local-operator-ui 0.36.0 → 0.36.2
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 +3761 -6
- package/out/preload/index.js +224 -4
- package/out/renderer/assets/{_basePickBy-SGLOphwb.js → _basePickBy-CcO6nPxQ.js} +1 -1
- package/out/renderer/assets/{_baseUniq-BEXNc7x-.js → _baseUniq-BH2uaUcG.js} +1 -1
- package/out/renderer/assets/{agent-details-page-DV2yIuv2.js → agent-details-page-B3JXwv1Q.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-CUbsvyOV.js → agent-hub-page-DKgp42Gz.js} +1 -1
- package/out/renderer/assets/{agents-page-HlZ3bxUE.js → agents-page-Bcgw5NaE.js} +3 -3
- package/out/renderer/assets/{arc-C8xiXz_s.js → arc-yBH7h1fW.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DPp-Txy7.js → architectureDiagram-IEHRJDOE-CHBovRWu.js} +1 -1
- package/out/renderer/assets/arrow-up-Di0VTM6O.js +6 -0
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-D_d0BHII.js → blockDiagram-JOT3LUYC-vW3btTHI.js} +1 -1
- package/out/renderer/assets/{book-open-DTOZBzFE.js → book-open-BklxnVnC.js} +1 -1
- package/out/renderer/assets/browser-page-dbyV2lDa.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-BK-iloiA.js → browser-webauthn-prompt-BVQVtCyj.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-C6MJyQ4X.js → c4Diagram-VJAJSXHY-B-omeKTH.js} +1 -1
- package/out/renderer/assets/channel-DseeJDH6.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-DaoR7E6u.js → chunk-4BMEZGHF-DbogYOtn.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-kSoJEGtH.js → chunk-A2AXSNBT-B99o2tMG.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-CbuETRiF.js → chunk-AEK57VVT-BHrb34eS.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-VgQyUEwk.js → chunk-D6G4REZN-COYEuoan.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-CC9D19Ws.js → chunk-RZ5BOZE2-D3q2lYwW.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-rHyhcY1z.js → chunk-XZIHB7SX-CvTfujhG.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-D-Nl2hgf.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-D-Nl2hgf.js +1 -0
- package/out/renderer/assets/clone-DYXRTfEl.js +1 -0
- package/out/renderer/assets/{console-mirror-C_vErGtg.js → console-mirror-BThuJoo1.js} +1 -1
- package/out/renderer/assets/{consoleCapture-BSMsAadm.js → consoleCapture-B6L7nb-J.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-D8m_0i2P.js → conversation-input-sync-Csq2qdm5.js} +259 -259
- package/out/renderer/assets/{dagre-OKDRZEBW-dnMavWL5.js → dagre-OKDRZEBW-CvnmuVIi.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-CbEqpT5c.js → diagram-SSKATNLV-DUkL0seE.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-CVFcaRWG.js → diagram-VNBRO52H-DYQJ-990.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-c4T4ZMVa.js → erDiagram-Q7BY3M3F-CQWWLpWe.js} +1 -1
- package/out/renderer/assets/{error-boundary-5hn9OWCr.js → error-boundary-D1EdrZoj.js} +2 -2
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DONfRBhn.js → flowDiagram-4HSFHLVR-CHWTC3wr.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-Cp9mKyj3.js → ganttDiagram-APWFNJXF-CbYaNbcy.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-qDIZQ2Xn.js → gitGraphDiagram-7IBYFJ6S-Dz5fATwZ.js} +1 -1
- package/out/renderer/assets/{graph-DxzSxuLT.js → graph-B4lGCZmF.js} +1 -1
- package/out/renderer/assets/index-BqKNVosC.js +57 -0
- package/out/renderer/assets/{index-By5U6kgU.js → index-C6uEPUVY.js} +211 -206
- package/out/renderer/assets/index-CU8sWhx0.css +1 -0
- package/out/renderer/assets/{index-CSR2j15s.js → index-CcD0LA0Q.js} +1 -1
- package/out/renderer/assets/{index-BUDP0pmc.js → index-DhrqAKsM.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-DMwjGTFV.js → infoDiagram-PH2N3AL5-CosR91M9.js} +1 -1
- package/out/renderer/assets/{installer-C6aKiv4n.js → installer-JTz2AD89.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-D1rmFkrM.js → journeyDiagram-U35MCT3I-DTj6yC5Y.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-CqK-A_YR.js → kanban-definition-NDS4AKOZ-fHLLpfWW.js} +1 -1
- package/out/renderer/assets/{layout-D4krH14D.js → layout-BUgJgJ17.js} +1 -1
- package/out/renderer/assets/legacy-agents-page-CSbcJE7R.js +33 -0
- package/out/renderer/assets/library-page-97CGidrj.js +162 -0
- package/out/renderer/assets/{mermaid.core-CrL8DoR1.js → mermaid.core-DXWoCulQ.js} +5 -5
- package/out/renderer/assets/mesh-page-CYwyEdW1.js +1 -0
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-C-gUOB1I.js → mindmap-definition-ALO5MXBD-C_r984Dl.js} +1 -1
- package/out/renderer/assets/{mini-onfDilHt.js → mini-B2a0S_aA.js} +1 -1
- package/out/renderer/assets/{notebook-pen-Btzx7ygD.js → notebook-pen-BeIeIauS.js} +1 -1
- package/out/renderer/assets/{org-access-BEUGBi3r.js → org-access-B4PFRWtx.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-D09m9wPe.js → org-surface-gate-OZbS0xfm.js} +1 -1
- package/out/renderer/assets/{page-header-CKQX5mld.js → page-header-3Jm521kq.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-Drlcy994.js → pieDiagram-IB7DONF6-pPG5qJ25.js} +1 -1
- package/out/renderer/assets/{projects-page-B6hrFCYu.js → projects-page-UaamBIPv.js} +12 -17
- package/out/renderer/assets/{publication-validation-CcRMJVIV.js → publication-validation-r9TKDPj_.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BiVOkk5-.js → quadrantDiagram-7GDLP6J5-LLUiR4wo.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-DJQQ5bto.js → radar-MK3ICKWK-DfSMH1dj.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BXlyZYxA.js → radient-auth-buttons-CEuhoAow.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BuTsJfL4.js → requirementDiagram-KVF5MWMF-DhHfvb40.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-D-tl8j-V.js → sankeyDiagram-QLVOVGJD-DURUf6SV.js} +1 -1
- package/out/renderer/assets/{schedules-page-DrwIsOtA.js → schedules-page-DiiamPZ_.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-NqOQh-1X.js → sequenceDiagram-X6HHIX6F-DTfgNRPc.js} +1 -1
- package/out/renderer/assets/settings-page-C3aXNJLk.js +287 -0
- package/out/renderer/assets/smartart-Dx8zw2rK.js +1 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-CbnDiKHd.js → stateDiagram-DGXRK772-Cp2owgQE.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DD26TncZ.js +1 -0
- package/out/renderer/assets/tags-input-chips-Dwb2Ojmj.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-C8_-K0jE.js → timeline-definition-BDJGKUSR-112iCByD.js} +1 -1
- package/out/renderer/assets/ui-preferences-store-CfAtSgON.js +1 -0
- package/out/renderer/assets/{use-download-agent-mutation-C2YV-ZqZ.js → use-download-agent-mutation-BGMZQ6m9.js} +1 -1
- package/out/renderer/assets/{use-memberships-query-CE1RS6l9.js → use-memberships-query-Bz3KIW6D.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-tK5pFJpN.js → use-session-snapshot-C3LrO077.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DxygsIwk.js → xychartDiagram-VJFVF3MP-BfqNCG-d.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +3 -2
- package/out/renderer/assets/browser-page-CeOP0TxL.js +0 -1
- package/out/renderer/assets/channel-FnsvGBvN.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-B1qeThzW.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-B1qeThzW.js +0 -1
- package/out/renderer/assets/clone-CEyxkG_K.js +0 -1
- package/out/renderer/assets/index-DlJQQpdf.css +0 -1
- package/out/renderer/assets/index-Dom8jp4B.js +0 -57
- package/out/renderer/assets/legacy-agents-page-kqMeTGcp.js +0 -33
- package/out/renderer/assets/mesh-page-CM48PCe9.js +0 -1
- package/out/renderer/assets/settings-page-D35Ls2IS.js +0 -287
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CAGVkdpP.js +0 -1
- package/out/renderer/assets/ui-preferences-store-Dz1d9H9b.js +0 -1
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
import{r as d,t as n,d as Le,j as t,c as M}from"./index-
|
|
1
|
+
import{r as d,t as n,d as Le,j as t,c as M}from"./index-BqKNVosC.js";import{cf as Tn,cg as Ht,ch as Rn,bU as xr,u as br,ci as Dn,cj as An,ck as On,cl as Pn,cm as Mn,cn as In,co as As,cp as Os,cq as Ln,cr as Fn,C as us,aK as Fe,d as pe,bZ as qn,D as ds,cs as V,ct as yt,cu as Un,Z as Rt,cv as Ps,cw as Ms,cx as Is,bI as Bn,aL as je,cy as $n,a as Je,c as he,aW as yr,aN as Dt,a3 as dt,aR as Ye,cz as zn,c0 as Gn,cb as Yn,cA as Hn,cc as Kn,aT as vr,aS as vt,bl as Wn,aB as Vn,ar as kt,bu as Qn,bA as Xn,bz as Jn,bx as Ls,ce as Zn,c2 as kr,b$ as ea,c1 as ta,a4 as le,cB as sa,cC as ra,cD as na,cE as aa,cF as oa,cG as wr,aM as ia,aq as ca,al as la,am as ua,ao as da,ap as pa,as as ma,ay as _a,cH as fa,cI as Nr,bE as ja,cJ as ha,aA as ga,aO as xa,aX as ba}from"./conversation-input-sync-Csq2qdm5.js";import{c as At,u as L,F as He,m as Ot,G as Ke,H as We,J as Ve,K as Re,a as z,r as ps,s as ms,S as Se,t as _s,x as Ne,a5 as ya,a6 as va,a7 as ka,ab as wa,ac as Na,w as Sa,B as xe,a1 as fs,ad as js,a3 as hs,I as oe,X as Pt,h as gs,T as Sr,L as ue,N as Cr,C as Er,A as Kt,O as Ca,Y as Ea,Z as Ta,_ as Ra,l as $e}from"./error-boundary-D1EdrZoj.js";import{P as Fs}from"./page-header-3Jm521kq.js";import{b5 as Tr,bp as Da,bd as Rr,bq as Aa,be as Oa,aR as Pa,a as it,A as qs,br as Us,bo as Ma}from"./index-C6uEPUVY.js";import{h as Ia,j as La,k as Qe,l as Fa,m as Wt}from"./ui-preferences-store-CfAtSgON.js";import{u as qa}from"./use-session-snapshot-C3LrO077.js";import{A as Dr}from"./arrow-up-Di0VTM6O.js";import"./console-mirror-BThuJoo1.js";function Bs(e,s){return e.filter(r=>!s.includes(r))}function Ua(e,s,r){const a=e.slice(0);return a[s]=r,a}var Ba=class extends Tn{#r;#e;#n;#a;#t;#s;#o;#i;#c=[];constructor(e,s,r){super(),this.#r=e,this.#a=r,this.#n=[],this.#t=[],this.#e=[],this.setQueries(s)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(s=>{this.#p(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.#a=s,Ht.batch(()=>{const r=this.#t,a=this.#d(this.#n);this.#c=a,a.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions));const o=a.map(c=>c.observer),i=o.map(c=>c.getCurrentResult()),l=o.some((c,u)=>c!==r[u]);r.length===o.length&&!l||(this.#t=o,this.#e=i,this.hasListeners()&&(Bs(r,o).forEach(c=>{c.destroy()}),Bs(o,r).forEach(c=>{c.subscribe(u=>{this.#p(c,u)})}),this.#m()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,s){const r=this.#d(e),a=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions));return[a,o=>this.#u(o??a,s),()=>this.#l(a,r)]}#l(e,s){return s.map((r,a)=>{const o=e[a];return r.defaultedQueryOptions.notifyOnChangeProps?o:r.observer.trackResult(o,i=>{s.forEach(l=>{l.observer.trackProp(i)})})})}#u(e,s){return s?((!this.#s||this.#e!==this.#i||s!==this.#o)&&(this.#o=s,this.#i=this.#e,this.#s=Rn(this.#s,s(e))),this.#s):e}#d(e){const s=new Map(this.#t.map(a=>[a.options.queryHash,a])),r=[];return e.forEach(a=>{const o=this.#r.defaultQueryOptions(a),i=s.get(o.queryHash);i?r.push({defaultedQueryOptions:o,observer:i}):r.push({defaultedQueryOptions:o,observer:new xr(this.#r,o)})}),r}#p(e,s){const r=this.#t.indexOf(e);r!==-1&&(this.#e=Ua(this.#e,r,s),this.#m())}#m(){if(this.hasListeners()){const e=this.#s,s=this.#l(this.#e,this.#c),r=this.#u(s,this.#a?.combine);e!==r&&Ht.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}};function $a({queries:e,...s},r){const a=br(r),o=Dn(),i=An(),l=d.useMemo(()=>e.map(v=>{const g=a.defaultQueryOptions(v);return g._optimisticResults=o?"isRestoring":"optimistic",g}),[e,a,o]);l.forEach(v=>{On(v),Pn(v,i)}),Mn(i);const[c]=d.useState(()=>new Ba(a,l,s)),[u,m,p]=c.getOptimisticResult(l,s.combine),f=!o&&s.subscribed!==!1;d.useSyncExternalStore(d.useCallback(v=>f?c.subscribe(Ht.batchCalls(v)):In,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),d.useEffect(()=>{c.setQueries(l,s)},[l,s,c]);const _=u.some((v,g)=>As(l[g],v))?u.flatMap((v,g)=>{const h=l[g];if(h){const y=new xr(a,h);if(As(h,v))return Os(h,y,i);Ln(v,o)&&Os(h,y,i)}return[]}):[];if(_.length>0)throw Promise.all(_);const x=u.find((v,g)=>{const h=l[g];return h&&Fn({result:v,errorResetBoundary:i,throwOnError:h.throwOnError,query:a.getQueryCache().get(h.queryHash),suspense:h.suspense})});if(x?.error)throw x.error;return m(p())}/**
|
|
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 za=[["path",{d:"
|
|
6
|
+
*/const za=[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ga=At("calendar-off",za);/**
|
|
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 Ya=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Ha=At("list-filter",Ya);/**
|
|
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
|
|
16
|
+
*/const Ka=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]],Wa=At("message-square-more",Ka);/**
|
|
17
17
|
* @license lucide-react v0.507.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const Wa=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]],Va=pt("message-square-more",Wa);/**
|
|
22
|
-
* @license lucide-react v0.507.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Qa=[["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"}]],Xa=pt("unlink",Qa),Mt={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function Ja(e){return us({queryKey:Mt.list,enabled:e,queryFn:()=>pe({op:"projects.list"}).then(s=>s.projects),retry:ds,staleTime:1e4})}function Za(e,s){return $a({queries:e.map(r=>({queryKey:Mt.detail(r),enabled:s&&!!r,queryFn:()=>pe({op:"projects.get",key:r}),retry:ds,staleTime:1e4}))})}function Ar(e,s){return us({queryKey:Mt.detail(e??""),enabled:s&&!!e,queryFn:()=>pe({op:"projects.get",key:e??""}),retry:ds,staleTime:1e4})}function qe(){const e=br();return()=>{e.invalidateQueries({queryKey:Mt.list})}}function eo(){const e=qe();return Fe({mutationFn:s=>pe({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 Or(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:qn,onSuccess:()=>e()})}function Pr(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function to(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function so(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function ro(){const e=qe();return Fe({mutationFn:s=>pe({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 no(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const Mr={planning:{get label(){return n("ui.projects.project_model.planning")},variant:"info"},active:{get label(){return n("ui.projects.project_model.active")},variant:"accent"},qa:{get label(){return n("ui.projects.project_model.qa")},variant:"attention"},validation:{get label(){return n("ui.projects.project_model.validation")},variant:"warning"},done:{get label(){return n("ui.projects.project_model.done")},variant:"success"},paused:{get label(){return n("ui.projects.project_model.paused")},variant:"neutral"},archived:{get label(){return n("ui.projects.project_model.archived")},variant:"outline"}},ze=Object.keys(Mr);function se(e){return Mr[e]??{label:e||n("ui.projects.project_model.unknown"),variant:"neutral"}}const Ir=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:se(e).label}));function ao(e){return e==="done"}const oo={completed:{get label(){return n("ui.projects.project_model.completed")},variant:"success"},overdue:{get label(){return n("ui.projects.project_model.overdue")},variant:"warning"},upcoming:{get label(){return n("ui.projects.project_model.upcoming")},variant:"neutral"}};function io(e){return oo[e]??{label:String(e),variant:"neutral"}}Le["ui.projects.project_model.stale"];const co=/^(\d{4})-(\d{2})-(\d{2})$/;function De(e,s,r=new Date){if(!e)return"";const a=co.exec(e);if(!a)return e;const o=new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));if(Number.isNaN(o.getTime()))return e;const i=vt(o,{month:"short",day:"numeric"},s);return o.getFullYear()===r.getFullYear()?i:vt(o,{month:"short",day:"numeric",year:"numeric"},s)}function mt(e,s){if(e==null)return"";const r=Math.max(0,Math.floor(s/1e3-e));return r<60?n("ui.projects.project_model.just_now"):r<3600?`${V(Math.floor(r/60),{useGrouping:!1})}m`:r<86400?`${V(Math.floor(r/3600),{useGrouping:!1})}h`:`${V(Math.floor(r/86400),{useGrouping:!1})}d`}function _t(e){return e===n("ui.projects.project_model.just_now")?n("ui.projects.project_model.just_now"):n("ui.projects.project_model.age_ago",{age:String(e)})}function lo(e){return e?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(_t(e))}):n("ui.projects.project_model.no_progress")}const Lr=/^$|^\d{4}-\d{2}-\d{2}$/;function Fr(e){return e?e==="operator"?n("ui.projects.project_model.the_operator"):n("ui.projects.project_model.session_reportedby",{reportedBy:String(e)}):""}function uo(e,s){if(!e.progress)return n("ui.projects.project_model.not_reported_yet");const r=mt(e.progress_updated_at,s),a=Fr(e.progress_reported_by),o=[r?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(_t(r))}):"reported"];return a&&o.push(n("ui.projects.project_model.by_reporter",{reporter:String(a)})),o.join(" ")}function qr(e,s){if(e==null)return"";const r=V(e,{useGrouping:!1,maximumFractionDigits:20});return s==="points"?n("ui.projects.project_model.value_pt",{value:String(r)}):s==="days"?n("ui.projects.project_model.value_d",{value:String(r)}):r}function Ur(e,s){return s<=0?"":n("ui.projects.project_model.completed_total",{completed:V(e,{useGrouping:!1}),total:V(s,{useGrouping:!1})})}function xs(e){return e<=0?"":n("ui.projects.project_model.live_live",{live:e})}function po(e){return e<=0?"":n("ui.projects.count.session",{count:e})}function mo(e){return n("ui.projects.count.project",{count:e})}function _o(e){const s=po(e.sessions);if(!s)return"";const r=xs(e.live_sessions);return r?n("ui.projects.project_model.count_live",{count:String(s),live:String(r)}):s}function fo(e){if(!e.exists)return{get label(){return n("ui.projects.project_model.missing")},variant:"outline"};if(e.archived)return{get label(){return n("ui.projects.project_model.archived")},variant:"neutral"};switch(e.runtime?.state){case"live":return{get label(){return n("ui.projects.project_model.live")},variant:"success"};case"wedged":return{get label(){return n("ui.projects.project_model.wedged")},variant:"warning"};case"stale":return{get label(){return n("ui.projects.project_model.stale")},variant:"warning"};case"stopped":return{get label(){return n("ui.projects.project_model.stopped")},variant:"neutral"};default:return{label:String(e.runtime?.state??n("ui.projects.project_model.unknown")),variant:"neutral"}}}function jo(e){return e?e.running>0?n("ui.projects.count.subagent_running",{count:e.running}):n("ui.projects.count.subagent",{count:e.settled}):""}function ho(e){return e?n("ui.projects.count.todo",{count:e.total}):""}function Br(e,s){const r=[],a=De(e.completed_at??e.target_date,s);a&&r.push({key:e.completed_at?"completed":"target",text:e.completed_at?n("ui.projects.project_model.completed_day",{day:String(a)}):n("ui.projects.project_model.due_day",{day:String(a)})});const o=qr(e.estimate,e.estimate_unit);o&&r.push({key:"estimate",text:o});const i=Ur(e.milestones_completed,e.milestones_total);i&&r.push({key:"milestones",text:n("ui.projects.project_model.milestones_milestones",{milestones:String(i)})});const l=xs(e.live_sessions);return l&&r.push({key:"live",text:l}),r}const Ge=864e5,go=/^(\d{4})-(\d{2})-(\d{2})$/;function ge(e){if(!e)return null;const s=go.exec(e);if(!s)return null;const r=Number(s[1]),a=Number(s[2]),o=Number(s[3]),i=Date.UTC(r,a-1,o),l=new Date(i);return l.getUTCFullYear()!==r||l.getUTCMonth()!==a-1||l.getUTCDate()!==o?null:i}const Vt=["planning","active","qa","validation","done"],Qt=["paused","archived"],It=[{value:"24h",get label(){return n("ui.projects.project_model.last_24_hours")},get phrase(){return n("ui.projects.project_model.the_last_24_hours")},seconds:86400},{value:"7d",get label(){return n("ui.projects.project_model.last_7_days")},get phrase(){return n("ui.projects.project_model.the_last_7_days")},seconds:604800},{value:"30d",get label(){return n("ui.projects.project_model.last_30_days")},get phrase(){return n("ui.projects.project_model.the_last_30_days")},seconds:2592e3},{value:"90d",get label(){return n("ui.projects.project_model.last_90_days")},get phrase(){return n("ui.projects.project_model.the_last_90_days")},seconds:7776e3},{value:"all",get label(){return n("ui.projects.project_model.all_time")},phrase:null,seconds:null}],$r="7d",xo=It.find(e=>e.value===$r);function zr(e){return It.find(s=>s.value===e)??xo}function bo(e){return It.some(s=>s.value===e)}function $s(e,s,r){const a=zr(s);return a.seconds===null?e:e.filter(o=>r/1e3-o.updated_at<=a.seconds)}function yo(e){const s=zr(e);return s.seconds===null?null:n("ui.projects.project_model.nothing_changed_in_phrase",{phrase:String(s.phrase)})}const Gr="projects-board-window";function vo(){try{const e=localStorage.getItem(Gr);if(e!==null&&bo(e))return e}catch{}return $r}function zs(e){try{localStorage.setItem(Gr,e)}catch{}}const Yr="projects-board-column-order";let Xt=null;function ko(){if(Xt)return[...Xt];try{const e=localStorage.getItem(Yr);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const r=[];for(const a of s){if(typeof a!="string"||a.length===0)return[];r.includes(a)||r.push(a)}return r}catch{return[]}}function wo(e){Xt=[...e];try{localStorage.setItem(Yr,JSON.stringify(e))}catch{}}function No(e,s,r){const a=e.filter(i=>i!==s),o=Math.max(0,Math.min(r,a.length));return a.splice(o,0,s),a}function So(e,s=[]){const r=new Map;for(const c of e){const u=r.get(c.status)??[];u.push(c),r.set(c.status,u)}const a=Vt.map(c=>({status:c,projects:r.get(c)??[]}));for(const c of Qt){const u=r.get(c)??[];u.length>0&&a.push({status:c,projects:u})}for(const[c,u]of r)!Qt.includes(c)&&!Vt.includes(c)&&a.push({status:c,projects:u});if(s.length===0)return a;const o=new Map(s.map((c,u)=>[c,u])),i=a.filter(c=>o.has(c.status));i.sort((c,u)=>(o.get(c.status)??0)-(o.get(u.status)??0));const l=a.filter(c=>!o.has(c.status));return[...i,...l]}function Hr(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const r=ge(e.target_date);return r===null?!1:r<s}function X(e){return e.title||e.name}Le["ui.projects.project_model.no_team"];function ft(e){const s=e.team?.trim();if(s)return s;const r=e.owner?.trim();return r||null}function bs(e,s){const r=new Map,a=[];for(const i of e){const l=s(i);if(l===null){a.push(i);continue}const c=r.get(l);c?c.push(i):r.set(l,[i])}const o=[...r.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return a.length>0&&o.push({team:null,items:a}),o}function Lt(e){return e.title||e.session_id}function Co(e){return[...e].reverse()}function Eo(e){return e<=0?"":n("ui.projects.count.update",{count:e})}const Gs=e=>String(e).padStart(2,"0");function Jt(e){return`${e.getFullYear()}-${Gs(e.getMonth()+1)}-${Gs(e.getDate())}`}function To(e){const s=Date.parse(e);return Number.isNaN(s)?"":Jt(new Date(s))}function Ro(e,s,r=new Date){if(!e)return"";if(e===Jt(r))return n("ui.projects.project_model.today");const a=new Date(r.getFullYear(),r.getMonth(),r.getDate()-1);return e===Jt(a)?n("ui.projects.project_model.yesterday"):De(e,s,r)}function Do(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":Un(new Date(r),{hour:"numeric",minute:"2-digit"},s)}function Ao(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":_t(mt(r/1e3,s))}function Oo(e,s,r=Date.now()){const a=[],o=Fr(e.by);o&&a.push({key:"author",text:o});const i=Do(e.at,s);i&&a.push({key:"time",text:i});const l=Ao(e.at,r);return l&&a.push({key:"age",text:l}),a}function Po(e,s,r=new Date){const a=[];for(const o of Co(e)){const i=To(o.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(o);continue}a.push({key:i,label:Ro(i,s,r),entries:[o]})}return a}function Mo(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 Io(e,s){return s<=0?"":`${e} of ${s} complete`}function Lo(e){let s=0,r=0,a=!1;for(const o of e)o.todos&&(a=!0,s+=o.todos.open,r+=o.todos.total);return a?{open:s,total:r}:null}function Ys(e){return`${e.open} open of ${e.total}`}function Fo(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function qo(e){const s=X(e),r=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${r}`,"Review the project details and continue or complete the work."].join(`
|
|
27
|
-
`)}function Uo(e){return e?e.kind==="team"?n("ui.projects.project_model.team_name",{name:String(e.name)}):n("ui.projects.project_model.agent_name",{name:String(e.name)}):""}const Bo=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Kr(e){const s=[];for(const r of e.matchAll(Bo))s.push((r[1]??r[2]??"").replace(/\\(.)/g,"$1"));return s}const yt=3;function ys(e){if(e.length<=yt+1)return e.length<=1?e.join(""):n("ui.projects.project_model.join_and_length_1",{join:String(e.slice(0,-1).join(", ")),length___1:String(e[e.length-1])});const s=e.length-yt;return n("ui.projects.project_model.join_and_hidden_more",{join:String(e.slice(0,yt).join(", ")),hidden:V(s,{useGrouping:!1})})}function vs(e){return n("ui.projects.count.milestones_are",{count:e})}const Hs="complete them, or pass force_done=true to close with them open",$o="complete or remove the incomplete milestones, then mark it done",Wr=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function jt(e){const s=e.match(Wr);if(s){const r=Number(s[1]),a=Kr(s[2]),o=a.length>0?ys(a):s[2];return n("ui.projects.project_model.this_can_t_be_marked_done_yet_milestonesare_count_still_incomplet",{milestonesAre_count:String(vs(r)),clause:String(o)})}return e.includes(Hs)?e.replace(Hs,$o):e}const zo="project_done_incomplete";function Go(e){const s=e.message.match(Wr),r=e.code===zo;if(!r&&!s)return null;const a=typeof e.detail=="object"&&e.detail!==null&&Array.isArray(e.detail.incomplete)?e.detail.incomplete.filter(l=>typeof l=="string"):null,o=a&&a.length>0?a:s?Kr(s[2]):[];return{count:o.length>0?o.length:s?Number(s[1]):0,names:o,coded:r,message:e.message}}function Yo(e){if(e.count>0){const s=ys(e.names);return n("ui.projects.project_model.count_still_open_clause_clause",{count:String(vs(e.count)),clause________clause:String(s?n("ui.projects.project_model.clause",{clause:String(s)}):"")})}return jt(e.message)||n("ui.projects.project_model.some_milestones_are_still_open")}function Ho(e){return e.count>0&&e.names.length>0?n("ui.projects.project_model.this_can_t_be_marked_done_yet_count_still_incomplete_names_comple",{count:String(vs(e.count)),names:String(ys(e.names))}):jt(e.message)||n("ui.projects.project_model.milestones_are_still_open_on_this_project_complete_or_remove_them")}function Vr(e,s,r){if(!e||e.forced_done!==!0)return n("ui.projects.project_model.moved_to_statuslabel",{statusLabel:String(r)});const a=typeof e.milestones_total=="number"&&typeof e.milestones_completed=="number"?e.milestones_total-e.milestones_completed:s,o=a>0?a:s;return n("ui.projects.count.moved_open",{status:r,open:o})}Le["ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"];function Qr(e){return e.trim().slice(0,Ia)}const Ko={get client(){return n("ui.projects.project_search.searches_names_descriptions_tags_owners_and_teams_update_text_is")},get backend(){return n("ui.projects.project_search.searches_names_descriptions_tags_owners_teams_and_update_text_cle")}},Wo=2,Vo=4,Qo=3,Xo=2,Jo=1,Zo=3,Pe={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},ei=/[^\p{L}\p{N}]+/u,ti=/\s+/;function Ks(e,s){const r=s.trim().toLowerCase();if(!r)return 0;if(r===e)return Vo;if(r.startsWith(e))return Qo;const a=r.split(ei).filter(Boolean),o=e.split(ti).filter(Boolean);if(o.length>0&&o.every(l=>a.some(c=>c.startsWith(l))))return Xo;const i=o.join("");return i.length>=Zo&&si(i,r)?Jo:0}function si(e,s){let r=0;for(const a of e){if(r=s.indexOf(a,r),r<0)return!1;r+=1}return!0}function ri(e,s){const r=s.trim().toLowerCase();if(!r)return 0;const a=[[e.title,Pe.title],[e.name,Pe.name],[e.description,Pe.description],[e.owner,Pe.attribution],[e.team,Pe.attribution],[e.status,Pe.status]];let o=0;for(const[i,l]of a){if(!i)continue;const c=Ks(r,i)*l;c>o&&(o=c)}for(const i of e.tags){const l=Ks(r,i)*Pe.tags;l>o&&(o=l)}return o}function ni(e,s){const r=s.trim();if(!r)return e;const a=[];for(const o of e){const i=ri(o,r);i>0&&a.push({project:o,score:i})}return a.sort((o,i)=>{if(o.score!==i.score)return i.score-o.score;if(o.project.updated_at!==i.project.updated_at)return i.project.updated_at-o.project.updated_at;const l=X(o.project).localeCompare(X(i.project),void 0,{sensitivity:"base"});if(l!==0)return l;const c=o.project.name.localeCompare(i.project.name,void 0,{sensitivity:"base"});return c!==0?c:o.project.id<i.project.id?-1:o.project.id>i.project.id?1:0}),a.map(o=>o.project)}function ai(e,s){if(s.length===0)return[];const r=new Map(e.map(o=>[o.id,o])),a=[];for(const o of s){const i=r.get(o.id);i!==void 0&&a.push(i)}return a}const oi=180;function ii(e,s){const r=Qr(e),a=Tr(r,oi),o=us({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>pe({op:"projects.search",q:a,limit:La}),retry:!1,staleTime:3e4}),i=a===r,l=i&&o.data&&o.data.query===r?o.data:null,c=i&&r.length>0&&!l&&o.isError;return{answer:l,pending:s&&r.length>0&&!l&&!c}}const Ze=["status","team","owner","tags","progress","target","estimate","milestones","live"],Ws={status:[],team:[],owner:[],tags:[],progress:[],target:[],estimate:[],milestones:[],live:[]},ot={get status(){return n("ui.projects.project_filters.status")},get team(){return n("ui.projects.project_filters.team")},get owner(){return n("ui.projects.project_filters.owner")},get tags(){return n("ui.projects.project_filters.tags")},get progress(){return n("ui.projects.project_filters.progress")},get target(){return n("ui.projects.project_filters.target_date")},get estimate(){return n("ui.projects.project_filters.estimate")},get milestones(){return n("ui.projects.project_filters.milestones")},get live(){return n("ui.projects.project_filters.live_sessions")}},ci=new Set(["status","progress","target","estimate","milestones","live"]),li={progress:["stale","up-to-date","not-reported"],target:["none","overdue","within-7","within-30"],estimate:["none","points","days"],milestones:["none","incomplete","complete"],live:["has-live","no-live"]},ui={get stale(){return n("ui.projects.project_filters.stale")},get"up-to-date"(){return n("ui.projects.project_filters.up_to_date")},get"not-reported"(){return n("ui.projects.project_filters.not_reported")},get none(){return n("ui.projects.project_filters.no_target_date")},get overdue(){return n("ui.projects.project_filters.overdue")},get"within-7"(){return n("ui.projects.project_filters.due_within_7_days")},get"within-30"(){return n("ui.projects.project_filters.due_within_30_days")},get points(){return n("ui.projects.project_filters.points")},get days(){return n("ui.projects.project_filters.days")},get incomplete(){return n("ui.projects.project_filters.incomplete")},get complete(){return n("ui.projects.project_filters.complete")},get"has-live"(){return n("ui.projects.project_filters.has_live_sessions")},get"no-live"(){return n("ui.projects.project_filters.no_live_sessions")}};function Xr(e,s){switch(e){case"status":return se(s).label;case"team":return s===null?n("ui.projects.project_filters.no_team"):s;case"owner":return s===null?n("ui.projects.project_filters.no_owner"):s;case"tags":return s??"";case"estimate":if(s==="none")return n("ui.projects.project_filters.no_estimate");break;case"milestones":if(s==="none")return n("ui.projects.project_filters.none_set");break;case"target":if(s==="none")return n("ui.projects.project_filters.no_target_date");break}return ui[s]??s??""}function di(e,s){return e[s].length>0}function ct(e){return Ze.every(s=>!di(e,s))}function pi(e){return Ze.reduce((s,r)=>s+e[r].length,0)}function Jr(e,s,r){const a=e[s],o=a.includes(r)?a.filter(i=>i!==r):[...a,r];return{...e,[s]:o}}function Zr(e,s,r,a){switch(e){case"status":return s.status===r;case"team":return ft(s)===r;case"owner":return(s.owner?.trim()||null)===r;case"tags":return s.tags.includes(r??"");case"progress":return r==="stale"?s.progress_stale===!0:r==="up-to-date"?s.progress_stale===!1:s.progress_updated_at===null;case"target":{if(r==="none")return ge(s.target_date)===null;if(r==="overdue")return Hr(s,a);const o=ge(s.target_date);if(o===null)return!1;const i=(o-a)/Ge;return r==="within-7"?i>=0&&i<=7:i>=0&&i<=30}case"estimate":return r==="none"?s.estimate===null:s.estimate===null?!1:r==="points"?s.estimate_unit==="points":s.estimate_unit==="days";case"milestones":return r==="none"?s.milestones_total===0:s.milestones_total===0?!1:r==="complete"?s.milestones_completed>=s.milestones_total:s.milestones_completed<s.milestones_total;case"live":return r==="has-live"?s.live_sessions>0:s.live_sessions===0}}function en(e,s,r,a){const o=e[s];return o.length===0?!0:o.some(i=>Zr(s,r,i,a))}function mi(e,s,r){return ct(s)?e:e.filter(a=>Ze.every(o=>en(s,o,a,r)))}function _i(e,s,r,a){return s.filter(o=>Ze.every(i=>i===e||en(r,i,o,a)))}function fi(e,s,r){const a=r[e];switch(e){case"status":{const i=[...new Set(s.map(c=>c.status))].filter(c=>!ze.includes(c)).sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"})),l=a.filter(c=>typeof c=="string"&&!ze.includes(c)&&!i.includes(c));return[...ze,...i,...l]}case"team":{const o=new Set;let i=!1;for(const c of s){const u=ft(c);u===null?i=!0:o.add(u)}for(const c of a)c===null?i=!0:o.add(c);const l=[...o].sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"owner":{const o=new Set;let i=!1;for(const c of s){const u=c.owner?.trim();u?o.add(u):i=!0}for(const c of a)c===null?i=!0:o.add(c);const l=[...o].sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"tags":{const o=new Set;for(const i of s)for(const l of i.tags)o.add(l);for(const i of a)o.add(i??"");return[...o].sort((i,l)=>i.localeCompare(l,void 0,{sensitivity:"base"}))}case"progress":case"target":case"estimate":case"milestones":case"live":return li[e]}}function tn(e,s,r,a){const o=_i(e,s,r,a),i=ci.has(e),l=[];for(const c of fi(e,o,r)){const u=r[e].includes(c),m=o.reduce((p,f)=>p+(Zr(e,f,c,a)?1:0),0);!i&&m===0&&!u||l.push({value:c,label:Xr(e,c),count:m,selected:u})}return{facet:e,label:ot[e],options:l}}function ji(e,s,r){return Ze.map(a=>tn(a,e,s,r))}const Zt="projects-sort";Le["ui.projects.project_sort.default_as_listed"];function hi(e){return gi.includes(e)}const gi=["name","status","target","estimate","milestones","live","progress"];function xi(){try{const e=localStorage.getItem(Zt);if(e===null)return null;const[s,r,...a]=e.split(":");if(a.length>0)return null;if(s&&hi(s)&&(r==="asc"||r==="desc"))return{key:s,direction:r}}catch{}return null}function bi(e){try{e===null?localStorage.removeItem(Zt):localStorage.setItem(Zt,`${e.key}:${e.direction}`)}catch{}}function Xe(e){switch(e){case"name":return n("ui.projects.project_sort.project");case"status":return n("ui.projects.project_sort.status");case"target":return n("ui.projects.project_sort.target");case"estimate":return n("ui.projects.project_sort.estimate");case"milestones":return n("ui.projects.project_sort.milestones");case"live":return n("ui.projects.project_sort.live");case"progress":return n("ui.projects.project_sort.progress")}}function Bt(e){return e==="target"||e==="progress"?"desc":"asc"}function ks(e,s){const r=s==="desc";switch(e){case"name":return r?n("ui.projects.project_sort.z_to_a"):n("ui.projects.project_sort.a_to_z");case"status":return r?n("ui.projects.project_sort.archived_first"):n("ui.projects.project_sort.planning_first");case"target":return r?n("ui.projects.project_sort.latest_first"):n("ui.projects.project_sort.soonest_first");case"estimate":return r?n("ui.projects.project_sort.days_first"):n("ui.projects.project_sort.points_first");case"milestones":return r?n("ui.projects.project_sort.most_complete_first"):n("ui.projects.project_sort.least_complete_first");case"live":return r?n("ui.projects.project_sort.most_first"):n("ui.projects.project_sort.fewest_first");case"progress":return r?n("ui.projects.project_sort.most_recent_first"):n("ui.projects.project_sort.most_stale_first")}}function yi(e){return e===null?n("ui.projects.project_sort.sort_cleared"):n("ui.projects.project_sort.sorted_by_key_direction",{key:String(Xe(e.key)),direction:String(ks(e.key,e.direction))})}function vi(e){const s=[e.search?"search":null,e.filters?"filters":null,e.sort?"sort":null].filter(a=>a!==null);if(s.length===0)return"";const r=s.length===1?n("ui.projects.project_sort.parts_0_cleared",{parts_0:String(s[0])}):n("ui.projects.project_sort.join_and_length_1_cleared",{join:String(s.slice(0,-1).join(", ")),length___1:String(s[s.length-1])});return r.charAt(0).toUpperCase()+r.slice(1)}function Vs(e,s){switch(e){case"name":return 0;case"status":return ze.includes(s.status)?0:1;case"target":return es(s)===null?1:0;case"estimate":return s.estimate===null?1:0;case"milestones":return s.milestones_total===0?1:0;case"live":return 0;case"progress":return s.progress_updated_at===null?1:0}}function es(e){return ge(e.completed_at??e.target_date)}function Qs(e){return e==="points"?0:e==="days"?1:2}function ki(e,s,r){switch(e){case"name":return X(s).localeCompare(X(r),void 0,{sensitivity:"base"});case"status":return ze.indexOf(s.status)-ze.indexOf(r.status);case"target":{const a=es(s)??0,o=es(r)??0;return a-o}case"estimate":{const a=Qs(s.estimate_unit)-Qs(r.estimate_unit);return a!==0?a:(s.estimate??0)-(r.estimate??0)}case"milestones":return s.milestones_completed*r.milestones_total-r.milestones_completed*s.milestones_total;case"live":return s.live_sessions-r.live_sessions;case"progress":return(s.progress_updated_at??0)-(r.progress_updated_at??0)}}function Xs(e,s){if(e.updated_at!==s.updated_at)return s.updated_at-e.updated_at;const r=X(e).localeCompare(X(s),void 0,{sensitivity:"base"});if(r!==0)return r;const a=e.name.localeCompare(s.name,void 0,{sensitivity:"base"});return a!==0?a:e.id<s.id?-1:e.id>s.id?1:0}function wi(e,s,r){const a=Vs(r.key,e),o=Vs(r.key,s);if(a!==o)return a-o;if(a===1)return Xs(e,s);const i=ki(r.key,e,s);return i!==0?r.direction==="desc"?-i:i:Xs(e,s)}function Ni(e,s){return[...e].sort((r,a)=>wi(r,a,s))}const Te=["day","week","month","quarter"],ws={day:24,week:9,month:3,quarter:1};function Ns(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function Me(e,s){return Math.round((s-e)/Ge)}function Js(e,s){return Me(e,s)+1}function Si(e,s){for(const r of Te)if(e*ws[r]<=s)return r;return Te[Te.length-1]}function Ci(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(r=>!!r.target_date)}function Ei(e,s){const r=[s];for(const a of e){for(const o of[a.project.start_date,a.project.target_date,a.project.completed_at]){const i=ge(o);i!==null&&r.push(i)}for(const o of a.milestones){const i=ge(o.target_date);i!==null&&r.push(i)}}return r.length===1?null:{startMs:Math.min(...r),endMs:Math.max(...r)}}function Ti(e){const s=[],r=[];for(const a of e)(Ci(a)?s:r).push(a);return{dated:s,undated:r}}function Ri(e){return n("ui.projects.count.undated",{count:e})}function Di(e){const{project:s}=e,r=ge(s.start_date),a=ge(s.target_date),o=ge(s.completed_at),i=s.status==="done"&&o!==null?o:a,l=r??i,c=i??r;return l===null||c===null?null:{fromMs:Math.min(l,c),toMs:Math.max(l,c)}}function Ai(e){const s=[];for(const r of e.milestones){const a=ge(r.target_date);a!==null&&s.push({name:r.name,dayMs:a,status:r.status})}return s}const $t=e=>vt(new Date(e),{month:"short",timeZone:"UTC"});function me(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Oi(e){const{year:s,month:r}=me(e);return Date.UTC(s,r-1,1)}function Pi(e){const{year:s,month:r}=me(e);return r===12?Date.UTC(s+1,0,1):Date.UTC(s,r,1)}function Mi(e){const{year:s,month:r}=me(e);return Date.UTC(s,Math.floor((r-1)/3)*3,1)}function Ii(e){const{year:s,month:r}=me(e),a=Math.floor((r-1)/3);return a===3?Date.UTC(s+1,0,1):Date.UTC(s,a*3+3,1)}function Li(e){const{weekday:s}=me(e);return e-(s+6)%7*Ge}const Fi=26;function qi(e,s,r){const a=[],o=(p,f,b)=>{p<e||p>s||a.push({dayMs:p,label:f,major:b})};if(r==="day"){let p=!1;for(let f=e;f<=s;f+=Ge){const{day:b}=me(f);b===1?(o(f,$t(f),!0),p=!0):p?(o(f,"",!1),p=!1):o(f,V(b,{useGrouping:!1}),!1)}return a}if(r==="week"){for(let p=Li(e);p<=s;p+=7*Ge){if(p<e)continue;const{day:f,month:b}=me(p);me(p-7*Ge).month!==b?o(p,vt(new Date(p),{month:"short",day:"numeric",timeZone:"UTC"}),!0):o(p,V(f,{useGrouping:!1}),!1)}return a}const i=r==="month"?Oi:Mi,l=r==="month"?Pi:Ii,c=p=>{const{year:f,month:b}=me(p);if(r==="month")return b===1&&f!==me(e).year?`${$t(p)} '${V(f%100,{minimumIntegerDigits:2,useGrouping:!1})}`:$t(p);const _=Math.floor((b-1)/3)+1;return _===1&&f!==me(e).year?`Q1 '${String(f%100).padStart(2,"0")}`:`Q${_}`};o(e,c(i(e)),!0);const u=Math.ceil(Fi/ws[r]);let m=e;for(let p=l(i(e));p<=s;p=l(p))Me(m,p)<u||(o(p,c(p),!0),m=p);return a}function lt(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}const Nt=80,St=80,Zs=64,er=8;function ts(e){return e.trim().length>Nt?n("ui.projects.project_edit_model.titles_are_at_most_value1_characters",{value1:Nt}):null}function sn(e){return e.length>Qe?n("ui.projects.project_edit_model.keep_the_description_within_value1_characters",{value1:Qe}):null}function Ct(e,s){return e.trim().length>St?n("ui.projects.project_edit_model.teams_are_at_most_value2_characters",{teams:String(s==="owner"?n("ui.projects.project_edit_model.owners"):n("ui.projects.project_edit_model.teams")),value2:St}):null}function ss(e){return Lr.test(e)?null:n("ui.projects.project_edit_model.dates_are_yyyy_mm_dd_or_empty")}function rs(e,s){return e&&s&&s<e?n("ui.projects.project_edit_model.the_target_date_is_before_the_start_date"):null}function rn(e){const s=e.trim();if(s==="")return null;const r=Number(s);return!Number.isFinite(r)||!(r>0)||r>1e3?n("ui.projects.project_edit_model.estimates_are_greater_than_0_and_at_most_1000"):null}function ns(e){const s=lt(e);if(s.length>er)return{tags:s,error:n("ui.projects.project_edit_model.up_to_project_tags_max_tags",{PROJECT_TAGS_MAX:er})};for(const r of s){const a=Fa(r);if(a)return{tags:s,error:a}}return{tags:s,error:null}}const Ui="project_name_exists";function tr(e){return e.code===Ui?n("ui.projects.project_edit_model.a_project_with_this_key_already_exists"):jt(e.message)||n("ui.projects.project_edit_model.the_project_was_not_saved")}function Bi(e,s){if(e.unit!==s.unit)return!1;const r=e.number.trim(),a=s.number.trim();return a===""?!0:r===""?!1:Number(r)===Number(a)}function $i(e,s){const r=lt(s);return r.length!==e.length?!1:r.every((a,o)=>a===e[o])}function zi(e,s){const r={},a=s.number.trim();if(a!==""){const o=Number(a);(e.estimate===null||e.estimate!==o)&&(r.estimate=o)}return s.unit!==e.unit&&(r.estimate_unit=s.unit),Object.keys(r).length>0?r:null}function et(e){return e instanceof Dt?tr({code:e.code,message:e.message}):tr({message:e instanceof Error?e.message:""})}function nn(e){return e instanceof Dt&&(e.code==="project_not_found"||e.status===404)}function an(e){return!(e instanceof Error)||!e.message?n("ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"):nn(e)?n("ui.projects.project_refusals.this_project_could_not_be_found_it_may_have_been_deleted"):et(e)}function on(e){if(!(e instanceof Error))return null;const s=e instanceof Dt?e:null;return Go({code:s?.code??null,message:e.message,detail:s?.detail})}async function Gi(e){try{return await e.move(),{kind:"accepted"}}catch(s){const r=on(s);return r?.coded&&e.forceDoneOffered&&e.claimQuestion()?{kind:"question",refusal:r}:{kind:"spoken",copy:r?Ho(r):an(s),refusal:r}}}Le["ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"];const Yi=({value:e,onChange:s})=>(L(),t.jsxs(He,{value:e,onValueChange:r=>s(r),children:[t.jsx(Ot,{content:e==="all"?null:n("ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"),side:"bottom",disableHoverableContent:!0,children:t.jsx(Ke,{"aria-label":n("ui.projects.board_window_select.projects_updated_within"),className:M("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(We,{})})}),t.jsx(Ve,{children:It.map(r=>t.jsx(Re,{value:r.value,children:r.label},r.value))})]})),as=6e4,os=6e3;Le["ui.projects.request_update.requesting_updates"];const Hi=400;Le["ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"];const Ki="linked but not yet in use — it becomes a recipient after the first message",sr=e=>`project-request-update-${e}`,Wi=e=>`project-request-cooldown-${e}`,Vi=e=>`project-request-update-cooldown-${e}`,zt=e=>e.length===1?e[0]:e.length===2?n("ui.projects.request_update.names_0_and_names_1",{names_0:String(e[0]),names_1:String(e[1])}):n("ui.projects.request_update.names_0_names_1_and_length_2_more",{names_0:String(e[0]),names_1:String(e[1]),length___2:V(e.length-2,{useGrouping:!1})}),rr=(e,s)=>e.sessions.filter(r=>r.outcome===s).map(r=>Lt({session_id:r.session_id,title:r.title})),Qi=e=>e.outcome==="failed"&&e.detail===Ki;function Et(e,s){const r=Math.max(1,Math.ceil(s/1e3)),a=Math.max(0,Math.ceil(as/1e3)-r);return n("ui.projects.request_update.update_already_requested_ago_s_ago_on_display_try_again_in_left_s",{ago:V(a,{useGrouping:!1}),display:String(e),left:V(r,{useGrouping:!1})})}function Xi(e){const s=X({title:e.project.title,name:e.project.key}),{delivered:r,unconfirmed:a,failed:o,total:i}=e.counts;if(e.state==="empty")return{variant:"info",title:n("ui.projects.request_update.no_linked_sessions_to_ask_link_a_session_to_display_first",{display:String(s)}),duration:os};if(e.state==="cooldown")return{variant:"info",title:Et(s,Math.max(0,e.cooldown_remaining_s??0)*1e3),duration:os};if(e.state!=="sent")return null;const l=rr(e,"failed"),c=rr(e,"unconfirmed");if(r>=1&&o===0&&a===0)return{variant:"success",title:n("ui.projects.request_update.delivered",{delivered:r,display:s})};if(r>=1){let u=n("ui.projects.request_update.requested_updates_from_delivered_of_total_sessions_on_display",{delivered:V(r,{useGrouping:!1}),total:i,display:String(s)});return o>0&&(u+=n("ui.projects.request_update.value1_could_not_be_reached",{value1:String(zt(l))})),a>0&&(u+=n("ui.projects.request_update.delivery_to_value1_could_not_be_confirmed",{value1:String(zt(c))})),{variant:"warning",title:u,duration:Number.POSITIVE_INFINITY}}if(o===0)return{variant:"warning",title:n("ui.projects.request_update.could_not_confirm_delivery_on_display_the_requests_may_still_reac",{display:String(s)}),duration:Number.POSITIVE_INFINITY};if(a===0){const u=e.sessions.every(Qi);let m;return u?m=n("ui.projects.request_update.never_started",{total:i}):m=n("ui.projects.request_update.could_not_reach_any_of_the_total_linked_sessions_on_display",{total:i,display:String(s)}),{variant:"error",title:m,duration:Number.POSITIVE_INFINITY}}return{variant:"warning",title:n("ui.projects.request_update.could_not_reach_failed_of_the_total_linked_sessions_on_display_de",{failed:V(o,{useGrouping:!1}),total:i,display:String(s),value4:String(zt(c))}),duration:Number.POSITIVE_INFINITY}}const at=new Map,Ss=new Set,Gt=new Map,is=new Set;let cn=0;const Tt=()=>{cn+=1;for(const e of is)e()},Ji=e=>(is.add(e),()=>{is.delete(e)}),nr=()=>cn,ln=e=>Ss.has(e),un=e=>at.get(e);function Zi(e){Ss.add(e),Tt()}function ec(e){Ss.delete(e),Tt()}function ar(e,s,r){const a=Date.now();if(r<=a)return;const o=at.get(e);if(o&&o.untilMs>=r)return;at.set(e,{startedMs:s,untilMs:r});const i=Gt.get(e);i&&clearTimeout(i);const l=setTimeout(()=>{Gt.delete(e);const c=at.get(e);c&&c.untilMs<=Date.now()&&(at.delete(e),Tt())},r-a);l.unref?.(),Gt.set(e,l),Tt()}const tc=e=>/[.!?…]$/.test(e)?e:`${e}.`;function sc(e,s){const r=Date.now();if(s.state==="cooldown"){const a=Math.max(0,s.cooldown_remaining_s??0)*1e3;ar(e,r-(as-a),r+a);return}s.state==="sent"&&(s.counts.delivered>=1||s.counts.unconfirmed>=1)&&ar(e,r,r+as)}async function rc(e){const s=e.id;if(ln(s)){Ps(n("ui.projects.request_update.requesting_updates"),{id:sr(s)});return}const r=Date.now(),a=un(s);if(a&&a.untilMs>r){Ms(Et(X(e),a.untilMs-r),{id:Wi(s),duration:os});return}Zi(s);const o=sr(s);let i=!1;const l=setTimeout(()=>{i=!0,Ps(n("ui.projects.request_update.requesting_updates"),{id:o})},Hi);try{const c=await pe({op:"projects.request_update",key:s});sc(s,c);const u=Xi(c);if(u){const m={id:o,...u.duration!==void 0?{duration:u.duration}:{}};switch(u.variant){case"success":je(u.title,m);break;case"warning":Bn(u.title,m);break;case"error":Is(u.title,m);break;default:Ms(u.title,m)}}else i&&$n(o)}catch(c){const u=c instanceof Error&&c.message.trim()!==""?c.message.trim():null;Is(u?n("ui.projects.use_request_update.could_not_request_updates_endedsentence_message",{endedSentence_message:String(tc(u))}):n("ui.projects.use_request_update.the_request_could_not_be_confirmed"),{id:o,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),ec(s)}}function dn(){return d.useCallback(e=>{rc(e)},[])}function nc(e){d.useSyncExternalStore(Ji,nr,nr);const s=ln(e),r=un(e),a=r!==void 0?r.untilMs-Date.now():0,o=a>0;return{sending:s,cooling:o,cooldownRemainingMs:o?a:null}}const or={get active(){return n("ui.projects.project_board.in_flight")},get paused(){return n("ui.projects.project_board.on_hold")},get done(){return n("ui.projects.project_board.finished")}};function ac(){const[e,s]=d.useState(null);return d.useEffect(()=>{if(!e)return;const r=document.querySelector(`[data-project-menu="${e}"]`);r&&(r.focus(),s(null))}),d.useCallback(r=>s(r),[])}const oc=4,ir="board-column-move-hint",ic=({projects:e,nowMs:s,onOpen:r,onEdit:a,onDelete:o,onMove:i,movingKeys:l=[],teamLabelFor:c=u=>u})=>{L();const[u,m]=d.useState(ko),p=So(e,u),f=bs(e,ft),[b,_]=d.useState(null),[x,v]=d.useState(""),g=d.useRef(null),h=d.useRef(null),y=d.useRef(null),T=d.useRef(null),w=d.useRef(null),U=new Set(l),C=(k,N)=>{const D=No(p.map(F=>F.status),k,N);m(D),wo(D),v(n("ui.projects.project_board.moved_label_column_to_position_indexof_status_1_of_length",{label:String(se(k).label),indexOf_status____1:String(D.indexOf(k)+1),length:V(D.length,{useGrouping:!1})}))},E=(k,N)=>{const D=g.current;if(!D)return 0;let F=0;const B=D.querySelectorAll("[data-board-column]");for(const $ of B){if($.dataset.boardColumn===N)continue;const ie=$.getBoundingClientRect();k>(ie.left+ie.right)/2&&(F+=1)}return F},P=(k,N)=>{const D=p.filter($=>$.status!==k),F=D[N-1]?.status,B=D[N]?.status;return F&&B?n("ui.projects.project_board.between_label_and_label_2",{label:String(se(F).label),label_2:String(se(B).label)}):B?n("ui.projects.project_board.before_label",{label:String(se(B).label)}):F?n("ui.projects.project_board.after_label",{label:String(se(F).label)}):n("ui.projects.project_board.in_place")},j=(k,N)=>{const D=E(k,N.status);D!==N.over&&(N.over=D,_({status:N.status,over:D}),v(n("ui.projects.project_board.moving_label_column_it_will_drop_status_over",{label:String(se(N.status).label),status__over:String(P(N.status,D))})))},O=()=>{T.current!==null&&(cancelAnimationFrame(T.current),T.current=null)},R=32,I=12,Y=()=>{T.current=null;const k=w.current,N=g.current,D=y.current;if(!k?.armed||!N||D===null)return;const F=N.getBoundingClientRect(),B=N.scrollWidth-N.clientWidth;let $=0;if(D-F.left<R&&N.scrollLeft>0?$=-1:F.right-D<R&&N.scrollLeft<B&&($=1),$!==0){const ie=N.scrollLeft;N.scrollLeft=ie+$*I,N.scrollLeft!==ie&&j(D,k)}else j(D,k);Z(k.status,k.over),T.current=requestAnimationFrame(Y)};d.useEffect(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},[]);const q=(k,N)=>{if(k.button===0){try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}w.current={pointerId:k.pointerId,status:N,startX:k.clientX,startY:k.clientY,armed:!1,over:p.findIndex(D=>D.status===N)},y.current=k.clientX}},G=k=>{const N=w.current;if(!(!N||k.pointerId!==N.pointerId)){if(y.current=k.clientX,!N.armed){if(Math.hypot(k.clientX-N.startX,k.clientY-N.startY)<oc)return;N.armed=!0,_({status:N.status,over:N.over}),v(n("ui.projects.project_board.moving_label_column",{label:String(se(N.status).label)})),T.current===null&&(T.current=requestAnimationFrame(Y))}j(k.clientX,N)}},W=k=>{const N=w.current;if(w.current=null,O(),_(null),!N?.armed)return;if(!k){v(n("ui.projects.project_board.move_cancelled"));return}const D=p.findIndex(F=>F.status===N.status);if(N.over===D){v("");return}C(N.status,N.over)},J=k=>{const N=w.current;!N||k.pointerId!==N.pointerId||W(!0)},de=()=>{W(!1)};d.useEffect(()=>{if(!b)return;const k=N=>{N.key==="Escape"&&W(!1)};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[b!==null]);const Z=d.useCallback((k,N)=>{const D=g.current,F=h.current;if(!D||!F)return;const B=D.getBoundingClientRect(),$=[];for(const ce of D.querySelectorAll("[data-board-column]"))ce.dataset.boardColumn!==k&&$.push(ce.getBoundingClientRect());const ie=6,Ae=N>=$.length?($[$.length-1]?.right??B.left)+ie:($[N]?.left??B.right)-ie,H=D.scrollLeft,Ce=2,be=Ae-B.left+H,fe=H+1,te=H+B.width-Ce-1,Oe=Math.round(Math.min(Math.max(be,fe),Math.max(fe,te)));F.style.left=`${Oe}px`},[]);d.useLayoutEffect(()=>{b&&Z(b.status,b.over)},[b,Z]);const ee=(k,N)=>{if(k.key==="Enter"||k.key===" "){k.preventDefault(),v(n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"));return}if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const D=p.map($=>$.status),F=D.indexOf(N),B=k.key==="ArrowLeft"?F-1:F+1;if(B<0||B>=D.length){v(n("ui.projects.project_board.label_column_is_already_the_last_column",{label:String(se(N).label),the_last_column:String(B<0?n("ui.projects.project_board.the_first_column"):n("ui.projects.project_board.the_last_column"))}));return}C(N,B)};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:x}),t.jsx("span",{id:ir,className:"sr-only",children:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column")}),t.jsxs("div",{ref:g,"data-board-strip":"",className:M("relative flex min-h-0 flex-1 items-start overflow-auto px-6 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:h,"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:p.map(k=>{const N=se(k.status);return t.jsxs("header",{"data-board-column":k.status,"data-glass-lane":"","data-board-column-handle":k.status,onPointerDown:D=>q(D,k.status),onPointerMove:G,onPointerUp:J,onPointerCancel:de,className:M("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===k.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(z,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":k.status,"aria-label":n("ui.projects.project_board.move_label_column",{label:String(N.label)}),"aria-describedby":ir,title:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"),className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:D=>ee(D,k.status),children:t.jsx(Da,{"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:N.label}),or[k.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:or[k.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:k.projects.length})]},k.status)})}),f.map(k=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":k.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:k.team==null?n("ui.projects.project_model.no_team"):c(k.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:k.items.length})]})}),t.jsx("div",{"data-glass-lane":"",className:"flex gap-3 rounded-md bg-sunken py-2",children:p.map(N=>{const D=k.items.filter(F=>F.status===N.status);return t.jsx("div",{"data-board-cell":N.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:D.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:D.map(F=>t.jsx("li",{children:t.jsx(cc,{project:F,nowMs:s,busy:U.has(F.id),onOpen:()=>r(F),onEdit:()=>a(F),onDelete:()=>o(F),onMove:B=>i(F,B)})},F.id))})},N.status)})})]},k.team??""))]})]})]})},cc=({project:e,nowMs:s,busy:r,onOpen:a,onEdit:o,onDelete:i,onMove:l})=>{const c=L(),u=Br(e,c),m=Je(),p=dn(),f=he(m.data,"projects_request_update"),b=X(e),_=d.useRef(null),[x,v]=d.useState(!1);d.useEffect(()=>{const w=_.current;if(!w)return;const U=()=>{w.isConnected&&v(w.scrollWidth-w.clientWidth>.5)},C=requestAnimationFrame(U),E=new ResizeObserver(U);return E.observe(w),document.fonts?.ready.then(U).catch(()=>{}),()=>{cancelAnimationFrame(C),E.disconnect()}},[b,x]);const g=Hr(e,Ns(s)),h=mt(e.progress_updated_at,s),y=()=>{const w=window.getSelection();w&&!w.isCollapsed||a()},T=w=>{w.key!=="Enter"&&w.key!==" "||w.target===w.currentTarget&&(w.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":n("ui.projects.project_board.open_displayname",{displayName:String(b)}),onClick:y,onKeyDown:T,"data-glass-block":"",className:M("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",g&&"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(Ot,{content:x?b:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:_,"data-project-title":e.name,tabIndex:x?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:b})}),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(ps,{children:[t.jsx(ms,{"data-project-menu":e.id,"aria-label":n("ui.projects.project_board.actions_for_displayname",{displayName:String(b)}),disabled:r,onClick:w=>w.stopPropagation(),className:M("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:r?t.jsx(Se,{size:"xs"}):t.jsx(yr,{className:"size-4"})}),t.jsxs(_s,{align:"end",onClick:w=>w.stopPropagation(),children:[t.jsx(Ne,{onSelect:a,children:n("ui.projects.project_board.open")}),t.jsxs(ya,{children:[t.jsx(va,{children:n("ui.projects.project_board.set_status")}),t.jsx(ka,{children:t.jsx(wa,{value:e.status,onValueChange:l,children:[...Vt,...Qt].map(w=>t.jsx(Na,{value:w,children:se(w).label},w))})})]}),f&&t.jsx(Ne,{onSelect:()=>p(e),children:n("ui.projects.project_board.request_update")}),t.jsx(Sa,{}),t.jsx(Ne,{onSelect:o,children:n("ui.projects.project_board.edit")}),t.jsx(Ne,{onSelect:i,children:n("ui.projects.project_board.delete")})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u.filter(w=>w.key!=="live").map(w=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:w.text},w.key)),g&&t.jsx(xe,{variant:"warning",children:n("ui.projects.project_board.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:lo(h)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!h)&&t.jsx("span",{"aria-label":n("ui.projects.project_model.stale"),title:n("ui.projects.project_model.stale"),className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(lc,{project:e})]})]})]})},lc=({project:e})=>{L();const[s,r]=d.useState(!1),a=At(),o=Ar(e.id,s),i=o.data?.links??[],l=_o(e),c=X(e);return t.jsxs(fs,{open:s,onOpenChange:r,children:[t.jsx(js,{"data-project-sessions":e.id,"aria-label":n("ui.projects.project_board.sessions_linked_to_displayname",{displayName:String(c)}),onClick:u=>u.stopPropagation(),className:M("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(hs,{align:"end",className:"w-64 p-2 outline-none",onClick:u=>u.stopPropagation(),children:o.isLoading?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:n("ui.projects.project_board.loading_linked_sessions")}):o.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:o.error instanceof Error&&o.error.message?o.error.message:n("ui.projects.project_board.the_linked_sessions_could_not_be_read")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:()=>void o.refetch(),children:n("ui.projects.project_board.try_again")})]}):i.length===0?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:n("ui.projects.project_board.no_sessions_linked_yet")}):t.jsx("ul",{className:"flex flex-col",children:i.map(u=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!u.exists,onClick:()=>{u.exists&&(r(!1),Rr(a,u.session_id))},className:M("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",u.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:u.title||u.session_id})})},u.session_id))})})]})},pn=({open:e,projectName:s,onClose:r,onConfirm:a})=>{L();const[o,i]=d.useState(""),[l,c]=d.useState(null),[u,m]=d.useState(!1),p=d.useId();d.useEffect(()=>{e&&(i(""),c(null),m(!1))},[e]);const f=o.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,b=async()=>{m(!0),c(null);try{await a(o.trim()),r()}catch(_){c(_ instanceof Error&&_.message?_.message:n("ui.projects.project_delete_dialog.the_project_was_not_deleted"))}finally{m(!1)}};return t.jsx(dt,{open:e,onClose:r,title:n("ui.projects.project_delete_dialog.delete_this_project"),dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ye,{onClick:r,disabled:u,children:n("ui.projects.project_delete_dialog.cancel")}),t.jsxs(zn,{onClick:()=>void b(),disabled:!f||u,children:[u&&t.jsx(Se,{size:"xs"}),n("ui.projects.project_delete_dialog.delete_project")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.projects.project_delete_dialog.this_deletes_the_project_and_its_milestones_the_sessions_linked_t")}),t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[n("ui.projects.project_delete_dialog.type")," ",t.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ",n("ui.projects.project_delete_dialog.to_confirm")]}),t.jsx(oe,{id:`${p}-confirm`,value:o,onChange:_=>i(_.target.value),placeholder:s,"aria-label":n("ui.projects.project_delete_dialog.type_the_project_name_to_confirm"),"aria-invalid":o.length>0&&!f,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function uc(e){return e==="editing"||e==="saving"||e==="error"}function dc(e,s,r=Object.is){return!r(e,s)}function pc(e,s){if(e.key==="Escape")return e.defaultPrevented===!0?null:"revert";if(e.key!=="Enter"||!s.keyboardCommit)return null;const r=e.metaKey===!0||e.ctrlKey===!0;return s.multiline?r?"accept":null:s.onEditor?"accept":null}function mc(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function _c(e){const{phase:s,base:r,draft:a,fresh:o,equals:i}=e;return s==="saving"||s==="saved"||i(r,o)?"none":s==="idle"||i(r,a)||i(o,a)?"adopt":"conflict"}function cr(e,s,r=Object.is){return!r(e,s)}const Cs="group/inline-edit",Yt="inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-xs text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink-muted",fc="relative before:absolute before:-inset-1.5 before:content-['']",jc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",hc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-right-1.5 before:left-0 before:content-['']",cs=({api:e,idle:s="affordance",className:r})=>{const{phase:a,labels:o}=e,i=a==="editing"||a==="saving"||a==="error",l=mc(a,e.dirty),c=e.acceptBlocked===!0;return t.jsx("span",{"data-inline-edit-slot":a,className:M("inline-flex shrink-0 items-center gap-0.5",r),children:l?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","data-inline-edit-control":"cancel","aria-label":a==="saving"?o.busy:o.cancel,title:a==="saving"?o.busy:o.cancel,"aria-disabled":a==="saving"||void 0,onMouseDown:u=>u.preventDefault(),onClick:u=>{u.detail>1||a!=="saving"&&e.cancel()},className:M(Yt,jc,a==="saving"&&"cursor-default text-ink-disabled"),children:t.jsx(Pt,{className:"size-3","aria-hidden":"true"})}),a==="saving"?t.jsx("span",{"data-inline-edit-control":"busy",className:"inline-flex size-5 shrink-0 items-center justify-center",children:t.jsx(Se,{size:"xs"})}):t.jsx("button",{type:"button","data-inline-edit-control":"accept","aria-label":a==="error"?o.retry??o.accept:o.accept,title:a==="error"?o.retry??o.accept:o.accept,"aria-disabled":c||void 0,onMouseDown:u=>u.preventDefault(),onClick:u=>{u.detail>1||c||e.accept()},className:M(Yt,hc,c&&"cursor-default text-ink-disabled"),children:t.jsx(gs,{className:"size-3","aria-hidden":"true"})})]}):i?null:s==="affordance"?t.jsx("button",{ref:e.slotRef,type:"button","data-inline-edit-control":"begin","aria-label":o.begin,title:o.begin,onClick:u=>{u.detail>1||e.begin()},className:M(Yt,fc,"opacity-0 transition-opacity duration-base ease-out-quart","group-hover/inline-edit:opacity-100 group-hover/inline-edit:duration-fast","group-focus-within/inline-edit:opacity-100 group-focus-within/inline-edit:duration-fast","focus-visible:opacity-100"),children:t.jsx(Gn,{className:"size-3","aria-hidden":"true"})}):null})},ls=({api:e,className:s})=>{L();const{phase:r,error:a,conflict:o}=e;return r==="saved"?t.jsx("p",{"data-inline-edit-feedback":"saved",className:M("text-meta text-success",s),children:e.labels.saved}):!a&&!o?null:t.jsxs("div",{id:e.feedbackId,"data-inline-edit-feedback":a&&o?"error+conflict":a?"error":"conflict",role:"alert",className:M("flex flex-wrap items-center gap-x-3 gap-y-1",s),children:[a&&t.jsx("p",{className:"text-meta text-danger",children:a}),a&&o===null&&t.jsx("button",{type:"button","data-inline-edit-control":"retry",onClick:()=>e.accept(),className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.common.actions.retry")}),o!==null&&t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-warning",children:n("ui.common.editing.conflict")}),t.jsx("button",{type:"button","data-inline-edit-control":"keep-mine",onClick:e.keepMine,className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.common.editing.keep_mine")}),t.jsx("button",{type:"button","data-inline-edit-control":"use-theirs",onClick:e.useTheirs,className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.common.editing.use_theirs")})]})]})},mn=d.createContext(null),gc=50,xc=({children:e})=>{const[s,r]=d.useState(""),a=d.useMemo(()=>({current:o=>{r(""),window.setTimeout(()=>r(o),gc)}}),[]);return t.jsxs(mn.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},bc=1200;function yc(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function ht(e){const{value:s,multiline:r=!1,keyboardCommit:a=!0,selectAllOnBegin:o=!1,beginOnMount:i=!1,savedDwellMs:l=bc,labels:c}=e,u=d.useRef(e.equals??Object.is);u.current=e.equals??Object.is;const m=d.useRef(e.commit);m.current=e.commit;const p=d.useRef(e.validate);p.current=e.validate;const f=d.useRef(e.errorCopy);f.current=e.errorCopy;const b=d.useRef(e.onSettle);b.current=e.onSettle;const _=d.useRef(e.onBegin);_.current=e.onBegin;const x=d.useRef(c);x.current=c;const[v,g]=d.useState(i?"editing":"idle"),[h,y]=d.useState(s),[T,w]=d.useState(s),[U,C]=d.useState(null),[E,P]=d.useState(null),j=d.useRef(v),O=d.useRef(h),R=d.useRef(T),I=d.useRef(U),Y=d.useRef(s);Y.current=s;const q=d.useCallback(A=>{j.current=A,g(A)},[]),G=d.useCallback(A=>{O.current=A,y(A)},[]),W=d.useCallback(A=>{R.current=A,w(A)},[]),J=d.useCallback(A=>{I.current=A,C(A)},[]),de=d.useRef(null),Z=d.useRef(null),ee=d.useRef(null),k=e.editorRef??ee,N=d.useRef(k);N.current=k;const D=`${d.useId()}-inline-edit`,F=d.useContext(mn),B=d.useRef(null),$=B.current,Ae=$!==null&&(e.equals??Object.is)(s,$.previous)&&!(e.equals??Object.is)(s,$.saved)&&$!==null?$.saved:s,H=d.useRef(Ae);H.current=Ae,d.useEffect(()=>{const A=B.current;if(A===null)return;const ne=u.current;(ne(s,A.saved)||!ne(s,A.previous))&&(B.current=null)},[s]);const Ce=d.useRef(i);d.useEffect(()=>{if(v!=="editing"||!Ce.current)return;Ce.current=!1;const A=N.current.current;A&&(A.focus(),o&&(A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement)&&A.select())},[v,o]);const be=d.useRef(!1);d.useEffect(()=>{be.current&&(v!=="idle"&&v!=="saved"||(be.current=!1,Z.current?.focus()))});const fe=d.useRef(null),te=d.useCallback(()=>{fe.current!==null&&(clearTimeout(fe.current),fe.current=null)},[]);d.useEffect(()=>()=>te(),[te]);const Oe=d.useRef(v);d.useEffect(()=>{const A=Oe.current;if(Oe.current=v,A==="saving"&&v==="saved"){b.current?.("saved");return}(A==="editing"||A==="error")&&v==="idle"&&b.current?.("cancelled")},[v]),d.useEffect(()=>{const A=_c({phase:j.current,base:R.current,draft:O.current,fresh:H.current,equals:u.current});A==="adopt"?(u.current(R.current,H.current)||W(H.current),u.current(H.current,O.current)||G(H.current)):A==="conflict"&&(I.current===null||!u.current(I.current,H.current))&&J(H.current)},[s,v,W,G,J]);const ce=d.useCallback(A=>{J(null),P(null),G(R.current),q("idle"),A&&(be.current=!0)},[J,G,q]),tt=d.useCallback(()=>{j.current!=="saving"&&(j.current==="idle"||j.current==="saved"||(te(),ce(!0)))},[te,ce]),re=d.useCallback((A,ne=!0)=>{const nt=j.current;if(nt==="saving"||nt==="saved"||I.current!==null)return;const ye=A!==void 0?A:O.current;if(!cr(R.current,ye,u.current)){ce(ne&&nt!=="idle");return}const xt=p.current?.(ye)??null;if(xt!==null){q("error"),P(xt);return}G(ye),P(null),q("saving"),m.current(ye).then(()=>{j.current==="saving"&&(B.current={saved:ye,previous:R.current},W(ye),G(ye),ne&&(be.current=!0),q("saved"),te(),fe.current=setTimeout(()=>{fe.current=null,j.current==="saved"&&q("idle")},l),F?.current?.(x.current.saved))},Be=>{j.current==="saving"&&(q("error"),P(f.current?f.current(Be):yc(Be)))})},[F,te,ce,l,W,G,q]),Ee=d.useCallback(()=>{j.current==="editing"||j.current==="saving"||(te(),Ce.current=!0,G(H.current),W(H.current),J(null),P(null),q("editing"),_.current?.())},[te,W,J,G,q]),Ue=d.useCallback(()=>{const A=I.current;A!==null&&(J(null),W(A),re())},[re,W,J]),qt=d.useCallback(()=>{const A=I.current;A!==null&&(W(A),ce(!0))},[ce,W]),st=d.useCallback(A=>{const ne=pc(A,{multiline:r,keyboardCommit:a,onEditor:A.target===N.current.current});if(ne==="revert"){A.preventDefault(),tt();return}ne==="accept"&&(A.preventDefault(),re())},[re,tt,a,r]),rt=d.useCallback(A=>{if(j.current!=="editing")return;const ne=A.relatedTarget;if(!(ne!==null&&de.current?.contains(ne))&&!(ne instanceof Element&&ne.closest("[data-radix-popper-content-wrapper]")!==null)&&I.current===null){if(!cr(R.current,O.current,u.current)){ce(!1);return}re(void 0,!1)}},[re,ce]),gt=v==="saved"?h:Ae;return{phase:v,dirty:dc(T,h,u.current),conflict:U,error:E,draft:h,setDraft:G,displayValue:gt,editing:uc(v),begin:Ee,accept:re,cancel:tt,keepMine:Ue,useTheirs:qt,handleKeyDown:st,handleBlur:rt,fieldProps:{onKeyDown:st,onBlur:rt,"aria-busy":v==="saving"?!0:void 0},editorAria:{"aria-invalid":E!==null?!0:void 0,"aria-describedby":E!==null||U!==null?D:void 0},fieldRef:de,editorRef:k,slotRef:Z,feedbackId:D,labels:c}}const vc=/^(https?:|mailto:)/i,kc={a:({href:e,children:s})=>typeof e=="string"&&vc.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:Hn},ut=d.memo(({children:e,className:s})=>t.jsx("div",{className:M("lo-markdown",s),children:t.jsx(Yn,{remarkPlugins:[Kn],components:kc,children:e})})),lr=`## Summary
|
|
21
|
+
*/const Va=[["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"}]],Qa=At("unlink",Va),Mt={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function Xa(e){return us({queryKey:Mt.list,enabled:e,queryFn:()=>pe({op:"projects.list"}).then(s=>s.projects),retry:ds,staleTime:1e4})}function Ja(e,s){return $a({queries:e.map(r=>({queryKey:Mt.detail(r),enabled:s&&!!r,queryFn:()=>pe({op:"projects.get",key:r}),retry:ds,staleTime:1e4}))})}function Ar(e,s){return us({queryKey:Mt.detail(e??""),enabled:s&&!!e,queryFn:()=>pe({op:"projects.get",key:e??""}),retry:ds,staleTime:1e4})}function qe(){const e=br();return()=>{e.invalidateQueries({queryKey:Mt.list})}}function Za(){const e=qe();return Fe({mutationFn:s=>pe({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 Or(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:qn,onSuccess:()=>e()})}function Pr(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function eo(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function to(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function so(){const e=qe();return Fe({mutationFn:s=>pe({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 ro(){const e=qe();return Fe({mutationFn:s=>pe({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const Mr={planning:{get label(){return n("ui.projects.project_model.planning")},variant:"info"},active:{get label(){return n("ui.projects.project_model.active")},variant:"accent"},qa:{get label(){return n("ui.projects.project_model.qa")},variant:"attention"},validation:{get label(){return n("ui.projects.project_model.validation")},variant:"warning"},done:{get label(){return n("ui.projects.project_model.done")},variant:"success"},paused:{get label(){return n("ui.projects.project_model.paused")},variant:"neutral"},archived:{get label(){return n("ui.projects.project_model.archived")},variant:"outline"}},ze=Object.keys(Mr);function se(e){return Mr[e]??{label:e||n("ui.projects.project_model.unknown"),variant:"neutral"}}const Ir=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:se(e).label}));function no(e){return e==="done"}const ao={completed:{get label(){return n("ui.projects.project_model.completed")},variant:"success"},overdue:{get label(){return n("ui.projects.project_model.overdue")},variant:"warning"},upcoming:{get label(){return n("ui.projects.project_model.upcoming")},variant:"neutral"}};function oo(e){return ao[e]??{label:String(e),variant:"neutral"}}Le["ui.projects.project_model.stale"];const io=/^(\d{4})-(\d{2})-(\d{2})$/;function De(e,s,r=new Date){if(!e)return"";const a=io.exec(e);if(!a)return e;const o=new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));if(Number.isNaN(o.getTime()))return e;const i=yt(o,{month:"short",day:"numeric"},s);return o.getFullYear()===r.getFullYear()?i:yt(o,{month:"short",day:"numeric",year:"numeric"},s)}function pt(e,s){if(e==null)return"";const r=Math.max(0,Math.floor(s/1e3-e));return r<60?n("ui.projects.project_model.just_now"):r<3600?`${V(Math.floor(r/60),{useGrouping:!1})}m`:r<86400?`${V(Math.floor(r/3600),{useGrouping:!1})}h`:`${V(Math.floor(r/86400),{useGrouping:!1})}d`}function mt(e){return e===n("ui.projects.project_model.just_now")?n("ui.projects.project_model.just_now"):n("ui.projects.project_model.age_ago",{age:String(e)})}function co(e){return e?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(mt(e))}):n("ui.projects.project_model.no_progress")}const Lr=/^$|^\d{4}-\d{2}-\d{2}$/;function Fr(e){return e?e==="operator"?n("ui.projects.project_model.the_operator"):n("ui.projects.project_model.session_reportedby",{reportedBy:String(e)}):""}function lo(e,s){if(!e.progress)return n("ui.projects.project_model.not_reported_yet");const r=pt(e.progress_updated_at,s),a=Fr(e.progress_reported_by),o=[r?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(mt(r))}):"reported"];return a&&o.push(n("ui.projects.project_model.by_reporter",{reporter:String(a)})),o.join(" ")}function qr(e,s){if(e==null)return"";const r=V(e,{useGrouping:!1,maximumFractionDigits:20});return s==="points"?n("ui.projects.project_model.value_pt",{value:String(r)}):s==="days"?n("ui.projects.project_model.value_d",{value:String(r)}):r}function Ur(e,s){return s<=0?"":n("ui.projects.project_model.completed_total",{completed:V(e,{useGrouping:!1}),total:V(s,{useGrouping:!1})})}function xs(e){return e<=0?"":n("ui.projects.project_model.live_live",{live:e})}function uo(e){return e<=0?"":n("ui.projects.count.session",{count:e})}function po(e){return n("ui.projects.count.project",{count:e})}function mo(e){const s=uo(e.sessions);if(!s)return"";const r=xs(e.live_sessions);return r?n("ui.projects.project_model.count_live",{count:String(s),live:String(r)}):s}function _o(e){if(!e.exists)return{get label(){return n("ui.projects.project_model.missing")},variant:"outline"};if(e.archived)return{get label(){return n("ui.projects.project_model.archived")},variant:"neutral"};switch(e.runtime?.state){case"live":return{get label(){return n("ui.projects.project_model.live")},variant:"success"};case"wedged":return{get label(){return n("ui.projects.project_model.wedged")},variant:"warning"};case"stale":return{get label(){return n("ui.projects.project_model.stale")},variant:"warning"};case"stopped":return{get label(){return n("ui.projects.project_model.stopped")},variant:"neutral"};default:return{label:String(e.runtime?.state??n("ui.projects.project_model.unknown")),variant:"neutral"}}}function fo(e){return e?e.running>0?n("ui.projects.count.subagent_running",{count:e.running}):n("ui.projects.count.subagent",{count:e.settled}):""}function jo(e){return e?n("ui.projects.count.todo",{count:e.total}):""}function Br(e,s){const r=[],a=De(e.completed_at??e.target_date,s);a&&r.push({key:e.completed_at?"completed":"target",text:e.completed_at?n("ui.projects.project_model.completed_day",{day:String(a)}):n("ui.projects.project_model.due_day",{day:String(a)})});const o=qr(e.estimate,e.estimate_unit);o&&r.push({key:"estimate",text:o});const i=Ur(e.milestones_completed,e.milestones_total);i&&r.push({key:"milestones",text:n("ui.projects.project_model.milestones_milestones",{milestones:String(i)})});const l=xs(e.live_sessions);return l&&r.push({key:"live",text:l}),r}const Ge=864e5,ho=/^(\d{4})-(\d{2})-(\d{2})$/;function ge(e){if(!e)return null;const s=ho.exec(e);if(!s)return null;const r=Number(s[1]),a=Number(s[2]),o=Number(s[3]),i=Date.UTC(r,a-1,o),l=new Date(i);return l.getUTCFullYear()!==r||l.getUTCMonth()!==a-1||l.getUTCDate()!==o?null:i}const Vt=["planning","active","qa","validation","done"],Qt=["paused","archived"],It=[{value:"24h",get label(){return n("ui.projects.project_model.last_24_hours")},get phrase(){return n("ui.projects.project_model.the_last_24_hours")},seconds:86400},{value:"7d",get label(){return n("ui.projects.project_model.last_7_days")},get phrase(){return n("ui.projects.project_model.the_last_7_days")},seconds:604800},{value:"30d",get label(){return n("ui.projects.project_model.last_30_days")},get phrase(){return n("ui.projects.project_model.the_last_30_days")},seconds:2592e3},{value:"90d",get label(){return n("ui.projects.project_model.last_90_days")},get phrase(){return n("ui.projects.project_model.the_last_90_days")},seconds:7776e3},{value:"all",get label(){return n("ui.projects.project_model.all_time")},phrase:null,seconds:null}],$r="7d",go=It.find(e=>e.value===$r);function zr(e){return It.find(s=>s.value===e)??go}function xo(e){return It.some(s=>s.value===e)}function $s(e,s,r){const a=zr(s);return a.seconds===null?e:e.filter(o=>r/1e3-o.updated_at<=a.seconds)}function bo(e){const s=zr(e);return s.seconds===null?null:n("ui.projects.project_model.nothing_changed_in_phrase",{phrase:String(s.phrase)})}const Gr="projects-board-window";function yo(){try{const e=localStorage.getItem(Gr);if(e!==null&&xo(e))return e}catch{}return $r}function zs(e){try{localStorage.setItem(Gr,e)}catch{}}const Yr="projects-board-column-order";let Xt=null;function vo(){if(Xt)return[...Xt];try{const e=localStorage.getItem(Yr);if(!e)return[];const s=JSON.parse(e);if(!Array.isArray(s))return[];const r=[];for(const a of s){if(typeof a!="string"||a.length===0)return[];r.includes(a)||r.push(a)}return r}catch{return[]}}function ko(e){Xt=[...e];try{localStorage.setItem(Yr,JSON.stringify(e))}catch{}}function wo(e,s,r){const a=e.filter(i=>i!==s),o=Math.max(0,Math.min(r,a.length));return a.splice(o,0,s),a}function No(e,s=[]){const r=new Map;for(const c of e){const u=r.get(c.status)??[];u.push(c),r.set(c.status,u)}const a=Vt.map(c=>({status:c,projects:r.get(c)??[]}));for(const c of Qt){const u=r.get(c)??[];u.length>0&&a.push({status:c,projects:u})}for(const[c,u]of r)!Qt.includes(c)&&!Vt.includes(c)&&a.push({status:c,projects:u});if(s.length===0)return a;const o=new Map(s.map((c,u)=>[c,u])),i=a.filter(c=>o.has(c.status));i.sort((c,u)=>(o.get(c.status)??0)-(o.get(u.status)??0));const l=a.filter(c=>!o.has(c.status));return[...i,...l]}function Hr(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const r=ge(e.target_date);return r===null?!1:r<s}function X(e){return e.title||e.name}Le["ui.projects.project_model.no_team"];function _t(e){const s=e.team?.trim();if(s)return s;const r=e.owner?.trim();return r||null}function bs(e,s){const r=new Map,a=[];for(const i of e){const l=s(i);if(l===null){a.push(i);continue}const c=r.get(l);c?c.push(i):r.set(l,[i])}const o=[...r.entries()].sort(([i],[l])=>i.localeCompare(l,void 0,{sensitivity:"base"})).map(([i,l])=>({team:i,items:l}));return a.length>0&&o.push({team:null,items:a}),o}function Lt(e){return e.title||e.session_id}function So(e){return[...e].reverse()}function Co(e){return e<=0?"":n("ui.projects.count.update",{count:e})}const Gs=e=>String(e).padStart(2,"0");function Jt(e){return`${e.getFullYear()}-${Gs(e.getMonth()+1)}-${Gs(e.getDate())}`}function Eo(e){const s=Date.parse(e);return Number.isNaN(s)?"":Jt(new Date(s))}function To(e,s,r=new Date){if(!e)return"";if(e===Jt(r))return n("ui.projects.project_model.today");const a=new Date(r.getFullYear(),r.getMonth(),r.getDate()-1);return e===Jt(a)?n("ui.projects.project_model.yesterday"):De(e,s,r)}function Ro(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":Un(new Date(r),{hour:"numeric",minute:"2-digit"},s)}function Do(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":mt(pt(r/1e3,s))}function Ao(e,s,r=Date.now()){const a=[],o=Fr(e.by);o&&a.push({key:"author",text:o});const i=Ro(e.at,s);i&&a.push({key:"time",text:i});const l=Do(e.at,r);return l&&a.push({key:"age",text:l}),a}function Oo(e,s,r=new Date){const a=[];for(const o of So(e)){const i=Eo(o.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(o);continue}a.push({key:i,label:To(i,s,r),entries:[o]})}return a}function Po(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 Mo(e,s){return s<=0?"":`${e} of ${s} complete`}function Io(e){let s=0,r=0,a=!1;for(const o of e)o.todos&&(a=!0,s+=o.todos.open,r+=o.todos.total);return a?{open:s,total:r}:null}function Ys(e){return`${e.open} open of ${e.total}`}function Lo(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function Fo(e){const s=X(e),r=e.progress.trim()||"not reported yet";return[`Continue work on project "${s}" (${e.name}).`,`Latest progress: ${r}`,"Review the project details and continue or complete the work."].join(`
|
|
22
|
+
`)}function qo(e){return e?e.kind==="team"?n("ui.projects.project_model.team_name",{name:String(e.name)}):n("ui.projects.project_model.agent_name",{name:String(e.name)}):""}const Uo=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function Kr(e){const s=[];for(const r of e.matchAll(Uo))s.push((r[1]??r[2]??"").replace(/\\(.)/g,"$1"));return s}const bt=3;function ys(e){if(e.length<=bt+1)return e.length<=1?e.join(""):n("ui.projects.project_model.join_and_length_1",{join:String(e.slice(0,-1).join(", ")),length___1:String(e[e.length-1])});const s=e.length-bt;return n("ui.projects.project_model.join_and_hidden_more",{join:String(e.slice(0,bt).join(", ")),hidden:V(s,{useGrouping:!1})})}function vs(e){return n("ui.projects.count.milestones_are",{count:e})}const Hs="complete them, or pass force_done=true to close with them open",Bo="complete or remove the incomplete milestones, then mark it done",Wr=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function ft(e){const s=e.match(Wr);if(s){const r=Number(s[1]),a=Kr(s[2]),o=a.length>0?ys(a):s[2];return n("ui.projects.project_model.this_can_t_be_marked_done_yet_milestonesare_count_still_incomplet",{milestonesAre_count:String(vs(r)),clause:String(o)})}return e.includes(Hs)?e.replace(Hs,Bo):e}const $o="project_done_incomplete";function zo(e){const s=e.message.match(Wr),r=e.code===$o;if(!r&&!s)return null;const a=typeof e.detail=="object"&&e.detail!==null&&Array.isArray(e.detail.incomplete)?e.detail.incomplete.filter(l=>typeof l=="string"):null,o=a&&a.length>0?a:s?Kr(s[2]):[];return{count:o.length>0?o.length:s?Number(s[1]):0,names:o,coded:r,message:e.message}}function Go(e){if(e.count>0){const s=ys(e.names);return n("ui.projects.project_model.count_still_open_clause_clause",{count:String(vs(e.count)),clause________clause:String(s?n("ui.projects.project_model.clause",{clause:String(s)}):"")})}return ft(e.message)||n("ui.projects.project_model.some_milestones_are_still_open")}function Yo(e){return e.count>0&&e.names.length>0?n("ui.projects.project_model.this_can_t_be_marked_done_yet_count_still_incomplete_names_comple",{count:String(vs(e.count)),names:String(ys(e.names))}):ft(e.message)||n("ui.projects.project_model.milestones_are_still_open_on_this_project_complete_or_remove_them")}function Vr(e,s,r){if(!e||e.forced_done!==!0)return n("ui.projects.project_model.moved_to_statuslabel",{statusLabel:String(r)});const a=typeof e.milestones_total=="number"&&typeof e.milestones_completed=="number"?e.milestones_total-e.milestones_completed:s,o=a>0?a:s;return n("ui.projects.count.moved_open",{status:r,open:o})}Le["ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"];function Qr(e){return e.trim().slice(0,Ia)}const Ho={get client(){return n("ui.projects.project_search.searches_names_descriptions_tags_owners_and_teams_update_text_is")},get backend(){return n("ui.projects.project_search.searches_names_descriptions_tags_owners_teams_and_update_text_cle")}},Ko=2,Wo=4,Vo=3,Qo=2,Xo=1,Jo=3,Pe={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},Zo=/[^\p{L}\p{N}]+/u,ei=/\s+/;function Ks(e,s){const r=s.trim().toLowerCase();if(!r)return 0;if(r===e)return Wo;if(r.startsWith(e))return Vo;const a=r.split(Zo).filter(Boolean),o=e.split(ei).filter(Boolean);if(o.length>0&&o.every(l=>a.some(c=>c.startsWith(l))))return Qo;const i=o.join("");return i.length>=Jo&&ti(i,r)?Xo:0}function ti(e,s){let r=0;for(const a of e){if(r=s.indexOf(a,r),r<0)return!1;r+=1}return!0}function si(e,s){const r=s.trim().toLowerCase();if(!r)return 0;const a=[[e.title,Pe.title],[e.name,Pe.name],[e.description,Pe.description],[e.owner,Pe.attribution],[e.team,Pe.attribution],[e.status,Pe.status]];let o=0;for(const[i,l]of a){if(!i)continue;const c=Ks(r,i)*l;c>o&&(o=c)}for(const i of e.tags){const l=Ks(r,i)*Pe.tags;l>o&&(o=l)}return o}function ri(e,s){const r=s.trim();if(!r)return e;const a=[];for(const o of e){const i=si(o,r);i>0&&a.push({project:o,score:i})}return a.sort((o,i)=>{if(o.score!==i.score)return i.score-o.score;if(o.project.updated_at!==i.project.updated_at)return i.project.updated_at-o.project.updated_at;const l=X(o.project).localeCompare(X(i.project),void 0,{sensitivity:"base"});if(l!==0)return l;const c=o.project.name.localeCompare(i.project.name,void 0,{sensitivity:"base"});return c!==0?c:o.project.id<i.project.id?-1:o.project.id>i.project.id?1:0}),a.map(o=>o.project)}function ni(e,s){if(s.length===0)return[];const r=new Map(e.map(o=>[o.id,o])),a=[];for(const o of s){const i=r.get(o.id);i!==void 0&&a.push(i)}return a}const ai=180;function oi(e,s){const r=Qr(e),a=Tr(r,ai),o=us({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>pe({op:"projects.search",q:a,limit:La}),retry:!1,staleTime:3e4}),i=a===r,l=i&&o.data&&o.data.query===r?o.data:null,c=i&&r.length>0&&!l&&o.isError;return{answer:l,pending:s&&r.length>0&&!l&&!c}}const Ze=["status","team","owner","tags","progress","target","estimate","milestones","live"],Ws={status:[],team:[],owner:[],tags:[],progress:[],target:[],estimate:[],milestones:[],live:[]},ot={get status(){return n("ui.projects.project_filters.status")},get team(){return n("ui.projects.project_filters.team")},get owner(){return n("ui.projects.project_filters.owner")},get tags(){return n("ui.projects.project_filters.tags")},get progress(){return n("ui.projects.project_filters.progress")},get target(){return n("ui.projects.project_filters.target_date")},get estimate(){return n("ui.projects.project_filters.estimate")},get milestones(){return n("ui.projects.project_filters.milestones")},get live(){return n("ui.projects.project_filters.live_sessions")}},ii=new Set(["status","progress","target","estimate","milestones","live"]),ci={progress:["stale","up-to-date","not-reported"],target:["none","overdue","within-7","within-30"],estimate:["none","points","days"],milestones:["none","incomplete","complete"],live:["has-live","no-live"]},li={get stale(){return n("ui.projects.project_filters.stale")},get"up-to-date"(){return n("ui.projects.project_filters.up_to_date")},get"not-reported"(){return n("ui.projects.project_filters.not_reported")},get none(){return n("ui.projects.project_filters.no_target_date")},get overdue(){return n("ui.projects.project_filters.overdue")},get"within-7"(){return n("ui.projects.project_filters.due_within_7_days")},get"within-30"(){return n("ui.projects.project_filters.due_within_30_days")},get points(){return n("ui.projects.project_filters.points")},get days(){return n("ui.projects.project_filters.days")},get incomplete(){return n("ui.projects.project_filters.incomplete")},get complete(){return n("ui.projects.project_filters.complete")},get"has-live"(){return n("ui.projects.project_filters.has_live_sessions")},get"no-live"(){return n("ui.projects.project_filters.no_live_sessions")}};function Xr(e,s){switch(e){case"status":return se(s).label;case"team":return s===null?n("ui.projects.project_filters.no_team"):s;case"owner":return s===null?n("ui.projects.project_filters.no_owner"):s;case"tags":return s??"";case"estimate":if(s==="none")return n("ui.projects.project_filters.no_estimate");break;case"milestones":if(s==="none")return n("ui.projects.project_filters.none_set");break;case"target":if(s==="none")return n("ui.projects.project_filters.no_target_date");break}return li[s]??s??""}function ui(e,s){return e[s].length>0}function ct(e){return Ze.every(s=>!ui(e,s))}function di(e){return Ze.reduce((s,r)=>s+e[r].length,0)}function Jr(e,s,r){const a=e[s],o=a.includes(r)?a.filter(i=>i!==r):[...a,r];return{...e,[s]:o}}function Zr(e,s,r,a){switch(e){case"status":return s.status===r;case"team":return _t(s)===r;case"owner":return(s.owner?.trim()||null)===r;case"tags":return s.tags.includes(r??"");case"progress":return r==="stale"?s.progress_stale===!0:r==="up-to-date"?s.progress_stale===!1:s.progress_updated_at===null;case"target":{if(r==="none")return ge(s.target_date)===null;if(r==="overdue")return Hr(s,a);const o=ge(s.target_date);if(o===null)return!1;const i=(o-a)/Ge;return r==="within-7"?i>=0&&i<=7:i>=0&&i<=30}case"estimate":return r==="none"?s.estimate===null:s.estimate===null?!1:r==="points"?s.estimate_unit==="points":s.estimate_unit==="days";case"milestones":return r==="none"?s.milestones_total===0:s.milestones_total===0?!1:r==="complete"?s.milestones_completed>=s.milestones_total:s.milestones_completed<s.milestones_total;case"live":return r==="has-live"?s.live_sessions>0:s.live_sessions===0}}function en(e,s,r,a){const o=e[s];return o.length===0?!0:o.some(i=>Zr(s,r,i,a))}function pi(e,s,r){return ct(s)?e:e.filter(a=>Ze.every(o=>en(s,o,a,r)))}function mi(e,s,r,a){return s.filter(o=>Ze.every(i=>i===e||en(r,i,o,a)))}function _i(e,s,r){const a=r[e];switch(e){case"status":{const i=[...new Set(s.map(c=>c.status))].filter(c=>!ze.includes(c)).sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"})),l=a.filter(c=>typeof c=="string"&&!ze.includes(c)&&!i.includes(c));return[...ze,...i,...l]}case"team":{const o=new Set;let i=!1;for(const c of s){const u=_t(c);u===null?i=!0:o.add(u)}for(const c of a)c===null?i=!0:o.add(c);const l=[...o].sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"owner":{const o=new Set;let i=!1;for(const c of s){const u=c.owner?.trim();u?o.add(u):i=!0}for(const c of a)c===null?i=!0:o.add(c);const l=[...o].sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"}));return i?[...l,null]:l}case"tags":{const o=new Set;for(const i of s)for(const l of i.tags)o.add(l);for(const i of a)o.add(i??"");return[...o].sort((i,l)=>i.localeCompare(l,void 0,{sensitivity:"base"}))}case"progress":case"target":case"estimate":case"milestones":case"live":return ci[e]}}function tn(e,s,r,a){const o=mi(e,s,r,a),i=ii.has(e),l=[];for(const c of _i(e,o,r)){const u=r[e].includes(c),m=o.reduce((p,f)=>p+(Zr(e,f,c,a)?1:0),0);!i&&m===0&&!u||l.push({value:c,label:Xr(e,c),count:m,selected:u})}return{facet:e,label:ot[e],options:l}}function fi(e,s,r){return Ze.map(a=>tn(a,e,s,r))}const Zt="projects-sort";Le["ui.projects.project_sort.default_as_listed"];function ji(e){return hi.includes(e)}const hi=["name","status","target","estimate","milestones","live","progress"];function gi(){try{const e=localStorage.getItem(Zt);if(e===null)return null;const[s,r,...a]=e.split(":");if(a.length>0)return null;if(s&&ji(s)&&(r==="asc"||r==="desc"))return{key:s,direction:r}}catch{}return null}function xi(e){try{e===null?localStorage.removeItem(Zt):localStorage.setItem(Zt,`${e.key}:${e.direction}`)}catch{}}function Xe(e){switch(e){case"name":return n("ui.projects.project_sort.project");case"status":return n("ui.projects.project_sort.status");case"target":return n("ui.projects.project_sort.target");case"estimate":return n("ui.projects.project_sort.estimate");case"milestones":return n("ui.projects.project_sort.milestones");case"live":return n("ui.projects.project_sort.live");case"progress":return n("ui.projects.project_sort.progress")}}function Bt(e){return e==="target"||e==="progress"?"desc":"asc"}function ks(e,s){const r=s==="desc";switch(e){case"name":return r?n("ui.projects.project_sort.z_to_a"):n("ui.projects.project_sort.a_to_z");case"status":return r?n("ui.projects.project_sort.archived_first"):n("ui.projects.project_sort.planning_first");case"target":return r?n("ui.projects.project_sort.latest_first"):n("ui.projects.project_sort.soonest_first");case"estimate":return r?n("ui.projects.project_sort.days_first"):n("ui.projects.project_sort.points_first");case"milestones":return r?n("ui.projects.project_sort.most_complete_first"):n("ui.projects.project_sort.least_complete_first");case"live":return r?n("ui.projects.project_sort.most_first"):n("ui.projects.project_sort.fewest_first");case"progress":return r?n("ui.projects.project_sort.most_recent_first"):n("ui.projects.project_sort.most_stale_first")}}function bi(e){return e===null?n("ui.projects.project_sort.sort_cleared"):n("ui.projects.project_sort.sorted_by_key_direction",{key:String(Xe(e.key)),direction:String(ks(e.key,e.direction))})}function yi(e){const s=[e.search?"search":null,e.filters?"filters":null,e.sort?"sort":null].filter(a=>a!==null);if(s.length===0)return"";const r=s.length===1?n("ui.projects.project_sort.parts_0_cleared",{parts_0:String(s[0])}):n("ui.projects.project_sort.join_and_length_1_cleared",{join:String(s.slice(0,-1).join(", ")),length___1:String(s[s.length-1])});return r.charAt(0).toUpperCase()+r.slice(1)}function Vs(e,s){switch(e){case"name":return 0;case"status":return ze.includes(s.status)?0:1;case"target":return es(s)===null?1:0;case"estimate":return s.estimate===null?1:0;case"milestones":return s.milestones_total===0?1:0;case"live":return 0;case"progress":return s.progress_updated_at===null?1:0}}function es(e){return ge(e.completed_at??e.target_date)}function Qs(e){return e==="points"?0:e==="days"?1:2}function vi(e,s,r){switch(e){case"name":return X(s).localeCompare(X(r),void 0,{sensitivity:"base"});case"status":return ze.indexOf(s.status)-ze.indexOf(r.status);case"target":{const a=es(s)??0,o=es(r)??0;return a-o}case"estimate":{const a=Qs(s.estimate_unit)-Qs(r.estimate_unit);return a!==0?a:(s.estimate??0)-(r.estimate??0)}case"milestones":return s.milestones_completed*r.milestones_total-r.milestones_completed*s.milestones_total;case"live":return s.live_sessions-r.live_sessions;case"progress":return(s.progress_updated_at??0)-(r.progress_updated_at??0)}}function Xs(e,s){if(e.updated_at!==s.updated_at)return s.updated_at-e.updated_at;const r=X(e).localeCompare(X(s),void 0,{sensitivity:"base"});if(r!==0)return r;const a=e.name.localeCompare(s.name,void 0,{sensitivity:"base"});return a!==0?a:e.id<s.id?-1:e.id>s.id?1:0}function ki(e,s,r){const a=Vs(r.key,e),o=Vs(r.key,s);if(a!==o)return a-o;if(a===1)return Xs(e,s);const i=vi(r.key,e,s);return i!==0?r.direction==="desc"?-i:i:Xs(e,s)}function wi(e,s){return[...e].sort((r,a)=>ki(r,a,s))}const Te=["day","week","month","quarter"],ws={day:24,week:9,month:3,quarter:1};function Ns(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function Me(e,s){return Math.round((s-e)/Ge)}function Js(e,s){return Me(e,s)+1}function Ni(e,s){for(const r of Te)if(e*ws[r]<=s)return r;return Te[Te.length-1]}function Si(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(r=>!!r.target_date)}function Ci(e,s){const r=[s];for(const a of e){for(const o of[a.project.start_date,a.project.target_date,a.project.completed_at]){const i=ge(o);i!==null&&r.push(i)}for(const o of a.milestones){const i=ge(o.target_date);i!==null&&r.push(i)}}return r.length===1?null:{startMs:Math.min(...r),endMs:Math.max(...r)}}function Ei(e){const s=[],r=[];for(const a of e)(Si(a)?s:r).push(a);return{dated:s,undated:r}}function Ti(e){return n("ui.projects.count.undated",{count:e})}function Ri(e){const{project:s}=e,r=ge(s.start_date),a=ge(s.target_date),o=ge(s.completed_at),i=s.status==="done"&&o!==null?o:a,l=r??i,c=i??r;return l===null||c===null?null:{fromMs:Math.min(l,c),toMs:Math.max(l,c)}}function Di(e){const s=[];for(const r of e.milestones){const a=ge(r.target_date);a!==null&&s.push({name:r.name,dayMs:a,status:r.status})}return s}const $t=e=>yt(new Date(e),{month:"short",timeZone:"UTC"});function me(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Ai(e){const{year:s,month:r}=me(e);return Date.UTC(s,r-1,1)}function Oi(e){const{year:s,month:r}=me(e);return r===12?Date.UTC(s+1,0,1):Date.UTC(s,r,1)}function Pi(e){const{year:s,month:r}=me(e);return Date.UTC(s,Math.floor((r-1)/3)*3,1)}function Mi(e){const{year:s,month:r}=me(e),a=Math.floor((r-1)/3);return a===3?Date.UTC(s+1,0,1):Date.UTC(s,a*3+3,1)}function Ii(e){const{weekday:s}=me(e);return e-(s+6)%7*Ge}const Li=26;function Fi(e,s,r){const a=[],o=(p,f,b)=>{p<e||p>s||a.push({dayMs:p,label:f,major:b})};if(r==="day"){let p=!1;for(let f=e;f<=s;f+=Ge){const{day:b}=me(f);b===1?(o(f,$t(f),!0),p=!0):p?(o(f,"",!1),p=!1):o(f,V(b,{useGrouping:!1}),!1)}return a}if(r==="week"){for(let p=Ii(e);p<=s;p+=7*Ge){if(p<e)continue;const{day:f,month:b}=me(p);me(p-7*Ge).month!==b?o(p,yt(new Date(p),{month:"short",day:"numeric",timeZone:"UTC"}),!0):o(p,V(f,{useGrouping:!1}),!1)}return a}const i=r==="month"?Ai:Pi,l=r==="month"?Oi:Mi,c=p=>{const{year:f,month:b}=me(p);if(r==="month")return b===1&&f!==me(e).year?`${$t(p)} '${V(f%100,{minimumIntegerDigits:2,useGrouping:!1})}`:$t(p);const _=Math.floor((b-1)/3)+1;return _===1&&f!==me(e).year?`Q1 '${String(f%100).padStart(2,"0")}`:`Q${_}`};o(e,c(i(e)),!0);const u=Math.ceil(Li/ws[r]);let m=e;for(let p=l(i(e));p<=s;p=l(p))Me(m,p)<u||(o(p,c(p),!0),m=p);return a}function lt(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}const wt=80,Nt=80,Zs=64,er=8;function ts(e){return e.trim().length>wt?n("ui.projects.project_edit_model.titles_are_at_most_value1_characters",{value1:wt}):null}function sn(e){return e.length>Qe?n("ui.projects.project_edit_model.keep_the_description_within_value1_characters",{value1:Qe}):null}function St(e,s){return e.trim().length>Nt?n("ui.projects.project_edit_model.teams_are_at_most_value2_characters",{teams:String(s==="owner"?n("ui.projects.project_edit_model.owners"):n("ui.projects.project_edit_model.teams")),value2:Nt}):null}function ss(e){return Lr.test(e)?null:n("ui.projects.project_edit_model.dates_are_yyyy_mm_dd_or_empty")}function rs(e,s){return e&&s&&s<e?n("ui.projects.project_edit_model.the_target_date_is_before_the_start_date"):null}function rn(e){const s=e.trim();if(s==="")return null;const r=Number(s);return!Number.isFinite(r)||!(r>0)||r>1e3?n("ui.projects.project_edit_model.estimates_are_greater_than_0_and_at_most_1000"):null}function ns(e){const s=lt(e);if(s.length>er)return{tags:s,error:n("ui.projects.project_edit_model.up_to_project_tags_max_tags",{PROJECT_TAGS_MAX:er})};for(const r of s){const a=Fa(r);if(a)return{tags:s,error:a}}return{tags:s,error:null}}const qi="project_name_exists";function tr(e){return e.code===qi?n("ui.projects.project_edit_model.a_project_with_this_key_already_exists"):ft(e.message)||n("ui.projects.project_edit_model.the_project_was_not_saved")}function Ui(e,s){if(e.unit!==s.unit)return!1;const r=e.number.trim(),a=s.number.trim();return a===""?!0:r===""?!1:Number(r)===Number(a)}function Bi(e,s){const r=lt(s);return r.length!==e.length?!1:r.every((a,o)=>a===e[o])}function $i(e,s){const r={},a=s.number.trim();if(a!==""){const o=Number(a);(e.estimate===null||e.estimate!==o)&&(r.estimate=o)}return s.unit!==e.unit&&(r.estimate_unit=s.unit),Object.keys(r).length>0?r:null}function et(e){return e instanceof Rt?tr({code:e.code,message:e.message}):tr({message:e instanceof Error?e.message:""})}function nn(e){return e instanceof Rt&&(e.code==="project_not_found"||e.status===404)}function an(e){return!(e instanceof Error)||!e.message?n("ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"):nn(e)?n("ui.projects.project_refusals.this_project_could_not_be_found_it_may_have_been_deleted"):et(e)}function on(e){if(!(e instanceof Error))return null;const s=e instanceof Rt?e:null;return zo({code:s?.code??null,message:e.message,detail:s?.detail})}async function zi(e){try{return await e.move(),{kind:"accepted"}}catch(s){const r=on(s);return r?.coded&&e.forceDoneOffered&&e.claimQuestion()?{kind:"question",refusal:r}:{kind:"spoken",copy:r?Yo(r):an(s),refusal:r}}}Le["ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"];const Gi=({value:e,onChange:s})=>(L(),t.jsxs(He,{value:e,onValueChange:r=>s(r),children:[t.jsx(Ot,{content:e==="all"?null:n("ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"),side:"bottom",disableHoverableContent:!0,children:t.jsx(Ke,{"aria-label":n("ui.projects.board_window_select.projects_updated_within"),className:M("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(We,{})})}),t.jsx(Ve,{children:It.map(r=>t.jsx(Re,{value:r.value,children:r.label},r.value))})]})),as=6e4,os=6e3;Le["ui.projects.request_update.requesting_updates"];const Yi=400;Le["ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"];const Hi="linked but not yet in use — it becomes a recipient after the first message",sr=e=>`project-request-update-${e}`,Ki=e=>`project-request-cooldown-${e}`,Wi=e=>`project-request-update-cooldown-${e}`,zt=e=>e.length===1?e[0]:e.length===2?n("ui.projects.request_update.names_0_and_names_1",{names_0:String(e[0]),names_1:String(e[1])}):n("ui.projects.request_update.names_0_names_1_and_length_2_more",{names_0:String(e[0]),names_1:String(e[1]),length___2:V(e.length-2,{useGrouping:!1})}),rr=(e,s)=>e.sessions.filter(r=>r.outcome===s).map(r=>Lt({session_id:r.session_id,title:r.title})),Vi=e=>e.outcome==="failed"&&e.detail===Hi;function Ct(e,s){const r=Math.max(1,Math.ceil(s/1e3)),a=Math.max(0,Math.ceil(as/1e3)-r);return n("ui.projects.request_update.update_already_requested_ago_s_ago_on_display_try_again_in_left_s",{ago:V(a,{useGrouping:!1}),display:String(e),left:V(r,{useGrouping:!1})})}function Qi(e){const s=X({title:e.project.title,name:e.project.key}),{delivered:r,unconfirmed:a,failed:o,total:i}=e.counts;if(e.state==="empty")return{variant:"info",title:n("ui.projects.request_update.no_linked_sessions_to_ask_link_a_session_to_display_first",{display:String(s)}),duration:os};if(e.state==="cooldown")return{variant:"info",title:Ct(s,Math.max(0,e.cooldown_remaining_s??0)*1e3),duration:os};if(e.state!=="sent")return null;const l=rr(e,"failed"),c=rr(e,"unconfirmed");if(r>=1&&o===0&&a===0)return{variant:"success",title:n("ui.projects.request_update.delivered",{delivered:r,display:s})};if(r>=1){let u=n("ui.projects.request_update.requested_updates_from_delivered_of_total_sessions_on_display",{delivered:V(r,{useGrouping:!1}),total:i,display:String(s)});return o>0&&(u+=n("ui.projects.request_update.value1_could_not_be_reached",{value1:String(zt(l))})),a>0&&(u+=n("ui.projects.request_update.delivery_to_value1_could_not_be_confirmed",{value1:String(zt(c))})),{variant:"warning",title:u,duration:Number.POSITIVE_INFINITY}}if(o===0)return{variant:"warning",title:n("ui.projects.request_update.could_not_confirm_delivery_on_display_the_requests_may_still_reac",{display:String(s)}),duration:Number.POSITIVE_INFINITY};if(a===0){const u=e.sessions.every(Vi);let m;return u?m=n("ui.projects.request_update.never_started",{total:i}):m=n("ui.projects.request_update.could_not_reach_any_of_the_total_linked_sessions_on_display",{total:i,display:String(s)}),{variant:"error",title:m,duration:Number.POSITIVE_INFINITY}}return{variant:"warning",title:n("ui.projects.request_update.could_not_reach_failed_of_the_total_linked_sessions_on_display_de",{failed:V(o,{useGrouping:!1}),total:i,display:String(s),value4:String(zt(c))}),duration:Number.POSITIVE_INFINITY}}const at=new Map,Ss=new Set,Gt=new Map,is=new Set;let cn=0;const Et=()=>{cn+=1;for(const e of is)e()},Xi=e=>(is.add(e),()=>{is.delete(e)}),nr=()=>cn,ln=e=>Ss.has(e),un=e=>at.get(e);function Ji(e){Ss.add(e),Et()}function Zi(e){Ss.delete(e),Et()}function ar(e,s,r){const a=Date.now();if(r<=a)return;const o=at.get(e);if(o&&o.untilMs>=r)return;at.set(e,{startedMs:s,untilMs:r});const i=Gt.get(e);i&&clearTimeout(i);const l=setTimeout(()=>{Gt.delete(e);const c=at.get(e);c&&c.untilMs<=Date.now()&&(at.delete(e),Et())},r-a);l.unref?.(),Gt.set(e,l),Et()}const ec=e=>/[.!?…]$/.test(e)?e:`${e}.`;function tc(e,s){const r=Date.now();if(s.state==="cooldown"){const a=Math.max(0,s.cooldown_remaining_s??0)*1e3;ar(e,r-(as-a),r+a);return}s.state==="sent"&&(s.counts.delivered>=1||s.counts.unconfirmed>=1)&&ar(e,r,r+as)}async function sc(e){const s=e.id;if(ln(s)){Ps(n("ui.projects.request_update.requesting_updates"),{id:sr(s)});return}const r=Date.now(),a=un(s);if(a&&a.untilMs>r){Ms(Ct(X(e),a.untilMs-r),{id:Ki(s),duration:os});return}Ji(s);const o=sr(s);let i=!1;const l=setTimeout(()=>{i=!0,Ps(n("ui.projects.request_update.requesting_updates"),{id:o})},Yi);try{const c=await pe({op:"projects.request_update",key:s});tc(s,c);const u=Qi(c);if(u){const m={id:o,...u.duration!==void 0?{duration:u.duration}:{}};switch(u.variant){case"success":je(u.title,m);break;case"warning":Bn(u.title,m);break;case"error":Is(u.title,m);break;default:Ms(u.title,m)}}else i&&$n(o)}catch(c){const u=c instanceof Error&&c.message.trim()!==""?c.message.trim():null;Is(u?n("ui.projects.use_request_update.could_not_request_updates_endedsentence_message",{endedSentence_message:String(ec(u))}):n("ui.projects.use_request_update.the_request_could_not_be_confirmed"),{id:o,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),Zi(s)}}function dn(){return d.useCallback(e=>{sc(e)},[])}function rc(e){d.useSyncExternalStore(Xi,nr,nr);const s=ln(e),r=un(e),a=r!==void 0?r.untilMs-Date.now():0,o=a>0;return{sending:s,cooling:o,cooldownRemainingMs:o?a:null}}const or={get active(){return n("ui.projects.project_board.in_flight")},get paused(){return n("ui.projects.project_board.on_hold")},get done(){return n("ui.projects.project_board.finished")}};function nc(){const[e,s]=d.useState(null);return d.useEffect(()=>{if(!e)return;const r=document.querySelector(`[data-project-menu="${e}"]`);r&&(r.focus(),s(null))}),d.useCallback(r=>s(r),[])}const ac=4,ir="board-column-move-hint",oc=({projects:e,nowMs:s,onOpen:r,onEdit:a,onDelete:o,onMove:i,movingKeys:l=[],teamLabelFor:c=u=>u})=>{L();const[u,m]=d.useState(vo),p=No(e,u),f=bs(e,_t),[b,_]=d.useState(null),[x,v]=d.useState(""),g=d.useRef(null),h=d.useRef(null),y=d.useRef(null),T=d.useRef(null),w=d.useRef(null),U=new Set(l),C=(k,N)=>{const D=wo(p.map(F=>F.status),k,N);m(D),ko(D),v(n("ui.projects.project_board.moved_label_column_to_position_indexof_status_1_of_length",{label:String(se(k).label),indexOf_status____1:String(D.indexOf(k)+1),length:V(D.length,{useGrouping:!1})}))},E=(k,N)=>{const D=g.current;if(!D)return 0;let F=0;const B=D.querySelectorAll("[data-board-column]");for(const $ of B){if($.dataset.boardColumn===N)continue;const ie=$.getBoundingClientRect();k>(ie.left+ie.right)/2&&(F+=1)}return F},P=(k,N)=>{const D=p.filter($=>$.status!==k),F=D[N-1]?.status,B=D[N]?.status;return F&&B?n("ui.projects.project_board.between_label_and_label_2",{label:String(se(F).label),label_2:String(se(B).label)}):B?n("ui.projects.project_board.before_label",{label:String(se(B).label)}):F?n("ui.projects.project_board.after_label",{label:String(se(F).label)}):n("ui.projects.project_board.in_place")},j=(k,N)=>{const D=E(k,N.status);D!==N.over&&(N.over=D,_({status:N.status,over:D}),v(n("ui.projects.project_board.moving_label_column_it_will_drop_status_over",{label:String(se(N.status).label),status__over:String(P(N.status,D))})))},O=()=>{T.current!==null&&(cancelAnimationFrame(T.current),T.current=null)},R=32,I=12,Y=()=>{T.current=null;const k=w.current,N=g.current,D=y.current;if(!k?.armed||!N||D===null)return;const F=N.getBoundingClientRect(),B=N.scrollWidth-N.clientWidth;let $=0;if(D-F.left<R&&N.scrollLeft>0?$=-1:F.right-D<R&&N.scrollLeft<B&&($=1),$!==0){const ie=N.scrollLeft;N.scrollLeft=ie+$*I,N.scrollLeft!==ie&&j(D,k)}else j(D,k);Z(k.status,k.over),T.current=requestAnimationFrame(Y)};d.useEffect(()=>()=>{T.current!==null&&cancelAnimationFrame(T.current)},[]);const q=(k,N)=>{if(k.button===0){try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}w.current={pointerId:k.pointerId,status:N,startX:k.clientX,startY:k.clientY,armed:!1,over:p.findIndex(D=>D.status===N)},y.current=k.clientX}},G=k=>{const N=w.current;if(!(!N||k.pointerId!==N.pointerId)){if(y.current=k.clientX,!N.armed){if(Math.hypot(k.clientX-N.startX,k.clientY-N.startY)<ac)return;N.armed=!0,_({status:N.status,over:N.over}),v(n("ui.projects.project_board.moving_label_column",{label:String(se(N.status).label)})),T.current===null&&(T.current=requestAnimationFrame(Y))}j(k.clientX,N)}},W=k=>{const N=w.current;if(w.current=null,O(),_(null),!N?.armed)return;if(!k){v(n("ui.projects.project_board.move_cancelled"));return}const D=p.findIndex(F=>F.status===N.status);if(N.over===D){v("");return}C(N.status,N.over)},J=k=>{const N=w.current;!N||k.pointerId!==N.pointerId||W(!0)},de=()=>{W(!1)};d.useEffect(()=>{if(!b)return;const k=N=>{N.key==="Escape"&&W(!1)};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[b!==null]);const Z=d.useCallback((k,N)=>{const D=g.current,F=h.current;if(!D||!F)return;const B=D.getBoundingClientRect(),$=[];for(const ce of D.querySelectorAll("[data-board-column]"))ce.dataset.boardColumn!==k&&$.push(ce.getBoundingClientRect());const ie=6,Ae=N>=$.length?($[$.length-1]?.right??B.left)+ie:($[N]?.left??B.right)-ie,H=D.scrollLeft,Ce=2,be=Ae-B.left+H,fe=H+1,te=H+B.width-Ce-1,Oe=Math.round(Math.min(Math.max(be,fe),Math.max(fe,te)));F.style.left=`${Oe}px`},[]);d.useLayoutEffect(()=>{b&&Z(b.status,b.over)},[b,Z]);const ee=(k,N)=>{if(k.key==="Enter"||k.key===" "){k.preventDefault(),v(n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"));return}if(k.key!=="ArrowLeft"&&k.key!=="ArrowRight")return;k.preventDefault();const D=p.map($=>$.status),F=D.indexOf(N),B=k.key==="ArrowLeft"?F-1:F+1;if(B<0||B>=D.length){v(n("ui.projects.project_board.label_column_is_already_the_last_column",{label:String(se(N).label),the_last_column:String(B<0?n("ui.projects.project_board.the_first_column"):n("ui.projects.project_board.the_last_column"))}));return}C(N,B)};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:x}),t.jsx("span",{id:ir,className:"sr-only",children:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column")}),t.jsxs("div",{ref:g,"data-board-strip":"",className:M("relative flex min-h-0 flex-1 items-start overflow-auto px-6 pb-9",b&&"cursor-grabbing select-none"),children:[b&&t.jsx("div",{ref:h,"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:p.map(k=>{const N=se(k.status);return t.jsxs("header",{"data-board-column":k.status,"data-glass-lane":"","data-board-column-handle":k.status,onPointerDown:D=>q(D,k.status),onPointerMove:G,onPointerUp:J,onPointerCancel:de,className:M("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===k.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(z,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":k.status,"aria-label":n("ui.projects.project_board.move_label_column",{label:String(N.label)}),"aria-describedby":ir,title:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"),className:"-ml-1.5 cursor-grab text-ink-muted active:cursor-grabbing",onKeyDown:D=>ee(D,k.status),children:t.jsx(Da,{"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:N.label}),or[k.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:or[k.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:k.projects.length})]},k.status)})}),f.map(k=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":k.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:k.team==null?n("ui.projects.project_model.no_team"):c(k.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:k.items.length})]})}),t.jsx("div",{"data-glass-lane":"",className:"flex gap-3 rounded-md bg-sunken py-2",children:p.map(N=>{const D=k.items.filter(F=>F.status===N.status);return t.jsx("div",{"data-board-cell":N.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:D.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:D.map(F=>t.jsx("li",{children:t.jsx(ic,{project:F,nowMs:s,busy:U.has(F.id),onOpen:()=>r(F),onEdit:()=>a(F),onDelete:()=>o(F),onMove:B=>i(F,B)})},F.id))})},N.status)})})]},k.team??""))]})]})]})},ic=({project:e,nowMs:s,busy:r,onOpen:a,onEdit:o,onDelete:i,onMove:l})=>{const c=L(),u=Br(e,c),m=Je(),p=dn(),f=he(m.data,"projects_request_update"),b=X(e),_=d.useRef(null),[x,v]=d.useState(!1);d.useEffect(()=>{const w=_.current;if(!w)return;const U=()=>{w.isConnected&&v(w.scrollWidth-w.clientWidth>.5)},C=requestAnimationFrame(U),E=new ResizeObserver(U);return E.observe(w),document.fonts?.ready.then(U).catch(()=>{}),()=>{cancelAnimationFrame(C),E.disconnect()}},[b,x]);const g=Hr(e,Ns(s)),h=pt(e.progress_updated_at,s),y=()=>{const w=window.getSelection();w&&!w.isCollapsed||a()},T=w=>{w.key!=="Enter"&&w.key!==" "||w.target===w.currentTarget&&(w.preventDefault(),a())};return t.jsxs("div",{"data-project-name":e.name,role:"button",tabIndex:0,"aria-label":n("ui.projects.project_board.open_displayname",{displayName:String(b)}),onClick:y,onKeyDown:T,"data-glass-block":"",className:M("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",g&&"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(Ot,{content:x?b:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:_,"data-project-title":e.name,tabIndex:x?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:b})}),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(ps,{children:[t.jsx(ms,{"data-project-menu":e.id,"aria-label":n("ui.projects.project_board.actions_for_displayname",{displayName:String(b)}),disabled:r,onClick:w=>w.stopPropagation(),className:M("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:r?t.jsx(Se,{size:"xs"}):t.jsx(yr,{className:"size-4"})}),t.jsxs(_s,{align:"end",onClick:w=>w.stopPropagation(),children:[t.jsx(Ne,{onSelect:a,children:n("ui.projects.project_board.open")}),t.jsxs(ya,{children:[t.jsx(va,{children:n("ui.projects.project_board.set_status")}),t.jsx(ka,{children:t.jsx(wa,{value:e.status,onValueChange:l,children:[...Vt,...Qt].map(w=>t.jsx(Na,{value:w,children:se(w).label},w))})})]}),f&&t.jsx(Ne,{onSelect:()=>p(e),children:n("ui.projects.project_board.request_update")}),t.jsx(Sa,{}),t.jsx(Ne,{onSelect:o,children:n("ui.projects.project_board.edit")}),t.jsx(Ne,{onSelect:i,children:n("ui.projects.project_board.delete")})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u.filter(w=>w.key!=="live").map(w=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:w.text},w.key)),g&&t.jsx(xe,{variant:"warning",children:n("ui.projects.project_board.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:co(h)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!h)&&t.jsx("span",{"aria-label":n("ui.projects.project_model.stale"),title:n("ui.projects.project_model.stale"),className:"size-1.5 rounded-full bg-warning"}),e.sessions>0&&t.jsx(cc,{project:e})]})]})]})},cc=({project:e})=>{L();const[s,r]=d.useState(!1),a=Dt(),o=Ar(e.id,s),i=o.data?.links??[],l=mo(e),c=X(e);return t.jsxs(fs,{open:s,onOpenChange:r,children:[t.jsx(js,{"data-project-sessions":e.id,"aria-label":n("ui.projects.project_board.sessions_linked_to_displayname",{displayName:String(c)}),onClick:u=>u.stopPropagation(),className:M("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(hs,{align:"end",className:"w-64 p-2 outline-none",onClick:u=>u.stopPropagation(),children:o.isLoading?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:n("ui.projects.project_board.loading_linked_sessions")}):o.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:o.error instanceof Error&&o.error.message?o.error.message:n("ui.projects.project_board.the_linked_sessions_could_not_be_read")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:()=>void o.refetch(),children:n("ui.projects.project_board.try_again")})]}):i.length===0?t.jsx("p",{className:"px-1 py-2 text-meta text-ink-muted",children:n("ui.projects.project_board.no_sessions_linked_yet")}):t.jsx("ul",{className:"flex flex-col",children:i.map(u=>t.jsx("li",{children:t.jsx("button",{type:"button",disabled:!u.exists,onClick:()=>{u.exists&&(r(!1),Rr(a,u.session_id))},className:M("flex w-full items-center gap-2 rounded-sm px-1 py-1.5 text-left text-meta",u.exists?"text-ink hover:bg-elevated":"text-ink-disabled"),children:t.jsx("span",{className:"truncate",children:u.title||u.session_id})})},u.session_id))})})]})},pn=({open:e,projectName:s,onClose:r,onConfirm:a})=>{L();const[o,i]=d.useState(""),[l,c]=d.useState(null),[u,m]=d.useState(!1),p=d.useId();d.useEffect(()=>{e&&(i(""),c(null),m(!1))},[e]);const f=o.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,b=async()=>{m(!0),c(null);try{await a(o.trim()),r()}catch(_){c(_ instanceof Error&&_.message?_.message:n("ui.projects.project_delete_dialog.the_project_was_not_deleted"))}finally{m(!1)}};return t.jsx(dt,{open:e,onClose:r,title:n("ui.projects.project_delete_dialog.delete_this_project"),dataTourTag:"project-delete-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ye,{onClick:r,disabled:u,children:n("ui.projects.project_delete_dialog.cancel")}),t.jsxs(zn,{onClick:()=>void b(),disabled:!f||u,children:[u&&t.jsx(Se,{size:"xs"}),n("ui.projects.project_delete_dialog.delete_project")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink",children:n("ui.projects.project_delete_dialog.this_deletes_the_project_and_its_milestones_the_sessions_linked_t")}),t.jsxs("p",{className:"text-body-sm text-ink-muted",children:[n("ui.projects.project_delete_dialog.type")," ",t.jsx("span",{className:"font-mono text-mono-sm text-ink",children:s})," ",n("ui.projects.project_delete_dialog.to_confirm")]}),t.jsx(oe,{id:`${p}-confirm`,value:o,onChange:_=>i(_.target.value),placeholder:s,"aria-label":n("ui.projects.project_delete_dialog.type_the_project_name_to_confirm"),"aria-invalid":o.length>0&&!f,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function lc(e){return e==="editing"||e==="saving"||e==="error"}function uc(e,s,r=Object.is){return!r(e,s)}function dc(e,s){if(e.key==="Escape")return e.defaultPrevented===!0?null:"revert";if(e.key!=="Enter"||!s.keyboardCommit)return null;const r=e.metaKey===!0||e.ctrlKey===!0;return s.multiline?r?"accept":null:s.onEditor?"accept":null}function pc(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function mc(e){const{phase:s,base:r,draft:a,fresh:o,equals:i}=e;return s==="saving"||s==="saved"||i(r,o)?"none":s==="idle"||i(r,a)||i(o,a)?"adopt":"conflict"}function cr(e,s,r=Object.is){return!r(e,s)}const Cs="group/inline-edit",Yt="inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-xs text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink-muted",_c="relative before:absolute before:-inset-1.5 before:content-['']",fc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",jc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-right-1.5 before:left-0 before:content-['']",cs=({api:e,idle:s="affordance",className:r})=>{const{phase:a,labels:o}=e,i=a==="editing"||a==="saving"||a==="error",l=pc(a,e.dirty),c=e.acceptBlocked===!0;return t.jsx("span",{"data-inline-edit-slot":a,className:M("inline-flex shrink-0 items-center gap-0.5",r),children:l?t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","data-inline-edit-control":"cancel","aria-label":a==="saving"?o.busy:o.cancel,title:a==="saving"?o.busy:o.cancel,"aria-disabled":a==="saving"||void 0,onMouseDown:u=>u.preventDefault(),onClick:u=>{u.detail>1||a!=="saving"&&e.cancel()},className:M(Yt,fc,a==="saving"&&"cursor-default text-ink-disabled"),children:t.jsx(Pt,{className:"size-3","aria-hidden":"true"})}),a==="saving"?t.jsx("span",{"data-inline-edit-control":"busy",className:"inline-flex size-5 shrink-0 items-center justify-center",children:t.jsx(Se,{size:"xs"})}):t.jsx("button",{type:"button","data-inline-edit-control":"accept","aria-label":a==="error"?o.retry??o.accept:o.accept,title:a==="error"?o.retry??o.accept:o.accept,"aria-disabled":c||void 0,onMouseDown:u=>u.preventDefault(),onClick:u=>{u.detail>1||c||e.accept()},className:M(Yt,jc,c&&"cursor-default text-ink-disabled"),children:t.jsx(gs,{className:"size-3","aria-hidden":"true"})})]}):i?null:s==="affordance"?t.jsx("button",{ref:e.slotRef,type:"button","data-inline-edit-control":"begin","aria-label":o.begin,title:o.begin,onClick:u=>{u.detail>1||e.begin()},className:M(Yt,_c,"opacity-0 transition-opacity duration-base ease-out-quart","group-hover/inline-edit:opacity-100 group-hover/inline-edit:duration-fast","group-focus-within/inline-edit:opacity-100 group-focus-within/inline-edit:duration-fast","focus-visible:opacity-100"),children:t.jsx(Gn,{className:"size-3","aria-hidden":"true"})}):null})},ls=({api:e,className:s})=>{L();const{phase:r,error:a,conflict:o}=e;return r==="saved"?t.jsx("p",{"data-inline-edit-feedback":"saved",className:M("text-meta text-success",s),children:e.labels.saved}):!a&&!o?null:t.jsxs("div",{id:e.feedbackId,"data-inline-edit-feedback":a&&o?"error+conflict":a?"error":"conflict",role:"alert",className:M("flex flex-wrap items-center gap-x-3 gap-y-1",s),children:[a&&t.jsx("p",{className:"text-meta text-danger",children:a}),a&&o===null&&t.jsx("button",{type:"button","data-inline-edit-control":"retry",onClick:()=>e.accept(),className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.common.actions.retry")}),o!==null&&t.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-meta text-warning",children:n("ui.common.editing.conflict")}),t.jsx("button",{type:"button","data-inline-edit-control":"keep-mine",onClick:e.keepMine,className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.common.editing.keep_mine")}),t.jsx("button",{type:"button","data-inline-edit-control":"use-theirs",onClick:e.useTheirs,className:"cursor-pointer text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.common.editing.use_theirs")})]})]})},mn=d.createContext(null),hc=50,gc=({children:e})=>{const[s,r]=d.useState(""),a=d.useMemo(()=>({current:o=>{r(""),window.setTimeout(()=>r(o),hc)}}),[]);return t.jsxs(mn.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},xc=1200;function bc(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function jt(e){const{value:s,multiline:r=!1,keyboardCommit:a=!0,selectAllOnBegin:o=!1,beginOnMount:i=!1,savedDwellMs:l=xc,labels:c}=e,u=d.useRef(e.equals??Object.is);u.current=e.equals??Object.is;const m=d.useRef(e.commit);m.current=e.commit;const p=d.useRef(e.validate);p.current=e.validate;const f=d.useRef(e.errorCopy);f.current=e.errorCopy;const b=d.useRef(e.onSettle);b.current=e.onSettle;const _=d.useRef(e.onBegin);_.current=e.onBegin;const x=d.useRef(c);x.current=c;const[v,g]=d.useState(i?"editing":"idle"),[h,y]=d.useState(s),[T,w]=d.useState(s),[U,C]=d.useState(null),[E,P]=d.useState(null),j=d.useRef(v),O=d.useRef(h),R=d.useRef(T),I=d.useRef(U),Y=d.useRef(s);Y.current=s;const q=d.useCallback(A=>{j.current=A,g(A)},[]),G=d.useCallback(A=>{O.current=A,y(A)},[]),W=d.useCallback(A=>{R.current=A,w(A)},[]),J=d.useCallback(A=>{I.current=A,C(A)},[]),de=d.useRef(null),Z=d.useRef(null),ee=d.useRef(null),k=e.editorRef??ee,N=d.useRef(k);N.current=k;const D=`${d.useId()}-inline-edit`,F=d.useContext(mn),B=d.useRef(null),$=B.current,Ae=$!==null&&(e.equals??Object.is)(s,$.previous)&&!(e.equals??Object.is)(s,$.saved)&&$!==null?$.saved:s,H=d.useRef(Ae);H.current=Ae,d.useEffect(()=>{const A=B.current;if(A===null)return;const ne=u.current;(ne(s,A.saved)||!ne(s,A.previous))&&(B.current=null)},[s]);const Ce=d.useRef(i);d.useEffect(()=>{if(v!=="editing"||!Ce.current)return;Ce.current=!1;const A=N.current.current;A&&(A.focus(),o&&(A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement)&&A.select())},[v,o]);const be=d.useRef(!1);d.useEffect(()=>{be.current&&(v!=="idle"&&v!=="saved"||(be.current=!1,Z.current?.focus()))});const fe=d.useRef(null),te=d.useCallback(()=>{fe.current!==null&&(clearTimeout(fe.current),fe.current=null)},[]);d.useEffect(()=>()=>te(),[te]);const Oe=d.useRef(v);d.useEffect(()=>{const A=Oe.current;if(Oe.current=v,A==="saving"&&v==="saved"){b.current?.("saved");return}(A==="editing"||A==="error")&&v==="idle"&&b.current?.("cancelled")},[v]),d.useEffect(()=>{const A=mc({phase:j.current,base:R.current,draft:O.current,fresh:H.current,equals:u.current});A==="adopt"?(u.current(R.current,H.current)||W(H.current),u.current(H.current,O.current)||G(H.current)):A==="conflict"&&(I.current===null||!u.current(I.current,H.current))&&J(H.current)},[s,v,W,G,J]);const ce=d.useCallback(A=>{J(null),P(null),G(R.current),q("idle"),A&&(be.current=!0)},[J,G,q]),tt=d.useCallback(()=>{j.current!=="saving"&&(j.current==="idle"||j.current==="saved"||(te(),ce(!0)))},[te,ce]),re=d.useCallback((A,ne=!0)=>{const nt=j.current;if(nt==="saving"||nt==="saved"||I.current!==null)return;const ye=A!==void 0?A:O.current;if(!cr(R.current,ye,u.current)){ce(ne&&nt!=="idle");return}const gt=p.current?.(ye)??null;if(gt!==null){q("error"),P(gt);return}G(ye),P(null),q("saving"),m.current(ye).then(()=>{j.current==="saving"&&(B.current={saved:ye,previous:R.current},W(ye),G(ye),ne&&(be.current=!0),q("saved"),te(),fe.current=setTimeout(()=>{fe.current=null,j.current==="saved"&&q("idle")},l),F?.current?.(x.current.saved))},Be=>{j.current==="saving"&&(q("error"),P(f.current?f.current(Be):bc(Be)))})},[F,te,ce,l,W,G,q]),Ee=d.useCallback(()=>{j.current==="editing"||j.current==="saving"||(te(),Ce.current=!0,G(H.current),W(H.current),J(null),P(null),q("editing"),_.current?.())},[te,W,J,G,q]),Ue=d.useCallback(()=>{const A=I.current;A!==null&&(J(null),W(A),re())},[re,W,J]),qt=d.useCallback(()=>{const A=I.current;A!==null&&(W(A),ce(!0))},[ce,W]),st=d.useCallback(A=>{const ne=dc(A,{multiline:r,keyboardCommit:a,onEditor:A.target===N.current.current});if(ne==="revert"){A.preventDefault(),tt();return}ne==="accept"&&(A.preventDefault(),re())},[re,tt,a,r]),rt=d.useCallback(A=>{if(j.current!=="editing")return;const ne=A.relatedTarget;if(!(ne!==null&&de.current?.contains(ne))&&!(ne instanceof Element&&ne.closest("[data-radix-popper-content-wrapper]")!==null)&&I.current===null){if(!cr(R.current,O.current,u.current)){ce(!1);return}re(void 0,!1)}},[re,ce]),ht=v==="saved"?h:Ae;return{phase:v,dirty:uc(T,h,u.current),conflict:U,error:E,draft:h,setDraft:G,displayValue:ht,editing:lc(v),begin:Ee,accept:re,cancel:tt,keepMine:Ue,useTheirs:qt,handleKeyDown:st,handleBlur:rt,fieldProps:{onKeyDown:st,onBlur:rt,"aria-busy":v==="saving"?!0:void 0},editorAria:{"aria-invalid":E!==null?!0:void 0,"aria-describedby":E!==null||U!==null?D:void 0},fieldRef:de,editorRef:k,slotRef:Z,feedbackId:D,labels:c}}const yc=/^(https?:|mailto:)/i,vc={a:({href:e,children:s})=>typeof e=="string"&&yc.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:Hn},ut=d.memo(({children:e,className:s})=>t.jsx("div",{className:M("lo-markdown",s),children:t.jsx(Yn,{remarkPlugins:[Kn],components:vc,children:e})})),lr=`## Summary
|
|
28
23
|
|
|
29
24
|
## Goals
|
|
30
25
|
|
|
31
|
-
## Notes`,
|
|
32
|
-
`))},u=e.match(
|
|
26
|
+
## Notes`,kc=new RegExp("\\p{Mn}","gu"),wc=/[^a-z0-9._-]+/g,Nc=/[._-]{2,}/g,Sc=/^[^a-z0-9]+/,ur=/[^a-z0-9]+$/;function Cc(e){return e.normalize("NFKD").replace(kc,"").toLowerCase().replace(wc,"-").replace(Nc,"-").replace(Sc,"").replace(ur,"").slice(0,64).replace(ur,"")}const Ec=/&#x([0-9a-f]+);/gi,Tc=/&#(\d+);/g,Rc=/ /g,Dc=/</g,Ac=/>/g,Oc=/"/g,Pc=/'|'/g,Mc=/&/g,dr=e=>e.replace(Ec,(s,r)=>String.fromCodePoint(Number.parseInt(r,16))).replace(Tc,(s,r)=>String.fromCodePoint(Number.parseInt(r,10))).replace(Rc," ").replace(Dc,"<").replace(Ac,">").replace(Oc,'"').replace(Pc,"'").replace(Mc,"&"),Ic=/<[^>]*>|[^<]+/g,Lc=/^<\//,Fc=/^<\/?\s*([a-zA-Z][a-zA-Z0-9]*)/,qc=/\s+/g,pr=/class="[^"]*language-([\w+-]+)/,Uc=/href="([^"]*)"/,Bc=/src="([^"]*)"/,$c=/alt="([^"]*)"/,zc=/[ \t]+\n/g,Gc=/\n{3,}/g;function Yc(e){const s=[],r=(...m)=>{for(let p=s.length-1;p>=0;p--)if(m.includes(s[p].tag)){const[f]=s.splice(p,1);return f}},a=[],o=()=>s.some(m=>m.tag==="pre"),i=()=>s.filter(m=>m.tag==="blockquote").length;let l=!0;const c=m=>{m&&(i()>0&&l&&!o()&&a.push("> ".repeat(i())),a.push(m),l=m.endsWith(`
|
|
27
|
+
`))},u=e.match(Ic)??[];for(let m=0;m<u.length;m++){const p=u[m];if(!p.startsWith("<")){c(o()?dr(p):dr(p).replace(qc," "));continue}const f=Lc.test(p),b=(p.match(Fc)?.[1]??"").toLowerCase();if(f){switch(b){case"p":case"div":c(`
|
|
33
28
|
|
|
34
29
|
`);break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":r(b),c(`
|
|
35
30
|
|
|
@@ -38,8 +33,8 @@ import{r as d,t as n,d as Le,j as t,c as M}from"./index-Dom8jp4B.js";import{bU a
|
|
|
38
33
|
`);break;case"strong":case"b":r("strong","b")&&c("**");break;case"em":case"i":r("em","i")&&c("*");break;case"del":case"s":r("del","s")&&c("~~");break;case"code":{r("code")?.inline&&c("`");break}case"pre":r("pre")&&c("\n```\n\n");break;case"a":{const _=r("a");_?.href&&c(`](${_.href})`);break}case"blockquote":r("blockquote")&&c(`
|
|
39
34
|
`);break}continue}switch(b){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{const _=Number(b[1]);s.push({tag:b}),c(`${"#".repeat(_)} `);break}case"ul":case"ol":s.push({tag:b,ordered:b==="ol",index:1});break;case"li":{const _=[...s].reverse().find(x=>x.tag==="ul"||x.tag==="ol");s.push({tag:"li"}),_?.ordered?c(`${_.index??1}. `):c("- ");break}case"strong":case"b":s.push({tag:b}),c("**");break;case"em":case"i":s.push({tag:b}),c("*");break;case"del":case"s":s.push({tag:b}),c("~~");break;case"code":{const _=s[s.length-1]?.tag!=="pre";s.push({tag:"code",inline:_}),_&&c("`");break}case"pre":{const _=p.match(pr)?.[1]??u[m+1]?.match(pr)?.[1]??"";s.push({tag:"pre"}),c(`
|
|
40
35
|
\`\`\`${_}
|
|
41
|
-
`);break}case"a":{const _=p.match(
|
|
42
|
-
`);break;case"blockquote":s.push({tag:"blockquote"});break}}return a.join("").replace(
|
|
43
|
-
`).replace(
|
|
36
|
+
`);break}case"a":{const _=p.match(Uc)?.[1]??"";s.push({tag:"a",href:_}),_&&c("[");break}case"img":{const _=p.match(Bc)?.[1]??"",x=p.match($c)?.[1]??"";_&&c(``);break}case"br":c(`
|
|
37
|
+
`);break;case"blockquote":s.push({tag:"blockquote"});break}}return a.join("").replace(zc,`
|
|
38
|
+
`).replace(Gc,`
|
|
44
39
|
|
|
45
|
-
`).trim()}function _n(e,s,r){const a=e.clipboardData?.getData("text/html");if(!a)return;const o=Hc(a);if(!o)return;e.preventDefault();const i=e.currentTarget,l=i.selectionStart??i.value.length,c=i.selectionEnd??l;r(i.value.slice(0,l)+o+i.value.slice(c)),requestAnimationFrame(()=>{const u=s.current;if(!u)return;const m=l+o.length;u.setSelectionRange(m,m)})}const fn=({open:e,refusal:s,projectLabel:r,onClose:a,onConfirm:o,secondaryLabel:i,onSecondary:l})=>{L();const[c,u]=d.useState(!1),[m,p]=d.useState(null),f=d.useRef(!1),b=d.useRef(null);d.useEffect(()=>{e&&(u(!1),p(null),f.current=!1)},[e]);const _=async()=>{if(!f.current){f.current=!0,u(!0),p(null);try{await o(),a()}catch(v){p({copy:an(v),gone:nn(v)})}finally{f.current=!1,u(!1)}}},x=s?.names??[];return t.jsx(dt,{open:e,onClose:a,title:n("ui.projects.project_done_anyway_dialog.mark_done_with_open_milestones"),dataTourTag:"project-done-anyway-dialog",maxWidth:"xs",dialogProps:{closeDisabled:c,onEscapeKeyDown:v=>{c&&v.preventDefault()},onInteractOutside:v=>{c&&v.preventDefault()},onOpenAutoFocus:v=>{v.preventDefault(),b.current?.focus()}},actions:t.jsxs("div",{className:"flex w-full min-w-0 flex-wrap justify-end gap-2",children:[t.jsx(Ye,{ref:b,onClick:a,disabled:c,children:n("ui.projects.project_done_anyway_dialog.cancel")}),!m?.gone&&t.jsx(Ye,{onClick:l,disabled:c,children:i}),m?.gone?t.jsx(kt,{"data-project-force-close":"",onClick:a,children:n("ui.projects.project_done_anyway_dialog.close")}):t.jsxs(kt,{"data-project-force-done":"","aria-disabled":c,className:"aria-disabled:pointer-events-none aria-disabled:bg-sunken aria-disabled:text-ink-disabled",onClick:()=>void _(),children:[c?t.jsx(Se,{size:"xs"}):t.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0"}),n("ui.projects.project_done_anyway_dialog.mark_done_anyway")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink break-words",children:r?n("ui.projects.project_done_anyway_dialog.projectlabel_moves_to_done_and_its_milestones_stay_open",{projectLabel:String(r)}):n("ui.projects.project_done_anyway_dialog.the_project_moves_to_done_and_its_milestones_stay_open")}),t.jsx("p",{className:"text-body-sm text-ink break-words",children:s?Yo(s):""}),x.length>yt+1&&t.jsx("div",{className:"px-1.5",children:t.jsx(vr,{summary:n("ui.projects.project_done_anyway_dialog.show_all_length_open_milestones",{length:x.length}),children:t.jsx("ul",{"data-project-open-milestones":"",className:"flex flex-col gap-1 py-1 text-body-sm text-ink-muted",children:x.map((v,g)=>t.jsx("li",{className:"break-words",children:v},`${g}-${v}`))})})}),t.jsx("p",{role:"alert",className:"min-h-[1lh] text-body-sm text-danger break-words",children:m?.copy??""})]})})},jn=({status:e})=>{const s=se(e);return t.jsxs(xe,{variant:s.variant,children:[ao(e)&&t.jsx(gs,{"aria-hidden":!0}),s.label]})},Kc="project-key",Wc="project-key";function _e(e,s){return{name:s,begin:n("ui.projects.project_editors.edit_field",{field:String(e)}),accept:n("ui.projects.project_editors.save_field",{field:String(e)}),cancel:n("ui.projects.project_editors.discard_the_field_edit",{field:String(e)}),busy:n("ui.projects.project_editors.saving_the_field",{field:String(e)}),saved:n("ui.projects.project_editors.display_saved",{display:String(s)}),retry:n("ui.projects.project_editors.retry_saving_the_field",{field:String(e)})}}const Ft=({field:e,fieldRef:s,fieldProps:r,editing:a,label:o,bare:i=!1,display:l,editor:c,slot:u,feedback:m,controlsIdle:p="affordance",hug:f=!1,feedbackExtra:b,className:_,controlsClassName:x})=>t.jsxs("div",{ref:s,...r,"data-project-field":e,className:M(!i&&Cs,"min-w-0",o!==void 0&&"flex items-start gap-3",_),children:[o!==void 0&&t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:o}),t.jsxs("div",{className:M("flex min-w-0 flex-col gap-1",f&&"items-start",o!==void 0&&"flex-1"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("div",{className:M("min-w-0",f?"w-fit":"flex-1",!a&&"cursor-text"),onDoubleClick:a?void 0:u.begin,children:a?c:l}),t.jsx(cs,{api:u,idle:p,className:M("shrink-0",x)})]}),t.jsx("div",{className:M("min-h-[1lh] text-meta",f&&"max-w-96"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx(ls,{api:m}),b]})})]})]}),Ie=({field:e,value:s,display:r,commitFields:a,validate:o,labels:i,commit:l,placeholder:c,mono:u=!1,ramp:m="text-body-sm",label:p,bare:f=!1,autoBegin:b=!1,maxLength:_,onRetire:x,className:v,controlsClassName:g})=>{const[h,y]=d.useState(b);d.useEffect(()=>{h&&s!==""&&(y(!1),x?.("filled"))},[h,s,x]);const T=ht({value:s,commit:async w=>{await l(a(w))},equals:(w,U)=>w.trim()===U.trim(),validate:o,labels:i,selectAllOnBegin:!0,beginOnMount:b,errorCopy:et,onSettle:w=>{w==="cancelled"&&(y(!1),x?.("cancelled"))}});return!h&&s===""?null:t.jsx(Ft,{field:e,fieldRef:T.fieldRef,fieldProps:T.fieldProps,editing:T.editing,label:p,bare:f,display:r,slot:T,feedback:T,className:v,controlsClassName:g,editor:t.jsx(oe,{ref:T.editorRef,...T.editorAria,value:T.draft,readOnly:T.phase==="saving",maxLength:_,placeholder:c,"aria-label":i.name,onChange:w=>T.setDraft(w.target.value),spellCheck:!1,autoComplete:"off",className:M("h-8",u?"font-mono text-mono-sm":m)})})},Vc=({project:e,commit:s})=>{L();const r=e.title??"",[a,o]=d.useState(!1),i=d.useRef(null),l=c=>{o(!1),c==="cancelled"&&setTimeout(()=>i.current?.focus(),0)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsxs("div",{className:M(Cs,"flex min-w-0 flex-col gap-0.5"),children:[r?t.jsx(Ie,{field:"title",value:r,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:r}),commitFields:c=>({title:c.trim()}),validate:c=>ts(c),labels:_e("title",n("ui.projects.project_editors.title")),commit:s,maxLength:Nt,placeholder:n("ui.projects.project_editors.a_short_name_for_the_workstream"),ramp:"text-body",bare:!0,controlsClassName:"self-center"}):t.jsx(Ie,{field:"key",value:e.name,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:e.name}),commitFields:c=>({name:c.trim()}),validate:c=>Wt(c.trim()),labels:_e("key",n("ui.projects.project_editors.key")),commit:s,maxLength:Zs,placeholder:Kc,ramp:"text-body",bare:!0,controlsClassName:"self-center"}),!r&&(a?t.jsx(Ie,{field:"title",value:"",display:null,commitFields:c=>({title:c.trim()}),validate:c=>ts(c),labels:_e("title",n("ui.projects.project_editors.title")),commit:s,maxLength:Nt,placeholder:e.name,ramp:"text-body-sm",bare:!0,autoBegin:!0,onRetire:l}):t.jsx("button",{ref:i,type:"button","data-project-add-title":"",onClick:()=>o(!0),className:M("w-fit cursor-pointer text-meta text-ink-dim","opacity-0 transition-opacity duration-base ease-out-quart","group-hover/inline-edit:opacity-100 group-hover/inline-edit:duration-fast","group-focus-within/inline-edit:opacity-100 group-focus-within/inline-edit:duration-fast","hover:text-ink"),children:n("ui.projects.project_editors.add_a_title")}))]}),r&&t.jsx(Ie,{field:"key",value:e.name,display:t.jsx("span",{className:"font-mono text-mono-sm text-ink-muted",children:e.name}),commitFields:c=>({name:c.trim()}),validate:c=>Wt(c.trim()),labels:_e("key",n("ui.projects.project_editors.key")),commit:s,maxLength:Zs,placeholder:Wc,mono:!0})]})},Qc=({project:e,commit:s})=>{L();const[r,a]=d.useState(!1),o=Je(),i=he(o.data,"projects_force_done"),[l,c]=d.useState(null),[u,m]=d.useState(null),p=d.useRef(!1),f=d.useRef(!1),b=d.useRef(null),_=ht({value:e.status,commit:async g=>{const h=p.current;p.current=!1,c(null);try{const y=await s({status:g},h?{forceDone:!0}:void 0);h&&je(Vr(y,l?.count??0,se(g).label)),b.current?.resolve()}catch(y){throw c(on(y)),b.current?.reject(y),y}finally{b.current=null}},labels:_e("status",n("ui.projects.project_editors.status")),keyboardCommit:!1,errorCopy:et,onBegin:()=>a(!0)}),x=i&&_.phase==="error"&&l!==null&&l.coded;d.useEffect(()=>{if(!f.current||_.phase!=="idle"&&_.phase!=="saved")return;f.current=!1;const g=document.querySelector("[data-project-milestones]");g&&(g.scrollIntoView({block:"start"}),g.querySelector("[data-project-milestones-heading]")?.focus({preventScroll:!0}))},[_.phase]);const v=()=>new Promise((g,h)=>{if(_.phase!=="error"||_.conflict!==null){h(new Error(""));return}if(!_.dirty){g();return}p.current=!0,b.current={resolve:g,reject:h},_.accept(_.draft,!0)});return t.jsx(Ft,{field:"status",fieldRef:_.fieldRef,fieldProps:_.fieldProps,editing:_.editing,display:t.jsx(jn,{status:e.status}),slot:_,feedback:_,hug:!0,feedbackExtra:t.jsxs(t.Fragment,{children:[x&&t.jsx(z,{variant:"ghost",size:"sm","data-project-force-done-door":"",onClick:()=>m(l),children:n("ui.projects.project_editors.mark_done_anyway")}),t.jsx(fn,{open:u!==null,refusal:u,projectLabel:X(e),onClose:()=>m(null),onConfirm:v,secondaryLabel:n("ui.projects.project_editors.review_milestones"),onSecondary:()=>{m(null),f.current=!0,_.cancel()}})]}),editor:t.jsxs(He,{open:r,onOpenChange:a,value:_.draft,onValueChange:g=>{a(!1),_.accept(g)},children:[t.jsx(Ke,{ref:_.editorRef,..._.editorAria,"aria-label":n("ui.projects.project_editors.status"),"data-project-status":"",className:"h-7 w-fit min-w-36",children:t.jsx(We,{})}),t.jsx(Ve,{children:Ir.map(g=>t.jsx(Re,{value:g.value,"data-project-status-option":g.value,children:g.label},g.value))})]})})},Xc=({project:e,commit:s})=>{L();const[r,a]=d.useState(!1),o=d.useRef(null),i=d.useRef(null),l=ht({value:e.description,commit:async m=>{await s({description:m.trim()})},equals:(m,p)=>m.trim()===p.trim(),validate:m=>sn(m),multiline:!0,labels:_e("description",n("ui.projects.project_editors.description")),errorCopy:et,editorRef:o,onSettle:m=>{m==="cancelled"&&!e.description.trim()&&setTimeout(()=>i.current?.focus(),0)}});d.useEffect(()=>{if(r||!l.editing)return;const m=setTimeout(()=>o.current?.focus(),0);return()=>clearTimeout(m)},[r,l.editing]);const u=(l.editing?l.draft:l.displayValue).length>Qe;return t.jsx("div",{ref:l.fieldRef,...l.fieldProps,"data-project-field":"description",className:M(Cs,"min-w-0"),children:l.editing?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_editors.description_mode")}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(m=>t.jsx("button",{type:"button","data-project-description-mode":m,"aria-pressed":r===(m==="preview"),onClick:()=>a(m==="preview"),className:M("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink",r===(m==="preview")&&"bg-surface text-ink"),children:m==="write"?n("ui.projects.project_editors.write"):n("ui.projects.project_editors.preview")},m))})]}),t.jsx(cs,{api:{...l,acceptBlocked:u}})]}),r?t.jsx("div",{"data-project-description-preview":"",className:"h-40 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:l.draft.trim()?t.jsx(ut,{className:"text-body-sm",children:l.draft}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_editors.nothing_to_preview_yet")})}):t.jsx(Sr,{ref:o,...l.editorAria,"data-project-description":"",value:l.draft,readOnly:l.phase==="saving",rows:8,placeholder:n("ui.projects.project_editors.markdown_headings_lists_code"),"aria-label":l.labels.name,onChange:m=>l.setDraft(m.target.value),onPaste:m=>_n(m,o,p=>l.setDraft(p)),className:"h-40 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ls,{api:l}),t.jsxs("p",{className:M("shrink-0 text-meta tabular-nums",u?"text-danger":"text-ink-muted"),children:[l.draft.length,"/",Qe]})]})]}):t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[(e.description??"").trim()?t.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[t.jsx("div",{className:"min-w-0 flex-1 cursor-text",onDoubleClick:l.begin,children:t.jsx(ut,{className:"text-body",children:e.description??""})}),t.jsx(cs,{api:l})]}):t.jsx("button",{ref:i,type:"button","data-project-add-description":"",onClick:l.begin,className:"w-fit cursor-pointer text-body-sm text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.projects.project_editors.add_description")}),t.jsx("div",{className:"min-h-[1lh] text-meta",children:t.jsx(ls,{api:l})})]})})},Jc=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>(L(),t.jsx(Ie,{field:"owner",value:e.owner??"",label:n("ui.projects.project_editors.owner"),display:t.jsx("span",{className:"text-body-sm text-ink",children:e.owner}),commitFields:o=>({owner:o.trim()}),validate:o=>Ct(o,"owner"),labels:_e("owner",n("ui.projects.project_editors.owner")),commit:s,maxLength:St,placeholder:n("ui.projects.examples.owner"),autoBegin:r,onRetire:a})),Zc=({project:e,commit:s,label:r=null,autoBegin:a=!1,onRetire:o})=>(L(),t.jsx(Ie,{field:"team",value:e.team??"",label:n("ui.projects.project_editors.team"),display:t.jsx("span",{className:"text-body-sm text-ink",children:r??e.team}),commitFields:i=>({team:i.trim()}),validate:i=>Ct(i,"team"),labels:_e("team",n("ui.projects.project_editors.team")),commit:s,maxLength:St,placeholder:n("ui.projects.examples.team"),autoBegin:a,onRetire:o})),mr=({project:e,commit:s,which:r,nowMs:a,autoBegin:o=!1,onRetire:i})=>{const l=r==="start"?e.start_date??"":e.target_date??"",c=L(),u=De(l,c,new Date(a)),m=r==="start"?n("ui.projects.project_editors.start"):n("ui.projects.project_editors.target");return t.jsx(Ie,{field:r==="start"?"start-date":"target-date",value:l,label:m,display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),commitFields:p=>r==="start"?{start_date:p}:{target_date:p},validate:p=>{const f=ss(p);return f||(r==="start"?rs(p,e.target_date??""):rs(e.start_date??"",p))},labels:_e(n("ui.projects.project_editors.tolowercase_date",{toLowerCase:String(m.toLowerCase())}),m),commit:s,placeholder:"YYYY-MM-DD",autoBegin:o,onRetire:i})},el=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{L();const o={estimate:e.estimate,unit:e.estimate_unit==="days"?"days":"points"},[i,l]=d.useState(r);d.useEffect(()=>{i&&e.estimate!==null&&(l(!1),a?.("filled"))},[i,e.estimate,a]);const c=ht({value:{number:e.estimate===null?"":String(e.estimate),unit:o.unit},equals:Bi,commit:async m=>{const p=zi(o,m);p&&await s(p)},validate:m=>rn(m.number),labels:_e("estimate",n("ui.projects.project_editors.estimate")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:et,onSettle:m=>{m==="cancelled"&&(l(!1),a?.("cancelled"))}});if(!i&&e.estimate===null)return null;const u=qr(e.estimate,e.estimate_unit)||"—";return t.jsx(Ft,{field:"estimate",fieldRef:c.fieldRef,fieldProps:c.fieldProps,editing:c.editing,label:n("ui.projects.project_editors.estimate"),display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),slot:c,feedback:c,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oe,{ref:c.editorRef,...c.editorAria,"data-project-estimate":"",value:c.draft.number,readOnly:c.phase==="saving",placeholder:"13",inputMode:"decimal","aria-label":c.labels.name,onChange:m=>c.setDraft({...c.draft,number:m.target.value}),className:"h-8 max-w-24"}),t.jsxs(He,{value:c.draft.unit,onValueChange:m=>c.setDraft({...c.draft,unit:m}),children:[t.jsx(Ke,{"data-project-estimate-unit":"","aria-label":n("ui.projects.project_editors.estimate_unit"),"aria-invalid":c.editorAria["aria-invalid"],className:"h-8 w-fit min-w-28",children:t.jsx(We,{})}),t.jsxs(Ve,{children:[t.jsx(Re,{value:"points",children:n("ui.projects.project_editors.points")}),t.jsx(Re,{value:"days",children:n("ui.projects.project_editors.days")})]})]})]}),c.draft.number.trim()===""&&o.estimate!==null&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_editors.clearing_an_estimate_is_not_supported_yet_saving_keeps_its_curren")})]})})},tl=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{L();const[o,i]=d.useState(r);d.useEffect(()=>{o&&e.tags.length>0&&(i(!1),a?.("filled"))},[o,e.tags,a]);const l=ht({value:e.tags.join(", "),equals:(u,m)=>$i(lt(u),m),commit:async u=>{const{tags:m}=ns(u);await s({tags:m})},validate:u=>ns(u).error,labels:_e("tags",n("ui.projects.project_editors.tags")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:et,onSettle:u=>{u==="cancelled"&&(i(!1),a?.("cancelled"))}});if(!o&&e.tags.length===0)return null;const c=l.editing?lt(l.draft):e.tags;return t.jsx(Ft,{field:"tags",fieldRef:l.fieldRef,fieldProps:l.fieldProps,editing:l.editing,label:n("ui.projects.project_editors.tags"),display:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(u=>t.jsx(xe,{variant:"outline",children:u},u))}),slot:l,feedback:l,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(oe,{ref:l.editorRef,...l.editorAria,"data-project-tags":"",value:l.draft,readOnly:l.phase==="saving",placeholder:n("ui.projects.project_editors.q4_payments"),"aria-label":l.labels.name,onChange:u=>l.setDraft(u.target.value),className:"h-8 max-w-72"}),t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:c.map(u=>t.jsx(xe,{variant:"outline",children:u},u))})]})})},sl="project-quick-send:no-target",rl=[],nl=({links:e,target:s,onTargetChange:r,onSend:a,focusTick:o})=>{L();const i=d.useRef(null),l=Wn(),{frontend:c,refresh:u}=qa(),[m,p]=d.useState(!1),f=Je(),b=s??sl;d.useEffect(()=>{s&&u(s)},[s,u]),d.useEffect(()=>{o>0&&i.current?.focusInput()},[o]);const _=e.filter(g=>g.exists),v=(_.find(g=>g.session_id===s)??null)?.runtime?.busy===!0;return t.jsxs("div",{"data-tour-tag":"project-quick-send","data-glass-block":"",className:"flex flex-col gap-2 rounded-md bg-surface 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:n("ui.projects.project_quick_send.send_to")}),t.jsxs(He,{value:s??void 0,onValueChange:g=>r(g),children:[t.jsx(Ke,{"aria-label":n("ui.projects.project_quick_send.select_the_session_to_message"),className:"max-w-72",children:t.jsx(We,{placeholder:n("ui.projects.project_quick_send.no_session_selected")})}),t.jsx(Ve,{children:_.map(g=>t.jsx(Re,{value:g.session_id,children:Lt(g)},g.session_id))})]}),m?t.jsx("span",{role:"status",className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.sending")}):v?t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.the_session_is_working_this_message_steers_the_running_turn")}):null]}),t.jsx(Vn,{ref:i,conversationId:b,messages:rl,isLoading:!1,ownGutter:!0,transcriptless:!0,autoFocus:!1,placeholderOverride:n("ui.projects.project_quick_send.message_the_session_paste_an_image_to_attach_it"),cwd:c?.cwd,cwdReadOnlyReason:n("ui.projects.project_quick_send.quick_send_follows_the_conversation_s_directory"),sessionStatus:c&&s?{frontend:c,costChannels:he(f.data,"cost_channels")}:void 0,recordingProbe:l,hostNotice:s?void 0:{id:"project-quick-send-no-target",node:t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.choose_a_session_to_send_to")}),blocksInput:!0,get placeholder(){return n("ui.projects.project_quick_send.choose_a_session_to_send_to")}},onSendMessage:async(g,h)=>{if(!s)return!1;p(!0);try{return await a(s,g,v?"steer":"prompt",h)}finally{p(!1),i.current?.focusInput({preventScroll:!0})}}})]})},al=({links:e,busy:s,onUnlink:r,onLink:a,onQuickSend:o,onStartSession:i})=>{L();const l=At(),c=wt(h=>h.sessions),[u,m]=d.useState(!1),[p,f]=d.useState(null),[b,_]=d.useState(0),x=p&&e.some(h=>h.session_id===p&&h.exists)?p:Fo(e),v=d.useMemo(()=>{const h=new Set(e.map(y=>y.session_id));return c.filter(y=>!h.has(y.session_id)).map(y=>({id:y.session_id,name:y.title||y.session_id,description:y.cwd??void 0}))},[c,e]),g=h=>{wt.getState().openSession(h).then(y=>{y&&l(`/chat/${h}`)})};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:n("ui.projects.project_links.linked_sessions")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(z,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Aa,{}),n("ui.projects.project_links.new_session")]}),t.jsxs(z,{variant:"secondary",size:"sm",disabled:s,onClick:()=>m(!0),"data-tour-tag":"project-link-session",children:[t.jsx(Oa,{}),n("ui.projects.project_links.link_session")]})]})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_links.no_sessions_linked_yet_link_the_conversations_that_are_working_on")}):t.jsx("ul",{"data-glass-block":"",className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(h=>{const y=fo(h),T=jo(h.subagents),w=ho(h.todos),U=h.title||h.session_id,C=h.exists;return t.jsxs("li",{"data-glass-block-row":"",className:M("flex items-center gap-2 rounded-sm px-2 py-2",C&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!C,onClick:()=>{C&&g(h.session_id)},className:M("flex min-w-0 flex-1 items-center gap-2 text-left",C?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{"data-glass-block-row-label":"",className:M("min-w-0 truncate text-body-sm",h.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:U})}),h.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_links.busy")}),T&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:T}),w&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:w}),t.jsx(xe,{variant:y.variant,children:y.label}),C&&t.jsx(z,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.message_title",{title:String(U)}),title:n("ui.projects.project_links.message_title",{title:String(U)}),onClick:()=>{f(h.session_id),_(E=>E+1)},children:t.jsx(Pa,{})}),t.jsx(z,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.unlink_title",{title:String(U)}),onClick:()=>r(h.session_id),children:t.jsx(Xa,{})})]},h.session_id)})}),e.some(h=>h.exists)&&t.jsx(nl,{links:e,target:x,onTargetChange:f,onSend:o,focusTick:b}),t.jsx(dt,{open:u,onClose:()=>m(!1),title:n("ui.projects.project_links.link_a_session"),maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(Ye,{onClick:()=>m(!1),children:n("ui.projects.project_links.close")}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(ue,{children:n("ui.projects.project_links.session")}),t.jsx(Cr,{showLabel:!1,ariaLabel:n("ui.projects.project_links.search_sessions"),busyLabel:n("ui.projects.project_links.loading_sessions"),placeholder:n("ui.projects.project_links.search_conversations"),options:v,selected:null,onSelect:h=>{m(!1),a(h.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_links.conversations_already_linked_to_this_project_are_not_listed")})]})})]})},ol=({milestones:e,summary:s,busy:r,onToggle:a,onRemove:o,onAdd:i})=>{const[l,c]=d.useState(""),[u,m]=d.useState(""),p=L(),f=!Lr.test(u.trim()),b=l.trim().length>0&&!f&&!r,_=()=>{b&&(i(l.trim(),u.trim()),c(""),m(""))};return t.jsxs("section",{"data-project-milestones":"",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",tabIndex:-1,"data-project-milestones-heading":"",children:n("ui.projects.project_milestones.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:n("ui.projects.project_milestones.no_milestones_yet_add_one_below_to_mark_the_dates_this_project_is")}):t.jsx("ul",{"data-glass-block":"",className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(x=>{const v=io(x.status),g=x.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Er,{checked:g,disabled:r,onCheckedChange:h=>a(x.name,h===!0),"aria-label":g?n("ui.projects.project_milestones.mark_name_not_complete",{name:String(x.name)}):n("ui.projects.project_milestones.mark_name_complete",{name:String(x.name)})}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:x.name}),x.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:De(x.target_date,p)}),t.jsx(xe,{variant:v.variant,children:v.label}),t.jsx(z,{variant:"ghost",size:"icon-sm",disabled:r,"aria-label":n("ui.projects.project_milestones.remove_name",{name:String(x.name)}),onClick:()=>o(x.name),children:t.jsx(Pt,{})})]},x.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(ue,{htmlFor:"project-milestone-name",children:n("ui.projects.project_milestones.new_milestone")}),t.jsx(oe,{id:"project-milestone-name",value:l,onChange:x=>c(x.target.value),placeholder:n("ui.projects.project_milestones.beta_cut"),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),_())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:"project-milestone-date",children:n("ui.projects.project_milestones.target_date")}),t.jsx(oe,{id:"project-milestone-date",value:u,onChange:x=>m(x.target.value),placeholder:"YYYY-MM-DD","aria-invalid":f}),f&&t.jsx("p",{className:"text-meta text-danger",children:n("ui.projects.project_milestones.dates_are_yyyy_mm_dd_or_empty")})]}),t.jsxs(z,{variant:"secondary",disabled:!b,onClick:_,"data-tour-tag":"project-milestone-add",children:[t.jsx(it,{}),n("ui.projects.project_milestones.add")]})]})]})},il=[{field:"owner",get label(){return n("ui.projects.project_properties.owner")}},{field:"team",get label(){return n("ui.projects.project_properties.team")}},{field:"start",get label(){return n("ui.projects.project_properties.start_date")}},{field:"target",get label(){return n("ui.projects.project_properties.target_date")}},{field:"estimate",get label(){return n("ui.projects.project_properties.estimate")}},{field:"tags",get label(){return n("ui.projects.project_properties.tags")}}],_r=({label:e,children:s})=>t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:e}),t.jsx("dd",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s})]}),cl=({project:e,nowMs:s,commit:r,teamLabel:a=null})=>{const o=L(),i=new Date(s),[l,c]=d.useState(null),u=d.useRef(null),m=d.useRef(!1),p={owner:e.owner!==null,team:e.team!==null,start:e.start_date!==null,target:e.target_date!==null,estimate:e.estimate!==null,tags:e.tags.length>0},f=(E,P)=>{c(j=>j===E?null:j),P==="cancelled"&&!p[E]&&setTimeout(()=>u.current?.focus(),0)},b=il.filter(({field:E})=>!p[E]&&l!==E),_=De(e.completed_at,o,i),x=e.updated_at>0?_t(mt(e.updated_at,s)):"",v=e.updated_at>0?Qn(new Date(e.updated_at*1e3),{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},o):"",g=p.owner||l==="owner",h=p.team||l==="team",y=p.start||l==="start",T=p.target||l==="target",w=p.estimate||l==="estimate",U=p.tags||l==="tags",C=g||h||y||T||!!_||w||U||e.updated_at>0;return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:n("ui.projects.project_properties.properties")}),b.length>0&&t.jsxs(ps,{children:[t.jsx(ms,{asChild:!0,children:t.jsxs("button",{ref:u,type:"button","data-project-add-field":"",className:M("flex shrink-0 cursor-pointer items-center gap-1 rounded-xs text-meta text-ink-dim","transition-colors duration-fast ease-out-quart hover:text-ink"),children:[t.jsx(it,{className:"size-3","aria-hidden":"true"}),n("ui.projects.project_properties.add")]})}),t.jsx(_s,{align:"end",onCloseAutoFocus:E=>{m.current&&(m.current=!1,E.preventDefault())},children:b.map(({field:E,label:P})=>t.jsx(Ne,{"data-project-add-option":E,onSelect:()=>{m.current=!0,c(E)},children:P},E))})]})]}),C?t.jsxs("dl",{className:"flex flex-col gap-2",children:[g&&t.jsx(Jc,{project:e,commit:r,autoBegin:l==="owner",onRetire:E=>f("owner",E)}),h&&t.jsx(Zc,{project:e,commit:r,label:a,autoBegin:l==="team",onRetire:E=>f("team",E)}),y&&t.jsx(mr,{project:e,commit:r,which:"start",nowMs:s,autoBegin:l==="start",onRetire:E=>f("start",E)}),T&&t.jsx(mr,{project:e,commit:r,which:"target",nowMs:s,autoBegin:l==="target",onRetire:E=>f("target",E)}),_&&t.jsx(_r,{label:n("ui.projects.project_properties.completed"),children:_}),w&&t.jsx(el,{project:e,commit:r,autoBegin:l==="estimate",onRetire:E=>f("estimate",E)}),U&&t.jsx(tl,{project:e,commit:r,autoBegin:l==="tags",onRetire:E=>f("tags",E)}),e.updated_at>0&&t.jsx(_r,{label:n("ui.projects.project_properties.updated"),children:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:v,children:x})})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_properties.no_dates_estimate_tags_owner_or_team_yet")})]})},ll=({project:e})=>{L();const s=Je(),r=dn(),{sending:a,cooling:o,cooldownRemainingMs:i}=nc(e.id);if(!he(s.data,"projects_request_update"))return null;const l=X(e),c=Vi(e.id);return t.jsxs(t.Fragment,{children:[t.jsx(Ot,{content:o&&i!==null?Et(l,i):n("ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"),children:t.jsxs(z,{variant:"secondary",className:"min-w-37","data-tour-tag":"project-request-update","aria-busy":a?!0:void 0,"aria-disabled":o?!0:void 0,"aria-describedby":o?c:void 0,onClick:()=>r(e),children:[a?t.jsx(Se,{size:"sm"}):o?t.jsx(gs,{}):t.jsx(Va,{}),a?n("ui.projects.project_request_update_button.requesting"):o?n("ui.projects.project_request_update_button.requested"):n("ui.projects.project_request_update_button.request_update")]})}),o&&i!==null&&t.jsx("span",{id:c,className:"sr-only",children:Et(l,i)})]})},hn="plain",gn=e=>`team:${e}`,xn=e=>`agent:${e}`;function ul(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function dl(e){return e.kind==="team"?gn(e.name):e.kind==="agent"?xn(e.name):hn}const fr={kind:"plain"},pl=({open:e,onClose:s,onStart:r,teamsEnabled:a,profilesEnabled:o})=>{L();const[i,l]=d.useState(fr),[c,u]=d.useState(null),[m,p]=d.useState(!1),f=Xn(e&&a),b=Jn(e&&o);d.useEffect(()=>{e&&(l(fr),u(null),p(!1))},[e]);const _=d.useMemo(()=>{const y=[{id:hn,get name(){return n("ui.projects.project_start_session.nothing_in_particular")},get description(){return n("ui.projects.project_start_session.a_plain_session_assign_a_team_or_agent_later")},get group(){return n("ui.projects.project_start_session.plain")}}];for(const T of f.data??[])y.push({id:gn(T.name),name:Ls(T),keywords:T.name===Ls(T)?void 0:[T.name],description:n("ui.projects.project_start_session.team_manager_manager",{manager:String(T.manager)}),get group(){return n("ui.projects.project_start_session.teams")}});for(const T of(b.data??[]).filter(w=>w.source!=="builtin"))y.push({id:xn(T.name),name:T.name,description:T.description||T.kind,get group(){return n("ui.projects.project_start_session.agents")}});return y},[f.data,b.data]),x=_.find(y=>y.id===dl(i))??_[0],v=!a||!o,g=f.isLoading||b.isLoading,h=async()=>{p(!0),u(null);try{await r(i),s()}catch(y){u(y instanceof Error&&y.message?y.message:n("ui.projects.project_start_session.the_session_could_not_be_started"))}finally{p(!1)}};return t.jsx(dt,{open:e,onClose:s,title:n("ui.projects.project_start_session.start_a_session"),maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ye,{onClick:s,disabled:m,children:n("ui.projects.project_start_session.cancel")}),t.jsxs(kt,{onClick:()=>void h(),disabled:m,children:[m&&t.jsx(Se,{size:"xs"}),n("ui.projects.project_start_session.start_session")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Cr,{label:n("ui.projects.project_start_session.work_with"),placeholder:n("ui.projects.project_start_session.search_teams_and_agents"),options:_,selected:x,onSelect:y=>l(ul(y.id)),busy:g,busyLabel:n("ui.projects.project_start_session.loading_teams_and_agents")}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_start_session.the_session_starts_now_links_itself_to_this_project_and_opens_wit")}),v&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_start_session.this_server_does_not_offer_the_team_or_agent_catalogues_yet_so_on")}),c&&t.jsx("p",{className:"text-body-sm text-danger",children:c})]})})},ml=({links:e})=>{L();const s=Lo(e),r=e.filter(a=>a.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:n("ui.projects.project_todos.to_dos")}),s&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:Ys(s)})]}),r.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_todos.no_to_do_snapshots_from_the_linked_sessions_yet_a_session_publish")}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:r.map(a=>t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx("span",{className:a.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:Lt(a)}),a.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:Ys(a.todos)})]},a.session_id))})]})},_l=({filePath:e,tooltip:s="File actions",icon:r,"aria-label":a="File actions",onShowInCanvas:o})=>{const i=async()=>{if(e)try{await navigator.clipboard.writeText(e),je("File path copied to clipboard")}catch(c){console.error("Failed to copy file path: ",c),le("Failed to copy file path")}},l=()=>{e&&window.api.openFile(e)};return t.jsxs(ps,{children:[t.jsx(Ot,{content:s,children:t.jsx(ms,{asChild:!0,children:t.jsx(z,{variant:"ghost",size:"icon-sm","aria-label":a,onClick:c=>c.stopPropagation(),children:r??t.jsx(yr,{"aria-hidden":"true"})})})}),t.jsxs(_s,{align:"end",className:"min-w-45",onClick:c=>c.stopPropagation(),children:[o&&t.jsxs(Ne,{onSelect:o,children:[t.jsx(Zn,{"aria-hidden":"true"}),t.jsx("span",{children:"Show in canvas"})]}),t.jsxs(Ne,{onSelect:l,children:[t.jsx(kr,{"aria-hidden":"true"}),t.jsx("span",{children:"Open file"})]}),t.jsxs(Ne,{onSelect:()=>window.api.showItemInFolder(e),children:[t.jsx(ea,{"aria-hidden":"true"}),t.jsx("span",{children:"Open folder"})]}),t.jsxs(Ne,{onSelect:i,children:[t.jsx(ta,{"aria-hidden":"true"}),t.jsx("span",{children:"Copy file path"})]})]})]})},fl=/[/\\]/;function bn(e){if(e.name)return e.name;const s=e.path.split(fl);return s[s.length-1]||n("ui.projects.project_updates.attachment")}const jl=({attachment:e})=>{L();const s=bn(e),r=Mo(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:n("ui.projects.project_updates.open_name",{name:String(s)}),children:[t.jsx(kr,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),r&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:r}),t.jsx(_l,{filePath:e.path,"aria-label":n("ui.projects.project_updates.file_actions_for_name",{name:String(s)})})]})},hl=({attachment:e})=>{L();const s=bn(e),r=sa(e.path,{mimeType:ra(e.name||e.path),sizeBytes:e.bytes});return r.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(na,{file:e.path,src:r.url,label:s,conversationId:""})}):r.status==="loading"?t.jsx(aa,{children:t.jsxs("span",{className:"sr-only",children:[n("ui.projects.project_updates.loading"),s]})}):t.jsx(oa,{name:s})},gl=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(hl,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(jl,{attachment:s},`${s.path}:${s.added_at}`))}),xl=({update:e,nowMs:s})=>{const r=L(),a=Oo(e,r,s);return t.jsxs("article",{className:"flex flex-col gap-2 rounded-sm px-2 py-3",children:[a.length>0&&t.jsx("p",{className:"flex flex-wrap items-baseline gap-x-2 text-meta text-ink-muted",children:a.map((o,i)=>t.jsxs(d.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:o.text})]},o.key))}),e.text&&t.jsx(ut,{children:e.text}),e.attachments.length>0&&t.jsx(gl,{attachments:e.attachments})]})},bl=({updates:e,nowMs:s})=>{const r=L(),a=Eo(e.length),o=Po(e,r,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:n("ui.projects.project_updates.updates")}),a&&t.jsx("span",{className:"text-meta text-ink-muted",children:a})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_updates.no_updates_yet_progress_reported_by_you_or_by_the_sessions_workin")}):t.jsx("div",{className:"flex flex-col gap-4",children:o.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,c)=>t.jsx(xl,{update:l,nowMs:s},`${l.at}:${l.by}:${c}`))})]},i.key||"ungrouped"))})]})},yl="project_not_found",vl=({projectKey:e,nowMs:s})=>{L();const r=At(),a=Je(),o=wr(he(a.data,"team_catalogue")),i=Ar(e,!0),l=Or(),c=Pr(),u=ro(),m=no(),p=to(),f=so(),[b,_]=d.useState(!1),[x,v]=d.useState(!1),g=l.isPending||c.isPending||u.isPending||m.isPending||p.isPending||f.isPending;if(i.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Se,{label:n("ui.projects.project_detail.loading_project")})});if(i.isError||!i.data){const j=i.error instanceof Dt&&(i.error.code===yl||i.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(Kt,{variant:"danger",className:"w-full",children:j?n("ui.projects.project_detail.this_project_could_not_be_found_it_may_have_been_deleted"):i.error instanceof Error&&i.error.message?i.error.message:n("ui.projects.project_detail.the_project_could_not_be_read")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{variant:"secondary",onClick:()=>void i.refetch(),children:n("ui.projects.project_detail.try_again")}),t.jsxs(z,{variant:"secondary",onClick:()=>void r("/projects"),children:[t.jsx(qs,{}),n("ui.projects.project_detail.all_projects")]})]})]})}const{project:h,links:y}=i.data,T=X(h),w=(j,O)=>l.mutateAsync({key:h.id,fields:j,...O?.forceDone===!0?{forceDone:!0}:{}}),U=h.team?o(h.team):null,C=Io(h.milestones.filter(j=>j.completed_at!==null).length,h.milestones.length),E=async(j,O,R,I)=>{const Y=wt.getState(),q=ca(null,j,Y.drafts);if(!q)return!1;try{const{images:G,unreadable:W,overflow:J}=await la(I,O),de=ua(W);if(de)return le(de),!1;const Z=da(J);if(Z)return le(Z),!1;const ee=pa(O,G);if(ee)return le(ee),!1;if(await ma(q,{text:O,attachments:I,images:G,mode:R,cwd:Y.cwd},j)===null)return le(n("ui.projects.project_detail.that_session_already_has_a_message_going_out_try_again_in_a_momen")),!1;const N=y.find(D=>D.session_id===j);return je(n("ui.projects.project_detail.sent_to_value1",{value1:String(N?Lt(N):j)})),!0}catch(G){return le(G instanceof Error&&G.message?G.message:n("ui.projects.project_detail.the_message_was_not_sent")),!1}},P=async j=>{const O=wt.getState(),R=j.kind==="plain"?void 0:{kind:j.kind,name:j.name},I=await O.createSession(O.cwd||"~",R);if(!I)throw new Error(O.error??n("ui.projects.project_detail.the_session_could_not_be_started"));_a.getState().setCurrentInput(I,qo(h));let Y=null;try{await p.mutateAsync({key:h.id,sessionId:I})}catch(q){Y=q instanceof Error&&q.message?q.message:n("ui.projects.project_detail.the_link_was_refused")}if(Y)le(n("ui.projects.project_detail.session_started_but_linking_it_failed_linkfailure",{linkFailure:String(Y)}));else{const q=R?n("ui.projects.project_detail.with_value1",{value1:String(Uo(R))}):"";je(n("ui.projects.project_detail.session_started_withtarget_and_linked_to_displayname",{withTarget:String(q),displayName:String(T)}))}await Rr(r,I)};return t.jsx(xc,{children: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 r("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx(qs,{className:"size-4"}),n("ui.projects.project_detail.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-1 flex-wrap items-start gap-x-3 gap-y-2",children:[t.jsx(Vc,{project:h,commit:w}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[t.jsx(Qc,{project:h,commit:w}),h.progress_stale&&t.jsx(xe,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ll,{project:h}),t.jsxs(z,{variant:"secondary",onClick:()=>_(!0),"data-tour-tag":"project-delete",children:[t.jsx(ia,{}),n("ui.projects.project_detail.delete")]})]})]})]}),t.jsx(Xc,{project:h,commit:w}),t.jsx(cl,{project:h,nowMs:s,commit:w,teamLabel:U}),h.updates.length===0&&h.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:n("ui.projects.project_detail.progress")}),t.jsx(ut,{className:"text-body",children:h.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:uo(h,s)})]}),t.jsx(ol,{milestones:h.milestones,summary:C,busy:g,onToggle:(j,O)=>{u.mutateAsync({key:h.id,name:j,completed:O}).catch(R=>{le(R instanceof Error&&R.message?R.message:n("ui.projects.project_detail.the_milestone_was_not_updated"))})},onRemove:j=>{m.mutateAsync({key:h.id,name:j}).catch(O=>{le(O instanceof Error&&O.message?O.message:n("ui.projects.project_detail.the_milestone_was_not_removed"))})},onAdd:(j,O)=>{u.mutateAsync({key:h.id,name:j,targetDate:O}).catch(R=>{le(R instanceof Error&&R.message?R.message:n("ui.projects.project_detail.the_milestone_was_not_added"))})}}),t.jsx(al,{projectKey:h.id,links:y,busy:g,onStartSession:()=>v(!0),onQuickSend:E,onLink:j=>{p.mutateAsync({key:h.id,sessionId:j}).catch(O=>{le(O instanceof Error&&O.message?O.message:n("ui.projects.project_detail.the_session_was_not_linked"))})},onUnlink:j=>{f.mutateAsync({key:h.id,sessionId:j}).catch(O=>{le(O instanceof Error&&O.message?O.message:n("ui.projects.project_detail.the_session_was_not_unlinked"))})}}),t.jsx(ml,{links:y}),t.jsx(bl,{updates:h.updates,nowMs:s}),t.jsx(pn,{open:b,projectName:h.name,onClose:()=>_(!1),onConfirm:async j=>{await c.mutateAsync({key:h.id,confirmedName:j}),je(n("ui.projects.project_detail.project_deleted")),r("/projects")}}),t.jsx(pl,{open:x,onClose:()=>v(!1),onStart:P,teamsEnabled:he(a.data,"team_catalogue"),profilesEnabled:he(a.data,"profile_catalogue")})]})})},kl="payments-migration",jr={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},wl=({open:e,onClose:s,onSubmit:r})=>{L();const[a,o]=d.useState(jr),[i,l]=d.useState({}),[c,u]=d.useState(null),m=d.useRef(null),[p,f]=d.useState(!1),[b,_]=d.useState(!1),[x,v]=d.useState(!1),g=d.useId(),h=d.useRef(null);d.useEffect(()=>{e&&(o({...jr,description:lr}),l({}),u(null),f(!1),_(!1),v(!1))},[e]),d.useEffect(()=>{c&&m.current?.scrollIntoView({block:"nearest"})},[c]);const y=(j,O)=>{o(R=>({...R,[j]:O}))},T=b?a.name:Ec(a.title),w=j=>_n(j,h,O=>y("description",O)),U=(j,O)=>{const R={},I=Wt(O);I&&(R.name=I);const Y=sn(j.description);Y&&(R.description=Y);const q=ns(j.tags).error;q&&(R.tags=q);const G=ss(j.startDate);G&&(R.startDate=G);const W=ss(j.targetDate);if(W)R.targetDate=W;else if(!G){const ee=rs(j.startDate,j.targetDate);ee&&(R.targetDate=ee)}if(j.estimate.trim()){const ee=rn(j.estimate);ee&&(R.estimate=ee)}const J=ts(j.title);J&&(R.title=J);const de=Ct(j.owner,"owner");de&&(R.owner=de);const Z=Ct(j.team,"team");return Z&&(R.team=Z),R},C=async()=>{const j=T.trim(),O=U(a,j);if(l(O),Object.keys(O).length>0)return;f(!0),u(null);const R=lt(a.tags);try{const I={};a.title.trim()&&(I.title=a.title.trim()),a.owner.trim()&&(I.owner=a.owner.trim()),a.team.trim()&&(I.team=a.team.trim()),a.startDate&&(I.start_date=a.startDate),a.targetDate&&(I.target_date=a.targetDate),a.estimate&&(I.estimate=Number(a.estimate),I.estimate_unit=a.estimateUnit),await r({fields:{name:j,...a.description.trim()&&a.description.trim()!==lr?{description:a.description.trim()}:{},status:a.status,...R.length>0?{tags:R}:{}},...Object.keys(I).length>0?{followUp:I}:{}}),s()}catch(I){const Y=I instanceof Error&&I.message?I.message:"";u(jt(Y)||n("ui.projects.project_form_dialog.the_project_was_not_saved"))}finally{f(!1)}},E=n("ui.projects.project_form_dialog.new_project"),P=a.description.length>Qe;return t.jsx(dt,{open:e,onClose:s,title:E,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:p,onEscapeKeyDown:j=>{p&&j.preventDefault()},onInteractOutside:j=>{p&&j.preventDefault()}},dataTourTag:"project-create-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ye,{onClick:s,disabled:p,children:n("ui.projects.project_form_dialog.cancel")}),t.jsxs(kt,{"data-project-submit":"",onClick:()=>void C(),disabled:p,children:[p&&t.jsx(Se,{size:"xs"}),n("ui.projects.project_form_dialog.create_project")]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:j=>{j.preventDefault(),C()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-title`,children:n("ui.projects.project_form_dialog.title")}),t.jsx(oe,{id:`${g}-title`,"data-project-title":"",value:a.title,onChange:j=>y("title",j.target.value),placeholder:n("ui.projects.project_form_dialog.payments_migration"),autoFocus:!0,className:"h-10 text-heading","aria-invalid":!!i.title}),i.title&&t.jsx("p",{className:"text-meta text-danger",children:i.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ue,{htmlFor:`${g}-key`,className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.key")}),t.jsx(oe,{id:`${g}-key`,"data-project-key":"",value:T,onChange:j=>{_(!0),y("name",j.target.value)},placeholder:kl,"aria-invalid":!!i.name,className:"h-7 max-w-56 font-mono text-mono-sm"}),t.jsx("span",{className:"text-meta text-ink-muted",children:b?n("ui.projects.project_form_dialog.letters_digits_dot_underscore_or_dash_no_spaces"):n("ui.projects.project_form_dialog.derived_from_the_title_until_you_edit_it")})]}),i.name&&t.jsx("p",{className:"text-meta text-danger",children:i.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(ue,{htmlFor:`${g}-description`,children:n("ui.projects.project_form_dialog.description")}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_form_dialog.description_mode")}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(j=>t.jsx("button",{type:"button","data-project-description-mode":j,"aria-pressed":x===(j==="preview"),onClick:()=>v(j==="preview"),className:M("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",x===(j==="preview")&&"bg-surface text-ink"),children:j==="write"?n("ui.projects.project_form_dialog.write"):n("ui.projects.project_form_dialog.preview")},j))})]})]}),x?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:a.description.trim()?t.jsx(ut,{className:"text-body-sm",children:a.description}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_form_dialog.nothing_to_preview_yet")})}):t.jsx(Sr,{ref:h,id:`${g}-description`,"data-project-description":"",value:a.description,onChange:j=>y("description",j.target.value),onPaste:w,rows:8,placeholder:n("ui.projects.project_form_dialog.markdown_headings_lists_code"),"aria-invalid":P||!!i.description,className:"h-44 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.description?t.jsx("p",{className:"text-meta text-danger",children:i.description}):t.jsx("span",{}),t.jsxs("p",{className:M("text-meta tabular-nums",P?"text-danger":"text-ink-muted"),children:[a.description.length,"/",Qe]})]})]}),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(ue,{children:n("ui.projects.project_form_dialog.status")}),t.jsxs(He,{value:a.status,onValueChange:j=>y("status",j),children:[t.jsx(Ke,{"aria-label":n("ui.projects.project_form_dialog.status"),children:t.jsx(We,{})}),t.jsx(Ve,{children:Ir.map(j=>t.jsx(Re,{value:j.value,children:j.label},j.value))})]}),a.status==="done"&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.moving_a_project_to_done_stamps_today_as_its_completion_date")})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-owner`,children:n("ui.projects.project_form_dialog.owner")}),t.jsx(oe,{id:`${g}-owner`,"data-project-owner":"",value:a.owner,onChange:j=>y("owner",j.target.value),placeholder:n("ui.projects.examples.owner"),"aria-invalid":!!i.owner}),i.owner&&t.jsx("p",{className:"text-meta text-danger",children:i.owner})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-team`,children:n("ui.projects.project_form_dialog.team")}),t.jsx(oe,{id:`${g}-team`,value:a.team,onChange:j=>y("team",j.target.value),placeholder:n("ui.projects.examples.team"),"aria-invalid":!!i.team}),i.team&&t.jsx("p",{className:"text-meta text-danger",children:i.team})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-target`,children:n("ui.projects.project_form_dialog.target_date")}),t.jsx(oe,{id:`${g}-target`,"data-project-target":"",value:a.targetDate,onChange:j=>y("targetDate",j.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!i.targetDate}),i.targetDate&&t.jsx("p",{className:"text-meta text-danger",children:i.targetDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-start`,children:n("ui.projects.project_form_dialog.start_date")}),t.jsx(oe,{id:`${g}-start`,value:a.startDate,onChange:j=>y("startDate",j.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!i.startDate}),i.startDate&&t.jsx("p",{className:"text-meta text-danger",children:i.startDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-estimate`,children:n("ui.projects.project_form_dialog.estimate")}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(oe,{id:`${g}-estimate`,value:a.estimate,onChange:j=>y("estimate",j.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!i.estimate,className:"max-w-28"}),t.jsxs(He,{value:a.estimateUnit,onValueChange:j=>y("estimateUnit",j),children:[t.jsx(Ke,{"aria-label":n("ui.projects.project_form_dialog.estimate_unit"),className:"max-w-32",children:t.jsx(We,{})}),t.jsxs(Ve,{children:[t.jsx(Re,{value:"points",children:n("ui.projects.project_form_dialog.points")}),t.jsx(Re,{value:"days",children:n("ui.projects.project_form_dialog.days")})]})]})]}),i.estimate&&t.jsx("p",{className:"text-meta text-danger",children:i.estimate})]}),t.jsxs("div",{className:"col-span-2 flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-tags`,children:n("ui.projects.project_form_dialog.tags")}),t.jsx(oe,{id:`${g}-tags`,value:a.tags,onChange:j=>y("tags",j.target.value),placeholder:n("ui.projects.project_form_dialog.q4_payments"),"aria-invalid":!!i.tags}),i.tags?t.jsx("p",{className:"text-meta text-danger",children:i.tags}):t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.comma_separated_up_to_8_lowercase_letters_digits_underscore_or_da")})]})]}),c&&t.jsx("p",{ref:m,className:"text-body-sm text-danger",children:c})]})})},yn=({children:e})=>{const s=d.useRef(null),[r,a]=d.useState(!1),o=()=>{const i=s.current;i&&a(i.scrollTop+i.clientHeight<i.scrollHeight-1)};return d.useEffect(o),t.jsx("div",{ref:s,onScroll:o,className:M("max-h-[min(70vh,32rem)] overflow-y-auto overscroll-contain",r&&"[mask-image:linear-gradient(to_bottom,black_calc(100%-12px),transparent)]"),children:e})},Nl=({label:e,count:s,selected:r,onToggle:a})=>{const o=d.useId();return t.jsxs("div",{className:"flex items-center gap-2 rounded-sm px-1 py-1 hover:bg-sunken",children:[t.jsx(Er,{id:o,checked:r,onCheckedChange:()=>a()}),t.jsx(ue,{htmlFor:o,className:"min-w-0 flex-1 cursor-pointer truncate font-normal text-body-sm text-ink",children:e}),t.jsx("span",{className:"text-meta text-ink-dim tabular-nums",children:s})]})},Sl=({column:e,spec:s,onChange:r})=>{L();const a=d.useId(),o=s!==null&&s.key===e,i=o?s.direction:Bt(e),l=i==="asc"?"desc":"asc",c=()=>r({key:e,direction:o?l:Bt(e)}),u=s===null?"default":o?"sorted":"other";return t.jsxs("fieldset",{className:"m-0 flex flex-col gap-0.5 border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_filters_panel.sort_by_sortcolumnlabel_column",{sortColumnLabel_column:String(Xe(e))})}),t.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-body-sm hover:bg-sunken",children:[t.jsx("input",{type:"radio",name:a,checked:u==="default",onChange:()=>r(null),className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:M("min-w-0 flex-1 truncate",u==="default"?"text-ink":"text-ink-muted"),children:n("ui.projects.project_sort.default_as_listed")})]}),t.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-body-sm hover:bg-sunken",children:[t.jsx("input",{type:"radio",name:a,checked:u==="sorted",onChange:c,onClick:()=>{u==="sorted"&&c()},onKeyDown:m=>{u==="sorted"&&(m.key!==" "&&m.key!=="Enter"||(m.preventDefault(),c()))},className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:M("min-w-0 flex-1 truncate",u==="sorted"?"text-ink":"text-ink-muted"),children:n("ui.projects.project_filters_panel.sort_by_sortcolumnlabel_column_value2",{sortColumnLabel_column:String(Xe(e)),value2:String(ks(e,o?i:Bt(e)))})})]})]})},Cl=({facet:e,options:s,onToggle:r})=>(L(),t.jsxs("div",{className:"flex flex-col gap-0.5 border-b border-hairline px-3 py-2 last:border-b-0",children:[t.jsx("span",{className:"px-1 text-meta text-ink-muted",children:ot[e]}),s.map(a=>t.jsx(Nl,{label:a.label,count:a.count,selected:a.selected,onToggle:()=>r(e,a.value)},`${e}:${a.value??"none"}`))]})),vn=({projects:e,state:s,query:r,todayMs:a,onToggle:o,onClearAll:i,scope:l,sort:c})=>{L();const u=l===void 0?ji(e,s,a):l===null?[]:[tn(l,e,s,a)],m=!ct(s)||r.trim()!=="";return t.jsxs("div",{className:"flex flex-col",children:[l===void 0&&t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-hairline px-3 py-2",children:[t.jsx("span",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_filters_panel.filters")}),m&&t.jsx(z,{variant:"link",size:"sm",onClick:i,children:n("ui.projects.project_filters_panel.clear_all")})]}),c&&t.jsxs("div",{className:"flex flex-col gap-0.5 border-b border-hairline px-3 py-2",children:[t.jsx("span",{className:"px-1 text-meta text-ink-muted",children:n("ui.projects.project_filters_panel.sort_by_key",{key:String(Xe(c.key))})}),t.jsx(Sl,{column:c.key,spec:c.spec,onChange:c.onChange})]}),u.map(p=>t.jsx(Cl,{facet:p.facet,options:p.options,onToggle:o},p.facet))]})},El=({team:e,count:s,headingId:r,className:a,...o})=>(L(),t.jsxs("div",{...o,"data-glass-well":"",className:M("flex h-8 cursor-default items-center gap-2 bg-surface px-3 text-meta",a),children:[t.jsx("h3",{id:r,className:"truncate text-ink",children:e??n("ui.projects.project_model.no_team")}),t.jsx("span",{className:"shrink-0 text-ink-muted","aria-label":mo(s),children:s})]})),we=[{key:"name",get label(){return n("ui.projects.project_list.project")},className:"min-w-0 flex-1",sort:"name",facet:null},{key:"status",get label(){return n("ui.projects.project_list.status")},className:"w-20 shrink-0",sort:"status",facet:"status"},{key:"target",get label(){return n("ui.projects.project_list.target")},className:"hidden w-32 shrink-0 @[40rem]:block",sort:"target",facet:"target"},{key:"estimate",get label(){return n("ui.projects.project_list.estimate")},className:"hidden w-16 shrink-0 @[40rem]:block",sort:"estimate",facet:"estimate"},{key:"milestones",get label(){return n("ui.projects.project_list.milestones")},className:"hidden w-20 shrink-0 @[34rem]:block",sort:"milestones",facet:"milestones"},{key:"live",get label(){return n("ui.projects.project_list.live")},className:"hidden w-14 shrink-0 @[34rem]:block",sort:"live",facet:"live"},{key:"progress",get label(){return n("ui.projects.project_list.progress")},className:"w-40 shrink-0",sort:"progress",facet:"progress"}];function Tl(e,s){const r=mt(e.progress_updated_at,s);return r?_t(r):n("ui.projects.project_list.not_reported")}const Rl=({direction:e})=>e==="asc"?t.jsx(Dr,{size:10,className:"shrink-0","aria-hidden":"true"}):t.jsx(Nr,{size:10,className:"shrink-0","aria-hidden":"true"}),Dl=({projects:e,nowMs:s,onOpen:r,sort:a,onSortChange:o,searchPopulation:i,filters:l,query:c,todayMs:u,onToggleFilter:m,onClearFilters:p,teamLabelFor:f=b=>b})=>{const b=L(),_=a?Ni(e,a):e,x=bs(_,ft),v=d.useId(),g=C=>`${v}-team-${C}`,[h,y]=d.useState(0),T=d.useRef([]),w=(C,E)=>{const P=we.length;for(let j=1;j<=P;j+=1){const O=(C+E*j+P*P)%P,R=T.current[O];if(R&&R.offsetParent!==null){y(O),R.focus();return}}},U=C=>E=>{E.key!=="ArrowLeft"&&E.key!=="ArrowRight"||(E.preventDefault(),w(C,E.key==="ArrowRight"?1:-1))};return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-list",children:[t.jsx("table",{className:"block shrink-0","aria-label":n("ui.projects.project_list.project_columns"),children:t.jsx("thead",{className:"block",children:t.jsx("tr",{className:"flex items-center gap-3 px-9 py-2 text-meta text-ink-muted",children:we.map((C,E)=>{const P=a!==null&&a.key===C.sort;return t.jsx("th",{scope:"col","aria-sort":P?a.direction==="desc"?"descending":"ascending":"none",className:M(C.className,"p-0 text-left font-normal"),children:t.jsxs(fs,{children:[t.jsx(js,{asChild:!0,children:t.jsxs("button",{type:"button",ref:j=>{T.current[E]=j},tabIndex:E===h?0:-1,"data-project-column":C.key,onFocus:()=>y(E),onKeyDown:U(E),className:M("group flex w-full min-w-0 items-center gap-1 rounded-xs text-left","transition-colors duration-fast ease-out-quart",P?"text-ink":"hover:text-ink"),children:[t.jsx("span",{className:"truncate",children:C.label}),P?t.jsx(Rl,{direction:a.direction}):t.jsx(fa,{size:10,className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink","aria-hidden":"true"})]})}),t.jsx(hs,{align:"start","aria-label":n("ui.projects.project_list.label_column",{label:String(C.label)}),className:"w-72 p-0",children:t.jsx(yn,{children:t.jsx(vn,{projects:i,state:l,query:c,todayMs:u,onToggle:m,onClearAll:p,scope:C.facet,sort:{key:C.sort,spec:a,onChange:o}})})})]})},C.key)})})})}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:x.map((C,E)=>t.jsxs("li",{children:[t.jsx(El,{team:C.team==null?null:f(C.team),count:C.items.length,headingId:g(E),className:"sticky top-0 z-10","data-project-team":C.team??""}),t.jsx("ul",{"aria-labelledby":g(E),className:"divide-y divide-hairline",children:C.items.map(P=>{const j=new Map(Br(P,b).map(I=>[I.key,I.text])),O=Ur(P.milestones_completed,P.milestones_total),R=xs(P.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>r(P),"data-project-name":P.name,className:M("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-row-hover"),children:[t.jsx("span",{className:M(we[0].className,"truncate text-body-sm text-ink"),children:X(P)}),t.jsx("span",{className:we[1].className,children:t.jsx(jn,{status:P.status})}),t.jsx("span",{className:M(we[2].className,"truncate text-meta text-ink-muted"),children:j.get("target")??j.get("completed")??""}),t.jsx("span",{className:M(we[3].className,"truncate text-meta text-ink-muted"),children:j.get("estimate")??""}),t.jsx("span",{className:M(we[4].className,"truncate text-meta text-ink-muted"),children:O}),t.jsx("span",{className:M(we[5].className,"truncate text-meta text-ink-muted"),children:R}),t.jsxs("span",{className:M(we[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:Tl(P,s)}),P.progress_stale&&t.jsx(xe,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]})},P.id)})})]},C.team??""))})]})},Rt=224,hr=36,Al={get day(){return n("ui.projects.project_timeline.days")},get week(){return n("ui.projects.project_timeline.weeks")},get month(){return n("ui.projects.project_timeline.months")},get quarter(){return n("ui.projects.project_timeline.quarters")}},Ol=({items:e,nowMs:s,onOpen:r,pendingDetails:a,failedDetails:o,onRetryDetails:i,teamLabelFor:l=c=>c})=>{L();const[c,u]=d.useState(null),[m,p]=d.useState(0),f=d.useRef(null),b=Ns(s),_=d.useMemo(()=>Ei(e,b),[e,b]),x=d.useMemo(()=>Ti(e),[e]),v=d.useMemo(()=>bs(x.dated,C=>ft(C.project)),[x]);d.useLayoutEffect(()=>{const C=f.current;if(!C)return;const E=()=>p(C.clientWidth);if(E(),typeof ResizeObserver>"u")return;const P=new ResizeObserver(E);return P.observe(C),()=>P.disconnect()},[]);const g=Math.max(m-Rt-24,160),h=_?Si(Js(_.startMs,_.endMs),g):"month",y=c??h,T=C=>{const E=Te.indexOf(y),P=Te[E-C];P&&u(P)},w=ws[y],U=_?Js(_.startMs,_.endMs)*w:0;return t.jsxs("div",{ref:f,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:o>0?n("ui.projects.timeline.read_failed",{count:o}):n("ui.projects.project_timeline.length_dated_length_2_without_dates_value3",{length:V(x.dated.length,{useGrouping:!1}),length_2:V(x.undated.length,{useGrouping:!1}),value3:String(a>0?n("ui.projects.project_timeline.loading_milestones_for_pendingdetails",{pendingDetails:V(a,{useGrouping:!1})}):"")})}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[o>0&&t.jsx(z,{variant:"secondary",size:"sm",onClick:i,children:n("ui.projects.project_timeline.try_again")}),t.jsx(z,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_in"),title:n("ui.projects.project_timeline.zoom_in_finer"),disabled:!_||y===Te[0],onClick:()=>T(1),children:t.jsx(it,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Al[y]}),t.jsx(z,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_out"),title:n("ui.projects.project_timeline.zoom_out_coarser"),disabled:!_||y===Te[Te.length-1],onClick:()=>T(-1),children:t.jsx(Ca,{})})]})]}),_&&x.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(Pl,{startMs:_.startMs,endMs:_.endMs,tier:y,pxPerDay:w,trackPx:U}),v.map(C=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":C.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:Rt},children:[t.jsx("span",{className:"truncate text-ink",children:C.team==null?n("ui.projects.project_model.no_team"):l(C.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:C.items.length})]})}),C.items.map(E=>t.jsx(Ml,{item:E,spanStart:_.startMs,pxPerDay:w,trackPx:U,today:b,onOpen:()=>r(E)},E.project.id))]},C.team??""))]})}):null,x.undated.length>0&&t.jsx("div",{className:"shrink-0 px-9 py-2","data-project-undated-callout":"",children:t.jsxs(vr,{defaultOpen:x.dated.length===0,triggerClassName:"text-ink hover:bg-row-hover hover:text-ink",chevronClassName:"text-ink-dim",rowClassName:"min-h-8 py-0",summary:t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-meta",children:[t.jsx(Ya,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"truncate text-ink",children:Ri(x.undated.length)})]}),children:[x.dated.length===0&&t.jsx("p",{className:"pb-1 text-meta text-ink-muted",children:n("ui.projects.project_timeline.set_a_start_date_a_target_date_or_a_milestone_date_and_it_will_ap")}),t.jsx("ul",{className:"flex max-h-24 flex-wrap gap-x-3 gap-y-1 overflow-y-auto",children:x.undated.map(C=>t.jsx("li",{children:t.jsx("button",{type:"button",className:"rounded-sm text-meta text-ink hover:bg-row-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",onClick:()=>r(C),children:X(C.project)})},C.project.id))})]})})]})},Pl=({startMs:e,endMs:s,tier:r,pxPerDay:a,trackPx:o})=>{const i=qi(e,s,r);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:Rt}}),t.jsx("span",{className:"relative block h-6",style:{width:o},children:i.map(l=>t.jsxs("span",{className:"absolute top-0 h-full",style:{left:Me(e,l.dayMs)*a},children:[t.jsx("span",{className:M("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))})]})},Ml=({item:e,spanStart:s,pxPerDay:r,trackPx:a,today:o,onOpen:i})=>{const{project:l}=e,c=Di(e),u=Ai(e),m=p=>new Date(p).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-row-hover",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:Rt,height:hr},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:X(l)})}),t.jsxs("span",{className:"relative block",style:{width:a,height:hr},children:[c&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:Me(s,c.fromMs)*r,width:(Me(c.fromMs,c.toMs)+1)*r},title:`${De(m(c.fromMs))} → ${De(m(c.toMs))}`}),u.map(p=>t.jsx("span",{"data-milestone":p.status,className:M("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",p.status==="completed"&&"bg-success",p.status==="overdue"&&"bg-warning",p.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:Me(s,p.dayMs)*r},title:`${p.name} · ${p.status} · ${De(m(p.dayMs))}`},`${p.name}-${p.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:Me(s,o)*r},"aria-hidden":"true"})]})]})},Il=({projects:e,query:s,onQueryChange:r,filters:a,onFiltersChange:o,onClearAll:i,todayMs:l,resultText:c,countRevealClass:u="@[37rem]:inline",trailing:m,disabled:p=!1,searchFieldRef:f})=>{L();const[b,_]=d.useState(!1),x=d.useRef(!1),v=pi(a),g=Tr(c??"",300),h=s.trim()!==""||!ct(a);return t.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-3",children:[t.jsxs("div",{className:"relative w-full min-w-0 max-w-[400px]",children:[t.jsx(ja,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim","aria-hidden":"true"}),t.jsx(oe,{ref:f,inputSize:"sm",value:s,onChange:y=>r(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(s?r(""):y.currentTarget.blur())},placeholder:n("ui.projects.projects_toolbar.search_projects"),"aria-label":n("ui.projects.projects_toolbar.search_projects"),autoComplete:"off",spellCheck:!1,className:"pl-9"}),s?t.jsx(z,{variant:"ghost",size:"icon-sm",className:"absolute top-1/2 right-1 -translate-y-1/2",onClick:()=>ha(f.current,r),"aria-label":n("ui.projects.projects_toolbar.clear_search"),children:t.jsx(Pt,{"aria-hidden":"true"})}):t.jsx("span",{className:"pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-ink-dim",children:t.jsx(ga,{shortcut:"/"})})]}),t.jsxs(fs,{open:b,onOpenChange:_,children:[t.jsx(js,{asChild:!0,children:t.jsxs(z,{variant:"secondary",size:"sm",disabled:p,"data-project-filters-button":"",children:[t.jsx(Ka,{size:14,"aria-hidden":"true"}),n("ui.projects.projects_toolbar.filters"),v>0&&t.jsx(xe,{variant:"neutral",children:v})]})}),t.jsx(hs,{align:"end","aria-label":n("ui.projects.projects_toolbar.filters"),className:"w-80 p-0",onCloseAutoFocus:y=>{x.current&&(x.current=!1,y.preventDefault())},children:t.jsx(yn,{children:t.jsx(vn,{projects:e,state:a,query:s,todayMs:l,onToggle:(y,T)=>o(Jr(a,y,T)),onClearAll:()=>{i(),x.current=!0,_(!1),f.current?.focus()}})})})]}),h&&c!==null&&t.jsx("span",{className:M("hidden whitespace-nowrap text-meta text-ink-dim",u),"data-project-count":"",children:c}),t.jsx("output",{className:"sr-only","aria-live":"polite",children:g}),m]})},Ll=({filters:e,sort:s,onFiltersChange:r,onSortChange:a,onClearAll:o,hideClearAll:i=!1,searchFieldRef:l})=>{L();const[c,u]=d.useState(null);d.useEffect(()=>{if(!c)return;let f=null;c.kind==="search"?f=l.current:(f=document.querySelector(`[data-project-chip="${c.index}"]`),f||(f=document.querySelector("[data-project-chip]")),f||(f=document.querySelector("[data-project-filters-button]"))),f&&(f.focus(),u(null))});const m=[];for(const f of Ze){const b=e[f];if(b.length===0)continue;const _=b.map(g=>Xr(f,g)),x=_[0],v=_.length>1?n("ui.projects.projects_toolbar.facet_labels_facet_first_length_1",{FACET_LABELS_facet:String(ot[f]),first:String(x),length___1:V(_.length-1,{useGrouping:!1})}):n("ui.projects.projects_toolbar.facet_labels_facet_first",{FACET_LABELS_facet:String(ot[f]),first:String(x)});m.push({kind:"facet",facet:f,label:v,ariaLabel:n("ui.projects.projects_toolbar.remove_filter_facet_labels_facet_join",{FACET_LABELS_facet:String(ot[f]),join:String(_.join(", "))}),clear:()=>r({...e,[f]:[]})})}if(s&&m.push({kind:"sort",spec:s,label:n("ui.projects.projects_toolbar.sort_key",{key:String(Xe(s.key))}),ariaLabel:n("ui.projects.projects_toolbar.remove_sort_key_direction",{key:String(Xe(s.key)),direction:String(ks(s.key,s.direction))}),clear:()=>a(null)}),m.length===0)return null;const p=(f,b)=>{b.clear();const _=m.length-1;u(_===0?{kind:"chip",index:0}:{kind:"chip",index:Math.min(f,_-1)})};return t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.map((f,b)=>t.jsx(xe,{asChild:!0,variant:"neutral",className:"gap-1 pr-1 text-ink",children:t.jsxs("button",{type:"button",className:"group","data-project-chip":b,"aria-label":f.ariaLabel,onClick:()=>p(b,f),children:[f.kind==="sort"&&(f.spec.direction==="asc"?t.jsx(Dr,{size:10,className:"text-ink-muted","aria-hidden":"true"}):t.jsx(Nr,{size:10,className:"text-ink-muted","aria-hidden":"true"})),t.jsx("span",{className:"truncate",children:f.label}),t.jsx(Pt,{className:M("text-ink-dim transition-colors duration-fast ease-out-quart","group-hover:text-danger"),"aria-hidden":"true"})]})},f.kind==="facet"?f.facet:"sort")),!i&&t.jsx(z,{variant:"link",size:"sm",onClick:()=>{o(),u({kind:"search"})},children:n("ui.projects.projects_toolbar.clear_all")})]})},kn="projects-view",Fl=[{value:"list",get label(){return n("ui.projects.projects_view_switcher.list")}},{value:"board",get label(){return n("ui.projects.projects_view_switcher.board")}},{value:"timeline",get label(){return n("ui.projects.projects_view_switcher.timeline")}}];function ql(){try{const e=localStorage.getItem(kn);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"board"}function Ul(e){try{localStorage.setItem(kn,e)}catch{}}const Bl=({value:e,onChange:s})=>(L(),t.jsx(Ea,{value:e,onValueChange:r=>s(r),children:t.jsx(Ta,{"aria-label":n("ui.projects.projects_view_switcher.project_view"),"data-tour-tag":"projects-view-switcher",children:Fl.map(r=>t.jsx(Ra,{value:r.value,children:r.label},r.value))})})),$l=["r1","r2","r3","r4","r5","r6"],zl=4e3,gr={get unpaired(){return n("ui.projects.projects_page.this_app_is_not_paired_with_the_local_operator_server_so_projects")},get"below-version"(){return n("ui.projects.projects_page.the_local_operator_server_is_older_than_this_app_expects_so_proje")},get unknown(){return n("ui.projects.projects_page.the_server_s_capabilities_could_not_be_read_so_projects_are_unava")}},Jl=({nowMs:e=Date.now()})=>{L();const{projectId:s}=xa(),r=At(),a=Je(),o=ba(a.data,"projects",1),i=o==="enabled",l=he(a.data,"projects",Wo),c=wr(he(a.data,"team_catalogue")),u=Ja(i),m=eo(),p=Or(),f=Pr(),[b,_]=d.useState(!1),[x,v]=d.useState(()=>ql()),[g,h]=d.useState(()=>vo()),[y,T]=d.useState(null),[w,U]=d.useState(""),[C,E]=d.useState(Ws),[P,j]=d.useState(()=>xi()),[O,R]=d.useState(""),I=d.useRef(""),Y=d.useRef(null),q=d.useRef(null),G=S=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),S!==""&&S===I.current?(R(""),Y.current=window.requestAnimationFrame(()=>{Y.current=null,R(S)})):R(S),I.current=S,q.current!==null&&window.clearTimeout(q.current),q.current=window.setTimeout(()=>{q.current=null,I.current="",R("")},zl)},W=()=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),q.current!==null&&(window.clearTimeout(q.current),q.current=null),I.current="",R("")},J=S=>{U(S),W()},de=S=>{E(S),W()},Z=d.useRef(null),ee=ac(),k=u.data??[],N=Ns(e),D=ii(w,i&&l),F=Qr(w),B=d.useMemo(()=>D.answer?ai(k,D.answer.projects):null,[k,D.answer]),$=F!=="",ie=d.useMemo(()=>$?B??ni(k,F):k,[k,F,$,B]),Ae=B===null?"client":"backend",H=d.useMemo(()=>mi(ie,C,N),[ie,C,N]),Ce=l&&$&&D.pending,be=$||!ct(C),fe=d.useMemo(()=>$s(k,g,e),[k,g,e]),te=d.useMemo(()=>$s(H,g,e),[H,g,e]),Oe=yo(g),ce=x==="board"?te.length:H.length,tt=!be||!u.isSuccess?null:x==="board"?n("ui.projects.projects_page.length_of_length_2_in_window",{length:V(te.length,{useGrouping:!1}),length_2:V(fe.length,{useGrouping:!1})}):n("ui.projects.projects_page.length_of_length_2_projects",{length:V(H.length,{useGrouping:!1}),length_2:k.length}),re=u.isSuccess&&k.length>0,Ee=re&&be&&ce===0&&!Ce,Ue=Ce&&ce===0&&re,[qt,st]=d.useState(!1);d.useEffect(()=>{if(!qt)return;const S=document.querySelector('[data-tour-tag="projects-board-window"]');S&&(S.focus(),st(!1))}),d.useEffect(()=>{if(!i||s)return;const S=K=>{const Q=K.target;if(!Q||Q.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(Q.tagName)||Q.closest('[role="dialog"]'))return;const ke=K.key==="/"&&!K.metaKey&&!K.ctrlKey&&!K.altKey,ae=(K.metaKey||K.ctrlKey)&&K.key.toLowerCase()==="f";!ke&&!ae||(K.preventDefault(),Z.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[i,s]);const rt=d.useRef(null);d.useLayoutEffect(()=>{if(!s)return;const S=rt.current;S!==null&&(S.scrollTop=0)},[s]);const gt=Za(x==="timeline"?k.map(S=>S.id):[],i),A=new Map(k.map((S,K)=>[S.id,gt[K]])),ne=H.map(S=>({project:S,milestones:A.get(S.id)?.data?.project.milestones??[]})),nt=x==="timeline"?H.filter(S=>A.get(S.id)?.isLoading).length:0,ye=x==="timeline"?H.filter(S=>A.get(S.id)?.isError).length:0,xt=()=>{for(const S of gt)S.isError&&S.refetch()},Be=S=>{j(S),bi(S),G(yi(S))},wn=(S,K)=>{E(Q=>Jr(Q,S,K)),W()},bt=()=>{const S=w.trim()!=="",K=!ct(C),Q=P!==null;U(""),E(Ws),P!==null&&Be(null),G(vi({search:S,filters:K,sort:Q}))},Es=()=>{h("all"),zs("all"),st(!0)},[ve,Ts]=d.useState(null),Ut=d.useRef(!1),Rs=()=>{Ut.current=!1,Ts(null)},[Nn,Ds]=d.useState([]),Sn=he(a.data,"projects_force_done"),Cn=(S,K)=>{const Q=S.id,ke=se(K).label;Ds(ae=>ae.includes(Q)?ae:[...ae,Q]),Gi({move:()=>p.mutateAsync({key:Q,fields:{status:K}}),forceDoneOffered:Sn,claimQuestion:()=>Ut.current?!1:(Ut.current=!0,!0)}).then(ae=>{if(ae.kind==="accepted"){je(n("ui.projects.projects_page.moved_to_label",{label:String(ke)})),u.refetch().then(()=>ee(Q));return}if(ae.kind==="question"){Ts({project:S,status:K,refusal:ae.refusal});return}le(ae.copy,ae.refusal?{action:{get label(){return n("ui.projects.projects_page.view_project")},onClick:()=>void r(`/projects/${Q}`)}}:void 0),ee(Q)}).finally(()=>{Ds(ae=>ae.filter(En=>En!==Q))})};return i?s?t.jsx("div",{ref:rt,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(vl,{projectKey:s,nowMs:e})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"@container flex shrink-0 flex-col gap-8 px-6 pt-6",children:[t.jsx(Fs,{title:n("ui.projects.projects_page.projects"),icon:Us,subtitle:n("ui.projects.projects_page.workstreams_you_and_your_agents_track_across_sessions"),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{variant:"secondary",size:"icon","aria-label":n("ui.projects.projects_page.refresh_projects"),title:n("ui.projects.projects_page.refresh_projects"),disabled:u.isFetching,onClick:()=>void u.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(Ma,{})}),t.jsxs(z,{variant:"secondary",onClick:()=>_(!0),"data-tour-tag":"create-project-button",children:[t.jsx(it,{}),n("ui.projects.projects_page.new_project")]})]})}),t.jsxs("div",{className:"flex shrink-0 flex-col gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3","data-project-search-row":"",children:[t.jsx(Bl,{value:x,onChange:S=>{v(S),Ul(S)}}),t.jsx(Il,{projects:ie,query:w,onQueryChange:J,filters:C,onFiltersChange:de,onClearAll:bt,todayMs:N,resultText:tt,countRevealClass:x==="board"?"@[47rem]:inline":void 0,disabled:u.isError,searchFieldRef:Z,trailing:x==="board"&&!(u.isSuccess&&u.data.length===0)?t.jsx(Yi,{value:g,onChange:S=>{h(S),zs(S)}}):null})]}),t.jsx(Ll,{filters:C,sort:P,onFiltersChange:de,onSortChange:Be,onClearAll:bt,hideClearAll:Ee,searchFieldRef:Z}),t.jsx("output",{"data-project-announcement":"",className:"sr-only","aria-live":"polite",children:O})]})]}),t.jsxs("div",{className:"mt-8 flex min-h-0 flex-1 flex-col",children:[u.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:n("ui.projects.projects_page.loading_projects")}),$l.map(S=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx($e,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx($e,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-40 shrink-0 bg-elevated"})]},S))]}),u.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx(Kt,{variant:"danger",children:u.error instanceof Error&&u.error.message?u.error.message:n("ui.projects.projects_page.the_projects_could_not_be_read")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:()=>void u.refetch(),children:n("ui.projects.projects_page.try_again")})]}),u.isSuccess&&u.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:n("ui.projects.projects_page.no_projects_yet")}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:n("ui.projects.projects_page.create_one_here_or_ask_an_agent_to_create_one_and_link_this_sessi")}),t.jsxs(z,{variant:"primary",onClick:()=>_(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(it,{}),n("ui.projects.projects_page.new_project")]})]}),Ue&&t.jsx("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:n("ui.projects.projects_page.searching")})}),re&&Ee&&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:w.trim()?n("ui.projects.projects_page.no_projects_match_trim",{trim:String(w.trim())}):n("ui.projects.projects_page.no_projects_match")}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:w.trim()?Ko[Ae]:n("ui.projects.projects_page.try_removing_a_filter_clearing_the_filters_restores_the_list")}),t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(z,{variant:"secondary",onClick:()=>{bt(),Z.current?.focus()},children:n("ui.projects.projects_page.clear_all")}),x==="board"&&H.length>0&&t.jsx(z,{variant:"secondary",onClick:Es,children:n("ui.projects.projects_page.show_all_time")})]})]}),re&&!Ee&&!Ue&&x==="list"&&t.jsx(Dl,{projects:H,nowMs:e,onOpen:S=>void r(`/projects/${S.id}`),sort:P,onSortChange:Be,searchPopulation:ie,filters:C,query:w,todayMs:N,onToggleFilter:wn,onClearFilters:bt,teamLabelFor:c}),re&&!Ee&&x==="board"&&te.length>0&&t.jsx(ic,{projects:te,nowMs:e,onOpen:S=>void r(`/projects/${S.id}`),onEdit:S=>void r(`/projects/${S.id}`),onDelete:T,onMove:Cn,teamLabelFor:c,movingKeys:Nn}),re&&!Ee&&!Ue&&x==="board"&&te.length===0&&Oe!==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:Oe}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:n("ui.projects.projects_page.older_projects_are_hidden_by_the_window")}),t.jsx(z,{variant:"secondary",onClick:Es,children:n("ui.projects.projects_page.show_all_time")})]}),re&&!Ee&&!Ue&&x==="timeline"&&t.jsx(Ol,{items:ne,nowMs:e,onOpen:S=>void r(`/projects/${S.project.id}`),pendingDetails:nt,failedDetails:ye,onRetryDetails:xt,teamLabelFor:c})]}),t.jsx(pn,{open:y!==null,projectName:y?.name??"",onClose:()=>T(null),onConfirm:async S=>{y&&(await f.mutateAsync({key:y.id,confirmedName:S}),je(n("ui.projects.projects_page.project_deleted")),T(null))}}),t.jsx(fn,{open:ve!==null,refusal:ve?.refusal??null,projectLabel:ve?X(ve.project):"",onClose:()=>{ve&&ee(ve.project.id),Rs()},onConfirm:async()=>{if(!ve)return;const{project:S,status:K,refusal:Q}=ve,ke=await p.mutateAsync({key:S.id,fields:{status:K},forceDone:!0});je(Vr(ke,Q.count,se(K).label)),u.refetch().then(()=>ee(S.id))},secondaryLabel:n("ui.projects.projects_page.open_project"),onSecondary:()=>{const S=ve?.project.id;Rs(),S&&r(`/projects/${S}`)}}),t.jsx(wl,{open:b,onClose:()=>_(!1),onSubmit:async S=>{const K=await m.mutateAsync(S.fields),Q=S.followUp?.title??S.fields.name;if(S.followUp)try{await p.mutateAsync({key:K.id,fields:S.followUp})}catch(ke){const ae=ke instanceof Error&&ke.message?ke.message:"";le(n("ui.projects.projects_page.project_label_was_created_but_the_extra_fields_were_not_saved_val",{label:String(Q),value2:String(jt(ae)||n("ui.projects.projects_page.the_server_refused_them"))}));return}je(n("ui.projects.projects_page.project_label_created",{label:String(Q)}))}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(Fs,{title:n("ui.projects.projects_page.projects"),icon:Us}),a.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Se,{label:n("ui.projects.projects_page.checking_the_server_s_projects_support")})}):t.jsx(Kt,{variant:"warning",children:gr[o]??gr.unknown})]})};export{Jl as ProjectsPage};
|
|
40
|
+
`).trim()}function _n(e,s,r){const a=e.clipboardData?.getData("text/html");if(!a)return;const o=Yc(a);if(!o)return;e.preventDefault();const i=e.currentTarget,l=i.selectionStart??i.value.length,c=i.selectionEnd??l;r(i.value.slice(0,l)+o+i.value.slice(c)),requestAnimationFrame(()=>{const u=s.current;if(!u)return;const m=l+o.length;u.setSelectionRange(m,m)})}const fn=({open:e,refusal:s,projectLabel:r,onClose:a,onConfirm:o,secondaryLabel:i,onSecondary:l})=>{L();const[c,u]=d.useState(!1),[m,p]=d.useState(null),f=d.useRef(!1),b=d.useRef(null);d.useEffect(()=>{e&&(u(!1),p(null),f.current=!1)},[e]);const _=async()=>{if(!f.current){f.current=!0,u(!0),p(null);try{await o(),a()}catch(v){p({copy:an(v),gone:nn(v)})}finally{f.current=!1,u(!1)}}},x=s?.names??[];return t.jsx(dt,{open:e,onClose:a,title:n("ui.projects.project_done_anyway_dialog.mark_done_with_open_milestones"),dataTourTag:"project-done-anyway-dialog",maxWidth:"xs",dialogProps:{closeDisabled:c,onEscapeKeyDown:v=>{c&&v.preventDefault()},onInteractOutside:v=>{c&&v.preventDefault()},onOpenAutoFocus:v=>{v.preventDefault(),b.current?.focus()}},actions:t.jsxs("div",{className:"flex w-full min-w-0 flex-wrap justify-end gap-2",children:[t.jsx(Ye,{ref:b,onClick:a,disabled:c,children:n("ui.projects.project_done_anyway_dialog.cancel")}),!m?.gone&&t.jsx(Ye,{onClick:l,disabled:c,children:i}),m?.gone?t.jsx(vt,{"data-project-force-close":"",onClick:a,children:n("ui.projects.project_done_anyway_dialog.close")}):t.jsxs(vt,{"data-project-force-done":"","aria-disabled":c,className:"aria-disabled:pointer-events-none aria-disabled:bg-sunken aria-disabled:text-ink-disabled",onClick:()=>void _(),children:[c?t.jsx(Se,{size:"xs"}):t.jsx("span",{"aria-hidden":"true",className:"size-3.5 shrink-0"}),n("ui.projects.project_done_anyway_dialog.mark_done_anyway")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("p",{className:"text-body-sm text-ink break-words",children:r?n("ui.projects.project_done_anyway_dialog.projectlabel_moves_to_done_and_its_milestones_stay_open",{projectLabel:String(r)}):n("ui.projects.project_done_anyway_dialog.the_project_moves_to_done_and_its_milestones_stay_open")}),t.jsx("p",{className:"text-body-sm text-ink break-words",children:s?Go(s):""}),x.length>bt+1&&t.jsx("div",{className:"px-1.5",children:t.jsx(vr,{summary:n("ui.projects.project_done_anyway_dialog.show_all_length_open_milestones",{length:x.length}),children:t.jsx("ul",{"data-project-open-milestones":"",className:"flex flex-col gap-1 py-1 text-body-sm text-ink-muted",children:x.map((v,g)=>t.jsx("li",{className:"break-words",children:v},`${g}-${v}`))})})}),t.jsx("p",{role:"alert",className:"min-h-[1lh] text-body-sm text-danger break-words",children:m?.copy??""})]})})},jn=({status:e})=>{const s=se(e);return t.jsxs(xe,{variant:s.variant,children:[no(e)&&t.jsx(gs,{"aria-hidden":!0}),s.label]})},Hc="project-key",Kc="project-key";function _e(e,s){return{name:s,begin:n("ui.projects.project_editors.edit_field",{field:String(e)}),accept:n("ui.projects.project_editors.save_field",{field:String(e)}),cancel:n("ui.projects.project_editors.discard_the_field_edit",{field:String(e)}),busy:n("ui.projects.project_editors.saving_the_field",{field:String(e)}),saved:n("ui.projects.project_editors.display_saved",{display:String(s)}),retry:n("ui.projects.project_editors.retry_saving_the_field",{field:String(e)})}}const Ft=({field:e,fieldRef:s,fieldProps:r,editing:a,label:o,bare:i=!1,display:l,editor:c,slot:u,feedback:m,controlsIdle:p="affordance",hug:f=!1,feedbackExtra:b,className:_,controlsClassName:x})=>t.jsxs("div",{ref:s,...r,"data-project-field":e,className:M(!i&&Cs,"min-w-0",o!==void 0&&"flex items-start gap-3",_),children:[o!==void 0&&t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:o}),t.jsxs("div",{className:M("flex min-w-0 flex-col gap-1",f&&"items-start",o!==void 0&&"flex-1"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx("div",{className:M("min-w-0",f?"w-fit":"flex-1",!a&&"cursor-text"),onDoubleClick:a?void 0:u.begin,children:a?c:l}),t.jsx(cs,{api:u,idle:p,className:M("shrink-0",x)})]}),t.jsx("div",{className:M("min-h-[1lh] text-meta",f&&"max-w-96"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx(ls,{api:m}),b]})})]})]}),Ie=({field:e,value:s,display:r,commitFields:a,validate:o,labels:i,commit:l,placeholder:c,mono:u=!1,ramp:m="text-body-sm",label:p,bare:f=!1,autoBegin:b=!1,maxLength:_,onRetire:x,className:v,controlsClassName:g})=>{const[h,y]=d.useState(b);d.useEffect(()=>{h&&s!==""&&(y(!1),x?.("filled"))},[h,s,x]);const T=jt({value:s,commit:async w=>{await l(a(w))},equals:(w,U)=>w.trim()===U.trim(),validate:o,labels:i,selectAllOnBegin:!0,beginOnMount:b,errorCopy:et,onSettle:w=>{w==="cancelled"&&(y(!1),x?.("cancelled"))}});return!h&&s===""?null:t.jsx(Ft,{field:e,fieldRef:T.fieldRef,fieldProps:T.fieldProps,editing:T.editing,label:p,bare:f,display:r,slot:T,feedback:T,className:v,controlsClassName:g,editor:t.jsx(oe,{ref:T.editorRef,...T.editorAria,value:T.draft,readOnly:T.phase==="saving",maxLength:_,placeholder:c,"aria-label":i.name,onChange:w=>T.setDraft(w.target.value),spellCheck:!1,autoComplete:"off",className:M("h-8",u?"font-mono text-mono-sm":m)})})},Wc=({project:e,commit:s})=>{L();const r=e.title??"",[a,o]=d.useState(!1),i=d.useRef(null),l=c=>{o(!1),c==="cancelled"&&setTimeout(()=>i.current?.focus(),0)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[t.jsxs("div",{className:M(Cs,"flex min-w-0 flex-col gap-0.5"),children:[r?t.jsx(Ie,{field:"title",value:r,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:r}),commitFields:c=>({title:c.trim()}),validate:c=>ts(c),labels:_e("title",n("ui.projects.project_editors.title")),commit:s,maxLength:wt,placeholder:n("ui.projects.project_editors.a_short_name_for_the_workstream"),ramp:"text-body",bare:!0,controlsClassName:"self-center"}):t.jsx(Ie,{field:"key",value:e.name,display:t.jsx("h1",{"data-project-title":e.name,className:"min-w-0 break-words text-display text-ink",children:e.name}),commitFields:c=>({name:c.trim()}),validate:c=>Wt(c.trim()),labels:_e("key",n("ui.projects.project_editors.key")),commit:s,maxLength:Zs,placeholder:Hc,ramp:"text-body",bare:!0,controlsClassName:"self-center"}),!r&&(a?t.jsx(Ie,{field:"title",value:"",display:null,commitFields:c=>({title:c.trim()}),validate:c=>ts(c),labels:_e("title",n("ui.projects.project_editors.title")),commit:s,maxLength:wt,placeholder:e.name,ramp:"text-body-sm",bare:!0,autoBegin:!0,onRetire:l}):t.jsx("button",{ref:i,type:"button","data-project-add-title":"",onClick:()=>o(!0),className:M("w-fit cursor-pointer text-meta text-ink-dim","opacity-0 transition-opacity duration-base ease-out-quart","group-hover/inline-edit:opacity-100 group-hover/inline-edit:duration-fast","group-focus-within/inline-edit:opacity-100 group-focus-within/inline-edit:duration-fast","hover:text-ink"),children:n("ui.projects.project_editors.add_a_title")}))]}),r&&t.jsx(Ie,{field:"key",value:e.name,display:t.jsx("span",{className:"font-mono text-mono-sm text-ink-muted",children:e.name}),commitFields:c=>({name:c.trim()}),validate:c=>Wt(c.trim()),labels:_e("key",n("ui.projects.project_editors.key")),commit:s,maxLength:Zs,placeholder:Kc,mono:!0})]})},Vc=({project:e,commit:s})=>{L();const[r,a]=d.useState(!1),o=Je(),i=he(o.data,"projects_force_done"),[l,c]=d.useState(null),[u,m]=d.useState(null),p=d.useRef(!1),f=d.useRef(!1),b=d.useRef(null),_=jt({value:e.status,commit:async g=>{const h=p.current;p.current=!1,c(null);try{const y=await s({status:g},h?{forceDone:!0}:void 0);h&&je(Vr(y,l?.count??0,se(g).label)),b.current?.resolve()}catch(y){throw c(on(y)),b.current?.reject(y),y}finally{b.current=null}},labels:_e("status",n("ui.projects.project_editors.status")),keyboardCommit:!1,errorCopy:et,onBegin:()=>a(!0)}),x=i&&_.phase==="error"&&l!==null&&l.coded;d.useEffect(()=>{if(!f.current||_.phase!=="idle"&&_.phase!=="saved")return;f.current=!1;const g=document.querySelector("[data-project-milestones]");g&&(g.scrollIntoView({block:"start"}),g.querySelector("[data-project-milestones-heading]")?.focus({preventScroll:!0}))},[_.phase]);const v=()=>new Promise((g,h)=>{if(_.phase!=="error"||_.conflict!==null){h(new Error(""));return}if(!_.dirty){g();return}p.current=!0,b.current={resolve:g,reject:h},_.accept(_.draft,!0)});return t.jsx(Ft,{field:"status",fieldRef:_.fieldRef,fieldProps:_.fieldProps,editing:_.editing,display:t.jsx(jn,{status:e.status}),slot:_,feedback:_,hug:!0,feedbackExtra:t.jsxs(t.Fragment,{children:[x&&t.jsx(z,{variant:"ghost",size:"sm","data-project-force-done-door":"",onClick:()=>m(l),children:n("ui.projects.project_editors.mark_done_anyway")}),t.jsx(fn,{open:u!==null,refusal:u,projectLabel:X(e),onClose:()=>m(null),onConfirm:v,secondaryLabel:n("ui.projects.project_editors.review_milestones"),onSecondary:()=>{m(null),f.current=!0,_.cancel()}})]}),editor:t.jsxs(He,{open:r,onOpenChange:a,value:_.draft,onValueChange:g=>{a(!1),_.accept(g)},children:[t.jsx(Ke,{ref:_.editorRef,..._.editorAria,"aria-label":n("ui.projects.project_editors.status"),"data-project-status":"",className:"h-7 w-fit min-w-36",children:t.jsx(We,{})}),t.jsx(Ve,{children:Ir.map(g=>t.jsx(Re,{value:g.value,"data-project-status-option":g.value,children:g.label},g.value))})]})})},Qc=({project:e,commit:s})=>{L();const[r,a]=d.useState(!1),o=d.useRef(null),i=d.useRef(null),l=jt({value:e.description,commit:async m=>{await s({description:m.trim()})},equals:(m,p)=>m.trim()===p.trim(),validate:m=>sn(m),multiline:!0,labels:_e("description",n("ui.projects.project_editors.description")),errorCopy:et,editorRef:o,onSettle:m=>{m==="cancelled"&&!e.description.trim()&&setTimeout(()=>i.current?.focus(),0)}});d.useEffect(()=>{if(r||!l.editing)return;const m=setTimeout(()=>o.current?.focus(),0);return()=>clearTimeout(m)},[r,l.editing]);const u=(l.editing?l.draft:l.displayValue).length>Qe;return t.jsx("div",{ref:l.fieldRef,...l.fieldProps,"data-project-field":"description",className:M(Cs,"min-w-0"),children:l.editing?t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_editors.description_mode")}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(m=>t.jsx("button",{type:"button","data-project-description-mode":m,"aria-pressed":r===(m==="preview"),onClick:()=>a(m==="preview"),className:M("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink",r===(m==="preview")&&"bg-surface text-ink"),children:m==="write"?n("ui.projects.project_editors.write"):n("ui.projects.project_editors.preview")},m))})]}),t.jsx(cs,{api:{...l,acceptBlocked:u}})]}),r?t.jsx("div",{"data-project-description-preview":"",className:"h-40 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:l.draft.trim()?t.jsx(ut,{className:"text-body-sm",children:l.draft}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_editors.nothing_to_preview_yet")})}):t.jsx(Sr,{ref:o,...l.editorAria,"data-project-description":"",value:l.draft,readOnly:l.phase==="saving",rows:8,placeholder:n("ui.projects.project_editors.markdown_headings_lists_code"),"aria-label":l.labels.name,onChange:m=>l.setDraft(m.target.value),onPaste:m=>_n(m,o,p=>l.setDraft(p)),className:"h-40 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(ls,{api:l}),t.jsxs("p",{className:M("shrink-0 text-meta tabular-nums",u?"text-danger":"text-ink-muted"),children:[l.draft.length,"/",Qe]})]})]}):t.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[(e.description??"").trim()?t.jsxs("div",{className:"flex min-w-0 items-start gap-1.5",children:[t.jsx("div",{className:"min-w-0 flex-1 cursor-text",onDoubleClick:l.begin,children:t.jsx(ut,{className:"text-body",children:e.description??""})}),t.jsx(cs,{api:l})]}):t.jsx("button",{ref:i,type:"button","data-project-add-description":"",onClick:l.begin,className:"w-fit cursor-pointer text-body-sm text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink",children:n("ui.projects.project_editors.add_description")}),t.jsx("div",{className:"min-h-[1lh] text-meta",children:t.jsx(ls,{api:l})})]})})},Xc=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>(L(),t.jsx(Ie,{field:"owner",value:e.owner??"",label:n("ui.projects.project_editors.owner"),display:t.jsx("span",{className:"text-body-sm text-ink",children:e.owner}),commitFields:o=>({owner:o.trim()}),validate:o=>St(o,"owner"),labels:_e("owner",n("ui.projects.project_editors.owner")),commit:s,maxLength:Nt,placeholder:n("ui.projects.examples.owner"),autoBegin:r,onRetire:a})),Jc=({project:e,commit:s,label:r=null,autoBegin:a=!1,onRetire:o})=>(L(),t.jsx(Ie,{field:"team",value:e.team??"",label:n("ui.projects.project_editors.team"),display:t.jsx("span",{className:"text-body-sm text-ink",children:r??e.team}),commitFields:i=>({team:i.trim()}),validate:i=>St(i,"team"),labels:_e("team",n("ui.projects.project_editors.team")),commit:s,maxLength:Nt,placeholder:n("ui.projects.examples.team"),autoBegin:a,onRetire:o})),mr=({project:e,commit:s,which:r,nowMs:a,autoBegin:o=!1,onRetire:i})=>{const l=r==="start"?e.start_date??"":e.target_date??"",c=L(),u=De(l,c,new Date(a)),m=r==="start"?n("ui.projects.project_editors.start"):n("ui.projects.project_editors.target");return t.jsx(Ie,{field:r==="start"?"start-date":"target-date",value:l,label:m,display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),commitFields:p=>r==="start"?{start_date:p}:{target_date:p},validate:p=>{const f=ss(p);return f||(r==="start"?rs(p,e.target_date??""):rs(e.start_date??"",p))},labels:_e(n("ui.projects.project_editors.tolowercase_date",{toLowerCase:String(m.toLowerCase())}),m),commit:s,placeholder:"YYYY-MM-DD",autoBegin:o,onRetire:i})},Zc=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{L();const o={estimate:e.estimate,unit:e.estimate_unit==="days"?"days":"points"},[i,l]=d.useState(r);d.useEffect(()=>{i&&e.estimate!==null&&(l(!1),a?.("filled"))},[i,e.estimate,a]);const c=jt({value:{number:e.estimate===null?"":String(e.estimate),unit:o.unit},equals:Ui,commit:async m=>{const p=$i(o,m);p&&await s(p)},validate:m=>rn(m.number),labels:_e("estimate",n("ui.projects.project_editors.estimate")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:et,onSettle:m=>{m==="cancelled"&&(l(!1),a?.("cancelled"))}});if(!i&&e.estimate===null)return null;const u=qr(e.estimate,e.estimate_unit)||"—";return t.jsx(Ft,{field:"estimate",fieldRef:c.fieldRef,fieldProps:c.fieldProps,editing:c.editing,label:n("ui.projects.project_editors.estimate"),display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),slot:c,feedback:c,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(oe,{ref:c.editorRef,...c.editorAria,"data-project-estimate":"",value:c.draft.number,readOnly:c.phase==="saving",placeholder:"13",inputMode:"decimal","aria-label":c.labels.name,onChange:m=>c.setDraft({...c.draft,number:m.target.value}),className:"h-8 max-w-24"}),t.jsxs(He,{value:c.draft.unit,onValueChange:m=>c.setDraft({...c.draft,unit:m}),children:[t.jsx(Ke,{"data-project-estimate-unit":"","aria-label":n("ui.projects.project_editors.estimate_unit"),"aria-invalid":c.editorAria["aria-invalid"],className:"h-8 w-fit min-w-28",children:t.jsx(We,{})}),t.jsxs(Ve,{children:[t.jsx(Re,{value:"points",children:n("ui.projects.project_editors.points")}),t.jsx(Re,{value:"days",children:n("ui.projects.project_editors.days")})]})]})]}),c.draft.number.trim()===""&&o.estimate!==null&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_editors.clearing_an_estimate_is_not_supported_yet_saving_keeps_its_curren")})]})})},el=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{L();const[o,i]=d.useState(r);d.useEffect(()=>{o&&e.tags.length>0&&(i(!1),a?.("filled"))},[o,e.tags,a]);const l=jt({value:e.tags.join(", "),equals:(u,m)=>Bi(lt(u),m),commit:async u=>{const{tags:m}=ns(u);await s({tags:m})},validate:u=>ns(u).error,labels:_e("tags",n("ui.projects.project_editors.tags")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:et,onSettle:u=>{u==="cancelled"&&(i(!1),a?.("cancelled"))}});if(!o&&e.tags.length===0)return null;const c=l.editing?lt(l.draft):e.tags;return t.jsx(Ft,{field:"tags",fieldRef:l.fieldRef,fieldProps:l.fieldProps,editing:l.editing,label:n("ui.projects.project_editors.tags"),display:t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:e.tags.map(u=>t.jsx(xe,{variant:"outline",children:u},u))}),slot:l,feedback:l,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(oe,{ref:l.editorRef,...l.editorAria,"data-project-tags":"",value:l.draft,readOnly:l.phase==="saving",placeholder:n("ui.projects.project_editors.q4_payments"),"aria-label":l.labels.name,onChange:u=>l.setDraft(u.target.value),className:"h-8 max-w-72"}),t.jsx("span",{className:"flex flex-wrap items-center gap-1.5",children:c.map(u=>t.jsx(xe,{variant:"outline",children:u},u))})]})})},tl="project-quick-send:no-target",sl=[],rl=({links:e,target:s,onTargetChange:r,onSend:a,focusTick:o})=>{L();const i=d.useRef(null),l=Wn(),{frontend:c,refresh:u}=qa(),[m,p]=d.useState(!1),f=Je(),b=s??tl;d.useEffect(()=>{s&&u(s)},[s,u]),d.useEffect(()=>{o>0&&i.current?.focusInput()},[o]);const _=e.filter(g=>g.exists),v=(_.find(g=>g.session_id===s)??null)?.runtime?.busy===!0;return t.jsxs("div",{"data-tour-tag":"project-quick-send","data-glass-block":"",className:"flex flex-col gap-2 rounded-md bg-surface 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:n("ui.projects.project_quick_send.send_to")}),t.jsxs(He,{value:s??void 0,onValueChange:g=>r(g),children:[t.jsx(Ke,{"aria-label":n("ui.projects.project_quick_send.select_the_session_to_message"),className:"max-w-72",children:t.jsx(We,{placeholder:n("ui.projects.project_quick_send.no_session_selected")})}),t.jsx(Ve,{children:_.map(g=>t.jsx(Re,{value:g.session_id,children:Lt(g)},g.session_id))})]}),m?t.jsx("span",{role:"status",className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.sending")}):v?t.jsx("span",{className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.the_session_is_working_this_message_steers_the_running_turn")}):null]}),t.jsx(Vn,{ref:i,conversationId:b,messages:sl,isLoading:!1,ownGutter:!0,transcriptless:!0,autoFocus:!1,placeholderOverride:n("ui.projects.project_quick_send.message_the_session_paste_an_image_to_attach_it"),cwd:c?.cwd,cwdReadOnlyReason:n("ui.projects.project_quick_send.quick_send_follows_the_conversation_s_directory"),sessionStatus:c&&s?{frontend:c,costChannels:he(f.data,"cost_channels")}:void 0,recordingProbe:l,hostNotice:s?void 0:{id:"project-quick-send-no-target",node:t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.choose_a_session_to_send_to")}),blocksInput:!0,get placeholder(){return n("ui.projects.project_quick_send.choose_a_session_to_send_to")}},onSendMessage:async(g,h)=>{if(!s)return!1;p(!0);try{return await a(s,g,v?"steer":"prompt",h)}finally{p(!1),i.current?.focusInput({preventScroll:!0})}}})]})},nl=({links:e,busy:s,onUnlink:r,onLink:a,onQuickSend:o,onStartSession:i})=>{L();const l=Dt(),c=kt(h=>h.sessions),[u,m]=d.useState(!1),[p,f]=d.useState(null),[b,_]=d.useState(0),x=p&&e.some(h=>h.session_id===p&&h.exists)?p:Lo(e),v=d.useMemo(()=>{const h=new Set(e.map(y=>y.session_id));return c.filter(y=>!h.has(y.session_id)).map(y=>({id:y.session_id,name:y.title||y.session_id,description:y.cwd??void 0}))},[c,e]),g=h=>{kt.getState().openSession(h).then(y=>{y&&l(`/chat/${h}`)})};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:n("ui.projects.project_links.linked_sessions")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(z,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Aa,{}),n("ui.projects.project_links.new_session")]}),t.jsxs(z,{variant:"secondary",size:"sm",disabled:s,onClick:()=>m(!0),"data-tour-tag":"project-link-session",children:[t.jsx(Oa,{}),n("ui.projects.project_links.link_session")]})]})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_links.no_sessions_linked_yet_link_the_conversations_that_are_working_on")}):t.jsx("ul",{"data-glass-block":"",className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(h=>{const y=_o(h),T=fo(h.subagents),w=jo(h.todos),U=h.title||h.session_id,C=h.exists;return t.jsxs("li",{"data-glass-block-row":"",className:M("flex items-center gap-2 rounded-sm px-2 py-2",C&&"hover:bg-row-hover"),children:[t.jsx("button",{type:"button",disabled:!C,onClick:()=>{C&&g(h.session_id)},className:M("flex min-w-0 flex-1 items-center gap-2 text-left",C?"cursor-pointer":"cursor-default opacity-100"),children:t.jsx("span",{"data-glass-block-row-label":"",className:M("min-w-0 truncate text-body-sm",h.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:U})}),h.runtime?.busy===!0&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_links.busy")}),T&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:T}),w&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:w}),t.jsx(xe,{variant:y.variant,children:y.label}),C&&t.jsx(z,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.message_title",{title:String(U)}),title:n("ui.projects.project_links.message_title",{title:String(U)}),onClick:()=>{f(h.session_id),_(E=>E+1)},children:t.jsx(Pa,{})}),t.jsx(z,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.unlink_title",{title:String(U)}),onClick:()=>r(h.session_id),children:t.jsx(Qa,{})})]},h.session_id)})}),e.some(h=>h.exists)&&t.jsx(rl,{links:e,target:x,onTargetChange:f,onSend:o,focusTick:b}),t.jsx(dt,{open:u,onClose:()=>m(!1),title:n("ui.projects.project_links.link_a_session"),maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(Ye,{onClick:()=>m(!1),children:n("ui.projects.project_links.close")}),children:t.jsxs("div",{className:"flex flex-col gap-2 px-1 py-1",children:[t.jsx(ue,{children:n("ui.projects.project_links.session")}),t.jsx(Cr,{showLabel:!1,ariaLabel:n("ui.projects.project_links.search_sessions"),busyLabel:n("ui.projects.project_links.loading_sessions"),placeholder:n("ui.projects.project_links.search_conversations"),options:v,selected:null,onSelect:h=>{m(!1),a(h.id)}}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_links.conversations_already_linked_to_this_project_are_not_listed")})]})})]})},al=({milestones:e,summary:s,busy:r,onToggle:a,onRemove:o,onAdd:i})=>{const[l,c]=d.useState(""),[u,m]=d.useState(""),p=L(),f=!Lr.test(u.trim()),b=l.trim().length>0&&!f&&!r,_=()=>{b&&(i(l.trim(),u.trim()),c(""),m(""))};return t.jsxs("section",{"data-project-milestones":"",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",tabIndex:-1,"data-project-milestones-heading":"",children:n("ui.projects.project_milestones.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:n("ui.projects.project_milestones.no_milestones_yet_add_one_below_to_mark_the_dates_this_project_is")}):t.jsx("ul",{"data-glass-block":"",className:"flex flex-col divide-y divide-hairline rounded-md bg-surface",children:e.map(x=>{const v=oo(x.status),g=x.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Er,{checked:g,disabled:r,onCheckedChange:h=>a(x.name,h===!0),"aria-label":g?n("ui.projects.project_milestones.mark_name_not_complete",{name:String(x.name)}):n("ui.projects.project_milestones.mark_name_complete",{name:String(x.name)})}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:x.name}),x.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:De(x.target_date,p)}),t.jsx(xe,{variant:v.variant,children:v.label}),t.jsx(z,{variant:"ghost",size:"icon-sm",disabled:r,"aria-label":n("ui.projects.project_milestones.remove_name",{name:String(x.name)}),onClick:()=>o(x.name),children:t.jsx(Pt,{})})]},x.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(ue,{htmlFor:"project-milestone-name",children:n("ui.projects.project_milestones.new_milestone")}),t.jsx(oe,{id:"project-milestone-name",value:l,onChange:x=>c(x.target.value),placeholder:n("ui.projects.project_milestones.beta_cut"),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),_())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:"project-milestone-date",children:n("ui.projects.project_milestones.target_date")}),t.jsx(oe,{id:"project-milestone-date",value:u,onChange:x=>m(x.target.value),placeholder:"YYYY-MM-DD","aria-invalid":f}),f&&t.jsx("p",{className:"text-meta text-danger",children:n("ui.projects.project_milestones.dates_are_yyyy_mm_dd_or_empty")})]}),t.jsxs(z,{variant:"secondary",disabled:!b,onClick:_,"data-tour-tag":"project-milestone-add",children:[t.jsx(it,{}),n("ui.projects.project_milestones.add")]})]})]})},ol=[{field:"owner",get label(){return n("ui.projects.project_properties.owner")}},{field:"team",get label(){return n("ui.projects.project_properties.team")}},{field:"start",get label(){return n("ui.projects.project_properties.start_date")}},{field:"target",get label(){return n("ui.projects.project_properties.target_date")}},{field:"estimate",get label(){return n("ui.projects.project_properties.estimate")}},{field:"tags",get label(){return n("ui.projects.project_properties.tags")}}],_r=({label:e,children:s})=>t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("dt",{className:"w-24 shrink-0 pt-0.5 text-body-sm text-ink-muted",children:e}),t.jsx("dd",{className:"min-w-0 flex-1 text-body-sm text-ink",children:s})]}),il=({project:e,nowMs:s,commit:r,teamLabel:a=null})=>{const o=L(),i=new Date(s),[l,c]=d.useState(null),u=d.useRef(null),m=d.useRef(!1),p={owner:e.owner!==null,team:e.team!==null,start:e.start_date!==null,target:e.target_date!==null,estimate:e.estimate!==null,tags:e.tags.length>0},f=(E,P)=>{c(j=>j===E?null:j),P==="cancelled"&&!p[E]&&setTimeout(()=>u.current?.focus(),0)},b=ol.filter(({field:E})=>!p[E]&&l!==E),_=De(e.completed_at,o,i),x=e.updated_at>0?mt(pt(e.updated_at,s)):"",v=e.updated_at>0?Qn(new Date(e.updated_at*1e3),{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},o):"",g=p.owner||l==="owner",h=p.team||l==="team",y=p.start||l==="start",T=p.target||l==="target",w=p.estimate||l==="estimate",U=p.tags||l==="tags",C=g||h||y||T||!!_||w||U||e.updated_at>0;return t.jsxs("section",{className:"flex flex-col gap-3",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx("h2",{className:"text-title text-ink",children:n("ui.projects.project_properties.properties")}),b.length>0&&t.jsxs(ps,{children:[t.jsx(ms,{asChild:!0,children:t.jsxs("button",{ref:u,type:"button","data-project-add-field":"",className:M("flex shrink-0 cursor-pointer items-center gap-1 rounded-xs text-meta text-ink-dim","transition-colors duration-fast ease-out-quart hover:text-ink"),children:[t.jsx(it,{className:"size-3","aria-hidden":"true"}),n("ui.projects.project_properties.add")]})}),t.jsx(_s,{align:"end",onCloseAutoFocus:E=>{m.current&&(m.current=!1,E.preventDefault())},children:b.map(({field:E,label:P})=>t.jsx(Ne,{"data-project-add-option":E,onSelect:()=>{m.current=!0,c(E)},children:P},E))})]})]}),C?t.jsxs("dl",{className:"flex flex-col gap-2",children:[g&&t.jsx(Xc,{project:e,commit:r,autoBegin:l==="owner",onRetire:E=>f("owner",E)}),h&&t.jsx(Jc,{project:e,commit:r,label:a,autoBegin:l==="team",onRetire:E=>f("team",E)}),y&&t.jsx(mr,{project:e,commit:r,which:"start",nowMs:s,autoBegin:l==="start",onRetire:E=>f("start",E)}),T&&t.jsx(mr,{project:e,commit:r,which:"target",nowMs:s,autoBegin:l==="target",onRetire:E=>f("target",E)}),_&&t.jsx(_r,{label:n("ui.projects.project_properties.completed"),children:_}),w&&t.jsx(Zc,{project:e,commit:r,autoBegin:l==="estimate",onRetire:E=>f("estimate",E)}),U&&t.jsx(el,{project:e,commit:r,autoBegin:l==="tags",onRetire:E=>f("tags",E)}),e.updated_at>0&&t.jsx(_r,{label:n("ui.projects.project_properties.updated"),children:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:v,children:x})})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_properties.no_dates_estimate_tags_owner_or_team_yet")})]})},cl=({project:e})=>{L();const s=Je(),r=dn(),{sending:a,cooling:o,cooldownRemainingMs:i}=rc(e.id);if(!he(s.data,"projects_request_update"))return null;const l=X(e),c=Wi(e.id);return t.jsxs(t.Fragment,{children:[t.jsx(Ot,{content:o&&i!==null?Ct(l,i):n("ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"),children:t.jsxs(z,{variant:"secondary",className:"min-w-37","data-tour-tag":"project-request-update","aria-busy":a?!0:void 0,"aria-disabled":o?!0:void 0,"aria-describedby":o?c:void 0,onClick:()=>r(e),children:[a?t.jsx(Se,{size:"sm"}):o?t.jsx(gs,{}):t.jsx(Wa,{}),a?n("ui.projects.project_request_update_button.requesting"):o?n("ui.projects.project_request_update_button.requested"):n("ui.projects.project_request_update_button.request_update")]})}),o&&i!==null&&t.jsx("span",{id:c,className:"sr-only",children:Ct(l,i)})]})},hn="plain",gn=e=>`team:${e}`,xn=e=>`agent:${e}`;function ll(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function ul(e){return e.kind==="team"?gn(e.name):e.kind==="agent"?xn(e.name):hn}const fr={kind:"plain"},dl=({open:e,onClose:s,onStart:r,teamsEnabled:a,profilesEnabled:o})=>{L();const[i,l]=d.useState(fr),[c,u]=d.useState(null),[m,p]=d.useState(!1),f=Xn(e&&a),b=Jn(e&&o);d.useEffect(()=>{e&&(l(fr),u(null),p(!1))},[e]);const _=d.useMemo(()=>{const y=[{id:hn,get name(){return n("ui.projects.project_start_session.nothing_in_particular")},get description(){return n("ui.projects.project_start_session.a_plain_session_assign_a_team_or_agent_later")},get group(){return n("ui.projects.project_start_session.plain")}}];for(const T of f.data??[])y.push({id:gn(T.name),name:Ls(T),keywords:T.name===Ls(T)?void 0:[T.name],description:n("ui.projects.project_start_session.team_manager_manager",{manager:String(T.manager)}),get group(){return n("ui.projects.project_start_session.teams")}});for(const T of(b.data??[]).filter(w=>w.source!=="builtin"))y.push({id:xn(T.name),name:T.name,description:T.description||T.kind,get group(){return n("ui.projects.project_start_session.agents")}});return y},[f.data,b.data]),x=_.find(y=>y.id===ul(i))??_[0],v=!a||!o,g=f.isLoading||b.isLoading,h=async()=>{p(!0),u(null);try{await r(i),s()}catch(y){u(y instanceof Error&&y.message?y.message:n("ui.projects.project_start_session.the_session_could_not_be_started"))}finally{p(!1)}};return t.jsx(dt,{open:e,onClose:s,title:n("ui.projects.project_start_session.start_a_session"),maxWidth:"sm",dataTourTag:"project-start-session-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ye,{onClick:s,disabled:m,children:n("ui.projects.project_start_session.cancel")}),t.jsxs(vt,{onClick:()=>void h(),disabled:m,children:[m&&t.jsx(Se,{size:"xs"}),n("ui.projects.project_start_session.start_session")]})]}),children:t.jsxs("div",{className:"flex flex-col gap-4 px-1 py-1",children:[t.jsx(Cr,{label:n("ui.projects.project_start_session.work_with"),placeholder:n("ui.projects.project_start_session.search_teams_and_agents"),options:_,selected:x,onSelect:y=>l(ll(y.id)),busy:g,busyLabel:n("ui.projects.project_start_session.loading_teams_and_agents")}),t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_start_session.the_session_starts_now_links_itself_to_this_project_and_opens_wit")}),v&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_start_session.this_server_does_not_offer_the_team_or_agent_catalogues_yet_so_on")}),c&&t.jsx("p",{className:"text-body-sm text-danger",children:c})]})})},pl=({links:e})=>{L();const s=Io(e),r=e.filter(a=>a.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:n("ui.projects.project_todos.to_dos")}),s&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:Ys(s)})]}),r.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_todos.no_to_do_snapshots_from_the_linked_sessions_yet_a_session_publish")}):t.jsx("ul",{className:"flex flex-col divide-y divide-hairline",children:r.map(a=>t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx("span",{className:a.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:Lt(a)}),a.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:Ys(a.todos)})]},a.session_id))})]})},ml=({filePath:e,tooltip:s="File actions",icon:r,"aria-label":a="File actions",onShowInCanvas:o})=>{const i=async()=>{if(e)try{await navigator.clipboard.writeText(e),je("File path copied to clipboard")}catch(c){console.error("Failed to copy file path: ",c),le("Failed to copy file path")}},l=()=>{e&&window.api.openFile(e)};return t.jsxs(ps,{children:[t.jsx(Ot,{content:s,children:t.jsx(ms,{asChild:!0,children:t.jsx(z,{variant:"ghost",size:"icon-sm","aria-label":a,onClick:c=>c.stopPropagation(),children:r??t.jsx(yr,{"aria-hidden":"true"})})})}),t.jsxs(_s,{align:"end",className:"min-w-45",onClick:c=>c.stopPropagation(),children:[o&&t.jsxs(Ne,{onSelect:o,children:[t.jsx(Zn,{"aria-hidden":"true"}),t.jsx("span",{children:"Show in canvas"})]}),t.jsxs(Ne,{onSelect:l,children:[t.jsx(kr,{"aria-hidden":"true"}),t.jsx("span",{children:"Open file"})]}),t.jsxs(Ne,{onSelect:()=>window.api.showItemInFolder(e),children:[t.jsx(ea,{"aria-hidden":"true"}),t.jsx("span",{children:"Open folder"})]}),t.jsxs(Ne,{onSelect:i,children:[t.jsx(ta,{"aria-hidden":"true"}),t.jsx("span",{children:"Copy file path"})]})]})]})},_l=/[/\\]/;function bn(e){if(e.name)return e.name;const s=e.path.split(_l);return s[s.length-1]||n("ui.projects.project_updates.attachment")}const fl=({attachment:e})=>{L();const s=bn(e),r=Po(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:n("ui.projects.project_updates.open_name",{name:String(s)}),children:[t.jsx(kr,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),t.jsx("span",{className:"truncate text-body-sm text-ink",children:s})]}),r&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:r}),t.jsx(ml,{filePath:e.path,"aria-label":n("ui.projects.project_updates.file_actions_for_name",{name:String(s)})})]})},jl=({attachment:e})=>{L();const s=bn(e),r=sa(e.path,{mimeType:ra(e.name||e.path),sizeBytes:e.bytes});return r.status==="ready"?t.jsx("div",{className:"inline-block max-w-full",children:t.jsx(na,{file:e.path,src:r.url,label:s,conversationId:""})}):r.status==="loading"?t.jsx(aa,{children:t.jsxs("span",{className:"sr-only",children:[n("ui.projects.project_updates.loading"),s]})}):t.jsx(oa,{name:s})},hl=({attachments:e})=>t.jsx("div",{className:"flex flex-wrap items-start gap-2",children:e.map(s=>s.kind==="image"?t.jsx(jl,{attachment:s},`${s.path}:${s.added_at}`):t.jsx(fl,{attachment:s},`${s.path}:${s.added_at}`))}),gl=({update:e,nowMs:s})=>{const r=L(),a=Ao(e,r,s);return t.jsxs("article",{className:"flex flex-col gap-2 rounded-sm px-2 py-3",children:[a.length>0&&t.jsx("p",{className:"flex flex-wrap items-baseline gap-x-2 text-meta text-ink-muted",children:a.map((o,i)=>t.jsxs(d.Fragment,{children:[i>0&&t.jsx("span",{"aria-hidden":"true",children:"·"}),t.jsx("span",{children:o.text})]},o.key))}),e.text&&t.jsx(ut,{children:e.text}),e.attachments.length>0&&t.jsx(hl,{attachments:e.attachments})]})},xl=({updates:e,nowMs:s})=>{const r=L(),a=Co(e.length),o=Oo(e,r,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:n("ui.projects.project_updates.updates")}),a&&t.jsx("span",{className:"text-meta text-ink-muted",children:a})]}),e.length===0?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_updates.no_updates_yet_progress_reported_by_you_or_by_the_sessions_workin")}):t.jsx("div",{className:"flex flex-col gap-4",children:o.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,c)=>t.jsx(gl,{update:l,nowMs:s},`${l.at}:${l.by}:${c}`))})]},i.key||"ungrouped"))})]})},bl="project_not_found",yl=({projectKey:e,nowMs:s})=>{L();const r=Dt(),a=Je(),o=wr(he(a.data,"team_catalogue")),i=Ar(e,!0),l=Or(),c=Pr(),u=so(),m=ro(),p=eo(),f=to(),[b,_]=d.useState(!1),[x,v]=d.useState(!1),g=l.isPending||c.isPending||u.isPending||m.isPending||p.isPending||f.isPending;if(i.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Se,{label:n("ui.projects.project_detail.loading_project")})});if(i.isError||!i.data){const j=i.error instanceof Rt&&(i.error.code===bl||i.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(Kt,{variant:"danger",className:"w-full",children:j?n("ui.projects.project_detail.this_project_could_not_be_found_it_may_have_been_deleted"):i.error instanceof Error&&i.error.message?i.error.message:n("ui.projects.project_detail.the_project_could_not_be_read")}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{variant:"secondary",onClick:()=>void i.refetch(),children:n("ui.projects.project_detail.try_again")}),t.jsxs(z,{variant:"secondary",onClick:()=>void r("/projects"),children:[t.jsx(qs,{}),n("ui.projects.project_detail.all_projects")]})]})]})}const{project:h,links:y}=i.data,T=X(h),w=(j,O)=>l.mutateAsync({key:h.id,fields:j,...O?.forceDone===!0?{forceDone:!0}:{}}),U=h.team?o(h.team):null,C=Mo(h.milestones.filter(j=>j.completed_at!==null).length,h.milestones.length),E=async(j,O,R,I)=>{const Y=kt.getState(),q=ca(null,j,Y.drafts);if(!q)return!1;try{const{images:G,unreadable:W,overflow:J}=await la(I,O),de=ua(W);if(de)return le(de),!1;const Z=da(J);if(Z)return le(Z),!1;const ee=pa(O,G);if(ee)return le(ee),!1;if(await ma(q,{text:O,attachments:I,images:G,mode:R,cwd:Y.cwd},j)===null)return le(n("ui.projects.project_detail.that_session_already_has_a_message_going_out_try_again_in_a_momen")),!1;const N=y.find(D=>D.session_id===j);return je(n("ui.projects.project_detail.sent_to_value1",{value1:String(N?Lt(N):j)})),!0}catch(G){return le(G instanceof Error&&G.message?G.message:n("ui.projects.project_detail.the_message_was_not_sent")),!1}},P=async j=>{const O=kt.getState(),R=j.kind==="plain"?void 0:{kind:j.kind,name:j.name},I=await O.createSession(O.cwd||"~",R);if(!I)throw new Error(O.error??n("ui.projects.project_detail.the_session_could_not_be_started"));_a.getState().setCurrentInput(I,Fo(h));let Y=null;try{await p.mutateAsync({key:h.id,sessionId:I})}catch(q){Y=q instanceof Error&&q.message?q.message:n("ui.projects.project_detail.the_link_was_refused")}if(Y)le(n("ui.projects.project_detail.session_started_but_linking_it_failed_linkfailure",{linkFailure:String(Y)}));else{const q=R?n("ui.projects.project_detail.with_value1",{value1:String(qo(R))}):"";je(n("ui.projects.project_detail.session_started_withtarget_and_linked_to_displayname",{withTarget:String(q),displayName:String(T)}))}await Rr(r,I)};return t.jsx(gc,{children: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 r("/projects"),className:"flex w-fit items-center gap-1.5 text-body-sm text-ink-muted hover:text-ink",children:[t.jsx(qs,{className:"size-4"}),n("ui.projects.project_detail.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-1 flex-wrap items-start gap-x-3 gap-y-2",children:[t.jsx(Wc,{project:h,commit:w}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[t.jsx(Vc,{project:h,commit:w}),h.progress_stale&&t.jsx(xe,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(cl,{project:h}),t.jsxs(z,{variant:"secondary",onClick:()=>_(!0),"data-tour-tag":"project-delete",children:[t.jsx(ia,{}),n("ui.projects.project_detail.delete")]})]})]})]}),t.jsx(Qc,{project:h,commit:w}),t.jsx(il,{project:h,nowMs:s,commit:w,teamLabel:U}),h.updates.length===0&&h.progress&&t.jsxs("section",{className:"flex flex-col gap-2",children:[t.jsx("h2",{className:"text-title text-ink",children:n("ui.projects.project_detail.progress")}),t.jsx(ut,{className:"text-body",children:h.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:lo(h,s)})]}),t.jsx(al,{milestones:h.milestones,summary:C,busy:g,onToggle:(j,O)=>{u.mutateAsync({key:h.id,name:j,completed:O}).catch(R=>{le(R instanceof Error&&R.message?R.message:n("ui.projects.project_detail.the_milestone_was_not_updated"))})},onRemove:j=>{m.mutateAsync({key:h.id,name:j}).catch(O=>{le(O instanceof Error&&O.message?O.message:n("ui.projects.project_detail.the_milestone_was_not_removed"))})},onAdd:(j,O)=>{u.mutateAsync({key:h.id,name:j,targetDate:O}).catch(R=>{le(R instanceof Error&&R.message?R.message:n("ui.projects.project_detail.the_milestone_was_not_added"))})}}),t.jsx(nl,{projectKey:h.id,links:y,busy:g,onStartSession:()=>v(!0),onQuickSend:E,onLink:j=>{p.mutateAsync({key:h.id,sessionId:j}).catch(O=>{le(O instanceof Error&&O.message?O.message:n("ui.projects.project_detail.the_session_was_not_linked"))})},onUnlink:j=>{f.mutateAsync({key:h.id,sessionId:j}).catch(O=>{le(O instanceof Error&&O.message?O.message:n("ui.projects.project_detail.the_session_was_not_unlinked"))})}}),t.jsx(pl,{links:y}),t.jsx(xl,{updates:h.updates,nowMs:s}),t.jsx(pn,{open:b,projectName:h.name,onClose:()=>_(!1),onConfirm:async j=>{await c.mutateAsync({key:h.id,confirmedName:j}),je(n("ui.projects.project_detail.project_deleted")),r("/projects")}}),t.jsx(dl,{open:x,onClose:()=>v(!1),onStart:P,teamsEnabled:he(a.data,"team_catalogue"),profilesEnabled:he(a.data,"profile_catalogue")})]})})},vl="payments-migration",jr={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},kl=({open:e,onClose:s,onSubmit:r})=>{L();const[a,o]=d.useState(jr),[i,l]=d.useState({}),[c,u]=d.useState(null),m=d.useRef(null),[p,f]=d.useState(!1),[b,_]=d.useState(!1),[x,v]=d.useState(!1),g=d.useId(),h=d.useRef(null);d.useEffect(()=>{e&&(o({...jr,description:lr}),l({}),u(null),f(!1),_(!1),v(!1))},[e]),d.useEffect(()=>{c&&m.current?.scrollIntoView({block:"nearest"})},[c]);const y=(j,O)=>{o(R=>({...R,[j]:O}))},T=b?a.name:Cc(a.title),w=j=>_n(j,h,O=>y("description",O)),U=(j,O)=>{const R={},I=Wt(O);I&&(R.name=I);const Y=sn(j.description);Y&&(R.description=Y);const q=ns(j.tags).error;q&&(R.tags=q);const G=ss(j.startDate);G&&(R.startDate=G);const W=ss(j.targetDate);if(W)R.targetDate=W;else if(!G){const ee=rs(j.startDate,j.targetDate);ee&&(R.targetDate=ee)}if(j.estimate.trim()){const ee=rn(j.estimate);ee&&(R.estimate=ee)}const J=ts(j.title);J&&(R.title=J);const de=St(j.owner,"owner");de&&(R.owner=de);const Z=St(j.team,"team");return Z&&(R.team=Z),R},C=async()=>{const j=T.trim(),O=U(a,j);if(l(O),Object.keys(O).length>0)return;f(!0),u(null);const R=lt(a.tags);try{const I={};a.title.trim()&&(I.title=a.title.trim()),a.owner.trim()&&(I.owner=a.owner.trim()),a.team.trim()&&(I.team=a.team.trim()),a.startDate&&(I.start_date=a.startDate),a.targetDate&&(I.target_date=a.targetDate),a.estimate&&(I.estimate=Number(a.estimate),I.estimate_unit=a.estimateUnit),await r({fields:{name:j,...a.description.trim()&&a.description.trim()!==lr?{description:a.description.trim()}:{},status:a.status,...R.length>0?{tags:R}:{}},...Object.keys(I).length>0?{followUp:I}:{}}),s()}catch(I){const Y=I instanceof Error&&I.message?I.message:"";u(ft(Y)||n("ui.projects.project_form_dialog.the_project_was_not_saved"))}finally{f(!1)}},E=n("ui.projects.project_form_dialog.new_project"),P=a.description.length>Qe;return t.jsx(dt,{open:e,onClose:s,title:E,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:p,onEscapeKeyDown:j=>{p&&j.preventDefault()},onInteractOutside:j=>{p&&j.preventDefault()}},dataTourTag:"project-create-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Ye,{onClick:s,disabled:p,children:n("ui.projects.project_form_dialog.cancel")}),t.jsxs(vt,{"data-project-submit":"",onClick:()=>void C(),disabled:p,children:[p&&t.jsx(Se,{size:"xs"}),n("ui.projects.project_form_dialog.create_project")]})]}),children:t.jsxs("form",{className:"flex flex-col gap-6 px-1 py-1",onSubmit:j=>{j.preventDefault(),C()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-title`,children:n("ui.projects.project_form_dialog.title")}),t.jsx(oe,{id:`${g}-title`,"data-project-title":"",value:a.title,onChange:j=>y("title",j.target.value),placeholder:n("ui.projects.project_form_dialog.payments_migration"),autoFocus:!0,className:"h-10 text-heading","aria-invalid":!!i.title}),i.title&&t.jsx("p",{className:"text-meta text-danger",children:i.title}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ue,{htmlFor:`${g}-key`,className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.key")}),t.jsx(oe,{id:`${g}-key`,"data-project-key":"",value:T,onChange:j=>{_(!0),y("name",j.target.value)},placeholder:vl,"aria-invalid":!!i.name,className:"h-7 max-w-56 font-mono text-mono-sm"}),t.jsx("span",{className:"text-meta text-ink-muted",children:b?n("ui.projects.project_form_dialog.letters_digits_dot_underscore_or_dash_no_spaces"):n("ui.projects.project_form_dialog.derived_from_the_title_until_you_edit_it")})]}),i.name&&t.jsx("p",{className:"text-meta text-danger",children:i.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(ue,{htmlFor:`${g}-description`,children:n("ui.projects.project_form_dialog.description")}),t.jsxs("fieldset",{className:"m-0 w-fit border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_form_dialog.description_mode")}),t.jsx("div",{className:"flex gap-0.5 rounded-md bg-sunken p-0.5",children:["write","preview"].map(j=>t.jsx("button",{type:"button","data-project-description-mode":j,"aria-pressed":x===(j==="preview"),onClick:()=>v(j==="preview"),className:M("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",x===(j==="preview")&&"bg-surface text-ink"),children:j==="write"?n("ui.projects.project_form_dialog.write"):n("ui.projects.project_form_dialog.preview")},j))})]})]}),x?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:a.description.trim()?t.jsx(ut,{className:"text-body-sm",children:a.description}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_form_dialog.nothing_to_preview_yet")})}):t.jsx(Sr,{ref:h,id:`${g}-description`,"data-project-description":"",value:a.description,onChange:j=>y("description",j.target.value),onPaste:w,rows:8,placeholder:n("ui.projects.project_form_dialog.markdown_headings_lists_code"),"aria-invalid":P||!!i.description,className:"h-44 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.description?t.jsx("p",{className:"text-meta text-danger",children:i.description}):t.jsx("span",{}),t.jsxs("p",{className:M("text-meta tabular-nums",P?"text-danger":"text-ink-muted"),children:[a.description.length,"/",Qe]})]})]}),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(ue,{children:n("ui.projects.project_form_dialog.status")}),t.jsxs(He,{value:a.status,onValueChange:j=>y("status",j),children:[t.jsx(Ke,{"aria-label":n("ui.projects.project_form_dialog.status"),children:t.jsx(We,{})}),t.jsx(Ve,{children:Ir.map(j=>t.jsx(Re,{value:j.value,children:j.label},j.value))})]}),a.status==="done"&&t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.moving_a_project_to_done_stamps_today_as_its_completion_date")})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-owner`,children:n("ui.projects.project_form_dialog.owner")}),t.jsx(oe,{id:`${g}-owner`,"data-project-owner":"",value:a.owner,onChange:j=>y("owner",j.target.value),placeholder:n("ui.projects.examples.owner"),"aria-invalid":!!i.owner}),i.owner&&t.jsx("p",{className:"text-meta text-danger",children:i.owner})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-team`,children:n("ui.projects.project_form_dialog.team")}),t.jsx(oe,{id:`${g}-team`,value:a.team,onChange:j=>y("team",j.target.value),placeholder:n("ui.projects.examples.team"),"aria-invalid":!!i.team}),i.team&&t.jsx("p",{className:"text-meta text-danger",children:i.team})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-target`,children:n("ui.projects.project_form_dialog.target_date")}),t.jsx(oe,{id:`${g}-target`,"data-project-target":"",value:a.targetDate,onChange:j=>y("targetDate",j.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!i.targetDate}),i.targetDate&&t.jsx("p",{className:"text-meta text-danger",children:i.targetDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-start`,children:n("ui.projects.project_form_dialog.start_date")}),t.jsx(oe,{id:`${g}-start`,value:a.startDate,onChange:j=>y("startDate",j.target.value),placeholder:"YYYY-MM-DD","aria-invalid":!!i.startDate}),i.startDate&&t.jsx("p",{className:"text-meta text-danger",children:i.startDate})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-estimate`,children:n("ui.projects.project_form_dialog.estimate")}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(oe,{id:`${g}-estimate`,value:a.estimate,onChange:j=>y("estimate",j.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!i.estimate,className:"max-w-28"}),t.jsxs(He,{value:a.estimateUnit,onValueChange:j=>y("estimateUnit",j),children:[t.jsx(Ke,{"aria-label":n("ui.projects.project_form_dialog.estimate_unit"),className:"max-w-32",children:t.jsx(We,{})}),t.jsxs(Ve,{children:[t.jsx(Re,{value:"points",children:n("ui.projects.project_form_dialog.points")}),t.jsx(Re,{value:"days",children:n("ui.projects.project_form_dialog.days")})]})]})]}),i.estimate&&t.jsx("p",{className:"text-meta text-danger",children:i.estimate})]}),t.jsxs("div",{className:"col-span-2 flex flex-col gap-1.5",children:[t.jsx(ue,{htmlFor:`${g}-tags`,children:n("ui.projects.project_form_dialog.tags")}),t.jsx(oe,{id:`${g}-tags`,value:a.tags,onChange:j=>y("tags",j.target.value),placeholder:n("ui.projects.project_form_dialog.q4_payments"),"aria-invalid":!!i.tags}),i.tags?t.jsx("p",{className:"text-meta text-danger",children:i.tags}):t.jsx("p",{className:"text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.comma_separated_up_to_8_lowercase_letters_digits_underscore_or_da")})]})]}),c&&t.jsx("p",{ref:m,className:"text-body-sm text-danger",children:c})]})})},yn=({children:e})=>{const s=d.useRef(null),[r,a]=d.useState(!1),o=()=>{const i=s.current;i&&a(i.scrollTop+i.clientHeight<i.scrollHeight-1)};return d.useEffect(o),t.jsx("div",{ref:s,onScroll:o,className:M("max-h-[min(70vh,32rem)] overflow-y-auto overscroll-contain",r&&"[mask-image:linear-gradient(to_bottom,black_calc(100%-12px),transparent)]"),children:e})},wl=({label:e,count:s,selected:r,onToggle:a})=>{const o=d.useId();return t.jsxs("div",{className:"flex items-center gap-2 rounded-sm px-1 py-1 hover:bg-sunken",children:[t.jsx(Er,{id:o,checked:r,onCheckedChange:()=>a()}),t.jsx(ue,{htmlFor:o,className:"min-w-0 flex-1 cursor-pointer truncate font-normal text-body-sm text-ink",children:e}),t.jsx("span",{className:"text-meta text-ink-dim tabular-nums",children:s})]})},Nl=({column:e,spec:s,onChange:r})=>{L();const a=d.useId(),o=s!==null&&s.key===e,i=o?s.direction:Bt(e),l=i==="asc"?"desc":"asc",c=()=>r({key:e,direction:o?l:Bt(e)}),u=s===null?"default":o?"sorted":"other";return t.jsxs("fieldset",{className:"m-0 flex flex-col gap-0.5 border-0 p-0",children:[t.jsx("legend",{className:"sr-only",children:n("ui.projects.project_filters_panel.sort_by_sortcolumnlabel_column",{sortColumnLabel_column:String(Xe(e))})}),t.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-body-sm hover:bg-sunken",children:[t.jsx("input",{type:"radio",name:a,checked:u==="default",onChange:()=>r(null),className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:M("min-w-0 flex-1 truncate",u==="default"?"text-ink":"text-ink-muted"),children:n("ui.projects.project_sort.default_as_listed")})]}),t.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-body-sm hover:bg-sunken",children:[t.jsx("input",{type:"radio",name:a,checked:u==="sorted",onChange:c,onClick:()=>{u==="sorted"&&c()},onKeyDown:m=>{u==="sorted"&&(m.key!==" "&&m.key!=="Enter"||(m.preventDefault(),c()))},className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:M("min-w-0 flex-1 truncate",u==="sorted"?"text-ink":"text-ink-muted"),children:n("ui.projects.project_filters_panel.sort_by_sortcolumnlabel_column_value2",{sortColumnLabel_column:String(Xe(e)),value2:String(ks(e,o?i:Bt(e)))})})]})]})},Sl=({facet:e,options:s,onToggle:r})=>(L(),t.jsxs("div",{className:"flex flex-col gap-0.5 border-b border-hairline px-3 py-2 last:border-b-0",children:[t.jsx("span",{className:"px-1 text-meta text-ink-muted",children:ot[e]}),s.map(a=>t.jsx(wl,{label:a.label,count:a.count,selected:a.selected,onToggle:()=>r(e,a.value)},`${e}:${a.value??"none"}`))]})),vn=({projects:e,state:s,query:r,todayMs:a,onToggle:o,onClearAll:i,scope:l,sort:c})=>{L();const u=l===void 0?fi(e,s,a):l===null?[]:[tn(l,e,s,a)],m=!ct(s)||r.trim()!=="";return t.jsxs("div",{className:"flex flex-col",children:[l===void 0&&t.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-hairline px-3 py-2",children:[t.jsx("span",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_filters_panel.filters")}),m&&t.jsx(z,{variant:"link",size:"sm",onClick:i,children:n("ui.projects.project_filters_panel.clear_all")})]}),c&&t.jsxs("div",{className:"flex flex-col gap-0.5 border-b border-hairline px-3 py-2",children:[t.jsx("span",{className:"px-1 text-meta text-ink-muted",children:n("ui.projects.project_filters_panel.sort_by_key",{key:String(Xe(c.key))})}),t.jsx(Nl,{column:c.key,spec:c.spec,onChange:c.onChange})]}),u.map(p=>t.jsx(Sl,{facet:p.facet,options:p.options,onToggle:o},p.facet))]})},Cl=({team:e,count:s,headingId:r,className:a,...o})=>(L(),t.jsxs("div",{...o,"data-glass-well":"",className:M("flex h-8 cursor-default items-center gap-2 bg-surface px-3 text-meta",a),children:[t.jsx("h3",{id:r,className:"truncate text-ink",children:e??n("ui.projects.project_model.no_team")}),t.jsx("span",{className:"shrink-0 text-ink-muted","aria-label":po(s),children:s})]})),we=[{key:"name",get label(){return n("ui.projects.project_list.project")},className:"min-w-0 flex-1",sort:"name",facet:null},{key:"status",get label(){return n("ui.projects.project_list.status")},className:"w-20 shrink-0",sort:"status",facet:"status"},{key:"target",get label(){return n("ui.projects.project_list.target")},className:"hidden w-32 shrink-0 @[40rem]:block",sort:"target",facet:"target"},{key:"estimate",get label(){return n("ui.projects.project_list.estimate")},className:"hidden w-16 shrink-0 @[40rem]:block",sort:"estimate",facet:"estimate"},{key:"milestones",get label(){return n("ui.projects.project_list.milestones")},className:"hidden w-20 shrink-0 @[34rem]:block",sort:"milestones",facet:"milestones"},{key:"live",get label(){return n("ui.projects.project_list.live")},className:"hidden w-14 shrink-0 @[34rem]:block",sort:"live",facet:"live"},{key:"progress",get label(){return n("ui.projects.project_list.progress")},className:"w-40 shrink-0",sort:"progress",facet:"progress"}];function El(e,s){const r=pt(e.progress_updated_at,s);return r?mt(r):n("ui.projects.project_list.not_reported")}const Tl=({direction:e})=>e==="asc"?t.jsx(Dr,{size:10,className:"shrink-0","aria-hidden":"true"}):t.jsx(Nr,{size:10,className:"shrink-0","aria-hidden":"true"}),Rl=({projects:e,nowMs:s,onOpen:r,sort:a,onSortChange:o,searchPopulation:i,filters:l,query:c,todayMs:u,onToggleFilter:m,onClearFilters:p,teamLabelFor:f=b=>b})=>{const b=L(),_=a?wi(e,a):e,x=bs(_,_t),v=d.useId(),g=C=>`${v}-team-${C}`,[h,y]=d.useState(0),T=d.useRef([]),w=(C,E)=>{const P=we.length;for(let j=1;j<=P;j+=1){const O=(C+E*j+P*P)%P,R=T.current[O];if(R&&R.offsetParent!==null){y(O),R.focus();return}}},U=C=>E=>{E.key!=="ArrowLeft"&&E.key!=="ArrowRight"||(E.preventDefault(),w(C,E.key==="ArrowRight"?1:-1))};return t.jsxs("div",{className:"@container flex min-h-0 flex-1 flex-col","data-testid":"project-list",children:[t.jsx("table",{className:"block shrink-0","aria-label":n("ui.projects.project_list.project_columns"),children:t.jsx("thead",{className:"block",children:t.jsx("tr",{className:"flex items-center gap-3 px-9 py-2 text-meta text-ink-muted",children:we.map((C,E)=>{const P=a!==null&&a.key===C.sort;return t.jsx("th",{scope:"col","aria-sort":P?a.direction==="desc"?"descending":"ascending":"none",className:M(C.className,"p-0 text-left font-normal"),children:t.jsxs(fs,{children:[t.jsx(js,{asChild:!0,children:t.jsxs("button",{type:"button",ref:j=>{T.current[E]=j},tabIndex:E===h?0:-1,"data-project-column":C.key,onFocus:()=>y(E),onKeyDown:U(E),className:M("group flex w-full min-w-0 items-center gap-1 rounded-xs text-left","transition-colors duration-fast ease-out-quart",P?"text-ink":"hover:text-ink"),children:[t.jsx("span",{className:"truncate",children:C.label}),P?t.jsx(Tl,{direction:a.direction}):t.jsx(fa,{size:10,className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink","aria-hidden":"true"})]})}),t.jsx(hs,{align:"start","aria-label":n("ui.projects.project_list.label_column",{label:String(C.label)}),className:"w-72 p-0",children:t.jsx(yn,{children:t.jsx(vn,{projects:i,state:l,query:c,todayMs:u,onToggle:m,onClearAll:p,scope:C.facet,sort:{key:C.sort,spec:a,onChange:o}})})})]})},C.key)})})})}),t.jsx("ul",{className:"min-h-0 flex-1 overflow-y-auto px-6",children:x.map((C,E)=>t.jsxs("li",{children:[t.jsx(Cl,{team:C.team==null?null:f(C.team),count:C.items.length,headingId:g(E),className:"sticky top-0 z-10","data-project-team":C.team??""}),t.jsx("ul",{"aria-labelledby":g(E),className:"divide-y divide-hairline",children:C.items.map(P=>{const j=new Map(Br(P,b).map(I=>[I.key,I.text])),O=Ur(P.milestones_completed,P.milestones_total),R=xs(P.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>r(P),"data-project-name":P.name,className:M("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-row-hover"),children:[t.jsx("span",{className:M(we[0].className,"truncate text-body-sm text-ink"),children:X(P)}),t.jsx("span",{className:we[1].className,children:t.jsx(jn,{status:P.status})}),t.jsx("span",{className:M(we[2].className,"truncate text-meta text-ink-muted"),children:j.get("target")??j.get("completed")??""}),t.jsx("span",{className:M(we[3].className,"truncate text-meta text-ink-muted"),children:j.get("estimate")??""}),t.jsx("span",{className:M(we[4].className,"truncate text-meta text-ink-muted"),children:O}),t.jsx("span",{className:M(we[5].className,"truncate text-meta text-ink-muted"),children:R}),t.jsxs("span",{className:M(we[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:El(P,s)}),P.progress_stale&&t.jsx(xe,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]})},P.id)})})]},C.team??""))})]})},Tt=224,hr=36,Dl={get day(){return n("ui.projects.project_timeline.days")},get week(){return n("ui.projects.project_timeline.weeks")},get month(){return n("ui.projects.project_timeline.months")},get quarter(){return n("ui.projects.project_timeline.quarters")}},Al=({items:e,nowMs:s,onOpen:r,pendingDetails:a,failedDetails:o,onRetryDetails:i,teamLabelFor:l=c=>c})=>{L();const[c,u]=d.useState(null),[m,p]=d.useState(0),f=d.useRef(null),b=Ns(s),_=d.useMemo(()=>Ci(e,b),[e,b]),x=d.useMemo(()=>Ei(e),[e]),v=d.useMemo(()=>bs(x.dated,C=>_t(C.project)),[x]);d.useLayoutEffect(()=>{const C=f.current;if(!C)return;const E=()=>p(C.clientWidth);if(E(),typeof ResizeObserver>"u")return;const P=new ResizeObserver(E);return P.observe(C),()=>P.disconnect()},[]);const g=Math.max(m-Tt-24,160),h=_?Ni(Js(_.startMs,_.endMs),g):"month",y=c??h,T=C=>{const E=Te.indexOf(y),P=Te[E-C];P&&u(P)},w=ws[y],U=_?Js(_.startMs,_.endMs)*w:0;return t.jsxs("div",{ref:f,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:o>0?n("ui.projects.timeline.read_failed",{count:o}):n("ui.projects.project_timeline.length_dated_length_2_without_dates_value3",{length:V(x.dated.length,{useGrouping:!1}),length_2:V(x.undated.length,{useGrouping:!1}),value3:String(a>0?n("ui.projects.project_timeline.loading_milestones_for_pendingdetails",{pendingDetails:V(a,{useGrouping:!1})}):"")})}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[o>0&&t.jsx(z,{variant:"secondary",size:"sm",onClick:i,children:n("ui.projects.project_timeline.try_again")}),t.jsx(z,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_in"),title:n("ui.projects.project_timeline.zoom_in_finer"),disabled:!_||y===Te[0],onClick:()=>T(1),children:t.jsx(it,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Dl[y]}),t.jsx(z,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_out"),title:n("ui.projects.project_timeline.zoom_out_coarser"),disabled:!_||y===Te[Te.length-1],onClick:()=>T(-1),children:t.jsx(Ca,{})})]})]}),_&&x.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(Ol,{startMs:_.startMs,endMs:_.endMs,tier:y,pxPerDay:w,trackPx:U}),v.map(C=>t.jsxs("div",{children:[t.jsx("div",{className:"sticky top-0 z-20 flex items-stretch bg-canvas","data-project-team":C.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:Tt},children:[t.jsx("span",{className:"truncate text-ink",children:C.team==null?n("ui.projects.project_model.no_team"):l(C.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:C.items.length})]})}),C.items.map(E=>t.jsx(Pl,{item:E,spanStart:_.startMs,pxPerDay:w,trackPx:U,today:b,onOpen:()=>r(E)},E.project.id))]},C.team??""))]})}):null,x.undated.length>0&&t.jsx("div",{className:"shrink-0 px-9 py-2","data-project-undated-callout":"",children:t.jsxs(vr,{defaultOpen:x.dated.length===0,triggerClassName:"text-ink hover:bg-row-hover hover:text-ink",chevronClassName:"text-ink-dim",rowClassName:"min-h-8 py-0",summary:t.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-meta",children:[t.jsx(Ga,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"truncate text-ink",children:Ti(x.undated.length)})]}),children:[x.dated.length===0&&t.jsx("p",{className:"pb-1 text-meta text-ink-muted",children:n("ui.projects.project_timeline.set_a_start_date_a_target_date_or_a_milestone_date_and_it_will_ap")}),t.jsx("ul",{className:"flex max-h-24 flex-wrap gap-x-3 gap-y-1 overflow-y-auto",children:x.undated.map(C=>t.jsx("li",{children:t.jsx("button",{type:"button",className:"rounded-sm text-meta text-ink hover:bg-row-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",onClick:()=>r(C),children:X(C.project)})},C.project.id))})]})})]})},Ol=({startMs:e,endMs:s,tier:r,pxPerDay:a,trackPx:o})=>{const i=Fi(e,s,r);return t.jsxs("div",{className:"flex items-stretch",children:[t.jsx("span",{className:"sticky left-0 z-10 shrink-0 bg-canvas",style:{width:Tt}}),t.jsx("span",{className:"relative block h-6",style:{width:o},children:i.map(l=>t.jsxs("span",{className:"absolute top-0 h-full",style:{left:Me(e,l.dayMs)*a},children:[t.jsx("span",{className:M("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))})]})},Pl=({item:e,spanStart:s,pxPerDay:r,trackPx:a,today:o,onOpen:i})=>{const{project:l}=e,c=Ri(e),u=Di(e),m=p=>new Date(p).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-row-hover",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:Tt,height:hr},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:X(l)})}),t.jsxs("span",{className:"relative block",style:{width:a,height:hr},children:[c&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:Me(s,c.fromMs)*r,width:(Me(c.fromMs,c.toMs)+1)*r},title:`${De(m(c.fromMs))} → ${De(m(c.toMs))}`}),u.map(p=>t.jsx("span",{"data-milestone":p.status,className:M("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",p.status==="completed"&&"bg-success",p.status==="overdue"&&"bg-warning",p.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:Me(s,p.dayMs)*r},title:`${p.name} · ${p.status} · ${De(m(p.dayMs))}`},`${p.name}-${p.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:Me(s,o)*r},"aria-hidden":"true"})]})]})},Ml=({projects:e,query:s,onQueryChange:r,filters:a,onFiltersChange:o,onClearAll:i,todayMs:l,resultText:c,countRevealClass:u="@[37rem]:inline",trailing:m,disabled:p=!1,searchFieldRef:f})=>{L();const[b,_]=d.useState(!1),x=d.useRef(!1),v=di(a),g=Tr(c??"",300),h=s.trim()!==""||!ct(a);return t.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-3",children:[t.jsxs("div",{className:"relative w-full min-w-0 max-w-[400px]",children:[t.jsx(ja,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim","aria-hidden":"true"}),t.jsx(oe,{ref:f,inputSize:"sm",value:s,onChange:y=>r(y.target.value),onKeyDown:y=>{y.key==="Escape"&&(s?r(""):y.currentTarget.blur())},placeholder:n("ui.projects.projects_toolbar.search_projects"),"aria-label":n("ui.projects.projects_toolbar.search_projects"),autoComplete:"off",spellCheck:!1,className:"pl-9"}),s?t.jsx(z,{variant:"ghost",size:"icon-sm",className:"absolute top-1/2 right-1 -translate-y-1/2",onClick:()=>ha(f.current,r),"aria-label":n("ui.projects.projects_toolbar.clear_search"),children:t.jsx(Pt,{"aria-hidden":"true"})}):t.jsx("span",{className:"pointer-events-none absolute top-1/2 right-2 -translate-y-1/2 text-ink-dim",children:t.jsx(ga,{shortcut:"/"})})]}),t.jsxs(fs,{open:b,onOpenChange:_,children:[t.jsx(js,{asChild:!0,children:t.jsxs(z,{variant:"secondary",size:"sm",disabled:p,"data-project-filters-button":"",children:[t.jsx(Ha,{size:14,"aria-hidden":"true"}),n("ui.projects.projects_toolbar.filters"),v>0&&t.jsx(xe,{variant:"neutral",children:v})]})}),t.jsx(hs,{align:"end","aria-label":n("ui.projects.projects_toolbar.filters"),className:"w-80 p-0",onCloseAutoFocus:y=>{x.current&&(x.current=!1,y.preventDefault())},children:t.jsx(yn,{children:t.jsx(vn,{projects:e,state:a,query:s,todayMs:l,onToggle:(y,T)=>o(Jr(a,y,T)),onClearAll:()=>{i(),x.current=!0,_(!1),f.current?.focus()}})})})]}),h&&c!==null&&t.jsx("span",{className:M("hidden whitespace-nowrap text-meta text-ink-dim",u),"data-project-count":"",children:c}),t.jsx("output",{className:"sr-only","aria-live":"polite",children:g}),m]})},Il=({filters:e,sort:s,onFiltersChange:r,onSortChange:a,onClearAll:o,hideClearAll:i=!1,searchFieldRef:l})=>{L();const[c,u]=d.useState(null);d.useEffect(()=>{if(!c)return;let f=null;c.kind==="search"?f=l.current:(f=document.querySelector(`[data-project-chip="${c.index}"]`),f||(f=document.querySelector("[data-project-chip]")),f||(f=document.querySelector("[data-project-filters-button]"))),f&&(f.focus(),u(null))});const m=[];for(const f of Ze){const b=e[f];if(b.length===0)continue;const _=b.map(g=>Xr(f,g)),x=_[0],v=_.length>1?n("ui.projects.projects_toolbar.facet_labels_facet_first_length_1",{FACET_LABELS_facet:String(ot[f]),first:String(x),length___1:V(_.length-1,{useGrouping:!1})}):n("ui.projects.projects_toolbar.facet_labels_facet_first",{FACET_LABELS_facet:String(ot[f]),first:String(x)});m.push({kind:"facet",facet:f,label:v,ariaLabel:n("ui.projects.projects_toolbar.remove_filter_facet_labels_facet_join",{FACET_LABELS_facet:String(ot[f]),join:String(_.join(", "))}),clear:()=>r({...e,[f]:[]})})}if(s&&m.push({kind:"sort",spec:s,label:n("ui.projects.projects_toolbar.sort_key",{key:String(Xe(s.key))}),ariaLabel:n("ui.projects.projects_toolbar.remove_sort_key_direction",{key:String(Xe(s.key)),direction:String(ks(s.key,s.direction))}),clear:()=>a(null)}),m.length===0)return null;const p=(f,b)=>{b.clear();const _=m.length-1;u(_===0?{kind:"chip",index:0}:{kind:"chip",index:Math.min(f,_-1)})};return t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[m.map((f,b)=>t.jsx(xe,{asChild:!0,variant:"neutral",className:"gap-1 pr-1 text-ink",children:t.jsxs("button",{type:"button",className:"group","data-project-chip":b,"aria-label":f.ariaLabel,onClick:()=>p(b,f),children:[f.kind==="sort"&&(f.spec.direction==="asc"?t.jsx(Dr,{size:10,className:"text-ink-muted","aria-hidden":"true"}):t.jsx(Nr,{size:10,className:"text-ink-muted","aria-hidden":"true"})),t.jsx("span",{className:"truncate",children:f.label}),t.jsx(Pt,{className:M("text-ink-dim transition-colors duration-fast ease-out-quart","group-hover:text-danger"),"aria-hidden":"true"})]})},f.kind==="facet"?f.facet:"sort")),!i&&t.jsx(z,{variant:"link",size:"sm",onClick:()=>{o(),u({kind:"search"})},children:n("ui.projects.projects_toolbar.clear_all")})]})},kn="projects-view",Ll=[{value:"list",get label(){return n("ui.projects.projects_view_switcher.list")}},{value:"board",get label(){return n("ui.projects.projects_view_switcher.board")}},{value:"timeline",get label(){return n("ui.projects.projects_view_switcher.timeline")}}];function Fl(){try{const e=localStorage.getItem(kn);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"board"}function ql(e){try{localStorage.setItem(kn,e)}catch{}}const Ul=({value:e,onChange:s})=>(L(),t.jsx(Ea,{value:e,onValueChange:r=>s(r),children:t.jsx(Ta,{"aria-label":n("ui.projects.projects_view_switcher.project_view"),"data-tour-tag":"projects-view-switcher",children:Ll.map(r=>t.jsx(Ra,{value:r.value,children:r.label},r.value))})})),Bl=["r1","r2","r3","r4","r5","r6"],$l=4e3,gr={get unpaired(){return n("ui.projects.projects_page.this_app_is_not_paired_with_the_local_operator_server_so_projects")},get"below-version"(){return n("ui.projects.projects_page.the_local_operator_server_is_older_than_this_app_expects_so_proje")},get unknown(){return n("ui.projects.projects_page.the_server_s_capabilities_could_not_be_read_so_projects_are_unava")}},Jl=({nowMs:e=Date.now()})=>{L();const{projectId:s}=xa(),r=Dt(),a=Je(),o=ba(a.data,"projects",1),i=o==="enabled",l=he(a.data,"projects",Ko),c=wr(he(a.data,"team_catalogue")),u=Xa(i),m=Za(),p=Or(),f=Pr(),[b,_]=d.useState(!1),[x,v]=d.useState(()=>Fl()),[g,h]=d.useState(()=>yo()),[y,T]=d.useState(null),[w,U]=d.useState(""),[C,E]=d.useState(Ws),[P,j]=d.useState(()=>gi()),[O,R]=d.useState(""),I=d.useRef(""),Y=d.useRef(null),q=d.useRef(null),G=S=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),S!==""&&S===I.current?(R(""),Y.current=window.requestAnimationFrame(()=>{Y.current=null,R(S)})):R(S),I.current=S,q.current!==null&&window.clearTimeout(q.current),q.current=window.setTimeout(()=>{q.current=null,I.current="",R("")},$l)},W=()=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),q.current!==null&&(window.clearTimeout(q.current),q.current=null),I.current="",R("")},J=S=>{U(S),W()},de=S=>{E(S),W()},Z=d.useRef(null),ee=nc(),k=u.data??[],N=Ns(e),D=oi(w,i&&l),F=Qr(w),B=d.useMemo(()=>D.answer?ni(k,D.answer.projects):null,[k,D.answer]),$=F!=="",ie=d.useMemo(()=>$?B??ri(k,F):k,[k,F,$,B]),Ae=B===null?"client":"backend",H=d.useMemo(()=>pi(ie,C,N),[ie,C,N]),Ce=l&&$&&D.pending,be=$||!ct(C),fe=d.useMemo(()=>$s(k,g,e),[k,g,e]),te=d.useMemo(()=>$s(H,g,e),[H,g,e]),Oe=bo(g),ce=x==="board"?te.length:H.length,tt=!be||!u.isSuccess?null:x==="board"?n("ui.projects.projects_page.length_of_length_2_in_window",{length:V(te.length,{useGrouping:!1}),length_2:V(fe.length,{useGrouping:!1})}):n("ui.projects.projects_page.length_of_length_2_projects",{length:V(H.length,{useGrouping:!1}),length_2:k.length}),re=u.isSuccess&&k.length>0,Ee=re&&be&&ce===0&&!Ce,Ue=Ce&&ce===0&&re,[qt,st]=d.useState(!1);d.useEffect(()=>{if(!qt)return;const S=document.querySelector('[data-tour-tag="projects-board-window"]');S&&(S.focus(),st(!1))}),d.useEffect(()=>{if(!i||s)return;const S=K=>{const Q=K.target;if(!Q||Q.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(Q.tagName)||Q.closest('[role="dialog"]'))return;const ke=K.key==="/"&&!K.metaKey&&!K.ctrlKey&&!K.altKey,ae=(K.metaKey||K.ctrlKey)&&K.key.toLowerCase()==="f";!ke&&!ae||(K.preventDefault(),Z.current?.focus())};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[i,s]);const rt=d.useRef(null);d.useLayoutEffect(()=>{if(!s)return;const S=rt.current;S!==null&&(S.scrollTop=0)},[s]);const ht=Ja(x==="timeline"?k.map(S=>S.id):[],i),A=new Map(k.map((S,K)=>[S.id,ht[K]])),ne=H.map(S=>({project:S,milestones:A.get(S.id)?.data?.project.milestones??[]})),nt=x==="timeline"?H.filter(S=>A.get(S.id)?.isLoading).length:0,ye=x==="timeline"?H.filter(S=>A.get(S.id)?.isError).length:0,gt=()=>{for(const S of ht)S.isError&&S.refetch()},Be=S=>{j(S),xi(S),G(bi(S))},wn=(S,K)=>{E(Q=>Jr(Q,S,K)),W()},xt=()=>{const S=w.trim()!=="",K=!ct(C),Q=P!==null;U(""),E(Ws),P!==null&&Be(null),G(yi({search:S,filters:K,sort:Q}))},Es=()=>{h("all"),zs("all"),st(!0)},[ve,Ts]=d.useState(null),Ut=d.useRef(!1),Rs=()=>{Ut.current=!1,Ts(null)},[Nn,Ds]=d.useState([]),Sn=he(a.data,"projects_force_done"),Cn=(S,K)=>{const Q=S.id,ke=se(K).label;Ds(ae=>ae.includes(Q)?ae:[...ae,Q]),zi({move:()=>p.mutateAsync({key:Q,fields:{status:K}}),forceDoneOffered:Sn,claimQuestion:()=>Ut.current?!1:(Ut.current=!0,!0)}).then(ae=>{if(ae.kind==="accepted"){je(n("ui.projects.projects_page.moved_to_label",{label:String(ke)})),u.refetch().then(()=>ee(Q));return}if(ae.kind==="question"){Ts({project:S,status:K,refusal:ae.refusal});return}le(ae.copy,ae.refusal?{action:{get label(){return n("ui.projects.projects_page.view_project")},onClick:()=>void r(`/projects/${Q}`)}}:void 0),ee(Q)}).finally(()=>{Ds(ae=>ae.filter(En=>En!==Q))})};return i?s?t.jsx("div",{ref:rt,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(yl,{projectKey:s,nowMs:e})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("div",{className:"@container flex shrink-0 flex-col gap-8 px-6 pt-6",children:[t.jsx(Fs,{title:n("ui.projects.projects_page.projects"),icon:Us,subtitle:n("ui.projects.projects_page.workstreams_you_and_your_agents_track_across_sessions"),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{variant:"secondary",size:"icon","aria-label":n("ui.projects.projects_page.refresh_projects"),title:n("ui.projects.projects_page.refresh_projects"),disabled:u.isFetching,onClick:()=>void u.refetch(),"data-tour-tag":"refresh-projects-button",children:t.jsx(Ma,{})}),t.jsxs(z,{variant:"secondary",onClick:()=>_(!0),"data-tour-tag":"create-project-button",children:[t.jsx(it,{}),n("ui.projects.projects_page.new_project")]})]})}),t.jsxs("div",{className:"flex shrink-0 flex-col gap-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-3","data-project-search-row":"",children:[t.jsx(Ul,{value:x,onChange:S=>{v(S),ql(S)}}),t.jsx(Ml,{projects:ie,query:w,onQueryChange:J,filters:C,onFiltersChange:de,onClearAll:xt,todayMs:N,resultText:tt,countRevealClass:x==="board"?"@[47rem]:inline":void 0,disabled:u.isError,searchFieldRef:Z,trailing:x==="board"&&!(u.isSuccess&&u.data.length===0)?t.jsx(Gi,{value:g,onChange:S=>{h(S),zs(S)}}):null})]}),t.jsx(Il,{filters:C,sort:P,onFiltersChange:de,onSortChange:Be,onClearAll:xt,hideClearAll:Ee,searchFieldRef:Z}),t.jsx("output",{"data-project-announcement":"",className:"sr-only","aria-live":"polite",children:O})]})]}),t.jsxs("div",{className:"mt-8 flex min-h-0 flex-1 flex-col",children:[u.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:n("ui.projects.projects_page.loading_projects")}),Bl.map(S=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx($e,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx($e,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx($e,{className:"h-4 w-40 shrink-0 bg-elevated"})]},S))]}),u.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx(Kt,{variant:"danger",children:u.error instanceof Error&&u.error.message?u.error.message:n("ui.projects.projects_page.the_projects_could_not_be_read")}),t.jsx(z,{variant:"secondary",size:"sm",onClick:()=>void u.refetch(),children:n("ui.projects.projects_page.try_again")})]}),u.isSuccess&&u.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:n("ui.projects.projects_page.no_projects_yet")}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:n("ui.projects.projects_page.create_one_here_or_ask_an_agent_to_create_one_and_link_this_sessi")}),t.jsxs(z,{variant:"primary",onClick:()=>_(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(it,{}),n("ui.projects.projects_page.new_project")]})]}),Ue&&t.jsx("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:n("ui.projects.projects_page.searching")})}),re&&Ee&&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:w.trim()?n("ui.projects.projects_page.no_projects_match_trim",{trim:String(w.trim())}):n("ui.projects.projects_page.no_projects_match")}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:w.trim()?Ho[Ae]:n("ui.projects.projects_page.try_removing_a_filter_clearing_the_filters_restores_the_list")}),t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.jsx(z,{variant:"secondary",onClick:()=>{xt(),Z.current?.focus()},children:n("ui.projects.projects_page.clear_all")}),x==="board"&&H.length>0&&t.jsx(z,{variant:"secondary",onClick:Es,children:n("ui.projects.projects_page.show_all_time")})]})]}),re&&!Ee&&!Ue&&x==="list"&&t.jsx(Rl,{projects:H,nowMs:e,onOpen:S=>void r(`/projects/${S.id}`),sort:P,onSortChange:Be,searchPopulation:ie,filters:C,query:w,todayMs:N,onToggleFilter:wn,onClearFilters:xt,teamLabelFor:c}),re&&!Ee&&x==="board"&&te.length>0&&t.jsx(oc,{projects:te,nowMs:e,onOpen:S=>void r(`/projects/${S.id}`),onEdit:S=>void r(`/projects/${S.id}`),onDelete:T,onMove:Cn,teamLabelFor:c,movingKeys:Nn}),re&&!Ee&&!Ue&&x==="board"&&te.length===0&&Oe!==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:Oe}),t.jsx("p",{className:"max-w-140 text-center text-body-sm text-ink-muted",children:n("ui.projects.projects_page.older_projects_are_hidden_by_the_window")}),t.jsx(z,{variant:"secondary",onClick:Es,children:n("ui.projects.projects_page.show_all_time")})]}),re&&!Ee&&!Ue&&x==="timeline"&&t.jsx(Al,{items:ne,nowMs:e,onOpen:S=>void r(`/projects/${S.project.id}`),pendingDetails:nt,failedDetails:ye,onRetryDetails:gt,teamLabelFor:c})]}),t.jsx(pn,{open:y!==null,projectName:y?.name??"",onClose:()=>T(null),onConfirm:async S=>{y&&(await f.mutateAsync({key:y.id,confirmedName:S}),je(n("ui.projects.projects_page.project_deleted")),T(null))}}),t.jsx(fn,{open:ve!==null,refusal:ve?.refusal??null,projectLabel:ve?X(ve.project):"",onClose:()=>{ve&&ee(ve.project.id),Rs()},onConfirm:async()=>{if(!ve)return;const{project:S,status:K,refusal:Q}=ve,ke=await p.mutateAsync({key:S.id,fields:{status:K},forceDone:!0});je(Vr(ke,Q.count,se(K).label)),u.refetch().then(()=>ee(S.id))},secondaryLabel:n("ui.projects.projects_page.open_project"),onSecondary:()=>{const S=ve?.project.id;Rs(),S&&r(`/projects/${S}`)}}),t.jsx(kl,{open:b,onClose:()=>_(!1),onSubmit:async S=>{const K=await m.mutateAsync(S.fields),Q=S.followUp?.title??S.fields.name;if(S.followUp)try{await p.mutateAsync({key:K.id,fields:S.followUp})}catch(ke){const ae=ke instanceof Error&&ke.message?ke.message:"";le(n("ui.projects.projects_page.project_label_was_created_but_the_extra_fields_were_not_saved_val",{label:String(Q),value2:String(ft(ae)||n("ui.projects.projects_page.the_server_refused_them"))}));return}je(n("ui.projects.projects_page.project_label_created",{label:String(Q)}))}})]}):t.jsxs("div",{className:"flex h-full flex-col gap-8 p-6",children:[t.jsx(Fs,{title:n("ui.projects.projects_page.projects"),icon:Us}),a.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Se,{label:n("ui.projects.projects_page.checking_the_server_s_projects_support")})}):t.jsx(Kt,{variant:"warning",children:gr[o]??gr.unknown})]})};export{Jl as ProjectsPage};
|