@likec4/mcp 1.55.1 → 1.57.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 (162) hide show
  1. package/README.md +2 -2
  2. package/bin/likec4-mcp.mjs +3 -0
  3. package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
  4. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
  5. package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
  6. package/dist/chunks/libs/@hono/mcp.mjs +70 -0
  7. package/dist/chunks/libs/@hono/node-server.mjs +1 -0
  8. package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
  9. package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
  10. package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
  11. package/dist/chunks/libs/@radix-ui/colors.mjs +1 -0
  12. package/dist/chunks/libs/@ts-graphviz/ast.mjs +3 -0
  13. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -0
  14. package/dist/chunks/libs/@ungap/structured-clone.mjs +1 -0
  15. package/dist/chunks/libs/bail.mjs +1 -0
  16. package/dist/chunks/libs/ccount.mjs +1 -0
  17. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
  18. package/dist/chunks/libs/chevrotain.mjs +58 -0
  19. package/dist/chunks/libs/chokidar.mjs +3 -0
  20. package/dist/chunks/libs/chroma-js.mjs +15 -0
  21. package/dist/chunks/libs/citty.mjs +5 -0
  22. package/dist/chunks/libs/comma-separated-tokens.mjs +1 -0
  23. package/dist/chunks/libs/decode-named-character-reference.mjs +1 -0
  24. package/dist/chunks/libs/defu.mjs +1 -0
  25. package/dist/chunks/libs/destr.mjs +1 -0
  26. package/dist/chunks/libs/devlop.mjs +1 -0
  27. package/dist/chunks/libs/escape-string-regexp.mjs +1 -0
  28. package/dist/chunks/libs/eventemitter3.mjs +1 -0
  29. package/dist/chunks/libs/extend.mjs +1 -0
  30. package/dist/chunks/libs/fdir.mjs +1 -0
  31. package/dist/chunks/libs/graphology-dag.mjs +1 -0
  32. package/dist/chunks/libs/graphology.mjs +1 -0
  33. package/dist/chunks/libs/hast-util-sanitize.mjs +1 -0
  34. package/dist/chunks/libs/hast-util-to-html.mjs +9 -0
  35. package/dist/chunks/libs/hono.mjs +1 -0
  36. package/dist/chunks/libs/immer.mjs +1 -0
  37. package/dist/chunks/libs/is-error-instance.mjs +1 -0
  38. package/dist/chunks/libs/is-plain-obj.mjs +1 -0
  39. package/dist/chunks/libs/isexe.mjs +1 -0
  40. package/dist/chunks/libs/json5.mjs +14 -0
  41. package/dist/chunks/libs/khroma.mjs +1 -0
  42. package/dist/chunks/libs/langium.mjs +32 -0
  43. package/dist/chunks/libs/longest-streak.mjs +1 -0
  44. package/dist/chunks/libs/markdown-table.mjs +2 -0
  45. package/dist/chunks/libs/mdast-util-find-and-replace.mjs +1 -0
  46. package/dist/chunks/libs/mdast-util-from-markdown.mjs +3 -0
  47. package/dist/chunks/libs/mdast-util-gfm.mjs +15 -0
  48. package/dist/chunks/libs/mdast-util-to-hast.mjs +11 -0
  49. package/dist/chunks/libs/merge-error-cause.mjs +2 -0
  50. package/dist/chunks/libs/micromark-extension-gfm.mjs +1 -0
  51. package/dist/chunks/libs/mnemonist.mjs +1 -0
  52. package/dist/chunks/libs/nano-spawn.mjs +3 -0
  53. package/dist/chunks/libs/natural-compare-lite.mjs +9 -0
  54. package/dist/chunks/libs/ohash.mjs +1 -0
  55. package/dist/chunks/libs/p-limit.mjs +1 -0
  56. package/dist/chunks/libs/p-queue.mjs +1 -0
  57. package/dist/chunks/libs/p-timeout.mjs +1 -0
  58. package/dist/chunks/libs/parse-ms.mjs +1 -0
  59. package/dist/chunks/libs/pathe.mjs +1 -0
  60. package/dist/chunks/libs/pretty-ms.mjs +1 -0
  61. package/dist/chunks/libs/rehype-sanitize.mjs +1 -0
  62. package/dist/chunks/libs/rehype-stringify.mjs +1 -0
  63. package/dist/chunks/libs/remark-gfm.mjs +1 -0
  64. package/dist/chunks/libs/remark-github-blockquote-alert.mjs +3 -0
  65. package/dist/chunks/libs/remark-parse.mjs +1 -0
  66. package/dist/chunks/libs/remark-rehype.mjs +1 -0
  67. package/dist/chunks/libs/remeda.mjs +1 -0
  68. package/dist/chunks/libs/safe-stringify.mjs +1 -0
  69. package/dist/chunks/libs/strip-indent.mjs +1 -0
  70. package/dist/chunks/libs/tinyrainbow.mjs +1 -0
  71. package/dist/chunks/libs/trough.mjs +1 -0
  72. package/dist/chunks/libs/ts-graphviz.mjs +1 -0
  73. package/dist/chunks/libs/ufo.mjs +1 -0
  74. package/dist/chunks/libs/unctx.mjs +1 -0
  75. package/dist/chunks/libs/unified.mjs +1 -0
  76. package/dist/chunks/libs/unstorage.mjs +1 -0
  77. package/dist/chunks/libs/which.mjs +1 -0
  78. package/dist/chunks/libs/word-wrap.mjs +12 -0
  79. package/dist/chunks/rolldown-runtime.mjs +1 -0
  80. package/dist/chunks/src.mjs +1436 -0
  81. package/dist/cli.mjs +1 -1
  82. package/dist/index.mjs +1 -1
  83. package/package.json +28 -22
  84. package/dist/THIRD-PARTY-LICENSES.md +0 -2318
  85. package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
  86. package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
  87. package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
  88. package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
  89. package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
  90. package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
  91. package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
  92. package/dist/_chunks/libs/@mantine/colors-generator.mjs +0 -15
  93. package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
  94. package/dist/_chunks/libs/@radix-ui/colors.mjs +0 -1
  95. package/dist/_chunks/libs/@ungap/structured-clone.mjs +0 -1
  96. package/dist/_chunks/libs/bail.mjs +0 -1
  97. package/dist/_chunks/libs/ccount.mjs +0 -1
  98. package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
  99. package/dist/_chunks/libs/chevrotain.mjs +0 -58
  100. package/dist/_chunks/libs/chokidar.mjs +0 -3
  101. package/dist/_chunks/libs/citty.mjs +0 -5
  102. package/dist/_chunks/libs/comma-separated-tokens.mjs +0 -1
  103. package/dist/_chunks/libs/decode-named-character-reference.mjs +0 -1
  104. package/dist/_chunks/libs/defu.mjs +0 -1
  105. package/dist/_chunks/libs/destr.mjs +0 -1
  106. package/dist/_chunks/libs/devlop.mjs +0 -1
  107. package/dist/_chunks/libs/escape-string-regexp.mjs +0 -1
  108. package/dist/_chunks/libs/eventemitter3.mjs +0 -1
  109. package/dist/_chunks/libs/extend.mjs +0 -1
  110. package/dist/_chunks/libs/fast-equals.mjs +0 -1
  111. package/dist/_chunks/libs/fdir.mjs +0 -1
  112. package/dist/_chunks/libs/graphology-dag.mjs +0 -1
  113. package/dist/_chunks/libs/graphology.mjs +0 -1
  114. package/dist/_chunks/libs/hast-util-sanitize.mjs +0 -1
  115. package/dist/_chunks/libs/hast-util-to-html.mjs +0 -9
  116. package/dist/_chunks/libs/immer.mjs +0 -1
  117. package/dist/_chunks/libs/is-error-instance.mjs +0 -1
  118. package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
  119. package/dist/_chunks/libs/isexe.mjs +0 -1
  120. package/dist/_chunks/libs/json5.mjs +0 -14
  121. package/dist/_chunks/libs/khroma.mjs +0 -1
  122. package/dist/_chunks/libs/langium.mjs +0 -30
  123. package/dist/_chunks/libs/longest-streak.mjs +0 -1
  124. package/dist/_chunks/libs/markdown-table.mjs +0 -2
  125. package/dist/_chunks/libs/mdast-util-find-and-replace.mjs +0 -1
  126. package/dist/_chunks/libs/mdast-util-from-markdown.mjs +0 -3
  127. package/dist/_chunks/libs/mdast-util-gfm.mjs +0 -15
  128. package/dist/_chunks/libs/mdast-util-to-hast.mjs +0 -11
  129. package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
  130. package/dist/_chunks/libs/micromark-extension-gfm.mjs +0 -1
  131. package/dist/_chunks/libs/mnemonist.mjs +0 -1
  132. package/dist/_chunks/libs/nano-spawn.mjs +0 -3
  133. package/dist/_chunks/libs/natural-compare-lite.mjs +0 -9
  134. package/dist/_chunks/libs/ohash.mjs +0 -1
  135. package/dist/_chunks/libs/p-limit.mjs +0 -1
  136. package/dist/_chunks/libs/p-queue.mjs +0 -1
  137. package/dist/_chunks/libs/p-timeout.mjs +0 -1
  138. package/dist/_chunks/libs/parse-ms.mjs +0 -1
  139. package/dist/_chunks/libs/pathe.mjs +0 -1
  140. package/dist/_chunks/libs/pretty-ms.mjs +0 -1
  141. package/dist/_chunks/libs/rehype-sanitize.mjs +0 -1
  142. package/dist/_chunks/libs/rehype-stringify.mjs +0 -1
  143. package/dist/_chunks/libs/remark-gfm.mjs +0 -1
  144. package/dist/_chunks/libs/remark-github-blockquote-alert.mjs +0 -3
  145. package/dist/_chunks/libs/remark-parse.mjs +0 -1
  146. package/dist/_chunks/libs/remark-rehype.mjs +0 -1
  147. package/dist/_chunks/libs/remeda.mjs +0 -2
  148. package/dist/_chunks/libs/safe-stringify.mjs +0 -1
  149. package/dist/_chunks/libs/strip-indent.mjs +0 -1
  150. package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
  151. package/dist/_chunks/libs/trough.mjs +0 -1
  152. package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
  153. package/dist/_chunks/libs/ufo.mjs +0 -1
  154. package/dist/_chunks/libs/unified.mjs +0 -1
  155. package/dist/_chunks/libs/unstorage.mjs +0 -1
  156. package/dist/_chunks/libs/which.mjs +0 -1
  157. package/dist/_chunks/libs/word-wrap.mjs +0 -12
  158. package/dist/_chunks/rolldown-runtime.mjs +0 -1
  159. package/dist/_chunks/src.mjs +0 -1228
  160. /package/dist/{_chunks → chunks}/libs/character-entities-html4.mjs +0 -0
  161. /package/dist/{_chunks → chunks}/libs/character-entities-legacy.mjs +0 -0
  162. /package/dist/{_chunks → chunks}/libs/character-entities.mjs +0 -0
@@ -1,30 +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";var b=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})),x=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})),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=x();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,e.RequestType0=class extends i{constructor(e){super(e,0)}},e.RequestType=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType1=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.RequestType2=class extends i{constructor(e){super(e,2)}},e.RequestType3=class extends i{constructor(e){super(e,3)}},e.RequestType4=class extends i{constructor(e){super(e,4)}},e.RequestType5=class extends i{constructor(e){super(e,5)}},e.RequestType6=class extends i{constructor(e){super(e,6)}},e.RequestType7=class extends i{constructor(e){super(e,7)}},e.RequestType8=class extends i{constructor(e){super(e,8)}},e.RequestType9=class extends i{constructor(e){super(e,9)}},e.NotificationType=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType0=class extends i{constructor(e){super(e,0)}},e.NotificationType1=class extends i{constructor(e,t=r.auto){super(e,1),this._parameterStructures=t}get parameterStructures(){return this._parameterStructures}},e.NotificationType2=class extends i{constructor(e){super(e,2)}},e.NotificationType3=class extends i{constructor(e){super(e,3)}},e.NotificationType4=class extends i{constructor(e){super(e,4)}},e.NotificationType5=class extends i{constructor(e){super(e,5)}},e.NotificationType6=class extends i{constructor(e){super(e,6)}},e.NotificationType7=class extends i{constructor(e){super(e,7)}},e.NotificationType8=class extends i{constructor(e){super(e,8)}},e.NotificationType9=class extends i{constructor(e){super(e,9)}};var a;(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})(a||(e.Message=a={}))})),C=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,e.LRUCache=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))}}})),w=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={}))})),ee=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})),T=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Emitter=e.Event=void 0;let t=ee();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(){}})),E=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CancellationTokenSource=e.CancellationToken=void 0;let t=ee(),n=x(),r=T();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)}};e.CancellationTokenSource=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}}})),D=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SharedArrayReceiverStrategy=e.SharedArraySenderStrategy=void 0;let t=E();var n;(function(e){e.Continue=0,e.Cancelled=1})(n||={}),e.SharedArraySenderStrategy=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()}};var r=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`)}},i=class{constructor(e){this.token=new r(e)}cancel(){}dispose(){}};e.SharedArrayReceiverStrategy=class{constructor(){this.kind=`request`}createCancellationTokenSource(e){let n=e.$cancellationData;return n===void 0?new t.CancellationTokenSource:new i(n)}}})),te=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Semaphore=void 0;let t=ee();e.Semaphore=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()}}}})),ne=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ReadableStreamMessageReader=e.AbstractMessageReader=e.MessageReader=void 0;let t=ee(),n=x(),r=T(),i=te();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||={}),e.ReadableStreamMessageReader=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))}}})),re=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WriteableStreamMessageWriter=e.AbstractMessageWriter=e.MessageWriter=void 0;let t=ee(),n=x(),r=te(),i=T();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||={}),e.WriteableStreamMessageWriter=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
2
- `),n.push(`\r
3
- `),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()}}})),O=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.AbstractMessageBuffer=void 0,e.AbstractMessageBuffer=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
4
- `);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}}})),ie=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=ee(),n=x(),r=S(),i=C(),a=T(),o=E();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||={}),e.ProgressType=class{constructor(){}};var u;(function(e){function t(e){return n.func(e)}e.is=t})(u||={}),e.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var d;(function(e){e[e.Off=0]=`Off`,e[e.Messages=1]=`Messages`,e[e.Compact=2]=`Compact`,e[e.Verbose=3]=`Verbose`})(d||(e.Trace=d={}));var f;(function(e){e.Off=`off`,e.Messages=`messages`,e.Compact=`compact`,e.Verbose=`verbose`})(f||(e.TraceValues=f={})),(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})(d||(e.Trace=d={}));var p;(function(e){e.Text=`text`,e.JSON=`json`})(p||(e.TraceFormat=p={})),(function(e){function t(t){return n.string(t)?(t=t.toLowerCase(),t===`json`?e.JSON:e.Text):e.Text}e.fromString=t})(p||(e.TraceFormat=p={}));var m;(function(e){e.type=new r.NotificationType(`$/setTrace`)})(m||(e.SetTraceNotification=m={}));var h;(function(e){e.type=new r.NotificationType(`$/logTrace`)})(h||(e.LogTraceNotification=h={}));var g;(function(e){e[e.Closed=1]=`Closed`,e[e.Disposed=2]=`Disposed`,e[e.AlreadyListening=3]=`AlreadyListening`})(g||(e.ConnectionErrors=g={}));var _=class e extends Error{constructor(t,n){super(n),this.code=t,Object.setPrototypeOf(this,e.prototype)}};e.ConnectionError=_;var v;(function(e){function t(e){let t=e;return t&&n.func(t.cancelUndispatched)}e.is=t})(v||(e.ConnectionStrategy=v={}));var y;(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})(y||(e.IdCancellationReceiverStrategy=y={}));var b;(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})(b||(e.RequestCancellationReceiverStrategy=b={}));var w;(function(e){e.Message=Object.freeze({createCancellationTokenSource(e){return new o.CancellationTokenSource}});function t(e){return y.is(e)||b.is(e)}e.is=t})(w||(e.CancellationReceiverStrategy=w={}));var D;(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})(D||(e.CancellationSenderStrategy=D={}));var te;(function(e){e.Message=Object.freeze({receiver:w.Message,sender:D.Message});function t(e){let t=e;return t&&w.is(t.receiver)&&D.is(t.sender)}e.is=t})(te||(e.CancellationStrategy=te={}));var ne;(function(e){function t(e){let t=e;return t&&n.func(t.handleMessage)}e.is=t})(ne||(e.MessageStrategy=ne={}));var re;(function(e){function t(e){let t=e;return t&&(te.is(t.cancellationStrategy)||v.is(t.connectionStrategy)||ne.is(t.messageStrategy))}e.is=t})(re||(e.ConnectionOptions=re={}));var O;(function(e){e[e.New=1]=`New`,e[e.Listening=2]=`Listening`,e[e.Closed=3]=`Closed`,e[e.Disposed=4]=`Disposed`})(O||={});function ie(f,v,b,x){let S=b===void 0?e.NullLogger:b,C=0,w=0,ee=0,T,E=new Map,D,re=new Map,ie=new Map,ae,oe=new i.LinkedMap,k=new Map,se=new Set,A=new Map,j=d.Off,M=p.Text,N,P=O.New,F=new a.Emitter,I=new a.Emitter,ce=new a.Emitter,le=new a.Emitter,ue=new a.Emitter,de=x&&x.cancellationStrategy?x.cancellationStrategy:te.Message;function fe(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 pe(e){return e===null?`res-unknown-`+(++ee).toString():`res-`+e.toString()}function me(){return`not-`+(++w).toString()}function he(e,t){r.Message.isRequest(t)?e.set(fe(t.id),t):r.Message.isResponse(t)?e.set(pe(t.id),t):e.set(me(),t)}function ge(e){}function _e(){return P===O.Listening}function ve(){return P===O.Closed}function ye(){return P===O.Disposed}function be(){(P===O.New||P===O.Listening)&&(P=O.Closed,I.fire(void 0))}function L(e){F.fire([e,void 0,void 0])}function xe(e){F.fire(e)}f.onClose(be),f.onError(L),v.onClose(be),v.onError(xe);function R(){ae||oe.size===0||(ae=(0,t.default)().timer.setImmediate(()=>{ae=void 0,Ce()}))}function Se(e){r.Message.isRequest(e)?Te(e):r.Message.isNotification(e)?De(e):r.Message.isResponse(e)?Ee(e):Oe(e)}function Ce(){if(oe.size===0)return;let e=oe.shift();try{let t=x?.messageStrategy;ne.is(t)?t.handleMessage(e,Se):Se(e)}finally{R()}}let we=e=>{try{if(r.Message.isNotification(e)&&e.method===s.type.method){let t=e.params.id,n=fe(t),i=oe.get(n);if(r.Message.isRequest(i)){let r=x?.connectionStrategy,a=r&&r.cancelUndispatched?r.cancelUndispatched(i,ge):void 0;if(a&&(a.error!==void 0||a.result!==void 0)){oe.delete(n),A.delete(t),a.id=i.id,je(a,e.method,Date.now()),v.write(a).catch(()=>S.error(`Sending response for canceled message failed.`));return}}let a=A.get(t);if(a!==void 0){a.cancel(),Ne(e);return}else se.add(t)}he(oe,e)}finally{R()}};function Te(e){if(ye())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,je(a,n,i),v.write(a).catch(()=>S.error(`Sending response failed.`))}function i(t,n,r){let i={jsonrpc:`2.0`,id:e.id,error:t.toJson()};je(i,n,r),v.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};je(i,n,r),v.write(i).catch(()=>S.error(`Sending response failed.`))}Me(e);let o=E.get(e.method),s,c;o&&(s=o.type,c=o.handler);let l=Date.now();if(c||T){let o=e.id??String(Date.now()),u=y.is(de.receiver)?de.receiver.createCancellationTokenSource(o):de.receiver.createCancellationTokenSource(e);e.id!==null&&se.has(e.id)&&u.cancel(),e.id!==null&&A.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 T&&(d=T(e.method,e.params,u.token));let f=d;d?f.then?f.then(n=>{A.delete(o),t(n,e.method,l)},t=>{A.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)}):(A.delete(o),t(d,e.method,l)):(A.delete(o),a(d,e.method,l))}catch(a){A.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 Ee(e){if(!ye())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=k.get(t);if(Pe(e,n),n!==void 0){k.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 De(e){if(ye())return;let t,n;if(e.method===s.type.method){let t=e.params.id;se.delete(t),Ne(e);return}else{let r=re.get(e.method);r&&(n=r.handler,t=r.type)}if(n||D)try{if(Ne(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 D&&D(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 ce.fire(e)}function Oe(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=k.get(e);n&&n.reject(Error(`The received response has neither a result nor an error property.`))}}function z(e){if(e!=null)switch(j){case d.Verbose:return JSON.stringify(e,null,4);case d.Compact:return JSON.stringify(e);default:return}}function ke(e){if(!(j===d.Off||!N))if(M===p.Text){let t;(j===d.Verbose||j===d.Compact)&&e.params&&(t=`Params: ${z(e.params)}\n\n`),N.log(`Sending request '${e.method} - (${e.id})'.`,t)}else Fe(`send-request`,e)}function Ae(e){if(!(j===d.Off||!N))if(M===p.Text){let t;(j===d.Verbose||j===d.Compact)&&(t=e.params?`Params: ${z(e.params)}\n\n`:`No parameters provided.
5
-
6
- `),N.log(`Sending notification '${e.method}'.`,t)}else Fe(`send-notification`,e)}function je(e,t,n){if(!(j===d.Off||!N))if(M===p.Text){let r;(j===d.Verbose||j===d.Compact)&&(e.error&&e.error.data?r=`Error data: ${z(e.error.data)}\n\n`:e.result?r=`Result: ${z(e.result)}\n\n`:e.error===void 0&&(r=`No result returned.
7
-
8
- `)),N.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,r)}else Fe(`send-response`,e)}function Me(e){if(!(j===d.Off||!N))if(M===p.Text){let t;(j===d.Verbose||j===d.Compact)&&e.params&&(t=`Params: ${z(e.params)}\n\n`),N.log(`Received request '${e.method} - (${e.id})'.`,t)}else Fe(`receive-request`,e)}function Ne(e){if(!(j===d.Off||!N||e.method===h.type.method))if(M===p.Text){let t;(j===d.Verbose||j===d.Compact)&&(t=e.params?`Params: ${z(e.params)}\n\n`:`No parameters provided.
9
-
10
- `),N.log(`Received notification '${e.method}'.`,t)}else Fe(`receive-notification`,e)}function Pe(e,t){if(!(j===d.Off||!N))if(M===p.Text){let n;if((j===d.Verbose||j===d.Compact)&&(e.error&&e.error.data?n=`Error data: ${z(e.error.data)}\n\n`:e.result?n=`Result: ${z(e.result)}\n\n`:e.error===void 0&&(n=`No result returned.
11
-
12
- `)),t){let r=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:``;N.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${r}`,n)}else N.log(`Received response ${e.id} without active response promise.`,n)}else Fe(`receive-response`,e)}function Fe(e,t){if(!N||j===d.Off)return;let n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};N.log(n)}function Ie(){if(ve())throw new _(g.Closed,`Connection is closed.`);if(ye())throw new _(g.Disposed,`Connection is disposed.`)}function Le(){if(_e())throw new _(g.AlreadyListening,`Connection is already listening`)}function Re(){if(!_e())throw Error(`Call listen() first.`)}function ze(e){return e===void 0?null:e}function Be(e){if(e!==null)return e}function Ve(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}function He(e,t){switch(e){case r.ParameterStructures.auto:return Ve(t)?Be(t):[ze(t)];case r.ParameterStructures.byName:if(!Ve(t))throw Error(`Received parameters by name but param is not an object literal.`);return Be(t);case r.ParameterStructures.byPosition:return[ze(t)];default:throw Error(`Unknown parameter structure ${e.toString()}`)}}function Ue(e,t){let n,r=e.numberOfParams;switch(r){case 0:n=void 0;break;case 1:n=He(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e<t.length&&e<r;e++)n.push(ze(t[e]));if(t.length<r)for(let e=t.length;e<r;e++)n.push(null);break}return n}let We={sendNotification:(e,...t)=>{Ie();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=He(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=>ze(e));break}}else{let n=t;i=e.method,a=Ue(e,n)}let o={jsonrpc:`2.0`,method:i,params:a};return Ae(o),v.write(o).catch(e=>{throw S.error(`Sending notification failed.`),e})},onNotification:(e,t)=>{Ie();let r;return n.func(e)?D=e:t&&(n.string(e)?(r=e,re.set(e,{type:void 0,handler:t})):(r=e.method,re.set(e.method,{type:e,handler:t}))),{dispose:()=>{r===void 0?D=void 0:re.delete(r)}}},onProgress:(e,t,n)=>{if(ie.has(t))throw Error(`Progress handler for token ${t} already registered`);return ie.set(t,n),{dispose:()=>{ie.delete(t)}}},sendProgress:(e,t,n)=>We.sendNotification(l.type,{token:t,value:n}),onUnhandledProgress:le.event,sendRequest:(e,...t)=>{Ie(),Re();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=He(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=>ze(e));break}}else{let n=t;i=e.method,a=Ue(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=de.sender.sendCancellation(We,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 ke(u),typeof de.sender.enableCancellation==`function`&&de.sender.enableCancellation(u),new Promise(async(e,t)=>{let n={method:i,timerStart:Date.now(),resolve:t=>{e(t),de.sender.cleanup(c),l?.dispose()},reject:e=>{t(e),de.sender.cleanup(c),l?.dispose()}};try{k.set(c,n),await v.write(u)}catch(e){throw k.delete(c),n.reject(new r.ResponseError(r.ErrorCodes.MessageWriteError,e.message?e.message:`Unknown reason`)),S.error(`Sending request failed.`),e}})},onRequest:(e,t)=>{Ie();let r=null;return u.is(e)?(r=void 0,T=e):n.string(e)?(r=null,t!==void 0&&(r=e,E.set(e,{handler:t,type:void 0}))):t!==void 0&&(r=e.method,E.set(e.method,{type:e,handler:t})),{dispose:()=>{r!==null&&(r===void 0?T=void 0:E.delete(r))}}},hasPendingResponse:()=>k.size>0,trace:async(e,t,r)=>{let i=!1,a=p.Text;r!==void 0&&(n.boolean(r)?i=r:(i=r.sendNotification||!1,a=r.traceFormat||p.Text)),j=e,M=a,N=j===d.Off?void 0:t,i&&!ve()&&!ye()&&await We.sendNotification(m.type,{value:d.toString(e)})},onError:F.event,onClose:I.event,onUnhandledNotification:ce.event,onDispose:ue.event,end:()=>{v.end()},dispose:()=>{if(ye())return;P=O.Disposed,ue.fire(void 0);let e=new r.ResponseError(r.ErrorCodes.PendingResponseRejected,`Pending response rejected since connection got disposed`);for(let t of k.values())t.reject(e);k=new Map,A=new Map,se=new Set,oe=new i.LinkedMap,n.func(v.dispose)&&v.dispose(),n.func(f.dispose)&&f.dispose()},listen:()=>{Ie(),Le(),P=O.Listening,f.listen(we)},inspect:()=>{(0,t.default)().console.log(`inspect`)}};return We.onNotification(h.type,e=>{if(j===d.Off||!N)return;let t=j===d.Verbose||j===d.Compact;N.log(e.message,t?e.verbose:void 0)}),We.onNotification(l.type,e=>{let t=ie.get(e.token);t?t(e.value):le.fire(e)}),We}e.createMessageConnection=ie})),ae=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=C();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=w();Object.defineProperty(e,`Disposable`,{enumerable:!0,get:function(){return r.Disposable}});let i=T();Object.defineProperty(e,`Event`,{enumerable:!0,get:function(){return i.Event}}),Object.defineProperty(e,`Emitter`,{enumerable:!0,get:function(){return i.Emitter}});let a=E();Object.defineProperty(e,`CancellationTokenSource`,{enumerable:!0,get:function(){return a.CancellationTokenSource}}),Object.defineProperty(e,`CancellationToken`,{enumerable:!0,get:function(){return a.CancellationToken}});let o=D();Object.defineProperty(e,`SharedArraySenderStrategy`,{enumerable:!0,get:function(){return o.SharedArraySenderStrategy}}),Object.defineProperty(e,`SharedArrayReceiverStrategy`,{enumerable:!0,get:function(){return o.SharedArrayReceiverStrategy}});let s=ne();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=re();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=O();Object.defineProperty(e,`AbstractMessageBuffer`,{enumerable:!0,get:function(){return l.AbstractMessageBuffer}});let u=ie();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=ee().default})),oe=o((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`util`),r=ae();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})),k=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=oe();i.default.install();let a=e(`path`),o=e(`os`),s=e(`crypto`),c=e(`net`),l=ae();r(ae(),t),t.IPCMessageReader=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.IPCMessageWriter=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.PortMessageReader=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.PortMessageWriter=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(){}};var u=class extends l.ReadableStreamMessageReader{constructor(e,t=`utf-8`){super((0,i.default)().stream.asReadableStream(e),t)}};t.SocketMessageReader=u;var d=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=d;var f=class extends l.ReadableStreamMessageReader{constructor(e,t){super((0,i.default)().stream.asReadableStream(e),t)}};t.StreamMessageReader=f;var p=class extends l.WriteableStreamMessageWriter{constructor(e,t){super((0,i.default)().stream.asWritableStream(e),t)}};t.StreamMessageWriter=p;let m=process.env.XDG_RUNTIME_DIR,h=new Map([[`linux`,107],[`darwin`,103]]);function g(){let e=(0,s.randomBytes)(21).toString(`hex`);if(process.platform===`win32`)return`\\\\.\\pipe\\vscode-jsonrpc-${e}-sock`;let t;t=m?a.join(m,`vscode-ipc-${e}.sock`):a.join(o.tmpdir(),`vscode-${e}.sock`);let n=h.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=g;function _(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 u(e,t),new d(e,t)])});o.on(`error`,a),o.listen(e,()=>{o.removeListener(`error`,a),i({onConnected:()=>r})})})}t.createClientPipeTransport=_;function v(e,t=`utf-8`){let n=(0,c.createConnection)(e);return[new u(n,t),new d(n,t)]}t.createServerPipeTransport=v;function y(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 u(e,t),new d(e,t)])});o.on(`error`,a),o.listen(e,`127.0.0.1`,()=>{o.removeListener(`error`,a),i({onConnected:()=>r})})})}t.createClientSocketTransport=y;function b(e,t=`utf-8`){let n=(0,c.createConnection)(e,`127.0.0.1`);return[new u(n,t),new d(n,t)]}t.createServerSocketTransport=b;function x(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function S(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function C(e,t,n,r){n||=l.NullLogger;let i=x(e)?new f(e):e,a=S(t)?new p(t):t;return l.ConnectionStrategy.is(r)&&(r={connectionStrategy:r}),(0,l.createMessageConnection)(i,a,n,r)}t.createMessageConnection=C})),se=o(((e,t)=>{t.exports=k()})),A=i({AnnotatedTextEdit:()=>Se,ChangeAnnotation:()=>xe,ChangeAnnotationIdentifier:()=>R,CodeAction:()=>it,CodeActionContext:()=>rt,CodeActionKind:()=>tt,CodeActionTriggerKind:()=>nt,CodeDescription:()=>ve,CodeLens:()=>at,Color:()=>ue,ColorInformation:()=>de,ColorPresentation:()=>fe,Command:()=>be,CompletionItem:()=>He,CompletionItemKind:()=>Ie,CompletionItemLabelDetails:()=>Ve,CompletionItemTag:()=>Re,CompletionList:()=>Ue,CreateFile:()=>we,DeleteFile:()=>Ee,Diagnostic:()=>ye,DiagnosticRelatedInformation:()=>he,DiagnosticSeverity:()=>ge,DiagnosticTag:()=>_e,DocumentHighlight:()=>Ye,DocumentHighlightKind:()=>Je,DocumentLink:()=>st,DocumentSymbol:()=>et,DocumentUri:()=>j,EOL:()=>Et,FoldingRange:()=>me,FoldingRangeKind:()=>pe,FormattingOptions:()=>ot,Hover:()=>Ge,InlayHint:()=>vt,InlayHintKind:()=>gt,InlayHintLabelPart:()=>_t,InlineCompletionContext:()=>wt,InlineCompletionItem:()=>bt,InlineCompletionList:()=>xt,InlineCompletionTriggerKind:()=>St,InlineValueContext:()=>ht,InlineValueEvaluatableExpression:()=>mt,InlineValueText:()=>ft,InlineValueVariableLookup:()=>pt,InsertReplaceEdit:()=>ze,InsertTextFormat:()=>Le,InsertTextMode:()=>Be,Location:()=>ce,LocationLink:()=>le,MarkedString:()=>We,MarkupContent:()=>Fe,MarkupKind:()=>Pe,OptionalVersionedTextDocumentIdentifier:()=>Me,ParameterInformation:()=>Ke,Position:()=>F,Range:()=>I,RenameFile:()=>Te,SelectedCompletionInfo:()=>Ct,SelectionRange:()=>ct,SemanticTokenModifiers:()=>ut,SemanticTokenTypes:()=>lt,SemanticTokens:()=>dt,SignatureInformation:()=>qe,StringValue:()=>yt,SymbolInformation:()=>Qe,SymbolKind:()=>Xe,SymbolTag:()=>Ze,TextDocument:()=>Dt,TextDocumentEdit:()=>Ce,TextDocumentIdentifier:()=>Ae,TextDocumentItem:()=>Ne,TextEdit:()=>L,URI:()=>M,VersionedTextDocumentIdentifier:()=>je,WorkspaceChange:()=>ke,WorkspaceEdit:()=>De,WorkspaceFolder:()=>Tt,WorkspaceSymbol:()=>$e,integer:()=>N,uinteger:()=>P}),j,M,N,P,F,I,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be,L,xe,R,Se,Ce,we,Te,Ee,De,Oe,z,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,B,kt=n((()=>{(function(e){function t(e){return typeof e==`string`}e.is=t})(j||={}),(function(e){function t(e){return typeof e==`string`}e.is=t})(M||={}),(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})(N||={}),(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})(P||={}),(function(e){function t(e,t){return e===Number.MAX_VALUE&&(e=P.MAX_VALUE),t===Number.MAX_VALUE&&(t=P.MAX_VALUE),{line:e,character:t}}e.create=t;function n(e){let t=e;return B.objectLiteral(t)&&B.uinteger(t.line)&&B.uinteger(t.character)}e.is=n})(F||={}),(function(e){function t(e,t,n,r){if(B.uinteger(e)&&B.uinteger(t)&&B.uinteger(n)&&B.uinteger(r))return{start:F.create(e,t),end:F.create(n,r)};if(F.is(e)&&F.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 B.objectLiteral(t)&&F.is(t.start)&&F.is(t.end)}e.is=n})(I||={}),(function(e){function t(e,t){return{uri:e,range:t}}e.create=t;function n(e){let t=e;return B.objectLiteral(t)&&I.is(t.range)&&(B.string(t.uri)||B.undefined(t.uri))}e.is=n})(ce||={}),(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 B.objectLiteral(t)&&I.is(t.targetRange)&&B.string(t.targetUri)&&I.is(t.targetSelectionRange)&&(I.is(t.originSelectionRange)||B.undefined(t.originSelectionRange))}e.is=n})(le||={}),(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 B.objectLiteral(t)&&B.numberRange(t.red,0,1)&&B.numberRange(t.green,0,1)&&B.numberRange(t.blue,0,1)&&B.numberRange(t.alpha,0,1)}e.is=n})(ue||={}),(function(e){function t(e,t){return{range:e,color:t}}e.create=t;function n(e){let t=e;return B.objectLiteral(t)&&I.is(t.range)&&ue.is(t.color)}e.is=n})(de||={}),(function(e){function t(e,t,n){return{label:e,textEdit:t,additionalTextEdits:n}}e.create=t;function n(e){let t=e;return B.objectLiteral(t)&&B.string(t.label)&&(B.undefined(t.textEdit)||L.is(t))&&(B.undefined(t.additionalTextEdits)||B.typedArray(t.additionalTextEdits,L.is))}e.is=n})(fe||={}),(function(e){e.Comment=`comment`,e.Imports=`imports`,e.Region=`region`})(pe||={}),(function(e){function t(e,t,n,r,i,a){let o={startLine:e,endLine:t};return B.defined(n)&&(o.startCharacter=n),B.defined(r)&&(o.endCharacter=r),B.defined(i)&&(o.kind=i),B.defined(a)&&(o.collapsedText=a),o}e.create=t;function n(e){let t=e;return B.objectLiteral(t)&&B.uinteger(t.startLine)&&B.uinteger(t.startLine)&&(B.undefined(t.startCharacter)||B.uinteger(t.startCharacter))&&(B.undefined(t.endCharacter)||B.uinteger(t.endCharacter))&&(B.undefined(t.kind)||B.string(t.kind))}e.is=n})(me||={}),(function(e){function t(e,t){return{location:e,message:t}}e.create=t;function n(e){let t=e;return B.defined(t)&&ce.is(t.location)&&B.string(t.message)}e.is=n})(he||={}),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(ge||={}),(function(e){e.Unnecessary=1,e.Deprecated=2})(_e||={}),(function(e){function t(e){let t=e;return B.objectLiteral(t)&&B.string(t.href)}e.is=t})(ve||={}),(function(e){function t(e,t,n,r,i,a){let o={range:e,message:t};return B.defined(n)&&(o.severity=n),B.defined(r)&&(o.code=r),B.defined(i)&&(o.source=i),B.defined(a)&&(o.relatedInformation=a),o}e.create=t;function n(e){let t=e;return B.defined(t)&&I.is(t.range)&&B.string(t.message)&&(B.number(t.severity)||B.undefined(t.severity))&&(B.integer(t.code)||B.string(t.code)||B.undefined(t.code))&&(B.undefined(t.codeDescription)||B.string(t.codeDescription?.href))&&(B.string(t.source)||B.undefined(t.source))&&(B.undefined(t.relatedInformation)||B.typedArray(t.relatedInformation,he.is))}e.is=n})(ye||={}),(function(e){function t(e,t,...n){let r={title:e,command:t};return B.defined(n)&&n.length>0&&(r.arguments=n),r}e.create=t;function n(e){let t=e;return B.defined(t)&&B.string(t.title)&&B.string(t.command)}e.is=n})(be||={}),(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 B.objectLiteral(t)&&B.string(t.newText)&&I.is(t.range)}e.is=i})(L||={}),(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 B.objectLiteral(t)&&B.string(t.label)&&(B.boolean(t.needsConfirmation)||t.needsConfirmation===void 0)&&(B.string(t.description)||t.description===void 0)}e.is=n})(xe||={}),(function(e){function t(e){let t=e;return B.string(t)}e.is=t})(R||={}),(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 L.is(t)&&(xe.is(t.annotationId)||R.is(t.annotationId))}e.is=i})(Se||={}),(function(e){function t(e,t){return{textDocument:e,edits:t}}e.create=t;function n(e){let t=e;return B.defined(t)&&Me.is(t.textDocument)&&Array.isArray(t.edits)}e.is=n})(Ce||={}),(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`&&B.string(t.uri)&&(t.options===void 0||(t.options.overwrite===void 0||B.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||B.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||R.is(t.annotationId))}e.is=n})(we||={}),(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`&&B.string(t.oldUri)&&B.string(t.newUri)&&(t.options===void 0||(t.options.overwrite===void 0||B.boolean(t.options.overwrite))&&(t.options.ignoreIfExists===void 0||B.boolean(t.options.ignoreIfExists)))&&(t.annotationId===void 0||R.is(t.annotationId))}e.is=n})(Te||={}),(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`&&B.string(t.uri)&&(t.options===void 0||(t.options.recursive===void 0||B.boolean(t.options.recursive))&&(t.options.ignoreIfNotExists===void 0||B.boolean(t.options.ignoreIfNotExists)))&&(t.annotationId===void 0||R.is(t.annotationId))}e.is=n})(Ee||={}),(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=>B.string(e.kind)?we.is(e)||Te.is(e)||Ee.is(e):Ce.is(e)))}e.is=t})(De||={}),Oe=class{constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,n){let r,i;if(n===void 0?r=L.insert(e,t):R.is(n)?(i=n,r=Se.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Se.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=L.replace(e,t):R.is(n)?(i=n,r=Se.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),r=Se.replace(e,t,i)),this.edits.push(r),i!==void 0)return i}delete(e,t){let n,r;if(t===void 0?n=L.del(e):R.is(t)?(r=t,n=Se.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(t),n=Se.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.`)}},z=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(R.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()}},ke=class{constructor(e){this._textEditChanges=Object.create(null),e===void 0?this._workspaceEdit={}:(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new z(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(e=>{if(Ce.is(e)){let t=new Oe(e.edits,this._changeAnnotations);this._textEditChanges[e.textDocument.uri]=t}})):e.changes&&Object.keys(e.changes).forEach(t=>{let n=new Oe(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(Me.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 Oe(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 Oe(n),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new z,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;xe.is(t)||R.is(t)?r=t:n=t;let i,a;if(r===void 0?i=we.create(e,n):(a=R.is(r)?r:this._changeAnnotations.manage(r),i=we.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;xe.is(n)||R.is(n)?i=n:r=n;let a,o;if(i===void 0?a=Te.create(e,t,r):(o=R.is(i)?i:this._changeAnnotations.manage(i),a=Te.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;xe.is(t)||R.is(t)?r=t:n=t;let i,a;if(r===void 0?i=Ee.create(e,n):(a=R.is(r)?r:this._changeAnnotations.manage(r),i=Ee.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 B.defined(t)&&B.string(t.uri)}e.is=n})(Ae||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return B.defined(t)&&B.string(t.uri)&&B.integer(t.version)}e.is=n})(je||={}),(function(e){function t(e,t){return{uri:e,version:t}}e.create=t;function n(e){let t=e;return B.defined(t)&&B.string(t.uri)&&(t.version===null||B.integer(t.version))}e.is=n})(Me||={}),(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 B.defined(t)&&B.string(t.uri)&&B.string(t.languageId)&&B.integer(t.version)&&B.string(t.text)}e.is=n})(Ne||={}),(function(e){e.PlainText=`plaintext`,e.Markdown=`markdown`;function t(t){let n=t;return n===e.PlainText||n===e.Markdown}e.is=t})(Pe||={}),(function(e){function t(e){let t=e;return B.objectLiteral(e)&&Pe.is(t.kind)&&B.string(t.value)}e.is=t})(Fe||={}),(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})(Ie||={}),(function(e){e.PlainText=1,e.Snippet=2})(Le||={}),(function(e){e.Deprecated=1})(Re||={}),(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&&B.string(t.newText)&&I.is(t.insert)&&I.is(t.replace)}e.is=n})(ze||={}),(function(e){e.asIs=1,e.adjustIndentation=2})(Be||={}),(function(e){function t(e){let t=e;return t&&(B.string(t.detail)||t.detail===void 0)&&(B.string(t.description)||t.description===void 0)}e.is=t})(Ve||={}),(function(e){function t(e){return{label:e}}e.create=t})(He||={}),(function(e){function t(e,t){return{items:e||[],isIncomplete:!!t}}e.create=t})(Ue||={}),(function(e){function t(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,`\\$&`)}e.fromPlainText=t;function n(e){let t=e;return B.string(t)||B.objectLiteral(t)&&B.string(t.language)&&B.string(t.value)}e.is=n})(We||={}),(function(e){function t(e){let t=e;return!!t&&B.objectLiteral(t)&&(Fe.is(t.contents)||We.is(t.contents)||B.typedArray(t.contents,We.is))&&(e.range===void 0||I.is(e.range))}e.is=t})(Ge||={}),(function(e){function t(e,t){return t?{label:e,documentation:t}:{label:e}}e.create=t})(Ke||={}),(function(e){function t(e,t,...n){let r={label:e};return B.defined(t)&&(r.documentation=t),B.defined(n)?r.parameters=n:r.parameters=[],r}e.create=t})(qe||={}),(function(e){e.Text=1,e.Read=2,e.Write=3})(Je||={}),(function(e){function t(e,t){let n={range:e};return B.number(t)&&(n.kind=t),n}e.create=t})(Ye||={}),(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})(Xe||={}),(function(e){e.Deprecated=1})(Ze||={}),(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})(Qe||={}),(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})($e||={}),(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&&B.string(t.name)&&B.number(t.kind)&&I.is(t.range)&&I.is(t.selectionRange)&&(t.detail===void 0||B.string(t.detail))&&(t.deprecated===void 0||B.boolean(t.deprecated))&&(t.children===void 0||Array.isArray(t.children))&&(t.tags===void 0||Array.isArray(t.tags))}e.is=n})(et||={}),(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`})(tt||={}),(function(e){e.Invoked=1,e.Automatic=2})(nt||={}),(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 B.defined(t)&&B.typedArray(t.diagnostics,ye.is)&&(t.only===void 0||B.typedArray(t.only,B.string))&&(t.triggerKind===void 0||t.triggerKind===nt.Invoked||t.triggerKind===nt.Automatic)}e.is=n})(rt||={}),(function(e){function t(e,t,n){let r={title:e},i=!0;return typeof t==`string`?(i=!1,r.kind=t):be.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&&B.string(t.title)&&(t.diagnostics===void 0||B.typedArray(t.diagnostics,ye.is))&&(t.kind===void 0||B.string(t.kind))&&(t.edit!==void 0||t.command!==void 0)&&(t.command===void 0||be.is(t.command))&&(t.isPreferred===void 0||B.boolean(t.isPreferred))&&(t.edit===void 0||De.is(t.edit))}e.is=n})(it||={}),(function(e){function t(e,t){let n={range:e};return B.defined(t)&&(n.data=t),n}e.create=t;function n(e){let t=e;return B.defined(t)&&I.is(t.range)&&(B.undefined(t.command)||be.is(t.command))}e.is=n})(at||={}),(function(e){function t(e,t){return{tabSize:e,insertSpaces:t}}e.create=t;function n(e){let t=e;return B.defined(t)&&B.uinteger(t.tabSize)&&B.boolean(t.insertSpaces)}e.is=n})(ot||={}),(function(e){function t(e,t,n){return{range:e,target:t,data:n}}e.create=t;function n(e){let t=e;return B.defined(t)&&I.is(t.range)&&(B.undefined(t.target)||B.string(t.target))}e.is=n})(st||={}),(function(e){function t(e,t){return{range:e,parent:t}}e.create=t;function n(t){let n=t;return B.objectLiteral(n)&&I.is(n.range)&&(n.parent===void 0||e.is(n.parent))}e.is=n})(ct||={}),(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`})(lt||={}),(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`})(ut||={}),(function(e){function t(e){let t=e;return B.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})(dt||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t;function n(e){let t=e;return t!=null&&I.is(t.range)&&B.string(t.text)}e.is=n})(ft||={}),(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&&I.is(t.range)&&B.boolean(t.caseSensitiveLookup)&&(B.string(t.variableName)||t.variableName===void 0)}e.is=n})(pt||={}),(function(e){function t(e,t){return{range:e,expression:t}}e.create=t;function n(e){let t=e;return t!=null&&I.is(t.range)&&(B.string(t.expression)||t.expression===void 0)}e.is=n})(mt||={}),(function(e){function t(e,t){return{frameId:e,stoppedLocation:t}}e.create=t;function n(e){let t=e;return B.defined(t)&&I.is(e.stoppedLocation)}e.is=n})(ht||={}),(function(e){e.Type=1,e.Parameter=2;function t(e){return e===1||e===2}e.is=t})(gt||={}),(function(e){function t(e){return{value:e}}e.create=t;function n(e){let t=e;return B.objectLiteral(t)&&(t.tooltip===void 0||B.string(t.tooltip)||Fe.is(t.tooltip))&&(t.location===void 0||ce.is(t.location))&&(t.command===void 0||be.is(t.command))}e.is=n})(_t||={}),(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 B.objectLiteral(t)&&F.is(t.position)&&(B.string(t.label)||B.typedArray(t.label,_t.is))&&(t.kind===void 0||gt.is(t.kind))&&t.textEdits===void 0||B.typedArray(t.textEdits,L.is)&&(t.tooltip===void 0||B.string(t.tooltip)||Fe.is(t.tooltip))&&(t.paddingLeft===void 0||B.boolean(t.paddingLeft))&&(t.paddingRight===void 0||B.boolean(t.paddingRight))}e.is=n})(vt||={}),(function(e){function t(e){return{kind:`snippet`,value:e}}e.createSnippet=t})(yt||={}),(function(e){function t(e,t,n,r){return{insertText:e,filterText:t,range:n,command:r}}e.create=t})(bt||={}),(function(e){function t(e){return{items:e}}e.create=t})(xt||={}),(function(e){e.Invoked=0,e.Automatic=1})(St||={}),(function(e){function t(e,t){return{range:e,text:t}}e.create=t})(Ct||={}),(function(e){function t(e,t){return{triggerKind:e,selectedCompletionInfo:t}}e.create=t})(wt||={}),(function(e){function t(e){let t=e;return B.objectLiteral(t)&&M.is(t.uri)&&B.string(t.name)}e.is=t})(Tt||={}),Et=[`
13
- `,`\r
14
- `,`\r`],(function(e){function t(e,t,n,r){return new Ot(e,t,n,r)}e.create=t;function n(e){let t=e;return!!(B.defined(t)&&B.string(t.uri)&&(B.undefined(t.languageId)||B.string(t.languageId))&&B.uinteger(t.lineCount)&&B.func(t.getText)&&B.func(t.positionAt)&&B.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}})(Dt||={}),Ot=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===`
15
- `,i===`\r`&&r+1<t.length&&t.charAt(r+1)===`
16
- `&&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 F.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 F.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})(B||={})})),V=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ProtocolNotificationType=e.ProtocolNotificationType0=e.ProtocolRequestType=e.ProtocolRequestType0=e.RegistrationType=e.MessageDirection=void 0;let t=k();var n;(function(e){e.clientToServer=`clientToServer`,e.serverToClient=`serverToClient`,e.both=`both`})(n||(e.MessageDirection=n={})),e.RegistrationType=class{constructor(e){this.method=e}},e.ProtocolRequestType0=class extends t.RequestType0{constructor(e){super(e)}},e.ProtocolRequestType=class extends t.RequestType{constructor(e){super(e,t.ParameterStructures.byName)}},e.ProtocolNotificationType0=class extends t.NotificationType0{constructor(e){super(e)}},e.ProtocolNotificationType=class extends t.NotificationType{constructor(e){super(e,t.ParameterStructures.byName)}}})),At=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})),jt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ImplementationRequest=void 0;let t=V();var n;(function(e){e.method=`textDocument/implementation`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ImplementationRequest=n={}))})),Mt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeDefinitionRequest=void 0;let t=V();var n;(function(e){e.method=`textDocument/typeDefinition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.TypeDefinitionRequest=n={}))})),Nt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DidChangeWorkspaceFoldersNotification=e.WorkspaceFoldersRequest=void 0;let t=V();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={}))})),Pt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConfigurationRequest=void 0;let t=V();var n;(function(e){e.method=`workspace/configuration`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ConfigurationRequest=n={}))})),Ft=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColorPresentationRequest=e.DocumentColorRequest=void 0;let t=V();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={}))})),It=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FoldingRangeRefreshRequest=e.FoldingRangeRequest=void 0;let t=V();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={}))})),Lt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeclarationRequest=void 0;let t=V();var n;(function(e){e.method=`textDocument/declaration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.DeclarationRequest=n={}))})),Rt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SelectionRangeRequest=void 0;let t=V();var n;(function(e){e.method=`textDocument/selectionRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.SelectionRangeRequest=n={}))})),zt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkDoneProgressCancelNotification=e.WorkDoneProgressCreateRequest=e.WorkDoneProgress=void 0;let t=k(),n=V();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={}))})),Bt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CallHierarchyOutgoingCallsRequest=e.CallHierarchyIncomingCallsRequest=e.CallHierarchyPrepareRequest=void 0;let t=V();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={}))})),Vt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SemanticTokensRefreshRequest=e.SemanticTokensRangeRequest=e.SemanticTokensDeltaRequest=e.SemanticTokensRequest=e.SemanticTokensRegistrationType=e.TokenFormat=void 0;let t=V();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={}))})),Ht=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ShowDocumentRequest=void 0;let t=V();var n;(function(e){e.method=`window/showDocument`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(n||(e.ShowDocumentRequest=n={}))})),Ut=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedEditingRangeRequest=void 0;let t=V();var n;(function(e){e.method=`textDocument/linkedEditingRange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.LinkedEditingRangeRequest=n={}))})),Wt=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=V();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={}))})),Gt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MonikerRequest=e.MonikerKind=e.UniquenessLevel=void 0;let t=V();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={}))})),Kt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHierarchySubtypesRequest=e.TypeHierarchySupertypesRequest=e.TypeHierarchyPrepareRequest=void 0;let t=V();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={}))})),qt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineValueRefreshRequest=e.InlineValueRequest=void 0;let t=V();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={}))})),Jt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlayHintRefreshRequest=e.InlayHintResolveRequest=e.InlayHintRequest=void 0;let t=V();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={}))})),Yt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiagnosticRefreshRequest=e.WorkspaceDiagnosticRequest=e.DocumentDiagnosticRequest=e.DocumentDiagnosticReportKind=e.DiagnosticServerCancellationData=void 0;let t=k(),n=At(),r=V();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={}))})),Xt=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=(kt(),r(A)),n=At(),i=V();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={}))})),Zt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineCompletionRequest=void 0;let t=V();var n;(function(e){e.method=`textDocument/inlineCompletion`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(n||(e.InlineCompletionRequest=n={}))})),Qt=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=V(),n=(kt(),r(A)),i=At(),a=jt();Object.defineProperty(e,`ImplementationRequest`,{enumerable:!0,get:function(){return a.ImplementationRequest}});let o=Mt();Object.defineProperty(e,`TypeDefinitionRequest`,{enumerable:!0,get:function(){return o.TypeDefinitionRequest}});let s=Nt();Object.defineProperty(e,`WorkspaceFoldersRequest`,{enumerable:!0,get:function(){return s.WorkspaceFoldersRequest}}),Object.defineProperty(e,`DidChangeWorkspaceFoldersNotification`,{enumerable:!0,get:function(){return s.DidChangeWorkspaceFoldersNotification}});let c=Pt();Object.defineProperty(e,`ConfigurationRequest`,{enumerable:!0,get:function(){return c.ConfigurationRequest}});let l=Ft();Object.defineProperty(e,`DocumentColorRequest`,{enumerable:!0,get:function(){return l.DocumentColorRequest}}),Object.defineProperty(e,`ColorPresentationRequest`,{enumerable:!0,get:function(){return l.ColorPresentationRequest}});let u=It();Object.defineProperty(e,`FoldingRangeRequest`,{enumerable:!0,get:function(){return u.FoldingRangeRequest}}),Object.defineProperty(e,`FoldingRangeRefreshRequest`,{enumerable:!0,get:function(){return u.FoldingRangeRefreshRequest}});let d=Lt();Object.defineProperty(e,`DeclarationRequest`,{enumerable:!0,get:function(){return d.DeclarationRequest}});let f=Rt();Object.defineProperty(e,`SelectionRangeRequest`,{enumerable:!0,get:function(){return f.SelectionRangeRequest}});let p=zt();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=Bt();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=Vt();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=Ht();Object.defineProperty(e,`ShowDocumentRequest`,{enumerable:!0,get:function(){return g.ShowDocumentRequest}});let _=Ut();Object.defineProperty(e,`LinkedEditingRangeRequest`,{enumerable:!0,get:function(){return _.LinkedEditingRangeRequest}});let v=Wt();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=Gt();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=Kt();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=qt();Object.defineProperty(e,`InlineValueRequest`,{enumerable:!0,get:function(){return x.InlineValueRequest}}),Object.defineProperty(e,`InlineValueRefreshRequest`,{enumerable:!0,get:function(){return x.InlineValueRefreshRequest}});let S=Jt();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=Yt();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=Xt();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 ee=Zt();Object.defineProperty(e,`InlineCompletionRequest`,{enumerable:!0,get:function(){return ee.InlineCompletionRequest}});var T;(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})(T||(e.TextDocumentFilter=T={}));var E;(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})(E||(e.NotebookDocumentFilter=E={}));var D;(function(e){function t(e){let t=e;return i.objectLiteral(t)&&(i.string(t.notebook)||E.is(t.notebook))&&(t.language===void 0||i.string(t.language))}e.is=t})(D||(e.NotebookCellTextDocumentFilter=D={}));var te;(function(e){function t(e){if(!Array.isArray(e))return!1;for(let t of e)if(!i.string(t)&&!T.is(t)&&!D.is(t))return!1;return!0}e.is=t})(te||(e.DocumentSelector=te={}));var ne;(function(e){e.method=`client/registerCapability`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(ne||(e.RegistrationRequest=ne={}));var re;(function(e){e.method=`client/unregisterCapability`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(re||(e.UnregistrationRequest=re={}));var O;(function(e){e.Create=`create`,e.Rename=`rename`,e.Delete=`delete`})(O||(e.ResourceOperationKind=O={}));var ie;(function(e){e.Abort=`abort`,e.Transactional=`transactional`,e.TextOnlyTransactional=`textOnlyTransactional`,e.Undo=`undo`})(ie||(e.FailureHandlingKind=ie={}));var ae;(function(e){e.UTF8=`utf-8`,e.UTF16=`utf-16`,e.UTF32=`utf-32`})(ae||(e.PositionEncodingKind=ae={}));var oe;(function(e){function t(e){let t=e;return t&&i.string(t.id)&&t.id.length>0}e.hasId=t})(oe||(e.StaticRegistrationOptions=oe={}));var k;(function(e){function t(e){let t=e;return t&&(t.documentSelector===null||te.is(t.documentSelector))}e.is=t})(k||(e.TextDocumentRegistrationOptions=k={}));var se;(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})(se||(e.WorkDoneProgressOptions=se={}));var j;(function(e){e.method=`initialize`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(j||(e.InitializeRequest=j={}));var M;(function(e){e.unknownProtocolVersion=1})(M||(e.InitializeErrorCodes=M={}));var N;(function(e){e.method=`initialized`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(N||(e.InitializedNotification=N={}));var P;(function(e){e.method=`shutdown`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType0(e.method)})(P||(e.ShutdownRequest=P={}));var F;(function(e){e.method=`exit`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType0(e.method)})(F||(e.ExitNotification=F={}));var I;(function(e){e.method=`workspace/didChangeConfiguration`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(I||(e.DidChangeConfigurationNotification=I={}));var ce;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(ce||(e.MessageType=ce={}));var le;(function(e){e.method=`window/showMessage`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(le||(e.ShowMessageNotification=le={}));var ue;(function(e){e.method=`window/showMessageRequest`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(e.method)})(ue||(e.ShowMessageRequest=ue={}));var de;(function(e){e.method=`window/logMessage`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(de||(e.LogMessageNotification=de={}));var fe;(function(e){e.method=`telemetry/event`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolNotificationType(e.method)})(fe||(e.TelemetryEventNotification=fe={}));var pe;(function(e){e.None=0,e.Full=1,e.Incremental=2})(pe||(e.TextDocumentSyncKind=pe={}));var me;(function(e){e.method=`textDocument/didOpen`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(me||(e.DidOpenTextDocumentNotification=me={}));var he;(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})(he||(e.TextDocumentContentChangeEvent=he={}));var ge;(function(e){e.method=`textDocument/didChange`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ge||(e.DidChangeTextDocumentNotification=ge={}));var _e;(function(e){e.method=`textDocument/didClose`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(_e||(e.DidCloseTextDocumentNotification=_e={}));var ve;(function(e){e.method=`textDocument/didSave`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(ve||(e.DidSaveTextDocumentNotification=ve={}));var ye;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(ye||(e.TextDocumentSaveReason=ye={}));var be;(function(e){e.method=`textDocument/willSave`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(be||(e.WillSaveTextDocumentNotification=be={}));var L;(function(e){e.method=`textDocument/willSaveWaitUntil`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(L||(e.WillSaveTextDocumentWaitUntilRequest=L={}));var xe;(function(e){e.method=`workspace/didChangeWatchedFiles`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolNotificationType(e.method)})(xe||(e.DidChangeWatchedFilesNotification=xe={}));var R;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(R||(e.FileChangeType=R={}));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 z;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(z||(e.SignatureHelpTriggerKind=z={}));var ke;(function(e){e.method=`textDocument/signatureHelp`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(ke||(e.SignatureHelpRequest=ke={}));var Ae;(function(e){e.method=`textDocument/definition`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ae||(e.DefinitionRequest=Ae={}));var je;(function(e){e.method=`textDocument/references`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(je||(e.ReferencesRequest=je={}));var Me;(function(e){e.method=`textDocument/documentHighlight`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Me||(e.DocumentHighlightRequest=Me={}));var Ne;(function(e){e.method=`textDocument/documentSymbol`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ne||(e.DocumentSymbolRequest=Ne={}));var Pe;(function(e){e.method=`textDocument/codeAction`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Pe||(e.CodeActionRequest=Pe={}));var Fe;(function(e){e.method=`codeAction/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Fe||(e.CodeActionResolveRequest=Fe={}));var Ie;(function(e){e.method=`workspace/symbol`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ie||(e.WorkspaceSymbolRequest=Ie={}));var Le;(function(e){e.method=`workspaceSymbol/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Le||(e.WorkspaceSymbolResolveRequest=Le={}));var Re;(function(e){e.method=`textDocument/codeLens`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Re||(e.CodeLensRequest=Re={}));var ze;(function(e){e.method=`codeLens/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(ze||(e.CodeLensResolveRequest=ze={}));var Be;(function(e){e.method=`workspace/codeLens/refresh`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType0(e.method)})(Be||(e.CodeLensRefreshRequest=Be={}));var Ve;(function(e){e.method=`textDocument/documentLink`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ve||(e.DocumentLinkRequest=Ve={}));var He;(function(e){e.method=`documentLink/resolve`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(He||(e.DocumentLinkResolveRequest=He={}));var Ue;(function(e){e.method=`textDocument/formatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ue||(e.DocumentFormattingRequest=Ue={}));var We;(function(e){e.method=`textDocument/rangeFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(We||(e.DocumentRangeFormattingRequest=We={}));var Ge;(function(e){e.method=`textDocument/rangesFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ge||(e.DocumentRangesFormattingRequest=Ge={}));var Ke;(function(e){e.method=`textDocument/onTypeFormatting`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ke||(e.DocumentOnTypeFormattingRequest=Ke={}));var qe;(function(e){e.Identifier=1})(qe||(e.PrepareSupportDefaultBehavior=qe={}));var Je;(function(e){e.method=`textDocument/rename`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Je||(e.RenameRequest=Je={}));var Ye;(function(e){e.method=`textDocument/prepareRename`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Ye||(e.PrepareRenameRequest=Ye={}));var Xe;(function(e){e.method=`workspace/executeCommand`,e.messageDirection=t.MessageDirection.clientToServer,e.type=new t.ProtocolRequestType(e.method)})(Xe||(e.ExecuteCommandRequest=Xe={}));var Ze;(function(e){e.method=`workspace/applyEdit`,e.messageDirection=t.MessageDirection.serverToClient,e.type=new t.ProtocolRequestType(`workspace/applyEdit`)})(Ze||(e.ApplyWorkspaceEditRequest=Ze={}))})),$t=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createProtocolConnection=void 0;let t=k();function n(e,n,r,i){return t.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),(0,t.createMessageConnection)(e,n,r,i)}e.createProtocolConnection=n})),en=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(k(),e),n((kt(),r(A)),e),n(V(),e),n(Qt(),e);var i=$t();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={}))})),H=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=se();n(se(),e),n(en(),e);function i(e,t,n,i){return(0,r.createMessageConnection)(e,t,n,i)}e.createProtocolConnection=i})),tn=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})),nn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.attachPartialResult=e.ProgressFeature=e.attachWorkDone=void 0;let t=H(),n=tn();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,e.ProgressFeature=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)}};var c;(function(e){e.type=new t.ProgressType})(c||={});var l=class{constructor(e,t){this._connection=e,this._token=t}report(e){this._connection.sendProgress(c.type,this._token,e)}};function u(e,t){if(t===void 0||t.partialResultToken===void 0)return;let n=t.partialResultToken;return delete t.partialResultToken,new l(e,n)}e.attachPartialResult=u})),rn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ConfigurationFeature=void 0;let t=H(),n=b();e.ConfigurationFeature=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)}}})),an=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.WorkspaceFoldersFeature=void 0;let t=H();e.WorkspaceFoldersFeature=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}}})),on=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CallHierarchyFeature=void 0;let t=H();e.CallHierarchyFeature=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)))}}}}})),sn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SemanticTokensBuilder=e.SemanticTokensDiff=e.SemanticTokensFeature=void 0;let t=H();e.SemanticTokensFeature=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)))}}}};var n=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=n,e.SemanticTokensBuilder=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 n(this._prevData,this._data).computeDiff()}}}})),cn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ShowDocumentFeature=void 0;let t=H();e.ShowDocumentFeature=e=>class extends e{showDocument(e){return this.connection.sendRequest(t.ShowDocumentRequest.type,e)}}})),ln=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FileOperationsFeature=void 0;let t=H();e.FileOperationsFeature=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))}}})),un=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LinkedEditingRangeFeature=void 0;let t=H();e.LinkedEditingRangeFeature=e=>class extends e{onLinkedEditingRange(e){return this.connection.onRequest(t.LinkedEditingRangeRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t),void 0))}}})),dn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHierarchyFeature=void 0;let t=H();e.TypeHierarchyFeature=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)))}}}}})),fn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineValueFeature=void 0;let t=H();e.InlineValueFeature=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)))}}}})),pn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FoldingRangeFeature=void 0;let t=H();e.FoldingRangeFeature=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)))}}}}})),mn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlayHintFeature=void 0;let t=H();e.InlayHintFeature=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))}}}})),hn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DiagnosticFeature=void 0;let t=H();e.DiagnosticFeature=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)))}}}})),gn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TextDocuments=void 0;let t=H();e.TextDocuments=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())})}}})),_n=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NotebookDocuments=e.NotebookSyncFeature=void 0;let t=H(),n=gn();e.NotebookSyncFeature=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)})}}};var r=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}};r.NULL_DISPOSE=Object.freeze({dispose:()=>{}}),e.NotebookDocuments=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 r,i=[];return i.push(this.cellTextDocuments.listen(n)),i.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)})),i.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)})),i.push(e.notebooks.synchronization.onDidSaveNotebookDocument(e=>{let t=this.notebookDocuments.get(e.notebookDocument.uri);t!==void 0&&this._onDidSave.fire(t)})),i.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(()=>{i.forEach(e=>e.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}}})),vn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MonikerFeature=void 0;let t=H();e.MonikerFeature=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)))}}}}})),yn=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=H(),n=b(),r=tn(),i=nn(),a=rn(),o=an(),s=on(),c=sn(),l=cn(),u=ln(),d=un(),f=dn(),p=fn(),m=pn(),h=mn(),g=hn(),_=_n(),v=vn();function y(e){if(e!==null)return e}e.ErrorMessageTracker=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)})}};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 ee}e.create=t})(w||(e.BulkRegistration=w={}));var ee=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}}},T;(function(e){function t(){return new E(void 0,[])}e.create=t})(T||(e.BulkUnregistration=T={}));var E=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}},D=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 ee?this.registerMany(e):e instanceof E?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 E(this._connection,n.registrations.map(e=>({id:e.id,method:e.method}))),e=>(this.connection.console.info(`Bulk registration failed.`),Promise.reject(e)))}},te=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 ne=(0,u.FileOperationsFeature)((0,o.WorkspaceFoldersFeature)((0,a.ConfigurationFeature)(te)));var re=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(()=>{})}},O=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`)})}},ie=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=ie;let ae=(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)(ie)))))))));var oe=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=oe;let k=(0,_.NotebookSyncFeature)(oe);function se(e,t){return function(n){return t(e(n))}}e.combineConsoleFeatures=se;function A(e,t){return function(n){return t(e(n))}}e.combineTelemetryFeatures=A;function j(e,t){return function(n){return t(e(n))}}e.combineTracerFeatures=j;function M(e,t){return function(n){return t(e(n))}}e.combineClientFeatures=M;function N(e,t){return function(n){return t(e(n))}}e.combineWindowFeatures=N;function P(e,t){return function(n){return t(e(n))}}e.combineWorkspaceFeatures=P;function F(e,t){return function(n){return t(e(n))}}e.combineLanguagesFeatures=F;function I(e,t){return function(n){return t(e(n))}}e.combineNotebooksFeatures=I;function ce(e,t){function n(e,t,n){return e&&t?n(e,t):e||t}return{__brand:`features`,console:n(e.console,t.console,se),tracer:n(e.tracer,t.tracer,j),telemetry:n(e.telemetry,t.telemetry,A),client:n(e.client,t.client,M),window:n(e.window,t.window,N),workspace:n(e.workspace,t.workspace,P),languages:n(e.languages,t.languages,F),notebooks:n(e.notebooks,t.notebooks,I)}}e.combineFeatures=ce;function le(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(re)):new re,l=a&&a.telemetry?new(a.telemetry(O)):new O,u=a&&a.client?new(a.client(D)):new D,d=a&&a.window?new(a.window(C)):new C,f=a&&a.workspace?new(a.workspace(ne)):new ne,p=a&&a.languages?new(a.languages(ae)):new ae,m=a&&a.notebooks?new(a.notebooks(k)):new k,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=le})),bn=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})),xn=o(((e,t)=>{t.exports=H()})),Sn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.InlineCompletionFeature=void 0;let t=H();e.InlineCompletionFeature=e=>class extends e{get inlineCompletion(){return{on:e=>this.connection.onRequest(t.InlineCompletionRequest.type,(t,n)=>e(t,n,this.attachWorkDoneProgress(t)))}}}})),Cn=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=sn();Object.defineProperty(e,`SemanticTokensBuilder`,{enumerable:!0,get:function(){return r.SemanticTokensBuilder}});let i=Sn();n(H(),e);let a=gn();Object.defineProperty(e,`TextDocuments`,{enumerable:!0,get:function(){return a.TextDocuments}});let o=_n();Object.defineProperty(e,`NotebookDocuments`,{enumerable:!0,get:function(){return o.NotebookDocuments}}),n(yn(),e);var s;(function(e){e.all={__brand:`features`,languages:i.InlineCompletionFeature}})(s||(e.ProposedFeatures=s={}))})),wn=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=b(),o=yn(),s=bn(),c=xn();r(xn(),t),r(Cn(),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)})}return(0,o.createConnection)(r=>{let a=(0,c.createProtocolConnection)(e,t,r,n);return i&&g(r),a},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){if(!n)if(r.length===0)e.error(`Assertion failed`);else{let[n,...i]=r;e.error(`Assertion failed: ${n} ${t(i)}`)}},console.count=function(t=`default`){let r=String(t),i=n.get(r)??0;i+=1,n.set(r,i),e.log(`${r}: ${r}`)},console.countReset=function(e){e===void 0?n.clear():n.delete(String(e))},console.debug=function(...n){e.log(t(n))},console.dir=function(t,n){e.log((0,i.inspect)(t,n))},console.log=function(...n){e.log(t(n))},console.error=function(...n){e.error(t(n))},console.trace=function(...n){let r=Error().stack.replace(/(.+\n){2}/,``),i=`Trace`;n.length!==0&&(i+=`: ${t(n)}`),e.log(`${i}\n${r}`)},console.warn=function(...n){e.warn(t(n))}}}));function U(e){return typeof e==`object`&&!!e&&typeof e.$type==`string`}function Tn(e){return typeof e==`object`&&!!e&&typeof e.$refText==`string`}function En(e){return typeof e==`object`&&!!e&&typeof e.name==`string`&&typeof e.type==`string`&&typeof e.path==`string`}function Dn(e){return typeof e==`object`&&!!e&&U(e.container)&&Tn(e.reference)&&typeof e.message==`string`}var On=class{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return U(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 kn(e){return typeof e==`object`&&!!e&&Array.isArray(e.content)}function An(e){return typeof e==`object`&&!!e&&typeof e.tokenType==`object`}function jn(e){return kn(e)&&typeof e.fullText==`string`}var Mn=i({AbstractElement:()=>Kn,AbstractRule:()=>Pn,AbstractType:()=>In,Action:()=>zr,Alternatives:()=>Vr,ArrayLiteral:()=>Jn,ArrayType:()=>Xn,Assignment:()=>Ur,BooleanLiteral:()=>Qn,CharacterRange:()=>Gr,Condition:()=>Rn,Conjunction:()=>er,CrossReference:()=>qr,Disjunction:()=>nr,EndOfFile:()=>Yr,Grammar:()=>ir,GrammarImport:()=>or,Group:()=>Zr,InferredType:()=>cr,Interface:()=>ur,Keyword:()=>$r,LangiumGrammarAstReflection:()=>yi,LangiumGrammarTerminals:()=>Nn,NamedArgument:()=>fr,NegatedToken:()=>ti,Negation:()=>mr,NumberLiteral:()=>gr,Parameter:()=>vr,ParameterReference:()=>br,ParserRule:()=>Sr,ReferenceType:()=>Cr,RegexToken:()=>ri,ReturnType:()=>Tr,RuleCall:()=>ai,SimpleType:()=>Dr,StringLiteral:()=>kr,TerminalAlternatives:()=>si,TerminalGroup:()=>li,TerminalRule:()=>jr,TerminalRuleCall:()=>di,Type:()=>Nr,TypeAttribute:()=>Fr,TypeDefinition:()=>Hn,UnionType:()=>Lr,UnorderedGroup:()=>pi,UntilToken:()=>hi,ValueLiteral:()=>Wn,Wildcard:()=>_i,isAbstractElement:()=>qn,isAbstractRule:()=>Fn,isAbstractType:()=>Ln,isAction:()=>Br,isAlternatives:()=>Hr,isArrayLiteral:()=>Yn,isArrayType:()=>Zn,isAssignment:()=>Wr,isBooleanLiteral:()=>$n,isCharacterRange:()=>Kr,isCondition:()=>zn,isConjunction:()=>tr,isCrossReference:()=>Jr,isDisjunction:()=>rr,isEndOfFile:()=>Xr,isFeatureName:()=>Bn,isGrammar:()=>ar,isGrammarImport:()=>sr,isGroup:()=>Qr,isInferredType:()=>lr,isInterface:()=>dr,isKeyword:()=>ei,isNamedArgument:()=>pr,isNegatedToken:()=>ni,isNegation:()=>hr,isNumberLiteral:()=>_r,isParameter:()=>yr,isParameterReference:()=>xr,isParserRule:()=>W,isPrimitiveType:()=>Vn,isReferenceType:()=>wr,isRegexToken:()=>ii,isReturnType:()=>Er,isRuleCall:()=>oi,isSimpleType:()=>Or,isStringLiteral:()=>Ar,isTerminalAlternatives:()=>ci,isTerminalGroup:()=>ui,isTerminalRule:()=>Mr,isTerminalRuleCall:()=>fi,isType:()=>Pr,isTypeAttribute:()=>Ir,isTypeDefinition:()=>Un,isUnionType:()=>Rr,isUnorderedGroup:()=>mi,isUntilToken:()=>gi,isValueLiteral:()=>Gn,isWildcard:()=>vi,reflection:()=>G});const Nn={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]*/},Pn=`AbstractRule`;function Fn(e){return G.isInstance(e,Pn)}const In=`AbstractType`;function Ln(e){return G.isInstance(e,In)}const Rn=`Condition`;function zn(e){return G.isInstance(e,Rn)}function Bn(e){return Vn(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 Vn(e){return e===`string`||e===`number`||e===`boolean`||e===`Date`||e===`bigint`}const Hn=`TypeDefinition`;function Un(e){return G.isInstance(e,Hn)}const Wn=`ValueLiteral`;function Gn(e){return G.isInstance(e,Wn)}const Kn=`AbstractElement`;function qn(e){return G.isInstance(e,Kn)}const Jn=`ArrayLiteral`;function Yn(e){return G.isInstance(e,Jn)}const Xn=`ArrayType`;function Zn(e){return G.isInstance(e,Xn)}const Qn=`BooleanLiteral`;function $n(e){return G.isInstance(e,Qn)}const er=`Conjunction`;function tr(e){return G.isInstance(e,er)}const nr=`Disjunction`;function rr(e){return G.isInstance(e,nr)}const ir=`Grammar`;function ar(e){return G.isInstance(e,ir)}const or=`GrammarImport`;function sr(e){return G.isInstance(e,or)}const cr=`InferredType`;function lr(e){return G.isInstance(e,cr)}const ur=`Interface`;function dr(e){return G.isInstance(e,ur)}const fr=`NamedArgument`;function pr(e){return G.isInstance(e,fr)}const mr=`Negation`;function hr(e){return G.isInstance(e,mr)}const gr=`NumberLiteral`;function _r(e){return G.isInstance(e,gr)}const vr=`Parameter`;function yr(e){return G.isInstance(e,vr)}const br=`ParameterReference`;function xr(e){return G.isInstance(e,br)}const Sr=`ParserRule`;function W(e){return G.isInstance(e,Sr)}const Cr=`ReferenceType`;function wr(e){return G.isInstance(e,Cr)}const Tr=`ReturnType`;function Er(e){return G.isInstance(e,Tr)}const Dr=`SimpleType`;function Or(e){return G.isInstance(e,Dr)}const kr=`StringLiteral`;function Ar(e){return G.isInstance(e,kr)}const jr=`TerminalRule`;function Mr(e){return G.isInstance(e,jr)}const Nr=`Type`;function Pr(e){return G.isInstance(e,Nr)}const Fr=`TypeAttribute`;function Ir(e){return G.isInstance(e,Fr)}const Lr=`UnionType`;function Rr(e){return G.isInstance(e,Lr)}const zr=`Action`;function Br(e){return G.isInstance(e,zr)}const Vr=`Alternatives`;function Hr(e){return G.isInstance(e,Vr)}const Ur=`Assignment`;function Wr(e){return G.isInstance(e,Ur)}const Gr=`CharacterRange`;function Kr(e){return G.isInstance(e,Gr)}const qr=`CrossReference`;function Jr(e){return G.isInstance(e,qr)}const Yr=`EndOfFile`;function Xr(e){return G.isInstance(e,Yr)}const Zr=`Group`;function Qr(e){return G.isInstance(e,Zr)}const $r=`Keyword`;function ei(e){return G.isInstance(e,$r)}const ti=`NegatedToken`;function ni(e){return G.isInstance(e,ti)}const ri=`RegexToken`;function ii(e){return G.isInstance(e,ri)}const ai=`RuleCall`;function oi(e){return G.isInstance(e,ai)}const si=`TerminalAlternatives`;function ci(e){return G.isInstance(e,si)}const li=`TerminalGroup`;function ui(e){return G.isInstance(e,li)}const di=`TerminalRuleCall`;function fi(e){return G.isInstance(e,di)}const pi=`UnorderedGroup`;function mi(e){return G.isInstance(e,pi)}const hi=`UntilToken`;function gi(e){return G.isInstance(e,hi)}const _i=`Wildcard`;function vi(e){return G.isInstance(e,_i)}var yi=class extends On{getAllTypes(){return[Kn,Pn,In,zr,Vr,Jn,Xn,Ur,Qn,Gr,Rn,er,qr,nr,Yr,ir,or,Zr,cr,ur,$r,fr,ti,mr,gr,vr,br,Sr,Cr,ri,Tr,ai,Dr,kr,si,li,jr,di,Nr,Fr,Hn,Lr,pi,hi,Wn,_i]}computeIsSubtype(e,t){switch(e){case zr:case Vr:case Ur:case Gr:case qr:case Yr:case Zr:case $r:case ti:case ri:case ai:case si:case li:case di:case pi:case hi:case _i:return this.isSubtype(Kn,t);case Jn:case gr:case kr:return this.isSubtype(Wn,t);case Xn:case Cr:case Dr:case Lr:return this.isSubtype(Hn,t);case Qn:return this.isSubtype(Rn,t)||this.isSubtype(Wn,t);case er:case nr:case mr:case br:return this.isSubtype(Rn,t);case cr:case ur:case Nr:return this.isSubtype(In,t);case Sr:return this.isSubtype(Pn,t)||this.isSubtype(In,t);case jr:return this.isSubtype(Pn,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 In;case`Grammar:hiddenTokens`:case`ParserRule:hiddenTokens`:case`RuleCall:rule`:return Pn;case`Grammar:usedGrammars`:return ir;case`NamedArgument:parameter`:case`ParameterReference:parameter`:return vr;case`TerminalRuleCall:rule`:return jr;default:throw Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Kn:return{name:Kn,properties:[{name:`cardinality`},{name:`lookahead`}]};case Jn:return{name:Jn,properties:[{name:`elements`,defaultValue:[]}]};case Xn:return{name:Xn,properties:[{name:`elementType`}]};case Qn:return{name:Qn,properties:[{name:`true`,defaultValue:!1}]};case er:return{name:er,properties:[{name:`left`},{name:`right`}]};case nr:return{name:nr,properties:[{name:`left`},{name:`right`}]};case ir:return{name:ir,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 or:return{name:or,properties:[{name:`path`}]};case cr:return{name:cr,properties:[{name:`name`}]};case ur:return{name:ur,properties:[{name:`attributes`,defaultValue:[]},{name:`name`},{name:`superTypes`,defaultValue:[]}]};case fr:return{name:fr,properties:[{name:`calledByName`,defaultValue:!1},{name:`parameter`},{name:`value`}]};case mr:return{name:mr,properties:[{name:`value`}]};case gr:return{name:gr,properties:[{name:`value`}]};case vr:return{name:vr,properties:[{name:`name`}]};case br:return{name:br,properties:[{name:`parameter`}]};case Sr:return{name:Sr,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 Cr:return{name:Cr,properties:[{name:`referenceType`}]};case Tr:return{name:Tr,properties:[{name:`name`}]};case Dr:return{name:Dr,properties:[{name:`primitiveType`},{name:`stringType`},{name:`typeRef`}]};case kr:return{name:kr,properties:[{name:`value`}]};case jr:return{name:jr,properties:[{name:`definition`},{name:`fragment`,defaultValue:!1},{name:`hidden`,defaultValue:!1},{name:`name`},{name:`type`}]};case Nr:return{name:Nr,properties:[{name:`name`},{name:`type`}]};case Fr:return{name:Fr,properties:[{name:`defaultValue`},{name:`isOptional`,defaultValue:!1},{name:`name`},{name:`type`}]};case Lr:return{name:Lr,properties:[{name:`types`,defaultValue:[]}]};case zr:return{name:zr,properties:[{name:`cardinality`},{name:`feature`},{name:`inferredType`},{name:`lookahead`},{name:`operator`},{name:`type`}]};case Vr:return{name:Vr,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case Ur:return{name:Ur,properties:[{name:`cardinality`},{name:`feature`},{name:`lookahead`},{name:`operator`},{name:`terminal`}]};case Gr:return{name:Gr,properties:[{name:`cardinality`},{name:`left`},{name:`lookahead`},{name:`right`}]};case qr:return{name:qr,properties:[{name:`cardinality`},{name:`deprecatedSyntax`,defaultValue:!1},{name:`lookahead`},{name:`terminal`},{name:`type`}]};case Yr:return{name:Yr,properties:[{name:`cardinality`},{name:`lookahead`}]};case Zr:return{name:Zr,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`guardCondition`},{name:`lookahead`}]};case $r:return{name:$r,properties:[{name:`cardinality`},{name:`lookahead`},{name:`value`}]};case ti:return{name:ti,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case ri:return{name:ri,properties:[{name:`cardinality`},{name:`lookahead`},{name:`regex`}]};case ai:return{name:ai,properties:[{name:`arguments`,defaultValue:[]},{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case si:return{name:si,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case li:return{name:li,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case di:return{name:di,properties:[{name:`cardinality`},{name:`lookahead`},{name:`rule`}]};case pi:return{name:pi,properties:[{name:`cardinality`},{name:`elements`,defaultValue:[]},{name:`lookahead`}]};case hi:return{name:hi,properties:[{name:`cardinality`},{name:`lookahead`},{name:`terminal`}]};case _i:return{name:_i,properties:[{name:`cardinality`},{name:`lookahead`}]};default:return{name:e,properties:[]}}}};const G=new yi;var bi=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 K})}join(e=`,`){let t=this.iterator(),n=``,r,i=!1;do r=t.next(),r.done||(i&&(n+=e),n+=xi(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?K:{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 K})}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(Si(n))e.iterator=n[Symbol.iterator]();else return{done:!1,value:n}}}while(e.iterator);return K})}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(Si(r))e.iterator=r[Symbol.iterator]();else return{done:!1,value:r}}while(e.iterator);return K})}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?K: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 K})}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 xi(e){return typeof e==`string`?e:e===void 0?`undefined`:typeof e.toString==`function`?e.toString():Object.prototype.toString.call(e)}function Si(e){return!!e&&typeof e[Symbol.iterator]==`function`}const Ci=new bi(()=>void 0,()=>K),K=Object.freeze({done:!0,value:void 0});function q(...e){if(e.length===1){let t=e[0];if(t instanceof bi)return t;if(Si(t))return new bi(()=>t[Symbol.iterator](),e=>e.next());if(typeof t.length==`number`)return new bi(()=>({index:0}),e=>e.index<t.length?{done:!1,value:t[e.index++]}:K)}return e.length>1?new bi(()=>({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++];Si(n)?t.iterator=n[Symbol.iterator]():n&&typeof n.length==`number`&&(t.array=n)}}while(t.iterator||t.array||t.collIndex<e.length);return K}):Ci}var wi=class extends bi{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 K})}iterator(){let e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}},Ti;(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})(Ti||={});var Ei=i({DefaultNameRegexp:()=>Fi,RangeComparison:()=>Mi,compareRange:()=>Ni,findCommentNode:()=>Li,findDeclarationNodeAtOffset:()=>Ii,findLeafNodeAtOffset:()=>zi,findLeafNodeBeforeOffset:()=>Bi,flattenCst:()=>Oi,getInteriorNodes:()=>Gi,getNextNode:()=>Ui,getPreviousNode:()=>Hi,getStartlineNode:()=>Wi,inRange:()=>Pi,isChildNode:()=>ki,isCommentNode:()=>Ri,streamCst:()=>Di,toDocumentSegment:()=>ji,tokenToRange:()=>Ai});function Di(e){return new wi(e,e=>kn(e)?e.content:[],{includeRoot:!0})}function Oi(e){return Di(e).filter(An)}function ki(e,t){for(;e.container;)if(e=e.container,e===t)return!0;return!1}function Ai(e){return{start:{character:e.startColumn-1,line:e.startLine-1},end:{character:e.endColumn,line:e.endLine-1}}}function ji(e){if(!e)return;let{offset:t,end:n,range:r}=e;return{range:r,offset:t,end:n,length:n-t}}var Mi;(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`})(Mi||={});function Ni(e,t){if(e.end.line<t.start.line||e.end.line===t.start.line&&e.end.character<=t.start.character)return Mi.Before;if(e.start.line>t.end.line||e.start.line===t.end.line&&e.start.character>=t.end.character)return Mi.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?Mi.Inside:n?Mi.OverlapBack:r?Mi.OverlapFront:Mi.Outside}function Pi(e,t){return Ni(e,t)>Mi.After}const Fi=/^[\w\p{L}]$/u;function Ii(e,t,n=Fi){if(e){if(t>0){let r=t-e.offset,i=e.text.charAt(r);n.test(i)||t--}return zi(e,t)}}function Li(e,t){if(e){let n=Hi(e,!0);if(n&&Ri(n,t))return n;if(jn(e)){let n=e.content.findIndex(e=>!e.hidden);for(let r=n-1;r>=0;r--){let n=e.content[r];if(Ri(n,t))return n}}}}function Ri(e,t){return An(e)&&t.includes(e.tokenType.name)}function zi(e,t){if(An(e))return e;if(kn(e)){let n=Vi(e,t,!1);if(n)return zi(n,t)}}function Bi(e,t){if(An(e))return e;if(kn(e)){let n=Vi(e,t,!0);if(n)return Bi(n,t)}}function Vi(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 Hi(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 Ui(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 Wi(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 Gi(e,t){let n=Ki(e,t);return n?n.parent.content.slice(n.a+1,n.b):[]}function Ki(e,t){let n=qi(e),r=qi(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 qi(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 Ji=i({assignMandatoryProperties:()=>oa,copyAstNode:()=>ca,findLocalReferences:()=>aa,findRootNode:()=>$i,getContainerOfType:()=>Xi,getDocument:()=>Qi,hasContainerOfType:()=>Zi,linkContentToContainer:()=>Yi,streamAllContents:()=>ta,streamAst:()=>na,streamContents:()=>ea,streamReferences:()=>ia});function Yi(e){for(let[t,n]of Object.entries(e))t.startsWith(`$`)||(Array.isArray(n)?n.forEach((n,r)=>{U(n)&&(n.$container=e,n.$containerProperty=t,n.$containerIndex=r)}):U(n)&&(n.$container=e,n.$containerProperty=t))}function Xi(e,t){let n=e;for(;n;){if(t(n))return n;n=n.$container}}function Zi(e,t){let n=e;for(;n;){if(t(n))return!0;n=n.$container}return!1}function Qi(e){let t=$i(e).$document;if(!t)throw Error(`AST node has no document.`);return t}function $i(e){for(;e.$container;)e=e.$container;return e}function ea(e,t){if(!e)throw Error(`Node must be an AstNode.`);let n=t?.range;return new bi(()=>({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(U(i)){if(t.keyIndex++,ra(i,n))return{done:!1,value:i}}else if(Array.isArray(i)){for(;t.arrayIndex<i.length;){let e=i[t.arrayIndex++];if(U(e)&&ra(e,n))return{done:!1,value:e}}t.arrayIndex=0}}t.keyIndex++}return K})}function ta(e,t){if(!e)throw Error(`Root node must be an AstNode.`);return new wi(e,e=>ea(e,t))}function na(e,t){if(!e)throw Error(`Root node must be an AstNode.`);return t?.range&&!ra(e,t.range)?new wi(e,()=>[]):new wi(e,e=>ea(e,t),{includeRoot:!0})}function ra(e,t){if(!t)return!0;let n=e.$cstNode?.range;return n?Pi(n,t):!1}function ia(e){return new bi(()=>({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(Tn(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(Tn(a))return{done:!1,value:{reference:a,container:e,property:n,index:i}}}t.arrayIndex=0}}t.keyIndex++}return K})}function aa(e,t=Qi(e).parseResult.value){let n=[];return na(t).forEach(t=>{ia(t).forEach(t=>{t.reference.ref===e&&n.push(t.reference)})}),q(n)}function oa(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]=sa(e.defaultValue))}function sa(e){return Array.isArray(e)?[...e.map(sa)]:e}function ca(e,t){let n={$type:e.$type};for(let[r,i]of Object.entries(e))if(!r.startsWith(`$`))if(U(i))n[r]=ca(i,t);else if(Tn(i))n[r]=t(n,r,i.$refNode,i.$refText);else if(Array.isArray(i)){let e=[];for(let a of i)U(a)?e.push(ca(a,t)):Tn(a)?e.push(t(n,r,a.$refNode,a.$refText)):e.push(a);n[r]=e}else n[r]=i;return Yi(n),n}var la=class extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}};function ua(e){throw Error(`Error! The input value was not handled.`)}var da=i({NEWLINE_REGEXP:()=>fa,escapeRegExp:()=>ya,getTerminalParts:()=>ha,isMultilineComment:()=>ga,isWhitespace:()=>va,partialMatches:()=>ba,partialRegExp:()=>xa,whitespaceCharacters:()=>_a});const fa=/\r?\n/gm,pa=new s,ma=new 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===`
17
- `&&(this.multiline=!0),e.quantifier)this.isStarting=!1,this.endRegexpStack=[];else{let e=ya(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=!!`
18
- `.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)}};function ha(e){try{typeof e!=`string`&&(e=e.source),e=`/${e}/`;let t=pa.pattern(e),n=[];for(let r of t.value.value)ma.reset(e),ma.visit(r),n.push({start:ma.startRegexp,end:ma.endRegex});return n}catch{return[]}}function ga(e){try{return typeof e==`string`&&(e=new RegExp(e)),e=e.toString(),ma.reset(e),ma.visit(pa.pattern(e)),ma.multiline}catch{return!1}}const _a=`\f
19
- \r \v \xA0            \u2028\u2029   `.split(``);function va(e){let t=typeof e==`string`?new RegExp(e):e;return _a.some(e=>t.test(e))}function ya(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ba(e,t){let n=xa(e),r=t.match(n);return!!r&&r[0].length>0}function xa(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 Sa=i({findAssignment:()=>Ia,findNameAssignment:()=>La,findNodeForKeyword:()=>Pa,findNodeForProperty:()=>ja,findNodesForKeyword:()=>Na,findNodesForKeywordInternal:()=>Fa,findNodesForProperty:()=>Aa,getActionAtElement:()=>za,getActionType:()=>Ya,getAllReachableRules:()=>Ta,getAllRulesUsedForCrossReferences:()=>Da,getCrossReferenceTerminal:()=>Oa,getEntryRule:()=>Ca,getExplicitRuleType:()=>qa,getHiddenRules:()=>wa,getRuleType:()=>Za,getRuleTypeName:()=>Xa,getTypeName:()=>Ja,isArrayCardinality:()=>Va,isArrayOperator:()=>Ha,isCommentTerminal:()=>ka,isDataType:()=>Ga,isDataTypeRule:()=>Ua,isOptionalCardinality:()=>Ba,terminalRegex:()=>Qa});function Ca(e){return e.rules.find(e=>W(e)&&e.entry)}function wa(e){return e.rules.filter(e=>Mr(e)&&e.hidden)}function Ta(e,t){let n=new Set,r=Ca(e);if(!r)return new Set(e.rules);let i=[r].concat(wa(e));for(let e of i)Ea(e,n,t);let a=new Set;for(let t of e.rules)(n.has(t.name)||Mr(t)&&t.hidden)&&a.add(t);return a}function Ea(e,t,n){t.add(e.name),ta(e).forEach(e=>{if(oi(e)||n&&fi(e)){let r=e.rule.ref;r&&!t.has(r.name)&&Ea(r,t,n)}})}function Da(e){let t=new Set;return ta(e).forEach(e=>{Jr(e)&&(W(e.type.ref)&&t.add(e.type.ref),lr(e.type.ref)&&W(e.type.ref.$container)&&t.add(e.type.ref.$container))}),t}function Oa(e){if(e.terminal)return e.terminal;if(e.type.ref)return La(e.type.ref)?.terminal}function ka(e){return e.hidden&&!va(Qa(e))}function Aa(e,t){return!e||!t?[]:Ma(e,t,e.astNode,!0)}function ja(e,t,n){if(!e||!t)return;let r=Ma(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 Ma(e,t,n,r){if(!r){let n=Xi(e.grammarSource,Wr);if(n&&n.feature===t)return[e]}return kn(e)&&e.astNode===n?e.content.flatMap(e=>Ma(e,t,n,!1)):[]}function Na(e,t){return e?Fa(e,t,e?.astNode):[]}function Pa(e,t,n){if(!e)return;let r=Fa(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 Fa(e,t,n){if(e.astNode!==n)return[];if(ei(e.grammarSource)&&e.grammarSource.value===t)return[e];let r=Di(e).iterator(),i,a=[];do if(i=r.next(),!i.done){let e=i.value;e.astNode===n?ei(e.grammarSource)&&e.grammarSource.value===t&&a.push(e):r.prune()}while(!i.done);return a}function Ia(e){let t=e.astNode;for(;t===e.container?.astNode;){let t=Xi(e.grammarSource,Wr);if(t)return t;e=e.container}}function La(e){let t=e;return lr(t)&&(Br(t.$container)?t=t.$container.$container:W(t.$container)?t=t.$container:ua(t.$container)),Ra(e,t,new Map)}function Ra(e,t,n){function r(t,r){let i;return Xi(t,Wr)||(i=Ra(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 ta(t))if(Wr(i)&&i.feature.toLowerCase()===`name`)return n.set(e,i),i;else if(oi(i)&&W(i.rule.ref))return r(i,i.rule.ref);else if(Or(i)&&i.typeRef?.ref)return r(i,i.typeRef.ref)}function za(e){let t=e.$container;if(Qr(t)){let n=t.elements,r=n.indexOf(e);for(let e=r-1;e>=0;e--){let t=n[e];if(Br(t))return t;{let t=ta(n[e]).find(Br);if(t)return t}}}if(qn(t))return za(t)}function Ba(e,t){return e===`?`||e===`*`||Qr(t)&&!!t.guardCondition}function Va(e){return e===`*`||e===`+`}function Ha(e){return e===`+=`}function Ua(e){return Wa(e,new Set)}function Wa(e,t){if(t.has(e))return!0;t.add(e);for(let n of ta(e))if(oi(n)){if(!n.rule.ref||W(n.rule.ref)&&!Wa(n.rule.ref,t))return!1}else if(Wr(n))return!1;else if(Br(n))return!1;return!!e.definition}function Ga(e){return Ka(e.type,new Set)}function Ka(e,t){if(t.has(e))return!0;if(t.add(e),Zn(e)||wr(e))return!1;if(Rr(e))return e.types.every(e=>Ka(e,t));if(Or(e)){if(e.primitiveType!==void 0||e.stringType!==void 0)return!0;if(e.typeRef!==void 0){let n=e.typeRef.ref;return Pr(n)?Ka(n.type,t):!1}else return!1}else return!1}function qa(e){if(e.inferredType)return e.inferredType.name;if(e.dataType)return e.dataType;if(e.returnType){let t=e.returnType.ref;if(t&&(W(t)||dr(t)||Pr(t)))return t.name}}function Ja(e){if(W(e))return Ua(e)?e.name:qa(e)??e.name;if(dr(e)||Pr(e)||Er(e))return e.name;if(Br(e)){let t=Ya(e);if(t)return t}else if(lr(e))return e.name;throw Error(`Cannot get name of Unknown Type`)}function Ya(e){if(e.inferredType)return e.inferredType.name;if(e.type?.ref)return Ja(e.type.ref)}function Xa(e){return Mr(e)?e.type?.name??`string`:Ua(e)?e.name:qa(e)??e.name}function Za(e){return Mr(e)?e.type?.name??`string`:qa(e)??e.name}function Qa(e){let t={s:!1,i:!1,u:!1},n=eo(e.definition,t),r=Object.entries(t).filter(([,e])=>e).map(([e])=>e).join(``);return new RegExp(n,r)}const $a=`[\\s\\S]`;function eo(e,t){if(ci(e))return to(e);if(ui(e))return no(e);if(Kr(e))return ao(e);if(fi(e)){let t=e.rule.ref;if(!t)throw Error(`Missing rule reference.`);return so(eo(t.definition),{cardinality:e.cardinality,lookahead:e.lookahead})}else if(ni(e))return io(e);else if(gi(e))return ro(e);else if(ii(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`)),so(r,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}else if(vi(e))return so($a,{cardinality:e.cardinality,lookahead:e.lookahead});else throw Error(`Invalid terminal element: ${e?.$type}`)}function to(e){return so(e.elements.map(e=>eo(e)).join(`|`),{cardinality:e.cardinality,lookahead:e.lookahead})}function no(e){return so(e.elements.map(e=>eo(e)).join(``),{cardinality:e.cardinality,lookahead:e.lookahead})}function ro(e){return so(`${$a}*?${eo(e.terminal)}`,{cardinality:e.cardinality,lookahead:e.lookahead})}function io(e){return so(`(?!${eo(e.terminal)})${$a}*?`,{cardinality:e.cardinality,lookahead:e.lookahead})}function ao(e){return e.right?so(`[${oo(e.left)}-${oo(e.right)}]`,{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1}):so(oo(e.left),{cardinality:e.cardinality,lookahead:e.lookahead,wrap:!1})}function oo(e){return ya(e.value)}function so(e,t){return(t.wrap!==!1||t.lookahead)&&(e=`(${t.lookahead??``}${e})`),t.cardinality?`${e}${t.cardinality}`:e}function co(e,t){let n={stacks:e,tokens:t};return ho(n),n.stacks.flat().forEach(e=>{e.property=void 0}),go(n.stacks).map(e=>e[e.length-1])}function lo(e){let{next:t,cardinalities:n,visited:r,plus:i}=e,a=[],o=t.feature;if(r.has(o))return[];Qr(o)||r.add(o);let s,c=o;for(;c.$container;)if(Qr(c.$container)){s=c.$container;break}else if(qn(c.$container))c=c.$container;else break;if(Va(c.cardinality)){let e=fo({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(...mo({feature:s,type:t.type},e+1,n,r,i)),a.every(e=>Ba(e.feature.cardinality,e.feature)||Ba(n.get(e.feature))||i.has(e.feature))&&a.push(...lo({next:{feature:s,type:t.type},cardinalities:n,visited:r,plus:i}))}return a}function uo(e){return U(e)&&(e={feature:e}),fo({next:e,cardinalities:new Map,visited:new Set,plus:new Set})}function fo(e){let{next:t,cardinalities:n,visited:r,plus:i}=e;if(t===void 0)return[];let{feature:a,type:o}=t;if(Qr(a))return r.has(a)?[]:(r.add(a),mo(t,0,n,r,i).map(e=>po(e,a.cardinality,n)));if(Hr(a)||mi(a))return a.elements.flatMap(e=>fo({next:{feature:e,type:o,property:t.property},cardinalities:n,visited:r,plus:i})).map(e=>po(e,a.cardinality,n));if(Wr(a))return fo({next:{feature:a.terminal,type:o,property:t.property??a.feature},cardinalities:n,visited:r,plus:i}).map(e=>po(e,a.cardinality,n));if(Br(a))return lo({next:{feature:a,type:Ja(a),property:t.property??a.feature},cardinalities:n,visited:r,plus:i});if(oi(a)&&W(a.rule.ref)){let e=a.rule.ref;return fo({next:{feature:e.definition,type:e.fragment||e.dataType?void 0:qa(e)??e.name,property:t.property},cardinalities:n,visited:r,plus:i}).map(e=>po(e,a.cardinality,n))}else return[t]}function po(e,t,n){return n.set(e.feature,t),e}function mo(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(...fo({next:o,cardinalities:n,visited:r,plus:i})),Ba(o.feature.cardinality??n.get(o.feature),o.feature)););return a}function ho(e){for(let t of e.tokens)e.stacks=go(e.stacks,t)}function go(e,t){let n=[];for(let r of e)n.push(..._o(r,t));return n}function _o(e,t){let n=new Map,r=new Set(e.map(e=>e.feature).filter(vo)),i=[];for(;e.length>0;){let a=lo({next:e.pop(),cardinalities:n,plus:r,visited:new Set}).filter(e=>t?yo(e.feature,t):!0);for(let t of a)i.push([...e,t]);if(!a.every(e=>Ba(e.feature.cardinality,e.feature)||Ba(n.get(e.feature))))break}return i}function vo(e){if(e.cardinality===`+`)return!0;let t=Xi(e,Wr);return!!(t&&t.cardinality===`+`)}function yo(e,t){if(ei(e))return e.value===t.image;if(oi(e))return bo(e.rule.ref,t);if(Jr(e)){let n=Oa(e);if(n)return yo(n,t)}return!1}function bo(e,t){return W(e)?uo(e.definition).some(e=>yo(e.feature,t)):Mr(e)?Qa(e).test(t.image):!1}var J=wn();function xo(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 So=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=>ei(e.feature)?e.feature.value:e.feature,s=[];for(let e of i)if(await Promise.all(q(e.features).distinct(o).exclude(s).map(t=>this.completionFor(e,t,a))),s.push(...e.features),!this.continueCompletion(r))break;return J.CompletionList.create(this.deduplicateItems(r),!0)}deduplicateItems(e){return q(e).distinct(e=>`${e.kind}_${e.label}_${e.detail}`).toArray()}findFeaturesAt(e,t){let n=e.getText({start:J.Position.create(0,0),end:e.positionAt(t)}),r=this.completionParser.parse(n),i=r.tokens;if(r.tokenIndex===0){let e=Ca(this.grammar),t=uo({feature:e.definition,type:qa(e)});return i.length>0?(i.shift(),co(t.map(e=>[e]),i)):t}let a=[...i].splice(r.tokenIndex);return co([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=Bi(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=Bi(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=Ca(this.grammar);if(!e)throw Error(`Missing entry parser rule`);yield Object.assign(Object.assign({},o),{tokenOffset:c,tokenEndOffset:l,features:uo(e.definition)})}}performNextTokenCompletion(e,t,n,r){return/\P{L}$/u.test(t)}findDataTypeRuleStart(e,t){let n=Ii(e,t,this.grammarConfig.nameRegexp),r=!!Xi(n?.grammarSource,W)?.dataType;if(r){for(;r;)n=n?.container,r=!!Xi(n?.grammarSource,W)?.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(ei(t.feature))return this.completionForKeyword(e,t.feature,n);if(Jr(t.feature)&&e.node)return this.completionForCrossReference(e,t,n)}completionForCrossReference(e,t,n){let r=Xi(t.feature,Wr),i=e.node;if(r&&i){t.type&&(i={$type:t.type,$container:i,$containerProperty:t.property},oa(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 J.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}}}},Co;(()=>{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||={}),Co=r})();const{URI:Y,Utils:wo}=Co;var X;(function(e){e.basename=wo.basename,e.dirname=wo.dirname,e.extname=wo.extname,e.joinPath=wo.joinPath,e.resolvePath=wo.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`?Y.parse(e).path:e.path,i=typeof n==`string`?Y.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 Y.parse(e.toString()).toString()}e.normalize=i})(X||={});var To=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=Ii(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[J.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=Qi(t.astNode);if(t&&n)return{source:e,target:t,targetDocument:n}}}};function Eo(e){let t=[],n=e.Grammar;for(let e of n.rules)Mr(e)&&ka(e)&&ga(Qa(e))&&t.push(e.name);return{multilineCommentRules:t,nameRegexp:Fi}}kt();var Do=class{constructor(){this.nodeStack=[]}get current(){return this.nodeStack[this.nodeStack.length-1]??this.rootNode}buildRootNode(e){return this.rootNode=new Mo(e),this.rootNode.root=this.rootNode,this.nodeStack=[this.rootNode],this.rootNode}buildCompositeNode(e){let t=new Ao;return t.grammarSource=e,t.root=this.rootNode,this.current.content.push(t),this.nodeStack.push(t),t}buildLeafNode(e,t){let n=new ko(e.startOffset,e.image.length,Ai(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 ko(n.startOffset,n.image.length,Ai(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)}},Oo=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)}},ko=class extends Oo{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}},Ao=class extends Oo{constructor(){super(...arguments),this.content=new jo(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:F.create(0,0),end:F.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]}},jo=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}},Mo=class extends Ao{get text(){return this._text.substring(this.offset,this.end)}get fullText(){return this._text}constructor(e){super(),this._text=``,this._text=e??``}};const No=Symbol(`Datatype`);function Po(e){return e.$type===No}const Fo=e=>e.endsWith(`​`)?e:e+`​`;var Io=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 Ho(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()}},Lo=class extends Io{get current(){return this.stack[this.stack.length-1]}constructor(e){super(e),this.nodeBuilder=new Do,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(Fo(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 Ua(e)?No:qa(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===No&&(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=ei(n)?r.image:this.converter.convert(r.image,t);this.assign(i.operator,i.feature,e,t,a)}else if(Po(o)){let e=r.image;ei(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(Po(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 Yi(e),this.nodeBuilder.construct(e),this.stack.pop(),Po(e)?this.converter.convert(e.value,e.$cstNode):(oa(this.astReflection,e),e)}getAssignment(e){if(!this.assignmentMap.has(e)){let t=Xi(e,Wr);this.assignmentMap.set(e,{assignment:t,isCrossRef:t?Jr(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}},Ro=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)}},zo=class extends Ro{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}\`.`}},Bo=class extends Io{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(Fo(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 Vo={recoveryEnabled:!0,nodeLocationTracking:`full`,skipValidations:!0,errorMessageProvider:new zo};var Ho=class extends p{constructor(e,t){let n=t&&`maxLookahead`in t;super(e,Object.assign(Object.assign(Object.assign({},Vo),{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 Uo(e,t,n){return Wo({parser:t,tokens:n,ruleNames:new Map},e),t}function Wo(e,t){let n=Ta(t,!1),r=q(t.rules).filter(W).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,Go(n,t.definition))}}function Go(e,t,n=!1){let r;if(ei(t))r=ts(e,t);else if(Br(t))r=Ko(e,t);else if(Wr(t))r=Go(e,t.terminal);else if(Jr(t))r=es(e,t);else if(oi(t))r=qo(e,t);else if(Hr(t))r=Xo(e,t);else if(mi(t))r=Zo(e,t);else if(Qr(t))r=Qo(e,t);else if(Xr(t)){let n=e.consume++;r=()=>e.parser.consume(n,m,t)}else throw new la(t.$cstNode,`Unexpected element type: ${t.$type}`);return ns(e,n?void 0:$o(t),r,t.cardinality)}function Ko(e,t){let n=Ja(t);return()=>e.parser.action(n,t)}function qo(e,t){let n=t.rule.ref;if(W(n)){let r=e.subrule++,i=n.fragment,a=t.arguments.length>0?Jo(n,t.arguments):()=>({});return o=>e.parser.subrule(r,rs(e,n),i,t,a(o))}else if(Mr(n)){let r=e.consume++,i=as(e,n.name);return()=>e.parser.consume(r,i,t)}else if(n)ua(n);else throw new la(t.$cstNode,`Undefined rule: ${t.rule.$refText}`)}function Jo(e,t){let n=t.map(e=>Yo(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 Yo(e){if(rr(e)){let t=Yo(e.left),n=Yo(e.right);return e=>t(e)||n(e)}else if(tr(e)){let t=Yo(e.left),n=Yo(e.right);return e=>t(e)&&n(e)}else if(hr(e)){let t=Yo(e.value);return e=>!t(e)}else if(xr(e)){let t=e.parameter.ref.name;return e=>e!==void 0&&e[t]===!0}else if($n(e)){let t=!!e.true;return()=>t}ua(e)}function Xo(e,t){if(t.elements.length===1)return Go(e,t.elements[0]);{let n=[];for(let r of t.elements){let t={ALT:Go(e,r,!0)},i=$o(r);i&&(t.GATE=Yo(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 Zo(e,t){if(t.elements.length===1)return Go(e,t.elements[0]);let n=[];for(let r of t.elements){let t={ALT:Go(e,r,!0)},i=$o(r);i&&(t.GATE=Yo(i)),n.push(t)}let r=e.or++,i=(e,t)=>`uGroup_${e}_${t.getRuleStack().join(`-`)}`,a=ns(e,$o(t),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})),`*`);return t=>{a(t),e.parser.isRecording()||e.parser.unorderedGroups.delete(i(r,e.parser))}}function Qo(e,t){let n=t.elements.map(t=>Go(e,t));return e=>n.forEach(t=>t(e))}function $o(e){if(Qr(e))return e.guardCondition}function es(e,t,n=t.terminal){if(!n){if(!t.type.ref)throw Error(`Could not resolve reference to type: `+t.type.$refText);let n=La(t.type.ref)?.terminal;if(!n)throw Error(`Could not find name assignment for type: `+Ja(t.type.ref));return es(e,t,n)}else if(oi(n)&&W(n.rule.ref)){let r=n.rule.ref,i=e.subrule++;return n=>e.parser.subrule(i,rs(e,r),!1,t,n)}else if(oi(n)&&Mr(n.rule.ref)){let r=e.consume++,i=as(e,n.rule.ref.name);return()=>e.parser.consume(r,i,t)}else if(ei(n)){let r=e.consume++,i=as(e,n.value);return()=>e.parser.consume(r,i,t)}else throw Error(`Could not build cross reference parser`)}function ts(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 ns(e,t,n,r){let i=t&&Yo(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 ua(r)}function rs(e,t){let n=is(e,t),r=e.parser.getRule(n);if(!r)throw Error(`Rule "${n}" not found."`);return r}function is(e,t){if(W(t))return t.name;if(e.ruleNames.has(t))return e.ruleNames.get(t);{let n=t,r=n.$container,i=t.$type;for(;!W(r);)(Qr(r)||Hr(r)||mi(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 as(e,t){let n=e.tokens[t];if(!n)throw Error(`Token "${t}" not found."`);return n}function os(e){let t=e.Grammar,n=e.parser.Lexer,r=new Bo(e);return Uo(t,r,n.definition),r.finalize(),r}function ss(e){let t=cs(e);return t.finalize(),t}function cs(e){let t=e.Grammar,n=e.parser.Lexer;return Uo(t,new Lo(e),n.definition)}var ls=class{constructor(){this.diagnostics=[]}buildTokens(e,t){let n=q(Ta(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(Mr).filter(e=>!e.fragment).map(e=>this.buildTerminalToken(e)).toArray()}buildTerminalToken(e){let t=Qa(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=va(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(W).flatMap(e=>ta(e).filter(ei)).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(ya(e.value),`i`):e.value}findLongerAlt(e,t){return t.reduce((t,n)=>{let r=n?.PATTERN;return r?.source&&ba(`^`+r.source+`$`,e.value)&&t.push(n),t},[])}},us=class{convert(e,t){let n=t.grammarSource;if(Jr(n)&&(n=Oa(n)),oi(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 ds.convertInt(t);case`STRING`:return ds.convertString(t);case`ID`:return ds.convertID(t)}switch(Za(e)?.toLowerCase()){case`number`:return ds.convertNumber(t);case`boolean`:return ds.convertBoolean(t);case`bigint`:return ds.convertBigint(t);case`date`:return ds.convertDate(t);default:return t}}},ds;(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`
20
- `;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})(ds||={});var Z=i({});t(Z,a(E(),1));function fs(){return new Promise(e=>{typeof setImmediate>`u`?setTimeout(e,0):setImmediate(e)})}let ps=0,ms=10;function hs(){return ps=performance.now(),new Z.CancellationTokenSource}function gs(e){ms=e}const _s=Symbol(`OperationCancelled`);function vs(e){return e===_s}async function Q(e){if(e===Z.CancellationToken.None)return;let t=performance.now();if(t-ps>=ms&&(ps=t,await fs(),ps=performance.now()),e.isCancellationRequested)throw _s}var ys=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>(e(t),this),this.reject=e=>(t(e),this)})}},bs=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=ws(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=Cs(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=Cs(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}},xs;(function(e){function t(e,t,n,r){return new bs(e,t,n,r)}e.create=t;function n(e,t,n){if(e instanceof bs)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=Ss(t.map(Ts),(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})(xs||={});function Ss(e,t){if(e.length<=1)return e;let n=e.length/2|0,r=e.slice(0,n),i=e.slice(n);Ss(r,t),Ss(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 Cs(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 ws(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 Ts(e){let t=ws(e.range);return t===e.range?e:{newText:e.newText,range:t}}var $;(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`})($||={});var Es=class{constructor(e){this.serviceRegistry=e.ServiceRegistry,this.textDocuments=e.workspace.TextDocuments,this.fileSystemProvider=e.workspace.FileSystemProvider}async fromUri(e,t=Z.CancellationToken.None){let n=await this.fileSystemProvider.readFile(e);return this.createAsync(e,n,t)}fromTextDocument(e,t,n){return t??=Y.parse(e.uri),Z.CancellationToken.is(n)?this.createAsync(t,e,n):this.create(t,e,n)}fromString(e,t,n){return Z.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:$.Parsed,references:[],textDocument:n};else{let n=this.createTextDocumentGetter(t,r);i={parseResult:e,uri:t,state:$.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=$.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??=xs.create(e.toString(),n.getServices(e).LanguageMetaData.languageId,0,t??``)}},Ds=class{constructor(e){this.documentMap=new Map,this.langiumDocumentFactory=e.workspace.LangiumDocumentFactory,this.serviceRegistry=e.ServiceRegistry}get all(){return q(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=$.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=$.Changed,this.documentMap.delete(t)),n}};const Os=Symbol(`ref_resolving`);var ks=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=Z.CancellationToken.None){for(let n of na(e.parseResult.value))await Q(t),ia(n).forEach(t=>this.doLink(t,e))}doLink(e,t){let n=e.reference;if(n._ref===void 0){n._ref=Os;try{let t=this.getCandidate(e);Dn(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(U(this._ref))return this._ref;if(En(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=Os;let n=$i(e).$document,r=i.getLinkedNode({reference:a,container:e,property:t});if(r.error&&n&&n.state<$.ComputedScopes){this._ref=void 0;return}this._ref=r.node??r.error,this._nodeDescription=r.descr,n?.references.push(this)}else if(this._ref===Os)throw Error(`Cyclic reference resolution detected: ${i.astNodeLocator.getAstNodePath(e)}/${t} (symbol '${r}')`);return U(this._ref)?this._ref:void 0},get $nodeDescription(){return this._nodeDescription},get error(){return Dn(this._ref)?this._ref:void 0}};return a}getLinkedNode(e){try{let t=this.getCandidate(e);if(Dn(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=$i(e.container).$document;n&&n.state<$.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 As(e){return typeof e.name==`string`}var js=class{getName(e){if(As(e))return e.name}getNameNode(e){return ja(e.$cstNode,`name`)}},Ms=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=Ia(e),n=e.astNode;if(t&&n){let r=n[t.feature];if(Tn(r))return r.ref;if(Array.isArray(r)){for(let t of r)if(Tn(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||ki(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=>X.equals(e.sourceUri,t.documentUri))),n.push(...r),q(n)}getReferenceToSelf(e){let t=this.nameProvider.getNameNode(e);if(t){let n=Qi(e),r=this.nodeLocator.getAstNodePath(e);return{sourceUri:n.uri,sourcePath:r,targetUri:n.uri,targetPath:r,segment:ji(t),local:!0}}}},Ns=class{constructor(e){if(this.map=new Map,e)for(let[t,n]of e)this.add(t,n)}get size(){return Ti.sum(q(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 q(this.map.entries()).flatMap(([e,t])=>t.map(t=>[e,t]))}keys(){return q(this.map.keys())}values(){return q(this.map.values()).flat()}entriesGroupedByKey(){return q(this.map.entries())}},Ps=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)}},Fs=class{constructor(e){this.nameProvider=e.references.NameProvider,this.descriptions=e.workspace.AstNodeDescriptionProvider}async computeExports(e,t=Z.CancellationToken.None){return this.computeExportsForNode(e.parseResult.value,e,void 0,t)}async computeExportsForNode(e,t,n=ea,r=Z.CancellationToken.None){let i=[];this.exportNode(e,i,t);for(let a of n(e))await Q(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=Z.CancellationToken.None){let n=e.parseResult.value,r=new Ns;for(let i of ta(n))await Q(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))}}},Is=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)}},Ls=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=q(this.elements.values());return this.outerScope&&(e=e.concat(this.outerScope.getAllElements())),e}};const Rs={getElement(){},getAllElements(){return Ci}};var zs=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`)}},Bs=class extends zs{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()}},Vs=class extends zs{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}},Hs=class extends Vs{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)}))}},Us=class extends Bs{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()}))}},Ws=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 Us(e.shared)}getScope(e){let t=[],n=this.reflection.getReferenceType(e),r=Qi(e.container).precomputedScopes;if(r){let i=e.container;do{let e=r.get(i);e.length>0&&t.push(q(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 Is(q(e),t,n)}createScopeForNodes(e,t,n){return new Is(q(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 Ls(this.indexManager.allElements(e)))}};function Gs(e){return typeof e.$comment==`string`}function Ks(e){return typeof e==`object`&&!!e&&(`$ref`in e||`$error`in e)}var qs=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=Qi(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(Tn(t)){let e=t.ref,r=n?t.$refText:void 0;if(e){let n=Qi(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(U(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=Aa(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];Ks(o)?i[a]=this.reviveReference(e,r,t,o,n):U(o)&&this.linkNode(o,t,n,e,r,a)}else Ks(i)?e[r]=this.reviveReference(e,r,t,i,n):U(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(U(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):Y.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)):Y.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)}}},Js=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=X.extname(e),r=X.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())}},Ys;(function(e){e.merge=(e,t)=>nc(nc({},e),t)})(Ys||={});function Xs(e,t,n,r,i,a,o,s,c){return $s([e,t,n,r,i,a,o,s,c].reduce(nc,{}))}const Zs=Symbol(`isProxy`);function Qs(e){if(e&&e[Zs])for(let t of Object.values(e))Qs(t);return e}function $s(e,t){let n=new Proxy({},{deleteProperty:()=>!1,set:()=>{throw Error(`Cannot set property on injected service container`)},get:(r,i)=>i===Zs?!0:tc(r,i,e,t||n),getOwnPropertyDescriptor:(r,i)=>(tc(r,i,e,t||n),Object.getOwnPropertyDescriptor(r,i)),has:(t,n)=>n in e,ownKeys:()=>[...Object.getOwnPropertyNames(e)]});return n}const ec=Symbol();function tc(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]===ec)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]=ec;try{e[t]=typeof i==`function`?i(r):$s(i,r)}catch(n){throw e[t]=n instanceof Error?n:void 0,n}return e[t]}else return}function nc(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]=nc(t,r):e[n]=r}}return e}var rc=class{constructor(e){this.grammarConfig=()=>e.parser.GrammarConfig}getComment(e){return Gs(e)?e.$comment:Li(e.$cstNode,this.grammarConfig().multilineCommentRules)?.text}};kt();function ic(e,t,n){let r,i;typeof e==`string`?(i=t,r=n):(i=e.range.start,r=t),i||=F.create(0,0);let a=oc(e),o=Sc(r);return hc({index:0,tokens:lc({lines:a,position:i,options:o}),position:i})}function ac(e,t){let n=Sc(t),r=oc(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 oc(e){let t=``;return t=typeof e==`string`?e:e.text,t.split(fa)}const sc=/\s*(@([\p{L}][\p{L}\p{N}]*)?)/uy,cc=/\{(@[\p{L}][\p{L}\p{N}]*)(\s*)([^\r\n}]+)?\}/gu;function lc(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,mc(s)),pc(s,c)>=s.length){if(t.length>0){let e=F.create(n,r);t.push({type:`break`,content:``,range:I.create(e,e)})}}else{sc.lastIndex=c;let e=sc.exec(s);if(e){let i=e[0],a=e[1],o=F.create(n,r+c),l=F.create(n,r+c+i.length);t.push({type:`tag`,content:a,range:I.create(o,l)}),c+=i.length,c=pc(s,c)}if(c<s.length){let e=s.substring(c),i=Array.from(e.matchAll(cc));t.push(...uc(i,e,n,r+c))}}n++,r=0}return t.length>0&&t[t.length-1].type===`break`?t.slice(0,-1):t}function uc(e,t,n,r){let i=[];if(e.length===0){let e=F.create(n,r),a=F.create(n,r+t.length);i.push({type:`text`,content:t,range:I.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:I.create(F.create(n,a+r),F.create(n,e+r))});let c=s.length+1,l=o[1];if(i.push({type:`inline-tag`,content:l,range:I.create(F.create(n,a+c+r),F.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:I.create(F.create(n,a+c+r),F.create(n,a+c+e.length+r))})}else i.push({type:`text`,content:``,range:I.create(F.create(n,a+c+r),F.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:I.create(F.create(n,a+r),F.create(n,a+r+o.length))})}return i}const dc=/\S/,fc=/\s*$/;function pc(e,t){let n=e.substring(t).match(dc);return n?t+n.index:e.length}function mc(e){let t=e.match(fc);if(t&&typeof t.index==`number`)return t.index}function hc(e){let t=F.create(e.position.line,e.position.character);if(e.tokens.length===0)return new wc([],I.create(t,t));let n=[];for(;e.index<e.tokens.length;){let t=gc(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 wc(n,I.create(r,i))}function gc(e,t){let n=e.tokens[e.index];if(n.type===`tag`)return bc(e,!1);if(n.type===`text`||n.type===`inline-tag`)return vc(e);_c(n,t),e.index++}function _c(e,t){if(t){let n=new kc(``,e.range);`inlines`in t?t.inlines.push(n):t.content.inlines.push(n)}}function vc(e){let t=e.tokens[e.index],n=t,r=t,i=[];for(;t&&t.type!==`break`&&t.type!==`tag`;)i.push(yc(e)),r=t,t=e.tokens[e.index];return new Oc(i,I.create(n.range.start,r.range.end))}function yc(e){return e.tokens[e.index].type===`inline-tag`?bc(e,!0):xc(e)}function bc(e,t){let n=e.tokens[e.index++],r=n.content.substring(1);if(e.tokens[e.index]?.type===`text`)if(t){let i=xc(e);return new Tc(r,new Oc([i],i.range),t,I.create(n.range.start,i.range.end))}else{let i=vc(e);return new Tc(r,i,t,I.create(n.range.start,i.range.end))}else{let e=n.range;return new Tc(r,new Oc([],e),t,e)}}function xc(e){let t=e.tokens[e.index++];return new kc(t.content,t.range)}function Sc(e){if(!e)return Sc({start:`/**`,end:`*/`,line:`*`});let{start:t,end:n,line:r}=e;return{start:Cc(t,!0),end:Cc(n,!1),line:Cc(r,!0)}}function Cc(e,t){if(typeof e==`string`||typeof e==`object`){let n=typeof e==`string`?ya(e):e.source;return t?RegExp(`^\\s*${n}`):RegExp(`\\s*${n}\\s*$`)}else return e}var wc=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+=Ac(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+=Ac(t)+r}return t.trim()}},Tc=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=Ec(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 Ec(e,t,n){if(e===`linkplain`||e===`linkcode`||e===`link`){let r=t.indexOf(` `),i=t;if(r>0){let e=pc(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)??Dc(t,i)}}function Dc(e,t){try{return Y.parse(e,!0),`[${t}](${e})`}catch{return e}}var Oc=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+=`
21
- `)}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+=`
22
- `)}return t}},kc=class{constructor(e,t){this.text=e,this.range=t}toString(){return this.text}toMarkdown(){return this.text}};function Ac(e){return e.endsWith(`
23
- `)?`
24
- `:`
25
-
26
- `}var jc=class{constructor(e){this.indexManager=e.shared.workspace.IndexManager,this.commentProvider=e.documentation.CommentProvider}getDocumentation(e){let t=this.commentProvider.getComment(e);if(t&&ac(t))return ic(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=Qi(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)}},Mc=i({});t(Mc,a(T(),1));var Nc=class{constructor(e){this.syncParser=e.parser.LangiumParser}parse(e,t){return Promise.resolve(this.syncParser.parse(e))}},Pc=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 ys,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 ys;return e.onCancellationRequested(()=>{let e=this.queue.indexOf(t);e>=0&&this.queue.splice(e,1),t.reject(_s)}),this.queue.push(t),t.promise}},Fc=class{get ready(){return this._ready}get onReady(){return this.onReadyEmitter.event}constructor(e,t,n,r){this.onReadyEmitter=new Mc.Emitter,this.deferred=new ys,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(_s),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 ys,this.sendMessage(e),this.deferred.promise}},Ic=class{buildUnexpectedCharactersMessage(e,t,n,r,i){return f.buildUnexpectedCharactersMessage(e,t,n,r,i)}buildUnableToPopLexerModeMessage(e){return f.buildUnableToPopLexerModeMessage(e)}};const Lc={mode:`full`};var Rc=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(Vc(t)?Object.values(t):t,{positionTracking:`full`,skipValidations:e.LanguageMetaData.mode===`production`,errorMessageProvider:this.errorMessageProvider})}get definition(){return this.tokenTypes}tokenize(e,t=Lc){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(Vc(e))return e;let t=Bc(e)?Object.values(e.modes).flat():e,n={};return t.forEach(e=>n[e.name]=e),n}};function zc(e){return Array.isArray(e)&&(e.length===0||`name`in e[0])}function Bc(e){return e&&`modes`in e&&`defaultMode`in e}function Vc(e){return!zc(e)&&!Bc(e)}const Hc={indentTokenName:`INDENT`,dedentTokenName:`DEDENT`,whitespaceTokenName:`WS`,ignoreIndentationDelimiters:[]};var Uc;(function(e){e.REGULAR=`indentation-sensitive`,e.IGNORE_INDENTATION=`ignore-indentation`})(Uc||={});var Wc=class extends ls{constructor(e=Hc){super(),this.indentationStack=[0],this.whitespaceRegExp=/[ \t]+/y,this.options=Object.assign(Object.assign({},Hc),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(!zc(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=Uc.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:{[Uc.REGULAR]:[s,c,...u,l],[Uc.IGNORE_INDENTATION]:[...u,l]},defaultMode:Uc.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
27
- `.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}},Gc=class extends Rc{constructor(e){if(super(e),e.parser.TokenBuilder instanceof Wc)this.indentationTokenBuilder=e.parser.TokenBuilder;else throw Error(`IndentationAwareLexer requires an accompanying IndentationAwareTokenBuilder`)}tokenize(e,t=Lc){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}},Kc=class{constructor(e){this.grammarElementIdMap=new Ps,this.tokenTypeIdMap=new Ps,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 na(e))t.set(n,{});if(e.$cstNode)for(let t of Di(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)U(n)?e.push(this.dehydrateAstNode(n,t)):Tn(n)?e.push(this.dehydrateReference(n,t)):e.push(n)}else U(i)?n[r]=this.dehydrateAstNode(i,t):Tn(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 jn(e)?n.fullText=e.fullText:n.grammarSource=this.getGrammarElementId(e.grammarSource),n.hidden=e.hidden,n.astNode=t.astNodes.get(e.astNode),kn(e)?n.content=e.content.map(e=>this.dehydrateCstNode(e,t)):An(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 na(e))t.set(n,{});let r;if(e.$cstNode)for(let t of Di(e.$cstNode)){let e;`fullText`in t?(e=new Mo(t.fullText),r=e):`content`in t?e=new Ao:`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)U(a)?e.push(this.setParent(this.hydrateAstNode(a,t),n)):Tn(a)?e.push(this.hydrateReference(a,n,r,t)):e.push(a)}else U(i)?n[r]=this.setParent(this.hydrateAstNode(i,t),n):Tn(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),kn(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 ko(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 na(this.grammar))qn(t)&&this.grammarElementIdMap.set(t,e++)}},qc;(function(e){function t(e){return{dispose:async()=>await e()}}e.create=t})(qc||={});var Jc=class{readFile(){throw Error(`No file system is available.`)}async readDirectory(){return[]}};const Yc={fileSystemProvider:()=>new Jc},Xc={Grammar:()=>void 0,LanguageMetaData:()=>({caseInsensitive:!1,fileExtensions:[`.langium`],languageId:`langium`})},Zc={AstReflection:()=>new yi};function Qc(){let e=Xs(vl(Yc),Zc),t=Xs(_l({shared:e}),Xc);return e.ServiceRegistry.register(t),t}function $c(e){let t=Qc(),n=t.serializer.JsonSerializer.deserialize(e);return t.shared.workspace.LangiumDocumentFactory.fromModel(n,Y.parse(`memory://${n.name??`grammar`}.langium`)),n}var el=i({AstUtils:()=>Ji,BiMap:()=>Ps,Cancellation:()=>Z,ContextCache:()=>Vs,CstUtils:()=>Ei,DONE_RESULT:()=>K,Deferred:()=>ys,Disposable:()=>qc,DisposableCache:()=>zs,DocumentCache:()=>Hs,EMPTY_STREAM:()=>Ci,ErrorWithLocation:()=>la,GrammarUtils:()=>Sa,MultiMap:()=>Ns,OperationCancelled:()=>_s,Reduction:()=>Ti,RegExpUtils:()=>da,SimpleCache:()=>Bs,StreamImpl:()=>bi,TreeStreamImpl:()=>wi,URI:()=>Y,UriUtils:()=>X,WorkspaceCache:()=>Us,assertUnreachable:()=>ua,delayNextTick:()=>fs,interruptAndCheck:()=>Q,isOperationCancelled:()=>vs,loadGrammarFromJson:()=>$c,setInterruptionPeriod:()=>gs,startCancelableOperation:()=>hs,stream:()=>q});t(el,Mc);var tl=class{constructor(e){this.astNodeLocator=e.workspace.AstNodeLocator,this.nameProvider=e.references.NameProvider}createDescription(e,t,n){let r=n??Qi(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??=ji(this.nameProvider.getNameNode(e)??e.$cstNode);return{node:e,name:t,get nameSegment(){return o()},selectionSegment:ji(e.$cstNode),type:e.$type,documentUri:r.uri,path:i}}},nl=class{constructor(e){this.nodeLocator=e.workspace.AstNodeLocator}async createDescriptions(e,t=Z.CancellationToken.None){let n=[],r=e.parseResult.value;for(let e of na(r))await Q(t),ia(e).filter(e=>!Dn(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=Qi(e.container).uri;return{sourceUri:r,sourcePath:this.nodeLocator.getAstNodePath(e.container),targetUri:t.documentUri,targetPath:t.path,segment:ji(n),local:X.equals(t.documentUri,r)}}},rl=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)}},il=class{constructor(e){this._ready=new ys,this.settings={},this.workspaceConfig=!1,this.onConfigurationSectionUpdateEmitter=new Mc.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}},al=class{constructor(e){this.updateBuildOptions={validation:{categories:[`built-in`,`fast`]}},this.updateListeners=[],this.buildPhaseListeners=new Ns,this.documentPhaseListeners=new Ns,this.buildState=new Map,this.documentBuildWaiters=new Map,this.currentState=$.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=Z.CancellationToken.None){for(let n of e){let e=n.uri.toString();if(n.state===$.Validated){if(typeof t.validation==`boolean`&&t.validation)n.state=$.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??ul.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=$.IndexedReferences)}}}else this.buildState.delete(e)}this.currentState=$.Changed,await this.emitUpdate(e.map(e=>e.uri),[]),await this.buildDocuments(e,t,n)}async update(e,t,n=Z.CancellationToken.None){this.currentState=$.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=$.Changed,this.langiumDocuments.addDocument(e)}this.buildState.delete(t.toString())}let r=q(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,$.ComputedScopes),e.diagnostics=void 0}),await this.emitUpdate(e,t),await Q(n);let i=this.sortDocuments(this.langiumDocuments.all.filter(e=>e.state<$.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),qc.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,$.Parsed,n,e=>this.langiumDocumentFactory.update(e,n)),await this.runCancelable(e,$.IndexedContent,n,e=>this.indexManager.updateContent(e,n)),await this.runCancelable(e,$.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,$.Linked,n,e=>this.serviceRegistry.getServices(e.uri).references.Linker.link(e,n)),await this.runCancelable(r,$.IndexedReferences,n,e=>this.indexManager.updateReferences(e,n));let i=e.filter(e=>this.shouldValidate(e));await this.runCancelable(i,$.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 Q(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),qc.create(()=>{this.buildPhaseListeners.delete(e,t)})}onDocumentPhase(e,t){return this.documentPhaseListeners.add(e,t),qc.create(()=>{this.documentPhaseListeners.delete(e,t)})}waitUntil(e,t,n){let r;if(t&&`path`in t?r=t:n=t,n??=Z.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(_s):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(_s)})})}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(!vs(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 Q(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??ul.all;o.result.validationChecks?o.result.validationChecks.push(...e):o.result.validationChecks=[...e]}}getBuildOptions(e){return this.buildState.get(e.uri.toString())?.options??{}}},ol=class{constructor(e){this.symbolIndex=new Map,this.symbolByTypeIndex=new Vs,this.referenceIndex=new Map,this.documents=e.workspace.LangiumDocuments,this.serviceRegistry=e.ServiceRegistry,this.astReflection=e.AstReflection}findAllReferences(e,t){let n=Qi(e).uri,r=[];return this.referenceIndex.forEach(e=>{e.forEach(e=>{X.equals(e.targetUri,n)&&e.targetPath===t&&r.push(e)})}),q(r)}allElements(e,t){let n=q(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=Z.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=Z.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}},sl=class{constructor(){this.previousTokenSource=new Z.CancellationTokenSource,this.writeQueue=[],this.readQueue=[],this.done=!0}write(e){this.cancelWrite();let t=hs();return this.previousTokenSource=t,this.enqueue(this.writeQueue,e,t.token)}read(e){return this.enqueue(this.readQueue,e)}enqueue(e,t,n=Z.CancellationToken.None){let r=new ys,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){vs(e)?t.resolve(void 0):t.reject(e)}})),this.done=!0,this.performNextOperation()}cancelWrite(){this.previousTokenSource.cancel()}},cl=class{constructor(e){this.initialBuildOptions={},this._ready=new ys,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=Z.CancellationToken.None){let n=await this.performStartup(e);await Q(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 Y.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=X.basename(t.uri);return r.startsWith(`.`)?!1:t.isDirectory?r!==`node_modules`&&r!==`out`:t.isFile?n.fileExtensions.includes(X.extname(t.uri))||n.fileNames.includes(X.basename(t.uri)):!1}};t(i({AbstractAstReflection:()=>On,AbstractCstNode:()=>Oo,AbstractLangiumParser:()=>Io,AbstractParserErrorMessageProvider:()=>Ro,AbstractThreadedAsyncParser:()=>Pc,AstUtils:()=>Ji,BiMap:()=>Ps,Cancellation:()=>Z,CompositeCstNodeImpl:()=>Ao,ContextCache:()=>Vs,CstNodeBuilder:()=>Do,CstUtils:()=>Ei,DEFAULT_TOKENIZE_OPTIONS:()=>Lc,DONE_RESULT:()=>K,DatatypeSymbol:()=>No,DefaultAstNodeDescriptionProvider:()=>tl,DefaultAstNodeLocator:()=>rl,DefaultAsyncParser:()=>Nc,DefaultCommentProvider:()=>rc,DefaultConfigurationProvider:()=>il,DefaultDocumentBuilder:()=>al,DefaultDocumentValidator:()=>fl,DefaultHydrator:()=>Kc,DefaultIndexManager:()=>ol,DefaultJsonSerializer:()=>qs,DefaultLangiumDocumentFactory:()=>Es,DefaultLangiumDocuments:()=>Ds,DefaultLexer:()=>Rc,DefaultLexerErrorMessageProvider:()=>Ic,DefaultLinker:()=>ks,DefaultNameProvider:()=>js,DefaultReferenceDescriptionProvider:()=>nl,DefaultReferences:()=>Ms,DefaultScopeComputation:()=>Fs,DefaultScopeProvider:()=>Ws,DefaultServiceRegistry:()=>Js,DefaultTokenBuilder:()=>ls,DefaultValueConverter:()=>us,DefaultWorkspaceLock:()=>sl,DefaultWorkspaceManager:()=>cl,Deferred:()=>ys,Disposable:()=>qc,DisposableCache:()=>zs,DocumentCache:()=>Hs,DocumentState:()=>$,DocumentValidator:()=>gl,EMPTY_SCOPE:()=>Rs,EMPTY_STREAM:()=>Ci,EmptyFileSystem:()=>Yc,EmptyFileSystemProvider:()=>Jc,ErrorWithLocation:()=>la,GrammarAST:()=>Mn,GrammarUtils:()=>Sa,IndentationAwareLexer:()=>Gc,IndentationAwareTokenBuilder:()=>Wc,JSDocDocumentationProvider:()=>jc,LangiumCompletionParser:()=>Bo,LangiumParser:()=>Lo,LangiumParserErrorMessageProvider:()=>zo,LeafCstNodeImpl:()=>ko,LexingMode:()=>Uc,MapScope:()=>Ls,Module:()=>Ys,MultiMap:()=>Ns,OperationCancelled:()=>_s,ParserWorker:()=>Fc,Reduction:()=>Ti,RegExpUtils:()=>da,RootCstNodeImpl:()=>Mo,SimpleCache:()=>Bs,StreamImpl:()=>bi,StreamScope:()=>Is,TextDocument:()=>xs,TreeStreamImpl:()=>wi,URI:()=>Y,UriUtils:()=>X,ValidationCategory:()=>ul,ValidationRegistry:()=>dl,ValueConverter:()=>ds,WorkspaceCache:()=>Us,assertUnreachable:()=>ua,createCompletionParser:()=>os,createDefaultCoreModule:()=>_l,createDefaultSharedCoreModule:()=>vl,createGrammarConfig:()=>Eo,createLangiumParser:()=>ss,createParser:()=>Uo,delayNextTick:()=>fs,diagnosticData:()=>ll,eagerLoad:()=>Qs,getDiagnosticRange:()=>pl,indentationBuilderDefaultOptions:()=>Hc,inject:()=>Xs,interruptAndCheck:()=>Q,isAstNode:()=>U,isAstNodeDescription:()=>En,isAstNodeWithComment:()=>Gs,isCompositeCstNode:()=>kn,isIMultiModeLexerDefinition:()=>Bc,isJSDoc:()=>ac,isLeafCstNode:()=>An,isLinkingError:()=>Dn,isNamed:()=>As,isOperationCancelled:()=>vs,isReference:()=>Tn,isRootCstNode:()=>jn,isTokenTypeArray:()=>zc,isTokenTypeDictionary:()=>Vc,loadGrammarFromJson:()=>$c,parseJSDoc:()=>ic,prepareLangiumParser:()=>cs,setInterruptionPeriod:()=>gs,startCancelableOperation:()=>hs,stream:()=>q,toDiagnosticData:()=>hl,toDiagnosticSeverity:()=>ml}),el);function ll(e){return{code:e}}var ul;(function(e){e.all=[`fast`,`slow`,`built-in`]})(ul||={});var dl=class{constructor(e){this.entries=new Ns,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 ua(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(vs(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=q(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}},fl=class{constructor(e){this.validationRegistry=e.validation.ValidationRegistry,this.metadata=e.LanguageMetaData}async validateDocument(e,t={},n=Z.CancellationToken.None){let r=e.parseResult,i=[];if(await Q(n),(!t.categories||t.categories.includes(`built-in`))&&(this.processLexingErrors(r,i,t),t.stopAfterLexingErrors&&i.some(e=>e.data?.code===gl.LexingError)||(this.processParsingErrors(r,i,t),t.stopAfterParsingErrors&&i.some(e=>e.data?.code===gl.ParsingError))||(this.processLinkingErrors(e,i,t),t.stopAfterLinkingErrors&&i.some(e=>e.data?.code===gl.LinkingError))))return i;try{i.push(...await this.validateAst(r.value,t,n))}catch(e){if(vs(e))throw e;console.error(`An error occurred during validation:`,e)}return await Q(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:ml(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:hl(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=Ai(n.token);if(e){let r={severity:ml(`error`),range:e,message:n.message,data:ll(gl.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:gl.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=Z.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=Z.CancellationToken.None){let i=this.validationRegistry.checksBefore;for(let a of i)await Q(r),await a(e,n,t.categories??[],r)}async validateAstNodes(e,t,n,r=Z.CancellationToken.None){await Promise.all(na(e).map(async e=>{await Q(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=Z.CancellationToken.None){let i=this.validationRegistry.checksAfter;for(let a of i)await Q(r),await a(e,n,t.categories??[],r)}toDiagnostic(e,t,n){return{message:t,range:pl(n),severity:ml(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 pl(e){if(e.range)return e.range;let t;return typeof e.property==`string`?t=ja(e.node.$cstNode,e.property,e.index):typeof e.keyword==`string`&&(t=Pa(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 ml(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 hl(e){switch(e){case`error`:return ll(gl.LexingError);case`warning`:return ll(gl.LexingWarning);case`info`:return ll(gl.LexingInfo);case`hint`:return ll(gl.LexingHint);default:throw Error(`Invalid diagnostic severity: `+e)}}var gl;(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`})(gl||={});function _l(e){return{documentation:{CommentProvider:e=>new rc(e),DocumentationProvider:e=>new jc(e)},parser:{AsyncParser:e=>new Nc(e),GrammarConfig:e=>Eo(e),LangiumParser:e=>ss(e),CompletionParser:e=>os(e),ValueConverter:()=>new us,TokenBuilder:()=>new ls,Lexer:e=>new Rc(e),ParserErrorMessageProvider:()=>new zo,LexerErrorMessageProvider:()=>new Ic},workspace:{AstNodeLocator:()=>new rl,AstNodeDescriptionProvider:e=>new tl(e),ReferenceDescriptionProvider:e=>new nl(e)},references:{Linker:e=>new ks(e),NameProvider:()=>new js,ScopeProvider:e=>new Ws(e),ScopeComputation:e=>new Fs(e),References:e=>new Ms(e)},serializer:{Hydrator:e=>new Kc(e),JsonSerializer:e=>new qs(e)},validation:{DocumentValidator:e=>new fl(e),ValidationRegistry:e=>new dl(e)},shared:()=>e.shared}}function vl(e){return{ServiceRegistry:e=>new Js(e),workspace:{LangiumDocuments:e=>new Ds(e),LangiumDocumentFactory:e=>new Es(e),DocumentBuilder:e=>new al(e),IndexManager:e=>new ol(e),WorkspaceManager:e=>new cl(e),FileSystemProvider:t=>e.fileSystemProvider(t),WorkspaceLock:()=>new sl,ConfigurationProvider:e=>new il(e)}}}var yl=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=Ii(r,e.textDocument.offsetAt(t.position),this.grammarConfig.nameRegexp);if(!i)return;let a=this.references.findDeclaration(i);if(a){let t=X.equals(Qi(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 J.DocumentHighlight.create(e.segment.range)}},bl=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 ea(t)){let t=this.getSymbol(e,r);n.push(...t)}if(n.length>0)return n}},xl=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=q(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=q(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(J.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([Y.parse(e.document.uri)],[])}didChangeWatchedFiles(e){let t=q(e.changes).filter(e=>e.type!==J.FileChangeType.Deleted).distinct(e=>e.uri).map(e=>Y.parse(e.uri)).toArray(),n=q(e.changes).filter(e=>e.type===J.FileChangeType.Deleted).distinct(e=>e.uri).map(e=>Y.parse(e.uri)).toArray();this.fireDocumentUpdate(t,n)}},Sl=class{constructor(e){this.commentNames=e.parser.GrammarConfig.multilineCommentRules}getFoldingRanges(e,t,n){let r=[];return this.collectFolding(e,e=>r.push(e)),r}collectFolding(e,t){let n=e.parseResult?.value;if(n){if(this.shouldProcessContent(n)){let r=ta(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 Oi(r))if(this.commentNames.includes(t.tokenType.name)){let r=this.toFoldingRange(e,t,J.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)),J.FoldingRange.create(i.line,a.line,i.character,a.character,n)}includeLastFoldingLine(e,t){if(t===J.FoldingRangeKind.Comment)return!1;let n=e.text,r=n.charAt(n.length-1);return!(r===`}`||r===`)`||r===`]`)}},Cl=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 wl<=e&&e<=Tl&&El<=t&&t<=Dl||e===Ol&&t!==Ol}toUpperCharCode(e){return wl<=e&&e<=Tl?e-32:e}};const wl=97,Tl=122,El=65,Dl=90,Ol=95;var kl=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=Ii(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(ei(i.grammarSource))return this.getKeywordHoverContent(i.grammarSource)}}}getKeywordHoverContent(e){let t=Gs(e)?e.$comment:void 0;if(t||=Li(e.$cstNode,[`ML_COMMENT`])?.text,t&&ac(t)){let e=ic(t).toMarkdown();if(e)return{contents:{kind:`markdown`,value:e}}}}},Al=class extends kl{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 jl={[J.SemanticTokenTypes.class]:0,[J.SemanticTokenTypes.comment]:1,[J.SemanticTokenTypes.enum]:2,[J.SemanticTokenTypes.enumMember]:3,[J.SemanticTokenTypes.event]:4,[J.SemanticTokenTypes.function]:5,[J.SemanticTokenTypes.interface]:6,[J.SemanticTokenTypes.keyword]:7,[J.SemanticTokenTypes.macro]:8,[J.SemanticTokenTypes.method]:9,[J.SemanticTokenTypes.modifier]:10,[J.SemanticTokenTypes.namespace]:11,[J.SemanticTokenTypes.number]:12,[J.SemanticTokenTypes.operator]:13,[J.SemanticTokenTypes.parameter]:14,[J.SemanticTokenTypes.property]:15,[J.SemanticTokenTypes.regexp]:16,[J.SemanticTokenTypes.string]:17,[J.SemanticTokenTypes.struct]:18,[J.SemanticTokenTypes.type]:19,[J.SemanticTokenTypes.typeParameter]:20,[J.SemanticTokenTypes.variable]:21,[J.SemanticTokenTypes.decorator]:22},Ml={[J.SemanticTokenModifiers.abstract]:1,[J.SemanticTokenModifiers.async]:2,[J.SemanticTokenModifiers.declaration]:4,[J.SemanticTokenModifiers.defaultLibrary]:8,[J.SemanticTokenModifiers.definition]:16,[J.SemanticTokenModifiers.deprecated]:32,[J.SemanticTokenModifiers.documentation]:64,[J.SemanticTokenModifiers.modification]:128,[J.SemanticTokenModifiers.readonly]:256,[J.SemanticTokenModifiers.static]:512};function Nl(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 Pl=class extends J.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}},Fl=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 jl}get tokenModifiers(){return Ml}get semanticTokensOptions(){return{legend:{tokenTypes:Object.keys(this.tokenTypes),tokenModifiers:Object.keys(this.tokenModifiers)},full:{delta:!0},range:!0}}async semanticHighlight(e,t,n=Z.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=Z.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=Z.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(){return 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})}}getDocumentTokensBuilder(e){let t=this.tokensBuilders.get(e.uri.toString());if(t)return t;let n=new Pl;return this.tokensBuilders.set(e.uri.toString(),n),n}async computeHighlighting(e,t,n){let r=e.parseResult.value,i=na(r,{range:this.currentRange}).iterator(),a;do if(a=i.next(),!a.done){await Q(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&&!Pi(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=ja(e.node.$cstNode,e.property,e.index);n&&t.push(n)}else t.push(...Aa(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=Pa(t.$cstNode,n,i);e&&o.push(e)}else o.push(...Na(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})}},Il;(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}})(Il||={});function Ll(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 Rl=H(),zl=class{constructor(e){this.onInitializeEmitter=new Rl.Emitter,this.onInitializedEmitter=new Rl.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(){Qs(this.services),this.services.ServiceRegistry.all.forEach(e=>Qs(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=Nl(r.map(e=>e.lsp?.SemanticTokenProvider?.semanticTokensOptions)),l=this.services.lsp?.ExecuteCommandHandler?.commands,u=this.hasService(e=>e.lsp?.DocumentLinkProvider),d=Ll(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=xo(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),ee=this.hasService(e=>e.lsp?.CodeLensProvider),T=this.hasService(e=>e.lsp?.DeclarationProvider),E=this.hasService(e=>e.lsp?.InlayHintProvider),D=this.services.lsp?.WorkspaceSymbolProvider;return{capabilities:{workspace:{workspaceFolders:{supported:!0},fileOperations:n},executeCommandProvider:l&&{commands:l},textDocumentSync:{change:Rl.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:ee?{resolveProvider:!1}:void 0,declarationProvider:T,inlayHintProvider:E?{resolveProvider:!1}:void 0,workspaceSymbolProvider:D?{resolveProvider:!!D.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(Rl.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))}},Bl=class{getSymbolKind(e){return J.SymbolKind.Field}getCompletionItemKind(e){return J.CompletionItemKind.Reference}},Vl=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=Ii(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(J.Location.create(e.sourceUri.toString(),e.segment.range))})}return r}};kt();var Hl=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=Ii(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=L.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=Ii(n,r,this.grammarConfig.nameRegexp);if(!e)return;if(this.references.findDeclaration(e)||this.isNameNode(e))return e.range}}isNameNode(e){return e?.astNode&&As(e.astNode)&&e===this.nameProvider.getNameNode(e.astNode)}},Ul=class{constructor(e){this.indexManager=e.workspace.IndexManager,this.nodeKindProvider=e.lsp.NodeKindProvider,this.fuzzyMatcher=e.lsp.FuzzyMatcher}async getSymbols(e,t=Z.CancellationToken.None){let n=[],r=e.query.toLowerCase();for(let e of this.indexManager.allElements())if(await Q(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()}}}},Wl=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new J.Emitter,this._onDidOpen=new J.Emitter,this._onDidClose=new J.Emitter,this._onDidSave=new J.Emitter,this._onWillSave=new J.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(X.normalize(e))}set(e){let t=X.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=X.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=J.TextDocumentSyncKind.Incremental;let t=[];return t.push(e.onDidOpenTextDocument(e=>{let t=e.textDocument,n=X.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=X.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=X.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(X.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(X.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(X.normalize(e.textDocument.uri));t!==void 0&&this._onDidSave.fire(Object.freeze({document:t}))})),J.Disposable.create(()=>{t.forEach(e=>e.dispose())})}},Gl=class{constructor(e){this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new J.Emitter,this._onDidSave=new J.Emitter,this._onDidChange=new J.Emitter,this._onDidClose=new J.Emitter,`listen`in e?this._cellTextDocuments=e:this._cellTextDocuments=new Wl(e)}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(X.normalize(e))}getNotebookCell(e){let t=this.notebookCellMap.get(X.normalize(e));return t&&t[0]}findNotebookDocumentForCell(e){let t=typeof e==`string`||`scheme`in e?e:e.document,n=this.notebookCellMap.get(X.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 Kl,n=[];return n.push(this.cellTextDocuments.listen(t)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(e=>{let n=X.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=X.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=X.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)}})),J.Disposable.create(()=>{n.forEach(e=>e.dispose())})}updateCellMap(e){for(let t of e.cells)this.notebookCellMap.set(t.document,[t,e])}},Kl=class e{onDidOpenTextDocument(e){return this.openHandler=e,J.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,J.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,J.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}};Kl.NULL_DISPOSE=Object.freeze({dispose:()=>{}});function ql(e){return Ys.merge(_l(e),Jl(e))}function Jl(e){return{lsp:{CompletionProvider:e=>new So(e),DocumentSymbolProvider:e=>new bl(e),HoverProvider:e=>new Al(e),FoldingRangeProvider:e=>new Sl(e),ReferencesProvider:e=>new Vl(e),DefinitionProvider:e=>new To(e),DocumentHighlightProvider:e=>new yl(e),RenameProvider:e=>new Hl(e)},shared:()=>e.shared}}function Yl(e){return Ys.merge(vl(e),Xl(e))}function Xl(e){return{lsp:{Connection:()=>e.connection,LanguageServer:e=>new zl(e),DocumentUpdateHandler:e=>new xl(e),WorkspaceSymbolProvider:e=>new Ul(e),NodeKindProvider:()=>new Bl,FuzzyMatcher:()=>new Cl},workspace:{TextDocuments:()=>new Wl(xs),NotebookDocuments:e=>new Gl(e.workspace.TextDocuments)}}}var Zl=class{constructor(){this.collector=()=>{}}getNodeFormatter(e){return new Ql(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;this.collector=(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.iterateAstFormatting(e,n);let i=this.iterateCstFormatting(e,r,t,n);return this.avoidOverlappingEdits(e.textDocument,i)}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=ta(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=An(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=Ui(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)),An(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 wi(n,e=>this.iterateCst(e,t)):Ci}iterateCst(e,t){if(!kn(e))return Ci;let n=t.indentation;return new bi(()=>({index:0}),r=>r.index<e.content.length?{done:!1,value:e.content[r.index++]}:(t.indentation=n,K))}},Ql=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new $l(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new $l(t,this.collector)}property(e,t){let n=ja(this.astNode.$cstNode,e,t);return new $l(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let e=Aa(this.astNode.$cstNode,n);t.push(...e)}return new $l(t,this.collector)}keyword(e,t){let n=Pa(this.astNode.$cstNode,e,t);return new $l(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let e=Na(this.astNode.$cstNode,n);t.push(...e)}return new $l(t,this.collector)}cst(e){return new $l([...e],this.collector)}interior(e,t){let n=e.nodes,r=t.nodes;if(n.length!==1||r.length!==1)return new $l([],this.collector);let i=n[0],a=r[0];if(i.offset>a.offset){let e=i;i=a,a=e}return new $l(Gi(i,a),this.collector)}},$l=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)}},eu;(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}})(eu||={});var tu=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:X.joinPath(e,t.name)}))}};export{oi as $,$ as A,ja as B,Ls as C,js as D,Ns as E,ds as F,Qi as G,Sa as H,X as I,Li as J,Zi as K,Y as L,Q as M,vs as N,As as O,us as P,ei as Q,So as R,Rs as S,Fs as T,Ji as U,Aa as V,Xi as W,q as X,Ci as Y,Jr as Z,Xs as _,Yl as a,ge as at,Bs as b,kl as c,I as ct,cl as d,Xe as dt,On as et,ol as f,L as ft,jc as g,qc as h,ql as i,Ie as it,xs as j,Ds as k,yl as l,ut as lt,$c as m,k as mt,Zl as n,wn as nt,Ul as o,Le as ot,tl as p,kt as pt,ta as q,eu as r,H as rt,Fl as s,F as st,tu as t,U as tt,fl as u,lt as ut,Ws as v,Is as w,Us as x,Vs as y,Pa as z};