@luckzz/vue-logicflow-designer 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4423 @@
1
+ import { ref as J, shallowRef as Gt, computed as we, provide as ji, inject as Wi, resolveComponent as fe, openBlock as X, createElementBlock as ie, createElementVNode as L, createVNode as C, withCtx as A, createTextVNode as ne, createBlock as He, createCommentVNode as We, unref as te, isRef as je, Fragment as wn, renderList as Sn, normalizeClass as Kt, toDisplayString as st, withModifiers as nt, onMounted as In, onUnmounted as Fn, watch as ct, nextTick as _t } from "vue";
2
+ import { ElMessage as Be, ElMessageBox as En } from "element-plus";
3
+ import "./space-air-plugin.es.js";
4
+ import { F as Mn, u as Ui, g as Ut, d as be, _ as It, i as Hi, S as zi, K as it, p as Xi, e as Gi } from "./engine-core-DEblhuLi.js";
5
+ import { StateEffect as Qe, EditorSelection as De, StateField as Bn, Prec as Ki, codePointAt as qi, fromCodePoint as Ji, codePointSize as Qi, Facet as Jt, combineConfig as Qt, CharCategory as Ce, EditorState as Lt, RangeSetBuilder as Pn, findClusterBreak as $n } from "@codemirror/state";
6
+ import { getPanel as Yt, getDialog as Yi, showDialog as Zi, EditorView as Ee, ViewPlugin as Vn, Decoration as de, showPanel as jn, runScopeHandlers as el, activateHover as tl, hoverTooltip as nl, WidgetType as il, lineNumbers as ll, highlightActiveLineGutter as sl, highlightSpecialChars as al, drawSelection as rl, dropCursor as ol, rectangularSelection as cl, crosshairCursor as ul, highlightActiveLine as dl, keymap as fl } from "@codemirror/view";
7
+ import { foldGutter as hl, indentOnInput as gl, syntaxHighlighting as pl, defaultHighlightStyle as ml, bracketMatching as vl, foldKeymap as bl } from "@codemirror/language";
8
+ import { history as yl, defaultKeymap as xl, historyKeymap as wl, indentWithTab as Sl } from "@codemirror/commands";
9
+ import { closeBrackets as El, autocompletion as Ml, closeBracketsKeymap as _l, completionKeymap as Cl } from "@codemirror/autocomplete";
10
+ import './logicflow-designer3.css';class ht {
11
+ /**
12
+ * @param {Object} data
13
+ * @param {string} data.id - 唯一标识,如 "s1"
14
+ * @param {string} data.name - 名称,如 "普通脚本"
15
+ * @param {string} data.type - 类型:script / switch_script / if_script / for_script / while_script / break_script
16
+ * @param {string} data.language - 语言,如 "groovy" / "js" / "python" / "lua" / "QLExpress"
17
+ * @param {string} data.value - CDATA 内容(脚本源码)
18
+ */
19
+ constructor(e = {}) {
20
+ this.id = e.id || "", this.name = e.name || "", this.type = e.type || "script", this.language = e.language || "groovy", this.value = e.value || "";
21
+ }
22
+ }
23
+ class gt {
24
+ /**
25
+ * @param {Object} data
26
+ * @param {string} data.name - 链名称(唯一标识),如 "chain1"
27
+ * @param {string} data.dsl - DSL 表达式字符串,如 "THEN(a, b, WHEN(c, d))"
28
+ * ⚠️ 不再持有 flowData。
29
+ * flowData 在激活时由 useFlowManager 动态创建,
30
+ * 反激活时通过 toDSL() 保存回 dsl,然后丢弃。
31
+ */
32
+ constructor(e = {}) {
33
+ this.name = e.name || "", this.dsl = e.dsl || "";
34
+ }
35
+ }
36
+ class Je {
37
+ /**
38
+ * @param {Object} data
39
+ * @param {ScriptNode[]} data.scriptNodes
40
+ * @param {ChainModel[]} data.chains
41
+ */
42
+ constructor(e = {}) {
43
+ this.scriptNodes = (e.scriptNodes || []).map((t) => t instanceof ht ? t : new ht(t)), this.chains = (e.chains || []).map((t) => t instanceof gt ? t : new gt(t));
44
+ }
45
+ /**
46
+ * 克隆(浅拷贝列表,深拷贝元素)
47
+ */
48
+ clone() {
49
+ return new Je({
50
+ scriptNodes: this.scriptNodes.map((e) => new ht({ ...e })),
51
+ chains: this.chains.map((e) => new gt({ ...e }))
52
+ });
53
+ }
54
+ }
55
+ function _n(i) {
56
+ try {
57
+ const e = document.implementation.createDocument(null, "flow", null), t = e.createElement("nodes");
58
+ i.scriptNodes && i.scriptNodes.length > 0 && i.scriptNodes.forEach((r) => {
59
+ const c = e.createElement("node");
60
+ c.setAttribute("id", r.id || ""), c.setAttribute("name", r.name || ""), c.setAttribute("type", r.type || "script"), c.setAttribute("language", r.language || "groovy"), r.value !== null && r.value !== void 0 && c.appendChild(e.createCDATASection(r.value)), t.appendChild(c);
61
+ }), e.documentElement.appendChild(t), i.chains && i.chains.length > 0 && i.chains.forEach((r) => {
62
+ const c = e.createElement("chain");
63
+ c.setAttribute("name", r.name || ""), r.dsl && c.appendChild(e.createTextNode(r.dsl)), e.documentElement.appendChild(c);
64
+ });
65
+ let l = new XMLSerializer().serializeToString(e);
66
+ const s = `<?xml version="1.0" encoding="UTF-8"?>
67
+ `, o = `<!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd">
68
+ `;
69
+ if (l.startsWith("<?xml")) {
70
+ const r = l.indexOf("?>");
71
+ r !== -1 && (l = l.substring(r + 2).trimStart());
72
+ }
73
+ return l = s + o + l, Ll(l);
74
+ } catch (e) {
75
+ return console.error("[XMLParser] 导出 XML 失败:", e), "";
76
+ }
77
+ }
78
+ function kl(i) {
79
+ if (!i || !i.trim())
80
+ return new Je();
81
+ try {
82
+ const t = new DOMParser().parseFromString(i, "application/xml"), n = t.querySelector("parsererror");
83
+ if (n)
84
+ throw new Error(n.textContent);
85
+ const l = [], s = [];
86
+ return t.querySelectorAll("node, nodes > node").forEach((c) => {
87
+ const p = c.getAttribute("id") || "", w = c.getAttribute("name") || "", m = c.getAttribute("type") || "script", f = c.getAttribute("language") || "groovy", N = Nl(c);
88
+ l.push(new ht({ id: p, name: w, type: m, language: f, value: N }));
89
+ }), t.querySelectorAll("chain, flow > chain").forEach((c) => {
90
+ const p = c.getAttribute("name") || "", w = (c.textContent || "").trim();
91
+ s.push(new gt({ name: p, dsl: w }));
92
+ }), new Je({ scriptNodes: l, chains: s });
93
+ } catch (e) {
94
+ throw console.error("[XMLParser] 解析 XML 失败:", e), e;
95
+ }
96
+ }
97
+ function Nl(i) {
98
+ let e = "";
99
+ for (const t of i.childNodes)
100
+ t.nodeType === Node.CDATA_SECTION_NODE ? e += t.data : t.nodeType === Node.TEXT_NODE && (Array.from(i.childNodes).some((l) => l.nodeType === Node.CDATA_SECTION_NODE) || (e += t.textContent));
101
+ return e.trim();
102
+ }
103
+ function Ll(i) {
104
+ const t = i.replace(/></g, `>
105
+ <`).replace(/\n\s*\n/g, `
106
+ `).split(`
107
+ `);
108
+ let n = 0;
109
+ const l = [];
110
+ for (let s = 0; s < t.length; s++) {
111
+ const o = t[s].trim();
112
+ if (o && (o.startsWith("</") && (n = Math.max(0, n - 1)), l.push(" ".repeat(n) + o), o.startsWith("<") && !o.startsWith("</") && !o.startsWith("<?") && !o.startsWith("<!") && !o.endsWith("/>"))) {
113
+ const r = o.match(/<(\w+)/);
114
+ r && !o.includes(`</${r[1]}>`) && (n = Math.min(n + 1, 10));
115
+ }
116
+ }
117
+ return l.join(`
118
+ `) + `
119
+ `;
120
+ }
121
+ function Cn(i) {
122
+ if (!i || !i.trim()) return "empty";
123
+ const e = i.trim();
124
+ return e.startsWith("<?xml") || e.startsWith("<flow") ? "xml" : "dsl_el";
125
+ }
126
+ const Dl = {
127
+ js: "javascript",
128
+ javascript: "javascript",
129
+ python: "python",
130
+ groovy: "java",
131
+ // Groovy 回退 Java 模式
132
+ java: "java",
133
+ lua: null,
134
+ // text/plain
135
+ QLExpress: null
136
+ // text/plain
137
+ };
138
+ function Tl(i = null) {
139
+ const e = J(new Je()), t = J("none"), n = J(-1), l = J(-1), s = J(!1), o = J(i), r = J(null), c = Gt(null), p = Gt(null);
140
+ let w = -1;
141
+ function m() {
142
+ if (c.value) return c.value;
143
+ const h = Ui();
144
+ return c.value = h, p.value = h.lfRef, h.setOnChange((y) => {
145
+ s.value = !0;
146
+ }), h;
147
+ }
148
+ function f() {
149
+ return c.value;
150
+ }
151
+ function N(h) {
152
+ var ce, Ie, Ne;
153
+ const y = c.value, $ = (ce = p.value) == null ? void 0 : ce.value;
154
+ try {
155
+ const Pe = JSON.parse(h), Ye = new Mn(Pe);
156
+ if ($.render(Ye.toLFGraphData()), setTimeout(() => $.translateCenter(), 100), y.selectedElement.value = null, y.saveSnapshot(), r.value = Ye, l.value = 1, t.value = "chain", y.nodeCount) {
157
+ const Te = $.getGraphData();
158
+ y.nodeCount.value = ((Ie = Te.nodes) == null ? void 0 : Ie.length) || 0, y.edgeCount.value = ((Ne = Te.edges) == null ? void 0 : Ne.length) || 0;
159
+ }
160
+ } catch (Pe) {
161
+ console.error("[useFlowManager] JSON 初始化失败:", Pe);
162
+ }
163
+ }
164
+ function D(h) {
165
+ try {
166
+ Cn(h) === "xml" ? e.value = kl(h) : e.value = new Je(), t.value = "none", n.value = -1, l.value = -1, T(), e.value.chains.length > 0 ? ve(0) : e.value.scriptNodes.length > 0 && ge(0), s.value = !1;
167
+ } catch (y) {
168
+ console.error("[useFlowManager] XML 初始化失败:", y);
169
+ }
170
+ }
171
+ function R() {
172
+ e.value = new Je(), t.value = "none", n.value = -1, l.value = -1, T(), s.value = !1;
173
+ }
174
+ function U() {
175
+ return z(), _n(e.value);
176
+ }
177
+ function G(h = {}) {
178
+ const y = new ht({
179
+ ...h,
180
+ language: h.language || o.value || "groovy"
181
+ });
182
+ return e.value.scriptNodes.push(y), s.value = !0, ge(e.value.scriptNodes.length - 1), y;
183
+ }
184
+ function K(h, y) {
185
+ if (h < 0 || h >= e.value.scriptNodes.length) return;
186
+ const $ = e.value.scriptNodes[h];
187
+ y.id !== void 0 && ($.id = y.id), y.name !== void 0 && ($.name = y.name), y.type !== void 0 && ($.type = y.type), y.language !== void 0 && ($.language = y.language), y.value !== void 0 && ($.value = y.value), s.value = !0;
188
+ }
189
+ function S(h) {
190
+ if (!(h < 0 || h >= e.value.scriptNodes.length))
191
+ if (e.value.scriptNodes.splice(h, 1), s.value = !0, n.value === h)
192
+ if (e.value.scriptNodes.length > 0) {
193
+ const y = Math.min(h, e.value.scriptNodes.length - 1);
194
+ ge(y);
195
+ } else
196
+ n.value = -1, t.value = "none";
197
+ else n.value > h && n.value--;
198
+ }
199
+ function O(h = "") {
200
+ const y = h || `chain${e.value.chains.length + 1}`, $ = new gt({ name: y, dsl: "" });
201
+ return e.value.chains.push($), s.value = !0, ve(e.value.chains.length - 1), $;
202
+ }
203
+ function ee(h, y) {
204
+ if (h < 0 || h >= e.value.chains.length) return;
205
+ const $ = e.value.chains[h];
206
+ y.name !== void 0 && ($.name = y.name), y.dsl !== void 0 && ($.dsl = y.dsl), s.value = !0;
207
+ }
208
+ function ke(h) {
209
+ if (!(h < 0 || h >= e.value.chains.length))
210
+ if (l.value === h && T(), e.value.chains.splice(h, 1), s.value = !0, l.value === h)
211
+ if (e.value.chains.length > 0) {
212
+ const y = Math.min(h, e.value.chains.length - 1);
213
+ ve(y), Me(y, !0);
214
+ } else
215
+ l.value = -1, t.value = "none";
216
+ else l.value > h && l.value--;
217
+ }
218
+ function ge(h) {
219
+ T(), n.value = h, l.value = -1, h >= 0 ? t.value = "script" : t.value = "none";
220
+ }
221
+ function ve(h) {
222
+ w = l.value, n.value = -1, h >= 0 ? (t.value = "chain", l.value = h) : (t.value = "none", l.value = -1);
223
+ }
224
+ function Re(h) {
225
+ const y = Ut(be.START), $ = Ut(be.END), ce = Ut("edge");
226
+ h.nodes = [
227
+ { id: y, type: be.START, text: "开始", x: 0, y: 0, properties: {} },
228
+ { id: $, type: be.END, text: "结束", x: 0, y: 200, properties: {} }
229
+ ], h.edges = [
230
+ { id: ce, type: "edge-with-plus", sourceNodeId: y, targetNodeId: $, text: "", properties: {} }
231
+ ];
232
+ }
233
+ function Me(h, y = !1) {
234
+ var Pe, Ye, Te;
235
+ const $ = c.value, ce = (Pe = p.value) == null ? void 0 : Pe.value;
236
+ if (h < 0 || h >= e.value.chains.length || !$ || !ce || !y && l.value === h && r.value) return;
237
+ T();
238
+ const Ie = e.value.chains[h], Ne = new Mn();
239
+ if (Ne.name = Ie.name, Ie.dsl && Ie.dsl.trim())
240
+ try {
241
+ Ne.fromDSL(Ie.dsl);
242
+ } catch (Ze) {
243
+ console.warn("[useFlowManager] DSL 解析失败:", Ze), Re(Ne);
244
+ }
245
+ else
246
+ Re(Ne);
247
+ if (ce.render(Ne.toLFGraphData()), setTimeout(() => ce.translateCenter(), 100), $.selectedElement.value = null, $.saveSnapshot(), r.value = Ne, l.value = h, t.value = "chain", $.nodeCount) {
248
+ const Ze = ce.getGraphData();
249
+ $.nodeCount.value = ((Ye = Ze.nodes) == null ? void 0 : Ye.length) || 0, $.edgeCount.value = ((Te = Ze.edges) == null ? void 0 : Te.length) || 0;
250
+ }
251
+ }
252
+ function T() {
253
+ var ce;
254
+ if (!r.value) return;
255
+ const h = c.value, y = (ce = h == null ? void 0 : h.lfRef) == null ? void 0 : ce.value, $ = w >= 0 ? w : l.value;
256
+ y && r.value.syncFromLF(y), $ >= 0 && $ < e.value.chains.length && (e.value.chains[$].dsl = r.value.toDSL()), y && y.render({ nodes: [], edges: [] }), r.value = null, w = -1;
257
+ }
258
+ function z() {
259
+ var h;
260
+ if (t.value === "chain" && r.value) {
261
+ const y = (h = p.value) == null ? void 0 : h.value;
262
+ if (y) {
263
+ r.value.syncFromLF(y);
264
+ const $ = l.value;
265
+ $ >= 0 && $ < e.value.chains.length && (e.value.chains[$].dsl = r.value.toDSL());
266
+ }
267
+ }
268
+ }
269
+ function _e() {
270
+ t.value === "chain" && r.value && T();
271
+ const h = _n(e.value);
272
+ return l.value >= 0 && l.value < e.value.chains.length && Me(l.value, !0), s.value = !1, h;
273
+ }
274
+ function E(h) {
275
+ if (!(t.value !== "script" || n.value < 0) && h && typeof h.getValue == "function") {
276
+ const y = h.getValue();
277
+ n.value < e.value.scriptNodes.length && (e.value.scriptNodes[n.value].value = y, s.value = !0);
278
+ }
279
+ }
280
+ function d() {
281
+ var h;
282
+ return t.value === "script" && n.value >= 0 ? ((h = e.value.scriptNodes[n.value]) == null ? void 0 : h.language) || "groovy" : o.value || "groovy";
283
+ }
284
+ function I(h) {
285
+ const y = Dl[h] || null;
286
+ return y || null;
287
+ }
288
+ const B = we(() => e.value.scriptNodes.length), Q = we(() => e.value.chains.length), oe = we(() => n.value >= 0 && n.value < e.value.scriptNodes.length ? e.value.scriptNodes[n.value] : null), j = we(() => l.value >= 0 && l.value < e.value.chains.length ? e.value.chains[l.value] : null);
289
+ function Xe(h) {
290
+ if (!(!h || !h.trim()))
291
+ if (T(), l.value >= 0 && l.value < e.value.chains.length)
292
+ e.value.chains[l.value].dsl = h.trim(), s.value = !0, Me(l.value, !0);
293
+ else {
294
+ const y = O();
295
+ y.dsl = h.trim(), Me(e.value.chains.length - 1, !0);
296
+ }
297
+ }
298
+ return {
299
+ // 状态
300
+ flowModel: e,
301
+ activeTab: t,
302
+ activeScriptIndex: n,
303
+ activeChainIndex: l,
304
+ isDirty: s,
305
+ globalLanguage: o,
306
+ currentFlowData: r,
307
+ currentDesigner: c,
308
+ currentLfRef: p,
309
+ // 计算属性
310
+ scriptCount: B,
311
+ chainCount: Q,
312
+ activeScriptNode: oe,
313
+ activeChain: j,
314
+ // Designer 管理
315
+ createDesigner: m,
316
+ getDesigner: f,
317
+ // JSON
318
+ initFromJSON: N,
319
+ // XML
320
+ initFromXML: D,
321
+ initDefault: R,
322
+ toXML: U,
323
+ save: _e,
324
+ // 脚本 CRUD
325
+ addScriptNode: G,
326
+ updateScriptNode: K,
327
+ deleteScriptNode: S,
328
+ // 流程 CRUD
329
+ addChain: O,
330
+ updateChain: ee,
331
+ deleteChain: ke,
332
+ // 选择
333
+ selectScript: ge,
334
+ selectChain: ve,
335
+ // 激活/反激活
336
+ activateChain: Me,
337
+ deactivateChain: T,
338
+ // 脚本同步
339
+ syncCurrentScriptValue: E,
340
+ getCurrentLanguage: d,
341
+ getCodeMirrorLanguageExt: I,
342
+ // 导入 DSL/EL
343
+ importDSLOrEL: Xe,
344
+ // 工具
345
+ detectFormat: Cn
346
+ };
347
+ }
348
+ const Wn = Symbol("flowManager");
349
+ function Ol(i) {
350
+ ji(Wn, i);
351
+ }
352
+ function Al() {
353
+ const i = Wi(Wn);
354
+ if (!i) throw new Error("useFlowManager 必须在 DesignerPanel 内部使用");
355
+ return i;
356
+ }
357
+ function Rl(i) {
358
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
359
+ }
360
+ var Ht, kn;
361
+ function Il() {
362
+ if (kn) return Ht;
363
+ kn = 1;
364
+ function i(a) {
365
+ return a instanceof Map ? a.clear = a.delete = a.set = function() {
366
+ throw new Error("map is read-only");
367
+ } : a instanceof Set && (a.add = a.clear = a.delete = function() {
368
+ throw new Error("set is read-only");
369
+ }), Object.freeze(a), Object.getOwnPropertyNames(a).forEach((u) => {
370
+ const v = a[u], P = typeof v;
371
+ (P === "object" || P === "function") && !Object.isFrozen(v) && i(v);
372
+ }), a;
373
+ }
374
+ class e {
375
+ /**
376
+ * @param {CompiledMode} mode
377
+ */
378
+ constructor(u) {
379
+ u.data === void 0 && (u.data = {}), this.data = u.data, this.isMatchIgnored = !1;
380
+ }
381
+ ignoreMatch() {
382
+ this.isMatchIgnored = !0;
383
+ }
384
+ }
385
+ function t(a) {
386
+ return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
387
+ }
388
+ function n(a, ...u) {
389
+ const v = /* @__PURE__ */ Object.create(null);
390
+ for (const P in a)
391
+ v[P] = a[P];
392
+ return u.forEach(function(P) {
393
+ for (const se in P)
394
+ v[se] = P[se];
395
+ }), /** @type {T} */
396
+ v;
397
+ }
398
+ const l = "</span>", s = (a) => !!a.scope, o = (a, { prefix: u }) => {
399
+ if (a.startsWith("language:"))
400
+ return a.replace("language:", "language-");
401
+ if (a.includes(".")) {
402
+ const v = a.split(".");
403
+ return [
404
+ `${u}${v.shift()}`,
405
+ ...v.map((P, se) => `${P}${"_".repeat(se + 1)}`)
406
+ ].join(" ");
407
+ }
408
+ return `${u}${a}`;
409
+ };
410
+ class r {
411
+ /**
412
+ * Creates a new HTMLRenderer
413
+ *
414
+ * @param {Tree} parseTree - the parse tree (must support `walk` API)
415
+ * @param {{classPrefix: string}} options
416
+ */
417
+ constructor(u, v) {
418
+ this.buffer = "", this.classPrefix = v.classPrefix, u.walk(this);
419
+ }
420
+ /**
421
+ * Adds texts to the output stream
422
+ *
423
+ * @param {string} text */
424
+ addText(u) {
425
+ this.buffer += t(u);
426
+ }
427
+ /**
428
+ * Adds a node open to the output stream (if needed)
429
+ *
430
+ * @param {Node} node */
431
+ openNode(u) {
432
+ if (!s(u)) return;
433
+ const v = o(
434
+ u.scope,
435
+ { prefix: this.classPrefix }
436
+ );
437
+ this.span(v);
438
+ }
439
+ /**
440
+ * Adds a node close to the output stream (if needed)
441
+ *
442
+ * @param {Node} node */
443
+ closeNode(u) {
444
+ s(u) && (this.buffer += l);
445
+ }
446
+ /**
447
+ * returns the accumulated buffer
448
+ */
449
+ value() {
450
+ return this.buffer;
451
+ }
452
+ // helpers
453
+ /**
454
+ * Builds a span element
455
+ *
456
+ * @param {string} className */
457
+ span(u) {
458
+ this.buffer += `<span class="${u}">`;
459
+ }
460
+ }
461
+ const c = (a = {}) => {
462
+ const u = { children: [] };
463
+ return Object.assign(u, a), u;
464
+ };
465
+ class p {
466
+ constructor() {
467
+ this.rootNode = c(), this.stack = [this.rootNode];
468
+ }
469
+ get top() {
470
+ return this.stack[this.stack.length - 1];
471
+ }
472
+ get root() {
473
+ return this.rootNode;
474
+ }
475
+ /** @param {Node} node */
476
+ add(u) {
477
+ this.top.children.push(u);
478
+ }
479
+ /** @param {string} scope */
480
+ openNode(u) {
481
+ const v = c({ scope: u });
482
+ this.add(v), this.stack.push(v);
483
+ }
484
+ closeNode() {
485
+ if (this.stack.length > 1)
486
+ return this.stack.pop();
487
+ }
488
+ closeAllNodes() {
489
+ for (; this.closeNode(); ) ;
490
+ }
491
+ toJSON() {
492
+ return JSON.stringify(this.rootNode, null, 4);
493
+ }
494
+ /**
495
+ * @typedef { import("./html_renderer").Renderer } Renderer
496
+ * @param {Renderer} builder
497
+ */
498
+ walk(u) {
499
+ return this.constructor._walk(u, this.rootNode);
500
+ }
501
+ /**
502
+ * @param {Renderer} builder
503
+ * @param {Node} node
504
+ */
505
+ static _walk(u, v) {
506
+ return typeof v == "string" ? u.addText(v) : v.children && (u.openNode(v), v.children.forEach((P) => this._walk(u, P)), u.closeNode(v)), u;
507
+ }
508
+ /**
509
+ * @param {Node} node
510
+ */
511
+ static _collapse(u) {
512
+ typeof u != "string" && u.children && (u.children.every((v) => typeof v == "string") ? u.children = [u.children.join("")] : u.children.forEach((v) => {
513
+ p._collapse(v);
514
+ }));
515
+ }
516
+ }
517
+ class w extends p {
518
+ /**
519
+ * @param {*} options
520
+ */
521
+ constructor(u) {
522
+ super(), this.options = u;
523
+ }
524
+ /**
525
+ * @param {string} text
526
+ */
527
+ addText(u) {
528
+ u !== "" && this.add(u);
529
+ }
530
+ /** @param {string} scope */
531
+ startScope(u) {
532
+ this.openNode(u);
533
+ }
534
+ endScope() {
535
+ this.closeNode();
536
+ }
537
+ /**
538
+ * @param {Emitter & {root: DataNode}} emitter
539
+ * @param {string} name
540
+ */
541
+ __addSublanguage(u, v) {
542
+ const P = u.root;
543
+ v && (P.scope = `language:${v}`), this.add(P);
544
+ }
545
+ toHTML() {
546
+ return new r(this, this.options).value();
547
+ }
548
+ finalize() {
549
+ return this.closeAllNodes(), !0;
550
+ }
551
+ }
552
+ function m(a) {
553
+ return a ? typeof a == "string" ? a : a.source : null;
554
+ }
555
+ function f(a) {
556
+ return R("(?=", a, ")");
557
+ }
558
+ function N(a) {
559
+ return R("(?:", a, ")*");
560
+ }
561
+ function D(a) {
562
+ return R("(?:", a, ")?");
563
+ }
564
+ function R(...a) {
565
+ return a.map((v) => m(v)).join("");
566
+ }
567
+ function U(a) {
568
+ const u = a[a.length - 1];
569
+ return typeof u == "object" && u.constructor === Object ? (a.splice(a.length - 1, 1), u) : {};
570
+ }
571
+ function G(...a) {
572
+ return "(" + (U(a).capture ? "" : "?:") + a.map((P) => m(P)).join("|") + ")";
573
+ }
574
+ function K(a) {
575
+ return new RegExp(a.toString() + "|").exec("").length - 1;
576
+ }
577
+ function S(a, u) {
578
+ const v = a && a.exec(u);
579
+ return v && v.index === 0;
580
+ }
581
+ const O = new RegExp(G(
582
+ /\[(?:[^\\\]]|\\.)*\]/,
583
+ // a character class, inside which ( and \ lose their meaning
584
+ /\(\?<(?![=!])[^>]+>/,
585
+ // a named capture group `(?<name>` (not a lookbehind `(?<=` / `(?<!`)
586
+ /\(\?'[^']+'/,
587
+ // a named capture group `(?'name'`
588
+ /\(\??/,
589
+ // an opening parenthesis, capturing or non-capturing / lookahead
590
+ /\\([1-9][0-9]*)/,
591
+ // a backreference like `\1`
592
+ /\\./
593
+ // any other escape sequence
594
+ ));
595
+ function ee(a, { joinWith: u }) {
596
+ let v = 0;
597
+ return a.map((P) => {
598
+ v += 1;
599
+ const se = v;
600
+ let ae = m(P), M = "";
601
+ for (; ae.length > 0; ) {
602
+ const x = O.exec(ae);
603
+ if (!x) {
604
+ M += ae;
605
+ break;
606
+ }
607
+ M += ae.substring(0, x.index), ae = ae.substring(x.index + x[0].length), x[0][0] === "\\" && x[1] ? M += "\\" + String(Number(x[1]) + se) : (M += x[0], (x[0] === "(" || /^\(\?[<']/.test(x[0])) && v++);
608
+ }
609
+ return M;
610
+ }).map((P) => `(${P})`).join(u);
611
+ }
612
+ const ke = /\b\B/, ge = "[a-zA-Z]\\w*", ve = "[a-zA-Z_]\\w*", Re = "\\b\\d+(\\.\\d+)?", Me = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)", T = "\\b(0b[01]+)", z = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~", _e = (a = {}) => {
613
+ const u = /^#![ ]*\//;
614
+ return a.binary && (a.begin = R(
615
+ u,
616
+ /.*\b/,
617
+ a.binary,
618
+ /\b.*/
619
+ )), n({
620
+ scope: "meta",
621
+ begin: u,
622
+ end: /$/,
623
+ relevance: 0,
624
+ /** @type {ModeCallback} */
625
+ "on:begin": (v, P) => {
626
+ v.index !== 0 && P.ignoreMatch();
627
+ }
628
+ }, a);
629
+ }, E = {
630
+ begin: "\\\\[\\s\\S]",
631
+ relevance: 0
632
+ }, d = {
633
+ scope: "string",
634
+ begin: "'",
635
+ end: "'",
636
+ illegal: "\\n",
637
+ contains: [E]
638
+ }, I = {
639
+ scope: "string",
640
+ begin: '"',
641
+ end: '"',
642
+ illegal: "\\n",
643
+ contains: [E]
644
+ }, B = {
645
+ begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
646
+ }, Q = function(a, u, v = {}) {
647
+ const P = n(
648
+ {
649
+ scope: "comment",
650
+ begin: a,
651
+ end: u,
652
+ contains: []
653
+ },
654
+ v
655
+ );
656
+ P.contains.push({
657
+ scope: "doctag",
658
+ // hack to avoid the space from being included. the space is necessary to
659
+ // match here to prevent the plain text rule below from gobbling up doctags
660
+ begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
661
+ end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
662
+ excludeBegin: !0,
663
+ relevance: 0
664
+ });
665
+ const se = G(
666
+ // list of common 1 and 2 letter words in English
667
+ "I",
668
+ "a",
669
+ "is",
670
+ "so",
671
+ "us",
672
+ "to",
673
+ "at",
674
+ "if",
675
+ "in",
676
+ "it",
677
+ "on",
678
+ // note: this is not an exhaustive list of contractions, just popular ones
679
+ /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
680
+ // contractions - can't we'd they're let's, etc
681
+ /[A-Za-z]+[-][a-z]+/,
682
+ // `no-way`, etc.
683
+ /[A-Za-z][a-z]{2,}/
684
+ // allow capitalized words at beginning of sentences
685
+ );
686
+ return P.contains.push(
687
+ {
688
+ // TODO: how to include ", (, ) without breaking grammars that use these for
689
+ // comment delimiters?
690
+ // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
691
+ // ---
692
+ // this tries to find sequences of 3 english words in a row (without any
693
+ // "programming" type syntax) this gives us a strong signal that we've
694
+ // TRULY found a comment - vs perhaps scanning with the wrong language.
695
+ // It's possible to find something that LOOKS like the start of the
696
+ // comment - but then if there is no readable text - good chance it is a
697
+ // false match and not a comment.
698
+ //
699
+ // for a visual example please see:
700
+ // https://github.com/highlightjs/highlight.js/issues/2827
701
+ begin: R(
702
+ /[ ]+/,
703
+ // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
704
+ "(",
705
+ se,
706
+ /[.]?[:]?([.][ ]|[ ])/,
707
+ "){3}"
708
+ )
709
+ // look for 3 words in a row
710
+ }
711
+ ), P;
712
+ }, oe = Q("//", "$"), j = Q("/\\*", "\\*/"), Xe = Q("#", "$"), h = {
713
+ scope: "number",
714
+ begin: Re,
715
+ relevance: 0
716
+ }, y = {
717
+ scope: "number",
718
+ begin: Me,
719
+ relevance: 0
720
+ }, $ = {
721
+ scope: "number",
722
+ begin: T,
723
+ relevance: 0
724
+ }, ce = {
725
+ scope: "regexp",
726
+ begin: /\/(?=[^/\n]*\/)/,
727
+ end: /\/[gimuy]*/,
728
+ contains: [
729
+ E,
730
+ {
731
+ begin: /\[/,
732
+ end: /\]/,
733
+ relevance: 0,
734
+ contains: [E]
735
+ }
736
+ ]
737
+ }, Ie = {
738
+ scope: "title",
739
+ begin: ge,
740
+ relevance: 0
741
+ }, Ne = {
742
+ scope: "title",
743
+ begin: ve,
744
+ relevance: 0
745
+ }, Pe = {
746
+ // excludes method names from keyword processing
747
+ begin: "\\.\\s*" + ve,
748
+ relevance: 0
749
+ };
750
+ var Te = /* @__PURE__ */ Object.freeze({
751
+ __proto__: null,
752
+ APOS_STRING_MODE: d,
753
+ BACKSLASH_ESCAPE: E,
754
+ BINARY_NUMBER_MODE: $,
755
+ BINARY_NUMBER_RE: T,
756
+ COMMENT: Q,
757
+ C_BLOCK_COMMENT_MODE: j,
758
+ C_LINE_COMMENT_MODE: oe,
759
+ C_NUMBER_MODE: y,
760
+ C_NUMBER_RE: Me,
761
+ END_SAME_AS_BEGIN: function(a) {
762
+ return Object.assign(
763
+ a,
764
+ {
765
+ /** @type {ModeCallback} */
766
+ "on:begin": (u, v) => {
767
+ v.data._beginMatch = u[1];
768
+ },
769
+ /** @type {ModeCallback} */
770
+ "on:end": (u, v) => {
771
+ v.data._beginMatch !== u[1] && v.ignoreMatch();
772
+ }
773
+ }
774
+ );
775
+ },
776
+ HASH_COMMENT_MODE: Xe,
777
+ IDENT_RE: ge,
778
+ MATCH_NOTHING_RE: ke,
779
+ METHOD_GUARD: Pe,
780
+ NUMBER_MODE: h,
781
+ NUMBER_RE: Re,
782
+ PHRASAL_WORDS_MODE: B,
783
+ QUOTE_STRING_MODE: I,
784
+ REGEXP_MODE: ce,
785
+ RE_STARTERS_RE: z,
786
+ SHEBANG: _e,
787
+ TITLE_MODE: Ie,
788
+ UNDERSCORE_IDENT_RE: ve,
789
+ UNDERSCORE_TITLE_MODE: Ne
790
+ });
791
+ function Ze(a, u) {
792
+ a.input[a.index - 1] === "." && u.ignoreMatch();
793
+ }
794
+ function li(a, u) {
795
+ a.className !== void 0 && (a.scope = a.className, delete a.className);
796
+ }
797
+ function si(a, u) {
798
+ u && a.beginKeywords && (a.begin = "\\b(" + a.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)", a.__beforeBegin = Ze, a.keywords = a.keywords || a.beginKeywords, delete a.beginKeywords, a.relevance === void 0 && (a.relevance = 0));
799
+ }
800
+ function ai(a, u) {
801
+ Array.isArray(a.illegal) && (a.illegal = G(...a.illegal));
802
+ }
803
+ function ri(a, u) {
804
+ if (a.match) {
805
+ if (a.begin || a.end) throw new Error("begin & end are not supported with match");
806
+ a.begin = a.match, delete a.match;
807
+ }
808
+ }
809
+ function oi(a, u) {
810
+ a.relevance === void 0 && (a.relevance = 1);
811
+ }
812
+ const ci = (a, u) => {
813
+ if (!a.beforeMatch) return;
814
+ if (a.starts) throw new Error("beforeMatch cannot be used with starts");
815
+ const v = Object.assign({}, a);
816
+ Object.keys(a).forEach((P) => {
817
+ delete a[P];
818
+ }), a.keywords = v.keywords, a.begin = R(v.beforeMatch, f(v.begin)), a.starts = {
819
+ relevance: 0,
820
+ contains: [
821
+ Object.assign(v, { endsParent: !0 })
822
+ ]
823
+ }, a.relevance = 0, delete v.beforeMatch;
824
+ }, ui = [
825
+ "of",
826
+ "and",
827
+ "for",
828
+ "in",
829
+ "not",
830
+ "or",
831
+ "if",
832
+ "then",
833
+ "parent",
834
+ // common variable name
835
+ "list",
836
+ // common variable name
837
+ "value"
838
+ // common variable name
839
+ ], di = "keyword";
840
+ function sn(a, u, v = di) {
841
+ const P = /* @__PURE__ */ Object.create(null);
842
+ return typeof a == "string" ? se(v, a.split(" ")) : Array.isArray(a) ? se(v, a) : Object.keys(a).forEach(function(ae) {
843
+ Object.assign(
844
+ P,
845
+ sn(a[ae], u, ae)
846
+ );
847
+ }), P;
848
+ function se(ae, M) {
849
+ u && (M = M.map((x) => x.toLowerCase())), M.forEach(function(x) {
850
+ const F = x.split("|");
851
+ P[F[0]] = [ae, fi(F[0], F[1])];
852
+ });
853
+ }
854
+ }
855
+ function fi(a, u) {
856
+ return u ? Number(u) : hi(a) ? 0 : 1;
857
+ }
858
+ function hi(a) {
859
+ return ui.includes(a.toLowerCase());
860
+ }
861
+ const an = {}, Ge = (a) => {
862
+ console.error(a);
863
+ }, rn = (a, ...u) => {
864
+ console.log(`WARN: ${a}`, ...u);
865
+ }, et = (a, u) => {
866
+ an[`${a}/${u}`] || (console.log(`Deprecated as of ${a}. ${u}`), an[`${a}/${u}`] = !0);
867
+ }, yt = new Error();
868
+ function on(a, u, { key: v }) {
869
+ let P = 0;
870
+ const se = a[v], ae = {}, M = {};
871
+ for (let x = 1; x <= u.length; x++)
872
+ M[x + P] = se[x], ae[x + P] = !0, P += K(u[x - 1]);
873
+ a[v] = M, a[v]._emit = ae, a[v]._multi = !0;
874
+ }
875
+ function gi(a) {
876
+ if (Array.isArray(a.begin)) {
877
+ if (a.skip || a.excludeBegin || a.returnBegin)
878
+ throw Ge("skip, excludeBegin, returnBegin not compatible with beginScope: {}"), yt;
879
+ if (typeof a.beginScope != "object" || a.beginScope === null)
880
+ throw Ge("beginScope must be object"), yt;
881
+ on(a, a.begin, { key: "beginScope" }), a.begin = ee(a.begin, { joinWith: "" });
882
+ }
883
+ }
884
+ function pi(a) {
885
+ if (Array.isArray(a.end)) {
886
+ if (a.skip || a.excludeEnd || a.returnEnd)
887
+ throw Ge("skip, excludeEnd, returnEnd not compatible with endScope: {}"), yt;
888
+ if (typeof a.endScope != "object" || a.endScope === null)
889
+ throw Ge("endScope must be object"), yt;
890
+ on(a, a.end, { key: "endScope" }), a.end = ee(a.end, { joinWith: "" });
891
+ }
892
+ }
893
+ function mi(a) {
894
+ a.scope && typeof a.scope == "object" && a.scope !== null && (a.beginScope = a.scope, delete a.scope);
895
+ }
896
+ function vi(a) {
897
+ mi(a), typeof a.beginScope == "string" && (a.beginScope = { _wrap: a.beginScope }), typeof a.endScope == "string" && (a.endScope = { _wrap: a.endScope }), gi(a), pi(a);
898
+ }
899
+ function bi(a) {
900
+ function u(M, x) {
901
+ return new RegExp(
902
+ m(M),
903
+ "m" + (a.case_insensitive ? "i" : "") + (a.unicodeRegex ? "u" : "") + (x ? "g" : "")
904
+ );
905
+ }
906
+ class v {
907
+ constructor() {
908
+ this.matchIndexes = {}, this.regexes = [], this.matchAt = 1, this.position = 0;
909
+ }
910
+ // @ts-ignore
911
+ addRule(x, F) {
912
+ F.position = this.position++, this.matchIndexes[this.matchAt] = F, this.regexes.push([F, x]), this.matchAt += K(x) + 1;
913
+ }
914
+ compile() {
915
+ this.regexes.length === 0 && (this.exec = () => null);
916
+ const x = this.regexes.map((F) => F[1]);
917
+ this.matcherRe = u(ee(x, { joinWith: "|" }), !0), this.lastIndex = 0;
918
+ }
919
+ /** @param {string} s */
920
+ exec(x) {
921
+ this.matcherRe.lastIndex = this.lastIndex;
922
+ const F = this.matcherRe.exec(x);
923
+ if (!F)
924
+ return null;
925
+ const he = F.findIndex((ft, Bt) => Bt > 0 && ft !== void 0), re = this.matchIndexes[he];
926
+ return F.splice(0, he), Object.assign(F, re);
927
+ }
928
+ }
929
+ class P {
930
+ constructor() {
931
+ this.rules = [], this.multiRegexes = [], this.count = 0, this.lastIndex = 0, this.regexIndex = 0;
932
+ }
933
+ // @ts-ignore
934
+ getMatcher(x) {
935
+ if (this.multiRegexes[x]) return this.multiRegexes[x];
936
+ const F = new v();
937
+ return this.rules.slice(x).forEach(([he, re]) => F.addRule(he, re)), F.compile(), this.multiRegexes[x] = F, F;
938
+ }
939
+ resumingScanAtSamePosition() {
940
+ return this.regexIndex !== 0;
941
+ }
942
+ considerAll() {
943
+ this.regexIndex = 0;
944
+ }
945
+ // @ts-ignore
946
+ addRule(x, F) {
947
+ this.rules.push([x, F]), F.type === "begin" && this.count++;
948
+ }
949
+ /** @param {string} s */
950
+ exec(x) {
951
+ const F = this.getMatcher(this.regexIndex);
952
+ F.lastIndex = this.lastIndex;
953
+ let he = F.exec(x);
954
+ if (this.resumingScanAtSamePosition() && !(he && he.index === this.lastIndex)) {
955
+ const re = this.getMatcher(0);
956
+ re.lastIndex = this.lastIndex + 1, he = re.exec(x);
957
+ }
958
+ return he && (this.regexIndex += he.position + 1, this.regexIndex === this.count && this.considerAll()), he;
959
+ }
960
+ }
961
+ function se(M) {
962
+ const x = new P();
963
+ return M.contains.forEach((F) => x.addRule(F.begin, { rule: F, type: "begin" })), M.terminatorEnd && x.addRule(M.terminatorEnd, { type: "end" }), M.illegal && x.addRule(M.illegal, { type: "illegal" }), x;
964
+ }
965
+ function ae(M, x) {
966
+ const F = (
967
+ /** @type CompiledMode */
968
+ M
969
+ );
970
+ if (M.isCompiled) return F;
971
+ [
972
+ li,
973
+ // do this early so compiler extensions generally don't have to worry about
974
+ // the distinction between match/begin
975
+ ri,
976
+ vi,
977
+ ci
978
+ ].forEach((re) => re(M, x)), a.compilerExtensions.forEach((re) => re(M, x)), M.__beforeBegin = null, [
979
+ si,
980
+ // do this later so compiler extensions that come earlier have access to the
981
+ // raw array if they wanted to perhaps manipulate it, etc.
982
+ ai,
983
+ // default to 1 relevance if not specified
984
+ oi
985
+ ].forEach((re) => re(M, x)), M.isCompiled = !0;
986
+ let he = null;
987
+ return typeof M.keywords == "object" && M.keywords.$pattern && (M.keywords = Object.assign({}, M.keywords), he = M.keywords.$pattern, delete M.keywords.$pattern), he = he || /\w+/, M.keywords && (M.keywords = sn(M.keywords, a.case_insensitive)), F.keywordPatternRe = u(he, !0), x && (M.begin || (M.begin = /\B|\b/), F.beginRe = u(F.begin), !M.end && !M.endsWithParent && (M.end = /\B|\b/), M.end && (F.endRe = u(F.end)), F.terminatorEnd = m(F.end) || "", M.endsWithParent && x.terminatorEnd && (F.terminatorEnd += (M.end ? "|" : "") + x.terminatorEnd)), M.illegal && (F.illegalRe = u(
988
+ /** @type {RegExp | string} */
989
+ M.illegal
990
+ )), M.contains || (M.contains = []), M.contains = [].concat(...M.contains.map(function(re) {
991
+ return yi(re === "self" ? M : re);
992
+ })), M.contains.forEach(function(re) {
993
+ ae(
994
+ /** @type Mode */
995
+ re,
996
+ F
997
+ );
998
+ }), M.starts && ae(M.starts, x), F.matcher = se(F), F;
999
+ }
1000
+ if (a.compilerExtensions || (a.compilerExtensions = []), a.contains && a.contains.includes("self"))
1001
+ throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
1002
+ return a.classNameAliases = n(a.classNameAliases || {}), ae(
1003
+ /** @type Mode */
1004
+ a
1005
+ );
1006
+ }
1007
+ function cn(a) {
1008
+ return a ? a.endsWithParent || cn(a.starts) : !1;
1009
+ }
1010
+ function yi(a) {
1011
+ return a.variants && !a.cachedVariants && (a.cachedVariants = a.variants.map(function(u) {
1012
+ return n(a, { variants: null }, u);
1013
+ })), a.cachedVariants ? a.cachedVariants : cn(a) ? n(a, { starts: a.starts ? n(a.starts) : null }) : Object.isFrozen(a) ? n(a) : a;
1014
+ }
1015
+ var xi = "11.12.0";
1016
+ class wi extends Error {
1017
+ constructor(u, v) {
1018
+ super(u), this.name = "HTMLInjectionError", this.html = v;
1019
+ }
1020
+ }
1021
+ const Ft = t, un = n, dn = Symbol("nomatch"), Si = 7, fn = function(a) {
1022
+ const u = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), P = [];
1023
+ let se = !0;
1024
+ const ae = "Could not find the language '{}', did you forget to load/include a language module?", M = { disableAutodetect: !0, name: "Plain text", contains: [] };
1025
+ let x = {
1026
+ ignoreUnescapedHTML: !1,
1027
+ throwUnescapedHTML: !1,
1028
+ noHighlightRe: /^(no-?highlight)$/i,
1029
+ languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
1030
+ classPrefix: "hljs-",
1031
+ cssSelector: "pre code",
1032
+ languages: null,
1033
+ // beta configuration options, subject to change, welcome to discuss
1034
+ // https://github.com/highlightjs/highlight.js/issues/1086
1035
+ __emitter: w
1036
+ };
1037
+ function F(g) {
1038
+ return x.noHighlightRe.test(g);
1039
+ }
1040
+ function he(g) {
1041
+ let k = g.className + " ";
1042
+ k += g.parentNode ? g.parentNode.className : "";
1043
+ const H = x.languageDetectRe.exec(k);
1044
+ if (H) {
1045
+ const Y = $e(H[1]);
1046
+ return Y || (rn(ae.replace("{}", H[1])), rn("Falling back to no-highlight mode for this block.", g)), Y ? H[1] : "no-highlight";
1047
+ }
1048
+ return k.split(/\s+/).find((Y) => F(Y) || $e(Y));
1049
+ }
1050
+ function re(g, k, H) {
1051
+ let Y = "", ue = "";
1052
+ typeof k == "object" ? (Y = g, H = k.ignoreIllegals, ue = k.language) : (et("10.7.0", "highlight(lang, code, ...args) has been deprecated."), et("10.7.0", `Please use highlight(code, options) instead.
1053
+ https://github.com/highlightjs/highlight.js/issues/2277`), ue = g, Y = k), H === void 0 && (H = !0);
1054
+ const Le = {
1055
+ code: Y,
1056
+ language: ue
1057
+ };
1058
+ wt("before:highlight", Le);
1059
+ const Ve = Le.result ? Le.result : ft(Le.language, Le.code, H);
1060
+ return Ve.code = Le.code, wt("after:highlight", Ve), Ve;
1061
+ }
1062
+ function ft(g, k, H, Y) {
1063
+ const ue = /* @__PURE__ */ Object.create(null);
1064
+ function Le(b, _) {
1065
+ return b.keywords[_];
1066
+ }
1067
+ function Ve() {
1068
+ if (!V.keywords) {
1069
+ pe.addText(Z);
1070
+ return;
1071
+ }
1072
+ let b = 0;
1073
+ V.keywordPatternRe.lastIndex = 0;
1074
+ let _ = V.keywordPatternRe.exec(Z), W = "";
1075
+ for (; _; ) {
1076
+ W += Z.substring(b, _.index);
1077
+ const q = Ae.case_insensitive ? _[0].toLowerCase() : _[0], me = Le(V, q);
1078
+ if (me) {
1079
+ const [Fe, $i] = me;
1080
+ if (pe.addText(W), W = "", ue[q] = (ue[q] || 0) + 1, ue[q] <= Si && (Mt += $i), Fe.startsWith("_"))
1081
+ W += _[0];
1082
+ else {
1083
+ const Vi = Ae.classNameAliases[Fe] || Fe;
1084
+ Oe(_[0], Vi);
1085
+ }
1086
+ } else
1087
+ W += _[0];
1088
+ b = V.keywordPatternRe.lastIndex, _ = V.keywordPatternRe.exec(Z);
1089
+ }
1090
+ W += Z.substring(b), pe.addText(W);
1091
+ }
1092
+ function St() {
1093
+ if (Z === "") return;
1094
+ let b = null;
1095
+ if (typeof V.subLanguage == "string") {
1096
+ if (!u[V.subLanguage]) {
1097
+ pe.addText(Z);
1098
+ return;
1099
+ }
1100
+ b = ft(V.subLanguage, Z, !0, xn[V.subLanguage]), xn[V.subLanguage] = /** @type {CompiledMode} */
1101
+ b._top;
1102
+ } else
1103
+ b = Pt(Z, V.subLanguage.length ? V.subLanguage : null);
1104
+ V.relevance > 0 && (Mt += b.relevance), pe.__addSublanguage(b._emitter, b.language);
1105
+ }
1106
+ function ye() {
1107
+ V.subLanguage != null ? St() : Ve(), Z = "";
1108
+ }
1109
+ function Oe(b, _) {
1110
+ b !== "" && (pe.startScope(_), pe.addText(b), pe.endScope());
1111
+ }
1112
+ function mn(b, _) {
1113
+ let W = 1;
1114
+ const q = _.length - 1;
1115
+ for (; W <= q; ) {
1116
+ if (!b._emit[W]) {
1117
+ W++;
1118
+ continue;
1119
+ }
1120
+ const me = Ae.classNameAliases[b[W]] || b[W], Fe = _[W];
1121
+ me ? Oe(Fe, me) : (Z = Fe, Ve(), Z = ""), W++;
1122
+ }
1123
+ }
1124
+ function vn(b, _) {
1125
+ return b.scope && typeof b.scope == "string" && pe.openNode(Ae.classNameAliases[b.scope] || b.scope), b.beginScope && (b.beginScope._wrap ? (Oe(Z, Ae.classNameAliases[b.beginScope._wrap] || b.beginScope._wrap), Z = "") : b.beginScope._multi && (mn(b.beginScope, _), Z = "")), V = Object.create(b, { parent: { value: V } }), V;
1126
+ }
1127
+ function bn(b, _, W) {
1128
+ let q = S(b.endRe, W);
1129
+ if (q) {
1130
+ if (b["on:end"]) {
1131
+ const me = new e(b);
1132
+ b["on:end"](_, me), me.isMatchIgnored && (q = !1);
1133
+ }
1134
+ if (q) {
1135
+ for (; b.endsParent && b.parent; )
1136
+ b = b.parent;
1137
+ return b;
1138
+ }
1139
+ }
1140
+ if (b.endsWithParent)
1141
+ return bn(b.parent, _, W);
1142
+ }
1143
+ function Ri(b) {
1144
+ return V.matcher.regexIndex === 0 ? (Z += b[0], 1) : (Wt = !0, 0);
1145
+ }
1146
+ function Ii(b) {
1147
+ const _ = b[0], W = b.rule, q = new e(W), me = [W.__beforeBegin, W["on:begin"]];
1148
+ for (const Fe of me)
1149
+ if (Fe && (Fe(b, q), q.isMatchIgnored))
1150
+ return Ri(_);
1151
+ return W.skip ? Z += _ : (W.excludeBegin && (Z += _), ye(), !W.returnBegin && !W.excludeBegin && (Z = _)), vn(W, b), W.returnBegin ? 0 : _.length;
1152
+ }
1153
+ function Fi(b) {
1154
+ const _ = b[0], W = k.substring(b.index), q = bn(V, b, W);
1155
+ if (!q)
1156
+ return dn;
1157
+ const me = V;
1158
+ V.endScope && V.endScope._wrap ? (ye(), Oe(_, V.endScope._wrap)) : V.endScope && V.endScope._multi ? (ye(), mn(V.endScope, b)) : me.skip ? Z += _ : (me.returnEnd || me.excludeEnd || (Z += _), ye(), me.excludeEnd && (Z = _));
1159
+ do
1160
+ V.scope && pe.closeNode(), !V.skip && !V.subLanguage && (Mt += V.relevance), V = V.parent;
1161
+ while (V !== q.parent);
1162
+ return q.starts && vn(q.starts, b), me.returnEnd ? 0 : _.length;
1163
+ }
1164
+ function Bi() {
1165
+ const b = [];
1166
+ for (let _ = V; _ !== Ae; _ = _.parent)
1167
+ _.scope && b.unshift(_.scope);
1168
+ b.forEach((_) => pe.openNode(_));
1169
+ }
1170
+ let Et = {};
1171
+ function yn(b, _) {
1172
+ const W = _ && _[0];
1173
+ if (Z += b, W == null)
1174
+ return ye(), 0;
1175
+ if (Et.type === "begin" && _.type === "end" && Et.index === _.index && W === "") {
1176
+ if (Z += k.slice(_.index, _.index + 1), !se) {
1177
+ const q = new Error(`0 width match regex (${g})`);
1178
+ throw q.languageName = g, q.badRule = Et.rule, q;
1179
+ }
1180
+ return 1;
1181
+ }
1182
+ if (Et = _, _.type === "begin")
1183
+ return Ii(_);
1184
+ if (_.type === "illegal" && !H) {
1185
+ const q = new Error('Illegal lexeme "' + W + '" for mode "' + (V.scope || "<unnamed>") + '"');
1186
+ throw q.mode = V, q;
1187
+ } else if (_.type === "end") {
1188
+ const q = Fi(_);
1189
+ if (q !== dn)
1190
+ return q;
1191
+ }
1192
+ if (_.type === "illegal" && W === "")
1193
+ return _.index === k.length || (Z += `
1194
+ `), 1;
1195
+ if (jt > 1e5 && jt > _.index * 3)
1196
+ throw new Error("potential infinite loop, way more iterations than matches");
1197
+ return Z += W, W.length;
1198
+ }
1199
+ const Ae = $e(g);
1200
+ if (!Ae)
1201
+ throw Ge(ae.replace("{}", g)), new Error('Unknown language: "' + g + '"');
1202
+ const Pi = bi(Ae);
1203
+ let Vt = "", V = Y || Pi;
1204
+ const xn = {}, pe = new x.__emitter(x);
1205
+ Bi();
1206
+ let Z = "", Mt = 0, Ke = 0, jt = 0, Wt = !1;
1207
+ try {
1208
+ if (Ae.__emitTokens)
1209
+ Ae.__emitTokens(k, pe);
1210
+ else {
1211
+ for (V.matcher.considerAll(); ; ) {
1212
+ jt++, Wt ? Wt = !1 : V.matcher.considerAll(), V.matcher.lastIndex = Ke;
1213
+ const b = V.matcher.exec(k);
1214
+ if (!b) break;
1215
+ const _ = k.substring(Ke, b.index), W = yn(_, b);
1216
+ Ke = b.index + W;
1217
+ }
1218
+ yn(k.substring(Ke));
1219
+ }
1220
+ return pe.finalize(), Vt = pe.toHTML(), {
1221
+ language: g,
1222
+ value: Vt,
1223
+ relevance: Mt,
1224
+ illegal: !1,
1225
+ _emitter: pe,
1226
+ _top: V
1227
+ };
1228
+ } catch (b) {
1229
+ if (b.message && b.message.includes("Illegal"))
1230
+ return {
1231
+ language: g,
1232
+ value: Ft(k),
1233
+ illegal: !0,
1234
+ relevance: 0,
1235
+ _illegalBy: {
1236
+ message: b.message,
1237
+ index: Ke,
1238
+ context: k.slice(Ke - 100, Ke + 100),
1239
+ mode: b.mode,
1240
+ resultSoFar: Vt
1241
+ },
1242
+ _emitter: pe
1243
+ };
1244
+ if (se)
1245
+ return {
1246
+ language: g,
1247
+ value: Ft(k),
1248
+ illegal: !1,
1249
+ relevance: 0,
1250
+ errorRaised: b,
1251
+ _emitter: pe,
1252
+ _top: V
1253
+ };
1254
+ throw b;
1255
+ }
1256
+ }
1257
+ function Bt(g) {
1258
+ const k = {
1259
+ value: Ft(g),
1260
+ illegal: !1,
1261
+ relevance: 0,
1262
+ _top: M,
1263
+ _emitter: new x.__emitter(x)
1264
+ };
1265
+ return k._emitter.addText(g), k;
1266
+ }
1267
+ function Pt(g, k) {
1268
+ k = k || x.languages || Object.keys(u);
1269
+ const H = Bt(g), Y = k.filter($e).filter(pn).map(
1270
+ (ye) => ft(ye, g, !1)
1271
+ );
1272
+ Y.unshift(H);
1273
+ const ue = Y.sort((ye, Oe) => {
1274
+ if (ye.relevance !== Oe.relevance) return Oe.relevance - ye.relevance;
1275
+ if (ye.language && Oe.language) {
1276
+ if ($e(ye.language).supersetOf === Oe.language)
1277
+ return 1;
1278
+ if ($e(Oe.language).supersetOf === ye.language)
1279
+ return -1;
1280
+ }
1281
+ return 0;
1282
+ }), [Le, Ve] = ue, St = Le;
1283
+ return St.secondBest = Ve, St;
1284
+ }
1285
+ function Ei(g, k, H) {
1286
+ const Y = k && v[k] || H;
1287
+ g.classList.add("hljs"), g.classList.add(`language-${Y}`);
1288
+ }
1289
+ function $t(g) {
1290
+ let k = null;
1291
+ const H = he(g);
1292
+ if (F(H)) return;
1293
+ if (wt(
1294
+ "before:highlightElement",
1295
+ { el: g, language: H }
1296
+ ), g.dataset.highlighted) {
1297
+ console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", g);
1298
+ return;
1299
+ }
1300
+ if (g.children.length > 0 && (x.ignoreUnescapedHTML || (console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."), console.warn("https://github.com/highlightjs/highlight.js/wiki/security"), console.warn("The element with unescaped HTML:"), console.warn(g)), x.throwUnescapedHTML))
1301
+ throw new wi(
1302
+ "One of your code blocks includes unescaped HTML.",
1303
+ g.innerHTML
1304
+ );
1305
+ k = g;
1306
+ const Y = k.textContent, ue = H ? re(Y, { language: H, ignoreIllegals: !0 }) : Pt(Y);
1307
+ g.innerHTML = ue.value, g.dataset.highlighted = "yes", Ei(g, H, ue.language), g.result = {
1308
+ language: ue.language,
1309
+ // TODO: remove with version 11.0
1310
+ re: ue.relevance,
1311
+ relevance: ue.relevance
1312
+ }, ue.secondBest && (g.secondBest = {
1313
+ language: ue.secondBest.language,
1314
+ relevance: ue.secondBest.relevance
1315
+ }), wt("after:highlightElement", { el: g, result: ue, text: Y });
1316
+ }
1317
+ function Mi(g) {
1318
+ x = un(x, g);
1319
+ }
1320
+ const _i = () => {
1321
+ xt(), et("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
1322
+ };
1323
+ function Ci() {
1324
+ xt(), et("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
1325
+ }
1326
+ let hn = !1;
1327
+ function xt() {
1328
+ function g() {
1329
+ xt();
1330
+ }
1331
+ if (document.readyState === "loading") {
1332
+ hn || window.addEventListener("DOMContentLoaded", g, !1), hn = !0;
1333
+ return;
1334
+ }
1335
+ document.querySelectorAll(x.cssSelector).forEach($t);
1336
+ }
1337
+ function ki(g, k) {
1338
+ let H = null;
1339
+ try {
1340
+ H = k(a);
1341
+ } catch (Y) {
1342
+ if (Ge("Language definition for '{}' could not be registered.".replace("{}", g)), se)
1343
+ Ge(Y);
1344
+ else
1345
+ throw Y;
1346
+ H = M;
1347
+ }
1348
+ H.name || (H.name = g), u[g] = H, H.rawDefinition = k.bind(null, a), H.aliases && gn(H.aliases, { languageName: g });
1349
+ }
1350
+ function Ni(g) {
1351
+ delete u[g];
1352
+ for (const k of Object.keys(v))
1353
+ v[k] === g && delete v[k];
1354
+ }
1355
+ function Li() {
1356
+ return Object.keys(u);
1357
+ }
1358
+ function $e(g) {
1359
+ return g = (g || "").toLowerCase(), u[g] || u[v[g]];
1360
+ }
1361
+ function gn(g, { languageName: k }) {
1362
+ typeof g == "string" && (g = [g]), g.forEach((H) => {
1363
+ v[H.toLowerCase()] = k;
1364
+ });
1365
+ }
1366
+ function pn(g) {
1367
+ const k = $e(g);
1368
+ return k && !k.disableAutodetect;
1369
+ }
1370
+ function Di(g) {
1371
+ g["before:highlightBlock"] && !g["before:highlightElement"] && (g["before:highlightElement"] = (k) => {
1372
+ g["before:highlightBlock"](
1373
+ Object.assign({ block: k.el }, k)
1374
+ );
1375
+ }), g["after:highlightBlock"] && !g["after:highlightElement"] && (g["after:highlightElement"] = (k) => {
1376
+ g["after:highlightBlock"](
1377
+ Object.assign({ block: k.el }, k)
1378
+ );
1379
+ });
1380
+ }
1381
+ function Ti(g) {
1382
+ Di(g), P.push(g);
1383
+ }
1384
+ function Oi(g) {
1385
+ const k = P.indexOf(g);
1386
+ k !== -1 && P.splice(k, 1);
1387
+ }
1388
+ function wt(g, k) {
1389
+ const H = g;
1390
+ P.forEach(function(Y) {
1391
+ Y[H] && Y[H](k);
1392
+ });
1393
+ }
1394
+ function Ai(g) {
1395
+ return et("10.7.0", "highlightBlock will be removed entirely in v12.0"), et("10.7.0", "Please use highlightElement now."), $t(g);
1396
+ }
1397
+ Object.assign(a, {
1398
+ highlight: re,
1399
+ highlightAuto: Pt,
1400
+ highlightAll: xt,
1401
+ highlightElement: $t,
1402
+ // TODO: Remove with v12 API
1403
+ highlightBlock: Ai,
1404
+ configure: Mi,
1405
+ initHighlighting: _i,
1406
+ initHighlightingOnLoad: Ci,
1407
+ registerLanguage: ki,
1408
+ unregisterLanguage: Ni,
1409
+ listLanguages: Li,
1410
+ getLanguage: $e,
1411
+ registerAliases: gn,
1412
+ autoDetection: pn,
1413
+ inherit: un,
1414
+ addPlugin: Ti,
1415
+ removePlugin: Oi
1416
+ }), a.debugMode = function() {
1417
+ se = !1;
1418
+ }, a.safeMode = function() {
1419
+ se = !0;
1420
+ }, a.versionString = xi, a.regex = {
1421
+ concat: R,
1422
+ lookahead: f,
1423
+ either: G,
1424
+ optional: D,
1425
+ anyNumberOfTimes: N
1426
+ };
1427
+ for (const g in Te)
1428
+ typeof Te[g] == "object" && i(Te[g]);
1429
+ return Object.assign(a, Te), a;
1430
+ }, tt = fn({});
1431
+ return tt.newInstance = () => fn({}), Ht = tt, tt.HighlightJS = tt, tt.default = tt, Ht;
1432
+ }
1433
+ var Fl = /* @__PURE__ */ Il();
1434
+ const lt = /* @__PURE__ */ Rl(Fl);
1435
+ function Bl(i) {
1436
+ const e = i.regex, t = e.concat(/[\p{L}_]/u, e.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u), n = /[\p{L}0-9._:-]+/u, l = {
1437
+ className: "symbol",
1438
+ begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/
1439
+ }, s = {
1440
+ begin: /\s/,
1441
+ contains: [
1442
+ {
1443
+ className: "keyword",
1444
+ begin: /#?[a-z_][a-z1-9_-]+/,
1445
+ illegal: /\n/
1446
+ }
1447
+ ]
1448
+ }, o = i.inherit(s, {
1449
+ begin: /\(/,
1450
+ end: /\)/
1451
+ }), r = i.inherit(i.APOS_STRING_MODE, { className: "string" }), c = i.inherit(i.QUOTE_STRING_MODE, { className: "string" }), p = {
1452
+ endsWithParent: !0,
1453
+ illegal: /</,
1454
+ relevance: 0,
1455
+ contains: [
1456
+ {
1457
+ className: "attr",
1458
+ begin: n,
1459
+ relevance: 0
1460
+ },
1461
+ {
1462
+ begin: /=\s*/,
1463
+ relevance: 0,
1464
+ contains: [
1465
+ {
1466
+ className: "string",
1467
+ endsParent: !0,
1468
+ variants: [
1469
+ {
1470
+ begin: /"/,
1471
+ end: /"/,
1472
+ contains: [l]
1473
+ },
1474
+ {
1475
+ begin: /'/,
1476
+ end: /'/,
1477
+ contains: [l]
1478
+ },
1479
+ { begin: /[^\s"'=<>`]+/ }
1480
+ ]
1481
+ }
1482
+ ]
1483
+ }
1484
+ ]
1485
+ };
1486
+ return {
1487
+ name: "HTML, XML",
1488
+ aliases: [
1489
+ "html",
1490
+ "xhtml",
1491
+ "rss",
1492
+ "atom",
1493
+ "xjb",
1494
+ "xsd",
1495
+ "xsl",
1496
+ "plist",
1497
+ "wsf",
1498
+ "svg"
1499
+ ],
1500
+ case_insensitive: !0,
1501
+ unicodeRegex: !0,
1502
+ contains: [
1503
+ {
1504
+ className: "meta",
1505
+ begin: /<![a-z]/,
1506
+ end: />/,
1507
+ relevance: 10,
1508
+ contains: [
1509
+ s,
1510
+ c,
1511
+ r,
1512
+ o,
1513
+ {
1514
+ begin: /\[/,
1515
+ end: /\]/,
1516
+ contains: [
1517
+ {
1518
+ className: "meta",
1519
+ begin: /<![a-z]/,
1520
+ end: />/,
1521
+ contains: [
1522
+ s,
1523
+ o,
1524
+ c,
1525
+ r
1526
+ ]
1527
+ }
1528
+ ]
1529
+ }
1530
+ ]
1531
+ },
1532
+ i.COMMENT(
1533
+ /<!--/,
1534
+ /-->/,
1535
+ { relevance: 10 }
1536
+ ),
1537
+ {
1538
+ begin: /<!\[CDATA\[/,
1539
+ end: /\]\]>/,
1540
+ relevance: 10
1541
+ },
1542
+ l,
1543
+ // xml processing instructions
1544
+ {
1545
+ className: "meta",
1546
+ end: /\?>/,
1547
+ variants: [
1548
+ {
1549
+ begin: /<\?xml/,
1550
+ relevance: 10,
1551
+ contains: [
1552
+ c
1553
+ ]
1554
+ },
1555
+ {
1556
+ begin: /<\?[a-z][a-z0-9]+/
1557
+ }
1558
+ ]
1559
+ },
1560
+ {
1561
+ className: "tag",
1562
+ /*
1563
+ The lookahead pattern (?=...) ensures that 'begin' only matches
1564
+ '<style' as a single word, followed by a whitespace or an
1565
+ ending bracket.
1566
+ */
1567
+ begin: /<style(?=\s|>)/,
1568
+ end: />/,
1569
+ keywords: { name: "style" },
1570
+ contains: [p],
1571
+ starts: {
1572
+ end: /<\/style>/,
1573
+ returnEnd: !0,
1574
+ subLanguage: "css"
1575
+ }
1576
+ },
1577
+ {
1578
+ className: "tag",
1579
+ // See the comment in the <style tag about the lookahead pattern
1580
+ begin: /<script(?=\s|>)/,
1581
+ end: />/,
1582
+ keywords: { name: "script" },
1583
+ contains: [p],
1584
+ starts: {
1585
+ end: /<\/script>/,
1586
+ returnEnd: !0,
1587
+ subLanguage: "javascript"
1588
+ }
1589
+ },
1590
+ // we need this for now for jSX
1591
+ {
1592
+ className: "tag",
1593
+ begin: /<>|<\/>/
1594
+ },
1595
+ // open tag
1596
+ {
1597
+ className: "tag",
1598
+ begin: e.concat(
1599
+ /</,
1600
+ e.lookahead(e.concat(
1601
+ t,
1602
+ // <tag/>
1603
+ // <tag>
1604
+ // <tag ...
1605
+ e.either(/\/>/, />/, /\s/)
1606
+ ))
1607
+ ),
1608
+ end: /\/?>/,
1609
+ contains: [
1610
+ {
1611
+ className: "name",
1612
+ begin: t,
1613
+ relevance: 0,
1614
+ starts: p
1615
+ }
1616
+ ]
1617
+ },
1618
+ // close tag
1619
+ {
1620
+ className: "tag",
1621
+ begin: e.concat(
1622
+ /<\//,
1623
+ e.lookahead(e.concat(
1624
+ t,
1625
+ />/
1626
+ ))
1627
+ ),
1628
+ contains: [
1629
+ {
1630
+ className: "name",
1631
+ begin: t,
1632
+ relevance: 0
1633
+ },
1634
+ {
1635
+ begin: />/,
1636
+ relevance: 0,
1637
+ endsParent: !0
1638
+ }
1639
+ ]
1640
+ }
1641
+ ]
1642
+ };
1643
+ }
1644
+ const Pl = "([-+]?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)|NaN|[-+]?Infinity", $l = {
1645
+ scope: "number",
1646
+ match: Pl,
1647
+ relevance: 0
1648
+ };
1649
+ function Vl(i) {
1650
+ const e = {
1651
+ className: "attr",
1652
+ begin: /(("(\\.|[^\\"\r\n])*")|('(\\.|[^\\'\r\n])*'))(?=\s*:)/,
1653
+ relevance: 1.01
1654
+ }, t = {
1655
+ match: /[{}[\],:]/,
1656
+ className: "punctuation",
1657
+ relevance: 0
1658
+ }, n = [
1659
+ "true",
1660
+ "false",
1661
+ "null"
1662
+ ], l = {
1663
+ scope: "literal",
1664
+ beginKeywords: n.join(" ")
1665
+ };
1666
+ return {
1667
+ name: "JSON",
1668
+ aliases: ["jsonc", "json5"],
1669
+ keywords: {
1670
+ literal: n
1671
+ },
1672
+ contains: [
1673
+ e,
1674
+ t,
1675
+ i.APOS_STRING_MODE,
1676
+ i.QUOTE_STRING_MODE,
1677
+ l,
1678
+ $l,
1679
+ i.C_LINE_COMMENT_MODE,
1680
+ i.C_BLOCK_COMMENT_MODE
1681
+ ],
1682
+ illegal: "\\S"
1683
+ };
1684
+ }
1685
+ const jl = { class: "top-toolbar" }, Wl = { class: "toolbar-right" }, Ul = {
1686
+ style: { width: "14px", height: "14px" },
1687
+ viewBox: "0 0 24 24",
1688
+ fill: "none",
1689
+ stroke: "currentColor",
1690
+ "stroke-width": "2"
1691
+ }, Hl = {
1692
+ style: { width: "14px", height: "14px" },
1693
+ viewBox: "0 0 24 24",
1694
+ fill: "none",
1695
+ stroke: "currentColor",
1696
+ "stroke-width": "2"
1697
+ }, zl = {
1698
+ style: { width: "14px", height: "14px" },
1699
+ viewBox: "0 0 24 24",
1700
+ fill: "none",
1701
+ stroke: "currentColor",
1702
+ "stroke-width": "2"
1703
+ }, Xl = {
1704
+ style: { width: "14px", height: "14px" },
1705
+ viewBox: "0 0 24 24",
1706
+ fill: "none",
1707
+ stroke: "currentColor",
1708
+ "stroke-width": "2"
1709
+ }, Gl = { class: "code-block" }, Kl = ["innerHTML"], ql = { class: "dsl-viewer" }, Jl = { class: "dsl-code" }, Ql = ["innerHTML"], Yl = {
1710
+ __name: "TopToolbar",
1711
+ props: {
1712
+ readonly: { type: Boolean, default: !1 }
1713
+ },
1714
+ setup(i) {
1715
+ lt.registerLanguage("xml", Bl), lt.registerLanguage("json", Vl);
1716
+ const { lfRef: e, exportJSON: t } = Hi(), n = Al(), l = [...new Set(zi.map((E) => E.key))].join("|");
1717
+ lt.registerLanguage("liteflow-dsl", function(E) {
1718
+ const d = [
1719
+ be.THEN,
1720
+ be.PRE,
1721
+ be.FINALLY,
1722
+ be.WHEN,
1723
+ be.SWITCH,
1724
+ be.IF,
1725
+ be.FOR,
1726
+ be.WHILE,
1727
+ be.ITERATOR,
1728
+ be.AND,
1729
+ it.DO,
1730
+ it.ELSE,
1731
+ it.CATCH,
1732
+ it.OR,
1733
+ it.NOT,
1734
+ it.BUS
1735
+ ].join("|"), I = "true|false|null";
1736
+ return {
1737
+ name: "LiteFlow DSL",
1738
+ contains: [
1739
+ // 行注释 //
1740
+ E.COMMENT("//", "$", { relevance: 0 }),
1741
+ // 块注释 /* */
1742
+ E.C_BLOCK_COMMENT_MODE,
1743
+ // 字符串
1744
+ E.QUOTE_STRING_MODE,
1745
+ E.APOS_STRING_MODE,
1746
+ // 数字
1747
+ E.NUMBER_MODE,
1748
+ // 关键字(relevance=10 保证最高优先级,不会被 title 规则覆盖)
1749
+ {
1750
+ className: "keyword",
1751
+ begin: new RegExp("\\b(" + d + ")\\b"),
1752
+ relevance: 10
1753
+ },
1754
+ // 字面量
1755
+ {
1756
+ className: "literal",
1757
+ begin: new RegExp("\\b(" + I + ")\\b"),
1758
+ relevance: 10
1759
+ },
1760
+ // 子关键字调用 .id("xxx"), .retry(2, 3) 等
1761
+ {
1762
+ className: "attr",
1763
+ begin: new RegExp("\\.(" + l + ")\\b"),
1764
+ relevance: 5
1765
+ },
1766
+ // 普通组件 ID(最低优先级,避免覆盖关键字)
1767
+ {
1768
+ className: "title",
1769
+ begin: /\b([A-Za-z_][A-Za-z0-9_]*)\b/,
1770
+ relevance: 0
1771
+ }
1772
+ ]
1773
+ };
1774
+ });
1775
+ const s = J(!1), o = J("");
1776
+ function r(E) {
1777
+ let d = "", I = 0, B = 0;
1778
+ for (; B < E.length; ) {
1779
+ const Q = E[B];
1780
+ if (Q === "(")
1781
+ for (d += `(
1782
+ ` + " ".repeat(I + 1), I++, B++; B < E.length && E[B] === " "; ) B++;
1783
+ else if (Q === ")")
1784
+ for (I = Math.max(0, I - 1), d += `
1785
+ ` + " ".repeat(I) + ")", B++; B < E.length && E[B] === " "; ) B++;
1786
+ else if (Q === ",")
1787
+ for (d += `,
1788
+ ` + " ".repeat(I), B++; B < E.length && E[B] === " "; ) B++;
1789
+ else Q === ";" || (d += Q), B++;
1790
+ }
1791
+ return d.trim();
1792
+ }
1793
+ const c = we(() => {
1794
+ if (!o.value)
1795
+ return '<span class="hljs-comment"><!-- 空 --></span>';
1796
+ const E = r(o.value);
1797
+ return lt.highlight(E, { language: "liteflow-dsl" }).value.split(`
1798
+ `).map((Q, oe) => {
1799
+ const j = Q || " ";
1800
+ return `<span class="code-line"><span class="line-no">${oe + 1}</span>${j}</span>`;
1801
+ }).join("");
1802
+ });
1803
+ function p() {
1804
+ let E = "";
1805
+ n.activeTab.value === "chain" && n.currentFlowData.value && (e.value && n.currentFlowData.value.syncFromLF(e.value), E = n.currentFlowData.value.toDSL()), o.value = E, s.value = !0;
1806
+ }
1807
+ function w() {
1808
+ o.value && navigator.clipboard.writeText(o.value).then(() => {
1809
+ Be.success("已复制到剪贴板");
1810
+ });
1811
+ }
1812
+ let m = J(!1), f = J(!1), N = J(""), D = J("");
1813
+ function R() {
1814
+ D.value = "XML", N.value = "", m.value = !0;
1815
+ }
1816
+ function U() {
1817
+ D.value = "JSON", N.value = "", f.value = !0;
1818
+ }
1819
+ function G() {
1820
+ try {
1821
+ const E = N.value.trim();
1822
+ if (!E) {
1823
+ Be.warning("请输入 " + D.value + " 内容");
1824
+ return;
1825
+ }
1826
+ D.value == "XML" && (n.initFromXML(E), n.flowModel.value.chains.length > 0 && (n.selectChain(0), setTimeout(() => {
1827
+ n.activateChain(0, !0);
1828
+ }, 100)), m.value = !1), D.value == "JSON" && (n.initFromJSON(E), f.value = !1), Be.success(D.value + " 导入成功");
1829
+ } catch (E) {
1830
+ Be.error("导入 " + D.value + " 失败: " + E.message);
1831
+ }
1832
+ }
1833
+ let K = J(!1), S = J("");
1834
+ function O() {
1835
+ try {
1836
+ D.value = "JSON";
1837
+ const E = t(), d = JSON.stringify(E, null, 2);
1838
+ S.value = d || "", K.value = !0;
1839
+ } catch (E) {
1840
+ Be.error("查看 JSON 失败: " + E.message);
1841
+ }
1842
+ }
1843
+ function ee() {
1844
+ try {
1845
+ if (D.value = "XML", n.activeTab.value === "chain" && n.currentFlowData.value) {
1846
+ const d = e.value;
1847
+ d && n.currentFlowData.value.syncFromLF(d);
1848
+ }
1849
+ const E = n.toXML();
1850
+ S.value = E || "", K.value = !0;
1851
+ } catch (E) {
1852
+ Be.error("查看 XML 失败: " + E.message);
1853
+ }
1854
+ }
1855
+ function ke() {
1856
+ const E = t();
1857
+ if (!E) {
1858
+ alert("暂无流程数据");
1859
+ return;
1860
+ }
1861
+ const d = new Blob([JSON.stringify(E, null, 2)], { type: "application/json" }), I = URL.createObjectURL(d), B = document.createElement("a");
1862
+ B.href = I, B.download = "流程数据.json", B.click(), URL.revokeObjectURL(I);
1863
+ }
1864
+ const ge = J(/* @__PURE__ */ new Set());
1865
+ function ve(E) {
1866
+ const d = E.split(`
1867
+ `), I = [], B = [];
1868
+ for (let Q = 0; Q < d.length; Q++) {
1869
+ const oe = d[Q], j = /<(\w+)(?:\s[^>]*)?>/g, Xe = /<\/(\w+)>/g;
1870
+ let h;
1871
+ for (; (h = j.exec(oe)) !== null; ) {
1872
+ const y = h[1];
1873
+ h[0].endsWith("/>") || B.push({ tagName: y, openLine: Q });
1874
+ }
1875
+ for (; (h = Xe.exec(oe)) !== null; ) {
1876
+ const y = h[1];
1877
+ for (let $ = B.length - 1; $ >= 0; $--)
1878
+ if (B[$].tagName === y) {
1879
+ const { openLine: ce } = B[$];
1880
+ B.splice($, 1), Q - ce > 1 && I.push({ openLine: ce, closeLine: Q, tagName: y });
1881
+ break;
1882
+ }
1883
+ }
1884
+ }
1885
+ return I;
1886
+ }
1887
+ function Re(E) {
1888
+ const d = {};
1889
+ for (const I of E)
1890
+ d[I.openLine] = { closeLine: I.closeLine, tagName: I.tagName };
1891
+ return d;
1892
+ }
1893
+ function Me(E, d) {
1894
+ const I = /* @__PURE__ */ new Set();
1895
+ for (const [B, { closeLine: Q }] of Object.entries(E)) {
1896
+ const oe = parseInt(B);
1897
+ if (d.has(oe))
1898
+ for (let j = oe + 1; j <= Q; j++)
1899
+ I.add(j);
1900
+ }
1901
+ return I;
1902
+ }
1903
+ function T(E) {
1904
+ const d = E.target.closest(".fold-toggle");
1905
+ if (!d) return;
1906
+ const I = parseInt(d.dataset.line);
1907
+ if (isNaN(I)) return;
1908
+ const B = new Set(ge.value);
1909
+ B.has(I) ? B.delete(I) : B.add(I), ge.value = B;
1910
+ }
1911
+ const z = we(() => {
1912
+ if (D.value == "JSON")
1913
+ return lt.highlight(S.value, { language: "json" }).value;
1914
+ if (!S.value)
1915
+ return '<span class="hljs-comment"><!-- 空 --></span>';
1916
+ const d = lt.highlight(S.value, { language: "xml" }).value.split(`
1917
+ `), I = ve(S.value), B = Re(I), Q = Me(B, ge.value), oe = [];
1918
+ for (let j = 0; j < d.length; j++) {
1919
+ if (Q.has(j)) continue;
1920
+ const Xe = d[j] || " ", h = Object.prototype.hasOwnProperty.call(B, j), y = ge.value.has(j), $ = h ? `<span class="fold-toggle" data-line="${j}">${y ? "▶" : "▼"}</span>` : "", ce = h && y ? `<span class="collapsed-hint"> … </${B[j].tagName}></span>` : "";
1921
+ oe.push(
1922
+ `<span class="code-line${h ? " foldable" : ""}${y ? " folded" : ""}">${$}<span class="line-no">${j + 1}</span>${Xe}${ce}</span>`
1923
+ );
1924
+ }
1925
+ return oe.join(`
1926
+ `);
1927
+ });
1928
+ function _e() {
1929
+ S.value && navigator.clipboard.writeText(S.value).then(() => {
1930
+ Be.success("已复制到剪贴板");
1931
+ });
1932
+ }
1933
+ return (E, d) => {
1934
+ const I = fe("el-button"), B = fe("el-divider"), Q = fe("el-input"), oe = fe("el-dialog");
1935
+ return X(), ie("div", jl, [
1936
+ d[30] || (d[30] = L("div", { class: "toolbar-left" }, [
1937
+ L("span", { class: "toolbar-title" }, "流程编排设计器")
1938
+ ], -1)),
1939
+ L("div", Wl, [
1940
+ C(I, {
1941
+ size: "small",
1942
+ onClick: p,
1943
+ title: "查看 DSL"
1944
+ }, {
1945
+ default: A(() => [
1946
+ (X(), ie("svg", Ul, [...d[10] || (d[10] = [
1947
+ L("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }, null, -1),
1948
+ L("circle", {
1949
+ cx: "12",
1950
+ cy: "12",
1951
+ r: "3"
1952
+ }, null, -1)
1953
+ ])])),
1954
+ d[11] || (d[11] = ne(" 查看 DSL ", -1))
1955
+ ]),
1956
+ _: 1
1957
+ }),
1958
+ C(B, { direction: "vertical" }),
1959
+ i.readonly ? We("", !0) : (X(), He(I, {
1960
+ key: 0,
1961
+ size: "small",
1962
+ onClick: R
1963
+ }, {
1964
+ default: A(() => [...d[12] || (d[12] = [
1965
+ ne(" 导入 XML ", -1)
1966
+ ])]),
1967
+ _: 1
1968
+ })),
1969
+ C(I, {
1970
+ size: "small",
1971
+ onClick: ee
1972
+ }, {
1973
+ default: A(() => [
1974
+ (X(), ie("svg", Hl, [...d[13] || (d[13] = [
1975
+ L("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }, null, -1),
1976
+ L("circle", {
1977
+ cx: "12",
1978
+ cy: "12",
1979
+ r: "3"
1980
+ }, null, -1)
1981
+ ])])),
1982
+ d[14] || (d[14] = ne(" 查看 XML ", -1))
1983
+ ]),
1984
+ _: 1
1985
+ }),
1986
+ C(B, { direction: "vertical" }),
1987
+ i.readonly ? We("", !0) : (X(), He(I, {
1988
+ key: 1,
1989
+ size: "small",
1990
+ onClick: U
1991
+ }, {
1992
+ default: A(() => [...d[15] || (d[15] = [
1993
+ ne(" 导入 JSON ", -1)
1994
+ ])]),
1995
+ _: 1
1996
+ })),
1997
+ C(I, {
1998
+ size: "small",
1999
+ onClick: O
2000
+ }, {
2001
+ default: A(() => [
2002
+ (X(), ie("svg", zl, [...d[16] || (d[16] = [
2003
+ L("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }, null, -1),
2004
+ L("circle", {
2005
+ cx: "12",
2006
+ cy: "12",
2007
+ r: "3"
2008
+ }, null, -1)
2009
+ ])])),
2010
+ d[17] || (d[17] = ne(" 查看 JSON ", -1))
2011
+ ]),
2012
+ _: 1
2013
+ }),
2014
+ C(I, {
2015
+ size: "small",
2016
+ onClick: ke
2017
+ }, {
2018
+ default: A(() => [
2019
+ (X(), ie("svg", Xl, [...d[18] || (d[18] = [
2020
+ L("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }, null, -1),
2021
+ L("polyline", { points: "7 10 12 15 17 10" }, null, -1),
2022
+ L("line", {
2023
+ x1: "12",
2024
+ y1: "15",
2025
+ x2: "12",
2026
+ y2: "3"
2027
+ }, null, -1)
2028
+ ])])),
2029
+ d[19] || (d[19] = ne(" 导出 JSON ", -1))
2030
+ ]),
2031
+ _: 1
2032
+ })
2033
+ ]),
2034
+ C(oe, {
2035
+ modelValue: te(m),
2036
+ "onUpdate:modelValue": d[2] || (d[2] = (j) => je(m) ? m.value = j : m = j),
2037
+ title: "导入" + te(D),
2038
+ width: "550px",
2039
+ "append-to-body": ""
2040
+ }, {
2041
+ footer: A(() => [
2042
+ C(I, {
2043
+ onClick: d[1] || (d[1] = (j) => je(m) ? m.value = !1 : m = !1)
2044
+ }, {
2045
+ default: A(() => [...d[20] || (d[20] = [
2046
+ ne("取消", -1)
2047
+ ])]),
2048
+ _: 1
2049
+ }),
2050
+ C(I, {
2051
+ type: "primary",
2052
+ onClick: G
2053
+ }, {
2054
+ default: A(() => [...d[21] || (d[21] = [
2055
+ ne("确定导入", -1)
2056
+ ])]),
2057
+ _: 1
2058
+ })
2059
+ ]),
2060
+ default: A(() => [
2061
+ C(Q, {
2062
+ modelValue: te(N),
2063
+ "onUpdate:modelValue": d[0] || (d[0] = (j) => je(N) ? N.value = j : N = j),
2064
+ type: "textarea",
2065
+ rows: 14,
2066
+ placeholder: "请粘贴 LiteFlow " + te(D) + " 数据..."
2067
+ }, null, 8, ["modelValue", "placeholder"])
2068
+ ]),
2069
+ _: 1
2070
+ }, 8, ["modelValue", "title"]),
2071
+ C(oe, {
2072
+ modelValue: te(f),
2073
+ "onUpdate:modelValue": d[5] || (d[5] = (j) => je(f) ? f.value = j : f = j),
2074
+ title: "导入" + te(D),
2075
+ width: "550px",
2076
+ "append-to-body": ""
2077
+ }, {
2078
+ footer: A(() => [
2079
+ C(I, {
2080
+ onClick: d[4] || (d[4] = (j) => je(f) ? f.value = !1 : f = !1)
2081
+ }, {
2082
+ default: A(() => [...d[22] || (d[22] = [
2083
+ ne("取消", -1)
2084
+ ])]),
2085
+ _: 1
2086
+ }),
2087
+ C(I, {
2088
+ type: "primary",
2089
+ onClick: G
2090
+ }, {
2091
+ default: A(() => [...d[23] || (d[23] = [
2092
+ ne("确定导入", -1)
2093
+ ])]),
2094
+ _: 1
2095
+ })
2096
+ ]),
2097
+ default: A(() => [
2098
+ C(Q, {
2099
+ modelValue: te(N),
2100
+ "onUpdate:modelValue": d[3] || (d[3] = (j) => je(N) ? N.value = j : N = j),
2101
+ type: "textarea",
2102
+ rows: 14,
2103
+ placeholder: "请粘贴 LiteFlow " + te(D) + " 数据..."
2104
+ }, null, 8, ["modelValue", "placeholder"])
2105
+ ]),
2106
+ _: 1
2107
+ }, 8, ["modelValue", "title"]),
2108
+ C(oe, {
2109
+ modelValue: te(K),
2110
+ "onUpdate:modelValue": d[7] || (d[7] = (j) => je(K) ? K.value = j : K = j),
2111
+ title: "查看" + te(D),
2112
+ width: "800px",
2113
+ "append-to-body": ""
2114
+ }, {
2115
+ footer: A(() => [
2116
+ C(I, { onClick: _e }, {
2117
+ default: A(() => [...d[26] || (d[26] = [
2118
+ ne("复制", -1)
2119
+ ])]),
2120
+ _: 1
2121
+ }),
2122
+ C(I, {
2123
+ onClick: d[6] || (d[6] = (j) => je(K) ? K.value = !1 : K = !1)
2124
+ }, {
2125
+ default: A(() => [...d[27] || (d[27] = [
2126
+ ne("关闭", -1)
2127
+ ])]),
2128
+ _: 1
2129
+ })
2130
+ ]),
2131
+ default: A(() => [
2132
+ L("div", {
2133
+ class: "code-viewer",
2134
+ onClick: T
2135
+ }, [
2136
+ L("pre", Gl, [
2137
+ d[24] || (d[24] = ne(" ", -1)),
2138
+ L("code", {
2139
+ class: "hljs language-xml",
2140
+ innerHTML: z.value
2141
+ }, null, 8, Kl),
2142
+ d[25] || (d[25] = ne(`
2143
+ `, -1))
2144
+ ])
2145
+ ])
2146
+ ]),
2147
+ _: 1
2148
+ }, 8, ["modelValue", "title"]),
2149
+ C(oe, {
2150
+ modelValue: s.value,
2151
+ "onUpdate:modelValue": d[9] || (d[9] = (j) => s.value = j),
2152
+ title: "DSL 表达式",
2153
+ width: "750px",
2154
+ class: "dsl-view-dialog",
2155
+ "append-to-body": ""
2156
+ }, {
2157
+ footer: A(() => [
2158
+ C(I, {
2159
+ type: "primary",
2160
+ onClick: w
2161
+ }, {
2162
+ default: A(() => [...d[28] || (d[28] = [
2163
+ ne("复制", -1)
2164
+ ])]),
2165
+ _: 1
2166
+ }),
2167
+ C(I, {
2168
+ onClick: d[8] || (d[8] = (j) => s.value = !1)
2169
+ }, {
2170
+ default: A(() => [...d[29] || (d[29] = [
2171
+ ne("关闭", -1)
2172
+ ])]),
2173
+ _: 1
2174
+ })
2175
+ ]),
2176
+ default: A(() => [
2177
+ L("div", ql, [
2178
+ L("pre", Jl, [
2179
+ L("code", {
2180
+ class: "hljs language-liteflow-dsl",
2181
+ innerHTML: c.value
2182
+ }, null, 8, Ql)
2183
+ ])
2184
+ ])
2185
+ ]),
2186
+ _: 1
2187
+ }, 8, ["modelValue"])
2188
+ ]);
2189
+ };
2190
+ }
2191
+ }, Zl = /* @__PURE__ */ It(Yl, [["__scopeId", "data-v-53184566"]]), es = { class: "side-panel" }, ts = { class: "collapse-title" }, ns = { class: "header-right" }, is = { class: "section-count" }, ls = { class: "section-body" }, ss = {
2192
+ key: 0,
2193
+ class: "empty-tip"
2194
+ }, as = ["onClick"], rs = { class: "item-main" }, os = { class: "item-name" }, cs = { class: "item-meta" }, us = { class: "meta-tag id-tag" }, ds = {
2195
+ key: 0,
2196
+ class: "item-actions"
2197
+ }, fs = {
2198
+ style: { width: "14px", height: "14px" },
2199
+ viewBox: "0 0 24 24",
2200
+ fill: "none",
2201
+ stroke: "currentColor",
2202
+ "stroke-width": "2"
2203
+ }, hs = {
2204
+ style: { width: "14px", height: "14px" },
2205
+ viewBox: "0 0 24 24",
2206
+ fill: "none",
2207
+ stroke: "#F56C6C",
2208
+ "stroke-width": "2"
2209
+ }, gs = { class: "collapse-title" }, ps = { class: "header-right" }, ms = { class: "section-count" }, vs = { class: "section-body" }, bs = {
2210
+ key: 0,
2211
+ class: "empty-tip"
2212
+ }, ys = ["onClick"], xs = { class: "item-main" }, ws = { class: "item-name" }, Ss = {
2213
+ key: 0,
2214
+ class: "item-actions"
2215
+ }, Es = {
2216
+ style: { width: "14px", height: "14px" },
2217
+ viewBox: "0 0 24 24",
2218
+ fill: "none",
2219
+ stroke: "currentColor",
2220
+ "stroke-width": "2"
2221
+ }, Ms = {
2222
+ style: { width: "14px", height: "14px" },
2223
+ viewBox: "0 0 24 24",
2224
+ fill: "none",
2225
+ stroke: "#F56C6C",
2226
+ "stroke-width": "2"
2227
+ }, _s = {
2228
+ __name: "SidePanel",
2229
+ props: {
2230
+ scriptNodes: { type: Array, default: () => [] },
2231
+ chains: { type: Array, default: () => [] },
2232
+ activeTab: { type: String, default: "none" },
2233
+ activeScriptIndex: { type: Number, default: -1 },
2234
+ activeChainIndex: { type: Number, default: -1 },
2235
+ readonly: { type: Boolean, default: !1 }
2236
+ },
2237
+ emits: [
2238
+ "addScript",
2239
+ "editScript",
2240
+ "deleteScript",
2241
+ "addChain",
2242
+ "editChain",
2243
+ "deleteChain",
2244
+ "selectScript",
2245
+ "selectChain"
2246
+ ],
2247
+ setup(i) {
2248
+ const e = J(["script", "chain"]);
2249
+ return (t, n) => {
2250
+ const l = fe("el-button"), s = fe("el-collapse-item"), o = fe("el-collapse");
2251
+ return X(), ie("div", es, [
2252
+ C(o, {
2253
+ modelValue: e.value,
2254
+ "onUpdate:modelValue": n[2] || (n[2] = (r) => e.value = r)
2255
+ }, {
2256
+ default: A(() => [
2257
+ C(s, { name: "script" }, {
2258
+ title: A(() => [
2259
+ L("div", ts, [
2260
+ n[4] || (n[4] = L("span", { class: "section-title" }, "脚本节点", -1)),
2261
+ L("span", ns, [
2262
+ L("span", is, st(i.scriptNodes.length), 1),
2263
+ i.readonly ? We("", !0) : (X(), He(l, {
2264
+ key: 0,
2265
+ size: "small",
2266
+ type: "primary",
2267
+ text: "",
2268
+ onClick: n[0] || (n[0] = nt((r) => t.$emit("addScript"), ["stop"]))
2269
+ }, {
2270
+ default: A(() => [...n[3] || (n[3] = [
2271
+ ne(" + 新增 ", -1)
2272
+ ])]),
2273
+ _: 1
2274
+ }))
2275
+ ])
2276
+ ])
2277
+ ]),
2278
+ default: A(() => [
2279
+ L("div", ls, [
2280
+ i.scriptNodes.length === 0 ? (X(), ie("div", ss, " 暂无脚本节点 ")) : We("", !0),
2281
+ (X(!0), ie(wn, null, Sn(i.scriptNodes, (r, c) => (X(), ie("div", {
2282
+ key: r.id || c,
2283
+ class: Kt(["list-item", { active: i.activeTab === "script" && i.activeScriptIndex === c }]),
2284
+ onClick: (p) => t.$emit("selectScript", c)
2285
+ }, [
2286
+ L("div", rs, [
2287
+ L("span", os, st(r.name || r.id || "未命名"), 1)
2288
+ ]),
2289
+ L("div", cs, [
2290
+ L("span", us, st(r.id), 1)
2291
+ ]),
2292
+ i.readonly ? We("", !0) : (X(), ie("div", ds, [
2293
+ C(l, {
2294
+ size: "small",
2295
+ text: "",
2296
+ title: "编辑",
2297
+ onClick: nt((p) => t.$emit("editScript", c), ["stop"])
2298
+ }, {
2299
+ default: A(() => [
2300
+ (X(), ie("svg", fs, [...n[5] || (n[5] = [
2301
+ L("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, null, -1),
2302
+ L("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" }, null, -1)
2303
+ ])]))
2304
+ ]),
2305
+ _: 1
2306
+ }, 8, ["onClick"]),
2307
+ C(l, {
2308
+ size: "small",
2309
+ text: "",
2310
+ title: "删除",
2311
+ onClick: nt((p) => t.$emit("deleteScript", c), ["stop"])
2312
+ }, {
2313
+ default: A(() => [
2314
+ (X(), ie("svg", hs, [...n[6] || (n[6] = [
2315
+ L("polyline", { points: "3 6 5 6 21 6" }, null, -1),
2316
+ L("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }, null, -1)
2317
+ ])]))
2318
+ ]),
2319
+ _: 1
2320
+ }, 8, ["onClick"])
2321
+ ]))
2322
+ ], 10, as))), 128))
2323
+ ])
2324
+ ]),
2325
+ _: 1
2326
+ }),
2327
+ C(s, { name: "chain" }, {
2328
+ title: A(() => [
2329
+ L("div", gs, [
2330
+ n[8] || (n[8] = L("span", { class: "section-title" }, "流程链", -1)),
2331
+ L("span", ps, [
2332
+ L("span", ms, st(i.chains.length), 1),
2333
+ i.readonly ? We("", !0) : (X(), He(l, {
2334
+ key: 0,
2335
+ size: "small",
2336
+ type: "primary",
2337
+ text: "",
2338
+ onClick: n[1] || (n[1] = nt((r) => t.$emit("addChain"), ["stop"]))
2339
+ }, {
2340
+ default: A(() => [...n[7] || (n[7] = [
2341
+ ne(" + 新增 ", -1)
2342
+ ])]),
2343
+ _: 1
2344
+ }))
2345
+ ])
2346
+ ])
2347
+ ]),
2348
+ default: A(() => [
2349
+ L("div", vs, [
2350
+ i.chains.length === 0 ? (X(), ie("div", bs, " 暂无流程链 ")) : We("", !0),
2351
+ (X(!0), ie(wn, null, Sn(i.chains, (r, c) => (X(), ie("div", {
2352
+ key: r.name || c,
2353
+ class: Kt(["list-item chain-item", { active: i.activeTab === "chain" && i.activeChainIndex === c }]),
2354
+ onClick: (p) => t.$emit("selectChain", c)
2355
+ }, [
2356
+ L("div", xs, [
2357
+ L("span", ws, st(r.name || "未命名"), 1)
2358
+ ]),
2359
+ i.readonly ? We("", !0) : (X(), ie("div", Ss, [
2360
+ C(l, {
2361
+ size: "small",
2362
+ text: "",
2363
+ title: "编辑",
2364
+ onClick: nt((p) => t.$emit("editChain", c), ["stop"])
2365
+ }, {
2366
+ default: A(() => [
2367
+ (X(), ie("svg", Es, [...n[9] || (n[9] = [
2368
+ L("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }, null, -1),
2369
+ L("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" }, null, -1)
2370
+ ])]))
2371
+ ]),
2372
+ _: 1
2373
+ }, 8, ["onClick"]),
2374
+ C(l, {
2375
+ size: "small",
2376
+ text: "",
2377
+ title: "删除",
2378
+ onClick: nt((p) => t.$emit("deleteChain", c), ["stop"])
2379
+ }, {
2380
+ default: A(() => [
2381
+ (X(), ie("svg", Ms, [...n[10] || (n[10] = [
2382
+ L("polyline", { points: "3 6 5 6 21 6" }, null, -1),
2383
+ L("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }, null, -1)
2384
+ ])]))
2385
+ ]),
2386
+ _: 1
2387
+ }, 8, ["onClick"])
2388
+ ]))
2389
+ ], 10, ys))), 128))
2390
+ ])
2391
+ ]),
2392
+ _: 1
2393
+ })
2394
+ ]),
2395
+ _: 1
2396
+ }, 8, ["modelValue"])
2397
+ ]);
2398
+ };
2399
+ }
2400
+ }, Cs = /* @__PURE__ */ It(_s, [["__scopeId", "data-v-19442045"]]);
2401
+ function le() {
2402
+ var i = arguments[0];
2403
+ typeof i == "string" && (i = document.createElement(i));
2404
+ var e = 1, t = arguments[1];
2405
+ if (t && typeof t == "object" && t.nodeType == null && !Array.isArray(t)) {
2406
+ for (var n in t) if (Object.prototype.hasOwnProperty.call(t, n)) {
2407
+ var l = t[n];
2408
+ typeof l == "string" ? i.setAttribute(n, l) : l != null && (i[n] = l);
2409
+ }
2410
+ e++;
2411
+ }
2412
+ for (; e < arguments.length; e++) Un(i, arguments[e]);
2413
+ return i;
2414
+ }
2415
+ function Un(i, e) {
2416
+ if (typeof e == "string")
2417
+ i.appendChild(document.createTextNode(e));
2418
+ else if (e != null) if (e.nodeType != null)
2419
+ i.appendChild(e);
2420
+ else if (Array.isArray(e))
2421
+ for (var t = 0; t < e.length; t++) Un(i, e[t]);
2422
+ else
2423
+ throw new RangeError("Unsupported child node: " + e);
2424
+ }
2425
+ const Nn = typeof String.prototype.normalize == "function" ? (i) => i.normalize("NFKD") : (i) => i;
2426
+ class ut {
2427
+ /**
2428
+ Create a text cursor. The query is the search string, `from` to
2429
+ `to` provides the region to search.
2430
+
2431
+ When `normalize` is given, it will be called, on both the query
2432
+ string and the content it is matched against, before comparing.
2433
+ You can, for example, create a case-insensitive search by
2434
+ passing `s => s.toLowerCase()`.
2435
+
2436
+ Text is always normalized with
2437
+ [`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
2438
+ (when supported).
2439
+ */
2440
+ constructor(e, t, n = 0, l = e.length, s, o) {
2441
+ this.test = o, this.value = { from: 0, to: 0, precise: !1 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, l), this.bufferStart = n, this.normalize = s ? (r) => s(Nn(r)) : Nn, this.query = this.normalize(t);
2442
+ }
2443
+ peek() {
2444
+ if (this.bufferPos == this.buffer.length) {
2445
+ if (this.bufferStart += this.buffer.length, this.iter.next(), this.iter.done)
2446
+ return -1;
2447
+ this.bufferPos = 0, this.buffer = this.iter.value;
2448
+ }
2449
+ return qi(this.buffer, this.bufferPos);
2450
+ }
2451
+ /**
2452
+ Look for the next match. Updates the iterator's
2453
+ [`value`](https://codemirror.net/6/docs/ref/#search.SearchCursor.value) and
2454
+ [`done`](https://codemirror.net/6/docs/ref/#search.SearchCursor.done) properties. Should be called
2455
+ at least once before using the cursor.
2456
+ */
2457
+ next() {
2458
+ for (; this.matches.length; )
2459
+ this.matches.pop();
2460
+ return this.nextOverlapping();
2461
+ }
2462
+ /**
2463
+ The `next` method will ignore matches that partially overlap a
2464
+ previous match. This method behaves like `next`, but includes
2465
+ such matches.
2466
+ */
2467
+ nextOverlapping() {
2468
+ for (; ; ) {
2469
+ let e = this.peek();
2470
+ if (e < 0)
2471
+ return this.done = !0, this;
2472
+ let t = Ji(e), n = this.bufferStart + this.bufferPos;
2473
+ this.bufferPos += Qi(e);
2474
+ let l = this.normalize(t);
2475
+ if (l.length)
2476
+ for (let s = 0, o = n, r = !0; ; s++) {
2477
+ let c = l.charCodeAt(s), p = this.match(c, o, r, this.bufferPos + this.bufferStart, s == l.length - 1);
2478
+ if (p)
2479
+ return this.value = p, this;
2480
+ if (s == l.length - 1)
2481
+ break;
2482
+ r && s < t.length && t.charCodeAt(s) == c ? o++ : r = !1;
2483
+ }
2484
+ }
2485
+ }
2486
+ match(e, t, n, l, s) {
2487
+ let o = null;
2488
+ for (let r = 0; r < this.matches.length; ) {
2489
+ let c = this.matches[r], p = !1;
2490
+ this.query.charCodeAt(c.index) == e && (c.index == this.query.length - 1 ? o = { from: c.from, to: l, precise: s && c.precise } : (c.index++, p = !0)), p ? r++ : this.matches.splice(r, 1);
2491
+ }
2492
+ return this.query.charCodeAt(0) == e && (this.query.length == 1 ? o = { from: t, to: l, precise: n && s } : this.matches.push({ from: t, index: 1, precise: n })), o && this.test && !this.test(o.from, o.to, this.buffer, this.bufferStart) && (o = null), o;
2493
+ }
2494
+ }
2495
+ typeof Symbol < "u" && (ut.prototype[Symbol.iterator] = function() {
2496
+ return this;
2497
+ });
2498
+ const Hn = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec(""), precise: !0 }, Zt = "gm" + (/x/.unicode == null ? "" : "u");
2499
+ class zn {
2500
+ /**
2501
+ Create a cursor that will search the given range in the given
2502
+ document. `query` should be the raw pattern (as you'd pass it to
2503
+ `new RegExp`).
2504
+ */
2505
+ constructor(e, t, n, l = 0, s = e.length) {
2506
+ if (this.text = e, this.to = s, this.curLine = "", this.done = !1, this.value = Hn, /\\[sWDnr]|\n|\r|\[\^/.test(t))
2507
+ return new Xn(e, t, n, l, s);
2508
+ this.re = new RegExp(t, Zt + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.iter = e.iter();
2509
+ let o = e.lineAt(l);
2510
+ this.curLineStart = o.from, this.matchPos = Dt(e, l), this.getLine(this.curLineStart);
2511
+ }
2512
+ getLine(e) {
2513
+ 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());
2514
+ }
2515
+ nextLine() {
2516
+ this.curLineStart = this.curLineStart + this.curLine.length + 1, this.curLineStart > this.to ? this.curLine = "" : this.getLine(0);
2517
+ }
2518
+ /**
2519
+ Move to the next match, if there is one.
2520
+ */
2521
+ next() {
2522
+ for (let e = this.matchPos - this.curLineStart; ; ) {
2523
+ this.re.lastIndex = e;
2524
+ let t = this.matchPos <= this.to && this.re.exec(this.curLine);
2525
+ if (t) {
2526
+ let n = this.curLineStart + t.index, l = n + t[0].length;
2527
+ if (this.matchPos = Dt(this.text, l + (n == l ? 1 : 0)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < l || n > this.value.to) && (!this.test || this.test(n, l, t)))
2528
+ return this.value = { from: n, to: l, precise: !0, match: t }, this;
2529
+ e = this.matchPos - this.curLineStart;
2530
+ } else if (this.curLineStart + this.curLine.length < this.to)
2531
+ this.nextLine(), e = 0;
2532
+ else
2533
+ return this.done = !0, this;
2534
+ }
2535
+ }
2536
+ }
2537
+ const zt = /* @__PURE__ */ new WeakMap();
2538
+ class ot {
2539
+ constructor(e, t) {
2540
+ this.from = e, this.text = t;
2541
+ }
2542
+ get to() {
2543
+ return this.from + this.text.length;
2544
+ }
2545
+ static get(e, t, n) {
2546
+ let l = zt.get(e);
2547
+ if (!l || l.from >= n || l.to <= t) {
2548
+ let r = new ot(t, e.sliceString(t, n));
2549
+ return zt.set(e, r), r;
2550
+ }
2551
+ if (l.from == t && l.to == n)
2552
+ return l;
2553
+ let { text: s, from: o } = l;
2554
+ return o > t && (s = e.sliceString(t, o) + s, o = t), l.to < n && (s += e.sliceString(l.to, n)), zt.set(e, new ot(o, s)), new ot(t, s.slice(t - o, n - o));
2555
+ }
2556
+ }
2557
+ class Xn {
2558
+ constructor(e, t, n, l, s) {
2559
+ this.text = e, this.to = s, this.done = !1, this.value = Hn, this.matchPos = Dt(e, l), this.re = new RegExp(t, Zt + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.flat = ot.get(e, l, this.chunkEnd(
2560
+ l + 5e3
2561
+ /* Chunk.Base */
2562
+ ));
2563
+ }
2564
+ chunkEnd(e) {
2565
+ return e >= this.to ? this.to : this.text.lineAt(e).to;
2566
+ }
2567
+ next() {
2568
+ for (; ; ) {
2569
+ let e = this.re.lastIndex = this.matchPos - this.flat.from, t = this.re.exec(this.flat.text);
2570
+ if (t && !t[0] && t.index == e && (this.re.lastIndex = e + 1, t = this.re.exec(this.flat.text)), t) {
2571
+ let n = this.flat.from + t.index, l = n + t[0].length;
2572
+ if ((this.flat.to >= this.to || t.index + t[0].length <= this.flat.text.length - 10) && (!this.test || this.test(n, l, t)))
2573
+ return this.value = { from: n, to: l, precise: !0, match: t }, this.matchPos = Dt(this.text, l + (n == l ? 1 : 0)), this;
2574
+ }
2575
+ if (this.flat.to == this.to)
2576
+ return this.done = !0, this;
2577
+ this.flat = ot.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
2578
+ }
2579
+ }
2580
+ }
2581
+ typeof Symbol < "u" && (zn.prototype[Symbol.iterator] = Xn.prototype[Symbol.iterator] = function() {
2582
+ return this;
2583
+ });
2584
+ function ks(i) {
2585
+ try {
2586
+ return new RegExp(i, Zt), !0;
2587
+ } catch {
2588
+ return !1;
2589
+ }
2590
+ }
2591
+ function Dt(i, e) {
2592
+ if (e >= i.length)
2593
+ return e;
2594
+ let t = i.lineAt(e), n;
2595
+ for (; e < t.to && (n = t.text.charCodeAt(e - t.from)) >= 56320 && n < 57344; )
2596
+ e++;
2597
+ return e;
2598
+ }
2599
+ const Ns = (i) => {
2600
+ let e = Yi(i, "cm-goto-line");
2601
+ if (e) {
2602
+ let o = e.dom.querySelector("input[type=text]");
2603
+ return o && o.select(), !0;
2604
+ }
2605
+ let { state: t } = i, n = String(t.doc.lineAt(i.state.selection.main.head).number), { close: l, result: s } = Zi(i, {
2606
+ class: "cm-goto-line",
2607
+ label: t.phrase("Go to line"),
2608
+ input: { type: "text", name: "line", value: n },
2609
+ focus: !0,
2610
+ submitLabel: t.phrase("go")
2611
+ });
2612
+ return s.then((o) => {
2613
+ let r = o && /^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);
2614
+ if (!r) {
2615
+ i.dispatch({ effects: l });
2616
+ return;
2617
+ }
2618
+ let c = t.doc.lineAt(t.selection.main.head), [, p, w, m, f] = r, N = m ? +m.slice(1) : 0, D = w ? +w : c.number;
2619
+ if (w && f) {
2620
+ let G = D / 100;
2621
+ p && (G = G * (p == "-" ? -1 : 1) + c.number / t.doc.lines), D = Math.round(t.doc.lines * G);
2622
+ } else w && p && (D = D * (p == "-" ? -1 : 1) + c.number);
2623
+ let R = t.doc.line(Math.max(1, Math.min(t.doc.lines, D))), U = De.cursor(R.from + Math.max(0, Math.min(N, R.length)));
2624
+ i.dispatch({
2625
+ effects: [l, Ee.scrollIntoView(U.from, { y: "center" })],
2626
+ selection: U
2627
+ });
2628
+ }), !0;
2629
+ }, Ls = {
2630
+ highlightWordAroundCursor: !1,
2631
+ minSelectionLength: 1,
2632
+ maxMatches: 100,
2633
+ wholeWords: !1
2634
+ }, Ds = /* @__PURE__ */ Jt.define({
2635
+ combine(i) {
2636
+ return Qt(i, Ls, {
2637
+ highlightWordAroundCursor: (e, t) => e || t,
2638
+ minSelectionLength: Math.min,
2639
+ maxMatches: Math.min
2640
+ });
2641
+ }
2642
+ });
2643
+ function Ts(i) {
2644
+ return [Fs, Is];
2645
+ }
2646
+ const Os = /* @__PURE__ */ de.mark({ class: "cm-selectionMatch" }), As = /* @__PURE__ */ de.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
2647
+ function Ln(i, e, t, n) {
2648
+ return (t == 0 || i(e.sliceDoc(t - 1, t)) != Ce.Word) && (n == e.doc.length || i(e.sliceDoc(n, n + 1)) != Ce.Word);
2649
+ }
2650
+ function Rs(i, e, t, n) {
2651
+ return i(e.sliceDoc(t, t + 1)) == Ce.Word && i(e.sliceDoc(n - 1, n)) == Ce.Word;
2652
+ }
2653
+ const Is = /* @__PURE__ */ Vn.fromClass(class {
2654
+ constructor(i) {
2655
+ this.decorations = this.getDeco(i);
2656
+ }
2657
+ update(i) {
2658
+ (i.selectionSet || i.docChanged || i.viewportChanged) && (this.decorations = this.getDeco(i.view));
2659
+ }
2660
+ getDeco(i) {
2661
+ let e = i.state.facet(Ds), { state: t } = i, n = t.selection;
2662
+ if (n.ranges.length > 1)
2663
+ return de.none;
2664
+ let l = n.main, s, o = null;
2665
+ if (l.empty) {
2666
+ if (!e.highlightWordAroundCursor)
2667
+ return de.none;
2668
+ let c = t.wordAt(l.head);
2669
+ if (!c)
2670
+ return de.none;
2671
+ o = t.charCategorizer(l.head), s = t.sliceDoc(c.from, c.to);
2672
+ } else {
2673
+ let c = l.to - l.from;
2674
+ if (c < e.minSelectionLength || c > 200)
2675
+ return de.none;
2676
+ if (e.wholeWords) {
2677
+ if (s = t.sliceDoc(l.from, l.to), o = t.charCategorizer(l.head), !(Ln(o, t, l.from, l.to) && Rs(o, t, l.from, l.to)))
2678
+ return de.none;
2679
+ } else if (s = t.sliceDoc(l.from, l.to), !s)
2680
+ return de.none;
2681
+ }
2682
+ let r = [];
2683
+ for (let c of i.visibleRanges) {
2684
+ let p = new ut(t.doc, s, c.from, c.to);
2685
+ for (; !p.next().done; ) {
2686
+ let { from: w, to: m } = p.value;
2687
+ if ((!o || Ln(o, t, w, m)) && (l.empty && w <= l.from && m >= l.to ? r.push(As.range(w, m)) : (w >= l.to || m <= l.from) && r.push(Os.range(w, m)), r.length > e.maxMatches))
2688
+ return de.none;
2689
+ }
2690
+ }
2691
+ return de.set(r);
2692
+ }
2693
+ }, {
2694
+ decorations: (i) => i.decorations
2695
+ }), Fs = /* @__PURE__ */ Ee.baseTheme({
2696
+ ".cm-selectionMatch": { backgroundColor: "#99ff7780" },
2697
+ ".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
2698
+ }), Bs = ({ state: i, dispatch: e }) => {
2699
+ let { selection: t } = i, n = De.create(t.ranges.map((l) => i.wordAt(l.head) || De.cursor(l.head)), t.mainIndex);
2700
+ return n.eq(t) ? !1 : (e(i.update({ selection: n })), !0);
2701
+ };
2702
+ function Ps(i, e) {
2703
+ let { main: t, ranges: n } = i.selection, l = i.wordAt(t.head), s = l && l.from == t.from && l.to == t.to;
2704
+ for (let o = !1, r = new ut(i.doc, e, n[n.length - 1].to); ; )
2705
+ if (r.next(), r.done) {
2706
+ if (o)
2707
+ return null;
2708
+ r = new ut(i.doc, e, 0, Math.max(0, n[n.length - 1].from - 1)), o = !0;
2709
+ } else {
2710
+ if (o && n.some((c) => c.from == r.value.from))
2711
+ continue;
2712
+ if (s) {
2713
+ let c = i.wordAt(r.value.from);
2714
+ if (!c || c.from != r.value.from || c.to != r.value.to)
2715
+ continue;
2716
+ }
2717
+ return r.value;
2718
+ }
2719
+ }
2720
+ const $s = ({ state: i, dispatch: e }) => {
2721
+ let { ranges: t } = i.selection;
2722
+ if (t.some((s) => s.from === s.to))
2723
+ return Bs({ state: i, dispatch: e });
2724
+ let n = i.sliceDoc(t[0].from, t[0].to);
2725
+ if (i.selection.ranges.some((s) => i.sliceDoc(s.from, s.to) != n))
2726
+ return !1;
2727
+ let l = Ps(i, n);
2728
+ return l ? (e(i.update({
2729
+ selection: i.selection.addRange(De.range(l.from, l.to), !1),
2730
+ effects: Ee.scrollIntoView(l.to)
2731
+ })), !0) : !1;
2732
+ }, dt = /* @__PURE__ */ Jt.define({
2733
+ combine(i) {
2734
+ return Qt(i, {
2735
+ top: !1,
2736
+ caseSensitive: !1,
2737
+ literal: !1,
2738
+ regexp: !1,
2739
+ wholeWord: !1,
2740
+ createPanel: (e) => new Zs(e),
2741
+ scrollToMatch: (e) => Ee.scrollIntoView(e)
2742
+ });
2743
+ }
2744
+ });
2745
+ class Gn {
2746
+ /**
2747
+ Create a query object.
2748
+ */
2749
+ constructor(e) {
2750
+ 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 || ks(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord, this.test = e.test;
2751
+ }
2752
+ /**
2753
+ @internal
2754
+ */
2755
+ unquote(e) {
2756
+ return this.literal ? e : e.replace(/\\([nrt\\])/g, (t, n) => n == "n" ? `
2757
+ ` : n == "r" ? "\r" : n == "t" ? " " : "\\");
2758
+ }
2759
+ /**
2760
+ Compare this query to another query.
2761
+ */
2762
+ eq(e) {
2763
+ 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;
2764
+ }
2765
+ /**
2766
+ @internal
2767
+ */
2768
+ create() {
2769
+ return this.regexp ? new zs(this) : new Ws(this);
2770
+ }
2771
+ /**
2772
+ Get a search cursor for this query, searching through the given
2773
+ range in the given state.
2774
+ */
2775
+ getCursor(e, t = 0, n) {
2776
+ let l = e.doc ? e : Lt.create({ doc: e });
2777
+ return n == null && (n = l.doc.length), this.regexp ? rt(this, l, t, n) : at(this, l, t, n);
2778
+ }
2779
+ }
2780
+ class Kn {
2781
+ constructor(e) {
2782
+ this.spec = e;
2783
+ }
2784
+ }
2785
+ function Vs(i, e, t) {
2786
+ return (n, l, s, o) => {
2787
+ if (t && !t(n, l, s, o))
2788
+ return !1;
2789
+ let r = n >= o && l <= o + s.length ? s.slice(n - o, l - o) : e.doc.sliceString(n, l);
2790
+ return i(r, e, n, l);
2791
+ };
2792
+ }
2793
+ function at(i, e, t, n) {
2794
+ let l;
2795
+ return i.wholeWord && (l = js(e.doc, e.charCategorizer(e.selection.main.head))), i.test && (l = Vs(i.test, e, l)), new ut(e.doc, i.unquoted, t, n, i.caseSensitive ? void 0 : (s) => s.toLowerCase(), l);
2796
+ }
2797
+ function js(i, e) {
2798
+ return (t, n, l, s) => ((s > t || s + l.length < n) && (s = Math.max(0, t - 2), l = i.sliceString(s, Math.min(i.length, n + 2))), (e(Tt(l, t - s)) != Ce.Word || e(Ot(l, t - s)) != Ce.Word) && (e(Ot(l, n - s)) != Ce.Word || e(Tt(l, n - s)) != Ce.Word));
2799
+ }
2800
+ class Ws extends Kn {
2801
+ constructor(e) {
2802
+ super(e);
2803
+ }
2804
+ nextMatch(e, t, n) {
2805
+ let l = at(this.spec, e, n, e.doc.length).nextOverlapping();
2806
+ if (l.done) {
2807
+ let s = Math.min(e.doc.length, t + this.spec.unquoted.length);
2808
+ l = at(this.spec, e, 0, s).nextOverlapping();
2809
+ }
2810
+ return l.done || l.value.from == t && l.value.to == n ? null : l.value;
2811
+ }
2812
+ // Searching in reverse is, rather than implementing an inverted search
2813
+ // cursor, done by scanning chunk after chunk forward.
2814
+ prevMatchInRange(e, t, n) {
2815
+ for (let l = n; ; ) {
2816
+ let s = Math.max(t, l - 1e4 - this.spec.unquoted.length), o = at(this.spec, e, s, l), r = null;
2817
+ for (; !o.nextOverlapping().done; )
2818
+ r = o.value;
2819
+ if (r)
2820
+ return r;
2821
+ if (s == t)
2822
+ return null;
2823
+ l -= 1e4;
2824
+ }
2825
+ }
2826
+ prevMatch(e, t, n) {
2827
+ let l = this.prevMatchInRange(e, 0, t);
2828
+ return l || (l = this.prevMatchInRange(e, Math.max(0, n - this.spec.unquoted.length), e.doc.length)), l && (l.from != t || l.to != n) ? l : null;
2829
+ }
2830
+ getReplacement(e) {
2831
+ return this.spec.unquote(this.spec.replace);
2832
+ }
2833
+ matchAll(e, t) {
2834
+ let n = at(this.spec, e, 0, e.doc.length), l = [];
2835
+ for (; !n.next().done; ) {
2836
+ if (l.length >= t)
2837
+ return null;
2838
+ l.push(n.value);
2839
+ }
2840
+ return l;
2841
+ }
2842
+ highlight(e, t, n, l) {
2843
+ let s = at(this.spec, e, Math.max(0, t - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length));
2844
+ for (; !s.next().done; )
2845
+ l(s.value.from, s.value.to);
2846
+ }
2847
+ }
2848
+ function Us(i, e, t) {
2849
+ return (n, l, s) => (!t || t(n, l, s)) && i(s[0], e, n, l);
2850
+ }
2851
+ function rt(i, e, t, n) {
2852
+ let l;
2853
+ return i.wholeWord && (l = Hs(e.charCategorizer(e.selection.main.head))), i.test && (l = Us(i.test, e, l)), new zn(e.doc, i.search, { ignoreCase: !i.caseSensitive, test: l }, t, n);
2854
+ }
2855
+ function Tt(i, e) {
2856
+ return i.slice($n(i, e, !1), e);
2857
+ }
2858
+ function Ot(i, e) {
2859
+ return i.slice(e, $n(i, e));
2860
+ }
2861
+ function Hs(i) {
2862
+ return (e, t, n) => !n[0].length || (i(Tt(n.input, n.index)) != Ce.Word || i(Ot(n.input, n.index)) != Ce.Word) && (i(Ot(n.input, n.index + n[0].length)) != Ce.Word || i(Tt(n.input, n.index + n[0].length)) != Ce.Word);
2863
+ }
2864
+ class zs extends Kn {
2865
+ nextMatch(e, t, n) {
2866
+ let l = rt(this.spec, e, n, e.doc.length).next();
2867
+ return l.done && (l = rt(this.spec, e, 0, t).next()), l.done ? null : l.value;
2868
+ }
2869
+ prevMatchInRange(e, t, n) {
2870
+ for (let l = 1; ; l++) {
2871
+ let s = Math.max(
2872
+ t,
2873
+ n - l * 1e4
2874
+ /* FindPrev.ChunkSize */
2875
+ ), o = rt(this.spec, e, s, n), r = null;
2876
+ for (; !o.next().done; )
2877
+ r = o.value;
2878
+ if (r && (s == t || r.from > s + 10))
2879
+ return r;
2880
+ if (s == t)
2881
+ return null;
2882
+ }
2883
+ }
2884
+ prevMatch(e, t, n) {
2885
+ return this.prevMatchInRange(e, 0, t) || this.prevMatchInRange(e, n, e.doc.length);
2886
+ }
2887
+ getReplacement(e) {
2888
+ return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g, (t, n) => {
2889
+ if (n == "&")
2890
+ return e.match[0];
2891
+ if (n == "$")
2892
+ return "$";
2893
+ for (let l = n.length; l > 0; l--) {
2894
+ let s = +n.slice(0, l);
2895
+ if (s > 0 && s < e.match.length)
2896
+ return e.match[s] + n.slice(l);
2897
+ }
2898
+ return t;
2899
+ });
2900
+ }
2901
+ matchAll(e, t) {
2902
+ let n = rt(this.spec, e, 0, e.doc.length), l = [];
2903
+ for (; !n.next().done; ) {
2904
+ if (l.length >= t)
2905
+ return null;
2906
+ l.push(n.value);
2907
+ }
2908
+ return l;
2909
+ }
2910
+ highlight(e, t, n, l) {
2911
+ let s = rt(this.spec, e, Math.max(
2912
+ 0,
2913
+ t - 250
2914
+ /* RegExp.HighlightMargin */
2915
+ ), Math.min(n + 250, e.doc.length));
2916
+ for (; !s.next().done; )
2917
+ l(s.value.from, s.value.to);
2918
+ }
2919
+ }
2920
+ const pt = /* @__PURE__ */ Qe.define(), en = /* @__PURE__ */ Qe.define(), Ue = /* @__PURE__ */ Bn.define({
2921
+ create(i) {
2922
+ return new Xt(qt(i).create(), null);
2923
+ },
2924
+ update(i, e) {
2925
+ for (let t of e.effects)
2926
+ t.is(pt) ? i = new Xt(t.value.create(), i.panel) : t.is(en) && (i = new Xt(i.query, t.value ? tn : null));
2927
+ return i;
2928
+ },
2929
+ provide: (i) => jn.from(i, (e) => e.panel)
2930
+ });
2931
+ class Xt {
2932
+ constructor(e, t) {
2933
+ this.query = e, this.panel = t;
2934
+ }
2935
+ }
2936
+ const Xs = /* @__PURE__ */ de.mark({ class: "cm-searchMatch" }), Gs = /* @__PURE__ */ de.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), Ks = /* @__PURE__ */ Vn.fromClass(class {
2937
+ constructor(i) {
2938
+ this.view = i, this.decorations = this.highlight(i.state.field(Ue));
2939
+ }
2940
+ update(i) {
2941
+ let e = i.state.field(Ue);
2942
+ (e != i.startState.field(Ue) || i.docChanged || i.selectionSet || i.viewportChanged) && (this.decorations = this.highlight(e));
2943
+ }
2944
+ highlight({ query: i, panel: e }) {
2945
+ if (!e || !i.spec.valid)
2946
+ return de.none;
2947
+ let { view: t } = this, n = new Pn();
2948
+ for (let l = 0, s = t.visibleRanges, o = s.length; l < o; l++) {
2949
+ let { from: r, to: c } = s[l];
2950
+ for (; l < o - 1 && c > s[l + 1].from - 500; )
2951
+ c = s[++l].to;
2952
+ i.highlight(t.state, r, c, (p, w) => {
2953
+ let m = t.state.selection.ranges.some((f) => f.from == p && f.to == w);
2954
+ n.add(p, w, m ? Gs : Xs);
2955
+ });
2956
+ }
2957
+ return n.finish();
2958
+ }
2959
+ }, {
2960
+ decorations: (i) => i.decorations
2961
+ });
2962
+ function bt(i) {
2963
+ return (e) => {
2964
+ let t = e.state.field(Ue, !1);
2965
+ return t && t.query.spec.valid ? i(e, t) : Qn(e);
2966
+ };
2967
+ }
2968
+ const At = /* @__PURE__ */ bt((i, { query: e }) => {
2969
+ let { to: t } = i.state.selection.main, n = e.nextMatch(i.state, t, t);
2970
+ if (!n)
2971
+ return !1;
2972
+ let l = De.single(n.from, n.to), s = i.state.facet(dt);
2973
+ return i.dispatch({
2974
+ selection: l,
2975
+ effects: [nn(i, n), s.scrollToMatch(l.main, i)],
2976
+ userEvent: "select.search"
2977
+ }), Jn(i), !0;
2978
+ }), Rt = /* @__PURE__ */ bt((i, { query: e }) => {
2979
+ let { state: t } = i, { from: n } = t.selection.main, l = e.prevMatch(t, n, n);
2980
+ if (!l)
2981
+ return !1;
2982
+ let s = De.single(l.from, l.to), o = i.state.facet(dt);
2983
+ return i.dispatch({
2984
+ selection: s,
2985
+ effects: [nn(i, l), o.scrollToMatch(s.main, i)],
2986
+ userEvent: "select.search"
2987
+ }), Jn(i), !0;
2988
+ }), qs = /* @__PURE__ */ bt((i, { query: e }) => {
2989
+ let t = e.matchAll(i.state, 1e3);
2990
+ return !t || !t.length ? !1 : (i.dispatch({
2991
+ selection: De.create(t.map((n) => De.range(n.from, n.to))),
2992
+ userEvent: "select.search.matches"
2993
+ }), !0);
2994
+ }), Js = ({ state: i, dispatch: e }) => {
2995
+ let t = i.selection;
2996
+ if (t.ranges.length > 1 || t.main.empty)
2997
+ return !1;
2998
+ let { from: n, to: l } = t.main, s = [], o = 0;
2999
+ for (let r = new ut(i.doc, i.sliceDoc(n, l)); !r.next().done; ) {
3000
+ if (s.length > 1e3)
3001
+ return !1;
3002
+ r.value.from == n && (o = s.length), s.push(De.range(r.value.from, r.value.to));
3003
+ }
3004
+ return e(i.update({
3005
+ selection: De.create(s, o),
3006
+ userEvent: "select.search.matches"
3007
+ })), !0;
3008
+ }, Dn = /* @__PURE__ */ bt((i, { query: e }) => {
3009
+ let { state: t } = i, { from: n, to: l } = t.selection.main;
3010
+ if (t.readOnly)
3011
+ return !1;
3012
+ let s = e.nextMatch(t, n, n);
3013
+ if (!s)
3014
+ return !1;
3015
+ let o = s, r = [], c, p, w = [];
3016
+ o.precise ? o.from == n && o.to == l && (p = t.toText(e.getReplacement(o)), r.push({ from: o.from, to: o.to, insert: p }), o = e.nextMatch(t, o.from, o.to), w.push(Ee.announce.of(t.phrase("replaced match on line $", t.doc.lineAt(n).number) + "."))) : o = e.nextMatch(t, o.from, o.to);
3017
+ let m = i.state.changes(r);
3018
+ return o && (c = De.single(o.from, o.to).map(m), w.push(nn(i, o)), w.push(t.facet(dt).scrollToMatch(c.main, i))), i.dispatch({
3019
+ changes: m,
3020
+ selection: c,
3021
+ effects: w,
3022
+ userEvent: "input.replace"
3023
+ }), !0;
3024
+ }), Qs = /* @__PURE__ */ bt((i, { query: e }) => {
3025
+ if (i.state.readOnly)
3026
+ return !1;
3027
+ let t = [];
3028
+ for (let l of e.matchAll(i.state, 1e9)) {
3029
+ let { from: s, to: o, precise: r } = l;
3030
+ r && t.push({ from: s, to: o, insert: e.getReplacement(l) });
3031
+ }
3032
+ if (!t.length)
3033
+ return !1;
3034
+ let n = i.state.phrase("replaced $ matches", t.length) + ".";
3035
+ return i.dispatch({
3036
+ changes: t,
3037
+ effects: Ee.announce.of(n),
3038
+ userEvent: "input.replace.all"
3039
+ }), !0;
3040
+ });
3041
+ function tn(i) {
3042
+ return i.state.facet(dt).createPanel(i);
3043
+ }
3044
+ function qt(i, e) {
3045
+ var t, n, l, s, o;
3046
+ let r = i.selection.main, c = r.empty || r.to > r.from + 100 ? "" : i.sliceDoc(r.from, r.to);
3047
+ if (e && !c)
3048
+ return e;
3049
+ let p = i.facet(dt);
3050
+ return new Gn({
3051
+ search: ((t = e == null ? void 0 : e.literal) !== null && t !== void 0 ? t : p.literal) ? c : c.replace(/\n/g, "\\n"),
3052
+ caseSensitive: (n = e == null ? void 0 : e.caseSensitive) !== null && n !== void 0 ? n : p.caseSensitive,
3053
+ literal: (l = e == null ? void 0 : e.literal) !== null && l !== void 0 ? l : p.literal,
3054
+ regexp: (s = e == null ? void 0 : e.regexp) !== null && s !== void 0 ? s : p.regexp,
3055
+ wholeWord: (o = e == null ? void 0 : e.wholeWord) !== null && o !== void 0 ? o : p.wholeWord
3056
+ });
3057
+ }
3058
+ function qn(i) {
3059
+ let e = Yt(i, tn);
3060
+ return e && e.dom.querySelector("[main-field]");
3061
+ }
3062
+ function Jn(i) {
3063
+ let e = qn(i);
3064
+ e && e == i.root.activeElement && e.select();
3065
+ }
3066
+ const Qn = (i) => {
3067
+ let e = i.state.field(Ue, !1);
3068
+ if (e && e.panel) {
3069
+ let t = qn(i);
3070
+ if (t && t != i.root.activeElement) {
3071
+ let n = qt(i.state, e.query.spec);
3072
+ n.valid && i.dispatch({ effects: pt.of(n) }), t.focus(), t.select();
3073
+ }
3074
+ } else
3075
+ i.dispatch({ effects: [
3076
+ en.of(!0),
3077
+ e ? pt.of(qt(i.state, e.query.spec)) : Qe.appendConfig.of(ta)
3078
+ ] });
3079
+ return !0;
3080
+ }, Yn = (i) => {
3081
+ let e = i.state.field(Ue, !1);
3082
+ if (!e || !e.panel)
3083
+ return !1;
3084
+ let t = Yt(i, tn);
3085
+ return t && t.dom.contains(i.root.activeElement) && i.focus(), i.dispatch({ effects: en.of(!1) }), !0;
3086
+ }, Ys = [
3087
+ { key: "Mod-f", run: Qn, scope: "editor search-panel" },
3088
+ { key: "F3", run: At, shift: Rt, scope: "editor search-panel", preventDefault: !0 },
3089
+ { key: "Mod-g", run: At, shift: Rt, scope: "editor search-panel", preventDefault: !0 },
3090
+ { key: "Escape", run: Yn, scope: "editor search-panel" },
3091
+ { key: "Mod-Shift-l", run: Js },
3092
+ { key: "Mod-Alt-g", run: Ns },
3093
+ { key: "Mod-d", run: $s, preventDefault: !0 }
3094
+ ];
3095
+ class Zs {
3096
+ constructor(e) {
3097
+ this.view = e;
3098
+ let t = this.query = e.state.field(Ue).query.spec;
3099
+ this.commit = this.commit.bind(this), this.searchField = le("input", {
3100
+ value: t.search,
3101
+ placeholder: xe(e, "Find"),
3102
+ "aria-label": xe(e, "Find"),
3103
+ class: "cm-textfield",
3104
+ name: "search",
3105
+ form: "",
3106
+ "main-field": "true",
3107
+ onchange: this.commit,
3108
+ onkeyup: this.commit
3109
+ }), this.replaceField = le("input", {
3110
+ value: t.replace,
3111
+ placeholder: xe(e, "Replace"),
3112
+ "aria-label": xe(e, "Replace"),
3113
+ class: "cm-textfield",
3114
+ name: "replace",
3115
+ form: "",
3116
+ onchange: this.commit,
3117
+ onkeyup: this.commit
3118
+ }), this.caseField = le("input", {
3119
+ type: "checkbox",
3120
+ name: "case",
3121
+ form: "",
3122
+ checked: t.caseSensitive,
3123
+ onchange: this.commit
3124
+ }), this.reField = le("input", {
3125
+ type: "checkbox",
3126
+ name: "re",
3127
+ form: "",
3128
+ checked: t.regexp,
3129
+ onchange: this.commit
3130
+ }), this.wordField = le("input", {
3131
+ type: "checkbox",
3132
+ name: "word",
3133
+ form: "",
3134
+ checked: t.wholeWord,
3135
+ onchange: this.commit
3136
+ });
3137
+ function n(l, s, o) {
3138
+ return le("button", { class: "cm-button", name: l, onclick: s, type: "button" }, o);
3139
+ }
3140
+ this.dom = le("div", { onkeydown: (l) => this.keydown(l), class: "cm-search" }, [
3141
+ this.searchField,
3142
+ n("next", () => At(e), [xe(e, "next")]),
3143
+ n("prev", () => Rt(e), [xe(e, "previous")]),
3144
+ n("select", () => qs(e), [xe(e, "all")]),
3145
+ le("label", null, [this.caseField, xe(e, "match case")]),
3146
+ le("label", null, [this.reField, xe(e, "regexp")]),
3147
+ le("label", null, [this.wordField, xe(e, "by word")]),
3148
+ ...e.state.readOnly ? [] : [
3149
+ le("br"),
3150
+ this.replaceField,
3151
+ n("replace", () => Dn(e), [xe(e, "replace")]),
3152
+ n("replaceAll", () => Qs(e), [xe(e, "replace all")])
3153
+ ],
3154
+ le("button", {
3155
+ name: "close",
3156
+ onclick: () => Yn(e),
3157
+ "aria-label": xe(e, "close"),
3158
+ type: "button"
3159
+ }, ["×"])
3160
+ ]);
3161
+ }
3162
+ commit() {
3163
+ let e = new Gn({
3164
+ search: this.searchField.value,
3165
+ caseSensitive: this.caseField.checked,
3166
+ regexp: this.reField.checked,
3167
+ wholeWord: this.wordField.checked,
3168
+ replace: this.replaceField.value
3169
+ });
3170
+ e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: pt.of(e) }));
3171
+ }
3172
+ keydown(e) {
3173
+ el(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? Rt : At)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), Dn(this.view));
3174
+ }
3175
+ update(e) {
3176
+ for (let t of e.transactions)
3177
+ for (let n of t.effects)
3178
+ n.is(pt) && !n.value.eq(this.query) && this.setQuery(n.value);
3179
+ }
3180
+ setQuery(e) {
3181
+ 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;
3182
+ }
3183
+ mount() {
3184
+ this.searchField.select();
3185
+ }
3186
+ get pos() {
3187
+ return 80;
3188
+ }
3189
+ get top() {
3190
+ return this.view.state.facet(dt).top;
3191
+ }
3192
+ }
3193
+ function xe(i, e) {
3194
+ return i.state.phrase(e);
3195
+ }
3196
+ const Ct = 30, kt = /[\s\.,:;?!]/;
3197
+ function nn(i, { from: e, to: t }) {
3198
+ let n = i.state.doc.lineAt(e), l = i.state.doc.lineAt(t).to, s = Math.max(n.from, e - Ct), o = Math.min(l, t + Ct), r = i.state.sliceDoc(s, o);
3199
+ if (s != n.from) {
3200
+ for (let c = 0; c < Ct; c++)
3201
+ if (!kt.test(r[c + 1]) && kt.test(r[c])) {
3202
+ r = r.slice(c);
3203
+ break;
3204
+ }
3205
+ }
3206
+ if (o != l) {
3207
+ for (let c = r.length - 1; c > r.length - Ct; c--)
3208
+ if (!kt.test(r[c - 1]) && kt.test(r[c])) {
3209
+ r = r.slice(0, c);
3210
+ break;
3211
+ }
3212
+ }
3213
+ return Ee.announce.of(`${i.state.phrase("current match")}. ${r} ${i.state.phrase("on line")} ${n.number}.`);
3214
+ }
3215
+ const ea = /* @__PURE__ */ Ee.baseTheme({
3216
+ ".cm-panel.cm-search": {
3217
+ padding: "2px 6px 4px",
3218
+ position: "relative",
3219
+ "& [name=close]": {
3220
+ position: "absolute",
3221
+ top: "0",
3222
+ right: "4px",
3223
+ backgroundColor: "inherit",
3224
+ border: "none",
3225
+ font: "inherit",
3226
+ padding: 0,
3227
+ margin: 0
3228
+ },
3229
+ "& input, & button, & label": {
3230
+ margin: ".2em .6em .2em 0"
3231
+ },
3232
+ "& input[type=checkbox]": {
3233
+ marginRight: ".2em"
3234
+ },
3235
+ "& label": {
3236
+ fontSize: "80%",
3237
+ whiteSpace: "pre"
3238
+ }
3239
+ },
3240
+ "&light .cm-searchMatch": { backgroundColor: "#ffff0054" },
3241
+ "&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
3242
+ "&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
3243
+ "&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
3244
+ }), ta = [
3245
+ Ue,
3246
+ /* @__PURE__ */ Ki.low(Ks),
3247
+ ea
3248
+ ];
3249
+ class Tn {
3250
+ constructor(e, t, n) {
3251
+ this.from = e, this.to = t, this.diagnostic = n;
3252
+ }
3253
+ }
3254
+ class qe {
3255
+ constructor(e, t, n) {
3256
+ this.diagnostics = e, this.panel = t, this.selected = n;
3257
+ }
3258
+ static init(e, t, n) {
3259
+ let l = n.facet(mt).markerFilter;
3260
+ l && (e = l(e, n));
3261
+ let s = e.slice().sort((N, D) => N.from - D.from || N.to - D.to), o = new Pn(), r = [], c = 0, p = n.doc.iter(), w = 0, m = n.doc.length;
3262
+ for (let N = 0; ; ) {
3263
+ let D = N == s.length ? null : s[N];
3264
+ if (!D && !r.length)
3265
+ break;
3266
+ let R, U;
3267
+ if (r.length)
3268
+ R = c, U = r.reduce((S, O) => Math.min(S, O.to), D && D.from > R ? D.from : 1e8);
3269
+ else {
3270
+ if (R = D.from, R > m)
3271
+ break;
3272
+ U = D.to, r.push(D), N++;
3273
+ }
3274
+ for (; N < s.length; ) {
3275
+ let S = s[N];
3276
+ if (S.from == R && (S.to > S.from || S.to == R))
3277
+ r.push(S), N++, U = Math.min(S.to, U);
3278
+ else {
3279
+ U = Math.min(S.from, U);
3280
+ break;
3281
+ }
3282
+ }
3283
+ U = Math.min(U, m);
3284
+ let G = !1;
3285
+ if (r.some((S) => S.from == R && (S.to == U || U == m)) && (G = R == U, !G && U - R < 10)) {
3286
+ let S = R - (w + p.value.length);
3287
+ S > 0 && (p.next(S), w = R);
3288
+ for (let O = R; ; ) {
3289
+ if (O >= U) {
3290
+ G = !0;
3291
+ break;
3292
+ }
3293
+ if (!p.lineBreak && w + p.value.length > O)
3294
+ break;
3295
+ O = w + p.value.length, w += p.value.length, p.next();
3296
+ }
3297
+ }
3298
+ let K = ga(r);
3299
+ if (G)
3300
+ o.add(R, R, de.widget({
3301
+ widget: new ua(K),
3302
+ diagnostics: r.slice()
3303
+ }));
3304
+ else {
3305
+ let S = r.reduce((O, ee) => ee.markClass ? O + " " + ee.markClass : O, "");
3306
+ o.add(R, U, de.mark({
3307
+ class: "cm-lintRange cm-lintRange-" + K + S,
3308
+ diagnostics: r.slice(),
3309
+ inclusiveEnd: r.some((O) => O.to > U)
3310
+ }));
3311
+ }
3312
+ if (c = U, c == m)
3313
+ break;
3314
+ for (let S = 0; S < r.length; S++)
3315
+ r[S].to <= c && r.splice(S--, 1);
3316
+ }
3317
+ let f = o.finish();
3318
+ return new qe(f, t, ze(f));
3319
+ }
3320
+ }
3321
+ function ze(i, e = null, t = 0) {
3322
+ let n = null;
3323
+ return i.between(t, 1e9, (l, s, { spec: o }) => {
3324
+ if (!(e && o.diagnostics.indexOf(e) < 0))
3325
+ if (!n)
3326
+ n = new Tn(l, s, e || o.diagnostics[0]);
3327
+ else {
3328
+ if (o.diagnostics.indexOf(n.diagnostic) < 0)
3329
+ return !1;
3330
+ n = new Tn(n.from, s, n.diagnostic);
3331
+ }
3332
+ }), n;
3333
+ }
3334
+ function na(i, e) {
3335
+ let t = e.pos, n = e.end || t, l = i.state.facet(mt).hideOn(i, t, n);
3336
+ if (l != null)
3337
+ return l;
3338
+ let s = i.startState.doc.lineAt(e.pos);
3339
+ return !!(i.effects.some((o) => o.is(Zn)) || i.changes.touchesRange(s.from, Math.max(s.to, n)));
3340
+ }
3341
+ function ia(i, e) {
3342
+ return i.field(Se, !1) ? e : e.concat(Qe.appendConfig.of(pa));
3343
+ }
3344
+ const Zn = /* @__PURE__ */ Qe.define(), ln = /* @__PURE__ */ Qe.define(), ei = /* @__PURE__ */ Qe.define(), Se = /* @__PURE__ */ Bn.define({
3345
+ create() {
3346
+ return new qe(de.none, null, null);
3347
+ },
3348
+ update(i, e) {
3349
+ if (e.docChanged && i.diagnostics.size) {
3350
+ let t = i.diagnostics.map(e.changes), n = null, l = i.panel;
3351
+ if (i.selected) {
3352
+ let s = e.changes.mapPos(i.selected.from, 1);
3353
+ n = ze(t, i.selected.diagnostic, s) || ze(t, null, s);
3354
+ }
3355
+ !t.size && l && e.state.facet(mt).autoPanel && (l = null), i = new qe(t, l, n);
3356
+ }
3357
+ for (let t of e.effects)
3358
+ if (t.is(Zn)) {
3359
+ let n = e.state.facet(mt).autoPanel ? t.value.length ? vt.open : null : i.panel;
3360
+ i = qe.init(t.value, n, e.state);
3361
+ } else t.is(ln) ? i = new qe(i.diagnostics, t.value ? vt.open : null, i.selected) : t.is(ei) && (i = new qe(i.diagnostics, i.panel, t.value));
3362
+ return i;
3363
+ },
3364
+ provide: (i) => [
3365
+ jn.from(i, (e) => e.panel),
3366
+ Ee.decorations.from(i, (e) => e.diagnostics)
3367
+ ]
3368
+ }), la = /* @__PURE__ */ de.mark({ class: "cm-lintRange cm-lintRange-active" });
3369
+ function sa(i, e, t) {
3370
+ let { diagnostics: n } = i.state.field(Se), l, s = -1, o = -1;
3371
+ n.between(e - (t < 0 ? 1 : 0), e + (t > 0 ? 1 : 0), (c, p, { spec: w }) => {
3372
+ if (e >= c && e <= p && (c == p || (e > c || t > 0) && (e < p || t < 0)))
3373
+ return l = w.diagnostics, s = c, o = p, !1;
3374
+ });
3375
+ let r = i.state.facet(mt).tooltipFilter;
3376
+ return l && r && (l = r(l, i.state)), l ? {
3377
+ pos: s,
3378
+ end: o,
3379
+ above: !0,
3380
+ create() {
3381
+ return { dom: aa(i, l) };
3382
+ }
3383
+ } : null;
3384
+ }
3385
+ function aa(i, e) {
3386
+ return le("ul", { class: "cm-tooltip-lint" }, e.map((t) => ni(i, t, !1)));
3387
+ }
3388
+ const ra = (i) => {
3389
+ let e = i.state.field(Se, !1);
3390
+ (!e || !e.panel) && i.dispatch({ effects: ia(i.state, [ln.of(!0)]) });
3391
+ let t = Yt(i, vt.open);
3392
+ return t && t.dom.querySelector(".cm-panel-lint ul").focus(), !0;
3393
+ }, On = (i) => {
3394
+ let e = i.state.field(Se, !1);
3395
+ return !e || !e.panel ? !1 : (i.dispatch({ effects: ln.of(!1) }), !0);
3396
+ }, oa = (i) => {
3397
+ let e = i.state.field(Se, !1);
3398
+ if (!e)
3399
+ return !1;
3400
+ let t = i.state.selection.main, n = ze(e.diagnostics, null, t.to + 1);
3401
+ return !n && (n = ze(e.diagnostics, null, 0), !n || n.from == t.from && n.to == t.to) ? !1 : (i.dispatch({ selection: { anchor: n.from, head: n.to }, scrollIntoView: !0 }), tl(i, n.from, 1, {
3402
+ tooltip: ii,
3403
+ until: (l) => l.docChanged || l.newSelection.main.head < n.from || l.newSelection.main.head > n.to
3404
+ }), !0);
3405
+ }, ca = [
3406
+ { key: "Mod-Shift-m", run: ra, preventDefault: !0 },
3407
+ { key: "F8", run: oa }
3408
+ ], mt = /* @__PURE__ */ Jt.define({
3409
+ combine(i) {
3410
+ return {
3411
+ sources: i.map((e) => e.source).filter((e) => e != null),
3412
+ ...Qt(i.map((e) => e.config), {
3413
+ delay: 750,
3414
+ markerFilter: null,
3415
+ tooltipFilter: null,
3416
+ needsRefresh: null,
3417
+ hideOn: () => null
3418
+ }, {
3419
+ delay: Math.max,
3420
+ markerFilter: An,
3421
+ tooltipFilter: An,
3422
+ needsRefresh: (e, t) => e ? t ? (n) => e(n) || t(n) : e : t,
3423
+ hideOn: (e, t) => e ? t ? (n, l, s) => e(n, l, s) || t(n, l, s) : e : t,
3424
+ autoPanel: (e, t) => e || t
3425
+ })
3426
+ };
3427
+ }
3428
+ });
3429
+ function An(i, e) {
3430
+ return i ? e ? (t, n) => e(i(t, n), n) : i : e;
3431
+ }
3432
+ function ti(i) {
3433
+ let e = [];
3434
+ if (i)
3435
+ e: for (let { name: t } of i) {
3436
+ for (let n = 0; n < t.length; n++) {
3437
+ let l = t[n];
3438
+ if (/[a-zA-Z]/.test(l) && !e.some((s) => s.toLowerCase() == l.toLowerCase())) {
3439
+ e.push(l);
3440
+ continue e;
3441
+ }
3442
+ }
3443
+ e.push("");
3444
+ }
3445
+ return e;
3446
+ }
3447
+ function ni(i, e, t) {
3448
+ var n;
3449
+ let l = t ? ti(e.actions) : [];
3450
+ return le("li", { class: "cm-diagnostic cm-diagnostic-" + e.severity }, le("span", { class: "cm-diagnosticText" }, e.renderMessage ? e.renderMessage(i) : e.message), (n = e.actions) === null || n === void 0 ? void 0 : n.map((s, o) => {
3451
+ let r = !1, c = (N) => {
3452
+ if (N.preventDefault(), r)
3453
+ return;
3454
+ r = !0;
3455
+ let D = ze(i.state.field(Se).diagnostics, e);
3456
+ D && s.apply(i, D.from, D.to);
3457
+ }, { name: p } = s, w = l[o] ? p.indexOf(l[o]) : -1, m = w < 0 ? p : [
3458
+ p.slice(0, w),
3459
+ le("u", p.slice(w, w + 1)),
3460
+ p.slice(w + 1)
3461
+ ], f = s.markClass ? " " + s.markClass : "";
3462
+ return le("button", {
3463
+ type: "button",
3464
+ class: "cm-diagnosticAction" + f,
3465
+ onclick: c,
3466
+ onmousedown: c,
3467
+ "aria-label": ` Action: ${p}${w < 0 ? "" : ` (access key "${l[o]})"`}.`
3468
+ }, m);
3469
+ }), e.source && le("div", { class: "cm-diagnosticSource" }, e.source));
3470
+ }
3471
+ class ua extends il {
3472
+ constructor(e) {
3473
+ super(), this.sev = e;
3474
+ }
3475
+ eq(e) {
3476
+ return e.sev == this.sev;
3477
+ }
3478
+ toDOM() {
3479
+ return le("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
3480
+ }
3481
+ }
3482
+ class Rn {
3483
+ constructor(e, t) {
3484
+ this.diagnostic = t, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = ni(e, t, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
3485
+ }
3486
+ }
3487
+ class vt {
3488
+ constructor(e) {
3489
+ this.view = e, this.items = [];
3490
+ let t = (l) => {
3491
+ if (!(l.ctrlKey || l.altKey || l.metaKey)) {
3492
+ if (l.keyCode == 27)
3493
+ On(this.view), this.view.focus();
3494
+ else if (l.keyCode == 38 || l.keyCode == 33)
3495
+ this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
3496
+ else if (l.keyCode == 40 || l.keyCode == 34)
3497
+ this.moveSelection((this.selectedIndex + 1) % this.items.length);
3498
+ else if (l.keyCode == 36)
3499
+ this.moveSelection(0);
3500
+ else if (l.keyCode == 35)
3501
+ this.moveSelection(this.items.length - 1);
3502
+ else if (l.keyCode == 13)
3503
+ this.view.focus();
3504
+ else if (l.keyCode >= 65 && l.keyCode <= 90 && this.selectedIndex >= 0) {
3505
+ let { diagnostic: s } = this.items[this.selectedIndex], o = ti(s.actions);
3506
+ for (let r = 0; r < o.length; r++)
3507
+ if (o[r].toUpperCase().charCodeAt(0) == l.keyCode) {
3508
+ let c = ze(this.view.state.field(Se).diagnostics, s);
3509
+ c && s.actions[r].apply(e, c.from, c.to);
3510
+ }
3511
+ } else
3512
+ return;
3513
+ l.preventDefault();
3514
+ }
3515
+ }, n = (l) => {
3516
+ for (let s = 0; s < this.items.length; s++)
3517
+ this.items[s].dom.contains(l.target) && this.moveSelection(s);
3518
+ };
3519
+ this.list = le("ul", {
3520
+ tabIndex: 0,
3521
+ role: "listbox",
3522
+ "aria-label": this.view.state.phrase("Diagnostics"),
3523
+ onkeydown: t,
3524
+ onclick: n
3525
+ }), this.dom = le("div", { class: "cm-panel-lint" }, this.list, le("button", {
3526
+ type: "button",
3527
+ name: "close",
3528
+ "aria-label": this.view.state.phrase("close"),
3529
+ onclick: () => On(this.view)
3530
+ }, "×")), this.update();
3531
+ }
3532
+ get selectedIndex() {
3533
+ let e = this.view.state.field(Se).selected;
3534
+ if (!e)
3535
+ return -1;
3536
+ for (let t = 0; t < this.items.length; t++)
3537
+ if (this.items[t].diagnostic == e.diagnostic)
3538
+ return t;
3539
+ return -1;
3540
+ }
3541
+ update() {
3542
+ let { diagnostics: e, selected: t } = this.view.state.field(Se), n = 0, l = !1, s = null, o = /* @__PURE__ */ new Set();
3543
+ for (e.between(0, this.view.state.doc.length, (r, c, { spec: p }) => {
3544
+ for (let w of p.diagnostics) {
3545
+ if (o.has(w))
3546
+ continue;
3547
+ o.add(w);
3548
+ let m = -1, f;
3549
+ for (let N = n; N < this.items.length; N++)
3550
+ if (this.items[N].diagnostic == w) {
3551
+ m = N;
3552
+ break;
3553
+ }
3554
+ m < 0 ? (f = new Rn(this.view, w), this.items.splice(n, 0, f), l = !0) : (f = this.items[m], m > n && (this.items.splice(n, m - n), l = !0)), t && f.diagnostic == t.diagnostic ? f.dom.hasAttribute("aria-selected") || (f.dom.setAttribute("aria-selected", "true"), s = f) : f.dom.hasAttribute("aria-selected") && f.dom.removeAttribute("aria-selected"), n++;
3555
+ }
3556
+ }); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); )
3557
+ l = !0, this.items.pop();
3558
+ this.items.length == 0 && (this.items.push(new Rn(this.view, {
3559
+ from: -1,
3560
+ to: -1,
3561
+ severity: "info",
3562
+ message: this.view.state.phrase("No diagnostics")
3563
+ })), l = !0), s ? (this.list.setAttribute("aria-activedescendant", s.id), this.view.requestMeasure({
3564
+ key: this,
3565
+ read: () => ({ sel: s.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }),
3566
+ write: ({ sel: r, panel: c }) => {
3567
+ let p = c.height / this.list.offsetHeight;
3568
+ r.top < c.top ? this.list.scrollTop -= (c.top - r.top) / p : r.bottom > c.bottom && (this.list.scrollTop += (r.bottom - c.bottom) / p);
3569
+ }
3570
+ })) : this.selectedIndex < 0 && this.list.removeAttribute("aria-activedescendant"), l && this.sync();
3571
+ }
3572
+ sync() {
3573
+ let e = this.list.firstChild;
3574
+ function t() {
3575
+ let n = e;
3576
+ e = n.nextSibling, n.remove();
3577
+ }
3578
+ for (let n of this.items)
3579
+ if (n.dom.parentNode == this.list) {
3580
+ for (; e != n.dom; )
3581
+ t();
3582
+ e = n.dom.nextSibling;
3583
+ } else
3584
+ this.list.insertBefore(n.dom, e);
3585
+ for (; e; )
3586
+ t();
3587
+ }
3588
+ moveSelection(e) {
3589
+ if (this.selectedIndex < 0)
3590
+ return;
3591
+ let t = this.view.state.field(Se), n = ze(t.diagnostics, this.items[e].diagnostic);
3592
+ n && this.view.dispatch({
3593
+ selection: { anchor: n.from, head: n.to },
3594
+ scrollIntoView: !0,
3595
+ effects: ei.of(n)
3596
+ });
3597
+ }
3598
+ static open(e) {
3599
+ return new vt(e);
3600
+ }
3601
+ }
3602
+ function da(i, e = 'viewBox="0 0 40 40"') {
3603
+ return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`;
3604
+ }
3605
+ function Nt(i) {
3606
+ return da(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`, 'width="6" height="3"');
3607
+ }
3608
+ const fa = /* @__PURE__ */ Ee.baseTheme({
3609
+ ".cm-diagnostic": {
3610
+ padding: "3px 6px 3px 8px",
3611
+ marginLeft: "-1px",
3612
+ display: "block",
3613
+ whiteSpace: "pre-wrap"
3614
+ },
3615
+ ".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
3616
+ ".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
3617
+ ".cm-diagnostic-info": { borderLeft: "5px solid #999" },
3618
+ ".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
3619
+ ".cm-diagnosticAction": {
3620
+ font: "inherit",
3621
+ border: "none",
3622
+ padding: "2px 4px",
3623
+ backgroundColor: "#444",
3624
+ color: "white",
3625
+ borderRadius: "3px",
3626
+ marginLeft: "8px",
3627
+ cursor: "pointer"
3628
+ },
3629
+ ".cm-diagnosticSource": {
3630
+ fontSize: "70%",
3631
+ opacity: 0.7
3632
+ },
3633
+ ".cm-lintRange": {
3634
+ backgroundPosition: "left bottom",
3635
+ backgroundRepeat: "repeat-x",
3636
+ paddingBottom: "0.7px"
3637
+ },
3638
+ ".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ Nt("#f11") },
3639
+ ".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ Nt("orange") },
3640
+ ".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ Nt("#999") },
3641
+ ".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ Nt("#66d") },
3642
+ ".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
3643
+ ".cm-tooltip-lint": {
3644
+ padding: 0,
3645
+ margin: 0
3646
+ },
3647
+ ".cm-lintPoint": {
3648
+ position: "relative",
3649
+ "&:after": {
3650
+ content: '""',
3651
+ position: "absolute",
3652
+ bottom: 0,
3653
+ left: "-2px",
3654
+ borderLeft: "3px solid transparent",
3655
+ borderRight: "3px solid transparent",
3656
+ borderBottom: "4px solid #d11"
3657
+ }
3658
+ },
3659
+ ".cm-lintPoint-warning": {
3660
+ "&:after": { borderBottomColor: "orange" }
3661
+ },
3662
+ ".cm-lintPoint-info": {
3663
+ "&:after": { borderBottomColor: "#999" }
3664
+ },
3665
+ ".cm-lintPoint-hint": {
3666
+ "&:after": { borderBottomColor: "#66d" }
3667
+ },
3668
+ ".cm-panel.cm-panel-lint": {
3669
+ position: "relative",
3670
+ "& ul": {
3671
+ maxHeight: "100px",
3672
+ overflowY: "auto",
3673
+ "& [aria-selected]": {
3674
+ backgroundColor: "#ddd",
3675
+ "& u": { textDecoration: "underline" }
3676
+ },
3677
+ "&:focus [aria-selected]": {
3678
+ background_fallback: "#bdf",
3679
+ backgroundColor: "Highlight",
3680
+ color_fallback: "white",
3681
+ color: "HighlightText"
3682
+ },
3683
+ "& u": { textDecoration: "none" },
3684
+ padding: 0,
3685
+ margin: 0
3686
+ },
3687
+ "& [name=close]": {
3688
+ position: "absolute",
3689
+ top: "0",
3690
+ right: "2px",
3691
+ background: "inherit",
3692
+ border: "none",
3693
+ font: "inherit",
3694
+ padding: 0,
3695
+ margin: 0
3696
+ }
3697
+ },
3698
+ "&dark .cm-lintRange-active": { backgroundColor: "#86714a80" },
3699
+ "&dark .cm-panel.cm-panel-lint ul": {
3700
+ "& [aria-selected]": {
3701
+ backgroundColor: "#2e343e"
3702
+ }
3703
+ }
3704
+ });
3705
+ function ha(i) {
3706
+ return i == "error" ? 4 : i == "warning" ? 3 : i == "info" ? 2 : 1;
3707
+ }
3708
+ function ga(i) {
3709
+ let e = "hint", t = 1;
3710
+ for (let n of i) {
3711
+ let l = ha(n.severity);
3712
+ l > t && (t = l, e = n.severity);
3713
+ }
3714
+ return e;
3715
+ }
3716
+ const ii = /* @__PURE__ */ nl(sa, { hideOn: na }), pa = [
3717
+ Se,
3718
+ /* @__PURE__ */ Ee.decorations.compute([Se], (i) => {
3719
+ let { selected: e, panel: t } = i.field(Se);
3720
+ return !e || !t || e.from == e.to ? de.none : de.set([
3721
+ la.range(e.from, e.to)
3722
+ ]);
3723
+ }),
3724
+ ii,
3725
+ fa
3726
+ ], ma = { class: "script-editor" }, va = { class: "editor-header" }, ba = { class: "lang-badge" }, ya = {
3727
+ __name: "ScriptEditor",
3728
+ props: {
3729
+ /** 脚本内容 */
3730
+ modelValue: { type: String, default: "" },
3731
+ /** 语言标识 */
3732
+ language: { type: String, default: "groovy" },
3733
+ /** 是否只读 */
3734
+ readonly: { type: Boolean, default: !1 }
3735
+ },
3736
+ emits: ["update:modelValue"],
3737
+ setup(i, { expose: e, emit: t }) {
3738
+ const n = {
3739
+ javascript: null,
3740
+ python: null,
3741
+ java: null
3742
+ };
3743
+ let l = !1, s = !1;
3744
+ async function o() {
3745
+ if (!(s || l)) {
3746
+ l = !0;
3747
+ try {
3748
+ const [S, O, ee] = await Promise.all([
3749
+ import("@codemirror/lang-javascript"),
3750
+ import("@codemirror/lang-python"),
3751
+ import("@codemirror/lang-java")
3752
+ ]);
3753
+ n.javascript = S.javascript, n.python = O.python, n.java = ee.java, s = !0;
3754
+ } catch (S) {
3755
+ console.error("[ScriptEditor] 语言包加载失败:", S);
3756
+ } finally {
3757
+ l = !1;
3758
+ }
3759
+ }
3760
+ }
3761
+ const r = i, c = t, p = {
3762
+ groovy: "Groovy",
3763
+ java: "Java",
3764
+ js: "JavaScript",
3765
+ javascript: "JavaScript",
3766
+ python: "Python",
3767
+ lua: "Lua",
3768
+ QLExpress: "QLExpress"
3769
+ }, w = we(() => {
3770
+ const S = (r.language || "").toLowerCase();
3771
+ return p[S] || r.language || "Groovy";
3772
+ }), m = J(null), f = Gt(null), N = J(!1);
3773
+ function D(S) {
3774
+ switch ((S || "").toLowerCase()) {
3775
+ case "js":
3776
+ case "javascript":
3777
+ return n.javascript ? [n.javascript()] : [];
3778
+ case "python":
3779
+ return n.python ? [n.python()] : [];
3780
+ case "groovy":
3781
+ case "java":
3782
+ return n.java ? [n.java()] : [];
3783
+ // lua, QLExpress → text/plain(无额外扩展,仅有行号/缩进/撤销重做)
3784
+ default:
3785
+ return [];
3786
+ }
3787
+ }
3788
+ function R() {
3789
+ if (!m.value) return;
3790
+ f.value && (f.value.destroy(), f.value = null);
3791
+ const S = D(r.language), O = [
3792
+ // 基础功能
3793
+ ll(),
3794
+ sl(),
3795
+ al(),
3796
+ yl(),
3797
+ hl(),
3798
+ rl(),
3799
+ ol(),
3800
+ // 默认允许多光标(alt+click),但不启用矩形选区
3801
+ Lt.allowMultipleSelections.of(!0),
3802
+ gl(),
3803
+ pl(ml, { fallback: !0 }),
3804
+ vl(),
3805
+ El(),
3806
+ Ml(),
3807
+ cl(),
3808
+ ul(),
3809
+ dl(),
3810
+ Ts(),
3811
+ fl.of([
3812
+ ..._l,
3813
+ ...xl,
3814
+ ...Ys,
3815
+ ...wl,
3816
+ ...bl,
3817
+ ...Cl,
3818
+ ...ca,
3819
+ Sl
3820
+ ]),
3821
+ // 语言扩展
3822
+ ...S,
3823
+ // 内容变更回调
3824
+ Ee.updateListener.of((ge) => {
3825
+ if (ge.docChanged && !N.value) {
3826
+ const ve = ge.state.doc.toString();
3827
+ c("update:modelValue", ve);
3828
+ }
3829
+ })
3830
+ ];
3831
+ r.readonly && O.push(Lt.readOnly.of(!0));
3832
+ const ee = Lt.create({
3833
+ doc: r.modelValue || "",
3834
+ extensions: O
3835
+ }), ke = new Ee({
3836
+ state: ee,
3837
+ parent: m.value
3838
+ });
3839
+ f.value = ke;
3840
+ }
3841
+ function U() {
3842
+ return f.value ? f.value.state.doc.toString() : r.modelValue || "";
3843
+ }
3844
+ function G(S) {
3845
+ const O = S || "";
3846
+ if (!f.value) {
3847
+ c("update:modelValue", O);
3848
+ return;
3849
+ }
3850
+ N.value = !0;
3851
+ const ee = f.value, ke = ee.state.update({
3852
+ changes: {
3853
+ from: 0,
3854
+ to: ee.state.doc.length,
3855
+ insert: O
3856
+ }
3857
+ });
3858
+ ee.dispatch(ke), setTimeout(() => {
3859
+ N.value = !1;
3860
+ }, 50);
3861
+ }
3862
+ function K(S) {
3863
+ var ee;
3864
+ const O = U();
3865
+ (ee = f.value) == null || ee.destroy(), f.value = null, R(), f.value && G(O);
3866
+ }
3867
+ return In(async () => {
3868
+ await o(), R(), r.modelValue && f.value && G(r.modelValue);
3869
+ }), Fn(() => {
3870
+ f.value && (f.value.destroy(), f.value = null);
3871
+ }), ct(() => r.language, async (S) => {
3872
+ f.value && (await o(), K());
3873
+ }), ct(() => r.modelValue, (S) => {
3874
+ if (f.value && !N.value) {
3875
+ const O = f.value.state.doc.toString();
3876
+ S !== O && G(S);
3877
+ }
3878
+ }), e({
3879
+ getValue: U,
3880
+ setValue: G
3881
+ }), (S, O) => (X(), ie("div", ma, [
3882
+ L("div", va, [
3883
+ L("span", ba, st(w.value), 1),
3884
+ O[0] || (O[0] = L("span", { class: "editor-hint" }, "脚本编辑器", -1))
3885
+ ]),
3886
+ L("div", {
3887
+ class: "editor-body",
3888
+ ref_key: "editorContainerRef",
3889
+ ref: m
3890
+ }, null, 512)
3891
+ ]));
3892
+ }
3893
+ }, xa = /* @__PURE__ */ It(ya, [["__scopeId", "data-v-1b9d3c09"]]), wa = {
3894
+ __name: "ScriptDialog",
3895
+ props: {
3896
+ visible: { type: Boolean, default: !1 },
3897
+ editData: { type: Object, default: null },
3898
+ // ScriptNode 对象(编辑模式)
3899
+ globalLanguage: { type: String, default: null },
3900
+ existingIds: { type: Array, default: () => [] }
3901
+ // 已存在的 ID 列表
3902
+ },
3903
+ emits: ["update:visible", "confirm"],
3904
+ setup(i, { emit: e }) {
3905
+ const t = i, n = e, l = we(() => !!t.editData), s = we({
3906
+ get: () => t.visible,
3907
+ set: (m) => n("update:visible", m)
3908
+ }), o = J(null), r = J({
3909
+ id: "",
3910
+ name: "",
3911
+ type: "script",
3912
+ language: "groovy"
3913
+ }), c = {
3914
+ id: [
3915
+ { required: !0, message: "请输入脚本ID", trigger: "blur" },
3916
+ { pattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/, message: "ID 只能包含字母、数字和下划线,且以字母开头", trigger: "blur" }
3917
+ ],
3918
+ name: [
3919
+ { required: !0, message: "请输入脚本名称", trigger: "blur" }
3920
+ ]
3921
+ };
3922
+ ct(() => t.visible, (m) => {
3923
+ m && (t.editData ? r.value = {
3924
+ id: t.editData.id || "",
3925
+ name: t.editData.name || "",
3926
+ type: t.editData.type || "script",
3927
+ language: t.editData.language || t.globalLanguage || "groovy"
3928
+ } : r.value = {
3929
+ id: "",
3930
+ name: "",
3931
+ type: "script",
3932
+ language: t.globalLanguage || "groovy"
3933
+ });
3934
+ }), ct(() => t.globalLanguage, (m) => {
3935
+ !t.editData && t.visible && m && (r.value.language = m);
3936
+ });
3937
+ function p() {
3938
+ var m;
3939
+ (m = o.value) == null || m.resetFields();
3940
+ }
3941
+ function w() {
3942
+ var m;
3943
+ (m = o.value) == null || m.validate((f) => {
3944
+ var N;
3945
+ if (f) {
3946
+ if ((!l.value || r.value.id !== ((N = t.editData) == null ? void 0 : N.id)) && t.existingIds.includes(r.value.id)) {
3947
+ Be.warning("脚本 ID 已存在");
3948
+ return;
3949
+ }
3950
+ n("confirm", {
3951
+ ...r.value
3952
+ }), n("update:visible", !1);
3953
+ }
3954
+ });
3955
+ }
3956
+ return (m, f) => {
3957
+ const N = fe("el-input"), D = fe("el-form-item"), R = fe("el-option"), U = fe("el-select"), G = fe("el-form"), K = fe("el-button"), S = fe("el-dialog");
3958
+ return X(), He(S, {
3959
+ modelValue: s.value,
3960
+ "onUpdate:modelValue": f[5] || (f[5] = (O) => s.value = O),
3961
+ title: l.value ? "编辑脚本" : "新增脚本",
3962
+ width: "480px",
3963
+ "close-on-click-modal": !1,
3964
+ onClose: p
3965
+ }, {
3966
+ footer: A(() => [
3967
+ C(K, {
3968
+ onClick: f[4] || (f[4] = (O) => s.value = !1)
3969
+ }, {
3970
+ default: A(() => [...f[6] || (f[6] = [
3971
+ ne("取消", -1)
3972
+ ])]),
3973
+ _: 1
3974
+ }),
3975
+ C(K, {
3976
+ type: "primary",
3977
+ onClick: w
3978
+ }, {
3979
+ default: A(() => [...f[7] || (f[7] = [
3980
+ ne("确定", -1)
3981
+ ])]),
3982
+ _: 1
3983
+ })
3984
+ ]),
3985
+ default: A(() => [
3986
+ C(G, {
3987
+ ref_key: "formRef",
3988
+ ref: o,
3989
+ model: r.value,
3990
+ rules: c,
3991
+ "label-width": "80px"
3992
+ }, {
3993
+ default: A(() => [
3994
+ C(D, {
3995
+ label: "ID",
3996
+ prop: "id"
3997
+ }, {
3998
+ default: A(() => [
3999
+ C(N, {
4000
+ modelValue: r.value.id,
4001
+ "onUpdate:modelValue": f[0] || (f[0] = (O) => r.value.id = O),
4002
+ placeholder: "如 s1"
4003
+ }, null, 8, ["modelValue"])
4004
+ ]),
4005
+ _: 1
4006
+ }),
4007
+ C(D, {
4008
+ label: "名称",
4009
+ prop: "name"
4010
+ }, {
4011
+ default: A(() => [
4012
+ C(N, {
4013
+ modelValue: r.value.name,
4014
+ "onUpdate:modelValue": f[1] || (f[1] = (O) => r.value.name = O),
4015
+ placeholder: "如 普通脚本"
4016
+ }, null, 8, ["modelValue"])
4017
+ ]),
4018
+ _: 1
4019
+ }),
4020
+ C(D, {
4021
+ label: "类型",
4022
+ prop: "type"
4023
+ }, {
4024
+ default: A(() => [
4025
+ C(U, {
4026
+ modelValue: r.value.type,
4027
+ "onUpdate:modelValue": f[2] || (f[2] = (O) => r.value.type = O),
4028
+ style: { width: "100%" }
4029
+ }, {
4030
+ default: A(() => [
4031
+ C(R, {
4032
+ label: "script(普通脚本)",
4033
+ value: "script"
4034
+ }),
4035
+ C(R, {
4036
+ label: "switch_script(选择脚本)",
4037
+ value: "switch_script"
4038
+ }),
4039
+ C(R, {
4040
+ label: "if_script(条件脚本)",
4041
+ value: "if_script"
4042
+ }),
4043
+ C(R, {
4044
+ label: "for_script(数量循环)",
4045
+ value: "for_script"
4046
+ }),
4047
+ C(R, {
4048
+ label: "while_script(条件循环)",
4049
+ value: "while_script"
4050
+ }),
4051
+ C(R, {
4052
+ label: "break_script(退出循环)",
4053
+ value: "break_script"
4054
+ })
4055
+ ]),
4056
+ _: 1
4057
+ }, 8, ["modelValue"])
4058
+ ]),
4059
+ _: 1
4060
+ }),
4061
+ C(D, {
4062
+ label: "语言",
4063
+ prop: "language"
4064
+ }, {
4065
+ default: A(() => [
4066
+ C(U, {
4067
+ modelValue: r.value.language,
4068
+ "onUpdate:modelValue": f[3] || (f[3] = (O) => r.value.language = O),
4069
+ style: { width: "100%" },
4070
+ disabled: !!i.globalLanguage,
4071
+ title: i.globalLanguage ? "语言已由全局设置锁定" : ""
4072
+ }, {
4073
+ default: A(() => [
4074
+ C(R, {
4075
+ label: "Groovy",
4076
+ value: "groovy"
4077
+ }),
4078
+ C(R, {
4079
+ label: "JavaScript",
4080
+ value: "js"
4081
+ }),
4082
+ C(R, {
4083
+ label: "Python",
4084
+ value: "python"
4085
+ }),
4086
+ C(R, {
4087
+ label: "Lua",
4088
+ value: "lua"
4089
+ }),
4090
+ C(R, {
4091
+ label: "QLExpress",
4092
+ value: "QLExpress"
4093
+ })
4094
+ ]),
4095
+ _: 1
4096
+ }, 8, ["modelValue", "disabled", "title"])
4097
+ ]),
4098
+ _: 1
4099
+ })
4100
+ ]),
4101
+ _: 1
4102
+ }, 8, ["model"])
4103
+ ]),
4104
+ _: 1
4105
+ }, 8, ["modelValue", "title"]);
4106
+ };
4107
+ }
4108
+ }, Sa = {
4109
+ __name: "ChainDialog",
4110
+ props: {
4111
+ visible: { type: Boolean, default: !1 },
4112
+ editData: { type: Object, default: null },
4113
+ // ChainModel 对象(编辑模式)
4114
+ existingNames: { type: Array, default: () => [] }
4115
+ },
4116
+ emits: ["update:visible", "confirm"],
4117
+ setup(i, { emit: e }) {
4118
+ const t = i, n = e, l = we(() => !!t.editData), s = we({
4119
+ get: () => t.visible,
4120
+ set: (m) => n("update:visible", m)
4121
+ }), o = J(null), r = J({
4122
+ name: ""
4123
+ }), c = {
4124
+ name: [
4125
+ { required: !0, message: "请输入流程名称", trigger: "blur" },
4126
+ { pattern: /^[a-zA-Z_][a-zA-Z0-9_]*$/, message: "名称只能包含字母、数字和下划线,且以字母开头", trigger: "blur" }
4127
+ ]
4128
+ };
4129
+ ct(() => t.visible, (m) => {
4130
+ m && (t.editData ? r.value = { name: t.editData.name || "" } : r.value = { name: "" });
4131
+ });
4132
+ function p() {
4133
+ var m;
4134
+ (m = o.value) == null || m.resetFields();
4135
+ }
4136
+ function w() {
4137
+ var m;
4138
+ (m = o.value) == null || m.validate((f) => {
4139
+ var N;
4140
+ if (f) {
4141
+ if ((!l.value || r.value.name !== ((N = t.editData) == null ? void 0 : N.name)) && t.existingNames.includes(r.value.name)) {
4142
+ Be.warning("流程名称已存在");
4143
+ return;
4144
+ }
4145
+ n("confirm", { name: r.value.name }), n("update:visible", !1);
4146
+ }
4147
+ });
4148
+ }
4149
+ return (m, f) => {
4150
+ const N = fe("el-input"), D = fe("el-form-item"), R = fe("el-form"), U = fe("el-button"), G = fe("el-dialog");
4151
+ return X(), He(G, {
4152
+ modelValue: s.value,
4153
+ "onUpdate:modelValue": f[2] || (f[2] = (K) => s.value = K),
4154
+ title: l.value ? "编辑流程" : "新增流程",
4155
+ width: "420px",
4156
+ "close-on-click-modal": !1,
4157
+ onClose: p
4158
+ }, {
4159
+ footer: A(() => [
4160
+ C(U, {
4161
+ onClick: f[1] || (f[1] = (K) => s.value = !1)
4162
+ }, {
4163
+ default: A(() => [...f[3] || (f[3] = [
4164
+ ne("取消", -1)
4165
+ ])]),
4166
+ _: 1
4167
+ }),
4168
+ C(U, {
4169
+ type: "primary",
4170
+ onClick: w
4171
+ }, {
4172
+ default: A(() => [...f[4] || (f[4] = [
4173
+ ne("确定", -1)
4174
+ ])]),
4175
+ _: 1
4176
+ })
4177
+ ]),
4178
+ default: A(() => [
4179
+ C(R, {
4180
+ ref_key: "formRef",
4181
+ ref: o,
4182
+ model: r.value,
4183
+ rules: c,
4184
+ "label-width": "80px"
4185
+ }, {
4186
+ default: A(() => [
4187
+ C(D, {
4188
+ label: "名称",
4189
+ prop: "name"
4190
+ }, {
4191
+ default: A(() => [
4192
+ C(N, {
4193
+ modelValue: r.value.name,
4194
+ "onUpdate:modelValue": f[0] || (f[0] = (K) => r.value.name = K),
4195
+ placeholder: "如 chain1"
4196
+ }, null, 8, ["modelValue"])
4197
+ ]),
4198
+ _: 1
4199
+ })
4200
+ ]),
4201
+ _: 1
4202
+ }, 8, ["model"])
4203
+ ]),
4204
+ _: 1
4205
+ }, 8, ["modelValue", "title"]);
4206
+ };
4207
+ }
4208
+ }, Ea = { class: "designer-body" }, Ma = { class: "main-content" }, _a = {
4209
+ key: 2,
4210
+ class: "empty-guide"
4211
+ }, Ca = { class: "empty-icon" }, ka = {
4212
+ style: { width: "64px", height: "64px" },
4213
+ viewBox: "0 0 24 24",
4214
+ fill: "none",
4215
+ stroke: "#c0c4cc",
4216
+ "stroke-width": "1.5"
4217
+ }, Na = {
4218
+ __name: "DesignerPanel",
4219
+ props: {
4220
+ /** XML 字符串 */
4221
+ data: { type: String, default: "" },
4222
+ readonly: { type: Boolean, default: !1 },
4223
+ /** 全局默认语言,设置后所有脚本强制使用该语言 */
4224
+ defaultLanguage: { type: String, default: null }
4225
+ },
4226
+ emits: ["change"],
4227
+ setup(i, { expose: e, emit: t }) {
4228
+ const n = i, l = t, s = Tl(n.defaultLanguage), o = s.createDesigner();
4229
+ Xi(o), Ol(s);
4230
+ const r = J(null);
4231
+ o.setOnChange((T) => {
4232
+ r.value && clearTimeout(r.value), r.value = setTimeout(() => {
4233
+ w();
4234
+ const z = s.toXML();
4235
+ l("change", z);
4236
+ }, 200);
4237
+ });
4238
+ const c = J(null);
4239
+ function p(T) {
4240
+ s.activeScriptIndex.value >= 0 && s.updateScriptNode(s.activeScriptIndex.value, { value: T });
4241
+ }
4242
+ function w() {
4243
+ var T;
4244
+ if (s.activeTab.value === "chain" && s.currentFlowData.value) {
4245
+ const z = (T = s.currentLfRef.value) == null ? void 0 : T.value;
4246
+ if (z && s.currentFlowData.value) {
4247
+ s.currentFlowData.value.syncFromLF(z);
4248
+ const _e = s.activeChainIndex.value;
4249
+ _e >= 0 && _e < s.flowModel.value.chains.length && (s.flowModel.value.chains[_e].dsl = s.currentFlowData.value.toDSL());
4250
+ }
4251
+ }
4252
+ }
4253
+ ct(() => n.data, (T) => {
4254
+ T != null && (s.initFromXML(T), _t(() => {
4255
+ s.activeTab.value === "chain" && s.activeChainIndex.value >= 0 && s.activateChain(s.activeChainIndex.value, !0);
4256
+ }));
4257
+ }, { immediate: !0 });
4258
+ const m = J(!1), f = J(null), N = we(
4259
+ () => s.flowModel.value.scriptNodes.map((T) => T.id)
4260
+ );
4261
+ function D() {
4262
+ f.value = null, m.value = !0;
4263
+ }
4264
+ function R(T) {
4265
+ f.value = { ...s.flowModel.value.scriptNodes[T] }, m.value = !0;
4266
+ }
4267
+ function U(T) {
4268
+ const z = s.flowModel.value.scriptNodes[T];
4269
+ En.confirm(`确定删除脚本 "${z.name || z.id}"?`, "确认删除", {
4270
+ confirmButtonText: "删除",
4271
+ cancelButtonText: "取消",
4272
+ type: "warning"
4273
+ }).then(() => {
4274
+ s.deleteScriptNode(T);
4275
+ }).catch(() => {
4276
+ });
4277
+ }
4278
+ function G(T) {
4279
+ s.activeTab.value === "script" && s.activeScriptIndex.value >= 0 && s.syncCurrentScriptValue(c.value), s.selectScript(T);
4280
+ }
4281
+ function K(T) {
4282
+ f.value ? s.updateScriptNode(
4283
+ s.activeScriptIndex.value >= 0 ? s.activeScriptIndex.value : s.flowModel.value.scriptNodes.findIndex((z) => z.id === f.value.id),
4284
+ T
4285
+ ) : s.addScriptNode(T);
4286
+ }
4287
+ const S = J(!1), O = J(null), ee = we(
4288
+ () => s.flowModel.value.chains.map((T) => T.name)
4289
+ );
4290
+ function ke() {
4291
+ O.value = null, S.value = !0;
4292
+ }
4293
+ function ge(T) {
4294
+ O.value = { ...s.flowModel.value.chains[T] }, S.value = !0;
4295
+ }
4296
+ function ve(T) {
4297
+ const z = s.flowModel.value.chains[T];
4298
+ En.confirm(`确定删除流程 "${z.name}"?`, "确认删除", {
4299
+ confirmButtonText: "删除",
4300
+ cancelButtonText: "取消",
4301
+ type: "warning"
4302
+ }).then(() => {
4303
+ s.deleteChain(T);
4304
+ }).catch(() => {
4305
+ });
4306
+ }
4307
+ function Re(T) {
4308
+ s.activeTab.value === "script" && s.activeScriptIndex.value >= 0 && s.syncCurrentScriptValue(c.value), s.selectChain(T), _t(() => {
4309
+ s.activateChain(T, !0);
4310
+ });
4311
+ }
4312
+ function Me(T) {
4313
+ O.value ? s.updateChain(
4314
+ s.flowModel.value.chains.findIndex((z) => z.name === O.value.name),
4315
+ T
4316
+ ) : (s.addChain(T.name), _t(() => {
4317
+ s.activateChain(s.flowModel.value.chains.length - 1, !0);
4318
+ }));
4319
+ }
4320
+ return e({
4321
+ getSnapshot: o.getSnapshot,
4322
+ newFlow: o.newFlow,
4323
+ exportJSON: o.exportJSON,
4324
+ importJSON: o.importJSON,
4325
+ fitView: o.fitView,
4326
+ /** 导出 XML */
4327
+ exportXML: () => (w(), s.activeTab.value === "script" && s.syncCurrentScriptValue(c.value), s.toXML()),
4328
+ /** 导入 XML */
4329
+ importXML: (T) => {
4330
+ s.initFromXML(T), _t(() => {
4331
+ s.activeTab.value === "chain" && s.activeChainIndex.value >= 0 && s.activateChain(s.activeChainIndex.value, !0);
4332
+ });
4333
+ },
4334
+ /** 获取 FlowModel */
4335
+ getFlowModel: () => s.flowModel.value
4336
+ }), In(() => {
4337
+ }), Fn(() => {
4338
+ o.destroy(), r.value && clearTimeout(r.value);
4339
+ }), (T, z) => {
4340
+ var _e;
4341
+ return X(), ie("div", {
4342
+ class: Kt(["designer-panel", { "is-readonly": i.readonly }])
4343
+ }, [
4344
+ C(Zl, { readonly: i.readonly }, null, 8, ["readonly"]),
4345
+ L("div", Ea, [
4346
+ C(Cs, {
4347
+ "script-nodes": te(s).flowModel.value.scriptNodes,
4348
+ chains: te(s).flowModel.value.chains,
4349
+ "active-tab": te(s).activeTab.value,
4350
+ "active-script-index": te(s).activeScriptIndex.value,
4351
+ "active-chain-index": te(s).activeChainIndex.value,
4352
+ readonly: i.readonly,
4353
+ onAddScript: D,
4354
+ onEditScript: R,
4355
+ onDeleteScript: U,
4356
+ onAddChain: ke,
4357
+ onEditChain: ge,
4358
+ onDeleteChain: ve,
4359
+ onSelectScript: G,
4360
+ onSelectChain: Re
4361
+ }, null, 8, ["script-nodes", "chains", "active-tab", "active-script-index", "active-chain-index", "readonly"]),
4362
+ L("div", Ma, [
4363
+ te(s).activeTab.value === "script" && te(s).activeScriptIndex.value >= 0 ? (X(), He(xa, {
4364
+ key: "script-" + te(s).activeScriptIndex.value,
4365
+ ref_key: "scriptEditorRef",
4366
+ ref: c,
4367
+ "model-value": ((_e = te(s).activeScriptNode.value) == null ? void 0 : _e.value) || "",
4368
+ language: te(s).getCurrentLanguage(),
4369
+ readonly: i.readonly,
4370
+ "onUpdate:modelValue": p
4371
+ }, null, 8, ["model-value", "language", "readonly"])) : te(s).activeTab.value === "chain" && te(s).activeChainIndex.value >= 0 ? (X(), He(te(Gi), {
4372
+ key: 1,
4373
+ readonly: i.readonly
4374
+ }, null, 8, ["readonly"])) : (X(), ie("div", _a, [
4375
+ L("div", Ca, [
4376
+ (X(), ie("svg", ka, [...z[2] || (z[2] = [
4377
+ L("polygon", { points: "12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2" }, null, -1),
4378
+ L("line", {
4379
+ x1: "12",
4380
+ y1: "22",
4381
+ x2: "12",
4382
+ y2: "15.5"
4383
+ }, null, -1),
4384
+ L("polyline", { points: "22 8.5 12 15.5 2 8.5" }, null, -1)
4385
+ ])]))
4386
+ ]),
4387
+ z[3] || (z[3] = L("p", { class: "empty-title" }, "欢迎使用 LiteFlow 设计器", -1)),
4388
+ z[4] || (z[4] = L("p", { class: "empty-desc" }, "请先在左侧面板创建脚本节点或流程链", -1))
4389
+ ]))
4390
+ ])
4391
+ ]),
4392
+ C(wa, {
4393
+ visible: m.value,
4394
+ "onUpdate:visible": z[0] || (z[0] = (E) => m.value = E),
4395
+ "edit-data": f.value,
4396
+ "global-language": n.defaultLanguage,
4397
+ "existing-ids": N.value,
4398
+ onConfirm: K
4399
+ }, null, 8, ["visible", "edit-data", "global-language", "existing-ids"]),
4400
+ C(Sa, {
4401
+ visible: S.value,
4402
+ "onUpdate:visible": z[1] || (z[1] = (E) => S.value = E),
4403
+ "edit-data": O.value,
4404
+ "existing-names": ee.value,
4405
+ onConfirm: Me
4406
+ }, null, 8, ["visible", "edit-data", "existing-names"])
4407
+ ], 2);
4408
+ };
4409
+ }
4410
+ }, La = /* @__PURE__ */ It(Na, [["__scopeId", "data-v-c2ba37e3"]]), $a = {
4411
+ install(i) {
4412
+ i.component("LiteFlowDesigner", La);
4413
+ }
4414
+ };
4415
+ export {
4416
+ gt as ChainModel,
4417
+ La as DesignerPanel,
4418
+ Je as FlowModel,
4419
+ ht as ScriptNode,
4420
+ $a as default,
4421
+ _n as flowModelToXML,
4422
+ kl as xmlToFlowModel
4423
+ };