@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.
Files changed (133) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +47 -0
  3. package/README.md +18 -0
  4. package/dist/browser/_virtual_open-flow-twemoji-DJwKsM_w.js +5067 -0
  5. package/dist/browser/addNodeOptions-DqoIueCR.js +33746 -0
  6. package/dist/browser/assets/font-00b26ac825e20950.woff2 +0 -0
  7. package/dist/browser/assets/font-036d4e95149b69ff.woff2 +0 -0
  8. package/dist/browser/assets/font-07d8e303ce4fc12b.ttf +0 -0
  9. package/dist/browser/assets/font-08ce98e51b04d589.ttf +0 -0
  10. package/dist/browser/assets/font-0cdd387c9590a1a9.woff2 +0 -0
  11. package/dist/browser/assets/font-0d85ae7cc30f2379.ttf +0 -0
  12. package/dist/browser/assets/font-0f60d1b897938ec9.woff2 +0 -0
  13. package/dist/browser/assets/font-11e4dc8a6471ff6d.woff +0 -0
  14. package/dist/browser/assets/font-138ac28d1663b303.ttf +0 -0
  15. package/dist/browser/assets/font-1ae6bd7475590e97.woff +0 -0
  16. package/dist/browser/assets/font-1c67f068fea8bb09.ttf +0 -0
  17. package/dist/browser/assets/font-1e6f9579e90e2cac.ttf +0 -0
  18. package/dist/browser/assets/font-1ece03f79f95277d.ttf +0 -0
  19. package/dist/browser/assets/font-2014c523c3210bcc.woff +0 -0
  20. package/dist/browser/assets/font-30da91e84c893f87.woff +0 -0
  21. package/dist/browser/assets/font-3398dd02302557a7.woff +0 -0
  22. package/dist/browser/assets/font-3931dd81faed86ba.ttf +0 -0
  23. package/dist/browser/assets/font-500e04d54f0d5166.ttf +0 -0
  24. package/dist/browser/assets/font-51814d270d06ff02.woff2 +0 -0
  25. package/dist/browser/assets/font-5d53e70ad607c235.woff2 +0 -0
  26. package/dist/browser/assets/font-5e28753be717dac9.woff +0 -0
  27. package/dist/browser/assets/font-68534840bcfdd2bf.ttf +0 -0
  28. package/dist/browser/assets/font-68e8c73ef42afd3c.woff2 +0 -0
  29. package/dist/browser/assets/font-6ab6b62e9b62dae2.woff +0 -0
  30. package/dist/browser/assets/font-6b47c40166b6dbe2.woff2 +0 -0
  31. package/dist/browser/assets/font-70ee1f64a20f2048.ttf +0 -0
  32. package/dist/browser/assets/font-71d517d67827787c.woff2 +0 -0
  33. package/dist/browser/assets/font-73d591271b160496.woff2 +0 -0
  34. package/dist/browser/assets/font-74444efd593c005e.woff2 +0 -0
  35. package/dist/browser/assets/font-7af58c5ec8f132a2.woff2 +0 -0
  36. package/dist/browser/assets/font-850c0af5c2238497.woff +0 -0
  37. package/dist/browser/assets/font-8a8d244581371912.woff +0 -0
  38. package/dist/browser/assets/font-9163df9c7122432e.ttf +0 -0
  39. package/dist/browser/assets/font-91ee67500cc0129a.woff +0 -0
  40. package/dist/browser/assets/font-95b6d2f1a50173bf.ttf +0 -0
  41. package/dist/browser/assets/font-97479ca6cce906ab.woff2 +0 -0
  42. package/dist/browser/assets/font-99cd42a3c072d918.woff2 +0 -0
  43. package/dist/browser/assets/font-99f9c6750b489c94.woff +0 -0
  44. package/dist/browser/assets/font-9be7ceb88004ab8a.woff +0 -0
  45. package/dist/browser/assets/font-a4af7d414440a1c1.woff2 +0 -0
  46. package/dist/browser/assets/font-a6b2099fb555c60e.ttf +0 -0
  47. package/dist/browser/assets/font-a6f7ec0d846ac7ad.woff +0 -0
  48. package/dist/browser/assets/font-c2342cd8b869e017.woff2 +0 -0
  49. package/dist/browser/assets/font-c6368d87e8a1a3a5.woff +0 -0
  50. package/dist/browser/assets/font-c647367d1dd4e162.ttf +0 -0
  51. package/dist/browser/assets/font-c76c5d696297d51b.woff +0 -0
  52. package/dist/browser/assets/font-c943cc986384f59e.woff +0 -0
  53. package/dist/browser/assets/font-d0332f52868370fd.ttf +0 -0
  54. package/dist/browser/assets/font-d04c54219f9eaec6.woff2 +0 -0
  55. package/dist/browser/assets/font-d96cdf2b3bdd4d64.woff +0 -0
  56. package/dist/browser/assets/font-dc47344dbb6cb5b6.woff2 +0 -0
  57. package/dist/browser/assets/font-de7701e42cf1f4cf.woff2 +0 -0
  58. package/dist/browser/assets/font-e14fed02b1aba7ce.woff +0 -0
  59. package/dist/browser/assets/font-e99ae51144bf1232.woff2 +0 -0
  60. package/dist/browser/assets/font-ece03cfd83e22c21.woff +0 -0
  61. package/dist/browser/assets/font-ed0b74372feefcbb.ttf +0 -0
  62. package/dist/browser/assets/font-f01f3e87d9c6a61c.ttf +0 -0
  63. package/dist/browser/assets/font-f1d6ef86f3b11a52.woff +0 -0
  64. package/dist/browser/assets/font-f36ea897e19f4a2e.ttf +0 -0
  65. package/dist/browser/assets/font-f9377ab0271cda59.ttf +0 -0
  66. package/dist/browser/carbon-nMY84Amv.js +53 -0
  67. package/dist/browser/composite-7VwgfnXx.js +6088 -0
  68. package/dist/browser/createResourceDialog-ByuJWdSL.js +439 -0
  69. package/dist/browser/dist-7oZK9QXZ.js +50088 -0
  70. package/dist/browser/dist-B9OV3YTx.js +881 -0
  71. package/dist/browser/dist-BLk5M0uK.js +1816 -0
  72. package/dist/browser/dist-BbyiRq3c.js +3285 -0
  73. package/dist/browser/dist-CIq6ue3I.js +6646 -0
  74. package/dist/browser/dist-CLZJNoWB.js +89 -0
  75. package/dist/browser/dist-CvcmLAMW.js +1620 -0
  76. package/dist/browser/dist-DL0SDskM.js +2327 -0
  77. package/dist/browser/dist-Djd02JSy.js +1247 -0
  78. package/dist/browser/dist-aWSZx4q1.js +850 -0
  79. package/dist/browser/dist-n-z5HtaO.js +4 -0
  80. package/dist/browser/dist-o4dBuwiG.js +320 -0
  81. package/dist/browser/dist-zyY--HOV.js +1543 -0
  82. package/dist/browser/esm-DXw7EADW.js +218 -0
  83. package/dist/browser/favicon.svg +7 -0
  84. package/dist/browser/flowWorkspace-DwVMpcar.js +22092 -0
  85. package/dist/browser/lib-S4ccuMeT.js +7857 -0
  86. package/dist/browser/licenses.md +4973 -0
  87. package/dist/browser/markdownContent-ZZFfSRqO.js +44545 -0
  88. package/dist/browser/project-change.d.ts +311 -0
  89. package/dist/browser/project-change.js +259 -0
  90. package/dist/browser/project-notifications.d.ts +12 -0
  91. package/dist/browser/rolldown-runtime-CEFd7nDs.js +30 -0
  92. package/dist/browser/workbench-contract.d.ts +28 -0
  93. package/dist/browser/workbench.css +2 -0
  94. package/dist/browser/workbench.css.d.ts +1 -0
  95. package/dist/browser/workbench.d.ts +14 -0
  96. package/dist/browser/workbench.js +3364 -0
  97. package/dist/common/connector-action.d.ts +20 -0
  98. package/dist/common/connector-action.js +106 -0
  99. package/dist/common/connector-proxy.d.ts +14 -0
  100. package/dist/common/connector-proxy.js +0 -0
  101. package/dist/common/control-api-conformance.d.ts +13 -0
  102. package/dist/common/control-api-conformance.js +518 -0
  103. package/dist/common/control-api-errors.d.ts +121 -0
  104. package/dist/common/control-api.d.ts +349 -0
  105. package/dist/common/control-api.js +884 -0
  106. package/dist/common/cron-trigger.d.ts +21 -0
  107. package/dist/common/cron-trigger.js +834 -0
  108. package/dist/common/engine-contract.d.ts +7 -0
  109. package/dist/common/favicon.svg +7 -0
  110. package/dist/common/integration-trigger.d.ts +111 -0
  111. package/dist/common/integration-trigger.js +290 -0
  112. package/dist/common/licenses.md +27 -0
  113. package/dist/common/poll-trigger.d.ts +69 -0
  114. package/dist/common/poll-trigger.js +155 -0
  115. package/dist/common/project-encoding.d.ts +11 -0
  116. package/dist/common/project-encoding.js +242 -0
  117. package/dist/common/project-notifications.d.ts +12 -0
  118. package/dist/common/project-semantics.d.ts +55 -0
  119. package/dist/common/project-semantics.js +8687 -0
  120. package/dist/common/provider-triggers.d.ts +6 -0
  121. package/dist/common/provider-triggers.js +4614 -0
  122. package/dist/common/run-events.d.ts +9 -0
  123. package/dist/common/run-events.js +192 -0
  124. package/dist/common/run-lifecycle.d.ts +69 -0
  125. package/dist/common/run-lifecycle.js +169 -0
  126. package/dist/common/runtime-contract.d.ts +53 -0
  127. package/dist/common/runtime-contract.js +151 -0
  128. package/dist/common/scheduler.d.ts +99 -0
  129. package/dist/common/scheduler.js +379 -0
  130. package/dist/common/webhook-trigger.d.ts +22 -0
  131. package/dist/common/webhook-trigger.js +270 -0
  132. package/dist/index.d.ts +66 -0
  133. package/package.json +102 -0
@@ -0,0 +1,1620 @@
1
+ import { r as e } from "./rolldown-runtime-CEFd7nDs.js";
2
+ import { a as t, c as n, d as r, h as i, i as a, l as o, m as s, o as c, p as l, r as u, u as d } from "./dist-zyY--HOV.js";
3
+ import { b as ee, d as f, l as te, m as ne, o as p, p as m, s as h, u as re, y as ie } from "./dist-BLk5M0uK.js";
4
+ import { O as ae, a as g, i as oe, m as se, n as _, o as ce, r as v, t as y, x as le } from "./dist-CIq6ue3I.js";
5
+ //#region ../../node_modules/@codemirror/language/dist/index.js
6
+ var ue = /* @__PURE__ */ e({
7
+ DocInput: () => _e,
8
+ HighlightStyle: () => Y,
9
+ IndentContext: () => P,
10
+ LRLanguage: () => fe,
11
+ Language: () => C,
12
+ LanguageDescription: () => Se,
13
+ LanguageSupport: () => xe,
14
+ ParseContext: () => E,
15
+ StreamLanguage: () => Nt,
16
+ StringStream: () => kt,
17
+ TreeIndentContext: () => Ae,
18
+ bidiIsolates: () => Qt,
19
+ bracketMatching: () => St,
20
+ bracketMatchingHandle: () => Ct,
21
+ codeFolding: () => q,
22
+ continuedIndent: () => Ie,
23
+ defaultHighlightStyle: () => ft,
24
+ defineLanguageFacet: () => x,
25
+ delimitedIndent: () => Ne,
26
+ ensureSyntaxTree: () => pe,
27
+ flatIndent: () => Fe,
28
+ foldAll: () => Je,
29
+ foldCode: () => Ke,
30
+ foldEffect: () => z,
31
+ foldGutter: () => it,
32
+ foldInside: () => ze,
33
+ foldKeymap: () => Qe,
34
+ foldNodeProp: () => L,
35
+ foldService: () => I,
36
+ foldState: () => H,
37
+ foldable: () => R,
38
+ foldedRanges: () => We,
39
+ forceParsing: () => he,
40
+ getIndentUnit: () => j,
41
+ getIndentation: () => N,
42
+ highlightingFor: () => lt,
43
+ indentNodeProp: () => F,
44
+ indentOnInput: () => Re,
45
+ indentRange: () => we,
46
+ indentService: () => Ce,
47
+ indentString: () => M,
48
+ indentUnit: () => A,
49
+ language: () => k,
50
+ languageDataProp: () => b,
51
+ matchBrackets: () => Z,
52
+ sublanguageProp: () => S,
53
+ syntaxHighlighting: () => ct,
54
+ syntaxParserRunning: () => ge,
55
+ syntaxTree: () => w,
56
+ syntaxTreeAvailable: () => me,
57
+ toggleFold: () => Ze,
58
+ unfoldAll: () => Ye,
59
+ unfoldCode: () => qe,
60
+ unfoldEffect: () => B
61
+ }), b = /*@__PURE__*/ new o();
62
+ function x(e) {
63
+ return h.define({ combine: e ? (t) => t.concat(e) : void 0 });
64
+ }
65
+ var S = /*@__PURE__*/ new o(), C = class {
66
+ constructor(e, t, n = [], r = "") {
67
+ this.data = e, this.name = r, p.prototype.hasOwnProperty("tree") || Object.defineProperty(p.prototype, "tree", { get() {
68
+ return w(this);
69
+ } }), this.parser = t, this.extension = [k.of(this), p.languageData.of((e, t, n) => {
70
+ let r = de(e, t, n), i = r.type.prop(b);
71
+ if (!i) return [];
72
+ let a = e.facet(i), o = r.type.prop(S);
73
+ if (o) {
74
+ let i = r.resolve(t - r.from, n);
75
+ for (let t of o) if (t.test(i, e)) {
76
+ let n = e.facet(t.facet);
77
+ return t.type == "replace" ? n : n.concat(a);
78
+ }
79
+ }
80
+ return a;
81
+ })].concat(n);
82
+ }
83
+ isActiveAt(e, t, n = -1) {
84
+ return de(e, t, n).type.prop(b) == this.data;
85
+ }
86
+ findRegions(e) {
87
+ let t = e.facet(k);
88
+ if (t?.data == this.data) return [{
89
+ from: 0,
90
+ to: e.doc.length
91
+ }];
92
+ if (!t || !t.allowsNesting) return [];
93
+ let n = [], r = (e, t) => {
94
+ if (e.prop(b) == this.data) {
95
+ n.push({
96
+ from: t,
97
+ to: t + e.length
98
+ });
99
+ return;
100
+ }
101
+ let i = e.prop(o.mounted);
102
+ if (i) {
103
+ if (i.tree.prop(b) == this.data) {
104
+ if (i.overlay) for (let e of i.overlay) n.push({
105
+ from: e.from + t,
106
+ to: e.to + t
107
+ });
108
+ else n.push({
109
+ from: t,
110
+ to: t + e.length
111
+ });
112
+ return;
113
+ }
114
+ if (i.overlay) {
115
+ let e = n.length;
116
+ if (r(i.tree, i.overlay[0].from + t), n.length > e) return;
117
+ }
118
+ }
119
+ for (let n = 0; n < e.children.length; n++) {
120
+ let i = e.children[n];
121
+ i instanceof s && r(i, e.positions[n] + t);
122
+ }
123
+ };
124
+ return r(w(e), 0), n;
125
+ }
126
+ get allowsNesting() {
127
+ return !0;
128
+ }
129
+ };
130
+ C.setState = /*@__PURE__*/ m.define();
131
+ function de(e, t, r) {
132
+ let i = e.facet(k), a = w(e).topNode;
133
+ if (!i || i.allowsNesting) for (let e = a; e; e = e.enter(t, r, n.ExcludeBuffers | n.EnterBracketed)) e.type.isTop && (a = e);
134
+ return a;
135
+ }
136
+ var fe = class e extends C {
137
+ constructor(e, t, n) {
138
+ super(e, t, [], n), this.parser = t;
139
+ }
140
+ static define(t) {
141
+ let n = x(t.languageData);
142
+ return new e(n, t.parser.configure({ props: [b.add((e) => e.isTop ? n : void 0)] }), t.name);
143
+ }
144
+ configure(t, n) {
145
+ return new e(this.data, this.parser.configure(t), n || this.name);
146
+ }
147
+ get allowsNesting() {
148
+ return this.parser.hasWrappers();
149
+ }
150
+ };
151
+ function w(e) {
152
+ let t = e.field(C.state, !1);
153
+ return t ? t.tree : s.empty;
154
+ }
155
+ function pe(e, t, n = 50) {
156
+ let r = e.field(C.state, !1)?.context;
157
+ if (!r) return null;
158
+ let i = r.viewport;
159
+ r.updateViewport({
160
+ from: 0,
161
+ to: t
162
+ });
163
+ let a = r.isDone(t) || r.work(n, t) ? r.tree : null;
164
+ return r.updateViewport(i), a;
165
+ }
166
+ function me(e, t = e.doc.length) {
167
+ return e.field(C.state, !1)?.context.isDone(t) || !1;
168
+ }
169
+ function he(e, t = e.viewport.to, n = 100) {
170
+ let r = pe(e.state, t, n);
171
+ return r != w(e.state) && e.dispatch({}), !!r;
172
+ }
173
+ function ge(e) {
174
+ return e.plugin(be)?.isWorking() || !1;
175
+ }
176
+ var _e = class {
177
+ constructor(e) {
178
+ this.doc = e, this.cursorPos = 0, this.string = "", this.cursor = e.iter();
179
+ }
180
+ get length() {
181
+ return this.doc.length;
182
+ }
183
+ syncTo(e) {
184
+ return this.string = this.cursor.next(e - this.cursorPos).value, this.cursorPos = e + this.string.length, this.cursorPos - this.string.length;
185
+ }
186
+ chunk(e) {
187
+ return this.syncTo(e), this.string;
188
+ }
189
+ get lineChunks() {
190
+ return !0;
191
+ }
192
+ read(e, t) {
193
+ let n = this.cursorPos - this.string.length;
194
+ return e < n || t >= this.cursorPos ? this.doc.sliceString(e, t) : this.string.slice(e - n, t - n);
195
+ }
196
+ }, T = null, E = class e {
197
+ constructor(e, t, n = [], r, i, a, o, s) {
198
+ this.parser = e, this.state = t, this.fragments = n, this.tree = r, this.treeLen = i, this.viewport = a, this.skipped = o, this.scheduleOn = s, this.parse = null, this.tempSkipped = [];
199
+ }
200
+ static create(t, n, r) {
201
+ return new e(t, n, [], s.empty, 0, r, [], null);
202
+ }
203
+ startParse() {
204
+ return this.parser.startParse(new _e(this.state.doc), this.fragments);
205
+ }
206
+ work(e, t) {
207
+ return t != null && t >= this.state.doc.length && (t = void 0), this.tree != s.empty && this.isDone(t ?? this.state.doc.length) ? (this.takeTree(), !0) : this.withContext(() => {
208
+ if (typeof e == "number") {
209
+ let t = Date.now() + e;
210
+ e = () => Date.now() > t;
211
+ }
212
+ for (this.parse ||= this.startParse(), t != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > t) && t < this.state.doc.length && this.parse.stopAt(t);;) {
213
+ let n = this.parse.advance();
214
+ if (n) {
215
+ if (this.fragments = this.withoutTempSkipped(i.addTree(n, this.fragments, this.parse.stoppedAt != null)), this.treeLen = this.parse.stoppedAt ?? this.state.doc.length, this.tree = n, this.parse = null, this.treeLen < (t ?? this.state.doc.length)) this.parse = this.startParse();
216
+ else return !0;
217
+ }
218
+ if (e()) return !1;
219
+ }
220
+ });
221
+ }
222
+ takeTree() {
223
+ let e, t;
224
+ this.parse && (e = this.parse.parsedPos) >= this.treeLen && ((this.parse.stoppedAt == null || this.parse.stoppedAt > e) && this.parse.stopAt(e), this.withContext(() => {
225
+ for (; !(t = this.parse.advance()););
226
+ }), this.treeLen = e, this.tree = t, this.fragments = this.withoutTempSkipped(i.addTree(this.tree, this.fragments, !0)), this.parse = null);
227
+ }
228
+ withContext(e) {
229
+ let t = T;
230
+ T = this;
231
+ try {
232
+ return e();
233
+ } finally {
234
+ T = t;
235
+ }
236
+ }
237
+ withoutTempSkipped(e) {
238
+ for (let t; t = this.tempSkipped.pop();) e = ve(e, t.from, t.to);
239
+ return e;
240
+ }
241
+ changes(t, n) {
242
+ let { fragments: r, tree: a, treeLen: o, viewport: c, skipped: l } = this;
243
+ if (this.takeTree(), !t.empty) {
244
+ let e = [];
245
+ if (t.iterChangedRanges((t, n, r, i) => e.push({
246
+ fromA: t,
247
+ toA: n,
248
+ fromB: r,
249
+ toB: i
250
+ })), r = i.applyChanges(r, e), a = s.empty, o = 0, c = {
251
+ from: t.mapPos(c.from, -1),
252
+ to: t.mapPos(c.to, 1)
253
+ }, this.skipped.length) {
254
+ l = [];
255
+ for (let e of this.skipped) {
256
+ let n = t.mapPos(e.from, 1), r = t.mapPos(e.to, -1);
257
+ n < r && l.push({
258
+ from: n,
259
+ to: r
260
+ });
261
+ }
262
+ }
263
+ }
264
+ return new e(this.parser, n, r, a, o, c, l, this.scheduleOn);
265
+ }
266
+ updateViewport(e) {
267
+ if (this.viewport.from == e.from && this.viewport.to == e.to) return !1;
268
+ this.viewport = e;
269
+ let t = this.skipped.length;
270
+ for (let t = 0; t < this.skipped.length; t++) {
271
+ let { from: n, to: r } = this.skipped[t];
272
+ n < e.to && r > e.from && (this.fragments = ve(this.fragments, n, r), this.skipped.splice(t--, 1));
273
+ }
274
+ return this.skipped.length >= t ? !1 : (this.reset(), !0);
275
+ }
276
+ reset() {
277
+ this.parse &&= (this.takeTree(), null);
278
+ }
279
+ skipUntilInView(e, t) {
280
+ this.skipped.push({
281
+ from: e,
282
+ to: t
283
+ });
284
+ }
285
+ static getSkippingParser(e) {
286
+ return new class extends l {
287
+ createParse(t, n, i) {
288
+ let a = i[0].from, o = i[i.length - 1].to;
289
+ return {
290
+ parsedPos: a,
291
+ advance() {
292
+ let t = T;
293
+ if (t) {
294
+ for (let e of i) t.tempSkipped.push(e);
295
+ e && (t.scheduleOn = t.scheduleOn ? Promise.all([t.scheduleOn, e]) : e);
296
+ }
297
+ return this.parsedPos = o, new s(r.none, [], [], o - a);
298
+ },
299
+ stoppedAt: null,
300
+ stopAt() {}
301
+ };
302
+ }
303
+ }();
304
+ }
305
+ isDone(e) {
306
+ e = Math.min(e, this.state.doc.length);
307
+ let t = this.fragments;
308
+ return this.treeLen >= e && t.length && t[0].from == 0 && t[0].to >= e;
309
+ }
310
+ static get() {
311
+ return T;
312
+ }
313
+ };
314
+ function ve(e, t, n) {
315
+ return i.applyChanges(e, [{
316
+ fromA: t,
317
+ toA: n,
318
+ fromB: t,
319
+ toB: n
320
+ }]);
321
+ }
322
+ var D = class e {
323
+ constructor(e) {
324
+ this.context = e, this.tree = e.tree;
325
+ }
326
+ apply(t) {
327
+ if (!t.docChanged && this.tree == this.context.tree) return this;
328
+ let n = this.context.changes(t.changes, t.state), r = this.context.treeLen == t.startState.doc.length ? void 0 : Math.max(t.changes.mapPos(this.context.treeLen), n.viewport.to);
329
+ return n.work(20, r) || n.takeTree(), new e(n);
330
+ }
331
+ static init(t) {
332
+ let n = Math.min(3e3, t.doc.length), r = E.create(t.facet(k).parser, t, {
333
+ from: 0,
334
+ to: n
335
+ });
336
+ return r.work(20, n) || r.takeTree(), new e(r);
337
+ }
338
+ };
339
+ C.state = /*@__PURE__*/ ne.define({
340
+ create: D.init,
341
+ update(e, t) {
342
+ for (let e of t.effects) if (e.is(C.setState)) return e.value;
343
+ return t.startState.facet(k) == t.state.facet(k) ? e.apply(t) : D.init(t.state);
344
+ }
345
+ });
346
+ var ye = (e) => {
347
+ let t = setTimeout(() => e(), 500);
348
+ return () => clearTimeout(t);
349
+ };
350
+ typeof requestIdleCallback < "u" && (ye = (e) => {
351
+ let t = -1, n = setTimeout(() => {
352
+ t = requestIdleCallback(e, { timeout: 400 });
353
+ }, 100);
354
+ return () => t < 0 ? clearTimeout(n) : cancelIdleCallback(t);
355
+ });
356
+ var O = typeof navigator < "u" && navigator.scheduling?.isInputPending ? () => navigator.scheduling.isInputPending() : null, be = /*@__PURE__*/ g.fromClass(class {
357
+ constructor(e) {
358
+ this.view = e, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork();
359
+ }
360
+ update(e) {
361
+ let t = this.view.state.field(C.state).context;
362
+ (t.updateViewport(e.view.viewport) || this.view.viewport.to > t.treeLen) && this.scheduleWork(), (e.docChanged || e.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(t);
363
+ }
364
+ scheduleWork() {
365
+ if (this.working) return;
366
+ let { state: e } = this.view, t = e.field(C.state);
367
+ (t.tree != t.context.tree || !t.context.isDone(e.doc.length)) && (this.working = ye(this.work));
368
+ }
369
+ work(e) {
370
+ this.working = null;
371
+ let t = Date.now();
372
+ if (this.chunkEnd < t && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = t + 3e4, this.chunkBudget = 3e3), this.chunkBudget <= 0) return;
373
+ let { state: n, viewport: { to: r } } = this.view, i = n.field(C.state);
374
+ if (i.tree == i.context.tree && i.context.isDone(r + 1e5)) return;
375
+ let a = Date.now() + Math.min(this.chunkBudget, 100, e && !O ? Math.max(25, e.timeRemaining() - 5) : 1e9), o = i.context.treeLen < r && n.doc.length > r + 1e3, s = i.context.work(() => O && O() || Date.now() > a, r + (o ? 0 : 1e5));
376
+ this.chunkBudget -= Date.now() - t, (s || this.chunkBudget <= 0) && (i.context.takeTree(), this.view.dispatch({ effects: C.setState.of(new D(i.context)) })), this.chunkBudget > 0 && !(s && !o) && this.scheduleWork(), this.checkAsyncSchedule(i.context);
377
+ }
378
+ checkAsyncSchedule(e) {
379
+ e.scheduleOn &&= (this.workScheduled++, e.scheduleOn.then(() => this.scheduleWork()).catch((e) => le(this.view.state, e)).then(() => this.workScheduled--), null);
380
+ }
381
+ destroy() {
382
+ this.working && this.working();
383
+ }
384
+ isWorking() {
385
+ return !!(this.working || this.workScheduled > 0);
386
+ }
387
+ }, { eventHandlers: { focus() {
388
+ this.scheduleWork();
389
+ } } }), k = /*@__PURE__*/ h.define({
390
+ combine(e) {
391
+ return e.length ? e[0] : null;
392
+ },
393
+ enables: (e) => [
394
+ C.state,
395
+ be,
396
+ v.contentAttributes.compute([e], (t) => {
397
+ let n = t.facet(e);
398
+ return n && n.name ? { "data-language": n.name } : {};
399
+ })
400
+ ]
401
+ }), xe = class {
402
+ constructor(e, t = []) {
403
+ this.language = e, this.support = t, this.extension = [e, t];
404
+ }
405
+ }, Se = class e {
406
+ constructor(e, t, n, r, i, a = void 0) {
407
+ this.name = e, this.alias = t, this.extensions = n, this.filename = r, this.loadFunc = i, this.support = a, this.loading = null;
408
+ }
409
+ load() {
410
+ return this.loading ||= this.loadFunc().then((e) => this.support = e, (e) => {
411
+ throw this.loading = null, e;
412
+ });
413
+ }
414
+ static of(t) {
415
+ let { load: n, support: r } = t;
416
+ if (!n) {
417
+ if (!r) throw RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");
418
+ n = () => Promise.resolve(r);
419
+ }
420
+ return new e(t.name, (t.alias || []).concat(t.name).map((e) => e.toLowerCase()), t.extensions || [], t.filename, n, r);
421
+ }
422
+ static matchFilename(e, t) {
423
+ for (let n of e) if (n.filename && n.filename.test(t)) return n;
424
+ let n = /\.([^.]+)$/.exec(t);
425
+ if (n) {
426
+ for (let t of e) if (t.extensions.indexOf(n[1]) > -1) return t;
427
+ }
428
+ return null;
429
+ }
430
+ static matchLanguageName(e, t, n = !0) {
431
+ t = t.toLowerCase();
432
+ for (let n of e) if (n.alias.some((e) => e == t)) return n;
433
+ if (n) for (let n of e) for (let e of n.alias) {
434
+ let r = t.indexOf(e);
435
+ if (r > -1 && (e.length > 2 || !/\w/.test(t[r - 1]) && !/\w/.test(t[r + e.length]))) return n;
436
+ }
437
+ return null;
438
+ }
439
+ }, Ce = /*@__PURE__*/ h.define(), A = /*@__PURE__*/ h.define({ combine: (e) => {
440
+ if (!e.length) return " ";
441
+ let t = e[0];
442
+ if (!t || /\S/.test(t) || Array.from(t).some((e) => e != t[0])) throw Error("Invalid indent unit: " + JSON.stringify(e[0]));
443
+ return t;
444
+ } });
445
+ function j(e) {
446
+ let t = e.facet(A);
447
+ return t.charCodeAt(0) == 9 ? e.tabSize * t.length : t.length;
448
+ }
449
+ function M(e, t) {
450
+ let n = "", r = e.tabSize, i = e.facet(A)[0];
451
+ if (i == " ") {
452
+ for (; t >= r;) n += " ", t -= r;
453
+ i = " ";
454
+ }
455
+ for (let e = 0; e < t; e++) n += i;
456
+ return n;
457
+ }
458
+ function N(e, t) {
459
+ e instanceof p && (e = new P(e));
460
+ for (let n of e.state.facet(Ce)) {
461
+ let r = n(e, t);
462
+ if (r !== void 0) return r;
463
+ }
464
+ let n = w(e.state);
465
+ return n.length >= t ? Te(e, n, t) : null;
466
+ }
467
+ function we(e, t, n) {
468
+ let r = Object.create(null), i = new P(e, { overrideIndentation: (e) => r[e] ?? -1 }), a = [];
469
+ for (let o = t; o <= n;) {
470
+ let t = e.doc.lineAt(o);
471
+ o = t.to + 1;
472
+ let n = N(i, t.from);
473
+ if (n == null) continue;
474
+ /\S/.test(t.text) || (n = 0);
475
+ let s = /^\s*/.exec(t.text)[0], c = M(e, n);
476
+ s != c && (r[t.from] = n, a.push({
477
+ from: t.from,
478
+ to: t.from + s.length,
479
+ insert: c
480
+ }));
481
+ }
482
+ return e.changes(a);
483
+ }
484
+ var P = class {
485
+ constructor(e, t = {}) {
486
+ this.state = e, this.options = t, this.unit = j(e);
487
+ }
488
+ lineAt(e, t = 1) {
489
+ let n = this.state.doc.lineAt(e), { simulateBreak: r, simulateDoubleBreak: i } = this.options;
490
+ return r != null && r >= n.from && r <= n.to ? i && r == e ? {
491
+ text: "",
492
+ from: e
493
+ } : (t < 0 ? r < e : r <= e) ? {
494
+ text: n.text.slice(r - n.from),
495
+ from: r
496
+ } : {
497
+ text: n.text.slice(0, r - n.from),
498
+ from: n.from
499
+ } : n;
500
+ }
501
+ textAfterPos(e, t = 1) {
502
+ if (this.options.simulateDoubleBreak && e == this.options.simulateBreak) return "";
503
+ let { text: n, from: r } = this.lineAt(e, t);
504
+ return n.slice(e - r, Math.min(n.length, e + 100 - r));
505
+ }
506
+ column(e, t = 1) {
507
+ let { text: n, from: r } = this.lineAt(e, t), i = this.countColumn(n, e - r), a = this.options.overrideIndentation ? this.options.overrideIndentation(r) : -1;
508
+ return a > -1 && (i += a - this.countColumn(n, n.search(/\S|$/))), i;
509
+ }
510
+ countColumn(e, t = e.length) {
511
+ return ee(e, this.state.tabSize, t);
512
+ }
513
+ lineIndent(e, t = 1) {
514
+ let { text: n, from: r } = this.lineAt(e, t), i = this.options.overrideIndentation;
515
+ if (i) {
516
+ let e = i(r);
517
+ if (e > -1) return e;
518
+ }
519
+ return this.countColumn(n, n.search(/\S|$/));
520
+ }
521
+ get simulatedBreak() {
522
+ return this.options.simulateBreak || null;
523
+ }
524
+ }, F = /*@__PURE__*/ new o();
525
+ function Te(e, t, n) {
526
+ let r = t.resolveStack(n), i = t.resolveInner(n, -1).resolve(n, 0).enterUnfinishedNodesBefore(n);
527
+ if (i != r.node) {
528
+ let e = [];
529
+ for (let t = i; t && !(t.from < r.node.from || t.to > r.node.to || t.from == r.node.from && t.type == r.node.type); t = t.parent) e.push(t);
530
+ for (let t = e.length - 1; t >= 0; t--) r = {
531
+ node: e[t],
532
+ next: r
533
+ };
534
+ }
535
+ return Ee(r, e, n);
536
+ }
537
+ function Ee(e, t, n) {
538
+ for (let r = e; r; r = r.next) {
539
+ let e = Oe(r.node);
540
+ if (e) return e(Ae.create(t, n, r));
541
+ }
542
+ return 0;
543
+ }
544
+ function De(e) {
545
+ return e.pos == e.options.simulateBreak && e.options.simulateDoubleBreak;
546
+ }
547
+ function Oe(e) {
548
+ let t = e.type.prop(F);
549
+ if (t) return t;
550
+ let n = e.firstChild, r;
551
+ if (n && (r = n.type.prop(o.closedBy))) {
552
+ let t = e.lastChild, n = t && r.indexOf(t.name) > -1;
553
+ return (e) => Pe(e, !0, 1, void 0, n && !De(e) ? t.from : void 0);
554
+ }
555
+ return e.parent == null ? ke : null;
556
+ }
557
+ function ke() {
558
+ return 0;
559
+ }
560
+ var Ae = class e extends P {
561
+ constructor(e, t, n) {
562
+ super(e.state, e.options), this.base = e, this.pos = t, this.context = n;
563
+ }
564
+ get node() {
565
+ return this.context.node;
566
+ }
567
+ static create(t, n, r) {
568
+ return new e(t, n, r);
569
+ }
570
+ get textAfter() {
571
+ return this.textAfterPos(this.pos);
572
+ }
573
+ get baseIndent() {
574
+ return this.baseIndentFor(this.node);
575
+ }
576
+ baseIndentFor(e) {
577
+ let t = this.state.doc.lineAt(e.from);
578
+ for (;;) {
579
+ let n = e.resolve(t.from);
580
+ for (; n.parent && n.parent.from == n.from;) n = n.parent;
581
+ if (je(n, e)) break;
582
+ t = this.state.doc.lineAt(n.from);
583
+ }
584
+ return this.lineIndent(t.from);
585
+ }
586
+ continue() {
587
+ return Ee(this.context.next, this.base, this.pos);
588
+ }
589
+ };
590
+ function je(e, t) {
591
+ for (let n = t; n; n = n.parent) if (e == n) return !0;
592
+ return !1;
593
+ }
594
+ function Me(e) {
595
+ let t = e.node, n = t.childAfter(t.from), r = t.lastChild;
596
+ if (!n) return null;
597
+ let i = e.options.simulateBreak, a = e.state.doc.lineAt(n.from), o = i == null || i <= a.from ? a.to : Math.min(a.to, i);
598
+ for (let e = n.to;;) {
599
+ let i = t.childAfter(e);
600
+ if (!i || i == r) return null;
601
+ if (!i.type.isSkipped) {
602
+ if (i.from >= o) return null;
603
+ let e = /^ */.exec(a.text.slice(n.to - a.from))[0].length;
604
+ return {
605
+ from: n.from,
606
+ to: n.to + e
607
+ };
608
+ }
609
+ e = i.to;
610
+ }
611
+ }
612
+ function Ne({ closing: e, align: t = !0, units: n = 1 }) {
613
+ return (r) => Pe(r, t, n, e);
614
+ }
615
+ function Pe(e, t, n, r, i) {
616
+ let a = e.textAfter, o = a.match(/^\s*/)[0].length, s = r && a.slice(o, o + r.length) == r || i == e.pos + o, c = t ? Me(e) : null;
617
+ return c ? s ? e.column(c.from) : e.column(c.to) : e.baseIndent + (s ? 0 : e.unit * n);
618
+ }
619
+ var Fe = (e) => e.baseIndent;
620
+ function Ie({ except: e, units: t = 1 } = {}) {
621
+ return (n) => {
622
+ let r = e && e.test(n.textAfter);
623
+ return n.baseIndent + (r ? 0 : t * n.unit);
624
+ };
625
+ }
626
+ var Le = 200;
627
+ function Re() {
628
+ return p.transactionFilter.of((e) => {
629
+ if (!e.docChanged || !e.isUserEvent("input.type") && !e.isUserEvent("input.complete")) return e;
630
+ let t = e.startState.languageDataAt("indentOnInput", e.startState.selection.main.head);
631
+ if (!t.length) return e;
632
+ let n = e.newDoc, { head: r } = e.newSelection.main, i = n.lineAt(r);
633
+ if (r > i.from + Le) return e;
634
+ let a = n.sliceString(i.from, r);
635
+ if (!t.some((e) => e.test(a))) return e;
636
+ let { state: o } = e, s = -1, c = [];
637
+ for (let { head: e } of o.selection.ranges) {
638
+ let t = o.doc.lineAt(e);
639
+ if (t.from == s) continue;
640
+ s = t.from;
641
+ let n = N(o, t.from);
642
+ if (n == null) continue;
643
+ let r = /^\s*/.exec(t.text)[0], i = M(o, n);
644
+ r != i && c.push({
645
+ from: t.from,
646
+ to: t.from + r.length,
647
+ insert: i
648
+ });
649
+ }
650
+ return c.length ? [e, {
651
+ changes: c,
652
+ sequential: !0
653
+ }] : e;
654
+ });
655
+ }
656
+ var I = /*@__PURE__*/ h.define(), L = /*@__PURE__*/ new o();
657
+ function ze(e) {
658
+ let t = e.firstChild, n = e.lastChild;
659
+ return t && t.to < n.from ? {
660
+ from: t.to,
661
+ to: n.type.isError ? e.to : n.from
662
+ } : null;
663
+ }
664
+ function Be(e, t, n) {
665
+ let r = w(e);
666
+ if (r.length < n) return null;
667
+ let i = r.resolveStack(n, 1), a = null;
668
+ for (let o = i; o; o = o.next) {
669
+ let i = o.node;
670
+ if (i.to <= n || i.from > n) continue;
671
+ if (a && i.from < t) break;
672
+ let s = i.type.prop(L);
673
+ if (s && (i.to < r.length - 50 || r.length == e.doc.length || !Ve(i))) {
674
+ let r = s(i, e);
675
+ r && r.from <= n && r.from >= t && r.to > n && (a = r);
676
+ }
677
+ }
678
+ return a;
679
+ }
680
+ function Ve(e) {
681
+ let t = e.lastChild;
682
+ return t && t.to == e.to && t.type.isError;
683
+ }
684
+ function R(e, t, n) {
685
+ for (let r of e.facet(I)) {
686
+ let i = r(e, t, n);
687
+ if (i) return i;
688
+ }
689
+ return Be(e, t, n);
690
+ }
691
+ function He(e, t) {
692
+ let n = t.mapPos(e.from, 1), r = t.mapPos(e.to, -1);
693
+ return n >= r ? void 0 : {
694
+ from: n,
695
+ to: r
696
+ };
697
+ }
698
+ var z = /*@__PURE__*/ m.define({ map: He }), B = /*@__PURE__*/ m.define({ map: He });
699
+ function V(e) {
700
+ let t = [];
701
+ for (let { head: n } of e.state.selection.ranges) t.some((e) => e.from <= n && e.to >= n) || t.push(e.lineBlockAt(n));
702
+ return t;
703
+ }
704
+ var H = /*@__PURE__*/ ne.define({
705
+ create() {
706
+ return y.none;
707
+ },
708
+ update(e, t) {
709
+ t.isUserEvent("delete") && t.changes.iterChangedRanges((t, n) => e = Ue(e, t, n)), e = e.map(t.changes);
710
+ let n = [];
711
+ for (let r of t.effects) r.is(z) && !Ge(e, r.value.from, r.value.to) ? n.push(r.value) : r.is(B) && (e = e.update({
712
+ filter: (e, t) => r.value.from != e || r.value.to != t,
713
+ filterFrom: r.value.from,
714
+ filterTo: r.value.to
715
+ }));
716
+ if (n.length) {
717
+ let { preparePlaceholder: r } = t.state.facet(K), i = n.map((e) => (r ? y.replace({ widget: new nt(r(t.state, e)) }) : tt).range(e.from, e.to));
718
+ e = e.update({ add: i });
719
+ }
720
+ return t.selection && (e = Ue(e, t.selection.main.head)), e;
721
+ },
722
+ provide: (e) => v.decorations.from(e),
723
+ toJSON(e, t) {
724
+ let n = [];
725
+ return e.between(0, t.doc.length, (e, t) => {
726
+ n.push(e, t);
727
+ }), n;
728
+ },
729
+ fromJSON(e) {
730
+ if (!Array.isArray(e) || e.length % 2) throw RangeError("Invalid JSON for fold state");
731
+ let t = [];
732
+ for (let n = 0; n < e.length;) {
733
+ let r = e[n++], i = e[n++];
734
+ if (typeof r != "number" || typeof i != "number") throw RangeError("Invalid JSON for fold state");
735
+ t.push(tt.range(r, i));
736
+ }
737
+ return y.set(t, !0);
738
+ }
739
+ });
740
+ function Ue(e, t, n = t) {
741
+ let r = !1;
742
+ return e.between(t, n, (e, i) => {
743
+ e < n && i > t && (r = !0);
744
+ }), r ? e.update({
745
+ filterFrom: t,
746
+ filterTo: n,
747
+ filter: (e, r) => e >= n || r <= t
748
+ }) : e;
749
+ }
750
+ function We(e) {
751
+ return e.field(H, !1) || re.empty;
752
+ }
753
+ function U(e, t, n) {
754
+ var r;
755
+ let i = null;
756
+ return (r = e.field(H, !1)) == null || r.between(t, n, (e, t) => {
757
+ (!i || i.from > e) && (i = {
758
+ from: e,
759
+ to: t
760
+ });
761
+ }), i;
762
+ }
763
+ function Ge(e, t, n) {
764
+ let r = !1;
765
+ return e.between(t, t, (e, i) => {
766
+ e == t && i == n && (r = !0);
767
+ }), r;
768
+ }
769
+ function W(e, t) {
770
+ return e.field(H, !1) ? t : t.concat(m.appendConfig.of(q()));
771
+ }
772
+ var Ke = (e) => {
773
+ for (let t of V(e)) {
774
+ let n = R(e.state, t.from, t.to);
775
+ if (n) return e.dispatch({ effects: W(e.state, [z.of(n), G(e, n)]) }), !0;
776
+ }
777
+ return !1;
778
+ }, qe = (e) => {
779
+ if (!e.state.field(H, !1)) return !1;
780
+ let t = [];
781
+ for (let n of V(e)) {
782
+ let r = U(e.state, n.from, n.to);
783
+ r && t.push(B.of(r), G(e, r, !1));
784
+ }
785
+ return t.length && e.dispatch({ effects: t }), t.length > 0;
786
+ };
787
+ function G(e, t, n = !0) {
788
+ let r = e.state.doc.lineAt(t.from).number, i = e.state.doc.lineAt(t.to).number;
789
+ return v.announce.of(`${e.state.phrase(n ? "Folded lines" : "Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`);
790
+ }
791
+ var Je = (e) => {
792
+ let { state: t } = e, n = [];
793
+ for (let r = 0; r < t.doc.length;) {
794
+ let i = e.lineBlockAt(r), a = R(t, i.from, i.to);
795
+ a && n.push(z.of(a)), r = (a ? e.lineBlockAt(a.to) : i).to + 1;
796
+ }
797
+ return n.length && e.dispatch({ effects: W(e.state, n) }), !!n.length;
798
+ }, Ye = (e) => {
799
+ let t = e.state.field(H, !1);
800
+ if (!t || !t.size) return !1;
801
+ let n = [];
802
+ return t.between(0, e.state.doc.length, (e, t) => {
803
+ n.push(B.of({
804
+ from: e,
805
+ to: t
806
+ }));
807
+ }), e.dispatch({ effects: n }), !0;
808
+ };
809
+ function Xe(e, t) {
810
+ for (let n = t;;) {
811
+ let r = R(e.state, n.from, n.to);
812
+ if (r && r.to > t.from) return r;
813
+ if (!n.from) return null;
814
+ n = e.lineBlockAt(n.from - 1);
815
+ }
816
+ }
817
+ var Ze = (e) => {
818
+ let t = [];
819
+ for (let n of V(e)) {
820
+ let r = U(e.state, n.from, n.to);
821
+ if (r) t.push(B.of(r), G(e, r, !1));
822
+ else {
823
+ let r = Xe(e, n);
824
+ r && t.push(z.of(r), G(e, r));
825
+ }
826
+ }
827
+ return t.length > 0 && e.dispatch({ effects: W(e.state, t) }), !!t.length;
828
+ }, Qe = [
829
+ {
830
+ key: "Ctrl-Shift-[",
831
+ mac: "Cmd-Alt-[",
832
+ run: Ke
833
+ },
834
+ {
835
+ key: "Ctrl-Shift-]",
836
+ mac: "Cmd-Alt-]",
837
+ run: qe
838
+ },
839
+ {
840
+ key: "Ctrl-Alt-[",
841
+ run: Je
842
+ },
843
+ {
844
+ key: "Ctrl-Alt-]",
845
+ run: Ye
846
+ }
847
+ ], $e = {
848
+ placeholderDOM: null,
849
+ preparePlaceholder: null,
850
+ placeholderText: "…"
851
+ }, K = /*@__PURE__*/ h.define({ combine(e) {
852
+ return ie(e, $e);
853
+ } });
854
+ function q(e) {
855
+ let t = [H, at];
856
+ return e && t.push(K.of(e)), t;
857
+ }
858
+ function et(e, t) {
859
+ let { state: n } = e, r = n.facet(K), i = (t) => {
860
+ let n = e.lineBlockAt(e.posAtDOM(t.target)), r = U(e.state, n.from, n.to);
861
+ r && e.dispatch({ effects: B.of(r) }), t.preventDefault();
862
+ };
863
+ if (r.placeholderDOM) return r.placeholderDOM(e, i, t);
864
+ let a = document.createElement("span");
865
+ return a.textContent = r.placeholderText, a.setAttribute("aria-label", n.phrase("folded code")), a.title = n.phrase("unfold"), a.className = "cm-foldPlaceholder", a.onclick = i, a;
866
+ }
867
+ var tt = /*@__PURE__*/ y.replace({ widget: /*@__PURE__*/ new class extends ce {
868
+ toDOM(e) {
869
+ return et(e, null);
870
+ }
871
+ }() }), nt = class extends ce {
872
+ constructor(e) {
873
+ super(), this.value = e;
874
+ }
875
+ eq(e) {
876
+ return this.value == e.value;
877
+ }
878
+ toDOM(e) {
879
+ return et(e, this.value);
880
+ }
881
+ }, rt = {
882
+ openText: "⌄",
883
+ closedText: "›",
884
+ markerDOM: null,
885
+ domEventHandlers: {},
886
+ foldingChanged: () => !1
887
+ }, J = class extends oe {
888
+ constructor(e, t) {
889
+ super(), this.config = e, this.open = t;
890
+ }
891
+ eq(e) {
892
+ return this.config == e.config && this.open == e.open;
893
+ }
894
+ toDOM(e) {
895
+ if (this.config.markerDOM) return this.config.markerDOM(this.open);
896
+ let t = document.createElement("span");
897
+ return t.textContent = this.open ? this.config.openText : this.config.closedText, t.title = e.state.phrase(this.open ? "Fold line" : "Unfold line"), t;
898
+ }
899
+ };
900
+ function it(e = {}) {
901
+ let t = {
902
+ ...rt,
903
+ ...e
904
+ }, n = new J(t, !0), r = new J(t, !1), i = g.fromClass(class {
905
+ constructor(e) {
906
+ this.from = e.viewport.from, this.markers = this.buildMarkers(e);
907
+ }
908
+ update(e) {
909
+ (e.docChanged || e.viewportChanged || e.startState.facet(k) != e.state.facet(k) || e.startState.field(H, !1) != e.state.field(H, !1) || w(e.startState) != w(e.state) || t.foldingChanged(e)) && (this.markers = this.buildMarkers(e.view));
910
+ }
911
+ buildMarkers(e) {
912
+ let t = new f();
913
+ for (let i of e.viewportLineBlocks) {
914
+ let a = U(e.state, i.from, i.to) ? r : R(e.state, i.from, i.to) ? n : null;
915
+ a && t.add(i.from, i.from, a);
916
+ }
917
+ return t.finish();
918
+ }
919
+ }), { domEventHandlers: a } = t;
920
+ return [
921
+ i,
922
+ se({
923
+ class: "cm-foldGutter",
924
+ markers(e) {
925
+ return e.plugin(i)?.markers || re.empty;
926
+ },
927
+ initialSpacer() {
928
+ return new J(t, !1);
929
+ },
930
+ domEventHandlers: {
931
+ ...a,
932
+ click: (e, t, n) => {
933
+ if (a.click && a.click(e, t, n)) return !0;
934
+ let r = U(e.state, t.from, t.to);
935
+ if (r) return e.dispatch({ effects: B.of(r) }), !0;
936
+ let i = R(e.state, t.from, t.to);
937
+ return i ? (e.dispatch({ effects: z.of(i) }), !0) : !1;
938
+ }
939
+ }
940
+ }),
941
+ q()
942
+ ];
943
+ }
944
+ var at = /*@__PURE__*/ v.baseTheme({
945
+ ".cm-foldPlaceholder": {
946
+ backgroundColor: "#eee",
947
+ border: "1px solid #ddd",
948
+ color: "#888",
949
+ borderRadius: ".2em",
950
+ margin: "0 1px",
951
+ padding: "0 1px",
952
+ cursor: "pointer"
953
+ },
954
+ ".cm-foldGutter span": {
955
+ padding: "0 1px",
956
+ cursor: "pointer"
957
+ }
958
+ }), Y = class e {
959
+ constructor(e, n) {
960
+ this.specs = e;
961
+ let r;
962
+ function i(e) {
963
+ let t = ae.newName();
964
+ return (r ||= Object.create(null))["." + t] = e, t;
965
+ }
966
+ let a = typeof n.all == "string" ? n.all : n.all ? i(n.all) : void 0, o = n.scope;
967
+ this.scope = o instanceof C ? (e) => e.prop(b) == o.data : o ? (e) => e == o : void 0, this.style = t(e.map((e) => ({
968
+ tag: e.tag,
969
+ class: e.class || i(Object.assign({}, e, { tag: null }))
970
+ })), { all: a }).style, this.module = r ? new ae(r) : null, this.themeType = n.themeType;
971
+ }
972
+ static define(t, n) {
973
+ return new e(t, n || {});
974
+ }
975
+ }, ot = /*@__PURE__*/ h.define(), st = /*@__PURE__*/ h.define({ combine(e) {
976
+ return e.length ? [e[0]] : null;
977
+ } });
978
+ function X(e) {
979
+ let t = e.facet(ot);
980
+ return t.length ? t : e.facet(st);
981
+ }
982
+ function ct(e, t) {
983
+ let n = [dt], r;
984
+ return e instanceof Y && (e.module && n.push(v.styleModule.of(e.module)), r = e.themeType), t?.fallback ? n.push(st.of(e)) : r ? n.push(ot.computeN([v.darkTheme], (t) => t.facet(v.darkTheme) == (r == "dark") ? [e] : [])) : n.push(ot.of(e)), n;
985
+ }
986
+ function lt(e, t, n) {
987
+ let r = X(e), i = null;
988
+ if (r) {
989
+ for (let e of r) if (!e.scope || n && e.scope(n)) {
990
+ let n = e.style(t);
991
+ n && (i = i ? i + " " + n : n);
992
+ }
993
+ }
994
+ return i;
995
+ }
996
+ var ut = class {
997
+ constructor(e) {
998
+ this.markCache = Object.create(null), this.tree = w(e.state), this.decorations = this.buildDeco(e, X(e.state)), this.decoratedTo = e.viewport.to;
999
+ }
1000
+ update(e) {
1001
+ let t = w(e.state), n = X(e.state), r = n != X(e.startState), { viewport: i } = e.view, a = e.changes.mapPos(this.decoratedTo, 1);
1002
+ t.length < i.to && !r && t.type == this.tree.type && a >= i.to ? (this.decorations = this.decorations.map(e.changes), this.decoratedTo = a) : (t != this.tree || e.viewportChanged || r) && (this.tree = t, this.decorations = this.buildDeco(e.view, n), this.decoratedTo = i.to);
1003
+ }
1004
+ buildDeco(e, t) {
1005
+ if (!t || !this.tree.length) return y.none;
1006
+ let n = new f();
1007
+ for (let { from: r, to: i } of e.visibleRanges) u(this.tree, t, (e, t, r) => {
1008
+ n.add(e, t, this.markCache[r] || (this.markCache[r] = y.mark({ class: r })));
1009
+ }, r, i);
1010
+ return n.finish();
1011
+ }
1012
+ }, dt = /*@__PURE__*/ te.high(/*@__PURE__*/ g.fromClass(ut, { decorations: (e) => e.decorations })), ft = /*@__PURE__*/ Y.define([
1013
+ {
1014
+ tag: c.meta,
1015
+ color: "#404740"
1016
+ },
1017
+ {
1018
+ tag: c.link,
1019
+ textDecoration: "underline"
1020
+ },
1021
+ {
1022
+ tag: c.heading,
1023
+ textDecoration: "underline",
1024
+ fontWeight: "bold"
1025
+ },
1026
+ {
1027
+ tag: c.emphasis,
1028
+ fontStyle: "italic"
1029
+ },
1030
+ {
1031
+ tag: c.strong,
1032
+ fontWeight: "bold"
1033
+ },
1034
+ {
1035
+ tag: c.strikethrough,
1036
+ textDecoration: "line-through"
1037
+ },
1038
+ {
1039
+ tag: c.keyword,
1040
+ color: "#708"
1041
+ },
1042
+ {
1043
+ tag: [
1044
+ c.atom,
1045
+ c.bool,
1046
+ c.url,
1047
+ c.contentSeparator,
1048
+ c.labelName
1049
+ ],
1050
+ color: "#219"
1051
+ },
1052
+ {
1053
+ tag: [c.literal, c.inserted],
1054
+ color: "#164"
1055
+ },
1056
+ {
1057
+ tag: [c.string, c.deleted],
1058
+ color: "#a11"
1059
+ },
1060
+ {
1061
+ tag: [
1062
+ c.regexp,
1063
+ c.escape,
1064
+ /*@__PURE__*/ c.special(c.string)
1065
+ ],
1066
+ color: "#e40"
1067
+ },
1068
+ {
1069
+ tag: /*@__PURE__*/ c.definition(c.variableName),
1070
+ color: "#00f"
1071
+ },
1072
+ {
1073
+ tag: /*@__PURE__*/ c.local(c.variableName),
1074
+ color: "#30a"
1075
+ },
1076
+ {
1077
+ tag: [c.typeName, c.namespace],
1078
+ color: "#085"
1079
+ },
1080
+ {
1081
+ tag: c.className,
1082
+ color: "#167"
1083
+ },
1084
+ {
1085
+ tag: [/*@__PURE__*/ c.special(c.variableName), c.macroName],
1086
+ color: "#256"
1087
+ },
1088
+ {
1089
+ tag: /*@__PURE__*/ c.definition(c.propertyName),
1090
+ color: "#00c"
1091
+ },
1092
+ {
1093
+ tag: c.comment,
1094
+ color: "#940"
1095
+ },
1096
+ {
1097
+ tag: c.invalid,
1098
+ color: "#f00"
1099
+ }
1100
+ ]), pt = /*@__PURE__*/ v.baseTheme({
1101
+ "&.cm-focused .cm-matchingBracket": { backgroundColor: "#328c8252" },
1102
+ "&.cm-focused .cm-nonmatchingBracket": { backgroundColor: "#bb555544" }
1103
+ }), mt = 1e4, ht = "()[]{}", gt = /*@__PURE__*/ h.define({ combine(e) {
1104
+ return ie(e, {
1105
+ afterCursor: !0,
1106
+ brackets: ht,
1107
+ maxScanDistance: mt,
1108
+ renderMatch: yt
1109
+ });
1110
+ } }), _t = /*@__PURE__*/ y.mark({ class: "cm-matchingBracket" }), vt = /*@__PURE__*/ y.mark({ class: "cm-nonmatchingBracket" });
1111
+ function yt(e) {
1112
+ let t = [], n = e.matched ? _t : vt;
1113
+ return t.push(n.range(e.start.from, e.start.to)), e.end && t.push(n.range(e.end.from, e.end.to)), t;
1114
+ }
1115
+ function bt(e) {
1116
+ let t = [], n = e.facet(gt);
1117
+ for (let r of e.selection.ranges) {
1118
+ if (!r.empty) continue;
1119
+ let i = Z(e, r.head, -1, n) || r.head > 0 && Z(e, r.head - 1, 1, n) || n.afterCursor && (Z(e, r.head, 1, n) || r.head < e.doc.length && Z(e, r.head + 1, -1, n));
1120
+ i && (t = t.concat(n.renderMatch(i, e)));
1121
+ }
1122
+ return y.set(t, !0);
1123
+ }
1124
+ var xt = [/* @__PURE__ */ g.fromClass(class {
1125
+ constructor(e) {
1126
+ this.paused = !1, this.decorations = bt(e.state);
1127
+ }
1128
+ update(e) {
1129
+ (e.docChanged || e.selectionSet || this.paused) && (e.view.composing ? (this.decorations = this.decorations.map(e.changes), this.paused = !0) : (this.decorations = bt(e.state), this.paused = !1));
1130
+ }
1131
+ }, { decorations: (e) => e.decorations }), pt];
1132
+ function St(e = {}) {
1133
+ return [gt.of(e), xt];
1134
+ }
1135
+ var Ct = /*@__PURE__*/ new o();
1136
+ function wt(e, t, n) {
1137
+ let r = e.prop(t < 0 ? o.openedBy : o.closedBy);
1138
+ if (r) return r;
1139
+ if (e.name.length == 1) {
1140
+ let r = n.indexOf(e.name);
1141
+ if (r > -1 && r % 2 == +(t < 0)) return [n[r + t]];
1142
+ }
1143
+ return null;
1144
+ }
1145
+ function Tt(e) {
1146
+ let t = e.type.prop(Ct);
1147
+ return t ? t(e.node) : e;
1148
+ }
1149
+ function Z(e, t, n, r = {}) {
1150
+ let i = r.maxScanDistance || mt, a = r.brackets || ht, o = w(e), s = o.resolveInner(t, n);
1151
+ for (let r = s; r; r = r.parent) {
1152
+ let i = wt(r.type, n, a);
1153
+ if (i && r.from < r.to) {
1154
+ let o = Tt(r);
1155
+ if (o && (n > 0 ? t >= o.from && t < o.to : t > o.from && t <= o.to)) return Et(e, t, n, r, o, i, a);
1156
+ }
1157
+ }
1158
+ return Dt(e, t, n, o, s.type, i, a);
1159
+ }
1160
+ function Et(e, t, n, r, i, a, o) {
1161
+ let s = r.parent, c = {
1162
+ from: i.from,
1163
+ to: i.to
1164
+ }, l = 0, u = s?.cursor();
1165
+ if (u && (n < 0 ? u.childBefore(r.from) : u.childAfter(r.to))) do
1166
+ if (n < 0 ? u.to <= r.from : u.from >= r.to) {
1167
+ if (l == 0 && a.indexOf(u.type.name) > -1 && u.from < u.to) {
1168
+ let e = Tt(u);
1169
+ return {
1170
+ start: c,
1171
+ end: e ? {
1172
+ from: e.from,
1173
+ to: e.to
1174
+ } : void 0,
1175
+ matched: !0
1176
+ };
1177
+ }
1178
+ if (wt(u.type, n, o)) l++;
1179
+ else if (wt(u.type, -n, o)) {
1180
+ if (l == 0) {
1181
+ let e = Tt(u);
1182
+ return {
1183
+ start: c,
1184
+ end: e && e.from < e.to ? {
1185
+ from: e.from,
1186
+ to: e.to
1187
+ } : void 0,
1188
+ matched: !1
1189
+ };
1190
+ }
1191
+ l--;
1192
+ }
1193
+ }
1194
+ while (n < 0 ? u.prevSibling() : u.nextSibling());
1195
+ return {
1196
+ start: c,
1197
+ matched: !1
1198
+ };
1199
+ }
1200
+ function Dt(e, t, n, r, i, a, o) {
1201
+ if (n < 0 ? !t : t == e.doc.length) return null;
1202
+ let s = n < 0 ? e.sliceDoc(t - 1, t) : e.sliceDoc(t, t + 1), c = o.indexOf(s);
1203
+ if (c < 0 || c % 2 == 0 != n > 0) return null;
1204
+ let l = {
1205
+ from: n < 0 ? t - 1 : t,
1206
+ to: n > 0 ? t + 1 : t
1207
+ }, u = e.doc.iterRange(t, n > 0 ? e.doc.length : 0), d = 0;
1208
+ for (let e = 0; !u.next().done && e <= a;) {
1209
+ let a = u.value;
1210
+ n < 0 && (e += a.length);
1211
+ let s = t + e * n;
1212
+ for (let e = n > 0 ? 0 : a.length - 1, t = n > 0 ? a.length : -1; e != t; e += n) {
1213
+ let t = o.indexOf(a[e]);
1214
+ if (!(t < 0 || r.resolveInner(s + e, 1).type != i)) {
1215
+ if (t % 2 == 0 == n > 0) d++;
1216
+ else if (d == 1) return {
1217
+ start: l,
1218
+ end: {
1219
+ from: s + e,
1220
+ to: s + e + 1
1221
+ },
1222
+ matched: t >> 1 == c >> 1
1223
+ };
1224
+ else d--;
1225
+ }
1226
+ }
1227
+ n > 0 && (e += a.length);
1228
+ }
1229
+ return u.done ? {
1230
+ start: l,
1231
+ matched: !1
1232
+ } : null;
1233
+ }
1234
+ function Ot(e, t, n, r = 0, i = 0) {
1235
+ t ?? (t = e.search(/[^\s\u00a0]/), t == -1 && (t = e.length));
1236
+ let a = i;
1237
+ for (let i = r; i < t; i++) e.charCodeAt(i) == 9 ? a += n - a % n : a++;
1238
+ return a;
1239
+ }
1240
+ var kt = class {
1241
+ constructor(e, t, n, r) {
1242
+ this.string = e, this.tabSize = t, this.indentUnit = n, this.overrideIndent = r, this.pos = 0, this.start = 0, this.lastColumnPos = 0, this.lastColumnValue = 0;
1243
+ }
1244
+ eol() {
1245
+ return this.pos >= this.string.length;
1246
+ }
1247
+ sol() {
1248
+ return this.pos == 0;
1249
+ }
1250
+ peek() {
1251
+ return this.string.charAt(this.pos) || void 0;
1252
+ }
1253
+ next() {
1254
+ if (this.pos < this.string.length) return this.string.charAt(this.pos++);
1255
+ }
1256
+ eat(e) {
1257
+ let t = this.string.charAt(this.pos), n;
1258
+ if (n = typeof e == "string" ? t == e : t && (e instanceof RegExp ? e.test(t) : e(t)), n) return ++this.pos, t;
1259
+ }
1260
+ eatWhile(e) {
1261
+ let t = this.pos;
1262
+ for (; this.eat(e););
1263
+ return this.pos > t;
1264
+ }
1265
+ eatSpace() {
1266
+ let e = this.pos;
1267
+ for (; /[\s\u00a0]/.test(this.string.charAt(this.pos));) ++this.pos;
1268
+ return this.pos > e;
1269
+ }
1270
+ skipToEnd() {
1271
+ this.pos = this.string.length;
1272
+ }
1273
+ skipTo(e) {
1274
+ let t = this.string.indexOf(e, this.pos);
1275
+ if (t > -1) return this.pos = t, !0;
1276
+ }
1277
+ backUp(e) {
1278
+ this.pos -= e;
1279
+ }
1280
+ column() {
1281
+ return this.lastColumnPos < this.start && (this.lastColumnValue = Ot(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue), this.lastColumnPos = this.start), this.lastColumnValue;
1282
+ }
1283
+ indentation() {
1284
+ return this.overrideIndent ?? Ot(this.string, null, this.tabSize);
1285
+ }
1286
+ match(e, t, n) {
1287
+ if (typeof e == "string") {
1288
+ let r = (e) => n ? e.toLowerCase() : e;
1289
+ return r(this.string.substr(this.pos, e.length)) == r(e) ? (t !== !1 && (this.pos += e.length), !0) : null;
1290
+ }
1291
+ {
1292
+ let n = this.string.slice(this.pos).match(e);
1293
+ return n && n.index > 0 ? null : (n && t !== !1 && (this.pos += n[0].length), n);
1294
+ }
1295
+ }
1296
+ current() {
1297
+ return this.string.slice(this.start, this.pos);
1298
+ }
1299
+ };
1300
+ function At(e) {
1301
+ return {
1302
+ name: e.name || "",
1303
+ token: e.token,
1304
+ blankLine: e.blankLine || (() => {}),
1305
+ startState: e.startState || (() => !0),
1306
+ copyState: e.copyState || jt,
1307
+ indent: e.indent || (() => null),
1308
+ languageData: e.languageData || {},
1309
+ tokenTable: e.tokenTable || zt,
1310
+ mergeTokens: e.mergeTokens !== !1
1311
+ };
1312
+ }
1313
+ function jt(e) {
1314
+ if (typeof e != "object") return e;
1315
+ let t = {};
1316
+ for (let n in e) {
1317
+ let r = e[n];
1318
+ t[n] = r instanceof Array ? r.slice() : r;
1319
+ }
1320
+ return t;
1321
+ }
1322
+ var Mt = /*@__PURE__*/ new WeakMap(), Nt = class e extends C {
1323
+ constructor(e) {
1324
+ let t = x(e.languageData), n = At(e), r, i = new class extends l {
1325
+ createParse(e, t, n) {
1326
+ return new Lt(r, e, t, n);
1327
+ }
1328
+ }();
1329
+ super(t, i, [], e.name), this.topNode = Jt(t, this), r = this, this.streamParser = n, this.stateAfter = new o({ perNode: !0 }), this.tokenTable = e.tokenTable ? new Wt(n.tokenTable) : Gt;
1330
+ }
1331
+ static define(t) {
1332
+ return new e(t);
1333
+ }
1334
+ getIndent(e) {
1335
+ let t, { overrideIndentation: n } = e.options;
1336
+ n && (t = Mt.get(e.state), t != null && t < e.pos - 1e4 && (t = void 0));
1337
+ let r = Pt(this, e.node.tree, e.node.from, e.node.from, t ?? e.pos), i, a;
1338
+ if (r ? (a = r.state, i = r.pos + 1) : (a = this.streamParser.startState(e.unit), i = e.node.from), e.pos - i > 1e4) return null;
1339
+ for (; i < e.pos;) {
1340
+ let t = e.state.doc.lineAt(i), r = Math.min(e.pos, t.to);
1341
+ if (t.length) {
1342
+ let i = n ? n(t.from) : -1, o = new kt(t.text, e.state.tabSize, e.unit, i < 0 ? void 0 : i);
1343
+ for (; o.pos < r - t.from;) Rt(this.streamParser.token, o, a);
1344
+ } else this.streamParser.blankLine(a, e.unit);
1345
+ if (r == e.pos) break;
1346
+ i = t.to + 1;
1347
+ }
1348
+ let o = e.lineAt(e.pos);
1349
+ return n && t == null && Mt.set(e.state, o.from), this.streamParser.indent(a, /^\s*(.*)/.exec(o.text)[1], e);
1350
+ }
1351
+ get allowsNesting() {
1352
+ return !1;
1353
+ }
1354
+ };
1355
+ function Pt(e, t, n, r, i) {
1356
+ let a = n >= r && n + t.length <= i && t.prop(e.stateAfter);
1357
+ if (a) return {
1358
+ state: e.streamParser.copyState(a),
1359
+ pos: n + t.length
1360
+ };
1361
+ for (let a = t.children.length - 1; a >= 0; a--) {
1362
+ let o = t.children[a], c = n + t.positions[a], l = o instanceof s && c < i && Pt(e, o, c, r, i);
1363
+ if (l) return l;
1364
+ }
1365
+ return null;
1366
+ }
1367
+ function Ft(e, t, n, r, i) {
1368
+ if (i && n <= 0 && r >= t.length) return t;
1369
+ !i && n == 0 && t.type == e.topNode && (i = !0);
1370
+ for (let a = t.children.length - 1; a >= 0; a--) {
1371
+ let o = t.positions[a], c = t.children[a], l;
1372
+ if (o < r && c instanceof s) {
1373
+ if (!(l = Ft(e, c, n - o, r - o, i))) break;
1374
+ return i ? new s(t.type, t.children.slice(0, a).concat(l), t.positions.slice(0, a + 1), o + l.length) : l;
1375
+ }
1376
+ }
1377
+ return null;
1378
+ }
1379
+ function It(e, t, n, r, i) {
1380
+ for (let i of t) {
1381
+ let t = i.from + (i.openStart ? 25 : 0), a = i.to - (i.openEnd ? 25 : 0), o = t <= n && a > n && Pt(e, i.tree, 0 - i.offset, n, a), s;
1382
+ if (o && o.pos <= r && (s = Ft(e, i.tree, n + i.offset, o.pos + i.offset, !1))) return {
1383
+ state: o.state,
1384
+ tree: s
1385
+ };
1386
+ }
1387
+ return {
1388
+ state: e.streamParser.startState(i ? j(i) : 4),
1389
+ tree: s.empty
1390
+ };
1391
+ }
1392
+ var Lt = class {
1393
+ constructor(e, t, n, r) {
1394
+ this.lang = e, this.input = t, this.fragments = n, this.ranges = r, this.stoppedAt = null, this.chunks = [], this.chunkPos = [], this.chunk = [], this.chunkReused = void 0, this.rangeIndex = 0, this.to = r[r.length - 1].to;
1395
+ let i = E.get(), a = r[0].from, { state: o, tree: s } = It(e, n, a, this.to, i?.state);
1396
+ this.state = o, this.parsedPos = this.chunkStart = a + s.length;
1397
+ for (let e = 0; e < s.children.length; e++) this.chunks.push(s.children[e]), this.chunkPos.push(s.positions[e]);
1398
+ i && this.parsedPos < i.viewport.from - 1e5 && r.some((e) => e.from <= i.viewport.from && e.to >= i.viewport.from) && (this.state = this.lang.streamParser.startState(j(i.state)), i.skipUntilInView(this.parsedPos, i.viewport.from), this.parsedPos = i.viewport.from), this.moveRangeIndex();
1399
+ }
1400
+ advance() {
1401
+ let e = E.get(), t = this.stoppedAt == null ? this.to : Math.min(this.to, this.stoppedAt), n = Math.min(t, this.chunkStart + 512);
1402
+ for (e && (n = Math.min(n, e.viewport.to)); this.parsedPos < n;) this.parseLine(e);
1403
+ return this.chunkStart < this.parsedPos && this.finishChunk(), this.parsedPos >= t ? this.finish() : e && this.parsedPos >= e.viewport.to ? (e.skipUntilInView(this.parsedPos, t), this.finish()) : null;
1404
+ }
1405
+ stopAt(e) {
1406
+ this.stoppedAt = e;
1407
+ }
1408
+ lineAfter(e) {
1409
+ let t = this.input.chunk(e);
1410
+ if (this.input.lineChunks) t == "\n" && (t = "");
1411
+ else {
1412
+ let e = t.indexOf("\n");
1413
+ e > -1 && (t = t.slice(0, e));
1414
+ }
1415
+ return e + t.length <= this.to ? t : t.slice(0, this.to - e);
1416
+ }
1417
+ nextLine() {
1418
+ let e = this.parsedPos, t = this.lineAfter(e), n = e + t.length;
1419
+ for (let e = this.rangeIndex;;) {
1420
+ let r = this.ranges[e].to;
1421
+ if (r >= n || (t = t.slice(0, r - (n - t.length)), e++, e == this.ranges.length)) break;
1422
+ let i = this.ranges[e].from, a = this.lineAfter(i);
1423
+ t += a, n = i + a.length;
1424
+ }
1425
+ return {
1426
+ line: t,
1427
+ end: n
1428
+ };
1429
+ }
1430
+ skipGapsTo(e, t, n) {
1431
+ for (;;) {
1432
+ let r = this.ranges[this.rangeIndex].to, i = e + t;
1433
+ if (n > 0 ? r > i : r >= i) break;
1434
+ let a = this.ranges[++this.rangeIndex].from;
1435
+ t += a - r;
1436
+ }
1437
+ return t;
1438
+ }
1439
+ moveRangeIndex() {
1440
+ for (; this.ranges[this.rangeIndex].to < this.parsedPos;) this.rangeIndex++;
1441
+ }
1442
+ emitToken(e, t, n, r) {
1443
+ let i = 4;
1444
+ if (this.ranges.length > 1) {
1445
+ r = this.skipGapsTo(t, r, 1), t += r;
1446
+ let e = this.chunk.length;
1447
+ r = this.skipGapsTo(n, r, -1), n += r, i += this.chunk.length - e;
1448
+ }
1449
+ let a = this.chunk.length - 4;
1450
+ return this.lang.streamParser.mergeTokens && i == 4 && a >= 0 && this.chunk[a] == e && this.chunk[a + 2] == t ? this.chunk[a + 2] = n : this.chunk.push(e, t, n, i), r;
1451
+ }
1452
+ parseLine(e) {
1453
+ let { line: t, end: n } = this.nextLine(), r = 0, { streamParser: i } = this.lang, a = new kt(t, e ? e.state.tabSize : 4, e ? j(e.state) : 2);
1454
+ if (a.eol()) i.blankLine(this.state, a.indentUnit);
1455
+ else for (; !a.eol();) {
1456
+ let e = Rt(i.token, a, this.state);
1457
+ if (e && (r = this.emitToken(this.lang.tokenTable.resolve(e), this.parsedPos + a.start, this.parsedPos + a.pos, r)), a.start > 1e4) break;
1458
+ }
1459
+ this.parsedPos = n, this.moveRangeIndex(), this.parsedPos < this.to && this.parsedPos++;
1460
+ }
1461
+ finishChunk() {
1462
+ let e = s.build({
1463
+ buffer: this.chunk,
1464
+ start: this.chunkStart,
1465
+ length: this.parsedPos - this.chunkStart,
1466
+ nodeSet: Bt,
1467
+ topID: 0,
1468
+ maxBufferLength: 512,
1469
+ reused: this.chunkReused
1470
+ });
1471
+ e = new s(e.type, e.children, e.positions, e.length, [[this.lang.stateAfter, this.lang.streamParser.copyState(this.state)]]), this.chunks.push(e), this.chunkPos.push(this.chunkStart - this.ranges[0].from), this.chunk = [], this.chunkReused = void 0, this.chunkStart = this.parsedPos;
1472
+ }
1473
+ finish() {
1474
+ return new s(this.lang.topNode, this.chunks, this.chunkPos, this.parsedPos - this.ranges[0].from).balance();
1475
+ }
1476
+ };
1477
+ function Rt(e, t, n) {
1478
+ t.start = t.pos;
1479
+ for (let r = 0; r < 10; r++) {
1480
+ let r = e(t, n);
1481
+ if (t.pos > t.start) return r;
1482
+ }
1483
+ throw Error("Stream parser failed to advance stream.");
1484
+ }
1485
+ var zt = /*@__PURE__*/ Object.create(null), Q = [r.none], Bt = /*@__PURE__*/ new d(Q), Vt = [], Ht = /*@__PURE__*/ Object.create(null), Ut = /*@__PURE__*/ Object.create(null);
1486
+ for (let [e, t] of [
1487
+ ["variable", "variableName"],
1488
+ ["variable-2", "variableName.special"],
1489
+ ["string-2", "string.special"],
1490
+ ["def", "variableName.definition"],
1491
+ ["tag", "tagName"],
1492
+ ["attribute", "attributeName"],
1493
+ ["type", "typeName"],
1494
+ ["builtin", "variableName.standard"],
1495
+ ["qualifier", "modifier"],
1496
+ ["error", "invalid"],
1497
+ ["header", "heading"],
1498
+ ["property", "propertyName"]
1499
+ ]) Ut[e] = /*@__PURE__*/ qt(zt, t);
1500
+ var Wt = class {
1501
+ constructor(e) {
1502
+ this.extra = e, this.table = Object.assign(Object.create(null), Ut);
1503
+ }
1504
+ resolve(e) {
1505
+ return e ? this.table[e] || (this.table[e] = qt(this.extra, e)) : 0;
1506
+ }
1507
+ }, Gt = /*@__PURE__*/ new Wt(zt);
1508
+ function Kt(e, t) {
1509
+ Vt.indexOf(e) > -1 || (Vt.push(e), console.warn(t));
1510
+ }
1511
+ function qt(e, t) {
1512
+ let n = [];
1513
+ for (let r of t.split(" ")) {
1514
+ let t = [];
1515
+ for (let n of r.split(".")) {
1516
+ let r = e[n] || c[n];
1517
+ r ? typeof r == "function" ? t.length ? t = t.map(r) : Kt(n, `Modifier ${n} used at start of tag`) : t.length ? Kt(n, `Tag ${n} used as modifier`) : t = Array.isArray(r) ? r : [r] : Kt(n, `Unknown highlighting tag ${n}`);
1518
+ }
1519
+ for (let e of t) n.push(e);
1520
+ }
1521
+ if (!n.length) return 0;
1522
+ let i = t.replace(/ /g, "_"), o = i + " " + n.map((e) => e.id), s = Ht[o];
1523
+ if (s) return s.id;
1524
+ let l = Ht[o] = r.define({
1525
+ id: Q.length,
1526
+ name: i,
1527
+ props: [a({ [i]: n })]
1528
+ });
1529
+ return Q.push(l), l.id;
1530
+ }
1531
+ function Jt(e, t) {
1532
+ let n = r.define({
1533
+ id: Q.length,
1534
+ name: "Document",
1535
+ props: [b.add(() => e), F.add(() => (e) => t.getIndent(e))],
1536
+ top: !0
1537
+ });
1538
+ return Q.push(n), n;
1539
+ }
1540
+ function Yt(e) {
1541
+ return e.length <= 4096 && /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(e);
1542
+ }
1543
+ function Xt(e) {
1544
+ for (let t = e.iter(); !t.next().done;) if (Yt(t.value)) return !0;
1545
+ return !1;
1546
+ }
1547
+ function Zt(e) {
1548
+ let t = !1;
1549
+ return e.iterChanges((e, n, r, i, a) => {
1550
+ !t && Xt(a) && (t = !0);
1551
+ }), t;
1552
+ }
1553
+ var $ = /*@__PURE__*/ h.define({ combine: (e) => e.some((e) => e) });
1554
+ function Qt(e = {}) {
1555
+ let t = [$t];
1556
+ return e.alwaysIsolate && t.push($.of(!0)), t;
1557
+ }
1558
+ var $t = /*@__PURE__*/ g.fromClass(class {
1559
+ constructor(e) {
1560
+ this.always = e.state.facet($) || e.textDirection != _.LTR || e.state.facet(v.perLineTextDirection), this.hasRTL = !this.always && Xt(e.state.doc), this.tree = w(e.state), this.decorations = this.always || this.hasRTL ? en(e, this.tree, this.always) : y.none;
1561
+ }
1562
+ update(e) {
1563
+ let t = e.state.facet($) || e.view.textDirection != _.LTR || e.state.facet(v.perLineTextDirection);
1564
+ if (!t && !this.hasRTL && Zt(e.changes) && (this.hasRTL = !0), !t && !this.hasRTL) return;
1565
+ let n = w(e.state);
1566
+ (t != this.always || n != this.tree || e.docChanged || e.viewportChanged) && (this.tree = n, this.always = t, this.decorations = en(e.view, n, t));
1567
+ }
1568
+ }, { provide: (e) => {
1569
+ function t(t) {
1570
+ return t.plugin(e)?.decorations ?? y.none;
1571
+ }
1572
+ return [v.outerDecorations.of(t), te.lowest(v.bidiIsolatedRanges.of(t))];
1573
+ } });
1574
+ function en(e, t, n) {
1575
+ let r = new f(), i = e.visibleRanges;
1576
+ n || (i = tn(i, e.state.doc));
1577
+ for (let { from: e, to: n } of i) t.iterate({
1578
+ enter: (e) => {
1579
+ let t = e.type.prop(o.isolate);
1580
+ t && r.add(e.from, e.to, nn[t]);
1581
+ },
1582
+ from: e,
1583
+ to: n
1584
+ });
1585
+ return r.finish();
1586
+ }
1587
+ function tn(e, t) {
1588
+ let n = t.iter(), r = 0, i = [], a = null;
1589
+ for (let { from: t, to: o } of e) if (!(a && a.to > t && (t = a.to, t >= o))) for (r + n.value.length < t && (n.next(t - (r + n.value.length)), r = t);;) {
1590
+ let e = r, t = r + n.value.length;
1591
+ if (!n.lineBreak && Yt(n.value) && (a && a.to > e - 10 ? a.to = Math.min(o, t) : i.push(a = {
1592
+ from: e,
1593
+ to: Math.min(o, t)
1594
+ })), t >= o) break;
1595
+ r = t, n.next();
1596
+ }
1597
+ return i;
1598
+ }
1599
+ var nn = {
1600
+ rtl: /*@__PURE__*/ y.mark({
1601
+ class: "cm-iso",
1602
+ inclusive: !0,
1603
+ attributes: { dir: "rtl" },
1604
+ bidiIsolate: _.RTL
1605
+ }),
1606
+ ltr: /*@__PURE__*/ y.mark({
1607
+ class: "cm-iso",
1608
+ inclusive: !0,
1609
+ attributes: { dir: "ltr" },
1610
+ bidiIsolate: _.LTR
1611
+ }),
1612
+ auto: /*@__PURE__*/ y.mark({
1613
+ class: "cm-iso",
1614
+ inclusive: !0,
1615
+ attributes: { dir: "auto" },
1616
+ bidiIsolate: null
1617
+ })
1618
+ };
1619
+ //#endregion
1620
+ export { ct as A, F as C, b as D, A as E, Z as O, N as S, M as T, ze as _, Se as a, I as b, St as c, ft as d, x as f, it as g, Fe as h, C as i, w as j, S as k, Ct as l, ue as m, P as n, xe as o, Ne as p, fe as r, E as s, Y as t, Ie as u, Qe as v, Re as w, j as x, L as y };