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