vue3-network-graph 0.1.4 → 0.1.6

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
@@ -208,11 +208,11 @@ var b = {
208
208
  "height",
209
209
  "rx",
210
210
  "stroke"
211
- ], ft = ["fill"], pt = [
211
+ ], ft = [
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
+ ], pt = ["dy"], mt = ["r", "stroke"], ht = ["values"], gt = ["transform"], _t = ["fill"], vt = ["transform"], yt = ["fill"], bt = [
216
216
  "y",
217
217
  "transform",
218
218
  "fill",
@@ -238,7 +238,7 @@ var b = {
238
238
  "y",
239
239
  "width",
240
240
  "height"
241
- ], Dt = 6, Ot = 14, kt = 3, At = 60, jt = .2, Mt = 5, Nt = 160, Pt = 140, Ft = 12, It = 4e3, Lt = 12, Rt = 4e3, zt = {
241
+ ], Dt = 6, Ot = 14, kt = 3, x = 60, At = .2, jt = 5, Mt = 160, Nt = 140, Pt = 12, Ft = 4e3, It = 12, Lt = 4e3, Rt = {
242
242
  __name: "Topology",
243
243
  props: {
244
244
  nodes: {
@@ -296,9 +296,9 @@ var b = {
296
296
  "node-resize-end"
297
297
  ],
298
298
  setup(_, { expose: te, emit: ne }) {
299
- let v = _, y = ne, zt = 0, Bt = () => {
300
- zt++;
301
- }, x = (e) => e && typeof e == "object" ? {
299
+ let v = _, y = ne, Rt = 0, zt = () => {
300
+ Rt++;
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
- }, Vt = (e, t = 11) => e.fontSize || t, Ht = (e) => e.fontColor || "#000000", Ut = (e, t = 500) => e.fontWeight || t, S = (e, t) => e.fontSize || x(t).fontSize || 8, C = (e, t) => e.fontColor || x(t).color || "#000000", w = d(v.nodes.map((e) => ({ ...e }))), Wt = null, T = () => {
312
- Wt = w.value, y("update:nodes", w.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 === Wt) return;
316
+ if (t === Gt) return;
317
317
  let n = null, r = null;
318
318
  try {
319
- n = JSON.stringify(t), r = JSON.stringify(w.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) && (Bt(), w.value = t.map((e) => ({ ...e })));
323
+ (n === null || n !== r) && (zt(), C.value = t.map((e) => ({ ...e })));
324
324
  }, { deep: !0 });
325
- let Gt = d(v.lineMode);
325
+ let Kt = d(v.lineMode);
326
326
  h(() => v.lineMode, (e) => {
327
- Gt.value = e;
327
+ Kt.value = e;
328
328
  });
329
- let E = t({
330
- get: () => Gt.value,
329
+ let T = t({
330
+ get: () => Kt.value,
331
331
  set: (e) => {
332
- Gt.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(w.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: w.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
- w,
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 = w.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 && (w.value = w.value.filter((t) => !e.has(t.id)), T()), 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(w.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 ? (w.value = [...w.value, ...r], T(), 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 w.value = w.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 ? (T(), 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) ? (w.value = JSON.parse(JSON.stringify(t.nodes)), T()) : (w.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Wt = w.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
- Bt();
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 w.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.nodeType === "text", _n = (e) => e.nodeType === "border-only", vn = (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
- }, yn = (e) => {
535
- let t = vn(e.width, At), n = vn(e.height, At);
534
+ }, bn = (e) => {
535
+ let t = yn(e.width, x), n = yn(e.height, x);
536
536
  return {
537
- sx: t / At,
538
- sy: n / At
537
+ sx: t / x,
538
+ sy: n / x
539
539
  };
540
- }, bn = (e) => {
541
- let { sx: t, sy: n } = yn(e);
542
- return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
543
540
  }, xn = (e) => {
544
- let { w: t, h: n } = L(e), r = Math.min(10, t * .3), i = Math.min(10, n * .3);
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);
545
+ return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
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
- }, Sn = t(() => {
549
+ }, wn = t(() => {
547
550
  let e = Number(v.config.labelGap);
548
551
  return Number.isFinite(e) && e >= 0 ? e : 18;
549
- }), Cn = (e) => {
550
- if (gn(e)) return 4;
551
- let { h: t } = L(e);
552
- return e.labelPosition === "top" ? -(t / 2 + Sn.value) : e.labelPosition === "center" ? 0 : t / 2 + Sn.value;
553
- }, wn = (e) => {
554
- let t = R(e);
555
- if (gn(e) || !e.label) return t;
556
- let n = Vt(e), r = Cn(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,147 +565,147 @@ var b = {
562
565
  i > t.y + t.height && (t.height = i - t.y);
563
566
  }
564
567
  return t;
565
- }, Tn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, L = (e) => {
566
- let t = gn(e), n = _n(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: vn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : n ? Math.max(80, String(e.label).length * 8 + 24) : At),
569
- h: vn(e.height, t ? 26 : n ? 40 : At)
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
- }, En = (e) => Tn(e) ? R(e) : null, Dn = (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 On = (e) => z.value.includes(e.id), kn = (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: w.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
- }, An = (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, jn = t(() => An(v.config.maxSelectNodes)), Mn = t(() => An(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([jn, Mn], ([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 Nn = t(() => v.config.selectedBorderColor || "#fbbf24"), Pn = (e, t) => {
598
- if (!Wn()) {
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], jn.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], jn.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", On(e) ? e : null), V();
609
+ y("node-click", e), y("node-select", An(e) ? e : null), B();
607
610
  }
608
- }, Fn = (e) => {
609
- let t = w.value.find((t) => t.id === e);
611
+ }, Ln = (e) => {
612
+ let t = C.value.find((t) => t.id === e);
610
613
  if (!t || v.config.enableZOrder === !1) return !1;
611
- let n = t.zIndex ?? 0, r = w.value.filter((e) => (e.zIndex ?? 0) > n);
614
+ let n = t.zIndex ?? 0, r = C.value.filter((e) => (e.zIndex ?? 0) > n);
612
615
  return r.length !== 0 && (t.zIndex = Math.min(...r.map((e) => e.zIndex ?? 0)), !0);
613
- }, In = (e) => {
614
- let t = w.value.find((t) => t.id === e);
616
+ }, Rn = (e) => {
617
+ let t = C.value.find((t) => t.id === e);
615
618
  if (!t || v.config.enableZOrder === !1) return !1;
616
- let n = t.zIndex ?? 0, r = w.value.filter((e) => (e.zIndex ?? 0) < n);
619
+ let n = t.zIndex ?? 0, r = C.value.filter((e) => (e.zIndex ?? 0) < n);
617
620
  return r.length !== 0 && (t.zIndex = Math.max(...r.map((e) => e.zIndex ?? 0)), !0);
618
- }, Ln = (e) => {
619
- let t = w.value.find((t) => t.id === e);
620
- return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.max(...w.value.map((e) => e.zIndex ?? 0), 0) + 1, !0);
621
- }, Rn = (e) => {
622
- let t = w.value.find((t) => t.id === e);
623
- return !t || v.config.enableZOrder === !1 ? !1 : (t.zIndex = Math.min(...w.value.map((e) => e.zIndex ?? 0), 0) - 1, !0);
624
- }, zn = () => {
625
- if (!O.value) return;
626
- let e = O.value.cloneNode(!0);
627
- e.querySelectorAll("animate, animateMotion, animateTransform, set").forEach((e) => e.remove()), e.querySelectorAll(".center-crosshair").forEach((e) => e.remove()), e.setAttribute("width", U.value || "800"), e.setAttribute("height", W.value || "600");
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");
628
631
  let t = new XMLSerializer().serializeToString(e);
629
632
  t = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + t;
630
633
  let n = new Blob([t], { type: "image/svg+xml;charset=utf-8" }), r = URL.createObjectURL(n), i = document.createElement("a");
631
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);
632
- }, Bn = t(() => v.config.selectedLineColor || "#fbbf24"), Vn = (e, t) => {
633
- if (Wn()) return;
634
- let n = P.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
635
- let t = P.value[e.id];
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];
636
639
  return t && t.key === n.key;
637
640
  }) : null, a = r ? i.map((e) => e.id) : [e.id], o = r ? {
638
641
  ...e,
639
642
  bundleEdges: i
640
643
  } : e;
641
- 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, Mn.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);
642
645
  else {
643
- let e = a.length === B.value.length && a.every((e) => B.value.includes(e));
644
- B.value = e ? [] : H([], a, Mn.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 = [];
645
648
  }
646
- y("edge-select", kn(e) ? o : null), V();
647
- }, Hn = 0, Un = (e = 200) => {
648
- Hn = performance.now() + e;
649
- }, Wn = () => performance.now() < Hn, Gn = () => {
650
- z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V();
651
- }, Kn = (e) => {
652
- if (Wn()) 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;
653
656
  let t = e.target;
654
- t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || Gn();
655
- }, qn = d({
657
+ t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || qn();
658
+ }, Yn = d({
656
659
  width: 1e3,
657
660
  height: 650
658
- }), Jn = d(1), Yn = d(0), Xn = d(0), Zn = t(() => -$n.value / 2 + Yn.value), Qn = t(() => -er.value / 2 + Xn.value), $n = t(() => v.width ?? qn.value.width), er = t(() => v.height ?? qn.value.height), tr = 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;
659
662
  l(() => {
660
- let e = O.value;
663
+ let e = D.value;
661
664
  if (e) {
662
665
  let t = e.getBoundingClientRect();
663
- t.width > 0 && t.height > 0 && (qn.value = {
666
+ t.width > 0 && t.height > 0 && (Yn.value = {
664
667
  width: t.width,
665
668
  height: t.height
666
669
  });
667
670
  }
668
- e && typeof ResizeObserver < "u" && (tr = new ResizeObserver(() => {
671
+ e && typeof ResizeObserver < "u" && (rr = new ResizeObserver(() => {
669
672
  let t = e.getBoundingClientRect();
670
- t.width > 0 && t.height > 0 && (qn.value = {
673
+ t.width > 0 && t.height > 0 && (Yn.value = {
671
674
  width: t.width,
672
675
  height: t.height
673
676
  });
674
- }), tr.observe(e));
677
+ }), rr.observe(e));
675
678
  }), c(() => {
676
- tr &&= (tr.disconnect(), null), Wr &&= (cancelAnimationFrame(Wr), 0), hr &&= (cancelAnimationFrame(hr), 0), Z &&= (cancelAnimationFrame(Z), 0), mi(), xr();
679
+ rr &&= (rr.disconnect(), null), J &&= (cancelAnimationFrame(J), 0), q &&= (cancelAnimationFrame(q), 0), ci &&= (cancelAnimationFrame(ci), 0), hi(), Sr();
677
680
  });
678
- let U = t(() => $n.value / Jn.value), W = t(() => er.value / Jn.value), nr = t(() => ({
679
- x0: Zn.value - Nt,
680
- y0: Qn.value - Nt,
681
- x1: Zn.value + U.value + Nt,
682
- y1: Qn.value + W.value + Nt
683
- })), rr = t(() => {
684
- let e = nr.value, t = w.value.filter((t) => {
685
- 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);
686
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;
687
690
  });
688
691
  return v.config.enableZOrder !== !1 && t.sort((e, t) => (e.zIndex ?? 0) - (t.zIndex ?? 0)), t;
689
- }), G = t(() => {
690
- let e = nr.value;
691
- return M.value.filter((t) => {
692
- if (!Ai(t)) return !1;
693
- let n = F(t.from), r = F(t.to);
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);
694
697
  if (!n || !r) return !1;
695
- let i = L(n).w / 2, a = L(n).h / 2, o = L(r).w / 2, s = L(r).h / 2;
696
- return Math.min(n.x - i, r.x - o) - Pt <= e.x1 && Math.max(n.x + i, r.x + o) + Pt >= e.x0 && Math.min(n.y - a, r.y - s) - Pt <= e.y1 && Math.max(n.y + a, r.y + s) + Pt >= e.y0;
698
+ let i = I(n).w / 2, a = I(n).h / 2, o = I(r).w / 2, s = I(r).h / 2;
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;
697
700
  });
698
- }), ir = (e) => {
701
+ }), or = (e) => {
699
702
  if (v.config.enableZoom === !1) return;
700
703
  e.preventDefault();
701
- 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(Mt, Math.max(jt, Jn.value * c)), u = $n.value / l, d = er.value / l;
702
- Yn.value += (o - u) * i, Xn.value += (s - d) * a, Jn.value = l;
703
- }, K = d(null), q = d(null), ar = (e) => {
704
- let t = O.value, n = t ? t.getBoundingClientRect() : null;
705
- 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 = {
706
709
  startX: e.clientX,
707
710
  startY: e.clientY,
708
711
  lastX: e.clientX,
@@ -710,9 +713,9 @@ var b = {
710
713
  moved: !1,
711
714
  rectWidth: n && n.width ? n.width : 0,
712
715
  rectHeight: n && n.height ? n.height : 0
713
- }, br();
714
- }, or = (e) => {
715
- let t = K.value, n = O.value;
716
+ }, xr();
717
+ }, cr = (e) => {
718
+ let t = G.value, n = D.value;
716
719
  if (!t || !n) return;
717
720
  let r = t.rectWidth, i = t.rectHeight;
718
721
  if (!r || !i) return;
@@ -722,13 +725,13 @@ var b = {
722
725
  return;
723
726
  }
724
727
  let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
725
- t.lastX = e.clientX, t.lastY = e.clientY, Yn.value -= a * (U.value / r), Xn.value -= o * (W.value / i);
726
- }, sr = () => {
727
- let e = K.value;
728
- K.value = null, e && e.moved && Un(), Sr();
729
- }, cr = (e) => {
730
- let t = X(e);
731
- q.value = {
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) => {
733
+ let t = Z(e);
734
+ K.value = {
732
735
  start: {
733
736
  x: t.x,
734
737
  y: t.y
@@ -740,17 +743,17 @@ var b = {
740
743
  startClientX: e.clientX,
741
744
  startClientY: e.clientY,
742
745
  moved: !1
743
- }, br();
744
- }, lr = (e) => {
745
- let t = q.value;
746
+ }, xr();
747
+ }, dr = (e) => {
748
+ let t = K.value;
746
749
  if (!t) return;
747
- let n = X(e);
750
+ let n = Z(e);
748
751
  t.current = {
749
752
  x: n.x,
750
753
  y: n.y
751
754
  }, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
752
- }, ur = t(() => {
753
- let e = q.value;
755
+ }, fr = t(() => {
756
+ let e = K.value;
754
757
  return e ? {
755
758
  x: Math.min(e.start.x, e.current.x),
756
759
  y: Math.min(e.start.y, e.current.y),
@@ -762,62 +765,62 @@ var b = {
762
765
  width: 0,
763
766
  height: 0
764
767
  };
765
- }), dr = () => {
766
- let e = q.value;
767
- if (q.value = null, e && e.moved) {
768
+ }), pr = () => {
769
+ let e = K.value;
770
+ if (K.value = null, e && e.moved) {
768
771
  let t = {
769
772
  x: Math.min(e.start.x, e.current.x),
770
773
  y: Math.min(e.start.y, e.current.y),
771
774
  w: Math.abs(e.current.x - e.start.x),
772
775
  h: Math.abs(e.current.y - e.start.y)
773
- }, n = w.value.filter((e) => {
774
- 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;
775
778
  return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
776
779
  });
777
- n.length && (z.value = H(z.value, n.map((e) => e.id), jn.value), V()), Un();
780
+ n.length && (R.value = V(R.value, n.map((e) => e.id), Nn.value), B()), Gn();
778
781
  }
779
- Sr();
780
- }, fr = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), pr = (e) => {
781
- 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) {
782
785
  if (e.button === 1) {
783
786
  if (v.config.enablePan === !1) return;
784
- e.preventDefault(), ar(e);
787
+ e.preventDefault(), sr(e);
785
788
  return;
786
789
  }
787
- if (e.button === 0 && !fr(e.target)) {
790
+ if (e.button === 0 && !mr(e.target)) {
788
791
  if (e.ctrlKey || e.metaKey) {
789
792
  if (v.config.enableMarquee === !1) return;
790
- e.preventDefault(), cr(e);
793
+ e.preventDefault(), ur(e);
791
794
  return;
792
795
  }
793
- v.config.enablePan !== !1 && (e.preventDefault(), ar(e));
796
+ v.config.enablePan !== !1 && (e.preventDefault(), sr(e));
794
797
  }
795
798
  }
796
- }, mr = !1, hr = 0, gr = null, _r = () => {
797
- hr = 0;
798
- let e = gr;
799
- gr = null, e && (K.value ? or(e) : q.value && lr(e));
800
- }, vr = (e) => {
801
- gr = e, hr ||= requestAnimationFrame(_r);
802
- }, yr = () => {
803
- hr && (cancelAnimationFrame(hr), _r()), K.value && sr(), q.value && dr();
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);
804
805
  }, br = () => {
805
- mr || (mr = !0, window.addEventListener("mousemove", vr, !0), window.addEventListener("mouseup", yr, !0));
806
+ q && (cancelAnimationFrame(q), vr()), G.value && lr(), K.value && pr();
806
807
  }, xr = () => {
807
- mr && (mr = !1, window.removeEventListener("mousemove", vr, !0), window.removeEventListener("mouseup", yr, !0));
808
+ gr || (gr = !0, window.addEventListener("mousemove", yr, !0), window.addEventListener("mouseup", br, !0));
808
809
  }, Sr = () => {
809
- !K.value && !q.value && xr();
810
- }, Cr = t(() => {
811
- if (J.value && J.value.side) return { cursor: Qr(J.value.side) };
812
- if (q.value) return { cursor: "crosshair" };
813
- if (K.value && K.value.moved) return { cursor: "grabbing" };
814
- }), wr = t(() => v.config.showGrid !== !1), Tr = t(() => v.config.gridColor || "#1a2240"), Er = t(() => {
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(() => {
815
818
  let e = Number(v.config.gridStep);
816
- return (Number.isFinite(e) && e > 0 ? e : 40) / Jn.value;
817
- }), Dr = t(() => {
819
+ return (Number.isFinite(e) && e > 0 ? e : 40) / Xn.value;
820
+ }), Or = t(() => {
818
821
  let e = Number(v.config.gridOpacity);
819
822
  return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
820
- }), Or = t(() => {
823
+ }), kr = t(() => {
821
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) => ({
822
825
  offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
823
826
  color: e.color,
@@ -837,100 +840,100 @@ var b = {
837
840
  r: e.r || "60%",
838
841
  stops: n
839
842
  };
840
- }), kr = t(() => v.config.showCenterPoint === !0), Ar = t(() => v.config.showEdgeTextBg === !0), jr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Mr = t(() => v.config.showNodeHandles === !0), Nr = t(() => v.config.showStatusDot !== !1), Pr = (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) => {
841
844
  let n = Number(e);
842
845
  return Number.isFinite(n) && n >= 0 ? n : t;
843
- }, Fr = t(() => {
846
+ }, Ir = t(() => {
844
847
  let e = v.config.motionFx ?? v.config.fx;
845
848
  return typeof e == "boolean" ? e ? "all" : "none" : [
846
849
  "none",
847
850
  "flow",
848
851
  "particle",
849
852
  "all"
850
- ].includes(e) ? e : M.value.length <= Pr(v.config.fxMotionMaxEdges, 200) ? "all" : "none";
851
- }), Ir = t(() => {
852
- let e = v.config.glowFx ?? v.config.fx;
853
- return typeof e == "boolean" ? e : M.value.length <= Pr(v.config.fxGlowMaxEdges, 500);
853
+ ].includes(e) ? e : j.value.length <= Fr(v.config.fxMotionMaxEdges, 200) ? "all" : "none";
854
854
  }), Lr = t(() => {
855
+ let e = v.config.glowFx ?? v.config.fx;
856
+ return typeof e == "boolean" ? e : j.value.length <= Fr(v.config.fxGlowMaxEdges, 500);
857
+ }), Rr = t(() => {
855
858
  let e = v.config.breatheFx ?? v.config.fx;
856
- return typeof e == "boolean" ? e : w.value.length <= Pr(v.config.fxBreatheMaxNodes, 300);
857
- }), Rr = (e) => {
859
+ return typeof e == "boolean" ? e : C.value.length <= Fr(v.config.fxBreatheMaxNodes, 300);
860
+ }), zr = (e) => {
858
861
  if (e.animatedMode !== void 0) {
859
862
  let t = e.animatedMode;
860
- return !t || t === "all" ? Fr.value : t === "none" ? "none" : t;
863
+ return !t || t === "all" ? Ir.value : t === "none" ? "none" : t;
861
864
  }
862
- return e.animated === void 0 || e.animated ? Fr.value : "none";
863
- }, zr = (e) => e.borderColor || I(e) || "#94a3b8", Br = (e) => e.borderWidth || 0, Vr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Hr = (e) => {
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) => {
864
867
  let t = e.borderRadius;
865
868
  if (t == null || t === "") return 6;
866
869
  let n = Number(t);
867
870
  return Number.isFinite(n) && n >= 0 ? n : 6;
868
- }, Ur = (e, t) => {
871
+ }, Wr = (e, t) => {
869
872
  if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
870
873
  e.stopPropagation();
871
- let n = F(t), r = X(e);
872
- if (Kt.value = {
874
+ let n = P(t), r = Z(e);
875
+ if (qt.value = {
873
876
  x: r.x - n.x,
874
877
  y: r.y - n.y
875
- }, Jt = {
878
+ }, Yt = {
876
879
  x: e.clientX,
877
880
  y: e.clientY
878
- }, 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)) {
879
882
  let e = {};
880
- z.value.forEach((t) => {
881
- let n = F(t);
883
+ R.value.forEach((t) => {
884
+ let n = P(t);
882
885
  n && (e[t] = {
883
886
  x: n.x,
884
887
  y: n.y
885
888
  });
886
- }), qt.value = {
889
+ }), Jt.value = {
887
890
  origins: e,
888
891
  start: {
889
892
  x: r.x,
890
893
  y: r.y
891
894
  }
892
895
  };
893
- } else qt.value = null;
894
- D.value = t, y("node-drag-start", n);
895
- }, Wr = 0, Gr = null, Kr = () => {
896
- Wr = 0;
896
+ } else Jt.value = null;
897
+ E.value = t, y("node-drag-start", n);
898
+ }, J = 0, Gr = null, Kr = () => {
899
+ J = 0;
897
900
  let e = Gr;
898
901
  Gr = null, e && Jr(e);
899
902
  }, qr = (e) => {
900
- (J.value || D.value) && (Gr = {
903
+ (Y.value || E.value) && (Gr = {
901
904
  clientX: e.clientX,
902
905
  clientY: e.clientY
903
- }, Wr ||= requestAnimationFrame(Kr));
906
+ }, J ||= requestAnimationFrame(Kr));
904
907
  }, Jr = (e) => {
905
- if (J.value) {
908
+ if (Y.value) {
906
909
  ei(e);
907
910
  return;
908
911
  }
909
- if (!D.value) return;
910
- let t = X(e);
911
- !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], jn.value), B.value = [], y("node-select", z.value.includes(D.value) ? F(D.value) : null), V()));
912
- let n = qt.value;
912
+ if (!E.value) return;
913
+ let t = Z(e);
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;
913
916
  if (n) {
914
917
  let e = t.x - n.start.x, r = t.y - n.start.y;
915
- w.value = w.value.map((t) => n.origins[t.id] ? {
918
+ C.value = C.value.map((t) => n.origins[t.id] ? {
916
919
  ...t,
917
920
  x: n.origins[t.id].x + e,
918
921
  y: n.origins[t.id].y + r
919
922
  } : t);
920
- } else w.value = w.value.map((e) => e.id === D.value ? {
923
+ } else C.value = C.value.map((e) => e.id === E.value ? {
921
924
  ...e,
922
- x: t.x - Kt.value.x,
923
- y: t.y - Kt.value.y
925
+ x: t.x - qt.value.x,
926
+ y: t.y - qt.value.y
924
927
  } : e);
925
- T();
928
+ w();
926
929
  }, Yr = () => {
927
- if (Wr && (cancelAnimationFrame(Wr), Kr()), J.value) {
930
+ if (J && (cancelAnimationFrame(J), Kr()), Y.value) {
928
931
  ti();
929
932
  return;
930
933
  }
931
- D.value && (Yt && Un(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
932
- }, J = d(null), Xr = (e, t, n) => Math.min(n, Math.max(t, e)), Zr = (e) => {
933
- 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;
934
937
  return [
935
938
  {
936
939
  side: "nw",
@@ -975,8 +978,8 @@ var b = {
975
978
  ];
976
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) => {
977
980
  if (!v.editable || v.config.nodeResizable === !1 || !t) return;
978
- let { w: r, h: i } = L(t);
979
- J.value = {
981
+ let { w: r, h: i } = I(t);
982
+ Y.value = {
980
983
  id: t.id,
981
984
  side: n,
982
985
  anchorX: n.includes("e") ? t.x - r / 2 : n.includes("w") ? t.x + r / 2 : null,
@@ -985,35 +988,35 @@ var b = {
985
988
  startH: i
986
989
  }, y("node-resize-start", t);
987
990
  }, ei = (e) => {
988
- let t = J.value;
991
+ let t = Y.value;
989
992
  if (!t) return;
990
- let n = F(t.id);
993
+ let n = P(t.id);
991
994
  if (!n) return;
992
- let r = X(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
995
+ let r = Z(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
993
996
  if (t.anchorX !== null) {
994
997
  let e = t.side.includes("e");
995
- i = Xr(e ? r.x - t.anchorX : t.anchorX - r.x, Ft, It), 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;
996
999
  }
997
1000
  if (t.anchorY !== null) {
998
1001
  let e = t.side.includes("s");
999
- a = Xr(e ? r.y - t.anchorY : t.anchorY - r.y, Lt, Rt), 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;
1000
1003
  }
1001
- w.value = w.value.map((e) => e.id === t.id ? {
1004
+ C.value = C.value.map((e) => e.id === t.id ? {
1002
1005
  ...e,
1003
1006
  x: o,
1004
1007
  y: s,
1005
1008
  width: i,
1006
1009
  height: a
1007
- } : e), T();
1010
+ } : e), w();
1008
1011
  }, ti = () => {
1009
- let e = J.value;
1010
- J.value = null, e && (Un(), y("node-resize-end", F(e.id) || null));
1012
+ let e = Y.value;
1013
+ Y.value = null, e && (Gn(), y("node-resize-end", P(e.id) || null));
1011
1014
  }, ni = t(() => v.editable && v.config.nodeResizable !== !1), ri = t(() => {
1012
1015
  if (!ni.value) return null;
1013
- let e = z.value;
1014
- return e.length === 1 && F(e[0]) || null;
1015
- }), Y = d(null), ii = (e) => {
1016
- let t = R(e);
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);
1017
1020
  return [
1018
1021
  {
1019
1022
  side: "top",
@@ -1037,7 +1040,7 @@ var b = {
1037
1040
  }
1038
1041
  ];
1039
1042
  }, ai = (e, t) => {
1040
- let n = O.value;
1043
+ let n = D.value;
1041
1044
  if (!n) return null;
1042
1045
  let r = e, i = t;
1043
1046
  if (e && typeof e == "object" && (r = e.clientX, i = e.clientY), r == null || i == null) return null;
@@ -1051,7 +1054,7 @@ var b = {
1051
1054
  y: s.y
1052
1055
  };
1053
1056
  }, oi = (e, t) => {
1054
- let n = O.value;
1057
+ let n = D.value;
1055
1058
  if (!n) return null;
1056
1059
  let r = n.createSVGPoint();
1057
1060
  r.x = Number(e) || 0, r.y = Number(t) || 0;
@@ -1062,14 +1065,14 @@ var b = {
1062
1065
  x: a.x,
1063
1066
  y: a.y
1064
1067
  };
1065
- }, X = (e) => ai(e) ?? {
1068
+ }, Z = (e) => ai(e) ?? {
1066
1069
  x: 0,
1067
1070
  y: 0
1068
1071
  }, si = (e, t, n) => {
1069
- let r = F(t);
1070
- if (!r || !O.value) return;
1071
- let i = X(e);
1072
- Y.value = {
1072
+ let r = P(t);
1073
+ if (!r || !D.value) return;
1074
+ let i = Z(e);
1075
+ X.value = {
1073
1076
  fromId: t,
1074
1077
  side: n.side,
1075
1078
  ax: r.x + n.x,
@@ -1081,42 +1084,42 @@ var b = {
1081
1084
  try {
1082
1085
  e.target.setPointerCapture?.(e.pointerId);
1083
1086
  } catch {}
1084
- pi();
1085
- }, Z = 0, ci = null, li = () => {
1086
- Z = 0;
1087
- let e = ci;
1088
- ci = null, e && Y.value && gi(e);
1089
- }, ui = (e) => {
1090
- Y.value && (ci = {
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 = {
1091
1094
  clientX: e.clientX,
1092
1095
  clientY: e.clientY
1093
- }, Z ||= requestAnimationFrame(li));
1094
- }, di = () => {
1095
- Z && (cancelAnimationFrame(Z), li()), Y.value && _i();
1096
- }, fi = !1, pi = () => {
1097
- fi || (fi = !0, window.addEventListener("mousemove", ui, !0), window.addEventListener("mouseup", di, !0));
1098
- }, mi = () => {
1099
- fi && (fi = !1, window.removeEventListener("mousemove", ui, !0), window.removeEventListener("mouseup", di, !0));
1100
- }, hi = (e, t, n) => {
1101
- let r = w.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;
1102
1105
  for (let i = r.length - 1; i >= 0; i--) {
1103
1106
  let a = r[i];
1104
1107
  if (a.id === n) continue;
1105
- let o = R(a);
1108
+ let o = L(a);
1106
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;
1107
1110
  }
1108
1111
  return null;
1109
- }, gi = (e) => {
1110
- let t = Y.value;
1112
+ }, _i = (e) => {
1113
+ let t = X.value;
1111
1114
  if (!t) return;
1112
- let n = X(e);
1115
+ let n = Z(e);
1113
1116
  t.px = n.x, t.py = n.y;
1114
- let r = hi(n.x, n.y, t.fromId);
1117
+ let r = gi(n.x, n.y, t.fromId);
1115
1118
  t.overId = r ? r.id : null;
1116
- }, _i = () => {
1117
- mi();
1118
- let e = Y.value;
1119
- if (Y.value = null, !e || !e.overId || e.overId === e.fromId) return;
1119
+ }, vi = () => {
1120
+ hi();
1121
+ let e = X.value;
1122
+ if (X.value = null, !e || !e.overId || e.overId === e.fromId) return;
1120
1123
  let t = {
1121
1124
  id: `${re()}`,
1122
1125
  from: e.fromId,
@@ -1125,9 +1128,9 @@ var b = {
1125
1128
  fromAnchor: "edge",
1126
1129
  toAnchor: "edge"
1127
1130
  };
1128
- k.value.push(t), y("edge-create", t);
1129
- }, vi = (e, t, n) => {
1130
- 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);
1131
1134
  if (!n || n === "center" || a === 0 && o === 0) return {
1132
1135
  x: r,
1133
1136
  y: i
@@ -1137,20 +1140,20 @@ var b = {
1137
1140
  x: r + a * p,
1138
1141
  y: i + o * p
1139
1142
  };
1140
- }, yi = t(() => {
1143
+ }, bi = t(() => {
1141
1144
  let e = /* @__PURE__ */ new Map();
1142
- M.value.forEach((t) => {
1143
- let n = P.value[t.id];
1145
+ j.value.forEach((t) => {
1146
+ let n = N.value[t.id];
1144
1147
  n && !n.hidden && (e.has(n.key) || e.set(n.key, []), e.get(n.key).push(t));
1145
1148
  });
1146
1149
  let t = {};
1147
1150
  return e.forEach((e, n) => {
1148
- let [r, i] = n.split("__"), a = F(r), o = F(i);
1151
+ let [r, i] = n.split("__"), a = P(r), o = P(i);
1149
1152
  if (!a || !o) return;
1150
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;
1151
1154
  if (m > 1) {
1152
1155
  let e = (m - 1) / 2 * Ot, t = (e) => {
1153
- let { w: t, h: n } = L(e);
1156
+ let { w: t, h: n } = I(e);
1154
1157
  return Math.max(4, (Math.abs(f) * t + Math.abs(p) * n) / 2 - 6);
1155
1158
  }, n = Math.min(1, t(a) / e, t(o) / e);
1156
1159
  ee = Ot * Math.max(.35, n);
@@ -1169,12 +1172,12 @@ var b = {
1169
1172
  bulge: Math.min(l * .15, 50)
1170
1173
  };
1171
1174
  }), t;
1172
- }), bi = (e) => {
1173
- let t = P.value[e.id], n = t && yi.value[t.key];
1175
+ }), xi = (e) => {
1176
+ let t = N.value[e.id], n = t && bi.value[t.key];
1174
1177
  if (!n) return null;
1175
- let r = F(e.from), i = F(e.to);
1178
+ let r = P(e.from), i = P(e.to);
1176
1179
  if (!r || !i) return null;
1177
- let a = n.slots[e.id] || 0, o = a * n.gap, s = vi(r, i, e.fromAnchor), c = vi(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);
1178
1181
  return {
1179
1182
  frame: n,
1180
1183
  slot: a,
@@ -1187,12 +1190,12 @@ var b = {
1187
1190
  y: c.y + n.ny * o
1188
1191
  }
1189
1192
  };
1190
- }, xi = (e) => {
1191
- let t = bi(e);
1193
+ }, Si = (e) => {
1194
+ let t = xi(e);
1192
1195
  if (!t) return "";
1193
1196
  let { from: n, to: r, frame: i, slot: a } = t, o = a * i.gap;
1194
- if (E.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1195
- if (E.value === "polyline") {
1197
+ if (T.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1198
+ if (T.value === "polyline") {
1196
1199
  if (i.dominant === "v") {
1197
1200
  let e = (n.y + r.y) / 2 + o;
1198
1201
  return `M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`;
@@ -1202,18 +1205,18 @@ var b = {
1202
1205
  }
1203
1206
  let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
1204
1207
  return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
1205
- }, Si = (e, t) => {
1206
- let n = bi(e);
1208
+ }, Ci = (e, t) => {
1209
+ let n = xi(e);
1207
1210
  if (!n) return {
1208
1211
  x: 0,
1209
1212
  y: 0
1210
1213
  };
1211
1214
  let { from: r, to: i, frame: a, slot: o } = n, s = o * a.gap;
1212
- if (E.value === "straight") return {
1215
+ if (T.value === "straight") return {
1213
1216
  x: r.x + (i.x - r.x) * t,
1214
1217
  y: r.y + (i.y - r.y) * t
1215
1218
  };
1216
- if (E.value === "polyline") {
1219
+ if (T.value === "polyline") {
1217
1220
  if (a.dominant === "v") {
1218
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);
1219
1222
  return c <= n ? {
@@ -1244,29 +1247,29 @@ var b = {
1244
1247
  x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
1245
1248
  y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
1246
1249
  };
1247
- }, Ci = t(() => Y.value ? F(Y.value.fromId) : null), wi = t(() => Y.value && Y.value.overId ? F(Y.value.overId) : null), Ti = t(() => Ci.value ? I(Ci.value) : "#00f0ff"), Ei = t(() => {
1248
- let e = Y.value;
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(() => {
1251
+ let e = X.value;
1249
1252
  if (!e) return {
1250
1253
  x: 0,
1251
1254
  y: 0
1252
1255
  };
1253
- let t = wi.value;
1254
- return t && Ci.value ? vi(t, Ci.value, "edge") : {
1256
+ let t = Ti.value;
1257
+ return t && wi.value ? yi(t, wi.value, "edge") : {
1255
1258
  x: e.px,
1256
1259
  y: e.py
1257
1260
  };
1258
- }), Di = t(() => {
1259
- let e = wi.value;
1261
+ }), Oi = t(() => {
1262
+ let e = Ti.value;
1260
1263
  if (!e) return null;
1261
- let t = R(e);
1264
+ let t = L(e);
1262
1265
  return {
1263
1266
  x: e.x + t.x - 4,
1264
1267
  y: e.y + t.y - 4,
1265
1268
  w: t.width + 8,
1266
1269
  h: t.height + 8
1267
1270
  };
1268
- }), Oi = (e) => {
1269
- let t = e.nodeIds.map((e) => F(e)).filter(Boolean);
1271
+ }), ki = (e) => {
1272
+ let t = e.nodeIds.map((e) => P(e)).filter(Boolean);
1270
1273
  if (t.length === 0) return null;
1271
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;
1272
1275
  return {
@@ -1275,120 +1278,120 @@ var b = {
1275
1278
  width: a - r,
1276
1279
  height: o - i
1277
1280
  };
1278
- }, ki = t(() => v.groups.map((e) => ({
1281
+ }, Ai = t(() => v.groups.map((e) => ({
1279
1282
  ...e,
1280
- rect: Oi(e)
1281
- })).filter((e) => e.rect)), Q = (e) => kn(e) ? Bn.value : (F(e.from), e.centerText && e.centerText.color || "#00f0ff"), Ai = (e) => {
1282
- 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];
1283
1286
  return !!t && !t.hidden;
1284
- }, ji = t(() => [...new Set(M.value.map(Q))].map((e) => ({
1287
+ }, Mi = t(() => [...new Set(j.value.map(Q))].map((e) => ({
1285
1288
  key: String(e).replace("#", ""),
1286
1289
  color: e
1287
- }))), Mi = (e) => {
1290
+ }))), Ni = (e) => {
1288
1291
  let t = e.endMarker;
1289
1292
  if (!t || t === "none") return "";
1290
1293
  let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
1291
1294
  return `url(#${t === "dot" ? "edge-dot" : "edge-arrow"}-${r})`;
1292
- }, Ni = /* @__PURE__ */ new Map(), Pi = {
1295
+ }, Pi = /* @__PURE__ */ new Map(), Fi = {
1293
1296
  nodes: null,
1294
1297
  edges: null,
1295
1298
  mode: null,
1296
1299
  epoch: -1
1297
- }, Fi = () => {
1298
- let e = Pi;
1299
- (e.nodes !== w.value || e.edges !== M.value || e.mode !== E.value || e.epoch !== zt) && (Pi = {
1300
- nodes: w.value,
1301
- edges: M.value,
1302
- mode: E.value,
1303
- epoch: zt
1304
- }, Ni = /* @__PURE__ */ new Map());
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,
1306
+ epoch: Rt
1307
+ }, Pi = /* @__PURE__ */ new Map());
1305
1308
  }, $ = (e) => {
1306
- Fi();
1307
- let t = Ni.get(e.id);
1308
- return t === void 0 && (t = xi(e), Ni.set(e.id, t)), t;
1309
- }, Ii = (e, t = 1) => `${2 / e.speed * t}s`, Li = (e) => `${3 / e.speed}s`, Ri = (e) => {
1310
- let t = Rr(e);
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);
1311
1314
  return t === "flow" || t === "all";
1312
- }, zi = (e) => {
1313
- let t = Rr(e);
1315
+ }, Bi = (e) => {
1316
+ let t = zr(e);
1314
1317
  return t === "particle" || t === "all";
1315
- }, Bi = (e) => x(e).text, Vi = (e) => !!e && String(x(e).text ?? "").trim() !== "", Hi = (e, t) => {
1318
+ }, Vi = (e) => Bt(e).text, Hi = (e) => !!e && String(Bt(e).text ?? "").trim() !== "", Ui = (e, t) => {
1316
1319
  if (!e) return null;
1317
- let n = x(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;
1318
1321
  for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
1319
1322
  return {
1320
1323
  w: Math.max(14, a * r + 8),
1321
1324
  h: Math.max(12, r + 6)
1322
1325
  };
1323
- }, Ui = (e, t) => {
1324
- let n = Si(e, Math.max(0, t - .005)), r = Si(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));
1325
1328
  return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
1326
- }, Wi = (e) => {
1329
+ }, Gi = (e) => {
1327
1330
  let t = e % 180;
1328
1331
  return t > 90 && (t -= 180), t < -90 && (t += 180), t;
1329
- }, Gi = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(x(e).rotation || 0) + (n || 0)})`, Ki = t(() => {
1332
+ }, Ki = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(Bt(e).rotation || 0) + (n || 0)})`, qi = t(() => {
1330
1333
  let e = [];
1331
- for (let t of G.value) {
1332
- let n = P.value[t.id];
1334
+ for (let t of W.value) {
1335
+ let n = N.value[t.id];
1333
1336
  if (!n) continue;
1334
1337
  let r = n.merged && n.representative, i = !n.merged && (t.fromText || t.centerText || t.toText);
1335
1338
  if (!r && !i) continue;
1336
- let a = F(t.from), o = F(t.to);
1339
+ let a = P(t.from), o = P(t.to);
1337
1340
  a && o && e.push({
1338
1341
  id: t.id,
1339
1342
  edge: t,
1340
1343
  info: n,
1341
1344
  color: a && ie[a.nodeType] || "#00f0ff",
1342
- start: Si(t, .28),
1343
- center: Si(t, .5),
1344
- end: Si(t, .72),
1345
- startAngle: Wi(Ui(t, .28)),
1346
- centerAngle: Wi(Ui(t, .5)),
1347
- endAngle: Wi(Ui(t, .72)),
1348
- fromBox: Hi(t.fromText, t),
1349
- centerBox: Hi(t.centerText, t),
1350
- toBox: Hi(t.toText, t)
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)
1351
1354
  });
1352
1355
  }
1353
1356
  return e;
1354
1357
  });
1355
1358
  return te({
1356
- resetDataBaseline: on,
1357
- getData: sn,
1358
- setData: pn,
1359
- removeSelected: cn,
1360
- addNodes: ln,
1361
- addEdges: un,
1362
- updateNodes: dn,
1363
- updateEdges: fn,
1359
+ resetDataBaseline: sn,
1360
+ getData: cn,
1361
+ setData: mn,
1362
+ removeSelected: ln,
1363
+ addNodes: un,
1364
+ addEdges: dn,
1365
+ updateNodes: fn,
1366
+ updateEdges: pn,
1364
1367
  clientToSvg: ai,
1365
1368
  svgToClient: oi,
1366
- moveLayerUp: Fn,
1367
- moveLayerDown: In,
1368
- moveToFront: Ln,
1369
- moveToBack: Rn,
1370
- downloadSVG: zn
1369
+ moveLayerUp: Ln,
1370
+ moveLayerDown: Rn,
1371
+ moveToFront: zn,
1372
+ moveToBack: Bn,
1373
+ downloadSVG: Vn
1371
1374
  }), (t, c) => (u(), r("svg", {
1372
1375
  ref_key: "svgRef",
1373
- ref: O,
1376
+ ref: D,
1374
1377
  class: "topology-svg",
1375
- style: s(Cr.value),
1376
- viewBox: `${Zn.value} ${Qn.value} ${U.value} ${W.value}`,
1377
- onMousedown: pr,
1378
+ style: s(wr.value),
1379
+ viewBox: `${$n.value} ${er.value} ${H.value} ${U.value}`,
1380
+ onMousedown: hr,
1378
1381
  onMousemove: qr,
1379
1382
  onMouseup: Yr,
1380
1383
  onMouseleave: Yr,
1381
- onClick: Kn,
1382
- onWheel: g(ir, ["prevent"])
1384
+ onClick: Jn,
1385
+ onWheel: g(or, ["prevent"])
1383
1386
  }, [
1384
1387
  i("defs", null, [
1385
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),
1386
1389
  i("radialGradient", {
1387
1390
  id: "bg-grid",
1388
- cx: Or.value.cx,
1389
- cy: Or.value.cy,
1390
- r: Or.value.r
1391
- }, [(u(!0), r(e, null, f(Or.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", {
1392
1395
  key: `bg-stop-${t}`,
1393
1396
  offset: e.offset,
1394
1397
  "stop-color": e.color,
@@ -1415,7 +1418,7 @@ var b = {
1415
1418
  }, null, 8, de)
1416
1419
  ], 8, ce))), 128)),
1417
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),
1418
- (u(!0), r(e, null, f(ji.value, (e) => (u(), r("marker", {
1421
+ (u(!0), r(e, null, f(Mi.value, (e) => (u(), r("marker", {
1419
1422
  key: `m-arrow-${e.key}`,
1420
1423
  id: `edge-arrow-${e.key}`,
1421
1424
  viewBox: "0 0 10 10",
@@ -1429,7 +1432,7 @@ var b = {
1429
1432
  d: "M1,2.5 L9,5 L1,7.5 Z",
1430
1433
  fill: e.color
1431
1434
  }, null, 8, pe)], 8, fe))), 128)),
1432
- (u(!0), r(e, null, f(ji.value, (e) => (u(), r("marker", {
1435
+ (u(!0), r(e, null, f(Mi.value, (e) => (u(), r("marker", {
1433
1436
  key: `m-dot-${e.key}`,
1434
1437
  id: `edge-dot-${e.key}`,
1435
1438
  viewBox: "0 0 10 10",
@@ -1447,31 +1450,31 @@ var b = {
1447
1450
  }, null, 8, he)], 8, me))), 128))
1448
1451
  ]),
1449
1452
  i("rect", {
1450
- width: U.value,
1451
- height: W.value,
1452
- x: Zn.value,
1453
- y: Qn.value,
1453
+ width: H.value,
1454
+ height: U.value,
1455
+ x: $n.value,
1456
+ y: er.value,
1454
1457
  fill: "url(#bg-grid)"
1455
1458
  }, null, 8, ge),
1456
- wr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1459
+ Tr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1457
1460
  id: "grid",
1458
- width: Er.value,
1459
- height: Er.value,
1461
+ width: Dr.value,
1462
+ height: Dr.value,
1460
1463
  patternUnits: "userSpaceOnUse"
1461
1464
  }, [i("path", {
1462
- d: `M ${Er.value} 0 L 0 0 0 ${Er.value}`,
1465
+ d: `M ${Dr.value} 0 L 0 0 0 ${Dr.value}`,
1463
1466
  fill: "none",
1464
- stroke: Tr.value,
1467
+ stroke: Er.value,
1465
1468
  "stroke-width": "0.5"
1466
1469
  }, null, 8, ve)], 8, _e), i("rect", {
1467
- width: U.value,
1468
- height: W.value,
1469
- x: Zn.value,
1470
- y: Qn.value,
1470
+ width: H.value,
1471
+ height: U.value,
1472
+ x: $n.value,
1473
+ y: er.value,
1471
1474
  fill: "url(#grid)",
1472
- opacity: Dr.value
1475
+ opacity: Or.value
1473
1476
  }, null, 8, ye)], 64)) : n("", !0),
1474
- kr.value ? (u(), r("g", be, [...c[5] ||= [
1477
+ Ar.value ? (u(), r("g", be, [...c[5] ||= [
1475
1478
  i("line", {
1476
1479
  x1: "-22",
1477
1480
  y1: "0",
@@ -1503,7 +1506,7 @@ var b = {
1503
1506
  opacity: "0.8"
1504
1507
  }, null, -1)
1505
1508
  ]])) : n("", !0),
1506
- (u(!0), r(e, null, f(ki.value, (e) => (u(), r("g", { key: e.id }, [
1509
+ (u(!0), r(e, null, f(Ai.value, (e) => (u(), r("g", { key: e.id }, [
1507
1510
  i("rect", {
1508
1511
  x: e.rect.x,
1509
1512
  y: e.rect.y,
@@ -1565,16 +1568,16 @@ var b = {
1565
1568
  "letter-spacing": "0.5"
1566
1569
  }, m(e.label), 9, De)
1567
1570
  ]))), 128)),
1568
- (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", {
1569
1572
  key: `base-${e.id}`,
1570
1573
  d: $(e),
1571
1574
  fill: "none",
1572
1575
  stroke: "#1a2744",
1573
1576
  "stroke-width": "2",
1574
1577
  "stroke-linecap": "round",
1575
- "marker-end": Mi(e)
1578
+ "marker-end": Ni(e)
1576
1579
  }, null, 8, Oe))), 128)),
1577
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Ir.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", {
1578
1581
  key: 0,
1579
1582
  d: $(t),
1580
1583
  fill: "none",
@@ -1584,16 +1587,16 @@ var b = {
1584
1587
  opacity: "0.15",
1585
1588
  filter: "url(#glow-strong)"
1586
1589
  }, null, 8, ke)) : n("", !0)], 64))), 128)),
1587
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [kn(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", {
1588
1591
  key: 0,
1589
1592
  d: $(t),
1590
1593
  fill: "none",
1591
- stroke: Bn.value,
1594
+ stroke: Hn.value,
1592
1595
  "stroke-width": "4",
1593
1596
  opacity: "0.35",
1594
1597
  filter: "url(#glow-strong)"
1595
1598
  }, null, 8, Ae)) : n("", !0)], 64))), 128)),
1596
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [Ri(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, [
1597
1600
  i("path", {
1598
1601
  d: $(t),
1599
1602
  fill: "none",
@@ -1606,7 +1609,7 @@ var b = {
1606
1609
  attributeName: "stroke-dashoffset",
1607
1610
  from: "0",
1608
1611
  to: "-52",
1609
- dur: Ii(t),
1612
+ dur: Li(t),
1610
1613
  repeatCount: "indefinite"
1611
1614
  }, null, 8, Ne)], 8, Me),
1612
1615
  i("path", {
@@ -1621,7 +1624,7 @@ var b = {
1621
1624
  attributeName: "stroke-dashoffset",
1622
1625
  from: "-30",
1623
1626
  to: "-82",
1624
- dur: Ii(t, 1.3),
1627
+ dur: Li(t, 1.3),
1625
1628
  repeatCount: "indefinite"
1626
1629
  }, null, 8, Fe)], 8, Pe),
1627
1630
  i("path", {
@@ -1637,18 +1640,18 @@ var b = {
1637
1640
  attributeName: "stroke-dashoffset",
1638
1641
  from: "0",
1639
1642
  to: "-84",
1640
- dur: Ii(t, .8),
1643
+ dur: Li(t, .8),
1641
1644
  repeatCount: "indefinite"
1642
1645
  }, null, 8, Le)], 8, Ie)
1643
1646
  ])) : n("", !0)], 64))), 128)),
1644
- (u(!0), r(e, null, f(G.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [zi(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", {
1645
1648
  r: "3",
1646
1649
  fill: Q(t),
1647
1650
  opacity: "0.9",
1648
1651
  filter: "url(#glow-core)"
1649
1652
  }, [i("animateMotion", {
1650
1653
  path: $(t),
1651
- dur: Li(t),
1654
+ dur: Ri(t),
1652
1655
  repeatCount: "indefinite"
1653
1656
  }, null, 8, Be)], 8, ze), i("circle", {
1654
1657
  r: "8",
@@ -1657,17 +1660,17 @@ var b = {
1657
1660
  filter: "url(#glow-strong)"
1658
1661
  }, [i("animateMotion", {
1659
1662
  path: $(t),
1660
- dur: Li(t),
1663
+ dur: Ri(t),
1661
1664
  repeatCount: "indefinite"
1662
1665
  }, null, 8, He)], 8, Ve)])) : n("", !0)], 64))), 128)),
1663
- (u(!0), r(e, null, f(Ki.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", {
1664
1667
  key: 0,
1665
1668
  transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
1666
1669
  }, [i("rect", {
1667
1670
  x: "-7",
1668
- y: -S(t.edge, null) / 2,
1671
+ y: -Wt(t.edge, null) / 2,
1669
1672
  width: 14,
1670
- height: S(t.edge, null),
1673
+ height: Wt(t.edge, null),
1671
1674
  rx: "2",
1672
1675
  fill: "#FFFFFF",
1673
1676
  opacity: "0.9",
@@ -1677,121 +1680,121 @@ var b = {
1677
1680
  y: "0",
1678
1681
  "dominant-baseline": "central",
1679
1682
  "text-anchor": "middle",
1680
- "font-size": S(t.edge, null),
1681
- fill: C(t.edge, null),
1683
+ "font-size": Wt(t.edge, null),
1684
+ fill: S(t.edge, null),
1682
1685
  "font-family": "'SF Mono', monospace",
1683
1686
  opacity: "1"
1684
1687
  }, m(t.info.count), 9, Ge)], 8, Ue)) : t.info.merged ? n("", !0) : (u(), r("g", Ke, [
1685
- Vi(t.edge.fromText) ? (u(), r("g", {
1688
+ Hi(t.edge.fromText) ? (u(), r("g", {
1686
1689
  key: 0,
1687
- transform: Gi(t.edge.fromText, t.start, t.startAngle)
1688
- }, [Ar.value ? (u(), r("rect", {
1690
+ transform: Ki(t.edge.fromText, t.start, t.startAngle)
1691
+ }, [jr.value ? (u(), r("rect", {
1689
1692
  key: 0,
1690
1693
  x: -t.fromBox.w / 2,
1691
1694
  y: -t.fromBox.h / 2,
1692
1695
  width: t.fromBox.w,
1693
1696
  height: t.fromBox.h,
1694
1697
  rx: "3",
1695
- fill: jr.value,
1698
+ fill: Mr.value,
1696
1699
  opacity: "0.92",
1697
- stroke: C(t.edge, t.edge.fromText),
1700
+ stroke: S(t.edge, t.edge.fromText),
1698
1701
  "stroke-opacity": "0.35",
1699
1702
  "stroke-width": "0.6"
1700
1703
  }, null, 8, Je)) : n("", !0), i("text", {
1701
1704
  y: "0",
1702
1705
  "dominant-baseline": "central",
1703
1706
  "text-anchor": "middle",
1704
- "font-size": S(t.edge, t.edge.fromText),
1705
- fill: C(t.edge, t.edge.fromText),
1707
+ "font-size": Wt(t.edge, t.edge.fromText),
1708
+ fill: S(t.edge, t.edge.fromText),
1706
1709
  "font-family": "'SF Mono', monospace",
1707
1710
  "font-weight": "500",
1708
1711
  opacity: "0.9"
1709
- }, m(Bi(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1710
- Vi(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", {
1711
1714
  key: 1,
1712
- transform: Gi(t.edge.centerText, t.center, t.centerAngle)
1713
- }, [Ar.value ? (u(), r("rect", {
1715
+ transform: Ki(t.edge.centerText, t.center, t.centerAngle)
1716
+ }, [jr.value ? (u(), r("rect", {
1714
1717
  key: 0,
1715
1718
  x: -t.centerBox.w / 2,
1716
1719
  y: -t.centerBox.h / 2,
1717
1720
  width: t.centerBox.w,
1718
1721
  height: t.centerBox.h,
1719
1722
  rx: "3",
1720
- fill: jr.value,
1723
+ fill: Mr.value,
1721
1724
  opacity: "0.92",
1722
- stroke: C(t.edge, t.edge.centerText),
1725
+ stroke: S(t.edge, t.edge.centerText),
1723
1726
  "stroke-opacity": "0.35",
1724
1727
  "stroke-width": "0.6"
1725
1728
  }, null, 8, Ze)) : n("", !0), i("text", {
1726
1729
  y: "0",
1727
1730
  "dominant-baseline": "central",
1728
1731
  "text-anchor": "middle",
1729
- "font-size": S(t.edge, t.edge.centerText),
1730
- fill: C(t.edge, t.edge.centerText),
1732
+ "font-size": Wt(t.edge, t.edge.centerText),
1733
+ fill: S(t.edge, t.edge.centerText),
1731
1734
  "font-family": "'SF Mono', monospace",
1732
1735
  "font-weight": "600",
1733
1736
  opacity: "1"
1734
- }, m(Bi(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1735
- Vi(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", {
1736
1739
  key: 2,
1737
- transform: Gi(t.edge.toText, t.end, t.endAngle)
1738
- }, [Ar.value ? (u(), r("rect", {
1740
+ transform: Ki(t.edge.toText, t.end, t.endAngle)
1741
+ }, [jr.value ? (u(), r("rect", {
1739
1742
  key: 0,
1740
1743
  x: -t.toBox.w / 2,
1741
1744
  y: -t.toBox.h / 2,
1742
1745
  width: t.toBox.w,
1743
1746
  height: t.toBox.h,
1744
1747
  rx: "3",
1745
- fill: jr.value,
1748
+ fill: Mr.value,
1746
1749
  opacity: "0.92",
1747
- stroke: C(t.edge, t.edge.toText),
1750
+ stroke: S(t.edge, t.edge.toText),
1748
1751
  "stroke-opacity": "0.35",
1749
1752
  "stroke-width": "0.6"
1750
1753
  }, null, 8, et)) : n("", !0), i("text", {
1751
1754
  y: "0",
1752
1755
  "dominant-baseline": "central",
1753
1756
  "text-anchor": "middle",
1754
- "font-size": S(t.edge, t.edge.toText),
1755
- fill: C(t.edge, t.edge.toText),
1757
+ "font-size": Wt(t.edge, t.edge.toText),
1758
+ fill: S(t.edge, t.edge.toText),
1756
1759
  "font-family": "'SF Mono', monospace",
1757
1760
  "font-weight": "500",
1758
1761
  opacity: "0.9"
1759
- }, m(Bi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1762
+ }, m(Vi(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1760
1763
  ]))], 64))), 128)),
1761
- Y.value ? (u(), r("g", nt, [
1764
+ X.value ? (u(), r("g", nt, [
1762
1765
  i("line", {
1763
- x1: Y.value.ax,
1764
- y1: Y.value.ay,
1765
- x2: Ei.value.x,
1766
- y2: Ei.value.y,
1767
- stroke: Ti.value,
1766
+ x1: X.value.ax,
1767
+ y1: X.value.ay,
1768
+ x2: Di.value.x,
1769
+ y2: Di.value.y,
1770
+ stroke: Ei.value,
1768
1771
  "stroke-width": "2",
1769
1772
  "stroke-dasharray": "6 6",
1770
1773
  "stroke-linecap": "round",
1771
1774
  opacity: "0.9"
1772
1775
  }, null, 8, rt),
1773
1776
  i("circle", {
1774
- cx: Y.value.px,
1775
- cy: Y.value.py,
1777
+ cx: X.value.px,
1778
+ cy: X.value.py,
1776
1779
  r: "3.5",
1777
- fill: Ti.value,
1780
+ fill: Ei.value,
1778
1781
  opacity: "0.9"
1779
1782
  }, null, 8, it),
1780
- Y.value.overId && Di.value ? (u(), r("rect", {
1783
+ X.value.overId && Oi.value ? (u(), r("rect", {
1781
1784
  key: 0,
1782
- x: Di.value.x,
1783
- y: Di.value.y,
1784
- width: Di.value.w,
1785
- height: Di.value.h,
1785
+ x: Oi.value.x,
1786
+ y: Oi.value.y,
1787
+ width: Oi.value.w,
1788
+ height: Oi.value.h,
1786
1789
  rx: "6",
1787
1790
  fill: "none",
1788
- stroke: Ti.value,
1791
+ stroke: Ei.value,
1789
1792
  "stroke-width": "1.5",
1790
1793
  "stroke-dasharray": "6 4",
1791
1794
  opacity: "0.9"
1792
1795
  }, null, 8, at)) : n("", !0)
1793
1796
  ])) : n("", !0),
1794
- (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", {
1795
1798
  key: `hit-${e.id}`,
1796
1799
  d: $(e),
1797
1800
  fill: "none",
@@ -1801,100 +1804,102 @@ var b = {
1801
1804
  "pointer-events": "stroke",
1802
1805
  cursor: "pointer"
1803
1806
  },
1804
- onClick: g((t) => Vn(e, t), ["stop"])
1807
+ onClick: g((t) => Un(e, t), ["stop"])
1805
1808
  }, null, 8, ot))), 128)),
1806
- (u(!0), r(e, null, f(rr.value, (a) => (u(), r("g", {
1809
+ (u(!0), r(e, null, f(ar.value, (a) => (u(), r("g", {
1807
1810
  key: a.id,
1808
1811
  transform: `translate(${a.x}, ${a.y})`,
1809
- class: o(["topology-node", D.value === a.id ? "dragging" : ""]),
1810
- onMousedown: (e) => Ur(e, a.id),
1811
- onClick: (e) => Pn(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),
1812
1815
  style: s({
1813
1816
  cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
1814
- color: I(a)
1817
+ color: F(a)
1815
1818
  })
1816
1819
  }, [
1817
1820
  i("rect", {
1818
1821
  class: "node-hit-area",
1819
- x: wn(a).x,
1820
- y: wn(a).y,
1821
- width: wn(a).width,
1822
- height: wn(a).height,
1822
+ x: En(a).x,
1823
+ y: En(a).y,
1824
+ width: En(a).width,
1825
+ height: En(a).height,
1823
1826
  fill: "transparent",
1824
1827
  "pointer-events": "all"
1825
1828
  }, null, 8, ct),
1826
- Dn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1829
+ kn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1827
1830
  key: 0,
1828
- x: R(a).x,
1829
- y: R(a).y,
1830
- width: R(a).width,
1831
- height: R(a).height,
1832
- rx: Hr(a),
1833
- fill: Dn(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),
1834
1837
  opacity: "0.15"
1835
1838
  }, null, 8, lt)) : n("", !0),
1836
- En(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1839
+ On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1837
1840
  key: 1,
1838
- x: En(a).x,
1839
- y: En(a).y,
1840
- width: En(a).width,
1841
- height: En(a).height,
1842
- rx: Hr(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),
1843
1846
  fill: "none",
1844
- stroke: zr(a),
1845
- "stroke-width": Br(a),
1846
- "stroke-dasharray": Vr(a),
1847
+ stroke: Br(a),
1848
+ "stroke-width": Vr(a),
1849
+ "stroke-dasharray": Hr(a),
1847
1850
  opacity: "0.8"
1848
1851
  }, null, 8, ut)) : n("", !0),
1849
- On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1852
+ An(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1850
1853
  key: 2,
1851
- x: R(a).x,
1852
- y: R(a).y,
1853
- width: R(a).width,
1854
- height: R(a).height,
1855
- rx: Hr(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),
1856
1859
  fill: "none",
1857
- stroke: Nn.value,
1860
+ stroke: Fn.value,
1858
1861
  "stroke-width": "2.5",
1859
1862
  transform: "scale(1.1)",
1860
1863
  style: { "pointer-events": "none" }
1861
1864
  }, null, 8, dt)) : n("", !0),
1862
- gn(a) ? (u(), r(e, { key: 3 }, [i("rect", {
1863
- x: "-4",
1864
- y: "-10",
1865
- width: "8",
1866
- height: "20",
1867
- fill: hn(a).color,
1868
- opacity: "0.06"
1869
- }, null, 8, ft), i("text", {
1865
+ _n(a) ? (u(), r("text", {
1866
+ key: 3,
1870
1867
  y: "4",
1871
1868
  transform: `rotate(${a.rotation || 0} 0 4)`,
1872
1869
  "text-anchor": "middle",
1873
- fill: Ht(a) || I(a) || hn(a).color,
1870
+ fill: Ht(a) || F(a) || gn(a).color,
1874
1871
  "font-size": Vt(a, 12),
1875
1872
  "font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
1876
1873
  "font-weight": "600"
1877
- }, m(a.label), 9, pt)], 64)) : _n(a) ? (u(), r(e, { key: 4 }, [], 64)) : (u(), r(e, { key: 5 }, [
1878
- i("g", { transform: bn(a) }, [a.state !== "none" && Lr.value ? (u(), r("circle", {
1874
+ }, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
1875
+ key: t,
1876
+ x: "0",
1877
+ dy: t === 0 ? 0 : "1.2em"
1878
+ }, m(e), 9, pt))), 128))], 8, ft)) : vn(a) ? (u(), r(e, { key: 4 }, [], 64)) : (u(), r(e, { key: 5 }, [
1879
+ a.state !== "none" && Rr.value ? (u(), r("circle", {
1879
1880
  key: 0,
1880
- r: "30",
1881
+ r: xn(a),
1881
1882
  fill: "none",
1882
- stroke: hn(a).color,
1883
+ stroke: gn(a).color,
1883
1884
  "stroke-width": "2.5",
1884
1885
  opacity: "0"
1885
- }, [...c[6] ||= [i("animate", {
1886
+ }, [i("animate", {
1886
1887
  attributeName: "r",
1887
- values: "30;48;30",
1888
+ values: `${xn(a)};${xn(a) * 1.6};${xn(a)}`,
1888
1889
  dur: "2s",
1889
1890
  repeatCount: "indefinite"
1890
- }, null, -1), i("animate", {
1891
+ }, null, 8, ht), c[6] ||= i("animate", {
1891
1892
  attributeName: "opacity",
1892
1893
  values: "0.4;0.05;0.4",
1893
1894
  dur: "2s",
1894
1895
  repeatCount: "indefinite"
1895
- }, null, -1)]], 8, ht)) : n("", !0), i("g", gt, [p(t.$slots, "node-icon", {
1896
+ }, null, -1)], 8, mt)) : n("", !0),
1897
+ i("g", {
1898
+ class: "node-icon",
1899
+ transform: Sn(a)
1900
+ }, [p(t.$slots, "node-icon", {
1896
1901
  node: a,
1897
- color: I(a),
1902
+ color: F(a),
1898
1903
  viewMode: _.viewMode
1899
1904
  }, () => [i("rect", {
1900
1905
  x: "-18",
@@ -1902,21 +1907,21 @@ var b = {
1902
1907
  width: "36",
1903
1908
  height: "36",
1904
1909
  rx: "6",
1905
- fill: I(a),
1910
+ fill: F(a),
1906
1911
  opacity: "0.9"
1907
- }, null, 8, _t)])])], 8, mt),
1908
- Nr.value ? (u(), r("g", {
1909
- key: 0,
1910
- transform: xn(a)
1912
+ }, null, 8, _t)])], 8, gt),
1913
+ Pr.value ? (u(), r("g", {
1914
+ key: 1,
1915
+ transform: Cn(a)
1911
1916
  }, [i("circle", {
1912
1917
  r: "4",
1913
- fill: hn(a).color,
1918
+ fill: gn(a).color,
1914
1919
  stroke: "#0a0e1a",
1915
1920
  "stroke-width": "2"
1916
1921
  }, null, 8, yt)], 8, vt)) : n("", !0),
1917
1922
  i("text", {
1918
- y: Cn(a),
1919
- transform: `rotate(${a.rotation || 0} 0 ${Cn(a)})`,
1923
+ y: Tn(a),
1924
+ transform: `rotate(${a.rotation || 0} 0 ${Tn(a)})`,
1920
1925
  "text-anchor": "middle",
1921
1926
  fill: Ht(a),
1922
1927
  "font-size": Vt(a),
@@ -1929,20 +1934,20 @@ var b = {
1929
1934
  dy: t === 0 ? 0 : "1.2em"
1930
1935
  }, m(e), 9, xt))), 128))], 8, bt)
1931
1936
  ], 64)),
1932
- Mr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(ii(a), (e) => (u(), r("circle", {
1937
+ Nr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(ii(a), (e) => (u(), r("circle", {
1933
1938
  key: e.side,
1934
1939
  cx: e.x,
1935
1940
  cy: e.y,
1936
1941
  r: "4.5",
1937
1942
  class: "node-handle",
1938
1943
  fill: "#0a0e1a",
1939
- stroke: I(a),
1944
+ stroke: F(a),
1940
1945
  "stroke-width": "1.5",
1941
1946
  onPointerdown: g((t) => si(t, a.id, e), ["stop", "prevent"]),
1942
- onPointermove: g(gi, ["stop"]),
1943
- onPointerup: g(_i, ["stop"]),
1944
- onPointercancel: g(_i, ["stop"]),
1945
- onLostpointercapture: _i,
1947
+ onPointermove: g(_i, ["stop"]),
1948
+ onPointerup: g(vi, ["stop"]),
1949
+ onPointercancel: g(vi, ["stop"]),
1950
+ onLostpointercapture: vi,
1946
1951
  onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
1947
1952
  onClick: c[1] ||= g(() => {}, ["stop"])
1948
1953
  }, null, 40, Ct))), 128))])) : n("", !0)
@@ -1958,20 +1963,20 @@ var b = {
1958
1963
  onMousedown: g((t) => $r(t, ri.value, e.side), ["stop", "prevent"]),
1959
1964
  onClick: c[2] ||= g(() => {}, ["stop"])
1960
1965
  }, null, 42, Tt))), 128))])) : n("", !0),
1961
- q.value ? (u(), r("rect", {
1966
+ K.value ? (u(), r("rect", {
1962
1967
  key: 4,
1963
1968
  class: "marquee-box",
1964
- x: ur.value.x,
1965
- y: ur.value.y,
1966
- width: ur.value.width,
1967
- height: ur.value.height,
1969
+ x: fr.value.x,
1970
+ y: fr.value.y,
1971
+ width: fr.value.width,
1972
+ height: fr.value.height,
1968
1973
  rx: "2",
1969
1974
  "vector-effect": "non-scaling-stroke"
1970
1975
  }, null, 8, Et)) : n("", !0)
1971
1976
  ], 44, ae));
1972
1977
  }
1973
- }, Bt = { install(e) {
1974
- e.component("Topology", zt);
1978
+ }, zt = { install(e) {
1979
+ e.component("Topology", Rt);
1975
1980
  } };
1976
1981
  //#endregion
1977
- export { zt as Topology, Bt as default, ie as nodeColors, b as nodeStates };
1982
+ export { Rt as Topology, zt as default, ie as nodeColors, b as nodeStates };