@blueking/flow-canvas 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as H, computed as V, onScopeDispose as rt, defineComponent as fe, h as qe, watch as ge, onBeforeUnmount as Te, openBlock as A, createElementBlock as T, normalizeStyle as Ee, createElementVNode as q, normalizeClass as te, createCommentVNode as Y, createVNode as at, Transition as lt, withCtx as He, withModifiers as ht, createTextVNode as je, renderSlot as Me, nextTick as Ge, onMounted as dt, Fragment as de, renderList as Ie, toDisplayString as ce, unref as ie, createBlock as Ce, reactive as vt, resolveDynamicComponent as mt, Teleport as yt, inject as wt, createApp as bt } from "vue";
1
+ import { ref as H, computed as V, onScopeDispose as it, defineComponent as pe, h as qe, watch as he, onBeforeUnmount as Te, createElementBlock as T, openBlock as A, normalizeStyle as Ee, createElementVNode as F, createVNode as at, createCommentVNode as K, normalizeClass as oe, Transition as lt, withCtx as He, withModifiers as ht, createTextVNode as je, renderSlot as Me, nextTick as Ge, onMounted as dt, createBlock as Ie, Fragment as ue, renderList as Ce, toDisplayString as fe, unref as le, reactive as vt, resolveDynamicComponent as mt, Teleport as yt, inject as wt, createApp as bt } from "vue";
2
2
  import { Graph as Et } from "@antv/x6";
3
3
  import { register as xt } from "@antv/x6-vue-shape";
4
4
  import { Selection as It } from "@antv/x6-plugin-selection";
@@ -10,7 +10,7 @@ function Mn() {
10
10
  edges: {}
11
11
  };
12
12
  }
13
- class ue extends Error {
13
+ class ge extends Error {
14
14
  constructor(e) {
15
15
  super(e), this.name = "CanvasConstraintError";
16
16
  }
@@ -20,153 +20,153 @@ class kt extends Error {
20
20
  super(e), this.name = "CanvasSchemaError";
21
21
  }
22
22
  }
23
- function Re(s, e, o) {
23
+ function Re(n, e, o) {
24
24
  if (e.length === 0) {
25
25
  if (o === void 0) return;
26
26
  if (typeof o != "object" || o === null || Array.isArray(o))
27
27
  throw new Error("Root value of payload/extensions/meta must be an object or undefined");
28
28
  return o;
29
29
  }
30
- const t = s ? { ...s } : {};
31
- let n = t;
32
- for (let r = 0; r < e.length - 1; r++) {
33
- const l = e[r], a = n[l];
34
- a && typeof a == "object" && !Array.isArray(a) ? n[l] = { ...a } : n[l] = {}, n = n[l];
30
+ const t = n ? { ...n } : {};
31
+ let s = t;
32
+ for (let i = 0; i < e.length - 1; i++) {
33
+ const l = e[i], a = s[l];
34
+ a && typeof a == "object" && !Array.isArray(a) ? s[l] = { ...a } : s[l] = {}, s = s[l];
35
35
  }
36
- const i = e[e.length - 1];
37
- return o === void 0 ? delete n[i] : n[i] = o, t;
36
+ const r = e[e.length - 1];
37
+ return o === void 0 ? delete s[r] : s[r] = o, t;
38
38
  }
39
- function ct(s, e) {
39
+ function ct(n, e) {
40
40
  switch (e.type) {
41
41
  case "node.add":
42
- return St(s, e.node);
42
+ return St(n, e.node);
43
43
  case "node.move":
44
- return Mt(s, e.nodeId, e.position);
44
+ return Mt(n, e.nodeId, e.position);
45
45
  case "node.remove":
46
- return Nt(s, e.nodeId);
46
+ return Nt(n, e.nodeId);
47
47
  case "node.update":
48
- return Dt(s, e.nodeId, e.patch);
48
+ return Dt(n, e.nodeId, e.patch);
49
49
  case "node.set-payload":
50
- return At(s, e.nodeId, e.path, e.value);
50
+ return At(n, e.nodeId, e.path, e.value);
51
51
  case "node.set-extensions":
52
- return _t(s, e.nodeId, e.path, e.value);
52
+ return _t(n, e.nodeId, e.path, e.value);
53
53
  case "edge.add":
54
- return Pt(s, e.edge);
54
+ return Pt(n, e.edge);
55
55
  case "edge.remove":
56
- return Tt(s, e.edgeId);
56
+ return Tt(n, e.edgeId);
57
57
  case "edge.reconnect":
58
- return Rt(s, e.edgeId, e.source, e.target);
58
+ return Rt(n, e.edgeId, e.source, e.target);
59
59
  case "edge.update":
60
- return Lt(s, e.edgeId, e.patch);
60
+ return Lt(n, e.edgeId, e.patch);
61
61
  case "edge.set-payload":
62
- return Ot(s, e.edgeId, e.path, e.value);
62
+ return Ot(n, e.edgeId, e.path, e.value);
63
63
  case "edge.label.update":
64
- return $t(s, e.edgeId, e.labelId, e.patch);
64
+ return $t(n, e.edgeId, e.labelId, e.patch);
65
65
  case "model.set-meta":
66
- return Bt(s, e.path, e.value);
66
+ return Bt(n, e.path, e.value);
67
67
  default:
68
- throw new ue(`Unknown command type: ${e.type}`);
68
+ throw new ge(`Unknown command type: ${e.type}`);
69
69
  }
70
70
  }
71
- function Ne(s, e) {
72
- const o = s.nodes[e];
73
- if (!o) throw new ue(`Node "${e}" does not exist`);
71
+ function Ne(n, e) {
72
+ const o = n.nodes[e];
73
+ if (!o) throw new ge(`Node "${e}" does not exist`);
74
74
  return o;
75
75
  }
76
- function De(s, e) {
77
- const o = s.edges[e];
78
- if (!o) throw new ue(`Edge "${e}" does not exist`);
76
+ function De(n, e) {
77
+ const o = n.edges[e];
78
+ if (!o) throw new ge(`Edge "${e}" does not exist`);
79
79
  return o;
80
80
  }
81
- function ke(s, e, o) {
82
- const t = s.nodes[e.nodeId];
81
+ function ke(n, e, o) {
82
+ const t = n.nodes[e.nodeId];
83
83
  if (!t)
84
- throw new ue(`${o} node "${e.nodeId}" does not exist`);
85
- if (e.portId && t.ports && !t.ports.some((i) => i.id === e.portId))
86
- throw new ue(`${o} port "${e.portId}" not found on node "${e.nodeId}"`);
87
- }
88
- function Le(s, e, o) {
89
- return { ...s, nodes: { ...s.nodes, [e]: o } };
90
- }
91
- function Oe(s, e, o) {
92
- return { ...s, edges: { ...s.edges, [e]: o } };
93
- }
94
- function St(s, e) {
95
- if (s.nodes[e.id])
96
- throw new ue(`Node id "${e.id}" already exists`);
97
- return { ...s, nodes: { ...s.nodes, [e.id]: e } };
98
- }
99
- function Mt(s, e, o) {
100
- const t = Ne(s, e);
101
- return Le(s, e, { ...t, position: o });
102
- }
103
- function Nt(s, e) {
104
- Ne(s, e);
105
- const { [e]: o, ...t } = s.nodes, n = {};
106
- for (const [i, r] of Object.entries(s.edges))
107
- r.source.nodeId !== e && r.target.nodeId !== e && (n[i] = r);
108
- return { ...s, nodes: t, edges: n };
109
- }
110
- function Dt(s, e, o) {
111
- const t = Ne(s, e);
112
- return Le(s, e, { ...t, ...o, id: t.id });
113
- }
114
- function At(s, e, o, t) {
115
- const n = Ne(s, e), i = Re(n.payload, o, t);
116
- return Le(s, e, { ...n, payload: i });
117
- }
118
- function _t(s, e, o, t) {
119
- const n = Ne(s, e), i = Re(n.extensions, o, t);
120
- return Le(s, e, { ...n, extensions: i });
121
- }
122
- function Pt(s, e) {
123
- if (s.edges[e.id])
124
- throw new ue(`Edge id "${e.id}" already exists`);
125
- if (ke(s, e.source, "Source"), ke(s, e.target, "Target"), e.labels) {
84
+ throw new ge(`${o} node "${e.nodeId}" does not exist`);
85
+ if (e.portId && t.ports && !t.ports.some((r) => r.id === e.portId))
86
+ throw new ge(`${o} port "${e.portId}" not found on node "${e.nodeId}"`);
87
+ }
88
+ function Le(n, e, o) {
89
+ return { ...n, nodes: { ...n.nodes, [e]: o } };
90
+ }
91
+ function Oe(n, e, o) {
92
+ return { ...n, edges: { ...n.edges, [e]: o } };
93
+ }
94
+ function St(n, e) {
95
+ if (n.nodes[e.id])
96
+ throw new ge(`Node id "${e.id}" already exists`);
97
+ return { ...n, nodes: { ...n.nodes, [e.id]: e } };
98
+ }
99
+ function Mt(n, e, o) {
100
+ const t = Ne(n, e);
101
+ return Le(n, e, { ...t, position: o });
102
+ }
103
+ function Nt(n, e) {
104
+ Ne(n, e);
105
+ const { [e]: o, ...t } = n.nodes, s = {};
106
+ for (const [r, i] of Object.entries(n.edges))
107
+ i.source.nodeId !== e && i.target.nodeId !== e && (s[r] = i);
108
+ return { ...n, nodes: t, edges: s };
109
+ }
110
+ function Dt(n, e, o) {
111
+ const t = Ne(n, e);
112
+ return Le(n, e, { ...t, ...o, id: t.id });
113
+ }
114
+ function At(n, e, o, t) {
115
+ const s = Ne(n, e), r = Re(s.payload, o, t);
116
+ return Le(n, e, { ...s, payload: r });
117
+ }
118
+ function _t(n, e, o, t) {
119
+ const s = Ne(n, e), r = Re(s.extensions, o, t);
120
+ return Le(n, e, { ...s, extensions: r });
121
+ }
122
+ function Pt(n, e) {
123
+ if (n.edges[e.id])
124
+ throw new ge(`Edge id "${e.id}" already exists`);
125
+ if (ke(n, e.source, "Source"), ke(n, e.target, "Target"), e.labels) {
126
126
  const o = /* @__PURE__ */ new Set();
127
127
  for (const t of e.labels) {
128
128
  if (o.has(t.id))
129
- throw new ue(`Duplicate label id "${t.id}" in edge "${e.id}"`);
129
+ throw new ge(`Duplicate label id "${t.id}" in edge "${e.id}"`);
130
130
  o.add(t.id);
131
131
  }
132
132
  }
133
- return { ...s, edges: { ...s.edges, [e.id]: e } };
133
+ return { ...n, edges: { ...n.edges, [e.id]: e } };
134
134
  }
135
- function Tt(s, e) {
136
- De(s, e);
137
- const { [e]: o, ...t } = s.edges;
138
- return { ...s, edges: t };
135
+ function Tt(n, e) {
136
+ De(n, e);
137
+ const { [e]: o, ...t } = n.edges;
138
+ return { ...n, edges: t };
139
139
  }
140
- function Rt(s, e, o, t) {
141
- const n = De(s, e), i = o ?? n.source, r = t ?? n.target;
142
- return ke(s, i, "Source"), ke(s, r, "Target"), Oe(s, e, { ...n, source: i, target: r });
140
+ function Rt(n, e, o, t) {
141
+ const s = De(n, e), r = o ?? s.source, i = t ?? s.target;
142
+ return ke(n, r, "Source"), ke(n, i, "Target"), Oe(n, e, { ...s, source: r, target: i });
143
143
  }
144
- function Lt(s, e, o) {
145
- const t = De(s, e), n = { ...t, ...o, id: t.id };
146
- return o.source && ke(s, n.source, "Source"), o.target && ke(s, n.target, "Target"), Oe(s, e, n);
144
+ function Lt(n, e, o) {
145
+ const t = De(n, e), s = { ...t, ...o, id: t.id };
146
+ return o.source && ke(n, s.source, "Source"), o.target && ke(n, s.target, "Target"), Oe(n, e, s);
147
147
  }
148
- function Ot(s, e, o, t) {
149
- const n = De(s, e), i = Re(n.payload, o, t);
150
- return Oe(s, e, { ...n, payload: i });
148
+ function Ot(n, e, o, t) {
149
+ const s = De(n, e), r = Re(s.payload, o, t);
150
+ return Oe(n, e, { ...s, payload: r });
151
151
  }
152
- function $t(s, e, o, t) {
153
- const n = De(s, e);
154
- if (!n.labels)
155
- throw new ue(`Edge "${e}" has no labels`);
156
- const i = n.labels.findIndex((l) => l.id === o);
157
- if (i === -1)
158
- throw new ue(`Label "${o}" not found in edge "${e}"`);
159
- const r = [...n.labels];
160
- return r[i] = { ...r[i], ...t, id: o }, Oe(s, e, { ...n, labels: r });
152
+ function $t(n, e, o, t) {
153
+ const s = De(n, e);
154
+ if (!s.labels)
155
+ throw new ge(`Edge "${e}" has no labels`);
156
+ const r = s.labels.findIndex((l) => l.id === o);
157
+ if (r === -1)
158
+ throw new ge(`Label "${o}" not found in edge "${e}"`);
159
+ const i = [...s.labels];
160
+ return i[r] = { ...i[r], ...t, id: o }, Oe(n, e, { ...s, labels: i });
161
161
  }
162
- function Bt(s, e, o) {
163
- const t = Re(s.meta, e, o);
164
- return { ...s, meta: t };
162
+ function Bt(n, e, o) {
163
+ const t = Re(n.meta, e, o);
164
+ return { ...n, meta: t };
165
165
  }
166
- function Ft(s, e) {
167
- const o = e?.maxHistorySize ?? 100, t = H(s), n = [], i = [], r = H(!1), l = H(!1);
166
+ function Ft(n, e) {
167
+ const o = e?.maxHistorySize ?? 100, t = H(n), s = [], r = [], i = H(!1), l = H(!1);
168
168
  function a() {
169
- r.value = n.length > 0, l.value = i.length > 0;
169
+ i.value = s.length > 0, l.value = r.length > 0;
170
170
  }
171
171
  function h(b) {
172
172
  const S = t.value;
@@ -177,27 +177,27 @@ function Ft(s, e) {
177
177
  const B = e?.excludeCommandFromHistory, j = B ? b.commands.filter((k) => !B(k)) : b.commands;
178
178
  if (j.length > 0) {
179
179
  const k = j.length < b.commands.length ? { ...b, commands: j } : b;
180
- n.push({ snapshot: S, envelope: k }), n.length > o && n.shift(), i.length = 0;
180
+ s.push({ snapshot: S, envelope: k }), s.length > o && s.shift(), r.length = 0;
181
181
  }
182
182
  }
183
183
  return t.value = M, a(), M;
184
184
  }
185
185
  function f() {
186
- const b = n.pop();
186
+ const b = s.pop();
187
187
  if (!b) return null;
188
- i.push({ snapshot: t.value, envelope: b.envelope });
188
+ r.push({ snapshot: t.value, envelope: b.envelope });
189
189
  const S = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
190
190
  return t.value = S, a(), S;
191
191
  }
192
192
  function p() {
193
- const b = i.pop();
193
+ const b = r.pop();
194
194
  if (!b) return null;
195
- n.push({ snapshot: t.value, envelope: b.envelope });
195
+ s.push({ snapshot: t.value, envelope: b.envelope });
196
196
  const S = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
197
197
  return t.value = S, a(), S;
198
198
  }
199
199
  function u() {
200
- n.length = 0, i.length = 0, a();
200
+ s.length = 0, r.length = 0, a();
201
201
  }
202
202
  function w() {
203
203
  return t.value;
@@ -213,20 +213,20 @@ function Ft(s, e) {
213
213
  timestamp: Date.now(),
214
214
  commands: []
215
215
  };
216
- n.push({ snapshot: t.value, envelope: M }), n.length > o && n.shift(), i.length = 0, t.value = b, a();
216
+ s.push({ snapshot: t.value, envelope: M }), s.length > o && s.shift(), r.length = 0, t.value = b, a();
217
217
  }
218
218
  return {
219
219
  currentFlowModel: t,
220
220
  execute: h,
221
221
  undo: f,
222
222
  redo: p,
223
- canUndo: r,
223
+ canUndo: i,
224
224
  canRedo: l,
225
225
  get undoStack() {
226
- return n.map((b) => b.envelope);
226
+ return s.map((b) => b.envelope);
227
227
  },
228
228
  get redoStack() {
229
- return i.map((b) => b.envelope);
229
+ return r.map((b) => b.envelope);
230
230
  },
231
231
  clear: u,
232
232
  createSnapshot: w,
@@ -234,8 +234,8 @@ function Ft(s, e) {
234
234
  updateFlowModel: O
235
235
  };
236
236
  }
237
- function qt(s) {
238
- return s !== null && typeof s == "object" && s.rejected === !0;
237
+ function qt(n) {
238
+ return n !== null && typeof n == "object" && n.rejected === !0;
239
239
  }
240
240
  class Ht {
241
241
  plugins = [];
@@ -244,7 +244,7 @@ class Ht {
244
244
  /** 每次 attachRuntime 递增,detachRuntime 时旧 generation 的异步调用自动作废 */
245
245
  runtimeVersion = 0;
246
246
  install(e, o) {
247
- this.plugins = [...e].sort((t, n) => (t.priority ?? 100) - (n.priority ?? 100)), this.editorContext = o;
247
+ this.plugins = [...e].sort((t, s) => (t.priority ?? 100) - (s.priority ?? 100)), this.editorContext = o;
248
248
  for (const t of this.plugins)
249
249
  t.install?.(o);
250
250
  }
@@ -257,8 +257,8 @@ class Ht {
257
257
  const o = ++this.runtimeVersion;
258
258
  this.runtimeCtx = e;
259
259
  const t = this.createSafeRuntimeContext(e, o);
260
- for (const n of this.plugins)
261
- n.attachRuntime?.(t);
260
+ for (const s of this.plugins)
261
+ s.attachRuntime?.(t);
262
262
  }
263
263
  /** 按安装的逆序 detach,保证后安装的插件先释放运行时资源 */
264
264
  detachRuntime() {
@@ -271,16 +271,16 @@ class Ht {
271
271
  * 如果在 await 期间 detachRuntime 已执行,代理会将 graph 操作变为 no-op。
272
272
  */
273
273
  createSafeRuntimeContext(e, o) {
274
- const t = this, n = new Proxy(e.graph, {
275
- get(i, r, l) {
276
- const a = Reflect.get(i, r, l);
277
- return r === "use" && typeof a == "function" ? function(...f) {
274
+ const t = this, s = new Proxy(e.graph, {
275
+ get(r, i, l) {
276
+ const a = Reflect.get(r, i, l);
277
+ return i === "use" && typeof a == "function" ? function(...f) {
278
278
  if (t.runtimeVersion === o)
279
- return a.apply(i, f);
279
+ return a.apply(r, f);
280
280
  } : a;
281
281
  }
282
282
  });
283
- return { ...e, graph: n };
283
+ return { ...e, graph: s };
284
284
  }
285
285
  dispose() {
286
286
  for (const e of [...this.plugins].reverse())
@@ -292,8 +292,8 @@ class Ht {
292
292
  let o = e;
293
293
  for (const t of this.plugins) {
294
294
  if (!t.transformCommand) continue;
295
- const n = this.createPreview(o), i = t.transformCommand(o, n, this.editorContext);
296
- if (i === null)
295
+ const s = this.createPreview(o), r = t.transformCommand(o, s, this.editorContext);
296
+ if (r === null)
297
297
  return {
298
298
  rejected: !0,
299
299
  error: {
@@ -302,23 +302,23 @@ class Ht {
302
302
  source: t.name
303
303
  }
304
304
  };
305
- if (qt(i))
305
+ if (qt(r))
306
306
  return {
307
307
  rejected: !0,
308
308
  error: {
309
- code: i.code ?? "plugin_rejected",
310
- reason: i.reason,
309
+ code: r.code ?? "plugin_rejected",
310
+ reason: r.reason,
311
311
  source: t.name
312
312
  }
313
313
  };
314
- o = i;
314
+ o = r;
315
315
  }
316
316
  return { envelope: o };
317
317
  }
318
318
  afterCommand(e, o, t) {
319
319
  if (this.editorContext)
320
- for (const n of this.plugins)
321
- n.afterCommand?.(e, o, t, this.editorContext);
320
+ for (const s of this.plugins)
321
+ s.afterCommand?.(e, o, t, this.editorContext);
322
322
  }
323
323
  dispatchUiEvent(e) {
324
324
  if (this.runtimeCtx)
@@ -341,8 +341,8 @@ class Ht {
341
341
  if (!this.runtimeCtx) return [];
342
342
  const o = [];
343
343
  for (const t of this.plugins) {
344
- const n = t.onBlankContextMenu?.(e, this.runtimeCtx);
345
- n && o.push(...n);
344
+ const s = t.onBlankContextMenu?.(e, this.runtimeCtx);
345
+ s && o.push(...s);
346
346
  }
347
347
  return o;
348
348
  }
@@ -353,8 +353,8 @@ class Ht {
353
353
  for (const o of this.plugins) {
354
354
  const t = o.provideToolbarItems?.(this.editorContext);
355
355
  if (t)
356
- for (const n of t)
357
- e.set(n.id, n);
356
+ for (const s of t)
357
+ e.set(s.id, s);
358
358
  }
359
359
  return [...e.values()].sort((o, t) => (o.order ?? 0) - (t.order ?? 0));
360
360
  }
@@ -363,8 +363,8 @@ class Ht {
363
363
  if (!this.editorContext) return;
364
364
  let o;
365
365
  for (const t of this.plugins) {
366
- const n = t.decorateNode?.(e, this.editorContext);
367
- n && (o = o ? { ...o, ...n } : n);
366
+ const s = t.decorateNode?.(e, this.editorContext);
367
+ s && (o = o ? { ...o, ...s } : s);
368
368
  }
369
369
  return o;
370
370
  }
@@ -373,8 +373,8 @@ class Ht {
373
373
  if (!this.editorContext) return;
374
374
  let o;
375
375
  for (const t of this.plugins) {
376
- const n = t.decorateEdge?.(e, this.editorContext);
377
- n && (o = o ? { ...o, ...n } : n);
376
+ const s = t.decorateEdge?.(e, this.editorContext);
377
+ s && (o = o ? { ...o, ...s } : s);
378
378
  }
379
379
  return o;
380
380
  }
@@ -392,23 +392,23 @@ class Ht {
392
392
  const o = this.editorContext;
393
393
  return {
394
394
  previewFlowModel(t) {
395
- const n = t ?? e.commands;
396
- let i = o.flowModel.value;
397
- for (const r of n)
398
- i = ct(i, r);
399
- return i;
395
+ const s = t ?? e.commands;
396
+ let r = o.flowModel.value;
397
+ for (const i of s)
398
+ r = ct(r, i);
399
+ return r;
400
400
  }
401
401
  };
402
402
  }
403
403
  }
404
404
  let Gt = 0;
405
- function J() {
406
- const s = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
407
- return `${s}-${e}-${++Gt}`;
405
+ function ee() {
406
+ const n = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
407
+ return `${n}-${e}-${++Gt}`;
408
408
  }
409
- const ze = () => J();
410
- function Nn(s) {
411
- const { schema: e, plugins: o = [], historyOptions: t } = s, n = s.idGenerator ?? ze, i = { version: "1.0", ...s.initialFlowModel }, r = Ft(i, t), l = H(s.mode ?? "edit"), a = H(!1), h = H(null), f = H([]), p = {}, u = new Ht();
409
+ const ze = () => ee();
410
+ function Nn(n) {
411
+ const { schema: e, plugins: o = [], historyOptions: t } = n, s = n.idGenerator ?? ze, r = { version: "1.0", ...n.initialFlowModel }, i = Ft(r, t), l = H(n.mode ?? "edit"), a = H(!1), h = H(null), f = H([]), p = {}, u = new Ht();
412
412
  function w(S, M, B, j = "user:toolbar") {
413
413
  const k = {
414
414
  id: `history-${Date.now()}`,
@@ -417,11 +417,11 @@ function Nn(s) {
417
417
  timestamp: Date.now(),
418
418
  commands: []
419
419
  };
420
- u.afterCommand(k, M, B), f.value = u.collectToolbarItems(), s.onCommandResult?.({
420
+ u.afterCommand(k, M, B), f.value = u.collectToolbarItems(), n.onCommandResult?.({
421
421
  status: "applied",
422
422
  envelope: k,
423
423
  flowModel: B
424
- }), s.onFlowModelChange?.({
424
+ }), n.onFlowModelChange?.({
425
425
  flowModel: B,
426
426
  prevFlowModel: M,
427
427
  envelope: k,
@@ -429,43 +429,43 @@ function Nn(s) {
429
429
  });
430
430
  }
431
431
  const D = {
432
- execute: r.execute,
432
+ execute: i.execute,
433
433
  undo() {
434
- const S = r.currentFlowModel.value, M = r.undo();
434
+ const S = i.currentFlowModel.value, M = i.undo();
435
435
  return M && w("撤销", S, M), M;
436
436
  },
437
437
  redo() {
438
- const S = r.currentFlowModel.value, M = r.redo();
438
+ const S = i.currentFlowModel.value, M = i.redo();
439
439
  return M && w("重做", S, M), M;
440
440
  },
441
441
  get canUndo() {
442
- return r.canUndo;
442
+ return i.canUndo;
443
443
  },
444
444
  get canRedo() {
445
- return r.canRedo;
445
+ return i.canRedo;
446
446
  },
447
447
  get undoStack() {
448
- return r.undoStack;
448
+ return i.undoStack;
449
449
  },
450
450
  get redoStack() {
451
- return r.redoStack;
451
+ return i.redoStack;
452
452
  },
453
- clear: r.clear,
454
- createSnapshot: r.createSnapshot,
453
+ clear: i.clear,
454
+ createSnapshot: i.createSnapshot,
455
455
  replaceFlowModel(S) {
456
- const M = r.currentFlowModel.value;
457
- r.replaceFlowModel(S), w("替换 FlowModel", M, S, "system:replace");
456
+ const M = i.currentFlowModel.value;
457
+ i.replaceFlowModel(S), w("替换 FlowModel", M, S, "system:replace");
458
458
  },
459
459
  updateFlowModel(S, M) {
460
- const B = r.currentFlowModel.value;
461
- r.updateFlowModel(S, M), w(M ?? "更新 FlowModel", B, S, "system:update");
460
+ const B = i.currentFlowModel.value;
461
+ i.updateFlowModel(S, M), w(M ?? "更新 FlowModel", B, S, "system:update");
462
462
  }
463
463
  }, O = {
464
- flowModel: V(() => r.currentFlowModel.value),
464
+ flowModel: V(() => i.currentFlowModel.value),
465
465
  history: D,
466
466
  schema: e,
467
467
  mode: l,
468
- idGenerator: n,
468
+ idGenerator: s,
469
469
  executeCommand: b,
470
470
  replaceFlowModel(S) {
471
471
  D.replaceFlowModel(S);
@@ -493,9 +493,9 @@ function Nn(s) {
493
493
  history: D,
494
494
  schema: e,
495
495
  mode: l,
496
- idGenerator: n,
496
+ idGenerator: s,
497
497
  executeCommand: b
498
- }), f.value = u.collectToolbarItems(), rt(() => {
498
+ }), f.value = u.collectToolbarItems(), it(() => {
499
499
  u.dispose();
500
500
  });
501
501
  function b(S) {
@@ -506,23 +506,23 @@ function Nn(s) {
506
506
  envelope: S,
507
507
  error: M.error
508
508
  };
509
- return s.onCommandResult?.(k), k;
509
+ return n.onCommandResult?.(k), k;
510
510
  }
511
- const B = M.envelope, j = r.currentFlowModel.value;
511
+ const B = M.envelope, j = i.currentFlowModel.value;
512
512
  try {
513
- const k = r.execute(B), X = {
513
+ const k = i.execute(B), X = {
514
514
  status: "applied",
515
515
  envelope: B,
516
516
  flowModel: k
517
517
  };
518
- return u.afterCommand(B, j, k), f.value = u.collectToolbarItems(), s.onCommandResult?.(X), s.onFlowModelChange?.({
518
+ return u.afterCommand(B, j, k), f.value = u.collectToolbarItems(), n.onCommandResult?.(X), n.onFlowModelChange?.({
519
519
  flowModel: k,
520
520
  prevFlowModel: j,
521
521
  envelope: B,
522
522
  source: B.source
523
523
  }), X;
524
524
  } catch (k) {
525
- if (k instanceof ue) {
525
+ if (k instanceof ge) {
526
526
  const X = {
527
527
  status: "invalid",
528
528
  envelope: B,
@@ -532,7 +532,7 @@ function Nn(s) {
532
532
  source: "engine"
533
533
  }
534
534
  };
535
- return s.onCommandResult?.(X), X;
535
+ return n.onCommandResult?.(X), X;
536
536
  }
537
537
  throw k;
538
538
  }
@@ -541,10 +541,10 @@ function Nn(s) {
541
541
  }
542
542
  const zt = ["top", "right", "bottom", "left"];
543
543
  function ut() {
544
- return zt.map((s) => ({ id: s, group: s }));
544
+ return zt.map((n) => ({ id: n, group: n }));
545
545
  }
546
- function Ue(s, e) {
547
- return e?.(s) ?? s.ports ?? ut();
546
+ function Ue(n, e) {
547
+ return e?.(n) ?? n.ports ?? ut();
548
548
  }
549
549
  const Fe = -1, Ut = "flow-canvas-node-ring-target", We = "flow-canvas-node-ring-target--decorated", Ve = "flow-canvas-node-ring-target--pulse", jt = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
550
550
  class Wt {
@@ -574,8 +574,8 @@ class Wt {
574
574
  edgeDefaultAttrs = /* @__PURE__ */ new Map();
575
575
  lastModel = null;
576
576
  pendingDecorationRAFs = /* @__PURE__ */ new Map();
577
- constructor(e, o, t, n, i, r) {
578
- this.graph = e, this.schema = o, this.shapeRegistry = t, this.resolveNodeDecoration = n, this.resolveEdgeDecoration = i, this.resolveCanvasContext = r;
577
+ constructor(e, o, t, s, r, i) {
578
+ this.graph = e, this.schema = o, this.shapeRegistry = t, this.resolveNodeDecoration = s, this.resolveEdgeDecoration = r, this.resolveCanvasContext = i;
579
579
  }
580
580
  syncFlowModel(e) {
581
581
  if (!this.syncing) {
@@ -596,21 +596,21 @@ class Wt {
596
596
  * 仅在节点首次创建时调用一次。
597
597
  */
598
598
  saveNodeDefaultAttrs(e, o) {
599
- const n = o.x6CellConfig?.attrs?.body;
600
- if (!n) return;
601
- const i = {};
602
- let r = !1;
603
- n.stroke !== void 0 && (i.stroke = n.stroke, r = !0), n.strokeWidth !== void 0 && (i.strokeWidth = n.strokeWidth, r = !0), r && this.nodeDefaultAttrs.set(e, i);
599
+ const s = o.x6CellConfig?.attrs?.body;
600
+ if (!s) return;
601
+ const r = {};
602
+ let i = !1;
603
+ s.stroke !== void 0 && (r.stroke = s.stroke, i = !0), s.strokeWidth !== void 0 && (r.strokeWidth = s.strokeWidth, i = !0), i && this.nodeDefaultAttrs.set(e, r);
604
604
  }
605
605
  /**
606
606
  * 从 x6EdgeConfig.attrs.line 中提取基线描边,用于管理层清理时恢复。
607
607
  */
608
608
  saveEdgeDefaultAttrs(e, o) {
609
- const n = o?.x6EdgeConfig?.attrs?.line;
610
- if (!n) return;
611
- const i = {};
612
- let r = !1;
613
- n.stroke !== void 0 && (i.stroke = n.stroke, r = !0), n.strokeWidth !== void 0 && (i.strokeWidth = n.strokeWidth, r = !0), n.strokeDasharray !== void 0 && (i.strokeDasharray = n.strokeDasharray, r = !0), r && this.edgeDefaultAttrs.set(e, i);
609
+ const s = o?.x6EdgeConfig?.attrs?.line;
610
+ if (!s) return;
611
+ const r = {};
612
+ let i = !1;
613
+ s.stroke !== void 0 && (r.stroke = s.stroke, i = !0), s.strokeWidth !== void 0 && (r.strokeWidth = s.strokeWidth, i = !0), s.strokeDasharray !== void 0 && (r.strokeDasharray = s.strokeDasharray, i = !0), i && this.edgeDefaultAttrs.set(e, r);
614
614
  }
615
615
  /**
616
616
  * 恢复节点 attr 到基线值;无基线时设为安全默认值。
@@ -619,18 +619,18 @@ class Wt {
619
619
  * 使得内部 Vue 组件 (width/height: 100%) 折叠后无法恢复。
620
620
  */
621
621
  restoreNodeAttr(e, o, t) {
622
- const n = this.nodeDefaultAttrs.get(e.id)?.[t];
623
- if (n !== void 0)
624
- e.setAttrByPath(o, n);
622
+ const s = this.nodeDefaultAttrs.get(e.id)?.[t];
623
+ if (s !== void 0)
624
+ e.setAttrByPath(o, s);
625
625
  else {
626
- const i = t === "stroke" ? "none" : 0;
627
- e.setAttrByPath(o, i);
626
+ const r = t === "stroke" ? "none" : 0;
627
+ e.setAttrByPath(o, r);
628
628
  }
629
629
  }
630
630
  /** 恢复边 attr 到基线值;无基线时移除。 */
631
631
  restoreEdgeAttr(e, o, t) {
632
- const n = this.edgeDefaultAttrs.get(e.id)?.[t];
633
- n !== void 0 ? this.setEdgeAttrIfChanged(e, o, n) : e.attr(o) !== void 0 && e.removeAttrByPath(o);
632
+ const s = this.edgeDefaultAttrs.get(e.id)?.[t];
633
+ s !== void 0 ? this.setEdgeAttrIfChanged(e, o, s) : e.attr(o) !== void 0 && e.removeAttrByPath(o);
634
634
  }
635
635
  /**
636
636
  * 仅在值实际变化时调用 setAttrByPath。
@@ -638,32 +638,32 @@ class Wt {
638
638
  * 即使值相同也会导致 EdgeView.update() → updateConnection() → 路由器全量重算。
639
639
  */
640
640
  setEdgeAttrIfChanged(e, o, t) {
641
- const n = e.attr(o), i = typeof n == "object" && n !== null, r = typeof t == "object" && t !== null;
642
- n !== t && (i && r && JSON.stringify(n) === JSON.stringify(t) || e.setAttrByPath(o, t));
641
+ const s = e.attr(o), r = typeof s == "object" && s !== null, i = typeof t == "object" && t !== null;
642
+ s !== t && (r && i && JSON.stringify(s) === JSON.stringify(t) || e.setAttrByPath(o, t));
643
643
  }
644
644
  getNodeRingTarget(e) {
645
645
  return e ? e.querySelector(".flow-canvas-highlight-target") ?? e.querySelector(".flow-canvas-node-surface > :first-child") : null;
646
646
  }
647
647
  /** 让正式边接管交互式预览边时,恢复 schema 定义的端点 marker。 */
648
648
  syncEdgeMarker(e, o, t) {
649
- const i = o?.x6EdgeConfig?.attrs?.line?.[t], r = `line/${t}`;
650
- e.removeAttrByPath(r), i !== void 0 && e.setAttrByPath(r, i);
649
+ const r = o?.x6EdgeConfig?.attrs?.line?.[t], i = `line/${t}`;
650
+ e.removeAttrByPath(i), r !== void 0 && e.setAttrByPath(i, r);
651
651
  }
652
652
  getEdgeMarkerConfig(e, o) {
653
- const n = e?.x6EdgeConfig?.attrs?.line?.[o];
654
- if (n)
655
- return typeof n == "string" ? { name: n } : { ...n };
653
+ const s = e?.x6EdgeConfig?.attrs?.line?.[o];
654
+ if (s)
655
+ return typeof s == "string" ? { name: s } : { ...s };
656
656
  }
657
- applyEdgeMarkerDecoration(e, o, t, n) {
658
- if (!n) {
657
+ applyEdgeMarkerDecoration(e, o, t, s) {
658
+ if (!s) {
659
659
  this.prevEdgeDecorationMarkerIds.has(e.id) && (this.syncEdgeMarker(e, o, t), this.prevEdgeDecorationMarkerIds.delete(e.id));
660
660
  return;
661
661
  }
662
- const i = this.getEdgeMarkerConfig(o, t) ?? { name: "block", width: 8, height: 8 };
662
+ const r = this.getEdgeMarkerConfig(o, t) ?? { name: "block", width: 8, height: 8 };
663
663
  this.setEdgeAttrIfChanged(e, `line/${t}`, {
664
- ...i,
665
- stroke: n,
666
- fill: n
664
+ ...r,
665
+ stroke: s,
666
+ fill: s
667
667
  }), this.prevEdgeDecorationMarkerIds.add(e.id);
668
668
  }
669
669
  dispose() {
@@ -673,22 +673,22 @@ class Wt {
673
673
  }
674
674
  resolveNodes(e) {
675
675
  const o = /* @__PURE__ */ new Map();
676
- for (const [t, n] of Object.entries(e.nodes)) {
677
- const i = this.schema.nodeTypes[n.type];
678
- if (!i)
676
+ for (const [t, s] of Object.entries(e.nodes)) {
677
+ const r = this.schema.nodeTypes[s.type];
678
+ if (!r)
679
679
  throw new kt(
680
- `Unknown node type "${n.type}" for node "${t}". Registered types: [${Object.keys(this.schema.nodeTypes).join(", ")}]. Register the type in CanvasSchema.nodeTypes before using it in a FlowModel.`
680
+ `Unknown node type "${s.type}" for node "${t}". Registered types: [${Object.keys(this.schema.nodeTypes).join(", ")}]. Register the type in CanvasSchema.nodeTypes before using it in a FlowModel.`
681
681
  );
682
- const r = this.shapeRegistry.registerNodeType(n.type, i.component), l = i.getSize(n), a = Ue(n, i.getPorts);
683
- o.set(t, { model: n, definition: i, shapeName: r, size: l, ports: a });
682
+ const i = this.shapeRegistry.registerNodeType(s.type, r.component), l = r.getSize(s), a = Ue(s, r.getPorts);
683
+ o.set(t, { model: s, definition: r, shapeName: i, size: l, ports: a });
684
684
  }
685
685
  return o;
686
686
  }
687
687
  resolveEdges(e) {
688
688
  const o = /* @__PURE__ */ new Map();
689
- for (const [t, n] of Object.entries(e.edges)) {
690
- const i = n.type ?? this.schema.defaultEdgeType ?? "default", r = this.schema.edgeTypes?.[i];
691
- o.set(t, { model: n, definition: r });
689
+ for (const [t, s] of Object.entries(e.edges)) {
690
+ const r = s.type ?? this.schema.defaultEdgeType ?? "default", i = this.schema.edgeTypes?.[r];
691
+ o.set(t, { model: s, definition: i });
692
692
  }
693
693
  return o;
694
694
  }
@@ -696,18 +696,18 @@ class Wt {
696
696
  const o = new Set(e.keys());
697
697
  for (const t of this.knownNodeIds)
698
698
  if (!o.has(t)) {
699
- const n = this.graph.getCellById(t);
700
- n && this.graph.removeCell(n), this.knownNodeIds.delete(t), this.defaultHighlightedNodeIds.delete(t), this.prevNodeDecorationClasses.delete(t), this.prevNodeDecorationColors.delete(t), this.nodeDefaultAttrs.delete(t);
701
- const i = this.pendingDecorationRAFs.get(t);
702
- i && (cancelAnimationFrame(i), this.pendingDecorationRAFs.delete(t));
699
+ const s = this.graph.getCellById(t);
700
+ s && this.graph.removeCell(s), this.knownNodeIds.delete(t), this.defaultHighlightedNodeIds.delete(t), this.prevNodeDecorationClasses.delete(t), this.prevNodeDecorationColors.delete(t), this.nodeDefaultAttrs.delete(t);
701
+ const r = this.pendingDecorationRAFs.get(t);
702
+ r && (cancelAnimationFrame(r), this.pendingDecorationRAFs.delete(t));
703
703
  }
704
- for (const [t, n] of e) {
705
- const i = this.graph.getCellById(t);
706
- i ? this.updateExistingNode(i, n) : this.addNewNode(t, n);
704
+ for (const [t, s] of e) {
705
+ const r = this.graph.getCellById(t);
706
+ r ? this.updateExistingNode(r, s) : this.addNewNode(t, s);
707
707
  }
708
708
  }
709
709
  updateExistingNode(e, o) {
710
- const { model: t, size: n, ports: i, definition: r } = o;
710
+ const { model: t, size: s, ports: r, definition: i } = o;
711
711
  if (e.getData()?.type !== t.type) {
712
712
  this.graph.removeCell(e), this.addNewNode(e.id, o);
713
713
  return;
@@ -715,23 +715,23 @@ class Wt {
715
715
  const a = e.getPosition();
716
716
  (a.x !== t.position.x || a.y !== t.position.y) && e.setPosition(t.position.x, t.position.y);
717
717
  const h = e.getSize();
718
- (h.width !== n.width || h.height !== n.height) && e.setSize(n.width, n.height, { silent: !0 }), this.syncNodePorts(e, i), e.setData({ ...t }), this.applyNodeBehavior(e, t, r), this.applyNodeHighlightAndDecoration(e, t);
718
+ (h.width !== s.width || h.height !== s.height) && e.setSize(s.width, s.height, { silent: !0 }), this.syncNodePorts(e, r), e.setData({ ...t }), this.applyNodeBehavior(e, t, i), this.applyNodeHighlightAndDecoration(e, t);
719
719
  }
720
720
  syncNodePorts(e, o) {
721
- const t = e.getPorts(), n = new Set(o.map((r) => r.id)), i = new Set(t.map((r) => r.id));
722
- for (const r of t)
723
- r.id && !n.has(r.id) && e.removePort(r.id);
724
- for (const r of o)
725
- i.has(r.id) || e.addPort({ id: r.id, group: r.group, ...r.x6PortConfig });
721
+ const t = e.getPorts(), s = new Set(o.map((i) => i.id)), r = new Set(t.map((i) => i.id));
722
+ for (const i of t)
723
+ i.id && !s.has(i.id) && e.removePort(i.id);
724
+ for (const i of o)
725
+ r.has(i.id) || e.addPort({ id: i.id, group: i.group, ...i.x6PortConfig });
726
726
  }
727
727
  addNewNode(e, o) {
728
- const { model: t, shapeName: n, size: i, ports: r, definition: l } = o, a = {
728
+ const { model: t, shapeName: s, size: r, ports: i, definition: l } = o, a = {
729
729
  id: t.id,
730
- shape: n,
730
+ shape: s,
731
731
  x: t.position.x,
732
732
  y: t.position.y,
733
- width: i.width,
734
- height: i.height,
733
+ width: r.width,
734
+ height: r.height,
735
735
  data: { ...t },
736
736
  ports: {
737
737
  groups: {
@@ -760,7 +760,7 @@ class Wt {
760
760
  }
761
761
  }
762
762
  },
763
- items: r.map((f) => ({ id: f.id, group: f.group, ...f.x6PortConfig }))
763
+ items: i.map((f) => ({ id: f.id, group: f.group, ...f.x6PortConfig }))
764
764
  },
765
765
  ...l.x6CellConfig
766
766
  };
@@ -777,16 +777,16 @@ class Wt {
777
777
  scheduleDecorationRetryIfNeeded(e) {
778
778
  const o = this.graph.findViewByCell(e)?.container;
779
779
  if (this.getNodeRingTarget(o)) return;
780
- const t = e.id, n = this.pendingDecorationRAFs.get(t);
781
- n && cancelAnimationFrame(n);
782
- const i = requestAnimationFrame(() => {
780
+ const t = e.id, s = this.pendingDecorationRAFs.get(t);
781
+ s && cancelAnimationFrame(s);
782
+ const r = requestAnimationFrame(() => {
783
783
  if (this.pendingDecorationRAFs.delete(t), !this.knownNodeIds.has(t)) return;
784
- const r = this.lastModel?.nodes[t];
785
- if (!r) return;
784
+ const i = this.lastModel?.nodes[t];
785
+ if (!i) return;
786
786
  const l = this.graph.getCellById(t);
787
- l?.isNode() && this.applyNodeHighlightAndDecoration(l, r);
787
+ l?.isNode() && this.applyNodeHighlightAndDecoration(l, i);
788
788
  });
789
- this.pendingDecorationRAFs.set(t, i);
789
+ this.pendingDecorationRAFs.set(t, r);
790
790
  }
791
791
  /**
792
792
  * 将 schema 定义的 getBehavior 映射到 X6 节点属性。
@@ -802,32 +802,32 @@ class Wt {
802
802
  */
803
803
  applyNodeBehavior(e, o, t) {
804
804
  if (!t.getBehavior) return;
805
- const n = this.resolveCanvasContext?.();
806
- if (!n) return;
807
- const i = t.getBehavior(o, n);
808
- if (i.draggable !== void 0 && e.setProp("draggable", i.draggable, { silent: !0 }), i.connectable !== void 0) {
809
- const l = i.connectable ? !0 : i.targetable === !1 ? !1 : "passive";
805
+ const s = this.resolveCanvasContext?.();
806
+ if (!s) return;
807
+ const r = t.getBehavior(o, s);
808
+ if (r.draggable !== void 0 && e.setProp("draggable", r.draggable, { silent: !0 }), r.connectable !== void 0) {
809
+ const l = r.connectable ? !0 : r.targetable === !1 ? !1 : "passive";
810
810
  for (const a of e.getPorts())
811
811
  e.setPortProp(a.id, "attrs/circle/magnet", l, { silent: !0 });
812
812
  }
813
- if (i.showPorts !== void 0) {
814
- const l = i.showPorts;
813
+ if (r.showPorts !== void 0) {
814
+ const l = r.showPorts;
815
815
  for (const a of e.getPorts())
816
816
  e.setPortProp(a.id, "attrs/circle/visibility", l ? "visible" : "hidden", { silent: !0 });
817
817
  }
818
- const r = e.getData() ?? {};
819
- i.deletable !== void 0 && r._deletable !== i.deletable && e.setData({ ...r, _deletable: i.deletable }, { silent: !0 }), i.selectable !== void 0 && r._selectable !== i.selectable && e.setData({ ...e.getData(), _selectable: i.selectable }, { silent: !0 });
818
+ const i = e.getData() ?? {};
819
+ r.deletable !== void 0 && i._deletable !== r.deletable && e.setData({ ...i, _deletable: r.deletable }, { silent: !0 }), r.selectable !== void 0 && i._selectable !== r.selectable && e.setData({ ...e.getData(), _selectable: r.selectable }, { silent: !0 });
820
820
  }
821
821
  syncEdges(e, o) {
822
822
  const t = new Set(e.keys());
823
- for (const n of this.knownEdgeIds)
824
- if (!t.has(n)) {
825
- const i = this.graph.getCellById(n);
826
- i && this.graph.removeCell(i), this.knownEdgeIds.delete(n), this.defaultHighlightedEdgeIds.delete(n), this.prevEdgeDecorationClasses.delete(n), this.prevEdgeDecorationColors.delete(n), this.prevEdgeDecorationMarkerIds.delete(n), this.prevEdgeStyleIds.delete(n), this.edgeDefaultAttrs.delete(n);
823
+ for (const s of this.knownEdgeIds)
824
+ if (!t.has(s)) {
825
+ const r = this.graph.getCellById(s);
826
+ r && this.graph.removeCell(r), this.knownEdgeIds.delete(s), this.defaultHighlightedEdgeIds.delete(s), this.prevEdgeDecorationClasses.delete(s), this.prevEdgeDecorationColors.delete(s), this.prevEdgeDecorationMarkerIds.delete(s), this.prevEdgeStyleIds.delete(s), this.edgeDefaultAttrs.delete(s);
827
827
  }
828
- for (const [n, i] of e) {
829
- const r = this.graph.getCellById(n), { model: l, definition: a } = i;
830
- r ? (this.updateExistingEdge(r, l, a, o), this.knownEdgeIds.has(n) || (this.knownEdgeIds.add(n), this.saveEdgeDefaultAttrs(n, a))) : this.addNewEdge(n, l, a);
828
+ for (const [s, r] of e) {
829
+ const i = this.graph.getCellById(s), { model: l, definition: a } = r;
830
+ i ? (this.updateExistingEdge(i, l, a, o), this.knownEdgeIds.has(s) || (this.knownEdgeIds.add(s), this.saveEdgeDefaultAttrs(s, a))) : this.addNewEdge(s, l, a);
831
831
  }
832
832
  }
833
833
  /**
@@ -835,8 +835,8 @@ class Wt {
835
835
  * X6 Edge.getSource() 返回 { cell, port } 格式,与 FlowEdgeModel 的 { nodeId, portId } 不同,
836
836
  * 需要用 (currentSource as any).cell 来比较。
837
837
  */
838
- updateExistingEdge(e, o, t, n) {
839
- const i = e.getSource(), r = e.getTarget(), l = i.cell !== o.source.nodeId || i.port !== o.source.portId, a = r.cell !== o.target.nodeId || r.port !== o.target.portId;
838
+ updateExistingEdge(e, o, t, s) {
839
+ const r = e.getSource(), i = e.getTarget(), l = r.cell !== o.source.nodeId || r.port !== o.source.portId, a = i.cell !== o.target.nodeId || i.port !== o.target.portId;
840
840
  l && e.setSource({ cell: o.source.nodeId, port: o.source.portId }), a && e.setTarget({ cell: o.target.nodeId, port: o.target.portId });
841
841
  const f = (e.getData()?.type ?? void 0) !== (o.type ?? void 0);
842
842
  if (f) {
@@ -856,28 +856,28 @@ class Wt {
856
856
  e.getLabels().length > 0 && e.setLabels([]);
857
857
  return;
858
858
  }
859
- const t = o.labels.map((n) => ({
859
+ const t = o.labels.map((s) => ({
860
860
  attrs: {
861
- label: { text: n.text ?? "" }
861
+ label: { text: s.text ?? "" }
862
862
  },
863
- position: n.position != null ? { distance: n.position } : void 0
863
+ position: s.position != null ? { distance: s.position } : void 0
864
864
  }));
865
865
  e.setLabels(t);
866
866
  }
867
867
  addNewEdge(e, o, t) {
868
- const n = {
868
+ const s = {
869
869
  id: o.id,
870
870
  source: { cell: o.source.nodeId, port: o.source.portId },
871
871
  target: { cell: o.target.nodeId, port: o.target.portId },
872
872
  data: { ...o },
873
873
  zIndex: Fe
874
874
  };
875
- t?.router && (n.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (n.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(n, t.x6EdgeConfig), o.labels?.length && (n.labels = o.labels.map((r) => ({
876
- attrs: { label: { text: r.text ?? "" } },
877
- position: r.position != null ? { distance: r.position } : void 0
878
- }))), this.graph.addEdge(n), this.knownEdgeIds.add(e), this.saveEdgeDefaultAttrs(e, t);
879
- const i = this.graph.getCellById(e);
880
- i && this.applyEdgeStyleAndDecoration(i, o, t);
875
+ t?.router && (s.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (s.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(s, t.x6EdgeConfig), o.labels?.length && (s.labels = o.labels.map((i) => ({
876
+ attrs: { label: { text: i.text ?? "" } },
877
+ position: i.position != null ? { distance: i.position } : void 0
878
+ }))), this.graph.addEdge(s), this.knownEdgeIds.add(e), this.saveEdgeDefaultAttrs(e, t);
879
+ const r = this.graph.getCellById(e);
880
+ r && this.applyEdgeStyleAndDecoration(r, o, t);
881
881
  }
882
882
  /**
883
883
  * 重算所有边的视觉样式。
@@ -888,8 +888,8 @@ class Wt {
888
888
  for (const [e, o] of Object.entries(this.lastModel.edges)) {
889
889
  const t = this.graph.getCellById(e);
890
890
  if (!t?.isEdge()) continue;
891
- const n = o.type ?? this.schema.defaultEdgeType ?? "default", i = this.schema.edgeTypes?.[n];
892
- this.applyEdgeStyleAndDecoration(t, o, i);
891
+ const s = o.type ?? this.schema.defaultEdgeType ?? "default", r = this.schema.edgeTypes?.[s];
892
+ this.applyEdgeStyleAndDecoration(t, o, r);
893
893
  }
894
894
  }
895
895
  /**
@@ -902,8 +902,8 @@ class Wt {
902
902
  if (!o) return;
903
903
  const t = this.graph.getCellById(e);
904
904
  if (!t?.isEdge()) return;
905
- const n = o.type ?? this.schema.defaultEdgeType ?? "default", i = this.schema.edgeTypes?.[n];
906
- this.applyEdgeStyleAndDecoration(t, o, i);
905
+ const s = o.type ?? this.schema.defaultEdgeType ?? "default", r = this.schema.edgeTypes?.[s];
906
+ this.applyEdgeStyleAndDecoration(t, o, r);
907
907
  }
908
908
  /**
909
909
  * 重算所有节点的高亮 + 装饰视觉。
@@ -928,13 +928,13 @@ class Wt {
928
928
  * body/stroke 仅作为普通 SVG shape 的兜底同步。
929
929
  */
930
930
  applyNodeHighlightAndDecoration(e, o) {
931
- const t = this.highlightedNodeIds.has(e.id), n = this.resolveNodeDecoration?.(o), i = this.graph.findViewByCell(e)?.container, r = this.getNodeRingTarget(i), l = this.prevNodeDecorationClasses.get(e.id);
932
- l && (i?.classList.remove(l), this.prevNodeDecorationClasses.delete(e.id)), n?.className && (i?.classList.add(n.className), this.prevNodeDecorationClasses.set(e.id, n.className));
933
- const a = n?.borderColor, f = a ?? (t ? "#3a84ff" : void 0), p = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
934
- f ? (e.setAttrByPath("body/stroke", f), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), r && (r.classList.add(Ut), a ? (r.classList.add(We), r.style.setProperty("--flow-canvas-node-decoration-ring-background", a), r.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (r.classList.remove(We), r.style.removeProperty("--flow-canvas-node-decoration-ring-background"), r.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), t ? (r.classList.add(Ve), r.style.setProperty(
931
+ const t = this.highlightedNodeIds.has(e.id), s = this.resolveNodeDecoration?.(o), r = this.graph.findViewByCell(e)?.container, i = this.getNodeRingTarget(r), l = this.prevNodeDecorationClasses.get(e.id);
932
+ l && (r?.classList.remove(l), this.prevNodeDecorationClasses.delete(e.id)), s?.className && (r?.classList.add(s.className), this.prevNodeDecorationClasses.set(e.id, s.className));
933
+ const a = s?.borderColor, f = a ?? (t ? "#3a84ff" : void 0), p = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
934
+ f ? (e.setAttrByPath("body/stroke", f), e.setAttrByPath("body/strokeWidth", 2)) : p && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), i && (i.classList.add(Ut), a ? (i.classList.add(We), i.style.setProperty("--flow-canvas-node-decoration-ring-background", a), i.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (i.classList.remove(We), i.style.removeProperty("--flow-canvas-node-decoration-ring-background"), i.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), t ? (i.classList.add(Ve), i.style.setProperty(
935
935
  "--flow-canvas-node-pulse-ring-background",
936
936
  a ?? jt
937
- ), r.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (r.classList.remove(Ve), r.style.removeProperty("--flow-canvas-node-pulse-ring-background"), r.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), t && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
937
+ ), i.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (i.classList.remove(Ve), i.style.removeProperty("--flow-canvas-node-pulse-ring-background"), i.style.removeProperty("--flow-canvas-node-pulse-ring-opacity"))), a ? this.prevNodeDecorationColors.add(e.id) : this.prevNodeDecorationColors.delete(e.id), t && !a ? this.defaultHighlightedNodeIds.add(e.id) : this.defaultHighlightedNodeIds.delete(e.id);
938
938
  }
939
939
  getHoveredEdgeId() {
940
940
  return this.hoveredEdgeId;
@@ -961,19 +961,19 @@ class Wt {
961
961
  * 最终值 = decorationStroke ?? styleStroke ?? defaultHighlightStroke ?? (清除)。
962
962
  */
963
963
  applyEdgeStyleAndDecoration(e, o, t) {
964
- const n = this.highlightedEdgeIds.has(e.id), i = this.resolveEdgeDecoration?.(o), r = this.prevEdgeDecorationClasses.get(e.id);
965
- r && (this.graph.findViewByCell(e)?.container?.classList.remove(r), this.prevEdgeDecorationClasses.delete(e.id)), i?.className && (this.graph.findViewByCell(e)?.container?.classList.add(i.className), this.prevEdgeDecorationClasses.set(e.id, i.className));
964
+ const s = this.highlightedEdgeIds.has(e.id), r = this.resolveEdgeDecoration?.(o), i = this.prevEdgeDecorationClasses.get(e.id);
965
+ i && (this.graph.findViewByCell(e)?.container?.classList.remove(i), this.prevEdgeDecorationClasses.delete(e.id)), r?.className && (this.graph.findViewByCell(e)?.container?.classList.add(r.className), this.prevEdgeDecorationClasses.set(e.id, r.className));
966
966
  let l, a, h;
967
967
  if (t?.style) {
968
- const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, S = t.style(o, { selected: O, highlighted: n, hovered: b });
968
+ const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, S = t.style(o, { selected: O, highlighted: s, hovered: b });
969
969
  l = S.stroke, a = S.strokeWidth, h = S.strokeDasharray;
970
970
  }
971
- const f = !t?.style && n ? "#3a84ff" : void 0, p = i?.strokeColor, u = i?.targetMarkerColor, w = p ?? l ?? f, D = !!t?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
971
+ const f = !t?.style && s ? "#3a84ff" : void 0, p = r?.strokeColor, u = r?.targetMarkerColor, w = p ?? l ?? f, D = !!t?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
972
972
  w ? this.setEdgeAttrIfChanged(e, "line/stroke", w) : D && this.restoreEdgeAttr(e, "line/stroke", "stroke"), this.applyEdgeMarkerDecoration(e, t, "targetMarker", u), t?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), h ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", h) : this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray")) : this.prevEdgeStyleIds.has(e.id) && (this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), this.restoreEdgeAttr(e, "line/strokeDasharray", "strokeDasharray"), this.prevEdgeStyleIds.delete(e.id)), p ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), f ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(e.id);
973
973
  }
974
974
  }
975
975
  class Vt {
976
- instanceId = J();
976
+ instanceId = ee();
977
977
  registeredShapes = /* @__PURE__ */ new Map();
978
978
  wrappedComponents = /* @__PURE__ */ new Map();
979
979
  getShapeName(e) {
@@ -982,15 +982,15 @@ class Vt {
982
982
  }
983
983
  registerNodeType(e, o) {
984
984
  const t = this.getShapeName(e);
985
- let n = this.wrappedComponents.get(e);
986
- return n || (n = fe({
987
- name: `FlowCanvasNodeShape${e.replace(/(^|[-_])(\w)/g, (i, r, l) => l.toUpperCase())}`,
985
+ let s = this.wrappedComponents.get(e);
986
+ return s || (s = pe({
987
+ name: `FlowCanvasNodeShape${e.replace(/(^|[-_])(\w)/g, (r, i, l) => l.toUpperCase())}`,
988
988
  setup() {
989
989
  return () => qe("div", { class: "flow-canvas-node-surface" }, [qe(o)]);
990
990
  }
991
- }), this.wrappedComponents.set(e, n)), xt({
991
+ }), this.wrappedComponents.set(e, s)), xt({
992
992
  shape: t,
993
- component: n,
993
+ component: s,
994
994
  width: 100,
995
995
  height: 40
996
996
  }), t;
@@ -1006,8 +1006,8 @@ class Xt {
1006
1006
  flowModelRef;
1007
1007
  idGenerator;
1008
1008
  disposers = [];
1009
- constructor(e, o, t, n, i) {
1010
- this.graph = e, this.onUiEvent = o, this.onCommand = t, this.flowModelRef = n, this.idGenerator = i ?? ze, this.bindEvents();
1009
+ constructor(e, o, t, s, r) {
1010
+ this.graph = e, this.onUiEvent = o, this.onCommand = t, this.flowModelRef = s, this.idGenerator = r ?? ze, this.bindEvents();
1011
1011
  }
1012
1012
  dispose() {
1013
1013
  for (const e of this.disposers) e();
@@ -1029,9 +1029,9 @@ class Xt {
1029
1029
  position: { x: o.clientX, y: o.clientY }
1030
1030
  });
1031
1031
  }), this.on("edge:click", ({ edge: e, e: o }) => {
1032
- const n = o.target?.closest?.(".x6-edge-label");
1033
- if (n) {
1034
- const r = e.getData?.()?.labels ?? [], l = n.parentElement?.querySelectorAll(".x6-edge-label"), a = l ? Array.from(l).indexOf(n) : 0, h = r[Math.max(0, a)];
1032
+ const s = o.target?.closest?.(".x6-edge-label");
1033
+ if (s) {
1034
+ const i = e.getData?.()?.labels ?? [], l = s.parentElement?.querySelectorAll(".x6-edge-label"), a = l ? Array.from(l).indexOf(s) : 0, h = i[Math.max(0, a)];
1035
1035
  this.onUiEvent({
1036
1036
  type: "edge.label.click",
1037
1037
  edgeId: e.id,
@@ -1051,18 +1051,18 @@ class Xt {
1051
1051
  }), this.on("node:moved", ({ node: e }) => {
1052
1052
  const o = e.getPosition();
1053
1053
  this.onCommand({
1054
- id: J(),
1054
+ id: ee(),
1055
1055
  source: "user:drag",
1056
1056
  label: "移动节点",
1057
1057
  timestamp: Date.now(),
1058
1058
  commands: [{ type: "node.move", nodeId: e.id, position: { x: o.x, y: o.y } }]
1059
1059
  });
1060
1060
  }), this.on("edge:connected", ({ edge: e, isNew: o }) => {
1061
- const t = e.getSourceCell(), n = e.getTargetCell();
1062
- if (!t || !n) return;
1063
- const i = e.getSourcePortId(), r = e.getTargetPortId(), l = e.id in this.flowModelRef.value.edges;
1061
+ const t = e.getSourceCell(), s = e.getTargetCell();
1062
+ if (!t || !s) return;
1063
+ const r = e.getSourcePortId(), i = e.getTargetPortId(), l = e.id in this.flowModelRef.value.edges;
1064
1064
  o && !l ? (this.graph.removeCell(e), this.onCommand({
1065
- id: J(),
1065
+ id: ee(),
1066
1066
  source: "user:drag",
1067
1067
  label: "连线",
1068
1068
  timestamp: Date.now(),
@@ -1071,13 +1071,13 @@ class Xt {
1071
1071
  type: "edge.add",
1072
1072
  edge: {
1073
1073
  id: this.idGenerator("edge"),
1074
- source: { nodeId: t.id, portId: i ?? void 0 },
1075
- target: { nodeId: n.id, portId: r ?? void 0 }
1074
+ source: { nodeId: t.id, portId: r ?? void 0 },
1075
+ target: { nodeId: s.id, portId: i ?? void 0 }
1076
1076
  }
1077
1077
  }
1078
1078
  ]
1079
1079
  })) : this.onCommand({
1080
- id: J(),
1080
+ id: ee(),
1081
1081
  source: "user:drag",
1082
1082
  label: "重连",
1083
1083
  timestamp: Date.now(),
@@ -1085,32 +1085,32 @@ class Xt {
1085
1085
  {
1086
1086
  type: "edge.reconnect",
1087
1087
  edgeId: e.id,
1088
- source: { nodeId: t.id, portId: i ?? void 0 },
1089
- target: { nodeId: n.id, portId: r ?? void 0 }
1088
+ source: { nodeId: t.id, portId: r ?? void 0 },
1089
+ target: { nodeId: s.id, portId: i ?? void 0 }
1090
1090
  }
1091
1091
  ]
1092
1092
  });
1093
1093
  }), this.on("edge:change:labels", ({ edge: e, current: o }) => {
1094
- const n = e.getData?.()?.labels ?? [];
1095
- if (!n.length || !o?.length) return;
1096
- const i = [];
1097
- for (let r = 0; r < Math.min(n.length, o.length); r++) {
1098
- const l = o[r], a = n[r];
1094
+ const s = e.getData?.()?.labels ?? [];
1095
+ if (!s.length || !o?.length) return;
1096
+ const r = [];
1097
+ for (let i = 0; i < Math.min(s.length, o.length); i++) {
1098
+ const l = o[i], a = s[i];
1099
1099
  if (!a?.id) continue;
1100
1100
  const h = typeof l.position == "object" ? l.position?.distance : l.position;
1101
- h != null && i.push({
1101
+ h != null && r.push({
1102
1102
  type: "edge.label.update",
1103
1103
  edgeId: e.id,
1104
1104
  labelId: a.id,
1105
1105
  patch: { position: h }
1106
1106
  });
1107
1107
  }
1108
- i.length && this.onCommand({
1109
- id: J(),
1108
+ r.length && this.onCommand({
1109
+ id: ee(),
1110
1110
  source: "user:drag",
1111
1111
  label: "拖动标签",
1112
1112
  timestamp: Date.now(),
1113
- commands: i
1113
+ commands: r
1114
1114
  });
1115
1115
  });
1116
1116
  }
@@ -1118,20 +1118,20 @@ class Xt {
1118
1118
  this.graph.on(e, o), this.disposers.push(() => this.graph.off(e, o));
1119
1119
  }
1120
1120
  }
1121
- function Kt(s) {
1121
+ function Kt(n) {
1122
1122
  function e(t) {
1123
- const n = s.getCellById(t);
1124
- if (!n || !n.isNode()) return null;
1125
- const i = n, r = i.getPosition(), l = i.getSize(), a = { x: r.x, y: r.y, width: l.width, height: l.height }, h = s.localToGraph(a);
1123
+ const s = n.getCellById(t);
1124
+ if (!s || !s.isNode()) return null;
1125
+ const r = s, i = r.getPosition(), l = r.getSize(), a = { x: i.x, y: i.y, width: l.width, height: l.height }, h = n.localToGraph(a);
1126
1126
  return new DOMRect(h.x, h.y, h.width, h.height);
1127
1127
  }
1128
1128
  function o(t) {
1129
- const n = e(t);
1130
- if (!n) return null;
1131
- const i = s.container;
1132
- if (!i || typeof i.getBoundingClientRect != "function") return n;
1133
- const r = i.getBoundingClientRect();
1134
- return new DOMRect(n.x + r.left, n.y + r.top, n.width, n.height);
1129
+ const s = e(t);
1130
+ if (!s) return null;
1131
+ const r = n.container;
1132
+ if (!r || typeof r.getBoundingClientRect != "function") return s;
1133
+ const i = r.getBoundingClientRect();
1134
+ return new DOMRect(s.x + i.left, s.y + i.top, s.width, s.height);
1135
1135
  }
1136
1136
  return {
1137
1137
  getNodeScreenRect: e,
@@ -1144,64 +1144,64 @@ const Yt = Object.freeze({
1144
1144
  bottom: 8,
1145
1145
  left: 8
1146
1146
  });
1147
- function ft(s) {
1147
+ function ft(n) {
1148
1148
  return {
1149
- nodeIds: s.filter((e) => e.isNode()).map((e) => e.id),
1150
- edgeIds: s.filter((e) => e.isEdge()).map((e) => e.id)
1149
+ nodeIds: n.filter((e) => e.isNode()).map((e) => e.id),
1150
+ edgeIds: n.filter((e) => e.isEdge()).map((e) => e.id)
1151
1151
  };
1152
1152
  }
1153
- function Zt(s, e = Yt) {
1153
+ function Zt(n, e = Yt) {
1154
1154
  return new DOMRect(
1155
- s.x - e.left,
1156
- s.y - e.top,
1157
- s.width + e.left + e.right,
1158
- s.height + e.top + e.bottom
1155
+ n.x - e.left,
1156
+ n.y - e.top,
1157
+ n.width + e.left + e.right,
1158
+ n.height + e.top + e.bottom
1159
1159
  );
1160
1160
  }
1161
- function Qt(s, e) {
1161
+ function Qt(n, e) {
1162
1162
  const o = [
1163
- ...e.nodeIds.map((i) => s.getCellById(i)),
1164
- ...e.edgeIds.map((i) => s.getCellById(i))
1165
- ].filter((i) => !!i);
1163
+ ...e.nodeIds.map((r) => n.getCellById(r)),
1164
+ ...e.edgeIds.map((r) => n.getCellById(r))
1165
+ ].filter((r) => !!r);
1166
1166
  if (o.length === 0) return null;
1167
- const t = s.getCellsBBox(o);
1167
+ const t = n.getCellsBBox(o);
1168
1168
  if (!t) return null;
1169
- const n = s.localToGraph(t);
1170
- return Zt(n);
1169
+ const s = n.localToGraph(t);
1170
+ return Zt(s);
1171
1171
  }
1172
- function gt(s, e, o) {
1173
- const t = s.nodeIds.filter((r) => {
1174
- const l = e.nodes[r];
1172
+ function gt(n, e, o) {
1173
+ const t = n.nodeIds.filter((i) => {
1174
+ const l = e.nodes[i];
1175
1175
  if (!l) return !1;
1176
1176
  const a = o(l);
1177
1177
  return a.deletable !== !1 && a.deleteDisabled !== !0;
1178
- }), n = new Set(t), i = s.edgeIds.filter((r) => {
1179
- const l = e.edges[r];
1180
- return l ? !n.has(l.source.nodeId) && !n.has(l.target.nodeId) : !1;
1178
+ }), s = new Set(t), r = n.edgeIds.filter((i) => {
1179
+ const l = e.edges[i];
1180
+ return l ? !s.has(l.source.nodeId) && !s.has(l.target.nodeId) : !1;
1181
1181
  });
1182
- return { nodeIds: t, edgeIds: i };
1182
+ return { nodeIds: t, edgeIds: r };
1183
1183
  }
1184
- function Jt(s) {
1184
+ function Jt(n) {
1185
1185
  return [
1186
- ...s.edgeIds.map((e) => ({ type: "edge.remove", edgeId: e })),
1187
- ...s.nodeIds.map((e) => ({ type: "node.remove", nodeId: e }))
1186
+ ...n.edgeIds.map((e) => ({ type: "edge.remove", edgeId: e })),
1187
+ ...n.nodeIds.map((e) => ({ type: "node.remove", nodeId: e }))
1188
1188
  ];
1189
1189
  }
1190
1190
  const eo = 100;
1191
1191
  function to({
1192
- graph: s,
1192
+ graph: n,
1193
1193
  overlayManager: e,
1194
1194
  executeCommand: o,
1195
1195
  schema: t,
1196
- flowModel: n,
1197
- getNodeBehavior: i,
1198
- idGenerator: r,
1196
+ flowModel: s,
1197
+ getNodeBehavior: r,
1198
+ idGenerator: i,
1199
1199
  defaultInsertGap: l,
1200
1200
  getContextMenuItems: a,
1201
1201
  onHighlightChange: h,
1202
1202
  resolveNodeShape: f
1203
1203
  }) {
1204
- const p = r ?? ze;
1204
+ const p = i ?? ze;
1205
1205
  let u = [], w = [], D = null, O = !1, b = null;
1206
1206
  async function S() {
1207
1207
  if (O) return D;
@@ -1209,7 +1209,7 @@ function to({
1209
1209
  try {
1210
1210
  const d = await import("@antv/x6-plugin-dnd"), y = d.Dnd ?? d.default;
1211
1211
  return y ? (D = new y({
1212
- target: s,
1212
+ target: n,
1213
1213
  scaled: !0,
1214
1214
  animation: !0,
1215
1215
  getDragNode: (c) => c.clone(),
@@ -1229,10 +1229,10 @@ function to({
1229
1229
  if (!y?._dndSessionId || y._dndSessionId !== b) return;
1230
1230
  b = null;
1231
1231
  const c = d.getPosition();
1232
- s.removeNode(d.id);
1232
+ n.removeNode(d.id);
1233
1233
  const { _dndSessionId: g, ...v } = y, m = v.id || p("node");
1234
1234
  o({
1235
- id: J(),
1235
+ id: ee(),
1236
1236
  source: "user:drag",
1237
1237
  label: "拖入节点",
1238
1238
  timestamp: Date.now(),
@@ -1244,13 +1244,13 @@ function to({
1244
1244
  ]
1245
1245
  });
1246
1246
  };
1247
- s.on("node:added", B);
1247
+ n.on("node:added", B);
1248
1248
  function j(d) {
1249
1249
  const y = t.nodeTypes[d.type];
1250
1250
  return Ue(d, y?.getPorts);
1251
1251
  }
1252
1252
  function k(d) {
1253
- return d ?? ft(s.getSelectedCells?.() ?? []);
1253
+ return d ?? ft(n.getSelectedCells?.() ?? []);
1254
1254
  }
1255
1255
  function X(d, y, c, g, v) {
1256
1256
  switch (d) {
@@ -1290,53 +1290,53 @@ function to({
1290
1290
  }
1291
1291
  const G = {
1292
1292
  zoomIn() {
1293
- s.zoom(0.1);
1293
+ n.zoom(0.1);
1294
1294
  },
1295
1295
  zoomOut() {
1296
- s.zoom(-0.1);
1296
+ n.zoom(-0.1);
1297
1297
  },
1298
1298
  zoomTo(d) {
1299
- s.zoomTo(d);
1299
+ n.zoomTo(d);
1300
1300
  },
1301
1301
  zoomToFit(d) {
1302
- s.zoomToFit({ padding: 40, maxScale: 1, ...d });
1302
+ n.zoomToFit({ padding: 40, maxScale: 1, ...d });
1303
1303
  },
1304
1304
  getZoom() {
1305
- return s.zoom();
1305
+ return n.zoom();
1306
1306
  },
1307
1307
  centerContent() {
1308
- s.centerContent();
1308
+ n.centerContent();
1309
1309
  },
1310
1310
  scrollToOrigin() {
1311
- s.translate(0, 0);
1311
+ n.translate(0, 0);
1312
1312
  },
1313
1313
  scrollToNode(d) {
1314
- const y = s.getCellById(d);
1315
- y && s.centerCell(y);
1314
+ const y = n.getCellById(d);
1315
+ y && n.centerCell(y);
1316
1316
  },
1317
1317
  getSelection() {
1318
1318
  return k();
1319
1319
  },
1320
1320
  getSelectionBounds(d) {
1321
- return Qt(s, k(d));
1321
+ return Qt(n, k(d));
1322
1322
  },
1323
1323
  selectNodes(d) {
1324
- const y = d.map((c) => s.getCellById(c)).filter(Boolean);
1325
- s.select?.(y);
1324
+ const y = d.map((c) => n.getCellById(c)).filter(Boolean);
1325
+ n.select?.(y);
1326
1326
  },
1327
1327
  selectEdges(d) {
1328
- const y = d.map((c) => s.getCellById(c)).filter(Boolean);
1329
- s.select?.(y);
1328
+ const y = d.map((c) => n.getCellById(c)).filter(Boolean);
1329
+ n.select?.(y);
1330
1330
  },
1331
1331
  clearSelection() {
1332
- const d = s.getSelectedCells?.();
1333
- d?.length && s.unselect?.(d);
1332
+ const d = n.getSelectedCells?.();
1333
+ d?.length && n.unselect?.(d);
1334
1334
  },
1335
1335
  deleteSelection(d) {
1336
- const y = k(d?.selection), c = gt(y, n.value, i ?? (() => ({}))), g = Jt(c);
1336
+ const y = k(d?.selection), c = gt(y, s.value, r ?? (() => ({}))), g = Jt(c);
1337
1337
  if (g.length === 0) return null;
1338
1338
  const v = o({
1339
- id: J(),
1339
+ id: ee(),
1340
1340
  source: d?.source ?? "user:toolbar",
1341
1341
  label: d?.label ?? "删除选中",
1342
1342
  timestamp: Date.now(),
@@ -1348,9 +1348,9 @@ function to({
1348
1348
  const c = async (g) => {
1349
1349
  const v = await S();
1350
1350
  if (!v) return;
1351
- const m = J();
1351
+ const m = ee();
1352
1352
  b = m;
1353
- const E = y(), L = f?.(E.type), z = s.createNode({
1353
+ const E = y(), L = f?.(E.type), z = n.createNode({
1354
1354
  width: L?.width ?? 154,
1355
1355
  height: L?.height ?? 54,
1356
1356
  shape: L?.shapeName ?? "rect",
@@ -1367,14 +1367,14 @@ function to({
1367
1367
  * 复用 X6 原生的连线拖拽流程与 connecting.createEdge 配置。
1368
1368
  */
1369
1369
  startConnection(d, y) {
1370
- const c = s.getCellById(d);
1370
+ const c = n.getCellById(d);
1371
1371
  if (!c?.isNode()) return;
1372
- const g = c, v = s.findViewByCell(g);
1372
+ const g = c, v = n.findViewByCell(g);
1373
1373
  if (!v) return;
1374
1374
  const m = v.findPortElem(y, "circle") ?? v.findPortElem(y);
1375
1375
  if (!m) return;
1376
- const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(), re = z.left + z.width / 2, N = z.top + z.height / 2, _ = new MouseEvent("mousedown", {
1377
- clientX: re,
1376
+ const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(), de = z.left + z.width / 2, N = z.top + z.height / 2, _ = new MouseEvent("mousedown", {
1377
+ clientX: de,
1378
1378
  clientY: N,
1379
1379
  button: 0,
1380
1380
  buttons: 1,
@@ -1384,32 +1384,37 @@ function to({
1384
1384
  L.dispatchEvent(_);
1385
1385
  },
1386
1386
  async exportAsImage(d) {
1387
- const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? s.options.background?.color ?? "#ffffff", v = s.zoom(), m = s.translate(), E = s.getContentBBox(), L = E.width / v, z = E.height / v;
1387
+ const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? n.options.background?.color ?? "#ffffff", v = n.zoom(), m = n.translate(), E = n.getContentBBox(), L = E.width / v, z = E.height / v;
1388
1388
  if (L === 0 || z === 0)
1389
1389
  return new Blob();
1390
- const re = (E.x - m.tx) / v, N = (E.y - m.ty) / v, _ = Math.ceil(L + c * 2), x = Math.ceil(z + c * 2), R = document.createElement("div");
1390
+ const de = (E.x - m.tx) / v, N = (E.y - m.ty) / v, _ = Math.ceil(L + c * 2), x = Math.ceil(z + c * 2), R = document.createElement("div");
1391
1391
  R.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1392
- const F = s.container.cloneNode(!0);
1393
- F.style.width = `${_}px`, F.style.height = `${x}px`, F.style.overflow = "visible";
1394
- const Z = F.querySelector("svg");
1395
- Z && (Z.setAttribute("width", String(_)), Z.setAttribute("height", String(x)), Z.style.width = `${_}px`, Z.style.height = `${x}px`), F.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-re + c},${-N + c})`), R.appendChild(F), document.body.appendChild(R);
1392
+ const q = /* @__PURE__ */ new Set();
1393
+ let Y = n.container.parentElement;
1394
+ for (; Y && Y !== document.body && Y !== document.documentElement; )
1395
+ Y.classList.forEach((ne) => q.add(ne)), Y = Y.parentElement;
1396
+ q.size > 0 && (R.className = Array.from(q).join(" "));
1397
+ const J = n.container.cloneNode(!0);
1398
+ J.style.width = `${_}px`, J.style.height = `${x}px`, J.style.overflow = "visible";
1399
+ const Z = J.querySelector("svg");
1400
+ Z && (Z.setAttribute("width", String(_)), Z.setAttribute("height", String(x)), Z.style.width = `${_}px`, Z.style.height = `${x}px`), J.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-de + c},${-N + c})`), R.appendChild(J), document.body.appendChild(R);
1396
1401
  try {
1397
- return await M(), await y(F, {
1402
+ return await M(), await y(J, {
1398
1403
  width: _,
1399
1404
  height: x,
1400
1405
  backgroundColor: g,
1401
1406
  scale: d?.scale ?? window.devicePixelRatio,
1402
- filter: (Q) => {
1403
- if (Q instanceof Element) {
1404
- const K = Q.getAttribute("class") ?? "";
1405
- if (K.includes("x6-widget-selection") || K.includes("x6-widget-transform") || K.includes("x6-graph-grid") || K.includes("x6-graph-background"))
1407
+ filter: (ne) => {
1408
+ if (ne instanceof Element) {
1409
+ const re = ne.getAttribute("class") ?? "";
1410
+ if (re.includes("x6-widget-selection") || re.includes("x6-widget-transform") || re.includes("x6-graph-grid") || re.includes("x6-graph-background"))
1406
1411
  return !1;
1407
1412
  }
1408
1413
  return !0;
1409
1414
  }
1410
1415
  });
1411
- } catch (Q) {
1412
- return console.warn("[flow-canvas] Export failed:", Q), new Blob();
1416
+ } catch (ne) {
1417
+ return console.warn("[flow-canvas] Export failed:", ne), new Blob();
1413
1418
  } finally {
1414
1419
  R.remove();
1415
1420
  }
@@ -1428,49 +1433,49 @@ function to({
1428
1433
  return a?.(d) ?? [];
1429
1434
  },
1430
1435
  insertNodeToRight(d, y, c) {
1431
- const g = n.value, v = g.nodes[d];
1436
+ const g = s.value, v = g.nodes[d];
1432
1437
  if (!v)
1433
1438
  return {
1434
1439
  status: "invalid",
1435
1440
  envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
1436
1441
  error: { code: "constraint_violated", reason: `Source node "${d}" not found`, source: "api" }
1437
1442
  };
1438
- const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[v.type], z = t.nodeTypes[y.type], re = L?.getSize(v) ?? { width: 154, height: 54 }, N = z?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
1443
+ const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[v.type], z = t.nodeTypes[y.type], de = L?.getSize(v) ?? { width: 154, height: 54 }, N = z?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
1439
1444
  width: 154,
1440
1445
  height: 54
1441
- }, _ = X(E, v, re, N, m), x = y.id || p("node"), R = { ...y, id: x, position: _ }, F = [{ type: "node.add", node: R }];
1446
+ }, _ = X(E, v, de, N, m), x = y.id || p("node"), R = { ...y, id: x, position: _ }, q = [{ type: "node.add", node: R }];
1442
1447
  if (c?.autoWireEdges) {
1443
- const ae = j(v), Q = j(R), K = E, me = U(E), pe = ae.find((I) => I.group === K), we = Q.find((I) => I.group === me), $e = Q.find((I) => I.group === K), Se = pe ? Object.values(g.edges).find(
1444
- (I) => I.source.nodeId === d && I.source.portId === pe.id
1448
+ const J = j(v), Z = j(R), Q = E, ne = U(E), re = J.find((I) => I.group === Q), we = Z.find((I) => I.group === ne), $e = Z.find((I) => I.group === Q), Se = re ? Object.values(g.edges).find(
1449
+ (I) => I.source.nodeId === d && I.source.portId === re.id
1445
1450
  ) : Object.values(g.edges).find((I) => I.source.nodeId === d);
1446
1451
  if (Se) {
1447
- const I = Se.target, C = N.width + m, P = E === "right" ? C : E === "left" ? -C : 0, W = E === "bottom" ? C : E === "top" ? -C : 0, ee = /* @__PURE__ */ new Set(), le = [I.nodeId];
1448
- for (; le.length > 0; ) {
1449
- const oe = le.shift();
1450
- if (ee.has(oe) || oe === d) continue;
1451
- ee.add(oe);
1452
- const xe = g.nodes[oe];
1452
+ const I = Se.target, C = N.width + m, P = E === "right" ? C : E === "left" ? -C : 0, W = E === "bottom" ? C : E === "top" ? -C : 0, te = /* @__PURE__ */ new Set(), ce = [I.nodeId];
1453
+ for (; ce.length > 0; ) {
1454
+ const se = ce.shift();
1455
+ if (te.has(se) || se === d) continue;
1456
+ te.add(se);
1457
+ const xe = g.nodes[se];
1453
1458
  if (xe) {
1454
- F.push({
1459
+ q.push({
1455
1460
  type: "node.move",
1456
- nodeId: oe,
1461
+ nodeId: se,
1457
1462
  position: {
1458
1463
  x: xe.position.x + P,
1459
1464
  y: xe.position.y + W
1460
1465
  }
1461
1466
  });
1462
1467
  for (const be of Object.values(g.edges))
1463
- be.source.nodeId === oe && !ee.has(be.target.nodeId) && le.push(be.target.nodeId);
1468
+ be.source.nodeId === se && !te.has(be.target.nodeId) && ce.push(be.target.nodeId);
1464
1469
  }
1465
1470
  }
1466
- F.push({ type: "edge.remove", edgeId: Se.id }), F.push({
1471
+ q.push({ type: "edge.remove", edgeId: Se.id }), q.push({
1467
1472
  type: "edge.add",
1468
1473
  edge: {
1469
1474
  id: p("edge"),
1470
- source: { nodeId: d, portId: pe?.id },
1475
+ source: { nodeId: d, portId: re?.id },
1471
1476
  target: { nodeId: x, portId: we?.id }
1472
1477
  }
1473
- }), F.push({
1478
+ }), q.push({
1474
1479
  type: "edge.add",
1475
1480
  edge: {
1476
1481
  id: p("edge"),
@@ -1479,127 +1484,127 @@ function to({
1479
1484
  }
1480
1485
  });
1481
1486
  } else
1482
- F.push({
1487
+ q.push({
1483
1488
  type: "edge.add",
1484
1489
  edge: {
1485
1490
  id: p("edge"),
1486
- source: { nodeId: d, portId: pe?.id },
1491
+ source: { nodeId: d, portId: re?.id },
1487
1492
  target: { nodeId: x, portId: we?.id }
1488
1493
  }
1489
1494
  });
1490
1495
  }
1491
- const Z = {
1492
- id: J(),
1496
+ const Y = {
1497
+ id: ee(),
1493
1498
  source: c?.source ?? "user:toolbar",
1494
1499
  label: c?.label ?? "插入节点",
1495
1500
  timestamp: Date.now(),
1496
- commands: F
1501
+ commands: q
1497
1502
  };
1498
- return o(Z);
1503
+ return o(Y);
1499
1504
  },
1500
1505
  onGraphEvent(d, y) {
1501
- return s.on(d, y), () => s.off(d, y);
1506
+ return n.on(d, y), () => n.off(d, y);
1502
1507
  },
1503
1508
  unsafeGetGraph() {
1504
- return s;
1509
+ return n;
1505
1510
  }
1506
1511
  };
1507
1512
  return G;
1508
1513
  }
1509
1514
  function oo() {
1510
- const s = H(null), e = H(!1);
1515
+ const n = H(null), e = H(!1);
1511
1516
  let o = null, t = !1;
1512
- function n(p) {
1513
- o && (clearTimeout(o), o = null), s.value = p;
1517
+ function s(p) {
1518
+ o && (clearTimeout(o), o = null), n.value = p;
1514
1519
  }
1515
- function i(p = 100) {
1520
+ function r(p = 100) {
1516
1521
  t || (o && clearTimeout(o), o = setTimeout(() => {
1517
- s.value = null, o = null;
1522
+ n.value = null, o = null;
1518
1523
  }, p));
1519
1524
  }
1520
- function r() {
1525
+ function i() {
1521
1526
  t = !0, o && (clearTimeout(o), o = null);
1522
1527
  }
1523
1528
  function l(p = 100) {
1524
- t = !1, i(p);
1529
+ t = !1, r(p);
1525
1530
  }
1526
1531
  function a() {
1527
1532
  o && (clearTimeout(o), o = null);
1528
1533
  }
1529
1534
  function h() {
1530
- a(), t = !1, s.value = null;
1535
+ a(), t = !1, n.value = null;
1531
1536
  }
1532
1537
  function f() {
1533
1538
  o && clearTimeout(o);
1534
1539
  }
1535
- return { hoveredNodeId: s, isDraggingNode: e, enter: n, leave: i, enterOverlay: r, leaveOverlay: l, cancelLeave: a, reset: h, cleanup: f };
1540
+ return { hoveredNodeId: n, isDraggingNode: e, enter: s, leave: r, enterOverlay: i, leaveOverlay: l, cancelLeave: a, reset: h, cleanup: f };
1536
1541
  }
1537
1542
  const Xe = 10, Ae = 12;
1538
- function Ke(s, e) {
1539
- const o = s.getTotalLength();
1543
+ function Ke(n, e) {
1544
+ const o = n.getTotalLength();
1540
1545
  if (o === 0) return { ...e, length: 0, totalLength: 0 };
1541
- let t = s.getPointAtLength(0), n = 1 / 0;
1542
- const i = 50, r = o / i;
1546
+ let t = n.getPointAtLength(0), s = 1 / 0;
1547
+ const r = 50, i = o / r;
1543
1548
  let l = 0;
1544
- for (let p = 0; p <= i; p++) {
1545
- const u = p * r, w = s.getPointAtLength(u), D = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
1546
- D < n && (n = D, t = w, l = u);
1549
+ for (let p = 0; p <= r; p++) {
1550
+ const u = p * i, w = n.getPointAtLength(u), D = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
1551
+ D < s && (s = D, t = w, l = u);
1547
1552
  }
1548
- const a = Math.max(0, l - r), h = Math.min(o, l + r), f = (h - a) / 20;
1553
+ const a = Math.max(0, l - i), h = Math.min(o, l + i), f = (h - a) / 20;
1549
1554
  for (let p = a; p <= h; p += f) {
1550
- const u = s.getPointAtLength(p), w = (u.x - e.x) ** 2 + (u.y - e.y) ** 2;
1551
- w < n && (n = w, t = u, l = p);
1555
+ const u = n.getPointAtLength(p), w = (u.x - e.x) ** 2 + (u.y - e.y) ** 2;
1556
+ w < s && (s = w, t = u, l = p);
1552
1557
  }
1553
1558
  return { x: t.x, y: t.y, length: l, totalLength: o };
1554
1559
  }
1555
- function Ye(s, e) {
1556
- return s < Xe || s > e - Xe;
1560
+ function Ye(n, e) {
1561
+ return n < Xe || n > e - Xe;
1557
1562
  }
1558
- function Ze(s, e, o) {
1559
- const t = s.querySelectorAll(".x6-edge-label");
1560
- for (const n of t) {
1561
- const i = n.getBoundingClientRect();
1562
- if (e >= i.left - Ae && e <= i.right + Ae && o >= i.top - Ae && o <= i.bottom + Ae)
1563
+ function Ze(n, e, o) {
1564
+ const t = n.querySelectorAll(".x6-edge-label");
1565
+ for (const s of t) {
1566
+ const r = s.getBoundingClientRect();
1567
+ if (e >= r.left - Ae && e <= r.right + Ae && o >= r.top - Ae && o <= r.bottom + Ae)
1563
1568
  return !0;
1564
1569
  }
1565
1570
  return !1;
1566
1571
  }
1567
1572
  function Qe() {
1568
- const s = "http://www.w3.org/2000/svg", e = document.createElementNS(s, "g");
1573
+ const n = "http://www.w3.org/2000/svg", e = document.createElementNS(n, "g");
1569
1574
  e.setAttribute("class", "flow-canvas-edge-delete-tool"), e.style.cursor = "pointer";
1570
- const o = document.createElementNS(s, "rect");
1575
+ const o = document.createElementNS(n, "rect");
1571
1576
  o.setAttribute("width", "20"), o.setAttribute("height", "20"), o.setAttribute("x", "-10"), o.setAttribute("y", "-10"), o.setAttribute("rx", "4"), o.setAttribute("ry", "4"), o.setAttribute("fill", "#3a84ff"), e.appendChild(o);
1572
- const t = document.createElementNS(s, "text");
1577
+ const t = document.createElementNS(n, "text");
1573
1578
  return t.setAttribute("font-family", "flow-canvas"), t.setAttribute("font-size", "16"), t.setAttribute("fill", "#ffffff"), t.setAttribute("text-anchor", "middle"), t.setAttribute("dominant-baseline", "central"), t.textContent = "", e.appendChild(t), e;
1574
1579
  }
1575
- function no(s) {
1580
+ function no(n) {
1576
1581
  let e = null, o = null;
1577
1582
  function t(l, a) {
1578
- if (i(), o = l, a.target?.closest?.(".x6-edge-label")) return;
1579
- const f = s.getCellById(l);
1583
+ if (r(), o = l, a.target?.closest?.(".x6-edge-label")) return;
1584
+ const f = n.getCellById(l);
1580
1585
  if (!f?.isEdge()) return;
1581
- const p = s.findViewByCell(f);
1586
+ const p = n.findViewByCell(f);
1582
1587
  if (!p) return;
1583
1588
  const u = p.container.querySelector("path");
1584
1589
  if (!u) return;
1585
- const w = s.clientToLocal(a.clientX, a.clientY), D = Ke(u, w);
1590
+ const w = n.clientToLocal(a.clientX, a.clientY), D = Ke(u, w);
1586
1591
  if (Ye(D.length, D.totalLength) || Ze(p.container, a.clientX, a.clientY)) return;
1587
1592
  const O = Qe();
1588
1593
  O.setAttribute("transform", `translate(${D.x}, ${D.y})`), p.container.appendChild(O), e = O;
1589
1594
  }
1590
- function n(l) {
1595
+ function s(l) {
1591
1596
  if (!o) return;
1592
1597
  if (l.target?.closest?.(".x6-edge-label")) {
1593
1598
  e && e.setAttribute("display", "none");
1594
1599
  return;
1595
1600
  }
1596
- const h = s.getCellById(o);
1601
+ const h = n.getCellById(o);
1597
1602
  if (!h?.isEdge()) return;
1598
- const f = s.findViewByCell(h);
1603
+ const f = n.findViewByCell(h);
1599
1604
  if (!f) return;
1600
1605
  const p = f.container.querySelector("path");
1601
1606
  if (!p) return;
1602
- const u = s.clientToLocal(l.clientX, l.clientY), w = Ke(p, u);
1607
+ const u = n.clientToLocal(l.clientX, l.clientY), w = Ke(p, u);
1603
1608
  if (Ye(w.length, w.totalLength) || Ze(f.container, l.clientX, l.clientY))
1604
1609
  e && e.setAttribute("display", "none");
1605
1610
  else if (e)
@@ -1609,36 +1614,36 @@ function no(s) {
1609
1614
  D.setAttribute("transform", `translate(${w.x}, ${w.y})`), f.container.appendChild(D), e = D;
1610
1615
  }
1611
1616
  }
1612
- function i() {
1617
+ function r() {
1613
1618
  e && (e.remove(), e = null), o = null;
1614
1619
  }
1615
- function r(l) {
1620
+ function i(l) {
1616
1621
  l === o && (e = null, o = null);
1617
1622
  }
1618
- return { show: t, move: n, remove: i, handleEdgeRemoved: r };
1623
+ return { show: t, move: s, remove: r, handleEdgeRemoved: i };
1619
1624
  }
1620
- function so(s) {
1625
+ function so(n) {
1621
1626
  let e = null, o = 0;
1622
1627
  function t(f) {
1623
1628
  const p = f ? "visible" : "hidden";
1624
- for (const u of s.getNodes())
1629
+ for (const u of n.getNodes())
1625
1630
  for (const w of u.getPorts())
1626
1631
  u.setPortProp(w.id, "attrs/circle/visibility", p);
1627
1632
  }
1628
- function n(f) {
1633
+ function s(f) {
1629
1634
  if (!e)
1630
1635
  for (const p of f.getPorts())
1631
1636
  f.setPortProp(p.id, "attrs/circle/visibility", "visible");
1632
1637
  }
1633
- function i(f) {
1638
+ function r(f) {
1634
1639
  if (!e)
1635
1640
  for (const p of f.getPorts())
1636
1641
  f.setPortProp(p.id, "attrs/circle/visibility", "hidden");
1637
1642
  }
1638
- function r(f, p) {
1643
+ function i(f, p) {
1639
1644
  if (!f.getTargetCell())
1640
1645
  if (e = f.id, p?.size)
1641
- for (const u of s.getNodes()) {
1646
+ for (const u of n.getNodes()) {
1642
1647
  const w = p.has(u.id) ? "hidden" : "visible";
1643
1648
  for (const D of u.getPorts())
1644
1649
  u.setPortProp(D.id, "attrs/circle/visibility", w);
@@ -1656,26 +1661,26 @@ function so(s) {
1656
1661
  return !e && Date.now() >= o;
1657
1662
  }
1658
1663
  return {
1659
- showNodePorts: n,
1660
- hideNodePorts: i,
1661
- handleEdgeAdded: r,
1664
+ showNodePorts: s,
1665
+ hideNodePorts: r,
1666
+ handleEdgeAdded: i,
1662
1667
  handleEdgeConnected: l,
1663
1668
  handleEdgeRemoved: a,
1664
1669
  canShowEdgeTool: h
1665
1670
  };
1666
1671
  }
1667
- function Je(s) {
1668
- return s === "top" || s === "right" || s === "bottom" || s === "left";
1672
+ function Je(n) {
1673
+ return n === "top" || n === "right" || n === "bottom" || n === "left";
1669
1674
  }
1670
- function io(s) {
1671
- const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: n, getNodeBehavior: i, getInsertGap: r } = s, { isDraggingNode: l } = s, a = H(null), h = H(!1);
1675
+ function ro(n) {
1676
+ const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: s, getNodeBehavior: r, getInsertGap: i } = n, { isDraggingNode: l } = n, a = H(null), h = H(!1);
1672
1677
  let f = null, p = null, u = null;
1673
1678
  const w = V(() => ({
1674
1679
  enabled: !0,
1675
1680
  portGroup: "right",
1676
1681
  autoPanOnOpen: !0,
1677
1682
  autoPanPadding: 16,
1678
- ...s.quickAddProp.value
1683
+ ...n.quickAddProp.value
1679
1684
  }));
1680
1685
  function D() {
1681
1686
  f && (clearTimeout(f), f = null);
@@ -1702,7 +1707,7 @@ function io(s) {
1702
1707
  const x = w.value.getPort?.(N, _);
1703
1708
  if (!x) return null;
1704
1709
  const R = typeof x == "string" ? x : x.id;
1705
- return _.find((F) => F.id === R) ?? null;
1710
+ return _.find((q) => q.id === R) ?? null;
1706
1711
  }
1707
1712
  function k(N, _) {
1708
1713
  const x = e.api.value?.overlay.getNodeScreenRect(N);
@@ -1724,19 +1729,19 @@ function io(s) {
1724
1729
  if (!p) return k(N, x);
1725
1730
  const R = p.getCellById(N);
1726
1731
  if (R?.isNode()) {
1727
- const F = R, Z = p.findViewByCell(F), ae = Z?.findPortElem(_, "circle") ?? Z?.findPortElem(_);
1728
- if (ae) {
1729
- const Q = p.container.getBoundingClientRect(), K = ae.getBoundingClientRect();
1732
+ const q = R, Y = p.findViewByCell(q), J = Y?.findPortElem(_, "circle") ?? Y?.findPortElem(_);
1733
+ if (J) {
1734
+ const Z = p.container.getBoundingClientRect(), Q = J.getBoundingClientRect();
1730
1735
  return {
1731
- x: K.left - Q.left + K.width / 2,
1732
- y: K.top - Q.top + K.height / 2
1736
+ x: Q.left - Z.left + Q.width / 2,
1737
+ y: Q.top - Z.top + Q.height / 2
1733
1738
  };
1734
1739
  }
1735
1740
  }
1736
1741
  return k(N, x);
1737
1742
  }
1738
1743
  function U(N) {
1739
- const _ = B(N), x = j(N, _) ?? _.find((F) => F.group === w.value.portGroup) ?? null;
1744
+ const _ = B(N), x = j(N, _) ?? _.find((q) => q.group === w.value.portGroup) ?? null;
1740
1745
  if (!x) return null;
1741
1746
  const R = X(N.id, x.id, x.group);
1742
1747
  return R ? { portId: x.id, portGroup: x.group, portPosition: R } : null;
@@ -1753,19 +1758,19 @@ function io(s) {
1753
1758
  function d(N) {
1754
1759
  if (!w.value.enabled || e.mode.value !== "edit") return !1;
1755
1760
  const x = e.flowModel.value.nodes[N];
1756
- return !x || i(x).quickAddEnabled === !1 ? !1 : !!U(x);
1761
+ return !x || r(x).quickAddEnabled === !1 ? !1 : !!U(x);
1757
1762
  }
1758
1763
  const y = V(() => {
1759
- if (n.value, !w.value.enabled) return null;
1764
+ if (s.value, !w.value.enabled) return null;
1760
1765
  const N = a.value;
1761
1766
  if (!N || l.value || !e.api.value || e.mode.value !== "edit" || t.value)
1762
1767
  return null;
1763
1768
  const x = e.flowModel.value.nodes[N];
1764
1769
  if (!x) return null;
1765
- const R = i(x);
1770
+ const R = r(x);
1766
1771
  if (R.quickAddEnabled === !1) return null;
1767
- const F = U(x);
1768
- return F ? { node: x, ...F, behavior: R } : null;
1772
+ const q = U(x);
1773
+ return q ? { node: x, ...q, behavior: R } : null;
1769
1774
  });
1770
1775
  function c(N) {
1771
1776
  h.value = !0, y.value && e._emitUiEvent({ type: "node.quick-add", nodeId: N, position: y.value.portPosition });
@@ -1789,15 +1794,15 @@ function io(s) {
1789
1794
  function E(N, _) {
1790
1795
  const x = e.api.value;
1791
1796
  if (!x) return;
1792
- const R = _.id || e.idGenerator("node"), F = { ..._, id: R }, Z = e.flowModel.value.nodes[N];
1793
- if (!Z) return;
1794
- x.insertNodeToRight(N, F, {
1797
+ const R = _.id || e.idGenerator("node"), q = { ..._, id: R }, Y = e.flowModel.value.nodes[N];
1798
+ if (!Y) return;
1799
+ x.insertNodeToRight(N, q, {
1795
1800
  autoWireEdges: !0,
1796
- direction: G(Z),
1797
- gap: r(),
1801
+ direction: G(Y),
1802
+ gap: i(),
1798
1803
  source: "user:quick-add",
1799
1804
  label: "快捷插入节点"
1800
- }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: N, newNodeId: R }), s.closePopover();
1805
+ }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: N, newNodeId: R }), n.closePopover();
1801
1806
  }
1802
1807
  function L(N) {
1803
1808
  if (!p) return;
@@ -1805,32 +1810,32 @@ function io(s) {
1805
1810
  if (!_?.isNode()) return;
1806
1811
  const x = _, R = e.flowModel.value.nodes[N];
1807
1812
  if (!R) return;
1808
- const F = U(R);
1809
- let Z = !0;
1810
- i(R).hidePortForQuickAdd === !1 && (Z = !1);
1811
- const Q = Z && !l.value && !!F && d(N);
1812
- for (const K of x.getPorts()) {
1813
- const me = Q && K.id === F?.portId ? "hidden" : "visible";
1814
- x.setPortProp(K.id, "attrs/circle/visibility", me);
1813
+ const q = U(R);
1814
+ let Y = !0;
1815
+ r(R).hidePortForQuickAdd === !1 && (Y = !1);
1816
+ const Z = Y && !l.value && !!q && d(N);
1817
+ for (const Q of x.getPorts()) {
1818
+ const ne = Z && Q.id === q?.portId ? "hidden" : "visible";
1819
+ x.setPortProp(Q.id, "attrs/circle/visibility", ne);
1815
1820
  }
1816
1821
  }
1817
1822
  function z(N, _) {
1818
- u?.(), p = N, u = ge(
1823
+ u?.(), p = N, u = he(
1819
1824
  [a, l],
1820
1825
  ([x], [R]) => {
1821
1826
  if (R && R !== x) {
1822
- const F = N.getCellById(R);
1823
- F?.isNode() && _(F);
1827
+ const q = N.getCellById(R);
1828
+ q?.isNode() && _(q);
1824
1829
  }
1825
1830
  x && L(x);
1826
1831
  },
1827
1832
  { flush: "sync" }
1828
1833
  );
1829
1834
  }
1830
- ge(y, (N) => {
1835
+ he(y, (N) => {
1831
1836
  N || (h.value = !1);
1832
1837
  });
1833
- function re() {
1838
+ function de() {
1834
1839
  f && clearTimeout(f), u?.(), u = null, p = null;
1835
1840
  }
1836
1841
  return {
@@ -1851,21 +1856,21 @@ function io(s) {
1851
1856
  isActiveForNode: d,
1852
1857
  syncNodePorts: L,
1853
1858
  attachRuntime: z,
1854
- cleanup: re
1859
+ cleanup: de
1855
1860
  };
1856
1861
  }
1857
- const ro = 15, ao = 10;
1858
- function lo(s) {
1859
- const { editor: e } = s;
1860
- let o = null, t = null, n = null, i = null;
1861
- const r = [];
1862
+ const io = 15, ao = 10;
1863
+ function lo(n) {
1864
+ const { editor: e } = n;
1865
+ let o = null, t = null, s = null, r = null;
1866
+ const i = [];
1862
1867
  let l = null;
1863
1868
  const a = V(() => ({
1864
1869
  enabled: !1,
1865
- bufferMargin: ro,
1870
+ bufferMargin: io,
1866
1871
  incomingPortGroup: "left",
1867
1872
  outgoingPortGroup: "right",
1868
- ...s.edgeDropProp.value
1873
+ ...n.edgeDropProp.value
1869
1874
  }));
1870
1875
  function h(d) {
1871
1876
  if (!o) return null;
@@ -1880,12 +1885,12 @@ function lo(s) {
1880
1885
  }
1881
1886
  function f(d) {
1882
1887
  const y = h(d);
1883
- y && (y.style.stroke = "#3a84ff", i = d);
1888
+ y && (y.style.stroke = "#3a84ff", r = d);
1884
1889
  }
1885
1890
  function p() {
1886
- if (!i) return;
1887
- const d = h(i);
1888
- d && (d.style.stroke = ""), i = null;
1891
+ if (!r) return;
1892
+ const d = h(r);
1893
+ d && (d.style.stroke = ""), r = null;
1889
1894
  }
1890
1895
  function u(d, y, c) {
1891
1896
  if (o) {
@@ -1923,23 +1928,23 @@ function lo(s) {
1923
1928
  if (m.width <= 0 || m.height <= 0) return null;
1924
1929
  const E = m.x + m.width, L = m.y + m.height;
1925
1930
  let z = null;
1926
- const re = d.x + d.width / 2, N = d.y + d.height / 2;
1931
+ const de = d.x + d.width / 2, N = d.y + d.height / 2;
1927
1932
  for (const _ of o.getEdges()) {
1928
1933
  const x = y.edges[_.id];
1929
1934
  if (!x || c && (x.source.nodeId === c || x.target.nodeId === c) || g.isEdgeDropTarget && !g.isEdgeDropTarget(x, y)) continue;
1930
1935
  const R = o.findViewByCell(_);
1931
1936
  if (!R) continue;
1932
- const F = R.findOne?.("path");
1933
- if (!F || typeof F.getTotalLength != "function") continue;
1934
- const Z = w(F);
1935
- if (!Z.length) continue;
1936
- let ae = !1, Q = 1 / 0;
1937
- for (const K of Z)
1938
- if (K.x >= m.x && K.x <= E && K.y >= m.y && K.y <= L) {
1939
- const me = K.x - re, pe = K.y - N, we = me * me + pe * pe;
1940
- we < Q && (Q = we), ae = !0;
1937
+ const q = R.findOne?.("path");
1938
+ if (!q || typeof q.getTotalLength != "function") continue;
1939
+ const Y = w(q);
1940
+ if (!Y.length) continue;
1941
+ let J = !1, Z = 1 / 0;
1942
+ for (const Q of Y)
1943
+ if (Q.x >= m.x && Q.x <= E && Q.y >= m.y && Q.y <= L) {
1944
+ const ne = Q.x - de, re = Q.y - N, we = ne * ne + re * re;
1945
+ we < Z && (Z = we), J = !0;
1941
1946
  }
1942
- ae && (!z || Q < z.distSq) && (z = { edgeId: _.id, edge: x, distSq: Q });
1947
+ J && (!z || Z < z.distSq) && (z = { edgeId: _.id, edge: x, distSq: Z });
1943
1948
  }
1944
1949
  return z ? { edgeId: z.edgeId, edge: z.edge } : null;
1945
1950
  }
@@ -1960,14 +1965,14 @@ function lo(s) {
1960
1965
  b = !g.isNodeInsertable || g.isNodeInsertable(c, y);
1961
1966
  }
1962
1967
  function M({ node: d }) {
1963
- !a.value.enabled || !b || n === null && (n = requestAnimationFrame(() => {
1964
- if (n = null, !o) return;
1968
+ !a.value.enabled || !b || s === null && (s = requestAnimationFrame(() => {
1969
+ if (s = null, !o) return;
1965
1970
  const y = d.getPosition(), c = d.getSize();
1966
1971
  O({ x: y.x, y: y.y, width: c.width, height: c.height }, d.id);
1967
1972
  }));
1968
1973
  }
1969
1974
  function B() {
1970
- n !== null && (cancelAnimationFrame(n), n = null), p(), b = !0;
1975
+ s !== null && (cancelAnimationFrame(s), s = null), p(), b = !0;
1971
1976
  }
1972
1977
  function j() {
1973
1978
  if (!o) return;
@@ -1979,8 +1984,8 @@ function lo(s) {
1979
1984
  d && (d = !1, p(), t = null);
1980
1985
  return;
1981
1986
  }
1982
- d = !0, n === null && (n = requestAnimationFrame(() => {
1983
- if (n = null, !o) return;
1987
+ d = !0, s === null && (s = requestAnimationFrame(() => {
1988
+ if (s = null, !o) return;
1984
1989
  const c = y.getBoundingClientRect(), g = o.clientToLocal(c.left, c.top), v = o.clientToLocal(c.right, c.bottom), m = {
1985
1990
  x: g.x,
1986
1991
  y: g.y,
@@ -1989,12 +1994,12 @@ function lo(s) {
1989
1994
  };
1990
1995
  O(m);
1991
1996
  }));
1992
- }, document.addEventListener("mousemove", l), r.push(() => {
1997
+ }, document.addEventListener("mousemove", l), i.push(() => {
1993
1998
  l && (document.removeEventListener("mousemove", l), l = null);
1994
1999
  });
1995
2000
  }
1996
2001
  function k() {
1997
- p(), t = null, n !== null && (cancelAnimationFrame(n), n = null);
2002
+ p(), t = null, s !== null && (cancelAnimationFrame(s), s = null);
1998
2003
  }
1999
2004
  function X(d) {
2000
2005
  if (!t || d.source !== "user:drag") return d;
@@ -2009,7 +2014,7 @@ function lo(s) {
2009
2014
  const L = a.value;
2010
2015
  if (L.isNodeInsertable && !L.isNodeInsertable(E, c))
2011
2016
  return d;
2012
- const z = u(m, E, L.incomingPortGroup), re = u(m, E, L.outgoingPortGroup), N = e.idGenerator("edge"), _ = e.idGenerator("edge"), x = [
2017
+ const z = u(m, E, L.incomingPortGroup), de = u(m, E, L.outgoingPortGroup), N = e.idGenerator("edge"), _ = e.idGenerator("edge"), x = [
2013
2018
  { type: "edge.remove", edgeId: y },
2014
2019
  {
2015
2020
  type: "edge.add",
@@ -2025,7 +2030,7 @@ function lo(s) {
2025
2030
  edge: {
2026
2031
  id: _,
2027
2032
  type: g.type,
2028
- source: { nodeId: m, portId: re },
2033
+ source: { nodeId: m, portId: de },
2029
2034
  target: { nodeId: g.target.nodeId, portId: g.target.portId }
2030
2035
  }
2031
2036
  }
@@ -2039,14 +2044,14 @@ function lo(s) {
2039
2044
  function U(d) {
2040
2045
  o = d;
2041
2046
  const y = (c, g) => {
2042
- d.on(c, g), r.push(() => d.off(c, g));
2047
+ d.on(c, g), i.push(() => d.off(c, g));
2043
2048
  };
2044
2049
  y("node:move", S), y("node:change:position", M), y("node:moved", B), j();
2045
2050
  }
2046
2051
  function G() {
2047
2052
  k();
2048
- for (const d of r) d();
2049
- r.length = 0, o = null, b = !0;
2053
+ for (const d of i) d();
2054
+ i.length = 0, o = null, b = !0;
2050
2055
  }
2051
2056
  return {
2052
2057
  attachRuntime: U,
@@ -2054,35 +2059,35 @@ function lo(s) {
2054
2059
  cleanup: G
2055
2060
  };
2056
2061
  }
2057
- function co(s) {
2058
- function e(n) {
2062
+ function co(n) {
2063
+ function e(s) {
2059
2064
  return {
2060
- id: s.idGenerator("node"),
2061
- type: n.type,
2062
- label: n.label,
2063
- ports: n.ports ? JSON.parse(JSON.stringify(n.ports)) : void 0,
2064
- payload: n.payload ? JSON.parse(JSON.stringify(n.payload)) : void 0,
2065
- extensions: n.extensions ? JSON.parse(JSON.stringify(n.extensions)) : void 0
2065
+ id: n.idGenerator("node"),
2066
+ type: s.type,
2067
+ label: s.label,
2068
+ ports: s.ports ? JSON.parse(JSON.stringify(s.ports)) : void 0,
2069
+ payload: s.payload ? JSON.parse(JSON.stringify(s.payload)) : void 0,
2070
+ extensions: s.extensions ? JSON.parse(JSON.stringify(s.extensions)) : void 0
2066
2071
  };
2067
2072
  }
2068
- function o(n, i, r) {
2069
- const l = s.api.value;
2070
- switch (n) {
2073
+ function o(s, r, i) {
2074
+ const l = n.api.value;
2075
+ switch (s) {
2071
2076
  case "delete":
2072
- return s.executeCommand({
2073
- id: J(),
2077
+ return n.executeCommand({
2078
+ id: ee(),
2074
2079
  source: "user:toolbar",
2075
2080
  label: "删除节点",
2076
2081
  timestamp: Date.now(),
2077
- commands: [{ type: "node.remove", nodeId: i }]
2078
- }), s._emitUiEvent({ type: "node.action.delete", nodeId: i }), !0;
2082
+ commands: [{ type: "node.remove", nodeId: r }]
2083
+ }), n._emitUiEvent({ type: "node.action.delete", nodeId: r }), !0;
2079
2084
  case "copy": {
2080
2085
  if (!l) break;
2081
- const a = s.flowModel.value.nodes[i];
2086
+ const a = n.flowModel.value.nodes[r];
2082
2087
  if (!a) break;
2083
2088
  const h = e(a), f = 50;
2084
- s.executeCommand({
2085
- id: J(),
2089
+ n.executeCommand({
2090
+ id: ee(),
2086
2091
  source: "user:toolbar",
2087
2092
  label: "复制节点",
2088
2093
  timestamp: Date.now(),
@@ -2098,46 +2103,46 @@ function co(s) {
2098
2103
  }
2099
2104
  }
2100
2105
  ]
2101
- }), l.selectNodes([h.id]), s._emitUiEvent({ type: "node.action.copy", sourceNodeId: i, newNodeId: h.id });
2106
+ }), l.selectNodes([h.id]), n._emitUiEvent({ type: "node.action.copy", sourceNodeId: r, newNodeId: h.id });
2102
2107
  break;
2103
2108
  }
2104
2109
  case "copy-insert": {
2105
2110
  if (!l) break;
2106
- const a = s.flowModel.value.nodes[i];
2111
+ const a = n.flowModel.value.nodes[r];
2107
2112
  if (!a) break;
2108
2113
  const h = e(a);
2109
- l.insertNodeToRight(i, h, {
2114
+ l.insertNodeToRight(r, h, {
2110
2115
  autoWireEdges: !0,
2111
- gap: r,
2116
+ gap: i,
2112
2117
  label: "复制并插入节点"
2113
- }), l.selectNodes([h.id]), s._emitUiEvent({ type: "node.action.copy-insert", sourceNodeId: i, newNodeId: h.id });
2118
+ }), l.selectNodes([h.id]), n._emitUiEvent({ type: "node.action.copy-insert", sourceNodeId: r, newNodeId: h.id });
2114
2119
  break;
2115
2120
  }
2116
2121
  case "disconnect": {
2117
- const a = s.flowModel.value, h = Object.entries(a.edges).filter(([, f]) => {
2122
+ const a = n.flowModel.value, h = Object.entries(a.edges).filter(([, f]) => {
2118
2123
  const p = f;
2119
- return p.source.nodeId === i || p.target.nodeId === i;
2124
+ return p.source.nodeId === r || p.target.nodeId === r;
2120
2125
  }).map(([f]) => f);
2121
2126
  if (h.length === 0) break;
2122
- s.executeCommand({
2123
- id: J(),
2127
+ n.executeCommand({
2128
+ id: ee(),
2124
2129
  source: "user:toolbar",
2125
2130
  label: "断开连线",
2126
2131
  timestamp: Date.now(),
2127
2132
  commands: h.map((f) => ({ type: "edge.remove", edgeId: f }))
2128
- }), s._emitUiEvent({ type: "node.action.disconnect", nodeId: i, edgeIds: h });
2133
+ }), n._emitUiEvent({ type: "node.action.disconnect", nodeId: r, edgeIds: h });
2129
2134
  break;
2130
2135
  }
2131
2136
  case "debug": {
2132
- s._emitUiEvent({ type: "node.action.debug", nodeId: i });
2137
+ n._emitUiEvent({ type: "node.action.debug", nodeId: r });
2133
2138
  break;
2134
2139
  }
2135
2140
  }
2136
2141
  return !1;
2137
2142
  }
2138
- function t(n) {
2139
- s.api.value?.deleteSelection({
2140
- selection: n,
2143
+ function t(s) {
2144
+ n.api.value?.deleteSelection({
2145
+ selection: s,
2141
2146
  source: "user:toolbar",
2142
2147
  label: "批量删除选中"
2143
2148
  });
@@ -2165,8 +2170,8 @@ function uo() {
2165
2170
  ]
2166
2171
  };
2167
2172
  }
2168
- function fo(s, e) {
2169
- const o = e.defaultEdgeType ?? "default", t = e.edgeTypes?.[o], n = {
2173
+ function fo(n, e) {
2174
+ const o = e.defaultEdgeType ?? "default", t = e.edgeTypes?.[o], s = {
2170
2175
  zIndex: -1,
2171
2176
  attrs: {
2172
2177
  line: {
@@ -2176,39 +2181,39 @@ function fo(s, e) {
2176
2181
  }
2177
2182
  }
2178
2183
  };
2179
- t?.router && (n.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (n.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(n, t.x6EdgeConfig);
2180
- const i = n.attrs ?? {}, r = i.line ?? {};
2181
- return n.attrs = {
2182
- ...i,
2184
+ t?.router && (s.router = typeof t.router == "string" ? { name: t.router } : t.router), t?.connector && (s.connector = typeof t.connector == "string" ? { name: t.connector } : t.connector), t?.x6EdgeConfig && Object.assign(s, t.x6EdgeConfig);
2185
+ const r = s.attrs ?? {}, i = r.line ?? {};
2186
+ return s.attrs = {
2187
+ ...r,
2183
2188
  line: {
2184
- ...r,
2189
+ ...i,
2185
2190
  targetMarker: uo()
2186
2191
  }
2187
- }, s.createEdge(n);
2192
+ }, n.createEdge(s);
2188
2193
  }
2189
2194
  const go = ".x6-widget-selection", po = ".x6-graph-svg";
2190
- function ho(s) {
2191
- const e = s.querySelector(go), o = s.querySelector(po);
2195
+ function ho(n) {
2196
+ const e = n.querySelector(go), o = n.querySelector(po);
2192
2197
  return !e || !o || e.parentNode !== o.parentNode || !o.parentNode || o.previousSibling === e ? !1 : (o.parentNode.insertBefore(e, o), !0);
2193
2198
  }
2194
- function vo(s) {
2195
- const e = () => ho(s);
2199
+ function vo(n) {
2200
+ const e = () => ho(n);
2196
2201
  e();
2197
2202
  const o = new MutationObserver(() => {
2198
2203
  e();
2199
2204
  });
2200
- return o.observe(s, { childList: !0 }), () => o.disconnect();
2205
+ return o.observe(n, { childList: !0 }), () => o.disconnect();
2201
2206
  }
2202
- function mo(s, e, o) {
2203
- const t = new Set(e), n = new Set(o), i = /* @__PURE__ */ new Set([...t, ...n]);
2204
- for (const r of i) {
2205
- const l = s.getCellById(r);
2207
+ function mo(n, e, o) {
2208
+ const t = new Set(e), s = new Set(o), r = /* @__PURE__ */ new Set([...t, ...s]);
2209
+ for (const i of r) {
2210
+ const l = n.getCellById(i);
2206
2211
  if (!l?.isNode()) continue;
2207
- const a = n.has(r), h = l.getData() ?? {};
2212
+ const a = s.has(i), h = l.getData() ?? {};
2208
2213
  h._selected !== a && l.setData({ ...h, _selected: a });
2209
2214
  }
2210
2215
  }
2211
- const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2216
+ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ pe({
2212
2217
  __name: "node-actions-toolbar",
2213
2218
  props: {
2214
2219
  node: {},
@@ -2218,15 +2223,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2218
2223
  actionsOffset: {}
2219
2224
  },
2220
2225
  emits: ["action"],
2221
- setup(s, { emit: e }) {
2222
- const o = s, t = V(() => {
2226
+ setup(n, { emit: e }) {
2227
+ const o = n, t = V(() => {
2223
2228
  const p = o.actionsOffset?.x ?? 0, u = o.actionsOffset?.y ?? 0, w = p !== 0 || u !== 0;
2224
2229
  return {
2225
2230
  left: `${o.position.x}px`,
2226
2231
  top: `${o.position.y}px`,
2227
2232
  transform: w ? `translate(${p}px, ${u}px)` : "translateX(-100%)"
2228
2233
  };
2229
- }), n = e, i = V(() => ({
2234
+ }), s = e, r = V(() => ({
2230
2235
  debug: {
2231
2236
  visible: o.config.showDebug && o.behavior.debuggable !== !1,
2232
2237
  disabled: o.behavior.debugDisabled === !0
@@ -2247,7 +2252,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2247
2252
  visible: o.config.showDisconnect && o.behavior.disconnectable !== !1,
2248
2253
  disabled: o.behavior.disconnectDisabled === !0
2249
2254
  }
2250
- })), r = V(() => i.value.copy.visible || i.value.copyInsert.visible || i.value.disconnect.visible), l = H(!1);
2255
+ })), i = V(() => r.value.copy.visible || r.value.copyInsert.visible || r.value.disconnect.visible), l = H(!1);
2251
2256
  let a = null;
2252
2257
  function h() {
2253
2258
  a && (clearTimeout(a), a = null), l.value = !0;
@@ -2263,73 +2268,73 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2263
2268
  class: "flow-canvas-node-actions",
2264
2269
  style: Ee(t.value)
2265
2270
  }, [
2266
- q("div", yo, [
2267
- i.value.debug.visible ? (A(), T("i", {
2271
+ F("div", yo, [
2272
+ r.value.debug.visible ? (A(), T("i", {
2268
2273
  key: 0,
2269
- class: te(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": i.value.debug.disabled }]),
2270
- onClick: u[0] || (u[0] = (w) => !i.value.debug.disabled && n("action", "debug", s.node.id))
2271
- }, null, 2)) : Y("", !0),
2272
- i.value.delete.visible ? (A(), T("i", {
2274
+ class: oe(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": r.value.debug.disabled }]),
2275
+ onClick: u[0] || (u[0] = (w) => !r.value.debug.disabled && s("action", "debug", n.node.id))
2276
+ }, null, 2)) : K("", !0),
2277
+ r.value.delete.visible ? (A(), T("i", {
2273
2278
  key: 1,
2274
- class: te(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": i.value.delete.disabled }]),
2275
- onClick: u[1] || (u[1] = (w) => !i.value.delete.disabled && n("action", "delete", s.node.id))
2276
- }, null, 2)) : Y("", !0),
2277
- r.value ? (A(), T("div", {
2279
+ class: oe(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": r.value.delete.disabled }]),
2280
+ onClick: u[1] || (u[1] = (w) => !r.value.delete.disabled && s("action", "delete", n.node.id))
2281
+ }, null, 2)) : K("", !0),
2282
+ i.value ? (A(), T("div", {
2278
2283
  key: 2,
2279
2284
  class: "flow-canvas-node-actions__more-wrapper",
2280
2285
  onMouseenter: h,
2281
2286
  onMouseleave: f
2282
2287
  }, [...u[5] || (u[5] = [
2283
- q("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2284
- ])], 32)) : Y("", !0)
2288
+ F("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2289
+ ])], 32)) : K("", !0)
2285
2290
  ]),
2286
2291
  at(lt, { name: "flow-canvas-fade" }, {
2287
2292
  default: He(() => [
2288
- l.value && r.value ? (A(), T("div", {
2293
+ l.value && i.value ? (A(), T("div", {
2289
2294
  key: 0,
2290
2295
  class: "flow-canvas-node-actions__dropdown",
2291
2296
  onMouseenter: h,
2292
2297
  onMouseleave: f
2293
2298
  }, [
2294
- i.value.copy.visible ? (A(), T("div", {
2299
+ r.value.copy.visible ? (A(), T("div", {
2295
2300
  key: 0,
2296
- class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copy.disabled }]),
2297
- onClick: u[2] || (u[2] = (w) => !i.value.copy.disabled && n("action", "copy", s.node.id))
2301
+ class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copy.disabled }]),
2302
+ onClick: u[2] || (u[2] = (w) => !r.value.copy.disabled && s("action", "copy", n.node.id))
2298
2303
  }, [...u[6] || (u[6] = [
2299
- q("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2300
- q("span", null, "复制", -1)
2301
- ])], 2)) : Y("", !0),
2302
- i.value.copyInsert.visible ? (A(), T("div", {
2304
+ F("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2305
+ F("span", null, "复制", -1)
2306
+ ])], 2)) : K("", !0),
2307
+ r.value.copyInsert.visible ? (A(), T("div", {
2303
2308
  key: 1,
2304
- class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.copyInsert.disabled }]),
2305
- onClick: u[3] || (u[3] = (w) => !i.value.copyInsert.disabled && n("action", "copy-insert", s.node.id))
2309
+ class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copyInsert.disabled }]),
2310
+ onClick: u[3] || (u[3] = (w) => !r.value.copyInsert.disabled && s("action", "copy-insert", n.node.id))
2306
2311
  }, [...u[7] || (u[7] = [
2307
- q("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2308
- q("span", null, "复制并插入", -1)
2309
- ])], 2)) : Y("", !0),
2310
- i.value.disconnect.visible ? (A(), T("div", {
2312
+ F("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2313
+ F("span", null, "复制并插入", -1)
2314
+ ])], 2)) : K("", !0),
2315
+ r.value.disconnect.visible ? (A(), T("div", {
2311
2316
  key: 2,
2312
- class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": i.value.disconnect.disabled }]),
2313
- onClick: u[4] || (u[4] = (w) => !i.value.disconnect.disabled && n("action", "disconnect", s.node.id))
2317
+ class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.disconnect.disabled }]),
2318
+ onClick: u[4] || (u[4] = (w) => !r.value.disconnect.disabled && s("action", "disconnect", n.node.id))
2314
2319
  }, [...u[8] || (u[8] = [
2315
- q("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2316
- q("span", null, "断开连线", -1)
2317
- ])], 2)) : Y("", !0)
2318
- ], 32)) : Y("", !0)
2320
+ F("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2321
+ F("span", null, "断开连线", -1)
2322
+ ])], 2)) : K("", !0)
2323
+ ], 32)) : K("", !0)
2319
2324
  ]),
2320
2325
  _: 1
2321
2326
  })
2322
2327
  ], 4));
2323
2328
  }
2324
- }), ve = (s, e) => {
2325
- const o = s.__vccOpts || s;
2326
- for (const [t, n] of e)
2327
- o[t] = n;
2329
+ }), me = (n, e) => {
2330
+ const o = n.__vccOpts || n;
2331
+ for (const [t, s] of e)
2332
+ o[t] = s;
2328
2333
  return o;
2329
- }, bo = /* @__PURE__ */ ve(wo, [["__scopeId", "data-v-3b39dab5"]]), Eo = {
2334
+ }, bo = /* @__PURE__ */ me(wo, [["__scopeId", "data-v-3b39dab5"]]), Eo = {
2330
2335
  key: 0,
2331
2336
  class: "flow-canvas-quick-add__tooltip"
2332
- }, xo = 5, Io = /* @__PURE__ */ fe({
2337
+ }, xo = 5, Io = /* @__PURE__ */ pe({
2333
2338
  __name: "node-quick-add-popover",
2334
2339
  props: {
2335
2340
  node: {},
@@ -2338,8 +2343,8 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2338
2343
  autoPanPadding: {}
2339
2344
  },
2340
2345
  emits: ["open", "close", "start-drag", "viewport-overflow-right", "mouseenter", "mouseleave"],
2341
- setup(s, { expose: e, emit: o }) {
2342
- const t = s, n = o, i = H(), r = H(), l = H(!1), a = H(!1);
2346
+ setup(n, { expose: e, emit: o }) {
2347
+ const t = n, s = o, r = H(), i = H(), l = H(!1), a = H(!1);
2343
2348
  let h = null, f = !1, p = null;
2344
2349
  function u(G) {
2345
2350
  G.preventDefault(), G.stopPropagation(), h = { x: G.clientX, y: G.clientY }, f = !1, document.addEventListener("mousemove", w), document.addEventListener("mouseup", D);
@@ -2347,7 +2352,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2347
2352
  function w(G) {
2348
2353
  if (!h) return;
2349
2354
  const d = G.clientX - h.x, y = G.clientY - h.y;
2350
- Math.sqrt(d * d + y * y) >= xo && (f = !0, O(), n("start-drag", t.node.id));
2355
+ Math.sqrt(d * d + y * y) >= xo && (f = !0, O(), s("start-drag", t.node.id));
2351
2356
  }
2352
2357
  function D() {
2353
2358
  O(), f || b(), h = null, f = !1;
@@ -2359,7 +2364,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2359
2364
  a.value ? B() : S();
2360
2365
  }
2361
2366
  function S() {
2362
- a.value = !0, n("open", t.node.id), Ge(() => {
2367
+ a.value = !0, s("open", t.node.id), Ge(() => {
2363
2368
  requestAnimationFrame(() => {
2364
2369
  M();
2365
2370
  });
@@ -2368,105 +2373,105 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2368
2373
  });
2369
2374
  }
2370
2375
  function M() {
2371
- if (!a.value || !t.autoPanOnOpen || !r.value) return;
2376
+ if (!a.value || !t.autoPanOnOpen || !i.value) return;
2372
2377
  const G = window.innerWidth || document.documentElement.clientWidth || 0;
2373
2378
  if (G <= 0) return;
2374
- const d = t.autoPanPadding ?? 16, c = r.value.getBoundingClientRect().right + d - G;
2375
- c > 0 && n("viewport-overflow-right", c);
2379
+ const d = t.autoPanPadding ?? 16, c = i.value.getBoundingClientRect().right + d - G;
2380
+ c > 0 && s("viewport-overflow-right", c);
2376
2381
  }
2377
2382
  function B() {
2378
- a.value = !1, n("close"), document.removeEventListener("mousedown", j);
2383
+ a.value = !1, s("close"), document.removeEventListener("mousedown", j);
2379
2384
  }
2380
2385
  function j(G) {
2381
2386
  const d = G.target;
2382
- i.value?.contains(d) || r.value?.contains(d) || B();
2387
+ r.value?.contains(d) || i.value?.contains(d) || B();
2383
2388
  }
2384
2389
  function k() {
2385
- a.value || n("mouseleave");
2390
+ a.value || s("mouseleave");
2386
2391
  }
2387
2392
  function X() {
2388
- p && (clearTimeout(p), p = null), n("mouseenter");
2393
+ p && (clearTimeout(p), p = null), s("mouseenter");
2389
2394
  }
2390
2395
  function U() {
2391
2396
  p = setTimeout(() => {
2392
- B(), n("mouseleave"), p = null;
2397
+ B(), s("mouseleave"), p = null;
2393
2398
  }, 150);
2394
2399
  }
2395
2400
  return Te(() => {
2396
2401
  O(), p && clearTimeout(p), document.removeEventListener("mousedown", j);
2397
2402
  }), e({ closePopover: B }), (G, d) => (A(), T("div", {
2398
2403
  class: "flow-canvas-quick-add",
2399
- style: Ee({ left: `${s.portPosition.x}px`, top: `${s.portPosition.y}px` }),
2400
- onMouseenter: d[2] || (d[2] = (y) => n("mouseenter")),
2404
+ style: Ee({ left: `${n.portPosition.x}px`, top: `${n.portPosition.y}px` }),
2405
+ onMouseenter: d[2] || (d[2] = (y) => s("mouseenter")),
2401
2406
  onMouseleave: k,
2402
2407
  onClick: d[3] || (d[3] = ht(() => {
2403
2408
  }, ["stop"]))
2404
2409
  }, [
2405
- q("div", {
2410
+ F("div", {
2406
2411
  ref_key: "btnRef",
2407
- ref: i,
2408
- class: te(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2412
+ ref: r,
2413
+ class: oe(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2409
2414
  onMouseenter: d[0] || (d[0] = (y) => l.value = !0),
2410
2415
  onMouseleave: d[1] || (d[1] = (y) => l.value = !1),
2411
2416
  onMousedown: u
2412
2417
  }, [...d[4] || (d[4] = [
2413
- q("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2418
+ F("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2414
2419
  ])], 34),
2415
2420
  l.value && !a.value ? (A(), T("div", Eo, [...d[5] || (d[5] = [
2416
- q("div", null, [
2417
- q("b", null, "点击"),
2421
+ F("div", null, [
2422
+ F("b", null, "点击"),
2418
2423
  je(" 添加节点")
2419
2424
  ], -1),
2420
- q("div", null, [
2421
- q("b", null, "拖拽"),
2425
+ F("div", null, [
2426
+ F("b", null, "拖拽"),
2422
2427
  je(" 连接节点")
2423
2428
  ], -1)
2424
- ])])) : Y("", !0),
2429
+ ])])) : K("", !0),
2425
2430
  at(lt, { name: "flow-canvas-fade" }, {
2426
2431
  default: He(() => [
2427
2432
  a.value ? (A(), T("div", {
2428
2433
  key: 0,
2429
2434
  ref_key: "popoverRef",
2430
- ref: r,
2435
+ ref: i,
2431
2436
  class: "flow-canvas-quick-add__popover",
2432
2437
  onMouseenter: X,
2433
2438
  onMouseleave: U
2434
2439
  }, [
2435
2440
  Me(G.$slots, "default", {}, () => [
2436
- d[6] || (d[6] = q("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2441
+ d[6] || (d[6] = F("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2437
2442
  ], !0)
2438
- ], 544)) : Y("", !0)
2443
+ ], 544)) : K("", !0)
2439
2444
  ]),
2440
2445
  _: 3
2441
2446
  })
2442
2447
  ], 36));
2443
2448
  }
2444
- }), Co = /* @__PURE__ */ ve(Io, [["__scopeId", "data-v-255b3d8c"]]), ko = { class: "flow-canvas-selection-actions__bar" }, So = /* @__PURE__ */ fe({
2449
+ }), Co = /* @__PURE__ */ me(Io, [["__scopeId", "data-v-255b3d8c"]]), ko = { class: "flow-canvas-selection-actions__bar" }, So = /* @__PURE__ */ pe({
2445
2450
  __name: "selection-actions-toolbar",
2446
2451
  props: {
2447
2452
  position: {},
2448
2453
  canDelete: { type: Boolean }
2449
2454
  },
2450
2455
  emits: ["action"],
2451
- setup(s, { emit: e }) {
2452
- const o = s, t = e, n = V(() => ({
2456
+ setup(n, { emit: e }) {
2457
+ const o = n, t = e, s = V(() => ({
2453
2458
  left: `${o.position.x}px`,
2454
2459
  top: `${o.position.y}px`,
2455
2460
  transform: "translateX(-100%)"
2456
2461
  }));
2457
- return (i, r) => (A(), T("div", {
2462
+ return (r, i) => (A(), T("div", {
2458
2463
  class: "flow-canvas-selection-actions",
2459
- style: Ee(n.value)
2464
+ style: Ee(s.value)
2460
2465
  }, [
2461
- q("div", ko, [
2462
- q("i", {
2463
- class: te(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !s.canDelete }]),
2464
- onClick: r[0] || (r[0] = (l) => s.canDelete && t("action", "delete"))
2466
+ F("div", ko, [
2467
+ F("i", {
2468
+ class: oe(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !n.canDelete }]),
2469
+ onClick: i[0] || (i[0] = (l) => n.canDelete && t("action", "delete"))
2465
2470
  }, null, 2)
2466
2471
  ])
2467
2472
  ], 4));
2468
2473
  }
2469
- }), Mo = /* @__PURE__ */ ve(So, [["__scopeId", "data-v-25eb8b79"]]), No = { class: "flow-canvas-runtime-core__overlay" }, Do = /* @__PURE__ */ fe({
2474
+ }), Mo = /* @__PURE__ */ me(So, [["__scopeId", "data-v-25eb8b79"]]), No = { class: "flow-canvas-runtime-core__overlay" }, Do = /* @__PURE__ */ pe({
2470
2475
  __name: "canvas-runtime-core",
2471
2476
  props: {
2472
2477
  editor: {},
@@ -2478,8 +2483,8 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2478
2483
  toolbarInclude: {}
2479
2484
  },
2480
2485
  emits: ["ui-event"],
2481
- setup(s, { expose: e, emit: o }) {
2482
- const t = s, n = o, i = H(), r = H();
2486
+ setup(n, { expose: e, emit: o }) {
2487
+ const t = n, s = o, r = H(), i = H();
2483
2488
  let l, a, h, f, p = null, u = null, w = null, D = null, O = null;
2484
2489
  const b = oo(), { hoveredNodeId: S, isDraggingNode: M } = b, B = b.enterOverlay, j = () => b.leaveOverlay(), k = H(0), X = H({ nodeIds: [], edgeIds: [] });
2485
2490
  function U(I) {
@@ -2503,15 +2508,15 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2503
2508
  () => {
2504
2509
  if (k.value, !t.editor.api.value) return [];
2505
2510
  const I = t.editor.flowModel.value, C = t.editor.api.value.overlay, P = [];
2506
- for (const [W, ee] of Object.entries(I.nodes)) {
2507
- const le = t.editor._pluginManager.collectNodeDecorations(ee);
2508
- if (!le?.badge) continue;
2509
- const oe = C.getNodeScreenRect(W);
2510
- oe && P.push({
2511
+ for (const [W, te] of Object.entries(I.nodes)) {
2512
+ const ce = t.editor._pluginManager.collectNodeDecorations(te);
2513
+ if (!ce?.badge) continue;
2514
+ const se = C.getNodeScreenRect(W);
2515
+ se && P.push({
2511
2516
  nodeId: W,
2512
- x: oe.x + oe.width - 4,
2513
- y: oe.y - 8,
2514
- badge: le.badge
2517
+ x: se.x + se.width - 4,
2518
+ y: se.y - 8,
2519
+ badge: ce.badge
2515
2520
  });
2516
2521
  }
2517
2522
  return P;
@@ -2525,11 +2530,11 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2525
2530
  if (!P) return null;
2526
2531
  const W = t.editor.api.value.overlay.getNodeScreenRect(I);
2527
2532
  if (!W) return null;
2528
- const ee = U(P);
2529
- return ee.showActions === !1 ? null : {
2533
+ const te = U(P);
2534
+ return te.showActions === !1 ? null : {
2530
2535
  node: P,
2531
2536
  position: { x: W.x + W.width, y: W.y + W.height + 4 },
2532
- behavior: ee
2537
+ behavior: te
2533
2538
  };
2534
2539
  }), g = V(() => {
2535
2540
  if (k.value, !t.editor.api.value || t.editor.mode.value !== "edit") return null;
@@ -2542,7 +2547,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2542
2547
  position: { x: C.x + C.width, y: C.y + C.height + 4 },
2543
2548
  canDelete: P.nodeIds.length > 0 || P.edgeIds.length > 0
2544
2549
  };
2545
- }), v = H(), m = io({
2550
+ }), v = H(), m = ro({
2546
2551
  editor: t.editor,
2547
2552
  quickAddProp: V(() => t.quickAdd),
2548
2553
  isDraggingNode: M,
@@ -2553,20 +2558,20 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2553
2558
  getInsertGap: () => d.value.insertGap,
2554
2559
  closePopover: () => v.value?.closePopover()
2555
2560
  }), E = m.data, L = m.handleOpen, z = m.handleStartDrag;
2556
- function re() {
2561
+ function de() {
2557
2562
  m.handleClose(), b.leaveOverlay(200), m.leave();
2558
2563
  }
2559
2564
  const N = m.handleOverlayEnter, _ = m.handleOverlayLeave, x = m.handleInsert, R = lo({
2560
2565
  editor: t.editor,
2561
2566
  edgeDropProp: V(() => t.edgeDrop)
2562
- }), F = co(t.editor);
2563
- function Z(I, C) {
2564
- F.handleNodeAction(I, C, d.value.insertGap) && (S.value = null);
2567
+ }), q = co(t.editor);
2568
+ function Y(I, C) {
2569
+ q.handleNodeAction(I, C, d.value.insertGap) && (S.value = null);
2565
2570
  }
2566
- function ae(I) {
2567
- I === "delete" && F.deleteSelection(X.value);
2571
+ function J(I) {
2572
+ I === "delete" && q.deleteSelection(X.value);
2568
2573
  }
2569
- function Q(I) {
2574
+ function Z(I) {
2570
2575
  if (t.editor.mode.value !== "edit") return;
2571
2576
  if ((I.metaKey || I.ctrlKey) && (I.key === "z" || I.key === "Z")) {
2572
2577
  if (I.shiftKey) {
@@ -2581,14 +2586,14 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2581
2586
  }
2582
2587
  t.editor._pluginManager.dispatchKeyboardShortcut(I) && (I.preventDefault(), I.stopPropagation());
2583
2588
  }
2584
- function K(I, C) {
2585
- const P = l, W = (ee) => {
2586
- const le = P.isRubberbandEnabled?.() ?? !1;
2587
- le && P.disableRubberband?.(), ee ? l.enablePanning() : l.disablePanning(), le && P.enableRubberband?.();
2589
+ function Q(I, C) {
2590
+ const P = l, W = (te) => {
2591
+ const ce = P.isRubberbandEnabled?.() ?? !1;
2592
+ ce && P.disableRubberband?.(), te ? l.enablePanning() : l.disablePanning(), ce && P.enableRubberband?.();
2588
2593
  };
2589
2594
  I && C ? (P.enableSelection?.(), b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1, p?.remove(), W(!1), P.enableRubberband?.()) : (P.disableRubberband?.(), W(!0), P.disableSelection?.(), P.cleanSelection?.());
2590
2595
  }
2591
- function me(I) {
2596
+ function ne(I) {
2592
2597
  l.on("node:move", ({ node: C }) => {
2593
2598
  M.value = !0;
2594
2599
  const P = t.editor.flowModel.value.nodes[C.id];
@@ -2617,14 +2622,14 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2617
2622
  P && U(P).actionsOffset && (W = 300), b.leave(W), m.mergedConfig.value.enabled ? m.quickAddNodeId.value === C.id && !m.quickAddPopoverOpen.value ? m.leave() : m.quickAddNodeId.value !== C.id && I.hideNodePorts(C) : I.hideNodePorts(C);
2618
2623
  });
2619
2624
  }
2620
- function pe(I) {
2625
+ function re(I) {
2621
2626
  l.on("edge:added", ({ edge: C }) => {
2622
2627
  let P;
2623
2628
  if (t.getConnectionExcludedNodeIds && !C.getTargetCell()) {
2624
2629
  const W = C.getSourceCell();
2625
2630
  if (W) {
2626
- const ee = t.getConnectionExcludedNodeIds(W.id);
2627
- P = ee instanceof Set ? ee : new Set(ee);
2631
+ const te = t.getConnectionExcludedNodeIds(W.id);
2632
+ P = te instanceof Set ? te : new Set(te);
2628
2633
  }
2629
2634
  }
2630
2635
  I.handleEdgeAdded(C, P);
@@ -2639,7 +2644,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2639
2644
  a.setHoveredEdge(null), a.refreshSingleEdgeStyle(C.id), p.remove();
2640
2645
  }), l.on("edge:click", ({ edge: C, e: P }) => {
2641
2646
  P.target?.closest?.(".flow-canvas-edge-delete-tool") && t.editor.mode.value === "edit" && (p.remove(), t.editor.executeCommand({
2642
- id: J(),
2647
+ id: ee(),
2643
2648
  source: "user:toolbar",
2644
2649
  label: "删除连线",
2645
2650
  timestamp: Date.now(),
@@ -2656,35 +2661,35 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2656
2661
  return;
2657
2662
  }
2658
2663
  b.leave(180), m.quickAddPopoverOpen.value || m.leave();
2659
- }, i.value?.addEventListener("mousemove", w), D = () => {
2664
+ }, r.value?.addEventListener("mousemove", w), D = () => {
2660
2665
  b.reset(), m.quickAddPopoverOpen.value || (m.quickAddNodeId.value = null);
2661
- }, i.value?.addEventListener("mouseleave", D), i.value?.addEventListener("keydown", Q);
2666
+ }, r.value?.addEventListener("mouseleave", D), r.value?.addEventListener("keydown", Z);
2662
2667
  }
2663
2668
  function $e() {
2664
- ge(
2669
+ he(
2665
2670
  () => t.editor.flowModel.value,
2666
2671
  (I) => a.syncFlowModel(I)
2667
- ), ge(
2672
+ ), he(
2668
2673
  [() => t.editor.mode.value, () => t.editor.selectionMode.value],
2669
2674
  ([I, C]) => {
2670
- K(I === "edit", C);
2675
+ Q(I === "edit", C);
2671
2676
  },
2672
2677
  { immediate: !0 }
2673
2678
  );
2674
2679
  }
2675
2680
  dt(() => {
2676
- if (!r.value) return;
2681
+ if (!i.value) return;
2677
2682
  const I = /* @__PURE__ */ new Set(["model", "container"]), C = {};
2678
2683
  if (t.graphOptions)
2679
- for (const [$, ne] of Object.entries(t.graphOptions)) {
2684
+ for (const [$, ie] of Object.entries(t.graphOptions)) {
2680
2685
  if (I.has($)) {
2681
2686
  console.warn(`[flow-canvas] graphOptions.${$} is managed by the engine and will be ignored`);
2682
2687
  continue;
2683
2688
  }
2684
- C[$] = ne;
2689
+ C[$] = ie;
2685
2690
  }
2686
2691
  l = new Et({
2687
- container: r.value,
2692
+ container: i.value,
2688
2693
  autoResize: !0,
2689
2694
  background: { color: "#edf2fc" },
2690
2695
  grid: {
@@ -2744,25 +2749,25 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2744
2749
  idGenerator: t.editor.idGenerator,
2745
2750
  defaultInsertGap: t.nodeActions?.insertGap,
2746
2751
  getContextMenuItems: ($) => t.editor._pluginManager.collectContextMenuItems($),
2747
- onHighlightChange: ($, ne) => {
2752
+ onHighlightChange: ($, ie) => {
2748
2753
  a.setHighlightedNodes($);
2749
- const he = a.setHighlightedEdges(ne);
2754
+ const ve = a.setHighlightedEdges(ie);
2750
2755
  a.refreshNodeHighlights();
2751
- const se = new Set(ne);
2752
- for (const ye of he)
2753
- se.has(ye) || a.refreshSingleEdgeStyle(ye);
2754
- for (const ye of se)
2755
- he.has(ye) || a.refreshSingleEdgeStyle(ye);
2756
+ const ae = new Set(ie);
2757
+ for (const ye of ve)
2758
+ ae.has(ye) || a.refreshSingleEdgeStyle(ye);
2759
+ for (const ye of ae)
2760
+ ve.has(ye) || a.refreshSingleEdgeStyle(ye);
2756
2761
  },
2757
2762
  resolveNodeShape: ($) => {
2758
- const ne = t.editor.schema.nodeTypes[$];
2759
- if (!ne) return null;
2760
- const he = h.registerNodeType($, ne.component), se = ne.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2761
- return { shapeName: he, width: se.width, height: se.height };
2763
+ const ie = t.editor.schema.nodeTypes[$];
2764
+ if (!ie) return null;
2765
+ const ve = h.registerNodeType($, ie.component), ae = ie.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2766
+ return { shapeName: ve, width: ae.width, height: ae.height };
2762
2767
  }
2763
2768
  });
2764
2769
  t.editor.api.value = W;
2765
- const ee = {
2770
+ const te = {
2766
2771
  flowModel: t.editor.flowModel,
2767
2772
  history: t.editor.history,
2768
2773
  schema: t.editor.schema,
@@ -2774,10 +2779,10 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2774
2779
  overlay: P,
2775
2780
  graph: l
2776
2781
  };
2777
- t.editor._pluginManager.attachRuntime(ee);
2778
- const le = t.editor._pluginManager.collectExtendedApi();
2779
- Object.assign(t.editor.extendedApi, le), t.editor._emitUiEvent = ($) => {
2780
- t.editor._pluginManager.dispatchUiEvent($), n("ui-event", $);
2782
+ t.editor._pluginManager.attachRuntime(te);
2783
+ const ce = t.editor._pluginManager.collectExtendedApi();
2784
+ Object.assign(t.editor.extendedApi, ce), t.editor._emitUiEvent = ($) => {
2785
+ t.editor._pluginManager.dispatchUiEvent($), s("ui-event", $);
2781
2786
  }, f = new Xt(
2782
2787
  l,
2783
2788
  ($) => {
@@ -2785,11 +2790,11 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2785
2790
  },
2786
2791
  ($) => {
2787
2792
  if (a.isSyncing) return;
2788
- const ne = R.tryExpandForEdgeDrop($);
2789
- if (t.editor.executeCommand(ne).status !== "applied") {
2790
- for (const se of ne.commands)
2791
- if (se.type === "edge.add") {
2792
- const ye = l.getCellById(se.edge.id);
2793
+ const ie = R.tryExpandForEdgeDrop($);
2794
+ if (t.editor.executeCommand(ie).status !== "applied") {
2795
+ for (const ae of ie.commands)
2796
+ if (ae.type === "edge.add") {
2797
+ const ye = l.getCellById(ae.edge.id);
2793
2798
  ye && l.removeCell(ye);
2794
2799
  }
2795
2800
  }
@@ -2797,22 +2802,22 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2797
2802
  t.editor.flowModel,
2798
2803
  t.editor.idGenerator
2799
2804
  ), p = no(l);
2800
- const oe = so(l);
2801
- m.attachRuntime(l, ($) => oe.hideNodePorts($)), R.attachRuntime(l), me(oe), pe(oe), O = vo(l.container);
2805
+ const se = so(l);
2806
+ m.attachRuntime(l, ($) => se.hideNodePorts($)), R.attachRuntime(l), ne(se), re(se), O = vo(l.container);
2802
2807
  let xe = /* @__PURE__ */ new Set(), be = /* @__PURE__ */ new Set();
2803
2808
  l.on("selection:changed", () => {
2804
- const $ = ft(l.getSelectedCells?.() ?? []), ne = new Set($.nodeIds);
2805
- mo(l, xe, ne), xe = ne, X.value = $, t.editor._pluginManager.dispatchSelectionChange($), n("ui-event", {
2809
+ const $ = ft(l.getSelectedCells?.() ?? []), ie = new Set($.nodeIds);
2810
+ mo(l, xe, ie), xe = ie, X.value = $, t.editor._pluginManager.dispatchSelectionChange($), s("ui-event", {
2806
2811
  type: "selection.change",
2807
2812
  nodeIds: $.nodeIds,
2808
2813
  edgeIds: $.edgeIds
2809
2814
  }), a.refreshNodeHighlights();
2810
- const he = new Set($.edgeIds);
2811
- for (const se of be)
2812
- he.has(se) || a.refreshSingleEdgeStyle(se);
2813
- for (const se of he)
2814
- be.has(se) || a.refreshSingleEdgeStyle(se);
2815
- be = he;
2815
+ const ve = new Set($.edgeIds);
2816
+ for (const ae of be)
2817
+ ve.has(ae) || a.refreshSingleEdgeStyle(ae);
2818
+ for (const ae of ve)
2819
+ be.has(ae) || a.refreshSingleEdgeStyle(ae);
2820
+ be = ve;
2816
2821
  });
2817
2822
  const Be = () => {
2818
2823
  k.value++;
@@ -2823,93 +2828,93 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2823
2828
  b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1;
2824
2829
  }
2825
2830
  return e({ resetHoverState: Se }), Te(() => {
2826
- b.cleanup(), m.cleanup(), R.cleanup(), p?.remove(), u && l?.container?.removeEventListener("mousemove", u), w && i.value?.removeEventListener("mousemove", w), D && i.value?.removeEventListener("mouseleave", D), O?.(), i.value?.removeEventListener("keydown", Q), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2831
+ b.cleanup(), m.cleanup(), R.cleanup(), p?.remove(), u && l?.container?.removeEventListener("mousemove", u), w && r.value?.removeEventListener("mousemove", w), D && r.value?.removeEventListener("mouseleave", D), O?.(), r.value?.removeEventListener("keydown", Z), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2827
2832
  for (const I of Object.keys(t.editor.extendedApi))
2828
2833
  delete t.editor.extendedApi[I];
2829
2834
  f?.dispose(), a?.dispose(), h?.dispose(), l?.dispose();
2830
2835
  }), (I, C) => (A(), T("div", {
2831
2836
  ref_key: "rootRef",
2832
- ref: i,
2833
- class: te(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": G.value }]),
2837
+ ref: r,
2838
+ class: oe(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": G.value }]),
2834
2839
  tabindex: "0"
2835
2840
  }, [
2836
- q("div", {
2841
+ F("div", {
2837
2842
  ref_key: "containerRef",
2838
- ref: r,
2843
+ ref: i,
2839
2844
  class: "flow-canvas-runtime-core__graph"
2840
2845
  }, null, 512),
2841
- q("div", No, [
2842
- (A(!0), T(de, null, Ie(y.value, (P) => (A(), T("div", {
2846
+ F("div", No, [
2847
+ (A(!0), T(ue, null, Ce(y.value, (P) => (A(), T("div", {
2843
2848
  key: `badge-${P.nodeId}`,
2844
2849
  class: "flow-canvas-runtime-core__badge",
2845
2850
  style: Ee({ left: `${P.x}px`, top: `${P.y}px`, backgroundColor: P.badge.color })
2846
- }, ce(P.badge.text), 5))), 128)),
2847
- ie(E) ? (A(), Ce(Co, {
2851
+ }, fe(P.badge.text), 5))), 128)),
2852
+ le(E) ? (A(), Ie(Co, {
2848
2853
  key: 0,
2849
2854
  ref_key: "quickAddPopoverRef",
2850
2855
  ref: v,
2851
- node: ie(E).node,
2852
- "port-position": ie(E).portPosition,
2853
- "auto-pan-on-open": ie(m).mergedConfig.value.autoPanOnOpen,
2854
- "auto-pan-padding": ie(m).mergedConfig.value.autoPanPadding,
2855
- onOpen: ie(L),
2856
- onClose: re,
2857
- onStartDrag: ie(z),
2858
- onViewportOverflowRight: ie(m).handlePopoverViewportOverflow,
2859
- onMouseenter: ie(N),
2860
- onMouseleave: ie(_)
2856
+ node: le(E).node,
2857
+ "port-position": le(E).portPosition,
2858
+ "auto-pan-on-open": le(m).mergedConfig.value.autoPanOnOpen,
2859
+ "auto-pan-padding": le(m).mergedConfig.value.autoPanPadding,
2860
+ onOpen: le(L),
2861
+ onClose: de,
2862
+ onStartDrag: le(z),
2863
+ onViewportOverflowRight: le(m).handlePopoverViewportOverflow,
2864
+ onMouseenter: le(N),
2865
+ onMouseleave: le(_)
2861
2866
  }, {
2862
2867
  default: He(() => [
2863
2868
  Me(I.$slots, "quick-add-panel", {
2864
- node: ie(E).node,
2865
- api: s.editor.api.value,
2866
- insertNodeToRight: (P) => ie(x)(ie(E).node.id, P),
2869
+ node: le(E).node,
2870
+ api: n.editor.api.value,
2871
+ insertNodeToRight: (P) => le(x)(le(E).node.id, P),
2867
2872
  closePopover: () => v.value?.closePopover()
2868
2873
  }, void 0, !0)
2869
2874
  ]),
2870
2875
  _: 3
2871
- }, 8, ["node", "port-position", "auto-pan-on-open", "auto-pan-padding", "onOpen", "onStartDrag", "onViewportOverflowRight", "onMouseenter", "onMouseleave"])) : Y("", !0),
2872
- c.value ? (A(), Ce(bo, {
2876
+ }, 8, ["node", "port-position", "auto-pan-on-open", "auto-pan-padding", "onOpen", "onStartDrag", "onViewportOverflowRight", "onMouseenter", "onMouseleave"])) : K("", !0),
2877
+ c.value ? (A(), Ie(bo, {
2873
2878
  key: 1,
2874
2879
  node: c.value.node,
2875
2880
  position: c.value.position,
2876
2881
  config: d.value,
2877
2882
  behavior: c.value.behavior,
2878
2883
  "actions-offset": c.value.behavior.actionsOffset,
2879
- onAction: Z,
2880
- onMouseenter: ie(B),
2884
+ onAction: Y,
2885
+ onMouseenter: le(B),
2881
2886
  onMouseleave: j
2882
- }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : Y("", !0),
2883
- g.value ? (A(), Ce(Mo, {
2887
+ }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : K("", !0),
2888
+ g.value ? (A(), Ie(Mo, {
2884
2889
  key: 2,
2885
2890
  position: g.value.position,
2886
2891
  "can-delete": g.value.canDelete,
2887
- onAction: ae
2888
- }, null, 8, ["position", "can-delete"])) : Y("", !0)
2892
+ onAction: J
2893
+ }, null, 8, ["position", "can-delete"])) : K("", !0)
2889
2894
  ])
2890
2895
  ], 2));
2891
2896
  }
2892
- }), Dn = /* @__PURE__ */ ve(Do, [["__scopeId", "data-v-84584822"]]), Ao = { class: "flow-canvas-node-palette" }, _o = ["data-node-type"], Po = { class: "flow-canvas-node-palette__item-label" }, To = /* @__PURE__ */ fe({
2897
+ }), Dn = /* @__PURE__ */ me(Do, [["__scopeId", "data-v-84584822"]]), Ao = { class: "flow-canvas-node-palette" }, _o = ["data-node-type"], Po = { class: "flow-canvas-node-palette__item-label" }, To = /* @__PURE__ */ pe({
2893
2898
  __name: "canvas-node-palette",
2894
2899
  props: {
2895
2900
  editor: {},
2896
2901
  items: {}
2897
2902
  },
2898
- setup(s) {
2899
- const e = s, o = H(), t = V(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((n) => ({
2900
- type: n,
2901
- label: n.charAt(0).toUpperCase() + n.slice(1)
2903
+ setup(n) {
2904
+ const e = n, o = H(), t = V(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((s) => ({
2905
+ type: s,
2906
+ label: s.charAt(0).toUpperCase() + s.slice(1)
2902
2907
  })));
2903
- return ge(
2908
+ return he(
2904
2909
  [() => e.editor.api.value, t, o],
2905
- ([n, i, r], l, a) => {
2906
- if (!n || !r) return;
2910
+ ([s, r, i], l, a) => {
2911
+ if (!s || !i) return;
2907
2912
  const h = [];
2908
- for (const f of i) {
2909
- const p = r.querySelector(`[data-node-type="${f.type}"]`);
2913
+ for (const f of r) {
2914
+ const p = i.querySelector(`[data-node-type="${f.type}"]`);
2910
2915
  if (!p) continue;
2911
- const u = n.registerDndSource(p, () => ({
2912
- id: J(),
2916
+ const u = s.registerDndSource(p, () => ({
2917
+ id: ee(),
2913
2918
  type: f.type,
2914
2919
  label: f.label,
2915
2920
  position: { x: 0, y: 0 }
@@ -2921,30 +2926,30 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2921
2926
  });
2922
2927
  },
2923
2928
  { flush: "post" }
2924
- ), (n, i) => (A(), T("div", Ao, [
2925
- q("div", {
2929
+ ), (s, r) => (A(), T("div", Ao, [
2930
+ F("div", {
2926
2931
  ref_key: "listRef",
2927
2932
  ref: o,
2928
2933
  class: "flow-canvas-node-palette__list"
2929
2934
  }, [
2930
- (A(!0), T(de, null, Ie(t.value, (r) => (A(), T("div", {
2931
- key: r.type,
2935
+ (A(!0), T(ue, null, Ce(t.value, (i) => (A(), T("div", {
2936
+ key: i.type,
2932
2937
  class: "flow-canvas-node-palette__item",
2933
- "data-node-type": r.type
2938
+ "data-node-type": i.type
2934
2939
  }, [
2935
- r.icon ? (A(), T("i", {
2940
+ i.icon ? (A(), T("i", {
2936
2941
  key: 0,
2937
- class: te([r.icon, "flow-canvas-node-palette__item-icon"])
2938
- }, null, 2)) : Y("", !0),
2939
- q("span", Po, ce(r.label), 1)
2942
+ class: oe([i.icon, "flow-canvas-node-palette__item-icon"])
2943
+ }, null, 2)) : K("", !0),
2944
+ F("span", Po, fe(i.label), 1)
2940
2945
  ], 8, _o))), 128))
2941
2946
  ], 512)
2942
2947
  ]));
2943
2948
  }
2944
- }), Ro = /* @__PURE__ */ ve(To, [["__scopeId", "data-v-300314b7"]]), Lo = { class: "flow-canvas-layout" }, Oo = { class: "flow-canvas-layout__main" }, $o = { class: "flow-canvas-layout__content" }, Bo = {
2949
+ }), Ro = /* @__PURE__ */ me(To, [["__scopeId", "data-v-300314b7"]]), Lo = { class: "flow-canvas-layout" }, Oo = { class: "flow-canvas-layout__main" }, $o = { class: "flow-canvas-layout__content" }, Bo = {
2945
2950
  key: 0,
2946
2951
  class: "flow-canvas-layout__footer"
2947
- }, Fo = /* @__PURE__ */ fe({
2952
+ }, Fo = /* @__PURE__ */ pe({
2948
2953
  __name: "canvas-layout",
2949
2954
  props: {
2950
2955
  sidebarCollapsed: { type: Boolean, default: !1 },
@@ -2955,34 +2960,34 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2955
2960
  paletteItems: { default: void 0 }
2956
2961
  },
2957
2962
  emits: ["update:sidebarCollapsed"],
2958
- setup(s) {
2963
+ setup(n) {
2959
2964
  return (e, o) => (A(), T("div", Lo, [
2960
- !s.hideSidebar && (e.$slots.sidebar || s.editor) ? (A(), T("aside", {
2965
+ !n.hideSidebar && (e.$slots.sidebar || n.editor) ? (A(), T("aside", {
2961
2966
  key: 0,
2962
- class: te(["flow-canvas-layout__sidebar", { "is-collapsed": s.sidebarCollapsed }]),
2963
- style: Ee({ width: s.sidebarCollapsed ? "0px" : `${s.sidebarWidth}px` })
2967
+ class: oe(["flow-canvas-layout__sidebar", { "is-collapsed": n.sidebarCollapsed }]),
2968
+ style: Ee({ width: n.sidebarCollapsed ? "0px" : `${n.sidebarWidth}px` })
2964
2969
  }, [
2965
2970
  Me(e.$slots, "sidebar", {}, () => [
2966
- s.editor ? (A(), Ce(Ro, {
2971
+ n.editor ? (A(), Ie(Ro, {
2967
2972
  key: 0,
2968
- editor: s.editor,
2969
- items: s.paletteItems
2970
- }, null, 8, ["editor", "items"])) : Y("", !0)
2973
+ editor: n.editor,
2974
+ items: n.paletteItems
2975
+ }, null, 8, ["editor", "items"])) : K("", !0)
2971
2976
  ], !0)
2972
- ], 6)) : Y("", !0),
2973
- q("div", Oo, [
2974
- q("div", $o, [
2977
+ ], 6)) : K("", !0),
2978
+ F("div", Oo, [
2979
+ F("div", $o, [
2975
2980
  Me(e.$slots, "default", {}, void 0, !0)
2976
2981
  ]),
2977
- !s.hideFooter && e.$slots.footer ? (A(), T("div", Bo, [
2982
+ !n.hideFooter && e.$slots.footer ? (A(), T("div", Bo, [
2978
2983
  Me(e.$slots, "footer", {}, void 0, !0)
2979
- ])) : Y("", !0)
2984
+ ])) : K("", !0)
2980
2985
  ])
2981
2986
  ]));
2982
2987
  }
2983
- }), An = /* @__PURE__ */ ve(Fo, [["__scopeId", "data-v-26f35b6b"]]), et = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), qo = ["undo", "redo"];
2984
- function Ho(s) {
2985
- const e = new Set(s?.include), o = new Set(qo.filter((a) => !e.has(a))), t = [
2988
+ }), An = /* @__PURE__ */ me(Fo, [["__scopeId", "data-v-26f35b6b"]]), et = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), qo = ["undo", "redo"];
2989
+ function Ho(n) {
2990
+ const e = new Set(n?.include), o = new Set(qo.filter((a) => !e.has(a))), t = [
2986
2991
  {
2987
2992
  id: "undo",
2988
2993
  type: "undo",
@@ -3001,7 +3006,7 @@ function Ho(s) {
3001
3006
  shortcut: et ? ["⇧", "⌘", "Z"] : ["Ctrl", "Shift", "Z"],
3002
3007
  order: 11
3003
3008
  }
3004
- ], n = [
3009
+ ], s = [
3005
3010
  {
3006
3011
  id: "select",
3007
3012
  type: "select",
@@ -3026,7 +3031,7 @@ function Ho(s) {
3026
3031
  description: "下载",
3027
3032
  order: 24
3028
3033
  }
3029
- ], i = [
3034
+ ], r = [
3030
3035
  {
3031
3036
  id: "zoom-out",
3032
3037
  type: "zoom-out",
@@ -3044,7 +3049,7 @@ function Ho(s) {
3044
3049
  description: "放大画布",
3045
3050
  order: 32
3046
3051
  }
3047
- ], r = [
3052
+ ], i = [
3048
3053
  {
3049
3054
  id: "reset",
3050
3055
  type: "reset",
@@ -3054,9 +3059,9 @@ function Ho(s) {
3054
3059
  order: 40
3055
3060
  }
3056
3061
  ];
3057
- return [...[...t, ...n].filter(
3062
+ return [...[...t, ...s].filter(
3058
3063
  (a) => !o.has(a.type)
3059
- ), ...i, ...r];
3064
+ ), ...r, ...i];
3060
3065
  }
3061
3066
  const Go = { class: "flow-canvas-toolbar" }, zo = {
3062
3067
  key: 0,
@@ -3067,7 +3072,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3067
3072
  }, Wo = ["data-toolbar-id", "data-toolbar-type", "disabled", "onClick", "onMouseenter"], Vo = ["textContent"], Xo = {
3068
3073
  key: 0,
3069
3074
  class: "flow-canvas-toolbar-tooltip__kbd"
3070
- }, Ko = /* @__PURE__ */ fe({
3075
+ }, Ko = /* @__PURE__ */ pe({
3071
3076
  __name: "canvas-toolbar",
3072
3077
  props: {
3073
3078
  items: {},
@@ -3075,7 +3080,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3075
3080
  include: {},
3076
3081
  editor: {}
3077
3082
  },
3078
- setup(s) {
3083
+ setup(n) {
3079
3084
  const e = /* @__PURE__ */ new Set([
3080
3085
  "undo",
3081
3086
  "redo",
@@ -3088,12 +3093,12 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3088
3093
  function t(c) {
3089
3094
  return c.id.startsWith("plugin:") || c.type === "custom";
3090
3095
  }
3091
- function n(c) {
3096
+ function s(c) {
3092
3097
  return c !== "custom" && o.has(c);
3093
3098
  }
3094
- const i = s, r = V(() => {
3095
- if (i.items) return i.items;
3096
- const c = Ho({ include: i.include }), g = i.editor.toolbarItems.value, v = new Set(i.exclude ?? []), m = /* @__PURE__ */ new Map();
3099
+ const r = n, i = V(() => {
3100
+ if (r.items) return r.items;
3101
+ const c = Ho({ include: r.include }), g = r.editor.toolbarItems.value, v = new Set(r.exclude ?? []), m = /* @__PURE__ */ new Map();
3097
3102
  for (const E of c)
3098
3103
  m.set(E.id, E);
3099
3104
  for (const E of g) {
@@ -3103,8 +3108,8 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3103
3108
  return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !v.has(E.type)).sort((E, L) => (E.order ?? 0) - (L.order ?? 0));
3104
3109
  }), l = H(1), a = H(null), h = H(null), f = H(!1);
3105
3110
  let p = null;
3106
- ge(
3107
- () => i.editor.api.value,
3111
+ he(
3112
+ () => r.editor.api.value,
3108
3113
  (c) => {
3109
3114
  p?.(), p = null, c && (l.value = c.getZoom(), p = c.onGraphEvent("scale", () => {
3110
3115
  l.value = c.getZoom();
@@ -3124,62 +3129,62 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3124
3129
  function D() {
3125
3130
  u.visible = !1, a.value = null;
3126
3131
  }
3127
- rt(() => {
3132
+ it(() => {
3128
3133
  p?.();
3129
3134
  });
3130
- const O = V(() => `${Math.round(l.value * 100)}%`), b = V(() => i.editor.api.value ? {
3131
- api: i.editor.api.value,
3132
- flowModel: i.editor.flowModel.value,
3133
- history: i.editor.history,
3134
- mode: i.editor.mode.value
3135
+ const O = V(() => `${Math.round(l.value * 100)}%`), b = V(() => r.editor.api.value ? {
3136
+ api: r.editor.api.value,
3137
+ flowModel: r.editor.flowModel.value,
3138
+ history: r.editor.history,
3139
+ mode: r.editor.mode.value
3135
3140
  } : null);
3136
3141
  function S(c) {
3137
3142
  return c.visible === !1 ? !1 : typeof c.visible == "function" ? b.value ? c.visible(b.value) : !1 : !0;
3138
3143
  }
3139
3144
  function M(c) {
3140
- return typeof c.active == "function" ? b.value ? c.active(b.value) : !1 : c.active !== void 0 ? c.active : c.type === "select" ? i.editor.selectionMode.value : !1;
3145
+ return typeof c.active == "function" ? b.value ? c.active(b.value) : !1 : c.active !== void 0 ? c.active : c.type === "select" ? r.editor.selectionMode.value : !1;
3141
3146
  }
3142
3147
  const B = V(() => {
3143
3148
  const c = d.value.filter(
3144
- (v) => n(v.type) && M(v)
3149
+ (v) => s(v.type) && M(v)
3145
3150
  );
3146
3151
  if (c.length === 0) return null;
3147
3152
  const g = h.value;
3148
3153
  return g && c.some((v) => v.type === g) ? g : c[0]?.type ?? null;
3149
3154
  });
3150
3155
  function j(c) {
3151
- return n(c.type) ? B.value === c.type : M(c);
3156
+ return s(c.type) ? B.value === c.type : M(c);
3152
3157
  }
3153
3158
  function k(c) {
3154
- return !b.value || c.disabled === !0 ? !0 : typeof c.disabled == "function" ? c.disabled(b.value) : c.type === "undo" ? !i.editor.history.canUndo.value : c.type === "redo" ? !i.editor.history.canRedo.value : c.type === "export" ? f.value : !1;
3159
+ return !b.value || c.disabled === !0 ? !0 : typeof c.disabled == "function" ? c.disabled(b.value) : c.type === "undo" ? !r.editor.history.canUndo.value : c.type === "redo" ? !r.editor.history.canRedo.value : c.type === "export" ? f.value : !1;
3155
3160
  }
3156
3161
  function X(c) {
3157
- if (!(!b.value || !n(c.type) || !M(c))) {
3162
+ if (!(!b.value || !s(c.type) || !M(c))) {
3158
3163
  if (c.type === "select") {
3159
- i.editor.setSelectionMode(!1);
3164
+ r.editor.setSelectionMode(!1);
3160
3165
  return;
3161
3166
  }
3162
3167
  c.onClick?.(b.value);
3163
3168
  }
3164
3169
  }
3165
3170
  function U(c) {
3166
- if (n(c.type))
3171
+ if (s(c.type))
3167
3172
  for (const g of d.value)
3168
- !n(g.type) || g.id === c.id || X(g);
3173
+ !s(g.type) || g.id === c.id || X(g);
3169
3174
  }
3170
3175
  function G(c) {
3171
3176
  if (!b.value || k(c)) return;
3172
- if (n(c.type) && (h.value = c.type, U(c)), c.onClick) {
3177
+ if (s(c.type) && (h.value = c.type, U(c)), c.onClick) {
3173
3178
  c.onClick(b.value);
3174
3179
  return;
3175
3180
  }
3176
3181
  const { api: g } = b.value;
3177
3182
  switch (c.type) {
3178
3183
  case "undo":
3179
- i.editor.history.undo();
3184
+ r.editor.history.undo();
3180
3185
  break;
3181
3186
  case "redo":
3182
- i.editor.history.redo();
3187
+ r.editor.history.redo();
3183
3188
  break;
3184
3189
  case "zoom-in":
3185
3190
  g.zoomIn(), l.value = g.getZoom();
@@ -3205,10 +3210,10 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3205
3210
  });
3206
3211
  break;
3207
3212
  case "select":
3208
- i.editor.setSelectionMode(!i.editor.selectionMode.value);
3213
+ r.editor.setSelectionMode(!r.editor.selectionMode.value);
3209
3214
  break;
3210
3215
  case "auto-layout":
3211
- i.editor._emitUiEvent({ type: "toolbar.auto-layout" });
3216
+ r.editor._emitUiEvent({ type: "toolbar.auto-layout" });
3212
3217
  break;
3213
3218
  case "search":
3214
3219
  case "minimap":
@@ -3219,7 +3224,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3219
3224
  break;
3220
3225
  }
3221
3226
  }
3222
- const d = V(() => r.value.filter(S)), y = V(() => {
3227
+ const d = V(() => i.value.filter(S)), y = V(() => {
3223
3228
  const c = /* @__PURE__ */ new Map(), g = [];
3224
3229
  for (const v of d.value) {
3225
3230
  const m = v.group ?? "default";
@@ -3228,18 +3233,18 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3228
3233
  return g.map((v) => ({ name: v, items: c.get(v) })).filter((v) => v.items.length > 0);
3229
3234
  });
3230
3235
  return (c, g) => (A(), T("div", Go, [
3231
- (A(!0), T(de, null, Ie(y.value, (v, m) => (A(), T(de, {
3236
+ (A(!0), T(ue, null, Ce(y.value, (v, m) => (A(), T(ue, {
3232
3237
  key: v.name
3233
3238
  }, [
3234
- m > 0 ? (A(), T("div", zo)) : Y("", !0),
3235
- q("div", Uo, [
3236
- (A(!0), T(de, null, Ie(v.items, (E) => (A(), T(de, {
3239
+ m > 0 ? (A(), T("div", zo)) : K("", !0),
3240
+ F("div", Uo, [
3241
+ (A(!0), T(ue, null, Ce(v.items, (E) => (A(), T(ue, {
3237
3242
  key: E.id
3238
3243
  }, [
3239
- E.type === "zoom-display" ? (A(), T("span", jo, ce(O.value), 1)) : (A(), T("button", {
3244
+ E.type === "zoom-display" ? (A(), T("span", jo, fe(O.value), 1)) : (A(), T("button", {
3240
3245
  key: 1,
3241
3246
  type: "button",
3242
- class: te(["flow-canvas-toolbar__btn", {
3247
+ class: oe(["flow-canvas-toolbar__btn", {
3243
3248
  "is-disabled": k(E),
3244
3249
  "is-active": j(E),
3245
3250
  "is-exporting": E.type === "export" && f.value
@@ -3251,19 +3256,19 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3251
3256
  onMouseenter: (L) => w(L, E),
3252
3257
  onMouseleave: D
3253
3258
  }, [
3254
- E.component ? (A(), Ce(mt(E.component), { key: 0 })) : E.icon ? (A(), T("i", {
3259
+ E.component ? (A(), Ie(mt(E.component), { key: 0 })) : E.icon ? (A(), T("i", {
3255
3260
  key: 1,
3256
- class: te(E.icon)
3261
+ class: oe(E.icon)
3257
3262
  }, null, 2)) : (A(), T("span", {
3258
3263
  key: 2,
3259
3264
  class: "flow-canvas-toolbar__text",
3260
- textContent: ce(E.text ?? E.description ?? E.id)
3265
+ textContent: fe(E.text ?? E.description ?? E.id)
3261
3266
  }, null, 8, Vo))
3262
3267
  ], 42, Wo))
3263
3268
  ], 64))), 128))
3264
3269
  ])
3265
3270
  ], 64))), 128)),
3266
- (A(), Ce(yt, { to: "body" }, [
3271
+ (A(), Ie(yt, { to: "body" }, [
3267
3272
  u.visible ? (A(), T("div", {
3268
3273
  key: 0,
3269
3274
  ref_key: "tooltipRef",
@@ -3271,58 +3276,58 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3271
3276
  class: "flow-canvas-toolbar-tooltip",
3272
3277
  style: Ee({ left: `${u.x}px`, top: `${u.y}px` })
3273
3278
  }, [
3274
- q("span", null, ce(u.text), 1),
3279
+ F("span", null, fe(u.text), 1),
3275
3280
  u.shortcut.length ? (A(), T("kbd", Xo, [
3276
- (A(!0), T(de, null, Ie(u.shortcut, (v, m) => (A(), T("span", { key: m }, ce(v), 1))), 128))
3277
- ])) : Y("", !0),
3278
- g[0] || (g[0] = q("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3279
- ], 4)) : Y("", !0)
3281
+ (A(!0), T(ue, null, Ce(u.shortcut, (v, m) => (A(), T("span", { key: m }, fe(v), 1))), 128))
3282
+ ])) : K("", !0),
3283
+ g[0] || (g[0] = F("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3284
+ ], 4)) : K("", !0)
3280
3285
  ]))
3281
3286
  ]));
3282
3287
  }
3283
- }), _n = /* @__PURE__ */ ve(Ko, [["__scopeId", "data-v-904248f4"]]), Yo = { class: "flow-canvas-default-node__ep-label" }, Zo = {
3288
+ }), _n = /* @__PURE__ */ me(Ko, [["__scopeId", "data-v-904248f4"]]), Yo = { class: "flow-canvas-default-node__ep-label" }, Zo = {
3284
3289
  key: 1,
3285
3290
  class: "flow-canvas-default-node__diamond flow-canvas-highlight-target"
3286
3291
  }, Qo = {
3287
3292
  key: 2,
3288
3293
  class: "flow-canvas-default-node__task-label"
3289
- }, Jo = /* @__PURE__ */ fe({
3294
+ }, Jo = /* @__PURE__ */ pe({
3290
3295
  __name: "default-node",
3291
- setup(s) {
3292
- const o = wt("getNode")?.(), t = V(() => o?.getData?.() ?? null), n = V(() => t.value?.label || t.value?.type || ""), i = {
3296
+ setup(n) {
3297
+ const o = wt("getNode")?.(), t = V(() => o?.getData?.() ?? null), s = V(() => t.value?.label || t.value?.type || ""), r = {
3293
3298
  start: "canvas-kaishi",
3294
3299
  end: "canvas-stop",
3295
3300
  "parallel-gateway": "canvas-bingxingwangguan",
3296
3301
  "branch-gateway": "canvas-fenzhiwangguan",
3297
3302
  "converge-gateway": "canvas-huijuwangguan",
3298
3303
  "conditional-parallel-gateway": "canvas-tiaojianbingxingwangguan"
3299
- }, r = /* @__PURE__ */ new Set(["start", "end"]), l = /* @__PURE__ */ new Set([
3304
+ }, i = /* @__PURE__ */ new Set(["start", "end"]), l = /* @__PURE__ */ new Set([
3300
3305
  "parallel-gateway",
3301
3306
  "branch-gateway",
3302
3307
  "converge-gateway",
3303
3308
  "conditional-parallel-gateway"
3304
3309
  ]), a = V(() => {
3305
3310
  const f = t.value?.type ?? "";
3306
- return r.has(f) ? "endpoint" : l.has(f) ? "gateway" : "task";
3307
- }), h = V(() => i[t.value?.type ?? ""] ?? "");
3311
+ return i.has(f) ? "endpoint" : l.has(f) ? "gateway" : "task";
3312
+ }), h = V(() => r[t.value?.type ?? ""] ?? "");
3308
3313
  return (f, p) => (A(), T("div", {
3309
- class: te(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3314
+ class: oe(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3310
3315
  }, [
3311
- a.value === "endpoint" ? (A(), T(de, { key: 0 }, [
3316
+ a.value === "endpoint" ? (A(), T(ue, { key: 0 }, [
3312
3317
  h.value ? (A(), T("i", {
3313
3318
  key: 0,
3314
- class: te([["flow-canvas-icon", h.value], "flow-canvas-default-node__ep-icon"])
3315
- }, null, 2)) : Y("", !0),
3316
- q("span", Yo, ce(n.value), 1)
3319
+ class: oe([["flow-canvas-icon", h.value], "flow-canvas-default-node__ep-icon"])
3320
+ }, null, 2)) : K("", !0),
3321
+ F("span", Yo, fe(s.value), 1)
3317
3322
  ], 64)) : a.value === "gateway" ? (A(), T("div", Zo, [
3318
3323
  h.value ? (A(), T("i", {
3319
3324
  key: 0,
3320
- class: te([["flow-canvas-icon", h.value], "flow-canvas-default-node__gw-icon"])
3321
- }, null, 2)) : Y("", !0)
3322
- ])) : (A(), T("span", Qo, ce(n.value), 1))
3325
+ class: oe([["flow-canvas-icon", h.value], "flow-canvas-default-node__gw-icon"])
3326
+ }, null, 2)) : K("", !0)
3327
+ ])) : (A(), T("span", Qo, fe(s.value), 1))
3323
3328
  ], 2));
3324
3329
  }
3325
- }), en = /* @__PURE__ */ ve(Jo, [["__scopeId", "data-v-f0e24a9f"]]), tn = {
3330
+ }), en = /* @__PURE__ */ me(Jo, [["__scopeId", "data-v-f0e24a9f"]]), tn = {
3326
3331
  start: { label: "开始", icon: "flow-canvas-icon canvas-kaishi", width: 88, height: 40 },
3327
3332
  end: { label: "结束", icon: "flow-canvas-icon canvas-stop", width: 88, height: 40 },
3328
3333
  empty: { label: "空节点", icon: "flow-canvas-icon canvas-jiedi", width: 240, height: 48 },
@@ -3335,7 +3340,7 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3335
3340
  width: 64,
3336
3341
  height: 64
3337
3342
  }
3338
- }, tt = (s, e) => ({
3343
+ }, tt = (n, e) => ({
3339
3344
  stroke: e.hovered ? "#3a84ff" : "#abb5cc",
3340
3345
  strokeWidth: 2
3341
3346
  });
@@ -3365,47 +3370,47 @@ function on() {
3365
3370
  }
3366
3371
  };
3367
3372
  }
3368
- function Pn(s) {
3369
- const e = s?.nodeTypes ?? tn, o = {}, t = [];
3370
- for (const [r, l] of Object.entries(e)) {
3373
+ function Pn(n) {
3374
+ const e = n?.nodeTypes ?? tn, o = {}, t = [];
3375
+ for (const [i, l] of Object.entries(e)) {
3371
3376
  const a = l.width ?? 150, h = l.height ?? 50;
3372
- o[r] = {
3377
+ o[i] = {
3373
3378
  component: en,
3374
3379
  getSize: () => ({ width: a, height: h }),
3375
3380
  getPorts: () => ut()
3376
3381
  }, t.push({
3377
- type: r,
3378
- label: l.label ?? r,
3382
+ type: i,
3383
+ label: l.label ?? i,
3379
3384
  icon: l.icon
3380
3385
  });
3381
3386
  }
3382
- const n = {
3387
+ const s = {
3383
3388
  ...on(),
3384
- ...s?.edgeTypes
3385
- }, i = s?.defaultEdgeType ?? "manhattan";
3389
+ ...n?.edgeTypes
3390
+ }, r = n?.defaultEdgeType ?? "manhattan";
3386
3391
  return {
3387
- schema: { nodeTypes: o, defaultEdgeType: i, edgeTypes: n },
3392
+ schema: { nodeTypes: o, defaultEdgeType: r, edgeTypes: s },
3388
3393
  paletteItems: t
3389
3394
  };
3390
3395
  }
3391
- function Tn(s) {
3396
+ function Tn(n) {
3392
3397
  return {
3393
3398
  name: "connection-validator",
3394
3399
  priority: 10,
3395
3400
  transformCommand(e, o, t) {
3396
- const n = /* @__PURE__ */ new Set();
3397
- for (const i of e.commands)
3398
- i.type === "edge.remove" && n.add(i.edgeId);
3399
- for (const i of e.commands) {
3400
- if (i.type !== "edge.add" && i.type !== "edge.reconnect") continue;
3401
- const r = t.flowModel.value, l = i.type === "edge.add" ? i.edge.source.nodeId : i.source?.nodeId, a = i.type === "edge.add" ? i.edge.target.nodeId : i.target?.nodeId;
3401
+ const s = /* @__PURE__ */ new Set();
3402
+ for (const r of e.commands)
3403
+ r.type === "edge.remove" && s.add(r.edgeId);
3404
+ for (const r of e.commands) {
3405
+ if (r.type !== "edge.add" && r.type !== "edge.reconnect") continue;
3406
+ const i = t.flowModel.value, l = r.type === "edge.add" ? r.edge.source.nodeId : r.source?.nodeId, a = r.type === "edge.add" ? r.edge.target.nodeId : r.target?.nodeId;
3402
3407
  if (!l || !a) continue;
3403
- const h = r.nodes[l], f = r.nodes[a];
3408
+ const h = i.nodes[l], f = i.nodes[a];
3404
3409
  if (!h || !f) continue;
3405
- const p = i.type === "edge.add" ? i.edge.source.portId : i.source?.portId, u = i.type === "edge.add" ? i.edge.target.portId : i.target?.portId, w = p ? h.ports?.find((M) => M.id === p) : void 0, D = u ? f.ports?.find((M) => M.id === u) : void 0, O = i.type === "edge.reconnect" ? i.edgeId : void 0, b = Object.values(r.edges).filter(
3406
- (M) => M.id !== O && !n.has(M.id)
3407
- ), S = s({
3408
- flowModel: r,
3410
+ const p = r.type === "edge.add" ? r.edge.source.portId : r.source?.portId, u = r.type === "edge.add" ? r.edge.target.portId : r.target?.portId, w = p ? h.ports?.find((M) => M.id === p) : void 0, D = u ? f.ports?.find((M) => M.id === u) : void 0, O = r.type === "edge.reconnect" ? r.edgeId : void 0, b = Object.values(i.edges).filter(
3411
+ (M) => M.id !== O && !s.has(M.id)
3412
+ ), S = n({
3413
+ flowModel: i,
3409
3414
  sourceNode: h,
3410
3415
  targetNode: f,
3411
3416
  sourcePort: w,
@@ -3423,13 +3428,13 @@ function Tn(s) {
3423
3428
  }
3424
3429
  };
3425
3430
  }
3426
- function Rn(s) {
3427
- const { rubberband: e = !0, multiple: o = !0, movable: t = !0 } = s ?? {};
3431
+ function Rn(n) {
3432
+ const { rubberband: e = !0, multiple: o = !0, movable: t = !0 } = n ?? {};
3428
3433
  return {
3429
3434
  name: "selection",
3430
3435
  priority: 90,
3431
- attachRuntime(n) {
3432
- n.graph.use(
3436
+ attachRuntime(s) {
3437
+ s.graph.use(
3433
3438
  new It({
3434
3439
  enabled: !0,
3435
3440
  rubberband: e,
@@ -3437,22 +3442,22 @@ function Rn(s) {
3437
3442
  movable: t,
3438
3443
  pointerEvents: "none",
3439
3444
  showNodeSelectionBox: !0,
3440
- filter: (i) => !(i.isNode() && (i.getData?.() ?? {})._selectable === !1)
3445
+ filter: (r) => !(r.isNode() && (r.getData?.() ?? {})._selectable === !1)
3441
3446
  })
3442
3447
  );
3443
3448
  }
3444
3449
  };
3445
3450
  }
3446
- function Ln(s) {
3447
- const { tolerance: e = 10, color: o = "#3a84ff" } = s ?? {};
3451
+ function Ln(n) {
3452
+ const { tolerance: e = 10, color: o = "#3a84ff" } = n ?? {};
3448
3453
  let t = null;
3449
3454
  return {
3450
3455
  name: "snapline",
3451
3456
  priority: 90,
3452
- async attachRuntime(n) {
3453
- const { Snapline: i } = await import("@antv/x6-plugin-snapline");
3454
- n.graph.use(
3455
- new i({
3457
+ async attachRuntime(s) {
3458
+ const { Snapline: r } = await import("@antv/x6-plugin-snapline");
3459
+ s.graph.use(
3460
+ new r({
3456
3461
  enabled: !0,
3457
3462
  tolerance: e,
3458
3463
  className: "flow-canvas-snapline"
@@ -3467,7 +3472,7 @@ function Ln(s) {
3467
3472
  const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "placeholder"], rn = {
3468
3473
  key: 0,
3469
3474
  class: "flow-canvas-search-popover__no-result"
3470
- }, an = { class: "flow-canvas-search-popover__counter" }, ln = ["onMouseenter", "onClick"], dn = { class: "flow-canvas-search-popover__item-label" }, cn = /* @__PURE__ */ fe({
3475
+ }, an = { class: "flow-canvas-search-popover__counter" }, ln = ["onMouseenter", "onClick"], dn = { class: "flow-canvas-search-popover__item-label" }, cn = /* @__PURE__ */ pe({
3471
3476
  __name: "search-popover",
3472
3477
  props: {
3473
3478
  open: { type: Boolean },
@@ -3479,38 +3484,38 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3479
3484
  isAnchorTarget: { type: Function, default: void 0 }
3480
3485
  },
3481
3486
  emits: ["update:query", "select", "nextMatch", "prevMatch", "close"],
3482
- setup(s, { emit: e }) {
3483
- const o = s, t = e, n = H(null), i = H(null), r = H(-1);
3484
- ge(
3487
+ setup(n, { emit: e }) {
3488
+ const o = n, t = e, s = H(null), r = H(null), i = H(-1);
3489
+ he(
3485
3490
  () => o.open,
3486
3491
  (u) => {
3487
- u && (r.value = -1, Ge(() => {
3488
- n.value?.focus(), n.value?.select();
3492
+ u && (i.value = -1, Ge(() => {
3493
+ s.value?.focus(), s.value?.select();
3489
3494
  }));
3490
3495
  }
3491
- ), ge(
3496
+ ), he(
3492
3497
  () => o.query,
3493
3498
  () => {
3494
- r.value = -1;
3499
+ i.value = -1;
3495
3500
  }
3496
- ), ge(
3501
+ ), he(
3497
3502
  () => o.results.length,
3498
3503
  (u) => {
3499
3504
  if (!u) {
3500
- r.value = -1;
3505
+ i.value = -1;
3501
3506
  return;
3502
3507
  }
3503
- r.value >= u && (r.value = -1);
3508
+ i.value >= u && (i.value = -1);
3504
3509
  }
3505
3510
  );
3506
3511
  function l(u) {
3507
3512
  t("update:query", u.target.value);
3508
3513
  }
3509
3514
  function a(u) {
3510
- r.value = u;
3515
+ i.value = u;
3511
3516
  }
3512
3517
  function h() {
3513
- r.value = -1;
3518
+ i.value = -1;
3514
3519
  }
3515
3520
  function f(u) {
3516
3521
  if (u.key === "Escape") {
@@ -3519,17 +3524,17 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3519
3524
  }
3520
3525
  if (u.key === "ArrowDown") {
3521
3526
  if (u.preventDefault(), !o.results.length) return;
3522
- r.value = r.value < o.results.length - 1 ? r.value + 1 : 0;
3527
+ i.value = i.value < o.results.length - 1 ? i.value + 1 : 0;
3523
3528
  return;
3524
3529
  }
3525
3530
  if (u.key === "ArrowUp") {
3526
3531
  if (u.preventDefault(), !o.results.length) return;
3527
- r.value = r.value > 0 ? r.value - 1 : o.results.length - 1;
3532
+ i.value = i.value > 0 ? i.value - 1 : o.results.length - 1;
3528
3533
  return;
3529
3534
  }
3530
3535
  if (u.key === "Enter") {
3531
- if (u.preventDefault(), r.value >= 0) {
3532
- const w = o.results[r.value];
3536
+ if (u.preventDefault(), i.value >= 0) {
3537
+ const w = o.results[i.value];
3533
3538
  w && t("select", w.id);
3534
3539
  return;
3535
3540
  }
@@ -3539,42 +3544,42 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3539
3544
  function p(u) {
3540
3545
  if (!o.open) return;
3541
3546
  const w = u.target;
3542
- w && i.value?.contains(w) || o.isAnchorTarget?.(u.target) || t("close");
3547
+ w && r.value?.contains(w) || o.isAnchorTarget?.(u.target) || t("close");
3543
3548
  }
3544
3549
  return dt(() => {
3545
3550
  document.addEventListener("mousedown", p);
3546
3551
  }), Te(() => {
3547
3552
  document.removeEventListener("mousedown", p);
3548
- }), (u, w) => s.open ? (A(), T("div", {
3553
+ }), (u, w) => n.open ? (A(), T("div", {
3549
3554
  key: 0,
3550
3555
  ref_key: "panelRef",
3551
- ref: i,
3556
+ ref: r,
3552
3557
  class: "flow-canvas-search-popover",
3553
- style: Ee({ left: `${s.position.x}px`, top: `${s.position.y}px`, width: `${s.position.width}px` })
3558
+ style: Ee({ left: `${n.position.x}px`, top: `${n.position.y}px`, width: `${n.position.width}px` })
3554
3559
  }, [
3555
- q("div", nn, [
3556
- q("input", {
3560
+ F("div", nn, [
3561
+ F("input", {
3557
3562
  ref_key: "inputRef",
3558
- ref: n,
3559
- value: s.query,
3560
- placeholder: s.placeholder,
3563
+ ref: s,
3564
+ value: n.query,
3565
+ placeholder: n.placeholder,
3561
3566
  onInput: l,
3562
3567
  onKeydown: f
3563
3568
  }, null, 40, sn),
3564
- s.query ? (A(), T(de, { key: 0 }, [
3565
- s.results.length ? (A(), T(de, { key: 1 }, [
3566
- q("button", {
3569
+ n.query ? (A(), T(ue, { key: 0 }, [
3570
+ n.results.length ? (A(), T(ue, { key: 1 }, [
3571
+ F("button", {
3567
3572
  type: "button",
3568
3573
  class: "flow-canvas-search-popover__nav-btn",
3569
3574
  "aria-label": "上一个",
3570
3575
  onClick: w[0] || (w[0] = (D) => t("prevMatch"))
3571
3576
  }, [...w[2] || (w[2] = [
3572
- q("svg", {
3577
+ F("svg", {
3573
3578
  viewBox: "0 0 16 16",
3574
3579
  width: "12",
3575
3580
  height: "12"
3576
3581
  }, [
3577
- q("path", {
3582
+ F("path", {
3578
3583
  d: "M10.3 12.3 6 8l4.3-4.3",
3579
3584
  fill: "none",
3580
3585
  stroke: "currentColor",
@@ -3584,19 +3589,19 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3584
3589
  })
3585
3590
  ], -1)
3586
3591
  ])]),
3587
- q("span", an, ce(s.matchIndex >= 0 ? s.matchIndex + 1 : 0) + " / " + ce(s.results.length), 1),
3588
- q("button", {
3592
+ F("span", an, fe(n.matchIndex >= 0 ? n.matchIndex + 1 : 0) + " / " + fe(n.results.length), 1),
3593
+ F("button", {
3589
3594
  type: "button",
3590
3595
  class: "flow-canvas-search-popover__nav-btn",
3591
3596
  "aria-label": "下一个",
3592
3597
  onClick: w[1] || (w[1] = (D) => t("nextMatch"))
3593
3598
  }, [...w[3] || (w[3] = [
3594
- q("svg", {
3599
+ F("svg", {
3595
3600
  viewBox: "0 0 16 16",
3596
3601
  width: "12",
3597
3602
  height: "12"
3598
3603
  }, [
3599
- q("path", {
3604
+ F("path", {
3600
3605
  d: "M5.7 3.7 10 8l-4.3 4.3",
3601
3606
  fill: "none",
3602
3607
  stroke: "currentColor",
@@ -3607,56 +3612,56 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3607
3612
  ], -1)
3608
3613
  ])])
3609
3614
  ], 64)) : (A(), T("span", rn, "无结果"))
3610
- ], 64)) : Y("", !0),
3611
- w[4] || (w[4] = q("i", { class: "flow-canvas-icon canvas-search flow-canvas-search-popover__search-icon" }, null, -1))
3615
+ ], 64)) : K("", !0),
3616
+ w[4] || (w[4] = F("i", { class: "flow-canvas-icon canvas-search flow-canvas-search-popover__search-icon" }, null, -1))
3612
3617
  ]),
3613
- s.query && s.results.length ? (A(), T("div", {
3618
+ n.query && n.results.length ? (A(), T("div", {
3614
3619
  key: 0,
3615
3620
  class: "flow-canvas-search-popover__list-box",
3616
3621
  onMouseleave: h
3617
3622
  }, [
3618
- (A(!0), T(de, null, Ie(s.results, (D, O) => (A(), T("button", {
3623
+ (A(!0), T(ue, null, Ce(n.results, (D, O) => (A(), T("button", {
3619
3624
  key: D.id,
3620
3625
  type: "button",
3621
- class: te(["flow-canvas-search-popover__item", { "is-active": O === r.value, "is-matched": O === s.matchIndex }]),
3626
+ class: oe(["flow-canvas-search-popover__item", { "is-active": O === i.value, "is-matched": O === n.matchIndex }]),
3622
3627
  onMouseenter: (b) => a(O),
3623
3628
  onClick: (b) => t("select", D.id)
3624
3629
  }, [
3625
- q("span", dn, ce(D.label), 1)
3630
+ F("span", dn, fe(D.label), 1)
3626
3631
  ], 42, ln))), 128))
3627
- ], 32)) : Y("", !0)
3628
- ], 4)) : Y("", !0);
3632
+ ], 32)) : K("", !0)
3633
+ ], 4)) : K("", !0);
3629
3634
  }
3630
- }), un = /* @__PURE__ */ ve(cn, [["__scopeId", "data-v-aca2b1c1"]]), nt = 282, fn = 4, gn = 300, _e = "flow-canvas-node-ring-target--search-match", Pe = "flow-canvas-node-ring-target--search-current", pn = "flow-canvas-node-ring-target";
3631
- function hn(s) {
3632
- return s !== null;
3635
+ }), un = /* @__PURE__ */ me(cn, [["__scopeId", "data-v-aca2b1c1"]]), nt = 282, fn = 4, gn = 300, _e = "flow-canvas-node-ring-target--search-match", Pe = "flow-canvas-node-ring-target--search-current", pn = "flow-canvas-node-ring-target";
3636
+ function hn(n) {
3637
+ return n !== null;
3633
3638
  }
3634
- function vn(s) {
3639
+ function vn(n) {
3635
3640
  const e = /* @__PURE__ */ new Set();
3636
- return s.map((o) => o?.trim()).filter((o) => !!o).filter((o) => {
3641
+ return n.map((o) => o?.trim()).filter((o) => !!o).filter((o) => {
3637
3642
  const t = o.toLowerCase();
3638
3643
  return e.has(t) ? !1 : (e.add(t), !0);
3639
3644
  });
3640
3645
  }
3641
- function mn(s, e) {
3646
+ function mn(n, e) {
3642
3647
  const o = Math.max(8, window.innerWidth - e - 8);
3643
- return Math.min(Math.max(8, s), o);
3648
+ return Math.min(Math.max(8, n), o);
3644
3649
  }
3645
- function yn(s, e) {
3646
- const o = e?.getNodeMeta?.(s);
3650
+ function yn(n, e) {
3651
+ const o = e?.getNodeMeta?.(n);
3647
3652
  if (o === null) return null;
3648
- const t = o?.label?.trim() || s.label?.trim() || s.id, n = o?.subtitle?.trim() || void 0, i = vn(o?.keywords ?? [s.label, n]);
3649
- return i.length ? {
3650
- id: s.id,
3653
+ const t = o?.label?.trim() || n.label?.trim() || n.id, s = o?.subtitle?.trim() || void 0, r = vn(o?.keywords ?? [n.label, s]);
3654
+ return r.length ? {
3655
+ id: n.id,
3651
3656
  label: t,
3652
- subtitle: n,
3653
- keywords: i
3657
+ subtitle: s,
3658
+ keywords: r
3654
3659
  } : null;
3655
3660
  }
3656
- function On(s) {
3657
- let e = null, o = null, t = null, n = null, i = null, r = null;
3658
- const l = H(!1), a = H(""), h = H({ x: 0, y: 0, width: nt }), f = H(-1), p = V(() => e ? Object.values(e.flowModel.value.nodes).map((g) => yn(g, s)).filter(hn) : []), u = V(() => {
3659
- const g = a.value.trim().toLowerCase(), v = Math.max(1, s?.maxResults ?? gn);
3661
+ function On(n) {
3662
+ let e = null, o = null, t = null, s = null, r = null, i = null;
3663
+ const l = H(!1), a = H(""), h = H({ x: 0, y: 0, width: nt }), f = H(-1), p = V(() => e ? Object.values(e.flowModel.value.nodes).map((g) => yn(g, n)).filter(hn) : []), u = V(() => {
3664
+ const g = a.value.trim().toLowerCase(), v = Math.max(1, n?.maxResults ?? gn);
3660
3665
  return g ? p.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0, v) : p.value.slice(0, v);
3661
3666
  });
3662
3667
  function w() {
@@ -3740,7 +3745,7 @@ function On(s) {
3740
3745
  function y() {
3741
3746
  l.value && O();
3742
3747
  }
3743
- const c = fe({
3748
+ const c = pe({
3744
3749
  name: "FlowCanvasSearchHost",
3745
3750
  setup() {
3746
3751
  return () => qe(un, {
@@ -3749,7 +3754,7 @@ function On(s) {
3749
3754
  query: a.value,
3750
3755
  results: u.value,
3751
3756
  matchIndex: f.value,
3752
- placeholder: s?.placeholder ?? "搜索节点名称",
3757
+ placeholder: n?.placeholder ?? "搜索节点名称",
3753
3758
  isAnchorTarget: d,
3754
3759
  "onUpdate:query": (g) => {
3755
3760
  a.value = g, f.value = -1;
@@ -3768,7 +3773,7 @@ function On(s) {
3768
3773
  e = g;
3769
3774
  },
3770
3775
  attachRuntime(g) {
3771
- o = g, t = g.graph.container.closest(".flow-canvas-layout__content") ?? g.graph.container.parentElement, n = document.createElement("div"), n.className = "flow-canvas-search-host", document.body.append(n), i = bt(c), i.mount(n), r = ge(
3776
+ o = g, t = g.graph.container.closest(".flow-canvas-layout__content") ?? g.graph.container.parentElement, s = document.createElement("div"), s.className = "flow-canvas-search-host", document.body.append(s), r = bt(c), r.mount(s), i = he(
3772
3777
  () => [a.value, u.value.length],
3773
3778
  () => {
3774
3779
  f.value = -1, M();
@@ -3776,10 +3781,10 @@ function On(s) {
3776
3781
  ), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0);
3777
3782
  },
3778
3783
  detachRuntime() {
3779
- U(), r?.(), r = null, window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0), i?.unmount(), i = null, n?.remove(), n = null, t = null, o = null;
3784
+ U(), i?.(), i = null, window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0), r?.unmount(), r = null, s?.remove(), s = null, t = null, o = null;
3780
3785
  },
3781
3786
  dispose() {
3782
- U(), r?.(), r = null, e = null;
3787
+ U(), i?.(), i = null, e = null;
3783
3788
  },
3784
3789
  provideToolbarItems() {
3785
3790
  return [
@@ -3797,51 +3802,51 @@ function On(s) {
3797
3802
  }
3798
3803
  };
3799
3804
  }
3800
- const st = 52, it = 16, pt = 4, wn = 40;
3801
- function bn(s) {
3802
- const { mountRect: e, toolbarRect: o, fallbackLeft: t, fallbackTop: n, fallbackWidth: i, height: r } = s, l = s.offset ?? pt;
3805
+ const st = 52, rt = 16, pt = 4, wn = 40;
3806
+ function bn(n) {
3807
+ const { mountRect: e, toolbarRect: o, fallbackLeft: t, fallbackTop: s, fallbackWidth: r, height: i } = n, l = n.offset ?? pt;
3803
3808
  return !o || o.width <= 0 ? {
3804
3809
  left: t,
3805
- top: n,
3806
- width: i,
3807
- height: r
3810
+ top: s,
3811
+ width: r,
3812
+ height: i
3808
3813
  } : {
3809
3814
  left: Math.round(o.left - e.left),
3810
3815
  top: Math.round(o.bottom - e.top + l),
3811
3816
  width: Math.round(o.width),
3812
- height: r
3817
+ height: i
3813
3818
  };
3814
3819
  }
3815
- function En(s) {
3820
+ function En(n) {
3816
3821
  const e = document.createElement("div");
3817
- e.className = "flow-canvas-minimap", s.floating !== !1 && e.classList.add("flow-canvas-minimap--floating");
3822
+ e.className = "flow-canvas-minimap", n.floating !== !1 && e.classList.add("flow-canvas-minimap--floating");
3818
3823
  const o = document.createElement("div");
3819
3824
  o.className = "flow-canvas-minimap__host", e.append(o), Object.assign(e.style, {
3820
- width: `${s.width}px`,
3821
- height: `${s.height}px`
3822
- }), s.floating !== !1 && Object.assign(e.style, {
3825
+ width: `${n.width}px`,
3826
+ height: `${n.height}px`
3827
+ }), n.floating !== !1 && Object.assign(e.style, {
3823
3828
  top: `${st}px`,
3824
- left: `${it}px`
3829
+ left: `${rt}px`
3825
3830
  });
3826
- let t = null, n = s.defaultOpen ?? !1, i = null, r = null, l = null, a = null, h = {
3827
- width: s.width,
3828
- height: s.height
3831
+ let t = null, s = n.defaultOpen ?? !1, r = null, i = null, l = null, a = null, h = {
3832
+ width: n.width,
3833
+ height: n.height
3829
3834
  };
3830
3835
  function f(k, X) {
3831
3836
  if (!t) return;
3832
3837
  const U = t;
3833
- U.options.width = k, U.options.height = X, U.updatePaper(s.sourceGraph.container.clientWidth, s.sourceGraph.container.clientHeight);
3838
+ U.options.width = k, U.options.height = X, U.updatePaper(n.sourceGraph.container.clientWidth, n.sourceGraph.container.clientHeight);
3834
3839
  }
3835
3840
  function p() {
3836
- if (s.floating === !1) return;
3841
+ if (n.floating === !1) return;
3837
3842
  const k = bn({
3838
- mountRect: s.mountTarget.getBoundingClientRect(),
3839
- toolbarRect: s.getToolbarElement?.()?.getBoundingClientRect() ?? null,
3840
- fallbackLeft: it,
3843
+ mountRect: n.mountTarget.getBoundingClientRect(),
3844
+ toolbarRect: n.getToolbarElement?.()?.getBoundingClientRect() ?? null,
3845
+ fallbackLeft: rt,
3841
3846
  fallbackTop: st,
3842
- fallbackWidth: s.width,
3843
- height: s.height,
3844
- offset: s.panelOffset ?? pt
3847
+ fallbackWidth: n.width,
3848
+ height: n.height,
3849
+ offset: n.panelOffset ?? pt
3845
3850
  });
3846
3851
  h = {
3847
3852
  width: k.width,
@@ -3854,70 +3859,70 @@ function En(s) {
3854
3859
  }), f(k.width, k.height);
3855
3860
  }
3856
3861
  function u() {
3857
- if (s.floating === !1 || typeof ResizeObserver > "u") return;
3858
- const k = s.getToolbarElement?.() ?? null;
3859
- r || (r = new ResizeObserver(() => {
3860
- n && (u(), p());
3861
- })), a !== k && (r.disconnect(), r.observe(s.mountTarget), k && r.observe(k), a = k);
3862
+ if (n.floating === !1 || typeof ResizeObserver > "u") return;
3863
+ const k = n.getToolbarElement?.() ?? null;
3864
+ i || (i = new ResizeObserver(() => {
3865
+ s && (u(), p());
3866
+ })), a !== k && (i.disconnect(), i.observe(n.mountTarget), k && i.observe(k), a = k);
3862
3867
  }
3863
3868
  function w() {
3864
- s.floating !== !1 && (p(), u(), l || (l = () => {
3865
- n && (u(), p());
3869
+ n.floating !== !1 && (p(), u(), l || (l = () => {
3870
+ s && (u(), p());
3866
3871
  }, window.addEventListener("resize", l)));
3867
3872
  }
3868
3873
  function D() {
3869
- l && (window.removeEventListener("resize", l), l = null), r?.disconnect(), r = null, a = null;
3874
+ l && (window.removeEventListener("resize", l), l = null), i?.disconnect(), i = null, a = null;
3870
3875
  }
3871
3876
  function O() {
3872
- !s.onClickOutside || i || (i = (k) => {
3877
+ !n.onClickOutside || r || (r = (k) => {
3873
3878
  const X = k.target;
3874
- X && e.contains(X) || k.target?.closest('[data-toolbar-type="minimap"]') || k.target?.closest(".flow-canvas-layout__content") || s.onClickOutside();
3875
- }, document.addEventListener("mousedown", i));
3879
+ X && e.contains(X) || k.target?.closest('[data-toolbar-type="minimap"]') || k.target?.closest(".flow-canvas-layout__content") || n.onClickOutside();
3880
+ }, document.addEventListener("mousedown", r));
3876
3881
  }
3877
3882
  function b() {
3878
- i && (document.removeEventListener("mousedown", i), i = null);
3883
+ r && (document.removeEventListener("mousedown", r), r = null);
3879
3884
  }
3880
3885
  function S() {
3881
3886
  t || (t = new Ct({
3882
3887
  container: o,
3883
3888
  width: h.width,
3884
3889
  height: h.height,
3885
- padding: s.contentPadding ?? wn,
3890
+ padding: n.contentPadding ?? wn,
3886
3891
  scalable: !1
3887
- }), s.sourceGraph.use(t));
3892
+ }), n.sourceGraph.use(t));
3888
3893
  }
3889
3894
  function M(k) {
3890
- n = k, e.style.display = n ? "" : "none", n ? (w(), S(), O(), requestAnimationFrame(() => {
3891
- n && (u(), p());
3895
+ s = k, e.style.display = s ? "" : "none", s ? (w(), S(), O(), requestAnimationFrame(() => {
3896
+ s && (u(), p());
3892
3897
  })) : (b(), D());
3893
3898
  }
3894
3899
  function B() {
3895
- M(n), s.mountTarget.appendChild(e);
3900
+ M(s), n.mountTarget.appendChild(e);
3896
3901
  }
3897
3902
  function j() {
3898
3903
  b(), D(), t?.dispose(), t = null, e.remove();
3899
3904
  }
3900
3905
  return B(), {
3901
3906
  element: e,
3902
- isOpen: () => n,
3907
+ isOpen: () => s,
3903
3908
  setOpen: M,
3904
3909
  toggle() {
3905
- const k = !n;
3910
+ const k = !s;
3906
3911
  return M(k), k;
3907
3912
  },
3908
3913
  destroy: j
3909
3914
  };
3910
3915
  }
3911
- function $n(s) {
3916
+ function $n(n) {
3912
3917
  let e = null, o = null;
3913
3918
  const t = H(!1);
3914
- function n() {
3919
+ function s() {
3915
3920
  return o?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="minimap"]');
3916
3921
  }
3917
- function i() {
3918
- return n()?.closest(".flow-canvas-toolbar");
3922
+ function r() {
3923
+ return s()?.closest(".flow-canvas-toolbar");
3919
3924
  }
3920
- function r(a) {
3925
+ function i(a) {
3921
3926
  e?.setOpen(a), t.value = a;
3922
3927
  }
3923
3928
  function l() {
@@ -3927,19 +3932,19 @@ function $n(s) {
3927
3932
  name: "minimap",
3928
3933
  priority: 90,
3929
3934
  attachRuntime(a) {
3930
- const h = a, f = s?.width ?? 334, p = s?.height ?? 180;
3935
+ const h = a, f = n?.width ?? 334, p = n?.height ?? 180;
3931
3936
  o = h.graph.container.closest(".flow-canvas-layout__content") ?? h.graph.container.parentElement;
3932
- const u = s?.container ?? o;
3937
+ const u = n?.container ?? o;
3933
3938
  u && (e = En({
3934
3939
  sourceGraph: a.graph,
3935
3940
  mountTarget: u,
3936
3941
  width: f,
3937
3942
  height: p,
3938
- floating: !s?.container,
3943
+ floating: !n?.container,
3939
3944
  defaultOpen: !1,
3940
- getToolbarElement: s?.container ? void 0 : i,
3941
- onClickOutside: () => r(!1)
3942
- }), r(!1));
3945
+ getToolbarElement: n?.container ? void 0 : r,
3946
+ onClickOutside: () => i(!1)
3947
+ }), i(!1));
3943
3948
  },
3944
3949
  detachRuntime() {
3945
3950
  e?.destroy(), e = null, o = null, t.value = !1;
@@ -3961,58 +3966,58 @@ function $n(s) {
3961
3966
  };
3962
3967
  }
3963
3968
  function Bn() {
3964
- let s = null, e = 0;
3969
+ let n = null, e = 0;
3965
3970
  return {
3966
3971
  name: "clipboard",
3967
3972
  priority: 90,
3968
3973
  onKeyboardShortcut(o, t) {
3969
- const n = o.metaKey || o.ctrlKey;
3970
- if (n && o.key === "c") {
3971
- const i = t.graph.getSelectedCells?.() ?? [];
3972
- if (!i.length) return !1;
3973
- const r = t.flowModel.value, l = new Set(i.filter((f) => f.isNode()).map((f) => f.id)), a = [...l].map((f) => r.nodes[f]).filter(Boolean);
3974
+ const s = o.metaKey || o.ctrlKey;
3975
+ if (s && o.key === "c") {
3976
+ const r = t.graph.getSelectedCells?.() ?? [];
3977
+ if (!r.length) return !1;
3978
+ const i = t.flowModel.value, l = new Set(r.filter((f) => f.isNode()).map((f) => f.id)), a = [...l].map((f) => i.nodes[f]).filter(Boolean);
3974
3979
  if (!a.length) return !1;
3975
- const h = Object.values(r.edges).filter(
3980
+ const h = Object.values(i.edges).filter(
3976
3981
  (f) => l.has(f.source.nodeId) && l.has(f.target.nodeId)
3977
3982
  );
3978
- return s = { nodes: a, edges: h }, e = 0, !0;
3983
+ return n = { nodes: a, edges: h }, e = 0, !0;
3979
3984
  }
3980
- if (n && o.key === "v") {
3981
- if (!s?.nodes.length) return !1;
3985
+ if (s && o.key === "v") {
3986
+ if (!n?.nodes.length) return !1;
3982
3987
  e++;
3983
- const i = e * 30, r = /* @__PURE__ */ new Map(), l = [];
3984
- for (const a of s.nodes) {
3985
- const h = `${a.id}_cp${J().slice(0, 6)}`;
3986
- r.set(a.id, h), l.push({
3988
+ const r = e * 30, i = /* @__PURE__ */ new Map(), l = [];
3989
+ for (const a of n.nodes) {
3990
+ const h = `${a.id}_cp${ee().slice(0, 6)}`;
3991
+ i.set(a.id, h), l.push({
3987
3992
  type: "node.add",
3988
3993
  node: {
3989
3994
  ...a,
3990
3995
  id: h,
3991
3996
  position: {
3992
- x: a.position.x + i,
3993
- y: a.position.y + i
3997
+ x: a.position.x + r,
3998
+ y: a.position.y + r
3994
3999
  },
3995
4000
  payload: a.payload ? { ...a.payload } : {},
3996
4001
  extensions: a.extensions ? { ...a.extensions } : void 0
3997
4002
  }
3998
4003
  });
3999
4004
  }
4000
- for (const a of s.edges) {
4001
- const h = r.get(a.source.nodeId), f = r.get(a.target.nodeId);
4005
+ for (const a of n.edges) {
4006
+ const h = i.get(a.source.nodeId), f = i.get(a.target.nodeId);
4002
4007
  !h || !f || l.push({
4003
4008
  type: "edge.add",
4004
4009
  edge: {
4005
4010
  ...a,
4006
- id: `${a.id}_cp${J().slice(0, 6)}`,
4011
+ id: `${a.id}_cp${ee().slice(0, 6)}`,
4007
4012
  source: { ...a.source, nodeId: h },
4008
4013
  target: { ...a.target, nodeId: f },
4009
- labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${J().slice(0, 6)}` })),
4014
+ labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${ee().slice(0, 6)}` })),
4010
4015
  payload: a.payload ? { ...a.payload } : {}
4011
4016
  }
4012
4017
  });
4013
4018
  }
4014
4019
  return l.length && t.executeCommand({
4015
- id: J(),
4020
+ id: ee(),
4016
4021
  source: "user:keyboard",
4017
4022
  label: "粘贴",
4018
4023
  timestamp: Date.now(),
@@ -4024,7 +4029,7 @@ function Bn() {
4024
4029
  };
4025
4030
  }
4026
4031
  export {
4027
- ue as CanvasConstraintError,
4032
+ ge as CanvasConstraintError,
4028
4033
  An as CanvasLayout,
4029
4034
  Ro as CanvasNodePalette,
4030
4035
  Dn as CanvasRuntime,
@@ -4041,7 +4046,7 @@ export {
4041
4046
  Pn as createDefaultSchema,
4042
4047
  Ho as createDefaultToolbarItems,
4043
4048
  Mn as createEmptyFlowModel,
4044
- J as generateId,
4049
+ ee as generateId,
4045
4050
  $n as minimapPlugin,
4046
4051
  On as searchPlugin,
4047
4052
  Rn as selectionPlugin,