@intent-hq/web 2.357.5 → 2.358.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 (221) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/chunks/{DjAk5kVg.js → -kRuCO2W.js} +1 -1
  3. package/web/app/immutable/chunks/{BQBELrK8.js → 4qV-3jgp.js} +1 -1
  4. package/web/app/immutable/chunks/{BYJ8RYZY.js → 51mPy8SN.js} +1 -1
  5. package/web/app/immutable/chunks/{Oyv13Qiy.js → 5uoxxRrI.js} +1 -1
  6. package/web/app/immutable/chunks/{DG3WDlq-.js → 6M8_bOmN.js} +1 -1
  7. package/web/app/immutable/chunks/{Deb9adiR.js → A6hJVKP1.js} +1 -1
  8. package/web/app/immutable/chunks/{ejm--nzP.js → AXctOpQN.js} +1 -1
  9. package/web/app/immutable/chunks/{D3Rn6g6v.js → B--u_2Nc.js} +2 -2
  10. package/web/app/immutable/chunks/{B9uFsQO_.js → B1YqGJC0.js} +4 -4
  11. package/web/app/immutable/chunks/{CepTMMxo.js → B21KgEqG.js} +1 -1
  12. package/web/app/immutable/chunks/{CpbXIHWP.js → B39I5OLS.js} +1 -1
  13. package/web/app/immutable/chunks/{VWARWUyw.js → B72tYG46.js} +4 -4
  14. package/web/app/immutable/chunks/{D5P99waS.js → B7XrY5h-.js} +1 -1
  15. package/web/app/immutable/chunks/{CB5CVvIg.js → BAPNccEM.js} +1 -1
  16. package/web/app/immutable/chunks/{DwdAFMs6.js → BAnyU7RO.js} +4 -4
  17. package/web/app/immutable/chunks/{D52fecD7.js → BCRcMJ-W.js} +1 -1
  18. package/web/app/immutable/chunks/{Dn1W0Y6I.js → BDS5fuDA.js} +3 -3
  19. package/web/app/immutable/chunks/{BPRVG6k-.js → BECt4TTe.js} +1 -1
  20. package/web/app/immutable/chunks/{Di-it7y2.js → BEwavXhY.js} +1 -1
  21. package/web/app/immutable/chunks/{D1LanoIo.js → BGUCuT7q.js} +1 -1
  22. package/web/app/immutable/chunks/{CDLLVu20.js → BI5bMZSW.js} +1 -1
  23. package/web/app/immutable/chunks/{B4WNkghA.js → BJzXpdtH.js} +1 -1
  24. package/web/app/immutable/chunks/{Czt_AdsD.js → BK68KdNc.js} +1 -1
  25. package/web/app/immutable/chunks/{DhnPdhLH.js → BOz86KDw.js} +1 -1
  26. package/web/app/immutable/chunks/{Dd0GRPZW.js → BQ8X2LHt.js} +1 -1
  27. package/web/app/immutable/chunks/{CCPIWPlX.js → BUq4flUY.js} +3 -3
  28. package/web/app/immutable/chunks/{yHUOSXrf.js → BYPGFyPj.js} +1 -1
  29. package/web/app/immutable/chunks/{D471hSlY.js → B_8PQmWM.js} +1 -1
  30. package/web/app/immutable/chunks/{DnKl4bfl.js → Bafh2cjd.js} +1 -1
  31. package/web/app/immutable/chunks/{ByzmHTuF.js → BdYsGCQ_.js} +1 -1
  32. package/web/app/immutable/chunks/{DU5JIBjp.js → BeYq4r24.js} +1 -1
  33. package/web/app/immutable/chunks/{BCb2Hynx.js → BfQXVs1y.js} +1 -1
  34. package/web/app/immutable/chunks/{BZQMWVq2.js → BfkeWNeb.js} +1 -1
  35. package/web/app/immutable/chunks/{Bd8jLsTN.js → BgRBcaUo.js} +1 -1
  36. package/web/app/immutable/chunks/{C9AQUTrX.js → BhL5eL8L.js} +1 -1
  37. package/web/app/immutable/chunks/{N0DQzoVo.js → BjAL1UGr.js} +1 -1
  38. package/web/app/immutable/chunks/BkA84tNB.js +1 -0
  39. package/web/app/immutable/chunks/{CrI50RYR.js → BlcLvSv0.js} +1 -1
  40. package/web/app/immutable/chunks/{CrdWfEsG.js → Bmbt3TeR.js} +1 -1
  41. package/web/app/immutable/chunks/{C9Gi_ykP.js → Bmq2l9Xx.js} +1 -1
  42. package/web/app/immutable/chunks/{XxrpDha8.js → BoLczGrE.js} +1 -1
  43. package/web/app/immutable/chunks/{B40EQFF1.js → BoTvEsBS.js} +1 -1
  44. package/web/app/immutable/chunks/{Du6fZ610.js → BoZRF0Rb.js} +2 -2
  45. package/web/app/immutable/chunks/{GNBTf9n2.js → BonEtgBU.js} +1 -1
  46. package/web/app/immutable/chunks/{WA5aF6nq.js → BrZfxmOm.js} +1 -1
  47. package/web/app/immutable/chunks/{DaFADtX2.js → Bre5dDRa.js} +1 -1
  48. package/web/app/immutable/chunks/{doMsOb8h.js → Bt2zHtMa.js} +4 -4
  49. package/web/app/immutable/chunks/{CWvv3NtN.js → Bu2DF6bU.js} +1 -1
  50. package/web/app/immutable/chunks/{CkqMzcAU.js → BuuNmCxr.js} +1 -1
  51. package/web/app/immutable/chunks/{CEiAdjWq.js → Bwi005HJ.js} +1 -1
  52. package/web/app/immutable/chunks/{DLfUjnGm.js → BxMfB3uU.js} +1 -1
  53. package/web/app/immutable/chunks/{CBkni_u0.js → C-NPSxo2.js} +1 -1
  54. package/web/app/immutable/chunks/{PO83wZCL.js → C1sOJyFR.js} +1 -1
  55. package/web/app/immutable/chunks/{kkAUANeA.js → C3RH3nH_.js} +1 -1
  56. package/web/app/immutable/chunks/{yrOFcITJ.js → C3lgXrJt.js} +1 -1
  57. package/web/app/immutable/chunks/{rXzX5xZR.js → C3rj6Dod.js} +1 -1
  58. package/web/app/immutable/chunks/{D3EfSPo3.js → C4Mn0Hb-.js} +1 -1
  59. package/web/app/immutable/chunks/{BbN1PgGi.js → C4eFP2Zv.js} +1 -1
  60. package/web/app/immutable/chunks/{AyjU69sJ.js → C7xPtEkO.js} +1 -1
  61. package/web/app/immutable/chunks/{C5G99nVB.js → C9LROoRU.js} +31 -31
  62. package/web/app/immutable/chunks/{CqHhPGmA.js → C9OoGyJu.js} +1 -1
  63. package/web/app/immutable/chunks/{CdvjbMBZ.js → CB6GZsrQ.js} +1 -1
  64. package/web/app/immutable/chunks/{CBPLWyQ8.js → CD4BYSPy.js} +1 -1
  65. package/web/app/immutable/chunks/{BDG2v-O6.js → CDVUC5qK.js} +1 -1
  66. package/web/app/immutable/chunks/{CKjYWqEJ.js → CE70dsdv.js} +1 -1
  67. package/web/app/immutable/chunks/{AZ8Xy_Xh.js → CEGk06kt.js} +2 -2
  68. package/web/app/immutable/chunks/{D-jxMveW.js → CFa2NaXM.js} +1 -1
  69. package/web/app/immutable/chunks/{HwJSjKPR.js → CHFBgXBI.js} +3 -3
  70. package/web/app/immutable/chunks/{CvdR6Bd_.js → CIkMa8dp.js} +1 -1
  71. package/web/app/immutable/chunks/{CmcfBlnY.js → CKI1_bv0.js} +1 -1
  72. package/web/app/immutable/chunks/{DxlrzlUO.js → CKte-e5A.js} +1 -1
  73. package/web/app/immutable/chunks/{CjlM36lq.js → CLXYd9_V.js} +1 -1
  74. package/web/app/immutable/chunks/{DT0KOxBR.js → CM4ereyg.js} +1 -1
  75. package/web/app/immutable/chunks/{COHdP7EQ.js → CM_58O-V.js} +1 -1
  76. package/web/app/immutable/chunks/{fsmCJ9E9.js → CQKd4mJk.js} +1 -1
  77. package/web/app/immutable/chunks/{CjPqlWA8.js → CQhHtQK8.js} +1 -1
  78. package/web/app/immutable/chunks/{BD71gD4J.js → CSHLIIcV.js} +1 -1
  79. package/web/app/immutable/chunks/{CKWWK9AG.js → CSK-Ks7E.js} +2 -2
  80. package/web/app/immutable/chunks/{ocohHyhc.js → CSQeGAbZ.js} +1 -1
  81. package/web/app/immutable/chunks/{C7tJ8OXj.js → CU48trLA.js} +1 -1
  82. package/web/app/immutable/chunks/{D_rjCUs4.js → CV1tpNrG.js} +1 -1
  83. package/web/app/immutable/chunks/{qFl3oWnR.js → CVK5BOxJ.js} +1 -1
  84. package/web/app/immutable/chunks/{D0V81fq2.js → CWq1oZWc.js} +1 -1
  85. package/web/app/immutable/chunks/{DJQD2qGi.js → CXak2CWS.js} +1 -1
  86. package/web/app/immutable/chunks/{Djq26kWU.js → CY8reJZf.js} +1 -1
  87. package/web/app/immutable/chunks/{DepfqAOx.js → Ca9Vj8X7.js} +1 -1
  88. package/web/app/immutable/chunks/{Dk3D2qRF.js → CaSPRIlD.js} +1 -1
  89. package/web/app/immutable/chunks/{B--8cA8U.js → Cbqe96Su.js} +1 -1
  90. package/web/app/immutable/chunks/CdSvrLOZ.js +1 -0
  91. package/web/app/immutable/chunks/{BL1a9dAQ.js → CdjS2YHF.js} +1 -1
  92. package/web/app/immutable/chunks/{G1wxRXy_.js → CevP3sLy.js} +1 -1
  93. package/web/app/immutable/chunks/{BCqeyLEa.js → Cgbm4X7X.js} +1 -1
  94. package/web/app/immutable/chunks/{5cZE-Bb1.js → Chs5DYDz.js} +1 -1
  95. package/web/app/immutable/chunks/{BmvbrR5U.js → CiDOKjBy.js} +1 -1
  96. package/web/app/immutable/chunks/{Btd6UQfU.js → CjuCfT-H.js} +1 -1
  97. package/web/app/immutable/chunks/{BslfCNif.js → Cl6etYZ6.js} +1 -1
  98. package/web/app/immutable/chunks/{CuG3zmBQ.js → Cld1FvNn.js} +1 -1
  99. package/web/app/immutable/chunks/{DLZwi7N_.js → Coz3Oj0D.js} +1 -1
  100. package/web/app/immutable/chunks/{vFmgUcY-.js → Cp-V-kX1.js} +1 -1
  101. package/web/app/immutable/chunks/{CkfQIblp.js → CpjcO2UG.js} +1 -1
  102. package/web/app/immutable/chunks/{BjdDije1.js → CrVg-aIz.js} +1 -1
  103. package/web/app/immutable/chunks/{3E3FFIBp.js → D-WYdZmt.js} +1 -1
  104. package/web/app/immutable/chunks/{CMK6nD4P.js → D0OCVTi-.js} +3 -3
  105. package/web/app/immutable/chunks/{DzPu3hXf.js → D11PDukO.js} +1 -1
  106. package/web/app/immutable/chunks/{CtQODp8h.js → D1EdV32Z.js} +3 -3
  107. package/web/app/immutable/chunks/{Dtd8hHcj.js → D22mDMme.js} +1 -1
  108. package/web/app/immutable/chunks/{DNj5HeWT.js → D2HdgcKm.js} +1 -1
  109. package/web/app/immutable/chunks/{BgvNw2ix.js → D4JuvJNp.js} +1 -1
  110. package/web/app/immutable/chunks/{DY9qQwsB.js → D6fddbvu.js} +1 -1
  111. package/web/app/immutable/chunks/D6jebcOi.js +1 -0
  112. package/web/app/immutable/chunks/{DGeJx6D0.js → D7NtVhAr.js} +1 -1
  113. package/web/app/immutable/chunks/{buk5RAoP.js → D7lNUU6C.js} +1 -1
  114. package/web/app/immutable/chunks/{L73m0JEz.js → D83kA8oL.js} +2 -2
  115. package/web/app/immutable/chunks/{DblIbdBw.js → D90JUNRF.js} +1 -1
  116. package/web/app/immutable/chunks/{fvC-6LgA.js → D98guX46.js} +1 -1
  117. package/web/app/immutable/chunks/{kDhfBVjP.js → D9pex3XI.js} +1 -1
  118. package/web/app/immutable/chunks/{lV2DHKlu.js → DC7_gAhS.js} +1 -1
  119. package/web/app/immutable/chunks/{YglZqzQH.js → DEnGZxZ_.js} +1 -1
  120. package/web/app/immutable/chunks/{DcNaMmNl.js → DFPzxECW.js} +1 -1
  121. package/web/app/immutable/chunks/{0fyWevd4.js → DH2Upu6c.js} +1 -1
  122. package/web/app/immutable/chunks/{CbOr2Wo7.js → DHlDoleO.js} +1 -1
  123. package/web/app/immutable/chunks/{CJ5wd9GV.js → DIPuiSIu.js} +1 -1
  124. package/web/app/immutable/chunks/{Z89jOfre.js → DJ0Jx38f.js} +1 -1
  125. package/web/app/immutable/chunks/{DFHDo6Bi.js → DJ_p0OFU.js} +1 -1
  126. package/web/app/immutable/chunks/{Coi-YeL3.js → DLimNxdW.js} +1 -1
  127. package/web/app/immutable/chunks/{CvCvufVJ.js → DMFMx3nl.js} +1 -1
  128. package/web/app/immutable/chunks/{Cax0Mn2M.js → DMXfYyb6.js} +1 -1
  129. package/web/app/immutable/chunks/{JLBeR_lu.js → DN7oXRlP.js} +1 -1
  130. package/web/app/immutable/chunks/{CkxlqZls.js → DPKwA49z.js} +2 -2
  131. package/web/app/immutable/chunks/{BZCr6ykZ.js → DPk0hNVC.js} +1 -1
  132. package/web/app/immutable/chunks/{On9oBe3C.js → DQqi7m2D.js} +1 -1
  133. package/web/app/immutable/chunks/{_XUW51Cy.js → DR11idWf.js} +1 -1
  134. package/web/app/immutable/chunks/{byhfHhUo.js → DSqWFvtc.js} +1 -1
  135. package/web/app/immutable/chunks/{BqRgQbJq.js → DVgQbSSY.js} +1 -1
  136. package/web/app/immutable/chunks/{BdlgOWZv.js → DVmH_mdJ.js} +1 -1
  137. package/web/app/immutable/chunks/{BOpfuH36.js → DZ_5eRdK.js} +1 -1
  138. package/web/app/immutable/chunks/{glaRhtwK.js → DZmWXrCy.js} +2 -2
  139. package/web/app/immutable/chunks/{Djx7tjiF.js → D_6coCxv.js} +1 -1
  140. package/web/app/immutable/chunks/{DNnYGTTZ.js → DbmNxzez.js} +1 -1
  141. package/web/app/immutable/chunks/{C2Dp-Wl8.js → De-23Gnq.js} +1 -1
  142. package/web/app/immutable/chunks/{CcoWXdk5.js → De3GtDyW.js} +1 -1
  143. package/web/app/immutable/chunks/{CyVE_a1Z.js → DfFnGsMp.js} +1 -1
  144. package/web/app/immutable/chunks/{CgH2fhQZ.js → DgCFRQUb.js} +1 -1
  145. package/web/app/immutable/chunks/{Cn80JY_U.js → DhuTnbBI.js} +1 -1
  146. package/web/app/immutable/chunks/{CgmFGCOs.js → Di6UqIba.js} +1 -1
  147. package/web/app/immutable/chunks/{DzLCtzaZ.js → DifIxf0d.js} +1 -1
  148. package/web/app/immutable/chunks/{BOXzTbe3.js → DkHPIJea.js} +1 -1
  149. package/web/app/immutable/chunks/{C0yEwiys.js → DlJukBla.js} +1 -1
  150. package/web/app/immutable/chunks/{BTU_oKHo.js → DlQfuVhT.js} +1 -1
  151. package/web/app/immutable/chunks/{NUieU9w-.js → DlX8LW3G.js} +1 -1
  152. package/web/app/immutable/chunks/{Cf7gW7aB.js → DmSaqClG.js} +1 -1
  153. package/web/app/immutable/chunks/{DiFdx5oB.js → DokMbojI.js} +1 -1
  154. package/web/app/immutable/chunks/{Cv7PDz7N.js → DrzNBKRX.js} +1 -1
  155. package/web/app/immutable/chunks/{DQ6qUzf1.js → Ds6w291j.js} +1 -1
  156. package/web/app/immutable/chunks/{Bggds_Lj.js → DtBQtTbR.js} +1 -1
  157. package/web/app/immutable/chunks/{Cg1IDzIA.js → DusCCxOz.js} +1 -1
  158. package/web/app/immutable/chunks/{F6JYuVa2.js → DvOPTg8o.js} +1 -1
  159. package/web/app/immutable/chunks/{DBLkjlmS.js → DxjLRZie.js} +1 -1
  160. package/web/app/immutable/chunks/{x7yWobyq.js → DyY04EMd.js} +1 -1
  161. package/web/app/immutable/chunks/{CWfbH15T.js → DzV2tP7D.js} +1 -1
  162. package/web/app/immutable/chunks/{CJsbK-x_.js → EIfr2WPF.js} +1 -1
  163. package/web/app/immutable/chunks/{BrYUi9M4.js → EUhChSgv.js} +1 -1
  164. package/web/app/immutable/chunks/{CP1rOWJf.js → HTMQjphG.js} +1 -1
  165. package/web/app/immutable/chunks/{D2qgPGPl.js → Hn8VNjVU.js} +1 -1
  166. package/web/app/immutable/chunks/{De27JRFf.js → MVAiW-hJ.js} +1 -1
  167. package/web/app/immutable/chunks/OnVg69qn.js +1 -0
  168. package/web/app/immutable/chunks/{6gXfEeGO.js → QThbrY7P.js} +1 -1
  169. package/web/app/immutable/chunks/{Dy7XitXS.js → QoEJNfmE.js} +2 -2
  170. package/web/app/immutable/chunks/{d5Uq64N6.js → RXp9Ya1-.js} +1 -1
  171. package/web/app/immutable/chunks/{CV_50DRv.js → SvsTsrhb.js} +1 -1
  172. package/web/app/immutable/chunks/{C72TMHEI.js → Vl66GswY.js} +1 -1
  173. package/web/app/immutable/chunks/{DdLb4YD1.js → _Ak2VoUq.js} +1 -1
  174. package/web/app/immutable/chunks/{CMGOeDRU.js → _NdW2WBC.js} +2 -2
  175. package/web/app/immutable/chunks/{DGx3tKbO.js → _bOTv1mB.js} +1 -1
  176. package/web/app/immutable/chunks/{D05xLrNx.js → d0funJ1P.js} +1 -1
  177. package/web/app/immutable/chunks/{C0Yhbcvw.js → ek2C_PyH.js} +1 -1
  178. package/web/app/immutable/chunks/{Cu8PqUia.js → ev7flkaM.js} +1 -1
  179. package/web/app/immutable/chunks/{DgMHJRTi.js → evZTPwS7.js} +4 -4
  180. package/web/app/immutable/chunks/{BQyjLiC0.js → gfWJw24O.js} +1 -1
  181. package/web/app/immutable/chunks/{BiL4QTcV.js → i4GmiVMD.js} +1 -1
  182. package/web/app/immutable/chunks/ikBj1eYj.js +1 -0
  183. package/web/app/immutable/chunks/{DIbhT_40.js → pgv9jNmm.js} +1 -1
  184. package/web/app/immutable/chunks/{Cnd1Toz7.js → pwWESNJZ.js} +1 -1
  185. package/web/app/immutable/chunks/{Ctf7Dmj8.js → rTUEOx0p.js} +2 -2
  186. package/web/app/immutable/chunks/{D_wC6Fqe.js → uFuCUyKk.js} +1 -1
  187. package/web/app/immutable/chunks/{DXWj1WUy.js → v1s2zbkS.js} +1 -1
  188. package/web/app/immutable/chunks/{Zl6q5v_F.js → v_4lRRTK.js} +1 -1
  189. package/web/app/immutable/chunks/{ByvADqYQ.js → x3PmW7lX.js} +1 -1
  190. package/web/app/immutable/chunks/{oZSR7jB5.js → xe2H3EkW.js} +2 -2
  191. package/web/app/immutable/chunks/{C9iqPxLd.js → yiVXShkh.js} +1 -1
  192. package/web/app/immutable/chunks/{BfQMGn9-.js → zK_pBQnY.js} +1 -1
  193. package/web/app/immutable/chunks/{DgebLBJ3.js → zgW9h7_p.js} +2 -2
  194. package/web/app/immutable/entry/{app.DgJ9n1oL.js → app.CbA16NuX.js} +2 -2
  195. package/web/app/immutable/entry/start.Bk8Z1djZ.js +1 -0
  196. package/web/app/immutable/nodes/{0.Dyl0nNbk.js → 0.BasYUO8v.js} +1 -1
  197. package/web/app/immutable/nodes/{1.CRLYaZ63.js → 1.CIO3OA-k.js} +1 -1
  198. package/web/app/immutable/nodes/{10.DxPon5wB.js → 10.CFi8hf1p.js} +1 -1
  199. package/web/app/immutable/nodes/{12.zW0eyaJh.js → 12.5Zegs-e7.js} +1 -1
  200. package/web/app/immutable/nodes/{13.BC8MED3o.js → 13.C6rcyOvO.js} +1 -1
  201. package/web/app/immutable/nodes/{14.B4mlyc1_.js → 14.BshK7qxH.js} +1 -1
  202. package/web/app/immutable/nodes/{15.BMXR1gHR.js → 15.Xbhs2JLI.js} +1 -1
  203. package/web/app/immutable/nodes/{16.vNaF6DA8.js → 16.D1Kda7eS.js} +1 -1
  204. package/web/app/immutable/nodes/{17.MrvR2td2.js → 17.BWDMPbmT.js} +1 -1
  205. package/web/app/immutable/nodes/{18.8z39u87k.js → 18.C5ulMwTp.js} +2 -2
  206. package/web/app/immutable/nodes/{2.BA0oK1QI.js → 2.BNqRZUPf.js} +11 -11
  207. package/web/app/immutable/nodes/{3.BR33xGjs.js → 3.Cvuu_muM.js} +1 -1
  208. package/web/app/immutable/nodes/{4.Cd06_jG8.js → 4.DN_ujY3l.js} +1 -1
  209. package/web/app/immutable/nodes/{5.C8pevtne.js → 5.Dec4Arss.js} +1 -1
  210. package/web/app/immutable/nodes/{6.haMdZkdJ.js → 6.DpEHMH4c.js} +1 -1
  211. package/web/app/immutable/nodes/{7.qUwyypfP.js → 7.Dv3u39NY.js} +1 -1
  212. package/web/app/immutable/nodes/{8.B9LxN_HF.js → 8.J1fqiqGl.js} +4 -4
  213. package/web/app/immutable/nodes/{9.CuzqllGK.js → 9.Du0PNcOn.js} +5 -5
  214. package/web/app/version.json +1 -1
  215. package/web/index.html +15 -15
  216. package/web/app/immutable/chunks/9bhdf_gz.js +0 -1
  217. package/web/app/immutable/chunks/BGikh8Vc.js +0 -1
  218. package/web/app/immutable/chunks/BbcaUswI.js +0 -1
  219. package/web/app/immutable/chunks/Dnem51XN.js +0 -1
  220. package/web/app/immutable/chunks/WtQ21IhK.js +0 -1
  221. package/web/app/immutable/entry/start.4H5rT-16.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/BOXzTbe3.js","/app/immutable/chunks/F6JYuVa2.js","/app/immutable/chunks/BGikh8Vc.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BkP7iWmk.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Cmsd5u03.js","/app/immutable/chunks/DdeuoyZB.js","/app/immutable/chunks/C400w5jq.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/BTU_oKHo.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/eF4sVb1p.js","/app/immutable/chunks/CkxlqZls.js","/app/immutable/chunks/CeRzgChF.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/Dwtk3MUL.js","/app/immutable/chunks/BNaYSa9e.js","/app/immutable/chunks/EFalm4kN.js","/app/immutable/chunks/DY9qQwsB.js","/app/immutable/chunks/fvC-6LgA.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/K9ol5Tjr.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/Duz2cV7w.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/COHdP7EQ.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/BCqeyLEa.js","/app/immutable/chunks/Zl6q5v_F.js","/app/immutable/chunks/Cnd1Toz7.js","/app/immutable/chunks/Oyv13Qiy.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/CJ5wd9GV.js","/app/immutable/chunks/DhnPdhLH.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/glaRhtwK.js","/app/immutable/chunks/Di-it7y2.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/DxlrzlUO.js","/app/immutable/chunks/CepTMMxo.js","/app/immutable/chunks/kDhfBVjP.js"])))=>i.map(i=>d[i]);
2
- var Ct=Object.defineProperty;var Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Dt(e,typeof t!="symbol"?t+"":t,n);import{II as A,i as be,nA as R,vV as Rt,BL as Ge,vX as xt,CY as Ye,cA as Pt,cB as Bt,nB as Je,nn as Ot,e as ke,fI as $t,lQ as Lt,cI as Ut}from"./fvC-6LgA.js";import{B as Nt,O as Ht,dH as Be,cG as pe,ds as Ft,al as Kt,b1 as Qe,z as Wt,dT as jt}from"./COHdP7EQ.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./K9ol5Tjr.js";import{D as Oe,a as Xt,d as Zt}from"./CQcEqK4G.js";import{l as en,o as tn,g as Ze,r as nn,m as an,D as rn}from"./0fyWevd4.js";import{a as et,e as sn}from"./CJ5wd9GV.js";import{f as on}from"./Bvdrq2il.js";import{bm as b,_ as fe}from"./BkP7iWmk.js";import{a9 as tt,aA as se,J as he,a as nt,n as at,cQ as rt,e as st,aH as it,M as cn,ab as ln,aT as $e,d as le,C as dn,cR as un,U as mn,a6 as pn,aI as fn,bY as hn}from"./DepfqAOx.js";import{W as gn,L as yn,w as wn,R as bn,M as kn,h as vn}from"./CkxlqZls.js";import{N as _n,z as Sn}from"./BGikh8Vc.js";import{t as q,q as Mn,v as An}from"./EFalm4kN.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./HwJSjKPR.js";import{a as Le,b as Dn,g as Rn}from"./DypB-Dwi.js";import{K as xn}from"./Zl6q5v_F.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./DBLkjlmS.js";import{o as $,e as On,l as V,s as E,n as ce,b as $n,d as Ln,c as Un}from"./CIyUrgF0.js";const Rr=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),xr=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Pr=A.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const i of Object.values(s.panels))for(const o of i.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}});function Br(e,t){if(e)return e.model}function Nn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Or({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Nt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function $r(e){return Ht(e.messageMetadata)}function Hn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Lr(e){return Hn({...e,createdAt:Date.parse(e.queuedAt)})}const Fn=8*1024*1024,Kn=3*1024*1024;function Wn(e){return Math.ceil(Math.max(0,e)/3)*4}function jn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Kn&&typeof t=="number"&&t===Wn(e.size)?t:null}async function ot(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const i=en(e.source,e.saved);if(i.length>1e4)throw new Error("media-animation-layer-limit");const o=[];for(const c of i)s(),o.push({...c,png:await tn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:qt,jobId:t,media:e,layers:o});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const _e={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Ue(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function qn(e){const t=e.video==="full"?b.dock_captureEditor_videoFull_label():b.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?b.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?b.dock_captureEditor_voiceTranscript_label():b.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Vn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const j=on;function Ur(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=Vn(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,i,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",h=c?.error==="permission"&&c.kind==="pick",p=i?.startsWith("speech-permission")?"speech":i?.startsWith("microphone-permission")||i==="permission"?"microphone":void 0,m={},y={},f=(g,D,U)=>{m[g]=D,U&&(y[g]=U)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),h&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(i&&r.speechError?.(i))??s.speechPermission,p));const k=g=>{const D=y[g];D&&e.actions.onOpenSettings(D)},v=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),S=t.clips.length>=ae.clips,_=t.capabilities,B=t.speech.available,C=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!C.has(g.id)||D.some(({mark:U})=>!U.clipId)).map(({image:g,marks:D})=>({kind:"image",id:g.contextItemId,url:a.previews[g.id]??"",markCount:D.length,owner:"evidence",...a.previews[g.id]?{}:{status:"placing"}})),...t.clips.filter(g=>!g.discarding).map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:j(g.status==="recording"?Ue(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:qn(g.media.saved)}:{},...g.status==="ready"&&ge(e.workspaceId,g.path)?{url:ge(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:b.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!v.has(g.id)).map(g=>({...g.imageData&&g.imageMimeType?{kind:"image",id:g.id,url:`data:${g.imageMimeType};base64,${g.imageData}`,markCount:0,file:{name:g.label,imageData:g.imageData,imageMimeType:g.imageMimeType}}:{kind:"file",id:g.id,name:g.label},owner:"attachment",...g.placementStatus==="placing"?{status:"placing"}:{},...g.placementStatus==="failed"?{status:"failed",error:g.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.dictation?{kind:"listening",label:r.listening}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!_.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!_.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!_.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!_.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:j(I?Ue(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?j(a.now-t.dictation.startedAt):j(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,zn=["image/png","image/jpeg","image/webp"],Ne=e=>zn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function Nr(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const y=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:y,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:y,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),h=r[s.image.id];return!c?.imageData||!u||!h?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(h),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const i=n.clips.find(c=>c.id===e||c.contextItemId===e);if(i){const c=i.status==="ready"?ge(t.workspaceId,i.path):null;if(!c)return null;const d=a.find(h=>h.id===i.contextItemId),u=await t.fetchBytes(c);if(!Yn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${i.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:i.durationMs,hasMicAudio:i.hasMicAudio}}const o=a.find(c=>c.id===e),l=Ne(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:He(o.imageData)}:null}async function Gn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Yn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Hr(e){try{return(await Se()?.invoke(_e.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Jn(){try{return await Se()?.invoke(_e.CLIPBOARD_READ,{})??null}catch{return null}}async function Fr(e){try{const t=await Se()?.invoke(_e.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function Qn(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Kr(e,{onIntentMedia:t,isCurrent:n,read:a=Jn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,i=Array.from(r.files),o=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Qn(i,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of i)c.items.add(u);for(const[u,h]of o)c.setData(u,h);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function Xn(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function Zn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function ct(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function ea(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const lt={placeAttachment:it,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Me(e,t,n,a=lt){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},i=async m=>un(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=cn)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const y=await i(m);if(y)return y;throw m}const o=Xn(n.data),l=await ea(o);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&ln(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(mn,d),h=Math.ceil(o.byteLength/u);let p=!1;try{for(let m=0;m<h;m++){const y=o.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,Zn(y),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const y=p?await i(m):void 0;if(y)return y;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ta(e,t){return pn(e,`image-${Date.now()}-${t+1}`)}class Ae extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function na(e,t){return e instanceof Ae?e.retryBlocks:t}async function aa(e,t,n=lt,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],i=[],o=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),i.push(p);continue}const d=c,u=d.placementFileName??ta(d.mimeType,l),h=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Me(e,u,{data:d.data,mimeType:d.mimeType,...h!==void 0?{idempotencyKey:h}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),i.push(m)}catch(p){const m=dn(p);o.push(m?`${u} (${m})`:u),i.push(h!==void 0?{...d,placementIdempotencyKey:h,placementFileName:u}:d)}}if(o.length>0)throw new Ae(b.chat_imagePlacement_failed_error({names:o.join(", ")}),i);return le(a),s}const Wr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:na,placeImageAttachment:Me,toImageReferenceBlocks:aa},Symbol.toStringTag,{value:"Module"}));function dt(){try{return gn()}catch{return null}}function ra(){return{backendId:A.state.connections.windowBackendId??null,generation:A.state.daemonHealth.connectionGeneration,transport:dt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const H={current:e=>dt()===e.transport&&A.state.daemonHealth.connectionGeneration===e.generation&&(A.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>yn(),placeImage:(e,t,n,a)=>Me(e,t,n,{placeAttachment:N(a,it),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function G(e){return H.current(e)}function sa(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:R(n.drafts,Vt(e,t))?.clearRevision??0,binding:ra()}}function jr(e,t,n){const a=sa(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&G(n.binding)}function ut(e,t){return()=>{if(!e.current(t))throw new Ie}}const mt=Object.freeze({rawRetention:!1,chiefAttachments:!1});function qr(e){return e!==mt}const de=new Map;function pt(e,t=H){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=ut(t,e);a=(async()=>{r();const i=await t.capabilities();r();const o=i?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(de.delete(n),mt)),de.set(n,a)}return a}class Z extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function ft(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function ia(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function oa(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class ca extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function la(e){const t=e.api??H,n=e.now??Date.now,a=ut(t,e.binding);a();const r=await pt(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),i=[];for(const o of e.images){const l=e.records[o.image.id];let c=l&&l.signature===o.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:o.image.id,signature:o.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const h=c.compositeKey,p=t.mintKey(h??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${We(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??o.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&o.raw&&!c.raw&&!c.rawSettled){const h=c.rawKey,p=t.mintKey(h??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${We(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const y=oa(m,u,n());if(y==="expired")d({...c,rawSettled:!0});else if(y)d({...c,raw:y});else throw new Z("echo")}catch(y){if(ia(y))d({...c,rawSettled:!0});else throw y instanceof Z?y:ft(y)?new Z("refused"):y}}else throw new Z("unkeyed")}}catch(u){throw u instanceof Ie?u:new ca(o.image.id,u)}i.push(c)}return i}async function Vr(e,t,n,a){const r=()=>{if(!H.current(a))throw new Ie};r();const s=await H.placeImage(e,t,{...n,idempotencyKey:H.mintKey()},r);return r(),s}const da=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),ua=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class O extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ie(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!da.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>ua.has(r)?r:"other")].join(":")}function zr(e,t){return e instanceof O?{stage:e.stage,code:ie(e.code)}:{stage:t,code:ie(e)}}function F(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=ve(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ma(e,t,n,a,r,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let o="validate";try{const l=()=>{if(!r()||!G(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(o="validate",s?.stage(o),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||F(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let h=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&h.voice==="transcript"&&d.transcript?.status!=="ready"){if(o="transcribe",s?.stage(o),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(h=re(u,u.capturedMarks??[],d.transcript))}o="plan",s?.stage(o);const m=ve(h,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const y={id:c.id,kind:u.kind,video:h.video,voice:h.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:v})=>({n:f,id:k.id,at_ms:v,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){o="screenshot-source",s?.stage(o);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const v=await Gn(k.url);l();const I={base64:Ze(v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};o="screenshot-render",s?.stage(o),i.images[c.id]=await nn(u,h,I),l()}else{if(!m.clips.length){y.video_attachment_id=null,y.frames=[],y.kept_ms=[],i.metadata.push(y);continue}const f={...d,saved:h};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await ot(f,p,a,()=>r()&&G(n),S=>{o=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,o="placement",s?.stage(o);const v=[k.value.video,...k.value.frames],I=[];for(let S=0;S<v.length;S++){l();const _=v[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":_.mimeType==="image/jpeg"?"jpg":"png"}`,C=await fn(e,B,{sourcePath:_.sourcePath,mimeType:_.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&G(n));l(),S===0?i.files.push({type:"file",attachmentId:C.attachmentId,fileName:B,mimeType:C.mimeType??_.mimeType,size:C.size}):(i.frames.push({type:"image",attachmentId:C.attachmentId,mimeType:_.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push(jn(_))),I.push(C.attachmentId)}y.video_attachment_id=I[0],y.frames=k.value.frames.map((S,_)=>({mark_id:S.markId,attachment_id:I[_+1]})),y.kept_ms=m.clips}i.metadata.push(y)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return i}catch(l){throw l instanceof O?l:new O(o,ie(l))}}const ue=1568,pa=.85;async function fa(e,t){const n=Math.round(e.length*3/4/1024),a=await ha(e,t),{width:r,height:s}=a,i=r>ue||s>ue;let o=r,l=s;if(i){const f=ue/Math.max(r,s);o=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(o,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,o,l);let u=t;ga(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?pa:void 0}),p=h.type||u,m=await ya(h),y=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${o}×${l} | ${t} → ${p} | ${n} KB → ${y} KB`),{base64:m,mimeType:p}}async function ha(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ga(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ya(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Oe,badge:Oe.badgeRadius*2};function wa(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],i=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:i(c.x),y:i(c.y),w:i(c.w),h:i(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:i(m.x),y:i(m.y)})),width:T.pen*r});else{const m={x:i(c.from.x),y:i(c.from.y)},y={x:i(c.to.x),y:i(c.to.y)};s.push({kind:"arrow",from:m,to:y,head:Sa(m,y,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=i(l.bounds.x+l.bounds.w),h=i(l.bounds.y),p=Zt({x:i(l.bounds.x),y:h,w:u-i(l.bounds.x),h:i(l.bounds.h)},{x:0,y:0,w:i(e.width),h:i(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(o),font:d*T.badgeTextScale})}return s}function ba(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((i,o)=>o?e.lineTo(i.x,i.y):e.moveTo(i.x,i.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(Xt(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function ka(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function va(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function ht(e,t,n,a,r=0){await an();const s=await ka(e.base64,e.mimeType);try{const i=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*i)),Math.max(1,Math.round(t.height*i))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,o.width,o.height),ba(l,wa(t,n,i,r)),o}finally{s.close()}}async function _a(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return fa(await va(a),"image/png")}async function Gr(e,t,n,a=384){const r=await ht(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function Sa(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function Yr(e,t){const n=zt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!F(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function Jr({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:i,service:o,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!G(i))throw new O("validate","media-send-retired")};if(u(),n?.images.some(w=>w.mediaError)||n?.clips.some(w=>w.mediaError))throw new O("validate","invalid-saved-edit");const h=w=>!!w.media&&!F(w.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(w=>[w.id,a.find(M=>M.id===w.contextItemId)?.attachmentId??null]))}:null;for(const w of n?.clips??[]){if(!w.media||!F(w.media))continue;const M=a.find(Q=>Q.id===w.contextItemId);if(!M||M.attachmentId!==w.media.source.attachmentId||M.path!==w.media.source.path||M.placementStatus!==void 0&&M.placementStatus!=="placed")throw new O("validate","legacy-original-unavailable")}const m=n?await ma(e,n,i,o,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},y=new Set(n?.clips.filter(w=>h(w)||!!w.media&&F(w.media)).map(w=>w.id)),f=new Set(n?.clips.filter(w=>y.has(w.id)).flatMap(w=>(w.captureHistory??[]).map(M=>M.image.id))),k=(n?.images??[]).filter(w=>w.source!=="annotate"||!!w.media||!f.has(w.id)||n.marks.some(M=>M.imageId===w.id&&!(M.clipId&&y.has(M.clipId))));d?.stage("burn");let v=[];try{v=n?await Ma({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Fn)throw new O("validate","image-budget-exceeded");const S=new Set(n?.images.filter(w=>w.media).map(w=>w.id)),_=n?{...n,images:k.map(w=>m.images[w.id]?{...w,width:m.images[w.id].width,height:m.images[w.id].height}:w),clips:n.clips.filter(w=>!h(w)),marks:n.marks.filter(w=>!S.has(w.imageId)&&!n.clips.some(M=>h(M)&&M.id===w.clipId))}:null;u();const B=m.metadata.some(w=>typeof w.transcript=="string"&&w.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!v.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let C=v,P=null;d?.stage("placement");const xe=n?await pt(i):null;if(u(),n&&(e!==be||xe?.chiefAttachments)){const w=await la({workspaceId:e,binding:i,images:k.map((M,Q)=>{const X=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[Q].data,mimeType:v[Q].mimeType},raw:!M.media&&X?.imageData&&X.imageMimeType?{base64:X.imageData,mimeType:X.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),C=w.map(M=>({type:"image",attachmentId:M.composite.attachmentId,mimeType:M.composite.mimeType})),P=Object.fromEntries(w.map(M=>[M.imageId,{attachmentId:M.composite.attachmentId,raw:M.raw}]))}const g=new Map(n?Xe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},U=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Jt(_,D),m.metadata.length?`[Edited capture outputs]
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["/app/immutable/chunks/DkHPIJea.js","/app/immutable/chunks/DvOPTg8o.js","/app/immutable/chunks/BkA84tNB.js","/app/immutable/chunks/CIyUrgF0.js","/app/immutable/chunks/BkP7iWmk.js","/app/immutable/chunks/DYhIMPy1.js","/app/immutable/chunks/Cmsd5u03.js","/app/immutable/chunks/DdeuoyZB.js","/app/immutable/chunks/C400w5jq.js","/app/immutable/assets/spinner.D_TRo5Hy.css","/app/immutable/chunks/DlQfuVhT.js","/app/immutable/chunks/BaIAhI85.js","/app/immutable/chunks/eF4sVb1p.js","/app/immutable/chunks/DPKwA49z.js","/app/immutable/chunks/CeRzgChF.js","/app/immutable/chunks/uXuxG9cN.js","/app/immutable/assets/button.-yaUNjRS.css","/app/immutable/chunks/Dwtk3MUL.js","/app/immutable/chunks/BNaYSa9e.js","/app/immutable/chunks/EFalm4kN.js","/app/immutable/chunks/D6fddbvu.js","/app/immutable/chunks/D98guX46.js","/app/immutable/chunks/WFvSJ9zU.js","/app/immutable/chunks/ChTqQfQN.js","/app/immutable/chunks/K9ol5Tjr.js","/app/immutable/chunks/DxwfiAWm.js","/app/immutable/chunks/DfxQWSVU.js","/app/immutable/chunks/Duz2cV7w.js","/app/immutable/chunks/BWYr8u9e.js","/app/immutable/chunks/XJv96NUg.js","/app/immutable/assets/notify.B1j5oT2y.css","/app/immutable/chunks/CM_58O-V.js","/app/immutable/chunks/DypB-Dwi.js","/app/immutable/chunks/Cgbm4X7X.js","/app/immutable/chunks/v_4lRRTK.js","/app/immutable/chunks/pwWESNJZ.js","/app/immutable/chunks/5uoxxRrI.js","/app/immutable/chunks/BvFAWM27.js","/app/immutable/chunks/DIPuiSIu.js","/app/immutable/chunks/BOz86KDw.js","/app/immutable/chunks/BdWqymET.js","/app/immutable/chunks/DZmWXrCy.js","/app/immutable/chunks/BEwavXhY.js","/app/immutable/chunks/CMiilI_P.js","/app/immutable/chunks/CKte-e5A.js","/app/immutable/chunks/B21KgEqG.js","/app/immutable/chunks/D9pex3XI.js"])))=>i.map(i=>d[i]);
2
+ var Ct=Object.defineProperty;var Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Dt(e,typeof t!="symbol"?t+"":t,n);import{II as A,i as be,nA as R,vV as Rt,BL as Ge,vX as xt,CY as Ye,cA as Pt,cB as Bt,nB as Je,nn as Ot,e as ke,fI as $t,lQ as Lt,cI as Ut}from"./D98guX46.js";import{B as Nt,O as Ht,dH as Be,cG as pe,ds as Ft,al as Kt,b1 as Qe,z as Wt,dT as jt}from"./CM_58O-V.js";import{e as qt,b as ae,F as Vt,y as re,_ as ve,G as zt,C as Gt,W as Xe,v as Yt,u as Jt,M as Qt}from"./K9ol5Tjr.js";import{D as Oe,a as Xt,d as Zt}from"./CQcEqK4G.js";import{l as en,o as tn,g as Ze,r as nn,m as an,D as rn}from"./DH2Upu6c.js";import{a as et,e as sn}from"./DIPuiSIu.js";import{f as on}from"./Bvdrq2il.js";import{bm as b,_ as fe}from"./BkP7iWmk.js";import{a9 as tt,aA as se,J as he,a as nt,n as at,cQ as rt,e as st,aH as it,M as cn,ab as ln,aT as $e,d as le,C as dn,cR as un,U as mn,a6 as pn,aI as fn,bY as hn}from"./Ca9Vj8X7.js";import{W as gn,L as yn,w as wn,R as bn,M as kn,h as vn}from"./DPKwA49z.js";import{N as _n,z as Sn}from"./BkA84tNB.js";import{t as q,q as Mn,v as An}from"./EFalm4kN.js";import{x as In,J as Tn,ai as En,ar as Cn}from"./CHFBgXBI.js";import{a as Le,b as Dn,g as Rn}from"./DypB-Dwi.js";import{K as xn}from"./v_4lRRTK.js";import{C as Pn}from"./BvFAWM27.js";import{i as Bn}from"./DxjLRZie.js";import{o as $,e as On,l as V,s as E,n as ce,b as $n,d as Ln,c as Un}from"./CIyUrgF0.js";const Rr=A.createSelector((e,t)=>e.unreadTracking.dividerSessionByAgentId[t]??null),xr=A.createSelector(e=>e.unreadTracking.currentlyViewedAgentId),Pr=A.createSelector(e=>{const t=[];for(const s of Object.values(e.panelLayout.byWorkspaceId))for(const i of Object.values(s.panels))for(const o of i.tabs)o.type==="agent"&&o.agentId&&t.push(o.agentId);const n=Object.keys(e.unreadTracking.dividerSessionByAgentId),a=new Set(e.agentSessions.agentIdsByWorkspace[be]??[]);return{chiefCardVisible:e.sidebarNav.panelItem==="chief",chiefSessionAgentIds:n.filter(s=>a.has(s)),dividerSessionAgentIds:n,openAgentTabIds:t}});function Br(e,t){if(e)return e.model}function Nn({messages:e,pendingInitialPrompt:t,pendingContextReferenceCount:n=0}){return e.length>0||!!t||n>0}function Or({session:e,messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a=0}){return!(e?Nt(e):!1)&&!Nn({messages:t,pendingInitialPrompt:n,pendingContextReferenceCount:a})}function $r(e){return Ht(e.messageMetadata)}function Hn(e){return{id:e.id,appMessageId:e.appMessageId,role:"user",timestamp:new Date(e.createdAt??0).toISOString(),contentBlocks:[...e.content?[{type:"text",text:e.content}]:[],...e.imageBlocks??[],...e.fileBlocks??[]],metadata:e.messageMetadata,...e.author!==void 0?{author:e.author}:{}}}function Lr(e){return Hn({...e,createdAt:Date.parse(e.queuedAt)})}const Fn=8*1024*1024,Kn=3*1024*1024;function Wn(e){return Math.ceil(Math.max(0,e)/3)*4}function jn(e){const t=e.promptBase64Bytes;return e.mimeType==="image/jpeg"&&Number.isSafeInteger(e.size)&&e.size>0&&e.size<=Kn&&typeof t=="number"&&t===Wn(e.size)?t:null}async function ot(e,t,n,a,r=()=>{}){const s=()=>{if(!a())throw new Error("media-send-retired")};if(s(),r("overlay-render"),!n.exportMedia)throw new Error("media-export-unavailable");const i=en(e.source,e.saved);if(i.length>1e4)throw new Error("media-animation-layer-limit");const o=[];for(const c of i)s(),o.push({...c,png:await tn(e.source,e.saved,c.atMs)});s(),r("export");const l=await n.exportMedia({outputVersion:qt,jobId:t,media:e,layers:o});if(s(),!l.ok)throw new Error(["media-export-failed",l.error].filter(Boolean).join(":"));return{jobId:t,value:l.value}}const _e={CLIPBOARD_WRITE:"dock-media:clipboard-write",CLIPBOARD_READ:"dock-media:clipboard-read",MENU:"dock-media:menu"};function Ue(e,t){return Math.max(0,(e.pausedAt??t)-e.startedAt-(e.pausedMs??0))}function ge(e,t){if(!t?.startsWith(".intent/attachments/"))return;const n=t.split("/").map(encodeURIComponent).join("/"),a=tt(`intent://local/file/${n}`,e);return a?.kind==="video"?a.url:void 0}function qn(e){const t=e.video==="full"?b.dock_captureEditor_videoFull_label():b.dock_captureEditor_videoHighlights_label(),n=e.voice==="audio"?b.dock_captureEditor_voiceAudio_label():e.voice==="transcript"?b.dock_captureEditor_voiceTranscript_label():b.dock_captureEditor_voiceOff_summary();return`${t} · ${n}`}function Vn(e,t,n,a){if(a?.error==="permission")return a.kind==="pick"?"accessibility":"screen";if(e==="permission"||t==="permission")return"screen";if(n?.startsWith("microphone-permission"))return"microphone";if(n?.startsWith("speech-permission"))return"speech"}const j=on;function Ur(e){const{view:t,items:n,local:a,labels:r,copy:s}=e,i=t.speech.error??t.speech.capability?.reason??null,o=Vn(t.captureError,t.clips.find(g=>g.status==="failed"&&g.error==="permission")?.error??null,i,t.annotationIssue),l=t.annotationIssue?.error==="unavailable"?s?.annotationUnavailable:void 0,c=t.annotationIssue,d=t.captureError==="permission",u=c?.error==="permission"&&c.kind!=="pick",h=c?.error==="permission"&&c.kind==="pick",p=i?.startsWith("speech-permission")?"speech":i?.startsWith("microphone-permission")||i==="permission"?"microphone":void 0,m={},y={},f=(g,D,U)=>{m[g]=D,U&&(y[g]=U)};s&&(d&&(f("capture",s.permission,"screen"),t.recording||f("record",s.permission,"screen")),u&&!t.annotating&&f("annotate",s.permission,"screen"),h&&(f("pick",s.accessibilityPermission,"accessibility"),t.tool==="pick"&&!t.annotating&&f("annotate",s.accessibilityPermission,"accessibility")),p&&!t.dictation&&f("mic",(i&&r.speechError?.(i))??s.speechPermission,p));const k=g=>{const D=y[g];D&&e.actions.onOpenSettings(D)},v=new Set(t.evidenceOwnedItemIds),I=t.clips.find(g=>g.status==="recording"),S=t.clips.length>=ae.clips,_=t.capabilities,B=t.speech.available,C=new Set(t.clips.filter(g=>g.status==="recording"||g.status==="placing"||!!g.media).flatMap(g=>g.captureHistory?.map(D=>D.image.id)??[])),P=[...t.tiles.filter(({image:g,marks:D})=>!!g.media||g.source!=="annotate"||!C.has(g.id)||D.some(({mark:U})=>!U.clipId)).map(({image:g,marks:D})=>({kind:"image",id:g.contextItemId,url:a.previews[g.id]??"",markCount:D.length,owner:"evidence",...a.previews[g.id]?{}:{status:"placing"}})),...t.clips.filter(g=>!g.discarding).map(g=>({kind:"clip",id:g.contextItemId??g.id,duration:j(g.status==="recording"?Ue(g,a.now):g.durationMs),recording:g.status==="recording",...g.media?.saved?{summary:qn(g.media.saved)}:{},...g.status==="ready"&&ge(e.workspaceId,g.path)?{url:ge(e.workspaceId,g.path)}:{},owner:"evidence",...g.status==="placing"?{status:"placing"}:{},...g.status==="failed"?{status:"failed",...g.error==="limit"?{error:b.dock_composer_clipTooLarge_error()}:{}}:{}})),...n.filter(g=>!v.has(g.id)).map(g=>({...g.imageData&&g.imageMimeType?{kind:"image",id:g.id,url:`data:${g.imageMimeType};base64,${g.imageData}`,markCount:0,file:{name:g.label,imageData:g.imageData,imageMimeType:g.imageMimeType}}:{kind:"file",id:g.id,name:g.label},owner:"attachment",...g.placementStatus==="placing"?{status:"placing"}:{},...g.placementStatus==="failed"?{status:"failed",error:g.placementError}:{}}))];return{mediaStatus:t.recording?{kind:"recording",label:r.recording}:t.dictation?{kind:"listening",label:r.listening}:t.annotating?{kind:"annotating",label:r.annotating}:void 0,...o?{settingsPane:o}:{},...l?{annotationNotice:l}:{},labels:r,attachments:P,...s?{placeholder:t.dictation?"":s.idle}:{},state:{captureRevision:t.captureAccepted,capturePending:t.capturePending,captureDisabled:!_.capture||t.captureDisabled,...t.captureDisabled?{captureTooltip:r.captureLimit}:{},captureMode:t.evidence?.annotation?"fullscreen":t.captureMode,captureModesAvailable:!!_.captureModes&&!t.evidence?.annotation,annotationActive:t.annotating,tool:t.tool,toolUsed:t.toolUsed,annotationDisabled:!_.annotate,recording:t.recording&&!I?.discarding,recordingDisabled:!!I?.discarding||!t.recording&&(!_.record||S),...S&&!t.recording?{recordingTooltip:r.clipLimit}:{},recordingTime:j(I?Ue(I,a.now):0),dictating:!!t.dictation,dictationPending:t.speech.pending||t.dictation?.status==="transcribing",dictationDisabled:!B&&!t.dictation&&!m.mic,...t.speech.error&&r.speechError?{dictationTooltip:r.speechError(t.speech.error)}:{},dictationTime:t.dictation?j(a.now-t.dictation.startedAt):j(0),inputLevels:t.speech.levels,...Object.keys(m).length?{alerts:m}:{}},...e.actions,...t.fileAttachmentsEnabled===!1?{onEdit:void 0}:{},onAlert:k,beforeSubmit:e.beforeSubmit}}const Se=()=>globalThis.electronAPI,zn=["image/png","image/jpeg","image/webp"],Ne=e=>zn.includes(e??"")?e:null;function He(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a+=1)n[a]=t.charCodeAt(a);return n}async function Nr(e,t){const{view:n,items:a,previews:r}=t,s=n.tiles.find(({image:c})=>c.id===e||c.contextItemId===e);if(s){const c=a.find(p=>p.id===s.image.contextItemId),d=s.image.media;if(s.image.mediaError)return null;if(d?.saved){if(!t.createSavedPreviewUrl||!t.revokeUrl)return null;const p={...d,saved:d.saved},m=await t.createSavedPreviewUrl(t.workspaceId,p);try{const y=await t.fetchBytes(m),f=p.saved.crop;return{kind:"image",name:c?.label||"screenshot.png",mimeType:"image/png",bytes:y,intent:{pixels:{mimeType:"image/png",width:Math.max(1,Math.round(f?.w??p.source.width)),height:Math.max(1,Math.round(f?.h??p.source.height)),displayScale:s.image.displayScale,capturedAt:s.image.capturedAt},raw:y,marks:[]}}}finally{t.revokeUrl(m)}}const u=Ne(c?.imageMimeType),h=r[s.image.id];return!c?.imageData||!u||!h?null:{kind:"image",name:c.label||"screenshot.png",mimeType:"image/png",bytes:await t.fetchBytes(h),intent:{pixels:{mimeType:u,width:s.image.width,height:s.image.height,displayScale:s.image.displayScale,capturedAt:s.image.capturedAt,...s.image.hash?{hash:s.image.hash}:{}},raw:He(c.imageData),marks:s.marks.map(({mark:p})=>({tool:p.tool,geometry:p.geometry,bounds:p.bounds,element:p.element}))}}}const i=n.clips.find(c=>c.id===e||c.contextItemId===e);if(i){const c=i.status==="ready"?ge(t.workspaceId,i.path):null;if(!c)return null;const d=a.find(h=>h.id===i.contextItemId),u=await t.fetchBytes(c);if(!Yn(u))throw new Error("Not a recording file");return{kind:"clip",name:d?.label||`recording-${i.id.slice(0,8)}.mp4`,mimeType:d?.attachmentMimeType||"video/mp4",bytes:u,durationMs:i.durationMs,hasMicAudio:i.hasMicAudio}}const o=a.find(c=>c.id===e),l=Ne(o?.imageMimeType);return o?.imageData&&l?{kind:"image",name:o.label||"image",mimeType:l,bytes:He(o.imageData)}:null}async function Gn(e){const t=await fetch(e);if(!t.ok)throw new Error(`Media request failed (${t.status})`);const n=new Uint8Array(await t.arrayBuffer()),a=Number(t.headers.get("content-length")??Number.NaN);if(n.byteLength===0||Number.isFinite(a)&&a!==n.byteLength)throw new Error("Media response was incomplete");return n}function Yn(e){return e.byteLength>8&&String.fromCharCode(...e.subarray(4,8))==="ftyp"}async function Hr(e){try{return(await Se()?.invoke(_e.CLIPBOARD_WRITE,e))?.ok===!0}catch{return!1}}async function Jn(){try{return await Se()?.invoke(_e.CLIPBOARD_READ,{})??null}catch{return null}}async function Fr(e){try{const t=await Se()?.invoke(_e.MENU,{canCut:e});return t?.action==="copy"||t?.action==="cut"?t.action:null}catch{return null}}const Fe=new WeakSet;async function Qn(e,t){const[n]=e;if(e.length!==1||!n||n.size!==t.size)return!1;try{const a=await crypto.subtle.digest("SHA-256",await n.arrayBuffer());return Array.from(new Uint8Array(a),s=>s.toString(16).padStart(2,"0")).join("")===t.sha256}catch{return!1}}function Kr(e,{onIntentMedia:t,isCurrent:n,read:a=Jn}){const r=e.clipboardData;if(Fe.has(e)||!r||r.files.length===0)return!1;const s=e.target,i=Array.from(r.files),o=r.types.filter(l=>l!=="Files").map(l=>[l,r.getData(l)]);return e.preventDefault(),e.stopImmediatePropagation(),a().catch(()=>null).then(async l=>{if(!n())return;if(l&&await Qn(i,l)){n()&&t(l);return}if(!n()||!(s instanceof Node)||!s.isConnected)return;const c=new DataTransfer;for(const u of i)c.items.add(u);for(const[u,h]of o)c.setData(u,h);const d=new ClipboardEvent("paste",{clipboardData:c,bubbles:!0,cancelable:!0});Fe.add(d),s.dispatchEvent(d)}),!0}function Xn(e){const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}function Zn(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t)}function ct(e){let t=0;return e.endsWith("==")?t=2:e.endsWith("=")&&(t=1),Math.floor(e.length*3/4)-t}async function ea(e){const t=await crypto.subtle.digest("SHA-256",e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));return Array.from(new Uint8Array(t)).map(n=>n.toString(16).padStart(2,"0")).join("")}const lt={placeAttachment:it,beginAttachmentUpload:st,sendAttachmentUploadChunk:rt,commitAttachmentUpload:at,abortAttachmentUpload:nt,getAttachmentInfo:he,mintIdempotencyKey:se};async function Me(e,t,n,a=lt){const{idempotencyKey:r}=n,s={...r!==void 0?{idempotencyKey:r}:{},...n.rawScreenshot!==void 0?{rawScreenshot:n.rawScreenshot}:{}},i=async m=>un(m,r)?$e(e,r,a.getAttachmentInfo):void 0;if(ct(n.data)<=cn)try{return await a.placeAttachment(e,t,{data:n.data,mimeType:n.mimeType,...s})}catch(m){const y=await i(m);if(y)return y;throw m}const o=Xn(n.data),l=await ea(o);let c,d;try{({uploadId:c,maxChunkBytes:d}=await a.beginAttachmentUpload(e,t,o.byteLength,l,{mimeType:n.mimeType,...s}))}catch(m){if(r!==void 0&&ln(m)){const y=await $e(e,r,a.getAttachmentInfo);if(y)return y}throw m}const u=Math.min(mn,d),h=Math.ceil(o.byteLength/u);let p=!1;try{for(let m=0;m<h;m++){const y=o.subarray(m*u,(m+1)*u);await a.sendAttachmentUploadChunk(c,m,Zn(y),e)}return p=!0,await a.commitAttachmentUpload(c,e)}catch(m){const y=p?await i(m):void 0;if(y)return y;throw await a.abortAttachmentUpload(c,e).catch(()=>{}),m}}function ta(e,t){return pn(e,`image-${Date.now()}-${t+1}`)}class Ae extends Error{constructor(n,a){super(n);Pe(this,"retryBlocks");this.name="ImagePlacementError",this.retryBlocks=a}}function na(e,t){return e instanceof Ae?e.retryBlocks:t}async function aa(e,t,n=lt,a=()=>!0){const r=l=>(...c)=>(le(a),l(...c));n={placeAttachment:r(n.placeAttachment),beginAttachmentUpload:r(n.beginAttachmentUpload),sendAttachmentUploadChunk:r(n.sendAttachmentUploadChunk),commitAttachmentUpload:r(n.commitAttachmentUpload),abortAttachmentUpload:r(n.abortAttachmentUpload),getAttachmentInfo:r(n.getAttachmentInfo),mintIdempotencyKey:r(n.mintIdempotencyKey)};const s=[],i=[],o=[];for(let l=0;l<t.length;l++){le(a);const c=t[l];if("attachmentId"in c&&c.attachmentId){const p={type:"image",attachmentId:c.attachmentId,...c.mimeType?{mimeType:c.mimeType}:{}};s.push(p),i.push(p);continue}const d=c,u=d.placementFileName??ta(d.mimeType,l),h=n.mintIdempotencyKey(d.placementIdempotencyKey);try{const p=await Me(e,u,{data:d.data,mimeType:d.mimeType,...h!==void 0?{idempotencyKey:h}:{}},n),m={type:"image",attachmentId:p.attachmentId,...p.mimeType??d.mimeType?{mimeType:p.mimeType??d.mimeType}:{}};s.push(m),i.push(m)}catch(p){const m=dn(p);o.push(m?`${u} (${m})`:u),i.push(h!==void 0?{...d,placementIdempotencyKey:h,placementFileName:u}:d)}}if(o.length>0)throw new Ae(b.chat_imagePlacement_failed_error({names:o.join(", ")}),i);return le(a),s}const Wr=Object.freeze(Object.defineProperty({__proto__:null,ImagePlacementError:Ae,base64DecodedBytes:ct,imageRetryBlocks:na,placeImageAttachment:Me,toImageReferenceBlocks:aa},Symbol.toStringTag,{value:"Module"}));function dt(){try{return gn()}catch{return null}}function ra(){return{backendId:A.state.connections.windowBackendId??null,generation:A.state.daemonHealth.connectionGeneration,transport:dt()}}class Ie extends Error{constructor(){super("dock-evidence-backend-changed")}}function N(e,t){return async(...n)=>{e();const a=await t(...n);return e(),a}}const H={current:e=>dt()===e.transport&&A.state.daemonHealth.connectionGeneration===e.generation&&(A.state.connections.windowBackendId??null)===e.backendId,capabilities:()=>yn(),placeImage:(e,t,n,a)=>Me(e,t,n,{placeAttachment:N(a,it),beginAttachmentUpload:N(a,st),sendAttachmentUploadChunk:N(a,rt),commitAttachmentUpload:N(a,at),abortAttachmentUpload:N(a,nt),getAttachmentInfo:N(a,he),mintIdempotencyKey:se}),lookup:(e,t)=>he({workspaceId:e,idempotencyKey:t}),mintKey:se};function G(e){return H.current(e)}function sa(e,t){const n=A.state.dockConversation;return{generation:n.generation,authority:n.authority,clearRevision:R(n.drafts,Vt(e,t))?.clearRevision??0,binding:ra()}}function jr(e,t,n){const a=sa(e,t);return a.generation===n.generation&&a.authority===n.authority&&a.clearRevision===n.clearRevision&&G(n.binding)}function ut(e,t){return()=>{if(!e.current(t))throw new Ie}}const mt=Object.freeze({rawRetention:!1,chiefAttachments:!1});function qr(e){return e!==mt}const de=new Map;function pt(e,t=H){const n=`${e.backendId}:${e.generation}`;let a=de.get(n);if(!a){const r=ut(t,e);a=(async()=>{r();const i=await t.capabilities();r();const o=i?.server?.capabilities;if(!o||typeof o!="object")throw new Error("unobserved");return{rawRetention:o.rawScreenshotRetention===1,chiefAttachments:o.chiefAttachments===1}})().catch(()=>(de.delete(n),mt)),de.set(n,a)}return a}class Z extends Error{constructor(t){super(`dock-raw-retention-contract:${t}`),this.reason=t}}function ft(e){const{rpcCode:t,code:n}=e??{};return t===-32602||n==="INVALID_PARAMS"}function ia(e){const t=String(e?.message??"");return ft(e)&&(t.includes("rawScreenshotExpired:")||/expired at .*not renewable/i.test(t))}function oa(e,t,n){const a=e.rawScreenshot;if(!a||a.compositeAttachmentId!==t)return null;const r=Date.parse(a.expiresAt);return Number.isFinite(r)?a.expired||r<=n?"expired":{attachmentId:e.attachmentId,expiresAt:a.expiresAt}:null}function Ke(e){return{ok:!0,path:e.path,fileName:e.fileName,size:e.size,attachmentId:e.attachmentId,...e.mimeType?{mimeType:e.mimeType}:{},uploadedAt:e.uploadedAt,replayed:!0,...e.rawScreenshot?{rawScreenshot:e.rawScreenshot}:{}}}class ca extends Error{constructor(t,n){super("dock-evidence-placement-failed"),this.imageId=t,this.failure=n}}const We=e=>e.split("/")[1]?.replace("jpeg","jpg")||"png";async function la(e){const t=e.api??H,n=e.now??Date.now,a=ut(t,e.binding);a();const r=await pt(e.binding,t);a();const s=r.rawRetention&&(e.workspaceId!==be||r.chiefAttachments),i=[];for(const o of e.images){const l=e.records[o.image.id];let c=l&&l.signature===o.signature&&l.workspaceId===e.workspaceId&&l.backendId===e.binding.backendId?l:{imageId:o.image.id,signature:o.signature,workspaceId:e.workspaceId,backendId:e.binding.backendId,compositeKey:null,rawKey:null,composite:null,raw:null,rawSettled:!1};const d=u=>{c=u,e.onRecord(u)};try{if(!c.composite){const h=c.compositeKey,p=t.mintKey(h??void 0)??null;p!==c.compositeKey&&d({...c,compositeKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a()),m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}.${We(o.composite.mimeType)}`,{data:o.composite.base64,mimeType:o.composite.mimeType,...p?{idempotencyKey:p}:{}},a),a()),d({...c,composite:{attachmentId:m.attachmentId,mimeType:m.mimeType??o.composite.mimeType}})}const u=c.composite.attachmentId;if(s&&o.raw&&!c.raw&&!c.rawSettled){const h=c.rawKey,p=t.mintKey(h??void 0);if(p){p!==c.rawKey&&d({...c,rawKey:p});let m;h&&p===h&&(a(),m=await t.lookup(e.workspaceId,p).then(Ke).catch(()=>{}),a());try{m||(a(),m=await t.placeImage(e.workspaceId,`screenshot-${o.image.id.slice(0,8)}-original.${We(o.raw.mimeType)}`,{data:o.raw.base64,mimeType:o.raw.mimeType,idempotencyKey:p,rawScreenshot:{compositeAttachmentId:u}},a),a());const y=oa(m,u,n());if(y==="expired")d({...c,rawSettled:!0});else if(y)d({...c,raw:y});else throw new Z("echo")}catch(y){if(ia(y))d({...c,rawSettled:!0});else throw y instanceof Z?y:ft(y)?new Z("refused"):y}}else throw new Z("unkeyed")}}catch(u){throw u instanceof Ie?u:new ca(o.image.id,u)}i.push(c)}return i}async function Vr(e,t,n,a){const r=()=>{if(!H.current(a))throw new Ie};r();const s=await H.placeImage(e,t,{...n,idempotencyKey:H.mintKey()},r);return r(),s}const da=new Set(["invalid-saved-edit","media-send-retired","transcript-unavailable","transcript-pending","invalid-edit","stale-source","legacy-baked-marks","timing-unavailable","audio-unavailable","media-source-unavailable","media-export-unavailable","media-animation-layer-limit","media-export-failed","legacy-original-unavailable","capture-render-unavailable","capture-blur-unavailable","stale-source-pixels","not-a-screenshot","not-admitted","unavailable","dock-evidence-missing-pixels","draft-restore-failed","image-budget-exceeded"]),ua=new Set(["unavailable","permission","failed","busy","cancelled","limit"]);class O extends Error{constructor(t,n){super(n),this.stage=t,this.code=n,this.name="DockSendError"}}function ie(e){const t=e instanceof Error?e.message:typeof e=="string"?e:"";if(t.length>64)return"unclassified";const[n,...a]=t.split(":");return!da.has(n)||a.length>2?"unclassified":n!=="media-export-failed"?a.length?"unclassified":n:[n,...a.map(r=>ua.has(r)?r:"other")].join(":")}function zr(e,t){return e instanceof O?{stage:e.stage,code:ie(e.code)}:{stage:t,code:ie(e)}}function F(e){if(!e||e.source.kind!=="recording")return!1;const t=e.source,n=e.saved??re(t,t.capturedMarks??[],e.transcript);if(n.video!=="full"||n.voice!=="audio"||n.crop||n.blurRegions.length||n.blurStrokes?.length)return!1;const a=ve(n,t,e.transcript);return t.visuals==="clean"?!a.errors.length&&!a.muted&&n.cuts.length===0&&!n.marks.some(r=>r.included)&&a.marks.length===0&&a.transcript===null&&a.kept.length===1&&a.kept[0].startMs===0&&a.kept[0].endMs===t.durationMs&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs===t.durationMs:!a.errors.length&&!a.muted&&a.clips.length===1&&a.clips[0].startMs===0&&a.clips[0].endMs>=t.durationMs}async function ma(e,t,n,a,r,s){const i={images:{},files:[],frames:[],framePromptBytes:[],metadata:[]};let o="validate";try{const l=()=>{if(!r()||!G(n))throw new Error("media-send-retired")};for(const c of[...t.images,...t.clips]){if(o="validate",s?.stage(o),c.mediaError)throw new Error("invalid-saved-edit");if(!c.media||F(c.media))continue;l();const d=structuredClone(c.media),u=d.source;let h=d.saved??re(u,u.capturedMarks??[],d.transcript),p=crypto.randomUUID();try{if(u.kind==="recording"&&h.voice==="transcript"&&d.transcript?.status!=="ready"){if(o="transcribe",s?.stage(o),!a?.transcribeMedia)throw new Error("transcript-unavailable");const f=await a.transcribeMedia({jobId:p,media:d});if(l(),!f.ok)throw new Error("transcript-unavailable");d.transcript=f.value,d.saved||(h=re(u,u.capturedMarks??[],d.transcript))}o="plan",s?.stage(o);const m=ve(h,u,d.transcript);if(m.errors.length)throw new Error(m.errors[0]);const y={id:c.id,kind:u.kind,video:h.video,voice:h.voice,transcript:m.transcript,batches:u.batches,marks:m.marks.map(({n:f,mark:k,frameAtMs:v})=>({n:f,id:k.id,at_ms:v,kind:k.kind,label:k.label,note:k.note,context:k.context,geometry:k.geometry}))};if(u.kind==="screenshot"){o="screenshot-source",s?.stage(o);const f=u.path.split("/").map(encodeURIComponent).join("/"),k=tt(`intent://local/file/${f}`,e);if(!k||k.kind!=="image")throw new Error("media-source-unavailable");const v=await Gn(k.url);l();const I={base64:Ze(v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength)),mimeType:/\.jpe?g$/i.test(u.path)?"image/jpeg":/\.webp$/i.test(u.path)?"image/webp":"image/png"};o="screenshot-render",s?.stage(o),i.images[c.id]=await nn(u,h,I),l()}else{if(!m.clips.length){y.video_attachment_id=null,y.frames=[],y.kept_ms=[],i.metadata.push(y);continue}const f={...d,saved:h};let k=await a?.takePreparedRecording?.(f);if(k&&(p=k.jobId),l(),!k){if(!a)throw new Error("media-export-unavailable");k=await ot(f,p,a,()=>r()&&G(n),S=>{o=S,s?.stage(S),S==="export"&&s?.exportAttempt(p)})}p=k.jobId,o="placement",s?.stage(o);const v=[k.value.video,...k.value.frames],I=[];for(let S=0;S<v.length;S++){l();const _=v[S],B=`capture-${c.id.slice(0,12)}-${S}.${S===0?"mp4":_.mimeType==="image/jpeg"?"jpg":"png"}`,C=await fn(e,B,{sourcePath:_.sourcePath,mimeType:_.mimeType,idempotencyKey:se()},void 0,void 0,()=>r()&&G(n));l(),S===0?i.files.push({type:"file",attachmentId:C.attachmentId,fileName:B,mimeType:C.mimeType??_.mimeType,size:C.size}):(i.frames.push({type:"image",attachmentId:C.attachmentId,mimeType:_.mimeType==="image/jpeg"?"image/jpeg":"image/png"}),i.framePromptBytes.push(jn(_))),I.push(C.attachmentId)}y.video_attachment_id=I[0],y.frames=k.value.frames.map((S,_)=>({mark_id:S.markId,attachment_id:I[_+1]})),y.kept_ms=m.clips}i.metadata.push(y)}finally{s?.stage("release"),await a?.releaseMediaJob?.(p).catch(()=>{})}}return i}catch(l){throw l instanceof O?l:new O(o,ie(l))}}const ue=1568,pa=.85;async function fa(e,t){const n=Math.round(e.length*3/4/1024),a=await ha(e,t),{width:r,height:s}=a,i=r>ue||s>ue;let o=r,l=s;if(i){const f=ue/Math.max(r,s);o=Math.round(r*f),l=Math.round(s*f)}const c=new OffscreenCanvas(o,l),d=c.getContext("2d");if(!d)throw new Error("Failed to get 2D canvas context for image resize");d.drawImage(a,0,0,o,l);let u=t;ga(d,o,l)||(u="image/jpeg");const h=await c.convertToBlob({type:u,quality:u==="image/jpeg"?pa:void 0}),p=h.type||u,m=await ya(h),y=Math.round(m.length*3/4/1024);return console.debug(`[image-resize] ${r}×${s} → ${o}×${l} | ${t} → ${p} | ${n} KB → ${y} KB`),{base64:m,mimeType:p}}async function ha(e,t){const n=atob(e),a=new Uint8Array(n.length);for(let s=0;s<n.length;s++)a[s]=n.charCodeAt(s);const r=new Blob([a],{type:t});return createImageBitmap(r)}function ga(e,t,n){const r=e.getImageData(0,0,t,n).data;for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1}async function ya(e){const t=await e.arrayBuffer(),n=new Uint8Array(t);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return btoa(a)}const T={...Oe,badge:Oe.badgeRadius*2};function wa(e,t,n=1,a=0){const r=Math.max(1,e.displayScale)*n,s=[],i=o=>o*n;for(const{n:o,mark:l}of t){const c=l.geometry;if(c.kind==="rect")s.push({kind:"rect",x:i(c.x),y:i(c.y),w:i(c.w),h:i(c.h),width:T.stroke*r});else if(c.kind==="path")s.push({kind:"path",points:c.points.map(m=>({x:i(m.x),y:i(m.y)})),width:T.pen*r});else{const m={x:i(c.from.x),y:i(c.from.y)},y={x:i(c.to.x),y:i(c.to.y)};s.push({kind:"arrow",from:m,to:y,head:Sa(m,y,T.arrowHead*r),width:T.stroke*r})}if(!T.showNumbers)continue;const d=Math.max(a,T.badge/2*r),u=i(l.bounds.x+l.bounds.w),h=i(l.bounds.y),p=Zt({x:i(l.bounds.x),y:h,w:u-i(l.bounds.x),h:i(l.bounds.h)},{x:0,y:0,w:i(e.width),h:i(e.height)},r,d);s.push({kind:"badge",...p,radius:d,label:String(o),font:d*T.badgeTextScale})}return s}function ba(e,t){"letterSpacing"in e&&(e.letterSpacing="0px"),"wordSpacing"in e&&(e.wordSpacing="0px");const n=(a,r,s)=>{e.strokeStyle=T.halo,e.lineWidth=a+T.haloWidth*r,s(),e.strokeStyle=T.accent,e.lineWidth=a,s()};e.strokeStyle=T.accent,e.lineCap="round",e.lineJoin="round";for(const a of t)if(a.kind==="rect")n(a.width,a.width/T.stroke,()=>e.strokeRect(a.x,a.y,a.w,a.h));else if(a.kind==="path"||a.kind==="arrow"){e.lineWidth=a.width,e.beginPath();const r=a.kind==="path"?a.points:[a.from,a.to];a.kind==="arrow"&&r.forEach((i,o)=>o?e.lineTo(i.x,i.y):e.moveTo(i.x,i.y)),a.kind==="arrow"&&(e.moveTo(a.head.left.x,a.head.left.y),e.lineTo(a.to.x,a.to.y),e.lineTo(a.head.right.x,a.head.right.y));const s=a.kind==="path"?new Path2D(Xt(a.points)):null;n(a.width,a.width/(a.kind==="path"?T.pen:T.stroke),()=>s?e.stroke(s):e.stroke())}else e.fillStyle=T.paper,e.beginPath(),e.arc(a.x,a.y,a.radius,0,Math.PI*2),e.closePath(),e.fill(),e.strokeStyle=T.accent,e.lineWidth=T.badgeOutline*a.radius/T.badgeRadius,e.stroke(),e.fillStyle=T.ink,e.font=`600 ${a.font}px ${T.badgeFontFamily}`,e.textAlign="center",e.textBaseline="middle",e.fillText(a.label,a.x,a.y)}async function ka(e,t){const n=Uint8Array.from(atob(e),a=>a.charCodeAt(0));return createImageBitmap(new Blob([n],{type:t}))}async function va(e){const t=await e.convertToBlob({type:"image/png"});return Ze(await t.arrayBuffer())}async function ht(e,t,n,a,r=0){await an();const s=await ka(e.base64,e.mimeType);try{const i=Math.min(1,a/Math.max(t.width,t.height)),o=new OffscreenCanvas(Math.max(1,Math.round(t.width*i)),Math.max(1,Math.round(t.height*i))),l=o.getContext("2d");if(!l)throw new Error("dock-evidence-canvas-unavailable");return l.drawImage(s,0,0,o.width,o.height),ba(l,wa(t,n,i,r)),o}finally{s.close()}}async function _a(e,t,n){const a=await ht(e,t,n,Math.max(t.width,t.height));return fa(await va(a),"image/png")}async function Gr(e,t,n,a=384){const r=await ht(e,t,n,a,a/32);return URL.createObjectURL(await r.convertToBlob({type:"image/png"}))}function Sa(e,t,n=T.arrowHead){const a=Math.atan2(t.y-e.y,t.x-e.x),r=T.arrowSpread;return{left:{x:t.x-n*Math.cos(a-r),y:t.y-n*Math.sin(a-r)},right:{x:t.x-n*Math.cos(a+r),y:t.y-n*Math.sin(a+r)}}}function Yr(e,t){const n=zt(t??void 0),a=new Set(t?.clips.filter(r=>!!r.media&&!F(r.media)).map(r=>r.contextItemId));return e.filter(r=>!n.has(r.id)&&!a.has(r.id))}async function Jr({workspaceId:e,agentId:t,evidence:n,clickedItems:a,sendItems:r,clickedPayload:s,binding:i,service:o,current:l,onRecord:c,timing:d}){const u=()=>{if(!l()||!G(i))throw new O("validate","media-send-retired")};if(u(),n?.images.some(w=>w.mediaError)||n?.clips.some(w=>w.mediaError))throw new O("validate","invalid-saved-edit");const h=w=>!!w.media&&!F(w.media),p=n?{workspaceId:e,agentId:t,appUrl:`intent://local/workspace/${encodeURIComponent(e)}`,clipAttachmentIds:Object.fromEntries(n.clips.map(w=>[w.id,a.find(M=>M.id===w.contextItemId)?.attachmentId??null]))}:null;for(const w of n?.clips??[]){if(!w.media||!F(w.media))continue;const M=a.find(Q=>Q.id===w.contextItemId);if(!M||M.attachmentId!==w.media.source.attachmentId||M.path!==w.media.source.path||M.placementStatus!==void 0&&M.placementStatus!=="placed")throw new O("validate","legacy-original-unavailable")}const m=n?await ma(e,n,i,o,l,d):{images:{},files:[],frames:[],framePromptBytes:[],metadata:[]},y=new Set(n?.clips.filter(w=>h(w)||!!w.media&&F(w.media)).map(w=>w.id)),f=new Set(n?.clips.filter(w=>y.has(w.id)).flatMap(w=>(w.captureHistory??[]).map(M=>M.image.id))),k=(n?.images??[]).filter(w=>w.source!=="annotate"||!!w.media||!f.has(w.id)||n.marks.some(M=>M.imageId===w.id&&!(M.clipId&&y.has(M.clipId))));d?.stage("burn");let v=[];try{v=n?await Ma({...n,images:k},a,m.images):[]}catch(w){throw new O("burn",ie(w))}if(m.framePromptBytes.reduce((w,M)=>w+(M??0),0)>Fn)throw new O("validate","image-budget-exceeded");const S=new Set(n?.images.filter(w=>w.media).map(w=>w.id)),_=n?{...n,images:k.map(w=>m.images[w.id]?{...w,width:m.images[w.id].width,height:m.images[w.id].height}:w),clips:n.clips.filter(w=>!h(w)),marks:n.marks.filter(w=>!S.has(w.imageId)&&!n.clips.some(M=>h(M)&&M.id===w.clipId))}:null;u();const B=m.metadata.some(w=>typeof w.transcript=="string"&&w.transcript.trim());if(!s.text.trim()&&!r.length&&!s.workspaceContextStr?.trim()&&!v.length&&!m.files.length&&!m.frames.length&&!s.imageBlocks?.length&&!s.fileBlocks?.length&&!B)return null;let C=v,P=null;d?.stage("placement");const xe=n?await pt(i):null;if(u(),n&&(e!==be||xe?.chiefAttachments)){const w=await la({workspaceId:e,binding:i,images:k.map((M,Q)=>{const X=a.find(Et=>Et.id===M.contextItemId);return{image:M,signature:Gt(n,M.id),composite:{base64:v[Q].data,mimeType:v[Q].mimeType},raw:!M.media&&X?.imageData&&X.imageMimeType?{base64:X.imageData,mimeType:X.imageMimeType}:null}}),records:n?.placements??{},onRecord:c});u(),C=w.map(M=>({type:"image",attachmentId:M.composite.attachmentId,mimeType:M.composite.mimeType})),P=Object.fromEntries(w.map(M=>[M.imageId,{attachmentId:M.composite.attachmentId,raw:M.raw}]))}const g=new Map(n?Xe(n).map(({n:w,mark:M})=>[M.id,w]):[]),D=p&&P?{...p,imageAttachments:P,markNumbers:g}:p&&{...p,markNumbers:g},U=n&&D?{...s,imageBlocks:[...C,...m.frames,...s.imageBlocks??[]],fileBlocks:[...s.fileBlocks??[],...m.files],workspaceContextStr:[Jt(_,D),m.metadata.length?`[Edited capture outputs]
3
3
  ${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
4
4
 
5
5
  `),messageMetadata:{...s.messageMetadata,...Yt(_,D),edited_captures:m.metadata}}:s;return u(),U}async function Ma(e,t,n={}){const a=Xe(e);return Promise.all(e.images.map(async r=>{if(n[r.id])return{type:"image",...n[r.id]};const s=t.find(o=>o.id===r.contextItemId);if(!s?.imageData||!s.imageMimeType)throw new Error("dock-evidence-missing-pixels");const i=await _a({base64:s.imageData,mimeType:s.imageMimeType},r,a.filter(({mark:o})=>o.imageId===r.id));return{type:"image",data:i.base64,mimeType:i.mimeType}}))}const Aa="intent.dock.captureEditorPreview";function Qr(){try{return et()&&localStorage.getItem(Aa)==="1"}catch{return!1}}function Xr(e){const{clip:t}=e;if(t.status!=="ready"||!t.path)return null;const n=e.marks.filter(s=>s.clipId===t.id&&typeof s.clipMs=="number").sort((s,i)=>s.clipMs-i.clipMs).map(s=>({id:s.id,tool:s.tool,atMs:s.clipMs,...s.element?.name?{label:s.element.name.slice(0,200)}:{}})),a=Qt(e.evidence??void 0,t.id),r=a?t.media:void 0;return{kind:"recording",workspaceId:e.workspaceId,agentId:e.agentId,attachmentId:a?.attachmentId??t.id,sourceRevision:a?`${a.id}:${a.revision}`:t.path,attachmentPath:t.path,title:"",durationMs:t.durationMs,marks:n,provenance:a?{...a.audio==="unknown"?{}:{hasMicAudio:a.audio==="available"},visuals:a.visuals}:{hasMicAudio:t.hasMicAudio,visuals:n.length>0?"baked-marks":"clean"},...a&&r?{source:a,saved:r.saved??null,transcript:r.transcript??null}:{}}}async function Zr(e){if(!et())return{ok:!1,error:"unavailable"};try{return await sn().invoke(rn.OPEN,e)??{ok:!1,error:"unavailable"}}catch{return{ok:!1,error:"transport"}}}function es(e){let t=null,n=null;const a=o=>e.releaseMediaJob?.(o).catch(()=>{});function r(){const o=t;t=null,!(!o||o.taken||o.stopped)&&(o.stopped=!0,clearTimeout(o.timer),a(o.id))}function s(o,l,c){if(t?.key===o||n===o||(r(),n=null,!e.adoptMediaJob||!e.exportMedia||!c()||F(l)))return;const d=structuredClone(l),u=d.saved??re(d.source,d.source.capturedMarks??[],d.transcript),h=ve(u,d.source,d.transcript);if(d.source.kind!=="recording"||d.source.visuals!=="clean"||h.errors.length||!h.clips.length||u.voice==="transcript"&&d.transcript?.status!=="ready")return;const p={...d,saved:u},m=crypto.randomUUID(),y={key:o,mediaKey:JSON.stringify(p),id:m,current:c,taken:!1,stopped:!1,settled:!1,failed:!1,timer:setTimeout(()=>{t===y&&(n=o,r())},3e4),result:Promise.resolve({error:new Error("not-started")})};t=y,y.result=ot(p,m,e,()=>!y.stopped&&y.current()).then(async f=>y.stopped||!y.current()?(await a(m),{error:new Error("media-send-retired")}):{value:f},async f=>(y.failed=!0,t===y&&(n=o),await a(m),{error:f})).finally(()=>{y.settled=!0})}async function i(o,l,c){const d=t;if(!d||d.key!==o||d.mediaKey!==JSON.stringify(l)||d.stopped||d.taken||!c())return null;if(d.failed&&d.settled)return r(),null;d.taken=!0,d.current=c,clearTimeout(d.timer),t=null;const u=await d.result;if("error"in u)throw u.error;try{if(!c())throw new Error("media-send-retired");const h=await e.adoptMediaJob?.(d.id);if(!c())throw new Error("media-send-retired");return!h?.ok||!h.value?(await a(d.id),null):u.value}catch(h){throw await a(d.id),h}}return{warm:s,take:i,cancel:r}}function ts(e={}){const t=a=>_n(a,typeof e=="function"?e():e),n=a=>wn(t(a));return{actionHints:{get capture(){return{label:b.dock_composer_screenshotAction_label(),shortcut:t("dock.capture")}},get record(){return{label:b.ui_shortcuts_dockRecord_label(),shortcut:t("dock.record")}},get dictate(){return{label:b.dock_shortcut_dictate_label()}}},get capture(){return b.dock_composer_capture_tooltip({shortcut:n("dock.capture")})},captureMode:{get window(){return b.dock_composer_captureWindow_tooltip({shortcut:n("dock.capture")})},get region(){return b.dock_composer_captureRegion_tooltip({shortcut:n("dock.capture")})}},captureModes:{fullscreen:b.dock_composer_captureFullscreen_label(),window:b.dock_composer_captureWindow_label(),region:b.dock_composer_captureRegion_label()},captureOptions:b.dock_composer_captureModes_ariaLabel(),captureLimit:b.dock_composer_captureLimit_tooltip(),clipLimit:b.dock_composer_clipLimit_tooltip({limit:q(ae.clips)}),get record(){return b.dock_composer_record_tooltip({shortcut:n("dock.record")})},stopRecording:b.dock_composer_stopRecording_tooltip(),annotationTools:b.annotation_toolbar_ariaLabel(),annotateCurrent:a=>b.dock_composer_annotate_ariaLabel({tool:a}),tools:{pick:b.dock_composer_pick_label(),box:b.dock_composer_box_label(),pen:b.dock_composer_pen_label(),arrow:b.annotation_arrow_label()},get dictate(){return b.dock_shortcut_dictate_label()},stopDictating:b.dock_composer_stopDictating_tooltip(),annotating:b.dock_composer_annotating_status(),listening:b.dock_composer_listening_status(),recording:b.dock_composer_recording_status(),markUp:b.dock_composer_markUp_label(),remove:b.chat_contextChip_remove_label(),play:b.dock_composer_play_label(),edit:b.dock_composer_edit_label(),done:b.dock_composer_done_label(),attachments:b.context_attachments_title_label(),retry:b.chat_shared_retry_label(),attachmentPending:b.dock_composer_attachmentPending_status(),attachmentFailed:b.dock_composer_attachmentFailed_error(),image:a=>b.dock_composer_image_ariaLabel({n:q(a)}),clip:a=>b.dock_composer_clip_ariaLabel({duration:a}),recordingReference:(a,r)=>r?b.dock_composer_recordingEnd_chip({n:q(a)}):b.dock_composer_recordingStart_chip({n:q(a)}),speechError:a=>a.includes("permission")?b.dock_composer_speechPermission_error():["unsupported-platform","helper-missing","recognizer-unavailable","locale-unsupported","assets-unavailable","unavailable"].includes(a)?b.dock_composer_speechUnavailable_error():b.dock_composer_speechFailed_error()}}function ns(e,t){return{enabled:e,limit:ae.files,excludedIds:t,unavailableMessage:b.dock_composer_filesUnavailable_error(),limitMessage:b.dock_composer_fileLimit_error({limit:q(ae.files)})}}function Ia(e){try{return new URL(e.pageUrl).hostname||e.pageUrl}catch{return e.pageUrl}}function as(e,t){return e.targetAgentId===t}function rs(e){const t=e.element,n=e.viewport,a=Ia(e),r=t?`<${t.tagName.toLowerCase()}> · ${a}`:e.title||a,s=["<browser-element-capture>",`Page URL: ${e.pageUrl}`,`Page title: ${e.title}`,...t?[`DOM path: ${t.domPath}`,`CSS selector: ${t.selector}`,`Text snippet: ${t.textSnippet}`,...t.sourceRef?[`Source ref: ${t.sourceRef}`]:[],...n?[`Viewport: ${n.width}×${n.height}`]:[],`Element bounds: ${t.rect.width}×${t.rect.height} at (${t.rect.x}, ${t.rect.y})`]:[],"</browser-element-capture>"].join(`
@@ -8,5 +8,5 @@ ${JSON.stringify(m.metadata)}`:"",s.workspaceContextStr].filter(Boolean).join(`
8
8
  \`\`\`
9
9
  ${i}
10
10
  \`\`\`]`)}return Ta(a.join(`
11
- `),e)}function ss(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:r,fileBlocks:s}=Ea(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ca(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...r.length>0?{imageBlocks:r}:{},...s.length>0?{fileBlocks:s}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:r.length>0||s.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const Da="chat-read:",K=new Map,ye=new Set;function is(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function os(e,t){const n=K.get(e);if(!(!n||!n.delete(t))&&n.size===0){K.delete(e);for(const a of[...ye])a(e)}}function cs(e){return ye.add(e),()=>ye.delete(e)}function ls(e){return K.has(e)}function ds(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Da))return!0;return!1}function Ra(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ge(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(xt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&R(s.submissions,r.id)?r:null}function xa(e,t,n,a,r){const s=Be.select(e.state,n),i=pe.select(e.state)?.principal.id,o=Le(e.state);if(!s||!i||!o)return null;const l=In(t,n),c={agentId:t,workspaceId:n,principalId:i,participation:s,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},d=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&Be.select(e.state,n)===s&&pe.select(e.state)?.principal.id===i&&Le(e.state)===o;if(!d())return null;e.dispatch(Rt(c,a,Ft.select(e.state,n)));const u=Ra(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ge(h.scope,c)&&(!!R(h.operations,u.id)||!!R(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??Tn();return xa(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Kt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Pa(e,t,n){const a=we(e,t,n);return a?(e.dispatch(Ye(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Ba(e,t,n,a){const r=n.submission;if(!r)return"legacy";const s=r.reference,i=()=>s.scope.agentId===e&&s.scope.workspaceId===t&&Qe.select(A.state,e)===n?hn.select(A.state,s.scope):void 0,o=i();if(!o)return null;if(!o.supported)return"legacy";const l={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:a??n.options?.model};if(r.outcome==="rejected"){const p=R(o.tombstones,s.id);return R(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||R(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./BOXzTbe3.js").then(m=>m.E);return{notify:p}},__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,30,31,32,33,34,35,36,37,38,39,40,41]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||R(p.submissions,s.id)?.status!=="uncertain"||Pa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function us(e,t,n){const a=Qe.select(A.state,e),r=a?.submission?await Ba(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Pt(e,t):Bt(e,t,n));return}!r.isCurrent()||!a||A.dispatch(Ye(e,{wsId:t,text:a.text,imageBlocks:a.options?.imageBlocks,fileBlocks:a.options?.fileBlocks,noteIds:a.options?.noteIds,messageMetadata:a.options?.messageMetadata,model:n??a.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const ms=A.createSelector((e,t)=>{const n=R(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Je(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Oa(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&$t(t)==="topLevel"}function $a(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!xn(e.metadata,t)?t:null}function La(e){return e.status===ke.Error&&!Wt(jt(e))}function ps(e,t){return t.filter(n=>Oa(e,n)).flatMap(n=>{const a=Ot(n),r=$a(n),s=n.status===ke.Error;if(!a&&!r&&!s)return[];const i=a?.timestamp??(s?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(s?"failed":"question"),reason:a?.reason,timestamp:i&&Number.isFinite(Date.parse(i))?i:void 0,questionMessageId:r,canRetry:La(n)}]})}function fs(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function hs(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function Te(e){const t=bn(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),a=t.repo.toLowerCase();return{owner:n,repo:a,number:t.number,id:`${n}/${a}#${t.number}`,url:`https://github.com/${n}/${a}/pull/${t.number}`}}function gs(e,t,n,a){const r=e.filter(s=>a?a.includes(s.id):n?s.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(i=>i.owner?.toLowerCase()===s.repositoryOwner?.toLowerCase()&&i.name.toLowerCase()===s.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(s=>[...(s.pullRequests??[]).map(i=>i.url),s.activePullRequest?.url,s.prUrl]).flatMap(s=>{const i=s?Te(s):null;return i?[[i.id,{owner:i.owner,repo:i.repo,number:i.number}]]:[]})).values()].sort((s,i)=>`${s.owner}/${s.repo}#${s.number}`.localeCompare(`${i.owner}/${i.repo}#${i.number}`))}function ys(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const ws=A.createSelector(e=>e.homeIntegrations),bs=A.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,a)=>(a.updatedAt??"").localeCompare(n.updatedAt??""))}}),gt=A.createSelector(e=>Je(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Te(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),ks=A.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Te(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return gt.select(e).find(a=>a.url===n)??null}),vs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function _s(e){return ee=e,()=>{ee===e&&(ee=null)}}function Ss(){return ee}function Ms(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function As(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?e[0]:e[a+(n==="clockwise"?1:-1)]??null}let te=null;function Is(e){return te=e,()=>{te===e&&(te=null)}}function Ts(){return te}function Es(e){return An(e)}function Ua(e){return Mn(e)}function Na(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function me(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const r=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!Na(n.date,r))&&(n={date:r,label:Ua(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Cs(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(a)??0;return t.set(a,r+1),r===0?a:`${a}#${r}`})}function Ds(e,t){const n=new Map;let a=t?null:void 0;for(const r of e.groups)for(const s of r.messages)a!==void 0&&n.set(s.id,a),s.role==="user"&&!Bn(s)&&(a=s);return n}function Ha(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Ha(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Fa(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(s=>s.id)),a=new Set(t.map(s=>s.appMessageId).filter(s=>typeof s=="string"&&s.length>0)),r=e.filter(s=>!n.has(s.id)&&!(typeof s.appMessageId=="string"&&s.appMessageId.length>0&&a.has(s.appMessageId)));return r.length===e.length?e:r}function Rs(e,t,n){return e=Fa(e,t),e.length===0?{groups:me(t),detached:!1,hiddenTail:[]}:n?{groups:je(me(e),"h"),detached:!0,hiddenTail:t}:{groups:je(me([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function xs(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:r,historyCount:s,tailCount:i,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||r?!1:s>0||o||l>i+s}const Ps=300;function Bs(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:r}=e;return t||n?a&&!r?"none":"show":a&&!r?"arm-hide":"none"}const qe=24,Ka=320;function Ee(e){return Number.isFinite(e)?Math.min(Ka,Math.max(qe,e)):qe}const Wa=.2,ja=.12;function qa(e,t,n=Wa){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Os(e,t){const n=Ee(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function $s(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=qa(o,r/n));const l=e.unloadedRows??t-n,d=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),u=Math.abs(d-s);return u===0?{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}:d===0||s===0||u>s*ja||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Va=Pn,za=2;function Ls(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=Va,nearPages:s=za}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,Ga=1;function Us(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Ns(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=Ga}=e;if(n<=0||t.length<2)return"gentle";const s=t[t.length-1].timestamp-a,i=t.filter(l=>l.timestamp>=s);if(i.length<2)return"gentle";let o=0;for(let l=1;l<i.length;l+=1)o+=Math.abs(i[l].scrollTop-i[l-1].scrollTop);return o>n*r?"rapid":"gentle"}function Hs(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(r*a)))}function Fs(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:r,detachedFromTail:s}=e,i=Math.max(0,t-n);if(!s)return{above:a?0:i,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:i+o};if(r!==null){const c=Math.min(i,Math.max(0,Math.round(r)));return{above:c,below:i-c+o}}const l=Math.min(i,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:i-l,below:l+o}}function Ks(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ya="intent.drafts.sync",Ja="intent.drafts.changed",Qa=$({id:E(),type:E(),label:E(),description:E().optional(),content:E().optional(),path:E().optional(),imageData:E().optional(),imageMimeType:E().optional(),attachmentId:E().optional(),attachmentMimeType:E().optional(),attachmentSize:ce().optional(),sourcePath:E().optional(),placementStatus:V("failed").optional(),screen:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Ln("kind",[$({...z,kind:V("read")}),$({...z,...ne,kind:V("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...z,...ne,kind:V("flush")}),$({...z,...ne,kind:V("clear"),origin:E().min(1)})]);const bt=$({...z,...ne,origin:E(),sequence:ce().int().nonnegative(),snapshot:wt}),Xa=$({accepted:Un(),draft:bt});function Za(e,t,n=t){const a=new Map,r=new Set,s=crypto.randomUUID();let i=0,o=!1;const l=()=>{const f=t();if(o||!f)throw new Error("draft-authority-unavailable");return f},c=()=>{const f=n();if(!f||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==f)throw new Error("draft-authority-changed")}},d=(f,k,v)=>{const I=JSON.stringify([f,k,v]);let S=a.get(I);return S||(S={dirty:0},a.set(I,S)),S},u=(f,k)=>{if(o||f.provenance!==t())return;const v=d(f.provenance,f.workspaceId,f.agentId);if(!(v.value?.lifetime===f.lifetime&&v.value.revision>f.revision)&&(v.value=f,k&&v.dirty===0))for(const I of r)I(f)},h=e.subscribe(f=>{const k=bt.safeParse(f);k.success&&u(k.data,!0)}),p=async(f,k)=>{k();const v=Xa.parse(await e.request(f));if(k(),f.provenance!==l()||v.draft.provenance!==f.provenance)throw new Error("draft-authority-changed");if(!v.accepted)throw u(v.draft,!1),new Error("draft-changed-in-another-editor");return v.draft},m=async(f,k)=>{const v=l(),I=c(),S=d(v,f,k);S.tail&&await S.tail;const _=await p({kind:"read",provenance:v,workspaceId:f,agentId:k},I);return u(_,!1),_},y=(f,k,v)=>{const I=l(),S=c(),_=d(I,f,k),B=_.tail??(_.value?Promise.resolve(_.value):p({kind:"read",provenance:I,workspaceId:f,agentId:k},S));_.dirty+=1;const C=B.then(P=>p(v(P),S));return _.tail=C,C.then(P=>{_.dirty-=1,_.tail===C&&(_.tail=void 0),u(P,!0)},()=>{_.dirty-=1,_.tail===C&&(_.tail=void 0)}),C};return{authority:()=>o?null:n(),read:m,async edit(f,k,v,I){const S=++i;return y(k,v,_=>({kind:"edit",provenance:_.provenance,workspaceId:k,agentId:v,lifetime:_.lifetime,revision:_.revision,origin:f,sequence:S,snapshot:I}))},async flush(f,k){const v=l(),I=c(),S=d(v,f,k),_=await(S.tail??(S.value?Promise.resolve(S.value):m(f,k)));await p({kind:"flush",provenance:v,workspaceId:f,agentId:k,lifetime:_.lifetime,revision:_.revision},I)},async clear(f,k){await y(f,k,v=>({kind:"clear",provenance:v.provenance,workspaceId:f,agentId:k,lifetime:v.lifetime,revision:v.revision,origin:s}))},subscribe(f){return r.add(f),()=>{r.delete(f)}},dispose(){o=!0,h(),r.clear(),a.clear()}}}let L=null;async function Ws(e,t,n,a,r){const s=L;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(L!==s||s.authority()!==r)throw new Error("draft-authority-changed")};i(),await s.edit(e,t,n,a),i(),await s.flush(t,n),i()}async function js(e,t){await Promise.resolve(),L&&await L.flush(e,t)}function qs(){if(!Sn())return null;const e=Za({request:n=>vn(Ya,n),subscribe:n=>kn(a=>{a.method===Ja&&n(a.params)})},()=>Dn(A.state),()=>Rn(A.state));L=e;const t=e.dispose;return e.dispose=()=>{L===e&&(L=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function Vs(e,t){return kt.get(vt(e,t))}function zs(e,t,n){kt.set(vt(e,t),n)}const Gs=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.userMessageIndexes,n):void 0}),Ys=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.retryAgents,n):void 0});function er(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const s=e/1e3,i=s.toFixed(1);return i.endsWith(".0")?`${Math.round(s)}s`:`${i}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${a}m ${r}s`:`${a}m ${r}s`}function Js(e){return er(Math.max(1e3,Math.round(e/1e3)*1e3))}const tr=new Set(["launch","init","session-create","session-load","prompt"]),nr=new Set(["tool-call","tool-waiting"]);function ar(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Qs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function Xs(e,t){const n=ar(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Zs(e){let t=null;for(const n of e)n.phase!==_t&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ve={get title(){return b.chat_streamingStatus_sessionCorrupted_title()},get message(){return b.chat_streamingStatus_sessionCorrupted_message()}},rr=/^session\/[a-z_]+(?: failed)?:\s*/i;function sr(e){const n=(e.split(`
12
- `).map(a=>a.trim()).find(Boolean)??"").replace(rr,"");return n.charAt(0).toUpperCase()+n.slice(1)}function ei(e,t){return e?t===!0?{corrupted:!0,title:Ve.title,message:Ve.message,detail:e}:{corrupted:!1,title:b.chat_streamingStatus_responseFailed_label(),message:sr(e),detail:null}:null}const ti=A.createSelector((e,t)=>R(e.questionUi.consumers,t)),ir=3e4,Y=new Map;function ni(e,t){const n=Y.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>Y.delete(e),ir);Y.set(e,{value:t,timer:a})}function ai(e){const t=Y.get(e);if(t)return clearTimeout(t.timer),Y.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[Ut(t,n)]??Lt),or=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),ri=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&or.select(e,t,n).length>0}),cr=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},J=new Map,x=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const lr=200;function dr(e,t){if(x.delete(e),x.set(e,t),x.size>lr){const n=x.keys().next().value;n!==void 0&&x.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function si(e){return At(e)?.id??null}function ii(e){De(e,{requireViewedAndFocused:!0})}function oi(e){De(e,{requireViewedAndFocused:!1})}function ci(e){Ce(),De(e,Mt)}function li(e){W===e&&(J.has(e)||(W=null,Re(e,Mt)))}function di(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),Re(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),Re(e,t)},cr);J.set(e,{timer:n,gates:t})}let ze=null;function ur(){return ze??=Promise.all([fe(()=>import("./Di-it7y2.js"),__vite__mapDeps([42,21,22,5,23,24,3,8,4,25,15,2,43,44]),import.meta.url),fe(()=>import("./CepTMMxo.js").then(e=>e.o),__vite__mapDeps([45,37,4,5,21,22,23,24,3,8,25,15,2,13,14,7,9,16,40,39,46,32,36]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function Re(e,t){let n=null;try{const{appStore:a,appClient:r}=await ur(),s=a.state;if(t.requireViewedAndFocused&&(s.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const i=s.agentSessions?.byAgentId[e];if(!i)return;const o=typeof i.workspaceId=="string"?i.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&s.chatState?.byAgentId[e]?.initialHistoryPending){W=e;return}const l=At(i.messages??[]);if(!l){t.requireAssistantTail&&(W=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(x.get(e)===c)return;dr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&x.get(e)===n&&x.delete(e)}catch{n!==null&&x.get(e)===n&&x.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function ui(e,t){return oe.get(Tt(e,t))}function mi(e,t,n){oe.set(Tt(e,t),n)}function pi(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{Ms as $,Nr as A,Xr as B,zr as C,O as D,Fa as E,Yr as F,Ea as G,Da as H,Gn as I,js as J,Js as K,Es as L,cr as M,Xs as N,Ps as O,ui as P,Vs as Q,yt as R,Ts as S,ps as T,Ss as U,qe as V,fs as W,Zs as X,Qs as Y,ls as Z,ds as _,is as a,Wr as a0,na as a1,Ds as a2,Kr as a3,Ks as a4,G as a5,qr as a6,jr as a7,$r as a8,Hs as a9,St as aA,ri as aB,ms as aC,xr as aD,Pr as aE,Rr as aF,ws as aG,ks as aH,bs as aI,vs as aJ,gt as aK,ti as aL,Ys as aM,Gs as aN,mi as aO,zs as aP,xs as aQ,Fr as aR,ys as aS,Fs as aT,ni as aU,As as aV,Pa as aW,ai as aX,aa as aY,Hr as aZ,di as aa,li as ab,ii as ac,oi as ad,ci as ae,si as af,Bs as ag,cs as ah,Zr as ai,Hn as aj,Ws as ak,Vr as al,ss as am,Jr as an,Ba as ao,pt as ap,Lr as aq,Is as ar,$s as as,_s as at,os as au,Ce as av,us as aw,Br as ax,Os as ay,or as az,we as b,Us as c,as as d,rs as e,Cs as f,Ur as g,Ca as h,Or as i,sa as j,ra as k,Ns as l,Ls as m,pi as n,gs as o,Rs as p,ns as q,ts as r,Gr as s,qs as t,es as u,ei as v,hs as w,Qr as x,ge as y,qn as z};
11
+ `),e)}function ss(e,t,n){if(e==="suggested-prompt")return{fields:{},hasAttachments:!1,cleanup:{clearInput:!1,followBottom:!0,historyText:null}};const a=n(),{imageBlocks:r,fileBlocks:s}=Ea(a.contextItems);return{fields:{contextItems:a.contextItems,workspaceContextStr:Ca(a.contextItems,a.checkedPanels,a.checkedSelections),noteIds:a.noteIds,...r.length>0?{imageBlocks:r}:{},...s.length>0?{fileBlocks:s}:{},...a.pickedMentions?{messageMetadata:a.pickedMentions}:{}},hasAttachments:r.length>0||s.length>0,cleanup:{clearInput:!0,followBottom:!0,historyText:t}}}const Da="chat-read:",K=new Map,ye=new Set;function is(e,t){let n=K.get(e);n||(n=new Set,K.set(e,n)),n.add(t)}function os(e,t){const n=K.get(e);if(!(!n||!n.delete(t))&&n.size===0){K.delete(e);for(const a of[...ye])a(e)}}function cs(e){return ye.add(e),()=>ye.delete(e)}function ls(e){return K.has(e)}function ds(e){const t=K.get(e);if(!t)return!1;for(const n of t)if(!n.startsWith(Da))return!0;return!1}function Ra(e,t,n){const a=e.state.pendingSubmissions.byAgentId[t.agentId];if(!a||!Ge(a.scope,t))return null;const r={...structuredClone(n),id:crypto.randomUUID(),createdAt:Date.now()};e.dispatch(xt(t,r));const s=e.state.pendingSubmissions.byAgentId[t.agentId];return s&&R(s.submissions,r.id)?r:null}function xa(e,t,n,a,r){const s=Be.select(e.state,n),i=pe.select(e.state)?.principal.id,o=Le(e.state);if(!s||!i||!o)return null;const l=In(t,n),c={agentId:t,workspaceId:n,principalId:i,participation:s,authority:o,owner:l.key,lifetime:e.state.pendingSubmissions.byAgentId[t]?.scope.lifetime??crypto.randomUUID()},d=()=>l.isCurrent(e.state.agentSessions?.byAgentId[t]?.workspaceId)&&Be.select(e.state,n)===s&&pe.select(e.state)?.principal.id===i&&Le(e.state)===o;if(!d())return null;e.dispatch(Rt(c,a,Ft.select(e.state,n)));const u=Ra(e,c,r);return u?{scope:c,submission:u,isCurrent:()=>{const h=e.state.pendingSubmissions.byAgentId[t];return d()&&!!h&&Ge(h.scope,c)&&(!!R(h.operations,u.id)||!!R(h.submissions,u.id))}}:null}function we(e,t,n){if(!n.text.trim()&&!n.imageBlocks?.length&&!n.fileBlocks?.length)return null;const a=n.userAppMessageId??Tn();return xa(e,t,n.wsId,pe.select(e.state)?.capabilities.submissionCorrelation,{content:n.text.trim(),appMessageId:a,destination:!n.forceSubmit&&Kt.select(e.state,t)?"queue":"conversation",contextItems:n.contextItems,imageBlocks:n.imageBlocks,fileBlocks:n.fileBlocks,messageMetadata:n.messageMetadata})}function Pa(e,t,n){const a=we(e,t,n);return a?(e.dispatch(Ye(t,{...n,userAppMessageId:a.submission.appMessageId,submission:{scope:a.scope,id:a.submission.id}})),!0):!1}async function Ba(e,t,n,a){const r=n.submission;if(!r)return"legacy";const s=r.reference,i=()=>s.scope.agentId===e&&s.scope.workspaceId===t&&Qe.select(A.state,e)===n?hn.select(A.state,s.scope):void 0,o=i();if(!o)return null;if(!o.supported)return"legacy";const l={wsId:t,text:n.text,imageBlocks:n.options?.imageBlocks,fileBlocks:n.options?.fileBlocks,noteIds:n.options?.noteIds,messageMetadata:n.options?.messageMetadata,model:a??n.options?.model};if(r.outcome==="rejected"){const p=R(o.tombstones,s.id);return R(o.submissions,s.id)||p&&p.reason!=="rejected"?null:we(A,e,l)}if(r.outcome==="accepted")return we(A,e,l);await Promise.all([En(e,t).catch(()=>{}),Cn(e,t).catch(()=>{})]);const c=i();if(!c||R(c.submissions,s.id)?.status!=="uncertain")return null;const{notify:d}=await fe(async()=>{const{notify:p}=await import("./DkHPIJea.js").then(m=>m.E);return{notify:p}},__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,30,31,32,33,34,35,36,37,38,39,40,41]),import.meta.url);if(i()!==c)return null;let u=!1;const h=()=>{u=!0};return d.warning(b.agent_chatSend_uncertainRetry_description(),{key:`submission-retry:${t}:${e}:${s.id}`,duration:Number.POSITIVE_INFINITY,action:{label:b.agent_chatSend_resend_label(),onClick:()=>{if(u)return;u=!0;const p=i();!p||p.generation!==c.generation||p.submissions!==c.submissions||p.observationVersion!==c.observationVersion||R(p.submissions,s.id)?.status!=="uncertain"||Pa(A,e,l)}},cancel:{label:b.chat_richInput_cancel_label(),onClick:h},onDismiss:h}),null}async function us(e,t,n){const a=Qe.select(A.state,e),r=a?.submission?await Ba(e,t,a,n):"legacy";if(r){if(r==="legacy"){await A.dispatch(n===void 0?Pt(e,t):Bt(e,t,n));return}!r.isCurrent()||!a||A.dispatch(Ye(e,{wsId:t,text:a.text,imageBlocks:a.options?.imageBlocks,fileBlocks:a.options?.fileBlocks,noteIds:a.options?.noteIds,messageMetadata:a.options?.messageMetadata,model:n??a.options?.model,userAppMessageId:r.submission.appMessageId,submission:{scope:r.scope,id:r.submission.id}}))}}const ms=A.createSelector((e,t)=>{const n=R(e.chatDrafts.owners,t);return n?{restore:n.restore,saves:Je(n.saves),shared:n.restore?e.chatDrafts.shared[JSON.stringify([n.restore.workspaceId,n.restore.agentId])]:void 0}:void 0});function Oa(e,t){return t.workspaceId===e&&!t.retiredAt&&!t.pendingDeleteAt&&t.status!==ke.Deleted&&!t.notificationsMuted&&$t(t)==="topLevel"}function $a(e){const t=e.metadata?.pendingQuestionsMessageId;return typeof t=="string"&&t.length>0&&!xn(e.metadata,t)?t:null}function La(e){return e.status===ke.Error&&!Wt(jt(e))}function ps(e,t){return t.filter(n=>Oa(e,n)).flatMap(n=>{const a=Ot(n),r=$a(n),s=n.status===ke.Error;if(!a&&!r&&!s)return[];const i=a?.timestamp??(s?n.stopReasonTimestamp:void 0);return[{agentId:n.id,agentName:n.name,kind:a?.kind??(s?"failed":"question"),reason:a?.reason,timestamp:i&&Number.isFinite(Date.parse(i))?i:void 0,questionMessageId:r,canRetry:La(n)}]})}function fs(e){return e.displayStatus==="failed"?"failed":e.displayStatus==="blocked"?"blocked":e.attention==="review_required"?"review":e.displayStatus==="needs_attention"?"question":e.activity==="agent_running"||e.displayStatus==="in_progress"?"running":e.scriptsRunning===!0?"scripts_running":e.backgroundTasksRunning===!0?"background_tasks_running":e.displayStatus==="pr_ready"?"pr_ready":e.displayStatus==="pr_merged"?"merged":e.displayStatus==="complete"?"complete":e.attention==="unread"?"unread":e.displayStatus==="pr_open"||e.displayStatus==="pr_queued"?e.displayStatus:"idle"}function hs(e){const t=e.kind==="prs"?e.organization?.trim().toLowerCase():void 0;return{key:JSON.stringify([e.kind,e.workspaceId,t||null,[...new Set((t?[]:e.repositories).map(n=>JSON.stringify([n.key,n.owner,n.name])))].sort()]),hasGitHubRepositories:!!t||e.repositories.some(n=>!!n.owner),hasLocalRepositories:!t&&e.repositories.some(n=>!n.owner)}}function Te(e){const t=bn(e);if(t?.kind!=="pr"||!Number.isSafeInteger(t.number)||t.number<=0)return null;const n=t.owner.toLowerCase(),a=t.repo.toLowerCase();return{owner:n,repo:a,number:t.number,id:`${n}/${a}#${t.number}`,url:`https://github.com/${n}/${a}/pull/${t.number}`}}function gs(e,t,n,a){const r=e.filter(s=>a?a.includes(s.id):n?s.repositoryOwner?.toLowerCase()===n.toLowerCase():t.some(i=>i.owner?.toLowerCase()===s.repositoryOwner?.toLowerCase()&&i.name.toLowerCase()===s.repositoryName?.toLowerCase()));return[...new Map(r.flatMap(s=>[...(s.pullRequests??[]).map(i=>i.url),s.activePullRequest?.url,s.prUrl]).flatMap(s=>{const i=s?Te(s):null;return i?[[i.id,{owner:i.owner,repo:i.repo,number:i.number}]]:[]})).values()].sort((s,i)=>`${s.owner}/${s.repo}#${s.number}`.localeCompare(`${i.owner}/${i.repo}#${i.number}`))}function ys(e,t){const[n]=t;return t.length!==1||e.owner?.toLowerCase()!==n?.owner?.toLowerCase()||e.repo?.toLowerCase()!==n?.name.toLowerCase()}const ws=A.createSelector(e=>e.homeIntegrations),bs=A.createSelector(e=>{const t=e.homeIntegrations;return!t.linkedItems||!Object.keys(t.linkedItems).length?t:{...t,items:[...new Map([...Object.values(t.linkedItems),...t.items].map(n=>[n.id,n])).values()].sort((n,a)=>(a.updatedAt??"").localeCompare(n.updatedAt??""))}}),gt=A.createSelector(e=>Je(e.workspace.workspaces).flatMap(t=>[...(t.pullRequests??[]).map(n=>n.url),t.activePullRequest?.url,t.prUrl].filter(n=>!!n).map(n=>({url:Te(n)?.url??n.replace(/\/$/,"").toLowerCase(),workspaceId:t.id,name:t.title||t.id})))),ks=A.createSelector(e=>{const t=e.homeIntegrations.detail?.url,n=t?Te(t)?.url??t.replace(/\/$/,"").toLowerCase():void 0;return gt.select(e).find(a=>a.url===n)??null}),vs=A.createSelector(e=>gt.select(e).map(t=>t.url));let ee=null;function _s(e){return ee=e,()=>{ee===e&&(ee=null)}}function Ss(){return ee}function Ms(e){return[...e.groups.length>0?e.groups.filter(n=>n.expanded).flatMap(n=>n.items):e.workspaces,...e.asideExpanded?e.aside:[]].map(n=>n.id)}function As(e,t,n){if(e.length===0)return null;const a=t===null?-1:e.indexOf(t);return a===-1?e[0]:e[a+(n==="clockwise"?1:-1)]??null}let te=null;function Is(e){return te=e,()=>{te===e&&(te=null)}}function Ts(){return te}function Es(e){return An(e)}function Ua(e){return Mn(e)}function Na(e,t){return!e||!t?!1:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function me(e){if(e.length===0)return[];const t=[];let n=null;for(const a of e){const r=a.timestamp?typeof a.timestamp=="string"?new Date(a.timestamp):a.timestamp:new Date;(!n||!Na(n.date,r))&&(n={date:r,label:Ua(r),messages:[]},t.push(n)),n.messages.push(a)}return t}function Cs(e){const t=new Map;return e.map(({date:n})=>{const a=`${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`,r=t.get(a)??0;return t.set(a,r+1),r===0?a:`${a}#${r}`})}function Ds(e,t){const n=new Map;let a=t?null:void 0;for(const r of e.groups)for(const s of r.messages)a!==void 0&&n.set(s.id,a),s.role==="user"&&!Bn(s)&&(a=s);return n}function Ha(e){return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`}function je(e,t){const n=new Map;return e.map(a=>{const r=`${t}-${Ha(a.date)}`,s=(n.get(r)??0)+1;return n.set(r,s),{...a,groupKey:s===1?r:`${r}-${s}`}})}function Fa(e,t){if(e.length===0||t.length===0)return e;const n=new Set(t.map(s=>s.id)),a=new Set(t.map(s=>s.appMessageId).filter(s=>typeof s=="string"&&s.length>0)),r=e.filter(s=>!n.has(s.id)&&!(typeof s.appMessageId=="string"&&s.appMessageId.length>0&&a.has(s.appMessageId)));return r.length===e.length?e:r}function Rs(e,t,n){return e=Fa(e,t),e.length===0?{groups:me(t),detached:!1,hiddenTail:[]}:n?{groups:je(me(e),"h"),detached:!0,hiddenTail:t}:{groups:je(me([...e,...t]),"d"),detached:!1,hiddenTail:[]}}function xs(e){const{scrollTop:t,threshold:n,fetching:a,exhausted:r,historyCount:s,tailCount:i,tailTruncated:o,totalMessages:l,spacerAbove:c=0}=e;return t>n+c||a||r?!1:s>0||o||l>i+s}const Ps=300;function Bs(e){const{fetching:t,chainEvaluationPending:n,visible:a,hideArmed:r}=e;return t||n?a&&!r?"none":"show":a&&!r?"arm-hide":"none"}const qe=24,Ka=320;function Ee(e){return Number.isFinite(e)?Math.min(Ka,Math.max(qe,e)):qe}const Wa=.2,ja=.12;function qa(e,t,n=Wa){const a=Ee(t);return e===null||!Number.isFinite(e)?a:e+n*(a-e)}function Os(e,t){const n=Ee(t??Number.NaN);return{above:Math.round(Math.max(0,e.above)*n),below:Math.round(Math.max(0,e.below)*n)}}function $s(e){const{totalMessages:t,residentCount:n,exhausted:a,residentContentHeight:r,currentSpacerHeight:s,viewportHeight:i}=e;let o=e.rowHeightEma;n>0&&r>0&&(o=qa(o,r/n));const l=e.unloadedRows??t-n,d=a||t<=0||n<=0||l<=0||o===null?0:Math.round(l*o),u=Math.abs(d-s);return u===0?{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}:d===0||s===0||u>s*ja||i>0&&u>i?{spacerHeight:d,rowHeightEma:o,applied:!0,scrollTopDelta:d-s}:{spacerHeight:s,rowHeightEma:o,applied:!1,scrollTopDelta:0}}const Va=Pn,za=2;function Ls(e){const{scrollTop:t,spacerAboveHeight:n,rowHeightEstimate:a,pageSize:r=Va,nearPages:s=za}=e;if(n<=0||t>=n)return"serial";const i=Ee(a??Number.NaN);return(n-Math.max(0,t))/i>s*r?"seek":"serial"}const yt=200,Ga=1;function Us(e,t,n=yt){const a=t.timestamp-n;return[...e.filter(r=>r.timestamp>=a),t]}function Ns(e){const{samples:t,viewportHeight:n,windowMs:a=yt,viewportFactor:r=Ga}=e;if(n<=0||t.length<2)return"gentle";const s=t[t.length-1].timestamp-a,i=t.filter(l=>l.timestamp>=s);if(i.length<2)return"gentle";let o=0;for(let l=1;l<i.length;l+=1)o+=Math.abs(i[l].scrollTop-i[l-1].scrollTop);return o>n*r?"rapid":"gentle"}function Hs(e){const{scrollTop:t,spacerAboveHeight:n,unloadedRowsAbove:a}=e;if(a<=0||n<=0)return 0;const r=Math.min(1,Math.max(0,t/n));return Math.min(a-1,Math.max(0,Math.floor(r*a)))}function Fs(e){const{totalMessages:t,residentCount:n,exhausted:a,startOrdinalEstimate:r,detachedFromTail:s}=e,i=Math.max(0,t-n);if(!s)return{above:a?0:i,below:0};const o=Math.max(0,e.hiddenTailCount??0);if(a)return{above:0,below:i+o};if(r!==null){const c=Math.min(i,Math.max(0,Math.round(r)));return{above:c,below:i-c+o}}const l=Math.min(i,Math.max(0,Math.round(e.holeRowsEstimate??0)));return{above:i-l,below:l+o}}function Ks(e){const{exhausted:t,historyCount:n,tailCount:a,tailTruncated:r,totalMessages:s}=e;return t?!0:n>0?!1:!r&&s<=a}const Ya="intent.drafts.sync",Ja="intent.drafts.changed",Qa=$({id:E(),type:E(),label:E(),description:E().optional(),content:E().optional(),path:E().optional(),imageData:E().optional(),imageMimeType:E().optional(),attachmentId:E().optional(),attachmentMimeType:E().optional(),attachmentSize:ce().optional(),sourcePath:E().optional(),placementStatus:V("failed").optional(),screen:On().optional()}),wt=$({text:E(),attachments:$n(Qa)}),z={provenance:E().min(1),workspaceId:E().min(1),agentId:E().min(1)},ne={lifetime:E(),revision:ce().int().nonnegative()};Ln("kind",[$({...z,kind:V("read")}),$({...z,...ne,kind:V("edit"),origin:E().min(1),sequence:ce().int().positive(),snapshot:wt}),$({...z,...ne,kind:V("flush")}),$({...z,...ne,kind:V("clear"),origin:E().min(1)})]);const bt=$({...z,...ne,origin:E(),sequence:ce().int().nonnegative(),snapshot:wt}),Xa=$({accepted:Un(),draft:bt});function Za(e,t,n=t){const a=new Map,r=new Set,s=crypto.randomUUID();let i=0,o=!1;const l=()=>{const f=t();if(o||!f)throw new Error("draft-authority-unavailable");return f},c=()=>{const f=n();if(!f||o)throw new Error("draft-authority-unavailable");return()=>{if(o||n()!==f)throw new Error("draft-authority-changed")}},d=(f,k,v)=>{const I=JSON.stringify([f,k,v]);let S=a.get(I);return S||(S={dirty:0},a.set(I,S)),S},u=(f,k)=>{if(o||f.provenance!==t())return;const v=d(f.provenance,f.workspaceId,f.agentId);if(!(v.value?.lifetime===f.lifetime&&v.value.revision>f.revision)&&(v.value=f,k&&v.dirty===0))for(const I of r)I(f)},h=e.subscribe(f=>{const k=bt.safeParse(f);k.success&&u(k.data,!0)}),p=async(f,k)=>{k();const v=Xa.parse(await e.request(f));if(k(),f.provenance!==l()||v.draft.provenance!==f.provenance)throw new Error("draft-authority-changed");if(!v.accepted)throw u(v.draft,!1),new Error("draft-changed-in-another-editor");return v.draft},m=async(f,k)=>{const v=l(),I=c(),S=d(v,f,k);S.tail&&await S.tail;const _=await p({kind:"read",provenance:v,workspaceId:f,agentId:k},I);return u(_,!1),_},y=(f,k,v)=>{const I=l(),S=c(),_=d(I,f,k),B=_.tail??(_.value?Promise.resolve(_.value):p({kind:"read",provenance:I,workspaceId:f,agentId:k},S));_.dirty+=1;const C=B.then(P=>p(v(P),S));return _.tail=C,C.then(P=>{_.dirty-=1,_.tail===C&&(_.tail=void 0),u(P,!0)},()=>{_.dirty-=1,_.tail===C&&(_.tail=void 0)}),C};return{authority:()=>o?null:n(),read:m,async edit(f,k,v,I){const S=++i;return y(k,v,_=>({kind:"edit",provenance:_.provenance,workspaceId:k,agentId:v,lifetime:_.lifetime,revision:_.revision,origin:f,sequence:S,snapshot:I}))},async flush(f,k){const v=l(),I=c(),S=d(v,f,k),_=await(S.tail??(S.value?Promise.resolve(S.value):m(f,k)));await p({kind:"flush",provenance:v,workspaceId:f,agentId:k,lifetime:_.lifetime,revision:_.revision},I)},async clear(f,k){await y(f,k,v=>({kind:"clear",provenance:v.provenance,workspaceId:f,agentId:k,lifetime:v.lifetime,revision:v.revision,origin:s}))},subscribe(f){return r.add(f),()=>{r.delete(f)}},dispose(){o=!0,h(),r.clear(),a.clear()}}}let L=null;async function Ws(e,t,n,a,r){const s=L;if(!s)throw new Error("draft-shared-transport-unavailable");const i=()=>{if(L!==s||s.authority()!==r)throw new Error("draft-authority-changed")};i(),await s.edit(e,t,n,a),i(),await s.flush(t,n),i()}async function js(e,t){await Promise.resolve(),L&&await L.flush(e,t)}function qs(){if(!Sn())return null;const e=Za({request:n=>vn(Ya,n),subscribe:n=>kn(a=>{a.method===Ja&&n(a.params)})},()=>Dn(A.state),()=>Rn(A.state));L=e;const t=e.dispose;return e.dispose=()=>{L===e&&(L=null),t()},e}const kt=new Map;function vt(e,t){return`${e}\0${t}`}function Vs(e,t){return kt.get(vt(e,t))}function zs(e,t,n){kt.set(vt(e,t),n)}const Gs=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.userMessageIndexes,n):void 0}),Ys=A.createSelector((e,t,n)=>{const a=e.chatPanelUi.byWorkspaceId[t];return a?R(a.retryAgents,n):void 0});function er(e){e=Math.max(0,e);const t=Math.floor(e/1e3);if(t<10){const s=e/1e3,i=s.toFixed(1);return i.endsWith(".0")?`${Math.round(s)}s`:`${i}s`}if(t<60)return`${t}s`;const n=Math.floor(t/3600),a=Math.floor(t%3600/60),r=t%60;return n>0?`${n}h ${a}m ${r}s`:`${a}m ${r}s`}function Js(e){return er(Math.max(1e3,Math.round(e/1e3)*1e3))}const tr=new Set(["launch","init","session-create","session-load","prompt"]),nr=new Set(["tool-call","tool-waiting"]);function ar(e){let t=null;for(const n of e)(!t||n.timestamp>=t.timestamp)&&(t=n);return t}function Qs(e){return e&&tr.has(e)?"pulse":e&&nr.has(e)?"twist":"bloom"}const _t="stalled";function Xs(e,t){const n=ar(e);return!n||n.phase!==_t||typeof t=="number"&&t>n.timestamp?null:n}function Zs(e){let t=null;for(const n of e)n.phase!==_t&&(!t||n.timestamp>=t.timestamp)&&(t=n);return t}const Ve={get title(){return b.chat_streamingStatus_sessionCorrupted_title()},get message(){return b.chat_streamingStatus_sessionCorrupted_message()}},rr=/^session\/[a-z_]+(?: failed)?:\s*/i;function sr(e){const n=(e.split(`
12
+ `).map(a=>a.trim()).find(Boolean)??"").replace(rr,"");return n.charAt(0).toUpperCase()+n.slice(1)}function ei(e,t){return e?t===!0?{corrupted:!0,title:Ve.title,message:Ve.message,detail:e}:{corrupted:!1,title:b.chat_streamingStatus_responseFailed_label(),message:sr(e),detail:null}:null}const ti=A.createSelector((e,t)=>R(e.questionUi.consumers,t)),ir=3e4,Y=new Map;function ni(e,t){const n=Y.get(e);n&&clearTimeout(n.timer);const a=setTimeout(()=>Y.delete(e),ir);Y.set(e,{value:t,timer:a})}function ai(e){const t=Y.get(e);if(t)return clearTimeout(t.timer),Y.delete(e),t.value}const St=A.createSelector((e,t,n)=>e.agentWorkers?.byKey[Ut(t,n)]??Lt),or=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="unsupported"?[]:(a.snapshot?.workers??[]).filter(r=>r.status==="running"||r.status==="unknown")}),ri=A.createSelector((e,t,n)=>{const a=St.select(e,t,n);return a.status==="failed"?!0:a.status!=="ready"||!a.snapshot?!1:a.snapshot.truncated?!0:a.snapshot.support.status!=="supported"&&or.select(e,t,n).length>0}),cr=1e3,Mt={requireViewedAndFocused:!0,requireAssistantTail:!0},J=new Map,x=new Map;let W=null;function Ce(e){(e===void 0||W===e)&&(W=null)}const lr=200;function dr(e,t){if(x.delete(e),x.set(e,t),x.size>lr){const n=x.keys().next().value;n!==void 0&&x.delete(n)}}function At(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(!n.isStreaming&&typeof n.id=="string"&&n.id.length>0)return n}return null}function si(e){return At(e)?.id??null}function ii(e){De(e,{requireViewedAndFocused:!0})}function oi(e){De(e,{requireViewedAndFocused:!1})}function ci(e){Ce(),De(e,Mt)}function li(e){W===e&&(J.has(e)||(W=null,Re(e,Mt)))}function di(e){for(const t of e)typeof t!="string"||t.length===0||(It(t),Ce(t),Re(t,{requireViewedAndFocused:!1}))}function It(e){const t=J.get(e);t&&(clearTimeout(t.timer),J.delete(e))}function De(e,t){It(e),Ce(e);const n=setTimeout(()=>{J.delete(e),Re(e,t)},cr);J.set(e,{timer:n,gates:t})}let ze=null;function ur(){return ze??=Promise.all([fe(()=>import("./BEwavXhY.js"),__vite__mapDeps([42,21,22,5,23,24,3,8,4,25,15,2,43,44]),import.meta.url),fe(()=>import("./B21KgEqG.js").then(e=>e.o),__vite__mapDeps([45,37,4,5,21,22,23,24,3,8,25,15,2,13,14,7,9,16,40,39,46,32,36]),import.meta.url)]).then(([e,t])=>({appStore:e.store,appClient:t.appClient})),ze}async function Re(e,t){let n=null;try{const{appStore:a,appClient:r}=await ur(),s=a.state;if(t.requireViewedAndFocused&&(s.unreadTracking?.currentlyViewedAgentId!==e||typeof document<"u"&&!document.hasFocus()))return;const i=s.agentSessions?.byAgentId[e];if(!i)return;const o=typeof i.workspaceId=="string"?i.workspaceId:"";if(o.length===0)return;if(t.requireAssistantTail&&s.chatState?.byAgentId[e]?.initialHistoryPending){W=e;return}const l=At(i.messages??[]);if(!l){t.requireAssistantTail&&(W=e);return}if(t.requireAssistantTail&&l.role!=="assistant")return;const c=l.id;if(x.get(e)===c)return;dr(e,c),n=c,!(await r.agents.markSeen({workspaceId:o,agentId:e,messageId:c})).success&&x.get(e)===n&&x.delete(e)}catch{n!==null&&x.get(e)===n&&x.delete(e)}}const oe=new Map;function Tt(e,t){return`${e}\0${t}`}function ui(e,t){return oe.get(Tt(e,t))}function mi(e,t,n){oe.set(Tt(e,t),n)}function pi(e){if(e.length===0)return;const t=new Set(e);for(const n of[...oe.keys()]){const a=n.slice(n.indexOf("\0")+1);t.has(a)&&oe.delete(n)}}export{Ms as $,Nr as A,Xr as B,zr as C,O as D,Fa as E,Yr as F,Ea as G,Da as H,Gn as I,js as J,Js as K,Es as L,cr as M,Xs as N,Ps as O,ui as P,Vs as Q,yt as R,Ts as S,ps as T,Ss as U,qe as V,fs as W,Zs as X,Qs as Y,ls as Z,ds as _,is as a,Wr as a0,na as a1,Ds as a2,Kr as a3,Ks as a4,G as a5,qr as a6,jr as a7,$r as a8,Hs as a9,St as aA,ri as aB,ms as aC,xr as aD,Pr as aE,Rr as aF,ws as aG,ks as aH,bs as aI,vs as aJ,gt as aK,ti as aL,Ys as aM,Gs as aN,mi as aO,zs as aP,xs as aQ,Fr as aR,ys as aS,Fs as aT,ni as aU,As as aV,Pa as aW,ai as aX,aa as aY,Hr as aZ,di as aa,li as ab,ii as ac,oi as ad,ci as ae,si as af,Bs as ag,cs as ah,Zr as ai,Hn as aj,Ws as ak,Vr as al,ss as am,Jr as an,Ba as ao,pt as ap,Lr as aq,Is as ar,$s as as,_s as at,os as au,Ce as av,us as aw,Br as ax,Os as ay,or as az,we as b,Us as c,as as d,rs as e,Cs as f,Ur as g,Ca as h,Or as i,sa as j,ra as k,Ns as l,Ls as m,pi as n,gs as o,Rs as p,ns as q,ts as r,Gr as s,qs as t,es as u,ei as v,hs as w,Qr as x,ge as y,qn as z};
@@ -1 +1 @@
1
- import{J as h}from"./DepfqAOx.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./CkxlqZls.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{J as h}from"./Ca9Vj8X7.js";import{c as v}from"./ChTqQfQN.js";import{O as d}from"./DPKwA49z.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,4 +1,4 @@
1
- import{p as tt}from"./Cf7gW7aB.js";import{U as et,aZ as at,V as rt,a_ as it,Y as nt,b0 as ot,b as l,ay as E,X as st,q as lt,aX as ct,aH as dt,d as I,B as gt,r as ht,aJ as pt,O as ft}from"./B9uFsQO_.js";import{p as ut}from"./SyqyCDjk.js";import{o as mt}from"./C7tJ8OXj.js";var vt=ft.pie,R={sections:new Map,showData:!1},b=R.sections,H=R.showData,St=structuredClone(vt),xt=l(()=>structuredClone(St),"getConfig"),wt=l(()=>{b=new Map,H=R.showData,ht()},"clear"),$t=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);b.has(t)||(b.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Ct=l(()=>b,"getSections"),yt=l(t=>{H=t},"setShowData"),Dt=l(()=>H,"getShowData"),U={getConfig:xt,clear:wt,setDiagramTitle:ot,getDiagramTitle:nt,setAccTitle:it,getAccTitle:rt,setAccDescription:at,getAccDescription:et,addSection:$t,getSections:Ct,setShowData:yt,getShowData:Dt},bt=l((t,a)=>{tt(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),Tt={parse:l(async t=>{const a=await ut("pie",t);E.debug(a),bt(a,U)},"parse")},At=l(t=>`
1
+ import{p as tt}from"./DmSaqClG.js";import{U as et,aZ as at,V as rt,a_ as it,Y as nt,b0 as ot,b as l,ay as E,X as st,q as lt,aX as ct,aH as dt,d as I,B as gt,r as ht,aJ as pt,O as ft}from"./B1YqGJC0.js";import{p as ut}from"./SyqyCDjk.js";import{o as mt}from"./CU48trLA.js";var vt=ft.pie,R={sections:new Map,showData:!1},b=R.sections,H=R.showData,St=structuredClone(vt),xt=l(()=>structuredClone(St),"getConfig"),wt=l(()=>{b=new Map,H=R.showData,ht()},"clear"),$t=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);b.has(t)||(b.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Ct=l(()=>b,"getSections"),yt=l(t=>{H=t},"setShowData"),Dt=l(()=>H,"getShowData"),U={getConfig:xt,clear:wt,setDiagramTitle:ot,getDiagramTitle:nt,setAccTitle:it,getAccTitle:rt,setAccDescription:at,getAccDescription:et,addSection:$t,getSections:Ct,setShowData:yt,getShowData:Dt},bt=l((t,a)=>{tt(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),Tt={parse:l(async t=>{const a=await ut("pie",t);E.debug(a),bt(a,U)},"parse")},At=l(t=>`
2
2
  .pieCircle{
3
3
  stroke: ${t.pieStrokeColor};
4
4
  stroke-width : ${t.pieStrokeWidth};
@@ -1 +1 @@
1
- import{t as a3,bo as p,bw as t3,b as s3}from"./BkP7iWmk.js";import{bs as r3,a5 as o3,aD as t,bA as I,b_ as m,W as f,bn as l3,c9 as l,bV as L,aA as u,ay as i3,bS as n3,aw as S,bz as c3,bl as Z,bO as N,aB as v,bH as A}from"./DYhIMPy1.js";import{i as B}from"./Cmsd5u03.js";import{E as m3}from"./AZ8Xy_Xh.js";import{f as _,g as x,s as F}from"./DdeuoyZB.js";import{F as f3,aQ as v3,aI as g3,aZ as p3,cr as u3,am as d3}from"./Duz2cV7w.js";var h3=v("<div></div>"),b3=v('<span class="type-caption absolute text-subtle font-medium"> </span>'),w3=v("<img/> <!>",1),C3=v('<span class="type-caption text-subtle font-medium"> </span>'),_3=v("<div><!></div>");function x3(y,i){if(new.target)return a3({component:x3,...y});r3(i,!0);let r=p(i,"iconName",7),n=p(i,"label",7),o=p(i,"size",7,20),d=p(i,"class",7,"");const j={redis:"redis",mongodb:"mongodb",circleci:"circleci",vercel:"vercel",railway:"railway",convex:"convex",snowflake:"snowflake",sentry:"sentry",figma:"figma",github:"github",linear:"linear"},D={figma:"https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Figma-logo.svg/960px-Figma-logo.svg.png",playwright:"https://ray.run/playwright-brand-assets/playwright-logo.svg"},E={context7:'<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 0C26.2091 0 28 1.79086 28 4V24C28 26.2091 26.2091 28 24 28H4C1.79086 28 0 26.2091 0 24V4C0 1.79086 1.79086 0 4 0H24ZM8.58008 15.2559C8.58008 17.8621 7.95482 19.3557 6.33398 21.1885V22.7783H11.6309V21.1045H8.17773C9.66098 19.3776 10.5723 17.5019 10.5723 15.2559H8.58008ZM17.4268 15.2559C17.4268 17.5019 18.338 19.3776 19.8213 21.1045H16.3672V22.7783H21.6641V21.1885C20.0433 19.3558 19.4189 17.862 19.4189 15.2559H17.4268ZM6.33398 6.80957C7.95495 8.64244 8.58008 10.137 8.58008 12.7432H10.5713C10.5713 10.4972 9.66094 8.62143 8.17773 6.89453H11.6309V5.2207H6.33398V6.80957ZM16.3672 5.2207V6.89453H19.8213C18.338 8.62145 17.4268 10.4972 17.4268 12.7432H19.4189C19.4189 10.137 20.0432 8.64242 21.6641 6.80957V5.2207H16.3672Z" fill="black"/></svg>',slack:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path d="M27.255 80.719c0 7.33-5.978 13.317-13.309 13.317C6.616 94.036.63 88.049.63 80.719s5.987-13.317 13.317-13.317h13.309zm6.709 0c0-7.33 5.987-13.317 13.317-13.317s13.317 5.986 13.317 13.317v33.335c0 7.33-5.986 13.317-13.317 13.317-7.33 0-13.317-5.987-13.317-13.317zm0 0" fill="#de1c59"/><path d="M47.281 27.255c-7.33 0-13.317-5.978-13.317-13.309C33.964 6.616 39.951.63 47.281.63s13.317 5.987 13.317 13.317v13.309zm0 6.709c7.33 0 13.317 5.987 13.317 13.317s-5.986 13.317-13.317 13.317H13.946C6.616 60.598.63 54.612.63 47.281c0-7.33 5.987-13.317 13.317-13.317zm0 0" fill="#35c5f0"/><path d="M100.745 47.281c0-7.33 5.978-13.317 13.309-13.317 7.33 0 13.317 5.987 13.317 13.317s-5.987 13.317-13.317 13.317h-13.309zm-6.709 0c0 7.33-5.987 13.317-13.317 13.317s-13.317-5.986-13.317-13.317V13.946C67.402 6.616 73.388.63 80.719.63c7.33 0 13.317 5.987 13.317 13.317zm0 0" fill="#2eb57d"/><path d="M80.719 100.745c7.33 0 13.317 5.978 13.317 13.309 0 7.33-5.987 13.317-13.317 13.317s-13.317-5.987-13.317-13.317v-13.309zm0-6.709c-7.33 0-13.317-5.987-13.317-13.317s5.986-13.317 13.317-13.317h33.335c7.33 0 13.317 5.986 13.317 13.317 0 7.33-5.987 13.317-13.317 13.317zm0 0" fill="#ebb02e"/></svg>'},U=new Set(["context7","github","linear"]),h={brain:d3,server:u3,database:p3,cloud:g3,default:v3},z=l(()=>j[r().toLowerCase()]),W=l(()=>h[r().toLowerCase()]||h.default),H=l(()=>E[r().toLowerCase()]||null),M=l(()=>U.has(r().toLowerCase()));let b=L(!1),V=L(!1);const k=l(()=>D[r().toLowerCase()]||(t(z)?`https://cdn.simpleicons.org/${t(z)}`:null));function O(){A(b,!0)}function Q(){A(V,!0)}var q={get iconName(){return r()},set iconName(e){r(e),u()},get label(){return n()},set label(e){n(e),u()},get size(){return o()},set size(e=20){o(e),u()},get class(){return d()},set class(e=""){d(e),u()},$set:t3,$on:(e,a)=>s3(i,e,a)},c=_3(),G=o3(c);{var J=e=>{var a=h3();m3(a,()=>t(H),!0),I(a),m(()=>_(a,1,`w-full h-full flex items-center justify-center [&>svg]:w-full [&>svg]:h-full ${t(M)?"dark:invert":""}`)),f(e,a)},K=e=>{var a=w3(),s=i3(a);let g;var X=n3(s,2);{var Y=w=>{var C=b3(),$=Z(C,!0);m(e3=>{x(C,`font-size: ${o()*.45}px;`),N($,e3)},[()=>n().charAt(0)]),f(w,C)};B(X,w=>{t(b)||w(Y)})}m(()=>{F(s,"src",t(k)),F(s,"alt",n()),g=_(s,1,`w-full h-full object-contain ${t(M)?"dark:invert":""}`,null,g,{"opacity-0":!t(b)})}),S("load",s,O),S("error",s,Q),c3(s),f(e,a)},P=e=>{{let a=l(()=>o()*.7);f3(e,{get icon(){return t(W)},class:"text-ghost",get style(){return`font-size: ${t(a)??""}px;`}})}},R=l(()=>h[r().toLowerCase()]),T=e=>{var a=C3(),s=Z(a,!0);m(g=>{x(a,`font-size: ${o()*.45}px;`),N(s,g)},[()=>n().charAt(0)]),f(e,a)};B(G,e=>{t(H)?e(J):t(k)&&!t(V)?e(K,1):t(R)?e(P,2):e(T,-1)})}return I(c),m(()=>{_(c,1,`flex items-center justify-center shrink-0 ${d()??""}`),x(c,`width: ${o()??""}px; height: ${o()??""}px;`)}),f(y,c),l3(q)}export{x3 as M};
1
+ import{t as a3,bo as p,bw as t3,b as s3}from"./BkP7iWmk.js";import{bs as r3,a5 as o3,aD as t,bA as I,b_ as m,W as f,bn as l3,c9 as l,bV as L,aA as u,ay as i3,bS as n3,aw as S,bz as c3,bl as Z,bO as N,aB as v,bH as A}from"./DYhIMPy1.js";import{i as B}from"./Cmsd5u03.js";import{E as m3}from"./CEGk06kt.js";import{f as _,g as x,s as F}from"./DdeuoyZB.js";import{F as f3,aQ as v3,aI as g3,aZ as p3,cr as u3,am as d3}from"./Duz2cV7w.js";var h3=v("<div></div>"),b3=v('<span class="type-caption absolute text-subtle font-medium"> </span>'),w3=v("<img/> <!>",1),C3=v('<span class="type-caption text-subtle font-medium"> </span>'),_3=v("<div><!></div>");function x3(y,i){if(new.target)return a3({component:x3,...y});r3(i,!0);let r=p(i,"iconName",7),n=p(i,"label",7),o=p(i,"size",7,20),d=p(i,"class",7,"");const j={redis:"redis",mongodb:"mongodb",circleci:"circleci",vercel:"vercel",railway:"railway",convex:"convex",snowflake:"snowflake",sentry:"sentry",figma:"figma",github:"github",linear:"linear"},D={figma:"https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Figma-logo.svg/960px-Figma-logo.svg.png",playwright:"https://ray.run/playwright-brand-assets/playwright-logo.svg"},E={context7:'<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 0C26.2091 0 28 1.79086 28 4V24C28 26.2091 26.2091 28 24 28H4C1.79086 28 0 26.2091 0 24V4C0 1.79086 1.79086 0 4 0H24ZM8.58008 15.2559C8.58008 17.8621 7.95482 19.3557 6.33398 21.1885V22.7783H11.6309V21.1045H8.17773C9.66098 19.3776 10.5723 17.5019 10.5723 15.2559H8.58008ZM17.4268 15.2559C17.4268 17.5019 18.338 19.3776 19.8213 21.1045H16.3672V22.7783H21.6641V21.1885C20.0433 19.3558 19.4189 17.862 19.4189 15.2559H17.4268ZM6.33398 6.80957C7.95495 8.64244 8.58008 10.137 8.58008 12.7432H10.5713C10.5713 10.4972 9.66094 8.62143 8.17773 6.89453H11.6309V5.2207H6.33398V6.80957ZM16.3672 5.2207V6.89453H19.8213C18.338 8.62145 17.4268 10.4972 17.4268 12.7432H19.4189C19.4189 10.137 20.0432 8.64242 21.6641 6.80957V5.2207H16.3672Z" fill="black"/></svg>',slack:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path d="M27.255 80.719c0 7.33-5.978 13.317-13.309 13.317C6.616 94.036.63 88.049.63 80.719s5.987-13.317 13.317-13.317h13.309zm6.709 0c0-7.33 5.987-13.317 13.317-13.317s13.317 5.986 13.317 13.317v33.335c0 7.33-5.986 13.317-13.317 13.317-7.33 0-13.317-5.987-13.317-13.317zm0 0" fill="#de1c59"/><path d="M47.281 27.255c-7.33 0-13.317-5.978-13.317-13.309C33.964 6.616 39.951.63 47.281.63s13.317 5.987 13.317 13.317v13.309zm0 6.709c7.33 0 13.317 5.987 13.317 13.317s-5.986 13.317-13.317 13.317H13.946C6.616 60.598.63 54.612.63 47.281c0-7.33 5.987-13.317 13.317-13.317zm0 0" fill="#35c5f0"/><path d="M100.745 47.281c0-7.33 5.978-13.317 13.309-13.317 7.33 0 13.317 5.987 13.317 13.317s-5.987 13.317-13.317 13.317h-13.309zm-6.709 0c0 7.33-5.987 13.317-13.317 13.317s-13.317-5.986-13.317-13.317V13.946C67.402 6.616 73.388.63 80.719.63c7.33 0 13.317 5.987 13.317 13.317zm0 0" fill="#2eb57d"/><path d="M80.719 100.745c7.33 0 13.317 5.978 13.317 13.309 0 7.33-5.987 13.317-13.317 13.317s-13.317-5.987-13.317-13.317v-13.309zm0-6.709c-7.33 0-13.317-5.987-13.317-13.317s5.986-13.317 13.317-13.317h33.335c7.33 0 13.317 5.986 13.317 13.317 0 7.33-5.987 13.317-13.317 13.317zm0 0" fill="#ebb02e"/></svg>'},U=new Set(["context7","github","linear"]),h={brain:d3,server:u3,database:p3,cloud:g3,default:v3},z=l(()=>j[r().toLowerCase()]),W=l(()=>h[r().toLowerCase()]||h.default),H=l(()=>E[r().toLowerCase()]||null),M=l(()=>U.has(r().toLowerCase()));let b=L(!1),V=L(!1);const k=l(()=>D[r().toLowerCase()]||(t(z)?`https://cdn.simpleicons.org/${t(z)}`:null));function O(){A(b,!0)}function Q(){A(V,!0)}var q={get iconName(){return r()},set iconName(e){r(e),u()},get label(){return n()},set label(e){n(e),u()},get size(){return o()},set size(e=20){o(e),u()},get class(){return d()},set class(e=""){d(e),u()},$set:t3,$on:(e,a)=>s3(i,e,a)},c=_3(),G=o3(c);{var J=e=>{var a=h3();m3(a,()=>t(H),!0),I(a),m(()=>_(a,1,`w-full h-full flex items-center justify-center [&>svg]:w-full [&>svg]:h-full ${t(M)?"dark:invert":""}`)),f(e,a)},K=e=>{var a=w3(),s=i3(a);let g;var X=n3(s,2);{var Y=w=>{var C=b3(),$=Z(C,!0);m(e3=>{x(C,`font-size: ${o()*.45}px;`),N($,e3)},[()=>n().charAt(0)]),f(w,C)};B(X,w=>{t(b)||w(Y)})}m(()=>{F(s,"src",t(k)),F(s,"alt",n()),g=_(s,1,`w-full h-full object-contain ${t(M)?"dark:invert":""}`,null,g,{"opacity-0":!t(b)})}),S("load",s,O),S("error",s,Q),c3(s),f(e,a)},P=e=>{{let a=l(()=>o()*.7);f3(e,{get icon(){return t(W)},class:"text-ghost",get style(){return`font-size: ${t(a)??""}px;`}})}},R=l(()=>h[r().toLowerCase()]),T=e=>{var a=C3(),s=Z(a,!0);m(g=>{x(a,`font-size: ${o()*.45}px;`),N(s,g)},[()=>n().charAt(0)]),f(e,a)};B(G,e=>{t(H)?e(J):t(k)&&!t(V)?e(K,1):t(R)?e(P,2):e(T,-1)})}return I(c),m(()=>{_(c,1,`flex items-center justify-center shrink-0 ${d()??""}`),x(c,`width: ${o()??""}px; height: ${o()??""}px;`)}),f(y,c),l3(q)}export{x3 as M};
@@ -1,2 +1,2 @@
1
- import{t as ht,bo as _,bm as g,bw as bt,b as xt}from"./BkP7iWmk.js";import{bs as yt,a7 as kt,ay as Q,W as p,bn as wt,aA as h,a5 as M,bS as u,bl as S,bA as W,aD as e,b_ as D,bO as x,aB as k,bH as et,c9 as y,bV as at,be as At,b$ as It}from"./DYhIMPy1.js";import{i as f}from"./Cmsd5u03.js";import{I as Bt,g as Ct}from"./eF4sVb1p.js";import{I as Pt,D as zt}from"./EFalm4kN.js";import{f as O}from"./BTU_oKHo.js";import"./CkxlqZls.js";import"./DdeuoyZB.js";import"./C400w5jq.js";import{F as rt,ca as Rt,cm as St,ar as Wt}from"./Duz2cV7w.js";import{e as Dt}from"./AZ8Xy_Xh.js";import{D as Lt}from"./DzPu3hXf.js";import{II as $t,ut as Ht}from"./fvC-6LgA.js";import{g as Nt}from"./Dy7XitXS.js";var Ft=k('<span class="type-caption shrink-0 font-medium text-success"> </span>'),Mt=k('<!> <span class="type-body flex-1 truncate text-left font-medium text-foreground"> </span> <span class="type-caption shrink-0 tabular-nums"><span class="text-success"> </span> <span class="ml-1 text-danger"> </span></span> <!>',1),Ot=k("<!> ",1),Vt=k('<div class="mb-2 flex gap-1"></div>'),jt=k('<div class="border-t border-border p-2"><!> <!></div>'),qt=k('<div class="ws-block-widget type-body my-2 overflow-hidden rounded-md border border-border bg-card text-foreground shadow-(--elevation-raised)"><div class="flex min-h-9 items-center gap-2 px-3 py-1.5"><!> <!> <!></div> <!></div>'),Et=k('<div class="ws-block-widget type-caption my-2 text-muted-foreground"> </div>');function Tt(U,n){if(new.target)return ht({component:Tt,...U});yt(n,!0);let w=_(n,"patches",7),V=_(n,"label",23,()=>g.ui_patchBlock_label()),j=_(n,"lastApply",7),A=_(n,"linkedAgentId",7),L=_(n,"workspaceId",7),P=_(n,"applying",7,!1),$=_(n,"onApply",7),H=_(n,"onRevert",7),q=at(!1),E=at(0),z=y(()=>w()?.[e(E)]),T=y(()=>j()?.status==="success");function st(t){const o=t.split(`
1
+ import{t as ht,bo as _,bm as g,bw as bt,b as xt}from"./BkP7iWmk.js";import{bs as yt,a7 as kt,ay as Q,W as p,bn as wt,aA as h,a5 as M,bS as u,bl as S,bA as W,aD as e,b_ as D,bO as x,aB as k,bH as et,c9 as y,bV as at,be as At,b$ as It}from"./DYhIMPy1.js";import{i as f}from"./Cmsd5u03.js";import{I as Bt,g as Ct}from"./eF4sVb1p.js";import{I as Pt,D as zt}from"./EFalm4kN.js";import{f as O}from"./DlQfuVhT.js";import"./DPKwA49z.js";import"./DdeuoyZB.js";import"./C400w5jq.js";import{F as rt,ca as Rt,cm as St,ar as Wt}from"./Duz2cV7w.js";import{e as Dt}from"./CEGk06kt.js";import{D as Lt}from"./D11PDukO.js";import{II as $t,ut as Ht}from"./D98guX46.js";import{g as Nt}from"./QoEJNfmE.js";var Ft=k('<span class="type-caption shrink-0 font-medium text-success"> </span>'),Mt=k('<!> <span class="type-body flex-1 truncate text-left font-medium text-foreground"> </span> <span class="type-caption shrink-0 tabular-nums"><span class="text-success"> </span> <span class="ml-1 text-danger"> </span></span> <!>',1),Ot=k("<!> ",1),Vt=k('<div class="mb-2 flex gap-1"></div>'),jt=k('<div class="border-t border-border p-2"><!> <!></div>'),qt=k('<div class="ws-block-widget type-body my-2 overflow-hidden rounded-md border border-border bg-card text-foreground shadow-(--elevation-raised)"><div class="flex min-h-9 items-center gap-2 px-3 py-1.5"><!> <!> <!></div> <!></div>'),Et=k('<div class="ws-block-widget type-caption my-2 text-muted-foreground"> </div>');function Tt(U,n){if(new.target)return ht({component:Tt,...U});yt(n,!0);let w=_(n,"patches",7),V=_(n,"label",23,()=>g.ui_patchBlock_label()),j=_(n,"lastApply",7),A=_(n,"linkedAgentId",7),L=_(n,"workspaceId",7),P=_(n,"applying",7,!1),$=_(n,"onApply",7),H=_(n,"onRevert",7),q=at(!1),E=at(0),z=y(()=>w()?.[e(E)]),T=y(()=>j()?.status==="success");function st(t){const o=t.split(`
2
2
  `);let v=0,b=0;for(const I of o)I.startsWith("+")&&!I.startsWith("+++")?v++:I.startsWith("-")&&!I.startsWith("---")&&b++;return{addCount:v,removeCount:b}}let X=y(()=>e(z)?st(e(z).diff):{addCount:0,removeCount:0}),G=y(()=>P()?{label:g.ui_patchBlock_applying_label(),icon:null}:e(T)?{label:g.ui_patchBlock_revert_label(),icon:St}:{label:g.ui_patchBlock_apply_label(),icon:Wt}),nt=y(()=>!!($()||H()));function ot(){et(q,!e(q))}function it(){e(T)?H()?.():$()?.()}var lt={get patches(){return w()},set patches(t){w(t),h()},get label(){return V()},set label(t=g.ui_patchBlock_label()){V(t),h()},get lastApply(){return j()},set lastApply(t){j(t),h()},get linkedAgentId(){return A()},set linkedAgentId(t){A(t),h()},get workspaceId(){return L()},set workspaceId(t){L(t),h()},get applying(){return P()},set applying(t=!1){P(t),h()},get onApply(){return $()},set onApply(t){$(t),h()},get onRevert(){return H()},set onRevert(t){H(t),h()},$set:bt,$on:(t,o)=>xt(n,t,o)},Y=kt(),ct=Q(Y);{var dt=t=>{var o=qt(),v=M(o),b=M(v);{var I=a=>{{let c=y(()=>g.ui_patchBlock_viewAgent_tooltip());O(a,{variant:"plain",size:"icon-compact",iconOnly:!0,class:"size-4! shrink-0 rounded-sm! transition-opacity hover:opacity-80",onclick:i=>{L()&&$t.dispatch(Ht(L(),{agentId:A(),...Nt(i)}))},get title(){return e(c)},children:(i,m)=>{Dt(i,{get agentId(){return A()},variant:"compact"})},$$slots:{default:!0}})}};f(b,a=>{A()&&a(I)})}var Z=u(b,2);O(Z,{variant:"plain",size:"compact",class:"h-auto! min-w-0 flex-1 shrink items-center justify-start gap-2 px-0! py-0! text-muted-foreground transition-colors hover:text-foreground",truncateLabel:!1,labelClass:"flex min-w-0 flex-1 items-center gap-2",onclick:ot,children:(a,c)=>{var i=Mt(),m=Q(i);{var B=l=>{rt(l,{get icon(){return Rt},size:10,class:"text-muted-foreground"})};f(m,l=>{A()||l(B)})}var C=u(m,2),s=S(C,!0),d=u(C,2),r=M(d),R=S(r),N=u(r,2),J=S(N);W(d);var K=u(d,2);{var tt=l=>{var F=Ft(),_t=S(F,!0);D(gt=>x(_t,gt),[()=>g.ui_patchBlock_applied_label()]),p(l,F)};f(K,l=>{e(T)&&l(tt)})}D(()=>{x(s,V()),x(R,`+${e(X).addCount??""}`),x(J,`-${e(X).removeCount??""}`)}),p(a,i)},$$slots:{default:!0}});var ut=u(Z,2);{var ft=a=>{O(a,{variant:"ghost-light",size:"sm",class:"type-caption shrink-0",onclick:it,get disabled(){return P()},children:(c,i)=>{var m=Ot(),B=Q(m);{var C=r=>{Bt(r,{size:12})},s=r=>{rt(r,{get icon(){return e(G).icon},size:"xs"})};f(B,r=>{P()?r(C):e(G).icon&&r(s,1)})}var d=u(B);D(()=>x(d,` ${e(G).label??""}`)),p(c,m)},$$slots:{default:!0}})};f(ut,a=>{e(nt)&&a(ft)})}W(v);var vt=u(v,2);{var mt=a=>{var c=jt(),i=M(c);{var m=s=>{var d=Vt();Ct(d,23,w,(r,R)=>`patch-${R}-${r.filePath}`,(r,R,N)=>{{let J=y(()=>e(N)===e(E)?"default":"ghost-light");O(r,{get variant(){return e(J)},size:"sm",class:"type-caption",onclick:()=>et(E,e(N),!0),children:(K,tt)=>{At();var l=It();D(F=>x(l,F),[()=>e(R).filePath.split("/").pop()]),p(K,l)},$$slots:{default:!0}})}}),W(d),p(s,d)};f(i,s=>{w().length>1&&s(m)})}var B=u(i,2);{var C=s=>{Lt(s,{get patch(){return e(z).diff},get fileName(){return e(z).filePath},showHeader:!0,showStats:!0,showLineNumbers:!0,maxHeight:"300px",collapsible:!1,class:"overflow-hidden rounded-sm border border-border"})};f(B,s=>{e(z)&&s(C)})}W(c),Pt(3,c,()=>zt,()=>({tier:"moderate"})),p(a,c)};f(vt,a=>{e(q)&&a(mt)})}W(o),p(t,o)},pt=t=>{var o=Et(),v=S(o,!0);D(b=>x(v,b),[()=>g.ui_patchBlock_invalid_error()]),p(t,o)};f(ct,t=>{w()?.length?t(dt):t(pt,-1)})}return p(U,Y),wt(lt)}export{Tt as P};