@blueking/flow-canvas 0.0.10 → 0.0.11

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 z, computed as V, onScopeDispose as rt, defineComponent as fe, h as qe, watch as ge, onBeforeUnmount as Te, createElementBlock as P, openBlock as A, normalizeStyle as be, createElementVNode as q, createVNode as it, createCommentVNode as Y, normalizeClass as oe, Transition as at, withCtx as He, withModifiers as pt, createTextVNode as Ue, renderSlot as Me, onMounted as lt, createBlock as Ie, Fragment as de, renderList as Ce, toDisplayString as ce, unref as le, reactive as vt, resolveDynamicComponent as mt, Teleport as yt, nextTick as dt, inject as wt, createApp as bt } from "vue";
1
+ import { ref as H, computed as V, onScopeDispose as it, defineComponent as fe, h as qe, watch as ge, onBeforeUnmount as Te, createElementBlock as T, openBlock as A, normalizeStyle as Ee, createElementVNode as q, createVNode as at, createCommentVNode as Y, normalizeClass as te, 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 de, renderList as Ce, toDisplayString as ce, unref as re, 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";
@@ -20,7 +20,7 @@ class kt extends Error {
20
20
  super(e), this.name = "CanvasSchemaError";
21
21
  }
22
22
  }
23
- function Le(n, 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))
@@ -55,9 +55,9 @@ function ct(n, e) {
55
55
  case "edge.remove":
56
56
  return Tt(n, e.edgeId);
57
57
  case "edge.reconnect":
58
- return Lt(n, e.edgeId, e.source, e.target);
58
+ return Rt(n, e.edgeId, e.source, e.target);
59
59
  case "edge.update":
60
- return Rt(n, e.edgeId, e.patch);
60
+ return Lt(n, e.edgeId, e.patch);
61
61
  case "edge.set-payload":
62
62
  return Ot(n, e.edgeId, e.path, e.value);
63
63
  case "edge.label.update":
@@ -85,7 +85,7 @@ function ke(n, e, o) {
85
85
  if (e.portId && t.ports && !t.ports.some((r) => r.id === e.portId))
86
86
  throw new ue(`${o} port "${e.portId}" not found on node "${e.nodeId}"`);
87
87
  }
88
- function Re(n, e, o) {
88
+ function Le(n, e, o) {
89
89
  return { ...n, nodes: { ...n.nodes, [e]: o } };
90
90
  }
91
91
  function Oe(n, e, o) {
@@ -98,7 +98,7 @@ function St(n, e) {
98
98
  }
99
99
  function Mt(n, e, o) {
100
100
  const t = Ne(n, e);
101
- return Re(n, e, { ...t, position: o });
101
+ return Le(n, e, { ...t, position: o });
102
102
  }
103
103
  function Nt(n, e) {
104
104
  Ne(n, e);
@@ -109,15 +109,15 @@ function Nt(n, e) {
109
109
  }
110
110
  function Dt(n, e, o) {
111
111
  const t = Ne(n, e);
112
- return Re(n, e, { ...t, ...o, id: t.id });
112
+ return Le(n, e, { ...t, ...o, id: t.id });
113
113
  }
114
114
  function At(n, e, o, t) {
115
- const s = Ne(n, e), r = Le(s.payload, o, t);
116
- return Re(n, e, { ...s, payload: r });
115
+ const s = Ne(n, e), r = Re(s.payload, o, t);
116
+ return Le(n, e, { ...s, payload: r });
117
117
  }
118
118
  function _t(n, e, o, t) {
119
- const s = Ne(n, e), r = Le(s.extensions, o, t);
120
- return Re(n, e, { ...s, extensions: r });
119
+ const s = Ne(n, e), r = Re(s.extensions, o, t);
120
+ return Le(n, e, { ...s, extensions: r });
121
121
  }
122
122
  function Pt(n, e) {
123
123
  if (n.edges[e.id])
@@ -137,16 +137,16 @@ function Tt(n, e) {
137
137
  const { [e]: o, ...t } = n.edges;
138
138
  return { ...n, edges: t };
139
139
  }
140
- function Lt(n, e, o, t) {
140
+ function Rt(n, e, o, t) {
141
141
  const s = De(n, e), r = o ?? s.source, i = t ?? s.target;
142
142
  return ke(n, r, "Source"), ke(n, i, "Target"), Oe(n, e, { ...s, source: r, target: i });
143
143
  }
144
- function Rt(n, e, o) {
144
+ function Lt(n, e, o) {
145
145
  const t = De(n, e), s = { ...t, ...o, id: t.id };
146
146
  return o.source && ke(n, s.source, "Source"), o.target && ke(n, s.target, "Target"), Oe(n, e, s);
147
147
  }
148
148
  function Ot(n, e, o, t) {
149
- const s = De(n, e), r = Le(s.payload, o, t);
149
+ const s = De(n, e), r = Re(s.payload, o, t);
150
150
  return Oe(n, e, { ...s, payload: r });
151
151
  }
152
152
  function $t(n, e, o, t) {
@@ -160,66 +160,66 @@ function $t(n, e, o, t) {
160
160
  return i[r] = { ...i[r], ...t, id: o }, Oe(n, e, { ...s, labels: i });
161
161
  }
162
162
  function Bt(n, e, o) {
163
- const t = Le(n.meta, e, o);
163
+ const t = Re(n.meta, e, o);
164
164
  return { ...n, meta: t };
165
165
  }
166
166
  function Ft(n, e) {
167
- const o = e?.maxHistorySize ?? 100, t = z(n), s = [], r = [], i = z(!1), l = z(!1);
167
+ const o = e?.maxHistorySize ?? 100, t = H(n), s = [], r = [], i = H(!1), l = H(!1);
168
168
  function a() {
169
169
  i.value = s.length > 0, l.value = r.length > 0;
170
170
  }
171
171
  function v(b) {
172
- const M = t.value;
173
- let S = M;
174
- for (const H of b.commands)
175
- S = ct(S, H);
172
+ const S = t.value;
173
+ let M = S;
174
+ for (const B of b.commands)
175
+ M = ct(M, B);
176
176
  if (!b.skipHistory) {
177
- const H = e?.excludeCommandFromHistory, X = H ? b.commands.filter((k) => !H(k)) : b.commands;
178
- if (X.length > 0) {
179
- const k = X.length < b.commands.length ? { ...b, commands: X } : b;
180
- s.push({ snapshot: M, envelope: k }), s.length > o && s.shift(), r.length = 0;
177
+ const B = e?.excludeCommandFromHistory, j = B ? b.commands.filter((k) => !B(k)) : b.commands;
178
+ if (j.length > 0) {
179
+ const k = j.length < b.commands.length ? { ...b, commands: j } : b;
180
+ s.push({ snapshot: S, envelope: k }), s.length > o && s.shift(), r.length = 0;
181
181
  }
182
182
  }
183
- return t.value = S, a(), S;
183
+ return t.value = M, a(), M;
184
184
  }
185
- function u() {
185
+ function f() {
186
186
  const b = s.pop();
187
187
  if (!b) return null;
188
188
  r.push({ snapshot: t.value, envelope: b.envelope });
189
- const M = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
190
- return t.value = M, a(), M;
189
+ const S = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
190
+ return t.value = S, a(), S;
191
191
  }
192
- function h() {
192
+ function p() {
193
193
  const b = r.pop();
194
194
  if (!b) return null;
195
195
  s.push({ snapshot: t.value, envelope: b.envelope });
196
- const M = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
197
- return t.value = M, a(), M;
196
+ const S = e?.preserveMetaOnUndoRedo ? { ...b.snapshot, meta: t.value.meta } : b.snapshot;
197
+ return t.value = S, a(), S;
198
198
  }
199
- function c() {
199
+ function u() {
200
200
  s.length = 0, r.length = 0, a();
201
201
  }
202
202
  function w() {
203
203
  return t.value;
204
204
  }
205
- function N(b) {
206
- t.value = b, c();
205
+ function D(b) {
206
+ t.value = b, u();
207
207
  }
208
- function O(b, M) {
209
- const S = {
208
+ function O(b, S) {
209
+ const M = {
210
210
  id: `update-${Date.now()}`,
211
211
  source: "system:update",
212
- label: M ?? "更新模型",
212
+ label: S ?? "更新模型",
213
213
  timestamp: Date.now(),
214
214
  commands: []
215
215
  };
216
- s.push({ snapshot: t.value, envelope: S }), s.length > o && s.shift(), r.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: v,
221
- undo: u,
222
- redo: h,
221
+ undo: f,
222
+ redo: p,
223
223
  canUndo: i,
224
224
  canRedo: l,
225
225
  get undoStack() {
@@ -228,9 +228,9 @@ function Ft(n, e) {
228
228
  get redoStack() {
229
229
  return r.map((b) => b.envelope);
230
230
  },
231
- clear: c,
231
+ clear: u,
232
232
  createSnapshot: w,
233
- replaceFlowModel: N,
233
+ replaceFlowModel: D,
234
234
  updateFlowModel: O
235
235
  };
236
236
  }
@@ -274,9 +274,9 @@ class Ht {
274
274
  const t = this, s = new Proxy(e.graph, {
275
275
  get(r, i, l) {
276
276
  const a = Reflect.get(r, i, l);
277
- return i === "use" && typeof a == "function" ? function(...u) {
277
+ return i === "use" && typeof a == "function" ? function(...f) {
278
278
  if (t.runtimeVersion === o)
279
- return a.apply(r, u);
279
+ return a.apply(r, f);
280
280
  } : a;
281
281
  }
282
282
  });
@@ -402,41 +402,41 @@ class Ht {
402
402
  }
403
403
  }
404
404
  let Gt = 0;
405
- function Q() {
405
+ function J() {
406
406
  const n = Date.now().toString(36), e = Math.random().toString(36).substring(2, 8);
407
407
  return `${n}-${e}-${++Gt}`;
408
408
  }
409
- const Ge = () => Q();
409
+ const ze = () => J();
410
410
  function Nn(n) {
411
- const { schema: e, plugins: o = [], historyOptions: t } = n, s = n.idGenerator ?? Ge, r = { version: "1.0", ...n.initialFlowModel }, i = Ft(r, t), l = z(n.mode ?? "edit"), a = z(!1), v = z(null), u = z([]), h = {}, c = new Ht();
412
- function w(M, S, H, X = "user:toolbar") {
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), v = H(null), f = H([]), p = {}, u = new Ht();
412
+ function w(S, M, B, j = "user:toolbar") {
413
413
  const k = {
414
414
  id: `history-${Date.now()}`,
415
- source: X,
416
- label: M,
415
+ source: j,
416
+ label: S,
417
417
  timestamp: Date.now(),
418
418
  commands: []
419
419
  };
420
- c.afterCommand(k, S, H), u.value = c.collectToolbarItems(), n.onCommandResult?.({
420
+ u.afterCommand(k, M, B), f.value = u.collectToolbarItems(), n.onCommandResult?.({
421
421
  status: "applied",
422
422
  envelope: k,
423
- flowModel: H
423
+ flowModel: B
424
424
  }), n.onFlowModelChange?.({
425
- flowModel: H,
426
- prevFlowModel: S,
425
+ flowModel: B,
426
+ prevFlowModel: M,
427
427
  envelope: k,
428
- source: X
428
+ source: j
429
429
  });
430
430
  }
431
- const N = {
431
+ const D = {
432
432
  execute: i.execute,
433
433
  undo() {
434
- const M = i.currentFlowModel.value, S = i.undo();
435
- return S && w("撤销", M, S), S;
434
+ const S = i.currentFlowModel.value, M = i.undo();
435
+ return M && w("撤销", S, M), M;
436
436
  },
437
437
  redo() {
438
- const M = i.currentFlowModel.value, S = i.redo();
439
- return S && w("重做", M, S), S;
438
+ const S = i.currentFlowModel.value, M = i.redo();
439
+ return M && w("重做", S, M), M;
440
440
  },
441
441
  get canUndo() {
442
442
  return i.canUndo;
@@ -452,87 +452,87 @@ function Nn(n) {
452
452
  },
453
453
  clear: i.clear,
454
454
  createSnapshot: i.createSnapshot,
455
- replaceFlowModel(M) {
456
- const S = i.currentFlowModel.value;
457
- i.replaceFlowModel(M), w("替换 FlowModel", S, M, "system:replace");
455
+ replaceFlowModel(S) {
456
+ const M = i.currentFlowModel.value;
457
+ i.replaceFlowModel(S), w("替换 FlowModel", M, S, "system:replace");
458
458
  },
459
- updateFlowModel(M, S) {
460
- const H = i.currentFlowModel.value;
461
- i.updateFlowModel(M, S), w(S ?? "更新 FlowModel", H, M, "system:update");
459
+ updateFlowModel(S, M) {
460
+ const B = i.currentFlowModel.value;
461
+ i.updateFlowModel(S, M), w(M ?? "更新 FlowModel", B, S, "system:update");
462
462
  }
463
463
  }, O = {
464
464
  flowModel: V(() => i.currentFlowModel.value),
465
- history: N,
465
+ history: D,
466
466
  schema: e,
467
467
  mode: l,
468
468
  idGenerator: s,
469
469
  executeCommand: b,
470
- replaceFlowModel(M) {
471
- N.replaceFlowModel(M);
470
+ replaceFlowModel(S) {
471
+ D.replaceFlowModel(S);
472
472
  },
473
- updateFlowModel(M, S) {
474
- N.updateFlowModel(M, S);
473
+ updateFlowModel(S, M) {
474
+ D.updateFlowModel(S, M);
475
475
  },
476
- setMode(M) {
477
- l.value = M;
476
+ setMode(S) {
477
+ l.value = S;
478
478
  },
479
479
  selectionMode: a,
480
- setSelectionMode(M) {
481
- a.value = M;
480
+ setSelectionMode(S) {
481
+ a.value = S;
482
482
  },
483
483
  api: v,
484
- toolbarItems: u,
485
- extendedApi: h,
486
- _pluginManager: c,
487
- _emitUiEvent: (M) => {
488
- c.dispatchUiEvent(M);
484
+ toolbarItems: f,
485
+ extendedApi: p,
486
+ _pluginManager: u,
487
+ _emitUiEvent: (S) => {
488
+ u.dispatchUiEvent(S);
489
489
  }
490
490
  };
491
- c.install(o, {
491
+ u.install(o, {
492
492
  flowModel: O.flowModel,
493
- history: N,
493
+ history: D,
494
494
  schema: e,
495
495
  mode: l,
496
496
  idGenerator: s,
497
497
  executeCommand: b
498
- }), u.value = c.collectToolbarItems(), rt(() => {
499
- c.dispose();
498
+ }), f.value = u.collectToolbarItems(), it(() => {
499
+ u.dispose();
500
500
  });
501
- function b(M) {
502
- const S = c.transformCommand(M);
503
- if ("rejected" in S) {
501
+ function b(S) {
502
+ const M = u.transformCommand(S);
503
+ if ("rejected" in M) {
504
504
  const k = {
505
505
  status: "rejected",
506
- envelope: M,
507
- error: S.error
506
+ envelope: S,
507
+ error: M.error
508
508
  };
509
509
  return n.onCommandResult?.(k), k;
510
510
  }
511
- const H = S.envelope, X = i.currentFlowModel.value;
511
+ const B = M.envelope, j = i.currentFlowModel.value;
512
512
  try {
513
- const k = i.execute(H), K = {
513
+ const k = i.execute(B), X = {
514
514
  status: "applied",
515
- envelope: H,
515
+ envelope: B,
516
516
  flowModel: k
517
517
  };
518
- return c.afterCommand(H, X, k), u.value = c.collectToolbarItems(), n.onCommandResult?.(K), n.onFlowModelChange?.({
518
+ return u.afterCommand(B, j, k), f.value = u.collectToolbarItems(), n.onCommandResult?.(X), n.onFlowModelChange?.({
519
519
  flowModel: k,
520
- prevFlowModel: X,
521
- envelope: H,
522
- source: H.source
523
- }), K;
520
+ prevFlowModel: j,
521
+ envelope: B,
522
+ source: B.source
523
+ }), X;
524
524
  } catch (k) {
525
525
  if (k instanceof ue) {
526
- const K = {
526
+ const X = {
527
527
  status: "invalid",
528
- envelope: H,
528
+ envelope: B,
529
529
  error: {
530
530
  code: "constraint_violated",
531
531
  reason: k.message,
532
532
  source: "engine"
533
533
  }
534
534
  };
535
- return n.onCommandResult?.(K), K;
535
+ return n.onCommandResult?.(X), X;
536
536
  }
537
537
  throw k;
538
538
  }
@@ -543,10 +543,10 @@ const zt = ["top", "right", "bottom", "left"];
543
543
  function ut() {
544
544
  return zt.map((n) => ({ id: n, group: n }));
545
545
  }
546
- function ze(n, e) {
546
+ function Ue(n, e) {
547
547
  return e?.(n) ?? n.ports ?? ut();
548
548
  }
549
- const Fe = -1, Ut = "flow-canvas-node-ring-target", je = "flow-canvas-node-ring-target--decorated", We = "flow-canvas-node-ring-target--pulse", jt = "linear-gradient(135deg, #cadcfa 0%, #cee0ff 100%)";
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 {
551
551
  graph;
552
552
  schema;
@@ -679,7 +679,7 @@ class Wt {
679
679
  throw new kt(
680
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 i = this.shapeRegistry.registerNodeType(s.type, r.component), l = r.getSize(s), a = ze(s, r.getPorts);
682
+ const i = this.shapeRegistry.registerNodeType(s.type, r.component), l = r.getSize(s), a = Ue(s, r.getPorts);
683
683
  o.set(t, { model: s, definition: r, shapeName: i, size: l, ports: a });
684
684
  }
685
685
  return o;
@@ -760,7 +760,7 @@ class Wt {
760
760
  }
761
761
  }
762
762
  },
763
- items: i.map((u) => ({ id: u.id, group: u.group, ...u.x6PortConfig }))
763
+ items: i.map((f) => ({ id: f.id, group: f.group, ...f.x6PortConfig }))
764
764
  },
765
765
  ...l.x6CellConfig
766
766
  };
@@ -838,18 +838,18 @@ class Wt {
838
838
  updateExistingEdge(e, o, t, s) {
839
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
- const u = (e.getData()?.type ?? void 0) !== (o.type ?? void 0);
842
- if (u) {
841
+ const f = (e.getData()?.type ?? void 0) !== (o.type ?? void 0);
842
+ if (f) {
843
843
  if (t?.router) {
844
- const h = typeof t.router == "string" ? { name: t.router } : t.router;
845
- e.setRouter(h);
844
+ const p = typeof t.router == "string" ? { name: t.router } : t.router;
845
+ e.setRouter(p);
846
846
  }
847
847
  if (t?.connector) {
848
- const h = typeof t.connector == "string" ? { name: t.connector } : t.connector;
849
- e.setConnector(h);
848
+ const p = typeof t.connector == "string" ? { name: t.connector } : t.connector;
849
+ e.setConnector(p);
850
850
  }
851
851
  }
852
- (u || l || a) && (this.syncEdgeMarker(e, t, "sourceMarker"), this.syncEdgeMarker(e, t, "targetMarker")), this.syncEdgeLabels(e, o), e.getZIndex() !== Fe && e.setZIndex(Fe), e.setData({ ...o }, { silent: !0 }), this.applyEdgeStyleAndDecoration(e, o, t);
852
+ (f || l || a) && (this.syncEdgeMarker(e, t, "sourceMarker"), this.syncEdgeMarker(e, t, "targetMarker")), this.syncEdgeLabels(e, o), e.getZIndex() !== Fe && e.setZIndex(Fe), e.setData({ ...o }, { silent: !0 }), this.applyEdgeStyleAndDecoration(e, o, t);
853
853
  }
854
854
  syncEdgeLabels(e, o) {
855
855
  if (!o.labels?.length) {
@@ -930,11 +930,11 @@ class Wt {
930
930
  applyNodeHighlightAndDecoration(e, o) {
931
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
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, u = a ?? (t ? "#3a84ff" : void 0), h = this.prevNodeDecorationColors.has(e.id) || this.defaultHighlightedNodeIds.has(e.id);
934
- u ? (e.setAttrByPath("body/stroke", u), e.setAttrByPath("body/strokeWidth", 2)) : h && (this.restoreNodeAttr(e, "body/stroke", "stroke"), this.restoreNodeAttr(e, "body/strokeWidth", "strokeWidth")), i && (i.classList.add(Ut), a ? (i.classList.add(je), i.style.setProperty("--flow-canvas-node-decoration-ring-background", a), i.style.setProperty("--flow-canvas-node-decoration-ring-opacity", "0.95")) : (i.classList.remove(je), i.style.removeProperty("--flow-canvas-node-decoration-ring-background"), i.style.removeProperty("--flow-canvas-node-decoration-ring-opacity")), t ? (i.classList.add(We), i.style.setProperty(
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
- ), i.style.setProperty("--flow-canvas-node-pulse-ring-opacity", "0.95")) : (i.classList.remove(We), 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);
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;
@@ -965,15 +965,15 @@ class Wt {
965
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, v;
967
967
  if (t?.style) {
968
- const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, M = t.style(o, { selected: O, highlighted: s, hovered: b });
969
- l = M.stroke, a = M.strokeWidth, v = M.strokeDasharray;
968
+ const O = this.graph.isSelected?.(e) ?? !1, b = this.hoveredEdgeId === e.id, S = t.style(o, { selected: O, highlighted: s, hovered: b });
969
+ l = S.stroke, a = S.strokeWidth, v = S.strokeDasharray;
970
970
  }
971
- const u = !t?.style && s ? "#3a84ff" : void 0, h = r?.strokeColor, c = r?.targetMarkerColor, w = h ?? l ?? u, N = !!t?.style || this.prevEdgeDecorationColors.has(e.id) || this.defaultHighlightedEdgeIds.has(e.id) || this.prevEdgeStyleIds.has(e.id);
972
- w ? this.setEdgeAttrIfChanged(e, "line/stroke", w) : N && this.restoreEdgeAttr(e, "line/stroke", "stroke"), this.applyEdgeMarkerDecoration(e, t, "targetMarker", c), t?.style ? (this.prevEdgeStyleIds.add(e.id), a ? this.setEdgeAttrIfChanged(e, "line/strokeWidth", a) : this.restoreEdgeAttr(e, "line/strokeWidth", "strokeWidth"), v ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", v) : 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)), h ? this.prevEdgeDecorationColors.add(e.id) : this.prevEdgeDecorationColors.delete(e.id), u ? this.defaultHighlightedEdgeIds.add(e.id) : this.defaultHighlightedEdgeIds.delete(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
+ 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"), v ? this.setEdgeAttrIfChanged(e, "line/strokeDasharray", v) : 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 = Q();
976
+ instanceId = J();
977
977
  registeredShapes = /* @__PURE__ */ new Map();
978
978
  wrappedComponents = /* @__PURE__ */ new Map();
979
979
  getShapeName(e) {
@@ -1007,7 +1007,7 @@ class Xt {
1007
1007
  idGenerator;
1008
1008
  disposers = [];
1009
1009
  constructor(e, o, t, s, r) {
1010
- this.graph = e, this.onUiEvent = o, this.onCommand = t, this.flowModelRef = s, this.idGenerator = r ?? Ge, this.bindEvents();
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();
@@ -1047,7 +1047,7 @@ class Xt {
1047
1047
  }), this.on("node:moved", ({ node: e }) => {
1048
1048
  const o = e.getPosition();
1049
1049
  this.onCommand({
1050
- id: Q(),
1050
+ id: J(),
1051
1051
  source: "user:drag",
1052
1052
  label: "移动节点",
1053
1053
  timestamp: Date.now(),
@@ -1058,7 +1058,7 @@ class Xt {
1058
1058
  if (!t || !s) return;
1059
1059
  const r = e.getSourcePortId(), i = e.getTargetPortId(), l = e.id in this.flowModelRef.value.edges;
1060
1060
  o && !l ? (this.graph.removeCell(e), this.onCommand({
1061
- id: Q(),
1061
+ id: J(),
1062
1062
  source: "user:drag",
1063
1063
  label: "连线",
1064
1064
  timestamp: Date.now(),
@@ -1073,7 +1073,7 @@ class Xt {
1073
1073
  }
1074
1074
  ]
1075
1075
  })) : this.onCommand({
1076
- id: Q(),
1076
+ id: J(),
1077
1077
  source: "user:drag",
1078
1078
  label: "重连",
1079
1079
  timestamp: Date.now(),
@@ -1102,7 +1102,7 @@ class Xt {
1102
1102
  });
1103
1103
  }
1104
1104
  r.length && this.onCommand({
1105
- id: Q(),
1105
+ id: J(),
1106
1106
  source: "user:drag",
1107
1107
  label: "拖动标签",
1108
1108
  timestamp: Date.now(),
@@ -1186,85 +1186,85 @@ function to({
1186
1186
  defaultInsertGap: l,
1187
1187
  getContextMenuItems: a,
1188
1188
  onHighlightChange: v,
1189
- resolveNodeShape: u
1189
+ resolveNodeShape: f
1190
1190
  }) {
1191
- const h = i ?? Ge;
1192
- let c = [], w = [], N = null, O = !1, b = null;
1193
- async function M() {
1194
- if (O) return N;
1191
+ const p = i ?? ze;
1192
+ let u = [], w = [], D = null, O = !1, b = null;
1193
+ async function S() {
1194
+ if (O) return D;
1195
1195
  O = !0;
1196
1196
  try {
1197
- const f = await import("@antv/x6-plugin-dnd"), y = f.Dnd ?? f.default;
1198
- return y ? (N = new y({
1197
+ const d = await import("@antv/x6-plugin-dnd"), y = d.Dnd ?? d.default;
1198
+ return y ? (D = new y({
1199
1199
  target: n,
1200
1200
  scaled: !0,
1201
1201
  animation: !0,
1202
- getDragNode: (d) => d.clone(),
1203
- getDropNode: (d) => d.clone()
1204
- }), N) : null;
1202
+ getDragNode: (c) => c.clone(),
1203
+ getDropNode: (c) => c.clone()
1204
+ }), D) : null;
1205
1205
  } catch {
1206
1206
  return console.warn("[flow-canvas] @antv/x6-plugin-dnd not available, add it to your dependencies"), null;
1207
1207
  }
1208
1208
  }
1209
- function S() {
1210
- return new Promise((f) => {
1211
- requestAnimationFrame(() => requestAnimationFrame(() => f()));
1209
+ function M() {
1210
+ return new Promise((d) => {
1211
+ requestAnimationFrame(() => requestAnimationFrame(() => d()));
1212
1212
  });
1213
1213
  }
1214
- const H = ({ node: f }) => {
1215
- const y = f.getData?.();
1214
+ const B = ({ node: d }) => {
1215
+ const y = d.getData?.();
1216
1216
  if (!y?._dndSessionId || y._dndSessionId !== b) return;
1217
1217
  b = null;
1218
- const d = f.getPosition();
1219
- n.removeNode(f.id);
1220
- const { _dndSessionId: g, ...p } = y, m = p.id || h("node");
1218
+ const c = d.getPosition();
1219
+ n.removeNode(d.id);
1220
+ const { _dndSessionId: g, ...h } = y, m = h.id || p("node");
1221
1221
  o({
1222
- id: Q(),
1222
+ id: J(),
1223
1223
  source: "user:drag",
1224
1224
  label: "拖入节点",
1225
1225
  timestamp: Date.now(),
1226
1226
  commands: [
1227
1227
  {
1228
1228
  type: "node.add",
1229
- node: { ...p, id: m, position: { x: d.x, y: d.y } }
1229
+ node: { ...h, id: m, position: { x: c.x, y: c.y } }
1230
1230
  }
1231
1231
  ]
1232
1232
  });
1233
1233
  };
1234
- n.on("node:added", H);
1235
- function X(f) {
1236
- const y = t.nodeTypes[f.type];
1237
- return ze(f, y?.getPorts);
1234
+ n.on("node:added", B);
1235
+ function j(d) {
1236
+ const y = t.nodeTypes[d.type];
1237
+ return Ue(d, y?.getPorts);
1238
1238
  }
1239
- function k(f) {
1240
- return f ?? ft(n.getSelectedCells?.() ?? []);
1239
+ function k(d) {
1240
+ return d ?? ft(n.getSelectedCells?.() ?? []);
1241
1241
  }
1242
- function K(f, y, d, g, p) {
1243
- switch (f) {
1242
+ function X(d, y, c, g, h) {
1243
+ switch (d) {
1244
1244
  case "left":
1245
1245
  return {
1246
- x: y.position.x - p - g.width,
1247
- y: y.position.y + (d.height - g.height) / 2
1246
+ x: y.position.x - h - g.width,
1247
+ y: y.position.y + (c.height - g.height) / 2
1248
1248
  };
1249
1249
  case "top":
1250
1250
  return {
1251
- x: y.position.x + (d.width - g.width) / 2,
1252
- y: y.position.y - p - g.height
1251
+ x: y.position.x + (c.width - g.width) / 2,
1252
+ y: y.position.y - h - g.height
1253
1253
  };
1254
1254
  case "bottom":
1255
1255
  return {
1256
- x: y.position.x + (d.width - g.width) / 2,
1257
- y: y.position.y + d.height + p
1256
+ x: y.position.x + (c.width - g.width) / 2,
1257
+ y: y.position.y + c.height + h
1258
1258
  };
1259
1259
  default:
1260
1260
  return {
1261
- x: y.position.x + d.width + p,
1262
- y: y.position.y + (d.height - g.height) / 2
1261
+ x: y.position.x + c.width + h,
1262
+ y: y.position.y + (c.height - g.height) / 2
1263
1263
  };
1264
1264
  }
1265
1265
  }
1266
- function R(f) {
1267
- switch (f) {
1266
+ function U(d) {
1267
+ switch (d) {
1268
1268
  case "left":
1269
1269
  return "right";
1270
1270
  case "top":
@@ -1275,18 +1275,18 @@ function to({
1275
1275
  return "left";
1276
1276
  }
1277
1277
  }
1278
- const B = {
1278
+ const G = {
1279
1279
  zoomIn() {
1280
1280
  n.zoom(0.1);
1281
1281
  },
1282
1282
  zoomOut() {
1283
1283
  n.zoom(-0.1);
1284
1284
  },
1285
- zoomTo(f) {
1286
- n.zoomTo(f);
1285
+ zoomTo(d) {
1286
+ n.zoomTo(d);
1287
1287
  },
1288
- zoomToFit() {
1289
- n.zoomToFit({ padding: 40, maxScale: 1.5 });
1288
+ zoomToFit(d) {
1289
+ n.zoomToFit({ padding: 40, maxScale: 1, ...d });
1290
1290
  },
1291
1291
  getZoom() {
1292
1292
  return n.zoom();
@@ -1297,218 +1297,218 @@ function to({
1297
1297
  scrollToOrigin() {
1298
1298
  n.translate(0, 0);
1299
1299
  },
1300
- scrollToNode(f) {
1301
- const y = n.getCellById(f);
1300
+ scrollToNode(d) {
1301
+ const y = n.getCellById(d);
1302
1302
  y && n.centerCell(y);
1303
1303
  },
1304
1304
  getSelection() {
1305
1305
  return k();
1306
1306
  },
1307
- getSelectionBounds(f) {
1308
- return Qt(n, k(f));
1307
+ getSelectionBounds(d) {
1308
+ return Qt(n, k(d));
1309
1309
  },
1310
- selectNodes(f) {
1311
- const y = f.map((d) => n.getCellById(d)).filter(Boolean);
1310
+ selectNodes(d) {
1311
+ const y = d.map((c) => n.getCellById(c)).filter(Boolean);
1312
1312
  n.select?.(y);
1313
1313
  },
1314
- selectEdges(f) {
1315
- const y = f.map((d) => n.getCellById(d)).filter(Boolean);
1314
+ selectEdges(d) {
1315
+ const y = d.map((c) => n.getCellById(c)).filter(Boolean);
1316
1316
  n.select?.(y);
1317
1317
  },
1318
1318
  clearSelection() {
1319
- const f = n.getSelectedCells?.();
1320
- f?.length && n.unselect?.(f);
1319
+ const d = n.getSelectedCells?.();
1320
+ d?.length && n.unselect?.(d);
1321
1321
  },
1322
- deleteSelection(f) {
1323
- const y = k(f?.selection), d = gt(y, s.value, r ?? (() => ({}))), g = Jt(d);
1322
+ deleteSelection(d) {
1323
+ const y = k(d?.selection), c = gt(y, s.value, r ?? (() => ({}))), g = Jt(c);
1324
1324
  if (g.length === 0) return null;
1325
- const p = o({
1326
- id: Q(),
1327
- source: f?.source ?? "user:toolbar",
1328
- label: f?.label ?? "删除选中",
1325
+ const h = o({
1326
+ id: J(),
1327
+ source: d?.source ?? "user:toolbar",
1328
+ label: d?.label ?? "删除选中",
1329
1329
  timestamp: Date.now(),
1330
1330
  commands: g
1331
1331
  });
1332
- return p.status === "applied" && f?.clearSelectionAfterApply !== !1 && B.clearSelection(), p;
1332
+ return h.status === "applied" && d?.clearSelectionAfterApply !== !1 && G.clearSelection(), h;
1333
1333
  },
1334
- registerDndSource(f, y) {
1335
- const d = async (g) => {
1336
- const p = await M();
1337
- if (!p) return;
1338
- const m = Q();
1334
+ registerDndSource(d, y) {
1335
+ const c = async (g) => {
1336
+ const h = await S();
1337
+ if (!h) return;
1338
+ const m = J();
1339
1339
  b = m;
1340
- const E = y(), $ = u?.(E.type), U = n.createNode({
1341
- width: $?.width ?? 154,
1342
- height: $?.height ?? 54,
1343
- shape: $?.shapeName ?? "rect",
1340
+ const E = y(), L = f?.(E.type), z = n.createNode({
1341
+ width: L?.width ?? 154,
1342
+ height: L?.height ?? 54,
1343
+ shape: L?.shapeName ?? "rect",
1344
1344
  data: { ...E, _dndSessionId: m }
1345
1345
  });
1346
- p.start(U, g);
1346
+ h.start(z, g);
1347
1347
  };
1348
- return f.addEventListener("mousedown", d), () => {
1349
- f.removeEventListener("mousedown", d);
1348
+ return d.addEventListener("mousedown", c), () => {
1349
+ d.removeEventListener("mousedown", c);
1350
1350
  };
1351
1351
  },
1352
1352
  /**
1353
1353
  * 通过编程方式发起连线:直接命中真实 port 元素,
1354
1354
  * 复用 X6 原生的连线拖拽流程与 connecting.createEdge 配置。
1355
1355
  */
1356
- startConnection(f, y) {
1357
- const d = n.getCellById(f);
1358
- if (!d?.isNode()) return;
1359
- const g = d, p = n.findViewByCell(g);
1360
- if (!p) return;
1361
- const m = p.findPortElem(y, "circle") ?? p.findPortElem(y);
1356
+ startConnection(d, y) {
1357
+ const c = n.getCellById(d);
1358
+ if (!c?.isNode()) return;
1359
+ const g = c, h = n.findViewByCell(g);
1360
+ if (!h) return;
1361
+ const m = h.findPortElem(y, "circle") ?? h.findPortElem(y);
1362
1362
  if (!m) return;
1363
- const $ = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, U = $.getBoundingClientRect(), D = U.left + U.width / 2, L = U.top + U.height / 2, x = new MouseEvent("mousedown", {
1364
- clientX: D,
1365
- clientY: L,
1363
+ const L = (m.matches?.("[magnet]") ? m : m.querySelector?.("[magnet]")) ?? m, z = L.getBoundingClientRect(), ie = z.left + z.width / 2, N = z.top + z.height / 2, _ = new MouseEvent("mousedown", {
1364
+ clientX: ie,
1365
+ clientY: N,
1366
1366
  button: 0,
1367
1367
  buttons: 1,
1368
1368
  bubbles: !0,
1369
1369
  cancelable: !0
1370
1370
  });
1371
- $.dispatchEvent(x);
1371
+ L.dispatchEvent(_);
1372
1372
  },
1373
- async exportAsImage(f) {
1374
- const { domToBlob: y } = await import("modern-screenshot"), d = f?.padding ?? 20, g = f?.backgroundColor ?? n.options.background?.color ?? "#ffffff", p = n.zoom(), m = n.translate(), E = n.getContentBBox(), $ = E.width / p, U = E.height / p;
1375
- if ($ === 0 || U === 0)
1373
+ async exportAsImage(d) {
1374
+ const { domToBlob: y } = await import("modern-screenshot"), c = d?.padding ?? 20, g = d?.backgroundColor ?? n.options.background?.color ?? "#ffffff", h = n.zoom(), m = n.translate(), E = n.getContentBBox(), L = E.width / h, z = E.height / h;
1375
+ if (L === 0 || z === 0)
1376
1376
  return new Blob();
1377
- const D = (E.x - m.tx) / p, L = (E.y - m.ty) / p, x = Math.ceil($ + d * 2), T = Math.ceil(U + d * 2), G = document.createElement("div");
1378
- G.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1379
- const j = n.container.cloneNode(!0);
1380
- j.style.width = `${x}px`, j.style.height = `${T}px`, j.style.overflow = "visible";
1381
- const ee = j.querySelector("svg");
1382
- ee && (ee.setAttribute("width", String(x)), ee.setAttribute("height", String(T)), ee.style.width = `${x}px`, ee.style.height = `${T}px`), j.querySelector(".x6-graph-svg-viewport")?.setAttribute("transform", `matrix(1,0,0,1,${-D + d},${-L + d})`), G.appendChild(j), document.body.appendChild(G);
1377
+ const ie = (E.x - m.tx) / h, N = (E.y - m.ty) / h, _ = Math.ceil(L + c * 2), x = Math.ceil(z + c * 2), R = document.createElement("div");
1378
+ R.style.cssText = "position:fixed;left:-99999px;top:0;pointer-events:none;";
1379
+ const F = n.container.cloneNode(!0);
1380
+ F.style.width = `${_}px`, F.style.height = `${x}px`, F.style.overflow = "visible";
1381
+ const Z = F.querySelector("svg");
1382
+ 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,${-ie + c},${-N + c})`), R.appendChild(F), document.body.appendChild(R);
1383
1383
  try {
1384
- return await S(), await y(j, {
1385
- width: x,
1386
- height: T,
1384
+ return await M(), await y(F, {
1385
+ width: _,
1386
+ height: x,
1387
1387
  backgroundColor: g,
1388
- scale: f?.scale ?? window.devicePixelRatio,
1389
- filter: (Z) => {
1390
- if (Z instanceof Element) {
1391
- const J = Z.getAttribute("class") ?? "";
1392
- if (J.includes("x6-widget-selection") || J.includes("x6-widget-transform") || J.includes("x6-graph-grid") || J.includes("x6-graph-background"))
1388
+ scale: d?.scale ?? window.devicePixelRatio,
1389
+ filter: (Q) => {
1390
+ if (Q instanceof Element) {
1391
+ const K = Q.getAttribute("class") ?? "";
1392
+ if (K.includes("x6-widget-selection") || K.includes("x6-widget-transform") || K.includes("x6-graph-grid") || K.includes("x6-graph-background"))
1393
1393
  return !1;
1394
1394
  }
1395
1395
  return !0;
1396
1396
  }
1397
1397
  });
1398
- } catch (Z) {
1399
- return console.warn("[flow-canvas] Export failed:", Z), new Blob();
1398
+ } catch (Q) {
1399
+ return console.warn("[flow-canvas] Export failed:", Q), new Blob();
1400
1400
  } finally {
1401
- G.remove();
1401
+ R.remove();
1402
1402
  }
1403
1403
  },
1404
- highlightNodes(f) {
1405
- c = f, v?.(c, w);
1404
+ highlightNodes(d) {
1405
+ u = d, v?.(u, w);
1406
1406
  },
1407
- highlightEdges(f) {
1408
- w = f, v?.(c, w);
1407
+ highlightEdges(d) {
1408
+ w = d, v?.(u, w);
1409
1409
  },
1410
1410
  clearHighlight() {
1411
- c = [], w = [], v?.([], []);
1411
+ u = [], w = [], v?.([], []);
1412
1412
  },
1413
1413
  overlay: e,
1414
- getContextMenuItems(f) {
1415
- return a?.(f) ?? [];
1414
+ getContextMenuItems(d) {
1415
+ return a?.(d) ?? [];
1416
1416
  },
1417
- insertNodeToRight(f, y, d) {
1418
- const g = s.value, p = g.nodes[f];
1419
- if (!p)
1417
+ insertNodeToRight(d, y, c) {
1418
+ const g = s.value, h = g.nodes[d];
1419
+ if (!h)
1420
1420
  return {
1421
1421
  status: "invalid",
1422
1422
  envelope: { id: "", source: "user:toolbar", timestamp: Date.now(), commands: [] },
1423
- error: { code: "constraint_violated", reason: `Source node "${f}" not found`, source: "api" }
1423
+ error: { code: "constraint_violated", reason: `Source node "${d}" not found`, source: "api" }
1424
1424
  };
1425
- const m = d?.gap ?? l ?? eo, E = d?.direction ?? "right", $ = t.nodeTypes[p.type], U = t.nodeTypes[y.type], D = $?.getSize(p) ?? { width: 154, height: 54 }, L = U?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
1425
+ const m = c?.gap ?? l ?? eo, E = c?.direction ?? "right", L = t.nodeTypes[h.type], z = t.nodeTypes[y.type], ie = L?.getSize(h) ?? { width: 154, height: 54 }, N = z?.getSize({ ...y, position: { x: 0, y: 0 } }) ?? {
1426
1426
  width: 154,
1427
1427
  height: 54
1428
- }, x = K(E, p, D, L, m), T = y.id || h("node"), G = { ...y, id: T, position: x }, j = [{ type: "node.add", node: G }];
1429
- if (d?.autoWireEdges) {
1430
- const ie = X(p), Z = X(G), J = E, Ee = R(E), he = ie.find((I) => I.group === J), ye = Z.find((I) => I.group === Ee), $e = Z.find((I) => I.group === J), Se = he ? Object.values(g.edges).find(
1431
- (I) => I.source.nodeId === f && I.source.portId === he.id
1432
- ) : Object.values(g.edges).find((I) => I.source.nodeId === f);
1428
+ }, _ = X(E, h, ie, N, m), x = y.id || p("node"), R = { ...y, id: x, position: _ }, F = [{ type: "node.add", node: R }];
1429
+ if (c?.autoWireEdges) {
1430
+ const ae = j(h), 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(
1431
+ (I) => I.source.nodeId === d && I.source.portId === pe.id
1432
+ ) : Object.values(g.edges).find((I) => I.source.nodeId === d);
1433
1433
  if (Se) {
1434
- const I = Se.target, C = L.width + m, _ = E === "right" ? C : E === "left" ? -C : 0, W = E === "bottom" ? C : E === "top" ? -C : 0, te = /* @__PURE__ */ new Set(), ae = [I.nodeId];
1435
- for (; ae.length > 0; ) {
1436
- const ne = ae.shift();
1437
- if (te.has(ne) || ne === f) continue;
1438
- te.add(ne);
1439
- const xe = g.nodes[ne];
1434
+ 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];
1435
+ for (; le.length > 0; ) {
1436
+ const oe = le.shift();
1437
+ if (ee.has(oe) || oe === d) continue;
1438
+ ee.add(oe);
1439
+ const xe = g.nodes[oe];
1440
1440
  if (xe) {
1441
- j.push({
1441
+ F.push({
1442
1442
  type: "node.move",
1443
- nodeId: ne,
1443
+ nodeId: oe,
1444
1444
  position: {
1445
- x: xe.position.x + _,
1445
+ x: xe.position.x + P,
1446
1446
  y: xe.position.y + W
1447
1447
  }
1448
1448
  });
1449
- for (const we of Object.values(g.edges))
1450
- we.source.nodeId === ne && !te.has(we.target.nodeId) && ae.push(we.target.nodeId);
1449
+ for (const be of Object.values(g.edges))
1450
+ be.source.nodeId === oe && !ee.has(be.target.nodeId) && le.push(be.target.nodeId);
1451
1451
  }
1452
1452
  }
1453
- j.push({ type: "edge.remove", edgeId: Se.id }), j.push({
1453
+ F.push({ type: "edge.remove", edgeId: Se.id }), F.push({
1454
1454
  type: "edge.add",
1455
1455
  edge: {
1456
- id: h("edge"),
1457
- source: { nodeId: f, portId: he?.id },
1458
- target: { nodeId: T, portId: ye?.id }
1456
+ id: p("edge"),
1457
+ source: { nodeId: d, portId: pe?.id },
1458
+ target: { nodeId: x, portId: we?.id }
1459
1459
  }
1460
- }), j.push({
1460
+ }), F.push({
1461
1461
  type: "edge.add",
1462
1462
  edge: {
1463
- id: h("edge"),
1464
- source: { nodeId: T, portId: $e?.id },
1463
+ id: p("edge"),
1464
+ source: { nodeId: x, portId: $e?.id },
1465
1465
  target: I
1466
1466
  }
1467
1467
  });
1468
1468
  } else
1469
- j.push({
1469
+ F.push({
1470
1470
  type: "edge.add",
1471
1471
  edge: {
1472
- id: h("edge"),
1473
- source: { nodeId: f, portId: he?.id },
1474
- target: { nodeId: T, portId: ye?.id }
1472
+ id: p("edge"),
1473
+ source: { nodeId: d, portId: pe?.id },
1474
+ target: { nodeId: x, portId: we?.id }
1475
1475
  }
1476
1476
  });
1477
1477
  }
1478
- const ee = {
1479
- id: Q(),
1480
- source: d?.source ?? "user:toolbar",
1481
- label: d?.label ?? "插入节点",
1478
+ const Z = {
1479
+ id: J(),
1480
+ source: c?.source ?? "user:toolbar",
1481
+ label: c?.label ?? "插入节点",
1482
1482
  timestamp: Date.now(),
1483
- commands: j
1483
+ commands: F
1484
1484
  };
1485
- return o(ee);
1485
+ return o(Z);
1486
1486
  },
1487
- onGraphEvent(f, y) {
1488
- return n.on(f, y), () => n.off(f, y);
1487
+ onGraphEvent(d, y) {
1488
+ return n.on(d, y), () => n.off(d, y);
1489
1489
  },
1490
1490
  unsafeGetGraph() {
1491
1491
  return n;
1492
1492
  }
1493
1493
  };
1494
- return B;
1494
+ return G;
1495
1495
  }
1496
1496
  function oo() {
1497
- const n = z(null), e = z(!1);
1497
+ const n = H(null), e = H(!1);
1498
1498
  let o = null, t = !1;
1499
- function s(h) {
1500
- o && (clearTimeout(o), o = null), n.value = h;
1499
+ function s(p) {
1500
+ o && (clearTimeout(o), o = null), n.value = p;
1501
1501
  }
1502
- function r(h = 100) {
1502
+ function r(p = 100) {
1503
1503
  t || (o && clearTimeout(o), o = setTimeout(() => {
1504
1504
  n.value = null, o = null;
1505
- }, h));
1505
+ }, p));
1506
1506
  }
1507
1507
  function i() {
1508
1508
  t = !0, o && (clearTimeout(o), o = null);
1509
1509
  }
1510
- function l(h = 100) {
1511
- t = !1, r(h);
1510
+ function l(p = 100) {
1511
+ t = !1, r(p);
1512
1512
  }
1513
1513
  function a() {
1514
1514
  o && (clearTimeout(o), o = null);
@@ -1516,33 +1516,33 @@ function oo() {
1516
1516
  function v() {
1517
1517
  a(), t = !1, n.value = null;
1518
1518
  }
1519
- function u() {
1519
+ function f() {
1520
1520
  o && clearTimeout(o);
1521
1521
  }
1522
- return { hoveredNodeId: n, isDraggingNode: e, enter: s, leave: r, enterOverlay: i, leaveOverlay: l, cancelLeave: a, reset: v, cleanup: u };
1522
+ return { hoveredNodeId: n, isDraggingNode: e, enter: s, leave: r, enterOverlay: i, leaveOverlay: l, cancelLeave: a, reset: v, cleanup: f };
1523
1523
  }
1524
- const Ve = 10, Ae = 12;
1525
- function Xe(n, e) {
1524
+ const Xe = 10, Ae = 12;
1525
+ function Ke(n, e) {
1526
1526
  const o = n.getTotalLength();
1527
1527
  if (o === 0) return { ...e, length: 0, totalLength: 0 };
1528
1528
  let t = n.getPointAtLength(0), s = 1 / 0;
1529
1529
  const r = 50, i = o / r;
1530
1530
  let l = 0;
1531
- for (let h = 0; h <= r; h++) {
1532
- const c = h * i, w = n.getPointAtLength(c), N = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
1533
- N < s && (s = N, t = w, l = c);
1531
+ for (let p = 0; p <= r; p++) {
1532
+ const u = p * i, w = n.getPointAtLength(u), D = (w.x - e.x) ** 2 + (w.y - e.y) ** 2;
1533
+ D < s && (s = D, t = w, l = u);
1534
1534
  }
1535
- const a = Math.max(0, l - i), v = Math.min(o, l + i), u = (v - a) / 20;
1536
- for (let h = a; h <= v; h += u) {
1537
- const c = n.getPointAtLength(h), w = (c.x - e.x) ** 2 + (c.y - e.y) ** 2;
1538
- w < s && (s = w, t = c, l = h);
1535
+ const a = Math.max(0, l - i), v = Math.min(o, l + i), f = (v - a) / 20;
1536
+ for (let p = a; p <= v; p += f) {
1537
+ const u = n.getPointAtLength(p), w = (u.x - e.x) ** 2 + (u.y - e.y) ** 2;
1538
+ w < s && (s = w, t = u, l = p);
1539
1539
  }
1540
1540
  return { x: t.x, y: t.y, length: l, totalLength: o };
1541
1541
  }
1542
- function Ke(n, e) {
1543
- return n < Ve || n > e - Ve;
1542
+ function Ye(n, e) {
1543
+ return n < Xe || n > e - Xe;
1544
1544
  }
1545
- function Ye(n, e, o) {
1545
+ function Ze(n, e, o) {
1546
1546
  const t = n.querySelectorAll(".x6-edge-label");
1547
1547
  for (const s of t) {
1548
1548
  const r = s.getBoundingClientRect();
@@ -1551,7 +1551,7 @@ function Ye(n, e, o) {
1551
1551
  }
1552
1552
  return !1;
1553
1553
  }
1554
- function Ze() {
1554
+ function Qe() {
1555
1555
  const n = "http://www.w3.org/2000/svg", e = document.createElementNS(n, "g");
1556
1556
  e.setAttribute("class", "flow-canvas-edge-delete-tool"), e.style.cursor = "pointer";
1557
1557
  const o = document.createElementNS(n, "rect");
@@ -1563,16 +1563,16 @@ function no(n) {
1563
1563
  let e = null, o = null;
1564
1564
  function t(l, a) {
1565
1565
  if (r(), o = l, a.target?.closest?.(".x6-edge-label")) return;
1566
- const u = n.getCellById(l);
1567
- if (!u?.isEdge()) return;
1568
- const h = n.findViewByCell(u);
1569
- if (!h) return;
1570
- const c = h.container.querySelector("path");
1571
- if (!c) return;
1572
- const w = n.clientToLocal(a.clientX, a.clientY), N = Xe(c, w);
1573
- if (Ke(N.length, N.totalLength) || Ye(h.container, a.clientX, a.clientY)) return;
1574
- const O = Ze();
1575
- O.setAttribute("transform", `translate(${N.x}, ${N.y})`), h.container.appendChild(O), e = O;
1566
+ const f = n.getCellById(l);
1567
+ if (!f?.isEdge()) return;
1568
+ const p = n.findViewByCell(f);
1569
+ if (!p) return;
1570
+ const u = p.container.querySelector("path");
1571
+ if (!u) return;
1572
+ const w = n.clientToLocal(a.clientX, a.clientY), D = Ke(u, w);
1573
+ if (Ye(D.length, D.totalLength) || Ze(p.container, a.clientX, a.clientY)) return;
1574
+ const O = Qe();
1575
+ O.setAttribute("transform", `translate(${D.x}, ${D.y})`), p.container.appendChild(O), e = O;
1576
1576
  }
1577
1577
  function s(l) {
1578
1578
  if (!o) return;
@@ -1582,18 +1582,18 @@ function no(n) {
1582
1582
  }
1583
1583
  const v = n.getCellById(o);
1584
1584
  if (!v?.isEdge()) return;
1585
- const u = n.findViewByCell(v);
1586
- if (!u) return;
1587
- const h = u.container.querySelector("path");
1588
- if (!h) return;
1589
- const c = n.clientToLocal(l.clientX, l.clientY), w = Xe(h, c);
1590
- if (Ke(w.length, w.totalLength) || Ye(u.container, l.clientX, l.clientY))
1585
+ const f = n.findViewByCell(v);
1586
+ if (!f) return;
1587
+ const p = f.container.querySelector("path");
1588
+ if (!p) return;
1589
+ const u = n.clientToLocal(l.clientX, l.clientY), w = Ke(p, u);
1590
+ if (Ye(w.length, w.totalLength) || Ze(f.container, l.clientX, l.clientY))
1591
1591
  e && e.setAttribute("display", "none");
1592
1592
  else if (e)
1593
1593
  e.removeAttribute("display"), e.setAttribute("transform", `translate(${w.x}, ${w.y})`);
1594
1594
  else {
1595
- const N = Ze();
1596
- N.setAttribute("transform", `translate(${w.x}, ${w.y})`), u.container.appendChild(N), e = N;
1595
+ const D = Qe();
1596
+ D.setAttribute("transform", `translate(${w.x}, ${w.y})`), f.container.appendChild(D), e = D;
1597
1597
  }
1598
1598
  }
1599
1599
  function r() {
@@ -1606,29 +1606,29 @@ function no(n) {
1606
1606
  }
1607
1607
  function so(n) {
1608
1608
  let e = null, o = 0;
1609
- function t(u) {
1610
- const h = u ? "visible" : "hidden";
1611
- for (const c of n.getNodes())
1612
- for (const w of c.getPorts())
1613
- c.setPortProp(w.id, "attrs/circle/visibility", h);
1609
+ function t(f) {
1610
+ const p = f ? "visible" : "hidden";
1611
+ for (const u of n.getNodes())
1612
+ for (const w of u.getPorts())
1613
+ u.setPortProp(w.id, "attrs/circle/visibility", p);
1614
1614
  }
1615
- function s(u) {
1615
+ function s(f) {
1616
1616
  if (!e)
1617
- for (const h of u.getPorts())
1618
- u.setPortProp(h.id, "attrs/circle/visibility", "visible");
1617
+ for (const p of f.getPorts())
1618
+ f.setPortProp(p.id, "attrs/circle/visibility", "visible");
1619
1619
  }
1620
- function r(u) {
1620
+ function r(f) {
1621
1621
  if (!e)
1622
- for (const h of u.getPorts())
1623
- u.setPortProp(h.id, "attrs/circle/visibility", "hidden");
1624
- }
1625
- function i(u, h) {
1626
- if (!u.getTargetCell())
1627
- if (e = u.id, h?.size)
1628
- for (const c of n.getNodes()) {
1629
- const w = h.has(c.id) ? "hidden" : "visible";
1630
- for (const N of c.getPorts())
1631
- c.setPortProp(N.id, "attrs/circle/visibility", w);
1622
+ for (const p of f.getPorts())
1623
+ f.setPortProp(p.id, "attrs/circle/visibility", "hidden");
1624
+ }
1625
+ function i(f, p) {
1626
+ if (!f.getTargetCell())
1627
+ if (e = f.id, p?.size)
1628
+ for (const u of n.getNodes()) {
1629
+ const w = p.has(u.id) ? "hidden" : "visible";
1630
+ for (const D of u.getPorts())
1631
+ u.setPortProp(D.id, "attrs/circle/visibility", w);
1632
1632
  }
1633
1633
  else
1634
1634
  t(!0);
@@ -1636,8 +1636,8 @@ function so(n) {
1636
1636
  function l() {
1637
1637
  e = null, t(!1), o = Date.now() + 300;
1638
1638
  }
1639
- function a(u) {
1640
- u === e && (e = null, t(!1));
1639
+ function a(f) {
1640
+ f === e && (e = null, t(!1));
1641
1641
  }
1642
1642
  function v() {
1643
1643
  return !e && Date.now() >= o;
@@ -1651,48 +1651,50 @@ function so(n) {
1651
1651
  canShowEdgeTool: v
1652
1652
  };
1653
1653
  }
1654
- function Qe(n) {
1654
+ function Je(n) {
1655
1655
  return n === "top" || n === "right" || n === "bottom" || n === "left";
1656
1656
  }
1657
1657
  function ro(n) {
1658
- const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: s, getNodeBehavior: r, getInsertGap: i } = n, { isDraggingNode: l } = n, a = z(null), v = z(!1);
1659
- let u = null, h = null, c = null;
1658
+ const { editor: e, nodeHover: o, isSelectionModeActive: t, viewportVersion: s, getNodeBehavior: r, getInsertGap: i } = n, { isDraggingNode: l } = n, a = H(null), v = H(!1);
1659
+ let f = null, p = null, u = null;
1660
1660
  const w = V(() => ({
1661
1661
  enabled: !0,
1662
1662
  portGroup: "right",
1663
+ autoPanOnOpen: !0,
1664
+ autoPanPadding: 16,
1663
1665
  ...n.quickAddProp.value
1664
1666
  }));
1665
- function N() {
1666
- u && (clearTimeout(u), u = null);
1667
+ function D() {
1668
+ f && (clearTimeout(f), f = null);
1667
1669
  }
1668
1670
  function O() {
1669
- u && clearTimeout(u), u = setTimeout(() => {
1670
- a.value = null, u = null;
1671
+ f && clearTimeout(f), f = setTimeout(() => {
1672
+ a.value = null, f = null;
1671
1673
  }, 150);
1672
1674
  }
1673
- function b(D) {
1674
- return v.value ? !0 : (N(), f(D) ? (a.value = D, !0) : (a.value = null, !1));
1675
- }
1676
- function M() {
1677
- N(), o.enterOverlay();
1675
+ function b(N) {
1676
+ return v.value ? !0 : (D(), d(N) ? (a.value = N, !0) : (a.value = null, !1));
1678
1677
  }
1679
1678
  function S() {
1679
+ D(), o.enterOverlay();
1680
+ }
1681
+ function M() {
1680
1682
  O(), o.leaveOverlay();
1681
1683
  }
1682
- function H(D) {
1683
- const L = e.schema.nodeTypes[D.type];
1684
- return ze(D, L?.getPorts);
1684
+ function B(N) {
1685
+ const _ = e.schema.nodeTypes[N.type];
1686
+ return Ue(N, _?.getPorts);
1685
1687
  }
1686
- function X(D, L) {
1687
- const x = w.value.getPort?.(D, L);
1688
+ function j(N, _) {
1689
+ const x = w.value.getPort?.(N, _);
1688
1690
  if (!x) return null;
1689
- const T = typeof x == "string" ? x : x.id;
1690
- return L.find((G) => G.id === T) ?? null;
1691
+ const R = typeof x == "string" ? x : x.id;
1692
+ return _.find((F) => F.id === R) ?? null;
1691
1693
  }
1692
- function k(D, L) {
1693
- const x = e.api.value?.overlay.getNodeScreenRect(D);
1694
+ function k(N, _) {
1695
+ const x = e.api.value?.overlay.getNodeScreenRect(N);
1694
1696
  if (!x) return null;
1695
- switch (L) {
1697
+ switch (_) {
1696
1698
  case "top":
1697
1699
  return { x: x.x + x.width / 2, y: x.y };
1698
1700
  case "bottom":
@@ -1705,113 +1707,118 @@ function ro(n) {
1705
1707
  return null;
1706
1708
  }
1707
1709
  }
1708
- function K(D, L, x) {
1709
- if (!h) return k(D, x);
1710
- const T = h.getCellById(D);
1711
- if (T?.isNode()) {
1712
- const G = T, j = h.findViewByCell(G), ee = j?.findPortElem(L, "circle") ?? j?.findPortElem(L);
1713
- if (ee) {
1714
- const ie = h.container.getBoundingClientRect(), Z = ee.getBoundingClientRect();
1710
+ function X(N, _, x) {
1711
+ if (!p) return k(N, x);
1712
+ const R = p.getCellById(N);
1713
+ if (R?.isNode()) {
1714
+ const F = R, Z = p.findViewByCell(F), ae = Z?.findPortElem(_, "circle") ?? Z?.findPortElem(_);
1715
+ if (ae) {
1716
+ const Q = p.container.getBoundingClientRect(), K = ae.getBoundingClientRect();
1715
1717
  return {
1716
- x: Z.left - ie.left + Z.width / 2,
1717
- y: Z.top - ie.top + Z.height / 2
1718
+ x: K.left - Q.left + K.width / 2,
1719
+ y: K.top - Q.top + K.height / 2
1718
1720
  };
1719
1721
  }
1720
1722
  }
1721
- return k(D, x);
1723
+ return k(N, x);
1722
1724
  }
1723
- function R(D) {
1724
- const L = H(D), x = X(D, L) ?? L.find((G) => G.group === w.value.portGroup) ?? null;
1725
+ function U(N) {
1726
+ const _ = B(N), x = j(N, _) ?? _.find((F) => F.group === w.value.portGroup) ?? null;
1725
1727
  if (!x) return null;
1726
- const T = K(D.id, x.id, x.group);
1727
- return T ? { portId: x.id, portGroup: x.group, portPosition: T } : null;
1728
+ const R = X(N.id, x.id, x.group);
1729
+ return R ? { portId: x.id, portGroup: x.group, portPosition: R } : null;
1728
1730
  }
1729
- function B(D) {
1730
- const L = R(D), x = w.value.insertDirection;
1731
+ function G(N) {
1732
+ const _ = U(N), x = w.value.insertDirection;
1731
1733
  if (typeof x == "function") {
1732
- const T = x(D, L ? { id: L.portId, group: L.portGroup } : null);
1733
- if (T) return T;
1734
+ const R = x(N, _ ? { id: _.portId, group: _.portGroup } : null);
1735
+ if (R) return R;
1734
1736
  } else if (x)
1735
1737
  return x;
1736
- return L && Qe(L.portGroup) ? L.portGroup : Qe(w.value.portGroup) ? w.value.portGroup : "right";
1738
+ return _ && Je(_.portGroup) ? _.portGroup : Je(w.value.portGroup) ? w.value.portGroup : "right";
1737
1739
  }
1738
- function f(D) {
1740
+ function d(N) {
1739
1741
  if (!w.value.enabled || e.mode.value !== "edit") return !1;
1740
- const x = e.flowModel.value.nodes[D];
1741
- return !x || r(x).quickAddEnabled === !1 ? !1 : !!R(x);
1742
+ const x = e.flowModel.value.nodes[N];
1743
+ return !x || r(x).quickAddEnabled === !1 ? !1 : !!U(x);
1742
1744
  }
1743
1745
  const y = V(() => {
1744
1746
  if (s.value, !w.value.enabled) return null;
1745
- const D = a.value;
1746
- if (!D || l.value || !e.api.value || e.mode.value !== "edit" || t.value)
1747
+ const N = a.value;
1748
+ if (!N || l.value || !e.api.value || e.mode.value !== "edit" || t.value)
1747
1749
  return null;
1748
- const x = e.flowModel.value.nodes[D];
1750
+ const x = e.flowModel.value.nodes[N];
1749
1751
  if (!x) return null;
1750
- const T = r(x);
1751
- if (T.quickAddEnabled === !1) return null;
1752
- const G = R(x);
1753
- return G ? { node: x, ...G, behavior: T } : null;
1752
+ const R = r(x);
1753
+ if (R.quickAddEnabled === !1) return null;
1754
+ const F = U(x);
1755
+ return F ? { node: x, ...F, behavior: R } : null;
1754
1756
  });
1755
- function d(D) {
1756
- v.value = !0, y.value && e._emitUiEvent({ type: "node.quick-add", nodeId: D, position: y.value.portPosition });
1757
+ function c(N) {
1758
+ v.value = !0, y.value && e._emitUiEvent({ type: "node.quick-add", nodeId: N, position: y.value.portPosition });
1757
1759
  }
1758
1760
  function g() {
1759
1761
  v.value = !1;
1760
1762
  }
1761
- function p(D) {
1762
- const L = e.api.value;
1763
- if (!L) return;
1764
- const x = e.flowModel.value.nodes[D];
1763
+ function h(N) {
1764
+ const _ = e.api.value;
1765
+ if (!_) return;
1766
+ const x = e.flowModel.value.nodes[N];
1765
1767
  if (!x) return;
1766
- const T = R(x);
1767
- T && L.startConnection(D, T.portId);
1768
+ const R = U(x);
1769
+ R && _.startConnection(N, R.portId);
1770
+ }
1771
+ function m(N) {
1772
+ if (!p || !w.value.autoPanOnOpen || N <= 0) return;
1773
+ const _ = p.translate();
1774
+ p.translate(_.tx - N, _.ty);
1768
1775
  }
1769
- function m(D, L) {
1776
+ function E(N, _) {
1770
1777
  const x = e.api.value;
1771
1778
  if (!x) return;
1772
- const T = L.id || e.idGenerator("node"), G = { ...L, id: T }, j = e.flowModel.value.nodes[D];
1773
- if (!j) return;
1774
- x.insertNodeToRight(D, G, {
1779
+ const R = _.id || e.idGenerator("node"), F = { ..._, id: R }, Z = e.flowModel.value.nodes[N];
1780
+ if (!Z) return;
1781
+ x.insertNodeToRight(N, F, {
1775
1782
  autoWireEdges: !0,
1776
- direction: B(j),
1783
+ direction: G(Z),
1777
1784
  gap: i(),
1778
1785
  source: "user:quick-add",
1779
1786
  label: "快捷插入节点"
1780
- }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: D, newNodeId: T }), n.closePopover();
1781
- }
1782
- function E(D) {
1783
- if (!h) return;
1784
- const L = h.getCellById(D);
1785
- if (!L?.isNode()) return;
1786
- const x = L, T = e.flowModel.value.nodes[D];
1787
- if (!T) return;
1788
- const G = R(T);
1789
- let j = !0;
1790
- r(T).hidePortForQuickAdd === !1 && (j = !1);
1791
- const ie = j && !l.value && !!G && f(D);
1792
- for (const Z of x.getPorts()) {
1793
- const J = ie && Z.id === G?.portId ? "hidden" : "visible";
1794
- x.setPortProp(Z.id, "attrs/circle/visibility", J);
1795
- }
1796
- }
1797
- function $(D, L) {
1798
- c?.(), h = D, c = ge(
1787
+ }).status === "applied" && e._emitUiEvent({ type: "node.action.quick-insert", sourceNodeId: N, newNodeId: R }), n.closePopover();
1788
+ }
1789
+ function L(N) {
1790
+ if (!p) return;
1791
+ const _ = p.getCellById(N);
1792
+ if (!_?.isNode()) return;
1793
+ const x = _, R = e.flowModel.value.nodes[N];
1794
+ if (!R) return;
1795
+ const F = U(R);
1796
+ let Z = !0;
1797
+ r(R).hidePortForQuickAdd === !1 && (Z = !1);
1798
+ const Q = Z && !l.value && !!F && d(N);
1799
+ for (const K of x.getPorts()) {
1800
+ const me = Q && K.id === F?.portId ? "hidden" : "visible";
1801
+ x.setPortProp(K.id, "attrs/circle/visibility", me);
1802
+ }
1803
+ }
1804
+ function z(N, _) {
1805
+ u?.(), p = N, u = ge(
1799
1806
  [a, l],
1800
- ([x], [T]) => {
1801
- if (T && T !== x) {
1802
- const G = D.getCellById(T);
1803
- G?.isNode() && L(G);
1807
+ ([x], [R]) => {
1808
+ if (R && R !== x) {
1809
+ const F = N.getCellById(R);
1810
+ F?.isNode() && _(F);
1804
1811
  }
1805
- x && E(x);
1812
+ x && L(x);
1806
1813
  },
1807
1814
  { flush: "sync" }
1808
1815
  );
1809
1816
  }
1810
- ge(y, (D) => {
1811
- D || (v.value = !1);
1817
+ ge(y, (N) => {
1818
+ N || (v.value = !1);
1812
1819
  });
1813
- function U() {
1814
- u && clearTimeout(u), c?.(), c = null, h = null;
1820
+ function ie() {
1821
+ f && clearTimeout(f), u?.(), u = null, p = null;
1815
1822
  }
1816
1823
  return {
1817
1824
  quickAddNodeId: a,
@@ -1820,17 +1827,18 @@ function ro(n) {
1820
1827
  data: y,
1821
1828
  enter: b,
1822
1829
  leave: O,
1823
- cancelLeave: N,
1824
- handleOverlayEnter: M,
1825
- handleOverlayLeave: S,
1826
- handleOpen: d,
1830
+ cancelLeave: D,
1831
+ handleOverlayEnter: S,
1832
+ handleOverlayLeave: M,
1833
+ handleOpen: c,
1827
1834
  handleClose: g,
1828
- handleStartDrag: p,
1829
- handleInsert: m,
1830
- isActiveForNode: f,
1831
- syncNodePorts: E,
1832
- attachRuntime: $,
1833
- cleanup: U
1835
+ handleStartDrag: h,
1836
+ handlePopoverViewportOverflow: m,
1837
+ handleInsert: E,
1838
+ isActiveForNode: d,
1839
+ syncNodePorts: L,
1840
+ attachRuntime: z,
1841
+ cleanup: ie
1834
1842
  };
1835
1843
  }
1836
1844
  const io = 15, ao = 10;
@@ -1846,125 +1854,125 @@ function lo(n) {
1846
1854
  outgoingPortGroup: "right",
1847
1855
  ...n.edgeDropProp.value
1848
1856
  }));
1849
- function v(f) {
1857
+ function v(d) {
1850
1858
  if (!o) return null;
1851
- const y = o.getCellById(f);
1859
+ const y = o.getCellById(d);
1852
1860
  if (!y?.isEdge()) return null;
1853
- const d = o.findViewByCell(y)?.container;
1854
- if (!d) return null;
1855
- const g = d.querySelectorAll("path");
1856
- for (const p of g)
1857
- if (p.getAttribute("stroke") !== "transparent") return p;
1861
+ const c = o.findViewByCell(y)?.container;
1862
+ if (!c) return null;
1863
+ const g = c.querySelectorAll("path");
1864
+ for (const h of g)
1865
+ if (h.getAttribute("stroke") !== "transparent") return h;
1858
1866
  return null;
1859
1867
  }
1860
- function u(f) {
1861
- const y = v(f);
1862
- y && (y.style.stroke = "#3a84ff", r = f);
1868
+ function f(d) {
1869
+ const y = v(d);
1870
+ y && (y.style.stroke = "#3a84ff", r = d);
1863
1871
  }
1864
- function h() {
1872
+ function p() {
1865
1873
  if (!r) return;
1866
- const f = v(r);
1867
- f && (f.style.stroke = ""), r = null;
1874
+ const d = v(r);
1875
+ d && (d.style.stroke = ""), r = null;
1868
1876
  }
1869
- function c(f, y, d) {
1877
+ function u(d, y, c) {
1870
1878
  if (o) {
1871
- const g = o.getCellById(f);
1879
+ const g = o.getCellById(d);
1872
1880
  if (g?.isNode()) {
1873
- const p = g.getPorts().find((m) => m.group === d);
1874
- if (p?.id) return p.id;
1881
+ const h = g.getPorts().find((m) => m.group === c);
1882
+ if (h?.id) return h.id;
1875
1883
  }
1876
1884
  }
1877
1885
  if (y.ports?.length) {
1878
- const g = y.ports.find((p) => p.group === d);
1886
+ const g = y.ports.find((h) => h.group === c);
1879
1887
  if (g) return g.id;
1880
1888
  }
1881
- return d;
1889
+ return c;
1882
1890
  }
1883
- function w(f) {
1884
- const y = f.getTotalLength();
1891
+ function w(d) {
1892
+ const y = d.getTotalLength();
1885
1893
  if (y === 0) return [];
1886
- const d = [];
1887
- for (let p = 0; p <= y; p += ao) {
1888
- const m = f.getPointAtLength(p);
1889
- d.push({ x: m.x, y: m.y });
1894
+ const c = [];
1895
+ for (let h = 0; h <= y; h += ao) {
1896
+ const m = d.getPointAtLength(h);
1897
+ c.push({ x: m.x, y: m.y });
1890
1898
  }
1891
- const g = f.getPointAtLength(y);
1892
- return d.push({ x: g.x, y: g.y }), d;
1899
+ const g = d.getPointAtLength(y);
1900
+ return c.push({ x: g.x, y: g.y }), c;
1893
1901
  }
1894
- function N(f, y, d) {
1902
+ function D(d, y, c) {
1895
1903
  if (!o) return null;
1896
- const g = a.value, p = g.bufferMargin, m = {
1897
- x: f.x + p,
1898
- y: f.y + p,
1899
- width: Math.max(0, f.width - p * 2),
1900
- height: Math.max(0, f.height - p * 2)
1904
+ const g = a.value, h = g.bufferMargin, m = {
1905
+ x: d.x + h,
1906
+ y: d.y + h,
1907
+ width: Math.max(0, d.width - h * 2),
1908
+ height: Math.max(0, d.height - h * 2)
1901
1909
  };
1902
1910
  if (m.width <= 0 || m.height <= 0) return null;
1903
- const E = m.x + m.width, $ = m.y + m.height;
1904
- let U = null;
1905
- const D = f.x + f.width / 2, L = f.y + f.height / 2;
1906
- for (const x of o.getEdges()) {
1907
- const T = y.edges[x.id];
1908
- if (!T || d && (T.source.nodeId === d || T.target.nodeId === d) || g.isEdgeDropTarget && !g.isEdgeDropTarget(T, y)) continue;
1909
- const G = o.findViewByCell(x);
1910
- if (!G) continue;
1911
- const j = G.findOne?.("path");
1912
- if (!j || typeof j.getTotalLength != "function") continue;
1913
- const ee = w(j);
1914
- if (!ee.length) continue;
1915
- let ie = !1, Z = 1 / 0;
1916
- for (const J of ee)
1917
- if (J.x >= m.x && J.x <= E && J.y >= m.y && J.y <= $) {
1918
- const Ee = J.x - D, he = J.y - L, ye = Ee * Ee + he * he;
1919
- ye < Z && (Z = ye), ie = !0;
1911
+ const E = m.x + m.width, L = m.y + m.height;
1912
+ let z = null;
1913
+ const ie = d.x + d.width / 2, N = d.y + d.height / 2;
1914
+ for (const _ of o.getEdges()) {
1915
+ const x = y.edges[_.id];
1916
+ if (!x || c && (x.source.nodeId === c || x.target.nodeId === c) || g.isEdgeDropTarget && !g.isEdgeDropTarget(x, y)) continue;
1917
+ const R = o.findViewByCell(_);
1918
+ if (!R) continue;
1919
+ const F = R.findOne?.("path");
1920
+ if (!F || typeof F.getTotalLength != "function") continue;
1921
+ const Z = w(F);
1922
+ if (!Z.length) continue;
1923
+ let ae = !1, Q = 1 / 0;
1924
+ for (const K of Z)
1925
+ if (K.x >= m.x && K.x <= E && K.y >= m.y && K.y <= L) {
1926
+ const me = K.x - ie, pe = K.y - N, we = me * me + pe * pe;
1927
+ we < Q && (Q = we), ae = !0;
1920
1928
  }
1921
- ie && (!U || Z < U.distSq) && (U = { edgeId: x.id, edge: T, distSq: Z });
1929
+ ae && (!z || Q < z.distSq) && (z = { edgeId: _.id, edge: x, distSq: Q });
1922
1930
  }
1923
- return U ? { edgeId: U.edgeId, edge: U.edge } : null;
1931
+ return z ? { edgeId: z.edgeId, edge: z.edge } : null;
1924
1932
  }
1925
- function O(f, y) {
1933
+ function O(d, y) {
1926
1934
  if (!a.value.enabled) return;
1927
- const g = e.flowModel.value, p = N(f, g, y);
1928
- p ? t !== p.edgeId && (h(), t = p.edgeId, u(p.edgeId)) : t && (h(), t = null);
1935
+ const g = e.flowModel.value, h = D(d, g, y);
1936
+ h ? t !== h.edgeId && (p(), t = h.edgeId, f(h.edgeId)) : t && (p(), t = null);
1929
1937
  }
1930
1938
  let b = !0;
1931
- function M({ node: f }) {
1939
+ function S({ node: d }) {
1932
1940
  if (t = null, !a.value.enabled) return;
1933
- const y = e.flowModel.value, d = y.nodes[f.id];
1934
- if (!d) {
1941
+ const y = e.flowModel.value, c = y.nodes[d.id];
1942
+ if (!c) {
1935
1943
  b = !1;
1936
1944
  return;
1937
1945
  }
1938
1946
  const g = a.value;
1939
- b = !g.isNodeInsertable || g.isNodeInsertable(d, y);
1947
+ b = !g.isNodeInsertable || g.isNodeInsertable(c, y);
1940
1948
  }
1941
- function S({ node: f }) {
1949
+ function M({ node: d }) {
1942
1950
  !a.value.enabled || !b || s === null && (s = requestAnimationFrame(() => {
1943
1951
  if (s = null, !o) return;
1944
- const y = f.getPosition(), d = f.getSize();
1945
- O({ x: y.x, y: y.y, width: d.width, height: d.height }, f.id);
1952
+ const y = d.getPosition(), c = d.getSize();
1953
+ O({ x: y.x, y: y.y, width: c.width, height: c.height }, d.id);
1946
1954
  }));
1947
1955
  }
1948
- function H() {
1949
- s !== null && (cancelAnimationFrame(s), s = null), h(), b = !0;
1956
+ function B() {
1957
+ s !== null && (cancelAnimationFrame(s), s = null), p(), b = !0;
1950
1958
  }
1951
- function X() {
1959
+ function j() {
1952
1960
  if (!o) return;
1953
- let f = !1;
1961
+ let d = !1;
1954
1962
  l = () => {
1955
1963
  if (!a.value.enabled) return;
1956
1964
  const y = document.querySelector(".x6-widget-dnd");
1957
1965
  if (!y) {
1958
- f && (f = !1, h(), t = null);
1966
+ d && (d = !1, p(), t = null);
1959
1967
  return;
1960
1968
  }
1961
- f = !0, s === null && (s = requestAnimationFrame(() => {
1969
+ d = !0, s === null && (s = requestAnimationFrame(() => {
1962
1970
  if (s = null, !o) return;
1963
- const d = y.getBoundingClientRect(), g = o.clientToLocal(d.left, d.top), p = o.clientToLocal(d.right, d.bottom), m = {
1971
+ const c = y.getBoundingClientRect(), g = o.clientToLocal(c.left, c.top), h = o.clientToLocal(c.right, c.bottom), m = {
1964
1972
  x: g.x,
1965
1973
  y: g.y,
1966
- width: p.x - g.x,
1967
- height: p.y - g.y
1974
+ width: h.x - g.x,
1975
+ height: h.y - g.y
1968
1976
  };
1969
1977
  O(m);
1970
1978
  }));
@@ -1973,64 +1981,64 @@ function lo(n) {
1973
1981
  });
1974
1982
  }
1975
1983
  function k() {
1976
- h(), t = null, s !== null && (cancelAnimationFrame(s), s = null);
1984
+ p(), t = null, s !== null && (cancelAnimationFrame(s), s = null);
1977
1985
  }
1978
- function K(f) {
1979
- if (!t || f.source !== "user:drag") return f;
1986
+ function X(d) {
1987
+ if (!t || d.source !== "user:drag") return d;
1980
1988
  const y = t;
1981
- t = null, h();
1982
- const d = e.flowModel.value, g = d.edges[y];
1983
- if (!g) return f;
1984
- const p = f.commands.find((G) => G.type === "node.add" || G.type === "node.move");
1985
- if (!p) return f;
1986
- const m = p.type === "node.add" ? p.node.id : p.nodeId, E = p.type === "node.add" ? p.node : d.nodes[p.nodeId];
1987
- if (!E) return f;
1988
- const $ = a.value;
1989
- if ($.isNodeInsertable && !$.isNodeInsertable(E, d))
1990
- return f;
1991
- const U = c(m, E, $.incomingPortGroup), D = c(m, E, $.outgoingPortGroup), L = e.idGenerator("edge"), x = e.idGenerator("edge"), T = [
1989
+ t = null, p();
1990
+ const c = e.flowModel.value, g = c.edges[y];
1991
+ if (!g) return d;
1992
+ const h = d.commands.find((R) => R.type === "node.add" || R.type === "node.move");
1993
+ if (!h) return d;
1994
+ const m = h.type === "node.add" ? h.node.id : h.nodeId, E = h.type === "node.add" ? h.node : c.nodes[h.nodeId];
1995
+ if (!E) return d;
1996
+ const L = a.value;
1997
+ if (L.isNodeInsertable && !L.isNodeInsertable(E, c))
1998
+ return d;
1999
+ const z = u(m, E, L.incomingPortGroup), ie = u(m, E, L.outgoingPortGroup), N = e.idGenerator("edge"), _ = e.idGenerator("edge"), x = [
1992
2000
  { type: "edge.remove", edgeId: y },
1993
2001
  {
1994
2002
  type: "edge.add",
1995
2003
  edge: {
1996
- id: L,
2004
+ id: N,
1997
2005
  type: g.type,
1998
2006
  source: { nodeId: g.source.nodeId, portId: g.source.portId },
1999
- target: { nodeId: m, portId: U }
2007
+ target: { nodeId: m, portId: z }
2000
2008
  }
2001
2009
  },
2002
2010
  {
2003
2011
  type: "edge.add",
2004
2012
  edge: {
2005
- id: x,
2013
+ id: _,
2006
2014
  type: g.type,
2007
- source: { nodeId: m, portId: D },
2015
+ source: { nodeId: m, portId: ie },
2008
2016
  target: { nodeId: g.target.nodeId, portId: g.target.portId }
2009
2017
  }
2010
2018
  }
2011
2019
  ];
2012
2020
  return {
2013
- ...f,
2021
+ ...d,
2014
2022
  source: "user:edge-drop",
2015
- commands: [...f.commands, ...T]
2023
+ commands: [...d.commands, ...x]
2016
2024
  };
2017
2025
  }
2018
- function R(f) {
2019
- o = f;
2020
- const y = (d, g) => {
2021
- f.on(d, g), i.push(() => f.off(d, g));
2026
+ function U(d) {
2027
+ o = d;
2028
+ const y = (c, g) => {
2029
+ d.on(c, g), i.push(() => d.off(c, g));
2022
2030
  };
2023
- y("node:move", M), y("node:change:position", S), y("node:moved", H), X();
2031
+ y("node:move", S), y("node:change:position", M), y("node:moved", B), j();
2024
2032
  }
2025
- function B() {
2033
+ function G() {
2026
2034
  k();
2027
- for (const f of i) f();
2035
+ for (const d of i) d();
2028
2036
  i.length = 0, o = null, b = !0;
2029
2037
  }
2030
2038
  return {
2031
- attachRuntime: R,
2032
- tryExpandForEdgeDrop: K,
2033
- cleanup: B
2039
+ attachRuntime: U,
2040
+ tryExpandForEdgeDrop: X,
2041
+ cleanup: G
2034
2042
  };
2035
2043
  }
2036
2044
  function co(n) {
@@ -2049,7 +2057,7 @@ function co(n) {
2049
2057
  switch (s) {
2050
2058
  case "delete":
2051
2059
  return n.executeCommand({
2052
- id: Q(),
2060
+ id: J(),
2053
2061
  source: "user:toolbar",
2054
2062
  label: "删除节点",
2055
2063
  timestamp: Date.now(),
@@ -2059,9 +2067,9 @@ function co(n) {
2059
2067
  if (!l) break;
2060
2068
  const a = n.flowModel.value.nodes[r];
2061
2069
  if (!a) break;
2062
- const v = e(a), u = 50;
2070
+ const v = e(a), f = 50;
2063
2071
  n.executeCommand({
2064
- id: Q(),
2072
+ id: J(),
2065
2073
  source: "user:toolbar",
2066
2074
  label: "复制节点",
2067
2075
  timestamp: Date.now(),
@@ -2071,8 +2079,8 @@ function co(n) {
2071
2079
  node: {
2072
2080
  ...v,
2073
2081
  position: {
2074
- x: a.position.x + u,
2075
- y: a.position.y + u
2082
+ x: a.position.x + f,
2083
+ y: a.position.y + f
2076
2084
  }
2077
2085
  }
2078
2086
  }
@@ -2093,17 +2101,17 @@ function co(n) {
2093
2101
  break;
2094
2102
  }
2095
2103
  case "disconnect": {
2096
- const a = n.flowModel.value, v = Object.entries(a.edges).filter(([, u]) => {
2097
- const h = u;
2098
- return h.source.nodeId === r || h.target.nodeId === r;
2099
- }).map(([u]) => u);
2104
+ const a = n.flowModel.value, v = Object.entries(a.edges).filter(([, f]) => {
2105
+ const p = f;
2106
+ return p.source.nodeId === r || p.target.nodeId === r;
2107
+ }).map(([f]) => f);
2100
2108
  if (v.length === 0) break;
2101
2109
  n.executeCommand({
2102
- id: Q(),
2110
+ id: J(),
2103
2111
  source: "user:toolbar",
2104
2112
  label: "断开连线",
2105
2113
  timestamp: Date.now(),
2106
- commands: v.map((u) => ({ type: "edge.remove", edgeId: u }))
2114
+ commands: v.map((f) => ({ type: "edge.remove", edgeId: f }))
2107
2115
  }), n._emitUiEvent({ type: "node.action.disconnect", nodeId: r, edgeIds: v });
2108
2116
  break;
2109
2117
  }
@@ -2165,13 +2173,13 @@ function fo(n, e) {
2165
2173
  }
2166
2174
  }, n.createEdge(s);
2167
2175
  }
2168
- const go = ".x6-widget-selection", ho = ".x6-graph-svg";
2169
- function po(n) {
2170
- const e = n.querySelector(go), o = n.querySelector(ho);
2176
+ const go = ".x6-widget-selection", po = ".x6-graph-svg";
2177
+ function ho(n) {
2178
+ const e = n.querySelector(go), o = n.querySelector(po);
2171
2179
  return !e || !o || e.parentNode !== o.parentNode || !o.parentNode || o.previousSibling === e ? !1 : (o.parentNode.insertBefore(e, o), !0);
2172
2180
  }
2173
2181
  function vo(n) {
2174
- const e = () => po(n);
2182
+ const e = () => ho(n);
2175
2183
  e();
2176
2184
  const o = new MutationObserver(() => {
2177
2185
  e();
@@ -2199,11 +2207,11 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2199
2207
  emits: ["action"],
2200
2208
  setup(n, { emit: e }) {
2201
2209
  const o = n, t = V(() => {
2202
- const h = o.actionsOffset?.x ?? 0, c = o.actionsOffset?.y ?? 0, w = h !== 0 || c !== 0;
2210
+ const p = o.actionsOffset?.x ?? 0, u = o.actionsOffset?.y ?? 0, w = p !== 0 || u !== 0;
2203
2211
  return {
2204
2212
  left: `${o.position.x}px`,
2205
2213
  top: `${o.position.y}px`,
2206
- transform: w ? `translate(${h}px, ${c}px)` : "translateX(-100%)"
2214
+ transform: w ? `translate(${p}px, ${u}px)` : "translateX(-100%)"
2207
2215
  };
2208
2216
  }), s = e, r = V(() => ({
2209
2217
  debug: {
@@ -2226,71 +2234,71 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2226
2234
  visible: o.config.showDisconnect && o.behavior.disconnectable !== !1,
2227
2235
  disabled: o.behavior.disconnectDisabled === !0
2228
2236
  }
2229
- })), i = V(() => r.value.copy.visible || r.value.copyInsert.visible || r.value.disconnect.visible), l = z(!1);
2237
+ })), i = V(() => r.value.copy.visible || r.value.copyInsert.visible || r.value.disconnect.visible), l = H(!1);
2230
2238
  let a = null;
2231
2239
  function v() {
2232
2240
  a && (clearTimeout(a), a = null), l.value = !0;
2233
2241
  }
2234
- function u() {
2242
+ function f() {
2235
2243
  a = setTimeout(() => {
2236
2244
  l.value = !1, a = null;
2237
2245
  }, 100);
2238
2246
  }
2239
2247
  return Te(() => {
2240
2248
  a && clearTimeout(a);
2241
- }), (h, c) => (A(), P("div", {
2249
+ }), (p, u) => (A(), T("div", {
2242
2250
  class: "flow-canvas-node-actions",
2243
- style: be(t.value)
2251
+ style: Ee(t.value)
2244
2252
  }, [
2245
2253
  q("div", yo, [
2246
- r.value.debug.visible ? (A(), P("i", {
2254
+ r.value.debug.visible ? (A(), T("i", {
2247
2255
  key: 0,
2248
- class: oe(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": r.value.debug.disabled }]),
2249
- onClick: c[0] || (c[0] = (w) => !r.value.debug.disabled && s("action", "debug", n.node.id))
2256
+ class: te(["flow-canvas-icon canvas-debug flow-canvas-node-actions__icon", { "is-disabled": r.value.debug.disabled }]),
2257
+ onClick: u[0] || (u[0] = (w) => !r.value.debug.disabled && s("action", "debug", n.node.id))
2250
2258
  }, null, 2)) : Y("", !0),
2251
- r.value.delete.visible ? (A(), P("i", {
2259
+ r.value.delete.visible ? (A(), T("i", {
2252
2260
  key: 1,
2253
- class: oe(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": r.value.delete.disabled }]),
2254
- onClick: c[1] || (c[1] = (w) => !r.value.delete.disabled && s("action", "delete", n.node.id))
2261
+ class: te(["flow-canvas-icon canvas-shanchu flow-canvas-node-actions__icon", { "is-disabled": r.value.delete.disabled }]),
2262
+ onClick: u[1] || (u[1] = (w) => !r.value.delete.disabled && s("action", "delete", n.node.id))
2255
2263
  }, null, 2)) : Y("", !0),
2256
- i.value ? (A(), P("div", {
2264
+ i.value ? (A(), T("div", {
2257
2265
  key: 2,
2258
2266
  class: "flow-canvas-node-actions__more-wrapper",
2259
2267
  onMouseenter: v,
2260
- onMouseleave: u
2261
- }, [...c[5] || (c[5] = [
2268
+ onMouseleave: f
2269
+ }, [...u[5] || (u[5] = [
2262
2270
  q("i", { class: "flow-canvas-icon canvas-gengduo flow-canvas-node-actions__icon" }, null, -1)
2263
2271
  ])], 32)) : Y("", !0)
2264
2272
  ]),
2265
- it(at, { name: "flow-canvas-fade" }, {
2273
+ at(lt, { name: "flow-canvas-fade" }, {
2266
2274
  default: He(() => [
2267
- l.value && i.value ? (A(), P("div", {
2275
+ l.value && i.value ? (A(), T("div", {
2268
2276
  key: 0,
2269
2277
  class: "flow-canvas-node-actions__dropdown",
2270
2278
  onMouseenter: v,
2271
- onMouseleave: u
2279
+ onMouseleave: f
2272
2280
  }, [
2273
- r.value.copy.visible ? (A(), P("div", {
2281
+ r.value.copy.visible ? (A(), T("div", {
2274
2282
  key: 0,
2275
- class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copy.disabled }]),
2276
- onClick: c[2] || (c[2] = (w) => !r.value.copy.disabled && s("action", "copy", n.node.id))
2277
- }, [...c[6] || (c[6] = [
2283
+ class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copy.disabled }]),
2284
+ onClick: u[2] || (u[2] = (w) => !r.value.copy.disabled && s("action", "copy", n.node.id))
2285
+ }, [...u[6] || (u[6] = [
2278
2286
  q("i", { class: "flow-canvas-icon canvas-copy-fuzhi-2" }, null, -1),
2279
2287
  q("span", null, "复制", -1)
2280
2288
  ])], 2)) : Y("", !0),
2281
- r.value.copyInsert.visible ? (A(), P("div", {
2289
+ r.value.copyInsert.visible ? (A(), T("div", {
2282
2290
  key: 1,
2283
- class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copyInsert.disabled }]),
2284
- onClick: c[3] || (c[3] = (w) => !r.value.copyInsert.disabled && s("action", "copy-insert", n.node.id))
2285
- }, [...c[7] || (c[7] = [
2291
+ class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.copyInsert.disabled }]),
2292
+ onClick: u[3] || (u[3] = (w) => !r.value.copyInsert.disabled && s("action", "copy-insert", n.node.id))
2293
+ }, [...u[7] || (u[7] = [
2286
2294
  q("i", { class: "flow-canvas-icon canvas-fuzhibingcharu" }, null, -1),
2287
2295
  q("span", null, "复制并插入", -1)
2288
2296
  ])], 2)) : Y("", !0),
2289
- r.value.disconnect.visible ? (A(), P("div", {
2297
+ r.value.disconnect.visible ? (A(), T("div", {
2290
2298
  key: 2,
2291
- class: oe(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.disconnect.disabled }]),
2292
- onClick: c[4] || (c[4] = (w) => !r.value.disconnect.disabled && s("action", "disconnect", n.node.id))
2293
- }, [...c[8] || (c[8] = [
2299
+ class: te(["flow-canvas-node-actions__dropdown-item", { "is-disabled": r.value.disconnect.disabled }]),
2300
+ onClick: u[4] || (u[4] = (w) => !r.value.disconnect.disabled && s("action", "disconnect", n.node.id))
2301
+ }, [...u[8] || (u[8] = [
2294
2302
  q("i", { class: "flow-canvas-icon canvas-unlock-jiebang" }, null, -1),
2295
2303
  q("span", null, "断开连线", -1)
2296
2304
  ])], 2)) : Y("", !0)
@@ -2312,94 +2320,107 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2312
2320
  __name: "node-quick-add-popover",
2313
2321
  props: {
2314
2322
  node: {},
2315
- portPosition: {}
2323
+ portPosition: {},
2324
+ autoPanOnOpen: { type: Boolean },
2325
+ autoPanPadding: {}
2316
2326
  },
2317
- emits: ["open", "close", "start-drag", "mouseenter", "mouseleave"],
2327
+ emits: ["open", "close", "start-drag", "viewport-overflow-right", "mouseenter", "mouseleave"],
2318
2328
  setup(n, { expose: e, emit: o }) {
2319
- const t = n, s = o, r = z(), i = z(), l = z(!1), a = z(!1);
2320
- let v = null, u = !1, h = null;
2321
- function c(R) {
2322
- R.preventDefault(), R.stopPropagation(), v = { x: R.clientX, y: R.clientY }, u = !1, document.addEventListener("mousemove", w), document.addEventListener("mouseup", N);
2329
+ const t = n, s = o, r = H(), i = H(), l = H(!1), a = H(!1);
2330
+ let v = null, f = !1, p = null;
2331
+ function u(G) {
2332
+ G.preventDefault(), G.stopPropagation(), v = { x: G.clientX, y: G.clientY }, f = !1, document.addEventListener("mousemove", w), document.addEventListener("mouseup", D);
2323
2333
  }
2324
- function w(R) {
2334
+ function w(G) {
2325
2335
  if (!v) return;
2326
- const B = R.clientX - v.x, f = R.clientY - v.y;
2327
- Math.sqrt(B * B + f * f) >= xo && (u = !0, O(), s("start-drag", t.node.id));
2336
+ const d = G.clientX - v.x, y = G.clientY - v.y;
2337
+ Math.sqrt(d * d + y * y) >= xo && (f = !0, O(), s("start-drag", t.node.id));
2328
2338
  }
2329
- function N() {
2330
- O(), u || b(), v = null, u = !1;
2339
+ function D() {
2340
+ O(), f || b(), v = null, f = !1;
2331
2341
  }
2332
2342
  function O() {
2333
- document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", N);
2343
+ document.removeEventListener("mousemove", w), document.removeEventListener("mouseup", D);
2334
2344
  }
2335
2345
  function b() {
2336
- a.value ? S() : M();
2346
+ a.value ? B() : S();
2337
2347
  }
2338
- function M() {
2339
- a.value = !0, s("open", t.node.id), requestAnimationFrame(() => {
2340
- document.addEventListener("mousedown", H);
2348
+ function S() {
2349
+ a.value = !0, s("open", t.node.id), Ge(() => {
2350
+ requestAnimationFrame(() => {
2351
+ M();
2352
+ });
2353
+ }), requestAnimationFrame(() => {
2354
+ document.addEventListener("mousedown", j);
2341
2355
  });
2342
2356
  }
2343
- function S() {
2344
- a.value = !1, s("close"), document.removeEventListener("mousedown", H);
2357
+ function M() {
2358
+ if (!a.value || !t.autoPanOnOpen || !i.value) return;
2359
+ const G = window.innerWidth || document.documentElement.clientWidth || 0;
2360
+ if (G <= 0) return;
2361
+ const d = t.autoPanPadding ?? 16, c = i.value.getBoundingClientRect().right + d - G;
2362
+ c > 0 && s("viewport-overflow-right", c);
2345
2363
  }
2346
- function H(R) {
2347
- const B = R.target;
2348
- r.value?.contains(B) || i.value?.contains(B) || S();
2364
+ function B() {
2365
+ a.value = !1, s("close"), document.removeEventListener("mousedown", j);
2349
2366
  }
2350
- function X() {
2351
- a.value || s("mouseleave");
2367
+ function j(G) {
2368
+ const d = G.target;
2369
+ r.value?.contains(d) || i.value?.contains(d) || B();
2352
2370
  }
2353
2371
  function k() {
2354
- h && (clearTimeout(h), h = null), s("mouseenter");
2372
+ a.value || s("mouseleave");
2373
+ }
2374
+ function X() {
2375
+ p && (clearTimeout(p), p = null), s("mouseenter");
2355
2376
  }
2356
- function K() {
2357
- h = setTimeout(() => {
2358
- S(), s("mouseleave"), h = null;
2377
+ function U() {
2378
+ p = setTimeout(() => {
2379
+ B(), s("mouseleave"), p = null;
2359
2380
  }, 150);
2360
2381
  }
2361
2382
  return Te(() => {
2362
- O(), h && clearTimeout(h), document.removeEventListener("mousedown", H);
2363
- }), e({ closePopover: S }), (R, B) => (A(), P("div", {
2383
+ O(), p && clearTimeout(p), document.removeEventListener("mousedown", j);
2384
+ }), e({ closePopover: B }), (G, d) => (A(), T("div", {
2364
2385
  class: "flow-canvas-quick-add",
2365
- style: be({ left: `${n.portPosition.x}px`, top: `${n.portPosition.y}px` }),
2366
- onMouseenter: B[2] || (B[2] = (f) => s("mouseenter")),
2367
- onMouseleave: X,
2368
- onClick: B[3] || (B[3] = pt(() => {
2386
+ style: Ee({ left: `${n.portPosition.x}px`, top: `${n.portPosition.y}px` }),
2387
+ onMouseenter: d[2] || (d[2] = (y) => s("mouseenter")),
2388
+ onMouseleave: k,
2389
+ onClick: d[3] || (d[3] = ht(() => {
2369
2390
  }, ["stop"]))
2370
2391
  }, [
2371
2392
  q("div", {
2372
2393
  ref_key: "btnRef",
2373
2394
  ref: r,
2374
- class: oe(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2375
- onMouseenter: B[0] || (B[0] = (f) => l.value = !0),
2376
- onMouseleave: B[1] || (B[1] = (f) => l.value = !1),
2377
- onMousedown: c
2378
- }, [...B[4] || (B[4] = [
2395
+ class: te(["flow-canvas-quick-add__btn", { "is-hovered": l.value, "is-active": a.value }]),
2396
+ onMouseenter: d[0] || (d[0] = (y) => l.value = !0),
2397
+ onMouseleave: d[1] || (d[1] = (y) => l.value = !1),
2398
+ onMousedown: u
2399
+ }, [...d[4] || (d[4] = [
2379
2400
  q("i", { class: "flow-canvas-icon canvas-zoom-add" }, null, -1)
2380
2401
  ])], 34),
2381
- l.value && !a.value ? (A(), P("div", Eo, [...B[5] || (B[5] = [
2402
+ l.value && !a.value ? (A(), T("div", Eo, [...d[5] || (d[5] = [
2382
2403
  q("div", null, [
2383
2404
  q("b", null, "点击"),
2384
- Ue(" 添加节点")
2405
+ je(" 添加节点")
2385
2406
  ], -1),
2386
2407
  q("div", null, [
2387
2408
  q("b", null, "拖拽"),
2388
- Ue(" 连接节点")
2409
+ je(" 连接节点")
2389
2410
  ], -1)
2390
2411
  ])])) : Y("", !0),
2391
- it(at, { name: "flow-canvas-fade" }, {
2412
+ at(lt, { name: "flow-canvas-fade" }, {
2392
2413
  default: He(() => [
2393
- a.value ? (A(), P("div", {
2414
+ a.value ? (A(), T("div", {
2394
2415
  key: 0,
2395
2416
  ref_key: "popoverRef",
2396
2417
  ref: i,
2397
2418
  class: "flow-canvas-quick-add__popover",
2398
- onMouseenter: k,
2399
- onMouseleave: K
2419
+ onMouseenter: X,
2420
+ onMouseleave: U
2400
2421
  }, [
2401
- Me(R.$slots, "default", {}, () => [
2402
- B[6] || (B[6] = q("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2422
+ Me(G.$slots, "default", {}, () => [
2423
+ d[6] || (d[6] = q("div", { class: "flow-canvas-quick-add__default-content" }, "节点快捷操作面板", -1))
2403
2424
  ], !0)
2404
2425
  ], 544)) : Y("", !0)
2405
2426
  ]),
@@ -2407,7 +2428,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2407
2428
  })
2408
2429
  ], 36));
2409
2430
  }
2410
- }), Co = /* @__PURE__ */ ve(Io, [["__scopeId", "data-v-336cc3b4"]]), ko = { class: "flow-canvas-selection-actions__bar" }, So = /* @__PURE__ */ fe({
2431
+ }), Co = /* @__PURE__ */ ve(Io, [["__scopeId", "data-v-255b3d8c"]]), ko = { class: "flow-canvas-selection-actions__bar" }, So = /* @__PURE__ */ fe({
2411
2432
  __name: "selection-actions-toolbar",
2412
2433
  props: {
2413
2434
  position: {},
@@ -2420,13 +2441,13 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2420
2441
  top: `${o.position.y}px`,
2421
2442
  transform: "translateX(-100%)"
2422
2443
  }));
2423
- return (r, i) => (A(), P("div", {
2444
+ return (r, i) => (A(), T("div", {
2424
2445
  class: "flow-canvas-selection-actions",
2425
- style: be(s.value)
2446
+ style: Ee(s.value)
2426
2447
  }, [
2427
2448
  q("div", ko, [
2428
2449
  q("i", {
2429
- class: oe(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !n.canDelete }]),
2450
+ class: te(["flow-canvas-icon canvas-shanchu flow-canvas-selection-actions__icon", { "is-disabled": !n.canDelete }]),
2430
2451
  onClick: i[0] || (i[0] = (l) => n.canDelete && t("action", "delete"))
2431
2452
  }, null, 2)
2432
2453
  ])
@@ -2445,10 +2466,10 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2445
2466
  },
2446
2467
  emits: ["ui-event"],
2447
2468
  setup(n, { expose: e, emit: o }) {
2448
- const t = n, s = o, r = z(), i = z();
2449
- let l, a, v, u, h = null, c = null, w = null, N = null, O = null;
2450
- const b = oo(), { hoveredNodeId: M, isDraggingNode: S } = b, H = b.enterOverlay, X = () => b.leaveOverlay(), k = z(0), K = z({ nodeIds: [], edgeIds: [] });
2451
- function R(I) {
2469
+ const t = n, s = o, r = H(), i = H();
2470
+ let l, a, v, f, p = null, u = null, w = null, D = null, O = null;
2471
+ const b = oo(), { hoveredNodeId: S, isDraggingNode: M } = b, B = b.enterOverlay, j = () => b.leaveOverlay(), k = H(0), X = H({ nodeIds: [], edgeIds: [] });
2472
+ function U(I) {
2452
2473
  const C = t.editor.api.value;
2453
2474
  return C ? t.editor.schema.nodeTypes[I.type]?.getBehavior?.(I, {
2454
2475
  api: C,
@@ -2457,7 +2478,7 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2457
2478
  mode: t.editor.mode.value
2458
2479
  }) ?? {} : {};
2459
2480
  }
2460
- const B = V(() => t.editor.mode.value === "edit" && t.editor.selectionMode.value), f = V(() => ({
2481
+ const G = V(() => t.editor.mode.value === "edit" && t.editor.selectionMode.value), d = V(() => ({
2461
2482
  showDebug: !1,
2462
2483
  showDelete: !0,
2463
2484
  showCopy: !0,
@@ -2468,71 +2489,71 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2468
2489
  })), y = V(
2469
2490
  () => {
2470
2491
  if (k.value, !t.editor.api.value) return [];
2471
- const I = t.editor.flowModel.value, C = t.editor.api.value.overlay, _ = [];
2472
- for (const [W, te] of Object.entries(I.nodes)) {
2473
- const ae = t.editor._pluginManager.collectNodeDecorations(te);
2474
- if (!ae?.badge) continue;
2475
- const ne = C.getNodeScreenRect(W);
2476
- ne && _.push({
2492
+ const I = t.editor.flowModel.value, C = t.editor.api.value.overlay, P = [];
2493
+ for (const [W, ee] of Object.entries(I.nodes)) {
2494
+ const le = t.editor._pluginManager.collectNodeDecorations(ee);
2495
+ if (!le?.badge) continue;
2496
+ const oe = C.getNodeScreenRect(W);
2497
+ oe && P.push({
2477
2498
  nodeId: W,
2478
- x: ne.x + ne.width - 4,
2479
- y: ne.y - 8,
2480
- badge: ae.badge
2499
+ x: oe.x + oe.width - 4,
2500
+ y: oe.y - 8,
2501
+ badge: le.badge
2481
2502
  });
2482
2503
  }
2483
- return _;
2504
+ return P;
2484
2505
  }
2485
- ), d = V(() => {
2506
+ ), c = V(() => {
2486
2507
  k.value;
2487
- const I = M.value;
2488
- if (!I || S.value || !t.editor.api.value || t.editor.mode.value !== "edit" || B.value)
2508
+ const I = S.value;
2509
+ if (!I || M.value || !t.editor.api.value || t.editor.mode.value !== "edit" || G.value)
2489
2510
  return null;
2490
- const _ = t.editor.flowModel.value.nodes[I];
2491
- if (!_) return null;
2511
+ const P = t.editor.flowModel.value.nodes[I];
2512
+ if (!P) return null;
2492
2513
  const W = t.editor.api.value.overlay.getNodeScreenRect(I);
2493
2514
  if (!W) return null;
2494
- const te = R(_);
2495
- return te.showActions === !1 ? null : {
2496
- node: _,
2515
+ const ee = U(P);
2516
+ return ee.showActions === !1 ? null : {
2517
+ node: P,
2497
2518
  position: { x: W.x + W.width, y: W.y + W.height + 4 },
2498
- behavior: te
2519
+ behavior: ee
2499
2520
  };
2500
2521
  }), g = V(() => {
2501
2522
  if (k.value, !t.editor.api.value || t.editor.mode.value !== "edit") return null;
2502
- const I = K.value;
2523
+ const I = X.value;
2503
2524
  if (I.nodeIds.length + I.edgeIds.length === 0) return null;
2504
2525
  const C = t.editor.api.value.getSelectionBounds(I);
2505
2526
  if (!C) return null;
2506
- const _ = gt(I, t.editor.flowModel.value, R);
2527
+ const P = gt(I, t.editor.flowModel.value, U);
2507
2528
  return {
2508
2529
  position: { x: C.x + C.width, y: C.y + C.height + 4 },
2509
- canDelete: _.nodeIds.length > 0 || _.edgeIds.length > 0
2530
+ canDelete: P.nodeIds.length > 0 || P.edgeIds.length > 0
2510
2531
  };
2511
- }), p = z(), m = ro({
2532
+ }), h = H(), m = ro({
2512
2533
  editor: t.editor,
2513
2534
  quickAddProp: V(() => t.quickAdd),
2514
- isDraggingNode: S,
2535
+ isDraggingNode: M,
2515
2536
  nodeHover: b,
2516
- isSelectionModeActive: B,
2537
+ isSelectionModeActive: G,
2517
2538
  viewportVersion: k,
2518
- getNodeBehavior: R,
2519
- getInsertGap: () => f.value.insertGap,
2520
- closePopover: () => p.value?.closePopover()
2521
- }), E = m.data, $ = m.handleOpen, U = m.handleStartDrag;
2522
- function D() {
2539
+ getNodeBehavior: U,
2540
+ getInsertGap: () => d.value.insertGap,
2541
+ closePopover: () => h.value?.closePopover()
2542
+ }), E = m.data, L = m.handleOpen, z = m.handleStartDrag;
2543
+ function ie() {
2523
2544
  m.handleClose(), b.leaveOverlay(200), m.leave();
2524
2545
  }
2525
- const L = m.handleOverlayEnter, x = m.handleOverlayLeave, T = m.handleInsert, G = lo({
2546
+ const N = m.handleOverlayEnter, _ = m.handleOverlayLeave, x = m.handleInsert, R = lo({
2526
2547
  editor: t.editor,
2527
2548
  edgeDropProp: V(() => t.edgeDrop)
2528
- }), j = co(t.editor);
2529
- function ee(I, C) {
2530
- j.handleNodeAction(I, C, f.value.insertGap) && (M.value = null);
2549
+ }), F = co(t.editor);
2550
+ function Z(I, C) {
2551
+ F.handleNodeAction(I, C, d.value.insertGap) && (S.value = null);
2531
2552
  }
2532
- function ie(I) {
2533
- I === "delete" && j.deleteSelection(K.value);
2553
+ function ae(I) {
2554
+ I === "delete" && F.deleteSelection(X.value);
2534
2555
  }
2535
- function Z(I) {
2556
+ function Q(I) {
2536
2557
  if (t.editor.mode.value !== "edit") return;
2537
2558
  if ((I.metaKey || I.ctrlKey) && (I.key === "z" || I.key === "Z")) {
2538
2559
  if (I.shiftKey) {
@@ -2547,84 +2568,84 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2547
2568
  }
2548
2569
  t.editor._pluginManager.dispatchKeyboardShortcut(I) && (I.preventDefault(), I.stopPropagation());
2549
2570
  }
2550
- function J(I, C) {
2551
- const _ = l, W = (te) => {
2552
- const ae = _.isRubberbandEnabled?.() ?? !1;
2553
- ae && _.disableRubberband?.(), te ? l.enablePanning() : l.disablePanning(), ae && _.enableRubberband?.();
2571
+ function K(I, C) {
2572
+ const P = l, W = (ee) => {
2573
+ const le = P.isRubberbandEnabled?.() ?? !1;
2574
+ le && P.disableRubberband?.(), ee ? l.enablePanning() : l.disablePanning(), le && P.enableRubberband?.();
2554
2575
  };
2555
- I && C ? (_.enableSelection?.(), b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1, h?.remove(), W(!1), _.enableRubberband?.()) : (_.disableRubberband?.(), W(!0), _.disableSelection?.(), _.cleanSelection?.());
2576
+ 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?.());
2556
2577
  }
2557
- function Ee(I) {
2578
+ function me(I) {
2558
2579
  l.on("node:move", ({ node: C }) => {
2559
- S.value = !0;
2560
- const _ = t.editor.flowModel.value.nodes[C.id];
2561
- _ && R(_).bringToFrontOnDrag === !1 || C.toFront?.();
2580
+ M.value = !0;
2581
+ const P = t.editor.flowModel.value.nodes[C.id];
2582
+ P && U(P).bringToFrontOnDrag === !1 || C.toFront?.();
2562
2583
  }), l.on("node:moved", () => {
2563
- S.value = !1;
2584
+ M.value = !1;
2564
2585
  }), l.on("node:mouseenter", ({ node: C }) => {
2565
- if (B.value) {
2566
- M.value = null, m.quickAddNodeId.value = null, I.hideNodePorts(C);
2586
+ if (G.value) {
2587
+ S.value = null, m.quickAddNodeId.value = null, I.hideNodePorts(C);
2567
2588
  return;
2568
2589
  }
2569
2590
  b.enter(C.id);
2570
- const _ = t.editor.flowModel.value.nodes[C.id];
2571
- if (_ && R(_).showPorts === !1) {
2591
+ const P = t.editor.flowModel.value.nodes[C.id];
2592
+ if (P && U(P).showPorts === !1) {
2572
2593
  m.mergedConfig.value.enabled && m.enter(C.id);
2573
2594
  return;
2574
2595
  }
2575
2596
  m.mergedConfig.value.enabled && m.enter(C.id) || I.showNodePorts(C);
2576
2597
  }), l.on("node:mouseleave", ({ node: C }) => {
2577
- if (B.value) {
2598
+ if (G.value) {
2578
2599
  I.hideNodePorts(C);
2579
2600
  return;
2580
2601
  }
2581
- const _ = t.editor.flowModel.value.nodes[C.id];
2602
+ const P = t.editor.flowModel.value.nodes[C.id];
2582
2603
  let W = 100;
2583
- _ && R(_).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);
2604
+ 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);
2584
2605
  });
2585
2606
  }
2586
- function he(I) {
2607
+ function pe(I) {
2587
2608
  l.on("edge:added", ({ edge: C }) => {
2588
- let _;
2609
+ let P;
2589
2610
  if (t.getConnectionExcludedNodeIds && !C.getTargetCell()) {
2590
2611
  const W = C.getSourceCell();
2591
2612
  if (W) {
2592
- const te = t.getConnectionExcludedNodeIds(W.id);
2593
- _ = te instanceof Set ? te : new Set(te);
2613
+ const ee = t.getConnectionExcludedNodeIds(W.id);
2614
+ P = ee instanceof Set ? ee : new Set(ee);
2594
2615
  }
2595
2616
  }
2596
- I.handleEdgeAdded(C, _);
2617
+ I.handleEdgeAdded(C, P);
2597
2618
  }), l.on("edge:connected", () => {
2598
2619
  I.handleEdgeConnected();
2599
2620
  }), l.on("edge:removed", ({ edge: C }) => {
2600
- I.handleEdgeRemoved(C.id), h.handleEdgeRemoved(C.id);
2601
- }), l.on("edge:mouseenter", ({ edge: C, e: _ }) => {
2621
+ I.handleEdgeRemoved(C.id), p.handleEdgeRemoved(C.id);
2622
+ }), l.on("edge:mouseenter", ({ edge: C, e: P }) => {
2602
2623
  const W = a.getHoveredEdgeId();
2603
- a.setHoveredEdge(C.id), W && W !== C.id && a.refreshSingleEdgeStyle(W), a.refreshSingleEdgeStyle(C.id), t.editor.mode.value === "edit" && !B.value && I.canShowEdgeTool() && h.show(C.id, _);
2624
+ a.setHoveredEdge(C.id), W && W !== C.id && a.refreshSingleEdgeStyle(W), a.refreshSingleEdgeStyle(C.id), t.editor.mode.value === "edit" && !G.value && I.canShowEdgeTool() && p.show(C.id, P);
2604
2625
  }), l.on("edge:mouseleave", ({ edge: C }) => {
2605
- a.setHoveredEdge(null), a.refreshSingleEdgeStyle(C.id), h.remove();
2606
- }), l.on("edge:click", ({ edge: C, e: _ }) => {
2607
- _.target?.closest?.(".flow-canvas-edge-delete-tool") && t.editor.mode.value === "edit" && (h.remove(), t.editor.executeCommand({
2608
- id: Q(),
2626
+ a.setHoveredEdge(null), a.refreshSingleEdgeStyle(C.id), p.remove();
2627
+ }), l.on("edge:click", ({ edge: C, e: P }) => {
2628
+ P.target?.closest?.(".flow-canvas-edge-delete-tool") && t.editor.mode.value === "edit" && (p.remove(), t.editor.executeCommand({
2629
+ id: J(),
2609
2630
  source: "user:toolbar",
2610
2631
  label: "删除连线",
2611
2632
  timestamp: Date.now(),
2612
2633
  commands: [{ type: "edge.remove", edgeId: C.id }]
2613
2634
  }));
2614
- }), c = (C) => h.move(C), l.container.addEventListener("mousemove", c);
2635
+ }), u = (C) => p.move(C), l.container.addEventListener("mousemove", u);
2615
2636
  }
2616
- function ye() {
2637
+ function we() {
2617
2638
  w = (I) => {
2618
- if (!M.value && !m.quickAddNodeId.value) return;
2639
+ if (!S.value && !m.quickAddNodeId.value) return;
2619
2640
  const C = I.target;
2620
2641
  if (C?.closest?.(".x6-node") || C?.closest?.(".flow-canvas-node-actions") || C?.closest?.(".flow-canvas-quick-add")) {
2621
2642
  b.cancelLeave(), m.cancelLeave();
2622
2643
  return;
2623
2644
  }
2624
2645
  b.leave(180), m.quickAddPopoverOpen.value || m.leave();
2625
- }, r.value?.addEventListener("mousemove", w), N = () => {
2646
+ }, r.value?.addEventListener("mousemove", w), D = () => {
2626
2647
  b.reset(), m.quickAddPopoverOpen.value || (m.quickAddNodeId.value = null);
2627
- }, r.value?.addEventListener("mouseleave", N), r.value?.addEventListener("keydown", Z);
2648
+ }, r.value?.addEventListener("mouseleave", D), r.value?.addEventListener("keydown", Q);
2628
2649
  }
2629
2650
  function $e() {
2630
2651
  ge(
@@ -2633,21 +2654,21 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2633
2654
  ), ge(
2634
2655
  [() => t.editor.mode.value, () => t.editor.selectionMode.value],
2635
2656
  ([I, C]) => {
2636
- J(I === "edit", C);
2657
+ K(I === "edit", C);
2637
2658
  },
2638
2659
  { immediate: !0 }
2639
2660
  );
2640
2661
  }
2641
- lt(() => {
2662
+ dt(() => {
2642
2663
  if (!i.value) return;
2643
2664
  const I = /* @__PURE__ */ new Set(["model", "container"]), C = {};
2644
2665
  if (t.graphOptions)
2645
- for (const [F, se] of Object.entries(t.graphOptions)) {
2646
- if (I.has(F)) {
2647
- console.warn(`[flow-canvas] graphOptions.${F} is managed by the engine and will be ignored`);
2666
+ for (const [$, ne] of Object.entries(t.graphOptions)) {
2667
+ if (I.has($)) {
2668
+ console.warn(`[flow-canvas] graphOptions.${$} is managed by the engine and will be ignored`);
2648
2669
  continue;
2649
2670
  }
2650
- C[F] = se;
2671
+ C[$] = ne;
2651
2672
  }
2652
2673
  l = new Et({
2653
2674
  container: i.value,
@@ -2668,8 +2689,8 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2668
2689
  panning: { enabled: !0 },
2669
2690
  mousewheel: { enabled: !0, modifiers: ["ctrl", "meta"] },
2670
2691
  interacting: {
2671
- nodeMovable(F) {
2672
- return F.cell.getProp("draggable") !== !1;
2692
+ nodeMovable($) {
2693
+ return $.cell.getProp("draggable") !== !1;
2673
2694
  }
2674
2695
  },
2675
2696
  connecting: {
@@ -2691,8 +2712,8 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2691
2712
  l,
2692
2713
  t.editor.schema,
2693
2714
  v,
2694
- (F) => t.editor._pluginManager.collectNodeDecorations(F),
2695
- (F) => t.editor._pluginManager.collectEdgeDecorations(F),
2715
+ ($) => t.editor._pluginManager.collectNodeDecorations($),
2716
+ ($) => t.editor._pluginManager.collectEdgeDecorations($),
2696
2717
  () => t.editor.api.value ? {
2697
2718
  api: t.editor.api.value,
2698
2719
  flowModel: t.editor.flowModel.value,
@@ -2700,35 +2721,35 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2700
2721
  mode: t.editor.mode.value
2701
2722
  } : null
2702
2723
  );
2703
- const _ = Kt(l), W = to({
2724
+ const P = Kt(l), W = to({
2704
2725
  graph: l,
2705
- overlayManager: _,
2706
- executeCommand: (F) => t.editor.executeCommand(G.tryExpandForEdgeDrop(F)),
2726
+ overlayManager: P,
2727
+ executeCommand: ($) => t.editor.executeCommand(R.tryExpandForEdgeDrop($)),
2707
2728
  schema: t.editor.schema,
2708
2729
  flowModel: t.editor.flowModel,
2709
- getNodeBehavior: R,
2730
+ getNodeBehavior: U,
2710
2731
  idGenerator: t.editor.idGenerator,
2711
2732
  defaultInsertGap: t.nodeActions?.insertGap,
2712
- getContextMenuItems: (F) => t.editor._pluginManager.collectContextMenuItems(F),
2713
- onHighlightChange: (F, se) => {
2714
- a.setHighlightedNodes(F);
2715
- const pe = a.setHighlightedEdges(se);
2733
+ getContextMenuItems: ($) => t.editor._pluginManager.collectContextMenuItems($),
2734
+ onHighlightChange: ($, ne) => {
2735
+ a.setHighlightedNodes($);
2736
+ const he = a.setHighlightedEdges(ne);
2716
2737
  a.refreshNodeHighlights();
2717
- const re = new Set(se);
2718
- for (const me of pe)
2719
- re.has(me) || a.refreshSingleEdgeStyle(me);
2720
- for (const me of re)
2721
- pe.has(me) || a.refreshSingleEdgeStyle(me);
2738
+ const se = new Set(ne);
2739
+ for (const ye of he)
2740
+ se.has(ye) || a.refreshSingleEdgeStyle(ye);
2741
+ for (const ye of se)
2742
+ he.has(ye) || a.refreshSingleEdgeStyle(ye);
2722
2743
  },
2723
- resolveNodeShape: (F) => {
2724
- const se = t.editor.schema.nodeTypes[F];
2725
- if (!se) return null;
2726
- const pe = v.registerNodeType(F, se.component), re = se.getSize({ id: "", type: F, position: { x: 0, y: 0 } });
2727
- return { shapeName: pe, width: re.width, height: re.height };
2744
+ resolveNodeShape: ($) => {
2745
+ const ne = t.editor.schema.nodeTypes[$];
2746
+ if (!ne) return null;
2747
+ const he = v.registerNodeType($, ne.component), se = ne.getSize({ id: "", type: $, position: { x: 0, y: 0 } });
2748
+ return { shapeName: he, width: se.width, height: se.height };
2728
2749
  }
2729
2750
  });
2730
2751
  t.editor.api.value = W;
2731
- const te = {
2752
+ const ee = {
2732
2753
  flowModel: t.editor.flowModel,
2733
2754
  history: t.editor.history,
2734
2755
  schema: t.editor.schema,
@@ -2737,66 +2758,66 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2737
2758
  executeCommand: t.editor.executeCommand,
2738
2759
  selectionMode: t.editor.selectionMode,
2739
2760
  api: W,
2740
- overlay: _,
2761
+ overlay: P,
2741
2762
  graph: l
2742
2763
  };
2743
- t.editor._pluginManager.attachRuntime(te);
2744
- const ae = t.editor._pluginManager.collectExtendedApi();
2745
- Object.assign(t.editor.extendedApi, ae), t.editor._emitUiEvent = (F) => {
2746
- t.editor._pluginManager.dispatchUiEvent(F), s("ui-event", F);
2747
- }, u = new Xt(
2764
+ t.editor._pluginManager.attachRuntime(ee);
2765
+ const le = t.editor._pluginManager.collectExtendedApi();
2766
+ Object.assign(t.editor.extendedApi, le), t.editor._emitUiEvent = ($) => {
2767
+ t.editor._pluginManager.dispatchUiEvent($), s("ui-event", $);
2768
+ }, f = new Xt(
2748
2769
  l,
2749
- (F) => {
2750
- (F.type === "node.click" || F.type === "node.dblclick" || F.type === "node.contextmenu") && b.enter(F.nodeId), t.editor._emitUiEvent(F);
2770
+ ($) => {
2771
+ ($.type === "node.click" || $.type === "node.dblclick" || $.type === "node.contextmenu") && b.enter($.nodeId), t.editor._emitUiEvent($);
2751
2772
  },
2752
- (F) => {
2773
+ ($) => {
2753
2774
  if (a.isSyncing) return;
2754
- const se = G.tryExpandForEdgeDrop(F);
2755
- if (t.editor.executeCommand(se).status !== "applied") {
2756
- for (const re of se.commands)
2757
- if (re.type === "edge.add") {
2758
- const me = l.getCellById(re.edge.id);
2759
- me && l.removeCell(me);
2775
+ const ne = R.tryExpandForEdgeDrop($);
2776
+ if (t.editor.executeCommand(ne).status !== "applied") {
2777
+ for (const se of ne.commands)
2778
+ if (se.type === "edge.add") {
2779
+ const ye = l.getCellById(se.edge.id);
2780
+ ye && l.removeCell(ye);
2760
2781
  }
2761
2782
  }
2762
2783
  },
2763
2784
  t.editor.flowModel,
2764
2785
  t.editor.idGenerator
2765
- ), h = no(l);
2766
- const ne = so(l);
2767
- m.attachRuntime(l, (F) => ne.hideNodePorts(F)), G.attachRuntime(l), Ee(ne), he(ne), O = vo(l.container);
2768
- let xe = /* @__PURE__ */ new Set(), we = /* @__PURE__ */ new Set();
2786
+ ), p = no(l);
2787
+ const oe = so(l);
2788
+ m.attachRuntime(l, ($) => oe.hideNodePorts($)), R.attachRuntime(l), me(oe), pe(oe), O = vo(l.container);
2789
+ let xe = /* @__PURE__ */ new Set(), be = /* @__PURE__ */ new Set();
2769
2790
  l.on("selection:changed", () => {
2770
- const F = ft(l.getSelectedCells?.() ?? []), se = new Set(F.nodeIds);
2771
- mo(l, xe, se), xe = se, K.value = F, t.editor._pluginManager.dispatchSelectionChange(F), s("ui-event", {
2791
+ const $ = ft(l.getSelectedCells?.() ?? []), ne = new Set($.nodeIds);
2792
+ mo(l, xe, ne), xe = ne, X.value = $, t.editor._pluginManager.dispatchSelectionChange($), s("ui-event", {
2772
2793
  type: "selection.change",
2773
- nodeIds: F.nodeIds,
2774
- edgeIds: F.edgeIds
2794
+ nodeIds: $.nodeIds,
2795
+ edgeIds: $.edgeIds
2775
2796
  }), a.refreshNodeHighlights();
2776
- const pe = new Set(F.edgeIds);
2777
- for (const re of we)
2778
- pe.has(re) || a.refreshSingleEdgeStyle(re);
2779
- for (const re of pe)
2780
- we.has(re) || a.refreshSingleEdgeStyle(re);
2781
- we = pe;
2797
+ const he = new Set($.edgeIds);
2798
+ for (const se of be)
2799
+ he.has(se) || a.refreshSingleEdgeStyle(se);
2800
+ for (const se of he)
2801
+ be.has(se) || a.refreshSingleEdgeStyle(se);
2802
+ be = he;
2782
2803
  });
2783
2804
  const Be = () => {
2784
2805
  k.value++;
2785
2806
  };
2786
- l.on("translate", Be), l.on("scale", Be), l.on("resize", Be), ye(), a.syncFlowModel(t.editor.flowModel.value), $e();
2807
+ l.on("translate", Be), l.on("scale", Be), l.on("resize", Be), we(), a.syncFlowModel(t.editor.flowModel.value), $e();
2787
2808
  });
2788
2809
  function Se() {
2789
2810
  b.reset(), m.quickAddNodeId.value = null, m.quickAddPopoverOpen.value = !1;
2790
2811
  }
2791
2812
  return e({ resetHoverState: Se }), Te(() => {
2792
- b.cleanup(), m.cleanup(), G.cleanup(), h?.remove(), c && l?.container?.removeEventListener("mousemove", c), w && r.value?.removeEventListener("mousemove", w), N && r.value?.removeEventListener("mouseleave", N), O?.(), r.value?.removeEventListener("keydown", Z), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2813
+ 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", Q), t.editor._pluginManager.detachRuntime(), t.editor.api.value = null;
2793
2814
  for (const I of Object.keys(t.editor.extendedApi))
2794
2815
  delete t.editor.extendedApi[I];
2795
- u?.dispose(), a?.dispose(), v?.dispose(), l?.dispose();
2796
- }), (I, C) => (A(), P("div", {
2816
+ f?.dispose(), a?.dispose(), v?.dispose(), l?.dispose();
2817
+ }), (I, C) => (A(), T("div", {
2797
2818
  ref_key: "rootRef",
2798
2819
  ref: r,
2799
- class: oe(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": B.value }]),
2820
+ class: te(["flow-canvas-runtime-core", { "flow-canvas-runtime-core--selection-mode": G.value }]),
2800
2821
  tabindex: "0"
2801
2822
  }, [
2802
2823
  q("div", {
@@ -2805,61 +2826,64 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2805
2826
  class: "flow-canvas-runtime-core__graph"
2806
2827
  }, null, 512),
2807
2828
  q("div", No, [
2808
- (A(!0), P(de, null, Ce(y.value, (_) => (A(), P("div", {
2809
- key: `badge-${_.nodeId}`,
2829
+ (A(!0), T(de, null, Ce(y.value, (P) => (A(), T("div", {
2830
+ key: `badge-${P.nodeId}`,
2810
2831
  class: "flow-canvas-runtime-core__badge",
2811
- style: be({ left: `${_.x}px`, top: `${_.y}px`, backgroundColor: _.badge.color })
2812
- }, ce(_.badge.text), 5))), 128)),
2813
- le(E) ? (A(), Ie(Co, {
2832
+ style: Ee({ left: `${P.x}px`, top: `${P.y}px`, backgroundColor: P.badge.color })
2833
+ }, ce(P.badge.text), 5))), 128)),
2834
+ re(E) ? (A(), Ie(Co, {
2814
2835
  key: 0,
2815
2836
  ref_key: "quickAddPopoverRef",
2816
- ref: p,
2817
- node: le(E).node,
2818
- "port-position": le(E).portPosition,
2819
- onOpen: le($),
2820
- onClose: D,
2821
- onStartDrag: le(U),
2822
- onMouseenter: le(L),
2823
- onMouseleave: le(x)
2837
+ ref: h,
2838
+ node: re(E).node,
2839
+ "port-position": re(E).portPosition,
2840
+ "auto-pan-on-open": re(m).mergedConfig.value.autoPanOnOpen,
2841
+ "auto-pan-padding": re(m).mergedConfig.value.autoPanPadding,
2842
+ onOpen: re(L),
2843
+ onClose: ie,
2844
+ onStartDrag: re(z),
2845
+ onViewportOverflowRight: re(m).handlePopoverViewportOverflow,
2846
+ onMouseenter: re(N),
2847
+ onMouseleave: re(_)
2824
2848
  }, {
2825
2849
  default: He(() => [
2826
2850
  Me(I.$slots, "quick-add-panel", {
2827
- node: le(E).node,
2851
+ node: re(E).node,
2828
2852
  api: n.editor.api.value,
2829
- insertNodeToRight: (_) => le(T)(le(E).node.id, _),
2830
- closePopover: () => p.value?.closePopover()
2853
+ insertNodeToRight: (P) => re(x)(re(E).node.id, P),
2854
+ closePopover: () => h.value?.closePopover()
2831
2855
  }, void 0, !0)
2832
2856
  ]),
2833
2857
  _: 3
2834
- }, 8, ["node", "port-position", "onOpen", "onStartDrag", "onMouseenter", "onMouseleave"])) : Y("", !0),
2835
- d.value ? (A(), Ie(bo, {
2858
+ }, 8, ["node", "port-position", "auto-pan-on-open", "auto-pan-padding", "onOpen", "onStartDrag", "onViewportOverflowRight", "onMouseenter", "onMouseleave"])) : Y("", !0),
2859
+ c.value ? (A(), Ie(bo, {
2836
2860
  key: 1,
2837
- node: d.value.node,
2838
- position: d.value.position,
2839
- config: f.value,
2840
- behavior: d.value.behavior,
2841
- "actions-offset": d.value.behavior.actionsOffset,
2842
- onAction: ee,
2843
- onMouseenter: le(H),
2844
- onMouseleave: X
2861
+ node: c.value.node,
2862
+ position: c.value.position,
2863
+ config: d.value,
2864
+ behavior: c.value.behavior,
2865
+ "actions-offset": c.value.behavior.actionsOffset,
2866
+ onAction: Z,
2867
+ onMouseenter: re(B),
2868
+ onMouseleave: j
2845
2869
  }, null, 8, ["node", "position", "config", "behavior", "actions-offset", "onMouseenter"])) : Y("", !0),
2846
2870
  g.value ? (A(), Ie(Mo, {
2847
2871
  key: 2,
2848
2872
  position: g.value.position,
2849
2873
  "can-delete": g.value.canDelete,
2850
- onAction: ie
2874
+ onAction: ae
2851
2875
  }, null, 8, ["position", "can-delete"])) : Y("", !0)
2852
2876
  ])
2853
2877
  ], 2));
2854
2878
  }
2855
- }), Dn = /* @__PURE__ */ ve(Do, [["__scopeId", "data-v-a9bbf5f1"]]), Ao = { class: "flow-canvas-node-palette" }, _o = ["data-node-type"], Po = { class: "flow-canvas-node-palette__item-label" }, To = /* @__PURE__ */ fe({
2879
+ }), 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({
2856
2880
  __name: "canvas-node-palette",
2857
2881
  props: {
2858
2882
  editor: {},
2859
2883
  items: {}
2860
2884
  },
2861
2885
  setup(n) {
2862
- const e = n, o = z(), t = V(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((s) => ({
2886
+ const e = n, o = H(), t = V(() => e.items ? e.items : Object.keys(e.editor.schema.nodeTypes).map((s) => ({
2863
2887
  type: s,
2864
2888
  label: s.charAt(0).toUpperCase() + s.slice(1)
2865
2889
  })));
@@ -2868,43 +2892,43 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2868
2892
  ([s, r, i], l, a) => {
2869
2893
  if (!s || !i) return;
2870
2894
  const v = [];
2871
- for (const u of r) {
2872
- const h = i.querySelector(`[data-node-type="${u.type}"]`);
2873
- if (!h) continue;
2874
- const c = s.registerDndSource(h, () => ({
2875
- id: Q(),
2876
- type: u.type,
2877
- label: u.label,
2895
+ for (const f of r) {
2896
+ const p = i.querySelector(`[data-node-type="${f.type}"]`);
2897
+ if (!p) continue;
2898
+ const u = s.registerDndSource(p, () => ({
2899
+ id: J(),
2900
+ type: f.type,
2901
+ label: f.label,
2878
2902
  position: { x: 0, y: 0 }
2879
2903
  }));
2880
- v.push(c);
2904
+ v.push(u);
2881
2905
  }
2882
2906
  a(() => {
2883
- for (const u of v) u();
2907
+ for (const f of v) f();
2884
2908
  });
2885
2909
  },
2886
2910
  { flush: "post" }
2887
- ), (s, r) => (A(), P("div", Ao, [
2911
+ ), (s, r) => (A(), T("div", Ao, [
2888
2912
  q("div", {
2889
2913
  ref_key: "listRef",
2890
2914
  ref: o,
2891
2915
  class: "flow-canvas-node-palette__list"
2892
2916
  }, [
2893
- (A(!0), P(de, null, Ce(t.value, (i) => (A(), P("div", {
2917
+ (A(!0), T(de, null, Ce(t.value, (i) => (A(), T("div", {
2894
2918
  key: i.type,
2895
2919
  class: "flow-canvas-node-palette__item",
2896
2920
  "data-node-type": i.type
2897
2921
  }, [
2898
- i.icon ? (A(), P("i", {
2922
+ i.icon ? (A(), T("i", {
2899
2923
  key: 0,
2900
- class: oe([i.icon, "flow-canvas-node-palette__item-icon"])
2924
+ class: te([i.icon, "flow-canvas-node-palette__item-icon"])
2901
2925
  }, null, 2)) : Y("", !0),
2902
2926
  q("span", Po, ce(i.label), 1)
2903
2927
  ], 8, _o))), 128))
2904
2928
  ], 512)
2905
2929
  ]));
2906
2930
  }
2907
- }), Lo = /* @__PURE__ */ ve(To, [["__scopeId", "data-v-300314b7"]]), Ro = { class: "flow-canvas-layout" }, Oo = { class: "flow-canvas-layout__main" }, $o = { class: "flow-canvas-layout__content" }, Bo = {
2931
+ }), 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 = {
2908
2932
  key: 0,
2909
2933
  class: "flow-canvas-layout__footer"
2910
2934
  }, Fo = /* @__PURE__ */ fe({
@@ -2919,14 +2943,14 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2919
2943
  },
2920
2944
  emits: ["update:sidebarCollapsed"],
2921
2945
  setup(n) {
2922
- return (e, o) => (A(), P("div", Ro, [
2923
- !n.hideSidebar && (e.$slots.sidebar || n.editor) ? (A(), P("aside", {
2946
+ return (e, o) => (A(), T("div", Lo, [
2947
+ !n.hideSidebar && (e.$slots.sidebar || n.editor) ? (A(), T("aside", {
2924
2948
  key: 0,
2925
- class: oe(["flow-canvas-layout__sidebar", { "is-collapsed": n.sidebarCollapsed }]),
2926
- style: be({ width: n.sidebarCollapsed ? "0px" : `${n.sidebarWidth}px` })
2949
+ class: te(["flow-canvas-layout__sidebar", { "is-collapsed": n.sidebarCollapsed }]),
2950
+ style: Ee({ width: n.sidebarCollapsed ? "0px" : `${n.sidebarWidth}px` })
2927
2951
  }, [
2928
2952
  Me(e.$slots, "sidebar", {}, () => [
2929
- n.editor ? (A(), Ie(Lo, {
2953
+ n.editor ? (A(), Ie(Ro, {
2930
2954
  key: 0,
2931
2955
  editor: n.editor,
2932
2956
  items: n.paletteItems
@@ -2937,13 +2961,13 @@ const yo = { class: "flow-canvas-node-actions__bar" }, wo = /* @__PURE__ */ fe({
2937
2961
  q("div", $o, [
2938
2962
  Me(e.$slots, "default", {}, void 0, !0)
2939
2963
  ]),
2940
- !n.hideFooter && e.$slots.footer ? (A(), P("div", Bo, [
2964
+ !n.hideFooter && e.$slots.footer ? (A(), T("div", Bo, [
2941
2965
  Me(e.$slots, "footer", {}, void 0, !0)
2942
2966
  ])) : Y("", !0)
2943
2967
  ])
2944
2968
  ]));
2945
2969
  }
2946
- }), An = /* @__PURE__ */ ve(Fo, [["__scopeId", "data-v-26f35b6b"]]), Je = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), qo = ["undo", "redo"];
2970
+ }), An = /* @__PURE__ */ ve(Fo, [["__scopeId", "data-v-26f35b6b"]]), et = typeof navigator < "u" && /Mac|iPod|iPhone|iPad/.test(navigator.platform ?? navigator.userAgent), qo = ["undo", "redo"];
2947
2971
  function Ho(n) {
2948
2972
  const e = new Set(n?.include), o = new Set(qo.filter((a) => !e.has(a))), t = [
2949
2973
  {
@@ -2952,7 +2976,7 @@ function Ho(n) {
2952
2976
  group: "history",
2953
2977
  icon: "flow-canvas-icon canvas-undo",
2954
2978
  description: "撤销",
2955
- shortcut: Je ? ["⌘", "Z"] : ["Ctrl", "Z"],
2979
+ shortcut: et ? ["⌘", "Z"] : ["Ctrl", "Z"],
2956
2980
  order: 10
2957
2981
  },
2958
2982
  {
@@ -2961,7 +2985,7 @@ function Ho(n) {
2961
2985
  group: "history",
2962
2986
  icon: "flow-canvas-icon canvas-redo",
2963
2987
  description: "重做",
2964
- shortcut: Je ? ["⇧", "⌘", "Z"] : ["Ctrl", "Shift", "Z"],
2988
+ shortcut: et ? ["⇧", "⌘", "Z"] : ["Ctrl", "Shift", "Z"],
2965
2989
  order: 11
2966
2990
  }
2967
2991
  ], s = [
@@ -3048,47 +3072,47 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3048
3072
  "minimap",
3049
3073
  "export"
3050
3074
  ]), o = /* @__PURE__ */ new Set(["select", "search", "minimap"]);
3051
- function t(d) {
3052
- return d.id.startsWith("plugin:") || d.type === "custom";
3075
+ function t(c) {
3076
+ return c.id.startsWith("plugin:") || c.type === "custom";
3053
3077
  }
3054
- function s(d) {
3055
- return d !== "custom" && o.has(d);
3078
+ function s(c) {
3079
+ return c !== "custom" && o.has(c);
3056
3080
  }
3057
3081
  const r = n, i = V(() => {
3058
3082
  if (r.items) return r.items;
3059
- const d = Ho({ include: r.include }), g = r.editor.toolbarItems.value, p = new Set(r.exclude ?? []), m = /* @__PURE__ */ new Map();
3060
- for (const E of d)
3083
+ const c = Ho({ include: r.include }), g = r.editor.toolbarItems.value, h = new Set(r.exclude ?? []), m = /* @__PURE__ */ new Map();
3084
+ for (const E of c)
3061
3085
  m.set(E.id, E);
3062
3086
  for (const E of g) {
3063
- const $ = m.get(E.id);
3064
- $ ? m.set(E.id, { ...$, ...E, order: $.order, group: $.group }) : t(E) && m.set(E.id, E);
3087
+ const L = m.get(E.id);
3088
+ L ? m.set(E.id, { ...L, ...E, order: L.order, group: L.group }) : t(E) && m.set(E.id, E);
3065
3089
  }
3066
- return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !p.has(E.type)).sort((E, $) => (E.order ?? 0) - ($.order ?? 0));
3067
- }), l = z(1), a = z(null), v = z(null), u = z(!1);
3068
- let h = null;
3090
+ return [...m.values()].filter((E) => E.type === "custom" || !e.has(E.type) ? !0 : !h.has(E.type)).sort((E, L) => (E.order ?? 0) - (L.order ?? 0));
3091
+ }), l = H(1), a = H(null), v = H(null), f = H(!1);
3092
+ let p = null;
3069
3093
  ge(
3070
3094
  () => r.editor.api.value,
3071
- (d) => {
3072
- h?.(), h = null, d && (l.value = d.getZoom(), h = d.onGraphEvent("scale", () => {
3073
- l.value = d.getZoom();
3095
+ (c) => {
3096
+ p?.(), p = null, c && (l.value = c.getZoom(), p = c.onGraphEvent("scale", () => {
3097
+ l.value = c.getZoom();
3074
3098
  }));
3075
3099
  },
3076
3100
  { immediate: !0 }
3077
3101
  );
3078
- const c = vt({ visible: !1, text: "", shortcut: [], x: 0, y: 0 });
3079
- function w(d, g) {
3102
+ const u = vt({ visible: !1, text: "", shortcut: [], x: 0, y: 0 });
3103
+ function w(c, g) {
3080
3104
  if (!g.description) return;
3081
- const m = d.currentTarget.getBoundingClientRect();
3082
- c.text = g.description, c.shortcut = g.shortcut ?? [], c.visible = !0, dt(() => {
3083
- const E = a.value?.offsetWidth ?? 0, $ = a.value?.offsetHeight ?? 0;
3084
- c.x = m.left + m.width / 2 - E / 2, c.y = m.top - $ - 6;
3105
+ const m = c.currentTarget.getBoundingClientRect();
3106
+ u.text = g.description, u.shortcut = g.shortcut ?? [], u.visible = !0, Ge(() => {
3107
+ const E = a.value?.offsetWidth ?? 0, L = a.value?.offsetHeight ?? 0;
3108
+ u.x = m.left + m.width / 2 - E / 2, u.y = m.top - L - 6;
3085
3109
  });
3086
3110
  }
3087
- function N() {
3088
- c.visible = !1, a.value = null;
3111
+ function D() {
3112
+ u.visible = !1, a.value = null;
3089
3113
  }
3090
- rt(() => {
3091
- h?.();
3114
+ it(() => {
3115
+ p?.();
3092
3116
  });
3093
3117
  const O = V(() => `${Math.round(l.value * 100)}%`), b = V(() => r.editor.api.value ? {
3094
3118
  api: r.editor.api.value,
@@ -3096,48 +3120,48 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3096
3120
  history: r.editor.history,
3097
3121
  mode: r.editor.mode.value
3098
3122
  } : null);
3099
- function M(d) {
3100
- return d.visible === !1 ? !1 : typeof d.visible == "function" ? b.value ? d.visible(b.value) : !1 : !0;
3123
+ function S(c) {
3124
+ return c.visible === !1 ? !1 : typeof c.visible == "function" ? b.value ? c.visible(b.value) : !1 : !0;
3101
3125
  }
3102
- function S(d) {
3103
- return typeof d.active == "function" ? b.value ? d.active(b.value) : !1 : d.active !== void 0 ? d.active : d.type === "select" ? r.editor.selectionMode.value : !1;
3126
+ function M(c) {
3127
+ 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;
3104
3128
  }
3105
- const H = V(() => {
3106
- const d = f.value.filter(
3107
- (p) => s(p.type) && S(p)
3129
+ const B = V(() => {
3130
+ const c = d.value.filter(
3131
+ (h) => s(h.type) && M(h)
3108
3132
  );
3109
- if (d.length === 0) return null;
3133
+ if (c.length === 0) return null;
3110
3134
  const g = v.value;
3111
- return g && d.some((p) => p.type === g) ? g : d[0]?.type ?? null;
3135
+ return g && c.some((h) => h.type === g) ? g : c[0]?.type ?? null;
3112
3136
  });
3113
- function X(d) {
3114
- return s(d.type) ? H.value === d.type : S(d);
3137
+ function j(c) {
3138
+ return s(c.type) ? B.value === c.type : M(c);
3115
3139
  }
3116
- function k(d) {
3117
- return !b.value || d.disabled === !0 ? !0 : typeof d.disabled == "function" ? d.disabled(b.value) : d.type === "undo" ? !r.editor.history.canUndo.value : d.type === "redo" ? !r.editor.history.canRedo.value : d.type === "export" ? u.value : !1;
3140
+ function k(c) {
3141
+ 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;
3118
3142
  }
3119
- function K(d) {
3120
- if (!(!b.value || !s(d.type) || !S(d))) {
3121
- if (d.type === "select") {
3143
+ function X(c) {
3144
+ if (!(!b.value || !s(c.type) || !M(c))) {
3145
+ if (c.type === "select") {
3122
3146
  r.editor.setSelectionMode(!1);
3123
3147
  return;
3124
3148
  }
3125
- d.onClick?.(b.value);
3149
+ c.onClick?.(b.value);
3126
3150
  }
3127
3151
  }
3128
- function R(d) {
3129
- if (s(d.type))
3130
- for (const g of f.value)
3131
- !s(g.type) || g.id === d.id || K(g);
3152
+ function U(c) {
3153
+ if (s(c.type))
3154
+ for (const g of d.value)
3155
+ !s(g.type) || g.id === c.id || X(g);
3132
3156
  }
3133
- function B(d) {
3134
- if (!b.value || k(d)) return;
3135
- if (s(d.type) && (v.value = d.type, R(d)), d.onClick) {
3136
- d.onClick(b.value);
3157
+ function G(c) {
3158
+ if (!b.value || k(c)) return;
3159
+ if (s(c.type) && (v.value = c.type, U(c)), c.onClick) {
3160
+ c.onClick(b.value);
3137
3161
  return;
3138
3162
  }
3139
3163
  const { api: g } = b.value;
3140
- switch (d.type) {
3164
+ switch (c.type) {
3141
3165
  case "undo":
3142
3166
  r.editor.history.undo();
3143
3167
  break;
@@ -3157,14 +3181,14 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3157
3181
  g.zoomTo(1), g.scrollToOrigin(), l.value = 1;
3158
3182
  break;
3159
3183
  case "export":
3160
- if (u.value) break;
3161
- u.value = !0, g.exportAsImage().then((p) => {
3162
- const m = URL.createObjectURL(p), E = document.createElement("a");
3184
+ if (f.value) break;
3185
+ f.value = !0, g.exportAsImage().then((h) => {
3186
+ const m = URL.createObjectURL(h), E = document.createElement("a");
3163
3187
  E.href = m, E.download = "canvas-export.png", E.click(), URL.revokeObjectURL(m);
3164
- }).catch((p) => {
3165
- console.warn("[flow-canvas] Export failed:", p);
3188
+ }).catch((h) => {
3189
+ console.warn("[flow-canvas] Export failed:", h);
3166
3190
  }).finally(() => {
3167
- u.value = !1;
3191
+ f.value = !1;
3168
3192
  });
3169
3193
  break;
3170
3194
  case "select":
@@ -3175,49 +3199,49 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3175
3199
  break;
3176
3200
  case "search":
3177
3201
  case "minimap":
3178
- console.warn(`[flow-canvas] "${d.type}" toolbar item has no built-in handler. Provide an onClick callback.`);
3202
+ console.warn(`[flow-canvas] "${c.type}" toolbar item has no built-in handler. Provide an onClick callback.`);
3179
3203
  break;
3180
3204
  default:
3181
- d.type !== "custom" && console.warn(`[flow-canvas] No default handler for toolbar type "${d.type}". Provide an onClick handler.`);
3205
+ c.type !== "custom" && console.warn(`[flow-canvas] No default handler for toolbar type "${c.type}". Provide an onClick handler.`);
3182
3206
  break;
3183
3207
  }
3184
3208
  }
3185
- const f = V(() => i.value.filter(M)), y = V(() => {
3186
- const d = /* @__PURE__ */ new Map(), g = [];
3187
- for (const p of f.value) {
3188
- const m = p.group ?? "default";
3189
- d.has(m) || (d.set(m, []), g.push(m)), d.get(m).push(p);
3209
+ const d = V(() => i.value.filter(S)), y = V(() => {
3210
+ const c = /* @__PURE__ */ new Map(), g = [];
3211
+ for (const h of d.value) {
3212
+ const m = h.group ?? "default";
3213
+ c.has(m) || (c.set(m, []), g.push(m)), c.get(m).push(h);
3190
3214
  }
3191
- return g.map((p) => ({ name: p, items: d.get(p) })).filter((p) => p.items.length > 0);
3215
+ return g.map((h) => ({ name: h, items: c.get(h) })).filter((h) => h.items.length > 0);
3192
3216
  });
3193
- return (d, g) => (A(), P("div", Go, [
3194
- (A(!0), P(de, null, Ce(y.value, (p, m) => (A(), P(de, {
3195
- key: p.name
3217
+ return (c, g) => (A(), T("div", Go, [
3218
+ (A(!0), T(de, null, Ce(y.value, (h, m) => (A(), T(de, {
3219
+ key: h.name
3196
3220
  }, [
3197
- m > 0 ? (A(), P("div", zo)) : Y("", !0),
3221
+ m > 0 ? (A(), T("div", zo)) : Y("", !0),
3198
3222
  q("div", Uo, [
3199
- (A(!0), P(de, null, Ce(p.items, (E) => (A(), P(de, {
3223
+ (A(!0), T(de, null, Ce(h.items, (E) => (A(), T(de, {
3200
3224
  key: E.id
3201
3225
  }, [
3202
- E.type === "zoom-display" ? (A(), P("span", jo, ce(O.value), 1)) : (A(), P("button", {
3226
+ E.type === "zoom-display" ? (A(), T("span", jo, ce(O.value), 1)) : (A(), T("button", {
3203
3227
  key: 1,
3204
3228
  type: "button",
3205
- class: oe(["flow-canvas-toolbar__btn", {
3229
+ class: te(["flow-canvas-toolbar__btn", {
3206
3230
  "is-disabled": k(E),
3207
- "is-active": X(E),
3208
- "is-exporting": E.type === "export" && u.value
3231
+ "is-active": j(E),
3232
+ "is-exporting": E.type === "export" && f.value
3209
3233
  }]),
3210
3234
  "data-toolbar-id": E.id,
3211
3235
  "data-toolbar-type": E.type,
3212
3236
  disabled: k(E),
3213
- onClick: ($) => B(E),
3214
- onMouseenter: ($) => w($, E),
3215
- onMouseleave: N
3237
+ onClick: (L) => G(E),
3238
+ onMouseenter: (L) => w(L, E),
3239
+ onMouseleave: D
3216
3240
  }, [
3217
- E.component ? (A(), Ie(mt(E.component), { key: 0 })) : E.icon ? (A(), P("i", {
3241
+ E.component ? (A(), Ie(mt(E.component), { key: 0 })) : E.icon ? (A(), T("i", {
3218
3242
  key: 1,
3219
- class: oe(E.icon)
3220
- }, null, 2)) : (A(), P("span", {
3243
+ class: te(E.icon)
3244
+ }, null, 2)) : (A(), T("span", {
3221
3245
  key: 2,
3222
3246
  class: "flow-canvas-toolbar__text",
3223
3247
  textContent: ce(E.text ?? E.description ?? E.id)
@@ -3227,16 +3251,16 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3227
3251
  ])
3228
3252
  ], 64))), 128)),
3229
3253
  (A(), Ie(yt, { to: "body" }, [
3230
- c.visible ? (A(), P("div", {
3254
+ u.visible ? (A(), T("div", {
3231
3255
  key: 0,
3232
3256
  ref_key: "tooltipRef",
3233
3257
  ref: a,
3234
3258
  class: "flow-canvas-toolbar-tooltip",
3235
- style: be({ left: `${c.x}px`, top: `${c.y}px` })
3259
+ style: Ee({ left: `${u.x}px`, top: `${u.y}px` })
3236
3260
  }, [
3237
- q("span", null, ce(c.text), 1),
3238
- c.shortcut.length ? (A(), P("kbd", Xo, [
3239
- (A(!0), P(de, null, Ce(c.shortcut, (p, m) => (A(), P("span", { key: m }, ce(p), 1))), 128))
3261
+ q("span", null, ce(u.text), 1),
3262
+ u.shortcut.length ? (A(), T("kbd", Xo, [
3263
+ (A(!0), T(de, null, Ce(u.shortcut, (h, m) => (A(), T("span", { key: m }, ce(h), 1))), 128))
3240
3264
  ])) : Y("", !0),
3241
3265
  g[0] || (g[0] = q("div", { class: "flow-canvas-toolbar-tooltip__arrow" }, null, -1))
3242
3266
  ], 4)) : Y("", !0)
@@ -3265,24 +3289,24 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3265
3289
  "converge-gateway",
3266
3290
  "conditional-parallel-gateway"
3267
3291
  ]), a = V(() => {
3268
- const u = t.value?.type ?? "";
3269
- return i.has(u) ? "endpoint" : l.has(u) ? "gateway" : "task";
3292
+ const f = t.value?.type ?? "";
3293
+ return i.has(f) ? "endpoint" : l.has(f) ? "gateway" : "task";
3270
3294
  }), v = V(() => r[t.value?.type ?? ""] ?? "");
3271
- return (u, h) => (A(), P("div", {
3272
- class: oe(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3295
+ return (f, p) => (A(), T("div", {
3296
+ class: te(["flow-canvas-default-node", [`is-${a.value}`, { "flow-canvas-highlight-target": a.value !== "gateway" }]])
3273
3297
  }, [
3274
- a.value === "endpoint" ? (A(), P(de, { key: 0 }, [
3275
- v.value ? (A(), P("i", {
3298
+ a.value === "endpoint" ? (A(), T(de, { key: 0 }, [
3299
+ v.value ? (A(), T("i", {
3276
3300
  key: 0,
3277
- class: oe([["flow-canvas-icon", v.value], "flow-canvas-default-node__ep-icon"])
3301
+ class: te([["flow-canvas-icon", v.value], "flow-canvas-default-node__ep-icon"])
3278
3302
  }, null, 2)) : Y("", !0),
3279
3303
  q("span", Yo, ce(s.value), 1)
3280
- ], 64)) : a.value === "gateway" ? (A(), P("div", Zo, [
3281
- v.value ? (A(), P("i", {
3304
+ ], 64)) : a.value === "gateway" ? (A(), T("div", Zo, [
3305
+ v.value ? (A(), T("i", {
3282
3306
  key: 0,
3283
- class: oe([["flow-canvas-icon", v.value], "flow-canvas-default-node__gw-icon"])
3307
+ class: te([["flow-canvas-icon", v.value], "flow-canvas-default-node__gw-icon"])
3284
3308
  }, null, 2)) : Y("", !0)
3285
- ])) : (A(), P("span", Qo, ce(s.value), 1))
3309
+ ])) : (A(), T("span", Qo, ce(s.value), 1))
3286
3310
  ], 2));
3287
3311
  }
3288
3312
  }), en = /* @__PURE__ */ ve(Jo, [["__scopeId", "data-v-f0e24a9f"]]), tn = {
@@ -3298,11 +3322,11 @@ const Go = { class: "flow-canvas-toolbar" }, zo = {
3298
3322
  width: 64,
3299
3323
  height: 64
3300
3324
  }
3301
- }, et = (n, e) => ({
3325
+ }, tt = (n, e) => ({
3302
3326
  stroke: e.hovered ? "#3a84ff" : "#abb5cc",
3303
3327
  strokeWidth: 2
3304
3328
  });
3305
- function tt() {
3329
+ function ot() {
3306
3330
  return {
3307
3331
  attrs: {
3308
3332
  line: {
@@ -3318,13 +3342,13 @@ function on() {
3318
3342
  manhattan: {
3319
3343
  router: { name: "manhattan", args: { padding: 10, maxDirectionChange: 90 } },
3320
3344
  connector: { name: "rounded", args: { radius: 8 } },
3321
- style: et,
3322
- x6EdgeConfig: tt()
3345
+ style: tt,
3346
+ x6EdgeConfig: ot()
3323
3347
  },
3324
3348
  bezier: {
3325
3349
  connector: { name: "smooth" },
3326
- style: et,
3327
- x6EdgeConfig: tt()
3350
+ style: tt,
3351
+ x6EdgeConfig: ot()
3328
3352
  }
3329
3353
  };
3330
3354
  }
@@ -3363,22 +3387,22 @@ function Tn(n) {
3363
3387
  if (r.type !== "edge.add" && r.type !== "edge.reconnect") continue;
3364
3388
  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;
3365
3389
  if (!l || !a) continue;
3366
- const v = i.nodes[l], u = i.nodes[a];
3367
- if (!v || !u) continue;
3368
- const h = r.type === "edge.add" ? r.edge.source.portId : r.source?.portId, c = r.type === "edge.add" ? r.edge.target.portId : r.target?.portId, w = h ? v.ports?.find((S) => S.id === h) : void 0, N = c ? u.ports?.find((S) => S.id === c) : void 0, O = r.type === "edge.reconnect" ? r.edgeId : void 0, b = Object.values(i.edges).filter(
3369
- (S) => S.id !== O && !s.has(S.id)
3370
- ), M = n({
3390
+ const v = i.nodes[l], f = i.nodes[a];
3391
+ if (!v || !f) continue;
3392
+ 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 ? v.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(
3393
+ (M) => M.id !== O && !s.has(M.id)
3394
+ ), S = n({
3371
3395
  flowModel: i,
3372
3396
  sourceNode: v,
3373
- targetNode: u,
3397
+ targetNode: f,
3374
3398
  sourcePort: w,
3375
- targetPort: N,
3399
+ targetPort: D,
3376
3400
  existingEdges: b
3377
3401
  });
3378
- if (!M.valid)
3402
+ if (!S.valid)
3379
3403
  return {
3380
3404
  rejected: !0,
3381
- reason: M.reason ?? "Connection validation failed",
3405
+ reason: S.reason ?? "Connection validation failed",
3382
3406
  code: "validation_failed"
3383
3407
  };
3384
3408
  }
@@ -3386,7 +3410,7 @@ function Tn(n) {
3386
3410
  }
3387
3411
  };
3388
3412
  }
3389
- function Ln(n) {
3413
+ function Rn(n) {
3390
3414
  const { rubberband: e = !0, multiple: o = !0, movable: t = !0 } = n ?? {};
3391
3415
  return {
3392
3416
  name: "selection",
@@ -3406,7 +3430,7 @@ function Ln(n) {
3406
3430
  }
3407
3431
  };
3408
3432
  }
3409
- function Rn(n) {
3433
+ function Ln(n) {
3410
3434
  const { tolerance: e = 10, color: o = "#3a84ff" } = n ?? {};
3411
3435
  let t = null;
3412
3436
  return {
@@ -3443,11 +3467,11 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3443
3467
  },
3444
3468
  emits: ["update:query", "select", "nextMatch", "prevMatch", "close"],
3445
3469
  setup(n, { emit: e }) {
3446
- const o = n, t = e, s = z(null), r = z(null), i = z(-1);
3470
+ const o = n, t = e, s = H(null), r = H(null), i = H(-1);
3447
3471
  ge(
3448
3472
  () => o.open,
3449
- (c) => {
3450
- c && (i.value = -1, dt(() => {
3473
+ (u) => {
3474
+ u && (i.value = -1, Ge(() => {
3451
3475
  s.value?.focus(), s.value?.select();
3452
3476
  }));
3453
3477
  }
@@ -3458,62 +3482,62 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3458
3482
  }
3459
3483
  ), ge(
3460
3484
  () => o.results.length,
3461
- (c) => {
3462
- if (!c) {
3485
+ (u) => {
3486
+ if (!u) {
3463
3487
  i.value = -1;
3464
3488
  return;
3465
3489
  }
3466
- i.value >= c && (i.value = -1);
3490
+ i.value >= u && (i.value = -1);
3467
3491
  }
3468
3492
  );
3469
- function l(c) {
3470
- t("update:query", c.target.value);
3493
+ function l(u) {
3494
+ t("update:query", u.target.value);
3471
3495
  }
3472
- function a(c) {
3473
- i.value = c;
3496
+ function a(u) {
3497
+ i.value = u;
3474
3498
  }
3475
3499
  function v() {
3476
3500
  i.value = -1;
3477
3501
  }
3478
- function u(c) {
3479
- if (c.key === "Escape") {
3480
- c.preventDefault(), t("close");
3502
+ function f(u) {
3503
+ if (u.key === "Escape") {
3504
+ u.preventDefault(), t("close");
3481
3505
  return;
3482
3506
  }
3483
- if (c.key === "ArrowDown") {
3484
- if (c.preventDefault(), !o.results.length) return;
3507
+ if (u.key === "ArrowDown") {
3508
+ if (u.preventDefault(), !o.results.length) return;
3485
3509
  i.value = i.value < o.results.length - 1 ? i.value + 1 : 0;
3486
3510
  return;
3487
3511
  }
3488
- if (c.key === "ArrowUp") {
3489
- if (c.preventDefault(), !o.results.length) return;
3512
+ if (u.key === "ArrowUp") {
3513
+ if (u.preventDefault(), !o.results.length) return;
3490
3514
  i.value = i.value > 0 ? i.value - 1 : o.results.length - 1;
3491
3515
  return;
3492
3516
  }
3493
- if (c.key === "Enter") {
3494
- if (c.preventDefault(), i.value >= 0) {
3517
+ if (u.key === "Enter") {
3518
+ if (u.preventDefault(), i.value >= 0) {
3495
3519
  const w = o.results[i.value];
3496
3520
  w && t("select", w.id);
3497
3521
  return;
3498
3522
  }
3499
- c.shiftKey ? t("prevMatch") : t("nextMatch");
3523
+ u.shiftKey ? t("prevMatch") : t("nextMatch");
3500
3524
  }
3501
3525
  }
3502
- function h(c) {
3526
+ function p(u) {
3503
3527
  if (!o.open) return;
3504
- const w = c.target;
3505
- w && r.value?.contains(w) || o.isAnchorTarget?.(c.target) || t("close");
3528
+ const w = u.target;
3529
+ w && r.value?.contains(w) || o.isAnchorTarget?.(u.target) || t("close");
3506
3530
  }
3507
- return lt(() => {
3508
- document.addEventListener("mousedown", h);
3531
+ return dt(() => {
3532
+ document.addEventListener("mousedown", p);
3509
3533
  }), Te(() => {
3510
- document.removeEventListener("mousedown", h);
3511
- }), (c, w) => n.open ? (A(), P("div", {
3534
+ document.removeEventListener("mousedown", p);
3535
+ }), (u, w) => n.open ? (A(), T("div", {
3512
3536
  key: 0,
3513
3537
  ref_key: "panelRef",
3514
3538
  ref: r,
3515
3539
  class: "flow-canvas-search-popover",
3516
- style: be({ left: `${n.position.x}px`, top: `${n.position.y}px`, width: `${n.position.width}px` })
3540
+ style: Ee({ left: `${n.position.x}px`, top: `${n.position.y}px`, width: `${n.position.width}px` })
3517
3541
  }, [
3518
3542
  q("div", nn, [
3519
3543
  q("input", {
@@ -3522,15 +3546,15 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3522
3546
  value: n.query,
3523
3547
  placeholder: n.placeholder,
3524
3548
  onInput: l,
3525
- onKeydown: u
3549
+ onKeydown: f
3526
3550
  }, null, 40, sn),
3527
- n.query ? (A(), P(de, { key: 0 }, [
3528
- n.results.length ? (A(), P(de, { key: 1 }, [
3551
+ n.query ? (A(), T(de, { key: 0 }, [
3552
+ n.results.length ? (A(), T(de, { key: 1 }, [
3529
3553
  q("button", {
3530
3554
  type: "button",
3531
3555
  class: "flow-canvas-search-popover__nav-btn",
3532
3556
  "aria-label": "上一个",
3533
- onClick: w[0] || (w[0] = (N) => t("prevMatch"))
3557
+ onClick: w[0] || (w[0] = (D) => t("prevMatch"))
3534
3558
  }, [...w[2] || (w[2] = [
3535
3559
  q("svg", {
3536
3560
  viewBox: "0 0 16 16",
@@ -3552,7 +3576,7 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3552
3576
  type: "button",
3553
3577
  class: "flow-canvas-search-popover__nav-btn",
3554
3578
  "aria-label": "下一个",
3555
- onClick: w[1] || (w[1] = (N) => t("nextMatch"))
3579
+ onClick: w[1] || (w[1] = (D) => t("nextMatch"))
3556
3580
  }, [...w[3] || (w[3] = [
3557
3581
  q("svg", {
3558
3582
  viewBox: "0 0 16 16",
@@ -3569,29 +3593,29 @@ const nn = { class: "flow-canvas-search-popover__input-box" }, sn = ["value", "p
3569
3593
  })
3570
3594
  ], -1)
3571
3595
  ])])
3572
- ], 64)) : (A(), P("span", rn, "无结果"))
3596
+ ], 64)) : (A(), T("span", rn, "无结果"))
3573
3597
  ], 64)) : Y("", !0),
3574
3598
  w[4] || (w[4] = q("i", { class: "flow-canvas-icon canvas-search flow-canvas-search-popover__search-icon" }, null, -1))
3575
3599
  ]),
3576
- n.query && n.results.length ? (A(), P("div", {
3600
+ n.query && n.results.length ? (A(), T("div", {
3577
3601
  key: 0,
3578
3602
  class: "flow-canvas-search-popover__list-box",
3579
3603
  onMouseleave: v
3580
3604
  }, [
3581
- (A(!0), P(de, null, Ce(n.results, (N, O) => (A(), P("button", {
3582
- key: N.id,
3605
+ (A(!0), T(de, null, Ce(n.results, (D, O) => (A(), T("button", {
3606
+ key: D.id,
3583
3607
  type: "button",
3584
- class: oe(["flow-canvas-search-popover__item", { "is-active": O === i.value, "is-matched": O === n.matchIndex }]),
3608
+ class: te(["flow-canvas-search-popover__item", { "is-active": O === i.value, "is-matched": O === n.matchIndex }]),
3585
3609
  onMouseenter: (b) => a(O),
3586
- onClick: (b) => t("select", N.id)
3610
+ onClick: (b) => t("select", D.id)
3587
3611
  }, [
3588
- q("span", dn, ce(N.label), 1)
3612
+ q("span", dn, ce(D.label), 1)
3589
3613
  ], 42, ln))), 128))
3590
3614
  ], 32)) : Y("", !0)
3591
3615
  ], 4)) : Y("", !0);
3592
3616
  }
3593
- }), un = /* @__PURE__ */ ve(cn, [["__scopeId", "data-v-aca2b1c1"]]), ot = 282, fn = 4, gn = 300, _e = "flow-canvas-node-ring-target--search-match", Pe = "flow-canvas-node-ring-target--search-current", hn = "flow-canvas-node-ring-target";
3594
- function pn(n) {
3617
+ }), 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";
3618
+ function hn(n) {
3595
3619
  return n !== null;
3596
3620
  }
3597
3621
  function vn(n) {
@@ -3618,20 +3642,20 @@ function yn(n, e) {
3618
3642
  }
3619
3643
  function On(n) {
3620
3644
  let e = null, o = null, t = null, s = null, r = null, i = null;
3621
- const l = z(!1), a = z(""), v = z({ x: 0, y: 0, width: ot }), u = z(-1), h = V(() => e ? Object.values(e.flowModel.value.nodes).map((g) => yn(g, n)).filter(pn) : []), c = V(() => {
3622
- const g = a.value.trim().toLowerCase(), p = Math.max(1, n?.maxResults ?? gn);
3623
- return g ? h.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0, p) : h.value.slice(0, p);
3645
+ const l = H(!1), a = H(""), v = 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(() => {
3646
+ const g = a.value.trim().toLowerCase(), h = Math.max(1, n?.maxResults ?? gn);
3647
+ return g ? p.value.filter((m) => m.keywords.some((E) => E.toLowerCase().includes(g))).slice(0, h) : p.value.slice(0, h);
3624
3648
  });
3625
3649
  function w() {
3626
3650
  return t?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="search"]');
3627
3651
  }
3628
- function N() {
3652
+ function D() {
3629
3653
  return w()?.closest(".flow-canvas-toolbar");
3630
3654
  }
3631
3655
  function O() {
3632
- const g = N(), p = t?.getBoundingClientRect(), m = g?.getBoundingClientRect() ?? p;
3656
+ const g = D(), h = t?.getBoundingClientRect(), m = g?.getBoundingClientRect() ?? h;
3633
3657
  if (!m) return;
3634
- const E = Math.max(ot, Math.round(m.width));
3658
+ const E = Math.max(nt, Math.round(m.width));
3635
3659
  v.value = {
3636
3660
  x: mn(m.left, E),
3637
3661
  y: m.bottom + fn,
@@ -3640,87 +3664,87 @@ function On(n) {
3640
3664
  }
3641
3665
  function b(g) {
3642
3666
  if (!o) return null;
3643
- const p = o.graph.getCellById(g);
3644
- if (!p?.isNode()) return null;
3645
- const m = o.graph.findViewByCell(p)?.container;
3667
+ const h = o.graph.getCellById(g);
3668
+ if (!h?.isNode()) return null;
3669
+ const m = o.graph.findViewByCell(h)?.container;
3646
3670
  return m ? m.querySelector(".flow-canvas-highlight-target") ?? m.querySelector(".flow-canvas-node-surface > :first-child") : null;
3647
3671
  }
3648
- function M() {
3672
+ function S() {
3649
3673
  if (!o) return;
3650
3674
  const g = o.graph.getNodes();
3651
- for (const p of g) {
3652
- const m = b(p.id);
3675
+ for (const h of g) {
3676
+ const m = b(h.id);
3653
3677
  m && m.classList.remove(_e, Pe);
3654
3678
  }
3655
3679
  }
3656
- function S() {
3680
+ function M() {
3657
3681
  if (!o) return;
3658
3682
  const g = a.value.trim().toLowerCase();
3659
3683
  if (!l.value || !g) {
3660
- M();
3684
+ S();
3661
3685
  return;
3662
3686
  }
3663
- const p = new Set(c.value.map(($) => $.id)), m = u.value >= 0 ? c.value[u.value]?.id : null, E = o.graph.getNodes();
3664
- for (const $ of E) {
3665
- const U = b($.id);
3666
- U && (U.classList.add(hn), $.id === m ? (U.classList.remove(_e), U.classList.add(Pe)) : p.has($.id) ? (U.classList.remove(Pe), U.classList.add(_e)) : U.classList.remove(_e, Pe));
3687
+ const h = new Set(u.value.map((L) => L.id)), m = f.value >= 0 ? u.value[f.value]?.id : null, E = o.graph.getNodes();
3688
+ for (const L of E) {
3689
+ const z = b(L.id);
3690
+ z && (z.classList.add(pn), L.id === m ? (z.classList.remove(_e), z.classList.add(Pe)) : h.has(L.id) ? (z.classList.remove(Pe), z.classList.add(_e)) : z.classList.remove(_e, Pe));
3667
3691
  }
3668
3692
  }
3669
- function H(g) {
3693
+ function B(g) {
3670
3694
  if (!o) return;
3671
- const p = c.value.findIndex((m) => m.id === g);
3672
- p >= 0 && (u.value = p), o.api.scrollToNode(g), S();
3695
+ const h = u.value.findIndex((m) => m.id === g);
3696
+ h >= 0 && (f.value = h), o.api.scrollToNode(g), M();
3673
3697
  }
3674
- function X() {
3675
- const g = c.value;
3698
+ function j() {
3699
+ const g = u.value;
3676
3700
  if (g.length === 0) return;
3677
- const p = u.value < g.length - 1 ? u.value + 1 : 0;
3678
- u.value = p, H(g[p].id);
3701
+ const h = f.value < g.length - 1 ? f.value + 1 : 0;
3702
+ f.value = h, B(g[h].id);
3679
3703
  }
3680
3704
  function k() {
3681
- const g = c.value;
3705
+ const g = u.value;
3682
3706
  if (g.length === 0) return;
3683
- const p = u.value > 0 ? u.value - 1 : g.length - 1;
3684
- u.value = p, H(g[p].id);
3707
+ const h = f.value > 0 ? f.value - 1 : g.length - 1;
3708
+ f.value = h, B(g[h].id);
3685
3709
  }
3686
- function K() {
3710
+ function X() {
3687
3711
  o && (l.value = !0, O(), requestAnimationFrame(() => O()));
3688
3712
  }
3689
- function R() {
3690
- l.value = !1, a.value = "", u.value = -1, M();
3713
+ function U() {
3714
+ l.value = !1, a.value = "", f.value = -1, S();
3691
3715
  }
3692
- function B() {
3716
+ function G() {
3693
3717
  if (l.value) {
3694
- R();
3718
+ U();
3695
3719
  return;
3696
3720
  }
3697
- K();
3721
+ X();
3698
3722
  }
3699
- function f(g) {
3700
- const p = w();
3701
- return !!(p && g instanceof Node && p.contains(g));
3723
+ function d(g) {
3724
+ const h = w();
3725
+ return !!(h && g instanceof Node && h.contains(g));
3702
3726
  }
3703
3727
  function y() {
3704
3728
  l.value && O();
3705
3729
  }
3706
- const d = fe({
3730
+ const c = fe({
3707
3731
  name: "FlowCanvasSearchHost",
3708
3732
  setup() {
3709
3733
  return () => qe(un, {
3710
3734
  open: l.value,
3711
3735
  position: v.value,
3712
3736
  query: a.value,
3713
- results: c.value,
3714
- matchIndex: u.value,
3737
+ results: u.value,
3738
+ matchIndex: f.value,
3715
3739
  placeholder: n?.placeholder ?? "搜索节点名称",
3716
- isAnchorTarget: f,
3740
+ isAnchorTarget: d,
3717
3741
  "onUpdate:query": (g) => {
3718
- a.value = g, u.value = -1;
3742
+ a.value = g, f.value = -1;
3719
3743
  },
3720
- onSelect: H,
3721
- onNextMatch: X,
3744
+ onSelect: B,
3745
+ onNextMatch: j,
3722
3746
  onPrevMatch: k,
3723
- onClose: R
3747
+ onClose: U
3724
3748
  });
3725
3749
  }
3726
3750
  });
@@ -3731,18 +3755,18 @@ function On(n) {
3731
3755
  e = g;
3732
3756
  },
3733
3757
  attachRuntime(g) {
3734
- 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(d), r.mount(s), i = ge(
3735
- () => [a.value, c.value.length],
3758
+ 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 = ge(
3759
+ () => [a.value, u.value.length],
3736
3760
  () => {
3737
- u.value = -1, S();
3761
+ f.value = -1, M();
3738
3762
  }
3739
3763
  ), window.addEventListener("resize", y), window.addEventListener("scroll", y, !0);
3740
3764
  },
3741
3765
  detachRuntime() {
3742
- R(), i?.(), i = null, window.removeEventListener("resize", y), window.removeEventListener("scroll", y, !0), r?.unmount(), r = null, s?.remove(), s = null, t = null, o = null;
3766
+ 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;
3743
3767
  },
3744
3768
  dispose() {
3745
- R(), i?.(), i = null, e = null;
3769
+ U(), i?.(), i = null, e = null;
3746
3770
  },
3747
3771
  provideToolbarItems() {
3748
3772
  return [
@@ -3754,15 +3778,15 @@ function On(n) {
3754
3778
  group: "tools",
3755
3779
  order: 22,
3756
3780
  active: () => l.value,
3757
- onClick: B
3781
+ onClick: G
3758
3782
  }
3759
3783
  ];
3760
3784
  }
3761
3785
  };
3762
3786
  }
3763
- const nt = 52, st = 16, ht = 4, wn = 40;
3787
+ const st = 52, rt = 16, pt = 4, wn = 40;
3764
3788
  function bn(n) {
3765
- const { mountRect: e, toolbarRect: o, fallbackLeft: t, fallbackTop: s, fallbackWidth: r, height: i } = n, l = n.offset ?? ht;
3789
+ const { mountRect: e, toolbarRect: o, fallbackLeft: t, fallbackTop: s, fallbackWidth: r, height: i } = n, l = n.offset ?? pt;
3766
3790
  return !o || o.width <= 0 ? {
3767
3791
  left: t,
3768
3792
  top: s,
@@ -3783,28 +3807,28 @@ function En(n) {
3783
3807
  width: `${n.width}px`,
3784
3808
  height: `${n.height}px`
3785
3809
  }), n.floating !== !1 && Object.assign(e.style, {
3786
- top: `${nt}px`,
3787
- left: `${st}px`
3810
+ top: `${st}px`,
3811
+ left: `${rt}px`
3788
3812
  });
3789
3813
  let t = null, s = n.defaultOpen ?? !1, r = null, i = null, l = null, a = null, v = {
3790
3814
  width: n.width,
3791
3815
  height: n.height
3792
3816
  };
3793
- function u(k, K) {
3817
+ function f(k, X) {
3794
3818
  if (!t) return;
3795
- const R = t;
3796
- R.options.width = k, R.options.height = K, R.updatePaper(n.sourceGraph.container.clientWidth, n.sourceGraph.container.clientHeight);
3819
+ const U = t;
3820
+ U.options.width = k, U.options.height = X, U.updatePaper(n.sourceGraph.container.clientWidth, n.sourceGraph.container.clientHeight);
3797
3821
  }
3798
- function h() {
3822
+ function p() {
3799
3823
  if (n.floating === !1) return;
3800
3824
  const k = bn({
3801
3825
  mountRect: n.mountTarget.getBoundingClientRect(),
3802
3826
  toolbarRect: n.getToolbarElement?.()?.getBoundingClientRect() ?? null,
3803
- fallbackLeft: st,
3804
- fallbackTop: nt,
3827
+ fallbackLeft: rt,
3828
+ fallbackTop: st,
3805
3829
  fallbackWidth: n.width,
3806
3830
  height: n.height,
3807
- offset: n.panelOffset ?? ht
3831
+ offset: n.panelOffset ?? pt
3808
3832
  });
3809
3833
  v = {
3810
3834
  width: k.width,
@@ -3814,33 +3838,33 @@ function En(n) {
3814
3838
  top: `${k.top}px`,
3815
3839
  width: `${k.width}px`,
3816
3840
  height: `${k.height}px`
3817
- }), u(k.width, k.height);
3841
+ }), f(k.width, k.height);
3818
3842
  }
3819
- function c() {
3843
+ function u() {
3820
3844
  if (n.floating === !1 || typeof ResizeObserver > "u") return;
3821
3845
  const k = n.getToolbarElement?.() ?? null;
3822
3846
  i || (i = new ResizeObserver(() => {
3823
- s && (c(), h());
3847
+ s && (u(), p());
3824
3848
  })), a !== k && (i.disconnect(), i.observe(n.mountTarget), k && i.observe(k), a = k);
3825
3849
  }
3826
3850
  function w() {
3827
- n.floating !== !1 && (h(), c(), l || (l = () => {
3828
- s && (c(), h());
3851
+ n.floating !== !1 && (p(), u(), l || (l = () => {
3852
+ s && (u(), p());
3829
3853
  }, window.addEventListener("resize", l)));
3830
3854
  }
3831
- function N() {
3855
+ function D() {
3832
3856
  l && (window.removeEventListener("resize", l), l = null), i?.disconnect(), i = null, a = null;
3833
3857
  }
3834
3858
  function O() {
3835
3859
  !n.onClickOutside || r || (r = (k) => {
3836
- const K = k.target;
3837
- K && e.contains(K) || k.target?.closest('[data-toolbar-type="minimap"]') || k.target?.closest(".flow-canvas-layout__content") || n.onClickOutside();
3860
+ const X = k.target;
3861
+ X && e.contains(X) || k.target?.closest('[data-toolbar-type="minimap"]') || k.target?.closest(".flow-canvas-layout__content") || n.onClickOutside();
3838
3862
  }, document.addEventListener("mousedown", r));
3839
3863
  }
3840
3864
  function b() {
3841
3865
  r && (document.removeEventListener("mousedown", r), r = null);
3842
3866
  }
3843
- function M() {
3867
+ function S() {
3844
3868
  t || (t = new Ct({
3845
3869
  container: o,
3846
3870
  width: v.width,
@@ -3849,31 +3873,31 @@ function En(n) {
3849
3873
  scalable: !1
3850
3874
  }), n.sourceGraph.use(t));
3851
3875
  }
3852
- function S(k) {
3853
- s = k, e.style.display = s ? "" : "none", s ? (w(), M(), O(), requestAnimationFrame(() => {
3854
- s && (c(), h());
3855
- })) : (b(), N());
3876
+ function M(k) {
3877
+ s = k, e.style.display = s ? "" : "none", s ? (w(), S(), O(), requestAnimationFrame(() => {
3878
+ s && (u(), p());
3879
+ })) : (b(), D());
3856
3880
  }
3857
- function H() {
3858
- S(s), n.mountTarget.appendChild(e);
3881
+ function B() {
3882
+ M(s), n.mountTarget.appendChild(e);
3859
3883
  }
3860
- function X() {
3861
- b(), N(), t?.dispose(), t = null, e.remove();
3884
+ function j() {
3885
+ b(), D(), t?.dispose(), t = null, e.remove();
3862
3886
  }
3863
- return H(), {
3887
+ return B(), {
3864
3888
  element: e,
3865
3889
  isOpen: () => s,
3866
- setOpen: S,
3890
+ setOpen: M,
3867
3891
  toggle() {
3868
3892
  const k = !s;
3869
- return S(k), k;
3893
+ return M(k), k;
3870
3894
  },
3871
- destroy: X
3895
+ destroy: j
3872
3896
  };
3873
3897
  }
3874
3898
  function $n(n) {
3875
3899
  let e = null, o = null;
3876
- const t = z(!1);
3900
+ const t = H(!1);
3877
3901
  function s() {
3878
3902
  return o?.querySelector('.flow-canvas-toolbar__btn[data-toolbar-type="minimap"]');
3879
3903
  }
@@ -3890,14 +3914,14 @@ function $n(n) {
3890
3914
  name: "minimap",
3891
3915
  priority: 90,
3892
3916
  attachRuntime(a) {
3893
- const v = a, u = n?.width ?? 334, h = n?.height ?? 180;
3917
+ const v = a, f = n?.width ?? 334, p = n?.height ?? 180;
3894
3918
  o = v.graph.container.closest(".flow-canvas-layout__content") ?? v.graph.container.parentElement;
3895
- const c = n?.container ?? o;
3896
- c && (e = En({
3919
+ const u = n?.container ?? o;
3920
+ u && (e = En({
3897
3921
  sourceGraph: a.graph,
3898
- mountTarget: c,
3899
- width: u,
3900
- height: h,
3922
+ mountTarget: u,
3923
+ width: f,
3924
+ height: p,
3901
3925
  floating: !n?.container,
3902
3926
  defaultOpen: !1,
3903
3927
  getToolbarElement: n?.container ? void 0 : r,
@@ -3933,10 +3957,10 @@ function Bn() {
3933
3957
  if (s && o.key === "c") {
3934
3958
  const r = t.graph.getSelectedCells?.() ?? [];
3935
3959
  if (!r.length) return !1;
3936
- const i = t.flowModel.value, l = new Set(r.filter((u) => u.isNode()).map((u) => u.id)), a = [...l].map((u) => i.nodes[u]).filter(Boolean);
3960
+ 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);
3937
3961
  if (!a.length) return !1;
3938
3962
  const v = Object.values(i.edges).filter(
3939
- (u) => l.has(u.source.nodeId) && l.has(u.target.nodeId)
3963
+ (f) => l.has(f.source.nodeId) && l.has(f.target.nodeId)
3940
3964
  );
3941
3965
  return n = { nodes: a, edges: v }, e = 0, !0;
3942
3966
  }
@@ -3945,7 +3969,7 @@ function Bn() {
3945
3969
  e++;
3946
3970
  const r = e * 30, i = /* @__PURE__ */ new Map(), l = [];
3947
3971
  for (const a of n.nodes) {
3948
- const v = `${a.id}_cp${Q().slice(0, 6)}`;
3972
+ const v = `${a.id}_cp${J().slice(0, 6)}`;
3949
3973
  i.set(a.id, v), l.push({
3950
3974
  type: "node.add",
3951
3975
  node: {
@@ -3961,21 +3985,21 @@ function Bn() {
3961
3985
  });
3962
3986
  }
3963
3987
  for (const a of n.edges) {
3964
- const v = i.get(a.source.nodeId), u = i.get(a.target.nodeId);
3965
- !v || !u || l.push({
3988
+ const v = i.get(a.source.nodeId), f = i.get(a.target.nodeId);
3989
+ !v || !f || l.push({
3966
3990
  type: "edge.add",
3967
3991
  edge: {
3968
3992
  ...a,
3969
- id: `${a.id}_cp${Q().slice(0, 6)}`,
3993
+ id: `${a.id}_cp${J().slice(0, 6)}`,
3970
3994
  source: { ...a.source, nodeId: v },
3971
- target: { ...a.target, nodeId: u },
3972
- labels: a.labels?.map((h) => ({ ...h, id: `${h.id}_cp${Q().slice(0, 6)}` })),
3995
+ target: { ...a.target, nodeId: f },
3996
+ labels: a.labels?.map((p) => ({ ...p, id: `${p.id}_cp${J().slice(0, 6)}` })),
3973
3997
  payload: a.payload ? { ...a.payload } : {}
3974
3998
  }
3975
3999
  });
3976
4000
  }
3977
4001
  return l.length && t.executeCommand({
3978
- id: Q(),
4002
+ id: J(),
3979
4003
  source: "user:keyboard",
3980
4004
  label: "粘贴",
3981
4005
  timestamp: Date.now(),
@@ -3989,7 +4013,7 @@ function Bn() {
3989
4013
  export {
3990
4014
  ue as CanvasConstraintError,
3991
4015
  An as CanvasLayout,
3992
- Lo as CanvasNodePalette,
4016
+ Ro as CanvasNodePalette,
3993
4017
  Dn as CanvasRuntime,
3994
4018
  kt as CanvasSchemaError,
3995
4019
  _n as CanvasToolbar,
@@ -4004,10 +4028,10 @@ export {
4004
4028
  Pn as createDefaultSchema,
4005
4029
  Ho as createDefaultToolbarItems,
4006
4030
  Mn as createEmptyFlowModel,
4007
- Q as generateId,
4031
+ J as generateId,
4008
4032
  $n as minimapPlugin,
4009
4033
  On as searchPlugin,
4010
- Ln as selectionPlugin,
4011
- Rn as snaplinePlugin,
4034
+ Rn as selectionPlugin,
4035
+ Ln as snaplinePlugin,
4012
4036
  Nn as useCanvasEditor
4013
4037
  };