@marimo-team/islands 0.23.10-dev24 → 0.23.10-dev25

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 (75) hide show
  1. package/dist/{any-language-editor-QDDrgvfh.js → any-language-editor-DNmoSiWL.js} +18 -18
  2. package/dist/{chat-ui-BrKSZ7Yu.js → chat-ui-D6oraHT2.js} +11 -11
  3. package/dist/{code-visibility-CVmFerQM.js → code-visibility-CXkMXcdB.js} +5 -5
  4. package/dist/dist-7QfXoMdB.js +5 -0
  5. package/dist/{dist-DgnE8F-r.js → dist-A2846XWO.js} +1 -1
  6. package/dist/dist-BEXXyZig.js +5 -0
  7. package/dist/{dist-B3pZ0Ab6.js → dist-BR_gyG9L.js} +3 -3
  8. package/dist/{dist-CcXxepx6.js → dist-BSAt6RhH.js} +27 -27
  9. package/dist/{dist-Bde4a2kU.js → dist-BY018Paw.js} +8 -8
  10. package/dist/dist-BYj57OV4.js +5 -0
  11. package/dist/{dist-CUCNs1ja.js → dist-BaoDKvdy.js} +2 -2
  12. package/dist/{dist-Cy1WxgBD.js → dist-Bf7SHuNp.js} +5 -5
  13. package/dist/{dist-Bz_sYWbr.js → dist-Bk75fBZA.js} +2 -2
  14. package/dist/dist-BlSvQzNr.js +5 -0
  15. package/dist/{dist-C5VC_yzu.js → dist-BzEzfugY.js} +1 -1
  16. package/dist/dist-CCBlxAgS.js +8 -0
  17. package/dist/dist-CIDTVIUf.js +5 -0
  18. package/dist/{dist-CLUtPrdy.js → dist-CIYBwstr.js} +1 -1
  19. package/dist/{dist-BotSqB48.js → dist-C_Y3oV3C.js} +12 -12
  20. package/dist/{dist-BTfv03uy.js → dist-CcWX6tmx.js} +2 -2
  21. package/dist/{dist-BhM8gdSO.js → dist-CoXAujgg.js} +4 -4
  22. package/dist/{dist-4j4c7bjm.js → dist-CpxNdDkw.js} +3 -3
  23. package/dist/dist-CqQyhAM8.js +8 -0
  24. package/dist/dist-CwRu2Xzh.js +5 -0
  25. package/dist/{dist-BcuoonNH.js → dist-CxJDU6Bh.js} +9 -9
  26. package/dist/{dist-DxvORzUR.js → dist-D-W5ny5a.js} +8 -8
  27. package/dist/dist-D8CDTVgf.js +6 -0
  28. package/dist/dist-D8DNB0nO.js +8 -0
  29. package/dist/dist-DL6N_q-A.js +5 -0
  30. package/dist/{dist-BbbIBDiQ.js → dist-DMjWuVs8.js} +1 -1
  31. package/dist/dist-DOFbNV_b.js +8 -0
  32. package/dist/dist-DPrYzMY0.js +6 -0
  33. package/dist/{dist-h2c8sZvT.js → dist-DZORgqKY.js} +1 -1
  34. package/dist/{dist-B3P2fFpz.js → dist-DZo4nSS0.js} +14 -14
  35. package/dist/{dist-D4CewLk6.js → dist-Dax--nl9.js} +1 -1
  36. package/dist/{dist-DRfcqpxJ.js → dist-DgGbNavJ.js} +2 -2
  37. package/dist/{dist-fQ0ViXGs.js → dist-Dv_Y15yk.js} +107 -107
  38. package/dist/{dist-Bfwsv11D.js → dist-DyyjKEYf.js} +2 -2
  39. package/dist/{dist-p2qyWijU.js → dist-GZXUmt0b.js} +2 -2
  40. package/dist/{dist-CLJWPTX2.js → dist-LTU8Hdvn.js} +3 -3
  41. package/dist/{dist-DqAWR3CS.js → dist-M9Vag9Y0.js} +20 -20
  42. package/dist/{dist-DNdhYsgW.js → dist-U4F-tbMs.js} +79 -62
  43. package/dist/{dist-RqXTaiir.js → dist-abid3KgM.js} +11 -11
  44. package/dist/dist-cdmMjgsn.js +5 -0
  45. package/dist/dist-hT4QzYX-.js +1247 -0
  46. package/dist/{dist-luvabDEB.js → dist-t9Kf7xqC.js} +2 -2
  47. package/dist/esm-BaH2eg5-.js +1171 -0
  48. package/dist/{esm-Duie8iU-.js → esm-ga2Bf3O2.js} +43 -43
  49. package/dist/{extends-C3j0Pbh9.js → extends-D_hDsj6R.js} +1 -1
  50. package/dist/{html-to-image-D5fIgQg_.js → html-to-image-UEH5lFDZ.js} +2162 -2139
  51. package/dist/main.js +24 -24
  52. package/dist/{process-output-B59yoBQx.js → process-output-CyMLTogj.js} +1 -1
  53. package/dist/{reveal-component-bghJ00sb.js → reveal-component-dIolR_34.js} +8 -8
  54. package/dist/style.css +1 -1
  55. package/package.json +1 -1
  56. package/src/components/editor/documentation.css +19 -0
  57. package/src/core/codemirror/language/languages/python.ts +2 -0
  58. package/src/core/codemirror/lsp/__tests__/markdown-renderer.test.ts +41 -0
  59. package/src/core/codemirror/lsp/markdown-renderer.ts +59 -0
  60. package/dist/dist-0Fif7jnk.js +0 -5
  61. package/dist/dist-B5h_9sHB.js +0 -6
  62. package/dist/dist-B9M6R5ye.js +0 -5
  63. package/dist/dist-BCt3tnck.js +0 -8
  64. package/dist/dist-BUIJwMwn.js +0 -8
  65. package/dist/dist-BpquMd3k.js +0 -5
  66. package/dist/dist-BzJsqYfz.js +0 -5
  67. package/dist/dist-CA5ELXAf.js +0 -6
  68. package/dist/dist-CLBRs6Uv.js +0 -5
  69. package/dist/dist-CStVCMbq.js +0 -5
  70. package/dist/dist-CZRIEY3Y.js +0 -8
  71. package/dist/dist-CuUHbFD0.js +0 -5
  72. package/dist/dist-DV7Iabxb.js +0 -8
  73. package/dist/dist-DhHh0jLg.js +0 -1247
  74. package/dist/dist-DuEeHMvL.js +0 -5
  75. package/dist/esm-DzhtSSSq.js +0 -1171
@@ -1,1247 +0,0 @@
1
- import { $ as ViewPlugin, At as Prec, Bt as combineConfig, Et as EditorSelection, Ft as StateField, I as syntaxTree, It as Text, Lt as Transaction, Nt as RangeValue, Ot as Facet, Pt as StateEffect, Rt as codePointAt, Ut as fromCodePoint, X as Direction, Y as Decoration, Z as EditorView, at as getTooltip, dt as keymap, et as WidgetType, j as indentUnit, jt as RangeSet, kt as MapMode, pt as logException, wt as CharCategory, xt as Annotation, yt as showTooltip, zt as codePointSize } from "./dist-DNdhYsgW.js";
2
- var CompletionContext = class {
3
- constructor(i8, N, P, F) {
4
- this.state = i8, this.pos = N, this.explicit = P, this.view = F, this.abortListeners = [], this.abortOnDocChange = false;
5
- }
6
- tokenBefore(i8) {
7
- let N = syntaxTree(this.state).resolveInner(this.pos, -1);
8
- for (; N && i8.indexOf(N.name) < 0; ) N = N.parent;
9
- return N ? {
10
- from: N.from,
11
- to: this.pos,
12
- text: this.state.sliceDoc(N.from, this.pos),
13
- type: N.type
14
- } : null;
15
- }
16
- matchBefore(i8) {
17
- let N = this.state.doc.lineAt(this.pos), P = Math.max(N.from, this.pos - 250), F = N.text.slice(P - N.from, this.pos - N.from), I = F.search(ensureAnchor(i8, false));
18
- return I < 0 ? null : {
19
- from: P + I,
20
- to: this.pos,
21
- text: F.slice(I)
22
- };
23
- }
24
- get aborted() {
25
- return this.abortListeners == null;
26
- }
27
- addEventListener(i8, N, P) {
28
- i8 == "abort" && this.abortListeners && (this.abortListeners.push(N), P && P.onDocChange && (this.abortOnDocChange = true));
29
- }
30
- };
31
- function toSet(i8) {
32
- let N = Object.keys(i8).join(""), P = /\w/.test(N);
33
- return P && (N = N.replace(/\w/g, "")), `[${P ? "\\w" : ""}${N.replace(/[^\w\s]/g, "\\$&")}]`;
34
- }
35
- function prefixMatch(i8) {
36
- let N = /* @__PURE__ */ Object.create(null), P = /* @__PURE__ */ Object.create(null);
37
- for (let { label: F2 } of i8) {
38
- N[F2[0]] = true;
39
- for (let i9 = 1; i9 < F2.length; i9++) P[F2[i9]] = true;
40
- }
41
- let F = toSet(N) + toSet(P) + "*$";
42
- return [/* @__PURE__ */ RegExp("^" + F), new RegExp(F)];
43
- }
44
- function completeFromList(i8) {
45
- let N = i8.map((i9) => typeof i9 == "string" ? { label: i9 } : i9), [P, F] = N.every((i9) => /^\w+$/.test(i9.label)) ? [/\w*$/, /\w+$/] : prefixMatch(N);
46
- return (i9) => {
47
- let I = i9.matchBefore(F);
48
- return I || i9.explicit ? {
49
- from: I ? I.from : i9.pos,
50
- options: N,
51
- validFor: P
52
- } : null;
53
- };
54
- }
55
- function ifNotIn(i8, N) {
56
- return (P) => {
57
- for (let N2 = syntaxTree(P.state).resolveInner(P.pos, -1); N2; N2 = N2.parent) {
58
- if (i8.indexOf(N2.name) > -1) return null;
59
- if (N2.type.isTop) break;
60
- }
61
- return N(P);
62
- };
63
- }
64
- var Option = class {
65
- constructor(i8, N, P, F) {
66
- this.completion = i8, this.source = N, this.match = P, this.score = F;
67
- }
68
- };
69
- function cur(i8) {
70
- return i8.selection.main.from;
71
- }
72
- function ensureAnchor(i8, N) {
73
- let { source: P } = i8, F = N && P[0] != "^", I = P[P.length - 1] != "$";
74
- return !F && !I ? i8 : RegExp(`${F ? "^" : ""}(?:${P})${I ? "$" : ""}`, i8.flags ?? (i8.ignoreCase ? "i" : ""));
75
- }
76
- var pickedCompletion = /* @__PURE__ */ Annotation.define();
77
- function insertCompletionText(i8, N, P, I) {
78
- let { main: L } = i8.selection, R = P - L.from, z = I - L.from;
79
- return {
80
- ...i8.changeByRange((B) => {
81
- if (B != L && P != I && i8.sliceDoc(B.from + R, B.from + z) != i8.sliceDoc(P, I)) return { range: B };
82
- let V = i8.toText(N);
83
- return {
84
- changes: {
85
- from: B.from + R,
86
- to: I == L.from ? B.to : B.from + z,
87
- insert: V
88
- },
89
- range: EditorSelection.cursor(B.from + R + V.length)
90
- };
91
- }),
92
- scrollIntoView: true,
93
- userEvent: "input.complete"
94
- };
95
- }
96
- var SourceCache = /* @__PURE__ */ new WeakMap();
97
- function asSource(i8) {
98
- if (!Array.isArray(i8)) return i8;
99
- let N = SourceCache.get(i8);
100
- return N || SourceCache.set(i8, N = completeFromList(i8)), N;
101
- }
102
- var startCompletionEffect = /* @__PURE__ */ StateEffect.define(), closeCompletionEffect = /* @__PURE__ */ StateEffect.define(), FuzzyMatcher = class {
103
- constructor(i8) {
104
- this.pattern = i8, this.chars = [], this.folded = [], this.any = [], this.precise = [], this.byWord = [], this.score = 0, this.matched = [];
105
- for (let N = 0; N < i8.length; ) {
106
- let P = codePointAt(i8, N), F = codePointSize(P);
107
- this.chars.push(P);
108
- let I = i8.slice(N, N + F), L = I.toUpperCase();
109
- this.folded.push(codePointAt(L == I ? I.toLowerCase() : L, 0)), N += F;
110
- }
111
- this.astral = i8.length != this.chars.length;
112
- }
113
- ret(i8, N) {
114
- return this.score = i8, this.matched = N, this;
115
- }
116
- match(i8) {
117
- if (this.pattern.length == 0) return this.ret(-100, []);
118
- if (i8.length < this.pattern.length) return null;
119
- let { chars: N, folded: P, any: F, precise: I, byWord: L } = this;
120
- if (N.length == 1) {
121
- let F2 = codePointAt(i8, 0), I2 = codePointSize(F2), L2 = I2 == i8.length ? 0 : -100;
122
- if (F2 != N[0]) if (F2 == P[0]) L2 += -200;
123
- else return null;
124
- return this.ret(L2, [0, I2]);
125
- }
126
- let R = i8.indexOf(this.pattern);
127
- if (R == 0) return this.ret(i8.length == this.pattern.length ? 0 : -100, [0, this.pattern.length]);
128
- let z = N.length, B = 0;
129
- if (R < 0) {
130
- for (let I2 = 0, L2 = Math.min(i8.length, 200); I2 < L2 && B < z; ) {
131
- let L3 = codePointAt(i8, I2);
132
- (L3 == N[B] || L3 == P[B]) && (F[B++] = I2), I2 += codePointSize(L3);
133
- }
134
- if (B < z) return null;
135
- }
136
- let V = 0, H = 0, G = false, K = 0, q = -1, J = -1, Y = /[a-z]/.test(i8), X = true;
137
- for (let F2 = 0, B2 = Math.min(i8.length, 200), Z = 0; F2 < B2 && H < z; ) {
138
- let B3 = codePointAt(i8, F2);
139
- R < 0 && (V < z && B3 == N[V] && (I[V++] = F2), K < z && (B3 == N[K] || B3 == P[K] ? (K == 0 && (q = F2), J = F2 + 1, K++) : K = 0));
140
- let Q, $ = B3 < 255 ? B3 >= 48 && B3 <= 57 || B3 >= 97 && B3 <= 122 ? 2 : B3 >= 65 && B3 <= 90 ? 1 : 0 : (Q = fromCodePoint(B3)) == Q.toLowerCase() ? Q == Q.toUpperCase() ? 0 : 2 : 1;
141
- (!F2 || $ == 1 && Y || Z == 0 && $ != 0) && (N[H] == B3 || P[H] == B3 && (G = true) ? L[H++] = F2 : L.length && (X = false)), Z = $, F2 += codePointSize(B3);
142
- }
143
- return H == z && L[0] == 0 && X ? this.result(-100 + (G ? -200 : 0), L, i8) : K == z && q == 0 ? this.ret(-200 - i8.length + (J == i8.length ? 0 : -100), [0, J]) : R > -1 ? this.ret(-700 - i8.length, [R, R + this.pattern.length]) : K == z ? this.ret(-900 - i8.length, [q, J]) : H == z ? this.result(-100 + (G ? -200 : 0) + -700 + (X ? 0 : -1100), L, i8) : N.length == 2 ? null : this.result((F[0] ? -700 : 0) + -200 + -1100, F, i8);
144
- }
145
- result(i8, N, P) {
146
- let F = [], I = 0;
147
- for (let i9 of N) {
148
- let N2 = i9 + (this.astral ? codePointSize(codePointAt(P, i9)) : 1);
149
- I && F[I - 1] == i9 ? F[I - 1] = N2 : (F[I++] = i9, F[I++] = N2);
150
- }
151
- return this.ret(i8 - P.length, F);
152
- }
153
- }, StrictMatcher = class {
154
- constructor(i8) {
155
- this.pattern = i8, this.matched = [], this.score = 0, this.folded = i8.toLowerCase();
156
- }
157
- match(i8) {
158
- if (i8.length < this.pattern.length) return null;
159
- let N = i8.slice(0, this.pattern.length), P = N == this.pattern ? 0 : N.toLowerCase() == this.folded ? -200 : null;
160
- return P == null ? null : (this.matched = [0, N.length], this.score = P + (i8.length == this.pattern.length ? 0 : -100), this);
161
- }
162
- }, completionConfig = /* @__PURE__ */ Facet.define({ combine(i8) {
163
- return combineConfig(i8, {
164
- activateOnTyping: true,
165
- activateOnCompletion: () => false,
166
- activateOnTypingDelay: 100,
167
- selectOnOpen: true,
168
- override: null,
169
- closeOnBlur: true,
170
- maxRenderedOptions: 100,
171
- defaultKeymap: true,
172
- tooltipClass: () => "",
173
- optionClass: () => "",
174
- aboveCursor: false,
175
- icons: true,
176
- addToOptions: [],
177
- positionInfo: defaultPositionInfo,
178
- filterStrict: false,
179
- compareCompletions: (i9, N) => (i9.sortText || i9.label).localeCompare(N.sortText || N.label),
180
- interactionDelay: 75,
181
- updateSyncTime: 100
182
- }, {
183
- defaultKeymap: (i9, N) => i9 && N,
184
- closeOnBlur: (i9, N) => i9 && N,
185
- icons: (i9, N) => i9 && N,
186
- tooltipClass: (i9, N) => (P) => joinClass(i9(P), N(P)),
187
- optionClass: (i9, N) => (P) => joinClass(i9(P), N(P)),
188
- addToOptions: (i9, N) => i9.concat(N),
189
- filterStrict: (i9, N) => i9 || N
190
- });
191
- } });
192
- function joinClass(i8, N) {
193
- return i8 ? N ? i8 + " " + N : i8 : N;
194
- }
195
- function defaultPositionInfo(i8, N, P, F, I, L) {
196
- let R = i8.textDirection == Direction.RTL, z = R, B = false, V = "top", H, U, W = N.left - I.left, K = I.right - N.right, q = F.right - F.left, J = F.bottom - F.top;
197
- if (z && W < Math.min(q, K) ? z = false : !z && K < Math.min(q, W) && (z = true), q <= (z ? W : K)) H = Math.max(I.top, Math.min(P.top, I.bottom - J)) - N.top, U = Math.min(400, z ? W : K);
198
- else {
199
- B = true, U = Math.min(400, (R ? N.right : I.right - N.left) - 30);
200
- let i9 = I.bottom - N.bottom;
201
- i9 >= J || i9 > N.top ? H = P.bottom - N.top : (V = "bottom", H = N.bottom - P.top);
202
- }
203
- let Y = (N.bottom - N.top) / L.offsetHeight, X = (N.right - N.left) / L.offsetWidth;
204
- return {
205
- style: `${V}: ${H / Y}px; max-width: ${U / X}px`,
206
- class: "cm-completionInfo-" + (B ? R ? "left-narrow" : "right-narrow" : z ? "left" : "right")
207
- };
208
- }
209
- var setSelectedEffect = /* @__PURE__ */ StateEffect.define();
210
- function optionContent(i8) {
211
- let N = i8.addToOptions.slice();
212
- return i8.icons && N.push({
213
- render(i9) {
214
- let N2 = document.createElement("div");
215
- return N2.classList.add("cm-completionIcon"), i9.type && N2.classList.add(...i9.type.split(/\s+/g).map((i10) => "cm-completionIcon-" + i10)), N2.setAttribute("aria-hidden", "true"), N2;
216
- },
217
- position: 20
218
- }), N.push({
219
- render(i9, N2, P, F) {
220
- let I = document.createElement("span");
221
- I.className = "cm-completionLabel";
222
- let L = i9.displayLabel || i9.label, R = 0;
223
- for (let i10 = 0; i10 < F.length; ) {
224
- let N3 = F[i10++], P2 = F[i10++];
225
- N3 > R && I.appendChild(document.createTextNode(L.slice(R, N3)));
226
- let z = I.appendChild(document.createElement("span"));
227
- z.appendChild(document.createTextNode(L.slice(N3, P2))), z.className = "cm-completionMatchedText", R = P2;
228
- }
229
- return R < L.length && I.appendChild(document.createTextNode(L.slice(R))), I;
230
- },
231
- position: 50
232
- }, {
233
- render(i9) {
234
- if (!i9.detail) return null;
235
- let N2 = document.createElement("span");
236
- return N2.className = "cm-completionDetail", N2.textContent = i9.detail, N2;
237
- },
238
- position: 80
239
- }), N.sort((i9, N2) => i9.position - N2.position).map((i9) => i9.render);
240
- }
241
- function rangeAroundSelected(i8, N, P) {
242
- if (i8 <= P) return {
243
- from: 0,
244
- to: i8
245
- };
246
- if (N < 0 && (N = 0), N <= i8 >> 1) {
247
- let i9 = Math.floor(N / P);
248
- return {
249
- from: i9 * P,
250
- to: (i9 + 1) * P
251
- };
252
- }
253
- let F = Math.floor((i8 - N) / P);
254
- return {
255
- from: i8 - (F + 1) * P,
256
- to: i8 - F * P
257
- };
258
- }
259
- var CompletionTooltip = class {
260
- constructor(i8, N, P) {
261
- this.view = i8, this.stateField = N, this.applyCompletion = P, this.info = null, this.infoDestroy = null, this.placeInfoReq = {
262
- read: () => this.measureInfo(),
263
- write: (i9) => this.placeInfo(i9),
264
- key: this
265
- }, this.space = null, this.currentClass = "";
266
- let F = i8.state.field(N), { options: I, selected: L } = F.open, R = i8.state.facet(completionConfig);
267
- this.optionContent = optionContent(R), this.optionClass = R.optionClass, this.tooltipClass = R.tooltipClass, this.range = rangeAroundSelected(I.length, L, R.maxRenderedOptions), this.dom = document.createElement("div"), this.dom.className = "cm-tooltip-autocomplete", this.updateTooltipClass(i8.state), this.dom.addEventListener("mousedown", (P2) => {
268
- let { options: F2 } = i8.state.field(N).open;
269
- for (let N2 = P2.target, I2; N2 && N2 != this.dom; N2 = N2.parentNode) if (N2.nodeName == "LI" && (I2 = /-(\d+)$/.exec(N2.id)) && +I2[1] < F2.length) {
270
- this.applyCompletion(i8, F2[+I2[1]]), P2.preventDefault();
271
- return;
272
- }
273
- if (P2.target == this.list) {
274
- let N2 = this.list.classList.contains("cm-completionListIncompleteTop") && P2.clientY < this.list.firstChild.getBoundingClientRect().top ? this.range.from - 1 : this.list.classList.contains("cm-completionListIncompleteBottom") && P2.clientY > this.list.lastChild.getBoundingClientRect().bottom ? this.range.to : null;
275
- N2 != null && (i8.dispatch({ effects: setSelectedEffect.of(N2) }), P2.preventDefault());
276
- }
277
- }), this.dom.addEventListener("focusout", (N2) => {
278
- let P2 = i8.state.field(this.stateField, false);
279
- P2 && P2.tooltip && i8.state.facet(completionConfig).closeOnBlur && N2.relatedTarget != i8.contentDOM && i8.dispatch({ effects: closeCompletionEffect.of(null) });
280
- }), this.showOptions(I, F.id);
281
- }
282
- mount() {
283
- this.updateSel();
284
- }
285
- showOptions(i8, N) {
286
- this.list && this.list.remove(), this.list = this.dom.appendChild(this.createListBox(i8, N, this.range)), this.list.addEventListener("scroll", () => {
287
- this.info && this.view.requestMeasure(this.placeInfoReq);
288
- });
289
- }
290
- update(i8) {
291
- var _a;
292
- let N = i8.state.field(this.stateField), P = i8.startState.field(this.stateField);
293
- if (this.updateTooltipClass(i8.state), N != P) {
294
- let { options: F, selected: I, disabled: L } = N.open;
295
- (!P.open || P.open.options != F) && (this.range = rangeAroundSelected(F.length, I, i8.state.facet(completionConfig).maxRenderedOptions), this.showOptions(F, N.id)), this.updateSel(), L != ((_a = P.open) == null ? void 0 : _a.disabled) && this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!L);
296
- }
297
- }
298
- updateTooltipClass(i8) {
299
- let N = this.tooltipClass(i8);
300
- if (N != this.currentClass) {
301
- for (let i9 of this.currentClass.split(" ")) i9 && this.dom.classList.remove(i9);
302
- for (let i9 of N.split(" ")) i9 && this.dom.classList.add(i9);
303
- this.currentClass = N;
304
- }
305
- }
306
- positioned(i8) {
307
- this.space = i8, this.info && this.view.requestMeasure(this.placeInfoReq);
308
- }
309
- updateSel() {
310
- let i8 = this.view.state.field(this.stateField), N = i8.open;
311
- (N.selected > -1 && N.selected < this.range.from || N.selected >= this.range.to) && (this.range = rangeAroundSelected(N.options.length, N.selected, this.view.state.facet(completionConfig).maxRenderedOptions), this.showOptions(N.options, i8.id));
312
- let P = this.updateSelectedOption(N.selected);
313
- if (P) {
314
- this.destroyInfo();
315
- let { completion: F } = N.options[N.selected], { info: I } = F;
316
- if (!I) return;
317
- let L = typeof I == "string" ? document.createTextNode(I) : I(F);
318
- if (!L) return;
319
- "then" in L ? L.then((N2) => {
320
- N2 && this.view.state.field(this.stateField, false) == i8 && this.addInfoPane(N2, F);
321
- }).catch((i9) => logException(this.view.state, i9, "completion info")) : (this.addInfoPane(L, F), P.setAttribute("aria-describedby", this.info.id));
322
- }
323
- }
324
- addInfoPane(i8, N) {
325
- this.destroyInfo();
326
- let P = this.info = document.createElement("div");
327
- if (P.className = "cm-tooltip cm-completionInfo", P.id = "cm-completionInfo-" + Math.floor(Math.random() * 65535).toString(16), i8.nodeType != null) P.appendChild(i8), this.infoDestroy = null;
328
- else {
329
- let { dom: N2, destroy: F } = i8;
330
- P.appendChild(N2), this.infoDestroy = F || null;
331
- }
332
- this.dom.appendChild(P), this.view.requestMeasure(this.placeInfoReq);
333
- }
334
- updateSelectedOption(i8) {
335
- let N = null;
336
- for (let P = this.list.firstChild, F = this.range.from; P; P = P.nextSibling, F++) P.nodeName != "LI" || !P.id ? F-- : F == i8 ? P.hasAttribute("aria-selected") || (P.setAttribute("aria-selected", "true"), N = P) : P.hasAttribute("aria-selected") && (P.removeAttribute("aria-selected"), P.removeAttribute("aria-describedby"));
337
- return N && scrollIntoView(this.list, N), N;
338
- }
339
- measureInfo() {
340
- let i8 = this.dom.querySelector("[aria-selected]");
341
- if (!i8 || !this.info) return null;
342
- let N = this.dom.getBoundingClientRect(), P = this.info.getBoundingClientRect(), F = i8.getBoundingClientRect(), I = this.space;
343
- if (!I) {
344
- let i9 = this.dom.ownerDocument.documentElement;
345
- I = {
346
- left: 0,
347
- top: 0,
348
- right: i9.clientWidth,
349
- bottom: i9.clientHeight
350
- };
351
- }
352
- return F.top > Math.min(I.bottom, N.bottom) - 10 || F.bottom < Math.max(I.top, N.top) + 10 ? null : this.view.state.facet(completionConfig).positionInfo(this.view, N, F, P, I, this.dom);
353
- }
354
- placeInfo(i8) {
355
- this.info && (i8 ? (i8.style && (this.info.style.cssText = i8.style), this.info.className = "cm-tooltip cm-completionInfo " + (i8.class || "")) : this.info.style.cssText = "top: -1e6px");
356
- }
357
- createListBox(i8, N, P) {
358
- let F = document.createElement("ul");
359
- F.id = N, F.setAttribute("role", "listbox"), F.setAttribute("aria-expanded", "true"), F.setAttribute("aria-label", this.view.state.phrase("Completions")), F.addEventListener("mousedown", (i9) => {
360
- i9.target == F && i9.preventDefault();
361
- });
362
- let I = null;
363
- for (let L = P.from; L < P.to; L++) {
364
- let { completion: R, match: z } = i8[L], { section: B } = R;
365
- if (B) {
366
- let i9 = typeof B == "string" ? B : B.name;
367
- if (i9 != I && (L > P.from || P.from == 0)) if (I = i9, typeof B != "string" && B.header) F.appendChild(B.header(B));
368
- else {
369
- let N2 = F.appendChild(document.createElement("completion-section"));
370
- N2.textContent = i9;
371
- }
372
- }
373
- let V = F.appendChild(document.createElement("li"));
374
- V.id = N + "-" + L, V.setAttribute("role", "option");
375
- let H = this.optionClass(R);
376
- H && (V.className = H);
377
- for (let i9 of this.optionContent) {
378
- let N2 = i9(R, this.view.state, this.view, z);
379
- N2 && V.appendChild(N2);
380
- }
381
- }
382
- return P.from && F.classList.add("cm-completionListIncompleteTop"), P.to < i8.length && F.classList.add("cm-completionListIncompleteBottom"), F;
383
- }
384
- destroyInfo() {
385
- this.info && (this.info = (this.infoDestroy && this.infoDestroy(), this.info.remove(), null));
386
- }
387
- destroy() {
388
- this.destroyInfo();
389
- }
390
- };
391
- function completionTooltip(i8, N) {
392
- return (P) => new CompletionTooltip(P, i8, N);
393
- }
394
- function scrollIntoView(i8, N) {
395
- let P = i8.getBoundingClientRect(), F = N.getBoundingClientRect(), I = P.height / i8.offsetHeight;
396
- F.top < P.top ? i8.scrollTop -= (P.top - F.top) / I : F.bottom > P.bottom && (i8.scrollTop += (F.bottom - P.bottom) / I);
397
- }
398
- function score(i8) {
399
- return (i8.boost || 0) * 100 + (i8.apply ? 10 : 0) + (i8.info ? 5 : 0) + (i8.type ? 1 : 0);
400
- }
401
- function sortOptions(i8, N) {
402
- let P = [], F = null, I = null, L = (i9) => {
403
- P.push(i9);
404
- let { section: N2 } = i9.completion;
405
- if (N2) {
406
- F || (F = []);
407
- let i10 = typeof N2 == "string" ? N2 : N2.name;
408
- F.some((N3) => N3.name == i10) || F.push(typeof N2 == "string" ? { name: i10 } : N2);
409
- }
410
- }, R = N.facet(completionConfig);
411
- for (let F2 of i8) if (F2.hasResult()) {
412
- let i9 = F2.result.getMatch;
413
- if (F2.result.filter === false) for (let N2 of F2.result.options) L(new Option(N2, F2.source, i9 ? i9(N2) : [], 1e9 - P.length));
414
- else {
415
- let P2 = N.sliceDoc(F2.from, F2.to), z2, B2 = R.filterStrict ? new StrictMatcher(P2) : new FuzzyMatcher(P2);
416
- for (let N2 of F2.result.options) if (z2 = B2.match(N2.label)) {
417
- let P3 = N2.displayLabel ? i9 ? i9(N2, z2.matched) : [] : z2.matched, R2 = z2.score + (N2.boost || 0);
418
- if (L(new Option(N2, F2.source, P3, R2)), typeof N2.section == "object" && N2.section.rank === "dynamic") {
419
- let { name: i10 } = N2.section;
420
- I || (I = /* @__PURE__ */ Object.create(null)), I[i10] = Math.max(R2, I[i10] || -1e9);
421
- }
422
- }
423
- }
424
- }
425
- if (F) {
426
- let i9 = /* @__PURE__ */ Object.create(null), N2 = 0, L2 = (i10, N3) => (i10.rank === "dynamic" && N3.rank === "dynamic" ? I[N3.name] - I[i10.name] : 0) || (typeof i10.rank == "number" ? i10.rank : 1e9) - (typeof N3.rank == "number" ? N3.rank : 1e9) || (i10.name < N3.name ? -1 : 1);
427
- for (let P2 of F.sort(L2)) N2 -= 1e5, i9[P2.name] = N2;
428
- for (let N3 of P) {
429
- let { section: P2 } = N3.completion;
430
- P2 && (N3.score += i9[typeof P2 == "string" ? P2 : P2.name]);
431
- }
432
- }
433
- let z = [], B = null, V = R.compareCompletions;
434
- for (let i9 of P.sort((i10, N2) => N2.score - i10.score || V(i10.completion, N2.completion))) {
435
- let N2 = i9.completion;
436
- !B || B.label != N2.label || B.detail != N2.detail || B.type != null && N2.type != null && B.type != N2.type || B.apply != N2.apply || B.boost != N2.boost ? z.push(i9) : score(i9.completion) > score(B) && (z[z.length - 1] = i9), B = i9.completion;
437
- }
438
- return z;
439
- }
440
- var CompletionDialog = class i {
441
- constructor(i8, N, P, F, I, L) {
442
- this.options = i8, this.attrs = N, this.tooltip = P, this.timestamp = F, this.selected = I, this.disabled = L;
443
- }
444
- setSelected(N, P) {
445
- return N == this.selected || N >= this.options.length ? this : new i(this.options, makeAttrs(P, N), this.tooltip, this.timestamp, N, this.disabled);
446
- }
447
- static build(N, P, F, I, L, R) {
448
- if (I && !R && N.some((i8) => i8.isPending)) return I.setDisabled();
449
- let z = sortOptions(N, P);
450
- if (!z.length) return I && N.some((i8) => i8.isPending) ? I.setDisabled() : null;
451
- let B = P.facet(completionConfig).selectOnOpen ? 0 : -1;
452
- if (I && I.selected != B && I.selected != -1) {
453
- let i8 = I.options[I.selected].completion;
454
- for (let N2 = 0; N2 < z.length; N2++) if (z[N2].completion == i8) {
455
- B = N2;
456
- break;
457
- }
458
- }
459
- return new i(z, makeAttrs(F, B), {
460
- pos: N.reduce((i8, N2) => N2.hasResult() ? Math.min(i8, N2.from) : i8, 1e8),
461
- create: createTooltip,
462
- above: L.aboveCursor
463
- }, I ? I.timestamp : Date.now(), B, false);
464
- }
465
- map(N) {
466
- return new i(this.options, this.attrs, {
467
- ...this.tooltip,
468
- pos: N.mapPos(this.tooltip.pos)
469
- }, this.timestamp, this.selected, this.disabled);
470
- }
471
- setDisabled() {
472
- return new i(this.options, this.attrs, this.tooltip, this.timestamp, this.selected, true);
473
- }
474
- }, CompletionState = class i2 {
475
- constructor(i8, N, P) {
476
- this.active = i8, this.id = N, this.open = P;
477
- }
478
- static start() {
479
- return new i2(none, "cm-ac-" + Math.floor(Math.random() * 2e6).toString(36), null);
480
- }
481
- update(N) {
482
- let { state: P } = N, F = P.facet(completionConfig), I = (F.override || P.languageDataAt("autocomplete", cur(P)).map(asSource)).map((i8) => (this.active.find((N2) => N2.source == i8) || new ActiveSource(i8, this.active.some((i9) => i9.state != 0) ? 1 : 0)).update(N, F));
483
- I.length == this.active.length && I.every((i8, N2) => i8 == this.active[N2]) && (I = this.active);
484
- let L = this.open, R = N.effects.some((i8) => i8.is(setActiveEffect));
485
- L && N.docChanged && (L = L.map(N.changes)), N.selection || I.some((i8) => i8.hasResult() && N.changes.touchesRange(i8.from, i8.to)) || !sameResults(I, this.active) || R ? L = CompletionDialog.build(I, P, this.id, L, F, R) : L && L.disabled && !I.some((i8) => i8.isPending) && (L = null), !L && I.every((i8) => !i8.isPending) && I.some((i8) => i8.hasResult()) && (I = I.map((i8) => i8.hasResult() ? new ActiveSource(i8.source, 0) : i8));
486
- for (let i8 of N.effects) i8.is(setSelectedEffect) && (L && (L = L.setSelected(i8.value, this.id)));
487
- return I == this.active && L == this.open ? this : new i2(I, this.id, L);
488
- }
489
- get tooltip() {
490
- return this.open ? this.open.tooltip : null;
491
- }
492
- get attrs() {
493
- return this.open ? this.open.attrs : this.active.length ? baseAttrs : noAttrs;
494
- }
495
- };
496
- function sameResults(i8, N) {
497
- if (i8 == N) return true;
498
- for (let P = 0, F = 0; ; ) {
499
- for (; P < i8.length && !i8[P].hasResult(); ) P++;
500
- for (; F < N.length && !N[F].hasResult(); ) F++;
501
- let I = P == i8.length, L = F == N.length;
502
- if (I || L) return I == L;
503
- if (i8[P++].result != N[F++].result) return false;
504
- }
505
- }
506
- var baseAttrs = { "aria-autocomplete": "list" }, noAttrs = {};
507
- function makeAttrs(i8, N) {
508
- let P = {
509
- "aria-autocomplete": "list",
510
- "aria-haspopup": "listbox",
511
- "aria-controls": i8
512
- };
513
- return N > -1 && (P["aria-activedescendant"] = i8 + "-" + N), P;
514
- }
515
- var none = [];
516
- function getUpdateType(i8, N) {
517
- if (i8.isUserEvent("input.complete")) {
518
- let P2 = i8.annotation(pickedCompletion);
519
- if (P2 && N.activateOnCompletion(P2)) return 12;
520
- }
521
- let P = i8.isUserEvent("input.type");
522
- return P && N.activateOnTyping ? 5 : P ? 1 : i8.isUserEvent("delete.backward") ? 2 : i8.selection ? 8 : i8.docChanged ? 16 : 0;
523
- }
524
- var ActiveSource = class i3 {
525
- constructor(i8, N, P = false) {
526
- this.source = i8, this.state = N, this.explicit = P;
527
- }
528
- hasResult() {
529
- return false;
530
- }
531
- get isPending() {
532
- return this.state == 1;
533
- }
534
- update(N, P) {
535
- let F = getUpdateType(N, P), I = this;
536
- (F & 8 || F & 16 && this.touches(N)) && (I = new i3(I.source, 0)), F & 4 && I.state == 0 && (I = new i3(this.source, 1)), I = I.updateFor(N, F);
537
- for (let P2 of N.effects) if (P2.is(startCompletionEffect)) I = new i3(I.source, 1, P2.value);
538
- else if (P2.is(closeCompletionEffect)) I = new i3(I.source, 0);
539
- else if (P2.is(setActiveEffect)) for (let i8 of P2.value) i8.source == I.source && (I = i8);
540
- return I;
541
- }
542
- updateFor(i8, N) {
543
- return this.map(i8.changes);
544
- }
545
- map(i8) {
546
- return this;
547
- }
548
- touches(i8) {
549
- return i8.changes.touchesRange(cur(i8.state));
550
- }
551
- }, ActiveResult = class i4 extends ActiveSource {
552
- constructor(i8, N, P, F, I, L) {
553
- super(i8, 3, N), this.limit = P, this.result = F, this.from = I, this.to = L;
554
- }
555
- hasResult() {
556
- return true;
557
- }
558
- updateFor(N, P) {
559
- if (!(P & 3)) return this.map(N.changes);
560
- let F = this.result;
561
- F.map && !N.changes.empty && (F = F.map(F, N.changes));
562
- let I = N.changes.mapPos(this.from), L = N.changes.mapPos(this.to, 1), R = cur(N.state);
563
- if (R > L || !F || P & 2 && (cur(N.startState) == this.from || R < this.limit)) return new ActiveSource(this.source, P & 4 ? 1 : 0);
564
- let z = N.changes.mapPos(this.limit);
565
- return checkValid(F.validFor, N.state, I, L) ? new i4(this.source, this.explicit, z, F, I, L) : F.update && (F = F.update(F, I, L, new CompletionContext(N.state, R, false))) ? new i4(this.source, this.explicit, z, F, F.from, F.to ?? cur(N.state)) : new ActiveSource(this.source, 1, this.explicit);
566
- }
567
- map(N) {
568
- return N.empty ? this : (this.result.map ? this.result.map(this.result, N) : this.result) ? new i4(this.source, this.explicit, N.mapPos(this.limit), this.result, N.mapPos(this.from), N.mapPos(this.to, 1)) : new ActiveSource(this.source, 0);
569
- }
570
- touches(i8) {
571
- return i8.changes.touchesRange(this.from, this.to);
572
- }
573
- };
574
- function checkValid(i8, N, P, F) {
575
- if (!i8) return false;
576
- let I = N.sliceDoc(P, F);
577
- return typeof i8 == "function" ? i8(I, P, F, N) : ensureAnchor(i8, true).test(I);
578
- }
579
- var setActiveEffect = /* @__PURE__ */ StateEffect.define({ map(i8, N) {
580
- return i8.map((i9) => i9.map(N));
581
- } }), completionState = /* @__PURE__ */ StateField.define({
582
- create() {
583
- return CompletionState.start();
584
- },
585
- update(i8, N) {
586
- return i8.update(N);
587
- },
588
- provide: (i8) => [showTooltip.from(i8, (i9) => i9.tooltip), EditorView.contentAttributes.from(i8, (i9) => i9.attrs)]
589
- });
590
- function applyCompletion(i8, N) {
591
- let P = N.completion.apply || N.completion.label, F = i8.state.field(completionState).active.find((i9) => i9.source == N.source);
592
- return F instanceof ActiveResult ? (typeof P == "string" ? i8.dispatch({
593
- ...insertCompletionText(i8.state, P, F.from, F.to),
594
- annotations: pickedCompletion.of(N.completion)
595
- }) : P(i8, N.completion, F.from, F.to), true) : false;
596
- }
597
- var createTooltip = /* @__PURE__ */ completionTooltip(completionState, applyCompletion);
598
- function moveCompletionSelection(i8, N = "option") {
599
- return (P) => {
600
- let F = P.state.field(completionState, false);
601
- if (!F || !F.open || F.open.disabled || Date.now() - F.open.timestamp < P.state.facet(completionConfig).interactionDelay) return false;
602
- let I = 1, L;
603
- N == "page" && (L = getTooltip(P, F.open.tooltip)) && (I = Math.max(2, Math.floor(L.dom.offsetHeight / L.dom.querySelector("li").offsetHeight) - 1));
604
- let { length: R } = F.open.options, z = F.open.selected > -1 ? F.open.selected + I * (i8 ? 1 : -1) : i8 ? 0 : R - 1;
605
- return z < 0 ? z = N == "page" ? 0 : R - 1 : z >= R && (z = N == "page" ? R - 1 : 0), P.dispatch({ effects: setSelectedEffect.of(z) }), true;
606
- };
607
- }
608
- var acceptCompletion = (i8) => {
609
- let N = i8.state.field(completionState, false);
610
- return i8.state.readOnly || !N || !N.open || N.open.selected < 0 || N.open.disabled || Date.now() - N.open.timestamp < i8.state.facet(completionConfig).interactionDelay ? false : applyCompletion(i8, N.open.options[N.open.selected]);
611
- }, startCompletion = (i8) => i8.state.field(completionState, false) ? (i8.dispatch({ effects: startCompletionEffect.of(true) }), true) : false, closeCompletion = (i8) => {
612
- let N = i8.state.field(completionState, false);
613
- return !N || !N.active.some((i9) => i9.state != 0) ? false : (i8.dispatch({ effects: closeCompletionEffect.of(null) }), true);
614
- }, RunningQuery = class {
615
- constructor(i8, N) {
616
- this.active = i8, this.context = N, this.time = Date.now(), this.updates = [], this.done = void 0;
617
- }
618
- }, MaxUpdateCount = 50, MinAbortTime = 1e3, completionPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
619
- constructor(i8) {
620
- this.view = i8, this.debounceUpdate = -1, this.running = [], this.debounceAccept = -1, this.pendingStart = false, this.composing = 0;
621
- for (let N of i8.state.field(completionState).active) N.isPending && this.startQuery(N);
622
- }
623
- update(i8) {
624
- let N = i8.state.field(completionState), P = i8.state.facet(completionConfig);
625
- if (!i8.selectionSet && !i8.docChanged && i8.startState.field(completionState) == N) return;
626
- let F = i8.transactions.some((i9) => {
627
- let N2 = getUpdateType(i9, P);
628
- return N2 & 8 || (i9.selection || i9.docChanged) && !(N2 & 3);
629
- });
630
- for (let N2 = 0; N2 < this.running.length; N2++) {
631
- let P2 = this.running[N2];
632
- if (F || P2.context.abortOnDocChange && i8.docChanged || P2.updates.length + i8.transactions.length > MaxUpdateCount && Date.now() - P2.time > MinAbortTime) {
633
- for (let i9 of P2.context.abortListeners) try {
634
- i9();
635
- } catch (i10) {
636
- logException(this.view.state, i10);
637
- }
638
- P2.context.abortListeners = null, this.running.splice(N2--, 1);
639
- } else P2.updates.push(...i8.transactions);
640
- }
641
- this.debounceUpdate > -1 && clearTimeout(this.debounceUpdate), i8.transactions.some((i9) => i9.effects.some((i10) => i10.is(startCompletionEffect))) && (this.pendingStart = true);
642
- let I = this.pendingStart ? 50 : P.activateOnTypingDelay;
643
- if (this.debounceUpdate = N.active.some((i9) => i9.isPending && !this.running.some((N2) => N2.active.source == i9.source)) ? setTimeout(() => this.startUpdate(), I) : -1, this.composing != 0) for (let N2 of i8.transactions) N2.isUserEvent("input.type") ? this.composing = 2 : this.composing == 2 && N2.selection && (this.composing = 3);
644
- }
645
- startUpdate() {
646
- this.debounceUpdate = -1, this.pendingStart = false;
647
- let { state: i8 } = this.view, N = i8.field(completionState);
648
- for (let i9 of N.active) i9.isPending && !this.running.some((N2) => N2.active.source == i9.source) && this.startQuery(i9);
649
- this.running.length && N.open && N.open.disabled && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime));
650
- }
651
- startQuery(i8) {
652
- let { state: N } = this.view, P = new CompletionContext(N, cur(N), i8.explicit, this.view), F = new RunningQuery(i8, P);
653
- this.running.push(F), Promise.resolve(i8.source(P)).then((i9) => {
654
- F.context.aborted || (F.done = i9 || null, this.scheduleAccept());
655
- }, (i9) => {
656
- this.view.dispatch({ effects: closeCompletionEffect.of(null) }), logException(this.view.state, i9);
657
- });
658
- }
659
- scheduleAccept() {
660
- this.running.every((i8) => i8.done !== void 0) ? this.accept() : this.debounceAccept < 0 && (this.debounceAccept = setTimeout(() => this.accept(), this.view.state.facet(completionConfig).updateSyncTime));
661
- }
662
- accept() {
663
- this.debounceAccept > -1 && clearTimeout(this.debounceAccept), this.debounceAccept = -1;
664
- let i8 = [], N = this.view.state.facet(completionConfig), P = this.view.state.field(completionState);
665
- for (let F = 0; F < this.running.length; F++) {
666
- let I = this.running[F];
667
- if (I.done === void 0) continue;
668
- if (this.running.splice(F--, 1), I.done) {
669
- let P2 = cur(I.updates.length ? I.updates[0].startState : this.view.state), F2 = Math.min(P2, I.done.from + (I.active.explicit ? 0 : 1)), L2 = new ActiveResult(I.active.source, I.active.explicit, F2, I.done, I.done.from, I.done.to ?? P2);
670
- for (let i9 of I.updates) L2 = L2.update(i9, N);
671
- if (L2.hasResult()) {
672
- i8.push(L2);
673
- continue;
674
- }
675
- }
676
- let L = P.active.find((i9) => i9.source == I.active.source);
677
- if (L && L.isPending) if (I.done == null) {
678
- let P2 = new ActiveSource(I.active.source, 0);
679
- for (let i9 of I.updates) P2 = P2.update(i9, N);
680
- P2.isPending || i8.push(P2);
681
- } else this.startQuery(L);
682
- }
683
- (i8.length || P.open && P.open.disabled) && this.view.dispatch({ effects: setActiveEffect.of(i8) });
684
- }
685
- }, { eventHandlers: {
686
- blur(i8) {
687
- let N = this.view.state.field(completionState, false);
688
- if (N && N.tooltip && this.view.state.facet(completionConfig).closeOnBlur) {
689
- let P = N.open && getTooltip(this.view, N.open.tooltip);
690
- (!P || !P.dom.contains(i8.relatedTarget)) && setTimeout(() => this.view.dispatch({ effects: closeCompletionEffect.of(null) }), 10);
691
- }
692
- },
693
- compositionstart() {
694
- this.composing = 1;
695
- },
696
- compositionend() {
697
- this.composing == 3 && setTimeout(() => this.view.dispatch({ effects: startCompletionEffect.of(false) }), 20), this.composing = 0;
698
- }
699
- } }), windows = typeof navigator == "object" && /* @__PURE__ */ /Win/.test(navigator.platform), commitCharacters = /* @__PURE__ */ Prec.highest(/* @__PURE__ */ EditorView.domEventHandlers({ keydown(i8, N) {
700
- let P = N.state.field(completionState, false);
701
- if (!P || !P.open || P.open.disabled || P.open.selected < 0 || i8.key.length > 1 || i8.ctrlKey && !(windows && i8.altKey) || i8.metaKey) return false;
702
- let F = P.open.options[P.open.selected], I = P.active.find((i9) => i9.source == F.source), L = F.completion.commitCharacters || I.result.commitCharacters;
703
- return L && L.indexOf(i8.key) > -1 && applyCompletion(N, F), false;
704
- } })), baseTheme = /* @__PURE__ */ EditorView.baseTheme({
705
- ".cm-tooltip.cm-tooltip-autocomplete": { "& > ul": {
706
- fontFamily: "monospace",
707
- whiteSpace: "nowrap",
708
- overflow: "hidden auto",
709
- maxWidth_fallback: "700px",
710
- maxWidth: "min(700px, 95vw)",
711
- minWidth: "250px",
712
- maxHeight: "10em",
713
- height: "100%",
714
- listStyle: "none",
715
- margin: 0,
716
- padding: 0,
717
- "& > li, & > completion-section": {
718
- padding: "1px 3px",
719
- lineHeight: 1.2
720
- },
721
- "& > li": {
722
- overflowX: "hidden",
723
- textOverflow: "ellipsis",
724
- cursor: "pointer"
725
- },
726
- "& > completion-section": {
727
- display: "list-item",
728
- borderBottom: "1px solid silver",
729
- paddingLeft: "0.5em",
730
- opacity: 0.7
731
- }
732
- } },
733
- "&light .cm-tooltip-autocomplete ul li[aria-selected]": {
734
- background: "#17c",
735
- color: "white"
736
- },
737
- "&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#777" },
738
- "&dark .cm-tooltip-autocomplete ul li[aria-selected]": {
739
- background: "#347",
740
- color: "white"
741
- },
742
- "&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]": { background: "#444" },
743
- ".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after": {
744
- content: '"\xB7\xB7\xB7"',
745
- opacity: 0.5,
746
- display: "block",
747
- textAlign: "center"
748
- },
749
- ".cm-tooltip.cm-completionInfo": {
750
- position: "absolute",
751
- padding: "3px 9px",
752
- width: "max-content",
753
- maxWidth: "400px",
754
- boxSizing: "border-box",
755
- whiteSpace: "pre-line"
756
- },
757
- ".cm-completionInfo.cm-completionInfo-left": { right: "100%" },
758
- ".cm-completionInfo.cm-completionInfo-right": { left: "100%" },
759
- ".cm-completionInfo.cm-completionInfo-left-narrow": { right: "30px" },
760
- ".cm-completionInfo.cm-completionInfo-right-narrow": { left: "30px" },
761
- "&light .cm-snippetField": { backgroundColor: "#00000022" },
762
- "&dark .cm-snippetField": { backgroundColor: "#ffffff22" },
763
- ".cm-snippetFieldPosition": {
764
- verticalAlign: "text-top",
765
- width: 0,
766
- height: "1.15em",
767
- display: "inline-block",
768
- margin: "0 -0.7px -.7em",
769
- borderLeft: "1.4px dotted #888"
770
- },
771
- ".cm-completionMatchedText": { textDecoration: "underline" },
772
- ".cm-completionDetail": {
773
- marginLeft: "0.5em",
774
- fontStyle: "italic"
775
- },
776
- ".cm-completionIcon": {
777
- fontSize: "90%",
778
- width: ".8em",
779
- display: "inline-block",
780
- textAlign: "center",
781
- paddingRight: ".6em",
782
- opacity: "0.6",
783
- boxSizing: "content-box"
784
- },
785
- ".cm-completionIcon-function, .cm-completionIcon-method": { "&:after": { content: "'\u0192'" } },
786
- ".cm-completionIcon-class": { "&:after": { content: "'\u25CB'" } },
787
- ".cm-completionIcon-interface": { "&:after": { content: "'\u25CC'" } },
788
- ".cm-completionIcon-variable": { "&:after": { content: "'\u{1D465}'" } },
789
- ".cm-completionIcon-constant": { "&:after": { content: "'\u{1D436}'" } },
790
- ".cm-completionIcon-type": { "&:after": { content: "'\u{1D461}'" } },
791
- ".cm-completionIcon-enum": { "&:after": { content: "'\u222A'" } },
792
- ".cm-completionIcon-property": { "&:after": { content: "'\u25A1'" } },
793
- ".cm-completionIcon-keyword": { "&:after": { content: "'\u{1F511}\uFE0E'" } },
794
- ".cm-completionIcon-namespace": { "&:after": { content: "'\u25A2'" } },
795
- ".cm-completionIcon-text": { "&:after": {
796
- content: "'abc'",
797
- fontSize: "50%",
798
- verticalAlign: "middle"
799
- } }
800
- }), FieldPos = class {
801
- constructor(i8, N, P, F) {
802
- this.field = i8, this.line = N, this.from = P, this.to = F;
803
- }
804
- }, FieldRange = class i5 {
805
- constructor(i8, N, P) {
806
- this.field = i8, this.from = N, this.to = P;
807
- }
808
- map(N) {
809
- let P = N.mapPos(this.from, -1, MapMode.TrackDel), F = N.mapPos(this.to, 1, MapMode.TrackDel);
810
- return P == null || F == null ? null : new i5(this.field, P, F);
811
- }
812
- }, Snippet = class i6 {
813
- constructor(i8, N) {
814
- this.lines = i8, this.fieldPositions = N;
815
- }
816
- instantiate(i8, N) {
817
- let P = [], F = [N], I = i8.doc.lineAt(N), L = /^\s*/.exec(I.text)[0];
818
- for (let I2 of this.lines) {
819
- if (P.length) {
820
- let P2 = L, R = /^\t*/.exec(I2)[0].length;
821
- for (let N2 = 0; N2 < R; N2++) P2 += i8.facet(indentUnit);
822
- F.push(N + P2.length - R), I2 = P2 + I2.slice(R);
823
- }
824
- P.push(I2), N += I2.length + 1;
825
- }
826
- return {
827
- text: P,
828
- ranges: this.fieldPositions.map((i9) => new FieldRange(i9.field, F[i9.line] + i9.from, F[i9.line] + i9.to))
829
- };
830
- }
831
- static parse(N) {
832
- let P = [], F = [], I = [], L;
833
- for (let i8 of N.split(/\r\n?|\n/)) {
834
- for (; L = /[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(i8); ) {
835
- let N2 = L[1] ? +L[1] : null, R = L[2] || L[3] || "", z = -1, B = R.replace(/\\[{}]/g, (i9) => i9[1]);
836
- for (let i9 = 0; i9 < P.length; i9++) (N2 == null ? B && P[i9].name == B : P[i9].seq == N2) && (z = i9);
837
- if (z < 0) {
838
- let i9 = 0;
839
- for (; i9 < P.length && (N2 == null || P[i9].seq != null && P[i9].seq < N2); ) i9++;
840
- P.splice(i9, 0, {
841
- seq: N2,
842
- name: B
843
- }), z = i9;
844
- for (let i10 of I) i10.field >= z && i10.field++;
845
- }
846
- for (let i9 of I) if (i9.line == F.length && i9.from > L.index) {
847
- let N3 = L[2] ? 3 + (L[1] || "").length : 2;
848
- i9.from -= N3, i9.to -= N3;
849
- }
850
- I.push(new FieldPos(z, F.length, L.index, L.index + B.length)), i8 = i8.slice(0, L.index) + R + i8.slice(L.index + L[0].length);
851
- }
852
- i8 = i8.replace(/\\([{}])/g, (i9, N2, P2) => {
853
- for (let i10 of I) i10.line == F.length && i10.from > P2 && (i10.from--, i10.to--);
854
- return N2;
855
- }), F.push(i8);
856
- }
857
- return new i6(F, I);
858
- }
859
- }, fieldMarker = /* @__PURE__ */ Decoration.widget({ widget: /* @__PURE__ */ new class extends WidgetType {
860
- toDOM() {
861
- let i8 = document.createElement("span");
862
- return i8.className = "cm-snippetFieldPosition", i8;
863
- }
864
- ignoreEvent() {
865
- return false;
866
- }
867
- }() }), fieldRange = /* @__PURE__ */ Decoration.mark({ class: "cm-snippetField" }), ActiveSnippet = class i7 {
868
- constructor(i8, N) {
869
- this.ranges = i8, this.active = N, this.deco = Decoration.set(i8.map((i9) => (i9.from == i9.to ? fieldMarker : fieldRange).range(i9.from, i9.to)), true);
870
- }
871
- map(N) {
872
- let P = [];
873
- for (let i8 of this.ranges) {
874
- let F = i8.map(N);
875
- if (!F) return null;
876
- P.push(F);
877
- }
878
- return new i7(P, this.active);
879
- }
880
- selectionInsideField(i8) {
881
- return i8.ranges.every((i9) => this.ranges.some((N) => N.field == this.active && N.from <= i9.from && N.to >= i9.to));
882
- }
883
- }, setActive = /* @__PURE__ */ StateEffect.define({ map(i8, N) {
884
- return i8 && i8.map(N);
885
- } }), moveToField = /* @__PURE__ */ StateEffect.define(), snippetState = /* @__PURE__ */ StateField.define({
886
- create() {
887
- return null;
888
- },
889
- update(i8, N) {
890
- for (let P of N.effects) {
891
- if (P.is(setActive)) return P.value;
892
- if (P.is(moveToField) && i8) return new ActiveSnippet(i8.ranges, P.value);
893
- }
894
- return i8 && N.docChanged && (i8 = i8.map(N.changes)), i8 && N.selection && !i8.selectionInsideField(N.selection) && (i8 = null), i8;
895
- },
896
- provide: (i8) => EditorView.decorations.from(i8, (i9) => i9 ? i9.deco : Decoration.none)
897
- });
898
- function fieldSelection(i8, N) {
899
- return EditorSelection.create(i8.filter((i9) => i9.field == N).map((i9) => EditorSelection.range(i9.from, i9.to)));
900
- }
901
- function snippet(i8) {
902
- let N = Snippet.parse(i8);
903
- return (i9, P, F, I) => {
904
- let { text: L, ranges: B } = N.instantiate(i9.state, F), { main: V } = i9.state.selection, U = {
905
- changes: {
906
- from: F,
907
- to: I == V.from ? V.to : I,
908
- insert: Text.of(L)
909
- },
910
- scrollIntoView: true,
911
- annotations: P ? [pickedCompletion.of(P), Transaction.userEvent.of("input.complete")] : void 0
912
- };
913
- if (B.length && (U.selection = fieldSelection(B, 0)), B.some((i10) => i10.field > 0)) {
914
- let N2 = new ActiveSnippet(B, 0), P2 = U.effects = [setActive.of(N2)];
915
- i9.state.field(snippetState, false) === void 0 && P2.push(StateEffect.appendConfig.of([
916
- snippetState,
917
- addSnippetKeymap,
918
- snippetPointerHandler,
919
- baseTheme
920
- ]));
921
- }
922
- i9.dispatch(i9.state.update(U));
923
- };
924
- }
925
- function moveField(i8) {
926
- return ({ state: N, dispatch: P }) => {
927
- let F = N.field(snippetState, false);
928
- if (!F || i8 < 0 && F.active == 0) return false;
929
- let I = F.active + i8, L = i8 > 0 && !F.ranges.some((N2) => N2.field == I + i8);
930
- return P(N.update({
931
- selection: fieldSelection(F.ranges, I),
932
- effects: setActive.of(L ? null : new ActiveSnippet(F.ranges, I)),
933
- scrollIntoView: true
934
- })), true;
935
- };
936
- }
937
- var defaultSnippetKeymap = [{
938
- key: "Tab",
939
- run: /* @__PURE__ */ moveField(1),
940
- shift: /* @__PURE__ */ moveField(-1)
941
- }, {
942
- key: "Escape",
943
- run: ({ state: i8, dispatch: N }) => i8.field(snippetState, false) ? (N(i8.update({ effects: setActive.of(null) })), true) : false
944
- }], snippetKeymap = /* @__PURE__ */ Facet.define({ combine(i8) {
945
- return i8.length ? i8[0] : defaultSnippetKeymap;
946
- } }), addSnippetKeymap = /* @__PURE__ */ Prec.highest(/* @__PURE__ */ keymap.compute([snippetKeymap], (i8) => i8.facet(snippetKeymap)));
947
- function snippetCompletion(i8, N) {
948
- return {
949
- ...N,
950
- apply: snippet(i8)
951
- };
952
- }
953
- var snippetPointerHandler = /* @__PURE__ */ EditorView.domEventHandlers({ mousedown(i8, N) {
954
- let P = N.state.field(snippetState, false), F;
955
- if (!P || (F = N.posAtCoords({
956
- x: i8.clientX,
957
- y: i8.clientY
958
- })) == null) return false;
959
- let I = P.ranges.find((i9) => i9.from <= F && i9.to >= F);
960
- return !I || I.field == P.active ? false : (N.dispatch({
961
- selection: fieldSelection(P.ranges, I.field),
962
- effects: setActive.of(P.ranges.some((i9) => i9.field > I.field) ? new ActiveSnippet(P.ranges, I.field) : null),
963
- scrollIntoView: true
964
- }), true);
965
- } }), defaults = {
966
- brackets: [
967
- "(",
968
- "[",
969
- "{",
970
- "'",
971
- '"'
972
- ],
973
- before: ")]}:;>",
974
- stringPrefixes: []
975
- }, closeBracketEffect = /* @__PURE__ */ StateEffect.define({ map(i8, N) {
976
- return N.mapPos(i8, -1, MapMode.TrackAfter) ?? void 0;
977
- } }), closedBracket = /* @__PURE__ */ new class extends RangeValue {
978
- }();
979
- closedBracket.startSide = 1, closedBracket.endSide = -1;
980
- var bracketState = /* @__PURE__ */ StateField.define({
981
- create() {
982
- return RangeSet.empty;
983
- },
984
- update(i8, N) {
985
- if (i8 = i8.map(N.changes), N.selection) {
986
- let P = N.state.doc.lineAt(N.selection.main.head);
987
- i8 = i8.update({ filter: (i9) => i9 >= P.from && i9 <= P.to });
988
- }
989
- for (let P of N.effects) P.is(closeBracketEffect) && (i8 = i8.update({ add: [closedBracket.range(P.value, P.value + 1)] }));
990
- return i8;
991
- }
992
- });
993
- function closeBrackets() {
994
- return [inputHandler, bracketState];
995
- }
996
- var definedClosing = "()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";
997
- function closing(i8) {
998
- for (let N = 0; N < 16; N += 2) if (definedClosing.charCodeAt(N) == i8) return definedClosing.charAt(N + 1);
999
- return fromCodePoint(i8 < 128 ? i8 : i8 + 1);
1000
- }
1001
- function config(i8, N) {
1002
- return i8.languageDataAt("closeBrackets", N)[0] || defaults;
1003
- }
1004
- var android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent), inputHandler = /* @__PURE__ */ EditorView.inputHandler.of((i8, N, P, F) => {
1005
- if ((android ? i8.composing : i8.compositionStarted) || i8.state.readOnly) return false;
1006
- let I = i8.state.selection.main;
1007
- if (F.length > 2 || F.length == 2 && codePointSize(codePointAt(F, 0)) == 1 || N != I.from || P != I.to) return false;
1008
- let L = insertBracket(i8.state, F);
1009
- return L ? (i8.dispatch(L), true) : false;
1010
- }), closeBracketsKeymap = [{
1011
- key: "Backspace",
1012
- run: ({ state: i8, dispatch: N }) => {
1013
- if (i8.readOnly) return false;
1014
- let P = config(i8, i8.selection.main.head).brackets || defaults.brackets, I = null, L = i8.changeByRange((N2) => {
1015
- if (N2.empty) {
1016
- let I2 = prevChar(i8.doc, N2.head);
1017
- for (let L2 of P) if (L2 == I2 && nextChar(i8.doc, N2.head) == closing(codePointAt(L2, 0))) return {
1018
- changes: {
1019
- from: N2.head - L2.length,
1020
- to: N2.head + L2.length
1021
- },
1022
- range: EditorSelection.cursor(N2.head - L2.length)
1023
- };
1024
- }
1025
- return { range: I = N2 };
1026
- });
1027
- return I || N(i8.update(L, {
1028
- scrollIntoView: true,
1029
- userEvent: "delete.backward"
1030
- })), !I;
1031
- }
1032
- }];
1033
- function insertBracket(i8, N) {
1034
- let P = config(i8, i8.selection.main.head), F = P.brackets || defaults.brackets;
1035
- for (let I of F) {
1036
- let L = closing(codePointAt(I, 0));
1037
- if (N == I) return L == I ? handleSame(i8, I, F.indexOf(I + I + I) > -1, P) : handleOpen(i8, I, L, P.before || defaults.before);
1038
- if (N == L && closedBracketAt(i8, i8.selection.main.from)) return handleClose(i8, I, L);
1039
- }
1040
- return null;
1041
- }
1042
- function closedBracketAt(i8, N) {
1043
- let P = false;
1044
- return i8.field(bracketState).between(0, i8.doc.length, (i9) => {
1045
- i9 == N && (P = true);
1046
- }), P;
1047
- }
1048
- function nextChar(i8, N) {
1049
- let P = i8.sliceString(N, N + 2);
1050
- return P.slice(0, codePointSize(codePointAt(P, 0)));
1051
- }
1052
- function prevChar(i8, N) {
1053
- let P = i8.sliceString(N - 2, N);
1054
- return codePointSize(codePointAt(P, 0)) == P.length ? P : P.slice(1);
1055
- }
1056
- function handleOpen(i8, N, P, I) {
1057
- let L = null, R = i8.changeByRange((R2) => {
1058
- if (!R2.empty) return {
1059
- changes: [{
1060
- insert: N,
1061
- from: R2.from
1062
- }, {
1063
- insert: P,
1064
- from: R2.to
1065
- }],
1066
- effects: closeBracketEffect.of(R2.to + N.length),
1067
- range: EditorSelection.range(R2.anchor + N.length, R2.head + N.length)
1068
- };
1069
- let z = nextChar(i8.doc, R2.head);
1070
- return !z || /\s/.test(z) || I.indexOf(z) > -1 ? {
1071
- changes: {
1072
- insert: N + P,
1073
- from: R2.head
1074
- },
1075
- effects: closeBracketEffect.of(R2.head + N.length),
1076
- range: EditorSelection.cursor(R2.head + N.length)
1077
- } : { range: L = R2 };
1078
- });
1079
- return L ? null : i8.update(R, {
1080
- scrollIntoView: true,
1081
- userEvent: "input.type"
1082
- });
1083
- }
1084
- function handleClose(i8, N, P) {
1085
- let I = null, L = i8.changeByRange((N2) => N2.empty && nextChar(i8.doc, N2.head) == P ? {
1086
- changes: {
1087
- from: N2.head,
1088
- to: N2.head + P.length,
1089
- insert: P
1090
- },
1091
- range: EditorSelection.cursor(N2.head + P.length)
1092
- } : I = { range: N2 });
1093
- return I ? null : i8.update(L, {
1094
- scrollIntoView: true,
1095
- userEvent: "input.type"
1096
- });
1097
- }
1098
- function handleSame(i8, N, P, I) {
1099
- let L = I.stringPrefixes || defaults.stringPrefixes, R = null, z = i8.changeByRange((I2) => {
1100
- if (!I2.empty) return {
1101
- changes: [{
1102
- insert: N,
1103
- from: I2.from
1104
- }, {
1105
- insert: N,
1106
- from: I2.to
1107
- }],
1108
- effects: closeBracketEffect.of(I2.to + N.length),
1109
- range: EditorSelection.range(I2.anchor + N.length, I2.head + N.length)
1110
- };
1111
- let z2 = I2.head, B = nextChar(i8.doc, z2), V;
1112
- if (B == N) {
1113
- if (nodeStart(i8, z2)) return {
1114
- changes: {
1115
- insert: N + N,
1116
- from: z2
1117
- },
1118
- effects: closeBracketEffect.of(z2 + N.length),
1119
- range: EditorSelection.cursor(z2 + N.length)
1120
- };
1121
- if (closedBracketAt(i8, z2)) {
1122
- let I3 = P && i8.sliceDoc(z2, z2 + N.length * 3) == N + N + N ? N + N + N : N;
1123
- return {
1124
- changes: {
1125
- from: z2,
1126
- to: z2 + I3.length,
1127
- insert: I3
1128
- },
1129
- range: EditorSelection.cursor(z2 + I3.length)
1130
- };
1131
- }
1132
- } else if (P && i8.sliceDoc(z2 - 2 * N.length, z2) == N + N && (V = canStartStringAt(i8, z2 - 2 * N.length, L)) > -1 && nodeStart(i8, V)) return {
1133
- changes: {
1134
- insert: N + N + N + N,
1135
- from: z2
1136
- },
1137
- effects: closeBracketEffect.of(z2 + N.length),
1138
- range: EditorSelection.cursor(z2 + N.length)
1139
- };
1140
- else if (i8.charCategorizer(z2)(B) != CharCategory.Word && canStartStringAt(i8, z2, L) > -1 && !probablyInString(i8, z2, N, L)) return {
1141
- changes: {
1142
- insert: N + N,
1143
- from: z2
1144
- },
1145
- effects: closeBracketEffect.of(z2 + N.length),
1146
- range: EditorSelection.cursor(z2 + N.length)
1147
- };
1148
- return { range: R = I2 };
1149
- });
1150
- return R ? null : i8.update(z, {
1151
- scrollIntoView: true,
1152
- userEvent: "input.type"
1153
- });
1154
- }
1155
- function nodeStart(i8, N) {
1156
- let P = syntaxTree(i8).resolveInner(N + 1);
1157
- return P.parent && P.from == N;
1158
- }
1159
- function probablyInString(i8, N, P, F) {
1160
- let I = syntaxTree(i8).resolveInner(N, -1), R = F.reduce((i9, N2) => Math.max(i9, N2.length), 0);
1161
- for (let L = 0; L < 5; L++) {
1162
- let L2 = i8.sliceDoc(I.from, Math.min(I.to, I.from + P.length + R)), z = L2.indexOf(P);
1163
- if (!z || z > -1 && F.indexOf(L2.slice(0, z)) > -1) {
1164
- let N2 = I.firstChild;
1165
- for (; N2 && N2.from == I.from && N2.to - N2.from > P.length + z; ) {
1166
- if (i8.sliceDoc(N2.to - P.length, N2.to) == P) return false;
1167
- N2 = N2.firstChild;
1168
- }
1169
- return true;
1170
- }
1171
- let B = I.to == N && I.parent;
1172
- if (!B) break;
1173
- I = B;
1174
- }
1175
- return false;
1176
- }
1177
- function canStartStringAt(i8, N, P) {
1178
- let F = i8.charCategorizer(N);
1179
- if (F(i8.sliceDoc(N - 1, N)) != CharCategory.Word) return N;
1180
- for (let I of P) {
1181
- let P2 = N - I.length;
1182
- if (i8.sliceDoc(P2, N) == I && F(i8.sliceDoc(P2 - 1, P2)) != CharCategory.Word) return P2;
1183
- }
1184
- return -1;
1185
- }
1186
- function autocompletion(i8 = {}) {
1187
- return [
1188
- commitCharacters,
1189
- completionState,
1190
- completionConfig.of(i8),
1191
- completionPlugin,
1192
- completionKeymapExt,
1193
- baseTheme
1194
- ];
1195
- }
1196
- var completionKeymap = [
1197
- {
1198
- key: "Ctrl-Space",
1199
- run: startCompletion
1200
- },
1201
- {
1202
- mac: "Alt-`",
1203
- run: startCompletion
1204
- },
1205
- {
1206
- mac: "Alt-i",
1207
- run: startCompletion
1208
- },
1209
- {
1210
- key: "Escape",
1211
- run: closeCompletion
1212
- },
1213
- {
1214
- key: "ArrowDown",
1215
- run: /* @__PURE__ */ moveCompletionSelection(true)
1216
- },
1217
- {
1218
- key: "ArrowUp",
1219
- run: /* @__PURE__ */ moveCompletionSelection(false)
1220
- },
1221
- {
1222
- key: "PageDown",
1223
- run: /* @__PURE__ */ moveCompletionSelection(true, "page")
1224
- },
1225
- {
1226
- key: "PageUp",
1227
- run: /* @__PURE__ */ moveCompletionSelection(false, "page")
1228
- },
1229
- {
1230
- key: "Enter",
1231
- run: acceptCompletion
1232
- }
1233
- ], completionKeymapExt = /* @__PURE__ */ Prec.highest(/* @__PURE__ */ keymap.computeN([completionConfig], (i8) => i8.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));
1234
- export {
1235
- closeBracketsKeymap as a,
1236
- completionKeymap as c,
1237
- snippet as d,
1238
- snippetCompletion as f,
1239
- closeBrackets as i,
1240
- ifNotIn as l,
1241
- acceptCompletion as n,
1242
- closeCompletion as o,
1243
- autocompletion as r,
1244
- completeFromList as s,
1245
- CompletionContext as t,
1246
- insertCompletionText as u
1247
- };