local-operator-ui 0.36.7 → 0.36.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/out/main/index.js +874 -30
  2. package/out/preload/index.js +42 -1
  3. package/out/renderer/assets/{_basePickBy-Cp4-k2Ra.js → _basePickBy-DMcJ3S7k.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-SW_cXbV_.js → _baseUniq-D1lM95PP.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-N3zxLs5x.js → agent-details-page-BtlkMdIG.js} +2 -2
  6. package/out/renderer/assets/{agent-hub-page-BlZWarvE.js → agent-hub-page-CvnosPnb.js} +2 -2
  7. package/out/renderer/assets/{agents-page-C7c-PG8v.js → agents-page-C3p0casO.js} +3 -3
  8. package/out/renderer/assets/{arc-CH4PDipB.js → arc-DsWPhFjP.js} +1 -1
  9. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-YJo8Ggxb.js → architectureDiagram-IEHRJDOE-DNfaqYw7.js} +1 -1
  10. package/out/renderer/assets/{arrow-up-BB9CxXVA.js → arrow-up-Begz0H6P.js} +1 -1
  11. package/out/renderer/assets/{blockDiagram-JOT3LUYC-rOqQnp0E.js → blockDiagram-JOT3LUYC-BJENelAS.js} +1 -1
  12. package/out/renderer/assets/{book-open-DkVxCJ61.js → book-open-5BRzSc1Z.js} +1 -1
  13. package/out/renderer/assets/browser-page-Dwy1BXTz.js +1 -0
  14. package/out/renderer/assets/{browser-webauthn-prompt-Dna4BiM9.js → browser-webauthn-prompt-yiiGM34k.js} +1 -1
  15. package/out/renderer/assets/{building-2-CavXM_-r.js → building-2-T3OwRXqF.js} +1 -1
  16. package/out/renderer/assets/{c4Diagram-VJAJSXHY-DEPLadlT.js → c4Diagram-VJAJSXHY-CEijvBuX.js} +1 -1
  17. package/out/renderer/assets/channel-BuIK1RR0.js +1 -0
  18. package/out/renderer/assets/{chunk-4BMEZGHF-klJwtJH4.js → chunk-4BMEZGHF-CtdEc_y-.js} +1 -1
  19. package/out/renderer/assets/{chunk-A2AXSNBT-DRT8OSGB.js → chunk-A2AXSNBT-DzhnEf46.js} +1 -1
  20. package/out/renderer/assets/{chunk-AEK57VVT-kqK_zO-a.js → chunk-AEK57VVT-BNPXglh5.js} +1 -1
  21. package/out/renderer/assets/{chunk-D6G4REZN-CJZaq5OR.js → chunk-D6G4REZN-xyBvlSTD.js} +1 -1
  22. package/out/renderer/assets/{chunk-RZ5BOZE2-D4tpPnZf.js → chunk-RZ5BOZE2-8dmoMKQZ.js} +1 -1
  23. package/out/renderer/assets/{chunk-XZIHB7SX-D4Kppo6Q.js → chunk-XZIHB7SX-DLfyXOIE.js} +1 -1
  24. package/out/renderer/assets/classDiagram-GIVACNV2-CcLuC1It.js +1 -0
  25. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CcLuC1It.js +1 -0
  26. package/out/renderer/assets/clone-C-B3TV1U.js +1 -0
  27. package/out/renderer/assets/{console-mirror-BOyWikJU.js → console-mirror-Ddv0LHdM.js} +1 -1
  28. package/out/renderer/assets/{consoleCapture-Ctr4ZgwO.js → consoleCapture-Cm0PxzNK.js} +1 -1
  29. package/out/renderer/assets/{conversation-input-sync-DdFRR8Sk.js → conversation-input-sync-i6ilfEnc.js} +271 -271
  30. package/out/renderer/assets/{dagre-OKDRZEBW-ZzTMDgQF.js → dagre-OKDRZEBW-Dob_U_wx.js} +1 -1
  31. package/out/renderer/assets/{diagram-SSKATNLV-D-OEK7di.js → diagram-SSKATNLV-Dh8_PC2b.js} +1 -1
  32. package/out/renderer/assets/{diagram-VNBRO52H-CM6lMapK.js → diagram-VNBRO52H-NZ9qo5oG.js} +1 -1
  33. package/out/renderer/assets/{erDiagram-Q7BY3M3F-2khnybxo.js → erDiagram-Q7BY3M3F-BOUqITNj.js} +1 -1
  34. package/out/renderer/assets/{error-boundary-B2fmvLyi.js → error-boundary-LwhkYl0Z.js} +2 -2
  35. package/out/renderer/assets/{flowDiagram-4HSFHLVR-PmXhc4g8.js → flowDiagram-4HSFHLVR-CZiUXOWe.js} +1 -1
  36. package/out/renderer/assets/{ganttDiagram-APWFNJXF-DXqSjI8D.js → ganttDiagram-APWFNJXF-DqweVTOi.js} +1 -1
  37. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CE0xYGI6.js → gitGraphDiagram-7IBYFJ6S-KbIhBWBs.js} +1 -1
  38. package/out/renderer/assets/{graph-ydqZFY1l.js → graph-O8aHYPDC.js} +1 -1
  39. package/out/renderer/assets/{hash-Dc3JifaZ.js → hash-WYoE1Khd.js} +1 -1
  40. package/out/renderer/assets/index-6crVx9hx.js +57 -0
  41. package/out/renderer/assets/index-D4j9Ycfd.js +7 -0
  42. package/out/renderer/assets/index-D8fns19J.js +1 -0
  43. package/out/renderer/assets/index-O8V3Lal4.css +1 -0
  44. package/out/renderer/assets/index-Re5k_KqO.js +824 -0
  45. package/out/renderer/assets/{infoDiagram-PH2N3AL5-DOZ3-Qro.js → infoDiagram-PH2N3AL5-DU0dbmt7.js} +1 -1
  46. package/out/renderer/assets/{installer-DWToCmOf.js → installer-C-rmt1Yr.js} +1 -1
  47. package/out/renderer/assets/{journeyDiagram-U35MCT3I-DWis6Sd2.js → journeyDiagram-U35MCT3I-DUybkPWl.js} +1 -1
  48. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-B9e7wrf9.js → kanban-definition-NDS4AKOZ-onKwvi0l.js} +1 -1
  49. package/out/renderer/assets/{layout-CAcs3Q5o.js → layout-RKbPA5d2.js} +1 -1
  50. package/out/renderer/assets/{legacy-agents-page-DrGkO870.js → legacy-agents-page-DmUlGbZ_.js} +5 -5
  51. package/out/renderer/assets/{library-page-J-oYtewu.js → library-page-CsUF7SOa.js} +3 -3
  52. package/out/renderer/assets/{mermaid.core-BKDqOsvz.js → mermaid.core-DdYe4AYl.js} +5 -5
  53. package/out/renderer/assets/mesh-page-CW4tQHZJ.js +1 -0
  54. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-B8ubJP7r.js → mindmap-definition-ALO5MXBD-DrsGVqDZ.js} +1 -1
  55. package/out/renderer/assets/{mini-CSnAsFlT.js → mini-CHtVBEDV.js} +1 -1
  56. package/out/renderer/assets/{notebook-pen-eF7NwmC0.js → notebook-pen-BHmA9Aor.js} +1 -1
  57. package/out/renderer/assets/{org-access-CJDIOfTA.js → org-access-Bqdb8uRz.js} +1 -1
  58. package/out/renderer/assets/{org-surface-gate-BFLSYyz1.js → org-surface-gate-UD-oXlvB.js} +1 -1
  59. package/out/renderer/assets/{page-header-BMDtYfV0.js → page-header-CoSSp6Ks.js} +1 -1
  60. package/out/renderer/assets/{pieDiagram-IB7DONF6-C4Lho4yQ.js → pieDiagram-IB7DONF6-C0gYyuJA.js} +1 -1
  61. package/out/renderer/assets/projects-page-DU4wZXNY.js +45 -0
  62. package/out/renderer/assets/publication-validation-D4Bef-1h.js +1 -0
  63. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DauXMmcp.js → quadrantDiagram-7GDLP6J5-DbEt_1Ti.js} +1 -1
  64. package/out/renderer/assets/{radar-MK3ICKWK-_FJ6NjKi.js → radar-MK3ICKWK-BCsS7AKJ.js} +1 -1
  65. package/out/renderer/assets/{radient-auth-buttons-B4LrTMwy.js → radient-auth-buttons-vBcfzZdx.js} +1 -1
  66. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BBMnxRwM.js → requirementDiagram-KVF5MWMF-C3WoUU_2.js} +1 -1
  67. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-ZAgJNulV.js → sankeyDiagram-QLVOVGJD-vE9T4I2u.js} +1 -1
  68. package/out/renderer/assets/{schedules-page-BDxSAX-g.js → schedules-page-CGCopxbo.js} +1 -1
  69. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-ixhBbax-.js → sequenceDiagram-X6HHIX6F-CqwLiiP3.js} +1 -1
  70. package/out/renderer/assets/settings-page-DrZcB4mR.js +287 -0
  71. package/out/renderer/assets/{smartart-CsYIjueA.js → smartart-C6SIDcio.js} +1 -1
  72. package/out/renderer/assets/{stateDiagram-DGXRK772-Cyo1D1sd.js → stateDiagram-DGXRK772-W9r7i0O7.js} +1 -1
  73. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-cX4iVUJF.js +1 -0
  74. package/out/renderer/assets/{tags-input-chips-DeSDZmGf.js → tags-input-chips-CqW7e8j3.js} +1 -1
  75. package/out/renderer/assets/team-bridge-page-Dt4lEU3y.js +11 -0
  76. package/out/renderer/assets/{timeline-definition-BDJGKUSR-dHKNC0_-.js → timeline-definition-BDJGKUSR-QYcBKPg2.js} +1 -1
  77. package/out/renderer/assets/ui-preferences-store-BWYRkg79.js +1 -0
  78. package/out/renderer/assets/{use-download-agent-mutation-Du8Okjj5.js → use-download-agent-mutation-CNw_prc9.js} +5 -5
  79. package/out/renderer/assets/{use-session-snapshot-hoogT7-L.js → use-session-snapshot-CzQdg29b.js} +1 -1
  80. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-y9FbutsK.js → xychartDiagram-VJFVF3MP-B37S1SAD.js} +1 -1
  81. package/out/renderer/console-capture.html +5 -5
  82. package/out/renderer/index.html +7 -7
  83. package/out/renderer/installer.html +4 -4
  84. package/out/renderer/mini.html +7 -7
  85. package/package.json +3 -3
  86. package/out/renderer/assets/browser-page-Dr5j9bQE.js +0 -1
  87. package/out/renderer/assets/channel-BUsgjri2.js +0 -1
  88. package/out/renderer/assets/classDiagram-GIVACNV2-YCOFP_Sl.js +0 -1
  89. package/out/renderer/assets/classDiagram-v2-COTLJTTW-YCOFP_Sl.js +0 -1
  90. package/out/renderer/assets/clone-DVoefRFN.js +0 -1
  91. package/out/renderer/assets/index-BHi1lUGF.js +0 -1
  92. package/out/renderer/assets/index-BoPP-Dip.js +0 -7
  93. package/out/renderer/assets/index-DY17TKlm.js +0 -824
  94. package/out/renderer/assets/index-Doo51Mbi.js +0 -57
  95. package/out/renderer/assets/index-JreDTE2U.css +0 -1
  96. package/out/renderer/assets/mesh-page-CHZ2qVtJ.js +0 -1
  97. package/out/renderer/assets/projects-page-CNUJUnDM.js +0 -40
  98. package/out/renderer/assets/publication-validation-5oR6aluM.js +0 -1
  99. package/out/renderer/assets/settings-page-DpSl6AZf.js +0 -287
  100. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BylkQbLa.js +0 -1
  101. package/out/renderer/assets/team-bridge-page-BnsNoiEd.js +0 -1
  102. package/out/renderer/assets/ui-preferences-store-CFbBU1td.js +0 -1
  103. package/out/renderer/assets/use-memberships-query-C0ico4nv.js +0 -1
@@ -0,0 +1,45 @@
1
+ import{t as n,d as $e,j as t,c as R,r as d}from"./index-6crVx9hx.js";import{$ as gs,aO as ze,d as _e,c8 as qn,a0 as xs,u as Bn,cr as V,cs as Rt,ct as Un,V as qt,cu as $s,cv as zs,cw as Gs,bT as $n,aP as ve,cx as zn,a as nt,c as ye,aI as Cr,aR as Bt,a1 as _t,aV as Xe,cy as Gn,cb as Yn,cn as Kn,cz as Hn,co as Wn,aX as Er,aW as Dt,bx as Vn,az as Xn,ap as At,bF as Jn,bL as Qn,bK as Zn,bI as Ys,cq as ea,cd as ta,ca as sa,cc as ra,a2 as de,cA as Tr,cB as Rr,cj as Ut,cC as Be,cD as na,cE as jt,cF as aa,cG as Ks,cH as ht,cI as Dr,cJ as oa,cK as ia,cL as Ar,aQ as ca,ao as la,aj as ua,ak as da,am as pa,an as ma,aq as fa,aw as _a,cM as ja,cN as Pr,bO as ha,cO as ga,ay as xa,aS as ba,b7 as va}from"./conversation-input-sync-i6ilfEnc.js";import{c as gt,u as I,K as Je,y as $t,M as Qe,N as Ze,O as et,P as Oe,a as G,i as bs,j as vs,S as Te,k as ys,l as be,a9 as ya,aa as wa,ab as ka,o as Na,p as Sa,m as Ca,B as ke,a5 as ws,af as ks,a7 as Ns,I as ue,X as zt,h as Ss,T as Or,L as pe,R as Mr,C as Ir,ag as Ea,D as Ta,b as Ra,e as Da,A as ts,U as Aa,a0 as Pa,a1 as Oa,a2 as Ma,x as He}from"./error-boundary-LwhkYl0Z.js";import{P as Hs}from"./page-header-CoSSp6Ks.js";import{c6 as Ia,bO as Lr,c7 as La,bW as Fr,c8 as Fa,bX as qa,by as Ba,a as pt,c9 as Ua,$ as Ws,ca as Vs,c5 as $a}from"./index-Re5k_KqO.js";import{h as za,j as Ga,k as tt,l as Ya,m as ss}from"./ui-preferences-store-BWYRkg79.js";import{u as Ka}from"./use-session-snapshot-CzQdg29b.js";import{A as qr}from"./arrow-up-Begz0H6P.js";import"./console-mirror-Ddv0LHdM.js";/**
2
+ * @license lucide-react v0.507.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ha=[["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"}]],Wa=gt("calendar-off",Ha);/**
7
+ * @license lucide-react v0.507.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Va=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]],Xa=gt("list-filter",Va);/**
12
+ * @license lucide-react v0.507.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ja=[["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"}]],Qa=gt("message-square-more",Ja);/**
17
+ * @license lucide-react v0.507.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Za=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Br=gt("play",Za);/**
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 eo=[["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"}]],to=gt("unlink",eo),Gt={list:["desktop","projects"],detail:e=>["desktop","projects",e]};function so(e){return gs({queryKey:Gt.list,enabled:e,queryFn:()=>_e({op:"projects.list"}).then(s=>s.projects),retry:xs,staleTime:1e4})}function ro(e,s){return Ia({queries:e.map(r=>({queryKey:Gt.detail(r),enabled:s&&!!r,queryFn:()=>_e({op:"projects.get",key:r}),retry:xs,staleTime:1e4}))})}function Ur(e,s){return gs({queryKey:Gt.detail(e??""),enabled:s&&!!e,queryFn:()=>_e({op:"projects.get",key:e??""}),retry:xs,staleTime:1e4})}function Ge(){const e=Bn();return()=>{e.invalidateQueries({queryKey:Gt.list})}}function no(){const e=Ge();return ze({mutationFn:s=>_e({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 $r(){const e=Ge();return ze({mutationFn:s=>_e({op:"projects.update",key:s.key,fields:s.fields,...s.forceDone===!0?{force_done:!0}:{}}),retry:qn,onSuccess:()=>e()})}function zr(){const e=Ge();return ze({mutationFn:s=>_e({op:"projects.delete",key:s.key,confirmed_name:s.confirmedName}),onSuccess:()=>e()})}function ao(){const e=Ge();return ze({mutationFn:s=>_e({op:"projects.link",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function oo(){const e=Ge();return ze({mutationFn:s=>_e({op:"projects.unlink",key:s.key,sessionId:s.sessionId}),onSuccess:()=>e()})}function io(){const e=Ge();return ze({mutationFn:s=>_e({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 co(){const e=Ge();return ze({mutationFn:s=>_e({op:"projects.milestone.remove",key:s.key,name:s.name}),onSuccess:()=>e()})}const Gr={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"}},We=Object.keys(Gr);function ae(e){return Gr[e]??{label:e||n("ui.projects.project_model.unknown"),variant:"neutral"}}const Yr=["planning","active","qa","validation","done","paused","archived"].map(e=>({value:e,label:ae(e).label}));function lo(e){return e==="done"}const uo={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 po(e){return uo[e]??{label:String(e),variant:"neutral"}}$e["ui.projects.project_model.stale"];const mo=/^(\d{4})-(\d{2})-(\d{2})$/;function Me(e,s,r=new Date){if(!e)return"";const a=mo.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=Rt(o,{month:"short",day:"numeric"},s);return o.getFullYear()===r.getFullYear()?i:Rt(o,{month:"short",day:"numeric",year:"numeric"},s)}function xt(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 bt(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 fo(e){return e?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(bt(e))}):n("ui.projects.project_model.no_progress")}const Kr=/^$|^\d{4}-\d{2}-\d{2}$/;function Hr(e){return e?e==="operator"?n("ui.projects.project_model.the_operator"):n("ui.projects.project_model.session_reportedby",{reportedBy:String(e)}):""}function _o(e,s){if(!e.progress)return n("ui.projects.project_model.not_reported_yet");const r=xt(e.progress_updated_at,s),a=Hr(e.progress_reported_by),o=[r?n("ui.projects.project_model.reported_progressagephrase_age",{progressAgePhrase_age:String(bt(r))}):"reported"];return a&&o.push(n("ui.projects.project_model.by_reporter",{reporter:String(a)})),o.join(" ")}function Wr(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 Vr(e,s){return s<=0?"":n("ui.projects.project_model.completed_total",{completed:V(e,{useGrouping:!1}),total:V(s,{useGrouping:!1})})}function Cs(e){return e<=0?"":n("ui.projects.project_model.live_live",{live:e})}function jo(e){return e<=0?"":n("ui.projects.count.session",{count:e})}function ho(e){return n("ui.projects.count.project",{count:e})}function go(e){const s=jo(e.sessions);if(!s)return"";const r=Cs(e.live_sessions);return r?n("ui.projects.project_model.count_live",{count:String(s),live:String(r)}):s}function xo(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 bo(e){return e?e.running>0?n("ui.projects.count.subagent_running",{count:e.running}):n("ui.projects.count.subagent",{count:e.settled}):""}function vo(e){return e?n("ui.projects.count.todo",{count:e.total}):""}function Xr(e,s){const r=[],a=Me(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=Wr(e.estimate,e.estimate_unit);o&&r.push({key:"estimate",text:o});const i=Vr(e.milestones_completed,e.milestones_total);i&&r.push({key:"milestones",text:n("ui.projects.project_model.milestones_milestones",{milestones:String(i)})});const l=Cs(e.live_sessions);return l&&r.push({key:"live",text:l}),r}const Ve=864e5,yo=/^(\d{4})-(\d{2})-(\d{2})$/;function we(e){if(!e)return null;const s=yo.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 rs=["planning","active","qa","validation","done"],ns=["paused","archived"],Yt=[{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}],Jr="7d",wo=Yt.find(e=>e.value===Jr);function Qr(e){return Yt.find(s=>s.value===e)??wo}function ko(e){return Yt.some(s=>s.value===e)}function Xs(e,s,r){const a=Qr(s);return a.seconds===null?e:e.filter(o=>r/1e3-o.updated_at<=a.seconds)}function No(e){const s=Qr(e);return s.seconds===null?null:n("ui.projects.project_model.nothing_changed_in_phrase",{phrase:String(s.phrase)})}const Zr="projects-board-window";function So(){try{const e=localStorage.getItem(Zr);if(e!==null&&ko(e))return e}catch{}return Jr}function Js(e){try{localStorage.setItem(Zr,e)}catch{}}const en="projects-board-column-order";let as=null;function Co(){if(as)return[...as];try{const e=localStorage.getItem(en);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 Eo(e){as=[...e];try{localStorage.setItem(en,JSON.stringify(e))}catch{}}function To(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 Ro(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=rs.map(c=>({status:c,projects:r.get(c)??[]}));for(const c of ns){const u=r.get(c)??[];u.length>0&&a.push({status:c,projects:u})}for(const[c,u]of r)!ns.includes(c)&&!rs.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 tn(e,s){if(e.status==="done"||e.status==="archived"||e.completed_at)return!1;const r=we(e.target_date);return r===null?!1:r<s}function ne(e){return e.title||e.name}$e["ui.projects.project_model.no_team"];function vt(e){const s=e.team?.trim();if(s)return s;const r=e.owner?.trim();return r||null}function Es(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 Kt(e){return e.title||e.session_id}function Do(e){return[...e].reverse()}function Ao(e){return e<=0?"":n("ui.projects.count.update",{count:e})}const Qs=e=>String(e).padStart(2,"0");function os(e){return`${e.getFullYear()}-${Qs(e.getMonth()+1)}-${Qs(e.getDate())}`}function Po(e){const s=Date.parse(e);return Number.isNaN(s)?"":os(new Date(s))}function Oo(e,s,r=new Date){if(!e)return"";if(e===os(r))return n("ui.projects.project_model.today");const a=new Date(r.getFullYear(),r.getMonth(),r.getDate()-1);return e===os(a)?n("ui.projects.project_model.yesterday"):Me(e,s,r)}function Mo(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":Un(new Date(r),{hour:"numeric",minute:"2-digit"},s)}function Io(e,s){const r=Date.parse(e);return Number.isNaN(r)?"":bt(xt(r/1e3,s))}function Lo(e,s,r=Date.now()){const a=[],o=Hr(e.by);o&&a.push({key:"author",text:o});const i=Mo(e.at,s);i&&a.push({key:"time",text:i});const l=Io(e.at,r);return l&&a.push({key:"age",text:l}),a}function Fo(e,s,r=new Date){const a=[];for(const o of Do(e)){const i=Po(o.at),l=a[a.length-1];if(l&&l.key===i){l.entries.push(o);continue}a.push({key:i,label:Oo(i,s,r),entries:[o]})}return a}function qo(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 Bo(e,s){return s<=0?"":`${e} of ${s} complete`}function Uo(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 Zs(e){return`${e.open} open of ${e.total}`}function $o(e){const s=e.filter(a=>a.exists);return(s.find(a=>a.runtime?.state==="live")??s[0])?.session_id??null}function zo(e){const s=ne(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 Go(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 Yo=/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"/g;function sn(e){const s=[];for(const r of e.matchAll(Yo))s.push((r[1]??r[2]??"").replace(/\\(.)/g,"$1"));return s}const Tt=3;function Ts(e){if(e.length<=Tt+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-Tt;return n("ui.projects.project_model.join_and_hidden_more",{join:String(e.slice(0,Tt).join(", ")),hidden:V(s,{useGrouping:!1})})}function Rs(e){return n("ui.projects.count.milestones_are",{count:e})}const er="complete them, or pass force_done=true to close with them open",Ko="complete or remove the incomplete milestones, then mark it done",rn=/^cannot set status 'done': (\d+) milestones? still incomplete \((.+)\) — /;function yt(e){const s=e.match(rn);if(s){const r=Number(s[1]),a=sn(s[2]),o=a.length>0?Ts(a):s[2];return n("ui.projects.project_model.this_can_t_be_marked_done_yet_milestonesare_count_still_incomplet",{milestonesAre_count:String(Rs(r)),clause:String(o)})}return e.includes(er)?e.replace(er,Ko):e}const Ho="project_done_incomplete";function Wo(e){const s=e.message.match(rn),r=e.code===Ho;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?sn(s[2]):[];return{count:o.length>0?o.length:s?Number(s[1]):0,names:o,coded:r,message:e.message}}function Vo(e){if(e.count>0){const s=Ts(e.names);return n("ui.projects.project_model.count_still_open_clause_clause",{count:String(Rs(e.count)),clause________clause:String(s?n("ui.projects.project_model.clause",{clause:String(s)}):"")})}return yt(e.message)||n("ui.projects.project_model.some_milestones_are_still_open")}function Xo(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(Rs(e.count)),names:String(Ts(e.names))}):yt(e.message)||n("ui.projects.project_model.milestones_are_still_open_on_this_project_complete_or_remove_them")}function nn(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})}$e["ui.projects.project_model.the_project_was_not_moved_try_again_or_open_it_to_change_its_stat"];function an(e){return e.trim().slice(0,za)}const Jo={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")}},Qo=2,Zo=4,ei=3,ti=2,si=1,ri=3,Le={title:3,name:2.5,description:2,tags:1.5,attribution:1.5,status:1},ni=/[^\p{L}\p{N}]+/u,ai=/\s+/;function tr(e,s){const r=s.trim().toLowerCase();if(!r)return 0;if(r===e)return Zo;if(r.startsWith(e))return ei;const a=r.split(ni).filter(Boolean),o=e.split(ai).filter(Boolean);if(o.length>0&&o.every(l=>a.some(c=>c.startsWith(l))))return ti;const i=o.join("");return i.length>=ri&&oi(i,r)?si:0}function oi(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 ii(e,s){const r=s.trim().toLowerCase();if(!r)return 0;const a=[[e.title,Le.title],[e.name,Le.name],[e.description,Le.description],[e.owner,Le.attribution],[e.team,Le.attribution],[e.status,Le.status]];let o=0;for(const[i,l]of a){if(!i)continue;const c=tr(r,i)*l;c>o&&(o=c)}for(const i of e.tags){const l=tr(r,i)*Le.tags;l>o&&(o=l)}return o}function ci(e,s){const r=s.trim();if(!r)return e;const a=[];for(const o of e){const i=ii(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=ne(o.project).localeCompare(ne(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 li(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 ui=180;function di(e,s){const r=an(e),a=Lr(r,ui),o=gs({queryKey:["desktop","projects","search",a],enabled:s&&a.length>0,queryFn:()=>_e({op:"projects.search",q:a,limit:Ga}),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 at=["status","team","owner","tags","progress","target","estimate","milestones","live"],sr={status:[],team:[],owner:[],tags:[],progress:[],target:[],estimate:[],milestones:[],live:[]},dt={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")}},pi=new Set(["status","progress","target","estimate","milestones","live"]),mi={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"]},fi={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 on(e,s){switch(e){case"status":return ae(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 fi[s]??s??""}function _i(e,s){return e[s].length>0}function mt(e){return at.every(s=>!_i(e,s))}function ji(e){return at.reduce((s,r)=>s+e[r].length,0)}function cn(e,s,r){const a=e[s],o=a.includes(r)?a.filter(i=>i!==r):[...a,r];return{...e,[s]:o}}function ln(e,s,r,a){switch(e){case"status":return s.status===r;case"team":return vt(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 we(s.target_date)===null;if(r==="overdue")return tn(s,a);const o=we(s.target_date);if(o===null)return!1;const i=(o-a)/Ve;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 un(e,s,r,a){const o=e[s];return o.length===0?!0:o.some(i=>ln(s,r,i,a))}function hi(e,s,r){return mt(s)?e:e.filter(a=>at.every(o=>un(s,o,a,r)))}function gi(e,s,r,a){return s.filter(o=>at.every(i=>i===e||un(r,i,o,a)))}function xi(e,s,r){const a=r[e];switch(e){case"status":{const i=[...new Set(s.map(c=>c.status))].filter(c=>!We.includes(c)).sort((c,u)=>c.localeCompare(u,void 0,{sensitivity:"base"})),l=a.filter(c=>typeof c=="string"&&!We.includes(c)&&!i.includes(c));return[...We,...i,...l]}case"team":{const o=new Set;let i=!1;for(const c of s){const u=vt(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 mi[e]}}function dn(e,s,r,a){const o=gi(e,s,r,a),i=pi.has(e),l=[];for(const c of xi(e,o,r)){const u=r[e].includes(c),p=o.reduce((m,_)=>m+(ln(e,_,c,a)?1:0),0);!i&&p===0&&!u||l.push({value:c,label:on(e,c),count:p,selected:u})}return{facet:e,label:dt[e],options:l}}function bi(e,s,r){return at.map(a=>dn(a,e,s,r))}const is="projects-sort";$e["ui.projects.project_sort.default_as_listed"];function vi(e){return yi.includes(e)}const yi=["name","status","target","estimate","milestones","live","progress"];function wi(){try{const e=localStorage.getItem(is);if(e===null)return null;const[s,r,...a]=e.split(":");if(a.length>0)return null;if(s&&vi(s)&&(r==="asc"||r==="desc"))return{key:s,direction:r}}catch{}return null}function ki(e){try{e===null?localStorage.removeItem(is):localStorage.setItem(is,`${e.key}:${e.direction}`)}catch{}}function st(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 Xt(e){return e==="target"||e==="progress"?"desc":"asc"}function Ds(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 Ni(e){return e===null?n("ui.projects.project_sort.sort_cleared"):n("ui.projects.project_sort.sorted_by_key_direction",{key:String(st(e.key)),direction:String(Ds(e.key,e.direction))})}function Si(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 rr(e,s){switch(e){case"name":return 0;case"status":return We.includes(s.status)?0:1;case"target":return cs(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 cs(e){return we(e.completed_at??e.target_date)}function nr(e){return e==="points"?0:e==="days"?1:2}function Ci(e,s,r){switch(e){case"name":return ne(s).localeCompare(ne(r),void 0,{sensitivity:"base"});case"status":return We.indexOf(s.status)-We.indexOf(r.status);case"target":{const a=cs(s)??0,o=cs(r)??0;return a-o}case"estimate":{const a=nr(s.estimate_unit)-nr(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 ar(e,s){if(e.updated_at!==s.updated_at)return s.updated_at-e.updated_at;const r=ne(e).localeCompare(ne(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 Ei(e,s,r){const a=rr(r.key,e),o=rr(r.key,s);if(a!==o)return a-o;if(a===1)return ar(e,s);const i=Ci(r.key,e,s);return i!==0?r.direction==="desc"?-i:i:ar(e,s)}function Ti(e,s){return[...e].sort((r,a)=>Ei(r,a,s))}const Pe=["day","week","month","quarter"],As={day:24,week:9,month:3,quarter:1};function Ps(e){const s=new Date(e);return Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate())}function Fe(e,s){return Math.round((s-e)/Ve)}function or(e,s){return Fe(e,s)+1}function Ri(e,s){for(const r of Pe)if(e*As[r]<=s)return r;return Pe[Pe.length-1]}function Di(e){const{project:s}=e;return s.start_date||s.target_date||s.completed_at?!0:e.milestones.some(r=>!!r.target_date)}function Ai(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=we(o);i!==null&&r.push(i)}for(const o of a.milestones){const i=we(o.target_date);i!==null&&r.push(i)}}return r.length===1?null:{startMs:Math.min(...r),endMs:Math.max(...r)}}function Pi(e){const s=[],r=[];for(const a of e)(Di(a)?s:r).push(a);return{dated:s,undated:r}}function Oi(e){return n("ui.projects.count.undated",{count:e})}function Mi(e){const{project:s}=e,r=we(s.start_date),a=we(s.target_date),o=we(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 Ii(e){const s=[];for(const r of e.milestones){const a=we(r.target_date);a!==null&&s.push({name:r.name,dayMs:a,status:r.status})}return s}const Jt=e=>Rt(new Date(e),{month:"short",timeZone:"UTC"});function he(e){const s=new Date(e);return{year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate(),weekday:s.getUTCDay()}}function Li(e){const{year:s,month:r}=he(e);return Date.UTC(s,r-1,1)}function Fi(e){const{year:s,month:r}=he(e);return r===12?Date.UTC(s+1,0,1):Date.UTC(s,r,1)}function qi(e){const{year:s,month:r}=he(e);return Date.UTC(s,Math.floor((r-1)/3)*3,1)}function Bi(e){const{year:s,month:r}=he(e),a=Math.floor((r-1)/3);return a===3?Date.UTC(s+1,0,1):Date.UTC(s,a*3+3,1)}function Ui(e){const{weekday:s}=he(e);return e-(s+6)%7*Ve}const $i=26;function zi(e,s,r){const a=[],o=(m,_,j)=>{m<e||m>s||a.push({dayMs:m,label:_,major:j})};if(r==="day"){let m=!1;for(let _=e;_<=s;_+=Ve){const{day:j}=he(_);j===1?(o(_,Jt(_),!0),m=!0):m?(o(_,"",!1),m=!1):o(_,V(j,{useGrouping:!1}),!1)}return a}if(r==="week"){for(let m=Ui(e);m<=s;m+=7*Ve){if(m<e)continue;const{day:_,month:j}=he(m);he(m-7*Ve).month!==j?o(m,Rt(new Date(m),{month:"short",day:"numeric",timeZone:"UTC"}),!0):o(m,V(_,{useGrouping:!1}),!1)}return a}const i=r==="month"?Li:qi,l=r==="month"?Fi:Bi,c=m=>{const{year:_,month:j}=he(m);if(r==="month")return j===1&&_!==he(e).year?`${Jt(m)} '${V(_%100,{minimumIntegerDigits:2,useGrouping:!1})}`:Jt(m);const f=Math.floor((j-1)/3)+1;return f===1&&_!==he(e).year?`Q1 '${String(_%100).padStart(2,"0")}`:`Q${f}`};o(e,c(i(e)),!0);const u=Math.ceil($i/As[r]);let p=e;for(let m=l(i(e));m<=s;m=l(m))Fe(p,m)<u||(o(m,c(m),!0),p=m);return a}function ft(e){return e.split(",").map(s=>s.trim()).filter(s=>s.length>0)}const Pt=80,Ot=80,ir=64,cr=8;function ls(e){return e.trim().length>Pt?n("ui.projects.project_edit_model.titles_are_at_most_value1_characters",{value1:Pt}):null}function pn(e){return e.length>tt?n("ui.projects.project_edit_model.keep_the_description_within_value1_characters",{value1:tt}):null}function Mt(e,s){return e.trim().length>Ot?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:Ot}):null}function us(e){return Kr.test(e)?null:n("ui.projects.project_edit_model.dates_are_yyyy_mm_dd_or_empty")}function ds(e,s){return e&&s&&s<e?n("ui.projects.project_edit_model.the_target_date_is_before_the_start_date"):null}function mn(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 ps(e){const s=ft(e);if(s.length>cr)return{tags:s,error:n("ui.projects.project_edit_model.up_to_project_tags_max_tags",{PROJECT_TAGS_MAX:cr})};for(const r of s){const a=Ya(r);if(a)return{tags:s,error:a}}return{tags:s,error:null}}const Gi="project_name_exists";function lr(e){return e.code===Gi?n("ui.projects.project_edit_model.a_project_with_this_key_already_exists"):yt(e.message)||n("ui.projects.project_edit_model.the_project_was_not_saved")}function Yi(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 Ki(e,s){const r=ft(s);return r.length!==e.length?!1:r.every((a,o)=>a===e[o])}function Hi(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 ot(e){return e instanceof qt?lr({code:e.code,message:e.message}):lr({message:e instanceof Error?e.message:""})}function fn(e){return e instanceof qt&&(e.code==="project_not_found"||e.status===404)}function _n(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"):fn(e)?n("ui.projects.project_refusals.this_project_could_not_be_found_it_may_have_been_deleted"):ot(e)}function jn(e){if(!(e instanceof Error))return null;const s=e instanceof qt?e:null;return Wo({code:s?.code??null,message:e.message,detail:s?.detail})}async function Wi(e){try{return await e.move(),{kind:"accepted"}}catch(s){const r=jn(s);return r?.coded&&e.forceDoneOffered&&e.claimQuestion()?{kind:"question",refusal:r}:{kind:"spoken",copy:r?Xo(r):_n(s),refusal:r}}}$e["ui.projects.board_window_select.shows_projects_last_updated_within_this_window_older_ones_are_hid"];const Vi=({value:e,onChange:s})=>(I(),t.jsxs(Je,{value:e,onValueChange:r=>s(r),children:[t.jsx($t,{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(Qe,{"aria-label":n("ui.projects.board_window_select.projects_updated_within"),className:R("w-36 shrink-0"),"data-tour-tag":"projects-board-window",children:t.jsx(Ze,{})})}),t.jsx(et,{children:Yt.map(r=>t.jsx(Oe,{value:r.value,children:r.label},r.value))})]})),ms=6e4,fs=6e3;$e["ui.projects.request_update.requesting_updates"];const Xi=400;$e["ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"];const Ji="linked but not yet in use — it becomes a recipient after the first message",ur=e=>`project-request-update-${e}`,Qi=e=>`project-request-cooldown-${e}`,Zi=e=>`project-request-update-cooldown-${e}`,Qt=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})}),dr=(e,s)=>e.sessions.filter(r=>r.outcome===s).map(r=>Kt({session_id:r.session_id,title:r.title})),ec=e=>e.outcome==="failed"&&e.detail===Ji;function It(e,s){const r=Math.max(1,Math.ceil(s/1e3)),a=Math.max(0,Math.ceil(ms/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 tc(e){const s=ne({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:fs};if(e.state==="cooldown")return{variant:"info",title:It(s,Math.max(0,e.cooldown_remaining_s??0)*1e3),duration:fs};if(e.state!=="sent")return null;const l=dr(e,"failed"),c=dr(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(Qt(l))})),a>0&&(u+=n("ui.projects.request_update.delivery_to_value1_could_not_be_confirmed",{value1:String(Qt(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(ec);let p;return u?p=n("ui.projects.request_update.never_started",{total:i}):p=n("ui.projects.request_update.could_not_reach_any_of_the_total_linked_sessions_on_display",{total:i,display:String(s)}),{variant:"error",title:p,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(Qt(c))}),duration:Number.POSITIVE_INFINITY}}const ut=new Map,Os=new Set,Zt=new Map,_s=new Set;let hn=0;const Lt=()=>{hn+=1;for(const e of _s)e()},sc=e=>(_s.add(e),()=>{_s.delete(e)}),pr=()=>hn,gn=e=>Os.has(e),xn=e=>ut.get(e);function rc(e){Os.add(e),Lt()}function nc(e){Os.delete(e),Lt()}function mr(e,s,r){const a=Date.now();if(r<=a)return;const o=ut.get(e);if(o&&o.untilMs>=r)return;ut.set(e,{startedMs:s,untilMs:r});const i=Zt.get(e);i&&clearTimeout(i);const l=setTimeout(()=>{Zt.delete(e);const c=ut.get(e);c&&c.untilMs<=Date.now()&&(ut.delete(e),Lt())},r-a);l.unref?.(),Zt.set(e,l),Lt()}const ac=e=>/[.!?…]$/.test(e)?e:`${e}.`;function oc(e,s){const r=Date.now();if(s.state==="cooldown"){const a=Math.max(0,s.cooldown_remaining_s??0)*1e3;mr(e,r-(ms-a),r+a);return}s.state==="sent"&&(s.counts.delivered>=1||s.counts.unconfirmed>=1)&&mr(e,r,r+ms)}async function ic(e){const s=e.id;if(gn(s)){$s(n("ui.projects.request_update.requesting_updates"),{id:ur(s)});return}const r=Date.now(),a=xn(s);if(a&&a.untilMs>r){zs(It(ne(e),a.untilMs-r),{id:Qi(s),duration:fs});return}rc(s);const o=ur(s);let i=!1;const l=setTimeout(()=>{i=!0,$s(n("ui.projects.request_update.requesting_updates"),{id:o})},Xi);try{const c=await _e({op:"projects.request_update",key:s});oc(s,c);const u=tc(c);if(u){const p={id:o,...u.duration!==void 0?{duration:u.duration}:{}};switch(u.variant){case"success":ve(u.title,p);break;case"warning":$n(u.title,p);break;case"error":Gs(u.title,p);break;default:zs(u.title,p)}}else i&&zn(o)}catch(c){const u=c instanceof Error&&c.message.trim()!==""?c.message.trim():null;Gs(u?n("ui.projects.use_request_update.could_not_request_updates_endedsentence_message",{endedSentence_message:String(ac(u))}):n("ui.projects.use_request_update.the_request_could_not_be_confirmed"),{id:o,duration:Number.POSITIVE_INFINITY})}finally{clearTimeout(l),nc(s)}}function bn(){return d.useCallback(e=>{ic(e)},[])}function cc(e){d.useSyncExternalStore(sc,pr,pr);const s=gn(e),r=xn(e),a=r!==void 0?r.untilMs-Date.now():0,o=a>0;return{sending:s,cooling:o,cooldownRemainingMs:o?a:null}}const fr={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 lc(){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 uc=4,_r="board-column-move-hint",dc=({projects:e,nowMs:s,onOpen:r,onEdit:a,onDelete:o,onMove:i,movingKeys:l=[],teamLabelFor:c=u=>u})=>{I();const[u,p]=d.useState(Co),m=Ro(e,u),_=Es(e,vt),[j,f]=d.useState(null),[g,S]=d.useState(""),b=d.useRef(null),x=d.useRef(null),w=d.useRef(null);d.useEffect(()=>{const v=b.current,y=x.current;if(!v||!y)return;const O=y.firstElementChild;let L=-1;const B=()=>{const z=y.offsetWidth-y.clientWidth;z!==L&&(L=z,v.style.paddingRight=z>0?`${z}px`:"")};let K=-1;const X=()=>{const z=y.scrollLeft;Math.abs(v.scrollLeft-z)>.5&&(v.scrollLeft=z),K=z},$=()=>{Math.abs(v.scrollLeft-K)<=.5||(Math.abs(y.scrollLeft-v.scrollLeft)>.5&&(y.scrollLeft=v.scrollLeft),K=v.scrollLeft)},je=z=>{const se=z.deltaMode===1?16:z.deltaMode===2?y.clientWidth:1,xe=z.deltaMode===1?16:z.deltaMode===2?y.clientHeight:1;Math.abs(z.deltaX)>Math.abs(z.deltaY)?y.scrollLeft+=z.deltaX*se:y.scrollTop+=z.deltaY*xe,z.preventDefault()};B(),X(),v.addEventListener("wheel",je,{passive:!1}),v.addEventListener("scroll",$,{passive:!0}),y.addEventListener("scroll",X,{passive:!0});const ie=new ResizeObserver(()=>{B(),X()});return ie.observe(y),O&&ie.observe(O),window.addEventListener("resize",B),()=>{v.removeEventListener("wheel",je),v.removeEventListener("scroll",$),y.removeEventListener("scroll",X),ie.disconnect(),window.removeEventListener("resize",B)}},[]);const T=d.useRef(null),k=d.useRef(null),q=d.useRef(null),C=new Set(l),E=(v,y)=>{const O=To(m.map(L=>L.status),v,y);p(O),Eo(O),S(n("ui.projects.project_board.moved_label_column_to_position_indexof_status_1_of_length",{label:String(ae(v).label),indexOf_status____1:String(O.indexOf(v)+1),length:V(O.length,{useGrouping:!1})}))},M=(v,y)=>{const O=b.current;if(!O)return 0;let L=0;const B=O.querySelectorAll("[data-board-column]");for(const K of B){if(K.dataset.boardColumn===y)continue;const X=K.getBoundingClientRect();v>(X.left+X.right)/2&&(L+=1)}return L},h=(v,y)=>{const O=m.filter(K=>K.status!==v),L=O[y-1]?.status,B=O[y]?.status;return L&&B?n("ui.projects.project_board.between_label_and_label_2",{label:String(ae(L).label),label_2:String(ae(B).label)}):B?n("ui.projects.project_board.before_label",{label:String(ae(B).label)}):L?n("ui.projects.project_board.after_label",{label:String(ae(L).label)}):n("ui.projects.project_board.in_place")},A=(v,y)=>{const O=M(v,y.status);O!==y.over&&(y.over=O,f({status:y.status,over:O}),S(n("ui.projects.project_board.moving_label_column_it_will_drop_status_over",{label:String(ae(y.status).label),status__over:String(h(y.status,O))})))},D=()=>{k.current!==null&&(cancelAnimationFrame(k.current),k.current=null)},F=32,H=12,U=()=>{k.current=null;const v=q.current,y=x.current,O=T.current;if(!v?.armed||!y||O===null)return;const L=y.getBoundingClientRect(),B=y.scrollWidth-y.clientWidth;let K=0;if(O-L.left<F&&y.scrollLeft>0?K=-1:L.right-O<F&&y.scrollLeft<B&&(K=1),K!==0){const X=y.scrollLeft;if(y.scrollLeft=X+K*H,y.scrollLeft!==X){const $=b.current;$&&($.scrollLeft=y.scrollLeft),A(O,v)}}else A(O,v);ee(v.status,v.over),k.current=requestAnimationFrame(U)};d.useEffect(()=>()=>{k.current!==null&&cancelAnimationFrame(k.current)},[]);const Y=(v,y)=>{if(v.button===0){try{v.currentTarget.setPointerCapture(v.pointerId)}catch{}q.current={pointerId:v.pointerId,status:y,startX:v.clientX,startY:v.clientY,armed:!1,over:m.findIndex(O=>O.status===y)},T.current=v.clientX}},J=v=>{const y=q.current;if(!(!y||v.pointerId!==y.pointerId)){if(T.current=v.clientX,!y.armed){if(Math.hypot(v.clientX-y.startX,v.clientY-y.startY)<uc)return;y.armed=!0,f({status:y.status,over:y.over}),S(n("ui.projects.project_board.moving_label_column",{label:String(ae(y.status).label)})),k.current===null&&(k.current=requestAnimationFrame(U))}A(v.clientX,y)}},Z=v=>{const y=q.current;if(q.current=null,D(),f(null),!y?.armed)return;if(!v){S(n("ui.projects.project_board.move_cancelled"));return}const O=m.findIndex(L=>L.status===y.status);if(y.over===O){S("");return}E(y.status,y.over)},me=v=>{const y=q.current;!y||v.pointerId!==y.pointerId||Z(!0)},oe=()=>{Z(!1)};d.useEffect(()=>{if(!j)return;const v=y=>{y.key==="Escape"&&Z(!1)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[j!==null]);const ee=d.useCallback((v,y)=>{const O=b.current,L=x.current,B=w.current;if(!O||!L||!B)return;const K=L.getBoundingClientRect(),X=[];for(const re of O.querySelectorAll("[data-board-column]"))re.dataset.boardColumn!==v&&X.push(re.getBoundingClientRect());const $=6,je=y>=X.length?(X[X.length-1]?.right??K.left)+$:(X[y]?.left??K.right)-$,ie=L.scrollLeft,z=2,se=je-K.left+ie,xe=ie+1,fe=ie+L.clientWidth-z-1,Ie=Math.round(Math.min(Math.max(se,xe),Math.max(xe,fe)));B.style.left=`${Ie}px`},[]);d.useLayoutEffect(()=>{j&&ee(j.status,j.over)},[j,ee]);const te=(v,y)=>{if(v.key==="Enter"||v.key===" "){v.preventDefault(),S(n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column"));return}if(v.key!=="ArrowLeft"&&v.key!=="ArrowRight")return;v.preventDefault();const O=m.map(K=>K.status),L=O.indexOf(y),B=v.key==="ArrowLeft"?L-1:L+1;if(B<0||B>=O.length){S(n("ui.projects.project_board.label_column_is_already_the_last_column",{label:String(ae(y).label),the_last_column:String(B<0?n("ui.projects.project_board.the_first_column"):n("ui.projects.project_board.the_last_column"))}));return}E(y,B)};return t.jsxs("div",{className:R("[container-type:size] flex min-h-0 flex-1 flex-col",j&&"cursor-grabbing select-none"),"data-testid":"project-board",children:[t.jsx("output",{"aria-live":"polite",className:"sr-only","data-board-column-announcement":"",children:g}),t.jsx("span",{id:_r,className:"sr-only",children:n("ui.projects.project_board.drag_the_header_or_press_the_arrow_keys_to_move_this_column")}),t.jsx("div",{ref:b,"data-board-header-viewport":"",className:"h-11 shrink-0 overflow-hidden",children:t.jsx("div",{"data-board-column-row":"",className:"flex h-11 w-max gap-3 px-6",children:m.map(v=>{const y=ae(v.status);return t.jsxs("header",{"data-board-column":v.status,"data-board-column-handle":v.status,onPointerDown:O=>Y(O,v.status),onPointerMove:J,onPointerUp:me,onPointerCancel:oe,className:R("flex h-11 w-64 shrink-0 cursor-grab items-center justify-between gap-2 rounded-t-md bg-sunken px-3 active:cursor-grabbing",j?.status===v.status&&"opacity-85"),children:[t.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[t.jsx(G,{type:"button",variant:"ghost",size:"icon-sm","data-board-column-grip":v.status,"aria-label":n("ui.projects.project_board.move_label_column",{label:String(y.label)}),"aria-describedby":_r,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:O=>te(O,v.status),children:t.jsx(La,{"aria-hidden":"true"})}),t.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[t.jsx("span",{className:"truncate text-body-sm font-medium text-ink",children:y.label}),fr[v.status]&&t.jsx("span",{className:"truncate text-meta text-ink-muted",children:fr[v.status]})]})]}),t.jsx("span",{className:"text-meta text-ink-muted",children:v.projects.length})]},v.status)})})}),t.jsxs("div",{ref:x,"data-board-strip":"",className:"relative min-h-0 flex-1 overflow-auto px-6 pb-9",children:[j&&t.jsx("div",{ref:w,"aria-hidden":"true","data-board-drop-indicator":"",className:"pointer-events-none absolute top-3 bottom-3 w-0.5 rounded-full bg-accent"}),t.jsx("div",{className:"flex w-max flex-col",children:_.map(v=>t.jsxs("section",{className:"flex flex-col",children:[t.jsx("div",{"data-board-team":v.team??"",className:"sticky top-0 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:v.team==null?n("ui.projects.project_model.no_team"):c(v.team)}),t.jsx("span",{className:"shrink-0 text-ink-muted",children:v.items.length})]})}),t.jsx("div",{"data-glass-lane":"",className:"flex gap-3 rounded-md bg-sunken py-2",children:m.map(y=>{const O=v.items.filter(L=>L.status===y.status);return t.jsx("div",{"data-board-cell":y.status,className:"flex max-h-[calc(100cqh-92px)] w-64 shrink-0 flex-col gap-2 overflow-y-auto px-2",children:O.length>0&&t.jsx("ul",{className:"flex flex-col gap-2",children:O.map(L=>t.jsx("li",{children:t.jsx(pc,{project:L,nowMs:s,busy:C.has(L.id),onOpen:()=>r(L),onEdit:()=>a(L),onDelete:()=>o(L),onMove:B=>i(L,B)})},L.id))})},y.status)})})]},v.team??""))})]})]})},pc=({project:e,nowMs:s,busy:r,onOpen:a,onEdit:o,onDelete:i,onMove:l})=>{const c=I(),u=Xr(e,c),p=nt(),m=bn(),_=ye(p.data,"projects_request_update"),j=ne(e),f=d.useRef(null),[g,S]=d.useState(!1);d.useEffect(()=>{const k=f.current;if(!k)return;const q=()=>{k.isConnected&&S(k.scrollWidth-k.clientWidth>.5)},C=requestAnimationFrame(q),E=new ResizeObserver(q);return E.observe(k),document.fonts?.ready.then(q).catch(()=>{}),()=>{cancelAnimationFrame(C),E.disconnect()}},[j,g]);const b=tn(e,Ps(s)),x=xt(e.progress_updated_at,s),w=()=>{const k=window.getSelection();k&&!k.isCollapsed||a()},T=k=>{k.key!=="Enter"&&k.key!==" "||k.target===k.currentTarget&&(k.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(j)}),onClick:w,onKeyDown:T,"data-glass-block":"",className:R("group/card flex flex-col gap-2 rounded-sm bg-surface p-3","transition-colors duration-fast ease-out-quart hover:bg-elevated",b&&"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($t,{content:g?j:null,side:"top",disableHoverableContent:!0,children:t.jsx("span",{ref:f,"data-project-title":e.name,tabIndex:g?0:void 0,className:"block truncate text-body-sm font-medium text-ink",children:j})}),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(bs,{children:[t.jsx(vs,{"data-project-menu":e.id,"aria-label":n("ui.projects.project_board.actions_for_displayname",{displayName:String(j)}),disabled:r,onClick:k=>k.stopPropagation(),className:R("shrink-0 rounded-sm p-1 text-ink-muted whitespace-nowrap","hover:bg-sunken hover:text-ink"),children:r?t.jsx(Te,{size:"xs"}):t.jsx(Cr,{className:"size-4"})}),t.jsxs(ys,{align:"end",onClick:k=>k.stopPropagation(),children:[t.jsx(be,{onSelect:a,children:n("ui.projects.project_board.open")}),t.jsxs(ya,{children:[t.jsx(wa,{children:n("ui.projects.project_board.set_status")}),t.jsx(ka,{children:t.jsx(Na,{value:e.status,onValueChange:l,children:[...rs,...ns].map(k=>t.jsx(Sa,{value:k,children:ae(k).label},k))})})]}),_&&t.jsx(be,{onSelect:()=>m(e),children:n("ui.projects.project_board.request_update")}),t.jsx(Ca,{}),t.jsx(be,{onSelect:o,children:n("ui.projects.project_board.edit")}),t.jsx(be,{onSelect:i,children:n("ui.projects.project_board.delete")})]})]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[u.filter(k=>k.key!=="live").map(k=>t.jsx("span",{className:"rounded-sm bg-sunken px-1.5 py-0.5 text-meta text-ink-muted",children:k.text},k.key)),b&&t.jsx(ke,{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:fo(x)}),t.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[(e.progress_stale||!x)&&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(mc,{project:e})]})]})]})},mc=({project:e})=>{I();const[s,r]=d.useState(!1),a=Bt(),o=Ur(e.id,s),i=o.data?.links??[],l=go(e),c=ne(e);return t.jsxs(ws,{open:s,onOpenChange:r,children:[t.jsx(ks,{"data-project-sessions":e.id,"aria-label":n("ui.projects.project_board.sessions_linked_to_displayname",{displayName:String(c)}),onClick:u=>u.stopPropagation(),className:R("rounded-sm px-1 text-meta whitespace-nowrap",e.live_sessions>0?"text-success hover:bg-sunken":"text-ink-muted hover:bg-sunken"),children:l}),t.jsx(Ns,{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(G,{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),Fr(a,u.session_id))},className:R("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))})})]})},vn=({open:e,projectName:s,onClose:r,onConfirm:a})=>{I();const[o,i]=d.useState(""),[l,c]=d.useState(null),[u,p]=d.useState(!1),m=d.useId();d.useEffect(()=>{e&&(i(""),c(null),p(!1))},[e]);const _=o.trim().toLowerCase()===s.trim().toLowerCase()&&s.trim().length>0,j=async()=>{p(!0),c(null);try{await a(o.trim()),r()}catch(f){c(f instanceof Error&&f.message?f.message:n("ui.projects.project_delete_dialog.the_project_was_not_deleted"))}finally{p(!1)}};return t.jsx(_t,{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(Xe,{onClick:r,disabled:u,children:n("ui.projects.project_delete_dialog.cancel")}),t.jsxs(Gn,{onClick:()=>void j(),disabled:!_||u,children:[u&&t.jsx(Te,{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(ue,{id:`${m}-confirm`,value:o,onChange:f=>i(f.target.value),placeholder:s,"aria-label":n("ui.projects.project_delete_dialog.type_the_project_name_to_confirm"),"aria-invalid":o.length>0&&!_,autoFocus:!0}),l&&t.jsx("p",{className:"text-body-sm text-danger",children:l})]})})};function fc(e){return e==="editing"||e==="saving"||e==="error"}function _c(e,s,r=Object.is){return!r(e,s)}function jc(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 hc(e,s){return e==="saving"||e==="error"?!0:e==="editing"&&s}function gc(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 jr(e,s,r=Object.is){return!r(e,s)}const Ms="group/inline-edit",es="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",xc="relative before:absolute before:-inset-1.5 before:content-['']",bc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-left-1.5 before:right-0 before:content-['']",vc="relative before:absolute before:-top-1.5 before:-bottom-1.5 before:-right-1.5 before:left-0 before:content-['']",js=({api:e,idle:s="affordance",className:r})=>{const{phase:a,labels:o}=e,i=a==="editing"||a==="saving"||a==="error",l=hc(a,e.dirty),c=e.acceptBlocked===!0;return t.jsx("span",{"data-inline-edit-slot":a,className:R("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:R(es,bc,a==="saving"&&"cursor-default text-ink-disabled"),children:t.jsx(zt,{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(Te,{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:R(es,vc,c&&"cursor-default text-ink-disabled"),children:t.jsx(Ss,{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:R(es,xc,"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(Yn,{className:"size-3","aria-hidden":"true"})}):null})},hs=({api:e,className:s})=>{I();const{phase:r,error:a,conflict:o}=e;return r==="saved"?t.jsx("p",{"data-inline-edit-feedback":"saved",className:R("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:R("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")})]})]})},yn=d.createContext(null),yc=50,wc=({children:e})=>{const[s,r]=d.useState(""),a=d.useMemo(()=>({current:o=>{r(""),window.setTimeout(()=>r(o),yc)}}),[]);return t.jsxs(yn.Provider,{value:a,children:[e,t.jsx("span",{"data-inline-edit-announcement":"","aria-live":"polite",className:"sr-only",children:s})]})},kc=1200;function Nc(e){return e instanceof Error&&e.message?e.message:"The change was not saved."}function wt(e){const{value:s,multiline:r=!1,keyboardCommit:a=!0,selectAllOnBegin:o=!1,beginOnMount:i=!1,savedDwellMs:l=kc,labels:c}=e,u=d.useRef(e.equals??Object.is);u.current=e.equals??Object.is;const p=d.useRef(e.commit);p.current=e.commit;const m=d.useRef(e.validate);m.current=e.validate;const _=d.useRef(e.errorCopy);_.current=e.errorCopy;const j=d.useRef(e.onSettle);j.current=e.onSettle;const f=d.useRef(e.onBegin);f.current=e.onBegin;const g=d.useRef(c);g.current=c;const[S,b]=d.useState(i?"editing":"idle"),[x,w]=d.useState(s),[T,k]=d.useState(s),[q,C]=d.useState(null),[E,M]=d.useState(null),h=d.useRef(S),A=d.useRef(x),D=d.useRef(T),F=d.useRef(q),H=d.useRef(s);H.current=s;const U=d.useCallback(P=>{h.current=P,b(P)},[]),Y=d.useCallback(P=>{A.current=P,w(P)},[]),J=d.useCallback(P=>{D.current=P,k(P)},[]),Z=d.useCallback(P=>{F.current=P,C(P)},[]),me=d.useRef(null),oe=d.useRef(null),ee=d.useRef(null),te=e.editorRef??ee,v=d.useRef(te);v.current=te;const y=`${d.useId()}-inline-edit`,O=d.useContext(yn),L=d.useRef(null),B=L.current,X=B!==null&&(e.equals??Object.is)(s,B.previous)&&!(e.equals??Object.is)(s,B.saved)&&B!==null?B.saved:s,$=d.useRef(X);$.current=X,d.useEffect(()=>{const P=L.current;if(P===null)return;const ce=u.current;(ce(s,P.saved)||!ce(s,P.previous))&&(L.current=null)},[s]);const je=d.useRef(i);d.useEffect(()=>{if(S!=="editing"||!je.current)return;je.current=!1;const P=v.current.current;P&&(P.focus(),o&&(P instanceof HTMLInputElement||P instanceof HTMLTextAreaElement)&&P.select())},[S,o]);const ie=d.useRef(!1);d.useEffect(()=>{ie.current&&(S!=="idle"&&S!=="saved"||(ie.current=!1,oe.current?.focus()))});const z=d.useRef(null),se=d.useCallback(()=>{z.current!==null&&(clearTimeout(z.current),z.current=null)},[]);d.useEffect(()=>()=>se(),[se]);const xe=d.useRef(S);d.useEffect(()=>{const P=xe.current;if(xe.current=S,P==="saving"&&S==="saved"){j.current?.("saved");return}(P==="editing"||P==="error")&&S==="idle"&&j.current?.("cancelled")},[S]),d.useEffect(()=>{const P=gc({phase:h.current,base:D.current,draft:A.current,fresh:$.current,equals:u.current});P==="adopt"?(u.current(D.current,$.current)||J($.current),u.current($.current,A.current)||Y($.current)):P==="conflict"&&(F.current===null||!u.current(F.current,$.current))&&Z($.current)},[s,S,J,Y,Z]);const fe=d.useCallback(P=>{Z(null),M(null),Y(D.current),U("idle"),P&&(ie.current=!0)},[Z,Y,U]),Ie=d.useCallback(()=>{h.current!=="saving"&&(h.current==="idle"||h.current==="saved"||(se(),fe(!0)))},[se,fe]),re=d.useCallback((P,ce=!0)=>{const lt=h.current;if(lt==="saving"||lt==="saved"||F.current!==null)return;const Ne=P!==void 0?P:A.current;if(!jr(D.current,Ne,u.current)){fe(ce&&lt!=="idle");return}const Ct=m.current?.(Ne)??null;if(Ct!==null){U("error"),M(Ct);return}Y(Ne),M(null),U("saving"),p.current(Ne).then(()=>{h.current==="saving"&&(L.current={saved:Ne,previous:D.current},J(Ne),Y(Ne),ce&&(ie.current=!0),U("saved"),se(),z.current=setTimeout(()=>{z.current=null,h.current==="saved"&&U("idle")},l),O?.current?.(g.current.saved))},Ke=>{h.current==="saving"&&(U("error"),M(_.current?_.current(Ke):Nc(Ke)))})},[O,se,fe,l,J,Y,U]),De=d.useCallback(()=>{h.current==="editing"||h.current==="saving"||(se(),je.current=!0,Y($.current),J($.current),Z(null),M(null),U("editing"),f.current?.())},[se,J,Z,Y,U]),Ye=d.useCallback(()=>{const P=F.current;P!==null&&(Z(null),J(P),re())},[re,J,Z]),Wt=d.useCallback(()=>{const P=F.current;P!==null&&(J(P),fe(!0))},[fe,J]),it=d.useCallback(P=>{const ce=jc(P,{multiline:r,keyboardCommit:a,onEditor:P.target===v.current.current});if(ce==="revert"){P.preventDefault(),Ie();return}ce==="accept"&&(P.preventDefault(),re())},[re,Ie,a,r]),ct=d.useCallback(P=>{if(h.current!=="editing")return;const ce=P.relatedTarget;if(!(ce!==null&&me.current?.contains(ce))&&!(ce instanceof Element&&ce.closest("[data-radix-popper-content-wrapper]")!==null)&&F.current===null){if(!jr(D.current,A.current,u.current)){fe(!1);return}re(void 0,!1)}},[re,fe]),St=S==="saved"?x:X;return{phase:S,dirty:_c(T,x,u.current),conflict:q,error:E,draft:x,setDraft:Y,displayValue:St,editing:fc(S),begin:De,accept:re,cancel:Ie,keepMine:Ye,useTheirs:Wt,handleKeyDown:it,handleBlur:ct,fieldProps:{onKeyDown:it,onBlur:ct,"aria-busy":S==="saving"?!0:void 0},editorAria:{"aria-invalid":E!==null?!0:void 0,"aria-describedby":E!==null||q!==null?y:void 0},fieldRef:me,editorRef:te,slotRef:oe,feedbackId:y,labels:c}}const Sc=/^(https?:|mailto:)/i,Cc={a:({href:e,children:s})=>typeof e=="string"&&Sc.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},rt=d.memo(({children:e,className:s})=>t.jsx("div",{className:R("lo-markdown",s),children:t.jsx(Kn,{remarkPlugins:[Wn],components:Cc,children:e})})),hr=`## Summary
28
+
29
+ ## Goals
30
+
31
+ ## Notes`,Ec=new RegExp("\\p{Mn}","gu"),Tc=/[^a-z0-9._-]+/g,Rc=/[._-]{2,}/g,Dc=/^[^a-z0-9]+/,gr=/[^a-z0-9]+$/;function Ac(e){return e.normalize("NFKD").replace(Ec,"").toLowerCase().replace(Tc,"-").replace(Rc,"-").replace(Dc,"").replace(gr,"").slice(0,64).replace(gr,"")}const Pc=/&#x([0-9a-f]+);/gi,Oc=/&#(\d+);/g,Mc=/&nbsp;/g,Ic=/&lt;/g,Lc=/&gt;/g,Fc=/&quot;/g,qc=/&#39;|&apos;/g,Bc=/&amp;/g,xr=e=>e.replace(Pc,(s,r)=>String.fromCodePoint(Number.parseInt(r,16))).replace(Oc,(s,r)=>String.fromCodePoint(Number.parseInt(r,10))).replace(Mc," ").replace(Ic,"<").replace(Lc,">").replace(Fc,'"').replace(qc,"'").replace(Bc,"&"),Uc=/<[^>]*>|[^<]+/g,$c=/^<\//,zc=/^<\/?\s*([a-zA-Z][a-zA-Z0-9]*)/,Gc=/\s+/g,br=/class="[^"]*language-([\w+-]+)/,Yc=/href="([^"]*)"/,Kc=/src="([^"]*)"/,Hc=/alt="([^"]*)"/,Wc=/[ \t]+\n/g,Vc=/\n{3,}/g;function Xc(e){const s=[],r=(...p)=>{for(let m=s.length-1;m>=0;m--)if(p.includes(s[m].tag)){const[_]=s.splice(m,1);return _}},a=[],o=()=>s.some(p=>p.tag==="pre"),i=()=>s.filter(p=>p.tag==="blockquote").length;let l=!0;const c=p=>{p&&(i()>0&&l&&!o()&&a.push("> ".repeat(i())),a.push(p),l=p.endsWith(`
32
+ `))},u=e.match(Uc)??[];for(let p=0;p<u.length;p++){const m=u[p];if(!m.startsWith("<")){c(o()?xr(m):xr(m).replace(Gc," "));continue}const _=$c.test(m),j=(m.match(zc)?.[1]??"").toLowerCase();if(_){switch(j){case"p":case"div":c(`
33
+
34
+ `);break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":r(j),c(`
35
+
36
+ `);break;case"li":{r("li"),c(`
37
+ `);const f=[...s].reverse().find(g=>g.tag==="ul"||g.tag==="ol");f?.ordered&&(f.index=(f.index??1)+1);break}case"ul":case"ol":r(j),c(`
38
+ `);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 f=r("a");f?.href&&c(`](${f.href})`);break}case"blockquote":r("blockquote")&&c(`
39
+ `);break}continue}switch(j){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{const f=Number(j[1]);s.push({tag:j}),c(`${"#".repeat(f)} `);break}case"ul":case"ol":s.push({tag:j,ordered:j==="ol",index:1});break;case"li":{const f=[...s].reverse().find(g=>g.tag==="ul"||g.tag==="ol");s.push({tag:"li"}),f?.ordered?c(`${f.index??1}. `):c("- ");break}case"strong":case"b":s.push({tag:j}),c("**");break;case"em":case"i":s.push({tag:j}),c("*");break;case"del":case"s":s.push({tag:j}),c("~~");break;case"code":{const f=s[s.length-1]?.tag!=="pre";s.push({tag:"code",inline:f}),f&&c("`");break}case"pre":{const f=m.match(br)?.[1]??u[p+1]?.match(br)?.[1]??"";s.push({tag:"pre"}),c(`
40
+ \`\`\`${f}
41
+ `);break}case"a":{const f=m.match(Yc)?.[1]??"";s.push({tag:"a",href:f}),f&&c("[");break}case"img":{const f=m.match(Kc)?.[1]??"",g=m.match(Hc)?.[1]??"";f&&c(`![${g}](${f})`);break}case"br":c(`
42
+ `);break;case"blockquote":s.push({tag:"blockquote"});break}}return a.join("").replace(Wc,`
43
+ `).replace(Vc,`
44
+
45
+ `).trim()}function wn(e,s,r){const a=e.clipboardData?.getData("text/html");if(!a)return;const o=Xc(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 p=l+o.length;u.setSelectionRange(p,p)})}const kn=({open:e,refusal:s,projectLabel:r,onClose:a,onConfirm:o,secondaryLabel:i,onSecondary:l})=>{I();const[c,u]=d.useState(!1),[p,m]=d.useState(null),_=d.useRef(!1),j=d.useRef(null);d.useEffect(()=>{e&&(u(!1),m(null),_.current=!1)},[e]);const f=async()=>{if(!_.current){_.current=!0,u(!0),m(null);try{await o(),a()}catch(S){m({copy:_n(S),gone:fn(S)})}finally{_.current=!1,u(!1)}}},g=s?.names??[];return t.jsx(_t,{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:S=>{c&&S.preventDefault()},onInteractOutside:S=>{c&&S.preventDefault()},onOpenAutoFocus:S=>{S.preventDefault(),j.current?.focus()}},actions:t.jsxs("div",{className:"flex w-full min-w-0 flex-wrap justify-end gap-2",children:[t.jsx(Xe,{ref:j,onClick:a,disabled:c,children:n("ui.projects.project_done_anyway_dialog.cancel")}),!p?.gone&&t.jsx(Xe,{onClick:l,disabled:c,children:i}),p?.gone?t.jsx(Dt,{"data-project-force-close":"",onClick:a,children:n("ui.projects.project_done_anyway_dialog.close")}):t.jsxs(Dt,{"data-project-force-done":"","aria-disabled":c,className:"aria-disabled:pointer-events-none aria-disabled:bg-sunken aria-disabled:text-ink-disabled",onClick:()=>void f(),children:[c?t.jsx(Te,{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?Vo(s):""}),g.length>Tt+1&&t.jsx("div",{className:"px-1.5",children:t.jsx(Er,{summary:n("ui.projects.project_done_anyway_dialog.show_all_length_open_milestones",{length:g.length}),children:t.jsx("ul",{"data-project-open-milestones":"",className:"flex flex-col gap-1 py-1 text-body-sm text-ink-muted",children:g.map((S,b)=>t.jsx("li",{className:"break-words",children:S},`${b}-${S}`))})})}),t.jsx("p",{role:"alert",className:"min-h-[1lh] text-body-sm text-danger break-words",children:p?.copy??""})]})})},Nn=({status:e})=>{const s=ae(e);return t.jsxs(ke,{variant:s.variant,children:[lo(e)&&t.jsx(Ss,{"aria-hidden":!0}),s.label]})},Jc="project-key",Qc="project-key";function ge(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 Ht=({field:e,fieldRef:s,fieldProps:r,editing:a,label:o,bare:i=!1,display:l,editor:c,slot:u,feedback:p,controlsIdle:m="affordance",hug:_=!1,feedbackExtra:j,className:f,controlsClassName:g})=>t.jsxs("div",{ref:s,...r,"data-project-field":e,className:R(!i&&Ms,"min-w-0",o!==void 0&&"flex items-start gap-3",f),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:R("flex min-w-0 flex-col gap-1",_&&"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:R("min-w-0",_?"w-fit":"flex-1",!a&&"cursor-text"),onDoubleClick:a?void 0:u.begin,children:a?c:l}),t.jsx(js,{api:u,idle:m,className:R("shrink-0",g)})]}),t.jsx("div",{className:R("min-h-[1lh] text-meta",_&&"max-w-96"),children:t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx(hs,{api:p}),j]})})]})]}),qe=({field:e,value:s,display:r,commitFields:a,validate:o,labels:i,commit:l,placeholder:c,mono:u=!1,ramp:p="text-body-sm",label:m,bare:_=!1,autoBegin:j=!1,maxLength:f,onRetire:g,className:S,controlsClassName:b})=>{const[x,w]=d.useState(j);d.useEffect(()=>{x&&s!==""&&(w(!1),g?.("filled"))},[x,s,g]);const T=wt({value:s,commit:async k=>{await l(a(k))},equals:(k,q)=>k.trim()===q.trim(),validate:o,labels:i,selectAllOnBegin:!0,beginOnMount:j,errorCopy:ot,onSettle:k=>{k==="cancelled"&&(w(!1),g?.("cancelled"))}});return!x&&s===""?null:t.jsx(Ht,{field:e,fieldRef:T.fieldRef,fieldProps:T.fieldProps,editing:T.editing,label:m,bare:_,display:r,slot:T,feedback:T,className:S,controlsClassName:b,editor:t.jsx(ue,{ref:T.editorRef,...T.editorAria,value:T.draft,readOnly:T.phase==="saving",maxLength:f,placeholder:c,"aria-label":i.name,onChange:k=>T.setDraft(k.target.value),spellCheck:!1,autoComplete:"off",className:R("h-8",u?"font-mono text-mono-sm":p)})})},Zc=({project:e,commit:s})=>{I();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:R(Ms,"flex min-w-0 flex-col gap-0.5"),children:[r?t.jsx(qe,{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=>ls(c),labels:ge("title",n("ui.projects.project_editors.title")),commit:s,maxLength:Pt,placeholder:n("ui.projects.project_editors.a_short_name_for_the_workstream"),ramp:"text-body",bare:!0,controlsClassName:"self-center"}):t.jsx(qe,{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=>ss(c.trim()),labels:ge("key",n("ui.projects.project_editors.key")),commit:s,maxLength:ir,placeholder:Jc,ramp:"text-body",bare:!0,controlsClassName:"self-center"}),!r&&(a?t.jsx(qe,{field:"title",value:"",display:null,commitFields:c=>({title:c.trim()}),validate:c=>ls(c),labels:ge("title",n("ui.projects.project_editors.title")),commit:s,maxLength:Pt,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:R("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(qe,{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=>ss(c.trim()),labels:ge("key",n("ui.projects.project_editors.key")),commit:s,maxLength:ir,placeholder:Qc,mono:!0})]})},el=({project:e,commit:s})=>{I();const[r,a]=d.useState(!1),o=nt(),i=ye(o.data,"projects_force_done"),[l,c]=d.useState(null),[u,p]=d.useState(null),m=d.useRef(!1),_=d.useRef(!1),j=d.useRef(null),f=wt({value:e.status,commit:async b=>{const x=m.current;m.current=!1,c(null);try{const w=await s({status:b},x?{forceDone:!0}:void 0);x&&ve(nn(w,l?.count??0,ae(b).label)),j.current?.resolve()}catch(w){throw c(jn(w)),j.current?.reject(w),w}finally{j.current=null}},labels:ge("status",n("ui.projects.project_editors.status")),keyboardCommit:!1,errorCopy:ot,onBegin:()=>a(!0)}),g=i&&f.phase==="error"&&l!==null&&l.coded;d.useEffect(()=>{if(!_.current||f.phase!=="idle"&&f.phase!=="saved")return;_.current=!1;const b=document.querySelector("[data-project-milestones]");b&&(b.scrollIntoView({block:"start"}),b.querySelector("[data-project-milestones-heading]")?.focus({preventScroll:!0}))},[f.phase]);const S=()=>new Promise((b,x)=>{if(f.phase!=="error"||f.conflict!==null){x(new Error(""));return}if(!f.dirty){b();return}m.current=!0,j.current={resolve:b,reject:x},f.accept(f.draft,!0)});return t.jsx(Ht,{field:"status",fieldRef:f.fieldRef,fieldProps:f.fieldProps,editing:f.editing,display:t.jsx(Nn,{status:e.status}),slot:f,feedback:f,hug:!0,feedbackExtra:t.jsxs(t.Fragment,{children:[g&&t.jsx(G,{variant:"ghost",size:"sm","data-project-force-done-door":"",onClick:()=>p(l),children:n("ui.projects.project_editors.mark_done_anyway")}),t.jsx(kn,{open:u!==null,refusal:u,projectLabel:ne(e),onClose:()=>p(null),onConfirm:S,secondaryLabel:n("ui.projects.project_editors.review_milestones"),onSecondary:()=>{p(null),_.current=!0,f.cancel()}})]}),editor:t.jsxs(Je,{open:r,onOpenChange:a,value:f.draft,onValueChange:b=>{a(!1),f.accept(b)},children:[t.jsx(Qe,{ref:f.editorRef,...f.editorAria,"aria-label":n("ui.projects.project_editors.status"),"data-project-status":"",className:"h-7 w-fit min-w-36",children:t.jsx(Ze,{})}),t.jsx(et,{children:Yr.map(b=>t.jsx(Oe,{value:b.value,"data-project-status-option":b.value,children:b.label},b.value))})]})})},tl=({project:e,commit:s})=>{I();const[r,a]=d.useState(!1),o=d.useRef(null),i=d.useRef(null),l=wt({value:e.description,commit:async p=>{await s({description:p.trim()})},equals:(p,m)=>p.trim()===m.trim(),validate:p=>pn(p),multiline:!0,labels:ge("description",n("ui.projects.project_editors.description")),errorCopy:ot,editorRef:o,onSettle:p=>{p==="cancelled"&&!e.description.trim()&&setTimeout(()=>i.current?.focus(),0)}});d.useEffect(()=>{if(r||!l.editing)return;const p=setTimeout(()=>o.current?.focus(),0);return()=>clearTimeout(p)},[r,l.editing]);const u=(l.editing?l.draft:l.displayValue).length>tt;return t.jsx("div",{ref:l.fieldRef,...l.fieldProps,"data-project-field":"description",className:R(Ms,"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(p=>t.jsx("button",{type:"button","data-project-description-mode":p,"aria-pressed":r===(p==="preview"),onClick:()=>a(p==="preview"),className:R("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink",r===(p==="preview")&&"bg-surface text-ink"),children:p==="write"?n("ui.projects.project_editors.write"):n("ui.projects.project_editors.preview")},p))})]}),t.jsx(js,{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(rt,{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(Or,{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:p=>l.setDraft(p.target.value),onPaste:p=>wn(p,o,m=>l.setDraft(m)),className:"h-40 resize-none"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsx(hs,{api:l}),t.jsxs("p",{className:R("shrink-0 text-meta tabular-nums",u?"text-danger":"text-ink-muted"),children:[l.draft.length,"/",tt]})]})]}):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(rt,{className:"text-body",children:e.description??""})}),t.jsx(js,{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(hs,{api:l})})]})})},sl=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>(I(),t.jsx(qe,{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=>Mt(o,"owner"),labels:ge("owner",n("ui.projects.project_editors.owner")),commit:s,maxLength:Ot,placeholder:n("ui.projects.examples.owner"),autoBegin:r,onRetire:a})),rl=({project:e,commit:s,label:r=null,autoBegin:a=!1,onRetire:o})=>(I(),t.jsx(qe,{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=>Mt(i,"team"),labels:ge("team",n("ui.projects.project_editors.team")),commit:s,maxLength:Ot,placeholder:n("ui.projects.examples.team"),autoBegin:a,onRetire:o})),vr=({project:e,commit:s,which:r,nowMs:a,autoBegin:o=!1,onRetire:i})=>{const l=r==="start"?e.start_date??"":e.target_date??"",c=I(),u=Me(l,c,new Date(a)),p=r==="start"?n("ui.projects.project_editors.start"):n("ui.projects.project_editors.target");return t.jsx(qe,{field:r==="start"?"start-date":"target-date",value:l,label:p,display:t.jsx("span",{className:"text-body-sm text-ink",children:u}),commitFields:m=>r==="start"?{start_date:m}:{target_date:m},validate:m=>{const _=us(m);return _||(r==="start"?ds(m,e.target_date??""):ds(e.start_date??"",m))},labels:ge(n("ui.projects.project_editors.tolowercase_date",{toLowerCase:String(p.toLowerCase())}),p),commit:s,placeholder:"YYYY-MM-DD",autoBegin:o,onRetire:i})},nl=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{I();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=wt({value:{number:e.estimate===null?"":String(e.estimate),unit:o.unit},equals:Yi,commit:async p=>{const m=Hi(o,p);m&&await s(m)},validate:p=>mn(p.number),labels:ge("estimate",n("ui.projects.project_editors.estimate")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:ot,onSettle:p=>{p==="cancelled"&&(l(!1),a?.("cancelled"))}});if(!i&&e.estimate===null)return null;const u=Wr(e.estimate,e.estimate_unit)||"—";return t.jsx(Ht,{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(ue,{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:p=>c.setDraft({...c.draft,number:p.target.value}),className:"h-8 max-w-24"}),t.jsxs(Je,{value:c.draft.unit,onValueChange:p=>c.setDraft({...c.draft,unit:p}),children:[t.jsx(Qe,{"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(Ze,{})}),t.jsxs(et,{children:[t.jsx(Oe,{value:"points",children:n("ui.projects.project_editors.points")}),t.jsx(Oe,{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")})]})})},al=({project:e,commit:s,autoBegin:r=!1,onRetire:a})=>{I();const[o,i]=d.useState(r);d.useEffect(()=>{o&&e.tags.length>0&&(i(!1),a?.("filled"))},[o,e.tags,a]);const l=wt({value:e.tags.join(", "),equals:(u,p)=>Ki(ft(u),p),commit:async u=>{const{tags:p}=ps(u);await s({tags:p})},validate:u=>ps(u).error,labels:ge("tags",n("ui.projects.project_editors.tags")),selectAllOnBegin:!0,beginOnMount:r,errorCopy:ot,onSettle:u=>{u==="cancelled"&&(i(!1),a?.("cancelled"))}});if(!o&&e.tags.length===0)return null;const c=l.editing?ft(l.draft):e.tags;return t.jsx(Ht,{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(ke,{variant:"outline",children:u},u))}),slot:l,feedback:l,editor:t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(ue,{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(ke,{variant:"outline",children:u},u))})]})})},ol="project-quick-send:no-target",il=[],cl=({links:e,target:s,onTargetChange:r,onSend:a,focusTick:o})=>{I();const i=d.useRef(null),l=Vn(),{frontend:c,refresh:u}=Ka(),[p,m]=d.useState(!1),_=nt(),j=s??ol;d.useEffect(()=>{s&&u(s)},[s,u]),d.useEffect(()=>{o>0&&i.current?.focusInput()},[o]);const f=e.filter(b=>b.exists),S=(f.find(b=>b.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(Je,{value:s??void 0,onValueChange:b=>r(b),children:[t.jsx(Qe,{"aria-label":n("ui.projects.project_quick_send.select_the_session_to_message"),className:"max-w-72",children:t.jsx(Ze,{placeholder:n("ui.projects.project_quick_send.no_session_selected")})}),t.jsx(et,{children:f.map(b=>t.jsx(Oe,{value:b.session_id,children:Kt(b)},b.session_id))})]}),p?t.jsx("span",{role:"status",className:"text-meta text-ink-muted",children:n("ui.projects.project_quick_send.sending")}):S?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(Xn,{ref:i,conversationId:j,messages:il,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:ye(_.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(b,x)=>{if(!s)return!1;m(!0);try{return await a(s,b,S?"steer":"prompt",x)}finally{m(!1),i.current?.focusInput({preventScroll:!0})}}})]})},ll=({links:e,busy:s,onUnlink:r,onLink:a,onQuickSend:o,onStartSession:i})=>{I();const l=Bt(),c=At(x=>x.sessions),[u,p]=d.useState(!1),[m,_]=d.useState(null),[j,f]=d.useState(0),g=m&&e.some(x=>x.session_id===m&&x.exists)?m:$o(e),S=d.useMemo(()=>{const x=new Set(e.map(w=>w.session_id));return c.filter(w=>!x.has(w.session_id)).map(w=>({id:w.session_id,name:w.title||w.session_id,description:w.cwd??void 0}))},[c,e]),b=x=>{At.getState().openSession(x).then(w=>{w&&l(`/chat/${x}`)})};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(G,{variant:"secondary",size:"sm",disabled:s,onClick:i,"data-tour-tag":"project-start-session",children:[t.jsx(Fa,{}),n("ui.projects.project_links.new_session")]}),t.jsxs(G,{variant:"secondary",size:"sm",disabled:s,onClick:()=>p(!0),"data-tour-tag":"project-link-session",children:[t.jsx(qa,{}),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(x=>{const w=xo(x),T=bo(x.subagents),k=vo(x.todos),q=x.title||x.session_id,C=x.exists;return t.jsxs("li",{"data-glass-block-row":"",className:R("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&&b(x.session_id)},className:R("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:R("min-w-0 truncate text-body-sm",x.title?"text-ink":"font-mono text-mono-sm text-ink-muted"),children:q})}),x.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}),k&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:k}),t.jsx(ke,{variant:w.variant,children:w.label}),C&&t.jsx(G,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.message_title",{title:String(q)}),title:n("ui.projects.project_links.message_title",{title:String(q)}),onClick:()=>{_(x.session_id),f(E=>E+1)},children:t.jsx(Ba,{})}),t.jsx(G,{variant:"ghost",size:"icon-sm",disabled:s,"aria-label":n("ui.projects.project_links.unlink_title",{title:String(q)}),onClick:()=>r(x.session_id),children:t.jsx(to,{})})]},x.session_id)})}),e.some(x=>x.exists)&&t.jsx(cl,{links:e,target:g,onTargetChange:_,onSend:o,focusTick:j}),t.jsx(_t,{open:u,onClose:()=>p(!1),title:n("ui.projects.project_links.link_a_session"),maxWidth:"sm",dataTourTag:"project-link-dialog",actions:t.jsx(Xe,{onClick:()=>p(!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(pe,{children:n("ui.projects.project_links.session")}),t.jsx(Mr,{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:S,selected:null,onSelect:x=>{p(!1),a(x.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")})]})})]})},ul=({milestones:e,summary:s,busy:r,onToggle:a,onRemove:o,onAdd:i})=>{const[l,c]=d.useState(""),[u,p]=d.useState(""),m=I(),_=!Kr.test(u.trim()),j=l.trim().length>0&&!_&&!r,f=()=>{j&&(i(l.trim(),u.trim()),c(""),p(""))};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(g=>{const S=po(g.status),b=g.completed_at!==null;return t.jsxs("li",{className:"flex items-center gap-3 rounded-sm px-2 py-2",children:[t.jsx(Ir,{checked:b,disabled:r,onCheckedChange:x=>a(g.name,x===!0),"aria-label":b?n("ui.projects.project_milestones.mark_name_not_complete",{name:String(g.name)}):n("ui.projects.project_milestones.mark_name_complete",{name:String(g.name)})}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-body-sm text-ink",children:g.name}),g.target_date&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted",children:Me(g.target_date,m)}),t.jsx(ke,{variant:S.variant,children:S.label}),t.jsx(G,{variant:"ghost",size:"icon-sm",disabled:r,"aria-label":n("ui.projects.project_milestones.remove_name",{name:String(g.name)}),onClick:()=>o(g.name),children:t.jsx(zt,{})})]},g.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(pe,{htmlFor:"project-milestone-name",children:n("ui.projects.project_milestones.new_milestone")}),t.jsx(ue,{id:"project-milestone-name",value:l,onChange:g=>c(g.target.value),placeholder:n("ui.projects.project_milestones.beta_cut"),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),f())}})]}),t.jsxs("div",{className:"flex w-40 flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:"project-milestone-date",children:n("ui.projects.project_milestones.target_date")}),t.jsx(ue,{id:"project-milestone-date",value:u,onChange:g=>p(g.target.value),placeholder:"YYYY-MM-DD","aria-invalid":_}),_&&t.jsx("p",{className:"text-meta text-danger",children:n("ui.projects.project_milestones.dates_are_yyyy_mm_dd_or_empty")})]}),t.jsxs(G,{variant:"secondary",disabled:!j,onClick:f,"data-tour-tag":"project-milestone-add",children:[t.jsx(pt,{}),n("ui.projects.project_milestones.add")]})]})]})},dl=[{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")}}],yr=({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})]}),pl=({project:e,nowMs:s,commit:r,teamLabel:a=null})=>{const o=I(),i=new Date(s),[l,c]=d.useState(null),u=d.useRef(null),p=d.useRef(!1),m={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},_=(E,M)=>{c(h=>h===E?null:h),M==="cancelled"&&!m[E]&&setTimeout(()=>u.current?.focus(),0)},j=dl.filter(({field:E})=>!m[E]&&l!==E),f=Me(e.completed_at,o,i),g=e.updated_at>0?bt(xt(e.updated_at,s)):"",S=e.updated_at>0?Jn(new Date(e.updated_at*1e3),{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"},o):"",b=m.owner||l==="owner",x=m.team||l==="team",w=m.start||l==="start",T=m.target||l==="target",k=m.estimate||l==="estimate",q=m.tags||l==="tags",C=b||x||w||T||!!f||k||q||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")}),j.length>0&&t.jsxs(bs,{children:[t.jsx(vs,{asChild:!0,children:t.jsxs("button",{ref:u,type:"button","data-project-add-field":"",className:R("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(pt,{className:"size-3","aria-hidden":"true"}),n("ui.projects.project_properties.add")]})}),t.jsx(ys,{align:"end",onCloseAutoFocus:E=>{p.current&&(p.current=!1,E.preventDefault())},children:j.map(({field:E,label:M})=>t.jsx(be,{"data-project-add-option":E,onSelect:()=>{p.current=!0,c(E)},children:M},E))})]})]}),C?t.jsxs("dl",{className:"flex flex-col gap-2",children:[b&&t.jsx(sl,{project:e,commit:r,autoBegin:l==="owner",onRetire:E=>_("owner",E)}),x&&t.jsx(rl,{project:e,commit:r,label:a,autoBegin:l==="team",onRetire:E=>_("team",E)}),w&&t.jsx(vr,{project:e,commit:r,which:"start",nowMs:s,autoBegin:l==="start",onRetire:E=>_("start",E)}),T&&t.jsx(vr,{project:e,commit:r,which:"target",nowMs:s,autoBegin:l==="target",onRetire:E=>_("target",E)}),f&&t.jsx(yr,{label:n("ui.projects.project_properties.completed"),children:f}),k&&t.jsx(nl,{project:e,commit:r,autoBegin:l==="estimate",onRetire:E=>_("estimate",E)}),q&&t.jsx(al,{project:e,commit:r,autoBegin:l==="tags",onRetire:E=>_("tags",E)}),e.updated_at>0&&t.jsx(yr,{label:n("ui.projects.project_properties.updated"),children:t.jsx("time",{dateTime:new Date(e.updated_at*1e3).toISOString(),title:S,children:g})})]}):t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_properties.no_dates_estimate_tags_owner_or_team_yet")})]})},ml=({project:e})=>{I();const s=nt(),r=bn(),{sending:a,cooling:o,cooldownRemainingMs:i}=cc(e.id);if(!ye(s.data,"projects_request_update"))return null;const l=ne(e),c=Zi(e.id);return t.jsxs(t.Fragment,{children:[t.jsx($t,{content:o&&i!==null?It(l,i):n("ui.projects.request_update.ask_the_sessions_linked_to_this_project_to_post_a_progress_update"),children:t.jsxs(G,{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(Te,{size:"sm"}):o?t.jsx(Ss,{}):t.jsx(Qa,{}),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:It(l,i)})]})},Sn="plain",Cn=e=>`team:${e}`,En=e=>`agent:${e}`;function fl(e){return e.startsWith("team:")?{kind:"team",name:e.slice(5)}:e.startsWith("agent:")?{kind:"agent",name:e.slice(6)}:{kind:"plain"}}function _l(e){return e.kind==="team"?Cn(e.name):e.kind==="agent"?En(e.name):Sn}const wr={kind:"plain"},jl=({open:e,onClose:s,onStart:r,teamsEnabled:a,profilesEnabled:o})=>{I();const[i,l]=d.useState(wr),[c,u]=d.useState(null),[p,m]=d.useState(!1),_=Qn(e&&a),j=Zn(e&&o);d.useEffect(()=>{e&&(l(wr),u(null),m(!1))},[e]);const f=d.useMemo(()=>{const w=[{id:Sn,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 _.data??[])w.push({id:Cn(T.name),name:Ys(T),keywords:T.name===Ys(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(j.data??[]).filter(k=>k.source!=="builtin"))w.push({id:En(T.name),name:T.name,description:T.description||T.kind,get group(){return n("ui.projects.project_start_session.agents")}});return w},[_.data,j.data]),g=f.find(w=>w.id===_l(i))??f[0],S=!a||!o,b=_.isLoading||j.isLoading,x=async()=>{m(!0),u(null);try{await r(i),s()}catch(w){u(w instanceof Error&&w.message?w.message:n("ui.projects.project_start_session.the_session_could_not_be_started"))}finally{m(!1)}};return t.jsx(_t,{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(Xe,{onClick:s,disabled:p,children:n("ui.projects.project_start_session.cancel")}),t.jsxs(Dt,{onClick:()=>void x(),disabled:p,children:[p&&t.jsx(Te,{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(Mr,{label:n("ui.projects.project_start_session.work_with"),placeholder:n("ui.projects.project_start_session.search_teams_and_agents"),options:f,selected:g,onSelect:w=>l(fl(w.id)),busy:b,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")}),S&&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})]})})},hl=({links:e})=>{I();const s=Uo(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:Zs(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:Kt(a)}),a.todos&&t.jsx("span",{className:"shrink-0 text-meta text-ink-muted tabular-nums",children:Zs(a.todos)})]},a.session_id))})]})},Is=({filePath:e,tooltip:s="File actions",icon:r,"aria-label":a="File actions",onShowInCanvas:o,onPreview:i})=>{const l=async()=>{if(e)try{await navigator.clipboard.writeText(e),ve("File path copied to clipboard")}catch(u){console.error("Failed to copy file path: ",u),de("Failed to copy file path")}},c=()=>{e&&window.api.openFile(e)};return t.jsxs(bs,{children:[t.jsx($t,{content:s,children:t.jsx(vs,{asChild:!0,children:t.jsx(G,{variant:"ghost",size:"icon-sm","aria-label":a,onClick:u=>u.stopPropagation(),children:r??t.jsx(Cr,{"aria-hidden":"true"})})})}),t.jsxs(ys,{align:"end",className:"min-w-45",onClick:u=>u.stopPropagation(),children:[i&&t.jsxs(be,{onSelect:i,children:[t.jsx(Ua,{"aria-hidden":"true"}),t.jsx("span",{children:"Preview"})]}),o&&t.jsxs(be,{onSelect:o,children:[t.jsx(ea,{"aria-hidden":"true"}),t.jsx("span",{children:"Show in canvas"})]}),t.jsxs(be,{onSelect:c,children:[t.jsx(ta,{"aria-hidden":"true"}),t.jsx("span",{children:"Open file"})]}),t.jsxs(be,{onSelect:()=>window.api.showItemInFolder(e),children:[t.jsx(sa,{"aria-hidden":"true"}),t.jsx("span",{children:"Open folder"})]}),t.jsxs(be,{onSelect:l,children:[t.jsx(ra,{"aria-hidden":"true"}),t.jsx("span",{children:"Copy file path"})]})]})]})},gl=/[/\\]/,xl=e=>{if(e.name)return e.name;const s=e.path.split(gl);return s[s.length-1]||e.path},bl="h-[min(90vh,calc(100vh-104px))] w-[min(760px,calc(100vw-104px))] max-w-none gap-0 p-0",Tn=({open:e,attachment:s,onClose:r,restoreFocusTo:a})=>{I(),Ea(e,"project-file-preview");const[o,i]=d.useState({status:"loading"}),l=s?.path??null,c=s?Tr(s.name||s.path):!1;d.useEffect(()=>{if(!e||l===null)return;let p=!0;i({status:"loading"});const m=window.api?.readFile;if(typeof m!="function"){i({status:"unavailable"});return}return(async()=>{try{const _=await m(l);if(!p)return;if(!_.success){console.error("Project file preview failed",_.error),i({status:"error"});return}i({status:"ready",text:_.data})}catch(_){if(!p)return;console.error("Project file preview failed",_),i({status:"error"})}})(),()=>{p=!1}},[e,l]);const u=s?xl(s):"";return t.jsx(Ta,{open:e,onOpenChange:p=>!p&&r(),children:t.jsxs(Ra,{className:bl,onCloseAutoFocus:p=>{const m=a?.current;m&&(p.preventDefault(),m.focus())},children:[t.jsx("div",{className:"shrink-0 border-hairline border-b px-4 py-3 pr-12",children:t.jsx(Da,{className:"truncate text-title",title:l??"",children:u})}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-3","data-project-file-preview":"",children:o.status==="loading"?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_updates.preview_loading")}):o.status==="unavailable"?t.jsx("p",{className:"text-body-sm text-ink-muted",children:n("ui.projects.project_updates.preview_unavailable")}):o.status==="error"?t.jsxs("div",{className:"flex flex-col gap-1 text-body-sm text-ink-muted",children:[t.jsx("p",{children:n("ui.projects.project_updates.preview_failed")}),t.jsx("p",{children:n("ui.projects.project_updates.preview_moved")})]}):c?t.jsx(rt,{children:o.text}):t.jsx("pre",{className:"whitespace-pre-wrap font-mono text-ink text-mono-sm",children:o.text})})]})})};Tn.displayName="ProjectFilePreviewDialog";const vl=/[/\\]/,Re=e=>{if(e.name)return e.name;const s=e.path.split(vl);return s[s.length-1]||n("ui.projects.project_updates.attachment")};function yl(e){const s=e.kind.trim().toLowerCase();if(s==="image"||s==="video"||s==="audio")return s;const r=Rr(e.name||e.path);return r==="image"||r==="video"||r==="audio"?r:"file"}const kt=e=>{const s=Date.parse(e.added_at);return{mimeType:ia(e.name||e.path),sizeBytes:e.bytes,...Number.isFinite(s)?{mtimeMs:s}:{}}},Ae=e=>`${e.path}:${e.added_at}`,Ue="h-[78px] w-[117px]",Ls="pointer-events-none absolute top-1 right-1 z-[2] flex opacity-0 transition-opacity duration-fast ease-out-quart group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 has-[[aria-expanded=true]]:pointer-events-auto has-[[aria-expanded=true]]:opacity-100",Nt=({kind:e})=>e==="audio"?t.jsx("div",{className:"h-11 w-[242px] max-w-full rounded-sm border border-hairline bg-sunken"}):t.jsx(Be,{boundary:"control",className:Ue}),wl=({attachment:e,onOpen:s})=>{I();const r=Re(e),a=jt(e.path,kt(e));if(a.status==="ready"){const o=n("ui.projects.project_updates.open_name",{name:String(r)});return t.jsx(Dr,{file:e.path,src:a.url,label:r,conversationId:"",size:"thumbnail",press:{onPress:s,label:o,title:o}})}return a.status==="loading"?t.jsx(Be,{boundary:"control",className:Ue,children:t.jsxs("span",{className:"sr-only",children:[n("ui.projects.project_updates.loading"),r]})}):t.jsx(ht,{name:r,compact:!0})},kl=({attachment:e,onOpen:s})=>{const[r,a]=Ut();return t.jsx("div",{ref:r,className:"group relative flex leading-none","data-project-asset-tile":"image",children:a?t.jsx(wl,{attachment:e,onOpen:s}):t.jsx(Nt,{kind:"image"})})},Nl=({attachment:e,onOpen:s})=>{I();const r=Re(e),a=jt(e.path,kt(e));if(a.status!=="ready")return a.status==="loading"?t.jsx(Nt,{kind:"video"}):t.jsx(ht,{name:r,compact:!0});const o=n("ui.projects.project_updates.play_name",{name:String(r)});return t.jsx(t.Fragment,{children:t.jsx("button",{type:"button",className:"group/tile block cursor-pointer rounded-sm","aria-label":o,title:o,onClick:s,children:t.jsxs(Be,{boundary:"control",className:R(Ue,"relative"),children:[t.jsx("video",{src:a.url,preload:"metadata",muted:!0,playsInline:!0,className:R("h-[76px] w-[115px] object-contain","motion-safe:transition-transform motion-safe:duration-fast motion-safe:ease-out-quart","motion-safe:group-hover/tile:scale-[1.04]"),"data-project-video-thumb":""}),t.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t.jsx(Br,{className:"size-6 text-ink",fill:"currentColor","aria-hidden":"true"})})]})})})},Sl=({attachment:e,onOpen:s})=>{const[r,a]=Ut();return t.jsxs("div",{ref:r,className:"group relative block leading-none","data-project-asset-tile":"video",children:[a?t.jsx(Nl,{attachment:e,onOpen:s}):t.jsx(Nt,{kind:"video"}),t.jsx("div",{className:Ls,children:t.jsx(Is,{filePath:e.path,"aria-label":n("ui.projects.project_updates.file_actions_for_name",{name:String(Re(e))})})})]})},Cl=({attachment:e})=>{I();const s=Re(e),r=jt(e.path,kt(e));return r.status!=="ready"?r.status==="loading"?t.jsx(Nt,{kind:"audio"}):t.jsx(ht,{name:s}):t.jsx("div",{className:"w-[242px] max-w-full rounded-sm border border-hairline bg-surface px-2",children:t.jsx(oa,{ownerId:`project-sound:${e.path}`,src:r.url,label:s,peaks:null,variant:"compact"})})},El=({attachment:e})=>{const[s,r]=Ut();return t.jsxs("div",{ref:s,className:"group relative block leading-none sm:col-span-2","data-project-asset-tile":"audio",children:[r?t.jsx(Cl,{attachment:e}):t.jsx(Nt,{kind:"audio"}),t.jsx("div",{className:Ls,children:t.jsx(Is,{filePath:e.path,"aria-label":n("ui.projects.project_updates.file_actions_for_name",{name:String(Re(e))})})})]})},Tl=e=>{const s=e.name||e.path;if(Tr(s))return!0;const r=Rr(s);return r==="text"||r==="code"},Rl=({attachment:e,onPreview:s})=>{I();const r=Re(e),a=qo(e.bytes),o=d.useRef(null),i=Tl(e),l=i?n("ui.projects.project_updates.preview_name",{name:String(r)}):n("ui.projects.project_updates.open_name",{name:String(r)});return t.jsxs("div",{className:"group relative inline-block","data-project-asset-tile":"file",children:[t.jsx("button",{ref:o,type:"button",className:"group/tile block cursor-pointer rounded-sm","aria-label":l,title:r,onClick:()=>{if(i){s(o.current);return}window.api?.openFile(e.path)},children:t.jsxs(Be,{boundary:"control",className:R(Ue,"flex-col gap-0.5 px-2 py-1 text-center"),children:[t.jsx(na,{path:e.path}),t.jsx("span",{className:"w-full truncate text-meta text-ink",children:r}),a&&t.jsx("span",{className:"text-meta text-ink-muted tabular-nums",children:a})]})}),t.jsx("div",{className:Ls,children:t.jsx(Is,{filePath:e.path,"aria-label":n("ui.projects.project_updates.file_actions_for_name",{name:String(r)}),onPreview:i?()=>s(o.current):void 0})})]})},Dl=({asset:e,current:s,index:r,count:a,onSelect:o,scrollIntoView:i})=>{I();const[l,c]=Ut(),u=d.useRef(null),p=Re(e.attachment);return d.useEffect(()=>{!s||!i||u.current?.scrollIntoView({block:"nearest",inline:"nearest"})},[s,i]),t.jsx("li",{ref:u,className:R("flex shrink-0 rounded-sm leading-none",s&&"ring-1 ring-ink"),children:t.jsx("div",{ref:l,className:"group relative",children:c?t.jsx(Al,{asset:e,onSelect:o,current:s,index:r,count:a}):t.jsx("button",{type:"button","aria-label":n("ui.projects.project_updates.show_asset_name",{name:String(p),index:String(r+1),count:String(a)}),className:"group/tile inline-block cursor-pointer rounded-sm leading-none",onClick:o,children:t.jsx(Be,{boundary:"control",className:Ue,"data-attachment-reserved":""})})})})},Al=({asset:e,current:s,index:r,count:a,onSelect:o})=>{I();const i=Re(e.attachment),l=jt(e.attachment.path,kt(e.attachment)),c=n("ui.projects.project_updates.show_asset_name",{name:String(i),index:String(r+1),count:String(a)});return e.kind==="image"&&l.status==="ready"?t.jsx(Dr,{file:e.attachment.path,src:l.url,label:i,conversationId:"",size:"thumbnail",press:{onPress:o,label:c,title:c,current:s}}):l.status!=="ready"?l.status==="loading"?t.jsx("button",{type:"button","aria-label":c,className:"group/tile inline-block cursor-pointer rounded-sm leading-none",onClick:o,children:t.jsx(Be,{boundary:"control",className:Ue})}):t.jsx(ht,{name:i,compact:!0}):t.jsx("button",{type:"button",className:"group/tile block cursor-pointer rounded-sm","aria-label":c,title:c,"aria-current":s?"true":void 0,onClick:o,children:t.jsxs(Be,{boundary:"control",className:R(Ue,"relative"),children:[t.jsx("video",{src:l.url,preload:"metadata",muted:!0,playsInline:!0,className:R("h-[76px] w-[115px] object-contain","motion-safe:transition-transform motion-safe:duration-fast motion-safe:ease-out-quart","motion-safe:group-hover/tile:scale-[1.04]")}),t.jsx("span",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:t.jsx(Br,{className:"size-4 text-ink",fill:"currentColor","aria-hidden":"true"})})]})})},Pl=({media:e,index:s,onSelect:r})=>(I(),t.jsx("ul",{role:"list","aria-label":n("ui.projects.project_updates.attachments"),"data-project-asset-filmstrip":"",className:"flex max-w-full items-center gap-2 overflow-x-auto px-2 py-1 leading-none",children:e.map((a,o)=>t.jsx(Dl,{asset:a,current:o===s,index:o,count:e.length,onSelect:()=>r(o),scrollIntoView:s===o},Ae(a.attachment)))})),Ol=({media:e,index:s,onIndexChange:r,onClose:a,restoreFocusTo:o})=>{I();const i=e[s],l=Re(i.attachment),c=jt(i.attachment.path,kt(i.attachment)),u=e.length>1?t.jsx(Pl,{media:e,index:s,onSelect:r}):void 0;return t.jsx(aa,{open:!0,onOpenChange:p=>{p||a()},src:c.status==="ready"?c.url:void 0,pending:c.status==="loading",label:l,mediaKind:i.kind,mediaLabel:"asset",restoreFocusTo:o,fallback:t.jsx(ht,{name:l}),group:{index:s,count:e.length,onPrev:()=>r(Ks(s,e.length,-1)),onNext:()=>r(Ks(s,e.length,1)),filmstrip:u}})},Rn=({attachments:e})=>{I();const s=d.useMemo(()=>e.map(j=>({attachment:j,kind:yl(j)})),[e]),r=d.useMemo(()=>s.filter(j=>j.kind==="image"||j.kind==="video"),[s]),[a,o]=d.useState(null),[i,l]=d.useState(null),c=d.useRef(null),u=d.useRef(null),p=a?r.findIndex(j=>Ae(j.attachment)===a):-1,m=j=>{const f=document.activeElement;c.current=f instanceof HTMLElement?f:null,o(Ae(j))},_=(j,f=null)=>{const g=document.activeElement;u.current=f??(g instanceof HTMLElement?g:null),l(j)};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"grid max-w-[492px] grid-cols-[repeat(auto-fill,117px)] items-start gap-2","data-project-asset-grid":"",children:s.map(({attachment:j,kind:f})=>f==="image"?t.jsx(kl,{attachment:j,onOpen:()=>m(j)},Ae(j)):f==="video"?t.jsx(Sl,{attachment:j,onOpen:()=>m(j)},Ae(j)):f==="audio"?t.jsx(El,{attachment:j},Ae(j)):t.jsx(Rl,{attachment:j,onPreview:g=>_(j,g)},Ae(j)))}),p>=0&&t.jsx(Ol,{media:r,index:p,onIndexChange:j=>{const f=r[j];f&&o(Ae(f.attachment))},onClose:()=>o(null),restoreFocusTo:c}),t.jsx(Tn,{open:i!==null,attachment:i,onClose:()=>l(null),restoreFocusTo:u})]})};Rn.displayName="ProjectUpdateAssets";const Ml=({update:e,nowMs:s})=>{const r=I(),a=Lo(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(rt,{children:e.text}),e.attachments.length>0&&t.jsx(Rn,{attachments:e.attachments})]})},Il=({updates:e,nowMs:s})=>{const r=I(),a=Ao(e.length),o=Fo(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(Ml,{update:l,nowMs:s},`${l.at}:${l.by}:${c}`))})]},i.key||"ungrouped"))})]})},Ll="project_not_found",Fl=({projectKey:e,nowMs:s})=>{I();const r=Bt(),a=nt(),o=Ar(ye(a.data,"team_catalogue")),i=Ur(e,!0),l=$r(),c=zr(),u=io(),p=co(),m=ao(),_=oo(),[j,f]=d.useState(!1),[g,S]=d.useState(!1),b=l.isPending||c.isPending||u.isPending||p.isPending||m.isPending||_.isPending;if(i.isLoading)return t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Te,{label:n("ui.projects.project_detail.loading_project")})});if(i.isError||!i.data){const h=i.error instanceof qt&&(i.error.code===Ll||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(ts,{variant:"danger",className:"w-full",children:h?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(G,{variant:"secondary",onClick:()=>void i.refetch(),children:n("ui.projects.project_detail.try_again")}),t.jsxs(G,{variant:"secondary",onClick:()=>void r("/projects"),children:[t.jsx(Ws,{}),n("ui.projects.project_detail.all_projects")]})]})]})}const{project:x,links:w}=i.data,T=ne(x),k=(h,A)=>l.mutateAsync({key:x.id,fields:h,...A?.forceDone===!0?{forceDone:!0}:{}}),q=x.team?o(x.team):null,C=Bo(x.milestones.filter(h=>h.completed_at!==null).length,x.milestones.length),E=async(h,A,D,F)=>{const H=At.getState(),U=la(null,h,H.drafts);if(!U)return!1;try{const{images:Y,unreadable:J,overflow:Z}=await ua(F,A),me=da(J);if(me)return de(me),!1;const oe=pa(Z);if(oe)return de(oe),!1;const ee=ma(A,Y);if(ee)return de(ee),!1;if(await fa(U,{text:A,attachments:F,images:Y,mode:D,cwd:H.cwd},h)===null)return de(n("ui.projects.project_detail.that_session_already_has_a_message_going_out_try_again_in_a_momen")),!1;const v=w.find(y=>y.session_id===h);return ve(n("ui.projects.project_detail.sent_to_value1",{value1:String(v?Kt(v):h)})),!0}catch(Y){return de(Y instanceof Error&&Y.message?Y.message:n("ui.projects.project_detail.the_message_was_not_sent")),!1}},M=async h=>{const A=At.getState(),D=h.kind==="plain"?void 0:{kind:h.kind,name:h.name},F=await A.createSession(A.cwd||"~",D);if(!F)throw new Error(A.error??n("ui.projects.project_detail.the_session_could_not_be_started"));_a.getState().setCurrentInput(F,zo(x));let H=null;try{await m.mutateAsync({key:x.id,sessionId:F})}catch(U){H=U instanceof Error&&U.message?U.message:n("ui.projects.project_detail.the_link_was_refused")}if(H)de(n("ui.projects.project_detail.session_started_but_linking_it_failed_linkfailure",{linkFailure:String(H)}));else{const U=D?n("ui.projects.project_detail.with_value1",{value1:String(Go(D))}):"";ve(n("ui.projects.project_detail.session_started_withtarget_and_linked_to_displayname",{withTarget:String(U),displayName:String(T)}))}await Fr(r,F)};return t.jsx(wc,{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(Ws,{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(Zc,{project:x,commit:k}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1.5",children:[t.jsx(el,{project:x,commit:k}),x.progress_stale&&t.jsx(ke,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ml,{project:x}),t.jsxs(G,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"project-delete",children:[t.jsx(ca,{}),n("ui.projects.project_detail.delete")]})]})]})]}),t.jsx(tl,{project:x,commit:k}),t.jsx(pl,{project:x,nowMs:s,commit:k,teamLabel:q}),x.updates.length===0&&x.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(rt,{className:"text-body",children:x.progress}),t.jsx("p",{className:"text-meta text-ink-muted",children:_o(x,s)})]}),t.jsx(ul,{milestones:x.milestones,summary:C,busy:b,onToggle:(h,A)=>{u.mutateAsync({key:x.id,name:h,completed:A}).catch(D=>{de(D instanceof Error&&D.message?D.message:n("ui.projects.project_detail.the_milestone_was_not_updated"))})},onRemove:h=>{p.mutateAsync({key:x.id,name:h}).catch(A=>{de(A instanceof Error&&A.message?A.message:n("ui.projects.project_detail.the_milestone_was_not_removed"))})},onAdd:(h,A)=>{u.mutateAsync({key:x.id,name:h,targetDate:A}).catch(D=>{de(D instanceof Error&&D.message?D.message:n("ui.projects.project_detail.the_milestone_was_not_added"))})}}),t.jsx(ll,{projectKey:x.id,links:w,busy:b,onStartSession:()=>S(!0),onQuickSend:E,onLink:h=>{m.mutateAsync({key:x.id,sessionId:h}).catch(A=>{de(A instanceof Error&&A.message?A.message:n("ui.projects.project_detail.the_session_was_not_linked"))})},onUnlink:h=>{_.mutateAsync({key:x.id,sessionId:h}).catch(A=>{de(A instanceof Error&&A.message?A.message:n("ui.projects.project_detail.the_session_was_not_unlinked"))})}}),t.jsx(hl,{links:w}),t.jsx(Il,{updates:x.updates,nowMs:s}),t.jsx(vn,{open:j,projectName:x.name,onClose:()=>f(!1),onConfirm:async h=>{await c.mutateAsync({key:x.id,confirmedName:h}),ve(n("ui.projects.project_detail.project_deleted")),r("/projects")}}),t.jsx(jl,{open:g,onClose:()=>S(!1),onStart:M,teamsEnabled:ye(a.data,"team_catalogue"),profilesEnabled:ye(a.data,"profile_catalogue")})]})})},ql="payments-migration",kr={name:"",title:"",owner:"",team:"",description:"",status:"active",tags:"",startDate:"",targetDate:"",estimate:"",estimateUnit:"points"},Bl=({open:e,onClose:s,onSubmit:r})=>{I();const[a,o]=d.useState(kr),[i,l]=d.useState({}),[c,u]=d.useState(null),p=d.useRef(null),[m,_]=d.useState(!1),[j,f]=d.useState(!1),[g,S]=d.useState(!1),b=d.useId(),x=d.useRef(null);d.useEffect(()=>{e&&(o({...kr,description:hr}),l({}),u(null),_(!1),f(!1),S(!1))},[e]),d.useEffect(()=>{c&&p.current?.scrollIntoView({block:"nearest"})},[c]);const w=(h,A)=>{o(D=>({...D,[h]:A}))},T=j?a.name:Ac(a.title),k=h=>wn(h,x,A=>w("description",A)),q=(h,A)=>{const D={},F=ss(A);F&&(D.name=F);const H=pn(h.description);H&&(D.description=H);const U=ps(h.tags).error;U&&(D.tags=U);const Y=us(h.startDate);Y&&(D.startDate=Y);const J=us(h.targetDate);if(J)D.targetDate=J;else if(!Y){const ee=ds(h.startDate,h.targetDate);ee&&(D.targetDate=ee)}if(h.estimate.trim()){const ee=mn(h.estimate);ee&&(D.estimate=ee)}const Z=ls(h.title);Z&&(D.title=Z);const me=Mt(h.owner,"owner");me&&(D.owner=me);const oe=Mt(h.team,"team");return oe&&(D.team=oe),D},C=async()=>{const h=T.trim(),A=q(a,h);if(l(A),Object.keys(A).length>0)return;_(!0),u(null);const D=ft(a.tags);try{const F={};a.title.trim()&&(F.title=a.title.trim()),a.owner.trim()&&(F.owner=a.owner.trim()),a.team.trim()&&(F.team=a.team.trim()),a.startDate&&(F.start_date=a.startDate),a.targetDate&&(F.target_date=a.targetDate),a.estimate&&(F.estimate=Number(a.estimate),F.estimate_unit=a.estimateUnit),await r({fields:{name:h,...a.description.trim()&&a.description.trim()!==hr?{description:a.description.trim()}:{},status:a.status,...D.length>0?{tags:D}:{}},...Object.keys(F).length>0?{followUp:F}:{}}),s()}catch(F){const H=F instanceof Error&&F.message?F.message:"";u(yt(H)||n("ui.projects.project_form_dialog.the_project_was_not_saved"))}finally{_(!1)}},E=n("ui.projects.project_form_dialog.new_project"),M=a.description.length>tt;return t.jsx(_t,{open:e,onClose:s,title:E,fullWidth:!0,maxWidth:"md",dialogProps:{closeDisabled:m,onEscapeKeyDown:h=>{m&&h.preventDefault()},onInteractOutside:h=>{m&&h.preventDefault()}},dataTourTag:"project-create-dialog",actions:t.jsxs(t.Fragment,{children:[t.jsx(Xe,{onClick:s,disabled:m,children:n("ui.projects.project_form_dialog.cancel")}),t.jsxs(Dt,{"data-project-submit":"",onClick:()=>void C(),disabled:m,children:[m&&t.jsx(Te,{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:h=>{h.preventDefault(),C()},children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(pe,{htmlFor:`${b}-title`,children:n("ui.projects.project_form_dialog.title")}),t.jsx(ue,{id:`${b}-title`,"data-project-title":"",value:a.title,onChange:h=>w("title",h.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(pe,{htmlFor:`${b}-key`,className:"shrink-0 text-meta text-ink-muted",children:n("ui.projects.project_form_dialog.key")}),t.jsx(ue,{id:`${b}-key`,"data-project-key":"",value:T,onChange:h=>{f(!0),w("name",h.target.value)},placeholder:ql,"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:j?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(pe,{htmlFor:`${b}-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(h=>t.jsx("button",{type:"button","data-project-description-mode":h,"aria-pressed":g===(h==="preview"),onClick:()=>S(h==="preview"),className:R("h-6 rounded-sm px-3 text-body-sm text-ink-muted transition-colors duration-fast ease-out-quart","hover:text-ink","focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",g===(h==="preview")&&"bg-surface text-ink"),children:h==="write"?n("ui.projects.project_form_dialog.write"):n("ui.projects.project_form_dialog.preview")},h))})]})]}),g?t.jsx("div",{"data-project-description-preview":"",className:"h-44 overflow-y-auto rounded-md border border-hairline bg-sunken px-3 py-2",children:a.description.trim()?t.jsx(rt,{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(Or,{ref:x,id:`${b}-description`,"data-project-description":"",value:a.description,onChange:h=>w("description",h.target.value),onPaste:k,rows:8,placeholder:n("ui.projects.project_form_dialog.markdown_headings_lists_code"),"aria-invalid":M||!!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:R("text-meta tabular-nums",M?"text-danger":"text-ink-muted"),children:[a.description.length,"/",tt]})]})]}),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(pe,{children:n("ui.projects.project_form_dialog.status")}),t.jsxs(Je,{value:a.status,onValueChange:h=>w("status",h),children:[t.jsx(Qe,{"aria-label":n("ui.projects.project_form_dialog.status"),children:t.jsx(Ze,{})}),t.jsx(et,{children:Yr.map(h=>t.jsx(Oe,{value:h.value,children:h.label},h.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(pe,{htmlFor:`${b}-owner`,children:n("ui.projects.project_form_dialog.owner")}),t.jsx(ue,{id:`${b}-owner`,"data-project-owner":"",value:a.owner,onChange:h=>w("owner",h.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(pe,{htmlFor:`${b}-team`,children:n("ui.projects.project_form_dialog.team")}),t.jsx(ue,{id:`${b}-team`,value:a.team,onChange:h=>w("team",h.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(pe,{htmlFor:`${b}-target`,children:n("ui.projects.project_form_dialog.target_date")}),t.jsx(ue,{id:`${b}-target`,"data-project-target":"",value:a.targetDate,onChange:h=>w("targetDate",h.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(pe,{htmlFor:`${b}-start`,children:n("ui.projects.project_form_dialog.start_date")}),t.jsx(ue,{id:`${b}-start`,value:a.startDate,onChange:h=>w("startDate",h.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(pe,{htmlFor:`${b}-estimate`,children:n("ui.projects.project_form_dialog.estimate")}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ue,{id:`${b}-estimate`,value:a.estimate,onChange:h=>w("estimate",h.target.value),placeholder:"13",inputMode:"decimal","aria-invalid":!!i.estimate,className:"max-w-28"}),t.jsxs(Je,{value:a.estimateUnit,onValueChange:h=>w("estimateUnit",h),children:[t.jsx(Qe,{"aria-label":n("ui.projects.project_form_dialog.estimate_unit"),className:"max-w-32",children:t.jsx(Ze,{})}),t.jsxs(et,{children:[t.jsx(Oe,{value:"points",children:n("ui.projects.project_form_dialog.points")}),t.jsx(Oe,{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(pe,{htmlFor:`${b}-tags`,children:n("ui.projects.project_form_dialog.tags")}),t.jsx(ue,{id:`${b}-tags`,value:a.tags,onChange:h=>w("tags",h.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:p,className:"text-body-sm text-danger",children:c})]})})},Dn=({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:R("max-h-[min(70vh,32rem)] overflow-y-auto overscroll-contain",r&&"[mask-image:linear-gradient(to_bottom,black_calc(100%-12px),transparent)]"),children:e})},Ul=({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(Ir,{id:o,checked:r,onCheckedChange:()=>a()}),t.jsx(pe,{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})]})},$l=({column:e,spec:s,onChange:r})=>{I();const a=d.useId(),o=s!==null&&s.key===e,i=o?s.direction:Xt(e),l=i==="asc"?"desc":"asc",c=()=>r({key:e,direction:o?l:Xt(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(st(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:R("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:p=>{u==="sorted"&&(p.key!==" "&&p.key!=="Enter"||(p.preventDefault(),c()))},className:"m-0 size-3.5 shrink-0 accent-[var(--color-accent)]"}),t.jsx("span",{className:R("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(st(e)),value2:String(Ds(e,o?i:Xt(e)))})})]})]})},zl=({facet:e,options:s,onToggle:r})=>(I(),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:dt[e]}),s.map(a=>t.jsx(Ul,{label:a.label,count:a.count,selected:a.selected,onToggle:()=>r(e,a.value)},`${e}:${a.value??"none"}`))]})),An=({projects:e,state:s,query:r,todayMs:a,onToggle:o,onClearAll:i,scope:l,sort:c})=>{I();const u=l===void 0?bi(e,s,a):l===null?[]:[dn(l,e,s,a)],p=!mt(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")}),p&&t.jsx(G,{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(st(c.key))})}),t.jsx($l,{column:c.key,spec:c.spec,onChange:c.onChange})]}),u.map(m=>t.jsx(zl,{facet:m.facet,options:m.options,onToggle:o},m.facet))]})},Gl=({team:e,count:s,headingId:r,className:a,...o})=>(I(),t.jsxs("div",{...o,"data-glass-well":"",className:R("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":ho(s),children:s})]})),Ee=[{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 Yl(e,s){const r=xt(e.progress_updated_at,s);return r?bt(r):n("ui.projects.project_list.not_reported")}const Kl=({direction:e})=>e==="asc"?t.jsx(qr,{size:10,className:"shrink-0","aria-hidden":"true"}):t.jsx(Pr,{size:10,className:"shrink-0","aria-hidden":"true"}),Hl=({projects:e,nowMs:s,onOpen:r,sort:a,onSortChange:o,searchPopulation:i,filters:l,query:c,todayMs:u,onToggleFilter:p,onClearFilters:m,teamLabelFor:_=j=>j})=>{const j=I(),f=a?Ti(e,a):e,g=Es(f,vt),S=d.useId(),b=C=>`${S}-team-${C}`,[x,w]=d.useState(0),T=d.useRef([]),k=(C,E)=>{const M=Ee.length;for(let h=1;h<=M;h+=1){const A=(C+E*h+M*M)%M,D=T.current[A];if(D&&D.offsetParent!==null){w(A),D.focus();return}}},q=C=>E=>{E.key!=="ArrowLeft"&&E.key!=="ArrowRight"||(E.preventDefault(),k(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:Ee.map((C,E)=>{const M=a!==null&&a.key===C.sort;return t.jsx("th",{scope:"col","aria-sort":M?a.direction==="desc"?"descending":"ascending":"none",className:R(C.className,"p-0 text-left font-normal"),children:t.jsxs(ws,{children:[t.jsx(ks,{asChild:!0,children:t.jsxs("button",{type:"button",ref:h=>{T.current[E]=h},tabIndex:E===x?0:-1,"data-project-column":C.key,onFocus:()=>w(E),onKeyDown:q(E),className:R("group flex w-full min-w-0 items-center gap-1 rounded-xs text-left","transition-colors duration-fast ease-out-quart",M?"text-ink":"hover:text-ink"),children:[t.jsx("span",{className:"truncate",children:C.label}),M?t.jsx(Kl,{direction:a.direction}):t.jsx(ja,{size:10,className:"shrink-0 text-ink-dim transition-colors duration-fast ease-out-quart group-hover:text-ink","aria-hidden":"true"})]})}),t.jsx(Ns,{align:"start","aria-label":n("ui.projects.project_list.label_column",{label:String(C.label)}),className:"w-72 p-0",children:t.jsx(Dn,{children:t.jsx(An,{projects:i,state:l,query:c,todayMs:u,onToggle:p,onClearAll:m,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:g.map((C,E)=>t.jsxs("li",{children:[t.jsx(Gl,{team:C.team==null?null:_(C.team),count:C.items.length,headingId:b(E),className:"sticky top-0 z-10","data-project-team":C.team??""}),t.jsx("ul",{"aria-labelledby":b(E),className:"divide-y divide-hairline",children:C.items.map(M=>{const h=new Map(Xr(M,j).map(F=>[F.key,F.text])),A=Vr(M.milestones_completed,M.milestones_total),D=Cs(M.live_sessions);return t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>r(M),"data-project-name":M.name,className:R("flex w-full items-center gap-3 px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","hover:bg-row-hover"),children:[t.jsx("span",{className:R(Ee[0].className,"truncate text-body-sm text-ink"),children:ne(M)}),t.jsx("span",{className:Ee[1].className,children:t.jsx(Nn,{status:M.status})}),t.jsx("span",{className:R(Ee[2].className,"truncate text-meta text-ink-muted"),children:h.get("target")??h.get("completed")??""}),t.jsx("span",{className:R(Ee[3].className,"truncate text-meta text-ink-muted"),children:h.get("estimate")??""}),t.jsx("span",{className:R(Ee[4].className,"truncate text-meta text-ink-muted"),children:A}),t.jsx("span",{className:R(Ee[5].className,"truncate text-meta text-ink-muted"),children:D}),t.jsxs("span",{className:R(Ee[6].className,"flex items-center gap-2"),children:[t.jsx("span",{className:"truncate text-meta text-ink-muted",children:Yl(M,s)}),M.progress_stale&&t.jsx(ke,{variant:"warning",children:n("ui.projects.project_model.stale")})]})]})},M.id)})})]},C.team??""))})]})},Ft=224,Nr=36,Wl={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")}},Vl=({items:e,nowMs:s,onOpen:r,pendingDetails:a,failedDetails:o,onRetryDetails:i,teamLabelFor:l=c=>c})=>{I();const[c,u]=d.useState(null),[p,m]=d.useState(0),_=d.useRef(null),j=Ps(s),f=d.useMemo(()=>Ai(e,j),[e,j]),g=d.useMemo(()=>Pi(e),[e]),S=d.useMemo(()=>Es(g.dated,C=>vt(C.project)),[g]);d.useLayoutEffect(()=>{const C=_.current;if(!C)return;const E=()=>m(C.clientWidth);if(E(),typeof ResizeObserver>"u")return;const M=new ResizeObserver(E);return M.observe(C),()=>M.disconnect()},[]);const b=Math.max(p-Ft-24,160),x=f?Ri(or(f.startMs,f.endMs),b):"month",w=c??x,T=C=>{const E=Pe.indexOf(w),M=Pe[E-C];M&&u(M)},k=As[w],q=f?or(f.startMs,f.endMs)*k:0;return t.jsxs("div",{ref:_,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(g.dated.length,{useGrouping:!1}),length_2:V(g.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(G,{variant:"secondary",size:"sm",onClick:i,children:n("ui.projects.project_timeline.try_again")}),t.jsx(G,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_in"),title:n("ui.projects.project_timeline.zoom_in_finer"),disabled:!f||w===Pe[0],onClick:()=>T(1),children:t.jsx(pt,{})}),t.jsx("span",{className:"w-16 text-center text-meta text-ink-muted",children:Wl[w]}),t.jsx(G,{variant:"secondary",size:"icon","aria-label":n("ui.projects.project_timeline.zoom_out"),title:n("ui.projects.project_timeline.zoom_out_coarser"),disabled:!f||w===Pe[Pe.length-1],onClick:()=>T(-1),children:t.jsx(Aa,{})})]})]}),f&&g.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(Xl,{startMs:f.startMs,endMs:f.endMs,tier:w,pxPerDay:k,trackPx:q}),S.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:Ft},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(Jl,{item:E,spanStart:f.startMs,pxPerDay:k,trackPx:q,today:j,onOpen:()=>r(E)},E.project.id))]},C.team??""))]})}):null,g.undated.length>0&&t.jsx("div",{className:"shrink-0 px-9 py-2","data-project-undated-callout":"",children:t.jsxs(Er,{defaultOpen:g.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(Wa,{size:14,className:"shrink-0 text-ink-dim","aria-hidden":"true"}),t.jsx("span",{className:"truncate text-ink",children:Oi(g.undated.length)})]}),children:[g.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:g.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:ne(C.project)})},C.project.id))})]})})]})},Xl=({startMs:e,endMs:s,tier:r,pxPerDay:a,trackPx:o})=>{const i=zi(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:Ft}}),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:Fe(e,l.dayMs)*a},children:[t.jsx("span",{className:R("absolute top-0 h-full w-px",l.major?"bg-hairline":"bg-hairline/60"),"aria-hidden":"true"}),t.jsx("span",{className:"absolute top-1/2 left-1 -translate-y-1/2 whitespace-nowrap text-meta text-ink-muted",children:l.label})]},l.dayMs))})]})},Jl=({item:e,spanStart:s,pxPerDay:r,trackPx:a,today:o,onOpen:i})=>{const{project:l}=e,c=Mi(e),u=Ii(e),p=m=>new Date(m).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:Ft,height:Nr},children:t.jsx("span",{className:"truncate text-body-sm text-ink",children:ne(l)})}),t.jsxs("span",{className:"relative block",style:{width:a,height:Nr},children:[c&&t.jsx("span",{className:"absolute top-1/2 h-1.5 -translate-y-1/2 rounded-full bg-accent/75",style:{left:Fe(s,c.fromMs)*r,width:(Fe(c.fromMs,c.toMs)+1)*r},title:`${Me(p(c.fromMs))} → ${Me(p(c.toMs))}`}),u.map(m=>t.jsx("span",{"data-milestone":m.status,className:R("absolute top-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rotate-45",m.status==="completed"&&"bg-success",m.status==="overdue"&&"bg-warning",m.status==="upcoming"&&"border-[1.5px] border-ink-muted bg-surface"),style:{left:Fe(s,m.dayMs)*r},title:`${m.name} · ${m.status} · ${Me(p(m.dayMs))}`},`${m.name}-${m.dayMs}`)),t.jsx("span",{className:"absolute inset-y-0 w-px bg-accent/75",style:{left:Fe(s,o)*r},"aria-hidden":"true"})]})]})},Ql=({projects:e,query:s,onQueryChange:r,filters:a,onFiltersChange:o,onClearAll:i,todayMs:l,resultText:c,countRevealClass:u="@[37rem]:inline",trailing:p,disabled:m=!1,searchFieldRef:_})=>{I();const[j,f]=d.useState(!1),g=d.useRef(!1),S=ji(a),b=Lr(c??"",300),x=s.trim()!==""||!mt(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(ha,{size:16,className:"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2 text-ink-dim","aria-hidden":"true"}),t.jsx(ue,{ref:_,inputSize:"sm",value:s,onChange:w=>r(w.target.value),onKeyDown:w=>{w.key==="Escape"&&(s?r(""):w.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(G,{variant:"ghost",size:"icon-sm",className:"absolute top-1/2 right-1 -translate-y-1/2",onClick:()=>ga(_.current,r),"aria-label":n("ui.projects.projects_toolbar.clear_search"),children:t.jsx(zt,{"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(xa,{shortcut:"/"})})]}),t.jsxs(ws,{open:j,onOpenChange:f,children:[t.jsx(ks,{asChild:!0,children:t.jsxs(G,{variant:"secondary",size:"sm",disabled:m,"data-project-filters-button":"",children:[t.jsx(Xa,{size:14,"aria-hidden":"true"}),n("ui.projects.projects_toolbar.filters"),S>0&&t.jsx(ke,{variant:"neutral",children:S})]})}),t.jsx(Ns,{align:"end","aria-label":n("ui.projects.projects_toolbar.filters"),className:"w-80 p-0",onCloseAutoFocus:w=>{g.current&&(g.current=!1,w.preventDefault())},children:t.jsx(Dn,{children:t.jsx(An,{projects:e,state:a,query:s,todayMs:l,onToggle:(w,T)=>o(cn(a,w,T)),onClearAll:()=>{i(),g.current=!0,f(!1),_.current?.focus()}})})})]}),x&&c!==null&&t.jsx("span",{className:R("hidden whitespace-nowrap text-meta text-ink-dim",u),"data-project-count":"",children:c}),t.jsx("output",{className:"sr-only","aria-live":"polite",children:b}),p]})},Zl=({filters:e,sort:s,onFiltersChange:r,onSortChange:a,onClearAll:o,hideClearAll:i=!1,searchFieldRef:l})=>{I();const[c,u]=d.useState(null);d.useEffect(()=>{if(!c)return;let _=null;c.kind==="search"?_=l.current:(_=document.querySelector(`[data-project-chip="${c.index}"]`),_||(_=document.querySelector("[data-project-chip]")),_||(_=document.querySelector("[data-project-filters-button]"))),_&&(_.focus(),u(null))});const p=[];for(const _ of at){const j=e[_];if(j.length===0)continue;const f=j.map(b=>on(_,b)),g=f[0],S=f.length>1?n("ui.projects.projects_toolbar.facet_labels_facet_first_length_1",{FACET_LABELS_facet:String(dt[_]),first:String(g),length___1:V(f.length-1,{useGrouping:!1})}):n("ui.projects.projects_toolbar.facet_labels_facet_first",{FACET_LABELS_facet:String(dt[_]),first:String(g)});p.push({kind:"facet",facet:_,label:S,ariaLabel:n("ui.projects.projects_toolbar.remove_filter_facet_labels_facet_join",{FACET_LABELS_facet:String(dt[_]),join:String(f.join(", "))}),clear:()=>r({...e,[_]:[]})})}if(s&&p.push({kind:"sort",spec:s,label:n("ui.projects.projects_toolbar.sort_key",{key:String(st(s.key))}),ariaLabel:n("ui.projects.projects_toolbar.remove_sort_key_direction",{key:String(st(s.key)),direction:String(Ds(s.key,s.direction))}),clear:()=>a(null)}),p.length===0)return null;const m=(_,j)=>{j.clear();const f=p.length-1;u(f===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:[p.map((_,j)=>t.jsx(ke,{asChild:!0,variant:"neutral",className:"gap-1 pr-1 text-ink",children:t.jsxs("button",{type:"button",className:"group","data-project-chip":j,"aria-label":_.ariaLabel,onClick:()=>m(j,_),children:[_.kind==="sort"&&(_.spec.direction==="asc"?t.jsx(qr,{size:10,className:"text-ink-muted","aria-hidden":"true"}):t.jsx(Pr,{size:10,className:"text-ink-muted","aria-hidden":"true"})),t.jsx("span",{className:"truncate",children:_.label}),t.jsx(zt,{className:R("text-ink-dim transition-colors duration-fast ease-out-quart","group-hover:text-danger"),"aria-hidden":"true"})]})},_.kind==="facet"?_.facet:"sort")),!i&&t.jsx(G,{variant:"link",size:"sm",onClick:()=>{o(),u({kind:"search"})},children:n("ui.projects.projects_toolbar.clear_all")})]})},Pn="projects-view",eu=[{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 tu(){try{const e=localStorage.getItem(Pn);if(e==="board"||e==="timeline"||e==="list")return e}catch{}return"board"}function su(e){try{localStorage.setItem(Pn,e)}catch{}}const ru=({value:e,onChange:s})=>(I(),t.jsx(Pa,{value:e,onValueChange:r=>s(r),children:t.jsx(Oa,{"aria-label":n("ui.projects.projects_view_switcher.project_view"),"data-tour-tag":"projects-view-switcher",children:eu.map(r=>t.jsx(Ma,{value:r.value,children:r.label},r.value))})})),nu=["r1","r2","r3","r4","r5","r6"],au=4e3,Sr={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")}},_u=({nowMs:e=Date.now()})=>{I();const{projectId:s}=ba(),r=Bt(),a=nt(),o=va(a.data,"projects",1),i=o==="enabled",l=ye(a.data,"projects",Qo),c=Ar(ye(a.data,"team_catalogue")),u=so(i),p=no(),m=$r(),_=zr(),[j,f]=d.useState(!1),[g,S]=d.useState(()=>tu()),[b,x]=d.useState(()=>So()),[w,T]=d.useState(null),[k,q]=d.useState(""),[C,E]=d.useState(sr),[M,h]=d.useState(()=>wi()),[A,D]=d.useState(""),F=d.useRef(""),H=d.useRef(null),U=d.useRef(null),Y=N=>{H.current!==null&&(window.cancelAnimationFrame(H.current),H.current=null),N!==""&&N===F.current?(D(""),H.current=window.requestAnimationFrame(()=>{H.current=null,D(N)})):D(N),F.current=N,U.current!==null&&window.clearTimeout(U.current),U.current=window.setTimeout(()=>{U.current=null,F.current="",D("")},au)},J=()=>{H.current!==null&&(window.cancelAnimationFrame(H.current),H.current=null),U.current!==null&&(window.clearTimeout(U.current),U.current=null),F.current="",D("")},Z=N=>{q(N),J()},me=N=>{E(N),J()},oe=d.useRef(null),ee=lc(),te=u.data??[],v=Ps(e),y=di(k,i&&l),O=an(k),L=d.useMemo(()=>y.answer?li(te,y.answer.projects):null,[te,y.answer]),B=O!=="",K=d.useMemo(()=>B?L??ci(te,O):te,[te,O,B,L]),X=L===null?"client":"backend",$=d.useMemo(()=>hi(K,C,v),[K,C,v]),je=l&&B&&y.pending,ie=B||!mt(C),z=d.useMemo(()=>Xs(te,b,e),[te,b,e]),se=d.useMemo(()=>Xs($,b,e),[$,b,e]),xe=No(b),fe=g==="board"?se.length:$.length,Ie=!ie||!u.isSuccess?null:g==="board"?n("ui.projects.projects_page.length_of_length_2_in_window",{length:V(se.length,{useGrouping:!1}),length_2:V(z.length,{useGrouping:!1})}):n("ui.projects.projects_page.length_of_length_2_projects",{length:V($.length,{useGrouping:!1}),length_2:te.length}),re=u.isSuccess&&te.length>0,De=re&&ie&&fe===0&&!je,Ye=je&&fe===0&&re,[Wt,it]=d.useState(!1);d.useEffect(()=>{if(!Wt)return;const N=document.querySelector('[data-tour-tag="projects-board-window"]');N&&(N.focus(),it(!1))}),d.useEffect(()=>{if(!i||s)return;const N=W=>{const Q=W.target;if(!Q||Q.isContentEditable||["INPUT","TEXTAREA","SELECT"].includes(Q.tagName)||Q.closest('[role="dialog"]'))return;const Ce=W.key==="/"&&!W.metaKey&&!W.ctrlKey&&!W.altKey,le=(W.metaKey||W.ctrlKey)&&W.key.toLowerCase()==="f";!Ce&&!le||(W.preventDefault(),oe.current?.focus())};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[i,s]);const ct=d.useRef(null);d.useLayoutEffect(()=>{if(!s)return;const N=ct.current;N!==null&&(N.scrollTop=0)},[s]);const St=ro(g==="timeline"?te.map(N=>N.id):[],i),P=new Map(te.map((N,W)=>[N.id,St[W]])),ce=$.map(N=>({project:N,milestones:P.get(N.id)?.data?.project.milestones??[]})),lt=g==="timeline"?$.filter(N=>P.get(N.id)?.isLoading).length:0,Ne=g==="timeline"?$.filter(N=>P.get(N.id)?.isError).length:0,Ct=()=>{for(const N of St)N.isError&&N.refetch()},Ke=N=>{h(N),ki(N),Y(Ni(N))},On=(N,W)=>{E(Q=>cn(Q,N,W)),J()},Et=()=>{const N=k.trim()!=="",W=!mt(C),Q=M!==null;q(""),E(sr),M!==null&&Ke(null),Y(Si({search:N,filters:W,sort:Q}))},Fs=()=>{x("all"),Js("all"),it(!0)},[Se,qs]=d.useState(null),Vt=d.useRef(!1),Bs=()=>{Vt.current=!1,qs(null)},[Mn,Us]=d.useState([]),In=ye(a.data,"projects_force_done"),Ln=(N,W)=>{const Q=N.id,Ce=ae(W).label;Us(le=>le.includes(Q)?le:[...le,Q]),Wi({move:()=>m.mutateAsync({key:Q,fields:{status:W}}),forceDoneOffered:In,claimQuestion:()=>Vt.current?!1:(Vt.current=!0,!0)}).then(le=>{if(le.kind==="accepted"){ve(n("ui.projects.projects_page.moved_to_label",{label:String(Ce)})),u.refetch().then(()=>ee(Q));return}if(le.kind==="question"){qs({project:N,status:W,refusal:le.refusal});return}de(le.copy,le.refusal?{action:{get label(){return n("ui.projects.projects_page.view_project")},onClick:()=>void r(`/projects/${Q}`)}}:void 0),ee(Q)}).finally(()=>{Us(le=>le.filter(Fn=>Fn!==Q))})};return i?s?t.jsx("div",{ref:ct,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(Fl,{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(Hs,{title:n("ui.projects.projects_page.projects"),icon:Vs,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(G,{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($a,{})}),t.jsxs(G,{variant:"secondary",onClick:()=>f(!0),"data-tour-tag":"create-project-button",children:[t.jsx(pt,{}),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(ru,{value:g,onChange:N=>{S(N),su(N)}}),t.jsx(Ql,{projects:K,query:k,onQueryChange:Z,filters:C,onFiltersChange:me,onClearAll:Et,todayMs:v,resultText:Ie,countRevealClass:g==="board"?"@[47rem]:inline":void 0,disabled:u.isError,searchFieldRef:oe,trailing:g==="board"&&!(u.isSuccess&&u.data.length===0)?t.jsx(Vi,{value:b,onChange:N=>{x(N),Js(N)}}):null})]}),t.jsx(Zl,{filters:C,sort:M,onFiltersChange:me,onSortChange:Ke,onClearAll:Et,hideClearAll:De,searchFieldRef:oe}),t.jsx("output",{"data-project-announcement":"",className:"sr-only","aria-live":"polite",children:A})]})]}),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")}),nu.map(N=>t.jsxs("div",{className:"flex items-center gap-3 px-9 py-2","aria-hidden":"true",children:[t.jsx(He,{className:"h-4 min-w-0 flex-1 bg-elevated"}),t.jsx(He,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(He,{className:"h-4 w-32 shrink-0 bg-elevated"}),t.jsx(He,{className:"h-4 w-16 shrink-0 bg-elevated"}),t.jsx(He,{className:"h-4 w-20 shrink-0 bg-elevated"}),t.jsx(He,{className:"h-4 w-40 shrink-0 bg-elevated"})]},N))]}),u.isError&&t.jsxs("div",{className:"flex flex-col items-start gap-2 px-6",children:[t.jsx(ts,{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(G,{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(G,{variant:"primary",onClick:()=>f(!0),"data-tour-tag":"create-project-empty-button",children:[t.jsx(pt,{}),n("ui.projects.projects_page.new_project")]})]}),Ye&&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&&De&&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:k.trim()?n("ui.projects.projects_page.no_projects_match_trim",{trim:String(k.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:k.trim()?Jo[X]: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(G,{variant:"secondary",onClick:()=>{Et(),oe.current?.focus()},children:n("ui.projects.projects_page.clear_all")}),g==="board"&&$.length>0&&t.jsx(G,{variant:"secondary",onClick:Fs,children:n("ui.projects.projects_page.show_all_time")})]})]}),re&&!De&&!Ye&&g==="list"&&t.jsx(Hl,{projects:$,nowMs:e,onOpen:N=>void r(`/projects/${N.id}`),sort:M,onSortChange:Ke,searchPopulation:K,filters:C,query:k,todayMs:v,onToggleFilter:On,onClearFilters:Et,teamLabelFor:c}),re&&!De&&g==="board"&&se.length>0&&t.jsx(dc,{projects:se,nowMs:e,onOpen:N=>void r(`/projects/${N.id}`),onEdit:N=>void r(`/projects/${N.id}`),onDelete:T,onMove:Ln,teamLabelFor:c,movingKeys:Mn}),re&&!De&&!Ye&&g==="board"&&se.length===0&&xe!==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:xe}),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(G,{variant:"secondary",onClick:Fs,children:n("ui.projects.projects_page.show_all_time")})]}),re&&!De&&!Ye&&g==="timeline"&&t.jsx(Vl,{items:ce,nowMs:e,onOpen:N=>void r(`/projects/${N.project.id}`),pendingDetails:lt,failedDetails:Ne,onRetryDetails:Ct,teamLabelFor:c})]}),t.jsx(vn,{open:w!==null,projectName:w?.name??"",onClose:()=>T(null),onConfirm:async N=>{w&&(await _.mutateAsync({key:w.id,confirmedName:N}),ve(n("ui.projects.projects_page.project_deleted")),T(null))}}),t.jsx(kn,{open:Se!==null,refusal:Se?.refusal??null,projectLabel:Se?ne(Se.project):"",onClose:()=>{Se&&ee(Se.project.id),Bs()},onConfirm:async()=>{if(!Se)return;const{project:N,status:W,refusal:Q}=Se,Ce=await m.mutateAsync({key:N.id,fields:{status:W},forceDone:!0});ve(nn(Ce,Q.count,ae(W).label)),u.refetch().then(()=>ee(N.id))},secondaryLabel:n("ui.projects.projects_page.open_project"),onSecondary:()=>{const N=Se?.project.id;Bs(),N&&r(`/projects/${N}`)}}),t.jsx(Bl,{open:j,onClose:()=>f(!1),onSubmit:async N=>{const W=await p.mutateAsync(N.fields),Q=N.followUp?.title??N.fields.name;if(N.followUp)try{await m.mutateAsync({key:W.id,fields:N.followUp})}catch(Ce){const le=Ce instanceof Error&&Ce.message?Ce.message:"";de(n("ui.projects.projects_page.project_label_was_created_but_the_extra_fields_were_not_saved_val",{label:String(Q),value2:String(yt(le)||n("ui.projects.projects_page.the_server_refused_them"))}));return}ve(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(Hs,{title:n("ui.projects.projects_page.projects"),icon:Vs}),a.isLoading?t.jsx("div",{className:"flex justify-center py-16",children:t.jsx(Te,{label:n("ui.projects.projects_page.checking_the_server_s_projects_support")})}):t.jsx(ts,{variant:"warning",children:Sr[o]??Sr.unknown})]})};export{_u as ProjectsPage};
@@ -0,0 +1 @@
1
+ import{W as y,X as w,Y as f,Z as T,_ as v,$,a0 as A}from"./conversation-input-sync-i6ilfEnc.js";import{p as d,P as R,a as L,b as I,c as N,d as P}from"./ui-preferences-store-BWYRkg79.js";import{l as S,b as E}from"./index-Re5k_KqO.js";const p={malware_or_exploitation:"Instructions to build or spread malware, or to attack systems you do not own, cannot be published.",credential_theft:"Instructions to obtain someone else's credentials or tokens cannot be published.",fraud_or_deception:"Instructions to deceive or defraud people cannot be published.",harassment_or_hate:"Instructions to harass, threaten or target people cannot be published.",sexual_content_minors:"This agent cannot be published. If you believe this is a mistake, contact support.",sexual_content:"Explicit sexual content cannot be published.",violence_or_weapons:"Instructions to build weapons or to injure people cannot be published.",drugs_or_controlled_substances:"Instructions to make or traffic illegal drugs cannot be published.",self_harm:"This agent cannot be published. If you believe this is a mistake, contact support.",mass_surveillance_or_privacy_abuse:"Instructions to surveil or profile people without their consent cannot be published.",evasion_or_abuse_tooling:"Instructions to evade or defeat safety and anti-abuse systems cannot be published.",prompt_injection:"This instruction set tries to instruct the reviewer rather than describe an agent, so it cannot be published.",unclear_dual_use:"We could not tell whether this is aimed at your own systems or someone else's. Add a sentence stating the scope and target, then publish again.",other_harmful:"This agent was rejected because its instructions would cause harm."},O=e=>{const n=e.trim();return n.length>12&&/\s/.test(n)&&!/^(not found|bad request|unauthorized|error|internal server error)\.?$/i.test(n)};function z(e){const n=e?.categories?.[0];return n&&v(n)?p[n]:p.other_harmful}function k(e,n){const t=n?.rule?` ${n.rule}`:"";switch(n?.field){case"name":return{body:`Name${t||" is not acceptable"}.`,field:"name"};case"instructions":return{body:t?`The instruction body${t}.`:`The instruction body must be between 1 and ${R} characters.`,field:"instructions"};case"description":return{body:`Description${t}.`,field:"description"};case"tools":return{body:`Tools${t}.`,field:"tools"};case"when_to_use":return{body:`When to use${t}.`,field:"when_to_use"};case"categories":return{body:`Categories${t}.`,field:"categories"};case"tags":return{body:`Tags${t}.`,field:"tags"};default:return{body:e,field:null}}}function H(e,n){const t=n.surface==="pull",a=t?"Nothing was pulled.":"Nothing was published.",o=t?"pull again":"publish again",s=n.name.trim()||(t?"this team":"this agent");switch(e.code){case"name_taken":return e.details?.owned_by_caller===!0?{variant:"danger",headline:"You already published this agent",body:`You published "${s}" already. Update that listing instead of publishing a second one.`,note:null,actions:e.details?.existing_agent_id||n.hubAgentId?["update-listing","focus-name"]:["focus-name"]}:{variant:"danger",headline:"That name is taken",body:`"${s}" is already published on the hub by another account. Agent names are unique across the hub.`,note:null,actions:["focus-name"]};case"name_claim_in_flight":return{variant:"warning",headline:"That name is being published right now",body:`Someone is publishing an agent called "${s}" at this moment. It is not claimed — try again in a moment.`,note:null,actions:["retry"]};case"name_reserved_builtin":{const i=e.details?.builtin_name,u=i?d(i)===d(s):!1;return{variant:"danger",headline:"That name is reserved",body:i&&!u?`"${s}" is reserved by the built-in agent "${i}". Built-in names cannot be published to the hub.`:`"${i??s}" is the name of a built-in agent. Built-in names cannot be published to the hub.`,note:null,actions:["focus-name","install-builtin"]}}case"moderation_rejected":return{variant:"danger",headline:"This agent was not accepted",body:e.details?.reason?.trim()||e.message,note:z(e.details),actions:["edit-instructions"]};case"moderation_unavailable":return{variant:"warning",headline:"Review is temporarily unavailable",body:"We could not review this agent just now. Nothing was published. Try again in a minute.",note:null,actions:["retry"]};case"invalid_instruction_set":{const{body:i,field:u}=k(e.message,e.details);return{variant:"danger",headline:"The agent document is not valid",body:i,note:null,actions:u==="name"?["focus-name"]:u==="instructions"?["edit-instructions"]:["edit-agent"]}}case"payload_too_large":{const i=e.details?.limit_bytes;return{variant:"danger",headline:"This agent is too large to publish",body:i?`The instruction set is larger than ${Math.round(i/1024)} KiB. Shorten the instructions.`:"The instruction set is larger than the hub accepts. Shorten the instructions.",note:null,actions:["edit-instructions"]}}case"not_owner":return{variant:"danger",headline:"You cannot update this listing",body:"This listing belongs to another account.",note:null,actions:["publish-as-new"]};case"agent_not_found":return{variant:"danger",headline:"That listing no longer exists",body:"It may have been delisted.",note:null,actions:["publish-as-new","refresh-hub"]};case"hub_unauthorized":return{variant:"danger",headline:"The hub refused this machine's sign-in",body:`${a} Sign in to Radient again to replace the credential the hub refused, then ${o}.`,note:null,actions:["sign-in"]};case"hub_unavailable":return{variant:"warning",headline:t?"The pull did not go through":"The publication did not go through",body:O(e.message)?e.message:`${a} Try again in a moment, or update the backend if the hub has moved.`,note:null,actions:["retry"]};case"local_failure":return{variant:"warning",headline:t?"The team could not be pulled from this machine":"The agent could not be published from this machine",body:e.message,note:null,actions:["retry"]};case"team_plan_required":return{variant:"warning",headline:"That organization needs an active Team plan",body:t?"Reading an organization's teams is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then pull again.":"Sharing agents inside an organization is part of the Team plan. Ask an owner of the organization to activate it in the Radient console, then publish again.",note:null,actions:["retry"]};case"not_a_member":return{variant:"danger",headline:"You are not a member of that organization",body:`${a} Ask an owner of the organization to invite you, then ${o}.`,note:null,actions:[]};case"insufficient_role":{const i=e.details?.required;return{variant:"danger",headline:"Your organization role does not allow this",body:i?`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} the ${i} role. Ask an owner of the organization to change your role, then ${o}.`:`${t?"Reading an organization's teams needs":"Publishing into an organization needs"} a higher role than yours. Ask an owner of the organization to change your role, then ${o}.`,note:null,actions:[]}}case"team_not_found":return{variant:"danger",headline:"That team is no longer published",body:"It may have been delisted since this page was loaded.",note:null,actions:["refresh-hub"]};default:return{variant:"danger",headline:"The agent could not be published",body:e.message,note:null,actions:["retry"]}}}const C=[/^(?:Download agent from Radient failed: )?(?:Error downloading agent from Radient: )?\s*/,/^Failed to download agent(?: [^\s]+)? from Radient Agent Hub(?: due to a requests error)?:\s*/,/^[A-Za-z_][\w.]*\([^)]*\):\s*/],U=/^(\d{3})\b/,B=new Set([404,410]),q=["read timed out","connection timed out","connection refused","connection aborted","connection reset","connectionerror","connecttimeout","remote end closed connection","max retries exceeded","temporary failure in name resolution","name or service not known","no route to host"],x=e=>{const n=e.toLowerCase();return q.some(t=>n.includes(t))||T(e)},D=(e,n)=>{const t=n.trim()?`"${n.trim()}"`:"That agent";if(w(e))switch(e.code){case"agent_not_found":return`${t} is no longer on the hub, so nothing was downloaded.`;case"hub_unavailable":return`The hub did not complete the download, so ${t} was not downloaded.`;default:return`${t} was not downloaded: ${e.message}`}const a=C.reduce((s,i)=>s.replace(i,""),f(e,"").trim()).trim();if(!a)return`${t} could not be downloaded.`;const o=Number(U.exec(a)?.[1]??Number.NaN);return B.has(o)?`${t} is no longer on the hub, so nothing was downloaded.`:x(a)||o===408?`The hub could not be reached, so ${t} was not downloaded.`:o===429?`The hub is busy, so ${t} was not downloaded. Try again in a moment.`:o===401||o===403?`The hub refused this machine's sign-in, so ${t} was not downloaded.`:o>=500?`The hub could not complete the download, so ${t} was not downloaded. Try again in a moment.`:o>=400?`The hub refused the download, so ${t} is not here.`:`${t} was not downloaded: ${a}`},F="The action did not complete.",G=(e,n,t)=>e==="download"?D(n,t):y(F,n),X={"focus-name":"Choose another name","update-listing":"Update the existing listing","install-builtin":"Install the built-in instead",retry:"Try again","edit-instructions":"Edit the instructions","edit-agent":"Edit the agent","publish-as-new":"Publish as a new listing","sign-in":"Sign in again","refresh-hub":"Refresh the hub"},j="download_count",g={all:["public-agents"],list:e=>[...g.all,"list",{page:e.page,perPage:e.perPage,categories:e.categories?.join(",")??void 0,name:e.name??void 0,description:e.description??void 0,sort:e.sort,order:e.order}]},h={all:["org-agents"],list:(e,n)=>[...h.all,"list",e,{page:n.page,perPage:n.perPage,categories:n.categories?.join(",")??void 0,name:n.name??void 0,description:n.description??void 0,sort:n.sort,order:n.order}]},K=e=>e&&e[0]===h.all[0]?String(e[2]??""):null,Z=e=>e.invalidateQueries({queryKey:g.all}),J=(e,n)=>e.invalidateQueries({queryKey:n?[...h.all,"list",n]:h.all}),V=({page:e=1,perPage:n=20,enabled:t=!0,categories:a,name:o,description:s,sort:i=j,order:u="desc",tenantId:c}={})=>{const b={page:e,perPage:n,categories:a,name:o,description:s,sort:i,order:u},_=c?h.list(c,b):g.list(b),l=$({queryKey:_,queryFn:async()=>{const r={};return a&&a.length>0&&(r.categories=a.join(",")),o&&(r.name=o),s&&(r.description=s),r.sort=i,r.order=u,c?await S(c,e,n,r):await E(e,n,r)},select:r=>r.result,enabled:t,retry:A,staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!1,placeholderData:(r,m)=>K(m?.queryKey)===(c??null)?r:void 0});return{...l,agents:l.data?.records,isRefreshing:l.isFetching&&l.data!==void 0,pagination:l.data?{page:l.data.page,perPage:l.data.per_page,totalPages:l.data.total_pages,totalRecords:l.data.total_records}:void 0}},M={name:"Name",description:"Description",instructions:"The instruction body",tools:"Tools"};function ee(e){const n=[],t=(a,o)=>{o&&n.push({field:a,message:`${M[a]} ${o}.`})};return t("name",L(e.name)),t("description",I(e.description)),e.instructions!==null&&t("instructions",N(e.instructions)),t("tools",P(e.tools??[])),n}function ne(e,n){const t=d(e);return n.some(a=>d(a)===t)}function te(e){for(const n of e??[]){const t=n.indexOf(":");if(t<0||n.slice(0,t).trim().toLowerCase()!=="tools")continue;const a=n.slice(t+1).split(",").map(o=>o.trim()).filter(Boolean);return a.length>0?a:null}return null}function ae(e,n){const t=d(e);return n.find(a=>d(a)===t)??null}export{X as P,G as a,g as b,J as c,ne as d,ee as e,Z as i,ae as l,H as p,te as t,V as u};
@@ -1,4 +1,4 @@
1
- import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as qt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-BKDqOsvz.js";import{v as $t}from"./conversation-input-sync-DdFRR8Sk.js";import"./index-Doo51Mbi.js";import"./ui-preferences-store-CFbBU1td.js";import"./error-boundary-B2fmvLyi.js";var Ct=function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:m,5:b,10:y,12:T,13:q,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:m,5:b,10:y,12:T,13:q,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:m,5:b,10:y,12:T,13:q,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var qe=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function me(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(me,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`:
1
+ import{_ as r,s as be,g as Se,t as te,q as _e,a as Ae,b as ke,c as Et,l as qt,d as vt,e as Fe,z as Pe,H as D,M as ve,i as Ce}from"./mermaid.core-DdYe4AYl.js";import{v as $t}from"./conversation-input-sync-i6ilfEnc.js";import"./index-6crVx9hx.js";import"./ui-preferences-store-BWYRkg79.js";import"./error-boundary-LwhkYl0Z.js";var Ct=function(){var t=r(function(M,s,l,u){for(l=l||{},u=M.length;u--;l[M[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],rt=[1,14],ct=[1,23],dt=[1,18],ut=[1,19],xt=[1,20],ot=[1,21],bt=[1,22],lt=[1,24],i=[1,25],Dt=[1,26],zt=[1,27],Vt=[1,28],It=[1,29],W=[1,32],U=[1,33],k=[1,34],F=[1,39],P=[1,40],v=[1,42],C=[1,44],O=[1,62],H=[1,61],L=[4,5,8,10,12,13,14,18,44,47,49,55,56,57,63,64,65,66,67],wt=[1,65],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],I=[4,5,6,7,8,9,10,11,12,13,14,15,18],G=[1,90],K=[1,91],Z=[1,92],J=[1,99],$=[1,93],tt=[1,96],et=[1,94],it=[1,95],at=[1,97],nt=[1,98],St=[1,102],jt=[10,55,56,57],R=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(_,[2,34]),{27:45,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:46,4:m,5:b,10:y,12:T,13:q,14:g,18:rt,25:ct,35:dt,37:ut,39:xt,41:ot,42:bt,48:lt,50:i,51:Dt,52:zt,53:Vt,54:It,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,47]},{38:[1,48]},{40:[1,49]},t(c,[2,45]),t(c,[2,46]),{18:[1,50]},{4:m,5:b,10:y,12:T,13:q,14:g,43:51,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:52,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:53,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:54,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:55,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,10:y,12:T,13:q,14:g,43:56,58:31,60:W,61:U,63:k,64:F,65:P,66:v,67:C},{4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,44:[1,57],47:[1,58],58:60,59:59,63:k,64:F,65:P,66:v,67:C},t(L,[2,64]),t(L,[2,66]),t(L,[2,67]),t(L,[2,70]),t(L,[2,71]),t(L,[2,72]),t(L,[2,73]),t(L,[2,74]),t(L,[2,75]),t(L,[2,76]),t(L,[2,77]),t(L,[2,78]),t(L,[2,79]),t(L,[2,80]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:64,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,21:63},t(c,[2,53],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,49:[1,77],63:k,64:F,65:P,66:v,67:C}),t(c,[2,56],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,49:[1,78],63:k,64:F,65:P,66:v,67:C}),t(c,[2,57],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,58],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,59],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,60],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),{45:[1,79]},{44:[1,80]},t(L,[2,65]),t(L,[2,81]),t(L,[2,82]),t(L,[2,83]),{3:82,4:wt,5:Bt,6:Rt,7:Nt,8:Wt,9:Ut,10:Qt,11:Ot,12:Ht,13:Xt,14:Mt,15:Yt,18:[1,81]},t(I,[2,23]),t(I,[2,1]),t(I,[2,2]),t(I,[2,3]),t(I,[2,4]),t(I,[2,5]),t(I,[2,6]),t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12]),t(c,[2,52],{58:31,43:83,4:m,5:b,10:y,12:T,13:q,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),t(c,[2,55],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,60:W,61:U,63:k,64:F,65:P,66:v,67:C}),{46:[1,85]},{45:[1,86]},{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:88,23:87},t(I,[2,24]),t(c,[2,51],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,54],{59:59,58:60,4:m,5:b,8:O,10:y,12:T,13:q,14:g,18:H,63:k,64:F,65:P,66:v,67:C}),t(c,[2,47],{22:88,16:89,23:100,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{46:[1,101]},t(c,[2,29],{10:St}),t(jt,[2,27],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),t(R,[2,25]),t(R,[2,13]),t(R,[2,14]),t(R,[2,15]),t(R,[2,16]),t(R,[2,17]),t(R,[2,18]),t(R,[2,19]),t(R,[2,20]),t(R,[2,21]),t(R,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:88,16:89,23:104,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt}),{4:G,5:K,6:Z,8:J,11:$,13:tt,16:89,17:et,18:it,19:at,20:nt,22:105},t(R,[2,26]),t(c,[2,50],{10:St}),t(jt,[2,28],{16:103,4:G,5:K,6:Z,8:J,11:$,13:tt,17:et,18:it,19:at,20:nt})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Gt=0,ye=2,Kt=1,Te=e.slice.call(arguments,1),E=Object.create(this.lexer),Y={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(Y.yy[At]=this.yy[At]);E.setInput(s,Y.yy),Y.yy.lexer=E,Y.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var kt=E.yylloc;e.push(kt);var qe=E.options&&E.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function me(B){u.length=u.length-2*B,A.length=A.length-B,e.length=e.length-B}r(me,"popStack");function Zt(){var B;return B=d.pop()||E.lex()||Kt,typeof B!="number"&&(B instanceof Array&&(d=B,B=d.pop()),B=l.symbols_[B]||B),B}r(Zt,"lex");for(var w,j,N,Ft,st={},pt,X,Jt,yt;;){if(j=u[u.length-1],this.defaultActions[j]?N=this.defaultActions[j]:((w===null||typeof w>"u")&&(w=Zt()),N=ht[j]&&ht[j][w]),typeof N>"u"||!N.length||!N[0]){var Pt="";yt=[];for(pt in ht[j])this.terminals_[pt]&&pt>ye&&yt.push("'"+this.terminals_[pt]+"'");E.showPosition?Pt="Parse error on line "+(gt+1)+`:
2
2
  `+E.showPosition()+`
3
3
  Expecting `+yt.join(", ")+", got '"+(this.terminals_[w]||w)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(w==Kt?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(Pt,{text:E.match,token:this.terminals_[w]||w,line:E.yylineno,loc:kt,expected:yt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+j+", token: "+w);switch(N[0]){case 1:u.push(w),A.push(E.yytext),e.push(E.yylloc),u.push(N[1]),w=null,Gt=E.yyleng,n=E.yytext,gt=E.yylineno,kt=E.yylloc;break;case 2:if(X=this.productions_[N[1]][1],st.$=A[A.length-X],st._$={first_line:e[e.length-(X||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(X||1)].first_column,last_column:e[e.length-1].last_column},qe&&(st._$.range=[e[e.length-(X||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(st,[n,Gt,gt,Y.yy,N[1],A,e].concat(Te)),typeof Ft<"u")return Ft;X&&(u=u.slice(0,-1*X*2),A=A.slice(0,-1*X),e=e.slice(0,-1*X)),u.push(this.productions_[N[1]][0]),A.push(st.$),e.push(st._$),Jt=ht[u[u.length-2]][u[u.length-1]],u.push(Jt);break;case 3:return!0}}return!0},"parse")},pe=function(){var M={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+`