zidane-gui 9.0.3 → 9.1.1

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 (283) hide show
  1. package/README.md +1 -1
  2. package/out/main/chunks/{dev-extension-D5os9z0A.js → dev-extension-CjcEOYly.js} +10 -9
  3. package/out/main/chunks/extension-watch-Bk_X4gTf.js +93 -0
  4. package/out/main/chunks/{history-pager-DUFgTrih.js → history-pager-B5iwhWqn.js} +44 -7
  5. package/out/main/chunks/idle-collect-ZgTY7fw2.js +33 -0
  6. package/out/main/chunks/{remote-hosts-DlvE2ELX.js → remote-hosts-DmiOiwKi.js} +41 -1
  7. package/out/main/chunks/{session-search-sql-BrNTuwjH.js → session-search-sql-BaBnjEgm.js} +4 -4
  8. package/out/main/chunks/{tool-results-sql-C0MqWcQc.js → tool-results-sql-CVleIS51.js} +1 -1
  9. package/out/main/chunks/transcript-sql-DfsO-a4Q.js +27 -0
  10. package/out/main/extension-worker.js +52 -0
  11. package/out/main/git-watch-worker.js +21 -0
  12. package/out/main/history-worker.js +6 -3
  13. package/out/main/index.js +7614 -4263
  14. package/out/main/session-search-worker.js +18 -13
  15. package/out/main/tool-results-worker.js +18 -13
  16. package/out/main/update-worker.js +6 -0
  17. package/out/main/usage-worker.js +4 -1
  18. package/out/preload/index.mjs +49 -6
  19. package/out/renderer/assets/2CHDFZHC-B7OS2WPy.js +76 -0
  20. package/out/renderer/assets/43YPWK3Q-C1KxyhBe.js +297 -0
  21. package/out/renderer/assets/45MVAN6X-uedsCyvs.js +227 -0
  22. package/out/renderer/assets/46GJKBLZ-DqRDtmyU.js +362 -0
  23. package/out/renderer/assets/5THPTBWS-2mBFupjU.js +21 -0
  24. package/out/renderer/assets/63WH7YNF-E23uJkxY.js +1519 -0
  25. package/out/renderer/assets/6DDU7VKX-BnYMT-fZ.js +139 -0
  26. package/out/renderer/assets/7WLXJQOR-C8MM6Bra.js +23 -0
  27. package/out/renderer/assets/CLQLV5VT-BsAy1F0L.js +1159 -0
  28. package/out/renderer/assets/CUSPXG5M-BndthcFo.js +233 -0
  29. package/out/renderer/assets/{CodeEditor-in2F3Rz-.js → CodeEditor-Bc2yVqNr.js} +404 -744
  30. package/out/renderer/assets/{ComposerEditor-DzKoxH6Z.js → ComposerEditor-B4wmjkXE.js} +6 -7
  31. package/out/renderer/assets/D3L7O4X2-LfFKkl0g.js +194 -0
  32. package/out/renderer/assets/D5TW5CPZ-BUXfpU2q.js +21 -0
  33. package/out/renderer/assets/DKTLEL5E-Dj3316cp.js +42 -0
  34. package/out/renderer/assets/{DiffsTab-Ceh4E5wW.js → DiffsTab-BHaJc7Ve.js} +43 -26
  35. package/out/renderer/assets/EGADTWYV-giCCF2cw.js +292 -0
  36. package/out/renderer/assets/EOJSJZXM-B9xc3U2A.js +1137 -0
  37. package/out/renderer/assets/{EditorWorkers-Bhv2OJRb.js → EditorWorkers-DABG5YG9.js} +9 -11
  38. package/out/renderer/assets/FTXIJQGB-BX14b7pN.js +13 -0
  39. package/out/renderer/assets/{FileIcon-CYgGSQ59.js → FileIcon-acads6Ac.js} +1 -1
  40. package/out/renderer/assets/{FilesTab-DESQMqGK.js → FilesTab-CyWw9vW2.js} +70 -28
  41. package/out/renderer/assets/G2OEIG6X-hZmo0wrY.js +519 -0
  42. package/out/renderer/assets/G3MDBVQH-qZ3yfAIw.js +25 -0
  43. package/out/renderer/assets/GXJ2T77W-Dx1MA_On.js +445 -0
  44. package/out/renderer/assets/HX3UMAK7-DcJt6NaE.js +177 -0
  45. package/out/renderer/assets/IU7WZTP6-BZMu2vL3.js +137 -0
  46. package/out/renderer/assets/J5J2NR2G-CbQLnnZq.js +673 -0
  47. package/out/renderer/assets/JRCWTJEL-xEOyWDIN.js +419 -0
  48. package/out/renderer/assets/KHUP5TOH-032p46g-.js +359 -0
  49. package/out/renderer/assets/L74FQTH5-CQ_54hNm.js +994 -0
  50. package/out/renderer/assets/LAV4ZXOS-DvhVMhLR.js +968 -0
  51. package/out/renderer/assets/LBIZYCRR-CMaDdulz.js +715 -0
  52. package/out/renderer/assets/LFFXNLRS-BjbqzBYN.js +377 -0
  53. package/out/renderer/assets/LLLWOAQD-B2zZRpRf.js +409 -0
  54. package/out/renderer/assets/LTYQZ5U5-DzI-7yJW.js +1223 -0
  55. package/out/renderer/assets/NDSCUZ25-C9oT6c6G.js +83 -0
  56. package/out/renderer/assets/NMN3IKWL-9IsXehWp.js +1042 -0
  57. package/out/renderer/assets/NMUA3R2D-B2ZuyfXA.js +1080 -0
  58. package/out/renderer/assets/NY5A6PPW-BzmvsXmE.js +523 -0
  59. package/out/renderer/assets/OHJ2EJXK-BEkFEoxu.js +85 -0
  60. package/out/renderer/assets/OU2GIT2H-DZQl_5qv.js +32 -0
  61. package/out/renderer/assets/PDMLSE6I-C3FMl6Ej.js +15 -0
  62. package/out/renderer/assets/PJ7X32S5-BQ3aTkUy.js +188 -0
  63. package/out/renderer/assets/RLLQ44NJ-Dq15CCQ6.js +248 -0
  64. package/out/renderer/assets/RVARI57O-DMrXgtoB.js +10 -0
  65. package/out/renderer/assets/S6DWMCK5-KeQNStMI.js +817 -0
  66. package/out/renderer/assets/STIOTUT7-ZnewWXB7.js +509 -0
  67. package/out/renderer/assets/SXSLPWUD-VIPmiOfk.js +120 -0
  68. package/out/renderer/assets/TR4WJQGX-CQ3dPMLJ.js +25 -0
  69. package/out/renderer/assets/UWRPUF3N-CtgKKvKe.js +1276 -0
  70. package/out/renderer/assets/VSWIZJ7B-BN-hZ_G_.js +205 -0
  71. package/out/renderer/assets/WM7NR6YK-CghasXna.js +193 -0
  72. package/out/renderer/assets/WXKV2YEK-C8qjO_OQ.js +499 -0
  73. package/out/renderer/assets/XLHPVVFU-CoRVO17g.js +56 -0
  74. package/out/renderer/assets/YNX532HU-DhZCm9iK.js +119 -0
  75. package/out/renderer/assets/YUPSMAUO-Brx2G_oh.js +39 -0
  76. package/out/renderer/assets/ZFRCZTLK-Cs8fJIgy.js +150 -0
  77. package/out/renderer/assets/ZZDR4CN3-DcTVOpcO.js +122 -0
  78. package/out/renderer/assets/andromeeda-Bx1G2cLE.js +293 -0
  79. package/out/renderer/assets/andromeeda-vBqMIOkk.js +293 -0
  80. package/out/renderer/assets/aurora-x-Cm7-xw-C.js +243 -0
  81. package/out/renderer/assets/aurora-x-DPl7s7lw.js +243 -0
  82. package/out/renderer/assets/ayu-dark-CwZzE4zG.js +207 -0
  83. package/out/renderer/assets/ayu-dark-DkHc-GR-.js +207 -0
  84. package/out/renderer/assets/ayu-light-D8NJUeg2.js +207 -0
  85. package/out/renderer/assets/ayu-light-DNVhSCsl.js +207 -0
  86. package/out/renderer/assets/ayu-mirage-C-lSBwzI.js +207 -0
  87. package/out/renderer/assets/ayu-mirage-JE49iZ2H.js +207 -0
  88. package/out/renderer/assets/catppuccin-frappe-DU1nAiyx.js +414 -0
  89. package/out/renderer/assets/catppuccin-frappe-DX6Q-ciL.js +414 -0
  90. package/out/renderer/assets/catppuccin-latte-CO9onEOF.js +414 -0
  91. package/out/renderer/assets/catppuccin-latte-CkSyOFfG.js +414 -0
  92. package/out/renderer/assets/catppuccin-macchiato-OyZDjojj.js +414 -0
  93. package/out/renderer/assets/catppuccin-macchiato-WINjU_Dw.js +414 -0
  94. package/out/renderer/assets/catppuccin-mocha-0z8-eFg0.js +414 -0
  95. package/out/renderer/assets/catppuccin-mocha-DRTSTdRR.js +414 -0
  96. package/out/renderer/assets/core-COuvbqNs.js +5186 -0
  97. package/out/renderer/assets/{highlight.worker-gURcNJD7.js → core-Drnj1qQL.js} +404 -4454
  98. package/out/renderer/assets/{core-xOIU6ifr.js → core-Z_paRVMb.js} +3208 -1946
  99. package/out/renderer/assets/dark-plus-BaggkchT.js +241 -0
  100. package/out/renderer/assets/dark-plus-Conw9IRY.js +241 -0
  101. package/out/renderer/assets/default-CzLFidVE.js +1890 -0
  102. package/out/renderer/assets/dracula-BKSZoV-6.js +227 -0
  103. package/out/renderer/assets/dracula-BpiXsqbq.js +227 -0
  104. package/out/renderer/assets/dracula-soft-BF0b4PXf.js +169 -0
  105. package/out/renderer/assets/dracula-soft-DIWOT7Wr.js +169 -0
  106. package/out/renderer/assets/engine-javascript-CtTomO8o.js +3238 -0
  107. package/out/renderer/assets/engine-javascript-DUvVq6Hk.js +3223 -0
  108. package/out/renderer/assets/engine-oniguruma-DKBWYAaE.js +482 -0
  109. package/out/renderer/assets/engine-oniguruma-mZf4aRKS.js +482 -0
  110. package/out/renderer/assets/everforest-dark-B3n4qCUZ.js +181 -0
  111. package/out/renderer/assets/everforest-dark-BXgth4bF.js +181 -0
  112. package/out/renderer/assets/everforest-light-BhaIwhYu.js +181 -0
  113. package/out/renderer/assets/everforest-light-cbpcbx0E.js +181 -0
  114. package/out/renderer/assets/{file-tabs-Cozt9Sho.js → file-tabs-BCf1cAWp.js} +10 -12
  115. package/out/renderer/assets/{ghostty-web-BTHoKwMc.js → ghostty-web-CdNv377h.js} +3 -1
  116. package/out/renderer/assets/github-dark-BESFF5XO.js +234 -0
  117. package/out/renderer/assets/github-dark-DNCSzN6m.js +234 -0
  118. package/out/renderer/assets/github-dark-default-DgFmzzcd.js +168 -0
  119. package/out/renderer/assets/github-dark-default-ffmDUf0z.js +168 -0
  120. package/out/renderer/assets/github-dark-dimmed-CLKTYZCg.js +225 -0
  121. package/out/renderer/assets/github-dark-dimmed-s1SLsKJt.js +225 -0
  122. package/out/renderer/assets/github-dark-high-contrast-CXehgwDU.js +225 -0
  123. package/out/renderer/assets/github-dark-high-contrast-KLlCEr3k.js +225 -0
  124. package/out/renderer/assets/github-light-U3PkvbB_.js +234 -0
  125. package/out/renderer/assets/github-light-default-BPzGUBgG.js +225 -0
  126. package/out/renderer/assets/github-light-default-xMLgS_bN.js +225 -0
  127. package/out/renderer/assets/github-light-high-contrast-C8D72_o0.js +225 -0
  128. package/out/renderer/assets/github-light-high-contrast-DQhuIFi9.js +225 -0
  129. package/out/renderer/assets/github-light-jtm9FPHO.js +234 -0
  130. package/out/renderer/assets/gruvbox-dark-hard-BAboCHnq.js +214 -0
  131. package/out/renderer/assets/gruvbox-dark-hard-woZR1aVf.js +214 -0
  132. package/out/renderer/assets/gruvbox-dark-medium-BsoEOmFF.js +214 -0
  133. package/out/renderer/assets/gruvbox-dark-medium-CNo7daJC.js +214 -0
  134. package/out/renderer/assets/gruvbox-dark-soft-CaJ_lf0b.js +214 -0
  135. package/out/renderer/assets/gruvbox-dark-soft-Cg271WAX.js +214 -0
  136. package/out/renderer/assets/gruvbox-light-hard-CEjA0x_J.js +214 -0
  137. package/out/renderer/assets/gruvbox-light-hard-D8Ufxp8E.js +214 -0
  138. package/out/renderer/assets/gruvbox-light-medium-BCS-MX7u.js +214 -0
  139. package/out/renderer/assets/gruvbox-light-medium-DZkNZdeM.js +214 -0
  140. package/out/renderer/assets/gruvbox-light-soft-CRdK2Ssn.js +214 -0
  141. package/out/renderer/assets/gruvbox-light-soft-DEEl98i-.js +214 -0
  142. package/out/renderer/assets/hastToHtml-AUrFnNH_.js +123 -0
  143. package/out/renderer/assets/highlight.worker-BYB12Fvh.js +1624 -0
  144. package/out/renderer/assets/highlights-Cjdp9LIq.js +292 -0
  145. package/out/renderer/assets/highlights-CpZm9DAR-DaBE50nC.js +2188 -0
  146. package/out/renderer/assets/highlights-DaYW35iB.js +313 -0
  147. package/out/renderer/assets/horizon-B492K9Ky.js +165 -0
  148. package/out/renderer/assets/horizon-DAZuC-xh.js +165 -0
  149. package/out/renderer/assets/horizon-bright-D2Sfzu7E.js +165 -0
  150. package/out/renderer/assets/horizon-bright-tGFWGsRc.js +165 -0
  151. package/out/renderer/assets/houston-BuwDhoUX.js +373 -0
  152. package/out/renderer/assets/houston-Cp9zzZds.js +373 -0
  153. package/out/renderer/assets/index-DhpOdP7M.js +882 -0
  154. package/out/renderer/assets/{index-DkE-xvCG.js → index-_dhRO6Oc.js} +1823 -384
  155. package/out/renderer/assets/{index-DrLLItLS.css → index-fNK5AY6Q.css} +202 -42
  156. package/out/renderer/assets/kanagawa-dragon-6NLBJhOz.js +229 -0
  157. package/out/renderer/assets/kanagawa-dragon-BF7rCHRT.js +229 -0
  158. package/out/renderer/assets/kanagawa-lotus-Cj8RDQcT.js +229 -0
  159. package/out/renderer/assets/kanagawa-lotus-uV7FMPcj.js +229 -0
  160. package/out/renderer/assets/kanagawa-wave-0rvDP1ei.js +229 -0
  161. package/out/renderer/assets/kanagawa-wave-B6IVm0GO.js +229 -0
  162. package/out/renderer/assets/{kit-BUt8oFlT.js → kit-E8-H6M0V.js} +45590 -39890
  163. package/out/renderer/assets/langs-BDUDFyts.js +1333 -0
  164. package/out/renderer/assets/langs-BtXnoosO.js +1331 -0
  165. package/out/renderer/assets/laserwave-DXWE1WnK.js +166 -0
  166. package/out/renderer/assets/laserwave-JLRBtymH.js +166 -0
  167. package/out/renderer/assets/lazy-DQmrNfMK.js +1188 -0
  168. package/out/renderer/assets/light-plus-DU2oMqtU.js +244 -0
  169. package/out/renderer/assets/light-plus-D_GZIzn-.js +244 -0
  170. package/out/renderer/assets/loader-byWkNl6P.js +83 -0
  171. package/out/renderer/assets/loader-q6EC19QI.js +80 -0
  172. package/out/renderer/assets/material-theme-C0rHRk_7.js +171 -0
  173. package/out/renderer/assets/material-theme-CKzpgSIj.js +171 -0
  174. package/out/renderer/assets/material-theme-darker-LxtgP-nI.js +171 -0
  175. package/out/renderer/assets/material-theme-darker-q1PJSGwC.js +171 -0
  176. package/out/renderer/assets/material-theme-lighter-Bo7q33GI.js +171 -0
  177. package/out/renderer/assets/material-theme-lighter-DIrXq_cm.js +171 -0
  178. package/out/renderer/assets/material-theme-ocean-DBoGA257.js +171 -0
  179. package/out/renderer/assets/material-theme-ocean-DKw0PiZ1.js +171 -0
  180. package/out/renderer/assets/material-theme-palenight-C6KqY_uf.js +171 -0
  181. package/out/renderer/assets/material-theme-palenight-DoLm5E7H.js +171 -0
  182. package/out/renderer/assets/min-dark-C29HEm34.js +166 -0
  183. package/out/renderer/assets/min-dark-C5zOB6s9.js +166 -0
  184. package/out/renderer/assets/min-light-BDAdB2zx.js +166 -0
  185. package/out/renderer/assets/min-light-CCfylF7u.js +166 -0
  186. package/out/renderer/assets/monokai-CgbJVDnk.js +246 -0
  187. package/out/renderer/assets/monokai-hi1UnAdE.js +246 -0
  188. package/out/renderer/assets/night-owl-Cy8ZrWil.js +238 -0
  189. package/out/renderer/assets/night-owl-Pfm14M0L.js +238 -0
  190. package/out/renderer/assets/night-owl-light-Cr6ug2dl.js +237 -0
  191. package/out/renderer/assets/night-owl-light-UewpB7JV.js +237 -0
  192. package/out/renderer/assets/nord-C68LX7oy.js +200 -0
  193. package/out/renderer/assets/nord-D68iK8nx.js +200 -0
  194. package/out/renderer/assets/one-dark-pro-DSih0ZZj.js +196 -0
  195. package/out/renderer/assets/one-dark-pro-DyTT0T_G.js +196 -0
  196. package/out/renderer/assets/one-light--fEa3idW.js +232 -0
  197. package/out/renderer/assets/one-light-BzGf0rQc.js +232 -0
  198. package/out/renderer/assets/{patch-parse.worker-BAW1QWyk.js → patch-parse.worker-siqPY9wG.js} +24 -4
  199. package/out/renderer/assets/pierre-dark-1Xh1-lMo.js +4 -0
  200. package/out/renderer/assets/pierre-dark-7z_hCG7W.js +364 -0
  201. package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-DjiH32kw.js +364 -0
  202. package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-GW6g2K_K.js +364 -0
  203. package/out/renderer/assets/pierre-dark-protanopia-deuteranopia-LDfpPKjm.js +4 -0
  204. package/out/renderer/assets/pierre-dark-soft-1iBHdNO0.js +364 -0
  205. package/out/renderer/assets/pierre-dark-soft-C_k_gt55.js +4 -0
  206. package/out/renderer/assets/pierre-dark-soft-D5-n1AeJ.js +364 -0
  207. package/out/renderer/assets/pierre-dark-tritanopia-CeWJyYfV.js +4 -0
  208. package/out/renderer/assets/pierre-dark-tritanopia-ClMvjOGO.js +364 -0
  209. package/out/renderer/assets/pierre-dark-tritanopia-D9kXXcwP.js +364 -0
  210. package/out/renderer/assets/pierre-dark-vibrant-6Oqz1PbM.js +4 -0
  211. package/out/renderer/assets/pierre-dark-vibrant-C8yH51pK.js +364 -0
  212. package/out/renderer/assets/pierre-dark-vibrant-D_7rJXbX.js +364 -0
  213. package/out/renderer/assets/pierre-dark-yHUcpElV.js +364 -0
  214. package/out/renderer/assets/pierre-light-BIebL0yQ.js +4 -0
  215. package/out/renderer/assets/pierre-light-C34x-mcs.js +364 -0
  216. package/out/renderer/assets/pierre-light-C9v4GAHb.js +364 -0
  217. package/out/renderer/assets/pierre-light-protanopia-deuteranopia-BufD2-1n.js +4 -0
  218. package/out/renderer/assets/pierre-light-protanopia-deuteranopia-DUrvpW2C.js +364 -0
  219. package/out/renderer/assets/pierre-light-protanopia-deuteranopia-VwXWNPo2.js +364 -0
  220. package/out/renderer/assets/pierre-light-soft-BmDnpPlM.js +364 -0
  221. package/out/renderer/assets/pierre-light-soft-Cd6v49hf.js +4 -0
  222. package/out/renderer/assets/pierre-light-soft-DqFh0kZA.js +364 -0
  223. package/out/renderer/assets/pierre-light-tritanopia-BVCfgdSF.js +364 -0
  224. package/out/renderer/assets/pierre-light-tritanopia-RkA2q6k9.js +364 -0
  225. package/out/renderer/assets/pierre-light-tritanopia-VrCUn-Lh.js +4 -0
  226. package/out/renderer/assets/pierre-light-vibrant-C5BaqWq3.js +364 -0
  227. package/out/renderer/assets/pierre-light-vibrant-CCrCMYrB.js +364 -0
  228. package/out/renderer/assets/pierre-light-vibrant-ClZHsQXl.js +4 -0
  229. package/out/renderer/assets/{pierre-theme-Bj5EAt1L.js → pierre-theme-CsyO3esE.js} +1022 -913
  230. package/out/renderer/assets/plastic-7t7HzasC.js +207 -0
  231. package/out/renderer/assets/plastic-EgWoj0TX.js +207 -0
  232. package/out/renderer/assets/poimandres-Clm3QHf_.js +186 -0
  233. package/out/renderer/assets/poimandres-_9ZL-zjP.js +186 -0
  234. package/out/renderer/assets/red-BGLMOAQA.js +240 -0
  235. package/out/renderer/assets/red-C7WxuK4s.js +240 -0
  236. package/out/renderer/assets/rose-pine-CSYOOLQH.js +200 -0
  237. package/out/renderer/assets/rose-pine-DQTixAK4.js +200 -0
  238. package/out/renderer/assets/rose-pine-dawn-BsExWFpO.js +200 -0
  239. package/out/renderer/assets/rose-pine-dawn-DtnCKB3V.js +200 -0
  240. package/out/renderer/assets/rose-pine-moon-CIVzFPCR.js +200 -0
  241. package/out/renderer/assets/rose-pine-moon-DUVYttUm.js +200 -0
  242. package/out/renderer/assets/shiki-Ci4cdHsM-C6d-uTVf.js +681 -0
  243. package/out/renderer/assets/shiki-DxXti3Bm.js +651 -0
  244. package/out/renderer/assets/slack-dark-DqfBLzDN.js +156 -0
  245. package/out/renderer/assets/slack-dark-PDVLPqBV.js +156 -0
  246. package/out/renderer/assets/slack-ochin-BXb20b9s.js +167 -0
  247. package/out/renderer/assets/slack-ochin-Bkl8Akj-.js +167 -0
  248. package/out/renderer/assets/snazzy-light-B-XgRQqH.js +169 -0
  249. package/out/renderer/assets/snazzy-light-B_Pnr_t3.js +169 -0
  250. package/out/renderer/assets/solarized-dark-BExlwCgF.js +256 -0
  251. package/out/renderer/assets/solarized-dark-BWOkBqBk.js +256 -0
  252. package/out/renderer/assets/solarized-light-B0LC-9ef.js +256 -0
  253. package/out/renderer/assets/solarized-light-B7xKmc3j.js +256 -0
  254. package/out/renderer/assets/stream-tokenizer-DK9xp5M5-BkzgPytU.js +2641 -0
  255. package/out/renderer/assets/stream-tokenizer-sqhinrU5.js +131 -0
  256. package/out/renderer/assets/synthwave-84-Bz5LYLQI.js +766 -0
  257. package/out/renderer/assets/synthwave-84-DnB997dV.js +766 -0
  258. package/out/renderer/assets/themes-DGY5d--g.js +323 -0
  259. package/out/renderer/assets/themes-KOxcu5sY.js +322 -0
  260. package/out/renderer/assets/tokyo-night-BFQDXQF9.js +343 -0
  261. package/out/renderer/assets/tokyo-night-BKV2xFQO.js +343 -0
  262. package/out/renderer/assets/{useDetachCleanup-Bb7k1ePf.js → useDetachCleanup-DYbCqwX-.js} +95 -51
  263. package/out/renderer/assets/{useFolderChanges-B4X4n6NV.js → useFolderChanges-Y0OqX_nG.js} +406 -242
  264. package/out/renderer/assets/utils-BcG7Lqcy.js +90 -0
  265. package/out/renderer/assets/{vendor-BvslLX9q.js → vendor-BpwX-s_O.js} +16835 -16799
  266. package/out/renderer/assets/{vendor-editor-Bx3dRdBD.js → vendor-editor-Cx3SvGyZ.js} +2 -2
  267. package/out/renderer/assets/{vendor-motion-BLeNAEjH.js → vendor-motion-CD5Og8pC.js} +3 -3
  268. package/out/renderer/assets/{vendor-react-DltKc0Ts.js → vendor-react-bPTwWURR.js} +28 -12
  269. package/out/renderer/assets/vesper-BVtJs6jF.js +173 -0
  270. package/out/renderer/assets/vesper-BXSaHQeX.js +173 -0
  271. package/out/renderer/assets/vitesse-black-Bk4nGSr_.js +388 -0
  272. package/out/renderer/assets/vitesse-black-DjBh7jMr.js +388 -0
  273. package/out/renderer/assets/vitesse-dark-BSeRY0TR.js +388 -0
  274. package/out/renderer/assets/vitesse-dark-Czy_Ejt3.js +388 -0
  275. package/out/renderer/assets/vitesse-light-BpMpGmeY.js +388 -0
  276. package/out/renderer/assets/vitesse-light-Cv09MZGR.js +388 -0
  277. package/out/renderer/assets/worker-CswOd5_T.js +2367 -0
  278. package/out/renderer/index.html +8 -9
  279. package/package.json +13 -6
  280. package/out/main/chunks/transcript-sql-DbZ-a5wb.js +0 -43
  281. package/out/renderer/assets/index-DogoEzwx.js +0 -10868
  282. package/out/renderer/assets/vendor-shiki-ba8IDo5s.js +0 -459
  283. package/out/renderer/assets/worker-DNIQ0wG8.js +0 -12761
@@ -1,6 +1,6 @@
1
- import { _ as __vitePreload } from "./vendor-shiki-ba8IDo5s.js";
2
- import { b as bundledLanguages, n as normalizeTheme, c as createHighlighter, a as createOnigurumaEngine, d as createJavaScriptRegexEngine } from "./index-DogoEzwx.js";
3
- import { g as getDefaultExportFromCjs, r as reactExports, j as jsxRuntimeExports } from "./vendor-react-DltKc0Ts.js";
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./loader-byWkNl6P.js","./core-Z_paRVMb.js","./vendor-BpwX-s_O.js","./vendor-react-bPTwWURR.js","./vendor-D_E2rLzO.css","./themes-DGY5d--g.js","./core-Drnj1qQL.js","./index-DhpOdP7M.js","./highlights-DaYW35iB.js","./stream-tokenizer-sqhinrU5.js","./hastToHtml-AUrFnNH_.js","./default-CzLFidVE.js","./shiki-DxXti3Bm.js","./utils-BcG7Lqcy.js","./langs-BDUDFyts.js"])))=>i.map(i=>d[i]);
2
+ import { _ as __vitePreload } from "./core-Z_paRVMb.js";
3
+ import { g as getDefaultExportFromCjs, r as reactExports, j as jsxRuntimeExports } from "./vendor-react-bPTwWURR.js";
4
4
  const DIFFS_TAG_NAME = "diffs-container";
5
5
  (() => {
6
6
  try {
@@ -46,71 +46,43 @@ const DEFAULT_RENDER_RANGE = {
46
46
  bufferBefore: 0,
47
47
  bufferAfter: 0
48
48
  };
49
+ const EMPTY_LINE_ANNOTATIONS = Object.freeze([]);
49
50
  const EMPTY_RENDER_RANGE = {
50
51
  startingLine: 0,
51
52
  totalLines: 0,
52
53
  bufferBefore: 0,
53
54
  bufferAfter: 0
54
55
  };
55
- const ResolvedLanguages = /* @__PURE__ */ new Map();
56
- const ResolvingLanguages = /* @__PURE__ */ new Map();
57
- const RegisteredCustomLanguages = /* @__PURE__ */ new Map();
58
- const AttachedLanguages = /* @__PURE__ */ new Set();
59
- function areLanguagesAttached(languages) {
60
- for (const language of Array.isArray(languages) ? languages : [languages]) {
61
- if (language === "text" || language === "ansi") continue;
62
- if (!AttachedLanguages.has(language)) return false;
56
+ let activeType;
57
+ let holds = 0;
58
+ var HighlighterDisposedError = class extends Error {
59
+ constructor() {
60
+ super("Highlighter is disposed");
61
+ this.name = "HighlighterDisposedError";
63
62
  }
64
- return true;
63
+ };
64
+ function getHighlighterType() {
65
+ return activeType;
65
66
  }
66
- function attachResolvedLanguages(resolvedLanguages, highlighter2) {
67
- resolvedLanguages = Array.isArray(resolvedLanguages) ? resolvedLanguages : [resolvedLanguages];
68
- for (const resolvedLang of resolvedLanguages) {
69
- if (AttachedLanguages.has(resolvedLang.name)) continue;
70
- let lang = ResolvedLanguages.get(resolvedLang.name);
71
- if (lang == null) {
72
- lang = resolvedLang;
73
- ResolvedLanguages.set(resolvedLang.name, lang);
74
- }
75
- const grammar = lang.data.find((grammar2) => grammar2.name === lang.name || grammar2.aliases?.includes(lang.name) === true);
76
- if (grammar == null) throw new Error(`attachResolvedLanguages: No returned grammar declares "${lang.name}" as its name or an alias.`);
77
- highlighter2.loadLanguageSync(lang.data);
78
- try {
79
- highlighter2.getLanguage(lang.name);
80
- } catch {
81
- throw new Error(`attachResolvedLanguages: "${grammar.name}" is already loaded without alias "${lang.name}". Load the alias first or give the grammar a unique name.`);
82
- }
83
- AttachedLanguages.add(lang.name);
84
- }
67
+ function resolveHighlighterType(type) {
68
+ return type ?? activeType ?? "shiki-js";
85
69
  }
86
- function isWorkerContext() {
87
- return typeof WorkerGlobalScope !== "undefined" && typeof self !== "undefined" && self instanceof WorkerGlobalScope;
70
+ function assertHighlighterType(type) {
71
+ if (activeType != null && activeType !== type) throw new Error(`Cannot load the "${type}" highlighter while "${activeType}" is in use. Only one highlighter type can be active at a time; dispose every "${activeType}" instance (disposeHighlighter() disposes the shared one) before switching.`);
88
72
  }
89
- async function resolveLanguage(lang) {
90
- if (isWorkerContext()) throw new Error(`resolveLanguage("${lang}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);
91
- const resolver = ResolvingLanguages.get(lang);
92
- if (resolver != null) return resolver;
93
- try {
94
- let loader = RegisteredCustomLanguages.get(lang);
95
- if (loader == null && Object.prototype.hasOwnProperty.call(bundledLanguages, lang)) loader = bundledLanguages[lang];
96
- if (loader == null) throw new Error(`resolveLanguage: "${lang}" not found in bundled or custom languages`);
97
- const resolver2 = loader().then(({ default: data }) => {
98
- const resolvedLang = {
99
- name: lang,
100
- data
101
- };
102
- if (!ResolvedLanguages.has(lang)) ResolvedLanguages.set(lang, resolvedLang);
103
- return resolvedLang;
104
- });
105
- ResolvingLanguages.set(lang, resolver2);
106
- return await resolver2;
107
- } finally {
108
- ResolvingLanguages.delete(lang);
109
- }
73
+ function acquireHighlighterType(type) {
74
+ assertHighlighterType(type);
75
+ activeType = type;
76
+ holds++;
110
77
  }
111
- function getResolvedOrResolveLanguage(language) {
112
- return ResolvedLanguages.get(language) ?? resolveLanguage(language);
78
+ function releaseHighlighterType() {
79
+ holds--;
80
+ if (holds === 0) activeType = void 0;
113
81
  }
82
+ const ResolvedLanguages = /* @__PURE__ */ new Map();
83
+ const ResolvingLanguages = /* @__PURE__ */ new Map();
84
+ const RegisteredCustomLanguages = /* @__PURE__ */ new Map();
85
+ const AttachedLanguages = /* @__PURE__ */ new Set();
114
86
  function getThemes(theme = DEFAULT_THEMES) {
115
87
  const themesArr = [];
116
88
  if (typeof theme === "string") themesArr.push(theme);
@@ -120,99 +92,18 @@ function getThemes(theme = DEFAULT_THEMES) {
120
92
  }
121
93
  return themesArr;
122
94
  }
123
- const AttachedThemes = /* @__PURE__ */ new Set();
124
- function areThemesAttached(themes) {
125
- for (const theme of getThemes(themes)) if (!AttachedThemes.has(theme)) return false;
126
- return true;
127
- }
128
- function createThemeCollection(options) {
129
- const descriptors = [];
130
- const seen = /* @__PURE__ */ new Set();
131
- for (const entry of getCollectionEntries(options.themes)) {
132
- const themes = isThemeCollectionSource(entry) ? entry.getThemes() : [entry];
133
- for (const descriptor of themes) {
134
- if (seen.has(descriptor.name)) throw new Error(`Theme collection already contains theme "${descriptor.name}"`);
135
- seen.add(descriptor.name);
136
- descriptors.push(descriptor);
137
- }
138
- }
139
- const allThemes = Object.freeze([...descriptors]);
140
- const lightThemes = Object.freeze(allThemes.filter((descriptor) => descriptor.colorScheme === "light"));
141
- const darkThemes = Object.freeze(allThemes.filter((descriptor) => descriptor.colorScheme === "dark"));
142
- const themesByName = new Map(allThemes.map((descriptor) => [descriptor.name, descriptor]));
143
- const allNames = Object.freeze(allThemes.map((descriptor) => descriptor.name));
144
- const lightNames = Object.freeze(lightThemes.map((descriptor) => descriptor.name));
145
- const darkNames = Object.freeze(darkThemes.map((descriptor) => descriptor.name));
146
- function filteredThemes(filterOptions) {
147
- if (filterOptions == null) return allThemes;
148
- const { colorScheme, collection } = filterOptions;
149
- if (collection == null) {
150
- if (colorScheme === "light") return lightThemes;
151
- if (colorScheme === "dark") return darkThemes;
152
- return allThemes;
153
- }
154
- return allThemes.filter((descriptor) => {
155
- if (descriptor.collection !== collection) return false;
156
- return colorScheme == null || descriptor.colorScheme === colorScheme;
157
- });
158
- }
159
- return {
160
- getTheme(name) {
161
- return themesByName.get(name);
162
- },
163
- getThemes(themeOptions) {
164
- return filteredThemes(themeOptions);
165
- },
166
- getThemeNames(namesOptions) {
167
- if (namesOptions?.collection == null) {
168
- if (namesOptions?.colorScheme === "light") return lightNames;
169
- if (namesOptions?.colorScheme === "dark") return darkNames;
170
- return allNames;
171
- }
172
- return filteredThemes(namesOptions).map((descriptor) => descriptor.name);
173
- },
174
- hasTheme(name) {
175
- return themesByName.has(name);
176
- },
177
- orderBy(compare) {
178
- return createThemeCollection({ themes: allThemes.map((descriptor, index) => ({
179
- descriptor,
180
- index
181
- })).sort((a, b) => {
182
- const result = compare(a.descriptor, b.descriptor);
183
- if (result !== 0) return result;
184
- return a.index - b.index;
185
- }).map((entry) => entry.descriptor) });
186
- },
187
- pick(names) {
188
- const picked = [];
189
- const pickedNames = /* @__PURE__ */ new Set();
190
- for (const name of names) {
191
- if (pickedNames.has(name)) throw new Error(`Theme collection pick already includes theme "${name}"`);
192
- pickedNames.add(name);
193
- const descriptor = themesByName.get(name);
194
- if (descriptor == null) throw new Error(`Theme collection does not contain theme "${name}"`);
195
- picked.push(descriptor);
196
- }
197
- return createThemeCollection({ themes: picked });
198
- },
199
- registerInto(resolver) {
200
- for (const descriptor of allThemes) resolver.registerThemeIfAbsent(descriptor.name, descriptor.load);
201
- }
202
- };
203
- }
204
- function getCollectionEntries(input) {
205
- if (isThemeCollectionEntry(input)) return [input];
206
- return input;
207
- }
208
- function isThemeCollectionEntry(input) {
209
- return isThemeCollectionSource(input) || isThemeDescriptor(input);
210
- }
211
- function isThemeDescriptor(input) {
212
- return typeof input.name === "string" && typeof input.load === "function";
95
+ function isWorkerContext() {
96
+ return typeof WorkerGlobalScope !== "undefined" && typeof self !== "undefined" && self instanceof WorkerGlobalScope;
213
97
  }
214
- function isThemeCollectionSource(entry) {
215
- return typeof entry.getThemes === "function";
98
+ function createCachedLoader(loader) {
99
+ let cached;
100
+ return () => cached ??= loader().then((loaded) => {
101
+ cached = loaded;
102
+ return loaded;
103
+ }, (error) => {
104
+ cached = void 0;
105
+ throw error;
106
+ });
216
107
  }
217
108
  function unwrapDefault(value) {
218
109
  return value !== null && typeof value === "object" && "default" in value ? value.default : value;
@@ -235,7 +126,7 @@ var UnresolvedThemeError = class extends Error {
235
126
  this.name = "UnresolvedThemeError";
236
127
  }
237
128
  };
238
- function createThemeResolver() {
129
+ function createThemeResolver(options = {}) {
239
130
  const loaders = /* @__PURE__ */ new Map();
240
131
  const resolved = /* @__PURE__ */ new Map();
241
132
  const inflight = /* @__PURE__ */ new Map();
@@ -252,16 +143,18 @@ function createThemeResolver() {
252
143
  function hasRegisteredTheme(name) {
253
144
  return loaders.has(name);
254
145
  }
255
- function resolveTheme2(name) {
146
+ function resolveTheme(name) {
256
147
  const cached = resolved.get(name);
257
148
  if (cached !== void 0) return Promise.resolve(cached);
258
149
  const existing = inflight.get(name);
259
150
  if (existing !== void 0) return existing;
260
151
  const loader = loaders.get(name);
261
- if (loader === void 0) return Promise.reject(new UnregisteredThemeError(name));
152
+ if (loader === void 0 && options.fallbackLoader === void 0) return Promise.reject(new UnregisteredThemeError(name));
262
153
  const generation = cacheGeneration;
263
- const promise = loader().then((result) => {
264
- const theme = unwrapDefault(result);
154
+ const promise = Promise.resolve().then(() => loader !== void 0 ? loader() : options.fallbackLoader?.(name)).then(async (result) => {
155
+ if (result === void 0) throw new UnregisteredThemeError(name);
156
+ const loaded = unwrapDefault(result);
157
+ const theme = options.normalizeTheme === void 0 ? loaded : await options.normalizeTheme(loaded, name);
265
158
  if (generation === cacheGeneration) resolved.set(name, theme);
266
159
  if (inflight.get(name) === promise) inflight.delete(name);
267
160
  return theme;
@@ -273,7 +166,7 @@ function createThemeResolver() {
273
166
  return promise;
274
167
  }
275
168
  function resolveThemes2(names) {
276
- return Promise.all(names.map((name) => resolveTheme2(name)));
169
+ return Promise.all(names.map((name) => resolveTheme(name)));
277
170
  }
278
171
  function seedResolvedTheme(name, theme) {
279
172
  resolved.set(name, theme);
@@ -300,10 +193,10 @@ function createThemeResolver() {
300
193
  for (const name of names) if (!resolved.has(name)) return false;
301
194
  return true;
302
195
  }
303
- function getResolvedOrResolveTheme2(name) {
196
+ function getResolvedOrResolveTheme(name) {
304
197
  const cached = resolved.get(name);
305
198
  if (cached !== void 0) return cached;
306
- return resolveTheme2(name);
199
+ return resolveTheme(name);
307
200
  }
308
201
  function clearResolvedThemes() {
309
202
  cacheGeneration++;
@@ -312,7 +205,7 @@ function createThemeResolver() {
312
205
  }
313
206
  return {
314
207
  clearResolvedThemes,
315
- getResolvedOrResolveTheme: getResolvedOrResolveTheme2,
208
+ getResolvedOrResolveTheme,
316
209
  getResolvedTheme,
317
210
  getResolvedThemes: getResolvedThemes2,
318
211
  hasRegisteredTheme,
@@ -320,311 +213,198 @@ function createThemeResolver() {
320
213
  hasResolvedThemes: hasResolvedThemes2,
321
214
  registerTheme,
322
215
  registerThemeIfAbsent,
323
- resolveTheme: resolveTheme2,
216
+ resolveTheme,
324
217
  resolveThemes: resolveThemes2,
325
218
  seedResolvedTheme,
326
219
  seedResolvedThemes
327
220
  };
328
221
  }
329
- const themeResolver = createThemeResolver();
330
- function attachResolvedThemes(themes, highlighter2) {
331
- themes = Array.isArray(themes) ? themes : [themes];
332
- for (let themeRef of themes) {
333
- let resolvedTheme;
334
- if (typeof themeRef === "string") {
335
- resolvedTheme = themeResolver.getResolvedTheme(themeRef);
336
- if (resolvedTheme == null) throw new Error(`loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`);
337
- } else {
338
- resolvedTheme = themeRef;
339
- themeRef = themeRef.name;
340
- if (themeResolver.getResolvedTheme(themeRef) == null) themeResolver.seedResolvedTheme(themeRef, resolvedTheme);
222
+ const customThemes = /* @__PURE__ */ new Map();
223
+ const resolvers = /* @__PURE__ */ new Map();
224
+ const loadHighlightsThemeCatalog = createCachedLoader(() => __vitePreload(() => import("./loader-byWkNl6P.js"), true ? __vite__mapDeps([0,1,2,3,4]) : void 0, import.meta.url));
225
+ const loadPierreThemeCatalog = createCachedLoader(() => __vitePreload(() => import("./themes-DGY5d--g.js"), true ? __vite__mapDeps([5,1,2,3,4]) : void 0, import.meta.url));
226
+ const loadShikiCore = createCachedLoader(() => __vitePreload(() => import("./core-Drnj1qQL.js").then((n) => n.b), true ? __vite__mapDeps([6,7,2,3,4]) : void 0, import.meta.url));
227
+ const ZED_COLOR_ALIASES = [
228
+ ["editor.lineHighlightBackground", "editor.active_line.background"],
229
+ ["editor.selectionBackground", "element.selected"],
230
+ ["editor.findMatchBackground", "search.match_background"],
231
+ ["editor.findMatchHighlightBackground", "search.match_background"],
232
+ ["editorBracketMatch.background", "editor.document_highlight.bracket_background"],
233
+ ["editorError.foreground", "error"],
234
+ ["editorWarning.foreground", "warning"],
235
+ ["editorInfo.foreground", "info"],
236
+ ["editorHint.foreground", "hint"],
237
+ [
238
+ "gitDecoration.addedResourceForeground",
239
+ "created",
240
+ "terminal.ansi.green"
241
+ ],
242
+ [
243
+ "gitDecoration.deletedResourceForeground",
244
+ "deleted",
245
+ "terminal.ansi.red"
246
+ ],
247
+ [
248
+ "gitDecoration.modifiedResourceForeground",
249
+ "modified",
250
+ "terminal.ansi.blue"
251
+ ]
252
+ ];
253
+ function createHighlightsTheme(name, raw) {
254
+ const theme = "themes" in raw ? raw.themes[0] : raw;
255
+ if (theme == null) throw new Error(`Theme "${name}" is an empty Zed theme family.`);
256
+ const zed = {
257
+ ...theme,
258
+ name
259
+ };
260
+ const colors = {};
261
+ for (const [key, value] of Object.entries(zed.style)) if (typeof value === "string") colors[key] = value;
262
+ const player = zed.style.players?.[0];
263
+ if (player?.cursor != null) colors["editorCursor.foreground"] ??= player.cursor;
264
+ if (player?.selection != null) colors["editor.selectionBackground"] ??= player.selection;
265
+ for (const [target, ...sources] of ZED_COLOR_ALIASES) {
266
+ if (colors[target] != null) continue;
267
+ const source = sources.find((key) => colors[key] != null);
268
+ if (source != null) colors[target] = colors[source];
269
+ }
270
+ if (zed.cssVariables === true) {
271
+ colors["editor.foreground"] = "var(--hls-foreground)";
272
+ colors["editor.background"] = "var(--hls-background)";
273
+ } else if (typeof zed.cssVariables === "object") {
274
+ colors["editor.foreground"] ??= colors.text ?? colors.foreground ?? "foreground";
275
+ colors["editor.background"] ??= colors.background ?? "background";
276
+ const { prefix = "--hls-", defaults } = zed.cssVariables;
277
+ for (const [key, value] of Object.entries(colors)) {
278
+ const fallback = defaults?.[value];
279
+ colors[key] = `var(${prefix}${value}${fallback ? `, ${fallback}` : ""})`;
341
280
  }
342
- if (AttachedThemes.has(themeRef)) continue;
343
- AttachedThemes.add(themeRef);
344
- highlighter2.loadThemeSync(resolvedTheme);
345
281
  }
346
- }
347
- function createTheme({ name, load, colorScheme, collection, displayName }) {
282
+ const type = zed.appearance === "light" ? "light" : "dark";
348
283
  return {
349
284
  name,
350
- colorScheme,
351
- collection,
352
- displayName,
353
- load: normalizingLoader(load)
354
- };
355
- }
356
- function normalizingLoader(loader) {
357
- return async () => {
358
- return normalizeTheme(unwrapDefault(await loader()));
285
+ type,
286
+ colors,
287
+ zed,
288
+ fg: colors["editor.foreground"] ?? colors.text ?? colors.foreground ?? (type === "light" ? "#333333" : "#bbbbbb"),
289
+ bg: colors["editor.background"] ?? colors.background ?? (type === "light" ? "#ffffff" : "#1e1e1e")
359
290
  };
360
291
  }
361
- const PIERRE_COLLECTION = "pierre";
362
- const DARK_PIERRE_THEMES = [
363
- "pierre-dark",
364
- "pierre-dark-soft",
365
- "pierre-dark-vibrant",
366
- "pierre-dark-protanopia-deuteranopia",
367
- "pierre-dark-tritanopia"
368
- ];
369
- const LIGHT_PIERRE_THEMES = [
370
- "pierre-light",
371
- "pierre-light-soft",
372
- "pierre-light-vibrant",
373
- "pierre-light-protanopia-deuteranopia",
374
- "pierre-light-tritanopia"
375
- ];
376
- const PIERRE_THEMES = [...LIGHT_PIERRE_THEMES, ...DARK_PIERRE_THEMES];
377
- const LIGHT_PIERRE_THEME_NAMES = new Set(LIGHT_PIERRE_THEMES);
378
- function pierreColorScheme(name) {
379
- if (LIGHT_PIERRE_THEME_NAMES.has(name)) return "light";
380
- return "dark";
381
- }
382
- const PIERRE_THEME_DISPLAY_NAMES = {
383
- "pierre-dark": "Pierre Dark",
384
- "pierre-dark-soft": "Pierre Dark Soft",
385
- "pierre-dark-vibrant": "Pierre Dark Vibrant",
386
- "pierre-dark-protanopia-deuteranopia": "Pierre Dark Protanopia & Deuteranopia",
387
- "pierre-dark-tritanopia": "Pierre Dark Tritanopia",
388
- "pierre-light": "Pierre Light",
389
- "pierre-light-soft": "Pierre Light Soft",
390
- "pierre-light-vibrant": "Pierre Light Vibrant",
391
- "pierre-light-protanopia-deuteranopia": "Pierre Light Protanopia & Deuteranopia",
392
- "pierre-light-tritanopia": "Pierre Light Tritanopia"
393
- };
394
- const PIERRE_THEME_IMPORTS = {
395
- "pierre-dark": () => __vitePreload(() => import("./pierre-dark-BL-l9r39.js"), true ? [] : void 0, import.meta.url),
396
- "pierre-dark-soft": () => __vitePreload(() => import("./pierre-dark-soft-B6TBhICr.js"), true ? [] : void 0, import.meta.url),
397
- "pierre-dark-vibrant": () => __vitePreload(() => import("./pierre-dark-vibrant-yElMGqZN.js"), true ? [] : void 0, import.meta.url),
398
- "pierre-dark-protanopia-deuteranopia": () => __vitePreload(() => import("./pierre-dark-protanopia-deuteranopia-BBjGuJQU.js"), true ? [] : void 0, import.meta.url),
399
- "pierre-dark-tritanopia": () => __vitePreload(() => import("./pierre-dark-tritanopia-f-j_EX9A.js"), true ? [] : void 0, import.meta.url),
400
- "pierre-light": () => __vitePreload(() => import("./pierre-light-BUzWTcjO.js"), true ? [] : void 0, import.meta.url),
401
- "pierre-light-soft": () => __vitePreload(() => import("./pierre-light-soft-CCMU-Zh0.js"), true ? [] : void 0, import.meta.url),
402
- "pierre-light-vibrant": () => __vitePreload(() => import("./pierre-light-vibrant-BRUbQnMc.js"), true ? [] : void 0, import.meta.url),
403
- "pierre-light-protanopia-deuteranopia": () => __vitePreload(() => import("./pierre-light-protanopia-deuteranopia-DlvVSCaI.js"), true ? [] : void 0, import.meta.url),
404
- "pierre-light-tritanopia": () => __vitePreload(() => import("./pierre-light-tritanopia-v4xacE1C.js"), true ? [] : void 0, import.meta.url)
405
- };
406
- function createPierreTheme(name) {
407
- return createTheme({
408
- name,
409
- collection: PIERRE_COLLECTION,
410
- colorScheme: pierreColorScheme(name),
411
- displayName: PIERRE_THEME_DISPLAY_NAMES[name],
412
- load: PIERRE_THEME_IMPORTS[name]
292
+ function createDiffsThemeResolver(backend) {
293
+ let resolver = resolvers.get(backend);
294
+ if (resolver != null) return resolver;
295
+ resolver = createThemeResolver({
296
+ fallbackLoader: async (name) => {
297
+ if (typeof __DIFFS_WORKER__ !== "undefined" ? __DIFFS_WORKER__ : isWorkerContext()) throw new Error(`Theme "${name}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedThemes parameter.`);
298
+ const custom = customThemes.get(name);
299
+ if (backend === "highlights") {
300
+ const loader = custom?.zed ?? custom?.diffs;
301
+ if (loader != null) {
302
+ const loaded = await loader();
303
+ const theme = "default" in loaded ? loaded.default : loaded;
304
+ if ("zed" in theme && theme.zed != null) return theme;
305
+ if ("style" in theme || "themes" in theme) return createHighlightsTheme(name, theme);
306
+ throw new Error(`Theme "${name}" is a TextMate theme; register a Zed theme with registerCustomTheme(name, loader, 'zed') for Highlights.`);
307
+ }
308
+ const catalog = loadHighlightsThemeCatalog();
309
+ const { themes } = catalog instanceof Promise ? await catalog : catalog;
310
+ const bundledLoader = themes[name];
311
+ if (bundledLoader != null) return createHighlightsTheme(name, (await bundledLoader()).default);
312
+ if (custom?.textmate != null) throw new Error(`Theme "${name}" is only registered for TextMate; use registerCustomTheme(name, loader, 'zed') for Highlights.`);
313
+ } else {
314
+ const loader = custom?.textmate ?? custom?.diffs;
315
+ let loaded;
316
+ if (loader != null) {
317
+ const result = await loader();
318
+ loaded = "default" in result ? result.default : result;
319
+ } else {
320
+ const catalog = loadPierreThemeCatalog();
321
+ const { themes } = catalog instanceof Promise ? await catalog : catalog;
322
+ const descriptor = themes.getTheme(name);
323
+ if (descriptor == null && custom?.zed != null) throw new Error(`Theme "${name}" is only registered for Zed; use registerCustomTheme(name, loader, 'textmate') for Shiki.`);
324
+ if (descriptor == null) throw new Error(`No valid theme loader registered for "${name}"`);
325
+ const result = await descriptor.load();
326
+ loaded = "default" in result ? result.default : result;
327
+ }
328
+ if ("style" in loaded || "themes" in loaded) throw new Error(`Theme "${name}" is a Zed theme; use preferredHighlighter: 'highlights' or register a TextMate theme for Shiki.`);
329
+ const core = loadShikiCore();
330
+ const { normalizeTheme, createCssVariablesTheme } = core instanceof Promise ? await core : core;
331
+ if ("cssVariables" in loaded && loaded.cssVariables != null) return {
332
+ ...loaded,
333
+ textmate: normalizeTheme(createCssVariablesTheme(loaded.cssVariables))
334
+ };
335
+ if ("textmate" in loaded && loaded.textmate != null) return {
336
+ ...loaded,
337
+ textmate: normalizeTheme(loaded.textmate)
338
+ };
339
+ const textmate = normalizeTheme(loaded);
340
+ return {
341
+ name: textmate.name,
342
+ type: textmate.type,
343
+ fg: textmate.fg,
344
+ bg: textmate.bg,
345
+ colors: textmate.colors,
346
+ textmate
347
+ };
348
+ }
349
+ throw new Error(`No valid theme loader registered for "${name}"`);
350
+ },
351
+ normalizeTheme: (theme, name) => {
352
+ if (theme.name !== name) throw new Error(`resolvedTheme: themeName: ${name} does not match theme.name: ${theme.name}`);
353
+ return theme;
354
+ }
413
355
  });
356
+ resolvers.set(backend, resolver);
357
+ return resolver;
414
358
  }
415
- const pierreThemes = createThemeCollection({ themes: PIERRE_THEMES.map((name) => createPierreTheme(name)) });
416
- const SHIKI_COLLECTION = "shiki";
417
- const LIGHT_SHIKI_THEMES = [
418
- "ayu-light",
419
- "catppuccin-latte",
420
- "everforest-light",
421
- "github-light",
422
- "github-light-default",
423
- "github-light-high-contrast",
424
- "gruvbox-light-hard",
425
- "gruvbox-light-medium",
426
- "gruvbox-light-soft",
427
- "horizon-bright",
428
- "kanagawa-lotus",
429
- "light-plus",
430
- "material-theme-lighter",
431
- "min-light",
432
- "night-owl-light",
433
- "one-light",
434
- "rose-pine-dawn",
435
- "slack-ochin",
436
- "snazzy-light",
437
- "solarized-light",
438
- "vitesse-light"
439
- ];
440
- const DARK_SHIKI_THEMES = [
441
- "andromeeda",
442
- "aurora-x",
443
- "ayu-dark",
444
- "ayu-mirage",
445
- "catppuccin-frappe",
446
- "catppuccin-macchiato",
447
- "catppuccin-mocha",
448
- "dark-plus",
449
- "dracula",
450
- "dracula-soft",
451
- "everforest-dark",
452
- "github-dark",
453
- "github-dark-default",
454
- "github-dark-dimmed",
455
- "github-dark-high-contrast",
456
- "gruvbox-dark-hard",
457
- "gruvbox-dark-medium",
458
- "gruvbox-dark-soft",
459
- "horizon",
460
- "houston",
461
- "kanagawa-dragon",
462
- "kanagawa-wave",
463
- "laserwave",
464
- "material-theme",
465
- "material-theme-darker",
466
- "material-theme-ocean",
467
- "material-theme-palenight",
468
- "min-dark",
469
- "monokai",
470
- "night-owl",
471
- "nord",
472
- "one-dark-pro",
473
- "plastic",
474
- "poimandres",
475
- "red",
476
- "rose-pine",
477
- "rose-pine-moon",
478
- "slack-dark",
479
- "solarized-dark",
480
- "synthwave-84",
481
- "tokyo-night",
482
- "vesper",
483
- "vitesse-black",
484
- "vitesse-dark"
485
- ];
486
- const LIGHT_SHIKI_THEME_NAMES = new Set(LIGHT_SHIKI_THEMES);
487
- function shikiColorScheme(name) {
488
- if (LIGHT_SHIKI_THEME_NAMES.has(name)) return "light";
489
- return "dark";
490
- }
491
- const SHIKI_THEME_IMPORTS = {
492
- andromeeda: () => __vitePreload(() => import("./andromeeda-C847lm7Z.js"), true ? [] : void 0, import.meta.url),
493
- "aurora-x": () => __vitePreload(() => import("./aurora-x-wJ4-eM2h.js"), true ? [] : void 0, import.meta.url),
494
- "ayu-dark": () => __vitePreload(() => import("./ayu-dark-rtpbXCNg.js"), true ? [] : void 0, import.meta.url),
495
- "ayu-light": () => __vitePreload(() => import("./ayu-light-BCZDSyV8.js"), true ? [] : void 0, import.meta.url),
496
- "ayu-mirage": () => __vitePreload(() => import("./ayu-mirage-BVoH71sA.js"), true ? [] : void 0, import.meta.url),
497
- "catppuccin-frappe": () => __vitePreload(() => import("./catppuccin-frappe-CsW6iLIR.js"), true ? [] : void 0, import.meta.url),
498
- "catppuccin-latte": () => __vitePreload(() => import("./catppuccin-latte-reHbSDAH.js"), true ? [] : void 0, import.meta.url),
499
- "catppuccin-macchiato": () => __vitePreload(() => import("./catppuccin-macchiato-rSGd47q5.js"), true ? [] : void 0, import.meta.url),
500
- "catppuccin-mocha": () => __vitePreload(() => import("./catppuccin-mocha-C6c0_b-7.js"), true ? [] : void 0, import.meta.url),
501
- "dark-plus": () => __vitePreload(() => import("./dark-plus-DmZ1Dzd4.js"), true ? [] : void 0, import.meta.url),
502
- dracula: () => __vitePreload(() => import("./dracula-B8-AVrwI.js"), true ? [] : void 0, import.meta.url),
503
- "dracula-soft": () => __vitePreload(() => import("./dracula-soft-BHeefow7.js"), true ? [] : void 0, import.meta.url),
504
- "everforest-dark": () => __vitePreload(() => import("./everforest-dark-Cg1xdODP.js"), true ? [] : void 0, import.meta.url),
505
- "everforest-light": () => __vitePreload(() => import("./everforest-light-BmTD3bxe.js"), true ? [] : void 0, import.meta.url),
506
- "github-dark": () => __vitePreload(() => import("./github-dark-O22yVQaY.js"), true ? [] : void 0, import.meta.url),
507
- "github-dark-default": () => __vitePreload(() => import("./github-dark-default-DB2Hkvqn.js"), true ? [] : void 0, import.meta.url),
508
- "github-dark-dimmed": () => __vitePreload(() => import("./github-dark-dimmed-CMZ_OfqC.js"), true ? [] : void 0, import.meta.url),
509
- "github-dark-high-contrast": () => __vitePreload(() => import("./github-dark-high-contrast-DmxWVmCU.js"), true ? [] : void 0, import.meta.url),
510
- "github-light": () => __vitePreload(() => import("./github-light-BTbR9xVK.js"), true ? [] : void 0, import.meta.url),
511
- "github-light-default": () => __vitePreload(() => import("./github-light-default-DWEonwFe.js"), true ? [] : void 0, import.meta.url),
512
- "github-light-high-contrast": () => __vitePreload(() => import("./github-light-high-contrast-WJ_cPDts.js"), true ? [] : void 0, import.meta.url),
513
- "gruvbox-dark-hard": () => __vitePreload(() => import("./gruvbox-dark-hard-DVsRsETr.js"), true ? [] : void 0, import.meta.url),
514
- "gruvbox-dark-medium": () => __vitePreload(() => import("./gruvbox-dark-medium-B5JBrQdg.js"), true ? [] : void 0, import.meta.url),
515
- "gruvbox-dark-soft": () => __vitePreload(() => import("./gruvbox-dark-soft-Db-YOqRx.js"), true ? [] : void 0, import.meta.url),
516
- "gruvbox-light-hard": () => __vitePreload(() => import("./gruvbox-light-hard-CXzJt7DI.js"), true ? [] : void 0, import.meta.url),
517
- "gruvbox-light-medium": () => __vitePreload(() => import("./gruvbox-light-medium-B89RAI1Y.js"), true ? [] : void 0, import.meta.url),
518
- "gruvbox-light-soft": () => __vitePreload(() => import("./gruvbox-light-soft-Cs0hTZYv.js"), true ? [] : void 0, import.meta.url),
519
- horizon: () => __vitePreload(() => import("./horizon-DWzh3z5C.js"), true ? [] : void 0, import.meta.url),
520
- "horizon-bright": () => __vitePreload(() => import("./horizon-bright-BJQsV5UY.js"), true ? [] : void 0, import.meta.url),
521
- houston: () => __vitePreload(() => import("./houston-CF_ws8Cq.js"), true ? [] : void 0, import.meta.url),
522
- "kanagawa-dragon": () => __vitePreload(() => import("./kanagawa-dragon-BzrndB3G.js"), true ? [] : void 0, import.meta.url),
523
- "kanagawa-lotus": () => __vitePreload(() => import("./kanagawa-lotus-BMbWLXSu.js"), true ? [] : void 0, import.meta.url),
524
- "kanagawa-wave": () => __vitePreload(() => import("./kanagawa-wave-OC_VodQx.js"), true ? [] : void 0, import.meta.url),
525
- laserwave: () => __vitePreload(() => import("./laserwave-DF03wMlf.js"), true ? [] : void 0, import.meta.url),
526
- "light-plus": () => __vitePreload(() => import("./light-plus-DS08Xg5J.js"), true ? [] : void 0, import.meta.url),
527
- "material-theme": () => __vitePreload(() => import("./material-theme-B8B2U48Q.js"), true ? [] : void 0, import.meta.url),
528
- "material-theme-darker": () => __vitePreload(() => import("./material-theme-darker-BV0iY_T3.js"), true ? [] : void 0, import.meta.url),
529
- "material-theme-lighter": () => __vitePreload(() => import("./material-theme-lighter-DrzybSTF.js"), true ? [] : void 0, import.meta.url),
530
- "material-theme-ocean": () => __vitePreload(() => import("./material-theme-ocean-BRPLVReX.js"), true ? [] : void 0, import.meta.url),
531
- "material-theme-palenight": () => __vitePreload(() => import("./material-theme-palenight-DSJwsR_D.js"), true ? [] : void 0, import.meta.url),
532
- "min-dark": () => __vitePreload(() => import("./min-dark-BNaN9fWk.js"), true ? [] : void 0, import.meta.url),
533
- "min-light": () => __vitePreload(() => import("./min-light-CMrjentn.js"), true ? [] : void 0, import.meta.url),
534
- monokai: () => __vitePreload(() => import("./monokai-BL-7sM2b.js"), true ? [] : void 0, import.meta.url),
535
- "night-owl": () => __vitePreload(() => import("./night-owl-DSS199ra.js"), true ? [] : void 0, import.meta.url),
536
- "night-owl-light": () => __vitePreload(() => import("./night-owl-light-gC6E-Eh2.js"), true ? [] : void 0, import.meta.url),
537
- nord: () => __vitePreload(() => import("./nord-CvDbBq5M.js"), true ? [] : void 0, import.meta.url),
538
- "one-dark-pro": () => __vitePreload(() => import("./one-dark-pro-DfmyFT_9.js"), true ? [] : void 0, import.meta.url),
539
- "one-light": () => __vitePreload(() => import("./one-light-B0cTzZyr.js"), true ? [] : void 0, import.meta.url),
540
- plastic: () => __vitePreload(() => import("./plastic-BjwMpBc0.js"), true ? [] : void 0, import.meta.url),
541
- poimandres: () => __vitePreload(() => import("./poimandres-ChWyhPrn.js"), true ? [] : void 0, import.meta.url),
542
- red: () => __vitePreload(() => import("./red-BcXR4G_B.js"), true ? [] : void 0, import.meta.url),
543
- "rose-pine": () => __vitePreload(() => import("./rose-pine-DsUfEP3G.js"), true ? [] : void 0, import.meta.url),
544
- "rose-pine-dawn": () => __vitePreload(() => import("./rose-pine-dawn-BvRaiqBN.js"), true ? [] : void 0, import.meta.url),
545
- "rose-pine-moon": () => __vitePreload(() => import("./rose-pine-moon-B51k6Eh0.js"), true ? [] : void 0, import.meta.url),
546
- "slack-dark": () => __vitePreload(() => import("./slack-dark-BEe10hxO.js"), true ? [] : void 0, import.meta.url),
547
- "slack-ochin": () => __vitePreload(() => import("./slack-ochin-BKmu9pBc.js"), true ? [] : void 0, import.meta.url),
548
- "snazzy-light": () => __vitePreload(() => import("./snazzy-light-Dcvd-ZyI.js"), true ? [] : void 0, import.meta.url),
549
- "solarized-dark": () => __vitePreload(() => import("./solarized-dark-9CqJc6gu.js"), true ? [] : void 0, import.meta.url),
550
- "solarized-light": () => __vitePreload(() => import("./solarized-light-CahvOdlg.js"), true ? [] : void 0, import.meta.url),
551
- "synthwave-84": () => __vitePreload(() => import("./synthwave-84-CoUef9sh.js"), true ? [] : void 0, import.meta.url),
552
- "tokyo-night": () => __vitePreload(() => import("./tokyo-night-DjtLpAEY.js"), true ? [] : void 0, import.meta.url),
553
- vesper: () => __vitePreload(() => import("./vesper-D0zf0Dl2.js"), true ? [] : void 0, import.meta.url),
554
- "vitesse-black": () => __vitePreload(() => import("./vitesse-black-BqNLki8b.js"), true ? [] : void 0, import.meta.url),
555
- "vitesse-dark": () => __vitePreload(() => import("./vitesse-dark-jJ32WhwH.js"), true ? [] : void 0, import.meta.url),
556
- "vitesse-light": () => __vitePreload(() => import("./vitesse-light-476zM4e6.js"), true ? [] : void 0, import.meta.url)
557
- };
558
- function createShikiTheme(name) {
559
- return createTheme({
560
- name,
561
- collection: SHIKI_COLLECTION,
562
- colorScheme: shikiColorScheme(name),
563
- load: SHIKI_THEME_IMPORTS[name]
564
- });
359
+ function areThemesAttached(themes, highlighter2 = resolveHighlighterType()) {
360
+ if (typeof highlighter2 !== "string" && highlighter2.isDisposed) return false;
361
+ return (typeof highlighter2 === "string" ? createDiffsThemeResolver(highlighter2) : highlighter2.themeResolver).hasResolvedThemes(getThemes(themes));
565
362
  }
566
- const shikiThemes = createThemeCollection({ themes: Object.freeze([...LIGHT_SHIKI_THEMES.map((name) => createShikiTheme(name)), ...DARK_SHIKI_THEMES.map((name) => createShikiTheme(name))]) });
567
- createThemeCollection({ themes: [pierreThemes, shikiThemes] });
568
- function prepareThemeResolution(themeName) {
569
- if (isWorkerContext()) throw new Error(`Theme "${themeName}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);
570
- if (themeResolver.hasRegisteredTheme(themeName)) return;
571
- const descriptor = shikiThemes.getTheme(themeName);
572
- if (descriptor != null) {
573
- themeResolver.registerThemeIfAbsent(descriptor.name, descriptor.load);
574
- return;
363
+ let highlighter;
364
+ async function createHighlighter(type) {
365
+ const resolvedType = resolveHighlighterType(type);
366
+ acquireHighlighterType(resolvedType);
367
+ try {
368
+ if (resolvedType === "highlights") {
369
+ const { HighlightsHighlighter } = await __vitePreload(async () => {
370
+ const { HighlightsHighlighter: HighlightsHighlighter2 } = await import("./highlights-DaYW35iB.js");
371
+ return { HighlightsHighlighter: HighlightsHighlighter2 };
372
+ }, true ? __vite__mapDeps([8,9,10,7,2,3,4,11,1]) : void 0, import.meta.url);
373
+ return new HighlightsHighlighter();
374
+ }
375
+ const { ShikiHighlighter } = await __vitePreload(async () => {
376
+ const { ShikiHighlighter: ShikiHighlighter2 } = await import("./shiki-DxXti3Bm.js");
377
+ return { ShikiHighlighter: ShikiHighlighter2 };
378
+ }, true ? __vite__mapDeps([12,1,2,3,4,9,10,7,13,6]) : void 0, import.meta.url);
379
+ return await ShikiHighlighter.create(resolvedType);
380
+ } finally {
381
+ releaseHighlighterType();
575
382
  }
576
- throw new Error(`No valid theme loader registered for "${themeName}"`);
577
- }
578
- function validateResolvedThemeName(themeName, theme) {
579
- if (theme.name !== themeName) throw new Error(`resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`);
580
- }
581
- async function resolveTheme(themeName) {
582
- prepareThemeResolution(themeName);
583
- const theme = await themeResolver.resolveTheme(themeName);
584
- validateResolvedThemeName(themeName, theme);
585
- return theme;
586
383
  }
587
- function getResolvedOrResolveTheme(themeName) {
588
- return themeResolver.getResolvedTheme(themeName) ?? resolveTheme(themeName);
589
- }
590
- let highlighter;
591
- async function getSharedHighlighter({ themes, langs, preferredHighlighter = "shiki-js" }) {
592
- highlighter ??= createHighlighter({
593
- themes: [],
594
- langs: ["text"],
595
- engine: preferredHighlighter === "shiki-wasm" ? createOnigurumaEngine(__vitePreload(() => import("./wasm-DDgzZJey.js"), true ? [] : void 0, import.meta.url)) : createJavaScriptRegexEngine()
596
- });
597
- const instance = isHighlighterLoading(highlighter) ? await highlighter : highlighter;
598
- highlighter = instance;
599
- const languageLoaders = [];
600
- for (const language of Array.from(new Set(langs))) {
601
- if (language === "text" || language === "ansi") continue;
602
- const maybeResolvedLanguage = getResolvedOrResolveLanguage(language);
603
- if ("then" in maybeResolvedLanguage) languageLoaders.push(maybeResolvedLanguage);
604
- else attachResolvedLanguages(maybeResolvedLanguage, instance);
605
- }
606
- const themeLoaders = [];
607
- for (const themeName of themes) {
608
- const maybeResolvedTheme = getResolvedOrResolveTheme(themeName);
609
- if ("then" in maybeResolvedTheme) themeLoaders.push(maybeResolvedTheme);
610
- else attachResolvedThemes(maybeResolvedTheme, highlighter);
611
- }
612
- if (languageLoaders.length > 0 || themeLoaders.length > 0) await Promise.all([Promise.all(languageLoaders).then((languages) => {
613
- attachResolvedLanguages(languages, instance);
614
- }), Promise.all(themeLoaders).then((themes2) => {
615
- attachResolvedThemes(themes2, instance);
616
- })]);
384
+ async function getSharedHighlighter({ themes, langs, preferredHighlighter }) {
385
+ dropDisposedHighlighter();
386
+ const cached = highlighter ??= createHighlighter(getHighlighterType() ?? preferredHighlighter);
387
+ let instance;
388
+ try {
389
+ instance = await cached;
390
+ } catch (error) {
391
+ if (highlighter === cached) highlighter = void 0;
392
+ throw error;
393
+ }
394
+ if (highlighter === cached) highlighter = instance;
395
+ await Promise.all([instance.themeResolver.resolveThemes(themes), instance.loadLanguages(langs)]);
396
+ if (instance.isDisposed) throw new HighlighterDisposedError();
617
397
  return instance;
618
398
  }
619
- function getHighlighterIfLoaded(withSettings) {
620
- if (highlighter == null || "then" in highlighter) return;
621
- if (withSettings != null && (!areThemesAttached(withSettings.theme) || !areLanguagesAttached(withSettings.lang))) return;
622
- return highlighter;
399
+ function dropDisposedHighlighter() {
400
+ if (highlighter != null && !("then" in highlighter) && highlighter.isDisposed) highlighter = void 0;
623
401
  }
624
- function isHighlighterLoading(h = highlighter) {
625
- return h != null && "then" in h;
402
+ function getHighlighterIfLoaded({ theme, lang, langs } = {}) {
403
+ dropDisposedHighlighter();
404
+ const instance = highlighter;
405
+ if (instance == null || "then" in instance || theme != null && !areThemesAttached(theme, instance) || (lang != null || langs != null) && !instance.hasLoadedLanguages([...lang != null ? [lang] : [], ...langs ?? []])) return;
406
+ return instance;
626
407
  }
627
- for (const descriptor of pierreThemes.getThemes()) themeResolver.registerThemeIfAbsent(descriptor.name, descriptor.load);
628
408
  function areThemesEqual(themeA, themeB) {
629
409
  if (themeA == null || themeB == null || typeof themeA === "string" || typeof themeB === "string") return themeA === themeB;
630
410
  return themeA.dark === themeB.dark && themeA.light === themeB.light;
@@ -658,14 +438,6 @@ function createIconElement({ name, width = 16, height = 16, properties }) {
658
438
  })]
659
439
  });
660
440
  }
661
- function findCodeElement(nodes) {
662
- let firstChild = nodes.children[0];
663
- while (firstChild != null) {
664
- if (firstChild.type === "element" && firstChild.tagName === "code") return firstChild;
665
- if ("children" in firstChild) firstChild = firstChild.children[0];
666
- else firstChild = null;
667
- }
668
- }
669
441
  function createGutterWrapper(children) {
670
442
  return createHastElement({
671
443
  tagName: "div",
@@ -700,8 +472,10 @@ function createGutterGap(type, bufferType, size) {
700
472
  }
701
473
  });
702
474
  }
703
- function hasResolvedThemes(themeNames) {
704
- return themeResolver.hasResolvedThemes(themeNames);
475
+ function areLanguagesAttached(languages, highlighter2) {
476
+ const names = Array.isArray(languages) ? languages : [languages];
477
+ if (highlighter2 != null) return highlighter2.hasLoadedLanguages(names);
478
+ return names.every((name) => name === "text" || name === "ansi" || AttachedLanguages.has(name));
705
479
  }
706
480
  function areFileRenderOptionsEqual(optionsA, optionsB) {
707
481
  return areThemesEqual(optionsA.theme, optionsB.theme) && optionsA.useTokenTransformer === optionsB.useTokenTransformer && optionsA.tokenizeMaxLineLength === optionsB.tokenizeMaxLineLength;
@@ -1091,238 +865,6 @@ function getCustomExtensionsVersion() {
1091
865
  function getCustomExtensionsMap() {
1092
866
  return Object.fromEntries(CUSTOM_EXTENSION_TO_FILE_FORMAT);
1093
867
  }
1094
- function processLine(node, line, state) {
1095
- const lineInfo = typeof state.lineInfo === "function" ? state.lineInfo(line) : state.lineInfo[line - 1];
1096
- if (lineInfo == null) {
1097
- const errorMessage = `processLine: line ${line}, contains no state.lineInfo`;
1098
- console.error(errorMessage, {
1099
- node,
1100
- line,
1101
- state
1102
- });
1103
- throw new Error(errorMessage);
1104
- }
1105
- node.tagName = "div";
1106
- node.properties["data-line"] = lineInfo.lineNumber;
1107
- node.properties["data-alt-line"] = lineInfo.altLineNumber;
1108
- node.properties["data-line-type"] = lineInfo.type;
1109
- node.properties["data-line-index"] = lineInfo.lineIndex;
1110
- if (node.children.length === 0) node.children.push(createTextNodeElement("\n"));
1111
- return node;
1112
- }
1113
- const NO_TOKEN = /* @__PURE__ */ Symbol("no-token");
1114
- const MULTIPLE_TOKENS = /* @__PURE__ */ Symbol("multiple-tokens");
1115
- function wrapTokenFragments(container) {
1116
- const ownTokenChar = getTokenChar(container);
1117
- if (ownTokenChar != null) return ownTokenChar;
1118
- let containerTokenState = NO_TOKEN;
1119
- const wrappedChildren = [];
1120
- let currentTokenChildren = [];
1121
- let currentTokenChar;
1122
- const flushTokenChildren = () => {
1123
- if (currentTokenChildren.length === 0 || currentTokenChar == null) {
1124
- currentTokenChildren = [];
1125
- currentTokenChar = void 0;
1126
- return;
1127
- }
1128
- if (currentTokenChildren.length === 1) {
1129
- const child = currentTokenChildren[0];
1130
- if (child?.type === "element") {
1131
- setTokenChar(child, currentTokenChar);
1132
- for (const grandChild of child.children) stripTokenChar(grandChild);
1133
- } else stripTokenChar(child);
1134
- wrappedChildren.push(child);
1135
- currentTokenChildren = [];
1136
- currentTokenChar = void 0;
1137
- return;
1138
- }
1139
- for (const child of currentTokenChildren) stripTokenChar(child);
1140
- wrappedChildren.push(createHastElement({
1141
- tagName: "span",
1142
- properties: { "data-char": currentTokenChar },
1143
- children: currentTokenChildren
1144
- }));
1145
- currentTokenChildren = [];
1146
- currentTokenChar = void 0;
1147
- };
1148
- const mergeContainerTokenState = (childTokenState) => {
1149
- if (childTokenState === NO_TOKEN) return;
1150
- if (childTokenState === MULTIPLE_TOKENS) {
1151
- containerTokenState = MULTIPLE_TOKENS;
1152
- return;
1153
- }
1154
- if (containerTokenState === NO_TOKEN) {
1155
- containerTokenState = childTokenState;
1156
- return;
1157
- }
1158
- if (containerTokenState !== childTokenState) containerTokenState = MULTIPLE_TOKENS;
1159
- };
1160
- for (const child of container.children) {
1161
- const childTokenState = child.type === "element" ? wrapTokenFragments(child) : NO_TOKEN;
1162
- mergeContainerTokenState(childTokenState);
1163
- if (typeof childTokenState !== "number") {
1164
- flushTokenChildren();
1165
- wrappedChildren.push(child);
1166
- continue;
1167
- }
1168
- if (currentTokenChar != null && currentTokenChar !== childTokenState) flushTokenChildren();
1169
- currentTokenChar ??= childTokenState;
1170
- currentTokenChildren.push(child);
1171
- }
1172
- flushTokenChildren();
1173
- container.children = wrappedChildren;
1174
- return containerTokenState;
1175
- }
1176
- function getTokenChar(node) {
1177
- const value = node.properties["data-char"];
1178
- if (typeof value === "number") return value;
1179
- }
1180
- function stripTokenChar(node) {
1181
- if (node.type !== "element") return;
1182
- node.properties["data-char"] = void 0;
1183
- for (const child of node.children) stripTokenChar(child);
1184
- }
1185
- function setTokenChar(node, char) {
1186
- node.properties["data-char"] = char;
1187
- }
1188
- function transformerStyleToClass(options = {}) {
1189
- const { classPrefix = "__shiki_", classSuffix = "", classReplacer = (className) => className } = options;
1190
- const classToStyle = /* @__PURE__ */ new Map();
1191
- function stringifyStyle(style) {
1192
- return Object.entries(style).map(([key, value]) => `${key}:${value}`).join(";");
1193
- }
1194
- function registerStyle(style) {
1195
- const str = typeof style === "string" ? style : stringifyStyle(style);
1196
- let className = classPrefix + cyrb53(str) + classSuffix;
1197
- className = classReplacer(className);
1198
- if (!classToStyle.has(className)) classToStyle.set(className, typeof style === "string" ? style : { ...style });
1199
- return className;
1200
- }
1201
- return {
1202
- name: "@shikijs/transformers:style-to-class",
1203
- pre(t) {
1204
- if (!t.properties.style) return;
1205
- const className = registerStyle(t.properties.style);
1206
- delete t.properties.style;
1207
- this.addClassToHast(t, className);
1208
- },
1209
- tokens(lines) {
1210
- for (const line of lines) for (const token of line) {
1211
- if (!token.htmlStyle) continue;
1212
- const className = registerStyle(token.htmlStyle);
1213
- token.htmlStyle = {};
1214
- token.htmlAttrs ||= {};
1215
- if (!token.htmlAttrs.class) token.htmlAttrs.class = className;
1216
- else token.htmlAttrs.class += ` ${className}`;
1217
- }
1218
- },
1219
- getClassRegistry() {
1220
- return classToStyle;
1221
- },
1222
- getCSS() {
1223
- let css = "";
1224
- for (const [className, style] of classToStyle.entries()) css += `.${className}{${typeof style === "string" ? style : stringifyStyle(style)}}`;
1225
- return css;
1226
- },
1227
- clearRegistry() {
1228
- classToStyle.clear();
1229
- }
1230
- };
1231
- }
1232
- function cyrb53(str, seed = 0) {
1233
- let h1 = 3735928559 ^ seed;
1234
- let h2 = 1103547991 ^ seed;
1235
- for (let i = 0, ch; i < str.length; i++) {
1236
- ch = str.charCodeAt(i);
1237
- h1 = Math.imul(h1 ^ ch, 2654435761);
1238
- h2 = Math.imul(h2 ^ ch, 1597334677);
1239
- }
1240
- h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
1241
- h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
1242
- h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
1243
- h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
1244
- return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(36).slice(0, 6);
1245
- }
1246
- function createTransformerWithState(useTokenTransformer = false, useCSSClasses = false) {
1247
- const state = { lineInfo: [] };
1248
- const transformers = [{
1249
- line(node) {
1250
- delete node.properties.class;
1251
- return node;
1252
- },
1253
- pre(pre) {
1254
- const code = findCodeElement(pre);
1255
- const children = [];
1256
- if (code != null) {
1257
- let index = 1;
1258
- for (const node of code.children) {
1259
- if (node.type !== "element") continue;
1260
- if (useTokenTransformer) wrapTokenFragments(node);
1261
- children.push(processLine(node, index, state));
1262
- index++;
1263
- }
1264
- code.children = children;
1265
- }
1266
- return pre;
1267
- },
1268
- ...useTokenTransformer ? {
1269
- tokens(lines) {
1270
- for (const line of lines) {
1271
- let col = 0;
1272
- for (const token of line) {
1273
- const tokenWithOriginalRange = token;
1274
- tokenWithOriginalRange.__lineChar ??= col;
1275
- col += token.content.length;
1276
- }
1277
- }
1278
- },
1279
- preprocess(_code, options) {
1280
- options.mergeWhitespaces = "never";
1281
- },
1282
- span(hast, _line, _char, _lineElement, token) {
1283
- if (token?.offset != null && token.content != null) {
1284
- const tokenChar = token.__lineChar;
1285
- if (tokenChar != null) hast.properties["data-char"] = tokenChar;
1286
- return hast;
1287
- }
1288
- return hast;
1289
- }
1290
- } : null
1291
- }];
1292
- if (useCSSClasses) transformers.push(tokenStyleNormalizer, toClass);
1293
- if (useTokenTransformer) transformers.push({ line: (node) => {
1294
- if (node.type === "element" && node.children.length === 0) node.children.push({
1295
- type: "element",
1296
- tagName: "br",
1297
- properties: {},
1298
- children: []
1299
- });
1300
- return node;
1301
- } });
1302
- return {
1303
- state,
1304
- transformers,
1305
- toClass
1306
- };
1307
- }
1308
- const toClass = transformerStyleToClass({ classPrefix: "hl-" });
1309
- const tokenStyleNormalizer = {
1310
- name: "token-style-normalizer",
1311
- tokens(lines) {
1312
- for (const line of lines) for (const token of line) {
1313
- if (token.htmlStyle != null) continue;
1314
- const style = {};
1315
- if (token.color != null) style.color = token.color;
1316
- if (token.bgColor != null) style["background-color"] = token.bgColor;
1317
- if (token.fontStyle != null && token.fontStyle !== 0) {
1318
- if ((token.fontStyle & 1) !== 0) style["font-style"] = "italic";
1319
- if ((token.fontStyle & 2) !== 0) style["font-weight"] = "bold";
1320
- if ((token.fontStyle & 4) !== 0) style["text-decoration"] = "underline";
1321
- }
1322
- if (Object.keys(style).length > 0) token.htmlStyle = style;
1323
- }
1324
- }
1325
- };
1326
868
  function formatCSSVariablePrefix(type) {
1327
869
  return `--${type === "token" ? "diffs-token" : "diffs"}-`;
1328
870
  }
@@ -1506,7 +1048,7 @@ function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highli
1506
1048
  let styles = "";
1507
1049
  if (typeof theme === "string") {
1508
1050
  const themeData = highlighter2.getTheme(theme);
1509
- const normalized = normalizeThemeColors(themeData);
1051
+ const normalized = getThemeColors(themeData, highlighter2);
1510
1052
  styles += `color:${normalized.fg};`;
1511
1053
  styles += `background-color:${normalized.bg};`;
1512
1054
  styles += `${formatCSSVariablePrefix("global")}fg:${normalized.fg};`;
@@ -1514,18 +1056,28 @@ function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highli
1514
1056
  styles += getGitVariables(themeData, prefix);
1515
1057
  } else {
1516
1058
  let themeData = highlighter2.getTheme(theme.dark);
1517
- let normalized = normalizeThemeColors(themeData);
1059
+ let normalized = getThemeColors(themeData, highlighter2);
1518
1060
  styles += `${formatCSSVariablePrefix("global")}dark:${normalized.fg};`;
1519
1061
  styles += `${formatCSSVariablePrefix("global")}dark-bg:${normalized.bg};`;
1520
1062
  styles += getGitVariables(themeData, "dark");
1521
1063
  themeData = highlighter2.getTheme(theme.light);
1522
- normalized = normalizeThemeColors(themeData);
1064
+ normalized = getThemeColors(themeData, highlighter2);
1523
1065
  styles += `${formatCSSVariablePrefix("global")}light:${normalized.fg};`;
1524
1066
  styles += `${formatCSSVariablePrefix("global")}light-bg:${normalized.bg};`;
1525
1067
  styles += getGitVariables(themeData, "light");
1526
1068
  }
1527
1069
  return styles;
1528
1070
  }
1071
+ function getThemeColors(theme, highlighter2) {
1072
+ if (highlighter2.name === "highlights" && theme.zed?.cssVariables === true) {
1073
+ const prefix = formatCSSVariablePrefix("token");
1074
+ return {
1075
+ fg: `var(${prefix}foreground)`,
1076
+ bg: `var(${prefix}background)`
1077
+ };
1078
+ }
1079
+ return normalizeThemeColors(theme);
1080
+ }
1529
1081
  function getGitVariables(themeData, modePrefix) {
1530
1082
  modePrefix = modePrefix != null ? `${modePrefix}-` : "";
1531
1083
  let styles = "";
@@ -1537,15 +1089,394 @@ function getGitVariables(themeData, modePrefix) {
1537
1089
  if (modifiedBlue != null) styles += `${formatCSSVariablePrefix("global")}${modePrefix}modified-color:${modifiedBlue};`;
1538
1090
  return styles;
1539
1091
  }
1540
- function getLineNodes(nodes) {
1541
- let firstChild = nodes.children[0];
1542
- while (firstChild != null) {
1543
- if (firstChild.type === "element" && firstChild.tagName === "code") return firstChild.children;
1544
- if ("children" in firstChild) firstChild = firstChild.children[0];
1545
- else firstChild = null;
1092
+ function processLine(node, line, state) {
1093
+ const lineInfo = typeof state.lineInfo === "function" ? state.lineInfo(line) : state.lineInfo[line - 1];
1094
+ if (lineInfo == null) {
1095
+ const errorMessage = `processLine: line ${line}, contains no state.lineInfo`;
1096
+ console.error(errorMessage, {
1097
+ node,
1098
+ line,
1099
+ state
1100
+ });
1101
+ throw new Error(errorMessage);
1102
+ }
1103
+ node.tagName = "div";
1104
+ node.properties["data-line"] = lineInfo.lineNumber;
1105
+ node.properties["data-alt-line"] = lineInfo.altLineNumber;
1106
+ node.properties["data-line-type"] = lineInfo.type;
1107
+ node.properties["data-line-index"] = lineInfo.lineIndex;
1108
+ if (node.children.length === 0) node.children.push(createTextNodeElement("\n"));
1109
+ return node;
1110
+ }
1111
+ const htmlStyleCache = /* @__PURE__ */ new WeakMap();
1112
+ function tokenStyle(token, cacheHtmlStyle = false) {
1113
+ const { htmlStyle } = token;
1114
+ if (htmlStyle != null) {
1115
+ let style2 = cacheHtmlStyle ? htmlStyleCache.get(htmlStyle) : void 0;
1116
+ if (style2 == null) {
1117
+ style2 = "";
1118
+ for (const name in htmlStyle) style2 += `${style2 === "" ? "" : ";"}${name}:${htmlStyle[name]}`;
1119
+ if (cacheHtmlStyle) htmlStyleCache.set(htmlStyle, style2);
1120
+ }
1121
+ return style2;
1122
+ }
1123
+ let style = token.color != null ? `color:${token.color}` : "";
1124
+ if (token.bgColor != null) style += `;background-color:${token.bgColor}`;
1125
+ if (token.fontStyle != null) {
1126
+ if ((token.fontStyle & 1) !== 0) style += ";font-style:italic";
1127
+ if ((token.fontStyle & 2) !== 0) style += ";font-weight:bold";
1128
+ const underline = (token.fontStyle & 4) !== 0;
1129
+ const strikethrough = (token.fontStyle & 8) !== 0;
1130
+ if (underline || strikethrough) style += `;text-decoration:${underline ? "underline" : ""}${underline && strikethrough ? " " : ""}${strikethrough ? "line-through" : ""}`;
1131
+ }
1132
+ return style.replace(/^;/, "");
1133
+ }
1134
+ function setDeferredArrayItem(array, index, create, { retain = true } = {}) {
1135
+ let initialized = false;
1136
+ let cached;
1137
+ Object.defineProperty(array, index, {
1138
+ configurable: true,
1139
+ enumerable: true,
1140
+ get() {
1141
+ if (initialized) return cached;
1142
+ const value = create();
1143
+ if (!retain) return value;
1144
+ cached = value;
1145
+ initialized = true;
1146
+ if (Object.getOwnPropertyDescriptor(array, index)?.configurable === true) Object.defineProperty(array, index, {
1147
+ configurable: true,
1148
+ enumerable: true,
1149
+ writable: true,
1150
+ value: cached
1151
+ });
1152
+ return cached;
1153
+ },
1154
+ set(value) {
1155
+ if (Object.getOwnPropertyDescriptor(array, index)?.configurable === true) Object.defineProperty(array, index, {
1156
+ configurable: true,
1157
+ enumerable: true,
1158
+ writable: true,
1159
+ value
1160
+ });
1161
+ else if (Object.isFrozen(array)) throw new TypeError(`Cannot assign to read only array index '${index}'`);
1162
+ else {
1163
+ cached = value;
1164
+ initialized = true;
1165
+ }
1166
+ }
1167
+ });
1168
+ }
1169
+ const NO_TOKEN = /* @__PURE__ */ Symbol("no-token");
1170
+ const MULTIPLE_TOKENS = /* @__PURE__ */ Symbol("multiple-tokens");
1171
+ function wrapTokenFragments(container) {
1172
+ const ownTokenChar = getTokenChar(container);
1173
+ if (ownTokenChar != null) return ownTokenChar;
1174
+ let containerTokenState = NO_TOKEN;
1175
+ const wrappedChildren = [];
1176
+ let currentTokenChildren = [];
1177
+ let currentTokenChar;
1178
+ const flushTokenChildren = () => {
1179
+ if (currentTokenChildren.length === 0 || currentTokenChar == null) {
1180
+ currentTokenChildren = [];
1181
+ currentTokenChar = void 0;
1182
+ return;
1183
+ }
1184
+ if (currentTokenChildren.length === 1) {
1185
+ const child = currentTokenChildren[0];
1186
+ if (child?.type === "element") {
1187
+ setTokenChar(child, currentTokenChar);
1188
+ for (const grandChild of child.children) stripTokenChar(grandChild);
1189
+ } else stripTokenChar(child);
1190
+ wrappedChildren.push(child);
1191
+ currentTokenChildren = [];
1192
+ currentTokenChar = void 0;
1193
+ return;
1194
+ }
1195
+ for (const child of currentTokenChildren) stripTokenChar(child);
1196
+ wrappedChildren.push(createHastElement({
1197
+ tagName: "span",
1198
+ properties: { "data-char": currentTokenChar },
1199
+ children: currentTokenChildren
1200
+ }));
1201
+ currentTokenChildren = [];
1202
+ currentTokenChar = void 0;
1203
+ };
1204
+ const mergeContainerTokenState = (childTokenState) => {
1205
+ if (childTokenState === NO_TOKEN) return;
1206
+ if (childTokenState === MULTIPLE_TOKENS) {
1207
+ containerTokenState = MULTIPLE_TOKENS;
1208
+ return;
1209
+ }
1210
+ if (containerTokenState === NO_TOKEN) {
1211
+ containerTokenState = childTokenState;
1212
+ return;
1213
+ }
1214
+ if (containerTokenState !== childTokenState) containerTokenState = MULTIPLE_TOKENS;
1215
+ };
1216
+ for (const child of container.children) {
1217
+ const childTokenState = child.type === "element" ? wrapTokenFragments(child) : NO_TOKEN;
1218
+ mergeContainerTokenState(childTokenState);
1219
+ if (typeof childTokenState !== "number") {
1220
+ flushTokenChildren();
1221
+ wrappedChildren.push(child);
1222
+ continue;
1223
+ }
1224
+ if (currentTokenChar != null && currentTokenChar !== childTokenState) flushTokenChildren();
1225
+ currentTokenChar ??= childTokenState;
1226
+ currentTokenChildren.push(child);
1227
+ }
1228
+ flushTokenChildren();
1229
+ container.children = wrappedChildren;
1230
+ return containerTokenState;
1231
+ }
1232
+ function getTokenChar(node) {
1233
+ const value = node.properties["data-char"];
1234
+ if (typeof value === "number") return value;
1235
+ }
1236
+ function stripTokenChar(node) {
1237
+ if (node.type !== "element") return;
1238
+ node.properties["data-char"] = void 0;
1239
+ for (const child of node.children) stripTokenChar(child);
1240
+ }
1241
+ function setTokenChar(node, char) {
1242
+ node.properties["data-char"] = char;
1243
+ }
1244
+ function renderTokenLines(lines, { state, lazyLineAST = false, cacheHtmlStyles = false, useTokenTransformer = false, mergeWhitespaces = "always", decorations = [], lineOffsets = [] }) {
1245
+ let decorationsByLine;
1246
+ for (const decoration of decorations) {
1247
+ const byLine = decorationsByLine ??= /* @__PURE__ */ new Map();
1248
+ const normalized = {
1249
+ ...decoration,
1250
+ start: getDecorationPosition(decoration.start, lineOffsets),
1251
+ end: getDecorationPosition(decoration.end, lineOffsets)
1252
+ };
1253
+ const lastLine = Math.min(normalized.end.line, lines.length - 1);
1254
+ for (let line = normalized.start.line; line <= lastLine; line++) {
1255
+ let spans = byLine.get(line);
1256
+ if (spans == null) byLine.set(line, spans = []);
1257
+ spans.push(normalized);
1258
+ }
1259
+ }
1260
+ const renderLine = (tokens, lineIndex) => {
1261
+ let normalized;
1262
+ if (useTokenTransformer || mergeWhitespaces !== "never") {
1263
+ let pendingWhitespace = "";
1264
+ let whitespaceOffset = 0;
1265
+ for (let i = 0; i < tokens.length; i++) {
1266
+ let token = tokens[i];
1267
+ if (useTokenTransformer) {
1268
+ const content = token.content.trim();
1269
+ if (content !== "" && content !== token.content) {
1270
+ normalized ??= tokens.slice(0, i);
1271
+ const start = token.content.indexOf(content);
1272
+ if (start > 0) normalized.push({
1273
+ content: token.content.slice(0, start),
1274
+ offset: token.offset
1275
+ });
1276
+ normalized.push({
1277
+ ...token,
1278
+ content,
1279
+ offset: token.offset + start
1280
+ });
1281
+ const end = start + content.length;
1282
+ if (end < token.content.length) normalized.push({
1283
+ content: token.content.slice(end),
1284
+ offset: token.offset + end
1285
+ });
1286
+ continue;
1287
+ }
1288
+ } else {
1289
+ const decoratedWhitespace = ((token.fontStyle ?? 0) & 12) !== 0;
1290
+ if (!decoratedWhitespace && /^\s+$/.test(token.content) && i < tokens.length - 1) {
1291
+ normalized ??= tokens.slice(0, i);
1292
+ if (pendingWhitespace === "") whitespaceOffset = token.offset;
1293
+ pendingWhitespace += token.content;
1294
+ continue;
1295
+ }
1296
+ if (pendingWhitespace !== "" && normalized != null) {
1297
+ if (decoratedWhitespace) normalized.push({
1298
+ content: pendingWhitespace,
1299
+ offset: whitespaceOffset
1300
+ });
1301
+ else token = {
1302
+ ...token,
1303
+ content: pendingWhitespace + token.content,
1304
+ offset: whitespaceOffset
1305
+ };
1306
+ pendingWhitespace = "";
1307
+ }
1308
+ }
1309
+ normalized?.push(token);
1310
+ }
1311
+ }
1312
+ normalized ??= tokens;
1313
+ const line = {
1314
+ type: "element",
1315
+ tagName: state == null ? "span" : "div",
1316
+ properties: state == null ? { class: "line" } : {},
1317
+ children: []
1318
+ };
1319
+ const spans = decorationsByLine?.get(lineIndex);
1320
+ const column = spans == null ? appendTokens(line, normalized, useTokenTransformer, cacheHtmlStyles) : appendDecoratedTokens(line, normalized, spans, lineIndex, useTokenTransformer, cacheHtmlStyles);
1321
+ if (useTokenTransformer && column === 0) line.children.push({
1322
+ type: "element",
1323
+ tagName: "br",
1324
+ properties: {},
1325
+ children: []
1326
+ });
1327
+ if (useTokenTransformer && spans != null) wrapTokenFragments(line);
1328
+ return state == null ? line : processLine(line, lineIndex + 1, state);
1329
+ };
1330
+ if (!lazyLineAST) return lines.map(renderLine);
1331
+ const rows = new Array(lines.length);
1332
+ for (let index = 0; index < lines.length; index++) {
1333
+ const tokens = lines[index];
1334
+ setDeferredArrayItem(rows, index, () => renderLine(tokens, index));
1335
+ }
1336
+ return rows;
1337
+ }
1338
+ function appendTokens(line, tokens, useTokenTransformer, cacheHtmlStyles) {
1339
+ let column = 0;
1340
+ for (const token of tokens) {
1341
+ if (token.content === "") continue;
1342
+ line.children.push(createTokenSpan(token, tokenStyle(token, cacheHtmlStyles), token.content, column, useTokenTransformer));
1343
+ column += token.content.length;
1344
+ }
1345
+ return column;
1346
+ }
1347
+ function appendDecoratedTokens(line, tokens, spans, lineIndex, useTokenTransformer, cacheHtmlStyles) {
1348
+ if (spans.length > 1) spans.sort((a, b) => {
1349
+ if (a.start.line !== b.start.line) return a.start.line - b.start.line;
1350
+ if (a.start.character !== b.start.character) return a.start.character - b.start.character;
1351
+ if (a.end.line !== b.end.line) return b.end.line - a.end.line;
1352
+ return b.end.character - a.end.character;
1353
+ });
1354
+ const lineLength = tokens.reduce((length, token) => length + token.content.length, 0);
1355
+ const boundaries = [];
1356
+ for (let order = 0; order < spans.length; order++) {
1357
+ const decoration = spans[order];
1358
+ const range = {
1359
+ decoration,
1360
+ order,
1361
+ from: decoration.start.line === lineIndex ? decoration.start.character : 0,
1362
+ to: decoration.end.line === lineIndex ? decoration.end.character : lineLength
1363
+ };
1364
+ boundaries.push({
1365
+ position: Math.max(0, Math.min(range.from, lineLength)),
1366
+ range,
1367
+ start: true
1368
+ }, {
1369
+ position: Math.max(0, Math.min(range.to, lineLength)),
1370
+ range,
1371
+ start: false
1372
+ });
1373
+ }
1374
+ boundaries.sort((a, b) => a.position - b.position);
1375
+ const active = [];
1376
+ const decorationStack = [];
1377
+ let boundaryIndex = 0;
1378
+ const updateActive = (range, add) => {
1379
+ let low = 0;
1380
+ let high = active.length;
1381
+ while (low < high) {
1382
+ const middle = low + high >>> 1;
1383
+ if (active[middle].order < range.order) low = middle + 1;
1384
+ else high = middle;
1385
+ }
1386
+ if (add) active.splice(low, 0, range);
1387
+ else if (active[low] === range) active.splice(low, 1);
1388
+ };
1389
+ const getParent = () => {
1390
+ let parent2 = line;
1391
+ let depth = 0;
1392
+ for (const range of active) {
1393
+ if (decorationStack[depth]?.range !== range) {
1394
+ decorationStack.length = depth;
1395
+ const wrapper = {
1396
+ type: "element",
1397
+ tagName: "span",
1398
+ properties: { ...range.decoration.properties },
1399
+ children: []
1400
+ };
1401
+ parent2.children.push(wrapper);
1402
+ decorationStack.push({
1403
+ range,
1404
+ node: wrapper
1405
+ });
1406
+ }
1407
+ parent2 = decorationStack[depth++].node;
1408
+ }
1409
+ decorationStack.length = depth;
1410
+ return parent2;
1411
+ };
1412
+ let parent = line;
1413
+ const advanceBoundary = (position) => {
1414
+ const first = boundaryIndex;
1415
+ while (boundaries[boundaryIndex]?.position === position) boundaryIndex++;
1416
+ let hasMarker = false;
1417
+ for (let i = first; i < boundaryIndex; i++) {
1418
+ const { range, start } = boundaries[i];
1419
+ if (!start && range.from !== range.to && position < lineLength) updateActive(range, false);
1420
+ }
1421
+ for (let i = first; i < boundaryIndex; i++) {
1422
+ const { range, start } = boundaries[i];
1423
+ if (start && range.from <= position && range.to >= position && (range.to > position || range.from === position || position === lineLength)) {
1424
+ updateActive(range, true);
1425
+ if (range.from === range.to) hasMarker = true;
1426
+ }
1427
+ }
1428
+ if (hasMarker) {
1429
+ getParent();
1430
+ for (let i = first; i < boundaryIndex; i++) {
1431
+ const { range, start } = boundaries[i];
1432
+ if (start && range.from === range.to) updateActive(range, false);
1433
+ }
1434
+ }
1435
+ if (position < lineLength) parent = getParent();
1436
+ };
1437
+ let column = 0;
1438
+ for (const token of tokens) {
1439
+ if (token.content === "") continue;
1440
+ const start = column;
1441
+ const end = start + token.content.length;
1442
+ const style = tokenStyle(token, cacheHtmlStyles);
1443
+ while (column < end) {
1444
+ if (boundaries[boundaryIndex]?.position === column) advanceBoundary(column);
1445
+ const to = Math.min(end, boundaries[boundaryIndex]?.position ?? end);
1446
+ parent.children.push(createTokenSpan(token, style, column === start && to === end ? token.content : token.content.slice(column - start, to - start), start, useTokenTransformer));
1447
+ column = to;
1448
+ }
1449
+ }
1450
+ if (boundaries[boundaryIndex]?.position === column) advanceBoundary(column);
1451
+ return column;
1452
+ }
1453
+ function createTokenSpan(token, style, text, start, useTokenTransformer) {
1454
+ const properties = token.htmlAttrs != null ? { ...token.htmlAttrs } : {};
1455
+ if (style !== "") properties.style = style;
1456
+ if (useTokenTransformer) properties["data-char"] = start;
1457
+ return {
1458
+ type: "element",
1459
+ tagName: "span",
1460
+ properties,
1461
+ children: [{
1462
+ type: "text",
1463
+ value: text
1464
+ }]
1465
+ };
1466
+ }
1467
+ function getDecorationPosition(position, lineOffsets) {
1468
+ if (typeof position !== "number") return position;
1469
+ let low = 0;
1470
+ let high = lineOffsets.length;
1471
+ while (low + 1 < high) {
1472
+ const middle = low + high >>> 1;
1473
+ if (lineOffsets[middle] <= position) low = middle;
1474
+ else high = middle;
1546
1475
  }
1547
- console.error(nodes);
1548
- throw new Error("getLineNodes: Unable to find children");
1476
+ return {
1477
+ line: low,
1478
+ character: position - (lineOffsets[low] ?? 0)
1479
+ };
1549
1480
  }
1550
1481
  const LINE_FEED = 10;
1551
1482
  const CARRIAGE_RETURN = 13;
@@ -1612,8 +1543,18 @@ function linesFromFileContents(contents) {
1612
1543
  function appendItems(target, items) {
1613
1544
  for (const item of items) target.push(item);
1614
1545
  }
1546
+ function getTokenOptions(lang, theme, tokenizeMaxLineLength) {
1547
+ return {
1548
+ lang,
1549
+ ...typeof theme === "string" ? { theme } : { themes: theme },
1550
+ defaultColor: false,
1551
+ cssVariablePrefix: formatCSSVariablePrefix("token"),
1552
+ tokenizeMaxLineLength,
1553
+ tokenizeTimeLimit: 0
1554
+ };
1555
+ }
1615
1556
  const DEFAULT_PLAIN_TEXT_OPTIONS$1 = { forcePlainText: false };
1616
- function renderFileWithHighlighter(file, highlighter2, { theme, tokenizeMaxLineLength, useTokenTransformer }, { forcePlainText, startingLine, totalLines, lines } = DEFAULT_PLAIN_TEXT_OPTIONS$1) {
1557
+ function renderFileWithHighlighter(file, highlighter2, { theme, tokenizeMaxLineLength, useTokenTransformer }, { forcePlainText, lazyLineAST = false, startingLine, totalLines, lines } = DEFAULT_PLAIN_TEXT_OPTIONS$1) {
1617
1558
  if (forcePlainText) {
1618
1559
  startingLine ??= 0;
1619
1560
  totalLines ??= Infinity;
@@ -1622,7 +1563,7 @@ function renderFileWithHighlighter(file, highlighter2, { theme, tokenizeMaxLineL
1622
1563
  totalLines = Infinity;
1623
1564
  }
1624
1565
  const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
1625
- const { state, transformers } = createTransformerWithState(useTokenTransformer);
1566
+ const state = { lineInfo: [] };
1626
1567
  const lang = forcePlainText ? "text" : file.lang ?? getFiletypeFromFileName(file.name);
1627
1568
  const baseThemeType = typeof theme === "string" ? highlighter2.getTheme(theme).type : void 0;
1628
1569
  const themeStyles = getHighlighterThemeStyles({
@@ -1634,27 +1575,12 @@ function renderFileWithHighlighter(file, highlighter2, { theme, tokenizeMaxLineL
1634
1575
  lineIndex: shikiLineNumber - 1 + startingLine,
1635
1576
  lineNumber: shikiLineNumber + startingLine
1636
1577
  });
1637
- const hastConfig = (() => {
1638
- if (typeof theme === "string") return {
1639
- lang,
1640
- theme,
1641
- transformers,
1642
- defaultColor: false,
1643
- cssVariablePrefix: formatCSSVariablePrefix("token"),
1644
- tokenizeMaxLineLength,
1645
- tokenizeTimeLimit: 0
1646
- };
1647
- return {
1648
- lang,
1649
- themes: theme,
1650
- transformers,
1651
- defaultColor: false,
1652
- cssVariablePrefix: formatCSSVariablePrefix("token"),
1653
- tokenizeMaxLineLength,
1654
- tokenizeTimeLimit: 0
1655
- };
1656
- })();
1657
- const highlightedLines = getLineNodes(highlighter2.codeToHast(normalizeHighlightLineEndings(isWindowedHighlight ? extractWindowedFileContent(lines ?? linesFromFileContents(file.contents), startingLine, totalLines) : file.contents), hastConfig));
1578
+ const highlightedLines = renderTokenLines(highlighter2.codeToTokens(normalizeHighlightLineEndings(isWindowedHighlight ? extractWindowedFileContent(lines ?? linesFromFileContents(file.contents), startingLine, totalLines) : file.contents), getTokenOptions(lang, theme, tokenizeMaxLineLength)).tokens, {
1579
+ state,
1580
+ useTokenTransformer,
1581
+ lazyLineAST: lazyLineAST && !forcePlainText && !useTokenTransformer,
1582
+ cacheHtmlStyles: highlighter2.name === "highlights"
1583
+ });
1658
1584
  const code = isWindowedHighlight ? new Array(startingLine) : highlightedLines;
1659
1585
  if (isWindowedHighlight) appendItems(code, highlightedLines);
1660
1586
  return {
@@ -2693,7 +2619,7 @@ function getChangeLineData({ hunkIndex, hunk, collapsedAfter, collapsedBefore, d
2693
2619
  };
2694
2620
  }
2695
2621
  const DEFAULT_PLAIN_TEXT_OPTIONS = { forcePlainText: false };
2696
- function renderDiffWithHighlighter(diff, highlighter2, options, { forcePlainText, startingLine, totalLines, expandedHunks, collapsedContextThreshold = 1 } = DEFAULT_PLAIN_TEXT_OPTIONS) {
2622
+ function renderDiffWithHighlighter(diff, highlighter2, options, { forcePlainText, lazyLineAST = false, startingLine, totalLines, expandedHunks, collapsedContextThreshold = 1 } = DEFAULT_PLAIN_TEXT_OPTIONS) {
2697
2623
  if (forcePlainText) {
2698
2624
  startingLine ??= 0;
2699
2625
  totalLines ??= Infinity;
@@ -2702,6 +2628,7 @@ function renderDiffWithHighlighter(diff, highlighter2, options, { forcePlainText
2702
2628
  totalLines = Infinity;
2703
2629
  }
2704
2630
  const isWindowedHighlight = startingLine > 0 || totalLines < Infinity;
2631
+ lazyLineAST &&= !forcePlainText && !options.useTokenTransformer;
2705
2632
  const baseThemeType = typeof options.theme === "string" ? highlighter2.getTheme(options.theme).type : void 0;
2706
2633
  const themeStyles = getHighlighterThemeStyles({
2707
2634
  theme: options.theme,
@@ -2796,17 +2723,27 @@ function renderDiffWithHighlighter(diff, highlighter2, options, { forcePlainText
2796
2723
  additionDecorations: bucket.additionDecorations,
2797
2724
  highlighter: highlighter2,
2798
2725
  options,
2799
- languageOverride: forcePlainText ? "text" : diff.lang
2726
+ languageOverride: forcePlainText ? "text" : diff.lang,
2727
+ lazyLineAST
2800
2728
  });
2801
2729
  if (shouldGroupAll) {
2802
2730
  code.deletionLines = deletionLines;
2803
2731
  code.additionLines = additionLines;
2804
2732
  continue;
2805
2733
  }
2806
- if (bucket.deletionSegments.length > 0) for (const seg of bucket.deletionSegments) for (let i = 0; i < seg.count; i++) code.deletionLines[seg.targetIndex + i] = deletionLines[seg.originalOffset + i];
2807
- else appendItems(code.deletionLines, deletionLines);
2808
- if (bucket.additionSegments.length > 0) for (const seg of bucket.additionSegments) for (let i = 0; i < seg.count; i++) code.additionLines[seg.targetIndex + i] = additionLines[seg.originalOffset + i];
2809
- else appendItems(code.additionLines, additionLines);
2734
+ for (const [target, lines, segments] of [[
2735
+ code.deletionLines,
2736
+ deletionLines,
2737
+ bucket.deletionSegments
2738
+ ], [
2739
+ code.additionLines,
2740
+ additionLines,
2741
+ bucket.additionSegments
2742
+ ]]) if (segments.length > 0) for (const segment of segments) for (let index = 0; index < segment.count; index++) target[segment.targetIndex + index] = lines[segment.originalOffset + index];
2743
+ else if (lazyLineAST) {
2744
+ const offset = target.length;
2745
+ for (let index = 0; index < lines.length; index++) setDeferredArrayItem(target, offset + index, () => lines[index]);
2746
+ } else appendItems(target, lines);
2810
2747
  }
2811
2748
  return {
2812
2749
  code,
@@ -2938,46 +2875,20 @@ function createBucket() {
2938
2875
  additionSegments: []
2939
2876
  };
2940
2877
  }
2941
- function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter2, deletionDecorations, additionDecorations, languageOverride, options: { theme: themeOrThemes, ...options } }) {
2942
- const deletionLang = languageOverride ?? getFiletypeFromFileName(deletionFile.name);
2943
- const additionLang = languageOverride ?? getFiletypeFromFileName(additionFile.name);
2944
- const { state, transformers } = createTransformerWithState(options.useTokenTransformer);
2945
- const hastConfig = (() => {
2946
- return typeof themeOrThemes === "string" ? {
2947
- ...options,
2948
- lang: "text",
2949
- theme: themeOrThemes,
2950
- transformers,
2951
- decorations: void 0,
2952
- defaultColor: false,
2953
- cssVariablePrefix: formatCSSVariablePrefix("token"),
2954
- tokenizeTimeLimit: 0
2955
- } : {
2956
- ...options,
2957
- lang: "text",
2958
- themes: themeOrThemes,
2959
- transformers,
2960
- decorations: void 0,
2961
- defaultColor: false,
2962
- cssVariablePrefix: formatCSSVariablePrefix("token"),
2963
- tokenizeTimeLimit: 0
2964
- };
2965
- })();
2878
+ function renderTwoFiles({ lazyLineAST, deletionFile, additionFile, deletionInfo, additionInfo, highlighter: highlighter2, deletionDecorations, additionDecorations, languageOverride, options: { theme, useTokenTransformer, tokenizeMaxLineLength } }) {
2879
+ const renderFile = (file, lineInfo, decorations) => {
2880
+ if (file.contents === "") return [];
2881
+ return renderTokenLines(highlighter2.codeToTokens(cleanLastNewline(file.contents), getTokenOptions(languageOverride ?? getFiletypeFromFileName(file.name), theme, tokenizeMaxLineLength)).tokens, {
2882
+ state: { lineInfo },
2883
+ useTokenTransformer,
2884
+ decorations,
2885
+ lazyLineAST,
2886
+ cacheHtmlStyles: highlighter2.name === "highlights"
2887
+ });
2888
+ };
2966
2889
  return {
2967
- deletionLines: (() => {
2968
- if (deletionFile.contents === "") return [];
2969
- hastConfig.lang = deletionLang;
2970
- state.lineInfo = deletionInfo;
2971
- hastConfig.decorations = deletionDecorations;
2972
- return getLineNodes(highlighter2.codeToHast(cleanLastNewline(deletionFile.contents), hastConfig));
2973
- })(),
2974
- additionLines: (() => {
2975
- if (additionFile.contents === "") return [];
2976
- hastConfig.lang = additionLang;
2977
- hastConfig.decorations = additionDecorations;
2978
- state.lineInfo = additionInfo;
2979
- return getLineNodes(highlighter2.codeToHast(cleanLastNewline(additionFile.contents), hastConfig));
2980
- })()
2890
+ deletionLines: renderFile(deletionFile, deletionInfo, deletionDecorations),
2891
+ additionLines: renderFile(additionFile, additionInfo, additionDecorations)
2981
2892
  };
2982
2893
  }
2983
2894
  function isDiffPlainText(diff) {
@@ -2994,6 +2905,38 @@ function getResolvedLanguages(languages) {
2994
2905
  }
2995
2906
  return resolvedLanguages;
2996
2907
  }
2908
+ async function resolveLanguage(lang) {
2909
+ if (typeof __DIFFS_WORKER__ !== "undefined" ? __DIFFS_WORKER__ : isWorkerContext()) throw new Error(`resolveLanguage("${lang}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);
2910
+ const pending = ResolvingLanguages.get(lang);
2911
+ if (pending != null) return pending;
2912
+ const resolver = (async () => {
2913
+ let loader = RegisteredCustomLanguages.get(lang);
2914
+ if (loader == null) {
2915
+ const { bundledLanguages } = await __vitePreload(async () => {
2916
+ const { bundledLanguages: bundledLanguages2 } = await import("./langs-BDUDFyts.js");
2917
+ return { bundledLanguages: bundledLanguages2 };
2918
+ }, true ? __vite__mapDeps([14,1,2,3,4]) : void 0, import.meta.url);
2919
+ if (Object.prototype.hasOwnProperty.call(bundledLanguages, lang)) loader = bundledLanguages[lang];
2920
+ }
2921
+ if (loader == null) throw new Error(`resolveLanguage: "${lang}" not found in bundled or custom languages`);
2922
+ const { default: data } = await loader();
2923
+ const resolvedLang = {
2924
+ name: lang,
2925
+ data
2926
+ };
2927
+ if (!ResolvedLanguages.has(lang)) ResolvedLanguages.set(lang, resolvedLang);
2928
+ return resolvedLang;
2929
+ })();
2930
+ ResolvingLanguages.set(lang, resolver);
2931
+ try {
2932
+ return await resolver;
2933
+ } finally {
2934
+ if (ResolvingLanguages.get(lang) === resolver) ResolvingLanguages.delete(lang);
2935
+ }
2936
+ }
2937
+ function getResolvedOrResolveLanguage(language) {
2938
+ return ResolvedLanguages.get(language) ?? resolveLanguage(language);
2939
+ }
2997
2940
  function hasResolvedLanguages(languages) {
2998
2941
  for (const language of Array.isArray(languages) ? languages : [languages]) if (!ResolvedLanguages.has(language)) return false;
2999
2942
  return true;
@@ -3015,14 +2958,79 @@ async function resolveLanguages(languages) {
3015
2958
  });
3016
2959
  return resolvedLanguages;
3017
2960
  }
3018
- function getResolvedThemes(themeNames) {
3019
- return themeResolver.getResolvedThemes(themeNames);
3020
- }
3021
- async function resolveThemes(themes) {
3022
- for (const themeName of themes) prepareThemeResolution(themeName);
3023
- const resolvedThemes = await themeResolver.resolveThemes(themes);
3024
- for (let i = 0; i < themes.length; i++) validateResolvedThemeName(themes[i], resolvedThemes[i]);
3025
- return resolvedThemes;
2961
+ function getResolvedThemes(themeNames, backend = resolveHighlighterType()) {
2962
+ return createDiffsThemeResolver(backend).getResolvedThemes(themeNames);
2963
+ }
2964
+ function hasResolvedThemes(themeNames, backend = resolveHighlighterType()) {
2965
+ return createDiffsThemeResolver(backend).hasResolvedThemes(themeNames);
2966
+ }
2967
+ function resolveThemes(themes, backend = resolveHighlighterType()) {
2968
+ return createDiffsThemeResolver(backend).resolveThemes(themes);
2969
+ }
2970
+ const HOLE = 0;
2971
+ const TEXT = 1;
2972
+ const ELEMENT = 2;
2973
+ const STRING = 4;
2974
+ const INTEGER = 5;
2975
+ const EXTRA = 6;
2976
+ const PRIMITIVES = [
2977
+ void 0,
2978
+ null,
2979
+ true,
2980
+ false
2981
+ ];
2982
+ function decodeHastLines(encoded) {
2983
+ if (Array.isArray(encoded)) return encoded;
2984
+ const { ops, offsets, strings, text, extras } = encoded;
2985
+ const lines = new Array(offsets.length / 2);
2986
+ let position = 0;
2987
+ let textPosition = 0;
2988
+ function decodeNodes(count) {
2989
+ const nodes = new Array(count);
2990
+ for (let index = 0; index < count; index++) {
2991
+ const kind = ops[position++];
2992
+ if (kind === HOLE) continue;
2993
+ if (kind === TEXT) {
2994
+ const end = textPosition + ops[position++];
2995
+ nodes[index] = {
2996
+ type: "text",
2997
+ value: text.slice(textPosition, end)
2998
+ };
2999
+ textPosition = end;
3000
+ } else if (kind === ELEMENT) {
3001
+ const tagName = strings[ops[position++]];
3002
+ const properties = {};
3003
+ for (let remaining = ops[position++]; remaining > 0; remaining--) {
3004
+ const key = strings[ops[position++]];
3005
+ const type = ops[position++];
3006
+ const value = type === STRING ? strings[ops[position++]] : type === INTEGER ? ops[position++] : type === EXTRA ? extras[ops[position++]] : PRIMITIVES[type];
3007
+ if (key === "__proto__") Object.defineProperty(properties, key, {
3008
+ value,
3009
+ enumerable: true,
3010
+ configurable: true,
3011
+ writable: true
3012
+ });
3013
+ else properties[key] = value;
3014
+ }
3015
+ nodes[index] = {
3016
+ type: "element",
3017
+ tagName,
3018
+ properties,
3019
+ children: decodeNodes(ops[position++])
3020
+ };
3021
+ } else nodes[index] = extras[ops[position++]];
3022
+ }
3023
+ return nodes;
3024
+ }
3025
+ for (let index = 0; index < lines.length; index++) {
3026
+ if (ops[offsets[index * 2]] === HOLE) continue;
3027
+ setDeferredArrayItem(lines, index, () => {
3028
+ position = offsets[index * 2];
3029
+ textPosition = offsets[index * 2 + 1];
3030
+ return decodeNodes(1)[0];
3031
+ }, { retain: false });
3032
+ }
3033
+ return lines;
3026
3034
  }
3027
3035
  var lru$1 = { exports: {} };
3028
3036
  var lru = lru$1.exports;
@@ -3147,7 +3155,6 @@ const IGNORE_RESPONSE = /* @__PURE__ */ Symbol("IGNORE_RESPONSE");
3147
3155
  const DEFAULT_WORKER_INITIALIZATION_TIMEOUT = 1e4;
3148
3156
  var WorkerPoolManager = class {
3149
3157
  options;
3150
- highlighter;
3151
3158
  preferredHighlighter;
3152
3159
  renderOptions;
3153
3160
  renderOptionsRequestVersion = 0;
@@ -3162,14 +3169,15 @@ var WorkerPoolManager = class {
3162
3169
  nextRequestId = 0;
3163
3170
  themeSubscribers = /* @__PURE__ */ new Set();
3164
3171
  workersFailed = false;
3172
+ terminated = false;
3165
3173
  statSubscribers = /* @__PURE__ */ new Set();
3166
3174
  fileCache;
3167
3175
  diffCache;
3168
3176
  _queuedBroadcast;
3169
3177
  lifecycleGeneration = 0;
3170
- constructor(options, { langs, theme = DEFAULT_THEMES, useTokenTransformer = false, lineDiffType = "word-alt", maxLineDiffLength = 1e3, tokenizeMaxLineLength = 1e3, preferredHighlighter = "shiki-js" }) {
3178
+ constructor(options, { langs, theme = DEFAULT_THEMES, useTokenTransformer = false, lineDiffType = "word-alt", maxLineDiffLength = 1e3, tokenizeMaxLineLength = 1e3, preferredHighlighter }) {
3171
3179
  this.options = options;
3172
- this.preferredHighlighter = preferredHighlighter;
3180
+ this.preferredHighlighter = resolveHighlighterType(preferredHighlighter);
3173
3181
  this.renderOptions = {
3174
3182
  theme,
3175
3183
  useTokenTransformer,
@@ -3182,7 +3190,16 @@ var WorkerPoolManager = class {
3182
3190
  this.queueInitialization(langs);
3183
3191
  }
3184
3192
  isWorkingPool() {
3185
- return !this.workersFailed;
3193
+ return !this.workersFailed && !this.terminated;
3194
+ }
3195
+ /**
3196
+ * Whether a file or diff fits within `mainThreadMaxCharacters`, so it
3197
+ * highlights on the main thread instead of a worker. Files count `contents`;
3198
+ * diffs count both sides.
3199
+ */
3200
+ shouldHighlightOnMainThread(fileOrDiff) {
3201
+ const { mainThreadMaxCharacters = -1 } = this.options;
3202
+ return ("contents" in fileOrDiff ? fileOrDiff.contents.length : fileOrDiff.deletionCharacterCount + fileOrDiff.additionCharacterCount) <= mainThreadMaxCharacters;
3186
3203
  }
3187
3204
  getFileResultCache(file) {
3188
3205
  return file.cacheKey != null ? this.fileCache.get(file.cacheKey) : void 0;
@@ -3190,6 +3207,24 @@ var WorkerPoolManager = class {
3190
3207
  getDiffResultCache(diff) {
3191
3208
  return diff.cacheKey != null ? this.diffCache.get(diff.cacheKey) : void 0;
3192
3209
  }
3210
+ setFileResultCache(cacheKey, { result, options }) {
3211
+ if (cacheKey == null || !areFileRenderOptionsEqual(options, this.getFileRenderOptions())) return false;
3212
+ this.fileCache.set(cacheKey, {
3213
+ result,
3214
+ options
3215
+ });
3216
+ this.queueBroadcastStateChanges();
3217
+ return true;
3218
+ }
3219
+ setDiffResultCache(cacheKey, { result, options }) {
3220
+ if (cacheKey == null || !areDiffRenderOptionsEqual(options, this.getDiffRenderOptions())) return false;
3221
+ this.diffCache.set(cacheKey, {
3222
+ result,
3223
+ options
3224
+ });
3225
+ this.queueBroadcastStateChanges();
3226
+ return true;
3227
+ }
3193
3228
  inspectCaches() {
3194
3229
  const { fileCache, diffCache } = this;
3195
3230
  return {
@@ -3223,24 +3258,19 @@ var WorkerPoolManager = class {
3223
3258
  maxLineDiffLength,
3224
3259
  tokenizeMaxLineLength
3225
3260
  };
3226
- if (!this.isInitialized()) await this.initialize();
3261
+ if (!this.isInitialized()) try {
3262
+ await this.initialize();
3263
+ } catch (error) {
3264
+ if (!this.workersFailed) throw error;
3265
+ }
3227
3266
  if (!isCurrentRequest() || areDiffRenderOptionsEqual(newRenderOptions, this.renderOptions)) return;
3228
3267
  const themeNames = getThemes(theme);
3229
3268
  let resolvedThemes = [];
3230
- if (!areThemesEqual(newRenderOptions.theme, this.renderOptions.theme)) {
3231
- if (hasResolvedThemes(themeNames)) resolvedThemes = getResolvedThemes(themeNames);
3232
- else resolvedThemes = await resolveThemes(themeNames);
3233
- }
3269
+ if (!areThemesEqual(newRenderOptions.theme, this.renderOptions.theme)) resolvedThemes = hasResolvedThemes(themeNames, this.preferredHighlighter) ? getResolvedThemes(themeNames, this.preferredHighlighter) : await resolveThemes(themeNames, this.preferredHighlighter);
3234
3270
  if (!isCurrentRequest()) return;
3235
- if (this.highlighter != null) attachResolvedThemes(resolvedThemes, this.highlighter);
3236
- else {
3237
- const highlighter2 = await getSharedHighlighter({
3238
- themes: themeNames,
3239
- langs: ["text"],
3240
- preferredHighlighter: this.preferredHighlighter
3241
- });
3271
+ if (getHighlighterIfLoaded({ theme }) == null) {
3272
+ await this.loadSharedHighlighter(themeNames, ["text"]);
3242
3273
  if (!isCurrentRequest()) return;
3243
- this.highlighter = highlighter2;
3244
3274
  }
3245
3275
  const workerSetup = this.setRenderOptionsOnWorkers(newRenderOptions, resolvedThemes);
3246
3276
  this.renderOptions = newRenderOptions;
@@ -3348,41 +3378,34 @@ var WorkerPoolManager = class {
3348
3378
  return this.initialized === true;
3349
3379
  }
3350
3380
  async initialize(languages = []) {
3351
- if (this.initialized === true) return;
3352
- else if (this.initialized === false) {
3381
+ if (this.initialized === true) {
3382
+ if (getHighlighterIfLoaded({ theme: this.renderOptions.theme }) == null) await this.loadSharedHighlighter(getThemes(this.renderOptions.theme), ["text", ...languages]);
3383
+ return;
3384
+ } else if (this.initialized === false) {
3385
+ this.terminated = false;
3353
3386
  const { lifecycleGeneration } = this;
3354
3387
  const initialization = new Promise((resolve, reject) => {
3355
3388
  (async () => {
3356
3389
  try {
3357
3390
  const themes = getThemes(this.renderOptions.theme);
3358
- let resolvedThemes = [];
3359
- if (hasResolvedThemes(themes)) resolvedThemes = getResolvedThemes(themes);
3360
- else resolvedThemes = await resolveThemes(themes);
3391
+ const resolvedThemes = hasResolvedThemes(themes, this.preferredHighlighter) ? getResolvedThemes(themes, this.preferredHighlighter) : await resolveThemes(themes, this.preferredHighlighter);
3361
3392
  if (!this.isCurrentLifecycle(lifecycleGeneration)) {
3362
3393
  resolve();
3363
3394
  return;
3364
3395
  }
3365
3396
  let resolvedLanguages = [];
3366
- if (hasResolvedLanguages(languages)) resolvedLanguages = getResolvedLanguages(languages);
3367
- else resolvedLanguages = await resolveLanguages(languages);
3397
+ if (this.preferredHighlighter !== "highlights") resolvedLanguages = hasResolvedLanguages(languages) ? getResolvedLanguages(languages) : await resolveLanguages(languages);
3368
3398
  if (!this.isCurrentLifecycle(lifecycleGeneration)) {
3369
3399
  resolve();
3370
3400
  return;
3371
3401
  }
3372
- const [highlighter2] = await Promise.all([getSharedHighlighter({
3373
- themes,
3374
- langs: ["text", ...languages],
3375
- preferredHighlighter: this.preferredHighlighter
3376
- }), this.initializeWorkers(resolvedThemes, resolvedLanguages)]);
3402
+ await Promise.all([this.loadSharedHighlighter(themes, ["text", ...languages]), this.initializeWorkers(resolvedThemes, resolvedLanguages)]);
3377
3403
  if (!this.isCurrentLifecycle(lifecycleGeneration)) {
3378
3404
  this.terminateWorkers();
3379
3405
  resolve();
3380
3406
  return;
3381
3407
  }
3382
- this.highlighter = highlighter2;
3383
3408
  this.initialized = true;
3384
- this.diffCache.clear();
3385
- this.fileCache.clear();
3386
3409
  this.drainQueue();
3387
3410
  this.queueBroadcastStateChanges();
3388
3411
  resolve();
@@ -3407,6 +3430,17 @@ var WorkerPoolManager = class {
3407
3430
  return initialization;
3408
3431
  } else return this.initialized;
3409
3432
  }
3433
+ async loadSharedHighlighter(themes, langs) {
3434
+ try {
3435
+ await getSharedHighlighter({
3436
+ themes,
3437
+ langs,
3438
+ preferredHighlighter: this.preferredHighlighter
3439
+ });
3440
+ } catch (error) {
3441
+ if (!(error instanceof HighlighterDisposedError)) throw error;
3442
+ }
3443
+ }
3410
3444
  async initializeWorkers(resolvedThemes, resolvedLanguages) {
3411
3445
  this.workersFailed = false;
3412
3446
  const initPromises = [];
@@ -3435,6 +3469,7 @@ var WorkerPoolManager = class {
3435
3469
  id,
3436
3470
  request: {
3437
3471
  type: "initialize",
3472
+ resultFormat: "hast-ops-v1",
3438
3473
  id,
3439
3474
  renderOptions: this.renderOptions,
3440
3475
  preferredHighlighter: this.preferredHighlighter,
@@ -3501,7 +3536,7 @@ var WorkerPoolManager = class {
3501
3536
  i++;
3502
3537
  continue;
3503
3538
  }
3504
- const langs = getLangsFromTask(task);
3539
+ const langs = getLangsFromRequest(task.request);
3505
3540
  const availableWorker = this.getAvailableWorker(langs);
3506
3541
  if (availableWorker == null) break;
3507
3542
  this.queuedTasks.splice(i, 1);
@@ -3520,35 +3555,52 @@ var WorkerPoolManager = class {
3520
3555
  }
3521
3556
  primeFileHighlightCache(file) {
3522
3557
  if (!this.isWorkingPool()) return Promise.reject(/* @__PURE__ */ new Error("WorkerPoolManager.primeFileHighlightCache: worker pool is not working"));
3558
+ if (!this.shouldPrimeFileHighlightCache(file)) return Promise.resolve();
3559
+ if (this.shouldHighlightOnMainThread(file)) {
3560
+ const options = this.getFileRenderOptions();
3561
+ return this.primeHighlightCacheOnMainThread(getLangsFromRequest({
3562
+ type: "file",
3563
+ file
3564
+ }), options.theme, (highlighter2) => this.setFileResultCache(file.cacheKey, {
3565
+ result: renderFileWithHighlighter(file, highlighter2, options),
3566
+ options
3567
+ }));
3568
+ }
3523
3569
  const task = this.getOrCreateFileHighlightCacheTask(file);
3524
3570
  return task != null ? this.createRenderTaskCallbacks(task) : Promise.resolve();
3525
3571
  }
3526
- getOrCreateFileHighlightCacheTask(file) {
3572
+ shouldPrimeFileHighlightCache(file) {
3527
3573
  if (file.cacheKey == null) {
3528
3574
  console.warn(`WorkerPoolManager.primeFileHighlightCache: priming highlight cache requires file.cacheKey; skipping "${file.name}".`);
3529
- return;
3575
+ return false;
3530
3576
  }
3531
3577
  const cachedResult = this.getFileResultCache(file);
3578
+ return !isFilePlainText(file) && (cachedResult == null || !areFileRenderOptionsEqual(cachedResult.options, this.getFileRenderOptions()));
3579
+ }
3580
+ getOrCreateFileHighlightCacheTask(file) {
3532
3581
  const highlightKey = this.getFileHighlightKey(file);
3533
- if (highlightKey == null || isFilePlainText(file) || cachedResult != null && areFileRenderOptionsEqual(cachedResult.options, this.getFileRenderOptions())) return;
3582
+ if (highlightKey == null) return;
3534
3583
  const existingTask = this.getTaskByHighlightKey(highlightKey);
3535
3584
  if (existingTask != null) {
3585
+ if (existingTask.type !== "file") throw new Error("WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task type");
3536
3586
  existingTask.primeCache = true;
3537
- return existingTask.type === "file" ? existingTask : void 0;
3587
+ return existingTask;
3538
3588
  } else {
3539
3589
  const task = this.submitCacheTask({
3540
3590
  type: "file",
3541
3591
  file
3542
3592
  }, highlightKey);
3543
- return task.type === "file" ? task : void 0;
3593
+ if (task.type !== "file") throw new Error("WorkerPoolManager.getOrCreateFileHighlightCacheTask: Invalid task created");
3594
+ return task;
3544
3595
  }
3545
3596
  }
3546
3597
  getPlainFileAST(file, startingLine, totalLines, lines) {
3547
- if (this.highlighter == null) {
3598
+ const highlighter2 = getHighlighterIfLoaded({ theme: this.renderOptions.theme });
3599
+ if (highlighter2 == null) {
3548
3600
  this.queueInitialization();
3549
3601
  return;
3550
3602
  }
3551
- return renderFileWithHighlighter(file, this.highlighter, this.renderOptions, {
3603
+ return renderFileWithHighlighter(file, highlighter2, this.renderOptions, {
3552
3604
  forcePlainText: true,
3553
3605
  startingLine,
3554
3606
  totalLines,
@@ -3565,37 +3617,73 @@ var WorkerPoolManager = class {
3565
3617
  }
3566
3618
  primeDiffHighlightCache(diff) {
3567
3619
  if (!this.isWorkingPool()) return Promise.reject(/* @__PURE__ */ new Error("WorkerPoolManager.primeDiffHighlightCache: worker pool is not working"));
3620
+ if (!this.shouldPrimeDiffHighlightCache(diff)) return Promise.resolve();
3621
+ if (this.shouldHighlightOnMainThread(diff)) {
3622
+ const options = this.getDiffRenderOptions();
3623
+ return this.primeHighlightCacheOnMainThread(getLangsFromRequest({
3624
+ type: "diff",
3625
+ diff
3626
+ }), options.theme, (highlighter2) => this.setDiffResultCache(diff.cacheKey, {
3627
+ result: renderDiffWithHighlighter(diff, highlighter2, options),
3628
+ options
3629
+ }));
3630
+ }
3568
3631
  const task = this.getOrCreateDiffHighlightCacheTask(diff);
3569
3632
  return task != null ? this.createRenderTaskCallbacks(task) : Promise.resolve();
3570
3633
  }
3571
- getOrCreateDiffHighlightCacheTask(diff) {
3634
+ shouldPrimeDiffHighlightCache(diff) {
3572
3635
  if (diff.cacheKey == null) {
3573
3636
  console.warn(`WorkerPoolManager.primeDiffHighlightCache: priming highlight cache requires diff.cacheKey; skipping "${diff.prevName ?? diff.name}" -> "${diff.name}".`);
3574
- return;
3637
+ return false;
3575
3638
  }
3576
3639
  const cachedResult = this.getDiffResultCache(diff);
3640
+ return !isDiffPlainText(diff) && (cachedResult == null || !areDiffRenderOptionsEqual(cachedResult.options, this.getDiffRenderOptions()));
3641
+ }
3642
+ primeHighlightCacheOnMainThread(langs, theme, highlightAndCacheResult) {
3643
+ function highlightAndCacheIfLoaded() {
3644
+ const highlighter2 = getHighlighterIfLoaded({
3645
+ theme,
3646
+ langs
3647
+ });
3648
+ return highlighter2 != null && highlightAndCacheResult(highlighter2);
3649
+ }
3650
+ if (highlightAndCacheIfLoaded()) return Promise.resolve();
3651
+ const { lifecycleGeneration } = this;
3652
+ return this.loadSharedHighlighter(getThemes(theme), ["text", ...langs]).then(() => {
3653
+ if (!this.isCurrentLifecycle(lifecycleGeneration)) throw new WorkerPoolTerminatedError();
3654
+ if (!highlightAndCacheIfLoaded()) throw new WorkerPoolTaskCanceledError();
3655
+ });
3656
+ }
3657
+ getOrCreateDiffHighlightCacheTask(diff) {
3577
3658
  const highlightKey = this.getDiffHighlightKey(diff);
3578
- if (highlightKey == null || isDiffPlainText(diff) || cachedResult != null && areDiffRenderOptionsEqual(cachedResult.options, this.getDiffRenderOptions())) return;
3659
+ if (highlightKey == null) return;
3579
3660
  const existingTask = this.getTaskByHighlightKey(highlightKey);
3580
3661
  if (existingTask != null) {
3662
+ if (existingTask.type !== "diff") throw new Error("WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task type");
3581
3663
  existingTask.primeCache = true;
3582
- return existingTask.type === "diff" ? existingTask : void 0;
3664
+ return existingTask;
3583
3665
  } else {
3584
3666
  const task = this.submitCacheTask({
3585
3667
  type: "diff",
3586
3668
  diff
3587
3669
  }, highlightKey);
3588
- return task.type === "diff" ? task : void 0;
3670
+ if (task.type !== "diff") throw new Error("WorkerPoolManager.getOrCreateDiffHighlightCacheTask: Invalid task created");
3671
+ return task;
3589
3672
  }
3590
3673
  }
3591
3674
  getPlainDiffAST(diff, startingLine, totalLines, expandedHunks, collapsedContextThreshold) {
3592
- return this.highlighter != null ? renderDiffWithHighlighter(diff, this.highlighter, this.renderOptions, {
3675
+ const highlighter2 = getHighlighterIfLoaded({ theme: this.renderOptions.theme });
3676
+ if (highlighter2 == null) {
3677
+ this.queueInitialization();
3678
+ return;
3679
+ }
3680
+ return renderDiffWithHighlighter(diff, highlighter2, this.renderOptions, {
3593
3681
  forcePlainText: true,
3594
3682
  startingLine,
3595
3683
  totalLines,
3596
3684
  expandedHunks,
3597
3685
  collapsedContextThreshold
3598
- }) : void 0;
3686
+ });
3599
3687
  }
3600
3688
  terminate() {
3601
3689
  this.lifecycleGeneration++;
@@ -3610,9 +3698,9 @@ var WorkerPoolManager = class {
3610
3698
  this.queuedTaskByInstance.clear();
3611
3699
  this.taskByHighlightKey.clear();
3612
3700
  this.activeTaskById.clear();
3613
- this.highlighter = void 0;
3614
3701
  this.initialized = false;
3615
3702
  this.workersFailed = false;
3703
+ this.terminated = true;
3616
3704
  this.queueBroadcastStateChanges();
3617
3705
  }
3618
3706
  isCurrentLifecycle(lifecycleGeneration) {
@@ -3750,15 +3838,12 @@ var WorkerPoolManager = class {
3750
3838
  }
3751
3839
  async resolveLanguagesAndExecuteTask(availableWorker, task, langs) {
3752
3840
  try {
3753
- const mainThreadLangs = langs.filter((lang) => !areLanguagesAttached(lang));
3754
- if (mainThreadLangs.length > 0) getSharedHighlighter({
3755
- themes: getThemes(this.renderOptions.theme),
3756
- langs: ["text", ...mainThreadLangs],
3757
- preferredHighlighter: this.preferredHighlighter
3758
- }).catch((error) => {
3841
+ const highlighter2 = getHighlighterIfLoaded();
3842
+ const mainThreadLangs = langs.filter((lang) => highlighter2 == null || !areLanguagesAttached(lang, highlighter2));
3843
+ if (mainThreadLangs.length > 0) this.loadSharedHighlighter(getThemes(this.renderOptions.theme), ["text", ...mainThreadLangs]).catch((error) => {
3759
3844
  console.error(error);
3760
3845
  });
3761
- const workerMissingLangs = langs.filter((lang) => !availableWorker.langs.has(lang));
3846
+ const workerMissingLangs = this.preferredHighlighter === "highlights" ? [] : langs.filter((lang) => !availableWorker.langs.has(lang));
3762
3847
  if (workerMissingLangs.length > 0) {
3763
3848
  if (hasResolvedLanguages(workerMissingLangs)) task.request.resolvedLanguages = getResolvedLanguages(workerMissingLangs);
3764
3849
  else task.request.resolvedLanguages = await resolveLanguages(workerMissingLangs);
@@ -3806,9 +3891,13 @@ var WorkerPoolManager = class {
3806
3891
  break;
3807
3892
  case "file": {
3808
3893
  if (task.type !== "file") throw new Error("handleWorkerMessage: task/response dont match");
3809
- const { result, options } = response;
3894
+ const { options } = response;
3810
3895
  if (!this.isCurrentRenderTask(task) || !areFileRenderOptionsEqual(options, this.getFileRenderOptions())) throw IGNORE_RESPONSE;
3811
3896
  const { request } = task;
3897
+ const result = {
3898
+ ...response.result,
3899
+ code: decodeHastLines(response.result.code)
3900
+ };
3812
3901
  this.syncCustomExtensionVersion(managedWorker, request);
3813
3902
  if (task.cacheKeyAtDispatch != null) this.fileCache.set(task.cacheKeyAtDispatch, {
3814
3903
  result,
@@ -3820,9 +3909,16 @@ var WorkerPoolManager = class {
3820
3909
  }
3821
3910
  case "diff": {
3822
3911
  if (task.type !== "diff") throw new Error("handleWorkerMessage: task/response dont match");
3823
- const { result, options } = response;
3912
+ const { options } = response;
3824
3913
  if (!this.isCurrentRenderTask(task) || !areDiffRenderOptionsEqual(options, this.getDiffRenderOptions())) throw IGNORE_RESPONSE;
3825
3914
  const { request } = task;
3915
+ const result = {
3916
+ ...response.result,
3917
+ code: {
3918
+ deletionLines: decodeHastLines(response.result.code.deletionLines),
3919
+ additionLines: decodeHastLines(response.result.code.additionLines)
3920
+ }
3921
+ };
3826
3922
  this.syncCustomExtensionVersion(managedWorker, request);
3827
3923
  if (task.cacheKeyAtDispatch != null) this.diffCache.set(task.cacheKeyAtDispatch, {
3828
3924
  result,
@@ -4031,16 +4127,15 @@ var WorkerPoolManager = class {
4031
4127
  function shouldSyncCustomExtensions(request) {
4032
4128
  return request.type === "initialize" || request.type === "file" || request.type === "diff";
4033
4129
  }
4034
- function getLangsFromTask(task) {
4130
+ function getLangsFromRequest(request) {
4035
4131
  const langs = /* @__PURE__ */ new Set();
4036
- if (task.type === "initialize" || task.type === "set-render-options") return [];
4037
- switch (task.type) {
4132
+ switch (request.type) {
4038
4133
  case "file":
4039
- langs.add(task.request.file.lang ?? getFiletypeFromFileName(task.request.file.name));
4134
+ langs.add(request.file.lang ?? getFiletypeFromFileName(request.file.name));
4040
4135
  break;
4041
4136
  case "diff":
4042
- langs.add(task.request.diff.lang ?? getFiletypeFromFileName(task.request.diff.name));
4043
- langs.add(task.request.diff.lang ?? getFiletypeFromFileName(task.request.diff.prevName ?? "-"));
4137
+ langs.add(request.diff.lang ?? getFiletypeFromFileName(request.diff.name));
4138
+ langs.add(request.diff.lang ?? getFiletypeFromFileName(request.diff.prevName ?? "-"));
4044
4139
  }
4045
4140
  langs.delete("text");
4046
4141
  return Array.from(langs);
@@ -4118,7 +4213,7 @@ const DIFFS_HOST_STYLE = {
4118
4213
  "--diffs-bg-deletion-emphasis-override": "var(--zg-diff-remove-content-bg)",
4119
4214
  "--diffs-bg-deletion-number-override": "var(--zg-diff-remove-bg)",
4120
4215
  "--diffs-fg-number-override": "var(--zg-text-subtle)",
4121
- // Editor selection colour (pierre reads the shiki theme's editor.selectionBackground, often unset).
4216
+ // Editor selection colour (pierre reads the code theme's selection colour, often unset).
4122
4217
  "--diffs-editor-selection-bg": "color-mix(in srgb, var(--zg-accent) 28%, transparent)",
4123
4218
  "--diffs-fg-number-addition-override": "var(--zg-diff-add-fg)",
4124
4219
  "--diffs-fg-number-deletion-override": "var(--zg-diff-remove-fg)",
@@ -4130,14 +4225,15 @@ const DIFFS_HOST_STYLE = {
4130
4225
  "--diffs-font-size": "var(--zg-font-size-code)",
4131
4226
  "--diffs-line-height": "calc(var(--zg-font-size-code) * 1.65)"
4132
4227
  };
4133
- const PREFERRED_HIGHLIGHTER = "shiki-wasm";
4228
+ const PREFERRED_HIGHLIGHTER = "highlights";
4134
4229
  const VIRTUALIZER_CONFIG = { overscrollSize: 600, intersectionObserverMargin: 1200 };
4135
4230
  const DIFFS_UNSAFE_CSS = `
4136
4231
  /* One hover surface: findings ride in our HoverCard; keep pierre's squiggles, drop its popover. */
4137
4232
  [data-marker-popover] { display: none !important; }
4138
4233
  [data-diffs-header] {
4139
4234
  min-height: 32px;
4140
- padding-inline: 10px 12px;
4235
+ /* A host lines the icon up with its own column (the Diffs tab, under its file tree). */
4236
+ padding-inline: var(--zg-diff-header-inset, 10px) 12px;
4141
4237
  font-size: var(--zg-font-size-label);
4142
4238
  border-bottom: 1px solid var(--zg-hairline);
4143
4239
  background: var(--zg-tray);
@@ -4226,87 +4322,100 @@ const TREES_UNSAFE_CSS = `
4226
4322
  [data-truncate-marker] { --truncate-marker-background-overlay-color: transparent; }
4227
4323
  `;
4228
4324
  export {
4229
- COMMIT_METADATA_SPLIT as $,
4230
- areThemesEqual as A,
4231
- isHandledWorkerPoolError as B,
4232
- CUSTOM_HEADER_SLOT_ID as C,
4325
+ WorkerPoolContext as $,
4326
+ AttachedLanguages as A,
4327
+ areLanguagesAttached as B,
4328
+ renderFileWithHighlighter as C,
4233
4329
  DEFAULT_THEMES as D,
4234
- EMPTY_RENDER_RANGE as E,
4235
- HEADER_FILENAME_SUFFIX_SLOT_ID as F,
4236
- HEADER_METADATA_SLOT_ID as G,
4237
- HEADER_PREFIX_SLOT_ID as H,
4238
- DEFAULT_VIRTUAL_FILE_METRICS as I,
4239
- computeVirtualFileMetrics as J,
4240
- getVirtualFileHeaderHeight as K,
4241
- getVirtualFileHeaderRegion as L,
4242
- getVirtualFilePaddingBottom as M,
4243
- WorkerPoolContext as N,
4244
- DIFFS_TAG_NAME as O,
4330
+ createGutterGap as E,
4331
+ createGutterItem as F,
4332
+ createHastElement as G,
4333
+ HighlighterDisposedError as H,
4334
+ getSharedHighlighter as I,
4335
+ createGutterWrapper as J,
4336
+ EMPTY_LINE_ANNOTATIONS as K,
4337
+ areThemesEqual as L,
4338
+ getThemes as M,
4339
+ EMPTY_RENDER_RANGE as N,
4340
+ isHandledWorkerPoolError as O,
4245
4341
  PREFERRED_HIGHLIGHTER as P,
4246
- computeLineOffsets as Q,
4247
- countLineBreaks as R,
4248
- LRUMapPkg as S,
4249
- DIFFS_UNSAFE_CSS as T,
4250
- DIFFS_HOST_STYLE as U,
4251
- VIRTUALIZER_CONFIG as V,
4342
+ CUSTOM_HEADER_SLOT_ID as Q,
4343
+ ResolvedLanguages as R,
4344
+ HEADER_PREFIX_SLOT_ID as S,
4345
+ HEADER_FILENAME_SUFFIX_SLOT_ID as T,
4346
+ HEADER_METADATA_SLOT_ID as U,
4347
+ DEFAULT_VIRTUAL_FILE_METRICS as V,
4252
4348
  WorkerPoolContextProvider as W,
4253
- DEFAULT_TOKENIZE_MAX_LENGTH as X,
4254
- SPLIT_WITH_NEWLINES as Y,
4255
- getHunkSideStartBoundary as Z,
4256
- getHunkSideEndBoundary as _,
4257
- isDarkSurface as a,
4258
- GIT_DIFF_FILE_BREAK_REGEX as a0,
4259
- FILENAME_HEADER_REGEX as a1,
4260
- INDEX_LINE_METADATA as a2,
4261
- cleanLastNewline as a3,
4262
- Diff as a4,
4263
- createTextNodeElement as a5,
4264
- createIconElement as a6,
4265
- hasTrailingContextMismatch as a7,
4266
- getExpandedRegion as a8,
4267
- getTrailingExpandedRegion as a9,
4268
- areDiffTargetsEqual as aa,
4269
- areDiffRenderOptionsEqual as ab,
4270
- isDiffPlainText as ac,
4271
- DEFAULT_EXPANDED_REGION as ad,
4272
- renderDiffWithHighlighter as ae,
4273
- iterateOverDiff as af,
4274
- getTrailingContextRangeSize as ag,
4275
- isAdditionLineRenderable as ah,
4276
- getNearestRenderableAdditionLine as ai,
4277
- getHunkAdditionLineRange as aj,
4278
- areFilesEqual as ak,
4279
- getLeadingHunkSeparatorLayout as al,
4280
- getTrailingHunkSeparatorLayout as am,
4281
- UNSAFE_CSS_ATTRIBUTE as an,
4282
- DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE as ao,
4283
- DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY as ap,
4284
- THEME_CSS_ATTRIBUTE as aq,
4285
- TREES_HOST_STYLE as ar,
4286
- TREES_UNSAFE_CSS as as,
4287
- compositeOverBg as b,
4288
- contrastRatio as c,
4289
- deriveMutedFg as d,
4290
- areThemesAttached as e,
4291
- areFileRenderOptionsEqual as f,
4292
- getHighlighterIfLoaded as g,
4293
- hoverWouldEraseText as h,
4349
+ computeVirtualFileMetrics as X,
4350
+ getVirtualFileHeaderHeight as Y,
4351
+ getVirtualFileHeaderRegion as Z,
4352
+ getVirtualFilePaddingBottom as _,
4353
+ appendItems as a,
4354
+ DIFFS_TAG_NAME as a0,
4355
+ computeLineOffsets as a1,
4356
+ countLineBreaks as a2,
4357
+ LRUMapPkg as a3,
4358
+ DIFFS_UNSAFE_CSS as a4,
4359
+ DIFFS_HOST_STYLE as a5,
4360
+ VIRTUALIZER_CONFIG as a6,
4361
+ DEFAULT_TOKENIZE_MAX_LENGTH as a7,
4362
+ SPLIT_WITH_NEWLINES as a8,
4363
+ getHunkSideStartBoundary as a9,
4364
+ UNSAFE_CSS_ATTRIBUTE as aA,
4365
+ DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE as aB,
4366
+ DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY as aC,
4367
+ THEME_CSS_ATTRIBUTE as aD,
4368
+ TREES_HOST_STYLE as aE,
4369
+ TREES_UNSAFE_CSS as aF,
4370
+ getHunkSideEndBoundary as aa,
4371
+ COMMIT_METADATA_SPLIT as ab,
4372
+ GIT_DIFF_FILE_BREAK_REGEX as ac,
4373
+ FILENAME_HEADER_REGEX as ad,
4374
+ INDEX_LINE_METADATA as ae,
4375
+ cleanLastNewline as af,
4376
+ Diff as ag,
4377
+ createTextNodeElement as ah,
4378
+ createIconElement as ai,
4379
+ hasTrailingContextMismatch as aj,
4380
+ getExpandedRegion as ak,
4381
+ getTrailingExpandedRegion as al,
4382
+ areDiffTargetsEqual as am,
4383
+ areDiffRenderOptionsEqual as an,
4384
+ isDiffPlainText as ao,
4385
+ DEFAULT_EXPANDED_REGION as ap,
4386
+ renderDiffWithHighlighter as aq,
4387
+ iterateOverDiff as ar,
4388
+ getTrailingContextRangeSize as as,
4389
+ isAdditionLineRenderable as at,
4390
+ getNearestRenderableAdditionLine as au,
4391
+ getHunkAdditionLineRange as av,
4392
+ areFilesEqual as aw,
4393
+ getLeadingHunkSeparatorLayout as ax,
4394
+ getTrailingHunkSeparatorLayout as ay,
4395
+ resolveHighlighterType as az,
4396
+ acquireHighlighterType as b,
4397
+ createDiffsThemeResolver as c,
4398
+ releaseHighlighterType as d,
4399
+ resolveLanguages as e,
4400
+ formatCSSVariablePrefix as f,
4401
+ RegisteredCustomLanguages as g,
4402
+ unwrapDefault as h,
4294
4403
  isFullyTransparent as i,
4295
- isFilePlainText as j,
4296
- getFiletypeFromFileName as k,
4297
- linesFromFileContents as l,
4298
- DEFAULT_RENDER_RANGE as m,
4299
- areLanguagesAttached as n,
4300
- hasResolvedThemes as o,
4404
+ relativeLuminance as j,
4405
+ isDarkSurface as k,
4406
+ hoverWouldEraseText as l,
4407
+ deriveMutedFg as m,
4408
+ contrastRatio as n,
4409
+ compositeOverBg as o,
4301
4410
  pickReadableForeground as p,
4302
- getThemes as q,
4303
- relativeLuminance as r,
4411
+ areFileRenderOptionsEqual as q,
4412
+ renderTokenLines as r,
4304
4413
  surfacesMatch as s,
4305
- renderFileWithHighlighter as t,
4414
+ isFilePlainText as t,
4306
4415
  useWorkerPool as u,
4307
- createGutterGap as v,
4308
- createGutterItem as w,
4309
- createHastElement as x,
4310
- getSharedHighlighter as y,
4311
- createGutterWrapper as z
4416
+ getHighlighterIfLoaded as v,
4417
+ getFiletypeFromFileName as w,
4418
+ linesFromFileContents as x,
4419
+ DEFAULT_RENDER_RANGE as y,
4420
+ areThemesAttached as z
4312
4421
  };