@intent-hq/web 2.381.2 → 2.383.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 (334) hide show
  1. package/package.json +1 -1
  2. package/web/app/immutable/assets/0.BmwjvpSF.css +1 -0
  3. package/web/app/immutable/chunks/{BeKKPzED.js → -K3ARgq0.js} +1 -1
  4. package/web/app/immutable/chunks/{DlZ4XLhX.js → 0HRWclfL.js} +1 -1
  5. package/web/app/immutable/chunks/{B1TqZZyd.js → 1WR8MecL.js} +3 -3
  6. package/web/app/immutable/chunks/{BROVaoRF.js → 1mf839wD.js} +1 -1
  7. package/web/app/immutable/chunks/{zFOAQ-fV.js → 3xK9OOJy.js} +1 -1
  8. package/web/app/immutable/chunks/{e9FnhdhA.js → 4BrIaRe_.js} +1 -1
  9. package/web/app/immutable/chunks/{C9RagC2N.js → 518Fef2L.js} +1 -1
  10. package/web/app/immutable/chunks/{zOXOu59X.js → 6-uYidyP.js} +3 -3
  11. package/web/app/immutable/chunks/{E-ElQTlm.js → 68Tuqjp3.js} +1 -1
  12. package/web/app/immutable/chunks/{CuMJ0LCw.js → 6Bqipt1r.js} +1 -1
  13. package/web/app/immutable/chunks/{CyczJyMt.js → 7UPrdiE9.js} +1 -1
  14. package/web/app/immutable/chunks/{Cywj8P1v.js → 8r75D0ru.js} +1 -1
  15. package/web/app/immutable/chunks/{gtC5KXEz.js → 9bukzQMK.js} +1 -1
  16. package/web/app/immutable/chunks/{H_09C3Qv.js → 9gSjzhYc.js} +1 -1
  17. package/web/app/immutable/chunks/A9niI_uA.js +1 -0
  18. package/web/app/immutable/chunks/{CEUJ2SOA.js → AlEhxd2n.js} +1 -1
  19. package/web/app/immutable/chunks/{B4Uud3OJ.js → B-ef1MlI.js} +1 -1
  20. package/web/app/immutable/chunks/{DN6qgMae.js → B2Ym4lhl.js} +1 -1
  21. package/web/app/immutable/chunks/{CDnYwtBR.js → B2f9w8eB.js} +1 -1
  22. package/web/app/immutable/chunks/{DVHfIJ_U.js → B2kb4xeF.js} +1 -1
  23. package/web/app/immutable/chunks/{CkEbA_As.js → B2nCyo89.js} +1 -1
  24. package/web/app/immutable/chunks/{D2MSvsFH.js → B3Bfek34.js} +1 -1
  25. package/web/app/immutable/chunks/{BmQQcH5z.js → B4SiDSWP.js} +1 -1
  26. package/web/app/immutable/chunks/{Dq39ODex.js → B4WuQori.js} +1 -1
  27. package/web/app/immutable/chunks/{B4K17hnI.js → B4xSB_Hx.js} +1 -1
  28. package/web/app/immutable/chunks/{DRdEaij1.js → B5M0SkuR.js} +1 -1
  29. package/web/app/immutable/chunks/{BZKoidWB.js → B6S6VNu7.js} +1 -1
  30. package/web/app/immutable/chunks/{Bg4SPgrZ.js → B6STvYyK.js} +1 -1
  31. package/web/app/immutable/chunks/{qE-X6VV1.js → B8-Q1tED.js} +1 -1
  32. package/web/app/immutable/chunks/{BIIYZtt3.js → B9oKJyXc.js} +1 -1
  33. package/web/app/immutable/chunks/{C-931TJ0.js → BA-rwlhs.js} +1 -1
  34. package/web/app/immutable/chunks/{BX63FB9x.js → BAKPnd3w.js} +1 -1
  35. package/web/app/immutable/chunks/{Bt_5d6KS.js → BAOaoX22.js} +1 -1
  36. package/web/app/immutable/chunks/{D5Rd8qkd.js → BE6Cp7Qp.js} +1 -1
  37. package/web/app/immutable/chunks/{Ue-wYmxq.js → BETzmOvF.js} +1 -1
  38. package/web/app/immutable/chunks/{Bmt71DMB.js → BFEzojY2.js} +1 -1
  39. package/web/app/immutable/chunks/{9mNi8996.js → BFIcslMA.js} +2 -2
  40. package/web/app/immutable/chunks/{CKFaA258.js → BFeEPayU.js} +1 -1
  41. package/web/app/immutable/chunks/{BOzF_1jP.js → BG9tvqwj.js} +1 -1
  42. package/web/app/immutable/chunks/{CVuT-llE.js → BGTRTFMR.js} +1 -1
  43. package/web/app/immutable/chunks/BIVeXMBl.js +1 -0
  44. package/web/app/immutable/chunks/{DMhc83bo.js → BJWt3PU_.js} +1 -1
  45. package/web/app/immutable/chunks/{CL_Wu5hL.js → BJ_CKcUH.js} +1 -1
  46. package/web/app/immutable/chunks/{bT3v1QYj.js → BO_DS0RP.js} +1 -1
  47. package/web/app/immutable/chunks/{B3TTR8D_.js → BP3Sccje.js} +1 -1
  48. package/web/app/immutable/chunks/{DAY78LgA.js → BP4Hm_tD.js} +2 -2
  49. package/web/app/immutable/chunks/{xlIh55VB.js → BP5uGGO_.js} +1 -1
  50. package/web/app/immutable/chunks/{BavAnT42.js → BPL5Fo2b.js} +1 -1
  51. package/web/app/immutable/chunks/{DnbNqDYS.js → BSKFIBj2.js} +1 -1
  52. package/web/app/immutable/chunks/{BJGbabcl.js → BSKf8bnG.js} +1 -1
  53. package/web/app/immutable/chunks/{CkyY-zEo.js → BTrqJIJZ.js} +1 -1
  54. package/web/app/immutable/chunks/{DPCjIvYy.js → BUGeL7WE.js} +1 -1
  55. package/web/app/immutable/chunks/{vnEDE6VU.js → BUQUek8g.js} +1 -1
  56. package/web/app/immutable/chunks/{CoHtEoLb.js → BURZJh0r.js} +1 -1
  57. package/web/app/immutable/chunks/{CgbisBm3.js → BWGnuS1v.js} +1 -1
  58. package/web/app/immutable/chunks/{Besc4d7d.js → BWYuMy_r.js} +1 -1
  59. package/web/app/immutable/chunks/{dzRbajCR.js → BX-0SVP7.js} +1 -1
  60. package/web/app/immutable/chunks/{DZTelE6-.js → BX-LCSle.js} +1 -1
  61. package/web/app/immutable/chunks/{Bkn9MGZb.js → BYq9VtBF.js} +1 -1
  62. package/web/app/immutable/chunks/{7Co-pRoL.js → B_LcgbLl.js} +1 -1
  63. package/web/app/immutable/chunks/{B-wL6Wzy.js → Ba8ctcpl.js} +1 -1
  64. package/web/app/immutable/chunks/{DQdDAxOz.js → BaujsV9k.js} +1 -1
  65. package/web/app/immutable/chunks/{s7AiPAor.js → BcpfdNy8.js} +1 -1
  66. package/web/app/immutable/chunks/{BQyGe_6f.js → BeNn_MBw.js} +1 -1
  67. package/web/app/immutable/chunks/{BB82Eb4D.js → BeOwB_6G.js} +1 -1
  68. package/web/app/immutable/chunks/{DDHXn0gy.js → BfojStRz.js} +1 -1
  69. package/web/app/immutable/chunks/{DtV42LL1.js → BfvZe-kN.js} +6 -6
  70. package/web/app/immutable/chunks/{jExJ4qw0.js → Bir0Y4gf.js} +2 -2
  71. package/web/app/immutable/chunks/{pGhuLhmB.js → BlDljC9y.js} +1 -1
  72. package/web/app/immutable/chunks/{Ah-onPNG.js → BmTMWrby.js} +1 -1
  73. package/web/app/immutable/chunks/{CLbTxOfk.js → BmUPAQa9.js} +1 -1
  74. package/web/app/immutable/chunks/{BCl5zPXa.js → Bn880vDO.js} +1 -1
  75. package/web/app/immutable/chunks/{De9e0mT0.js → Bs2WE18g.js} +1 -1
  76. package/web/app/immutable/chunks/{D5zGpim8.js → Bs9K_x5H.js} +1 -1
  77. package/web/app/immutable/chunks/{oLeo92vY.js → BsN2abqQ.js} +1 -1
  78. package/web/app/immutable/chunks/{HWtwQJMe.js → Bsh6nUhU.js} +1 -1
  79. package/web/app/immutable/chunks/{CTzwWQun.js → BsrrIQeo.js} +1 -1
  80. package/web/app/immutable/chunks/{CE-ONoWm.js → BtTA7CNV.js} +1 -1
  81. package/web/app/immutable/chunks/{BWLItowS.js → Bty1UglO.js} +1 -1
  82. package/web/app/immutable/chunks/{BORX4QsI.js → Bu7LYnzn.js} +1 -1
  83. package/web/app/immutable/chunks/{DwzqUxIw.js → Bvi-fRGz.js} +1 -1
  84. package/web/app/immutable/chunks/{Dpd18D9E.js → BwG2vfja.js} +1 -1
  85. package/web/app/immutable/chunks/{DLs0Gu12.js → BxEf7uwl.js} +1 -1
  86. package/web/app/immutable/chunks/{D1BWZmii.js → BxJ6X-Sl.js} +1 -1
  87. package/web/app/immutable/chunks/{BzWnUeNO.js → BypvqIQM.js} +1 -1
  88. package/web/app/immutable/chunks/{BEGsYnq4.js → Bz7R1ahj.js} +4 -4
  89. package/web/app/immutable/chunks/{D2KaVfIR.js → C0I_aIej.js} +2 -2
  90. package/web/app/immutable/chunks/C0QTy0Sy.js +1 -0
  91. package/web/app/immutable/chunks/{Bz7B58eG.js → C1EvfTg-.js} +1 -1
  92. package/web/app/immutable/chunks/{CtJr8Pwg.js → C45U06qp.js} +1 -1
  93. package/web/app/immutable/chunks/{DVkTXE2a.js → C4JXGtw1.js} +1 -1
  94. package/web/app/immutable/chunks/{C1hbmGxM.js → C4JbSg3f.js} +1 -1
  95. package/web/app/immutable/chunks/{Fh9R4BHC.js → C4QKwtCH.js} +1 -1
  96. package/web/app/immutable/chunks/{BgdV71H8.js → C5yhcKTW.js} +1 -1
  97. package/web/app/immutable/chunks/{CsY5Dftt.js → C6mS8uZB.js} +1 -1
  98. package/web/app/immutable/chunks/{B3Muoj7H.js → C7LIHk5_.js} +1 -1
  99. package/web/app/immutable/chunks/{Cr-iZ9Tf.js → C8HkqBCb.js} +1 -1
  100. package/web/app/immutable/chunks/{Da_Z6CgM.js → C8y9EItt.js} +1 -1
  101. package/web/app/immutable/chunks/{B6jOBMKj.js → CAgnBDaV.js} +3 -3
  102. package/web/app/immutable/chunks/{BE66F_G_.js → CAvYeStH.js} +1 -1
  103. package/web/app/immutable/chunks/{Dy2ZTySC.js → CCqqosml.js} +1 -1
  104. package/web/app/immutable/chunks/{KWmquGlL.js → CDK_hSiv.js} +1 -1
  105. package/web/app/immutable/chunks/{CXCeVP0_.js → CDjpuJh0.js} +1 -1
  106. package/web/app/immutable/chunks/{3Tv2tBbo.js → CE7VCun2.js} +3 -3
  107. package/web/app/immutable/chunks/{Yy6hnibL.js → CE7dsja4.js} +1 -1
  108. package/web/app/immutable/chunks/{CPvBbiM1.js → CEgeN2ws.js} +1 -1
  109. package/web/app/immutable/chunks/{RNoFqjp6.js → CFny5dMa.js} +1 -1
  110. package/web/app/immutable/chunks/{DaYz5Oxb.js → CFvBUo4R.js} +3 -3
  111. package/web/app/immutable/chunks/{C9K8tC7J.js → CHLX1QZz.js} +1 -1
  112. package/web/app/immutable/chunks/{Bwqr9iPo.js → CJ4Z96pe.js} +1 -1
  113. package/web/app/immutable/chunks/{CngHTAnD.js → CMrw-y4l.js} +13 -13
  114. package/web/app/immutable/chunks/{B828qkf6.js → CMu-09q3.js} +1 -1
  115. package/web/app/immutable/chunks/{CYDXSK8a.js → CNAgTnv2.js} +1 -1
  116. package/web/app/immutable/chunks/{I_40sZHA.js → CO5zWp8I.js} +1 -1
  117. package/web/app/immutable/chunks/{b16NDDfn.js → COhRCR9P.js} +2 -2
  118. package/web/app/immutable/chunks/CPQ-kfy2.js +1 -0
  119. package/web/app/immutable/chunks/{lEWu7gpF.js → CPTZJWC9.js} +1 -1
  120. package/web/app/immutable/chunks/{BQzm8t-k.js → CRZZ_hOy.js} +1 -1
  121. package/web/app/immutable/chunks/{Cy0xJYMG.js → CRs9zG2A.js} +1 -1
  122. package/web/app/immutable/chunks/{BFjAz9so.js → CSRYV6LQ.js} +1 -1
  123. package/web/app/immutable/chunks/{C7vw9rpc.js → CSVgdt55.js} +1 -1
  124. package/web/app/immutable/chunks/{F6tZeezN.js → CU5jKGma.js} +1 -1
  125. package/web/app/immutable/chunks/{BIGXb0qV.js → CUkDMZwP.js} +1 -1
  126. package/web/app/immutable/chunks/{B_L3BWUb.js → CXS2Ba3S.js} +1 -1
  127. package/web/app/immutable/chunks/{wQP9H0b5.js → CY4fyoCV.js} +1 -1
  128. package/web/app/immutable/chunks/{B_9Y0vrL.js → CYtPXqgK.js} +1 -1
  129. package/web/app/immutable/chunks/C_1hI7HP.js +1 -0
  130. package/web/app/immutable/chunks/{CN0TD23u.js → C_78iNNC.js} +1 -1
  131. package/web/app/immutable/chunks/{B2JbncL-.js → C_KuQ05a.js} +1 -1
  132. package/web/app/immutable/chunks/{C4Fxj3Dv.js → CbqxWBi7.js} +1 -1
  133. package/web/app/immutable/chunks/{C9qmiGPA.js → Cf4fmkfL.js} +1 -1
  134. package/web/app/immutable/chunks/{Cy1eIaf4.js → ChTVnFH2.js} +1 -1
  135. package/web/app/immutable/chunks/{P-6iyz0U.js → CiMmbOsB.js} +1 -1
  136. package/web/app/immutable/chunks/{CHDBPeiu.js → CjTo2K46.js} +1 -1
  137. package/web/app/immutable/chunks/{76a0x163.js → CkA2ItLw.js} +1 -1
  138. package/web/app/immutable/chunks/{oxrHj9WB.js → Cmq0pZIQ.js} +2 -2
  139. package/web/app/immutable/chunks/{hOsZO8to.js → CmrjfWYI.js} +1 -1
  140. package/web/app/immutable/chunks/{CvmogvXF.js → Co4vj0dC.js} +1 -1
  141. package/web/app/immutable/chunks/{BzpQRjDP.js → Cqa6LF3b.js} +1 -1
  142. package/web/app/immutable/chunks/CqcqWJoa.js +1 -0
  143. package/web/app/immutable/chunks/CrD0jtXE.js +1 -0
  144. package/web/app/immutable/chunks/{CHiOQIO1.js → CrkMZYjb.js} +1 -1
  145. package/web/app/immutable/chunks/{CVQJ3G9r.js → Cs2lHsyA.js} +1 -1
  146. package/web/app/immutable/chunks/{B_TGsMEB.js → Csc9ETIC.js} +1 -1
  147. package/web/app/immutable/chunks/{nMcdiCb6.js → CtNkh9GR.js} +1 -1
  148. package/web/app/immutable/chunks/{Cgjp6r06.js → Ct_q9q1G.js} +1 -1
  149. package/web/app/immutable/chunks/{DLncssSx.js → Ctbo6mXV.js} +1 -1
  150. package/web/app/immutable/chunks/{8OEJW7fY.js → CuW3cq2w.js} +1 -1
  151. package/web/app/immutable/chunks/{wJF9cAcZ.js → CuewocoW.js} +1 -1
  152. package/web/app/immutable/chunks/{D_2nAvGE.js → CxOmNieJ.js} +1 -1
  153. package/web/app/immutable/chunks/D-zjf2Af.js +1 -0
  154. package/web/app/immutable/chunks/{DhkuGmLb.js → D37getya.js} +1 -1
  155. package/web/app/immutable/chunks/{BtCfKiJI.js → D3O8Vtuw.js} +1 -1
  156. package/web/app/immutable/chunks/{BgfkQ05m.js → D3p_bZm7.js} +1 -1
  157. package/web/app/immutable/chunks/{B6v6locT.js → D51XIZYq.js} +1 -1
  158. package/web/app/immutable/chunks/{BGr1zUsV.js → D5tDp1i8.js} +1 -1
  159. package/web/app/immutable/chunks/{SCoe-XeJ.js → D5xMHmv3.js} +1 -1
  160. package/web/app/immutable/chunks/{DT_2ysGq.js → D6dlPeEM.js} +1 -1
  161. package/web/app/immutable/chunks/{CMzQ5CXp.js → D73nBZuu.js} +1 -1
  162. package/web/app/immutable/chunks/{Do7ouyXz.js → D8ohaX19.js} +1 -1
  163. package/web/app/immutable/chunks/{dnTowHeA.js → D9XKwVJX.js} +3 -3
  164. package/web/app/immutable/chunks/{B4GJOofT.js → DA5opfEp.js} +1 -1
  165. package/web/app/immutable/chunks/{BOSZ-Hrc.js → DB7RVYiL.js} +1 -1
  166. package/web/app/immutable/chunks/{CfRm3l5p.js → DC8keNAk.js} +1 -1
  167. package/web/app/immutable/chunks/{C8SLclsn.js → DCK8dPAL.js} +1 -1
  168. package/web/app/immutable/chunks/{Bl3Cuor0.js → DCRuihKm.js} +2 -2
  169. package/web/app/immutable/chunks/{CxSmnqpJ.js → DE7dSDHO.js} +1 -1
  170. package/web/app/immutable/chunks/{D2ZHHwj-.js → DEVX5wOm.js} +2 -2
  171. package/web/app/immutable/chunks/{ByhEuqgY.js → DF2_1gr9.js} +1 -1
  172. package/web/app/immutable/chunks/{zdyRQTcF.js → DFcppVBl.js} +1 -1
  173. package/web/app/immutable/chunks/{EW9Oxsda.js → DGa13zF2.js} +1 -1
  174. package/web/app/immutable/chunks/{CfHaUU8C.js → DIFhl0he.js} +1 -1
  175. package/web/app/immutable/chunks/{6eBy--fo.js → DIG1mTAN.js} +2 -2
  176. package/web/app/immutable/chunks/{mg5SY1J3.js → DIKTPgAK.js} +1 -1
  177. package/web/app/immutable/chunks/{BiKalUOw.js → DK-ttWlY.js} +1 -1
  178. package/web/app/immutable/chunks/{CnT7X_Ka.js → DKHY8q_S.js} +1 -1
  179. package/web/app/immutable/chunks/{DJS9lO4g.js → DLbcryNV.js} +1 -1
  180. package/web/app/immutable/chunks/{C4_TlGj0.js → DLwWVKiF.js} +1 -1
  181. package/web/app/immutable/chunks/{Bw803iNn.js → DMDFfHqn.js} +3 -3
  182. package/web/app/immutable/chunks/{3BCA27_7.js → DMQmPhTl.js} +1 -1
  183. package/web/app/immutable/chunks/{CmLRC7-r.js → DN6OUhsP.js} +1 -1
  184. package/web/app/immutable/chunks/{BUfNfMkk.js → DO19lrhU.js} +1 -1
  185. package/web/app/immutable/chunks/{CHyLxrMv.js → DOEI9gYY.js} +1 -1
  186. package/web/app/immutable/chunks/{CJotcdQg.js → DPA45OJk.js} +1 -1
  187. package/web/app/immutable/chunks/{tFT894m3.js → DPYlDye0.js} +1 -1
  188. package/web/app/immutable/chunks/{BLCYnNxp.js → DQ_mNIfK.js} +1 -1
  189. package/web/app/immutable/chunks/{CZpxXUzD.js → DR4Kh2SL.js} +1 -1
  190. package/web/app/immutable/chunks/{CpCzAUi8.js → DSbNJBwA.js} +1 -1
  191. package/web/app/immutable/chunks/{CrtOf2Rt.js → DTuql3Rj.js} +1 -1
  192. package/web/app/immutable/chunks/{Ckr4n1ss.js → DUIwUF5m.js} +1 -1
  193. package/web/app/immutable/chunks/{CpxnRRai.js → DVROSXw1.js} +1 -1
  194. package/web/app/immutable/chunks/{Dk_2gwLu.js → DWWC1JsA.js} +1 -1
  195. package/web/app/immutable/chunks/{BG_RlrpY.js → DWiU4388.js} +1 -1
  196. package/web/app/immutable/chunks/{CplGIhI5.js → DX-Wrapd.js} +1 -1
  197. package/web/app/immutable/chunks/{C1Zw9RUp.js → DXBEIeJu.js} +1 -1
  198. package/web/app/immutable/chunks/{BKMwkk7g.js → DY0qeQe8.js} +1 -1
  199. package/web/app/immutable/chunks/{CaBTNP9L.js → D_Xpj-6r.js} +1 -1
  200. package/web/app/immutable/chunks/{o9vqVVAE.js → D_ovLyyd.js} +1 -1
  201. package/web/app/immutable/chunks/{CbUxbw3N.js → Db3Wob9h.js} +1 -1
  202. package/web/app/immutable/chunks/{BD4C_b2Z.js → DdXBqrnq.js} +1 -1
  203. package/web/app/immutable/chunks/{C__OzIly.js → DeHvIzqj.js} +2 -2
  204. package/web/app/immutable/chunks/{aDC6CW-9.js → Dfg3lB2h.js} +1 -1
  205. package/web/app/immutable/chunks/{DqfOHbUh.js → Djp7mdlG.js} +1 -1
  206. package/web/app/immutable/chunks/{DgQzilAi.js → DjxLojU4.js} +1 -1
  207. package/web/app/immutable/chunks/{3ozr1vad.js → DlJZrxef.js} +2 -2
  208. package/web/app/immutable/chunks/{IPb2sVOc.js → DliHiH6M.js} +4 -4
  209. package/web/app/immutable/chunks/{BZRdDiLW.js → Dlk4BhFg.js} +1 -1
  210. package/web/app/immutable/chunks/{DCfPUdw9.js → DlliJA4a.js} +3 -3
  211. package/web/app/immutable/chunks/{D6uQnPIb.js → DnJ4jlPB.js} +1 -1
  212. package/web/app/immutable/chunks/{gWn9PDXZ.js → DpHn84BV.js} +1 -1
  213. package/web/app/immutable/chunks/{Cg1tTx8i.js → DpMOdl0E.js} +1 -1
  214. package/web/app/immutable/chunks/{Bz8C2v0s.js → DpyfxjgC.js} +1 -1
  215. package/web/app/immutable/chunks/{ko5zX9YA.js → Dqdvt4Zr.js} +1 -1
  216. package/web/app/immutable/chunks/{CKt7lvPP.js → DrIA1Azf.js} +1 -1
  217. package/web/app/immutable/chunks/{BX43DT22.js → DrxfcnSy.js} +1 -1
  218. package/web/app/immutable/chunks/{CE095mBY.js → DsGUBv3k.js} +1 -1
  219. package/web/app/immutable/chunks/{DtqWU30y.js → Dsr4GELp.js} +1 -1
  220. package/web/app/immutable/chunks/DtF9DVpp.js +1 -0
  221. package/web/app/immutable/chunks/{BkliVAqJ.js → DvSURWC2.js} +4 -4
  222. package/web/app/immutable/chunks/{Gi8kzv-V.js → DvUGkiYP.js} +1 -1
  223. package/web/app/immutable/chunks/{CLiKsUcS.js → DvYUfzNR.js} +1 -1
  224. package/web/app/immutable/chunks/{BIon5kwa.js → Dw8wIAFi.js} +1 -1
  225. package/web/app/immutable/chunks/{D4XZeMXl.js → DwL1A1su.js} +1 -1
  226. package/web/app/immutable/chunks/{B-4Cm2na.js → DzWZGIya.js} +1 -1
  227. package/web/app/immutable/chunks/{D81Tox6K.js → EK6zOAHM.js} +1 -1
  228. package/web/app/immutable/chunks/{CESUeVmp.js → FzlZUztb.js} +1 -1
  229. package/web/app/immutable/chunks/{rdao0YQj.js → IQ13JH5A.js} +1 -1
  230. package/web/app/immutable/chunks/{DgW5R9bn.js → J8_M56d9.js} +1 -1
  231. package/web/app/immutable/chunks/{y7Ugu8WS.js → KHteWVFN.js} +1 -1
  232. package/web/app/immutable/chunks/{CxRJqvXa.js → KYuLFpkq.js} +1 -1
  233. package/web/app/immutable/chunks/{5DxHNwZe.js → L4HdMFBq.js} +1 -1
  234. package/web/app/immutable/chunks/{c5MBfH9F.js → L7j-Q29w.js} +1 -1
  235. package/web/app/immutable/chunks/{DvQWx7ZN.js → L_tYoUCb.js} +1 -1
  236. package/web/app/immutable/chunks/{BFqSYY_K.js → M5Dwuu-X.js} +1 -1
  237. package/web/app/immutable/chunks/{BNrkXLIB.js → No1eCFy3.js} +1 -1
  238. package/web/app/immutable/chunks/{DEelt7b0.js → OFhgRaUm.js} +1 -1
  239. package/web/app/immutable/chunks/{Q7XiOE5T.js → OtomGvb3.js} +1 -1
  240. package/web/app/immutable/chunks/{DIQ23RZn.js → PIgqsYsQ.js} +1 -1
  241. package/web/app/immutable/chunks/{CV9F7g3O.js → PO_5m99x.js} +1 -1
  242. package/web/app/immutable/chunks/{BCx2RJGr.js → QeBH-DWE.js} +1 -1
  243. package/web/app/immutable/chunks/{D7kKwL53.js → RFsxwSsB.js} +1 -1
  244. package/web/app/immutable/chunks/{Be5foFms.js → S845NCb3.js} +1 -1
  245. package/web/app/immutable/chunks/{BzJwOhb5.js → S8ugWfAx.js} +1 -1
  246. package/web/app/immutable/chunks/{DQEQvBuM.js → U9jJmfYa.js} +1 -1
  247. package/web/app/immutable/chunks/{CfC-LCr9.js → U_OQY9n3.js} +1 -1
  248. package/web/app/immutable/chunks/{BR1_dE35.js → UhL0ohiG.js} +1 -1
  249. package/web/app/immutable/chunks/{DkPs4gWX.js → W2WLehNu.js} +1 -1
  250. package/web/app/immutable/chunks/{DYTNWFlt.js → XCWZeNYo.js} +1 -1
  251. package/web/app/immutable/chunks/{xAGiw113.js → Y5Ky10uA.js} +1 -1
  252. package/web/app/immutable/chunks/{Do1K3fjZ.js → _SYFiE9N.js} +1 -1
  253. package/web/app/immutable/chunks/{DdtN-mI9.js → a3TFelkn.js} +1 -1
  254. package/web/app/immutable/chunks/{Bxk8XeS_.js → baWz1QxB.js} +1 -1
  255. package/web/app/immutable/chunks/{Gpf-ce3t.js → bhKPSdq4.js} +1 -1
  256. package/web/app/immutable/chunks/{CcrFwPvM.js → c5QZsH9t.js} +1 -1
  257. package/web/app/immutable/chunks/{DYXQ0DvL.js → cebxNJuC.js} +4 -4
  258. package/web/app/immutable/chunks/{CYodIWBo.js → chjnSxvZ.js} +1 -1
  259. package/web/app/immutable/chunks/{DYltC5LY.js → duDdSCAT.js} +1 -1
  260. package/web/app/immutable/chunks/{Bfi3_8Hc.js → eElW3aeh.js} +1 -1
  261. package/web/app/immutable/chunks/{BdSrsYxv.js → eQVXRlbn.js} +1 -1
  262. package/web/app/immutable/chunks/{_Juvw-ie.js → eTsHzcIE.js} +3 -3
  263. package/web/app/immutable/chunks/{CNXu44c3.js → ebbVP0tp.js} +1 -1
  264. package/web/app/immutable/chunks/{0chz2rsS.js → f24VwgrA.js} +1 -1
  265. package/web/app/immutable/chunks/{BGozEqB2.js → fiz8N_zQ.js} +1 -1
  266. package/web/app/immutable/chunks/{Cr4NRN2o.js → hHMYoFyG.js} +1 -1
  267. package/web/app/immutable/chunks/{Ba-gJiCF.js → haN7a3Sc.js} +1 -1
  268. package/web/app/immutable/chunks/{J4xkCilS.js → hb4NYXGo.js} +1 -1
  269. package/web/app/immutable/chunks/{DsbDY3sD.js → jcl0zObl.js} +2 -2
  270. package/web/app/immutable/chunks/{Dxv5pbru.js → jn4zbMQy.js} +1 -1
  271. package/web/app/immutable/chunks/k0JmlCVk.js +2 -0
  272. package/web/app/immutable/chunks/{Cc08a9kX.js → kS6Z7jzP.js} +1 -1
  273. package/web/app/immutable/chunks/{D5CeMpEM.js → kjxbkPQZ.js} +1 -1
  274. package/web/app/immutable/chunks/{DwgOf6Jh.js → lJeex2Gh.js} +1 -1
  275. package/web/app/immutable/chunks/{BTQKLXYi.js → lVh2oAeQ.js} +1 -1
  276. package/web/app/immutable/chunks/{DVIpt_-b.js → lwlI9u_5.js} +1 -1
  277. package/web/app/immutable/chunks/{DQzjOLwV.js → nXfD7jHz.js} +2 -2
  278. package/web/app/immutable/chunks/{C5BT0KwE.js → ozVAo4aX.js} +1 -1
  279. package/web/app/immutable/chunks/{EfOpqeLT.js → p9X2tUBM.js} +1 -1
  280. package/web/app/immutable/chunks/{COWdAscC.js → pYQh_Bw_.js} +1 -1
  281. package/web/app/immutable/chunks/{CDGdQPZ3.js → puJFvQs5.js} +1 -1
  282. package/web/app/immutable/chunks/{DwlFFy2U.js → pwJelZzH.js} +1 -1
  283. package/web/app/immutable/chunks/{Bf8Z3F34.js → sdV4t8T0.js} +1 -1
  284. package/web/app/immutable/chunks/{VtSYBFwm.js → tZyAiGvb.js} +1 -1
  285. package/web/app/immutable/chunks/{9xo585Vy.js → tr-2J8Mf.js} +1 -1
  286. package/web/app/immutable/chunks/{DhKLQ_6L.js → ujhgjK1k.js} +1 -1
  287. package/web/app/immutable/chunks/{CCHulQ4M.js → v0ybYtGc.js} +1 -1
  288. package/web/app/immutable/chunks/{Cf9FKQ2t.js → viB2mzAd.js} +1 -1
  289. package/web/app/immutable/chunks/{CFhJzMqD.js → wIMcEpgB.js} +1 -1
  290. package/web/app/immutable/chunks/{BnV5imkg.js → wUSGg9l9.js} +1 -1
  291. package/web/app/immutable/chunks/{DQGxxGZP.js → wl2qP2wF.js} +1 -1
  292. package/web/app/immutable/chunks/{DZldOwzL.js → yFcbscNn.js} +1 -1
  293. package/web/app/immutable/entry/app.PfV9Bd5g.js +4 -0
  294. package/web/app/immutable/entry/start.kviRYMjm.js +1 -0
  295. package/web/app/immutable/nodes/{0.XjTeJo8S.js → 0.N3QFhxpx.js} +1 -1
  296. package/web/app/immutable/nodes/{1.WAn52SGO.js → 1.Cuki-Q-c.js} +1 -1
  297. package/web/app/immutable/nodes/{10.BCt95gGF.js → 10.CzZBTiyD.js} +5 -5
  298. package/web/app/immutable/nodes/{11.D9nZjMrf.js → 11.Cc53X5P2.js} +1 -1
  299. package/web/app/immutable/nodes/{12.J0j9wF8Z.js → 12.BpXDHhXi.js} +1 -1
  300. package/web/app/immutable/nodes/{13.BGHXM182.js → 13.CCKyw-_o.js} +1 -1
  301. package/web/app/immutable/nodes/{14.BpDGhzOE.js → 14.BD92xFv4.js} +3 -3
  302. package/web/app/immutable/nodes/{15.DTHSLR65.js → 15.D2GMHiSb.js} +1 -1
  303. package/web/app/immutable/nodes/{16.WKc2P4l3.js → 16.CVCm-nfj.js} +1 -1
  304. package/web/app/immutable/nodes/{17.f0RTyi1E.js → 17.CjKvJw8X.js} +1 -1
  305. package/web/app/immutable/nodes/{18.BCr1DqlF.js → 18.DDY8Eqsn.js} +1 -1
  306. package/web/app/immutable/nodes/{19.kyknfcua.js → 19.DvFJngD4.js} +2 -2
  307. package/web/app/immutable/nodes/{2.BhjQOmpc.js → 2.B94-26jU.js} +4 -4
  308. package/web/app/immutable/nodes/{20.DJSk2vW3.js → 20.CLsq1QLL.js} +1 -1
  309. package/web/app/immutable/nodes/{3.B5ONUR90.js → 3.D7lbuuWp.js} +1 -1
  310. package/web/app/immutable/nodes/{4.9E3WAn5x.js → 4.YSZzuDIT.js} +1 -1
  311. package/web/app/immutable/nodes/5.ymicNL_Y.js +1 -0
  312. package/web/app/immutable/nodes/{6.DC2CoHu2.js → 6.CtS0PFqR.js} +1 -1
  313. package/web/app/immutable/nodes/{7.ipL23qll.js → 7.BVAyauMB.js} +1 -1
  314. package/web/app/immutable/nodes/{8.H6jtZ1r2.js → 8.CHlBOO6u.js} +1 -1
  315. package/web/app/immutable/nodes/9.CNAqB0x1.js +14 -0
  316. package/web/app/immutable/workers/html-file-preview.worker-BfFljPK-.js +1 -0
  317. package/web/app/version.json +1 -1
  318. package/web/generated/paraglide.js +46 -46
  319. package/web/index.html +19 -19
  320. package/web/app/immutable/assets/0.MRSSdFvi.css +0 -1
  321. package/web/app/immutable/chunks/B8JLAqaa.js +0 -1
  322. package/web/app/immutable/chunks/BEwMx-58.js +0 -1
  323. package/web/app/immutable/chunks/ChxY4HYP.js +0 -1
  324. package/web/app/immutable/chunks/DRhX_2TI.js +0 -1
  325. package/web/app/immutable/chunks/DWOJ689M.js +0 -1
  326. package/web/app/immutable/chunks/LCTocMEs.js +0 -1
  327. package/web/app/immutable/chunks/LNBns0B-.js +0 -1
  328. package/web/app/immutable/chunks/RXLk0Kpm.js +0 -1
  329. package/web/app/immutable/chunks/_FHZ2hc1.js +0 -2
  330. package/web/app/immutable/chunks/lZXQR9AV.js +0 -1
  331. package/web/app/immutable/entry/app.C9XhrjLK.js +0 -4
  332. package/web/app/immutable/entry/start.CkQDADa5.js +0 -1
  333. package/web/app/immutable/nodes/5.51b5Mc5a.js +0 -1
  334. package/web/app/immutable/nodes/9.qiIDO-mm.js +0 -12
@@ -1 +1 @@
1
- var j=Object.defineProperty;var V=(s,e,t)=>e in s?j(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var n=(s,e,t)=>V(s,typeof e!="symbol"?e+"":e,t);import{f as x,j as G,p as z}from"./uXuxG9cN.js";import{u as J,o as T,_ as C,s as b,l as _,n as U}from"./CIyUrgF0.js";import{bm as $}from"./BEwMx-58.js";class u extends Error{constructor(t){super(t.message);n(this,"code");n(this,"data");n(this,"rpcCode");this.name="BackendError",this.code=t.code,this.data=t.data,this.rpcCode=t.rpcCode}}function Ee(s){return!s||typeof s!="object"?!1:typeof s.rpcCode=="number"}const K=-32003;function Ce(s){return!s||typeof s!="object"?!1:s.rpcCode===K}const Ae=x.refine(s=>s.repository.provider==="github"&&s.kind==="pull-request"||s.repository.provider==="gitlab"&&s.kind==="merge-request"),Oe=J([T({state:C(["available","pending","reconnect-required","restricted","disabled","unsupported","unavailable","unknown"])}),T({state:_("backoff"),retryAt:b()}),T({state:_("unresolved"),reason:C(["missing-provenance","unverified-import","invalid-target","missing-authority","unknown"]).catch("unknown")})]).catch({state:"unknown"}),_e=T({backendId:b().min(1),sessionId:b().min(1),workspaceId:b().min(1)}).strict();function v(s){return typeof s=="number"&&Number.isSafeInteger(s)&&s>=1}function Ne(s){if(s.resource||s.monitorAvailability||s.title===null||s.url===null||s.lastSnapshot===null)return!1;const e=s.lastSnapshot;return!e||!e.availability&&e.isDraft!==null&&e.hasConflicts!==null&&e.isBehind!==null&&Object.values(e.checks).every(t=>t!==null)&&e.approvals.decision!==null&&e.approvals.have!==null&&e.approvals.changesRequested!==null}const Ie=new Set(["agent.getConversation","agent.listUserMessages","agent.getMessageBlock","chat.subscribe","chat.unsubscribe"]);class Y{constructor(e,t,i,o,a,d,R){n(this,"ready");n(this,"acknowledged",!1);n(this,"closed",!1);n(this,"id",0);n(this,"pending",new Map);n(this,"listeners",new Set);n(this,"rejectReady");n(this,"timer");this.socket=e,this.currentSource=o,this.timeoutMs=a,this.onFailure=R,this.ready=new Promise((m,r)=>{this.rejectReady=r,e.onopen=()=>{if(!this.current())return this.fail();this.send("client.hello",{clientId:t,connectionRole:"review-monitor",capabilities:{reviewMonitoring:i}}).then(f=>{const c=f;if(!this.current()||c?.clientId!==t||c?.connectionRole!=="review-monitor"||!v(c?.server?.capabilities?.reviewMonitoring))return this.fail();this.acknowledged=!0,clearTimeout(this.timer),m()},()=>this.fail())}}),this.timer=setTimeout(()=>this.fail(),d),e.onerror=()=>this.fail(),e.onclose=()=>this.fail(),e.onmessage=({data:m})=>{if(!this.current()||typeof m!="string")return;let r;try{r=JSON.parse(m)}catch{return}if(!r||typeof r!="object")return;if(typeof r.method=="string"){if(r.id!=null){try{e.send(JSON.stringify({jsonrpc:"2.0",id:r.id,error:{code:-32601,message:"Method not found"}}))}catch{this.fail()}return}if(this.acknowledged)for(const c of[...this.listeners])c({method:r.method,params:r.params});return}if(typeof r.id!="number")return;const f=this.pending.get(r.id);if(f)if(this.pending.delete(r.id),clearTimeout(f.timer),r.error){const c=r.error.data,g=c&&typeof c=="object"&&"code"in c&&typeof c.code=="string"?c.code:"SERVER_ERROR";f.reject(new u({code:g,message:typeof r.error.message=="string"?r.error.message:"Monitor request failed",data:c,rpcCode:typeof r.error.code=="number"?r.error.code:void 0}))}else f.resolve(r.result)}}current(){return!this.closed&&this.currentSource()}onNotification(e){return this.listeners.add(e),()=>this.listeners.delete(e)}request(e,t){return!this.acknowledged||e==="client.hello"?Promise.reject(this.unavailable()):this.send(e,t)}close(){if(this.closed)return;this.closed=!0,this.acknowledged=!1,clearTimeout(this.timer);const e=this.unavailable();this.rejectReady(e);for(const t of this.pending.values())clearTimeout(t.timer),t.reject(e);this.pending.clear(),this.listeners.clear(),this.socket.onopen=this.socket.onmessage=this.socket.onerror=this.socket.onclose=null;try{this.socket.close()}catch{}}fail(){this.closed||(this.close(),this.onFailure())}unavailable(){return new u({code:"PR_MONITOR_SESSION_RETIRED",message:"Monitor attachment unavailable"})}send(e,t){if(!this.current())return Promise.reject(this.unavailable());const i=++this.id;return new Promise((o,a)=>{const d=setTimeout(()=>{this.pending.delete(i),a(new u({code:"TIMEOUT",message:`JSON-RPC request timed out: ${e}`}))},this.timeoutMs);this.pending.set(i,{resolve:o,reject:a,timer:d});try{this.socket.send(JSON.stringify({jsonrpc:"2.0",id:i,method:e,params:t}))}catch{this.fail()}})}}const X=["agentNodes","localNodeIsolation","agentPlatformRouting","workspaceMembershipEvents","rawScreenshotRetention","chiefAttachments","noteTruncatedRead","remoteMachines","remoteInitialAgent","remoteMachineClaim","machineOrder","remoteLinkTraffic","cloudMachines","cloudMachineEntries","cloudMachineProviders"];function Q(s){return Object.freeze(Object.fromEntries(X.map(e=>[e,s?.[e]===1?1:0])))}function Z(s){if(!G(s,11,1))throw new Error($.files_secondaryRoot_unsupported_error())}function ee(s,e,t){te(s,e)&&Z(t)}function te(s,e){if(s!=="file.read"&&s!=="file.readChunk")return!1;const t=e?.gitRootId;return typeof t=="string"&&!!t.trim()}const N=-32012,se="system.startupStatus",ne=1e3,L=1e3,F=3e4,w=U().int().nonnegative().max(Number.MAX_SAFE_INTEGER),ie=T({completedNotes:w,totalNotes:w,processedSourceBytes:w,totalSourceBytes:w}).refine(s=>s.completedNotes<=s.totalNotes&&s.processedSourceBytes<=s.totalSourceBytes),oe=T({startupStatus:_(1),daemonVersion:b().min(1).optional(),attemptId:b().min(1),phase:C(["preparing","indexing","finalizing","ready","failed"]),elapsedMs:w,phaseElapsedMs:w,progressAgeMs:w,retryAfterMs:U().int().min(L).max(F).optional(),progress:ie.optional(),estimatedRemainingMs:w.optional(),finalizingStep:C(["anchors","committing","services"]).optional(),failure:T({code:b().min(1),message:b().min(1)}).optional()}).refine(s=>(s.phase==="ready"||s.phase==="failed"?s.retryAfterMs===void 0:s.retryAfterMs!==void 0)&&(s.phase==="finalizing"?s.finalizingStep!==void 0:s.finalizingStep===void 0)&&(s.phase==="failed"?s.failure!==void 0:s.failure===void 0)&&(s.estimatedRemainingMs===void 0||s.phase==="indexing"));function B(s){const e=oe.safeParse(s);return e.success?e.data:null}function P(s){const e=typeof s=="number"&&Number.isFinite(s)?s:ne;return Math.min(F,Math.max(L,e))}function re(s){const e=s;return typeof e.rpcCode=="number"?e.rpcCode:typeof e.code=="number"?e.code:void 0}function q(s){if(!s||typeof s!="object"||re(s)!==N)return;const e=s.data??{},t=B(e.startup);if(e.code==="daemon-startup-failed"){const i=e.startup?.failure?.message,o=s.message;return{kind:"failed",message:typeof i=="string"&&i.trim()?i:typeof o=="string"?o:"",snapshot:t}}if(!(e.code!=="daemon-not-ready"||e.retryable!==!0))return{kind:"not-ready",retryAfterMs:P(e.retryAfterMs),snapshot:t}}function D(s){const e=s.snapshot??void 0;return s.state==="failed"?{code:N,message:"Daemon startup failed",data:{code:"daemon-startup-failed",retryable:!1,startup:e}}:{code:N,message:"Daemon not ready",data:{code:"daemon-not-ready",retryable:!0,retryAfterMs:P(e?.retryAfterMs),startup:e}}}const ae=5e3,ce=5e3,le=3e4;function he(s){const e=s.snapshot;return JSON.stringify([s.state,s.available,e?.attemptId,e?.phase,e?.finalizingStep,e?.progress?.completedNotes,e?.progress?.totalNotes,e?.estimatedRemainingMs===void 0,(e?.progressAgeMs??0)>=le])}class ue{constructor(e){n(this,"generation",0);n(this,"timer",null);n(this,"snapshot",null);n(this,"lastKey",null);n(this,"lastPublishedAt",0);this.host=e}start(e){this.stop(),this.snapshot=e.snapshot??this.snapshot,this.publish({state:"starting",snapshot:this.snapshot,available:e.snapshot!==null},!0),this.schedule(e.retryAfterMs)}stop(){this.generation++,this.timer&&(clearTimeout(this.timer),this.timer=null)}reset(){this.stop(),this.snapshot=null,this.lastKey=null,this.lastPublishedAt=0}publish(e,t=!1){const i=he(e),o=Date.now();!t&&i===this.lastKey&&o-this.lastPublishedAt<ce||(this.lastKey=i,this.lastPublishedAt=o,this.host.publish(e))}schedule(e){const t=this.generation;this.timer=setTimeout(()=>{if(this.timer=null,t!==this.generation)return;const i=()=>this.poll(t);this.host.track?this.host.track(i):i()},e)}async poll(e){let t;try{t=B(await this.host.request())}catch(i){if(e!==this.generation)return;const o=q(i);if(o?.kind==="failed"){this.stop(),this.host.fail(o.message,o.snapshot);return}if(o?.kind==="not-ready"){this.snapshot=o.snapshot??this.snapshot,this.publish({state:"starting",snapshot:this.snapshot,available:o.snapshot!==null}),this.schedule(o.retryAfterMs);return}this.unavailable();return}if(e===this.generation){if(t===null){this.unavailable();return}if(this.snapshot=t,t.phase==="failed"){this.stop(),this.host.fail(t.failure?.message??"",t);return}if(t.phase==="ready"){this.stop(),this.publish({state:"starting",snapshot:t,available:!0},!0),this.host.handoff(!0);return}this.publish({state:"starting",snapshot:t,available:!0}),this.schedule(P(t.retryAfterMs))}}unavailable(){this.stop(),this.publish({state:"starting",snapshot:this.snapshot,available:!1},!0),this.host.handoff(!1)}}function Pe(s=(()=>{const e=globalThis.__INTENT_RUNTIME_CONFIG__;return e?.intentdWsUrl!==void 0?e.intentdWsUrl:typeof process>"u"?void 0:""})()){if(typeof s!="string")return;const e=s.trim();if(!e)return;if(e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\")){const o=globalThis.location;if(o?.host&&(o.protocol==="http:"||o.protocol==="https:"))return`${o.protocol==="https:"?"wss:":"ws:"}//${o.host}${e}`;console.warn("[browser-websocket-transport] Ignoring same-origin WebSocket path without an HTTP page origin");return}let t;try{t=new URL(e)}catch{console.warn("[browser-websocket-transport] Ignoring browser WebSocket URL: expected ws:// or wss://");return}if(t.protocol!=="ws:"&&t.protocol!=="wss:"){console.warn("[browser-websocket-transport] Ignoring browser WebSocket URL: expected ws:// or wss://");return}const i=t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]";if(t.protocol==="ws:"&&!i){console.warn("[browser-websocket-transport] Ignoring insecure remote WebSocket URL: use wss://");return}return e}function de(s){try{const e=new URL(s);return e.username="",e.password="",e.search="",e.hash="",e.toString()}catch{return s.replace(/[?#].*$/,"").replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/]*@/i,"$1")}}const fe={[-32700]:"PARSE_ERROR",[-32600]:"INVALID_REQUEST",[-32601]:"METHOD_NOT_FOUND",[-32602]:"INVALID_PARAMS",[-32603]:"INTERNAL_ERROR"};function pe(s){const e=fe[s];return e||(s<=-32e3&&s>=-32099?"SERVER_ERROR":"UNKNOWN_ERROR")}function me(s){if(s&&typeof s=="object"&&"code"in s){const e=s.code;if(typeof e=="string"&&e.length>0)return e}}function O(s){const e=me(s.data)??pe(s.code),t=s.data&&typeof s.data=="object"?{...s.data,code:e}:typeof s.data=="string"&&s.data.length>0?{code:e,detail:s.data}:{code:e};return{code:e,message:s.message,data:t,rpcCode:s.code}}function E(s){if(s instanceof u)return s;const e=s instanceof Error?s.message:String(s);return new u({code:"TRANSPORT_ERROR",message:e,data:{code:"TRANSPORT_ERROR"}})}const ge=3e4,Re=1e3,ye=3e4,Se=1e4,be=5e3;class we{constructor(e){n(this,"url");n(this,"webSocketFactory");n(this,"requestTimeoutMs");n(this,"reconnectDelayMs");n(this,"maxReconnectDelayMs");n(this,"connectTimeoutMs");n(this,"socket",null);n(this,"connected",!1);n(this,"connecting",!1);n(this,"disposed",!1);n(this,"requestId",0);n(this,"currentReconnectDelay");n(this,"reconnectTimer",null);n(this,"connectTimer",null);n(this,"connectWaiters",[]);n(this,"clientId");n(this,"helloConfirmed",!1);n(this,"acknowledgedHello",null);n(this,"nodeCapabilities",null);n(this,"capabilityHelloGeneration",0);n(this,"reviewMonitoring");n(this,"reviewMonitoringRecipient");n(this,"reviewMonitoringEnabled",!1);n(this,"ordinaryHello",!1);n(this,"monitorRetry",null);n(this,"monitorRetirements",new Set);n(this,"monitorReady",new Set);n(this,"protocolVersion",null);n(this,"helloError",new u({code:"UNAVAILABLE",message:"client.hello has not completed on this connection"}));n(this,"pending",new Map);n(this,"hasBeenConnected",!1);n(this,"hasConnectionFailed",!1);n(this,"notificationHandlers",new Set);n(this,"reconnectedHandlers",new Set);n(this,"statusHandlers",new Set);n(this,"lastNotifiedStatus","disconnected");n(this,"startupState",null);n(this,"startupSocket",null);n(this,"startupPoller",new ue({request:()=>{const e=this.startupSocket;return e?this.requestOnSocket(se,void 0,{timeoutMs:ae},e):Promise.reject(this.startupRefusal())},publish:e=>this.updateStartup(e),handoff:e=>this.startupHandoff(e),fail:(e,t)=>this.failStartup(e,t)}));n(this,"startupHandlers",new Set);this.reviewMonitoringEnabled=v(e.reviewMonitoring),this.reviewMonitoringRecipient=v(e.reviewMonitoring)?e.reviewMonitoring:void 0,this.url=e.url,this.webSocketFactory=e.webSocketFactory??(t=>new WebSocket(t)),this.requestTimeoutMs=e.requestTimeoutMs??ge,this.reconnectDelayMs=e.reconnectDelayMs??Re,this.maxReconnectDelayMs=e.maxReconnectDelayMs??ye,this.connectTimeoutMs=e.connectTimeoutMs??Se,this.currentReconnectDelay=this.reconnectDelayMs}isAvailable(){return!this.disposed}async readPrincipal(){if(this.disposed)throw new u({code:"UNAVAILABLE",message:"Backend transport disposed"});const e=await this.ensureConnected(),t=this.capabilityHelloGeneration,i=structuredClone(this.acknowledgedHello),o=()=>!this.disposed&&this.connected&&this.socket===e&&this.capabilityHelloGeneration===t&&this.acknowledgedHello!==null;if(!o())throw this.helloError;const a=await this.requestOnSocket("principal.me",{},void 0,e);if(!o())throw new u({code:"UNAVAILABLE",message:"Principal discovery connection changed"});return{hello:i,principal:a}}async observeNodeCapabilities(){if(this.disposed)throw new u({code:"UNAVAILABLE",message:"Backend transport disposed"});const e=await this.ensureConnected();if(this.disposed||!this.connected||this.socket!==e)throw new u({code:"UNAVAILABLE",message:"Backend connection changed"});return{server:{capabilities:this.nodeCapabilities}}}onMonitorReconnected(e){this.monitorReady.add(e);const t=this.onReconnected(e);return()=>{this.monitorReady.delete(e),t()}}prMonitorBackendId(){return de(this.url)}async capturePrMonitorSession(e){const t=await this.ensureConnected(),i=this.capabilityHelloGeneration,o=()=>new u({code:"PR_MONITOR_SESSION_RETIRED",message:"Monitor connection unavailable"});let a,d=!1;const R=new Set,m=new Set,r=()=>{if(!d){d=!0,this.monitorRetirements.delete(r),a?.close();for(const l of R)l();R.clear()}},f=()=>!d&&!this.disposed&&this.connected&&this.helloConfirmed&&this.socket===t&&i===this.capabilityHelloGeneration,c=()=>f()&&(!a||a.current());if(!c())throw o();this.monitorRetirements.add(r);const g=v(this.reviewMonitoring);let M=g?"consumer-pending":"unsupported";if(g&&this.reviewMonitoringEnabled&&this.ordinaryHello&&this.clientId)try{if(a=new Y(this.webSocketFactory(this.url),this.clientId,Math.min(this.reviewMonitoringRecipient,this.reviewMonitoring),f,this.requestTimeoutMs,this.connectTimeoutMs,()=>{const l=f();r(),l&&this.scheduleMonitorRecovery(t,i)}),await a.ready,!c())throw o();M="supported"}catch(l){const p=f();throw r(),p&&this.scheduleMonitorRecovery(t,i),l}const y=(l,p)=>a?a.request(l,p):this.requestOnSocket(l,p,void 0,t);return{origin:{backendId:this.prMonitorBackendId(),sessionId:crypto.randomUUID(),workspaceId:e},support:M,onRetired(l){return c()?(R.add(l),()=>{R.delete(l)}):(l(),()=>{})},onNotification:l=>(a??this).onNotification(p=>{c()&&l(p)}),request:async(l,p)=>{if(!c()||M==="consumer-pending"||p.workspaceId!==e)throw o();const k=await y(l,p),h=l==="events.subscribe"?k?.subscriptionId:void 0;if(!c())throw h&&this.socket===t&&this.connected&&i===this.capabilityHelloGeneration&&y("events.unsubscribe",{workspaceId:e,subscriptionId:h}).catch(()=>{}),o();return h&&m.add(h),l==="events.unsubscribe"&&m.delete(String(p.subscriptionId)),k},release:async()=>{const l=c();r(),l&&!a&&await Promise.all([...m].map(p=>this.requestOnSocket("events.unsubscribe",{workspaceId:e,subscriptionId:p},void 0,t).catch(()=>{})))}}}request(e,t,i){return this.requestOnSocket(e,t,i)}requestOnSocket(e,t,i,o){if(i?.localMachine)return Promise.reject(new u({code:"UNAVAILABLE",message:"Local machine requests require the desktop bridge"}));if(this.disposed)return Promise.reject(new u({code:"UNAVAILABLE",message:"Backend transport disposed"}));if(!o&&this.startupState?.state==="starting")return Promise.reject(new u(O(D(this.startupState))));const a=++this.requestId,d=i?.timeoutMs,R=typeof d=="number"&&Number.isFinite(d)&&d>0?d:this.requestTimeoutMs;return new Promise((m,r)=>{let f=!1;const c=setTimeout(()=>{f=!0,this.pending.delete(a),r(new u({code:"TIMEOUT",message:`JSON-RPC request timed out: ${e}`,data:{code:"TIMEOUT"}}))},R),g=y=>{clearTimeout(c),r(E(y))},M=y=>{if(f)return;if(this.disposed||this.socket!==y){g(new u({code:"TRANSPORT_ERROR",message:"Connection replaced"}));return}if(e==="presence.update"&&!this.helloConfirmed){g(this.helloError);return}try{ee(e,t,this.protocolVersion)}catch(h){g(h);return}let l=e==="client.hello"&&this.clientId?{clientId:this.clientId,...t}:t;if(e==="client.hello"){const h={...l},S={...h.capabilities};Object.prototype.hasOwnProperty.call(S,"reviewMonitoring")&&(this.reviewMonitoringEnabled=this.reviewMonitoringRecipient!==void 0&&v(S.reviewMonitoring)),delete S.reviewMonitoring,delete h.connectionRole,h.capabilities!==void 0&&(h.capabilities=S),l=h}const p=JSON.stringify({jsonrpc:"2.0",id:a,method:e,params:l}),k=e==="client.hello"?++this.capabilityHelloGeneration:0;if(e==="client.hello"){this.helloConfirmed=!1,this.ordinaryHello=!1,this.clearMonitorRecovery(),this.nodeCapabilities=null,this.reviewMonitoring=void 0;for(const h of[...this.monitorRetirements])h();this.acknowledgedHello=null}this.pending.set(a,{method:e,timeout:c,resolve:h=>{if(e==="client.hello"&&this.socket===y&&k===this.capabilityHelloGeneration){const S=h?.clientId;if(typeof S=="string"&&S.length>0){const H=h.server?.capabilities;if(this.clientId=S,this.reviewMonitoring=H?.reviewMonitoring,this.ordinaryHello=h.connectionRole===void 0,this.acknowledgedHello=structuredClone(h),this.nodeCapabilities=Q(H),this.protocolVersion=z(h.protocolVersion),this.helloConfirmed=!0,this.connected)for(const W of this.monitorReady)W()}}m(h)},reject:r});try{y.send(p)}catch(h){clearTimeout(c),this.pending.delete(a),r(E(h))}};o?M(o):this.connected&&this.socket?M(this.socket):this.ensureConnected().then(M,g)})}async subscribe(e){return this.request("events.subscribe",e)}async unsubscribe(e,t){try{await this.request("events.unsubscribe",{subscriptionId:e,...t!==void 0?{workspaceId:t}:{}})}catch{}}onNotification(e){return this.notificationHandlers.add(e),()=>this.notificationHandlers.delete(e)}onReconnected(e){return this.reconnectedHandlers.add(e),()=>this.reconnectedHandlers.delete(e)}getConnectionStatus(){return this.connected?"connected":this.connecting?"connecting":"disconnected"}getStartupState(){return this.startupState}onStartupChange(e){return this.startupHandlers.add(e),()=>this.startupHandlers.delete(e)}onConnectionStatusChange(e){return this.statusHandlers.add(e),()=>this.statusHandlers.delete(e)}dispose(){if(this.disposed)return;this.disposed=!0,this.clearReconnect(),this.clearConnectTimer();const e=new u({code:"UNAVAILABLE",message:"Backend transport disposed"});this.failPending(e),this.failWaiters(e),this.teardownSocket(),this.connected=!1,this.connecting=!1,this.notifyStatusChange(),this.notificationHandlers.clear(),this.reconnectedHandlers.clear(),this.statusHandlers.clear(),this.startupHandlers.clear()}ensureConnected(){return this.connected&&this.socket?Promise.resolve(this.socket):new Promise((e,t)=>{this.connectWaiters.push({resolve:e,reject:t}),this.start()})}start(){this.disposed||this.socket||this.connecting||this.reconnectTimer||this.connect()}connect(){this.clearReconnect(),this.connecting=!0,this.notifyStatusChange();let e;try{e=this.webSocketFactory(this.url)}catch(t){this.connecting=!1,this.onConnectionFailure(E(t));return}this.socket=e,this.helloConfirmed=!1,this.connectTimer=setTimeout(()=>{this.connectTimer=null,!(this.socket!==e||this.connected)&&(this.connecting=!1,this.onConnectionFailure(new u({code:"TRANSPORT_ERROR",message:`WebSocket connect attempt timed out after ${this.connectTimeoutMs}ms`})))},this.connectTimeoutMs),e.onopen=()=>{this.socket===e&&this.onConnected(e)},e.onmessage=t=>{this.socket===e&&this.onMessage(t.data)},e.onerror=null,e.onclose=()=>{this.socket===e&&(this.connecting=!1,this.onConnectionFailure(new u({code:"TRANSPORT_ERROR",message:"WebSocket connection closed"})))}}onConnected(e){this.clearConnectTimer(),this.performHelloHandshake(e)}async performHelloHandshake(e){try{await this.requestOnSocket("client.hello",{},{timeoutMs:Math.min(this.requestTimeoutMs,be)},e)}catch(o){if(this.disposed||this.socket!==e)return;const a=q(o);if(a){this.enterStartup(e,a);return}this.helloError=E(o)}if(this.disposed||this.socket!==e)return;this.startupPoller.reset(),this.startupSocket=null;const t=this.startupState!==null;this.startupState=null,this.connecting=!1,this.connected=!0,this.currentReconnectDelay=this.reconnectDelayMs;const i=this.hasBeenConnected||this.hasConnectionFailed;if(this.hasBeenConnected=!0,this.hasConnectionFailed=!1,this.notifyStatusChange(),t)for(const o of[...this.startupHandlers])o(null);if(this.flushWaiters(e),i)for(const o of[...this.reconnectedHandlers])o()}onConnectionFailure(e){if(this.clearConnectTimer(),!this.disposed){if(this.startupSocket!==null&&this.startupSocket===this.socket){this.startupHandoff(!0);return}this.startupState?.state==="starting"&&(this.startupPoller.reset(),this.updateStartup(null)),this.hasConnectionFailed=!0,this.connected=!1,this.notifyStatusChange(),this.teardownSocket(),this.failPending(e),this.failWaiters(e),this.scheduleReconnect()}}notifyStatusChange(){const e=this.getConnectionStatus();if(e!==this.lastNotifiedStatus){this.lastNotifiedStatus=e;for(const t of[...this.statusHandlers])t(e)}}onMessage(e){if(typeof e!="string")return;let t;try{t=JSON.parse(e)}catch{console.warn("[browser-websocket-transport] Dropping unparseable frame");return}if(!t||typeof t!="object")return;const i=typeof t.method=="string",o=t.id!=null;if(i&&o){this.sendFrame({jsonrpc:"2.0",id:t.id,error:{code:-32601,message:`Method not found: ${String(t.method)}`}});return}if(o){const a=Number(t.id),d=this.pending.get(a);if(!d)return;this.pending.delete(a),clearTimeout(d.timeout),t.error?d.reject(new u(O(t.error))):d.resolve(t.result);return}if(i){const a={method:t.method,params:t.params};for(const d of[...this.notificationHandlers])d(a)}}sendFrame(e){try{this.socket?.send(JSON.stringify(e))}catch{}}scheduleReconnect(){if(this.disposed||this.reconnectTimer)return;const e=this.currentReconnectDelay;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.currentReconnectDelay=Math.min(e*2,this.maxReconnectDelayMs),this.disposed||this.connect()},e)}clearReconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}clearConnectTimer(){this.connectTimer&&(clearTimeout(this.connectTimer),this.connectTimer=null)}scheduleMonitorRecovery(e,t){this.monitorRetry||this.disposed||(this.monitorRetry=setTimeout(()=>{if(this.monitorRetry=null,!this.disposed&&this.connected&&this.socket===e&&this.capabilityHelloGeneration===t)for(const i of[...this.monitorReady])i()},this.reconnectDelayMs))}clearMonitorRecovery(){this.monitorRetry&&clearTimeout(this.monitorRetry),this.monitorRetry=null}teardownSocket(){this.startupPoller.stop(),this.startupSocket=null,this.reviewMonitoring=void 0,this.clearMonitorRecovery();for(const t of[...this.monitorRetirements])t();if(this.acknowledgedHello=null,this.nodeCapabilities=null,this.capabilityHelloGeneration+=1,this.protocolVersion=null,!this.socket)return;const e=this.socket;this.socket=null,e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}updateStartup(e){this.startupState=e?Object.freeze({...e}):null;for(const t of[...this.startupHandlers])t(this.startupState)}startupRefusal(){return this.startupState?new u(O(D(this.startupState))):new u({code:"TRANSPORT_ERROR",message:"WebSocket connection closed"})}enterStartup(e,t){if(this.hasConnectionFailed=!0,t.kind==="failed"){this.failStartup(t.message,t.snapshot);return}this.startupSocket=e,this.startupPoller.start(t),this.failWaiters(this.startupRefusal())}startupHandoff(e){const t=this.startupRefusal();if(this.teardownSocket(),this.failPending(t),this.disposed)return;this.connecting=!0,this.notifyStatusChange(),this.clearReconnect();let i=this.reconnectDelayMs;e?this.currentReconnectDelay=this.reconnectDelayMs:(i=this.currentReconnectDelay,this.currentReconnectDelay=Math.min(i*2,this.maxReconnectDelayMs)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.disposed||this.connect()},i)}failStartup(e,t){this.startupPoller.stop(),this.startupSocket=null,this.hasConnectionFailed=!0,this.updateStartup({state:"failed",snapshot:t,available:t!==null,message:e}),this.connecting=!1,this.onConnectionFailure(this.startupRefusal())}failPending(e){for(const t of this.pending.values())clearTimeout(t.timeout),t.reject(e);this.pending.clear()}flushWaiters(e){const t=this.connectWaiters;this.connectWaiters=[];for(const i of t)i.resolve(e)}failWaiters(e){const t=this.connectWaiters;this.connectWaiters=[];for(const i of t)i.reject(e)}}function He(s){return new we(s)}let A=null;const I=new Set;function De(s){A=s;for(const e of[...I])e(s)}function Ue(){return A}function Le(s){return I.add(s),A&&s(A),()=>I.delete(s)}export{u as B,Oe as M,_e as P,Ie as R,Ae as a,Ce as b,He as c,Ne as d,Pe as e,v as f,Ue as g,Ee as i,Le as o,De as r,de as s};
1
+ var j=Object.defineProperty;var V=(s,e,t)=>e in s?j(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var n=(s,e,t)=>V(s,typeof e!="symbol"?e+"":e,t);import{f as x,j as G,p as z}from"./uXuxG9cN.js";import{u as J,o as T,_ as C,s as b,l as _,n as U}from"./CIyUrgF0.js";import{bm as $}from"./C0QTy0Sy.js";class u extends Error{constructor(t){super(t.message);n(this,"code");n(this,"data");n(this,"rpcCode");this.name="BackendError",this.code=t.code,this.data=t.data,this.rpcCode=t.rpcCode}}function Ee(s){return!s||typeof s!="object"?!1:typeof s.rpcCode=="number"}const K=-32003;function Ce(s){return!s||typeof s!="object"?!1:s.rpcCode===K}const Ae=x.refine(s=>s.repository.provider==="github"&&s.kind==="pull-request"||s.repository.provider==="gitlab"&&s.kind==="merge-request"),Oe=J([T({state:C(["available","pending","reconnect-required","restricted","disabled","unsupported","unavailable","unknown"])}),T({state:_("backoff"),retryAt:b()}),T({state:_("unresolved"),reason:C(["missing-provenance","unverified-import","invalid-target","missing-authority","unknown"]).catch("unknown")})]).catch({state:"unknown"}),_e=T({backendId:b().min(1),sessionId:b().min(1),workspaceId:b().min(1)}).strict();function v(s){return typeof s=="number"&&Number.isSafeInteger(s)&&s>=1}function Ne(s){if(s.resource||s.monitorAvailability||s.title===null||s.url===null||s.lastSnapshot===null)return!1;const e=s.lastSnapshot;return!e||!e.availability&&e.isDraft!==null&&e.hasConflicts!==null&&e.isBehind!==null&&Object.values(e.checks).every(t=>t!==null)&&e.approvals.decision!==null&&e.approvals.have!==null&&e.approvals.changesRequested!==null}const Ie=new Set(["agent.getConversation","agent.listUserMessages","agent.getMessageBlock","chat.subscribe","chat.unsubscribe"]);class Y{constructor(e,t,i,o,a,d,R){n(this,"ready");n(this,"acknowledged",!1);n(this,"closed",!1);n(this,"id",0);n(this,"pending",new Map);n(this,"listeners",new Set);n(this,"rejectReady");n(this,"timer");this.socket=e,this.currentSource=o,this.timeoutMs=a,this.onFailure=R,this.ready=new Promise((m,r)=>{this.rejectReady=r,e.onopen=()=>{if(!this.current())return this.fail();this.send("client.hello",{clientId:t,connectionRole:"review-monitor",capabilities:{reviewMonitoring:i}}).then(f=>{const c=f;if(!this.current()||c?.clientId!==t||c?.connectionRole!=="review-monitor"||!v(c?.server?.capabilities?.reviewMonitoring))return this.fail();this.acknowledged=!0,clearTimeout(this.timer),m()},()=>this.fail())}}),this.timer=setTimeout(()=>this.fail(),d),e.onerror=()=>this.fail(),e.onclose=()=>this.fail(),e.onmessage=({data:m})=>{if(!this.current()||typeof m!="string")return;let r;try{r=JSON.parse(m)}catch{return}if(!r||typeof r!="object")return;if(typeof r.method=="string"){if(r.id!=null){try{e.send(JSON.stringify({jsonrpc:"2.0",id:r.id,error:{code:-32601,message:"Method not found"}}))}catch{this.fail()}return}if(this.acknowledged)for(const c of[...this.listeners])c({method:r.method,params:r.params});return}if(typeof r.id!="number")return;const f=this.pending.get(r.id);if(f)if(this.pending.delete(r.id),clearTimeout(f.timer),r.error){const c=r.error.data,g=c&&typeof c=="object"&&"code"in c&&typeof c.code=="string"?c.code:"SERVER_ERROR";f.reject(new u({code:g,message:typeof r.error.message=="string"?r.error.message:"Monitor request failed",data:c,rpcCode:typeof r.error.code=="number"?r.error.code:void 0}))}else f.resolve(r.result)}}current(){return!this.closed&&this.currentSource()}onNotification(e){return this.listeners.add(e),()=>this.listeners.delete(e)}request(e,t){return!this.acknowledged||e==="client.hello"?Promise.reject(this.unavailable()):this.send(e,t)}close(){if(this.closed)return;this.closed=!0,this.acknowledged=!1,clearTimeout(this.timer);const e=this.unavailable();this.rejectReady(e);for(const t of this.pending.values())clearTimeout(t.timer),t.reject(e);this.pending.clear(),this.listeners.clear(),this.socket.onopen=this.socket.onmessage=this.socket.onerror=this.socket.onclose=null;try{this.socket.close()}catch{}}fail(){this.closed||(this.close(),this.onFailure())}unavailable(){return new u({code:"PR_MONITOR_SESSION_RETIRED",message:"Monitor attachment unavailable"})}send(e,t){if(!this.current())return Promise.reject(this.unavailable());const i=++this.id;return new Promise((o,a)=>{const d=setTimeout(()=>{this.pending.delete(i),a(new u({code:"TIMEOUT",message:`JSON-RPC request timed out: ${e}`}))},this.timeoutMs);this.pending.set(i,{resolve:o,reject:a,timer:d});try{this.socket.send(JSON.stringify({jsonrpc:"2.0",id:i,method:e,params:t}))}catch{this.fail()}})}}const X=["agentNodes","localNodeIsolation","agentPlatformRouting","workspaceMembershipEvents","rawScreenshotRetention","chiefAttachments","noteTruncatedRead","remoteMachines","remoteInitialAgent","remoteMachineClaim","machineOrder","remoteLinkTraffic","cloudMachines","cloudMachineEntries","cloudMachineProviders"];function Q(s){return Object.freeze(Object.fromEntries(X.map(e=>[e,s?.[e]===1?1:0])))}function Z(s){if(!G(s,11,1))throw new Error($.files_secondaryRoot_unsupported_error())}function ee(s,e,t){te(s,e)&&Z(t)}function te(s,e){if(s!=="file.read"&&s!=="file.readChunk")return!1;const t=e?.gitRootId;return typeof t=="string"&&!!t.trim()}const N=-32012,se="system.startupStatus",ne=1e3,L=1e3,F=3e4,w=U().int().nonnegative().max(Number.MAX_SAFE_INTEGER),ie=T({completedNotes:w,totalNotes:w,processedSourceBytes:w,totalSourceBytes:w}).refine(s=>s.completedNotes<=s.totalNotes&&s.processedSourceBytes<=s.totalSourceBytes),oe=T({startupStatus:_(1),daemonVersion:b().min(1).optional(),attemptId:b().min(1),phase:C(["preparing","indexing","finalizing","ready","failed"]),elapsedMs:w,phaseElapsedMs:w,progressAgeMs:w,retryAfterMs:U().int().min(L).max(F).optional(),progress:ie.optional(),estimatedRemainingMs:w.optional(),finalizingStep:C(["anchors","committing","services"]).optional(),failure:T({code:b().min(1),message:b().min(1)}).optional()}).refine(s=>(s.phase==="ready"||s.phase==="failed"?s.retryAfterMs===void 0:s.retryAfterMs!==void 0)&&(s.phase==="finalizing"?s.finalizingStep!==void 0:s.finalizingStep===void 0)&&(s.phase==="failed"?s.failure!==void 0:s.failure===void 0)&&(s.estimatedRemainingMs===void 0||s.phase==="indexing"));function B(s){const e=oe.safeParse(s);return e.success?e.data:null}function P(s){const e=typeof s=="number"&&Number.isFinite(s)?s:ne;return Math.min(F,Math.max(L,e))}function re(s){const e=s;return typeof e.rpcCode=="number"?e.rpcCode:typeof e.code=="number"?e.code:void 0}function q(s){if(!s||typeof s!="object"||re(s)!==N)return;const e=s.data??{},t=B(e.startup);if(e.code==="daemon-startup-failed"){const i=e.startup?.failure?.message,o=s.message;return{kind:"failed",message:typeof i=="string"&&i.trim()?i:typeof o=="string"?o:"",snapshot:t}}if(!(e.code!=="daemon-not-ready"||e.retryable!==!0))return{kind:"not-ready",retryAfterMs:P(e.retryAfterMs),snapshot:t}}function D(s){const e=s.snapshot??void 0;return s.state==="failed"?{code:N,message:"Daemon startup failed",data:{code:"daemon-startup-failed",retryable:!1,startup:e}}:{code:N,message:"Daemon not ready",data:{code:"daemon-not-ready",retryable:!0,retryAfterMs:P(e?.retryAfterMs),startup:e}}}const ae=5e3,ce=5e3,le=3e4;function he(s){const e=s.snapshot;return JSON.stringify([s.state,s.available,e?.attemptId,e?.phase,e?.finalizingStep,e?.progress?.completedNotes,e?.progress?.totalNotes,e?.estimatedRemainingMs===void 0,(e?.progressAgeMs??0)>=le])}class ue{constructor(e){n(this,"generation",0);n(this,"timer",null);n(this,"snapshot",null);n(this,"lastKey",null);n(this,"lastPublishedAt",0);this.host=e}start(e){this.stop(),this.snapshot=e.snapshot??this.snapshot,this.publish({state:"starting",snapshot:this.snapshot,available:e.snapshot!==null},!0),this.schedule(e.retryAfterMs)}stop(){this.generation++,this.timer&&(clearTimeout(this.timer),this.timer=null)}reset(){this.stop(),this.snapshot=null,this.lastKey=null,this.lastPublishedAt=0}publish(e,t=!1){const i=he(e),o=Date.now();!t&&i===this.lastKey&&o-this.lastPublishedAt<ce||(this.lastKey=i,this.lastPublishedAt=o,this.host.publish(e))}schedule(e){const t=this.generation;this.timer=setTimeout(()=>{if(this.timer=null,t!==this.generation)return;const i=()=>this.poll(t);this.host.track?this.host.track(i):i()},e)}async poll(e){let t;try{t=B(await this.host.request())}catch(i){if(e!==this.generation)return;const o=q(i);if(o?.kind==="failed"){this.stop(),this.host.fail(o.message,o.snapshot);return}if(o?.kind==="not-ready"){this.snapshot=o.snapshot??this.snapshot,this.publish({state:"starting",snapshot:this.snapshot,available:o.snapshot!==null}),this.schedule(o.retryAfterMs);return}this.unavailable();return}if(e===this.generation){if(t===null){this.unavailable();return}if(this.snapshot=t,t.phase==="failed"){this.stop(),this.host.fail(t.failure?.message??"",t);return}if(t.phase==="ready"){this.stop(),this.publish({state:"starting",snapshot:t,available:!0},!0),this.host.handoff(!0);return}this.publish({state:"starting",snapshot:t,available:!0}),this.schedule(P(t.retryAfterMs))}}unavailable(){this.stop(),this.publish({state:"starting",snapshot:this.snapshot,available:!1},!0),this.host.handoff(!1)}}function Pe(s=(()=>{const e=globalThis.__INTENT_RUNTIME_CONFIG__;return e?.intentdWsUrl!==void 0?e.intentdWsUrl:typeof process>"u"?void 0:""})()){if(typeof s!="string")return;const e=s.trim();if(!e)return;if(e.startsWith("/")&&!e.startsWith("//")&&!e.includes("\\")){const o=globalThis.location;if(o?.host&&(o.protocol==="http:"||o.protocol==="https:"))return`${o.protocol==="https:"?"wss:":"ws:"}//${o.host}${e}`;console.warn("[browser-websocket-transport] Ignoring same-origin WebSocket path without an HTTP page origin");return}let t;try{t=new URL(e)}catch{console.warn("[browser-websocket-transport] Ignoring browser WebSocket URL: expected ws:// or wss://");return}if(t.protocol!=="ws:"&&t.protocol!=="wss:"){console.warn("[browser-websocket-transport] Ignoring browser WebSocket URL: expected ws:// or wss://");return}const i=t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]";if(t.protocol==="ws:"&&!i){console.warn("[browser-websocket-transport] Ignoring insecure remote WebSocket URL: use wss://");return}return e}function de(s){try{const e=new URL(s);return e.username="",e.password="",e.search="",e.hash="",e.toString()}catch{return s.replace(/[?#].*$/,"").replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/]*@/i,"$1")}}const fe={[-32700]:"PARSE_ERROR",[-32600]:"INVALID_REQUEST",[-32601]:"METHOD_NOT_FOUND",[-32602]:"INVALID_PARAMS",[-32603]:"INTERNAL_ERROR"};function pe(s){const e=fe[s];return e||(s<=-32e3&&s>=-32099?"SERVER_ERROR":"UNKNOWN_ERROR")}function me(s){if(s&&typeof s=="object"&&"code"in s){const e=s.code;if(typeof e=="string"&&e.length>0)return e}}function O(s){const e=me(s.data)??pe(s.code),t=s.data&&typeof s.data=="object"?{...s.data,code:e}:typeof s.data=="string"&&s.data.length>0?{code:e,detail:s.data}:{code:e};return{code:e,message:s.message,data:t,rpcCode:s.code}}function E(s){if(s instanceof u)return s;const e=s instanceof Error?s.message:String(s);return new u({code:"TRANSPORT_ERROR",message:e,data:{code:"TRANSPORT_ERROR"}})}const ge=3e4,Re=1e3,ye=3e4,Se=1e4,be=5e3;class we{constructor(e){n(this,"url");n(this,"webSocketFactory");n(this,"requestTimeoutMs");n(this,"reconnectDelayMs");n(this,"maxReconnectDelayMs");n(this,"connectTimeoutMs");n(this,"socket",null);n(this,"connected",!1);n(this,"connecting",!1);n(this,"disposed",!1);n(this,"requestId",0);n(this,"currentReconnectDelay");n(this,"reconnectTimer",null);n(this,"connectTimer",null);n(this,"connectWaiters",[]);n(this,"clientId");n(this,"helloConfirmed",!1);n(this,"acknowledgedHello",null);n(this,"nodeCapabilities",null);n(this,"capabilityHelloGeneration",0);n(this,"reviewMonitoring");n(this,"reviewMonitoringRecipient");n(this,"reviewMonitoringEnabled",!1);n(this,"ordinaryHello",!1);n(this,"monitorRetry",null);n(this,"monitorRetirements",new Set);n(this,"monitorReady",new Set);n(this,"protocolVersion",null);n(this,"helloError",new u({code:"UNAVAILABLE",message:"client.hello has not completed on this connection"}));n(this,"pending",new Map);n(this,"hasBeenConnected",!1);n(this,"hasConnectionFailed",!1);n(this,"notificationHandlers",new Set);n(this,"reconnectedHandlers",new Set);n(this,"statusHandlers",new Set);n(this,"lastNotifiedStatus","disconnected");n(this,"startupState",null);n(this,"startupSocket",null);n(this,"startupPoller",new ue({request:()=>{const e=this.startupSocket;return e?this.requestOnSocket(se,void 0,{timeoutMs:ae},e):Promise.reject(this.startupRefusal())},publish:e=>this.updateStartup(e),handoff:e=>this.startupHandoff(e),fail:(e,t)=>this.failStartup(e,t)}));n(this,"startupHandlers",new Set);this.reviewMonitoringEnabled=v(e.reviewMonitoring),this.reviewMonitoringRecipient=v(e.reviewMonitoring)?e.reviewMonitoring:void 0,this.url=e.url,this.webSocketFactory=e.webSocketFactory??(t=>new WebSocket(t)),this.requestTimeoutMs=e.requestTimeoutMs??ge,this.reconnectDelayMs=e.reconnectDelayMs??Re,this.maxReconnectDelayMs=e.maxReconnectDelayMs??ye,this.connectTimeoutMs=e.connectTimeoutMs??Se,this.currentReconnectDelay=this.reconnectDelayMs}isAvailable(){return!this.disposed}async readPrincipal(){if(this.disposed)throw new u({code:"UNAVAILABLE",message:"Backend transport disposed"});const e=await this.ensureConnected(),t=this.capabilityHelloGeneration,i=structuredClone(this.acknowledgedHello),o=()=>!this.disposed&&this.connected&&this.socket===e&&this.capabilityHelloGeneration===t&&this.acknowledgedHello!==null;if(!o())throw this.helloError;const a=await this.requestOnSocket("principal.me",{},void 0,e);if(!o())throw new u({code:"UNAVAILABLE",message:"Principal discovery connection changed"});return{hello:i,principal:a}}async observeNodeCapabilities(){if(this.disposed)throw new u({code:"UNAVAILABLE",message:"Backend transport disposed"});const e=await this.ensureConnected();if(this.disposed||!this.connected||this.socket!==e)throw new u({code:"UNAVAILABLE",message:"Backend connection changed"});return{server:{capabilities:this.nodeCapabilities}}}onMonitorReconnected(e){this.monitorReady.add(e);const t=this.onReconnected(e);return()=>{this.monitorReady.delete(e),t()}}prMonitorBackendId(){return de(this.url)}async capturePrMonitorSession(e){const t=await this.ensureConnected(),i=this.capabilityHelloGeneration,o=()=>new u({code:"PR_MONITOR_SESSION_RETIRED",message:"Monitor connection unavailable"});let a,d=!1;const R=new Set,m=new Set,r=()=>{if(!d){d=!0,this.monitorRetirements.delete(r),a?.close();for(const l of R)l();R.clear()}},f=()=>!d&&!this.disposed&&this.connected&&this.helloConfirmed&&this.socket===t&&i===this.capabilityHelloGeneration,c=()=>f()&&(!a||a.current());if(!c())throw o();this.monitorRetirements.add(r);const g=v(this.reviewMonitoring);let M=g?"consumer-pending":"unsupported";if(g&&this.reviewMonitoringEnabled&&this.ordinaryHello&&this.clientId)try{if(a=new Y(this.webSocketFactory(this.url),this.clientId,Math.min(this.reviewMonitoringRecipient,this.reviewMonitoring),f,this.requestTimeoutMs,this.connectTimeoutMs,()=>{const l=f();r(),l&&this.scheduleMonitorRecovery(t,i)}),await a.ready,!c())throw o();M="supported"}catch(l){const p=f();throw r(),p&&this.scheduleMonitorRecovery(t,i),l}const y=(l,p)=>a?a.request(l,p):this.requestOnSocket(l,p,void 0,t);return{origin:{backendId:this.prMonitorBackendId(),sessionId:crypto.randomUUID(),workspaceId:e},support:M,onRetired(l){return c()?(R.add(l),()=>{R.delete(l)}):(l(),()=>{})},onNotification:l=>(a??this).onNotification(p=>{c()&&l(p)}),request:async(l,p)=>{if(!c()||M==="consumer-pending"||p.workspaceId!==e)throw o();const k=await y(l,p),h=l==="events.subscribe"?k?.subscriptionId:void 0;if(!c())throw h&&this.socket===t&&this.connected&&i===this.capabilityHelloGeneration&&y("events.unsubscribe",{workspaceId:e,subscriptionId:h}).catch(()=>{}),o();return h&&m.add(h),l==="events.unsubscribe"&&m.delete(String(p.subscriptionId)),k},release:async()=>{const l=c();r(),l&&!a&&await Promise.all([...m].map(p=>this.requestOnSocket("events.unsubscribe",{workspaceId:e,subscriptionId:p},void 0,t).catch(()=>{})))}}}request(e,t,i){return this.requestOnSocket(e,t,i)}requestOnSocket(e,t,i,o){if(i?.localMachine)return Promise.reject(new u({code:"UNAVAILABLE",message:"Local machine requests require the desktop bridge"}));if(this.disposed)return Promise.reject(new u({code:"UNAVAILABLE",message:"Backend transport disposed"}));if(!o&&this.startupState?.state==="starting")return Promise.reject(new u(O(D(this.startupState))));const a=++this.requestId,d=i?.timeoutMs,R=typeof d=="number"&&Number.isFinite(d)&&d>0?d:this.requestTimeoutMs;return new Promise((m,r)=>{let f=!1;const c=setTimeout(()=>{f=!0,this.pending.delete(a),r(new u({code:"TIMEOUT",message:`JSON-RPC request timed out: ${e}`,data:{code:"TIMEOUT"}}))},R),g=y=>{clearTimeout(c),r(E(y))},M=y=>{if(f)return;if(this.disposed||this.socket!==y){g(new u({code:"TRANSPORT_ERROR",message:"Connection replaced"}));return}if(e==="presence.update"&&!this.helloConfirmed){g(this.helloError);return}try{ee(e,t,this.protocolVersion)}catch(h){g(h);return}let l=e==="client.hello"&&this.clientId?{clientId:this.clientId,...t}:t;if(e==="client.hello"){const h={...l},S={...h.capabilities};Object.prototype.hasOwnProperty.call(S,"reviewMonitoring")&&(this.reviewMonitoringEnabled=this.reviewMonitoringRecipient!==void 0&&v(S.reviewMonitoring)),delete S.reviewMonitoring,delete h.connectionRole,h.capabilities!==void 0&&(h.capabilities=S),l=h}const p=JSON.stringify({jsonrpc:"2.0",id:a,method:e,params:l}),k=e==="client.hello"?++this.capabilityHelloGeneration:0;if(e==="client.hello"){this.helloConfirmed=!1,this.ordinaryHello=!1,this.clearMonitorRecovery(),this.nodeCapabilities=null,this.reviewMonitoring=void 0;for(const h of[...this.monitorRetirements])h();this.acknowledgedHello=null}this.pending.set(a,{method:e,timeout:c,resolve:h=>{if(e==="client.hello"&&this.socket===y&&k===this.capabilityHelloGeneration){const S=h?.clientId;if(typeof S=="string"&&S.length>0){const H=h.server?.capabilities;if(this.clientId=S,this.reviewMonitoring=H?.reviewMonitoring,this.ordinaryHello=h.connectionRole===void 0,this.acknowledgedHello=structuredClone(h),this.nodeCapabilities=Q(H),this.protocolVersion=z(h.protocolVersion),this.helloConfirmed=!0,this.connected)for(const W of this.monitorReady)W()}}m(h)},reject:r});try{y.send(p)}catch(h){clearTimeout(c),this.pending.delete(a),r(E(h))}};o?M(o):this.connected&&this.socket?M(this.socket):this.ensureConnected().then(M,g)})}async subscribe(e){return this.request("events.subscribe",e)}async unsubscribe(e,t){try{await this.request("events.unsubscribe",{subscriptionId:e,...t!==void 0?{workspaceId:t}:{}})}catch{}}onNotification(e){return this.notificationHandlers.add(e),()=>this.notificationHandlers.delete(e)}onReconnected(e){return this.reconnectedHandlers.add(e),()=>this.reconnectedHandlers.delete(e)}getConnectionStatus(){return this.connected?"connected":this.connecting?"connecting":"disconnected"}getStartupState(){return this.startupState}onStartupChange(e){return this.startupHandlers.add(e),()=>this.startupHandlers.delete(e)}onConnectionStatusChange(e){return this.statusHandlers.add(e),()=>this.statusHandlers.delete(e)}dispose(){if(this.disposed)return;this.disposed=!0,this.clearReconnect(),this.clearConnectTimer();const e=new u({code:"UNAVAILABLE",message:"Backend transport disposed"});this.failPending(e),this.failWaiters(e),this.teardownSocket(),this.connected=!1,this.connecting=!1,this.notifyStatusChange(),this.notificationHandlers.clear(),this.reconnectedHandlers.clear(),this.statusHandlers.clear(),this.startupHandlers.clear()}ensureConnected(){return this.connected&&this.socket?Promise.resolve(this.socket):new Promise((e,t)=>{this.connectWaiters.push({resolve:e,reject:t}),this.start()})}start(){this.disposed||this.socket||this.connecting||this.reconnectTimer||this.connect()}connect(){this.clearReconnect(),this.connecting=!0,this.notifyStatusChange();let e;try{e=this.webSocketFactory(this.url)}catch(t){this.connecting=!1,this.onConnectionFailure(E(t));return}this.socket=e,this.helloConfirmed=!1,this.connectTimer=setTimeout(()=>{this.connectTimer=null,!(this.socket!==e||this.connected)&&(this.connecting=!1,this.onConnectionFailure(new u({code:"TRANSPORT_ERROR",message:`WebSocket connect attempt timed out after ${this.connectTimeoutMs}ms`})))},this.connectTimeoutMs),e.onopen=()=>{this.socket===e&&this.onConnected(e)},e.onmessage=t=>{this.socket===e&&this.onMessage(t.data)},e.onerror=null,e.onclose=()=>{this.socket===e&&(this.connecting=!1,this.onConnectionFailure(new u({code:"TRANSPORT_ERROR",message:"WebSocket connection closed"})))}}onConnected(e){this.clearConnectTimer(),this.performHelloHandshake(e)}async performHelloHandshake(e){try{await this.requestOnSocket("client.hello",{},{timeoutMs:Math.min(this.requestTimeoutMs,be)},e)}catch(o){if(this.disposed||this.socket!==e)return;const a=q(o);if(a){this.enterStartup(e,a);return}this.helloError=E(o)}if(this.disposed||this.socket!==e)return;this.startupPoller.reset(),this.startupSocket=null;const t=this.startupState!==null;this.startupState=null,this.connecting=!1,this.connected=!0,this.currentReconnectDelay=this.reconnectDelayMs;const i=this.hasBeenConnected||this.hasConnectionFailed;if(this.hasBeenConnected=!0,this.hasConnectionFailed=!1,this.notifyStatusChange(),t)for(const o of[...this.startupHandlers])o(null);if(this.flushWaiters(e),i)for(const o of[...this.reconnectedHandlers])o()}onConnectionFailure(e){if(this.clearConnectTimer(),!this.disposed){if(this.startupSocket!==null&&this.startupSocket===this.socket){this.startupHandoff(!0);return}this.startupState?.state==="starting"&&(this.startupPoller.reset(),this.updateStartup(null)),this.hasConnectionFailed=!0,this.connected=!1,this.notifyStatusChange(),this.teardownSocket(),this.failPending(e),this.failWaiters(e),this.scheduleReconnect()}}notifyStatusChange(){const e=this.getConnectionStatus();if(e!==this.lastNotifiedStatus){this.lastNotifiedStatus=e;for(const t of[...this.statusHandlers])t(e)}}onMessage(e){if(typeof e!="string")return;let t;try{t=JSON.parse(e)}catch{console.warn("[browser-websocket-transport] Dropping unparseable frame");return}if(!t||typeof t!="object")return;const i=typeof t.method=="string",o=t.id!=null;if(i&&o){this.sendFrame({jsonrpc:"2.0",id:t.id,error:{code:-32601,message:`Method not found: ${String(t.method)}`}});return}if(o){const a=Number(t.id),d=this.pending.get(a);if(!d)return;this.pending.delete(a),clearTimeout(d.timeout),t.error?d.reject(new u(O(t.error))):d.resolve(t.result);return}if(i){const a={method:t.method,params:t.params};for(const d of[...this.notificationHandlers])d(a)}}sendFrame(e){try{this.socket?.send(JSON.stringify(e))}catch{}}scheduleReconnect(){if(this.disposed||this.reconnectTimer)return;const e=this.currentReconnectDelay;this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.currentReconnectDelay=Math.min(e*2,this.maxReconnectDelayMs),this.disposed||this.connect()},e)}clearReconnect(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}clearConnectTimer(){this.connectTimer&&(clearTimeout(this.connectTimer),this.connectTimer=null)}scheduleMonitorRecovery(e,t){this.monitorRetry||this.disposed||(this.monitorRetry=setTimeout(()=>{if(this.monitorRetry=null,!this.disposed&&this.connected&&this.socket===e&&this.capabilityHelloGeneration===t)for(const i of[...this.monitorReady])i()},this.reconnectDelayMs))}clearMonitorRecovery(){this.monitorRetry&&clearTimeout(this.monitorRetry),this.monitorRetry=null}teardownSocket(){this.startupPoller.stop(),this.startupSocket=null,this.reviewMonitoring=void 0,this.clearMonitorRecovery();for(const t of[...this.monitorRetirements])t();if(this.acknowledgedHello=null,this.nodeCapabilities=null,this.capabilityHelloGeneration+=1,this.protocolVersion=null,!this.socket)return;const e=this.socket;this.socket=null,e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}updateStartup(e){this.startupState=e?Object.freeze({...e}):null;for(const t of[...this.startupHandlers])t(this.startupState)}startupRefusal(){return this.startupState?new u(O(D(this.startupState))):new u({code:"TRANSPORT_ERROR",message:"WebSocket connection closed"})}enterStartup(e,t){if(this.hasConnectionFailed=!0,t.kind==="failed"){this.failStartup(t.message,t.snapshot);return}this.startupSocket=e,this.startupPoller.start(t),this.failWaiters(this.startupRefusal())}startupHandoff(e){const t=this.startupRefusal();if(this.teardownSocket(),this.failPending(t),this.disposed)return;this.connecting=!0,this.notifyStatusChange(),this.clearReconnect();let i=this.reconnectDelayMs;e?this.currentReconnectDelay=this.reconnectDelayMs:(i=this.currentReconnectDelay,this.currentReconnectDelay=Math.min(i*2,this.maxReconnectDelayMs)),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.disposed||this.connect()},i)}failStartup(e,t){this.startupPoller.stop(),this.startupSocket=null,this.hasConnectionFailed=!0,this.updateStartup({state:"failed",snapshot:t,available:t!==null,message:e}),this.connecting=!1,this.onConnectionFailure(this.startupRefusal())}failPending(e){for(const t of this.pending.values())clearTimeout(t.timeout),t.reject(e);this.pending.clear()}flushWaiters(e){const t=this.connectWaiters;this.connectWaiters=[];for(const i of t)i.resolve(e)}failWaiters(e){const t=this.connectWaiters;this.connectWaiters=[];for(const i of t)i.reject(e)}}function He(s){return new we(s)}let A=null;const I=new Set;function De(s){A=s;for(const e of[...I])e(s)}function Ue(){return A}function Le(s){return I.add(s),A&&s(A),()=>I.delete(s)}export{u as B,Oe as M,_e as P,Ie as R,Ae as a,Ce as b,He as c,Ne as d,Pe as e,v as f,Ue as g,Ee as i,Le as o,De as r,de as s};
@@ -1 +1 @@
1
- import{t as Ot,bo as R,bm as u,bw as Ft,b as Rt}from"./BEwMx-58.js";import{bs as Gt,bV as K,br as rt,bk as er,bj as tr,bH as r,a5 as c,aD as e,bS as n,bl as S,bA as l,b_ as g,bO as m,W as o,bn as Mt,aA as G,c9 as z,be as Ve,b$ as Be,aB as b,c5 as mt,ca as ft,a7 as Ue,ay as U,ai as rr,aj as ar,bf as sr}from"./3SdAC2_C.js";import{i as W}from"./Gpf-ce3t.js";import{I as or,g as Xe}from"./BZKoidWB.js";import{c as Ee}from"./BIGXb0qV.js";import{n as Oe,j as Ze,h as $t}from"./C4_TlGj0.js";import{f as Fe,c as gt,s as nr}from"./CyczJyMt.js";import{b as xt}from"./Dn334wJv.js";import{F as Te,cR as ir,au as lr,cK as bt,c$ as Pt,cd as cr}from"./DQEQvBuM.js";import{f as ye}from"./CESUeVmp.js";import"./Bl3Cuor0.js";import"./BCx2RJGr.js";import{M as nt}from"./DaYz5Oxb.js";import{M as dr}from"./CXCeVP0_.js";import{w as _e}from"./Dxv5pbru.js";import{h as Ct,i as Et,g as Tt,P as At}from"./Ah-onPNG.js";import{C as ht}from"./CrtOf2Rt.js";import{c as pr}from"./ChTqQfQN.js";import{A as ur}from"./DQGxxGZP.js";import"./LNBns0B-.js";import{f as vr}from"./CsY5Dftt.js";import{Jv as _r}from"./9xo585Vy.js";import{dS as mr}from"./DQdDAxOz.js";import{S as et,j as fr,a as jt}from"./IPb2sVOc.js";import{R as qe,c as it,m as gr,bE as tt}from"./3Tv2tBbo.js";import"./EfOpqeLT.js";var xr=b('<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>'),br=b('<div class="text-sm text-danger bg-danger-background/10 rounded-md p-3"> </div>'),hr=b('<div class="flex items-center gap-2 text-subtle"><!> <span class="text-sm"> </span></div>'),Sr=b('<div class="p-4 max-h-60 overflow-y-auto overscroll-contain"><!></div>'),wr=b('<div class="p-3 bg-muted/30"><div class="flex items-center justify-between mb-2"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span></div> <!></div> <p class="text-xs text-subtle mb-2"> </p> <div class="h-32 rounded border border-border overflow-hidden"><!></div></div>'),yr=b('<div class="flex flex-col bg-background border border-border rounded-lg overflow-hidden"><div class="flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span> <!></div> <div class="flex items-center gap-1"><!></div></div> <!> <!></div>');function St(He,P){if(new.target)return Ot({component:St,...He});Gt(P,!0);const at=pr("SetupScriptAgent");let Ae=R(P,"repoPath",7),Re=R(P,"onScriptGenerated",7),Ge=R(P,"onClose",7),Me=K(rt(crypto.randomUUID())),O=K(!1),ae=K(null),me=!1,ie=K(null);er(()=>{me=!0,C()}),tr(()=>{me=!1});async function le(){try{const v=mr.select(_r.state).find(E=>E.repositoryPath===Ae()||E.path===Ae()||E.worktreePath===Ae());return v?String(v.id):null}catch{return null}}async function C(){r(O,!0),r(ae,null),r(ie,null);try{const s=await le();if(!me)return;if(!s){r(ae,u.workspace_setupScriptAgent_noWorkspace_error(),!0),r(O,!1);return}const v=await vr.setupScripts.generate(s);if(!me)return;if(!v||!v.script){r(ae,u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1);return}r(ie,{name:v.projectType?u.workspace_setupScriptAgent_projectTypeSetup_label({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedSetup_label(),description:v.projectType?u.workspace_setupScriptAgent_generatedForProject_description({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedFromAnalysis_description(),content:v.script},!0),r(O,!1)}catch(s){if(at.error("Failed to generate setup script",s),!me)return;r(ae,s instanceof Error?s.message:u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1)}}function fe(s){Re()?.(s)}var ge={get repoPath(){return Ae()},set repoPath(s){Ae(s),G()},get onScriptGenerated(){return Re()},set onScriptGenerated(s){Re(s),G()},get onClose(){return Ge()},set onClose(s){Ge(s),G()},$set:Ft,$on:(s,v)=>Rt(P,s,v)},ce=yr(),xe=c(ce),be=c(xe),De=c(be);ur(De,{variant:"standard",get agentId(){return e(Me)}});var Le=n(De,2),je=S(Le,!0),he=n(Le,2);{var de=s=>{var v=xr();o(s,v)};W(he,s=>{e(O)&&s(de)})}l(be);var Y=n(be,2),ke=c(Y);{let s=z(()=>u.workspace_setupScriptAgent_close_ariaLabel());ye(ke,{variant:"ghost-light",size:"icon-sm",iconOnly:!0,get"aria-label"(){return e(s)},get onclick(){return Ge()},children:(v,E)=>{Te(v,{get icon(){return ir}})},$$slots:{default:!0}})}l(Y),l(xe);var $e=n(xe,2);{var Ie=s=>{var v=Sr(),E=c(v);{var q=B=>{var M=br(),Q=S(M,!0);g(()=>m(Q,e(ae))),o(B,M)},se=B=>{var M=hr(),Q=c(M);or(Q,{size:16,class:"text-primary"});var Se=n(Q,2),ze=S(Se,!0);l(M),g(we=>m(ze,we),[()=>u.workspace_setupScriptAgent_analyzing_label()]),o(B,M)};W(E,B=>{e(ae)?B(q):B(se,-1)})}l(v),o(s,v)};W($e,s=>{(e(ae)||e(O))&&s(Ie)})}var Je=n($e,2);{var pe=s=>{var v=wr(),E=c(v),q=c(E),se=c(q);Te(se,{get icon(){return lr},class:"text-green-500"});var B=n(se,2),M=S(B,!0);l(q);var Q=n(q,2);ye(Q,{variant:"primary",size:"sm",onclick:()=>fe(e(ie)),class:"h-7",children:(Pe,st)=>{Ve();var Ye=Be();g(ct=>m(Ye,ct),[()=>u.workspace_setupScriptAgent_createScript_label()]),o(Pe,Ye)},$$slots:{default:!0}}),l(E);var Se=n(E,2),ze=S(Se,!0),we=n(Se,2),lt=c(we);ht(lt,{get value(){return e(ie).content},language:"shell",readOnly:!0,lineNumbers:!1}),l(we),l(v),g(()=>{m(M,e(ie).name),m(ze,e(ie).description)}),o(s,v)};W(Je,s=>{e(ie)&&!e(O)&&s(pe)})}return l(ce),g(s=>m(je,s),[()=>u.workspace_setupScriptAgent_title()]),o(He,ce),Mt(ge)}var kr=b('<span class="block truncate"> </span>'),$r=b("<div></div>"),Pr=b('<div role="group"></div> <div class="mt-2 border-t border-border pt-2"><!></div> <!> <div class="mt-2 border-t border-border pt-2"><!> <!></div>',1),Cr=b('<code class="type-caption text-muted-foreground"> </code>'),Er=b('<p> </p> <code class="type-caption"> </code>',1),It=b("<!> <!>",1),Tr=b('<div class="mt-2 flex flex-wrap gap-2 px-2"></div>'),Ar=b('<div class="h-44 min-w-0 overflow-hidden rounded-(--radius-medium) border border-border bg-background py-2"><!></div> <div class="mt-2 px-1"><!> <!></div>',1),jr=b('<div class="mb-2 flex items-center justify-between gap-3 px-2"><div class="min-w-0"><h3> </h3> <p class="type-caption truncate text-muted-foreground"> </p></div> <!></div> <!>',1),Ke=b("<div><!></div>"),Ir=b("<!> ",1),Nt=b('<div class="min-w-0 w-full"><span class="text-sm"> </span> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Ut=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>'),Nr=b('<span class="type-caption px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium shrink-0"> </span>'),Ur=b('<div class="min-w-0 w-full"><div class="flex flex-wrap items-center gap-x-2 gap-y-1"><span class="text-sm"> </span> <!></div> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Or=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <p class="text-xs text-subtle px-2 mb-2"> </p> <!></div> <!> <!> <div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>',1),Fr=b('<code class="type-caption px-1.5 py-0.5 rounded bg-background/80 text-muted-foreground font-mono cursor-pointer hover:bg-background hover:text-foreground transition-colors"> </code>'),Rr=b('<p class="text-xs"> </p> <p class="mt-1 text-xs text-muted-foreground"> <code class="type-caption"> </code></p>',1),Gr=b('<div class="flex flex-wrap items-center gap-x-3 gap-y-1.5 px-3 py-1.5 bg-muted/30 shrink-0"><span class="type-caption font-medium text-muted-foreground shrink-0"> </span> <div class="flex flex-wrap gap-1.5"></div></div> <div class="flex-1 min-h-0 min-w-0 overflow-hidden py-3 bg-background"><!></div>',1),Mr=b('<div class="flex min-h-0 min-w-0 flex-col overflow-y-auto"><!></div> <div class="flex min-h-0 min-w-0 flex-col"><!></div>',1),Dr=b('<div class="flex flex-col min-h-0 min-w-0 overflow-y-auto p-2 md:pr-4"><!></div> <div class="flex flex-col min-w-0 min-h-0"><!></div>',1),Lr=b('<!> <span class="text-sm font-normal text-subtle"> </span> <span class="text-subtle font-normal"> </span>',1),zr=b('<div class="mt-1 pl-7 space-y-3"><!></div>'),Wr=b('<div class="space-y-3"><!></div>'),qr=b("<div><!> <!></div> <!>",1);function Kr(He,P){if(new.target)return Ot({component:Kr,...He});Gt(P,!0);const at=(t,a=sr)=>{{const y=_=>{Te(_,{get icon(){return bt},get class(){return _e.icon}})},j=_=>{var i=kr(),f=S(i,!0);g(()=>m(f,a().name)),o(_,i)},T=_=>{{let i=z(()=>e(st)===a().id?"checked":"empty");dr(_,{get state(){return e(i)}})}};let h=z(()=>e(st)===a().id),$=z(()=>e(st)===a().id);nt(t,{get selected(){return e(h)},get"aria-pressed"(){return e($)},get"data-setup-source"(){return a().id},get class(){return _e.row},onclick:()=>a().id==="custom"?Dt():we(a().id),leading:y,title:j,trailing:T,$$slots:{leading:!0,title:!0,trailing:!0}})}},Ae=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Pr(),_=U($);Xe(_,21,()=>e(Ye),I=>I.id,(I,F)=>{at(I,()=>e(F))}),l(_);var i=n(_,2),f=c(i);nt(f,{get"aria-expanded"(){return e($e)},get class(){return _e.row},onclick:()=>r($e,!e($e)),leading:w=>{Te(w,{get icon(){return cr},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptEditor_templates_label()]),o(w,d)},$$slots:{leading:!0,title:!0}}),l(i);var x=n(i,2);{var k=I=>{var F=$r();Xe(F,21,()=>e(ct),w=>w.id,(w,d)=>{at(w,()=>({id:`template-${e(d).id}`,name:e(d).name}))}),l(F),Oe(3,F,()=>Ze,()=>({tier:"moderate"})),o(I,F)};W(x,I=>{e($e)&&I(k)})}var D=n(x,2),ue=c(D);nt(ue,{get class(){return _e.row},onclick:()=>r(ke,!0),leading:w=>{Te(w,{get icon(){return bt},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptPicker_edit_label()]),o(w,d)},$$slots:{leading:!0,title:!0}});var ve=n(ue,2);{const I=d=>{Te(d,{get icon(){return Pt},get class(){return _e.icon}})},F=d=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(d,p)};let w=z(()=>!O());nt(ve,{get class(){return _e.row},get disabled(){return e(w)},onclick:()=>{r(ke,!0),r(Y,!0)},leading:I,title:F,$$slots:{leading:!0,title:!0}})}l(D),g(I=>nr(_,"aria-label",I),[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(h,$)},T=h=>{var $=jr(),_=U($),i=c(_),f=c(i),x=S(f,!0),k=n(f,2),D=S(k,!0);l(i);var ue=n(i,2);ye(ue,{variant:"ghost",size:"sm",onclick:()=>{r(ke,!1),r(Y,!1)},children:(w,d)=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptPicker_choose_label()]),o(w,p)},$$slots:{default:!0}}),l(_);var ve=n(_,2);{var I=w=>{St(w,{get repoPath(){return O()},onScriptGenerated:Lt,onClose:()=>r(Y,!1)})},F=w=>{var d=Ar(),p=U(d),N=c(p);xt(ht(N,{language:"shell",lineNumbers:!1,get lineWrapping(){return e(Se)},get value(){return C()},set value(A){C(A)}}),A=>r(pe,A,!0),()=>e(pe)),l(p);var X=n(p,2),H=c(X);ye(H,{variant:"ghost",size:"sm",get active(){return e(Ie)},get"aria-expanded"(){return e(Ie)},onclick:()=>r(Ie,!e(Ie)),children:(A,oe)=>{Ve();var L=Be();g(ee=>m(L,ee),[()=>u.workspace_setupScriptEditor_variables_label()]),o(A,L)},$$slots:{default:!0}});var V=n(H,2);{var Z=A=>{var oe=Ue(),L=U(oe);Ee(L,()=>At,(ee,te)=>{te(ee,{delayDuration:100,children:(ne,Ce)=>{var J=Tr();Xe(J,21,()=>jt,re=>re.name,(re,Ne)=>{var We=Ue(),pt=U(We);Ee(pt,()=>Ct,(Vt,Bt)=>{Bt(Vt,{children:(Ht,Vr)=>{var yt=It(),kt=U(yt);Ee(kt,()=>Et,(ut,vt)=>{vt(ut,{children:(_t,Yt)=>{var Qe=Cr(),ot=S(Qe);g(()=>m(ot,`$${e(Ne).name??""}`)),o(_t,Qe)},$$slots:{default:!0}})});var Jt=n(kt,2);Ee(Jt,()=>Tt,(ut,vt)=>{vt(ut,{side:"top",class:"max-w-xs",children:(_t,Yt)=>{var Qe=Er(),ot=U(Qe),Qt=S(ot,!0),Xt=n(ot,2),Zt=S(Xt,!0);g(()=>{m(Qt,e(Ne).description),m(Zt,e(Ne).example)}),o(_t,Qe)},$$slots:{default:!0}})}),o(Ht,yt)},$$slots:{default:!0}})}),o(re,We)}),l(J),o(ne,J)},$$slots:{default:!0}})}),o(A,oe)};W(V,A=>{e(Ie)&&A(Z)})}l(X),o(w,d)};W(ve,w=>{e(Y)&&O()?w(I):w(F,-1)})}g(w=>{Fe(f,1,gt(_e.title),"svelte-1yy464i"),m(x,w),m(D,e(ze))},[()=>u.workspace_setupScriptPicker_commands_label()]),o(h,$)};W(y,h=>{e(ke)?h(T,-1):h(j)})}l(a),xt(a,h=>r(Je,h),()=>e(Je)),g(()=>Fe(a,1,`${_e.rows} min-w-0`,"svelte-1yy464i")),o(t,a)},Re=t=>{var a=Or(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2),$=S(h,!0),_=n(h,2);{var i=d=>{var p=Ke(),N=c(p);St(N,{get repoPath(){return O()},onScriptGenerated:X=>{r(se,!0),r(s,""),C(X.content),r(E,X.name,!0),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())},onClose:()=>r(Y,!1)}),l(p),Oe(3,p,()=>Ze,()=>({tier:"moderate"})),o(d,p)},f=d=>{{let p=z(()=>!O());ye(d,{variant:"ghost",size:"sm",class:"w-full justify-start text-subtle",onclick:()=>r(Y,!0),get disabled(){return e(p)},children:(N,X)=>{var H=Ir(),V=U(H);Te(V,{get icon(){return Pt},class:"mr-1.5"});var Z=n(V);g(A=>m(Z,` ${A??""}`),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(N,H)},$$slots:{default:!0}})}};W(_,d=>{e(Y)&&O()?d(i):d(f,-1)})}l(y);var x=n(y,2);{var k=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===qe),Z=z(()=>e(s)===qe);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(qe),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(it,"repo-config"),()=>u.workspace_setupScriptEditor_repoConfig_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_repoConfig_label()]),o(d,p)};W(x,d=>{le()&&d(k)})}var D=n(x,2);{var ue=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===B),Z=z(()=>e(s)===B);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(B),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(e(M).name,e(M).nameSource),()=>u.workspace_setupScriptEditor_lastUsed_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_lastUsed_label()]),o(d,p)};W(D,d=>{e(M)&&d(ue)})}var ve=n(D,2),I=c(ve),F=S(I,!0),w=n(I,2);Xe(w,17,()=>et,d=>d.id,(d,p)=>{{let N=z(()=>e(s)===`template-${e(p).id}`),X=z(()=>e(s)===`template-${e(p).id}`);ye(d,{variant:"ghost",truncateLabel:!1,get active(){return e(N)},get"aria-pressed"(){return e(X)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(`template-${e(p).id}`),children:(H,V)=>{var Z=Ur(),A=c(Z),oe=c(A),L=S(oe,!0),ee=n(oe,2);{var te=J=>{var re=Nr(),Ne=S(re,!0);g(We=>m(Ne,We),[()=>u.workspace_setupScriptEditor_recommended_label()]),o(J,re)};W(ee,J=>{e(p).projectType===ie()&&J(te)})}l(A);var ne=n(A,2),Ce=S(ne,!0);l(Z),g(()=>{m(L,e(p).name),m(Ce,e(p).description)}),o(H,Z)},$$slots:{default:!0}})}}),l(ve),g((d,p,N)=>{m(T,d),m($,p),m(F,N)},[()=>u.workspace_setupScriptEditor_generate_label(),()=>u.workspace_setupScriptEditor_generate_description(),()=>u.workspace_setupScriptEditor_templates_label()]),o(t,a)},Ge=t=>{var a=Gr(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2);Xe(h,21,()=>jt,i=>i.name,(i,f)=>{var x=Ue(),k=U(x);Ee(k,()=>At,(D,ue)=>{ue(D,{delayDuration:100,children:(ve,I)=>{var F=Ue(),w=U(F);Ee(w,()=>Ct,(d,p)=>{p(d,{delayDuration:100,children:(N,X)=>{var H=It(),V=U(H);Ee(V,()=>Et,(A,oe)=>{oe(A,{children:(L,ee)=>{var te=Fr(),ne=S(te);g(()=>m(ne,`$${e(f).name??""}`)),o(L,te)},$$slots:{default:!0}})});var Z=n(V,2);Ee(Z,()=>Tt,(A,oe)=>{oe(A,{side:"bottom",class:"max-w-xs z-[200]",children:(L,ee)=>{var te=Rr(),ne=U(te),Ce=S(ne,!0),J=n(ne,2),re=c(J),Ne=n(re),We=S(Ne,!0);l(J),g(pt=>{m(Ce,e(f).description),m(re,`${pt??""} `),m(We,e(f).example)},[()=>u.workspace_setupScriptEditor_example_before()]),o(L,te)},$$slots:{default:!0}})}),o(N,H)},$$slots:{default:!0}})}),o(ve,F)},$$slots:{default:!0}})}),o(i,x)}),l(h),l(y);var $=n(y,2),_=c($);xt(ht(_,{language:"shell",lineNumbers:!0,get lineWrapping(){return e(Se)},get value(){return C()},set value(i){C(i)}}),i=>r(pe,i,!0),()=>e(pe)),l($),g(i=>m(T,i),[()=>u.workspace_setupScriptEditor_variables_label()]),ar("keydown",$,i=>{i.altKey&&i.key==="z"&&(i.preventDefault(),r(Se,!e(Se)))}),o(t,a)},Me=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Mr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),Oe(1,_,()=>$t,()=>({tier:"moderate",axis:"x",distance:-8})),Oe(1,f,()=>$t,()=>({tier:"moderate",axis:"x"})),o(h,$)},T=h=>{var $=Dr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),o(h,$)};W(y,h=>{he()==="workspace"?h(j):h(T,-1)})}l(a),g(()=>Fe(a,1,gt(he()==="workspace"?"setup-workspace-layout":"grid flex-1 min-h-0 min-w-0 grid-cols-1 grid-rows-[minmax(0,1fr)_minmax(0,2fr)] md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] md:grid-rows-1"),"svelte-1yy464i")),o(t,a)};let O=R(P,"repoPath",7,""),ae=R(P,"repositoryKey",7),me=R(P,"githubUrl",7,null),ie=R(P,"projectType",7,void 0),le=R(P,"repoConfigScript",7,null),C=R(P,"value",15,""),fe=R(P,"expanded",15,!1),ge=R(P,"scriptName",31,()=>rt(u.workspace_setupScriptEditor_custom_name())),ce=R(P,"scriptNameSource",15,"named"),xe=R(P,"isCustomScript",15,!1),be=R(P,"compact",7,!1),De=R(P,"triggerClass",7,""),Le=R(P,"contentOnly",7,!1),je=R(P,"contentClass",7,""),he=R(P,"presentation",7,"editor"),de=R(P,"onchange",7),Y=K(!1),ke=K(rt(mt(()=>xe()))),$e=K(!1),Ie=K(!1),Je=K(void 0),pe=K(void 0),s=K(""),v=K(!1),E=K(rt(ge())),q=K(rt(ce())),se=K(!1);const B="last-used",M=z(()=>{const t=ae()??O(),a=t?gr(t,me()):void 0;return a?.nameSource==="repo-config"?{...a,name:"Custom",nameSource:"custom"}:a}),Q=z(()=>{const t=new Map;return le()&&t.set(qe,{content:le(),label:it,source:"repo-config"}),e(M)&&t.set(B,{content:e(M).content,label:e(M).name,source:e(M).nameSource}),et.forEach(a=>{t.set(`template-${a.id}`,{content:fr(a),label:a.name,source:"named"})}),t});let Se=K(!0);const ze=z(()=>{if(e(v))return tt(e(E),e(q));if(!e(s))return u.workspace_setupScriptEditor_custom_name();const t=e(Q).get(e(s));return t?tt(t.label,t.source):u.workspace_setupScriptEditor_custom_name()});function we(t){r(s,t,!0),r(v,!1),r(se,!0);const a=e(Q).get(t);a&&(C(a.content),r(E,a.label,!0),r(q,a.source,!0),de()?.(C())),he()==="picker"?(r(ke,!1),r($e,!1),requestAnimationFrame(()=>e(Je)?.querySelector("[data-setup-source][aria-pressed=true]")?.focus())):requestAnimationFrame(()=>e(pe)?.focus())}function lt(t){if(e(s)&&e(s)!=="none"){const a=e(Q).get(e(s));a&&r(v,t!==a.content)}else t&&r(v,!0)}const Pe=(()=>{const t=et.find(a=>a.id==="generic");return t?`template-${t.id}`:""})(),st=z(()=>e(v)||!e(s)?"custom":e(s)),Ye=z(()=>{const t=[];le()&&t.push({id:qe,name:tt(it,"repo-config")}),e(M)&&t.push({id:B,name:u.workspace_setupScriptEditor_lastUsed_label()});for(const a of et){const y=`template-${a.id}`;(y===Pe||y===e(s))&&t.push({id:y,name:a.name})}return t.push({id:"custom",name:u.workspace_setupScriptPicker_custom_label()}),t}),ct=z(()=>et.filter(t=>!e(Ye).some(a=>a.id===`template-${t.id}`)));function Dt(){r(s,""),r(v,!0),r(E,"Custom"),r(q,"custom"),r(Y,!1),r(ke,!0),requestAnimationFrame(()=>e(pe)?.focus())}function Lt(t){r(se,!0),r(s,""),C(t.content),r(E,t.name,!0),r(q,"named"),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())}let dt=K(null);ft(()=>{const t=ae()??O();if(t===e(dt))return;const a=e(dt)===null&&(xe()||C().trim().length>0);if(r(dt,t,!0),a){mt(()=>{let T=!1;const h=C().trim();for(const[$,_]of e(Q).entries())if(h===_.content.trim()&&_.source===ce()&&_.label===ge()){r(s,$,!0),r(E,_.label,!0),r(q,_.source,!0),r(v,!1),T=!0;break}T||(r(v,!0),e(E)||(r(E,ge()||u.workspace_setupScriptEditor_custom_name(),!0),r(q,ge()?ce():"named",!0))),r(se,!0)});return}const y=!!le(),j=e(M);if(mt(()=>{if(r(v,!1),r(se,!0),y)r(s,qe,!0),r(E,it,!0),r(q,"repo-config");else if(j)r(s,B),r(E,j.name,!0),r(q,j.nameSource,!0);else if(Pe){r(s,Pe,!0);const T=e(Q).get(Pe);r(E,T?.label||u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}else r(E,u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}),y&&le())C(le()),de()?.(C());else if(j)C(j.content),de()?.(C());else if(Pe){const T=e(Q).get(Pe);T&&(C(T.content),de()?.(C()))}}),ft(()=>{if(e(se)){r(se,!1);return}C()!==void 0&&lt(C())}),ft(()=>{ge(e(E)),ce(e(q)),xe(e(v))});var zt={get repoPath(){return O()},set repoPath(t=""){O(t),G()},get repositoryKey(){return ae()},set repositoryKey(t){ae(t),G()},get githubUrl(){return me()},set githubUrl(t=null){me(t),G()},get projectType(){return ie()},set projectType(t=void 0){ie(t),G()},get repoConfigScript(){return le()},set repoConfigScript(t=null){le(t),G()},get value(){return C()},set value(t=""){C(t),G()},get expanded(){return fe()},set expanded(t=!1){fe(t),G()},get scriptName(){return ge()},set scriptName(t=u.workspace_setupScriptEditor_custom_name()){ge(t),G()},get scriptNameSource(){return ce()},set scriptNameSource(t="named"){ce(t),G()},get isCustomScript(){return xe()},set isCustomScript(t=!1){xe(t),G()},get compact(){return be()},set compact(t=!1){be(t),G()},get triggerClass(){return De()},set triggerClass(t=""){De(t),G()},get contentOnly(){return Le()},set contentOnly(t=!1){Le(t),G()},get contentClass(){return je()},set contentClass(t=""){je(t),G()},get presentation(){return he()},set presentation(t="editor"){he(t),G()},get onchange(){return de()},set onchange(t){de(t),G()},$set:Ft,$on:(t,a)=>Rt(P,t,a)},wt=Ue(),Wt=U(wt);{var qt=t=>{var a=Ue(),y=U(a);{var j=T=>{var h=Ue(),$=U(h);{var _=x=>{var k=Ke(),D=c(k);Ae(D),l(k),g(()=>Fe(k,1,`${je()??""} min-w-0`,"svelte-1yy464i")),o(x,k)},i=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex min-h-0 min-w-0 flex-1 flex-col`,"svelte-1yy464i")),o(x,k)},f=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex flex-col gap-3 flex-1 min-h-0 min-w-0`,"svelte-1yy464i")),Oe(3,k,()=>Ze,()=>({tier:"moderate"})),o(x,k)};W($,x=>{he()==="picker"?x(_):he()==="workspace"?x(i,1):x(f,-1)})}o(T,h)};W(y,T=>{fe()&&T(j)})}o(t,a)},Kt=t=>{var a=qr(),y=U(a),j=c(y);ye(j,{variant:"ghost",size:"sm",get class(){return`whitespace-nowrap hover:text-inherit! ${De()??""}`},onclick:()=>fe(!fe()),children:(i,f)=>{var x=Lr(),k=U(x);Te(k,{get icon(){return bt},size:"xs"});var D=n(k,2),ue=S(D,!0),ve=n(D,2),I=S(ve,!0);g(F=>{m(ue,F),m(I,e(ze))},[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(i,x)},$$slots:{default:!0}});var T=n(j,2);{var h=i=>{var f=zr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W(T,i=>{fe()&&!be()&&i(h)})}l(y);var $=n(y,2);{var _=i=>{var f=Wr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W($,i=>{fe()&&be()&&i(_)})}g(()=>Fe(y,1,gt(be()?"":"w-full"))),o(t,a)};W(Wt,t=>{Le()?t(qt):t(Kt,-1)})}return o(He,wt),Mt(zt)}rr(["keydown"]);export{Kr as default};
1
+ import{t as Ot,bo as R,bm as u,bw as Ft,b as Rt}from"./C0QTy0Sy.js";import{bs as Gt,bV as K,br as rt,bk as er,bj as tr,bH as r,a5 as c,aD as e,bS as n,bl as S,bA as l,b_ as g,bO as m,W as o,bn as Mt,aA as G,c9 as z,be as Ve,b$ as Be,aB as b,c5 as mt,ca as ft,a7 as Ue,ay as U,ai as rr,aj as ar,bf as sr}from"./3SdAC2_C.js";import{i as W}from"./bhKPSdq4.js";import{I as or,g as Xe}from"./B6S6VNu7.js";import{c as Ee}from"./CUkDMZwP.js";import{n as Oe,j as Ze,h as $t}from"./DLwWVKiF.js";import{f as Fe,c as gt,s as nr}from"./7UPrdiE9.js";import{b as xt}from"./Dn334wJv.js";import{F as Te,cR as ir,au as lr,cK as bt,c$ as Pt,cd as cr}from"./U9jJmfYa.js";import{f as ye}from"./FzlZUztb.js";import"./DCRuihKm.js";import"./QeBH-DWE.js";import{M as nt}from"./CFvBUo4R.js";import{M as dr}from"./CDjpuJh0.js";import{w as _e}from"./jn4zbMQy.js";import{h as Ct,i as Et,g as Tt,P as At}from"./BmTMWrby.js";import{C as ht}from"./DTuql3Rj.js";import{c as pr}from"./ChTqQfQN.js";import{A as ur}from"./wl2qP2wF.js";import"./CrD0jtXE.js";import{f as vr}from"./C6mS8uZB.js";import{Jv as _r}from"./tr-2J8Mf.js";import{dS as mr}from"./BaujsV9k.js";import{S as et,j as fr,a as jt}from"./DliHiH6M.js";import{R as qe,c as it,m as gr,bE as tt}from"./CE7VCun2.js";import"./p9X2tUBM.js";var xr=b('<div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>'),br=b('<div class="text-sm text-danger bg-danger-background/10 rounded-md p-3"> </div>'),hr=b('<div class="flex items-center gap-2 text-subtle"><!> <span class="text-sm"> </span></div>'),Sr=b('<div class="p-4 max-h-60 overflow-y-auto overscroll-contain"><!></div>'),wr=b('<div class="p-3 bg-muted/30"><div class="flex items-center justify-between mb-2"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span></div> <!></div> <p class="text-xs text-subtle mb-2"> </p> <div class="h-32 rounded border border-border overflow-hidden"><!></div></div>'),yr=b('<div class="flex flex-col bg-background border border-border rounded-lg overflow-hidden"><div class="flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30"><div class="flex items-center gap-2"><!> <span class="text-sm font-medium"> </span> <!></div> <div class="flex items-center gap-1"><!></div></div> <!> <!></div>');function St(He,P){if(new.target)return Ot({component:St,...He});Gt(P,!0);const at=pr("SetupScriptAgent");let Ae=R(P,"repoPath",7),Re=R(P,"onScriptGenerated",7),Ge=R(P,"onClose",7),Me=K(rt(crypto.randomUUID())),O=K(!1),ae=K(null),me=!1,ie=K(null);er(()=>{me=!0,C()}),tr(()=>{me=!1});async function le(){try{const v=mr.select(_r.state).find(E=>E.repositoryPath===Ae()||E.path===Ae()||E.worktreePath===Ae());return v?String(v.id):null}catch{return null}}async function C(){r(O,!0),r(ae,null),r(ie,null);try{const s=await le();if(!me)return;if(!s){r(ae,u.workspace_setupScriptAgent_noWorkspace_error(),!0),r(O,!1);return}const v=await vr.setupScripts.generate(s);if(!me)return;if(!v||!v.script){r(ae,u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1);return}r(ie,{name:v.projectType?u.workspace_setupScriptAgent_projectTypeSetup_label({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedSetup_label(),description:v.projectType?u.workspace_setupScriptAgent_generatedForProject_description({projectType:v.projectType}):u.workspace_setupScriptAgent_generatedFromAnalysis_description(),content:v.script},!0),r(O,!1)}catch(s){if(at.error("Failed to generate setup script",s),!me)return;r(ae,s instanceof Error?s.message:u.workspace_setupScriptAgent_generateFailed_error(),!0),r(O,!1)}}function fe(s){Re()?.(s)}var ge={get repoPath(){return Ae()},set repoPath(s){Ae(s),G()},get onScriptGenerated(){return Re()},set onScriptGenerated(s){Re(s),G()},get onClose(){return Ge()},set onClose(s){Ge(s),G()},$set:Ft,$on:(s,v)=>Rt(P,s,v)},ce=yr(),xe=c(ce),be=c(xe),De=c(be);ur(De,{variant:"standard",get agentId(){return e(Me)}});var Le=n(De,2),je=S(Le,!0),he=n(Le,2);{var de=s=>{var v=xr();o(s,v)};W(he,s=>{e(O)&&s(de)})}l(be);var Y=n(be,2),ke=c(Y);{let s=z(()=>u.workspace_setupScriptAgent_close_ariaLabel());ye(ke,{variant:"ghost-light",size:"icon-sm",iconOnly:!0,get"aria-label"(){return e(s)},get onclick(){return Ge()},children:(v,E)=>{Te(v,{get icon(){return ir}})},$$slots:{default:!0}})}l(Y),l(xe);var $e=n(xe,2);{var Ie=s=>{var v=Sr(),E=c(v);{var q=B=>{var M=br(),Q=S(M,!0);g(()=>m(Q,e(ae))),o(B,M)},se=B=>{var M=hr(),Q=c(M);or(Q,{size:16,class:"text-primary"});var Se=n(Q,2),ze=S(Se,!0);l(M),g(we=>m(ze,we),[()=>u.workspace_setupScriptAgent_analyzing_label()]),o(B,M)};W(E,B=>{e(ae)?B(q):B(se,-1)})}l(v),o(s,v)};W($e,s=>{(e(ae)||e(O))&&s(Ie)})}var Je=n($e,2);{var pe=s=>{var v=wr(),E=c(v),q=c(E),se=c(q);Te(se,{get icon(){return lr},class:"text-green-500"});var B=n(se,2),M=S(B,!0);l(q);var Q=n(q,2);ye(Q,{variant:"primary",size:"sm",onclick:()=>fe(e(ie)),class:"h-7",children:(Pe,st)=>{Ve();var Ye=Be();g(ct=>m(Ye,ct),[()=>u.workspace_setupScriptAgent_createScript_label()]),o(Pe,Ye)},$$slots:{default:!0}}),l(E);var Se=n(E,2),ze=S(Se,!0),we=n(Se,2),lt=c(we);ht(lt,{get value(){return e(ie).content},language:"shell",readOnly:!0,lineNumbers:!1}),l(we),l(v),g(()=>{m(M,e(ie).name),m(ze,e(ie).description)}),o(s,v)};W(Je,s=>{e(ie)&&!e(O)&&s(pe)})}return l(ce),g(s=>m(je,s),[()=>u.workspace_setupScriptAgent_title()]),o(He,ce),Mt(ge)}var kr=b('<span class="block truncate"> </span>'),$r=b("<div></div>"),Pr=b('<div role="group"></div> <div class="mt-2 border-t border-border pt-2"><!></div> <!> <div class="mt-2 border-t border-border pt-2"><!> <!></div>',1),Cr=b('<code class="type-caption text-muted-foreground"> </code>'),Er=b('<p> </p> <code class="type-caption"> </code>',1),It=b("<!> <!>",1),Tr=b('<div class="mt-2 flex flex-wrap gap-2 px-2"></div>'),Ar=b('<div class="h-44 min-w-0 overflow-hidden rounded-(--radius-medium) border border-border bg-background py-2"><!></div> <div class="mt-2 px-1"><!> <!></div>',1),jr=b('<div class="mb-2 flex items-center justify-between gap-3 px-2"><div class="min-w-0"><h3> </h3> <p class="type-caption truncate text-muted-foreground"> </p></div> <!></div> <!>',1),Ke=b("<div><!></div>"),Ir=b("<!> ",1),Nt=b('<div class="min-w-0 w-full"><span class="text-sm"> </span> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Ut=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>'),Nr=b('<span class="type-caption px-1.5 py-0.5 rounded-full bg-primary/10 text-primary font-medium shrink-0"> </span>'),Ur=b('<div class="min-w-0 w-full"><div class="flex flex-wrap items-center gap-x-2 gap-y-1"><span class="text-sm"> </span> <!></div> <p class="text-xs text-subtle mt-0.5"> </p></div>'),Or=b('<div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <p class="text-xs text-subtle px-2 mb-2"> </p> <!></div> <!> <!> <div class="mb-4"><h4 class="type-caption font-medium text-muted-foreground mb-1.5 px-2"> </h4> <!></div>',1),Fr=b('<code class="type-caption px-1.5 py-0.5 rounded bg-background/80 text-muted-foreground font-mono cursor-pointer hover:bg-background hover:text-foreground transition-colors"> </code>'),Rr=b('<p class="text-xs"> </p> <p class="mt-1 text-xs text-muted-foreground"> <code class="type-caption"> </code></p>',1),Gr=b('<div class="flex flex-wrap items-center gap-x-3 gap-y-1.5 px-3 py-1.5 bg-muted/30 shrink-0"><span class="type-caption font-medium text-muted-foreground shrink-0"> </span> <div class="flex flex-wrap gap-1.5"></div></div> <div class="flex-1 min-h-0 min-w-0 overflow-hidden py-3 bg-background"><!></div>',1),Mr=b('<div class="flex min-h-0 min-w-0 flex-col overflow-y-auto"><!></div> <div class="flex min-h-0 min-w-0 flex-col"><!></div>',1),Dr=b('<div class="flex flex-col min-h-0 min-w-0 overflow-y-auto p-2 md:pr-4"><!></div> <div class="flex flex-col min-w-0 min-h-0"><!></div>',1),Lr=b('<!> <span class="text-sm font-normal text-subtle"> </span> <span class="text-subtle font-normal"> </span>',1),zr=b('<div class="mt-1 pl-7 space-y-3"><!></div>'),Wr=b('<div class="space-y-3"><!></div>'),qr=b("<div><!> <!></div> <!>",1);function Kr(He,P){if(new.target)return Ot({component:Kr,...He});Gt(P,!0);const at=(t,a=sr)=>{{const y=_=>{Te(_,{get icon(){return bt},get class(){return _e.icon}})},j=_=>{var i=kr(),f=S(i,!0);g(()=>m(f,a().name)),o(_,i)},T=_=>{{let i=z(()=>e(st)===a().id?"checked":"empty");dr(_,{get state(){return e(i)}})}};let h=z(()=>e(st)===a().id),$=z(()=>e(st)===a().id);nt(t,{get selected(){return e(h)},get"aria-pressed"(){return e($)},get"data-setup-source"(){return a().id},get class(){return _e.row},onclick:()=>a().id==="custom"?Dt():we(a().id),leading:y,title:j,trailing:T,$$slots:{leading:!0,title:!0,trailing:!0}})}},Ae=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Pr(),_=U($);Xe(_,21,()=>e(Ye),I=>I.id,(I,F)=>{at(I,()=>e(F))}),l(_);var i=n(_,2),f=c(i);nt(f,{get"aria-expanded"(){return e($e)},get class(){return _e.row},onclick:()=>r($e,!e($e)),leading:w=>{Te(w,{get icon(){return cr},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptEditor_templates_label()]),o(w,d)},$$slots:{leading:!0,title:!0}}),l(i);var x=n(i,2);{var k=I=>{var F=$r();Xe(F,21,()=>e(ct),w=>w.id,(w,d)=>{at(w,()=>({id:`template-${e(d).id}`,name:e(d).name}))}),l(F),Oe(3,F,()=>Ze,()=>({tier:"moderate"})),o(I,F)};W(x,I=>{e($e)&&I(k)})}var D=n(x,2),ue=c(D);nt(ue,{get class(){return _e.row},onclick:()=>r(ke,!0),leading:w=>{Te(w,{get icon(){return bt},get class(){return _e.icon}})},title:w=>{Ve();var d=Be();g(p=>m(d,p),[()=>u.workspace_setupScriptPicker_edit_label()]),o(w,d)},$$slots:{leading:!0,title:!0}});var ve=n(ue,2);{const I=d=>{Te(d,{get icon(){return Pt},get class(){return _e.icon}})},F=d=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(d,p)};let w=z(()=>!O());nt(ve,{get class(){return _e.row},get disabled(){return e(w)},onclick:()=>{r(ke,!0),r(Y,!0)},leading:I,title:F,$$slots:{leading:!0,title:!0}})}l(D),g(I=>nr(_,"aria-label",I),[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(h,$)},T=h=>{var $=jr(),_=U($),i=c(_),f=c(i),x=S(f,!0),k=n(f,2),D=S(k,!0);l(i);var ue=n(i,2);ye(ue,{variant:"ghost",size:"sm",onclick:()=>{r(ke,!1),r(Y,!1)},children:(w,d)=>{Ve();var p=Be();g(N=>m(p,N),[()=>u.workspace_setupScriptPicker_choose_label()]),o(w,p)},$$slots:{default:!0}}),l(_);var ve=n(_,2);{var I=w=>{St(w,{get repoPath(){return O()},onScriptGenerated:Lt,onClose:()=>r(Y,!1)})},F=w=>{var d=Ar(),p=U(d),N=c(p);xt(ht(N,{language:"shell",lineNumbers:!1,get lineWrapping(){return e(Se)},get value(){return C()},set value(A){C(A)}}),A=>r(pe,A,!0),()=>e(pe)),l(p);var X=n(p,2),H=c(X);ye(H,{variant:"ghost",size:"sm",get active(){return e(Ie)},get"aria-expanded"(){return e(Ie)},onclick:()=>r(Ie,!e(Ie)),children:(A,oe)=>{Ve();var L=Be();g(ee=>m(L,ee),[()=>u.workspace_setupScriptEditor_variables_label()]),o(A,L)},$$slots:{default:!0}});var V=n(H,2);{var Z=A=>{var oe=Ue(),L=U(oe);Ee(L,()=>At,(ee,te)=>{te(ee,{delayDuration:100,children:(ne,Ce)=>{var J=Tr();Xe(J,21,()=>jt,re=>re.name,(re,Ne)=>{var We=Ue(),pt=U(We);Ee(pt,()=>Ct,(Vt,Bt)=>{Bt(Vt,{children:(Ht,Vr)=>{var yt=It(),kt=U(yt);Ee(kt,()=>Et,(ut,vt)=>{vt(ut,{children:(_t,Yt)=>{var Qe=Cr(),ot=S(Qe);g(()=>m(ot,`$${e(Ne).name??""}`)),o(_t,Qe)},$$slots:{default:!0}})});var Jt=n(kt,2);Ee(Jt,()=>Tt,(ut,vt)=>{vt(ut,{side:"top",class:"max-w-xs",children:(_t,Yt)=>{var Qe=Er(),ot=U(Qe),Qt=S(ot,!0),Xt=n(ot,2),Zt=S(Xt,!0);g(()=>{m(Qt,e(Ne).description),m(Zt,e(Ne).example)}),o(_t,Qe)},$$slots:{default:!0}})}),o(Ht,yt)},$$slots:{default:!0}})}),o(re,We)}),l(J),o(ne,J)},$$slots:{default:!0}})}),o(A,oe)};W(V,A=>{e(Ie)&&A(Z)})}l(X),o(w,d)};W(ve,w=>{e(Y)&&O()?w(I):w(F,-1)})}g(w=>{Fe(f,1,gt(_e.title),"svelte-1yy464i"),m(x,w),m(D,e(ze))},[()=>u.workspace_setupScriptPicker_commands_label()]),o(h,$)};W(y,h=>{e(ke)?h(T,-1):h(j)})}l(a),xt(a,h=>r(Je,h),()=>e(Je)),g(()=>Fe(a,1,`${_e.rows} min-w-0`,"svelte-1yy464i")),o(t,a)},Re=t=>{var a=Or(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2),$=S(h,!0),_=n(h,2);{var i=d=>{var p=Ke(),N=c(p);St(N,{get repoPath(){return O()},onScriptGenerated:X=>{r(se,!0),r(s,""),C(X.content),r(E,X.name,!0),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())},onClose:()=>r(Y,!1)}),l(p),Oe(3,p,()=>Ze,()=>({tier:"moderate"})),o(d,p)},f=d=>{{let p=z(()=>!O());ye(d,{variant:"ghost",size:"sm",class:"w-full justify-start text-subtle",onclick:()=>r(Y,!0),get disabled(){return e(p)},children:(N,X)=>{var H=Ir(),V=U(H);Te(V,{get icon(){return Pt},class:"mr-1.5"});var Z=n(V);g(A=>m(Z,` ${A??""}`),[()=>u.workspace_setupScriptEditor_autoGenerate_label()]),o(N,H)},$$slots:{default:!0}})}};W(_,d=>{e(Y)&&O()?d(i):d(f,-1)})}l(y);var x=n(y,2);{var k=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===qe),Z=z(()=>e(s)===qe);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(qe),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(it,"repo-config"),()=>u.workspace_setupScriptEditor_repoConfig_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_repoConfig_label()]),o(d,p)};W(x,d=>{le()&&d(k)})}var D=n(x,2);{var ue=d=>{var p=Ut(),N=c(p),X=S(N,!0),H=n(N,2);{let V=z(()=>e(s)===B),Z=z(()=>e(s)===B);ye(H,{variant:"ghost",truncateLabel:!1,get active(){return e(V)},get"aria-pressed"(){return e(Z)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(B),children:(A,oe)=>{var L=Nt(),ee=c(L),te=S(ee,!0),ne=n(ee,2),Ce=S(ne,!0);l(L),g((J,re)=>{m(te,J),m(Ce,re)},[()=>tt(e(M).name,e(M).nameSource),()=>u.workspace_setupScriptEditor_lastUsed_description()]),o(A,L)},$$slots:{default:!0}})}l(p),g(V=>m(X,V),[()=>u.workspace_setupScriptEditor_lastUsed_label()]),o(d,p)};W(D,d=>{e(M)&&d(ue)})}var ve=n(D,2),I=c(ve),F=S(I,!0),w=n(I,2);Xe(w,17,()=>et,d=>d.id,(d,p)=>{{let N=z(()=>e(s)===`template-${e(p).id}`),X=z(()=>e(s)===`template-${e(p).id}`);ye(d,{variant:"ghost",truncateLabel:!1,get active(){return e(N)},get"aria-pressed"(){return e(X)},class:"w-full h-auto justify-start whitespace-normal text-left px-2 py-1.5",onclick:()=>we(`template-${e(p).id}`),children:(H,V)=>{var Z=Ur(),A=c(Z),oe=c(A),L=S(oe,!0),ee=n(oe,2);{var te=J=>{var re=Nr(),Ne=S(re,!0);g(We=>m(Ne,We),[()=>u.workspace_setupScriptEditor_recommended_label()]),o(J,re)};W(ee,J=>{e(p).projectType===ie()&&J(te)})}l(A);var ne=n(A,2),Ce=S(ne,!0);l(Z),g(()=>{m(L,e(p).name),m(Ce,e(p).description)}),o(H,Z)},$$slots:{default:!0}})}}),l(ve),g((d,p,N)=>{m(T,d),m($,p),m(F,N)},[()=>u.workspace_setupScriptEditor_generate_label(),()=>u.workspace_setupScriptEditor_generate_description(),()=>u.workspace_setupScriptEditor_templates_label()]),o(t,a)},Ge=t=>{var a=Gr(),y=U(a),j=c(y),T=S(j,!0),h=n(j,2);Xe(h,21,()=>jt,i=>i.name,(i,f)=>{var x=Ue(),k=U(x);Ee(k,()=>At,(D,ue)=>{ue(D,{delayDuration:100,children:(ve,I)=>{var F=Ue(),w=U(F);Ee(w,()=>Ct,(d,p)=>{p(d,{delayDuration:100,children:(N,X)=>{var H=It(),V=U(H);Ee(V,()=>Et,(A,oe)=>{oe(A,{children:(L,ee)=>{var te=Fr(),ne=S(te);g(()=>m(ne,`$${e(f).name??""}`)),o(L,te)},$$slots:{default:!0}})});var Z=n(V,2);Ee(Z,()=>Tt,(A,oe)=>{oe(A,{side:"bottom",class:"max-w-xs z-[200]",children:(L,ee)=>{var te=Rr(),ne=U(te),Ce=S(ne,!0),J=n(ne,2),re=c(J),Ne=n(re),We=S(Ne,!0);l(J),g(pt=>{m(Ce,e(f).description),m(re,`${pt??""} `),m(We,e(f).example)},[()=>u.workspace_setupScriptEditor_example_before()]),o(L,te)},$$slots:{default:!0}})}),o(N,H)},$$slots:{default:!0}})}),o(ve,F)},$$slots:{default:!0}})}),o(i,x)}),l(h),l(y);var $=n(y,2),_=c($);xt(ht(_,{language:"shell",lineNumbers:!0,get lineWrapping(){return e(Se)},get value(){return C()},set value(i){C(i)}}),i=>r(pe,i,!0),()=>e(pe)),l($),g(i=>m(T,i),[()=>u.workspace_setupScriptEditor_variables_label()]),ar("keydown",$,i=>{i.altKey&&i.key==="z"&&(i.preventDefault(),r(Se,!e(Se)))}),o(t,a)},Me=t=>{var a=Ke(),y=c(a);{var j=h=>{var $=Mr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),Oe(1,_,()=>$t,()=>({tier:"moderate",axis:"x",distance:-8})),Oe(1,f,()=>$t,()=>({tier:"moderate",axis:"x"})),o(h,$)},T=h=>{var $=Dr(),_=U($),i=c(_);Re(i),l(_);var f=n(_,2),x=c(f);Ge(x),l(f),o(h,$)};W(y,h=>{he()==="workspace"?h(j):h(T,-1)})}l(a),g(()=>Fe(a,1,gt(he()==="workspace"?"setup-workspace-layout":"grid flex-1 min-h-0 min-w-0 grid-cols-1 grid-rows-[minmax(0,1fr)_minmax(0,2fr)] md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] md:grid-rows-1"),"svelte-1yy464i")),o(t,a)};let O=R(P,"repoPath",7,""),ae=R(P,"repositoryKey",7),me=R(P,"githubUrl",7,null),ie=R(P,"projectType",7,void 0),le=R(P,"repoConfigScript",7,null),C=R(P,"value",15,""),fe=R(P,"expanded",15,!1),ge=R(P,"scriptName",31,()=>rt(u.workspace_setupScriptEditor_custom_name())),ce=R(P,"scriptNameSource",15,"named"),xe=R(P,"isCustomScript",15,!1),be=R(P,"compact",7,!1),De=R(P,"triggerClass",7,""),Le=R(P,"contentOnly",7,!1),je=R(P,"contentClass",7,""),he=R(P,"presentation",7,"editor"),de=R(P,"onchange",7),Y=K(!1),ke=K(rt(mt(()=>xe()))),$e=K(!1),Ie=K(!1),Je=K(void 0),pe=K(void 0),s=K(""),v=K(!1),E=K(rt(ge())),q=K(rt(ce())),se=K(!1);const B="last-used",M=z(()=>{const t=ae()??O(),a=t?gr(t,me()):void 0;return a?.nameSource==="repo-config"?{...a,name:"Custom",nameSource:"custom"}:a}),Q=z(()=>{const t=new Map;return le()&&t.set(qe,{content:le(),label:it,source:"repo-config"}),e(M)&&t.set(B,{content:e(M).content,label:e(M).name,source:e(M).nameSource}),et.forEach(a=>{t.set(`template-${a.id}`,{content:fr(a),label:a.name,source:"named"})}),t});let Se=K(!0);const ze=z(()=>{if(e(v))return tt(e(E),e(q));if(!e(s))return u.workspace_setupScriptEditor_custom_name();const t=e(Q).get(e(s));return t?tt(t.label,t.source):u.workspace_setupScriptEditor_custom_name()});function we(t){r(s,t,!0),r(v,!1),r(se,!0);const a=e(Q).get(t);a&&(C(a.content),r(E,a.label,!0),r(q,a.source,!0),de()?.(C())),he()==="picker"?(r(ke,!1),r($e,!1),requestAnimationFrame(()=>e(Je)?.querySelector("[data-setup-source][aria-pressed=true]")?.focus())):requestAnimationFrame(()=>e(pe)?.focus())}function lt(t){if(e(s)&&e(s)!=="none"){const a=e(Q).get(e(s));a&&r(v,t!==a.content)}else t&&r(v,!0)}const Pe=(()=>{const t=et.find(a=>a.id==="generic");return t?`template-${t.id}`:""})(),st=z(()=>e(v)||!e(s)?"custom":e(s)),Ye=z(()=>{const t=[];le()&&t.push({id:qe,name:tt(it,"repo-config")}),e(M)&&t.push({id:B,name:u.workspace_setupScriptEditor_lastUsed_label()});for(const a of et){const y=`template-${a.id}`;(y===Pe||y===e(s))&&t.push({id:y,name:a.name})}return t.push({id:"custom",name:u.workspace_setupScriptPicker_custom_label()}),t}),ct=z(()=>et.filter(t=>!e(Ye).some(a=>a.id===`template-${t.id}`)));function Dt(){r(s,""),r(v,!0),r(E,"Custom"),r(q,"custom"),r(Y,!1),r(ke,!0),requestAnimationFrame(()=>e(pe)?.focus())}function Lt(t){r(se,!0),r(s,""),C(t.content),r(E,t.name,!0),r(q,"named"),r(v,!0),de()?.(C()),r(Y,!1),requestAnimationFrame(()=>e(pe)?.focus())}let dt=K(null);ft(()=>{const t=ae()??O();if(t===e(dt))return;const a=e(dt)===null&&(xe()||C().trim().length>0);if(r(dt,t,!0),a){mt(()=>{let T=!1;const h=C().trim();for(const[$,_]of e(Q).entries())if(h===_.content.trim()&&_.source===ce()&&_.label===ge()){r(s,$,!0),r(E,_.label,!0),r(q,_.source,!0),r(v,!1),T=!0;break}T||(r(v,!0),e(E)||(r(E,ge()||u.workspace_setupScriptEditor_custom_name(),!0),r(q,ge()?ce():"named",!0))),r(se,!0)});return}const y=!!le(),j=e(M);if(mt(()=>{if(r(v,!1),r(se,!0),y)r(s,qe,!0),r(E,it,!0),r(q,"repo-config");else if(j)r(s,B),r(E,j.name,!0),r(q,j.nameSource,!0);else if(Pe){r(s,Pe,!0);const T=e(Q).get(Pe);r(E,T?.label||u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}else r(E,u.workspace_setupScriptEditor_custom_name(),!0),r(q,"named")}),y&&le())C(le()),de()?.(C());else if(j)C(j.content),de()?.(C());else if(Pe){const T=e(Q).get(Pe);T&&(C(T.content),de()?.(C()))}}),ft(()=>{if(e(se)){r(se,!1);return}C()!==void 0&&lt(C())}),ft(()=>{ge(e(E)),ce(e(q)),xe(e(v))});var zt={get repoPath(){return O()},set repoPath(t=""){O(t),G()},get repositoryKey(){return ae()},set repositoryKey(t){ae(t),G()},get githubUrl(){return me()},set githubUrl(t=null){me(t),G()},get projectType(){return ie()},set projectType(t=void 0){ie(t),G()},get repoConfigScript(){return le()},set repoConfigScript(t=null){le(t),G()},get value(){return C()},set value(t=""){C(t),G()},get expanded(){return fe()},set expanded(t=!1){fe(t),G()},get scriptName(){return ge()},set scriptName(t=u.workspace_setupScriptEditor_custom_name()){ge(t),G()},get scriptNameSource(){return ce()},set scriptNameSource(t="named"){ce(t),G()},get isCustomScript(){return xe()},set isCustomScript(t=!1){xe(t),G()},get compact(){return be()},set compact(t=!1){be(t),G()},get triggerClass(){return De()},set triggerClass(t=""){De(t),G()},get contentOnly(){return Le()},set contentOnly(t=!1){Le(t),G()},get contentClass(){return je()},set contentClass(t=""){je(t),G()},get presentation(){return he()},set presentation(t="editor"){he(t),G()},get onchange(){return de()},set onchange(t){de(t),G()},$set:Ft,$on:(t,a)=>Rt(P,t,a)},wt=Ue(),Wt=U(wt);{var qt=t=>{var a=Ue(),y=U(a);{var j=T=>{var h=Ue(),$=U(h);{var _=x=>{var k=Ke(),D=c(k);Ae(D),l(k),g(()=>Fe(k,1,`${je()??""} min-w-0`,"svelte-1yy464i")),o(x,k)},i=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex min-h-0 min-w-0 flex-1 flex-col`,"svelte-1yy464i")),o(x,k)},f=x=>{var k=Ke(),D=c(k);Me(D),l(k),g(()=>Fe(k,1,`${je()??""} flex flex-col gap-3 flex-1 min-h-0 min-w-0`,"svelte-1yy464i")),Oe(3,k,()=>Ze,()=>({tier:"moderate"})),o(x,k)};W($,x=>{he()==="picker"?x(_):he()==="workspace"?x(i,1):x(f,-1)})}o(T,h)};W(y,T=>{fe()&&T(j)})}o(t,a)},Kt=t=>{var a=qr(),y=U(a),j=c(y);ye(j,{variant:"ghost",size:"sm",get class(){return`whitespace-nowrap hover:text-inherit! ${De()??""}`},onclick:()=>fe(!fe()),children:(i,f)=>{var x=Lr(),k=U(x);Te(k,{get icon(){return bt},size:"xs"});var D=n(k,2),ue=S(D,!0),ve=n(D,2),I=S(ve,!0);g(F=>{m(ue,F),m(I,e(ze))},[()=>u.workspace_setupScriptEditor_setupScript_label()]),o(i,x)},$$slots:{default:!0}});var T=n(j,2);{var h=i=>{var f=zr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W(T,i=>{fe()&&!be()&&i(h)})}l(y);var $=n(y,2);{var _=i=>{var f=Wr(),x=c(f);Me(x),l(f),Oe(3,f,()=>Ze,()=>({tier:"moderate"})),o(i,f)};W($,i=>{fe()&&be()&&i(_)})}g(()=>Fe(y,1,gt(be()?"":"w-full"))),o(t,a)};W(Wt,t=>{Le()?t(qt):t(Kt,-1)})}return o(He,wt),Mt(zt)}rr(["keydown"]);export{Kr as default};
@@ -1 +1 @@
1
- var g=Object.defineProperty;var v=(h,e,s)=>e in h?g(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s;var a=(h,e,s)=>v(h,typeof e!="symbol"?e+"":e,s);import{p as c}from"./C1Zw9RUp.js";import{applyCustomMonacoTheme as f,revertMonacoTheme as I}from"./dzRbajCR.js";import{d as y}from"./B0Z-1lwJ.js";import{Cp as r}from"./9xo585Vy.js";const u="custom-vscode-theme",l="theme-preset-id",d="theme-preset-set",o=typeof window<"u",n=class n{constructor(){a(this,"currentTheme","system");a(this,"fixedDarkAppearance",o&&["dock","dock-annotation","dock-capture-editor"].includes(document.documentElement.dataset.auxiliaryWindow??""));a(this,"mediaQuery",null);a(this,"customTheme",null);a(this,"presetDarkTheme",null);a(this,"presetLightTheme",null);a(this,"appliedCSSVariableKeys",[]);a(this,"activePresetId",null);a(this,"handleSystemThemeChange",()=>{this.currentTheme==="system"&&this.applyTheme()});o&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.loadTheme(),this.setupListeners())}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance?.dispose(),n.instance=null}loadTheme(){const e=r.getItem("theme");e&&(this.currentTheme=e),this.activePresetId=r.getItem(l);const s=r.getItem(d);if(s)try{const{dark:t,light:i}=JSON.parse(s);this.presetDarkTheme=c(t),this.presetLightTheme=c(i)}catch{r.removeItem(d),this.activePresetId=null,r.removeItem(l)}if(!this.presetDarkTheme){const t=r.getItem(u);if(t)try{const i=JSON.parse(t);this.customTheme=c(i)}catch{r.removeItem(u),this.activePresetId=null,r.removeItem(l)}}this.applyTheme()}setupListeners(){this.mediaQuery&&this.mediaQuery.addEventListener("change",this.handleSystemThemeChange)}dispose(){this.mediaQuery?.removeEventListener("change",this.handleSystemThemeChange),this.mediaQuery=null}setTheme(e,s={}){if(!o)return;const{persist:t=!0}=s;this.currentTheme=e,t&&r.setItem("theme",e),this.applyTheme()}getTheme(){return this.currentTheme}setCustomTheme(e){if(!o)return;const s=c(e);this.customTheme=s,this.activePresetId=null,this.presetDarkTheme=null,this.presetLightTheme=null,r.removeItem(l),r.removeItem(d),r.setJSON(u,e),this.applyTheme()}setPresetTheme(e,s,t){o&&(this.presetDarkTheme=c(s),this.presetLightTheme=c(t),this.activePresetId=e,this.customTheme=null,r.removeItem(u),r.setItem(l,e),r.setJSON(d,{dark:s,light:t}),this.applyTheme())}clearCustomTheme(){o&&(this.customTheme=null,this.presetDarkTheme=null,this.presetLightTheme=null,this.activePresetId=null,r.removeItem(u),r.removeItem(l),r.removeItem(d),this.removeCSSVariableOverrides(),this.applyTheme())}hasCustomTheme(){return this.getActiveTheme()!==null}getCustomThemeName(){return this.getActiveTheme()?.name??null}getActivePresetId(){return this.activePresetId}resolveIsDark(){if(this.fixedDarkAppearance)return!0;const e=this.mediaQuery?.matches??!1;return this.currentTheme==="system"?e:this.currentTheme==="dark"}getActiveTheme(){return this.presetDarkTheme&&this.presetLightTheme?this.resolveIsDark()?this.presetDarkTheme:this.presetLightTheme:this.fixedDarkAppearance&&this.customTheme?.type==="light"?null:this.customTheme}applyTheme(){if(!o)return;const e=document.documentElement,s=this.mediaQuery?.matches??!1,t=this.getActiveTheme(),i=this.isDark();e.classList.remove("dark","light"),e.classList.add(i?"dark":"light"),e.style.setProperty("color-scheme",i?"dark":"light"),t?this.applyCSSVariableOverrides(t.cssVariables):this.removeCSSVariableOverrides(),i&&!s&&!t?e.setAttribute("data-theme-override","true"):e.removeAttribute("data-theme-override");const p=document.querySelector('meta[name="theme-color"]');p&&p.setAttribute("content",i?"#0a0a0a":"#ffffff"),t?f(t.monacoTheme):I(i),y("theme-changed",{theme:this.currentTheme,isDark:i,customThemeName:t?.name??null,activePresetId:this.activePresetId,terminalColors:t?.terminalColors??null})}applyCSSVariableOverrides(e){const s=document.documentElement;this.removeCSSVariableOverrides();const t=[];for(const[i,T]of Object.entries(e))s.style.setProperty(i,T),t.push(i);this.appliedCSSVariableKeys=t}removeCSSVariableOverrides(){const e=document.documentElement;for(const s of this.appliedCSSVariableKeys)e.style.removeProperty(s);this.appliedCSSVariableKeys=[]}toggleTheme(){if(!o)return;const e=["light","dark","system"],t=(e.indexOf(this.currentTheme)+1)%e.length;this.setTheme(e[t])}isDark(){return this.fixedDarkAppearance?!0:this.customTheme?this.customTheme.type==="dark":this.resolveIsDark()}};a(n,"instance",null);let m=n;const E={setTheme:(...h)=>m.getInstance().setTheme(...h),getTheme:()=>m.getInstance().getTheme(),setCustomTheme:(...h)=>m.getInstance().setCustomTheme(...h),setPresetTheme:(...h)=>m.getInstance().setPresetTheme(...h),clearCustomTheme:()=>m.getInstance().clearCustomTheme(),hasCustomTheme:()=>m.getInstance().hasCustomTheme(),getCustomThemeName:()=>m.getInstance().getCustomThemeName(),getActivePresetId:()=>m.getInstance().getActivePresetId(),toggleTheme:()=>m.getInstance().toggleTheme(),isDark:()=>m.getInstance().isDark()};export{m as T,E as t};
1
+ var g=Object.defineProperty;var v=(h,e,s)=>e in h?g(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s;var a=(h,e,s)=>v(h,typeof e!="symbol"?e+"":e,s);import{p as c}from"./DXBEIeJu.js";import{applyCustomMonacoTheme as f,revertMonacoTheme as I}from"./BX-0SVP7.js";import{d as y}from"./B0Z-1lwJ.js";import{Cp as r}from"./tr-2J8Mf.js";const u="custom-vscode-theme",l="theme-preset-id",d="theme-preset-set",o=typeof window<"u",n=class n{constructor(){a(this,"currentTheme","system");a(this,"fixedDarkAppearance",o&&["dock","dock-annotation","dock-capture-editor"].includes(document.documentElement.dataset.auxiliaryWindow??""));a(this,"mediaQuery",null);a(this,"customTheme",null);a(this,"presetDarkTheme",null);a(this,"presetLightTheme",null);a(this,"appliedCSSVariableKeys",[]);a(this,"activePresetId",null);a(this,"handleSystemThemeChange",()=>{this.currentTheme==="system"&&this.applyTheme()});o&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.loadTheme(),this.setupListeners())}static getInstance(){return n.instance||(n.instance=new n),n.instance}static resetInstance(){n.instance?.dispose(),n.instance=null}loadTheme(){const e=r.getItem("theme");e&&(this.currentTheme=e),this.activePresetId=r.getItem(l);const s=r.getItem(d);if(s)try{const{dark:t,light:i}=JSON.parse(s);this.presetDarkTheme=c(t),this.presetLightTheme=c(i)}catch{r.removeItem(d),this.activePresetId=null,r.removeItem(l)}if(!this.presetDarkTheme){const t=r.getItem(u);if(t)try{const i=JSON.parse(t);this.customTheme=c(i)}catch{r.removeItem(u),this.activePresetId=null,r.removeItem(l)}}this.applyTheme()}setupListeners(){this.mediaQuery&&this.mediaQuery.addEventListener("change",this.handleSystemThemeChange)}dispose(){this.mediaQuery?.removeEventListener("change",this.handleSystemThemeChange),this.mediaQuery=null}setTheme(e,s={}){if(!o)return;const{persist:t=!0}=s;this.currentTheme=e,t&&r.setItem("theme",e),this.applyTheme()}getTheme(){return this.currentTheme}setCustomTheme(e){if(!o)return;const s=c(e);this.customTheme=s,this.activePresetId=null,this.presetDarkTheme=null,this.presetLightTheme=null,r.removeItem(l),r.removeItem(d),r.setJSON(u,e),this.applyTheme()}setPresetTheme(e,s,t){o&&(this.presetDarkTheme=c(s),this.presetLightTheme=c(t),this.activePresetId=e,this.customTheme=null,r.removeItem(u),r.setItem(l,e),r.setJSON(d,{dark:s,light:t}),this.applyTheme())}clearCustomTheme(){o&&(this.customTheme=null,this.presetDarkTheme=null,this.presetLightTheme=null,this.activePresetId=null,r.removeItem(u),r.removeItem(l),r.removeItem(d),this.removeCSSVariableOverrides(),this.applyTheme())}hasCustomTheme(){return this.getActiveTheme()!==null}getCustomThemeName(){return this.getActiveTheme()?.name??null}getActivePresetId(){return this.activePresetId}resolveIsDark(){if(this.fixedDarkAppearance)return!0;const e=this.mediaQuery?.matches??!1;return this.currentTheme==="system"?e:this.currentTheme==="dark"}getActiveTheme(){return this.presetDarkTheme&&this.presetLightTheme?this.resolveIsDark()?this.presetDarkTheme:this.presetLightTheme:this.fixedDarkAppearance&&this.customTheme?.type==="light"?null:this.customTheme}applyTheme(){if(!o)return;const e=document.documentElement,s=this.mediaQuery?.matches??!1,t=this.getActiveTheme(),i=this.isDark();e.classList.remove("dark","light"),e.classList.add(i?"dark":"light"),e.style.setProperty("color-scheme",i?"dark":"light"),t?this.applyCSSVariableOverrides(t.cssVariables):this.removeCSSVariableOverrides(),i&&!s&&!t?e.setAttribute("data-theme-override","true"):e.removeAttribute("data-theme-override");const p=document.querySelector('meta[name="theme-color"]');p&&p.setAttribute("content",i?"#0a0a0a":"#ffffff"),t?f(t.monacoTheme):I(i),y("theme-changed",{theme:this.currentTheme,isDark:i,customThemeName:t?.name??null,activePresetId:this.activePresetId,terminalColors:t?.terminalColors??null})}applyCSSVariableOverrides(e){const s=document.documentElement;this.removeCSSVariableOverrides();const t=[];for(const[i,T]of Object.entries(e))s.style.setProperty(i,T),t.push(i);this.appliedCSSVariableKeys=t}removeCSSVariableOverrides(){const e=document.documentElement;for(const s of this.appliedCSSVariableKeys)e.style.removeProperty(s);this.appliedCSSVariableKeys=[]}toggleTheme(){if(!o)return;const e=["light","dark","system"],t=(e.indexOf(this.currentTheme)+1)%e.length;this.setTheme(e[t])}isDark(){return this.fixedDarkAppearance?!0:this.customTheme?this.customTheme.type==="dark":this.resolveIsDark()}};a(n,"instance",null);let m=n;const E={setTheme:(...h)=>m.getInstance().setTheme(...h),getTheme:()=>m.getInstance().getTheme(),setCustomTheme:(...h)=>m.getInstance().setCustomTheme(...h),setPresetTheme:(...h)=>m.getInstance().setPresetTheme(...h),clearCustomTheme:()=>m.getInstance().clearCustomTheme(),hasCustomTheme:()=>m.getInstance().hasCustomTheme(),getCustomThemeName:()=>m.getInstance().getCustomThemeName(),getActivePresetId:()=>m.getInstance().getActivePresetId(),toggleTheme:()=>m.getInstance().toggleTheme(),isDark:()=>m.getInstance().isDark()};export{m as T,E as t};