@gsc-basic/components 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/es/_virtual/_plugin-vue_export-helper.js +9 -0
  2. package/dist/es/index.js +35 -0
  3. package/dist/es/node_modules/@codemirror/autocomplete/dist/index.js +1371 -0
  4. package/dist/es/node_modules/@codemirror/commands/dist/index.js +838 -0
  5. package/dist/es/node_modules/@codemirror/lang-java/dist/index.js +38 -0
  6. package/dist/es/node_modules/@codemirror/lang-javascript/dist/index.js +300 -0
  7. package/dist/es/node_modules/@codemirror/lang-json/dist/index.js +48 -0
  8. package/dist/es/node_modules/@codemirror/lang-python/dist/index.js +399 -0
  9. package/dist/es/node_modules/@codemirror/lang-sql/dist/index.js +497 -0
  10. package/dist/es/node_modules/@codemirror/lang-xml/dist/index.js +216 -0
  11. package/dist/es/node_modules/@codemirror/lang-yaml/dist/index.js +51 -0
  12. package/dist/es/node_modules/@codemirror/language/dist/index.js +1299 -0
  13. package/dist/es/node_modules/@codemirror/lint/dist/index.js +649 -0
  14. package/dist/es/node_modules/@codemirror/search/dist/index.js +872 -0
  15. package/dist/es/node_modules/@codemirror/state/dist/index.js +2639 -0
  16. package/dist/es/node_modules/@codemirror/theme-one-dark/dist/index.js +132 -0
  17. package/dist/es/node_modules/@codemirror/view/dist/index.js +7280 -0
  18. package/dist/es/node_modules/@lezer/common/dist/index.js +1430 -0
  19. package/dist/es/node_modules/@lezer/highlight/dist/index.js +637 -0
  20. package/dist/es/node_modules/@lezer/java/dist/index.js +62 -0
  21. package/dist/es/node_modules/@lezer/javascript/dist/index.js +161 -0
  22. package/dist/es/node_modules/@lezer/json/dist/index.js +34 -0
  23. package/dist/es/node_modules/@lezer/lr/dist/index.js +1307 -0
  24. package/dist/es/node_modules/@lezer/python/dist/index.js +221 -0
  25. package/dist/es/node_modules/@lezer/xml/dist/index.js +100 -0
  26. package/dist/es/node_modules/@lezer/yaml/dist/index.js +274 -0
  27. package/dist/es/node_modules/@marijn/find-cluster-break/src/index.js +69 -0
  28. package/dist/es/node_modules/@vueuse/core/dist/index.js +125 -0
  29. package/dist/es/node_modules/@vueuse/shared/dist/index.js +55 -0
  30. package/dist/es/node_modules/codemirror/dist/index.js +40 -0
  31. package/dist/es/node_modules/crelt/index.js +27 -0
  32. package/dist/es/node_modules/lodash-es/_Hash.js +20 -0
  33. package/dist/es/node_modules/lodash-es/_ListCache.js +20 -0
  34. package/dist/es/node_modules/lodash-es/_Map.js +6 -0
  35. package/dist/es/node_modules/lodash-es/_MapCache.js +20 -0
  36. package/dist/es/node_modules/lodash-es/_Symbol.js +5 -0
  37. package/dist/es/node_modules/lodash-es/_arrayMap.js +8 -0
  38. package/dist/es/node_modules/lodash-es/_assocIndexOf.js +10 -0
  39. package/dist/es/node_modules/lodash-es/_baseGet.js +11 -0
  40. package/dist/es/node_modules/lodash-es/_baseGetTag.js +10 -0
  41. package/dist/es/node_modules/lodash-es/_baseIsNative.js +16 -0
  42. package/dist/es/node_modules/lodash-es/_baseToString.js +18 -0
  43. package/dist/es/node_modules/lodash-es/_castPath.js +10 -0
  44. package/dist/es/node_modules/lodash-es/_coreJsData.js +5 -0
  45. package/dist/es/node_modules/lodash-es/_freeGlobal.js +4 -0
  46. package/dist/es/node_modules/lodash-es/_getMapData.js +8 -0
  47. package/dist/es/node_modules/lodash-es/_getNative.js +9 -0
  48. package/dist/es/node_modules/lodash-es/_getRawTag.js +15 -0
  49. package/dist/es/node_modules/lodash-es/_getValue.js +6 -0
  50. package/dist/es/node_modules/lodash-es/_hashClear.js +7 -0
  51. package/dist/es/node_modules/lodash-es/_hashDelete.js +7 -0
  52. package/dist/es/node_modules/lodash-es/_hashGet.js +13 -0
  53. package/dist/es/node_modules/lodash-es/_hashHas.js +9 -0
  54. package/dist/es/node_modules/lodash-es/_hashSet.js +9 -0
  55. package/dist/es/node_modules/lodash-es/_isKey.js +12 -0
  56. package/dist/es/node_modules/lodash-es/_isKeyable.js +7 -0
  57. package/dist/es/node_modules/lodash-es/_isMasked.js +11 -0
  58. package/dist/es/node_modules/lodash-es/_listCacheClear.js +6 -0
  59. package/dist/es/node_modules/lodash-es/_listCacheDelete.js +12 -0
  60. package/dist/es/node_modules/lodash-es/_listCacheGet.js +8 -0
  61. package/dist/es/node_modules/lodash-es/_listCacheHas.js +7 -0
  62. package/dist/es/node_modules/lodash-es/_listCacheSet.js +8 -0
  63. package/dist/es/node_modules/lodash-es/_mapCacheClear.js +13 -0
  64. package/dist/es/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  65. package/dist/es/node_modules/lodash-es/_mapCacheGet.js +7 -0
  66. package/dist/es/node_modules/lodash-es/_mapCacheHas.js +7 -0
  67. package/dist/es/node_modules/lodash-es/_mapCacheSet.js +8 -0
  68. package/dist/es/node_modules/lodash-es/_memoizeCapped.js +11 -0
  69. package/dist/es/node_modules/lodash-es/_nativeCreate.js +5 -0
  70. package/dist/es/node_modules/lodash-es/_objectToString.js +7 -0
  71. package/dist/es/node_modules/lodash-es/_root.js +5 -0
  72. package/dist/es/node_modules/lodash-es/_stringToPath.js +10 -0
  73. package/dist/es/node_modules/lodash-es/_toKey.js +10 -0
  74. package/dist/es/node_modules/lodash-es/_toSource.js +17 -0
  75. package/dist/es/node_modules/lodash-es/eq.js +6 -0
  76. package/dist/es/node_modules/lodash-es/get.js +8 -0
  77. package/dist/es/node_modules/lodash-es/isArray.js +4 -0
  78. package/dist/es/node_modules/lodash-es/isFunction.js +12 -0
  79. package/dist/es/node_modules/lodash-es/isNil.js +6 -0
  80. package/dist/es/node_modules/lodash-es/isObject.js +7 -0
  81. package/dist/es/node_modules/lodash-es/isObjectLike.js +6 -0
  82. package/dist/es/node_modules/lodash-es/isString.js +10 -0
  83. package/dist/es/node_modules/lodash-es/isSymbol.js +9 -0
  84. package/dist/es/node_modules/lodash-es/memoize.js +18 -0
  85. package/dist/es/node_modules/lodash-es/toString.js +7 -0
  86. package/dist/es/node_modules/style-mod/src/style-mod.js +109 -0
  87. package/dist/es/node_modules/vue-codemirror/dist/vue-codemirror.esm.js +132 -0
  88. package/dist/es/node_modules/w3c-keyname/index.js +93 -0
  89. package/dist/es/src/CodeEditor/index.js +6 -0
  90. package/dist/es/src/CodeEditor/src/index.css +1 -0
  91. package/dist/es/src/CodeEditor/src/index.vue.js +128 -0
  92. package/dist/es/src/CodeEditor/src/index2.css +1 -0
  93. package/dist/es/src/ConfigProvider/index.js +7 -0
  94. package/dist/es/src/ConfigProvider/src/configProvider.js +14 -0
  95. package/dist/es/src/ConfigProvider/src/configProviderProps.js +22 -0
  96. package/dist/es/src/ConfigProvider/src/constants.js +9 -0
  97. package/dist/es/src/ConfigProvider/src/useGlobalConfig.js +45 -0
  98. package/dist/es/src/ScaleScreen/index.js +6 -0
  99. package/dist/es/src/ScaleScreen/src/index.css +1 -0
  100. package/dist/es/src/ScaleScreen/src/index.vue.js +115 -0
  101. package/dist/es/src/ScaleScreen/src/index2.css +1 -0
  102. package/dist/es/src/VideoBackground/index.js +6 -0
  103. package/dist/es/src/VideoBackground/src/helper.js +29 -0
  104. package/dist/es/src/VideoBackground/src/index.css +1 -0
  105. package/dist/es/src/VideoBackground/src/index.vue.js +108 -0
  106. package/dist/es/src/VideoBackground/src/index2.css +1 -0
  107. package/dist/es/src/VideoBackground/src/index3.css +1 -0
  108. package/dist/es/src/VideoBackground/src/videoBackground.js +31 -0
  109. package/dist/es/src/hooks/useLocale.js +24 -0
  110. package/dist/es/src/hooks/useNamespace.js +8 -0
  111. package/dist/es/src/index.js +28 -0
  112. package/dist/es/src/locale/lang/en-US.js +32 -0
  113. package/dist/es/src/locale/lang/ja-JP.js +32 -0
  114. package/dist/es/src/locale/lang/zh-CN.js +32 -0
  115. package/dist/es/src/styles/tokens.css +1 -0
  116. package/dist/lib/_virtual/_plugin-vue_export-helper.js +1 -0
  117. package/dist/lib/index.js +1 -0
  118. package/dist/lib/node_modules/@codemirror/autocomplete/dist/index.js +1 -0
  119. package/dist/lib/node_modules/@codemirror/commands/dist/index.js +1 -0
  120. package/dist/lib/node_modules/@codemirror/lang-java/dist/index.js +1 -0
  121. package/dist/lib/node_modules/@codemirror/lang-javascript/dist/index.js +13 -0
  122. package/dist/lib/node_modules/@codemirror/lang-json/dist/index.js +1 -0
  123. package/dist/lib/node_modules/@codemirror/lang-python/dist/index.js +3 -0
  124. package/dist/lib/node_modules/@codemirror/lang-sql/dist/index.js +2 -0
  125. package/dist/lib/node_modules/@codemirror/lang-xml/dist/index.js +1 -0
  126. package/dist/lib/node_modules/@codemirror/lang-yaml/dist/index.js +1 -0
  127. package/dist/lib/node_modules/@codemirror/language/dist/index.js +1 -0
  128. package/dist/lib/node_modules/@codemirror/lint/dist/index.js +1 -0
  129. package/dist/lib/node_modules/@codemirror/search/dist/index.js +2 -0
  130. package/dist/lib/node_modules/@codemirror/state/dist/index.js +5 -0
  131. package/dist/lib/node_modules/@codemirror/theme-one-dark/dist/index.js +1 -0
  132. package/dist/lib/node_modules/@codemirror/view/dist/index.js +5 -0
  133. package/dist/lib/node_modules/@lezer/common/dist/index.js +1 -0
  134. package/dist/lib/node_modules/@lezer/highlight/dist/index.js +1 -0
  135. package/dist/lib/node_modules/@lezer/java/dist/index.js +1 -0
  136. package/dist/lib/node_modules/@lezer/javascript/dist/index.js +1 -0
  137. package/dist/lib/node_modules/@lezer/json/dist/index.js +1 -0
  138. package/dist/lib/node_modules/@lezer/lr/dist/index.js +1 -0
  139. package/dist/lib/node_modules/@lezer/python/dist/index.js +1 -0
  140. package/dist/lib/node_modules/@lezer/xml/dist/index.js +1 -0
  141. package/dist/lib/node_modules/@lezer/yaml/dist/index.js +1 -0
  142. package/dist/lib/node_modules/@marijn/find-cluster-break/src/index.js +1 -0
  143. package/dist/lib/node_modules/@vueuse/core/dist/index.js +1 -0
  144. package/dist/lib/node_modules/@vueuse/shared/dist/index.js +1 -0
  145. package/dist/lib/node_modules/codemirror/dist/index.js +1 -0
  146. package/dist/lib/node_modules/crelt/index.js +1 -0
  147. package/dist/lib/node_modules/lodash-es/_Hash.js +1 -0
  148. package/dist/lib/node_modules/lodash-es/_ListCache.js +1 -0
  149. package/dist/lib/node_modules/lodash-es/_Map.js +1 -0
  150. package/dist/lib/node_modules/lodash-es/_MapCache.js +1 -0
  151. package/dist/lib/node_modules/lodash-es/_Symbol.js +1 -0
  152. package/dist/lib/node_modules/lodash-es/_arrayMap.js +1 -0
  153. package/dist/lib/node_modules/lodash-es/_assocIndexOf.js +1 -0
  154. package/dist/lib/node_modules/lodash-es/_baseGet.js +1 -0
  155. package/dist/lib/node_modules/lodash-es/_baseGetTag.js +1 -0
  156. package/dist/lib/node_modules/lodash-es/_baseIsNative.js +1 -0
  157. package/dist/lib/node_modules/lodash-es/_baseToString.js +1 -0
  158. package/dist/lib/node_modules/lodash-es/_castPath.js +1 -0
  159. package/dist/lib/node_modules/lodash-es/_coreJsData.js +1 -0
  160. package/dist/lib/node_modules/lodash-es/_freeGlobal.js +1 -0
  161. package/dist/lib/node_modules/lodash-es/_getMapData.js +1 -0
  162. package/dist/lib/node_modules/lodash-es/_getNative.js +1 -0
  163. package/dist/lib/node_modules/lodash-es/_getRawTag.js +1 -0
  164. package/dist/lib/node_modules/lodash-es/_getValue.js +1 -0
  165. package/dist/lib/node_modules/lodash-es/_hashClear.js +1 -0
  166. package/dist/lib/node_modules/lodash-es/_hashDelete.js +1 -0
  167. package/dist/lib/node_modules/lodash-es/_hashGet.js +1 -0
  168. package/dist/lib/node_modules/lodash-es/_hashHas.js +1 -0
  169. package/dist/lib/node_modules/lodash-es/_hashSet.js +1 -0
  170. package/dist/lib/node_modules/lodash-es/_isKey.js +1 -0
  171. package/dist/lib/node_modules/lodash-es/_isKeyable.js +1 -0
  172. package/dist/lib/node_modules/lodash-es/_isMasked.js +1 -0
  173. package/dist/lib/node_modules/lodash-es/_listCacheClear.js +1 -0
  174. package/dist/lib/node_modules/lodash-es/_listCacheDelete.js +1 -0
  175. package/dist/lib/node_modules/lodash-es/_listCacheGet.js +1 -0
  176. package/dist/lib/node_modules/lodash-es/_listCacheHas.js +1 -0
  177. package/dist/lib/node_modules/lodash-es/_listCacheSet.js +1 -0
  178. package/dist/lib/node_modules/lodash-es/_mapCacheClear.js +1 -0
  179. package/dist/lib/node_modules/lodash-es/_mapCacheDelete.js +1 -0
  180. package/dist/lib/node_modules/lodash-es/_mapCacheGet.js +1 -0
  181. package/dist/lib/node_modules/lodash-es/_mapCacheHas.js +1 -0
  182. package/dist/lib/node_modules/lodash-es/_mapCacheSet.js +1 -0
  183. package/dist/lib/node_modules/lodash-es/_memoizeCapped.js +1 -0
  184. package/dist/lib/node_modules/lodash-es/_nativeCreate.js +1 -0
  185. package/dist/lib/node_modules/lodash-es/_objectToString.js +1 -0
  186. package/dist/lib/node_modules/lodash-es/_root.js +1 -0
  187. package/dist/lib/node_modules/lodash-es/_stringToPath.js +1 -0
  188. package/dist/lib/node_modules/lodash-es/_toKey.js +1 -0
  189. package/dist/lib/node_modules/lodash-es/_toSource.js +1 -0
  190. package/dist/lib/node_modules/lodash-es/eq.js +1 -0
  191. package/dist/lib/node_modules/lodash-es/get.js +1 -0
  192. package/dist/lib/node_modules/lodash-es/isArray.js +1 -0
  193. package/dist/lib/node_modules/lodash-es/isFunction.js +1 -0
  194. package/dist/lib/node_modules/lodash-es/isNil.js +1 -0
  195. package/dist/lib/node_modules/lodash-es/isObject.js +1 -0
  196. package/dist/lib/node_modules/lodash-es/isObjectLike.js +1 -0
  197. package/dist/lib/node_modules/lodash-es/isString.js +1 -0
  198. package/dist/lib/node_modules/lodash-es/isSymbol.js +1 -0
  199. package/dist/lib/node_modules/lodash-es/memoize.js +1 -0
  200. package/dist/lib/node_modules/lodash-es/toString.js +1 -0
  201. package/dist/lib/node_modules/style-mod/src/style-mod.js +3 -0
  202. package/dist/lib/node_modules/vue-codemirror/dist/vue-codemirror.esm.js +1 -0
  203. package/dist/lib/node_modules/w3c-keyname/index.js +1 -0
  204. package/dist/lib/src/CodeEditor/index.js +1 -0
  205. package/dist/lib/src/CodeEditor/src/index.css +1 -0
  206. package/dist/lib/src/CodeEditor/src/index.vue.js +1 -0
  207. package/dist/lib/src/CodeEditor/src/index2.css +1 -0
  208. package/dist/lib/src/ConfigProvider/index.js +1 -0
  209. package/dist/lib/src/ConfigProvider/src/configProvider.js +1 -0
  210. package/dist/lib/src/ConfigProvider/src/configProviderProps.js +1 -0
  211. package/dist/lib/src/ConfigProvider/src/constants.js +1 -0
  212. package/dist/lib/src/ConfigProvider/src/useGlobalConfig.js +1 -0
  213. package/dist/lib/src/ScaleScreen/index.js +1 -0
  214. package/dist/lib/src/ScaleScreen/src/index.css +1 -0
  215. package/dist/lib/src/ScaleScreen/src/index.vue.js +1 -0
  216. package/dist/lib/src/ScaleScreen/src/index2.css +1 -0
  217. package/dist/lib/src/VideoBackground/index.js +1 -0
  218. package/dist/lib/src/VideoBackground/src/helper.js +1 -0
  219. package/dist/lib/src/VideoBackground/src/index.css +1 -0
  220. package/dist/lib/src/VideoBackground/src/index.vue.js +1 -0
  221. package/dist/lib/src/VideoBackground/src/index2.css +1 -0
  222. package/dist/lib/src/VideoBackground/src/index3.css +1 -0
  223. package/dist/lib/src/VideoBackground/src/videoBackground.js +1 -0
  224. package/dist/lib/src/hooks/useLocale.js +1 -0
  225. package/dist/lib/src/hooks/useNamespace.js +1 -0
  226. package/dist/lib/src/index.js +1 -0
  227. package/dist/lib/src/locale/lang/en-US.js +1 -0
  228. package/dist/lib/src/locale/lang/ja-JP.js +1 -0
  229. package/dist/lib/src/locale/lang/zh-CN.js +1 -0
  230. package/dist/lib/src/styles/tokens.css +1 -0
  231. package/package.json +71 -0
@@ -0,0 +1,1371 @@
1
+ import { Annotation as Re, Transaction as Me, Text as Le, StateEffect as O, StateField as _, Prec as ee, Facet as ye, EditorSelection as w, codePointAt as v, codePointSize as T, RangeSet as ke, combineConfig as Be, MapMode as G, fromCodePoint as be, RangeValue as Fe, CharCategory as J } from "../../state/dist/index.js";
2
+ import { EditorView as M, ViewPlugin as $e, Decoration as V, keymap as xe, getTooltip as we, showTooltip as Ne, logException as Z, WidgetType as Ue, Direction as We } from "../../view/dist/index.js";
3
+ import { syntaxTree as q, indentUnit as je } from "../../language/dist/index.js";
4
+ class Ce {
5
+ /**
6
+ Create a new completion context. (Mostly useful for testing
7
+ completion sources—in the editor, the extension will create
8
+ these for you.)
9
+ */
10
+ constructor(e, t, n, o) {
11
+ this.state = e, this.pos = t, this.explicit = n, this.view = o, this.abortListeners = [], this.abortOnDocChange = !1;
12
+ }
13
+ /**
14
+ Get the extent, content, and (if there is a token) type of the
15
+ token before `this.pos`.
16
+ */
17
+ tokenBefore(e) {
18
+ let t = q(this.state).resolveInner(this.pos, -1);
19
+ for (; t && e.indexOf(t.name) < 0; )
20
+ t = t.parent;
21
+ return t ? {
22
+ from: t.from,
23
+ to: this.pos,
24
+ text: this.state.sliceDoc(t.from, this.pos),
25
+ type: t.type
26
+ } : null;
27
+ }
28
+ /**
29
+ Get the match of the given expression directly before the
30
+ cursor.
31
+ */
32
+ matchBefore(e) {
33
+ let t = this.state.doc.lineAt(this.pos), n = Math.max(t.from, this.pos - 250), o = t.text.slice(n - t.from, this.pos - t.from), s = o.search(ve(e, !1));
34
+ return s < 0 ? null : { from: n + s, to: this.pos, text: o.slice(s) };
35
+ }
36
+ /**
37
+ Yields true when the query has been aborted. Can be useful in
38
+ asynchronous queries to avoid doing work that will be ignored.
39
+ */
40
+ get aborted() {
41
+ return this.abortListeners == null;
42
+ }
43
+ /**
44
+ Allows you to register abort handlers, which will be called when
45
+ the query is
46
+ [aborted](https://codemirror.net/6/docs/ref/#autocomplete.CompletionContext.aborted).
47
+
48
+ By default, running queries will not be aborted for regular
49
+ typing or backspacing, on the assumption that they are likely to
50
+ return a result with a
51
+ [`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor) field that
52
+ allows the result to be used after all. Passing `onDocChange:
53
+ true` will cause this query to be aborted for any document
54
+ change.
55
+ */
56
+ addEventListener(e, t, n) {
57
+ e == "abort" && this.abortListeners && (this.abortListeners.push(t), n && n.onDocChange && (this.abortOnDocChange = !0));
58
+ }
59
+ }
60
+ function ae(i) {
61
+ let e = Object.keys(i).join(""), t = /\w/.test(e);
62
+ return t && (e = e.replace(/\w/g, "")), `[${t ? "\\w" : ""}${e.replace(/[^\w\s]/g, "\\$&")}]`;
63
+ }
64
+ function He(i) {
65
+ let e = /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
66
+ for (let { label: o } of i) {
67
+ e[o[0]] = !0;
68
+ for (let s = 1; s < o.length; s++)
69
+ t[o[s]] = !0;
70
+ }
71
+ let n = ae(e) + ae(t) + "*$";
72
+ return [new RegExp("^" + n), new RegExp(n)];
73
+ }
74
+ function Ve(i) {
75
+ let e = i.map((o) => typeof o == "string" ? { label: o } : o), [t, n] = e.every((o) => /^\w+$/.test(o.label)) ? [/\w*$/, /\w+$/] : He(e);
76
+ return (o) => {
77
+ let s = o.matchBefore(n);
78
+ return s || o.explicit ? { from: s ? s.from : o.pos, options: e, validFor: t } : null;
79
+ };
80
+ }
81
+ function Ut(i, e) {
82
+ return (t) => {
83
+ for (let n = q(t.state).resolveInner(t.pos, -1); n; n = n.parent) {
84
+ if (i.indexOf(n.name) > -1)
85
+ return null;
86
+ if (n.type.isTop)
87
+ break;
88
+ }
89
+ return e(t);
90
+ };
91
+ }
92
+ class ce {
93
+ constructor(e, t, n, o) {
94
+ this.completion = e, this.source = t, this.match = n, this.score = o;
95
+ }
96
+ }
97
+ function E(i) {
98
+ return i.selection.main.from;
99
+ }
100
+ function ve(i, e) {
101
+ var t;
102
+ let { source: n } = i, o = e && n[0] != "^", s = n[n.length - 1] != "$";
103
+ return !o && !s ? i : new RegExp(`${o ? "^" : ""}(?:${n})${s ? "$" : ""}`, (t = i.flags) !== null && t !== void 0 ? t : i.ignoreCase ? "i" : "");
104
+ }
105
+ const te = /* @__PURE__ */ Re.define();
106
+ function qe(i, e, t, n) {
107
+ let { main: o } = i.selection, s = t - o.from, l = n - o.from;
108
+ return {
109
+ ...i.changeByRange((a) => {
110
+ if (a != o && t != n && i.sliceDoc(a.from + s, a.from + l) != i.sliceDoc(t, n))
111
+ return { range: a };
112
+ let r = i.toText(e);
113
+ return {
114
+ changes: { from: a.from + s, to: n == o.from ? a.to : a.from + l, insert: r },
115
+ range: w.cursor(a.from + s + r.length)
116
+ };
117
+ }),
118
+ scrollIntoView: !0,
119
+ userEvent: "input.complete"
120
+ };
121
+ }
122
+ const fe = /* @__PURE__ */ new WeakMap();
123
+ function ze(i) {
124
+ if (!Array.isArray(i))
125
+ return i;
126
+ let e = fe.get(i);
127
+ return e || fe.set(i, e = Ve(i)), e;
128
+ }
129
+ const j = /* @__PURE__ */ O.define(), B = /* @__PURE__ */ O.define();
130
+ class Ke {
131
+ constructor(e) {
132
+ this.pattern = e, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = [];
133
+ for (let t = 0; t < e.length; ) {
134
+ let n = v(e, t), o = T(n);
135
+ this.chars.push(n);
136
+ let s = e.slice(t, t + o), l = s.toUpperCase();
137
+ this.folded.push(v(l == s ? s.toLowerCase() : l, 0)), t += o;
138
+ }
139
+ this.astral = e.length != this.chars.length;
140
+ }
141
+ ret(e, t) {
142
+ return this.score = e, this.matched = t, this;
143
+ }
144
+ // Matches a given word (completion) against the pattern (input).
145
+ // Will return a boolean indicating whether there was a match and,
146
+ // on success, set `this.score` to the score, `this.matched` to an
147
+ // array of `from, to` pairs indicating the matched parts of `word`.
148
+ //
149
+ // The score is a number that is more negative the worse the match
150
+ // is. See `Penalty` above.
151
+ match(e) {
152
+ if (this.pattern.length == 0)
153
+ return this.ret(-100, []);
154
+ if (e.length < this.pattern.length)
155
+ return null;
156
+ let { chars: t, folded: n, any: o, precise: s, byWord: l } = this;
157
+ if (t.length == 1) {
158
+ let d = v(e, 0), D = T(d), S = D == e.length ? 0 : -100;
159
+ if (d != t[0]) if (d == n[0])
160
+ S += -200;
161
+ else
162
+ return null;
163
+ return this.ret(S, [0, D]);
164
+ }
165
+ let a = e.indexOf(this.pattern);
166
+ if (a == 0)
167
+ return this.ret(e.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]);
168
+ let r = t.length, h = 0;
169
+ if (a < 0) {
170
+ for (let d = 0, D = Math.min(e.length, 200); d < D && h < r; ) {
171
+ let S = v(e, d);
172
+ (S == t[h] || S == n[h]) && (o[h++] = d), d += T(S);
173
+ }
174
+ if (h < r)
175
+ return null;
176
+ }
177
+ let c = 0, f = 0, p = !1, u = 0, m = -1, y = -1, k = /[a-z]/.test(e), I = !0;
178
+ for (let d = 0, D = Math.min(e.length, 200), S = 0; d < D && f < r; ) {
179
+ let b = v(e, d);
180
+ a < 0 && (c < r && b == t[c] && (s[c++] = d), u < r && (b == t[u] || b == n[u] ? (u == 0 && (m = d), y = d + 1, u++) : u = 0));
181
+ let U, K = b < 255 ? b >= 48 && b <= 57 || b >= 97 && b <= 122 ? 2 : b >= 65 && b <= 90 ? 1 : 0 : (U = be(b)) != U.toLowerCase() ? 1 : U != U.toUpperCase() ? 2 : 0;
182
+ (!d || K == 1 && k || S == 0 && K != 0) && (t[f] == b || n[f] == b && (p = !0) ? l[f++] = d : l.length && (I = !1)), S = K, d += T(b);
183
+ }
184
+ return f == r && l[0] == 0 && I ? this.result(-100 + (p ? -200 : 0), l, e) : u == r && m == 0 ? this.ret(-200 - e.length + (y == e.length ? 0 : -100), [0, y]) : a > -1 ? this.ret(-700 - e.length, [a, a + this.pattern.length]) : u == r ? this.ret(-900 - e.length, [m, y]) : f == r ? this.result(-100 + (p ? -200 : 0) + -700 + (I ? 0 : -1100), l, e) : t.length == 2 ? null : this.result((o[0] ? -700 : 0) + -200 + -1100, o, e);
185
+ }
186
+ result(e, t, n) {
187
+ let o = [], s = 0;
188
+ for (let l of t) {
189
+ let a = l + (this.astral ? T(v(n, l)) : 1);
190
+ s && o[s - 1] == l ? o[s - 1] = a : (o[s++] = l, o[s++] = a);
191
+ }
192
+ return this.ret(e - n.length, o);
193
+ }
194
+ }
195
+ class Qe {
196
+ constructor(e) {
197
+ this.pattern = e, this.matched = [], this.score = 0, this.folded = e.toLowerCase();
198
+ }
199
+ match(e) {
200
+ if (e.length < this.pattern.length)
201
+ return null;
202
+ let t = e.slice(0, this.pattern.length), n = t == this.pattern ? 0 : t.toLowerCase() == this.folded ? -200 : null;
203
+ return n == null ? null : (this.matched = [0, t.length], this.score = n + (e.length == this.pattern.length ? 0 : -100), this);
204
+ }
205
+ }
206
+ const g = /* @__PURE__ */ ye.define({
207
+ combine(i) {
208
+ return Be(i, {
209
+ activateOnTyping: !0,
210
+ activateOnCompletion: () => !1,
211
+ activateOnTypingDelay: 100,
212
+ selectOnOpen: !0,
213
+ override: null,
214
+ closeOnBlur: !0,
215
+ maxRenderedOptions: 100,
216
+ defaultKeymap: !0,
217
+ tooltipClass: () => "",
218
+ optionClass: () => "",
219
+ aboveCursor: !1,
220
+ icons: !0,
221
+ addToOptions: [],
222
+ positionInfo: Xe,
223
+ filterStrict: !1,
224
+ compareCompletions: (e, t) => (e.sortText || e.label).localeCompare(t.sortText || t.label),
225
+ interactionDelay: 75,
226
+ updateSyncTime: 100
227
+ }, {
228
+ defaultKeymap: (e, t) => e && t,
229
+ closeOnBlur: (e, t) => e && t,
230
+ icons: (e, t) => e && t,
231
+ tooltipClass: (e, t) => (n) => he(e(n), t(n)),
232
+ optionClass: (e, t) => (n) => he(e(n), t(n)),
233
+ addToOptions: (e, t) => e.concat(t),
234
+ filterStrict: (e, t) => e || t
235
+ });
236
+ }
237
+ });
238
+ function he(i, e) {
239
+ return i ? e ? i + " " + e : i : e;
240
+ }
241
+ function Xe(i, e, t, n, o, s) {
242
+ let l = i.textDirection == We.RTL, a = l, r = !1, h = "top", c, f, p = e.left - o.left, u = o.right - e.right, m = n.right - n.left, y = n.bottom - n.top;
243
+ if (a && p < Math.min(m, u) ? a = !1 : !a && u < Math.min(m, p) && (a = !0), m <= (a ? p : u))
244
+ c = Math.max(o.top, Math.min(t.top, o.bottom - y)) - e.top, f = Math.min(400, a ? p : u);
245
+ else {
246
+ r = !0, f = Math.min(
247
+ 400,
248
+ (l ? e.right : o.right - e.left) - 30
249
+ /* Info.Margin */
250
+ );
251
+ let d = o.bottom - e.bottom;
252
+ d >= y || d > e.top ? c = t.bottom - e.top : (h = "bottom", c = e.bottom - t.top);
253
+ }
254
+ let k = (e.bottom - e.top) / s.offsetHeight, I = (e.right - e.left) / s.offsetWidth;
255
+ return {
256
+ style: `${h}: ${c / k}px; max-width: ${f / I}px`,
257
+ class: "cm-completionInfo-" + (r ? l ? "left-narrow" : "right-narrow" : a ? "left" : "right")
258
+ };
259
+ }
260
+ function Ye(i) {
261
+ let e = i.addToOptions.slice();
262
+ return i.icons && e.push({
263
+ render(t) {
264
+ let n = document.createElement("div");
265
+ return n.classList.add("cm-completionIcon"), t.type && n.classList.add(...t.type.split(/\s+/g).map((o) => "cm-completionIcon-" + o)), n.setAttribute("aria-hidden", "true"), n;
266
+ },
267
+ position: 20
268
+ }), e.push({
269
+ render(t, n, o, s) {
270
+ let l = document.createElement("span");
271
+ l.className = "cm-completionLabel";
272
+ let a = t.displayLabel || t.label, r = 0;
273
+ for (let h = 0; h < s.length; ) {
274
+ let c = s[h++], f = s[h++];
275
+ c > r && l.appendChild(document.createTextNode(a.slice(r, c)));
276
+ let p = l.appendChild(document.createElement("span"));
277
+ p.appendChild(document.createTextNode(a.slice(c, f))), p.className = "cm-completionMatchedText", r = f;
278
+ }
279
+ return r < a.length && l.appendChild(document.createTextNode(a.slice(r))), l;
280
+ },
281
+ position: 50
282
+ }, {
283
+ render(t) {
284
+ if (!t.detail)
285
+ return null;
286
+ let n = document.createElement("span");
287
+ return n.className = "cm-completionDetail", n.textContent = t.detail, n;
288
+ },
289
+ position: 80
290
+ }), e.sort((t, n) => t.position - n.position).map((t) => t.render);
291
+ }
292
+ function Q(i, e, t) {
293
+ if (i <= t)
294
+ return { from: 0, to: i };
295
+ if (e < 0 && (e = 0), e <= i >> 1) {
296
+ let o = Math.floor(e / t);
297
+ return { from: o * t, to: (o + 1) * t };
298
+ }
299
+ let n = Math.floor((i - e) / t);
300
+ return { from: i - (n + 1) * t, to: i - n * t };
301
+ }
302
+ class Ge {
303
+ constructor(e, t, n) {
304
+ this.view = e, this.stateField = t, this.applyCompletion = n, this.info = null, this.infoDestroy = null, this.placeInfoReq = {
305
+ read: () => this.measureInfo(),
306
+ write: (r) => this.placeInfo(r),
307
+ key: this
308
+ }, this.space = null, this.currentClass = "";
309
+ let o = e.state.field(t), { options: s, selected: l } = o.open, a = e.state.facet(g);
310
+ this.optionContent = Ye(a), this.optionClass = a.optionClass, this.tooltipClass = a.tooltipClass, this.range = Q(s.length, l, a.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(e.state), this.dom.addEventListener("mousedown", (r) => {
311
+ let { options: h } = e.state.field(t).open;
312
+ for (let c = r.target, f; c && c != this.dom; c = c.parentNode)
313
+ if (c.nodeName == "LI" && (f = /-(\d+)$/.exec(c.id)) && +f[1] < h.length) {
314
+ this.applyCompletion(e, h[+f[1]]), r.preventDefault();
315
+ return;
316
+ }
317
+ }), this.dom.addEventListener("focusout", (r) => {
318
+ let h = e.state.field(this.stateField, !1);
319
+ h && h.tooltip && e.state.facet(g).closeOnBlur && r.relatedTarget != e.contentDOM && e.dispatch({ effects: B.of(null) });
320
+ }), this.showOptions(s, o.id);
321
+ }
322
+ mount() {
323
+ this.updateSel();
324
+ }
325
+ showOptions(e, t) {
326
+ this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(e, t, this.range)), this.list.addEventListener("scroll", () => {
327
+ this.info && this.view.requestMeasure(this.placeInfoReq);
328
+ });
329
+ }
330
+ update(e) {
331
+ var t;
332
+ let n = e.state.field(this.stateField), o = e.startState.field(this.stateField);
333
+ if (this.updateTooltipClass(e.state), n != o) {
334
+ let { options: s, selected: l, disabled: a } = n.open;
335
+ (!o.open || o.open.options != s) && (this.range = Q(s.length, l, e.state.facet(g).maxRenderedOptions), this.showOptions(s, n.id)), this.updateSel(), a != ((t = o.open) === null || t === void 0 ? void 0 : t.disabled) && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!a);
336
+ }
337
+ }
338
+ updateTooltipClass(e) {
339
+ let t = this.tooltipClass(e);
340
+ if (t != this.currentClass) {
341
+ for (let n of this.currentClass.split(" "))
342
+ n && this.dom.classList.remove(n);
343
+ for (let n of t.split(" "))
344
+ n && this.dom.classList.add(n);
345
+ this.currentClass = t;
346
+ }
347
+ }
348
+ positioned(e) {
349
+ this.space = e, this.info && this.view.requestMeasure(this.placeInfoReq);
350
+ }
351
+ updateSel() {
352
+ let e = this.view.state.field(this.stateField), t = e.open;
353
+ (t.selected > -1 && t.selected < this.range.from || t.selected >= this.range.to) && (this.range = Q(t.options.length, t.selected, this.view.state.facet(g).maxRenderedOptions), this.showOptions(t.options, e.id));
354
+ let n = this.updateSelectedOption(t.selected);
355
+ if (n) {
356
+ this.destroyInfo();
357
+ let { completion: o } = t.options[t.selected], { info: s } = o;
358
+ if (!s)
359
+ return;
360
+ let l = typeof s == "string" ? document.createTextNode(s) : s(o);
361
+ if (!l)
362
+ return;
363
+ "then" in l ? l.then((a) => {
364
+ a && this.view.state.field(this.stateField, !1) == e && this.addInfoPane(a, o);
365
+ }).catch((a) => Z(this.view.state, a, "completion info")) : (this.addInfoPane(l, o), n.setAttribute("aria-describedby", this.info.id));
366
+ }
367
+ }
368
+ addInfoPane(e, t) {
369
+ this.destroyInfo();
370
+ let n = this.info = document.createElement("div");
371
+ if (n.className = "cm-tooltip cm-completionInfo", n.id = "cm-completionInfo-" + Math.floor(Math.random() * 65535).toString(16), e.nodeType != null)
372
+ n.appendChild(e), this.infoDestroy = null;
373
+ else {
374
+ let { dom: o, destroy: s } = e;
375
+ n.appendChild(o), this.infoDestroy = s || null;
376
+ }
377
+ this.dom.appendChild(n), this.view.requestMeasure(this.placeInfoReq);
378
+ }
379
+ updateSelectedOption(e) {
380
+ let t = null;
381
+ for (let n = this.list.firstChild, o = this.range.from; n; n = n.nextSibling, o++)
382
+ n.nodeName != "LI" || !n.id ? o-- : o == e ? n.hasAttribute("aria-selected") || (n.setAttribute("aria-selected", "true"), t = n) : n.hasAttribute("aria-selected") && (n.removeAttribute("aria-selected"), n.removeAttribute("aria-describedby"));
383
+ return t && Ze(this.list, t), t;
384
+ }
385
+ measureInfo() {
386
+ let e = this.dom.querySelector("[aria-selected]");
387
+ if (!e || !this.info)
388
+ return null;
389
+ let t = this.dom.getBoundingClientRect(), n = this.info.getBoundingClientRect(), o = e.getBoundingClientRect(), s = this.space;
390
+ if (!s) {
391
+ let l = this.dom.ownerDocument.documentElement;
392
+ s = { left: 0, top: 0, right: l.clientWidth, bottom: l.clientHeight };
393
+ }
394
+ return o.top > Math.min(s.bottom, t.bottom) - 10 || o.bottom < Math.max(s.top, t.top) + 10 ? null : this.view.state.facet(g).positionInfo(this.view, t, o, n, s, this.dom);
395
+ }
396
+ placeInfo(e) {
397
+ this.info && (e ? (e.style && (this.info.style.cssText = e.style), this.info.className = "cm-tooltip cm-completionInfo " + (e.class || "")) : this.info.style.cssText = "top: -1e6px");
398
+ }
399
+ createListBox(e, t, n) {
400
+ const o = document.createElement("ul");
401
+ o.id = t, o.setAttribute("role", "listbox"), o.setAttribute("aria-expanded", "true"), o.setAttribute("aria-label", this.view.state.phrase("Completions")), o.addEventListener("mousedown", (l) => {
402
+ l.target == o && l.preventDefault();
403
+ });
404
+ let s = null;
405
+ for (let l = n.from; l < n.to; l++) {
406
+ let { completion: a, match: r } = e[l], { section: h } = a;
407
+ if (h) {
408
+ let p = typeof h == "string" ? h : h.name;
409
+ if (p != s && (l > n.from || n.from == 0))
410
+ if (s = p, typeof h != "string" && h.header)
411
+ o.appendChild(h.header(h));
412
+ else {
413
+ let u = o.appendChild(document.createElement("completion-section"));
414
+ u.textContent = p;
415
+ }
416
+ }
417
+ const c = o.appendChild(document.createElement("li"));
418
+ c.id = t + "-" + l, c.setAttribute("role", "option");
419
+ let f = this.optionClass(a);
420
+ f && (c.className = f);
421
+ for (let p of this.optionContent) {
422
+ let u = p(a, this.view.state, this.view, r);
423
+ u && c.appendChild(u);
424
+ }
425
+ }
426
+ return n.from && o.classList.add("cm-completionListIncompleteTop"), n.to < e.length && o.classList.add("cm-completionListIncompleteBottom"), o;
427
+ }
428
+ destroyInfo() {
429
+ this.info && (this.infoDestroy && this.infoDestroy(), this.info.remove(), this.info = null);
430
+ }
431
+ destroy() {
432
+ this.destroyInfo();
433
+ }
434
+ }
435
+ function Je(i, e) {
436
+ return (t) => new Ge(t, i, e);
437
+ }
438
+ function Ze(i, e) {
439
+ let t = i.getBoundingClientRect(), n = e.getBoundingClientRect(), o = t.height / i.offsetHeight;
440
+ n.top < t.top ? i.scrollTop -= (t.top - n.top) / o : n.bottom > t.bottom && (i.scrollTop += (n.bottom - t.bottom) / o);
441
+ }
442
+ function pe(i) {
443
+ return (i.boost || 0) * 100 + (i.apply ? 10 : 0) + (i.info ? 5 : 0) + (i.type ? 1 : 0);
444
+ }
445
+ function _e(i, e) {
446
+ let t = [], n = null, o = null, s = (c) => {
447
+ t.push(c);
448
+ let { section: f } = c.completion;
449
+ if (f) {
450
+ n || (n = []);
451
+ let p = typeof f == "string" ? f : f.name;
452
+ n.some((u) => u.name == p) || n.push(typeof f == "string" ? { name: p } : f);
453
+ }
454
+ }, l = e.facet(g);
455
+ for (let c of i)
456
+ if (c.hasResult()) {
457
+ let f = c.result.getMatch;
458
+ if (c.result.filter === !1)
459
+ for (let p of c.result.options)
460
+ s(new ce(p, c.source, f ? f(p) : [], 1e9 - t.length));
461
+ else {
462
+ let p = e.sliceDoc(c.from, c.to), u, m = l.filterStrict ? new Qe(p) : new Ke(p);
463
+ for (let y of c.result.options)
464
+ if (u = m.match(y.label)) {
465
+ let k = y.displayLabel ? f ? f(y, u.matched) : [] : u.matched, I = u.score + (y.boost || 0);
466
+ if (s(new ce(y, c.source, k, I)), typeof y.section == "object" && y.section.rank === "dynamic") {
467
+ let { name: d } = y.section;
468
+ o || (o = /* @__PURE__ */ Object.create(null)), o[d] = Math.max(I, o[d] || -1e9);
469
+ }
470
+ }
471
+ }
472
+ }
473
+ if (n) {
474
+ let c = /* @__PURE__ */ Object.create(null), f = 0, p = (u, m) => (u.rank === "dynamic" && m.rank === "dynamic" ? o[m.name] - o[u.name] : 0) || (typeof u.rank == "number" ? u.rank : 1e9) - (typeof m.rank == "number" ? m.rank : 1e9) || (u.name < m.name ? -1 : 1);
475
+ for (let u of n.sort(p))
476
+ f -= 1e5, c[u.name] = f;
477
+ for (let u of t) {
478
+ let { section: m } = u.completion;
479
+ m && (u.score += c[typeof m == "string" ? m : m.name]);
480
+ }
481
+ }
482
+ let a = [], r = null, h = l.compareCompletions;
483
+ for (let c of t.sort((f, p) => p.score - f.score || h(f.completion, p.completion))) {
484
+ let f = c.completion;
485
+ !r || r.label != f.label || r.detail != f.detail || r.type != null && f.type != null && r.type != f.type || r.apply != f.apply || r.boost != f.boost ? a.push(c) : pe(c.completion) > pe(r) && (a[a.length - 1] = c), r = c.completion;
486
+ }
487
+ return a;
488
+ }
489
+ class P {
490
+ constructor(e, t, n, o, s, l) {
491
+ this.options = e, this.attrs = t, this.tooltip = n, this.timestamp = o, this.selected = s, this.disabled = l;
492
+ }
493
+ setSelected(e, t) {
494
+ return e == this.selected || e >= this.options.length ? this : new P(this.options, ue(t, e), this.tooltip, this.timestamp, e, this.disabled);
495
+ }
496
+ static build(e, t, n, o, s, l) {
497
+ if (o && !l && e.some((h) => h.isPending))
498
+ return o.setDisabled();
499
+ let a = _e(e, t);
500
+ if (!a.length)
501
+ return o && e.some((h) => h.isPending) ? o.setDisabled() : null;
502
+ let r = t.facet(g).selectOnOpen ? 0 : -1;
503
+ if (o && o.selected != r && o.selected != -1) {
504
+ let h = o.options[o.selected].completion;
505
+ for (let c = 0; c < a.length; c++)
506
+ if (a[c].completion == h) {
507
+ r = c;
508
+ break;
509
+ }
510
+ }
511
+ return new P(a, ue(n, r), {
512
+ pos: e.reduce((h, c) => c.hasResult() ? Math.min(h, c.from) : h, 1e8),
513
+ create: st,
514
+ above: s.aboveCursor
515
+ }, o ? o.timestamp : Date.now(), r, !1);
516
+ }
517
+ map(e) {
518
+ return new P(this.options, this.attrs, { ...this.tooltip, pos: e.mapPos(this.tooltip.pos) }, this.timestamp, this.selected, this.disabled);
519
+ }
520
+ setDisabled() {
521
+ return new P(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, !0);
522
+ }
523
+ }
524
+ class H {
525
+ constructor(e, t, n) {
526
+ this.active = e, this.id = t, this.open = n;
527
+ }
528
+ static start() {
529
+ return new H(nt, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
530
+ }
531
+ update(e) {
532
+ let { state: t } = e, n = t.facet(g), s = (n.override || t.languageDataAt("autocomplete", E(t)).map(ze)).map((r) => (this.active.find((c) => c.source == r) || new C(
533
+ r,
534
+ this.active.some(
535
+ (c) => c.state != 0
536
+ /* State.Inactive */
537
+ ) ? 1 : 0
538
+ /* State.Inactive */
539
+ )).update(e, n));
540
+ s.length == this.active.length && s.every((r, h) => r == this.active[h]) && (s = this.active);
541
+ let l = this.open, a = e.effects.some((r) => r.is(ie));
542
+ l && e.docChanged && (l = l.map(e.changes)), e.selection || s.some((r) => r.hasResult() && e.changes.touchesRange(r.from, r.to)) || !et(s, this.active) || a ? l = P.build(s, t, this.id, l, n, a) : l && l.disabled && !s.some((r) => r.isPending) && (l = null), !l && s.every((r) => !r.isPending) && s.some((r) => r.hasResult()) && (s = s.map((r) => r.hasResult() ? new C(
543
+ r.source,
544
+ 0
545
+ /* State.Inactive */
546
+ ) : r));
547
+ for (let r of e.effects)
548
+ r.is(Ie) && (l = l && l.setSelected(r.value, this.id));
549
+ return s == this.active && l == this.open ? this : new H(s, this.id, l);
550
+ }
551
+ get tooltip() {
552
+ return this.open ? this.open.tooltip : null;
553
+ }
554
+ get attrs() {
555
+ return this.open ? this.open.attrs : this.active.length ? tt : it;
556
+ }
557
+ }
558
+ function et(i, e) {
559
+ if (i == e)
560
+ return !0;
561
+ for (let t = 0, n = 0; ; ) {
562
+ for (; t < i.length && !i[t].hasResult(); )
563
+ t++;
564
+ for (; n < e.length && !e[n].hasResult(); )
565
+ n++;
566
+ let o = t == i.length, s = n == e.length;
567
+ if (o || s)
568
+ return o == s;
569
+ if (i[t++].result != e[n++].result)
570
+ return !1;
571
+ }
572
+ }
573
+ const tt = {
574
+ "aria-autocomplete": "list"
575
+ }, it = {};
576
+ function ue(i, e) {
577
+ let t = {
578
+ "aria-autocomplete": "list",
579
+ "aria-haspopup": "listbox",
580
+ "aria-controls": i
581
+ };
582
+ return e > -1 && (t["aria-activedescendant"] = i + "-" + e), t;
583
+ }
584
+ const nt = [];
585
+ function Se(i, e) {
586
+ if (i.isUserEvent("input.complete")) {
587
+ let n = i.annotation(te);
588
+ if (n && e.activateOnCompletion(n))
589
+ return 12;
590
+ }
591
+ let t = i.isUserEvent("input.type");
592
+ return t && e.activateOnTyping ? 5 : t ? 1 : i.isUserEvent("delete.backward") ? 2 : i.selection ? 8 : i.docChanged ? 16 : 0;
593
+ }
594
+ class C {
595
+ constructor(e, t, n = !1) {
596
+ this.source = e, this.state = t, this.explicit = n;
597
+ }
598
+ hasResult() {
599
+ return !1;
600
+ }
601
+ get isPending() {
602
+ return this.state == 1;
603
+ }
604
+ update(e, t) {
605
+ let n = Se(e, t), o = this;
606
+ (n & 8 || n & 16 && this.touches(e)) && (o = new C(
607
+ o.source,
608
+ 0
609
+ /* State.Inactive */
610
+ )), n & 4 && o.state == 0 && (o = new C(
611
+ this.source,
612
+ 1
613
+ /* State.Pending */
614
+ )), o = o.updateFor(e, n);
615
+ for (let s of e.effects)
616
+ if (s.is(j))
617
+ o = new C(o.source, 1, s.value);
618
+ else if (s.is(B))
619
+ o = new C(
620
+ o.source,
621
+ 0
622
+ /* State.Inactive */
623
+ );
624
+ else if (s.is(ie))
625
+ for (let l of s.value)
626
+ l.source == o.source && (o = l);
627
+ return o;
628
+ }
629
+ updateFor(e, t) {
630
+ return this.map(e.changes);
631
+ }
632
+ map(e) {
633
+ return this;
634
+ }
635
+ touches(e) {
636
+ return e.changes.touchesRange(E(e.state));
637
+ }
638
+ }
639
+ class R extends C {
640
+ constructor(e, t, n, o, s, l) {
641
+ super(e, 3, t), this.limit = n, this.result = o, this.from = s, this.to = l;
642
+ }
643
+ hasResult() {
644
+ return !0;
645
+ }
646
+ updateFor(e, t) {
647
+ var n;
648
+ if (!(t & 3))
649
+ return this.map(e.changes);
650
+ let o = this.result;
651
+ o.map && !e.changes.empty && (o = o.map(o, e.changes));
652
+ let s = e.changes.mapPos(this.from), l = e.changes.mapPos(this.to, 1), a = E(e.state);
653
+ if (a > l || !o || t & 2 && (E(e.startState) == this.from || a < this.limit))
654
+ return new C(
655
+ this.source,
656
+ t & 4 ? 1 : 0
657
+ /* State.Inactive */
658
+ );
659
+ let r = e.changes.mapPos(this.limit);
660
+ return ot(o.validFor, e.state, s, l) ? new R(this.source, this.explicit, r, o, s, l) : o.update && (o = o.update(o, s, l, new Ce(e.state, a, !1))) ? new R(this.source, this.explicit, r, o, o.from, (n = o.to) !== null && n !== void 0 ? n : E(e.state)) : new C(this.source, 1, this.explicit);
661
+ }
662
+ map(e) {
663
+ return e.empty ? this : (this.result.map ? this.result.map(this.result, e) : this.result) ? new R(this.source, this.explicit, e.mapPos(this.limit), this.result, e.mapPos(this.from), e.mapPos(this.to, 1)) : new C(
664
+ this.source,
665
+ 0
666
+ /* State.Inactive */
667
+ );
668
+ }
669
+ touches(e) {
670
+ return e.changes.touchesRange(this.from, this.to);
671
+ }
672
+ }
673
+ function ot(i, e, t, n) {
674
+ if (!i)
675
+ return !1;
676
+ let o = e.sliceDoc(t, n);
677
+ return typeof i == "function" ? i(o, t, n, e) : ve(i, !0).test(o);
678
+ }
679
+ const ie = /* @__PURE__ */ O.define({
680
+ map(i, e) {
681
+ return i.map((t) => t.map(e));
682
+ }
683
+ }), Ie = /* @__PURE__ */ O.define(), x = /* @__PURE__ */ _.define({
684
+ create() {
685
+ return H.start();
686
+ },
687
+ update(i, e) {
688
+ return i.update(e);
689
+ },
690
+ provide: (i) => [
691
+ Ne.from(i, (e) => e.tooltip),
692
+ M.contentAttributes.from(i, (e) => e.attrs)
693
+ ]
694
+ });
695
+ function ne(i, e) {
696
+ const t = e.completion.apply || e.completion.label;
697
+ let n = i.state.field(x).active.find((o) => o.source == e.source);
698
+ return n instanceof R ? (typeof t == "string" ? i.dispatch({
699
+ ...qe(i.state, t, n.from, n.to),
700
+ annotations: te.of(e.completion)
701
+ }) : t(i, e.completion, n.from, n.to), !0) : !1;
702
+ }
703
+ const st = /* @__PURE__ */ Je(x, ne);
704
+ function W(i, e = "option") {
705
+ return (t) => {
706
+ let n = t.state.field(x, !1);
707
+ if (!n || !n.open || n.open.disabled || Date.now() - n.open.timestamp < t.state.facet(g).interactionDelay)
708
+ return !1;
709
+ let o = 1, s;
710
+ e == "page" && (s = we(t, n.open.tooltip)) && (o = Math.max(2, Math.floor(s.dom.offsetHeight / s.dom.querySelector("li").offsetHeight) - 1));
711
+ let { length: l } = n.open.options, a = n.open.selected > -1 ? n.open.selected + o * (i ? 1 : -1) : i ? 0 : l - 1;
712
+ return a < 0 ? a = e == "page" ? 0 : l - 1 : a >= l && (a = e == "page" ? l - 1 : 0), t.dispatch({ effects: Ie.of(a) }), !0;
713
+ };
714
+ }
715
+ const lt = (i) => {
716
+ let e = i.state.field(x, !1);
717
+ return i.state.readOnly || !e || !e.open || e.open.selected < 0 || e.open.disabled || Date.now() - e.open.timestamp < i.state.facet(g).interactionDelay ? !1 : ne(i, e.open.options[e.open.selected]);
718
+ }, X = (i) => i.state.field(x, !1) ? (i.dispatch({ effects: j.of(!0) }), !0) : !1, rt = (i) => {
719
+ let e = i.state.field(x, !1);
720
+ return !e || !e.active.some(
721
+ (t) => t.state != 0
722
+ /* State.Inactive */
723
+ ) ? !1 : (i.dispatch({ effects: B.of(null) }), !0);
724
+ };
725
+ class at {
726
+ constructor(e, t) {
727
+ this.active = e, this.context = t, this.time = Date.now(), this.updates = [], this.done = void 0;
728
+ }
729
+ }
730
+ const ct = 50, ft = 1e3, ht = /* @__PURE__ */ $e.fromClass(class {
731
+ constructor(i) {
732
+ this.view = i, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.pendingStart = !1, this.composing = 0;
733
+ for (let e of i.state.field(x).active)
734
+ e.isPending && this.startQuery(e);
735
+ }
736
+ update(i) {
737
+ let e = i.state.field(x), t = i.state.facet(g);
738
+ if (!i.selectionSet && !i.docChanged && i.startState.field(x) == e)
739
+ return;
740
+ let n = i.transactions.some((s) => {
741
+ let l = Se(s, t);
742
+ return l & 8 || (s.selection || s.docChanged) && !(l & 3);
743
+ });
744
+ for (let s = 0; s < this.running.length; s++) {
745
+ let l = this.running[s];
746
+ if (n || l.context.abortOnDocChange && i.docChanged || l.updates.length + i.transactions.length > ct && Date.now() - l.time > ft) {
747
+ for (let a of l.context.abortListeners)
748
+ try {
749
+ a();
750
+ } catch (r) {
751
+ Z(this.view.state, r);
752
+ }
753
+ l.context.abortListeners = null, this.running.splice(s--, 1);
754
+ } else
755
+ l.updates.push(...i.transactions);
756
+ }
757
+ this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), i.transactions.some((s) => s.effects.some((l) => l.is(j))) && (this.pendingStart = !0);
758
+ let o = this.pendingStart ? 50 : t.activateOnTypingDelay;
759
+ if (this.debounceUpdate = e.active.some((s) => s.isPending && !this.running.some((l) => l.active.source == s.source)) ? setTimeout(() => this.startUpdate(), o) : -1, this.composing != 0)
760
+ for (let s of i.transactions)
761
+ s.isUserEvent("input.type") ? this.composing = 2 : this.composing == 2 && s.selection && (this.composing = 3);
762
+ }
763
+ startUpdate() {
764
+ this.debounceUpdate = -1, this.pendingStart = !1;
765
+ let { state: i } = this.view, e = i.field(x);
766
+ for (let t of e.active)
767
+ t.isPending && !this.running.some((n) => n.active.source == t.source) && this.startQuery(t);
768
+ this.running.length && e.open && e.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(g).updateSyncTime));
769
+ }
770
+ startQuery(i) {
771
+ let { state: e } = this.view, t = E(e), n = new Ce(e, t, i.explicit, this.view), o = new at(i, n);
772
+ this.running.push(o), Promise.resolve(i.source(n)).then((s) => {
773
+ o.context.aborted || (o.done = s || null, this.scheduleAccept());
774
+ }, (s) => {
775
+ this.view.dispatch({ effects: B.of(null) }), Z(this.view.state, s);
776
+ });
777
+ }
778
+ scheduleAccept() {
779
+ this.running.every((i) => i.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(g).updateSyncTime));
780
+ }
781
+ // For each finished query in this.running, try to create a result
782
+ // or, if appropriate, restart the query.
783
+ accept() {
784
+ var i;
785
+ this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1;
786
+ let e = [], t = this.view.state.facet(g), n = this.view.state.field(x);
787
+ for (let o = 0; o < this.running.length; o++) {
788
+ let s = this.running[o];
789
+ if (s.done === void 0)
790
+ continue;
791
+ if (this.running.splice(o--, 1), s.done) {
792
+ let a = E(s.updates.length ? s.updates[0].startState : this.view.state), r = Math.min(a, s.done.from + (s.active.explicit ? 0 : 1)), h = new R(s.active.source, s.active.explicit, r, s.done, s.done.from, (i = s.done.to) !== null && i !== void 0 ? i : a);
793
+ for (let c of s.updates)
794
+ h = h.update(c, t);
795
+ if (h.hasResult()) {
796
+ e.push(h);
797
+ continue;
798
+ }
799
+ }
800
+ let l = n.active.find((a) => a.source == s.active.source);
801
+ if (l && l.isPending)
802
+ if (s.done == null) {
803
+ let a = new C(
804
+ s.active.source,
805
+ 0
806
+ /* State.Inactive */
807
+ );
808
+ for (let r of s.updates)
809
+ a = a.update(r, t);
810
+ a.isPending || e.push(a);
811
+ } else
812
+ this.startQuery(l);
813
+ }
814
+ (e.length || n.open && n.open.disabled) && this.view.dispatch({ effects: ie.of(e) });
815
+ }
816
+ }, {
817
+ eventHandlers: {
818
+ blur(i) {
819
+ let e = this.view.state.field(x, !1);
820
+ if (e && e.tooltip && this.view.state.facet(g).closeOnBlur) {
821
+ let t = e.open && we(this.view, e.open.tooltip);
822
+ (!t || !t.dom.contains(i.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects: B.of(null) }), 10);
823
+ }
824
+ },
825
+ compositionstart() {
826
+ this.composing = 1;
827
+ },
828
+ compositionend() {
829
+ this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: j.of(!1) }), 20), this.composing = 0;
830
+ }
831
+ }
832
+ }), pt = typeof navigator == "object" && /* @__PURE__ */ /Win/.test(navigator.platform), ut = /* @__PURE__ */ ee.highest(/* @__PURE__ */ M.domEventHandlers({
833
+ keydown(i, e) {
834
+ let t = e.state.field(x, !1);
835
+ if (!t || !t.open || t.open.disabled || t.open.selected < 0 || i.key.length > 1 || i.ctrlKey && !(pt && i.altKey) || i.metaKey)
836
+ return !1;
837
+ let n = t.open.options[t.open.selected], o = t.active.find((l) => l.source == n.source), s = n.completion.commitCharacters || o.result.commitCharacters;
838
+ return s && s.indexOf(i.key) > -1 && ne(e, n), !1;
839
+ }
840
+ })), Te = /* @__PURE__ */ M.baseTheme({
841
+ ".cm-tooltip.cm-tooltip-autocomplete": {
842
+ "& > ul": {
843
+ fontFamily: "monospace",
844
+ whiteSpace: "nowrap",
845
+ overflow: "hidden auto",
846
+ maxWidth_fallback: "700px",
847
+ maxWidth: "min(700px, 95vw)",
848
+ minWidth: "250px",
849
+ maxHeight: "10em",
850
+ height: "100%",
851
+ listStyle: "none",
852
+ margin: 0,
853
+ padding: 0,
854
+ "& > li, & > completion-section": {
855
+ padding: "1px 3px",
856
+ lineHeight: 1.2
857
+ },
858
+ "& > li": {
859
+ overflowX: "hidden",
860
+ textOverflow: "ellipsis",
861
+ cursor: "pointer"
862
+ },
863
+ "& > completion-section": {
864
+ display: "list-item",
865
+ borderBottom: "1px solid silver",
866
+ paddingLeft: "0.5em",
867
+ opacity: 0.7
868
+ }
869
+ }
870
+ },
871
+ "&light .cm-tooltip-autocomplete ul li[aria-selected]": {
872
+ background: "#17c",
873
+ color: "white"
874
+ },
875
+ "&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {
876
+ background: "#777"
877
+ },
878
+ "&dark .cm-tooltip-autocomplete ul li[aria-selected]": {
879
+ background: "#347",
880
+ color: "white"
881
+ },
882
+ "&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": {
883
+ background: "#444"
884
+ },
885
+ ".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {
886
+ content: '"···"',
887
+ opacity: 0.5,
888
+ display: "block",
889
+ textAlign: "center"
890
+ },
891
+ ".cm-tooltip.cm-completionInfo": {
892
+ position: "absolute",
893
+ padding: "3px 9px",
894
+ width: "max-content",
895
+ maxWidth: "400px",
896
+ boxSizing: "border-box",
897
+ whiteSpace: "pre-line"
898
+ },
899
+ ".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
900
+ ".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
901
+ ".cm-completionInfo.cm-completionInfo-left-narrow": { right: "30px" },
902
+ ".cm-completionInfo.cm-completionInfo-right-narrow": { left: "30px" },
903
+ "&light .cm-snippetField": { backgroundColor: "#00000022" },
904
+ "&dark .cm-snippetField": { backgroundColor: "#ffffff22" },
905
+ ".cm-snippetFieldPosition": {
906
+ verticalAlign: "text-top",
907
+ width: 0,
908
+ height: "1.15em",
909
+ display: "inline-block",
910
+ margin: "0 -0.7px -.7em",
911
+ borderLeft: "1.4px dotted #888"
912
+ },
913
+ ".cm-completionMatchedText": {
914
+ textDecoration: "underline"
915
+ },
916
+ ".cm-completionDetail": {
917
+ marginLeft: "0.5em",
918
+ fontStyle: "italic"
919
+ },
920
+ ".cm-completionIcon": {
921
+ fontSize: "90%",
922
+ width: ".8em",
923
+ display: "inline-block",
924
+ textAlign: "center",
925
+ paddingRight: ".6em",
926
+ opacity: "0.6",
927
+ boxSizing: "content-box"
928
+ },
929
+ ".cm-completionIcon-function, .cm-completionIcon-method": {
930
+ "&:after": { content: "'ƒ'" }
931
+ },
932
+ ".cm-completionIcon-class": {
933
+ "&:after": { content: "'○'" }
934
+ },
935
+ ".cm-completionIcon-interface": {
936
+ "&:after": { content: "'◌'" }
937
+ },
938
+ ".cm-completionIcon-variable": {
939
+ "&:after": { content: "'𝑥'" }
940
+ },
941
+ ".cm-completionIcon-constant": {
942
+ "&:after": { content: "'𝐶'" }
943
+ },
944
+ ".cm-completionIcon-type": {
945
+ "&:after": { content: "'𝑡'" }
946
+ },
947
+ ".cm-completionIcon-enum": {
948
+ "&:after": { content: "'∪'" }
949
+ },
950
+ ".cm-completionIcon-property": {
951
+ "&:after": { content: "'□'" }
952
+ },
953
+ ".cm-completionIcon-keyword": {
954
+ "&:after": { content: "'🔑︎'" }
955
+ // Disable emoji rendering
956
+ },
957
+ ".cm-completionIcon-namespace": {
958
+ "&:after": { content: "'▢'" }
959
+ },
960
+ ".cm-completionIcon-text": {
961
+ "&:after": { content: "'abc'", fontSize: "50%", verticalAlign: "middle" }
962
+ }
963
+ });
964
+ class dt {
965
+ constructor(e, t, n, o) {
966
+ this.field = e, this.line = t, this.from = n, this.to = o;
967
+ }
968
+ }
969
+ class oe {
970
+ constructor(e, t, n) {
971
+ this.field = e, this.from = t, this.to = n;
972
+ }
973
+ map(e) {
974
+ let t = e.mapPos(this.from, -1, G.TrackDel), n = e.mapPos(this.to, 1, G.TrackDel);
975
+ return t == null || n == null ? null : new oe(this.field, t, n);
976
+ }
977
+ }
978
+ class se {
979
+ constructor(e, t) {
980
+ this.lines = e, this.fieldPositions = t;
981
+ }
982
+ instantiate(e, t) {
983
+ let n = [], o = [t], s = e.doc.lineAt(t), l = /^\s*/.exec(s.text)[0];
984
+ for (let r of this.lines) {
985
+ if (n.length) {
986
+ let h = l, c = /^\t*/.exec(r)[0].length;
987
+ for (let f = 0; f < c; f++)
988
+ h += e.facet(je);
989
+ o.push(t + h.length - c), r = h + r.slice(c);
990
+ }
991
+ n.push(r), t += r.length + 1;
992
+ }
993
+ let a = this.fieldPositions.map((r) => new oe(r.field, o[r.line] + r.from, o[r.line] + r.to));
994
+ return { text: n, ranges: a };
995
+ }
996
+ static parse(e) {
997
+ let t = [], n = [], o = [], s;
998
+ for (let l of e.split(/\r\n?|\n/)) {
999
+ for (; s = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l); ) {
1000
+ let a = s[1] ? +s[1] : null, r = s[2] || s[3] || "", h = -1, c = r.replace(/\\[{}]/g, (f) => f[1]);
1001
+ for (let f = 0; f < t.length; f++)
1002
+ (a != null ? t[f].seq == a : c && t[f].name == c) && (h = f);
1003
+ if (h < 0) {
1004
+ let f = 0;
1005
+ for (; f < t.length && (a == null || t[f].seq != null && t[f].seq < a); )
1006
+ f++;
1007
+ t.splice(f, 0, { seq: a, name: c }), h = f;
1008
+ for (let p of o)
1009
+ p.field >= h && p.field++;
1010
+ }
1011
+ for (let f of o)
1012
+ if (f.line == n.length && f.from > s.index) {
1013
+ let p = s[2] ? 3 + (s[1] || "").length : 2;
1014
+ f.from -= p, f.to -= p;
1015
+ }
1016
+ o.push(new dt(h, n.length, s.index, s.index + c.length)), l = l.slice(0, s.index) + r + l.slice(s.index + s[0].length);
1017
+ }
1018
+ l = l.replace(/\\([{}])/g, (a, r, h) => {
1019
+ for (let c of o)
1020
+ c.line == n.length && c.from > h && (c.from--, c.to--);
1021
+ return r;
1022
+ }), n.push(l);
1023
+ }
1024
+ return new se(n, o);
1025
+ }
1026
+ }
1027
+ let mt = /* @__PURE__ */ V.widget({ widget: /* @__PURE__ */ new class extends Ue {
1028
+ toDOM() {
1029
+ let i = document.createElement("span");
1030
+ return i.className = "cm-snippetFieldPosition", i;
1031
+ }
1032
+ ignoreEvent() {
1033
+ return !1;
1034
+ }
1035
+ }() }), gt = /* @__PURE__ */ V.mark({ class: "cm-snippetField" });
1036
+ class L {
1037
+ constructor(e, t) {
1038
+ this.ranges = e, this.active = t, this.deco = V.set(e.map((n) => (n.from == n.to ? mt : gt).range(n.from, n.to)), !0);
1039
+ }
1040
+ map(e) {
1041
+ let t = [];
1042
+ for (let n of this.ranges) {
1043
+ let o = n.map(e);
1044
+ if (!o)
1045
+ return null;
1046
+ t.push(o);
1047
+ }
1048
+ return new L(t, this.active);
1049
+ }
1050
+ selectionInsideField(e) {
1051
+ return e.ranges.every((t) => this.ranges.some((n) => n.field == this.active && n.from <= t.from && n.to >= t.to));
1052
+ }
1053
+ }
1054
+ const N = /* @__PURE__ */ O.define({
1055
+ map(i, e) {
1056
+ return i && i.map(e);
1057
+ }
1058
+ }), yt = /* @__PURE__ */ O.define(), F = /* @__PURE__ */ _.define({
1059
+ create() {
1060
+ return null;
1061
+ },
1062
+ update(i, e) {
1063
+ for (let t of e.effects) {
1064
+ if (t.is(N))
1065
+ return t.value;
1066
+ if (t.is(yt) && i)
1067
+ return new L(i.ranges, t.value);
1068
+ }
1069
+ return i && e.docChanged && (i = i.map(e.changes)), i && e.selection && !i.selectionInsideField(e.selection) && (i = null), i;
1070
+ },
1071
+ provide: (i) => M.decorations.from(i, (e) => e ? e.deco : V.none)
1072
+ });
1073
+ function le(i, e) {
1074
+ return w.create(i.filter((t) => t.field == e).map((t) => w.range(t.from, t.to)));
1075
+ }
1076
+ function bt(i) {
1077
+ let e = se.parse(i);
1078
+ return (t, n, o, s) => {
1079
+ let { text: l, ranges: a } = e.instantiate(t.state, o), { main: r } = t.state.selection, h = {
1080
+ changes: { from: o, to: s == r.from ? r.to : s, insert: Le.of(l) },
1081
+ scrollIntoView: !0,
1082
+ annotations: n ? [te.of(n), Me.userEvent.of("input.complete")] : void 0
1083
+ };
1084
+ if (a.length && (h.selection = le(a, 0)), a.some((c) => c.field > 0)) {
1085
+ let c = new L(a, 0), f = h.effects = [N.of(c)];
1086
+ t.state.field(F, !1) === void 0 && f.push(O.appendConfig.of([F, St, It, Te]));
1087
+ }
1088
+ t.dispatch(t.state.update(h));
1089
+ };
1090
+ }
1091
+ function Oe(i) {
1092
+ return ({ state: e, dispatch: t }) => {
1093
+ let n = e.field(F, !1);
1094
+ if (!n || i < 0 && n.active == 0)
1095
+ return !1;
1096
+ let o = n.active + i, s = i > 0 && !n.ranges.some((l) => l.field == o + i);
1097
+ return t(e.update({
1098
+ selection: le(n.ranges, o),
1099
+ effects: N.of(s ? null : new L(n.ranges, o)),
1100
+ scrollIntoView: !0
1101
+ })), !0;
1102
+ };
1103
+ }
1104
+ const xt = ({ state: i, dispatch: e }) => i.field(F, !1) ? (e(i.update({ effects: N.of(null) })), !0) : !1, wt = /* @__PURE__ */ Oe(1), Ct = /* @__PURE__ */ Oe(-1), vt = [
1105
+ { key: "Tab", run: wt, shift: Ct },
1106
+ { key: "Escape", run: xt }
1107
+ ], de = /* @__PURE__ */ ye.define({
1108
+ combine(i) {
1109
+ return i.length ? i[0] : vt;
1110
+ }
1111
+ }), St = /* @__PURE__ */ ee.highest(/* @__PURE__ */ xe.compute([de], (i) => i.facet(de)));
1112
+ function Wt(i, e) {
1113
+ return { ...e, apply: bt(i) };
1114
+ }
1115
+ const It = /* @__PURE__ */ M.domEventHandlers({
1116
+ mousedown(i, e) {
1117
+ let t = e.state.field(F, !1), n;
1118
+ if (!t || (n = e.posAtCoords({ x: i.clientX, y: i.clientY })) == null)
1119
+ return !1;
1120
+ let o = t.ranges.find((s) => s.from <= n && s.to >= n);
1121
+ return !o || o.field == t.active ? !1 : (e.dispatch({
1122
+ selection: le(t.ranges, o.field),
1123
+ effects: N.of(t.ranges.some((s) => s.field > o.field) ? new L(t.ranges, o.field) : null),
1124
+ scrollIntoView: !0
1125
+ }), !0);
1126
+ }
1127
+ }), $ = {
1128
+ brackets: ["(", "[", "{", "'", '"'],
1129
+ before: ")]}:;>",
1130
+ stringPrefixes: []
1131
+ }, A = /* @__PURE__ */ O.define({
1132
+ map(i, e) {
1133
+ let t = e.mapPos(i, -1, G.TrackAfter);
1134
+ return t ?? void 0;
1135
+ }
1136
+ }), re = /* @__PURE__ */ new class extends Fe {
1137
+ }();
1138
+ re.startSide = 1;
1139
+ re.endSide = -1;
1140
+ const Ae = /* @__PURE__ */ _.define({
1141
+ create() {
1142
+ return ke.empty;
1143
+ },
1144
+ update(i, e) {
1145
+ if (i = i.map(e.changes), e.selection) {
1146
+ let t = e.state.doc.lineAt(e.selection.main.head);
1147
+ i = i.update({ filter: (n) => n >= t.from && n <= t.to });
1148
+ }
1149
+ for (let t of e.effects)
1150
+ t.is(A) && (i = i.update({ add: [re.range(t.value, t.value + 1)] }));
1151
+ return i;
1152
+ }
1153
+ });
1154
+ function jt() {
1155
+ return [Ot, Ae];
1156
+ }
1157
+ const Y = "()[]{}<>«»»«[]{}";
1158
+ function Ee(i) {
1159
+ for (let e = 0; e < Y.length; e += 2)
1160
+ if (Y.charCodeAt(e) == i)
1161
+ return Y.charAt(e + 1);
1162
+ return be(i < 128 ? i : i + 1);
1163
+ }
1164
+ function De(i, e) {
1165
+ return i.languageDataAt("closeBrackets", e)[0] || $;
1166
+ }
1167
+ const Tt = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), Ot = /* @__PURE__ */ M.inputHandler.of((i, e, t, n) => {
1168
+ if ((Tt ? i.composing : i.compositionStarted) || i.state.readOnly)
1169
+ return !1;
1170
+ let o = i.state.selection.main;
1171
+ if (n.length > 2 || n.length == 2 && T(v(n, 0)) == 1 || e != o.from || t != o.to)
1172
+ return !1;
1173
+ let s = Et(i.state, n);
1174
+ return s ? (i.dispatch(s), !0) : !1;
1175
+ }), At = ({ state: i, dispatch: e }) => {
1176
+ if (i.readOnly)
1177
+ return !1;
1178
+ let n = De(i, i.selection.main.head).brackets || $.brackets, o = null, s = i.changeByRange((l) => {
1179
+ if (l.empty) {
1180
+ let a = Dt(i.doc, l.head);
1181
+ for (let r of n)
1182
+ if (r == a && z(i.doc, l.head) == Ee(v(r, 0)))
1183
+ return {
1184
+ changes: { from: l.head - r.length, to: l.head + r.length },
1185
+ range: w.cursor(l.head - r.length)
1186
+ };
1187
+ }
1188
+ return { range: o = l };
1189
+ });
1190
+ return o || e(i.update(s, { scrollIntoView: !0, userEvent: "delete.backward" })), !o;
1191
+ }, Ht = [
1192
+ { key: "Backspace", run: At }
1193
+ ];
1194
+ function Et(i, e) {
1195
+ let t = De(i, i.selection.main.head), n = t.brackets || $.brackets;
1196
+ for (let o of n) {
1197
+ let s = Ee(v(o, 0));
1198
+ if (e == o)
1199
+ return s == o ? Mt(i, o, n.indexOf(o + o + o) > -1, t) : Pt(i, o, s, t.before || $.before);
1200
+ if (e == s && Pe(i, i.selection.main.from))
1201
+ return Rt(i, o, s);
1202
+ }
1203
+ return null;
1204
+ }
1205
+ function Pe(i, e) {
1206
+ let t = !1;
1207
+ return i.field(Ae).between(0, i.doc.length, (n) => {
1208
+ n == e && (t = !0);
1209
+ }), t;
1210
+ }
1211
+ function z(i, e) {
1212
+ let t = i.sliceString(e, e + 2);
1213
+ return t.slice(0, T(v(t, 0)));
1214
+ }
1215
+ function Dt(i, e) {
1216
+ let t = i.sliceString(e - 2, e);
1217
+ return T(v(t, 0)) == t.length ? t : t.slice(1);
1218
+ }
1219
+ function Pt(i, e, t, n) {
1220
+ let o = null, s = i.changeByRange((l) => {
1221
+ if (!l.empty)
1222
+ return {
1223
+ changes: [{ insert: e, from: l.from }, { insert: t, from: l.to }],
1224
+ effects: A.of(l.to + e.length),
1225
+ range: w.range(l.anchor + e.length, l.head + e.length)
1226
+ };
1227
+ let a = z(i.doc, l.head);
1228
+ return !a || /\s/.test(a) || n.indexOf(a) > -1 ? {
1229
+ changes: { insert: e + t, from: l.head },
1230
+ effects: A.of(l.head + e.length),
1231
+ range: w.cursor(l.head + e.length)
1232
+ } : { range: o = l };
1233
+ });
1234
+ return o ? null : i.update(s, {
1235
+ scrollIntoView: !0,
1236
+ userEvent: "input.type"
1237
+ });
1238
+ }
1239
+ function Rt(i, e, t) {
1240
+ let n = null, o = i.changeByRange((s) => s.empty && z(i.doc, s.head) == t ? {
1241
+ changes: { from: s.head, to: s.head + t.length, insert: t },
1242
+ range: w.cursor(s.head + t.length)
1243
+ } : n = { range: s });
1244
+ return n ? null : i.update(o, {
1245
+ scrollIntoView: !0,
1246
+ userEvent: "input.type"
1247
+ });
1248
+ }
1249
+ function Mt(i, e, t, n) {
1250
+ let o = n.stringPrefixes || $.stringPrefixes, s = null, l = i.changeByRange((a) => {
1251
+ if (!a.empty)
1252
+ return {
1253
+ changes: [{ insert: e, from: a.from }, { insert: e, from: a.to }],
1254
+ effects: A.of(a.to + e.length),
1255
+ range: w.range(a.anchor + e.length, a.head + e.length)
1256
+ };
1257
+ let r = a.head, h = z(i.doc, r), c;
1258
+ if (h == e) {
1259
+ if (me(i, r))
1260
+ return {
1261
+ changes: { insert: e + e, from: r },
1262
+ effects: A.of(r + e.length),
1263
+ range: w.cursor(r + e.length)
1264
+ };
1265
+ if (Pe(i, r)) {
1266
+ let p = t && i.sliceDoc(r, r + e.length * 3) == e + e + e ? e + e + e : e;
1267
+ return {
1268
+ changes: { from: r, to: r + p.length, insert: p },
1269
+ range: w.cursor(r + p.length)
1270
+ };
1271
+ }
1272
+ } else {
1273
+ if (t && i.sliceDoc(r - 2 * e.length, r) == e + e && (c = ge(i, r - 2 * e.length, o)) > -1 && me(i, c))
1274
+ return {
1275
+ changes: { insert: e + e + e + e, from: r },
1276
+ effects: A.of(r + e.length),
1277
+ range: w.cursor(r + e.length)
1278
+ };
1279
+ if (i.charCategorizer(r)(h) != J.Word && ge(i, r, o) > -1 && !Lt(i, r, e, o))
1280
+ return {
1281
+ changes: { insert: e + e, from: r },
1282
+ effects: A.of(r + e.length),
1283
+ range: w.cursor(r + e.length)
1284
+ };
1285
+ }
1286
+ return { range: s = a };
1287
+ });
1288
+ return s ? null : i.update(l, {
1289
+ scrollIntoView: !0,
1290
+ userEvent: "input.type"
1291
+ });
1292
+ }
1293
+ function me(i, e) {
1294
+ let t = q(i).resolveInner(e + 1);
1295
+ return t.parent && t.from == e;
1296
+ }
1297
+ function Lt(i, e, t, n) {
1298
+ let o = q(i).resolveInner(e, -1), s = n.reduce((l, a) => Math.max(l, a.length), 0);
1299
+ for (let l = 0; l < 5; l++) {
1300
+ let a = i.sliceDoc(o.from, Math.min(o.to, o.from + t.length + s)), r = a.indexOf(t);
1301
+ if (!r || r > -1 && n.indexOf(a.slice(0, r)) > -1) {
1302
+ let c = o.firstChild;
1303
+ for (; c && c.from == o.from && c.to - c.from > t.length + r; ) {
1304
+ if (i.sliceDoc(c.to - t.length, c.to) == t)
1305
+ return !1;
1306
+ c = c.firstChild;
1307
+ }
1308
+ return !0;
1309
+ }
1310
+ let h = o.to == e && o.parent;
1311
+ if (!h)
1312
+ break;
1313
+ o = h;
1314
+ }
1315
+ return !1;
1316
+ }
1317
+ function ge(i, e, t) {
1318
+ let n = i.charCategorizer(e);
1319
+ if (n(i.sliceDoc(e - 1, e)) != J.Word)
1320
+ return e;
1321
+ for (let o of t) {
1322
+ let s = e - o.length;
1323
+ if (i.sliceDoc(s, e) == o && n(i.sliceDoc(s - 1, s)) != J.Word)
1324
+ return s;
1325
+ }
1326
+ return -1;
1327
+ }
1328
+ function Vt(i = {}) {
1329
+ return [
1330
+ ut,
1331
+ x,
1332
+ g.of(i),
1333
+ ht,
1334
+ Bt,
1335
+ Te
1336
+ ];
1337
+ }
1338
+ const kt = [
1339
+ { key: "Ctrl-Space", run: X },
1340
+ { mac: "Alt-`", run: X },
1341
+ { mac: "Alt-i", run: X },
1342
+ { key: "Escape", run: rt },
1343
+ { key: "ArrowDown", run: /* @__PURE__ */ W(!0) },
1344
+ { key: "ArrowUp", run: /* @__PURE__ */ W(!1) },
1345
+ { key: "PageDown", run: /* @__PURE__ */ W(!0, "page") },
1346
+ { key: "PageUp", run: /* @__PURE__ */ W(!1, "page") },
1347
+ { key: "Enter", run: lt }
1348
+ ], Bt = /* @__PURE__ */ ee.highest(/* @__PURE__ */ xe.computeN([g], (i) => i.facet(g).defaultKeymap ? [kt] : []));
1349
+ export {
1350
+ Ce as CompletionContext,
1351
+ lt as acceptCompletion,
1352
+ Vt as autocompletion,
1353
+ xt as clearSnippet,
1354
+ jt as closeBrackets,
1355
+ Ht as closeBracketsKeymap,
1356
+ rt as closeCompletion,
1357
+ Ve as completeFromList,
1358
+ kt as completionKeymap,
1359
+ At as deleteBracketPair,
1360
+ Ut as ifNotIn,
1361
+ Et as insertBracket,
1362
+ qe as insertCompletionText,
1363
+ W as moveCompletionSelection,
1364
+ wt as nextSnippetField,
1365
+ te as pickedCompletion,
1366
+ Ct as prevSnippetField,
1367
+ bt as snippet,
1368
+ Wt as snippetCompletion,
1369
+ de as snippetKeymap,
1370
+ X as startCompletion
1371
+ };