@intent-hq/web 2.284.0 → 2.285.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 (202) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{BLEfessf.js → -KtznSS-.js} +1 -1
  3. package/web/app/immutable/chunks/{BfCf1CX7.js → 1lVCCXL6.js} +1 -1
  4. package/web/app/immutable/chunks/{rL78ODLZ.js → 2eBUyHOS.js} +1 -1
  5. package/web/app/immutable/chunks/{D-aPtTCv.js → 6ASkEKEx.js} +1 -1
  6. package/web/app/immutable/chunks/{C6Lk-C_n.js → 70g8kmTR.js} +1 -1
  7. package/web/app/immutable/chunks/{CclADFoZ.js → 9s6R6NFl.js} +1 -1
  8. package/web/app/immutable/chunks/{BghJZEqX.js → ASxUuKIZ.js} +1 -1
  9. package/web/app/immutable/chunks/{BYvXj8cv.js → B0UymEvm.js} +1 -1
  10. package/web/app/immutable/chunks/{BoffG-0C.js → B0a31Ljt.js} +1 -1
  11. package/web/app/immutable/chunks/{gNzz3jGE.js → B4GCMjY3.js} +1 -1
  12. package/web/app/immutable/chunks/B4kKZm1B.js +1 -0
  13. package/web/app/immutable/chunks/{Dkj8SIBR.js → B91hcydD.js} +1 -1
  14. package/web/app/immutable/chunks/{Bj2uvmt-.js → B9DD1rvd.js} +1 -1
  15. package/web/app/immutable/chunks/{B1s7HAuZ.js → BA2m5W5p.js} +1 -1
  16. package/web/app/immutable/chunks/{CajYOO74.js → BB-v27nE.js} +1 -1
  17. package/web/app/immutable/chunks/{CeMTgCB3.js → BDnf9UFd.js} +1 -1
  18. package/web/app/immutable/chunks/{DyQA18KQ.js → BEu9jjb7.js} +1 -1
  19. package/web/app/immutable/chunks/{Byp8PswU.js → BFDtkLj3.js} +1 -1
  20. package/web/app/immutable/chunks/{C-AxUu93.js → BFlCxloC.js} +1 -1
  21. package/web/app/immutable/chunks/{DR4RT4VO.js → BLT4lwJH.js} +1 -1
  22. package/web/app/immutable/chunks/{CyO8AnLs.js → BMCIczJY.js} +1 -1
  23. package/web/app/immutable/chunks/{BcemBG1g.js → BMqkZHSQ.js} +4 -4
  24. package/web/app/immutable/chunks/{DcoQTetB.js → BOxsG-23.js} +1 -1
  25. package/web/app/immutable/chunks/{D2hiI0dA.js → BRaDvZhu.js} +1 -1
  26. package/web/app/immutable/chunks/{BUtQhKox.js → BRiWAWWR.js} +1 -1
  27. package/web/app/immutable/chunks/{vICHfDZm.js → BRrnGZdq.js} +1 -1
  28. package/web/app/immutable/chunks/{8n4ougjP.js → BRsvqYQJ.js} +1 -1
  29. package/web/app/immutable/chunks/{Bj6-QOR3.js → BW5WMYMF.js} +1 -1
  30. package/web/app/immutable/chunks/{DZ-8K7hK.js → BYD9CrbJ.js} +1 -1
  31. package/web/app/immutable/chunks/{CEkEURUB.js → BerKnKvV.js} +1 -1
  32. package/web/app/immutable/chunks/{J2ZKQ-lu.js → BfCM8g6D.js} +1 -1
  33. package/web/app/immutable/chunks/{BFDD1pyQ.js → Bi5G5jdW.js} +1 -1
  34. package/web/app/immutable/chunks/{BSLrzoVf.js → BijxVENA.js} +1 -1
  35. package/web/app/immutable/chunks/{JqZ92YB_.js → BioKfdhs.js} +1 -1
  36. package/web/app/immutable/chunks/{5ZpW5rVB.js → Bj2REgAl.js} +1 -1
  37. package/web/app/immutable/chunks/{5BmKVYc1.js → Bj2YjLqH.js} +4 -4
  38. package/web/app/immutable/chunks/{B8xgoeqo.js → BkTES_s_.js} +1 -1
  39. package/web/app/immutable/chunks/{oPjZ8e3L.js → BlGCnZqu.js} +1 -1
  40. package/web/app/immutable/chunks/{CBF5TBJQ.js → BoAgG62K.js} +1 -1
  41. package/web/app/immutable/chunks/{cesw6DqW.js → Bpei5bK8.js} +1 -1
  42. package/web/app/immutable/chunks/{CqyYuyXE.js → BqEq2gS8.js} +1 -1
  43. package/web/app/immutable/chunks/{Bir-_mB8.js → BrPrpju0.js} +1 -1
  44. package/web/app/immutable/chunks/{DbdgMxO8.js → Btdv9Hrh.js} +1 -1
  45. package/web/app/immutable/chunks/{C1FIrZNw.js → BuKPgt_Y.js} +1 -1
  46. package/web/app/immutable/chunks/{CLDGr3DL.js → BuRX-tbO.js} +1 -1
  47. package/web/app/immutable/chunks/{BQqtq_EY.js → Butq4Y1l.js} +4 -4
  48. package/web/app/immutable/chunks/{CoEKpjkL.js → BwcCzTcz.js} +1 -1
  49. package/web/app/immutable/chunks/{DxyRwm0L.js → C-PJ15bY.js} +1 -1
  50. package/web/app/immutable/chunks/{D0GCGQZA.js → C4eeWJf-.js} +1 -1
  51. package/web/app/immutable/chunks/{lKWYFdqV.js → C4mRaa7L.js} +1 -1
  52. package/web/app/immutable/chunks/{BOV2-YtX.js → C5vTcsb2.js} +1 -1
  53. package/web/app/immutable/chunks/{Dwola7mR.js → C64d2sYd.js} +1 -1
  54. package/web/app/immutable/chunks/{D9ZfYqMq.js → C7A26Vlu.js} +1 -1
  55. package/web/app/immutable/chunks/{kjKGIJZ6.js → C8BEXIPc.js} +1 -1
  56. package/web/app/immutable/chunks/{DWW4w6Jk.js → C8xd2WWY.js} +1 -1
  57. package/web/app/immutable/chunks/{CWMWrTe0.js → C9o24MoC.js} +1 -1
  58. package/web/app/immutable/chunks/{7IZupueL.js → CAkMXI-6.js} +3 -3
  59. package/web/app/immutable/chunks/{LoyMyTg_.js → CDnN0LSW.js} +1 -1
  60. package/web/app/immutable/chunks/{Ri_Gwy-5.js → CEQqb3fD.js} +1 -1
  61. package/web/app/immutable/chunks/{DPd_IJJ7.js → CFzJYgT5.js} +1 -1
  62. package/web/app/immutable/chunks/{DSJT83nX.js → CHXt_ftw.js} +1 -1
  63. package/web/app/immutable/chunks/{RAzXpC6i.js → CHaUiotE.js} +1 -1
  64. package/web/app/immutable/chunks/{BIkNHTNp.js → CHjSilfW.js} +1 -1
  65. package/web/app/immutable/chunks/{CLCaT9pi.js → CJQrM64N.js} +3 -3
  66. package/web/app/immutable/chunks/{U9YbfUz9.js → CMO5zsjQ.js} +1 -1
  67. package/web/app/immutable/chunks/{BCkgwkHF.js → CMt5MqSJ.js} +1 -1
  68. package/web/app/immutable/chunks/{580ALcE7.js → COL0pyet.js} +1 -1
  69. package/web/app/immutable/chunks/{D_mcoMIN.js → CQ7Jnj9E.js} +1 -1
  70. package/web/app/immutable/chunks/{DoBcYmem.js → CRhgbDg2.js} +5 -5
  71. package/web/app/immutable/chunks/{DDi4fKeR.js → CTozw_6a.js} +1 -1
  72. package/web/app/immutable/chunks/{--3ZEJ9J.js → CTwzQE4y.js} +1 -1
  73. package/web/app/immutable/chunks/{Dk3JYfn4.js → CULilvBT.js} +1 -1
  74. package/web/app/immutable/chunks/{BnZq-I73.js → CV2PaujE.js} +2 -2
  75. package/web/app/immutable/chunks/{bin8Us0N.js → CVUNrf_6.js} +1 -1
  76. package/web/app/immutable/chunks/{GJVVHDkb.js → CWgAcLvx.js} +1 -1
  77. package/web/app/immutable/chunks/{CTthB0JK.js → CYElNz1m.js} +1 -1
  78. package/web/app/immutable/chunks/{CoQLGQdj.js → CZUDc12W.js} +1 -1
  79. package/web/app/immutable/chunks/{Bmnp4Cni.js → CdT170lG.js} +6 -6
  80. package/web/app/immutable/chunks/{B96HYSUr.js → Ceyasj46.js} +1 -1
  81. package/web/app/immutable/chunks/{IrWlayTZ.js → CfAqizJ3.js} +1 -1
  82. package/web/app/immutable/chunks/{D8GxmJaV.js → CfYh5raT.js} +1 -1
  83. package/web/app/immutable/chunks/{DkJafW99.js → CgWJ7tKh.js} +1 -1
  84. package/web/app/immutable/chunks/{CwYn_cZy.js → ChDcu7sM.js} +1 -1
  85. package/web/app/immutable/chunks/{C-tRLOED.js → ChmO5DTP.js} +1 -1
  86. package/web/app/immutable/chunks/{CXruy7R4.js → Cj_Tm5wU.js} +1 -1
  87. package/web/app/immutable/chunks/{BXwgWEmz.js → CkNc-1DL.js} +1 -1
  88. package/web/app/immutable/chunks/{DpiQDkOO.js → CkqPtSf5.js} +1 -1
  89. package/web/app/immutable/chunks/{Cci8BWX_.js → ClNs6jou.js} +1 -1
  90. package/web/app/immutable/chunks/{qb0bPcr5.js → CotgBJSP.js} +1 -1
  91. package/web/app/immutable/chunks/{CHK5bSfe.js → CoyHhRwd.js} +1 -1
  92. package/web/app/immutable/chunks/{Dd_avILP.js → CozIiFS7.js} +1 -1
  93. package/web/app/immutable/chunks/{B5HPrVzu.js → Cp09JH6d.js} +1 -1
  94. package/web/app/immutable/chunks/{BYhzE2Id.js → CpPsvdhC.js} +1 -1
  95. package/web/app/immutable/chunks/{v3KbAU5c.js → CrXlvCkv.js} +1 -1
  96. package/web/app/immutable/chunks/{DKwy0FDy.js → Crq4Js3_.js} +1 -1
  97. package/web/app/immutable/chunks/{BZjntufp.js → CvZhT_UL.js} +1 -1
  98. package/web/app/immutable/chunks/{Ds-TYeKV.js → Cve5pOPi.js} +2 -2
  99. package/web/app/immutable/chunks/{CQMmROUx.js → CwK4Fl7A.js} +2 -2
  100. package/web/app/immutable/chunks/{Bhov0MTz.js → Cwxvd99b.js} +1 -1
  101. package/web/app/immutable/chunks/{CbNazQqj.js → Cz9_gz0r.js} +1 -1
  102. package/web/app/immutable/chunks/{CXu6aWOL.js → Czc4IAh9.js} +1 -1
  103. package/web/app/immutable/chunks/{BmY5L1Op.js → Czzw_Pvc.js} +1 -1
  104. package/web/app/immutable/chunks/{BCHni7By.js → D0csyvlS.js} +1 -1
  105. package/web/app/immutable/chunks/{pl6-mRrC.js → D1dPbxoX.js} +1 -1
  106. package/web/app/immutable/chunks/{CNzOZ9MW.js → D2Fdja4t.js} +1 -1
  107. package/web/app/immutable/chunks/{DPfdnkfB.js → D38kCxZ9.js} +1 -1
  108. package/web/app/immutable/chunks/{DZpe54cf.js → D4K0RFHm.js} +1 -1
  109. package/web/app/immutable/chunks/{BLjf4WQt.js → D4RvTAYA.js} +1 -1
  110. package/web/app/immutable/chunks/{DG8rkBW-.js → D6XYE7JV.js} +1 -1
  111. package/web/app/immutable/chunks/{k5qVf45I.js → D6dtEt_1.js} +1 -1
  112. package/web/app/immutable/chunks/{DOdMtNpo.js → D72pFxfr.js} +1 -1
  113. package/web/app/immutable/chunks/{D6K58w6v.js → D7P2CXpO.js} +3 -3
  114. package/web/app/immutable/chunks/{BE5jLkkZ.js → D82TCSK5.js} +1 -1
  115. package/web/app/immutable/chunks/{CJuSN2hh.js → D8HMZQ9R.js} +1 -1
  116. package/web/app/immutable/chunks/{syg_Gxp6.js → D8U0PEIU.js} +1 -1
  117. package/web/app/immutable/chunks/{CrPyrftw.js → DB6_aOnf.js} +1 -1
  118. package/web/app/immutable/chunks/{4kHCfKWR.js → DB_2g4tK.js} +1 -1
  119. package/web/app/immutable/chunks/{1wcS2GHA.js → DBicYI5c.js} +1 -1
  120. package/web/app/immutable/chunks/{BQu3cSOx.js → DFXw4s8S.js} +1 -1
  121. package/web/app/immutable/chunks/{CCzzpn5X.js → DFvnP41F.js} +1 -1
  122. package/web/app/immutable/chunks/{BmeKmSN1.js → DG5KvEVf.js} +1 -1
  123. package/web/app/immutable/chunks/{oU2ii1bq.js → DKF2EjTY.js} +1 -1
  124. package/web/app/immutable/chunks/{BSIOWZWq.js → DOPcy6T2.js} +1 -1
  125. package/web/app/immutable/chunks/{Dzk1FZ-5.js → DPY72hn4.js} +1 -1
  126. package/web/app/immutable/chunks/{CAS7It7T.js → DQafeec3.js} +1 -1
  127. package/web/app/immutable/chunks/{D6CS23-9.js → DRdRLmUz.js} +1 -1
  128. package/web/app/immutable/chunks/{D5bYJMaB.js → DWzbf_aU.js} +1 -1
  129. package/web/app/immutable/chunks/{BAyTpaq3.js → DX0AlGFV.js} +1 -1
  130. package/web/app/immutable/chunks/{DI5O_gLl.js → DX0hE1oC.js} +1 -1
  131. package/web/app/immutable/chunks/{BxFP5cPu.js → DX3MlPN0.js} +1 -1
  132. package/web/app/immutable/chunks/{Tpzyol5T.js → DXJ3D6-0.js} +2 -2
  133. package/web/app/immutable/chunks/{wXtCM_sb.js → DYX4kEq9.js} +1 -1
  134. package/web/app/immutable/chunks/{BuSZooEw.js → DZRaa7LH.js} +1 -1
  135. package/web/app/immutable/chunks/{BMBobKUo.js → Dbuv3b_7.js} +2 -2
  136. package/web/app/immutable/chunks/{CEZnJlwn.js → DhQAmnDS.js} +1 -1
  137. package/web/app/immutable/chunks/{BrvhC6GL.js → DhkOw60r.js} +1 -1
  138. package/web/app/immutable/chunks/{D805RV1I.js → Dijv8faG.js} +1 -1
  139. package/web/app/immutable/chunks/{Djthn66V.js → DlYL66WK.js} +2 -2
  140. package/web/app/immutable/chunks/{BS6Z2wWv.js → DlYrPe_w.js} +1 -1
  141. package/web/app/immutable/chunks/{cfTDb37Y.js → Dlu0_GVa.js} +1 -1
  142. package/web/app/immutable/chunks/{BNfbL3_i.js → DpXfO8nM.js} +1 -1
  143. package/web/app/immutable/chunks/{BE6av5p4.js → DuKFlC9j.js} +1 -1
  144. package/web/app/immutable/chunks/{DqUTyEPN.js → DwW5MiN3.js} +1 -1
  145. package/web/app/immutable/chunks/{BRk6sSrF.js → DxJXJeWp.js} +1 -1
  146. package/web/app/immutable/chunks/{03ESLWB1.js → DxlpLNnB.js} +1 -1
  147. package/web/app/immutable/chunks/{BYB7SynS.js → F42L1irN.js} +1 -1
  148. package/web/app/immutable/chunks/{FcnPtqUv.js → I1eQnBry.js} +1 -1
  149. package/web/app/immutable/chunks/{B5KLQb3J.js → J5Q3706J.js} +1 -1
  150. package/web/app/immutable/chunks/{mf6N49ed.js → JUqct0gC.js} +1 -1
  151. package/web/app/immutable/chunks/{BxUDfZfX.js → KxpMwUsB.js} +1 -1
  152. package/web/app/immutable/chunks/{BKAQdyqG.js → LiYeJQ_y.js} +1 -1
  153. package/web/app/immutable/chunks/{CZ1Jg-sG.js → Qyi-W7KZ.js} +1 -1
  154. package/web/app/immutable/chunks/{CyBNkEuV.js → RDcDz1X1.js} +1 -1
  155. package/web/app/immutable/chunks/{Blhl4Kzo.js → SlH326tK.js} +1 -1
  156. package/web/app/immutable/chunks/{lLF0vfI3.js → UMObs5wi.js} +1 -1
  157. package/web/app/immutable/chunks/{BEQXbC7q.js → Uv0U-1kP.js} +1 -1
  158. package/web/app/immutable/chunks/{DIvWSFnj.js → WPmFGY7m.js} +1 -1
  159. package/web/app/immutable/chunks/{DRYCjR4c.js → Xb_csWgU.js} +1 -1
  160. package/web/app/immutable/chunks/{aVNMqNTp.js → Y3UAS5wV.js} +1 -1
  161. package/web/app/immutable/chunks/{CZFoI5QY.js → YpQeV5ep.js} +6 -6
  162. package/web/app/immutable/chunks/{DO0tFr72.js → _Y7Nvr11.js} +1 -1
  163. package/web/app/immutable/chunks/{lflImyZ6.js → _bgnudZi.js} +2 -2
  164. package/web/app/immutable/chunks/{CRQOCmwo.js → _eQjP0_7.js} +7 -7
  165. package/web/app/immutable/chunks/{C6NP7Wkf.js → c0MObYhr.js} +1 -1
  166. package/web/app/immutable/chunks/{CYvdhBss.js → hAyFyjes.js} +1 -1
  167. package/web/app/immutable/chunks/{BLjxHwvZ.js → iPSaMdjW.js} +1 -1
  168. package/web/app/immutable/chunks/{Jyr4akMd.js → ingscYYg.js} +1 -1
  169. package/web/app/immutable/chunks/{goXBWNik.js → lrd8vBcb.js} +1 -1
  170. package/web/app/immutable/chunks/{BlhXsK8K.js → nvBTDqJi.js} +1 -1
  171. package/web/app/immutable/chunks/{CzfXsXYz.js → oDL-pLcj.js} +1 -1
  172. package/web/app/immutable/chunks/{C83cffhG.js → s4JAFzR2.js} +1 -1
  173. package/web/app/immutable/chunks/{DyaiTi8A.js → sgXcAFR7.js} +1 -1
  174. package/web/app/immutable/chunks/{DQ_zmHT9.js → t61BPD62.js} +1 -1
  175. package/web/app/immutable/chunks/{CRqiQDbX.js → t7uelISx.js} +1 -1
  176. package/web/app/immutable/chunks/{CzTIJ9gY.js → tWOclZbM.js} +1 -1
  177. package/web/app/immutable/chunks/{i_sqIi_B.js → u9Jr5xJ2.js} +1 -1
  178. package/web/app/immutable/chunks/{CtwCGSFA.js → uKt9v9GZ.js} +1 -1
  179. package/web/app/immutable/chunks/{CsP-2ecL.js → xS44oH53.js} +1 -1
  180. package/web/app/immutable/chunks/{CX89Aogf.js → yQykulND.js} +1 -1
  181. package/web/app/immutable/chunks/{NfelpfPi.js → z5aynuor.js} +1 -1
  182. package/web/app/immutable/chunks/{B1P0TORE.js → zOdhHtWD.js} +1 -1
  183. package/web/app/immutable/chunks/{C1GRqLCq.js → zuhzlizP.js} +1 -1
  184. package/web/app/immutable/entry/{app.Cn1_ubOc.js → app.ZJRI8LL8.js} +2 -2
  185. package/web/app/immutable/entry/start.B_ChBWnN.js +1 -0
  186. package/web/app/immutable/nodes/{0.wKUTDWdz.js → 0.B_5IeAcY.js} +1 -1
  187. package/web/app/immutable/nodes/{1.DxJUaPzW.js → 1.D2RcMrk8.js} +1 -1
  188. package/web/app/immutable/nodes/{10.eeMW9oGM.js → 10.a-yBB_mg.js} +1 -1
  189. package/web/app/immutable/nodes/{14.DMbmYykJ.js → 14.BRMrhd95.js} +1 -1
  190. package/web/app/immutable/nodes/{16.D7z1ouJw.js → 16.DsObfcQu.js} +2 -2
  191. package/web/app/immutable/nodes/{2.BHOa4yl6.js → 2.BX2UV9md.js} +3 -3
  192. package/web/app/immutable/nodes/{3.DLeJMfu1.js → 3.BAb5j4vs.js} +1 -1
  193. package/web/app/immutable/nodes/{4.BEPpJpXB.js → 4.i3m7hv4J.js} +1 -1
  194. package/web/app/immutable/nodes/{5.Cb4CR-KH.js → 5.kQ7xzuNs.js} +1 -1
  195. package/web/app/immutable/nodes/{6.Bko4vkVy.js → 6.De5Z6N1w.js} +1 -1
  196. package/web/app/immutable/nodes/{7.z66lh95v.js → 7.Dqm5QJxM.js} +1 -1
  197. package/web/app/immutable/nodes/{8.Cykwxl0x.js → 8.BT-G_bE5.js} +2 -2
  198. package/web/app/immutable/nodes/{9.Bm3FCmVg.js → 9.DIcsOChV.js} +1 -1
  199. package/web/app/version.json +1 -1
  200. package/web/index.html +9 -9
  201. package/web/app/immutable/chunks/DsYKN9zh.js +0 -1
  202. package/web/app/immutable/entry/start.7mFy7hlx.js +0 -1
@@ -1 +1 @@
1
- import{I as h}from"./DQ_zmHT9.js";import{c as v}from"./ChTqQfQN.js";import{bs as d}from"./DgFojmqv.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};
1
+ import{I as h}from"./t61BPD62.js";import{c as v}from"./ChTqQfQN.js";import{bs as d}from"./DgFojmqv.js";const g=v("AttachmentImageUrl");function y(t,n){const r=n.split("/").filter(e=>e.length>0).map(e=>encodeURIComponent(e)).join("/");return`workspace-file://${t}/${r}`}const u=new Map,a=new Map;let f=0,m=!1;function p(){m||(m=!0,d(()=>{f+=1,u.clear(),a.clear()}))}function A(t,n){u.delete(`${t}/${n}`)}function F(t,n,r){p();let e=!1,i=!1,o=!1;async function l(){if(!e){if(i){o=!0;return}i=!0;try{const c=await $(t,n);e||r(c)}finally{i=!1,o&&(o=!1,l())}}}const s=d(()=>{l()});return l(),{imageFailed(){e||(A(t,n),r(null))},dispose(){e=!0,s()}}}function $(t,n){p();const r=f,e=`${t}/${n}`,i=u.get(e);if(i)return Promise.resolve(i);const o=a.get(e);if(o)return o;const l=(async()=>{try{const s=await h({attachmentId:n,workspaceId:t});if(r!==f)return null;if(!s.exists)return g.warn("Attachment file missing on disk",{attachmentId:n}),null;const c=y(t,s.path);return u.set(e,c),c}catch(s){return g.warn("Failed to resolve attachment image",{attachmentId:n,error:s}),null}finally{r===f&&a.delete(e)}})();return a.set(e,l),l}export{A as e,F as o,$ as r};
@@ -1 +1 @@
1
- var Me=Object.defineProperty;var De=(i,s,e)=>s in i?Me(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var m=(i,s,e)=>De(i,typeof s!="symbol"?s+"":s,e);import{x as Ne,J as oe,Y as ce,ag as q,ao as Ce}from"./D6K58w6v.js";import{bI as Le,cD as le,c4 as ue,c3 as ve}from"./DQ_zmHT9.js";import{G2 as p,z4 as we,br as be,c as Fe,HZ as de,hA as me,bD as ke,AW as z,zs as Ge,eT as Pe,xE as xe,dP as Ee,eP as fe,dO as _e,y3 as Ve,HF as Ue,tU as Be}from"./C51KzdSG.js";import{aA as Ae,dz as he,A as H,P as ge,aw as K}from"./dimBDqRX.js";import{ax as $e}from"./DgFojmqv.js";import{c as Y}from"./ChTqQfQN.js";import{a as Xe}from"./BJzHxIyr.js";import{n as Q}from"./BjO6mATN.js";import"./B8o4lNgr.js";import{bo as n}from"./D4MoKNoK.js";import"./WVYGrHqE.js";import"./WZHg24tN.js";import"./De4WWpS0.js";import{R as Re}from"./CVBBsS8i.js";import{L as We}from"./D8dE5NKO.js";function Ye(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new Xe("PerformanceOptimizer"),w=class w{constructor(){m(this,"metricsBuffer");m(this,"metricsIndex",0);m(this,"metricsCount",0);m(this,"MAX_METRICS",500);m(this,"TARGET_RESPONSE_TIME",100);m(this,"memoCache",new Map);m(this,"MEMO_TTL",6e4);m(this,"MAX_CACHE_SIZE",100);m(this,"cacheHits",0);m(this,"cacheMisses",0);m(this,"pendingRequests",new Map);m(this,"requestQueue",[]);m(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let c=0;c<s.length;c+=r){const f=s.slice(c,c+r).map((o,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(o);d(k)},g)})}),u=await Promise.all(f);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const f=this.getMemoized(a);if(f!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),f;this.cacheMisses++}if(t.coalesce){const f=this.pendingRequests.get(s);if(f)return V.debug("Request coalesced",{operation:s}),f}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const c=await l;t.memoize&&this.memoize(a,c);const E=Z.now()-r;return this.recordMetric(s,E,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),E>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(E),target:this.TARGET_RESPONSE_TIME}),c}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const o=this.metricsBuffer[(e+u)%this.MAX_METRICS];o&&s.push(o)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,o)=>u.duration-o.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const c=a/s.length,E=Math.floor(t.length*.95),f=Math.floor(t.length*.99);return{avgResponseTime:Math.round(c),p95ResponseTime:Math.round(t[E]?.duration||0),p99ResponseTime:Math.round(t[f]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};m(w,"instance");let ee=w;const qe=ee.getInstance(),pe={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},j={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},ze={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function He(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Ke(i,s){return He(i).every(t=>t in s)}function Ie(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function J(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function Qe(i,s){return s&&j[i]&&Ke(j[i],s)?Ie(j[i],s):ze[i]||n.errors_userFriendly_fallback_error()}function Ze(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?pe[e]:pe.GENERAL}const je={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function Je(i){return je[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var D=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(D||{});class W extends Error{constructor(e,t,r={},a){super(e);m(this,"code");m(this,"context");m(this,"recoverySuggestions");m(this,"userMessage");m(this,"isRecoverable");m(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return Qe(e,this.context)}getDefaultRecoverySuggestions(e){return Je(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return Ze(this.code)}formatMessage(e){return Ie(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const et={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function ie(i){const s=i.toLowerCase();for(const e of et.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const tt="Agent already has an in-flight prompt. Message was not delivered.",v=Y("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=Re.DEFAULT_ATTEMPTS,retryDelay:a=Re.BASE_DELAY,exponentialBackoff:l=!0,notify:c=!1,notifyOnRetry:E=!1,context:f={},onError:u,onRetry:o,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const h=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),h}catch(h){if(g=h,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:f}),u?.(g,d),d<=r&&R(g)){const C=l?a*Math.pow(2,d-1):a;E&&Q.warning(n.agent_errorBoundary_retrying_message({seconds:C/1e3})),o?.(d),v.info(`[${e}] Retrying in ${C}ms`),await this.sleep(C)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=J(g?.message||n.agent_errorBoundary_generic_error()),N=g?.message?.toLowerCase()||"",$=N.includes("no available models")||N.includes("all models exhausted")||N.includes("all models unavailable");throw c&&!$&&Q.error(P),new W(P,D.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:f})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&Q.error(J(a.message)),new W(J(a.message),D.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return ie(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof W?[D.NETWORK_ERROR,D.STREAM_TIMEOUT,D.STREAM_CONNECTION_FAILED,D.PROVIDER_CONNECTION_FAILED,D.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new W(`${t} timed out after ${e}ms`,D.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,c=[],E=[];for(let f=0;f<s.length;f+=r){const u=s.slice(f,f+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")c.push(R.value);else{const d=R.reason;if(E.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return E.length>0&&v.warn(`[${l}] Completed with ${E.length} errors`),{results:c,errors:E}}};m(b,"instance");let te=b;const st=te.getInstance(),se=Y("browser/index"),F=new Map,B=new Map;let U;function it(i,s,e){for(const t of s)try{t(e)}catch(r){se.error("Error in agent subscriber callback",{agentId:i,error:r})}}function rt(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Ae.select(e,t);B.get(t)!==a&&(B.set(t,a),it(t,r,a))}})}function at(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ct(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),rt();const a=p.state,l=Ae.select(a,i);return r&&B.set(i,l),l?se.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):se.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const c=F.get(i);c&&(c.delete(s),c.size===0&&(F.delete(i),B.delete(i))),at()}}const y=Y("ErrorRecovery"),Se={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||ie(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class nt{constructor(){m(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class ot extends nt{constructor(){super(...arguments);m(this,"activeRecoveries",new Map);m(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=Se.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let c,E=t.initialBackoffMs,f=0;for(let u=1;u<=t.maxRetries;u++){if(f=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const o=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:o,attempts:u,totalTime:Date.now()-a}}catch(o){c=o,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:c.message});const R=c.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:c.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:c.message});break}if(ie(c.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:c.message});break}if(!t.shouldRetry(c,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:c.message});break}if(u<t.maxRetries){const g=Math.random()*.2*E,d=Math.min(E+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:c.message}),await this.delay(d,l.signal),E=Math.min(E*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(c,f),this.emit("recovery:failure",{operationId:r,attempts:f,duration:Date.now()-a,error:c?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:c,attempts:f,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const c=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",c);const E=r;r=()=>{t.removeEventListener("abort",c),E()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const ct=new ot,O=new We({category:"WorkspaceMetrics"}),lt=100;class ut{constructor(){m(this,"metrics",new Map);m(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>lt;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const dt=new ut,M=Y("AgentSend");function A(i){p.dispatch(i)}function Te(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mt(i){const s=Te(i)&&i.success===!0&&"data"in i?i.data:i;return!Te(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(tt)}async function Lt(i,s,e,t={}){const r=he.select(p.state,e.id);if(!r)return;const a=Ne(i,e.id),l=t.submission,c=!!l&&Le.select(p.state,l.scope)?.supported===!0,E=(o,R,g=!1)=>{l&&A(Be(l.scope,l.id,o,Date.now(),R,g))};let f=!1;const u=()=>(!l||f||ve.select(p.state,l))&&r===he.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let o=await p.dispatch(we(e.id,i));if(u()){if(!o)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));o={...o,isStreaming:o.isStreaming??!1};{if(o&&(o.status==="pending"||!o.id)&&!o.backendSessionId&&o.activationState!==H.ACTIVE&&o.activationState!==H.ACTIVATING){const h=e.id.startsWith("optimistic-"),C=e.worktreePath||e.repositoryPath||e.path;if(!h&&C){M.info("Activating pending session in sendMessage",{agentId:i,status:o.status,activationState:o.activationState,hasBackendSessionId:!!o.backendSessionId});const x=await p.dispatch(be(e.id,i));if(!u())return;x&&(o=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else o&&o.status==="pending"&&o.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:o.backendSessionId,activationState:o.activationState}),o={...o,status:Fe.Active,activationState:H.ACTIVE},A(de({...o,workspaceId:e.id})));if(!o)throw new Error(`Failed to get or create session for agent ${i}`);A(de({...o,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??oe(),k=t.messageMetadata?.[ge],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[ge]:k}:{}},N={id:me(le()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};c||(l&&(E("rejected"),f=!0),A(ke(o.id,N))),A(z(o.id,!0));let $=!1;try{c||await p.dispatch(Ge(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=me(`msg_${le()}`),C=oe(),x=async()=>st.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:o.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(_=>({type:_.type,mimeType:_.mimeType,dataLength:_.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(_=>({type:_.type,fileName:_.fileName,mimeType:_.mimeType,attachmentId:_.attachmentId,size:_.size}))||[]});const Oe=t.model??t.modelId??o.model??void 0;A(Pe(i));const ye=ce(i,e.id),ae=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await $e("agent.sendMessage",{agentId:i,...c&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Oe,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:C,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(_=>{if(u())throw _});if(u()){if(mt(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:o.id}),E("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const _=T.error,I=typeof _=="string"?_:_?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:o.id,queuedMessageId:T.queuedMessage?.id}),(!c||!l||!ue.select(p.state,l))&&A(z(o.id,!1)),c||A(xe(o.id,N.id)),c){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=Ee(s,t),X=K.select(p.state,i,e.id).find(ne=>ne.id===I.id||ne.turnId===L);A(fe(i,I.id,S,L,_e(X??I,S),!X&&!!l&&ue.select(p.state,l),ae))}E("accepted",I,!0),q(i,e.id);return}const _=T.queuedMessage;if(_){const I=T.turnId,G=typeof I=="string"?I:_.turnId;let L=_;if(u()&&ce(i,e.id)===ye){const S=K.select(p.state,i,e.id),X=Ye(S,_);A(Ve(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:_.id}),await q(i,e.id).catch(()=>{}),L=K.select(p.state,i,e.id).find(S=>S.id===_.id||S.turnId===G));if(u()&&typeof G=="string"){const S=Ee(s,t);A(fe(i,_.id,S,G,_e(L??_,S),!L,ae))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:_.id})}return}}c&&(E("accepted"),q(i,e.id),Ce(i,e.id)),dt.incrementMessageSent(e.id)}},"send message",{retries:c?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),re=c?await x().then(()=>({success:!0,error:void 0})):await ct.executeWithRecovery(x,Se.streaming,`send-message-${i}`);if(!re.success)throw re.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(z(o.id,!1)),!c&&t.messageMetadata&&A(Ue(o.id,N.id,{metadata:P})),c&&E($?"rejected":"uncertain"),h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Ct as a,J as c,Ye as r,Lt as s};
1
+ var Me=Object.defineProperty;var De=(i,s,e)=>s in i?Me(i,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[s]=e;var m=(i,s,e)=>De(i,typeof s!="symbol"?s+"":s,e);import{x as Ne,J as oe,Y as ce,ag as q,ao as Ce}from"./D7P2CXpO.js";import{bI as Le,cD as le,c4 as ue,c3 as ve}from"./t61BPD62.js";import{G2 as p,z4 as we,br as be,c as Fe,HZ as de,hA as me,bD as ke,AW as z,zs as Ge,eT as Pe,xE as xe,dP as Ee,eP as fe,dO as _e,y3 as Ve,HF as Ue,tU as Be}from"./C51KzdSG.js";import{aA as Ae,dz as he,A as H,P as ge,aw as K}from"./dimBDqRX.js";import{ax as $e}from"./DgFojmqv.js";import{c as Y}from"./ChTqQfQN.js";import{a as Xe}from"./BJzHxIyr.js";import{n as Q}from"./BjO6mATN.js";import"./B8o4lNgr.js";import{bo as n}from"./D4MoKNoK.js";import"./WVYGrHqE.js";import"./WZHg24tN.js";import"./De4WWpS0.js";import{R as Re}from"./CVBBsS8i.js";import{L as We}from"./D8dE5NKO.js";function Ye(i,s){return i.some(e=>e.id===s.id)?i.map(e=>e.id===s.id?{...s,...s.author==null&&e.author!==void 0?{author:e.author}:{}}:e):[...i,s]}const Z=typeof performance<"u"?performance:{now:()=>Date.now()},V=new Xe("PerformanceOptimizer"),w=class w{constructor(){m(this,"metricsBuffer");m(this,"metricsIndex",0);m(this,"metricsCount",0);m(this,"MAX_METRICS",500);m(this,"TARGET_RESPONSE_TIME",100);m(this,"memoCache",new Map);m(this,"MEMO_TTL",6e4);m(this,"MAX_CACHE_SIZE",100);m(this,"cacheHits",0);m(this,"cacheMisses",0);m(this,"pendingRequests",new Map);m(this,"requestQueue",[]);m(this,"cleanupInterval",null);this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.startCacheCleanup(),V.info("PerformanceOptimizer initialized")}static getInstance(){return w.instance||(w.instance=new w),w.instance}reset(){this.metricsBuffer=new Array(this.MAX_METRICS).fill(null),this.metricsIndex=0,this.metricsCount=0,this.memoCache.clear(),this.pendingRequests.clear(),this.requestQueue=[],this.cacheHits=0,this.cacheMisses=0}clearCache(){this.memoCache.clear(),this.cacheHits=0,this.cacheMisses=0}async processBatch(s,e,t={}){const{batchSize:r=10,concurrency:a=4}=t,l=[];for(let c=0;c<s.length;c+=r){const f=s.slice(c,c+r).map((o,R)=>{const g=Math.floor(R/a)*10;return new Promise(d=>{setTimeout(async()=>{const k=await e(o);d(k)},g)})}),u=await Promise.all(f);l.push(...u)}return l}startCacheCleanup(){this.cleanupInterval=setInterval(()=>{this.cleanupCache()},3e4)}stopCacheCleanup(){this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null)}cleanupCache(){const s=Date.now(),e=[];this.memoCache.forEach((t,r)=>{s-t.timestamp>this.MEMO_TTL&&e.push(r)}),e.forEach(t=>this.memoCache.delete(t)),this.memoCache.size>this.MAX_CACHE_SIZE&&Array.from(this.memoCache.entries()).sort((a,l)=>a[1].hits-l[1].hits||a[1].timestamp-l[1].timestamp).slice(0,this.memoCache.size-this.MAX_CACHE_SIZE).forEach(([a])=>this.memoCache.delete(a))}async track(s,e,t={}){const r=Z.now();try{const a=t.cacheKey||s;if(t.memoize){const f=this.getMemoized(a);if(f!==void 0)return this.cacheHits++,V.debug("Memoized result used",{operation:s,cacheKey:a,hits:this.cacheHits}),f;this.cacheMisses++}if(t.coalesce){const f=this.pendingRequests.get(s);if(f)return V.debug("Request coalesced",{operation:s}),f}let l;t.coalesce?(l=t.timeout?this.withTimeout(e(),t.timeout):e(),this.pendingRequests.set(s,l)):l=t.timeout?this.withTimeout(e(),t.timeout):e();const c=await l;t.memoize&&this.memoize(a,c);const E=Z.now()-r;return this.recordMetric(s,E,!0,{strategy:t.priority||"normal",memoized:t.memoize||!1,coalesced:t.coalesce||!1}),E>this.TARGET_RESPONSE_TIME&&V.warn("Operation exceeded target time",{operation:s,duration:Math.round(E),target:this.TARGET_RESPONSE_TIME}),c}catch(a){const l=Z.now()-r;throw this.recordMetric(s,l,!1,{error:a instanceof Error?a.message:"Unknown error"}),a}finally{t.coalesce&&this.pendingRequests.delete(s)}}getStats(){if(this.metricsCount===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const s=[],e=this.metricsCount<this.MAX_METRICS?0:this.metricsIndex;for(let u=0;u<this.metricsCount;u++){const o=this.metricsBuffer[(e+u)%this.MAX_METRICS];o&&s.push(o)}if(s.length===0)return{avgResponseTime:0,p95ResponseTime:0,p99ResponseTime:0,successRate:100,slowOperations:[]};const t=s.sort((u,o)=>u.duration-o.duration);let r=0,a=0;const l=new Set;for(const u of s)a+=u.duration,u.success&&r++,u.duration>this.TARGET_RESPONSE_TIME&&l.add(u.operation);const c=a/s.length,E=Math.floor(t.length*.95),f=Math.floor(t.length*.99);return{avgResponseTime:Math.round(c),p95ResponseTime:Math.round(t[E]?.duration||0),p99ResponseTime:Math.round(t[f]?.duration||0),successRate:r/s.length*100,slowOperations:Array.from(l)}}getCacheStats(){const s=this.cacheHits+this.cacheMisses;return{size:this.memoCache.size,hitRate:s>0?this.cacheHits/s*100:0,hits:this.cacheHits,misses:this.cacheMisses}}getMemoized(s){const e=this.memoCache.get(s);if(e){if(Date.now()-e.timestamp>this.MEMO_TTL){this.memoCache.delete(s);return}return e.hits++,e.value}}memoize(s,e){const t=JSON.stringify(e).length;this.memoCache.set(s,{value:e,timestamp:Date.now(),hits:0,size:t}),this.memoCache.size>this.MAX_CACHE_SIZE&&this.cleanupCache()}async withTimeout(s,e){return Promise.race([s,new Promise((t,r)=>setTimeout(()=>r(new Error(`Operation timed out after ${e}ms`)),e))])}recordMetric(s,e,t,r){this.metricsBuffer[this.metricsIndex]={operation:s,duration:e,timestamp:Date.now(),success:t,metadata:r},this.metricsIndex=(this.metricsIndex+1)%this.MAX_METRICS,this.metricsCount<this.MAX_METRICS&&this.metricsCount++,e>this.TARGET_RESPONSE_TIME&&V.warn("Slow operation detected",{operation:s,duration:`${e.toFixed(2)}ms`,target:`${this.TARGET_RESPONSE_TIME}ms`,metadata:r})}};m(w,"instance");let ee=w;const qe=ee.getInstance(),pe={AGENT_CREATION:"https://docs.example.com/agent-creation",STREAMING:"https://docs.example.com/streaming-issues",STORAGE:"https://docs.example.com/storage-troubleshooting",MEMORY:"https://docs.example.com/memory-management",PROVIDER:"https://docs.example.com/provider-setup",GENERAL:"https://docs.example.com/help"},j={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_template({agentName:"{agentName}",details:"{details}"})},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_template({agentName:"{agentName}"})},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_template({details:"{details}"})},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_template({details:"{details}"})},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_template({sessionId:"{sessionId}"})},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_template()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_template({details:"{details}"})},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_template({details:"{details}"})},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_template({timeout:"{timeout}"})},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_template({attempt:"{attempt}",maxAttempts:"{maxAttempts}"})},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_template({attempts:"{attempts}"})},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_template({details:"{details}"})},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_template({details:"{details}"})},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_template({maxLength:"{maxLength}",currentLength:"{currentLength}"})},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_template({provider:"{provider}"})},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_template({provider:"{provider}",details:"{details}"})},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_template({provider:"{provider}"})},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_template({details:"{details}"})},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_template({details:"{details}"})},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_template({lastBackup:"{lastBackup}"})},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_template({currentUsage:"{currentUsage}",limit:"{limit}"})},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_template({count:"{count}",window:"{window}"})},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_template({current:"{current}",max:"{max}"})}},ze={get AGENT_CREATION_FAILED(){return n.errors_catalog_agentCreationFailed_friendly()},get AGENT_ALREADY_EXISTS(){return n.errors_catalog_agentAlreadyExists_friendly()},get INVALID_AGENT_CONFIG(){return n.errors_catalog_invalidAgentConfig_friendly()},get INVALID_CONFIG(){return n.errors_catalog_invalidConfig_friendly()},get SESSION_NOT_FOUND(){return n.errors_catalog_sessionNotFound_friendly()},get SESSION_ALREADY_ACTIVE(){return n.errors_catalog_sessionAlreadyActive_friendly()},get SESSION_INITIALIZATION_FAILED(){return n.errors_catalog_sessionInitializationFailed_friendly()},get STREAM_CONNECTION_FAILED(){return n.errors_catalog_streamConnectionFailed_friendly()},get STREAM_TIMEOUT(){return n.errors_catalog_streamTimeout_friendly()},get STREAM_INTERRUPTED(){return n.errors_catalog_streamInterrupted_friendly()},get STREAM_RECOVERY_FAILED(){return n.errors_catalog_streamRecoveryFailed_friendly()},get MESSAGE_SEND_FAILED(){return n.errors_catalog_messageSendFailed_friendly()},get MESSAGE_VALIDATION_FAILED(){return n.errors_catalog_messageValidationFailed_friendly()},get MESSAGE_TOO_LONG(){return n.errors_catalog_messageTooLong_friendly()},get PROVIDER_NOT_FOUND(){return n.errors_catalog_providerNotFound_friendly()},get PROVIDER_CONNECTION_FAILED(){return n.errors_catalog_providerConnectionFailed_friendly()},get PROVIDER_PROCESS_DIED(){return n.errors_catalog_providerProcessDied_friendly()},get STORAGE_READ_FAILED(){return n.errors_catalog_storageReadFailed_friendly()},get STORAGE_WRITE_FAILED(){return n.errors_catalog_storageWriteFailed_friendly()},get STORAGE_CORRUPTED(){return n.errors_catalog_storageCorrupted_friendly()},get MEMORY_LIMIT_EXCEEDED(){return n.errors_catalog_memoryLimitExceeded_friendly()},get RATE_LIMIT_EXCEEDED(){return n.errors_catalog_rateLimitExceeded_friendly()},get CONCURRENT_LIMIT_EXCEEDED(){return n.errors_catalog_concurrentLimitExceeded_friendly()}};function He(i){return(i.match(/{(\w+)}/g)||[]).map(e=>e.slice(1,-1))}function Ke(i,s){return He(i).every(t=>t in s)}function Ie(i,s={}){return i.replace(/{(\w+)}/g,(e,t)=>String(s[t]??e))}function J(i){const s=n.errors_cleanMessage_fallback_error();if(!i)return s;let e=i;return e=e.replace(/^.*?failed(?:\s+to\s+.*?)?\s+after\s+\d+\s+attempts:\s*/i,""),e=e.replace(/^Error invoking remote method '[^']+':(\s*Error:)?\s*/i,""),e=e.replace(/^(Error:\s*)+/i,""),e=e.replace(/\n\s*at .+/g,""),e=e.replace(/\s+/g," ").trim(),e||s}function Qe(i,s){return s&&j[i]&&Ke(j[i],s)?Ie(j[i],s):ze[i]||n.errors_userFriendly_fallback_error()}function Ze(i){const e={AGENT_CREATION_FAILED:"AGENT_CREATION",AGENT_ALREADY_EXISTS:"AGENT_CREATION",INVALID_AGENT_CONFIG:"AGENT_CREATION",STREAM_CONNECTION_FAILED:"STREAMING",STREAM_TIMEOUT:"STREAMING",STREAM_INTERRUPTED:"STREAMING",STREAM_RECOVERY_FAILED:"STREAMING",STORAGE_READ_FAILED:"STORAGE",STORAGE_WRITE_FAILED:"STORAGE",STORAGE_CORRUPTED:"STORAGE",MEMORY_LIMIT_EXCEEDED:"MEMORY",RATE_LIMIT_EXCEEDED:"MEMORY",CONCURRENT_LIMIT_EXCEEDED:"MEMORY",PROVIDER_NOT_FOUND:"PROVIDER",PROVIDER_CONNECTION_FAILED:"PROVIDER",PROVIDER_PROCESS_DIED:"PROVIDER"}[i];return e?pe[e]:pe.GENERAL}const je={AGENT_CREATION_FAILED:[{action:"retry",description:"Try creating the agent again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify agent configuration in settings",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient memory and disk space",automatic:!1,priority:"medium"}],AGENT_ALREADY_EXISTS:[{action:"rename",description:"Choose a different name for the agent",automatic:!1,priority:"high"},{action:"delete-existing",description:"Delete the existing agent first",automatic:!1,priority:"medium"}],INVALID_AGENT_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],INVALID_CONFIG:[{action:"review-config",description:"Review and correct the configuration",automatic:!1,priority:"high"},{action:"use-defaults",description:"Reset to default configuration",automatic:!1,priority:"medium"}],SESSION_NOT_FOUND:[{action:"start-new",description:"Start a new agent session",automatic:!1,priority:"high"},{action:"check-history",description:"Check session history for recent sessions",automatic:!1,priority:"medium"}],SESSION_ALREADY_ACTIVE:[{action:"wait",description:"Wait for the current session to complete",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel the active session first",automatic:!1,priority:"high"}],SESSION_INITIALIZATION_FAILED:[{action:"retry",description:"Try initializing the session again",automatic:!1,priority:"high"},{action:"check-resources",description:"Ensure sufficient resources are available",automatic:!1,priority:"medium"}],MESSAGE_SEND_FAILED:[{action:"retry",description:"Try sending the message again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],MESSAGE_VALIDATION_FAILED:[{action:"review-config",description:"Review and correct the message format",automatic:!1,priority:"high"},{action:"check-config",description:"Check configuration for valid message format",automatic:!1,priority:"medium"}],MESSAGE_TOO_LONG:[{action:"retry",description:"Shorten the message and try again",automatic:!1,priority:"high"},{action:"batch",description:"Split the message into multiple parts",automatic:!1,priority:"medium"}],PROVIDER_NOT_FOUND:[{action:"check-config",description:"Verify provider is properly configured",automatic:!1,priority:"high"},{action:"recreate",description:"Install or reinstall the provider",automatic:!1,priority:"high"}],PROVIDER_CONNECTION_FAILED:[{action:"retry",description:"Try connecting to the provider again",automatic:!1,priority:"high"},{action:"check-config",description:"Verify provider configuration",automatic:!1,priority:"high"}],STORAGE_READ_FAILED:[{action:"retry",description:"Try reading the data again",automatic:!1,priority:"high"},{action:"restore",description:"Restore from a recent backup",automatic:!1,priority:"medium"}],STORAGE_WRITE_FAILED:[{action:"retry",description:"Try saving again",automatic:!1,priority:"high"},{action:"check-resources",description:"Check available disk space",automatic:!1,priority:"high"}],STREAM_CONNECTION_FAILED:[{action:"retry",description:"Try connecting again",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your network connection",automatic:!1,priority:"high"}],STREAM_RECOVERY_FAILED:[{action:"restart",description:"Restart the agent",automatic:!1,priority:"high"},{action:"check-config",description:"Check error logs for more details",automatic:!1,priority:"medium"}],STREAM_INTERRUPTED:[{action:"reconnect",description:"Attempting automatic reconnection",automatic:!0,priority:"high"},{action:"retry",description:"Retry sending the message",automatic:!1,priority:"high"},{action:"check-connection",description:"Check your internet connection",automatic:!1,priority:"medium"}],STREAM_TIMEOUT:[{action:"wait",description:"Wait for agent to complete processing",automatic:!1,priority:"high"},{action:"cancel",description:"Cancel current operation",automatic:!1,priority:"medium"},{action:"increase-timeout",description:"Increase timeout in settings",automatic:!1,priority:"low"}],PROVIDER_PROCESS_DIED:[{action:"restart",description:"Restart agent process",automatic:!0,priority:"high"},{action:"recreate",description:"Create new agent session",automatic:!1,priority:"high"}],STORAGE_CORRUPTED:[{action:"restore",description:"Restore from backup",automatic:!1,priority:"high"},{action:"reset",description:"Reset agent data",automatic:!1,priority:"medium"}],MEMORY_LIMIT_EXCEEDED:[{action:"cleanup",description:"Close unused agents",automatic:!1,priority:"high"},{action:"increase-limit",description:"Increase memory limit in settings",automatic:!1,priority:"medium"}],RATE_LIMIT_EXCEEDED:[{action:"wait",description:"Wait before making more requests",automatic:!1,priority:"high"},{action:"batch",description:"Batch requests together",automatic:!1,priority:"medium"}],CONCURRENT_LIMIT_EXCEEDED:[{action:"close-agents",description:"Close some running agents",automatic:!1,priority:"high"},{action:"queue",description:"Queue operation for later",automatic:!1,priority:"medium"}]};function Je(i){return je[i]||[{action:"retry",description:"Try the operation again",automatic:!1,priority:"high"}]}var D=(i=>(i.AGENT_CREATION_FAILED="AGENT_CREATION_FAILED",i.AGENT_ALREADY_EXISTS="AGENT_ALREADY_EXISTS",i.INVALID_AGENT_CONFIG="INVALID_AGENT_CONFIG",i.INVALID_CONFIG="INVALID_CONFIG",i.SESSION_NOT_FOUND="SESSION_NOT_FOUND",i.SESSION_ALREADY_ACTIVE="SESSION_ALREADY_ACTIVE",i.SESSION_INITIALIZATION_FAILED="SESSION_INITIALIZATION_FAILED",i.STREAM_CONNECTION_FAILED="STREAM_CONNECTION_FAILED",i.STREAM_TIMEOUT="STREAM_TIMEOUT",i.STREAM_INTERRUPTED="STREAM_INTERRUPTED",i.STREAM_RECOVERY_FAILED="STREAM_RECOVERY_FAILED",i.MESSAGE_SEND_FAILED="MESSAGE_SEND_FAILED",i.MESSAGE_VALIDATION_FAILED="MESSAGE_VALIDATION_FAILED",i.MESSAGE_TOO_LONG="MESSAGE_TOO_LONG",i.PROVIDER_NOT_FOUND="PROVIDER_NOT_FOUND",i.PROVIDER_CONNECTION_FAILED="PROVIDER_CONNECTION_FAILED",i.PROVIDER_PROCESS_DIED="PROVIDER_PROCESS_DIED",i.PROVIDER_UNAVAILABLE="PROVIDER_UNAVAILABLE",i.PROVIDER_ERROR="PROVIDER_ERROR",i.STORAGE_READ_FAILED="STORAGE_READ_FAILED",i.STORAGE_WRITE_FAILED="STORAGE_WRITE_FAILED",i.STORAGE_CORRUPTED="STORAGE_CORRUPTED",i.STORAGE_ERROR="STORAGE_ERROR",i.STORAGE_QUOTA_EXCEEDED="STORAGE_QUOTA_EXCEEDED",i.MEMORY_LIMIT_EXCEEDED="MEMORY_LIMIT_EXCEEDED",i.RATE_LIMIT_EXCEEDED="RATE_LIMIT_EXCEEDED",i.CONCURRENT_LIMIT_EXCEEDED="CONCURRENT_LIMIT_EXCEEDED",i.RESOURCE_NOT_FOUND="RESOURCE_NOT_FOUND",i.RESOURCE_EXHAUSTED="RESOURCE_EXHAUSTED",i.NETWORK_ERROR="NETWORK_ERROR",i.PERMISSION_DENIED="PERMISSION_DENIED",i.OPERATION_FAILED="OPERATION_FAILED",i.VALIDATION_ERROR="VALIDATION_ERROR",i.INVALID_RESPONSE="INVALID_RESPONSE",i.STATE_CORRUPTION="STATE_CORRUPTION",i.CONTEXT_OVERFLOW="CONTEXT_OVERFLOW",i))(D||{});class W extends Error{constructor(e,t,r={},a){super(e);m(this,"code");m(this,"context");m(this,"recoverySuggestions");m(this,"userMessage");m(this,"isRecoverable");m(this,"cause");this.name="AgentError",this.code=t,this.context={...r,timestamp:new Date,stackTrace:this.stack},this.userMessage=a?.userMessage||this.getDefaultUserMessage(t),this.recoverySuggestions=a?.recoverySuggestions||this.getDefaultRecoverySuggestions(t),this.isRecoverable=a?.isRecoverable??this.isErrorRecoverable(t),a?.cause&&(this.cause=a.cause)}getDefaultUserMessage(e){return Qe(e,this.context)}getDefaultRecoverySuggestions(e){return Je(e)}isErrorRecoverable(e){return["STREAM_INTERRUPTED","STREAM_TIMEOUT","MESSAGE_SEND_FAILED","PROVIDER_PROCESS_DIED","STORAGE_READ_FAILED","STORAGE_WRITE_FAILED"].includes(e)}getHelpLink(){return Ze(this.code)}formatMessage(e){return Ie(e,this.context)}toJSON(){return{name:this.name,code:this.code,message:this.message,userMessage:this.userMessage,context:this.context,recoverySuggestions:this.recoverySuggestions,isRecoverable:this.isRecoverable,helpLink:this.getHelpLink(),stack:this.stack}}}const et={NON_RETRYABLE_ERRORS:["EACCES","EPERM","ENOSPC","EMFILE","permission","memory","fatal","process died","not available on your current plan","agent binary","rate limit","too many requests","hit your limit","you've hit your limit","quota exceeded"]};function ie(i){const s=i.toLowerCase();for(const e of et.NON_RETRYABLE_ERRORS)if(s.includes(e.toLowerCase()))return!0;return!1}const tt="Agent already has an in-flight prompt. Message was not delivered.",v=Y("ErrorBoundary"),b=class b{constructor(){}static getInstance(){return b.instance||(b.instance=new b),b.instance}async wrap(s,e,t={}){const{retries:r=Re.DEFAULT_ATTEMPTS,retryDelay:a=Re.BASE_DELAY,exponentialBackoff:l=!0,notify:c=!1,notifyOnRetry:E=!1,context:f={},onError:u,onRetry:o,shouldRetry:R=this.defaultShouldRetry}=t;let g=null,d=0;for(d=1;d<=r+1;d++)try{v.debug(`[${e}] Attempt ${d}/${r+1}`);const h=await s();return d>1&&v.info(`[${e}] Succeeded after ${d} attempts`),h}catch(h){if(g=h,v.error(`[${e}] Attempt ${d} failed`,{error:g.message,attempt:d,maxAttempts:r+1,context:f}),u?.(g,d),d<=r&&R(g)){const C=l?a*Math.pow(2,d-1):a;E&&Q.warning(n.agent_errorBoundary_retrying_message({seconds:C/1e3})),o?.(d),v.info(`[${e}] Retrying in ${C}ms`),await this.sleep(C)}else break}const k=`${e} failed after ${d} attempt${d===1?"":"s"}: ${g?.message}`,P=J(g?.message||n.agent_errorBoundary_generic_error()),N=g?.message?.toLowerCase()||"",$=N.includes("no available models")||N.includes("all models exhausted")||N.includes("all models unavailable");throw c&&!$&&Q.error(P),new W(P,D.OPERATION_FAILED,{originalError:g?.message,detailedMessage:k,attempts:d,context:f})}async wrapVoid(s,e,t={}){await this.wrap(s,e,t)}wrapSync(s,e,t={}){try{return s()}catch(r){const a=r;throw v.error(`[${e}] Failed`,{error:a.message,context:t.context}),t.notify&&Q.error(J(a.message)),new W(J(a.message),D.OPERATION_FAILED,t.context)}}defaultShouldRetry(s){const e=s.message.toLowerCase();return ie(s.message)?!1:e.includes("network")||e.includes("timeout")?!0:s instanceof W?[D.NETWORK_ERROR,D.STREAM_TIMEOUT,D.STREAM_CONNECTION_FAILED,D.PROVIDER_CONNECTION_FAILED,D.PROVIDER_UNAVAILABLE].includes(s.code):!(e.includes("invalid")||e.includes("interrupted")||e.includes("cancel")||e.includes("not found")||e.includes("not available")||e.includes("404")||e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||e.includes("413")||e.includes("too long for the agent")||e.includes("request entity too large")||e.includes("payload too large")||e.includes("content too large")||e.includes("body too large")||e.includes("unauthorized")||e.includes("forbidden")||e.includes("401")||e.includes("403"))}sleep(s){return new Promise(e=>setTimeout(e,s))}async withTimeout(s,e,t){return Promise.race([s(),new Promise((r,a)=>setTimeout(()=>a(new W(`${t} timed out after ${e}ms`,D.STREAM_TIMEOUT)),e))])}async batchOperations(s,e,t={}){const{concurrency:r=5,continueOnError:a=!0,operationName:l="batch operation"}=t,c=[],E=[];for(let f=0;f<s.length;f+=r){const u=s.slice(f,f+r);(await Promise.allSettled(u.map(R=>e(R)))).forEach((R,g)=>{if(R.status==="fulfilled")c.push(R.value);else{const d=R.reason;if(E.push({item:u[g],error:d}),v.error(`[${l}] Batch item failed`,{item:u[g],error:d.message}),!a)throw d}})}return E.length>0&&v.warn(`[${l}] Completed with ${E.length} errors`),{results:c,errors:E}}};m(b,"instance");let te=b;const st=te.getInstance(),se=Y("browser/index"),F=new Map,B=new Map;let U;function it(i,s,e){for(const t of s)try{t(e)}catch(r){se.error("Error in agent subscriber callback",{agentId:i,error:r})}}function rt(){if(U)return;let i=!1;U=p.createSelector(e=>e.agentSessions)().subscribe(()=>{if(!i){i=!0;return}if(F.size===0)return;const e=p.state;for(const[t,r]of F){const a=Ae.select(e,t);B.get(t)!==a&&(B.set(t,a),it(t,r,a))}})}function at(){F.size>0||!U||(U(),U=void 0,B.clear())}function Ct(i,s,e){let t=F.get(i);const r=!t;t||(t=new Set,F.set(i,t)),t.add(s),rt();const a=p.state,l=Ae.select(a,i);return r&&B.set(i,l),l?se.debug("[subscribeToAgent] Initial callback data",{agentId:i,workspaceId:e??"current",hasSession:!0}):se.debug("[subscribeToAgent] No session found",{agentId:i,workspaceId:e??"current"}),s(l),()=>{const c=F.get(i);c&&(c.delete(s),c.size===0&&(F.delete(i),B.delete(i))),at()}}const y=Y("ErrorRecovery"),Se={network:{maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:1e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("network")||s.includes("fetch")||s.includes("connection")||s.includes("timeout")}},streaming:{maxRetries:5,initialBackoffMs:500,maxBackoffMs:5e3,backoffMultiplier:1.5,shouldRetry:(i,s)=>{if(s>=5)return!1;const e=i.message.toLowerCase();return e.includes("no available models")||e.includes("all models exhausted")||e.includes("all models unavailable")||ie(i.message)?!1:e.includes("stream")||e.includes("chunk")||e.includes("incomplete")}},persistence:{maxRetries:2,initialBackoffMs:100,maxBackoffMs:1e3,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("save")||s.includes("write")||s.includes("persist")}},rateLimit:{maxRetries:3,initialBackoffMs:5e3,maxBackoffMs:3e4,backoffMultiplier:2,shouldRetry:i=>{const s=i.message.toLowerCase();return s.includes("rate")||s.includes("limit")||s.includes("429")}}};class nt{constructor(){m(this,"listeners",new Map)}on(s,e){let t=this.listeners.get(s);t||(t=new Set,this.listeners.set(s,t)),t.add(e)}off(s,e){this.listeners.get(s)?.delete(e)}emit(s,...e){this.listeners.get(s)?.forEach(t=>{try{t(...e)}catch(r){y.error(`Error in event listener for ${s}:`,r)}})}removeAllListeners(){this.listeners.clear()}}class ot extends nt{constructor(){super(...arguments);m(this,"activeRecoveries",new Map);m(this,"recoveryStats",new Map)}async executeWithRecovery(e,t=Se.network,r){const a=Date.now(),l=new AbortController;r&&(this.cancelRecovery(r),this.activeRecoveries.set(r,l));let c,E=t.initialBackoffMs,f=0;for(let u=1;u<=t.maxRetries;u++){if(f=u,l.signal.aborted){y.info(`Recovery cancelled for operation ${r}`);break}try{y.debug(`Attempting operation (attempt ${u}/${t.maxRetries})`,{operationId:r});const o=await e();return this.updateStats(r,!0),this.emit("recovery:success",{operationId:r,attempt:u,duration:Date.now()-a}),r&&this.activeRecoveries.delete(r),{success:!0,data:o,attempts:u,totalTime:Date.now()-a}}catch(o){c=o,y.warn(`Operation failed (attempt ${u}/${t.maxRetries})`,{operationId:r,error:c.message});const R=c.message.toLowerCase();if(R.includes("interrupted")||R.includes("cancelled")||R.includes("canceled")){y.debug("User-initiated interruption/cancellation, not retrying",{operationId:r,error:c.message});break}if(R.includes("no available models")||R.includes("all models exhausted")||R.includes("all models unavailable")){y.debug("All models exhausted, not retrying",{operationId:r,error:c.message});break}if(ie(c.message)){y.debug("Fatal error detected, not retrying",{operationId:r,error:c.message});break}if(!t.shouldRetry(c,u)){y.debug("Error not retryable, stopping recovery",{operationId:r,error:c.message});break}if(u<t.maxRetries){const g=Math.random()*.2*E,d=Math.min(E+g,t.maxBackoffMs);t.onRetry?.(u,d),this.emit("recovery:retry",{operationId:r,attempt:u,delay:d,error:c.message}),await this.delay(d,l.signal),E=Math.min(E*t.backoffMultiplier,t.maxBackoffMs)}}}return this.updateStats(r,!1),t.onFailure?.(c,f),this.emit("recovery:failure",{operationId:r,attempts:f,duration:Date.now()-a,error:c?.message}),r&&this.activeRecoveries.delete(r),{success:!1,error:c,attempts:f,totalTime:Date.now()-a}}cancelRecovery(e){const t=this.activeRecoveries.get(e);t&&(t.abort(),this.activeRecoveries.delete(e),y.info(`Cancelled recovery for operation ${e}`))}cancelAllRecoveries(){for(const[e,t]of this.activeRecoveries)t.abort(),y.info(`Cancelled recovery for operation ${e}`);this.activeRecoveries.clear()}getStats(e){if(e)return this.recoveryStats.get(e)||{successes:0,failures:0};const t={};for(const[r,a]of this.recoveryStats)t[r]=a;return t}clearStats(e){e?this.recoveryStats.delete(e):this.recoveryStats.clear()}isRetryable(e,t){const r=e.message.toLowerCase();if(t)switch(t){case"NETWORK":return r.includes("network")||r.includes("fetch");case"TIMEOUT":return r.includes("timeout")||r.includes("timed out");case"RATE_LIMIT":return r.includes("rate")||r.includes("limit")||r.includes("429");case"TEMPORARY":return r.includes("temporary")||r.includes("transient");case"CONFLICT":return r.includes("conflict")||r.includes("concurrent");default:return!1}return this.isRetryable(e,"NETWORK")||this.isRetryable(e,"TIMEOUT")||this.isRetryable(e,"RATE_LIMIT")||this.isRetryable(e,"TEMPORARY")||this.isRetryable(e,"CONFLICT")}delay(e,t){return new Promise((r,a)=>{const l=setTimeout(r,e);if(t){const c=()=>{clearTimeout(l),a(new Error("Delay aborted"))};t.addEventListener("abort",c);const E=r;r=()=>{t.removeEventListener("abort",c),E()}}})}updateStats(e,t){if(!e)return;const r=this.recoveryStats.get(e)||{successes:0,failures:0};t?r.successes++:r.failures++,this.recoveryStats.set(e,r)}dispose(){this.cancelAllRecoveries(),this.recoveryStats.clear(),this.removeAllListeners()}}const ct=new ot,O=new We({category:"WorkspaceMetrics"}),lt=100;class ut{constructor(){m(this,"metrics",new Map);m(this,"operations",new Map)}startWorkspaceCreation(s){const e=Date.now();for(this.metrics.delete(s),this.metrics.set(s,{workspaceId:s,creationStarted:e});this.metrics.size>lt;){const t=this.metrics.keys().next().value;if(t===void 0)break;this.metrics.delete(t)}O.info("Started tracking workspace creation",{workspaceId:s})}recordMilestone(s,e){const t=this.metrics.get(s);if(!t){O.warn("No metrics found for workspace",{workspaceId:s,milestone:e});return}const r=Date.now();switch(e){case"optimisticNavigation":t.optimisticNavigation=r;break;case"realWorkspaceCreated":t.realWorkspaceCreated=r;break;case"agentCreated":t.agentCreated=r;break;case"agentReady":t.agentReady=r;break;case"firstMessageSent":t.firstMessageSent=r;break;case"firstResponseReceived":t.firstResponseReceived=r;break;case"firstChunkReceived":t.firstChunkReceived=r;break;case"totalDuration":t.totalDuration=r;break;case"workspaceId":case"creationStarted":O.warn("Cannot update milestone",{milestone:e});return}const a=r-t.creationStarted;O.info(`Milestone: ${e}`,{workspaceId:s,elapsed:`${a}ms`,timestamp:r}),e==="firstResponseReceived"&&(t.totalDuration=r-t.creationStarted,this.logSummary(s))}startOperation(s,e){this.operations.set(s,{startTime:Date.now(),metadata:e})}endOperation(s,e){const t=this.operations.get(s);if(!t)return O.warn("Operation not found",{operationId:s}),null;const r=Date.now();return t.endTime=r,t.duration=r-t.startTime,e&&(t.metadata={...t.metadata,...e}),O.info("Operation completed",{operationId:s,duration:`${t.duration}ms`,metadata:t.metadata}),this.operations.delete(s),t.duration}getMetrics(s){return this.metrics.get(s)}logSummary(s){const e=this.metrics.get(s);if(!e)return;const t={workspaceId:s,totalDuration:`${e.totalDuration}ms`,stages:{optimisticNavigation:e.optimisticNavigation?`${e.optimisticNavigation-e.creationStarted}ms`:"N/A",realWorkspaceCreation:e.realWorkspaceCreated?`${e.realWorkspaceCreated-e.creationStarted}ms`:"N/A",agentCreation:e.agentCreated?`${e.agentCreated-e.creationStarted}ms`:"N/A",agentReady:e.agentReady?`${e.agentReady-e.creationStarted}ms`:"N/A",firstMessage:e.firstMessageSent?`${e.firstMessageSent-e.creationStarted}ms`:"N/A",firstResponse:e.firstResponseReceived?`${e.firstResponseReceived-e.creationStarted}ms`:"N/A"}};O.info("=== Workspace Creation Metrics Summary ===",t),O.info("Workspace Creation Metrics:",t)}clearMetrics(s){this.metrics.delete(s)}incrementAgentCreated(s){const e=this.metrics.get(s);e&&(e.agentCreated=Date.now(),O.info("Agent created",{workspaceId:s}))}incrementMessageSent(s){const e=this.metrics.get(s);e&&!e.firstMessageSent&&(e.firstMessageSent=Date.now(),O.info("First message sent",{workspaceId:s}))}}const dt=new ut,M=Y("AgentSend");function A(i){p.dispatch(i)}function Te(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function mt(i){const s=Te(i)&&i.success===!0&&"data"in i?i.data:i;return!Te(s)||s.success!==!1?!1:typeof s.error=="string"&&s.error.includes(tt)}async function Lt(i,s,e,t={}){const r=he.select(p.state,e.id);if(!r)return;const a=Ne(i,e.id),l=t.submission,c=!!l&&Le.select(p.state,l.scope)?.supported===!0,E=(o,R,g=!1)=>{l&&A(Be(l.scope,l.id,o,Date.now(),R,g))};let f=!1;const u=()=>(!l||f||ve.select(p.state,l))&&r===he.select(p.state,e.id)&&a.isCurrent(p.state.agentSessions?.byAgentId[i]?.workspaceId);return qe.track(`sendMessage:${a.key}:${i}:${l?.id??"legacy"}`,async()=>{if(!u())return;M.debug(`Sending message to agent ${i}`,{contentLength:s.length,hasContextReferences:!!t.contextReferences?.length,model:t.model});let o=await p.dispatch(we(e.id,i));if(u()){if(!o)throw new Error(n.agent_streamLifecycle_sessionNotFound_error({agentId:i}));o={...o,isStreaming:o.isStreaming??!1};{if(o&&(o.status==="pending"||!o.id)&&!o.backendSessionId&&o.activationState!==H.ACTIVE&&o.activationState!==H.ACTIVATING){const h=e.id.startsWith("optimistic-"),C=e.worktreePath||e.repositoryPath||e.path;if(!h&&C){M.info("Activating pending session in sendMessage",{agentId:i,status:o.status,activationState:o.activationState,hasBackendSessionId:!!o.backendSessionId});const x=await p.dispatch(be(e.id,i));if(!u())return;x&&(o=x)}else throw M.warn("Cannot activate agent - workspace not ready",{agentId:i,workspaceId:e.id,isOptimistic:h,hasWorktreePath:!!e.worktreePath,hasRepositoryPath:!!e.repositoryPath,hasPath:!!e.path}),new Error(n.agent_streamLifecycle_spaceNotReady_error())}else o&&o.status==="pending"&&o.backendSessionId&&(M.info("Fixing status for already-activated session",{agentId:i,backendSessionId:o.backendSessionId,activationState:o.activationState}),o={...o,status:Fe.Active,activationState:H.ACTIVE},A(de({...o,workspaceId:e.id})));if(!o)throw new Error(`Failed to get or create session for agent ${i}`);A(de({...o,workspaceId:e.id}));const g=[{type:"text",text:s}];if(t.imageBlocks)for(const h of t.imageBlocks)g.push({type:"image",...h.data!==void 0?{data:h.data}:{},...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.attachmentId!==void 0?{attachmentId:h.attachmentId}:{}});if(t.fileBlocks)for(const h of t.fileBlocks)g.push({type:"file",attachmentId:h.attachmentId,fileName:h.fileName,...h.mimeType!==void 0?{mimeType:h.mimeType}:{},...h.size!==void 0?{size:h.size}:{}});const d=t.userAppMessageId??oe(),k=t.messageMetadata?.[ge],P={...t.contextReferences?.length?{contextReferences:t.contextReferences}:{},...k!==void 0?{[ge]:k}:{}},N={id:me(le()),appMessageId:d,role:"user",contentBlocks:g,timestamp:new Date().toISOString(),metadata:{...P,...t.messageMetadata??{}}};c||(l&&(E("rejected"),f=!0),A(ke(o.id,N))),A(z(o.id,!0));let $=!1;try{c||await p.dispatch(Ge(e.id,i,!0,{allowTruncation:t.resetHistory}));const h=me(`msg_${le()}`),C=oe(),x=async()=>st.wrap(async()=>{if(!u())return;M.info("Agent Service: Sending message to backend with image and file blocks",{agentId:i,sessionId:o.id,hasImageBlocks:!!t.imageBlocks,imageBlocksCount:t.imageBlocks?.length||0,imageBlockDetails:t.imageBlocks?.map(_=>({type:_.type,mimeType:_.mimeType,dataLength:_.data?.length||0}))||[],hasFileBlocks:!!t.fileBlocks,fileBlocksCount:t.fileBlocks?.length||0,fileBlockDetails:t.fileBlocks?.map(_=>({type:_.type,fileName:_.fileName,mimeType:_.mimeType,attachmentId:_.attachmentId,size:_.size}))||[]});const Oe=t.model??t.modelId??o.model??void 0;A(Pe(i));const ye=ce(i,e.id),ae=p.state.chatState?.byAgentId[i]?.attemptGeneration??0,T=await $e("agent.sendMessage",{agentId:i,...c&&l?{messageId:l.id}:{},workspaceId:e.id,content:s,model:Oe,contextReferences:t.contextReferences,imageBlocks:t.imageBlocks,fileBlocks:t.fileBlocks,noteIds:t.noteIds,stdinContext:t.stdinContext,assistantMessageId:h,userAppMessageId:d,assistantAppMessageId:C,priority:t.priority,...t.messageMetadata?{messageMetadata:t.messageMetadata}:{}}).catch(_=>{if(u())throw _});if(u()){if(mt(T)){M.info("Backend dropped duplicate in-flight prompt",{agentId:i,sessionId:o.id}),E("rejected");return}if(T&&typeof T=="object"&&"success"in T){if(!T.success){const _=T.error,I=typeof _=="string"?_:_?.message;throw $=!0,new Error(I||n.agent_streamLifecycle_sendToBackendFailed_error())}if("queued"in T&&T.queued===!0){if(M.info("sendMessage auto-queued by daemon (mid-turn or turn-startup race)",{agentId:i,sessionId:o.id,queuedMessageId:T.queuedMessage?.id}),(!c||!l||!ue.select(p.state,l))&&A(z(o.id,!1)),c||A(xe(o.id,N.id)),c){const I=T.queuedMessage,G=T.turnId,L=typeof G=="string"?G:I?.turnId;if(I&&typeof L=="string"){const S=Ee(s,t),X=K.select(p.state,i,e.id).find(ne=>ne.id===I.id||ne.turnId===L);A(fe(i,I.id,S,L,_e(X??I,S),!X&&!!l&&ue.select(p.state,l),ae))}E("accepted",I,!0),q(i,e.id);return}const _=T.queuedMessage;if(_){const I=T.turnId,G=typeof I=="string"?I:_.turnId;let L=_;if(u()&&ce(i,e.id)===ye){const S=K.select(p.state,i,e.id),X=Ye(S,_);A(Ve(i,X,e.id))}else u()&&(M.debug("queued-response queue seed superseded by an authoritative snapshot; reconciling via hydrate",{agentId:i,queuedMessageId:_.id}),await q(i,e.id).catch(()=>{}),L=K.select(p.state,i,e.id).find(S=>S.id===_.id||S.turnId===G));if(u()&&typeof G=="string"){const S=Ee(s,t);A(fe(i,_.id,S,G,_e(L??_,S),!L,ae))}else u()&&M.warn("auto-queued sendMessage response carried no turnId; retry record not parked",{agentId:i,queuedMessageId:_.id})}return}}c&&(E("accepted"),q(i,e.id),Ce(i,e.id)),dt.incrementMessageSent(e.id)}},"send message",{retries:c?0:2,notify:!1,context:{agentId:i,workspace:e.id}}),re=c?await x().then(()=>({success:!0,error:void 0})):await ct.executeWithRecovery(x,Se.streaming,`send-message-${i}`);if(!re.success)throw re.error||new Error(n.agent_streamLifecycle_sendFailed_error())}catch(h){if(!u())return;throw A(z(o.id,!1)),!c&&t.messageMetadata&&A(Ue(o.id,N.id,{metadata:P})),c&&E($?"rejected":"uncertain"),h}}}},{memoize:!1,coalesce:!0,priority:"high"})}export{Ct as a,J as c,Ye as r,Lt as s};
@@ -1 +1 @@
1
- import{t as Jt,bq as V,by as Qt,b as Xt,a_ as P,bu as J,bs as Ie,bo as i}from"./D4MoKNoK.js";import{bs as Yt,ay as yt,be as h,b$ as x,b_ as s,bO as o,W as n,bS as l,bl as B,bn as Zt,aA as W,a7 as Se,aD as t,c9 as f,aB as I,bo as we,bV as kt,br as Ge,ca as Bt,bH as q,bk as Le,a5 as E,bA as O}from"./B8o4lNgr.js";import{h as Ae,i as Pe,k as ze,d as De,I as Ht,s as Mt}from"./WVYGrHqE.js";import{c as Te}from"./BPQohPc9.js";import{f as z}from"./DgFojmqv.js";import"./BrXpFLv_.js";import{e as Fe,L as qt}from"./BQ-Vdhjp.js";import"./S9ot6IO_.js";import"./C_fEvnNK.js";import{k as Ue,G as Ee,N as Oe}from"./BMBobKUo.js";import{I as Kt}from"./CS1d84Cn.js";import"./WZHg24tN.js";import{G2 as K,f8 as Vt,v as Be,e0 as Wt,pg as He,sa as Me,FV as qe,n8 as Ke,h0 as Ve}from"./C51KzdSG.js";import{g as Nt,h as Rt,i as We,s as Ne,b as jt,d as Re,e as je,m as Je}from"./DQOyHGtr.js";var Qe=I('<!> <p class="type-body"> </p>',1);function Xe(it,m){if(new.target)return Jt({component:Xe,...it});Yt(m,!0);let D=V(m,"open",15,!1),H=V(m,"static",7,!1),st=V(m,"title",7),_=V(m,"message",7),k=V(m,"buttons",7),b=V(m,"cancelIndex",7,0),Q=V(m,"onSelect",7);function N(r){D(!1),Q()?.(r)}var vt={get open(){return D()},set open(r=!1){D(r),W()},get static(){return H()},set static(r=!1){H(r),W()},get title(){return st()},set title(r){st(r),W()},get message(){return _()},set message(r){_(r),W()},get buttons(){return k()},set buttons(r){k(r),W()},get cancelIndex(){return b()},set cancelIndex(r=0){b(r),W()},get onSelect(){return Q()},set onSelect(r){Q(r),W()},$set:Qt,$on:(r,M)=>Xt(m,r,M)};return Ue(it,{get static(){return H()},role:"alertdialog",get title(){return st()},dismissOnInteractOutside:!1,focusContent:!0,onSubmit:()=>N(k().length-1),onCancel:()=>N(b()),get open(){return D()},set open(M){D(M)},footer:M=>{var T=Se(),w=yt(T);Ae(w,17,k,Pe,(X,Y,R)=>{{let Z=f(()=>R===b()?"ghost":R===k().length-1?"primary":"outline");z(X,{get variant(){return t(Z)},onclick:()=>N(R),children:(ct,pt)=>{h();var ut=x();s(()=>o(ut,t(Y))),n(ct,ut)},$$slots:{default:!0}})}}),n(M,T)},children:(M,T)=>{var w=Qe(),X=yt(w);Te(X,()=>Fe,(Z,ct)=>{ct(Z,{class:"sr-only",children:(pt,ut)=>{h();var _t=x();s(()=>o(_t,_())),n(pt,_t)},$$slots:{default:!0}})});var Y=l(X,2),R=B(Y,!0);s(()=>o(R,_())),n(M,w)},$$slots:{footer:!0,default:!0}}),Zt(vt)}var Ye=I('<p class="text-sm text-subtle" role="status" data-testid="gitlab-instance-update-required"> </p>'),Ze=I('<p class="break-all type-caption text-subtle" data-testid="gitlab-connect-instance"> </p>'),ta=I('<div class="max-w-sm space-y-3" data-testid="gitlab-connect-device-flow"><!> <div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!> <!></div></div>'),ea=I('<div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!></div>'),aa=I('<p class="text-xs text-danger" role="alert"> </p>'),na=I('<div class="max-w-sm space-y-1" data-testid="gitlab-connect-token"><!> <!> <p class="text-xs text-subtle"> <!></p></div> <div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>',1),ra=I('<div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>'),sa=I('<div class="max-w-sm space-y-1"><!> <!> <p class="text-xs text-subtle"> </p> <!></div> <!>',1),oa=I('<p class="text-sm text-subtle" role="status"> </p>'),la=I('<div class="space-y-1"><p class="text-sm text-subtle" role="status"> </p> <!></div>'),ia=I('<p class="text-sm text-danger" role="alert"> </p>'),ca=I('<div data-testid="gitlab-connect-form"><!> <!> <!> <!> <!></div>');function ua(it,m){const D=we();if(new.target)return Jt({component:ua,...it});Yt(m,!0);const H=()=>J(ct,"$storedInstance$",r),st=()=>J(ee,"$deviceGrantSupported$",r),_=()=>J(ne,"$instanceSetupSupported$",r),k=()=>J(pt,"$isAuthenticating$",r),b=()=>J(ut,"$isCancelling$",r),Q=()=>J(te,"$deviceFlow$",r),N=()=>J(_t,"$cancelOutcome$",r),vt=()=>J(ae,"$error$",r),[r,M]=Ie();let T=V(m,"compact",7,!1),w=V(m,"onCancel",7);const X=`${D}-host`,Y=`${D}-host-help`,R=`${D}-host-error`,Z=`${D}-token`,ct=Nt(),pt=Rt(),ut=We(),_t=Ne(),te=jt(),ee=Re(),ae=je(),ne=Je();let bt=kt(Ge(Nt.select(K.state))),St=kt(!1),tt=kt(""),gt=kt(!1);const p=f(()=>Me(t(bt))),wt=f(()=>t(gt)||t(p)===H()&&st()===!1),Ct=f(()=>t(p)?Ke(t(p)):null),re=f(()=>_()&&t(p)!==null&&t(tt).trim().length>0);Bt(()=>{const c=H();t(St)||q(bt,c,!0)}),Bt(()=>{_()||q(tt,"")}),Le(()=>{const c=()=>{const e=K.state;Rt.select(e)&&jt.select(e)&&K.dispatch(Vt())};return window.addEventListener("focus",c),()=>window.removeEventListener("focus",c)});function Gt(){!_()||!t(p)||t(p)===H()||k()||b()||K.dispatch(He(t(p)))}function se(){q(St,!0),q(tt,"")}function Lt(){!_()||!t(p)||k()||b()||K.dispatch(qe(t(p)))}function At(){const c=t(tt).trim();!_()||!c||!t(p)||k()||b()||(K.dispatch(Ve(t(p),c)),q(tt,""))}function Pt(){!_()||b()||(k()&&K.dispatch(Wt()),q(gt,!0))}function oe(){q(gt,!1)}function le(){b()||K.dispatch(Wt())}function ie(){t(Ct)&&Oe(t(Ct),{})}function ce(c){c.key==="Enter"&&(c.preventDefault(),Gt(),t(wt)?document.getElementById(Z)?.focus():Lt())}function ue(c){c.key==="Enter"&&(c.preventDefault(),At())}const zt=f(()=>T()?"sm":"xl"),ft=f(()=>T()?"sm":"default");var de={get compact(){return T()},set compact(c=!1){T(c),W()},get onCancel(){return w()},set onCancel(c){w(c),W()},$set:Qt,$on:(c,e)=>Xt(m,c,e)},$t=ca();{const c=e=>{z(e,{variant:"ghost",size:"sm",type:"button",class:"text-muted-foreground hover:text-foreground",get disabled(){return b()},onclick:le,children:(a,u)=>{h();var g=x();s(G=>o(g,G),[()=>b()?i.lib_gitlabConnect_cancelling_label():i.lib_gitlabConnect_cancel_label()]),n(a,g)},$$slots:{default:!0}})};var Dt=E($t);{var ve=e=>{var a=Ye(),u=B(a,!0);s(g=>o(u,g),[()=>i.lib_gitlabConnect_updateRequired_description()]),n(e,a)};P(Dt,e=>{_()||e(ve)})}var Tt=l(Dt,2);{var pe=e=>{var a=Ze(),u=B(a,!0);s(()=>o(u,H())),n(e,a)};P(Tt,e=>{(k()||b())&&e(pe)})}var Ft=l(Tt,2);{var _e=e=>{var a=ta(),u=E(a);{let at=f(()=>i.lib_gitlabConnect_openGitlab_label());Ee(u,{get userCode(){return Q().userCode},get verificationUri(){return Q().verificationUri},get openLabel(){return t(at)},get compact(){return T()}})}var g=l(u,2),G=E(g);Ht(G,{size:16,class:"shrink-0"});var S=l(G,2),ot=B(S,!0),et=l(S,2);{let at=f(()=>b()||!_());z(et,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return t(at)},onclick:Pt,children:(It,Et)=>{h();var d=x();s($=>o(d,$),[()=>i.lib_gitlabConnect_useToken_label()]),n(It,d)},$$slots:{default:!0}})}var dt=l(et,2);c(dt),O(g),O(a),s(at=>o(ot,at),[()=>i.lib_gitlabConnect_waitingForAuthorization_label()]),n(e,a)},be=e=>{var a=ea(),u=E(a);Ht(u,{size:16,class:"shrink-0"});var g=l(u,2),G=B(g,!0),S=l(g,2);c(S),O(a),s(ot=>o(G,ot),[()=>i.lib_gitlabConnect_connecting_label()]),n(e,a)},ge=e=>{var a=sa(),u=yt(a),g=E(u);qt(g,{get for(){return X},children:(d,$)=>{h();var y=x();s(L=>o(y,L),[()=>i.lib_gitlabConnect_host_label()]),n(d,y)},$$slots:{default:!0}});var G=l(g,2);{let d=f(()=>!_()),$=f(()=>!t(p)||void 0),y=f(()=>t(p)?Y:`${Y} ${R}`);Kt(G,{get id(){return X},type:"text",autocomplete:"url",spellcheck:!1,get disabled(){return t(d)},get"aria-invalid"(){return t($)},get"aria-describedby"(){return t(y)},get placeholder(){return Be},oninput:se,onchange:Gt,onkeydown:ce,get value(){return t(bt)},set value(L){q(bt,L,!0)}})}var S=l(G,2),ot=B(S,!0),et=l(S,2);{var dt=d=>{var $=aa(),y=B($,!0);s(L=>{Mt($,"id",R),o(y,L)},[()=>i.lib_gitlabConnect_invalidInstance_error()]),n(d,$)};P(et,d=>{t(p)||d(dt)})}O(u);var at=l(u,2);{var It=d=>{var $=na(),y=yt($),L=E(y);qt(L,{get for(){return Z},children:(v,U)=>{h();var lt=x();s(C=>o(lt,C),[()=>i.lib_gitlabConnect_token_label()]),n(v,lt)},$$slots:{default:!0}});var mt=l(L,2);{let v=f(()=>!_());Kt(mt,{get id(){return Z},type:"password",autocomplete:"off",get disabled(){return t(v)},placeholder:"glpat-...",onkeydown:ue,get value(){return t(tt)},set value(U){q(tt,U,!0)}})}var ht=l(mt,2),F=E(ht),nt=l(F);{var xt=v=>{z(v,{variant:"link",size:"sm",type:"button",class:"h-auto px-0 text-xs",onclick:ie,children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_createToken_label({host:t(p)})]),n(U,C)},$$slots:{default:!0}})};P(nt,v=>{t(Ct)&&t(p)&&v(xt)})}O(ht),O(y);var A=l(y,2),j=E(A);{let v=f(()=>!t(re));z(j,{variant:"primary",get size(){return t(zt)},type:"button",onclick:At,get disabled(){return t(v)},children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_connect_label()]),n(U,C)},$$slots:{default:!0}})}var Ot=l(j,2);{var ke=v=>{z(v,{variant:"ghost",get size(){return t(ft)},type:"button",onclick:oe,children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_useDevice_label()]),n(U,C)},$$slots:{default:!0}})};P(Ot,v=>{t(gt)&&!(t(p)===H()&&st()===!1)&&v(ke)})}var ye=l(Ot,2);{var Ce=v=>{z(v,{variant:"ghost",get size(){return t(ft)},type:"button",get onclick(){return w()},children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_cancel_label()]),n(U,C)},$$slots:{default:!0}})};P(ye,v=>{w()&&v(Ce)})}O(A),s(v=>o(F,`${v??""} `),[()=>i.lib_gitlabConnect_token_description()]),n(d,$)},Et=d=>{var $=ra(),y=E($);{let F=f(()=>!t(p)||!_());z(y,{variant:"primary",get size(){return t(zt)},type:"button",onclick:Lt,get disabled(){return t(F)},children:(nt,xt)=>{h();var A=x();s(j=>o(A,j),[()=>i.lib_gitlabConnect_connect_label()]),n(nt,A)},$$slots:{default:!0}})}var L=l(y,2);{let F=f(()=>!_());z(L,{variant:"ghost",get size(){return t(ft)},type:"button",get disabled(){return t(F)},onclick:Pt,children:(nt,xt)=>{h();var A=x();s(j=>o(A,j),[()=>i.lib_gitlabConnect_useToken_label()]),n(nt,A)},$$slots:{default:!0}})}var mt=l(L,2);{var ht=F=>{z(F,{variant:"ghost",get size(){return t(ft)},type:"button",get onclick(){return w()},children:(nt,xt)=>{h();var A=x();s(j=>o(A,j),[()=>i.lib_gitlabConnect_cancel_label()]),n(nt,A)},$$slots:{default:!0}})};P(mt,F=>{w()&&F(ht)})}O($),n(d,$)};P(at,d=>{t(wt)?d(It):d(Et,-1)})}s(d=>{Mt(S,"id",Y),o(ot,d)},[()=>i.lib_gitlabConnect_host_description()]),n(e,a)};P(Ft,e=>{(k()||b())&&Q()?e(_e):k()||b()?e(be,1):e(ge,-1)})}var Ut=l(Ft,2);{var fe=e=>{var a=oa(),u=B(a,!0);s(g=>o(u,g),[()=>i.lib_gitlabConnect_cancelled_label()]),n(e,a)},$e=e=>{var a=la(),u=E(a),g=B(u,!0),G=l(u,2);z(G,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return b()},onclick:()=>K.dispatch(Vt()),children:(S,ot)=>{h();var et=x();s(dt=>o(et,dt),[()=>i.lib_gitlabConnect_checkStatus_label()]),n(S,et)},$$slots:{default:!0}}),O(a),s(S=>o(g,S),[()=>N()==="already-started"?i.lib_gitlabConnect_alreadyStarted_description():i.lib_gitlabConnect_cancelFailed_description()]),n(e,a)};P(Ut,e=>{N()==="cancelled"?e(fe):(N()==="already-started"||N()==="failed")&&e($e,1)})}var me=l(Ut,2);{var he=e=>{var a=ia(),u=B(a,!0);s(()=>o(u,vt())),n(e,a)};P(me,e=>{vt()&&e(he)})}O($t)}s(()=>ze($t,1,De(T()?"space-y-2":"space-y-4"))),n(it,$t);var xe=Zt(de);return M(),xe}export{ua as G,Xe as M};
1
+ import{t as Jt,bq as V,by as Qt,b as Xt,a_ as P,bu as J,bs as Ie,bo as i}from"./D4MoKNoK.js";import{bs as Yt,ay as yt,be as h,b$ as x,b_ as s,bO as o,W as n,bS as l,bl as B,bn as Zt,aA as W,a7 as Se,aD as t,c9 as f,aB as I,bo as we,bV as kt,br as Ge,ca as Bt,bH as q,bk as Le,a5 as E,bA as O}from"./B8o4lNgr.js";import{h as Ae,i as Pe,k as ze,d as De,I as Ht,s as Mt}from"./WVYGrHqE.js";import{c as Te}from"./BPQohPc9.js";import{f as z}from"./DgFojmqv.js";import"./BrXpFLv_.js";import{e as Fe,L as qt}from"./BQ-Vdhjp.js";import"./S9ot6IO_.js";import"./C_fEvnNK.js";import{k as Ue,G as Ee,N as Oe}from"./Dbuv3b_7.js";import{I as Kt}from"./CS1d84Cn.js";import"./WZHg24tN.js";import{G2 as K,f8 as Vt,v as Be,e0 as Wt,pg as He,sa as Me,FV as qe,n8 as Ke,h0 as Ve}from"./C51KzdSG.js";import{g as Nt,h as Rt,i as We,s as Ne,b as jt,d as Re,e as je,m as Je}from"./DQOyHGtr.js";var Qe=I('<!> <p class="type-body"> </p>',1);function Xe(it,m){if(new.target)return Jt({component:Xe,...it});Yt(m,!0);let D=V(m,"open",15,!1),H=V(m,"static",7,!1),st=V(m,"title",7),_=V(m,"message",7),k=V(m,"buttons",7),b=V(m,"cancelIndex",7,0),Q=V(m,"onSelect",7);function N(r){D(!1),Q()?.(r)}var vt={get open(){return D()},set open(r=!1){D(r),W()},get static(){return H()},set static(r=!1){H(r),W()},get title(){return st()},set title(r){st(r),W()},get message(){return _()},set message(r){_(r),W()},get buttons(){return k()},set buttons(r){k(r),W()},get cancelIndex(){return b()},set cancelIndex(r=0){b(r),W()},get onSelect(){return Q()},set onSelect(r){Q(r),W()},$set:Qt,$on:(r,M)=>Xt(m,r,M)};return Ue(it,{get static(){return H()},role:"alertdialog",get title(){return st()},dismissOnInteractOutside:!1,focusContent:!0,onSubmit:()=>N(k().length-1),onCancel:()=>N(b()),get open(){return D()},set open(M){D(M)},footer:M=>{var T=Se(),w=yt(T);Ae(w,17,k,Pe,(X,Y,R)=>{{let Z=f(()=>R===b()?"ghost":R===k().length-1?"primary":"outline");z(X,{get variant(){return t(Z)},onclick:()=>N(R),children:(ct,pt)=>{h();var ut=x();s(()=>o(ut,t(Y))),n(ct,ut)},$$slots:{default:!0}})}}),n(M,T)},children:(M,T)=>{var w=Qe(),X=yt(w);Te(X,()=>Fe,(Z,ct)=>{ct(Z,{class:"sr-only",children:(pt,ut)=>{h();var _t=x();s(()=>o(_t,_())),n(pt,_t)},$$slots:{default:!0}})});var Y=l(X,2),R=B(Y,!0);s(()=>o(R,_())),n(M,w)},$$slots:{footer:!0,default:!0}}),Zt(vt)}var Ye=I('<p class="text-sm text-subtle" role="status" data-testid="gitlab-instance-update-required"> </p>'),Ze=I('<p class="break-all type-caption text-subtle" data-testid="gitlab-connect-instance"> </p>'),ta=I('<div class="max-w-sm space-y-3" data-testid="gitlab-connect-device-flow"><!> <div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!> <!></div></div>'),ea=I('<div class="flex flex-wrap items-center gap-2 text-subtle text-sm"><!> <span> </span> <!></div>'),aa=I('<p class="text-xs text-danger" role="alert"> </p>'),na=I('<div class="max-w-sm space-y-1" data-testid="gitlab-connect-token"><!> <!> <p class="text-xs text-subtle"> <!></p></div> <div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>',1),ra=I('<div class="flex flex-wrap items-center gap-2"><!> <!> <!></div>'),sa=I('<div class="max-w-sm space-y-1"><!> <!> <p class="text-xs text-subtle"> </p> <!></div> <!>',1),oa=I('<p class="text-sm text-subtle" role="status"> </p>'),la=I('<div class="space-y-1"><p class="text-sm text-subtle" role="status"> </p> <!></div>'),ia=I('<p class="text-sm text-danger" role="alert"> </p>'),ca=I('<div data-testid="gitlab-connect-form"><!> <!> <!> <!> <!></div>');function ua(it,m){const D=we();if(new.target)return Jt({component:ua,...it});Yt(m,!0);const H=()=>J(ct,"$storedInstance$",r),st=()=>J(ee,"$deviceGrantSupported$",r),_=()=>J(ne,"$instanceSetupSupported$",r),k=()=>J(pt,"$isAuthenticating$",r),b=()=>J(ut,"$isCancelling$",r),Q=()=>J(te,"$deviceFlow$",r),N=()=>J(_t,"$cancelOutcome$",r),vt=()=>J(ae,"$error$",r),[r,M]=Ie();let T=V(m,"compact",7,!1),w=V(m,"onCancel",7);const X=`${D}-host`,Y=`${D}-host-help`,R=`${D}-host-error`,Z=`${D}-token`,ct=Nt(),pt=Rt(),ut=We(),_t=Ne(),te=jt(),ee=Re(),ae=je(),ne=Je();let bt=kt(Ge(Nt.select(K.state))),St=kt(!1),tt=kt(""),gt=kt(!1);const p=f(()=>Me(t(bt))),wt=f(()=>t(gt)||t(p)===H()&&st()===!1),Ct=f(()=>t(p)?Ke(t(p)):null),re=f(()=>_()&&t(p)!==null&&t(tt).trim().length>0);Bt(()=>{const c=H();t(St)||q(bt,c,!0)}),Bt(()=>{_()||q(tt,"")}),Le(()=>{const c=()=>{const e=K.state;Rt.select(e)&&jt.select(e)&&K.dispatch(Vt())};return window.addEventListener("focus",c),()=>window.removeEventListener("focus",c)});function Gt(){!_()||!t(p)||t(p)===H()||k()||b()||K.dispatch(He(t(p)))}function se(){q(St,!0),q(tt,"")}function Lt(){!_()||!t(p)||k()||b()||K.dispatch(qe(t(p)))}function At(){const c=t(tt).trim();!_()||!c||!t(p)||k()||b()||(K.dispatch(Ve(t(p),c)),q(tt,""))}function Pt(){!_()||b()||(k()&&K.dispatch(Wt()),q(gt,!0))}function oe(){q(gt,!1)}function le(){b()||K.dispatch(Wt())}function ie(){t(Ct)&&Oe(t(Ct),{})}function ce(c){c.key==="Enter"&&(c.preventDefault(),Gt(),t(wt)?document.getElementById(Z)?.focus():Lt())}function ue(c){c.key==="Enter"&&(c.preventDefault(),At())}const zt=f(()=>T()?"sm":"xl"),ft=f(()=>T()?"sm":"default");var de={get compact(){return T()},set compact(c=!1){T(c),W()},get onCancel(){return w()},set onCancel(c){w(c),W()},$set:Qt,$on:(c,e)=>Xt(m,c,e)},$t=ca();{const c=e=>{z(e,{variant:"ghost",size:"sm",type:"button",class:"text-muted-foreground hover:text-foreground",get disabled(){return b()},onclick:le,children:(a,u)=>{h();var g=x();s(G=>o(g,G),[()=>b()?i.lib_gitlabConnect_cancelling_label():i.lib_gitlabConnect_cancel_label()]),n(a,g)},$$slots:{default:!0}})};var Dt=E($t);{var ve=e=>{var a=Ye(),u=B(a,!0);s(g=>o(u,g),[()=>i.lib_gitlabConnect_updateRequired_description()]),n(e,a)};P(Dt,e=>{_()||e(ve)})}var Tt=l(Dt,2);{var pe=e=>{var a=Ze(),u=B(a,!0);s(()=>o(u,H())),n(e,a)};P(Tt,e=>{(k()||b())&&e(pe)})}var Ft=l(Tt,2);{var _e=e=>{var a=ta(),u=E(a);{let at=f(()=>i.lib_gitlabConnect_openGitlab_label());Ee(u,{get userCode(){return Q().userCode},get verificationUri(){return Q().verificationUri},get openLabel(){return t(at)},get compact(){return T()}})}var g=l(u,2),G=E(g);Ht(G,{size:16,class:"shrink-0"});var S=l(G,2),ot=B(S,!0),et=l(S,2);{let at=f(()=>b()||!_());z(et,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return t(at)},onclick:Pt,children:(It,Et)=>{h();var d=x();s($=>o(d,$),[()=>i.lib_gitlabConnect_useToken_label()]),n(It,d)},$$slots:{default:!0}})}var dt=l(et,2);c(dt),O(g),O(a),s(at=>o(ot,at),[()=>i.lib_gitlabConnect_waitingForAuthorization_label()]),n(e,a)},be=e=>{var a=ea(),u=E(a);Ht(u,{size:16,class:"shrink-0"});var g=l(u,2),G=B(g,!0),S=l(g,2);c(S),O(a),s(ot=>o(G,ot),[()=>i.lib_gitlabConnect_connecting_label()]),n(e,a)},ge=e=>{var a=sa(),u=yt(a),g=E(u);qt(g,{get for(){return X},children:(d,$)=>{h();var y=x();s(L=>o(y,L),[()=>i.lib_gitlabConnect_host_label()]),n(d,y)},$$slots:{default:!0}});var G=l(g,2);{let d=f(()=>!_()),$=f(()=>!t(p)||void 0),y=f(()=>t(p)?Y:`${Y} ${R}`);Kt(G,{get id(){return X},type:"text",autocomplete:"url",spellcheck:!1,get disabled(){return t(d)},get"aria-invalid"(){return t($)},get"aria-describedby"(){return t(y)},get placeholder(){return Be},oninput:se,onchange:Gt,onkeydown:ce,get value(){return t(bt)},set value(L){q(bt,L,!0)}})}var S=l(G,2),ot=B(S,!0),et=l(S,2);{var dt=d=>{var $=aa(),y=B($,!0);s(L=>{Mt($,"id",R),o(y,L)},[()=>i.lib_gitlabConnect_invalidInstance_error()]),n(d,$)};P(et,d=>{t(p)||d(dt)})}O(u);var at=l(u,2);{var It=d=>{var $=na(),y=yt($),L=E(y);qt(L,{get for(){return Z},children:(v,U)=>{h();var lt=x();s(C=>o(lt,C),[()=>i.lib_gitlabConnect_token_label()]),n(v,lt)},$$slots:{default:!0}});var mt=l(L,2);{let v=f(()=>!_());Kt(mt,{get id(){return Z},type:"password",autocomplete:"off",get disabled(){return t(v)},placeholder:"glpat-...",onkeydown:ue,get value(){return t(tt)},set value(U){q(tt,U,!0)}})}var ht=l(mt,2),F=E(ht),nt=l(F);{var xt=v=>{z(v,{variant:"link",size:"sm",type:"button",class:"h-auto px-0 text-xs",onclick:ie,children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_createToken_label({host:t(p)})]),n(U,C)},$$slots:{default:!0}})};P(nt,v=>{t(Ct)&&t(p)&&v(xt)})}O(ht),O(y);var A=l(y,2),j=E(A);{let v=f(()=>!t(re));z(j,{variant:"primary",get size(){return t(zt)},type:"button",onclick:At,get disabled(){return t(v)},children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_connect_label()]),n(U,C)},$$slots:{default:!0}})}var Ot=l(j,2);{var ke=v=>{z(v,{variant:"ghost",get size(){return t(ft)},type:"button",onclick:oe,children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_useDevice_label()]),n(U,C)},$$slots:{default:!0}})};P(Ot,v=>{t(gt)&&!(t(p)===H()&&st()===!1)&&v(ke)})}var ye=l(Ot,2);{var Ce=v=>{z(v,{variant:"ghost",get size(){return t(ft)},type:"button",get onclick(){return w()},children:(U,lt)=>{h();var C=x();s(rt=>o(C,rt),[()=>i.lib_gitlabConnect_cancel_label()]),n(U,C)},$$slots:{default:!0}})};P(ye,v=>{w()&&v(Ce)})}O(A),s(v=>o(F,`${v??""} `),[()=>i.lib_gitlabConnect_token_description()]),n(d,$)},Et=d=>{var $=ra(),y=E($);{let F=f(()=>!t(p)||!_());z(y,{variant:"primary",get size(){return t(zt)},type:"button",onclick:Lt,get disabled(){return t(F)},children:(nt,xt)=>{h();var A=x();s(j=>o(A,j),[()=>i.lib_gitlabConnect_connect_label()]),n(nt,A)},$$slots:{default:!0}})}var L=l(y,2);{let F=f(()=>!_());z(L,{variant:"ghost",get size(){return t(ft)},type:"button",get disabled(){return t(F)},onclick:Pt,children:(nt,xt)=>{h();var A=x();s(j=>o(A,j),[()=>i.lib_gitlabConnect_useToken_label()]),n(nt,A)},$$slots:{default:!0}})}var mt=l(L,2);{var ht=F=>{z(F,{variant:"ghost",get size(){return t(ft)},type:"button",get onclick(){return w()},children:(nt,xt)=>{h();var A=x();s(j=>o(A,j),[()=>i.lib_gitlabConnect_cancel_label()]),n(nt,A)},$$slots:{default:!0}})};P(mt,F=>{w()&&F(ht)})}O($),n(d,$)};P(at,d=>{t(wt)?d(It):d(Et,-1)})}s(d=>{Mt(S,"id",Y),o(ot,d)},[()=>i.lib_gitlabConnect_host_description()]),n(e,a)};P(Ft,e=>{(k()||b())&&Q()?e(_e):k()||b()?e(be,1):e(ge,-1)})}var Ut=l(Ft,2);{var fe=e=>{var a=oa(),u=B(a,!0);s(g=>o(u,g),[()=>i.lib_gitlabConnect_cancelled_label()]),n(e,a)},$e=e=>{var a=la(),u=E(a),g=B(u,!0),G=l(u,2);z(G,{variant:"link",size:"sm",type:"button",class:"px-0",get disabled(){return b()},onclick:()=>K.dispatch(Vt()),children:(S,ot)=>{h();var et=x();s(dt=>o(et,dt),[()=>i.lib_gitlabConnect_checkStatus_label()]),n(S,et)},$$slots:{default:!0}}),O(a),s(S=>o(g,S),[()=>N()==="already-started"?i.lib_gitlabConnect_alreadyStarted_description():i.lib_gitlabConnect_cancelFailed_description()]),n(e,a)};P(Ut,e=>{N()==="cancelled"?e(fe):(N()==="already-started"||N()==="failed")&&e($e,1)})}var me=l(Ut,2);{var he=e=>{var a=ia(),u=B(a,!0);s(()=>o(u,vt())),n(e,a)};P(me,e=>{vt()&&e(he)})}O($t)}s(()=>ze($t,1,De(T()?"space-y-2":"space-y-4"))),n(it,$t);var xe=Zt(de);return M(),xe}export{ua as G,Xe as M};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/CX89Aogf.js","/app/immutable/chunks/CVBBsS8i.js","/app/immutable/chunks/CjSUqH7t.js","/app/immutable/chunks/B8o4lNgr.js","/app/immutable/chunks/C51KzdSG.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/DVkfuwKw.js","/app/immutable/chunks/CpHIRYx9.js","/app/immutable/chunks/WZHg24tN.js","/app/immutable/chunks/D4MoKNoK.js","/app/immutable/chunks/HfuFYz2u.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/Sk9pLJI5.js","/app/immutable/chunks/DgFojmqv.js","/app/immutable/chunks/WVYGrHqE.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/D2g8BuR1.js","/app/immutable/chunks/BPQohPc9.js","/app/immutable/chunks/D0pR1-a6.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/DzMB8eQW.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/dimBDqRX.js","/app/immutable/chunks/CG5J-qd_.js","/app/immutable/chunks/B9YdV5Lr.js","/app/immutable/chunks/C8yAGnZY.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/CQMmROUx.js","/app/immutable/chunks/CBF5TBJQ.js"])))=>i.map(i=>d[i]);
2
- import{bo as c,_ as p}from"./D4MoKNoK.js";import{n as w}from"./BjO6mATN.js";import"./B8o4lNgr.js";import"./WVYGrHqE.js";import"./WZHg24tN.js";import{bw as A}from"./DgFojmqv.js";import"./ChTqQfQN.js";import"./De4WWpS0.js";import{g as L,G2 as d,tf as g,th as y}from"./C51KzdSG.js";import{$ as R}from"./dimBDqRX.js";import{l as v}from"./Di6XfBOT.js";const F="intent://local/note/{note-id}",S="intent://local/{workspace-id}/note/{note-id}";function f(){return c.ui_linkHandler_invalidFormat_error({shortFormat:F,longFormat:S})}class u extends Error{constructor(r){super(r),this.name="NotFoundError"}}function W(e){try{const r=new URL(e.replace("intent://","http://")),t=r.hostname,n=r.pathname.replace(/^\/+/,"").split("/").filter(l=>l.length>0),a=e.replace("intent://","").split(/[?#]/)[0].split("/").slice(1);if(!t||n.length<2)return{type:"unknown",orgId:t||"",resourceId:"",valid:!1,error:f()};let o,s,i,_,I;if(a[0]==="workspace"&&(a.length===2||a.length===3&&a[2]==="")){const l=O(a[1]);if(!l)return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:f()};o=l,s="workspace",i=l}else if(a[0]==="file")s="file",i=h(a.slice(1));else if(a.length>=3&&k(a[0])&&a[1]==="file")o=a[0],s="file",i=h(a.slice(2));else if(a.length===5&&a[1]==="agent"&&a[3]==="message"&&k(a[0])&&k(a[2])&&k(a[4])&&n.length===5&&n[1]==="agent"&&n[3]==="message")o=n[0],s="message",_=n[2],i=n[4];else if(n[0]==="note"||n[0]==="task")s=n[0],i=n[1];else if(n.length>=3&&(n[1]==="note"||n[1]==="task"))o=n[0],s=n[1],i=n[2];else return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:f()};if(!i||i.trim().length===0)return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:c.ui_linkHandler_emptyResourceId_error()};if(s==="note"||s==="task")return{type:s,orgId:t,workspaceId:o,resourceId:i,valid:!0};if(s==="file"){const l=/^#L\d+(?:-\d+|C\d+)?$/.test(r.hash)?r.hash:"",E=a.slice(o?2:1).join("/"),m=A(E+l);return i=h(m.path.split("/")),I=m.line,H(i)?{type:"file",orgId:t,workspaceId:o,resourceId:i,...I!==void 0?{line:I}:{},valid:!0}:{type:"unknown",orgId:t,workspaceId:o,resourceId:"",valid:!1,error:c.ui_linkHandler_invalidFilePath_error()}}return s==="workspace"&&o?{type:"workspace",orgId:t,workspaceId:o,resourceId:i,valid:!0}:s==="message"&&o&&_?{type:"message",orgId:t,workspaceId:o,resourceId:i,agentId:_,valid:!0}:{type:"unknown",orgId:t,workspaceId:o,resourceId:i,valid:!1,error:c.ui_linkHandler_unknownResourceType_error({type:s})}}catch(r){return{type:"unknown",orgId:"",resourceId:"",valid:!1,error:r instanceof Error?r.message:c.ui_linkHandler_parseFailed_error()}}}function h(e){return e.map(r=>decodeURIComponent(r)).join("/")}function H(e){return/^[A-Za-z]:/.test(e)?!1:e.split(/[\\/]/).every(t=>t.length>0&&t!=="."&&t!=="..")}const j=new Set([L,"new"]);function O(e){if(e===void 0||!k(e))return null;const r=decodeURIComponent(e);return j.has(r)?null:r}function k(e){let r;try{r=decodeURIComponent(e)}catch{return!1}return r.length>0&&r!=="."&&r!==".."&&!/[\\/]/.test(r)}async function T(e,r={}){if(!e.startsWith("intent://"))return!1;const t=W(e);if(!t.valid)return w.error(c.ui_linkHandler_invalidLink_title(),{description:t.error||c.ui_linkHandler_invalidLink_description()}),!0;try{switch(t.type){case"note":case"task":await N(t,r);break;case"file":await b(t,r);break;case"workspace":await C(t.resourceId);break;case"message":{const{openMessage:n}=await p(async()=>{const{openMessage:a}=await import("./CX89Aogf.js");return{openMessage:a}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]),import.meta.url);await n({workspaceId:t.workspaceId,agentId:t.agentId,messageId:t.resourceId});break}default:w.error(c.ui_linkHandler_unsupportedLink_title(),{description:c.ui_linkHandler_unsupportedLink_description({type:t.type})})}}catch(n){n instanceof u?w.error(c.ui_linkHandler_notFound_title(),{description:n.message}):w.error(c.ui_linkHandler_navigationFailed_title(),{description:n instanceof Error?n.message:c.ui_linkHandler_unknownError_label()})}return!0}function Z(e,r){return R(e,r)}function B(){return async(e,r,t)=>{const a=t.target.closest("a");return a?.href?.startsWith("intent://")?(t.preventDefault(),await T(a.href)):!1}}async function C(e){const{appClient:r}=await p(async()=>{const{appClient:a}=await import("./Sk9pLJI5.js").then(o=>o.X);return{appClient:a}},__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,12,21,22]),import.meta.url);if(!await r.workspaces.get(e).catch(()=>null))throw new u(c.workspace_loader_notFound_title());const{openAndShowWorkspace:n}=await p(async()=>{const{openAndShowWorkspace:a}=await import("./CBF5TBJQ.js").then(o=>o.s);return{openAndShowWorkspace:a}},__vite__mapDeps([29,2,3,4,5,6,7,8,9,10,11,28]),import.meta.url);await n(e)}async function N(e,r){const t=r.workspaceId??v.select(d.state)??void 0;if(e.workspaceId){const a=!t||e.workspaceId!==t;if(!await P(e.workspaceId,e.resourceId))throw new u(c.ui_linkHandler_noteNotFound_error({noteId:e.resourceId,workspaceId:e.workspaceId}));if(a){const{openAndShowWorkspace:s}=await p(async()=>{const{openAndShowWorkspace:i}=await import("./CBF5TBJQ.js").then(_=>_.s);return{openAndShowWorkspace:i}},__vite__mapDeps([29,2,3,4,5,6,7,8,9,10,11,28]),import.meta.url);await s(e.workspaceId,{query:{note:e.resourceId}})}else d.dispatch(y(e.workspaceId,e.resourceId,{openInAdjacentPanel:r.openInAdjacentPanel??!1,openInNewAdjacentPanel:r.openInNewAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}));return}if(!t)throw new u(c.ui_linkHandler_noSpaceOpen_error());if(!await P(t,e.resourceId))throw new u(c.ui_linkHandler_noteNotFoundCurrent_error({noteId:e.resourceId}));d.dispatch(y(t,e.resourceId,{openInAdjacentPanel:r.openInAdjacentPanel??!1,openInNewAdjacentPanel:r.openInNewAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}))}async function b(e,r){const t=r.workspaceId??v.select(d.state)??void 0;if(e.workspaceId){const n=!t||e.workspaceId!==t;if(n){const{openAndShowWorkspace:a}=await p(async()=>{const{openAndShowWorkspace:o}=await import("./CBF5TBJQ.js").then(s=>s.s);return{openAndShowWorkspace:o}},__vite__mapDeps([29,2,3,4,5,6,7,8,9,10,11,28]),import.meta.url);if(!await a(e.workspaceId))return}d.dispatch(g(e.workspaceId,e.resourceId,{filePathIsLiteral:!0,...e.line!==void 0?{line:e.line}:{},openInAdjacentPanel:n?!1:r.openInAdjacentPanel??!1,sourcePanelId:n?void 0:r.sourcePanelId}));return}if(!t)throw new u(c.ui_linkHandler_noSpaceOpen_error());d.dispatch(g(t,e.resourceId,{filePathIsLiteral:!0,...e.line!==void 0?{line:e.line}:{},openInAdjacentPanel:r.openInAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}))}async function P(e,r){try{const{backendRequest:t}=await p(async()=>{const{backendRequest:o}=await import("./DgFojmqv.js").then(s=>s.az);return{backendRequest:o}},__vite__mapDeps([14,10,3,9,15,8,16,17,18,11,19,7,20]),import.meta.url),n=await t("note.get",{workspaceId:e,noteId:r}),a=n&&typeof n=="object"&&"note"in n?n.note:n;return a!=null&&typeof a=="object"}catch{return!1}}export{u as NotFoundError,B as createIntentLinkClickHandler,Z as generateNoteLink,T as handleIntentLink,W as parseIntentLink};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/yQykulND.js","/app/immutable/chunks/CVBBsS8i.js","/app/immutable/chunks/CjSUqH7t.js","/app/immutable/chunks/B8o4lNgr.js","/app/immutable/chunks/C51KzdSG.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/D5B1sycf.js","/app/immutable/chunks/DVkfuwKw.js","/app/immutable/chunks/CpHIRYx9.js","/app/immutable/chunks/WZHg24tN.js","/app/immutable/chunks/D4MoKNoK.js","/app/immutable/chunks/HfuFYz2u.js","/app/immutable/chunks/BJzHxIyr.js","/app/immutable/chunks/Sk9pLJI5.js","/app/immutable/chunks/DgFojmqv.js","/app/immutable/chunks/WVYGrHqE.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/D2g8BuR1.js","/app/immutable/chunks/BPQohPc9.js","/app/immutable/chunks/D0pR1-a6.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/DzMB8eQW.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/dimBDqRX.js","/app/immutable/chunks/CG5J-qd_.js","/app/immutable/chunks/B9YdV5Lr.js","/app/immutable/chunks/C8yAGnZY.js","/app/immutable/chunks/B0Z-1lwJ.js","/app/immutable/chunks/CwK4Fl7A.js","/app/immutable/chunks/BoAgG62K.js"])))=>i.map(i=>d[i]);
2
+ import{bo as c,_ as p}from"./D4MoKNoK.js";import{n as w}from"./BjO6mATN.js";import"./B8o4lNgr.js";import"./WVYGrHqE.js";import"./WZHg24tN.js";import{bw as A}from"./DgFojmqv.js";import"./ChTqQfQN.js";import"./De4WWpS0.js";import{g as L,G2 as d,tf as g,th as y}from"./C51KzdSG.js";import{$ as R}from"./dimBDqRX.js";import{l as v}from"./Di6XfBOT.js";const F="intent://local/note/{note-id}",S="intent://local/{workspace-id}/note/{note-id}";function f(){return c.ui_linkHandler_invalidFormat_error({shortFormat:F,longFormat:S})}class u extends Error{constructor(r){super(r),this.name="NotFoundError"}}function W(e){try{const r=new URL(e.replace("intent://","http://")),t=r.hostname,n=r.pathname.replace(/^\/+/,"").split("/").filter(l=>l.length>0),a=e.replace("intent://","").split(/[?#]/)[0].split("/").slice(1);if(!t||n.length<2)return{type:"unknown",orgId:t||"",resourceId:"",valid:!1,error:f()};let o,s,i,_,I;if(a[0]==="workspace"&&(a.length===2||a.length===3&&a[2]==="")){const l=O(a[1]);if(!l)return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:f()};o=l,s="workspace",i=l}else if(a[0]==="file")s="file",i=h(a.slice(1));else if(a.length>=3&&k(a[0])&&a[1]==="file")o=a[0],s="file",i=h(a.slice(2));else if(a.length===5&&a[1]==="agent"&&a[3]==="message"&&k(a[0])&&k(a[2])&&k(a[4])&&n.length===5&&n[1]==="agent"&&n[3]==="message")o=n[0],s="message",_=n[2],i=n[4];else if(n[0]==="note"||n[0]==="task")s=n[0],i=n[1];else if(n.length>=3&&(n[1]==="note"||n[1]==="task"))o=n[0],s=n[1],i=n[2];else return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:f()};if(!i||i.trim().length===0)return{type:"unknown",orgId:t,resourceId:"",valid:!1,error:c.ui_linkHandler_emptyResourceId_error()};if(s==="note"||s==="task")return{type:s,orgId:t,workspaceId:o,resourceId:i,valid:!0};if(s==="file"){const l=/^#L\d+(?:-\d+|C\d+)?$/.test(r.hash)?r.hash:"",E=a.slice(o?2:1).join("/"),m=A(E+l);return i=h(m.path.split("/")),I=m.line,H(i)?{type:"file",orgId:t,workspaceId:o,resourceId:i,...I!==void 0?{line:I}:{},valid:!0}:{type:"unknown",orgId:t,workspaceId:o,resourceId:"",valid:!1,error:c.ui_linkHandler_invalidFilePath_error()}}return s==="workspace"&&o?{type:"workspace",orgId:t,workspaceId:o,resourceId:i,valid:!0}:s==="message"&&o&&_?{type:"message",orgId:t,workspaceId:o,resourceId:i,agentId:_,valid:!0}:{type:"unknown",orgId:t,workspaceId:o,resourceId:i,valid:!1,error:c.ui_linkHandler_unknownResourceType_error({type:s})}}catch(r){return{type:"unknown",orgId:"",resourceId:"",valid:!1,error:r instanceof Error?r.message:c.ui_linkHandler_parseFailed_error()}}}function h(e){return e.map(r=>decodeURIComponent(r)).join("/")}function H(e){return/^[A-Za-z]:/.test(e)?!1:e.split(/[\\/]/).every(t=>t.length>0&&t!=="."&&t!=="..")}const j=new Set([L,"new"]);function O(e){if(e===void 0||!k(e))return null;const r=decodeURIComponent(e);return j.has(r)?null:r}function k(e){let r;try{r=decodeURIComponent(e)}catch{return!1}return r.length>0&&r!=="."&&r!==".."&&!/[\\/]/.test(r)}async function T(e,r={}){if(!e.startsWith("intent://"))return!1;const t=W(e);if(!t.valid)return w.error(c.ui_linkHandler_invalidLink_title(),{description:t.error||c.ui_linkHandler_invalidLink_description()}),!0;try{switch(t.type){case"note":case"task":await N(t,r);break;case"file":await b(t,r);break;case"workspace":await C(t.resourceId);break;case"message":{const{openMessage:n}=await p(async()=>{const{openMessage:a}=await import("./yQykulND.js");return{openMessage:a}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]),import.meta.url);await n({workspaceId:t.workspaceId,agentId:t.agentId,messageId:t.resourceId});break}default:w.error(c.ui_linkHandler_unsupportedLink_title(),{description:c.ui_linkHandler_unsupportedLink_description({type:t.type})})}}catch(n){n instanceof u?w.error(c.ui_linkHandler_notFound_title(),{description:n.message}):w.error(c.ui_linkHandler_navigationFailed_title(),{description:n instanceof Error?n.message:c.ui_linkHandler_unknownError_label()})}return!0}function Z(e,r){return R(e,r)}function B(){return async(e,r,t)=>{const a=t.target.closest("a");return a?.href?.startsWith("intent://")?(t.preventDefault(),await T(a.href)):!1}}async function C(e){const{appClient:r}=await p(async()=>{const{appClient:a}=await import("./Sk9pLJI5.js").then(o=>o.X);return{appClient:a}},__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11,14,15,16,17,18,19,20,12,21,22]),import.meta.url);if(!await r.workspaces.get(e).catch(()=>null))throw new u(c.workspace_loader_notFound_title());const{openAndShowWorkspace:n}=await p(async()=>{const{openAndShowWorkspace:a}=await import("./BoAgG62K.js").then(o=>o.s);return{openAndShowWorkspace:a}},__vite__mapDeps([29,2,3,4,5,6,7,8,9,10,11,28]),import.meta.url);await n(e)}async function N(e,r){const t=r.workspaceId??v.select(d.state)??void 0;if(e.workspaceId){const a=!t||e.workspaceId!==t;if(!await P(e.workspaceId,e.resourceId))throw new u(c.ui_linkHandler_noteNotFound_error({noteId:e.resourceId,workspaceId:e.workspaceId}));if(a){const{openAndShowWorkspace:s}=await p(async()=>{const{openAndShowWorkspace:i}=await import("./BoAgG62K.js").then(_=>_.s);return{openAndShowWorkspace:i}},__vite__mapDeps([29,2,3,4,5,6,7,8,9,10,11,28]),import.meta.url);await s(e.workspaceId,{query:{note:e.resourceId}})}else d.dispatch(y(e.workspaceId,e.resourceId,{openInAdjacentPanel:r.openInAdjacentPanel??!1,openInNewAdjacentPanel:r.openInNewAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}));return}if(!t)throw new u(c.ui_linkHandler_noSpaceOpen_error());if(!await P(t,e.resourceId))throw new u(c.ui_linkHandler_noteNotFoundCurrent_error({noteId:e.resourceId}));d.dispatch(y(t,e.resourceId,{openInAdjacentPanel:r.openInAdjacentPanel??!1,openInNewAdjacentPanel:r.openInNewAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}))}async function b(e,r){const t=r.workspaceId??v.select(d.state)??void 0;if(e.workspaceId){const n=!t||e.workspaceId!==t;if(n){const{openAndShowWorkspace:a}=await p(async()=>{const{openAndShowWorkspace:o}=await import("./BoAgG62K.js").then(s=>s.s);return{openAndShowWorkspace:o}},__vite__mapDeps([29,2,3,4,5,6,7,8,9,10,11,28]),import.meta.url);if(!await a(e.workspaceId))return}d.dispatch(g(e.workspaceId,e.resourceId,{filePathIsLiteral:!0,...e.line!==void 0?{line:e.line}:{},openInAdjacentPanel:n?!1:r.openInAdjacentPanel??!1,sourcePanelId:n?void 0:r.sourcePanelId}));return}if(!t)throw new u(c.ui_linkHandler_noSpaceOpen_error());d.dispatch(g(t,e.resourceId,{filePathIsLiteral:!0,...e.line!==void 0?{line:e.line}:{},openInAdjacentPanel:r.openInAdjacentPanel??!1,sourcePanelId:r.sourcePanelId}))}async function P(e,r){try{const{backendRequest:t}=await p(async()=>{const{backendRequest:o}=await import("./DgFojmqv.js").then(s=>s.az);return{backendRequest:o}},__vite__mapDeps([14,10,3,9,15,8,16,17,18,11,19,7,20]),import.meta.url),n=await t("note.get",{workspaceId:e,noteId:r}),a=n&&typeof n=="object"&&"note"in n?n.note:n;return a!=null&&typeof a=="object"}catch{return!1}}export{u as NotFoundError,B as createIntentLinkClickHandler,Z as generateNoteLink,T as handleIntentLink,W as parseIntentLink};
@@ -1 +1 @@
1
- import{g as p,r as u,d as n}from"./D0GCGQZA.js";import{p as f}from"./BoffG-0C.js";import{M as c,c as d}from"./i_sqIi_B.js";import{a,ad as o}from"./CRQOCmwo.js";import"./Bmnp4Cni.js";var v=d().RailroadAbnf.parser.LangiumParser,i=a(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=a(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=a(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=a(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=a(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=a(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=a(e=>{f(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(P(r)))},"populateDb"),R={parse:a(e=>{n.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:R,db:n,renderer:u,styles:p};export{B as diagram};
1
+ import{g as p,r as u,d as n}from"./C4eeWJf-.js";import{p as f}from"./B0a31Ljt.js";import{M as c,c as d}from"./u9Jr5xJ2.js";import{a,ad as o}from"./_eQjP0_7.js";import"./CdT170lG.js";var v=d().RailroadAbnf.parser.LangiumParser,i=a(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=a(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=a(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=a(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=a(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=a(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=a(e=>{f(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(P(r)))},"populateDb"),R={parse:a(e=>{n.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:n}},B={parser:R,db:n,renderer:u,styles:p};export{B as diagram};
@@ -1,4 +1,4 @@
1
- import{g as Pe}from"./Dzk1FZ-5.js";import{bq as Fe,aV as xe,bt as Me,cs as Ke,cr as Ye,cu as We,ct as Ve,cn as Ue,cl as He,cb as Xe,bX as Ge,bN as je,bM as qe,bD as Je,ba as Ze,b9 as Qe,bb as $e,aH as et,aG as tt,au as st,N as rt,at as it,o as nt,s as at,m as ot,f as u,aN as Y,c3 as X,bF as ct,a6 as lt,bC as y,a0 as ut,c0 as gt,aO as Le,G as ht,b5 as dt,b6 as pt,bT as ft,a4 as bt,aT as St,b8 as me,bU as xt}from"./Bmnp4Cni.js";import{c as Lt}from"./DsYKN9zh.js";function mt(e){return Array.isArray(e)}function yt(e){if(Fe(e))return e;const n=xe(e);if(!wt(e))return{};if(mt(e)){const r=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(r.index=e.index,r.input=e.input),r}if(Me(e)){const r=e,l=r.constructor;return new l(r.buffer,r.byteOffset,r.length)}if(n==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(n==="[object DataView]"){const r=e,l=r.buffer,d=r.byteOffset,s=r.byteLength,h=new ArrayBuffer(s),x=new Uint8Array(l,d,s);return new Uint8Array(h).set(x),new DataView(h)}if(n==="[object Boolean]"||n==="[object Number]"||n==="[object String]"){const r=e.constructor,l=new r(e.valueOf());return n==="[object String]"?_t(l,e):se(l,e),l}if(n==="[object Date]")return new Date(Number(e));if(n==="[object RegExp]"){const r=e,l=new RegExp(r.source,r.flags);return l.lastIndex=r.lastIndex,l}if(n==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(n==="[object Map]"){const r=e,l=new Map;return r.forEach((d,s)=>{l.set(s,d)}),l}if(n==="[object Set]"){const r=e,l=new Set;return r.forEach(d=>{l.add(d)}),l}if(n==="[object Arguments]"){const r=e,l={};return se(l,r),l.length=r.length,l[Symbol.iterator]=r[Symbol.iterator],l}const o={};return kt(o,e),se(o,e),Et(o,e),o}function wt(e){switch(xe(e)){case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Qe:case Ze:case Je:case qe:case je:case Ge:case Xe:case He:case Ue:case Ve:case We:case Ye:case Ke:return!0;default:return!1}}function se(e,n){for(const o in n)Object.hasOwn(n,o)&&(e[o]=n[o])}function Et(e,n){const o=Object.getOwnPropertySymbols(n);for(let r=0;r<o.length;r++){const l=o[r];Object.prototype.propertyIsEnumerable.call(n,l)&&(e[l]=n[l])}}function _t(e,n){const o=n.valueOf().length;for(const r in n)Object.hasOwn(n,r)&&(Number.isNaN(Number(r))||Number(r)>=o)&&(e[r]=n[r])}function kt(e,n){const o=Object.getPrototypeOf(n);o!==null&&typeof n.constructor=="function"&&Object.setPrototypeOf(e,o)}var ie=(function(){var e=u(function(v,g,i,c){for(i=i||{},c=v.length;c--;i[v[c]]=g);return i},"o"),n=[1,15],o=[1,7],r=[1,13],l=[1,14],d=[1,19],s=[1,16],h=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],f=[1,23],L=[1,24],w=[8,10,15,16,21,28,29,30,31,39,43,46],b=[8,10,15,16,21,27,28,29,30,31,39,43,46],k=[1,49],_={trace:u(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:u(function(g,i,c,p,E,t,M){var a=t.length-1;switch(E){case 4:p.getLogger().debug("Rule: separator (NL) ");break;case 5:p.getLogger().debug("Rule: separator (Space) ");break;case 6:p.getLogger().debug("Rule: separator (EOF) ");break;case 7:p.getLogger().debug("Rule: hierarchy: ",t[a-1]),p.setHierarchy(t[a-1]);break;case 8:p.getLogger().debug("Stop NL ");break;case 9:p.getLogger().debug("Stop EOF ");break;case 10:p.getLogger().debug("Stop NL2 ");break;case 11:p.getLogger().debug("Stop EOF2 ");break;case 12:p.getLogger().debug("Rule: statement: ",t[a]),typeof t[a].length=="number"?this.$=t[a]:this.$=[t[a]];break;case 13:p.getLogger().debug("Rule: statement #2: ",t[a-1]),this.$=[t[a-1]].concat(t[a]);break;case 14:p.getLogger().debug("Rule: link: ",t[a],g),this.$={edgeTypeStr:t[a],label:""};break;case 15:p.getLogger().debug("Rule: LABEL link: ",t[a-3],t[a-1],t[a]),this.$={edgeTypeStr:t[a],label:t[a-1]};break;case 18:const P=parseInt(t[a]),W=p.generateId();this.$={id:W,type:"space",label:"",width:P,children:[]};break;case 23:p.getLogger().debug("Rule: (nodeStatement link node) ",t[a-2],t[a-1],t[a]," typestr: ",t[a-1].edgeTypeStr);const J=p.edgeStrToEdgeData(t[a-1].edgeTypeStr),V=p.edgeStrToEdgeStartData(t[a-1].edgeTypeStr),Z=p.edgeStrToThickness(t[a-1].edgeTypeStr),D=p.edgeStrToPattern(t[a-1].edgeTypeStr);this.$=[{id:t[a-2].id,label:t[a-2].label,type:t[a-2].type,directions:t[a-2].directions},{id:t[a-2].id+"-"+t[a].id,start:t[a-2].id,end:t[a].id,label:t[a-1].label,type:"edge",thickness:Z,pattern:D,directions:t[a].directions,arrowTypeEnd:J,arrowTypeStart:V},{id:t[a].id,label:t[a].label,type:p.typeStr2Type(t[a].typeStr),directions:t[a].directions}];break;case 24:p.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[a-1],t[a]),this.$={id:t[a-1].id,label:t[a-1].label,type:p.typeStr2Type(t[a-1].typeStr),directions:t[a-1].directions,widthInColumns:parseInt(t[a],10)};break;case 25:p.getLogger().debug("Rule: nodeStatement (node) ",t[a]),this.$={id:t[a].id,label:t[a].label,type:p.typeStr2Type(t[a].typeStr),directions:t[a].directions,widthInColumns:1};break;case 26:p.getLogger().debug("APA123",this?this:"na"),p.getLogger().debug("COLUMNS: ",t[a]),this.$={type:"column-setting",columns:t[a]==="auto"?-1:parseInt(t[a])};break;case 27:p.getLogger().debug("Rule: id-block statement : ",t[a-2],t[a-1]),p.generateId(),this.$={...t[a-2],type:"composite",children:t[a-1]};break;case 28:p.getLogger().debug("Rule: blockStatement : ",t[a-2],t[a-1],t[a]);const A=p.generateId();this.$={id:A,type:"composite",label:"",children:t[a-1]};break;case 29:p.getLogger().debug("Rule: node (NODE_ID separator): ",t[a]),this.$={id:t[a]};break;case 30:p.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[a-1],t[a]),this.$={id:t[a-1],label:t[a].label,typeStr:t[a].typeStr,directions:t[a].directions};break;case 31:p.getLogger().debug("Rule: dirList: ",t[a]),this.$=[t[a]];break;case 32:p.getLogger().debug("Rule: dirList: ",t[a-1],t[a]),this.$=[t[a-1]].concat(t[a]);break;case 33:p.getLogger().debug("Rule: nodeShapeNLabel: ",t[a-2],t[a-1],t[a]),this.$={typeStr:t[a-2]+t[a],label:t[a-1]};break;case 34:p.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[a-3],t[a-2]," #3:",t[a-1],t[a]),this.$={typeStr:t[a-3]+t[a],label:t[a-2],directions:t[a-1]};break;case 35:case 36:this.$={type:"classDef",id:t[a-1].trim(),css:t[a].trim()};break;case 37:this.$={type:"applyClass",id:t[a-1].trim(),styleClass:t[a].trim()};break;case 38:this.$={type:"applyStyles",id:t[a-1].trim(),stylesStr:t[a].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:n,11:3,13:4,19:5,20:6,21:o,22:8,23:9,24:10,25:11,26:12,28:r,29:l,31:d,39:s,43:h,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:n,21:o,28:r,29:l,31:d,39:s,43:h,46:x}),e(S,[2,16],{14:22,15:f,16:L}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(w,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:d},{10:n,11:27,13:4,19:5,20:6,21:o,22:8,23:9,24:10,25:11,26:12,28:r,29:l,31:d,39:s,43:h,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(b,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:d},{31:[2,14]},{17:[1,36]},e(w,[2,24]),{10:n,11:37,13:4,14:22,15:f,16:L,19:5,20:6,21:o,22:8,23:9,24:10,25:11,26:12,28:r,29:l,31:d,39:s,43:h,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(b,[2,30]),{18:[1,43]},{18:[1,44]},e(w,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:k},{15:[1,50]},e(S,[2,27]),e(b,[2,33]),{38:[1,51]},{33:52,34:k,38:[2,31]},{31:[2,15]},e(b,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:u(function(g,i){if(i.recoverable)this.trace(g);else{var c=new Error(g);throw c.hash=i,c}},"parseError"),parse:u(function(g){var i=this,c=[0],p=[],E=[null],t=[],M=this.table,a="",P=0,W=0,J=2,V=1,Z=t.slice.call(arguments,1),D=Object.create(this.lexer),A={yy:{}};for(var Q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Q)&&(A.yy[Q]=this.yy[Q]);D.setInput(g,A.yy),A.yy.lexer=D,A.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var $=D.yylloc;t.push($);var Be=D.options&&D.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Re(O){c.length=c.length-2*O,E.length=E.length-O,t.length=t.length-O}u(Re,"popStack");function de(){var O;return O=p.pop()||D.lex()||V,typeof O!="number"&&(O instanceof Array&&(p=O,O=p.pop()),O=i.symbols_[O]||O),O}u(de,"lex");for(var N,R,C,ee,F={},U,B,pe,H;;){if(R=c[c.length-1],this.defaultActions[R]?C=this.defaultActions[R]:((N===null||typeof N>"u")&&(N=de()),C=M[R]&&M[R][N]),typeof C>"u"||!C.length||!C[0]){var te="";H=[];for(U in M[R])this.terminals_[U]&&U>J&&H.push("'"+this.terminals_[U]+"'");D.showPosition?te="Parse error on line "+(P+1)+`:
1
+ import{g as Pe}from"./C8xd2WWY.js";import{bq as Fe,aV as xe,bt as Me,cs as Ke,cr as Ye,cu as We,ct as Ve,cn as Ue,cl as He,cb as Xe,bX as Ge,bN as je,bM as qe,bD as Je,ba as Ze,b9 as Qe,bb as $e,aH as et,aG as tt,au as st,N as rt,at as it,o as nt,s as at,m as ot,f as u,aN as Y,c3 as X,bF as ct,a6 as lt,bC as y,a0 as ut,c0 as gt,aO as Le,G as ht,b5 as dt,b6 as pt,bT as ft,a4 as bt,aT as St,b8 as me,bU as xt}from"./CdT170lG.js";import{c as Lt}from"./B4kKZm1B.js";function mt(e){return Array.isArray(e)}function yt(e){if(Fe(e))return e;const n=xe(e);if(!wt(e))return{};if(mt(e)){const r=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(r.index=e.index,r.input=e.input),r}if(Me(e)){const r=e,l=r.constructor;return new l(r.buffer,r.byteOffset,r.length)}if(n==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(n==="[object DataView]"){const r=e,l=r.buffer,d=r.byteOffset,s=r.byteLength,h=new ArrayBuffer(s),x=new Uint8Array(l,d,s);return new Uint8Array(h).set(x),new DataView(h)}if(n==="[object Boolean]"||n==="[object Number]"||n==="[object String]"){const r=e.constructor,l=new r(e.valueOf());return n==="[object String]"?_t(l,e):se(l,e),l}if(n==="[object Date]")return new Date(Number(e));if(n==="[object RegExp]"){const r=e,l=new RegExp(r.source,r.flags);return l.lastIndex=r.lastIndex,l}if(n==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(n==="[object Map]"){const r=e,l=new Map;return r.forEach((d,s)=>{l.set(s,d)}),l}if(n==="[object Set]"){const r=e,l=new Set;return r.forEach(d=>{l.add(d)}),l}if(n==="[object Arguments]"){const r=e,l={};return se(l,r),l.length=r.length,l[Symbol.iterator]=r[Symbol.iterator],l}const o={};return kt(o,e),se(o,e),Et(o,e),o}function wt(e){switch(xe(e)){case ot:case at:case nt:case it:case rt:case st:case tt:case et:case $e:case Qe:case Ze:case Je:case qe:case je:case Ge:case Xe:case He:case Ue:case Ve:case We:case Ye:case Ke:return!0;default:return!1}}function se(e,n){for(const o in n)Object.hasOwn(n,o)&&(e[o]=n[o])}function Et(e,n){const o=Object.getOwnPropertySymbols(n);for(let r=0;r<o.length;r++){const l=o[r];Object.prototype.propertyIsEnumerable.call(n,l)&&(e[l]=n[l])}}function _t(e,n){const o=n.valueOf().length;for(const r in n)Object.hasOwn(n,r)&&(Number.isNaN(Number(r))||Number(r)>=o)&&(e[r]=n[r])}function kt(e,n){const o=Object.getPrototypeOf(n);o!==null&&typeof n.constructor=="function"&&Object.setPrototypeOf(e,o)}var ie=(function(){var e=u(function(v,g,i,c){for(i=i||{},c=v.length;c--;i[v[c]]=g);return i},"o"),n=[1,15],o=[1,7],r=[1,13],l=[1,14],d=[1,19],s=[1,16],h=[1,17],x=[1,18],m=[8,30],S=[8,10,21,28,29,30,31,39,43,46],f=[1,23],L=[1,24],w=[8,10,15,16,21,28,29,30,31,39,43,46],b=[8,10,15,16,21,27,28,29,30,31,39,43,46],k=[1,49],_={trace:u(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:u(function(g,i,c,p,E,t,M){var a=t.length-1;switch(E){case 4:p.getLogger().debug("Rule: separator (NL) ");break;case 5:p.getLogger().debug("Rule: separator (Space) ");break;case 6:p.getLogger().debug("Rule: separator (EOF) ");break;case 7:p.getLogger().debug("Rule: hierarchy: ",t[a-1]),p.setHierarchy(t[a-1]);break;case 8:p.getLogger().debug("Stop NL ");break;case 9:p.getLogger().debug("Stop EOF ");break;case 10:p.getLogger().debug("Stop NL2 ");break;case 11:p.getLogger().debug("Stop EOF2 ");break;case 12:p.getLogger().debug("Rule: statement: ",t[a]),typeof t[a].length=="number"?this.$=t[a]:this.$=[t[a]];break;case 13:p.getLogger().debug("Rule: statement #2: ",t[a-1]),this.$=[t[a-1]].concat(t[a]);break;case 14:p.getLogger().debug("Rule: link: ",t[a],g),this.$={edgeTypeStr:t[a],label:""};break;case 15:p.getLogger().debug("Rule: LABEL link: ",t[a-3],t[a-1],t[a]),this.$={edgeTypeStr:t[a],label:t[a-1]};break;case 18:const P=parseInt(t[a]),W=p.generateId();this.$={id:W,type:"space",label:"",width:P,children:[]};break;case 23:p.getLogger().debug("Rule: (nodeStatement link node) ",t[a-2],t[a-1],t[a]," typestr: ",t[a-1].edgeTypeStr);const J=p.edgeStrToEdgeData(t[a-1].edgeTypeStr),V=p.edgeStrToEdgeStartData(t[a-1].edgeTypeStr),Z=p.edgeStrToThickness(t[a-1].edgeTypeStr),D=p.edgeStrToPattern(t[a-1].edgeTypeStr);this.$=[{id:t[a-2].id,label:t[a-2].label,type:t[a-2].type,directions:t[a-2].directions},{id:t[a-2].id+"-"+t[a].id,start:t[a-2].id,end:t[a].id,label:t[a-1].label,type:"edge",thickness:Z,pattern:D,directions:t[a].directions,arrowTypeEnd:J,arrowTypeStart:V},{id:t[a].id,label:t[a].label,type:p.typeStr2Type(t[a].typeStr),directions:t[a].directions}];break;case 24:p.getLogger().debug("Rule: nodeStatement (abc88 node size) ",t[a-1],t[a]),this.$={id:t[a-1].id,label:t[a-1].label,type:p.typeStr2Type(t[a-1].typeStr),directions:t[a-1].directions,widthInColumns:parseInt(t[a],10)};break;case 25:p.getLogger().debug("Rule: nodeStatement (node) ",t[a]),this.$={id:t[a].id,label:t[a].label,type:p.typeStr2Type(t[a].typeStr),directions:t[a].directions,widthInColumns:1};break;case 26:p.getLogger().debug("APA123",this?this:"na"),p.getLogger().debug("COLUMNS: ",t[a]),this.$={type:"column-setting",columns:t[a]==="auto"?-1:parseInt(t[a])};break;case 27:p.getLogger().debug("Rule: id-block statement : ",t[a-2],t[a-1]),p.generateId(),this.$={...t[a-2],type:"composite",children:t[a-1]};break;case 28:p.getLogger().debug("Rule: blockStatement : ",t[a-2],t[a-1],t[a]);const A=p.generateId();this.$={id:A,type:"composite",label:"",children:t[a-1]};break;case 29:p.getLogger().debug("Rule: node (NODE_ID separator): ",t[a]),this.$={id:t[a]};break;case 30:p.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",t[a-1],t[a]),this.$={id:t[a-1],label:t[a].label,typeStr:t[a].typeStr,directions:t[a].directions};break;case 31:p.getLogger().debug("Rule: dirList: ",t[a]),this.$=[t[a]];break;case 32:p.getLogger().debug("Rule: dirList: ",t[a-1],t[a]),this.$=[t[a-1]].concat(t[a]);break;case 33:p.getLogger().debug("Rule: nodeShapeNLabel: ",t[a-2],t[a-1],t[a]),this.$={typeStr:t[a-2]+t[a],label:t[a-1]};break;case 34:p.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",t[a-3],t[a-2]," #3:",t[a-1],t[a]),this.$={typeStr:t[a-3]+t[a],label:t[a-2],directions:t[a-1]};break;case 35:case 36:this.$={type:"classDef",id:t[a-1].trim(),css:t[a].trim()};break;case 37:this.$={type:"applyClass",id:t[a-1].trim(),styleClass:t[a].trim()};break;case 38:this.$={type:"applyStyles",id:t[a-1].trim(),stylesStr:t[a].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:n,11:3,13:4,19:5,20:6,21:o,22:8,23:9,24:10,25:11,26:12,28:r,29:l,31:d,39:s,43:h,46:x},{8:[1,20]},e(m,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:n,21:o,28:r,29:l,31:d,39:s,43:h,46:x}),e(S,[2,16],{14:22,15:f,16:L}),e(S,[2,17]),e(S,[2,18]),e(S,[2,19]),e(S,[2,20]),e(S,[2,21]),e(S,[2,22]),e(w,[2,25],{27:[1,25]}),e(S,[2,26]),{19:26,26:12,31:d},{10:n,11:27,13:4,19:5,20:6,21:o,22:8,23:9,24:10,25:11,26:12,28:r,29:l,31:d,39:s,43:h,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(b,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(m,[2,13]),{26:35,31:d},{31:[2,14]},{17:[1,36]},e(w,[2,24]),{10:n,11:37,13:4,14:22,15:f,16:L,19:5,20:6,21:o,22:8,23:9,24:10,25:11,26:12,28:r,29:l,31:d,39:s,43:h,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(b,[2,30]),{18:[1,43]},{18:[1,44]},e(w,[2,23]),{18:[1,45]},{30:[1,46]},e(S,[2,28]),e(S,[2,35]),e(S,[2,36]),e(S,[2,37]),e(S,[2,38]),{36:[1,47]},{33:48,34:k},{15:[1,50]},e(S,[2,27]),e(b,[2,33]),{38:[1,51]},{33:52,34:k,38:[2,31]},{31:[2,15]},e(b,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:u(function(g,i){if(i.recoverable)this.trace(g);else{var c=new Error(g);throw c.hash=i,c}},"parseError"),parse:u(function(g){var i=this,c=[0],p=[],E=[null],t=[],M=this.table,a="",P=0,W=0,J=2,V=1,Z=t.slice.call(arguments,1),D=Object.create(this.lexer),A={yy:{}};for(var Q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Q)&&(A.yy[Q]=this.yy[Q]);D.setInput(g,A.yy),A.yy.lexer=D,A.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var $=D.yylloc;t.push($);var Be=D.options&&D.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Re(O){c.length=c.length-2*O,E.length=E.length-O,t.length=t.length-O}u(Re,"popStack");function de(){var O;return O=p.pop()||D.lex()||V,typeof O!="number"&&(O instanceof Array&&(p=O,O=p.pop()),O=i.symbols_[O]||O),O}u(de,"lex");for(var N,R,C,ee,F={},U,B,pe,H;;){if(R=c[c.length-1],this.defaultActions[R]?C=this.defaultActions[R]:((N===null||typeof N>"u")&&(N=de()),C=M[R]&&M[R][N]),typeof C>"u"||!C.length||!C[0]){var te="";H=[];for(U in M[R])this.terminals_[U]&&U>J&&H.push("'"+this.terminals_[U]+"'");D.showPosition?te="Parse error on line "+(P+1)+`:
2
2
  `+D.showPosition()+`
3
3
  Expecting `+H.join(", ")+", got '"+(this.terminals_[N]||N)+"'":te="Parse error on line "+(P+1)+": Unexpected "+(N==V?"end of input":"'"+(this.terminals_[N]||N)+"'"),this.parseError(te,{text:D.match,token:this.terminals_[N]||N,line:D.yylineno,loc:$,expected:H})}if(C[0]instanceof Array&&C.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+N);switch(C[0]){case 1:c.push(N),E.push(D.yytext),t.push(D.yylloc),c.push(C[1]),N=null,W=D.yyleng,a=D.yytext,P=D.yylineno,$=D.yylloc;break;case 2:if(B=this.productions_[C[1]][1],F.$=E[E.length-B],F._$={first_line:t[t.length-(B||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(B||1)].first_column,last_column:t[t.length-1].last_column},Be&&(F._$.range=[t[t.length-(B||1)].range[0],t[t.length-1].range[1]]),ee=this.performAction.apply(F,[a,W,P,A.yy,C[1],E,t].concat(Z)),typeof ee<"u")return ee;B&&(c=c.slice(0,-1*B*2),E=E.slice(0,-1*B),t=t.slice(0,-1*B)),c.push(this.productions_[C[1]][0]),E.push(F.$),t.push(F._$),pe=M[c[c.length-2]][c[c.length-1]],c.push(pe);break;case 3:return!0}}return!0},"parse")},T=(function(){var v={EOF:1,parseError:u(function(i,c){if(this.yy.parser)this.yy.parser.parseError(i,c);else throw new Error(i)},"parseError"),setInput:u(function(g,i){return this.yy=i||this.yy||{},this._input=g,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:u(function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.offset++,this.match+=g,this.matched+=g;var i=g.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),g},"input"),unput:u(function(g){var i=g.length,c=g.split(/(?:\r\n?|\n)/g);this._input=g+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var p=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),c.length-1&&(this.yylineno-=c.length-1);var E=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:c?(c.length===p.length?this.yylloc.first_column:0)+p[p.length-c.length].length-c[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:u(function(){return this._more=!0,this},"more"),reject:u(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:u(function(g){this.unput(this.match.slice(g))},"less"),pastInput:u(function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:u(function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:u(function(){var g=this.pastInput(),i=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{t as ue,bq as b,a_ as I,by as fe,b as pe,bo as y}from"./D4MoKNoK.js";import{bs as ge,a7 as X,ay as E,W as m,bn as ve,aA as _,a5 as V,aD as e,bS as j,bl as Z,b_ as z,bO as ee,bA as G,aB as P,bf as be,c9 as i}from"./B8o4lNgr.js";import{h as me,k as N,s as f,l as O}from"./WVYGrHqE.js";import{F as _e,bn as he,bm as xe}from"./CG5J-qd_.js";import{f as ye,am as ke}from"./DgFojmqv.js";import{s as Se}from"./BMBobKUo.js";import{t as H}from"./C8yAGnZY.js";import{a as te,p as we,b as ze,d as Pe}from"./B0w4Cxo_.js";var $e=P('<span aria-hidden="true"></span>'),Ie=P('<span class="absolute -right-0.5 -bottom-0.5 inline-flex items-center justify-center rounded-full bg-background text-foreground" aria-hidden="true"><!></span>'),Me=P('<span><span data-presence-avatar-tile=""><!></span> <!> <!></span>'),Ae=P('<!> <span class="sr-only"> </span>',1),Ce=P('<span class="inline-flex shrink-0 items-center justify-center rounded-full border border-background bg-muted px-1 font-medium leading-none text-muted-foreground"> </span>'),Le=P('<span role="group" data-presence-avatar-stack=""><!> <!></span>');function Ve(J,u){if(new.target)return ue({component:Ve,...J});ge(u,!0);const R=(t,a=be)=>{const k=i(()=>Pe(a())),L=i(()=>a().online===!1);var d=Me();let l;var r=V(d);let v;var $=V(r);{let n=i(()=>ze(a()));Se($,{fill:!0,get avatarUrl(){return a().avatarUrl},get label(){return e(n)}})}G(r);var S=j(r,2);{var D=n=>{var s=$e();z(()=>{N(s,1,`absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full border border-background ${a().online?"bg-success":"bg-muted-foreground"}`),f(s,"data-presence-status",a().online?"online":"offline")}),m(n,s)};I(S,n=>{o()==="stack"&&a().hostRole&&a().online!==void 0&&n(D)})}var Y=j(S,2);{var c=n=>{var s=Ie();let h;var w=V(s);{let x=i(()=>a().identity.provider==="gitlab"?he:xe);_e(w,{get icon(){return e(x)}})}G(s),z(x=>{f(s,"data-presence-identity-provider",a().identity.provider),f(s,"data-presence-identity-host",a().identity.host),h=O(s,"",h,{width:`${e(q)??""}px`,height:`${e(q)??""}px`,"font-size":x})},[()=>`${Math.round(e(q)*.8)}px`]),m(n,s)};I(Y,n=>{o()==="stack"&&a().identity&&n(c)})}G(d),z(n=>{N(d,1,`relative inline-flex shrink-0 rounded-full border ${o()==="tile"?"border-border":`border-background ${e(k)?ne[e(k)]:""}`}`),f(d,"data-presence-avatar",a().principalId),f(d,"data-presence-ring",o()==="stack"?e(k)??void 0:void 0),f(d,"data-presence-offline",e(L)||void 0),f(d,"data-presence-self",a().self||void 0),l=O(d,"",l,{width:`${g()??""}px`,height:`${g()??""}px`}),N(r,1,`inline-flex h-full w-full items-center justify-center overflow-hidden rounded-full font-medium leading-none ${o()==="tile"?"bg-muted text-muted-foreground":"text-primary-foreground"} ${e(L)||o()==="tile"&&a().viewing===!1?"grayscale":""}`),v=O(r,"",v,{"font-size":e(K),"background-color":n})},[()=>o()==="stack"?we(a().principalId):void 0]),m(t,d)};let p=b(u,"people",7),M=b(u,"maxVisible",7,3),g=b(u,"size",7,16),o=b(u,"variant",7,"stack"),A=b(u,"side",7,"bottom"),B=b(u,"decorative",7,!1),C=b(u,"action",7),F=b(u,"class",7,"");const ae=i(()=>p().slice(0,M())),T=i(()=>Math.max(0,p().length-M())),U=i(()=>p().filter(t=>!t.self&&t.online!==!1).length),W=i(()=>p().filter(t=>!t.self&&t.online===!1).length),re=i(()=>e(U)===1?y.presence_avatarStack_people_one():e(U)>1?y.presence_avatarStack_people_many({count:H(e(U))}):e(W)===0?y.presence_avatarStack_onlyYou_label():e(W)===1?y.presence_avatarStack_offline_one():y.presence_avatarStack_offline_many({count:H(e(W))})),K=i(()=>`${Math.max(8,Math.round(g()*.55))}px`),q=i(()=>Math.max(9,Math.round(g()*.5))),ne={owner:"ring-2 ring-info",member:"ring-2 ring-success",guest:"ring-2 ring-warning-ink",offline:"ring-2 ring-muted-foreground/40"};var se={get people(){return p()},set people(t){p(t),_()},get maxVisible(){return M()},set maxVisible(t=3){M(t),_()},get size(){return g()},set size(t=16){g(t),_()},get variant(){return o()},set variant(t="stack"){o(t),_()},get side(){return A()},set side(t="bottom"){A(t),_()},get decorative(){return B()},set decorative(t=!1){B(t),_()},get action(){return C()},set action(t){C(t),_()},get class(){return F()},set class(t=""){F(t),_()},$set:fe,$on:(t,a)=>pe(u,t,a)},Q=X(),ie=E(Q);{var le=t=>{var a=Le(),k=V(a);me(k,17,()=>e(ae),l=>l.principalId,(l,r)=>{var v=X(),$=E(v);{var S=c=>{const n=i(()=>{const{label:s,onSelect:h}=C()(e(r));return{personLabel:s,onSelect:h}});{let s=i(()=>e(n).onSelect?void 0:!0),h=i(()=>e(n).onSelect??void 0);ye(c,{variant:"plain",wrapContent:!1,class:"h-auto rounded-full p-0 aria-disabled:opacity-100",get tooltip(){return e(n).personLabel},get tooltipSide(){return A()},get"aria-label"(){return e(n).personLabel},get"aria-disabled"(){return e(s)},get onclick(){return e(h)},get"data-presence-person-button"(){return e(r).principalId},children:(w,x)=>{R(w,()=>e(r))},$$slots:{default:!0}})}},D=c=>{R(c,()=>e(r))},Y=c=>{{let n=i(()=>te(e(r)));ke(c,{get content(){return e(n)},get side(){return A()},children:(s,h)=>{var w=Ae(),x=E(w);R(x,()=>e(r));var oe=j(x,2),de=Z(oe,!0);z(ce=>ee(de,ce),[()=>te(e(r))]),m(s,w)},$$slots:{default:!0}})}};I($,c=>{C()?c(S):B()?c(D,1):c(Y,-1)})}m(l,v)});var L=j(k,2);{var d=l=>{var r=Ce();let v;var $=Z(r,!0);z(S=>{f(r,"data-presence-overflow",e(T)),v=O(r,"",v,{"min-width":`${g()??""}px`,height:`${g()??""}px`,"font-size":e(K)}),ee($,S)},[()=>y.presence_avatarStack_more_label({count:H(e(T))})]),m(l,r)};I(L,l=>{e(T)>0&&l(d)})}G(a),z(l=>{N(a,1,`inline-flex items-center ${o()==="tile"?"flex-wrap gap-1.25":"-space-x-1"} ${F()??""}`),f(a,"aria-label",l),f(a,"data-presence-count",p().length)},[()=>o()==="tile"?y.workspace_peopleTile_title():e(re)]),m(t,a)};I(ie,t=>{p().length>0&&t(le)})}return m(J,Q),ve(se)}export{Ve as P};
1
+ import{t as ue,bq as b,a_ as I,by as fe,b as pe,bo as y}from"./D4MoKNoK.js";import{bs as ge,a7 as X,ay as E,W as m,bn as ve,aA as _,a5 as V,aD as e,bS as j,bl as Z,b_ as z,bO as ee,bA as G,aB as P,bf as be,c9 as i}from"./B8o4lNgr.js";import{h as me,k as N,s as f,l as O}from"./WVYGrHqE.js";import{F as _e,bn as he,bm as xe}from"./CG5J-qd_.js";import{f as ye,am as ke}from"./DgFojmqv.js";import{s as Se}from"./Dbuv3b_7.js";import{t as H}from"./C8yAGnZY.js";import{a as te,p as we,b as ze,d as Pe}from"./B0w4Cxo_.js";var $e=P('<span aria-hidden="true"></span>'),Ie=P('<span class="absolute -right-0.5 -bottom-0.5 inline-flex items-center justify-center rounded-full bg-background text-foreground" aria-hidden="true"><!></span>'),Me=P('<span><span data-presence-avatar-tile=""><!></span> <!> <!></span>'),Ae=P('<!> <span class="sr-only"> </span>',1),Ce=P('<span class="inline-flex shrink-0 items-center justify-center rounded-full border border-background bg-muted px-1 font-medium leading-none text-muted-foreground"> </span>'),Le=P('<span role="group" data-presence-avatar-stack=""><!> <!></span>');function Ve(J,u){if(new.target)return ue({component:Ve,...J});ge(u,!0);const R=(t,a=be)=>{const k=i(()=>Pe(a())),L=i(()=>a().online===!1);var d=Me();let l;var r=V(d);let v;var $=V(r);{let n=i(()=>ze(a()));Se($,{fill:!0,get avatarUrl(){return a().avatarUrl},get label(){return e(n)}})}G(r);var S=j(r,2);{var D=n=>{var s=$e();z(()=>{N(s,1,`absolute -right-0.5 -top-0.5 h-1.5 w-1.5 rounded-full border border-background ${a().online?"bg-success":"bg-muted-foreground"}`),f(s,"data-presence-status",a().online?"online":"offline")}),m(n,s)};I(S,n=>{o()==="stack"&&a().hostRole&&a().online!==void 0&&n(D)})}var Y=j(S,2);{var c=n=>{var s=Ie();let h;var w=V(s);{let x=i(()=>a().identity.provider==="gitlab"?he:xe);_e(w,{get icon(){return e(x)}})}G(s),z(x=>{f(s,"data-presence-identity-provider",a().identity.provider),f(s,"data-presence-identity-host",a().identity.host),h=O(s,"",h,{width:`${e(q)??""}px`,height:`${e(q)??""}px`,"font-size":x})},[()=>`${Math.round(e(q)*.8)}px`]),m(n,s)};I(Y,n=>{o()==="stack"&&a().identity&&n(c)})}G(d),z(n=>{N(d,1,`relative inline-flex shrink-0 rounded-full border ${o()==="tile"?"border-border":`border-background ${e(k)?ne[e(k)]:""}`}`),f(d,"data-presence-avatar",a().principalId),f(d,"data-presence-ring",o()==="stack"?e(k)??void 0:void 0),f(d,"data-presence-offline",e(L)||void 0),f(d,"data-presence-self",a().self||void 0),l=O(d,"",l,{width:`${g()??""}px`,height:`${g()??""}px`}),N(r,1,`inline-flex h-full w-full items-center justify-center overflow-hidden rounded-full font-medium leading-none ${o()==="tile"?"bg-muted text-muted-foreground":"text-primary-foreground"} ${e(L)||o()==="tile"&&a().viewing===!1?"grayscale":""}`),v=O(r,"",v,{"font-size":e(K),"background-color":n})},[()=>o()==="stack"?we(a().principalId):void 0]),m(t,d)};let p=b(u,"people",7),M=b(u,"maxVisible",7,3),g=b(u,"size",7,16),o=b(u,"variant",7,"stack"),A=b(u,"side",7,"bottom"),B=b(u,"decorative",7,!1),C=b(u,"action",7),F=b(u,"class",7,"");const ae=i(()=>p().slice(0,M())),T=i(()=>Math.max(0,p().length-M())),U=i(()=>p().filter(t=>!t.self&&t.online!==!1).length),W=i(()=>p().filter(t=>!t.self&&t.online===!1).length),re=i(()=>e(U)===1?y.presence_avatarStack_people_one():e(U)>1?y.presence_avatarStack_people_many({count:H(e(U))}):e(W)===0?y.presence_avatarStack_onlyYou_label():e(W)===1?y.presence_avatarStack_offline_one():y.presence_avatarStack_offline_many({count:H(e(W))})),K=i(()=>`${Math.max(8,Math.round(g()*.55))}px`),q=i(()=>Math.max(9,Math.round(g()*.5))),ne={owner:"ring-2 ring-info",member:"ring-2 ring-success",guest:"ring-2 ring-warning-ink",offline:"ring-2 ring-muted-foreground/40"};var se={get people(){return p()},set people(t){p(t),_()},get maxVisible(){return M()},set maxVisible(t=3){M(t),_()},get size(){return g()},set size(t=16){g(t),_()},get variant(){return o()},set variant(t="stack"){o(t),_()},get side(){return A()},set side(t="bottom"){A(t),_()},get decorative(){return B()},set decorative(t=!1){B(t),_()},get action(){return C()},set action(t){C(t),_()},get class(){return F()},set class(t=""){F(t),_()},$set:fe,$on:(t,a)=>pe(u,t,a)},Q=X(),ie=E(Q);{var le=t=>{var a=Le(),k=V(a);me(k,17,()=>e(ae),l=>l.principalId,(l,r)=>{var v=X(),$=E(v);{var S=c=>{const n=i(()=>{const{label:s,onSelect:h}=C()(e(r));return{personLabel:s,onSelect:h}});{let s=i(()=>e(n).onSelect?void 0:!0),h=i(()=>e(n).onSelect??void 0);ye(c,{variant:"plain",wrapContent:!1,class:"h-auto rounded-full p-0 aria-disabled:opacity-100",get tooltip(){return e(n).personLabel},get tooltipSide(){return A()},get"aria-label"(){return e(n).personLabel},get"aria-disabled"(){return e(s)},get onclick(){return e(h)},get"data-presence-person-button"(){return e(r).principalId},children:(w,x)=>{R(w,()=>e(r))},$$slots:{default:!0}})}},D=c=>{R(c,()=>e(r))},Y=c=>{{let n=i(()=>te(e(r)));ke(c,{get content(){return e(n)},get side(){return A()},children:(s,h)=>{var w=Ae(),x=E(w);R(x,()=>e(r));var oe=j(x,2),de=Z(oe,!0);z(ce=>ee(de,ce),[()=>te(e(r))]),m(s,w)},$$slots:{default:!0}})}};I($,c=>{C()?c(S):B()?c(D,1):c(Y,-1)})}m(l,v)});var L=j(k,2);{var d=l=>{var r=Ce();let v;var $=Z(r,!0);z(S=>{f(r,"data-presence-overflow",e(T)),v=O(r,"",v,{"min-width":`${g()??""}px`,height:`${g()??""}px`,"font-size":e(K)}),ee($,S)},[()=>y.presence_avatarStack_more_label({count:H(e(T))})]),m(l,r)};I(L,l=>{e(T)>0&&l(d)})}G(a),z(l=>{N(a,1,`inline-flex items-center ${o()==="tile"?"flex-wrap gap-1.25":"-space-x-1"} ${F()??""}`),f(a,"aria-label",l),f(a,"data-presence-count",p().length)},[()=>o()==="tile"?y.workspace_peopleTile_title():e(re)]),m(t,a)};I(ie,t=>{p().length>0&&t(le)})}return m(J,Q),ve(se)}export{Ve as P};
@@ -1 +1 @@
1
- import{f as i,c3 as l,bA as d,aA as o}from"./Bmnp4Cni.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),f=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),h=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{g as a,m as b,w as c,p as d,x as e,y as f,f as g,h};
1
+ import{f as i,c3 as l,bA as d,aA as o}from"./CdT170lG.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),f=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),h=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{g as a,m as b,w as c,p as d,x as e,y as f,f as g,h};