@bilal-fazlani/mock-server 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (703) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/bundle-full.mjs +41 -0
  4. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/engine-oniguruma.mjs +8 -0
  5. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/index.mjs +29 -0
  6. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/langs-bundle-full-4noeO3oH.mjs +1283 -0
  7. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/rolldown-runtime-BBjsoOtd.mjs +27 -0
  8. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/themes.mjs +396 -0
  9. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/dist/wasm.mjs +3 -0
  10. package/.next/standalone/.next/node_modules/shiki-43d062b67f27bbdc/package.json +73 -0
  11. package/.next/standalone/.next/prerender-manifest.json +3 -3
  12. package/.next/standalone/.next/required-server-files.json +4 -1
  13. package/.next/standalone/.next/server/app/[...path]/route.js +2 -2
  14. package/.next/standalone/.next/server/app/[...path]/route.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  16. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  17. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  18. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  19. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  21. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  22. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  24. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  25. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  26. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  27. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  28. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  29. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  30. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  31. package/.next/standalone/.next/server/app/index.html +1 -1
  32. package/.next/standalone/.next/server/app/index.rsc +2 -2
  33. package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  34. package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
  35. package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
  36. package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
  37. package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  38. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  39. package/.next/standalone/.next/server/app/ui/[...notFound]/page.js +1 -1
  40. package/.next/standalone/.next/server/app/ui/[...notFound]/page.js.nft.json +1 -1
  41. package/.next/standalone/.next/server/app/ui/[...notFound]/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/ui/api/catalog/route.js +2 -2
  43. package/.next/standalone/.next/server/app/ui/api/catalog/route.js.nft.json +1 -1
  44. package/.next/standalone/.next/server/app/ui/api/global-mocks/[system]/[endpoint]/route.js +2 -2
  45. package/.next/standalone/.next/server/app/ui/api/global-mocks/[system]/[endpoint]/route.js.nft.json +1 -1
  46. package/.next/standalone/.next/server/app/ui/api/global-mocks/route.js +1 -1
  47. package/.next/standalone/.next/server/app/ui/api/global-mocks/route.js.nft.json +1 -1
  48. package/.next/standalone/.next/server/app/ui/api/health/route.js +1 -1
  49. package/.next/standalone/.next/server/app/ui/api/health/route.js.nft.json +1 -1
  50. package/.next/standalone/.next/server/app/ui/api/logs/[logId]/route.js +1 -1
  51. package/.next/standalone/.next/server/app/ui/api/logs/[logId]/route.js.nft.json +1 -1
  52. package/.next/standalone/.next/server/app/ui/api/logs/route.js +1 -1
  53. package/.next/standalone/.next/server/app/ui/api/logs/route.js.nft.json +1 -1
  54. package/.next/standalone/.next/server/app/ui/api/profiles/[profileId]/reset/route.js +1 -1
  55. package/.next/standalone/.next/server/app/ui/api/profiles/[profileId]/reset/route.js.nft.json +1 -1
  56. package/.next/standalone/.next/server/app/ui/api/profiles/[profileId]/route.js +2 -2
  57. package/.next/standalone/.next/server/app/ui/api/profiles/[profileId]/route.js.nft.json +1 -1
  58. package/.next/standalone/.next/server/app/ui/catalog/[system]/[endpoint]/page.js +8 -7
  59. package/.next/standalone/.next/server/app/ui/catalog/[system]/[endpoint]/page.js.nft.json +1 -1
  60. package/.next/standalone/.next/server/app/ui/catalog/[system]/[endpoint]/page_client-reference-manifest.js +1 -1
  61. package/.next/standalone/.next/server/app/ui/catalog/page.js +5 -5
  62. package/.next/standalone/.next/server/app/ui/catalog/page.js.nft.json +1 -1
  63. package/.next/standalone/.next/server/app/ui/catalog/page_client-reference-manifest.js +1 -1
  64. package/.next/standalone/.next/server/app/ui/environment/page.js +4 -4
  65. package/.next/standalone/.next/server/app/ui/environment/page.js.nft.json +1 -1
  66. package/.next/standalone/.next/server/app/ui/environment/page_client-reference-manifest.js +1 -1
  67. package/.next/standalone/.next/server/app/ui/global-mocks/page/server-reference-manifest.json +2 -2
  68. package/.next/standalone/.next/server/app/ui/global-mocks/page.js +4 -4
  69. package/.next/standalone/.next/server/app/ui/global-mocks/page.js.nft.json +1 -1
  70. package/.next/standalone/.next/server/app/ui/global-mocks/page_client-reference-manifest.js +1 -1
  71. package/.next/standalone/.next/server/app/ui/logs/page/server-reference-manifest.json +1 -1
  72. package/.next/standalone/.next/server/app/ui/logs/page.js +5 -5
  73. package/.next/standalone/.next/server/app/ui/logs/page.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/ui/logs/page_client-reference-manifest.js +1 -1
  75. package/.next/standalone/.next/server/app/ui/page.js +4 -4
  76. package/.next/standalone/.next/server/app/ui/page.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/ui/page_client-reference-manifest.js +1 -1
  78. package/.next/standalone/.next/server/app/ui/profiles/[profileId]/page/server-reference-manifest.json +4 -4
  79. package/.next/standalone/.next/server/app/ui/profiles/[profileId]/page.js +6 -6
  80. package/.next/standalone/.next/server/app/ui/profiles/[profileId]/page.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/ui/profiles/[profileId]/page_client-reference-manifest.js +1 -1
  82. package/.next/standalone/.next/server/app/ui/profiles/new/page/server-reference-manifest.json +4 -4
  83. package/.next/standalone/.next/server/app/ui/profiles/new/page.js +5 -5
  84. package/.next/standalone/.next/server/app/ui/profiles/new/page.js.nft.json +1 -1
  85. package/.next/standalone/.next/server/app/ui/profiles/new/page_client-reference-manifest.js +1 -1
  86. package/.next/standalone/.next/server/app/ui/profiles/new.html +1 -1
  87. package/.next/standalone/.next/server/app/ui/profiles/new.rsc +31 -31
  88. package/.next/standalone/.next/server/app/ui/profiles/new.segments/_full.segment.rsc +31 -31
  89. package/.next/standalone/.next/server/app/ui/profiles/new.segments/_head.segment.rsc +1 -1
  90. package/.next/standalone/.next/server/app/ui/profiles/new.segments/_index.segment.rsc +2 -2
  91. package/.next/standalone/.next/server/app/ui/profiles/new.segments/_tree.segment.rsc +2 -2
  92. package/.next/standalone/.next/server/app/ui/profiles/new.segments/ui/profiles/new/__PAGE__.segment.rsc +18 -17
  93. package/.next/standalone/.next/server/app/ui/profiles/new.segments/ui/profiles/new.segment.rsc +1 -1
  94. package/.next/standalone/.next/server/app/ui/profiles/new.segments/ui/profiles.segment.rsc +1 -1
  95. package/.next/standalone/.next/server/app/ui/profiles/new.segments/ui.segment.rsc +3 -3
  96. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_w4w88._.js +3 -0
  97. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0eo49or._.js +3 -0
  98. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0om7kg8._.js +3 -0
  99. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0s6drot._.js +3 -0
  100. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0t8o5f7._.js +3 -0
  101. package/.next/standalone/.next/server/chunks/[root-of-the-server]__14hrty_._.js +3 -0
  102. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1d3vxpt._.js +3 -0
  103. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1e407ve._.js +3 -0
  104. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1islaxo._.js +3 -0
  105. package/.next/standalone/.next/server/chunks/{_01xbyam._.js → _0qbx9v1._.js} +6 -6
  106. package/.next/standalone/.next/server/chunks/{_0022gwg._.js → _16q11je._.js} +6 -6
  107. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_1hi1g43.js +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__095ld3v._.js +3 -0
  109. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0c_8sxb._.js +3 -0
  110. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__131d-3a._.js → [root-of-the-server]__0ok8mg5._.js} +2 -2
  111. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0uln_1r._.js +1 -1
  112. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0xmt17v._.js +3 -0
  113. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__16y93ju._.js +3 -0
  114. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__18_kqdp._.js +3 -0
  115. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__18z_8pt._.js +3 -0
  116. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ac328a._.js +3 -0
  117. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ffkjjl._.js +3 -0
  118. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1gmmta4._.js +1 -1
  119. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1k-7k5k._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1po4if1._.js +3 -0
  121. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1r99_25._.js +3 -0
  122. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1xkfxwl._.js +3 -0
  123. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__20xpe3a._.js +3 -0
  124. package/.next/standalone/.next/server/chunks/ssr/_0ceyznt._.js +3 -0
  125. package/.next/standalone/.next/server/chunks/ssr/{_1s8xzfs._.js → _0dcewjo._.js} +5 -5
  126. package/.next/standalone/.next/server/chunks/ssr/_0dp2bez._.js +3 -0
  127. package/.next/standalone/.next/server/chunks/ssr/_0hv6b4i._.js +1 -1
  128. package/.next/standalone/.next/server/chunks/ssr/_0txvxmw._.js +3 -0
  129. package/.next/standalone/.next/server/chunks/ssr/_13ez5qw._.js +3 -0
  130. package/.next/standalone/.next/server/chunks/ssr/_142--49._.js +3 -0
  131. package/.next/standalone/.next/server/chunks/ssr/_1nyvjoj._.js +3 -0
  132. package/.next/standalone/.next/server/chunks/ssr/src_1s6weq_._.js +1 -1
  133. package/.next/standalone/.next/server/chunks/ssr/src_app_ui_logs_LogRow_tsx_1mzipt8._.js +1 -1
  134. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  135. package/.next/standalone/.next/server/pages/404.html +1 -1
  136. package/.next/standalone/.next/server/pages/500.html +1 -1
  137. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  138. package/.next/standalone/.next/server/server-reference-manifest.json +8 -8
  139. package/.next/standalone/.next/static/chunks/12ny879muwkxw.js +1 -0
  140. package/.next/standalone/.next/static/chunks/18hh57jv94a5e.js +1 -0
  141. package/.next/standalone/.next/static/chunks/1rml3lmlc_-1c.js +1 -0
  142. package/.next/standalone/.next/static/chunks/1zxhmuljxo270.js +1 -0
  143. package/.next/standalone/.next/static/chunks/2bqfpygv3x9-k.js +1 -0
  144. package/.next/standalone/.next/static/chunks/3fpjbzbf26aey.js +1 -0
  145. package/.next/standalone/.next/static/chunks/3ivfq435-2tni.css +3 -0
  146. package/.next/standalone/next.config.ts +32 -0
  147. package/.next/standalone/node_modules/@shikijs/core/dist/index.mjs +1406 -0
  148. package/.next/standalone/node_modules/@shikijs/core/package.json +60 -0
  149. package/.next/standalone/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs +47 -0
  150. package/.next/standalone/node_modules/@shikijs/engine-javascript/dist/engine-raw.mjs +27 -0
  151. package/.next/standalone/node_modules/@shikijs/engine-javascript/dist/index.mjs +4 -0
  152. package/.next/standalone/node_modules/@shikijs/engine-javascript/dist/scanner-DX8LRFGE.mjs +77 -0
  153. package/.next/standalone/node_modules/@shikijs/engine-javascript/package.json +42 -0
  154. package/.next/standalone/node_modules/@shikijs/engine-oniguruma/dist/index.mjs +449 -0
  155. package/.next/standalone/node_modules/@shikijs/engine-oniguruma/dist/wasm-inlined.mjs +8 -0
  156. package/.next/standalone/node_modules/@shikijs/engine-oniguruma/package.json +45 -0
  157. package/.next/standalone/node_modules/@shikijs/langs/dist/abap.mjs +5 -0
  158. package/.next/standalone/node_modules/@shikijs/langs/dist/actionscript-3.mjs +5 -0
  159. package/.next/standalone/node_modules/@shikijs/langs/dist/ada.mjs +5 -0
  160. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-expression.mjs +5 -0
  161. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-html.mjs +16 -0
  162. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-inline-style.mjs +8 -0
  163. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-inline-template.mjs +10 -0
  164. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-let-declaration.mjs +8 -0
  165. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-template-blocks.mjs +10 -0
  166. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-template.mjs +8 -0
  167. package/.next/standalone/node_modules/@shikijs/langs/dist/angular-ts.mjs +18 -0
  168. package/.next/standalone/node_modules/@shikijs/langs/dist/apache.mjs +5 -0
  169. package/.next/standalone/node_modules/@shikijs/langs/dist/apex.mjs +5 -0
  170. package/.next/standalone/node_modules/@shikijs/langs/dist/apl.mjs +16 -0
  171. package/.next/standalone/node_modules/@shikijs/langs/dist/applescript.mjs +5 -0
  172. package/.next/standalone/node_modules/@shikijs/langs/dist/ara.mjs +5 -0
  173. package/.next/standalone/node_modules/@shikijs/langs/dist/asciidoc.mjs +5 -0
  174. package/.next/standalone/node_modules/@shikijs/langs/dist/asm.mjs +5 -0
  175. package/.next/standalone/node_modules/@shikijs/langs/dist/astro.mjs +18 -0
  176. package/.next/standalone/node_modules/@shikijs/langs/dist/awk.mjs +5 -0
  177. package/.next/standalone/node_modules/@shikijs/langs/dist/ballerina.mjs +5 -0
  178. package/.next/standalone/node_modules/@shikijs/langs/dist/bat.mjs +5 -0
  179. package/.next/standalone/node_modules/@shikijs/langs/dist/beancount.mjs +5 -0
  180. package/.next/standalone/node_modules/@shikijs/langs/dist/berry.mjs +5 -0
  181. package/.next/standalone/node_modules/@shikijs/langs/dist/bibtex.mjs +5 -0
  182. package/.next/standalone/node_modules/@shikijs/langs/dist/bicep.mjs +5 -0
  183. package/.next/standalone/node_modules/@shikijs/langs/dist/bird2.mjs +5 -0
  184. package/.next/standalone/node_modules/@shikijs/langs/dist/blade.mjs +20 -0
  185. package/.next/standalone/node_modules/@shikijs/langs/dist/bsl.mjs +8 -0
  186. package/.next/standalone/node_modules/@shikijs/langs/dist/c.mjs +5 -0
  187. package/.next/standalone/node_modules/@shikijs/langs/dist/c3.mjs +5 -0
  188. package/.next/standalone/node_modules/@shikijs/langs/dist/cadence.mjs +5 -0
  189. package/.next/standalone/node_modules/@shikijs/langs/dist/cairo.mjs +8 -0
  190. package/.next/standalone/node_modules/@shikijs/langs/dist/clarity.mjs +5 -0
  191. package/.next/standalone/node_modules/@shikijs/langs/dist/clojure.mjs +5 -0
  192. package/.next/standalone/node_modules/@shikijs/langs/dist/cmake.mjs +5 -0
  193. package/.next/standalone/node_modules/@shikijs/langs/dist/cobol.mjs +10 -0
  194. package/.next/standalone/node_modules/@shikijs/langs/dist/codeowners.mjs +5 -0
  195. package/.next/standalone/node_modules/@shikijs/langs/dist/codeql.mjs +5 -0
  196. package/.next/standalone/node_modules/@shikijs/langs/dist/coffee.mjs +8 -0
  197. package/.next/standalone/node_modules/@shikijs/langs/dist/common-lisp.mjs +5 -0
  198. package/.next/standalone/node_modules/@shikijs/langs/dist/coq.mjs +5 -0
  199. package/.next/standalone/node_modules/@shikijs/langs/dist/cpp-macro.mjs +12 -0
  200. package/.next/standalone/node_modules/@shikijs/langs/dist/cpp.mjs +14 -0
  201. package/.next/standalone/node_modules/@shikijs/langs/dist/crystal.mjs +18 -0
  202. package/.next/standalone/node_modules/@shikijs/langs/dist/csharp.mjs +5 -0
  203. package/.next/standalone/node_modules/@shikijs/langs/dist/css.mjs +5 -0
  204. package/.next/standalone/node_modules/@shikijs/langs/dist/csv.mjs +5 -0
  205. package/.next/standalone/node_modules/@shikijs/langs/dist/cue.mjs +5 -0
  206. package/.next/standalone/node_modules/@shikijs/langs/dist/cypher.mjs +5 -0
  207. package/.next/standalone/node_modules/@shikijs/langs/dist/d.mjs +5 -0
  208. package/.next/standalone/node_modules/@shikijs/langs/dist/dart.mjs +5 -0
  209. package/.next/standalone/node_modules/@shikijs/langs/dist/dax.mjs +5 -0
  210. package/.next/standalone/node_modules/@shikijs/langs/dist/desktop.mjs +5 -0
  211. package/.next/standalone/node_modules/@shikijs/langs/dist/diff.mjs +5 -0
  212. package/.next/standalone/node_modules/@shikijs/langs/dist/docker.mjs +5 -0
  213. package/.next/standalone/node_modules/@shikijs/langs/dist/dotenv.mjs +5 -0
  214. package/.next/standalone/node_modules/@shikijs/langs/dist/dream-maker.mjs +5 -0
  215. package/.next/standalone/node_modules/@shikijs/langs/dist/edge.mjs +12 -0
  216. package/.next/standalone/node_modules/@shikijs/langs/dist/elixir.mjs +8 -0
  217. package/.next/standalone/node_modules/@shikijs/langs/dist/elm.mjs +8 -0
  218. package/.next/standalone/node_modules/@shikijs/langs/dist/emacs-lisp.mjs +5 -0
  219. package/.next/standalone/node_modules/@shikijs/langs/dist/erb.mjs +10 -0
  220. package/.next/standalone/node_modules/@shikijs/langs/dist/erlang.mjs +8 -0
  221. package/.next/standalone/node_modules/@shikijs/langs/dist/es-tag-css.mjs +12 -0
  222. package/.next/standalone/node_modules/@shikijs/langs/dist/es-tag-glsl.mjs +12 -0
  223. package/.next/standalone/node_modules/@shikijs/langs/dist/es-tag-html.mjs +12 -0
  224. package/.next/standalone/node_modules/@shikijs/langs/dist/es-tag-sql.mjs +10 -0
  225. package/.next/standalone/node_modules/@shikijs/langs/dist/es-tag-xml.mjs +8 -0
  226. package/.next/standalone/node_modules/@shikijs/langs/dist/fennel.mjs +5 -0
  227. package/.next/standalone/node_modules/@shikijs/langs/dist/fish.mjs +5 -0
  228. package/.next/standalone/node_modules/@shikijs/langs/dist/fluent.mjs +5 -0
  229. package/.next/standalone/node_modules/@shikijs/langs/dist/fortran-fixed-form.mjs +8 -0
  230. package/.next/standalone/node_modules/@shikijs/langs/dist/fortran-free-form.mjs +5 -0
  231. package/.next/standalone/node_modules/@shikijs/langs/dist/fsharp.mjs +8 -0
  232. package/.next/standalone/node_modules/@shikijs/langs/dist/gdresource.mjs +10 -0
  233. package/.next/standalone/node_modules/@shikijs/langs/dist/gdscript.mjs +5 -0
  234. package/.next/standalone/node_modules/@shikijs/langs/dist/gdshader.mjs +5 -0
  235. package/.next/standalone/node_modules/@shikijs/langs/dist/genie.mjs +5 -0
  236. package/.next/standalone/node_modules/@shikijs/langs/dist/gherkin.mjs +5 -0
  237. package/.next/standalone/node_modules/@shikijs/langs/dist/git-commit.mjs +8 -0
  238. package/.next/standalone/node_modules/@shikijs/langs/dist/git-rebase.mjs +8 -0
  239. package/.next/standalone/node_modules/@shikijs/langs/dist/gleam.mjs +5 -0
  240. package/.next/standalone/node_modules/@shikijs/langs/dist/glimmer-js.mjs +14 -0
  241. package/.next/standalone/node_modules/@shikijs/langs/dist/glimmer-ts.mjs +14 -0
  242. package/.next/standalone/node_modules/@shikijs/langs/dist/glsl.mjs +8 -0
  243. package/.next/standalone/node_modules/@shikijs/langs/dist/gn.mjs +5 -0
  244. package/.next/standalone/node_modules/@shikijs/langs/dist/gnuplot.mjs +5 -0
  245. package/.next/standalone/node_modules/@shikijs/langs/dist/go.mjs +5 -0
  246. package/.next/standalone/node_modules/@shikijs/langs/dist/graphql.mjs +14 -0
  247. package/.next/standalone/node_modules/@shikijs/langs/dist/groovy.mjs +5 -0
  248. package/.next/standalone/node_modules/@shikijs/langs/dist/hack.mjs +10 -0
  249. package/.next/standalone/node_modules/@shikijs/langs/dist/haml.mjs +10 -0
  250. package/.next/standalone/node_modules/@shikijs/langs/dist/handlebars.mjs +14 -0
  251. package/.next/standalone/node_modules/@shikijs/langs/dist/haskell.mjs +5 -0
  252. package/.next/standalone/node_modules/@shikijs/langs/dist/haxe.mjs +5 -0
  253. package/.next/standalone/node_modules/@shikijs/langs/dist/hcl.mjs +5 -0
  254. package/.next/standalone/node_modules/@shikijs/langs/dist/hjson.mjs +5 -0
  255. package/.next/standalone/node_modules/@shikijs/langs/dist/hlsl.mjs +5 -0
  256. package/.next/standalone/node_modules/@shikijs/langs/dist/html-derivative.mjs +8 -0
  257. package/.next/standalone/node_modules/@shikijs/langs/dist/html.mjs +10 -0
  258. package/.next/standalone/node_modules/@shikijs/langs/dist/http.mjs +14 -0
  259. package/.next/standalone/node_modules/@shikijs/langs/dist/hurl.mjs +12 -0
  260. package/.next/standalone/node_modules/@shikijs/langs/dist/hxml.mjs +8 -0
  261. package/.next/standalone/node_modules/@shikijs/langs/dist/hy.mjs +5 -0
  262. package/.next/standalone/node_modules/@shikijs/langs/dist/imba.mjs +5 -0
  263. package/.next/standalone/node_modules/@shikijs/langs/dist/ini.mjs +5 -0
  264. package/.next/standalone/node_modules/@shikijs/langs/dist/java.mjs +5 -0
  265. package/.next/standalone/node_modules/@shikijs/langs/dist/javascript.mjs +5 -0
  266. package/.next/standalone/node_modules/@shikijs/langs/dist/jinja-html.mjs +8 -0
  267. package/.next/standalone/node_modules/@shikijs/langs/dist/jinja.mjs +8 -0
  268. package/.next/standalone/node_modules/@shikijs/langs/dist/jison.mjs +8 -0
  269. package/.next/standalone/node_modules/@shikijs/langs/dist/json.mjs +5 -0
  270. package/.next/standalone/node_modules/@shikijs/langs/dist/json5.mjs +5 -0
  271. package/.next/standalone/node_modules/@shikijs/langs/dist/jsonc.mjs +5 -0
  272. package/.next/standalone/node_modules/@shikijs/langs/dist/jsonl.mjs +5 -0
  273. package/.next/standalone/node_modules/@shikijs/langs/dist/jsonnet.mjs +5 -0
  274. package/.next/standalone/node_modules/@shikijs/langs/dist/jssm.mjs +5 -0
  275. package/.next/standalone/node_modules/@shikijs/langs/dist/jsx.mjs +5 -0
  276. package/.next/standalone/node_modules/@shikijs/langs/dist/julia.mjs +16 -0
  277. package/.next/standalone/node_modules/@shikijs/langs/dist/just.mjs +18 -0
  278. package/.next/standalone/node_modules/@shikijs/langs/dist/kdl.mjs +5 -0
  279. package/.next/standalone/node_modules/@shikijs/langs/dist/kotlin.mjs +5 -0
  280. package/.next/standalone/node_modules/@shikijs/langs/dist/kusto.mjs +5 -0
  281. package/.next/standalone/node_modules/@shikijs/langs/dist/latex.mjs +8 -0
  282. package/.next/standalone/node_modules/@shikijs/langs/dist/lean.mjs +5 -0
  283. package/.next/standalone/node_modules/@shikijs/langs/dist/less.mjs +5 -0
  284. package/.next/standalone/node_modules/@shikijs/langs/dist/liquid.mjs +14 -0
  285. package/.next/standalone/node_modules/@shikijs/langs/dist/llvm.mjs +5 -0
  286. package/.next/standalone/node_modules/@shikijs/langs/dist/log.mjs +5 -0
  287. package/.next/standalone/node_modules/@shikijs/langs/dist/logo.mjs +5 -0
  288. package/.next/standalone/node_modules/@shikijs/langs/dist/lua.mjs +8 -0
  289. package/.next/standalone/node_modules/@shikijs/langs/dist/luau.mjs +5 -0
  290. package/.next/standalone/node_modules/@shikijs/langs/dist/make.mjs +5 -0
  291. package/.next/standalone/node_modules/@shikijs/langs/dist/markdown-nix.mjs +5 -0
  292. package/.next/standalone/node_modules/@shikijs/langs/dist/markdown-vue.mjs +5 -0
  293. package/.next/standalone/node_modules/@shikijs/langs/dist/markdown.mjs +5 -0
  294. package/.next/standalone/node_modules/@shikijs/langs/dist/marko.mjs +14 -0
  295. package/.next/standalone/node_modules/@shikijs/langs/dist/matlab.mjs +5 -0
  296. package/.next/standalone/node_modules/@shikijs/langs/dist/mdc.mjs +12 -0
  297. package/.next/standalone/node_modules/@shikijs/langs/dist/mdx.mjs +5 -0
  298. package/.next/standalone/node_modules/@shikijs/langs/dist/mermaid.mjs +5 -0
  299. package/.next/standalone/node_modules/@shikijs/langs/dist/mipsasm.mjs +5 -0
  300. package/.next/standalone/node_modules/@shikijs/langs/dist/mojo.mjs +5 -0
  301. package/.next/standalone/node_modules/@shikijs/langs/dist/moonbit.mjs +5 -0
  302. package/.next/standalone/node_modules/@shikijs/langs/dist/move.mjs +5 -0
  303. package/.next/standalone/node_modules/@shikijs/langs/dist/narrat.mjs +5 -0
  304. package/.next/standalone/node_modules/@shikijs/langs/dist/nextflow-groovy.mjs +5 -0
  305. package/.next/standalone/node_modules/@shikijs/langs/dist/nextflow.mjs +8 -0
  306. package/.next/standalone/node_modules/@shikijs/langs/dist/nginx.mjs +8 -0
  307. package/.next/standalone/node_modules/@shikijs/langs/dist/nim.mjs +20 -0
  308. package/.next/standalone/node_modules/@shikijs/langs/dist/nix.mjs +8 -0
  309. package/.next/standalone/node_modules/@shikijs/langs/dist/nushell.mjs +5 -0
  310. package/.next/standalone/node_modules/@shikijs/langs/dist/objective-c.mjs +5 -0
  311. package/.next/standalone/node_modules/@shikijs/langs/dist/objective-cpp.mjs +5 -0
  312. package/.next/standalone/node_modules/@shikijs/langs/dist/ocaml.mjs +5 -0
  313. package/.next/standalone/node_modules/@shikijs/langs/dist/odin.mjs +5 -0
  314. package/.next/standalone/node_modules/@shikijs/langs/dist/openscad.mjs +5 -0
  315. package/.next/standalone/node_modules/@shikijs/langs/dist/pascal.mjs +5 -0
  316. package/.next/standalone/node_modules/@shikijs/langs/dist/perl.mjs +16 -0
  317. package/.next/standalone/node_modules/@shikijs/langs/dist/php.mjs +18 -0
  318. package/.next/standalone/node_modules/@shikijs/langs/dist/pkl.mjs +5 -0
  319. package/.next/standalone/node_modules/@shikijs/langs/dist/plsql.mjs +5 -0
  320. package/.next/standalone/node_modules/@shikijs/langs/dist/po.mjs +5 -0
  321. package/.next/standalone/node_modules/@shikijs/langs/dist/polar.mjs +5 -0
  322. package/.next/standalone/node_modules/@shikijs/langs/dist/postcss.mjs +5 -0
  323. package/.next/standalone/node_modules/@shikijs/langs/dist/powerquery.mjs +5 -0
  324. package/.next/standalone/node_modules/@shikijs/langs/dist/powershell.mjs +5 -0
  325. package/.next/standalone/node_modules/@shikijs/langs/dist/prisma.mjs +5 -0
  326. package/.next/standalone/node_modules/@shikijs/langs/dist/prolog.mjs +5 -0
  327. package/.next/standalone/node_modules/@shikijs/langs/dist/proto.mjs +5 -0
  328. package/.next/standalone/node_modules/@shikijs/langs/dist/pug.mjs +12 -0
  329. package/.next/standalone/node_modules/@shikijs/langs/dist/puppet.mjs +5 -0
  330. package/.next/standalone/node_modules/@shikijs/langs/dist/purescript.mjs +5 -0
  331. package/.next/standalone/node_modules/@shikijs/langs/dist/python.mjs +5 -0
  332. package/.next/standalone/node_modules/@shikijs/langs/dist/qml.mjs +8 -0
  333. package/.next/standalone/node_modules/@shikijs/langs/dist/qmldir.mjs +5 -0
  334. package/.next/standalone/node_modules/@shikijs/langs/dist/qss.mjs +5 -0
  335. package/.next/standalone/node_modules/@shikijs/langs/dist/r.mjs +5 -0
  336. package/.next/standalone/node_modules/@shikijs/langs/dist/racket.mjs +5 -0
  337. package/.next/standalone/node_modules/@shikijs/langs/dist/raku.mjs +5 -0
  338. package/.next/standalone/node_modules/@shikijs/langs/dist/razor.mjs +10 -0
  339. package/.next/standalone/node_modules/@shikijs/langs/dist/reg.mjs +5 -0
  340. package/.next/standalone/node_modules/@shikijs/langs/dist/regexp.mjs +5 -0
  341. package/.next/standalone/node_modules/@shikijs/langs/dist/rel.mjs +5 -0
  342. package/.next/standalone/node_modules/@shikijs/langs/dist/riscv.mjs +5 -0
  343. package/.next/standalone/node_modules/@shikijs/langs/dist/ron.mjs +5 -0
  344. package/.next/standalone/node_modules/@shikijs/langs/dist/rosmsg.mjs +5 -0
  345. package/.next/standalone/node_modules/@shikijs/langs/dist/rst.mjs +22 -0
  346. package/.next/standalone/node_modules/@shikijs/langs/dist/ruby.mjs +30 -0
  347. package/.next/standalone/node_modules/@shikijs/langs/dist/rust.mjs +5 -0
  348. package/.next/standalone/node_modules/@shikijs/langs/dist/sas.mjs +8 -0
  349. package/.next/standalone/node_modules/@shikijs/langs/dist/sass.mjs +5 -0
  350. package/.next/standalone/node_modules/@shikijs/langs/dist/scala.mjs +5 -0
  351. package/.next/standalone/node_modules/@shikijs/langs/dist/scheme.mjs +5 -0
  352. package/.next/standalone/node_modules/@shikijs/langs/dist/scss.mjs +8 -0
  353. package/.next/standalone/node_modules/@shikijs/langs/dist/sdbl.mjs +5 -0
  354. package/.next/standalone/node_modules/@shikijs/langs/dist/shaderlab.mjs +8 -0
  355. package/.next/standalone/node_modules/@shikijs/langs/dist/shellscript.mjs +5 -0
  356. package/.next/standalone/node_modules/@shikijs/langs/dist/shellsession.mjs +8 -0
  357. package/.next/standalone/node_modules/@shikijs/langs/dist/smalltalk.mjs +5 -0
  358. package/.next/standalone/node_modules/@shikijs/langs/dist/solidity.mjs +5 -0
  359. package/.next/standalone/node_modules/@shikijs/langs/dist/soy.mjs +8 -0
  360. package/.next/standalone/node_modules/@shikijs/langs/dist/sparql.mjs +8 -0
  361. package/.next/standalone/node_modules/@shikijs/langs/dist/splunk.mjs +5 -0
  362. package/.next/standalone/node_modules/@shikijs/langs/dist/sql.mjs +5 -0
  363. package/.next/standalone/node_modules/@shikijs/langs/dist/ssh-config.mjs +5 -0
  364. package/.next/standalone/node_modules/@shikijs/langs/dist/stata.mjs +8 -0
  365. package/.next/standalone/node_modules/@shikijs/langs/dist/stylus.mjs +5 -0
  366. package/.next/standalone/node_modules/@shikijs/langs/dist/surrealql.mjs +8 -0
  367. package/.next/standalone/node_modules/@shikijs/langs/dist/svelte.mjs +14 -0
  368. package/.next/standalone/node_modules/@shikijs/langs/dist/swift.mjs +5 -0
  369. package/.next/standalone/node_modules/@shikijs/langs/dist/system-verilog.mjs +5 -0
  370. package/.next/standalone/node_modules/@shikijs/langs/dist/systemd.mjs +5 -0
  371. package/.next/standalone/node_modules/@shikijs/langs/dist/talonscript.mjs +5 -0
  372. package/.next/standalone/node_modules/@shikijs/langs/dist/tasl.mjs +5 -0
  373. package/.next/standalone/node_modules/@shikijs/langs/dist/tcl.mjs +5 -0
  374. package/.next/standalone/node_modules/@shikijs/langs/dist/templ.mjs +12 -0
  375. package/.next/standalone/node_modules/@shikijs/langs/dist/terraform.mjs +5 -0
  376. package/.next/standalone/node_modules/@shikijs/langs/dist/tex.mjs +8 -0
  377. package/.next/standalone/node_modules/@shikijs/langs/dist/toml.mjs +5 -0
  378. package/.next/standalone/node_modules/@shikijs/langs/dist/ts-tags.mjs +18 -0
  379. package/.next/standalone/node_modules/@shikijs/langs/dist/tsv.mjs +5 -0
  380. package/.next/standalone/node_modules/@shikijs/langs/dist/tsx.mjs +5 -0
  381. package/.next/standalone/node_modules/@shikijs/langs/dist/turtle.mjs +5 -0
  382. package/.next/standalone/node_modules/@shikijs/langs/dist/twig.mjs +18 -0
  383. package/.next/standalone/node_modules/@shikijs/langs/dist/typescript.mjs +5 -0
  384. package/.next/standalone/node_modules/@shikijs/langs/dist/typespec.mjs +5 -0
  385. package/.next/standalone/node_modules/@shikijs/langs/dist/typst.mjs +5 -0
  386. package/.next/standalone/node_modules/@shikijs/langs/dist/v.mjs +5 -0
  387. package/.next/standalone/node_modules/@shikijs/langs/dist/vala.mjs +5 -0
  388. package/.next/standalone/node_modules/@shikijs/langs/dist/vb.mjs +5 -0
  389. package/.next/standalone/node_modules/@shikijs/langs/dist/verilog.mjs +5 -0
  390. package/.next/standalone/node_modules/@shikijs/langs/dist/vhdl.mjs +5 -0
  391. package/.next/standalone/node_modules/@shikijs/langs/dist/viml.mjs +5 -0
  392. package/.next/standalone/node_modules/@shikijs/langs/dist/vue-directives.mjs +5 -0
  393. package/.next/standalone/node_modules/@shikijs/langs/dist/vue-html.mjs +8 -0
  394. package/.next/standalone/node_modules/@shikijs/langs/dist/vue-interpolations.mjs +5 -0
  395. package/.next/standalone/node_modules/@shikijs/langs/dist/vue-sfc-style-variable-injection.mjs +8 -0
  396. package/.next/standalone/node_modules/@shikijs/langs/dist/vue-vine.mjs +18 -0
  397. package/.next/standalone/node_modules/@shikijs/langs/dist/vue.mjs +26 -0
  398. package/.next/standalone/node_modules/@shikijs/langs/dist/vyper.mjs +5 -0
  399. package/.next/standalone/node_modules/@shikijs/langs/dist/wasm.mjs +5 -0
  400. package/.next/standalone/node_modules/@shikijs/langs/dist/wenyan.mjs +5 -0
  401. package/.next/standalone/node_modules/@shikijs/langs/dist/wgsl.mjs +5 -0
  402. package/.next/standalone/node_modules/@shikijs/langs/dist/wikitext.mjs +5 -0
  403. package/.next/standalone/node_modules/@shikijs/langs/dist/wit.mjs +5 -0
  404. package/.next/standalone/node_modules/@shikijs/langs/dist/wolfram.mjs +5 -0
  405. package/.next/standalone/node_modules/@shikijs/langs/dist/xml.mjs +8 -0
  406. package/.next/standalone/node_modules/@shikijs/langs/dist/xsl.mjs +8 -0
  407. package/.next/standalone/node_modules/@shikijs/langs/dist/yaml.mjs +5 -0
  408. package/.next/standalone/node_modules/@shikijs/langs/dist/zenscript.mjs +5 -0
  409. package/.next/standalone/node_modules/@shikijs/langs/dist/zig.mjs +5 -0
  410. package/.next/standalone/node_modules/@shikijs/langs/package.json +387 -0
  411. package/.next/standalone/node_modules/@shikijs/primitive/dist/index.mjs +834 -0
  412. package/.next/standalone/node_modules/@shikijs/primitive/package.json +56 -0
  413. package/.next/standalone/node_modules/@shikijs/themes/dist/andromeeda.mjs +2 -0
  414. package/.next/standalone/node_modules/@shikijs/themes/dist/aurora-x.mjs +2 -0
  415. package/.next/standalone/node_modules/@shikijs/themes/dist/ayu-dark.mjs +2 -0
  416. package/.next/standalone/node_modules/@shikijs/themes/dist/ayu-light.mjs +2 -0
  417. package/.next/standalone/node_modules/@shikijs/themes/dist/ayu-mirage.mjs +2 -0
  418. package/.next/standalone/node_modules/@shikijs/themes/dist/catppuccin-frappe.mjs +2 -0
  419. package/.next/standalone/node_modules/@shikijs/themes/dist/catppuccin-latte.mjs +2 -0
  420. package/.next/standalone/node_modules/@shikijs/themes/dist/catppuccin-macchiato.mjs +2 -0
  421. package/.next/standalone/node_modules/@shikijs/themes/dist/catppuccin-mocha.mjs +2 -0
  422. package/.next/standalone/node_modules/@shikijs/themes/dist/dark-plus.mjs +2 -0
  423. package/.next/standalone/node_modules/@shikijs/themes/dist/dracula-soft.mjs +2 -0
  424. package/.next/standalone/node_modules/@shikijs/themes/dist/dracula.mjs +2 -0
  425. package/.next/standalone/node_modules/@shikijs/themes/dist/everforest-dark.mjs +2 -0
  426. package/.next/standalone/node_modules/@shikijs/themes/dist/everforest-light.mjs +2 -0
  427. package/.next/standalone/node_modules/@shikijs/themes/dist/github-dark-default.mjs +2 -0
  428. package/.next/standalone/node_modules/@shikijs/themes/dist/github-dark-dimmed.mjs +2 -0
  429. package/.next/standalone/node_modules/@shikijs/themes/dist/github-dark-high-contrast.mjs +2 -0
  430. package/.next/standalone/node_modules/@shikijs/themes/dist/github-dark.mjs +2 -0
  431. package/.next/standalone/node_modules/@shikijs/themes/dist/github-light-default.mjs +2 -0
  432. package/.next/standalone/node_modules/@shikijs/themes/dist/github-light-high-contrast.mjs +2 -0
  433. package/.next/standalone/node_modules/@shikijs/themes/dist/github-light.mjs +2 -0
  434. package/.next/standalone/node_modules/@shikijs/themes/dist/gruvbox-dark-hard.mjs +2 -0
  435. package/.next/standalone/node_modules/@shikijs/themes/dist/gruvbox-dark-medium.mjs +2 -0
  436. package/.next/standalone/node_modules/@shikijs/themes/dist/gruvbox-dark-soft.mjs +2 -0
  437. package/.next/standalone/node_modules/@shikijs/themes/dist/gruvbox-light-hard.mjs +2 -0
  438. package/.next/standalone/node_modules/@shikijs/themes/dist/gruvbox-light-medium.mjs +2 -0
  439. package/.next/standalone/node_modules/@shikijs/themes/dist/gruvbox-light-soft.mjs +2 -0
  440. package/.next/standalone/node_modules/@shikijs/themes/dist/horizon-bright.mjs +2 -0
  441. package/.next/standalone/node_modules/@shikijs/themes/dist/horizon.mjs +2 -0
  442. package/.next/standalone/node_modules/@shikijs/themes/dist/houston.mjs +2 -0
  443. package/.next/standalone/node_modules/@shikijs/themes/dist/kanagawa-dragon.mjs +2 -0
  444. package/.next/standalone/node_modules/@shikijs/themes/dist/kanagawa-lotus.mjs +2 -0
  445. package/.next/standalone/node_modules/@shikijs/themes/dist/kanagawa-wave.mjs +2 -0
  446. package/.next/standalone/node_modules/@shikijs/themes/dist/laserwave.mjs +2 -0
  447. package/.next/standalone/node_modules/@shikijs/themes/dist/light-plus.mjs +2 -0
  448. package/.next/standalone/node_modules/@shikijs/themes/dist/material-theme-darker.mjs +2 -0
  449. package/.next/standalone/node_modules/@shikijs/themes/dist/material-theme-lighter.mjs +2 -0
  450. package/.next/standalone/node_modules/@shikijs/themes/dist/material-theme-ocean.mjs +2 -0
  451. package/.next/standalone/node_modules/@shikijs/themes/dist/material-theme-palenight.mjs +2 -0
  452. package/.next/standalone/node_modules/@shikijs/themes/dist/material-theme.mjs +2 -0
  453. package/.next/standalone/node_modules/@shikijs/themes/dist/min-dark.mjs +2 -0
  454. package/.next/standalone/node_modules/@shikijs/themes/dist/min-light.mjs +2 -0
  455. package/.next/standalone/node_modules/@shikijs/themes/dist/monokai.mjs +2 -0
  456. package/.next/standalone/node_modules/@shikijs/themes/dist/night-owl-light.mjs +2 -0
  457. package/.next/standalone/node_modules/@shikijs/themes/dist/night-owl.mjs +2 -0
  458. package/.next/standalone/node_modules/@shikijs/themes/dist/nord.mjs +2 -0
  459. package/.next/standalone/node_modules/@shikijs/themes/dist/one-dark-pro.mjs +2 -0
  460. package/.next/standalone/node_modules/@shikijs/themes/dist/one-light.mjs +2 -0
  461. package/.next/standalone/node_modules/@shikijs/themes/dist/plastic.mjs +2 -0
  462. package/.next/standalone/node_modules/@shikijs/themes/dist/poimandres.mjs +2 -0
  463. package/.next/standalone/node_modules/@shikijs/themes/dist/red.mjs +2 -0
  464. package/.next/standalone/node_modules/@shikijs/themes/dist/rose-pine-dawn.mjs +2 -0
  465. package/.next/standalone/node_modules/@shikijs/themes/dist/rose-pine-moon.mjs +2 -0
  466. package/.next/standalone/node_modules/@shikijs/themes/dist/rose-pine.mjs +2 -0
  467. package/.next/standalone/node_modules/@shikijs/themes/dist/slack-dark.mjs +2 -0
  468. package/.next/standalone/node_modules/@shikijs/themes/dist/slack-ochin.mjs +2 -0
  469. package/.next/standalone/node_modules/@shikijs/themes/dist/snazzy-light.mjs +2 -0
  470. package/.next/standalone/node_modules/@shikijs/themes/dist/solarized-dark.mjs +2 -0
  471. package/.next/standalone/node_modules/@shikijs/themes/dist/solarized-light.mjs +2 -0
  472. package/.next/standalone/node_modules/@shikijs/themes/dist/synthwave-84.mjs +2 -0
  473. package/.next/standalone/node_modules/@shikijs/themes/dist/tokyo-night.mjs +2 -0
  474. package/.next/standalone/node_modules/@shikijs/themes/dist/vesper.mjs +2 -0
  475. package/.next/standalone/node_modules/@shikijs/themes/dist/vitesse-black.mjs +2 -0
  476. package/.next/standalone/node_modules/@shikijs/themes/dist/vitesse-dark.mjs +2 -0
  477. package/.next/standalone/node_modules/@shikijs/themes/dist/vitesse-light.mjs +2 -0
  478. package/.next/standalone/node_modules/@shikijs/themes/package.json +106 -0
  479. package/.next/standalone/node_modules/@shikijs/types/dist/index.mjs +9 -0
  480. package/.next/standalone/node_modules/@shikijs/types/package.json +39 -0
  481. package/.next/standalone/node_modules/@shikijs/vscode-textmate/dist/index.js +3216 -0
  482. package/.next/standalone/node_modules/@shikijs/vscode-textmate/package.json +46 -0
  483. package/.next/standalone/node_modules/ccount/index.js +27 -0
  484. package/.next/standalone/node_modules/ccount/package.json +71 -0
  485. package/.next/standalone/node_modules/character-entities-html4/index.js +259 -0
  486. package/.next/standalone/node_modules/character-entities-html4/package.json +79 -0
  487. package/.next/standalone/node_modules/character-entities-legacy/index.js +113 -0
  488. package/.next/standalone/node_modules/character-entities-legacy/package.json +77 -0
  489. package/.next/standalone/node_modules/comma-separated-tokens/index.js +74 -0
  490. package/.next/standalone/node_modules/comma-separated-tokens/package.json +72 -0
  491. package/.next/standalone/node_modules/hast-util-to-html/index.js +8 -0
  492. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/comment.js +52 -0
  493. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/doctype.js +27 -0
  494. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/element.js +265 -0
  495. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/index.js +47 -0
  496. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/raw.js +27 -0
  497. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/root.js +22 -0
  498. package/.next/standalone/node_modules/hast-util-to-html/lib/handle/text.js +38 -0
  499. package/.next/standalone/node_modules/hast-util-to-html/lib/index.js +257 -0
  500. package/.next/standalone/node_modules/hast-util-to-html/lib/omission/closing.js +358 -0
  501. package/.next/standalone/node_modules/hast-util-to-html/lib/omission/omission.js +44 -0
  502. package/.next/standalone/node_modules/hast-util-to-html/lib/omission/opening.js +148 -0
  503. package/.next/standalone/node_modules/hast-util-to-html/lib/omission/util/siblings.js +50 -0
  504. package/.next/standalone/node_modules/hast-util-to-html/package.json +106 -0
  505. package/.next/standalone/node_modules/hast-util-whitespace/index.js +1 -0
  506. package/.next/standalone/node_modules/hast-util-whitespace/lib/index.js +34 -0
  507. package/.next/standalone/node_modules/hast-util-whitespace/package.json +83 -0
  508. package/.next/standalone/node_modules/html-void-elements/index.js +27 -0
  509. package/.next/standalone/node_modules/html-void-elements/package.json +79 -0
  510. package/.next/standalone/node_modules/oniguruma-parser/dist/parser/node-utils.js +2 -0
  511. package/.next/standalone/node_modules/oniguruma-parser/dist/parser/parse.js +2 -0
  512. package/.next/standalone/node_modules/oniguruma-parser/dist/tokenizer/tokenize.js +34 -0
  513. package/.next/standalone/node_modules/oniguruma-parser/dist/traverser/traverse.js +2 -0
  514. package/.next/standalone/node_modules/oniguruma-parser/dist/utils.js +2 -0
  515. package/.next/standalone/node_modules/oniguruma-parser/package.json +64 -0
  516. package/.next/standalone/node_modules/oniguruma-to-es/dist/esm/index.js +1878 -0
  517. package/.next/standalone/node_modules/oniguruma-to-es/dist/esm/package.json +1 -0
  518. package/.next/standalone/node_modules/oniguruma-to-es/package.json +61 -0
  519. package/.next/standalone/node_modules/property-information/index.js +17 -0
  520. package/.next/standalone/node_modules/property-information/lib/aria.js +61 -0
  521. package/.next/standalone/node_modules/property-information/lib/find.js +97 -0
  522. package/.next/standalone/node_modules/property-information/lib/hast-to-react.js +30 -0
  523. package/.next/standalone/node_modules/property-information/lib/html.js +332 -0
  524. package/.next/standalone/node_modules/property-information/lib/normalize.js +12 -0
  525. package/.next/standalone/node_modules/property-information/lib/svg.js +569 -0
  526. package/.next/standalone/node_modules/property-information/lib/util/case-insensitive-transform.js +13 -0
  527. package/.next/standalone/node_modules/property-information/lib/util/case-sensitive-transform.js +11 -0
  528. package/.next/standalone/node_modules/property-information/lib/util/create.js +69 -0
  529. package/.next/standalone/node_modules/property-information/lib/util/defined-info.js +60 -0
  530. package/.next/standalone/node_modules/property-information/lib/util/info.js +32 -0
  531. package/.next/standalone/node_modules/property-information/lib/util/merge.js +27 -0
  532. package/.next/standalone/node_modules/property-information/lib/util/schema.js +29 -0
  533. package/.next/standalone/node_modules/property-information/lib/util/types.js +13 -0
  534. package/.next/standalone/node_modules/property-information/lib/xlink.js +17 -0
  535. package/.next/standalone/node_modules/property-information/lib/xml.js +9 -0
  536. package/.next/standalone/node_modules/property-information/lib/xmlns.js +9 -0
  537. package/.next/standalone/node_modules/property-information/package.json +84 -0
  538. package/.next/standalone/node_modules/regex/package.json +60 -0
  539. package/.next/standalone/node_modules/regex/src/atomic.js +224 -0
  540. package/.next/standalone/node_modules/regex/src/internals.js +2 -0
  541. package/.next/standalone/node_modules/regex/src/subclass.js +98 -0
  542. package/.next/standalone/node_modules/regex/src/utils-internals.js +33 -0
  543. package/.next/standalone/node_modules/regex-recursion/package.json +47 -0
  544. package/.next/standalone/node_modules/regex-recursion/src/index.js +365 -0
  545. package/.next/standalone/node_modules/regex-utilities/package.json +35 -0
  546. package/.next/standalone/node_modules/regex-utilities/src/index.js +170 -0
  547. package/.next/standalone/node_modules/shiki/dist/bundle-full.mjs +41 -0
  548. package/.next/standalone/node_modules/shiki/dist/engine-oniguruma.mjs +8 -0
  549. package/.next/standalone/node_modules/shiki/dist/index.mjs +29 -0
  550. package/.next/standalone/node_modules/shiki/dist/langs-bundle-full-4noeO3oH.mjs +1283 -0
  551. package/.next/standalone/node_modules/shiki/dist/rolldown-runtime-BBjsoOtd.mjs +27 -0
  552. package/.next/standalone/node_modules/shiki/dist/themes.mjs +396 -0
  553. package/.next/standalone/node_modules/shiki/dist/wasm.mjs +3 -0
  554. package/.next/standalone/node_modules/shiki/package.json +73 -0
  555. package/.next/standalone/node_modules/space-separated-tokens/index.js +24 -0
  556. package/.next/standalone/node_modules/space-separated-tokens/package.json +67 -0
  557. package/.next/standalone/node_modules/stringify-entities/index.js +6 -0
  558. package/.next/standalone/node_modules/stringify-entities/lib/constant/dangerous.js +16 -0
  559. package/.next/standalone/node_modules/stringify-entities/lib/core.js +117 -0
  560. package/.next/standalone/node_modules/stringify-entities/lib/index.js +36 -0
  561. package/.next/standalone/node_modules/stringify-entities/lib/util/format-basic.js +9 -0
  562. package/.next/standalone/node_modules/stringify-entities/lib/util/format-smart.js +69 -0
  563. package/.next/standalone/node_modules/stringify-entities/lib/util/to-decimal.js +16 -0
  564. package/.next/standalone/node_modules/stringify-entities/lib/util/to-hexadecimal.js +16 -0
  565. package/.next/standalone/node_modules/stringify-entities/lib/util/to-named.js +57 -0
  566. package/.next/standalone/node_modules/stringify-entities/package.json +86 -0
  567. package/.next/standalone/node_modules/zwitch/index.js +118 -0
  568. package/.next/standalone/node_modules/zwitch/package.json +72 -0
  569. package/.next/standalone/package-lock.json +719 -672
  570. package/.next/standalone/package.json +2 -1
  571. package/.next/standalone/release-please-config.json +1 -0
  572. package/.next/standalone/scripts/validate-catalog.ts +38 -0
  573. package/.next/standalone/server.js +1 -1
  574. package/.next/standalone/src/app/[...path]/route.ts +41 -0
  575. package/.next/standalone/src/app/ui/api/catalog/route.ts +32 -0
  576. package/.next/standalone/src/app/ui/api/global-mocks/[system]/[endpoint]/route.ts +53 -0
  577. package/.next/standalone/src/app/ui/api/global-mocks/route.ts +8 -0
  578. package/.next/standalone/src/app/ui/api/health/route.ts +47 -0
  579. package/.next/standalone/src/app/ui/api/logs/[logId]/route.ts +15 -0
  580. package/.next/standalone/src/app/ui/api/logs/route.ts +24 -0
  581. package/.next/standalone/src/app/ui/api/profiles/[profileId]/reset/route.ts +25 -0
  582. package/.next/standalone/src/app/ui/api/profiles/[profileId]/route.ts +64 -0
  583. package/.next/standalone/src/app/ui/catalog/highlight.ts +12 -0
  584. package/.next/standalone/src/app/ui/catalog/scenario-view.ts +68 -0
  585. package/.next/standalone/src/app/ui/global-mocks/actions.ts +50 -0
  586. package/.next/standalone/src/app/ui/logs/actions.ts +11 -0
  587. package/.next/standalone/src/app/ui/logs/list-state.ts +64 -0
  588. package/.next/standalone/src/app/ui/logs/types.ts +17 -0
  589. package/.next/standalone/src/app/ui/profiles/actions.ts +60 -0
  590. package/.next/standalone/src/lib/build-info.ts +13 -0
  591. package/.next/standalone/src/lib/catalog/find.ts +17 -0
  592. package/.next/standalone/src/lib/catalog/load.ts +226 -0
  593. package/.next/standalone/src/lib/catalog/path-template.ts +63 -0
  594. package/.next/standalone/src/lib/catalog/request-example.ts +96 -0
  595. package/.next/standalone/src/lib/catalog/schema.ts +154 -0
  596. package/.next/standalone/src/lib/catalog/selector.ts +153 -0
  597. package/.next/standalone/src/lib/catalog/types.ts +43 -0
  598. package/.next/standalone/src/lib/catalog/validate.ts +290 -0
  599. package/.next/standalone/src/lib/config.ts +93 -0
  600. package/.next/standalone/src/lib/dynamic/history-store.ts +68 -0
  601. package/.next/standalone/src/lib/environment.ts +155 -0
  602. package/.next/standalone/src/lib/format.ts +3 -0
  603. package/.next/standalone/src/lib/logs/admin-log.ts +27 -0
  604. package/.next/standalone/src/lib/logs/store.ts +153 -0
  605. package/.next/standalone/src/lib/mock-engine/fixtures.ts +38 -0
  606. package/.next/standalone/src/lib/mock-engine/resolver.ts +110 -0
  607. package/.next/standalone/src/lib/mock-engine/template.ts +71 -0
  608. package/.next/standalone/src/lib/mongo/embedded.ts +40 -0
  609. package/.next/standalone/src/lib/profiles/api-scenarios.ts +69 -0
  610. package/.next/standalone/src/lib/profiles/form.ts +64 -0
  611. package/.next/standalone/src/lib/profiles/stale.ts +56 -0
  612. package/.next/standalone/src/lib/profiles/store.ts +420 -0
  613. package/.next/standalone/src/lib/router/handler.ts +187 -0
  614. package/.next/standalone/src/lib/router/passthrough.ts +86 -0
  615. package/.next/standalone/src/lib/router/route-request.ts +645 -0
  616. package/.next/standalone/src/lib/runtime.ts +150 -0
  617. package/.next/standalone/src/lib/scenarios.ts +52 -0
  618. package/.next/standalone/src/lib/utils.ts +6 -0
  619. package/.next/standalone/tests/api/catalog-route.test.ts +72 -0
  620. package/.next/standalone/tests/api/global-mocks-route.test.ts +171 -0
  621. package/.next/standalone/tests/api/profiles-reset-route.test.ts +50 -0
  622. package/.next/standalone/tests/api/profiles-route.test.ts +132 -0
  623. package/.next/standalone/tests/bin/args.test.ts +42 -0
  624. package/.next/standalone/tests/catalog/find.test.ts +40 -0
  625. package/.next/standalone/tests/catalog/load.test.ts +258 -0
  626. package/.next/standalone/tests/catalog/path-template.test.ts +79 -0
  627. package/.next/standalone/tests/catalog/request-example.test.ts +86 -0
  628. package/.next/standalone/tests/catalog/schema.test.ts +249 -0
  629. package/.next/standalone/tests/catalog/selector.test.ts +175 -0
  630. package/.next/standalone/tests/catalog/validate.test.ts +462 -0
  631. package/.next/standalone/tests/dynamic/history-store.test.ts +82 -0
  632. package/.next/standalone/tests/global-mocks/actions.test.ts +192 -0
  633. package/.next/standalone/tests/lib/config-catalog-dir.test.ts +17 -0
  634. package/.next/standalone/tests/lib/config.test.ts +99 -0
  635. package/.next/standalone/tests/lib/environment.test.ts +115 -0
  636. package/.next/standalone/tests/lib/format.test.ts +8 -0
  637. package/.next/standalone/tests/lib/runtime.test.ts +153 -0
  638. package/.next/standalone/tests/lib/scenarios.test.ts +88 -0
  639. package/.next/standalone/tests/logs/admin-log.test.ts +51 -0
  640. package/.next/standalone/tests/logs/store.test.ts +233 -0
  641. package/.next/standalone/tests/mock-engine/fixtures.test.ts +33 -0
  642. package/.next/standalone/tests/mock-engine/resolver.test.ts +117 -0
  643. package/.next/standalone/tests/mock-engine/template.test.ts +74 -0
  644. package/.next/standalone/tests/mongo/embedded.test.ts +78 -0
  645. package/.next/standalone/tests/profiles/actions.test.ts +183 -0
  646. package/.next/standalone/tests/profiles/api-scenarios.test.ts +105 -0
  647. package/.next/standalone/tests/profiles/form.test.ts +181 -0
  648. package/.next/standalone/tests/profiles/request-log-ttl-index.test.ts +62 -0
  649. package/.next/standalone/tests/profiles/stale.test.ts +174 -0
  650. package/.next/standalone/tests/profiles/store.test.ts +470 -0
  651. package/.next/standalone/tests/router/dynamic.e2e.test.ts +147 -0
  652. package/.next/standalone/tests/router/handler.e2e.test.ts +97 -0
  653. package/.next/standalone/tests/router/handler.test.ts +344 -0
  654. package/.next/standalone/tests/router/passthrough.test.ts +100 -0
  655. package/.next/standalone/tests/router/route-request.test.ts +1147 -0
  656. package/.next/standalone/tests/testdata/fixtures/test-system/hello_world/by_amount.ts +3 -0
  657. package/.next/standalone/tests/testdata/fixtures/test-system/resolver_default/hold.json +1 -0
  658. package/.next/standalone/tests/testdata/fixtures/test-system/resolver_default/success.json +1 -0
  659. package/.next/standalone/tests/ui/list-state.test.ts +84 -0
  660. package/.next/standalone/tests/ui/log-summary-view.test.ts +24 -0
  661. package/.next/standalone/tests/ui/scenario-view.test.ts +138 -0
  662. package/.next/standalone/vitest.config.ts +19 -0
  663. package/package.json +2 -1
  664. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0668hgm._.js +0 -3
  665. package/.next/standalone/.next/server/chunks/[root-of-the-server]__078olc9._.js +0 -3
  666. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0f-_c79._.js +0 -3
  667. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0geqpjb._.js +0 -3
  668. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0uudiqz._.js +0 -3
  669. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0wg041t._.js +0 -3
  670. package/.next/standalone/.next/server/chunks/[root-of-the-server]__19qak1g._.js +0 -3
  671. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1eiw7ks._.js +0 -3
  672. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1qb7sih._.js +0 -3
  673. package/.next/standalone/.next/server/chunks/_095ilyi._.js +0 -11
  674. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__05255v2._.js +0 -3
  675. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0dmadib._.js +0 -3
  676. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0jey74_._.js +0 -3
  677. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0nj8b73._.js +0 -3
  678. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12oahit._.js +0 -3
  679. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__14u5l1_._.js +0 -3
  680. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1bbz1wr._.js +0 -3
  681. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1eoh3gn._.js +0 -3
  682. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kd5kn_._.js +0 -3
  683. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1kie6ah._.js +0 -3
  684. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1u6i1bm._.js +0 -3
  685. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1ypwv93._.js +0 -3
  686. package/.next/standalone/.next/server/chunks/ssr/_0a347_9._.js +0 -3
  687. package/.next/standalone/.next/server/chunks/ssr/_0btcklf._.js +0 -3
  688. package/.next/standalone/.next/server/chunks/ssr/_0exg_3l._.js +0 -11
  689. package/.next/standalone/.next/server/chunks/ssr/_1_7ssjl._.js +0 -3
  690. package/.next/standalone/.next/server/chunks/ssr/_1hdkp-g._.js +0 -3
  691. package/.next/standalone/.next/server/chunks/ssr/_1jfkfx-._.js +0 -3
  692. package/.next/standalone/.next/server/chunks/ssr/node_modules_10liiot._.js +0 -3
  693. package/.next/standalone/.next/static/chunks/08ghjqetuoc_b.js +0 -1
  694. package/.next/standalone/.next/static/chunks/19w2nv_pvssix.js +0 -1
  695. package/.next/standalone/.next/static/chunks/1ljc320o2yhky.js +0 -1
  696. package/.next/standalone/.next/static/chunks/2akx4rvdzbimg.css +0 -3
  697. package/.next/standalone/.next/static/chunks/2kg3qe34tmgob.js +0 -1
  698. package/.next/standalone/.next/static/chunks/2nlgh2oq4eg96.js +0 -1
  699. package/.next/standalone/.next/static/chunks/30olthhuj56a1.js +0 -1
  700. /package/.next/standalone/.next/static/{SV1UWx8kQm3m26f1jMoBU → 8CkjRpETX_8CM0X2xtdJ7}/_buildManifest.js +0 -0
  701. /package/.next/standalone/.next/static/{SV1UWx8kQm3m26f1jMoBU → 8CkjRpETX_8CM0X2xtdJ7}/_clientMiddlewareManifest.js +0 -0
  702. /package/.next/standalone/.next/static/{SV1UWx8kQm3m26f1jMoBU → 8CkjRpETX_8CM0X2xtdJ7}/_ssgManifest.js +0 -0
  703. /package/.next/standalone/catalog/hello-system/account_balance/{_dynamic.ts → dynamic.ts} +0 -0
@@ -0,0 +1,3216 @@
1
+ // src/utils.ts
2
+ function clone(something) {
3
+ return doClone(something);
4
+ }
5
+ function doClone(something) {
6
+ if (Array.isArray(something)) {
7
+ return cloneArray(something);
8
+ }
9
+ if (something instanceof RegExp) {
10
+ return something;
11
+ }
12
+ if (typeof something === "object") {
13
+ return cloneObj(something);
14
+ }
15
+ return something;
16
+ }
17
+ function cloneArray(arr) {
18
+ let r = [];
19
+ for (let i = 0, len = arr.length; i < len; i++) {
20
+ r[i] = doClone(arr[i]);
21
+ }
22
+ return r;
23
+ }
24
+ function cloneObj(obj) {
25
+ let r = {};
26
+ for (let key in obj) {
27
+ r[key] = doClone(obj[key]);
28
+ }
29
+ return r;
30
+ }
31
+ function mergeObjects(target, ...sources) {
32
+ sources.forEach((source) => {
33
+ for (let key in source) {
34
+ target[key] = source[key];
35
+ }
36
+ });
37
+ return target;
38
+ }
39
+ function basename(path) {
40
+ const idx = ~path.lastIndexOf("/") || ~path.lastIndexOf("\\");
41
+ if (idx === 0) {
42
+ return path;
43
+ } else if (~idx === path.length - 1) {
44
+ return basename(path.substring(0, path.length - 1));
45
+ } else {
46
+ return path.substr(~idx + 1);
47
+ }
48
+ }
49
+ var CAPTURING_REGEX_SOURCE = /\$(\d+)|\${(\d+):\/(downcase|upcase)}/g;
50
+ var RegexSource = class {
51
+ static hasCaptures(regexSource) {
52
+ if (regexSource === null) {
53
+ return false;
54
+ }
55
+ CAPTURING_REGEX_SOURCE.lastIndex = 0;
56
+ return CAPTURING_REGEX_SOURCE.test(regexSource);
57
+ }
58
+ static replaceCaptures(regexSource, captureSource, captureIndices) {
59
+ return regexSource.replace(CAPTURING_REGEX_SOURCE, (match, index, commandIndex, command) => {
60
+ let capture = captureIndices[parseInt(index || commandIndex, 10)];
61
+ if (capture) {
62
+ let result = captureSource.substring(capture.start, capture.end);
63
+ while (result[0] === ".") {
64
+ result = result.substring(1);
65
+ }
66
+ switch (command) {
67
+ case "downcase":
68
+ return result.toLowerCase();
69
+ case "upcase":
70
+ return result.toUpperCase();
71
+ default:
72
+ return result;
73
+ }
74
+ } else {
75
+ return match;
76
+ }
77
+ });
78
+ }
79
+ };
80
+ function strcmp(a, b) {
81
+ if (a < b) {
82
+ return -1;
83
+ }
84
+ if (a > b) {
85
+ return 1;
86
+ }
87
+ return 0;
88
+ }
89
+ function strArrCmp(a, b) {
90
+ if (a === null && b === null) {
91
+ return 0;
92
+ }
93
+ if (!a) {
94
+ return -1;
95
+ }
96
+ if (!b) {
97
+ return 1;
98
+ }
99
+ let len1 = a.length;
100
+ let len2 = b.length;
101
+ if (len1 === len2) {
102
+ for (let i = 0; i < len1; i++) {
103
+ let res = strcmp(a[i], b[i]);
104
+ if (res !== 0) {
105
+ return res;
106
+ }
107
+ }
108
+ return 0;
109
+ }
110
+ return len1 - len2;
111
+ }
112
+ function isValidHexColor(hex) {
113
+ if (/^#[0-9a-f]{6}$/i.test(hex)) {
114
+ return true;
115
+ }
116
+ if (/^#[0-9a-f]{8}$/i.test(hex)) {
117
+ return true;
118
+ }
119
+ if (/^#[0-9a-f]{3}$/i.test(hex)) {
120
+ return true;
121
+ }
122
+ if (/^#[0-9a-f]{4}$/i.test(hex)) {
123
+ return true;
124
+ }
125
+ return false;
126
+ }
127
+ function escapeRegExpCharacters(value) {
128
+ return value.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, "\\$&");
129
+ }
130
+ var CachedFn = class {
131
+ constructor(fn) {
132
+ this.fn = fn;
133
+ }
134
+ cache = /* @__PURE__ */ new Map();
135
+ get(key) {
136
+ if (this.cache.has(key)) {
137
+ return this.cache.get(key);
138
+ }
139
+ const value = this.fn(key);
140
+ this.cache.set(key, value);
141
+ return value;
142
+ }
143
+ };
144
+
145
+ // src/theme.ts
146
+ var Theme = class {
147
+ constructor(_colorMap, _defaults, _root) {
148
+ this._colorMap = _colorMap;
149
+ this._defaults = _defaults;
150
+ this._root = _root;
151
+ }
152
+ static createFromRawTheme(source, colorMap) {
153
+ return this.createFromParsedTheme(parseTheme(source), colorMap);
154
+ }
155
+ static createFromParsedTheme(source, colorMap) {
156
+ return resolveParsedThemeRules(source, colorMap);
157
+ }
158
+ _cachedMatchRoot = new CachedFn(
159
+ (scopeName) => this._root.match(scopeName)
160
+ );
161
+ getColorMap() {
162
+ return this._colorMap.getColorMap();
163
+ }
164
+ getDefaults() {
165
+ return this._defaults;
166
+ }
167
+ match(scopePath) {
168
+ if (scopePath === null) {
169
+ return this._defaults;
170
+ }
171
+ const scopeName = scopePath.scopeName;
172
+ const matchingTrieElements = this._cachedMatchRoot.get(scopeName);
173
+ const effectiveRule = matchingTrieElements.find(
174
+ (v) => _scopePathMatchesParentScopes(scopePath.parent, v.parentScopes)
175
+ );
176
+ if (!effectiveRule) {
177
+ return null;
178
+ }
179
+ return new StyleAttributes(
180
+ effectiveRule.fontStyle,
181
+ effectiveRule.foreground,
182
+ effectiveRule.background
183
+ );
184
+ }
185
+ };
186
+ var ScopeStack = class _ScopeStack {
187
+ constructor(parent, scopeName) {
188
+ this.parent = parent;
189
+ this.scopeName = scopeName;
190
+ }
191
+ static push(path, scopeNames) {
192
+ for (const name of scopeNames) {
193
+ path = new _ScopeStack(path, name);
194
+ }
195
+ return path;
196
+ }
197
+ static from(...segments) {
198
+ let result = null;
199
+ for (let i = 0; i < segments.length; i++) {
200
+ result = new _ScopeStack(result, segments[i]);
201
+ }
202
+ return result;
203
+ }
204
+ push(scopeName) {
205
+ return new _ScopeStack(this, scopeName);
206
+ }
207
+ getSegments() {
208
+ let item = this;
209
+ const result = [];
210
+ while (item) {
211
+ result.push(item.scopeName);
212
+ item = item.parent;
213
+ }
214
+ result.reverse();
215
+ return result;
216
+ }
217
+ toString() {
218
+ return this.getSegments().join(" ");
219
+ }
220
+ extends(other) {
221
+ if (this === other) {
222
+ return true;
223
+ }
224
+ if (this.parent === null) {
225
+ return false;
226
+ }
227
+ return this.parent.extends(other);
228
+ }
229
+ getExtensionIfDefined(base) {
230
+ const result = [];
231
+ let item = this;
232
+ while (item && item !== base) {
233
+ result.push(item.scopeName);
234
+ item = item.parent;
235
+ }
236
+ return item === base ? result.reverse() : void 0;
237
+ }
238
+ };
239
+ function _scopePathMatchesParentScopes(scopePath, parentScopes) {
240
+ if (parentScopes.length === 0) {
241
+ return true;
242
+ }
243
+ for (let index = 0; index < parentScopes.length; index++) {
244
+ let scopePattern = parentScopes[index];
245
+ let scopeMustMatch = false;
246
+ if (scopePattern === ">") {
247
+ if (index === parentScopes.length - 1) {
248
+ return false;
249
+ }
250
+ scopePattern = parentScopes[++index];
251
+ scopeMustMatch = true;
252
+ }
253
+ while (scopePath) {
254
+ if (_matchesScope(scopePath.scopeName, scopePattern)) {
255
+ break;
256
+ }
257
+ if (scopeMustMatch) {
258
+ return false;
259
+ }
260
+ scopePath = scopePath.parent;
261
+ }
262
+ if (!scopePath) {
263
+ return false;
264
+ }
265
+ scopePath = scopePath.parent;
266
+ }
267
+ return true;
268
+ }
269
+ function _matchesScope(scopeName, scopePattern) {
270
+ return scopePattern === scopeName || scopeName.startsWith(scopePattern) && scopeName[scopePattern.length] === ".";
271
+ }
272
+ var StyleAttributes = class {
273
+ constructor(fontStyle, foregroundId, backgroundId) {
274
+ this.fontStyle = fontStyle;
275
+ this.foregroundId = foregroundId;
276
+ this.backgroundId = backgroundId;
277
+ }
278
+ };
279
+ function parseTheme(source) {
280
+ if (!source) {
281
+ return [];
282
+ }
283
+ if (!source.settings || !Array.isArray(source.settings)) {
284
+ return [];
285
+ }
286
+ let settings = source.settings;
287
+ let result = [], resultLen = 0;
288
+ for (let i = 0, len = settings.length; i < len; i++) {
289
+ let entry = settings[i];
290
+ if (!entry.settings) {
291
+ continue;
292
+ }
293
+ let scopes;
294
+ if (typeof entry.scope === "string") {
295
+ let _scope = entry.scope;
296
+ _scope = _scope.replace(/^[,]+/, "");
297
+ _scope = _scope.replace(/[,]+$/, "");
298
+ scopes = _scope.split(",");
299
+ } else if (Array.isArray(entry.scope)) {
300
+ scopes = entry.scope;
301
+ } else {
302
+ scopes = [""];
303
+ }
304
+ let fontStyle = -1 /* NotSet */;
305
+ if (typeof entry.settings.fontStyle === "string") {
306
+ fontStyle = 0 /* None */;
307
+ let segments = entry.settings.fontStyle.split(" ");
308
+ for (let j = 0, lenJ = segments.length; j < lenJ; j++) {
309
+ let segment = segments[j];
310
+ switch (segment) {
311
+ case "italic":
312
+ fontStyle = fontStyle | 1 /* Italic */;
313
+ break;
314
+ case "bold":
315
+ fontStyle = fontStyle | 2 /* Bold */;
316
+ break;
317
+ case "underline":
318
+ fontStyle = fontStyle | 4 /* Underline */;
319
+ break;
320
+ case "strikethrough":
321
+ fontStyle = fontStyle | 8 /* Strikethrough */;
322
+ break;
323
+ }
324
+ }
325
+ }
326
+ let foreground = null;
327
+ if (typeof entry.settings.foreground === "string" && isValidHexColor(entry.settings.foreground)) {
328
+ foreground = entry.settings.foreground;
329
+ }
330
+ let background = null;
331
+ if (typeof entry.settings.background === "string" && isValidHexColor(entry.settings.background)) {
332
+ background = entry.settings.background;
333
+ }
334
+ for (let j = 0, lenJ = scopes.length; j < lenJ; j++) {
335
+ let _scope = scopes[j].trim();
336
+ let segments = _scope.split(" ");
337
+ let scope = segments[segments.length - 1];
338
+ let parentScopes = null;
339
+ if (segments.length > 1) {
340
+ parentScopes = segments.slice(0, segments.length - 1);
341
+ parentScopes.reverse();
342
+ }
343
+ result[resultLen++] = new ParsedThemeRule(
344
+ scope,
345
+ parentScopes,
346
+ i,
347
+ fontStyle,
348
+ foreground,
349
+ background
350
+ );
351
+ }
352
+ }
353
+ return result;
354
+ }
355
+ var ParsedThemeRule = class {
356
+ constructor(scope, parentScopes, index, fontStyle, foreground, background) {
357
+ this.scope = scope;
358
+ this.parentScopes = parentScopes;
359
+ this.index = index;
360
+ this.fontStyle = fontStyle;
361
+ this.foreground = foreground;
362
+ this.background = background;
363
+ }
364
+ };
365
+ var FontStyle = /* @__PURE__ */ ((FontStyle2) => {
366
+ FontStyle2[FontStyle2["NotSet"] = -1] = "NotSet";
367
+ FontStyle2[FontStyle2["None"] = 0] = "None";
368
+ FontStyle2[FontStyle2["Italic"] = 1] = "Italic";
369
+ FontStyle2[FontStyle2["Bold"] = 2] = "Bold";
370
+ FontStyle2[FontStyle2["Underline"] = 4] = "Underline";
371
+ FontStyle2[FontStyle2["Strikethrough"] = 8] = "Strikethrough";
372
+ return FontStyle2;
373
+ })(FontStyle || {});
374
+ function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
375
+ parsedThemeRules.sort((a, b) => {
376
+ let r = strcmp(a.scope, b.scope);
377
+ if (r !== 0) {
378
+ return r;
379
+ }
380
+ r = strArrCmp(a.parentScopes, b.parentScopes);
381
+ if (r !== 0) {
382
+ return r;
383
+ }
384
+ return a.index - b.index;
385
+ });
386
+ let defaultFontStyle = 0 /* None */;
387
+ let defaultForeground = "#000000";
388
+ let defaultBackground = "#ffffff";
389
+ while (parsedThemeRules.length >= 1 && parsedThemeRules[0].scope === "") {
390
+ let incomingDefaults = parsedThemeRules.shift();
391
+ if (incomingDefaults.fontStyle !== -1 /* NotSet */) {
392
+ defaultFontStyle = incomingDefaults.fontStyle;
393
+ }
394
+ if (incomingDefaults.foreground !== null) {
395
+ defaultForeground = incomingDefaults.foreground;
396
+ }
397
+ if (incomingDefaults.background !== null) {
398
+ defaultBackground = incomingDefaults.background;
399
+ }
400
+ }
401
+ let colorMap = new ColorMap(_colorMap);
402
+ let defaults = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
403
+ let root = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1 /* NotSet */, 0, 0), []);
404
+ for (let i = 0, len = parsedThemeRules.length; i < len; i++) {
405
+ let rule = parsedThemeRules[i];
406
+ root.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
407
+ }
408
+ return new Theme(colorMap, defaults, root);
409
+ }
410
+ var ColorMap = class {
411
+ _isFrozen;
412
+ _lastColorId;
413
+ _id2color;
414
+ _color2id;
415
+ constructor(_colorMap) {
416
+ this._lastColorId = 0;
417
+ this._id2color = [];
418
+ this._color2id = /* @__PURE__ */ Object.create(null);
419
+ if (Array.isArray(_colorMap)) {
420
+ this._isFrozen = true;
421
+ for (let i = 0, len = _colorMap.length; i < len; i++) {
422
+ this._color2id[_colorMap[i]] = i;
423
+ this._id2color[i] = _colorMap[i];
424
+ }
425
+ } else {
426
+ this._isFrozen = false;
427
+ }
428
+ }
429
+ getId(color) {
430
+ if (color === null) {
431
+ return 0;
432
+ }
433
+ color = color.toUpperCase();
434
+ let value = this._color2id[color];
435
+ if (value) {
436
+ return value;
437
+ }
438
+ if (this._isFrozen) {
439
+ throw new Error(`Missing color in color map - ${color}`);
440
+ }
441
+ value = ++this._lastColorId;
442
+ this._color2id[color] = value;
443
+ this._id2color[value] = color;
444
+ return value;
445
+ }
446
+ getColorMap() {
447
+ return this._id2color.slice(0);
448
+ }
449
+ };
450
+ var emptyParentScopes = Object.freeze([]);
451
+ var ThemeTrieElementRule = class _ThemeTrieElementRule {
452
+ scopeDepth;
453
+ parentScopes;
454
+ fontStyle;
455
+ foreground;
456
+ background;
457
+ constructor(scopeDepth, parentScopes, fontStyle, foreground, background) {
458
+ this.scopeDepth = scopeDepth;
459
+ this.parentScopes = parentScopes || emptyParentScopes;
460
+ this.fontStyle = fontStyle;
461
+ this.foreground = foreground;
462
+ this.background = background;
463
+ }
464
+ clone() {
465
+ return new _ThemeTrieElementRule(this.scopeDepth, this.parentScopes, this.fontStyle, this.foreground, this.background);
466
+ }
467
+ static cloneArr(arr) {
468
+ let r = [];
469
+ for (let i = 0, len = arr.length; i < len; i++) {
470
+ r[i] = arr[i].clone();
471
+ }
472
+ return r;
473
+ }
474
+ acceptOverwrite(scopeDepth, fontStyle, foreground, background) {
475
+ if (this.scopeDepth > scopeDepth) {
476
+ console.log("how did this happen?");
477
+ } else {
478
+ this.scopeDepth = scopeDepth;
479
+ }
480
+ if (fontStyle !== -1 /* NotSet */) {
481
+ this.fontStyle = fontStyle;
482
+ }
483
+ if (foreground !== 0) {
484
+ this.foreground = foreground;
485
+ }
486
+ if (background !== 0) {
487
+ this.background = background;
488
+ }
489
+ }
490
+ };
491
+ var ThemeTrieElement = class _ThemeTrieElement {
492
+ constructor(_mainRule, rulesWithParentScopes = [], _children = {}) {
493
+ this._mainRule = _mainRule;
494
+ this._children = _children;
495
+ this._rulesWithParentScopes = rulesWithParentScopes;
496
+ }
497
+ _rulesWithParentScopes;
498
+ static _cmpBySpecificity(a, b) {
499
+ if (a.scopeDepth !== b.scopeDepth) {
500
+ return b.scopeDepth - a.scopeDepth;
501
+ }
502
+ let aParentIndex = 0;
503
+ let bParentIndex = 0;
504
+ while (true) {
505
+ if (a.parentScopes[aParentIndex] === ">") {
506
+ aParentIndex++;
507
+ }
508
+ if (b.parentScopes[bParentIndex] === ">") {
509
+ bParentIndex++;
510
+ }
511
+ if (aParentIndex >= a.parentScopes.length || bParentIndex >= b.parentScopes.length) {
512
+ break;
513
+ }
514
+ const parentScopeLengthDiff = b.parentScopes[bParentIndex].length - a.parentScopes[aParentIndex].length;
515
+ if (parentScopeLengthDiff !== 0) {
516
+ return parentScopeLengthDiff;
517
+ }
518
+ aParentIndex++;
519
+ bParentIndex++;
520
+ }
521
+ return b.parentScopes.length - a.parentScopes.length;
522
+ }
523
+ match(scope) {
524
+ if (scope !== "") {
525
+ let dotIndex = scope.indexOf(".");
526
+ let head;
527
+ let tail;
528
+ if (dotIndex === -1) {
529
+ head = scope;
530
+ tail = "";
531
+ } else {
532
+ head = scope.substring(0, dotIndex);
533
+ tail = scope.substring(dotIndex + 1);
534
+ }
535
+ if (this._children.hasOwnProperty(head)) {
536
+ return this._children[head].match(tail);
537
+ }
538
+ }
539
+ const rules = this._rulesWithParentScopes.concat(this._mainRule);
540
+ rules.sort(_ThemeTrieElement._cmpBySpecificity);
541
+ return rules;
542
+ }
543
+ insert(scopeDepth, scope, parentScopes, fontStyle, foreground, background) {
544
+ if (scope === "") {
545
+ this._doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background);
546
+ return;
547
+ }
548
+ let dotIndex = scope.indexOf(".");
549
+ let head;
550
+ let tail;
551
+ if (dotIndex === -1) {
552
+ head = scope;
553
+ tail = "";
554
+ } else {
555
+ head = scope.substring(0, dotIndex);
556
+ tail = scope.substring(dotIndex + 1);
557
+ }
558
+ let child;
559
+ if (this._children.hasOwnProperty(head)) {
560
+ child = this._children[head];
561
+ } else {
562
+ child = new _ThemeTrieElement(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes));
563
+ this._children[head] = child;
564
+ }
565
+ child.insert(scopeDepth + 1, tail, parentScopes, fontStyle, foreground, background);
566
+ }
567
+ _doInsertHere(scopeDepth, parentScopes, fontStyle, foreground, background) {
568
+ if (parentScopes === null) {
569
+ this._mainRule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);
570
+ return;
571
+ }
572
+ for (let i = 0, len = this._rulesWithParentScopes.length; i < len; i++) {
573
+ let rule = this._rulesWithParentScopes[i];
574
+ if (strArrCmp(rule.parentScopes, parentScopes) === 0) {
575
+ rule.acceptOverwrite(scopeDepth, fontStyle, foreground, background);
576
+ return;
577
+ }
578
+ }
579
+ if (fontStyle === -1 /* NotSet */) {
580
+ fontStyle = this._mainRule.fontStyle;
581
+ }
582
+ if (foreground === 0) {
583
+ foreground = this._mainRule.foreground;
584
+ }
585
+ if (background === 0) {
586
+ background = this._mainRule.background;
587
+ }
588
+ this._rulesWithParentScopes.push(new ThemeTrieElementRule(scopeDepth, parentScopes, fontStyle, foreground, background));
589
+ }
590
+ };
591
+
592
+ // src/encodedTokenAttributes.ts
593
+ var EncodedTokenMetadata = class _EncodedTokenMetadata {
594
+ static toBinaryStr(encodedTokenAttributes) {
595
+ return encodedTokenAttributes.toString(2).padStart(32, "0");
596
+ }
597
+ static print(encodedTokenAttributes) {
598
+ const languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
599
+ const tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
600
+ const fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
601
+ const foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
602
+ const background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
603
+ console.log({
604
+ languageId,
605
+ tokenType,
606
+ fontStyle,
607
+ foreground,
608
+ background
609
+ });
610
+ }
611
+ static getLanguageId(encodedTokenAttributes) {
612
+ return (encodedTokenAttributes & 255 /* LANGUAGEID_MASK */) >>> 0 /* LANGUAGEID_OFFSET */;
613
+ }
614
+ static getTokenType(encodedTokenAttributes) {
615
+ return (encodedTokenAttributes & 768 /* TOKEN_TYPE_MASK */) >>> 8 /* TOKEN_TYPE_OFFSET */;
616
+ }
617
+ static containsBalancedBrackets(encodedTokenAttributes) {
618
+ return (encodedTokenAttributes & 1024 /* BALANCED_BRACKETS_MASK */) !== 0;
619
+ }
620
+ static getFontStyle(encodedTokenAttributes) {
621
+ return (encodedTokenAttributes & 30720 /* FONT_STYLE_MASK */) >>> 11 /* FONT_STYLE_OFFSET */;
622
+ }
623
+ static getForeground(encodedTokenAttributes) {
624
+ return (encodedTokenAttributes & 16744448 /* FOREGROUND_MASK */) >>> 15 /* FOREGROUND_OFFSET */;
625
+ }
626
+ static getBackground(encodedTokenAttributes) {
627
+ return (encodedTokenAttributes & 4278190080 /* BACKGROUND_MASK */) >>> 24 /* BACKGROUND_OFFSET */;
628
+ }
629
+ /**
630
+ * Updates the fields in `metadata`.
631
+ * A value of `0`, `NotSet` or `null` indicates that the corresponding field should be left as is.
632
+ */
633
+ static set(encodedTokenAttributes, languageId, tokenType, containsBalancedBrackets, fontStyle, foreground, background) {
634
+ let _languageId = _EncodedTokenMetadata.getLanguageId(encodedTokenAttributes);
635
+ let _tokenType = _EncodedTokenMetadata.getTokenType(encodedTokenAttributes);
636
+ let _containsBalancedBracketsBit = _EncodedTokenMetadata.containsBalancedBrackets(encodedTokenAttributes) ? 1 : 0;
637
+ let _fontStyle = _EncodedTokenMetadata.getFontStyle(encodedTokenAttributes);
638
+ let _foreground = _EncodedTokenMetadata.getForeground(encodedTokenAttributes);
639
+ let _background = _EncodedTokenMetadata.getBackground(encodedTokenAttributes);
640
+ if (languageId !== 0) {
641
+ _languageId = languageId;
642
+ }
643
+ if (tokenType !== 8 /* NotSet */) {
644
+ _tokenType = fromOptionalTokenType(tokenType);
645
+ }
646
+ if (containsBalancedBrackets !== null) {
647
+ _containsBalancedBracketsBit = containsBalancedBrackets ? 1 : 0;
648
+ }
649
+ if (fontStyle !== -1 /* NotSet */) {
650
+ _fontStyle = fontStyle;
651
+ }
652
+ if (foreground !== 0) {
653
+ _foreground = foreground;
654
+ }
655
+ if (background !== 0) {
656
+ _background = background;
657
+ }
658
+ return (_languageId << 0 /* LANGUAGEID_OFFSET */ | _tokenType << 8 /* TOKEN_TYPE_OFFSET */ | _containsBalancedBracketsBit << 10 /* BALANCED_BRACKETS_OFFSET */ | _fontStyle << 11 /* FONT_STYLE_OFFSET */ | _foreground << 15 /* FOREGROUND_OFFSET */ | _background << 24 /* BACKGROUND_OFFSET */) >>> 0;
659
+ }
660
+ };
661
+ function toOptionalTokenType(standardType) {
662
+ return standardType;
663
+ }
664
+ function fromOptionalTokenType(standardType) {
665
+ return standardType;
666
+ }
667
+
668
+ // src/matcher.ts
669
+ function createMatchers(selector, matchesName) {
670
+ const results = [];
671
+ const tokenizer = newTokenizer(selector);
672
+ let token = tokenizer.next();
673
+ while (token !== null) {
674
+ let priority = 0;
675
+ if (token.length === 2 && token.charAt(1) === ":") {
676
+ switch (token.charAt(0)) {
677
+ case "R":
678
+ priority = 1;
679
+ break;
680
+ case "L":
681
+ priority = -1;
682
+ break;
683
+ default:
684
+ console.log(`Unknown priority ${token} in scope selector`);
685
+ }
686
+ token = tokenizer.next();
687
+ }
688
+ let matcher = parseConjunction();
689
+ results.push({ matcher, priority });
690
+ if (token !== ",") {
691
+ break;
692
+ }
693
+ token = tokenizer.next();
694
+ }
695
+ return results;
696
+ function parseOperand() {
697
+ if (token === "-") {
698
+ token = tokenizer.next();
699
+ const expressionToNegate = parseOperand();
700
+ return (matcherInput) => !!expressionToNegate && !expressionToNegate(matcherInput);
701
+ }
702
+ if (token === "(") {
703
+ token = tokenizer.next();
704
+ const expressionInParents = parseInnerExpression();
705
+ if (token === ")") {
706
+ token = tokenizer.next();
707
+ }
708
+ return expressionInParents;
709
+ }
710
+ if (isIdentifier(token)) {
711
+ const identifiers = [];
712
+ do {
713
+ identifiers.push(token);
714
+ token = tokenizer.next();
715
+ } while (isIdentifier(token));
716
+ return (matcherInput) => matchesName(identifiers, matcherInput);
717
+ }
718
+ return null;
719
+ }
720
+ function parseConjunction() {
721
+ const matchers = [];
722
+ let matcher = parseOperand();
723
+ while (matcher) {
724
+ matchers.push(matcher);
725
+ matcher = parseOperand();
726
+ }
727
+ return (matcherInput) => matchers.every((matcher2) => matcher2(matcherInput));
728
+ }
729
+ function parseInnerExpression() {
730
+ const matchers = [];
731
+ let matcher = parseConjunction();
732
+ while (matcher) {
733
+ matchers.push(matcher);
734
+ if (token === "|" || token === ",") {
735
+ do {
736
+ token = tokenizer.next();
737
+ } while (token === "|" || token === ",");
738
+ } else {
739
+ break;
740
+ }
741
+ matcher = parseConjunction();
742
+ }
743
+ return (matcherInput) => matchers.some((matcher2) => matcher2(matcherInput));
744
+ }
745
+ }
746
+ function isIdentifier(token) {
747
+ return !!token && !!token.match(/[\w\.:]+/);
748
+ }
749
+ function newTokenizer(input) {
750
+ let regex = /([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g;
751
+ let match = regex.exec(input);
752
+ return {
753
+ next: () => {
754
+ if (!match) {
755
+ return null;
756
+ }
757
+ const res = match[0];
758
+ match = regex.exec(input);
759
+ return res;
760
+ }
761
+ };
762
+ }
763
+
764
+ // src/onigLib.ts
765
+ var FindOption = /* @__PURE__ */ ((FindOption2) => {
766
+ FindOption2[FindOption2["None"] = 0] = "None";
767
+ FindOption2[FindOption2["NotBeginString"] = 1] = "NotBeginString";
768
+ FindOption2[FindOption2["NotEndString"] = 2] = "NotEndString";
769
+ FindOption2[FindOption2["NotBeginPosition"] = 4] = "NotBeginPosition";
770
+ FindOption2[FindOption2["DebugCall"] = 8] = "DebugCall";
771
+ return FindOption2;
772
+ })(FindOption || {});
773
+ function disposeOnigString(str) {
774
+ if (typeof str.dispose === "function") {
775
+ str.dispose();
776
+ }
777
+ }
778
+
779
+ // src/grammar/grammarDependencies.ts
780
+ var TopLevelRuleReference = class {
781
+ constructor(scopeName) {
782
+ this.scopeName = scopeName;
783
+ }
784
+ toKey() {
785
+ return this.scopeName;
786
+ }
787
+ };
788
+ var TopLevelRepositoryRuleReference = class {
789
+ constructor(scopeName, ruleName) {
790
+ this.scopeName = scopeName;
791
+ this.ruleName = ruleName;
792
+ }
793
+ toKey() {
794
+ return `${this.scopeName}#${this.ruleName}`;
795
+ }
796
+ };
797
+ var ExternalReferenceCollector = class {
798
+ _references = [];
799
+ _seenReferenceKeys = /* @__PURE__ */ new Set();
800
+ get references() {
801
+ return this._references;
802
+ }
803
+ visitedRule = /* @__PURE__ */ new Set();
804
+ add(reference) {
805
+ const key = reference.toKey();
806
+ if (this._seenReferenceKeys.has(key)) {
807
+ return;
808
+ }
809
+ this._seenReferenceKeys.add(key);
810
+ this._references.push(reference);
811
+ }
812
+ };
813
+ var ScopeDependencyProcessor = class {
814
+ constructor(repo, initialScopeName) {
815
+ this.repo = repo;
816
+ this.initialScopeName = initialScopeName;
817
+ this.seenFullScopeRequests.add(this.initialScopeName);
818
+ this.Q = [new TopLevelRuleReference(this.initialScopeName)];
819
+ }
820
+ seenFullScopeRequests = /* @__PURE__ */ new Set();
821
+ seenPartialScopeRequests = /* @__PURE__ */ new Set();
822
+ Q;
823
+ processQueue() {
824
+ const q = this.Q;
825
+ this.Q = [];
826
+ const deps = new ExternalReferenceCollector();
827
+ for (const dep of q) {
828
+ collectReferencesOfReference(dep, this.initialScopeName, this.repo, deps);
829
+ }
830
+ for (const dep of deps.references) {
831
+ if (dep instanceof TopLevelRuleReference) {
832
+ if (this.seenFullScopeRequests.has(dep.scopeName)) {
833
+ continue;
834
+ }
835
+ this.seenFullScopeRequests.add(dep.scopeName);
836
+ this.Q.push(dep);
837
+ } else {
838
+ if (this.seenFullScopeRequests.has(dep.scopeName)) {
839
+ continue;
840
+ }
841
+ if (this.seenPartialScopeRequests.has(dep.toKey())) {
842
+ continue;
843
+ }
844
+ this.seenPartialScopeRequests.add(dep.toKey());
845
+ this.Q.push(dep);
846
+ }
847
+ }
848
+ }
849
+ };
850
+ function collectReferencesOfReference(reference, baseGrammarScopeName, repo, result) {
851
+ const selfGrammar = repo.lookup(reference.scopeName);
852
+ if (!selfGrammar) {
853
+ if (reference.scopeName === baseGrammarScopeName) {
854
+ throw new Error(`No grammar provided for <${baseGrammarScopeName}>`);
855
+ }
856
+ return;
857
+ }
858
+ const baseGrammar = repo.lookup(baseGrammarScopeName);
859
+ if (reference instanceof TopLevelRuleReference) {
860
+ collectExternalReferencesInTopLevelRule({ baseGrammar, selfGrammar }, result);
861
+ } else {
862
+ collectExternalReferencesInTopLevelRepositoryRule(
863
+ reference.ruleName,
864
+ { baseGrammar, selfGrammar, repository: selfGrammar.repository },
865
+ result
866
+ );
867
+ }
868
+ const injections = repo.injections(reference.scopeName);
869
+ if (injections) {
870
+ for (const injection of injections) {
871
+ result.add(new TopLevelRuleReference(injection));
872
+ }
873
+ }
874
+ }
875
+ function collectExternalReferencesInTopLevelRepositoryRule(ruleName, context, result) {
876
+ if (context.repository && context.repository[ruleName]) {
877
+ const rule = context.repository[ruleName];
878
+ collectExternalReferencesInRules([rule], context, result);
879
+ }
880
+ }
881
+ function collectExternalReferencesInTopLevelRule(context, result) {
882
+ if (context.selfGrammar.patterns && Array.isArray(context.selfGrammar.patterns)) {
883
+ collectExternalReferencesInRules(
884
+ context.selfGrammar.patterns,
885
+ { ...context, repository: context.selfGrammar.repository },
886
+ result
887
+ );
888
+ }
889
+ if (context.selfGrammar.injections) {
890
+ collectExternalReferencesInRules(
891
+ Object.values(context.selfGrammar.injections),
892
+ { ...context, repository: context.selfGrammar.repository },
893
+ result
894
+ );
895
+ }
896
+ }
897
+ function collectExternalReferencesInRules(rules, context, result) {
898
+ for (const rule of rules) {
899
+ if (result.visitedRule.has(rule)) {
900
+ continue;
901
+ }
902
+ result.visitedRule.add(rule);
903
+ const patternRepository = rule.repository ? mergeObjects({}, context.repository, rule.repository) : context.repository;
904
+ if (Array.isArray(rule.patterns)) {
905
+ collectExternalReferencesInRules(rule.patterns, { ...context, repository: patternRepository }, result);
906
+ }
907
+ const include = rule.include;
908
+ if (!include) {
909
+ continue;
910
+ }
911
+ const reference = parseInclude(include);
912
+ switch (reference.kind) {
913
+ case 0 /* Base */:
914
+ collectExternalReferencesInTopLevelRule({ ...context, selfGrammar: context.baseGrammar }, result);
915
+ break;
916
+ case 1 /* Self */:
917
+ collectExternalReferencesInTopLevelRule(context, result);
918
+ break;
919
+ case 2 /* RelativeReference */:
920
+ collectExternalReferencesInTopLevelRepositoryRule(reference.ruleName, { ...context, repository: patternRepository }, result);
921
+ break;
922
+ case 3 /* TopLevelReference */:
923
+ case 4 /* TopLevelRepositoryReference */:
924
+ const selfGrammar = reference.scopeName === context.selfGrammar.scopeName ? context.selfGrammar : reference.scopeName === context.baseGrammar.scopeName ? context.baseGrammar : void 0;
925
+ if (selfGrammar) {
926
+ const newContext = { baseGrammar: context.baseGrammar, selfGrammar, repository: patternRepository };
927
+ if (reference.kind === 4 /* TopLevelRepositoryReference */) {
928
+ collectExternalReferencesInTopLevelRepositoryRule(reference.ruleName, newContext, result);
929
+ } else {
930
+ collectExternalReferencesInTopLevelRule(newContext, result);
931
+ }
932
+ } else {
933
+ if (reference.kind === 4 /* TopLevelRepositoryReference */) {
934
+ result.add(new TopLevelRepositoryRuleReference(reference.scopeName, reference.ruleName));
935
+ } else {
936
+ result.add(new TopLevelRuleReference(reference.scopeName));
937
+ }
938
+ }
939
+ break;
940
+ }
941
+ }
942
+ }
943
+ var BaseReference = class {
944
+ kind = 0 /* Base */;
945
+ };
946
+ var SelfReference = class {
947
+ kind = 1 /* Self */;
948
+ };
949
+ var RelativeReference = class {
950
+ constructor(ruleName) {
951
+ this.ruleName = ruleName;
952
+ }
953
+ kind = 2 /* RelativeReference */;
954
+ };
955
+ var TopLevelReference = class {
956
+ constructor(scopeName) {
957
+ this.scopeName = scopeName;
958
+ }
959
+ kind = 3 /* TopLevelReference */;
960
+ };
961
+ var TopLevelRepositoryReference = class {
962
+ constructor(scopeName, ruleName) {
963
+ this.scopeName = scopeName;
964
+ this.ruleName = ruleName;
965
+ }
966
+ kind = 4 /* TopLevelRepositoryReference */;
967
+ };
968
+ function parseInclude(include) {
969
+ if (include === "$base") {
970
+ return new BaseReference();
971
+ } else if (include === "$self") {
972
+ return new SelfReference();
973
+ }
974
+ const indexOfSharp = include.indexOf("#");
975
+ if (indexOfSharp === -1) {
976
+ return new TopLevelReference(include);
977
+ } else if (indexOfSharp === 0) {
978
+ return new RelativeReference(include.substring(1));
979
+ } else {
980
+ const scopeName = include.substring(0, indexOfSharp);
981
+ const ruleName = include.substring(indexOfSharp + 1);
982
+ return new TopLevelRepositoryReference(scopeName, ruleName);
983
+ }
984
+ }
985
+
986
+ // src/rule.ts
987
+ var HAS_BACK_REFERENCES = /\\(\d+)/;
988
+ var BACK_REFERENCING_END = /\\(\d+)/g;
989
+ var ruleIdSymbol = Symbol("RuleId");
990
+ var endRuleId = -1;
991
+ var whileRuleId = -2;
992
+ function ruleIdFromNumber(id) {
993
+ return id;
994
+ }
995
+ function ruleIdToNumber(id) {
996
+ return id;
997
+ }
998
+ var Rule = class {
999
+ $location;
1000
+ id;
1001
+ _nameIsCapturing;
1002
+ _name;
1003
+ _contentNameIsCapturing;
1004
+ _contentName;
1005
+ constructor($location, id, name, contentName) {
1006
+ this.$location = $location;
1007
+ this.id = id;
1008
+ this._name = name || null;
1009
+ this._nameIsCapturing = RegexSource.hasCaptures(this._name);
1010
+ this._contentName = contentName || null;
1011
+ this._contentNameIsCapturing = RegexSource.hasCaptures(this._contentName);
1012
+ }
1013
+ get debugName() {
1014
+ const location = this.$location ? `${basename(this.$location.filename)}:${this.$location.line}` : "unknown";
1015
+ return `${this.constructor.name}#${this.id} @ ${location}`;
1016
+ }
1017
+ getName(lineText, captureIndices) {
1018
+ if (!this._nameIsCapturing || this._name === null || lineText === null || captureIndices === null) {
1019
+ return this._name;
1020
+ }
1021
+ return RegexSource.replaceCaptures(this._name, lineText, captureIndices);
1022
+ }
1023
+ getContentName(lineText, captureIndices) {
1024
+ if (!this._contentNameIsCapturing || this._contentName === null) {
1025
+ return this._contentName;
1026
+ }
1027
+ return RegexSource.replaceCaptures(this._contentName, lineText, captureIndices);
1028
+ }
1029
+ };
1030
+ var CaptureRule = class extends Rule {
1031
+ retokenizeCapturedWithRuleId;
1032
+ constructor($location, id, name, contentName, retokenizeCapturedWithRuleId) {
1033
+ super($location, id, name, contentName);
1034
+ this.retokenizeCapturedWithRuleId = retokenizeCapturedWithRuleId;
1035
+ }
1036
+ dispose() {
1037
+ }
1038
+ collectPatterns(grammar, out) {
1039
+ throw new Error("Not supported!");
1040
+ }
1041
+ compile(grammar, endRegexSource) {
1042
+ throw new Error("Not supported!");
1043
+ }
1044
+ compileAG(grammar, endRegexSource, allowA, allowG) {
1045
+ throw new Error("Not supported!");
1046
+ }
1047
+ };
1048
+ var MatchRule = class extends Rule {
1049
+ _match;
1050
+ captures;
1051
+ _cachedCompiledPatterns;
1052
+ constructor($location, id, name, match, captures) {
1053
+ super($location, id, name, null);
1054
+ this._match = new RegExpSource(match, this.id);
1055
+ this.captures = captures;
1056
+ this._cachedCompiledPatterns = null;
1057
+ }
1058
+ dispose() {
1059
+ if (this._cachedCompiledPatterns) {
1060
+ this._cachedCompiledPatterns.dispose();
1061
+ this._cachedCompiledPatterns = null;
1062
+ }
1063
+ }
1064
+ get debugMatchRegExp() {
1065
+ return `${this._match.source}`;
1066
+ }
1067
+ collectPatterns(grammar, out) {
1068
+ out.push(this._match);
1069
+ }
1070
+ compile(grammar, endRegexSource) {
1071
+ return this._getCachedCompiledPatterns(grammar).compile(grammar);
1072
+ }
1073
+ compileAG(grammar, endRegexSource, allowA, allowG) {
1074
+ return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
1075
+ }
1076
+ _getCachedCompiledPatterns(grammar) {
1077
+ if (!this._cachedCompiledPatterns) {
1078
+ this._cachedCompiledPatterns = new RegExpSourceList();
1079
+ this.collectPatterns(grammar, this._cachedCompiledPatterns);
1080
+ }
1081
+ return this._cachedCompiledPatterns;
1082
+ }
1083
+ };
1084
+ var IncludeOnlyRule = class extends Rule {
1085
+ hasMissingPatterns;
1086
+ patterns;
1087
+ _cachedCompiledPatterns;
1088
+ constructor($location, id, name, contentName, patterns) {
1089
+ super($location, id, name, contentName);
1090
+ this.patterns = patterns.patterns;
1091
+ this.hasMissingPatterns = patterns.hasMissingPatterns;
1092
+ this._cachedCompiledPatterns = null;
1093
+ }
1094
+ dispose() {
1095
+ if (this._cachedCompiledPatterns) {
1096
+ this._cachedCompiledPatterns.dispose();
1097
+ this._cachedCompiledPatterns = null;
1098
+ }
1099
+ }
1100
+ collectPatterns(grammar, out) {
1101
+ for (const pattern of this.patterns) {
1102
+ const rule = grammar.getRule(pattern);
1103
+ rule.collectPatterns(grammar, out);
1104
+ }
1105
+ }
1106
+ compile(grammar, endRegexSource) {
1107
+ return this._getCachedCompiledPatterns(grammar).compile(grammar);
1108
+ }
1109
+ compileAG(grammar, endRegexSource, allowA, allowG) {
1110
+ return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
1111
+ }
1112
+ _getCachedCompiledPatterns(grammar) {
1113
+ if (!this._cachedCompiledPatterns) {
1114
+ this._cachedCompiledPatterns = new RegExpSourceList();
1115
+ this.collectPatterns(grammar, this._cachedCompiledPatterns);
1116
+ }
1117
+ return this._cachedCompiledPatterns;
1118
+ }
1119
+ };
1120
+ var BeginEndRule = class extends Rule {
1121
+ _begin;
1122
+ beginCaptures;
1123
+ _end;
1124
+ endHasBackReferences;
1125
+ endCaptures;
1126
+ applyEndPatternLast;
1127
+ hasMissingPatterns;
1128
+ patterns;
1129
+ _cachedCompiledPatterns;
1130
+ constructor($location, id, name, contentName, begin, beginCaptures, end, endCaptures, applyEndPatternLast, patterns) {
1131
+ super($location, id, name, contentName);
1132
+ this._begin = new RegExpSource(begin, this.id);
1133
+ this.beginCaptures = beginCaptures;
1134
+ this._end = new RegExpSource(end ? end : "\uFFFF", -1);
1135
+ this.endHasBackReferences = this._end.hasBackReferences;
1136
+ this.endCaptures = endCaptures;
1137
+ this.applyEndPatternLast = applyEndPatternLast || false;
1138
+ this.patterns = patterns.patterns;
1139
+ this.hasMissingPatterns = patterns.hasMissingPatterns;
1140
+ this._cachedCompiledPatterns = null;
1141
+ }
1142
+ dispose() {
1143
+ if (this._cachedCompiledPatterns) {
1144
+ this._cachedCompiledPatterns.dispose();
1145
+ this._cachedCompiledPatterns = null;
1146
+ }
1147
+ }
1148
+ get debugBeginRegExp() {
1149
+ return `${this._begin.source}`;
1150
+ }
1151
+ get debugEndRegExp() {
1152
+ return `${this._end.source}`;
1153
+ }
1154
+ getEndWithResolvedBackReferences(lineText, captureIndices) {
1155
+ return this._end.resolveBackReferences(lineText, captureIndices);
1156
+ }
1157
+ collectPatterns(grammar, out) {
1158
+ out.push(this._begin);
1159
+ }
1160
+ compile(grammar, endRegexSource) {
1161
+ return this._getCachedCompiledPatterns(grammar, endRegexSource).compile(grammar);
1162
+ }
1163
+ compileAG(grammar, endRegexSource, allowA, allowG) {
1164
+ return this._getCachedCompiledPatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);
1165
+ }
1166
+ _getCachedCompiledPatterns(grammar, endRegexSource) {
1167
+ if (!this._cachedCompiledPatterns) {
1168
+ this._cachedCompiledPatterns = new RegExpSourceList();
1169
+ for (const pattern of this.patterns) {
1170
+ const rule = grammar.getRule(pattern);
1171
+ rule.collectPatterns(grammar, this._cachedCompiledPatterns);
1172
+ }
1173
+ if (this.applyEndPatternLast) {
1174
+ this._cachedCompiledPatterns.push(this._end.hasBackReferences ? this._end.clone() : this._end);
1175
+ } else {
1176
+ this._cachedCompiledPatterns.unshift(this._end.hasBackReferences ? this._end.clone() : this._end);
1177
+ }
1178
+ }
1179
+ if (this._end.hasBackReferences) {
1180
+ if (this.applyEndPatternLast) {
1181
+ this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length() - 1, endRegexSource);
1182
+ } else {
1183
+ this._cachedCompiledPatterns.setSource(0, endRegexSource);
1184
+ }
1185
+ }
1186
+ return this._cachedCompiledPatterns;
1187
+ }
1188
+ };
1189
+ var BeginWhileRule = class extends Rule {
1190
+ _begin;
1191
+ beginCaptures;
1192
+ whileCaptures;
1193
+ _while;
1194
+ whileHasBackReferences;
1195
+ hasMissingPatterns;
1196
+ patterns;
1197
+ _cachedCompiledPatterns;
1198
+ _cachedCompiledWhilePatterns;
1199
+ constructor($location, id, name, contentName, begin, beginCaptures, _while, whileCaptures, patterns) {
1200
+ super($location, id, name, contentName);
1201
+ this._begin = new RegExpSource(begin, this.id);
1202
+ this.beginCaptures = beginCaptures;
1203
+ this.whileCaptures = whileCaptures;
1204
+ this._while = new RegExpSource(_while, whileRuleId);
1205
+ this.whileHasBackReferences = this._while.hasBackReferences;
1206
+ this.patterns = patterns.patterns;
1207
+ this.hasMissingPatterns = patterns.hasMissingPatterns;
1208
+ this._cachedCompiledPatterns = null;
1209
+ this._cachedCompiledWhilePatterns = null;
1210
+ }
1211
+ dispose() {
1212
+ if (this._cachedCompiledPatterns) {
1213
+ this._cachedCompiledPatterns.dispose();
1214
+ this._cachedCompiledPatterns = null;
1215
+ }
1216
+ if (this._cachedCompiledWhilePatterns) {
1217
+ this._cachedCompiledWhilePatterns.dispose();
1218
+ this._cachedCompiledWhilePatterns = null;
1219
+ }
1220
+ }
1221
+ get debugBeginRegExp() {
1222
+ return `${this._begin.source}`;
1223
+ }
1224
+ get debugWhileRegExp() {
1225
+ return `${this._while.source}`;
1226
+ }
1227
+ getWhileWithResolvedBackReferences(lineText, captureIndices) {
1228
+ return this._while.resolveBackReferences(lineText, captureIndices);
1229
+ }
1230
+ collectPatterns(grammar, out) {
1231
+ out.push(this._begin);
1232
+ }
1233
+ compile(grammar, endRegexSource) {
1234
+ return this._getCachedCompiledPatterns(grammar).compile(grammar);
1235
+ }
1236
+ compileAG(grammar, endRegexSource, allowA, allowG) {
1237
+ return this._getCachedCompiledPatterns(grammar).compileAG(grammar, allowA, allowG);
1238
+ }
1239
+ _getCachedCompiledPatterns(grammar) {
1240
+ if (!this._cachedCompiledPatterns) {
1241
+ this._cachedCompiledPatterns = new RegExpSourceList();
1242
+ for (const pattern of this.patterns) {
1243
+ const rule = grammar.getRule(pattern);
1244
+ rule.collectPatterns(grammar, this._cachedCompiledPatterns);
1245
+ }
1246
+ }
1247
+ return this._cachedCompiledPatterns;
1248
+ }
1249
+ compileWhile(grammar, endRegexSource) {
1250
+ return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compile(grammar);
1251
+ }
1252
+ compileWhileAG(grammar, endRegexSource, allowA, allowG) {
1253
+ return this._getCachedCompiledWhilePatterns(grammar, endRegexSource).compileAG(grammar, allowA, allowG);
1254
+ }
1255
+ _getCachedCompiledWhilePatterns(grammar, endRegexSource) {
1256
+ if (!this._cachedCompiledWhilePatterns) {
1257
+ this._cachedCompiledWhilePatterns = new RegExpSourceList();
1258
+ this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences ? this._while.clone() : this._while);
1259
+ }
1260
+ if (this._while.hasBackReferences) {
1261
+ this._cachedCompiledWhilePatterns.setSource(0, endRegexSource ? endRegexSource : "\uFFFF");
1262
+ }
1263
+ return this._cachedCompiledWhilePatterns;
1264
+ }
1265
+ };
1266
+ var RuleFactory = class _RuleFactory {
1267
+ static createCaptureRule(helper, $location, name, contentName, retokenizeCapturedWithRuleId) {
1268
+ return helper.registerRule((id) => {
1269
+ return new CaptureRule($location, id, name, contentName, retokenizeCapturedWithRuleId);
1270
+ });
1271
+ }
1272
+ static getCompiledRuleId(desc, helper, repository) {
1273
+ if (!desc.id) {
1274
+ helper.registerRule((id) => {
1275
+ desc.id = id;
1276
+ if (desc.match) {
1277
+ return new MatchRule(
1278
+ desc.$vscodeTextmateLocation,
1279
+ desc.id,
1280
+ desc.name,
1281
+ desc.match,
1282
+ _RuleFactory._compileCaptures(desc.captures, helper, repository)
1283
+ );
1284
+ }
1285
+ if (typeof desc.begin === "undefined") {
1286
+ if (desc.repository) {
1287
+ repository = mergeObjects({}, repository, desc.repository);
1288
+ }
1289
+ let patterns = desc.patterns;
1290
+ if (typeof patterns === "undefined" && desc.include) {
1291
+ patterns = [{ include: desc.include }];
1292
+ }
1293
+ return new IncludeOnlyRule(
1294
+ desc.$vscodeTextmateLocation,
1295
+ desc.id,
1296
+ desc.name,
1297
+ desc.contentName,
1298
+ _RuleFactory._compilePatterns(patterns, helper, repository)
1299
+ );
1300
+ }
1301
+ if (desc.while) {
1302
+ return new BeginWhileRule(
1303
+ desc.$vscodeTextmateLocation,
1304
+ desc.id,
1305
+ desc.name,
1306
+ desc.contentName,
1307
+ desc.begin,
1308
+ _RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository),
1309
+ desc.while,
1310
+ _RuleFactory._compileCaptures(desc.whileCaptures || desc.captures, helper, repository),
1311
+ _RuleFactory._compilePatterns(desc.patterns, helper, repository)
1312
+ );
1313
+ }
1314
+ return new BeginEndRule(
1315
+ desc.$vscodeTextmateLocation,
1316
+ desc.id,
1317
+ desc.name,
1318
+ desc.contentName,
1319
+ desc.begin,
1320
+ _RuleFactory._compileCaptures(desc.beginCaptures || desc.captures, helper, repository),
1321
+ desc.end,
1322
+ _RuleFactory._compileCaptures(desc.endCaptures || desc.captures, helper, repository),
1323
+ desc.applyEndPatternLast,
1324
+ _RuleFactory._compilePatterns(desc.patterns, helper, repository)
1325
+ );
1326
+ });
1327
+ }
1328
+ return desc.id;
1329
+ }
1330
+ static _compileCaptures(captures, helper, repository) {
1331
+ let r = [];
1332
+ if (captures) {
1333
+ let maximumCaptureId = 0;
1334
+ for (const captureId in captures) {
1335
+ if (captureId === "$vscodeTextmateLocation") {
1336
+ continue;
1337
+ }
1338
+ const numericCaptureId = parseInt(captureId, 10);
1339
+ if (numericCaptureId > maximumCaptureId) {
1340
+ maximumCaptureId = numericCaptureId;
1341
+ }
1342
+ }
1343
+ for (let i = 0; i <= maximumCaptureId; i++) {
1344
+ r[i] = null;
1345
+ }
1346
+ for (const captureId in captures) {
1347
+ if (captureId === "$vscodeTextmateLocation") {
1348
+ continue;
1349
+ }
1350
+ const numericCaptureId = parseInt(captureId, 10);
1351
+ let retokenizeCapturedWithRuleId = 0;
1352
+ if (captures[captureId].patterns) {
1353
+ retokenizeCapturedWithRuleId = _RuleFactory.getCompiledRuleId(captures[captureId], helper, repository);
1354
+ }
1355
+ r[numericCaptureId] = _RuleFactory.createCaptureRule(helper, captures[captureId].$vscodeTextmateLocation, captures[captureId].name, captures[captureId].contentName, retokenizeCapturedWithRuleId);
1356
+ }
1357
+ }
1358
+ return r;
1359
+ }
1360
+ static _compilePatterns(patterns, helper, repository) {
1361
+ let r = [];
1362
+ if (patterns) {
1363
+ for (let i = 0, len = patterns.length; i < len; i++) {
1364
+ const pattern = patterns[i];
1365
+ let ruleId = -1;
1366
+ if (pattern.include) {
1367
+ const reference = parseInclude(pattern.include);
1368
+ switch (reference.kind) {
1369
+ case 0 /* Base */:
1370
+ case 1 /* Self */:
1371
+ ruleId = _RuleFactory.getCompiledRuleId(repository[pattern.include], helper, repository);
1372
+ break;
1373
+ case 2 /* RelativeReference */:
1374
+ let localIncludedRule = repository[reference.ruleName];
1375
+ if (localIncludedRule) {
1376
+ ruleId = _RuleFactory.getCompiledRuleId(localIncludedRule, helper, repository);
1377
+ } else {
1378
+ }
1379
+ break;
1380
+ case 3 /* TopLevelReference */:
1381
+ case 4 /* TopLevelRepositoryReference */:
1382
+ const externalGrammarName = reference.scopeName;
1383
+ const externalGrammarInclude = reference.kind === 4 /* TopLevelRepositoryReference */ ? reference.ruleName : null;
1384
+ const externalGrammar = helper.getExternalGrammar(externalGrammarName, repository);
1385
+ if (externalGrammar) {
1386
+ if (externalGrammarInclude) {
1387
+ let externalIncludedRule = externalGrammar.repository[externalGrammarInclude];
1388
+ if (externalIncludedRule) {
1389
+ ruleId = _RuleFactory.getCompiledRuleId(externalIncludedRule, helper, externalGrammar.repository);
1390
+ } else {
1391
+ }
1392
+ } else {
1393
+ ruleId = _RuleFactory.getCompiledRuleId(externalGrammar.repository.$self, helper, externalGrammar.repository);
1394
+ }
1395
+ } else {
1396
+ }
1397
+ break;
1398
+ }
1399
+ } else {
1400
+ ruleId = _RuleFactory.getCompiledRuleId(pattern, helper, repository);
1401
+ }
1402
+ if (ruleId !== -1) {
1403
+ const rule = helper.getRule(ruleId);
1404
+ let skipRule = false;
1405
+ if (rule instanceof IncludeOnlyRule || rule instanceof BeginEndRule || rule instanceof BeginWhileRule) {
1406
+ if (rule.hasMissingPatterns && rule.patterns.length === 0) {
1407
+ skipRule = true;
1408
+ }
1409
+ }
1410
+ if (skipRule) {
1411
+ continue;
1412
+ }
1413
+ r.push(ruleId);
1414
+ }
1415
+ }
1416
+ }
1417
+ return {
1418
+ patterns: r,
1419
+ hasMissingPatterns: (patterns ? patterns.length : 0) !== r.length
1420
+ };
1421
+ }
1422
+ };
1423
+ var RegExpSource = class _RegExpSource {
1424
+ source;
1425
+ ruleId;
1426
+ hasAnchor;
1427
+ hasBackReferences;
1428
+ _anchorCache;
1429
+ constructor(regExpSource, ruleId) {
1430
+ if (regExpSource && typeof regExpSource === "string") {
1431
+ const len = regExpSource.length;
1432
+ let lastPushedPos = 0;
1433
+ let output = [];
1434
+ let hasAnchor = false;
1435
+ for (let pos = 0; pos < len; pos++) {
1436
+ const ch = regExpSource.charAt(pos);
1437
+ if (ch === "\\") {
1438
+ if (pos + 1 < len) {
1439
+ const nextCh = regExpSource.charAt(pos + 1);
1440
+ if (nextCh === "z") {
1441
+ output.push(regExpSource.substring(lastPushedPos, pos));
1442
+ output.push("$(?!\\n)(?<!\\n)");
1443
+ lastPushedPos = pos + 2;
1444
+ } else if (nextCh === "A" || nextCh === "G") {
1445
+ hasAnchor = true;
1446
+ }
1447
+ pos++;
1448
+ }
1449
+ }
1450
+ }
1451
+ this.hasAnchor = hasAnchor;
1452
+ if (lastPushedPos === 0) {
1453
+ this.source = regExpSource;
1454
+ } else {
1455
+ output.push(regExpSource.substring(lastPushedPos, len));
1456
+ this.source = output.join("");
1457
+ }
1458
+ } else {
1459
+ this.hasAnchor = false;
1460
+ this.source = regExpSource;
1461
+ }
1462
+ if (this.hasAnchor) {
1463
+ this._anchorCache = this._buildAnchorCache();
1464
+ } else {
1465
+ this._anchorCache = null;
1466
+ }
1467
+ this.ruleId = ruleId;
1468
+ if (typeof this.source === "string") {
1469
+ this.hasBackReferences = HAS_BACK_REFERENCES.test(this.source);
1470
+ } else {
1471
+ this.hasBackReferences = false;
1472
+ }
1473
+ }
1474
+ clone() {
1475
+ return new _RegExpSource(this.source, this.ruleId);
1476
+ }
1477
+ setSource(newSource) {
1478
+ if (this.source === newSource) {
1479
+ return;
1480
+ }
1481
+ this.source = newSource;
1482
+ if (this.hasAnchor) {
1483
+ this._anchorCache = this._buildAnchorCache();
1484
+ }
1485
+ }
1486
+ resolveBackReferences(lineText, captureIndices) {
1487
+ if (typeof this.source !== "string") {
1488
+ throw new Error("This method should only be called if the source is a string");
1489
+ }
1490
+ let capturedValues = captureIndices.map((capture) => {
1491
+ return lineText.substring(capture.start, capture.end);
1492
+ });
1493
+ BACK_REFERENCING_END.lastIndex = 0;
1494
+ return this.source.replace(BACK_REFERENCING_END, (match, g1) => {
1495
+ return escapeRegExpCharacters(capturedValues[parseInt(g1, 10)] || "");
1496
+ });
1497
+ }
1498
+ _buildAnchorCache() {
1499
+ if (typeof this.source !== "string") {
1500
+ throw new Error("This method should only be called if the source is a string");
1501
+ }
1502
+ let A0_G0_result = [];
1503
+ let A0_G1_result = [];
1504
+ let A1_G0_result = [];
1505
+ let A1_G1_result = [];
1506
+ let pos, len, ch, nextCh;
1507
+ for (pos = 0, len = this.source.length; pos < len; pos++) {
1508
+ ch = this.source.charAt(pos);
1509
+ A0_G0_result[pos] = ch;
1510
+ A0_G1_result[pos] = ch;
1511
+ A1_G0_result[pos] = ch;
1512
+ A1_G1_result[pos] = ch;
1513
+ if (ch === "\\") {
1514
+ if (pos + 1 < len) {
1515
+ nextCh = this.source.charAt(pos + 1);
1516
+ if (nextCh === "A") {
1517
+ A0_G0_result[pos + 1] = "\uFFFF";
1518
+ A0_G1_result[pos + 1] = "\uFFFF";
1519
+ A1_G0_result[pos + 1] = "A";
1520
+ A1_G1_result[pos + 1] = "A";
1521
+ } else if (nextCh === "G") {
1522
+ A0_G0_result[pos + 1] = "\uFFFF";
1523
+ A0_G1_result[pos + 1] = "G";
1524
+ A1_G0_result[pos + 1] = "\uFFFF";
1525
+ A1_G1_result[pos + 1] = "G";
1526
+ } else {
1527
+ A0_G0_result[pos + 1] = nextCh;
1528
+ A0_G1_result[pos + 1] = nextCh;
1529
+ A1_G0_result[pos + 1] = nextCh;
1530
+ A1_G1_result[pos + 1] = nextCh;
1531
+ }
1532
+ pos++;
1533
+ }
1534
+ }
1535
+ }
1536
+ return {
1537
+ A0_G0: A0_G0_result.join(""),
1538
+ A0_G1: A0_G1_result.join(""),
1539
+ A1_G0: A1_G0_result.join(""),
1540
+ A1_G1: A1_G1_result.join("")
1541
+ };
1542
+ }
1543
+ resolveAnchors(allowA, allowG) {
1544
+ if (!this.hasAnchor || !this._anchorCache || typeof this.source !== "string") {
1545
+ return this.source;
1546
+ }
1547
+ if (allowA) {
1548
+ if (allowG) {
1549
+ return this._anchorCache.A1_G1;
1550
+ } else {
1551
+ return this._anchorCache.A1_G0;
1552
+ }
1553
+ } else {
1554
+ if (allowG) {
1555
+ return this._anchorCache.A0_G1;
1556
+ } else {
1557
+ return this._anchorCache.A0_G0;
1558
+ }
1559
+ }
1560
+ }
1561
+ };
1562
+ var RegExpSourceList = class {
1563
+ _items;
1564
+ _hasAnchors;
1565
+ _cached;
1566
+ _anchorCache;
1567
+ constructor() {
1568
+ this._items = [];
1569
+ this._hasAnchors = false;
1570
+ this._cached = null;
1571
+ this._anchorCache = {
1572
+ A0_G0: null,
1573
+ A0_G1: null,
1574
+ A1_G0: null,
1575
+ A1_G1: null
1576
+ };
1577
+ }
1578
+ dispose() {
1579
+ this._disposeCaches();
1580
+ }
1581
+ _disposeCaches() {
1582
+ if (this._cached) {
1583
+ this._cached.dispose();
1584
+ this._cached = null;
1585
+ }
1586
+ if (this._anchorCache.A0_G0) {
1587
+ this._anchorCache.A0_G0.dispose();
1588
+ this._anchorCache.A0_G0 = null;
1589
+ }
1590
+ if (this._anchorCache.A0_G1) {
1591
+ this._anchorCache.A0_G1.dispose();
1592
+ this._anchorCache.A0_G1 = null;
1593
+ }
1594
+ if (this._anchorCache.A1_G0) {
1595
+ this._anchorCache.A1_G0.dispose();
1596
+ this._anchorCache.A1_G0 = null;
1597
+ }
1598
+ if (this._anchorCache.A1_G1) {
1599
+ this._anchorCache.A1_G1.dispose();
1600
+ this._anchorCache.A1_G1 = null;
1601
+ }
1602
+ }
1603
+ push(item) {
1604
+ this._items.push(item);
1605
+ this._hasAnchors = this._hasAnchors || item.hasAnchor;
1606
+ }
1607
+ unshift(item) {
1608
+ this._items.unshift(item);
1609
+ this._hasAnchors = this._hasAnchors || item.hasAnchor;
1610
+ }
1611
+ length() {
1612
+ return this._items.length;
1613
+ }
1614
+ setSource(index, newSource) {
1615
+ if (this._items[index].source !== newSource) {
1616
+ this._disposeCaches();
1617
+ this._items[index].setSource(newSource);
1618
+ }
1619
+ }
1620
+ compile(onigLib) {
1621
+ if (!this._cached) {
1622
+ let regExps = this._items.map((e) => e.source);
1623
+ this._cached = new CompiledRule(onigLib, regExps, this._items.map((e) => e.ruleId));
1624
+ }
1625
+ return this._cached;
1626
+ }
1627
+ compileAG(onigLib, allowA, allowG) {
1628
+ if (!this._hasAnchors) {
1629
+ return this.compile(onigLib);
1630
+ } else {
1631
+ if (allowA) {
1632
+ if (allowG) {
1633
+ if (!this._anchorCache.A1_G1) {
1634
+ this._anchorCache.A1_G1 = this._resolveAnchors(onigLib, allowA, allowG);
1635
+ }
1636
+ return this._anchorCache.A1_G1;
1637
+ } else {
1638
+ if (!this._anchorCache.A1_G0) {
1639
+ this._anchorCache.A1_G0 = this._resolveAnchors(onigLib, allowA, allowG);
1640
+ }
1641
+ return this._anchorCache.A1_G0;
1642
+ }
1643
+ } else {
1644
+ if (allowG) {
1645
+ if (!this._anchorCache.A0_G1) {
1646
+ this._anchorCache.A0_G1 = this._resolveAnchors(onigLib, allowA, allowG);
1647
+ }
1648
+ return this._anchorCache.A0_G1;
1649
+ } else {
1650
+ if (!this._anchorCache.A0_G0) {
1651
+ this._anchorCache.A0_G0 = this._resolveAnchors(onigLib, allowA, allowG);
1652
+ }
1653
+ return this._anchorCache.A0_G0;
1654
+ }
1655
+ }
1656
+ }
1657
+ }
1658
+ _resolveAnchors(onigLib, allowA, allowG) {
1659
+ let regExps = this._items.map((e) => e.resolveAnchors(allowA, allowG));
1660
+ return new CompiledRule(onigLib, regExps, this._items.map((e) => e.ruleId));
1661
+ }
1662
+ };
1663
+ var CompiledRule = class {
1664
+ constructor(onigLib, regExps, rules) {
1665
+ this.regExps = regExps;
1666
+ this.rules = rules;
1667
+ this.scanner = onigLib.createOnigScanner(regExps);
1668
+ }
1669
+ scanner;
1670
+ dispose() {
1671
+ if (typeof this.scanner.dispose === "function") {
1672
+ this.scanner.dispose();
1673
+ }
1674
+ }
1675
+ toString() {
1676
+ const r = [];
1677
+ for (let i = 0, len = this.rules.length; i < len; i++) {
1678
+ r.push(" - " + this.rules[i] + ": " + this.regExps[i]);
1679
+ }
1680
+ return r.join("\n");
1681
+ }
1682
+ findNextMatchSync(string, startPosition, options) {
1683
+ const result = this.scanner.findNextMatchSync(string, startPosition, options);
1684
+ if (!result) {
1685
+ return null;
1686
+ }
1687
+ return {
1688
+ ruleId: this.rules[result.index],
1689
+ captureIndices: result.captureIndices
1690
+ };
1691
+ }
1692
+ };
1693
+
1694
+ // src/grammar/basicScopesAttributeProvider.ts
1695
+ var BasicScopeAttributes = class {
1696
+ constructor(languageId, tokenType) {
1697
+ this.languageId = languageId;
1698
+ this.tokenType = tokenType;
1699
+ }
1700
+ };
1701
+ var BasicScopeAttributesProvider = class _BasicScopeAttributesProvider {
1702
+ _defaultAttributes;
1703
+ _embeddedLanguagesMatcher;
1704
+ constructor(initialLanguageId, embeddedLanguages) {
1705
+ this._defaultAttributes = new BasicScopeAttributes(initialLanguageId, 8 /* NotSet */);
1706
+ this._embeddedLanguagesMatcher = new ScopeMatcher(Object.entries(embeddedLanguages || {}));
1707
+ }
1708
+ getDefaultAttributes() {
1709
+ return this._defaultAttributes;
1710
+ }
1711
+ getBasicScopeAttributes(scopeName) {
1712
+ if (scopeName === null) {
1713
+ return _BasicScopeAttributesProvider._NULL_SCOPE_METADATA;
1714
+ }
1715
+ return this._getBasicScopeAttributes.get(scopeName);
1716
+ }
1717
+ static _NULL_SCOPE_METADATA = new BasicScopeAttributes(0, 0);
1718
+ _getBasicScopeAttributes = new CachedFn((scopeName) => {
1719
+ const languageId = this._scopeToLanguage(scopeName);
1720
+ const standardTokenType = this._toStandardTokenType(scopeName);
1721
+ return new BasicScopeAttributes(languageId, standardTokenType);
1722
+ });
1723
+ /**
1724
+ * Given a produced TM scope, return the language that token describes or null if unknown.
1725
+ * e.g. source.html => html, source.css.embedded.html => css, punctuation.definition.tag.html => null
1726
+ */
1727
+ _scopeToLanguage(scope) {
1728
+ return this._embeddedLanguagesMatcher.match(scope) || 0;
1729
+ }
1730
+ _toStandardTokenType(scopeName) {
1731
+ const m = scopeName.match(_BasicScopeAttributesProvider.STANDARD_TOKEN_TYPE_REGEXP);
1732
+ if (!m) {
1733
+ return 8 /* NotSet */;
1734
+ }
1735
+ switch (m[1]) {
1736
+ case "comment":
1737
+ return 1 /* Comment */;
1738
+ case "string":
1739
+ return 2 /* String */;
1740
+ case "regex":
1741
+ return 3 /* RegEx */;
1742
+ case "meta.embedded":
1743
+ return 0 /* Other */;
1744
+ }
1745
+ throw new Error("Unexpected match for standard token type!");
1746
+ }
1747
+ static STANDARD_TOKEN_TYPE_REGEXP = /\b(comment|string|regex|meta\.embedded)\b/;
1748
+ };
1749
+ var ScopeMatcher = class {
1750
+ values;
1751
+ scopesRegExp;
1752
+ constructor(values) {
1753
+ if (values.length === 0) {
1754
+ this.values = null;
1755
+ this.scopesRegExp = null;
1756
+ } else {
1757
+ this.values = new Map(values);
1758
+ const escapedScopes = values.map(
1759
+ ([scopeName, value]) => escapeRegExpCharacters(scopeName)
1760
+ );
1761
+ escapedScopes.sort();
1762
+ escapedScopes.reverse();
1763
+ this.scopesRegExp = new RegExp(
1764
+ `^((${escapedScopes.join(")|(")}))($|\\.)`,
1765
+ ""
1766
+ );
1767
+ }
1768
+ }
1769
+ match(scope) {
1770
+ if (!this.scopesRegExp) {
1771
+ return void 0;
1772
+ }
1773
+ const m = scope.match(this.scopesRegExp);
1774
+ if (!m) {
1775
+ return void 0;
1776
+ }
1777
+ return this.values.get(m[1]);
1778
+ }
1779
+ };
1780
+
1781
+ // src/debug.ts
1782
+ var DebugFlags = {
1783
+ InDebugMode: typeof process !== "undefined" && !!process.env["VSCODE_TEXTMATE_DEBUG"]
1784
+ };
1785
+ var UseOnigurumaFindOptions = false;
1786
+
1787
+ // src/grammar/tokenizeString.ts
1788
+ var TokenizeStringResult = class {
1789
+ constructor(stack, stoppedEarly) {
1790
+ this.stack = stack;
1791
+ this.stoppedEarly = stoppedEarly;
1792
+ }
1793
+ };
1794
+ function _tokenizeString(grammar, lineText, isFirstLine, linePos, stack, lineTokens, checkWhileConditions, timeLimit) {
1795
+ const lineLength = lineText.content.length;
1796
+ let STOP = false;
1797
+ let anchorPosition = -1;
1798
+ if (checkWhileConditions) {
1799
+ const whileCheckResult = _checkWhileConditions(
1800
+ grammar,
1801
+ lineText,
1802
+ isFirstLine,
1803
+ linePos,
1804
+ stack,
1805
+ lineTokens
1806
+ );
1807
+ stack = whileCheckResult.stack;
1808
+ linePos = whileCheckResult.linePos;
1809
+ isFirstLine = whileCheckResult.isFirstLine;
1810
+ anchorPosition = whileCheckResult.anchorPosition;
1811
+ }
1812
+ const startTime = Date.now();
1813
+ while (!STOP) {
1814
+ if (timeLimit !== 0) {
1815
+ const elapsedTime = Date.now() - startTime;
1816
+ if (elapsedTime > timeLimit) {
1817
+ return new TokenizeStringResult(stack, true);
1818
+ }
1819
+ }
1820
+ scanNext();
1821
+ }
1822
+ return new TokenizeStringResult(stack, false);
1823
+ function scanNext() {
1824
+ if (false) {
1825
+ console.log("");
1826
+ console.log(
1827
+ `@@scanNext ${linePos}: |${lineText.content.substr(linePos).replace(/\n$/, "\\n")}|`
1828
+ );
1829
+ }
1830
+ const r = matchRuleOrInjections(
1831
+ grammar,
1832
+ lineText,
1833
+ isFirstLine,
1834
+ linePos,
1835
+ stack,
1836
+ anchorPosition
1837
+ );
1838
+ if (!r) {
1839
+ lineTokens.produce(stack, lineLength);
1840
+ STOP = true;
1841
+ return;
1842
+ }
1843
+ const captureIndices = r.captureIndices;
1844
+ const matchedRuleId = r.matchedRuleId;
1845
+ const hasAdvanced = captureIndices && captureIndices.length > 0 ? captureIndices[0].end > linePos : false;
1846
+ if (matchedRuleId === endRuleId) {
1847
+ const poppedRule = stack.getRule(grammar);
1848
+ if (false) {
1849
+ console.log(
1850
+ " popping " + poppedRule.debugName + " - " + poppedRule.debugEndRegExp
1851
+ );
1852
+ }
1853
+ lineTokens.produce(stack, captureIndices[0].start);
1854
+ stack = stack.withContentNameScopesList(stack.nameScopesList);
1855
+ handleCaptures(
1856
+ grammar,
1857
+ lineText,
1858
+ isFirstLine,
1859
+ stack,
1860
+ lineTokens,
1861
+ poppedRule.endCaptures,
1862
+ captureIndices
1863
+ );
1864
+ lineTokens.produce(stack, captureIndices[0].end);
1865
+ const popped = stack;
1866
+ stack = stack.parent;
1867
+ anchorPosition = popped.getAnchorPos();
1868
+ if (!hasAdvanced && popped.getEnterPos() === linePos) {
1869
+ if (false) {
1870
+ console.error(
1871
+ "[1] - Grammar is in an endless loop - Grammar pushed & popped a rule without advancing"
1872
+ );
1873
+ }
1874
+ stack = popped;
1875
+ lineTokens.produce(stack, lineLength);
1876
+ STOP = true;
1877
+ return;
1878
+ }
1879
+ } else {
1880
+ const _rule = grammar.getRule(matchedRuleId);
1881
+ lineTokens.produce(stack, captureIndices[0].start);
1882
+ const beforePush = stack;
1883
+ const scopeName = _rule.getName(lineText.content, captureIndices);
1884
+ const nameScopesList = stack.contentNameScopesList.pushAttributed(
1885
+ scopeName,
1886
+ grammar
1887
+ );
1888
+ stack = stack.push(
1889
+ matchedRuleId,
1890
+ linePos,
1891
+ anchorPosition,
1892
+ captureIndices[0].end === lineLength,
1893
+ null,
1894
+ nameScopesList,
1895
+ nameScopesList
1896
+ );
1897
+ if (_rule instanceof BeginEndRule) {
1898
+ const pushedRule = _rule;
1899
+ if (false) {
1900
+ console.log(
1901
+ " pushing " + pushedRule.debugName + " - " + pushedRule.debugBeginRegExp
1902
+ );
1903
+ }
1904
+ handleCaptures(
1905
+ grammar,
1906
+ lineText,
1907
+ isFirstLine,
1908
+ stack,
1909
+ lineTokens,
1910
+ pushedRule.beginCaptures,
1911
+ captureIndices
1912
+ );
1913
+ lineTokens.produce(stack, captureIndices[0].end);
1914
+ anchorPosition = captureIndices[0].end;
1915
+ const contentName = pushedRule.getContentName(
1916
+ lineText.content,
1917
+ captureIndices
1918
+ );
1919
+ const contentNameScopesList = nameScopesList.pushAttributed(
1920
+ contentName,
1921
+ grammar
1922
+ );
1923
+ stack = stack.withContentNameScopesList(contentNameScopesList);
1924
+ if (pushedRule.endHasBackReferences) {
1925
+ stack = stack.withEndRule(
1926
+ pushedRule.getEndWithResolvedBackReferences(
1927
+ lineText.content,
1928
+ captureIndices
1929
+ )
1930
+ );
1931
+ }
1932
+ if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {
1933
+ if (false) {
1934
+ console.error(
1935
+ "[2] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"
1936
+ );
1937
+ }
1938
+ stack = stack.pop();
1939
+ lineTokens.produce(stack, lineLength);
1940
+ STOP = true;
1941
+ return;
1942
+ }
1943
+ } else if (_rule instanceof BeginWhileRule) {
1944
+ const pushedRule = _rule;
1945
+ if (false) {
1946
+ console.log(" pushing " + pushedRule.debugName);
1947
+ }
1948
+ handleCaptures(
1949
+ grammar,
1950
+ lineText,
1951
+ isFirstLine,
1952
+ stack,
1953
+ lineTokens,
1954
+ pushedRule.beginCaptures,
1955
+ captureIndices
1956
+ );
1957
+ lineTokens.produce(stack, captureIndices[0].end);
1958
+ anchorPosition = captureIndices[0].end;
1959
+ const contentName = pushedRule.getContentName(
1960
+ lineText.content,
1961
+ captureIndices
1962
+ );
1963
+ const contentNameScopesList = nameScopesList.pushAttributed(
1964
+ contentName,
1965
+ grammar
1966
+ );
1967
+ stack = stack.withContentNameScopesList(contentNameScopesList);
1968
+ if (pushedRule.whileHasBackReferences) {
1969
+ stack = stack.withEndRule(
1970
+ pushedRule.getWhileWithResolvedBackReferences(
1971
+ lineText.content,
1972
+ captureIndices
1973
+ )
1974
+ );
1975
+ }
1976
+ if (!hasAdvanced && beforePush.hasSameRuleAs(stack)) {
1977
+ if (false) {
1978
+ console.error(
1979
+ "[3] - Grammar is in an endless loop - Grammar pushed the same rule without advancing"
1980
+ );
1981
+ }
1982
+ stack = stack.pop();
1983
+ lineTokens.produce(stack, lineLength);
1984
+ STOP = true;
1985
+ return;
1986
+ }
1987
+ } else {
1988
+ const matchingRule = _rule;
1989
+ if (false) {
1990
+ console.log(
1991
+ " matched " + matchingRule.debugName + " - " + matchingRule.debugMatchRegExp
1992
+ );
1993
+ }
1994
+ handleCaptures(
1995
+ grammar,
1996
+ lineText,
1997
+ isFirstLine,
1998
+ stack,
1999
+ lineTokens,
2000
+ matchingRule.captures,
2001
+ captureIndices
2002
+ );
2003
+ lineTokens.produce(stack, captureIndices[0].end);
2004
+ stack = stack.pop();
2005
+ if (!hasAdvanced) {
2006
+ if (false) {
2007
+ console.error(
2008
+ "[4] - Grammar is in an endless loop - Grammar is not advancing, nor is it pushing/popping"
2009
+ );
2010
+ }
2011
+ stack = stack.safePop();
2012
+ lineTokens.produce(stack, lineLength);
2013
+ STOP = true;
2014
+ return;
2015
+ }
2016
+ }
2017
+ }
2018
+ if (captureIndices[0].end > linePos) {
2019
+ linePos = captureIndices[0].end;
2020
+ isFirstLine = false;
2021
+ }
2022
+ }
2023
+ }
2024
+ function _checkWhileConditions(grammar, lineText, isFirstLine, linePos, stack, lineTokens) {
2025
+ let anchorPosition = stack.beginRuleCapturedEOL ? 0 : -1;
2026
+ const whileRules = [];
2027
+ for (let node = stack; node; node = node.pop()) {
2028
+ const nodeRule = node.getRule(grammar);
2029
+ if (nodeRule instanceof BeginWhileRule) {
2030
+ whileRules.push({
2031
+ rule: nodeRule,
2032
+ stack: node
2033
+ });
2034
+ }
2035
+ }
2036
+ for (let whileRule = whileRules.pop(); whileRule; whileRule = whileRules.pop()) {
2037
+ const { ruleScanner, findOptions } = prepareRuleWhileSearch(whileRule.rule, grammar, whileRule.stack.endRule, isFirstLine, linePos === anchorPosition);
2038
+ const r = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
2039
+ if (false) {
2040
+ console.log(" scanning for while rule");
2041
+ console.log(ruleScanner.toString());
2042
+ }
2043
+ if (r) {
2044
+ const matchedRuleId = r.ruleId;
2045
+ if (matchedRuleId !== whileRuleId) {
2046
+ stack = whileRule.stack.pop();
2047
+ break;
2048
+ }
2049
+ if (r.captureIndices && r.captureIndices.length) {
2050
+ lineTokens.produce(whileRule.stack, r.captureIndices[0].start);
2051
+ handleCaptures(grammar, lineText, isFirstLine, whileRule.stack, lineTokens, whileRule.rule.whileCaptures, r.captureIndices);
2052
+ lineTokens.produce(whileRule.stack, r.captureIndices[0].end);
2053
+ anchorPosition = r.captureIndices[0].end;
2054
+ if (r.captureIndices[0].end > linePos) {
2055
+ linePos = r.captureIndices[0].end;
2056
+ isFirstLine = false;
2057
+ }
2058
+ }
2059
+ } else {
2060
+ if (false) {
2061
+ console.log(" popping " + whileRule.rule.debugName + " - " + whileRule.rule.debugWhileRegExp);
2062
+ }
2063
+ stack = whileRule.stack.pop();
2064
+ break;
2065
+ }
2066
+ }
2067
+ return { stack, linePos, anchorPosition, isFirstLine };
2068
+ }
2069
+ function matchRuleOrInjections(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
2070
+ const matchResult = matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
2071
+ const injections = grammar.getInjections();
2072
+ if (injections.length === 0) {
2073
+ return matchResult;
2074
+ }
2075
+ const injectionResult = matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition);
2076
+ if (!injectionResult) {
2077
+ return matchResult;
2078
+ }
2079
+ if (!matchResult) {
2080
+ return injectionResult;
2081
+ }
2082
+ const matchResultScore = matchResult.captureIndices[0].start;
2083
+ const injectionResultScore = injectionResult.captureIndices[0].start;
2084
+ if (injectionResultScore < matchResultScore || injectionResult.priorityMatch && injectionResultScore === matchResultScore) {
2085
+ return injectionResult;
2086
+ }
2087
+ return matchResult;
2088
+ }
2089
+ function matchRule(grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
2090
+ const rule = stack.getRule(grammar);
2091
+ const { ruleScanner, findOptions } = prepareRuleSearch(rule, grammar, stack.endRule, isFirstLine, linePos === anchorPosition);
2092
+ const r = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
2093
+ if (r) {
2094
+ return {
2095
+ captureIndices: r.captureIndices,
2096
+ matchedRuleId: r.ruleId
2097
+ };
2098
+ }
2099
+ return null;
2100
+ }
2101
+ function matchInjections(injections, grammar, lineText, isFirstLine, linePos, stack, anchorPosition) {
2102
+ let bestMatchRating = Number.MAX_VALUE;
2103
+ let bestMatchCaptureIndices = null;
2104
+ let bestMatchRuleId;
2105
+ let bestMatchResultPriority = 0;
2106
+ const scopes = stack.contentNameScopesList.getScopeNames();
2107
+ for (let i = 0, len = injections.length; i < len; i++) {
2108
+ const injection = injections[i];
2109
+ if (!injection.matcher(scopes)) {
2110
+ continue;
2111
+ }
2112
+ const rule = grammar.getRule(injection.ruleId);
2113
+ const { ruleScanner, findOptions } = prepareRuleSearch(rule, grammar, null, isFirstLine, linePos === anchorPosition);
2114
+ const matchResult = ruleScanner.findNextMatchSync(lineText, linePos, findOptions);
2115
+ if (!matchResult) {
2116
+ continue;
2117
+ }
2118
+ if (false) {
2119
+ console.log(` matched injection: ${injection.debugSelector}`);
2120
+ console.log(ruleScanner.toString());
2121
+ }
2122
+ const matchRating = matchResult.captureIndices[0].start;
2123
+ if (matchRating >= bestMatchRating) {
2124
+ continue;
2125
+ }
2126
+ bestMatchRating = matchRating;
2127
+ bestMatchCaptureIndices = matchResult.captureIndices;
2128
+ bestMatchRuleId = matchResult.ruleId;
2129
+ bestMatchResultPriority = injection.priority;
2130
+ if (bestMatchRating === linePos) {
2131
+ break;
2132
+ }
2133
+ }
2134
+ if (bestMatchCaptureIndices) {
2135
+ return {
2136
+ priorityMatch: bestMatchResultPriority === -1,
2137
+ captureIndices: bestMatchCaptureIndices,
2138
+ matchedRuleId: bestMatchRuleId
2139
+ };
2140
+ }
2141
+ return null;
2142
+ }
2143
+ function prepareRuleSearch(rule, grammar, endRegexSource, allowA, allowG) {
2144
+ if (UseOnigurumaFindOptions) {
2145
+ const ruleScanner2 = rule.compile(grammar, endRegexSource);
2146
+ const findOptions = getFindOptions(allowA, allowG);
2147
+ return { ruleScanner: ruleScanner2, findOptions };
2148
+ }
2149
+ const ruleScanner = rule.compileAG(grammar, endRegexSource, allowA, allowG);
2150
+ return { ruleScanner, findOptions: 0 /* None */ };
2151
+ }
2152
+ function prepareRuleWhileSearch(rule, grammar, endRegexSource, allowA, allowG) {
2153
+ if (UseOnigurumaFindOptions) {
2154
+ const ruleScanner2 = rule.compileWhile(grammar, endRegexSource);
2155
+ const findOptions = getFindOptions(allowA, allowG);
2156
+ return { ruleScanner: ruleScanner2, findOptions };
2157
+ }
2158
+ const ruleScanner = rule.compileWhileAG(grammar, endRegexSource, allowA, allowG);
2159
+ return { ruleScanner, findOptions: 0 /* None */ };
2160
+ }
2161
+ function getFindOptions(allowA, allowG) {
2162
+ let options = 0 /* None */;
2163
+ if (!allowA) {
2164
+ options |= 1 /* NotBeginString */;
2165
+ }
2166
+ if (!allowG) {
2167
+ options |= 4 /* NotBeginPosition */;
2168
+ }
2169
+ return options;
2170
+ }
2171
+ function handleCaptures(grammar, lineText, isFirstLine, stack, lineTokens, captures, captureIndices) {
2172
+ if (captures.length === 0) {
2173
+ return;
2174
+ }
2175
+ const lineTextContent = lineText.content;
2176
+ const len = Math.min(captures.length, captureIndices.length);
2177
+ const localStack = [];
2178
+ const maxEnd = captureIndices[0].end;
2179
+ for (let i = 0; i < len; i++) {
2180
+ const captureRule = captures[i];
2181
+ if (captureRule === null) {
2182
+ continue;
2183
+ }
2184
+ const captureIndex = captureIndices[i];
2185
+ if (captureIndex.length === 0) {
2186
+ continue;
2187
+ }
2188
+ if (captureIndex.start > maxEnd) {
2189
+ break;
2190
+ }
2191
+ while (localStack.length > 0 && localStack[localStack.length - 1].endPos <= captureIndex.start) {
2192
+ lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);
2193
+ localStack.pop();
2194
+ }
2195
+ if (localStack.length > 0) {
2196
+ lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, captureIndex.start);
2197
+ } else {
2198
+ lineTokens.produce(stack, captureIndex.start);
2199
+ }
2200
+ if (captureRule.retokenizeCapturedWithRuleId) {
2201
+ const scopeName = captureRule.getName(lineTextContent, captureIndices);
2202
+ const nameScopesList = stack.contentNameScopesList.pushAttributed(scopeName, grammar);
2203
+ const contentName = captureRule.getContentName(lineTextContent, captureIndices);
2204
+ const contentNameScopesList = nameScopesList.pushAttributed(contentName, grammar);
2205
+ const stackClone = stack.push(captureRule.retokenizeCapturedWithRuleId, captureIndex.start, -1, false, null, nameScopesList, contentNameScopesList);
2206
+ const onigSubStr = grammar.createOnigString(lineTextContent.substring(0, captureIndex.end));
2207
+ _tokenizeString(
2208
+ grammar,
2209
+ onigSubStr,
2210
+ isFirstLine && captureIndex.start === 0,
2211
+ captureIndex.start,
2212
+ stackClone,
2213
+ lineTokens,
2214
+ false,
2215
+ /* no time limit */
2216
+ 0
2217
+ );
2218
+ disposeOnigString(onigSubStr);
2219
+ continue;
2220
+ }
2221
+ const captureRuleScopeName = captureRule.getName(lineTextContent, captureIndices);
2222
+ if (captureRuleScopeName !== null) {
2223
+ const base = localStack.length > 0 ? localStack[localStack.length - 1].scopes : stack.contentNameScopesList;
2224
+ const captureRuleScopesList = base.pushAttributed(captureRuleScopeName, grammar);
2225
+ localStack.push(new LocalStackElement(captureRuleScopesList, captureIndex.end));
2226
+ }
2227
+ }
2228
+ while (localStack.length > 0) {
2229
+ lineTokens.produceFromScopes(localStack[localStack.length - 1].scopes, localStack[localStack.length - 1].endPos);
2230
+ localStack.pop();
2231
+ }
2232
+ }
2233
+ var LocalStackElement = class {
2234
+ scopes;
2235
+ endPos;
2236
+ constructor(scopes, endPos) {
2237
+ this.scopes = scopes;
2238
+ this.endPos = endPos;
2239
+ }
2240
+ };
2241
+
2242
+ // src/grammar/grammar.ts
2243
+ function createGrammar(scopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, onigLib) {
2244
+ return new Grammar(
2245
+ scopeName,
2246
+ grammar,
2247
+ initialLanguage,
2248
+ embeddedLanguages,
2249
+ tokenTypes,
2250
+ balancedBracketSelectors,
2251
+ grammarRepository,
2252
+ onigLib
2253
+ );
2254
+ }
2255
+ function collectInjections(result, selector, rule, ruleFactoryHelper, grammar) {
2256
+ const matchers = createMatchers(selector, nameMatcher);
2257
+ const ruleId = RuleFactory.getCompiledRuleId(rule, ruleFactoryHelper, grammar.repository);
2258
+ for (const matcher of matchers) {
2259
+ result.push({
2260
+ debugSelector: selector,
2261
+ matcher: matcher.matcher,
2262
+ ruleId,
2263
+ grammar,
2264
+ priority: matcher.priority
2265
+ });
2266
+ }
2267
+ }
2268
+ function nameMatcher(identifers, scopes) {
2269
+ if (scopes.length < identifers.length) {
2270
+ return false;
2271
+ }
2272
+ let lastIndex = 0;
2273
+ return identifers.every((identifier) => {
2274
+ for (let i = lastIndex; i < scopes.length; i++) {
2275
+ if (scopesAreMatching(scopes[i], identifier)) {
2276
+ lastIndex = i + 1;
2277
+ return true;
2278
+ }
2279
+ }
2280
+ return false;
2281
+ });
2282
+ }
2283
+ function scopesAreMatching(thisScopeName, scopeName) {
2284
+ if (!thisScopeName) {
2285
+ return false;
2286
+ }
2287
+ if (thisScopeName === scopeName) {
2288
+ return true;
2289
+ }
2290
+ const len = scopeName.length;
2291
+ return thisScopeName.length > len && thisScopeName.substr(0, len) === scopeName && thisScopeName[len] === ".";
2292
+ }
2293
+ var Grammar = class {
2294
+ constructor(_rootScopeName, grammar, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors, grammarRepository, _onigLib) {
2295
+ this._rootScopeName = _rootScopeName;
2296
+ this.balancedBracketSelectors = balancedBracketSelectors;
2297
+ this._onigLib = _onigLib;
2298
+ this._basicScopeAttributesProvider = new BasicScopeAttributesProvider(
2299
+ initialLanguage,
2300
+ embeddedLanguages
2301
+ );
2302
+ this._rootId = -1;
2303
+ this._lastRuleId = 0;
2304
+ this._ruleId2desc = [null];
2305
+ this._includedGrammars = {};
2306
+ this._grammarRepository = grammarRepository;
2307
+ this._grammar = initGrammar(grammar, null);
2308
+ this._injections = null;
2309
+ this._tokenTypeMatchers = [];
2310
+ if (tokenTypes) {
2311
+ for (const selector of Object.keys(tokenTypes)) {
2312
+ const matchers = createMatchers(selector, nameMatcher);
2313
+ for (const matcher of matchers) {
2314
+ this._tokenTypeMatchers.push({
2315
+ matcher: matcher.matcher,
2316
+ type: tokenTypes[selector]
2317
+ });
2318
+ }
2319
+ }
2320
+ }
2321
+ }
2322
+ _rootId;
2323
+ _lastRuleId;
2324
+ _ruleId2desc;
2325
+ _includedGrammars;
2326
+ _grammarRepository;
2327
+ _grammar;
2328
+ _injections;
2329
+ _basicScopeAttributesProvider;
2330
+ _tokenTypeMatchers;
2331
+ get themeProvider() {
2332
+ return this._grammarRepository;
2333
+ }
2334
+ dispose() {
2335
+ for (const rule of this._ruleId2desc) {
2336
+ if (rule) {
2337
+ rule.dispose();
2338
+ }
2339
+ }
2340
+ }
2341
+ createOnigScanner(sources) {
2342
+ return this._onigLib.createOnigScanner(sources);
2343
+ }
2344
+ createOnigString(sources) {
2345
+ return this._onigLib.createOnigString(sources);
2346
+ }
2347
+ getMetadataForScope(scope) {
2348
+ return this._basicScopeAttributesProvider.getBasicScopeAttributes(scope);
2349
+ }
2350
+ _collectInjections() {
2351
+ const grammarRepository = {
2352
+ lookup: (scopeName2) => {
2353
+ if (scopeName2 === this._rootScopeName) {
2354
+ return this._grammar;
2355
+ }
2356
+ return this.getExternalGrammar(scopeName2);
2357
+ },
2358
+ injections: (scopeName2) => {
2359
+ return this._grammarRepository.injections(scopeName2);
2360
+ }
2361
+ };
2362
+ const result = [];
2363
+ const scopeName = this._rootScopeName;
2364
+ const grammar = grammarRepository.lookup(scopeName);
2365
+ if (grammar) {
2366
+ const rawInjections = grammar.injections;
2367
+ if (rawInjections) {
2368
+ for (let expression in rawInjections) {
2369
+ collectInjections(
2370
+ result,
2371
+ expression,
2372
+ rawInjections[expression],
2373
+ this,
2374
+ grammar
2375
+ );
2376
+ }
2377
+ }
2378
+ const injectionScopeNames = this._grammarRepository.injections(scopeName);
2379
+ if (injectionScopeNames) {
2380
+ injectionScopeNames.forEach((injectionScopeName) => {
2381
+ const injectionGrammar = this.getExternalGrammar(injectionScopeName);
2382
+ if (injectionGrammar) {
2383
+ const selector = injectionGrammar.injectionSelector;
2384
+ if (selector) {
2385
+ collectInjections(
2386
+ result,
2387
+ selector,
2388
+ injectionGrammar,
2389
+ this,
2390
+ injectionGrammar
2391
+ );
2392
+ }
2393
+ }
2394
+ });
2395
+ }
2396
+ }
2397
+ result.sort((i1, i2) => i1.priority - i2.priority);
2398
+ return result;
2399
+ }
2400
+ getInjections() {
2401
+ if (this._injections === null) {
2402
+ this._injections = this._collectInjections();
2403
+ }
2404
+ return this._injections;
2405
+ }
2406
+ registerRule(factory) {
2407
+ const id = ++this._lastRuleId;
2408
+ const result = factory(ruleIdFromNumber(id));
2409
+ this._ruleId2desc[id] = result;
2410
+ return result;
2411
+ }
2412
+ getRule(ruleId) {
2413
+ return this._ruleId2desc[ruleIdToNumber(ruleId)];
2414
+ }
2415
+ getExternalGrammar(scopeName, repository) {
2416
+ if (this._includedGrammars[scopeName]) {
2417
+ return this._includedGrammars[scopeName];
2418
+ } else if (this._grammarRepository) {
2419
+ const rawIncludedGrammar = this._grammarRepository.lookup(scopeName);
2420
+ if (rawIncludedGrammar) {
2421
+ this._includedGrammars[scopeName] = initGrammar(
2422
+ rawIncludedGrammar,
2423
+ repository && repository.$base
2424
+ );
2425
+ return this._includedGrammars[scopeName];
2426
+ }
2427
+ }
2428
+ return void 0;
2429
+ }
2430
+ tokenizeLine(lineText, prevState, timeLimit = 0) {
2431
+ const r = this._tokenize(lineText, prevState, false, timeLimit);
2432
+ return {
2433
+ tokens: r.lineTokens.getResult(r.ruleStack, r.lineLength),
2434
+ ruleStack: r.ruleStack,
2435
+ stoppedEarly: r.stoppedEarly
2436
+ };
2437
+ }
2438
+ tokenizeLine2(lineText, prevState, timeLimit = 0) {
2439
+ const r = this._tokenize(lineText, prevState, true, timeLimit);
2440
+ return {
2441
+ tokens: r.lineTokens.getBinaryResult(r.ruleStack, r.lineLength),
2442
+ ruleStack: r.ruleStack,
2443
+ stoppedEarly: r.stoppedEarly
2444
+ };
2445
+ }
2446
+ _tokenize(lineText, prevState, emitBinaryTokens, timeLimit) {
2447
+ if (this._rootId === -1) {
2448
+ this._rootId = RuleFactory.getCompiledRuleId(
2449
+ this._grammar.repository.$self,
2450
+ this,
2451
+ this._grammar.repository
2452
+ );
2453
+ this.getInjections();
2454
+ }
2455
+ let isFirstLine;
2456
+ if (!prevState || prevState === StateStackImpl.NULL) {
2457
+ isFirstLine = true;
2458
+ const rawDefaultMetadata = this._basicScopeAttributesProvider.getDefaultAttributes();
2459
+ const defaultStyle = this.themeProvider.getDefaults();
2460
+ const defaultMetadata = EncodedTokenMetadata.set(
2461
+ 0,
2462
+ rawDefaultMetadata.languageId,
2463
+ rawDefaultMetadata.tokenType,
2464
+ null,
2465
+ defaultStyle.fontStyle,
2466
+ defaultStyle.foregroundId,
2467
+ defaultStyle.backgroundId
2468
+ );
2469
+ const rootScopeName = this.getRule(this._rootId).getName(
2470
+ null,
2471
+ null
2472
+ );
2473
+ let scopeList;
2474
+ if (rootScopeName) {
2475
+ scopeList = AttributedScopeStack.createRootAndLookUpScopeName(
2476
+ rootScopeName,
2477
+ defaultMetadata,
2478
+ this
2479
+ );
2480
+ } else {
2481
+ scopeList = AttributedScopeStack.createRoot(
2482
+ "unknown",
2483
+ defaultMetadata
2484
+ );
2485
+ }
2486
+ prevState = new StateStackImpl(
2487
+ null,
2488
+ this._rootId,
2489
+ -1,
2490
+ -1,
2491
+ false,
2492
+ null,
2493
+ scopeList,
2494
+ scopeList
2495
+ );
2496
+ } else {
2497
+ isFirstLine = false;
2498
+ prevState.reset();
2499
+ }
2500
+ lineText = lineText + "\n";
2501
+ const onigLineText = this.createOnigString(lineText);
2502
+ const lineLength = onigLineText.content.length;
2503
+ const lineTokens = new LineTokens(
2504
+ emitBinaryTokens,
2505
+ lineText,
2506
+ this._tokenTypeMatchers,
2507
+ this.balancedBracketSelectors
2508
+ );
2509
+ const r = _tokenizeString(
2510
+ this,
2511
+ onigLineText,
2512
+ isFirstLine,
2513
+ 0,
2514
+ prevState,
2515
+ lineTokens,
2516
+ true,
2517
+ timeLimit
2518
+ );
2519
+ disposeOnigString(onigLineText);
2520
+ return {
2521
+ lineLength,
2522
+ lineTokens,
2523
+ ruleStack: r.stack,
2524
+ stoppedEarly: r.stoppedEarly
2525
+ };
2526
+ }
2527
+ };
2528
+ function initGrammar(grammar, base) {
2529
+ grammar = clone(grammar);
2530
+ grammar.repository = grammar.repository || {};
2531
+ grammar.repository.$self = {
2532
+ $vscodeTextmateLocation: grammar.$vscodeTextmateLocation,
2533
+ patterns: grammar.patterns,
2534
+ name: grammar.scopeName
2535
+ };
2536
+ grammar.repository.$base = base || grammar.repository.$self;
2537
+ return grammar;
2538
+ }
2539
+ var AttributedScopeStack = class _AttributedScopeStack {
2540
+ /**
2541
+ * Invariant:
2542
+ * ```
2543
+ * if (parent && !scopePath.extends(parent.scopePath)) {
2544
+ * throw new Error();
2545
+ * }
2546
+ * ```
2547
+ */
2548
+ constructor(parent, scopePath, tokenAttributes) {
2549
+ this.parent = parent;
2550
+ this.scopePath = scopePath;
2551
+ this.tokenAttributes = tokenAttributes;
2552
+ }
2553
+ static fromExtension(namesScopeList, contentNameScopesList) {
2554
+ let current = namesScopeList;
2555
+ let scopeNames = namesScopeList?.scopePath ?? null;
2556
+ for (const frame of contentNameScopesList) {
2557
+ scopeNames = ScopeStack.push(scopeNames, frame.scopeNames);
2558
+ current = new _AttributedScopeStack(current, scopeNames, frame.encodedTokenAttributes);
2559
+ }
2560
+ return current;
2561
+ }
2562
+ static createRoot(scopeName, tokenAttributes) {
2563
+ return new _AttributedScopeStack(null, new ScopeStack(null, scopeName), tokenAttributes);
2564
+ }
2565
+ static createRootAndLookUpScopeName(scopeName, tokenAttributes, grammar) {
2566
+ const rawRootMetadata = grammar.getMetadataForScope(scopeName);
2567
+ const scopePath = new ScopeStack(null, scopeName);
2568
+ const rootStyle = grammar.themeProvider.themeMatch(scopePath);
2569
+ const resolvedTokenAttributes = _AttributedScopeStack.mergeAttributes(
2570
+ tokenAttributes,
2571
+ rawRootMetadata,
2572
+ rootStyle
2573
+ );
2574
+ return new _AttributedScopeStack(null, scopePath, resolvedTokenAttributes);
2575
+ }
2576
+ get scopeName() {
2577
+ return this.scopePath.scopeName;
2578
+ }
2579
+ toString() {
2580
+ return this.getScopeNames().join(" ");
2581
+ }
2582
+ equals(other) {
2583
+ return _AttributedScopeStack.equals(this, other);
2584
+ }
2585
+ static equals(a, b) {
2586
+ do {
2587
+ if (a === b) {
2588
+ return true;
2589
+ }
2590
+ if (!a && !b) {
2591
+ return true;
2592
+ }
2593
+ if (!a || !b) {
2594
+ return false;
2595
+ }
2596
+ if (a.scopeName !== b.scopeName || a.tokenAttributes !== b.tokenAttributes) {
2597
+ return false;
2598
+ }
2599
+ a = a.parent;
2600
+ b = b.parent;
2601
+ } while (true);
2602
+ }
2603
+ static mergeAttributes(existingTokenAttributes, basicScopeAttributes, styleAttributes) {
2604
+ let fontStyle = -1 /* NotSet */;
2605
+ let foreground = 0;
2606
+ let background = 0;
2607
+ if (styleAttributes !== null) {
2608
+ fontStyle = styleAttributes.fontStyle;
2609
+ foreground = styleAttributes.foregroundId;
2610
+ background = styleAttributes.backgroundId;
2611
+ }
2612
+ return EncodedTokenMetadata.set(
2613
+ existingTokenAttributes,
2614
+ basicScopeAttributes.languageId,
2615
+ basicScopeAttributes.tokenType,
2616
+ null,
2617
+ fontStyle,
2618
+ foreground,
2619
+ background
2620
+ );
2621
+ }
2622
+ pushAttributed(scopePath, grammar) {
2623
+ if (scopePath === null) {
2624
+ return this;
2625
+ }
2626
+ if (scopePath.indexOf(" ") === -1) {
2627
+ return _AttributedScopeStack._pushAttributed(this, scopePath, grammar);
2628
+ }
2629
+ const scopes = scopePath.split(/ /g);
2630
+ let result = this;
2631
+ for (const scope of scopes) {
2632
+ result = _AttributedScopeStack._pushAttributed(result, scope, grammar);
2633
+ }
2634
+ return result;
2635
+ }
2636
+ static _pushAttributed(target, scopeName, grammar) {
2637
+ const rawMetadata = grammar.getMetadataForScope(scopeName);
2638
+ const newPath = target.scopePath.push(scopeName);
2639
+ const scopeThemeMatchResult = grammar.themeProvider.themeMatch(newPath);
2640
+ const metadata = _AttributedScopeStack.mergeAttributes(
2641
+ target.tokenAttributes,
2642
+ rawMetadata,
2643
+ scopeThemeMatchResult
2644
+ );
2645
+ return new _AttributedScopeStack(target, newPath, metadata);
2646
+ }
2647
+ getScopeNames() {
2648
+ return this.scopePath.getSegments();
2649
+ }
2650
+ getExtensionIfDefined(base) {
2651
+ const result = [];
2652
+ let self = this;
2653
+ while (self && self !== base) {
2654
+ result.push({
2655
+ encodedTokenAttributes: self.tokenAttributes,
2656
+ scopeNames: self.scopePath.getExtensionIfDefined(self.parent?.scopePath ?? null)
2657
+ });
2658
+ self = self.parent;
2659
+ }
2660
+ return self === base ? result.reverse() : void 0;
2661
+ }
2662
+ };
2663
+ var StateStackImpl = class _StateStackImpl {
2664
+ /**
2665
+ * Invariant:
2666
+ * ```
2667
+ * if (contentNameScopesList !== nameScopesList && contentNameScopesList?.parent !== nameScopesList) {
2668
+ * throw new Error();
2669
+ * }
2670
+ * if (this.parent && !nameScopesList.extends(this.parent.contentNameScopesList)) {
2671
+ * throw new Error();
2672
+ * }
2673
+ * ```
2674
+ */
2675
+ constructor(parent, ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
2676
+ this.parent = parent;
2677
+ this.ruleId = ruleId;
2678
+ this.beginRuleCapturedEOL = beginRuleCapturedEOL;
2679
+ this.endRule = endRule;
2680
+ this.nameScopesList = nameScopesList;
2681
+ this.contentNameScopesList = contentNameScopesList;
2682
+ this.depth = this.parent ? this.parent.depth + 1 : 1;
2683
+ this._enterPos = enterPos;
2684
+ this._anchorPos = anchorPos;
2685
+ }
2686
+ _stackElementBrand = void 0;
2687
+ // TODO remove me
2688
+ static NULL = new _StateStackImpl(
2689
+ null,
2690
+ 0,
2691
+ 0,
2692
+ 0,
2693
+ false,
2694
+ null,
2695
+ null,
2696
+ null
2697
+ );
2698
+ /**
2699
+ * The position on the current line where this state was pushed.
2700
+ * This is relevant only while tokenizing a line, to detect endless loops.
2701
+ * Its value is meaningless across lines.
2702
+ */
2703
+ _enterPos;
2704
+ /**
2705
+ * The captured anchor position when this stack element was pushed.
2706
+ * This is relevant only while tokenizing a line, to restore the anchor position when popping.
2707
+ * Its value is meaningless across lines.
2708
+ */
2709
+ _anchorPos;
2710
+ /**
2711
+ * The depth of the stack.
2712
+ */
2713
+ depth;
2714
+ equals(other) {
2715
+ if (other === null) {
2716
+ return false;
2717
+ }
2718
+ return _StateStackImpl._equals(this, other);
2719
+ }
2720
+ static _equals(a, b) {
2721
+ if (a === b) {
2722
+ return true;
2723
+ }
2724
+ if (!this._structuralEquals(a, b)) {
2725
+ return false;
2726
+ }
2727
+ return AttributedScopeStack.equals(a.contentNameScopesList, b.contentNameScopesList);
2728
+ }
2729
+ /**
2730
+ * A structural equals check. Does not take into account `scopes`.
2731
+ */
2732
+ static _structuralEquals(a, b) {
2733
+ do {
2734
+ if (a === b) {
2735
+ return true;
2736
+ }
2737
+ if (!a && !b) {
2738
+ return true;
2739
+ }
2740
+ if (!a || !b) {
2741
+ return false;
2742
+ }
2743
+ if (a.depth !== b.depth || a.ruleId !== b.ruleId || a.endRule !== b.endRule) {
2744
+ return false;
2745
+ }
2746
+ a = a.parent;
2747
+ b = b.parent;
2748
+ } while (true);
2749
+ }
2750
+ clone() {
2751
+ return this;
2752
+ }
2753
+ static _reset(el) {
2754
+ while (el) {
2755
+ el._enterPos = -1;
2756
+ el._anchorPos = -1;
2757
+ el = el.parent;
2758
+ }
2759
+ }
2760
+ reset() {
2761
+ _StateStackImpl._reset(this);
2762
+ }
2763
+ pop() {
2764
+ return this.parent;
2765
+ }
2766
+ safePop() {
2767
+ if (this.parent) {
2768
+ return this.parent;
2769
+ }
2770
+ return this;
2771
+ }
2772
+ push(ruleId, enterPos, anchorPos, beginRuleCapturedEOL, endRule, nameScopesList, contentNameScopesList) {
2773
+ return new _StateStackImpl(
2774
+ this,
2775
+ ruleId,
2776
+ enterPos,
2777
+ anchorPos,
2778
+ beginRuleCapturedEOL,
2779
+ endRule,
2780
+ nameScopesList,
2781
+ contentNameScopesList
2782
+ );
2783
+ }
2784
+ getEnterPos() {
2785
+ return this._enterPos;
2786
+ }
2787
+ getAnchorPos() {
2788
+ return this._anchorPos;
2789
+ }
2790
+ getRule(grammar) {
2791
+ return grammar.getRule(this.ruleId);
2792
+ }
2793
+ toString() {
2794
+ const r = [];
2795
+ this._writeString(r, 0);
2796
+ return "[" + r.join(",") + "]";
2797
+ }
2798
+ _writeString(res, outIndex) {
2799
+ if (this.parent) {
2800
+ outIndex = this.parent._writeString(res, outIndex);
2801
+ }
2802
+ res[outIndex++] = `(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`;
2803
+ return outIndex;
2804
+ }
2805
+ withContentNameScopesList(contentNameScopeStack) {
2806
+ if (this.contentNameScopesList === contentNameScopeStack) {
2807
+ return this;
2808
+ }
2809
+ return this.parent.push(
2810
+ this.ruleId,
2811
+ this._enterPos,
2812
+ this._anchorPos,
2813
+ this.beginRuleCapturedEOL,
2814
+ this.endRule,
2815
+ this.nameScopesList,
2816
+ contentNameScopeStack
2817
+ );
2818
+ }
2819
+ withEndRule(endRule) {
2820
+ if (this.endRule === endRule) {
2821
+ return this;
2822
+ }
2823
+ return new _StateStackImpl(
2824
+ this.parent,
2825
+ this.ruleId,
2826
+ this._enterPos,
2827
+ this._anchorPos,
2828
+ this.beginRuleCapturedEOL,
2829
+ endRule,
2830
+ this.nameScopesList,
2831
+ this.contentNameScopesList
2832
+ );
2833
+ }
2834
+ // Used to warn of endless loops
2835
+ hasSameRuleAs(other) {
2836
+ let el = this;
2837
+ while (el && el._enterPos === other._enterPos) {
2838
+ if (el.ruleId === other.ruleId) {
2839
+ return true;
2840
+ }
2841
+ el = el.parent;
2842
+ }
2843
+ return false;
2844
+ }
2845
+ toStateStackFrame() {
2846
+ return {
2847
+ ruleId: ruleIdToNumber(this.ruleId),
2848
+ beginRuleCapturedEOL: this.beginRuleCapturedEOL,
2849
+ endRule: this.endRule,
2850
+ nameScopesList: this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList ?? null) ?? [],
2851
+ contentNameScopesList: this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList) ?? []
2852
+ };
2853
+ }
2854
+ static pushFrame(self, frame) {
2855
+ const namesScopeList = AttributedScopeStack.fromExtension(self?.nameScopesList ?? null, frame.nameScopesList);
2856
+ return new _StateStackImpl(
2857
+ self,
2858
+ ruleIdFromNumber(frame.ruleId),
2859
+ frame.enterPos ?? -1,
2860
+ frame.anchorPos ?? -1,
2861
+ frame.beginRuleCapturedEOL,
2862
+ frame.endRule,
2863
+ namesScopeList,
2864
+ AttributedScopeStack.fromExtension(namesScopeList, frame.contentNameScopesList)
2865
+ );
2866
+ }
2867
+ };
2868
+ var BalancedBracketSelectors = class {
2869
+ balancedBracketScopes;
2870
+ unbalancedBracketScopes;
2871
+ allowAny = false;
2872
+ constructor(balancedBracketScopes, unbalancedBracketScopes) {
2873
+ this.balancedBracketScopes = balancedBracketScopes.flatMap(
2874
+ (selector) => {
2875
+ if (selector === "*") {
2876
+ this.allowAny = true;
2877
+ return [];
2878
+ }
2879
+ return createMatchers(selector, nameMatcher).map((m) => m.matcher);
2880
+ }
2881
+ );
2882
+ this.unbalancedBracketScopes = unbalancedBracketScopes.flatMap(
2883
+ (selector) => createMatchers(selector, nameMatcher).map((m) => m.matcher)
2884
+ );
2885
+ }
2886
+ get matchesAlways() {
2887
+ return this.allowAny && this.unbalancedBracketScopes.length === 0;
2888
+ }
2889
+ get matchesNever() {
2890
+ return this.balancedBracketScopes.length === 0 && !this.allowAny;
2891
+ }
2892
+ match(scopes) {
2893
+ for (const excluder of this.unbalancedBracketScopes) {
2894
+ if (excluder(scopes)) {
2895
+ return false;
2896
+ }
2897
+ }
2898
+ for (const includer of this.balancedBracketScopes) {
2899
+ if (includer(scopes)) {
2900
+ return true;
2901
+ }
2902
+ }
2903
+ return this.allowAny;
2904
+ }
2905
+ };
2906
+ var LineTokens = class {
2907
+ constructor(emitBinaryTokens, lineText, tokenTypeOverrides, balancedBracketSelectors) {
2908
+ this.balancedBracketSelectors = balancedBracketSelectors;
2909
+ this._emitBinaryTokens = emitBinaryTokens;
2910
+ this._tokenTypeOverrides = tokenTypeOverrides;
2911
+ if (false) {
2912
+ this._lineText = lineText;
2913
+ } else {
2914
+ this._lineText = null;
2915
+ }
2916
+ this._tokens = [];
2917
+ this._binaryTokens = [];
2918
+ this._lastTokenEndIndex = 0;
2919
+ }
2920
+ _emitBinaryTokens;
2921
+ /**
2922
+ * defined only if `false`.
2923
+ */
2924
+ _lineText;
2925
+ /**
2926
+ * used only if `_emitBinaryTokens` is false.
2927
+ */
2928
+ _tokens;
2929
+ /**
2930
+ * used only if `_emitBinaryTokens` is true.
2931
+ */
2932
+ _binaryTokens;
2933
+ _lastTokenEndIndex;
2934
+ _tokenTypeOverrides;
2935
+ produce(stack, endIndex) {
2936
+ this.produceFromScopes(stack.contentNameScopesList, endIndex);
2937
+ }
2938
+ produceFromScopes(scopesList, endIndex) {
2939
+ if (this._lastTokenEndIndex >= endIndex) {
2940
+ return;
2941
+ }
2942
+ if (this._emitBinaryTokens) {
2943
+ let metadata = scopesList?.tokenAttributes ?? 0;
2944
+ let containsBalancedBrackets = false;
2945
+ if (this.balancedBracketSelectors?.matchesAlways) {
2946
+ containsBalancedBrackets = true;
2947
+ }
2948
+ if (this._tokenTypeOverrides.length > 0 || this.balancedBracketSelectors && !this.balancedBracketSelectors.matchesAlways && !this.balancedBracketSelectors.matchesNever) {
2949
+ const scopes2 = scopesList?.getScopeNames() ?? [];
2950
+ for (const tokenType of this._tokenTypeOverrides) {
2951
+ if (tokenType.matcher(scopes2)) {
2952
+ metadata = EncodedTokenMetadata.set(
2953
+ metadata,
2954
+ 0,
2955
+ toOptionalTokenType(tokenType.type),
2956
+ null,
2957
+ -1 /* NotSet */,
2958
+ 0,
2959
+ 0
2960
+ );
2961
+ }
2962
+ }
2963
+ if (this.balancedBracketSelectors) {
2964
+ containsBalancedBrackets = this.balancedBracketSelectors.match(scopes2);
2965
+ }
2966
+ }
2967
+ if (containsBalancedBrackets) {
2968
+ metadata = EncodedTokenMetadata.set(
2969
+ metadata,
2970
+ 0,
2971
+ 8 /* NotSet */,
2972
+ containsBalancedBrackets,
2973
+ -1 /* NotSet */,
2974
+ 0,
2975
+ 0
2976
+ );
2977
+ }
2978
+ if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 1] === metadata) {
2979
+ this._lastTokenEndIndex = endIndex;
2980
+ return;
2981
+ }
2982
+ this._binaryTokens.push(this._lastTokenEndIndex);
2983
+ this._binaryTokens.push(metadata);
2984
+ this._lastTokenEndIndex = endIndex;
2985
+ return;
2986
+ }
2987
+ const scopes = scopesList?.getScopeNames() ?? [];
2988
+ this._tokens.push({
2989
+ startIndex: this._lastTokenEndIndex,
2990
+ endIndex,
2991
+ // value: lineText.substring(lastTokenEndIndex, endIndex),
2992
+ scopes
2993
+ });
2994
+ this._lastTokenEndIndex = endIndex;
2995
+ }
2996
+ getResult(stack, lineLength) {
2997
+ if (this._tokens.length > 0 && this._tokens[this._tokens.length - 1].startIndex === lineLength - 1) {
2998
+ this._tokens.pop();
2999
+ }
3000
+ if (this._tokens.length === 0) {
3001
+ this._lastTokenEndIndex = -1;
3002
+ this.produce(stack, lineLength);
3003
+ this._tokens[this._tokens.length - 1].startIndex = 0;
3004
+ }
3005
+ return this._tokens;
3006
+ }
3007
+ getBinaryResult(stack, lineLength) {
3008
+ if (this._binaryTokens.length > 0 && this._binaryTokens[this._binaryTokens.length - 2] === lineLength - 1) {
3009
+ this._binaryTokens.pop();
3010
+ this._binaryTokens.pop();
3011
+ }
3012
+ if (this._binaryTokens.length === 0) {
3013
+ this._lastTokenEndIndex = -1;
3014
+ this.produce(stack, lineLength);
3015
+ this._binaryTokens[this._binaryTokens.length - 2] = 0;
3016
+ }
3017
+ const result = new Uint32Array(this._binaryTokens.length);
3018
+ for (let i = 0, len = this._binaryTokens.length; i < len; i++) {
3019
+ result[i] = this._binaryTokens[i];
3020
+ }
3021
+ return result;
3022
+ }
3023
+ };
3024
+
3025
+ // src/registry.ts
3026
+ var SyncRegistry = class {
3027
+ constructor(theme, _onigLib) {
3028
+ this._onigLib = _onigLib;
3029
+ this._theme = theme;
3030
+ }
3031
+ _grammars = /* @__PURE__ */ new Map();
3032
+ _rawGrammars = /* @__PURE__ */ new Map();
3033
+ _injectionGrammars = /* @__PURE__ */ new Map();
3034
+ _theme;
3035
+ dispose() {
3036
+ for (const grammar of this._grammars.values()) {
3037
+ grammar.dispose();
3038
+ }
3039
+ }
3040
+ setTheme(theme) {
3041
+ this._theme = theme;
3042
+ }
3043
+ getColorMap() {
3044
+ return this._theme.getColorMap();
3045
+ }
3046
+ /**
3047
+ * Add `grammar` to registry and return a list of referenced scope names
3048
+ */
3049
+ addGrammar(grammar, injectionScopeNames) {
3050
+ this._rawGrammars.set(grammar.scopeName, grammar);
3051
+ if (injectionScopeNames) {
3052
+ this._injectionGrammars.set(grammar.scopeName, injectionScopeNames);
3053
+ }
3054
+ }
3055
+ /**
3056
+ * Lookup a raw grammar.
3057
+ */
3058
+ lookup(scopeName) {
3059
+ return this._rawGrammars.get(scopeName);
3060
+ }
3061
+ /**
3062
+ * Returns the injections for the given grammar
3063
+ */
3064
+ injections(targetScope) {
3065
+ return this._injectionGrammars.get(targetScope);
3066
+ }
3067
+ /**
3068
+ * Get the default theme settings
3069
+ */
3070
+ getDefaults() {
3071
+ return this._theme.getDefaults();
3072
+ }
3073
+ /**
3074
+ * Match a scope in the theme.
3075
+ */
3076
+ themeMatch(scopePath) {
3077
+ return this._theme.match(scopePath);
3078
+ }
3079
+ /**
3080
+ * Lookup a grammar.
3081
+ */
3082
+ grammarForScopeName(scopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
3083
+ if (!this._grammars.has(scopeName)) {
3084
+ let rawGrammar = this._rawGrammars.get(scopeName);
3085
+ if (!rawGrammar) {
3086
+ return null;
3087
+ }
3088
+ this._grammars.set(scopeName, createGrammar(
3089
+ scopeName,
3090
+ rawGrammar,
3091
+ initialLanguage,
3092
+ embeddedLanguages,
3093
+ tokenTypes,
3094
+ balancedBracketSelectors,
3095
+ this,
3096
+ this._onigLib
3097
+ ));
3098
+ }
3099
+ return this._grammars.get(scopeName);
3100
+ }
3101
+ };
3102
+
3103
+ // src/index.ts
3104
+ var Registry = class {
3105
+ _options;
3106
+ _syncRegistry;
3107
+ _ensureGrammarCache;
3108
+ constructor(options) {
3109
+ this._options = options;
3110
+ this._syncRegistry = new SyncRegistry(
3111
+ Theme.createFromRawTheme(options.theme, options.colorMap),
3112
+ options.onigLib
3113
+ );
3114
+ this._ensureGrammarCache = /* @__PURE__ */ new Map();
3115
+ }
3116
+ dispose() {
3117
+ this._syncRegistry.dispose();
3118
+ }
3119
+ /**
3120
+ * Change the theme. Once called, no previous `ruleStack` should be used anymore.
3121
+ */
3122
+ setTheme(theme, colorMap) {
3123
+ this._syncRegistry.setTheme(Theme.createFromRawTheme(theme, colorMap));
3124
+ }
3125
+ /**
3126
+ * Returns a lookup array for color ids.
3127
+ */
3128
+ getColorMap() {
3129
+ return this._syncRegistry.getColorMap();
3130
+ }
3131
+ /**
3132
+ * Load the grammar for `scopeName` and all referenced included grammars asynchronously.
3133
+ * Please do not use language id 0.
3134
+ */
3135
+ loadGrammarWithEmbeddedLanguages(initialScopeName, initialLanguage, embeddedLanguages) {
3136
+ return this.loadGrammarWithConfiguration(initialScopeName, initialLanguage, { embeddedLanguages });
3137
+ }
3138
+ /**
3139
+ * Load the grammar for `scopeName` and all referenced included grammars asynchronously.
3140
+ * Please do not use language id 0.
3141
+ */
3142
+ loadGrammarWithConfiguration(initialScopeName, initialLanguage, configuration) {
3143
+ return this._loadGrammar(
3144
+ initialScopeName,
3145
+ initialLanguage,
3146
+ configuration.embeddedLanguages,
3147
+ configuration.tokenTypes,
3148
+ new BalancedBracketSelectors(
3149
+ configuration.balancedBracketSelectors || [],
3150
+ configuration.unbalancedBracketSelectors || []
3151
+ )
3152
+ );
3153
+ }
3154
+ /**
3155
+ * Load the grammar for `scopeName` and all referenced included grammars asynchronously.
3156
+ */
3157
+ loadGrammar(initialScopeName) {
3158
+ return this._loadGrammar(initialScopeName, 0, null, null, null);
3159
+ }
3160
+ _loadGrammar(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes, balancedBracketSelectors) {
3161
+ const dependencyProcessor = new ScopeDependencyProcessor(this._syncRegistry, initialScopeName);
3162
+ while (dependencyProcessor.Q.length > 0) {
3163
+ dependencyProcessor.Q.map((request) => this._loadSingleGrammar(request.scopeName));
3164
+ dependencyProcessor.processQueue();
3165
+ }
3166
+ return this._grammarForScopeName(
3167
+ initialScopeName,
3168
+ initialLanguage,
3169
+ embeddedLanguages,
3170
+ tokenTypes,
3171
+ balancedBracketSelectors
3172
+ );
3173
+ }
3174
+ _loadSingleGrammar(scopeName) {
3175
+ if (!this._ensureGrammarCache.has(scopeName)) {
3176
+ this._doLoadSingleGrammar(scopeName);
3177
+ this._ensureGrammarCache.set(scopeName, true);
3178
+ }
3179
+ }
3180
+ _doLoadSingleGrammar(scopeName) {
3181
+ const grammar = this._options.loadGrammar(scopeName);
3182
+ if (grammar) {
3183
+ const injections = typeof this._options.getInjections === "function" ? this._options.getInjections(scopeName) : void 0;
3184
+ this._syncRegistry.addGrammar(grammar, injections);
3185
+ }
3186
+ }
3187
+ /**
3188
+ * Adds a rawGrammar.
3189
+ */
3190
+ addGrammar(rawGrammar, injections = [], initialLanguage = 0, embeddedLanguages = null) {
3191
+ this._syncRegistry.addGrammar(rawGrammar, injections);
3192
+ return this._grammarForScopeName(rawGrammar.scopeName, initialLanguage, embeddedLanguages);
3193
+ }
3194
+ /**
3195
+ * Get the grammar for `scopeName`. The grammar must first be created via `loadGrammar` or `addGrammar`.
3196
+ */
3197
+ _grammarForScopeName(scopeName, initialLanguage = 0, embeddedLanguages = null, tokenTypes = null, balancedBracketSelectors = null) {
3198
+ return this._syncRegistry.grammarForScopeName(
3199
+ scopeName,
3200
+ initialLanguage,
3201
+ embeddedLanguages,
3202
+ tokenTypes,
3203
+ balancedBracketSelectors
3204
+ );
3205
+ }
3206
+ };
3207
+ var INITIAL = StateStackImpl.NULL;
3208
+ export {
3209
+ EncodedTokenMetadata,
3210
+ FindOption,
3211
+ FontStyle,
3212
+ INITIAL,
3213
+ Registry,
3214
+ Theme,
3215
+ disposeOnigString
3216
+ };