@pi-outpost/embed 0.62.3 → 0.63.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 (59) hide show
  1. package/dist/{CodeEditor-C2mtBAxz.js → CodeEditor-BW8cShfE.js} +870 -869
  2. package/dist/CodeEditor-BZfOQyjO.cjs +9 -0
  3. package/dist/{conversationExport-jRLUX0kH.js → conversationExport-BHXWfKKh.js} +37 -37
  4. package/dist/{conversationExport-DXxmgLoF.cjs → conversationExport-CWUOyeJO.cjs} +2 -2
  5. package/dist/{conversationHistory-C6PqGsO9.cjs → conversationHistory-0ds9dEO5.cjs} +26 -4
  6. package/dist/{conversationHistory-3pDBlkZZ.js → conversationHistory-xEFHYA2a.js} +94 -61
  7. package/dist/{dist-B9wvGgxB.js → dist-B-n0qSdY.js} +134 -133
  8. package/dist/{dist-LBUs7dVk.js → dist-B53CIh_q.js} +62 -61
  9. package/dist/{dist-DeLxY4Ia.js → dist-BBPYf4ef.js} +30 -29
  10. package/dist/dist-BFbWWJdM.cjs +23 -0
  11. package/dist/dist-BLE5-Y8p.cjs +9 -0
  12. package/dist/dist-BQCPWecG.cjs +1 -0
  13. package/dist/dist-BmjjdWVL.cjs +1 -0
  14. package/dist/{dist-kpPXlS4A.cjs → dist-Bo7aGd2O.cjs} +2 -2
  15. package/dist/{dist-Bk3hLKgL.js → dist-BoHwBqKn.js} +49 -49
  16. package/dist/{dist-VWDOErn8.js → dist-BpRy8-Lq.js} +47 -47
  17. package/dist/dist-BzV3uXd3.js +2842 -0
  18. package/dist/dist-C3wOZTh_.cjs +1 -0
  19. package/dist/dist-C6485_TJ.cjs +1 -0
  20. package/dist/{dist-BIMxMB--.js → dist-CEPaeNz_.js} +57 -57
  21. package/dist/dist-CbNZ-oK_.cjs +11 -0
  22. package/dist/dist-CewGgiCl.cjs +1 -0
  23. package/dist/dist-Cgkuh5Wk.cjs +11 -0
  24. package/dist/dist-ChIJFFop.cjs +3 -0
  25. package/dist/dist-Cqy-WSUm.cjs +6 -0
  26. package/dist/{dist-Bg1-NGne.js → dist-D1XDfvdG.js} +17 -17
  27. package/dist/{dist-qeX2QqDc.js → dist-DAh__jUg.js} +6724 -9561
  28. package/dist/dist-DV7vb3Vn.cjs +1 -0
  29. package/dist/dist-DWOMmaS_.cjs +1 -0
  30. package/dist/{dist-BWAsFrsx.js → dist-DcevhA0K.js} +73 -73
  31. package/dist/dist-DdI6ugoG.cjs +1 -0
  32. package/dist/{dist-CpOA8cNn.js → dist-DhtR0qbm.js} +49 -49
  33. package/dist/{dist-CwPu13CG.js → dist-DlwWvZ4d.js} +46 -46
  34. package/dist/{dist-nQ2aeIgK.js → dist-DnmbmV7C.js} +495 -494
  35. package/dist/dist-DsOiUWHL.cjs +1 -0
  36. package/dist/dist-DuyBYmw-.cjs +1 -0
  37. package/dist/{dist-DUziszL2.js → dist-T7rNKseu.js} +32 -32
  38. package/dist/{dist-CcTOENSK.js → dist-XKeyr4Om.js} +26 -26
  39. package/dist/{dist-CvxwObne.js → dist-n29rG6c2.js} +117 -117
  40. package/dist/{dist-DCT8mdeU.js → dist-s8hmOD0A.js} +52 -52
  41. package/dist/pi-outpost-embed.cjs +46 -44
  42. package/dist/pi-outpost-embed.js +5022 -4147
  43. package/package.json +1 -1
  44. package/dist/CodeEditor-CHKp59kP.cjs +0 -9
  45. package/dist/dist-B9TXDASo.cjs +0 -1
  46. package/dist/dist-BMzIUMhf.cjs +0 -1
  47. package/dist/dist-BawiB8yE.cjs +0 -23
  48. package/dist/dist-BjxwUutQ.cjs +0 -6
  49. package/dist/dist-BlUoR-U1.cjs +0 -13
  50. package/dist/dist-Bnsp4Y3i.cjs +0 -9
  51. package/dist/dist-CM2l_BHt.cjs +0 -1
  52. package/dist/dist-CkDnvyBs.cjs +0 -1
  53. package/dist/dist-CpsCEkIr.cjs +0 -1
  54. package/dist/dist-DJYmQsI-.cjs +0 -1
  55. package/dist/dist-F6qtkv2Q.cjs +0 -11
  56. package/dist/dist-Lxxq5IH0.cjs +0 -1
  57. package/dist/dist-c-DRw6Dh.cjs +0 -1
  58. package/dist/dist-sM-IE5EO.cjs +0 -1
  59. package/dist/dist-vBlUeRrZ.cjs +0 -1
@@ -0,0 +1,2842 @@
1
+ import { A as e, B as t, D as n, F as r, M as i, O as a, P as o, V as s, _ as c, a as l, b as u, d, i as f, j as p, n as m, o as h, r as g, t as _ } from "./dist-DAh__jUg.js";
2
+ //#region ../node_modules/@lezer/common/dist/index.js
3
+ var ee = 1024, v = 0, y = class {
4
+ constructor(e, t) {
5
+ this.from = e, this.to = t;
6
+ }
7
+ }, b = class {
8
+ constructor(e = {}) {
9
+ this.id = v++, this.perNode = !!e.perNode, this.deserialize = e.deserialize || (() => {
10
+ throw Error("This node type doesn't define a deserialize function");
11
+ }), this.combine = e.combine || null;
12
+ }
13
+ add(e) {
14
+ if (this.perNode) throw RangeError("Can't add per-node props to node types");
15
+ return typeof e != "function" && (e = C.match(e)), (t) => {
16
+ let n = e(t);
17
+ return n === void 0 ? null : [this, n];
18
+ };
19
+ }
20
+ };
21
+ b.closedBy = new b({ deserialize: (e) => e.split(" ") }), b.openedBy = new b({ deserialize: (e) => e.split(" ") }), b.group = new b({ deserialize: (e) => e.split(" ") }), b.isolate = new b({ deserialize: (e) => {
22
+ if (e && e != "rtl" && e != "ltr" && e != "auto") throw RangeError("Invalid value for isolate: " + e);
23
+ return e || "auto";
24
+ } }), b.contextHash = new b({ perNode: !0 }), b.lookAhead = new b({ perNode: !0 }), b.mounted = new b({ perNode: !0 });
25
+ var x = class {
26
+ constructor(e, t, n, r = !1) {
27
+ this.tree = e, this.overlay = t, this.parser = n, this.bracketed = r;
28
+ }
29
+ static get(e) {
30
+ return e && e.props && e.props[b.mounted.id];
31
+ }
32
+ }, S = Object.create(null), C = class e {
33
+ constructor(e, t, n, r = 0) {
34
+ this.name = e, this.props = t, this.id = n, this.flags = r;
35
+ }
36
+ static define(t) {
37
+ let n = t.props && t.props.length ? Object.create(null) : S, r = +!!t.top | (t.skipped ? 2 : 0) | (t.error ? 4 : 0) | (t.name == null ? 8 : 0), i = new e(t.name || "", n, t.id, r);
38
+ if (t.props) {
39
+ for (let e of t.props) if (Array.isArray(e) || (e = e(i)), e) {
40
+ if (e[0].perNode) throw RangeError("Can't store a per-node prop on a node type");
41
+ n[e[0].id] = e[1];
42
+ }
43
+ }
44
+ return i;
45
+ }
46
+ prop(e) {
47
+ return this.props[e.id];
48
+ }
49
+ get isTop() {
50
+ return (this.flags & 1) > 0;
51
+ }
52
+ get isSkipped() {
53
+ return (this.flags & 2) > 0;
54
+ }
55
+ get isError() {
56
+ return (this.flags & 4) > 0;
57
+ }
58
+ get isAnonymous() {
59
+ return (this.flags & 8) > 0;
60
+ }
61
+ is(e) {
62
+ if (typeof e == "string") {
63
+ if (this.name == e) return !0;
64
+ let t = this.prop(b.group);
65
+ return t ? t.indexOf(e) > -1 : !1;
66
+ }
67
+ return this.id == e;
68
+ }
69
+ static match(e) {
70
+ let t = Object.create(null);
71
+ for (let n in e) for (let r of n.split(" ")) t[r] = e[n];
72
+ return (e) => {
73
+ for (let n = e.prop(b.group), r = -1; r < (n ? n.length : 0); r++) {
74
+ let i = t[r < 0 ? e.name : n[r]];
75
+ if (i) return i;
76
+ }
77
+ };
78
+ }
79
+ };
80
+ C.none = new C("", Object.create(null), 0, 8);
81
+ var w = class e {
82
+ constructor(e) {
83
+ this.types = e;
84
+ for (let t = 0; t < e.length; t++) if (e[t].id != t) throw RangeError("Node type ids should correspond to array positions when creating a node set");
85
+ }
86
+ extend(...t) {
87
+ let n = [];
88
+ for (let e of this.types) {
89
+ let r = null;
90
+ for (let n of t) {
91
+ let t = n(e);
92
+ if (t) {
93
+ r ||= Object.assign({}, e.props);
94
+ let n = t[1], i = t[0];
95
+ i.combine && i.id in r && (n = i.combine(r[i.id], n)), r[i.id] = n;
96
+ }
97
+ }
98
+ n.push(r ? new C(e.name, r, e.id, e.flags) : e);
99
+ }
100
+ return new e(n);
101
+ }
102
+ }, T = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), D;
103
+ (function(e) {
104
+ e[e.ExcludeBuffers = 1] = "ExcludeBuffers", e[e.IncludeAnonymous = 2] = "IncludeAnonymous", e[e.IgnoreMounts = 4] = "IgnoreMounts", e[e.IgnoreOverlays = 8] = "IgnoreOverlays", e[e.EnterBracketed = 16] = "EnterBracketed";
105
+ })(D ||= {});
106
+ var O = class e {
107
+ constructor(e, t, n, r, i) {
108
+ if (this.type = e, this.children = t, this.positions = n, this.length = r, this.props = null, i && i.length) {
109
+ this.props = Object.create(null);
110
+ for (let [e, t] of i) this.props[typeof e == "number" ? e : e.id] = t;
111
+ }
112
+ }
113
+ toString() {
114
+ let e = x.get(this);
115
+ if (e && !e.overlay) return e.tree.toString();
116
+ let t = "";
117
+ for (let e of this.children) {
118
+ let n = e.toString();
119
+ n && (t && (t += ","), t += n);
120
+ }
121
+ return this.type.name ? (/\W/.test(this.type.name) && !this.type.isError ? JSON.stringify(this.type.name) : this.type.name) + (t.length ? "(" + t + ")" : "") : t;
122
+ }
123
+ cursor(e = 0) {
124
+ return new ue(this.topNode, e);
125
+ }
126
+ cursorAt(e, t = 0, n = 0) {
127
+ let r = new ue(T.get(this) || this.topNode);
128
+ return r.moveTo(e, t), T.set(this, r._tree), r;
129
+ }
130
+ get topNode() {
131
+ return new j(this, 0, 0, null);
132
+ }
133
+ resolve(e, t = 0) {
134
+ let n = A(T.get(this) || this.topNode, e, t, !1);
135
+ return T.set(this, n), n;
136
+ }
137
+ resolveInner(e, t = 0) {
138
+ let n = A(E.get(this) || this.topNode, e, t, !0);
139
+ return E.set(this, n), n;
140
+ }
141
+ resolveStack(e, t = 0) {
142
+ return le(this, e, t);
143
+ }
144
+ iterate(e) {
145
+ let { enter: t, leave: n, from: r = 0, to: i = this.length } = e, a = e.mode || 0, o = (a & D.IncludeAnonymous) > 0;
146
+ for (let e = this.cursor(a | D.IncludeAnonymous);;) {
147
+ let a = !1;
148
+ if (e.from <= i && e.to >= r && (!o && e.type.isAnonymous || t(e) !== !1)) {
149
+ if (e.firstChild()) continue;
150
+ a = !0;
151
+ }
152
+ for (; a && n && (o || !e.type.isAnonymous) && n(e), !e.nextSibling();) {
153
+ if (!e.parent()) return;
154
+ a = !0;
155
+ }
156
+ }
157
+ }
158
+ prop(e) {
159
+ return e.perNode ? this.props ? this.props[e.id] : void 0 : this.type.prop(e);
160
+ }
161
+ get propValues() {
162
+ let e = [];
163
+ if (this.props) for (let t in this.props) e.push([+t, this.props[t]]);
164
+ return e;
165
+ }
166
+ balance(t = {}) {
167
+ return this.children.length <= 8 ? this : he(C.none, this.children, this.positions, 0, this.children.length, 0, this.length, (t, n, r) => new e(this.type, t, n, r, this.propValues), t.makeTree || ((t, n, r) => new e(C.none, t, n, r)));
168
+ }
169
+ static build(e) {
170
+ return fe(e);
171
+ }
172
+ };
173
+ O.empty = new O(C.none, [], [], 0);
174
+ var te = class e {
175
+ constructor(e, t) {
176
+ this.buffer = e, this.index = t;
177
+ }
178
+ get id() {
179
+ return this.buffer[this.index - 4];
180
+ }
181
+ get start() {
182
+ return this.buffer[this.index - 3];
183
+ }
184
+ get end() {
185
+ return this.buffer[this.index - 2];
186
+ }
187
+ get size() {
188
+ return this.buffer[this.index - 1];
189
+ }
190
+ get pos() {
191
+ return this.index;
192
+ }
193
+ next() {
194
+ this.index -= 4;
195
+ }
196
+ fork() {
197
+ return new e(this.buffer, this.index);
198
+ }
199
+ }, k = class e {
200
+ constructor(e, t, n) {
201
+ this.buffer = e, this.length = t, this.set = n;
202
+ }
203
+ get type() {
204
+ return C.none;
205
+ }
206
+ toString() {
207
+ let e = [];
208
+ for (let t = 0; t < this.buffer.length;) e.push(this.childString(t)), t = this.buffer[t + 3];
209
+ return e.join(",");
210
+ }
211
+ childString(e) {
212
+ let t = this.buffer[e], n = this.buffer[e + 3], r = this.set.types[t], i = r.name;
213
+ if (/\W/.test(i) && !r.isError && (i = JSON.stringify(i)), e += 4, n == e) return i;
214
+ let a = [];
215
+ for (; e < n;) a.push(this.childString(e)), e = this.buffer[e + 3];
216
+ return i + "(" + a.join(",") + ")";
217
+ }
218
+ findChild(e, t, n, r, i) {
219
+ let { buffer: a } = this, o = -1;
220
+ for (let s = e; s != t && !(ne(i, r, a[s + 1], a[s + 2]) && (o = s, n > 0)); s = a[s + 3]);
221
+ return o;
222
+ }
223
+ slice(t, n, r) {
224
+ let i = this.buffer, a = new Uint16Array(n - t), o = 0;
225
+ for (let e = t, s = 0; e < n;) {
226
+ a[s++] = i[e++], a[s++] = i[e++] - r;
227
+ let n = a[s++] = i[e++] - r;
228
+ a[s++] = i[e++] - t, o = Math.max(o, n);
229
+ }
230
+ return new e(a, o, this.set);
231
+ }
232
+ };
233
+ function ne(e, t, n, r) {
234
+ switch (e) {
235
+ case -2: return n < t;
236
+ case -1: return r >= t && n < t;
237
+ case 0: return n < t && r > t;
238
+ case 1: return n <= t && r > t;
239
+ case 2: return r > t;
240
+ case 4: return !0;
241
+ }
242
+ }
243
+ function A(e, t, n, r) {
244
+ for (; e.from == e.to || (n < 1 ? e.from >= t : e.from > t) || (n > -1 ? e.to <= t : e.to < t);) {
245
+ let t = !r && e instanceof j && e.index < 0 ? null : e.parent;
246
+ if (!t) return e;
247
+ e = t;
248
+ }
249
+ let i = r ? 0 : D.IgnoreOverlays;
250
+ if (r) for (let r = e, a = r.parent; a; r = a, a = r.parent) r instanceof j && r.index < 0 && a.enter(t, n, i)?.from != r.from && (e = a);
251
+ for (;;) {
252
+ let r = e.enter(t, n, i);
253
+ if (!r) return e;
254
+ e = r;
255
+ }
256
+ }
257
+ var re = class {
258
+ cursor(e = 0) {
259
+ return new ue(this, e);
260
+ }
261
+ getChild(e, t = null, n = null) {
262
+ let r = ie(this, e, t, n);
263
+ return r.length ? r[0] : null;
264
+ }
265
+ getChildren(e, t = null, n = null) {
266
+ return ie(this, e, t, n);
267
+ }
268
+ resolve(e, t = 0) {
269
+ return A(this, e, t, !1);
270
+ }
271
+ resolveInner(e, t = 0) {
272
+ return A(this, e, t, !0);
273
+ }
274
+ matchContext(e) {
275
+ return ae(this.parent, e);
276
+ }
277
+ enterUnfinishedNodesBefore(e) {
278
+ let t = this.childBefore(e), n = this;
279
+ for (; t;) {
280
+ let e = t.lastChild;
281
+ if (!e || e.to != t.to) break;
282
+ e.type.isError && e.from == e.to ? (n = t, t = e.prevSibling) : t = e;
283
+ }
284
+ return n;
285
+ }
286
+ get node() {
287
+ return this;
288
+ }
289
+ get next() {
290
+ return this.parent;
291
+ }
292
+ }, j = class e extends re {
293
+ constructor(e, t, n, r) {
294
+ super(), this._tree = e, this.from = t, this.index = n, this._parent = r;
295
+ }
296
+ get type() {
297
+ return this._tree.type;
298
+ }
299
+ get name() {
300
+ return this._tree.type.name;
301
+ }
302
+ get to() {
303
+ return this.from + this._tree.length;
304
+ }
305
+ nextChild(t, n, r, i, a = 0) {
306
+ for (let o = this;;) {
307
+ for (let { children: s, positions: c } = o._tree, l = n > 0 ? s.length : -1; t != l; t += n) {
308
+ let l = s[t], u = c[t] + o.from, d;
309
+ if (a & D.EnterBracketed && l instanceof O && (d = x.get(l)) && !d.overlay && d.bracketed && r >= u && r <= u + l.length || ne(i, r, u, u + l.length)) {
310
+ if (l instanceof k) {
311
+ if (a & D.ExcludeBuffers) continue;
312
+ let e = l.findChild(0, l.buffer.length, n, r - u, i);
313
+ if (e > -1) return new M(new oe(o, l, t, u), null, e);
314
+ } else if (a & D.IncludeAnonymous || !l.type.isAnonymous || de(l)) {
315
+ let s;
316
+ if (!(a & D.IgnoreMounts) && (s = x.get(l)) && !s.overlay) return new e(s.tree, u, t, o);
317
+ let c = new e(l, u, t, o);
318
+ return a & D.IncludeAnonymous || !c.type.isAnonymous ? c : c.nextChild(n < 0 ? l.children.length - 1 : 0, n, r, i, a);
319
+ }
320
+ }
321
+ }
322
+ if (a & D.IncludeAnonymous || !o.type.isAnonymous || (t = o.index >= 0 ? o.index + n : n < 0 ? -1 : o._parent._tree.children.length, o = o._parent, !o)) return null;
323
+ }
324
+ }
325
+ get firstChild() {
326
+ return this.nextChild(0, 1, 0, 4);
327
+ }
328
+ get lastChild() {
329
+ return this.nextChild(this._tree.children.length - 1, -1, 0, 4);
330
+ }
331
+ childAfter(e) {
332
+ return this.nextChild(0, 1, e, 2);
333
+ }
334
+ childBefore(e) {
335
+ return this.nextChild(this._tree.children.length - 1, -1, e, -2);
336
+ }
337
+ prop(e) {
338
+ return this._tree.prop(e);
339
+ }
340
+ enter(t, n, r = 0) {
341
+ let i;
342
+ if (!(r & D.IgnoreOverlays) && (i = x.get(this._tree)) && i.overlay) {
343
+ let a = t - this.from, o = r & D.EnterBracketed && i.bracketed;
344
+ for (let { from: t, to: r } of i.overlay) if ((n > 0 || o ? t <= a : t < a) && (n < 0 || o ? r >= a : r > a)) return new e(i.tree, i.overlay[0].from + this.from, -1, this);
345
+ }
346
+ return this.nextChild(0, 1, t, n, r);
347
+ }
348
+ nextSignificantParent() {
349
+ let e = this;
350
+ for (; e.type.isAnonymous && e._parent;) e = e._parent;
351
+ return e;
352
+ }
353
+ get parent() {
354
+ return this._parent ? this._parent.nextSignificantParent() : null;
355
+ }
356
+ get nextSibling() {
357
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index + 1, 1, 0, 4) : null;
358
+ }
359
+ get prevSibling() {
360
+ return this._parent && this.index >= 0 ? this._parent.nextChild(this.index - 1, -1, 0, 4) : null;
361
+ }
362
+ get tree() {
363
+ return this._tree;
364
+ }
365
+ toTree() {
366
+ return this._tree;
367
+ }
368
+ toString() {
369
+ return this._tree.toString();
370
+ }
371
+ };
372
+ function ie(e, t, n, r) {
373
+ let i = e.cursor(), a = [];
374
+ if (!i.firstChild()) return a;
375
+ if (n != null) {
376
+ for (let e = !1; !e;) if (e = i.type.is(n), !i.nextSibling()) return a;
377
+ }
378
+ for (;;) {
379
+ if (r != null && i.type.is(r)) return a;
380
+ if (i.type.is(t) && a.push(i.node), !i.nextSibling()) return r == null ? a : [];
381
+ }
382
+ }
383
+ function ae(e, t, n = t.length - 1) {
384
+ for (let r = e; n >= 0; r = r.parent) {
385
+ if (!r) return !1;
386
+ if (!r.type.isAnonymous) {
387
+ if (t[n] && t[n] != r.name) return !1;
388
+ n--;
389
+ }
390
+ }
391
+ return !0;
392
+ }
393
+ var oe = class {
394
+ constructor(e, t, n, r) {
395
+ this.parent = e, this.buffer = t, this.index = n, this.start = r;
396
+ }
397
+ }, M = class e extends re {
398
+ get name() {
399
+ return this.type.name;
400
+ }
401
+ get from() {
402
+ return this.context.start + this.context.buffer.buffer[this.index + 1];
403
+ }
404
+ get to() {
405
+ return this.context.start + this.context.buffer.buffer[this.index + 2];
406
+ }
407
+ constructor(e, t, n) {
408
+ super(), this.context = e, this._parent = t, this.index = n, this.type = e.buffer.set.types[e.buffer.buffer[n]];
409
+ }
410
+ child(t, n, r) {
411
+ let { buffer: i } = this.context, a = i.findChild(this.index + 4, i.buffer[this.index + 3], t, n - this.context.start, r);
412
+ return a < 0 ? null : new e(this.context, this, a);
413
+ }
414
+ get firstChild() {
415
+ return this.child(1, 0, 4);
416
+ }
417
+ get lastChild() {
418
+ return this.child(-1, 0, 4);
419
+ }
420
+ childAfter(e) {
421
+ return this.child(1, e, 2);
422
+ }
423
+ childBefore(e) {
424
+ return this.child(-1, e, -2);
425
+ }
426
+ prop(e) {
427
+ return this.type.prop(e);
428
+ }
429
+ enter(t, n, r = 0) {
430
+ if (r & D.ExcludeBuffers) return null;
431
+ let { buffer: i } = this.context, a = i.findChild(this.index + 4, i.buffer[this.index + 3], n > 0 ? 1 : -1, t - this.context.start, n);
432
+ return a < 0 ? null : new e(this.context, this, a);
433
+ }
434
+ get parent() {
435
+ return this._parent || this.context.parent.nextSignificantParent();
436
+ }
437
+ externalSibling(e) {
438
+ return this._parent ? null : this.context.parent.nextChild(this.context.index + e, e, 0, 4);
439
+ }
440
+ get nextSibling() {
441
+ let { buffer: t } = this.context, n = t.buffer[this.index + 3];
442
+ return n < (this._parent ? t.buffer[this._parent.index + 3] : t.buffer.length) ? new e(this.context, this._parent, n) : this.externalSibling(1);
443
+ }
444
+ get prevSibling() {
445
+ let { buffer: t } = this.context, n = this._parent ? this._parent.index + 4 : 0;
446
+ return this.index == n ? this.externalSibling(-1) : new e(this.context, this._parent, t.findChild(n, this.index, -1, 0, 4));
447
+ }
448
+ get tree() {
449
+ return null;
450
+ }
451
+ toTree() {
452
+ let e = [], t = [], { buffer: n } = this.context, r = this.index + 4, i = n.buffer[this.index + 3];
453
+ if (i > r) {
454
+ let a = n.buffer[this.index + 1];
455
+ e.push(n.slice(r, i, a)), t.push(0);
456
+ }
457
+ return new O(this.type, e, t, this.to - this.from);
458
+ }
459
+ toString() {
460
+ return this.context.buffer.childString(this.index);
461
+ }
462
+ };
463
+ function se(e) {
464
+ if (!e.length) return null;
465
+ let t = 0, n = e[0];
466
+ for (let r = 1; r < e.length; r++) {
467
+ let i = e[r];
468
+ (i.from > n.from || i.to < n.to) && (n = i, t = r);
469
+ }
470
+ let r = n instanceof j && n.index < 0 ? null : n.parent, i = e.slice();
471
+ return r ? i[t] = r : i.splice(t, 1), new ce(i, n);
472
+ }
473
+ var ce = class {
474
+ constructor(e, t) {
475
+ this.heads = e, this.node = t;
476
+ }
477
+ get next() {
478
+ return se(this.heads);
479
+ }
480
+ };
481
+ function le(e, t, n) {
482
+ let r = e.resolveInner(t, n), i = null;
483
+ for (let e = r instanceof j ? r : r.context.parent; e; e = e.parent) if (e.index < 0) {
484
+ let a = e.parent;
485
+ (i ||= [r]).push(a.resolve(t, n)), e = a;
486
+ } else {
487
+ let a = x.get(e.tree);
488
+ if (a && a.overlay && a.overlay[0].from <= t && a.overlay[a.overlay.length - 1].to >= t) {
489
+ let o = new j(a.tree, a.overlay[0].from + e.from, -1, e);
490
+ (i ||= [r]).push(A(o, t, n, !1));
491
+ }
492
+ }
493
+ return i ? se(i) : r;
494
+ }
495
+ var ue = class {
496
+ get name() {
497
+ return this.type.name;
498
+ }
499
+ constructor(e, t = 0) {
500
+ if (this.buffer = null, this.stack = [], this.index = 0, this.bufferNode = null, this.mode = t & ~D.EnterBracketed, e instanceof j) this.yieldNode(e);
501
+ else {
502
+ this._tree = e.context.parent, this.buffer = e.context;
503
+ for (let t = e._parent; t; t = t._parent) this.stack.unshift(t.index);
504
+ this.bufferNode = e, this.yieldBuf(e.index);
505
+ }
506
+ }
507
+ yieldNode(e) {
508
+ return e ? (this._tree = e, this.type = e.type, this.from = e.from, this.to = e.to, !0) : !1;
509
+ }
510
+ yieldBuf(e, t) {
511
+ this.index = e;
512
+ let { start: n, buffer: r } = this.buffer;
513
+ return this.type = t || r.set.types[r.buffer[e]], this.from = n + r.buffer[e + 1], this.to = n + r.buffer[e + 2], !0;
514
+ }
515
+ yield(e) {
516
+ return e ? e instanceof j ? (this.buffer = null, this.yieldNode(e)) : (this.buffer = e.context, this.yieldBuf(e.index, e.type)) : !1;
517
+ }
518
+ toString() {
519
+ return this.buffer ? this.buffer.buffer.childString(this.index) : this._tree.toString();
520
+ }
521
+ enterChild(e, t, n) {
522
+ if (!this.buffer) return this.yield(this._tree.nextChild(e < 0 ? this._tree._tree.children.length - 1 : 0, e, t, n, this.mode));
523
+ let { buffer: r } = this.buffer, i = r.findChild(this.index + 4, r.buffer[this.index + 3], e, t - this.buffer.start, n);
524
+ return i < 0 ? !1 : (this.stack.push(this.index), this.yieldBuf(i));
525
+ }
526
+ firstChild() {
527
+ return this.enterChild(1, 0, 4);
528
+ }
529
+ lastChild() {
530
+ return this.enterChild(-1, 0, 4);
531
+ }
532
+ childAfter(e) {
533
+ return this.enterChild(1, e, 2);
534
+ }
535
+ childBefore(e) {
536
+ return this.enterChild(-1, e, -2);
537
+ }
538
+ enter(e, t, n = this.mode) {
539
+ return this.buffer ? n & D.ExcludeBuffers ? !1 : this.enterChild(1, e, t) : this.yield(this._tree.enter(e, t, n));
540
+ }
541
+ parent() {
542
+ if (!this.buffer) return this.yieldNode(this.mode & D.IncludeAnonymous ? this._tree._parent : this._tree.parent);
543
+ if (this.stack.length) return this.yieldBuf(this.stack.pop());
544
+ let e = this.mode & D.IncludeAnonymous ? this.buffer.parent : this.buffer.parent.nextSignificantParent();
545
+ return this.buffer = null, this.yieldNode(e);
546
+ }
547
+ sibling(e) {
548
+ if (!this.buffer) return this._tree._parent ? this.yield(this._tree.index < 0 ? null : this._tree._parent.nextChild(this._tree.index + e, e, 0, 4, this.mode)) : !1;
549
+ let { buffer: t } = this.buffer, n = this.stack.length - 1;
550
+ if (e < 0) {
551
+ let e = n < 0 ? 0 : this.stack[n] + 4;
552
+ if (this.index != e) return this.yieldBuf(t.findChild(e, this.index, -1, 0, 4));
553
+ } else {
554
+ let e = t.buffer[this.index + 3];
555
+ if (e < (n < 0 ? t.buffer.length : t.buffer[this.stack[n] + 3])) return this.yieldBuf(e);
556
+ }
557
+ return n < 0 && this.yield(this.buffer.parent.nextChild(this.buffer.index + e, e, 0, 4, this.mode));
558
+ }
559
+ nextSibling() {
560
+ return this.sibling(1);
561
+ }
562
+ prevSibling() {
563
+ return this.sibling(-1);
564
+ }
565
+ atLastNode(e) {
566
+ let t, n, { buffer: r } = this;
567
+ if (r) {
568
+ if (e > 0) {
569
+ if (this.index < r.buffer.buffer.length) return !1;
570
+ } else for (let e = 0; e < this.index; e++) if (r.buffer.buffer[e + 3] < this.index) return !1;
571
+ ({index: t, parent: n} = r);
572
+ } else ({index: t, _parent: n} = this._tree);
573
+ for (; n; {index: t, _parent: n} = n) if (t > -1) for (let r = t + e, i = e < 0 ? -1 : n._tree.children.length; r != i; r += e) {
574
+ let e = n._tree.children[r];
575
+ if (this.mode & D.IncludeAnonymous || e instanceof k || !e.type.isAnonymous || de(e)) return !1;
576
+ }
577
+ return !0;
578
+ }
579
+ move(e, t) {
580
+ if (t && this.enterChild(e, 0, 4)) return !0;
581
+ for (;;) {
582
+ if (this.sibling(e)) return !0;
583
+ if (this.atLastNode(e) || !this.parent()) return !1;
584
+ }
585
+ }
586
+ next(e = !0) {
587
+ return this.move(1, e);
588
+ }
589
+ prev(e = !0) {
590
+ return this.move(-1, e);
591
+ }
592
+ moveTo(e, t = 0) {
593
+ for (; (this.from == this.to || (t < 1 ? this.from >= e : this.from > e) || (t > -1 ? this.to <= e : this.to < e)) && this.parent(););
594
+ for (; this.enterChild(1, e, t););
595
+ return this;
596
+ }
597
+ get node() {
598
+ if (!this.buffer) return this._tree;
599
+ let e = this.bufferNode, t = null, n = 0;
600
+ if (e && e.context == this.buffer) scan: for (let r = this.index, i = this.stack.length; i >= 0;) {
601
+ for (let a = e; a; a = a._parent) if (a.index == r) {
602
+ if (r == this.index) return a;
603
+ t = a, n = i + 1;
604
+ break scan;
605
+ }
606
+ r = this.stack[--i];
607
+ }
608
+ for (let e = n; e < this.stack.length; e++) t = new M(this.buffer, t, this.stack[e]);
609
+ return this.bufferNode = new M(this.buffer, t, this.index);
610
+ }
611
+ get tree() {
612
+ return this.buffer ? null : this._tree._tree;
613
+ }
614
+ iterate(e, t) {
615
+ for (let n = 0;;) {
616
+ let r = !1;
617
+ if (this.type.isAnonymous || e(this) !== !1) {
618
+ if (this.firstChild()) {
619
+ n++;
620
+ continue;
621
+ }
622
+ this.type.isAnonymous || (r = !0);
623
+ }
624
+ for (;;) {
625
+ if (r && t && t(this), r = this.type.isAnonymous, !n) return;
626
+ if (this.nextSibling()) break;
627
+ this.parent(), n--, r = !0;
628
+ }
629
+ }
630
+ }
631
+ matchContext(e) {
632
+ if (!this.buffer) return ae(this.node.parent, e);
633
+ let { buffer: t } = this.buffer, { types: n } = t.set;
634
+ for (let r = e.length - 1, i = this.stack.length - 1; r >= 0; i--) {
635
+ if (i < 0) return ae(this._tree, e, r);
636
+ let a = n[t.buffer[this.stack[i]]];
637
+ if (!a.isAnonymous) {
638
+ if (e[r] && e[r] != a.name) return !1;
639
+ r--;
640
+ }
641
+ }
642
+ return !0;
643
+ }
644
+ };
645
+ function de(e) {
646
+ return e.children.some((e) => e instanceof k || !e.type.isAnonymous || de(e));
647
+ }
648
+ function fe(e) {
649
+ let { buffer: t, nodeSet: n, maxBufferLength: r = ee, reused: i = [], minRepeatType: a = n.types.length } = e, o = Array.isArray(t) ? new te(t, t.length) : t, s = n.types, c = 0, l = 0;
650
+ function u(e, t, _, ee, v, y) {
651
+ let { id: b, start: x, end: S, size: C } = o, w = l, T = c;
652
+ if (C < 0) {
653
+ if (o.next(), C == -1) {
654
+ let t = i[b];
655
+ _.push(t), ee.push(x - e);
656
+ return;
657
+ }
658
+ if (C == -3) {
659
+ c = b;
660
+ return;
661
+ }
662
+ if (C == -4) {
663
+ l = b;
664
+ return;
665
+ }
666
+ throw RangeError(`Unrecognized record size: ${C}`);
667
+ }
668
+ let E = s[b], D, O, te = x - e;
669
+ if (S - x <= r && (O = h(o.pos - t, v))) {
670
+ let t = new Uint16Array(O.size - O.skip), r = o.pos - O.size, i = t.length;
671
+ for (; o.pos > r;) i = g(O.start, t, i);
672
+ D = new k(t, S - O.start, n), te = O.start - e;
673
+ } else {
674
+ let e = o.pos - C;
675
+ o.next();
676
+ let t = [], n = [], i = b >= a ? b : -1, s = 0, c = S;
677
+ for (; o.pos > e;) i >= 0 && o.id == i && o.size >= 0 ? (o.end <= c - r && (p(t, n, x, s, o.end, c, i, w, T), s = t.length, c = o.end), o.next()) : y > 2500 ? d(x, e, t, n) : u(x, e, t, n, i, y + 1);
678
+ if (i >= 0 && s > 0 && s < t.length && p(t, n, x, s, x, c, i, w, T), t.reverse(), n.reverse(), i > -1 && s > 0) {
679
+ let e = f(E, T);
680
+ D = he(E, t, n, 0, t.length, 0, S - x, e, e);
681
+ } else D = m(E, t, n, S - x, w - S, T);
682
+ }
683
+ _.push(D), ee.push(te);
684
+ }
685
+ function d(e, t, i, a) {
686
+ let s = [], c = 0, l = -1;
687
+ for (; o.pos > t;) {
688
+ let { id: e, start: t, end: n, size: i } = o;
689
+ if (i > 4) o.next();
690
+ else if (l > -1 && t < l) break;
691
+ else l < 0 && (l = n - r), s.push(e, t, n), c++, o.next();
692
+ }
693
+ if (c) {
694
+ let t = new Uint16Array(c * 4), r = s[s.length - 2];
695
+ for (let e = s.length - 3, n = 0; e >= 0; e -= 3) t[n++] = s[e], t[n++] = s[e + 1] - r, t[n++] = s[e + 2] - r, t[n++] = n;
696
+ i.push(new k(t, s[2] - r, n)), a.push(r - e);
697
+ }
698
+ }
699
+ function f(e, t) {
700
+ return (n, r, i) => {
701
+ let a = 0, o = n.length - 1, s, c;
702
+ if (o >= 0 && (s = n[o]) instanceof O) {
703
+ if (!o && s.type == e && s.length == i) return s;
704
+ (c = s.prop(b.lookAhead)) && (a = r[o] + s.length + c);
705
+ }
706
+ return m(e, n, r, i, a, t);
707
+ };
708
+ }
709
+ function p(e, t, r, i, a, o, s, c, l) {
710
+ let u = [], d = [];
711
+ for (; e.length > i;) u.push(e.pop()), d.push(t.pop() + r - a);
712
+ e.push(m(n.types[s], u, d, o - a, c - o, l)), t.push(a - r);
713
+ }
714
+ function m(e, t, n, r, i, a, o) {
715
+ if (a) {
716
+ let e = [b.contextHash, a];
717
+ o = o ? [e].concat(o) : [e];
718
+ }
719
+ if (i > 25) {
720
+ let e = [b.lookAhead, i];
721
+ o = o ? [e].concat(o) : [e];
722
+ }
723
+ return new O(e, t, n, r, o);
724
+ }
725
+ function h(e, t) {
726
+ let n = o.fork(), i = 0, s = 0, c = 0, l = n.end - r, u = {
727
+ size: 0,
728
+ start: 0,
729
+ skip: 0
730
+ };
731
+ scan: for (let r = n.pos - e; n.pos > r;) {
732
+ let e = n.size;
733
+ if (n.id == t && e >= 0) {
734
+ u.size = i, u.start = s, u.skip = c, c += 4, i += 4, n.next();
735
+ continue;
736
+ }
737
+ let o = n.pos - e;
738
+ if (e < 0 || o < r || n.start < l) break;
739
+ let d = n.id >= a ? 4 : 0, f = n.start;
740
+ for (n.next(); n.pos > o;) {
741
+ if (n.size < 0) {
742
+ if (n.size == -3 || n.size == -4) d += 4;
743
+ else break scan;
744
+ } else n.id >= a && (d += 4);
745
+ n.next();
746
+ }
747
+ s = f, i += e, c += d;
748
+ }
749
+ return (t < 0 || i == e) && (u.size = i, u.start = s, u.skip = c), u.size > 4 ? u : void 0;
750
+ }
751
+ function g(e, t, n) {
752
+ let { id: r, start: i, end: s, size: u } = o;
753
+ if (o.next(), u >= 0 && r < a) {
754
+ let a = n;
755
+ if (u > 4) {
756
+ let r = o.pos - (u - 4);
757
+ for (; o.pos > r;) n = g(e, t, n);
758
+ }
759
+ t[--n] = a, t[--n] = s - e, t[--n] = i - e, t[--n] = r;
760
+ } else u == -3 ? c = r : u == -4 && (l = r);
761
+ return n;
762
+ }
763
+ let _ = [], v = [];
764
+ for (; o.pos > 0;) u(e.start || 0, e.bufferStart || 0, _, v, -1, 0);
765
+ let y = e.length ?? (_.length ? v[0] + _[0].length : 0);
766
+ return new O(s[e.topID], _.reverse(), v.reverse(), y);
767
+ }
768
+ var pe = /* @__PURE__ */ new WeakMap();
769
+ function me(e, t) {
770
+ if (!e.isAnonymous || t instanceof k || t.type != e) return 1;
771
+ let n = pe.get(t);
772
+ if (n == null) {
773
+ n = 1;
774
+ for (let r of t.children) {
775
+ if (r.type != e || !(r instanceof O)) {
776
+ n = 1;
777
+ break;
778
+ }
779
+ n += me(e, r);
780
+ }
781
+ pe.set(t, n);
782
+ }
783
+ return n;
784
+ }
785
+ function he(e, t, n, r, i, a, o, s, c) {
786
+ let l = 0;
787
+ for (let n = r; n < i; n++) l += me(e, t[n]);
788
+ let u = Math.ceil(l * 1.5 / 8), d = [], f = [];
789
+ function p(t, n, r, i, o) {
790
+ for (let s = r; s < i;) {
791
+ let r = s, l = n[s], m = me(e, t[s]);
792
+ for (s++; s < i; s++) {
793
+ let n = me(e, t[s]);
794
+ if (m + n >= u) break;
795
+ m += n;
796
+ }
797
+ if (s == r + 1) {
798
+ if (m > u) {
799
+ let e = t[r];
800
+ p(e.children, e.positions, 0, e.children.length, n[r] + o);
801
+ continue;
802
+ }
803
+ d.push(t[r]);
804
+ } else {
805
+ let i = n[s - 1] + t[s - 1].length - l;
806
+ d.push(he(e, t, n, r, s, l, i, null, c));
807
+ }
808
+ f.push(l + o - a);
809
+ }
810
+ }
811
+ return p(t, n, r, i, 0), (s || c)(d, f, o);
812
+ }
813
+ var ge = class {
814
+ constructor() {
815
+ this.map = /* @__PURE__ */ new WeakMap();
816
+ }
817
+ setBuffer(e, t, n) {
818
+ let r = this.map.get(e);
819
+ r || this.map.set(e, r = /* @__PURE__ */ new Map()), r.set(t, n);
820
+ }
821
+ getBuffer(e, t) {
822
+ let n = this.map.get(e);
823
+ return n && n.get(t);
824
+ }
825
+ set(e, t) {
826
+ e instanceof M ? this.setBuffer(e.context.buffer, e.index, t) : e instanceof j && this.map.set(e.tree, t);
827
+ }
828
+ get(e) {
829
+ return e instanceof M ? this.getBuffer(e.context.buffer, e.index) : e instanceof j ? this.map.get(e.tree) : void 0;
830
+ }
831
+ cursorSet(e, t) {
832
+ e.buffer ? this.setBuffer(e.buffer.buffer, e.index, t) : this.map.set(e.tree, t);
833
+ }
834
+ cursorGet(e) {
835
+ return e.buffer ? this.getBuffer(e.buffer.buffer, e.index) : this.map.get(e.tree);
836
+ }
837
+ }, N = class e {
838
+ constructor(e, t, n, r, i = !1, a = !1) {
839
+ this.from = e, this.to = t, this.tree = n, this.offset = r, this.open = !!i | (a ? 2 : 0);
840
+ }
841
+ get openStart() {
842
+ return (this.open & 1) > 0;
843
+ }
844
+ get openEnd() {
845
+ return (this.open & 2) > 0;
846
+ }
847
+ static addTree(t, n = [], r = !1) {
848
+ let i = [new e(0, t.length, t, 0, !1, r)];
849
+ for (let e of n) e.to > t.length && i.push(e);
850
+ return i;
851
+ }
852
+ static applyChanges(t, n, r = 128) {
853
+ if (!n.length) return t;
854
+ let i = [], a = 1, o = t.length ? t[0] : null;
855
+ for (let s = 0, c = 0, l = 0;; s++) {
856
+ let u = s < n.length ? n[s] : null, d = u ? u.fromA : 1e9;
857
+ if (d - c >= r) for (; o && o.from < d;) {
858
+ let n = o;
859
+ if (c >= n.from || d <= n.to || l) {
860
+ let t = Math.max(n.from, c) - l, r = Math.min(n.to, d) - l;
861
+ n = t >= r ? null : new e(t, r, n.tree, n.offset + l, s > 0, !!u);
862
+ }
863
+ if (n && i.push(n), o.to > d) break;
864
+ o = a < t.length ? t[a++] : null;
865
+ }
866
+ if (!u) break;
867
+ c = u.toA, l = u.toA - u.toB;
868
+ }
869
+ return i;
870
+ }
871
+ }, _e = class {
872
+ startParse(e, t, n) {
873
+ return typeof e == "string" && (e = new ve(e)), n = n ? n.length ? n.map((e) => new y(e.from, e.to)) : [new y(0, 0)] : [new y(0, e.length)], this.createParse(e, t || [], n);
874
+ }
875
+ parse(e, t, n) {
876
+ let r = this.startParse(e, t, n);
877
+ for (;;) {
878
+ let e = r.advance();
879
+ if (e) return e;
880
+ }
881
+ }
882
+ }, ve = class {
883
+ constructor(e) {
884
+ this.string = e;
885
+ }
886
+ get length() {
887
+ return this.string.length;
888
+ }
889
+ chunk(e) {
890
+ return this.string.slice(e);
891
+ }
892
+ get lineChunks() {
893
+ return !1;
894
+ }
895
+ read(e, t) {
896
+ return this.string.slice(e, t);
897
+ }
898
+ };
899
+ function ye(e) {
900
+ return (t, n, r, i) => new we(t, e, n, r, i);
901
+ }
902
+ var be = class {
903
+ constructor(e, t, n, r, i, a) {
904
+ this.parser = e, this.parse = t, this.overlay = n, this.bracketed = r, this.target = i, this.from = a;
905
+ }
906
+ };
907
+ function xe(e) {
908
+ if (!e.length || e.some((e) => e.from >= e.to)) throw RangeError("Invalid inner parse ranges given: " + JSON.stringify(e));
909
+ }
910
+ var Se = class {
911
+ constructor(e, t, n, r, i, a, o, s) {
912
+ this.parser = e, this.predicate = t, this.mounts = n, this.index = r, this.start = i, this.bracketed = a, this.target = o, this.prev = s, this.depth = 0, this.ranges = [];
913
+ }
914
+ }, Ce = new b({ perNode: !0 }), we = class {
915
+ constructor(e, t, n, r, i) {
916
+ this.nest = t, this.input = n, this.fragments = r, this.ranges = i, this.inner = [], this.innerDone = 0, this.baseTree = null, this.stoppedAt = null, this.baseParse = e;
917
+ }
918
+ advance() {
919
+ if (this.baseParse) {
920
+ let e = this.baseParse.advance();
921
+ if (!e) return null;
922
+ if (this.baseParse = null, this.baseTree = e, this.startInner(), this.stoppedAt != null) for (let e of this.inner) e.parse.stopAt(this.stoppedAt);
923
+ }
924
+ if (this.innerDone == this.inner.length) {
925
+ let e = this.baseTree;
926
+ return this.stoppedAt != null && (e = new O(e.type, e.children, e.positions, e.length, e.propValues.concat([[Ce, this.stoppedAt]]))), e;
927
+ }
928
+ let e = this.inner[this.innerDone], t = e.parse.advance();
929
+ if (t) {
930
+ this.innerDone++;
931
+ let n = Object.assign(Object.create(null), e.target.props);
932
+ n[b.mounted.id] = new x(t, e.overlay, e.parser, e.bracketed), e.target.props = n;
933
+ }
934
+ return null;
935
+ }
936
+ get parsedPos() {
937
+ if (this.baseParse) return 0;
938
+ let e = this.input.length;
939
+ for (let t = this.innerDone; t < this.inner.length; t++) this.inner[t].from < e && (e = Math.min(e, this.inner[t].parse.parsedPos));
940
+ return e;
941
+ }
942
+ stopAt(e) {
943
+ if (this.stoppedAt = e, this.baseParse) this.baseParse.stopAt(e);
944
+ else for (let t = this.innerDone; t < this.inner.length; t++) this.inner[t].parse.stopAt(e);
945
+ }
946
+ startInner() {
947
+ let e = new ke(this.fragments), t = null, n = null, r = new ue(new j(this.baseTree, this.ranges[0].from, 0, null), D.IncludeAnonymous | D.IgnoreMounts);
948
+ scan: for (let i, a;;) {
949
+ let o = !0, s;
950
+ if (this.stoppedAt != null && r.from >= this.stoppedAt) o = !1;
951
+ else if (e.hasNode(r)) {
952
+ if (t) {
953
+ let e = t.mounts.find((e) => e.frag.from <= r.from && e.frag.to >= r.to && e.mount.overlay);
954
+ if (e) for (let n of e.mount.overlay) {
955
+ let i = n.from + e.pos, a = n.to + e.pos;
956
+ i >= r.from && a <= r.to && !t.ranges.some((e) => e.from < a && e.to > i) && t.ranges.push({
957
+ from: i,
958
+ to: a
959
+ });
960
+ }
961
+ }
962
+ o = !1;
963
+ } else if (n && (a = Te(n.ranges, r.from, r.to))) o = a != 2;
964
+ else if (!r.type.isAnonymous && (i = this.nest(r, this.input)) && (r.from < r.to || !i.overlay)) {
965
+ r.tree || (De(r), t && t.depth++, n && n.depth++);
966
+ let a = e.findMounts(r.from, i.parser);
967
+ if (typeof i.overlay == "function") t = new Se(i.parser, i.overlay, a, this.inner.length, r.from, !!i.bracketed, r.tree, t);
968
+ else {
969
+ let e = Ae(this.ranges, i.overlay || (r.from < r.to ? [new y(r.from, r.to)] : []));
970
+ e.length && xe(e), (e.length || !i.overlay) && this.inner.push(new be(i.parser, e.length ? i.parser.startParse(this.input, Me(a, e), e) : i.parser.startParse(""), i.overlay ? i.overlay.map((e) => new y(e.from - r.from, e.to - r.from)) : null, !!i.bracketed, r.tree, e.length ? e[0].from : r.from)), i.overlay ? e.length && (n = {
971
+ ranges: e,
972
+ depth: 0,
973
+ prev: n
974
+ }) : o = !1;
975
+ }
976
+ } else if (t && (s = t.predicate(r)) && (s === !0 && (s = new y(r.from, r.to)), s.from < s.to)) {
977
+ let e = t.ranges.length - 1;
978
+ e >= 0 && t.ranges[e].to == s.from ? t.ranges[e] = {
979
+ from: t.ranges[e].from,
980
+ to: s.to
981
+ } : t.ranges.push(s);
982
+ }
983
+ if (o && r.firstChild()) t && t.depth++, n && n.depth++;
984
+ else for (; !r.nextSibling();) {
985
+ if (!r.parent()) break scan;
986
+ if (t && !--t.depth) {
987
+ let e = Ae(this.ranges, t.ranges);
988
+ e.length && (xe(e), this.inner.splice(t.index, 0, new be(t.parser, t.parser.startParse(this.input, Me(t.mounts, e), e), t.ranges.map((e) => new y(e.from - t.start, e.to - t.start)), t.bracketed, t.target, e[0].from))), t = t.prev;
989
+ }
990
+ n && !--n.depth && (n = n.prev);
991
+ }
992
+ }
993
+ }
994
+ };
995
+ function Te(e, t, n) {
996
+ for (let r of e) {
997
+ if (r.from >= n) break;
998
+ if (r.to > t) return r.from <= t && r.to >= n ? 2 : 1;
999
+ }
1000
+ return 0;
1001
+ }
1002
+ function Ee(e, t, n, r, i, a) {
1003
+ if (t < n) {
1004
+ let o = e.buffer[t + 1];
1005
+ r.push(e.slice(t, n, o)), i.push(o - a);
1006
+ }
1007
+ }
1008
+ function De(e) {
1009
+ let { node: t } = e, n = [], r = t.context.buffer;
1010
+ do
1011
+ n.push(e.index), e.parent();
1012
+ while (!e.tree);
1013
+ let i = e.tree, a = i.children.indexOf(r), o = i.children[a], s = o.buffer, c = [a];
1014
+ function l(e, r, i, a, u, d) {
1015
+ let f = n[d], p = [], m = [];
1016
+ Ee(o, e, f, p, m, a);
1017
+ let h = s[f + 1], g = s[f + 2];
1018
+ c.push(p.length);
1019
+ let _ = d ? l(f + 4, s[f + 3], o.set.types[s[f]], h, g - h, d - 1) : t.toTree();
1020
+ return p.push(_), m.push(h - a), Ee(o, s[f + 3], r, p, m, a), new O(i, p, m, u);
1021
+ }
1022
+ i.children[a] = l(0, s.length, C.none, 0, o.length, n.length - 1);
1023
+ for (let t of c) {
1024
+ let n = e.tree.children[t], r = e.tree.positions[t];
1025
+ e.yield(new j(n, r + e.from, t, e._tree));
1026
+ }
1027
+ }
1028
+ var Oe = class {
1029
+ constructor(e, t) {
1030
+ this.offset = t, this.done = !1, this.cursor = e.cursor(D.IncludeAnonymous | D.IgnoreMounts | D.ExcludeBuffers);
1031
+ }
1032
+ moveTo(e) {
1033
+ let { cursor: t } = this, n = e - this.offset;
1034
+ for (; !this.done && t.from < n;) if (!(t.to >= n && t.enter(n, 1, D.IncludeAnonymous | D.IgnoreOverlays | D.ExcludeBuffers))) {
1035
+ if (t.to <= n) t.next(!1) || (this.done = !0);
1036
+ else break;
1037
+ }
1038
+ }
1039
+ hasNode(e) {
1040
+ if (this.moveTo(e.from), !this.done && this.cursor.from + this.offset == e.from && this.cursor.tree) for (let t = this.cursor.tree;;) {
1041
+ if (t == e.tree) return !0;
1042
+ if (t.children.length && t.positions[0] == 0 && t.children[0] instanceof O) t = t.children[0];
1043
+ else break;
1044
+ }
1045
+ return !1;
1046
+ }
1047
+ }, ke = class {
1048
+ constructor(e) {
1049
+ if (this.fragments = e, this.curTo = 0, this.fragI = 0, e.length) {
1050
+ let t = this.curFrag = e[0];
1051
+ this.curTo = t.tree.prop(Ce) ?? t.to, this.inner = new Oe(t.tree, -t.offset);
1052
+ } else this.curFrag = this.inner = null;
1053
+ }
1054
+ hasNode(e) {
1055
+ for (; this.curFrag && e.from >= this.curTo;) this.nextFrag();
1056
+ return this.curFrag && this.curFrag.from <= e.from && this.curTo >= e.to && this.inner.hasNode(e);
1057
+ }
1058
+ nextFrag() {
1059
+ if (this.fragI++, this.fragI == this.fragments.length) this.curFrag = this.inner = null;
1060
+ else {
1061
+ let e = this.curFrag = this.fragments[this.fragI];
1062
+ this.curTo = e.tree.prop(Ce) ?? e.to, this.inner = new Oe(e.tree, -e.offset);
1063
+ }
1064
+ }
1065
+ findMounts(e, t) {
1066
+ let n = [];
1067
+ if (this.inner) {
1068
+ this.inner.cursor.moveTo(e, 1);
1069
+ for (let e = this.inner.cursor.node; e; e = e.parent) {
1070
+ let r = e.tree?.prop(b.mounted);
1071
+ if (r && r.parser == t) for (let t = this.fragI; t < this.fragments.length; t++) {
1072
+ let i = this.fragments[t];
1073
+ if (i.from >= e.to) break;
1074
+ i.tree == this.curFrag.tree && n.push({
1075
+ frag: i,
1076
+ pos: e.from - i.offset,
1077
+ mount: r
1078
+ });
1079
+ }
1080
+ }
1081
+ }
1082
+ return n;
1083
+ }
1084
+ };
1085
+ function Ae(e, t) {
1086
+ let n = null, r = t;
1087
+ for (let i = 1, a = 0; i < e.length; i++) {
1088
+ let o = e[i - 1].to, s = e[i].from;
1089
+ for (; a < r.length; a++) {
1090
+ let e = r[a];
1091
+ if (e.from >= s) break;
1092
+ e.to <= o || (n || (r = n = t.slice()), e.from < o ? (n[a] = new y(e.from, o), e.to > s && n.splice(a + 1, 0, new y(s, e.to))) : e.to > s ? n[a--] = new y(s, e.to) : n.splice(a--, 1));
1093
+ }
1094
+ }
1095
+ return r;
1096
+ }
1097
+ function je(e, t, n, r) {
1098
+ let i = 0, a = 0, o = !1, s = !1, c = -1e9, l = [];
1099
+ for (;;) {
1100
+ let u = i == e.length ? 1e9 : o ? e[i].to : e[i].from, d = a == t.length ? 1e9 : s ? t[a].to : t[a].from;
1101
+ if (o != s) {
1102
+ let e = Math.max(c, n), t = Math.min(u, d, r);
1103
+ e < t && l.push(new y(e, t));
1104
+ }
1105
+ if (c = Math.min(u, d), c == 1e9) break;
1106
+ u == c && (o ? (o = !1, i++) : o = !0), d == c && (s ? (s = !1, a++) : s = !0);
1107
+ }
1108
+ return l;
1109
+ }
1110
+ function Me(e, t) {
1111
+ let n = [];
1112
+ for (let { pos: r, mount: i, frag: a } of e) {
1113
+ let e = r + (i.overlay ? i.overlay[0].from : 0), o = e + i.tree.length, s = Math.max(a.from, e), c = Math.min(a.to, o);
1114
+ if (i.overlay) {
1115
+ let o = je(t, i.overlay.map((e) => new y(e.from + r, e.to + r)), s, c);
1116
+ for (let t = 0, r = s;; t++) {
1117
+ let s = t == o.length, l = s ? c : o[t].from;
1118
+ if (l > r && n.push(new N(r, l, i.tree, -e, a.from >= r || a.openStart, a.to <= l || a.openEnd)), s) break;
1119
+ r = o[t].to;
1120
+ }
1121
+ } else n.push(new N(s, c, i.tree, -e, a.from >= e || a.openStart, a.to <= o || a.openEnd));
1122
+ }
1123
+ return n;
1124
+ }
1125
+ //#endregion
1126
+ //#region ../node_modules/@lezer/highlight/dist/index.js
1127
+ var Ne = 0, P = class e {
1128
+ constructor(e, t, n, r) {
1129
+ this.name = e, this.set = t, this.base = n, this.modified = r, this.id = Ne++;
1130
+ }
1131
+ toString() {
1132
+ let { name: e } = this;
1133
+ for (let t of this.modified) t.name && (e = `${t.name}(${e})`);
1134
+ return e;
1135
+ }
1136
+ static define(t, n) {
1137
+ let r = typeof t == "string" ? t : "?";
1138
+ if (t instanceof e && (n = t), n?.base) throw Error("Can not derive from a modified tag");
1139
+ let i = new e(r, [], null, []);
1140
+ if (i.set.push(i), n) for (let e of n.set) i.set.push(e);
1141
+ return i;
1142
+ }
1143
+ static defineModifier(e) {
1144
+ let t = new Fe(e);
1145
+ return (e) => e.modified.indexOf(t) > -1 ? e : Fe.get(e.base || e, e.modified.concat(t).sort((e, t) => e.id - t.id));
1146
+ }
1147
+ }, Pe = 0, Fe = class e {
1148
+ constructor(e) {
1149
+ this.name = e, this.instances = [], this.id = Pe++;
1150
+ }
1151
+ static get(t, n) {
1152
+ if (!n.length) return t;
1153
+ let r = n[0].instances.find((e) => e.base == t && Ie(n, e.modified));
1154
+ if (r) return r;
1155
+ let i = [], a = new P(t.name, i, t, n);
1156
+ for (let e of n) e.instances.push(a);
1157
+ let o = Le(n);
1158
+ for (let n of t.set) if (!n.modified.length) for (let t of o) i.push(e.get(n, t));
1159
+ return a;
1160
+ }
1161
+ };
1162
+ function Ie(e, t) {
1163
+ return e.length == t.length && e.every((e, n) => e == t[n]);
1164
+ }
1165
+ function Le(e) {
1166
+ let t = [[]];
1167
+ for (let n = 0; n < e.length; n++) for (let r = 0, i = t.length; r < i; r++) t.push(t[r].concat(e[n]));
1168
+ return t.sort((e, t) => t.length - e.length);
1169
+ }
1170
+ function Re(e) {
1171
+ let t = Object.create(null);
1172
+ for (let n in e) {
1173
+ let r = e[n];
1174
+ Array.isArray(r) || (r = [r]);
1175
+ for (let e of n.split(" ")) if (e) {
1176
+ let n = [], i = 2, a = e;
1177
+ for (let t = 0;;) {
1178
+ if (a == "..." && t > 0 && t + 3 == e.length) {
1179
+ i = 1;
1180
+ break;
1181
+ }
1182
+ let r = /^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);
1183
+ if (!r) throw RangeError("Invalid path: " + e);
1184
+ if (n.push(r[0] == "*" ? "" : r[0][0] == "\"" ? JSON.parse(r[0]) : r[0]), t += r[0].length, t == e.length) break;
1185
+ let o = e[t++];
1186
+ if (t == e.length && o == "!") {
1187
+ i = 0;
1188
+ break;
1189
+ }
1190
+ if (o != "/") throw RangeError("Invalid path: " + e);
1191
+ a = e.slice(t);
1192
+ }
1193
+ let o = n.length - 1, s = n[o];
1194
+ if (!s) throw RangeError("Invalid path: " + e);
1195
+ t[s] = new F(r, i, o > 0 ? n.slice(0, o) : null).sort(t[s]);
1196
+ }
1197
+ }
1198
+ return ze.add(t);
1199
+ }
1200
+ var ze = new b({ combine(e, t) {
1201
+ let n, r, i;
1202
+ for (; e || t;) {
1203
+ if (!e || t && e.depth <= t.depth ? (i = t, t = t.next) : (i = e, e = e.next), n && n.mode == i.mode && !i.context && !n.context) continue;
1204
+ let a = new F(i.tags, i.mode, i.context);
1205
+ n ? n.next = a : r = a, n = a;
1206
+ }
1207
+ return r;
1208
+ } }), F = class {
1209
+ constructor(e, t, n, r) {
1210
+ this.tags = e, this.mode = t, this.context = n, this.next = r;
1211
+ }
1212
+ get opaque() {
1213
+ return this.mode == 0;
1214
+ }
1215
+ get inherit() {
1216
+ return this.mode == 1;
1217
+ }
1218
+ sort(e) {
1219
+ return !e || e.depth < this.depth ? (this.next = e, this) : (e.next = this.sort(e.next), e);
1220
+ }
1221
+ get depth() {
1222
+ return this.context ? this.context.length : 0;
1223
+ }
1224
+ };
1225
+ F.empty = new F([], 2, null);
1226
+ function Be(e, t) {
1227
+ let n = Object.create(null);
1228
+ for (let t of e) if (!Array.isArray(t.tag)) n[t.tag.id] = t.class;
1229
+ else for (let e of t.tag) n[e.id] = t.class;
1230
+ let { scope: r, all: i = null } = t || {};
1231
+ return {
1232
+ style: (e) => {
1233
+ let t = i;
1234
+ for (let r of e) for (let e of r.set) {
1235
+ let r = n[e.id];
1236
+ if (r) {
1237
+ t = t ? t + " " + r : r;
1238
+ break;
1239
+ }
1240
+ }
1241
+ return t;
1242
+ },
1243
+ scope: r
1244
+ };
1245
+ }
1246
+ function Ve(e, t) {
1247
+ let n = null;
1248
+ for (let r of e) {
1249
+ let e = r.style(t);
1250
+ e && (n = n ? n + " " + e : e);
1251
+ }
1252
+ return n;
1253
+ }
1254
+ function He(e, t, n, r = 0, i = e.length) {
1255
+ let a = new Ue(r, Array.isArray(t) ? t : [t], n);
1256
+ a.highlightRange(e.cursor(), r, i, "", a.highlighters), a.flush(i);
1257
+ }
1258
+ var Ue = class {
1259
+ constructor(e, t, n) {
1260
+ this.at = e, this.highlighters = t, this.span = n, this.class = "";
1261
+ }
1262
+ startSpan(e, t) {
1263
+ t != this.class && (this.flush(e), e > this.at && (this.at = e), this.class = t);
1264
+ }
1265
+ flush(e) {
1266
+ e > this.at && this.class && this.span(this.at, e, this.class);
1267
+ }
1268
+ highlightRange(e, t, n, r, i) {
1269
+ let { type: a, from: o, to: s } = e;
1270
+ if (o >= n || s <= t) return;
1271
+ a.isTop && (i = this.highlighters.filter((e) => !e.scope || e.scope(a)));
1272
+ let c = r, l = We(e) || F.empty, u = Ve(i, l.tags);
1273
+ if (u && (c && (c += " "), c += u, l.mode == 1 && (r += (r ? " " : "") + u)), this.startSpan(Math.max(t, o), c), l.opaque) return;
1274
+ let d = e.tree && e.tree.prop(b.mounted);
1275
+ if (d && d.overlay) {
1276
+ let a = e.node.enter(d.overlay[0].from + o, 1), l = this.highlighters.filter((e) => !e.scope || e.scope(d.tree.type)), u = e.firstChild();
1277
+ for (let f = 0, p = o;; f++) {
1278
+ let m = f < d.overlay.length ? d.overlay[f] : null, h = m ? m.from + o : s, g = Math.max(t, p), _ = Math.min(n, h);
1279
+ if (g < _ && u) for (; e.from < _ && (this.highlightRange(e, g, _, r, i), this.startSpan(Math.min(_, e.to), c), !(e.to >= h || !e.nextSibling())););
1280
+ if (!m || h > n) break;
1281
+ p = m.to + o, p > t && (this.highlightRange(a.cursor(), Math.max(t, m.from + o), Math.min(n, p), "", l), this.startSpan(Math.min(n, p), c));
1282
+ }
1283
+ u && e.parent();
1284
+ } else if (e.firstChild()) {
1285
+ d && (r = "");
1286
+ do
1287
+ if (!(e.to <= t)) {
1288
+ if (e.from >= n) break;
1289
+ this.highlightRange(e, t, n, r, i), this.startSpan(Math.min(n, e.to), c);
1290
+ }
1291
+ while (e.nextSibling());
1292
+ e.parent();
1293
+ }
1294
+ }
1295
+ };
1296
+ function We(e) {
1297
+ let t = e.type.prop(ze);
1298
+ for (; t && t.context && !e.matchContext(t.context);) t = t.next;
1299
+ return t || null;
1300
+ }
1301
+ var I = P.define, Ge = I(), L = I(), Ke = I(L), qe = I(L), R = I(), Je = I(R), Ye = I(R), z = I(), B = I(z), V = I(), H = I(), Xe = I(), U = I(Xe), Ze = I(), W = {
1302
+ comment: Ge,
1303
+ lineComment: I(Ge),
1304
+ blockComment: I(Ge),
1305
+ docComment: I(Ge),
1306
+ name: L,
1307
+ variableName: I(L),
1308
+ typeName: Ke,
1309
+ tagName: I(Ke),
1310
+ propertyName: qe,
1311
+ attributeName: I(qe),
1312
+ className: I(L),
1313
+ labelName: I(L),
1314
+ namespace: I(L),
1315
+ macroName: I(L),
1316
+ literal: R,
1317
+ string: Je,
1318
+ docString: I(Je),
1319
+ character: I(Je),
1320
+ attributeValue: I(Je),
1321
+ number: Ye,
1322
+ integer: I(Ye),
1323
+ float: I(Ye),
1324
+ bool: I(R),
1325
+ regexp: I(R),
1326
+ escape: I(R),
1327
+ color: I(R),
1328
+ url: I(R),
1329
+ keyword: V,
1330
+ self: I(V),
1331
+ null: I(V),
1332
+ atom: I(V),
1333
+ unit: I(V),
1334
+ modifier: I(V),
1335
+ operatorKeyword: I(V),
1336
+ controlKeyword: I(V),
1337
+ definitionKeyword: I(V),
1338
+ moduleKeyword: I(V),
1339
+ operator: H,
1340
+ derefOperator: I(H),
1341
+ arithmeticOperator: I(H),
1342
+ logicOperator: I(H),
1343
+ bitwiseOperator: I(H),
1344
+ compareOperator: I(H),
1345
+ updateOperator: I(H),
1346
+ definitionOperator: I(H),
1347
+ typeOperator: I(H),
1348
+ controlOperator: I(H),
1349
+ punctuation: Xe,
1350
+ separator: I(Xe),
1351
+ bracket: U,
1352
+ angleBracket: I(U),
1353
+ squareBracket: I(U),
1354
+ paren: I(U),
1355
+ brace: I(U),
1356
+ content: z,
1357
+ heading: B,
1358
+ heading1: I(B),
1359
+ heading2: I(B),
1360
+ heading3: I(B),
1361
+ heading4: I(B),
1362
+ heading5: I(B),
1363
+ heading6: I(B),
1364
+ contentSeparator: I(z),
1365
+ list: I(z),
1366
+ quote: I(z),
1367
+ emphasis: I(z),
1368
+ strong: I(z),
1369
+ link: I(z),
1370
+ monospace: I(z),
1371
+ strikethrough: I(z),
1372
+ inserted: I(),
1373
+ deleted: I(),
1374
+ changed: I(),
1375
+ invalid: I(),
1376
+ meta: Ze,
1377
+ documentMeta: I(Ze),
1378
+ annotation: I(Ze),
1379
+ processingInstruction: I(Ze),
1380
+ definition: P.defineModifier("definition"),
1381
+ constant: P.defineModifier("constant"),
1382
+ function: P.defineModifier("function"),
1383
+ standard: P.defineModifier("standard"),
1384
+ local: P.defineModifier("local"),
1385
+ special: P.defineModifier("special")
1386
+ };
1387
+ for (let e in W) {
1388
+ let t = W[e];
1389
+ t instanceof P && (t.name = e);
1390
+ }
1391
+ var Qe = Be([
1392
+ {
1393
+ tag: W.link,
1394
+ class: "tok-link"
1395
+ },
1396
+ {
1397
+ tag: W.heading,
1398
+ class: "tok-heading"
1399
+ },
1400
+ {
1401
+ tag: W.emphasis,
1402
+ class: "tok-emphasis"
1403
+ },
1404
+ {
1405
+ tag: W.strong,
1406
+ class: "tok-strong"
1407
+ },
1408
+ {
1409
+ tag: W.keyword,
1410
+ class: "tok-keyword"
1411
+ },
1412
+ {
1413
+ tag: W.atom,
1414
+ class: "tok-atom"
1415
+ },
1416
+ {
1417
+ tag: W.bool,
1418
+ class: "tok-bool"
1419
+ },
1420
+ {
1421
+ tag: W.url,
1422
+ class: "tok-url"
1423
+ },
1424
+ {
1425
+ tag: W.labelName,
1426
+ class: "tok-labelName"
1427
+ },
1428
+ {
1429
+ tag: W.inserted,
1430
+ class: "tok-inserted"
1431
+ },
1432
+ {
1433
+ tag: W.deleted,
1434
+ class: "tok-deleted"
1435
+ },
1436
+ {
1437
+ tag: W.literal,
1438
+ class: "tok-literal"
1439
+ },
1440
+ {
1441
+ tag: W.string,
1442
+ class: "tok-string"
1443
+ },
1444
+ {
1445
+ tag: W.number,
1446
+ class: "tok-number"
1447
+ },
1448
+ {
1449
+ tag: [
1450
+ W.regexp,
1451
+ W.escape,
1452
+ W.special(W.string)
1453
+ ],
1454
+ class: "tok-string2"
1455
+ },
1456
+ {
1457
+ tag: W.variableName,
1458
+ class: "tok-variableName"
1459
+ },
1460
+ {
1461
+ tag: W.local(W.variableName),
1462
+ class: "tok-variableName tok-local"
1463
+ },
1464
+ {
1465
+ tag: W.definition(W.variableName),
1466
+ class: "tok-variableName tok-definition"
1467
+ },
1468
+ {
1469
+ tag: W.special(W.variableName),
1470
+ class: "tok-variableName2"
1471
+ },
1472
+ {
1473
+ tag: W.definition(W.propertyName),
1474
+ class: "tok-propertyName tok-definition"
1475
+ },
1476
+ {
1477
+ tag: W.typeName,
1478
+ class: "tok-typeName"
1479
+ },
1480
+ {
1481
+ tag: W.namespace,
1482
+ class: "tok-namespace"
1483
+ },
1484
+ {
1485
+ tag: W.className,
1486
+ class: "tok-className"
1487
+ },
1488
+ {
1489
+ tag: W.macroName,
1490
+ class: "tok-macroName"
1491
+ },
1492
+ {
1493
+ tag: W.propertyName,
1494
+ class: "tok-propertyName"
1495
+ },
1496
+ {
1497
+ tag: W.operator,
1498
+ class: "tok-operator"
1499
+ },
1500
+ {
1501
+ tag: W.comment,
1502
+ class: "tok-comment"
1503
+ },
1504
+ {
1505
+ tag: W.meta,
1506
+ class: "tok-meta"
1507
+ },
1508
+ {
1509
+ tag: W.invalid,
1510
+ class: "tok-invalid"
1511
+ },
1512
+ {
1513
+ tag: W.punctuation,
1514
+ class: "tok-punctuation"
1515
+ }
1516
+ ]);
1517
+ //#endregion
1518
+ //#region ../node_modules/@codemirror/streamparser/dist/index.js
1519
+ function $e(e, t, n, r = 0, i = 0) {
1520
+ t ?? (t = e.search(/[^\s\u00a0]/), t == -1 && (t = e.length));
1521
+ let a = i;
1522
+ for (let i = r; i < t; i++) e.charCodeAt(i) == 9 ? a += n - a % n : a++;
1523
+ return a;
1524
+ }
1525
+ var et = class {
1526
+ constructor(e, t, n, r) {
1527
+ this.string = e, this.tabSize = t, this.indentUnit = n, this.overrideIndent = r, this.pos = 0, this.start = 0, this.lastColumnPos = 0, this.lastColumnValue = 0;
1528
+ }
1529
+ eol() {
1530
+ return this.pos >= this.string.length;
1531
+ }
1532
+ sol() {
1533
+ return this.pos == 0;
1534
+ }
1535
+ peek() {
1536
+ return this.string.charAt(this.pos) || void 0;
1537
+ }
1538
+ next() {
1539
+ if (this.pos < this.string.length) return this.string.charAt(this.pos++);
1540
+ }
1541
+ eat(e) {
1542
+ let t = this.string.charAt(this.pos), n;
1543
+ if (n = typeof e == "string" ? t == e : t && (e instanceof RegExp ? e.test(t) : e(t)), n) return ++this.pos, t;
1544
+ }
1545
+ eatWhile(e) {
1546
+ let t = this.pos;
1547
+ for (; this.eat(e););
1548
+ return this.pos > t;
1549
+ }
1550
+ eatSpace() {
1551
+ let e = this.pos;
1552
+ for (; /[\s\u00a0]/.test(this.string.charAt(this.pos));) ++this.pos;
1553
+ return this.pos > e;
1554
+ }
1555
+ skipToEnd() {
1556
+ this.pos = this.string.length;
1557
+ }
1558
+ skipTo(e) {
1559
+ let t = this.string.indexOf(e, this.pos);
1560
+ if (t > -1) return this.pos = t, !0;
1561
+ }
1562
+ backUp(e) {
1563
+ this.pos -= e;
1564
+ }
1565
+ column() {
1566
+ return this.lastColumnPos < this.start && (this.lastColumnValue = $e(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue;
1567
+ }
1568
+ indentation() {
1569
+ return this.overrideIndent ?? $e(this.string, null, this.tabSize);
1570
+ }
1571
+ match(e, t, n) {
1572
+ if (typeof e == "string") {
1573
+ let r = (e) => n ? e.toLowerCase() : e;
1574
+ return r(this.string.substr(this.pos, e.length)) == r(e) ? (t !== !1 && (this.pos += e.length), !0) : null;
1575
+ }
1576
+ {
1577
+ let n = this.string.slice(this.pos).match(e);
1578
+ return n && n.index > 0 ? null : (n && t !== !1 && (this.pos += n[0].length), n);
1579
+ }
1580
+ }
1581
+ current() {
1582
+ return this.string.slice(this.start, this.pos);
1583
+ }
1584
+ }, G = /*@__PURE__*/ new b();
1585
+ function tt(e) {
1586
+ return a.define({ combine: e ? (t) => t.concat(e) : void 0 });
1587
+ }
1588
+ var nt = /*@__PURE__*/ new b(), K = class {
1589
+ constructor(e, t, r = [], i = "") {
1590
+ this.data = e, this.name = i, n.prototype.hasOwnProperty("tree") || Object.defineProperty(n.prototype, "tree", { get() {
1591
+ return q(this);
1592
+ } }), this.parser = t, this.extension = [Y.of(this), n.languageData.of((e, t, n) => {
1593
+ let r = rt(e, t, n), i = r.type.prop(G);
1594
+ if (!i) return [];
1595
+ let a = e.facet(i), o = r.type.prop(nt);
1596
+ if (o) {
1597
+ let i = r.resolve(t - r.from, n);
1598
+ for (let t of o) if (t.test(i, e)) {
1599
+ let n = e.facet(t.facet);
1600
+ return t.type == "replace" ? n : n.concat(a);
1601
+ }
1602
+ }
1603
+ return a;
1604
+ })].concat(r);
1605
+ }
1606
+ isActiveAt(e, t, n = -1) {
1607
+ return rt(e, t, n).type.prop(G) == this.data;
1608
+ }
1609
+ findRegions(e) {
1610
+ let t = e.facet(Y);
1611
+ if (t?.data == this.data) return [{
1612
+ from: 0,
1613
+ to: e.doc.length
1614
+ }];
1615
+ if (!t || !t.allowsNesting) return [];
1616
+ let n = [], r = (e, t) => {
1617
+ if (e.prop(G) == this.data) {
1618
+ n.push({
1619
+ from: t,
1620
+ to: t + e.length
1621
+ });
1622
+ return;
1623
+ }
1624
+ let i = e.prop(b.mounted);
1625
+ if (i) {
1626
+ if (i.tree.prop(G) == this.data) {
1627
+ if (i.overlay) for (let e of i.overlay) n.push({
1628
+ from: e.from + t,
1629
+ to: e.to + t
1630
+ });
1631
+ else n.push({
1632
+ from: t,
1633
+ to: t + e.length
1634
+ });
1635
+ return;
1636
+ }
1637
+ if (i.overlay) {
1638
+ let e = n.length;
1639
+ if (r(i.tree, i.overlay[0].from + t), n.length > e) return;
1640
+ }
1641
+ }
1642
+ for (let n = 0; n < e.children.length; n++) {
1643
+ let i = e.children[n];
1644
+ i instanceof O && r(i, e.positions[n] + t);
1645
+ }
1646
+ };
1647
+ return r(q(e), 0), n;
1648
+ }
1649
+ get allowsNesting() {
1650
+ return !0;
1651
+ }
1652
+ };
1653
+ K.setState = /*@__PURE__*/ o.define();
1654
+ function rt(e, t, n) {
1655
+ let r = e.facet(Y), i = q(e).topNode;
1656
+ if (!r || r.allowsNesting) for (let e = i; e; e = e.enter(t, n, D.ExcludeBuffers | D.EnterBracketed)) e.type.isTop && (i = e);
1657
+ return i;
1658
+ }
1659
+ var it = class e extends K {
1660
+ constructor(e, t, n) {
1661
+ super(e, t, [], n), this.parser = t;
1662
+ }
1663
+ static define(t) {
1664
+ let n = tt(t.languageData);
1665
+ return new e(n, t.parser.configure({ props: [G.add((e) => e.isTop ? n : void 0)] }), t.name);
1666
+ }
1667
+ configure(t, n) {
1668
+ return new e(this.data, this.parser.configure(t), n || this.name);
1669
+ }
1670
+ get allowsNesting() {
1671
+ return this.parser.hasWrappers();
1672
+ }
1673
+ };
1674
+ function q(e) {
1675
+ let t = e.field(K.state, !1);
1676
+ return t ? t.tree : O.empty;
1677
+ }
1678
+ var at = class {
1679
+ constructor(e) {
1680
+ this.doc = e, this.cursorPos = 0, this.string = "", this.cursor = e.iter();
1681
+ }
1682
+ get length() {
1683
+ return this.doc.length;
1684
+ }
1685
+ syncTo(e) {
1686
+ return this.string = this.cursor.next(e - this.cursorPos).value, this.cursorPos = e + this.string.length, this.cursorPos - this.string.length;
1687
+ }
1688
+ chunk(e) {
1689
+ return this.syncTo(e), this.string;
1690
+ }
1691
+ get lineChunks() {
1692
+ return !0;
1693
+ }
1694
+ read(e, t) {
1695
+ let n = this.cursorPos - this.string.length;
1696
+ return e < n || t >= this.cursorPos ? this.doc.sliceString(e, t) : this.string.slice(e - n, t - n);
1697
+ }
1698
+ }, J = null, ot = class e {
1699
+ constructor(e, t, n = [], r, i, a, o, s) {
1700
+ this.parser = e, this.state = t, this.fragments = n, this.tree = r, this.treeLen = i, this.viewport = a, this.skipped = o, this.scheduleOn = s, this.parse = null, this.tempSkipped = [];
1701
+ }
1702
+ static create(t, n, r) {
1703
+ return new e(t, n, [], O.empty, 0, r, [], null);
1704
+ }
1705
+ startParse() {
1706
+ return this.parser.startParse(new at(this.state.doc), this.fragments);
1707
+ }
1708
+ work(e, t) {
1709
+ return t != null && t >= this.state.doc.length && (t = void 0), this.tree != O.empty && this.isDone(t ?? this.state.doc.length) ? (this.takeTree(), !0) : this.withContext(() => {
1710
+ if (typeof e == "number") {
1711
+ let t = Date.now() + e;
1712
+ e = () => Date.now() > t;
1713
+ }
1714
+ for (this.parse ||= this.startParse(), t != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > t) && t < this.state.doc.length && this.parse.stopAt(t);;) {
1715
+ let n = this.parse.advance();
1716
+ if (n) {
1717
+ if (this.fragments = this.withoutTempSkipped(N.addTree(n, this.fragments, this.parse.stoppedAt != null)), this.treeLen = this.parse.stoppedAt ?? this.state.doc.length, this.tree = n, this.parse = null, this.treeLen < (t ?? this.state.doc.length)) this.parse = this.startParse();
1718
+ else return !0;
1719
+ }
1720
+ if (e()) return !1;
1721
+ }
1722
+ });
1723
+ }
1724
+ takeTree() {
1725
+ let e, t;
1726
+ this.parse && (e = this.parse.parsedPos) >= this.treeLen && ((this.parse.stoppedAt == null || this.parse.stoppedAt > e) && this.parse.stopAt(e), this.withContext(() => {
1727
+ for (; !(t = this.parse.advance()););
1728
+ }), this.treeLen = e, this.tree = t, this.fragments = this.withoutTempSkipped(N.addTree(this.tree, this.fragments, !0)), this.parse = null);
1729
+ }
1730
+ withContext(e) {
1731
+ let t = J;
1732
+ J = this;
1733
+ try {
1734
+ return e();
1735
+ } finally {
1736
+ J = t;
1737
+ }
1738
+ }
1739
+ withoutTempSkipped(e) {
1740
+ for (let t; t = this.tempSkipped.pop();) e = st(e, t.from, t.to);
1741
+ return e;
1742
+ }
1743
+ changes(t, n) {
1744
+ let { fragments: r, tree: i, treeLen: a, viewport: o, skipped: s } = this;
1745
+ if (this.takeTree(), !t.empty) {
1746
+ let e = [];
1747
+ if (t.iterChangedRanges((t, n, r, i) => e.push({
1748
+ fromA: t,
1749
+ toA: n,
1750
+ fromB: r,
1751
+ toB: i
1752
+ })), r = N.applyChanges(r, e), i = O.empty, a = 0, o = {
1753
+ from: t.mapPos(o.from, -1),
1754
+ to: t.mapPos(o.to, 1)
1755
+ }, this.skipped.length) {
1756
+ s = [];
1757
+ for (let e of this.skipped) {
1758
+ let n = t.mapPos(e.from, 1), r = t.mapPos(e.to, -1);
1759
+ n < r && s.push({
1760
+ from: n,
1761
+ to: r
1762
+ });
1763
+ }
1764
+ }
1765
+ }
1766
+ return new e(this.parser, n, r, i, a, o, s, this.scheduleOn);
1767
+ }
1768
+ updateViewport(e) {
1769
+ if (this.viewport.from == e.from && this.viewport.to == e.to) return !1;
1770
+ this.viewport = e;
1771
+ let t = this.skipped.length;
1772
+ for (let t = 0; t < this.skipped.length; t++) {
1773
+ let { from: n, to: r } = this.skipped[t];
1774
+ n < e.to && r > e.from && (this.fragments = st(this.fragments, n, r), this.skipped.splice(t--, 1));
1775
+ }
1776
+ return this.skipped.length >= t ? !1 : (this.reset(), !0);
1777
+ }
1778
+ reset() {
1779
+ this.parse &&= (this.takeTree(), null);
1780
+ }
1781
+ skipUntilInView(e, t) {
1782
+ this.skipped.push({
1783
+ from: e,
1784
+ to: t
1785
+ });
1786
+ }
1787
+ static getSkippingParser(e) {
1788
+ return new class extends _e {
1789
+ createParse(t, n, r) {
1790
+ let i = r[0].from, a = r[r.length - 1].to;
1791
+ return {
1792
+ parsedPos: i,
1793
+ advance() {
1794
+ let t = J;
1795
+ if (t) {
1796
+ for (let e of r) t.tempSkipped.push(e);
1797
+ e && (t.scheduleOn = t.scheduleOn ? Promise.all([t.scheduleOn, e]) : e);
1798
+ }
1799
+ return this.parsedPos = a, new O(C.none, [], [], a - i);
1800
+ },
1801
+ stoppedAt: null,
1802
+ stopAt() {}
1803
+ };
1804
+ }
1805
+ }();
1806
+ }
1807
+ isDone(e) {
1808
+ e = Math.min(e, this.state.doc.length);
1809
+ let t = this.fragments;
1810
+ return this.treeLen >= e && t.length && t[0].from == 0 && t[0].to >= e;
1811
+ }
1812
+ static get() {
1813
+ return J;
1814
+ }
1815
+ };
1816
+ function st(e, t, n) {
1817
+ return N.applyChanges(e, [{
1818
+ fromA: t,
1819
+ toA: n,
1820
+ fromB: t,
1821
+ toB: n
1822
+ }]);
1823
+ }
1824
+ var ct = class e {
1825
+ constructor(e) {
1826
+ this.context = e, this.tree = e.tree;
1827
+ }
1828
+ apply(t) {
1829
+ if (!t.docChanged && this.tree == this.context.tree) return this;
1830
+ let n = this.context.changes(t.changes, t.state), r = this.context.treeLen == t.startState.doc.length ? void 0 : Math.max(t.changes.mapPos(this.context.treeLen), n.viewport.to);
1831
+ return n.work(20, r) || n.takeTree(), new e(n);
1832
+ }
1833
+ static init(t) {
1834
+ let n = Math.min(3e3, t.doc.length), r = ot.create(t.facet(Y).parser, t, {
1835
+ from: 0,
1836
+ to: n
1837
+ });
1838
+ return r.work(20, n) || r.takeTree(), new e(r);
1839
+ }
1840
+ };
1841
+ K.state = /*@__PURE__*/ r.define({
1842
+ create: ct.init,
1843
+ update(e, t) {
1844
+ for (let e of t.effects) if (e.is(K.setState)) return e.value;
1845
+ return t.startState.facet(Y) == t.state.facet(Y) ? e.apply(t) : ct.init(t.state);
1846
+ }
1847
+ });
1848
+ var lt = (e) => {
1849
+ let t = setTimeout(() => e(), 500);
1850
+ return () => clearTimeout(t);
1851
+ };
1852
+ typeof requestIdleCallback < "u" && (lt = (e) => {
1853
+ let t = -1, n = setTimeout(() => {
1854
+ t = requestIdleCallback(e, { timeout: 400 });
1855
+ }, 100);
1856
+ return () => t < 0 ? clearTimeout(n) : cancelIdleCallback(t);
1857
+ });
1858
+ var ut = typeof navigator < "u" && navigator.scheduling?.isInputPending ? () => navigator.scheduling.isInputPending() : null, dt = /*@__PURE__*/ l.fromClass(class {
1859
+ constructor(e) {
1860
+ this.view = e, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork();
1861
+ }
1862
+ update(e) {
1863
+ let t = this.view.state.field(K.state).context;
1864
+ (t.updateViewport(e.view.viewport) || this.view.viewport.to > t.treeLen) && this.scheduleWork(), (e.docChanged || e.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(t);
1865
+ }
1866
+ scheduleWork() {
1867
+ if (this.working) return;
1868
+ let { state: e } = this.view, t = e.field(K.state);
1869
+ (t.tree != t.context.tree || !t.context.isDone(e.doc.length)) && (this.working = lt(this.work));
1870
+ }
1871
+ work(e) {
1872
+ this.working = null;
1873
+ let t = Date.now();
1874
+ if (this.chunkEnd < t && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = t + 3e4, this.chunkBudget = 3e3), this.chunkBudget <= 0) return;
1875
+ let { state: n, viewport: { to: r } } = this.view, i = n.field(K.state);
1876
+ if (i.tree == i.context.tree && i.context.isDone(r + 1e5)) return;
1877
+ let a = Date.now() + Math.min(this.chunkBudget, 100, e && !ut ? Math.max(25, e.timeRemaining() - 5) : 1e9), o = i.context.treeLen < r && n.doc.length > r + 1e3, s = i.context.work(() => ut && ut() || Date.now() > a, r + (o ? 0 : 1e5));
1878
+ this.chunkBudget -= Date.now() - t, (s || this.chunkBudget <= 0) && (i.context.takeTree(), this.view.dispatch({ effects: K.setState.of(new ct(i.context)) })), this.chunkBudget > 0 && (!s || o) && this.scheduleWork(), this.checkAsyncSchedule(i.context);
1879
+ }
1880
+ checkAsyncSchedule(e) {
1881
+ e.scheduleOn &&= (this.workScheduled++, e.scheduleOn.then(() => this.scheduleWork()).catch((e) => c(this.view.state, e)).then(() => this.workScheduled--), null);
1882
+ }
1883
+ destroy() {
1884
+ this.working && this.working();
1885
+ }
1886
+ isWorking() {
1887
+ return !!(this.working || this.workScheduled > 0);
1888
+ }
1889
+ }, { eventHandlers: { focus() {
1890
+ this.scheduleWork();
1891
+ } } }), Y = /*@__PURE__*/ a.define({
1892
+ combine(e) {
1893
+ return e.length ? e[0] : null;
1894
+ },
1895
+ enables: (e) => [
1896
+ K.state,
1897
+ dt,
1898
+ g.contentAttributes.compute([e], (t) => {
1899
+ let n = t.facet(e);
1900
+ return n && n.name ? { "data-language": n.name } : {};
1901
+ })
1902
+ ]
1903
+ }), ft = class {
1904
+ constructor(e, t = []) {
1905
+ this.language = e, this.support = t, this.extension = [e, t];
1906
+ }
1907
+ }, pt = class e {
1908
+ constructor(e, t, n, r, i, a = void 0) {
1909
+ this.name = e, this.alias = t, this.extensions = n, this.filename = r, this.loadFunc = i, this.support = a, this.loading = null;
1910
+ }
1911
+ load() {
1912
+ return this.loading ||= this.loadFunc().then((e) => this.support = e, (e) => {
1913
+ throw this.loading = null, e;
1914
+ });
1915
+ }
1916
+ static of(t) {
1917
+ let { load: n, support: r } = t;
1918
+ if (!n) {
1919
+ if (!r) throw RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");
1920
+ n = () => Promise.resolve(r);
1921
+ }
1922
+ return new e(t.name, (t.alias || []).concat(t.name).map((e) => e.toLowerCase()), t.extensions || [], t.filename, n, r);
1923
+ }
1924
+ static matchFilename(e, t) {
1925
+ for (let n of e) if (n.filename && n.filename.test(t)) return n;
1926
+ let n = /\.([^.]+)$/.exec(t);
1927
+ if (n) {
1928
+ for (let t of e) if (t.extensions.indexOf(n[1]) > -1) return t;
1929
+ }
1930
+ return null;
1931
+ }
1932
+ static matchLanguageName(e, t, n = !0) {
1933
+ t = t.toLowerCase();
1934
+ for (let n of e) if (n.alias.some((e) => e == t)) return n;
1935
+ if (n) for (let n of e) for (let e of n.alias) {
1936
+ let r = t.indexOf(e);
1937
+ if (r > -1 && (e.length > 2 || !/\w/.test(t[r - 1]) && !/\w/.test(t[r + e.length]))) return n;
1938
+ }
1939
+ return null;
1940
+ }
1941
+ }, mt = /*@__PURE__*/ a.define(), ht = /*@__PURE__*/ a.define({ combine: (e) => {
1942
+ if (!e.length) return " ";
1943
+ let t = e[0];
1944
+ if (!t || /\S/.test(t) || Array.from(t).some((e) => e != t[0])) throw Error("Invalid indent unit: " + JSON.stringify(e[0]));
1945
+ return t;
1946
+ } });
1947
+ function X(e) {
1948
+ let t = e.facet(ht);
1949
+ return t.charCodeAt(0) == 9 ? e.tabSize * t.length : t.length;
1950
+ }
1951
+ function gt(e, t) {
1952
+ let n = "", r = e.tabSize, i = e.facet(ht)[0];
1953
+ if (i == " ") {
1954
+ for (; t >= r;) n += " ", t -= r;
1955
+ i = " ";
1956
+ }
1957
+ for (let e = 0; e < t; e++) n += i;
1958
+ return n;
1959
+ }
1960
+ function _t(e, t) {
1961
+ e instanceof n && (e = new vt(e));
1962
+ for (let n of e.state.facet(mt)) {
1963
+ let r = n(e, t);
1964
+ if (r !== void 0) return r;
1965
+ }
1966
+ let r = q(e.state);
1967
+ return r.length >= t ? bt(e, r, t) : null;
1968
+ }
1969
+ var vt = class {
1970
+ constructor(e, t = {}) {
1971
+ this.state = e, this.options = t, this.unit = X(e);
1972
+ }
1973
+ lineAt(e, t = 1) {
1974
+ let n = this.state.doc.lineAt(e), { simulateBreak: r, simulateDoubleBreak: i } = this.options;
1975
+ return r != null && r >= n.from && r <= n.to ? i && r == e ? {
1976
+ text: "",
1977
+ from: e
1978
+ } : (t < 0 ? r < e : r <= e) ? {
1979
+ text: n.text.slice(r - n.from),
1980
+ from: r
1981
+ } : {
1982
+ text: n.text.slice(0, r - n.from),
1983
+ from: n.from
1984
+ } : n;
1985
+ }
1986
+ textAfterPos(e, t = 1) {
1987
+ if (this.options.simulateDoubleBreak && e == this.options.simulateBreak) return "";
1988
+ let { text: n, from: r } = this.lineAt(e, t);
1989
+ return n.slice(e - r, Math.min(n.length, e + 100 - r));
1990
+ }
1991
+ column(e, t = 1) {
1992
+ let { text: n, from: r } = this.lineAt(e, t), i = this.countColumn(n, e - r), a = this.options.overrideIndentation ? this.options.overrideIndentation(r) : -1;
1993
+ return a > -1 && (i += a - this.countColumn(n, n.search(/\S|$/))), i;
1994
+ }
1995
+ countColumn(e, t = e.length) {
1996
+ return s(e, this.state.tabSize, t);
1997
+ }
1998
+ lineIndent(e, t = 1) {
1999
+ let { text: n, from: r } = this.lineAt(e, t), i = this.options.overrideIndentation;
2000
+ if (i) {
2001
+ let e = i(r);
2002
+ if (e > -1) return e;
2003
+ }
2004
+ return this.countColumn(n, n.search(/\S|$/));
2005
+ }
2006
+ get simulatedBreak() {
2007
+ return this.options.simulateBreak || null;
2008
+ }
2009
+ }, yt = /*@__PURE__*/ new b();
2010
+ function bt(e, t, n) {
2011
+ let r = t.resolveStack(n), i = t.resolveInner(n, -1).resolve(n, 0).enterUnfinishedNodesBefore(n);
2012
+ if (i != r.node) {
2013
+ let e = [];
2014
+ for (let t = i; t && !(t.from < r.node.from || t.to > r.node.to || t.from == r.node.from && t.type == r.node.type); t = t.parent) e.push(t);
2015
+ for (let t = e.length - 1; t >= 0; t--) r = {
2016
+ node: e[t],
2017
+ next: r
2018
+ };
2019
+ }
2020
+ return xt(r, e, n);
2021
+ }
2022
+ function xt(e, t, n) {
2023
+ for (let r = e; r; r = r.next) {
2024
+ let e = Ct(r.node);
2025
+ if (e) return e(Tt.create(t, n, r));
2026
+ }
2027
+ return 0;
2028
+ }
2029
+ function St(e) {
2030
+ return e.pos == e.options.simulateBreak && e.options.simulateDoubleBreak;
2031
+ }
2032
+ function Ct(e) {
2033
+ let t = e.type.prop(yt);
2034
+ if (t) return t;
2035
+ let n = e.firstChild, r;
2036
+ if (n && (r = n.type.prop(b.closedBy))) {
2037
+ let t = e.lastChild, n = t && r.indexOf(t.name) > -1;
2038
+ return (e) => kt(e, !0, 1, void 0, n && !St(e) ? t.from : void 0);
2039
+ }
2040
+ return e.parent == null ? wt : null;
2041
+ }
2042
+ function wt() {
2043
+ return 0;
2044
+ }
2045
+ var Tt = class e extends vt {
2046
+ constructor(e, t, n) {
2047
+ super(e.state, e.options), this.base = e, this.pos = t, this.context = n;
2048
+ }
2049
+ get node() {
2050
+ return this.context.node;
2051
+ }
2052
+ static create(t, n, r) {
2053
+ return new e(t, n, r);
2054
+ }
2055
+ get textAfter() {
2056
+ return this.textAfterPos(this.pos);
2057
+ }
2058
+ get baseIndent() {
2059
+ return this.baseIndentFor(this.node);
2060
+ }
2061
+ baseIndentFor(e) {
2062
+ let t = this.state.doc.lineAt(e.from);
2063
+ for (;;) {
2064
+ let n = e.resolve(t.from);
2065
+ for (; n.parent && n.parent.from == n.from;) n = n.parent;
2066
+ if (Et(n, e)) break;
2067
+ t = this.state.doc.lineAt(n.from);
2068
+ }
2069
+ return this.lineIndent(t.from);
2070
+ }
2071
+ continue() {
2072
+ return xt(this.context.next, this.base, this.pos);
2073
+ }
2074
+ };
2075
+ function Et(e, t) {
2076
+ for (let n = t; n; n = n.parent) if (e == n) return !0;
2077
+ return !1;
2078
+ }
2079
+ function Dt(e) {
2080
+ let t = e.node, n = t.childAfter(t.from), r = t.lastChild;
2081
+ if (!n) return null;
2082
+ let i = e.options.simulateBreak, a = e.state.doc.lineAt(n.from), o = i == null || i <= a.from ? a.to : Math.min(a.to, i);
2083
+ for (let e = n.to;;) {
2084
+ let i = t.childAfter(e);
2085
+ if (!i || i == r) return null;
2086
+ if (!i.type.isSkipped) {
2087
+ if (i.from >= o) return null;
2088
+ let e = /^ */.exec(a.text.slice(n.to - a.from))[0].length;
2089
+ return {
2090
+ from: n.from,
2091
+ to: n.to + e
2092
+ };
2093
+ }
2094
+ e = i.to;
2095
+ }
2096
+ }
2097
+ function Ot({ closing: e, align: t = !0, units: n = 1 }) {
2098
+ return (r) => kt(r, t, n, e);
2099
+ }
2100
+ function kt(e, t, n, r, i) {
2101
+ let a = e.textAfter, o = a.match(/^\s*/)[0].length, s = r && a.slice(o, o + r.length) == r || i == e.pos + o, c = t ? Dt(e) : null;
2102
+ return c ? s ? e.column(c.from) : e.column(c.to) : e.baseIndent + (s ? 0 : e.unit * n);
2103
+ }
2104
+ var At = (e) => e.baseIndent;
2105
+ function jt({ except: e, units: t = 1 } = {}) {
2106
+ return (n) => {
2107
+ let r = e && e.test(n.textAfter);
2108
+ return n.baseIndent + (r ? 0 : t * n.unit);
2109
+ };
2110
+ }
2111
+ var Mt = 200;
2112
+ function Nt() {
2113
+ return n.transactionFilter.of((e) => {
2114
+ if (!e.docChanged || !e.isUserEvent("input.type") && !e.isUserEvent("input.complete")) return e;
2115
+ let t = e.startState.languageDataAt("indentOnInput", e.startState.selection.main.head);
2116
+ if (!t.length) return e;
2117
+ let n = e.newDoc, { head: r } = e.newSelection.main, i = n.lineAt(r);
2118
+ if (r > i.from + Mt) return e;
2119
+ let a = n.sliceString(i.from, r);
2120
+ if (!t.some((e) => e.test(a))) return e;
2121
+ let { state: o } = e, s = -1, c = [];
2122
+ for (let { head: e } of o.selection.ranges) {
2123
+ let t = o.doc.lineAt(e);
2124
+ if (t.from == s) continue;
2125
+ s = t.from;
2126
+ let n = _t(o, t.from);
2127
+ if (n == null) continue;
2128
+ let r = /^\s*/.exec(t.text)[0], i = gt(o, n);
2129
+ r != i && c.push({
2130
+ from: t.from,
2131
+ to: t.from + r.length,
2132
+ insert: i
2133
+ });
2134
+ }
2135
+ return c.length ? [e, {
2136
+ changes: c,
2137
+ sequential: !0
2138
+ }] : e;
2139
+ });
2140
+ }
2141
+ var Pt = /*@__PURE__*/ a.define(), Ft = /*@__PURE__*/ new b();
2142
+ function It(e) {
2143
+ let t = e.firstChild, n = e.lastChild;
2144
+ return t && t.to < n.from ? {
2145
+ from: t.to,
2146
+ to: n.type.isError ? e.to : n.from
2147
+ } : null;
2148
+ }
2149
+ function Lt(e, t, n) {
2150
+ let r = q(e);
2151
+ if (r.length < n) return null;
2152
+ let i = r.resolveStack(n, 1), a = null;
2153
+ for (let o = i; o; o = o.next) {
2154
+ let i = o.node;
2155
+ if (i.to <= n || i.from > n) continue;
2156
+ if (a && i.from < t) break;
2157
+ let s = i.type.prop(Ft);
2158
+ if (s && (i.to < r.length - 50 || r.length == e.doc.length || !Rt(i))) {
2159
+ let r = s(i, e);
2160
+ r && r.from <= n && r.from >= t && r.to > n && (a = r);
2161
+ }
2162
+ }
2163
+ return a;
2164
+ }
2165
+ function Rt(e) {
2166
+ let t = e.lastChild;
2167
+ return t && t.to == e.to && t.type.isError;
2168
+ }
2169
+ function zt(e, t, n) {
2170
+ for (let r of e.facet(Pt)) {
2171
+ let i = r(e, t, n);
2172
+ if (i) return i;
2173
+ }
2174
+ return Lt(e, t, n);
2175
+ }
2176
+ function Bt(e, t) {
2177
+ let n = t.mapPos(e.from, 1), r = t.mapPos(e.to, -1);
2178
+ return n >= r ? void 0 : {
2179
+ from: n,
2180
+ to: r
2181
+ };
2182
+ }
2183
+ var Vt = /*@__PURE__*/ o.define({ map: Bt }), Z = /*@__PURE__*/ o.define({ map: Bt });
2184
+ function Ht(e) {
2185
+ let t = [];
2186
+ for (let { head: n } of e.state.selection.ranges) t.some((e) => e.from <= n && e.to >= n) || t.push(e.lineBlockAt(n));
2187
+ return t;
2188
+ }
2189
+ var Q = /*@__PURE__*/ r.define({
2190
+ create() {
2191
+ return _.none;
2192
+ },
2193
+ update(e, t) {
2194
+ t.isUserEvent("delete") && t.changes.iterChangedRanges((t, n) => e = Ut(e, t, n)), e = e.map(t.changes);
2195
+ let n = [];
2196
+ for (let r of t.effects) r.is(Vt) && !Gt(e, r.value.from, r.value.to) ? n.push(r.value) : r.is(Z) && (e = e.update({
2197
+ filter: (e, t) => r.value.from != e || r.value.to != t,
2198
+ filterFrom: r.value.from,
2199
+ filterTo: r.value.to
2200
+ }));
2201
+ if (n.length) {
2202
+ let { preparePlaceholder: r } = t.state.facet(Qt), i = n.map((e) => (r ? _.replace({ widget: new nn(r(t.state, e)) }) : tn).range(e.from, e.to));
2203
+ e = e.update({ add: i });
2204
+ }
2205
+ return t.selection && (e = Ut(e, t.selection.main.head)), e;
2206
+ },
2207
+ provide: (e) => g.decorations.from(e),
2208
+ toJSON(e, t) {
2209
+ let n = [];
2210
+ return e.between(0, t.doc.length, (e, t) => {
2211
+ n.push(e, t);
2212
+ }), n;
2213
+ },
2214
+ fromJSON(e) {
2215
+ if (!Array.isArray(e) || e.length % 2) throw RangeError("Invalid JSON for fold state");
2216
+ let t = [];
2217
+ for (let n = 0; n < e.length;) {
2218
+ let r = e[n++], i = e[n++];
2219
+ if (typeof r != "number" || typeof i != "number") throw RangeError("Invalid JSON for fold state");
2220
+ t.push(tn.range(r, i));
2221
+ }
2222
+ return _.set(t, !0);
2223
+ }
2224
+ });
2225
+ function Ut(e, t, n = t) {
2226
+ let r = !1;
2227
+ return e.between(t, n, (e, i) => {
2228
+ e < n && i > t && (r = !0);
2229
+ }), r ? e.update({
2230
+ filterFrom: t,
2231
+ filterTo: n,
2232
+ filter: (e, r) => e >= n || r <= t
2233
+ }) : e;
2234
+ }
2235
+ function Wt(e, t, n) {
2236
+ var r;
2237
+ let i = null;
2238
+ return (r = e.field(Q, !1)) == null || r.between(t, n, (e, t) => {
2239
+ (!i || i.from > e) && (i = {
2240
+ from: e,
2241
+ to: t
2242
+ });
2243
+ }), i;
2244
+ }
2245
+ function Gt(e, t, n) {
2246
+ let r = !1;
2247
+ return e.between(t, t, (e, i) => {
2248
+ e == t && i == n && (r = !0);
2249
+ }), r;
2250
+ }
2251
+ function Kt(e, t) {
2252
+ return e.field(Q, !1) ? t : t.concat(o.appendConfig.of($t()));
2253
+ }
2254
+ var qt = (e) => {
2255
+ for (let t of Ht(e)) {
2256
+ let n = zt(e.state, t.from, t.to);
2257
+ if (n) return e.dispatch({ effects: Kt(e.state, [Vt.of(n), Yt(e, n)]) }), !0;
2258
+ }
2259
+ return !1;
2260
+ }, Jt = (e) => {
2261
+ if (!e.state.field(Q, !1)) return !1;
2262
+ let t = [];
2263
+ for (let n of Ht(e)) {
2264
+ let r = Wt(e.state, n.from, n.to);
2265
+ r && t.push(Z.of(r), Yt(e, r, !1));
2266
+ }
2267
+ return t.length && e.dispatch({ effects: t }), t.length > 0;
2268
+ };
2269
+ function Yt(e, t, n = !0) {
2270
+ let r = e.state.doc.lineAt(t.from).number, i = e.state.doc.lineAt(t.to).number;
2271
+ return g.announce.of(`${e.state.phrase(n ? "Folded lines" : "Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`);
2272
+ }
2273
+ var Xt = [
2274
+ {
2275
+ key: "Ctrl-Shift-[",
2276
+ mac: "Cmd-Alt-[",
2277
+ run: qt
2278
+ },
2279
+ {
2280
+ key: "Ctrl-Shift-]",
2281
+ mac: "Cmd-Alt-]",
2282
+ run: Jt
2283
+ },
2284
+ {
2285
+ key: "Ctrl-Alt-[",
2286
+ run: (e) => {
2287
+ let { state: t } = e, n = [];
2288
+ for (let r = 0; r < t.doc.length;) {
2289
+ let i = e.lineBlockAt(r), a = zt(t, i.from, i.to);
2290
+ a && n.push(Vt.of(a)), r = (a ? e.lineBlockAt(a.to) : i).to + 1;
2291
+ }
2292
+ return n.length && e.dispatch({ effects: Kt(e.state, n) }), !!n.length;
2293
+ }
2294
+ },
2295
+ {
2296
+ key: "Ctrl-Alt-]",
2297
+ run: (e) => {
2298
+ let t = e.state.field(Q, !1);
2299
+ if (!t || !t.size) return !1;
2300
+ let n = [];
2301
+ return t.between(0, e.state.doc.length, (e, t) => {
2302
+ n.push(Z.of({
2303
+ from: e,
2304
+ to: t
2305
+ }));
2306
+ }), e.dispatch({ effects: n }), !0;
2307
+ }
2308
+ }
2309
+ ], Zt = {
2310
+ placeholderDOM: null,
2311
+ preparePlaceholder: null,
2312
+ placeholderText: "…"
2313
+ }, Qt = /*@__PURE__*/ a.define({ combine(e) {
2314
+ return t(e, Zt);
2315
+ } });
2316
+ function $t(e) {
2317
+ let t = [Q, sn];
2318
+ return e && t.push(Qt.of(e)), t;
2319
+ }
2320
+ function en(e, t) {
2321
+ let { state: n } = e, r = n.facet(Qt), i = (t) => {
2322
+ let n = e.lineBlockAt(e.posAtDOM(t.target)), r = Wt(e.state, n.from, n.to);
2323
+ r && e.dispatch({ effects: Z.of(r) }), t.preventDefault();
2324
+ };
2325
+ if (r.placeholderDOM) return r.placeholderDOM(e, i, t);
2326
+ let a = document.createElement("span");
2327
+ return a.textContent = r.placeholderText, a.setAttribute("aria-label", n.phrase("folded code")), a.title = n.phrase("unfold"), a.className = "cm-foldPlaceholder", a.onclick = i, a;
2328
+ }
2329
+ var tn = /*@__PURE__*/ _.replace({ widget: /*@__PURE__*/ new class extends h {
2330
+ toDOM(e) {
2331
+ return en(e, null);
2332
+ }
2333
+ }() }), nn = class extends h {
2334
+ constructor(e) {
2335
+ super(), this.value = e;
2336
+ }
2337
+ eq(e) {
2338
+ return this.value == e.value;
2339
+ }
2340
+ toDOM(e) {
2341
+ return en(e, this.value);
2342
+ }
2343
+ }, rn = {
2344
+ openText: "⌄",
2345
+ closedText: "›",
2346
+ markerDOM: null,
2347
+ domEventHandlers: {},
2348
+ foldingChanged: () => !1
2349
+ }, an = class extends f {
2350
+ constructor(e, t) {
2351
+ super(), this.config = e, this.open = t;
2352
+ }
2353
+ eq(e) {
2354
+ return this.config == e.config && this.open == e.open;
2355
+ }
2356
+ toDOM(e) {
2357
+ if (this.config.markerDOM) return this.config.markerDOM(this.open);
2358
+ let t = document.createElement("span");
2359
+ return t.textContent = this.open ? this.config.openText : this.config.closedText, t.title = e.state.phrase(this.open ? "Fold line" : "Unfold line"), t;
2360
+ }
2361
+ };
2362
+ function on(e = {}) {
2363
+ let t = {
2364
+ ...rn,
2365
+ ...e
2366
+ }, n = new an(t, !0), r = new an(t, !1), a = l.fromClass(class {
2367
+ constructor(e) {
2368
+ this.from = e.viewport.from, this.markers = this.buildMarkers(e);
2369
+ }
2370
+ update(e) {
2371
+ (e.docChanged || e.viewportChanged || e.startState.facet(Y) != e.state.facet(Y) || e.startState.field(Q, !1) != e.state.field(Q, !1) || q(e.startState) != q(e.state) || t.foldingChanged(e)) && (this.markers = this.buildMarkers(e.view));
2372
+ }
2373
+ buildMarkers(e) {
2374
+ let t = new i();
2375
+ for (let i of e.viewportLineBlocks) {
2376
+ let a = Wt(e.state, i.from, i.to) ? r : zt(e.state, i.from, i.to) ? n : null;
2377
+ a && t.add(i.from, i.from, a);
2378
+ }
2379
+ return t.finish();
2380
+ }
2381
+ }), { domEventHandlers: o } = t;
2382
+ return [
2383
+ a,
2384
+ d({
2385
+ class: "cm-foldGutter",
2386
+ markers(e) {
2387
+ return e.plugin(a)?.markers || p.empty;
2388
+ },
2389
+ initialSpacer() {
2390
+ return new an(t, !1);
2391
+ },
2392
+ domEventHandlers: {
2393
+ ...o,
2394
+ click: (e, t, n) => {
2395
+ if (o.click && o.click(e, t, n)) return !0;
2396
+ let r = Wt(e.state, t.from, t.to);
2397
+ if (r) return e.dispatch({ effects: Z.of(r) }), !0;
2398
+ let i = zt(e.state, t.from, t.to);
2399
+ return i ? (e.dispatch({ effects: Vt.of(i) }), !0) : !1;
2400
+ }
2401
+ }
2402
+ }),
2403
+ $t()
2404
+ ];
2405
+ }
2406
+ var sn = /*@__PURE__*/ g.baseTheme({
2407
+ ".cm-foldPlaceholder": {
2408
+ backgroundColor: "#eee",
2409
+ border: "1px solid #ddd",
2410
+ color: "#888",
2411
+ borderRadius: ".2em",
2412
+ margin: "0 1px",
2413
+ padding: "0 1px",
2414
+ cursor: "pointer"
2415
+ },
2416
+ ".cm-foldGutter span": {
2417
+ padding: "0 1px",
2418
+ cursor: "pointer"
2419
+ }
2420
+ }), cn = class e {
2421
+ constructor(e, t) {
2422
+ this.specs = e;
2423
+ let n;
2424
+ function r(e) {
2425
+ let t = u.newName();
2426
+ return (n ||= Object.create(null))["." + t] = e, t;
2427
+ }
2428
+ let i = typeof t.all == "string" ? t.all : t.all ? r(t.all) : void 0, a = t.scope;
2429
+ this.scope = a instanceof K ? (e) => e.prop(G) == a.data : a ? (e) => e == a : void 0, this.style = Be(e.map((e) => ({
2430
+ tag: e.tag,
2431
+ class: e.class || r(Object.assign({}, e, { tag: null }))
2432
+ })), { all: i }).style, this.module = n ? new u(n) : null, this.themeType = t.themeType;
2433
+ }
2434
+ static define(t, n) {
2435
+ return new e(t, n || {});
2436
+ }
2437
+ }, ln = /*@__PURE__*/ a.define(), un = /*@__PURE__*/ a.define({ combine(e) {
2438
+ return e.length ? [e[0]] : null;
2439
+ } });
2440
+ function dn(e) {
2441
+ let t = e.facet(ln);
2442
+ return t.length ? t : e.facet(un);
2443
+ }
2444
+ function fn(e, t) {
2445
+ let n = [mn], r;
2446
+ return e instanceof cn && (e.module && n.push(g.styleModule.of(e.module)), r = e.themeType), t?.fallback ? n.push(un.of(e)) : r ? n.push(ln.computeN([g.darkTheme], (t) => t.facet(g.darkTheme) == (r == "dark") ? [e] : [])) : n.push(ln.of(e)), n;
2447
+ }
2448
+ var pn = class {
2449
+ constructor(e) {
2450
+ this.markCache = Object.create(null), this.tree = q(e.state), this.decorations = this.buildDeco(e, dn(e.state)), this.decoratedTo = e.viewport.to;
2451
+ }
2452
+ update(e) {
2453
+ let t = q(e.state), n = dn(e.state), r = n != dn(e.startState), { viewport: i } = e.view, a = e.changes.mapPos(this.decoratedTo, 1);
2454
+ t.length < i.to && !r && t.type == this.tree.type && a >= i.to ? (this.decorations = this.decorations.map(e.changes), this.decoratedTo = a) : (t != this.tree || e.viewportChanged || r) && (this.tree = t, this.decorations = this.buildDeco(e.view, n), this.decoratedTo = i.to);
2455
+ }
2456
+ buildDeco(e, t) {
2457
+ if (!t || !this.tree.length) return _.none;
2458
+ let n = new i();
2459
+ for (let { from: r, to: i } of e.visibleRanges) He(this.tree, t, (e, t, r) => {
2460
+ n.add(e, t, this.markCache[r] || (this.markCache[r] = _.mark({ class: r })));
2461
+ }, r, i);
2462
+ return n.finish();
2463
+ }
2464
+ }, mn = /*@__PURE__*/ e.high(/*@__PURE__*/ l.fromClass(pn, { decorations: (e) => e.decorations }));
2465
+ W.meta, W.link, W.heading, W.emphasis, W.strong, W.strikethrough, W.keyword, W.atom, W.bool, W.url, W.contentSeparator, W.labelName, W.literal, W.inserted, W.string, W.deleted, W.regexp, W.escape, W.string, W.variableName, W.variableName, W.typeName, W.namespace, W.className, W.variableName, W.macroName, W.propertyName, W.comment, W.invalid;
2466
+ var hn = /*@__PURE__*/ g.baseTheme({
2467
+ "&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" },
2468
+ "&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" }
2469
+ }), gn = 1e4, _n = "()[]{}", vn = /*@__PURE__*/ a.define({ combine(e) {
2470
+ return t(e, {
2471
+ afterCursor: !0,
2472
+ brackets: _n,
2473
+ maxScanDistance: gn,
2474
+ renderMatch: xn
2475
+ });
2476
+ } }), yn = /*@__PURE__*/ _.mark({ class: "cm-matchingBracket" }), bn = /*@__PURE__*/ _.mark({ class: "cm-nonmatchingBracket" });
2477
+ function xn(e) {
2478
+ let t = [], n = e.matched ? yn : bn;
2479
+ return t.push(n.range(e.start.from, e.start.to)), e.end && t.push(n.range(e.end.from, e.end.to)), t;
2480
+ }
2481
+ function Sn(e) {
2482
+ let t = [], n = e.facet(vn);
2483
+ for (let r of e.selection.ranges) {
2484
+ if (!r.empty) continue;
2485
+ let i = On(e, r.head, -1, n) || r.head > 0 && On(e, r.head - 1, 1, n) || n.afterCursor && (On(e, r.head, 1, n) || r.head < e.doc.length && On(e, r.head + 1, -1, n));
2486
+ i && (t = t.concat(n.renderMatch(i, e)));
2487
+ }
2488
+ return _.set(t, !0);
2489
+ }
2490
+ var Cn = [/* @__PURE__ */ l.fromClass(class {
2491
+ constructor(e) {
2492
+ this.paused = !1, this.decorations = Sn(e.state);
2493
+ }
2494
+ update(e) {
2495
+ (e.docChanged || e.selectionSet || this.paused) && (e.view.composing ? (this.decorations = this.decorations.map(e.changes), this.paused = !0) : (this.decorations = Sn(e.state), this.paused = !1));
2496
+ }
2497
+ }, { decorations: (e) => e.decorations }), hn];
2498
+ function wn(e = {}) {
2499
+ return [vn.of(e), Cn];
2500
+ }
2501
+ var Tn = /*@__PURE__*/ new b();
2502
+ function En(e, t, n) {
2503
+ let r = e.prop(t < 0 ? b.openedBy : b.closedBy);
2504
+ if (r) return r;
2505
+ if (e.name.length == 1) {
2506
+ let r = n.indexOf(e.name);
2507
+ if (r > -1 && r % 2 == +(t < 0)) return [n[r + t]];
2508
+ }
2509
+ return null;
2510
+ }
2511
+ function Dn(e) {
2512
+ let t = e.type.prop(Tn);
2513
+ return t ? t(e.node) : e;
2514
+ }
2515
+ function On(e, t, n, r = {}) {
2516
+ let i = r.maxScanDistance || gn, a = r.brackets || _n, o = q(e), s = o.resolveInner(t, n);
2517
+ for (let r = s; r; r = r.parent) {
2518
+ let i = En(r.type, n, a);
2519
+ if (i && r.from < r.to) {
2520
+ let o = Dn(r);
2521
+ if (o && (n > 0 ? t >= o.from && t < o.to : t > o.from && t <= o.to)) return kn(e, t, n, r, o, i, a);
2522
+ }
2523
+ }
2524
+ return An(e, t, n, o, s.type, i, a);
2525
+ }
2526
+ function kn(e, t, n, r, i, a, o) {
2527
+ let s = r.parent, c = {
2528
+ from: i.from,
2529
+ to: i.to
2530
+ }, l = 0, u = s?.cursor();
2531
+ if (u && (n < 0 ? u.childBefore(r.from) : u.childAfter(r.to))) do
2532
+ if (n < 0 ? u.to <= r.from : u.from >= r.to) {
2533
+ if (l == 0 && a.indexOf(u.type.name) > -1 && u.from < u.to) {
2534
+ let e = Dn(u);
2535
+ return {
2536
+ start: c,
2537
+ end: e ? {
2538
+ from: e.from,
2539
+ to: e.to
2540
+ } : void 0,
2541
+ matched: !0
2542
+ };
2543
+ }
2544
+ if (En(u.type, n, o)) l++;
2545
+ else if (En(u.type, -n, o)) {
2546
+ if (l == 0) {
2547
+ let e = Dn(u);
2548
+ return {
2549
+ start: c,
2550
+ end: e && e.from < e.to ? {
2551
+ from: e.from,
2552
+ to: e.to
2553
+ } : void 0,
2554
+ matched: !1
2555
+ };
2556
+ }
2557
+ l--;
2558
+ }
2559
+ }
2560
+ while (n < 0 ? u.prevSibling() : u.nextSibling());
2561
+ return {
2562
+ start: c,
2563
+ matched: !1
2564
+ };
2565
+ }
2566
+ function An(e, t, n, r, i, a, o) {
2567
+ if (n < 0 ? !t : t == e.doc.length) return null;
2568
+ let s = n < 0 ? e.sliceDoc(t - 1, t) : e.sliceDoc(t, t + 1), c = o.indexOf(s);
2569
+ if (c < 0 || c % 2 == 0 != n > 0) return null;
2570
+ let l = {
2571
+ from: n < 0 ? t - 1 : t,
2572
+ to: n > 0 ? t + 1 : t
2573
+ }, u = e.doc.iterRange(t, n > 0 ? e.doc.length : 0), d = 0;
2574
+ for (let e = 0; !u.next().done && e <= a;) {
2575
+ let a = u.value;
2576
+ n < 0 && (e += a.length);
2577
+ let s = t + e * n;
2578
+ for (let e = n > 0 ? 0 : a.length - 1, t = n > 0 ? a.length : -1; e != t; e += n) {
2579
+ let t = o.indexOf(a[e]);
2580
+ if (!(t < 0 || r.resolveInner(s + e, 1).type != i)) {
2581
+ if (t % 2 == 0 == n > 0) d++;
2582
+ else if (d == 1) return {
2583
+ start: l,
2584
+ end: {
2585
+ from: s + e,
2586
+ to: s + e + 1
2587
+ },
2588
+ matched: t >> 1 == c >> 1
2589
+ };
2590
+ else d--;
2591
+ }
2592
+ }
2593
+ n > 0 && (e += a.length);
2594
+ }
2595
+ return u.done ? {
2596
+ start: l,
2597
+ matched: !1
2598
+ } : null;
2599
+ }
2600
+ function jn(e) {
2601
+ return {
2602
+ name: e.name || "",
2603
+ token: e.token,
2604
+ blankLine: e.blankLine || (() => {}),
2605
+ startState: e.startState || (() => !0),
2606
+ copyState: e.copyState || Mn,
2607
+ indent: e.indent || (() => null),
2608
+ languageData: e.languageData || {},
2609
+ tokenTable: e.tokenTable || Bn,
2610
+ mergeTokens: e.mergeTokens !== !1
2611
+ };
2612
+ }
2613
+ function Mn(e) {
2614
+ if (typeof e != "object") return e;
2615
+ let t = {};
2616
+ for (let n in e) {
2617
+ let r = e[n];
2618
+ t[n] = r instanceof Array ? r.slice() : r;
2619
+ }
2620
+ return t;
2621
+ }
2622
+ var Nn = /*@__PURE__*/ new WeakMap(), Pn = class e extends K {
2623
+ constructor(e) {
2624
+ let t = tt(e.languageData), n = jn(e), r, i = new class extends _e {
2625
+ createParse(e, t, n) {
2626
+ return new Rn(r, e, t, n);
2627
+ }
2628
+ }();
2629
+ super(t, i, [], e.name), this.topNode = Yn(t, this), r = this, this.streamParser = n, this.stateAfter = new b({ perNode: !0 }), this.tokenTable = e.tokenTable ? new Gn(n.tokenTable) : Kn;
2630
+ }
2631
+ static define(t) {
2632
+ return new e(t);
2633
+ }
2634
+ getIndent(e) {
2635
+ let t, { overrideIndentation: n } = e.options;
2636
+ n && (t = Nn.get(e.state), t != null && t < e.pos - 1e4 && (t = void 0));
2637
+ let r = Fn(this, e.node.tree, e.node.from, e.node.from, t ?? e.pos), i, a;
2638
+ if (r ? (a = r.state, i = r.pos + 1) : (a = this.streamParser.startState(e.unit), i = e.node.from), e.pos - i > 1e4) return null;
2639
+ for (; i < e.pos;) {
2640
+ let t = e.state.doc.lineAt(i), r = Math.min(e.pos, t.to);
2641
+ if (t.length) {
2642
+ let i = n ? n(t.from) : -1, o = new et(t.text, e.state.tabSize, e.unit, i < 0 ? void 0 : i);
2643
+ for (; o.pos < r - t.from;) zn(this.streamParser.token, o, a);
2644
+ } else this.streamParser.blankLine(a, e.unit);
2645
+ if (r == e.pos) break;
2646
+ i = t.to + 1;
2647
+ }
2648
+ let o = e.lineAt(e.pos);
2649
+ return n && t == null && Nn.set(e.state, o.from), this.streamParser.indent(a, /^\s*(.*)/.exec(o.text)[1], e);
2650
+ }
2651
+ get allowsNesting() {
2652
+ return !1;
2653
+ }
2654
+ };
2655
+ function Fn(e, t, n, r, i) {
2656
+ let a = n >= r && n + t.length <= i && t.prop(e.stateAfter);
2657
+ if (a) return {
2658
+ state: e.streamParser.copyState(a),
2659
+ pos: n + t.length
2660
+ };
2661
+ for (let a = t.children.length - 1; a >= 0; a--) {
2662
+ let o = t.children[a], s = n + t.positions[a], c = o instanceof O && s < i && Fn(e, o, s, r, i);
2663
+ if (c) return c;
2664
+ }
2665
+ return null;
2666
+ }
2667
+ function In(e, t, n, r, i) {
2668
+ if (i && n <= 0 && r >= t.length) return t;
2669
+ !i && n == 0 && t.type == e.topNode && (i = !0);
2670
+ for (let a = t.children.length - 1; a >= 0; a--) {
2671
+ let o = t.positions[a], s = t.children[a], c;
2672
+ if (o < r && s instanceof O) {
2673
+ if (!(c = In(e, s, n - o, r - o, i))) break;
2674
+ return i ? new O(t.type, t.children.slice(0, a).concat(c), t.positions.slice(0, a + 1), o + c.length) : c;
2675
+ }
2676
+ }
2677
+ return null;
2678
+ }
2679
+ function Ln(e, t, n, r, i) {
2680
+ for (let i of t) {
2681
+ let t = i.from + (i.openStart ? 25 : 0), a = i.to - (i.openEnd ? 25 : 0), o = t <= n && a > n && Fn(e, i.tree, 0 - i.offset, n, a), s;
2682
+ if (o && o.pos <= r && (s = In(e, i.tree, n + i.offset, o.pos + i.offset, !1))) return {
2683
+ state: o.state,
2684
+ tree: s
2685
+ };
2686
+ }
2687
+ return {
2688
+ state: e.streamParser.startState(i ? X(i) : 4),
2689
+ tree: O.empty
2690
+ };
2691
+ }
2692
+ var Rn = class {
2693
+ constructor(e, t, n, r) {
2694
+ this.lang = e, this.input = t, this.fragments = n, this.ranges = r, this.stoppedAt = null, this.chunks = [], this.chunkPos = [], this.chunk = [], this.chunkReused = void 0, this.rangeIndex = 0, this.to = r[r.length - 1].to;
2695
+ let i = ot.get(), a = r[0].from, { state: o, tree: s } = Ln(e, n, a, this.to, i?.state);
2696
+ this.state = o, this.parsedPos = this.chunkStart = a + s.length;
2697
+ for (let e = 0; e < s.children.length; e++) this.chunks.push(s.children[e]), this.chunkPos.push(s.positions[e]);
2698
+ i && this.parsedPos < i.viewport.from - 1e5 && r.some((e) => e.from <= i.viewport.from && e.to >= i.viewport.from) && (this.state = this.lang.streamParser.startState(X(i.state)), i.skipUntilInView(this.parsedPos, i.viewport.from), this.parsedPos = i.viewport.from), this.moveRangeIndex();
2699
+ }
2700
+ advance() {
2701
+ let e = ot.get(), t = this.stoppedAt == null ? this.to : Math.min(this.to, this.stoppedAt), n = Math.min(t, this.chunkStart + 512);
2702
+ for (e && (n = Math.min(n, e.viewport.to)); this.parsedPos < n;) this.parseLine(e);
2703
+ return this.chunkStart < this.parsedPos && this.finishChunk(), this.parsedPos >= t ? this.finish() : e && this.parsedPos >= e.viewport.to ? (e.skipUntilInView(this.parsedPos, t), this.finish()) : null;
2704
+ }
2705
+ stopAt(e) {
2706
+ this.stoppedAt = e;
2707
+ }
2708
+ lineAfter(e) {
2709
+ let t = this.input.chunk(e);
2710
+ if (this.input.lineChunks) t == "\n" && (t = "");
2711
+ else {
2712
+ let e = t.indexOf("\n");
2713
+ e > -1 && (t = t.slice(0, e));
2714
+ }
2715
+ return e + t.length <= this.to ? t : t.slice(0, this.to - e);
2716
+ }
2717
+ nextLine() {
2718
+ let e = this.parsedPos, t = this.lineAfter(e), n = e + t.length;
2719
+ for (let e = this.rangeIndex;;) {
2720
+ let r = this.ranges[e].to;
2721
+ if (r >= n || (t = t.slice(0, r - (n - t.length)), e++, e == this.ranges.length)) break;
2722
+ let i = this.ranges[e].from, a = this.lineAfter(i);
2723
+ t += a, n = i + a.length;
2724
+ }
2725
+ return {
2726
+ line: t,
2727
+ end: n
2728
+ };
2729
+ }
2730
+ skipGapsTo(e, t, n) {
2731
+ for (;;) {
2732
+ let r = this.ranges[this.rangeIndex].to, i = e + t;
2733
+ if (n > 0 ? r > i : r >= i) break;
2734
+ let a = this.ranges[++this.rangeIndex].from;
2735
+ t += a - r;
2736
+ }
2737
+ return t;
2738
+ }
2739
+ moveRangeIndex() {
2740
+ for (; this.ranges[this.rangeIndex].to < this.parsedPos;) this.rangeIndex++;
2741
+ }
2742
+ emitToken(e, t, n, r) {
2743
+ let i = 4;
2744
+ if (this.ranges.length > 1) {
2745
+ r = this.skipGapsTo(t, r, 1), t += r;
2746
+ let e = this.chunk.length;
2747
+ r = this.skipGapsTo(n, r, -1), n += r, i += this.chunk.length - e;
2748
+ }
2749
+ let a = this.chunk.length - 4;
2750
+ return this.lang.streamParser.mergeTokens && i == 4 && a >= 0 && this.chunk[a] == e && this.chunk[a + 2] == t ? this.chunk[a + 2] = n : this.chunk.push(e, t, n, i), r;
2751
+ }
2752
+ parseLine(e) {
2753
+ let { line: t, end: n } = this.nextLine(), r = 0, { streamParser: i } = this.lang, a = new et(t, e ? e.state.tabSize : 4, e ? X(e.state) : 2);
2754
+ if (a.eol()) i.blankLine(this.state, a.indentUnit);
2755
+ else for (; !a.eol();) {
2756
+ let e = zn(i.token, a, this.state);
2757
+ if (e && (r = this.emitToken(this.lang.tokenTable.resolve(e), this.parsedPos + a.start, this.parsedPos + a.pos, r)), a.start > 1e4) break;
2758
+ }
2759
+ this.parsedPos = n, this.moveRangeIndex(), this.parsedPos < this.to && this.parsedPos++;
2760
+ }
2761
+ finishChunk() {
2762
+ let e = O.build({
2763
+ buffer: this.chunk,
2764
+ start: this.chunkStart,
2765
+ length: this.parsedPos - this.chunkStart,
2766
+ nodeSet: Vn,
2767
+ topID: 0,
2768
+ maxBufferLength: 512,
2769
+ reused: this.chunkReused
2770
+ });
2771
+ e = new O(e.type, e.children, e.positions, e.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]), this.chunks.push(e), this.chunkPos.push(this.chunkStart - this.ranges[0].from), this.chunk = [], this.chunkReused = void 0, this.chunkStart = this.parsedPos;
2772
+ }
2773
+ finish() {
2774
+ return new O(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance();
2775
+ }
2776
+ };
2777
+ function zn(e, t, n) {
2778
+ t.start = t.pos;
2779
+ for (let r = 0; r < 10; r++) {
2780
+ let r = e(t, n);
2781
+ if (t.pos > t.start) return r;
2782
+ }
2783
+ throw Error("Stream parser failed to advance stream.");
2784
+ }
2785
+ var Bn = /*@__PURE__*/ Object.create(null), $ = [C.none], Vn = /*@__PURE__*/ new w($), Hn = [], Un = /*@__PURE__*/ Object.create(null), Wn = /*@__PURE__*/ Object.create(null);
2786
+ for (let [e, t] of [
2787
+ ["variable", "variableName"],
2788
+ ["variable-2", "variableName.special"],
2789
+ ["string-2", "string.special"],
2790
+ ["def", "variableName.definition"],
2791
+ ["tag", "tagName"],
2792
+ ["attribute", "attributeName"],
2793
+ ["type", "typeName"],
2794
+ ["builtin", "variableName.standard"],
2795
+ ["qualifier", "modifier"],
2796
+ ["error", "invalid"],
2797
+ ["header", "heading"],
2798
+ ["property", "propertyName"]
2799
+ ]) Wn[e] = /*@__PURE__*/ Jn(Bn, t);
2800
+ var Gn = class {
2801
+ constructor(e) {
2802
+ this.extra = e, this.table = Object.assign(Object.create(null), Wn);
2803
+ }
2804
+ resolve(e) {
2805
+ return e ? this.table[e] || (this.table[e] = Jn(this.extra, e)) : 0;
2806
+ }
2807
+ }, Kn = /*@__PURE__*/ new Gn(Bn);
2808
+ function qn(e, t) {
2809
+ Hn.indexOf(e) > -1 || (Hn.push(e), console.warn(t));
2810
+ }
2811
+ function Jn(e, t) {
2812
+ let n = [];
2813
+ for (let r of t.split(" ")) {
2814
+ let t = [];
2815
+ for (let n of r.split(".")) {
2816
+ let r = e[n] || W[n];
2817
+ r ? typeof r == "function" ? t.length ? t = t.map(r) : qn(n, `Modifier ${n} used at start of tag`) : t.length ? qn(n, `Tag ${n} used as modifier`) : t = Array.isArray(r) ? r : [r] : qn(n, `Unknown highlighting tag ${n}`);
2818
+ }
2819
+ for (let e of t) n.push(e);
2820
+ }
2821
+ if (!n.length) return 0;
2822
+ let r = t.replace(/ /g, "_"), i = r + " " + n.map((e) => e.id), a = Un[i];
2823
+ if (a) return a.id;
2824
+ let o = Un[i] = C.define({
2825
+ id: $.length,
2826
+ name: r,
2827
+ props: [Re({ [r]: n })]
2828
+ });
2829
+ return $.push(o), o.id;
2830
+ }
2831
+ function Yn(e, t) {
2832
+ let n = C.define({
2833
+ id: $.length,
2834
+ name: "Document",
2835
+ props: [G.add(() => e), yt.add(() => (e) => t.getIndent(e))],
2836
+ top: !0
2837
+ });
2838
+ return $.push(n), n;
2839
+ }
2840
+ m.RTL, m.LTR;
2841
+ //#endregion
2842
+ export { P as A, _e as B, gt as C, nt as D, On as E, D as F, ye as H, b as I, w as L, Re as M, W as N, fn as O, ee as P, C as R, Nt as S, G as T, O as V, Ft as _, ft as a, _t as b, wn as c, tt as d, Ot as f, Xt as g, It as h, pt as i, Qe as j, q as k, Tn as l, on as m, it as n, ot as o, At as p, K as r, Pn as s, vt as t, jt as u, Pt as v, ht as w, yt as x, X as y, ge as z };