local-operator-ui 0.39.9 → 0.41.0

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 (126) hide show
  1. package/out/main/index.js +450 -37
  2. package/out/preload/index.js +24 -2
  3. package/out/renderer/assets/{_basePickBy-op663AbZ.js → _basePickBy--UFblcLV.js} +1 -1
  4. package/out/renderer/assets/{_baseUniq-BmA1_2me.js → _baseUniq-Ct7pRnI4.js} +1 -1
  5. package/out/renderer/assets/{agent-details-page-DD95Pj8m.js → agent-details-page-Col1VcjS.js} +2 -2
  6. package/out/renderer/assets/{agent-hub-page-KqbaZ4jt.js → agent-hub-page-CTPn6yGs.js} +2 -2
  7. package/out/renderer/assets/agents-page-CBWj1DTr.js +7 -0
  8. package/out/renderer/assets/arc-B-YNVaQW.js +1 -0
  9. package/out/renderer/assets/architectureDiagram-IEHRJDOE-DCzmuMLj.js +36 -0
  10. package/out/renderer/assets/{blockDiagram-JOT3LUYC-BbL6rC8t.js → blockDiagram-JOT3LUYC-f1GS2_U0.js} +6 -6
  11. package/out/renderer/assets/{book-open-C5VnLNlM.js → book-open-Cb4F-cRs.js} +1 -1
  12. package/out/renderer/assets/browser-page-BfJd3-qS.js +1 -0
  13. package/out/renderer/assets/browser-webauthn-prompt-ghcPWp0R.js +1 -0
  14. package/out/renderer/assets/{building-2-BinkVpHL.js → building-2-C_YBTC7O.js} +1 -1
  15. package/out/renderer/assets/{c4Diagram-VJAJSXHY-TY6fUFKt.js → c4Diagram-VJAJSXHY-BlePs8Im.js} +1 -1
  16. package/out/renderer/assets/channel-BFAjMbH6.js +1 -0
  17. package/out/renderer/assets/{chunk-4BMEZGHF-dLL3W7IZ.js → chunk-4BMEZGHF-Bse1IaHb.js} +1 -1
  18. package/out/renderer/assets/{chunk-A2AXSNBT-D78WiLnh.js → chunk-A2AXSNBT-CncpJ5It.js} +1 -1
  19. package/out/renderer/assets/{chunk-AEK57VVT-BKmfkMGW.js → chunk-AEK57VVT-37Z6jWz2.js} +1 -1
  20. package/out/renderer/assets/{chunk-D6G4REZN-CZre37TG.js → chunk-D6G4REZN-BR9ZpBMV.js} +1 -1
  21. package/out/renderer/assets/{chunk-RZ5BOZE2-BVFKaoz8.js → chunk-RZ5BOZE2-KrZ6g0pV.js} +1 -1
  22. package/out/renderer/assets/{chunk-XZIHB7SX-C4B9nFg3.js → chunk-XZIHB7SX-BUwRYMe9.js} +1 -1
  23. package/out/renderer/assets/classDiagram-GIVACNV2-CmW0Ezdi.js +1 -0
  24. package/out/renderer/assets/classDiagram-v2-COTLJTTW-CmW0Ezdi.js +1 -0
  25. package/out/renderer/assets/clone-B_pc7cSP.js +1 -0
  26. package/out/renderer/assets/console-mirror-DPVG6sWK.js +44 -0
  27. package/out/renderer/assets/consoleCapture-Coky9UhD.js +1 -0
  28. package/out/renderer/assets/{conversation-input-sync-Drf7pG8h.js → conversation-input-sync-C2vqs6ad.js} +252 -309
  29. package/out/renderer/assets/dagre-OKDRZEBW-CGv1CEcm.js +4 -0
  30. package/out/renderer/assets/diagram-SSKATNLV-u_zFGYu8.js +43 -0
  31. package/out/renderer/assets/diagram-VNBRO52H-Bme6bFvQ.js +24 -0
  32. package/out/renderer/assets/{erDiagram-Q7BY3M3F-CbYsJOXr.js → erDiagram-Q7BY3M3F-B-KkjVtc.js} +1 -1
  33. package/out/renderer/assets/error-boundary-DJSaJHcb.js +126 -0
  34. package/out/renderer/assets/{flowDiagram-4HSFHLVR-xksRM4qL.js → flowDiagram-4HSFHLVR-CSZy2b_d.js} +1 -1
  35. package/out/renderer/assets/ganttDiagram-APWFNJXF-CpYOSVKU.js +257 -0
  36. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-WOOSBsBb.js +65 -0
  37. package/out/renderer/assets/{graph-F4dHmEZ9.js → graph-Du8nFp-Q.js} +1 -1
  38. package/out/renderer/assets/hash--PQTQMu2.js +6 -0
  39. package/out/renderer/assets/heart-CVGkdUzT.js +6 -0
  40. package/out/renderer/assets/index-AGCqaeOI.js +7 -0
  41. package/out/renderer/assets/index-ALGblIL0.css +1 -0
  42. package/out/renderer/assets/index-BYeiLB51.js +57 -0
  43. package/out/renderer/assets/index-D8L83jtw.js +835 -0
  44. package/out/renderer/assets/index-fw54FEnm.js +1 -0
  45. package/out/renderer/assets/infoDiagram-PH2N3AL5-BprulvMk.js +2 -0
  46. package/out/renderer/assets/{installer-AUhVnro1.js → installer-muZhWyyS.js} +1 -1
  47. package/out/renderer/assets/{journeyDiagram-U35MCT3I-BKYQCvNS.js → journeyDiagram-U35MCT3I-DfdLRQAF.js} +1 -1
  48. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-Af9PLtCI.js → kanban-definition-NDS4AKOZ-R6IsuYWB.js} +1 -1
  49. package/out/renderer/assets/{layout-DArRUuWc.js → layout-05Xak_7z.js} +1 -1
  50. package/out/renderer/assets/legacy-agents-page-Dpl33Kla.js +33 -0
  51. package/out/renderer/assets/library-page-BNrffbLi.js +157 -0
  52. package/out/renderer/assets/{mermaid.core-DeacZbEh.js → mermaid.core-BzKfajYZ.js} +5 -5
  53. package/out/renderer/assets/mesh-page-D6ZzFOeG.js +1 -0
  54. package/out/renderer/assets/mindmap-definition-ALO5MXBD-Dn_l0i7j.js +95 -0
  55. package/out/renderer/assets/mini-BgJE9L7J.js +1 -0
  56. package/out/renderer/assets/{notebook-pen-CAaIu5ma.js → notebook-pen-CtAKsfVm.js} +1 -1
  57. package/out/renderer/assets/org-access-BHt55LAw.js +1 -0
  58. package/out/renderer/assets/org-surface-gate-CqFJQYmV.js +1 -0
  59. package/out/renderer/assets/{page-header-DxdkMDUw.js → page-header-BlIvE-Ti.js} +1 -1
  60. package/out/renderer/assets/path-utils-CYBk4q7C.js +58 -0
  61. package/out/renderer/assets/{pieDiagram-IB7DONF6-BAijqzhx.js → pieDiagram-IB7DONF6-_W_OzAAk.js} +2 -2
  62. package/out/renderer/assets/{projects-page-CyQadeH9.js → projects-page-DtZ_g9gZ.js} +4 -4
  63. package/out/renderer/assets/publication-validation-D7f3xAgF.js +1 -0
  64. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-B9gsMu2n.js → quadrantDiagram-7GDLP6J5-FQ5Wvxqm.js} +1 -1
  65. package/out/renderer/assets/{radar-MK3ICKWK-f4VBDN4e.js → radar-MK3ICKWK-BRufXucA.js} +1 -1
  66. package/out/renderer/assets/radient-auth-buttons-7i7blC-7.js +1 -0
  67. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-CPNfG1Zx.js → requirementDiagram-KVF5MWMF-CHO8Cq1H.js} +1 -1
  68. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-C4JDJOwX.js +10 -0
  69. package/out/renderer/assets/{schedules-page-CroQduzq.js → schedules-page-6tPgFgS_.js} +4 -4
  70. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BptLOcCw.js → sequenceDiagram-X6HHIX6F-BFf3HnKw.js} +1 -1
  71. package/out/renderer/assets/settings-page-CXOFCx8w.js +287 -0
  72. package/out/renderer/assets/smartart-crAq3DvJ.js +1 -0
  73. package/out/renderer/assets/stateDiagram-DGXRK772-BqFVSIKA.js +1 -0
  74. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-aaVC-oiG.js +1 -0
  75. package/out/renderer/assets/team-bridge-page-BgjJrT3v.js +26 -0
  76. package/out/renderer/assets/{timeline-definition-BDJGKUSR-mfxv2tvk.js → timeline-definition-BDJGKUSR-Cp3uYUSs.js} +1 -1
  77. package/out/renderer/assets/use-download-agent-mutation-C_W8yx0C.js +56 -0
  78. package/out/renderer/assets/use-session-snapshot-vFZD5qIO.js +1 -0
  79. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DU7xqK3g.js → xychartDiagram-VJFVF3MP-DFcICu1Q.js} +1 -1
  80. package/out/renderer/console-capture.html +5 -5
  81. package/out/renderer/index.html +7 -7
  82. package/out/renderer/installer.html +4 -4
  83. package/out/renderer/mini.html +7 -7
  84. package/package.json +2 -2
  85. package/out/renderer/assets/agents-page-BuW5YXsO.js +0 -7
  86. package/out/renderer/assets/arc-BDKgui3b.js +0 -1
  87. package/out/renderer/assets/architectureDiagram-IEHRJDOE-DQ-ywUWn.js +0 -36
  88. package/out/renderer/assets/browser-page-Blp9VxzI.js +0 -1
  89. package/out/renderer/assets/browser-webauthn-prompt-CIVC5zZy.js +0 -1
  90. package/out/renderer/assets/channel-BXgHvdBf.js +0 -1
  91. package/out/renderer/assets/classDiagram-GIVACNV2-DqhUybG_.js +0 -1
  92. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DqhUybG_.js +0 -1
  93. package/out/renderer/assets/clone-Dy0JmXpj.js +0 -1
  94. package/out/renderer/assets/console-mirror-CPwb8uF3.js +0 -44
  95. package/out/renderer/assets/consoleCapture-HmARhax8.js +0 -1
  96. package/out/renderer/assets/dagre-OKDRZEBW-Dh0W2jNu.js +0 -4
  97. package/out/renderer/assets/diagram-SSKATNLV-DRCrONrr.js +0 -43
  98. package/out/renderer/assets/diagram-VNBRO52H-BV4nGPJx.js +0 -24
  99. package/out/renderer/assets/error-boundary-Cxrbe_jr.js +0 -126
  100. package/out/renderer/assets/ganttDiagram-APWFNJXF-mPElU2p8.js +0 -257
  101. package/out/renderer/assets/gitGraphDiagram-7IBYFJ6S-GsnNXRGz.js +0 -65
  102. package/out/renderer/assets/hash-DY3q9E3o.js +0 -6
  103. package/out/renderer/assets/index-D2xD4O43.js +0 -835
  104. package/out/renderer/assets/index-DOY6mKnp.js +0 -1
  105. package/out/renderer/assets/index-DecxvzI1.js +0 -57
  106. package/out/renderer/assets/index-OxbcfWJz.css +0 -1
  107. package/out/renderer/assets/index-n0UKEmyA.js +0 -7
  108. package/out/renderer/assets/infoDiagram-PH2N3AL5-Bj2irJ1P.js +0 -2
  109. package/out/renderer/assets/legacy-agents-page-DoDPY_st.js +0 -33
  110. package/out/renderer/assets/library-page-CCZamoeo.js +0 -157
  111. package/out/renderer/assets/mesh-page-b0Arx7SZ.js +0 -1
  112. package/out/renderer/assets/mindmap-definition-ALO5MXBD-D7Dx3AOZ.js +0 -95
  113. package/out/renderer/assets/mini-BCNMkGXS.js +0 -1
  114. package/out/renderer/assets/org-access-BnJqhAjv.js +0 -1
  115. package/out/renderer/assets/org-surface-gate-C2iuuUmY.js +0 -1
  116. package/out/renderer/assets/publication-validation-BLE_XzAT.js +0 -1
  117. package/out/renderer/assets/radient-auth-buttons-ukARjoyK.js +0 -1
  118. package/out/renderer/assets/sankeyDiagram-QLVOVGJD-BlICGCPu.js +0 -10
  119. package/out/renderer/assets/settings-page-B6GsvZtx.js +0 -287
  120. package/out/renderer/assets/smartart-54M0TKRG.js +0 -1
  121. package/out/renderer/assets/stateDiagram-DGXRK772-LIFxYM21.js +0 -1
  122. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DfyWsnvp.js +0 -1
  123. package/out/renderer/assets/team-bridge-page-CG0IpAuo.js +0 -16
  124. package/out/renderer/assets/ui-preferences-store-BA52R-Fw.js +0 -1
  125. package/out/renderer/assets/use-download-agent-mutation-BxernpiS.js +0 -61
  126. package/out/renderer/assets/use-session-snapshot-sSI_vLQL.js +0 -1
@@ -1 +0,0 @@
1
- import{g as Y,a as E,b as F}from"./library-page-CCZamoeo.js";import"./index-DecxvzI1.js";import"./index-D2xD4O43.js";import"./conversation-input-sync-Drf7pG8h.js";import"./ui-preferences-store-BA52R-Fw.js";import"./error-boundary-Cxrbe_jr.js";import"./console-mirror-CPwb8uF3.js";import"./page-header-DxdkMDUw.js";import"./hash-DY3q9E3o.js";const B=["#4472C4","#ED7D31","#A9D18E","#FF0000","#FFC000","#5B9BD5","#70AD47","#C00000","#7030A0","#00B0F0"];function W(n,t){const c=`accent${n%6+1}`;return t[c]?"#"+t[c]:B[n%B.length]}function j(n,t=.45){const c=parseInt(n.slice(1,3),16),s=parseInt(n.slice(3,5),16),a=parseInt(n.slice(5,7),16),p=Math.round(c+(255-c)*t),M=Math.round(s+(255-s)*t),o=Math.round(a+(255-a)*t);return`rgb(${p},${M},${o})`}function G(n){const t=[];for(const c of E(n,"t")){const s=c.textContent.trim();s&&t.push(s)}return t.join(" ")}function V(n){if(!n)return[];const t=Y(n,"ptLst");if(!t)return[];const c=[];for(const s of E(t,"pt")){const a=F(s,"type","node");if(a==="parTrans"||a==="sibTrans")continue;const p=G(s);(p||a==="node")&&c.push({id:F(s,"modelId",""),type:a,text:p})}return c.filter(s=>s.text)}function z(n){if(!n)return"list";const t=Y(n,"layoutDef")||n,s=(F(t,"uniqueId","")||F(t,"defStyle","")||"").toLowerCase();return s.includes("chevron")||s.includes("arrowprocess")||s.includes("process")?"process":s.includes("cycle")||s.includes("continuouscycle")?"cycle":s.includes("hierarchy")||s.includes("orgchart")||s.includes("org")?"hierarchy":s.includes("radial")||s.includes("diverging")?"radial":s.includes("pyramid")||s.includes("invertedpyramid")?"pyramid":s.includes("funnel")?"funnel":s.includes("venn")?"venn":s.includes("matrix")?"matrix":s.includes("list")||s.includes("bullet")?"list":s.includes("relationship")||s.includes("balance")?"relationship":"list"}function $(n,t,c,s,a,p,M,o="#fff",f="center"){if(!t)return;n.save(),n.fillStyle=o,n.textAlign=f,n.textBaseline="middle";const l=t.split(" "),g=M*1.3;let h=[],r="";for(const u of l){const y=r?r+" "+u:u;n.measureText(y).width>a-4&&r?(h.push(r),r=u):r=y}r&&h.push(r);const i=Math.max(1,Math.floor(p/g));h.length>i&&(h=h.slice(0,i));const e=s-(h.length-1)*g/2;for(let u=0;u<h.length;u++)n.fillText(h[u],c,e+u*g);n.restore()}function I(n,t,c,s=14){const a=Math.floor(t/(s*.55)),p=n.split(" "),M=Math.ceil(p.join(" ").length/Math.max(a,1)),o=c/(M*1.4);return Math.max(8,Math.min(s,o))}function L(n,t,c,s,a,p,M,o){n.save(),n.beginPath(),p=Math.min(p,s/2,a/2),n.moveTo(t+p,c),n.arcTo(t+s,c,t+s,c+a,p),n.arcTo(t+s,c+a,t,c+a,p),n.arcTo(t,c+a,t,c,p),n.arcTo(t,c,t+s,c,p),n.closePath(),M&&(n.fillStyle=M,n.fill()),n.restore()}function X(n,t,c,s,a,p,M=1.5){const o=Math.atan2(a-c,s-t),f=8;n.save(),n.strokeStyle=p,n.fillStyle=p,n.lineWidth=M,n.beginPath(),n.moveTo(t,c),n.lineTo(s,a),n.stroke(),n.beginPath(),n.moveTo(s,a),n.lineTo(s-f*Math.cos(o-.4),a-f*Math.sin(o-.4)),n.lineTo(s-f*Math.cos(o+.4),a-f*Math.sin(o+.4)),n.closePath(),n.fill(),n.restore()}function J(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=a/f,g=Math.min(l*.08,10*o),h=Math.min(l*.12,18*o),r=l-h-g,i=p*.7,e=s+(p-i)/2;for(let u=0;u<f;u++){const y=W(u,M),d=c+l*u+g/2,b=u===f-1;n.save(),n.beginPath();const P=d+r+(b?0:h);n.moveTo(d,e),n.lineTo(d+r,e),b||n.lineTo(P,e+i/2),n.lineTo(d+r,e+i),n.lineTo(d,e+i),u>0&&n.lineTo(d+h,e+i/2),n.closePath(),n.fillStyle=y,n.fill(),n.restore();const m=I(t[u].text,r-h,i)*o;n.font=`${m}px sans-serif`;const T=d+(r+(u>0?h:0))/2;$(n,t[u].text,T,e+i/2,r,i,m)}}function K(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=c+a/2,g=s+p/2,h=Math.min(a,p)*.33,r=Math.min(h*.32,40*o);n.save(),n.strokeStyle="#ccc",n.lineWidth=2*o,n.setLineDash([4*o,4*o]),n.beginPath(),n.arc(l,g,h,0,Math.PI*2),n.stroke(),n.setLineDash([]),n.restore();for(let i=0;i<f;i++){const e=i/f*Math.PI*2-Math.PI/2,u=l+h*Math.cos(e),y=g+h*Math.sin(e),d=W(i,M);if(n.save(),n.beginPath(),n.arc(u,y,r,0,Math.PI*2),n.fillStyle=d,n.fill(),n.restore(),f>1){const P=(i+1)/f*Math.PI*2-Math.PI/2,m=(e+P)/2,T=l+h*Math.cos(e+.15),v=g+h*Math.sin(e+.15),k=l+h*Math.cos(P-.15),S=g+h*Math.sin(P-.15);n.save(),n.strokeStyle=d+"99",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(T,v),n.quadraticCurveTo(l+h*1.1*Math.cos(m),g+h*1.1*Math.sin(m),k,S),n.stroke(),n.restore()}const b=I(t[i].text,r*1.7,r*1.2)*o;n.font=`${b}px sans-serif`,$(n,t[i].text,u,y,r*2,r*1.8,b)}}function O(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=Math.max(l.length,1),h=p/(l.length>0?2.8:1.2),r=h*.75,i=Math.min(a*.3,160*o),e=r,u=c+(a-i)/2,y=s+(h-e)/2,d=W(0,M);L(n,u,y,i,e,6*o,d);const b=I(f.text,i-10*o,e)*o;if(n.font=`bold ${b}px sans-serif`,$(n,f.text,u+i/2,y+e/2,i-10,e,b),!l.length)return;const P=(a-20*o)/g,m=s+h*1.5,T=y+e,v=m-4*o;n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(u+i/2,T),n.lineTo(u+i/2,(T+v)/2),n.lineTo(c+10*o,(T+v)/2),n.lineTo(c+a-10*o,(T+v)/2),n.stroke(),n.restore();for(let k=0;k<l.length;k++){const S=c+P*k+8*o,R=m,A=P-16*o,H=r,N=W(k+1,M);n.save(),n.strokeStyle="#999",n.lineWidth=1.5*o,n.beginPath(),n.moveTo(S+A/2,(T+v)/2),n.lineTo(S+A/2,R),n.stroke(),n.restore(),L(n,S,R,A,H,5*o,N);const D=I(l[k].text,A-8*o,H)*o;n.font=`${D}px sans-serif`,$(n,l[k].text,S+A/2,R+H/2,A-8,H,D)}}function Q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t[0],l=t.slice(1),g=c+a/2,h=s+p/2,r=Math.min(a,p)*.18,i=Math.min(a,p)*.36,e=Math.min(i*.28,38*o),u=l.length||1,y=W(0,M);n.save(),n.beginPath(),n.arc(g,h,r,0,Math.PI*2),n.fillStyle=y,n.fill(),n.restore();const d=I(f.text,r*1.6,r*1.2)*o;n.font=`bold ${d}px sans-serif`,$(n,f.text,g,h,r*2,r*2,d);for(let b=0;b<u;b++){const P=b/u*Math.PI*2-Math.PI/2,m=g+i*Math.cos(P),T=h+i*Math.sin(P),v=W(b+1,M),k=g+r*Math.cos(P),S=h+r*Math.sin(P),R=m-e*Math.cos(P),A=T-e*Math.sin(P);X(n,k,S,R,A,v+"99",1.5*o),n.save(),n.beginPath(),n.arc(m,T,e,0,Math.PI*2),n.fillStyle=v,n.fill(),n.restore();const H=I(l[b].text,e*1.7,e*1.2)*o;n.font=`${H}px sans-serif`,$(n,l[b].text,m,T,e*2,e*1.8,H)}}function U(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=(f-g)/f,r=a*h,i=c+(a-r)/2,e=s+g*l,u=W(g,M);n.save(),n.beginPath(),n.moveTo(i,e+l),n.lineTo(i+r,e+l);const y=a*((f-g-1)/f);n.lineTo(c+(a+y)/2,e),n.lineTo(c+(a-y)/2,e),n.closePath(),n.fillStyle=u,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const d=I(t[g].text,r*.6,l*.7)*o;n.font=`${d}px sans-serif`,$(n,t[g].text,c+a/2,e+l/2,r*.6,l*.7,d)}}function Z(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f;for(let g=0;g<f;g++){const h=1-g/f*.55,r=1-(g+1)/f*.55,i=a*h,e=a*r,u=c+(a-i)/2,y=c+(a-e)/2,d=s+g*l,b=W(g,M);n.save(),n.beginPath(),n.moveTo(u,d),n.lineTo(u+i,d),n.lineTo(y+e,d+l),n.lineTo(y,d+l),n.closePath(),n.fillStyle=b,n.strokeStyle="#fff",n.lineWidth=2*o,n.fill(),n.stroke(),n.restore();const P=(i+e)/2,m=I(t[g].text,P*.8,l*.7)*o;n.font=`${m}px sans-serif`,$(n,t[g].text,c+a/2,d+l/2,P*.8,l*.7,m)}}function _(n,t,c,s,a,p,M,o){if(!t.length)return;const f=Math.min(t.length,4),l=c+a/2,g=s+p/2,h=Math.min(a,p)*(f<=2?.32:.28),r=h*.65,i=[];for(let e=0;e<f;e++)i.push(e/f*Math.PI*2-Math.PI/2);for(let e=0;e<f;e++){const u=f>1?l+r*Math.cos(i[e]):l,y=f>1?g+r*Math.sin(i[e]):g,d=W(e,M);n.save(),n.globalAlpha=.55,n.beginPath(),n.arc(u,y,h,0,Math.PI*2),n.fillStyle=d,n.fill(),n.globalAlpha=1,n.strokeStyle="#fff",n.lineWidth=1.5*o,n.stroke(),n.restore();const b=f>1?l+(r+h*.45)*Math.cos(i[e]):l,P=f>1?g+(r+h*.45)*Math.sin(i[e]):g,m=I(t[e].text,h*1.2,h*.7)*o;n.font=`${m}px sans-serif`,$(n,t[e].text,b,P,h*1.2,h*.7,m,"#333")}}function w(n,t,c,s,a,p,M,o){const f=[t[0]||{text:""},t[1]||{text:""},t[2]||{text:""},t[3]||{text:""}],l=a/2,g=p/2,h=8*o;for(let r=0;r<2;r++)for(let i=0;i<2;i++){const e=r*2+i,u=c+i*l+h,y=s+r*g+h,d=l-h*2,b=g-h*2,P=W(e,M);L(n,u,y,d,b,8*o,P);const m=I(f[e].text,d-10,b)*o;n.font=`${m}px sans-serif`,$(n,f[e].text,u+d/2,y+b/2,d-10,b,m)}}function q(n,t,c,s,a,p,M,o){if(!t.length)return;const f=t.length,l=p/f,g=Math.min(l*.2,14*o),h=g*3;for(let r=0;r<f;r++){const i=s+r*l,e=i+l/2,u=W(r,M);n.save(),n.beginPath(),n.arc(c+g,e,g,0,Math.PI*2),n.fillStyle=u,n.fill(),n.restore(),L(n,c+h,i+l*.1,a-h-4*o,l*.8,4*o,u+"22");const y=I(t[r].text,a-h-20*o,l*.7)*o;n.font=`${y}px sans-serif`,n.fillStyle="#333",n.textAlign="left",n.textBaseline="middle",n.fillText(t[r].text,c+h+8*o,e)}}function C(n,t,c,s,a,p,M,o){if(t.length<2){q(n,t,c,s,a,p,M,o);return}const f=t[Math.floor(t.length/2)],l=t.slice(0,Math.floor(t.length/2)),g=t.slice(Math.floor(t.length/2)+1),h=c+a/2,r=s+p/2,i=Math.min(a*.14,p*.25),e=W(Math.floor(t.length/2),M);n.save(),n.beginPath(),n.arc(h,r,i,0,Math.PI*2),n.fillStyle=e,n.fill(),n.restore();const u=I(f.text,i*1.6,i*1.2)*o;n.font=`bold ${u}px sans-serif`,$(n,f.text,h,r,i*2,i*1.8,u);const y=p/Math.max(l.length,g.length,1),d=a*.3,b=y*.7,P=(m,T)=>{const v=T==="left"?c:c+a-d,k=T==="left"?h-i:h+i;for(let S=0;S<m.length;S++){const R=s+y*S+(y-b)/2,A=W(S+(T==="right"?l.length+1:0),M);L(n,v,R,d,b,5*o,A);const H=I(m[S].text,d-8,b)*o;n.font=`${H}px sans-serif`,$(n,m[S].text,v+d/2,R+b/2,d-8,b,H);const N=T==="left"?v+d:v;X(n,N,R+b/2,k,r,A+"88",1.5*o)}};P(l,"left"),P(g,"right")}function x(n,t,c,s,a,p,M,o){const f=t.length;if(!f)return;const l=Math.ceil(Math.sqrt(f)),g=Math.ceil(f/l),h=a/l,r=p/g,i=Math.min(h,r)*.1;for(let e=0;e<f;e++){const u=e%l,y=Math.floor(e/l),d=c+u*h+i,b=s+y*r+i,P=h-i*2,m=r-i*2,T=W(e,M);L(n,d,b,P,m,8*o,T),j(T),n.save();const v=n.createLinearGradient(d,b,d,b+m*.5);v.addColorStop(0,"rgba(255,255,255,0.18)"),v.addColorStop(1,"rgba(255,255,255,0)"),n.fillStyle=v,n.beginPath(),n.roundRect?.(d,b,P,m,8*o),n.fill(),n.restore();const k=I(t[e].text,P-12*o,m)*o;n.font=`${k}px sans-serif`,$(n,t[e].text,d+P/2,b+m/2,P-12*o,m,k)}}function hn(n,t,c,s,a,p,M,o,f){const l=V(t),g=z(c),h=16*f;n.save(),n.fillStyle="#f7f9fc",n.strokeStyle="#e0e4ec",n.lineWidth=1,n.beginPath(),n.roundRect?.(s,a,p,M,6*f)||n.rect(s,a,p,M),n.fill(),n.stroke();const r=s+h,i=a+h,e=p-h*2,u=M-h*2;if(!l.length){n.fillStyle="#aaa",n.font=`${12*f}px sans-serif`,n.textAlign="center",n.textBaseline="middle",n.fillText("SmartArt Diagram",s+p/2,a+M/2),n.restore();return}switch(g){case"process":J(n,l,r,i,e,u,o,f);break;case"cycle":K(n,l,r,i,e,u,o,f);break;case"hierarchy":O(n,l,r,i,e,u,o,f);break;case"radial":Q(n,l,r,i,e,u,o,f);break;case"pyramid":U(n,l,r,i,e,u,o,f);break;case"funnel":Z(n,l,r,i,e,u,o,f);break;case"venn":_(n,l,r,i,e,u,o,f);break;case"matrix":w(n,l,r,i,e,u,o,f);break;case"list":q(n,l,r,i,e,u,o,f);break;case"relationship":C(n,l,r,i,e,u,o,f);break;default:x(n,l,r,i,e,u,o,f)}n.restore()}export{hn as renderSmartArt};
@@ -1 +0,0 @@
1
- import{s as W,a as P,S as N}from"./chunk-AEK57VVT-BKmfkMGW.js";import{_ as u,c as t,d as z,l as S,e as C,k as T,u as U}from"./mermaid.core-DeacZbEh.js";import{G as F}from"./graph-F4dHmEZ9.js";import{l as O}from"./layout-DArRUuWc.js";import{y as J,z as X}from"./conversation-input-sync-Drf7pG8h.js";import"./chunk-RZ5BOZE2-BVFKaoz8.js";import"./index-DecxvzI1.js";import"./_baseUniq-BmA1_2me.js";import"./_basePickBy-op663AbZ.js";import"./ui-preferences-store-BA52R-Fw.js";import"./error-boundary-Cxrbe_jr.js";var L={},D=u((e,i)=>{L[e]=i},"set"),Y=u(e=>L[e],"get"),G=u(()=>Object.keys(L),"keys"),I=u(()=>G().length,"size"),$={get:Y,set:D,keys:G,size:I},j=u(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),q=u(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Z=u((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),o=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",o.width+2*t().state.padding).attr("height",o.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),K=u((e,i)=>{const d=u(function(l,B,m){const k=l.append("tspan").attr("x",2*t().state.padding).text(B);m||k.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),g=n.height,x=e.append("text").attr("x",t().state.padding).attr("y",g+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(l){a||(d(x,l,s),s=!1),a=!1});const y=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+g+t().state.dividerMargin/2).attr("y2",t().state.padding+g+t().state.dividerMargin/2).attr("class","descr-divider"),p=x.node().getBBox(),c=Math.max(p.width,n.width);return y.attr("x2",c+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c+2*t().state.padding).attr("height",p.height+g+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),Q=u((e,i,d)=>{const o=t().state.padding,n=2*t().state.padding,g=e.node().getBBox(),x=g.width,a=g.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),p=s.node().getBBox().width+n;let c=Math.max(p,x);c===x&&(c=c+n);let l;const B=e.node().getBBox();i.doc,l=a-o,p>x&&(l=(x-c)/2+o),Math.abs(a-B.x)<o&&p>x&&(l=a-(p-x)/2);const m=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",l).attr("y",m).attr("class",d?"alt-composit":"composit").attr("width",c).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",l+o),p<=x&&s.attr("x",a+(c-n)/2-p/2+o),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",l).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",c).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),V=u(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),tt=u((e,i)=>{let d=t().state.forkWidth,o=t().state.forkHeight;if(i.parentId){let n=d;d=o,o=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",o).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),et=u((e,i,d,o)=>{let n=0;const g=o.append("text");g.style("text-anchor","start"),g.attr("class","noteText");let x=e.replace(/\r\n/g,"<br/>");x=x.replace(/\n/g,"<br/>");const a=x.split(T.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const y of a){const p=y.trim();if(p.length>0){const c=g.append("tspan");if(c.text(p),s===0){const l=c.node().getBBox();s+=l.height}n+=s,c.attr("x",i+t().state.noteMargin),c.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:g.node().getBBox().width,textHeight:n}},"_drawLongText"),at=u((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),o=i.append("g"),{textWidth:n,textHeight:g}=et(e,0,0,o);return d.attr("height",g+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),_=u(function(e,i){const d=i.id,o={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&j(n),i.type==="end"&&V(n),(i.type==="fork"||i.type==="join")&&tt(n,i),i.type==="note"&&at(i.note.text,n),i.type==="divider"&&q(n),i.type==="default"&&i.descriptions.length===0&&Z(n,i),i.type==="default"&&i.descriptions.length>0&&K(n,i);const g=n.node().getBBox();return o.width=g.width+2*t().state.padding,o.height=g.height+2*t().state.padding,$.set(d,o),o},"drawState"),A=0,it=u(function(e,i,d){const o=u(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,g=J().x(function(s){return s.x}).y(function(s){return s.y}).curve(X),x=e.append("path").attr("d",g(n)).attr("id","edge"+A).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,a=a.replace(/\(/g,"\\("),a=a.replace(/\)/g,"\\)")),x.attr("marker-end","url("+a+"#"+o(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:y,y:p}=U.calcLabelPosition(i.points),c=T.getRows(d.title);let l=0;const B=[];let m=0,k=0;for(let f=0;f<=c.length;f++){const h=s.append("text").attr("text-anchor","middle").text(c[f]).attr("x",y).attr("y",p+l),w=h.node().getBBox();m=Math.max(m,w.width),k=Math.min(k,w.x),S.info(w.x,y,p+l),l===0&&(l=h.node().getBBox().height,S.info("Title height",l,p)),B.push(h)}let E=l*c.length;if(c.length>1){const f=(c.length-1)*l*.5;B.forEach((h,w)=>h.attr("y",p+w*l-f)),E=l*c.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",y-m/2-t().state.padding/2).attr("y",p-E/2-t().state.padding/2-3.5).attr("width",m+t().state.padding).attr("height",E+t().state.padding),S.info(r)}A++},"drawEdge"),b,H={},rt=u(function(){},"setConf"),nt=u(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),st=u(function(e,i,d,o){b=t().state;const n=t().securityLevel;let g;n==="sandbox"&&(g=z("#i"+i));const x=n==="sandbox"?z(g.nodes()[0].contentDocument.body):z("body"),a=n==="sandbox"?g.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=x.select(`[id='${i}']`);nt(s);const y=o.db.getRootDoc();R(y,s,void 0,!1,x,a,o);const p=b.padding,c=s.node().getBBox(),l=c.width+p*2,B=c.height+p*2,m=l*1.75;C(s,B,m,b.useMaxWidth),s.attr("viewBox",`${c.x-b.padding} ${c.y-b.padding} `+l+" "+B)},"draw"),dt=u(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),R=u((e,i,d,o,n,g,x)=>{const a=new F({compound:!0,multigraph:!0});let s,y=!0;for(s=0;s<e.length;s++)if(e[s].stmt==="relation"){y=!1;break}d?a.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,isMultiGraph:!0}):a.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:y?1:b.edgeLengthFactor,nodeSep:y?1:50,ranker:"tight-tree",isMultiGraph:!0}),a.setDefaultEdgeLabel(function(){return{}});const p=x.db.getStates(),c=x.db.getRelations(),l=Object.keys(p);for(const r of l){const f=p[r];d&&(f.parentId=d);let h;if(f.doc){let w=i.append("g").attr("id",f.id).attr("class","stateGroup");h=R(f.doc,w,f.id,!o,n,g,x);{w=Q(w,f,o);let v=w.node().getBBox();h.width=v.width,h.height=v.height+b.padding/2,H[f.id]={y:b.compositTitleSize}}}else h=_(i,f,a);if(f.note){const w={descriptions:[],id:f.id+"-note",note:f.note,type:"note"},v=_(i,w,a);f.note.position==="left of"?(a.setNode(h.id+"-note",v),a.setNode(h.id,h)):(a.setNode(h.id,h),a.setNode(h.id+"-note",v)),a.setParent(h.id,h.id+"-group"),a.setParent(h.id+"-note",h.id+"-group")}else a.setNode(h.id,h)}S.debug("Count=",a.nodeCount(),a);let B=0;c.forEach(function(r){B++,S.debug("Setting edge",r),a.setEdge(r.id1,r.id2,{relation:r,width:dt(r.title),height:b.labelHeight*T.getRows(r.title).length,labelpos:"c"},"id"+B)}),O(a),S.debug("Graph after layout",a.nodes());const m=i.node();a.nodes().forEach(function(r){r!==void 0&&a.node(r)!==void 0?(S.warn("Node "+r+": "+JSON.stringify(a.node(r))),n.select("#"+m.id+" #"+r).attr("transform","translate("+(a.node(r).x-a.node(r).width/2)+","+(a.node(r).y+(H[r]?H[r].y:0)-a.node(r).height/2)+" )"),n.select("#"+m.id+" #"+r).attr("data-x-shift",a.node(r).x-a.node(r).width/2),g.querySelectorAll("#"+m.id+" #"+r+" .divider").forEach(h=>{const w=h.parentElement;let v=0,M=0;w&&(w.parentElement&&(v=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",v-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let k=m.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),it(i,a.edge(r),a.edge(r).relation))}),k=m.getBBox();const E={id:d||"root",label:d||"root",width:0,height:0};return E.width=k.width+2*b.padding,E.height=k.height+2*b.padding,S.debug("Doc rendered",E,a),E},"renderDoc"),ot={setConf:rt,draw:st},Bt={parser:P,get db(){return new N(1)},renderer:ot,styles:W,init:u(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{Bt as diagram};
@@ -1 +0,0 @@
1
- import{s as r,b as e,a,S as s}from"./chunk-AEK57VVT-BKmfkMGW.js";import{_ as i}from"./mermaid.core-DeacZbEh.js";import"./chunk-RZ5BOZE2-BVFKaoz8.js";import"./conversation-input-sync-Drf7pG8h.js";import"./index-DecxvzI1.js";import"./ui-preferences-store-BA52R-Fw.js";import"./error-boundary-Cxrbe_jr.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram};
@@ -1,16 +0,0 @@
1
- import{r as u,j as e,t,c as w}from"./index-DecxvzI1.js";import{ax as J,y as oe,ay as pt,az as ht,aA as gt,aB as ft,aC as bt,aD as jt,aE as vt,aF as X,aG as yt,aH as Ye,aI as re,aJ as kt,aK as Bt,aL as Re,aM as Nt,aN as Ze,aO as Ee,aP as wt,aQ as et,aR as _t,aS as tt,aT as Ct,aU as at,aV as Ve,aW as Mt,aX as st,aY as St,aZ as Dt,a_ as Tt,a$ as It,b0 as Qe,b1 as zt,b2 as Rt,x as Et,b3 as Ft,b4 as Pt,b5 as Lt,b6 as qt,b7 as At,b8 as Gt,b9 as Ot,ba as $t,bb as Ut,bc as Ht,bd as Kt,be as Vt,bf as Qt,bg as Wt,bh as Jt,bi as Xt,bj as Yt,bk as Zt,bl as ea}from"./index-D2xD4O43.js";import{c as Fe,u as D,X as ta,q as Pe,r as Le,B as H,s as qe,w as Ae,v as it,t as fe,x as nt,y as Ie,D as aa,a as sa,d as ia,e as na,I as We,z as ra,F as Ne,G as ze,S as be,H as Je}from"./error-boundary-Cxrbe_jr.js";import{b1 as rt,b5 as la,b6 as oa,b7 as da,b8 as lt,b9 as ca,ba as we,bb as le,bc as ua,aI as ma}from"./conversation-input-sync-Drf7pG8h.js";import"./ui-preferences-store-BA52R-Fw.js";import{B as xa}from"./building-2-BinkVpHL.js";import{H as ot}from"./hash-DY3q9E3o.js";import"./console-mirror-CPwb8uF3.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 pa=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],dt=Fe("bell-off",pa);/**
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 ha=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],ga=Fe("bell",ha);/**
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 fa=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],ba=Fe("user-round",fa),ct=({recipients:a,candidates:i,onChange:r,autoFocus:s=!0})=>{D();const n=u.useId(),m=u.useRef(null),[x,h]=u.useState(""),[k,p]=u.useState(!1),[o,g]=u.useState(0);u.useEffect(()=>{document.getElementById(`${n}-${o}`)?.scrollIntoView({block:"nearest"})},[o,n]);const T=u.useMemo(()=>new Set(a.map(J)),[a]),v=u.useMemo(()=>{const d=x.trim().toLocaleLowerCase();return i.filter(j=>!T.has(J(j))&&(d===""||j.label.toLocaleLowerCase().includes(d)))},[i,T,x]),I=d=>{r([...a,d]),h(""),g(0),m.current?.focus()},z=k&&v.length>0;return e.jsxs("div",{className:"relative shrink-0 px-5 pt-3 pb-2",children:[e.jsxs("div",{className:"flex min-h-9 flex-wrap items-center gap-1.5 rounded-lg bg-elevated px-2 py-1",children:[e.jsx("span",{className:"pr-1 text-[13px] text-ink-dim",children:t("ui.teamBridge.compose.to")}),a.map(d=>e.jsxs("span",{className:"flex h-6 items-center gap-1 rounded-md bg-accent-wash pr-0.5 pl-1.5 text-[13px] text-ink",children:[d.kind==="agent"&&e.jsx(oe,{size:12,"aria-hidden":"true",className:"text-accent"}),d.label,e.jsx("button",{type:"button","aria-label":t("ui.teamBridge.compose.remove",{name:d.label}),onClick:()=>r(a.filter(j=>J(j)!==J(d))),className:"flex size-5 items-center justify-center rounded-sm text-ink-dim hover:bg-row-hover hover:text-ink",children:e.jsx(ta,{size:12})})]},J(d))),e.jsx("input",{ref:m,autoFocus:s,role:"combobox","aria-expanded":z,"aria-controls":n,"aria-autocomplete":"list","aria-activedescendant":z?`${n}-${Math.min(o,v.length-1)}`:void 0,"aria-label":t("ui.teamBridge.compose.label"),placeholder:a.length===0?t("ui.teamBridge.compose.placeholder"):void 0,value:x,onFocus:()=>p(!0),onBlur:()=>p(!1),onChange:d=>{h(d.target.value),g(0),p(!0)},onKeyDown:d=>{if(d.key==="ArrowDown")d.preventDefault(),p(!0),g(j=>Math.max(0,Math.min(j+1,v.length-1)));else if(d.key==="ArrowUp")d.preventDefault(),g(j=>Math.max(j-1,0));else if(d.key==="Enter"&&z){d.preventDefault();const j=v[Math.min(o,v.length-1)];j&&I(j)}else d.key==="Escape"?p(!1):d.key==="Backspace"&&x===""&&a.length>0&&r(a.slice(0,-1))},className:"h-7 min-w-32 flex-1 bg-transparent text-[13px] text-ink outline-none placeholder:text-ink-dim"})]}),z&&e.jsx("div",{id:n,tabIndex:-1,role:"listbox","aria-label":t("ui.teamBridge.compose.label"),className:"absolute top-full right-5 left-5 z-20 mt-1 max-h-64 overflow-y-auto rounded-lg bg-elevated p-1 shadow-lg",children:v.map((d,j)=>e.jsxs("button",{id:`${n}-${j}`,type:"button",tabIndex:-1,role:"option","aria-selected":j===o,onMouseDown:Y=>Y.preventDefault(),onClick:()=>I(d),onMouseEnter:()=>g(j),className:w("flex h-[30px] w-full cursor-default items-center gap-2 rounded-md px-2 text-left text-[13px]",j===o?"bg-row-hover text-ink":"text-ink-muted"),children:[e.jsx("span",{"aria-hidden":"true",className:w("flex size-5 shrink-0 items-center justify-center rounded-[5px] text-[10px] font-medium",d.kind==="agent"?"bg-accent-wash text-accent":"border border-control bg-sunken text-ink-muted"),children:d.kind==="agent"?e.jsx(oe,{size:12}):d.label.trim().charAt(0).toUpperCase()||"?"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:d.label})]},J(d)))})]})},ja=({conversation:a,onNotifyChange:i,defaultOpen:r=!1})=>{D();const s=pt(a),n=s==="mute";return e.jsxs(Pe,{defaultOpen:r,children:[e.jsx(Le,{asChild:!0,children:e.jsx(H,{type:"button",size:"icon-sm",variant:"ghost","aria-label":t("ui.teamBridge.menu.label"),title:t("ui.teamBridge.menu.label"),children:e.jsx(rt,{size:16,"aria-hidden":"true"})})}),e.jsxs(qe,{align:"end",className:"w-60",children:[e.jsxs(Ae,{onSelect:()=>i(ht(s)),children:[n?e.jsx(ga,{size:16,"aria-hidden":"true"}):e.jsx(dt,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:n?t("ui.teamBridge.menu.unmute"):t("ui.teamBridge.menu.mute")})]}),e.jsx(it,{}),e.jsx(fe,{children:t("ui.teamBridge.notify.label")}),e.jsx(nt,{value:s,"aria-label":t("ui.teamBridge.notify.label"),onValueChange:m=>i(ft(m)),children:gt.map(m=>e.jsx(Ie,{value:m.value,children:e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t(m.labelKey)})},m.value))})]})]})},va=/\s+/g,ya=/^#+/;function ka(a){return a.trim().toLowerCase().replace(va,"-").replace(ya,"")}const Ba=({open:a,onClose:i,candidates:r,onCreate:s,pending:n=!1,error:m})=>{D();const x=u.useId(),h=u.useId(),[k,p]=u.useState(""),[o,g]=u.useState(""),[T,v]=u.useState([]);u.useEffect(()=>{a&&(p(""),g(""),v([]))},[a]);const I=ka(k),z=I.length>0;return e.jsx(aa,{open:a,onOpenChange:d=>{d||i()},children:e.jsxs(sa,{className:"gap-4",children:[e.jsx(ia,{children:t("ui.teamBridge.create.title")}),e.jsx(na,{className:"text-[13px] text-ink-muted",children:t("ui.teamBridge.create.channel_description")}),e.jsxs("label",{htmlFor:x,className:"flex flex-col gap-1 text-[13px] text-ink-muted",children:[t("ui.teamBridge.create.name"),e.jsx(We,{id:x,value:k,onChange:d=>p(d.target.value),placeholder:t("ui.teamBridge.create.name_placeholder"),maxLength:80,autoFocus:!0})]}),e.jsxs("label",{htmlFor:h,className:"flex flex-col gap-1 text-[13px] text-ink-muted",children:[t("ui.teamBridge.create.topic"),e.jsx(We,{id:h,value:o,onChange:d=>g(d.target.value),maxLength:512})]}),e.jsxs("div",{className:"flex flex-col gap-1 text-[13px] text-ink-muted",children:[e.jsx("span",{children:t("ui.teamBridge.create.members")}),e.jsx("div",{className:"relative -mx-5",children:e.jsx(ct,{recipients:T,candidates:r,onChange:v,autoFocus:!1})})]}),m&&e.jsx("p",{role:"alert",className:"text-[13px] text-danger",children:m}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(H,{type:"button",variant:"ghost",onClick:i,children:t("ui.teamBridge.create.cancel")}),e.jsx(H,{type:"button",variant:"primary",disabled:!z||n,onClick:()=>s({kind:"channel",name:I,...o.trim()?{topic:o.trim()}:{},visibility:"tenant",agentCapable:!0,members:T.map(bt)}),children:t("ui.teamBridge.create.confirm")})]})]})})},Na=/^(https?:|mailto:)/i,wa={a:({href:a,children:i})=>typeof a=="string"&&Na.test(a)?e.jsx("a",{href:a,target:"_blank",rel:"noreferrer",children:i}):e.jsx("span",{className:"font-mono text-mono-sm",children:i}),img:({alt:a,src:i})=>e.jsx("span",{className:"text-ink-muted",children:a||(typeof i=="string"?i:"")}),table:oa},ut=u.memo(({children:a,className:i})=>e.jsx("div",{className:w("lo-markdown",i),children:e.jsx(la,{remarkPlugins:[da],components:wa,children:a})}));ut.displayName="TeamBridgeMarkdown";const _a=({messages:a,labelFor:i})=>{const r=D(),s=jt(a,new Date);return e.jsx("ol",{className:"mt-auto flex flex-col pt-4 pb-2",children:s.map(n=>n.type==="day"?e.jsx(Ca,{item:n,locale:r},`day:${n.key}`):e.jsx(Ma,{message:n.message,continuation:n.continuation,label:i(n.message.sender),locale:r},n.message.id))})},Ca=({item:a,locale:i})=>{const r=a.relative==="today"?t("ui.teamBridge.thread.today"):a.relative==="yesterday"?t("ui.teamBridge.thread.yesterday"):lt(a.date,{weekday:"long",month:"long",day:"numeric"},i);return e.jsxs("li",{className:"flex items-center gap-3 px-5 py-2","aria-label":r,children:[e.jsx("span",{"aria-hidden":"true",className:"h-px flex-1 bg-hairline"}),e.jsx("span",{className:"shrink-0 rounded-full bg-elevated px-2.5 py-0.5 font-medium text-[12px] text-ink-muted",children:r}),e.jsx("span",{"aria-hidden":"true",className:"h-px flex-1 bg-hairline"})]})},Ma=({message:a,continuation:i,label:r,locale:s})=>{const n=a.sender.kind==="agent",m=r??(n?t("ui.teamBridge.sender.unknown_agent"):t("ui.teamBridge.sender.unknown_person")),x=new Date(a.created_at),h=!Number.isNaN(x.getTime()),k=h?ca(x,{hour:"numeric",minute:"2-digit"},s):"",p=h?lt(x,{dateStyle:"full",timeStyle:"short"},s):"";return e.jsxs("li",{className:w("group/message flex gap-3 px-5 transition-colors duration-fast ease-out-quart hover:bg-row-hover",i?"py-0.5":"mt-2 pt-1.5 pb-0.5"),children:[e.jsx("div",{className:"w-9 shrink-0",children:i?h&&e.jsx("time",{dateTime:a.created_at,title:p,className:"block pt-0.5 text-right text-[11px] text-ink-dim opacity-0 group-hover/message:opacity-100",children:k}):e.jsx("span",{"aria-hidden":"true","data-sender-avatar":n?"agent":r===null?"unknown":"initial",className:w("mt-0.5 flex size-9 items-center justify-center rounded-md font-medium text-[14px]",n?"border border-control bg-accent-wash text-accent":"border border-control bg-sunken text-ink-muted"),children:n?e.jsx(oe,{size:18}):r===null?e.jsx(ba,{size:18}):r.trim().charAt(0).toUpperCase()||"?"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[!i&&e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{"data-sender":r===null?"unknown":"known",className:w("truncate text-[14px]",r===null?"text-ink-muted italic":"font-semibold text-ink"),children:m}),h&&e.jsx("time",{dateTime:a.created_at,title:p,className:"shrink-0 text-[12px] text-ink-dim",children:k})]}),a.body===null?e.jsx("p",{className:"text-[14px] text-ink-dim italic",children:t("ui.teamBridge.thread.withheld")}):e.jsx(ut,{className:"team-bridge-message-body text-[14px] text-ink",children:a.body})]})]})},Sa=({organizations:a,scope:i,onScopeChange:r,totalUnread:s,membershipsLoading:n=!1,organizationsFailed:m=!1,defaultOpen:x=!1,onRetry:h})=>{D();const k=vt(a,i),p=i===X?t("ui.teamBridge.scope.all"):k?.name??t("ui.teamBridge.scope.unknown");return e.jsxs(Pe,{defaultOpen:x,children:[e.jsx(Le,{asChild:!0,children:e.jsxs("button",{type:"button","aria-label":t("ui.teamBridge.scope.trigger",{name:p}),title:p,className:w("group flex h-[30px] min-w-0 flex-1 items-center gap-2 rounded-md px-2","text-left text-[13px] text-ink transition-colors duration-fast","hover:bg-row-hover data-[state=open]:bg-row-hover"),children:[e.jsx(xa,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:p}),e.jsx(ra,{size:14,"aria-hidden":"true",className:"shrink-0 text-ink-dim"})]})}),e.jsxs(qe,{align:"start",className:"w-64",children:[e.jsx(fe,{children:t("ui.teamBridge.scope.label")}),e.jsxs(nt,{value:i,onValueChange:o=>r(yt(o)),children:[e.jsxs(Ie,{value:X,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t("ui.teamBridge.scope.all")}),s>0&&e.jsx(Ne,{variant:"attentionQuiet",size:"count","aria-label":t("ui.teamBridge.unread.count",{count:s}),title:t("ui.teamBridge.unread.count",{count:s}),children:ze(s,99)})]}),a.length>0&&e.jsx(it,{}),a.map(o=>e.jsxs(Ie,{value:o.tenantId,children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:o.name}),o.role&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim capitalize",children:o.role}),o.unread>0&&e.jsx(Ne,{variant:"attentionQuiet",size:"count","aria-label":t("ui.teamBridge.unread.count",{count:o.unread}),title:t("ui.teamBridge.unread.count",{count:o.unread}),children:ze(o.unread,99)})]},o.tenantId))]}),n&&e.jsx(fe,{children:t("ui.teamBridge.scope.loading")}),!n&&m&&e.jsxs(e.Fragment,{children:[e.jsx(fe,{children:t("ui.teamBridge.scope.error")}),h&&e.jsx(Ae,{onSelect:()=>h(),children:t("ui.teamBridge.list.retry")})]}),!n&&!m&&a.length===0&&e.jsx(fe,{children:t("ui.teamBridge.scope.empty")})]})]})},je="group/row relative flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-left text-[13px] transition-colors duration-fast ease-out-quart",Ge=({count:a,yieldsToMenu:i=!1})=>a>0?e.jsx(Ne,{variant:"attentionQuiet",shape:"pill",size:"count",className:w("shrink-0",i&&"group-focus-within/row:invisible group-hover/row:invisible"),"aria-label":t("ui.teamBridge.unread.count",{count:a}),children:ze(a,99)}):null,ne=({id:a,title:i,children:r,empty:s,add:n})=>(D(),e.jsxs("section",{"aria-labelledby":a,className:"px-1 pb-1",children:[e.jsxs("div",{className:"group/section flex items-center pt-3 pr-1 pb-1 pl-2",children:[e.jsx("h2",{id:a,className:"min-w-0 flex-1 truncate font-medium text-meta text-ink-dim tracking-wide",children:i}),n&&e.jsx("button",{type:"button",onClick:n.onAdd,"aria-label":n.label,title:n.label,className:"flex size-5 items-center justify-center rounded-sm text-ink-dim opacity-0 transition-opacity duration-fast hover:bg-row-hover hover:text-ink focus-visible:opacity-100 group-hover/section:opacity-100",children:e.jsx(Ye,{size:13,"aria-hidden":"true"})})]}),s?s.onCreate?e.jsx("button",{type:"button",onClick:s.onCreate,className:"w-full rounded-md px-2 py-1 text-left text-[12px] text-ink-dim leading-snug transition-colors duration-fast ease-out-quart hover:bg-row-hover hover:text-ink-muted",children:s.text}):e.jsx("p",{className:"px-2 py-1 text-[12px] text-ink-dim leading-snug",children:s.text}):r]})),Da=({conversation:a,selected:i,selfAccountId:r,title:s,organizationName:n,onSelect:m})=>{const x=D(),h=a.kind==="group"?we:a.kind==="dm"?Nt:ot,k=s??Ze(a,r)??t("ui.teamBridge.list.untitled"),p=Ee(a),o=a.unread_count,g=za(a.last_message_at,x);return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:m,title:g||void 0,"aria-current":i?"page":void 0,"data-conversation-id":a.id,"data-conversation-builtin":a.builtin,className:w(je,n&&"h-auto min-h-[38px] py-1",i?Re:o>0?"font-medium text-ink hover:bg-row-hover":"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[e.jsx(h,{size:15,"aria-hidden":"true",className:"shrink-0"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:"truncate",children:k}),n&&e.jsx("span",{className:"truncate font-normal text-meta-sm text-ink-dim",children:n})]}),p&&e.jsx(Ne,{variant:"attentionQuiet",className:"shrink-0",children:t("ui.teamBridge.preview.chip")}),wt(a)&&e.jsxs("span",{className:"shrink-0 text-ink-dim",title:t("ui.teamBridge.notify.muted"),children:[e.jsx(dt,{size:12,"aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:t("ui.teamBridge.notify.muted")})]}),e.jsx(Ge,{count:o})]})})},mt=({label:a,onStartGroup:i})=>e.jsxs(Pe,{children:[e.jsx(Le,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":t("ui.teamBridge.row.menu",{name:a}),className:"absolute right-1.5 flex size-6 items-center justify-center rounded-sm text-ink-dim opacity-0 transition-opacity duration-fast hover:bg-row-hover hover:text-ink focus-visible:opacity-100 group-hover/row:opacity-100 group-focus-within/row:opacity-100 data-[state=open]:opacity-100",children:e.jsx(rt,{size:14,"aria-hidden":"true"})})}),e.jsx(qe,{align:"start",side:"right",className:"border-transparent shadow-lg",children:e.jsxs(Ae,{onSelect:i,children:[e.jsx(we,{size:14,"aria-hidden":"true"}),t("ui.teamBridge.row.start_group")]})})]}),Ta=({member:a,selfAccountId:i,identityKnown:r,selected:s,dm:n,readOnly:m,onSelect:x,onStartGroup:h})=>{D();const k=u.useId(),p=re(a),o=r?kt(a,i):"unknown",g=e.jsx("span",{"aria-hidden":"true",className:w("flex size-5 shrink-0 items-center justify-center rounded-[5px] bg-sunken font-medium text-[10px]",o==="unavailable"?"text-ink-disabled":"text-ink-muted"),children:Bt(p)});if(o==="self")return e.jsx("li",{children:e.jsxs("div",{className:w(je,"cursor-default text-ink-muted"),children:[g,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t("ui.teamBridge.people.self_named",{name:p})})]})});const T=o==="unknown"?t("ui.teamBridge.people.identity_loading"):o==="unavailable"&&!n?t("ui.teamBridge.people.bridge_off"):null;if(T)return e.jsx("li",{children:e.jsxs("button",{type:"button","aria-disabled":"true","aria-describedby":k,className:w(je,"h-auto min-h-[30px] cursor-default py-1 text-ink-muted"),children:[e.jsx("span",{className:"opacity-60",children:g}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col text-start",children:[e.jsx("span",{className:"truncate",children:p}),e.jsx("span",{id:k,className:"truncate text-meta-sm text-ink-dim",children:T})]})]})});const v=n?.unread_count??0,I=!m&&o!=="unavailable";return e.jsxs("li",{className:"group/row relative flex items-center",children:[e.jsxs("button",{type:"button",onClick:x,"aria-current":s?"page":void 0,"data-team-bridge-person":a.account_id,"aria-label":t("ui.teamBridge.people.message",{name:p}),className:w(je,s?Re:v>0?"font-medium text-ink hover:bg-row-hover":"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[g,e.jsx("span",{className:"min-w-0 flex-1 truncate",children:p}),o==="paused"&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:t("ui.teamBridge.people.paused")}),e.jsx(Ge,{count:v,yieldsToMenu:!0})]}),I&&e.jsx(mt,{label:p,onStartGroup:()=>h({kind:"human",accountId:a.account_id,label:p})})]})},Ia=({chief:a,label:i,selected:r,dm:s,readOnly:n,onSelect:m,onStartGroup:x})=>{D();const h=s?.unread_count??0;return e.jsxs("li",{className:"group/row relative flex items-center",children:[e.jsxs("button",{type:"button",onClick:m,"aria-current":r?"page":void 0,"data-team-bridge-chief":a.person.account_id,"aria-label":t("ui.teamBridge.people.message",{name:i}),className:w(je,r?Re:h>0?"font-medium text-ink hover:bg-row-hover":"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[e.jsx("span",{"aria-hidden":"true",className:"flex size-5 shrink-0 items-center justify-center rounded-[5px] bg-accent-wash text-accent",children:e.jsx(oe,{size:12})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:i}),a.paused&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:t("ui.teamBridge.people.paused")}),e.jsx(Ge,{count:h,yieldsToMenu:!0})]}),!n&&e.jsx(mt,{label:i,onStartGroup:()=>x({kind:"agent",accountId:a.person.account_id,endpointId:a.endpointId,label:i})})]})},Be=({label:a})=>e.jsx("div",{className:"flex h-[30px] items-center px-2",children:e.jsx(be,{size:"sm",label:a})});function Xe(a,i,r){return a?.type===i&&a.accountId===r}function za(a,i){if(!a)return"";const r=Date.parse(a);if(Number.isNaN(r))return"";const s=Math.round((r-Date.now())/6e4),n=Math.round(s/60),m=Math.abs(s)<60?le(s,"minute",{numeric:"auto"},i):Math.abs(n)<24?le(n,"hour",{numeric:"auto"},i):le(Math.round(n/24),"day",{numeric:"auto"},i),x=new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}).format(new Date(r));return`${m} · ${x}`}const Ra=({error:a,onRetry:i})=>{D();const r=Xt(a),s=a?.message,n=typeof s=="string"?s.trim():"",m=r==="sign_in"?t("ui.teamBridge.plan.sign_in_reason"):r==="plan"?t("ui.teamBridge.plan.reason"):r==="invalid"?n||t("ui.teamBridge.scope.error"):r==="outdated"?t("ui.teamBridge.plan.update_reason"):t("ui.teamBridge.plan.unavailable_reason"),x=r==="unreachable"||r==="server";return e.jsxs("div",{className:"flex flex-col items-start gap-2 px-2 py-1",children:[e.jsx("p",{className:"text-[12px] leading-snug text-ink-muted",children:t("ui.teamBridge.people.error")}),e.jsx("p",{className:"text-[12px] leading-snug text-ink-dim",children:m}),x&&i&&e.jsx(H,{type:"button",size:"sm",variant:"outline",onClick:i,children:t("ui.teamBridge.list.retry")})]})},Ea=()=>(D(),e.jsx("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-canvas px-6",children:e.jsx(be,{size:"sm",label:t("ui.teamBridge.plan.checking")})})),Fa=({reason:a})=>{D();const i={plan_required:{title:"ui.teamBridge.plan.title",reason:"ui.teamBridge.plan.reason"},signed_out:{title:"ui.teamBridge.plan.sign_in_title",reason:"ui.teamBridge.plan.sign_in_reason"},update_required:{title:"ui.teamBridge.plan.update_title",reason:"ui.teamBridge.plan.update_reason"},unavailable:{title:"ui.teamBridge.plan.unavailable_title",reason:"ui.teamBridge.plan.unavailable_reason"}};return e.jsx("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full items-center justify-center overflow-hidden bg-canvas px-6",children:e.jsxs("div",{className:"max-w-lg text-center",children:[e.jsx(we,{size:20,"aria-hidden":"true",className:"mx-auto mb-3 text-ink-dim"}),e.jsx("h1",{className:"text-balance text-[16px] font-medium text-ink",children:t(i[a].title)}),e.jsxs("div",{className:"mt-2",children:[e.jsx("p",{className:"text-pretty text-[13px] leading-relaxed text-ink-muted",children:t("ui.teamBridge.plan.body")}),e.jsx("p",{className:"mt-4 text-[12px] leading-snug text-ink-dim",children:t(i[a].reason)})]})]})})};function Pa(a,i){if(!a)return"";const r=Date.parse(a);return Number.isNaN(r)?"":new Intl.DateTimeFormat(i,{dateStyle:"medium",timeStyle:"short"}).format(new Date(r))}function La(a,i){const r=Date.parse(a);if(Number.isNaN(r))return"";const s=Math.round((r-Date.now())/6e4);if(Math.abs(s)<60)return le(s,"minute",{numeric:"auto"},i);const n=Math.round(s/60);return Math.abs(n)<24?le(n,"hour",{numeric:"auto"},i):le(Math.round(n/24),"day",{numeric:"auto"},i)}const qa=({listState:a,messageState:i,conversations:r,target:s,messages:n,organizations:m,scope:x,totalUnread:h,membershipsLoading:k=!1,organizationsFailed:p=!1,selfAccountId:o,sending:g=!1,sendFailed:T=!1,joining:v=!1,joinFailed:I=!1,notifyFailed:z=!1,onJoin:d,onNotifyChange:j,defaultMenuOpen:Y=!1,initialDraft:K="",people:_=[],directories:q,selfName:de,peopleState:A="ready",peopleError:ce,peopleIncomplete:Z=!1,onRetryPeople:_e,eligibility:B=null,gatePending:G=!1,readOnly:E=!1,onTarget:M,onSend:Ce,onNewChannel:O,onRetry:f,onScopeChange:Me,onRetryMemberships:ee})=>{const V=D(),[F,ve]=u.useState(K),S=x===X,ue=o!==void 0,Q=u.useMemo(()=>et(r,x,m),[r,x,m]),$=u.useMemo(()=>_t(Q),[Q]),te=u.useMemo(()=>S?[]:tt(_,o),[S,_,o]),ae=(l,b)=>t("ui.teamBridge.chief.label",{agent:l,person:b}),Se=u.useMemo(()=>o&&de?.trim()?{accountId:o,name:de}:null,[o,de]),me=l=>S?q?.[l]??[]:_,ye=(l,b)=>Mt(l,me(b),ae,Se),xe=(l,b)=>ye(l,b)??(l.kind==="agent"?t("ui.teamBridge.sender.unknown_agent"):t("ui.teamBridge.sender.unknown_person")),ke=S?$.directs:Ct($.directs,_,te,o),C=at(s,Q,o),c=C!==null&&Ee(C),y=C?Ve(C,m):null,U=S&&C!==null&&y===null,W=s?.type==="person"||s?.type==="chief"?_.find(l=>l.account_id===s.accountId)??null:null,pe=s?.type==="chief"?te.find(l=>l.person.account_id===s.accountId)??null:null,P=C?C.kind==="dm"?(()=>{const l=C.members.find(b=>b.state!=="removed"&&!(b.kind==="human"&&b.account_id===o));return l?xe(l,C.tenant_id):t("ui.teamBridge.list.untitled")})():Ze(C,o)??t("ui.teamBridge.list.untitled"):pe?ae(pe.agentName,re(pe.person)):W?re(W):null,se=u.useMemo(()=>st(_,o,(l,b)=>t("ui.teamBridge.chief.label",{agent:l,person:b})),[_,o]),L=s?.type==="compose"?s.recipients:[],N=C,De=!E&&!c&&!U&&(N!==null||s?.type==="compose"&&L.length>0||(s?.type==="person"||s?.type==="chief")&&W!==null),he=u.useRef(null),Oe=()=>{const l=F.trim();if(!l||g||!De)return;const b=he.current?.body===l?he.current.clientRef:crypto.randomUUID(),ge={body:l,clientRef:b};he.current=ge;const ie=Ce(l,b),He=()=>{he.current===ge&&(he.current=null),ve(Ke=>Ke.trim()===l?"":Ke)};ie instanceof Promise?ie.then(He).catch(()=>{}):He()};if(G)return e.jsx(Ea,{});if(B)return e.jsx(Fa,{reason:B});const xt=l=>s?.type==="conversation"&&s.id===l.id,$e=l=>M({type:"compose",recipients:[l]}),R=S||E,Ue=E?t("ui.teamBridge.read_only.note"):t("ui.teamBridge.scope.create_needs_org"),Te=l=>e.jsx("ul",{className:"flex flex-col",children:l.map(b=>e.jsx(Da,{conversation:b,selected:xt(b),selfAccountId:o,title:b.kind==="dm"?(()=>{const ge=b.members.find(ie=>ie.state!=="removed"&&!(ie.kind==="human"&&ie.account_id===o));return ge?xe(ge,b.tenant_id):void 0})():void 0,organizationName:S?Ve(b,m)??t("ui.teamBridge.scope.unknown"):void 0,onSelect:()=>M({type:"conversation",id:b.id})},b.id))});return e.jsxs("div",{"data-glass-region":"canvas",className:"flex h-full min-h-0 w-full overflow-hidden bg-canvas",children:[e.jsxs("aside",{"data-glass-region":"page-sidebar",className:"flex w-72 shrink-0 flex-col bg-surface pt-[var(--panel-top-pad,0px)]",children:[e.jsx("h1",{className:"sr-only",children:t("ui.teamBridge.page.title")}),e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-3",children:[e.jsx(Sa,{organizations:m,scope:x,onScopeChange:Me,totalUnread:h,membershipsLoading:k,organizationsFailed:p,onRetry:ee}),e.jsx(H,{size:"icon-sm",variant:"ghost","aria-label":t("ui.teamBridge.compose.new"),"aria-disabled":R||void 0,title:R?Ue:void 0,className:R?"text-ink-disabled hover:bg-transparent":void 0,onClick:()=>{R||M({type:"compose",recipients:[]})},children:e.jsx(Ye,{size:16})})]}),e.jsxs(Je,{className:"min-h-0 flex-1 [&_[data-radix-scroll-area-viewport]>div]:block!",children:[a==="error"&&e.jsxs("div",{className:"flex flex-col items-start gap-2 px-3 py-3",children:[e.jsx("p",{className:"text-[12px] text-ink-muted",children:t("ui.teamBridge.list.error")}),f&&e.jsx(H,{size:"sm",variant:"ghost",onClick:f,children:t("ui.teamBridge.list.retry")})]}),e.jsx(ne,{id:"team-bridge-channels-heading",title:t("ui.teamBridge.section.channels"),add:R?void 0:{label:t("ui.teamBridge.section.channels_add"),onAdd:O},empty:a==="ready"&&$.channels.length===0?{text:R?t("ui.teamBridge.section.channels_none"):t("ui.teamBridge.section.channels_empty"),onCreate:R?void 0:O}:void 0,children:a==="loading"?e.jsx(Be,{label:t("ui.teamBridge.list.loading")}):Te($.channels)}),e.jsx(ne,{id:"team-bridge-groups-heading",title:t("ui.teamBridge.section.groups"),add:R?void 0:{label:t("ui.teamBridge.section.groups_add"),onAdd:()=>M({type:"compose",recipients:[]})},empty:a==="ready"&&$.groups.length===0?{text:R?t("ui.teamBridge.section.groups_none"):t("ui.teamBridge.section.groups_empty"),onCreate:R?void 0:()=>M({type:"compose",recipients:[]})}:void 0,children:a==="loading"?e.jsx(Be,{label:t("ui.teamBridge.list.loading")}):Te($.groups)}),ke.length>0&&e.jsx(ne,{id:"team-bridge-directs-heading",title:t("ui.teamBridge.section.directs"),children:Te(ke)}),S?e.jsx(ne,{id:"team-bridge-people-heading",title:t("ui.teamBridge.people.title"),empty:{text:t("ui.teamBridge.people.all_scope")}}):e.jsxs(e.Fragment,{children:[e.jsx(ne,{id:"team-bridge-people-heading",title:t("ui.teamBridge.people.title"),empty:A==="ready"&&_.length===0?{text:Z?t("ui.teamBridge.people.error"):t("ui.teamBridge.people.empty")}:void 0,children:A==="loading"?e.jsx(Be,{label:t("ui.teamBridge.people.loading")}):A==="error"?e.jsx(Ra,{error:ce,onRetry:_e}):e.jsx("ul",{className:"flex flex-col",children:_.map(l=>e.jsx(Ta,{member:l,selfAccountId:o,identityKnown:ue,selected:Xe(s,"person",l.account_id),dm:St(Q,l.account_id,o),readOnly:E,onSelect:()=>M({type:"person",accountId:l.account_id}),onStartGroup:$e},l.account_id))})}),e.jsx(ne,{id:"team-bridge-chiefs-heading",title:t("ui.teamBridge.section.chiefs"),empty:A==="ready"&&te.length===0?{text:t("ui.teamBridge.section.chiefs_empty")}:void 0,children:A==="loading"?e.jsx(Be,{label:t("ui.teamBridge.people.loading")}):A==="error"?null:e.jsx("ul",{className:"flex flex-col",children:te.map(l=>e.jsx(Ia,{chief:l,label:ae(l.agentName,re(l.person)),selected:Xe(s,"chief",l.person.account_id),dm:Dt(Q,l.person.account_id,o),readOnly:E,onSelect:()=>M({type:"chief",accountId:l.person.account_id}),onStartGroup:$e},l.person.account_id))})})]})]})]}),e.jsx("section",{className:"flex min-w-0 flex-1 flex-col bg-surface pt-[var(--panel-top-pad,0px)]",children:s===null?e.jsx("div",{className:"flex flex-1 items-center justify-center px-6",children:a==="loading"?e.jsx(be,{size:"sm",label:t("ui.teamBridge.list.loading")}):a==="error"?e.jsx("p",{className:"max-w-sm text-center text-[13px] text-ink-muted",children:t("ui.teamBridge.list.error_pane")}):e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("p",{className:"font-medium text-[13px] text-ink",children:t("ui.teamBridge.list.empty.title")}),e.jsx("p",{className:"mt-1 text-[13px] text-ink-muted",children:R?Ue:t("ui.teamBridge.list.empty.body")})]})}):e.jsxs(e.Fragment,{children:[s.type==="compose"?e.jsx(ct,{recipients:L,candidates:se,onChange:l=>M({type:"compose",recipients:l})}):e.jsxs("header",{className:"flex h-11 shrink-0 items-center gap-2 px-5",children:[N?.kind==="channel"?e.jsx(ot,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}):N?.kind==="group"?e.jsx(we,{size:16,"aria-hidden":"true",className:"shrink-0 text-ink-dim"}):s.type==="chief"?e.jsx(oe,{size:16,"aria-hidden":"true",className:"shrink-0 text-accent"}):null,e.jsx("h2",{className:"min-w-0 truncate font-semibold text-[15px] text-ink",children:P??t("ui.teamBridge.list.untitled")}),S&&y&&e.jsx("span",{className:"shrink-0 rounded-sm bg-elevated px-1.5 py-0.5 text-meta-sm text-ink-dim",children:y}),N&&N.kind!=="dm"&&e.jsx("span",{className:"shrink-0 text-meta-sm text-ink-dim",children:t("ui.teamBridge.member.count",{count:Tt(N)})}),N?.last_message_at&&N.latest_seq>0&&e.jsxs("span",{className:"shrink-0 text-meta-sm text-ink-dim",title:Pa(N.last_message_at,V),children:[e.jsx("span",{"aria-hidden":"true",children:"·"})," ",La(N.last_message_at,V)]}),e.jsx("div",{className:"ml-auto flex items-center gap-1",children:N&&!c&&!E&&j&&e.jsx(ja,{conversation:N,onNotifyChange:j,defaultOpen:Y})})]}),z&&e.jsx("p",{role:"alert",className:"px-5 pb-1 text-[12px] text-danger",children:t("ui.teamBridge.notify.error")}),N?.builtin&&e.jsx("p",{className:"px-5 pb-1 text-[12px] text-ink-dim",children:N.builtin==="agents"?t("ui.teamBridge.builtin.agents_topic"):t("ui.teamBridge.builtin.humans_topic")}),e.jsx(Je,{className:"min-h-0 flex-1 [&_[data-radix-scroll-area-viewport]>div]:block! [&_[data-radix-scroll-area-viewport]>div]:h-full",children:e.jsx("div",{className:"flex h-full flex-col",children:c?e.jsx(Aa,{joining:v,joinFailed:I,readOnly:E,onJoin:d}):U?e.jsx("p",{className:"px-5 py-8 text-[13px] text-ink-muted",children:t("ui.teamBridge.scope.thread_unknown")}):N===null?e.jsx("div",{className:"mt-auto flex flex-col gap-2 px-5 pb-5",children:s.type==="compose"?e.jsx("p",{className:"text-[13px] text-ink-muted",children:L.length===0?t("ui.teamBridge.compose.empty"):t("ui.teamBridge.thread.intro_group",{names:L.map(l=>l.label).join(", ")})}):e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:w("flex size-14 items-center justify-center rounded-xl font-semibold text-[22px]",s.type==="chief"?"bg-accent-wash text-accent":"bg-sunken text-ink-muted"),children:s.type==="chief"?e.jsx(oe,{size:26}):(P??"").trim().charAt(0).toUpperCase()||"?"}),e.jsx("p",{className:"font-semibold text-[17px] text-ink",children:P}),e.jsx("p",{className:"text-[13px] text-ink-muted",children:s.type==="chief"?t("ui.teamBridge.thread.intro_chief",{name:P??""}):t("ui.teamBridge.thread.intro_person",{name:P??""})})]})}):i==="loading"?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(be,{size:"sm",label:t("ui.teamBridge.thread.loading")})}):i==="error"?e.jsx("p",{className:"px-5 py-8 text-[13px] text-ink-muted",children:t("ui.teamBridge.thread.error")}):n.length===0?e.jsx("p",{className:"mt-auto px-5 pb-4 text-[13px] text-ink-muted",children:t("ui.teamBridge.thread.empty")}):e.jsx(_a,{messages:n,labelFor:l=>ye(l,N?.tenant_id??"")})})}),!c&&(E?e.jsx("p",{className:"shrink-0 px-5 pb-4 text-[12px] text-ink-dim leading-snug",children:t("ui.teamBridge.read_only.composer")}):e.jsxs("div",{className:"shrink-0 px-4 pb-4",children:[T&&e.jsx("p",{role:"alert",className:"px-2 pb-1 text-[12px] text-danger",children:t("ui.teamBridge.composer.error")}),e.jsxs("div",{className:w("rounded-xl bg-elevated transition-colors duration-fast ease-out-quart","has-[textarea:focus-visible]:outline-2 has-[textarea:focus-visible]:outline-accent has-[textarea:focus-visible]:outline-offset-2 has-[textarea:focus-visible]:outline-solid"),children:[e.jsx("textarea",{value:F,onChange:l=>ve(l.target.value),onKeyDown:l=>{l.key==="Enter"&&!l.shiftKey&&!l.nativeEvent.isComposing&&(l.preventDefault(),Oe())},rows:1,disabled:!De,placeholder:s.type==="compose"&&L.length>0?t("ui.teamBridge.composer.placeholder_to",{name:L.map(l=>l.label).join(", ")}):P&&s.type!=="compose"?t("ui.teamBridge.composer.placeholder_to",{name:P}):t("ui.teamBridge.composer.placeholder"),"aria-label":t("ui.teamBridge.composer.placeholder"),className:"block max-h-40 min-h-10 w-full resize-none bg-transparent px-3.5 pt-3 pb-1 text-[14px] text-ink outline-none placeholder:text-ink-dim disabled:cursor-not-allowed"}),e.jsxs("div",{className:"flex items-center gap-2 px-2 pb-2",children:[e.jsx("span",{className:w("min-w-0 flex-1 truncate pl-1.5 text-meta-sm text-ink-dim transition-opacity duration-fast",F.trim()?"opacity-100":"opacity-0"),"aria-hidden":!F.trim(),children:t("ui.teamBridge.composer.hint")}),e.jsx(H,{size:"icon-sm",variant:"primary",className:"rounded-md",disabled:!F.trim()||g||!De,"aria-label":t("ui.teamBridge.composer.send"),onClick:Oe,children:g?e.jsx(be,{size:"sm"}):e.jsx(It,{size:16})})]})]})]}))]})})]})},Aa=({joining:a=!1,joinFailed:i=!1,readOnly:r=!1,onJoin:s})=>(D(),e.jsx("div",{className:"flex flex-1 items-center justify-center px-6 py-10",children:e.jsxs("div",{className:"flex max-w-md flex-col items-center gap-3 text-center",children:[e.jsx("p",{className:"text-[13px] text-ink",children:t("ui.teamBridge.preview.banner")}),i&&e.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:t("ui.teamBridge.preview.join_error")}),r?e.jsx("p",{className:"text-[12px] leading-snug text-ink-dim",children:t("ui.teamBridge.read_only.note")}):e.jsx(H,{type:"button",size:"sm",variant:"primary",disabled:a,onClick:s,children:t("ui.teamBridge.preview.join")})]})})),Wa=()=>{const[a,i]=ua(),r=a.get("conversation"),s=a.get("tenant"),[n,m]=u.useState(()=>s?Qe(s):X),x=u.useRef(!!s),h=zt(),k=h.data?Rt(h.data):null,p=h.isPending,o=!p&&k===null,g=h.data?.account_id??void 0,T=h.data?.read_only===!0,v=Et({enabled:o}),I=Ft(o,X),z=Pt(h.data),d=u.useMemo(()=>Lt(v.memberships,I.data?.organizations,z),[v.memberships,I.data,z]),{pending:j,failed:Y}=qt(z,v),K=At(n,o),_=Gt(n===X?null:n,o),q=n===X,de=Ot(q?d.map(c=>c.tenantId):[],o),A=ma().user?.name??void 0,ce=K.data?.conversations??[],Z=_.data?.members??[],_e=st(Z,g,(c,y)=>t("ui.teamBridge.chief.label",{agent:c,person:y})),[B,G]=u.useState(()=>r?{type:"conversation",id:r}:null),[E,M]=u.useState(!1);u.useEffect(()=>{!r||!s||(x.current=!0,m(Qe(s)),G({type:"conversation",id:r}),M(!1),i({},{replace:!0}))},[r,s,i]);const Ce=c=>{x.current=!0,m(c),G(null),M(!1)};u.useEffect(()=>{m(c=>$t(d,c,x.current))},[d]);const O=u.useMemo(()=>et(ce,n,d),[ce,n,d]);u.useEffect(()=>{if(B===null&&O.length>0){const c=O.find(y=>y.builtin==="humans")??O[0];G({type:"conversation",id:c.id})}},[O,B]);const f=at(B,O,g),Me=f!==null&&Ee(f),ee=Ut(Me?null:f?.id??null,f?.tenant_id,o),V=Ht(f?.id??"",f?.tenant_id),F=Kt(q?void 0:n),ve=Vt(f?.id??"",f?.tenant_id),S=Qt(f?.id??"",f?.tenant_id),ue=Wt(),Q=(c,y)=>t("ui.teamBridge.chief.label",{agent:c,person:y}),$=()=>{if(B===null)return[];if(B.type==="compose")return B.recipients;if(B.type==="person"){const c=Z.find(y=>y.account_id===B.accountId);return c?[{kind:"human",accountId:c.account_id,label:re(c)}]:[]}if(B.type==="chief"){const c=tt(Z,g).find(y=>y.person.account_id===B.accountId);return c?[{kind:"agent",accountId:c.person.account_id,endpointId:c.endpointId,label:Q(c.agentName||t("ui.teamBridge.chief.fallback"),re(c.person))}]:[]}return[]},[te,ae]=u.useState(!1),[Se,me]=u.useState(!1),ye=u.useRef(new Map),xe=u.useRef(B);xe.current=B;const ke=async(c,y)=>{if(f!==null)return V.mutateAsync({clientRef:y,body:c});const U=$(),W=Yt(U);if(W===null)return;const pe=`${q?"*":n}|${W.kind}|${U.map(J).sort().join(",")}`,P=B;ae(!0),me(!1);try{const{id:se}=await Zt({draftKey:pe,input:W,body:c,clientRef:y,tenantId:q?void 0:n,remembered:ye.current,create:L=>F.mutateAsync(L),post:(L,N)=>ea.send(L,N)});return P?.type==="compose"&&xe.current===P&&G({type:"conversation",id:se}),await K.refetch(),{id:se}}catch(se){throw me(!0),se}finally{ae(!1)}};u.useEffect(()=>{V.reset(),S.reset(),ue.reset(),me(!1)},[f?.id,B]);const C=ee.data?.messages.reduce((c,y)=>c===void 0||y.seq>c?y.seq:c,void 0);return u.useEffect(()=>{f===null||C===void 0||C<=f.last_read_seq||ve.mutate({seq:C})},[f?.id,C]),e.jsxs(e.Fragment,{children:[e.jsx(qa,{listState:K.isPending||q&&j?"loading":K.isError||q&&Y?"error":"ready",messageState:f===null?"idle":ee.isPending?"loading":ee.isError?"error":"ready",conversations:ce,target:B,messages:ee.data?.messages??[],organizations:d,scope:n,totalUnread:I.data?.total??0,membershipsLoading:j,organizationsFailed:Y,selfAccountId:g,sending:V.isPending||te,sendFailed:V.isError||Se,joining:S.isPending,joinFailed:S.isError,notifyFailed:Jt(ue,f?.id??null),onJoin:()=>S.mutate(),onNotifyChange:c=>{f!==null&&ue.mutate({conversationId:f.id,tenantId:f.tenant_id,notify:c})},onTarget:c=>{M(!1),G(c)},onSend:ke,onNewChannel:()=>{T||q||M(!0)},people:Z,directories:de,selfName:A,peopleState:_.isPending?"loading":_.isError?"error":"ready",peopleError:_.error,peopleIncomplete:(_.data?.unavailable_count??0)>0,onRetryPeople:()=>{_.refetch()},eligibility:k,gatePending:p,readOnly:T,onRetry:()=>{K.refetch(),v.isError&&v.refetch()},onScopeChange:Ce,onRetryMemberships:()=>{v.refetch()}}),e.jsx(Ba,{open:E,candidates:_e,pending:F.isPending,error:F.isError?t("ui.teamBridge.create.error"):void 0,onClose:()=>M(!1),onCreate:c=>{F.mutate(c,{onSuccess:y=>{M(!1);const U=y;U.id&&G({type:"conversation",id:U.id})}})}})]})};export{Fa as TeamBridgeEligibilityPanel,Wa as TeamBridgePage,qa as TeamBridgePageView,Aa as TeamBridgePreviewBanner,Pa as absolute,La as relative};