@arach/arc 0.4.5 → 0.6.0

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.
@@ -0,0 +1,1006 @@
1
+ import { StateField as tt, Facet as ke, Annotation as Ae, EditorSelection as h, countColumn as ee, Text as Be, findClusterBreak as T, Transaction as K, CharCategory as D, combineConfig as nt, StateEffect as Se, ChangeSet as rt, ChangeDesc as ot } from "./index-CI-w1U9t.js";
2
+ import { E as O, D as lt } from "./index-CnGsbmkP.js";
3
+ import { IndentContext as Ce, getIndentation as De, indentString as G, syntaxTree as te, matchBrackets as E, getIndentUnit as Q, indentUnit as ct } from "./index-DBTOQDAV.js";
4
+ import { N as X } from "./index-CvsZLy9v.js";
5
+ const st = (e) => {
6
+ let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = ne(e.state, n.from);
7
+ return r.line ? it(e) : r.block ? ft(e) : !1;
8
+ };
9
+ function L(e, t) {
10
+ return ({ state: n, dispatch: r }) => {
11
+ if (n.readOnly)
12
+ return !1;
13
+ let l = e(t, n);
14
+ return l ? (r(n.update(l)), !0) : !1;
15
+ };
16
+ }
17
+ const it = /* @__PURE__ */ L(
18
+ re,
19
+ 0
20
+ /* CommentOption.Toggle */
21
+ ), An = /* @__PURE__ */ L(
22
+ re,
23
+ 1
24
+ /* CommentOption.Comment */
25
+ ), Bn = /* @__PURE__ */ L(
26
+ re,
27
+ 2
28
+ /* CommentOption.Uncomment */
29
+ ), ut = /* @__PURE__ */ L(
30
+ V,
31
+ 0
32
+ /* CommentOption.Toggle */
33
+ ), Sn = /* @__PURE__ */ L(
34
+ V,
35
+ 1
36
+ /* CommentOption.Comment */
37
+ ), Cn = /* @__PURE__ */ L(
38
+ V,
39
+ 2
40
+ /* CommentOption.Uncomment */
41
+ ), ft = /* @__PURE__ */ L(
42
+ (e, t) => V(e, t, ht(t)),
43
+ 0
44
+ /* CommentOption.Toggle */
45
+ );
46
+ function ne(e, t) {
47
+ let n = e.languageDataAt("commentTokens", t, 1);
48
+ return n.length ? n[0] : {};
49
+ }
50
+ const v = 50;
51
+ function at(e, { open: t, close: n }, r, l) {
52
+ let o = e.sliceDoc(r - v, r), c = e.sliceDoc(l, l + v), s = /\s*$/.exec(o)[0].length, i = /^\s*/.exec(c)[0].length, f = o.length - s;
53
+ if (o.slice(f - t.length, f) == t && c.slice(i, i + n.length) == n)
54
+ return {
55
+ open: { pos: r - s, margin: s && 1 },
56
+ close: { pos: l + i, margin: i && 1 }
57
+ };
58
+ let u, a;
59
+ l - r <= 2 * v ? u = a = e.sliceDoc(r, l) : (u = e.sliceDoc(r, r + v), a = e.sliceDoc(l - v, l));
60
+ let d = /^\s*/.exec(u)[0].length, B = /\s*$/.exec(a)[0].length, k = a.length - B - n.length;
61
+ return u.slice(d, d + t.length) == t && a.slice(k, k + n.length) == n ? {
62
+ open: {
63
+ pos: r + d + t.length,
64
+ margin: /\s/.test(u.charAt(d + t.length)) ? 1 : 0
65
+ },
66
+ close: {
67
+ pos: l - B - n.length,
68
+ margin: /\s/.test(a.charAt(k - 1)) ? 1 : 0
69
+ }
70
+ } : null;
71
+ }
72
+ function ht(e) {
73
+ let t = [];
74
+ for (let n of e.selection.ranges) {
75
+ let r = e.doc.lineAt(n.from), l = n.to <= r.to ? r : e.doc.lineAt(n.to);
76
+ l.from > r.from && l.from == n.to && (l = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
77
+ let o = t.length - 1;
78
+ o >= 0 && t[o].to > r.from ? t[o].to = l.to : t.push({ from: r.from + /^\s*/.exec(r.text)[0].length, to: l.to });
79
+ }
80
+ return t;
81
+ }
82
+ function V(e, t, n = t.selection.ranges) {
83
+ let r = n.map((o) => ne(t, o.from).block);
84
+ if (!r.every((o) => o))
85
+ return null;
86
+ let l = n.map((o, c) => at(t, r[c], o.from, o.to));
87
+ if (e != 2 && !l.every((o) => o))
88
+ return { changes: t.changes(n.map((o, c) => l[c] ? [] : [{ from: o.from, insert: r[c].open + " " }, { from: o.to, insert: " " + r[c].close }])) };
89
+ if (e != 1 && l.some((o) => o)) {
90
+ let o = [];
91
+ for (let c = 0, s; c < l.length; c++)
92
+ if (s = l[c]) {
93
+ let i = r[c], { open: f, close: u } = s;
94
+ o.push({ from: f.pos - i.open.length, to: f.pos + f.margin }, { from: u.pos - u.margin, to: u.pos + i.close.length });
95
+ }
96
+ return { changes: o };
97
+ }
98
+ return null;
99
+ }
100
+ function re(e, t, n = t.selection.ranges) {
101
+ let r = [], l = -1;
102
+ e: for (let { from: o, to: c } of n) {
103
+ let s = r.length, i = 1e9, f;
104
+ for (let u = o; u <= c; ) {
105
+ let a = t.doc.lineAt(u);
106
+ if (f == null && (f = ne(t, a.from).line, !f))
107
+ continue e;
108
+ if (a.from > l && (o == c || c > a.from)) {
109
+ l = a.from;
110
+ let d = /^\s*/.exec(a.text)[0].length, B = d == a.length, k = a.text.slice(d, d + f.length) == f ? d : -1;
111
+ d < a.text.length && d < i && (i = d), r.push({ line: a, comment: k, token: f, indent: d, empty: B, single: !1 });
112
+ }
113
+ u = a.to + 1;
114
+ }
115
+ if (i < 1e9)
116
+ for (let u = s; u < r.length; u++)
117
+ r[u].indent < r[u].line.text.length && (r[u].indent = i);
118
+ r.length == s + 1 && (r[s].single = !0);
119
+ }
120
+ if (e != 2 && r.some((o) => o.comment < 0 && (!o.empty || o.single))) {
121
+ let o = [];
122
+ for (let { line: s, token: i, indent: f, empty: u, single: a } of r)
123
+ (a || !u) && o.push({ from: s.from + f, insert: i + " " });
124
+ let c = t.changes(o);
125
+ return { changes: c, selection: t.selection.map(c, 1) };
126
+ } else if (e != 1 && r.some((o) => o.comment >= 0)) {
127
+ let o = [];
128
+ for (let { line: c, comment: s, token: i } of r)
129
+ if (s >= 0) {
130
+ let f = c.from + s, u = f + i.length;
131
+ c.text[u - c.from] == " " && u++, o.push({ from: f, to: u });
132
+ }
133
+ return { changes: o };
134
+ }
135
+ return null;
136
+ }
137
+ const Y = /* @__PURE__ */ Ae.define(), dt = /* @__PURE__ */ Ae.define(), mt = /* @__PURE__ */ ke.define(), xe = /* @__PURE__ */ ke.define({
138
+ combine(e) {
139
+ return nt(e, {
140
+ minDepth: 100,
141
+ newGroupDelay: 500,
142
+ joinToEvent: (t, n) => n
143
+ }, {
144
+ minDepth: Math.max,
145
+ newGroupDelay: Math.min,
146
+ joinToEvent: (t, n) => (r, l) => t(r, l) || n(r, l)
147
+ });
148
+ }
149
+ }), N = /* @__PURE__ */ tt.define({
150
+ create() {
151
+ return C.empty;
152
+ },
153
+ update(e, t) {
154
+ let n = t.state.facet(xe), r = t.annotation(Y);
155
+ if (r) {
156
+ let i = g.fromTransaction(t, r.selection), f = r.side, u = f == 0 ? e.undone : e.done;
157
+ return i ? u = U(u, u.length, n.minDepth, i) : u = Ee(u, t.startState.selection), new C(f == 0 ? r.rest : u, f == 0 ? u : r.rest);
158
+ }
159
+ let l = t.annotation(dt);
160
+ if ((l == "full" || l == "before") && (e = e.isolate()), t.annotation(K.addToHistory) === !1)
161
+ return t.changes.empty ? e : e.addMapping(t.changes.desc);
162
+ let o = g.fromTransaction(t), c = t.annotation(K.time), s = t.annotation(K.userEvent);
163
+ return o ? e = e.addChanges(o, c, s, n, t) : t.selection && (e = e.addSelection(t.startState.selection, c, s, n.newGroupDelay)), (l == "full" || l == "after") && (e = e.isolate()), e;
164
+ },
165
+ toJSON(e) {
166
+ return { done: e.done.map((t) => t.toJSON()), undone: e.undone.map((t) => t.toJSON()) };
167
+ },
168
+ fromJSON(e) {
169
+ return new C(e.done.map(g.fromJSON), e.undone.map(g.fromJSON));
170
+ }
171
+ });
172
+ function Dn(e = {}) {
173
+ return [
174
+ N,
175
+ xe.of(e),
176
+ O.domEventHandlers({
177
+ beforeinput(t, n) {
178
+ let r = t.inputType == "historyUndo" ? Le : t.inputType == "historyRedo" ? Z : null;
179
+ return r ? (t.preventDefault(), r(n)) : !1;
180
+ }
181
+ })
182
+ ];
183
+ }
184
+ const xn = N;
185
+ function P(e, t) {
186
+ return function({ state: n, dispatch: r }) {
187
+ if (!t && n.readOnly)
188
+ return !1;
189
+ let l = n.field(N, !1);
190
+ if (!l)
191
+ return !1;
192
+ let o = l.pop(e, n, t);
193
+ return o ? (r(o), !0) : !1;
194
+ };
195
+ }
196
+ const Le = /* @__PURE__ */ P(0, !1), Z = /* @__PURE__ */ P(1, !1), pt = /* @__PURE__ */ P(0, !0), gt = /* @__PURE__ */ P(1, !0);
197
+ function Me(e) {
198
+ return function(t) {
199
+ let n = t.field(N, !1);
200
+ if (!n)
201
+ return 0;
202
+ let r = e == 0 ? n.done : n.undone;
203
+ return r.length - (r.length && !r[0].changes ? 1 : 0);
204
+ };
205
+ }
206
+ const Ln = /* @__PURE__ */ Me(
207
+ 0
208
+ /* BranchName.Done */
209
+ ), Mn = /* @__PURE__ */ Me(
210
+ 1
211
+ /* BranchName.Undone */
212
+ );
213
+ class g {
214
+ constructor(t, n, r, l, o) {
215
+ this.changes = t, this.effects = n, this.mapped = r, this.startSelection = l, this.selectionsAfter = o;
216
+ }
217
+ setSelAfter(t) {
218
+ return new g(this.changes, this.effects, this.mapped, this.startSelection, t);
219
+ }
220
+ toJSON() {
221
+ var t, n, r;
222
+ return {
223
+ changes: (t = this.changes) === null || t === void 0 ? void 0 : t.toJSON(),
224
+ mapped: (n = this.mapped) === null || n === void 0 ? void 0 : n.toJSON(),
225
+ startSelection: (r = this.startSelection) === null || r === void 0 ? void 0 : r.toJSON(),
226
+ selectionsAfter: this.selectionsAfter.map((l) => l.toJSON())
227
+ };
228
+ }
229
+ static fromJSON(t) {
230
+ return new g(t.changes && rt.fromJSON(t.changes), [], t.mapped && ot.fromJSON(t.mapped), t.startSelection && h.fromJSON(t.startSelection), t.selectionsAfter.map(h.fromJSON));
231
+ }
232
+ // This does not check `addToHistory` and such, it assumes the
233
+ // transaction needs to be converted to an item. Returns null when
234
+ // there are no changes or effects in the transaction.
235
+ static fromTransaction(t, n) {
236
+ let r = A;
237
+ for (let l of t.startState.facet(mt)) {
238
+ let o = l(t);
239
+ o.length && (r = r.concat(o));
240
+ }
241
+ return !r.length && t.changes.empty ? null : new g(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, A);
242
+ }
243
+ static selection(t) {
244
+ return new g(void 0, A, void 0, void 0, t);
245
+ }
246
+ }
247
+ function U(e, t, n, r) {
248
+ let l = t + 1 > n + 20 ? t - n - 1 : 0, o = e.slice(l, t);
249
+ return o.push(r), o;
250
+ }
251
+ function yt(e, t) {
252
+ let n = [], r = !1;
253
+ return e.iterChangedRanges((l, o) => n.push(l, o)), t.iterChangedRanges((l, o, c, s) => {
254
+ for (let i = 0; i < n.length; ) {
255
+ let f = n[i++], u = n[i++];
256
+ s >= f && c <= u && (r = !0);
257
+ }
258
+ }), r;
259
+ }
260
+ function kt(e, t) {
261
+ return e.ranges.length == t.ranges.length && e.ranges.filter((n, r) => n.empty != t.ranges[r].empty).length === 0;
262
+ }
263
+ function be(e, t) {
264
+ return e.length ? t.length ? e.concat(t) : e : t;
265
+ }
266
+ const A = [], At = 200;
267
+ function Ee(e, t) {
268
+ if (e.length) {
269
+ let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - At));
270
+ return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), U(e, e.length - 1, 1e9, n.setSelAfter(r)));
271
+ } else
272
+ return [g.selection([t])];
273
+ }
274
+ function Bt(e) {
275
+ let t = e[e.length - 1], n = e.slice();
276
+ return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
277
+ }
278
+ function $(e, t) {
279
+ if (!e.length)
280
+ return e;
281
+ let n = e.length, r = A;
282
+ for (; n; ) {
283
+ let l = St(e[n - 1], t, r);
284
+ if (l.changes && !l.changes.empty || l.effects.length) {
285
+ let o = e.slice(0, n);
286
+ return o[n - 1] = l, o;
287
+ } else
288
+ t = l.mapped, n--, r = l.selectionsAfter;
289
+ }
290
+ return r.length ? [g.selection(r)] : A;
291
+ }
292
+ function St(e, t, n) {
293
+ let r = be(e.selectionsAfter.length ? e.selectionsAfter.map((s) => s.map(t)) : A, n);
294
+ if (!e.changes)
295
+ return g.selection(r);
296
+ let l = e.changes.map(t), o = t.mapDesc(e.changes, !0), c = e.mapped ? e.mapped.composeDesc(o) : o;
297
+ return new g(l, Se.mapEffects(e.effects, t), c, e.startSelection.map(o), r);
298
+ }
299
+ const Ct = /^(input\.type|delete)($|\.)/;
300
+ class C {
301
+ constructor(t, n, r = 0, l = void 0) {
302
+ this.done = t, this.undone = n, this.prevTime = r, this.prevUserEvent = l;
303
+ }
304
+ isolate() {
305
+ return this.prevTime ? new C(this.done, this.undone) : this;
306
+ }
307
+ addChanges(t, n, r, l, o) {
308
+ let c = this.done, s = c[c.length - 1];
309
+ return s && s.changes && !s.changes.empty && t.changes && (!r || Ct.test(r)) && (!s.selectionsAfter.length && n - this.prevTime < l.newGroupDelay && l.joinToEvent(o, yt(s.changes, t.changes)) || // For compose (but not compose.start) events, always join with previous event
310
+ r == "input.type.compose") ? c = U(c, c.length - 1, l.minDepth, new g(t.changes.compose(s.changes), be(Se.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, A)) : c = U(c, c.length, l.minDepth, t), new C(c, A, n, r);
311
+ }
312
+ addSelection(t, n, r, l) {
313
+ let o = this.done.length ? this.done[this.done.length - 1].selectionsAfter : A;
314
+ return o.length > 0 && n - this.prevTime < l && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && kt(o[o.length - 1], t) ? this : new C(Ee(this.done, t), this.undone, n, r);
315
+ }
316
+ addMapping(t) {
317
+ return new C($(this.done, t), $(this.undone, t), this.prevTime, this.prevUserEvent);
318
+ }
319
+ pop(t, n, r) {
320
+ let l = t == 0 ? this.done : this.undone;
321
+ if (l.length == 0)
322
+ return null;
323
+ let o = l[l.length - 1], c = o.selectionsAfter[0] || (o.startSelection ? o.startSelection.map(o.changes.invertedDesc, 1) : n.selection);
324
+ if (r && o.selectionsAfter.length)
325
+ return n.update({
326
+ selection: o.selectionsAfter[o.selectionsAfter.length - 1],
327
+ annotations: Y.of({ side: t, rest: Bt(l), selection: c }),
328
+ userEvent: t == 0 ? "select.undo" : "select.redo",
329
+ scrollIntoView: !0
330
+ });
331
+ if (o.changes) {
332
+ let s = l.length == 1 ? A : l.slice(0, l.length - 1);
333
+ return o.mapped && (s = $(s, o.mapped)), n.update({
334
+ changes: o.changes,
335
+ selection: o.startSelection,
336
+ effects: o.effects,
337
+ annotations: Y.of({ side: t, rest: s, selection: c }),
338
+ filter: !1,
339
+ userEvent: t == 0 ? "undo" : "redo",
340
+ scrollIntoView: !0
341
+ });
342
+ } else
343
+ return null;
344
+ }
345
+ }
346
+ C.empty = /* @__PURE__ */ new C(A, A);
347
+ const bn = [
348
+ { key: "Mod-z", run: Le, preventDefault: !0 },
349
+ { key: "Mod-y", mac: "Mod-Shift-z", run: Z, preventDefault: !0 },
350
+ { linux: "Ctrl-Shift-z", run: Z, preventDefault: !0 },
351
+ { key: "Mod-u", run: pt, preventDefault: !0 },
352
+ { key: "Alt-u", mac: "Mod-Shift-u", run: gt, preventDefault: !0 }
353
+ ];
354
+ function I(e, t) {
355
+ return h.create(e.ranges.map(t), e.mainIndex);
356
+ }
357
+ function S(e, t) {
358
+ return e.update({ selection: t, scrollIntoView: !0, userEvent: "select" });
359
+ }
360
+ function y({ state: e, dispatch: t }, n) {
361
+ let r = I(e.selection, n);
362
+ return r.eq(e.selection, !0) ? !1 : (t(S(e, r)), !0);
363
+ }
364
+ function M(e, t) {
365
+ return h.cursor(t ? e.to : e.from);
366
+ }
367
+ function J(e, t) {
368
+ return y(e, (n) => n.empty ? e.moveByChar(n, t) : M(n, t));
369
+ }
370
+ function m(e) {
371
+ return e.textDirectionAt(e.state.selection.main.head) == lt.LTR;
372
+ }
373
+ const Te = (e) => J(e, !m(e)), Oe = (e) => J(e, m(e)), En = (e) => J(e, !0), Tn = (e) => J(e, !1);
374
+ function oe(e, t, n) {
375
+ let r = t.head, l = e.doc.lineAt(r);
376
+ return r == (n ? l.to : l.from) ? r = n ? Math.min(e.doc.length, l.to + 1) : Math.max(0, l.from - 1) : r = l.from + T(l.text, r - l.from, n), h.cursor(r, n ? -1 : 1);
377
+ }
378
+ function Ie(e, t) {
379
+ return y(e, (n) => n.empty ? oe(e.state, n, t) : M(n, t));
380
+ }
381
+ const On = (e) => Ie(e, !0), In = (e) => Ie(e, !1);
382
+ function w(e, t) {
383
+ return y(e, (n) => n.empty ? e.moveByGroup(n, t) : M(n, t));
384
+ }
385
+ const Dt = (e) => w(e, !m(e)), xt = (e) => w(e, m(e)), vn = (e) => w(e, !0), Rn = (e) => w(e, !1);
386
+ function le(e, t, n) {
387
+ let r = e.state.charCategorizer(t), l = r(n), o = l != D.Space;
388
+ return (c) => {
389
+ let s = r(c);
390
+ return s != D.Space ? o && s == l : (o = !1, !0);
391
+ };
392
+ }
393
+ const Fn = (e) => y(e, (t) => t.empty ? e.moveByChar(t, !0, (n) => le(e, t.head, n)) : M(t, !0)), ue = typeof Intl < "u" && Intl.Segmenter ? /* @__PURE__ */ new Intl.Segmenter(void 0, { granularity: "word" }) : null;
394
+ function ve(e, t, n) {
395
+ let r = e.state.charCategorizer(t.from), l = D.Space, o = t.from, c = 0, s = !1, i = !1, f = !1, u = (d) => {
396
+ if (s)
397
+ return !1;
398
+ o += n ? d.length : -d.length;
399
+ let B = r(d), k;
400
+ if (B == D.Word && d.charCodeAt(0) < 128 && /[\W_]/.test(d) && (B = -1), l == D.Space && (l = B), l != B)
401
+ return !1;
402
+ if (l == D.Word)
403
+ if (d.toLowerCase() == d) {
404
+ if (!n && i)
405
+ return !1;
406
+ f = !0;
407
+ } else if (f) {
408
+ if (n)
409
+ return !1;
410
+ s = !0;
411
+ } else {
412
+ if (i && n && r(k = e.state.sliceDoc(o, o + 1)) == D.Word && k.toLowerCase() == k)
413
+ return !1;
414
+ i = !0;
415
+ }
416
+ return c++, !0;
417
+ }, a = e.moveByChar(t, n, (d) => (u(d), u));
418
+ if (ue && l == D.Word && a.from == t.from + c * (n ? 1 : -1)) {
419
+ let d = Math.min(t.head, a.head), B = Math.max(t.head, a.head), k = e.state.sliceDoc(d, B);
420
+ if (k.length > 1 && /[\u4E00-\uffff]/.test(k)) {
421
+ let R = Array.from(ue.segment(k));
422
+ if (R.length > 1)
423
+ return n ? h.cursor(t.head + R[1].index, -1) : h.cursor(a.head + R[R.length - 1].index, 1);
424
+ }
425
+ }
426
+ return a;
427
+ }
428
+ function Re(e, t) {
429
+ return y(e, (n) => n.empty ? ve(e, n, t) : M(n, t));
430
+ }
431
+ const Gn = (e) => Re(e, !0), Un = (e) => Re(e, !1);
432
+ function Lt(e, t, n) {
433
+ if (t.type.prop(n))
434
+ return !0;
435
+ let r = t.to - t.from;
436
+ return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
437
+ }
438
+ function z(e, t, n) {
439
+ let r = te(e).resolveInner(t.head), l = n ? X.closedBy : X.openedBy;
440
+ for (let i = t.head; ; ) {
441
+ let f = n ? r.childAfter(i) : r.childBefore(i);
442
+ if (!f)
443
+ break;
444
+ Lt(e, f, l) ? r = f : i = n ? f.to : f.from;
445
+ }
446
+ let o = r.type.prop(l), c, s;
447
+ return o && (c = n ? E(e, r.from, 1) : E(e, r.to, -1)) && c.matched ? s = n ? c.end.to : c.end.from : s = n ? r.to : r.from, h.cursor(s, n ? -1 : 1);
448
+ }
449
+ const Mt = (e) => y(e, (t) => z(e.state, t, !m(e))), bt = (e) => y(e, (t) => z(e.state, t, m(e)));
450
+ function Fe(e, t) {
451
+ return y(e, (n) => {
452
+ if (!n.empty)
453
+ return M(n, t);
454
+ let r = e.moveVertically(n, t);
455
+ return r.head != n.head ? r : e.moveToLineBoundary(n, t);
456
+ });
457
+ }
458
+ const Ge = (e) => Fe(e, !1), Ue = (e) => Fe(e, !0);
459
+ function Ve(e) {
460
+ let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, n = 0, r = 0, l;
461
+ if (t) {
462
+ for (let o of e.state.facet(O.scrollMargins)) {
463
+ let c = o(e);
464
+ c?.top && (n = Math.max(c?.top, n)), c?.bottom && (r = Math.max(c?.bottom, r));
465
+ }
466
+ l = e.scrollDOM.clientHeight - n - r;
467
+ } else
468
+ l = (e.dom.ownerDocument.defaultView || window).innerHeight;
469
+ return {
470
+ marginTop: n,
471
+ marginBottom: r,
472
+ selfScroll: t,
473
+ height: Math.max(e.defaultLineHeight, l - 5)
474
+ };
475
+ }
476
+ function Ne(e, t) {
477
+ let n = Ve(e), { state: r } = e, l = I(r.selection, (c) => c.empty ? e.moveVertically(c, t, n.height) : M(c, t));
478
+ if (l.eq(r.selection))
479
+ return !1;
480
+ let o;
481
+ if (n.selfScroll) {
482
+ let c = e.coordsAtPos(r.selection.main.head), s = e.scrollDOM.getBoundingClientRect(), i = s.top + n.marginTop, f = s.bottom - n.marginBottom;
483
+ c && c.top > i && c.bottom < f && (o = O.scrollIntoView(l.main.head, { y: "start", yMargin: c.top - i }));
484
+ }
485
+ return e.dispatch(S(r, l), { effects: o }), !0;
486
+ }
487
+ const fe = (e) => Ne(e, !1), _ = (e) => Ne(e, !0);
488
+ function x(e, t, n) {
489
+ let r = e.lineBlockAt(t.head), l = e.moveToLineBoundary(t, n);
490
+ if (l.head == t.head && l.head != (n ? r.to : r.from) && (l = e.moveToLineBoundary(t, n, !1)), !n && l.head == r.from && r.length) {
491
+ let o = /^\s*/.exec(e.state.sliceDoc(r.from, Math.min(r.from + 100, r.to)))[0].length;
492
+ o && t.head != r.from + o && (l = h.cursor(r.from + o));
493
+ }
494
+ return l;
495
+ }
496
+ const Et = (e) => y(e, (t) => x(e, t, !0)), Tt = (e) => y(e, (t) => x(e, t, !1)), Ot = (e) => y(e, (t) => x(e, t, !m(e))), It = (e) => y(e, (t) => x(e, t, m(e))), vt = (e) => y(e, (t) => h.cursor(e.lineBlockAt(t.head).from, 1)), Rt = (e) => y(e, (t) => h.cursor(e.lineBlockAt(t.head).to, -1));
497
+ function Pe(e, t, n) {
498
+ let r = !1, l = I(e.selection, (o) => {
499
+ let c = E(e, o.head, -1) || E(e, o.head, 1) || o.head > 0 && E(e, o.head - 1, 1) || o.head < e.doc.length && E(e, o.head + 1, -1);
500
+ if (!c || !c.end)
501
+ return o;
502
+ r = !0;
503
+ let s = c.start.from == o.head ? c.end.to : c.end.from;
504
+ return n ? h.range(o.anchor, s) : h.cursor(s);
505
+ });
506
+ return r ? (t(S(e, l)), !0) : !1;
507
+ }
508
+ const Ft = ({ state: e, dispatch: t }) => Pe(e, t, !1), Vn = ({ state: e, dispatch: t }) => Pe(e, t, !0);
509
+ function p(e, t, n) {
510
+ let r = I(e.state.selection, (l) => {
511
+ l.undirectional && l.head >= l.anchor != t && (l = h.range(l.head, l.anchor));
512
+ let o = n(l);
513
+ return h.range(l.anchor, o.head, o.goalColumn, o.bidiLevel || void 0, o.assoc);
514
+ });
515
+ return r.eq(e.state.selection) ? !1 : (e.dispatch(S(e.state, r)), !0);
516
+ }
517
+ function W(e, t) {
518
+ return p(e, t, (n) => e.moveByChar(n, t));
519
+ }
520
+ const Je = (e) => W(e, !m(e)), we = (e) => W(e, m(e)), Nn = (e) => W(e, !0), Pn = (e) => W(e, !1), Jn = (e) => p(e, !0, (t) => oe(e.state, t, !0)), wn = (e) => p(e, !1, (t) => oe(e.state, t, !1));
521
+ function H(e, t) {
522
+ return p(e, t, (n) => e.moveByGroup(n, t));
523
+ }
524
+ const Gt = (e) => H(e, !m(e)), Ut = (e) => H(e, m(e)), zn = (e) => H(e, !0), Wn = (e) => H(e, !1), Hn = (e) => p(e, !0, (t) => e.moveByChar(t, !0, (n) => le(e, t.head, n)));
525
+ function ze(e, t) {
526
+ return p(e, t, (n) => ve(e, n, t));
527
+ }
528
+ const qn = (e) => ze(e, !0), Kn = (e) => ze(e, !1), Vt = (e) => {
529
+ let t = !m(e);
530
+ return p(e, t, (n) => z(e.state, n, t));
531
+ }, Nt = (e) => {
532
+ let t = m(e);
533
+ return p(e, t, (n) => z(e.state, n, t));
534
+ };
535
+ function We(e, t) {
536
+ return p(e, t, (n) => e.moveVertically(n, t));
537
+ }
538
+ const He = (e) => We(e, !1), qe = (e) => We(e, !0);
539
+ function Ke(e, t) {
540
+ return p(e, t, (n) => e.moveVertically(n, t, Ve(e).height));
541
+ }
542
+ const ae = (e) => Ke(e, !1), he = (e) => Ke(e, !0), Pt = (e) => p(e, !0, (t) => x(e, t, !0)), Jt = (e) => p(e, !1, (t) => x(e, t, !1)), wt = (e) => {
543
+ let t = !m(e);
544
+ return p(e, t, (n) => x(e, n, t));
545
+ }, zt = (e) => {
546
+ let t = m(e);
547
+ return p(e, t, (n) => x(e, n, t));
548
+ }, Wt = (e) => p(e, !1, (t) => h.cursor(e.lineBlockAt(t.head).from)), Ht = (e) => p(e, !0, (t) => h.cursor(e.lineBlockAt(t.head).to)), de = ({ state: e, dispatch: t }) => (t(S(e, { anchor: 0 })), !0), me = ({ state: e, dispatch: t }) => (t(S(e, { anchor: e.doc.length })), !0), pe = ({ state: e, dispatch: t }) => (t(S(e, { anchor: e.selection.main.anchor, head: 0 })), !0), ge = ({ state: e, dispatch: t }) => (t(S(e, { anchor: e.selection.main.anchor, head: e.doc.length })), !0), qt = ({ state: e, dispatch: t }) => (t(e.update({ selection: { anchor: 0, head: e.doc.length }, userEvent: "select" })), !0), Kt = ({ state: e, dispatch: t }) => {
549
+ let n = q(e).map(({ from: r, to: l }) => h.range(r, Math.min(l + 1, e.doc.length)));
550
+ return t(e.update({ selection: h.create(n), userEvent: "select" })), !0;
551
+ }, $t = ({ state: e, dispatch: t }) => {
552
+ let n = I(e.selection, (r) => {
553
+ let l = te(e), o = l.resolveStack(r.from, 1);
554
+ if (r.empty) {
555
+ let c = l.resolveStack(r.from, -1);
556
+ c.node.from >= o.node.from && c.node.to <= o.node.to && (o = c);
557
+ }
558
+ for (let c = o; c; c = c.next) {
559
+ let { node: s } = c;
560
+ if ((s.from < r.from && s.to >= r.to || s.to > r.to && s.from <= r.from) && c.next)
561
+ return h.range(s.to, s.from);
562
+ }
563
+ return r;
564
+ });
565
+ return n.eq(e.selection) ? !1 : (t(S(e, n)), !0);
566
+ };
567
+ function $e(e, t) {
568
+ let { state: n } = e, r = n.selection, l = n.selection.ranges.slice();
569
+ for (let o of n.selection.ranges) {
570
+ let c = n.doc.lineAt(o.head);
571
+ if (t ? c.to < e.state.doc.length : c.from > 0)
572
+ for (let s = o; ; ) {
573
+ let i = e.moveVertically(s, t);
574
+ if (i.head < c.from || i.head > c.to) {
575
+ l.some((f) => f.head == i.head) || l.push(i);
576
+ break;
577
+ } else {
578
+ if (i.head == s.head)
579
+ break;
580
+ s = i;
581
+ }
582
+ }
583
+ }
584
+ return l.length == r.ranges.length ? !1 : (e.dispatch(S(n, h.create(l, l.length - 1))), !0);
585
+ }
586
+ const Qt = (e) => $e(e, !1), Xt = (e) => $e(e, !0), Yt = ({ state: e, dispatch: t }) => {
587
+ let n = e.selection, r = null;
588
+ return n.ranges.length > 1 ? r = h.create([n.main]) : n.main.empty || (r = h.create([h.cursor(n.main.head)])), r ? (t(S(e, r)), !0) : !1;
589
+ };
590
+ function b(e, t) {
591
+ if (e.state.readOnly)
592
+ return !1;
593
+ let n = "delete.selection", { state: r } = e, l = r.changeByRange((o) => {
594
+ let { from: c, to: s } = o;
595
+ if (c == s) {
596
+ let i = t(o);
597
+ i < c ? (n = "delete.backward", i = F(e, i, !1)) : i > c && (n = "delete.forward", i = F(e, i, !0)), c = Math.min(c, i), s = Math.max(s, i);
598
+ } else
599
+ c = F(e, c, !1), s = F(e, s, !0);
600
+ return c == s ? { range: o } : { changes: { from: c, to: s }, range: h.cursor(c, c < o.head ? -1 : 1) };
601
+ });
602
+ return l.changes.empty ? !1 : (e.dispatch(r.update(l, {
603
+ scrollIntoView: !0,
604
+ userEvent: n,
605
+ effects: n == "delete.selection" ? O.announce.of(r.phrase("Selection deleted")) : void 0
606
+ })), !0);
607
+ }
608
+ function F(e, t, n) {
609
+ if (e instanceof O)
610
+ for (let r of e.state.facet(O.atomicRanges).map((l) => l(e)))
611
+ r.between(t, t, (l, o) => {
612
+ l < t && o > t && (t = n ? o : l);
613
+ });
614
+ return t;
615
+ }
616
+ const ce = (e, t, n) => b(e, (r) => {
617
+ let l = r.from, { state: o } = e, c = o.doc.lineAt(l), s, i;
618
+ if (n && !t && l > c.from && l < c.from + 200 && !/[^ \t]/.test(s = c.text.slice(0, l - c.from))) {
619
+ if (s[s.length - 1] == " ")
620
+ return l - 1;
621
+ let f = ee(s, o.tabSize), u = f % Q(o) || Q(o);
622
+ for (let a = 0; a < u && s[s.length - 1 - a] == " "; a++)
623
+ l--;
624
+ i = l;
625
+ } else
626
+ i = T(c.text, l - c.from, t, t) + c.from, i == l && c.number != (t ? o.doc.lines : 1) ? i += t ? 1 : -1 : !t && /[\ufe00-\ufe0f]/.test(c.text.slice(i - c.from, l - c.from)) && (i = T(c.text, i - c.from, !1, !1) + c.from);
627
+ return i;
628
+ }), j = (e) => ce(e, !1, !0), $n = (e) => ce(e, !1, !1), Qe = (e) => ce(e, !0, !1), Xe = (e, t) => b(e, (n) => {
629
+ let r = n.head, { state: l } = e, o = l.doc.lineAt(r), c = l.charCategorizer(r);
630
+ for (let s = null; ; ) {
631
+ if (r == (t ? o.to : o.from)) {
632
+ r == n.head && o.number != (t ? l.doc.lines : 1) && (r += t ? 1 : -1);
633
+ break;
634
+ }
635
+ let i = T(o.text, r - o.from, t) + o.from, f = o.text.slice(Math.min(r, i) - o.from, Math.max(r, i) - o.from), u = c(f);
636
+ if (s != null && u != s)
637
+ break;
638
+ (f != " " || r != n.head) && (s = u), r = i;
639
+ }
640
+ return r;
641
+ }), Ye = (e) => Xe(e, !1), Zt = (e) => Xe(e, !0), Qn = (e) => b(e, (t) => e.moveByChar(t, !0, (n) => le(e, t.head, n)).head), _t = (e) => b(e, (t) => {
642
+ let n = e.lineBlockAt(t.head).to;
643
+ return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
644
+ }), Xn = (e) => b(e, (t) => {
645
+ let n = e.lineBlockAt(t.head).from;
646
+ return t.head > n ? n : Math.max(0, t.head - 1);
647
+ }), jt = (e) => b(e, (t) => {
648
+ let n = e.moveToLineBoundary(t, !1).head;
649
+ return t.head > n ? n : Math.max(0, t.head - 1);
650
+ }), en = (e) => b(e, (t) => {
651
+ let n = e.moveToLineBoundary(t, !0).head;
652
+ return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
653
+ }), Yn = ({ state: e, dispatch: t }) => {
654
+ if (e.readOnly)
655
+ return !1;
656
+ let n = [];
657
+ for (let r = 0, l = "", o = e.doc.iter(); ; ) {
658
+ if (o.next(), o.lineBreak || o.done) {
659
+ let c = l.search(/\s+$/);
660
+ if (c > -1 && n.push({ from: r - (l.length - c), to: r }), o.done)
661
+ break;
662
+ l = "";
663
+ } else
664
+ l = o.value;
665
+ r += o.value.length;
666
+ }
667
+ return n.length ? (t(e.update({ changes: n, userEvent: "delete" })), !0) : !1;
668
+ }, tn = ({ state: e, dispatch: t }) => {
669
+ if (e.readOnly)
670
+ return !1;
671
+ let n = e.changeByRange((r) => ({
672
+ changes: { from: r.from, to: r.to, insert: Be.of(["", ""]) },
673
+ range: h.cursor(r.from)
674
+ }));
675
+ return t(e.update(n, { scrollIntoView: !0, userEvent: "input" })), !0;
676
+ }, nn = ({ state: e, dispatch: t }) => {
677
+ if (e.readOnly)
678
+ return !1;
679
+ let n = e.changeByRange((r) => {
680
+ if (!r.empty || r.from == 0 || r.from == e.doc.length)
681
+ return { range: r };
682
+ let l = r.from, o = e.doc.lineAt(l), c = l == o.from ? l - 1 : T(o.text, l - o.from, !1) + o.from, s = l == o.to ? l + 1 : T(o.text, l - o.from, !0) + o.from;
683
+ return {
684
+ changes: { from: c, to: s, insert: e.doc.slice(l, s).append(e.doc.slice(c, l)) },
685
+ range: h.cursor(s)
686
+ };
687
+ });
688
+ return n.changes.empty ? !1 : (t(e.update(n, { scrollIntoView: !0, userEvent: "move.character" })), !0);
689
+ };
690
+ function q(e) {
691
+ let t = [], n = -1;
692
+ for (let r of e.selection.ranges) {
693
+ let l = e.doc.lineAt(r.from), o = e.doc.lineAt(r.to);
694
+ if (!r.empty && r.to == o.from && (o = e.doc.lineAt(r.to - 1)), n >= l.number) {
695
+ let c = t[t.length - 1];
696
+ c.to = o.to, c.ranges.push(r);
697
+ } else
698
+ t.push({ from: l.from, to: o.to, ranges: [r] });
699
+ n = o.number + 1;
700
+ }
701
+ return t;
702
+ }
703
+ function Ze(e, t, n) {
704
+ if (e.readOnly)
705
+ return !1;
706
+ let r = [], l = [];
707
+ for (let o of q(e)) {
708
+ if (n ? o.to == e.doc.length : o.from == 0)
709
+ continue;
710
+ let c = e.doc.lineAt(n ? o.to + 1 : o.from - 1), s = c.length + 1;
711
+ if (n) {
712
+ r.push({ from: o.to, to: c.to }, { from: o.from, insert: c.text + e.lineBreak });
713
+ for (let i of o.ranges)
714
+ l.push(h.range(Math.min(e.doc.length, i.anchor + s), Math.min(e.doc.length, i.head + s)));
715
+ } else {
716
+ r.push({ from: c.from, to: o.from }, { from: o.to, insert: e.lineBreak + c.text });
717
+ for (let i of o.ranges)
718
+ l.push(h.range(i.anchor - s, i.head - s));
719
+ }
720
+ }
721
+ return r.length ? (t(e.update({
722
+ changes: r,
723
+ scrollIntoView: !0,
724
+ selection: h.create(l, e.selection.mainIndex),
725
+ userEvent: "move.line"
726
+ })), !0) : !1;
727
+ }
728
+ const rn = ({ state: e, dispatch: t }) => Ze(e, t, !1), on = ({ state: e, dispatch: t }) => Ze(e, t, !0);
729
+ function _e(e, t, n) {
730
+ if (e.readOnly)
731
+ return !1;
732
+ let r = [];
733
+ for (let o of q(e))
734
+ n ? r.push({ from: o.from, insert: e.doc.slice(o.from, o.to) + e.lineBreak }) : r.push({ from: o.to, insert: e.lineBreak + e.doc.slice(o.from, o.to) });
735
+ let l = e.changes(r);
736
+ return t(e.update({
737
+ changes: l,
738
+ selection: e.selection.map(l, n ? 1 : -1),
739
+ scrollIntoView: !0,
740
+ userEvent: "input.copyline"
741
+ })), !0;
742
+ }
743
+ const ln = ({ state: e, dispatch: t }) => _e(e, t, !1), cn = ({ state: e, dispatch: t }) => _e(e, t, !0), sn = (e) => {
744
+ if (e.state.readOnly)
745
+ return !1;
746
+ let { state: t } = e, n = t.changes(q(t).map(({ from: l, to: o }) => (l > 0 ? l-- : o < t.doc.length && o++, { from: l, to: o }))), r = I(t.selection, (l) => {
747
+ let o;
748
+ if (e.lineWrapping) {
749
+ let c = e.lineBlockAt(l.head), s = e.coordsAtPos(l.head, l.assoc || 1);
750
+ s && (o = c.bottom + e.documentTop - s.bottom + e.defaultLineHeight / 2);
751
+ }
752
+ return e.moveVertically(l, !0, o);
753
+ }).map(n);
754
+ return e.dispatch({ changes: n, selection: r, scrollIntoView: !0, userEvent: "delete.line" }), !0;
755
+ }, Zn = ({ state: e, dispatch: t }) => (t(e.update(e.replaceSelection(e.lineBreak), { scrollIntoView: !0, userEvent: "input" })), !0), _n = ({ state: e, dispatch: t }) => (t(e.update(e.changeByRange((n) => {
756
+ let r = /^\s*/.exec(e.doc.lineAt(n.from).text)[0];
757
+ return {
758
+ changes: { from: n.from, to: n.to, insert: e.lineBreak + r },
759
+ range: h.cursor(n.from + r.length + 1)
760
+ };
761
+ }), { scrollIntoView: !0, userEvent: "input" })), !0);
762
+ function un(e, t) {
763
+ if (/\(\)|\[\]|\{\}/.test(e.sliceDoc(t - 1, t + 1)))
764
+ return { from: t, to: t };
765
+ let n = te(e).resolveInner(t), r = n.childBefore(t), l = n.childAfter(t), o;
766
+ return r && l && r.to <= t && l.from >= t && (o = r.type.prop(X.closedBy)) && o.indexOf(l.name) > -1 && e.doc.lineAt(r.to).from == e.doc.lineAt(l.from).from && !/\S/.test(e.sliceDoc(r.to, l.from)) ? { from: r.to, to: l.from } : null;
767
+ }
768
+ const ye = /* @__PURE__ */ je(!1), fn = /* @__PURE__ */ je(!0);
769
+ function je(e) {
770
+ return ({ state: t, dispatch: n }) => {
771
+ if (t.readOnly)
772
+ return !1;
773
+ let r = t.changeByRange((l) => {
774
+ let { from: o, to: c } = l, s = t.doc.lineAt(o), i = !e && o == c && un(t, o);
775
+ e && (o = c = (c <= s.to ? s : t.doc.lineAt(c)).to);
776
+ let f = new Ce(t, { simulateBreak: o, simulateDoubleBreak: !!i }), u = De(f, o);
777
+ for (u == null && (u = ee(/^\s*/.exec(t.doc.lineAt(o).text)[0], t.tabSize)); c < s.to && /\s/.test(s.text[c - s.from]); )
778
+ c++;
779
+ i ? { from: o, to: c } = i : o > s.from && o < s.from + 100 && !/\S/.test(s.text.slice(0, o)) && (o = s.from);
780
+ let a = ["", G(t, u)];
781
+ return i && a.push(G(t, f.lineIndent(s.from, -1))), {
782
+ changes: { from: o, to: c, insert: Be.of(a) },
783
+ range: h.cursor(o + 1 + a[1].length)
784
+ };
785
+ });
786
+ return n(t.update(r, { scrollIntoView: !0, userEvent: "input" })), !0;
787
+ };
788
+ }
789
+ function se(e, t) {
790
+ let n = -1;
791
+ return e.changeByRange((r) => {
792
+ let l = [];
793
+ for (let c = r.from; c <= r.to; ) {
794
+ let s = e.doc.lineAt(c);
795
+ s.number > n && (r.empty || r.to > s.from) && (t(s, l, r), n = s.number), c = s.to + 1;
796
+ }
797
+ let o = e.changes(l);
798
+ return {
799
+ changes: l,
800
+ range: h.range(o.mapPos(r.anchor, 1), o.mapPos(r.head, 1))
801
+ };
802
+ });
803
+ }
804
+ const an = ({ state: e, dispatch: t }) => {
805
+ if (e.readOnly)
806
+ return !1;
807
+ let n = /* @__PURE__ */ Object.create(null), r = new Ce(e, { overrideIndentation: (o) => {
808
+ let c = n[o];
809
+ return c ?? -1;
810
+ } }), l = se(e, (o, c, s) => {
811
+ let i = De(r, o.from);
812
+ if (i == null)
813
+ return;
814
+ /\S/.test(o.text) || (i = 0);
815
+ let f = /^\s*/.exec(o.text)[0], u = G(e, i);
816
+ (f != u || s.from < o.from + f.length) && (n[o.from] = i, c.push({ from: o.from, to: o.from + f.length, insert: u }));
817
+ });
818
+ return l.changes.empty || t(e.update(l, { userEvent: "indent" })), !0;
819
+ }, ie = ({ state: e, dispatch: t }) => e.readOnly ? !1 : (t(e.update(se(e, (n, r) => {
820
+ r.push({ from: n.from, insert: e.facet(ct) });
821
+ }), { userEvent: "input.indent" })), !0), et = ({ state: e, dispatch: t }) => e.readOnly ? !1 : (t(e.update(se(e, (n, r) => {
822
+ let l = /^\s*/.exec(n.text)[0];
823
+ if (!l)
824
+ return;
825
+ let o = ee(l, e.tabSize), c = 0, s = G(e, Math.max(0, o - Q(e)));
826
+ for (; c < l.length && c < s.length && l.charCodeAt(c) == s.charCodeAt(c); )
827
+ c++;
828
+ r.push({ from: n.from + c, to: n.from + l.length, insert: s.slice(c) });
829
+ }), { userEvent: "delete.dedent" })), !0), hn = (e) => (e.setTabFocusMode(), !0), jn = (e) => (e.setTabFocusMode(2e3), !0), er = ({ state: e, dispatch: t }) => e.selection.ranges.some((n) => !n.empty) ? ie({ state: e, dispatch: t }) : (t(e.update(e.replaceSelection(" "), { scrollIntoView: !0, userEvent: "input" })), !0), dn = [
830
+ { key: "Ctrl-b", run: Te, shift: Je, preventDefault: !0 },
831
+ { key: "Ctrl-f", run: Oe, shift: we },
832
+ { key: "Ctrl-p", run: Ge, shift: He },
833
+ { key: "Ctrl-n", run: Ue, shift: qe },
834
+ { key: "Ctrl-a", run: vt, shift: Wt },
835
+ { key: "Ctrl-e", run: Rt, shift: Ht },
836
+ { key: "Ctrl-d", run: Qe },
837
+ { key: "Ctrl-h", run: j },
838
+ { key: "Ctrl-k", run: _t },
839
+ { key: "Ctrl-Alt-h", run: Ye },
840
+ { key: "Ctrl-o", run: tn },
841
+ { key: "Ctrl-t", run: nn },
842
+ { key: "Ctrl-v", run: _ }
843
+ ], mn = /* @__PURE__ */ [
844
+ { key: "ArrowLeft", run: Te, shift: Je, preventDefault: !0 },
845
+ { key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: Dt, shift: Gt, preventDefault: !0 },
846
+ { mac: "Cmd-ArrowLeft", run: Ot, shift: wt, preventDefault: !0 },
847
+ { key: "ArrowRight", run: Oe, shift: we, preventDefault: !0 },
848
+ { key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: xt, shift: Ut, preventDefault: !0 },
849
+ { mac: "Cmd-ArrowRight", run: It, shift: zt, preventDefault: !0 },
850
+ { key: "ArrowUp", run: Ge, shift: He, preventDefault: !0 },
851
+ { mac: "Cmd-ArrowUp", run: de, shift: pe },
852
+ { mac: "Ctrl-ArrowUp", run: fe, shift: ae },
853
+ { key: "ArrowDown", run: Ue, shift: qe, preventDefault: !0 },
854
+ { mac: "Cmd-ArrowDown", run: me, shift: ge },
855
+ { mac: "Ctrl-ArrowDown", run: _, shift: he },
856
+ { key: "PageUp", run: fe, shift: ae },
857
+ { key: "PageDown", run: _, shift: he },
858
+ { key: "Home", run: Tt, shift: Jt, preventDefault: !0 },
859
+ { key: "Mod-Home", run: de, shift: pe },
860
+ { key: "End", run: Et, shift: Pt, preventDefault: !0 },
861
+ { key: "Mod-End", run: me, shift: ge },
862
+ { key: "Enter", run: ye, shift: ye },
863
+ { key: "Mod-a", run: qt },
864
+ { key: "Backspace", run: j, shift: j, preventDefault: !0 },
865
+ { key: "Delete", run: Qe, preventDefault: !0 },
866
+ { key: "Mod-Backspace", mac: "Alt-Backspace", run: Ye, preventDefault: !0 },
867
+ { key: "Mod-Delete", mac: "Alt-Delete", run: Zt, preventDefault: !0 },
868
+ { mac: "Mod-Backspace", run: jt, preventDefault: !0 },
869
+ { mac: "Mod-Delete", run: en, preventDefault: !0 }
870
+ ].concat(/* @__PURE__ */ dn.map((e) => ({ mac: e.key, run: e.run, shift: e.shift }))), tr = /* @__PURE__ */ [
871
+ { key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: Mt, shift: Vt },
872
+ { key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: bt, shift: Nt },
873
+ { key: "Alt-ArrowUp", run: rn },
874
+ { key: "Shift-Alt-ArrowUp", run: ln },
875
+ { key: "Alt-ArrowDown", run: on },
876
+ { key: "Shift-Alt-ArrowDown", run: cn },
877
+ { key: "Mod-Alt-ArrowUp", run: Qt },
878
+ { key: "Mod-Alt-ArrowDown", run: Xt },
879
+ { key: "Escape", run: Yt },
880
+ { key: "Mod-Enter", run: fn },
881
+ { key: "Alt-l", mac: "Ctrl-l", run: Kt },
882
+ { key: "Mod-i", run: $t, preventDefault: !0 },
883
+ { key: "Mod-[", run: et },
884
+ { key: "Mod-]", run: ie },
885
+ { key: "Mod-Alt-\\", run: an },
886
+ { key: "Shift-Mod-k", run: sn },
887
+ { key: "Shift-Mod-\\", run: Ft },
888
+ { key: "Mod-/", run: st },
889
+ { key: "Alt-A", run: ut },
890
+ { key: "Ctrl-m", mac: "Shift-Alt-m", run: hn }
891
+ ].concat(mn), nr = { key: "Tab", run: ie, shift: et };
892
+ export {
893
+ Qt as addCursorAbove,
894
+ Xt as addCursorBelow,
895
+ Sn as blockComment,
896
+ Cn as blockUncomment,
897
+ cn as copyLineDown,
898
+ ln as copyLineUp,
899
+ Tn as cursorCharBackward,
900
+ In as cursorCharBackwardLogical,
901
+ En as cursorCharForward,
902
+ On as cursorCharForwardLogical,
903
+ Te as cursorCharLeft,
904
+ Oe as cursorCharRight,
905
+ me as cursorDocEnd,
906
+ de as cursorDocStart,
907
+ Rn as cursorGroupBackward,
908
+ vn as cursorGroupForward,
909
+ Fn as cursorGroupForwardWin,
910
+ Dt as cursorGroupLeft,
911
+ xt as cursorGroupRight,
912
+ Tt as cursorLineBoundaryBackward,
913
+ Et as cursorLineBoundaryForward,
914
+ Ot as cursorLineBoundaryLeft,
915
+ It as cursorLineBoundaryRight,
916
+ Ue as cursorLineDown,
917
+ Rt as cursorLineEnd,
918
+ vt as cursorLineStart,
919
+ Ge as cursorLineUp,
920
+ Ft as cursorMatchingBracket,
921
+ _ as cursorPageDown,
922
+ fe as cursorPageUp,
923
+ Un as cursorSubwordBackward,
924
+ Gn as cursorSubwordForward,
925
+ Mt as cursorSyntaxLeft,
926
+ bt as cursorSyntaxRight,
927
+ tr as defaultKeymap,
928
+ j as deleteCharBackward,
929
+ $n as deleteCharBackwardStrict,
930
+ Qe as deleteCharForward,
931
+ Ye as deleteGroupBackward,
932
+ Zt as deleteGroupForward,
933
+ Qn as deleteGroupForwardWin,
934
+ sn as deleteLine,
935
+ jt as deleteLineBoundaryBackward,
936
+ en as deleteLineBoundaryForward,
937
+ _t as deleteToLineEnd,
938
+ Xn as deleteToLineStart,
939
+ Yn as deleteTrailingWhitespace,
940
+ dn as emacsStyleKeymap,
941
+ Dn as history,
942
+ xn as historyField,
943
+ bn as historyKeymap,
944
+ et as indentLess,
945
+ ie as indentMore,
946
+ an as indentSelection,
947
+ nr as indentWithTab,
948
+ fn as insertBlankLine,
949
+ Zn as insertNewline,
950
+ ye as insertNewlineAndIndent,
951
+ _n as insertNewlineKeepIndent,
952
+ er as insertTab,
953
+ mt as invertedEffects,
954
+ dt as isolateHistory,
955
+ An as lineComment,
956
+ Bn as lineUncomment,
957
+ on as moveLineDown,
958
+ rn as moveLineUp,
959
+ Z as redo,
960
+ Mn as redoDepth,
961
+ gt as redoSelection,
962
+ qt as selectAll,
963
+ Pn as selectCharBackward,
964
+ wn as selectCharBackwardLogical,
965
+ Nn as selectCharForward,
966
+ Jn as selectCharForwardLogical,
967
+ Je as selectCharLeft,
968
+ we as selectCharRight,
969
+ ge as selectDocEnd,
970
+ pe as selectDocStart,
971
+ Wn as selectGroupBackward,
972
+ zn as selectGroupForward,
973
+ Hn as selectGroupForwardWin,
974
+ Gt as selectGroupLeft,
975
+ Ut as selectGroupRight,
976
+ Kt as selectLine,
977
+ Jt as selectLineBoundaryBackward,
978
+ Pt as selectLineBoundaryForward,
979
+ wt as selectLineBoundaryLeft,
980
+ zt as selectLineBoundaryRight,
981
+ qe as selectLineDown,
982
+ Ht as selectLineEnd,
983
+ Wt as selectLineStart,
984
+ He as selectLineUp,
985
+ Vn as selectMatchingBracket,
986
+ he as selectPageDown,
987
+ ae as selectPageUp,
988
+ $t as selectParentSyntax,
989
+ Kn as selectSubwordBackward,
990
+ qn as selectSubwordForward,
991
+ Vt as selectSyntaxLeft,
992
+ Nt as selectSyntaxRight,
993
+ Yt as simplifySelection,
994
+ tn as splitLine,
995
+ mn as standardKeymap,
996
+ jn as temporarilySetTabFocusMode,
997
+ ut as toggleBlockComment,
998
+ ft as toggleBlockCommentByLine,
999
+ st as toggleComment,
1000
+ it as toggleLineComment,
1001
+ hn as toggleTabFocusMode,
1002
+ nn as transposeChars,
1003
+ Le as undo,
1004
+ Ln as undoDepth,
1005
+ pt as undoSelection
1006
+ };