vue3-network-graph 0.1.3 → 0.1.5

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.mjs CHANGED
@@ -212,14 +212,14 @@ var b = {
212
212
  "transform",
213
213
  "fill",
214
214
  "font-size"
215
- ], mt = ["transform"], ht = ["stroke"], gt = { class: "node-icon" }, _t = ["fill"], vt = ["transform"], yt = ["fill"], bt = [
215
+ ], mt = ["r", "stroke"], ht = ["values"], gt = ["transform"], _t = ["fill"], vt = ["transform"], yt = ["fill"], bt = [
216
216
  "y",
217
217
  "transform",
218
218
  "fill",
219
219
  "font-size",
220
220
  "font-weight"
221
221
  ], xt = ["dy"], St = {
222
- key: 5,
222
+ key: 6,
223
223
  class: "node-handles"
224
224
  }, Ct = [
225
225
  "cx",
@@ -298,7 +298,7 @@ var b = {
298
298
  setup(_, { expose: te, emit: ne }) {
299
299
  let v = _, y = ne, Rt = 0, zt = () => {
300
300
  Rt++;
301
- }, S = (e) => e && typeof e == "object" ? {
301
+ }, Bt = (e) => e && typeof e == "object" ? {
302
302
  text: e.text,
303
303
  rotation: e.rotation || 0,
304
304
  fontSize: e.fontSize,
@@ -308,106 +308,106 @@ var b = {
308
308
  rotation: 0,
309
309
  fontSize: void 0,
310
310
  color: void 0
311
- }, Bt = (e, t = 11) => e.fontSize || t, Vt = (e) => e.fontColor || "#000000", Ht = (e, t = 500) => e.fontWeight || t, C = (e, t) => e.fontSize || S(t).fontSize || 8, w = (e, t) => e.fontColor || S(t).color || "#000000", T = d(v.nodes.map((e) => ({ ...e }))), Ut = null, E = () => {
312
- Ut = T.value, y("update:nodes", T.value);
311
+ }, Vt = (e, t = 11) => e.fontSize || t, Ht = (e) => e.fontColor || "#000000", Ut = (e, t = 500) => e.fontWeight || t, Wt = (e, t) => e.fontSize || Bt(t).fontSize || 8, S = (e, t) => e.fontColor || Bt(t).color || "#000000", C = d(v.nodes.map((e) => ({ ...e }))), Gt = null, w = () => {
312
+ Gt = C.value, y("update:nodes", C.value);
313
313
  };
314
314
  h(() => v.nodes, (e) => {
315
315
  let t = Array.isArray(e) ? e : [];
316
- if (t === Ut) return;
316
+ if (t === Gt) return;
317
317
  let n = null, r = null;
318
318
  try {
319
- n = JSON.stringify(t), r = JSON.stringify(T.value);
319
+ n = JSON.stringify(t), r = JSON.stringify(C.value);
320
320
  } catch {
321
321
  n = null;
322
322
  }
323
- (n === null || n !== r) && (zt(), T.value = t.map((e) => ({ ...e })));
323
+ (n === null || n !== r) && (zt(), C.value = t.map((e) => ({ ...e })));
324
324
  }, { deep: !0 });
325
- let Wt = d(v.lineMode);
325
+ let Kt = d(v.lineMode);
326
326
  h(() => v.lineMode, (e) => {
327
- Wt.value = e;
327
+ Kt.value = e;
328
328
  });
329
- let Gt = t({
330
- get: () => Wt.value,
329
+ let T = t({
330
+ get: () => Kt.value,
331
331
  set: (e) => {
332
- Wt.value = e, y("update:lineMode", e);
332
+ Kt.value = e, y("update:lineMode", e);
333
333
  }
334
- }), D = d(null), O = d(null), Kt = d({
334
+ }), E = d(null), D = d(null), qt = d({
335
335
  x: 0,
336
336
  y: 0
337
- }), qt = d(null), Jt = null, Yt = !1, Xt = !1, k = d([]), A = d(/* @__PURE__ */ new Map()), j = d(/* @__PURE__ */ new Set()), M = t(() => {
337
+ }), Jt = d(null), Yt = null, Xt = !1, Zt = !1, O = d([]), k = d(/* @__PURE__ */ new Map()), A = d(/* @__PURE__ */ new Set()), j = t(() => {
338
338
  let e = v.edges, t = [];
339
- if (k.value.length) {
339
+ if (O.value.length) {
340
340
  let n = new Set(e.map((e) => e.id));
341
- t = k.value.filter((e) => !n.has(e.id));
341
+ t = O.value.filter((e) => !n.has(e.id));
342
342
  }
343
- let n = t.length ? [...e, ...t] : e, r = A.value;
343
+ let n = t.length ? [...e, ...t] : e, r = k.value;
344
344
  r.size && (n = n.map((e) => r.has(e.id) ? {
345
345
  ...e,
346
346
  ...r.get(e.id)
347
347
  } : e));
348
- let i = new Set(T.value.map((e) => e.id)), a = j.value;
348
+ let i = new Set(C.value.map((e) => e.id)), a = A.value;
349
349
  return n.filter((e) => !a.has(e.id) && i.has(e.from) && i.has(e.to));
350
- }), Zt = t(() => v.config.watchDataChanges === !0), Qt = d({
350
+ }), Qt = t(() => v.config.watchDataChanges === !0), $t = d({
351
351
  nodes: [],
352
352
  edges: []
353
- }), $t = "", N = null, en = () => JSON.parse(JSON.stringify({
354
- nodes: T.value,
355
- edges: M.value
356
- })), tn = (e, t) => {
353
+ }), en = "", M = null, tn = () => JSON.parse(JSON.stringify({
354
+ nodes: C.value,
355
+ edges: j.value
356
+ })), nn = (e, t) => {
357
357
  let n = new Map(e.map((e) => [e.id, e])), r = new Map(t.map((e) => [e.id, e]));
358
358
  return {
359
359
  added: t.filter((e) => !n.has(e.id)).map((e) => e.id),
360
360
  removed: e.filter((e) => !r.has(e.id)).map((e) => e.id),
361
361
  updated: t.filter((e) => n.has(e.id) && JSON.stringify(n.get(e.id)) !== JSON.stringify(e)).map((e) => e.id)
362
362
  };
363
- }, nn = (e) => ({
364
- nodes: tn(Qt.value.nodes, e.nodes),
365
- edges: tn(Qt.value.edges, e.edges)
366
- }), rn = () => {
367
- if (N = null, !Zt.value) return;
368
- let e = en(), t = JSON.stringify(e);
369
- if (t === $t) return;
370
- let n = nn(e), r = n.nodes.added.length + n.nodes.removed.length + n.nodes.updated.length + n.edges.added.length + n.edges.removed.length + n.edges.updated.length;
371
- $t = t, r && y("data-change", {
363
+ }, rn = (e) => ({
364
+ nodes: nn($t.value.nodes, e.nodes),
365
+ edges: nn($t.value.edges, e.edges)
366
+ }), an = () => {
367
+ if (M = null, !Qt.value) return;
368
+ let e = tn(), t = JSON.stringify(e);
369
+ if (t === en) return;
370
+ let n = rn(e), r = n.nodes.added.length + n.nodes.removed.length + n.nodes.updated.length + n.edges.added.length + n.edges.removed.length + n.edges.updated.length;
371
+ en = t, r && y("data-change", {
372
372
  nodes: e.nodes,
373
373
  edges: e.edges,
374
374
  summary: n
375
375
  });
376
- }, an = () => {
377
- Zt.value && (N && clearTimeout(N), N = setTimeout(rn, 300));
378
376
  }, on = () => {
379
- N &&= (clearTimeout(N), null), Qt.value = en(), $t = "";
377
+ Qt.value && (M && clearTimeout(M), M = setTimeout(an, 300));
378
+ }, sn = () => {
379
+ M &&= (clearTimeout(M), null), $t.value = tn(), en = "";
380
380
  };
381
381
  h([
382
- T,
383
- k,
384
- j,
385
- A
386
- ], () => an(), { deep: !0 }), h(Zt, (e) => {
387
- e ? on() : N &&= (clearTimeout(N), null);
382
+ C,
383
+ O,
384
+ A,
385
+ k
386
+ ], () => on(), { deep: !0 }), h(Qt, (e) => {
387
+ e ? sn() : M &&= (clearTimeout(M), null);
388
388
  }), l(() => {
389
- Zt.value && on();
389
+ Qt.value && sn();
390
390
  });
391
- let sn = () => en(), cn = () => {
392
- let e = new Set(z.value), t = new Set(B.value), n = T.value.filter((t) => e.has(t.id)), r = M.value.filter((n) => t.has(n.id) || e.has(n.from) || e.has(n.to));
391
+ let cn = () => tn(), ln = () => {
392
+ let e = new Set(R.value), t = new Set(z.value), n = C.value.filter((t) => e.has(t.id)), r = j.value.filter((n) => t.has(n.id) || e.has(n.from) || e.has(n.to));
393
393
  return !n.length && !r.length ? {
394
394
  nodes: [],
395
395
  edges: []
396
- } : (n.length && (T.value = T.value.filter((t) => !e.has(t.id)), E()), r.length && (j.value = /* @__PURE__ */ new Set([...j.value, ...r.map((e) => e.id)]), k.value = k.value.filter((e) => !j.value.has(e.id)), y("edge-remove", r.map((e) => JSON.parse(JSON.stringify(e))))), z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V(), JSON.parse(JSON.stringify({
396
+ } : (n.length && (C.value = C.value.filter((t) => !e.has(t.id)), w()), r.length && (A.value = /* @__PURE__ */ new Set([...A.value, ...r.map((e) => e.id)]), O.value = O.value.filter((e) => !A.value.has(e.id)), y("edge-remove", r.map((e) => JSON.parse(JSON.stringify(e))))), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), JSON.parse(JSON.stringify({
397
397
  nodes: n,
398
398
  edges: r
399
399
  })));
400
- }, ln = (e) => {
401
- let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(T.value.map((e) => e.id)), r = [];
400
+ }, un = (e) => {
401
+ let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(C.value.map((e) => e.id)), r = [];
402
402
  for (let e of t) {
403
403
  let t = JSON.parse(JSON.stringify(e));
404
404
  if (t.id == null) t.id = re();
405
405
  else if (n.has(t.id)) continue;
406
406
  n.add(t.id), r.push(t);
407
407
  }
408
- return r.length ? (T.value = [...T.value, ...r], E(), JSON.parse(JSON.stringify(r))) : [];
409
- }, un = (e) => {
410
- let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(M.value.map((e) => e.id)), r = [];
408
+ return r.length ? (C.value = [...C.value, ...r], w(), JSON.parse(JSON.stringify(r))) : [];
409
+ }, dn = (e) => {
410
+ let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(j.value.map((e) => e.id)), r = [];
411
411
  for (let e of t) {
412
412
  let t = JSON.parse(JSON.stringify(e));
413
413
  if (t.from != null && t.to != null) {
@@ -417,13 +417,13 @@ var b = {
417
417
  }
418
418
  }
419
419
  if (!r.length) return [];
420
- let i = r.filter((e) => j.value.has(e.id));
420
+ let i = r.filter((e) => A.value.has(e.id));
421
421
  if (i.length) {
422
422
  let e = new Set(i.map((e) => e.id));
423
- j.value = new Set([...j.value].filter((t) => !e.has(t)));
423
+ A.value = new Set([...A.value].filter((t) => !e.has(t)));
424
424
  }
425
- return k.value = [...k.value, ...r], r.forEach((e) => y("edge-create", JSON.parse(JSON.stringify(e)))), JSON.parse(JSON.stringify(r));
426
- }, dn = (e) => {
425
+ return O.value = [...O.value, ...r], r.forEach((e) => y("edge-create", JSON.parse(JSON.stringify(e)))), JSON.parse(JSON.stringify(r));
426
+ }, fn = (e) => {
427
427
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
428
428
  if (!t.length) return [];
429
429
  let n = /* @__PURE__ */ new Map();
@@ -436,7 +436,7 @@ var b = {
436
436
  });
437
437
  }
438
438
  let r = [];
439
- return T.value = T.value.map((e) => {
439
+ return C.value = C.value.map((e) => {
440
440
  let t = n.get(e.id);
441
441
  if (!t) return e;
442
442
  let i = {
@@ -444,11 +444,11 @@ var b = {
444
444
  ...t
445
445
  };
446
446
  return r.push(i), i;
447
- }), r.length ? (E(), JSON.parse(JSON.stringify(r))) : [];
448
- }, fn = (e) => {
447
+ }), r.length ? (w(), JSON.parse(JSON.stringify(r))) : [];
448
+ }, pn = (e) => {
449
449
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
450
450
  if (!t.length) return [];
451
- let n = new Set(M.value.map((e) => e.id)), r = new Map(A.value), i = [];
451
+ let n = new Set(j.value.map((e) => e.id)), r = new Map(k.value), i = [];
452
452
  for (let e of t) {
453
453
  let { id: t, ...a } = e;
454
454
  if (!n.has(t)) continue;
@@ -459,36 +459,36 @@ var b = {
459
459
  ...o
460
460
  };
461
461
  r.set(t, s);
462
- let c = M.value.find((e) => e.id === t);
462
+ let c = j.value.find((e) => e.id === t);
463
463
  i.push({
464
464
  ...c,
465
465
  ...s
466
466
  });
467
467
  }
468
- return i.length ? (A.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
469
- }, pn = (e) => {
468
+ return i.length ? (k.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
469
+ }, mn = (e) => {
470
470
  let t = e && typeof e == "object" ? e : null;
471
- return k.value = [], j.value = /* @__PURE__ */ new Set(), A.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (T.value = JSON.parse(JSON.stringify(t.nodes)), E()) : (T.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Ut = T.value), z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V(), on(), en();
471
+ return O.value = [], A.value = /* @__PURE__ */ new Set(), k.value = /* @__PURE__ */ new Map(), t && Array.isArray(t.nodes) ? (C.value = JSON.parse(JSON.stringify(t.nodes)), w()) : (C.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Gt = C.value), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), sn(), tn();
472
472
  };
473
473
  h(() => v.edges, (e) => {
474
474
  zt();
475
475
  let t = Array.isArray(e) ? e : [], n = new Set(t.map((e) => e.id));
476
- if (k.value.length) {
477
- let e = k.value.filter((e) => !n.has(e.id));
478
- e.length !== k.value.length && (k.value = e);
476
+ if (O.value.length) {
477
+ let e = O.value.filter((e) => !n.has(e.id));
478
+ e.length !== O.value.length && (O.value = e);
479
479
  }
480
- if (A.value.size) {
481
- let e = new Map(A.value), n = new Set(k.value.map((e) => e.id)), r = !1;
480
+ if (k.value.size) {
481
+ let e = new Map(k.value), n = new Set(O.value.map((e) => e.id)), r = !1;
482
482
  for (let [i, a] of e) {
483
483
  let o = t.find((e) => e.id === i);
484
484
  o ? Object.entries(a).every(([e, t]) => JSON.stringify(o[e] ?? null) === JSON.stringify(t ?? null)) && (e.delete(i), r = !0) : n.has(i) || (e.delete(i), r = !0);
485
485
  }
486
- r && (A.value = e);
486
+ r && (k.value = e);
487
487
  }
488
488
  }, { deep: !0 });
489
- let P = t(() => {
489
+ let N = t(() => {
490
490
  let e = {};
491
- M.value.forEach((t) => {
491
+ j.value.forEach((t) => {
492
492
  let n = [t.from, t.to].sort().join("__");
493
493
  e[n] || (e[n] = []), e[n].push(t);
494
494
  });
@@ -524,36 +524,39 @@ var b = {
524
524
  };
525
525
  });
526
526
  }), t;
527
- }), mn = t(() => {
527
+ }), hn = t(() => {
528
528
  let e = /* @__PURE__ */ new Map();
529
- for (let t of T.value) e.set(t.id, t);
529
+ for (let t of C.value) e.set(t.id, t);
530
530
  return e;
531
- }), F = (e) => mn.value.get(e), I = (e) => e.state != "none" && b[e.state] && b[e.state].color || "#00f0ff", hn = (e) => b[e.state] || b.normal, gn = (e) => e.type === "text", _n = (e, t) => {
531
+ }), P = (e) => hn.value.get(e), F = (e) => e.state != "none" && b[e.state] && b[e.state].color || "#00f0ff", gn = (e) => b[e.state] || b.normal, _n = (e) => e.nodeType === "text", vn = (e) => e.nodeType === "border-only", yn = (e, t) => {
532
532
  let n = Number(e);
533
533
  return Number.isFinite(n) && n > 0 ? n : t;
534
- }, vn = (e) => {
535
- let t = _n(e.width, x), n = _n(e.height, x);
534
+ }, bn = (e) => {
535
+ let t = yn(e.width, x), n = yn(e.height, x);
536
536
  return {
537
537
  sx: t / x,
538
538
  sy: n / x
539
539
  };
540
- }, yn = (e) => {
541
- let { sx: t, sy: n } = vn(e);
540
+ }, xn = (e) => {
541
+ let t = Math.max(e.width, e.height);
542
+ return isNaN(t) ? 30 : t / 2;
543
+ }, Sn = (e) => {
544
+ let { sx: t, sy: n } = bn(e);
542
545
  return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
543
- }, bn = (e) => {
544
- let { w: t, h: n } = L(e), r = Math.min(10, t * .3), i = Math.min(10, n * .3);
546
+ }, Cn = (e) => {
547
+ let { w: t, h: n } = I(e), r = Math.min(10, t * .3), i = Math.min(10, n * .3);
545
548
  return `translate(${t / 2 - r}, ${-(n / 2 - i)})`;
546
- }, xn = t(() => {
549
+ }, wn = t(() => {
547
550
  let e = Number(v.config.labelGap);
548
551
  return Number.isFinite(e) && e >= 0 ? e : 18;
549
- }), Sn = (e) => {
550
- if (gn(e)) return 4;
551
- let { h: t } = L(e);
552
- return e.labelPosition === "top" ? -(t / 2 + xn.value) : e.labelPosition === "center" ? 0 : t / 2 + xn.value;
553
- }, Cn = (e) => {
554
- let t = R(e);
555
- if (gn(e) || !e.label) return t;
556
- let n = Bt(e), r = Sn(e);
552
+ }), Tn = (e) => {
553
+ if (_n(e)) return 4;
554
+ let { h: t } = I(e);
555
+ return e.labelPosition === "top" ? -(t / 2 + wn.value) : e.labelPosition === "center" ? 0 : t / 2 + wn.value;
556
+ }, En = (e) => {
557
+ let t = L(e);
558
+ if (_n(e) || !e.label) return t;
559
+ let n = Vt(e), r = Tn(e);
557
560
  if (e.labelPosition === "top") {
558
561
  let e = r - n - 4;
559
562
  e < t.y && (t.height += t.y - e, t.y = e);
@@ -562,123 +565,147 @@ var b = {
562
565
  i > t.y + t.height && (t.height = i - t.y);
563
566
  }
564
567
  return t;
565
- }, wn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, L = (e) => {
566
- let t = gn(e);
568
+ }, Dn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, I = (e) => {
569
+ let t = _n(e), n = vn(e);
567
570
  return {
568
- w: _n(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : x),
569
- h: _n(e.height, t ? 26 : x)
571
+ w: yn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : n ? Math.max(80, String(e.label).length * 8 + 24) : x),
572
+ h: yn(e.height, t ? 26 : n ? 40 : x)
570
573
  };
571
- }, R = (e) => {
572
- let { w: t, h: n } = L(e);
574
+ }, L = (e) => {
575
+ let { w: t, h: n } = I(e);
573
576
  return {
574
577
  x: -t / 2,
575
578
  y: -n / 2,
576
579
  width: t,
577
580
  height: n
578
581
  };
579
- }, Tn = (e) => wn(e) ? R(e) : null, En = (e) => e.background && e.background !== "none" ? e.background : null, z = d([]), B = d([]);
580
- t(() => z.value.length === 1 ? z.value[0] : null), t(() => B.value.length === 1 ? B.value[0] : null);
581
- let Dn = (e) => z.value.includes(e.id), On = (e) => B.value.includes(e.id), V = () => {
582
+ }, On = (e) => Dn(e) ? L(e) : null, kn = (e) => e.background && e.background !== "none" ? e.background : null, R = d([]), z = d([]);
583
+ t(() => R.value.length === 1 ? R.value[0] : null), t(() => z.value.length === 1 ? z.value[0] : null);
584
+ let An = (e) => R.value.includes(e.id), jn = (e) => z.value.includes(e.id), B = () => {
582
585
  y("selection-change", {
583
- nodes: T.value.filter((e) => z.value.includes(e.id)),
584
- edges: M.value.filter((e) => B.value.includes(e.id))
586
+ nodes: C.value.filter((e) => R.value.includes(e.id)),
587
+ edges: j.value.filter((e) => z.value.includes(e.id))
585
588
  });
586
- }, kn = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 ? Math.floor(e) : Infinity : typeof e == "string" && /^\d+$/.test(e.trim()) ? parseInt(e.trim(), 10) : Infinity, An = t(() => kn(v.config.maxSelectNodes)), jn = t(() => kn(v.config.maxSelectEdges)), H = (e, t, n) => {
589
+ }, Mn = (e) => typeof e == "number" ? Number.isFinite(e) && e >= 0 ? Math.floor(e) : Infinity : typeof e == "string" && /^\d+$/.test(e.trim()) ? parseInt(e.trim(), 10) : Infinity, Nn = t(() => Mn(v.config.maxSelectNodes)), Pn = t(() => Mn(v.config.maxSelectEdges)), V = (e, t, n) => {
587
590
  let r = new Set(e), i = [];
588
591
  for (let e of t) r.has(e) || (r.add(e), i.push(e));
589
592
  if (n === Infinity) return [...e, ...i];
590
593
  let a = Math.max(0, n - e.length);
591
594
  return [...e, ...i.slice(0, a)];
592
595
  };
593
- h([An, jn], ([e, t]) => {
596
+ h([Nn, Pn], ([e, t]) => {
594
597
  let n = !1;
595
- z.value.length > e && (z.value = z.value.slice(0, e), n = !0), B.value.length > t && (B.value = B.value.slice(0, t), n = !0), n && V();
598
+ R.value.length > e && (R.value = R.value.slice(0, e), n = !0), z.value.length > t && (z.value = z.value.slice(0, t), n = !0), n && B();
596
599
  });
597
- let Mn = t(() => v.config.selectedBorderColor || "#fbbf24"), Nn = (e, t) => {
598
- if (!Rn()) {
600
+ let Fn = t(() => v.config.selectedBorderColor || "#fbbf24"), In = (e, t) => {
601
+ if (!Kn()) {
599
602
  if (t && (t.ctrlKey || t.metaKey)) {
600
- let t = z.value.indexOf(e.id);
601
- t >= 0 ? z.value.splice(t, 1) : z.value = H(z.value, [e.id], An.value);
603
+ let t = R.value.indexOf(e.id);
604
+ t >= 0 ? R.value.splice(t, 1) : R.value = V(R.value, [e.id], Nn.value);
602
605
  } else {
603
- let t = z.value.length === 1 && z.value[0] === e.id;
604
- z.value = t ? [] : H([], [e.id], An.value), B.value = [];
606
+ let t = R.value.length === 1 && R.value[0] === e.id;
607
+ R.value = t ? [] : V([], [e.id], Nn.value), z.value = [];
605
608
  }
606
- y("node-click", e), y("node-select", Dn(e) ? e : null), V();
609
+ y("node-click", e), y("node-select", An(e) ? e : null), B();
607
610
  }
608
- }, Pn = t(() => v.config.selectedLineColor || "#fbbf24"), Fn = (e, t) => {
609
- if (Rn()) return;
610
- let n = P.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
611
- let t = P.value[e.id];
611
+ }, Ln = (e) => {
612
+ let t = C.value.find((t) => t.id === e);
613
+ if (!t || v.config.enableZOrder === !1) return !1;
614
+ let n = t.zIndex ?? 0, r = C.value.filter((e) => (e.zIndex ?? 0) > n);
615
+ return r.length !== 0 && (t.zIndex = Math.min(...r.map((e) => e.zIndex ?? 0)), !0);
616
+ }, Rn = (e) => {
617
+ let t = C.value.find((t) => t.id === e);
618
+ if (!t || v.config.enableZOrder === !1) return !1;
619
+ let n = t.zIndex ?? 0, r = C.value.filter((e) => (e.zIndex ?? 0) < n);
620
+ return r.length !== 0 && (t.zIndex = Math.max(...r.map((e) => e.zIndex ?? 0)), !0);
621
+ }, zn = (e) => {
622
+ let t = C.value.find((t) => t.id === e);
623
+ return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.max(...C.value.map((e) => e.zIndex ?? 0), 0) + 1, !0);
624
+ }, Bn = (e) => {
625
+ let t = C.value.find((t) => t.id === e);
626
+ return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.min(...C.value.map((e) => e.zIndex ?? 0), 0) - 1, !0);
627
+ }, Vn = () => {
628
+ if (!D.value) return;
629
+ let e = D.value.cloneNode(!0);
630
+ e.querySelectorAll("animate, animateMotion, animateTransform, set").forEach((e) => e.remove()), e.querySelectorAll(".center-crosshair").forEach((e) => e.remove()), e.setAttribute("width", H.value || "800"), e.setAttribute("height", U.value || "600");
631
+ let t = new XMLSerializer().serializeToString(e);
632
+ t = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + t;
633
+ let n = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("a");
634
+ i.href = r, i.download = `topology-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.svg`, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
635
+ }, Hn = t(() => v.config.selectedLineColor || "#fbbf24"), Un = (e, t) => {
636
+ if (Kn()) return;
637
+ let n = N.value[e.id], r = !!(n && n.merged && n.representative), i = r ? j.value.filter((e) => {
638
+ let t = N.value[e.id];
612
639
  return t && t.key === n.key;
613
640
  }) : null, a = r ? i.map((e) => e.id) : [e.id], o = r ? {
614
641
  ...e,
615
642
  bundleEdges: i
616
643
  } : e;
617
- if (t && (t.ctrlKey || t.metaKey)) a.every((e) => B.value.includes(e)) ? B.value = B.value.filter((e) => !a.includes(e)) : B.value = H(B.value, a, jn.value);
644
+ if (t && (t.ctrlKey || t.metaKey)) a.every((e) => z.value.includes(e)) ? z.value = z.value.filter((e) => !a.includes(e)) : z.value = V(z.value, a, Pn.value);
618
645
  else {
619
- let e = a.length === B.value.length && a.every((e) => B.value.includes(e));
620
- B.value = e ? [] : H([], a, jn.value), z.value = [];
646
+ let e = a.length === z.value.length && a.every((e) => z.value.includes(e));
647
+ z.value = e ? [] : V([], a, Pn.value), R.value = [];
621
648
  }
622
- y("edge-select", On(e) ? o : null), V();
623
- }, In = 0, Ln = (e = 200) => {
624
- In = performance.now() + e;
625
- }, Rn = () => performance.now() < In, zn = () => {
626
- z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V();
627
- }, Bn = (e) => {
628
- if (Rn()) return;
649
+ y("edge-select", jn(e) ? o : null), B();
650
+ }, Wn = 0, Gn = (e = 200) => {
651
+ Wn = performance.now() + e;
652
+ }, Kn = () => performance.now() < Wn, qn = () => {
653
+ R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B();
654
+ }, Jn = (e) => {
655
+ if (Kn()) return;
629
656
  let t = e.target;
630
- t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || zn();
631
- }, Vn = d({
657
+ t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || qn();
658
+ }, Yn = d({
632
659
  width: 1e3,
633
660
  height: 650
634
- }), Hn = d(1), Un = d(0), Wn = d(0), Gn = t(() => -qn.value / 2 + Un.value), Kn = t(() => -Jn.value / 2 + Wn.value), qn = t(() => v.width ?? Vn.value.width), Jn = t(() => v.height ?? Vn.value.height), Yn = null;
661
+ }), Xn = d(1), Zn = d(0), Qn = d(0), $n = t(() => -tr.value / 2 + Zn.value), er = t(() => -nr.value / 2 + Qn.value), tr = t(() => v.width ?? Yn.value.width), nr = t(() => v.height ?? Yn.value.height), rr = null;
635
662
  l(() => {
636
- let e = O.value;
663
+ let e = D.value;
637
664
  if (e) {
638
665
  let t = e.getBoundingClientRect();
639
- t.width > 0 && t.height > 0 && (Vn.value = {
666
+ t.width > 0 && t.height > 0 && (Yn.value = {
640
667
  width: t.width,
641
668
  height: t.height
642
669
  });
643
670
  }
644
- e && typeof ResizeObserver < "u" && (Yn = new ResizeObserver(() => {
671
+ e && typeof ResizeObserver < "u" && (rr = new ResizeObserver(() => {
645
672
  let t = e.getBoundingClientRect();
646
- t.width > 0 && t.height > 0 && (Vn.value = {
673
+ t.width > 0 && t.height > 0 && (Yn.value = {
647
674
  width: t.width,
648
675
  height: t.height
649
676
  });
650
- }), Yn.observe(e));
677
+ }), rr.observe(e));
651
678
  }), c(() => {
652
- Yn &&= (Yn.disconnect(), null), Lr &&= (cancelAnimationFrame(Lr), 0), J &&= (cancelAnimationFrame(J), 0), ti &&= (cancelAnimationFrame(ti), 0), ci(), mr();
679
+ rr &&= (rr.disconnect(), null), J &&= (cancelAnimationFrame(J), 0), q &&= (cancelAnimationFrame(q), 0), ci &&= (cancelAnimationFrame(ci), 0), hi(), Sr();
653
680
  });
654
- let U = t(() => qn.value / Hn.value), W = t(() => Jn.value / Hn.value), Xn = t(() => ({
655
- x0: Gn.value - Mt,
656
- y0: Kn.value - Mt,
657
- x1: Gn.value + U.value + Mt,
658
- y1: Kn.value + W.value + Mt
659
- })), Zn = t(() => {
660
- let e = Xn.value;
661
- return T.value.filter((t) => {
662
- let { w: n, h: r } = L(t);
681
+ let H = t(() => tr.value / Xn.value), U = t(() => nr.value / Xn.value), ir = t(() => ({
682
+ x0: $n.value - Mt,
683
+ y0: er.value - Mt,
684
+ x1: $n.value + H.value + Mt,
685
+ y1: er.value + U.value + Mt
686
+ })), ar = t(() => {
687
+ let e = ir.value, t = C.value.filter((t) => {
688
+ let { w: n, h: r } = I(t);
663
689
  return t.x + n / 2 >= e.x0 && t.x - n / 2 <= e.x1 && t.y + r / 2 >= e.y0 && t.y - r / 2 <= e.y1;
664
690
  });
665
- }), G = t(() => {
666
- let e = Xn.value;
667
- return M.value.filter((t) => {
668
- if (!wi(t)) return !1;
669
- let n = F(t.from), r = F(t.to);
691
+ return v.config.enableZOrder !== !1 && t.sort((e, t) => (e.zIndex ?? 0) - (t.zIndex ?? 0)), t;
692
+ }), W = t(() => {
693
+ let e = ir.value;
694
+ return j.value.filter((t) => {
695
+ if (!ji(t)) return !1;
696
+ let n = P(t.from), r = P(t.to);
670
697
  if (!n || !r) return !1;
671
- let i = L(n).w / 2, a = L(n).h / 2, o = L(r).w / 2, s = L(r).h / 2;
698
+ let i = I(n).w / 2, a = I(n).h / 2, o = I(r).w / 2, s = I(r).h / 2;
672
699
  return Math.min(n.x - i, r.x - o) - Nt <= e.x1 && Math.max(n.x + i, r.x + o) + Nt >= e.x0 && Math.min(n.y - a, r.y - s) - Nt <= e.y1 && Math.max(n.y + a, r.y + s) + Nt >= e.y0;
673
700
  });
674
- }), Qn = (e) => {
701
+ }), or = (e) => {
675
702
  if (v.config.enableZoom === !1) return;
676
703
  e.preventDefault();
677
- let t = O.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o = U.value, s = W.value, c = e.deltaY > 0 ? .9 : 1.1, l = Math.min(jt, Math.max(At, Hn.value * c)), u = qn.value / l, d = Jn.value / l;
678
- Un.value += (o - u) * i, Wn.value += (s - d) * a, Hn.value = l;
679
- }, K = d(null), q = d(null), $n = (e) => {
680
- let t = O.value, n = t ? t.getBoundingClientRect() : null;
681
- K.value = {
704
+ let t = D.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o = H.value, s = U.value, c = e.deltaY > 0 ? .9 : 1.1, l = Math.min(jt, Math.max(At, Xn.value * c)), u = tr.value / l, d = nr.value / l;
705
+ Zn.value += (o - u) * i, Qn.value += (s - d) * a, Xn.value = l;
706
+ }, G = d(null), K = d(null), sr = (e) => {
707
+ let t = D.value, n = t ? t.getBoundingClientRect() : null;
708
+ G.value = {
682
709
  startX: e.clientX,
683
710
  startY: e.clientY,
684
711
  lastX: e.clientX,
@@ -686,9 +713,9 @@ var b = {
686
713
  moved: !1,
687
714
  rectWidth: n && n.width ? n.width : 0,
688
715
  rectHeight: n && n.height ? n.height : 0
689
- }, pr();
690
- }, er = (e) => {
691
- let t = K.value, n = O.value;
716
+ }, xr();
717
+ }, cr = (e) => {
718
+ let t = G.value, n = D.value;
692
719
  if (!t || !n) return;
693
720
  let r = t.rectWidth, i = t.rectHeight;
694
721
  if (!r || !i) return;
@@ -698,13 +725,13 @@ var b = {
698
725
  return;
699
726
  }
700
727
  let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
701
- t.lastX = e.clientX, t.lastY = e.clientY, Un.value -= a * (U.value / r), Wn.value -= o * (W.value / i);
702
- }, tr = () => {
703
- let e = K.value;
704
- K.value = null, e && e.moved && Ln(), hr();
705
- }, nr = (e) => {
728
+ t.lastX = e.clientX, t.lastY = e.clientY, Zn.value -= a * (H.value / r), Qn.value -= o * (U.value / i);
729
+ }, lr = () => {
730
+ let e = G.value;
731
+ G.value = null, e && e.moved && Gn(), Cr();
732
+ }, ur = (e) => {
706
733
  let t = Z(e);
707
- q.value = {
734
+ K.value = {
708
735
  start: {
709
736
  x: t.x,
710
737
  y: t.y
@@ -716,17 +743,17 @@ var b = {
716
743
  startClientX: e.clientX,
717
744
  startClientY: e.clientY,
718
745
  moved: !1
719
- }, pr();
720
- }, rr = (e) => {
721
- let t = q.value;
746
+ }, xr();
747
+ }, dr = (e) => {
748
+ let t = K.value;
722
749
  if (!t) return;
723
750
  let n = Z(e);
724
751
  t.current = {
725
752
  x: n.x,
726
753
  y: n.y
727
754
  }, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
728
- }, ir = t(() => {
729
- let e = q.value;
755
+ }, fr = t(() => {
756
+ let e = K.value;
730
757
  return e ? {
731
758
  x: Math.min(e.start.x, e.current.x),
732
759
  y: Math.min(e.start.y, e.current.y),
@@ -738,62 +765,62 @@ var b = {
738
765
  width: 0,
739
766
  height: 0
740
767
  };
741
- }), ar = () => {
742
- let e = q.value;
743
- if (q.value = null, e && e.moved) {
768
+ }), pr = () => {
769
+ let e = K.value;
770
+ if (K.value = null, e && e.moved) {
744
771
  let t = {
745
772
  x: Math.min(e.start.x, e.current.x),
746
773
  y: Math.min(e.start.y, e.current.y),
747
774
  w: Math.abs(e.current.x - e.start.x),
748
775
  h: Math.abs(e.current.y - e.start.y)
749
- }, n = T.value.filter((e) => {
750
- let n = R(e), r = e.x + n.x, i = e.y + n.y;
776
+ }, n = C.value.filter((e) => {
777
+ let n = L(e), r = e.x + n.x, i = e.y + n.y;
751
778
  return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
752
779
  });
753
- n.length && (z.value = H(z.value, n.map((e) => e.id), An.value), V()), Ln();
780
+ n.length && (R.value = V(R.value, n.map((e) => e.id), Nn.value), B()), Gn();
754
781
  }
755
- hr();
756
- }, or = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), sr = (e) => {
757
- if (O.value) {
782
+ Cr();
783
+ }, mr = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), hr = (e) => {
784
+ if (D.value) {
758
785
  if (e.button === 1) {
759
786
  if (v.config.enablePan === !1) return;
760
- e.preventDefault(), $n(e);
787
+ e.preventDefault(), sr(e);
761
788
  return;
762
789
  }
763
- if (e.button === 0 && !or(e.target)) {
790
+ if (e.button === 0 && !mr(e.target)) {
764
791
  if (e.ctrlKey || e.metaKey) {
765
792
  if (v.config.enableMarquee === !1) return;
766
- e.preventDefault(), nr(e);
793
+ e.preventDefault(), ur(e);
767
794
  return;
768
795
  }
769
- v.config.enablePan !== !1 && (e.preventDefault(), $n(e));
796
+ v.config.enablePan !== !1 && (e.preventDefault(), sr(e));
770
797
  }
771
798
  }
772
- }, cr = !1, J = 0, lr = null, ur = () => {
773
- J = 0;
774
- let e = lr;
775
- lr = null, e && (K.value ? er(e) : q.value && rr(e));
776
- }, dr = (e) => {
777
- lr = e, J ||= requestAnimationFrame(ur);
778
- }, fr = () => {
779
- J && (cancelAnimationFrame(J), ur()), K.value && tr(), q.value && ar();
780
- }, pr = () => {
781
- cr || (cr = !0, window.addEventListener("mousemove", dr, !0), window.addEventListener("mouseup", fr, !0));
782
- }, mr = () => {
783
- cr && (cr = !1, window.removeEventListener("mousemove", dr, !0), window.removeEventListener("mouseup", fr, !0));
784
- }, hr = () => {
785
- !K.value && !q.value && mr();
786
- }, gr = t(() => {
787
- if (Y.value && Y.value.side) return { cursor: Gr(Y.value.side) };
788
- if (q.value) return { cursor: "crosshair" };
789
- if (K.value && K.value.moved) return { cursor: "grabbing" };
790
- }), _r = t(() => v.config.showGrid !== !1), vr = t(() => v.config.gridColor || "#1a2240"), yr = t(() => {
799
+ }, gr = !1, q = 0, _r = null, vr = () => {
800
+ q = 0;
801
+ let e = _r;
802
+ _r = null, e && (G.value ? cr(e) : K.value && dr(e));
803
+ }, yr = (e) => {
804
+ _r = e, q ||= requestAnimationFrame(vr);
805
+ }, br = () => {
806
+ q && (cancelAnimationFrame(q), vr()), G.value && lr(), K.value && pr();
807
+ }, xr = () => {
808
+ gr || (gr = !0, window.addEventListener("mousemove", yr, !0), window.addEventListener("mouseup", br, !0));
809
+ }, Sr = () => {
810
+ gr && (gr = !1, window.removeEventListener("mousemove", yr, !0), window.removeEventListener("mouseup", br, !0));
811
+ }, Cr = () => {
812
+ !G.value && !K.value && Sr();
813
+ }, wr = t(() => {
814
+ if (Y.value && Y.value.side) return { cursor: Qr(Y.value.side) };
815
+ if (K.value) return { cursor: "crosshair" };
816
+ if (G.value && G.value.moved) return { cursor: "grabbing" };
817
+ }), Tr = t(() => v.config.showGrid !== !1), Er = t(() => v.config.gridColor || "#1a2240"), Dr = t(() => {
791
818
  let e = Number(v.config.gridStep);
792
- return (Number.isFinite(e) && e > 0 ? e : 40) / Hn.value;
793
- }), br = t(() => {
819
+ return (Number.isFinite(e) && e > 0 ? e : 40) / Xn.value;
820
+ }), Or = t(() => {
794
821
  let e = Number(v.config.gridOpacity);
795
822
  return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
796
- }), xr = t(() => {
823
+ }), kr = t(() => {
797
824
  let e = v.config.radialGradient && typeof v.config.radialGradient == "object" ? v.config.radialGradient : {}, t = Array.isArray(e.stops) && e.stops.length ? e.stops.filter((e) => e && e.color).map((e, t) => ({
798
825
  offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
799
826
  color: e.color,
@@ -813,89 +840,100 @@ var b = {
813
840
  r: e.r || "60%",
814
841
  stops: n
815
842
  };
816
- }), Sr = t(() => v.config.showCenterPoint === !0), Cr = t(() => v.config.showEdgeTextBg === !0), wr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Tr = t(() => v.config.showNodeHandles === !0), Er = t(() => v.config.showStatusDot !== !1), Dr = (e, t) => {
843
+ }), Ar = t(() => v.config.showCenterPoint === !0), jr = t(() => v.config.showEdgeTextBg === !0), Mr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Nr = t(() => v.config.showNodeHandles === !0), Pr = t(() => v.config.showStatusDot !== !1), Fr = (e, t) => {
817
844
  let n = Number(e);
818
845
  return Number.isFinite(n) && n >= 0 ? n : t;
819
- }, Or = t(() => {
846
+ }, Ir = t(() => {
820
847
  let e = v.config.motionFx ?? v.config.fx;
821
- return typeof e == "boolean" ? e : M.value.length <= Dr(v.config.fxMotionMaxEdges, 200);
822
- }), kr = t(() => {
848
+ return typeof e == "boolean" ? e ? "all" : "none" : [
849
+ "none",
850
+ "flow",
851
+ "particle",
852
+ "all"
853
+ ].includes(e) ? e : j.value.length <= Fr(v.config.fxMotionMaxEdges, 200) ? "all" : "none";
854
+ }), Lr = t(() => {
823
855
  let e = v.config.glowFx ?? v.config.fx;
824
- return typeof e == "boolean" ? e : M.value.length <= Dr(v.config.fxGlowMaxEdges, 500);
825
- }), Ar = t(() => {
856
+ return typeof e == "boolean" ? e : j.value.length <= Fr(v.config.fxGlowMaxEdges, 500);
857
+ }), Rr = t(() => {
826
858
  let e = v.config.breatheFx ?? v.config.fx;
827
- return typeof e == "boolean" ? e : T.value.length <= Dr(v.config.fxBreatheMaxNodes, 300);
828
- }), jr = (e) => e.animated !== !1, Mr = (e) => e.borderColor || I(e) || "#94a3b8", Nr = (e) => e.borderWidth || 0, Pr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Fr = (e) => {
859
+ return typeof e == "boolean" ? e : C.value.length <= Fr(v.config.fxBreatheMaxNodes, 300);
860
+ }), zr = (e) => {
861
+ if (e.animatedMode !== void 0) {
862
+ let t = e.animatedMode;
863
+ return !t || t === "all" ? Ir.value : t === "none" ? "none" : t;
864
+ }
865
+ return e.animated === void 0 || e.animated ? Ir.value : "none";
866
+ }, Br = (e) => e.borderColor || F(e) || "#94a3b8", Vr = (e) => e.borderWidth || 0, Hr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Ur = (e) => {
829
867
  let t = e.borderRadius;
830
868
  if (t == null || t === "") return 6;
831
869
  let n = Number(t);
832
870
  return Number.isFinite(n) && n >= 0 ? n : 6;
833
- }, Ir = (e, t) => {
871
+ }, Wr = (e, t) => {
834
872
  if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
835
873
  e.stopPropagation();
836
- let n = F(t), r = Z(e);
837
- if (Kt.value = {
874
+ let n = P(t), r = Z(e);
875
+ if (qt.value = {
838
876
  x: r.x - n.x,
839
877
  y: r.y - n.y
840
- }, Jt = {
878
+ }, Yt = {
841
879
  x: e.clientX,
842
880
  y: e.clientY
843
- }, Yt = !1, Xt = !!(e.ctrlKey || e.metaKey), z.value.length > 1 && z.value.includes(t)) {
881
+ }, Xt = !1, Zt = !!(e.ctrlKey || e.metaKey), R.value.length > 1 && R.value.includes(t)) {
844
882
  let e = {};
845
- z.value.forEach((t) => {
846
- let n = F(t);
883
+ R.value.forEach((t) => {
884
+ let n = P(t);
847
885
  n && (e[t] = {
848
886
  x: n.x,
849
887
  y: n.y
850
888
  });
851
- }), qt.value = {
889
+ }), Jt.value = {
852
890
  origins: e,
853
891
  start: {
854
892
  x: r.x,
855
893
  y: r.y
856
894
  }
857
895
  };
858
- } else qt.value = null;
859
- D.value = t, y("node-drag-start", n);
860
- }, Lr = 0, Rr = null, zr = () => {
861
- Lr = 0;
862
- let e = Rr;
863
- Rr = null, e && Vr(e);
864
- }, Br = (e) => {
865
- (Y.value || D.value) && (Rr = {
896
+ } else Jt.value = null;
897
+ E.value = t, y("node-drag-start", n);
898
+ }, J = 0, Gr = null, Kr = () => {
899
+ J = 0;
900
+ let e = Gr;
901
+ Gr = null, e && Jr(e);
902
+ }, qr = (e) => {
903
+ (Y.value || E.value) && (Gr = {
866
904
  clientX: e.clientX,
867
905
  clientY: e.clientY
868
- }, Lr ||= requestAnimationFrame(zr));
869
- }, Vr = (e) => {
906
+ }, J ||= requestAnimationFrame(Kr));
907
+ }, Jr = (e) => {
870
908
  if (Y.value) {
871
- qr(e);
909
+ ei(e);
872
910
  return;
873
911
  }
874
- if (!D.value) return;
912
+ if (!E.value) return;
875
913
  let t = Z(e);
876
- !Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !z.value.includes(D.value) && (z.value = H([], [D.value], An.value), B.value = [], y("node-select", z.value.includes(D.value) ? F(D.value) : null), V()));
877
- let n = qt.value;
914
+ !Xt && Yt && Math.hypot(e.clientX - Yt.x, e.clientY - Yt.y) > kt && (Xt = !0, !Zt && !R.value.includes(E.value) && (R.value = V([], [E.value], Nn.value), z.value = [], y("node-select", R.value.includes(E.value) ? P(E.value) : null), B()));
915
+ let n = Jt.value;
878
916
  if (n) {
879
917
  let e = t.x - n.start.x, r = t.y - n.start.y;
880
- T.value = T.value.map((t) => n.origins[t.id] ? {
918
+ C.value = C.value.map((t) => n.origins[t.id] ? {
881
919
  ...t,
882
920
  x: n.origins[t.id].x + e,
883
921
  y: n.origins[t.id].y + r
884
922
  } : t);
885
- } else T.value = T.value.map((e) => e.id === D.value ? {
923
+ } else C.value = C.value.map((e) => e.id === E.value ? {
886
924
  ...e,
887
- x: t.x - Kt.value.x,
888
- y: t.y - Kt.value.y
925
+ x: t.x - qt.value.x,
926
+ y: t.y - qt.value.y
889
927
  } : e);
890
- E();
891
- }, Hr = () => {
892
- if (Lr && (cancelAnimationFrame(Lr), zr()), Y.value) {
893
- Jr();
928
+ w();
929
+ }, Yr = () => {
930
+ if (J && (cancelAnimationFrame(J), Kr()), Y.value) {
931
+ ti();
894
932
  return;
895
933
  }
896
- D.value && (Yt && Ln(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
897
- }, Y = d(null), Ur = (e, t, n) => Math.min(n, Math.max(t, e)), Wr = (e) => {
898
- let t = R(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
934
+ E.value && (Xt && Gn(), E.value = null, Jt.value = null, Yt = null, Xt = !1, y("node-drag-end"));
935
+ }, Y = d(null), Xr = (e, t, n) => Math.min(n, Math.max(t, e)), Zr = (e) => {
936
+ let t = L(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
899
937
  return [
900
938
  {
901
939
  side: "nw",
@@ -938,9 +976,9 @@ var b = {
938
976
  y: 0
939
977
  }
940
978
  ];
941
- }, Gr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", Kr = (e, t, n) => {
979
+ }, Qr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", $r = (e, t, n) => {
942
980
  if (!v.editable || v.config.nodeResizable === !1 || !t) return;
943
- let { w: r, h: i } = L(t);
981
+ let { w: r, h: i } = I(t);
944
982
  Y.value = {
945
983
  id: t.id,
946
984
  side: n,
@@ -949,36 +987,36 @@ var b = {
949
987
  startW: r,
950
988
  startH: i
951
989
  }, y("node-resize-start", t);
952
- }, qr = (e) => {
990
+ }, ei = (e) => {
953
991
  let t = Y.value;
954
992
  if (!t) return;
955
- let n = F(t.id);
993
+ let n = P(t.id);
956
994
  if (!n) return;
957
995
  let r = Z(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
958
996
  if (t.anchorX !== null) {
959
997
  let e = t.side.includes("e");
960
- i = Ur(e ? r.x - t.anchorX : t.anchorX - r.x, Pt, Ft), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
998
+ i = Xr(e ? r.x - t.anchorX : t.anchorX - r.x, Pt, Ft), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
961
999
  }
962
1000
  if (t.anchorY !== null) {
963
1001
  let e = t.side.includes("s");
964
- a = Ur(e ? r.y - t.anchorY : t.anchorY - r.y, It, Lt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
1002
+ a = Xr(e ? r.y - t.anchorY : t.anchorY - r.y, It, Lt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
965
1003
  }
966
- T.value = T.value.map((e) => e.id === t.id ? {
1004
+ C.value = C.value.map((e) => e.id === t.id ? {
967
1005
  ...e,
968
1006
  x: o,
969
1007
  y: s,
970
1008
  width: i,
971
1009
  height: a
972
- } : e), E();
973
- }, Jr = () => {
1010
+ } : e), w();
1011
+ }, ti = () => {
974
1012
  let e = Y.value;
975
- Y.value = null, e && (Ln(), y("node-resize-end", F(e.id) || null));
976
- }, Yr = t(() => v.editable && v.config.nodeResizable !== !1), Xr = t(() => {
977
- if (!Yr.value) return null;
978
- let e = z.value;
979
- return e.length === 1 && F(e[0]) || null;
980
- }), X = d(null), Zr = (e) => {
981
- let t = R(e);
1013
+ Y.value = null, e && (Gn(), y("node-resize-end", P(e.id) || null));
1014
+ }, ni = t(() => v.editable && v.config.nodeResizable !== !1), ri = t(() => {
1015
+ if (!ni.value) return null;
1016
+ let e = R.value;
1017
+ return e.length === 1 && P(e[0]) || null;
1018
+ }), X = d(null), ii = (e) => {
1019
+ let t = L(e);
982
1020
  return [
983
1021
  {
984
1022
  side: "top",
@@ -1001,8 +1039,8 @@ var b = {
1001
1039
  y: 0
1002
1040
  }
1003
1041
  ];
1004
- }, Qr = (e, t) => {
1005
- let n = O.value;
1042
+ }, ai = (e, t) => {
1043
+ let n = D.value;
1006
1044
  if (!n) return null;
1007
1045
  let r = e, i = t;
1008
1046
  if (e && typeof e == "object" && (r = e.clientX, i = e.clientY), r == null || i == null) return null;
@@ -1015,8 +1053,8 @@ var b = {
1015
1053
  x: s.x,
1016
1054
  y: s.y
1017
1055
  };
1018
- }, $r = (e, t) => {
1019
- let n = O.value;
1056
+ }, oi = (e, t) => {
1057
+ let n = D.value;
1020
1058
  if (!n) return null;
1021
1059
  let r = n.createSVGPoint();
1022
1060
  r.x = Number(e) || 0, r.y = Number(t) || 0;
@@ -1027,12 +1065,12 @@ var b = {
1027
1065
  x: a.x,
1028
1066
  y: a.y
1029
1067
  };
1030
- }, Z = (e) => Qr(e) ?? {
1068
+ }, Z = (e) => ai(e) ?? {
1031
1069
  x: 0,
1032
1070
  y: 0
1033
- }, ei = (e, t, n) => {
1034
- let r = F(t);
1035
- if (!r || !O.value) return;
1071
+ }, si = (e, t, n) => {
1072
+ let r = P(t);
1073
+ if (!r || !D.value) return;
1036
1074
  let i = Z(e);
1037
1075
  X.value = {
1038
1076
  fromId: t,
@@ -1046,40 +1084,40 @@ var b = {
1046
1084
  try {
1047
1085
  e.target.setPointerCapture?.(e.pointerId);
1048
1086
  } catch {}
1049
- si();
1050
- }, ti = 0, ni = null, ri = () => {
1051
- ti = 0;
1052
- let e = ni;
1053
- ni = null, e && X.value && ui(e);
1054
- }, ii = (e) => {
1055
- X.value && (ni = {
1087
+ mi();
1088
+ }, ci = 0, li = null, ui = () => {
1089
+ ci = 0;
1090
+ let e = li;
1091
+ li = null, e && X.value && _i(e);
1092
+ }, di = (e) => {
1093
+ X.value && (li = {
1056
1094
  clientX: e.clientX,
1057
1095
  clientY: e.clientY
1058
- }, ti ||= requestAnimationFrame(ri));
1059
- }, ai = () => {
1060
- ti && (cancelAnimationFrame(ti), ri()), X.value && di();
1061
- }, oi = !1, si = () => {
1062
- oi || (oi = !0, window.addEventListener("mousemove", ii, !0), window.addEventListener("mouseup", ai, !0));
1063
- }, ci = () => {
1064
- oi && (oi = !1, window.removeEventListener("mousemove", ii, !0), window.removeEventListener("mouseup", ai, !0));
1065
- }, li = (e, t, n) => {
1066
- let r = T.value;
1096
+ }, ci ||= requestAnimationFrame(ui));
1097
+ }, fi = () => {
1098
+ ci && (cancelAnimationFrame(ci), ui()), X.value && vi();
1099
+ }, pi = !1, mi = () => {
1100
+ pi || (pi = !0, window.addEventListener("mousemove", di, !0), window.addEventListener("mouseup", fi, !0));
1101
+ }, hi = () => {
1102
+ pi && (pi = !1, window.removeEventListener("mousemove", di, !0), window.removeEventListener("mouseup", fi, !0));
1103
+ }, gi = (e, t, n) => {
1104
+ let r = C.value;
1067
1105
  for (let i = r.length - 1; i >= 0; i--) {
1068
1106
  let a = r[i];
1069
1107
  if (a.id === n) continue;
1070
- let o = R(a);
1108
+ let o = L(a);
1071
1109
  if (e >= a.x + o.x - 2 && e <= a.x + o.x + o.width + 2 && t >= a.y + o.y - 2 && t <= a.y + o.y + o.height + 2) return a;
1072
1110
  }
1073
1111
  return null;
1074
- }, ui = (e) => {
1112
+ }, _i = (e) => {
1075
1113
  let t = X.value;
1076
1114
  if (!t) return;
1077
1115
  let n = Z(e);
1078
1116
  t.px = n.x, t.py = n.y;
1079
- let r = li(n.x, n.y, t.fromId);
1117
+ let r = gi(n.x, n.y, t.fromId);
1080
1118
  t.overId = r ? r.id : null;
1081
- }, di = () => {
1082
- ci();
1119
+ }, vi = () => {
1120
+ hi();
1083
1121
  let e = X.value;
1084
1122
  if (X.value = null, !e || !e.overId || e.overId === e.fromId) return;
1085
1123
  let t = {
@@ -1090,9 +1128,9 @@ var b = {
1090
1128
  fromAnchor: "edge",
1091
1129
  toAnchor: "edge"
1092
1130
  };
1093
- k.value.push(t), y("edge-create", t);
1094
- }, fi = (e, t, n) => {
1095
- let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = L(e);
1131
+ O.value.push(t), y("edge-create", t);
1132
+ }, yi = (e, t, n) => {
1133
+ let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = I(e);
1096
1134
  if (!n || n === "center" || a === 0 && o === 0) return {
1097
1135
  x: r,
1098
1136
  y: i
@@ -1102,20 +1140,20 @@ var b = {
1102
1140
  x: r + a * p,
1103
1141
  y: i + o * p
1104
1142
  };
1105
- }, pi = t(() => {
1143
+ }, bi = t(() => {
1106
1144
  let e = /* @__PURE__ */ new Map();
1107
- M.value.forEach((t) => {
1108
- let n = P.value[t.id];
1145
+ j.value.forEach((t) => {
1146
+ let n = N.value[t.id];
1109
1147
  n && !n.hidden && (e.has(n.key) || e.set(n.key, []), e.get(n.key).push(t));
1110
1148
  });
1111
1149
  let t = {};
1112
1150
  return e.forEach((e, n) => {
1113
- let [r, i] = n.split("__"), a = F(r), o = F(i);
1151
+ let [r, i] = n.split("__"), a = P(r), o = P(i);
1114
1152
  if (!a || !o) return;
1115
1153
  let s = o.x - a.x, c = o.y - a.y, l = Math.sqrt(s * s + c * c) || 1, u = s / l, d = c / l, f = -d, p = u, m = e.length, ee = Ot;
1116
1154
  if (m > 1) {
1117
1155
  let e = (m - 1) / 2 * Ot, t = (e) => {
1118
- let { w: t, h: n } = L(e);
1156
+ let { w: t, h: n } = I(e);
1119
1157
  return Math.max(4, (Math.abs(f) * t + Math.abs(p) * n) / 2 - 6);
1120
1158
  }, n = Math.min(1, t(a) / e, t(o) / e);
1121
1159
  ee = Ot * Math.max(.35, n);
@@ -1134,12 +1172,12 @@ var b = {
1134
1172
  bulge: Math.min(l * .15, 50)
1135
1173
  };
1136
1174
  }), t;
1137
- }), mi = (e) => {
1138
- let t = P.value[e.id], n = t && pi.value[t.key];
1175
+ }), xi = (e) => {
1176
+ let t = N.value[e.id], n = t && bi.value[t.key];
1139
1177
  if (!n) return null;
1140
- let r = F(e.from), i = F(e.to);
1178
+ let r = P(e.from), i = P(e.to);
1141
1179
  if (!r || !i) return null;
1142
- let a = n.slots[e.id] || 0, o = a * n.gap, s = fi(r, i, e.fromAnchor), c = fi(i, r, e.toAnchor);
1180
+ let a = n.slots[e.id] || 0, o = a * n.gap, s = yi(r, i, e.fromAnchor), c = yi(i, r, e.toAnchor);
1143
1181
  return {
1144
1182
  frame: n,
1145
1183
  slot: a,
@@ -1152,12 +1190,12 @@ var b = {
1152
1190
  y: c.y + n.ny * o
1153
1191
  }
1154
1192
  };
1155
- }, hi = (e) => {
1156
- let t = mi(e);
1193
+ }, Si = (e) => {
1194
+ let t = xi(e);
1157
1195
  if (!t) return "";
1158
1196
  let { from: n, to: r, frame: i, slot: a } = t, o = a * i.gap;
1159
- if (Gt.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1160
- if (Gt.value === "polyline") {
1197
+ if (T.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1198
+ if (T.value === "polyline") {
1161
1199
  if (i.dominant === "v") {
1162
1200
  let e = (n.y + r.y) / 2 + o;
1163
1201
  return `M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`;
@@ -1167,18 +1205,18 @@ var b = {
1167
1205
  }
1168
1206
  let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
1169
1207
  return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
1170
- }, gi = (e, t) => {
1171
- let n = mi(e);
1208
+ }, Ci = (e, t) => {
1209
+ let n = xi(e);
1172
1210
  if (!n) return {
1173
1211
  x: 0,
1174
1212
  y: 0
1175
1213
  };
1176
1214
  let { from: r, to: i, frame: a, slot: o } = n, s = o * a.gap;
1177
- if (Gt.value === "straight") return {
1215
+ if (T.value === "straight") return {
1178
1216
  x: r.x + (i.x - r.x) * t,
1179
1217
  y: r.y + (i.y - r.y) * t
1180
1218
  };
1181
- if (Gt.value === "polyline") {
1219
+ if (T.value === "polyline") {
1182
1220
  if (a.dominant === "v") {
1183
1221
  let e = (r.y + i.y) / 2 + s, n = Math.abs(e - r.y), a = Math.abs(i.x - r.x), o = Math.abs(i.y - e), c = t * (n + a + o || 1);
1184
1222
  return c <= n ? {
@@ -1209,29 +1247,29 @@ var b = {
1209
1247
  x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
1210
1248
  y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
1211
1249
  };
1212
- }, _i = t(() => X.value ? F(X.value.fromId) : null), vi = t(() => X.value && X.value.overId ? F(X.value.overId) : null), yi = t(() => _i.value ? I(_i.value) : "#00f0ff"), bi = t(() => {
1250
+ }, wi = t(() => X.value ? P(X.value.fromId) : null), Ti = t(() => X.value && X.value.overId ? P(X.value.overId) : null), Ei = t(() => wi.value ? F(wi.value) : "#00f0ff"), Di = t(() => {
1213
1251
  let e = X.value;
1214
1252
  if (!e) return {
1215
1253
  x: 0,
1216
1254
  y: 0
1217
1255
  };
1218
- let t = vi.value;
1219
- return t && _i.value ? fi(t, _i.value, "edge") : {
1256
+ let t = Ti.value;
1257
+ return t && wi.value ? yi(t, wi.value, "edge") : {
1220
1258
  x: e.px,
1221
1259
  y: e.py
1222
1260
  };
1223
- }), xi = t(() => {
1224
- let e = vi.value;
1261
+ }), Oi = t(() => {
1262
+ let e = Ti.value;
1225
1263
  if (!e) return null;
1226
- let t = R(e);
1264
+ let t = L(e);
1227
1265
  return {
1228
1266
  x: e.x + t.x - 4,
1229
1267
  y: e.y + t.y - 4,
1230
1268
  w: t.width + 8,
1231
1269
  h: t.height + 8
1232
1270
  };
1233
- }), Si = (e) => {
1234
- let t = e.nodeIds.map((e) => F(e)).filter(Boolean);
1271
+ }), ki = (e) => {
1272
+ let t = e.nodeIds.map((e) => P(e)).filter(Boolean);
1235
1273
  if (t.length === 0) return null;
1236
1274
  let n = e.padding, r = Math.min(...t.map((e) => e.x)) - n, i = Math.min(...t.map((e) => e.y)) - n, a = Math.max(...t.map((e) => e.x)) + n, o = Math.max(...t.map((e) => e.y)) + n;
1237
1275
  return {
@@ -1240,109 +1278,120 @@ var b = {
1240
1278
  width: a - r,
1241
1279
  height: o - i
1242
1280
  };
1243
- }, Ci = t(() => v.groups.map((e) => ({
1281
+ }, Ai = t(() => v.groups.map((e) => ({
1244
1282
  ...e,
1245
- rect: Si(e)
1246
- })).filter((e) => e.rect)), Q = (e) => On(e) ? Pn.value : (F(e.from), e.centerText && e.centerText.color || "#00f0ff"), wi = (e) => {
1247
- let t = P.value[e.id];
1283
+ rect: ki(e)
1284
+ })).filter((e) => e.rect)), Q = (e) => jn(e) ? Hn.value : (P(e.from), e.centerText && e.centerText.color || "#00f0ff"), ji = (e) => {
1285
+ let t = N.value[e.id];
1248
1286
  return !!t && !t.hidden;
1249
- }, Ti = t(() => [...new Set(M.value.map(Q))].map((e) => ({
1287
+ }, Mi = t(() => [...new Set(j.value.map(Q))].map((e) => ({
1250
1288
  key: String(e).replace("#", ""),
1251
1289
  color: e
1252
- }))), Ei = (e) => {
1290
+ }))), Ni = (e) => {
1253
1291
  let t = e.endMarker;
1254
1292
  if (!t || t === "none") return "";
1255
1293
  let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
1256
1294
  return `url(#${t === "dot" ? "edge-dot" : "edge-arrow"}-${r})`;
1257
- }, Di = /* @__PURE__ */ new Map(), Oi = {
1295
+ }, Pi = /* @__PURE__ */ new Map(), Fi = {
1258
1296
  nodes: null,
1259
1297
  edges: null,
1260
1298
  mode: null,
1261
1299
  epoch: -1
1262
- }, ki = () => {
1263
- let e = Oi;
1264
- (e.nodes !== T.value || e.edges !== M.value || e.mode !== Gt.value || e.epoch !== Rt) && (Oi = {
1265
- nodes: T.value,
1266
- edges: M.value,
1267
- mode: Gt.value,
1300
+ }, Ii = () => {
1301
+ let e = Fi;
1302
+ (e.nodes !== C.value || e.edges !== j.value || e.mode !== T.value || e.epoch !== Rt) && (Fi = {
1303
+ nodes: C.value,
1304
+ edges: j.value,
1305
+ mode: T.value,
1268
1306
  epoch: Rt
1269
- }, Di = /* @__PURE__ */ new Map());
1307
+ }, Pi = /* @__PURE__ */ new Map());
1270
1308
  }, $ = (e) => {
1271
- ki();
1272
- let t = Di.get(e.id);
1273
- return t === void 0 && (t = hi(e), Di.set(e.id, t)), t;
1274
- }, Ai = (e, t = 1) => `${2 / e.speed * t}s`, ji = (e) => `${3 / e.speed}s`, Mi = (e) => S(e).text, Ni = (e) => !!e && String(S(e).text ?? "").trim() !== "", Pi = (e, t) => {
1309
+ Ii();
1310
+ let t = Pi.get(e.id);
1311
+ return t === void 0 && (t = Si(e), Pi.set(e.id, t)), t;
1312
+ }, Li = (e, t = 1) => `${2 / e.speed * t}s`, Ri = (e) => `${3 / e.speed}s`, zi = (e) => {
1313
+ let t = zr(e);
1314
+ return t === "flow" || t === "all";
1315
+ }, Bi = (e) => {
1316
+ let t = zr(e);
1317
+ return t === "particle" || t === "all";
1318
+ }, Vi = (e) => Bt(e).text, Hi = (e) => !!e && String(Bt(e).text ?? "").trim() !== "", Ui = (e, t) => {
1275
1319
  if (!e) return null;
1276
- let n = S(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1320
+ let n = Bt(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1277
1321
  for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
1278
1322
  return {
1279
1323
  w: Math.max(14, a * r + 8),
1280
1324
  h: Math.max(12, r + 6)
1281
1325
  };
1282
- }, Fi = (e, t) => {
1283
- let n = gi(e, Math.max(0, t - .005)), r = gi(e, Math.min(1, t + .005));
1326
+ }, Wi = (e, t) => {
1327
+ let n = Ci(e, Math.max(0, t - .005)), r = Ci(e, Math.min(1, t + .005));
1284
1328
  return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
1285
- }, Ii = (e) => {
1329
+ }, Gi = (e) => {
1286
1330
  let t = e % 180;
1287
1331
  return t > 90 && (t -= 180), t < -90 && (t += 180), t;
1288
- }, Li = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(S(e).rotation || 0) + (n || 0)})`, Ri = t(() => {
1332
+ }, Ki = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(Bt(e).rotation || 0) + (n || 0)})`, qi = t(() => {
1289
1333
  let e = [];
1290
- for (let t of G.value) {
1291
- let n = P.value[t.id];
1334
+ for (let t of W.value) {
1335
+ let n = N.value[t.id];
1292
1336
  if (!n) continue;
1293
1337
  let r = n.merged && n.representative, i = !n.merged && (t.fromText || t.centerText || t.toText);
1294
1338
  if (!r && !i) continue;
1295
- let a = F(t.from), o = F(t.to);
1339
+ let a = P(t.from), o = P(t.to);
1296
1340
  a && o && e.push({
1297
1341
  id: t.id,
1298
1342
  edge: t,
1299
1343
  info: n,
1300
- color: a && ie[a.type] || "#00f0ff",
1301
- start: gi(t, .28),
1302
- center: gi(t, .5),
1303
- end: gi(t, .72),
1304
- startAngle: Ii(Fi(t, .28)),
1305
- centerAngle: Ii(Fi(t, .5)),
1306
- endAngle: Ii(Fi(t, .72)),
1307
- fromBox: Pi(t.fromText, t),
1308
- centerBox: Pi(t.centerText, t),
1309
- toBox: Pi(t.toText, t)
1344
+ color: a && ie[a.nodeType] || "#00f0ff",
1345
+ start: Ci(t, .28),
1346
+ center: Ci(t, .5),
1347
+ end: Ci(t, .72),
1348
+ startAngle: Gi(Wi(t, .28)),
1349
+ centerAngle: Gi(Wi(t, .5)),
1350
+ endAngle: Gi(Wi(t, .72)),
1351
+ fromBox: Ui(t.fromText, t),
1352
+ centerBox: Ui(t.centerText, t),
1353
+ toBox: Ui(t.toText, t)
1310
1354
  });
1311
1355
  }
1312
1356
  return e;
1313
1357
  });
1314
1358
  return te({
1315
- resetDataBaseline: on,
1316
- getData: sn,
1317
- setData: pn,
1318
- removeSelected: cn,
1319
- addNodes: ln,
1320
- addEdges: un,
1321
- updateNodes: dn,
1322
- updateEdges: fn,
1323
- clientToSvg: Qr,
1324
- svgToClient: $r
1359
+ resetDataBaseline: sn,
1360
+ getData: cn,
1361
+ setData: mn,
1362
+ removeSelected: ln,
1363
+ addNodes: un,
1364
+ addEdges: dn,
1365
+ updateNodes: fn,
1366
+ updateEdges: pn,
1367
+ clientToSvg: ai,
1368
+ svgToClient: oi,
1369
+ moveLayerUp: Ln,
1370
+ moveLayerDown: Rn,
1371
+ moveToFront: zn,
1372
+ moveToBack: Bn,
1373
+ downloadSVG: Vn
1325
1374
  }), (t, c) => (u(), r("svg", {
1326
1375
  ref_key: "svgRef",
1327
- ref: O,
1376
+ ref: D,
1328
1377
  class: "topology-svg",
1329
- style: s(gr.value),
1330
- viewBox: `${Gn.value} ${Kn.value} ${U.value} ${W.value}`,
1331
- onMousedown: sr,
1332
- onMousemove: Br,
1333
- onMouseup: Hr,
1334
- onMouseleave: Hr,
1335
- onClick: Bn,
1336
- onWheel: g(Qn, ["prevent"])
1378
+ style: s(wr.value),
1379
+ viewBox: `${$n.value} ${er.value} ${H.value} ${U.value}`,
1380
+ onMousedown: hr,
1381
+ onMousemove: qr,
1382
+ onMouseup: Yr,
1383
+ onMouseleave: Yr,
1384
+ onClick: Jn,
1385
+ onWheel: g(or, ["prevent"])
1337
1386
  }, [
1338
1387
  i("defs", null, [
1339
1388
  c[3] ||= a("<filter id=\"glow-core\" x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"3\" result=\"blur\"></feGaussianBlur><feMerge><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter><filter id=\"glow-strong\" x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\"><feGaussianBlur in=\"SourceGraphic\" stdDeviation=\"6\" result=\"blur\"></feGaussianBlur><feMerge><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"blur\"></feMergeNode><feMergeNode in=\"SourceGraphic\"></feMergeNode></feMerge></filter>", 2),
1340
1389
  i("radialGradient", {
1341
1390
  id: "bg-grid",
1342
- cx: xr.value.cx,
1343
- cy: xr.value.cy,
1344
- r: xr.value.r
1345
- }, [(u(!0), r(e, null, f(xr.value.stops, (e, t) => (u(), r("stop", {
1391
+ cx: kr.value.cx,
1392
+ cy: kr.value.cy,
1393
+ r: kr.value.r
1394
+ }, [(u(!0), r(e, null, f(kr.value.stops, (e, t) => (u(), r("stop", {
1346
1395
  key: `bg-stop-${t}`,
1347
1396
  offset: e.offset,
1348
1397
  "stop-color": e.color,
@@ -1369,7 +1418,7 @@ var b = {
1369
1418
  }, null, 8, de)
1370
1419
  ], 8, ce))), 128)),
1371
1420
  c[4] ||= a("<linearGradient id=\"flow-grad-1\" gradientUnits=\"userSpaceOnUse\"><stop offset=\"0%\" stop-color=\"#00f0ff\" stop-opacity=\"0\"></stop><stop offset=\"40%\" stop-color=\"#00f0ff\" stop-opacity=\"1\"></stop><stop offset=\"60%\" stop-color=\"#00f0ff\" stop-opacity=\"1\"></stop><stop offset=\"100%\" stop-color=\"#00f0ff\" stop-opacity=\"0\"></stop></linearGradient>", 1),
1372
- (u(!0), r(e, null, f(Ti.value, (e) => (u(), r("marker", {
1421
+ (u(!0), r(e, null, f(Mi.value, (e) => (u(), r("marker", {
1373
1422
  key: `m-arrow-${e.key}`,
1374
1423
  id: `edge-arrow-${e.key}`,
1375
1424
  viewBox: "0 0 10 10",
@@ -1383,7 +1432,7 @@ var b = {
1383
1432
  d: "M1,2.5 L9,5 L1,7.5 Z",
1384
1433
  fill: e.color
1385
1434
  }, null, 8, pe)], 8, fe))), 128)),
1386
- (u(!0), r(e, null, f(Ti.value, (e) => (u(), r("marker", {
1435
+ (u(!0), r(e, null, f(Mi.value, (e) => (u(), r("marker", {
1387
1436
  key: `m-dot-${e.key}`,
1388
1437
  id: `edge-dot-${e.key}`,
1389
1438
  viewBox: "0 0 10 10",
@@ -1401,31 +1450,31 @@ var b = {
1401
1450
  }, null, 8, he)], 8, me))), 128))
1402
1451
  ]),
1403
1452
  i("rect", {
1404
- width: U.value,
1405
- height: W.value,
1406
- x: Gn.value,
1407
- y: Kn.value,
1453
+ width: H.value,
1454
+ height: U.value,
1455
+ x: $n.value,
1456
+ y: er.value,
1408
1457
  fill: "url(#bg-grid)"
1409
1458
  }, null, 8, ge),
1410
- _r.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1459
+ Tr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1411
1460
  id: "grid",
1412
- width: yr.value,
1413
- height: yr.value,
1461
+ width: Dr.value,
1462
+ height: Dr.value,
1414
1463
  patternUnits: "userSpaceOnUse"
1415
1464
  }, [i("path", {
1416
- d: `M ${yr.value} 0 L 0 0 0 ${yr.value}`,
1465
+ d: `M ${Dr.value} 0 L 0 0 0 ${Dr.value}`,
1417
1466
  fill: "none",
1418
- stroke: vr.value,
1467
+ stroke: Er.value,
1419
1468
  "stroke-width": "0.5"
1420
1469
  }, null, 8, ve)], 8, _e), i("rect", {
1421
- width: U.value,
1422
- height: W.value,
1423
- x: Gn.value,
1424
- y: Kn.value,
1470
+ width: H.value,
1471
+ height: U.value,
1472
+ x: $n.value,
1473
+ y: er.value,
1425
1474
  fill: "url(#grid)",
1426
- opacity: br.value
1475
+ opacity: Or.value
1427
1476
  }, null, 8, ye)], 64)) : n("", !0),
1428
- Sr.value ? (u(), r("g", be, [...c[5] ||= [
1477
+ Ar.value ? (u(), r("g", be, [...c[5] ||= [
1429
1478
  i("line", {
1430
1479
  x1: "-22",
1431
1480
  y1: "0",
@@ -1457,7 +1506,7 @@ var b = {
1457
1506
  opacity: "0.8"
1458
1507
  }, null, -1)
1459
1508
  ]])) : n("", !0),
1460
- (u(!0), r(e, null, f(Ci.value, (e) => (u(), r("g", { key: e.id }, [
1509
+ (u(!0), r(e, null, f(Ai.value, (e) => (u(), r("g", { key: e.id }, [
1461
1510
  i("rect", {
1462
1511
  x: e.rect.x,
1463
1512
  y: e.rect.y,
@@ -1519,16 +1568,16 @@ var b = {
1519
1568
  "letter-spacing": "0.5"
1520
1569
  }, m(e.label), 9, De)
1521
1570
  ]))), 128)),
1522
- (u(!0), r(e, null, f(G.value, (e) => (u(), r("path", {
1571
+ (u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
1523
1572
  key: `base-${e.id}`,
1524
1573
  d: $(e),
1525
1574
  fill: "none",
1526
1575
  stroke: "#1a2744",
1527
1576
  "stroke-width": "2",
1528
1577
  "stroke-linecap": "round",
1529
- "marker-end": Ei(e)
1578
+ "marker-end": Ni(e)
1530
1579
  }, null, 8, Oe))), 128)),
1531
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [kr.value ? (u(), r("path", {
1580
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Lr.value ? (u(), r("path", {
1532
1581
  key: 0,
1533
1582
  d: $(t),
1534
1583
  fill: "none",
@@ -1538,16 +1587,16 @@ var b = {
1538
1587
  opacity: "0.15",
1539
1588
  filter: "url(#glow-strong)"
1540
1589
  }, null, 8, ke)) : n("", !0)], 64))), 128)),
1541
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [On(t) ? (u(), r("path", {
1590
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [jn(t) ? (u(), r("path", {
1542
1591
  key: 0,
1543
1592
  d: $(t),
1544
1593
  fill: "none",
1545
- stroke: Pn.value,
1594
+ stroke: Hn.value,
1546
1595
  "stroke-width": "4",
1547
1596
  opacity: "0.35",
1548
1597
  filter: "url(#glow-strong)"
1549
1598
  }, null, 8, Ae)) : n("", !0)], 64))), 128)),
1550
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [Or.value && jr(t) ? (u(), r("g", je, [
1599
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [zi(t) ? (u(), r("g", je, [
1551
1600
  i("path", {
1552
1601
  d: $(t),
1553
1602
  fill: "none",
@@ -1560,7 +1609,7 @@ var b = {
1560
1609
  attributeName: "stroke-dashoffset",
1561
1610
  from: "0",
1562
1611
  to: "-52",
1563
- dur: Ai(t),
1612
+ dur: Li(t),
1564
1613
  repeatCount: "indefinite"
1565
1614
  }, null, 8, Ne)], 8, Me),
1566
1615
  i("path", {
@@ -1575,7 +1624,7 @@ var b = {
1575
1624
  attributeName: "stroke-dashoffset",
1576
1625
  from: "-30",
1577
1626
  to: "-82",
1578
- dur: Ai(t, 1.3),
1627
+ dur: Li(t, 1.3),
1579
1628
  repeatCount: "indefinite"
1580
1629
  }, null, 8, Fe)], 8, Pe),
1581
1630
  i("path", {
@@ -1591,18 +1640,18 @@ var b = {
1591
1640
  attributeName: "stroke-dashoffset",
1592
1641
  from: "0",
1593
1642
  to: "-84",
1594
- dur: Ai(t, .8),
1643
+ dur: Li(t, .8),
1595
1644
  repeatCount: "indefinite"
1596
1645
  }, null, 8, Le)], 8, Ie)
1597
1646
  ])) : n("", !0)], 64))), 128)),
1598
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [Or.value && jr(t) ? (u(), r("g", Re, [i("circle", {
1647
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [Bi(t) ? (u(), r("g", Re, [i("circle", {
1599
1648
  r: "3",
1600
1649
  fill: Q(t),
1601
1650
  opacity: "0.9",
1602
1651
  filter: "url(#glow-core)"
1603
1652
  }, [i("animateMotion", {
1604
1653
  path: $(t),
1605
- dur: ji(t),
1654
+ dur: Ri(t),
1606
1655
  repeatCount: "indefinite"
1607
1656
  }, null, 8, Be)], 8, ze), i("circle", {
1608
1657
  r: "8",
@@ -1611,17 +1660,17 @@ var b = {
1611
1660
  filter: "url(#glow-strong)"
1612
1661
  }, [i("animateMotion", {
1613
1662
  path: $(t),
1614
- dur: ji(t),
1663
+ dur: Ri(t),
1615
1664
  repeatCount: "indefinite"
1616
1665
  }, null, 8, He)], 8, Ve)])) : n("", !0)], 64))), 128)),
1617
- (u(!0), r(e, null, f(Ri.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1666
+ (u(!0), r(e, null, f(qi.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1618
1667
  key: 0,
1619
1668
  transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
1620
1669
  }, [i("rect", {
1621
1670
  x: "-7",
1622
- y: -C(t.edge, null) / 2,
1671
+ y: -Wt(t.edge, null) / 2,
1623
1672
  width: 14,
1624
- height: C(t.edge, null),
1673
+ height: Wt(t.edge, null),
1625
1674
  rx: "2",
1626
1675
  fill: "#FFFFFF",
1627
1676
  opacity: "0.9",
@@ -1631,94 +1680,94 @@ var b = {
1631
1680
  y: "0",
1632
1681
  "dominant-baseline": "central",
1633
1682
  "text-anchor": "middle",
1634
- "font-size": C(t.edge, null),
1635
- fill: w(t.edge, null),
1683
+ "font-size": Wt(t.edge, null),
1684
+ fill: S(t.edge, null),
1636
1685
  "font-family": "'SF Mono', monospace",
1637
1686
  opacity: "1"
1638
1687
  }, m(t.info.count), 9, Ge)], 8, Ue)) : t.info.merged ? n("", !0) : (u(), r("g", Ke, [
1639
- Ni(t.edge.fromText) ? (u(), r("g", {
1688
+ Hi(t.edge.fromText) ? (u(), r("g", {
1640
1689
  key: 0,
1641
- transform: Li(t.edge.fromText, t.start, t.startAngle)
1642
- }, [Cr.value ? (u(), r("rect", {
1690
+ transform: Ki(t.edge.fromText, t.start, t.startAngle)
1691
+ }, [jr.value ? (u(), r("rect", {
1643
1692
  key: 0,
1644
1693
  x: -t.fromBox.w / 2,
1645
1694
  y: -t.fromBox.h / 2,
1646
1695
  width: t.fromBox.w,
1647
1696
  height: t.fromBox.h,
1648
1697
  rx: "3",
1649
- fill: wr.value,
1698
+ fill: Mr.value,
1650
1699
  opacity: "0.92",
1651
- stroke: w(t.edge, t.edge.fromText),
1700
+ stroke: S(t.edge, t.edge.fromText),
1652
1701
  "stroke-opacity": "0.35",
1653
1702
  "stroke-width": "0.6"
1654
1703
  }, null, 8, Je)) : n("", !0), i("text", {
1655
1704
  y: "0",
1656
1705
  "dominant-baseline": "central",
1657
1706
  "text-anchor": "middle",
1658
- "font-size": C(t.edge, t.edge.fromText),
1659
- fill: w(t.edge, t.edge.fromText),
1707
+ "font-size": Wt(t.edge, t.edge.fromText),
1708
+ fill: S(t.edge, t.edge.fromText),
1660
1709
  "font-family": "'SF Mono', monospace",
1661
1710
  "font-weight": "500",
1662
1711
  opacity: "0.9"
1663
- }, m(Mi(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1664
- Ni(t.edge.centerText) ? (u(), r("g", {
1712
+ }, m(Vi(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1713
+ Hi(t.edge.centerText) ? (u(), r("g", {
1665
1714
  key: 1,
1666
- transform: Li(t.edge.centerText, t.center, t.centerAngle)
1667
- }, [Cr.value ? (u(), r("rect", {
1715
+ transform: Ki(t.edge.centerText, t.center, t.centerAngle)
1716
+ }, [jr.value ? (u(), r("rect", {
1668
1717
  key: 0,
1669
1718
  x: -t.centerBox.w / 2,
1670
1719
  y: -t.centerBox.h / 2,
1671
1720
  width: t.centerBox.w,
1672
1721
  height: t.centerBox.h,
1673
1722
  rx: "3",
1674
- fill: wr.value,
1723
+ fill: Mr.value,
1675
1724
  opacity: "0.92",
1676
- stroke: w(t.edge, t.edge.centerText),
1725
+ stroke: S(t.edge, t.edge.centerText),
1677
1726
  "stroke-opacity": "0.35",
1678
1727
  "stroke-width": "0.6"
1679
1728
  }, null, 8, Ze)) : n("", !0), i("text", {
1680
1729
  y: "0",
1681
1730
  "dominant-baseline": "central",
1682
1731
  "text-anchor": "middle",
1683
- "font-size": C(t.edge, t.edge.centerText),
1684
- fill: w(t.edge, t.edge.centerText),
1732
+ "font-size": Wt(t.edge, t.edge.centerText),
1733
+ fill: S(t.edge, t.edge.centerText),
1685
1734
  "font-family": "'SF Mono', monospace",
1686
1735
  "font-weight": "600",
1687
1736
  opacity: "1"
1688
- }, m(Mi(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1689
- Ni(t.edge.toText) ? (u(), r("g", {
1737
+ }, m(Vi(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1738
+ Hi(t.edge.toText) ? (u(), r("g", {
1690
1739
  key: 2,
1691
- transform: Li(t.edge.toText, t.end, t.endAngle)
1692
- }, [Cr.value ? (u(), r("rect", {
1740
+ transform: Ki(t.edge.toText, t.end, t.endAngle)
1741
+ }, [jr.value ? (u(), r("rect", {
1693
1742
  key: 0,
1694
1743
  x: -t.toBox.w / 2,
1695
1744
  y: -t.toBox.h / 2,
1696
1745
  width: t.toBox.w,
1697
1746
  height: t.toBox.h,
1698
1747
  rx: "3",
1699
- fill: wr.value,
1748
+ fill: Mr.value,
1700
1749
  opacity: "0.92",
1701
- stroke: w(t.edge, t.edge.toText),
1750
+ stroke: S(t.edge, t.edge.toText),
1702
1751
  "stroke-opacity": "0.35",
1703
1752
  "stroke-width": "0.6"
1704
1753
  }, null, 8, et)) : n("", !0), i("text", {
1705
1754
  y: "0",
1706
1755
  "dominant-baseline": "central",
1707
1756
  "text-anchor": "middle",
1708
- "font-size": C(t.edge, t.edge.toText),
1709
- fill: w(t.edge, t.edge.toText),
1757
+ "font-size": Wt(t.edge, t.edge.toText),
1758
+ fill: S(t.edge, t.edge.toText),
1710
1759
  "font-family": "'SF Mono', monospace",
1711
1760
  "font-weight": "500",
1712
1761
  opacity: "0.9"
1713
- }, m(Mi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1762
+ }, m(Vi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1714
1763
  ]))], 64))), 128)),
1715
1764
  X.value ? (u(), r("g", nt, [
1716
1765
  i("line", {
1717
1766
  x1: X.value.ax,
1718
1767
  y1: X.value.ay,
1719
- x2: bi.value.x,
1720
- y2: bi.value.y,
1721
- stroke: yi.value,
1768
+ x2: Di.value.x,
1769
+ y2: Di.value.y,
1770
+ stroke: Ei.value,
1722
1771
  "stroke-width": "2",
1723
1772
  "stroke-dasharray": "6 6",
1724
1773
  "stroke-linecap": "round",
@@ -1728,24 +1777,24 @@ var b = {
1728
1777
  cx: X.value.px,
1729
1778
  cy: X.value.py,
1730
1779
  r: "3.5",
1731
- fill: yi.value,
1780
+ fill: Ei.value,
1732
1781
  opacity: "0.9"
1733
1782
  }, null, 8, it),
1734
- X.value.overId && xi.value ? (u(), r("rect", {
1783
+ X.value.overId && Oi.value ? (u(), r("rect", {
1735
1784
  key: 0,
1736
- x: xi.value.x,
1737
- y: xi.value.y,
1738
- width: xi.value.w,
1739
- height: xi.value.h,
1785
+ x: Oi.value.x,
1786
+ y: Oi.value.y,
1787
+ width: Oi.value.w,
1788
+ height: Oi.value.h,
1740
1789
  rx: "6",
1741
1790
  fill: "none",
1742
- stroke: yi.value,
1791
+ stroke: Ei.value,
1743
1792
  "stroke-width": "1.5",
1744
1793
  "stroke-dasharray": "6 4",
1745
1794
  opacity: "0.9"
1746
1795
  }, null, 8, at)) : n("", !0)
1747
1796
  ])) : n("", !0),
1748
- (u(!0), r(e, null, f(G.value, (e) => (u(), r("path", {
1797
+ (u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
1749
1798
  key: `hit-${e.id}`,
1750
1799
  d: $(e),
1751
1800
  fill: "none",
@@ -1755,100 +1804,104 @@ var b = {
1755
1804
  "pointer-events": "stroke",
1756
1805
  cursor: "pointer"
1757
1806
  },
1758
- onClick: g((t) => Fn(e, t), ["stop"])
1807
+ onClick: g((t) => Un(e, t), ["stop"])
1759
1808
  }, null, 8, ot))), 128)),
1760
- (u(!0), r(e, null, f(Zn.value, (a) => (u(), r("g", {
1809
+ (u(!0), r(e, null, f(ar.value, (a) => (u(), r("g", {
1761
1810
  key: a.id,
1762
1811
  transform: `translate(${a.x}, ${a.y})`,
1763
- class: o(["topology-node", D.value === a.id ? "dragging" : ""]),
1764
- onMousedown: (e) => Ir(e, a.id),
1765
- onClick: (e) => Nn(a, e),
1812
+ class: o(["topology-node", E.value === a.id ? "dragging" : ""]),
1813
+ onMousedown: (e) => Wr(e, a.id),
1814
+ onClick: (e) => In(a, e),
1766
1815
  style: s({
1767
1816
  cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
1768
- color: I(a)
1817
+ color: F(a)
1769
1818
  })
1770
1819
  }, [
1771
1820
  i("rect", {
1772
1821
  class: "node-hit-area",
1773
- x: Cn(a).x,
1774
- y: Cn(a).y,
1775
- width: Cn(a).width,
1776
- height: Cn(a).height,
1822
+ x: En(a).x,
1823
+ y: En(a).y,
1824
+ width: En(a).width,
1825
+ height: En(a).height,
1777
1826
  fill: "transparent",
1778
1827
  "pointer-events": "all"
1779
1828
  }, null, 8, ct),
1780
- En(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1829
+ kn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1781
1830
  key: 0,
1782
- x: R(a).x,
1783
- y: R(a).y,
1784
- width: R(a).width,
1785
- height: R(a).height,
1786
- rx: Fr(a),
1787
- fill: En(a),
1831
+ x: L(a).x,
1832
+ y: L(a).y,
1833
+ width: L(a).width,
1834
+ height: L(a).height,
1835
+ rx: Ur(a),
1836
+ fill: kn(a),
1788
1837
  opacity: "0.15"
1789
1838
  }, null, 8, lt)) : n("", !0),
1790
- Tn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1839
+ On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1791
1840
  key: 1,
1792
- x: Tn(a).x,
1793
- y: Tn(a).y,
1794
- width: Tn(a).width,
1795
- height: Tn(a).height,
1796
- rx: Fr(a),
1841
+ x: On(a).x,
1842
+ y: On(a).y,
1843
+ width: On(a).width,
1844
+ height: On(a).height,
1845
+ rx: Ur(a),
1797
1846
  fill: "none",
1798
- stroke: Mr(a),
1799
- "stroke-width": Nr(a),
1800
- "stroke-dasharray": Pr(a),
1847
+ stroke: Br(a),
1848
+ "stroke-width": Vr(a),
1849
+ "stroke-dasharray": Hr(a),
1801
1850
  opacity: "0.8"
1802
1851
  }, null, 8, ut)) : n("", !0),
1803
- Dn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1852
+ An(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1804
1853
  key: 2,
1805
- x: R(a).x,
1806
- y: R(a).y,
1807
- width: R(a).width,
1808
- height: R(a).height,
1809
- rx: Fr(a),
1854
+ x: L(a).x,
1855
+ y: L(a).y,
1856
+ width: L(a).width,
1857
+ height: L(a).height,
1858
+ rx: Ur(a),
1810
1859
  fill: "none",
1811
- stroke: Mn.value,
1860
+ stroke: Fn.value,
1812
1861
  "stroke-width": "2.5",
1813
1862
  transform: "scale(1.1)",
1814
1863
  style: { "pointer-events": "none" }
1815
1864
  }, null, 8, dt)) : n("", !0),
1816
- gn(a) ? (u(), r(e, { key: 3 }, [i("rect", {
1865
+ _n(a) ? (u(), r(e, { key: 3 }, [i("rect", {
1817
1866
  x: "-4",
1818
1867
  y: "-10",
1819
1868
  width: "8",
1820
1869
  height: "20",
1821
- fill: hn(a).color,
1870
+ fill: gn(a).color,
1822
1871
  opacity: "0.06"
1823
1872
  }, null, 8, ft), i("text", {
1824
1873
  y: "4",
1825
1874
  transform: `rotate(${a.rotation || 0} 0 4)`,
1826
1875
  "text-anchor": "middle",
1827
- fill: Vt(a) || I(a) || hn(a).color,
1828
- "font-size": Bt(a, 12),
1876
+ fill: Ht(a) || F(a) || gn(a).color,
1877
+ "font-size": Vt(a, 12),
1829
1878
  "font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
1830
1879
  "font-weight": "600"
1831
- }, m(a.label), 9, pt)], 64)) : (u(), r(e, { key: 4 }, [
1832
- i("g", { transform: yn(a) }, [a.state !== "none" && Ar.value ? (u(), r("circle", {
1880
+ }, m(a.label), 9, pt)], 64)) : vn(a) ? (u(), r(e, { key: 4 }, [], 64)) : (u(), r(e, { key: 5 }, [
1881
+ a.state !== "none" && Rr.value ? (u(), r("circle", {
1833
1882
  key: 0,
1834
- r: "30",
1883
+ r: xn(a),
1835
1884
  fill: "none",
1836
- stroke: hn(a).color,
1885
+ stroke: gn(a).color,
1837
1886
  "stroke-width": "2.5",
1838
1887
  opacity: "0"
1839
- }, [...c[6] ||= [i("animate", {
1888
+ }, [i("animate", {
1840
1889
  attributeName: "r",
1841
- values: "30;48;30",
1890
+ values: `${xn(a)};${xn(a) * 1.6};${xn(a)}`,
1842
1891
  dur: "2s",
1843
1892
  repeatCount: "indefinite"
1844
- }, null, -1), i("animate", {
1893
+ }, null, 8, ht), c[6] ||= i("animate", {
1845
1894
  attributeName: "opacity",
1846
1895
  values: "0.4;0.05;0.4",
1847
1896
  dur: "2s",
1848
1897
  repeatCount: "indefinite"
1849
- }, null, -1)]], 8, ht)) : n("", !0), i("g", gt, [p(t.$slots, "node-icon", {
1898
+ }, null, -1)], 8, mt)) : n("", !0),
1899
+ i("g", {
1900
+ class: "node-icon",
1901
+ transform: Sn(a)
1902
+ }, [p(t.$slots, "node-icon", {
1850
1903
  node: a,
1851
- color: I(a),
1904
+ color: F(a),
1852
1905
  viewMode: _.viewMode
1853
1906
  }, () => [i("rect", {
1854
1907
  x: "-18",
@@ -1856,25 +1909,25 @@ var b = {
1856
1909
  width: "36",
1857
1910
  height: "36",
1858
1911
  rx: "6",
1859
- fill: I(a),
1912
+ fill: F(a),
1860
1913
  opacity: "0.9"
1861
- }, null, 8, _t)])])], 8, mt),
1862
- Er.value ? (u(), r("g", {
1863
- key: 0,
1864
- transform: bn(a)
1914
+ }, null, 8, _t)])], 8, gt),
1915
+ Pr.value ? (u(), r("g", {
1916
+ key: 1,
1917
+ transform: Cn(a)
1865
1918
  }, [i("circle", {
1866
1919
  r: "4",
1867
- fill: hn(a).color,
1920
+ fill: gn(a).color,
1868
1921
  stroke: "#0a0e1a",
1869
1922
  "stroke-width": "2"
1870
1923
  }, null, 8, yt)], 8, vt)) : n("", !0),
1871
1924
  i("text", {
1872
- y: Sn(a),
1873
- transform: `rotate(${a.rotation || 0} 0 ${Sn(a)})`,
1925
+ y: Tn(a),
1926
+ transform: `rotate(${a.rotation || 0} 0 ${Tn(a)})`,
1874
1927
  "text-anchor": "middle",
1875
- fill: Vt(a),
1876
- "font-size": Bt(a),
1877
- "font-weight": Ht(a),
1928
+ fill: Ht(a),
1929
+ "font-size": Vt(a),
1930
+ "font-weight": Ut(a),
1878
1931
  "font-family": "'Segoe UI', system-ui, sans-serif",
1879
1932
  opacity: "0.9"
1880
1933
  }, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
@@ -1883,42 +1936,42 @@ var b = {
1883
1936
  dy: t === 0 ? 0 : "1.2em"
1884
1937
  }, m(e), 9, xt))), 128))], 8, bt)
1885
1938
  ], 64)),
1886
- Tr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(Zr(a), (e) => (u(), r("circle", {
1939
+ Nr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(ii(a), (e) => (u(), r("circle", {
1887
1940
  key: e.side,
1888
1941
  cx: e.x,
1889
1942
  cy: e.y,
1890
1943
  r: "4.5",
1891
1944
  class: "node-handle",
1892
1945
  fill: "#0a0e1a",
1893
- stroke: I(a),
1946
+ stroke: F(a),
1894
1947
  "stroke-width": "1.5",
1895
- onPointerdown: g((t) => ei(t, a.id, e), ["stop", "prevent"]),
1896
- onPointermove: g(ui, ["stop"]),
1897
- onPointerup: g(di, ["stop"]),
1898
- onPointercancel: g(di, ["stop"]),
1899
- onLostpointercapture: di,
1948
+ onPointerdown: g((t) => si(t, a.id, e), ["stop", "prevent"]),
1949
+ onPointermove: g(_i, ["stop"]),
1950
+ onPointerup: g(vi, ["stop"]),
1951
+ onPointercancel: g(vi, ["stop"]),
1952
+ onLostpointercapture: vi,
1900
1953
  onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
1901
1954
  onClick: c[1] ||= g(() => {}, ["stop"])
1902
1955
  }, null, 40, Ct))), 128))])) : n("", !0)
1903
1956
  ], 46, st))), 128)),
1904
- Xr.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(Wr(Xr.value), (e) => (u(), r("rect", {
1957
+ ri.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(Zr(ri.value), (e) => (u(), r("rect", {
1905
1958
  key: e.side,
1906
- x: Xr.value.x + e.x - 4.5,
1907
- y: Xr.value.y + e.y - 4.5,
1959
+ x: ri.value.x + e.x - 4.5,
1960
+ y: ri.value.y + e.y - 4.5,
1908
1961
  width: "9",
1909
1962
  height: "9",
1910
1963
  rx: "2",
1911
1964
  class: o(["node-resize-handle", `rt-${e.side}`]),
1912
- onMousedown: g((t) => Kr(t, Xr.value, e.side), ["stop", "prevent"]),
1965
+ onMousedown: g((t) => $r(t, ri.value, e.side), ["stop", "prevent"]),
1913
1966
  onClick: c[2] ||= g(() => {}, ["stop"])
1914
1967
  }, null, 42, Tt))), 128))])) : n("", !0),
1915
- q.value ? (u(), r("rect", {
1968
+ K.value ? (u(), r("rect", {
1916
1969
  key: 4,
1917
1970
  class: "marquee-box",
1918
- x: ir.value.x,
1919
- y: ir.value.y,
1920
- width: ir.value.width,
1921
- height: ir.value.height,
1971
+ x: fr.value.x,
1972
+ y: fr.value.y,
1973
+ width: fr.value.width,
1974
+ height: fr.value.height,
1922
1975
  rx: "2",
1923
1976
  "vector-effect": "non-scaling-stroke"
1924
1977
  }, null, 8, Et)) : n("", !0)