likec4 1.55.0 → 1.56.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 (263) hide show
  1. package/__app__/chunks/ColorSchemeToggle.mjs +1 -0
  2. package/__app__/chunks/DiagramActorProvider.mjs +10 -0
  3. package/__app__/chunks/Fallback.mjs +1 -0
  4. package/__app__/chunks/Header.mjs +13 -0
  5. package/__app__/chunks/IconRenderer.mjs +1 -0
  6. package/__app__/chunks/LikeC4Diagram.mjs +19 -0
  7. package/__app__/chunks/LikeC4ModelContext.mjs +1 -0
  8. package/__app__/chunks/LikeC4ModelContext2.mjs +1 -0
  9. package/__app__/chunks/LikeC4Styles.mjs +48 -0
  10. package/__app__/chunks/NavigationPanel.mjs +1 -0
  11. package/__app__/chunks/StaticLikeC4Diagram.mjs +1 -0
  12. package/__app__/chunks/ViewReact.mjs +1 -0
  13. package/__app__/chunks/__root.mjs +1 -0
  14. package/__app__/chunks/adhoc-editor.mjs +1 -0
  15. package/__app__/chunks/hooks.mjs +1 -0
  16. package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
  17. package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
  18. package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
  19. package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
  20. package/__app__/chunks/libs/@mantine/core.mjs +41 -0
  21. package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
  22. package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
  23. package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
  24. package/__app__/chunks/libs/@tabler/icons-react.mjs +15 -0
  25. package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
  26. package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
  27. package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
  28. package/__app__/chunks/libs/@xstate/react.mjs +1 -0
  29. package/__app__/chunks/libs/@xstate/store.mjs +1 -0
  30. package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
  31. package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
  32. package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
  33. package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
  34. package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
  35. package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
  36. package/__app__/chunks/libs/bezier-js.mjs +1 -0
  37. package/__app__/chunks/libs/d3-path.mjs +1 -0
  38. package/__app__/chunks/libs/d3-shape.mjs +1 -0
  39. package/__app__/chunks/libs/fast-equals.mjs +1 -0
  40. package/__app__/chunks/libs/framer-motion.mjs +9 -0
  41. package/__app__/chunks/libs/html-to-image.mjs +2 -0
  42. package/__app__/chunks/libs/motion-dom.mjs +1 -0
  43. package/__app__/chunks/libs/motion.mjs +1 -0
  44. package/__app__/chunks/libs/nanostores.mjs +1 -0
  45. package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
  46. package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
  47. package/__app__/chunks/libs/remeda.mjs +1 -0
  48. package/__app__/chunks/libs/xstate.mjs +1 -0
  49. package/__app__/chunks/libs/zod.mjs +39 -0
  50. package/__app__/chunks/rolldown-runtime.mjs +1 -0
  51. package/__app__/chunks/safeCtx.mjs +1 -0
  52. package/__app__/chunks/searchParams.mjs +1 -0
  53. package/__app__/chunks/single-index.mjs +1 -0
  54. package/__app__/chunks/styled-system.mjs +1 -0
  55. package/__app__/chunks/styles.css.mjs +1 -0
  56. package/__app__/chunks/useLikeC4Project.mjs +1 -0
  57. package/__app__/chunks/useUpdateEffect.mjs +1 -0
  58. package/__app__/codegen/react.mjs +11 -0
  59. package/__app__/codegen/webcomponent.mjs +790 -0
  60. package/__app__/src/fonts.css +1 -1
  61. package/__app__/src/main.mjs +1 -0
  62. package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
  63. package/__app__/src/pages/EmbedPage.mjs +1 -0
  64. package/__app__/src/pages/ExportPage.mjs +1 -0
  65. package/__app__/src/pages/ProjectsOverview.mjs +1 -0
  66. package/__app__/src/pages/ViewAsD2.mjs +1 -0
  67. package/__app__/src/pages/ViewAsDot.mjs +1 -0
  68. package/__app__/src/pages/ViewAsMmd.mjs +1 -0
  69. package/__app__/src/pages/ViewAsPuml.mjs +1 -0
  70. package/__app__/src/pages/ViewEditor.mjs +1 -0
  71. package/__app__/src/pages/ViewReact.mjs +1 -0
  72. package/__app__/src/routeTree.gen.mjs +1 -0
  73. package/__app__/src/routes/__root.mjs +1 -0
  74. package/__app__/src/routes/_single/adhoc.mjs +1 -0
  75. package/__app__/src/routes/_single/embed._viewId.mjs +1 -0
  76. package/__app__/src/routes/_single/export._viewId.mjs +1 -0
  77. package/__app__/src/routes/_single/route.mjs +1 -0
  78. package/__app__/src/routes/_single/single-index.mjs +1 -0
  79. package/__app__/src/routes/_single/view._viewId.d2.mjs +1 -0
  80. package/__app__/src/routes/_single/view._viewId.dot.mjs +1 -0
  81. package/__app__/src/routes/_single/view._viewId.index.mjs +1 -0
  82. package/__app__/src/routes/_single/view._viewId.mjs +1 -0
  83. package/__app__/src/routes/_single/view._viewId.mmd.mjs +1 -0
  84. package/__app__/src/routes/_single/view._viewId.puml.mjs +1 -0
  85. package/__app__/src/routes/_single/webcomponent._.mjs +33 -0
  86. package/__app__/src/routes/index.mjs +1 -0
  87. package/__app__/src/routes/project._projectId/-components.mjs +1 -0
  88. package/__app__/src/routes/project._projectId/adhoc.mjs +1 -0
  89. package/__app__/src/routes/project._projectId/embed._viewId.mjs +1 -0
  90. package/__app__/src/routes/project._projectId/export._viewId.mjs +1 -0
  91. package/__app__/src/routes/project._projectId/index.mjs +1 -0
  92. package/__app__/src/routes/project._projectId/route.mjs +1 -0
  93. package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +1 -0
  94. package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +1 -0
  95. package/__app__/src/routes/project._projectId/view._viewId.index.mjs +1 -0
  96. package/__app__/src/routes/project._projectId/view._viewId.mjs +1 -0
  97. package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +1 -0
  98. package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +1 -0
  99. package/__app__/src/routes/projects.mjs +1 -0
  100. package/__app__/src/style.css +1 -1
  101. package/dist/chunks/filenames.mjs +17 -0
  102. package/dist/{_chunks → chunks}/index.d.mts +2 -1
  103. package/dist/{_chunks → chunks}/index2.d.mts +71 -12
  104. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
  105. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
  106. package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
  107. package/dist/chunks/libs/@hono/mcp.mjs +45 -0
  108. package/dist/chunks/libs/@hono/node-server.mjs +1 -0
  109. package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
  110. package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
  111. package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
  112. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
  113. package/dist/chunks/libs/ajv.mjs +1 -0
  114. package/dist/chunks/libs/ansi-align.mjs +2 -0
  115. package/dist/chunks/libs/ansi-regex.mjs +1 -0
  116. package/dist/chunks/libs/ansi-styles.mjs +1 -0
  117. package/dist/chunks/libs/atomically.mjs +1 -0
  118. package/dist/chunks/libs/birpc.mjs +1 -0
  119. package/dist/chunks/libs/boxen.mjs +22 -0
  120. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
  121. package/dist/chunks/libs/chevrotain.mjs +58 -0
  122. package/dist/chunks/libs/conf.mjs +1 -0
  123. package/dist/chunks/libs/defu.mjs +1 -0
  124. package/dist/chunks/libs/destr.mjs +1 -0
  125. package/dist/chunks/libs/eventemitter3.mjs +1 -0
  126. package/dist/chunks/libs/find-up-simple.mjs +1 -0
  127. package/dist/chunks/libs/get-port.mjs +1 -0
  128. package/dist/chunks/libs/hono.mjs +1 -0
  129. package/dist/chunks/libs/is-docker.mjs +1 -0
  130. package/dist/chunks/libs/is-error-instance.mjs +1 -0
  131. package/dist/chunks/libs/is-inside-container.mjs +1 -0
  132. package/dist/chunks/libs/is-plain-obj.mjs +1 -0
  133. package/dist/chunks/libs/isexe.mjs +1 -0
  134. package/dist/chunks/libs/json5.mjs +14 -0
  135. package/dist/chunks/libs/khroma.mjs +1 -0
  136. package/dist/chunks/libs/ky.mjs +3 -0
  137. package/dist/{_chunks → chunks}/libs/langium.d.mts +4 -4
  138. package/dist/chunks/libs/langium.mjs +32 -0
  139. package/dist/chunks/libs/merge-error-cause.mjs +2 -0
  140. package/dist/chunks/libs/p-debounce.mjs +1 -0
  141. package/dist/chunks/libs/p-limit.mjs +1 -0
  142. package/dist/chunks/libs/p-queue.mjs +1 -0
  143. package/dist/chunks/libs/p-timeout.mjs +1 -0
  144. package/dist/chunks/libs/package-manager-detector.mjs +1 -0
  145. package/dist/chunks/libs/package-up.mjs +1 -0
  146. package/dist/chunks/libs/pako.mjs +1 -0
  147. package/dist/chunks/libs/parse-ms.mjs +1 -0
  148. package/dist/chunks/libs/pathe.mjs +1 -0
  149. package/dist/chunks/libs/picomatch.mjs +1 -0
  150. package/dist/chunks/libs/pretty-ms.mjs +1 -0
  151. package/dist/chunks/libs/remeda.mjs +1 -0
  152. package/dist/chunks/libs/safe-stringify.mjs +1 -0
  153. package/dist/chunks/libs/strip-indent.mjs +1 -0
  154. package/dist/chunks/libs/tinyrainbow.mjs +1 -0
  155. package/dist/{_chunks → chunks}/libs/ts-graphviz.d.mts +2 -0
  156. package/dist/chunks/libs/ts-graphviz.mjs +4 -0
  157. package/dist/chunks/libs/ufo.mjs +1 -0
  158. package/dist/chunks/libs/unstorage.mjs +1 -0
  159. package/dist/chunks/libs/which.mjs +1 -0
  160. package/dist/chunks/libs/word-wrap.mjs +12 -0
  161. package/dist/{_chunks → chunks}/libs/zod.d.mts +2 -0
  162. package/dist/chunks/node.mjs +76 -0
  163. package/dist/chunks/plugin.mjs +400 -0
  164. package/dist/chunks/rolldown-runtime.mjs +1 -0
  165. package/dist/chunks/sequence-view.mjs +1 -0
  166. package/dist/cli/index.mjs +262 -123
  167. package/dist/config/index.d.mts +1 -2
  168. package/dist/config/index.mjs +1 -1
  169. package/dist/index.d.mts +4 -8
  170. package/dist/index.mjs +1 -1
  171. package/dist/model/index.d.mts +2 -1
  172. package/dist/model/index.mjs +1 -1
  173. package/dist/vite-plugin/index.d.mts +38 -8
  174. package/dist/vite-plugin/index.mjs +1 -1
  175. package/dist/{_chunks → vite-plugin/internal/chunks}/libs/@nanostores/react.d.mts +2 -56
  176. package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
  177. package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
  178. package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
  179. package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +59 -0
  180. package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
  181. package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
  182. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
  183. package/dist/vite-plugin/{internal.d.mts → internal/index.d.mts} +12 -3
  184. package/dist/vite-plugin/internal/index.mjs +1 -0
  185. package/package.json +37 -57
  186. package/react/index.d.mts +2 -28
  187. package/react/index.mjs +50520 -53827
  188. package/vite-plugin/internal/package.json +2 -2
  189. package/vite-plugin-modules.d.ts +14 -0
  190. package/__app__/react/likec4.tsx +0 -25
  191. package/__app__/src/ProjectsOverview.js +0 -16
  192. package/__app__/src/const.js +0 -19
  193. package/__app__/src/likec4.js +0 -21225
  194. package/__app__/src/main.js +0 -7
  195. package/__app__/src/routes/index.js +0 -324
  196. package/__app__/src/routes/projects.js +0 -189
  197. package/__app__/src/routes/single.js +0 -1924
  198. package/__app__/src/vendors.js +0 -52672
  199. package/__app__/src/webcomponent.js +0 -68
  200. package/dist/THIRD-PARTY-LICENSES.md +0 -1609
  201. package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
  202. package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
  203. package/dist/_chunks/libs/@chevrotain/types.d.mts +0 -1
  204. package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
  205. package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
  206. package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
  207. package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
  208. package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
  209. package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  210. package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
  211. package/dist/_chunks/libs/ajv.mjs +0 -1
  212. package/dist/_chunks/libs/ansi-align.mjs +0 -2
  213. package/dist/_chunks/libs/ansi-regex.mjs +0 -1
  214. package/dist/_chunks/libs/ansi-styles.mjs +0 -1
  215. package/dist/_chunks/libs/atomically.mjs +0 -1
  216. package/dist/_chunks/libs/birpc.mjs +0 -1
  217. package/dist/_chunks/libs/boxen.mjs +0 -22
  218. package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
  219. package/dist/_chunks/libs/chevrotain.mjs +0 -58
  220. package/dist/_chunks/libs/conf.mjs +0 -1
  221. package/dist/_chunks/libs/defu.mjs +0 -1
  222. package/dist/_chunks/libs/destr.mjs +0 -1
  223. package/dist/_chunks/libs/esm-env.mjs +0 -1
  224. package/dist/_chunks/libs/eventemitter3.mjs +0 -1
  225. package/dist/_chunks/libs/fast-equals.mjs +0 -1
  226. package/dist/_chunks/libs/find-up-simple.mjs +0 -1
  227. package/dist/_chunks/libs/get-port.mjs +0 -1
  228. package/dist/_chunks/libs/is-docker.mjs +0 -1
  229. package/dist/_chunks/libs/is-error-instance.mjs +0 -1
  230. package/dist/_chunks/libs/is-inside-container.mjs +0 -1
  231. package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
  232. package/dist/_chunks/libs/isexe.mjs +0 -1
  233. package/dist/_chunks/libs/json5.mjs +0 -14
  234. package/dist/_chunks/libs/khroma.mjs +0 -1
  235. package/dist/_chunks/libs/ky.mjs +0 -3
  236. package/dist/_chunks/libs/langium.mjs +0 -33
  237. package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
  238. package/dist/_chunks/libs/p-limit.mjs +0 -1
  239. package/dist/_chunks/libs/p-queue.mjs +0 -1
  240. package/dist/_chunks/libs/p-timeout.mjs +0 -1
  241. package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
  242. package/dist/_chunks/libs/package-up.mjs +0 -1
  243. package/dist/_chunks/libs/pako.mjs +0 -1
  244. package/dist/_chunks/libs/parse-ms.mjs +0 -1
  245. package/dist/_chunks/libs/pathe.mjs +0 -1
  246. package/dist/_chunks/libs/picomatch.mjs +0 -1
  247. package/dist/_chunks/libs/pretty-ms.mjs +0 -1
  248. package/dist/_chunks/libs/remeda.mjs +0 -2
  249. package/dist/_chunks/libs/safe-stringify.mjs +0 -1
  250. package/dist/_chunks/libs/strip-indent.mjs +0 -1
  251. package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
  252. package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
  253. package/dist/_chunks/libs/ufo.mjs +0 -1
  254. package/dist/_chunks/libs/unstorage.mjs +0 -1
  255. package/dist/_chunks/libs/which.mjs +0 -1
  256. package/dist/_chunks/libs/word-wrap.mjs +0 -12
  257. package/dist/_chunks/node.mjs +0 -76
  258. package/dist/_chunks/rolldown-runtime.mjs +0 -1
  259. package/dist/_chunks/sequence.mjs +0 -1
  260. package/dist/_chunks/src.mjs +0 -17
  261. package/dist/_chunks/src2.mjs +0 -499
  262. package/dist/vite-plugin/internal.mjs +0 -1
  263. /package/dist/{_chunks → chunks}/libs/vscode-languageserver.mjs +0 -0
@@ -1,33 +0,0 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../rolldown-runtime.mjs";import{n as s,t as c}from"./@chevrotain/regexp-to-ast.mjs";import{a as l,c as u,d,f,n as p,o as m,r as h,s as g,t as _}from"./chevrotain.mjs";import{t as v}from"./chevrotain-allstar.mjs";import*as y from"node:fs";function b(e){return typeof e==`object`&&!!e&&typeof e.$type==`string`}function x(e){return typeof e==`object`&&!!e&&typeof e.$refText==`string`}function S(e){return typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.type==`string`&&typeof e.path==`string`}function C(e){return typeof e==`object`&&!!e&&b(e.container)&&x(e.reference)&&typeof e.message==`string`}var w=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return b(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let n=this.subtypes[e];n||=this.subtypes[e]={};let r=n[t];if(r!==void 0)return r;{let r=this.computeIsSubtype(e,t);return n[t]=r,r}}getAllSubTypes(e){let t=this.allSubtypes[e];if(t)return t;{let t=this.getAllTypes(),n=[];for(let r of t)this.isSubtype(r,e)&&n.push(r);return this.allSubtypes[e]=n,n}}};function T(e){return typeof e==`object`&&!!e&&Array.isArray(e.content)}function E(e){return typeof e==`object`&&!!e&&typeof e.tokenType==`object`}function D(e){return T(e)&&typeof e.fullText==`string`}var O=class e{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){let e=this.iterator(),t=0,n=e.next();for(;!n.done;)t++,n=e.next();return t}toArray(){let e=[],t=this.iterator(),n;do n=t.next(),n.value!==void 0&&e.push(n.value);while(!n.done);return e}toSet(){return new Set(this)}toMap(e,t){let n=this.map(n=>[e?e(n):n,t?t(n):n]);return new Map(n)}toString(){return this.join()}concat(t){return new e(()=>({first:this.startFn(),firstDone:!1,iterator:t[Symbol.iterator]()}),e=>{let t;if(!e.firstDone){do if(t=this.nextFn(e.first),!t.done)return t;while(!t.done);e.firstDone=!0}do if(t=e.iterator.next(),!t.done)return t;while(!t.done);return A})}join(e=`,`){let t=this.iterator(),n=``,r,i=!1;do r=t.next(),r.done||(i&&(n+=e),n+=ee(r.value)),i=!0;while(!r.done);return n}indexOf(e,t=0){let n=this.iterator(),r=0,i=n.next();for(;!i.done;){if(r>=t&&i.value===e)return r;i=n.next(),r++}return-1}every(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(!e(n.value))return!1;n=t.next()}return!0}some(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return!0;n=t.next()}return!1}forEach(e){let t=this.iterator(),n=0,r=t.next();for(;!r.done;)e(r.value,n),r=t.next(),n++}map(t){return new e(this.startFn,e=>{let{done:n,value:r}=this.nextFn(e);return n?A:{done:!1,value:t(r)}})}filter(t){return new e(this.startFn,e=>{let n;do if(n=this.nextFn(e),!n.done&&t(n.value))return n;while(!n.done);return A})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){let n=this.iterator(),r=t,i=n.next();for(;!i.done;)r=r===void 0?i.value:e(r,i.value),i=n.next();return r}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,n){let r=e.next();if(r.done)return n;let i=this.recursiveReduce(e,t,n);return i===void 0?r.value:t(i,r.value)}find(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(e(n.value))return n.value;n=t.next()}}findIndex(e){let t=this.iterator(),n=0,r=t.next();for(;!r.done;){if(e(r.value))return n;r=t.next(),n++}return-1}includes(e){let t=this.iterator(),n=t.next();for(;!n.done;){if(n.value===e)return!0;n=t.next()}return!1}flatMap(t){return new e(()=>({this:this.startFn()}),e=>{do{if(e.iterator){let t=e.iterator.next();if(t.done)e.iterator=void 0;else return t}let{done:n,value:r}=this.nextFn(e.this);if(!n){let n=t(r);if(te(n))e.iterator=n[Symbol.iterator]();else return{done:!1,value:n}}}while(e.iterator);return A})}flat(t){if(t===void 0&&(t=1),t<=0)return this;let n=t>1?this.flat(t-1):this;return new e(()=>({this:n.startFn()}),e=>{do{if(e.iterator){let t=e.iterator.next();if(t.done)e.iterator=void 0;else return t}let{done:t,value:r}=n.nextFn(e.this);if(!t)if(te(r))e.iterator=r[Symbol.iterator]();else return{done:!1,value:r}}while(e.iterator);return A})}head(){let e=this.iterator().next();if(!e.done)return e.value}tail(t=1){return new e(()=>{let e=this.startFn();for(let n=0;n<t;n++)if(this.nextFn(e).done)return e;return e},this.nextFn)}limit(t){return new e(()=>({size:0,state:this.startFn()}),e=>(e.size++,e.size>t?A:this.nextFn(e.state)))}distinct(t){return new e(()=>({set:new Set,internalState:this.startFn()}),e=>{let n;do if(n=this.nextFn(e.internalState),!n.done){let r=t?t(n.value):n.value;if(!e.set.has(r))return e.set.add(r),n}while(!n.done);return A})}exclude(e,t){let n=new Set;for(let r of e){let e=t?t(r):r;n.add(e)}return this.filter(e=>{let r=t?t(e):e;return!n.has(r)})}};function ee(e){return typeof e==`string`?e:e===void 0?`undefined`:typeof e.toString==`function`?e.toString():Object.prototype.toString.call(e)}function te(e){return!!e&&typeof e[Symbol.iterator]==`function`}const k=new O(()=>void 0,()=>A),A=Object.freeze({done:!0,value:void 0});function j(...e){if(e.length===1){let t=e[0];if(t instanceof O)return t;if(te(t))return new O(()=>t[Symbol.iterator](),e=>e.next());if(typeof t.length==`number`)return new O(()=>({index:0}),e=>e.index<t.length?{done:!1,value:t[e.index++]}:A)}return e.length>1?new O(()=>({collIndex:0,arrIndex:0}),t=>{do{if(t.iterator){let e=t.iterator.next();if(!e.done)return e;t.iterator=void 0}if(t.array){if(t.arrIndex<t.array.length)return{done:!1,value:t.array[t.arrIndex++]};t.array=void 0,t.arrIndex=0}if(t.collIndex<e.length){let n=e[t.collIndex++];te(n)?t.iterator=n[Symbol.iterator]():n&&typeof n.length==`number`&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return A}):k}var ne=class extends O{constructor(e,t,n){super(()=>({iterators:n?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),e=>{for(e.pruned&&=(e.iterators.pop(),!1);e.iterators.length>0;){let n=e.iterators[e.iterators.length-1].next();if(n.done)e.iterators.pop();else return e.iterators.push(t(n.value)[Symbol.iterator]()),n}return A})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},M;(function(e){function t(e){return e.reduce((e,t)=>e+t,0)}e.sum=t;function n(e){return e.reduce((e,t)=>e*t,0)}e.product=n;function r(e){return e.reduce((e,t)=>Math.min(e,t))}e.min=r;function i(e){return e.reduce((e,t)=>Math.max(e,t))}e.max=i})(M||={});var re=i({DefaultNameRegexp:()=>se,RangeComparison:()=>L,compareRange:()=>ae,findCommentNode:()=>le,findDeclarationNodeAtOffset:()=>ce,findLeafNodeAtOffset:()=>de,findLeafNodeBeforeOffset:()=>fe,flattenCst:()=>N,getInteriorNodes:()=>_e,getNextNode:()=>he,getPreviousNode:()=>me,getStartlineNode:()=>ge,inRange:()=>oe,isChildNode:()=>P,isCommentNode:()=>ue,streamCst:()=>ie,toDocumentSegment:()=>I,tokenToRange:()=>F});function ie(e){return new ne(e,e=>T(e)?e.content:[],{includeRoot:!0})}function N(e){return ie(e).filter(E)}function P(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function F(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function I(e){if(!e)return;let{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}var L;(function(e){e[e.Before=0]=`Before`,e[e.After=1]=`After`,e[e.OverlapFront=2]=`OverlapFront`,e[e.OverlapBack=3]=`OverlapBack`,e[e.Inside=4]=`Inside`,e[e.Outside=5]=`Outside`})(L||={});function ae(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return L.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return L.After;let n=e.start.line>t.start.line||e.start.line===t.start.line&&e.start.character>=t.start.character,r=e.end.line<t.end.line||e.end.line===t.end.line&&e.end.character<=t.end.character;return n&&r?L.Inside:n?L.OverlapBack:r?L.OverlapFront:L.Outside}function oe(e,t){return ae(e,t)>L.After}const se=/^[\w\p{L}]$/u;function ce(e,t,n=se){if(e){if(t>0){let r=t-e.offset,i=e.text.charAt(r);n.test(i)||t--}return de(e,t)}}function le(e,t){if(e){let n=me(e,!0);if(n&&ue(n,t))return n;if(D(e)){let n=e.content.findIndex(e=>!e.hidden);for(let r=n-1;r>=0;r--){let n=e.content[r];if(ue(n,t))return n}}}}function ue(e,t){return E(e)&&t.includes(e.tokenType.name)}function de(e,t){if(E(e))return e;if(T(e)){let n=pe(e,t,!1);if(n)return de(n,t)}}function fe(e,t){if(E(e))return e;if(T(e)){let n=pe(e,t,!0);if(n)return fe(n,t)}}function pe(e,t,n){let r=0,i=e.content.length-1,a;for(;r<=i;){let o=Math.floor((r+i)/2),s=e.content[o];if(s.offset<=t&&s.end>t)return s;s.end<=t?(a=n?s:void 0,r=o+1):i=o-1}return a}function me(e,t=!0){for(;e.container;){let n=e.container,r=n.content.indexOf(e);for(;r>0;){r--;let e=n.content[r];if(t||!e.hidden)return e}e=n}}function he(e,t=!0){for(;e.container;){let n=e.container,r=n.content.indexOf(e),i=n.content.length-1;for(;r<i;){r++;let e=n.content[r];if(t||!e.hidden)return e}e=n}}function ge(e){if(e.range.start.character===0)return e;let t=e.range.start.line,n=e,r;for(;e.container;){let i=e.container,a=r??i.content.indexOf(e);if(a===0?(e=i,r=void 0):(r=a-1,e=i.content[r]),e.range.start.line!==t)break;n=e}return n}function _e(e,t){let n=ve(e,t);return n?n.parent.content.slice(n.a+1,n.b):[]}function ve(e,t){let n=ye(e),r=ye(t),i;for(let e=0;e<n.length&&e<r.length;e++){let t=n[e],a=r[e];if(t.parent===a.parent)i={parent:t.parent,a:t.index,b:a.index};else break}return i}function ye(e){let t=[];for(;e.container;){let n=e.container,r=n.content.indexOf(e);t.push({parent:n,index:r}),e=n}return t.reverse()}var be=class extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};function xe(e){throw Error(`Error! The input value was not handled.`)}var Se=i({AbstractElement:()=>Ie,AbstractRule:()=>we,AbstractType:()=>Ee,Action:()=>kt,Alternatives:()=>jt,ArrayLiteral:()=>Re,ArrayType:()=>Be,Assignment:()=>Nt,BooleanLiteral:()=>He,CharacterRange:()=>Ft,Condition:()=>Oe,Conjunction:()=>We,CrossReference:()=>Lt,Disjunction:()=>Ke,EndOfFile:()=>zt,Grammar:()=>Je,GrammarImport:()=>Xe,Group:()=>Vt,InferredType:()=>Qe,Interface:()=>et,Keyword:()=>Ut,LangiumGrammarAstReflection:()=>un,LangiumGrammarTerminals:()=>Ce,NamedArgument:()=>nt,NegatedToken:()=>Gt,Negation:()=>it,NumberLiteral:()=>ot,Parameter:()=>ct,ParameterReference:()=>ut,ParserRule:()=>ft,ReferenceType:()=>pt,RegexToken:()=>qt,ReturnType:()=>ht,RuleCall:()=>Yt,SimpleType:()=>_t,StringLiteral:()=>yt,TerminalAlternatives:()=>Zt,TerminalGroup:()=>$t,TerminalRule:()=>xt,TerminalRuleCall:()=>tn,Type:()=>Ct,TypeAttribute:()=>Tt,TypeDefinition:()=>Me,UnionType:()=>Dt,UnorderedGroup:()=>rn,UntilToken:()=>on,ValueLiteral:()=>Pe,Wildcard:()=>cn,isAbstractElement:()=>Le,isAbstractRule:()=>Te,isAbstractType:()=>De,isAction:()=>At,isAlternatives:()=>Mt,isArrayLiteral:()=>ze,isArrayType:()=>Ve,isAssignment:()=>Pt,isBooleanLiteral:()=>Ue,isCharacterRange:()=>It,isCondition:()=>ke,isConjunction:()=>Ge,isCrossReference:()=>Rt,isDisjunction:()=>qe,isEndOfFile:()=>Bt,isFeatureName:()=>Ae,isGrammar:()=>Ye,isGrammarImport:()=>Ze,isGroup:()=>Ht,isInferredType:()=>$e,isInterface:()=>tt,isKeyword:()=>Wt,isNamedArgument:()=>rt,isNegatedToken:()=>Kt,isNegation:()=>at,isNumberLiteral:()=>st,isParameter:()=>lt,isParameterReference:()=>dt,isParserRule:()=>R,isPrimitiveType:()=>je,isReferenceType:()=>mt,isRegexToken:()=>Jt,isReturnType:()=>gt,isRuleCall:()=>Xt,isSimpleType:()=>vt,isStringLiteral:()=>bt,isTerminalAlternatives:()=>Qt,isTerminalGroup:()=>en,isTerminalRule:()=>St,isTerminalRuleCall:()=>nn,isType:()=>wt,isTypeAttribute:()=>Et,isTypeDefinition:()=>Ne,isUnionType:()=>Ot,isUnorderedGroup:()=>an,isUntilToken:()=>sn,isValueLiteral:()=>Fe,isWildcard:()=>ln,reflection:()=>z});const Ce={ID:/\^?[_a-zA-Z][\w_]*/,STRING:/"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/,NUMBER:/NaN|-?((\d*\.\d+|\d+)([Ee][+-]?\d+)?|Infinity)/,RegexLiteral:/\/(?![*+?])(?:[^\r\n\[/\\]|\\.|\[(?:[^\r\n\]\\]|\\.)*\])+\/[a-z]*/,WS:/\s+/,ML_COMMENT:/\/\*[\s\S]*?\*\//,SL_COMMENT:/\/\/[^\n\r]*/},we=`AbstractRule`;function Te(e){return z.isInstance(e,we)}const Ee=`AbstractType`;function De(e){return z.isInstance(e,Ee)}const Oe=`Condition`;function ke(e){return z.isInstance(e,Oe)}function Ae(e){return je(e)||e===`current`||e===`entry`||e===`extends`||e===`false`||e===`fragment`||e===`grammar`||e===`hidden`||e===`import`||e===`interface`||e===`returns`||e===`terminal`||e===`true`||e===`type`||e===`infer`||e===`infers`||e===`with`||typeof e==`string`&&/\^?[_a-zA-Z][\w_]*/.test(e)}function je(e){return e===`string`||e===`number`||e===`boolean`||e===`Date`||e===`bigint`}const Me=`TypeDefinition`;function Ne(e){return z.isInstance(e,Me)}const Pe=`ValueLiteral`;function Fe(e){return z.isInstance(e,Pe)}const Ie=`AbstractElement`;function Le(e){return z.isInstance(e,Ie)}const Re=`ArrayLiteral`;function ze(e){return z.isInstance(e,Re)}const Be=`ArrayType`;function Ve(e){return z.isInstance(e,Be)}const He=`BooleanLiteral`;function Ue(e){return z.isInstance(e,He)}const We=`Conjunction`;function Ge(e){return z.isInstance(e,We)}const Ke=`Disjunction`;function qe(e){return z.isInstance(e,Ke)}const Je=`Grammar`;function Ye(e){return z.isInstance(e,Je)}const Xe=`GrammarImport`;function Ze(e){return z.isInstance(e,Xe)}const Qe=`InferredType`;function $e(e){return z.isInstance(e,Qe)}const et=`Interface`;function tt(e){return z.isInstance(e,et)}const nt=`NamedArgument`;function rt(e){return z.isInstance(e,nt)}const it=`Negation`;function at(e){return z.isInstance(e,it)}const ot=`NumberLiteral`;function st(e){return z.isInstance(e,ot)}const ct=`Parameter`;function lt(e){return z.isInstance(e,ct)}const ut=`ParameterReference`;function dt(e){return z.isInstance(e,ut)}const ft=`ParserRule`;function R(e){return z.isInstance(e,ft)}const pt=`ReferenceType`;function mt(e){return z.isInstance(e,pt)}const ht=`ReturnType`;function gt(e){return z.isInstance(e,ht)}const _t=`SimpleType`;function vt(e){return z.isInstance(e,_t)}const yt=`StringLiteral`;function bt(e){return z.isInstance(e,yt)}const xt=`TerminalRule`;function St(e){return z.isInstance(e,xt)}const Ct=`Type`;function wt(e){return z.isInstance(e,Ct)}const Tt=`TypeAttribute`;function Et(e){return z.isInstance(e,Tt)}const Dt=`UnionType`;function Ot(e){return z.isInstance(e,Dt)}const kt=`Action`;function At(e){return z.isInstance(e,kt)}const jt=`Alternatives`;function Mt(e){return z.isInstance(e,jt)}const Nt=`Assignment`;function Pt(e){return z.isInstance(e,Nt)}const Ft=`CharacterRange`;function It(e){return z.isInstance(e,Ft)}const Lt=`CrossReference`;function Rt(e){return z.isInstance(e,Lt)}const zt=`EndOfFile`;function Bt(e){return z.isInstance(e,zt)}const Vt=`Group`;function Ht(e){return z.isInstance(e,Vt)}const Ut=`Keyword`;function Wt(e){return z.isInstance(e,Ut)}const Gt=`NegatedToken`;function Kt(e){return z.isInstance(e,Gt)}const qt=`RegexToken`;function Jt(e){return z.isInstance(e,qt)}const Yt=`RuleCall`;function Xt(e){return z.isInstance(e,Yt)}const Zt=`TerminalAlternatives`;function Qt(e){return z.isInstance(e,Zt)}const $t=`TerminalGroup`;function en(e){return z.isInstance(e,$t)}const tn=`TerminalRuleCall`;function nn(e){return z.isInstance(e,tn)}const rn=`UnorderedGroup`;function an(e){return z.isInstance(e,rn)}const on=`UntilToken`;function sn(e){return z.isInstance(e,on)}const cn=`Wildcard`;function ln(e){return z.isInstance(e,cn)}var un=class extends w{getAllTypes(){return[Ie,we,Ee,kt,jt,Re,Be,Nt,He,Ft,Oe,We,Lt,Ke,zt,Je,Xe,Vt,Qe,et,Ut,nt,Gt,it,ot,ct,ut,ft,pt,qt,ht,Yt,_t,yt,Zt,$t,xt,tn,Ct,Tt,Me,Dt,rn,on,Pe,cn]}computeIsSubtype(e,t){switch(e){case kt:case jt:case Nt:case Ft:case Lt:case zt:case Vt:case Ut:case Gt:case qt:case Yt:case Zt:case $t:case tn:case rn:case on:case cn:return this.isSubtype(Ie,t);case Re:case ot:case yt:return this.isSubtype(Pe,t);case Be:case pt:case _t:case Dt:return this.isSubtype(Me,t);case He:return this.isSubtype(Oe,t)||this.isSubtype(Pe,t);case We:case Ke:case it:case ut:return this.isSubtype(Oe,t);case Qe:case et:case Ct:return this.isSubtype(Ee,t);case ft:return this.isSubtype(we,t)||this.isSubtype(Ee,t);case xt:return this.isSubtype(we,t);default:return!1}}getReferenceType(e){let t=`${e.container.$type}:${e.property}`;switch(t){case`Action:type`:case`CrossReference:type`:case`Interface:superTypes`:case`ParserRule:returnType`:case`SimpleType:typeRef`:return Ee;case`Grammar:hiddenTokens`:case`ParserRule:hiddenTokens`:case`RuleCall:rule`:return we;case`Grammar:usedGrammars`:return Je;case`NamedArgument:parameter`:case`ParameterReference:parameter`:return ct;case`TerminalRuleCall:rule`:return xt;default:throw Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Ie:return{name:Ie,properties:[{name:`cardinality`},{name:`lookahead`}]};case Re:return{name:Re,properties:[{name:`elements`,defaultValue:[]}]};case Be:return{name:Be,properties:[{name:`elementType`}]};case He:return{name:He,properties:[{name:`true`,defaultValue:!1}]};case We:return{name:We,properties:[{name:`left`},{name:`right`}]};case Ke:return{name:Ke,properties:[{name:`left`},{name:`right`}]};case Je:return{name:Je,properties:[{name:`definesHiddenTokens`,defaultValue:!1},{name:`hiddenTokens`,defaultValue:[]},{name:`imports`,defaultValue:[]},{name:`interfaces`,defaultValue:[]},{name:`isDeclared`,defaultValue:!1},{name:`name`},{name:`rules`,defaultValue:[]},{name:`types`,defaultValue:[]},{name:`usedGrammars`,defaultValue:[]}]};case Xe:return{name:Xe,properties:[{name:`path`}]};case Qe:return{name:Qe,properties:[{name:`name`}]};case et:return{name:et,properties:[{name:`attributes`,defaultValue:[]},{name:`name`},{name:`superTypes`,defaultValue:[]}]};case nt:return{name:nt,properties:[{name:`calledByName`,defaultValue:!1},{name:`parameter`},{name:`value`}]};case it:return{name:it,properties:[{name:`value`}]};case ot:return{name:ot,properties:[{name:`value`}]};case ct:return{name:ct,properties:[{name:`name`}]};case ut:return{name:ut,properties:[{name:`parameter`}]};case ft:return{name:ft,properties:[{name:`dataType`},{name:`definesHiddenTokens`,defaultValue:!1},{name:`definition`},{name:`entry`,defaultValue:!1},{name:`fragment`,defaultValue:!1},{name:`hiddenTokens`,defaultValue:[]},{name:`inferredType`},{name:`name`},{name:`parameters`,defaultValue:[]},{name:`returnType`},{name:`wildcard`,defaultValue:!1}]};case pt:return{name:pt,properties:[{name:`referenceType`}]};case ht:return{name:ht,properties:[{name:`name`}]};case _t:return{name:_t,properties:[{name:`primitiveType`},{name:`stringType`},{name:`typeRef`}]};case yt:return{name:yt,properties:[{name:`value`}]};case xt:return{name:xt,properties:[{name:`definition`},{name:`fragment`,defaultValue:!1},{name:`hidden`,defaultValue:!1},{name:`name`},{name:`type`}]};case Ct:return{name:Ct,properties:[{name:`name`},{name:`type`}]};case Tt:return{name:Tt,properties:[{name:`defaultValue`},{name:`isOptional`,defaultValue:!1},{name:`name`},{name:`type`}]};case Dt:return{name:Dt,properties:[{name:`types`,defaultValue:[]}]};case kt:return{name:kt,properties:[{name:`cardinality`},{name:`feature`},{name:`inferredType`},{name:`lookahead`},{name:`operator`},{name:`type`}]};case jt:return{name:jt,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Nt:return{name:Nt,properties:[{name:`cardinality`},{name:`feature`},{name:`lookahead`},{name:`operator`},{name:`terminal`}]};case Ft:return{name:Ft,properties:[{name:`cardinality`},{name:`left`},{name:`lookahead`},{name:`right`}]};case Lt:return{name:Lt,properties:[{name:`cardinality`},{name:`deprecatedSyntax`,defaultValue:!1},{name:`lookahead`},{name:`terminal`},{name:`type`}]};case zt:return{name:zt,properties:[{name:`cardinality`},{name:`lookahead`}]};case Vt:return{name:Vt,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`guardCondition`},{name:`lookahead`}]};case Ut:return{name:Ut,properties:[{name:`cardinality`},{name:`lookahead`},{name:`value`}]};case Gt:return{name:Gt,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case qt:return{name:qt,properties:[{name:`cardinality`},{name:`lookahead`},{name:`regex`}]};case Yt:return{name:Yt,properties:[{name:`arguments`,defaultValue:[]},{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case Zt:return{name:Zt,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case $t:return{name:$t,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case tn:return{name:tn,properties:[{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case rn:return{name:rn,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case on:return{name:on,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case cn:return{name:cn,properties:[{name:`cardinality`},{name:`lookahead`}]};default:return{name:e,properties:[]}}}};const z=new un;var dn=i({assignMandatoryProperties:()=>Sn,copyAstNode:()=>wn,findLocalReferences:()=>xn,findRootNode:()=>hn,getContainerOfType:()=>pn,getDocument:()=>B,hasContainerOfType:()=>mn,linkContentToContainer:()=>fn,streamAllContents:()=>_n,streamAst:()=>vn,streamContents:()=>gn,streamReferences:()=>bn});function fn(e){for(let[t,n]of Object.entries(e))t.startsWith(`$`)||(Array.isArray(n)?n.forEach((n,r)=>{b(n)&&(n.$container=e,n.$containerProperty=t,n.$containerIndex=r)}):b(n)&&(n.$container=e,n.$containerProperty=t))}function pn(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function mn(e,t){let n=e;for(;n;){if(t(n))return!0;n=n.$container}return!1}function B(e){let t=hn(e).$document;if(!t)throw Error(`AST node has no document.`);return t}function hn(e){for(;e.$container;)e=e.$container;return e}function gn(e,t){if(!e)throw Error(`Node must be an AstNode.`);let n=t?.range;return new O(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndex<t.keys.length;){let r=t.keys[t.keyIndex];if(!r.startsWith(`$`)){let i=e[r];if(b(i)){if(t.keyIndex++,yn(i,n))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){let e=i[t.arrayIndex++];if(b(e)&&yn(e,n))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return A})}function _n(e,t){if(!e)throw Error(`Root node must be an AstNode.`);return new ne(e,e=>gn(e,t))}function vn(e,t){if(!e)throw Error(`Root node must be an AstNode.`);return t?.range&&!yn(e,t.range)?new ne(e,()=>[]):new ne(e,e=>gn(e,t),{includeRoot:!0})}function yn(e,t){if(!t)return!0;let n=e.$cstNode?.range;return n?oe(n,t):!1}function bn(e){return new O(()=>({keys:Object.keys(e),keyIndex:0,arrayIndex:0}),t=>{for(;t.keyIndex<t.keys.length;){let n=t.keys[t.keyIndex];if(!n.startsWith(`$`)){let r=e[n];if(x(r))return t.keyIndex++,{done:!1,value:{reference:r,container:e,property:n}};if(Array.isArray(r)){for(;t.arrayIndex<r.length;){let i=t.arrayIndex++,a=r[i];if(x(a))return{done:!1,value:{reference:a,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return A})}function xn(e,t=B(e).parseResult.value){let n=[];return vn(t).forEach(t=>{bn(t).forEach(t=>{t.reference.ref===e&&n.push(t.reference)})}),j(n)}function Sn(e,t){let n=e.getTypeMetaData(t.$type),r=t;for(let e of n.properties)e.defaultValue!==void 0&&r[e.name]===void 0&&(r[e.name]=Cn(e.defaultValue))}function Cn(e){return Array.isArray(e)?[...e.map(Cn)]:e}function wn(e,t){let n={$type:e.$type};for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(b(i))n[r]=wn(i,t);else if(x(i))n[r]=t(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){let e=[];for(let a of i)b(a)?e.push(wn(a,t)):x(a)?e.push(t(n,r,a.$refNode,a.$refText)):e.push(a);n[r]=e}else n[r]=i;return fn(n),n}var Tn=i({NEWLINE_REGEXP:()=>En,escapeRegExp:()=>Pn,getTerminalParts:()=>An,isMultilineComment:()=>jn,isWhitespace:()=>Nn,partialMatches:()=>Fn,partialRegExp:()=>In,whitespaceCharacters:()=>Mn});const En=/\r?\n/gm,Dn=new s;var On=class extends c{constructor(){super(...arguments),this.isStarting=!0,this.endRegexpStack=[],this.multiline=!1}get endRegex(){return this.endRegexpStack.join(``)}reset(e){this.multiline=!1,this.regex=e,this.startRegexp=``,this.isStarting=!0,this.endRegexpStack=[]}visitGroup(e){e.quantifier&&(this.isStarting=!1,this.endRegexpStack=[])}visitCharacter(e){let t=String.fromCharCode(e.value);if(!this.multiline&&t===`
2
- `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let e=Pn(t);this.endRegexpStack.push(e),this.isStarting&&(this.startRegexp+=e)}}visitSet(e){if(!this.multiline){let t=this.regex.substring(e.loc.begin,e.loc.end),n=new RegExp(t);this.multiline=!!`
3
- `.match(n)}if(e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let t=this.regex.substring(e.loc.begin,e.loc.end);this.endRegexpStack.push(t),this.isStarting&&(this.startRegexp+=t)}}visitChildren(e){e.type===`Group`&&e.quantifier||super.visitChildren(e)}};const kn=new On;function An(e){try{typeof e!=`string`&&(e=e.source),e=`/${e}/`;let t=Dn.pattern(e),n=[];for(let r of t.value.value)kn.reset(e),kn.visit(r),n.push({start:kn.startRegexp,end:kn.endRegex});return n}catch{return[]}}function jn(e){try{return typeof e==`string`&&(e=new RegExp(e)),e=e.toString(),kn.reset(e),kn.visit(Dn.pattern(e)),kn.multiline}catch{return!1}}const Mn=`\f
4
- \r \v \xA0            \u2028\u2029   `.split(``);function Nn(e){let t=typeof e==`string`?new RegExp(e):e;return Mn.some(e=>t.test(e))}function Pn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Fn(e,t){let n=In(e),r=t.match(n);return!!r&&r[0].length>0}function In(e){typeof e==`string`&&(e=new RegExp(e));let t=e,n=e.source,r=0;function i(){let e=``,a;function o(t){e+=n.substr(r,t),r+=t}function s(t){e+=`(?:`+n.substr(r,t)+`|$)`,r+=t}for(;r<n.length;)switch(n[r]){case`\\`:switch(n[r+1]){case`c`:s(3);break;case`x`:s(4);break;case`u`:t.unicode?n[r+2]===`{`?s(n.indexOf(`}`,r)-r+1):s(6):s(2);break;case`p`:case`P`:t.unicode?s(n.indexOf(`}`,r)-r+1):s(2);break;case`k`:s(n.indexOf(`>`,r)-r+1);break;default:s(2);break}break;case`[`:a=/\[(?:\\.|.)*?\]/g,a.lastIndex=r,a=a.exec(n)||[],s(a[0].length);break;case`|`:case`^`:case`$`:case`*`:case`+`:case`?`:o(1);break;case`{`:a=/\{\d+,?\d*\}/g,a.lastIndex=r,a=a.exec(n),a?o(a[0].length):s(1);break;case`(`:if(n[r+1]===`?`)switch(n[r+2]){case`:`:e+=`(?:`,r+=3,e+=i()+`|$)`;break;case`=`:e+=`(?=`,r+=3,e+=i()+`)`;break;case`!`:a=r,r+=3,i(),e+=n.substr(a,r-a);break;case`<`:switch(n[r+3]){case`=`:case`!`:a=r,r+=4,i(),e+=n.substr(a,r-a);break;default:o(n.indexOf(`>`,r)-r+1),e+=i()+`|$)`;break}break}else o(1),e+=i()+`|$)`;break;case`)`:return++r,e;default:s(1);break}return e}return new RegExp(i(),e.flags)}var Ln=i({findAssignment:()=>Zn,findNameAssignment:()=>Qn,findNodeForKeyword:()=>Yn,findNodeForProperty:()=>Kn,findNodesForKeyword:()=>Jn,findNodesForKeywordInternal:()=>Xn,findNodesForProperty:()=>Gn,getActionAtElement:()=>er,getActionType:()=>ur,getAllReachableRules:()=>Bn,getAllRulesUsedForCrossReferences:()=>Hn,getCrossReferenceTerminal:()=>Un,getEntryRule:()=>Rn,getExplicitRuleType:()=>cr,getHiddenRules:()=>zn,getRuleType:()=>fr,getRuleTypeName:()=>dr,getTypeName:()=>lr,isArrayCardinality:()=>nr,isArrayOperator:()=>rr,isCommentTerminal:()=>Wn,isDataType:()=>or,isDataTypeRule:()=>ir,isOptionalCardinality:()=>tr,terminalRegex:()=>pr});function Rn(e){return e.rules.find(e=>R(e)&&e.entry)}function zn(e){return e.rules.filter(e=>St(e)&&e.hidden)}function Bn(e,t){let n=new Set,r=Rn(e);if(!r)return new Set(e.rules);let i=[r].concat(zn(e));for(let e of i)Vn(e,n,t);let a=new Set;for(let t of e.rules)(n.has(t.name)||St(t)&&t.hidden)&&a.add(t);return a}function Vn(e,t,n){t.add(e.name),_n(e).forEach(e=>{if(Xt(e)||n&&nn(e)){let r=e.rule.ref;r&&!t.has(r.name)&&Vn(r,t,n)}})}function Hn(e){let t=new Set;return _n(e).forEach(e=>{Rt(e)&&(R(e.type.ref)&&t.add(e.type.ref),$e(e.type.ref)&&R(e.type.ref.$container)&&t.add(e.type.ref.$container))}),t}function Un(e){if(e.terminal)return e.terminal;if(e.type.ref)return Qn(e.type.ref)?.terminal}function Wn(e){return e.hidden&&!Nn(pr(e))}function Gn(e,t){return!e||!t?[]:qn(e,t,e.astNode,!0)}function Kn(e,t,n){if(!e||!t)return;let r=qn(e,t,e.astNode,!0);if(r.length!==0)return n=n===void 0?0:Math.max(0,Math.min(n,r.length-1)),r[n]}function qn(e,t,n,r){if(!r){let n=pn(e.grammarSource,Pt);if(n&&n.feature===t)return[e]}return T(e)&&e.astNode===n?e.content.flatMap(e=>qn(e,t,n,!1)):[]}function Jn(e,t){return e?Xn(e,t,e?.astNode):[]}function Yn(e,t,n){if(!e)return;let r=Xn(e,t,e?.astNode);if(r.length!==0)return n=n===void 0?0:Math.max(0,Math.min(n,r.length-1)),r[n]}function Xn(e,t,n){if(e.astNode!==n)return[];if(Wt(e.grammarSource)&&e.grammarSource.value===t)return[e];let r=ie(e).iterator(),i,a=[];do if(i=r.next(),!i.done){let e=i.value;e.astNode===n?Wt(e.grammarSource)&&e.grammarSource.value===t&&a.push(e):r.prune()}while(!i.done);return a}function Zn(e){let t=e.astNode;for(;t===e.container?.astNode;){let t=pn(e.grammarSource,Pt);if(t)return t;e=e.container}}function Qn(e){let t=e;return $e(t)&&(At(t.$container)?t=t.$container.$container:R(t.$container)?t=t.$container:xe(t.$container)),$n(e,t,new Map)}function $n(e,t,n){function r(t,r){let i;return pn(t,Pt)||(i=$n(r,r,n)),n.set(e,i),i}if(n.has(e))return n.get(e);n.set(e,void 0);for(let i of _n(t))if(Pt(i)&&i.feature.toLowerCase()===`name`)return n.set(e,i),i;else if(Xt(i)&&R(i.rule.ref))return r(i,i.rule.ref);else if(vt(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}function er(e){let t=e.$container;if(Ht(t)){let n=t.elements,r=n.indexOf(e);for(let e=r-1;e>=0;e--){let t=n[e];if(At(t))return t;{let t=_n(n[e]).find(At);if(t)return t}}}if(Le(t))return er(t)}function tr(e,t){return e===`?`||e===`*`||Ht(t)&&!!t.guardCondition}function nr(e){return e===`*`||e===`+`}function rr(e){return e===`+=`}function ir(e){return ar(e,new Set)}function ar(e,t){if(t.has(e))return!0;t.add(e);for(let n of _n(e))if(Xt(n)){if(!n.rule.ref||R(n.rule.ref)&&!ar(n.rule.ref,t))return!1}else if(Pt(n))return!1;else if(At(n))return!1;return!!e.definition}function or(e){return sr(e.type,new Set)}function sr(e,t){if(t.has(e))return!0;if(t.add(e),Ve(e)||mt(e))return!1;if(Ot(e))return e.types.every(e=>sr(e,t));if(vt(e)){if(e.primitiveType!==void 0||e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let n=e.typeRef.ref;return wt(n)?sr(n.type,t):!1}else return!1}else return!1}function cr(e){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t&&(R(t)||tt(t)||wt(t)))return t.name}}function lr(e){if(R(e))return ir(e)?e.name:cr(e)??e.name;if(tt(e)||wt(e)||gt(e))return e.name;if(At(e)){let t=ur(e);if(t)return t}else if($e(e))return e.name;throw Error(`Cannot get name of Unknown Type`)}function ur(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return lr(e.type.ref)}function dr(e){return St(e)?e.type?.name??`string`:ir(e)?e.name:cr(e)??e.name}function fr(e){return St(e)?e.type?.name??`string`:cr(e)??e.name}function pr(e){let t={s:!1,i:!1,u:!1},n=hr(e.definition,t),r=Object.entries(t).filter(([,e])=>e).map(([e])=>e).join(``);return new RegExp(n,r)}const mr=`[\\s\\S]`;function hr(e,t){if(Qt(e))return gr(e);if(en(e))return _r(e);if(It(e))return br(e);if(nn(e)){let t=e.rule.ref;if(!t)throw Error(`Missing rule reference.`);return Sr(hr(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead})}else if(Kt(e))return yr(e);else if(sn(e))return vr(e);else if(Jt(e)){let n=e.regex.lastIndexOf(`/`),r=e.regex.substring(1,n),i=e.regex.substring(n+1);return t&&(t.i=i.includes(`i`),t.s=i.includes(`s`),t.u=i.includes(`u`)),Sr(r,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}else if(ln(e))return Sr(mr,{cardinality:e.cardinality,lookahead:e.lookahead});else throw Error(`Invalid terminal element: ${e?.$type}`)}function gr(e){return Sr(e.elements.map(e=>hr(e)).join(`|`),{cardinality:e.cardinality,lookahead:e.lookahead})}function _r(e){return Sr(e.elements.map(e=>hr(e)).join(``),{cardinality:e.cardinality,lookahead:e.lookahead})}function vr(e){return Sr(`${mr}*?${hr(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead})}function yr(e){return Sr(`(?!${hr(e.terminal)})${mr}*?`,{cardinality:e.cardinality,lookahead:e.lookahead})}function br(e){return e.right?Sr(`[${xr(e.left)}-${xr(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1}):Sr(xr(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}function xr(e){return Pn(e.value)}function Sr(e,t){return(t.wrap!==!1||t.lookahead)&&(e=`(${t.lookahead??``}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function Cr(e){let t=[],n=e.Grammar;for(let e of n.rules)St(e)&&Wn(e)&&jn(pr(e))&&t.push(e.name);return{multilineCommentRules:t,nameRegexp:se}}var wr=i({AnnotatedTextEdit:()=>Wr,ChangeAnnotation:()=>Ur,ChangeAnnotationIdentifier:()=>U,CodeAction:()=>Di,CodeActionContext:()=>Ei,CodeActionKind:()=>wi,CodeActionTriggerKind:()=>Ti,CodeDescription:()=>zr,CodeLens:()=>Oi,Color:()=>jr,ColorInformation:()=>Mr,ColorPresentation:()=>Nr,Command:()=>Vr,CompletionItem:()=>di,CompletionItemKind:()=>ai,CompletionItemLabelDetails:()=>ui,CompletionItemTag:()=>si,CompletionList:()=>fi,CreateFile:()=>Kr,DeleteFile:()=>Jr,Diagnostic:()=>Br,DiagnosticRelatedInformation:()=>Ir,DiagnosticSeverity:()=>Lr,DiagnosticTag:()=>Rr,DocumentHighlight:()=>vi,DocumentHighlightKind:()=>_i,DocumentLink:()=>Ai,DocumentSymbol:()=>Ci,DocumentUri:()=>Tr,EOL:()=>Yi,FoldingRange:()=>Fr,FoldingRangeKind:()=>Pr,FormattingOptions:()=>ki,Hover:()=>mi,InlayHint:()=>Vi,InlayHintKind:()=>zi,InlayHintLabelPart:()=>Bi,InlineCompletionContext:()=>qi,InlineCompletionItem:()=>Ui,InlineCompletionList:()=>Wi,InlineCompletionTriggerKind:()=>Gi,InlineValueContext:()=>Ri,InlineValueEvaluatableExpression:()=>Li,InlineValueText:()=>Fi,InlineValueVariableLookup:()=>Ii,InsertReplaceEdit:()=>ci,InsertTextFormat:()=>oi,InsertTextMode:()=>li,Location:()=>kr,LocationLink:()=>Ar,MarkedString:()=>pi,MarkupContent:()=>ii,MarkupKind:()=>ri,OptionalVersionedTextDocumentIdentifier:()=>ti,ParameterInformation:()=>hi,Position:()=>V,Range:()=>H,RenameFile:()=>qr,SelectedCompletionInfo:()=>Ki,SelectionRange:()=>ji,SemanticTokenModifiers:()=>Ni,SemanticTokenTypes:()=>Mi,SemanticTokens:()=>Pi,SignatureInformation:()=>gi,StringValue:()=>Hi,SymbolInformation:()=>xi,SymbolKind:()=>yi,SymbolTag:()=>bi,TextDocument:()=>Xi,TextDocumentEdit:()=>Gr,TextDocumentIdentifier:()=>$r,TextDocumentItem:()=>ni,TextEdit:()=>Hr,URI:()=>Er,VersionedTextDocumentIdentifier:()=>ei,WorkspaceChange:()=>Qr,WorkspaceEdit:()=>Yr,WorkspaceFolder:()=>Ji,WorkspaceSymbol:()=>Si,integer:()=>Dr,uinteger:()=>Or}),Tr,Er,Dr,Or,V,H,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,U,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi,W,Qi=n((()=>{(function(e){function t(e){return typeof e==`string`}e.is=t})(Tr||={}),(function(e){function t(e){return typeof e==`string`}e.is=t})(Er||={}),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}e.is=t})(Dr||={}),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(t){return typeof t==`number`&&e.MIN_VALUE<=t&&t<=e.MAX_VALUE}e.is=t})(Or||={}),(function(e){function t(e,t){return e===Number.MAX_VALUE&&(e=Or.MAX_VALUE),t===Number.MAX_VALUE&&(t=Or.MAX_VALUE),{line:e,character:t}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&W.uinteger(t.line)&&W.uinteger(t.character)}e.is=n})(V||={}),(function(e){function t(e,t,n,r){if(W.uinteger(e)&&W.uinteger(t)&&W.uinteger(n)&&W.uinteger(r))return{start:V.create(e,t),end:V.create(n,r)};if(V.is(e)&&V.is(t))return{start:e,end:t};throw Error(`Range#create called with invalid arguments[${e}, ${t}, ${n}, ${r}]`)}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&V.is(t.start)&&V.is(t.end)}e.is=n})(H||={}),(function(e){function t(e,t){return{uri:e,range:t}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&H.is(t.range)&&(W.string(t.uri)||W.undefined(t.uri))}e.is=n})(kr||={}),(function(e){function t(e,t,n,r){return{targetUri:e,targetRange:t,targetSelectionRange:n,originSelectionRange:r}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&H.is(t.targetRange)&&W.string(t.targetUri)&&H.is(t.targetSelectionRange)&&(H.is(t.originSelectionRange)||W.undefined(t.originSelectionRange))}e.is=n})(Ar||={}),(function(e){function t(e,t,n,r){return{red:e,green:t,blue:n,alpha:r}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&W.numberRange(t.red,0,1)&&W.numberRange(t.green,0,1)&&W.numberRange(t.blue,0,1)&&W.numberRange(t.alpha,0,1)}e.is=n})(jr||={}),(function(e){function t(e,t){return{range:e,color:t}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&H.is(t.range)&&jr.is(t.color)}e.is=n})(Mr||={}),(function(e){function t(e,t,n){return{label:e,textEdit:t,additionalTextEdits:n}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&W.string(t.label)&&(W.undefined(t.textEdit)||Hr.is(t))&&(W.undefined(t.additionalTextEdits)||W.typedArray(t.additionalTextEdits,Hr.is))}e.is=n})(Nr||={}),(function(e){e.Comment=`comment`,e.Imports=`imports`,e.Region=`region`})(Pr||={}),(function(e){function t(e,t,n,r,i,a){let o={startLine:e,endLine:t};return W.defined(n)&&(o.startCharacter=n),W.defined(r)&&(o.endCharacter=r),W.defined(i)&&(o.kind=i),W.defined(a)&&(o.collapsedText=a),o}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&W.uinteger(t.startLine)&&W.uinteger(t.startLine)&&(W.undefined(t.startCharacter)||W.uinteger(t.startCharacter))&&(W.undefined(t.endCharacter)||W.uinteger(t.endCharacter))&&(W.undefined(t.kind)||W.string(t.kind))}e.is=n})(Fr||={}),(function(e){function t(e,t){return{location:e,message:t}}e.create=t;function n(e){let t=e;return W.defined(t)&&kr.is(t.location)&&W.string(t.message)}e.is=n})(Ir||={}),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(Lr||={}),(function(e){e.Unnecessary=1,e.Deprecated=2})(Rr||={}),(function(e){function t(e){let t=e;return W.objectLiteral(t)&&W.string(t.href)}e.is=t})(zr||={}),(function(e){function t(e,t,n,r,i,a){let o={range:e,message:t};return W.defined(n)&&(o.severity=n),W.defined(r)&&(o.code=r),W.defined(i)&&(o.source=i),W.defined(a)&&(o.relatedInformation=a),o}e.create=t;function n(e){let t=e;return W.defined(t)&&H.is(t.range)&&W.string(t.message)&&(W.number(t.severity)||W.undefined(t.severity))&&(W.integer(t.code)||W.string(t.code)||W.undefined(t.code))&&(W.undefined(t.codeDescription)||W.string(t.codeDescription?.href))&&(W.string(t.source)||W.undefined(t.source))&&(W.undefined(t.relatedInformation)||W.typedArray(t.relatedInformation,Ir.is))}e.is=n})(Br||={}),(function(e){function t(e,t,...n){let r={title:e,command:t};return W.defined(n)&&n.length>0&&(r.arguments=n),r}e.create=t;function n(e){let t=e;return W.defined(t)&&W.string(t.title)&&W.string(t.command)}e.is=n})(Vr||={}),(function(e){function t(e,t){return{range:e,newText:t}}e.replace=t;function n(e,t){return{range:{start:e,end:e},newText:t}}e.insert=n;function r(e){return{range:e,newText:``}}e.del=r;function i(e){let t=e;return W.objectLiteral(t)&&W.string(t.newText)&&H.is(t.range)}e.is=i})(Hr||={}),(function(e){function t(e,t,n){let r={label:e};return t!==void 0&&(r.needsConfirmation=t),n!==void 0&&(r.description=n),r}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&W.string(t.label)&&(W.boolean(t.needsConfirmation)||t.needsConfirmation===void 0)&&(W.string(t.description)||t.description===void 0)}e.is=n})(Ur||={}),(function(e){function t(e){let t=e;return W.string(t)}e.is=t})(U||={}),(function(e){function t(e,t,n){return{range:e,newText:t,annotationId:n}}e.replace=t;function n(e,t,n){return{range:{start:e,end:e},newText:t,annotationId:n}}e.insert=n;function r(e,t){return{range:e,newText:``,annotationId:t}}e.del=r;function i(e){let t=e;return Hr.is(t)&&(Ur.is(t.annotationId)||U.is(t.annotationId))}e.is=i})(Wr||={}),(function(e){function t(e,t){return{textDocument:e,edits:t}}e.create=t;function n(e){let t=e;return W.defined(t)&&ti.is(t.textDocument)&&Array.isArray(t.edits)}e.is=n})(Gr||={}),(function(e){function t(e,t,n){let r={kind:`create`,uri:e};return t!==void 0&&(t.overwrite!==void 0||t.ignoreIfExists!==void 0)&&(r.options=t),n!==void 0&&(r.annotationId=n),r}e.create=t;function n(e){let t=e;return t&&t.kind===`create`&&W.string(t.uri)&&(t.options===void 0||(t.options.overwrite===void 0||W.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||W.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||U.is(t.annotationId))}e.is=n})(Kr||={}),(function(e){function t(e,t,n,r){let i={kind:`rename`,oldUri:e,newUri:t};return n!==void 0&&(n.overwrite!==void 0||n.ignoreIfExists!==void 0)&&(i.options=n),r!==void 0&&(i.annotationId=r),i}e.create=t;function n(e){let t=e;return t&&t.kind===`rename`&&W.string(t.oldUri)&&W.string(t.newUri)&&(t.options===void 0||(t.options.overwrite===void 0||W.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||W.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||U.is(t.annotationId))}e.is=n})(qr||={}),(function(e){function t(e,t,n){let r={kind:`delete`,uri:e};return t!==void 0&&(t.recursive!==void 0||t.ignoreIfNotExists!==void 0)&&(r.options=t),n!==void 0&&(r.annotationId=n),r}e.create=t;function n(e){let t=e;return t&&t.kind===`delete`&&W.string(t.uri)&&(t.options===void 0||(t.options.recursive===void 0||W.boolean(t.options.recursive))&&(t.options.ignoreIfNotExists===void 0||W.boolean(t.options.ignoreIfNotExists)))&&(t.annotationId===void 0||U.is(t.annotationId))}e.is=n})(Jr||={}),(function(e){function t(e){let t=e;return t&&(t.changes!==void 0||t.documentChanges!==void 0)&&(t.documentChanges===void 0||t.documentChanges.every(e=>W.string(e.kind)?Kr.is(e)||qr.is(e)||Jr.is(e):Gr.is(e)))}e.is=t})(Yr||={}),Xr=class{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,n){let r,i;if(n===void 0?r=Hr.insert(e,t):U.is(n)?(i=n,r=Wr.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Wr.insert(e,t,i)),this.edits.push(r),i!==void 0)return i}replace(e,t,n){let r,i;if(n===void 0?r=Hr.replace(e,t):U.is(n)?(i=n,r=Wr.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Wr.replace(e,t,i)),this.edits.push(r),i!==void 0)return i}delete(e,t){let n,r;if(t===void 0?n=Hr.del(e):U.is(t)?(r=t,n=Wr.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(t),n=Wr.del(e,r)),this.edits.push(n),r!==void 0)return r}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw Error(`Text edit change is not configured to manage change annotations.`)}},Zr=class{constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let n;if(U.is(e)?n=e:(n=this.nextId(),t=e),this._annotations[n]!==void 0)throw Error(`Id ${n} is already in use.`);if(t===void 0)throw Error(`No annotation provided for id ${n}`);return this._annotations[n]=t,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},Qr=class{constructor(e){this._textEditChanges=Object.create(null),e===void 0?this._workspaceEdit={}:(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Zr(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(e=>{if(Gr.is(e)){let t=new Xr(e.edits,this._changeAnnotations);this._textEditChanges[e.textDocument.uri]=t}})):e.changes&&Object.keys(e.changes).forEach(t=>{let n=new Xr(e.changes[t]);this._textEditChanges[t]=n}))}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(ti.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let t={uri:e.uri,version:e.version},n=this._textEditChanges[t.uri];if(!n){let e=[],r={textDocument:t,edits:e};this._workspaceEdit.documentChanges.push(r),n=new Xr(e,this._changeAnnotations),this._textEditChanges[t.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw Error(`Workspace edit is not configured for normal text edit changes.`);let t=this._textEditChanges[e];if(!t){let n=[];this._workspaceEdit.changes[e]=n,t=new Xr(n),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Zr,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let r;Ur.is(t)||U.is(t)?r=t:n=t;let i,a;if(r===void 0?i=Kr.create(e,n):(a=U.is(r)?r:this._changeAnnotations.manage(r),i=Kr.create(e,n,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}renameFile(e,t,n,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let i;Ur.is(n)||U.is(n)?i=n:r=n;let a,o;if(i===void 0?a=qr.create(e,t,r):(o=U.is(i)?i:this._changeAnnotations.manage(i),a=qr.create(e,t,r,o)),this._workspaceEdit.documentChanges.push(a),o!==void 0)return o}deleteFile(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw Error(`Workspace edit is not configured for document changes.`);let r;Ur.is(t)||U.is(t)?r=t:n=t;let i,a;if(r===void 0?i=Jr.create(e,n):(a=U.is(r)?r:this._changeAnnotations.manage(r),i=Jr.create(e,n,a)),this._workspaceEdit.documentChanges.push(i),a!==void 0)return a}},(function(e){function t(e){return{uri:e}}e.create=t;function n(e){let t=e;return W.defined(t)&&W.string(t.uri)}e.is=n})($r||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return W.defined(t)&&W.string(t.uri)&&W.integer(t.version)}e.is=n})(ei||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return W.defined(t)&&W.string(t.uri)&&(t.version===null||W.integer(t.version))}e.is=n})(ti||={}),(function(e){function t(e,t,n,r){return{uri:e,languageId:t,version:n,text:r}}e.create=t;function n(e){let t=e;return W.defined(t)&&W.string(t.uri)&&W.string(t.languageId)&&W.integer(t.version)&&W.string(t.text)}e.is=n})(ni||={}),(function(e){e.PlainText=`plaintext`,e.Markdown=`markdown`;function t(t){let n=t;return n===e.PlainText||n===e.Markdown}e.is=t})(ri||={}),(function(e){function t(e){let t=e;return W.objectLiteral(e)&&ri.is(t.kind)&&W.string(t.value)}e.is=t})(ii||={}),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(ai||={}),(function(e){e.PlainText=1,e.Snippet=2})(oi||={}),(function(e){e.Deprecated=1})(si||={}),(function(e){function t(e,t,n){return{newText:e,insert:t,replace:n}}e.create=t;function n(e){let t=e;return t&&W.string(t.newText)&&H.is(t.insert)&&H.is(t.replace)}e.is=n})(ci||={}),(function(e){e.asIs=1,e.adjustIndentation=2})(li||={}),(function(e){function t(e){let t=e;return t&&(W.string(t.detail)||t.detail===void 0)&&(W.string(t.description)||t.description===void 0)}e.is=t})(ui||={}),(function(e){function t(e){return{label:e}}e.create=t})(di||={}),(function(e){function t(e,t){return{items:e||[],isIncomplete:!!t}}e.create=t})(fi||={}),(function(e){function t(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,`\\$&`)}e.fromPlainText=t;function n(e){let t=e;return W.string(t)||W.objectLiteral(t)&&W.string(t.language)&&W.string(t.value)}e.is=n})(pi||={}),(function(e){function t(e){let t=e;return!!t&&W.objectLiteral(t)&&(ii.is(t.contents)||pi.is(t.contents)||W.typedArray(t.contents,pi.is))&&(e.range===void 0||H.is(e.range))}e.is=t})(mi||={}),(function(e){function t(e,t){return t?{label:e,documentation:t}:{label:e}}e.create=t})(hi||={}),(function(e){function t(e,t,...n){let r={label:e};return W.defined(t)&&(r.documentation=t),W.defined(n)?r.parameters=n:r.parameters=[],r}e.create=t})(gi||={}),(function(e){e.Text=1,e.Read=2,e.Write=3})(_i||={}),(function(e){function t(e,t){let n={range:e};return W.number(t)&&(n.kind=t),n}e.create=t})(vi||={}),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(yi||={}),(function(e){e.Deprecated=1})(bi||={}),(function(e){function t(e,t,n,r,i){let a={name:e,kind:t,location:{uri:r,range:n}};return i&&(a.containerName=i),a}e.create=t})(xi||={}),(function(e){function t(e,t,n,r){return r===void 0?{name:e,kind:t,location:{uri:n}}:{name:e,kind:t,location:{uri:n,range:r}}}e.create=t})(Si||={}),(function(e){function t(e,t,n,r,i,a){let o={name:e,detail:t,kind:n,range:r,selectionRange:i};return a!==void 0&&(o.children=a),o}e.create=t;function n(e){let t=e;return t&&W.string(t.name)&&W.number(t.kind)&&H.is(t.range)&&H.is(t.selectionRange)&&(t.detail===void 0||W.string(t.detail))&&(t.deprecated===void 0||W.boolean(t.deprecated))&&(t.children===void 0||Array.isArray(t.children))&&(t.tags===void 0||Array.isArray(t.tags))}e.is=n})(Ci||={}),(function(e){e.Empty=``,e.QuickFix=`quickfix`,e.Refactor=`refactor`,e.RefactorExtract=`refactor.extract`,e.RefactorInline=`refactor.inline`,e.RefactorRewrite=`refactor.rewrite`,e.Source=`source`,e.SourceOrganizeImports=`source.organizeImports`,e.SourceFixAll=`source.fixAll`})(wi||={}),(function(e){e.Invoked=1,e.Automatic=2})(Ti||={}),(function(e){function t(e,t,n){let r={diagnostics:e};return t!=null&&(r.only=t),n!=null&&(r.triggerKind=n),r}e.create=t;function n(e){let t=e;return W.defined(t)&&W.typedArray(t.diagnostics,Br.is)&&(t.only===void 0||W.typedArray(t.only,W.string))&&(t.triggerKind===void 0||t.triggerKind===Ti.Invoked||t.triggerKind===Ti.Automatic)}e.is=n})(Ei||={}),(function(e){function t(e,t,n){let r={title:e},i=!0;return typeof t==`string`?(i=!1,r.kind=t):Vr.is(t)?r.command=t:r.edit=t,i&&n!==void 0&&(r.kind=n),r}e.create=t;function n(e){let t=e;return t&&W.string(t.title)&&(t.diagnostics===void 0||W.typedArray(t.diagnostics,Br.is))&&(t.kind===void 0||W.string(t.kind))&&(t.edit!==void 0||t.command!==void 0)&&(t.command===void 0||Vr.is(t.command))&&(t.isPreferred===void 0||W.boolean(t.isPreferred))&&(t.edit===void 0||Yr.is(t.edit))}e.is=n})(Di||={}),(function(e){function t(e,t){let n={range:e};return W.defined(t)&&(n.data=t),n}e.create=t;function n(e){let t=e;return W.defined(t)&&H.is(t.range)&&(W.undefined(t.command)||Vr.is(t.command))}e.is=n})(Oi||={}),(function(e){function t(e,t){return{tabSize:e,insertSpaces:t}}e.create=t;function n(e){let t=e;return W.defined(t)&&W.uinteger(t.tabSize)&&W.boolean(t.insertSpaces)}e.is=n})(ki||={}),(function(e){function t(e,t,n){return{range:e,target:t,data:n}}e.create=t;function n(e){let t=e;return W.defined(t)&&H.is(t.range)&&(W.undefined(t.target)||W.string(t.target))}e.is=n})(Ai||={}),(function(e){function t(e,t){return{range:e,parent:t}}e.create=t;function n(t){let n=t;return W.objectLiteral(n)&&H.is(n.range)&&(n.parent===void 0||e.is(n.parent))}e.is=n})(ji||={}),(function(e){e.namespace=`namespace`,e.type=`type`,e.class=`class`,e.enum=`enum`,e.interface=`interface`,e.struct=`struct`,e.typeParameter=`typeParameter`,e.parameter=`parameter`,e.variable=`variable`,e.property=`property`,e.enumMember=`enumMember`,e.event=`event`,e.function=`function`,e.method=`method`,e.macro=`macro`,e.keyword=`keyword`,e.modifier=`modifier`,e.comment=`comment`,e.string=`string`,e.number=`number`,e.regexp=`regexp`,e.operator=`operator`,e.decorator=`decorator`})(Mi||={}),(function(e){e.declaration=`declaration`,e.definition=`definition`,e.readonly=`readonly`,e.static=`static`,e.deprecated=`deprecated`,e.abstract=`abstract`,e.async=`async`,e.modification=`modification`,e.documentation=`documentation`,e.defaultLibrary=`defaultLibrary`})(Ni||={}),(function(e){function t(e){let t=e;return W.objectLiteral(t)&&(t.resultId===void 0||typeof t.resultId==`string`)&&Array.isArray(t.data)&&(t.data.length===0||typeof t.data[0]==`number`)}e.is=t})(Pi||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t;function n(e){let t=e;return t!=null&&H.is(t.range)&&W.string(t.text)}e.is=n})(Fi||={}),(function(e){function t(e,t,n){return{range:e,variableName:t,caseSensitiveLookup:n}}e.create=t;function n(e){let t=e;return t!=null&&H.is(t.range)&&W.boolean(t.caseSensitiveLookup)&&(W.string(t.variableName)||t.variableName===void 0)}e.is=n})(Ii||={}),(function(e){function t(e,t){return{range:e,expression:t}}e.create=t;function n(e){let t=e;return t!=null&&H.is(t.range)&&(W.string(t.expression)||t.expression===void 0)}e.is=n})(Li||={}),(function(e){function t(e,t){return{frameId:e,stoppedLocation:t}}e.create=t;function n(e){let t=e;return W.defined(t)&&H.is(e.stoppedLocation)}e.is=n})(Ri||={}),(function(e){e.Type=1,e.Parameter=2;function t(e){return e===1||e===2}e.is=t})(zi||={}),(function(e){function t(e){return{value:e}}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&(t.tooltip===void 0||W.string(t.tooltip)||ii.is(t.tooltip))&&(t.location===void 0||kr.is(t.location))&&(t.command===void 0||Vr.is(t.command))}e.is=n})(Bi||={}),(function(e){function t(e,t,n){let r={position:e,label:t};return n!==void 0&&(r.kind=n),r}e.create=t;function n(e){let t=e;return W.objectLiteral(t)&&V.is(t.position)&&(W.string(t.label)||W.typedArray(t.label,Bi.is))&&(t.kind===void 0||zi.is(t.kind))&&t.textEdits===void 0||W.typedArray(t.textEdits,Hr.is)&&(t.tooltip===void 0||W.string(t.tooltip)||ii.is(t.tooltip))&&(t.paddingLeft===void 0||W.boolean(t.paddingLeft))&&(t.paddingRight===void 0||W.boolean(t.paddingRight))}e.is=n})(Vi||={}),(function(e){function t(e){return{kind:`snippet`,value:e}}e.createSnippet=t})(Hi||={}),(function(e){function t(e,t,n,r){return{insertText:e,filterText:t,range:n,command:r}}e.create=t})(Ui||={}),(function(e){function t(e){return{items:e}}e.create=t})(Wi||={}),(function(e){e.Invoked=0,e.Automatic=1})(Gi||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t})(Ki||={}),(function(e){function t(e,t){return{triggerKind:e,selectedCompletionInfo:t}}e.create=t})(qi||={}),(function(e){function t(e){let t=e;return W.objectLiteral(t)&&Er.is(t.uri)&&W.string(t.name)}e.is=t})(Ji||={}),Yi=[`
5
- `,`\r
6
- `,`\r`],(function(e){function t(e,t,n,r){return new Zi(e,t,n,r)}e.create=t;function n(e){let t=e;return!!(W.defined(t)&&W.string(t.uri)&&(W.undefined(t.languageId)||W.string(t.languageId))&&W.uinteger(t.lineCount)&&W.func(t.getText)&&W.func(t.positionAt)&&W.func(t.offsetAt))}e.is=n;function r(e,t){let n=e.getText(),r=i(t,(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),a=n.length;for(let t=r.length-1;t>=0;t--){let i=r[t],o=e.offsetAt(i.range.start),s=e.offsetAt(i.range.end);if(s<=a)n=n.substring(0,o)+i.newText+n.substring(s,n.length);else throw Error(`Overlapping edit`);a=o}return n}e.applyEdits=r;function i(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),a=e.slice(n);i(r,t),i(a,t);let o=0,s=0,c=0;for(;o<r.length&&s<a.length;)t(r[o],a[s])<=0?e[c++]=r[o++]:e[c++]=a[s++];for(;o<r.length;)e[c++]=r[o++];for(;s<a.length;)e[c++]=a[s++];return e}})(Xi||={}),Zi=class{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let e=[],t=this._content,n=!0;for(let r=0;r<t.length;r++){n&&=(e.push(r),!1);let i=t.charAt(r);n=i===`\r`||i===`
7
- `,i===`\r`&&r+1<t.length&&t.charAt(r+1)===`
8
- `&&r++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return V.create(0,e);for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return V.create(i,e-t[i])}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}},(function(e){let t=Object.prototype.toString;function n(e){return e!==void 0}e.defined=n;function r(e){return e===void 0}e.undefined=r;function i(e){return e===!0||e===!1}e.boolean=i;function a(e){return t.call(e)===`[object String]`}e.string=a;function o(e){return t.call(e)===`[object Number]`}e.number=o;function s(e,n,r){return t.call(e)===`[object Number]`&&n<=e&&e<=r}e.numberRange=s;function c(e){return t.call(e)===`[object Number]`&&-2147483648<=e&&e<=2147483647}e.integer=c;function l(e){return t.call(e)===`[object Number]`&&0<=e&&e<=2147483647}e.uinteger=l;function u(e){return t.call(e)===`[object Function]`}e.func=u;function d(e){return typeof e==`object`&&!!e}e.objectLiteral=d;function f(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=f})(W||={})}));Qi();var $i=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new ia(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new na;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new ta(e.startOffset,e.image.length,F(e),e.tokenType,!t);return n.grammarSource=t,n.root=this.rootNode,this.current.content.push(n),n}removeNode(e){let t=e.container;if(t){let n=t.content.indexOf(e);n>=0&&t.content.splice(n,1)}}addHiddenNodes(e){let t=[];for(let n of e){let e=new ta(n.startOffset,n.image.length,F(n),n.tokenType,!0);e.root=this.rootNode,t.push(e)}let n=this.current,r=!1;if(n.content.length>0){n.content.push(...t);return}for(;n.container;){let e=n.container.content.indexOf(n);if(e>0){n.container.content.splice(e,0,...t),r=!0;break}n=n.container}r||this.rootNode.content.unshift(...t)}construct(e){let t=this.current;typeof e.$type==`string`&&(this.current.astNode=e),e.$cstNode=t;let n=this.nodeStack.pop();n?.content.length===0&&this.removeNode(n)}},ea=class{get parent(){return this.container}get feature(){return this.grammarSource}get hidden(){return!1}get astNode(){let e=typeof this._astNode?.$type==`string`?this._astNode:this.container?.astNode;if(!e)throw Error(`This node has no associated AST element`);return e}set astNode(e){this._astNode=e}get element(){return this.astNode}get text(){return this.root.fullText.substring(this.offset,this.end)}},ta=class extends ea{get offset(){return this._offset}get length(){return this._length}get end(){return this._offset+this._length}get hidden(){return this._hidden}get tokenType(){return this._tokenType}get range(){return this._range}constructor(e,t,n,r,i=!1){super(),this._hidden=i,this._offset=e,this._tokenType=r,this._length=t,this._range=n}},na=class extends ea{constructor(){super(...arguments),this.content=new ra(this)}get children(){return this.content}get offset(){return this.firstNonHiddenNode?.offset??0}get length(){return this.end-this.offset}get end(){return this.lastNonHiddenNode?.end??0}get range(){let e=this.firstNonHiddenNode,t=this.lastNonHiddenNode;if(e&&t){if(this._rangeCache===void 0){let{range:n}=e,{range:r}=t;this._rangeCache={start:n.start,end:r.end.line<n.start.line?n.start:r.end}}return this._rangeCache}else return{start:V.create(0,0),end:V.create(0,0)}}get firstNonHiddenNode(){for(let e of this.content)if(!e.hidden)return e;return this.content[0]}get lastNonHiddenNode(){for(let e=this.content.length-1;e>=0;e--){let t=this.content[e];if(!t.hidden)return t}return this.content[this.content.length-1]}},ra=class e extends Array{constructor(t){super(),this.parent=t,Object.setPrototypeOf(this,e.prototype)}push(...e){return this.addParents(e),super.push(...e)}unshift(...e){return this.addParents(e),super.unshift(...e)}splice(e,t,...n){return this.addParents(n),super.splice(e,t,...n)}addParents(e){for(let t of e)t.container=this.parent}},ia=class extends na{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text=``,this._text=e??``}};const aa=Symbol(`Datatype`);function oa(e){return e.$type===aa}const sa=e=>e.endsWith(`​`)?e:e+`​`;var ca=class{constructor(e){this._unorderedGroups=new Map,this.allRules=new Map,this.lexer=e.parser.Lexer;let t=this.lexer.definition,n=e.LanguageMetaData.mode===`production`;this.wrapper=new ma(t,Object.assign(Object.assign({},e.parser.ParserConfig),{skipValidations:n,errorMessageProvider:e.parser.ParserErrorMessageProvider}))}alternatives(e,t){this.wrapper.wrapOr(e,t)}optional(e,t){this.wrapper.wrapOption(e,t)}many(e,t){this.wrapper.wrapMany(e,t)}atLeastOne(e,t){this.wrapper.wrapAtLeastOne(e,t)}getRule(e){return this.allRules.get(e)}isRecording(){return this.wrapper.IS_RECORDING}get unorderedGroups(){return this._unorderedGroups}getRuleStack(){return this.wrapper.RULE_STACK}finalize(){this.wrapper.wrapSelfAnalysis()}},la=class extends ca{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new $i,this.stack=[],this.assignmentMap=new Map,this.linker=e.references.Linker,this.converter=e.parser.ValueConverter,this.astReflection=e.shared.AstReflection}rule(e,t){let n=this.computeRuleType(e),r=this.wrapper.DEFINE_RULE(sa(e.name),this.startImplementation(n,t).bind(this));return this.allRules.set(e.name,r),e.entry&&(this.mainRule=r),r}computeRuleType(e){if(!e.fragment)return ir(e)?aa:cr(e)??e.name}parse(e,t={}){this.nodeBuilder.buildRootNode(e);let n=this.lexerResult=this.lexer.tokenize(e);this.wrapper.input=n.tokens;let r=t.rule?this.allRules.get(t.rule):this.mainRule;if(!r)throw Error(t.rule?`No rule found with name '${t.rule}'`:`No main rule available.`);let i=this.doParse(r);return this.nodeBuilder.addHiddenNodes(n.hidden),this.unorderedGroups.clear(),this.lexerResult=void 0,{value:i,lexerErrors:n.errors,lexerReport:n.report,parserErrors:this.wrapper.errors}}doParse(e){let t=e.call(this.wrapper,{});if(this.stack.length>0&&(t=this.construct()),t===void 0)throw Error(`No result from parser`);if(this.stack.length>0)throw Error(`Parser stack is not empty after parsing`);return t}startImplementation(e,t){return n=>{let r=!this.isRecording()&&e!==void 0;if(r){let t={$type:e};this.stack.push(t),e===aa&&(t.value=``)}return t(n),r?this.construct():void 0}}extractHiddenTokens(e){let t=this.lexerResult.hidden;if(!t.length)return[];let n=e.startOffset;for(let e=0;e<t.length;e++)if(t[e].startOffset>n)return t.splice(0,e);return t.splice(0,t.length)}consume(e,t,n){let r=this.wrapper.wrapConsume(e,t);if(!this.isRecording()&&this.isValidToken(r)){let e=this.extractHiddenTokens(r);this.nodeBuilder.addHiddenNodes(e);let t=this.nodeBuilder.buildLeafNode(r,n),{assignment:i,isCrossRef:a}=this.getAssignment(n),o=this.current;if(i){let e=Wt(n)?r.image:this.converter.convert(r.image,t);this.assign(i.operator,i.feature,e,t,a)}else if(oa(o)){let e=r.image;Wt(n)||(e=this.converter.convert(e,t).toString()),o.value+=e}}}isValidToken(e){return!e.isInsertedInRecovery&&!isNaN(e.startOffset)&&typeof e.endOffset==`number`&&!isNaN(e.endOffset)}subrule(e,t,n,r,i){let a;!this.isRecording()&&!n&&(a=this.nodeBuilder.buildCompositeNode(r));let o;try{o=this.wrapper.wrapSubrule(e,t,i)}finally{this.isRecording()||(o===void 0&&!n&&(o=this.construct()),o!==void 0&&a&&a.length>0&&this.performSubruleAssignment(o,r,a))}}performSubruleAssignment(e,t,n){let{assignment:r,isCrossRef:i}=this.getAssignment(t);if(r)this.assign(r.operator,r.feature,e,n,i);else if(!r){let t=this.current;if(oa(t))t.value+=e.toString();else if(typeof e==`object`&&e){let n=this.assignWithoutOverride(e,t);this.stack.pop(),this.stack.push(n)}}}action(e,t){if(!this.isRecording()){let n=this.current;if(t.feature&&t.operator){n=this.construct(),this.nodeBuilder.removeNode(n.$cstNode),this.nodeBuilder.buildCompositeNode(t).content.push(n.$cstNode);let r={$type:e};this.stack.push(r),this.assign(t.operator,t.feature,n,n.$cstNode,!1)}else n.$type=e}}construct(){if(this.isRecording())return;let e=this.current;return fn(e),this.nodeBuilder.construct(e),this.stack.pop(),oa(e)?this.converter.convert(e.value,e.$cstNode):(Sn(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let t=pn(e,Pt);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?Rt(t.terminal):!1})}return this.assignmentMap.get(e)}assign(e,t,n,r,i){let a=this.current,o;switch(o=i&&typeof n==`string`?this.linker.buildReference(a,t,r,n):n,e){case`=`:a[t]=o;break;case`?=`:a[t]=!0;break;case`+=`:Array.isArray(a[t])||(a[t]=[]),a[t].push(o)}}assignWithoutOverride(e,t){for(let[n,r]of Object.entries(t)){let t=e[n];t===void 0?e[n]=r:Array.isArray(t)&&Array.isArray(r)&&(r.push(...t),e[n]=r)}let n=e.$cstNode;return n&&(n.astNode=void 0,e.$cstNode=void 0),e}get definitionErrors(){return this.wrapper.definitionErrors}},ua=class{buildMismatchTokenMessage(e){return l.buildMismatchTokenMessage(e)}buildNotAllInputParsedMessage(e){return l.buildNotAllInputParsedMessage(e)}buildNoViableAltMessage(e){return l.buildNoViableAltMessage(e)}buildEarlyExitMessage(e){return l.buildEarlyExitMessage(e)}},da=class extends ua{buildMismatchTokenMessage({expected:e,actual:t}){return`Expecting ${e.LABEL?"`"+e.LABEL+"`":e.name.endsWith(`:KW`)?`keyword '${e.name.substring(0,e.name.length-3)}'`:`token of type '${e.name}'`} but found \`${t.image}\`.`}buildNotAllInputParsedMessage({firstRedundant:e}){return`Expecting end of file but found \`${e.image}\`.`}},fa=class extends ca{constructor(){super(...arguments),this.tokens=[],this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}action(){}construct(){}parse(e){return this.resetState(),this.tokens=this.lexer.tokenize(e,{mode:`partial`}).tokens,this.wrapper.input=[...this.tokens],this.mainRule.call(this.wrapper,{}),this.unorderedGroups.clear(),{tokens:this.tokens,elementStack:[...this.lastElementStack],tokenIndex:this.nextTokenIndex}}rule(e,t){let n=this.wrapper.DEFINE_RULE(sa(e.name),this.startImplementation(t).bind(this));return this.allRules.set(e.name,n),e.entry&&(this.mainRule=n),n}resetState(){this.elementStack=[],this.lastElementStack=[],this.nextTokenIndex=0,this.stackSize=0}startImplementation(e){return t=>{let n=this.keepStackSize();try{e(t)}finally{this.resetStackSize(n)}}}removeUnexpectedElements(){this.elementStack.splice(this.stackSize)}keepStackSize(){let e=this.elementStack.length;return this.stackSize=e,e}resetStackSize(e){this.removeUnexpectedElements(),this.stackSize=e}consume(e,t,n){this.wrapper.wrapConsume(e,t),this.isRecording()||(this.lastElementStack=[...this.elementStack,n],this.nextTokenIndex=this.currIdx+1)}subrule(e,t,n,r,i){this.before(r),this.wrapper.wrapSubrule(e,t,i),this.after(r)}before(e){this.isRecording()||this.elementStack.push(e)}after(e){if(!this.isRecording()){let t=this.elementStack.lastIndexOf(e);t>=0&&this.elementStack.splice(t)}}get currIdx(){return this.wrapper.currIdx}};const pa={recoveryEnabled:!0,nodeLocationTracking:`full`,skipValidations:!0,errorMessageProvider:new da};var ma=class extends p{constructor(e,t){let n=t&&`maxLookahead`in t;super(e,Object.assign(Object.assign(Object.assign({},pa),{lookaheadStrategy:n?new h({maxLookahead:t.maxLookahead}):new v({logging:t.skipValidations?()=>{}:void 0})}),t))}get IS_RECORDING(){return this.RECORDING_PHASE}DEFINE_RULE(e,t,n){return this.RULE(e,t,n)}wrapSelfAnalysis(){this.performSelfAnalysis()}wrapConsume(e,t){return this.consume(e,t,void 0)}wrapSubrule(e,t,n){return this.subrule(e,t,{ARGS:[n]})}wrapOr(e,t){this.or(e,t)}wrapOption(e,t){this.option(e,t)}wrapMany(e,t){this.many(e,t)}wrapAtLeastOne(e,t){this.atLeastOne(e,t)}};function ha(e,t,n){return ga({parser:t,tokens:n,ruleNames:new Map},e),t}function ga(e,t){let n=Bn(t,!1),r=j(t.rules).filter(R).filter(e=>n.has(e));for(let t of r){let n=Object.assign(Object.assign({},e),{consume:1,optional:1,subrule:1,many:1,or:1});e.parser.rule(t,_a(n,t.definition))}}function _a(e,t,n=!1){let r;if(Wt(t))r=Da(e,t);else if(At(t))r=va(e,t);else if(Pt(t))r=_a(e,t.terminal);else if(Rt(t))r=Ea(e,t);else if(Xt(t))r=ya(e,t);else if(Mt(t))r=Sa(e,t);else if(an(t))r=Ca(e,t);else if(Ht(t))r=wa(e,t);else if(Bt(t)){let n=e.consume++;r=()=>e.parser.consume(n,m,t)}else throw new be(t.$cstNode,`Unexpected element type: ${t.$type}`);return Oa(e,n?void 0:Ta(t),r,t.cardinality)}function va(e,t){let n=lr(t);return()=>e.parser.action(n,t)}function ya(e,t){let n=t.rule.ref;if(R(n)){let r=e.subrule++,i=n.fragment,a=t.arguments.length>0?ba(n,t.arguments):()=>({});return o=>e.parser.subrule(r,ka(e,n),i,t,a(o))}else if(St(n)){let r=e.consume++,i=ja(e,n.name);return()=>e.parser.consume(r,i,t)}else if(n)xe(n);else throw new be(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function ba(e,t){let n=t.map(e=>xa(e.value));return t=>{let r={};for(let i=0;i<n.length;i++){let a=e.parameters[i],o=n[i];r[a.name]=o(t)}return r}}function xa(e){if(qe(e)){let t=xa(e.left),n=xa(e.right);return e=>t(e)||n(e)}else if(Ge(e)){let t=xa(e.left),n=xa(e.right);return e=>t(e)&&n(e)}else if(at(e)){let t=xa(e.value);return e=>!t(e)}else if(dt(e)){let t=e.parameter.ref.name;return e=>e!==void 0&&e[t]===!0}else if(Ue(e)){let t=!!e.true;return()=>t}xe(e)}function Sa(e,t){if(t.elements.length===1)return _a(e,t.elements[0]);{let n=[];for(let r of t.elements){let t={ALT:_a(e,r,!0)},i=Ta(r);i&&(t.GATE=xa(i)),n.push(t)}let r=e.or++;return t=>e.parser.alternatives(r,n.map(e=>{let n={ALT:()=>e.ALT(t)},r=e.GATE;return r&&(n.GATE=()=>r(t)),n}))}}function Ca(e,t){if(t.elements.length===1)return _a(e,t.elements[0]);let n=[];for(let r of t.elements){let t={ALT:_a(e,r,!0)},i=Ta(r);i&&(t.GATE=xa(i)),n.push(t)}let r=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join(`-`)}`,a=t=>e.parser.alternatives(r,n.map((n,a)=>{let o={ALT:()=>!0},s=e.parser;o.ALT=()=>{if(n.ALT(t),!s.isRecording()){let e=i(r,s);s.unorderedGroups.get(e)||s.unorderedGroups.set(e,[]);let t=s.unorderedGroups.get(e);t?.[a]===void 0&&(t[a]=!0)}};let c=n.GATE;return c?o.GATE=()=>c(t):o.GATE=()=>!s.unorderedGroups.get(i(r,s))?.[a],o})),o=Oa(e,Ta(t),a,`*`);return t=>{o(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}function wa(e,t){let n=t.elements.map(t=>_a(e,t));return e=>n.forEach(t=>t(e))}function Ta(e){if(Ht(e))return e.guardCondition}function Ea(e,t,n=t.terminal){if(!n){if(!t.type.ref)throw Error(`Could not resolve reference to type: `+t.type.$refText);let n=Qn(t.type.ref)?.terminal;if(!n)throw Error(`Could not find name assignment for type: `+lr(t.type.ref));return Ea(e,t,n)}else if(Xt(n)&&R(n.rule.ref)){let r=n.rule.ref,i=e.subrule++;return n=>e.parser.subrule(i,ka(e,r),!1,t,n)}else if(Xt(n)&&St(n.rule.ref)){let r=e.consume++,i=ja(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}else if(Wt(n)){let r=e.consume++,i=ja(e,n.value);return()=>e.parser.consume(r,i,t)}else throw Error(`Could not build cross reference parser`)}function Da(e,t){let n=e.consume++,r=e.tokens[t.value];if(!r)throw Error(`Could not find token for keyword: `+t.value);return()=>e.parser.consume(n,r,t)}function Oa(e,t,n,r){let i=t&&xa(t);if(!r)if(i){let t=e.or++;return r=>e.parser.alternatives(t,[{ALT:()=>n(r),GATE:()=>i(r)},{ALT:_(),GATE:()=>!i(r)}])}else return n;if(r===`*`){let t=e.many++;return r=>e.parser.many(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}else if(r===`+`){let t=e.many++;if(i){let r=e.or++;return a=>e.parser.alternatives(r,[{ALT:()=>e.parser.atLeastOne(t,{DEF:()=>n(a)}),GATE:()=>i(a)},{ALT:_(),GATE:()=>!i(a)}])}else return r=>e.parser.atLeastOne(t,{DEF:()=>n(r)})}else if(r===`?`){let t=e.optional++;return r=>e.parser.optional(t,{DEF:()=>n(r),GATE:i?()=>i(r):void 0})}else xe(r)}function ka(e,t){let n=Aa(e,t),r=e.parser.getRule(n);if(!r)throw Error(`Rule "${n}" not found."`);return r}function Aa(e,t){if(R(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!R(r);)(Ht(r)||Mt(r)||an(r))&&(i=r.elements.indexOf(n).toString()+`:`+i),n=r,r=r.$container;return i=r.name+`:`+i,e.ruleNames.set(t,i),i}}function ja(e,t){let n=e.tokens[t];if(!n)throw Error(`Token "${t}" not found."`);return n}function Ma(e){let t=e.Grammar,n=e.parser.Lexer,r=new fa(e);return ha(t,r,n.definition),r.finalize(),r}function Na(e){let t=Pa(e);return t.finalize(),t}function Pa(e){let t=e.Grammar,n=e.parser.Lexer;return ha(t,new la(e),n.definition)}var Fa=class{constructor(){this.diagnostics=[]}buildTokens(e,t){let n=j(Bn(e,!1)),r=this.buildTerminalTokens(n),i=this.buildKeywordTokens(n,r,t);return i.push(...r),i}flushLexingReport(e){return{diagnostics:this.popDiagnostics()}}popDiagnostics(){let e=[...this.diagnostics];return this.diagnostics=[],e}buildTerminalTokens(e){return e.filter(St).filter(e=>!e.fragment).map(e=>this.buildTerminalToken(e)).toArray()}buildTerminalToken(e){let t=pr(e),n=this.requiresCustomPattern(t)?this.regexPatternFunction(t):t,r={name:e.name,PATTERN:n};return typeof n==`function`&&(r.LINE_BREAKS=!0),e.hidden&&(r.GROUP=Nn(t)?d.SKIPPED:`hidden`),r}requiresCustomPattern(e){return e.flags.includes(`u`)||e.flags.includes(`s`)?!0:!!(e.source.includes(`?<=`)||e.source.includes(`?<!`))}regexPatternFunction(e){let t=new RegExp(e,e.flags+`y`);return(e,n)=>(t.lastIndex=n,t.exec(e))}buildKeywordTokens(e,t,n){return e.filter(R).flatMap(e=>_n(e).filter(Wt)).distinct(e=>e.value).toArray().sort((e,t)=>t.value.length-e.value.length).map(e=>this.buildKeywordToken(e,t,!!n?.caseInsensitive))}buildKeywordToken(e,t,n){let r=this.buildKeywordPattern(e,n),i={name:e.value,PATTERN:r,LONGER_ALT:this.findLongerAlt(e,t)};return typeof r==`function`&&(i.LINE_BREAKS=!0),i}buildKeywordPattern(e,t){return t?new RegExp(Pn(e.value),`i`):e.value}findLongerAlt(e,t){return t.reduce((t,n)=>{let r=n?.PATTERN;return r?.source&&Fn(`^`+r.source+`$`,e.value)&&t.push(n),t},[])}},Ia=class{convert(e,t){let n=t.grammarSource;if(Rt(n)&&(n=Un(n)),Xt(n)){let r=n.rule.ref;if(!r)throw Error(`This cst node was not parsed by a rule.`);return this.runConverter(r,e,t)}return e}runConverter(e,t,n){switch(e.name.toUpperCase()){case`INT`:return La.convertInt(t);case`STRING`:return La.convertString(t);case`ID`:return La.convertID(t)}switch(fr(e)?.toLowerCase()){case`number`:return La.convertNumber(t);case`boolean`:return La.convertBoolean(t);case`bigint`:return La.convertBigint(t);case`date`:return La.convertDate(t);default:return t}}},La;(function(e){function t(e){let t=``;for(let r=1;r<e.length-1;r++){let i=e.charAt(r);if(i===`\\`){let i=e.charAt(++r);t+=n(i)}else t+=i}return t}e.convertString=t;function n(e){switch(e){case`b`:return`\b`;case`f`:return`\f`;case`n`:return`
9
- `;case`r`:return`\r`;case`t`:return` `;case`v`:return`\v`;case`0`:return`\0`;default:return e}}function r(e){return e.charAt(0)===`^`?e.substring(1):e}e.convertID=r;function i(e){return parseInt(e)}e.convertInt=i;function a(e){return BigInt(e)}e.convertBigint=a;function o(e){return new Date(e)}e.convertDate=o;function s(e){return Number(e)}e.convertNumber=s;function c(e){return e.toLowerCase()===`true`}e.convertBoolean=c})(La||={});var Ra=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t;function n(){if(t===void 0)throw Error(`No runtime abstraction layer installed`);return t}(function(e){function n(e){if(e===void 0)throw Error(`No runtime abstraction layer provided`);t=e}e.install=n})(n||={}),e.default=n})),za=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s})),Ba=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Emitter=e.Event=void 0;let t=Ra();var n;(function(e){let t={dispose(){}};e.None=function(){return t}})(n||(e.Event=n={}));var r=class{add(e,t=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(e),this._contexts.push(t),Array.isArray(n)&&n.push({dispose:()=>this.remove(e,t)})}remove(e,t=null){if(!this._callbacks)return;let n=!1;for(let r=0,i=this._callbacks.length;r<i;r++)if(this._callbacks[r]===e)if(this._contexts[r]===t){this._callbacks.splice(r,1),this._contexts.splice(r,1);return}else n=!0;if(n)throw Error(`When adding a listener with a context, you should remove it with the same context`)}invoke(...e){if(!this._callbacks)return[];let n=[],r=this._callbacks.slice(0),i=this._contexts.slice(0);for(let a=0,o=r.length;a<o;a++)try{n.push(r[a].apply(i[a],e))}catch(e){(0,t.default)().console.error(e)}return n}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},i=class e{constructor(e){this._options=e}get event(){return this._event||=(t,n,i)=>{this._callbacks||=new r,this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,n);let a={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,n),a.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(i)&&i.push(a),a},this._event}fire(e){this._callbacks&&this._callbacks.invoke.call(this._callbacks,e)}dispose(){this._callbacks&&=(this._callbacks.dispose(),void 0)}};e.Emitter=i,i._noop=function(){}})),Va=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;let t=Ra(),n=za(),r=Ba();var i;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:r.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:r.Event.None});function t(t){let r=t;return r&&(r===e.None||r===e.Cancelled||n.boolean(r.isCancellationRequested)&&!!r.onCancellationRequested)}e.is=t})(i||(e.CancellationToken=i={}));let a=Object.freeze(function(e,n){let r=(0,t.default)().timer.setTimeout(e.bind(n),0);return{dispose(){r.dispose()}}});var o=class{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||=new r.Emitter,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),void 0)}},s=class{get token(){return this._token||=new o,this._token}cancel(){this._token?this._token.cancel():this._token=i.Cancelled}dispose(){this._token?this._token instanceof o&&this._token.dispose():this._token=i.None}};e.CancellationTokenSource=s})),G=i({});t(G,a(Va(),1));function Ha(){return new Promise(e=>{typeof setImmediate>`u`?setTimeout(e,0):setImmediate(e)})}let Ua=0,Wa=10;function Ga(){return Ua=performance.now(),new G.CancellationTokenSource}function Ka(e){Wa=e}const qa=Symbol(`OperationCancelled`);function Ja(e){return e===qa}async function K(e){if(e===G.CancellationToken.None)return;let t=performance.now();if(t-Ua>=Wa&&(Ua=t,await Ha(),Ua=performance.now()),e.isCancellationRequested)throw qa}var Ya=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)})}},Xa=class e{constructor(e,t,n,r){this._uri=e,this._languageId=t,this._version=n,this._content=r,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content}update(t,n){for(let n of t)if(e.isIncremental(n)){let e=eo(n.range),t=this.offsetAt(e.start),r=this.offsetAt(e.end);this._content=this._content.substring(0,t)+n.text+this._content.substring(r,this._content.length);let i=Math.max(e.start.line,0),a=Math.max(e.end.line,0),o=this._lineOffsets,s=$a(n.text,!1,t);if(a-i===s.length)for(let e=0,t=s.length;e<t;e++)o[e+i+1]=s[e];else s.length<1e4?o.splice(i+1,a-i,...s):this._lineOffsets=o=o.slice(0,i+1).concat(s,o.slice(a+1));let c=n.text.length-(r-t);if(c!==0)for(let e=i+1+s.length,t=o.length;e<t;e++)o[e]=o[e]+c}else if(e.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw Error(`Unknown change event received`);this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=$a(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let t=this.getLineOffsets(),n=0,r=t.length;if(r===0)return{line:0,character:e};for(;n<r;){let i=Math.floor((n+r)/2);t[i]>e?r=i:n=i+1}let i=n-1;return{line:i,character:e-t[i]}}offsetAt(e){let t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;let n=t[e.line],r=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,r),n)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength==`number`)}static isFull(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range===void 0&&t.rangeLength===void 0}},Za;(function(e){function t(e,t,n,r){return new Xa(e,t,n,r)}e.create=t;function n(e,t,n){if(e instanceof Xa)return e.update(t,n),e;throw Error(`TextDocument.update: document must be created by TextDocument.create`)}e.update=n;function r(e,t){let n=e.getText(),r=Qa(t.map(to),(e,t)=>{let n=e.range.start.line-t.range.start.line;return n===0?e.range.start.character-t.range.start.character:n}),i=0,a=[];for(let t of r){let r=e.offsetAt(t.range.start);if(r<i)throw Error(`Overlapping edit`);r>i&&a.push(n.substring(i,r)),t.newText.length&&a.push(t.newText),i=e.offsetAt(t.range.end)}return a.push(n.substr(i)),a.join(``)}e.applyEdits=r})(Za||={});function Qa(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);Qa(r,t),Qa(i,t);let a=0,o=0,s=0;for(;a<r.length&&o<i.length;)t(r[a],i[o])<=0?e[s++]=r[a++]:e[s++]=i[o++];for(;a<r.length;)e[s++]=r[a++];for(;o<i.length;)e[s++]=i[o++];return e}function $a(e,t,n=0){let r=t?[n]:[];for(let t=0;t<e.length;t++){let i=e.charCodeAt(t);(i===13||i===10)&&(i===13&&t+1<e.length&&e.charCodeAt(t+1)===10&&t++,r.push(n+t+1))}return r}function eo(e){let t=e.start,n=e.end;return t.line>n.line||t.line===n.line&&t.character>n.character?{start:n,end:t}:e}function to(e){let t=eo(e.range);return t===e.range?e:{newText:e.newText,range:t}}var no;(()=>{var e={975:e=>{function t(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function n(e,t){for(var n,r=``,i=0,a=-1,o=0,s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===47)break;n=47}if(n===47){if(!(a===s-1||o===1))if(a!==s-1&&o===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var c=r.lastIndexOf(`/`);if(c!==r.length-1){c===-1?(r=``,i=0):i=(r=r.slice(0,c)).length-1-r.lastIndexOf(`/`),a=s,o=0;continue}}else if(r.length===2||r.length===1){r=``,i=0,a=s,o=0;continue}}t&&(r.length>0?r+=`/..`:r=`..`,i=2)}else r.length>0?r+=`/`+e.slice(a+1,s):r=e.slice(a+1,s),i=s-a-1;a=s,o=0}else n===46&&o!==-1?++o:o=-1}return r}var r={resolve:function(){for(var e,r=``,i=!1,a=arguments.length-1;a>=-1&&!i;a--){var o;a>=0?o=arguments[a]:(e===void 0&&(e=process.cwd()),o=e),t(o),o.length!==0&&(r=o+`/`+r,i=o.charCodeAt(0)===47)}return r=n(r,!i),i?r.length>0?`/`+r:`/`:r.length>0?r:`.`},normalize:function(e){if(t(e),e.length===0)return`.`;var r=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return(e=n(e,!r)).length!==0||r||(e=`.`),e.length>0&&i&&(e+=`/`),r?`/`+e:e},isAbsolute:function(e){return t(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,n=0;n<arguments.length;++n){var i=arguments[n];t(i),i.length>0&&(e===void 0?e=i:e+=`/`+i)}return e===void 0?`.`:r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n||(e=r.resolve(e))===(n=r.resolve(n)))return``;for(var i=1;i<e.length&&e.charCodeAt(i)===47;++i);for(var a=e.length,o=a-i,s=1;s<n.length&&n.charCodeAt(s)===47;++s);for(var c=n.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(n.charCodeAt(s+d)===47)return n.slice(s+d+1);if(d===0)return n.slice(s+d)}else o>l&&(e.charCodeAt(i+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(i+d);if(f!==n.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=i+u+1;d<=a;++d)d!==a&&e.charCodeAt(d)!==47||(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+n.slice(s+u):(s+=u,n.charCodeAt(s)===47&&++s,n.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(t(e),e.length===0)return`.`;for(var n=e.charCodeAt(0),r=n===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if((n=e.charCodeAt(o))===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,n){if(n!==void 0&&typeof n!=`string`)throw TypeError(`"ext" argument must be a string`);t(e);var r,i=0,a=-1,o=!0;if(n!==void 0&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return``;var s=n.length-1,c=-1;for(r=e.length-1;r>=0;--r){var l=e.charCodeAt(r);if(l===47){if(!o){i=r+1;break}}else c===-1&&(o=!1,c=r+1),s>=0&&(l===n.charCodeAt(s)?--s==-1&&(a=r):(s=-1,a=c))}return i===a?a=c:a===-1&&(a=e.length),e.slice(i,a)}for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===47){if(!o){i=r+1;break}}else a===-1&&(o=!1,a=r+1);return a===-1?``:e.slice(i,a)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c!==47)i===-1&&(a=!1,i=s+1),c===46?n===-1?n=s:o!==1&&(o=1):n!==-1&&(o=-1);else if(!a){r=s+1;break}}return n===-1||i===-1||o===0||o===1&&n===i-1&&n===r+1?``:e.slice(n,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+`/`+r:r}(0,e)},parse:function(e){t(e);var n={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return n;var r,i=e.charCodeAt(0),a=i===47;a?(n.root=`/`,r=1):r=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=r;--u)if((i=e.charCodeAt(u))!==47)c===-1&&(l=!1,c=u+1),i===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1);else if(!l){s=u+1;break}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(n.base=n.name=s===0&&a?e.slice(1,c):e.slice(s,c)):(s===0&&a?(n.name=e.slice(1,o),n.base=e.slice(1,c)):(n.name=e.slice(s,o),n.base=e.slice(s,c)),n.ext=e.slice(o,c)),s>0?n.dir=e.slice(0,s-1):a&&(n.dir=`/`),n},sep:`/`,delimiter:`:`,win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,`__esModule`,{value:!0})};var r={};let i;n.r(r),n.d(r,{URI:()=>u,Utils:()=>C}),typeof process==`object`?i=process.platform===`win32`:typeof navigator==`object`&&(i=navigator.userAgent.indexOf(`Windows`)>=0);let a=/^\w[\w\d+.-]*$/,o=/^\//,s=/^\/\//;function c(e,t){if(!e.scheme&&t)throw Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${e.authority}", path: "${e.path}", query: "${e.query}", fragment: "${e.fragment}"}`);if(e.scheme&&!a.test(e.scheme))throw Error(`[UriError]: Scheme contains illegal characters.`);if(e.path){if(e.authority){if(!o.test(e.path))throw Error(`[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character`)}else if(s.test(e.path))throw Error(`[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")`)}}let l=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class u{static isUri(e){return e instanceof u||!!e&&typeof e.authority==`string`&&typeof e.fragment==`string`&&typeof e.path==`string`&&typeof e.query==`string`&&typeof e.scheme==`string`&&typeof e.fsPath==`string`&&typeof e.with==`function`&&typeof e.toString==`function`}scheme;authority;path;query;fragment;constructor(e,t,n,r,i,a=!1){typeof e==`object`?(this.scheme=e.scheme||``,this.authority=e.authority||``,this.path=e.path||``,this.query=e.query||``,this.fragment=e.fragment||``):(this.scheme=function(e,t){return e||t?e:`file`}(e,a),this.authority=t||``,this.path=function(e,t){switch(e){case`https`:case`http`:case`file`:t?t[0]!==`/`&&(t=`/`+t):t=`/`}return t}(this.scheme,n||``),this.query=r||``,this.fragment=i||``,c(this,a))}get fsPath(){return g(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:n,path:r,query:i,fragment:a}=e;return t===void 0?t=this.scheme:t===null&&(t=``),n===void 0?n=this.authority:n===null&&(n=``),r===void 0?r=this.path:r===null&&(r=``),i===void 0?i=this.query:i===null&&(i=``),a===void 0?a=this.fragment:a===null&&(a=``),t===this.scheme&&n===this.authority&&r===this.path&&i===this.query&&a===this.fragment?this:new f(t,n,r,i,a)}static parse(e,t=!1){let n=l.exec(e);return n?new f(n[2]||``,b(n[4]||``),b(n[5]||``),b(n[7]||``),b(n[9]||``),t):new f(``,``,``,``,``)}static file(e){let t=``;if(i&&(e=e.replace(/\\/g,`/`)),e[0]===`/`&&e[1]===`/`){let n=e.indexOf(`/`,2);n===-1?(t=e.substring(2),e=`/`):(t=e.substring(2,n),e=e.substring(n)||`/`)}return new f(`file`,t,e,``,``)}static from(e){let t=new f(e.scheme,e.authority,e.path,e.query,e.fragment);return c(t,!0),t}toString(e=!1){return _(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof u)return e;{let t=new f(e);return t._formatted=e.external,t._fsPath=e._sep===d?e.fsPath:null,t}}return e}}let d=i?1:void 0;class f extends u{_formatted=null;_fsPath=null;get fsPath(){return this._fsPath||=g(this,!1),this._fsPath}toString(e=!1){return e?_(this,!0):(this._formatted||=_(this,!1),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=d),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}}let p={58:`%3A`,47:`%2F`,63:`%3F`,35:`%23`,91:`%5B`,93:`%5D`,64:`%40`,33:`%21`,36:`%24`,38:`%26`,39:`%27`,40:`%28`,41:`%29`,42:`%2A`,43:`%2B`,44:`%2C`,59:`%3B`,61:`%3D`,32:`%20`};function m(e,t,n){let r,i=-1;for(let a=0;a<e.length;a++){let o=e.charCodeAt(a);if(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o===45||o===46||o===95||o===126||t&&o===47||n&&o===91||n&&o===93||n&&o===58)i!==-1&&(r+=encodeURIComponent(e.substring(i,a)),i=-1),r!==void 0&&(r+=e.charAt(a));else{r===void 0&&(r=e.substr(0,a));let t=p[o];t===void 0?i===-1&&(i=a):(i!==-1&&(r+=encodeURIComponent(e.substring(i,a)),i=-1),r+=t)}}return i!==-1&&(r+=encodeURIComponent(e.substring(i))),r===void 0?e:r}function h(e){let t;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r===35||r===63?(t===void 0&&(t=e.substr(0,n)),t+=p[r]):t!==void 0&&(t+=e[n])}return t===void 0?e:t}function g(e,t){let n;return n=e.authority&&e.path.length>1&&e.scheme===`file`?`//${e.authority}${e.path}`:e.path.charCodeAt(0)===47&&(e.path.charCodeAt(1)>=65&&e.path.charCodeAt(1)<=90||e.path.charCodeAt(1)>=97&&e.path.charCodeAt(1)<=122)&&e.path.charCodeAt(2)===58?t?e.path.substr(1):e.path[1].toLowerCase()+e.path.substr(2):e.path,i&&(n=n.replace(/\//g,`\\`)),n}function _(e,t){let n=t?h:m,r=``,{scheme:i,authority:a,path:o,query:s,fragment:c}=e;if(i&&(r+=i,r+=`:`),(a||i===`file`)&&(r+=`/`,r+=`/`),a){let e=a.indexOf(`@`);if(e!==-1){let t=a.substr(0,e);a=a.substr(e+1),e=t.lastIndexOf(`:`),e===-1?r+=n(t,!1,!1):(r+=n(t.substr(0,e),!1,!1),r+=`:`,r+=n(t.substr(e+1),!1,!0)),r+=`@`}a=a.toLowerCase(),e=a.lastIndexOf(`:`),e===-1?r+=n(a,!1,!0):(r+=n(a.substr(0,e),!1,!0),r+=a.substr(e))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){let e=o.charCodeAt(1);e>=65&&e<=90&&(o=`/${String.fromCharCode(e+32)}:${o.substr(3)}`)}else if(o.length>=2&&o.charCodeAt(1)===58){let e=o.charCodeAt(0);e>=65&&e<=90&&(o=`${String.fromCharCode(e+32)}:${o.substr(2)}`)}r+=n(o,!0,!1)}return s&&(r+=`?`,r+=n(s,!1,!1)),c&&(r+=`#`,r+=t?c:m(c,!1,!1)),r}function v(e){try{return decodeURIComponent(e)}catch{return e.length>3?e.substr(0,3)+v(e.substr(3)):e}}let y=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function b(e){return e.match(y)?e.replace(y,(e=>v(e))):e}var x=n(975);let S=x.posix||x;var C;(function(e){e.joinPath=function(e,...t){return e.with({path:S.join(e.path,...t)})},e.resolvePath=function(e,...t){let n=e.path,r=!1;n[0]!==`/`&&(n=`/`+n,r=!0);let i=S.resolve(n,...t);return r&&i[0]===`/`&&!e.authority&&(i=i.substring(1)),e.with({path:i})},e.dirname=function(e){if(e.path.length===0||e.path===`/`)return e;let t=S.dirname(e.path);return t.length===1&&t.charCodeAt(0)===46&&(t=``),e.with({path:t})},e.basename=function(e){return S.basename(e.path)},e.extname=function(e){return S.extname(e.path)}})(C||={}),no=r})();const{URI:q,Utils:ro}=no;var J;(function(e){e.basename=ro.basename,e.dirname=ro.dirname,e.extname=ro.extname,e.joinPath=ro.joinPath,e.resolvePath=ro.resolvePath;let t=typeof process==`object`&&(process==null?void 0:process.platform)===`win32`;function n(e,t){return e?.toString()===t?.toString()}e.equals=n;function r(e,n){let r=typeof e==`string`?q.parse(e).path:e.path,i=typeof n==`string`?q.parse(n).path:n.path,a=r.split(`/`).filter(e=>e.length>0),o=i.split(`/`).filter(e=>e.length>0);if(t){let e=/^[A-Z]:$/;if(a[0]&&e.test(a[0])&&(a[0]=a[0].toLowerCase()),o[0]&&e.test(o[0])&&(o[0]=o[0].toLowerCase()),a[0]!==o[0])return i.substring(1)}let s=0;for(;s<a.length&&a[s]===o[s];s++);return`../`.repeat(a.length-s)+o.slice(s).join(`/`)}e.relative=r;function i(e){return q.parse(e.toString()).toString()}e.normalize=i})(J||={});var Y;(function(e){e[e.Changed=0]=`Changed`,e[e.Parsed=1]=`Parsed`,e[e.IndexedContent=2]=`IndexedContent`,e[e.ComputedScopes=3]=`ComputedScopes`,e[e.Linked=4]=`Linked`,e[e.IndexedReferences=5]=`IndexedReferences`,e[e.Validated=6]=`Validated`})(Y||={});var io=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=G.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t??=q.parse(e.uri),G.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromString(e,t,n){return G.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromModel(e,t){return this.create(t,{$model:e})}create(e,t,n){if(typeof t==`string`){let r=this.parse(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}else if(`$model`in t){let n={value:t.$model,parserErrors:[],lexerErrors:[]};return this.createLangiumDocument(n,e)}else{let r=this.parse(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}async createAsync(e,t,n){if(typeof t==`string`){let r=await this.parseAsync(e,t,n);return this.createLangiumDocument(r,e,void 0,t)}else{let r=await this.parseAsync(e,t.getText(),n);return this.createLangiumDocument(r,e,t)}}createLangiumDocument(e,t,n,r){let i;if(n)i={parseResult:e,uri:t,state:Y.Parsed,references:[],textDocument:n};else{let n=this.createTextDocumentGetter(t,r);i={parseResult:e,uri:t,state:Y.Parsed,references:[],get textDocument(){return n()}}}return e.value.$document=i,i}async update(e,t){let n=e.parseResult.value.$cstNode?.root.fullText,r=this.textDocuments?.get(e.uri.toString()),i=r?r.getText():await this.fileSystemProvider.readFile(e.uri);if(r)Object.defineProperty(e,`textDocument`,{value:r});else{let t=this.createTextDocumentGetter(e.uri,i);Object.defineProperty(e,`textDocument`,{get:t})}return n!==i&&(e.parseResult=await this.parseAsync(e.uri,i,t),e.parseResult.value.$document=e),e.state=Y.Parsed,e}parse(e,t,n){return this.serviceRegistry.getServices(e).parser.LangiumParser.parse(t,n)}parseAsync(e,t,n){return this.serviceRegistry.getServices(e).parser.AsyncParser.parse(t,n)}createTextDocumentGetter(e,t){let n=this.serviceRegistry,r;return()=>r??=Za.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,t??``)}},ao=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return j(this.documentMap.values())}addDocument(e){let t=e.uri.toString();if(this.documentMap.has(t))throw Error(`A document with the URI '${t}' is already present.`);this.documentMap.set(t,e)}getDocument(e){let t=e.toString();return this.documentMap.get(t)}async getOrCreateDocument(e,t){let n=this.getDocument(e);return n||(n=await this.langiumDocumentFactory.fromUri(e,t),this.addDocument(n),n)}createDocument(e,t,n){if(n)return this.langiumDocumentFactory.fromString(t,e,n).then(e=>(this.addDocument(e),e));{let n=this.langiumDocumentFactory.fromString(t,e);return this.addDocument(n),n}}hasDocument(e){return this.documentMap.has(e.toString())}invalidateDocument(e){let t=e.toString(),n=this.documentMap.get(t);return n&&(this.serviceRegistry.getServices(e).references.Linker.unlink(n),n.state=Y.Changed,n.precomputedScopes=void 0,n.diagnostics=void 0),n}deleteDocument(e){let t=e.toString(),n=this.documentMap.get(t);return n&&(n.state=Y.Changed,this.documentMap.delete(t)),n}};const oo=Symbol(`ref_resolving`);var so=class{constructor(e){this.reflection=e.shared.AstReflection,this.langiumDocuments=()=>e.shared.workspace.LangiumDocuments,this.scopeProvider=e.references.ScopeProvider,this.astNodeLocator=e.workspace.AstNodeLocator}async link(e,t=G.CancellationToken.None){for(let n of vn(e.parseResult.value))await K(t),bn(n).forEach(t=>this.doLink(t,e))}doLink(e,t){let n=e.reference;if(n._ref===void 0){n._ref=oo;try{let t=this.getCandidate(e);C(t)?n._ref=t:(n._nodeDescription=t,this.langiumDocuments().hasDocument(t.documentUri)?n._ref=this.loadAstNode(t)??this.createLinkingError(e,t):n._ref=void 0)}catch(t){console.error(`An error occurred while resolving reference to '${n.$refText}':`,t);let r=t.message??String(t);n._ref=Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${n.$refText}': ${r}`})}t.references.push(n)}}unlink(e){for(let t of e.references)delete t._ref,delete t._nodeDescription;e.references=[]}getCandidate(e){return this.scopeProvider.getScope(e).getElement(e.reference.$refText)??this.createLinkingError(e)}buildReference(e,t,n,r){let i=this,a={$refNode:n,$refText:r,get ref(){if(b(this._ref))return this._ref;if(S(this._nodeDescription))this._ref=i.loadAstNode(this._nodeDescription)??i.createLinkingError({reference:a,container:e,property:t},this._nodeDescription);else if(this._ref===void 0){this._ref=oo;let n=hn(e).$document,r=i.getLinkedNode({reference:a,container:e,property:t});if(r.error&&n&&n.state<Y.ComputedScopes){this._ref=void 0;return}this._ref=r.node??r.error,this._nodeDescription=r.descr,n?.references.push(this)}else if(this._ref===oo)throw Error(`Cyclic reference resolution detected: ${i.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`);return b(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return C(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{let t=this.getCandidate(e);if(C(t))return{error:t};let n=this.loadAstNode(t);return n?{node:n,descr:t}:{descr:t,error:this.createLinkingError(e,t)}}catch(t){console.error(`An error occurred while resolving reference to '${e.reference.$refText}':`,t);let n=t.message??String(t);return{error:Object.assign(Object.assign({},e),{message:`An error occurred while resolving reference to '${e.reference.$refText}': ${n}`})}}}loadAstNode(e){if(e.node)return e.node;let t=this.langiumDocuments().getDocument(e.documentUri);if(t)return this.astNodeLocator.getAstNode(t.parseResult.value,e.path)}createLinkingError(e,t){let n=hn(e.container).$document;n&&n.state<Y.ComputedScopes&&console.warn(`Attempted reference resolution before document reached ComputedScopes state (${n.uri}).`);let r=this.reflection.getReferenceType(e);return Object.assign(Object.assign({},e),{message:`Could not resolve reference to ${r} named '${e.reference.$refText}'.`,targetDescription:t})}};function co(e){return typeof e.name==`string`}var lo=class{getName(e){if(co(e))return e.name}getNameNode(e){return Kn(e.$cstNode,`name`)}},uo=class{constructor(e){this.nameProvider=e.references.NameProvider,this.index=e.shared.workspace.IndexManager,this.nodeLocator=e.workspace.AstNodeLocator}findDeclaration(e){if(e){let t=Zn(e),n=e.astNode;if(t&&n){let r=n[t.feature];if(x(r))return r.ref;if(Array.isArray(r)){for(let t of r)if(x(t)&&t.$refNode&&t.$refNode.offset<=e.offset&&t.$refNode.end>=e.end)return t.ref}}if(n){let t=this.nameProvider.getNameNode(n);if(t&&(t===e||P(e,t)))return n}}}findDeclarationNode(e){let t=this.findDeclaration(e);if(t?.$cstNode)return this.nameProvider.getNameNode(t)??t.$cstNode}findReferences(e,t){let n=[];if(t.includeDeclaration){let t=this.getReferenceToSelf(e);t&&n.push(t)}let r=this.index.findAllReferences(e,this.nodeLocator.getAstNodePath(e));return t.documentUri&&(r=r.filter(e=>J.equals(e.sourceUri,t.documentUri))),n.push(...r),j(n)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=B(e),r=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:r,targetUri:n.uri,targetPath:r,segment:I(t),local:!0}}}},fo=class{constructor(e){if(this.map=new Map,e)for(let[t,n]of e)this.add(t,n)}get size(){return M.sum(j(this.map.values()).map(e=>e.length))}clear(){this.map.clear()}delete(e,t){if(t===void 0)return this.map.delete(e);{let n=this.map.get(e);if(n){let r=n.indexOf(t);if(r>=0)return n.length===1?this.map.delete(e):n.splice(r,1),!0}return!1}}get(e){return this.map.get(e)??[]}has(e,t){if(t===void 0)return this.map.has(e);{let n=this.map.get(e);return n?n.indexOf(t)>=0:!1}}add(e,t){return this.map.has(e)?this.map.get(e).push(t):this.map.set(e,[t]),this}addAll(e,t){return this.map.has(e)?this.map.get(e).push(...t):this.map.set(e,Array.from(t)),this}forEach(e){this.map.forEach((t,n)=>t.forEach(t=>e(t,n,this)))}[Symbol.iterator](){return this.entries().iterator()}entries(){return j(this.map.entries()).flatMap(([e,t])=>t.map(t=>[e,t]))}keys(){return j(this.map.keys())}values(){return j(this.map.values()).flat()}entriesGroupedByKey(){return j(this.map.entries())}},po=class{get size(){return this.map.size}constructor(e){if(this.map=new Map,this.inverse=new Map,e)for(let[t,n]of e)this.set(t,n)}clear(){this.map.clear(),this.inverse.clear()}set(e,t){return this.map.set(e,t),this.inverse.set(t,e),this}get(e){return this.map.get(e)}getKey(e){return this.inverse.get(e)}delete(e){let t=this.map.get(e);return t===void 0?!1:(this.map.delete(e),this.inverse.delete(t),!0)}},mo=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=G.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=gn,r=G.CancellationToken.None){let i=[];this.exportNode(e,i,t);for(let a of n(e))await K(r),this.exportNode(a,i,t);return i}exportNode(e,t,n){let r=this.nameProvider.getName(e);r&&t.push(this.descriptions.createDescription(e,r,n))}async computeLocalScopes(e,t=G.CancellationToken.None){let n=e.parseResult.value,r=new fo;for(let i of _n(n))await K(t),this.processNode(i,e,r);return r}processNode(e,t,n){let r=e.$container;if(r){let i=this.nameProvider.getName(e);i&&n.add(r,this.descriptions.createDescription(e,i,t))}}},ho=class{constructor(e,t,n){this.elements=e,this.outerScope=t,this.caseInsensitive=n?.caseInsensitive??!1}getAllElements(){return this.outerScope?this.elements.concat(this.outerScope.getAllElements()):this.elements}getElement(e){let t=this.caseInsensitive?this.elements.find(t=>t.name.toLowerCase()===e.toLowerCase()):this.elements.find(t=>t.name===e);if(t)return t;if(this.outerScope)return this.outerScope.getElement(e)}},go=class{constructor(e,t,n){this.elements=new Map,this.caseInsensitive=n?.caseInsensitive??!1;for(let t of e){let e=this.caseInsensitive?t.name.toLowerCase():t.name;this.elements.set(e,t)}this.outerScope=t}getElement(e){let t=this.caseInsensitive?e.toLowerCase():e,n=this.elements.get(t);if(n)return n;if(this.outerScope)return this.outerScope.getElement(e)}getAllElements(){let e=j(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}};const _o={getElement(){},getAllElements(){return k}};var vo=class{constructor(){this.toDispose=[],this.isDisposed=!1}onDispose(e){this.toDispose.push(e)}dispose(){this.throwIfDisposed(),this.clear(),this.isDisposed=!0,this.toDispose.forEach(e=>e.dispose())}throwIfDisposed(){if(this.isDisposed)throw Error(`This cache has already been disposed`)}},yo=class extends vo{constructor(){super(...arguments),this.cache=new Map}has(e){return this.throwIfDisposed(),this.cache.has(e)}set(e,t){this.throwIfDisposed(),this.cache.set(e,t)}get(e,t){if(this.throwIfDisposed(),this.cache.has(e))return this.cache.get(e);if(t){let n=t();return this.cache.set(e,n),n}else return}delete(e){return this.throwIfDisposed(),this.cache.delete(e)}clear(){this.throwIfDisposed(),this.cache.clear()}},bo=class extends vo{constructor(e){super(),this.cache=new Map,this.converter=e??(e=>e)}has(e,t){return this.throwIfDisposed(),this.cacheForContext(e).has(t)}set(e,t,n){this.throwIfDisposed(),this.cacheForContext(e).set(t,n)}get(e,t,n){this.throwIfDisposed();let r=this.cacheForContext(e);if(r.has(t))return r.get(t);if(n){let e=n();return r.set(t,e),e}else return}delete(e,t){return this.throwIfDisposed(),this.cacheForContext(e).delete(t)}clear(e){if(this.throwIfDisposed(),e){let t=this.converter(e);this.cache.delete(t)}else this.cache.clear()}cacheForContext(e){let t=this.converter(e),n=this.cache.get(t);return n||(n=new Map,this.cache.set(t,n)),n}},xo=class extends bo{constructor(e,t){super(e=>e.toString()),t?(this.toDispose.push(e.workspace.DocumentBuilder.onDocumentPhase(t,e=>{this.clear(e.uri.toString())})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((e,t)=>{for(let e of t)this.clear(e)}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((e,t)=>{let n=e.concat(t);for(let e of n)this.clear(e)}))}},So=class extends yo{constructor(e,t){super(),t?(this.toDispose.push(e.workspace.DocumentBuilder.onBuildPhase(t,()=>{this.clear()})),this.toDispose.push(e.workspace.DocumentBuilder.onUpdate((e,t)=>{t.length>0&&this.clear()}))):this.toDispose.push(e.workspace.DocumentBuilder.onUpdate(()=>{this.clear()}))}},Co=class{constructor(e){this.reflection=e.shared.AstReflection,this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider,this.indexManager=e.shared.workspace.IndexManager,this.globalScopeCache=new So(e.shared)}getScope(e){let t=[],n=this.reflection.getReferenceType(e),r=B(e.container).precomputedScopes;if(r){let i=e.container;do{let e=r.get(i);e.length>0&&t.push(j(e).filter(e=>this.reflection.isSubtype(e.type,n))),i=i.$container}while(i)}let i=this.getGlobalScope(n,e);for(let e=t.length-1;e>=0;e--)i=this.createScope(t[e],i);return i}createScope(e,t,n){return new ho(j(e),t,n)}createScopeForNodes(e,t,n){return new ho(j(e).map(e=>{let t=this.nameProvider.getName(e);if(t)return this.descriptions.createDescription(e,t)}).nonNullable(),t,n)}getGlobalScope(e,t){return this.globalScopeCache.get(e,()=>new go(this.indexManager.allElements(e)))}};function wo(e){return typeof e.$comment==`string`}function To(e){return typeof e==`object`&&!!e&&(`$ref`in e||`$error`in e)}var Eo=class{constructor(e){this.ignoreProperties=new Set([`$container`,`$containerProperty`,`$containerIndex`,`$document`,`$cstNode`]),this.langiumDocuments=e.shared.workspace.LangiumDocuments,this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider,this.commentProvider=e.documentation.CommentProvider}serialize(e,t){let n=t??{},r=t?.replacer,i=(e,t)=>this.replacer(e,t,n),a=r?(e,t)=>r(e,t,i):i;try{return this.currentDocument=B(e),JSON.stringify(e,a,t?.space)}finally{this.currentDocument=void 0}}deserialize(e,t){let n=t??{},r=JSON.parse(e);return this.linkNode(r,r,n),r}replacer(e,t,{refText:n,sourceText:r,textRegions:i,comments:a,uriConverter:o}){if(!this.ignoreProperties.has(e))if(x(t)){let e=t.ref,r=n?t.$refText:void 0;if(e){let n=B(e),i=``;this.currentDocument&&this.currentDocument!==n&&(i=o?o(n.uri,t):n.uri.toString());let a=this.astNodeLocator.getAstNodePath(e);return{$ref:`${i}#${a}`,$refText:r}}else return{$error:t.error?.message??`Could not resolve reference`,$refText:r}}else if(b(t)){let n;if(i&&(n=this.addAstNodeRegionWithAssignmentsTo(Object.assign({},t)),(!e||t.$document)&&n?.$textRegion&&(n.$textRegion.documentURI=this.currentDocument?.uri.toString())),r&&!e&&(n??=Object.assign({},t),n.$sourceText=t.$cstNode?.text),a){n??=Object.assign({},t);let e=this.commentProvider.getComment(t);e&&(n.$comment=e.replace(/\r/g,``))}return n??t}else return t}addAstNodeRegionWithAssignmentsTo(e){let t=e=>({offset:e.offset,end:e.end,length:e.length,range:e.range});if(e.$cstNode){let n=e.$textRegion=t(e.$cstNode),r=n.assignments={};return Object.keys(e).filter(e=>!e.startsWith(`$`)).forEach(n=>{let i=Gn(e.$cstNode,n).map(t);i.length!==0&&(r[n]=i)}),e}}linkNode(e,t,n,r,i,a){for(let[r,i]of Object.entries(e))if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];To(o)?i[a]=this.reviveReference(e,r,t,o,n):b(o)&&this.linkNode(o,t,n,e,r,a)}else To(i)?e[r]=this.reviveReference(e,r,t,i,n):b(i)&&this.linkNode(i,t,n,e,r);let o=e;o.$container=r,o.$containerProperty=i,o.$containerIndex=a}reviveReference(e,t,n,r,i){let a=r.$refText,o=r.$error;if(r.$ref){let e=this.getRefNode(n,r.$ref,i.uriConverter);if(b(e))return a||=this.nameProvider.getName(e),{$refText:a??``,ref:e};o=e}if(o){let n={$refText:a??``};return n.error={container:e,property:t,message:o,reference:n},n}else return}getRefNode(e,t,n){try{let r=t.indexOf(`#`);if(r===0)return this.astNodeLocator.getAstNode(e,t.substring(1))||`Could not resolve path: `+t;if(r<0){let e=n?n(t):q.parse(t),r=this.langiumDocuments.getDocument(e);return r?r.parseResult.value:`Could not find document for URI: `+t}let i=n?n(t.substring(0,r)):q.parse(t.substring(0,r)),a=this.langiumDocuments.getDocument(i);return a?r===t.length-1?a.parseResult.value:this.astNodeLocator.getAstNode(a.parseResult.value,t.substring(r+1))||`Could not resolve URI: `+t:`Could not find document for URI: `+t}catch(e){return String(e)}}},Do=class{get map(){return this.fileExtensionMap}constructor(e){this.languageIdMap=new Map,this.fileExtensionMap=new Map,this.fileNameMap=new Map,this.textDocuments=e?.workspace.TextDocuments}register(e){let t=e.LanguageMetaData;for(let n of t.fileExtensions)this.fileExtensionMap.has(n)&&console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileExtensionMap.set(n,e);if(t.fileNames)for(let n of t.fileNames)this.fileNameMap.has(n)&&console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`),this.fileNameMap.set(n,e);this.languageIdMap.set(t.languageId,e),this.languageIdMap.size===1?this.singleton=e:this.singleton=void 0}getServices(e){if(this.singleton!==void 0)return this.singleton;if(this.languageIdMap.size===0)throw Error("The service registry is empty. Use `register` to register the services of a language.");let t=this.textDocuments?.get(e)?.languageId;if(t!==void 0){let e=this.languageIdMap.get(t);if(e)return e}let n=J.extname(e),r=J.basename(e),i=this.fileNameMap.get(r)??this.fileExtensionMap.get(n);if(!i)throw t?Error(`The service registry contains no services for the extension '${n}' for language '${t}'.`):Error(`The service registry contains no services for the extension '${n}'.`);return i}hasServices(e){try{return this.getServices(e),!0}catch{return!1}}get all(){return Array.from(this.languageIdMap.values())}};function Oo(e){return{code:e}}var ko;(function(e){e.all=[`fast`,`slow`,`built-in`]})(ko||={});var Ao=class{constructor(e){this.entries=new fo,this.entriesBefore=[],this.entriesAfter=[],this.reflection=e.shared.AstReflection}register(e,t=this,n=`fast`){if(n===`built-in`)throw Error(`The 'built-in' category is reserved for lexer, parser, and linker errors.`);for(let[r,i]of Object.entries(e)){let e=i;if(Array.isArray(e))for(let i of e){let e={check:this.wrapValidationException(i,t),category:n};this.addEntry(r,e)}else if(typeof e==`function`){let i={check:this.wrapValidationException(e,t),category:n};this.addEntry(r,i)}else xe(e)}}wrapValidationException(e,t){return async(n,r,i)=>{await this.handleException(()=>e.call(t,n,r,i),`An error occurred during validation`,r,n)}}async handleException(e,t,n,r){try{await e()}catch(e){if(Ja(e))throw e;console.error(`${t}:`,e),e instanceof Error&&e.stack&&console.error(e.stack),n(`error`,`${t}: ${e instanceof Error?e.message:String(e)}`,{node:r})}}addEntry(e,t){if(e===`AstNode`){this.entries.add(`AstNode`,t);return}for(let n of this.reflection.getAllSubTypes(e))this.entries.add(n,t)}getChecks(e,t){let n=j(this.entries.get(e)).concat(this.entries.get(`AstNode`));return t&&(n=n.filter(e=>t.includes(e.category))),n.map(e=>e.check)}registerBeforeDocument(e,t=this){this.entriesBefore.push(this.wrapPreparationException(e,`An error occurred during set-up of the validation`,t))}registerAfterDocument(e,t=this){this.entriesAfter.push(this.wrapPreparationException(e,`An error occurred during tear-down of the validation`,t))}wrapPreparationException(e,t,n){return async(r,i,a,o)=>{await this.handleException(()=>e.call(n,r,i,a,o),t,i,r)}}get checksBefore(){return this.entriesBefore}get checksAfter(){return this.entriesAfter}},jo=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=G.CancellationToken.None){let r=e.parseResult,i=[];if(await K(n),(!t.categories||t.categories.includes(`built-in`))&&(this.processLexingErrors(r,i,t),t.stopAfterLexingErrors&&i.some(e=>e.data?.code===Fo.LexingError)||(this.processParsingErrors(r,i,t),t.stopAfterParsingErrors&&i.some(e=>e.data?.code===Fo.ParsingError))||(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(e=>e.data?.code===Fo.LinkingError))))return i;try{i.push(...await this.validateAst(r.value,t,n))}catch(e){if(Ja(e))throw e;console.error(`An error occurred during validation:`,e)}return await K(n),i}processLexingErrors(e,t,n){let r=[...e.lexerErrors,...e.lexerReport?.diagnostics??[]];for(let e of r){let n=e.severity??`error`,r={severity:No(n),range:{start:{line:e.line-1,character:e.column-1},end:{line:e.line-1,character:e.column+e.length-1}},message:e.message,data:Po(n),source:this.getSource()};t.push(r)}}processParsingErrors(e,t,n){for(let n of e.parserErrors){let e;if(isNaN(n.token.startOffset)){if(`previousToken`in n){let t=n.previousToken;if(isNaN(t.startOffset)){let t={line:0,character:0};e={start:t,end:t}}else{let n={line:t.endLine-1,character:t.endColumn};e={start:n,end:n}}}}else e=F(n.token);if(e){let r={severity:No(`error`),range:e,message:n.message,data:Oo(Fo.ParsingError),source:this.getSource()};t.push(r)}}}processLinkingErrors(e,t,n){for(let n of e.references){let e=n.error;if(e){let n={node:e.container,property:e.property,index:e.index,data:{code:Fo.LinkingError,containerType:e.container.$type,property:e.property,refText:e.reference.$refText}};t.push(this.toDiagnostic(`error`,e.message,n))}}}async validateAst(e,t,n=G.CancellationToken.None){let r=[],i=(e,t,n)=>{r.push(this.toDiagnostic(e,t,n))};return await this.validateAstBefore(e,t,i,n),await this.validateAstNodes(e,t,i,n),await this.validateAstAfter(e,t,i,n),r}async validateAstBefore(e,t,n,r=G.CancellationToken.None){let i=this.validationRegistry.checksBefore;for(let a of i)await K(r),await a(e,n,t.categories??[],r)}async validateAstNodes(e,t,n,r=G.CancellationToken.None){await Promise.all(vn(e).map(async e=>{await K(r);let i=this.validationRegistry.getChecks(e.$type,t.categories);for(let t of i)await t(e,n,r)}))}async validateAstAfter(e,t,n,r=G.CancellationToken.None){let i=this.validationRegistry.checksAfter;for(let a of i)await K(r),await a(e,n,t.categories??[],r)}toDiagnostic(e,t,n){return{message:t,range:Mo(n),severity:No(e),code:n.code,codeDescription:n.codeDescription,tags:n.tags,relatedInformation:n.relatedInformation,data:n.data,source:this.getSource()}}getSource(){return this.metadata.languageId}};function Mo(e){if(e.range)return e.range;let t;return typeof e.property==`string`?t=Kn(e.node.$cstNode,e.property,e.index):typeof e.keyword==`string`&&(t=Yn(e.node.$cstNode,e.keyword,e.index)),t??=e.node.$cstNode,t?t.range:{start:{line:0,character:0},end:{line:0,character:0}}}function No(e){switch(e){case`error`:return 1;case`warning`:return 2;case`info`:return 3;case`hint`:return 4;default:throw Error(`Invalid diagnostic severity: `+e)}}function Po(e){switch(e){case`error`:return Oo(Fo.LexingError);case`warning`:return Oo(Fo.LexingWarning);case`info`:return Oo(Fo.LexingInfo);case`hint`:return Oo(Fo.LexingHint);default:throw Error(`Invalid diagnostic severity: `+e)}}var Fo;(function(e){e.LexingError=`lexing-error`,e.LexingWarning=`lexing-warning`,e.LexingInfo=`lexing-info`,e.LexingHint=`lexing-hint`,e.ParsingError=`parsing-error`,e.LinkingError=`linking-error`})(Fo||={});var Io=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){let r=n??B(e);t??=this.nameProvider.getName(e);let i=this.astNodeLocator.getAstNodePath(e);if(!t)throw Error(`Node at path ${i} has no name.`);let a,o=()=>a??=I(this.nameProvider.getNameNode(e)??e.$cstNode);return{node:e,name:t,get nameSegment(){return o()},selectionSegment:I(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}},Lo=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=G.CancellationToken.None){let n=[],r=e.parseResult.value;for(let e of vn(r))await K(t),bn(e).filter(e=>!C(e)).forEach(e=>{let t=this.createDescription(e);t&&n.push(t)});return n}createDescription(e){let t=e.reference.$nodeDescription,n=e.reference.$refNode;if(!t||!n)return;let r=B(e.container).uri;return{sourceUri:r,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:I(n),local:J.equals(t.documentUri,r)}}},Ro=class{constructor(){this.segmentSeparator=`/`,this.indexSeparator=`@`}getAstNodePath(e){if(e.$container){let t=this.getAstNodePath(e.$container),n=this.getPathSegment(e);return t+this.segmentSeparator+n}return``}getPathSegment({$containerProperty:e,$containerIndex:t}){if(!e)throw Error(`Missing '$containerProperty' in AST node.`);return t===void 0?e:e+this.indexSeparator+t}getAstNode(e,t){return t.split(this.segmentSeparator).reduce((e,t)=>{if(!e||t.length===0)return e;let n=t.indexOf(this.indexSeparator);if(n>0){let r=t.substring(0,n),i=parseInt(t.substring(n+1));return e[r]?.[i]}return e[t]},e)}},zo=i({});t(zo,a(Ba(),1));var Bo=class{constructor(e){this._ready=new Ya,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new zo.Emitter,this.serviceRegistry=e.ServiceRegistry}get ready(){return this._ready.promise}initialize(e){this.workspaceConfig=e.capabilities.workspace?.configuration??!1}async initialized(e){if(this.workspaceConfig){if(e.register){let t=this.serviceRegistry.all;e.register({section:t.map(e=>this.toSectionName(e.LanguageMetaData.languageId))})}if(e.fetchConfiguration){let t=this.serviceRegistry.all.map(e=>({section:this.toSectionName(e.LanguageMetaData.languageId)})),n=await e.fetchConfiguration(t);t.forEach((e,t)=>{this.updateSectionConfiguration(e.section,n[t])})}}this._ready.resolve()}updateConfiguration(e){e.settings&&Object.keys(e.settings).forEach(t=>{let n=e.settings[t];this.updateSectionConfiguration(t,n),this.onConfigurationSectionUpdateEmitter.fire({section:t,configuration:n})})}updateSectionConfiguration(e,t){this.settings[e]=t}async getConfiguration(e,t){await this.ready;let n=this.toSectionName(e);if(this.settings[n])return this.settings[n][t]}toSectionName(e){return`${e}`}get onConfigurationSectionUpdate(){return this.onConfigurationSectionUpdateEmitter.event}},Vo;(function(e){function t(e){return{dispose:async()=>await e()}}e.create=t})(Vo||={});var Ho=class{constructor(e){this.updateBuildOptions={validation:{categories:[`built-in`,`fast`]}},this.updateListeners=[],this.buildPhaseListeners=new fo,this.documentPhaseListeners=new fo,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=Y.Changed,this.langiumDocuments=e.workspace.LangiumDocuments,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.textDocuments=e.workspace.TextDocuments,this.indexManager=e.workspace.IndexManager,this.serviceRegistry=e.ServiceRegistry}async build(e,t={},n=G.CancellationToken.None){for(let n of e){let e=n.uri.toString();if(n.state===Y.Validated){if(typeof t.validation==`boolean`&&t.validation)n.state=Y.IndexedReferences,n.diagnostics=void 0,this.buildState.delete(e);else if(typeof t.validation==`object`){let r=this.buildState.get(e),i=r?.result?.validationChecks;if(i){let a=(t.validation.categories??ko.all).filter(e=>!i.includes(e));a.length>0&&(this.buildState.set(e,{completed:!1,options:{validation:Object.assign(Object.assign({},t.validation),{categories:a})},result:r.result}),n.state=Y.IndexedReferences)}}}else this.buildState.delete(e)}this.currentState=Y.Changed,await this.emitUpdate(e.map(e=>e.uri),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=G.CancellationToken.None){this.currentState=Y.Changed;for(let e of t)this.langiumDocuments.deleteDocument(e),this.buildState.delete(e.toString()),this.indexManager.remove(e);for(let t of e){if(!this.langiumDocuments.invalidateDocument(t)){let e=this.langiumDocumentFactory.fromModel({$type:`INVALID`},t);e.state=Y.Changed,this.langiumDocuments.addDocument(e)}this.buildState.delete(t.toString())}let r=j(e).concat(t).map(e=>e.toString()).toSet();this.langiumDocuments.all.filter(e=>!r.has(e.uri.toString())&&this.shouldRelink(e,r)).forEach(e=>{this.serviceRegistry.getServices(e.uri).references.Linker.unlink(e),e.state=Math.min(e.state,Y.ComputedScopes),e.diagnostics=void 0}),await this.emitUpdate(e,t),await K(n);let i=this.sortDocuments(this.langiumDocuments.all.filter(e=>e.state<Y.Linked||!this.buildState.get(e.uri.toString())?.completed).toArray());await this.buildDocuments(i,this.updateBuildOptions,n)}async emitUpdate(e,t){await Promise.all(this.updateListeners.map(n=>n(e,t)))}sortDocuments(e){let t=0,n=e.length-1;for(;t<n;){for(;t<e.length&&this.hasTextDocument(e[t]);)t++;for(;n>=0&&!this.hasTextDocument(e[n]);)n--;t<n&&([e[t],e[n]]=[e[n],e[t]])}return e}hasTextDocument(e){return!!this.textDocuments?.get(e.uri)}shouldRelink(e,t){return e.references.some(e=>e.error!==void 0)?!0:this.indexManager.isAffected(e,t)}onUpdate(e){return this.updateListeners.push(e),Vo.create(()=>{let t=this.updateListeners.indexOf(e);t>=0&&this.updateListeners.splice(t,1)})}async buildDocuments(e,t,n){this.prepareBuild(e,t),await this.runCancelable(e,Y.Parsed,n,e=>this.langiumDocumentFactory.update(e,n)),await this.runCancelable(e,Y.IndexedContent,n,e=>this.indexManager.updateContent(e,n)),await this.runCancelable(e,Y.ComputedScopes,n,async e=>{e.precomputedScopes=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeLocalScopes(e,n)});let r=e.filter(e=>this.shouldLink(e));await this.runCancelable(r,Y.Linked,n,e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,n)),await this.runCancelable(r,Y.IndexedReferences,n,e=>this.indexManager.updateReferences(e,n));let i=e.filter(e=>this.shouldValidate(e));await this.runCancelable(i,Y.Validated,n,e=>this.validate(e,n));for(let t of e){let e=this.buildState.get(t.uri.toString());e&&(e.completed=!0)}}prepareBuild(e,t){for(let n of e){let e=n.uri.toString(),r=this.buildState.get(e);(!r||r.completed)&&this.buildState.set(e,{completed:!1,options:t,result:r?.result})}}async runCancelable(e,t,n,r){let i=e.filter(e=>e.state<t);for(let e of i)await K(n),await r(e),e.state=t,await this.notifyDocumentPhase(e,t,n);let a=e.filter(e=>e.state===t);await this.notifyBuildPhase(a,t,n),this.currentState=t}onBuildPhase(e,t){return this.buildPhaseListeners.add(e,t),Vo.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),Vo.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,n){let r;if(t&&`path`in t?r=t:n=t,n??=G.CancellationToken.None,r){let t=this.langiumDocuments.getDocument(r);if(t&&t.state>=e)return Promise.resolve(r)}return this.currentState>=e?Promise.resolve(void 0):n.isCancellationRequested?Promise.reject(qa):new Promise((t,i)=>{let a=this.onBuildPhase(e,()=>{a.dispose(),o.dispose(),t(r?this.langiumDocuments.getDocument(r)?.uri:void 0)}),o=n.onCancellationRequested(()=>{a.dispose(),o.dispose(),i(qa)})})}async notifyDocumentPhase(e,t,n){let r=this.documentPhaseListeners.get(t).slice();for(let t of r)try{await t(e,n)}catch(e){if(!Ja(e))throw e}}async notifyBuildPhase(e,t,n){if(e.length===0)return;let r=this.buildPhaseListeners.get(t).slice();for(let t of r)await K(n),await t(e,n)}shouldLink(e){return this.getBuildOptions(e).eagerLinking??!0}shouldValidate(e){return!!this.getBuildOptions(e).validation}async validate(e,t){let n=this.serviceRegistry.getServices(e.uri).validation.DocumentValidator,r=this.getBuildOptions(e).validation,i=typeof r==`object`?r:void 0,a=await n.validateDocument(e,i,t);e.diagnostics?e.diagnostics.push(...a):e.diagnostics=a;let o=this.buildState.get(e.uri.toString());if(o){o.result??={};let e=i?.categories??ko.all;o.result.validationChecks?o.result.validationChecks.push(...e):o.result.validationChecks=[...e]}}getBuildOptions(e){return this.buildState.get(e.uri.toString())?.options??{}}},Uo=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new bo,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let n=B(e).uri,r=[];return this.referenceIndex.forEach(e=>{e.forEach(e=>{J.equals(e.targetUri,n)&&e.targetPath===t&&r.push(e)})}),j(r)}allElements(e,t){let n=j(this.symbolIndex.keys());return t&&(n=n.filter(e=>!t||t.has(e))),n.map(t=>this.getFileDescriptions(t,e)).flat()}getFileDescriptions(e,t){return t?this.symbolByTypeIndex.get(e,t,()=>(this.symbolIndex.get(e)??[]).filter(e=>this.astReflection.isSubtype(e.type,t))):this.symbolIndex.get(e)??[]}remove(e){let t=e.toString();this.symbolIndex.delete(t),this.symbolByTypeIndex.clear(t),this.referenceIndex.delete(t)}async updateContent(e,t=G.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).references.ScopeComputation.computeExports(e,t),r=e.uri.toString();this.symbolIndex.set(r,n),this.symbolByTypeIndex.clear(r)}async updateReferences(e,t=G.CancellationToken.None){let n=await this.serviceRegistry.getServices(e.uri).workspace.ReferenceDescriptionProvider.createDescriptions(e,t);this.referenceIndex.set(e.uri.toString(),n)}isAffected(e,t){let n=this.referenceIndex.get(e.uri.toString());return n?n.some(e=>!e.local&&t.has(e.targetUri.toString())):!1}},Wo=class{constructor(e){this.initialBuildOptions={},this._ready=new Ya,this.serviceRegistry=e.ServiceRegistry,this.langiumDocuments=e.workspace.LangiumDocuments,this.documentBuilder=e.workspace.DocumentBuilder,this.fileSystemProvider=e.workspace.FileSystemProvider,this.mutex=e.workspace.WorkspaceLock}get ready(){return this._ready.promise}get workspaceFolders(){return this.folders}initialize(e){this.folders=e.workspaceFolders??void 0}initialized(e){return this.mutex.write(e=>this.initializeWorkspace(this.folders??[],e))}async initializeWorkspace(e,t=G.CancellationToken.None){let n=await this.performStartup(e);await K(t),await this.documentBuilder.build(n,this.initialBuildOptions,t)}async performStartup(e){let t=this.serviceRegistry.all.flatMap(e=>e.LanguageMetaData.fileExtensions),n=this.serviceRegistry.all.flatMap(e=>e.LanguageMetaData.fileNames??[]),r=[],i=e=>{r.push(e),this.langiumDocuments.hasDocument(e.uri)||this.langiumDocuments.addDocument(e)};return await this.loadAdditionalDocuments(e,i),await Promise.all(e.map(e=>[e,this.getRootFolder(e)]).map(async e=>this.traverseFolder(...e,{fileExtensions:t,fileNames:n},i))),this._ready.resolve(),r}loadAdditionalDocuments(e,t){return Promise.resolve()}getRootFolder(e){return q.parse(e.uri)}async traverseFolder(e,t,n,r){let i=await this.fileSystemProvider.readDirectory(t);await Promise.all(i.map(async t=>{this.includeEntry(e,t,n)&&(t.isDirectory?await this.traverseFolder(e,t.uri,n,r):t.isFile&&r(await this.langiumDocuments.getOrCreateDocument(t.uri)))}))}includeEntry(e,t,n){let r=J.basename(t.uri);return r.startsWith(`.`)?!1:t.isDirectory?r!==`node_modules`&&r!==`out`:t.isFile?n.fileExtensions.includes(J.extname(t.uri))||n.fileNames.includes(J.basename(t.uri)):!1}},Go=class{buildUnexpectedCharactersMessage(e,t,n,r,i){return f.buildUnexpectedCharactersMessage(e,t,n,r,i)}buildUnableToPopLexerModeMessage(e){return f.buildUnableToPopLexerModeMessage(e)}};const Ko={mode:`full`};var qo=class{constructor(e){this.errorMessageProvider=e.parser.LexerErrorMessageProvider,this.tokenBuilder=e.parser.TokenBuilder;let t=this.tokenBuilder.buildTokens(e.Grammar,{caseInsensitive:e.LanguageMetaData.caseInsensitive});this.tokenTypes=this.toTokenTypeDictionary(t),this.chevrotainLexer=new d(Xo(t)?Object.values(t):t,{positionTracking:`full`,skipValidations:e.LanguageMetaData.mode===`production`,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Ko){var n;let r=this.chevrotainLexer.tokenize(e);return{tokens:r.tokens,errors:r.errors,hidden:r.groups.hidden??[],report:(n=this.tokenBuilder).flushLexingReport?.call(n,e)}}toTokenTypeDictionary(e){if(Xo(e))return e;let t=Yo(e)?Object.values(e.modes).flat():e,n={};return t.forEach(e=>n[e.name]=e),n}};function Jo(e){return Array.isArray(e)&&(e.length===0||`name`in e[0])}function Yo(e){return e&&`modes`in e&&`defaultMode`in e}function Xo(e){return!Jo(e)&&!Yo(e)}Qi();function Zo(e,t,n){let r,i;typeof e==`string`?(i=t,r=n):(i=e.range.start,r=t),i||=V.create(0,0);let a=$o(e),o=hs(r);return cs({index:0,tokens:ns({lines:a,position:i,options:o}),position:i})}function Qo(e,t){let n=hs(t),r=$o(e);if(r.length===0)return!1;let i=r[0],a=r[r.length-1],o=n.start,s=n.end;return!!o?.exec(i)&&!!s?.exec(a)}function $o(e){let t=``;return t=typeof e==`string`?e:e.text,t.split(En)}const es=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,ts=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function ns(e){let t=[],n=e.position.line,r=e.position.character;for(let i=0;i<e.lines.length;i++){let a=i===0,o=i===e.lines.length-1,s=e.lines[i],c=0;if(a&&e.options.start){let t=e.options.start?.exec(s);t&&(c=t.index+t[0].length)}else{let t=e.options.line?.exec(s);t&&(c=t.index+t[0].length)}if(o){let t=e.options.end?.exec(s);t&&(s=s.substring(0,t.index))}if(s=s.substring(0,ss(s)),os(s,c)>=s.length){if(t.length>0){let e=V.create(n,r);t.push({type:`break`,content:``,range:H.create(e,e)})}}else{es.lastIndex=c;let e=es.exec(s);if(e){let i=e[0],a=e[1],o=V.create(n,r+c),l=V.create(n,r+c+i.length);t.push({type:`tag`,content:a,range:H.create(o,l)}),c+=i.length,c=os(s,c)}if(c<s.length){let e=s.substring(c),i=Array.from(e.matchAll(ts));t.push(...rs(i,e,n,r+c))}}n++,r=0}return t.length>0&&t[t.length-1].type===`break`?t.slice(0,-1):t}function rs(e,t,n,r){let i=[];if(e.length===0){let e=V.create(n,r),a=V.create(n,r+t.length);i.push({type:`text`,content:t,range:H.create(e,a)})}else{let a=0;for(let o of e){let e=o.index,s=t.substring(a,e);s.length>0&&i.push({type:`text`,content:t.substring(a,e),range:H.create(V.create(n,a+r),V.create(n,e+r))});let c=s.length+1,l=o[1];if(i.push({type:`inline-tag`,content:l,range:H.create(V.create(n,a+c+r),V.create(n,a+c+l.length+r))}),c+=l.length,o.length===4){c+=o[2].length;let e=o[3];i.push({type:`text`,content:e,range:H.create(V.create(n,a+c+r),V.create(n,a+c+e.length+r))})}else i.push({type:`text`,content:``,range:H.create(V.create(n,a+c+r),V.create(n,a+c+r))});a=e+o[0].length}let o=t.substring(a);o.length>0&&i.push({type:`text`,content:o,range:H.create(V.create(n,a+r),V.create(n,a+r+o.length))})}return i}const is=/\S/,as=/\s*$/;function os(e,t){let n=e.substring(t).match(is);return n?t+n.index:e.length}function ss(e){let t=e.match(as);if(t&&typeof t.index==`number`)return t.index}function cs(e){let t=V.create(e.position.line,e.position.character);if(e.tokens.length===0)return new _s([],H.create(t,t));let n=[];for(;e.index<e.tokens.length;){let t=ls(e,n[n.length-1]);t&&n.push(t)}let r=n[0]?.range.start??t,i=n[n.length-1]?.range.end??t;return new _s(n,H.create(r,i))}function ls(e,t){let n=e.tokens[e.index];if(n.type===`tag`)return ps(e,!1);if(n.type===`text`||n.type===`inline-tag`)return ds(e);us(n,t),e.index++}function us(e,t){if(t){let n=new Ss(``,e.range);`inlines`in t?t.inlines.push(n):t.content.inlines.push(n)}}function ds(e){let t=e.tokens[e.index],n=t,r=t,i=[];for(;t&&t.type!==`break`&&t.type!==`tag`;)i.push(fs(e)),r=t,t=e.tokens[e.index];return new xs(i,H.create(n.range.start,r.range.end))}function fs(e){return e.tokens[e.index].type===`inline-tag`?ps(e,!0):ms(e)}function ps(e,t){let n=e.tokens[e.index++],r=n.content.substring(1);if(e.tokens[e.index]?.type===`text`)if(t){let i=ms(e);return new vs(r,new xs([i],i.range),t,H.create(n.range.start,i.range.end))}else{let i=ds(e);return new vs(r,i,t,H.create(n.range.start,i.range.end))}else{let e=n.range;return new vs(r,new xs([],e),t,e)}}function ms(e){let t=e.tokens[e.index++];return new Ss(t.content,t.range)}function hs(e){if(!e)return hs({start:`/**`,end:`*/`,line:`*`});let{start:t,end:n,line:r}=e;return{start:gs(t,!0),end:gs(n,!1),line:gs(r,!0)}}function gs(e,t){if(typeof e==`string`||typeof e==`object`){let n=typeof e==`string`?Pn(e):e.source;return t?RegExp(`^\\s*${n}`):RegExp(`\\s*${n}\\s*$`)}else return e}var _s=class{constructor(e,t){this.elements=e,this.range=t}getTag(e){return this.getAllTags().find(t=>t.name===e)}getTags(e){return this.getAllTags().filter(t=>t.name===e)}getAllTags(){return this.elements.filter(e=>`name`in e)}toString(){let e=``;for(let t of this.elements)if(e.length===0)e=t.toString();else{let n=t.toString();e+=Cs(e)+n}return e.trim()}toMarkdown(e){let t=``;for(let n of this.elements)if(t.length===0)t=n.toMarkdown(e);else{let r=n.toMarkdown(e);t+=Cs(t)+r}return t.trim()}},vs=class{constructor(e,t,n,r){this.name=e,this.content=t,this.inline=n,this.range=r}toString(){let e=`@${this.name}`,t=this.content.toString();return this.content.inlines.length===1?e=`${e} ${t}`:this.content.inlines.length>1&&(e=`${e}\n${t}`),this.inline?`{${e}}`:e}toMarkdown(e){return(e?.renderTag)?.call(e,this)??this.toMarkdownDefault(e)}toMarkdownDefault(e){let t=this.content.toMarkdown(e);if(this.inline){let n=ys(this.name,t,e??{});if(typeof n==`string`)return n}let n=``;e?.tag===`italic`||e?.tag===void 0?n=`*`:e?.tag===`bold`?n=`**`:e?.tag===`bold-italic`&&(n=`***`);let r=`${n}@${this.name}${n}`;return this.content.inlines.length===1?r=`${r} — ${t}`:this.content.inlines.length>1&&(r=`${r}\n${t}`),this.inline?`{${r}}`:r}};function ys(e,t,n){if(e===`linkplain`||e===`linkcode`||e===`link`){let r=t.indexOf(` `),i=t;if(r>0){let e=os(t,r);i=t.substring(e),t=t.substring(0,r)}return(e===`linkcode`||e===`link`&&n.link===`code`)&&(i=`\`${i}\``),n.renderLink?.call(n,t,i)??bs(t,i)}}function bs(e,t){try{return q.parse(e,!0),`[${t}](${e})`}catch{return e}}var xs=class{constructor(e,t){this.inlines=e,this.range=t}toString(){let e=``;for(let t=0;t<this.inlines.length;t++){let n=this.inlines[t],r=this.inlines[t+1];e+=n.toString(),r&&r.range.start.line>n.range.start.line&&(e+=`
10
- `)}return e}toMarkdown(e){let t=``;for(let n=0;n<this.inlines.length;n++){let r=this.inlines[n],i=this.inlines[n+1];t+=r.toMarkdown(e),i&&i.range.start.line>r.range.start.line&&(t+=`
11
- `)}return t}},Ss=class{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};function Cs(e){return e.endsWith(`
12
- `)?`
13
- `:`
14
-
15
- `}var ws=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&Qo(t))return Zo(t).toMarkdown({renderLink:(t,n)=>this.documentationLinkRenderer(e,t,n),renderTag:t=>this.documentationTagRenderer(e,t)})}documentationLinkRenderer(e,t,n){let r=this.findNameInPrecomputedScopes(e,t)??this.findNameInGlobalScope(e,t);if(r&&r.nameSegment){let e=r.nameSegment.range.start.line+1,t=r.nameSegment.range.start.character+1;return`[${n}](${r.documentUri.with({fragment:`L${e},${t}`}).toString()})`}else return}documentationTagRenderer(e,t){}findNameInPrecomputedScopes(e,t){let n=B(e).precomputedScopes;if(!n)return;let r=e;do{let e=n.get(r).find(e=>e.name===t);if(e)return e;r=r.$container}while(r)}findNameInGlobalScope(e,t){return this.indexManager.allElements().find(e=>e.name===t)}},Ts=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return wo(e)?e.$comment:le(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}},Es=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},Ds=class{constructor(e){this.threadCount=8,this.terminationDelay=200,this.workerPool=[],this.queue=[],this.hydrator=e.serializer.Hydrator}initializeWorkers(){for(;this.workerPool.length<this.threadCount;){let e=this.createWorker();e.onReady(()=>{if(this.queue.length>0){let t=this.queue.shift();t&&(e.lock(),t.resolve(e))}}),this.workerPool.push(e)}}async parse(e,t){let n=await this.acquireParserWorker(t),r=new Ya,i,a=t.onCancellationRequested(()=>{i=setTimeout(()=>{this.terminateWorker(n)},this.terminationDelay)});return n.parse(e).then(e=>{let t=this.hydrator.hydrate(e);r.resolve(t)}).catch(e=>{r.reject(e)}).finally(()=>{a.dispose(),clearTimeout(i)}),r.promise}terminateWorker(e){e.terminate();let t=this.workerPool.indexOf(e);t>=0&&this.workerPool.splice(t,1)}async acquireParserWorker(e){this.initializeWorkers();for(let e of this.workerPool)if(e.ready)return e.lock(),e;let t=new Ya;return e.onCancellationRequested(()=>{let e=this.queue.indexOf(t);e>=0&&this.queue.splice(e,1),t.reject(qa)}),this.queue.push(t),t.promise}},Os=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,n,r){this.onReadyEmitter=new zo.Emitter,this.deferred=new Ya,this._ready=!0,this._parsing=!1,this.sendMessage=e,this._terminate=r,t(e=>{let t=e;this.deferred.resolve(t),this.unlock()}),n(e=>{this.deferred.reject(e),this.unlock()})}terminate(){this.deferred.reject(qa),this._terminate()}lock(){this._ready=!1}unlock(){this._parsing=!1,this._ready=!0,this.onReadyEmitter.fire()}parse(e){if(this._parsing)throw Error(`Parser worker is busy`);return this._parsing=!0,this.deferred=new Ya,this.sendMessage(e),this.deferred.promise}},ks=class{constructor(){this.previousTokenSource=new G.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=Ga();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=G.CancellationToken.None){let r=new Ya,i={action:t,deferred:r,cancellationToken:n};return e.push(i),this.performNextOperation(),r.promise}async performNextOperation(){if(!this.done)return;let e=[];if(this.writeQueue.length>0)e.push(this.writeQueue.shift());else if(this.readQueue.length>0)e.push(...this.readQueue.splice(0,this.readQueue.length));else return;this.done=!1,await Promise.all(e.map(async({action:e,deferred:t,cancellationToken:n})=>{try{let r=await Promise.resolve().then(()=>e(n));t.resolve(r)}catch(e){Ja(e)?t.resolve(void 0):t.reject(e)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},As=class{constructor(e){this.grammarElementIdMap=new po,this.tokenTypeIdMap=new po,this.grammar=e.Grammar,this.lexer=e.parser.Lexer,this.linker=e.references.Linker}dehydrate(e){return{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport?this.dehydrateLexerReport(e.lexerReport):void 0,parserErrors:e.parserErrors.map(e=>Object.assign(Object.assign({},e),{message:e.message})),value:this.dehydrateAstNode(e.value,this.createDehyrationContext(e.value))}}dehydrateLexerReport(e){return e}createDehyrationContext(e){let t=new Map,n=new Map;for(let n of vn(e))t.set(n,{});if(e.$cstNode)for(let t of ie(e.$cstNode))n.set(t,{});return{astNodes:t,cstNodes:n}}dehydrateAstNode(e,t){let n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode!==void 0&&(n.$cstNode=this.dehydrateCstNode(e.$cstNode,t));for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(Array.isArray(i)){let e=[];n[r]=e;for(let n of i)b(n)?e.push(this.dehydrateAstNode(n,t)):x(n)?e.push(this.dehydrateReference(n,t)):e.push(n)}else b(i)?n[r]=this.dehydrateAstNode(i,t):x(i)?n[r]=this.dehydrateReference(i,t):i!==void 0&&(n[r]=i);return n}dehydrateReference(e,t){let n={};return n.$refText=e.$refText,e.$refNode&&(n.$refNode=t.cstNodes.get(e.$refNode)),n}dehydrateCstNode(e,t){let n=t.cstNodes.get(e);return D(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),T(e)?n.content=e.content.map(e=>this.dehydrateCstNode(e,t)):E(e)&&(n.tokenType=e.tokenType.name,n.offset=e.offset,n.length=e.length,n.startLine=e.range.start.line,n.startColumn=e.range.start.character,n.endLine=e.range.end.line,n.endColumn=e.range.end.character),n}hydrate(e){let t=e.value,n=this.createHydrationContext(t);return`$cstNode`in t&&this.hydrateCstNode(t.$cstNode,n),{lexerErrors:e.lexerErrors,lexerReport:e.lexerReport,parserErrors:e.parserErrors,value:this.hydrateAstNode(t,n)}}createHydrationContext(e){let t=new Map,n=new Map;for(let n of vn(e))t.set(n,{});let r;if(e.$cstNode)for(let t of ie(e.$cstNode)){let e;`fullText`in t?(e=new ia(t.fullText),r=e):`content`in t?e=new na:`tokenType`in t&&(e=this.hydrateCstLeafNode(t)),e&&(n.set(t,e),e.root=r)}return{astNodes:t,cstNodes:n}}hydrateAstNode(e,t){let n=t.astNodes.get(e);n.$type=e.$type,n.$containerIndex=e.$containerIndex,n.$containerProperty=e.$containerProperty,e.$cstNode&&(n.$cstNode=t.cstNodes.get(e.$cstNode));for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(Array.isArray(i)){let e=[];n[r]=e;for(let a of i)b(a)?e.push(this.setParent(this.hydrateAstNode(a,t),n)):x(a)?e.push(this.hydrateReference(a,n,r,t)):e.push(a)}else b(i)?n[r]=this.setParent(this.hydrateAstNode(i,t),n):x(i)?n[r]=this.hydrateReference(i,n,r,t):i!==void 0&&(n[r]=i);return n}setParent(e,t){return e.$container=t,e}hydrateReference(e,t,n,r){return this.linker.buildReference(t,n,r.cstNodes.get(e.$refNode),e.$refText)}hydrateCstNode(e,t,n=0){let r=t.cstNodes.get(e);if(typeof e.grammarSource==`number`&&(r.grammarSource=this.getGrammarElement(e.grammarSource)),r.astNode=t.astNodes.get(e.astNode),T(r))for(let i of e.content){let e=this.hydrateCstNode(i,t,n++);r.content.push(e)}return r}hydrateCstLeafNode(e){let t=this.getTokenType(e.tokenType),n=e.offset,r=e.length,i=e.startLine,a=e.startColumn,o=e.endLine,s=e.endColumn,c=e.hidden;return new ta(n,r,{start:{line:i,character:a},end:{line:o,character:s}},t,c)}getTokenType(e){return this.lexer.definition[e]}getGrammarElementId(e){if(e)return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.get(e)}getGrammarElement(e){return this.grammarElementIdMap.size===0&&this.createGrammarElementIdMap(),this.grammarElementIdMap.getKey(e)}createGrammarElementIdMap(){let e=0;for(let t of vn(this.grammar))Le(t)&&this.grammarElementIdMap.set(t,e++)}};function js(e){return{documentation:{CommentProvider:e=>new Ts(e),DocumentationProvider:e=>new ws(e)},parser:{AsyncParser:e=>new Es(e),GrammarConfig:e=>Cr(e),LangiumParser:e=>Na(e),CompletionParser:e=>Ma(e),ValueConverter:()=>new Ia,TokenBuilder:()=>new Fa,Lexer:e=>new qo(e),ParserErrorMessageProvider:()=>new da,LexerErrorMessageProvider:()=>new Go},workspace:{AstNodeLocator:()=>new Ro,AstNodeDescriptionProvider:e=>new Io(e),ReferenceDescriptionProvider:e=>new Lo(e)},references:{Linker:e=>new so(e),NameProvider:()=>new lo,ScopeProvider:e=>new Co(e),ScopeComputation:e=>new mo(e),References:e=>new uo(e)},serializer:{Hydrator:e=>new As(e),JsonSerializer:e=>new Eo(e)},validation:{DocumentValidator:e=>new jo(e),ValidationRegistry:e=>new Ao(e)},shared:()=>e.shared}}function Ms(e){return{ServiceRegistry:e=>new Do(e),workspace:{LangiumDocuments:e=>new ao(e),LangiumDocumentFactory:e=>new io(e),DocumentBuilder:e=>new Ho(e),IndexManager:e=>new Uo(e),WorkspaceManager:e=>new Wo(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new ks,ConfigurationProvider:e=>new Bo(e)}}}var Ns;(function(e){e.merge=(e,t)=>Bs(Bs({},e),t)})(Ns||={});function Ps(e,t,n,r,i,a,o,s,c){return Ls([e,t,n,r,i,a,o,s,c].reduce(Bs,{}))}const Fs=Symbol(`isProxy`);function Is(e){if(e&&e[Fs])for(let t of Object.values(e))Is(t);return e}function Ls(e,t){let n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw Error(`Cannot set property on injected service container`)},get:(r,i)=>i===Fs?!0:zs(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(zs(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(t,n)=>n in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}const Rs=Symbol();function zs(e,t,n,r){if(t in e){if(e[t]instanceof Error)throw Error(`Construction failure. Please make sure that your dependencies are constructable.`,{cause:e[t]});if(e[t]===Rs)throw Error(`Cycle detected. Please make "`+String(t)+`" lazy. Visit https://langium.org/docs/reference/configuration-services/#resolving-cyclic-dependencies`);return e[t]}else if(t in n){let i=n[t];e[t]=Rs;try{e[t]=typeof i==`function`?i(r):Ls(i,r)}catch(n){throw e[t]=n instanceof Error?n:void 0,n}return e[t]}else return}function Bs(e,t){if(t){for(let[n,r]of Object.entries(t))if(r!==void 0){let t=e[n];t!==null&&r!==null&&typeof t==`object`&&typeof r==`object`?e[n]=Bs(t,r):e[n]=r}}return e}const Vs={indentTokenName:`INDENT`,dedentTokenName:`DEDENT`,whitespaceTokenName:`WS`,ignoreIndentationDelimiters:[]};var Hs;(function(e){e.REGULAR=`indentation-sensitive`,e.IGNORE_INDENTATION=`ignore-indentation`})(Hs||={});var Us=class extends Fa{constructor(e=Vs){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options=Object.assign(Object.assign({},Vs),e),this.indentTokenType=g({name:this.options.indentTokenName,pattern:this.indentMatcher.bind(this),line_breaks:!1}),this.dedentTokenType=g({name:this.options.dedentTokenName,pattern:this.dedentMatcher.bind(this),line_breaks:!1})}buildTokens(e,t){let n=super.buildTokens(e,t);if(!Jo(n))throw Error(`Invalid tokens built by default builder`);let{indentTokenName:r,dedentTokenName:i,whitespaceTokenName:a,ignoreIndentationDelimiters:o}=this.options,s,c,l,u=[];for(let e of n){for(let[t,n]of o)e.name===t?e.PUSH_MODE=Hs.IGNORE_INDENTATION:e.name===n&&(e.POP_MODE=!0);e.name===i?s=e:e.name===r?c=e:e.name===a?l=e:u.push(e)}if(!s||!c||!l)throw Error(`Some indentation/whitespace tokens not found!`);return o.length>0?{modes:{[Hs.REGULAR]:[s,c,...u,l],[Hs.IGNORE_INDENTATION]:[...u,l]},defaultMode:Hs.REGULAR}:[s,c,l,...u]}flushLexingReport(e){let t=super.flushLexingReport(e);return Object.assign(Object.assign({},t),{remainingDedents:this.flushRemainingDedents(e)})}isStartOfLine(e,t){return t===0||`\r
16
- `.includes(e[t-1])}matchWhitespace(e,t,n,r){this.whitespaceRegExp.lastIndex=t;let i=this.whitespaceRegExp.exec(e);return{currIndentLevel:i?.[0].length??0,prevIndentLevel:this.indentationStack.at(-1),match:i}}createIndentationTokenInstance(e,t,n,r){let i=this.getLineNumber(t,r);return u(e,n,r,r+n.length,i,i,1,n.length)}getLineNumber(e,t){return e.substring(0,t).split(/\r\n|\r|\n/).length}indentMatcher(e,t,n,r){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:o}=this.matchWhitespace(e,t,n,r);return i<=a?null:(this.indentationStack.push(i),o)}dedentMatcher(e,t,n,r){if(!this.isStartOfLine(e,t))return null;let{currIndentLevel:i,prevIndentLevel:a,match:o}=this.matchWhitespace(e,t,n,r);if(i>=a)return null;let s=this.indentationStack.lastIndexOf(i);if(s===-1)return this.diagnostics.push({severity:`error`,message:`Invalid dedent level ${i} at offset: ${t}. Current indentation stack: ${this.indentationStack}`,offset:t,length:o?.[0]?.length??0,line:this.getLineNumber(e,t),column:1}),null;let c=this.indentationStack.length-s-1,l=e.substring(0,t).match(/[\r\n]+$/)?.[0].length??1;for(let r=0;r<c;r++){let r=this.createIndentationTokenInstance(this.dedentTokenType,e,``,t-(l-1));n.push(r),this.indentationStack.pop()}return null}buildTerminalToken(e){let t=super.buildTerminalToken(e),{indentTokenName:n,dedentTokenName:r,whitespaceTokenName:i}=this.options;return t.name===n?this.indentTokenType:t.name===r?this.dedentTokenType:t.name===i?g({name:i,pattern:this.whitespaceRegExp,group:d.SKIPPED}):t}flushRemainingDedents(e){let t=[];for(;this.indentationStack.length>1;)t.push(this.createIndentationTokenInstance(this.dedentTokenType,e,``,e.length)),this.indentationStack.pop();return this.indentationStack=[0],t}},Ws=class extends qo{constructor(e){if(super(e),e.parser.TokenBuilder instanceof Us)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw Error(`IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder`)}tokenize(e,t=Ko){let n=super.tokenize(e),r=n.report;t?.mode===`full`&&n.tokens.push(...r.remainingDedents),r.remainingDedents=[];let{indentTokenType:i,dedentTokenType:a}=this.indentationTokenBuilder,o=i.tokenTypeIdx,s=a.tokenTypeIdx,c=[],l=n.tokens.length-1;for(let e=0;e<l;e++){let t=n.tokens[e],r=n.tokens[e+1];if(t.tokenTypeIdx===o&&r.tokenTypeIdx===s){e++;continue}c.push(t)}return l>=0&&c.push(n.tokens[l]),n.tokens=c,n}},Gs=class{readFile(){throw Error(`No file system is available.`)}async readDirectory(){return[]}};const Ks={fileSystemProvider:()=>new Gs},qs={Grammar:()=>void 0,LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[`.langium`],languageId:`langium`})},Js={AstReflection:()=>new un};function Ys(){let e=Ps(Ms(Ks),Js),t=Ps(js({shared:e}),qs);return e.ServiceRegistry.register(t),t}function Xs(e){let t=Ys(),n=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,q.parse(`memory://${n.name??`grammar`}.langium`)),n}var Zs=i({AstUtils:()=>dn,BiMap:()=>po,Cancellation:()=>G,ContextCache:()=>bo,CstUtils:()=>re,DONE_RESULT:()=>A,Deferred:()=>Ya,Disposable:()=>Vo,DisposableCache:()=>vo,DocumentCache:()=>xo,EMPTY_STREAM:()=>k,ErrorWithLocation:()=>be,GrammarUtils:()=>Ln,MultiMap:()=>fo,OperationCancelled:()=>qa,Reduction:()=>M,RegExpUtils:()=>Tn,SimpleCache:()=>yo,StreamImpl:()=>O,TreeStreamImpl:()=>ne,URI:()=>q,UriUtils:()=>J,WorkspaceCache:()=>So,assertUnreachable:()=>xe,delayNextTick:()=>Ha,interruptAndCheck:()=>K,isOperationCancelled:()=>Ja,loadGrammarFromJson:()=>Xs,setInterruptionPeriod:()=>Ka,startCancelableOperation:()=>Ga,stream:()=>j});t(Zs,zo),t(i({AbstractAstReflection:()=>w,AbstractCstNode:()=>ea,AbstractLangiumParser:()=>ca,AbstractParserErrorMessageProvider:()=>ua,AbstractThreadedAsyncParser:()=>Ds,AstUtils:()=>dn,BiMap:()=>po,Cancellation:()=>G,CompositeCstNodeImpl:()=>na,ContextCache:()=>bo,CstNodeBuilder:()=>$i,CstUtils:()=>re,DEFAULT_TOKENIZE_OPTIONS:()=>Ko,DONE_RESULT:()=>A,DatatypeSymbol:()=>aa,DefaultAstNodeDescriptionProvider:()=>Io,DefaultAstNodeLocator:()=>Ro,DefaultAsyncParser:()=>Es,DefaultCommentProvider:()=>Ts,DefaultConfigurationProvider:()=>Bo,DefaultDocumentBuilder:()=>Ho,DefaultDocumentValidator:()=>jo,DefaultHydrator:()=>As,DefaultIndexManager:()=>Uo,DefaultJsonSerializer:()=>Eo,DefaultLangiumDocumentFactory:()=>io,DefaultLangiumDocuments:()=>ao,DefaultLexer:()=>qo,DefaultLexerErrorMessageProvider:()=>Go,DefaultLinker:()=>so,DefaultNameProvider:()=>lo,DefaultReferenceDescriptionProvider:()=>Lo,DefaultReferences:()=>uo,DefaultScopeComputation:()=>mo,DefaultScopeProvider:()=>Co,DefaultServiceRegistry:()=>Do,DefaultTokenBuilder:()=>Fa,DefaultValueConverter:()=>Ia,DefaultWorkspaceLock:()=>ks,DefaultWorkspaceManager:()=>Wo,Deferred:()=>Ya,Disposable:()=>Vo,DisposableCache:()=>vo,DocumentCache:()=>xo,DocumentState:()=>Y,DocumentValidator:()=>Fo,EMPTY_SCOPE:()=>_o,EMPTY_STREAM:()=>k,EmptyFileSystem:()=>Ks,EmptyFileSystemProvider:()=>Gs,ErrorWithLocation:()=>be,GrammarAST:()=>Se,GrammarUtils:()=>Ln,IndentationAwareLexer:()=>Ws,IndentationAwareTokenBuilder:()=>Us,JSDocDocumentationProvider:()=>ws,LangiumCompletionParser:()=>fa,LangiumParser:()=>la,LangiumParserErrorMessageProvider:()=>da,LeafCstNodeImpl:()=>ta,LexingMode:()=>Hs,MapScope:()=>go,Module:()=>Ns,MultiMap:()=>fo,OperationCancelled:()=>qa,ParserWorker:()=>Os,Reduction:()=>M,RegExpUtils:()=>Tn,RootCstNodeImpl:()=>ia,SimpleCache:()=>yo,StreamImpl:()=>O,StreamScope:()=>ho,TextDocument:()=>Za,TreeStreamImpl:()=>ne,URI:()=>q,UriUtils:()=>J,ValidationCategory:()=>ko,ValidationRegistry:()=>Ao,ValueConverter:()=>La,WorkspaceCache:()=>So,assertUnreachable:()=>xe,createCompletionParser:()=>Ma,createDefaultCoreModule:()=>js,createDefaultSharedCoreModule:()=>Ms,createGrammarConfig:()=>Cr,createLangiumParser:()=>Na,createParser:()=>ha,delayNextTick:()=>Ha,diagnosticData:()=>Oo,eagerLoad:()=>Is,getDiagnosticRange:()=>Mo,indentationBuilderDefaultOptions:()=>Vs,inject:()=>Ps,interruptAndCheck:()=>K,isAstNode:()=>b,isAstNodeDescription:()=>S,isAstNodeWithComment:()=>wo,isCompositeCstNode:()=>T,isIMultiModeLexerDefinition:()=>Yo,isJSDoc:()=>Qo,isLeafCstNode:()=>E,isLinkingError:()=>C,isNamed:()=>co,isOperationCancelled:()=>Ja,isReference:()=>x,isRootCstNode:()=>D,isTokenTypeArray:()=>Jo,isTokenTypeDictionary:()=>Xo,loadGrammarFromJson:()=>Xs,parseJSDoc:()=>Zo,prepareLangiumParser:()=>Pa,setInterruptionPeriod:()=>Ka,startCancelableOperation:()=>Ga,stream:()=>j,toDiagnosticData:()=>Po,toDiagnosticSeverity:()=>No}),Zs);var Qs=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.thenable=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s;function c(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=c;function l(e){return e&&a(e.then)}e.thenable=l})),$s=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Message=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType=e.RequestType0=e.AbstractMessageSignature=e.ParameterStructures=e.ResponseError=e.ErrorCodes=void 0;let t=za();var n;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(n||(e.ErrorCodes=n={})),e.ResponseError=class e extends Error{constructor(r,i,a){super(i),this.code=t.number(r)?r:n.UnknownErrorCode,this.data=a,Object.setPrototypeOf(this,e.prototype)}toJson(){let e={code:this.code,message:this.message};return this.data!==void 0&&(e.data=this.data),e}};var r=class e{constructor(e){this.kind=e}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};e.ParameterStructures=r,r.auto=new r(`auto`),r.byPosition=new r(`byPosition`),r.byName=new r(`byName`);var i=class{constructor(e,t){this.method=e,this.numberOfParams=t}get parameterStructures(){return r.auto}};e.AbstractMessageSignature=i;var a=class extends i{constructor(e){super(e,0)}};e.RequestType0=a;var o=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};e.RequestType=o;var s=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};e.RequestType1=s;var c=class extends i{constructor(e){super(e,2)}};e.RequestType2=c;var l=class extends i{constructor(e){super(e,3)}};e.RequestType3=l;var u=class extends i{constructor(e){super(e,4)}};e.RequestType4=u;var d=class extends i{constructor(e){super(e,5)}};e.RequestType5=d;var f=class extends i{constructor(e){super(e,6)}};e.RequestType6=f;var p=class extends i{constructor(e){super(e,7)}};e.RequestType7=p;var m=class extends i{constructor(e){super(e,8)}};e.RequestType8=m;var h=class extends i{constructor(e){super(e,9)}};e.RequestType9=h;var g=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};e.NotificationType=g;var _=class extends i{constructor(e){super(e,0)}};e.NotificationType0=_;var v=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}};e.NotificationType1=v;var y=class extends i{constructor(e){super(e,2)}};e.NotificationType2=y;var b=class extends i{constructor(e){super(e,3)}};e.NotificationType3=b;var x=class extends i{constructor(e){super(e,4)}};e.NotificationType4=x;var S=class extends i{constructor(e){super(e,5)}};e.NotificationType5=S;var C=class extends i{constructor(e){super(e,6)}};e.NotificationType6=C;var w=class extends i{constructor(e){super(e,7)}};e.NotificationType7=w;var T=class extends i{constructor(e){super(e,8)}};e.NotificationType8=T;var E=class extends i{constructor(e){super(e,9)}};e.NotificationType9=E;var D;(function(e){function n(e){let n=e;return n&&t.string(n.method)&&(t.string(n.id)||t.number(n.id))}e.isRequest=n;function r(e){let n=e;return n&&t.string(n.method)&&e.id===void 0}e.isNotification=r;function i(e){let n=e;return n&&(n.result!==void 0||!!n.error)&&(t.string(n.id)||t.number(n.id)||n.id===null)}e.isResponse=i})(D||(e.Message=D={}))})),ec=o((e=>{var t;Object.defineProperty(e,`__esModule`,{value:!0}),e.LRUCache=e.LinkedMap=e.Touch=void 0;var n;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(n||(e.Touch=n={}));var r=class{constructor(){this[t]=`LinkedMap`,this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=n.None){let r=this._map.get(e);if(r)return t!==n.None&&this.touch(r,t),r.value}set(e,t,r=n.None){let i=this._map.get(e);if(i)i.value=t,r!==n.None&&this.touch(i,r);else{switch(i={key:e,value:t,next:void 0,previous:void 0},r){case n.None:this.addItemLast(i);break;case n.First:this.addItemFirst(i);break;case n.Last:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw Error(`Invalid list`);let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,r=this._head;for(;r;){if(t?e.bind(t)(r.value,r.key,this):e(r.value,r.key,this),this._state!==n)throw Error(`LinkedMap got modified during iteration.`);r=r.next}}keys(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.key,done:!1};return t=t.next,e}else return{value:void 0,done:!0}}};return n}values(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:t.value,done:!1};return t=t.next,e}else return{value:void 0,done:!0}}};return n}entries(){let e=this._state,t=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==e)throw Error(`LinkedMap got modified during iteration.`);if(t){let e={value:[t.key,t.value],done:!1};return t=t.next,e}else return{value:void 0,done:!0}}};return n}[(t=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw Error(`Invalid list`);this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw Error(`Invalid list`);this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw Error(`Invalid list`);e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw Error(`Invalid list`);e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw Error(`Invalid list`);t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw Error(`Invalid list`);if(!(t!==n.First&&t!==n.Last)){if(t===n.First){if(e===this._head)return;let t=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(t.previous=n,n.next=t),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===n.Last){if(e===this._tail)return;let t=e.next,n=e.previous;e===this._head?(t.previous=void 0,this._head=t):(t.previous=n,n.next=t),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};e.LinkedMap=r;var i=class extends r{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get ratio(){return this._ratio}set ratio(e){this._ratio=Math.min(Math.max(0,e),1),this.checkTrim()}get(e,t=n.AsNew){return super.get(e,t)}peek(e){return super.get(e,n.None)}set(e,t){return super.set(e,t,n.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};e.LRUCache=i})),tc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Disposable=void 0;var t;(function(e){function t(e){return{dispose:e}}e.create=t})(t||(e.Disposable=t={}))})),nc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;let t=Va();var n;(function(e){e.Continue=0,e.Cancelled=1})(n||={});var r=class{constructor(){this.buffers=new Map}enableCancellation(e){if(e.id===null)return;let t=new SharedArrayBuffer(4),r=new Int32Array(t,0,1);r[0]=n.Continue,this.buffers.set(e.id,t),e.$cancellationData=t}async sendCancellation(e,t){let r=this.buffers.get(t);if(r===void 0)return;let i=new Int32Array(r,0,1);Atomics.store(i,0,n.Cancelled)}cleanup(e){this.buffers.delete(e)}dispose(){this.buffers.clear()}};e.SharedArraySenderStrategy=r;var i=class{constructor(e){this.data=new Int32Array(e,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===n.Cancelled}get onCancellationRequested(){throw Error(`Cancellation over SharedArrayBuffer doesn't support cancellation events`)}},a=class{constructor(e){this.token=new i(e)}cancel(){}dispose(){}},o=class{constructor(){this.kind=`request`}createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new t.CancellationTokenSource:new a(n)}};e.SharedArrayReceiverStrategy=o})),rc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Semaphore=void 0;let t=Ra();var n=class{constructor(e=1){if(e<=0)throw Error(`Capacity must be greater than 0`);this._capacity=e,this._active=0,this._waiting=[]}lock(e){return new Promise((t,n)=>{this._waiting.push({thunk:e,resolve:t,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,t.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let e=this._waiting.shift();if(this._active++,this._active>this._capacity)throw Error(`To many thunks active`);try{let t=e.thunk();t instanceof Promise?t.then(t=>{this._active--,e.resolve(t),this.runNext()},t=>{this._active--,e.reject(t),this.runNext()}):(this._active--,e.resolve(t),this.runNext())}catch(t){this._active--,e.reject(t),this.runNext()}}};e.Semaphore=n})),ic=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;let t=Ra(),n=za(),r=Ba(),i=rc();var a;(function(e){function t(e){let t=e;return t&&n.func(t.listen)&&n.func(t.dispose)&&n.func(t.onError)&&n.func(t.onClose)&&n.func(t.onPartialMessage)}e.is=t})(a||(e.MessageReader=a={}));var o=class{constructor(){this.errorEmitter=new r.Emitter,this.closeEmitter=new r.Emitter,this.partialMessageEmitter=new r.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e){this.errorEmitter.fire(this.asError(e))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(e){this.partialMessageEmitter.fire(e)}asError(e){return e instanceof Error?e:Error(`Reader received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageReader=o;var s;(function(e){function n(e){let n,r,i=new Map,a,o=new Map;if(e===void 0||typeof e==`string`)n=e??`utf-8`;else{if(n=e.charset??`utf-8`,e.contentDecoder!==void 0&&(r=e.contentDecoder,i.set(r.name,r)),e.contentDecoders!==void 0)for(let t of e.contentDecoders)i.set(t.name,t);if(e.contentTypeDecoder!==void 0&&(a=e.contentTypeDecoder,o.set(a.name,a)),e.contentTypeDecoders!==void 0)for(let t of e.contentTypeDecoders)o.set(t.name,t)}return a===void 0&&(a=(0,t.default)().applicationJson.decoder,o.set(a.name,a)),{charset:n,contentDecoder:r,contentDecoders:i,contentTypeDecoder:a,contentTypeDecoders:o}}e.fromOptions=n})(s||={});var c=class extends o{constructor(e,n){super(),this.readable=e,this.options=s.fromOptions(n),this.buffer=(0,t.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new i.Semaphore(1)}set partialMessageTimeout(e){this._partialMessageTimeout=e}get partialMessageTimeout(){return this._partialMessageTimeout}listen(e){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=e;let t=this.readable.onData(e=>{this.onData(e)});return this.readable.onError(e=>this.fireError(e)),this.readable.onClose(()=>this.fireClose()),t}onData(e){try{for(this.buffer.append(e);;){if(this.nextMessageLength===-1){let e=this.buffer.tryReadHeaders(!0);if(!e)return;let t=e.get(`content-length`);if(!t){this.fireError(Error(`Header must provide a Content-Length property.\n${JSON.stringify(Object.fromEntries(e))}`));return}let n=parseInt(t);if(isNaN(n)){this.fireError(Error(`Content-Length value must be a number. Got ${t}`));return}this.nextMessageLength=n}let e=this.buffer.tryReadBody(this.nextMessageLength);if(e===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let t=this.options.contentDecoder===void 0?e:await this.options.contentDecoder.decode(e),n=await this.options.contentTypeDecoder.decode(t,this.options);this.callback(n)}).catch(e=>{this.fireError(e)})}}catch(e){this.fireError(e)}}clearPartialMessageTimer(){this.partialMessageTimer&&=(this.partialMessageTimer.dispose(),void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,t.default)().timer.setTimeout((e,t)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:t}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};e.ReadableStreamMessageReader=c})),ac=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;let t=Ra(),n=za(),r=rc(),i=Ba();var a;(function(e){function t(e){let t=e;return t&&n.func(t.dispose)&&n.func(t.onClose)&&n.func(t.onError)&&n.func(t.write)}e.is=t})(a||(e.MessageWriter=a={}));var o=class{constructor(){this.errorEmitter=new i.Emitter,this.closeEmitter=new i.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,t,n){this.errorEmitter.fire([this.asError(e),t,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:Error(`Writer received error. Reason: ${n.string(e.message)?e.message:`unknown`}`)}};e.AbstractMessageWriter=o;var s;(function(e){function n(e){return e===void 0||typeof e==`string`?{charset:e??`utf-8`,contentTypeEncoder:(0,t.default)().applicationJson.encoder}:{charset:e.charset??`utf-8`,contentEncoder:e.contentEncoder,contentTypeEncoder:e.contentTypeEncoder??(0,t.default)().applicationJson.encoder}}e.fromOptions=n})(s||={});var c=class extends o{constructor(e,t){super(),this.writable=e,this.options=s.fromOptions(t),this.errorCount=0,this.writeSemaphore=new r.Semaphore(1),this.writable.onError(e=>this.fireError(e)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(e=>this.options.contentEncoder===void 0?e:this.options.contentEncoder.encode(e)).then(t=>{let n=[];return n.push(`Content-Length: `,t.byteLength.toString(),`\r
17
- `),n.push(`\r
18
- `),this.doWrite(e,n,t)},e=>{throw this.fireError(e),e}))}async doWrite(e,t,n){try{return await this.writable.write(t.join(``),`ascii`),this.writable.write(n)}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){this.writable.end()}};e.WriteableStreamMessageWriter=c})),oc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AbstractMessageBuffer=void 0;var t=class{constructor(e=`utf-8`){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let t=typeof e==`string`?this.fromString(e,this._encoding):e;this._chunks.push(t),this._totalLength+=t.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let t=0,n=0,r=0,i=0;row:for(;n<this._chunks.length;){let e=this._chunks[n];r=0;column:for(;r<e.length;){switch(e[r]){case 13:switch(t){case 0:t=1;break;case 2:t=3;break;default:t=0}break;case 10:switch(t){case 1:t=2;break;case 3:t=4,r++;break row;default:t=0}break;default:t=0}r++}i+=e.byteLength,n++}if(t!==4)return;let a=this._read(i+r),o=new Map,s=this.toString(a,`ascii`).split(`\r
19
- `);if(s.length<2)return o;for(let t=0;t<s.length-2;t++){let n=s[t],r=n.indexOf(`:`);if(r===-1)throw Error(`Message header must separate key and value using ':'\n${n}`);let i=n.substr(0,r),a=n.substr(r+1).trim();o.set(e?i.toLowerCase():i,a)}return o}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw Error(`Cannot read so many bytes!`);if(this._chunks[0].byteLength===e){let t=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(t)}if(this._chunks[0].byteLength>e){let t=this._chunks[0],n=this.asNative(t,e);return this._chunks[0]=t.slice(e),this._totalLength-=e,n}let t=this.allocNative(e),n=0;for(;e>0;){let r=this._chunks[0];if(r.byteLength>e){let i=r.slice(0,e);t.set(i,n),n+=e,this._chunks[0]=r.slice(e),this._totalLength-=e,e-=e}else t.set(r,n),n+=r.byteLength,this._chunks.shift(),this._totalLength-=r.byteLength,e-=r.byteLength}return t}};e.AbstractMessageBuffer=t})),sc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createMessageConnection=e.ConnectionOptions=e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.RequestCancellationReceiverStrategy=e.IdCancellationReceiverStrategy=e.ConnectionStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=e.NullLogger=e.ProgressType=e.ProgressToken=void 0;let t=Ra(),n=za(),r=$s(),i=ec(),a=Ba(),o=Va();var s;(function(e){e.type=new r.NotificationType(`$/cancelRequest`)})(s||={});var c;(function(e){function t(e){return typeof e==`string`||typeof e==`number`}e.is=t})(c||(e.ProgressToken=c={}));var l;(function(e){e.type=new r.NotificationType(`$/progress`)})(l||={});var u=class{constructor(){}};e.ProgressType=u;var d;(function(e){function t(e){return n.func(e)}e.is=t})(d||={}),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var f;(function(e){e[e.Off=0]=`Off`,e[e.Messages=1]=`Messages`,e[e.Compact=2]=`Compact`,e[e.Verbose=3]=`Verbose`})(f||(e.Trace=f={}));var p;(function(e){e.Off=`off`,e.Messages=`messages`,e.Compact=`compact`,e.Verbose=`verbose`})(p||(e.TraceValues=p={})),(function(e){function t(t){if(!n.string(t))return e.Off;switch(t=t.toLowerCase(),t){case`off`:return e.Off;case`messages`:return e.Messages;case`compact`:return e.Compact;case`verbose`:return e.Verbose;default:return e.Off}}e.fromString=t;function r(t){switch(t){case e.Off:return`off`;case e.Messages:return`messages`;case e.Compact:return`compact`;case e.Verbose:return`verbose`;default:return`off`}}e.toString=r})(f||(e.Trace=f={}));var m;(function(e){e.Text=`text`,e.JSON=`json`})(m||(e.TraceFormat=m={})),(function(e){function t(t){return n.string(t)?(t=t.toLowerCase(),t===`json`?e.JSON:e.Text):e.Text}e.fromString=t})(m||(e.TraceFormat=m={}));var h;(function(e){e.type=new r.NotificationType(`$/setTrace`)})(h||(e.SetTraceNotification=h={}));var g;(function(e){e.type=new r.NotificationType(`$/logTrace`)})(g||(e.LogTraceNotification=g={}));var _;(function(e){e[e.Closed=1]=`Closed`,e[e.Disposed=2]=`Disposed`,e[e.AlreadyListening=3]=`AlreadyListening`})(_||(e.ConnectionErrors=_={}));var v=class e extends Error{constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};e.ConnectionError=v;var y;(function(e){function t(e){let t=e;return t&&n.func(t.cancelUndispatched)}e.is=t})(y||(e.ConnectionStrategy=y={}));var b;(function(e){function t(e){let t=e;return t&&(t.kind===void 0||t.kind===`id`)&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}e.is=t})(b||(e.IdCancellationReceiverStrategy=b={}));var x;(function(e){function t(e){let t=e;return t&&t.kind===`request`&&n.func(t.createCancellationTokenSource)&&(t.dispose===void 0||n.func(t.dispose))}e.is=t})(x||(e.RequestCancellationReceiverStrategy=x={}));var S;(function(e){e.Message=Object.freeze({createCancellationTokenSource(e){return new o.CancellationTokenSource}});function t(e){return b.is(e)||x.is(e)}e.is=t})(S||(e.CancellationReceiverStrategy=S={}));var C;(function(e){e.Message=Object.freeze({sendCancellation(e,t){return e.sendNotification(s.type,{id:t})},cleanup(e){}});function t(e){let t=e;return t&&n.func(t.sendCancellation)&&n.func(t.cleanup)}e.is=t})(C||(e.CancellationSenderStrategy=C={}));var w;(function(e){e.Message=Object.freeze({receiver:S.Message,sender:C.Message});function t(e){let t=e;return t&&S.is(t.receiver)&&C.is(t.sender)}e.is=t})(w||(e.CancellationStrategy=w={}));var T;(function(e){function t(e){let t=e;return t&&n.func(t.handleMessage)}e.is=t})(T||(e.MessageStrategy=T={}));var E;(function(e){function t(e){let t=e;return t&&(w.is(t.cancellationStrategy)||y.is(t.connectionStrategy)||T.is(t.messageStrategy))}e.is=t})(E||(e.ConnectionOptions=E={}));var D;(function(e){e[e.New=1]=`New`,e[e.Listening=2]=`Listening`,e[e.Closed=3]=`Closed`,e[e.Disposed=4]=`Disposed`})(D||={});function O(u,p,y,x){let S=y===void 0?e.NullLogger:y,C=0,E=0,O=0,ee,te=new Map,k,A=new Map,j=new Map,ne,M=new i.LinkedMap,re=new Map,ie=new Set,N=new Map,P=f.Off,F=m.Text,I,L=D.New,ae=new a.Emitter,oe=new a.Emitter,se=new a.Emitter,ce=new a.Emitter,le=new a.Emitter,ue=x&&x.cancellationStrategy?x.cancellationStrategy:w.Message;function de(e){if(e===null)throw Error(`Can't send requests with id null since the response can't be correlated.`);return`req-`+e.toString()}function fe(e){return e===null?`res-unknown-`+(++O).toString():`res-`+e.toString()}function pe(){return`not-`+(++E).toString()}function me(e,t){r.Message.isRequest(t)?e.set(de(t.id),t):r.Message.isResponse(t)?e.set(fe(t.id),t):e.set(pe(),t)}function he(e){}function ge(){return L===D.Listening}function _e(){return L===D.Closed}function ve(){return L===D.Disposed}function ye(){(L===D.New||L===D.Listening)&&(L=D.Closed,oe.fire(void 0))}function be(e){ae.fire([e,void 0,void 0])}function xe(e){ae.fire(e)}u.onClose(ye),u.onError(be),p.onClose(ye),p.onError(xe);function Se(){ne||M.size===0||(ne=(0,t.default)().timer.setImmediate(()=>{ne=void 0,we()}))}function Ce(e){r.Message.isRequest(e)?Ee(e):r.Message.isNotification(e)?Oe(e):r.Message.isResponse(e)?De(e):ke(e)}function we(){if(M.size===0)return;let e=M.shift();try{let t=x?.messageStrategy;T.is(t)?t.handleMessage(e,Ce):Ce(e)}finally{Se()}}let Te=e=>{try{if(r.Message.isNotification(e)&&e.method===s.type.method){let t=e.params.id,n=de(t),i=M.get(n);if(r.Message.isRequest(i)){let r=x?.connectionStrategy,a=r&&r.cancelUndispatched?r.cancelUndispatched(i,he):void 0;if(a&&(a.error!==void 0||a.result!==void 0)){M.delete(n),N.delete(t),a.id=i.id,Ne(a,e.method,Date.now()),p.write(a).catch(()=>S.error(`Sending response for canceled message failed.`));return}}let a=N.get(t);if(a!==void 0){a.cancel(),Fe(e);return}else ie.add(t)}me(M,e)}finally{Se()}};function Ee(e){if(ve())return;function t(t,n,i){let a={jsonrpc:`2.0`,id:e.id};t instanceof r.ResponseError?a.error=t.toJson():a.result=t===void 0?null:t,Ne(a,n,i),p.write(a).catch(()=>S.error(`Sending response failed.`))}function i(t,n,r){let i={jsonrpc:`2.0`,id:e.id,error:t.toJson()};Ne(i,n,r),p.write(i).catch(()=>S.error(`Sending response failed.`))}function a(t,n,r){t===void 0&&(t=null);let i={jsonrpc:`2.0`,id:e.id,result:t};Ne(i,n,r),p.write(i).catch(()=>S.error(`Sending response failed.`))}Pe(e);let o=te.get(e.method),s,c;o&&(s=o.type,c=o.handler);let l=Date.now();if(c||ee){let o=e.id??String(Date.now()),u=b.is(ue.receiver)?ue.receiver.createCancellationTokenSource(o):ue.receiver.createCancellationTokenSource(e);e.id!==null&&ie.has(e.id)&&u.cancel(),e.id!==null&&N.set(o,u);try{let d;if(c)if(e.params===void 0){if(s!==void 0&&s.numberOfParams!==0){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines ${s.numberOfParams} params but received none.`),e.method,l);return}d=c(u.token)}else if(Array.isArray(e.params)){if(s!==void 0&&s.parameterStructures===r.ParameterStructures.byName){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,l);return}d=c(...e.params,u.token)}else{if(s!==void 0&&s.parameterStructures===r.ParameterStructures.byPosition){i(new r.ResponseError(r.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,l);return}d=c(e.params,u.token)}else ee&&(d=ee(e.method,e.params,u.token));let f=d;d?f.then?f.then(n=>{N.delete(o),t(n,e.method,l)},t=>{N.delete(o),t instanceof r.ResponseError?i(t,e.method,l):t&&n.string(t.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,l):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}):(N.delete(o),t(d,e.method,l)):(N.delete(o),a(d,e.method,l))}catch(a){N.delete(o),a instanceof r.ResponseError?t(a,e.method,l):a&&n.string(a.message)?i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${a.message}`),e.method,l):i(new r.ResponseError(r.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,l)}}else i(new r.ResponseError(r.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,l)}function De(e){if(!ve())if(e.id===null)e.error?S.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):S.error(`Received response message without id. No further error information provided.`);else{let t=e.id,n=re.get(t);if(Ie(e,n),n!==void 0){re.delete(t);try{if(e.error){let t=e.error;n.reject(new r.ResponseError(t.code,t.message,t.data))}else if(e.result!==void 0)n.resolve(e.result);else throw Error(`Should never happen.`)}catch(e){e.message?S.error(`Response handler '${n.method}' failed with message: ${e.message}`):S.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}function Oe(e){if(ve())return;let t,n;if(e.method===s.type.method){let t=e.params.id;ie.delete(t),Fe(e);return}else{let r=A.get(e.method);r&&(n=r.handler,t=r.type)}if(n||k)try{if(Fe(e),n)if(e.params===void 0)t!==void 0&&t.numberOfParams!==0&&t.parameterStructures!==r.ParameterStructures.byName&&S.error(`Notification ${e.method} defines ${t.numberOfParams} params but received none.`),n();else if(Array.isArray(e.params)){let i=e.params;e.method===l.type.method&&i.length===2&&c.is(i[0])?n({token:i[0],value:i[1]}):(t!==void 0&&(t.parameterStructures===r.ParameterStructures.byName&&S.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&S.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${i.length} arguments`)),n(...i))}else t!==void 0&&t.parameterStructures===r.ParameterStructures.byPosition&&S.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params);else k&&k(e.method,e.params)}catch(t){t.message?S.error(`Notification handler '${e.method}' failed with message: ${t.message}`):S.error(`Notification handler '${e.method}' failed unexpectedly.`)}else se.fire(e)}function ke(e){if(!e){S.error(`Received empty message.`);return}S.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);let t=e;if(n.string(t.id)||n.number(t.id)){let e=t.id,n=re.get(e);n&&n.reject(Error(`The received response has neither a result nor an error property.`))}}function Ae(e){if(e!=null)switch(P){case f.Verbose:return JSON.stringify(e,null,4);case f.Compact:return JSON.stringify(e);default:return}}function je(e){if(!(P===f.Off||!I))if(F===m.Text){let t;(P===f.Verbose||P===f.Compact)&&e.params&&(t=`Params: ${Ae(e.params)}\n\n`),I.log(`Sending request '${e.method} - (${e.id})'.`,t)}else Le(`send-request`,e)}function Me(e){if(!(P===f.Off||!I))if(F===m.Text){let t;(P===f.Verbose||P===f.Compact)&&(t=e.params?`Params: ${Ae(e.params)}\n\n`:`No parameters provided.
20
-
21
- `),I.log(`Sending notification '${e.method}'.`,t)}else Le(`send-notification`,e)}function Ne(e,t,n){if(!(P===f.Off||!I))if(F===m.Text){let r;(P===f.Verbose||P===f.Compact)&&(e.error&&e.error.data?r=`Error data: ${Ae(e.error.data)}\n\n`:e.result?r=`Result: ${Ae(e.result)}\n\n`:e.error===void 0&&(r=`No result returned.
22
-
23
- `)),I.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else Le(`send-response`,e)}function Pe(e){if(!(P===f.Off||!I))if(F===m.Text){let t;(P===f.Verbose||P===f.Compact)&&e.params&&(t=`Params: ${Ae(e.params)}\n\n`),I.log(`Received request '${e.method} - (${e.id})'.`,t)}else Le(`receive-request`,e)}function Fe(e){if(!(P===f.Off||!I||e.method===g.type.method))if(F===m.Text){let t;(P===f.Verbose||P===f.Compact)&&(t=e.params?`Params: ${Ae(e.params)}\n\n`:`No parameters provided.
24
-
25
- `),I.log(`Received notification '${e.method}'.`,t)}else Le(`receive-notification`,e)}function Ie(e,t){if(!(P===f.Off||!I))if(F===m.Text){let n;if((P===f.Verbose||P===f.Compact)&&(e.error&&e.error.data?n=`Error data: ${Ae(e.error.data)}\n\n`:e.result?n=`Result: ${Ae(e.result)}\n\n`:e.error===void 0&&(n=`No result returned.
26
-
27
- `)),t){let r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:``;I.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else I.log(`Received response ${e.id} without active response promise.`,n)}else Le(`receive-response`,e)}function Le(e,t){if(!I||P===f.Off)return;let n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};I.log(n)}function Re(){if(_e())throw new v(_.Closed,`Connection is closed.`);if(ve())throw new v(_.Disposed,`Connection is disposed.`)}function ze(){if(ge())throw new v(_.AlreadyListening,`Connection is already listening`)}function Be(){if(!ge())throw Error(`Call listen() first.`)}function Ve(e){return e===void 0?null:e}function He(e){if(e!==null)return e}function Ue(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}function We(e,t){switch(e){case r.ParameterStructures.auto:return Ue(t)?He(t):[Ve(t)];case r.ParameterStructures.byName:if(!Ue(t))throw Error(`Received parameters by name but param is not an object literal.`);return He(t);case r.ParameterStructures.byPosition:return[Ve(t)];default:throw Error(`Unknown parameter structure ${e.toString()}`)}}function Ge(e,t){let n,r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=We(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(Ve(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null);break}return n}let Ke={sendNotification:(e,...t)=>{Re();let i,a;if(n.string(e)){i=e;let n=t[0],o=0,s=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(o=1,s=n);let c=t.length,l=c-o;switch(l){case 0:a=void 0;break;case 1:a=We(s,t[o]);break;default:if(s===r.ParameterStructures.byName)throw Error(`Received ${l} parameters for 'by Name' notification parameter structure.`);a=t.slice(o,c).map(e=>Ve(e));break}}else{let n=t;i=e.method,a=Ge(e,n)}let o={jsonrpc:`2.0`,method:i,params:a};return Me(o),p.write(o).catch(e=>{throw S.error(`Sending notification failed.`),e})},onNotification:(e,t)=>{Re();let r;return n.func(e)?k=e:t&&(n.string(e)?(r=e,A.set(e,{type:void 0,handler:t})):(r=e.method,A.set(e.method,{type:e,handler:t}))),{dispose:()=>{r===void 0?k=void 0:A.delete(r)}}},onProgress:(e,t,n)=>{if(j.has(t))throw Error(`Progress handler for token ${t} already registered`);return j.set(t,n),{dispose:()=>{j.delete(t)}}},sendProgress:(e,t,n)=>Ke.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:ce.event,sendRequest:(e,...t)=>{Re(),Be();let i,a,s;if(n.string(e)){i=e;let n=t[0],c=t[t.length-1],l=0,u=r.ParameterStructures.auto;r.ParameterStructures.is(n)&&(l=1,u=n);let d=t.length;o.CancellationToken.is(c)&&(--d,s=c);let f=d-l;switch(f){case 0:a=void 0;break;case 1:a=We(u,t[l]);break;default:if(u===r.ParameterStructures.byName)throw Error(`Received ${f} parameters for 'by Name' request parameter structure.`);a=t.slice(l,d).map(e=>Ve(e));break}}else{let n=t;i=e.method,a=Ge(e,n);let r=e.numberOfParams;s=o.CancellationToken.is(n[r])?n[r]:void 0}let c=C++,l;s&&(l=s.onCancellationRequested(()=>{let e=ue.sender.sendCancellation(Ke,c);return e===void 0?(S.log(`Received no promise from cancellation strategy when cancelling id ${c}`),Promise.resolve()):e.catch(()=>{S.log(`Sending cancellation messages for id ${c} failed`)})}));let u={jsonrpc:`2.0`,id:c,method:i,params:a};return je(u),typeof ue.sender.enableCancellation==`function`&&ue.sender.enableCancellation(u),new Promise(async(e,t)=>{let n=t=>{e(t),ue.sender.cleanup(c),l?.dispose()},a=e=>{t(e),ue.sender.cleanup(c),l?.dispose()},o={method:i,timerStart:Date.now(),resolve:n,reject:a};try{re.set(c,o),await p.write(u)}catch(e){throw re.delete(c),o.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,e.message?e.message:`Unknown reason`)),S.error(`Sending request failed.`),e}})},onRequest:(e,t)=>{Re();let r=null;return d.is(e)?(r=void 0,ee=e):n.string(e)?(r=null,t!==void 0&&(r=e,te.set(e,{handler:t,type:void 0}))):t!==void 0&&(r=e.method,te.set(e.method,{type:e,handler:t})),{dispose:()=>{r!==null&&(r===void 0?ee=void 0:te.delete(r))}}},hasPendingResponse:()=>re.size>0,trace:async(e,t,r)=>{let i=!1,a=m.Text;r!==void 0&&(n.boolean(r)?i=r:(i=r.sendNotification||!1,a=r.traceFormat||m.Text)),P=e,F=a,I=P===f.Off?void 0:t,i&&!_e()&&!ve()&&await Ke.sendNotification(h.type,{value:f.toString(e)})},onError:ae.event,onClose:oe.event,onUnhandledNotification:se.event,onDispose:le.event,end:()=>{p.end()},dispose:()=>{if(ve())return;L=D.Disposed,le.fire(void 0);let e=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,`Pending response rejected since connection got disposed`);for(let t of re.values())t.reject(e);re=new Map,N=new Map,ie=new Set,M=new i.LinkedMap,n.func(p.dispose)&&p.dispose(),n.func(u.dispose)&&u.dispose()},listen:()=>{Re(),ze(),L=D.Listening,u.listen(Te)},inspect:()=>{(0,t.default)().console.log(`inspect`)}};return Ke.onNotification(g.type,e=>{if(P===f.Off||!I)return;let t=P===f.Verbose||P===f.Compact;I.log(e.message,t?e.verbose:void 0)}),Ke.onNotification(l.type,e=>{let t=j.get(e.token);t?t(e.value):ce.fire(e)}),Ke}e.createMessageConnection=O})),cc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ProgressType=e.ProgressToken=e.createMessageConnection=e.NullLogger=e.ConnectionOptions=e.ConnectionStrategy=e.AbstractMessageBuffer=e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=e.CancellationToken=e.CancellationTokenSource=e.Emitter=e.Event=e.Disposable=e.LRUCache=e.Touch=e.LinkedMap=e.ParameterStructures=e.NotificationType9=e.NotificationType8=e.NotificationType7=e.NotificationType6=e.NotificationType5=e.NotificationType4=e.NotificationType3=e.NotificationType2=e.NotificationType1=e.NotificationType0=e.NotificationType=e.ErrorCodes=e.ResponseError=e.RequestType9=e.RequestType8=e.RequestType7=e.RequestType6=e.RequestType5=e.RequestType4=e.RequestType3=e.RequestType2=e.RequestType1=e.RequestType0=e.RequestType=e.Message=e.RAL=void 0,e.MessageStrategy=e.CancellationStrategy=e.CancellationSenderStrategy=e.CancellationReceiverStrategy=e.ConnectionError=e.ConnectionErrors=e.LogTraceNotification=e.SetTraceNotification=e.TraceFormat=e.TraceValues=e.Trace=void 0;let t=$s();Object.defineProperty(e,`Message`,{enumerable:!0,get:function(){return t.Message}}),Object.defineProperty(e,`RequestType`,{enumerable:!0,get:function(){return t.RequestType}}),Object.defineProperty(e,`RequestType0`,{enumerable:!0,get:function(){return t.RequestType0}}),Object.defineProperty(e,`RequestType1`,{enumerable:!0,get:function(){return t.RequestType1}}),Object.defineProperty(e,`RequestType2`,{enumerable:!0,get:function(){return t.RequestType2}}),Object.defineProperty(e,`RequestType3`,{enumerable:!0,get:function(){return t.RequestType3}}),Object.defineProperty(e,`RequestType4`,{enumerable:!0,get:function(){return t.RequestType4}}),Object.defineProperty(e,`RequestType5`,{enumerable:!0,get:function(){return t.RequestType5}}),Object.defineProperty(e,`RequestType6`,{enumerable:!0,get:function(){return t.RequestType6}}),Object.defineProperty(e,`RequestType7`,{enumerable:!0,get:function(){return t.RequestType7}}),Object.defineProperty(e,`RequestType8`,{enumerable:!0,get:function(){return t.RequestType8}}),Object.defineProperty(e,`RequestType9`,{enumerable:!0,get:function(){return t.RequestType9}}),Object.defineProperty(e,`ResponseError`,{enumerable:!0,get:function(){return t.ResponseError}}),Object.defineProperty(e,`ErrorCodes`,{enumerable:!0,get:function(){return t.ErrorCodes}}),Object.defineProperty(e,`NotificationType`,{enumerable:!0,get:function(){return t.NotificationType}}),Object.defineProperty(e,`NotificationType0`,{enumerable:!0,get:function(){return t.NotificationType0}}),Object.defineProperty(e,`NotificationType1`,{enumerable:!0,get:function(){return t.NotificationType1}}),Object.defineProperty(e,`NotificationType2`,{enumerable:!0,get:function(){return t.NotificationType2}}),Object.defineProperty(e,`NotificationType3`,{enumerable:!0,get:function(){return t.NotificationType3}}),Object.defineProperty(e,`NotificationType4`,{enumerable:!0,get:function(){return t.NotificationType4}}),Object.defineProperty(e,`NotificationType5`,{enumerable:!0,get:function(){return t.NotificationType5}}),Object.defineProperty(e,`NotificationType6`,{enumerable:!0,get:function(){return t.NotificationType6}}),Object.defineProperty(e,`NotificationType7`,{enumerable:!0,get:function(){return t.NotificationType7}}),Object.defineProperty(e,`NotificationType8`,{enumerable:!0,get:function(){return t.NotificationType8}}),Object.defineProperty(e,`NotificationType9`,{enumerable:!0,get:function(){return t.NotificationType9}}),Object.defineProperty(e,`ParameterStructures`,{enumerable:!0,get:function(){return t.ParameterStructures}});let n=ec();Object.defineProperty(e,`LinkedMap`,{enumerable:!0,get:function(){return n.LinkedMap}}),Object.defineProperty(e,`LRUCache`,{enumerable:!0,get:function(){return n.LRUCache}}),Object.defineProperty(e,`Touch`,{enumerable:!0,get:function(){return n.Touch}});let r=tc();Object.defineProperty(e,`Disposable`,{enumerable:!0,get:function(){return r.Disposable}});let i=Ba();Object.defineProperty(e,`Event`,{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(e,`Emitter`,{enumerable:!0,get:function(){return i.Emitter}});let a=Va();Object.defineProperty(e,`CancellationTokenSource`,{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(e,`CancellationToken`,{enumerable:!0,get:function(){return a.CancellationToken}});let o=nc();Object.defineProperty(e,`SharedArraySenderStrategy`,{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(e,`SharedArrayReceiverStrategy`,{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});let s=ic();Object.defineProperty(e,`MessageReader`,{enumerable:!0,get:function(){return s.MessageReader}}),Object.defineProperty(e,`AbstractMessageReader`,{enumerable:!0,get:function(){return s.AbstractMessageReader}}),Object.defineProperty(e,`ReadableStreamMessageReader`,{enumerable:!0,get:function(){return s.ReadableStreamMessageReader}});let c=ac();Object.defineProperty(e,`MessageWriter`,{enumerable:!0,get:function(){return c.MessageWriter}}),Object.defineProperty(e,`AbstractMessageWriter`,{enumerable:!0,get:function(){return c.AbstractMessageWriter}}),Object.defineProperty(e,`WriteableStreamMessageWriter`,{enumerable:!0,get:function(){return c.WriteableStreamMessageWriter}});let l=oc();Object.defineProperty(e,`AbstractMessageBuffer`,{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});let u=sc();Object.defineProperty(e,`ConnectionStrategy`,{enumerable:!0,get:function(){return u.ConnectionStrategy}}),Object.defineProperty(e,`ConnectionOptions`,{enumerable:!0,get:function(){return u.ConnectionOptions}}),Object.defineProperty(e,`NullLogger`,{enumerable:!0,get:function(){return u.NullLogger}}),Object.defineProperty(e,`createMessageConnection`,{enumerable:!0,get:function(){return u.createMessageConnection}}),Object.defineProperty(e,`ProgressToken`,{enumerable:!0,get:function(){return u.ProgressToken}}),Object.defineProperty(e,`ProgressType`,{enumerable:!0,get:function(){return u.ProgressType}}),Object.defineProperty(e,`Trace`,{enumerable:!0,get:function(){return u.Trace}}),Object.defineProperty(e,`TraceValues`,{enumerable:!0,get:function(){return u.TraceValues}}),Object.defineProperty(e,`TraceFormat`,{enumerable:!0,get:function(){return u.TraceFormat}}),Object.defineProperty(e,`SetTraceNotification`,{enumerable:!0,get:function(){return u.SetTraceNotification}}),Object.defineProperty(e,`LogTraceNotification`,{enumerable:!0,get:function(){return u.LogTraceNotification}}),Object.defineProperty(e,`ConnectionErrors`,{enumerable:!0,get:function(){return u.ConnectionErrors}}),Object.defineProperty(e,`ConnectionError`,{enumerable:!0,get:function(){return u.ConnectionError}}),Object.defineProperty(e,`CancellationReceiverStrategy`,{enumerable:!0,get:function(){return u.CancellationReceiverStrategy}}),Object.defineProperty(e,`CancellationSenderStrategy`,{enumerable:!0,get:function(){return u.CancellationSenderStrategy}}),Object.defineProperty(e,`CancellationStrategy`,{enumerable:!0,get:function(){return u.CancellationStrategy}}),Object.defineProperty(e,`MessageStrategy`,{enumerable:!0,get:function(){return u.MessageStrategy}}),e.RAL=Ra().default})),lc=o((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`util`),r=cc();var i=class e extends r.AbstractMessageBuffer{constructor(e=`utf-8`){super(e)}emptyBuffer(){return e.emptyBuffer}fromString(e,t){return Buffer.from(e,t)}toString(e,t){return e instanceof Buffer?e.toString(t):new n.TextDecoder(t).decode(e)}asNative(e,t){return t===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,t):Buffer.from(e,0,t)}allocNative(e){return Buffer.allocUnsafe(e)}};i.emptyBuffer=Buffer.allocUnsafe(0);var a=class{constructor(e){this.stream=e}onClose(e){return this.stream.on(`close`,e),r.Disposable.create(()=>this.stream.off(`close`,e))}onError(e){return this.stream.on(`error`,e),r.Disposable.create(()=>this.stream.off(`error`,e))}onEnd(e){return this.stream.on(`end`,e),r.Disposable.create(()=>this.stream.off(`end`,e))}onData(e){return this.stream.on(`data`,e),r.Disposable.create(()=>this.stream.off(`data`,e))}},o=class{constructor(e){this.stream=e}onClose(e){return this.stream.on(`close`,e),r.Disposable.create(()=>this.stream.off(`close`,e))}onError(e){return this.stream.on(`error`,e),r.Disposable.create(()=>this.stream.off(`error`,e))}onEnd(e){return this.stream.on(`end`,e),r.Disposable.create(()=>this.stream.off(`end`,e))}write(e,t){return new Promise((n,r)=>{let i=e=>{e==null?n():r(e)};typeof e==`string`?this.stream.write(e,t,i):this.stream.write(e,i)})}end(){this.stream.end()}};let s=Object.freeze({messageBuffer:Object.freeze({create:e=>new i(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:`application/json`,encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(e){return Promise.reject(e)}}}),decoder:Object.freeze({name:`application/json`,decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new n.TextDecoder(t.charset).decode(e)))}catch(e){return Promise.reject(e)}}})}),stream:Object.freeze({asReadableStream:e=>new a(e),asWritableStream:e=>new o(e)}),console,timer:Object.freeze({setTimeout(e,t,...n){let r=setTimeout(e,t,...n);return{dispose:()=>clearTimeout(r)}},setImmediate(e,...t){let n=setImmediate(e,...t);return{dispose:()=>clearImmediate(n)}},setInterval(e,t,...n){let r=setInterval(e,t,...n);return{dispose:()=>clearInterval(r)}}})});function c(){return s}(function(e){function t(){r.RAL.install(s)}e.install=t})(c||={}),t.default=c})),uc=o((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createMessageConnection=t.createServerSocketTransport=t.createClientSocketTransport=t.createServerPipeTransport=t.createClientPipeTransport=t.generateRandomPipeName=t.StreamMessageWriter=t.StreamMessageReader=t.SocketMessageWriter=t.SocketMessageReader=t.PortMessageWriter=t.PortMessageReader=t.IPCMessageWriter=t.IPCMessageReader=void 0;let i=lc();i.default.install();let a=e(`path`),o=e(`os`),s=e(`crypto`),c=e(`net`),l=cc();r(cc(),t);var u=class extends l.AbstractMessageReader{constructor(e){super(),this.process=e;let t=this.process;t.on(`error`,e=>this.fireError(e)),t.on(`close`,()=>this.fireClose())}listen(e){return this.process.on(`message`,e),l.Disposable.create(()=>this.process.off(`message`,e))}};t.IPCMessageReader=u;var d=class extends l.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let t=this.process;t.on(`error`,e=>this.fireError(e)),t.on(`close`,()=>this.fireClose)}write(e){try{return typeof this.process.send==`function`&&this.process.send(e,void 0,void 0,t=>{t?(this.errorCount++,this.handleError(t,e)):this.errorCount=0}),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};t.IPCMessageWriter=d;var f=class extends l.AbstractMessageReader{constructor(e){super(),this.onData=new l.Emitter,e.on(`close`,()=>this.fireClose),e.on(`error`,e=>this.fireError(e)),e.on(`message`,e=>{this.onData.fire(e)})}listen(e){return this.onData.event(e)}};t.PortMessageReader=f;var p=class extends l.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on(`close`,()=>this.fireClose()),e.on(`error`,e=>this.fireError(e))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}};t.PortMessageWriter=p;var m=class extends l.ReadableStreamMessageReader{constructor(e,t=`utf-8`){super((0,i.default)().stream.asReadableStream(e),t)}};t.SocketMessageReader=m;var h=class extends l.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};t.SocketMessageWriter=h;var g=class extends l.ReadableStreamMessageReader{constructor(e,t){super((0,i.default)().stream.asReadableStream(e),t)}};t.StreamMessageReader=g;var _=class extends l.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t)}};t.StreamMessageWriter=_;let v=process.env.XDG_RUNTIME_DIR,y=new Map([[`linux`,107],[`darwin`,103]]);function b(){let e=(0,s.randomBytes)(21).toString(`hex`);if(process.platform===`win32`)return`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`;let t;t=v?a.join(v,`vscode-ipc-${e}.sock`):a.join(o.tmpdir(),`vscode-${e}.sock`);let n=y.get(process.platform);return n!==void 0&&t.length>n&&(0,i.default)().console.warn(`WARNING: IPC handle "${t}" is longer than ${n} characters.`),t}t.generateRandomPipeName=b;function x(e,t=`utf-8`){let n,r=new Promise((e,t)=>{n=e});return new Promise((i,a)=>{let o=(0,c.createServer)(e=>{o.close(),n([new m(e,t),new h(e,t)])});o.on(`error`,a),o.listen(e,()=>{o.removeListener(`error`,a),i({onConnected:()=>r})})})}t.createClientPipeTransport=x;function S(e,t=`utf-8`){let n=(0,c.createConnection)(e);return[new m(n,t),new h(n,t)]}t.createServerPipeTransport=S;function C(e,t=`utf-8`){let n,r=new Promise((e,t)=>{n=e});return new Promise((i,a)=>{let o=(0,c.createServer)(e=>{o.close(),n([new m(e,t),new h(e,t)])});o.on(`error`,a),o.listen(e,`127.0.0.1`,()=>{o.removeListener(`error`,a),i({onConnected:()=>r})})})}t.createClientSocketTransport=C;function w(e,t=`utf-8`){let n=(0,c.createConnection)(e,`127.0.0.1`);return[new m(n,t),new h(n,t)]}t.createServerSocketTransport=w;function T(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function E(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function D(e,t,n,r){n||=l.NullLogger;let i=T(e)?new g(e):e,a=E(t)?new _(t):t;return l.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,l.createMessageConnection)(i,a,n,r)}t.createMessageConnection=D})),dc=o(((e,t)=>{t.exports=uc()})),X=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;let t=uc();var n;(function(e){e.clientToServer=`clientToServer`,e.serverToClient=`serverToClient`,e.both=`both`})(n||(e.MessageDirection=n={}));var r=class{constructor(e){this.method=e}};e.RegistrationType=r;var i=class extends t.RequestType0{constructor(e){super(e)}};e.ProtocolRequestType0=i;var a=class extends t.RequestType{constructor(e){super(e,t.ParameterStructures.byName)}};e.ProtocolRequestType=a;var o=class extends t.NotificationType0{constructor(e){super(e)}};e.ProtocolNotificationType0=o;var s=class extends t.NotificationType{constructor(e){super(e,t.ParameterStructures.byName)}};e.ProtocolNotificationType=s})),fc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.objectLiteral=e.typedArray=e.stringArray=e.array=e.func=e.error=e.number=e.string=e.boolean=void 0;function t(e){return e===!0||e===!1}e.boolean=t;function n(e){return typeof e==`string`||e instanceof String}e.string=n;function r(e){return typeof e==`number`||e instanceof Number}e.number=r;function i(e){return e instanceof Error}e.error=i;function a(e){return typeof e==`function`}e.func=a;function o(e){return Array.isArray(e)}e.array=o;function s(e){return o(e)&&e.every(e=>n(e))}e.stringArray=s;function c(e,t){return Array.isArray(e)&&e.every(t)}e.typedArray=c;function l(e){return typeof e==`object`&&!!e}e.objectLiteral=l})),pc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ImplementationRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/implementation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ImplementationRequest=n={}))})),mc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeDefinitionRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/typeDefinition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeDefinitionRequest=n={}))})),hc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;let t=X();var n;(function(e){e.method=`workspace/workspaceFolders`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(n||(e.WorkspaceFoldersRequest=n={}));var r;(function(e){e.method=`workspace/didChangeWorkspaceFolders`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(r||(e.DidChangeWorkspaceFoldersNotification=r={}))})),gc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConfigurationRequest=void 0;let t=X();var n;(function(e){e.method=`workspace/configuration`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ConfigurationRequest=n={}))})),_c=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/documentColor`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DocumentColorRequest=n={}));var r;(function(e){e.method=`textDocument/colorPresentation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.ColorPresentationRequest=r={}))})),vc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/foldingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.FoldingRangeRequest=n={}));var r;(function(e){e.method=`workspace/foldingRange/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(r||(e.FoldingRangeRefreshRequest=r={}))})),yc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeclarationRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/declaration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DeclarationRequest=n={}))})),bc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SelectionRangeRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/selectionRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.SelectionRangeRequest=n={}))})),xc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;let t=uc(),n=X();var r;(function(e){e.type=new t.ProgressType;function n(t){return t===e.type}e.is=n})(r||(e.WorkDoneProgress=r={}));var i;(function(e){e.method=`window/workDoneProgress/create`,e.messageDirection=n.MessageDirection.serverToClient,e.type=new n.ProtocolRequestType(e.method)})(i||(e.WorkDoneProgressCreateRequest=i={}));var a;(function(e){e.method=`window/workDoneProgress/cancel`,e.messageDirection=n.MessageDirection.clientToServer,e.type=new n.ProtocolNotificationType(e.method)})(a||(e.WorkDoneProgressCancelNotification=a={}))})),Sc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/prepareCallHierarchy`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.CallHierarchyPrepareRequest=n={}));var r;(function(e){e.method=`callHierarchy/incomingCalls`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.CallHierarchyIncomingCallsRequest=r={}));var i;(function(e){e.method=`callHierarchy/outgoingCalls`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.CallHierarchyOutgoingCallsRequest=i={}))})),Cc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;let t=X();var n;(function(e){e.Relative=`relative`})(n||(e.TokenFormat=n={}));var r;(function(e){e.method=`textDocument/semanticTokens`,e.type=new t.RegistrationType(e.method)})(r||(e.SemanticTokensRegistrationType=r={}));var i;(function(e){e.method=`textDocument/semanticTokens/full`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(i||(e.SemanticTokensRequest=i={}));var a;(function(e){e.method=`textDocument/semanticTokens/full/delta`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(a||(e.SemanticTokensDeltaRequest=a={}));var o;(function(e){e.method=`textDocument/semanticTokens/range`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method),e.registrationMethod=r.method})(o||(e.SemanticTokensRangeRequest=o={}));var s;(function(e){e.method=`workspace/semanticTokens/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(s||(e.SemanticTokensRefreshRequest=s={}))})),wc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ShowDocumentRequest=void 0;let t=X();var n;(function(e){e.method=`window/showDocument`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ShowDocumentRequest=n={}))})),Tc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedEditingRangeRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/linkedEditingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.LinkedEditingRangeRequest=n={}))})),Ec=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.DidRenameFilesNotification=e.WillRenameFilesRequest=e.DidCreateFilesNotification=e.WillCreateFilesRequest=e.FileOperationPatternKind=void 0;let t=X();var n;(function(e){e.file=`file`,e.folder=`folder`})(n||(e.FileOperationPatternKind=n={}));var r;(function(e){e.method=`workspace/willCreateFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.WillCreateFilesRequest=r={}));var i;(function(e){e.method=`workspace/didCreateFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(i||(e.DidCreateFilesNotification=i={}));var a;(function(e){e.method=`workspace/willRenameFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(a||(e.WillRenameFilesRequest=a={}));var o;(function(e){e.method=`workspace/didRenameFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(o||(e.DidRenameFilesNotification=o={}));var s;(function(e){e.method=`workspace/didDeleteFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(s||(e.DidDeleteFilesNotification=s={}));var c;(function(e){e.method=`workspace/willDeleteFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(c||(e.WillDeleteFilesRequest=c={}))})),Dc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;let t=X();var n;(function(e){e.document=`document`,e.project=`project`,e.group=`group`,e.scheme=`scheme`,e.global=`global`})(n||(e.UniquenessLevel=n={}));var r;(function(e){e.$import=`import`,e.$export=`export`,e.local=`local`})(r||(e.MonikerKind=r={}));var i;(function(e){e.method=`textDocument/moniker`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.MonikerRequest=i={}))})),Oc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/prepareTypeHierarchy`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeHierarchyPrepareRequest=n={}));var r;(function(e){e.method=`typeHierarchy/supertypes`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.TypeHierarchySupertypesRequest=r={}));var i;(function(e){e.method=`typeHierarchy/subtypes`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(i||(e.TypeHierarchySubtypesRequest=i={}))})),kc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/inlineValue`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineValueRequest=n={}));var r;(function(e){e.method=`workspace/inlineValue/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(r||(e.InlineValueRefreshRequest=r={}))})),Ac=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/inlayHint`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlayHintRequest=n={}));var r;(function(e){e.method=`inlayHint/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(r||(e.InlayHintResolveRequest=r={}));var i;(function(e){e.method=`workspace/inlayHint/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(i||(e.InlayHintRefreshRequest=i={}))})),jc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;let t=uc(),n=fc(),r=X();var i;(function(e){function t(e){let t=e;return t&&n.boolean(t.retriggerRequest)}e.is=t})(i||(e.DiagnosticServerCancellationData=i={}));var a;(function(e){e.Full=`full`,e.Unchanged=`unchanged`})(a||(e.DocumentDiagnosticReportKind=a={}));var o;(function(e){e.method=`textDocument/diagnostic`,e.messageDirection=r.MessageDirection.clientToServer,e.type=new r.ProtocolRequestType(e.method),e.partialResult=new t.ProgressType})(o||(e.DocumentDiagnosticRequest=o={}));var s;(function(e){e.method=`workspace/diagnostic`,e.messageDirection=r.MessageDirection.clientToServer,e.type=new r.ProtocolRequestType(e.method),e.partialResult=new t.ProgressType})(s||(e.WorkspaceDiagnosticRequest=s={}));var c;(function(e){e.method=`workspace/diagnostic/refresh`,e.messageDirection=r.MessageDirection.serverToClient,e.type=new r.ProtocolRequestType0(e.method)})(c||(e.DiagnosticRefreshRequest=c={}))})),Mc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=void 0;let t=(Qi(),r(wr)),n=fc(),i=X();var a;(function(e){e.Markup=1,e.Code=2;function t(e){return e===1||e===2}e.is=t})(a||(e.NotebookCellKind=a={}));var o;(function(e){function r(e,t){let n={executionOrder:e};return(t===!0||t===!1)&&(n.success=t),n}e.create=r;function i(e){let r=e;return n.objectLiteral(r)&&t.uinteger.is(r.executionOrder)&&(r.success===void 0||n.boolean(r.success))}e.is=i;function a(e,t){return e===t?!0:e==null||t==null?!1:e.executionOrder===t.executionOrder&&e.success===t.success}e.equals=a})(o||(e.ExecutionSummary=o={}));var s;(function(e){function r(e,t){return{kind:e,document:t}}e.create=r;function i(e){let r=e;return n.objectLiteral(r)&&a.is(r.kind)&&t.DocumentUri.is(r.document)&&(r.metadata===void 0||n.objectLiteral(r.metadata))}e.is=i;function s(e,t){let n=new Set;return e.document!==t.document&&n.add(`document`),e.kind!==t.kind&&n.add(`kind`),e.executionSummary!==t.executionSummary&&n.add(`executionSummary`),(e.metadata!==void 0||t.metadata!==void 0)&&!c(e.metadata,t.metadata)&&n.add(`metadata`),(e.executionSummary!==void 0||t.executionSummary!==void 0)&&!o.equals(e.executionSummary,t.executionSummary)&&n.add(`executionSummary`),n}e.diff=s;function c(e,t){if(e===t)return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`)return!1;let r=Array.isArray(e),i=Array.isArray(t);if(r!==i)return!1;if(r&&i){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!c(e[n],t[n]))return!1}if(n.objectLiteral(e)&&n.objectLiteral(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length||(n.sort(),r.sort(),!c(n,r)))return!1;for(let r=0;r<n.length;r++){let i=n[r];if(!c(e[i],t[i]))return!1}}return!0}})(s||(e.NotebookCell=s={}));var c;(function(e){function r(e,t,n,r){return{uri:e,notebookType:t,version:n,cells:r}}e.create=r;function i(e){let r=e;return n.objectLiteral(r)&&n.string(r.uri)&&t.integer.is(r.version)&&n.typedArray(r.cells,s.is)}e.is=i})(c||(e.NotebookDocument=c={}));var l;(function(e){e.method=`notebookDocument/sync`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.RegistrationType(e.method)})(l||(e.NotebookDocumentSyncRegistrationType=l={}));var u;(function(e){e.method=`notebookDocument/didOpen`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(u||(e.DidOpenNotebookDocumentNotification=u={}));var d;(function(e){function r(e){let r=e;return n.objectLiteral(r)&&t.uinteger.is(r.start)&&t.uinteger.is(r.deleteCount)&&(r.cells===void 0||n.typedArray(r.cells,s.is))}e.is=r;function i(e,t,n){let r={start:e,deleteCount:t};return n!==void 0&&(r.cells=n),r}e.create=i})(d||(e.NotebookCellArrayChange=d={}));var f;(function(e){e.method=`notebookDocument/didChange`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(f||(e.DidChangeNotebookDocumentNotification=f={}));var p;(function(e){e.method=`notebookDocument/didSave`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(p||(e.DidSaveNotebookDocumentNotification=p={}));var m;(function(e){e.method=`notebookDocument/didClose`,e.messageDirection=i.MessageDirection.clientToServer,e.type=new i.ProtocolNotificationType(e.method),e.registrationMethod=l.method})(m||(e.DidCloseNotebookDocumentNotification=m={}))})),Nc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineCompletionRequest=void 0;let t=X();var n;(function(e){e.method=`textDocument/inlineCompletion`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineCompletionRequest=n={}))})),Pc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkspaceSymbolRequest=e.CodeActionResolveRequest=e.CodeActionRequest=e.DocumentSymbolRequest=e.DocumentHighlightRequest=e.ReferencesRequest=e.DefinitionRequest=e.SignatureHelpRequest=e.SignatureHelpTriggerKind=e.HoverRequest=e.CompletionResolveRequest=e.CompletionRequest=e.CompletionTriggerKind=e.PublishDiagnosticsNotification=e.WatchKind=e.RelativePattern=e.FileChangeType=e.DidChangeWatchedFilesNotification=e.WillSaveTextDocumentWaitUntilRequest=e.WillSaveTextDocumentNotification=e.TextDocumentSaveReason=e.DidSaveTextDocumentNotification=e.DidCloseTextDocumentNotification=e.DidChangeTextDocumentNotification=e.TextDocumentContentChangeEvent=e.DidOpenTextDocumentNotification=e.TextDocumentSyncKind=e.TelemetryEventNotification=e.LogMessageNotification=e.ShowMessageRequest=e.ShowMessageNotification=e.MessageType=e.DidChangeConfigurationNotification=e.ExitNotification=e.ShutdownRequest=e.InitializedNotification=e.InitializeErrorCodes=e.InitializeRequest=e.WorkDoneProgressOptions=e.TextDocumentRegistrationOptions=e.StaticRegistrationOptions=e.PositionEncodingKind=e.FailureHandlingKind=e.ResourceOperationKind=e.UnregistrationRequest=e.RegistrationRequest=e.DocumentSelector=e.NotebookCellTextDocumentFilter=e.NotebookDocumentFilter=e.TextDocumentFilter=void 0,e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=e.WillDeleteFilesRequest=e.DidDeleteFilesNotification=e.WillRenameFilesRequest=e.DidRenameFilesNotification=e.WillCreateFilesRequest=e.DidCreateFilesNotification=e.FileOperationPatternKind=e.LinkedEditingRangeRequest=e.ShowDocumentRequest=e.SemanticTokensRegistrationType=e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.TokenFormat=e.CallHierarchyPrepareRequest=e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=e.SelectionRangeRequest=e.DeclarationRequest=e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=e.ColorPresentationRequest=e.DocumentColorRequest=e.ConfigurationRequest=e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=e.TypeDefinitionRequest=e.ImplementationRequest=e.ApplyWorkspaceEditRequest=e.ExecuteCommandRequest=e.PrepareRenameRequest=e.RenameRequest=e.PrepareSupportDefaultBehavior=e.DocumentOnTypeFormattingRequest=e.DocumentRangesFormattingRequest=e.DocumentRangeFormattingRequest=e.DocumentFormattingRequest=e.DocumentLinkResolveRequest=e.DocumentLinkRequest=e.CodeLensRefreshRequest=e.CodeLensResolveRequest=e.CodeLensRequest=e.WorkspaceSymbolResolveRequest=void 0,e.InlineCompletionRequest=e.DidCloseNotebookDocumentNotification=e.DidSaveNotebookDocumentNotification=e.DidChangeNotebookDocumentNotification=e.NotebookCellArrayChange=e.DidOpenNotebookDocumentNotification=e.NotebookDocumentSyncRegistrationType=e.NotebookDocument=e.NotebookCell=e.ExecutionSummary=e.NotebookCellKind=e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=e.InlineValueRefreshRequest=e.InlineValueRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchySubtypesRequest=e.TypeHierarchyPrepareRequest=void 0;let t=X(),n=(Qi(),r(wr)),i=fc(),a=pc();Object.defineProperty(e,`ImplementationRequest`,{enumerable:!0,get:function(){return a.ImplementationRequest}});let o=mc();Object.defineProperty(e,`TypeDefinitionRequest`,{enumerable:!0,get:function(){return o.TypeDefinitionRequest}});let s=hc();Object.defineProperty(e,`WorkspaceFoldersRequest`,{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,`DidChangeWorkspaceFoldersNotification`,{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});let c=gc();Object.defineProperty(e,`ConfigurationRequest`,{enumerable:!0,get:function(){return c.ConfigurationRequest}});let l=_c();Object.defineProperty(e,`DocumentColorRequest`,{enumerable:!0,get:function(){return l.DocumentColorRequest}}),Object.defineProperty(e,`ColorPresentationRequest`,{enumerable:!0,get:function(){return l.ColorPresentationRequest}});let u=vc();Object.defineProperty(e,`FoldingRangeRequest`,{enumerable:!0,get:function(){return u.FoldingRangeRequest}}),Object.defineProperty(e,`FoldingRangeRefreshRequest`,{enumerable:!0,get:function(){return u.FoldingRangeRefreshRequest}});let d=yc();Object.defineProperty(e,`DeclarationRequest`,{enumerable:!0,get:function(){return d.DeclarationRequest}});let f=bc();Object.defineProperty(e,`SelectionRangeRequest`,{enumerable:!0,get:function(){return f.SelectionRangeRequest}});let p=xc();Object.defineProperty(e,`WorkDoneProgress`,{enumerable:!0,get:function(){return p.WorkDoneProgress}}),Object.defineProperty(e,`WorkDoneProgressCreateRequest`,{enumerable:!0,get:function(){return p.WorkDoneProgressCreateRequest}}),Object.defineProperty(e,`WorkDoneProgressCancelNotification`,{enumerable:!0,get:function(){return p.WorkDoneProgressCancelNotification}});let m=Sc();Object.defineProperty(e,`CallHierarchyIncomingCallsRequest`,{enumerable:!0,get:function(){return m.CallHierarchyIncomingCallsRequest}}),Object.defineProperty(e,`CallHierarchyOutgoingCallsRequest`,{enumerable:!0,get:function(){return m.CallHierarchyOutgoingCallsRequest}}),Object.defineProperty(e,`CallHierarchyPrepareRequest`,{enumerable:!0,get:function(){return m.CallHierarchyPrepareRequest}});let h=Cc();Object.defineProperty(e,`TokenFormat`,{enumerable:!0,get:function(){return h.TokenFormat}}),Object.defineProperty(e,`SemanticTokensRequest`,{enumerable:!0,get:function(){return h.SemanticTokensRequest}}),Object.defineProperty(e,`SemanticTokensDeltaRequest`,{enumerable:!0,get:function(){return h.SemanticTokensDeltaRequest}}),Object.defineProperty(e,`SemanticTokensRangeRequest`,{enumerable:!0,get:function(){return h.SemanticTokensRangeRequest}}),Object.defineProperty(e,`SemanticTokensRefreshRequest`,{enumerable:!0,get:function(){return h.SemanticTokensRefreshRequest}}),Object.defineProperty(e,`SemanticTokensRegistrationType`,{enumerable:!0,get:function(){return h.SemanticTokensRegistrationType}});let g=wc();Object.defineProperty(e,`ShowDocumentRequest`,{enumerable:!0,get:function(){return g.ShowDocumentRequest}});let _=Tc();Object.defineProperty(e,`LinkedEditingRangeRequest`,{enumerable:!0,get:function(){return _.LinkedEditingRangeRequest}});let v=Ec();Object.defineProperty(e,`FileOperationPatternKind`,{enumerable:!0,get:function(){return v.FileOperationPatternKind}}),Object.defineProperty(e,`DidCreateFilesNotification`,{enumerable:!0,get:function(){return v.DidCreateFilesNotification}}),Object.defineProperty(e,`WillCreateFilesRequest`,{enumerable:!0,get:function(){return v.WillCreateFilesRequest}}),Object.defineProperty(e,`DidRenameFilesNotification`,{enumerable:!0,get:function(){return v.DidRenameFilesNotification}}),Object.defineProperty(e,`WillRenameFilesRequest`,{enumerable:!0,get:function(){return v.WillRenameFilesRequest}}),Object.defineProperty(e,`DidDeleteFilesNotification`,{enumerable:!0,get:function(){return v.DidDeleteFilesNotification}}),Object.defineProperty(e,`WillDeleteFilesRequest`,{enumerable:!0,get:function(){return v.WillDeleteFilesRequest}});let y=Dc();Object.defineProperty(e,`UniquenessLevel`,{enumerable:!0,get:function(){return y.UniquenessLevel}}),Object.defineProperty(e,`MonikerKind`,{enumerable:!0,get:function(){return y.MonikerKind}}),Object.defineProperty(e,`MonikerRequest`,{enumerable:!0,get:function(){return y.MonikerRequest}});let b=Oc();Object.defineProperty(e,`TypeHierarchyPrepareRequest`,{enumerable:!0,get:function(){return b.TypeHierarchyPrepareRequest}}),Object.defineProperty(e,`TypeHierarchySubtypesRequest`,{enumerable:!0,get:function(){return b.TypeHierarchySubtypesRequest}}),Object.defineProperty(e,`TypeHierarchySupertypesRequest`,{enumerable:!0,get:function(){return b.TypeHierarchySupertypesRequest}});let x=kc();Object.defineProperty(e,`InlineValueRequest`,{enumerable:!0,get:function(){return x.InlineValueRequest}}),Object.defineProperty(e,`InlineValueRefreshRequest`,{enumerable:!0,get:function(){return x.InlineValueRefreshRequest}});let S=Ac();Object.defineProperty(e,`InlayHintRequest`,{enumerable:!0,get:function(){return S.InlayHintRequest}}),Object.defineProperty(e,`InlayHintResolveRequest`,{enumerable:!0,get:function(){return S.InlayHintResolveRequest}}),Object.defineProperty(e,`InlayHintRefreshRequest`,{enumerable:!0,get:function(){return S.InlayHintRefreshRequest}});let C=jc();Object.defineProperty(e,`DiagnosticServerCancellationData`,{enumerable:!0,get:function(){return C.DiagnosticServerCancellationData}}),Object.defineProperty(e,`DocumentDiagnosticReportKind`,{enumerable:!0,get:function(){return C.DocumentDiagnosticReportKind}}),Object.defineProperty(e,`DocumentDiagnosticRequest`,{enumerable:!0,get:function(){return C.DocumentDiagnosticRequest}}),Object.defineProperty(e,`WorkspaceDiagnosticRequest`,{enumerable:!0,get:function(){return C.WorkspaceDiagnosticRequest}}),Object.defineProperty(e,`DiagnosticRefreshRequest`,{enumerable:!0,get:function(){return C.DiagnosticRefreshRequest}});let w=Mc();Object.defineProperty(e,`NotebookCellKind`,{enumerable:!0,get:function(){return w.NotebookCellKind}}),Object.defineProperty(e,`ExecutionSummary`,{enumerable:!0,get:function(){return w.ExecutionSummary}}),Object.defineProperty(e,`NotebookCell`,{enumerable:!0,get:function(){return w.NotebookCell}}),Object.defineProperty(e,`NotebookDocument`,{enumerable:!0,get:function(){return w.NotebookDocument}}),Object.defineProperty(e,`NotebookDocumentSyncRegistrationType`,{enumerable:!0,get:function(){return w.NotebookDocumentSyncRegistrationType}}),Object.defineProperty(e,`DidOpenNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidOpenNotebookDocumentNotification}}),Object.defineProperty(e,`NotebookCellArrayChange`,{enumerable:!0,get:function(){return w.NotebookCellArrayChange}}),Object.defineProperty(e,`DidChangeNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidChangeNotebookDocumentNotification}}),Object.defineProperty(e,`DidSaveNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidSaveNotebookDocumentNotification}}),Object.defineProperty(e,`DidCloseNotebookDocumentNotification`,{enumerable:!0,get:function(){return w.DidCloseNotebookDocumentNotification}});let T=Nc();Object.defineProperty(e,`InlineCompletionRequest`,{enumerable:!0,get:function(){return T.InlineCompletionRequest}});var E;(function(e){function t(e){let t=e;return i.string(t)||i.string(t.language)||i.string(t.scheme)||i.string(t.pattern)}e.is=t})(E||(e.TextDocumentFilter=E={}));var D;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebookType)||i.string(t.scheme)||i.string(t.pattern))}e.is=t})(D||(e.NotebookDocumentFilter=D={}));var O;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebook)||D.is(t.notebook))&&(t.language===void 0||i.string(t.language))}e.is=t})(O||(e.NotebookCellTextDocumentFilter=O={}));var ee;(function(e){function t(e){if(!Array.isArray(e))return!1;for(let t of e)if(!i.string(t)&&!E.is(t)&&!O.is(t))return!1;return!0}e.is=t})(ee||(e.DocumentSelector=ee={}));var te;(function(e){e.method=`client/registerCapability`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(te||(e.RegistrationRequest=te={}));var k;(function(e){e.method=`client/unregisterCapability`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(k||(e.UnregistrationRequest=k={}));var A;(function(e){e.Create=`create`,e.Rename=`rename`,e.Delete=`delete`})(A||(e.ResourceOperationKind=A={}));var j;(function(e){e.Abort=`abort`,e.Transactional=`transactional`,e.TextOnlyTransactional=`textOnlyTransactional`,e.Undo=`undo`})(j||(e.FailureHandlingKind=j={}));var ne;(function(e){e.UTF8=`utf-8`,e.UTF16=`utf-16`,e.UTF32=`utf-32`})(ne||(e.PositionEncodingKind=ne={}));var M;(function(e){function t(e){let t=e;return t&&i.string(t.id)&&t.id.length>0}e.hasId=t})(M||(e.StaticRegistrationOptions=M={}));var re;(function(e){function t(e){let t=e;return t&&(t.documentSelector===null||ee.is(t.documentSelector))}e.is=t})(re||(e.TextDocumentRegistrationOptions=re={}));var ie;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(t.workDoneProgress===void 0||i.boolean(t.workDoneProgress))}e.is=t;function n(e){let t=e;return t&&i.boolean(t.workDoneProgress)}e.hasWorkDoneProgress=n})(ie||(e.WorkDoneProgressOptions=ie={}));var N;(function(e){e.method=`initialize`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(N||(e.InitializeRequest=N={}));var P;(function(e){e.unknownProtocolVersion=1})(P||(e.InitializeErrorCodes=P={}));var F;(function(e){e.method=`initialized`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(F||(e.InitializedNotification=F={}));var I;(function(e){e.method=`shutdown`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType0(e.method)})(I||(e.ShutdownRequest=I={}));var L;(function(e){e.method=`exit`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType0(e.method)})(L||(e.ExitNotification=L={}));var ae;(function(e){e.method=`workspace/didChangeConfiguration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ae||(e.DidChangeConfigurationNotification=ae={}));var oe;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(oe||(e.MessageType=oe={}));var se;(function(e){e.method=`window/showMessage`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(se||(e.ShowMessageNotification=se={}));var ce;(function(e){e.method=`window/showMessageRequest`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(ce||(e.ShowMessageRequest=ce={}));var le;(function(e){e.method=`window/logMessage`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(le||(e.LogMessageNotification=le={}));var ue;(function(e){e.method=`telemetry/event`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(ue||(e.TelemetryEventNotification=ue={}));var de;(function(e){e.None=0,e.Full=1,e.Incremental=2})(de||(e.TextDocumentSyncKind=de={}));var fe;(function(e){e.method=`textDocument/didOpen`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(fe||(e.DidOpenTextDocumentNotification=fe={}));var pe;(function(e){function t(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength==`number`)}e.isIncremental=t;function n(e){let t=e;return t!=null&&typeof t.text==`string`&&t.range===void 0&&t.rangeLength===void 0}e.isFull=n})(pe||(e.TextDocumentContentChangeEvent=pe={}));var me;(function(e){e.method=`textDocument/didChange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(me||(e.DidChangeTextDocumentNotification=me={}));var he;(function(e){e.method=`textDocument/didClose`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(he||(e.DidCloseTextDocumentNotification=he={}));var ge;(function(e){e.method=`textDocument/didSave`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ge||(e.DidSaveTextDocumentNotification=ge={}));var _e;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(_e||(e.TextDocumentSaveReason=_e={}));var ve;(function(e){e.method=`textDocument/willSave`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ve||(e.WillSaveTextDocumentNotification=ve={}));var ye;(function(e){e.method=`textDocument/willSaveWaitUntil`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(ye||(e.WillSaveTextDocumentWaitUntilRequest=ye={}));var be;(function(e){e.method=`workspace/didChangeWatchedFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(be||(e.DidChangeWatchedFilesNotification=be={}));var xe;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(xe||(e.FileChangeType=xe={}));var Se;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(n.URI.is(t.baseUri)||n.WorkspaceFolder.is(t.baseUri))&&i.string(t.pattern)}e.is=t})(Se||(e.RelativePattern=Se={}));var Ce;(function(e){e.Create=1,e.Change=2,e.Delete=4})(Ce||(e.WatchKind=Ce={}));var we;(function(e){e.method=`textDocument/publishDiagnostics`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(we||(e.PublishDiagnosticsNotification=we={}));var Te;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(Te||(e.CompletionTriggerKind=Te={}));var Ee;(function(e){e.method=`textDocument/completion`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ee||(e.CompletionRequest=Ee={}));var De;(function(e){e.method=`completionItem/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(De||(e.CompletionResolveRequest=De={}));var Oe;(function(e){e.method=`textDocument/hover`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Oe||(e.HoverRequest=Oe={}));var ke;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(ke||(e.SignatureHelpTriggerKind=ke={}));var Ae;(function(e){e.method=`textDocument/signatureHelp`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ae||(e.SignatureHelpRequest=Ae={}));var je;(function(e){e.method=`textDocument/definition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(je||(e.DefinitionRequest=je={}));var Me;(function(e){e.method=`textDocument/references`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Me||(e.ReferencesRequest=Me={}));var Ne;(function(e){e.method=`textDocument/documentHighlight`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ne||(e.DocumentHighlightRequest=Ne={}));var Pe;(function(e){e.method=`textDocument/documentSymbol`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Pe||(e.DocumentSymbolRequest=Pe={}));var Fe;(function(e){e.method=`textDocument/codeAction`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Fe||(e.CodeActionRequest=Fe={}));var Ie;(function(e){e.method=`codeAction/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ie||(e.CodeActionResolveRequest=Ie={}));var Le;(function(e){e.method=`workspace/symbol`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Le||(e.WorkspaceSymbolRequest=Le={}));var Re;(function(e){e.method=`workspaceSymbol/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Re||(e.WorkspaceSymbolResolveRequest=Re={}));var ze;(function(e){e.method=`textDocument/codeLens`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(ze||(e.CodeLensRequest=ze={}));var Be;(function(e){e.method=`codeLens/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Be||(e.CodeLensResolveRequest=Be={}));var Ve;(function(e){e.method=`workspace/codeLens/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(Ve||(e.CodeLensRefreshRequest=Ve={}));var He;(function(e){e.method=`textDocument/documentLink`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(He||(e.DocumentLinkRequest=He={}));var Ue;(function(e){e.method=`documentLink/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ue||(e.DocumentLinkResolveRequest=Ue={}));var We;(function(e){e.method=`textDocument/formatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(We||(e.DocumentFormattingRequest=We={}));var Ge;(function(e){e.method=`textDocument/rangeFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ge||(e.DocumentRangeFormattingRequest=Ge={}));var Ke;(function(e){e.method=`textDocument/rangesFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ke||(e.DocumentRangesFormattingRequest=Ke={}));var qe;(function(e){e.method=`textDocument/onTypeFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(qe||(e.DocumentOnTypeFormattingRequest=qe={}));var Je;(function(e){e.Identifier=1})(Je||(e.PrepareSupportDefaultBehavior=Je={}));var Ye;(function(e){e.method=`textDocument/rename`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ye||(e.RenameRequest=Ye={}));var Xe;(function(e){e.method=`textDocument/prepareRename`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Xe||(e.PrepareRenameRequest=Xe={}));var Ze;(function(e){e.method=`workspace/executeCommand`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ze||(e.ExecuteCommandRequest=Ze={}));var Qe;(function(e){e.method=`workspace/applyEdit`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(`workspace/applyEdit`)})(Qe||(e.ApplyWorkspaceEditRequest=Qe={}))})),Fc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createProtocolConnection=void 0;let t=uc();function n(e,n,r,i){return t.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,t.createMessageConnection)(e,n,r,i)}e.createProtocolConnection=n})),Ic=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.LSPErrorCodes=e.createProtocolConnection=void 0,n(uc(),e),n((Qi(),r(wr)),e),n(X(),e),n(Pc(),e);var i=Fc();Object.defineProperty(e,`createProtocolConnection`,{enumerable:!0,get:function(){return i.createProtocolConnection}});var a;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(a||(e.LSPErrorCodes=a={}))})),Z=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.createProtocolConnection=void 0;let r=dc();n(dc(),e),n(Ic(),e);function i(e,t,n,i){return(0,r.createMessageConnection)(e,t,n,i)}e.createProtocolConnection=i})),Lc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.generateUuid=e.parse=e.isUUID=e.v4=e.empty=void 0;var t=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},n=class e extends t{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return e._oneOf(e._chars)}constructor(){super([e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),`-`,e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),`-`,`4`,e._randomHex(),e._randomHex(),e._randomHex(),`-`,e._oneOf(e._timeHighBits),e._randomHex(),e._randomHex(),e._randomHex(),`-`,e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex(),e._randomHex()].join(``))}};n._chars=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`6`,`7`,`8`,`9`,`a`,`b`,`c`,`d`,`e`,`f`],n._timeHighBits=[`8`,`9`,`a`,`b`],e.empty=new t(`00000000-0000-0000-0000-000000000000`);function r(){return new n}e.v4=r;let i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function a(e){return i.test(e)}e.isUUID=a;function o(e){if(!a(e))throw Error(`invalid uuid`);return new t(e)}e.parse=o;function s(){return r().asHex()}e.generateUuid=s})),Rc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.attachPartialResult=e.ProgressFeature=e.attachWorkDone=void 0;let t=Z(),n=Lc();var r=class e{constructor(t,n){this._connection=t,this._token=n,e.Instances.set(this._token,this)}begin(e,n,r,i){let a={kind:`begin`,title:e,percentage:n,message:r,cancellable:i};this._connection.sendProgress(t.WorkDoneProgress.type,this._token,a)}report(e,n){let r={kind:`report`};typeof e==`number`?(r.percentage=e,n!==void 0&&(r.message=n)):r.message=e,this._connection.sendProgress(t.WorkDoneProgress.type,this._token,r)}done(){e.Instances.delete(this._token),this._connection.sendProgress(t.WorkDoneProgress.type,this._token,{kind:`end`})}};r.Instances=new Map;var i=class extends r{constructor(e,n){super(e,n),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},a=class{constructor(){}begin(){}report(){}done(){}},o=class extends a{constructor(){super(),this._source=new t.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function s(e,t){if(t===void 0||t.workDoneToken===void 0)return new a;let n=t.workDoneToken;return delete t.workDoneToken,new r(e,n)}e.attachWorkDone=s;let c=e=>class extends e{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(t.WorkDoneProgressCancelNotification.type,e=>{let t=r.Instances.get(e.token);(t instanceof i||t instanceof o)&&t.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new a:new r(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,n.generateUuid)();return this.connection.sendRequest(t.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new i(this.connection,e))}else return Promise.resolve(new o)}};e.ProgressFeature=c;var l;(function(e){e.type=new t.ProgressType})(l||={});var u=class{constructor(e,t){this._connection=e,this._token=t}report(e){this._connection.sendProgress(l.type,this._token,e)}};function d(e,t){if(t===void 0||t.partialResultToken===void 0)return;let n=t.partialResultToken;return delete t.partialResultToken,new u(e,n)}e.attachPartialResult=d})),zc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConfigurationFeature=void 0;let t=Z(),n=Qs(),r=e=>class extends e{getConfiguration(e){return e?n.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let n={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(t.ConfigurationRequest.type,n).then(t=>Array.isArray(t)?Array.isArray(e)?t:t[0]:Array.isArray(e)?[]:null)}};e.ConfigurationFeature=r})),Bc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkspaceFoldersFeature=void 0;let t=Z(),n=e=>class extends e{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let n=e.workspace;n&&n.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new t.Emitter,this.connection.onNotification(t.DidChangeWorkspaceFoldersNotification.type,e=>{this._onDidChangeWorkspaceFolders.fire(e.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let t=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=t===!0||typeof t==`string`}getWorkspaceFolders(){return this.connection.sendRequest(t.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw Error(`Client doesn't support sending workspace folder change events.`);return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(t.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};e.WorkspaceFoldersFeature=n})),Vc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CallHierarchyFeature=void 0;let t=Z(),n=e=>class extends e{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(t.CallHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onIncomingCalls:e=>{let n=t.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onOutgoingCalls:e=>{let n=t.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}};e.CallHierarchyFeature=n})),Hc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SemanticTokensBuilder=e.SemanticTokensDiff=e.SemanticTokensFeature=void 0;let t=Z(),n=e=>class extends e{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(t.SemanticTokensRefreshRequest.type),on:e=>{let n=t.SemanticTokensRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onDelta:e=>{let n=t.SemanticTokensDeltaRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onRange:e=>{let n=t.SemanticTokensRangeRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}};e.SemanticTokensFeature=n;var r=class{constructor(e,t){this.originalSequence=e,this.modifiedSequence=t}computeDiff(){let e=this.originalSequence.length,t=this.modifiedSequence.length,n=0;for(;n<t&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<t&&n<e){let r=e-1,i=t-1;for(;r>=n&&i>=n&&this.originalSequence[r]===this.modifiedSequence[i];)r--,i--;(r<n||i<n)&&(r++,i++);let a=r-n+1,o=this.modifiedSequence.slice(n,i+1);return o.length===1&&o[0]===this.originalSequence[r]?[{start:n,deleteCount:a-1}]:[{start:n,deleteCount:a,data:o}]}else if(n<t)return[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}];else if(n<e)return[{start:n,deleteCount:e-n}];else return[]}};e.SemanticTokensDiff=r;var i=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,t,n,r,i){let a=e,o=t;this._dataLen>0&&(a-=this._prevLine,a===0&&(o-=this._prevChar)),this._data[this._dataLen++]=a,this._data[this._dataLen++]=o,this._data[this._dataLen++]=n,this._data[this._dataLen++]=r,this._data[this._dataLen++]=i,this._prevLine=e,this._prevChar=t}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData===void 0?this.build():{resultId:this.id,edits:new r(this._prevData,this._data).computeDiff()}}};e.SemanticTokensBuilder=i})),Uc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ShowDocumentFeature=void 0;let t=Z(),n=e=>class extends e{showDocument(e){return this.connection.sendRequest(t.ShowDocumentRequest.type,e)}};e.ShowDocumentFeature=n})),Wc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FileOperationsFeature=void 0;let t=Z(),n=e=>class extends e{onDidCreateFiles(e){return this.connection.onNotification(t.DidCreateFilesNotification.type,t=>{e(t)})}onDidRenameFiles(e){return this.connection.onNotification(t.DidRenameFilesNotification.type,t=>{e(t)})}onDidDeleteFiles(e){return this.connection.onNotification(t.DidDeleteFilesNotification.type,t=>{e(t)})}onWillCreateFiles(e){return this.connection.onRequest(t.WillCreateFilesRequest.type,(t,n)=>e(t,n))}onWillRenameFiles(e){return this.connection.onRequest(t.WillRenameFilesRequest.type,(t,n)=>e(t,n))}onWillDeleteFiles(e){return this.connection.onRequest(t.WillDeleteFilesRequest.type,(t,n)=>e(t,n))}};e.FileOperationsFeature=n})),Gc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedEditingRangeFeature=void 0;let t=Z(),n=e=>class extends e{onLinkedEditingRange(e){return this.connection.onRequest(t.LinkedEditingRangeRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0))}};e.LinkedEditingRangeFeature=n})),Kc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHierarchyFeature=void 0;let t=Z(),n=e=>class extends e{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest(t.TypeHierarchyPrepareRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0)),onSupertypes:e=>{let n=t.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))},onSubtypes:e=>{let n=t.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}};e.TypeHierarchyFeature=n})),qc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineValueFeature=void 0;let t=Z(),n=e=>class extends e{get inlineValue(){return{refresh:()=>this.connection.sendRequest(t.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(t.InlineValueRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}};e.InlineValueFeature=n})),Jc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FoldingRangeFeature=void 0;let t=Z(),n=e=>class extends e{get foldingRange(){return{refresh:()=>this.connection.sendRequest(t.FoldingRangeRefreshRequest.type),on:e=>{let n=t.FoldingRangeRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}};e.FoldingRangeFeature=n})),Yc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlayHintFeature=void 0;let t=Z(),n=e=>class extends e{get inlayHint(){return{refresh:()=>this.connection.sendRequest(t.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(t.InlayHintRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t))),resolve:e=>this.connection.onRequest(t.InlayHintResolveRequest.type,(t,n)=>e(t,n))}}};e.InlayHintFeature=n})),Xc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiagnosticFeature=void 0;let t=Z(),n=e=>class extends e{get diagnostics(){return{refresh:()=>this.connection.sendRequest(t.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(t.DocumentDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t.DocumentDiagnosticRequest.partialResult,n))),onWorkspace:e=>this.connection.onRequest(t.WorkspaceDiagnosticRequest.type,(n,r)=>e(n,r,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(t.WorkspaceDiagnosticRequest.partialResult,n)))}}};e.DiagnosticFeature=n})),Zc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TextDocuments=void 0;let t=Z();var n=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new t.Emitter,this._onDidOpen=new t.Emitter,this._onDidClose=new t.Emitter,this._onDidSave=new t.Emitter,this._onWillSave=new t.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=t.TextDocumentSyncKind.Incremental;let n=[];return n.push(e.onDidOpenTextDocument(e=>{let t=e.textDocument,n=this._configuration.create(t.uri,t.languageId,t.version,t.text);this._syncedDocuments.set(t.uri,n);let r=Object.freeze({document:n});this._onDidOpen.fire(r),this._onDidChangeContent.fire(r)})),n.push(e.onDidChangeTextDocument(e=>{let t=e.textDocument,n=e.contentChanges;if(n.length===0)return;let{version:r}=t;if(r==null)throw Error(`Received document change event for ${t.uri} without valid version identifier`);let i=this._syncedDocuments.get(t.uri);i!==void 0&&(i=this._configuration.update(i,n,r),this._syncedDocuments.set(t.uri,i),this._onDidChangeContent.fire(Object.freeze({document:i})))})),n.push(e.onDidCloseTextDocument(e=>{let t=this._syncedDocuments.get(e.textDocument.uri);t!==void 0&&(this._syncedDocuments.delete(e.textDocument.uri),this._onDidClose.fire(Object.freeze({document:t})))})),n.push(e.onWillSaveTextDocument(e=>{let t=this._syncedDocuments.get(e.textDocument.uri);t!==void 0&&this._onWillSave.fire(Object.freeze({document:t,reason:e.reason}))})),n.push(e.onWillSaveTextDocumentWaitUntil((e,t)=>{let n=this._syncedDocuments.get(e.textDocument.uri);return n!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:n,reason:e.reason}),t):[]})),n.push(e.onDidSaveTextDocument(e=>{let t=this._syncedDocuments.get(e.textDocument.uri);t!==void 0&&this._onDidSave.fire(Object.freeze({document:t}))})),t.Disposable.create(()=>{n.forEach(e=>e.dispose())})}};e.TextDocuments=n})),Qc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NotebookDocuments=e.NotebookSyncFeature=void 0;let t=Z(),n=Zc(),r=e=>class extends e{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(t.DidOpenNotebookDocumentNotification.type,t=>{e(t)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(t.DidChangeNotebookDocumentNotification.type,t=>{e(t)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(t.DidSaveNotebookDocumentNotification.type,t=>{e(t)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(t.DidCloseNotebookDocumentNotification.type,t=>{e(t)})}}};e.NotebookSyncFeature=r;var i=class e{onDidOpenTextDocument(e){return this.openHandler=e,t.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,t.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,t.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}};i.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var a=class{constructor(e){e instanceof n.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new n.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new t.Emitter,this._onDidChange=new t.Emitter,this._onDidSave=new t.Emitter,this._onDidClose=new t.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let t=this.notebookCellMap.get(e);return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e==`string`?e:e.document,n=this.notebookCellMap.get(t);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let n=new i,r=[];return r.push(this.cellTextDocuments.listen(n)),r.push(e.notebooks.synchronization.onDidOpenNotebookDocument(e=>{this.notebookDocuments.set(e.notebookDocument.uri,e.notebookDocument);for(let t of e.cellTextDocuments)n.openTextDocument({textDocument:t});this.updateCellMap(e.notebookDocument),this._onDidOpen.fire(e.notebookDocument)})),r.push(e.notebooks.synchronization.onDidChangeNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);if(t===void 0)return;t.version=e.notebookDocument.version;let r=t.metadata,i=!1,a=e.change;a.metadata!==void 0&&(i=!0,t.metadata=a.metadata);let o=[],s=[],c=[],l=[];if(a.cells!==void 0){let e=a.cells;if(e.structure!==void 0){let r=e.structure.array;if(t.cells.splice(r.start,r.deleteCount,...r.cells===void 0?[]:r.cells),e.structure.didOpen!==void 0)for(let t of e.structure.didOpen)n.openTextDocument({textDocument:t}),o.push(t.uri);if(e.structure.didClose)for(let t of e.structure.didClose)n.closeTextDocument({textDocument:t}),s.push(t.uri)}if(e.data!==void 0){let n=new Map(e.data.map(e=>[e.document,e]));for(let e=0;e<=t.cells.length;e++){let r=n.get(t.cells[e].document);if(r!==void 0){let i=t.cells.splice(e,1,r);if(c.push({old:i[0],new:r}),n.delete(r.document),n.size===0)break}}}if(e.textContent!==void 0)for(let t of e.textContent)n.changeTextDocument({textDocument:t.document,contentChanges:t.changes}),l.push(t.document.uri)}this.updateCellMap(t);let u={notebookDocument:t};i&&(u.metadata={old:r,new:t.metadata});let d=[];for(let e of o)d.push(this.getNotebookCell(e));let f=[];for(let e of s)f.push(this.getNotebookCell(e));let p=[];for(let e of l)p.push(this.getNotebookCell(e));(d.length>0||f.length>0||c.length>0||p.length>0)&&(u.cells={added:d,removed:f,changed:{data:c,textContent:p}}),(u.metadata!==void 0||u.cells!==void 0)&&this._onDidChange.fire(u)})),r.push(e.notebooks.synchronization.onDidSaveNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);t!==void 0&&this._onDidSave.fire(t)})),r.push(e.notebooks.synchronization.onDidCloseNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);if(t!==void 0){this._onDidClose.fire(t);for(let t of e.cellTextDocuments)n.closeTextDocument({textDocument:t});this.notebookDocuments.delete(e.notebookDocument.uri);for(let e of t.cells)this.notebookCellMap.delete(e.document)}})),t.Disposable.create(()=>{r.forEach(e=>e.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}};e.NotebookDocuments=a})),$c=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MonikerFeature=void 0;let t=Z(),n=e=>class extends e{get moniker(){return{on:e=>{let n=t.MonikerRequest.type;return this.connection.onRequest(n,(t,r)=>e(t,r,this.attachWorkDoneProgress(t),this.attachPartialResultProgress(n,t)))}}}};e.MonikerFeature=n})),el=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createConnection=e.combineFeatures=e.combineNotebooksFeatures=e.combineLanguagesFeatures=e.combineWorkspaceFeatures=e.combineWindowFeatures=e.combineClientFeatures=e.combineTracerFeatures=e.combineTelemetryFeatures=e.combineConsoleFeatures=e._NotebooksImpl=e._LanguagesImpl=e.BulkUnregistration=e.BulkRegistration=e.ErrorMessageTracker=void 0;let t=Z(),n=Qs(),r=Lc(),i=Rc(),a=zc(),o=Bc(),s=Vc(),c=Hc(),l=Uc(),u=Wc(),d=Gc(),f=Kc(),p=qc(),m=Jc(),h=Yc(),g=Xc(),_=Qc(),v=$c();function y(e){if(e!==null)return e}var b=class{constructor(){this._messages=Object.create(null)}add(e){let t=this._messages[e];t||=0,t++,this._messages[e]=t}sendErrors(e){Object.keys(this._messages).forEach(t=>{e.window.showErrorMessage(t)})}};e.ErrorMessageTracker=b;var x=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(t.MessageType.Error,e)}warn(e){this.send(t.MessageType.Warning,e)}info(e){this.send(t.MessageType.Info,e)}log(e){this.send(t.MessageType.Log,e)}debug(e){this.send(t.MessageType.Debug,e)}send(e,n){this._rawConnection&&this._rawConnection.sendNotification(t.LogMessageNotification.type,{type:e,message:n}).catch(()=>{(0,t.RAL)().console.error(`Sending log message failed`)})}},S=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...n){let r={type:t.MessageType.Error,message:e,actions:n};return this.connection.sendRequest(t.ShowMessageRequest.type,r).then(y)}showWarningMessage(e,...n){let r={type:t.MessageType.Warning,message:e,actions:n};return this.connection.sendRequest(t.ShowMessageRequest.type,r).then(y)}showInformationMessage(e,...n){let r={type:t.MessageType.Info,message:e,actions:n};return this.connection.sendRequest(t.ShowMessageRequest.type,r).then(y)}};let C=(0,l.ShowDocumentFeature)((0,i.ProgressFeature)(S));var w;(function(e){function t(){return new T}e.create=t})(w||(e.BulkRegistration=w={}));var T=class{constructor(){this._registrations=[],this._registered=new Set}add(e,t){let i=n.string(e)?e:e.method;if(this._registered.has(i))throw Error(`${i} is already added to this registration`);let a=r.generateUuid();this._registrations.push({id:a,method:i,registerOptions:t||{}}),this._registered.add(i)}asRegistrationParams(){return{registrations:this._registrations}}},E;(function(e){function t(){return new D(void 0,[])}e.create=t})(E||(e.BulkUnregistration=E={}));var D=class{constructor(e,t){this._connection=e,this._unregistrations=new Map,t.forEach(e=>{this._unregistrations.set(e.method,e)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let t of this._unregistrations.values())e.push(t);let n={unregisterations:e};this._connection.sendRequest(t.UnregistrationRequest.type,n).catch(()=>{this._connection.console.info(`Bulk unregistration failed.`)})}disposeSingle(e){let r=n.string(e)?e:e.method,i=this._unregistrations.get(r);if(!i)return!1;let a={unregisterations:[i]};return this._connection.sendRequest(t.UnregistrationRequest.type,a).then(()=>{this._unregistrations.delete(r)},e=>{this._connection.console.info(`Un-registering request handler for ${i.id} failed.`)}),!0}},O=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,t,n){return e instanceof T?this.registerMany(e):e instanceof D?this.registerSingle1(e,t,n):this.registerSingle2(e,t)}registerSingle1(e,i,a){let o=n.string(i)?i:i.method,s=r.generateUuid(),c={registrations:[{id:s,method:o,registerOptions:a||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(t.RegistrationRequest.type,c).then(t=>(e.add({id:s,method:o}),e),e=>(this.connection.console.info(`Registering request handler for ${o} failed.`),Promise.reject(e)))}registerSingle2(e,i){let a=n.string(e)?e:e.method,o=r.generateUuid(),s={registrations:[{id:o,method:a,registerOptions:i||{}}]};return this.connection.sendRequest(t.RegistrationRequest.type,s).then(e=>t.Disposable.create(()=>{this.unregisterSingle(o,a).catch(()=>{this.connection.console.info(`Un-registering capability with id ${o} failed.`)})}),e=>(this.connection.console.info(`Registering request handler for ${a} failed.`),Promise.reject(e)))}unregisterSingle(e,n){let r={unregisterations:[{id:e,method:n}]};return this.connection.sendRequest(t.UnregistrationRequest.type,r).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let n=e.asRegistrationParams();return this.connection.sendRequest(t.RegistrationRequest.type,n).then(()=>new D(this._connection,n.registrations.map(e=>({id:e.id,method:e.method}))),e=>(this.connection.console.info(`Bulk registration failed.`),Promise.reject(e)))}},ee=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function n(e){return e&&!!e.edit}let r=n(e)?e:{edit:e};return this.connection.sendRequest(t.ApplyWorkspaceEditRequest.type,r)}};let te=(0,u.FileOperationsFeature)((0,o.WorkspaceFoldersFeature)((0,a.ConfigurationFeature)(ee)));var k=class{constructor(){this._trace=t.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,n){this._trace!==t.Trace.Off&&this.connection.sendNotification(t.LogTraceNotification.type,{message:e,verbose:this._trace===t.Trace.Verbose?n:void 0}).catch(()=>{})}},A=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(t.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log(`Sending TelemetryEventNotification failed`)})}},j=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,i.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,i.attachPartialResult)(this.connection,t)}};e._LanguagesImpl=j;let ne=(0,m.FoldingRangeFeature)((0,v.MonikerFeature)((0,g.DiagnosticFeature)((0,h.InlayHintFeature)((0,p.InlineValueFeature)((0,f.TypeHierarchyFeature)((0,d.LinkedEditingRangeFeature)((0,c.SemanticTokensFeature)((0,s.CallHierarchyFeature)(j)))))))));var M=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw Error(`Remote is not attached to a connection yet.`);return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,i.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,t){return(0,i.attachPartialResult)(this.connection,t)}};e._NotebooksImpl=M;let re=(0,_.NotebookSyncFeature)(M);function ie(e,t){return function(n){return t(e(n))}}e.combineConsoleFeatures=ie;function N(e,t){return function(n){return t(e(n))}}e.combineTelemetryFeatures=N;function P(e,t){return function(n){return t(e(n))}}e.combineTracerFeatures=P;function F(e,t){return function(n){return t(e(n))}}e.combineClientFeatures=F;function I(e,t){return function(n){return t(e(n))}}e.combineWindowFeatures=I;function L(e,t){return function(n){return t(e(n))}}e.combineWorkspaceFeatures=L;function ae(e,t){return function(n){return t(e(n))}}e.combineLanguagesFeatures=ae;function oe(e,t){return function(n){return t(e(n))}}e.combineNotebooksFeatures=oe;function se(e,t){function n(e,t,n){return e&&t?n(e,t):e||t}return{__brand:`features`,console:n(e.console,t.console,ie),tracer:n(e.tracer,t.tracer,P),telemetry:n(e.telemetry,t.telemetry,N),client:n(e.client,t.client,F),window:n(e.window,t.window,I),workspace:n(e.workspace,t.workspace,L),languages:n(e.languages,t.languages,ae),notebooks:n(e.notebooks,t.notebooks,oe)}}e.combineFeatures=se;function ce(e,r,a){let o=a&&a.console?new(a.console(x)):new x,s=e(o);o.rawAttach(s);let c=a&&a.tracer?new(a.tracer(k)):new k,l=a&&a.telemetry?new(a.telemetry(A)):new A,u=a&&a.client?new(a.client(O)):new O,d=a&&a.window?new(a.window(C)):new C,f=a&&a.workspace?new(a.workspace(te)):new te,p=a&&a.languages?new(a.languages(ne)):new ne,m=a&&a.notebooks?new(a.notebooks(re)):new re,h=[o,c,l,u,d,f,p,m];function g(e){return e instanceof Promise?e:n.thenable(e)?new Promise((t,n)=>{e.then(e=>t(e),e=>n(e))}):Promise.resolve(e)}let _,v,y,b={listen:()=>s.listen(),sendRequest:(e,...t)=>s.sendRequest(n.string(e)?e:e.method,...t),onRequest:(e,t)=>s.onRequest(e,t),sendNotification:(e,t)=>{let r=n.string(e)?e:e.method;return s.sendNotification(r,t)},onNotification:(e,t)=>s.onNotification(e,t),onProgress:s.onProgress,sendProgress:s.sendProgress,onInitialize:e=>(v=e,{dispose:()=>{v=void 0}}),onInitialized:e=>s.onNotification(t.InitializedNotification.type,e),onShutdown:e=>(_=e,{dispose:()=>{_=void 0}}),onExit:e=>(y=e,{dispose:()=>{y=void 0}}),get console(){return o},get telemetry(){return l},get tracer(){return c},get client(){return u},get window(){return d},get workspace(){return f},get languages(){return p},get notebooks(){return m},onDidChangeConfiguration:e=>s.onNotification(t.DidChangeConfigurationNotification.type,e),onDidChangeWatchedFiles:e=>s.onNotification(t.DidChangeWatchedFilesNotification.type,e),__textDocumentSync:void 0,onDidOpenTextDocument:e=>s.onNotification(t.DidOpenTextDocumentNotification.type,e),onDidChangeTextDocument:e=>s.onNotification(t.DidChangeTextDocumentNotification.type,e),onDidCloseTextDocument:e=>s.onNotification(t.DidCloseTextDocumentNotification.type,e),onWillSaveTextDocument:e=>s.onNotification(t.WillSaveTextDocumentNotification.type,e),onWillSaveTextDocumentWaitUntil:e=>s.onRequest(t.WillSaveTextDocumentWaitUntilRequest.type,e),onDidSaveTextDocument:e=>s.onNotification(t.DidSaveTextDocumentNotification.type,e),sendDiagnostics:e=>s.sendNotification(t.PublishDiagnosticsNotification.type,e),onHover:e=>s.onRequest(t.HoverRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onCompletion:e=>s.onRequest(t.CompletionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onCompletionResolve:e=>s.onRequest(t.CompletionResolveRequest.type,e),onSignatureHelp:e=>s.onRequest(t.SignatureHelpRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onDeclaration:e=>s.onRequest(t.DeclarationRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDefinition:e=>s.onRequest(t.DefinitionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onTypeDefinition:e=>s.onRequest(t.TypeDefinitionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onImplementation:e=>s.onRequest(t.ImplementationRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onReferences:e=>s.onRequest(t.ReferencesRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDocumentHighlight:e=>s.onRequest(t.DocumentHighlightRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDocumentSymbol:e=>s.onRequest(t.DocumentSymbolRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onWorkspaceSymbol:e=>s.onRequest(t.WorkspaceSymbolRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onWorkspaceSymbolResolve:e=>s.onRequest(t.WorkspaceSymbolResolveRequest.type,e),onCodeAction:e=>s.onRequest(t.CodeActionRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onCodeActionResolve:e=>s.onRequest(t.CodeActionResolveRequest.type,(t,n)=>e(t,n)),onCodeLens:e=>s.onRequest(t.CodeLensRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onCodeLensResolve:e=>s.onRequest(t.CodeLensResolveRequest.type,(t,n)=>e(t,n)),onDocumentFormatting:e=>s.onRequest(t.DocumentFormattingRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onDocumentRangeFormatting:e=>s.onRequest(t.DocumentRangeFormattingRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onDocumentOnTypeFormatting:e=>s.onRequest(t.DocumentOnTypeFormattingRequest.type,(t,n)=>e(t,n)),onRenameRequest:e=>s.onRequest(t.RenameRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),onPrepareRename:e=>s.onRequest(t.PrepareRenameRequest.type,(t,n)=>e(t,n)),onDocumentLinks:e=>s.onRequest(t.DocumentLinkRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onDocumentLinkResolve:e=>s.onRequest(t.DocumentLinkResolveRequest.type,(t,n)=>e(t,n)),onDocumentColor:e=>s.onRequest(t.DocumentColorRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onColorPresentation:e=>s.onRequest(t.ColorPresentationRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onFoldingRanges:e=>s.onRequest(t.FoldingRangeRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onSelectionRanges:e=>s.onRequest(t.SelectionRangeRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),(0,i.attachPartialResult)(s,t))),onExecuteCommand:e=>s.onRequest(t.ExecuteCommandRequest.type,(t,n)=>e(t,n,(0,i.attachWorkDone)(s,t),void 0)),dispose:()=>s.dispose()};for(let e of h)e.attach(b);return s.onRequest(t.InitializeRequest.type,e=>{r.initialize(e),n.string(e.trace)&&(c.trace=t.Trace.fromString(e.trace));for(let t of h)t.initialize(e.capabilities);if(v)return g(v(e,new t.CancellationTokenSource().token,(0,i.attachWorkDone)(s,e),void 0)).then(e=>{if(e instanceof t.ResponseError)return e;let r=e;r||={capabilities:{}};let i=r.capabilities;i||(i={},r.capabilities=i),i.textDocumentSync===void 0||i.textDocumentSync===null?i.textDocumentSync=n.number(b.__textDocumentSync)?b.__textDocumentSync:t.TextDocumentSyncKind.None:!n.number(i.textDocumentSync)&&!n.number(i.textDocumentSync.change)&&(i.textDocumentSync.change=n.number(b.__textDocumentSync)?b.__textDocumentSync:t.TextDocumentSyncKind.None);for(let e of h)e.fillServerCapabilities(i);return r});{let e={capabilities:{textDocumentSync:t.TextDocumentSyncKind.None}};for(let t of h)t.fillServerCapabilities(e.capabilities);return e}}),s.onRequest(t.ShutdownRequest.type,()=>{if(r.shutdownReceived=!0,_)return _(new t.CancellationTokenSource().token)}),s.onNotification(t.ExitNotification.type,()=>{try{y&&y()}finally{r.shutdownReceived?r.exit(0):r.exit(1)}}),s.onNotification(t.SetTraceNotification.type,e=>{c.trace=t.Trace.fromString(e.value)}),b}e.createConnection=ce})),tl=o((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.resolveModulePath=t.FileSystem=t.resolveGlobalYarnPath=t.resolveGlobalNodePath=t.resolve=t.uriToFilePath=void 0;let n=e(`url`),r=e(`path`),i=e(`fs`),a=e(`child_process`);function o(e){let t=n.parse(e);if(t.protocol!==`file:`||!t.path)return;let i=t.path.split(`/`);for(var a=0,o=i.length;a<o;a++)i[a]=decodeURIComponent(i[a]);if(process.platform===`win32`&&i.length>1){let e=i[0],t=i[1];e.length===0&&t.length>1&&t[1]===`:`&&i.shift()}return r.normalize(i.join(`/`))}t.uriToFilePath=o;function s(){return process.platform===`win32`}function c(e,t,n,o){let s=`NODE_PATH`,c=[`var p = process;`,`p.on('message',function(m){`,`if(m.c==='e'){`,`p.exit(0);`,`}`,`else if(m.c==='rs'){`,`try{`,`var r=require.resolve(m.a);`,`p.send({c:'r',s:true,r:r});`,`}`,`catch(err){`,`p.send({c:'r',s:false});`,`}`,`}`,`});`].join(``);return new Promise((l,u)=>{let d=process.env,f=Object.create(null);Object.keys(d).forEach(e=>f[e]=d[e]),t&&i.existsSync(t)&&(f[s]?f[s]=t+r.delimiter+f[s]:f[s]=t,o&&o(`NODE_PATH value is: ${f[s]}`)),f.ELECTRON_RUN_AS_NODE=`1`;try{let t=(0,a.fork)(``,[],{cwd:n,env:f,execArgv:[`-e`,c]});if(t.pid===void 0){u(Error(`Starting process to resolve node module ${e} failed`));return}t.on(`error`,e=>{u(e)}),t.on(`message`,n=>{n.c===`r`&&(t.send({c:`e`}),n.s?l(n.r):u(Error(`Failed to resolve module: ${e}`)))});let r={c:`rs`,a:e};t.send(r)}catch(e){u(e)}})}t.resolve=c;function l(e){let t=`npm`,n=Object.create(null);Object.keys(process.env).forEach(e=>n[e]=process.env[e]),n.NO_UPDATE_NOTIFIER=`true`;let i={encoding:`utf8`,env:n};s()&&(t=`npm.cmd`,i.shell=!0);let o=()=>{};try{process.on(`SIGPIPE`,o);let n=(0,a.spawnSync)(t,[`config`,`get`,`prefix`],i).stdout;if(!n){e&&e(`'npm config get prefix' didn't return a value.`);return}let c=n.trim();return e&&e(`'npm config get prefix' value is: ${c}`),c.length>0?s()?r.join(c,`node_modules`):r.join(c,`lib`,`node_modules`):void 0}catch{return}finally{process.removeListener(`SIGPIPE`,o)}}t.resolveGlobalNodePath=l;function u(e){let t=`yarn`,n={encoding:`utf8`};s()&&(t=`yarn.cmd`,n.shell=!0);let i=()=>{};try{process.on(`SIGPIPE`,i);let o=(0,a.spawnSync)(t,[`global`,`dir`,`--json`],n),s=o.stdout;if(!s){e&&(e(`'yarn global dir' didn't return a value.`),o.stderr&&e(o.stderr));return}let c=s.trim().split(/\r?\n/);for(let e of c)try{let t=JSON.parse(e);if(t.type===`log`)return r.join(t.data,`node_modules`)}catch{}return}catch{return}finally{process.removeListener(`SIGPIPE`,i)}}t.resolveGlobalYarnPath=u;var d;(function(e){let t;function n(){return t===void 0&&(t=process.platform===`win32`?!1:!i.existsSync(__filename.toUpperCase())||!i.existsSync(__filename.toLowerCase())),t}e.isCaseSensitive=n;function a(e,t){return n()?r.normalize(t).indexOf(r.normalize(e))===0:r.normalize(t).toLowerCase().indexOf(r.normalize(e).toLowerCase())===0}e.isParent=a})(d||(t.FileSystem=d={}));function f(e,t,n,i){return n?(r.isAbsolute(n)||(n=r.join(e,n)),c(t,n,n,i).then(e=>d.isParent(n,e)?e:Promise.reject(Error(`Failed to load ${t} from node path location.`))).then(void 0,n=>c(t,l(i),e,i))):c(t,l(i),e,i)}t.resolveModulePath=f})),nl=o(((e,t)=>{t.exports=Z()})),rl=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineCompletionFeature=void 0;let t=Z(),n=e=>class extends e{get inlineCompletion(){return{on:e=>this.connection.onRequest(t.InlineCompletionRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}};e.InlineCompletionFeature=n})),il=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.ProposedFeatures=e.NotebookDocuments=e.TextDocuments=e.SemanticTokensBuilder=void 0;let r=Hc();Object.defineProperty(e,`SemanticTokensBuilder`,{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});let i=rl();n(Z(),e);let a=Zc();Object.defineProperty(e,`TextDocuments`,{enumerable:!0,get:function(){return a.TextDocuments}});let o=Qc();Object.defineProperty(e,`NotebookDocuments`,{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(el(),e);var s;(function(e){e.all={__brand:`features`,languages:i.InlineCompletionFeature}})(s||(e.ProposedFeatures=s={}))})),al=o((t=>{var n=t&&t.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=t&&t.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(t,`__esModule`,{value:!0}),t.createConnection=t.Files=void 0;let i=e(`node:util`),a=Qs(),o=el(),s=tl(),c=nl();r(nl(),t),r(il(),t);var l;(function(e){e.uriToFilePath=s.uriToFilePath,e.resolveGlobalNodePath=s.resolveGlobalNodePath,e.resolveGlobalYarnPath=s.resolveGlobalYarnPath,e.resolve=s.resolve,e.resolveModulePath=s.resolveModulePath})(l||(t.Files=l={}));let u=!1,d;function f(){let e=`--clientProcessId`;function t(e){try{let t=parseInt(e);isNaN(t)||(d=setInterval(()=>{try{process.kill(t,0)}catch{process.exit(u?0:1)}},3e3))}catch{}}for(let n=2;n<process.argv.length;n++){let r=process.argv[n];if(r===e&&n+1<process.argv.length){t(process.argv[n+1]);return}else{let n=r.split(`=`);n[0]===e&&t(n[1])}}}f();let p={initialize:e=>{let t=e.processId;a.number(t)&&d===void 0&&setInterval(()=>{try{process.kill(t,0)}catch{process.exit(u?0:1)}},3e3)},get shutdownReceived(){return u},set shutdownReceived(e){u=e},exit:e=>{process.exit(e)}};function m(e,t,n,r){let i,a,o,s;return e!==void 0&&e.__brand===`features`&&(i=e,e=t,t=n,n=r),c.ConnectionStrategy.is(e)||c.ConnectionOptions.is(e)?s=e:(a=e,o=t,s=n),h(a,o,s,i)}t.createConnection=m;function h(e,t,n,r){let i=!1;if(!e&&!t&&process.argv.length>2){let n,r,a=process.argv.slice(2);for(let o=0;o<a.length;o++){let l=a[o];if(l===`--node-ipc`){e=new c.IPCMessageReader(process),t=new c.IPCMessageWriter(process);break}else if(l===`--stdio`){i=!0,e=process.stdin,t=process.stdout;break}else if(l===`--socket`){n=parseInt(a[o+1]);break}else if(l===`--pipe`){r=a[o+1];break}else{var s=l.split(`=`);if(s[0]===`--socket`){n=parseInt(s[1]);break}else if(s[0]===`--pipe`){r=s[1];break}}}if(n){let r=(0,c.createServerSocketTransport)(n);e=r[0],t=r[1]}else if(r){let n=(0,c.createServerPipeTransport)(r);e=n[0],t=n[1]}}var l=`Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'`;if(!e)throw Error(`Connection input stream is not set. `+l);if(!t)throw Error(`Connection output stream is not set. `+l);if(a.func(e.read)&&a.func(e.on)){let t=e;t.on(`end`,()=>{process.exit(u?0:1)}),t.on(`close`,()=>{process.exit(u?0:1)})}let d=r=>{let a=(0,c.createProtocolConnection)(e,t,r,n);return i&&g(r),a};return(0,o.createConnection)(d,p,r)}function g(e){function t(e){return e.map(e=>typeof e==`string`?e:(0,i.inspect)(e)).join(` `)}let n=new Map;console.assert=function n(r,...i){if(!r)if(i.length===0)e.error(`Assertion failed`);else{let[n,...r]=i;e.error(`Assertion failed: ${n} ${t(r)}`)}},console.count=function t(r=`default`){let i=String(r),a=n.get(i)??0;a+=1,n.set(i,a),e.log(`${i}: ${i}`)},console.countReset=function e(t){t===void 0?n.clear():n.delete(String(t))},console.debug=function n(...r){e.log(t(r))},console.dir=function t(n,r){e.log((0,i.inspect)(n,r))},console.log=function n(...r){e.log(t(r))},console.error=function n(...r){e.error(t(r))},console.trace=function n(...r){let i=Error().stack.replace(/(.+\n){2}/,``),a=`Trace`;r.length!==0&&(a+=`: ${t(r)}`),e.log(`${a}\n${i}`)},console.warn=function n(...r){e.warn(t(r))}}}));function ol(e,t){let n={stacks:e,tokens:t};return fl(n),n.stacks.flat().forEach(e=>{e.property=void 0}),pl(n.stacks).map(e=>e[e.length-1])}function sl(e){let{next:t,cardinalities:n,visited:r,plus:i}=e,a=[],o=t.feature;if(r.has(o))return[];Ht(o)||r.add(o);let s,c=o;for(;c.$container;)if(Ht(c.$container)){s=c.$container;break}else if(Le(c.$container))c=c.$container;else break;if(nr(c.cardinality)){let e=ll({next:{feature:c,type:t.type},cardinalities:n,visited:r,plus:i});for(let t of e)i.add(t.feature);a.push(...e)}if(s){let e=s.elements.indexOf(c);e!==void 0&&e<s.elements.length-1&&a.push(...dl({feature:s,type:t.type},e+1,n,r,i)),a.every(e=>tr(e.feature.cardinality,e.feature)||tr(n.get(e.feature))||i.has(e.feature))&&a.push(...sl({next:{feature:s,type:t.type},cardinalities:n,visited:r,plus:i}))}return a}function cl(e){return b(e)&&(e={feature:e}),ll({next:e,cardinalities:new Map,visited:new Set,plus:new Set})}function ll(e){let{next:t,cardinalities:n,visited:r,plus:i}=e;if(t===void 0)return[];let{feature:a,type:o}=t;if(Ht(a))return r.has(a)?[]:(r.add(a),dl(t,0,n,r,i).map(e=>ul(e,a.cardinality,n)));if(Mt(a)||an(a))return a.elements.flatMap(e=>ll({next:{feature:e,type:o,property:t.property},cardinalities:n,visited:r,plus:i})).map(e=>ul(e,a.cardinality,n));if(Pt(a))return ll({next:{feature:a.terminal,type:o,property:t.property??a.feature},cardinalities:n,visited:r,plus:i}).map(e=>ul(e,a.cardinality,n));if(At(a))return sl({next:{feature:a,type:lr(a),property:t.property??a.feature},cardinalities:n,visited:r,plus:i});if(Xt(a)&&R(a.rule.ref)){let e=a.rule.ref;return ll({next:{feature:e.definition,type:e.fragment||e.dataType?void 0:cr(e)??e.name,property:t.property},cardinalities:n,visited:r,plus:i}).map(e=>ul(e,a.cardinality,n))}else return[t]}function ul(e,t,n){return n.set(e.feature,t),e}function dl(e,t,n,r,i){let a=[],o;for(;t<e.feature.elements.length&&(o={feature:e.feature.elements[t++],type:e.type},a.push(...ll({next:o,cardinalities:n,visited:r,plus:i})),tr(o.feature.cardinality??n.get(o.feature),o.feature)););return a}function fl(e){for(let t of e.tokens)e.stacks=pl(e.stacks,t)}function pl(e,t){let n=[];for(let r of e)n.push(...ml(r,t));return n}function ml(e,t){let n=new Map,r=new Set(e.map(e=>e.feature).filter(hl)),i=[];for(;e.length>0;){let a=sl({next:e.pop(),cardinalities:n,plus:r,visited:new Set}).filter(e=>t?gl(e.feature,t):!0);for(let t of a)i.push([...e,t]);if(!a.every(e=>tr(e.feature.cardinality,e.feature)||tr(n.get(e.feature))))break}return i}function hl(e){if(e.cardinality===`+`)return!0;let t=pn(e,Pt);return!!(t&&t.cardinality===`+`)}function gl(e,t){if(Wt(e))return e.value===t.image;if(Xt(e))return _l(e.rule.ref,t);if(Rt(e)){let n=Un(e);if(n)return gl(n,t)}return!1}function _l(e,t){return R(e)?cl(e.definition).some(e=>gl(e.feature,t)):St(e)?pr(e).test(t.image):!1}var Q=al();function vl(e){let t=Array.from(new Set(e.flatMap(e=>e?.triggerCharacters??[]))),n=Array.from(new Set(e.flatMap(e=>e?.allCommitCharacters??[])));return{triggerCharacters:t.length>0?t:void 0,allCommitCharacters:n.length>0?n:void 0}}var yl=class{constructor(e){this.scopeProvider=e.references.ScopeProvider,this.grammar=e.Grammar,this.completionParser=e.parser.CompletionParser,this.nameProvider=e.references.NameProvider,this.lexer=e.parser.Lexer,this.nodeKindProvider=e.shared.lsp.NodeKindProvider,this.fuzzyMatcher=e.shared.lsp.FuzzyMatcher,this.grammarConfig=e.parser.GrammarConfig,this.astReflection=e.shared.AstReflection,this.documentationProvider=e.documentation.DocumentationProvider}async getCompletion(e,t,n){let r=[],i=this.buildContexts(e,t.position),a=(e,t)=>{let n=this.fillCompletionItem(e,t);n&&r.push(n)},o=e=>Wt(e.feature)?e.feature.value:e.feature,s=[];for(let e of i)if(await Promise.all(j(e.features).distinct(o).exclude(s).map(t=>this.completionFor(e,t,a))),s.push(...e.features),!this.continueCompletion(r))break;return Q.CompletionList.create(this.deduplicateItems(r),!0)}deduplicateItems(e){return j(e).distinct(e=>`${e.kind}_${e.label}_${e.detail}`).toArray()}findFeaturesAt(e,t){let n=e.getText({start:Q.Position.create(0,0),end:e.positionAt(t)}),r=this.completionParser.parse(n),i=r.tokens;if(r.tokenIndex===0){let e=Rn(this.grammar),t=cl({feature:e.definition,type:cr(e)});return i.length>0?(i.shift(),ol(t.map(e=>[e]),i)):t}let a=[...i].splice(r.tokenIndex);return ol([r.elementStack.map(e=>({feature:e}))],a)}*buildContexts(e,t){let n=e.parseResult.value.$cstNode;if(!n)return;let r=e.textDocument,i=r.getText(),a=r.offsetAt(t),o={document:e,textDocument:r,offset:a,position:t},s=this.findDataTypeRuleStart(n,a);if(s){let[e,t]=s,i=fe(n,e)?.astNode;yield Object.assign(Object.assign({},o),{node:i,tokenOffset:e,tokenEndOffset:t,features:this.findFeaturesAt(r,e)})}let{nextTokenStart:c,nextTokenEnd:l,previousTokenStart:u,previousTokenEnd:d}=this.backtrackToAnyToken(i,a),f=c;a<=c&&u!==void 0&&(f=u);let p=fe(n,f)?.astNode,m=!0;if(u!==void 0&&d!==void 0&&d===a&&(yield Object.assign(Object.assign({},o),{node:p,tokenOffset:u,tokenEndOffset:d,features:this.findFeaturesAt(r,u)}),m=this.performNextTokenCompletion(e,i.substring(u,d),u,d),m&&(yield Object.assign(Object.assign({},o),{node:p,tokenOffset:d,tokenEndOffset:d,features:this.findFeaturesAt(r,d)}))),p)m&&(yield Object.assign(Object.assign({},o),{node:p,tokenOffset:c,tokenEndOffset:l,features:this.findFeaturesAt(r,c)}));else{let e=Rn(this.grammar);if(!e)throw Error(`Missing entry parser rule`);yield Object.assign(Object.assign({},o),{tokenOffset:c,tokenEndOffset:l,features:cl(e.definition)})}}performNextTokenCompletion(e,t,n,r){return/\P{L}$/u.test(t)}findDataTypeRuleStart(e,t){let n=ce(e,t,this.grammarConfig.nameRegexp),r=!!pn(n?.grammarSource,R)?.dataType;if(r){for(;r;)n=n?.container,r=!!pn(n?.grammarSource,R)?.dataType;if(n)return[n.offset,n.end]}}continueCompletion(e){return e.length===0}backtrackToAnyToken(e,t){let n=this.lexer.tokenize(e).tokens;if(n.length===0)return{nextTokenStart:t,nextTokenEnd:t};let r;for(let e of n){if(e.startOffset>=t)return{nextTokenStart:t,nextTokenEnd:t,previousTokenStart:r?r.startOffset:void 0,previousTokenEnd:r?r.endOffset+1:void 0};if(e.endOffset>=t)return{nextTokenStart:e.startOffset,nextTokenEnd:e.endOffset+1,previousTokenStart:r?r.startOffset:void 0,previousTokenEnd:r?r.endOffset+1:void 0};r=e}return{nextTokenStart:t,nextTokenEnd:t,previousTokenStart:r?r.startOffset:void 0,previousTokenEnd:r?r.endOffset+1:void 0}}completionFor(e,t,n){if(Wt(t.feature))return this.completionForKeyword(e,t.feature,n);if(Rt(t.feature)&&e.node)return this.completionForCrossReference(e,t,n)}completionForCrossReference(e,t,n){let r=pn(t.feature,Pt),i=e.node;if(r&&i){t.type&&(i={$type:t.type,$container:i,$containerProperty:t.property},Sn(this.astReflection,i));let a={reference:{$refText:``},container:i,property:r.feature};try{for(let t of this.getReferenceCandidates(a,e))n(e,this.createReferenceCompletionItem(t))}catch(e){console.error(e)}}}getReferenceCandidates(e,t){return this.scopeProvider.getScope(e).getAllElements()}createReferenceCompletionItem(e){return{nodeDescription:e,kind:this.nodeKindProvider.getCompletionItemKind(e),documentation:this.getReferenceDocumentation(e),detail:e.type,sortText:`0`}}getReferenceDocumentation(e){if(!e.node)return;let t=this.documentationProvider.getDocumentation(e.node);if(t)return{kind:`markdown`,value:t}}completionForKeyword(e,t,n){this.filterKeyword(e,t)&&n(e,{label:t.value,kind:this.getKeywordCompletionItemKind(t),detail:`Keyword`,sortText:`1`})}getKeywordCompletionItemKind(e){return Q.CompletionItemKind.Keyword}filterKeyword(e,t){return/\p{L}/u.test(t.value)}fillCompletionItem(e,t){let n;if(typeof t.label==`string`)n=t.label;else if(`node`in t){let e=this.nameProvider.getName(t.node);if(!e)return;n=e}else if(`nodeDescription`in t)n=t.nodeDescription.name;else return;let r;r=typeof t.textEdit?.newText==`string`?t.textEdit.newText:typeof t.insertText==`string`?t.insertText:n;let i=t.textEdit??this.buildCompletionTextEdit(e,n,r);if(i)return{additionalTextEdits:t.additionalTextEdits,command:t.command,commitCharacters:t.commitCharacters,data:t.data,detail:t.detail,documentation:t.documentation,filterText:t.filterText,insertText:t.insertText,insertTextFormat:t.insertTextFormat,insertTextMode:t.insertTextMode,kind:t.kind,labelDetails:t.labelDetails,preselect:t.preselect,sortText:t.sortText,tags:t.tags,textEditText:t.textEditText,textEdit:i,label:n}}buildCompletionTextEdit(e,t,n){let r=e.textDocument.getText().substring(e.tokenOffset,e.offset);if(this.fuzzyMatcher.match(r,t))return{newText:n,range:{start:e.textDocument.positionAt(e.tokenOffset),end:e.position}}}},bl=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getDefinition(e,t,n){let r=e.parseResult.value;if(r.$cstNode){let n=r.$cstNode,i=ce(n,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(i)return this.collectLocationLinks(i,t)}}collectLocationLinks(e,t){let n=this.findLink(e);if(n)return[Q.LocationLink.create(n.targetDocument.textDocument.uri,(n.target.astNode.$cstNode??n.target).range,n.target.range,n.source.range)]}findLink(e){let t=this.references.findDeclarationNode(e);if(t?.astNode){let n=B(t.astNode);if(t&&n)return{source:e,target:t,targetDocument:n}}}},xl=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}getDocumentHighlight(e,t,n){let r=e.parseResult.value.$cstNode;if(!r)return;let i=ce(r,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let a=this.references.findDeclaration(i);if(a){let t=J.equals(B(a).uri,e.uri),n={documentUri:e.uri,includeDeclaration:t};return this.references.findReferences(a,n).map(e=>this.createDocumentHighlight(e)).toArray()}}createDocumentHighlight(e){return Q.DocumentHighlight.create(e.segment.range)}},Sl=class{constructor(e){this.nameProvider=e.references.NameProvider,this.nodeKindProvider=e.shared.lsp.NodeKindProvider}getSymbols(e,t,n){return this.getSymbol(e,e.parseResult.value)}getSymbol(e,t){let n=t.$cstNode,r=this.nameProvider.getNameNode(t);if(r&&n){let i=this.nameProvider.getName(t);return[{kind:this.nodeKindProvider.getSymbolKind(t),name:i||r.text,range:n.range,selectionRange:r.range,children:this.getChildSymbols(e,t)}]}else return this.getChildSymbols(e,t)||[]}getChildSymbols(e,t){let n=[];for(let r of gn(t)){let t=this.getSymbol(e,r);n.push(...t)}if(n.length>0)return n}},Cl=class{constructor(e){this.workspaceManager=e.workspace.WorkspaceManager,this.documentBuilder=e.workspace.DocumentBuilder,this.workspaceLock=e.workspace.WorkspaceLock,this.serviceRegistry=e.ServiceRegistry;let t=!1;e.lsp.LanguageServer.onInitialize(e=>{t=!!e.capabilities.workspace?.didChangeWatchedFiles?.dynamicRegistration}),e.lsp.LanguageServer.onInitialized(n=>{t&&this.registerFileWatcher(e)})}registerFileWatcher(e){let t=[],n=j(e.ServiceRegistry.all).flatMap(e=>e.LanguageMetaData.fileExtensions).map(e=>e.startsWith(`.`)?e.substring(1):e).distinct().toArray();n.length>0&&t.push({globPattern:n.length===1?`**/*.${n[0]}`:`**/*.{${n.join(`,`)}}`});let r=j(e.ServiceRegistry.all).flatMap(e=>e.LanguageMetaData.fileNames??[]).distinct().toArray();if(r.length>0&&t.push({globPattern:r.length===1?`**/${r[0]}`:`**/{${r.join(`,`)}}`}),t.length>0){let n=e.lsp.Connection,r={watchers:t};n?.client.register(Q.DidChangeWatchedFilesNotification.type,r)}}fireDocumentUpdate(e,t){e=e.filter(e=>this.serviceRegistry.hasServices(e)),this.workspaceManager.ready.then(()=>{this.workspaceLock.write(n=>this.documentBuilder.update(e,t,n))}).catch(e=>{console.error(`Workspace initialization failed. Could not perform document update.`,e)})}didChangeContent(e){this.fireDocumentUpdate([q.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let t=j(e.changes).filter(e=>e.type!==Q.FileChangeType.Deleted).distinct(e=>e.uri).map(e=>q.parse(e.uri)).toArray(),n=j(e.changes).filter(e=>e.type===Q.FileChangeType.Deleted).distinct(e=>e.uri).map(e=>q.parse(e.uri)).toArray();this.fireDocumentUpdate(t,n)}},wl=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,t,n){let r=[],i=e=>r.push(e);return this.collectFolding(e,i),r}collectFolding(e,t){let n=e.parseResult?.value;if(n){if(this.shouldProcessContent(n)){let r=_n(n).iterator(),i;do if(i=r.next(),!i.done){let n=i.value;this.shouldProcess(n)&&this.collectObjectFolding(e,n,t),this.shouldProcessContent(n)||r.prune()}while(!i.done)}this.collectCommentFolding(e,n,t)}}shouldProcess(e){return!0}shouldProcessContent(e){return!0}collectObjectFolding(e,t,n){let r=t.$cstNode;if(r){let t=this.toFoldingRange(e,r);t&&n(t)}}collectCommentFolding(e,t,n){let r=t.$cstNode;if(r){for(let t of N(r))if(this.commentNames.includes(t.tokenType.name)){let r=this.toFoldingRange(e,t,Q.FoldingRangeKind.Comment);r&&n(r)}}}toFoldingRange(e,t,n){let r=t.range,i=r.start,a=r.end;if(!(a.line-i.line<2))return this.includeLastFoldingLine(t,n)||(a=e.textDocument.positionAt(e.textDocument.offsetAt({line:a.line,character:0})-1)),Q.FoldingRange.create(i.line,a.line,i.character,a.character,n)}includeLastFoldingLine(e,t){if(t===Q.FoldingRangeKind.Comment)return!1;let n=e.text,r=n.charAt(n.length-1);return!(r===`}`||r===`)`||r===`]`)}},Tl=class{match(e,t){if(e.length===0)return!0;let n=!1,r,i=0,a=t.length;for(let o=0;o<a;o++){let a=t.charCodeAt(o),s=e.charCodeAt(i);if((a===s||this.toUpperCharCode(a)===this.toUpperCharCode(s))&&(n||=r===void 0||this.isWordTransition(r,a),n&&i++,i===e.length))return!0;r=a}return!1}isWordTransition(e,t){return El<=e&&e<=Dl&&Ol<=t&&t<=kl||e===Al&&t!==Al}toUpperCharCode(e){return El<=e&&e<=Dl?e-32:e}};const El=97,Dl=122,Ol=65,kl=90,Al=95;var jl=class{constructor(e){this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}getHoverContent(e,t){let n=e.parseResult?.value?.$cstNode;if(n){let r=e.textDocument.offsetAt(t.position),i=ce(n,r,this.grammarConfig.nameRegexp);if(i&&i.offset+i.length>r){let e=this.references.findDeclaration(i);if(e)return this.getAstNodeHoverContent(e);if(Wt(i.grammarSource))return this.getKeywordHoverContent(i.grammarSource)}}}getKeywordHoverContent(e){let t=wo(e)?e.$comment:void 0;if(t||=le(e.$cstNode,[`ML_COMMENT`])?.text,t&&Qo(t)){let e=Zo(t).toMarkdown();if(e)return{contents:{kind:`markdown`,value:e}}}}},Ml=class extends jl{constructor(e){super(e),this.documentationProvider=e.documentation.DocumentationProvider}getAstNodeHoverContent(e){let t=this.documentationProvider.getDocumentation(e);if(t)return{contents:{kind:`markdown`,value:t}}}};const Nl={[Q.SemanticTokenTypes.class]:0,[Q.SemanticTokenTypes.comment]:1,[Q.SemanticTokenTypes.enum]:2,[Q.SemanticTokenTypes.enumMember]:3,[Q.SemanticTokenTypes.event]:4,[Q.SemanticTokenTypes.function]:5,[Q.SemanticTokenTypes.interface]:6,[Q.SemanticTokenTypes.keyword]:7,[Q.SemanticTokenTypes.macro]:8,[Q.SemanticTokenTypes.method]:9,[Q.SemanticTokenTypes.modifier]:10,[Q.SemanticTokenTypes.namespace]:11,[Q.SemanticTokenTypes.number]:12,[Q.SemanticTokenTypes.operator]:13,[Q.SemanticTokenTypes.parameter]:14,[Q.SemanticTokenTypes.property]:15,[Q.SemanticTokenTypes.regexp]:16,[Q.SemanticTokenTypes.string]:17,[Q.SemanticTokenTypes.struct]:18,[Q.SemanticTokenTypes.type]:19,[Q.SemanticTokenTypes.typeParameter]:20,[Q.SemanticTokenTypes.variable]:21,[Q.SemanticTokenTypes.decorator]:22},Pl={[Q.SemanticTokenModifiers.abstract]:1,[Q.SemanticTokenModifiers.async]:2,[Q.SemanticTokenModifiers.declaration]:4,[Q.SemanticTokenModifiers.defaultLibrary]:8,[Q.SemanticTokenModifiers.definition]:16,[Q.SemanticTokenModifiers.deprecated]:32,[Q.SemanticTokenModifiers.documentation]:64,[Q.SemanticTokenModifiers.modification]:128,[Q.SemanticTokenModifiers.readonly]:256,[Q.SemanticTokenModifiers.static]:512};function Fl(e){let t=[],n=[],r=!0,i=!0,a=!0;for(let o of e)o&&(o.legend.tokenTypes.forEach((e,n)=>{let r=t[n];if(r&&r!==e)throw Error(`Cannot merge '${r}' and '${e}' token types. They use the same index ${n}.`);t[n]=e}),o.legend.tokenModifiers.forEach((e,t)=>{let r=n[t];if(r&&r!==e)throw Error(`Cannot merge '${r}' and '${e}' token modifier. They use the same index ${t}.`);n[t]=e}),o.full?typeof o.full==`object`&&!o.full.delta&&(i=!1):r=!1,o.range||(a=!1));return{legend:{tokenTypes:t,tokenModifiers:n},full:r&&{delta:i},range:a}}var Il=class extends Q.SemanticTokensBuilder{constructor(){super(...arguments),this._tokens=[]}push(e,t,n,r,i){this._tokens.push({line:e,char:t,length:n,tokenType:r,tokenModifiers:i})}build(){return this.applyTokens(),super.build()}buildEdits(){return this.applyTokens(),super.buildEdits()}flush(){this.previousResult(this.id)}applyTokens(){for(let e of this._tokens.sort(this.compareTokens))super.push(e.line,e.char,e.length,e.tokenType,e.tokenModifiers);this._tokens=[]}compareTokens(e,t){return e.line===t.line?e.char-t.char:e.line-t.line}},Ll=class{constructor(e){this.tokensBuilders=new Map,e.shared.workspace.TextDocuments.onDidClose(e=>{this.tokensBuilders.delete(e.document.uri)}),e.shared.lsp.LanguageServer.onInitialize(e=>{this.initialize(e.capabilities.textDocument?.semanticTokens)})}initialize(e){this.clientCapabilities=e}get tokenTypes(){return Nl}get tokenModifiers(){return Pl}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,t,n=G.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightRange(e,t,n=G.CancellationToken.None){return this.currentRange=t.range,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.flush(),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.build()}async semanticHighlightDelta(e,t,n=G.CancellationToken.None){return this.currentRange=void 0,this.currentDocument=e,this.currentTokensBuilder=this.getDocumentTokensBuilder(e),this.currentTokensBuilder.previousResult(t.previousResultId),await this.computeHighlighting(e,this.createAcceptor(),n),this.currentTokensBuilder.buildEdits()}createAcceptor(){let e=e=>{`line`in e?this.highlightToken({range:{start:{line:e.line,character:e.char},end:{line:e.line,character:e.char+e.length}},type:e.type,modifier:e.modifier}):`range`in e?this.highlightToken(e):`keyword`in e?this.highlightKeyword(e):`property`in e?this.highlightProperty(e):this.highlightNode({node:e.cst,type:e.type,modifier:e.modifier})};return e}getDocumentTokensBuilder(e){let t=this.tokensBuilders.get(e.uri.toString());if(t)return t;let n=new Il;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,t,n){let r=e.parseResult.value,i=vn(r,{range:this.currentRange}).iterator(),a;do if(a=i.next(),!a.done){await K(n);let e=a.value;this.highlightElement(e,t)===`prune`&&i.prune()}while(!a.done)}highlightToken(e){let{range:t,type:n}=e,r=e.modifier;if(this.currentRange&&!oe(t,this.currentRange)||!this.currentDocument||!this.currentTokensBuilder)return;let i=this.tokenTypes[n],a=0;if(r!==void 0){typeof r==`string`&&(r=[r]);for(let e of r){let t=this.tokenModifiers[e];a|=t}}let o=t.start.line,s=t.end.line;if(o===s){let e=t.start.character,n=t.end.character-e;this.currentTokensBuilder.push(o,e,n,i,a)}else if(this.clientCapabilities?.multilineTokenSupport){let e=t.start.character,n=this.currentDocument.textDocument.offsetAt(t.start),r=this.currentDocument.textDocument.offsetAt(t.end);this.currentTokensBuilder.push(o,e,r-n,i,a)}else{let e=t.start,n=this.currentDocument.textDocument.offsetAt({line:o+1,character:0});this.currentTokensBuilder.push(e.line,e.character,n-e.character-1,i,a);for(let e=o+1;e<s;e++){let t=n;n=this.currentDocument.textDocument.offsetAt({line:e+1,character:0}),this.currentTokensBuilder.push(e,0,n-t-1,i,a)}this.currentTokensBuilder.push(s,0,t.end.character,i,a)}}highlightProperty(e){let t=[];if(typeof e.index==`number`){let n=Kn(e.node.$cstNode,e.property,e.index);n&&t.push(n)}else t.push(...Gn(e.node.$cstNode,e.property));let{type:n,modifier:r}=e;for(let e of t)this.highlightNode({node:e,type:n,modifier:r})}highlightKeyword(e){let{node:t,keyword:n,type:r,index:i,modifier:a}=e,o=[];if(typeof i==`number`){let e=Yn(t.$cstNode,n,i);e&&o.push(e)}else o.push(...Jn(t.$cstNode,n));for(let e of o)this.highlightNode({node:e,type:r,modifier:a})}highlightNode(e){let{node:t,type:n,modifier:r}=e,i=t.range;this.highlightToken({range:i,type:n,modifier:r})}},Rl;(function(e){function t(e,t,r){let i=new Map;Object.entries(t).forEach(([e,t])=>i.set(t,e));let a=0,o=0;return n(e.data,5).map(e=>{a+=e[0],e[0]!==0&&(o=0),o+=e[1];let t=e[2];return{offset:r.textDocument.offsetAt({line:a,character:o}),tokenType:i.get(e[3]),tokenModifiers:e[4],text:r.textDocument.getText({start:{line:a,character:o},end:{line:a,character:o+t}})}})}e.decode=t;function n(e,t){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}})(Rl||={});function zl(e){let t=[],n=[];e.forEach(e=>{e?.triggerCharacters&&t.push(...e.triggerCharacters),e?.retriggerCharacters&&n.push(...e.retriggerCharacters)});let r={triggerCharacters:t.length>0?Array.from(new Set(t)).sort():void 0,retriggerCharacters:n.length>0?Array.from(new Set(n)).sort():void 0};return r.triggerCharacters?r:void 0}var Bl=Z(),Vl=class{constructor(e){this.onInitializeEmitter=new Bl.Emitter,this.onInitializedEmitter=new Bl.Emitter,this.services=e}get onInitialize(){return this.onInitializeEmitter.event}get onInitialized(){return this.onInitializedEmitter.event}async initialize(e){return this.eagerLoadServices(),this.fireInitializeOnDefaultServices(e),this.onInitializeEmitter.fire(e),this.onInitializeEmitter.dispose(),this.buildInitializeResult(e)}eagerLoadServices(){Is(this.services),this.services.ServiceRegistry.all.forEach(e=>Is(e))}hasService(e){return this.services.ServiceRegistry.all.some(t=>e(t)!==void 0)}buildInitializeResult(e){let t=this.services.lsp.DocumentUpdateHandler,n=this.services.lsp.FileOperationHandler?.fileOperationOptions,r=this.services.ServiceRegistry.all,i=this.hasService(e=>e.lsp?.Formatter),a=r.map(e=>e.lsp?.Formatter?.formatOnTypeOptions).find(e=>!!e),o=this.hasService(e=>e.lsp?.CodeActionProvider),s=this.hasService(e=>e.lsp?.SemanticTokenProvider),c=Fl(r.map(e=>e.lsp?.SemanticTokenProvider?.semanticTokensOptions)),l=this.services.lsp?.ExecuteCommandHandler?.commands,u=this.hasService(e=>e.lsp?.DocumentLinkProvider),d=zl(r.map(e=>e.lsp?.SignatureHelp?.signatureHelpOptions)),f=this.hasService(e=>e.lsp?.TypeProvider),p=this.hasService(e=>e.lsp?.ImplementationProvider),m=this.hasService(e=>e.lsp?.CompletionProvider),h=vl(r.map(e=>e.lsp?.CompletionProvider?.completionOptions)),g=this.hasService(e=>e.lsp?.ReferencesProvider),_=this.hasService(e=>e.lsp?.DocumentSymbolProvider),v=this.hasService(e=>e.lsp?.DefinitionProvider),y=this.hasService(e=>e.lsp?.DocumentHighlightProvider),b=this.hasService(e=>e.lsp?.FoldingRangeProvider),x=this.hasService(e=>e.lsp?.HoverProvider),S=this.hasService(e=>e.lsp?.RenameProvider),C=this.hasService(e=>e.lsp?.CallHierarchyProvider),w=this.hasService(e=>e.lsp?.TypeHierarchyProvider),T=this.hasService(e=>e.lsp?.CodeLensProvider),E=this.hasService(e=>e.lsp?.DeclarationProvider),D=this.hasService(e=>e.lsp?.InlayHintProvider),O=this.services.lsp?.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:n},executeCommandProvider:l&&{commands:l},textDocumentSync:{change:Bl.TextDocumentSyncKind.Incremental,openClose:!0,save:!!t.didSaveDocument,willSave:!!t.willSaveDocument,willSaveWaitUntil:!!t.willSaveDocumentWaitUntil},completionProvider:m?h:void 0,referencesProvider:g,documentSymbolProvider:_,definitionProvider:v,typeDefinitionProvider:f,documentHighlightProvider:y,codeActionProvider:o,documentFormattingProvider:i,documentRangeFormattingProvider:i,documentOnTypeFormattingProvider:a,foldingRangeProvider:b,hoverProvider:x,renameProvider:S?{prepareProvider:!0}:void 0,semanticTokensProvider:s?c:void 0,signatureHelpProvider:d,implementationProvider:p,callHierarchyProvider:C?{}:void 0,typeHierarchyProvider:w?{}:void 0,documentLinkProvider:u?{resolveProvider:!1}:void 0,codeLensProvider:T?{resolveProvider:!1}:void 0,declarationProvider:E,inlayHintProvider:D?{resolveProvider:!1}:void 0,workspaceSymbolProvider:O?{resolveProvider:!!O.resolveSymbol}:void 0}}}initialized(e){this.fireInitializedOnDefaultServices(e),this.onInitializedEmitter.fire(e),this.onInitializedEmitter.dispose()}fireInitializeOnDefaultServices(e){this.services.workspace.ConfigurationProvider.initialize(e),this.services.workspace.WorkspaceManager.initialize(e)}fireInitializedOnDefaultServices(e){let t=this.services.lsp.Connection,n=t?Object.assign(Object.assign({},e),{register:e=>t.client.register(Bl.DidChangeConfigurationNotification.type,e),fetchConfiguration:e=>t.workspace.getConfiguration(e)}):e;this.services.workspace.ConfigurationProvider.initialized(n).catch(e=>console.error(`Error in ConfigurationProvider initialization:`,e)),this.services.workspace.WorkspaceManager.initialized(e).catch(e=>console.error(`Error in WorkspaceManager initialization:`,e))}};function Hl(e){let t=e.lsp.Connection;if(!t)throw Error(`Starting a language server requires the languageServer.Connection service to be set.`);Ul(t,e),Wl(t,e),Gl(t,e),Kl(t,e),ql(t,e),Yl(t,e),Xl(t,e),Zl(t,e),Ql(t,e),eu(t,e),nu(t,e),ru(t,e),Jl(t,e),iu(t,e),tu(t,e),au(t,e),ou(t,e),cu(t,e),uu(t,e),pu(t,e),mu(t,e),du(t,e),lu(t,e),su(t,e),$l(t,e),fu(t,e),t.onInitialize(t=>e.lsp.LanguageServer.initialize(t)),t.onInitialized(t=>{e.lsp.LanguageServer.initialized(t)}),e.workspace.TextDocuments.listen(t),t.listen()}function Ul(e,t){let n=t.lsp.DocumentUpdateHandler,r=t.workspace.TextDocuments;n.didOpenDocument&&r.onDidOpen(e=>n.didOpenDocument(e)),n.didChangeContent&&r.onDidChangeContent(e=>n.didChangeContent(e)),n.didCloseDocument&&r.onDidClose(e=>n.didCloseDocument(e)),n.didSaveDocument&&r.onDidSave(e=>n.didSaveDocument(e)),n.willSaveDocument&&r.onWillSave(e=>n.willSaveDocument(e)),n.willSaveDocumentWaitUntil&&r.onWillSaveWaitUntil(e=>n.willSaveDocumentWaitUntil(e)),n.didChangeWatchedFiles&&e.onDidChangeWatchedFiles(e=>n.didChangeWatchedFiles(e))}function Wl(e,t){let n=t.lsp.FileOperationHandler;n&&(n.didCreateFiles&&e.workspace.onDidCreateFiles(e=>n.didCreateFiles(e)),n.didRenameFiles&&e.workspace.onDidRenameFiles(e=>n.didRenameFiles(e)),n.didDeleteFiles&&e.workspace.onDidDeleteFiles(e=>n.didDeleteFiles(e)),n.willCreateFiles&&e.workspace.onWillCreateFiles(e=>n.willCreateFiles(e)),n.willRenameFiles&&e.workspace.onWillRenameFiles(e=>n.willRenameFiles(e)),n.willDeleteFiles&&e.workspace.onWillDeleteFiles(e=>n.willDeleteFiles(e)))}function Gl(e,t){let n=t.workspace.DocumentBuilder;n.onUpdate(async(t,n)=>{for(let t of n)e.sendDiagnostics({uri:t.toString(),diagnostics:[]})}),n.onDocumentPhase(Y.Validated,async t=>{t.diagnostics&&e.sendDiagnostics({uri:t.uri.toString(),diagnostics:t.diagnostics})})}function Kl(e,t){e.onCompletion($((e,t,n,r)=>(e.lsp?.CompletionProvider)?.getCompletion(t,n,r),t,Y.IndexedReferences))}function ql(e,t){e.onReferences($((e,t,n,r)=>(e.lsp?.ReferencesProvider)?.findReferences(t,n,r),t,Y.IndexedReferences))}function Jl(e,t){e.onCodeAction($((e,t,n,r)=>(e.lsp?.CodeActionProvider)?.getCodeActions(t,n,r),t,Y.Validated))}function Yl(e,t){e.onDocumentSymbol($((e,t,n,r)=>(e.lsp?.DocumentSymbolProvider)?.getSymbols(t,n,r),t,Y.Parsed))}function Xl(e,t){e.onDefinition($((e,t,n,r)=>(e.lsp?.DefinitionProvider)?.getDefinition(t,n,r),t,Y.IndexedReferences))}function Zl(e,t){e.onTypeDefinition($((e,t,n,r)=>(e.lsp?.TypeProvider)?.getTypeDefinition(t,n,r),t,Y.IndexedReferences))}function Ql(e,t){e.onImplementation($((e,t,n,r)=>(e.lsp?.ImplementationProvider)?.getImplementation(t,n,r),t,Y.IndexedReferences))}function $l(e,t){e.onDeclaration($((e,t,n,r)=>(e.lsp?.DeclarationProvider)?.getDeclaration(t,n,r),t,Y.IndexedReferences))}function eu(e,t){e.onDocumentHighlight($((e,t,n,r)=>(e.lsp?.DocumentHighlightProvider)?.getDocumentHighlight(t,n,r),t,Y.IndexedReferences))}function tu(e,t){e.onHover($((e,t,n,r)=>(e.lsp?.HoverProvider)?.getHoverContent(t,n,r),t,Y.IndexedReferences))}function nu(e,t){e.onFoldingRanges($((e,t,n,r)=>(e.lsp?.FoldingRangeProvider)?.getFoldingRanges(t,n,r),t,Y.Parsed))}function ru(e,t){e.onDocumentFormatting($((e,t,n,r)=>(e.lsp?.Formatter)?.formatDocument(t,n,r),t,Y.Parsed)),e.onDocumentRangeFormatting($((e,t,n,r)=>(e.lsp?.Formatter)?.formatDocumentRange(t,n,r),t,Y.Parsed)),e.onDocumentOnTypeFormatting($((e,t,n,r)=>(e.lsp?.Formatter)?.formatDocumentOnType(t,n,r),t,Y.Parsed))}function iu(e,t){e.onRenameRequest($((e,t,n,r)=>(e.lsp?.RenameProvider)?.rename(t,n,r),t,Y.IndexedReferences)),e.onPrepareRename($((e,t,n,r)=>(e.lsp?.RenameProvider)?.prepareRename(t,n,r),t,Y.IndexedReferences))}function au(e,t){e.languages.inlayHint.on(gu((e,t,n,r)=>(e.lsp?.InlayHintProvider)?.getInlayHints(t,n,r),t,Y.IndexedReferences))}function ou(e,t){let n={data:[]};e.languages.semanticTokens.on(gu((e,t,r,i)=>e.lsp?.SemanticTokenProvider?e.lsp.SemanticTokenProvider.semanticHighlight(t,r,i):n,t,Y.IndexedReferences)),e.languages.semanticTokens.onDelta(gu((e,t,r,i)=>e.lsp?.SemanticTokenProvider?e.lsp.SemanticTokenProvider.semanticHighlightDelta(t,r,i):n,t,Y.IndexedReferences)),e.languages.semanticTokens.onRange(gu((e,t,r,i)=>e.lsp?.SemanticTokenProvider?e.lsp.SemanticTokenProvider.semanticHighlightRange(t,r,i):n,t,Y.IndexedReferences))}function su(e,t){e.onDidChangeConfiguration(e=>{e.settings&&t.workspace.ConfigurationProvider.updateConfiguration(e)})}function cu(e,t){let n=t.lsp.ExecuteCommandHandler;n&&e.onExecuteCommand(async(e,t)=>{try{return await n.executeCommand(e.command,e.arguments??[],t)}catch(e){return vu(e)}})}function lu(e,t){e.onDocumentLinks(gu((e,t,n,r)=>(e.lsp?.DocumentLinkProvider)?.getDocumentLinks(t,n,r),t,Y.Parsed))}function uu(e,t){e.onSignatureHelp(gu((e,t,n,r)=>(e.lsp?.SignatureHelp)?.provideSignatureHelp(t,n,r),t,Y.IndexedReferences))}function du(e,t){e.onCodeLens(gu((e,t,n,r)=>(e.lsp?.CodeLensProvider)?.provideCodeLens(t,n,r),t,Y.IndexedReferences))}function fu(e,t){let n=t.lsp.WorkspaceSymbolProvider;if(n){let r=t.workspace.DocumentBuilder;e.onWorkspaceSymbol(async(e,t)=>{try{return await r.waitUntil(Y.IndexedContent,t),await n.getSymbols(e,t)}catch(e){return vu(e)}});let i=n.resolveSymbol?.bind(n);i&&e.onWorkspaceSymbolResolve(async(e,t)=>{try{return await r.waitUntil(Y.IndexedContent,t),await i(e,t)}catch(e){return vu(e)}})}}function pu(e,t){e.languages.callHierarchy.onPrepare(gu(async(e,t,n,r)=>e.lsp?.CallHierarchyProvider?await e.lsp.CallHierarchyProvider.prepareCallHierarchy(t,n,r)??null:null,t,Y.IndexedReferences)),e.languages.callHierarchy.onIncomingCalls(hu(async(e,t,n)=>e.lsp?.CallHierarchyProvider?await e.lsp.CallHierarchyProvider.incomingCalls(t,n)??null:null,t)),e.languages.callHierarchy.onOutgoingCalls(hu(async(e,t,n)=>e.lsp?.CallHierarchyProvider?await e.lsp.CallHierarchyProvider.outgoingCalls(t,n)??null:null,t))}function mu(e,t){t.ServiceRegistry.all.some(e=>e.lsp?.TypeHierarchyProvider)&&(e.languages.typeHierarchy.onPrepare(gu(async(e,t,n,r)=>await(e.lsp?.TypeHierarchyProvider)?.prepareTypeHierarchy(t,n,r)??null,t,Y.IndexedReferences)),e.languages.typeHierarchy.onSupertypes(hu(async(e,t,n)=>await(e.lsp?.TypeHierarchyProvider)?.supertypes(t,n)??null,t)),e.languages.typeHierarchy.onSubtypes(hu(async(e,t,n)=>await(e.lsp?.TypeHierarchyProvider)?.subtypes(t,n)??null,t)))}function hu(e,t){let n=t.ServiceRegistry;return async(r,i)=>{let a=q.parse(r.item.uri),o=await _u(t,i,a,Y.IndexedReferences);if(o)return o;if(!n.hasServices(a)){let e=`Could not find service instance for uri: '${a}'`;return console.debug(e),vu(Error(e))}let s=n.getServices(a);try{return await e(s,r,i)}catch(e){return vu(e)}}}function gu(e,t,n){let r=t.workspace.LangiumDocuments,i=t.ServiceRegistry;return async(a,o)=>{let s=q.parse(a.textDocument.uri),c=await _u(t,o,s,n);if(c)return c;if(!i.hasServices(s)){let e=`Could not find service instance for uri: '${s}'`;return console.debug(e),vu(Error(e))}let l=i.getServices(s);try{return await e(l,await r.getOrCreateDocument(s),a,o)}catch(e){return vu(e)}}}function $(e,t,n){let r=t.workspace.LangiumDocuments,i=t.ServiceRegistry;return async(a,o)=>{let s=q.parse(a.textDocument.uri),c=await _u(t,o,s,n);if(c)return c;if(!i.hasServices(s))return console.debug(`Could not find service instance for uri: '${s.toString()}'`),null;let l=i.getServices(s);try{return await e(l,await r.getOrCreateDocument(s),a,o)}catch(e){return vu(e)}}}async function _u(e,t,n,r){if(r!==void 0){let i=e.workspace.DocumentBuilder;try{await i.waitUntil(r,n,t)}catch(e){return vu(e)}}}function vu(e){if(Ja(e))return new Bl.ResponseError(Bl.LSPErrorCodes.RequestCancelled,`The request has been cancelled.`);if(e instanceof Bl.ResponseError)return e;throw e}var yu=class{getSymbolKind(e){return Q.SymbolKind.Field}getCompletionItemKind(e){return Q.CompletionItemKind.Reference}},bu=class{constructor(e){this.nameProvider=e.references.NameProvider,this.references=e.references.References,this.grammarConfig=e.parser.GrammarConfig}findReferences(e,t,n){let r=e.parseResult.value.$cstNode;if(!r)return[];let i=ce(r,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);return i?this.getReferences(i,t,e):[]}getReferences(e,t,n){let r=[],i=this.references.findDeclaration(e);if(i){let e={includeDeclaration:t.context.includeDeclaration};this.references.findReferences(i,e).forEach(e=>{r.push(Q.Location.create(e.sourceUri.toString(),e.segment.range))})}return r}};Qi();var xu=class{constructor(e){this.references=e.references.References,this.nameProvider=e.references.NameProvider,this.grammarConfig=e.parser.GrammarConfig}async rename(e,t,n){let r={},i=e.parseResult.value.$cstNode;if(!i)return;let a=ce(i,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!a)return;let o=this.references.findDeclaration(a);if(o)return this.references.findReferences(o,{onlyLocal:!1,includeDeclaration:!0}).forEach(e=>{let n=Hr.replace(e.segment.range,t.newName),i=e.sourceUri.toString();r[i]?r[i].push(n):r[i]=[n]}),{changes:r}}prepareRename(e,t,n){return this.renameNodeRange(e,t.position)}renameNodeRange(e,t){let n=e.parseResult.value.$cstNode,r=e.textDocument.offsetAt(t);if(n&&r){let e=ce(n,r,this.grammarConfig.nameRegexp);if(!e)return;if(this.references.findDeclaration(e)||this.isNameNode(e))return e.range}}isNameNode(e){return e?.astNode&&co(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}},Su=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,t=G.CancellationToken.None){let n=[],r=e.query.toLowerCase();for(let e of this.indexManager.allElements())if(await K(t),this.fuzzyMatcher.match(r,e.name)){let t=this.getWorkspaceSymbol(e);t&&n.push(t)}return n}getWorkspaceSymbol(e){let t=e.nameSegment;if(t)return{kind:this.nodeKindProvider.getSymbolKind(e),name:e.name,location:{range:t.range,uri:e.documentUri.toString()}}}},Cu=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Q.Emitter,this._onDidOpen=new Q.Emitter,this._onDidClose=new Q.Emitter,this._onDidSave=new Q.Emitter,this._onWillSave=new Q.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(J.normalize(e))}set(e){let t=J.normalize(e.uri),n=!0;this._syncedDocuments.has(t)&&(n=!1),this._syncedDocuments.set(t,e);let r=Object.freeze({document:e});return this._onDidOpen.fire(r),this._onDidChangeContent.fire(r),n}delete(e){let t=J.normalize(typeof e==`object`&&`uri`in e?e.uri:e),n=this._syncedDocuments.get(t);n!==void 0&&(this._syncedDocuments.delete(t),this._onDidClose.fire(Object.freeze({document:n})))}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Q.TextDocumentSyncKind.Incremental;let t=[];return t.push(e.onDidOpenTextDocument(e=>{let t=e.textDocument,n=J.normalize(t.uri),r=this._configuration.create(n,t.languageId,t.version,t.text);this._syncedDocuments.set(n,r);let i=Object.freeze({document:r});this._onDidOpen.fire(i),this._onDidChangeContent.fire(i)})),t.push(e.onDidChangeTextDocument(e=>{let t=e.textDocument,n=e.contentChanges;if(n.length===0)return;let{version:r}=t;if(r==null)throw Error(`Received document change event for ${t.uri} without valid version identifier`);let i=J.normalize(t.uri),a=this._syncedDocuments.get(i);a!==void 0&&(a=this._configuration.update(a,n,r),this._syncedDocuments.set(i,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),t.push(e.onDidCloseTextDocument(e=>{let t=J.normalize(e.textDocument.uri),n=this._syncedDocuments.get(t);n!==void 0&&(this._syncedDocuments.delete(t),this._onDidClose.fire(Object.freeze({document:n})))})),t.push(e.onWillSaveTextDocument(e=>{let t=this._syncedDocuments.get(J.normalize(e.textDocument.uri));t!==void 0&&this._onWillSave.fire(Object.freeze({document:t,reason:e.reason}))})),t.push(e.onWillSaveTextDocumentWaitUntil((e,t)=>{let n=this._syncedDocuments.get(J.normalize(e.textDocument.uri));return n!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:n,reason:e.reason}),t):[]})),t.push(e.onDidSaveTextDocument(e=>{let t=this._syncedDocuments.get(J.normalize(e.textDocument.uri));t!==void 0&&this._onDidSave.fire(Object.freeze({document:t}))})),Q.Disposable.create(()=>{t.forEach(e=>e.dispose())})}},wu=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new Q.Emitter,this._onDidSave=new Q.Emitter,this._onDidChange=new Q.Emitter,this._onDidClose=new Q.Emitter,`listen`in e?this._cellTextDocuments=e:this._cellTextDocuments=new Cu(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(J.normalize(e))}getNotebookCell(e){let t=this.notebookCellMap.get(J.normalize(e));return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e==`string`||`scheme`in e?e:e.document,n=this.notebookCellMap.get(J.normalize(t));return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let t=new Tu,n=[];return n.push(this.cellTextDocuments.listen(t)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(e=>{let n=J.normalize(e.notebookDocument.uri);this.notebookDocuments.set(n,e.notebookDocument);for(let n of e.cellTextDocuments)t.openTextDocument({textDocument:n});this.updateCellMap(e.notebookDocument),this._onDidOpen.fire(e.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(e=>{let n=J.normalize(e.notebookDocument.uri),r=this.notebookDocuments.get(n);if(r===void 0)return;r.version=e.notebookDocument.version;let i=r.metadata,a=!1,o=e.change;o.metadata!==void 0&&(a=!0,r.metadata=o.metadata);let s=[],c=[],l=[],u=[];if(o.cells!==void 0){let e=o.cells;if(e.structure!==void 0){let n=e.structure.array;if(r.cells.splice(n.start,n.deleteCount,...n.cells===void 0?[]:n.cells),e.structure.didOpen!==void 0)for(let n of e.structure.didOpen)t.openTextDocument({textDocument:n}),s.push(n.uri);if(e.structure.didClose)for(let n of e.structure.didClose)t.closeTextDocument({textDocument:n}),c.push(n.uri)}if(e.data!==void 0){let t=new Map(e.data.map(e=>[e.document,e]));for(let e=0;e<=r.cells.length;e++){let n=t.get(r.cells[e].document);if(n!==void 0){let i=r.cells.splice(e,1,n);if(l.push({old:i[0],new:n}),t.delete(n.document),t.size===0)break}}}if(e.textContent!==void 0)for(let n of e.textContent)t.changeTextDocument({textDocument:n.document,contentChanges:n.changes}),u.push(n.document.uri)}this.updateCellMap(r);let d={notebookDocument:r};a&&(d.metadata={old:i,new:r.metadata});let f=[];for(let e of s)f.push(this.getNotebookCell(e));let p=[];for(let e of c)p.push(this.getNotebookCell(e));let m=[];for(let e of u)m.push(this.getNotebookCell(e));(f.length>0||p.length>0||l.length>0||m.length>0)&&(d.cells={added:f,removed:p,changed:{data:l,textContent:m}}),(d.metadata!==void 0||d.cells!==void 0)&&this._onDidChange.fire(d)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(e=>{let t=this.getNotebookDocument(e.notebookDocument.uri);t!==void 0&&this._onDidSave.fire(t)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(e=>{let n=J.normalize(e.notebookDocument.uri),r=this.notebookDocuments.get(n);if(r!==void 0){this._onDidClose.fire(r);for(let n of e.cellTextDocuments)t.closeTextDocument({textDocument:n});this.notebookDocuments.delete(n);for(let e of r.cells)this.notebookCellMap.delete(e.document)}})),Q.Disposable.create(()=>{n.forEach(e=>e.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}},Tu=class e{onDidOpenTextDocument(e){return this.openHandler=e,Q.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,Q.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,Q.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return e.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return e.NULL_DISPOSE}onDidSaveTextDocument(){return e.NULL_DISPOSE}};Tu.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function Eu(e){return Ns.merge(js(e),Du(e))}function Du(e){return{lsp:{CompletionProvider:e=>new yl(e),DocumentSymbolProvider:e=>new Sl(e),HoverProvider:e=>new Ml(e),FoldingRangeProvider:e=>new wl(e),ReferencesProvider:e=>new bu(e),DefinitionProvider:e=>new bl(e),DocumentHighlightProvider:e=>new xl(e),RenameProvider:e=>new xu(e)},shared:()=>e.shared}}function Ou(e){return Ns.merge(Ms(e),ku(e))}function ku(e){return{lsp:{Connection:()=>e.connection,LanguageServer:e=>new Vl(e),DocumentUpdateHandler:e=>new Cl(e),WorkspaceSymbolProvider:e=>new Su(e),NodeKindProvider:()=>new yu,FuzzyMatcher:()=>new Tl},workspace:{TextDocuments:()=>new Cu(Za),NotebookDocuments:e=>new wu(e.workspace.TextDocuments)}}}var Au=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new ju(e,this.collector)}formatDocument(e,t){let n=e.parseResult;return n.lexerErrors.length===0&&n.parserErrors.length===0?this.doDocumentFormat(e,t.options):[]}isFormatRangeErrorFree(e,t){let n=e.parseResult;return n.lexerErrors.length||n.parserErrors.length?Math.min(...n.lexerErrors.map(e=>e.line??Number.MAX_VALUE),...n.parserErrors.map(e=>e.token.startLine??Number.MAX_VALUE))>t.end.line:!0}formatDocumentRange(e,t){return this.isFormatRangeErrorFree(e,t.range)?this.doDocumentFormat(e,t.options,t.range):[]}formatDocumentOnType(e,t){let n={start:{character:0,line:t.position.line},end:t.position};return this.isFormatRangeErrorFree(e,n)?this.doDocumentFormat(e,t.options,n):[]}get formatOnTypeOptions(){}doDocumentFormat(e,t,n){let r=new Map,i=(e,t,n)=>{let i=this.nodeModeToKey(e,t),a=r.get(i),o=n.options.priority??0,s=a?.options.priority??0;(!a||s<=o)&&r.set(i,n)};this.collector=i,this.iterateAstFormatting(e,n);let a=this.iterateCstFormatting(e,r,t,n);return this.avoidOverlappingEdits(e.textDocument,a)}avoidOverlappingEdits(e,t){let n=[];for(let r of t){let t=n[n.length-1];for(;t&&e.offsetAt(r.range.start)<e.offsetAt(t.range.end);)n.pop(),t=n[n.length-1];n.push(r)}return n.filter(t=>this.isNecessary(t,e))}iterateAstFormatting(e,t){let n=e.parseResult.value;this.format(n);let r=_n(n).iterator(),i;do if(i=r.next(),!i.done){let e=i.value;this.insideRange(e.$cstNode.range,t)?this.format(e):r.prune()}while(!i.done)}nodeModeToKey(e,t){return`${e.offset}:${e.end}:${t}`}insideRange(e,t){return!t||e.start.line<=t.start.line&&e.end.line>=t.end.line||e.start.line>=t.start.line&&e.end.line<=t.end.line||e.start.line<=t.end.line&&e.end.line>=t.end.line}isNecessary(e,t){return e.newText!==t.getText(e.range).replace(/\r/g,``)}iterateCstFormatting(e,t,n,r){let i={indentation:0,options:n,document:e.textDocument},a=[],o=this.iterateCstTree(e,i).iterator(),s,c;do if(c=o.next(),!c.done){let e=c.value,n=E(e),o=this.nodeModeToKey(e,`prepend`),l=t.get(o);if(t.delete(o),l){let t=this.createTextEdit(s,e,l,i);for(let e of t)e&&this.insideRange(e.range,r)&&a.push(e)}let u=this.nodeModeToKey(e,`append`),d=t.get(u);if(t.delete(u),d){let t=he(e);if(t){let n=this.createTextEdit(e,t,d,i);for(let e of n)e&&this.insideRange(e.range,r)&&a.push(e)}}if(!l&&e.hidden){let t=this.createHiddenTextEdits(s,e,void 0,i);for(let e of t)e&&this.insideRange(e.range,r)&&a.push(e)}n&&(s=e)}while(!c.done);return a}createHiddenTextEdits(e,t,n,r){let i=t.range.start.line;if(e&&e.range.end.line===i)return[];let a=[],o={start:{character:0,line:i},end:t.range.start},s=r.document.getText(o),c=this.findFittingMove(o,n?.moves??[],r),l=this.getExistingIndentationCharacterCount(s,r),u=this.getIndentationCharacterCount(r,c)-l;if(u===0)return[];let d=``;u>0&&(d=(r.options.insertSpaces?` `:` `).repeat(u));let f=t.text.split(`
28
- `);f[0]=s+f[0];for(let e=0;e<f.length;e++){let t=i+e,n={character:0,line:t};if(u>0)a.push({newText:d,range:{start:n,end:n}});else{let r=f[e],i=0;for(;i<r.length;i++){let e=r.charAt(i);if(e!==` `&&e!==` `)break}a.push({newText:``,range:{start:n,end:{line:t,character:Math.min(i,Math.abs(u))}}})}}return a}getExistingIndentationCharacterCount(e,t){let n=` `.repeat(t.options.tabSize);return(t.options.insertSpaces?e.replaceAll(` `,n):e.replaceAll(n,` `)).length}getIndentationCharacterCount(e,t){let n=e.indentation;return t&&t.tabs&&(n+=t.tabs),(e.options.insertSpaces?e.options.tabSize:1)*n}createTextEdit(e,t,n,r){if(t.hidden)return this.createHiddenTextEdits(e,t,n,r);if(e&&(e.range.end.line>t.range.start.line||e.range.end.line===t.range.start.line&&e.range.end.character>t.range.start.character))return[];let i={start:e?.range.end??{character:0,line:0},end:t.range.start},a=this.findFittingMove(i,n.moves,r);if(!a)return[];let o=a.characters,s=a.lines,c=a.tabs,l=r.indentation;r.indentation+=c??0;let u=[];return o===void 0?s===void 0?c!==void 0&&u.push(this.createTabTextEdit(i,!!e,r)):u.push(this.createLineTextEdit(i,s,r,n.options)):e?.hidden||u.push(this.createSpaceTextEdit(i,o,n.options)),E(t)&&(r.indentation=l),u}createSpaceTextEdit(e,t,n){if(e.start.line===e.end.line){let r=e.end.character-e.start.character;t=this.fitIntoOptions(t,r,n)}return{newText:` `.repeat(t),range:e}}createLineTextEdit(e,t,n,r){let i=e.end.line-e.start.line;t=this.fitIntoOptions(t,i,r);let a=(n.options.insertSpaces?` `.repeat(n.options.tabSize):` `).repeat(n.indentation);return{newText:`${`
29
- `.repeat(t)}${a}`,range:e}}createTabTextEdit(e,t,n){let r=(n.options.insertSpaces?` `.repeat(n.options.tabSize):` `).repeat(n.indentation),i=t?1:0,a=Math.max(e.end.line-e.start.line,i);return{newText:`${`
30
- `.repeat(a)}${r}`,range:e}}fitIntoOptions(e,t,n){return n.allowMore?e=Math.max(t,e):n.allowLess&&(e=Math.min(t,e)),e}findFittingMove(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];let r=e.end.line-e.start.line;for(let e of t)if(e.lines!==void 0&&r<=e.lines)return e;else if(e.lines===void 0&&r===0)return e;return t[t.length-1]}iterateCstTree(e,t){let n=e.parseResult.value.$cstNode;return n?new ne(n,e=>this.iterateCst(e,t)):k}iterateCst(e,t){if(!T(e))return k;let n=t.indentation;return new O(()=>({index:0}),r=>r.index<e.content.length?{done:!1,value:e.content[r.index++]}:(t.indentation=n,A))}},ju=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new Mu(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new Mu(t,this.collector)}property(e,t){let n=Kn(this.astNode.$cstNode,e,t);return new Mu(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let e=Gn(this.astNode.$cstNode,n);t.push(...e)}return new Mu(t,this.collector)}keyword(e,t){let n=Yn(this.astNode.$cstNode,e,t);return new Mu(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let e=Jn(this.astNode.$cstNode,n);t.push(...e)}return new Mu(t,this.collector)}cst(e){return new Mu([...e],this.collector)}interior(e,t){let n=e.nodes,r=t.nodes;if(n.length!==1||r.length!==1)return new Mu([],this.collector);let i=n[0],a=r[0];if(i.offset>a.offset){let e=i;i=a,a=e}return new Mu(_e(i,a),this.collector)}},Mu=class e{constructor(e,t){this.nodes=e,this.collector=t}prepend(e){for(let t of this.nodes)this.collector(t,`prepend`,e);return this}append(e){for(let t of this.nodes)this.collector(t,`append`,e);return this}surround(e){for(let t of this.nodes)this.collector(t,`prepend`,e),this.collector(t,`append`,e);return this}slice(t,n){return new e(this.nodes.slice(t,n),this.collector)}},Nu;(function(e){function t(...e){return{options:{},moves:e.flatMap(e=>e.moves).sort(l)}}e.fit=t;function n(e){return i(0,e)}e.noSpace=n;function r(e){return i(1,e)}e.oneSpace=r;function i(e,t){return{options:t??{},moves:[{characters:e}]}}e.spaces=i;function a(e){return o(1,e)}e.newLine=a;function o(e,t){return{options:t??{},moves:[{lines:e}]}}e.newLines=o;function s(e){return{options:e??{},moves:[{tabs:1,lines:1}]}}e.indent=s;function c(e){return{options:e??{},moves:[{tabs:0}]}}e.noIndent=c;function l(e,t){let n=e.lines??0,r=t.lines??0,i=e.tabs??0,a=t.tabs??0,o=e.characters??0,s=t.characters??0;return n<r?-1:n>r?1:i<a?-1:i>a?1:o<s?-1:o>s?1:0}})(Nu||={});var Pu=class{constructor(){this.encoding=`utf-8`}readFile(e){return y.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await y.promises.readdir(e.fsPath,{withFileTypes:!0})).map(t=>({dirent:t,isFile:t.isFile(),isDirectory:t.isDirectory(),uri:J.joinPath(e,t.name)}))}};function Fu(e){if(e){if(`astNode`in e)return Ru(e);if(Array.isArray(e))return e.reduce(Vu,void 0);{let t=e;return Bu(t,Iu(t)?Lu(t?.root?.astNode??t?.astNode):void 0)}}}function Iu(e){return e!==void 0&&`element`in e&&`text`in e}function Lu(e){try{return B(e).uri.toString()}catch{return}}function Ru(e){let{astNode:t,property:n,index:r}=e??{},i=t?.$cstNode??t?.$textRegion;if(!(t===void 0||i===void 0)){if(n===void 0)return Bu(i,zu(t));{let e=e=>r!==void 0&&r>-1&&Array.isArray(t[n])?r<e.length?e[r]:void 0:e.reduce(Vu,void 0);if(i.assignments?.[n]){let r=e(i.assignments[n]);return r&&Bu(r,zu(t))}else if(t.$cstNode){let r=e(Gn(t.$cstNode,n));return r&&Bu(r,zu(t))}else return}}}function zu(e){if(e.$cstNode)return(B(e)?.uri)?.toString();if(e.$textRegion)return e.$textRegion.documentURI||new ne(e,e=>e.$container?[e.$container]:[]).find(e=>e.$textRegion?.documentURI)?.$textRegion?.documentURI}function Bu(e,t){let n={offset:e.offset,end:e.end??e.offset+e.length,length:e.length??e.end-e.offset};return e.range&&(n.range=e.range),t??=e.fileURI,t&&(n.fileURI=t),n}function Vu(e,t){if(!e)return t&&Bu(t);if(!t)return e&&Bu(e);let n=e.end??e.offset+e.length,r=t.end??t.offset+t.length,i=Math.min(e.offset,t.offset),a=Math.max(n,r),o={offset:i,end:a,length:a-i};if(e.range&&t.range&&(o.range={start:t.range.start.line<e.range.start.line||t.range.start.line===e.range.start.line&&t.range.start.character<e.range.start.character?t.range.start:e.range.start,end:t.range.end.line>e.range.end.line||t.range.end.line===e.range.end.line&&t.range.end.character>e.range.end.character?t.range.end:e.range.end}),e.fileURI||t.fileURI){let n=e.fileURI,r=t.fileURI;o.fileURI=n&&r&&n!==r?`<unmergable text regions of ${n}, ${r}>`:n??r}return o}var Hu=class{constructor(e){this.defaultIndentation=` `,this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e==`string`?this.defaultIndentation=e:typeof e==`number`&&(this.defaultIndentation=``.padStart(e))}get content(){return this.lines.map(e=>e.join(``)).join(``)}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join(``)}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,t){if(e.length>0){let n=t&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let t=this.traceData.length-1;t>=0;t--){let n=this.traceData[t];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join(``).length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(e){let t=Uu(e,this.currentPosition,e=>(this.traceData[this.traceData.length-1]?.children)?.push(e));return this.traceData.push(t),t}popTraceRegion(e){let t=this.traceData.pop();return this.assertTrue(t===e,`Trace region mismatch!`),t}getParentTraceSourceFileURI(){for(let e=this.traceData.length-1;e>-1;e--){let t=this.traceData[e].sourceRegion?.fileURI;if(t)return t}}assertTrue(e,t){if(!e)throw Error(t)}};function Uu(e,t,n){let r={sourceRegion:e,targetRegion:void 0,children:[],targetStart:t,complete:e=>(r.targetRegion={offset:r.targetStart.offset,end:e.offset,length:e.offset-r.targetStart.offset,range:{start:{line:r.targetStart.line,character:r.targetStart.character},end:{line:e.line,character:e.character}}},delete r.targetStart,r.children?.length===0&&delete r.children,r.targetRegion?.length&&n(r),delete r.complete,r)};return r}function Wu(e,t){let n=new Hu(t),r=n.pushTraceRegion(void 0);Gu(e,n),n.popTraceRegion(r),r.complete&&r.complete(n.currentPosition);let i=r.children&&r.children.length===1?r.children[0]:void 0,a=i?.targetRegion,o=r.targetRegion;return a&&i.sourceRegion&&a.offset===o.offset&&a.length===o.length?{text:n.content,trace:i}:{text:n.content,trace:r}}function Gu(e,t){typeof e==`string`?qu(e,t):e instanceof gd?Xu(e,t):e instanceof md?Yu(e,t):e instanceof _d&&Zu(e,t)}function Ku(e,t){return typeof e==`string`?e.length!==0:e instanceof md?e.contents.some(e=>Ku(e,t)):e instanceof _d?!(e.ifNotEmpty&&t.currentLineContent.length===0):!1}function qu(e,t){e&&(Ju(t,!1),t.append(e))}function Ju(e,t){if(e.pendingIndent){let n=``;for(let r of e.relevantIndents.filter(e=>e.indentEmptyLines||!t))n+=r.indentation??e.defaultIndentation;e.append(n,!0),e.pendingIndent=!1}}function Yu(e,t){let n,r=Fu(e.tracedSource);r&&(n=t.pushTraceRegion(r));for(let n of e.contents)Gu(n,t);if(n){t.popTraceRegion(n);let e=t.getParentTraceSourceFileURI();e&&r?.fileURI===e&&delete r.fileURI,n.complete&&n.complete(t.currentPosition)}}function Xu(e,t){if(Ku(e,t)){e.indentImmediately&&!t.pendingIndent&&t.append(e.indentation??t.defaultIndentation,!0);try{t.increaseIndent(e),Yu(e,t)}finally{t.decreaseIndent()}}}function Zu(e,t){e.ifNotEmpty&&!Qu(t.currentLineContent)?t.resetCurrentLine():(Ju(t,!0),t.append(e.lineDelimiter),t.addNewLine())}function Qu(e){return e.trimStart()!==``}Object.freeze(`__«SKIP^NEW^LINE^IF^EMPTY»__`);const $u=/\S|$/;function ed(e){let t=e.filter(e=>e.length>0).map(e=>e.search($u)),n=t.length===0?0:Math.min(...t);return Math.max(0,n)}function td(e,...t){return ud(id(e,t,rd(e)))}function nd(e,t,n){return(r,...i)=>hd(e,t,n)(td(r,...i))}function rd(e){let t=e.join(`_`).split(En),n=t.length>1&&t[0].trim().length===0,r=n&&t.length>1&&t[t.length-1].trim().length===0;if(t.length===1||t.length!==0&&t[0].trim().length!==0||t.length===2&&t[1].trim().length===0)return{indentation:0,omitFirstLine:n,omitLastLine:r,trimLastLine:t.length!==1&&t[t.length-1].trim().length===0};{let e=n?t.slice(1):t;e=r?e.slice(0,e.length-1):e,e=e.filter(e=>e.length!==0);let i=ed(e);return{indentation:i,omitFirstLine:n,omitLastLine:r&&(t[t.length-1].length<i||!t[t.length-1].startsWith(e[0].substring(0,i)))}}}function id(e,t,{indentation:n,omitFirstLine:r,omitLastLine:i,trimLastLine:a}){let o=[];e.forEach((e,i)=>{o.push(...e.split(En).map((e,t)=>t===0||e.length<n?e:e.substring(n)).reduce(i===0?(e,t,n)=>n===0?r?[]:[t]:n===1&&e.length===0?[t]:e.concat(ad,t):(e,t,n)=>n===0?[t]:e.concat(ad,t),[]).filter(e=>!(typeof e==`string`&&e.length===0)).concat(fd(t[i])?t[i]:t[i]===void 0?i<t.length?od:[]:{content:String(t[i])}))});let s=o.length,c=s===0?void 0:o[s-1];return(i||a)&&typeof c==`string`&&c.trim().length===0?r&&s!==1&&o[s-2]===ad?o.slice(0,s-2):o.slice(0,s-1):o}const ad={isNewLine:!0},od={isUndefinedSegment:!0},sd=e=>e===ad,cd=e=>e===od,ld=e=>e.content!==void 0;function ud(e){return e.reduce((t,n,r)=>cd(n)?t:sd(n)?{node:r!==0&&(cd(e[r-1])||fd(e[r-1]))||r>1&&typeof e[r-1]==`string`&&(cd(e[r-2])||fd(e[r-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{let i=(r===0||sd(e[r-1]))&&typeof n==`string`&&n.length!==0?``.padStart(n.length-n.trimStart().length):``,a=ld(n)?n.content:n,o;return{node:t.indented?t.node:i.length===0?t.node.append(a):t.node.indent({indentation:i,indentImmediately:!1,indentedChildren:e=>o=e.append(a)}),indented:o??t.indented?.append(a)}})(),{node:new md}).node}const dd=typeof process>`u`?`
31
- `:process.platform===`win32`?`\r
32
- `:`
33
- `;function fd(e){return e instanceof md||e instanceof gd||e instanceof _d}function pd(e,t){return fd(e)?Wu(e,t).text:String(e)}var md=class e{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(b(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw Error(`Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.`)}else this.tracedSource=e;return this}append(...e){for(let t of e)typeof t==`function`?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(vd)}appendNewLineIf(e){return e?this.append(vd):this}appendNewLineIfNotEmpty(){return this.append(yd)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(td(e,...t))}appendTemplateIf(e){return e?(e,...t)=>this.appendTemplate(e,...t):()=>this}indent(e){let{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:i}=Array.isArray(e)||typeof e==`function`?{indentedChildren:e}:typeof e==`object`?e:{},a=new gd(n,i,r);return this.contents.push(a),Array.isArray(t)?a.append(...t):t&&a.append(t),this}appendTraced(t,n,r){return i=>this.append(new e().trace(t,n,r).append(i))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t==`function`?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...i)=>this.append(nd(e,t,n)(r,...i))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t==`function`?t():t,n,r):()=>this}};function hd(e,t,n){return r=>r instanceof md&&r.tracedSource===void 0?r.trace(e,t,n):new md().trace(e,t,n).append(r)}var gd=class extends md{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e==`string`?this.indentation=e:typeof e==`number`&&(this.indentation=``.padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}},_d=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??dd,this.ifNotEmpty=t}};const vd=new _d,yd=new _d(void 0,!0),bd=e=>e===void 0||typeof e==`string`||fd(e)?e:String(e);function xd(e,t=bd,n={}){let r=typeof t==`function`?t:bd,{filter:i,prefix:a,suffix:o,separator:s,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:l}=typeof t==`object`?t:n,u=typeof a==`function`?a:(()=>a),d=typeof o==`function`?o:(()=>o);return Sd(e,(e,t,n,a)=>{if(i&&!i(t,n,a))return e;let o=r(t,n,a);return o===void 0?e:(e??=new md).append(u(t,n,a)).append(o).append(d(t,n,a)).appendIf(!a,s).appendNewLineIfNotEmptyIf(!e.isEmpty()&&!!c&&(!a||!l))})}function Sd(e,t,n){let r=e[Symbol.iterator](),i=r.next(),a=0,o=n;for(;!i.done;){let e=r.next();o=t(o,i.value,a,!!e.done),i=e,a++}return o}export{Ni as $,yo as A,Y as B,Wo as C,jo as D,Io as E,mo as F,Ja as G,q as H,fo as I,ai as J,Ia as K,lo as L,_o as M,go as N,Co as O,ho as P,H as Q,co as R,ws as S,Vo as T,Za as U,J as V,K as W,oi as X,Lr as Y,V as Z,al as _,k as _t,td as a,Kn as at,Xs as b,b as bt,Nu as c,dn as ct,Su as d,mn as dt,Mi as et,Hl as f,_n as ft,yl as g,le as gt,xl as h,Xt as ht,pd as i,Yn as it,So as j,bo as k,Eu as l,pn as lt,jl as m,Wt as mt,md as n,Hr as nt,Pu as o,Gn as ot,Ll as p,Rt as pt,La as q,vd as r,Qi as rt,Au as s,Ln as st,xd as t,yi as tt,Ou as u,B as ut,Z as v,j as vt,Uo as w,Ps as x,uc as y,w as yt,ao as z};