@burdenoff/microfe-technospam 2026.1102.1 → 2026.1102.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/generated/wspace-types.d.ts +7468 -141
  2. package/dist/generated/wspace-types.d.ts.map +1 -1
  3. package/dist/node_modules/@codemirror/autocomplete/dist/index.js +527 -0
  4. package/dist/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -0
  5. package/dist/node_modules/@codemirror/commands/dist/index.js +1108 -0
  6. package/dist/node_modules/@codemirror/commands/dist/index.js.map +1 -0
  7. package/dist/node_modules/@codemirror/lang-go/dist/index.js +206 -0
  8. package/dist/node_modules/@codemirror/lang-go/dist/index.js.map +1 -0
  9. package/dist/node_modules/@codemirror/lang-javascript/dist/index.js +321 -0
  10. package/dist/node_modules/@codemirror/lang-javascript/dist/index.js.map +1 -0
  11. package/dist/node_modules/@codemirror/lang-python/dist/index.js +265 -0
  12. package/dist/node_modules/@codemirror/lang-python/dist/index.js.map +1 -0
  13. package/dist/node_modules/@codemirror/language/dist/index.js +957 -0
  14. package/dist/node_modules/@codemirror/language/dist/index.js.map +1 -0
  15. package/dist/node_modules/@codemirror/legacy-modes/mode/ruby.js +164 -0
  16. package/dist/node_modules/@codemirror/legacy-modes/mode/ruby.js.map +1 -0
  17. package/dist/node_modules/@codemirror/legacy-modes/mode/shell.js +109 -0
  18. package/dist/node_modules/@codemirror/legacy-modes/mode/shell.js.map +1 -0
  19. package/dist/node_modules/@codemirror/state/dist/index.js +1739 -0
  20. package/dist/node_modules/@codemirror/state/dist/index.js.map +1 -0
  21. package/dist/node_modules/@codemirror/streamparser/dist/index.js +70 -0
  22. package/dist/node_modules/@codemirror/streamparser/dist/index.js.map +1 -0
  23. package/dist/node_modules/@codemirror/view/dist/index.js +5427 -0
  24. package/dist/node_modules/@codemirror/view/dist/index.js.map +1 -0
  25. package/dist/node_modules/@lezer/common/dist/index.js +896 -0
  26. package/dist/node_modules/@lezer/common/dist/index.js.map +1 -0
  27. package/dist/node_modules/@lezer/go/dist/index.js +215 -0
  28. package/dist/node_modules/@lezer/go/dist/index.js.map +1 -0
  29. package/dist/node_modules/@lezer/highlight/dist/index.js +395 -0
  30. package/dist/node_modules/@lezer/highlight/dist/index.js.map +1 -0
  31. package/dist/node_modules/@lezer/javascript/dist/index.js +437 -0
  32. package/dist/node_modules/@lezer/javascript/dist/index.js.map +1 -0
  33. package/dist/node_modules/@lezer/lr/dist/index.js +842 -0
  34. package/dist/node_modules/@lezer/lr/dist/index.js.map +1 -0
  35. package/dist/node_modules/@lezer/python/dist/index.js +352 -0
  36. package/dist/node_modules/@lezer/python/dist/index.js.map +1 -0
  37. package/dist/node_modules/@marijn/find-cluster-break/src/index.js +66 -0
  38. package/dist/node_modules/@marijn/find-cluster-break/src/index.js.map +1 -0
  39. package/dist/node_modules/style-mod/src/style-mod.js +74 -0
  40. package/dist/node_modules/style-mod/src/style-mod.js.map +1 -0
  41. package/dist/node_modules/w3c-keyname/index.js +90 -0
  42. package/dist/node_modules/w3c-keyname/index.js.map +1 -0
  43. package/dist/stories/fixtures/technospamFixtures.d.ts.map +1 -1
  44. package/dist/stories/journeys/Problems.stories.d.ts.map +1 -1
  45. package/dist/technospam/api/technospamApi.d.ts +39 -0
  46. package/dist/technospam/api/technospamApi.d.ts.map +1 -1
  47. package/dist/technospam/api/technospamApi.js +120 -86
  48. package/dist/technospam/api/technospamApi.js.map +1 -1
  49. package/dist/technospam/components/SubmissionViews.d.ts +6 -2
  50. package/dist/technospam/components/SubmissionViews.d.ts.map +1 -1
  51. package/dist/technospam/components/SubmissionViews.js +6 -5
  52. package/dist/technospam/components/SubmissionViews.js.map +1 -1
  53. package/dist/technospam/components/TechnoSpamErrorBoundary.d.ts +6 -0
  54. package/dist/technospam/components/TechnoSpamErrorBoundary.d.ts.map +1 -1
  55. package/dist/technospam/components/TechnoSpamErrorBoundary.js +2 -2
  56. package/dist/technospam/components/TechnoSpamErrorBoundary.js.map +1 -1
  57. package/dist/technospam/components/editor/CodeEditor.d.ts +26 -0
  58. package/dist/technospam/components/editor/CodeEditor.d.ts.map +1 -0
  59. package/dist/technospam/components/editor/CodeEditor.js +102 -0
  60. package/dist/technospam/components/editor/CodeEditor.js.map +1 -0
  61. package/dist/technospam/components/editor/RunOutputPanel.d.ts +14 -0
  62. package/dist/technospam/components/editor/RunOutputPanel.d.ts.map +1 -0
  63. package/dist/technospam/components/editor/RunOutputPanel.js +127 -0
  64. package/dist/technospam/components/editor/RunOutputPanel.js.map +1 -0
  65. package/dist/technospam/components/editor/editorLanguages.d.ts +11 -0
  66. package/dist/technospam/components/editor/editorLanguages.d.ts.map +1 -0
  67. package/dist/technospam/components/editor/editorLanguages.js +30 -0
  68. package/dist/technospam/components/editor/editorLanguages.js.map +1 -0
  69. package/dist/technospam/components/editor/editorTheme.d.ts +11 -0
  70. package/dist/technospam/components/editor/editorTheme.d.ts.map +1 -0
  71. package/dist/technospam/components/editor/editorTheme.js +120 -0
  72. package/dist/technospam/components/editor/editorTheme.js.map +1 -0
  73. package/dist/technospam/hooks/useSolutionRunner.d.ts +35 -0
  74. package/dist/technospam/hooks/useSolutionRunner.d.ts.map +1 -0
  75. package/dist/technospam/hooks/useSolutionRunner.js +66 -0
  76. package/dist/technospam/hooks/useSolutionRunner.js.map +1 -0
  77. package/dist/technospam/hooks/useTechnoSpamAnalytics.d.ts +1 -1
  78. package/dist/technospam/hooks/useTechnoSpamAnalytics.d.ts.map +1 -1
  79. package/dist/technospam/hooks/useTechnoSpamAnalytics.js.map +1 -1
  80. package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.d.ts.map +1 -1
  81. package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.js +416 -263
  82. package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.js.map +1 -1
  83. package/package.json +14 -4
@@ -0,0 +1,1739 @@
1
+ import { findClusterBreak as e } from "../../../@marijn/find-cluster-break/src/index.js";
2
+ //#region node_modules/@codemirror/state/dist/index.js
3
+ var t = class e {
4
+ lineAt(e) {
5
+ if (e < 0 || e > this.length) throw RangeError(`Invalid position ${e} in document of length ${this.length}`);
6
+ return this.lineInner(e, !1, 1, 0);
7
+ }
8
+ line(e) {
9
+ if (e < 1 || e > this.lines) throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);
10
+ return this.lineInner(e, !0, 1, 0);
11
+ }
12
+ replace(e, t, n) {
13
+ [e, t] = d(this, e, t);
14
+ let i = [];
15
+ return this.decompose(0, e, i, 2), n.length && n.decompose(0, n.length, i, 3), this.decompose(t, this.length, i, 1), r.from(i, this.length - (t - e) + n.length);
16
+ }
17
+ append(e) {
18
+ return this.replace(this.length, this.length, e);
19
+ }
20
+ slice(e, t = this.length) {
21
+ [e, t] = d(this, e, t);
22
+ let n = [];
23
+ return this.decompose(e, t, n, 0), r.from(n, t - e);
24
+ }
25
+ eq(e) {
26
+ if (e == this) return !0;
27
+ if (e.length != this.length || e.lines != this.lines) return !1;
28
+ let t = this.scanIdentical(e, 1), n = this.length - this.scanIdentical(e, -1), r = new s(this), i = new s(e);
29
+ for (let e = t, a = t;;) {
30
+ if (r.next(e), i.next(e), e = 0, r.lineBreak != i.lineBreak || r.done != i.done || r.value != i.value) return !1;
31
+ if (a += r.value.length, r.done || a >= n) return !0;
32
+ }
33
+ }
34
+ iter(e = 1) {
35
+ return new s(this, e);
36
+ }
37
+ iterRange(e, t = this.length) {
38
+ return new c(this, e, t);
39
+ }
40
+ iterLines(e, t) {
41
+ let n;
42
+ if (e == null) n = this.iter();
43
+ else {
44
+ t ??= this.lines + 1;
45
+ let r = this.line(e).from;
46
+ n = this.iterRange(r, Math.max(r, t == this.lines + 1 ? this.length : t <= 1 ? 0 : this.line(t - 1).to));
47
+ }
48
+ return new l(n);
49
+ }
50
+ toString() {
51
+ return this.sliceString(0);
52
+ }
53
+ toJSON() {
54
+ let e = [];
55
+ return this.flatten(e), e;
56
+ }
57
+ constructor() {}
58
+ static of(t) {
59
+ if (t.length == 0) throw RangeError("A document must have at least one line");
60
+ return t.length == 1 && !t[0] ? e.empty : t.length <= 32 ? new n(t) : r.from(n.split(t, []));
61
+ }
62
+ }, n = class e extends t {
63
+ constructor(e, t = i(e)) {
64
+ super(), this.text = e, this.length = t;
65
+ }
66
+ get lines() {
67
+ return this.text.length;
68
+ }
69
+ get children() {
70
+ return null;
71
+ }
72
+ lineInner(e, t, n, r) {
73
+ for (let i = 0;; i++) {
74
+ let a = this.text[i], o = r + a.length;
75
+ if ((t ? n : o) >= e) return new u(r, o, n, a);
76
+ r = o + 1, n++;
77
+ }
78
+ }
79
+ decompose(t, n, r, i) {
80
+ let s = t <= 0 && n >= this.length ? this : new e(o(this.text, t, n), Math.min(n, this.length) - Math.max(0, t));
81
+ if (i & 1) {
82
+ let t = r.pop(), n = a(s.text, t.text.slice(), 0, s.length);
83
+ if (n.length <= 32) r.push(new e(n, t.length + s.length));
84
+ else {
85
+ let t = n.length >> 1;
86
+ r.push(new e(n.slice(0, t)), new e(n.slice(t)));
87
+ }
88
+ } else r.push(s);
89
+ }
90
+ replace(t, n, i) {
91
+ if (!(i instanceof e)) return super.replace(t, n, i);
92
+ [t, n] = d(this, t, n);
93
+ let s = a(this.text, a(i.text, o(this.text, 0, t)), n), c = this.length + i.length - (n - t);
94
+ return s.length <= 32 ? new e(s, c) : r.from(e.split(s, []), c);
95
+ }
96
+ sliceString(e, t = this.length, n = "\n") {
97
+ [e, t] = d(this, e, t);
98
+ let r = "";
99
+ for (let i = 0, a = 0; i <= t && a < this.text.length; a++) {
100
+ let o = this.text[a], s = i + o.length;
101
+ i > e && a && (r += n), e < s && t > i && (r += o.slice(Math.max(0, e - i), t - i)), i = s + 1;
102
+ }
103
+ return r;
104
+ }
105
+ flatten(e) {
106
+ for (let t of this.text) e.push(t);
107
+ }
108
+ scanIdentical() {
109
+ return 0;
110
+ }
111
+ static split(t, n) {
112
+ let r = [], i = -1;
113
+ for (let a of t) r.push(a), i += a.length + 1, r.length == 32 && (n.push(new e(r, i)), r = [], i = -1);
114
+ return i > -1 && n.push(new e(r, i)), n;
115
+ }
116
+ }, r = class e extends t {
117
+ constructor(e, t) {
118
+ super(), this.children = e, this.length = t, this.lines = 0;
119
+ for (let t of e) this.lines += t.lines;
120
+ }
121
+ lineInner(e, t, n, r) {
122
+ for (let i = 0;; i++) {
123
+ let a = this.children[i], o = r + a.length, s = n + a.lines - 1;
124
+ if ((t ? s : o) >= e) return a.lineInner(e, t, n, r);
125
+ r = o + 1, n = s + 1;
126
+ }
127
+ }
128
+ decompose(e, t, n, r) {
129
+ for (let i = 0, a = 0; a <= t && i < this.children.length; i++) {
130
+ let o = this.children[i], s = a + o.length;
131
+ if (e <= s && t >= a) {
132
+ let i = r & (a <= e | (s >= t ? 2 : 0));
133
+ a >= e && s <= t && !i ? n.push(o) : o.decompose(e - a, t - a, n, i);
134
+ }
135
+ a = s + 1;
136
+ }
137
+ }
138
+ replace(t, n, r) {
139
+ if ([t, n] = d(this, t, n), r.lines < this.lines) for (let i = 0, a = 0; i < this.children.length; i++) {
140
+ let o = this.children[i], s = a + o.length;
141
+ if (t >= a && n <= s) {
142
+ let c = o.replace(t - a, n - a, r), l = this.lines - o.lines + c.lines;
143
+ if (c.lines < l >> 4 && c.lines > l >> 6) {
144
+ let a = this.children.slice();
145
+ return a[i] = c, new e(a, this.length - (n - t) + r.length);
146
+ }
147
+ return super.replace(a, s, c);
148
+ }
149
+ a = s + 1;
150
+ }
151
+ return super.replace(t, n, r);
152
+ }
153
+ sliceString(e, t = this.length, n = "\n") {
154
+ [e, t] = d(this, e, t);
155
+ let r = "";
156
+ for (let i = 0, a = 0; i < this.children.length && a <= t; i++) {
157
+ let o = this.children[i], s = a + o.length;
158
+ a > e && i && (r += n), e < s && t > a && (r += o.sliceString(e - a, t - a, n)), a = s + 1;
159
+ }
160
+ return r;
161
+ }
162
+ flatten(e) {
163
+ for (let t of this.children) t.flatten(e);
164
+ }
165
+ scanIdentical(t, n) {
166
+ if (!(t instanceof e)) return 0;
167
+ let r = 0, [i, a, o, s] = n > 0 ? [
168
+ 0,
169
+ 0,
170
+ this.children.length,
171
+ t.children.length
172
+ ] : [
173
+ this.children.length - 1,
174
+ t.children.length - 1,
175
+ -1,
176
+ -1
177
+ ];
178
+ for (;; i += n, a += n) {
179
+ if (i == o || a == s) return r;
180
+ let e = this.children[i], c = t.children[a];
181
+ if (e != c) return r + e.scanIdentical(c, n);
182
+ r += e.length + 1;
183
+ }
184
+ }
185
+ static from(t, r = t.reduce((e, t) => e + t.length + 1, -1)) {
186
+ let i = 0;
187
+ for (let e of t) i += e.lines;
188
+ if (i < 32) {
189
+ let e = [];
190
+ for (let n of t) n.flatten(e);
191
+ return new n(e, r);
192
+ }
193
+ let a = Math.max(32, i >> 5), o = a << 1, s = a >> 1, c = [], l = 0, u = -1, d = [];
194
+ function f(t) {
195
+ let r;
196
+ if (t.lines > o && t instanceof e) for (let e of t.children) f(e);
197
+ else t.lines > s && (l > s || !l) ? (p(), c.push(t)) : t instanceof n && l && (r = d[d.length - 1]) instanceof n && t.lines + r.lines <= 32 ? (l += t.lines, u += t.length + 1, d[d.length - 1] = new n(r.text.concat(t.text), r.length + 1 + t.length)) : (l + t.lines > a && p(), l += t.lines, u += t.length + 1, d.push(t));
198
+ }
199
+ function p() {
200
+ l != 0 && (c.push(d.length == 1 ? d[0] : e.from(d, u)), u = -1, l = d.length = 0);
201
+ }
202
+ for (let e of t) f(e);
203
+ return p(), c.length == 1 ? c[0] : new e(c, r);
204
+ }
205
+ };
206
+ t.empty = /* @__PURE__ */ new n([""], 0);
207
+ function i(e) {
208
+ let t = -1;
209
+ for (let n of e) t += n.length + 1;
210
+ return t;
211
+ }
212
+ function a(e, t, n = 0, r = 1e9) {
213
+ for (let i = 0, a = 0, o = !0; a < e.length && i <= r; a++) {
214
+ let s = e[a], c = i + s.length;
215
+ c >= n && (c > r && (s = s.slice(0, r - i)), i < n && (s = s.slice(n - i)), o ? (t[t.length - 1] += s, o = !1) : t.push(s)), i = c + 1;
216
+ }
217
+ return t;
218
+ }
219
+ function o(e, t, n) {
220
+ return a(e, [""], t, n);
221
+ }
222
+ var s = class {
223
+ constructor(e, t = 1) {
224
+ this.dir = t, this.done = !1, this.lineBreak = !1, this.value = "", this.nodes = [e], this.offsets = [t > 0 ? 1 : (e instanceof n ? e.text.length : e.children.length) << 1];
225
+ }
226
+ nextInner(e, t) {
227
+ for (this.done = this.lineBreak = !1;;) {
228
+ let r = this.nodes.length - 1, i = this.nodes[r], a = this.offsets[r], o = a >> 1, s = i instanceof n ? i.text.length : i.children.length;
229
+ if (o == (t > 0 ? s : 0)) {
230
+ if (r == 0) return this.done = !0, this.value = "", this;
231
+ t > 0 && this.offsets[r - 1]++, this.nodes.pop(), this.offsets.pop();
232
+ } else if ((a & 1) == (t > 0 ? 0 : 1)) {
233
+ if (this.offsets[r] += t, e == 0) return this.lineBreak = !0, this.value = "\n", this;
234
+ e--;
235
+ } else if (i instanceof n) {
236
+ let n = i.text[o + (t < 0 ? -1 : 0)];
237
+ if (this.offsets[r] += t, n.length > Math.max(0, e)) return this.value = e == 0 ? n : t > 0 ? n.slice(e) : n.slice(0, n.length - e), this;
238
+ e -= n.length;
239
+ } else {
240
+ let a = i.children[o + (t < 0 ? -1 : 0)];
241
+ e > a.length ? (e -= a.length, this.offsets[r] += t) : (t < 0 && this.offsets[r]--, this.nodes.push(a), this.offsets.push(t > 0 ? 1 : (a instanceof n ? a.text.length : a.children.length) << 1));
242
+ }
243
+ }
244
+ }
245
+ next(e = 0) {
246
+ return e < 0 && (this.nextInner(-e, -this.dir), e = this.value.length), this.nextInner(e, this.dir);
247
+ }
248
+ }, c = class {
249
+ constructor(e, t, n) {
250
+ this.value = "", this.done = !1, this.cursor = new s(e, t > n ? -1 : 1), this.pos = t > n ? e.length : 0, this.from = Math.min(t, n), this.to = Math.max(t, n);
251
+ }
252
+ nextInner(e, t) {
253
+ if (t < 0 ? this.pos <= this.from : this.pos >= this.to) return this.value = "", this.done = !0, this;
254
+ e += Math.max(0, t < 0 ? this.pos - this.to : this.from - this.pos);
255
+ let n = t < 0 ? this.pos - this.from : this.to - this.pos;
256
+ e > n && (e = n), n -= e;
257
+ let { value: r } = this.cursor.next(e);
258
+ return this.pos += (r.length + e) * t, this.value = r.length <= n ? r : t < 0 ? r.slice(r.length - n) : r.slice(0, n), this.done = !this.value, this;
259
+ }
260
+ next(e = 0) {
261
+ return e < 0 ? e = Math.max(e, this.from - this.pos) : e > 0 && (e = Math.min(e, this.to - this.pos)), this.nextInner(e, this.cursor.dir);
262
+ }
263
+ get lineBreak() {
264
+ return this.cursor.lineBreak && this.value != "";
265
+ }
266
+ }, l = class {
267
+ constructor(e) {
268
+ this.inner = e, this.afterBreak = !0, this.value = "", this.done = !1;
269
+ }
270
+ next(e = 0) {
271
+ let { done: t, lineBreak: n, value: r } = this.inner.next(e);
272
+ return t && this.afterBreak ? (this.value = "", this.afterBreak = !1) : t ? (this.done = !0, this.value = "") : n ? this.afterBreak ? this.value = "" : (this.afterBreak = !0, this.next()) : (this.value = r, this.afterBreak = !1), this;
273
+ }
274
+ get lineBreak() {
275
+ return !1;
276
+ }
277
+ };
278
+ typeof Symbol < "u" && (t.prototype[Symbol.iterator] = function() {
279
+ return this.iter();
280
+ }, s.prototype[Symbol.iterator] = c.prototype[Symbol.iterator] = l.prototype[Symbol.iterator] = function() {
281
+ return this;
282
+ });
283
+ var u = class {
284
+ constructor(e, t, n, r) {
285
+ this.from = e, this.to = t, this.number = n, this.text = r;
286
+ }
287
+ get length() {
288
+ return this.to - this.from;
289
+ }
290
+ };
291
+ function d(e, t, n) {
292
+ return t = Math.max(0, Math.min(e.length, t)), [t, Math.max(t, Math.min(e.length, n))];
293
+ }
294
+ function f(t, n, r = !0, i = !0) {
295
+ return e(t, n, r, i);
296
+ }
297
+ function p(e) {
298
+ return e >= 56320 && e < 57344;
299
+ }
300
+ function m(e) {
301
+ return e >= 55296 && e < 56320;
302
+ }
303
+ function h(e, t) {
304
+ let n = e.charCodeAt(t);
305
+ if (!m(n) || t + 1 == e.length) return n;
306
+ let r = e.charCodeAt(t + 1);
307
+ return p(r) ? (n - 55296 << 10) + (r - 56320) + 65536 : n;
308
+ }
309
+ function ee(e) {
310
+ return e <= 65535 ? String.fromCharCode(e) : (e -= 65536, String.fromCharCode((e >> 10) + 55296, (e & 1023) + 56320));
311
+ }
312
+ function te(e) {
313
+ return e < 65536 ? 1 : 2;
314
+ }
315
+ var ne = /\r\n?|\n/, g = /* @__PURE__ */ (function(e) {
316
+ return e[e.Simple = 0] = "Simple", e[e.TrackDel = 1] = "TrackDel", e[e.TrackBefore = 2] = "TrackBefore", e[e.TrackAfter = 3] = "TrackAfter", e;
317
+ })(g ||= {}), _ = class e {
318
+ constructor(e) {
319
+ this.sections = e;
320
+ }
321
+ get length() {
322
+ let e = 0;
323
+ for (let t = 0; t < this.sections.length; t += 2) e += this.sections[t];
324
+ return e;
325
+ }
326
+ get newLength() {
327
+ let e = 0;
328
+ for (let t = 0; t < this.sections.length; t += 2) {
329
+ let n = this.sections[t + 1];
330
+ e += n < 0 ? this.sections[t] : n;
331
+ }
332
+ return e;
333
+ }
334
+ get empty() {
335
+ return this.sections.length == 0 || this.sections.length == 2 && this.sections[1] < 0;
336
+ }
337
+ iterGaps(e) {
338
+ for (let t = 0, n = 0, r = 0; t < this.sections.length;) {
339
+ let i = this.sections[t++], a = this.sections[t++];
340
+ a < 0 ? (e(n, r, i), r += i) : r += a, n += i;
341
+ }
342
+ }
343
+ iterChangedRanges(e, t = !1) {
344
+ x(this, e, t);
345
+ }
346
+ get invertedDesc() {
347
+ let t = [];
348
+ for (let e = 0; e < this.sections.length;) {
349
+ let n = this.sections[e++], r = this.sections[e++];
350
+ r < 0 ? t.push(n, r) : t.push(r, n);
351
+ }
352
+ return new e(t);
353
+ }
354
+ composeDesc(e) {
355
+ return this.empty ? e : e.empty ? this : re(this, e);
356
+ }
357
+ mapDesc(e, t = !1) {
358
+ return e.empty ? this : S(this, e, t);
359
+ }
360
+ mapPos(e, t = -1, n = g.Simple) {
361
+ let r = 0, i = 0;
362
+ for (let a = 0; a < this.sections.length;) {
363
+ let o = this.sections[a++], s = this.sections[a++], c = r + o;
364
+ if (s < 0) {
365
+ if (c > e) return i + (e - r);
366
+ i += o;
367
+ } else {
368
+ if (n != g.Simple && c >= e && (n == g.TrackDel && r < e && c > e || n == g.TrackBefore && r < e || n == g.TrackAfter && c > e)) return null;
369
+ if (c > e || c == e && t < 0 && !o) return e == r || t < 0 ? i : i + s;
370
+ i += s;
371
+ }
372
+ r = c;
373
+ }
374
+ if (e > r) throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);
375
+ return i;
376
+ }
377
+ touchesRange(e, t = e) {
378
+ for (let n = 0, r = 0; n < this.sections.length && r <= t;) {
379
+ let i = this.sections[n++], a = this.sections[n++], o = r + i;
380
+ if (a >= 0 && r <= t && o >= e) return r < e && o > t ? "cover" : !0;
381
+ r = o;
382
+ }
383
+ return !1;
384
+ }
385
+ toString() {
386
+ let e = "";
387
+ for (let t = 0; t < this.sections.length;) {
388
+ let n = this.sections[t++], r = this.sections[t++];
389
+ e += (e ? " " : "") + n + (r >= 0 ? ":" + r : "");
390
+ }
391
+ return e;
392
+ }
393
+ toJSON() {
394
+ return this.sections;
395
+ }
396
+ static fromJSON(t) {
397
+ if (!Array.isArray(t) || t.length % 2 || t.some((e) => typeof e != "number")) throw RangeError("Invalid JSON representation of ChangeDesc");
398
+ return new e(t);
399
+ }
400
+ static create(t) {
401
+ return new e(t);
402
+ }
403
+ }, v = class e extends _ {
404
+ constructor(e, t) {
405
+ super(e), this.inserted = t;
406
+ }
407
+ apply(e) {
408
+ if (this.length != e.length) throw RangeError("Applying change set to a document with the wrong length");
409
+ return x(this, (t, n, r, i, a) => e = e.replace(r, r + (n - t), a), !1), e;
410
+ }
411
+ mapDesc(e, t = !1) {
412
+ return S(this, e, t, !0);
413
+ }
414
+ invert(n) {
415
+ let r = this.sections.slice(), i = [];
416
+ for (let e = 0, a = 0; e < r.length; e += 2) {
417
+ let o = r[e], s = r[e + 1];
418
+ if (s >= 0) {
419
+ r[e] = s, r[e + 1] = o;
420
+ let c = e >> 1;
421
+ for (; i.length < c;) i.push(t.empty);
422
+ i.push(o ? n.slice(a, a + o) : t.empty);
423
+ }
424
+ a += o;
425
+ }
426
+ return new e(r, i);
427
+ }
428
+ compose(e) {
429
+ return this.empty ? e : e.empty ? this : re(this, e, !0);
430
+ }
431
+ map(e, t = !1) {
432
+ return e.empty ? this : S(this, e, t, !0);
433
+ }
434
+ iterChanges(e, t = !1) {
435
+ x(this, e, t);
436
+ }
437
+ get desc() {
438
+ return _.create(this.sections);
439
+ }
440
+ filter(t) {
441
+ let n = [], r = [], i = [], a = new C(this);
442
+ done: for (let e = 0, o = 0;;) {
443
+ let s = e == t.length ? 1e9 : t[e++];
444
+ for (; o < s || o == s && a.len == 0;) {
445
+ if (a.done) break done;
446
+ let e = Math.min(a.len, s - o);
447
+ y(i, e, -1);
448
+ let t = a.ins == -1 ? -1 : a.off == 0 ? a.ins : 0;
449
+ y(n, e, t), t > 0 && b(r, n, a.text), a.forward(e), o += e;
450
+ }
451
+ let c = t[e++];
452
+ for (; o < c;) {
453
+ if (a.done) break done;
454
+ let e = Math.min(a.len, c - o);
455
+ y(n, e, -1), y(i, e, a.ins == -1 ? -1 : a.off == 0 ? a.ins : 0), a.forward(e), o += e;
456
+ }
457
+ }
458
+ return {
459
+ changes: new e(n, r),
460
+ filtered: _.create(i)
461
+ };
462
+ }
463
+ toJSON() {
464
+ let e = [];
465
+ for (let t = 0; t < this.sections.length; t += 2) {
466
+ let n = this.sections[t], r = this.sections[t + 1];
467
+ r < 0 ? e.push(n) : r == 0 ? e.push([n]) : e.push([n].concat(this.inserted[t >> 1].toJSON()));
468
+ }
469
+ return e;
470
+ }
471
+ static of(n, r, i) {
472
+ let a = [], o = [], s = 0, c = null;
473
+ function l(t = !1) {
474
+ if (!t && !a.length) return;
475
+ s < r && y(a, r - s, -1);
476
+ let n = new e(a, o);
477
+ c = c ? c.compose(n.map(c)) : n, a = [], o = [], s = 0;
478
+ }
479
+ function u(n) {
480
+ if (Array.isArray(n)) for (let e of n) u(e);
481
+ else if (n instanceof e) {
482
+ if (n.length != r) throw RangeError(`Mismatched change set length (got ${n.length}, expected ${r})`);
483
+ l(), c = c ? c.compose(n.map(c)) : n;
484
+ } else {
485
+ let { from: e, to: c = e, insert: u } = n;
486
+ if (e > c || e < 0 || c > r) throw RangeError(`Invalid change range ${e} to ${c} (in doc of length ${r})`);
487
+ let d = u ? typeof u == "string" ? t.of(u.split(i || ne)) : u : t.empty, f = d.length;
488
+ if (e == c && f == 0) return;
489
+ e < s && l(), e > s && y(a, e - s, -1), y(a, c - e, f), b(o, a, d), s = c;
490
+ }
491
+ }
492
+ return u(n), l(!c), c;
493
+ }
494
+ static empty(t) {
495
+ return new e(t ? [t, -1] : [], []);
496
+ }
497
+ static fromJSON(n) {
498
+ if (!Array.isArray(n)) throw RangeError("Invalid JSON representation of ChangeSet");
499
+ let r = [], i = [];
500
+ for (let e = 0; e < n.length; e++) {
501
+ let a = n[e];
502
+ if (typeof a == "number") r.push(a, -1);
503
+ else if (!Array.isArray(a) || typeof a[0] != "number" || a.some((e, t) => t && typeof e != "string")) throw RangeError("Invalid JSON representation of ChangeSet");
504
+ else if (a.length == 1) r.push(a[0], 0);
505
+ else {
506
+ for (; i.length < e;) i.push(t.empty);
507
+ i[e] = t.of(a.slice(1)), r.push(a[0], i[e].length);
508
+ }
509
+ }
510
+ return new e(r, i);
511
+ }
512
+ static createSet(t, n) {
513
+ return new e(t, n);
514
+ }
515
+ };
516
+ function y(e, t, n, r = !1) {
517
+ if (t == 0 && n <= 0) return;
518
+ let i = e.length - 2;
519
+ i >= 0 && n <= 0 && n == e[i + 1] ? e[i] += t : i >= 0 && t == 0 && e[i] == 0 ? e[i + 1] += n : r ? (e[i] += t, e[i + 1] += n) : e.push(t, n);
520
+ }
521
+ function b(e, n, r) {
522
+ if (r.length == 0) return;
523
+ let i = n.length - 2 >> 1;
524
+ if (i < e.length) e[e.length - 1] = e[e.length - 1].append(r);
525
+ else {
526
+ for (; e.length < i;) e.push(t.empty);
527
+ e.push(r);
528
+ }
529
+ }
530
+ function x(e, n, r) {
531
+ let i = e.inserted;
532
+ for (let a = 0, o = 0, s = 0; s < e.sections.length;) {
533
+ let c = e.sections[s++], l = e.sections[s++];
534
+ if (l < 0) a += c, o += c;
535
+ else {
536
+ let u = a, d = o, f = t.empty;
537
+ for (; u += c, d += l, l && i && (f = f.append(i[s - 2 >> 1])), !(r || s == e.sections.length || e.sections[s + 1] < 0);) c = e.sections[s++], l = e.sections[s++];
538
+ n(a, u, o, d, f), a = u, o = d;
539
+ }
540
+ }
541
+ }
542
+ function S(e, t, n, r = !1) {
543
+ let i = [], a = r ? [] : null, o = new C(e), s = new C(t);
544
+ for (let e = -1;;) if (o.done && s.len || s.done && o.len) throw Error("Mismatched change set lengths");
545
+ else if (o.ins == -1 && s.ins == -1) {
546
+ let e = Math.min(o.len, s.len);
547
+ y(i, e, -1), o.forward(e), s.forward(e);
548
+ } else if (s.ins >= 0 && (o.ins < 0 || e == o.i || o.off == 0 && (s.len < o.len || s.len == o.len && !n))) {
549
+ let t = s.len;
550
+ for (y(i, s.ins, -1); t;) {
551
+ let n = Math.min(o.len, t);
552
+ o.ins >= 0 && e < o.i && o.len <= n && (y(i, 0, o.ins), a && b(a, i, o.text), e = o.i), o.forward(n), t -= n;
553
+ }
554
+ s.next();
555
+ } else if (o.ins >= 0) {
556
+ let t = 0, n = o.len;
557
+ for (; n;) if (s.ins == -1) {
558
+ let e = Math.min(n, s.len);
559
+ t += e, n -= e, s.forward(e);
560
+ } else if (s.ins == 0 && s.len < n) n -= s.len, s.next();
561
+ else break;
562
+ y(i, t, e < o.i ? o.ins : 0), a && e < o.i && b(a, i, o.text), e = o.i, o.forward(o.len - n);
563
+ } else if (o.done && s.done) return a ? v.createSet(i, a) : _.create(i);
564
+ else throw Error("Mismatched change set lengths");
565
+ }
566
+ function re(e, t, n = !1) {
567
+ let r = [], i = n ? [] : null, a = new C(e), o = new C(t);
568
+ for (let e = !1;;) if (a.done && o.done) return i ? v.createSet(r, i) : _.create(r);
569
+ else if (a.ins == 0) y(r, a.len, 0, e), a.next();
570
+ else if (o.len == 0 && !o.done) y(r, 0, o.ins, e), i && b(i, r, o.text), o.next();
571
+ else if (a.done || o.done) throw Error("Mismatched change set lengths");
572
+ else {
573
+ let t = Math.min(a.len2, o.len), n = r.length;
574
+ if (a.ins == -1) {
575
+ let n = o.ins == -1 ? -1 : o.off ? 0 : o.ins;
576
+ y(r, t, n, e), i && n && b(i, r, o.text);
577
+ } else o.ins == -1 ? (y(r, a.off ? 0 : a.len, t, e), i && b(i, r, a.textBit(t))) : (y(r, a.off ? 0 : a.len, o.off ? 0 : o.ins, e), i && !o.off && b(i, r, o.text));
578
+ e = (a.ins > t || o.ins >= 0 && o.len > t) && (e || r.length > n), a.forward2(t), o.forward(t);
579
+ }
580
+ }
581
+ var C = class {
582
+ constructor(e) {
583
+ this.set = e, this.i = 0, this.next();
584
+ }
585
+ next() {
586
+ let { sections: e } = this.set;
587
+ this.i < e.length ? (this.len = e[this.i++], this.ins = e[this.i++]) : (this.len = 0, this.ins = -2), this.off = 0;
588
+ }
589
+ get done() {
590
+ return this.ins == -2;
591
+ }
592
+ get len2() {
593
+ return this.ins < 0 ? this.len : this.ins;
594
+ }
595
+ get text() {
596
+ let { inserted: e } = this.set, n = this.i - 2 >> 1;
597
+ return n >= e.length ? t.empty : e[n];
598
+ }
599
+ textBit(e) {
600
+ let { inserted: n } = this.set, r = this.i - 2 >> 1;
601
+ return r >= n.length && !e ? t.empty : n[r].slice(this.off, e == null ? void 0 : this.off + e);
602
+ }
603
+ forward(e) {
604
+ e == this.len ? this.next() : (this.len -= e, this.off += e);
605
+ }
606
+ forward2(e) {
607
+ this.ins == -1 ? this.forward(e) : e == this.ins ? this.next() : (this.ins -= e, this.off += e);
608
+ }
609
+ }, w = class e {
610
+ constructor(e, t, n, r) {
611
+ this.from = e, this.to = t, this.flags = n, this.goalColumn = r;
612
+ }
613
+ get anchor() {
614
+ return this.flags & 32 ? this.to : this.from;
615
+ }
616
+ get head() {
617
+ return this.flags & 32 ? this.from : this.to;
618
+ }
619
+ get empty() {
620
+ return this.from == this.to;
621
+ }
622
+ get assoc() {
623
+ return this.flags & 8 ? -1 : this.flags & 16 ? 1 : 0;
624
+ }
625
+ get undirectional() {
626
+ return (this.flags & 64) > 0;
627
+ }
628
+ get bidiLevel() {
629
+ let e = this.flags & 7;
630
+ return e == 7 ? null : e;
631
+ }
632
+ map(t, n = -1) {
633
+ let r, i;
634
+ return this.empty ? r = i = t.mapPos(this.from, n) : (r = t.mapPos(this.from, 1), i = t.mapPos(this.to, -1)), r == this.from && i == this.to ? this : new e(r, i, this.flags, this.goalColumn);
635
+ }
636
+ extend(e, t = e, n = 0) {
637
+ if (e <= this.anchor && t >= this.anchor) return T.range(e, t, void 0, void 0, n);
638
+ let r = Math.abs(e - this.anchor) > Math.abs(t - this.anchor) ? e : t;
639
+ return T.range(this.anchor, r, void 0, void 0, n);
640
+ }
641
+ eq(e, t = !1) {
642
+ return this.anchor == e.anchor && this.head == e.head && this.goalColumn == e.goalColumn && (!t || !this.empty || this.assoc == e.assoc);
643
+ }
644
+ toJSON() {
645
+ return {
646
+ anchor: this.anchor,
647
+ head: this.head
648
+ };
649
+ }
650
+ static fromJSON(e) {
651
+ if (!e || typeof e.anchor != "number" || typeof e.head != "number") throw RangeError("Invalid JSON representation for SelectionRange");
652
+ return T.range(e.anchor, e.head);
653
+ }
654
+ static create(t, n, r, i) {
655
+ return new e(t, n, r, i);
656
+ }
657
+ }, T = class e {
658
+ constructor(e, t) {
659
+ this.ranges = e, this.mainIndex = t;
660
+ }
661
+ map(t, n = -1) {
662
+ return t.empty ? this : e.create(this.ranges.map((e) => e.map(t, n)), this.mainIndex);
663
+ }
664
+ eq(e, t = !1) {
665
+ if (this.ranges.length != e.ranges.length || this.mainIndex != e.mainIndex) return !1;
666
+ for (let n = 0; n < this.ranges.length; n++) if (!this.ranges[n].eq(e.ranges[n], t)) return !1;
667
+ return !0;
668
+ }
669
+ get main() {
670
+ return this.ranges[this.mainIndex];
671
+ }
672
+ asSingle() {
673
+ return this.ranges.length == 1 ? this : new e([this.main], 0);
674
+ }
675
+ addRange(t, n = !0) {
676
+ return e.create([t].concat(this.ranges), n ? 0 : this.mainIndex + 1);
677
+ }
678
+ replaceRange(t, n = this.mainIndex) {
679
+ let r = this.ranges.slice();
680
+ return r[n] = t, e.create(r, this.mainIndex);
681
+ }
682
+ toJSON() {
683
+ return {
684
+ ranges: this.ranges.map((e) => e.toJSON()),
685
+ main: this.mainIndex
686
+ };
687
+ }
688
+ static fromJSON(t) {
689
+ if (!t || !Array.isArray(t.ranges) || typeof t.main != "number" || t.main >= t.ranges.length) throw RangeError("Invalid JSON representation for EditorSelection");
690
+ return new e(t.ranges.map((e) => w.fromJSON(e)), t.main);
691
+ }
692
+ static single(t, n = t) {
693
+ return new e([e.range(t, n)], 0);
694
+ }
695
+ static create(t, n = 0) {
696
+ if (t.length == 0) throw RangeError("A selection needs at least one range");
697
+ for (let r = 0, i = 0; i < t.length; i++) {
698
+ let a = t[i];
699
+ if (a.empty ? a.from <= r : a.from < r) return e.normalized(t.slice(), n);
700
+ r = a.to;
701
+ }
702
+ return new e(t, n);
703
+ }
704
+ static cursor(e, t = 0, n, r) {
705
+ return w.create(e, e, (t == 0 ? 0 : t < 0 ? 8 : 16) | (n == null ? 7 : Math.min(6, n)), r);
706
+ }
707
+ static range(e, t, n, r, i) {
708
+ let a = r == null ? 7 : Math.min(6, r);
709
+ return !i && e != t && (i = t < e ? 1 : -1), i && (a |= i < 0 ? 8 : 16), t < e ? w.create(t, e, a | 32, n) : w.create(e, t, a, n);
710
+ }
711
+ static undirectionalRange(e, t) {
712
+ return w.create(e, t, 64, void 0);
713
+ }
714
+ static normalized(t, n = 0) {
715
+ let r = t[n];
716
+ t.sort((e, t) => e.from - t.from), n = t.indexOf(r);
717
+ for (let r = 1; r < t.length; r++) {
718
+ let i = t[r], a = t[r - 1];
719
+ if (i.empty ? i.from <= a.to : i.from < a.to) {
720
+ let o = a.from, s = Math.max(i.to, a.to);
721
+ r <= n && n--, t.splice(--r, 2, i.anchor > i.head ? e.range(s, o) : e.range(o, s));
722
+ }
723
+ }
724
+ return new e(t, n);
725
+ }
726
+ };
727
+ function ie(e, t) {
728
+ for (let n of e.ranges) if (n.to > t) throw RangeError("Selection points outside of document");
729
+ }
730
+ var ae = 0, E = class e {
731
+ constructor(e, t, n, r, i) {
732
+ this.combine = e, this.compareInput = t, this.compare = n, this.isStatic = r, this.id = ae++, this.default = e([]), this.extensions = typeof i == "function" ? i(this) : i;
733
+ }
734
+ get reader() {
735
+ return this;
736
+ }
737
+ static define(t = {}) {
738
+ return new e(t.combine || ((e) => e), t.compareInput || ((e, t) => e === t), t.compare || (t.combine ? (e, t) => e === t : oe), !!t.static, t.enables);
739
+ }
740
+ of(e) {
741
+ return new D([], this, 0, e);
742
+ }
743
+ compute(e, t) {
744
+ if (this.isStatic) throw Error("Can't compute a static facet");
745
+ return new D(e, this, 1, t);
746
+ }
747
+ computeN(e, t) {
748
+ if (this.isStatic) throw Error("Can't compute a static facet");
749
+ return new D(e, this, 2, t);
750
+ }
751
+ from(e, t) {
752
+ return t ||= (e) => e, this.compute([e], (n) => t(n.field(e)));
753
+ }
754
+ };
755
+ function oe(e, t) {
756
+ return e == t || e.length == t.length && e.every((e, n) => e === t[n]);
757
+ }
758
+ var D = class {
759
+ constructor(e, t, n, r) {
760
+ this.dependencies = e, this.facet = t, this.type = n, this.value = r, this.id = ae++;
761
+ }
762
+ dynamicSlot(e) {
763
+ let t = this.value, n = this.facet.compareInput, r = this.id, i = e[r] >> 1, a = this.type == 2, o = !1, s = !1, c = [];
764
+ for (let t of this.dependencies) t == "doc" ? o = !0 : t == "selection" ? s = !0 : (e[t.id] ?? 1) & 1 || c.push(e[t.id]);
765
+ return {
766
+ create(e) {
767
+ return e.values[i] = t(e), 1;
768
+ },
769
+ update(e, r) {
770
+ if (o && r.docChanged || s && (r.docChanged || r.selection) || O(e, c)) {
771
+ let r = t(e);
772
+ if (a ? !se(r, e.values[i], n) : !n(r, e.values[i])) return e.values[i] = r, 1;
773
+ }
774
+ return 0;
775
+ },
776
+ reconfigure: (e, o) => {
777
+ let s, c = o.config.address[r];
778
+ if (c != null) {
779
+ let r = F(o, c);
780
+ if (this.dependencies.every((t) => t instanceof E ? o.facet(t) === e.facet(t) : t instanceof A ? o.field(t, !1) == e.field(t, !1) : !0) || (a ? se(s = t(e), r, n) : n(s = t(e), r))) return e.values[i] = r, 0;
781
+ } else s = t(e);
782
+ return e.values[i] = s, 1;
783
+ }
784
+ };
785
+ }
786
+ get extension() {
787
+ return this;
788
+ }
789
+ };
790
+ function se(e, t, n) {
791
+ if (e.length != t.length) return !1;
792
+ for (let r = 0; r < e.length; r++) if (!n(e[r], t[r])) return !1;
793
+ return !0;
794
+ }
795
+ function O(e, t) {
796
+ let n = !1;
797
+ for (let r of t) P(e, r) & 1 && (n = !0);
798
+ return n;
799
+ }
800
+ function ce(e, t, n) {
801
+ let r = n.map((t) => e[t.id]), i = n.map((e) => e.type), a = r.filter((e) => !(e & 1)), o = e[t.id] >> 1;
802
+ function s(e) {
803
+ let n = [];
804
+ for (let t = 0; t < r.length; t++) {
805
+ let a = F(e, r[t]);
806
+ if (i[t] == 2) for (let e of a) n.push(e);
807
+ else n.push(a);
808
+ }
809
+ return t.combine(n);
810
+ }
811
+ return {
812
+ create(e) {
813
+ for (let t of r) P(e, t);
814
+ return e.values[o] = s(e), 1;
815
+ },
816
+ update(e, n) {
817
+ if (!O(e, a)) return 0;
818
+ let r = s(e);
819
+ return t.compare(r, e.values[o]) ? 0 : (e.values[o] = r, 1);
820
+ },
821
+ reconfigure(e, i) {
822
+ let a = O(e, r), c = i.config.facets[t.id], l = i.facet(t);
823
+ if (c && !a && oe(n, c)) return e.values[o] = l, 0;
824
+ let u = s(e);
825
+ return t.compare(u, l) ? (e.values[o] = l, 0) : (e.values[o] = u, 1);
826
+ }
827
+ };
828
+ }
829
+ var k = /* @__PURE__ */ E.define({ static: !0 }), A = class e {
830
+ constructor(e, t, n, r, i) {
831
+ this.id = e, this.createF = t, this.updateF = n, this.compareF = r, this.spec = i, this.provides = void 0;
832
+ }
833
+ static define(t) {
834
+ let n = new e(ae++, t.create, t.update, t.compare || ((e, t) => e === t), t);
835
+ return t.provide && (n.provides = t.provide(n)), n;
836
+ }
837
+ create(e) {
838
+ return (e.facet(k).find((e) => e.field == this)?.create || this.createF)(e);
839
+ }
840
+ slot(e) {
841
+ let t = e[this.id] >> 1;
842
+ return {
843
+ create: (e) => (e.values[t] = this.create(e), 1),
844
+ update: (e, n) => {
845
+ let r = e.values[t], i = this.updateF(r, n);
846
+ return this.compareF(r, i) ? 0 : (e.values[t] = i, 1);
847
+ },
848
+ reconfigure: (e, n) => {
849
+ let r = e.facet(k), i = n.facet(k), a;
850
+ return (a = r.find((e) => e.field == this)) && a != i.find((e) => e.field == this) ? (e.values[t] = a.create(e), 1) : n.config.address[this.id] == null ? (e.values[t] = this.create(e), 1) : (e.values[t] = n.field(this), 0);
851
+ }
852
+ };
853
+ }
854
+ init(e) {
855
+ return [this, k.of({
856
+ field: this,
857
+ create: e
858
+ })];
859
+ }
860
+ get extension() {
861
+ return this;
862
+ }
863
+ }, j = {
864
+ lowest: 4,
865
+ low: 3,
866
+ default: 2,
867
+ high: 1,
868
+ highest: 0
869
+ };
870
+ function M(e) {
871
+ return (t) => new ue(t, e);
872
+ }
873
+ var le = {
874
+ highest: /* @__PURE__ */ M(j.highest),
875
+ high: /* @__PURE__ */ M(j.high),
876
+ default: /* @__PURE__ */ M(j.default),
877
+ low: /* @__PURE__ */ M(j.low),
878
+ lowest: /* @__PURE__ */ M(j.lowest)
879
+ }, ue = class {
880
+ constructor(e, t) {
881
+ this.inner = e, this.prec = t;
882
+ }
883
+ get extension() {
884
+ return this;
885
+ }
886
+ }, de = class e {
887
+ of(e) {
888
+ return new N(this, e);
889
+ }
890
+ reconfigure(t) {
891
+ return e.reconfigure.of({
892
+ compartment: this,
893
+ extension: t
894
+ });
895
+ }
896
+ get(e) {
897
+ return e.config.compartments.get(this);
898
+ }
899
+ }, N = class {
900
+ constructor(e, t) {
901
+ this.compartment = e, this.inner = t;
902
+ }
903
+ get extension() {
904
+ return this;
905
+ }
906
+ }, fe = class e {
907
+ constructor(e, t, n, r, i, a) {
908
+ for (this.base = e, this.compartments = t, this.dynamicSlots = n, this.address = r, this.staticValues = i, this.facets = a, this.statusTemplate = []; this.statusTemplate.length < n.length;) this.statusTemplate.push(0);
909
+ }
910
+ staticFacet(e) {
911
+ let t = this.address[e.id];
912
+ return t == null ? e.default : this.staticValues[t >> 1];
913
+ }
914
+ static resolve(t, n, r) {
915
+ let i = [], a = Object.create(null), o = /* @__PURE__ */ new Map();
916
+ for (let e of pe(t, n, o)) e instanceof A ? i.push(e) : (a[e.facet.id] || (a[e.facet.id] = [])).push(e);
917
+ let s = Object.create(null), c = [], l = [];
918
+ for (let e of i) s[e.id] = l.length << 1, l.push((t) => e.slot(t));
919
+ let u = r?.config.facets;
920
+ for (let e in a) {
921
+ let t = a[e], n = t[0].facet, i = u && u[e] || [];
922
+ if (t.every((e) => e.type == 0)) if (s[n.id] = c.length << 1 | 1, oe(i, t)) c.push(r.facet(n));
923
+ else {
924
+ let e = n.combine(t.map((e) => e.value));
925
+ c.push(r && n.compare(e, r.facet(n)) ? r.facet(n) : e);
926
+ }
927
+ else {
928
+ for (let e of t) e.type == 0 ? (s[e.id] = c.length << 1 | 1, c.push(e.value)) : (s[e.id] = l.length << 1, l.push((t) => e.dynamicSlot(t)));
929
+ s[n.id] = l.length << 1, l.push((e) => ce(e, n, t));
930
+ }
931
+ }
932
+ return new e(t, o, l.map((e) => e(s)), s, c, a);
933
+ }
934
+ };
935
+ function pe(e, t, n) {
936
+ let r = [
937
+ [],
938
+ [],
939
+ [],
940
+ [],
941
+ []
942
+ ], i = /* @__PURE__ */ new Map();
943
+ function a(e, o) {
944
+ let s = i.get(e);
945
+ if (s != null) {
946
+ if (s <= o) return;
947
+ let t = r[s].indexOf(e);
948
+ t > -1 && r[s].splice(t, 1), e instanceof N && n.delete(e.compartment);
949
+ }
950
+ if (i.set(e, o), Array.isArray(e)) for (let t of e) a(t, o);
951
+ else if (e instanceof N) {
952
+ if (n.has(e.compartment)) throw RangeError("Duplicate use of compartment in extensions");
953
+ let r = t.get(e.compartment) || e.inner;
954
+ n.set(e.compartment, r), a(r, o);
955
+ } else if (e instanceof ue) a(e.inner, e.prec);
956
+ else if (e instanceof A) r[o].push(e), e.provides && a(e.provides, o);
957
+ else if (e instanceof D) r[o].push(e), e.facet.extensions && a(e.facet.extensions, j.default);
958
+ else {
959
+ let t = e.extension;
960
+ if (!t) throw Error(`Unrecognized extension value in extension set (${e}).`);
961
+ if (t == e) throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);
962
+ a(t, o);
963
+ }
964
+ }
965
+ return a(e, j.default), r.reduce((e, t) => e.concat(t));
966
+ }
967
+ function P(e, t) {
968
+ if (t & 1) return 2;
969
+ let n = t >> 1, r = e.status[n];
970
+ if (r == 4) throw Error("Cyclic dependency between fields and/or facets");
971
+ if (r & 2) return r;
972
+ e.status[n] = 4;
973
+ let i = e.computeSlot(e, e.config.dynamicSlots[n]);
974
+ return e.status[n] = 2 | i;
975
+ }
976
+ function F(e, t) {
977
+ return t & 1 ? e.config.staticValues[t >> 1] : e.values[t >> 1];
978
+ }
979
+ var me = /* @__PURE__ */ E.define(), I = /* @__PURE__ */ E.define({
980
+ combine: (e) => e.some((e) => e),
981
+ static: !0
982
+ }), he = /* @__PURE__ */ E.define({
983
+ combine: (e) => e.length ? e[0] : void 0,
984
+ static: !0
985
+ }), ge = /* @__PURE__ */ E.define(), _e = /* @__PURE__ */ E.define(), ve = /* @__PURE__ */ E.define(), ye = /* @__PURE__ */ E.define({ combine: (e) => e.length ? e[0] : !1 }), L = class {
986
+ constructor(e, t) {
987
+ this.type = e, this.value = t;
988
+ }
989
+ static define() {
990
+ return new be();
991
+ }
992
+ }, be = class {
993
+ of(e) {
994
+ return new L(this, e);
995
+ }
996
+ }, xe = class {
997
+ constructor(e) {
998
+ this.map = e;
999
+ }
1000
+ of(e) {
1001
+ return new R(this, e);
1002
+ }
1003
+ }, R = class e {
1004
+ constructor(e, t) {
1005
+ this.type = e, this.value = t;
1006
+ }
1007
+ map(t) {
1008
+ let n = this.type.map(this.value, t);
1009
+ return n === void 0 ? void 0 : n == this.value ? this : new e(this.type, n);
1010
+ }
1011
+ is(e) {
1012
+ return this.type == e;
1013
+ }
1014
+ static define(e = {}) {
1015
+ return new xe(e.map || ((e) => e));
1016
+ }
1017
+ static mapEffects(e, t) {
1018
+ if (!e.length) return e;
1019
+ let n = [];
1020
+ for (let r of e) {
1021
+ let e = r.map(t);
1022
+ e && n.push(e);
1023
+ }
1024
+ return n;
1025
+ }
1026
+ };
1027
+ R.reconfigure = /* @__PURE__ */ R.define(), R.appendConfig = /* @__PURE__ */ R.define();
1028
+ var z = class e {
1029
+ constructor(t, n, r, i, a, o) {
1030
+ this.startState = t, this.changes = n, this.selection = r, this.effects = i, this.annotations = a, this.scrollIntoView = o, this._doc = null, this._state = null, r && ie(r, n.newLength), a.some((t) => t.type == e.time) || (this.annotations = a.concat(e.time.of(Date.now())));
1031
+ }
1032
+ static create(t, n, r, i, a, o) {
1033
+ return new e(t, n, r, i, a, o);
1034
+ }
1035
+ get newDoc() {
1036
+ return this._doc ||= this.changes.apply(this.startState.doc);
1037
+ }
1038
+ get newSelection() {
1039
+ return this.selection || this.startState.selection.map(this.changes);
1040
+ }
1041
+ get state() {
1042
+ return this._state || this.startState.applyTransaction(this), this._state;
1043
+ }
1044
+ annotation(e) {
1045
+ for (let t of this.annotations) if (t.type == e) return t.value;
1046
+ }
1047
+ get docChanged() {
1048
+ return !this.changes.empty;
1049
+ }
1050
+ get reconfigured() {
1051
+ return this.startState.config != this.state.config;
1052
+ }
1053
+ isUserEvent(t) {
1054
+ let n = this.annotation(e.userEvent);
1055
+ return !!(n && (n == t || n.length > t.length && n.slice(0, t.length) == t && n[t.length] == "."));
1056
+ }
1057
+ };
1058
+ z.time = /* @__PURE__ */ L.define(), z.userEvent = /* @__PURE__ */ L.define(), z.addToHistory = /* @__PURE__ */ L.define(), z.remote = /* @__PURE__ */ L.define();
1059
+ function Se(e, t) {
1060
+ let n = [];
1061
+ for (let r = 0, i = 0;;) {
1062
+ let a, o;
1063
+ if (r < e.length && (i == t.length || t[i] >= e[r])) a = e[r++], o = e[r++];
1064
+ else if (i < t.length) a = t[i++], o = t[i++];
1065
+ else return n;
1066
+ !n.length || n[n.length - 1] < a ? n.push(a, o) : n[n.length - 1] < o && (n[n.length - 1] = o);
1067
+ }
1068
+ }
1069
+ function Ce(e, t, n) {
1070
+ let r, i, a;
1071
+ return n ? (r = t.changes, i = v.empty(t.changes.length), a = e.changes.compose(t.changes)) : (r = t.changes.map(e.changes), i = e.changes.mapDesc(t.changes, !0), a = e.changes.compose(r)), {
1072
+ changes: a,
1073
+ selection: t.selection ? t.selection.map(i) : e.selection?.map(r),
1074
+ effects: R.mapEffects(e.effects, r).concat(R.mapEffects(t.effects, i)),
1075
+ annotations: e.annotations.length ? e.annotations.concat(t.annotations) : t.annotations,
1076
+ scrollIntoView: e.scrollIntoView || t.scrollIntoView
1077
+ };
1078
+ }
1079
+ function we(e, t, n) {
1080
+ let r = t.selection, i = B(t.annotations);
1081
+ return t.userEvent && (i = i.concat(z.userEvent.of(t.userEvent))), {
1082
+ changes: t.changes instanceof v ? t.changes : v.of(t.changes || [], n, e.facet(he)),
1083
+ selection: r && (r instanceof T ? r : T.single(r.anchor, r.head)),
1084
+ effects: B(t.effects),
1085
+ annotations: i,
1086
+ scrollIntoView: !!t.scrollIntoView
1087
+ };
1088
+ }
1089
+ function Te(e, t, n) {
1090
+ let r = we(e, t.length ? t[0] : {}, e.doc.length);
1091
+ t.length && t[0].filter === !1 && (n = !1);
1092
+ for (let i = 1; i < t.length; i++) {
1093
+ t[i].filter === !1 && (n = !1);
1094
+ let a = !!t[i].sequential;
1095
+ r = Ce(r, we(e, t[i], a ? r.changes.newLength : e.doc.length), a);
1096
+ }
1097
+ let i = z.create(e, r.changes, r.selection, r.effects, r.annotations, r.scrollIntoView);
1098
+ return De(n ? Ee(i) : i);
1099
+ }
1100
+ function Ee(e) {
1101
+ let t = e.startState, n = !0;
1102
+ for (let r of t.facet(ge)) {
1103
+ let t = r(e);
1104
+ if (t === !1) {
1105
+ n = !1;
1106
+ break;
1107
+ }
1108
+ Array.isArray(t) && (n = n === !0 ? t : Se(n, t));
1109
+ }
1110
+ if (n !== !0) {
1111
+ let r, i;
1112
+ if (n === !1) i = e.changes.invertedDesc, r = v.empty(t.doc.length);
1113
+ else {
1114
+ let t = e.changes.filter(n);
1115
+ r = t.changes, i = t.filtered.mapDesc(t.changes).invertedDesc;
1116
+ }
1117
+ e = z.create(t, r, e.selection && e.selection.map(i), R.mapEffects(e.effects, i), e.annotations, e.scrollIntoView);
1118
+ }
1119
+ let r = t.facet(_e);
1120
+ for (let n = r.length - 1; n >= 0; n--) {
1121
+ let i = r[n](e);
1122
+ e = i instanceof z ? i : Array.isArray(i) && i.length == 1 && i[0] instanceof z ? i[0] : Te(t, B(i), !1);
1123
+ }
1124
+ return e;
1125
+ }
1126
+ function De(e) {
1127
+ let t = e.startState, n = t.facet(ve), r = e;
1128
+ for (let i = n.length - 1; i >= 0; i--) {
1129
+ let a = n[i](e);
1130
+ a && Object.keys(a).length && (r = Ce(r, we(t, a, e.changes.newLength), !0));
1131
+ }
1132
+ return r == e ? e : z.create(t, e.changes, e.selection, r.effects, r.annotations, r.scrollIntoView);
1133
+ }
1134
+ var Oe = [];
1135
+ function B(e) {
1136
+ return e == null ? Oe : Array.isArray(e) ? e : [e];
1137
+ }
1138
+ var V = /* @__PURE__ */ (function(e) {
1139
+ return e[e.Word = 0] = "Word", e[e.Space = 1] = "Space", e[e.Other = 2] = "Other", e;
1140
+ })(V ||= {}), ke = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/, H;
1141
+ try {
1142
+ H = /* @__PURE__ */ RegExp("[\\p{Alphabetic}\\p{Number}_]", "u");
1143
+ } catch {}
1144
+ function Ae(e) {
1145
+ if (H) return H.test(e);
1146
+ for (let t = 0; t < e.length; t++) {
1147
+ let n = e[t];
1148
+ if (/\w/.test(n) || n > "€" && (n.toUpperCase() != n.toLowerCase() || ke.test(n))) return !0;
1149
+ }
1150
+ return !1;
1151
+ }
1152
+ function je(e) {
1153
+ return (t) => {
1154
+ if (!/\S/.test(t)) return V.Space;
1155
+ if (Ae(t)) return V.Word;
1156
+ for (let n = 0; n < e.length; n++) if (t.indexOf(e[n]) > -1) return V.Word;
1157
+ return V.Other;
1158
+ };
1159
+ }
1160
+ var U = class e {
1161
+ constructor(e, t, n, r, i, a) {
1162
+ this.config = e, this.doc = t, this.selection = n, this.values = r, this.status = e.statusTemplate.slice(), this.computeSlot = i, a && (a._state = this);
1163
+ for (let e = 0; e < this.config.dynamicSlots.length; e++) P(this, e << 1);
1164
+ this.computeSlot = null;
1165
+ }
1166
+ field(e, t = !0) {
1167
+ let n = this.config.address[e.id];
1168
+ if (n == null) {
1169
+ if (t) throw RangeError("Field is not present in this state");
1170
+ return;
1171
+ }
1172
+ return P(this, n), F(this, n);
1173
+ }
1174
+ update(...e) {
1175
+ return Te(this, e, !0);
1176
+ }
1177
+ applyTransaction(t) {
1178
+ let n = this.config, { base: r, compartments: i } = n;
1179
+ for (let e of t.effects) e.is(de.reconfigure) ? (n &&= (i = /* @__PURE__ */ new Map(), n.compartments.forEach((e, t) => i.set(t, e)), null), i.set(e.value.compartment, e.value.extension)) : e.is(R.reconfigure) ? (n = null, r = e.value) : e.is(R.appendConfig) && (n = null, r = B(r).concat(e.value));
1180
+ let a;
1181
+ n ? a = t.startState.values.slice() : (n = fe.resolve(r, i, this), a = new e(n, this.doc, this.selection, n.dynamicSlots.map(() => null), (e, t) => t.reconfigure(e, this), null).values);
1182
+ let o = t.startState.facet(I) ? t.newSelection : t.newSelection.asSingle();
1183
+ new e(n, t.newDoc, o, a, (e, n) => n.update(e, t), t);
1184
+ }
1185
+ replaceSelection(e) {
1186
+ return typeof e == "string" && (e = this.toText(e)), this.changeByRange((t) => ({
1187
+ changes: {
1188
+ from: t.from,
1189
+ to: t.to,
1190
+ insert: e
1191
+ },
1192
+ range: T.cursor(t.from + e.length, -1)
1193
+ }));
1194
+ }
1195
+ changeByRange(e) {
1196
+ let t = this.selection, n = e(t.ranges[0]), r = this.changes(n.changes), i = [n.range], a = B(n.effects);
1197
+ for (let n = 1; n < t.ranges.length; n++) {
1198
+ let o = e(t.ranges[n]), s = this.changes(o.changes), c = s.map(r);
1199
+ for (let e = 0; e < n; e++) i[e] = i[e].map(c);
1200
+ let l = r.mapDesc(s, !0);
1201
+ i.push(o.range.map(l)), r = r.compose(c), a = R.mapEffects(a, c).concat(R.mapEffects(B(o.effects), l));
1202
+ }
1203
+ return {
1204
+ changes: r,
1205
+ selection: T.create(i, t.mainIndex),
1206
+ effects: a
1207
+ };
1208
+ }
1209
+ changes(t = []) {
1210
+ return t instanceof v ? t : v.of(t, this.doc.length, this.facet(e.lineSeparator));
1211
+ }
1212
+ toText(n) {
1213
+ return t.of(n.split(this.facet(e.lineSeparator) || ne));
1214
+ }
1215
+ sliceDoc(e = 0, t = this.doc.length) {
1216
+ return this.doc.sliceString(e, t, this.lineBreak);
1217
+ }
1218
+ facet(e) {
1219
+ let t = this.config.address[e.id];
1220
+ return t == null ? e.default : (P(this, t), F(this, t));
1221
+ }
1222
+ toJSON(e) {
1223
+ let t = {
1224
+ doc: this.sliceDoc(),
1225
+ selection: this.selection.toJSON()
1226
+ };
1227
+ if (e) for (let n in e) {
1228
+ let r = e[n];
1229
+ r instanceof A && this.config.address[r.id] != null && (t[n] = r.spec.toJSON(this.field(e[n]), this));
1230
+ }
1231
+ return t;
1232
+ }
1233
+ static fromJSON(t, n = {}, r) {
1234
+ if (!t || typeof t.doc != "string") throw RangeError("Invalid JSON representation for EditorState");
1235
+ let i = [];
1236
+ if (r) {
1237
+ for (let e in r) if (Object.prototype.hasOwnProperty.call(t, e)) {
1238
+ let n = r[e], a = t[e];
1239
+ i.push(n.init((e) => n.spec.fromJSON(a, e)));
1240
+ }
1241
+ }
1242
+ return e.create({
1243
+ doc: t.doc,
1244
+ selection: T.fromJSON(t.selection),
1245
+ extensions: n.extensions ? i.concat([n.extensions]) : i
1246
+ });
1247
+ }
1248
+ static create(n = {}) {
1249
+ let r = fe.resolve(n.extensions || [], /* @__PURE__ */ new Map()), i = n.doc instanceof t ? n.doc : t.of((n.doc || "").split(r.staticFacet(e.lineSeparator) || ne)), a = n.selection ? n.selection instanceof T ? n.selection : T.single(n.selection.anchor, n.selection.head) : T.single(0);
1250
+ return ie(a, i.length), r.staticFacet(I) || (a = a.asSingle()), new e(r, i, a, r.dynamicSlots.map(() => null), (e, t) => t.create(e), null);
1251
+ }
1252
+ get tabSize() {
1253
+ return this.facet(e.tabSize);
1254
+ }
1255
+ get lineBreak() {
1256
+ return this.facet(e.lineSeparator) || "\n";
1257
+ }
1258
+ get readOnly() {
1259
+ return this.facet(ye);
1260
+ }
1261
+ phrase(t, ...n) {
1262
+ for (let n of this.facet(e.phrases)) if (Object.prototype.hasOwnProperty.call(n, t)) {
1263
+ t = n[t];
1264
+ break;
1265
+ }
1266
+ return n.length && (t = t.replace(/\$(\$|\d*)/g, (e, t) => {
1267
+ if (t == "$") return "$";
1268
+ let r = +(t || 1);
1269
+ return !r || r > n.length ? e : n[r - 1];
1270
+ })), t;
1271
+ }
1272
+ languageDataAt(e, t, n = -1) {
1273
+ let r = [];
1274
+ for (let i of this.facet(me)) for (let a of i(this, t, n)) Object.prototype.hasOwnProperty.call(a, e) && r.push(a[e]);
1275
+ return r;
1276
+ }
1277
+ charCategorizer(e) {
1278
+ let t = this.languageDataAt("wordChars", e);
1279
+ return je(t.length ? t[0] : "");
1280
+ }
1281
+ wordAt(e) {
1282
+ let { text: t, from: n, length: r } = this.doc.lineAt(e), i = this.charCategorizer(e), a = e - n, o = e - n;
1283
+ for (; a > 0;) {
1284
+ let e = f(t, a, !1);
1285
+ if (i(t.slice(e, a)) != V.Word) break;
1286
+ a = e;
1287
+ }
1288
+ for (; o < r;) {
1289
+ let e = f(t, o);
1290
+ if (i(t.slice(o, e)) != V.Word) break;
1291
+ o = e;
1292
+ }
1293
+ return a == o ? null : T.range(a + n, o + n);
1294
+ }
1295
+ };
1296
+ U.allowMultipleSelections = I, U.tabSize = /* @__PURE__ */ E.define({ combine: (e) => e.length ? e[0] : 4 }), U.lineSeparator = he, U.readOnly = ye, U.phrases = /* @__PURE__ */ E.define({ compare(e, t) {
1297
+ let n = Object.keys(e), r = Object.keys(t);
1298
+ return n.length == r.length && n.every((n) => e[n] == t[n]);
1299
+ } }), U.languageData = me, U.changeFilter = ge, U.transactionFilter = _e, U.transactionExtender = ve, de.reconfigure = /* @__PURE__ */ R.define();
1300
+ function Me(e, t, n = {}) {
1301
+ let r = {};
1302
+ for (let t of e) for (let e of Object.keys(t)) {
1303
+ let i = t[e], a = r[e];
1304
+ if (a === void 0) r[e] = i;
1305
+ else if (!(a === i || i === void 0)) if (Object.hasOwnProperty.call(n, e)) r[e] = n[e](a, i);
1306
+ else throw Error("Config merge conflict for field " + e);
1307
+ }
1308
+ for (let e in t) r[e] === void 0 && (r[e] = t[e]);
1309
+ return r;
1310
+ }
1311
+ var W = class {
1312
+ eq(e) {
1313
+ return this == e;
1314
+ }
1315
+ range(e, t = e) {
1316
+ return K.create(e, t, this);
1317
+ }
1318
+ };
1319
+ W.prototype.startSide = W.prototype.endSide = 0, W.prototype.point = !1, W.prototype.mapMode = g.TrackDel;
1320
+ function G(e, t) {
1321
+ return e == t || e.constructor == t.constructor && e.eq(t);
1322
+ }
1323
+ var K = class e {
1324
+ constructor(e, t, n) {
1325
+ this.from = e, this.to = t, this.value = n;
1326
+ }
1327
+ static create(t, n, r) {
1328
+ return new e(t, n, r);
1329
+ }
1330
+ };
1331
+ function q(e, t) {
1332
+ return e.from - t.from || e.value.startSide - t.value.startSide;
1333
+ }
1334
+ var Ne = class e {
1335
+ constructor(e, t, n, r) {
1336
+ this.from = e, this.to = t, this.value = n, this.maxPoint = r;
1337
+ }
1338
+ get length() {
1339
+ return Y(this.to);
1340
+ }
1341
+ findIndex(e, t, n, r = 0) {
1342
+ let i = n ? this.to : this.from;
1343
+ for (let a = r, o = i.length;;) {
1344
+ if (a == o) return a;
1345
+ let r = a + o >> 1, s = i[r] - e || (n ? this.value[r].endSide : this.value[r].startSide) - t;
1346
+ if (r == a) return s >= 0 ? a : o;
1347
+ s >= 0 ? o = r : a = r + 1;
1348
+ }
1349
+ }
1350
+ between(e, t, n, r) {
1351
+ for (let i = this.findIndex(t, -1e9, !0), a = this.findIndex(n, 1e9, !1, i); i < a; i++) if (r(this.from[i] + e, this.to[i] + e, this.value[i]) === !1) return !1;
1352
+ }
1353
+ map(t, n, r, i, a) {
1354
+ let o = [], s = [], c = [], l = -1, u = -1;
1355
+ iter: for (let e = 0; e < this.value.length; e++) {
1356
+ let d = this.value[e], f = this.from[e] + t, p = this.to[e] + t, m, h;
1357
+ if (f == p) {
1358
+ let e = n.mapPos(f, d.startSide, d.mapMode);
1359
+ if (e == null || (m = h = e, d.startSide != d.endSide && (h = n.mapPos(f, d.endSide), h < m))) continue;
1360
+ } else if (m = n.mapPos(f, d.startSide), h = n.mapPos(p, d.endSide), m > h || m == h && d.startSide > 0 && d.endSide <= 0) continue;
1361
+ if (!((h - m || d.endSide - d.startSide) < 0)) if (l < 0 && (l = m), d.point && (u = Math.max(u, h - m)), (m - r || d.startSide - i) >= 0) o.push(d), s.push(m - l), c.push(h - l), r = h, i = d.endSide;
1362
+ else {
1363
+ if (m == h) for (let e = o.length; e > 0; e--) {
1364
+ if ((m - (c[e - 1] + l) || d.startSide - o[e - 1].endSide) >= 0) {
1365
+ o.splice(e, 0, d), s.splice(e, 0, m - l), c.splice(e, 0, h - l);
1366
+ continue iter;
1367
+ }
1368
+ if ((m - (s[e - 1] + l) || d.endSide - o[e - 1].startSide) > 0) break;
1369
+ }
1370
+ a(m, h, d);
1371
+ }
1372
+ }
1373
+ return {
1374
+ mapped: o.length ? new e(s, c, o, u) : null,
1375
+ pos: l
1376
+ };
1377
+ }
1378
+ }, J = class e {
1379
+ constructor(e, t, n, r) {
1380
+ this.chunkPos = e, this.chunk = t, this.nextLayer = n, this.maxPoint = r;
1381
+ }
1382
+ static create(t, n, r, i) {
1383
+ return new e(t, n, r, i);
1384
+ }
1385
+ get length() {
1386
+ let e = this.chunk.length - 1;
1387
+ return e < 0 ? 0 : Math.max(this.chunkEnd(e), this.nextLayer.length);
1388
+ }
1389
+ get size() {
1390
+ if (this.isEmpty) return 0;
1391
+ let e = this.nextLayer.size;
1392
+ for (let t of this.chunk) e += t.value.length;
1393
+ return e;
1394
+ }
1395
+ chunkEnd(e) {
1396
+ return this.chunkPos[e] + this.chunk[e].length;
1397
+ }
1398
+ update(t) {
1399
+ let { add: n = [], sort: r = !1, filterFrom: i = 0, filterTo: a = this.length } = t, o = t.filter;
1400
+ if (n.length == 0 && !o) return this;
1401
+ if (r && (n = n.slice().sort(q)), this.isEmpty) return n.length ? e.of(n) : this;
1402
+ let s = new Ie(this, null, -1).goto(0), c = 0, l = [], u = new X();
1403
+ for (; s.value || c < n.length;) if (c < n.length && (s.from - n[c].from || s.startSide - n[c].value.startSide) >= 0) {
1404
+ let e = n[c++];
1405
+ u.addInner(e.from, e.to, e.value, !1) || l.push(e);
1406
+ } else s.rangeIndex == 1 && s.chunkIndex < this.chunk.length && (c == n.length || this.chunkEnd(s.chunkIndex) < n[c].from) && (!o || i > this.chunkEnd(s.chunkIndex) || a < this.chunkPos[s.chunkIndex]) && u.addChunk(this.chunkPos[s.chunkIndex], this.chunk[s.chunkIndex]) ? s.nextChunk() : ((!o || i > s.to || a < s.from || o(s.from, s.to, s.value)) && (u.addInner(s.from, s.to, s.value, !1) || l.push(K.create(s.from, s.to, s.value))), s.next());
1407
+ return u.finishInner(this.nextLayer.isEmpty && !l.length ? e.empty : this.nextLayer.update({
1408
+ add: l,
1409
+ filter: o,
1410
+ filterFrom: i,
1411
+ filterTo: a
1412
+ }));
1413
+ }
1414
+ map(t) {
1415
+ if (t.empty || this.isEmpty) return this;
1416
+ let n = [], r = [], i = -1, a, o = (e, t, n) => {
1417
+ a ||= new X(), a.addRange(e, t, n, !1);
1418
+ };
1419
+ for (let e = 0; e < this.chunk.length; e++) {
1420
+ let a = this.chunkPos[e], s = this.chunk[e], c = t.touchesRange(a, a + s.length);
1421
+ if (c === !1) i = Math.max(i, s.maxPoint), n.push(s), r.push(t.mapPos(a));
1422
+ else if (c === !0) {
1423
+ let [e, c] = n.length ? [Y(r) + Y(n).length, Y(Y(n).value).endSide] : [-1, -1], { mapped: l, pos: u } = s.map(a, t, e, c, o);
1424
+ l && (i = Math.max(i, l.maxPoint), n.push(l), r.push(u));
1425
+ }
1426
+ }
1427
+ let s = this.nextLayer.map(t);
1428
+ return a && (s = a.finishInner(s)), n.length == 0 ? s : new e(r, n, s || e.empty, i);
1429
+ }
1430
+ between(e, t, n) {
1431
+ if (!this.isEmpty) {
1432
+ for (let r = 0; r < this.chunk.length; r++) {
1433
+ let i = this.chunkPos[r], a = this.chunk[r];
1434
+ if (t >= i && e <= i + a.length && a.between(i, e - i, t - i, n) === !1) return;
1435
+ }
1436
+ this.nextLayer.between(e, t, n);
1437
+ }
1438
+ }
1439
+ iter(e = 0) {
1440
+ return Le.from([this]).goto(e);
1441
+ }
1442
+ get isEmpty() {
1443
+ return this.nextLayer == this;
1444
+ }
1445
+ static iter(e, t = 0) {
1446
+ return Le.from(e).goto(t);
1447
+ }
1448
+ static compare(e, t, n, r, i = -1) {
1449
+ let a = e.filter((e) => e.maxPoint > 0 || !e.isEmpty && e.maxPoint >= i), o = t.filter((e) => e.maxPoint > 0 || !e.isEmpty && e.maxPoint >= i), s = Fe(a, o, n), c = new Z(a, s, i), l = new Z(o, s, i);
1450
+ n.iterGaps((e, t, n) => ze(c, e, l, t, n, r)), n.empty && n.length == 0 && ze(c, 0, l, 0, 0, r);
1451
+ }
1452
+ static eq(e, t, n = 0, r) {
1453
+ r ??= 999999999;
1454
+ let i = e.filter((e) => !e.isEmpty && t.indexOf(e) < 0), a = t.filter((t) => !t.isEmpty && e.indexOf(t) < 0);
1455
+ if (i.length != a.length) return !1;
1456
+ if (!i.length) return !0;
1457
+ let o = Fe(i, a), s = new Z(i, o, 0).goto(n), c = new Z(a, o, 0).goto(n);
1458
+ for (;;) {
1459
+ if (s.to != c.to || !Be(s.active, c.active) || s.point && (!c.point || !G(s.point, c.point))) return !1;
1460
+ if (s.to > r) return !0;
1461
+ s.next(), c.next();
1462
+ }
1463
+ }
1464
+ static spans(e, t, n, r, i = -1) {
1465
+ let a = new Z(e, null, i).goto(t), o = t, s = a.openStart;
1466
+ for (;;) {
1467
+ let e = Math.min(a.to, n);
1468
+ if (a.point) {
1469
+ let n = a.activeForPoint(a.to), i = a.pointFrom < t ? n.length + 1 : a.point.startSide < 0 ? n.length : Math.min(n.length, s);
1470
+ r.point(o, e, a.point, n, i, a.pointRank), s = Math.min(a.openEnd(e), n.length);
1471
+ } else e > o && (r.span(o, e, a.active, s), s = a.openEnd(e));
1472
+ if (a.to > n) return s + (a.point && a.to > n ? 1 : 0);
1473
+ o = a.to, a.next();
1474
+ }
1475
+ }
1476
+ static of(e, t = !1) {
1477
+ let n = new X();
1478
+ for (let r of e instanceof K ? [e] : t ? Pe(e) : e) n.add(r.from, r.to, r.value);
1479
+ return n.finish();
1480
+ }
1481
+ static join(t) {
1482
+ if (!t.length) return e.empty;
1483
+ let n = Y(t);
1484
+ for (let r = t.length - 2; r >= 0; r--) for (let i = t[r]; i != e.empty; i = i.nextLayer) n = new e(i.chunkPos, i.chunk, n, Math.max(i.maxPoint, n.maxPoint));
1485
+ return n;
1486
+ }
1487
+ };
1488
+ J.empty = /* @__PURE__ */ new J([], [], null, -1);
1489
+ function Y(e) {
1490
+ return e[e.length - 1];
1491
+ }
1492
+ function Pe(e) {
1493
+ if (e.length > 1) for (let t = e[0], n = 1; n < e.length; n++) {
1494
+ let r = e[n];
1495
+ if (q(t, r) > 0) return e.slice().sort(q);
1496
+ t = r;
1497
+ }
1498
+ return e;
1499
+ }
1500
+ J.empty.nextLayer = J.empty;
1501
+ var X = class e {
1502
+ finishChunk(e) {
1503
+ this.chunks.push(new Ne(this.from, this.to, this.value, this.maxPoint)), this.chunkPos.push(this.chunkStart), this.chunkStart = -1, this.setMaxPoint = Math.max(this.setMaxPoint, this.maxPoint), this.maxPoint = -1, e && (this.from = [], this.to = [], this.value = []);
1504
+ }
1505
+ constructor() {
1506
+ this.chunks = [], this.chunkPos = [], this.chunkStart = -1, this.last = null, this.lastFrom = -1e9, this.lastTo = -1e9, this.from = [], this.to = [], this.value = [], this.maxPoint = -1, this.setMaxPoint = -1, this.nextLayer = null;
1507
+ }
1508
+ add(e, t, n) {
1509
+ this.addRange(e, t, n, !0);
1510
+ }
1511
+ addRange(t, n, r, i) {
1512
+ this.addInner(t, n, r, i) || (this.nextLayer ||= new e()).addRange(t, n, r, i);
1513
+ }
1514
+ addInner(e, t, n, r) {
1515
+ let i = e - this.lastTo || n.startSide - this.last.endSide;
1516
+ if (r && i <= 0 && (e - this.lastFrom || n.startSide - this.last.startSide) < 0) throw Error("Ranges must be added sorted by `from` position and `startSide`");
1517
+ return i < 0 ? !1 : (this.from.length == 250 && this.finishChunk(!0), this.chunkStart < 0 && (this.chunkStart = e), this.from.push(e - this.chunkStart), this.to.push(t - this.chunkStart), this.last = n, this.lastFrom = e, this.lastTo = t, this.value.push(n), n.point && (this.maxPoint = Math.max(this.maxPoint, t - e)), !0);
1518
+ }
1519
+ addChunk(e, t) {
1520
+ if ((e - this.lastTo || t.value[0].startSide - this.last.endSide) < 0) return !1;
1521
+ this.from.length && this.finishChunk(!0), this.setMaxPoint = Math.max(this.setMaxPoint, t.maxPoint), this.chunks.push(t), this.chunkPos.push(e);
1522
+ let n = t.value.length - 1;
1523
+ return this.last = t.value[n], this.lastFrom = t.from[n] + e, this.lastTo = t.to[n] + e, !0;
1524
+ }
1525
+ finish() {
1526
+ return this.finishInner(J.empty);
1527
+ }
1528
+ finishInner(e) {
1529
+ if (this.from.length && this.finishChunk(!1), this.chunks.length == 0) return e;
1530
+ let t = J.create(this.chunkPos, this.chunks, this.nextLayer ? this.nextLayer.finishInner(e) : e, this.setMaxPoint);
1531
+ return this.from = null, t;
1532
+ }
1533
+ };
1534
+ function Fe(e, t, n) {
1535
+ let r = /* @__PURE__ */ new Map();
1536
+ for (let t of e) for (let e = 0; e < t.chunk.length; e++) t.chunk[e].maxPoint <= 0 && r.set(t.chunk[e], t.chunkPos[e]);
1537
+ let i = /* @__PURE__ */ new Set();
1538
+ for (let e of t) for (let t = 0; t < e.chunk.length; t++) {
1539
+ let a = r.get(e.chunk[t]);
1540
+ a != null && (n ? n.mapPos(a) : a) == e.chunkPos[t] && !n?.touchesRange(a, a + e.chunk[t].length) && i.add(e.chunk[t]);
1541
+ }
1542
+ return i;
1543
+ }
1544
+ var Ie = class {
1545
+ constructor(e, t, n, r = 0) {
1546
+ this.layer = e, this.skip = t, this.minPoint = n, this.rank = r;
1547
+ }
1548
+ get startSide() {
1549
+ return this.value ? this.value.startSide : 0;
1550
+ }
1551
+ get endSide() {
1552
+ return this.value ? this.value.endSide : 0;
1553
+ }
1554
+ goto(e, t = -1e9) {
1555
+ return this.chunkIndex = this.rangeIndex = 0, this.gotoInner(e, t, !1), this;
1556
+ }
1557
+ gotoInner(e, t, n) {
1558
+ for (; this.chunkIndex < this.layer.chunk.length;) {
1559
+ let t = this.layer.chunk[this.chunkIndex];
1560
+ if (!(this.skip && this.skip.has(t) || this.layer.chunkEnd(this.chunkIndex) < e || t.maxPoint < this.minPoint)) break;
1561
+ this.chunkIndex++, n = !1;
1562
+ }
1563
+ if (this.chunkIndex < this.layer.chunk.length) {
1564
+ let r = this.layer.chunk[this.chunkIndex].findIndex(e - this.layer.chunkPos[this.chunkIndex], t, !0);
1565
+ (!n || this.rangeIndex < r) && this.setRangeIndex(r);
1566
+ }
1567
+ this.next();
1568
+ }
1569
+ forward(e, t) {
1570
+ (this.to - e || this.endSide - t) < 0 && this.gotoInner(e, t, !0);
1571
+ }
1572
+ next() {
1573
+ for (;;) if (this.chunkIndex == this.layer.chunk.length) {
1574
+ this.from = this.to = 1e9, this.value = null;
1575
+ break;
1576
+ } else {
1577
+ let e = this.layer.chunkPos[this.chunkIndex], t = this.layer.chunk[this.chunkIndex];
1578
+ if (this.from = e + t.from[this.rangeIndex], this.to = e + t.to[this.rangeIndex], this.value = t.value[this.rangeIndex], this.setRangeIndex(this.rangeIndex + 1), this.minPoint < 0 || this.value.point && this.to - this.from >= this.minPoint) break;
1579
+ }
1580
+ }
1581
+ setRangeIndex(e) {
1582
+ if (e == this.layer.chunk[this.chunkIndex].value.length) {
1583
+ if (this.chunkIndex++, this.skip) for (; this.chunkIndex < this.layer.chunk.length && this.skip.has(this.layer.chunk[this.chunkIndex]);) this.chunkIndex++;
1584
+ this.rangeIndex = 0;
1585
+ } else this.rangeIndex = e;
1586
+ }
1587
+ nextChunk() {
1588
+ this.chunkIndex++, this.rangeIndex = 0, this.next();
1589
+ }
1590
+ compare(e) {
1591
+ return this.from - e.from || this.startSide - e.startSide || this.rank - e.rank || this.to - e.to || this.endSide - e.endSide;
1592
+ }
1593
+ }, Le = class e {
1594
+ constructor(e) {
1595
+ this.heap = e;
1596
+ }
1597
+ static from(t, n = null, r = -1) {
1598
+ let i = [];
1599
+ for (let e = 0; e < t.length; e++) for (let a = t[e]; !a.isEmpty; a = a.nextLayer) a.maxPoint >= r && i.push(new Ie(a, n, r, e));
1600
+ return i.length == 1 ? i[0] : new e(i);
1601
+ }
1602
+ get startSide() {
1603
+ return this.value ? this.value.startSide : 0;
1604
+ }
1605
+ goto(e, t = -1e9) {
1606
+ for (let n of this.heap) n.goto(e, t);
1607
+ for (let e = this.heap.length >> 1; e >= 0; e--) Re(this.heap, e);
1608
+ return this.next(), this;
1609
+ }
1610
+ forward(e, t) {
1611
+ for (let n of this.heap) n.forward(e, t);
1612
+ for (let e = this.heap.length >> 1; e >= 0; e--) Re(this.heap, e);
1613
+ (this.to - e || this.value.endSide - t) < 0 && this.next();
1614
+ }
1615
+ next() {
1616
+ if (this.heap.length == 0) this.from = this.to = 1e9, this.value = null, this.rank = -1;
1617
+ else {
1618
+ let e = this.heap[0];
1619
+ this.from = e.from, this.to = e.to, this.value = e.value, this.rank = e.rank, e.value && e.next(), Re(this.heap, 0);
1620
+ }
1621
+ }
1622
+ };
1623
+ function Re(e, t) {
1624
+ for (let n = e[t];;) {
1625
+ let r = (t << 1) + 1;
1626
+ if (r >= e.length) break;
1627
+ let i = e[r];
1628
+ if (r + 1 < e.length && i.compare(e[r + 1]) >= 0 && (i = e[r + 1], r++), n.compare(i) < 0) break;
1629
+ e[r] = n, e[t] = i, t = r;
1630
+ }
1631
+ }
1632
+ var Z = class {
1633
+ constructor(e, t, n) {
1634
+ this.minPoint = n, this.active = [], this.activeTo = [], this.activeRank = [], this.minActive = -1, this.point = null, this.pointFrom = 0, this.pointRank = 0, this.to = -1e9, this.endSide = 0, this.openStart = -1, this.cursor = Le.from(e, t, n);
1635
+ }
1636
+ goto(e, t = -1e9) {
1637
+ return this.cursor.goto(e, t), this.active.length = this.activeTo.length = this.activeRank.length = 0, this.minActive = -1, this.to = e, this.endSide = t, this.openStart = -1, this.next(), this;
1638
+ }
1639
+ forward(e, t) {
1640
+ for (; this.minActive > -1 && (this.activeTo[this.minActive] - e || this.active[this.minActive].endSide - t) < 0;) this.removeActive(this.minActive);
1641
+ this.cursor.forward(e, t);
1642
+ }
1643
+ removeActive(e) {
1644
+ Q(this.active, e), Q(this.activeTo, e), Q(this.activeRank, e), this.minActive = Ve(this.active, this.activeTo);
1645
+ }
1646
+ addActive(e) {
1647
+ let t = 0, { value: n, to: r, rank: i } = this.cursor;
1648
+ for (; t < this.activeRank.length && (i - this.activeRank[t] || r - this.activeTo[t]) > 0;) t++;
1649
+ $(this.active, t, n), $(this.activeTo, t, r), $(this.activeRank, t, i), e && $(e, t, this.cursor.from), this.minActive = Ve(this.active, this.activeTo);
1650
+ }
1651
+ next() {
1652
+ let e = this.to, t = this.point;
1653
+ this.point = null;
1654
+ let n = this.openStart < 0 ? [] : null;
1655
+ for (;;) {
1656
+ let r = this.minActive;
1657
+ if (r > -1 && (this.activeTo[r] - this.cursor.from || this.active[r].endSide - this.cursor.startSide) < 0) {
1658
+ if (this.activeTo[r] > e) {
1659
+ this.to = this.activeTo[r], this.endSide = this.active[r].endSide;
1660
+ break;
1661
+ }
1662
+ this.removeActive(r), n && Q(n, r);
1663
+ } else if (!this.cursor.value) {
1664
+ this.to = this.endSide = 1e9;
1665
+ break;
1666
+ } else if (this.cursor.from > e) {
1667
+ this.to = this.cursor.from, this.endSide = this.cursor.startSide;
1668
+ break;
1669
+ } else {
1670
+ let e = this.cursor.value;
1671
+ if (!e.point) this.addActive(n), this.cursor.next();
1672
+ else if (t && this.cursor.to == this.to && this.cursor.from < this.cursor.to) this.cursor.next();
1673
+ else {
1674
+ this.point = e, this.pointFrom = this.cursor.from, this.pointRank = this.cursor.rank, this.to = this.cursor.to, this.endSide = e.endSide, this.cursor.next(), this.forward(this.to, this.endSide);
1675
+ break;
1676
+ }
1677
+ }
1678
+ }
1679
+ if (n) {
1680
+ this.openStart = 0;
1681
+ for (let t = n.length - 1; t >= 0 && n[t] < e; t--) this.openStart++;
1682
+ }
1683
+ }
1684
+ activeForPoint(e) {
1685
+ if (!this.active.length) return this.active;
1686
+ let t = [];
1687
+ for (let n = this.active.length - 1; n >= 0 && !(this.activeRank[n] < this.pointRank); n--) (this.activeTo[n] > e || this.activeTo[n] == e && this.active[n].endSide >= this.point.endSide) && t.push(this.active[n]);
1688
+ return t.reverse();
1689
+ }
1690
+ openEnd(e) {
1691
+ let t = 0;
1692
+ for (let n = this.activeTo.length - 1; n >= 0 && this.activeTo[n] > e; n--) t++;
1693
+ return t;
1694
+ }
1695
+ };
1696
+ function ze(e, t, n, r, i, a) {
1697
+ e.goto(t), n.goto(r);
1698
+ let o = r + i, s = r, c = r - t, l = !!a.boundChange;
1699
+ for (let t = !1;;) {
1700
+ let r = e.to + c - n.to, i = r || e.endSide - n.endSide, u = i < 0 ? e.to + c : n.to, d = Math.min(u, o);
1701
+ if (e.point || n.point ? (e.point && n.point && G(e.point, n.point) && Be(e.activeForPoint(e.to), n.activeForPoint(n.to)) || a.comparePoint(s, d, e.point, n.point), t = !1) : (t &&= (a.boundChange(s), !1), d > s && !Be(e.active, n.active) && a.compareRange(s, d, e.active, n.active), l && d < o && (r || e.openEnd(u) != n.openEnd(u)) && (t = !0)), u > o) break;
1702
+ s = u, i <= 0 && e.next(), i >= 0 && n.next();
1703
+ }
1704
+ }
1705
+ function Be(e, t) {
1706
+ if (e.length != t.length) return !1;
1707
+ for (let n = 0; n < e.length; n++) if (e[n] != t[n] && !G(e[n], t[n])) return !1;
1708
+ return !0;
1709
+ }
1710
+ function Q(e, t) {
1711
+ for (let n = t, r = e.length - 1; n < r; n++) e[n] = e[n + 1];
1712
+ e.pop();
1713
+ }
1714
+ function $(e, t, n) {
1715
+ for (let n = e.length - 1; n >= t; n--) e[n + 1] = e[n];
1716
+ e[t] = n;
1717
+ }
1718
+ function Ve(e, t) {
1719
+ let n = -1, r = 1e9;
1720
+ for (let i = 0; i < t.length; i++) (t[i] - r || e[i].endSide - e[n].endSide) < 0 && (n = i, r = t[i]);
1721
+ return n;
1722
+ }
1723
+ function He(e, t, n = e.length) {
1724
+ let r = 0;
1725
+ for (let i = 0; i < n && i < e.length;) e.charCodeAt(i) == 9 ? (r += t - r % t, i++) : (r++, i = f(e, i));
1726
+ return r;
1727
+ }
1728
+ function Ue(e, t, n, r) {
1729
+ for (let r = 0, i = 0;;) {
1730
+ if (i >= t) return r;
1731
+ if (r == e.length) break;
1732
+ i += e.charCodeAt(r) == 9 ? n - i % n : 1, r = f(e, r);
1733
+ }
1734
+ return r === !0 ? -1 : e.length;
1735
+ }
1736
+ //#endregion
1737
+ export { L as Annotation, _ as ChangeDesc, v as ChangeSet, V as CharCategory, de as Compartment, T as EditorSelection, U as EditorState, E as Facet, g as MapMode, le as Prec, J as RangeSet, X as RangeSetBuilder, W as RangeValue, R as StateEffect, A as StateField, t as Text, z as Transaction, h as codePointAt, te as codePointSize, Me as combineConfig, He as countColumn, f as findClusterBreak, Ue as findColumn, ee as fromCodePoint };
1738
+
1739
+ //# sourceMappingURL=index.js.map