@oomol-lab/open-flow 0.1.0-alpha.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.
- package/LICENSE +201 -0
- package/NOTICE +47 -0
- package/README.md +18 -0
- package/dist/browser/_virtual_open-flow-twemoji-DJwKsM_w.js +5067 -0
- package/dist/browser/addNodeOptions-DqoIueCR.js +33746 -0
- package/dist/browser/assets/font-00b26ac825e20950.woff2 +0 -0
- package/dist/browser/assets/font-036d4e95149b69ff.woff2 +0 -0
- package/dist/browser/assets/font-07d8e303ce4fc12b.ttf +0 -0
- package/dist/browser/assets/font-08ce98e51b04d589.ttf +0 -0
- package/dist/browser/assets/font-0cdd387c9590a1a9.woff2 +0 -0
- package/dist/browser/assets/font-0d85ae7cc30f2379.ttf +0 -0
- package/dist/browser/assets/font-0f60d1b897938ec9.woff2 +0 -0
- package/dist/browser/assets/font-11e4dc8a6471ff6d.woff +0 -0
- package/dist/browser/assets/font-138ac28d1663b303.ttf +0 -0
- package/dist/browser/assets/font-1ae6bd7475590e97.woff +0 -0
- package/dist/browser/assets/font-1c67f068fea8bb09.ttf +0 -0
- package/dist/browser/assets/font-1e6f9579e90e2cac.ttf +0 -0
- package/dist/browser/assets/font-1ece03f79f95277d.ttf +0 -0
- package/dist/browser/assets/font-2014c523c3210bcc.woff +0 -0
- package/dist/browser/assets/font-30da91e84c893f87.woff +0 -0
- package/dist/browser/assets/font-3398dd02302557a7.woff +0 -0
- package/dist/browser/assets/font-3931dd81faed86ba.ttf +0 -0
- package/dist/browser/assets/font-500e04d54f0d5166.ttf +0 -0
- package/dist/browser/assets/font-51814d270d06ff02.woff2 +0 -0
- package/dist/browser/assets/font-5d53e70ad607c235.woff2 +0 -0
- package/dist/browser/assets/font-5e28753be717dac9.woff +0 -0
- package/dist/browser/assets/font-68534840bcfdd2bf.ttf +0 -0
- package/dist/browser/assets/font-68e8c73ef42afd3c.woff2 +0 -0
- package/dist/browser/assets/font-6ab6b62e9b62dae2.woff +0 -0
- package/dist/browser/assets/font-6b47c40166b6dbe2.woff2 +0 -0
- package/dist/browser/assets/font-70ee1f64a20f2048.ttf +0 -0
- package/dist/browser/assets/font-71d517d67827787c.woff2 +0 -0
- package/dist/browser/assets/font-73d591271b160496.woff2 +0 -0
- package/dist/browser/assets/font-74444efd593c005e.woff2 +0 -0
- package/dist/browser/assets/font-7af58c5ec8f132a2.woff2 +0 -0
- package/dist/browser/assets/font-850c0af5c2238497.woff +0 -0
- package/dist/browser/assets/font-8a8d244581371912.woff +0 -0
- package/dist/browser/assets/font-9163df9c7122432e.ttf +0 -0
- package/dist/browser/assets/font-91ee67500cc0129a.woff +0 -0
- package/dist/browser/assets/font-95b6d2f1a50173bf.ttf +0 -0
- package/dist/browser/assets/font-97479ca6cce906ab.woff2 +0 -0
- package/dist/browser/assets/font-99cd42a3c072d918.woff2 +0 -0
- package/dist/browser/assets/font-99f9c6750b489c94.woff +0 -0
- package/dist/browser/assets/font-9be7ceb88004ab8a.woff +0 -0
- package/dist/browser/assets/font-a4af7d414440a1c1.woff2 +0 -0
- package/dist/browser/assets/font-a6b2099fb555c60e.ttf +0 -0
- package/dist/browser/assets/font-a6f7ec0d846ac7ad.woff +0 -0
- package/dist/browser/assets/font-c2342cd8b869e017.woff2 +0 -0
- package/dist/browser/assets/font-c6368d87e8a1a3a5.woff +0 -0
- package/dist/browser/assets/font-c647367d1dd4e162.ttf +0 -0
- package/dist/browser/assets/font-c76c5d696297d51b.woff +0 -0
- package/dist/browser/assets/font-c943cc986384f59e.woff +0 -0
- package/dist/browser/assets/font-d0332f52868370fd.ttf +0 -0
- package/dist/browser/assets/font-d04c54219f9eaec6.woff2 +0 -0
- package/dist/browser/assets/font-d96cdf2b3bdd4d64.woff +0 -0
- package/dist/browser/assets/font-dc47344dbb6cb5b6.woff2 +0 -0
- package/dist/browser/assets/font-de7701e42cf1f4cf.woff2 +0 -0
- package/dist/browser/assets/font-e14fed02b1aba7ce.woff +0 -0
- package/dist/browser/assets/font-e99ae51144bf1232.woff2 +0 -0
- package/dist/browser/assets/font-ece03cfd83e22c21.woff +0 -0
- package/dist/browser/assets/font-ed0b74372feefcbb.ttf +0 -0
- package/dist/browser/assets/font-f01f3e87d9c6a61c.ttf +0 -0
- package/dist/browser/assets/font-f1d6ef86f3b11a52.woff +0 -0
- package/dist/browser/assets/font-f36ea897e19f4a2e.ttf +0 -0
- package/dist/browser/assets/font-f9377ab0271cda59.ttf +0 -0
- package/dist/browser/carbon-nMY84Amv.js +53 -0
- package/dist/browser/composite-7VwgfnXx.js +6088 -0
- package/dist/browser/createResourceDialog-ByuJWdSL.js +439 -0
- package/dist/browser/dist-7oZK9QXZ.js +50088 -0
- package/dist/browser/dist-B9OV3YTx.js +881 -0
- package/dist/browser/dist-BLk5M0uK.js +1816 -0
- package/dist/browser/dist-BbyiRq3c.js +3285 -0
- package/dist/browser/dist-CIq6ue3I.js +6646 -0
- package/dist/browser/dist-CLZJNoWB.js +89 -0
- package/dist/browser/dist-CvcmLAMW.js +1620 -0
- package/dist/browser/dist-DL0SDskM.js +2327 -0
- package/dist/browser/dist-Djd02JSy.js +1247 -0
- package/dist/browser/dist-aWSZx4q1.js +850 -0
- package/dist/browser/dist-n-z5HtaO.js +4 -0
- package/dist/browser/dist-o4dBuwiG.js +320 -0
- package/dist/browser/dist-zyY--HOV.js +1543 -0
- package/dist/browser/esm-DXw7EADW.js +218 -0
- package/dist/browser/favicon.svg +7 -0
- package/dist/browser/flowWorkspace-DwVMpcar.js +22092 -0
- package/dist/browser/lib-S4ccuMeT.js +7857 -0
- package/dist/browser/licenses.md +4973 -0
- package/dist/browser/markdownContent-ZZFfSRqO.js +44545 -0
- package/dist/browser/project-change.d.ts +311 -0
- package/dist/browser/project-change.js +259 -0
- package/dist/browser/project-notifications.d.ts +12 -0
- package/dist/browser/rolldown-runtime-CEFd7nDs.js +30 -0
- package/dist/browser/workbench-contract.d.ts +28 -0
- package/dist/browser/workbench.css +2 -0
- package/dist/browser/workbench.css.d.ts +1 -0
- package/dist/browser/workbench.d.ts +14 -0
- package/dist/browser/workbench.js +3364 -0
- package/dist/common/connector-action.d.ts +20 -0
- package/dist/common/connector-action.js +106 -0
- package/dist/common/connector-proxy.d.ts +14 -0
- package/dist/common/connector-proxy.js +0 -0
- package/dist/common/control-api-conformance.d.ts +13 -0
- package/dist/common/control-api-conformance.js +518 -0
- package/dist/common/control-api-errors.d.ts +121 -0
- package/dist/common/control-api.d.ts +349 -0
- package/dist/common/control-api.js +884 -0
- package/dist/common/cron-trigger.d.ts +21 -0
- package/dist/common/cron-trigger.js +834 -0
- package/dist/common/engine-contract.d.ts +7 -0
- package/dist/common/favicon.svg +7 -0
- package/dist/common/integration-trigger.d.ts +111 -0
- package/dist/common/integration-trigger.js +290 -0
- package/dist/common/licenses.md +27 -0
- package/dist/common/poll-trigger.d.ts +69 -0
- package/dist/common/poll-trigger.js +155 -0
- package/dist/common/project-encoding.d.ts +11 -0
- package/dist/common/project-encoding.js +242 -0
- package/dist/common/project-notifications.d.ts +12 -0
- package/dist/common/project-semantics.d.ts +55 -0
- package/dist/common/project-semantics.js +8687 -0
- package/dist/common/provider-triggers.d.ts +6 -0
- package/dist/common/provider-triggers.js +4614 -0
- package/dist/common/run-events.d.ts +9 -0
- package/dist/common/run-events.js +192 -0
- package/dist/common/run-lifecycle.d.ts +69 -0
- package/dist/common/run-lifecycle.js +169 -0
- package/dist/common/runtime-contract.d.ts +53 -0
- package/dist/common/runtime-contract.js +151 -0
- package/dist/common/scheduler.d.ts +99 -0
- package/dist/common/scheduler.js +379 -0
- package/dist/common/webhook-trigger.d.ts +22 -0
- package/dist/common/webhook-trigger.js +270 -0
- package/dist/index.d.ts +66 -0
- package/package.json +102 -0
|
@@ -0,0 +1,2327 @@
|
|
|
1
|
+
import { l as e } from "./dist-zyY--HOV.js";
|
|
2
|
+
import { S as t, _ as n, a as r, b as i, d as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, t as ee, v as te, w as ne, y as g } from "./dist-BLk5M0uK.js";
|
|
3
|
+
import { C as re, D as _, S as ie, T as ae, _ as oe, a as se, b as ce, c as le, d as ue, f as de, g as fe, h as pe, n as me, o as he, r as v, s as ge, t as y, u as _e, v as ve, w as ye, y as be } from "./dist-CIq6ue3I.js";
|
|
4
|
+
import { A as xe, E as Se, O as b, S as Ce, T as x, c as we, d as Te, g as Ee, j as De, n as Oe, v as ke, w as Ae, x as je } from "./dist-CvcmLAMW.js";
|
|
5
|
+
import { i as Me, n as Ne, o as Pe, r as Fe } from "./dist-Djd02JSy.js";
|
|
6
|
+
//#region ../../node_modules/@codemirror/commands/dist/index.js
|
|
7
|
+
var Ie = (e) => {
|
|
8
|
+
let { state: t } = e, n = t.doc.lineAt(t.selection.main.from), r = Ve(e.state, n.from);
|
|
9
|
+
return r.line ? Re(e) : r.block ? Be(e) : !1;
|
|
10
|
+
};
|
|
11
|
+
function Le(e, t) {
|
|
12
|
+
return ({ state: n, dispatch: r }) => {
|
|
13
|
+
if (n.readOnly) return !1;
|
|
14
|
+
let i = e(t, n);
|
|
15
|
+
return i ? (r(n.update(i)), !0) : !1;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var Re = /*@__PURE__*/ Le(Ke, 0), ze = /*@__PURE__*/ Le(Ge, 0), Be = /*@__PURE__*/ Le((e, t) => Ge(e, t, We(t)), 0);
|
|
19
|
+
function Ve(e, t) {
|
|
20
|
+
let n = e.languageDataAt("commentTokens", t, 1);
|
|
21
|
+
return n.length ? n[0] : {};
|
|
22
|
+
}
|
|
23
|
+
var He = 50;
|
|
24
|
+
function Ue(e, { open: t, close: n }, r, i) {
|
|
25
|
+
let a = e.sliceDoc(r - He, r), o = e.sliceDoc(i, i + He), s = /\s*$/.exec(a)[0].length, c = /^\s*/.exec(o)[0].length, l = a.length - s;
|
|
26
|
+
if (a.slice(l - t.length, l) == t && o.slice(c, c + n.length) == n) return {
|
|
27
|
+
open: {
|
|
28
|
+
pos: r - s,
|
|
29
|
+
margin: s && 1
|
|
30
|
+
},
|
|
31
|
+
close: {
|
|
32
|
+
pos: i + c,
|
|
33
|
+
margin: c && 1
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
let u, d;
|
|
37
|
+
i - r <= 100 ? u = d = e.sliceDoc(r, i) : (u = e.sliceDoc(r, r + He), d = e.sliceDoc(i - He, i));
|
|
38
|
+
let f = /^\s*/.exec(u)[0].length, p = /\s*$/.exec(d)[0].length, m = d.length - p - n.length;
|
|
39
|
+
return u.slice(f, f + t.length) == t && d.slice(m, m + n.length) == n ? {
|
|
40
|
+
open: {
|
|
41
|
+
pos: r + f + t.length,
|
|
42
|
+
margin: +!!/\s/.test(u.charAt(f + t.length))
|
|
43
|
+
},
|
|
44
|
+
close: {
|
|
45
|
+
pos: i - p - n.length,
|
|
46
|
+
margin: +!!/\s/.test(d.charAt(m - 1))
|
|
47
|
+
}
|
|
48
|
+
} : null;
|
|
49
|
+
}
|
|
50
|
+
function We(e) {
|
|
51
|
+
let t = [];
|
|
52
|
+
for (let n of e.selection.ranges) {
|
|
53
|
+
let r = e.doc.lineAt(n.from), i = n.to <= r.to ? r : e.doc.lineAt(n.to);
|
|
54
|
+
i.from > r.from && i.from == n.to && (i = n.to == r.to + 1 ? r : e.doc.lineAt(n.to - 1));
|
|
55
|
+
let a = t.length - 1;
|
|
56
|
+
a >= 0 && t[a].to > r.from ? t[a].to = i.to : t.push({
|
|
57
|
+
from: r.from + /^\s*/.exec(r.text)[0].length,
|
|
58
|
+
to: i.to
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return t;
|
|
62
|
+
}
|
|
63
|
+
function Ge(e, t, n = t.selection.ranges) {
|
|
64
|
+
let r = n.map((e) => Ve(t, e.from).block);
|
|
65
|
+
if (!r.every((e) => e)) return null;
|
|
66
|
+
let i = n.map((e, n) => Ue(t, r[n], e.from, e.to));
|
|
67
|
+
if (e != 2 && !i.every((e) => e)) return { changes: t.changes(n.map((e, t) => i[t] ? [] : [{
|
|
68
|
+
from: e.from,
|
|
69
|
+
insert: r[t].open + " "
|
|
70
|
+
}, {
|
|
71
|
+
from: e.to,
|
|
72
|
+
insert: " " + r[t].close
|
|
73
|
+
}])) };
|
|
74
|
+
if (e != 1 && i.some((e) => e)) {
|
|
75
|
+
let e = [];
|
|
76
|
+
for (let t = 0, n; t < i.length; t++) if (n = i[t]) {
|
|
77
|
+
let i = r[t], { open: a, close: o } = n;
|
|
78
|
+
e.push({
|
|
79
|
+
from: a.pos - i.open.length,
|
|
80
|
+
to: a.pos + a.margin
|
|
81
|
+
}, {
|
|
82
|
+
from: o.pos - o.margin,
|
|
83
|
+
to: o.pos + i.close.length
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return { changes: e };
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function Ke(e, t, n = t.selection.ranges) {
|
|
91
|
+
let r = [], i = -1;
|
|
92
|
+
ranges: for (let { from: e, to: a } of n) {
|
|
93
|
+
let n = r.length, o = 1e9, s;
|
|
94
|
+
for (let n = e; n <= a;) {
|
|
95
|
+
let c = t.doc.lineAt(n);
|
|
96
|
+
if (s == null && (s = Ve(t, c.from).line, !s)) continue ranges;
|
|
97
|
+
if (c.from > i && (e == a || a > c.from)) {
|
|
98
|
+
i = c.from;
|
|
99
|
+
let e = /^\s*/.exec(c.text)[0].length, t = e == c.length, n = c.text.slice(e, e + s.length) == s ? e : -1;
|
|
100
|
+
e < c.text.length && e < o && (o = e), r.push({
|
|
101
|
+
line: c,
|
|
102
|
+
comment: n,
|
|
103
|
+
token: s,
|
|
104
|
+
indent: e,
|
|
105
|
+
empty: t,
|
|
106
|
+
single: !1
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
n = c.to + 1;
|
|
110
|
+
}
|
|
111
|
+
if (o < 1e9) for (let e = n; e < r.length; e++) r[e].indent < r[e].line.text.length && (r[e].indent = o);
|
|
112
|
+
r.length == n + 1 && (r[n].single = !0);
|
|
113
|
+
}
|
|
114
|
+
if (e != 2 && r.some((e) => e.comment < 0 && (!e.empty || e.single))) {
|
|
115
|
+
let e = [];
|
|
116
|
+
for (let { line: t, token: n, indent: i, empty: a, single: o } of r) (o || !a) && e.push({
|
|
117
|
+
from: t.from + i,
|
|
118
|
+
insert: n + " "
|
|
119
|
+
});
|
|
120
|
+
let n = t.changes(e);
|
|
121
|
+
return {
|
|
122
|
+
changes: n,
|
|
123
|
+
selection: t.selection.map(n, 1)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (e != 1 && r.some((e) => e.comment >= 0)) {
|
|
127
|
+
let e = [];
|
|
128
|
+
for (let { line: t, comment: n, token: i } of r) if (n >= 0) {
|
|
129
|
+
let r = t.from + n, a = r + i.length;
|
|
130
|
+
t.text[a - t.from] == " " && a++, e.push({
|
|
131
|
+
from: r,
|
|
132
|
+
to: a
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return { changes: e };
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
var qe = /*@__PURE__*/ ee.define(), Je = /*@__PURE__*/ ee.define(), Ye = /*@__PURE__*/ h.define(), Xe = /*@__PURE__*/ h.define({ combine(e) {
|
|
140
|
+
return g(e, {
|
|
141
|
+
minDepth: 100,
|
|
142
|
+
newGroupDelay: 500,
|
|
143
|
+
joinToEvent: (e, t) => t
|
|
144
|
+
}, {
|
|
145
|
+
minDepth: Math.max,
|
|
146
|
+
newGroupDelay: Math.min,
|
|
147
|
+
joinToEvent: (e, t) => (n, r) => e(n, r) || t(n, r)
|
|
148
|
+
});
|
|
149
|
+
} }), Ze = /*@__PURE__*/ u.define({
|
|
150
|
+
create() {
|
|
151
|
+
return T.empty;
|
|
152
|
+
},
|
|
153
|
+
update(e, t) {
|
|
154
|
+
let n = t.state.facet(Xe), r = t.annotation(qe);
|
|
155
|
+
if (r) {
|
|
156
|
+
let i = C.fromTransaction(t, r.selection), a = r.side, o = a == 0 ? e.undone : e.done;
|
|
157
|
+
return o = i ? rt(o, o.length, n.minDepth, i) : ct(o, t.startState.selection), new T(a == 0 ? r.rest : o, a == 0 ? o : r.rest);
|
|
158
|
+
}
|
|
159
|
+
let i = t.annotation(Je);
|
|
160
|
+
if ((i == "full" || i == "before") && (e = e.isolate()), t.annotation(o.addToHistory) === !1) return t.changes.empty ? e : e.addMapping(t.changes.desc);
|
|
161
|
+
let a = C.fromTransaction(t), s = t.annotation(o.time), c = t.annotation(o.userEvent);
|
|
162
|
+
return a ? e = e.addChanges(a, s, c, n, t) : t.selection && (e = e.addSelection(t.startState.selection, s, c, n.newGroupDelay)), (i == "full" || i == "after") && (e = e.isolate()), e;
|
|
163
|
+
},
|
|
164
|
+
toJSON(e) {
|
|
165
|
+
return {
|
|
166
|
+
done: e.done.map((e) => e.toJSON()),
|
|
167
|
+
undone: e.undone.map((e) => e.toJSON())
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
fromJSON(e) {
|
|
171
|
+
return new T(e.done.map(C.fromJSON), e.undone.map(C.fromJSON));
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
function Qe(e = {}) {
|
|
175
|
+
return [
|
|
176
|
+
Ze,
|
|
177
|
+
Xe.of(e),
|
|
178
|
+
v.domEventHandlers({ beforeinput(e, t) {
|
|
179
|
+
let n = e.inputType == "historyUndo" ? $e : e.inputType == "historyRedo" ? et : null;
|
|
180
|
+
return n ? (e.preventDefault(), n(t)) : !1;
|
|
181
|
+
} })
|
|
182
|
+
];
|
|
183
|
+
}
|
|
184
|
+
function S(e, t) {
|
|
185
|
+
return function({ state: n, dispatch: r }) {
|
|
186
|
+
if (!t && n.readOnly) return !1;
|
|
187
|
+
let i = n.field(Ze, !1);
|
|
188
|
+
if (!i) return !1;
|
|
189
|
+
let a = i.pop(e, n, t);
|
|
190
|
+
return a ? (r(a), !0) : !1;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
var $e = /*@__PURE__*/ S(0, !1), et = /*@__PURE__*/ S(1, !1), tt = /*@__PURE__*/ S(0, !0), nt = /*@__PURE__*/ S(1, !0), C = class e {
|
|
194
|
+
constructor(e, t, n, r, i) {
|
|
195
|
+
this.changes = e, this.effects = t, this.mapped = n, this.startSelection = r, this.selectionsAfter = i;
|
|
196
|
+
}
|
|
197
|
+
setSelAfter(t) {
|
|
198
|
+
return new e(this.changes, this.effects, this.mapped, this.startSelection, t);
|
|
199
|
+
}
|
|
200
|
+
toJSON() {
|
|
201
|
+
return {
|
|
202
|
+
changes: this.changes?.toJSON(),
|
|
203
|
+
mapped: this.mapped?.toJSON(),
|
|
204
|
+
startSelection: this.startSelection?.toJSON(),
|
|
205
|
+
selectionsAfter: this.selectionsAfter.map((e) => e.toJSON())
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
static fromJSON(t) {
|
|
209
|
+
return new e(t.changes && m.fromJSON(t.changes), [], t.mapped && d.fromJSON(t.mapped), t.startSelection && r.fromJSON(t.startSelection), t.selectionsAfter.map(r.fromJSON));
|
|
210
|
+
}
|
|
211
|
+
static fromTransaction(t, n) {
|
|
212
|
+
let r = w;
|
|
213
|
+
for (let e of t.startState.facet(Ye)) {
|
|
214
|
+
let n = e(t);
|
|
215
|
+
n.length && (r = r.concat(n));
|
|
216
|
+
}
|
|
217
|
+
return !r.length && t.changes.empty ? null : new e(t.changes.invert(t.startState.doc), r, void 0, n || t.startState.selection, w);
|
|
218
|
+
}
|
|
219
|
+
static selection(t) {
|
|
220
|
+
return new e(void 0, w, void 0, void 0, t);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
function rt(e, t, n, r) {
|
|
224
|
+
let i = t + 1 > n + 20 ? t - n - 1 : 0, a = e.slice(i, t);
|
|
225
|
+
return a.push(r), a;
|
|
226
|
+
}
|
|
227
|
+
function it(e, t) {
|
|
228
|
+
let n = [], r = !1;
|
|
229
|
+
return e.iterChangedRanges((e, t) => n.push(e, t)), t.iterChangedRanges((e, t, i, a) => {
|
|
230
|
+
for (let e = 0; e < n.length;) {
|
|
231
|
+
let t = n[e++], o = n[e++];
|
|
232
|
+
a >= t && i <= o && (r = !0);
|
|
233
|
+
}
|
|
234
|
+
}), r;
|
|
235
|
+
}
|
|
236
|
+
function at(e, t) {
|
|
237
|
+
return e.ranges.length == t.ranges.length && e.ranges.filter((e, n) => e.empty != t.ranges[n].empty).length === 0;
|
|
238
|
+
}
|
|
239
|
+
function ot(e, t) {
|
|
240
|
+
return e.length ? t.length ? e.concat(t) : e : t;
|
|
241
|
+
}
|
|
242
|
+
var w = [], st = 200;
|
|
243
|
+
function ct(e, t) {
|
|
244
|
+
if (e.length) {
|
|
245
|
+
let n = e[e.length - 1], r = n.selectionsAfter.slice(Math.max(0, n.selectionsAfter.length - st));
|
|
246
|
+
return r.length && r[r.length - 1].eq(t) ? e : (r.push(t), rt(e, e.length - 1, 1e9, n.setSelAfter(r)));
|
|
247
|
+
}
|
|
248
|
+
return [C.selection([t])];
|
|
249
|
+
}
|
|
250
|
+
function lt(e) {
|
|
251
|
+
let t = e[e.length - 1], n = e.slice();
|
|
252
|
+
return n[e.length - 1] = t.setSelAfter(t.selectionsAfter.slice(0, t.selectionsAfter.length - 1)), n;
|
|
253
|
+
}
|
|
254
|
+
function ut(e, t) {
|
|
255
|
+
if (!e.length) return e;
|
|
256
|
+
let n = e.length, r = w;
|
|
257
|
+
for (; n;) {
|
|
258
|
+
let i = dt(e[n - 1], t, r);
|
|
259
|
+
if (i.changes && !i.changes.empty || i.effects.length) {
|
|
260
|
+
let t = e.slice(0, n);
|
|
261
|
+
return t[n - 1] = i, t;
|
|
262
|
+
}
|
|
263
|
+
t = i.mapped, n--, r = i.selectionsAfter;
|
|
264
|
+
}
|
|
265
|
+
return r.length ? [C.selection(r)] : w;
|
|
266
|
+
}
|
|
267
|
+
function dt(e, t, n) {
|
|
268
|
+
let r = ot(e.selectionsAfter.length ? e.selectionsAfter.map((e) => e.map(t)) : w, n);
|
|
269
|
+
if (!e.changes) return C.selection(r);
|
|
270
|
+
let i = e.changes.map(t), a = t.mapDesc(e.changes, !0), o = e.mapped ? e.mapped.composeDesc(a) : a;
|
|
271
|
+
return new C(i, p.mapEffects(e.effects, t), o, e.startSelection.map(a), r);
|
|
272
|
+
}
|
|
273
|
+
var ft = /^(input\.type|delete)($|\.)/, T = class e {
|
|
274
|
+
constructor(e, t, n = 0, r = void 0) {
|
|
275
|
+
this.done = e, this.undone = t, this.prevTime = n, this.prevUserEvent = r;
|
|
276
|
+
}
|
|
277
|
+
isolate() {
|
|
278
|
+
return this.prevTime ? new e(this.done, this.undone) : this;
|
|
279
|
+
}
|
|
280
|
+
addChanges(t, n, r, i, a) {
|
|
281
|
+
let o = this.done, s = o[o.length - 1];
|
|
282
|
+
return o = s && s.changes && !s.changes.empty && t.changes && (!r || ft.test(r)) && (!s.selectionsAfter.length && n - this.prevTime < i.newGroupDelay && i.joinToEvent(a, it(s.changes, t.changes)) || r == "input.type.compose") ? rt(o, o.length - 1, i.minDepth, new C(t.changes.compose(s.changes), ot(p.mapEffects(t.effects, s.changes), s.effects), s.mapped, s.startSelection, w)) : rt(o, o.length, i.minDepth, t), new e(o, w, n, r);
|
|
283
|
+
}
|
|
284
|
+
addSelection(t, n, r, i) {
|
|
285
|
+
let a = this.done.length ? this.done[this.done.length - 1].selectionsAfter : w;
|
|
286
|
+
return a.length > 0 && n - this.prevTime < i && r == this.prevUserEvent && r && /^select($|\.)/.test(r) && at(a[a.length - 1], t) ? this : new e(ct(this.done, t), this.undone, n, r);
|
|
287
|
+
}
|
|
288
|
+
addMapping(t) {
|
|
289
|
+
return new e(ut(this.done, t), ut(this.undone, t), this.prevTime, this.prevUserEvent);
|
|
290
|
+
}
|
|
291
|
+
pop(e, t, n) {
|
|
292
|
+
let r = e == 0 ? this.done : this.undone;
|
|
293
|
+
if (r.length == 0) return null;
|
|
294
|
+
let i = r[r.length - 1], a = i.selectionsAfter[0] || (i.startSelection ? i.startSelection.map(i.changes.invertedDesc, 1) : t.selection);
|
|
295
|
+
if (n && i.selectionsAfter.length) return t.update({
|
|
296
|
+
selection: i.selectionsAfter[i.selectionsAfter.length - 1],
|
|
297
|
+
annotations: qe.of({
|
|
298
|
+
side: e,
|
|
299
|
+
rest: lt(r),
|
|
300
|
+
selection: a
|
|
301
|
+
}),
|
|
302
|
+
userEvent: e == 0 ? "select.undo" : "select.redo",
|
|
303
|
+
scrollIntoView: !0
|
|
304
|
+
});
|
|
305
|
+
if (i.changes) {
|
|
306
|
+
let n = r.length == 1 ? w : r.slice(0, r.length - 1);
|
|
307
|
+
return i.mapped && (n = ut(n, i.mapped)), t.update({
|
|
308
|
+
changes: i.changes,
|
|
309
|
+
selection: i.startSelection,
|
|
310
|
+
effects: i.effects,
|
|
311
|
+
annotations: qe.of({
|
|
312
|
+
side: e,
|
|
313
|
+
rest: n,
|
|
314
|
+
selection: a
|
|
315
|
+
}),
|
|
316
|
+
filter: !1,
|
|
317
|
+
userEvent: e == 0 ? "undo" : "redo",
|
|
318
|
+
scrollIntoView: !0
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
T.empty = /*@__PURE__*/ new T(w, w);
|
|
325
|
+
var pt = [
|
|
326
|
+
{
|
|
327
|
+
key: "Mod-z",
|
|
328
|
+
run: $e,
|
|
329
|
+
preventDefault: !0
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
key: "Mod-y",
|
|
333
|
+
mac: "Mod-Shift-z",
|
|
334
|
+
run: et,
|
|
335
|
+
preventDefault: !0
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
linux: "Ctrl-Shift-z",
|
|
339
|
+
run: et,
|
|
340
|
+
preventDefault: !0
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
key: "Mod-u",
|
|
344
|
+
run: tt,
|
|
345
|
+
preventDefault: !0
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
key: "Alt-u",
|
|
349
|
+
mac: "Mod-Shift-u",
|
|
350
|
+
run: nt,
|
|
351
|
+
preventDefault: !0
|
|
352
|
+
}
|
|
353
|
+
];
|
|
354
|
+
function E(e, t) {
|
|
355
|
+
return r.create(e.ranges.map(t), e.mainIndex);
|
|
356
|
+
}
|
|
357
|
+
function D(e, t) {
|
|
358
|
+
return e.update({
|
|
359
|
+
selection: t,
|
|
360
|
+
scrollIntoView: !0,
|
|
361
|
+
userEvent: "select"
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
function O({ state: e, dispatch: t }, n) {
|
|
365
|
+
let r = E(e.selection, n);
|
|
366
|
+
return !r.eq(e.selection, !0) && (t(D(e, r)), !0);
|
|
367
|
+
}
|
|
368
|
+
function mt(e, t) {
|
|
369
|
+
return r.cursor(t ? e.to : e.from);
|
|
370
|
+
}
|
|
371
|
+
function ht(e, t) {
|
|
372
|
+
return O(e, (n) => n.empty ? e.moveByChar(n, t) : mt(n, t));
|
|
373
|
+
}
|
|
374
|
+
function k(e) {
|
|
375
|
+
return e.textDirectionAt(e.state.selection.main.head) == me.LTR;
|
|
376
|
+
}
|
|
377
|
+
var gt = (e) => ht(e, !k(e)), _t = (e) => ht(e, k(e));
|
|
378
|
+
function vt(e, t) {
|
|
379
|
+
return O(e, (n) => n.empty ? e.moveByGroup(n, t) : mt(n, t));
|
|
380
|
+
}
|
|
381
|
+
var yt = (e) => vt(e, !k(e)), bt = (e) => vt(e, k(e));
|
|
382
|
+
typeof Intl < "u" && Intl.Segmenter;
|
|
383
|
+
function xt(e, t, n) {
|
|
384
|
+
if (t.type.prop(n)) return !0;
|
|
385
|
+
let r = t.to - t.from;
|
|
386
|
+
return r && (r > 2 || /[^\s,.;:]/.test(e.sliceDoc(t.from, t.to))) || t.firstChild;
|
|
387
|
+
}
|
|
388
|
+
function A(t, n, i) {
|
|
389
|
+
let a = De(t).resolveInner(n.head), o = i ? e.closedBy : e.openedBy;
|
|
390
|
+
for (let e = n.head;;) {
|
|
391
|
+
let n = i ? a.childAfter(e) : a.childBefore(e);
|
|
392
|
+
if (!n) break;
|
|
393
|
+
xt(t, n, o) ? a = n : e = i ? n.to : n.from;
|
|
394
|
+
}
|
|
395
|
+
let s = a.type.prop(o), c, l;
|
|
396
|
+
return l = s && (c = i ? b(t, a.from, 1) : b(t, a.to, -1)) && c.matched ? i ? c.end.to : c.end.from : i ? a.to : a.from, r.cursor(l, i ? -1 : 1);
|
|
397
|
+
}
|
|
398
|
+
var St = (e) => O(e, (t) => A(e.state, t, !k(e))), Ct = (e) => O(e, (t) => A(e.state, t, k(e)));
|
|
399
|
+
function wt(e, t) {
|
|
400
|
+
return O(e, (n) => {
|
|
401
|
+
if (!n.empty) return mt(n, t);
|
|
402
|
+
let r = e.moveVertically(n, t);
|
|
403
|
+
return r.head == n.head ? e.moveToLineBoundary(n, t) : r;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
var Tt = (e) => wt(e, !1), Et = (e) => wt(e, !0);
|
|
407
|
+
function Dt(e) {
|
|
408
|
+
let t = e.scrollDOM.clientHeight < e.scrollDOM.scrollHeight - 2, n = 0, r = 0, i;
|
|
409
|
+
if (t) {
|
|
410
|
+
for (let t of e.state.facet(v.scrollMargins)) {
|
|
411
|
+
let i = t(e);
|
|
412
|
+
i?.top && (n = Math.max(i?.top, n)), i?.bottom && (r = Math.max(i?.bottom, r));
|
|
413
|
+
}
|
|
414
|
+
i = e.scrollDOM.clientHeight - n - r;
|
|
415
|
+
} else i = (e.dom.ownerDocument.defaultView || window).innerHeight;
|
|
416
|
+
return {
|
|
417
|
+
marginTop: n,
|
|
418
|
+
marginBottom: r,
|
|
419
|
+
selfScroll: t,
|
|
420
|
+
height: Math.max(e.defaultLineHeight, i - 5)
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function Ot(e, t) {
|
|
424
|
+
let n = Dt(e), { state: r } = e, i = E(r.selection, (r) => r.empty ? e.moveVertically(r, t, n.height) : mt(r, t));
|
|
425
|
+
if (i.eq(r.selection)) return !1;
|
|
426
|
+
let a;
|
|
427
|
+
if (n.selfScroll) {
|
|
428
|
+
let t = e.coordsAtPos(r.selection.main.head), o = e.scrollDOM.getBoundingClientRect(), s = o.top + n.marginTop, c = o.bottom - n.marginBottom;
|
|
429
|
+
t && t.top > s && t.bottom < c && (a = v.scrollIntoView(i.main.head, {
|
|
430
|
+
y: "start",
|
|
431
|
+
yMargin: t.top - s
|
|
432
|
+
}));
|
|
433
|
+
}
|
|
434
|
+
return e.dispatch(D(r, i), { effects: a }), !0;
|
|
435
|
+
}
|
|
436
|
+
var kt = (e) => Ot(e, !1), At = (e) => Ot(e, !0);
|
|
437
|
+
function j(e, t, n) {
|
|
438
|
+
let i = e.lineBlockAt(t.head), a = e.moveToLineBoundary(t, n);
|
|
439
|
+
if (a.head == t.head && a.head != (n ? i.to : i.from) && (a = e.moveToLineBoundary(t, n, !1)), !n && a.head == i.from && i.length) {
|
|
440
|
+
let n = /^\s*/.exec(e.state.sliceDoc(i.from, Math.min(i.from + 100, i.to)))[0].length;
|
|
441
|
+
n && t.head != i.from + n && (a = r.cursor(i.from + n));
|
|
442
|
+
}
|
|
443
|
+
return a;
|
|
444
|
+
}
|
|
445
|
+
var jt = (e) => O(e, (t) => j(e, t, !0)), Mt = (e) => O(e, (t) => j(e, t, !1)), Nt = (e) => O(e, (t) => j(e, t, !k(e))), Pt = (e) => O(e, (t) => j(e, t, k(e))), Ft = (e) => O(e, (t) => r.cursor(e.lineBlockAt(t.head).from, 1)), It = (e) => O(e, (t) => r.cursor(e.lineBlockAt(t.head).to, -1));
|
|
446
|
+
function Lt(e, t, n) {
|
|
447
|
+
let i = !1, a = E(e.selection, (t) => {
|
|
448
|
+
let a = b(e, t.head, -1) || b(e, t.head, 1) || t.head > 0 && b(e, t.head - 1, 1) || t.head < e.doc.length && b(e, t.head + 1, -1);
|
|
449
|
+
if (!a || !a.end) return t;
|
|
450
|
+
i = !0;
|
|
451
|
+
let o = a.start.from == t.head ? a.end.to : a.end.from;
|
|
452
|
+
return n ? r.range(t.anchor, o) : r.cursor(o);
|
|
453
|
+
});
|
|
454
|
+
return i ? (t(D(e, a)), !0) : !1;
|
|
455
|
+
}
|
|
456
|
+
var Rt = ({ state: e, dispatch: t }) => Lt(e, t, !1);
|
|
457
|
+
function M(e, t, n) {
|
|
458
|
+
let i = E(e.state.selection, (e) => {
|
|
459
|
+
e.undirectional && e.head >= e.anchor != t && (e = r.range(e.head, e.anchor));
|
|
460
|
+
let i = n(e);
|
|
461
|
+
return r.range(e.anchor, i.head, i.goalColumn, i.bidiLevel || void 0, i.assoc);
|
|
462
|
+
});
|
|
463
|
+
return !i.eq(e.state.selection) && (e.dispatch(D(e.state, i)), !0);
|
|
464
|
+
}
|
|
465
|
+
function zt(e, t) {
|
|
466
|
+
return M(e, t, (n) => e.moveByChar(n, t));
|
|
467
|
+
}
|
|
468
|
+
var Bt = (e) => zt(e, !k(e)), Vt = (e) => zt(e, k(e));
|
|
469
|
+
function Ht(e, t) {
|
|
470
|
+
return M(e, t, (n) => e.moveByGroup(n, t));
|
|
471
|
+
}
|
|
472
|
+
var Ut = (e) => Ht(e, !k(e)), Wt = (e) => Ht(e, k(e)), Gt = (e) => {
|
|
473
|
+
let t = !k(e);
|
|
474
|
+
return M(e, t, (n) => A(e.state, n, t));
|
|
475
|
+
}, Kt = (e) => {
|
|
476
|
+
let t = k(e);
|
|
477
|
+
return M(e, t, (n) => A(e.state, n, t));
|
|
478
|
+
};
|
|
479
|
+
function qt(e, t) {
|
|
480
|
+
return M(e, t, (n) => e.moveVertically(n, t));
|
|
481
|
+
}
|
|
482
|
+
var Jt = (e) => qt(e, !1), Yt = (e) => qt(e, !0);
|
|
483
|
+
function Xt(e, t) {
|
|
484
|
+
return M(e, t, (n) => e.moveVertically(n, t, Dt(e).height));
|
|
485
|
+
}
|
|
486
|
+
var Zt = (e) => Xt(e, !1), Qt = (e) => Xt(e, !0), $t = (e) => M(e, !0, (t) => j(e, t, !0)), en = (e) => M(e, !1, (t) => j(e, t, !1)), tn = (e) => {
|
|
487
|
+
let t = !k(e);
|
|
488
|
+
return M(e, t, (n) => j(e, n, t));
|
|
489
|
+
}, nn = (e) => {
|
|
490
|
+
let t = k(e);
|
|
491
|
+
return M(e, t, (n) => j(e, n, t));
|
|
492
|
+
}, rn = (e) => M(e, !1, (t) => r.cursor(e.lineBlockAt(t.head).from)), an = (e) => M(e, !0, (t) => r.cursor(e.lineBlockAt(t.head).to)), on = ({ state: e, dispatch: t }) => (t(D(e, { anchor: 0 })), !0), sn = ({ state: e, dispatch: t }) => (t(D(e, { anchor: e.doc.length })), !0), cn = ({ state: e, dispatch: t }) => (t(D(e, {
|
|
493
|
+
anchor: e.selection.main.anchor,
|
|
494
|
+
head: 0
|
|
495
|
+
})), !0), ln = ({ state: e, dispatch: t }) => (t(D(e, {
|
|
496
|
+
anchor: e.selection.main.anchor,
|
|
497
|
+
head: e.doc.length
|
|
498
|
+
})), !0), un = ({ state: e, dispatch: t }) => (t(e.update({
|
|
499
|
+
selection: {
|
|
500
|
+
anchor: 0,
|
|
501
|
+
head: e.doc.length
|
|
502
|
+
},
|
|
503
|
+
userEvent: "select"
|
|
504
|
+
})), !0), dn = ({ state: e, dispatch: t }) => {
|
|
505
|
+
let n = F(e).map(({ from: t, to: n }) => r.range(t, Math.min(n + 1, e.doc.length)));
|
|
506
|
+
return t(e.update({
|
|
507
|
+
selection: r.create(n),
|
|
508
|
+
userEvent: "select"
|
|
509
|
+
})), !0;
|
|
510
|
+
}, fn = ({ state: e, dispatch: t }) => {
|
|
511
|
+
let n = E(e.selection, (t) => {
|
|
512
|
+
let n = De(e), i = n.resolveStack(t.from, 1);
|
|
513
|
+
if (t.empty) {
|
|
514
|
+
let e = n.resolveStack(t.from, -1);
|
|
515
|
+
e.node.from >= i.node.from && e.node.to <= i.node.to && (i = e);
|
|
516
|
+
}
|
|
517
|
+
for (let e = i; e; e = e.next) {
|
|
518
|
+
let { node: n } = e;
|
|
519
|
+
if ((n.from < t.from && n.to >= t.to || n.to > t.to && n.from <= t.from) && e.next) return r.range(n.to, n.from);
|
|
520
|
+
}
|
|
521
|
+
return t;
|
|
522
|
+
});
|
|
523
|
+
return !n.eq(e.selection) && (t(D(e, n)), !0);
|
|
524
|
+
};
|
|
525
|
+
function pn(e, t) {
|
|
526
|
+
let { state: n } = e, i = n.selection, a = n.selection.ranges.slice();
|
|
527
|
+
for (let r of n.selection.ranges) {
|
|
528
|
+
let i = n.doc.lineAt(r.head);
|
|
529
|
+
if (t ? i.to < e.state.doc.length : i.from > 0) for (let n = r;;) {
|
|
530
|
+
let r = e.moveVertically(n, t);
|
|
531
|
+
if (r.head < i.from || r.head > i.to) {
|
|
532
|
+
a.some((e) => e.head == r.head) || a.push(r);
|
|
533
|
+
break;
|
|
534
|
+
}
|
|
535
|
+
if (r.head == n.head) break;
|
|
536
|
+
n = r;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return a.length != i.ranges.length && (e.dispatch(D(n, r.create(a, a.length - 1))), !0);
|
|
540
|
+
}
|
|
541
|
+
var mn = (e) => pn(e, !1), hn = (e) => pn(e, !0), gn = ({ state: e, dispatch: t }) => {
|
|
542
|
+
let n = e.selection, i = null;
|
|
543
|
+
return n.ranges.length > 1 ? i = r.create([n.main]) : n.main.empty || (i = r.create([r.cursor(n.main.head)])), i ? (t(D(e, i)), !0) : !1;
|
|
544
|
+
};
|
|
545
|
+
function N(e, t) {
|
|
546
|
+
if (e.state.readOnly) return !1;
|
|
547
|
+
let n = "delete.selection", { state: i } = e, a = i.changeByRange((i) => {
|
|
548
|
+
let { from: a, to: o } = i;
|
|
549
|
+
if (a == o) {
|
|
550
|
+
let r = t(i);
|
|
551
|
+
r < a ? (n = "delete.backward", r = P(e, r, !1)) : r > a && (n = "delete.forward", r = P(e, r, !0)), a = Math.min(a, r), o = Math.max(o, r);
|
|
552
|
+
} else a = P(e, a, !1), o = P(e, o, !0);
|
|
553
|
+
return a == o ? { range: i } : {
|
|
554
|
+
changes: {
|
|
555
|
+
from: a,
|
|
556
|
+
to: o
|
|
557
|
+
},
|
|
558
|
+
range: r.cursor(a, a < i.head ? -1 : 1)
|
|
559
|
+
};
|
|
560
|
+
});
|
|
561
|
+
return !a.changes.empty && (e.dispatch(i.update(a, {
|
|
562
|
+
scrollIntoView: !0,
|
|
563
|
+
userEvent: n,
|
|
564
|
+
effects: n == "delete.selection" ? v.announce.of(i.phrase("Selection deleted")) : void 0
|
|
565
|
+
})), !0);
|
|
566
|
+
}
|
|
567
|
+
function P(e, t, n) {
|
|
568
|
+
if (e instanceof v) for (let r of e.state.facet(v.atomicRanges).map((t) => t(e))) r.between(t, t, (e, r) => {
|
|
569
|
+
e < t && r > t && (t = n ? r : e);
|
|
570
|
+
});
|
|
571
|
+
return t;
|
|
572
|
+
}
|
|
573
|
+
var _n = (e, n, r) => N(e, (a) => {
|
|
574
|
+
let o = a.from, { state: s } = e, c = s.doc.lineAt(o), l, u;
|
|
575
|
+
if (r && !n && o > c.from && o < c.from + 200 && !/[^ \t]/.test(l = c.text.slice(0, o - c.from))) {
|
|
576
|
+
if (l[l.length - 1] == " ") return o - 1;
|
|
577
|
+
let e = i(l, s.tabSize) % je(s) || je(s);
|
|
578
|
+
for (let t = 0; t < e && l[l.length - 1 - t] == " "; t++) o--;
|
|
579
|
+
u = o;
|
|
580
|
+
} else u = t(c.text, o - c.from, n, n) + c.from, u == o && c.number != (n ? s.doc.lines : 1) ? u += n ? 1 : -1 : !n && /[\ufe00-\ufe0f]/.test(c.text.slice(u - c.from, o - c.from)) && (u = t(c.text, u - c.from, !1, !1) + c.from);
|
|
581
|
+
return u;
|
|
582
|
+
}), vn = (e) => _n(e, !1, !0), yn = (e) => _n(e, !0, !1), bn = (e, n) => N(e, (r) => {
|
|
583
|
+
let i = r.head, { state: a } = e, o = a.doc.lineAt(i), s = a.charCategorizer(i);
|
|
584
|
+
for (let e = null;;) {
|
|
585
|
+
if (i == (n ? o.to : o.from)) {
|
|
586
|
+
i == r.head && o.number != (n ? a.doc.lines : 1) && (i += n ? 1 : -1);
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
let c = t(o.text, i - o.from, n) + o.from, l = o.text.slice(Math.min(i, c) - o.from, Math.max(i, c) - o.from), u = s(l);
|
|
590
|
+
if (e != null && u != e) break;
|
|
591
|
+
(l != " " || i != r.head) && (e = u), i = c;
|
|
592
|
+
}
|
|
593
|
+
return i;
|
|
594
|
+
}), xn = (e) => bn(e, !1), Sn = (e) => bn(e, !0), Cn = (e) => N(e, (t) => {
|
|
595
|
+
let n = e.lineBlockAt(t.head).to;
|
|
596
|
+
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
597
|
+
}), wn = (e) => N(e, (t) => {
|
|
598
|
+
let n = e.moveToLineBoundary(t, !1).head;
|
|
599
|
+
return t.head > n ? n : Math.max(0, t.head - 1);
|
|
600
|
+
}), Tn = (e) => N(e, (t) => {
|
|
601
|
+
let n = e.moveToLineBoundary(t, !0).head;
|
|
602
|
+
return t.head < n ? n : Math.min(e.state.doc.length, t.head + 1);
|
|
603
|
+
}), En = ({ state: e, dispatch: t }) => {
|
|
604
|
+
if (e.readOnly) return !1;
|
|
605
|
+
let n = e.changeByRange((e) => ({
|
|
606
|
+
changes: {
|
|
607
|
+
from: e.from,
|
|
608
|
+
to: e.to,
|
|
609
|
+
insert: s.of(["", ""])
|
|
610
|
+
},
|
|
611
|
+
range: r.cursor(e.from)
|
|
612
|
+
}));
|
|
613
|
+
return t(e.update(n, {
|
|
614
|
+
scrollIntoView: !0,
|
|
615
|
+
userEvent: "input"
|
|
616
|
+
})), !0;
|
|
617
|
+
}, Dn = ({ state: e, dispatch: n }) => {
|
|
618
|
+
if (e.readOnly) return !1;
|
|
619
|
+
let i = e.changeByRange((n) => {
|
|
620
|
+
if (!n.empty || n.from == 0 || n.from == e.doc.length) return { range: n };
|
|
621
|
+
let i = n.from, a = e.doc.lineAt(i), o = i == a.from ? i - 1 : t(a.text, i - a.from, !1) + a.from, s = i == a.to ? i + 1 : t(a.text, i - a.from, !0) + a.from;
|
|
622
|
+
return {
|
|
623
|
+
changes: {
|
|
624
|
+
from: o,
|
|
625
|
+
to: s,
|
|
626
|
+
insert: e.doc.slice(i, s).append(e.doc.slice(o, i))
|
|
627
|
+
},
|
|
628
|
+
range: r.cursor(s)
|
|
629
|
+
};
|
|
630
|
+
});
|
|
631
|
+
return !i.changes.empty && (n(e.update(i, {
|
|
632
|
+
scrollIntoView: !0,
|
|
633
|
+
userEvent: "move.character"
|
|
634
|
+
})), !0);
|
|
635
|
+
};
|
|
636
|
+
function F(e) {
|
|
637
|
+
let t = [], n = -1;
|
|
638
|
+
for (let r of e.selection.ranges) {
|
|
639
|
+
let i = e.doc.lineAt(r.from), a = e.doc.lineAt(r.to);
|
|
640
|
+
if (!r.empty && r.to == a.from && (a = e.doc.lineAt(r.to - 1)), n >= i.number) {
|
|
641
|
+
let e = t[t.length - 1];
|
|
642
|
+
e.to = a.to, e.ranges.push(r);
|
|
643
|
+
} else t.push({
|
|
644
|
+
from: i.from,
|
|
645
|
+
to: a.to,
|
|
646
|
+
ranges: [r]
|
|
647
|
+
});
|
|
648
|
+
n = a.number + 1;
|
|
649
|
+
}
|
|
650
|
+
return t;
|
|
651
|
+
}
|
|
652
|
+
function On(e, t, n) {
|
|
653
|
+
if (e.readOnly) return !1;
|
|
654
|
+
let i = [], a = [];
|
|
655
|
+
for (let t of F(e)) {
|
|
656
|
+
if (n ? t.to == e.doc.length : t.from == 0) continue;
|
|
657
|
+
let o = e.doc.lineAt(n ? t.to + 1 : t.from - 1), s = o.length + 1;
|
|
658
|
+
if (n) {
|
|
659
|
+
i.push({
|
|
660
|
+
from: t.to,
|
|
661
|
+
to: o.to
|
|
662
|
+
}, {
|
|
663
|
+
from: t.from,
|
|
664
|
+
insert: o.text + e.lineBreak
|
|
665
|
+
});
|
|
666
|
+
for (let n of t.ranges) a.push(r.range(Math.min(e.doc.length, n.anchor + s), Math.min(e.doc.length, n.head + s)));
|
|
667
|
+
} else {
|
|
668
|
+
i.push({
|
|
669
|
+
from: o.from,
|
|
670
|
+
to: t.from
|
|
671
|
+
}, {
|
|
672
|
+
from: t.to,
|
|
673
|
+
insert: e.lineBreak + o.text
|
|
674
|
+
});
|
|
675
|
+
for (let e of t.ranges) a.push(r.range(e.anchor - s, e.head - s));
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return i.length ? (t(e.update({
|
|
679
|
+
changes: i,
|
|
680
|
+
scrollIntoView: !0,
|
|
681
|
+
selection: r.create(a, e.selection.mainIndex),
|
|
682
|
+
userEvent: "move.line"
|
|
683
|
+
})), !0) : !1;
|
|
684
|
+
}
|
|
685
|
+
var kn = ({ state: e, dispatch: t }) => On(e, t, !1), An = ({ state: e, dispatch: t }) => On(e, t, !0);
|
|
686
|
+
function jn(e, t, n) {
|
|
687
|
+
if (e.readOnly) return !1;
|
|
688
|
+
let r = [];
|
|
689
|
+
for (let t of F(e)) n ? r.push({
|
|
690
|
+
from: t.from,
|
|
691
|
+
insert: e.doc.slice(t.from, t.to) + e.lineBreak
|
|
692
|
+
}) : r.push({
|
|
693
|
+
from: t.to,
|
|
694
|
+
insert: e.lineBreak + e.doc.slice(t.from, t.to)
|
|
695
|
+
});
|
|
696
|
+
let i = e.changes(r);
|
|
697
|
+
return t(e.update({
|
|
698
|
+
changes: i,
|
|
699
|
+
selection: e.selection.map(i, n ? 1 : -1),
|
|
700
|
+
scrollIntoView: !0,
|
|
701
|
+
userEvent: "input.copyline"
|
|
702
|
+
})), !0;
|
|
703
|
+
}
|
|
704
|
+
var Mn = ({ state: e, dispatch: t }) => jn(e, t, !1), Nn = ({ state: e, dispatch: t }) => jn(e, t, !0), Pn = (e) => {
|
|
705
|
+
if (e.state.readOnly) return !1;
|
|
706
|
+
let { state: t } = e, n = t.changes(F(t).map(({ from: e, to: n }) => (e > 0 ? e-- : n < t.doc.length && n++, {
|
|
707
|
+
from: e,
|
|
708
|
+
to: n
|
|
709
|
+
}))), r = E(t.selection, (t) => {
|
|
710
|
+
let n;
|
|
711
|
+
if (e.lineWrapping) {
|
|
712
|
+
let r = e.lineBlockAt(t.head), i = e.coordsAtPos(t.head, t.assoc || 1);
|
|
713
|
+
i && (n = r.bottom + e.documentTop - i.bottom + e.defaultLineHeight / 2);
|
|
714
|
+
}
|
|
715
|
+
return e.moveVertically(t, !0, n);
|
|
716
|
+
}).map(n);
|
|
717
|
+
return e.dispatch({
|
|
718
|
+
changes: n,
|
|
719
|
+
selection: r,
|
|
720
|
+
scrollIntoView: !0,
|
|
721
|
+
userEvent: "delete.line"
|
|
722
|
+
}), !0;
|
|
723
|
+
};
|
|
724
|
+
function Fn(t, n) {
|
|
725
|
+
if (/\(\)|\[\]|\{\}/.test(t.sliceDoc(n - 1, n + 1))) return {
|
|
726
|
+
from: n,
|
|
727
|
+
to: n
|
|
728
|
+
};
|
|
729
|
+
let r = De(t).resolveInner(n), i = r.childBefore(n), a = r.childAfter(n), o;
|
|
730
|
+
return i && a && i.to <= n && a.from >= n && (o = i.type.prop(e.closedBy)) && o.indexOf(a.name) > -1 && t.doc.lineAt(i.to).from == t.doc.lineAt(a.from).from && !/\S/.test(t.sliceDoc(i.to, a.from)) ? {
|
|
731
|
+
from: i.to,
|
|
732
|
+
to: a.from
|
|
733
|
+
} : null;
|
|
734
|
+
}
|
|
735
|
+
var In = /*@__PURE__*/ Rn(!1), Ln = /*@__PURE__*/ Rn(!0);
|
|
736
|
+
function Rn(e) {
|
|
737
|
+
return ({ state: t, dispatch: n }) => {
|
|
738
|
+
if (t.readOnly) return !1;
|
|
739
|
+
let a = t.changeByRange((n) => {
|
|
740
|
+
let { from: a, to: o } = n, c = t.doc.lineAt(a), l = !e && a == o && Fn(t, a);
|
|
741
|
+
e && (a = o = (o <= c.to ? c : t.doc.lineAt(o)).to);
|
|
742
|
+
let u = new Oe(t, {
|
|
743
|
+
simulateBreak: a,
|
|
744
|
+
simulateDoubleBreak: !!l
|
|
745
|
+
}), d = Ce(u, a);
|
|
746
|
+
for (d ??= i(/^\s*/.exec(t.doc.lineAt(a).text)[0], t.tabSize); o < c.to && /\s/.test(c.text[o - c.from]);) o++;
|
|
747
|
+
l ? {from: a, to: o} = l : a > c.from && a < c.from + 100 && !/\S/.test(c.text.slice(0, a)) && (a = c.from);
|
|
748
|
+
let f = ["", x(t, d)];
|
|
749
|
+
return l && f.push(x(t, u.lineIndent(c.from, -1))), {
|
|
750
|
+
changes: {
|
|
751
|
+
from: a,
|
|
752
|
+
to: o,
|
|
753
|
+
insert: s.of(f)
|
|
754
|
+
},
|
|
755
|
+
range: r.cursor(a + 1 + f[1].length)
|
|
756
|
+
};
|
|
757
|
+
});
|
|
758
|
+
return n(t.update(a, {
|
|
759
|
+
scrollIntoView: !0,
|
|
760
|
+
userEvent: "input"
|
|
761
|
+
})), !0;
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
function zn(e, t) {
|
|
765
|
+
let n = -1;
|
|
766
|
+
return e.changeByRange((i) => {
|
|
767
|
+
let a = [];
|
|
768
|
+
for (let r = i.from; r <= i.to;) {
|
|
769
|
+
let o = e.doc.lineAt(r);
|
|
770
|
+
o.number > n && (i.empty || i.to > o.from) && (t(o, a, i), n = o.number), r = o.to + 1;
|
|
771
|
+
}
|
|
772
|
+
let o = e.changes(a);
|
|
773
|
+
return {
|
|
774
|
+
changes: a,
|
|
775
|
+
range: r.range(o.mapPos(i.anchor, 1), o.mapPos(i.head, 1))
|
|
776
|
+
};
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
var Bn = ({ state: e, dispatch: t }) => {
|
|
780
|
+
if (e.readOnly) return !1;
|
|
781
|
+
let n = Object.create(null), r = new Oe(e, { overrideIndentation: (e) => n[e] ?? -1 }), i = zn(e, (t, i, a) => {
|
|
782
|
+
let o = Ce(r, t.from);
|
|
783
|
+
if (o == null) return;
|
|
784
|
+
/\S/.test(t.text) || (o = 0);
|
|
785
|
+
let s = /^\s*/.exec(t.text)[0], c = x(e, o);
|
|
786
|
+
(s != c || a.from < t.from + s.length) && (n[t.from] = o, i.push({
|
|
787
|
+
from: t.from,
|
|
788
|
+
to: t.from + s.length,
|
|
789
|
+
insert: c
|
|
790
|
+
}));
|
|
791
|
+
});
|
|
792
|
+
return i.changes.empty || t(e.update(i, { userEvent: "indent" })), !0;
|
|
793
|
+
}, Vn = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(zn(e, (t, n) => {
|
|
794
|
+
n.push({
|
|
795
|
+
from: t.from,
|
|
796
|
+
insert: e.facet(Se)
|
|
797
|
+
});
|
|
798
|
+
}), { userEvent: "input.indent" })), !0), Hn = ({ state: e, dispatch: t }) => !e.readOnly && (t(e.update(zn(e, (t, n) => {
|
|
799
|
+
let r = /^\s*/.exec(t.text)[0];
|
|
800
|
+
if (!r) return;
|
|
801
|
+
let a = i(r, e.tabSize), o = 0, s = x(e, Math.max(0, a - je(e)));
|
|
802
|
+
for (; o < r.length && o < s.length && r.charCodeAt(o) == s.charCodeAt(o);) o++;
|
|
803
|
+
n.push({
|
|
804
|
+
from: t.from + o,
|
|
805
|
+
to: t.from + r.length,
|
|
806
|
+
insert: s.slice(o)
|
|
807
|
+
});
|
|
808
|
+
}), { userEvent: "delete.dedent" })), !0), Un = (e) => (e.setTabFocusMode(), !0), Wn = [
|
|
809
|
+
{
|
|
810
|
+
key: "Ctrl-b",
|
|
811
|
+
run: gt,
|
|
812
|
+
shift: Bt,
|
|
813
|
+
preventDefault: !0
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
key: "Ctrl-f",
|
|
817
|
+
run: _t,
|
|
818
|
+
shift: Vt
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
key: "Ctrl-p",
|
|
822
|
+
run: Tt,
|
|
823
|
+
shift: Jt
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
key: "Ctrl-n",
|
|
827
|
+
run: Et,
|
|
828
|
+
shift: Yt
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
key: "Ctrl-a",
|
|
832
|
+
run: Ft,
|
|
833
|
+
shift: rn
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
key: "Ctrl-e",
|
|
837
|
+
run: It,
|
|
838
|
+
shift: an
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
key: "Ctrl-d",
|
|
842
|
+
run: yn
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
key: "Ctrl-h",
|
|
846
|
+
run: vn
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
key: "Ctrl-k",
|
|
850
|
+
run: Cn
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
key: "Ctrl-Alt-h",
|
|
854
|
+
run: xn
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
key: "Ctrl-o",
|
|
858
|
+
run: En
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
key: "Ctrl-t",
|
|
862
|
+
run: Dn
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
key: "Ctrl-v",
|
|
866
|
+
run: At
|
|
867
|
+
}
|
|
868
|
+
], Gn = /*@__PURE__*/ [
|
|
869
|
+
{
|
|
870
|
+
key: "ArrowLeft",
|
|
871
|
+
run: gt,
|
|
872
|
+
shift: Bt,
|
|
873
|
+
preventDefault: !0
|
|
874
|
+
},
|
|
875
|
+
{
|
|
876
|
+
key: "Mod-ArrowLeft",
|
|
877
|
+
mac: "Alt-ArrowLeft",
|
|
878
|
+
run: yt,
|
|
879
|
+
shift: Ut,
|
|
880
|
+
preventDefault: !0
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
mac: "Cmd-ArrowLeft",
|
|
884
|
+
run: Nt,
|
|
885
|
+
shift: tn,
|
|
886
|
+
preventDefault: !0
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
key: "ArrowRight",
|
|
890
|
+
run: _t,
|
|
891
|
+
shift: Vt,
|
|
892
|
+
preventDefault: !0
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
key: "Mod-ArrowRight",
|
|
896
|
+
mac: "Alt-ArrowRight",
|
|
897
|
+
run: bt,
|
|
898
|
+
shift: Wt,
|
|
899
|
+
preventDefault: !0
|
|
900
|
+
},
|
|
901
|
+
{
|
|
902
|
+
mac: "Cmd-ArrowRight",
|
|
903
|
+
run: Pt,
|
|
904
|
+
shift: nn,
|
|
905
|
+
preventDefault: !0
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
key: "ArrowUp",
|
|
909
|
+
run: Tt,
|
|
910
|
+
shift: Jt,
|
|
911
|
+
preventDefault: !0
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
mac: "Cmd-ArrowUp",
|
|
915
|
+
run: on,
|
|
916
|
+
shift: cn
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
mac: "Ctrl-ArrowUp",
|
|
920
|
+
run: kt,
|
|
921
|
+
shift: Zt
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
key: "ArrowDown",
|
|
925
|
+
run: Et,
|
|
926
|
+
shift: Yt,
|
|
927
|
+
preventDefault: !0
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
mac: "Cmd-ArrowDown",
|
|
931
|
+
run: sn,
|
|
932
|
+
shift: ln
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
mac: "Ctrl-ArrowDown",
|
|
936
|
+
run: At,
|
|
937
|
+
shift: Qt
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
key: "PageUp",
|
|
941
|
+
run: kt,
|
|
942
|
+
shift: Zt
|
|
943
|
+
},
|
|
944
|
+
{
|
|
945
|
+
key: "PageDown",
|
|
946
|
+
run: At,
|
|
947
|
+
shift: Qt
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
key: "Home",
|
|
951
|
+
run: Mt,
|
|
952
|
+
shift: en,
|
|
953
|
+
preventDefault: !0
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
key: "Mod-Home",
|
|
957
|
+
run: on,
|
|
958
|
+
shift: cn
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
key: "End",
|
|
962
|
+
run: jt,
|
|
963
|
+
shift: $t,
|
|
964
|
+
preventDefault: !0
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
key: "Mod-End",
|
|
968
|
+
run: sn,
|
|
969
|
+
shift: ln
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
key: "Enter",
|
|
973
|
+
run: In,
|
|
974
|
+
shift: In
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
key: "Mod-a",
|
|
978
|
+
run: un
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
key: "Backspace",
|
|
982
|
+
run: vn,
|
|
983
|
+
shift: vn,
|
|
984
|
+
preventDefault: !0
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
key: "Delete",
|
|
988
|
+
run: yn,
|
|
989
|
+
preventDefault: !0
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
key: "Mod-Backspace",
|
|
993
|
+
mac: "Alt-Backspace",
|
|
994
|
+
run: xn,
|
|
995
|
+
preventDefault: !0
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
key: "Mod-Delete",
|
|
999
|
+
mac: "Alt-Delete",
|
|
1000
|
+
run: Sn,
|
|
1001
|
+
preventDefault: !0
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
mac: "Mod-Backspace",
|
|
1005
|
+
run: wn,
|
|
1006
|
+
preventDefault: !0
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
mac: "Mod-Delete",
|
|
1010
|
+
run: Tn,
|
|
1011
|
+
preventDefault: !0
|
|
1012
|
+
}
|
|
1013
|
+
].concat(/*@__PURE__*/ Wn.map((e) => ({
|
|
1014
|
+
mac: e.key,
|
|
1015
|
+
run: e.run,
|
|
1016
|
+
shift: e.shift
|
|
1017
|
+
}))), Kn = /*@__PURE__*/ [
|
|
1018
|
+
{
|
|
1019
|
+
key: "Alt-ArrowLeft",
|
|
1020
|
+
mac: "Ctrl-ArrowLeft",
|
|
1021
|
+
run: St,
|
|
1022
|
+
shift: Gt
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
key: "Alt-ArrowRight",
|
|
1026
|
+
mac: "Ctrl-ArrowRight",
|
|
1027
|
+
run: Ct,
|
|
1028
|
+
shift: Kt
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
key: "Alt-ArrowUp",
|
|
1032
|
+
run: kn
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
key: "Shift-Alt-ArrowUp",
|
|
1036
|
+
run: Mn
|
|
1037
|
+
},
|
|
1038
|
+
{
|
|
1039
|
+
key: "Alt-ArrowDown",
|
|
1040
|
+
run: An
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
key: "Shift-Alt-ArrowDown",
|
|
1044
|
+
run: Nn
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
key: "Mod-Alt-ArrowUp",
|
|
1048
|
+
run: mn
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
key: "Mod-Alt-ArrowDown",
|
|
1052
|
+
run: hn
|
|
1053
|
+
},
|
|
1054
|
+
{
|
|
1055
|
+
key: "Escape",
|
|
1056
|
+
run: gn
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
key: "Mod-Enter",
|
|
1060
|
+
run: Ln
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
key: "Alt-l",
|
|
1064
|
+
mac: "Ctrl-l",
|
|
1065
|
+
run: dn
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
key: "Mod-i",
|
|
1069
|
+
run: fn,
|
|
1070
|
+
preventDefault: !0
|
|
1071
|
+
},
|
|
1072
|
+
{
|
|
1073
|
+
key: "Mod-[",
|
|
1074
|
+
run: Hn
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
key: "Mod-]",
|
|
1078
|
+
run: Vn
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
key: "Mod-Alt-\\",
|
|
1082
|
+
run: Bn
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
key: "Shift-Mod-k",
|
|
1086
|
+
run: Pn
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
key: "Shift-Mod-\\",
|
|
1090
|
+
run: Rt
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
key: "Mod-/",
|
|
1094
|
+
run: Ie
|
|
1095
|
+
},
|
|
1096
|
+
{
|
|
1097
|
+
key: "Alt-A",
|
|
1098
|
+
run: ze
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
key: "Ctrl-m",
|
|
1102
|
+
mac: "Shift-Alt-m",
|
|
1103
|
+
run: Un
|
|
1104
|
+
}
|
|
1105
|
+
].concat(Gn), qn = typeof String.prototype.normalize == "function" ? (e) => e.normalize("NFKD") : (e) => e, I = class {
|
|
1106
|
+
constructor(e, t, n = 0, r = e.length, i, a) {
|
|
1107
|
+
this.test = a, this.value = {
|
|
1108
|
+
from: 0,
|
|
1109
|
+
to: 0,
|
|
1110
|
+
precise: !1
|
|
1111
|
+
}, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, r), this.bufferStart = n, this.normalize = i ? (e) => i(qn(e)) : qn, this.query = this.normalize(t);
|
|
1112
|
+
}
|
|
1113
|
+
peek() {
|
|
1114
|
+
if (this.bufferPos == this.buffer.length) {
|
|
1115
|
+
if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done) return -1;
|
|
1116
|
+
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
1117
|
+
}
|
|
1118
|
+
return n(this.buffer, this.bufferPos);
|
|
1119
|
+
}
|
|
1120
|
+
next() {
|
|
1121
|
+
for (; this.matches.length;) this.matches.pop();
|
|
1122
|
+
return this.nextOverlapping();
|
|
1123
|
+
}
|
|
1124
|
+
nextOverlapping() {
|
|
1125
|
+
for (;;) {
|
|
1126
|
+
let e = this.peek();
|
|
1127
|
+
if (e < 0) return this.done = !0, this;
|
|
1128
|
+
let t = ne(e), n = this.bufferStart + this.bufferPos;
|
|
1129
|
+
this.bufferPos += te(e);
|
|
1130
|
+
let r = this.normalize(t);
|
|
1131
|
+
if (r.length) for (let e = 0, i = n, a = !0;; e++) {
|
|
1132
|
+
let n = r.charCodeAt(e), o = this.match(n, i, a, this.bufferPos + this.bufferStart, e == r.length - 1);
|
|
1133
|
+
if (o) return this.value = o, this;
|
|
1134
|
+
if (e == r.length - 1) break;
|
|
1135
|
+
a && e < t.length && t.charCodeAt(e) == n ? i++ : a = !1;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
match(e, t, n, r, i) {
|
|
1140
|
+
let a = null;
|
|
1141
|
+
for (let t = 0; t < this.matches.length;) {
|
|
1142
|
+
let n = this.matches[t], o = !1;
|
|
1143
|
+
this.query.charCodeAt(n.index) == e && (n.index == this.query.length - 1 ? a = {
|
|
1144
|
+
from: n.from,
|
|
1145
|
+
to: r,
|
|
1146
|
+
precise: i && n.precise
|
|
1147
|
+
} : (n.index++, o = !0)), o ? t++ : this.matches.splice(t, 1);
|
|
1148
|
+
}
|
|
1149
|
+
return this.query.charCodeAt(0) == e && (this.query.length == 1 ? a = {
|
|
1150
|
+
from: t,
|
|
1151
|
+
to: r,
|
|
1152
|
+
precise: n && i
|
|
1153
|
+
} : this.matches.push({
|
|
1154
|
+
from: t,
|
|
1155
|
+
index: 1,
|
|
1156
|
+
precise: n
|
|
1157
|
+
})), a && this.test && !this.test(a.from, a.to, this.buffer, this.bufferStart) && (a = null), a;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
typeof Symbol < "u" && (I.prototype[Symbol.iterator] = function() {
|
|
1161
|
+
return this;
|
|
1162
|
+
});
|
|
1163
|
+
var Jn = {
|
|
1164
|
+
from: -1,
|
|
1165
|
+
to: -1,
|
|
1166
|
+
match: /*@__PURE__*/ /.*/.exec(""),
|
|
1167
|
+
precise: !0
|
|
1168
|
+
}, Yn = "gm" + (/x/.unicode == null ? "" : "u"), Xn = class {
|
|
1169
|
+
constructor(e, t, n, r = 0, i = e.length) {
|
|
1170
|
+
if (this.text = e, this.to = i, this.curLine = "", this.done = !1, this.value = Jn, /\\[sWDnr]|\n|\r|\[\^/.test(t)) return new $n(e, t, n, r, i);
|
|
1171
|
+
this.re = new RegExp(t, Yn + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.iter = e.iter();
|
|
1172
|
+
let a = e.lineAt(r);
|
|
1173
|
+
this.curLineStart = a.from, this.matchPos = L(e, r), this.getLine(this.curLineStart);
|
|
1174
|
+
}
|
|
1175
|
+
getLine(e) {
|
|
1176
|
+
this.iter.next(e), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
|
|
1177
|
+
}
|
|
1178
|
+
nextLine() {
|
|
1179
|
+
this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0);
|
|
1180
|
+
}
|
|
1181
|
+
next() {
|
|
1182
|
+
for (let e = this.matchPos - this.curLineStart;;) {
|
|
1183
|
+
this.re.lastIndex = e;
|
|
1184
|
+
let t = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
1185
|
+
if (t) {
|
|
1186
|
+
let n = this.curLineStart + t.index, r = n + t[0].length;
|
|
1187
|
+
if (this.matchPos = L(this.text, r + +(n == r)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < r || n > this.value.to) && (!this.test || this.test(n, r, t))) return this.value = {
|
|
1188
|
+
from: n,
|
|
1189
|
+
to: r,
|
|
1190
|
+
precise: !0,
|
|
1191
|
+
match: t
|
|
1192
|
+
}, this;
|
|
1193
|
+
e = this.matchPos - this.curLineStart;
|
|
1194
|
+
} else if (this.curLineStart + this.curLine.length < this.to) this.nextLine(), e = 0;
|
|
1195
|
+
else return this.done = !0, this;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}, Zn = /*@__PURE__*/ new WeakMap(), Qn = class e {
|
|
1199
|
+
constructor(e, t) {
|
|
1200
|
+
this.from = e, this.text = t;
|
|
1201
|
+
}
|
|
1202
|
+
get to() {
|
|
1203
|
+
return this.from + this.text.length;
|
|
1204
|
+
}
|
|
1205
|
+
static get(t, n, r) {
|
|
1206
|
+
let i = Zn.get(t);
|
|
1207
|
+
if (!i || i.from >= r || i.to <= n) {
|
|
1208
|
+
let i = new e(n, t.sliceString(n, r));
|
|
1209
|
+
return Zn.set(t, i), i;
|
|
1210
|
+
}
|
|
1211
|
+
if (i.from == n && i.to == r) return i;
|
|
1212
|
+
let { text: a, from: o } = i;
|
|
1213
|
+
return o > n && (a = t.sliceString(n, o) + a, o = n), i.to < r && (a += t.sliceString(i.to, r)), Zn.set(t, new e(o, a)), new e(n, a.slice(n - o, r - o));
|
|
1214
|
+
}
|
|
1215
|
+
}, $n = class {
|
|
1216
|
+
constructor(e, t, n, r, i) {
|
|
1217
|
+
this.text = e, this.to = i, this.done = !1, this.value = Jn, this.matchPos = L(e, r), this.re = new RegExp(t, Yn + (n?.ignoreCase ? "i" : "")), this.test = n?.test, this.flat = Qn.get(e, r, this.chunkEnd(r + 5e3));
|
|
1218
|
+
}
|
|
1219
|
+
chunkEnd(e) {
|
|
1220
|
+
return e >= this.to ? this.to : this.text.lineAt(e).to;
|
|
1221
|
+
}
|
|
1222
|
+
next() {
|
|
1223
|
+
for (;;) {
|
|
1224
|
+
let e = this.re.lastIndex = this.matchPos - this.flat.from, t = this.re.exec(this.flat.text);
|
|
1225
|
+
if (t && !t[0] && t.index == e && (this.re.lastIndex = e + 1, t = this.re.exec(this.flat.text)), t) {
|
|
1226
|
+
let e = this.flat.from + t.index, n = e + t[0].length;
|
|
1227
|
+
if ((this.flat.to >= this.to || t.index + t[0].length <= this.flat.text.length - 10) && (!this.test || this.test(e, n, t))) return this.value = {
|
|
1228
|
+
from: e,
|
|
1229
|
+
to: n,
|
|
1230
|
+
precise: !0,
|
|
1231
|
+
match: t
|
|
1232
|
+
}, this.matchPos = L(this.text, n + +(e == n)), this;
|
|
1233
|
+
}
|
|
1234
|
+
if (this.flat.to == this.to) return this.done = !0, this;
|
|
1235
|
+
this.flat = Qn.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
typeof Symbol < "u" && (Xn.prototype[Symbol.iterator] = $n.prototype[Symbol.iterator] = function() {
|
|
1240
|
+
return this;
|
|
1241
|
+
});
|
|
1242
|
+
function er(e) {
|
|
1243
|
+
try {
|
|
1244
|
+
return new RegExp(e, Yn), !0;
|
|
1245
|
+
} catch {
|
|
1246
|
+
return !1;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
function L(e, t) {
|
|
1250
|
+
if (t >= e.length) return t;
|
|
1251
|
+
let n = e.lineAt(t), r;
|
|
1252
|
+
for (; t < n.to && (r = n.text.charCodeAt(t - n.from)) >= 56320 && r < 57344;) t++;
|
|
1253
|
+
return t;
|
|
1254
|
+
}
|
|
1255
|
+
var tr = (e) => {
|
|
1256
|
+
let { state: t } = e, n = String(t.doc.lineAt(e.state.selection.main.head).number), { close: i, result: a } = ye(e, {
|
|
1257
|
+
label: t.phrase("Go to line"),
|
|
1258
|
+
input: {
|
|
1259
|
+
type: "text",
|
|
1260
|
+
name: "line",
|
|
1261
|
+
value: n
|
|
1262
|
+
},
|
|
1263
|
+
focus: !0,
|
|
1264
|
+
submitLabel: t.phrase("go")
|
|
1265
|
+
});
|
|
1266
|
+
return a.then((n) => {
|
|
1267
|
+
let a = n && /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);
|
|
1268
|
+
if (!a) {
|
|
1269
|
+
e.dispatch({ effects: i });
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
let o = t.doc.lineAt(t.selection.main.head), [, s, c, l, u] = a, d = l ? +l.slice(1) : 0, f = c ? +c : o.number;
|
|
1273
|
+
if (c && u) {
|
|
1274
|
+
let e = f / 100;
|
|
1275
|
+
s && (e = e * (s == "-" ? -1 : 1) + o.number / t.doc.lines), f = Math.round(t.doc.lines * e);
|
|
1276
|
+
} else c && s && (f = f * (s == "-" ? -1 : 1) + o.number);
|
|
1277
|
+
let p = t.doc.line(Math.max(1, Math.min(t.doc.lines, f))), m = r.cursor(p.from + Math.max(0, Math.min(d, p.length)));
|
|
1278
|
+
e.dispatch({
|
|
1279
|
+
effects: [i, v.scrollIntoView(m.from, { y: "center" })],
|
|
1280
|
+
selection: m
|
|
1281
|
+
});
|
|
1282
|
+
}), !0;
|
|
1283
|
+
}, nr = {
|
|
1284
|
+
highlightWordAroundCursor: !1,
|
|
1285
|
+
minSelectionLength: 1,
|
|
1286
|
+
maxMatches: 100,
|
|
1287
|
+
wholeWords: !1
|
|
1288
|
+
}, rr = /*@__PURE__*/ h.define({ combine(e) {
|
|
1289
|
+
return g(e, nr, {
|
|
1290
|
+
highlightWordAroundCursor: (e, t) => e || t,
|
|
1291
|
+
minSelectionLength: Math.min,
|
|
1292
|
+
maxMatches: Math.min
|
|
1293
|
+
});
|
|
1294
|
+
} });
|
|
1295
|
+
function ir(e) {
|
|
1296
|
+
let t = [ur, lr];
|
|
1297
|
+
return e && t.push(rr.of(e)), t;
|
|
1298
|
+
}
|
|
1299
|
+
var ar = /*@__PURE__*/ y.mark({ class: "cm-selectionMatch" }), or = /*@__PURE__*/ y.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
1300
|
+
function sr(e, t, n, r) {
|
|
1301
|
+
return (n == 0 || e(t.sliceDoc(n - 1, n)) != c.Word) && (r == t.doc.length || e(t.sliceDoc(r, r + 1)) != c.Word);
|
|
1302
|
+
}
|
|
1303
|
+
function cr(e, t, n, r) {
|
|
1304
|
+
return e(t.sliceDoc(n, n + 1)) == c.Word && e(t.sliceDoc(r - 1, r)) == c.Word;
|
|
1305
|
+
}
|
|
1306
|
+
var lr = /*@__PURE__*/ se.fromClass(class {
|
|
1307
|
+
constructor(e) {
|
|
1308
|
+
this.decorations = this.getDeco(e);
|
|
1309
|
+
}
|
|
1310
|
+
update(e) {
|
|
1311
|
+
(e.selectionSet || e.docChanged || e.viewportChanged) && (this.decorations = this.getDeco(e.view));
|
|
1312
|
+
}
|
|
1313
|
+
getDeco(e) {
|
|
1314
|
+
let t = e.state.facet(rr), { state: n } = e, r = n.selection;
|
|
1315
|
+
if (r.ranges.length > 1) return y.none;
|
|
1316
|
+
let i = r.main, a, o = null;
|
|
1317
|
+
if (i.empty) {
|
|
1318
|
+
if (!t.highlightWordAroundCursor) return y.none;
|
|
1319
|
+
let e = n.wordAt(i.head);
|
|
1320
|
+
if (!e) return y.none;
|
|
1321
|
+
o = n.charCategorizer(i.head), a = n.sliceDoc(e.from, e.to);
|
|
1322
|
+
} else {
|
|
1323
|
+
let e = i.to - i.from;
|
|
1324
|
+
if (e < t.minSelectionLength || e > 200) return y.none;
|
|
1325
|
+
if (t.wholeWords) {
|
|
1326
|
+
if (a = n.sliceDoc(i.from, i.to), o = n.charCategorizer(i.head), !(sr(o, n, i.from, i.to) && cr(o, n, i.from, i.to))) return y.none;
|
|
1327
|
+
} else if (a = n.sliceDoc(i.from, i.to), !a) return y.none;
|
|
1328
|
+
}
|
|
1329
|
+
let s = [];
|
|
1330
|
+
for (let r of e.visibleRanges) {
|
|
1331
|
+
let e = new I(n.doc, a, r.from, r.to);
|
|
1332
|
+
for (; !e.next().done;) {
|
|
1333
|
+
let { from: r, to: a } = e.value;
|
|
1334
|
+
if ((!o || sr(o, n, r, a)) && (i.empty && r <= i.from && a >= i.to ? s.push(or.range(r, a)) : (r >= i.to || a <= i.from) && s.push(ar.range(r, a)), s.length > t.maxMatches)) return y.none;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
return y.set(s);
|
|
1338
|
+
}
|
|
1339
|
+
}, { decorations: (e) => e.decorations }), ur = /*@__PURE__*/ v.baseTheme({
|
|
1340
|
+
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
1341
|
+
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
1342
|
+
}), dr = ({ state: e, dispatch: t }) => {
|
|
1343
|
+
let { selection: n } = e, i = r.create(n.ranges.map((t) => e.wordAt(t.head) || r.cursor(t.head)), n.mainIndex);
|
|
1344
|
+
return !i.eq(n) && (t(e.update({ selection: i })), !0);
|
|
1345
|
+
};
|
|
1346
|
+
function fr(e, t) {
|
|
1347
|
+
let { main: n, ranges: r } = e.selection, i = e.wordAt(n.head), a = i && i.from == n.from && i.to == n.to;
|
|
1348
|
+
for (let n = !1, i = new I(e.doc, t, r[r.length - 1].to);;) if (i.next(), i.done) {
|
|
1349
|
+
if (n) return null;
|
|
1350
|
+
i = new I(e.doc, t, 0, Math.max(0, r[r.length - 1].from - 1)), n = !0;
|
|
1351
|
+
} else {
|
|
1352
|
+
if (n && r.some((e) => e.from == i.value.from)) continue;
|
|
1353
|
+
if (a) {
|
|
1354
|
+
let t = e.wordAt(i.value.from);
|
|
1355
|
+
if (!t || t.from != i.value.from || t.to != i.value.to) continue;
|
|
1356
|
+
}
|
|
1357
|
+
return i.value;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
var pr = ({ state: e, dispatch: t }) => {
|
|
1361
|
+
let { ranges: n } = e.selection;
|
|
1362
|
+
if (n.some((e) => e.from === e.to)) return dr({
|
|
1363
|
+
state: e,
|
|
1364
|
+
dispatch: t
|
|
1365
|
+
});
|
|
1366
|
+
let i = e.sliceDoc(n[0].from, n[0].to);
|
|
1367
|
+
if (e.selection.ranges.some((t) => e.sliceDoc(t.from, t.to) != i)) return !1;
|
|
1368
|
+
let a = fr(e, i);
|
|
1369
|
+
return a ? (t(e.update({
|
|
1370
|
+
selection: e.selection.addRange(r.range(a.from, a.to), !1),
|
|
1371
|
+
effects: v.scrollIntoView(a.to)
|
|
1372
|
+
})), !0) : !1;
|
|
1373
|
+
}, R = /*@__PURE__*/ h.define({ combine(e) {
|
|
1374
|
+
return g(e, {
|
|
1375
|
+
top: !1,
|
|
1376
|
+
caseSensitive: !1,
|
|
1377
|
+
literal: !1,
|
|
1378
|
+
regexp: !1,
|
|
1379
|
+
wholeWord: !1,
|
|
1380
|
+
createPanel: (e) => new Rr(e),
|
|
1381
|
+
scrollToMatch: (e) => v.scrollIntoView(e)
|
|
1382
|
+
});
|
|
1383
|
+
} }), mr = class {
|
|
1384
|
+
constructor(e) {
|
|
1385
|
+
this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp || er(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord, this.test = e.test;
|
|
1386
|
+
}
|
|
1387
|
+
unquote(e) {
|
|
1388
|
+
return this.literal ? e : e.replace(/\\([nrt\\])/g, (e, t) => t == "n" ? "\n" : t == "r" ? "\r" : t == "t" ? " " : "\\");
|
|
1389
|
+
}
|
|
1390
|
+
eq(e) {
|
|
1391
|
+
return this.search == e.search && this.replace == e.replace && this.caseSensitive == e.caseSensitive && this.regexp == e.regexp && this.wholeWord == e.wholeWord && this.test == e.test;
|
|
1392
|
+
}
|
|
1393
|
+
create() {
|
|
1394
|
+
return this.regexp ? new xr(this) : new vr(this);
|
|
1395
|
+
}
|
|
1396
|
+
getCursor(e, t = 0, n) {
|
|
1397
|
+
let r = e.doc ? e : f.create({ doc: e });
|
|
1398
|
+
return n ??= r.doc.length, this.regexp ? B(this, r, t, n) : z(this, r, t, n);
|
|
1399
|
+
}
|
|
1400
|
+
}, hr = class {
|
|
1401
|
+
constructor(e) {
|
|
1402
|
+
this.spec = e;
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
function gr(e, t, n) {
|
|
1406
|
+
return (r, i, a, o) => n && !n(r, i, a, o) ? !1 : e(r >= o && i <= o + a.length ? a.slice(r - o, i - o) : t.doc.sliceString(r, i), t, r, i);
|
|
1407
|
+
}
|
|
1408
|
+
function z(e, t, n, r) {
|
|
1409
|
+
let i;
|
|
1410
|
+
return e.wholeWord && (i = _r(t.doc, t.charCategorizer(t.selection.main.head))), e.test && (i = gr(e.test, t, i)), new I(t.doc, e.unquoted, n, r, e.caseSensitive ? void 0 : (e) => e.toLowerCase(), i);
|
|
1411
|
+
}
|
|
1412
|
+
function _r(e, t) {
|
|
1413
|
+
return (n, r, i, a) => ((a > n || a + i.length < r) && (a = Math.max(0, n - 2), i = e.sliceString(a, Math.min(e.length, r + 2))), (t(V(i, n - a)) != c.Word || t(H(i, n - a)) != c.Word) && (t(H(i, r - a)) != c.Word || t(V(i, r - a)) != c.Word));
|
|
1414
|
+
}
|
|
1415
|
+
var vr = class extends hr {
|
|
1416
|
+
constructor(e) {
|
|
1417
|
+
super(e);
|
|
1418
|
+
}
|
|
1419
|
+
nextMatch(e, t, n) {
|
|
1420
|
+
let r = z(this.spec, e, n, e.doc.length).nextOverlapping();
|
|
1421
|
+
if (r.done) {
|
|
1422
|
+
let n = Math.min(e.doc.length, t + this.spec.unquoted.length);
|
|
1423
|
+
r = z(this.spec, e, 0, n).nextOverlapping();
|
|
1424
|
+
}
|
|
1425
|
+
return r.done || r.value.from == t && r.value.to == n ? null : r.value;
|
|
1426
|
+
}
|
|
1427
|
+
prevMatchInRange(e, t, n) {
|
|
1428
|
+
for (let r = n;;) {
|
|
1429
|
+
let n = Math.max(t, r - 1e4 - this.spec.unquoted.length), i = z(this.spec, e, n, r), a = null;
|
|
1430
|
+
for (; !i.nextOverlapping().done;) a = i.value;
|
|
1431
|
+
if (a) return a;
|
|
1432
|
+
if (n == t) return null;
|
|
1433
|
+
r -= 1e4;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
prevMatch(e, t, n) {
|
|
1437
|
+
let r = this.prevMatchInRange(e, 0, t);
|
|
1438
|
+
return r ||= this.prevMatchInRange(e, Math.max(0, n - this.spec.unquoted.length), e.doc.length), r && (r.from != t || r.to != n) ? r : null;
|
|
1439
|
+
}
|
|
1440
|
+
getReplacement(e) {
|
|
1441
|
+
return this.spec.unquote(this.spec.replace);
|
|
1442
|
+
}
|
|
1443
|
+
matchAll(e, t) {
|
|
1444
|
+
let n = z(this.spec, e, 0, e.doc.length), r = [];
|
|
1445
|
+
for (; !n.next().done;) {
|
|
1446
|
+
if (r.length >= t) return null;
|
|
1447
|
+
r.push(n.value);
|
|
1448
|
+
}
|
|
1449
|
+
return r;
|
|
1450
|
+
}
|
|
1451
|
+
highlight(e, t, n, r) {
|
|
1452
|
+
let i = z(this.spec, e, Math.max(0, t - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length));
|
|
1453
|
+
for (; !i.next().done;) r(i.value.from, i.value.to);
|
|
1454
|
+
}
|
|
1455
|
+
};
|
|
1456
|
+
function yr(e, t, n) {
|
|
1457
|
+
return (r, i, a) => (!n || n(r, i, a)) && e(a[0], t, r, i);
|
|
1458
|
+
}
|
|
1459
|
+
function B(e, t, n, r) {
|
|
1460
|
+
let i;
|
|
1461
|
+
return e.wholeWord && (i = br(t.charCategorizer(t.selection.main.head))), e.test && (i = yr(e.test, t, i)), new Xn(t.doc, e.search, {
|
|
1462
|
+
ignoreCase: !e.caseSensitive,
|
|
1463
|
+
test: i
|
|
1464
|
+
}, n, r);
|
|
1465
|
+
}
|
|
1466
|
+
function V(e, n) {
|
|
1467
|
+
return e.slice(t(e, n, !1), n);
|
|
1468
|
+
}
|
|
1469
|
+
function H(e, n) {
|
|
1470
|
+
return e.slice(n, t(e, n));
|
|
1471
|
+
}
|
|
1472
|
+
function br(e) {
|
|
1473
|
+
return (t, n, r) => !r[0].length || (e(V(r.input, r.index)) != c.Word || e(H(r.input, r.index)) != c.Word) && (e(H(r.input, r.index + r[0].length)) != c.Word || e(V(r.input, r.index + r[0].length)) != c.Word);
|
|
1474
|
+
}
|
|
1475
|
+
var xr = class extends hr {
|
|
1476
|
+
nextMatch(e, t, n) {
|
|
1477
|
+
let r = B(this.spec, e, n, e.doc.length).next();
|
|
1478
|
+
return r.done && (r = B(this.spec, e, 0, t).next()), r.done ? null : r.value;
|
|
1479
|
+
}
|
|
1480
|
+
prevMatchInRange(e, t, n) {
|
|
1481
|
+
for (let r = 1;; r++) {
|
|
1482
|
+
let i = Math.max(t, n - r * 1e4), a = B(this.spec, e, i, n), o = null;
|
|
1483
|
+
for (; !a.next().done;) o = a.value;
|
|
1484
|
+
if (o && (i == t || o.from > i + 10)) return o;
|
|
1485
|
+
if (i == t) return null;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
prevMatch(e, t, n) {
|
|
1489
|
+
return this.prevMatchInRange(e, 0, t) || this.prevMatchInRange(e, n, e.doc.length);
|
|
1490
|
+
}
|
|
1491
|
+
getReplacement(e) {
|
|
1492
|
+
return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (t, n) => {
|
|
1493
|
+
if (n == "&") return e.match[0];
|
|
1494
|
+
if (n == "$") return "$";
|
|
1495
|
+
for (let t = n.length; t > 0; t--) {
|
|
1496
|
+
let r = +n.slice(0, t);
|
|
1497
|
+
if (r > 0 && r < e.match.length) return e.match[r] + n.slice(t);
|
|
1498
|
+
}
|
|
1499
|
+
return t;
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
matchAll(e, t) {
|
|
1503
|
+
let n = B(this.spec, e, 0, e.doc.length), r = [];
|
|
1504
|
+
for (; !n.next().done;) {
|
|
1505
|
+
if (r.length >= t) return null;
|
|
1506
|
+
r.push(n.value);
|
|
1507
|
+
}
|
|
1508
|
+
return r;
|
|
1509
|
+
}
|
|
1510
|
+
highlight(e, t, n, r) {
|
|
1511
|
+
let i = B(this.spec, e, Math.max(0, t - 250), Math.min(n + 250, e.doc.length));
|
|
1512
|
+
for (; !i.next().done;) r(i.value.from, i.value.to);
|
|
1513
|
+
}
|
|
1514
|
+
}, U = /*@__PURE__*/ p.define(), Sr = /*@__PURE__*/ p.define(), W = /*@__PURE__*/ u.define({
|
|
1515
|
+
create(e) {
|
|
1516
|
+
return new Cr(Mr(e).create(), null);
|
|
1517
|
+
},
|
|
1518
|
+
update(e, t) {
|
|
1519
|
+
for (let n of t.effects) n.is(U) ? e = new Cr(n.value.create(), e.panel) : n.is(Sr) && (e = new Cr(e.query, n.value ? jr : null));
|
|
1520
|
+
return e;
|
|
1521
|
+
},
|
|
1522
|
+
provide: (e) => ae.from(e, (e) => e.panel)
|
|
1523
|
+
}), Cr = class {
|
|
1524
|
+
constructor(e, t) {
|
|
1525
|
+
this.query = e, this.panel = t;
|
|
1526
|
+
}
|
|
1527
|
+
}, wr = /*@__PURE__*/ y.mark({ class: "cm-searchMatch" }), Tr = /*@__PURE__*/ y.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), Er = /*@__PURE__*/ se.fromClass(class {
|
|
1528
|
+
constructor(e) {
|
|
1529
|
+
this.view = e, this.decorations = this.highlight(e.state.field(W));
|
|
1530
|
+
}
|
|
1531
|
+
update(e) {
|
|
1532
|
+
let t = e.state.field(W);
|
|
1533
|
+
(t != e.startState.field(W) || e.docChanged || e.selectionSet || e.viewportChanged) && (this.decorations = this.highlight(t));
|
|
1534
|
+
}
|
|
1535
|
+
highlight({ query: e, panel: t }) {
|
|
1536
|
+
if (!t || !e.spec.valid) return y.none;
|
|
1537
|
+
let { view: n } = this, r = new a();
|
|
1538
|
+
for (let t = 0, i = n.visibleRanges, a = i.length; t < a; t++) {
|
|
1539
|
+
let { from: o, to: s } = i[t];
|
|
1540
|
+
for (; t < a - 1 && s > i[t + 1].from - 500;) s = i[++t].to;
|
|
1541
|
+
e.highlight(n.state, o, s, (e, t) => {
|
|
1542
|
+
let i = n.state.selection.ranges.some((n) => n.from == e && n.to == t);
|
|
1543
|
+
r.add(e, t, i ? Tr : wr);
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
return r.finish();
|
|
1547
|
+
}
|
|
1548
|
+
}, { decorations: (e) => e.decorations });
|
|
1549
|
+
function G(e) {
|
|
1550
|
+
return (t) => {
|
|
1551
|
+
let n = t.state.field(W, !1);
|
|
1552
|
+
return n && n.query.spec.valid ? e(t, n) : Fr(t);
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
var K = /*@__PURE__*/ G((e, { query: t }) => {
|
|
1556
|
+
let { to: n } = e.state.selection.main, i = t.nextMatch(e.state, n, n);
|
|
1557
|
+
if (!i) return !1;
|
|
1558
|
+
let a = r.single(i.from, i.to), o = e.state.facet(R);
|
|
1559
|
+
return e.dispatch({
|
|
1560
|
+
selection: a,
|
|
1561
|
+
effects: [Br(e, i), o.scrollToMatch(a.main, e)],
|
|
1562
|
+
userEvent: "select.search"
|
|
1563
|
+
}), Pr(e), !0;
|
|
1564
|
+
}), q = /*@__PURE__*/ G((e, { query: t }) => {
|
|
1565
|
+
let { state: n } = e, { from: i } = n.selection.main, a = t.prevMatch(n, i, i);
|
|
1566
|
+
if (!a) return !1;
|
|
1567
|
+
let o = r.single(a.from, a.to), s = e.state.facet(R);
|
|
1568
|
+
return e.dispatch({
|
|
1569
|
+
selection: o,
|
|
1570
|
+
effects: [Br(e, a), s.scrollToMatch(o.main, e)],
|
|
1571
|
+
userEvent: "select.search"
|
|
1572
|
+
}), Pr(e), !0;
|
|
1573
|
+
}), Dr = /*@__PURE__*/ G((e, { query: t }) => {
|
|
1574
|
+
let n = t.matchAll(e.state, 1e3);
|
|
1575
|
+
return !n || !n.length ? !1 : (e.dispatch({
|
|
1576
|
+
selection: r.create(n.map((e) => r.range(e.from, e.to))),
|
|
1577
|
+
userEvent: "select.search.matches"
|
|
1578
|
+
}), !0);
|
|
1579
|
+
}), Or = ({ state: e, dispatch: t }) => {
|
|
1580
|
+
let n = e.selection;
|
|
1581
|
+
if (n.ranges.length > 1 || n.main.empty) return !1;
|
|
1582
|
+
let { from: i, to: a } = n.main, o = [], s = 0;
|
|
1583
|
+
for (let t = new I(e.doc, e.sliceDoc(i, a)); !t.next().done;) {
|
|
1584
|
+
if (o.length > 1e3) return !1;
|
|
1585
|
+
t.value.from == i && (s = o.length), o.push(r.range(t.value.from, t.value.to));
|
|
1586
|
+
}
|
|
1587
|
+
return t(e.update({
|
|
1588
|
+
selection: r.create(o, s),
|
|
1589
|
+
userEvent: "select.search.matches"
|
|
1590
|
+
})), !0;
|
|
1591
|
+
}, kr = /*@__PURE__*/ G((e, { query: t }) => {
|
|
1592
|
+
let { state: n } = e, { from: i, to: a } = n.selection.main;
|
|
1593
|
+
if (n.readOnly) return !1;
|
|
1594
|
+
let o = t.nextMatch(n, i, i);
|
|
1595
|
+
if (!o) return !1;
|
|
1596
|
+
let s = o, c = [], l, u, d = [];
|
|
1597
|
+
s.precise ? s.from == i && s.to == a && (u = n.toText(t.getReplacement(s)), c.push({
|
|
1598
|
+
from: s.from,
|
|
1599
|
+
to: s.to,
|
|
1600
|
+
insert: u
|
|
1601
|
+
}), s = t.nextMatch(n, s.from, s.to), d.push(v.announce.of(n.phrase("replaced match on line $", n.doc.lineAt(i).number) + "."))) : s = t.nextMatch(n, s.from, s.to);
|
|
1602
|
+
let f = e.state.changes(c);
|
|
1603
|
+
return s && (l = r.single(s.from, s.to).map(f), d.push(Br(e, s)), d.push(n.facet(R).scrollToMatch(l.main, e))), e.dispatch({
|
|
1604
|
+
changes: f,
|
|
1605
|
+
selection: l,
|
|
1606
|
+
effects: d,
|
|
1607
|
+
userEvent: "input.replace"
|
|
1608
|
+
}), !0;
|
|
1609
|
+
}), Ar = /*@__PURE__*/ G((e, { query: t }) => {
|
|
1610
|
+
if (e.state.readOnly) return !1;
|
|
1611
|
+
let n = [];
|
|
1612
|
+
for (let r of t.matchAll(e.state, 1e9)) {
|
|
1613
|
+
let { from: e, to: i, precise: a } = r;
|
|
1614
|
+
a && n.push({
|
|
1615
|
+
from: e,
|
|
1616
|
+
to: i,
|
|
1617
|
+
insert: t.getReplacement(r)
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
if (!n.length) return !1;
|
|
1621
|
+
let r = e.state.phrase("replaced $ matches", n.length) + ".";
|
|
1622
|
+
return e.dispatch({
|
|
1623
|
+
changes: n,
|
|
1624
|
+
effects: v.announce.of(r),
|
|
1625
|
+
userEvent: "input.replace.all"
|
|
1626
|
+
}), !0;
|
|
1627
|
+
});
|
|
1628
|
+
function jr(e) {
|
|
1629
|
+
return e.state.facet(R).createPanel(e);
|
|
1630
|
+
}
|
|
1631
|
+
function Mr(e, t) {
|
|
1632
|
+
let n = e.selection.main, r = n.empty || n.to > n.from + 100 ? "" : e.sliceDoc(n.from, n.to);
|
|
1633
|
+
if (t && !r) return t;
|
|
1634
|
+
let i = e.facet(R);
|
|
1635
|
+
return new mr({
|
|
1636
|
+
search: t?.literal ?? i.literal ? r : r.replace(/\n/g, "\\n"),
|
|
1637
|
+
caseSensitive: t?.caseSensitive ?? i.caseSensitive,
|
|
1638
|
+
literal: t?.literal ?? i.literal,
|
|
1639
|
+
regexp: t?.regexp ?? i.regexp,
|
|
1640
|
+
wholeWord: t?.wholeWord ?? i.wholeWord
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
function Nr(e) {
|
|
1644
|
+
let t = de(e, jr);
|
|
1645
|
+
return t && t.dom.querySelector("[main-field]");
|
|
1646
|
+
}
|
|
1647
|
+
function Pr(e) {
|
|
1648
|
+
let t = Nr(e);
|
|
1649
|
+
t && t == e.root.activeElement && t.select();
|
|
1650
|
+
}
|
|
1651
|
+
var Fr = (e) => {
|
|
1652
|
+
let t = e.state.field(W, !1);
|
|
1653
|
+
if (t && t.panel) {
|
|
1654
|
+
let n = Nr(e);
|
|
1655
|
+
if (n && n != e.root.activeElement) {
|
|
1656
|
+
let r = Mr(e.state, t.query.spec);
|
|
1657
|
+
r.valid && e.dispatch({ effects: U.of(r) }), n.focus(), n.select();
|
|
1658
|
+
}
|
|
1659
|
+
} else e.dispatch({ effects: [Sr.of(!0), t ? U.of(Mr(e.state, t.query.spec)) : p.appendConfig.of(Hr)] });
|
|
1660
|
+
return !0;
|
|
1661
|
+
}, Ir = (e) => {
|
|
1662
|
+
let t = e.state.field(W, !1);
|
|
1663
|
+
if (!t || !t.panel) return !1;
|
|
1664
|
+
let n = de(e, jr);
|
|
1665
|
+
return n && n.dom.contains(e.root.activeElement) && e.focus(), e.dispatch({ effects: Sr.of(!1) }), !0;
|
|
1666
|
+
}, Lr = [
|
|
1667
|
+
{
|
|
1668
|
+
key: "Mod-f",
|
|
1669
|
+
run: Fr,
|
|
1670
|
+
scope: "editor search-panel"
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
key: "F3",
|
|
1674
|
+
run: K,
|
|
1675
|
+
shift: q,
|
|
1676
|
+
scope: "editor search-panel",
|
|
1677
|
+
preventDefault: !0
|
|
1678
|
+
},
|
|
1679
|
+
{
|
|
1680
|
+
key: "Mod-g",
|
|
1681
|
+
run: K,
|
|
1682
|
+
shift: q,
|
|
1683
|
+
scope: "editor search-panel",
|
|
1684
|
+
preventDefault: !0
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
key: "Escape",
|
|
1688
|
+
run: Ir,
|
|
1689
|
+
scope: "editor search-panel"
|
|
1690
|
+
},
|
|
1691
|
+
{
|
|
1692
|
+
key: "Mod-Shift-l",
|
|
1693
|
+
run: Or
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
key: "Mod-Alt-g",
|
|
1697
|
+
run: tr
|
|
1698
|
+
},
|
|
1699
|
+
{
|
|
1700
|
+
key: "Mod-d",
|
|
1701
|
+
run: pr,
|
|
1702
|
+
preventDefault: !0
|
|
1703
|
+
}
|
|
1704
|
+
], Rr = class {
|
|
1705
|
+
constructor(e) {
|
|
1706
|
+
this.view = e;
|
|
1707
|
+
let t = this.query = e.state.field(W).query.spec;
|
|
1708
|
+
this.commit = this.commit.bind(this), this.searchField = _("input", {
|
|
1709
|
+
value: t.search,
|
|
1710
|
+
placeholder: J(e, "Find"),
|
|
1711
|
+
"aria-label": J(e, "Find"),
|
|
1712
|
+
class: "cm-textfield",
|
|
1713
|
+
name: "search",
|
|
1714
|
+
form: "",
|
|
1715
|
+
"main-field": "true",
|
|
1716
|
+
onchange: this.commit,
|
|
1717
|
+
onkeyup: this.commit
|
|
1718
|
+
}), this.replaceField = _("input", {
|
|
1719
|
+
value: t.replace,
|
|
1720
|
+
placeholder: J(e, "Replace"),
|
|
1721
|
+
"aria-label": J(e, "Replace"),
|
|
1722
|
+
class: "cm-textfield",
|
|
1723
|
+
name: "replace",
|
|
1724
|
+
form: "",
|
|
1725
|
+
onchange: this.commit,
|
|
1726
|
+
onkeyup: this.commit
|
|
1727
|
+
}), this.caseField = _("input", {
|
|
1728
|
+
type: "checkbox",
|
|
1729
|
+
name: "case",
|
|
1730
|
+
form: "",
|
|
1731
|
+
checked: t.caseSensitive,
|
|
1732
|
+
onchange: this.commit
|
|
1733
|
+
}), this.reField = _("input", {
|
|
1734
|
+
type: "checkbox",
|
|
1735
|
+
name: "re",
|
|
1736
|
+
form: "",
|
|
1737
|
+
checked: t.regexp,
|
|
1738
|
+
onchange: this.commit
|
|
1739
|
+
}), this.wordField = _("input", {
|
|
1740
|
+
type: "checkbox",
|
|
1741
|
+
name: "word",
|
|
1742
|
+
form: "",
|
|
1743
|
+
checked: t.wholeWord,
|
|
1744
|
+
onchange: this.commit
|
|
1745
|
+
});
|
|
1746
|
+
function n(e, t, n) {
|
|
1747
|
+
return _("button", {
|
|
1748
|
+
class: "cm-button",
|
|
1749
|
+
name: e,
|
|
1750
|
+
onclick: t,
|
|
1751
|
+
type: "button"
|
|
1752
|
+
}, n);
|
|
1753
|
+
}
|
|
1754
|
+
this.dom = _("div", {
|
|
1755
|
+
onkeydown: (e) => this.keydown(e),
|
|
1756
|
+
class: "cm-search"
|
|
1757
|
+
}, [
|
|
1758
|
+
this.searchField,
|
|
1759
|
+
n("next", () => K(e), [J(e, "next")]),
|
|
1760
|
+
n("prev", () => q(e), [J(e, "previous")]),
|
|
1761
|
+
n("select", () => Dr(e), [J(e, "all")]),
|
|
1762
|
+
_("label", null, [this.caseField, J(e, "match case")]),
|
|
1763
|
+
_("label", null, [this.reField, J(e, "regexp")]),
|
|
1764
|
+
_("label", null, [this.wordField, J(e, "by word")]),
|
|
1765
|
+
...e.state.readOnly ? [] : [
|
|
1766
|
+
_("br"),
|
|
1767
|
+
this.replaceField,
|
|
1768
|
+
n("replace", () => kr(e), [J(e, "replace")]),
|
|
1769
|
+
n("replaceAll", () => Ar(e), [J(e, "replace all")])
|
|
1770
|
+
],
|
|
1771
|
+
_("button", {
|
|
1772
|
+
name: "close",
|
|
1773
|
+
onclick: () => Ir(e),
|
|
1774
|
+
"aria-label": J(e, "close"),
|
|
1775
|
+
type: "button"
|
|
1776
|
+
}, ["×"])
|
|
1777
|
+
]);
|
|
1778
|
+
}
|
|
1779
|
+
commit() {
|
|
1780
|
+
let e = new mr({
|
|
1781
|
+
search: this.searchField.value,
|
|
1782
|
+
caseSensitive: this.caseField.checked,
|
|
1783
|
+
regexp: this.reField.checked,
|
|
1784
|
+
wholeWord: this.wordField.checked,
|
|
1785
|
+
replace: this.replaceField.value
|
|
1786
|
+
});
|
|
1787
|
+
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: U.of(e) }));
|
|
1788
|
+
}
|
|
1789
|
+
keydown(e) {
|
|
1790
|
+
re(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? q : K)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), kr(this.view));
|
|
1791
|
+
}
|
|
1792
|
+
update(e) {
|
|
1793
|
+
for (let t of e.transactions) for (let e of t.effects) e.is(U) && !e.value.eq(this.query) && this.setQuery(e.value);
|
|
1794
|
+
}
|
|
1795
|
+
setQuery(e) {
|
|
1796
|
+
this.query = e, this.searchField.value = e.search, this.replaceField.value = e.replace, this.caseField.checked = e.caseSensitive, this.reField.checked = e.regexp, this.wordField.checked = e.wholeWord;
|
|
1797
|
+
}
|
|
1798
|
+
mount() {
|
|
1799
|
+
this.searchField.select();
|
|
1800
|
+
}
|
|
1801
|
+
get pos() {
|
|
1802
|
+
return 80;
|
|
1803
|
+
}
|
|
1804
|
+
get top() {
|
|
1805
|
+
return this.view.state.facet(R).top;
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1808
|
+
function J(e, t) {
|
|
1809
|
+
return e.state.phrase(t);
|
|
1810
|
+
}
|
|
1811
|
+
var Y = 30, zr = /[\s\.,:;?!]/;
|
|
1812
|
+
function Br(e, { from: t, to: n }) {
|
|
1813
|
+
let r = e.state.doc.lineAt(t), i = e.state.doc.lineAt(n).to, a = Math.max(r.from, t - Y), o = Math.min(i, n + Y), s = e.state.sliceDoc(a, o);
|
|
1814
|
+
if (a != r.from) {
|
|
1815
|
+
for (let e = 0; e < Y; e++) if (!zr.test(s[e + 1]) && zr.test(s[e])) {
|
|
1816
|
+
s = s.slice(e);
|
|
1817
|
+
break;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
if (o != i) {
|
|
1821
|
+
for (let e = s.length - 1; e > s.length - Y; e--) if (!zr.test(s[e - 1]) && zr.test(s[e])) {
|
|
1822
|
+
s = s.slice(0, e);
|
|
1823
|
+
break;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
return v.announce.of(`${e.state.phrase("current match")}. ${s} ${e.state.phrase("on line")} ${r.number}.`);
|
|
1827
|
+
}
|
|
1828
|
+
var Vr = /*@__PURE__*/ v.baseTheme({
|
|
1829
|
+
".cm-panel.cm-search": {
|
|
1830
|
+
padding: "2px 6px 4px",
|
|
1831
|
+
position: "relative",
|
|
1832
|
+
"& [name=close]": {
|
|
1833
|
+
position: "absolute",
|
|
1834
|
+
top: "0",
|
|
1835
|
+
right: "4px",
|
|
1836
|
+
backgroundColor: "inherit",
|
|
1837
|
+
border: "none",
|
|
1838
|
+
font: "inherit",
|
|
1839
|
+
padding: 0,
|
|
1840
|
+
margin: 0
|
|
1841
|
+
},
|
|
1842
|
+
"& input, & button, & label": { margin: ".2em .6em .2em 0" },
|
|
1843
|
+
"& input[type=checkbox]": { marginRight: ".2em" },
|
|
1844
|
+
"& label": {
|
|
1845
|
+
fontSize: "80%",
|
|
1846
|
+
whiteSpace: "pre"
|
|
1847
|
+
}
|
|
1848
|
+
},
|
|
1849
|
+
"&light .cm-searchMatch": { backgroundColor: "#ffff0054" },
|
|
1850
|
+
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
1851
|
+
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
1852
|
+
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
1853
|
+
}), Hr = [
|
|
1854
|
+
W,
|
|
1855
|
+
/*@__PURE__*/ l.low(Er),
|
|
1856
|
+
Vr
|
|
1857
|
+
], Ur = class {
|
|
1858
|
+
constructor(e, t, n) {
|
|
1859
|
+
this.from = e, this.to = t, this.diagnostic = n;
|
|
1860
|
+
}
|
|
1861
|
+
}, X = class e {
|
|
1862
|
+
constructor(e, t, n) {
|
|
1863
|
+
this.diagnostics = e, this.panel = t, this.selected = n;
|
|
1864
|
+
}
|
|
1865
|
+
static init(t, n, r) {
|
|
1866
|
+
let i = r.facet($).markerFilter;
|
|
1867
|
+
i && (t = i(t, r));
|
|
1868
|
+
let o = t.slice().sort((e, t) => e.from - t.from || e.to - t.to), s = new a(), c = [], l = 0, u = r.doc.iter(), d = 0, f = r.doc.length;
|
|
1869
|
+
for (let e = 0;;) {
|
|
1870
|
+
let t = e == o.length ? null : o[e];
|
|
1871
|
+
if (!t && !c.length) break;
|
|
1872
|
+
let n, r;
|
|
1873
|
+
if (c.length) n = l, r = c.reduce((e, t) => Math.min(e, t.to), t && t.from > n ? t.from : 1e8);
|
|
1874
|
+
else {
|
|
1875
|
+
if (n = t.from, n > f) break;
|
|
1876
|
+
r = t.to, c.push(t), e++;
|
|
1877
|
+
}
|
|
1878
|
+
for (; e < o.length;) {
|
|
1879
|
+
let t = o[e];
|
|
1880
|
+
if (t.from == n && (t.to > t.from || t.to == n)) c.push(t), e++, r = Math.min(t.to, r);
|
|
1881
|
+
else {
|
|
1882
|
+
r = Math.min(t.from, r);
|
|
1883
|
+
break;
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
r = Math.min(r, f);
|
|
1887
|
+
let i = !1;
|
|
1888
|
+
if (c.some((e) => e.from == n && (e.to == r || r == f)) && (i = n == r, !i && r - n < 10)) {
|
|
1889
|
+
let e = n - (d + u.value.length);
|
|
1890
|
+
e > 0 && (u.next(e), d = n);
|
|
1891
|
+
for (let e = n;;) {
|
|
1892
|
+
if (e >= r) {
|
|
1893
|
+
i = !0;
|
|
1894
|
+
break;
|
|
1895
|
+
}
|
|
1896
|
+
if (!u.lineBreak && d + u.value.length > e) break;
|
|
1897
|
+
e = d + u.value.length, d += u.value.length, u.next();
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
let a = di(c);
|
|
1901
|
+
if (i) s.add(n, n, y.widget({
|
|
1902
|
+
widget: new ii(a),
|
|
1903
|
+
diagnostics: c.slice()
|
|
1904
|
+
}));
|
|
1905
|
+
else {
|
|
1906
|
+
let e = c.reduce((e, t) => t.markClass ? e + " " + t.markClass : e, "");
|
|
1907
|
+
s.add(n, r, y.mark({
|
|
1908
|
+
class: "cm-lintRange cm-lintRange-" + a + e,
|
|
1909
|
+
diagnostics: c.slice(),
|
|
1910
|
+
inclusiveEnd: c.some((e) => e.to > r)
|
|
1911
|
+
}));
|
|
1912
|
+
}
|
|
1913
|
+
if (l = r, l == f) break;
|
|
1914
|
+
for (let e = 0; e < c.length; e++) c[e].to <= l && c.splice(e--, 1);
|
|
1915
|
+
}
|
|
1916
|
+
let p = s.finish();
|
|
1917
|
+
return new e(p, n, Z(p));
|
|
1918
|
+
}
|
|
1919
|
+
};
|
|
1920
|
+
function Z(e, t = null, n = 0) {
|
|
1921
|
+
let r = null;
|
|
1922
|
+
return e.between(n, 1e9, (e, n, { spec: i }) => {
|
|
1923
|
+
if (!(t && i.diagnostics.indexOf(t) < 0)) {
|
|
1924
|
+
if (!r) r = new Ur(e, n, t || i.diagnostics[0]);
|
|
1925
|
+
else if (i.diagnostics.indexOf(r.diagnostic) < 0) return !1;
|
|
1926
|
+
else r = new Ur(r.from, n, r.diagnostic);
|
|
1927
|
+
}
|
|
1928
|
+
}), r;
|
|
1929
|
+
}
|
|
1930
|
+
function Wr(e, t) {
|
|
1931
|
+
let n = t.pos, r = t.end || n, i = e.state.facet($).hideOn(e, n, r);
|
|
1932
|
+
if (i != null) return i;
|
|
1933
|
+
let a = e.startState.doc.lineAt(t.pos);
|
|
1934
|
+
return !!(e.effects.some((e) => e.is(Kr)) || e.changes.touchesRange(a.from, Math.max(a.to, r)));
|
|
1935
|
+
}
|
|
1936
|
+
function Gr(e, t) {
|
|
1937
|
+
return e.field(Q, !1) ? t : t.concat(p.appendConfig.of(pi));
|
|
1938
|
+
}
|
|
1939
|
+
var Kr = /*@__PURE__*/ p.define(), qr = /*@__PURE__*/ p.define(), Jr = /*@__PURE__*/ p.define(), Q = /*@__PURE__*/ u.define({
|
|
1940
|
+
create() {
|
|
1941
|
+
return new X(y.none, null, null);
|
|
1942
|
+
},
|
|
1943
|
+
update(e, t) {
|
|
1944
|
+
if (t.docChanged && e.diagnostics.size) {
|
|
1945
|
+
let n = e.diagnostics.map(t.changes), r = null, i = e.panel;
|
|
1946
|
+
if (e.selected) {
|
|
1947
|
+
let i = t.changes.mapPos(e.selected.from, 1);
|
|
1948
|
+
r = Z(n, e.selected.diagnostic, i) || Z(n, null, i);
|
|
1949
|
+
}
|
|
1950
|
+
!n.size && i && t.state.facet($).autoPanel && (i = null), e = new X(n, i, r);
|
|
1951
|
+
}
|
|
1952
|
+
for (let n of t.effects) if (n.is(Kr)) {
|
|
1953
|
+
let r = t.state.facet($).autoPanel ? n.value.length ? oi.open : null : e.panel;
|
|
1954
|
+
e = X.init(n.value, r, t.state);
|
|
1955
|
+
} else n.is(qr) ? e = new X(e.diagnostics, n.value ? oi.open : null, e.selected) : n.is(Jr) && (e = new X(e.diagnostics, e.panel, n.value));
|
|
1956
|
+
return e;
|
|
1957
|
+
},
|
|
1958
|
+
provide: (e) => [ae.from(e, (e) => e.panel), v.decorations.from(e, (e) => e.diagnostics)]
|
|
1959
|
+
}), Yr = /*@__PURE__*/ y.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
1960
|
+
function Xr(e, t, n) {
|
|
1961
|
+
let { diagnostics: r } = e.state.field(Q), i, a = -1, o = -1;
|
|
1962
|
+
r.between(t - +(n < 0), t + +(n > 0), (e, r, { spec: s }) => {
|
|
1963
|
+
if (t >= e && t <= r && (e == r || (t > e || n > 0) && (t < r || n < 0))) return i = s.diagnostics, a = e, o = r, !1;
|
|
1964
|
+
});
|
|
1965
|
+
let s = e.state.facet($).tooltipFilter;
|
|
1966
|
+
return i && s && (i = s(i, e.state)), i ? {
|
|
1967
|
+
pos: a,
|
|
1968
|
+
end: o,
|
|
1969
|
+
above: !0,
|
|
1970
|
+
create() {
|
|
1971
|
+
return { dom: Zr(e, i) };
|
|
1972
|
+
}
|
|
1973
|
+
} : null;
|
|
1974
|
+
}
|
|
1975
|
+
function Zr(e, t) {
|
|
1976
|
+
return _("ul", { class: "cm-tooltip-lint" }, t.map((t) => ri(e, t, !1)));
|
|
1977
|
+
}
|
|
1978
|
+
var Qr = (e) => {
|
|
1979
|
+
let t = e.state.field(Q, !1);
|
|
1980
|
+
(!t || !t.panel) && e.dispatch({ effects: Gr(e.state, [qr.of(!0)]) });
|
|
1981
|
+
let n = de(e, oi.open);
|
|
1982
|
+
return n && n.dom.querySelector(".cm-panel-lint ul").focus(), !0;
|
|
1983
|
+
}, $r = (e) => {
|
|
1984
|
+
let t = e.state.field(Q, !1);
|
|
1985
|
+
return !t || !t.panel ? !1 : (e.dispatch({ effects: qr.of(!1) }), !0);
|
|
1986
|
+
}, ei = [{
|
|
1987
|
+
key: "Mod-Shift-m",
|
|
1988
|
+
run: Qr,
|
|
1989
|
+
preventDefault: !0
|
|
1990
|
+
}, {
|
|
1991
|
+
key: "F8",
|
|
1992
|
+
run: (e) => {
|
|
1993
|
+
let t = e.state.field(Q, !1);
|
|
1994
|
+
if (!t) return !1;
|
|
1995
|
+
let n = e.state.selection.main, r = Z(t.diagnostics, null, n.to + 1);
|
|
1996
|
+
return !r && (r = Z(t.diagnostics, null, 0), !r || r.from == n.from && r.to == n.to) ? !1 : (e.dispatch({
|
|
1997
|
+
selection: {
|
|
1998
|
+
anchor: r.from,
|
|
1999
|
+
head: r.to
|
|
2000
|
+
},
|
|
2001
|
+
scrollIntoView: !0
|
|
2002
|
+
}), ge(e, r.from, 1, {
|
|
2003
|
+
tooltip: fi,
|
|
2004
|
+
until: (e) => e.docChanged || e.newSelection.main.head < r.from || e.newSelection.main.head > r.to
|
|
2005
|
+
}), !0);
|
|
2006
|
+
}
|
|
2007
|
+
}], $ = /*@__PURE__*/ h.define({ combine(e) {
|
|
2008
|
+
return {
|
|
2009
|
+
sources: e.map((e) => e.source).filter((e) => e != null),
|
|
2010
|
+
...g(e.map((e) => e.config), {
|
|
2011
|
+
delay: 750,
|
|
2012
|
+
markerFilter: null,
|
|
2013
|
+
tooltipFilter: null,
|
|
2014
|
+
needsRefresh: null,
|
|
2015
|
+
hideOn: () => null
|
|
2016
|
+
}, {
|
|
2017
|
+
delay: Math.max,
|
|
2018
|
+
markerFilter: ti,
|
|
2019
|
+
tooltipFilter: ti,
|
|
2020
|
+
needsRefresh: (e, t) => e ? t ? (n) => e(n) || t(n) : e : t,
|
|
2021
|
+
hideOn: (e, t) => e ? t ? (n, r, i) => e(n, r, i) || t(n, r, i) : e : t,
|
|
2022
|
+
autoPanel: (e, t) => e || t
|
|
2023
|
+
})
|
|
2024
|
+
};
|
|
2025
|
+
} });
|
|
2026
|
+
function ti(e, t) {
|
|
2027
|
+
return e ? t ? (n, r) => t(e(n, r), r) : e : t;
|
|
2028
|
+
}
|
|
2029
|
+
function ni(e) {
|
|
2030
|
+
let t = [];
|
|
2031
|
+
if (e) actions: for (let { name: n } of e) {
|
|
2032
|
+
for (let e = 0; e < n.length; e++) {
|
|
2033
|
+
let r = n[e];
|
|
2034
|
+
if (/[a-zA-Z]/.test(r) && !t.some((e) => e.toLowerCase() == r.toLowerCase())) {
|
|
2035
|
+
t.push(r);
|
|
2036
|
+
continue actions;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
t.push("");
|
|
2040
|
+
}
|
|
2041
|
+
return t;
|
|
2042
|
+
}
|
|
2043
|
+
function ri(e, t, n) {
|
|
2044
|
+
let r = n ? ni(t.actions) : [];
|
|
2045
|
+
return _("li", { class: "cm-diagnostic cm-diagnostic-" + t.severity }, _("span", { class: "cm-diagnosticText" }, t.renderMessage ? t.renderMessage(e) : t.message), t.actions?.map((n, i) => {
|
|
2046
|
+
let a = !1, o = (r) => {
|
|
2047
|
+
if (r.preventDefault(), a) return;
|
|
2048
|
+
a = !0;
|
|
2049
|
+
let i = Z(e.state.field(Q).diagnostics, t);
|
|
2050
|
+
i && n.apply(e, i.from, i.to);
|
|
2051
|
+
}, { name: s } = n, c = r[i] ? s.indexOf(r[i]) : -1, l = c < 0 ? s : [
|
|
2052
|
+
s.slice(0, c),
|
|
2053
|
+
_("u", s.slice(c, c + 1)),
|
|
2054
|
+
s.slice(c + 1)
|
|
2055
|
+
], u = n.markClass ? " " + n.markClass : "";
|
|
2056
|
+
return _("button", {
|
|
2057
|
+
type: "button",
|
|
2058
|
+
class: "cm-diagnosticAction" + u,
|
|
2059
|
+
onclick: o,
|
|
2060
|
+
onmousedown: o,
|
|
2061
|
+
"aria-label": ` Action: ${s}${c < 0 ? "" : ` (access key "${r[i]})"`}.`
|
|
2062
|
+
}, l);
|
|
2063
|
+
}), t.source && _("div", { class: "cm-diagnosticSource" }, t.source));
|
|
2064
|
+
}
|
|
2065
|
+
var ii = class extends he {
|
|
2066
|
+
constructor(e) {
|
|
2067
|
+
super(), this.sev = e;
|
|
2068
|
+
}
|
|
2069
|
+
eq(e) {
|
|
2070
|
+
return e.sev == this.sev;
|
|
2071
|
+
}
|
|
2072
|
+
toDOM() {
|
|
2073
|
+
return _("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
|
2074
|
+
}
|
|
2075
|
+
}, ai = class {
|
|
2076
|
+
constructor(e, t) {
|
|
2077
|
+
this.diagnostic = t, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = ri(e, t, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
2078
|
+
}
|
|
2079
|
+
}, oi = class e {
|
|
2080
|
+
constructor(e) {
|
|
2081
|
+
this.view = e, this.items = [];
|
|
2082
|
+
let t = (t) => {
|
|
2083
|
+
if (!(t.ctrlKey || t.altKey || t.metaKey)) {
|
|
2084
|
+
if (t.keyCode == 27) $r(this.view), this.view.focus();
|
|
2085
|
+
else if (t.keyCode == 38 || t.keyCode == 33) this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
|
2086
|
+
else if (t.keyCode == 40 || t.keyCode == 34) this.moveSelection((this.selectedIndex + 1) % this.items.length);
|
|
2087
|
+
else if (t.keyCode == 36) this.moveSelection(0);
|
|
2088
|
+
else if (t.keyCode == 35) this.moveSelection(this.items.length - 1);
|
|
2089
|
+
else if (t.keyCode == 13) this.view.focus();
|
|
2090
|
+
else if (t.keyCode >= 65 && t.keyCode <= 90 && this.selectedIndex >= 0) {
|
|
2091
|
+
let { diagnostic: n } = this.items[this.selectedIndex], r = ni(n.actions);
|
|
2092
|
+
for (let i = 0; i < r.length; i++) if (r[i].toUpperCase().charCodeAt(0) == t.keyCode) {
|
|
2093
|
+
let t = Z(this.view.state.field(Q).diagnostics, n);
|
|
2094
|
+
t && n.actions[i].apply(e, t.from, t.to);
|
|
2095
|
+
}
|
|
2096
|
+
} else return;
|
|
2097
|
+
t.preventDefault();
|
|
2098
|
+
}
|
|
2099
|
+
}, n = (e) => {
|
|
2100
|
+
for (let t = 0; t < this.items.length; t++) this.items[t].dom.contains(e.target) && this.moveSelection(t);
|
|
2101
|
+
};
|
|
2102
|
+
this.list = _("ul", {
|
|
2103
|
+
tabIndex: 0,
|
|
2104
|
+
role: "listbox",
|
|
2105
|
+
"aria-label": this.view.state.phrase("Diagnostics"),
|
|
2106
|
+
onkeydown: t,
|
|
2107
|
+
onclick: n
|
|
2108
|
+
}), this.dom = _("div", { class: "cm-panel-lint" }, this.list, _("button", {
|
|
2109
|
+
type: "button",
|
|
2110
|
+
name: "close",
|
|
2111
|
+
"aria-label": this.view.state.phrase("close"),
|
|
2112
|
+
onclick: () => $r(this.view)
|
|
2113
|
+
}, "×")), this.update();
|
|
2114
|
+
}
|
|
2115
|
+
get selectedIndex() {
|
|
2116
|
+
let e = this.view.state.field(Q).selected;
|
|
2117
|
+
if (!e) return -1;
|
|
2118
|
+
for (let t = 0; t < this.items.length; t++) if (this.items[t].diagnostic == e.diagnostic) return t;
|
|
2119
|
+
return -1;
|
|
2120
|
+
}
|
|
2121
|
+
update() {
|
|
2122
|
+
let { diagnostics: e, selected: t } = this.view.state.field(Q), n = 0, r = !1, i = null, a = /* @__PURE__ */ new Set();
|
|
2123
|
+
for (e.between(0, this.view.state.doc.length, (e, o, { spec: s }) => {
|
|
2124
|
+
for (let e of s.diagnostics) {
|
|
2125
|
+
if (a.has(e)) continue;
|
|
2126
|
+
a.add(e);
|
|
2127
|
+
let o = -1, s;
|
|
2128
|
+
for (let t = n; t < this.items.length; t++) if (this.items[t].diagnostic == e) {
|
|
2129
|
+
o = t;
|
|
2130
|
+
break;
|
|
2131
|
+
}
|
|
2132
|
+
o < 0 ? (s = new ai(this.view, e), this.items.splice(n, 0, s), r = !0) : (s = this.items[o], o > n && (this.items.splice(n, o - n), r = !0)), t && s.diagnostic == t.diagnostic ? s.dom.hasAttribute("aria-selected") || (s.dom.setAttribute("aria-selected", "true"), i = s) : s.dom.hasAttribute("aria-selected") && s.dom.removeAttribute("aria-selected"), n++;
|
|
2133
|
+
}
|
|
2134
|
+
}); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0);) r = !0, this.items.pop();
|
|
2135
|
+
this.items.length == 0 && (this.items.push(new ai(this.view, {
|
|
2136
|
+
from: -1,
|
|
2137
|
+
to: -1,
|
|
2138
|
+
severity: "info",
|
|
2139
|
+
message: this.view.state.phrase("No diagnostics")
|
|
2140
|
+
})), r = !0), i ? (this.list.setAttribute("aria-activedescendant", i.id), this.view.requestMeasure({
|
|
2141
|
+
key: this,
|
|
2142
|
+
read: () => ({
|
|
2143
|
+
sel: i.dom.getBoundingClientRect(),
|
|
2144
|
+
panel: this.list.getBoundingClientRect()
|
|
2145
|
+
}),
|
|
2146
|
+
write: ({ sel: e, panel: t }) => {
|
|
2147
|
+
let n = t.height / this.list.offsetHeight;
|
|
2148
|
+
e.top < t.top ? this.list.scrollTop -= (t.top - e.top) / n : e.bottom > t.bottom && (this.list.scrollTop += (e.bottom - t.bottom) / n);
|
|
2149
|
+
}
|
|
2150
|
+
})) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), r && this.sync();
|
|
2151
|
+
}
|
|
2152
|
+
sync() {
|
|
2153
|
+
let e = this.list.firstChild;
|
|
2154
|
+
function t() {
|
|
2155
|
+
let t = e;
|
|
2156
|
+
e = t.nextSibling, t.remove();
|
|
2157
|
+
}
|
|
2158
|
+
for (let n of this.items) if (n.dom.parentNode == this.list) {
|
|
2159
|
+
for (; e != n.dom;) t();
|
|
2160
|
+
e = n.dom.nextSibling;
|
|
2161
|
+
} else this.list.insertBefore(n.dom, e);
|
|
2162
|
+
for (; e;) t();
|
|
2163
|
+
}
|
|
2164
|
+
moveSelection(e) {
|
|
2165
|
+
if (this.selectedIndex < 0) return;
|
|
2166
|
+
let t = Z(this.view.state.field(Q).diagnostics, this.items[e].diagnostic);
|
|
2167
|
+
t && this.view.dispatch({
|
|
2168
|
+
selection: {
|
|
2169
|
+
anchor: t.from,
|
|
2170
|
+
head: t.to
|
|
2171
|
+
},
|
|
2172
|
+
scrollIntoView: !0,
|
|
2173
|
+
effects: Jr.of(t)
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
static open(t) {
|
|
2177
|
+
return new e(t);
|
|
2178
|
+
}
|
|
2179
|
+
};
|
|
2180
|
+
function si(e, t = "viewBox=\"0 0 40 40\"") {
|
|
2181
|
+
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`;
|
|
2182
|
+
}
|
|
2183
|
+
function ci(e) {
|
|
2184
|
+
return si(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`, "width=\"6\" height=\"3\"");
|
|
2185
|
+
}
|
|
2186
|
+
var li = /*@__PURE__*/ v.baseTheme({
|
|
2187
|
+
".cm-diagnostic": {
|
|
2188
|
+
padding: "3px 6px 3px 8px",
|
|
2189
|
+
marginLeft: "-1px",
|
|
2190
|
+
display: "block",
|
|
2191
|
+
whiteSpace: "pre-wrap"
|
|
2192
|
+
},
|
|
2193
|
+
".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
|
|
2194
|
+
".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
|
|
2195
|
+
".cm-diagnostic-info": { borderLeft: "5px solid #999" },
|
|
2196
|
+
".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
|
|
2197
|
+
".cm-diagnosticAction": {
|
|
2198
|
+
font: "inherit",
|
|
2199
|
+
border: "none",
|
|
2200
|
+
padding: "2px 4px",
|
|
2201
|
+
backgroundColor: "#444",
|
|
2202
|
+
color: "white",
|
|
2203
|
+
borderRadius: "3px",
|
|
2204
|
+
marginLeft: "8px",
|
|
2205
|
+
cursor: "pointer"
|
|
2206
|
+
},
|
|
2207
|
+
".cm-diagnosticSource": {
|
|
2208
|
+
fontSize: "70%",
|
|
2209
|
+
opacity: .7
|
|
2210
|
+
},
|
|
2211
|
+
".cm-lintRange": {
|
|
2212
|
+
backgroundPosition: "left bottom",
|
|
2213
|
+
backgroundRepeat: "repeat-x",
|
|
2214
|
+
paddingBottom: "0.7px"
|
|
2215
|
+
},
|
|
2216
|
+
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/ ci("#f11") },
|
|
2217
|
+
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/ ci("orange") },
|
|
2218
|
+
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/ ci("#999") },
|
|
2219
|
+
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/ ci("#66d") },
|
|
2220
|
+
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
2221
|
+
".cm-tooltip-lint": {
|
|
2222
|
+
padding: 0,
|
|
2223
|
+
margin: 0
|
|
2224
|
+
},
|
|
2225
|
+
".cm-lintPoint": {
|
|
2226
|
+
position: "relative",
|
|
2227
|
+
"&:after": {
|
|
2228
|
+
content: "\"\"",
|
|
2229
|
+
position: "absolute",
|
|
2230
|
+
bottom: 0,
|
|
2231
|
+
left: "-2px",
|
|
2232
|
+
borderLeft: "3px solid transparent",
|
|
2233
|
+
borderRight: "3px solid transparent",
|
|
2234
|
+
borderBottom: "4px solid #d11"
|
|
2235
|
+
}
|
|
2236
|
+
},
|
|
2237
|
+
".cm-lintPoint-warning": { "&:after": { borderBottomColor: "orange" } },
|
|
2238
|
+
".cm-lintPoint-info": { "&:after": { borderBottomColor: "#999" } },
|
|
2239
|
+
".cm-lintPoint-hint": { "&:after": { borderBottomColor: "#66d" } },
|
|
2240
|
+
".cm-panel.cm-panel-lint": {
|
|
2241
|
+
position: "relative",
|
|
2242
|
+
"& ul": {
|
|
2243
|
+
maxHeight: "100px",
|
|
2244
|
+
overflowY: "auto",
|
|
2245
|
+
"& [aria-selected]": {
|
|
2246
|
+
backgroundColor: "#ddd",
|
|
2247
|
+
"& u": { textDecoration: "underline" }
|
|
2248
|
+
},
|
|
2249
|
+
"&:focus [aria-selected]": {
|
|
2250
|
+
background_fallback: "#bdf",
|
|
2251
|
+
backgroundColor: "Highlight",
|
|
2252
|
+
color_fallback: "white",
|
|
2253
|
+
color: "HighlightText"
|
|
2254
|
+
},
|
|
2255
|
+
"& u": { textDecoration: "none" },
|
|
2256
|
+
padding: 0,
|
|
2257
|
+
margin: 0
|
|
2258
|
+
},
|
|
2259
|
+
"& [name=close]": {
|
|
2260
|
+
position: "absolute",
|
|
2261
|
+
top: "0",
|
|
2262
|
+
right: "2px",
|
|
2263
|
+
background: "inherit",
|
|
2264
|
+
border: "none",
|
|
2265
|
+
font: "inherit",
|
|
2266
|
+
padding: 0,
|
|
2267
|
+
margin: 0
|
|
2268
|
+
}
|
|
2269
|
+
},
|
|
2270
|
+
"&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
|
|
2271
|
+
"&dark .cm-panel.cm-panel-lint ul": { "& [aria-selected]": { backgroundColor: "#2e343e" } }
|
|
2272
|
+
});
|
|
2273
|
+
function ui(e) {
|
|
2274
|
+
return e == "error" ? 4 : e == "warning" ? 3 : e == "info" ? 2 : 1;
|
|
2275
|
+
}
|
|
2276
|
+
function di(e) {
|
|
2277
|
+
let t = "hint", n = 1;
|
|
2278
|
+
for (let r of e) {
|
|
2279
|
+
let e = ui(r.severity);
|
|
2280
|
+
e > n && (n = e, t = r.severity);
|
|
2281
|
+
}
|
|
2282
|
+
return t;
|
|
2283
|
+
}
|
|
2284
|
+
var fi = /*@__PURE__*/ ve(Xr, { hideOn: Wr }), pi = [
|
|
2285
|
+
Q,
|
|
2286
|
+
/*@__PURE__*/ v.decorations.compute([Q], (e) => {
|
|
2287
|
+
let { selected: t, panel: n } = e.field(Q);
|
|
2288
|
+
return !t || !n || t.from == t.to ? y.none : y.set([Yr.range(t.from, t.to)]);
|
|
2289
|
+
}),
|
|
2290
|
+
fi,
|
|
2291
|
+
li
|
|
2292
|
+
], mi = [
|
|
2293
|
+
ce(),
|
|
2294
|
+
fe(),
|
|
2295
|
+
oe(),
|
|
2296
|
+
Qe(),
|
|
2297
|
+
Ee(),
|
|
2298
|
+
_e(),
|
|
2299
|
+
ue(),
|
|
2300
|
+
f.allowMultipleSelections.of(!0),
|
|
2301
|
+
Ae(),
|
|
2302
|
+
xe(Te, { fallback: !0 }),
|
|
2303
|
+
we(),
|
|
2304
|
+
Fe(),
|
|
2305
|
+
Ne(),
|
|
2306
|
+
ie(),
|
|
2307
|
+
le(),
|
|
2308
|
+
pe(),
|
|
2309
|
+
ir(),
|
|
2310
|
+
be.of([
|
|
2311
|
+
...Me,
|
|
2312
|
+
...Kn,
|
|
2313
|
+
...Lr,
|
|
2314
|
+
...pt,
|
|
2315
|
+
...ke,
|
|
2316
|
+
...Pe,
|
|
2317
|
+
...ei
|
|
2318
|
+
])
|
|
2319
|
+
], hi = [
|
|
2320
|
+
oe(),
|
|
2321
|
+
Qe(),
|
|
2322
|
+
_e(),
|
|
2323
|
+
xe(Te, { fallback: !0 }),
|
|
2324
|
+
be.of([...Kn, ...pt])
|
|
2325
|
+
];
|
|
2326
|
+
//#endregion
|
|
2327
|
+
export { v as EditorView, mi as basicSetup, hi as minimalSetup };
|