vue3-network-graph 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -70,528 +70,7 @@ var b = {
70
70
  color: "#64748b",
71
71
  label: "Idle"
72
72
  }
73
- }, x = [
74
- {
75
- id: "cdn",
76
- label: "CDN Edge",
77
- type: "cdn",
78
- state: "idle",
79
- x: 0,
80
- y: -230,
81
- fontColor: "#fef08a",
82
- fontSize: 12
83
- },
84
- {
85
- id: "waf",
86
- label: "Web WAF",
87
- type: "firewall",
88
- state: "normal",
89
- x: -290,
90
- y: -150,
91
- width: 80,
92
- height: 90,
93
- borderColor: "#ff6b35",
94
- borderWidth: 2,
95
- borderStyle: "dashed",
96
- labelPosition: "top",
97
- fontColor: "#ffb38f"
98
- },
99
- {
100
- id: "lb",
101
- label: "入口负载均衡",
102
- type: "loadbalancer",
103
- state: "normal",
104
- x: 290,
105
- y: -150,
106
- fontColor: "#d8b4fe"
107
- },
108
- {
109
- id: "gw",
110
- label: "API 网关",
111
- type: "core",
112
- state: "normal",
113
- x: 0,
114
- y: -50,
115
- fontColor: "#67e8f9",
116
- fontSize: 14,
117
- fontWeight: 700
118
- },
119
- {
120
- id: "oauth",
121
- label: "认证服务",
122
- type: "server",
123
- state: "normal",
124
- x: -350,
125
- y: 70,
126
- width: 62,
127
- height: 62,
128
- fontColor: "#86efac"
129
- },
130
- {
131
- id: "order",
132
- label: "订单服务",
133
- type: "server",
134
- state: "normal",
135
- x: -170,
136
- y: 70,
137
- width: 110,
138
- height: 96,
139
- borderColor: "#4ade80",
140
- borderWidth: 1,
141
- fontColor: "#86efac",
142
- fontSize: 13
143
- },
144
- {
145
- id: "pay",
146
- label: "支付服务",
147
- type: "server",
148
- state: "error",
149
- x: 0,
150
- y: 70,
151
- width: 110,
152
- height: 96,
153
- rotation: -3,
154
- fontColor: "#fda4af",
155
- fontSize: 13
156
- },
157
- {
158
- id: "user",
159
- label: "用户服务",
160
- type: "server",
161
- state: "normal",
162
- x: 170,
163
- y: 70,
164
- width: 104,
165
- height: 96,
166
- fontColor: "#86efac",
167
- fontSize: 13
168
- },
169
- {
170
- id: "stock",
171
- label: "库存服务",
172
- type: "server",
173
- state: "warning",
174
- x: 350,
175
- y: 70,
176
- width: 62,
177
- height: 62,
178
- fontColor: "#fde047"
179
- },
180
- {
181
- id: "redis",
182
- label: "Redis 缓存",
183
- type: "cache",
184
- state: "normal",
185
- x: -260,
186
- y: 205,
187
- borderColor: "#f43f5e",
188
- borderWidth: 1,
189
- labelPosition: "bottom",
190
- background: "#f43f5e",
191
- fontColor: "#fda4af"
192
- },
193
- {
194
- id: "mq",
195
- label: "消息队列",
196
- type: "queue",
197
- state: "warning",
198
- x: -90,
199
- y: 205,
200
- rotation: 12,
201
- borderColor: "#fb923c",
202
- borderStyle: "dashed",
203
- labelPosition: "center",
204
- background: "#fb923c",
205
- fontColor: "#fdba74"
206
- },
207
- {
208
- id: "db1",
209
- label: "MySQL 主库",
210
- type: "database",
211
- state: "normal",
212
- x: 90,
213
- y: 205,
214
- width: 70,
215
- height: 70,
216
- fontColor: "#a5f3fc"
217
- },
218
- {
219
- id: "db2",
220
- label: "MySQL 从库",
221
- type: "database",
222
- state: "idle",
223
- x: 260,
224
- y: 205,
225
- width: 62,
226
- height: 62,
227
- rotation: 8,
228
- fontColor: "#a5f3fc"
229
- },
230
- {
231
- id: "subnet",
232
- label: "SUBNET-192.168.1.0/24",
233
- type: "text",
234
- state: "normal",
235
- x: 0,
236
- y: -305,
237
- fontColor: "#94a3b8",
238
- fontSize: 12
239
- },
240
- {
241
- id: "region",
242
- label: "REGION-EAST-1 · APP LAYER",
243
- type: "text",
244
- state: "normal",
245
- x: 0,
246
- y: 260,
247
- fontColor: "#94a3b8",
248
- fontSize: 10
249
- }
250
- ], ie = [
251
- {
252
- id: "g-edge",
253
- label: "Edge Layer",
254
- color: "#facc15",
255
- nodeIds: [
256
- "cdn",
257
- "waf",
258
- "lb"
259
- ],
260
- padding: 60,
261
- rotation: -6
262
- },
263
- {
264
- id: "g-app",
265
- label: "Application Layer",
266
- color: "#4ade80",
267
- nodeIds: [
268
- "oauth",
269
- "order",
270
- "pay",
271
- "user",
272
- "stock"
273
- ],
274
- padding: 58
275
- },
276
- {
277
- id: "g-data",
278
- label: "Data Layer",
279
- color: "#22d3ee",
280
- nodeIds: [
281
- "redis",
282
- "mq",
283
- "db1",
284
- "db2"
285
- ],
286
- padding: 55
287
- }
288
- ], ae = [
289
- {
290
- id: "e1",
291
- from: "cdn",
292
- to: "waf",
293
- speed: 2.5,
294
- fromText: {
295
- text: "HTTPS",
296
- color: "#fef08a",
297
- fontSize: 10
298
- },
299
- centerText: {
300
- text: "TLS",
301
- color: "#67e8f9",
302
- fontSize: 10
303
- },
304
- toText: {
305
- text: "443",
306
- color: "#ffb38f",
307
- fontSize: 10
308
- },
309
- endMarker: "arrow",
310
- fromAnchor: "edge",
311
- toAnchor: "edge"
312
- },
313
- {
314
- id: "e2",
315
- from: "cdn",
316
- to: "lb",
317
- speed: 3,
318
- fromText: {
319
- text: "HTTPS",
320
- color: "#fef08a"
321
- },
322
- centerText: {
323
- text: "L4",
324
- color: "#d8b4fe"
325
- },
326
- toText: {
327
- text: "8080",
328
- color: "#d8b4fe"
329
- },
330
- endMarker: "arrow",
331
- toAnchor: "edge"
332
- },
333
- {
334
- id: "e3",
335
- from: "waf",
336
- to: "gw",
337
- speed: 2,
338
- fromText: {
339
- text: "HTTP/2",
340
- color: "#ffb38f"
341
- },
342
- centerText: {
343
- text: "REST",
344
- color: "#67e8f9"
345
- },
346
- toText: {
347
- text: "API",
348
- color: "#67e8f9"
349
- },
350
- endMarker: "arrow",
351
- fromAnchor: "edge"
352
- },
353
- {
354
- id: "e4",
355
- from: "lb",
356
- to: "gw",
357
- speed: 2.6,
358
- fromText: {
359
- text: "Round-Robin",
360
- color: "#d8b4fe"
361
- },
362
- centerText: {
363
- text: "HTTP",
364
- color: "#67e8f9",
365
- fontSize: 9
366
- },
367
- toText: "API",
368
- endMarker: "dot",
369
- toAnchor: "edge"
370
- },
371
- {
372
- id: "e5",
373
- from: "gw",
374
- to: "oauth",
375
- speed: 2.2,
376
- fromText: {
377
- text: "JWT",
378
- color: "#67e8f9"
379
- },
380
- centerText: {
381
- text: "OAuth2",
382
- color: "#86efac"
383
- },
384
- toText: "Token",
385
- endMarker: "dot",
386
- toAnchor: "edge"
387
- },
388
- {
389
- id: "e6",
390
- from: "gw",
391
- to: "order",
392
- speed: 2,
393
- centerText: {
394
- text: "gRPC",
395
- color: "#86efac",
396
- fontSize: 9
397
- },
398
- endMarker: "dot",
399
- toAnchor: "edge"
400
- },
401
- {
402
- id: "e7",
403
- from: "gw",
404
- to: "pay",
405
- speed: 2.2,
406
- centerText: {
407
- text: "gRPC",
408
- color: "#fda4af",
409
- fontSize: 9
410
- },
411
- endMarker: "dot",
412
- toAnchor: "edge"
413
- },
414
- {
415
- id: "e8",
416
- from: "gw",
417
- to: "user",
418
- speed: 2,
419
- centerText: {
420
- text: "gRPC",
421
- color: "#86efac",
422
- fontSize: 9
423
- },
424
- endMarker: "dot",
425
- toAnchor: "edge"
426
- },
427
- {
428
- id: "e9",
429
- from: "gw",
430
- to: "stock",
431
- speed: 2.4,
432
- centerText: {
433
- text: "gRPC",
434
- color: "#fde047",
435
- fontSize: 9
436
- },
437
- endMarker: "dot",
438
- toAnchor: "edge"
439
- },
440
- {
441
- id: "e10",
442
- from: "order",
443
- to: "redis",
444
- speed: 1.6,
445
- fromText: {
446
- text: "GET",
447
- color: "#86efac"
448
- },
449
- centerText: {
450
- text: "缓存读",
451
- color: "#fda4af"
452
- },
453
- toText: "Redis",
454
- endMarker: "dot"
455
- },
456
- {
457
- id: "e11",
458
- from: "order",
459
- to: "mq",
460
- speed: 1.8,
461
- fromText: {
462
- text: "发布",
463
- color: "#86efac"
464
- },
465
- centerText: {
466
- text: "订单事件",
467
- color: "#fdba74"
468
- },
469
- toText: "Topic",
470
- endMarker: "arrow",
471
- toAnchor: "edge"
472
- },
473
- {
474
- id: "e12",
475
- from: "pay",
476
- to: "mq",
477
- speed: 2,
478
- fromText: {
479
- text: "发布",
480
- color: "#fda4af"
481
- },
482
- centerText: {
483
- text: "支付事件",
484
- color: "#fdba74"
485
- },
486
- toText: "Topic",
487
- endMarker: "arrow",
488
- toAnchor: "edge"
489
- },
490
- {
491
- id: "e13",
492
- from: "order",
493
- to: "db1",
494
- speed: 1.5,
495
- fromText: {
496
- text: "SQL",
497
- color: "#86efac"
498
- },
499
- centerText: {
500
- text: "事务",
501
- color: "#a5f3fc",
502
- fontSize: 9
503
- },
504
- toText: "Write",
505
- endMarker: "dot",
506
- toAnchor: "edge"
507
- },
508
- {
509
- id: "e14",
510
- from: "pay",
511
- to: "db2",
512
- speed: 1.8,
513
- fromText: {
514
- text: "SQL",
515
- color: "#fda4af"
516
- },
517
- centerText: {
518
- text: "事务",
519
- color: "#a5f3fc",
520
- fontSize: 9
521
- },
522
- toText: "Write",
523
- endMarker: "dot",
524
- toAnchor: "edge"
525
- },
526
- {
527
- id: "e15",
528
- from: "user",
529
- to: "redis",
530
- speed: 2.2,
531
- fromText: {
532
- text: "GET",
533
- color: "#86efac"
534
- },
535
- centerText: {
536
- text: "Session",
537
- color: "#fda4af"
538
- },
539
- toText: "HGet",
540
- endMarker: "dot"
541
- },
542
- {
543
- id: "e16",
544
- from: "stock",
545
- to: "mq",
546
- speed: 2.4,
547
- fromText: {
548
- text: "发布",
549
- color: "#fde047"
550
- },
551
- centerText: {
552
- text: "库存事件",
553
- color: "#fdba74"
554
- },
555
- toText: "Topic",
556
- endMarker: "dot",
557
- toAnchor: "edge"
558
- },
559
- {
560
- id: "e17",
561
- from: "mq",
562
- to: "order",
563
- speed: 1.8,
564
- fromText: {
565
- text: "订阅",
566
- color: "#fdba74"
567
- },
568
- centerText: {
569
- text: "回执",
570
- color: "#86efac"
571
- },
572
- toText: "Consume",
573
- endMarker: "arrow"
574
- },
575
- {
576
- id: "e18",
577
- from: "db1",
578
- to: "db2",
579
- speed: 1.4,
580
- fromText: {
581
- text: "Master",
582
- color: "#a5f3fc"
583
- },
584
- centerText: {
585
- text: "主从复制",
586
- color: "#a5f3fc",
587
- fontSize: 9
588
- },
589
- toText: "Replica",
590
- endMarker: "dot",
591
- fromAnchor: "edge",
592
- toAnchor: "edge"
593
- }
594
- ], oe = {
73
+ }, ie = {
595
74
  core: "#00f0ff",
596
75
  firewall: "#ff6b35",
597
76
  loadbalancer: "#a855f7",
@@ -601,7 +80,15 @@ var b = {
601
80
  cache: "#f43f5e",
602
81
  queue: "#fb923c",
603
82
  text: "#94a3b8"
604
- }, se = ["viewBox"], ce = ["id"], le = ["stop-color"], ue = ["stop-color"], de = ["stop-color"], fe = ["id"], pe = ["fill"], me = ["id"], he = ["fill"], ge = [
83
+ }, ae = ["viewBox"], oe = [
84
+ "cx",
85
+ "cy",
86
+ "r"
87
+ ], se = [
88
+ "offset",
89
+ "stop-color",
90
+ "stop-opacity"
91
+ ], ce = ["id"], le = ["stop-color"], ue = ["stop-color"], de = ["stop-color"], fe = ["id"], pe = ["fill"], me = ["id"], he = ["fill"], ge = [
605
92
  "width",
606
93
  "height",
607
94
  "x",
@@ -610,7 +97,8 @@ var b = {
610
97
  "width",
611
98
  "height",
612
99
  "x",
613
- "y"
100
+ "y",
101
+ "opacity"
614
102
  ], be = {
615
103
  key: 1,
616
104
  class: "center-crosshair"
@@ -688,17 +176,22 @@ var b = {
688
176
  "width",
689
177
  "height",
690
178
  "stroke"
691
- ], ot = [
179
+ ], ot = ["d", "onClick"], st = [
692
180
  "transform",
693
181
  "onMousedown",
694
182
  "onClick"
695
- ], st = [
183
+ ], ct = [
184
+ "x",
185
+ "y",
186
+ "width",
187
+ "height"
188
+ ], lt = [
696
189
  "x",
697
190
  "y",
698
191
  "width",
699
192
  "height",
700
193
  "fill"
701
- ], ct = [
194
+ ], ut = [
702
195
  "x",
703
196
  "y",
704
197
  "width",
@@ -706,43 +199,43 @@ var b = {
706
199
  "stroke",
707
200
  "stroke-width",
708
201
  "stroke-dasharray"
709
- ], lt = [
202
+ ], dt = [
710
203
  "x",
711
204
  "y",
712
205
  "width",
713
206
  "height",
714
207
  "stroke"
715
- ], ut = ["fill"], dt = [
208
+ ], ft = ["fill"], pt = [
716
209
  "transform",
717
210
  "fill",
718
211
  "font-size"
719
- ], ft = ["transform"], pt = ["stroke"], mt = { class: "node-icon" }, ht = ["fill"], gt = { transform: "translate(20, -20)" }, _t = ["fill"], vt = [
212
+ ], mt = ["transform"], ht = ["stroke"], gt = { class: "node-icon" }, _t = ["fill"], vt = ["transform"], yt = ["fill"], bt = [
720
213
  "y",
721
214
  "transform",
722
215
  "fill",
723
216
  "font-size",
724
217
  "font-weight"
725
- ], yt = ["dy"], bt = {
218
+ ], xt = ["dy"], St = {
726
219
  key: 5,
727
220
  class: "node-handles"
728
- }, xt = [
221
+ }, Ct = [
729
222
  "cx",
730
223
  "cy",
731
224
  "stroke",
732
225
  "onPointerdown"
733
- ], St = ["d", "onClick"], Ct = {
226
+ ], wt = {
734
227
  key: 3,
735
228
  class: "node-resize-layer"
736
- }, wt = [
229
+ }, Tt = [
737
230
  "x",
738
231
  "y",
739
232
  "onMousedown"
740
- ], Tt = [
233
+ ], Et = [
741
234
  "x",
742
235
  "y",
743
236
  "width",
744
237
  "height"
745
- ], Et = 6, Dt = 14, Ot = 3, S = 60, kt = .2, At = 5, jt = 12, Mt = 4e3, Nt = 12, Pt = 4e3, Ft = {
238
+ ], 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 = {
746
239
  __name: "Topology",
747
240
  props: {
748
241
  nodes: {
@@ -800,7 +293,9 @@ var b = {
800
293
  "node-resize-end"
801
294
  ],
802
295
  setup(_, { expose: te, emit: ne }) {
803
- let v = _, y = ne, x = (e) => e && typeof e == "object" ? {
296
+ let v = _, y = ne, zt = 0, Bt = () => {
297
+ zt++;
298
+ }, x = (e) => e && typeof e == "object" ? {
804
299
  text: e.text,
805
300
  rotation: e.rotation || 0,
806
301
  fontSize: e.fontSize,
@@ -810,89 +305,105 @@ var b = {
810
305
  rotation: 0,
811
306
  fontSize: void 0,
812
307
  color: void 0
813
- }, ie = (e, t = 11) => e.fontSize || t, ae = (e) => e.fontColor || "#000000", Ft = (e, t = 500) => e.fontWeight || t, C = (e, t) => e.fontSize || x(t).fontSize || 8, w = (e, t) => e.fontColor || x(t).color || "#000000", T = d(v.nodes.map((e) => ({ ...e })));
308
+ }, 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 = () => {
309
+ Wt = w.value, y("update:nodes", w.value);
310
+ };
814
311
  h(() => v.nodes, (e) => {
815
- T.value = e.map((e) => ({ ...e }));
816
- });
817
- let It = d(v.lineMode);
312
+ let t = Array.isArray(e) ? e : [];
313
+ if (t === Wt) return;
314
+ let n = null, r = null;
315
+ try {
316
+ n = JSON.stringify(t), r = JSON.stringify(w.value);
317
+ } catch {
318
+ n = null;
319
+ }
320
+ (n === null || n !== r) && (Bt(), w.value = t.map((e) => ({ ...e })));
321
+ }, { deep: !0 });
322
+ let Gt = d(v.lineMode);
818
323
  h(() => v.lineMode, (e) => {
819
- It.value = e;
324
+ Gt.value = e;
820
325
  });
821
- let Lt = t({
822
- get: () => It.value,
326
+ let E = t({
327
+ get: () => Gt.value,
823
328
  set: (e) => {
824
- It.value = e, y("update:lineMode", e);
329
+ Gt.value = e, y("update:lineMode", e);
825
330
  }
826
- }), E = d(null), D = d(null), Rt = d({
331
+ }), D = d(null), O = d(null), Kt = d({
827
332
  x: 0,
828
333
  y: 0
829
- }), zt = d(null), O = null, k = !1, Bt = !1, A = d([]), Vt = d(/* @__PURE__ */ new Map()), j = d(/* @__PURE__ */ new Set()), M = t(() => {
830
- let e = v.edges, t = A.value.filter((t) => !e.some((e) => e.id === t.id)), n = t.length ? [...e, ...t] : e, r = Vt.value;
334
+ }), qt = d(null), Jt = null, Yt = !1, Xt = !1, k = d([]), A = d(/* @__PURE__ */ new Map()), j = d(/* @__PURE__ */ new Set()), M = t(() => {
335
+ let e = v.edges, t = [];
336
+ if (k.value.length) {
337
+ let n = new Set(e.map((e) => e.id));
338
+ t = k.value.filter((e) => !n.has(e.id));
339
+ }
340
+ let n = t.length ? [...e, ...t] : e, r = A.value;
831
341
  r.size && (n = n.map((e) => r.has(e.id) ? {
832
342
  ...e,
833
343
  ...r.get(e.id)
834
344
  } : e));
835
- let i = new Set(T.value.map((e) => e.id)), a = j.value;
345
+ let i = new Set(w.value.map((e) => e.id)), a = j.value;
836
346
  return n.filter((e) => !a.has(e.id) && i.has(e.from) && i.has(e.to));
837
- }), Ht = t(() => v.config.watchDataChanges === !0), Ut = d({
347
+ }), Zt = t(() => v.config.watchDataChanges === !0), Qt = d({
838
348
  nodes: [],
839
349
  edges: []
840
- }), Wt = "", N = null, Gt = () => JSON.parse(JSON.stringify({
841
- nodes: T.value,
350
+ }), $t = "", N = null, en = () => JSON.parse(JSON.stringify({
351
+ nodes: w.value,
842
352
  edges: M.value
843
- })), Kt = (e, t) => {
353
+ })), tn = (e, t) => {
844
354
  let n = new Map(e.map((e) => [e.id, e])), r = new Map(t.map((e) => [e.id, e]));
845
355
  return {
846
356
  added: t.filter((e) => !n.has(e.id)).map((e) => e.id),
847
357
  removed: e.filter((e) => !r.has(e.id)).map((e) => e.id),
848
358
  updated: t.filter((e) => n.has(e.id) && JSON.stringify(n.get(e.id)) !== JSON.stringify(e)).map((e) => e.id)
849
359
  };
850
- }, qt = (e) => ({
851
- nodes: Kt(Ut.value.nodes, e.nodes),
852
- edges: Kt(Ut.value.edges, e.edges)
853
- }), Jt = () => {
854
- if (N = null, !Ht.value) return;
855
- let e = Gt(), t = JSON.stringify(e);
856
- if (t === Wt) return;
857
- let n = qt(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;
858
- Wt = t, !r && y("data-change", {
360
+ }, nn = (e) => ({
361
+ nodes: tn(Qt.value.nodes, e.nodes),
362
+ edges: tn(Qt.value.edges, e.edges)
363
+ }), rn = () => {
364
+ if (N = null, !Zt.value) return;
365
+ let e = en(), t = JSON.stringify(e);
366
+ if (t === $t) return;
367
+ 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;
368
+ $t = t, r && y("data-change", {
859
369
  nodes: e.nodes,
860
370
  edges: e.edges,
861
371
  summary: n
862
372
  });
863
- }, Yt = () => {
864
- Ht.value && (N && clearTimeout(N), N = setTimeout(Jt, 300));
865
- }, Xt = () => {
866
- N &&= (clearTimeout(N), null), Ut.value = Gt(), Wt = "";
373
+ }, an = () => {
374
+ Zt.value && (N && clearTimeout(N), N = setTimeout(rn, 300));
375
+ }, on = () => {
376
+ N &&= (clearTimeout(N), null), Qt.value = en(), $t = "";
867
377
  };
868
378
  h([
869
- T,
870
- A,
871
- j
872
- ], () => Yt(), { deep: !0 }), h(Ht, (e) => {
873
- e ? Xt() : N &&= (clearTimeout(N), null);
379
+ w,
380
+ k,
381
+ j,
382
+ A
383
+ ], () => an(), { deep: !0 }), h(Zt, (e) => {
384
+ e ? on() : N &&= (clearTimeout(N), null);
874
385
  }), l(() => {
875
- Ht.value && Xt();
386
+ Zt.value && on();
876
387
  });
877
- let Zt = () => Gt(), Qt = () => {
878
- 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));
388
+ let sn = () => en(), cn = () => {
389
+ let e = new Set(R.value), t = new Set(z.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));
879
390
  return !n.length && !r.length ? {
880
391
  nodes: [],
881
392
  edges: []
882
- } : (n.length && (T.value = T.value.filter((t) => !e.has(t.id)), y("update:nodes", T.value)), r.length && (j.value = /* @__PURE__ */ new Set([...j.value, ...r.map((e) => e.id)]), A.value = A.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({
393
+ } : (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))))), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), JSON.parse(JSON.stringify({
883
394
  nodes: n,
884
395
  edges: r
885
396
  })));
886
- }, $t = (e) => {
887
- let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(T.value.map((e) => e.id)), r = [];
397
+ }, ln = (e) => {
398
+ let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(w.value.map((e) => e.id)), r = [];
888
399
  for (let e of t) {
889
400
  let t = JSON.parse(JSON.stringify(e));
890
401
  if (t.id == null) t.id = re();
891
402
  else if (n.has(t.id)) continue;
892
403
  n.add(t.id), r.push(t);
893
404
  }
894
- return r.length ? (T.value = [...T.value, ...r], y("update:nodes", T.value), JSON.parse(JSON.stringify(r))) : [];
895
- }, en = (e) => {
405
+ return r.length ? (w.value = [...w.value, ...r], T(), JSON.parse(JSON.stringify(r))) : [];
406
+ }, un = (e) => {
896
407
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(M.value.map((e) => e.id)), r = [];
897
408
  for (let e of t) {
898
409
  let t = JSON.parse(JSON.stringify(e));
@@ -908,8 +419,8 @@ var b = {
908
419
  let e = new Set(i.map((e) => e.id));
909
420
  j.value = new Set([...j.value].filter((t) => !e.has(t)));
910
421
  }
911
- return A.value = [...A.value, ...r], r.forEach((e) => y("edge-create", JSON.parse(JSON.stringify(e)))), JSON.parse(JSON.stringify(r));
912
- }, tn = (e) => {
422
+ return k.value = [...k.value, ...r], r.forEach((e) => y("edge-create", JSON.parse(JSON.stringify(e)))), JSON.parse(JSON.stringify(r));
423
+ }, dn = (e) => {
913
424
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
914
425
  if (!t.length) return [];
915
426
  let n = /* @__PURE__ */ new Map();
@@ -922,7 +433,7 @@ var b = {
922
433
  });
923
434
  }
924
435
  let r = [];
925
- return T.value = T.value.map((e) => {
436
+ return w.value = w.value.map((e) => {
926
437
  let t = n.get(e.id);
927
438
  if (!t) return e;
928
439
  let i = {
@@ -930,11 +441,11 @@ var b = {
930
441
  ...t
931
442
  };
932
443
  return r.push(i), i;
933
- }), r.length ? (y("update:nodes", T.value), JSON.parse(JSON.stringify(r))) : [];
934
- }, nn = (e) => {
444
+ }), r.length ? (T(), JSON.parse(JSON.stringify(r))) : [];
445
+ }, fn = (e) => {
935
446
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && e.id != null);
936
447
  if (!t.length) return [];
937
- let n = new Set(M.value.map((e) => e.id)), r = new Map(Vt.value), i = [];
448
+ let n = new Set(M.value.map((e) => e.id)), r = new Map(A.value), i = [];
938
449
  for (let e of t) {
939
450
  let { id: t, ...a } = e;
940
451
  if (!n.has(t)) continue;
@@ -951,8 +462,28 @@ var b = {
951
462
  ...s
952
463
  });
953
464
  }
954
- return i.length ? (Vt.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
955
- }, P = t(() => {
465
+ return i.length ? (A.value = r, y("edge-update", JSON.parse(JSON.stringify(i))), JSON.parse(JSON.stringify(i))) : [];
466
+ }, pn = (e) => {
467
+ let t = e && typeof e == "object" ? e : null;
468
+ 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), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), on(), en();
469
+ };
470
+ h(() => v.edges, (e) => {
471
+ Bt();
472
+ let t = Array.isArray(e) ? e : [], n = new Set(t.map((e) => e.id));
473
+ if (k.value.length) {
474
+ let e = k.value.filter((e) => !n.has(e.id));
475
+ e.length !== k.value.length && (k.value = e);
476
+ }
477
+ if (A.value.size) {
478
+ let e = new Map(A.value), n = new Set(k.value.map((e) => e.id)), r = !1;
479
+ for (let [i, a] of e) {
480
+ let o = t.find((e) => e.id === i);
481
+ 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);
482
+ }
483
+ r && (A.value = e);
484
+ }
485
+ }, { deep: !0 });
486
+ let mn = t(() => {
956
487
  let e = {};
957
488
  M.value.forEach((t) => {
958
489
  let n = [t.from, t.to].sort().join("__");
@@ -961,7 +492,7 @@ var b = {
961
492
  let t = {};
962
493
  return Object.entries(e).forEach(([e, n]) => {
963
494
  let r = n.length;
964
- r > Et ? n.forEach((n, i) => {
495
+ r > Dt ? n.forEach((n, i) => {
965
496
  t[n.id] = i === 0 ? {
966
497
  key: e,
967
498
  index: 0,
@@ -990,128 +521,181 @@ var b = {
990
521
  };
991
522
  });
992
523
  }), t;
993
- }), F = (e) => T.value.find((t) => t.id === e), I = (e) => e.state != "none" && b[e.state] && b[e.state].color || "#00f0ff", rn = (e) => b[e.state] || b.normal, an = (e) => e.type === "text", on = (e, t) => {
524
+ }), hn = t(() => {
525
+ let e = /* @__PURE__ */ new Map();
526
+ for (let t of w.value) e.set(t.id, t);
527
+ return e;
528
+ }), 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.type === "text", vn = (e, t) => {
994
529
  let n = Number(e);
995
530
  return Number.isFinite(n) && n > 0 ? n : t;
996
- }, sn = (e) => {
997
- let t = on(e.width, S), n = on(e.height, S);
531
+ }, yn = (e) => {
532
+ let t = vn(e.width, At), n = vn(e.height, At);
998
533
  return {
999
- sx: t / S,
1000
- sy: n / S
534
+ sx: t / At,
535
+ sy: n / At
1001
536
  };
1002
- }, cn = (e) => {
1003
- let { sx: t, sy: n } = sn(e);
537
+ }, bn = (e) => {
538
+ let { sx: t, sy: n } = yn(e);
1004
539
  return t === 1 && n === 1 ? "" : `scale(${t}, ${n})`;
1005
- }, ln = (e) => {
1006
- let { sy: t } = sn(e);
540
+ }, xn = (e) => {
541
+ let { w: t, h: n } = I(e), r = Math.min(10, t * .3), i = Math.min(10, n * .3);
542
+ return `translate(${t / 2 - r}, ${-(n / 2 - i)})`;
543
+ }, Sn = (e) => {
544
+ let { sy: t } = yn(e);
1007
545
  return Math.round(48 * t);
1008
- }, un = (e) => an(e) ? 4 : e.labelPosition === "top" ? -30 : e.labelPosition === "center" ? 0 : ln(e), dn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, fn = (e) => {
1009
- let t = an(e);
546
+ }, Cn = (e) => _n(e) ? 4 : e.labelPosition === "top" ? -30 : e.labelPosition === "center" ? 0 : Sn(e), wn = (e) => {
547
+ let t = L(e);
548
+ if (_n(e) || !e.label) return t;
549
+ let n = Vt(e), r = Cn(e);
550
+ if (e.labelPosition === "top") {
551
+ let e = r - n - 4;
552
+ e < t.y && (t.height += t.y - e, t.y = e);
553
+ } else if (e.labelPosition !== "center") {
554
+ let i = r + (String(e.label).split("\n").length - 1) * 1.2 * n + n + 4;
555
+ i > t.y + t.height && (t.height = i - t.y);
556
+ }
557
+ return t;
558
+ }, Tn = (e) => e.borderColor !== void 0 || e.borderWidth !== void 0 || e.borderStyle !== void 0, I = (e) => {
559
+ let t = _n(e);
1010
560
  return {
1011
- w: on(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : S),
1012
- h: on(e.height, t ? 26 : S)
561
+ w: vn(e.width, t ? Math.max(60, String(e.label).length * 7 + 16) : At),
562
+ h: vn(e.height, t ? 26 : At)
1013
563
  };
1014
564
  }, L = (e) => {
1015
- let { w: t, h: n } = fn(e);
565
+ let { w: t, h: n } = I(e);
1016
566
  return {
1017
567
  x: -t / 2,
1018
568
  y: -n / 2,
1019
569
  width: t,
1020
570
  height: n
1021
571
  };
1022
- }, R = (e) => dn(e) ? L(e) : null, pn = (e) => e.background && e.background !== "none" ? e.background : null, z = d([]), B = d([]);
1023
- t(() => z.value.length === 1 ? z.value[0] : null), t(() => B.value.length === 1 ? B.value[0] : null);
1024
- let mn = (e) => z.value.includes(e.id), hn = (e) => B.value.includes(e.id), V = () => {
572
+ }, En = (e) => Tn(e) ? L(e) : null, Dn = (e) => e.background && e.background !== "none" ? e.background : null, R = d([]), z = d([]);
573
+ t(() => R.value.length === 1 ? R.value[0] : null), t(() => z.value.length === 1 ? z.value[0] : null);
574
+ let On = (e) => R.value.includes(e.id), kn = (e) => z.value.includes(e.id), B = () => {
1025
575
  y("selection-change", {
1026
- nodes: T.value.filter((e) => z.value.includes(e.id)),
1027
- edges: M.value.filter((e) => B.value.includes(e.id))
576
+ nodes: w.value.filter((e) => R.value.includes(e.id)),
577
+ edges: M.value.filter((e) => z.value.includes(e.id))
1028
578
  });
1029
- }, gn = t(() => v.config.selectedBorderColor || "#fbbf24"), _n = (e, t) => {
1030
- if (!Sn()) {
579
+ }, 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)), V = (e, t, n) => {
580
+ let r = new Set(e), i = [];
581
+ for (let e of t) r.has(e) || (r.add(e), i.push(e));
582
+ if (n === Infinity) return [...e, ...i];
583
+ let a = Math.max(0, n - e.length);
584
+ return [...e, ...i.slice(0, a)];
585
+ };
586
+ h([jn, Mn], ([e, t]) => {
587
+ let n = !1;
588
+ 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();
589
+ });
590
+ let Nn = t(() => v.config.selectedBorderColor || "#fbbf24"), Pn = (e, t) => {
591
+ if (!zn()) {
1031
592
  if (t && (t.ctrlKey || t.metaKey)) {
1032
- let t = z.value.indexOf(e.id);
1033
- t >= 0 ? z.value.splice(t, 1) : z.value.push(e.id);
593
+ let t = R.value.indexOf(e.id);
594
+ t >= 0 ? R.value.splice(t, 1) : R.value = V(R.value, [e.id], jn.value);
1034
595
  } else {
1035
- let t = z.value.length === 1 && z.value[0] === e.id;
1036
- z.value = t ? [] : [e.id], B.value = [];
596
+ let t = R.value.length === 1 && R.value[0] === e.id;
597
+ R.value = t ? [] : V([], [e.id], jn.value), z.value = [];
1037
598
  }
1038
- y("node-click", e), y("node-select", mn(e) ? e : null), V();
599
+ y("node-click", e), y("node-select", On(e) ? e : null), B();
1039
600
  }
1040
- }, vn = t(() => v.config.selectedLineColor || "#fbbf24"), yn = (e, t) => {
1041
- if (Sn()) return;
1042
- let n = P.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
1043
- let t = P.value[e.id];
601
+ }, Fn = t(() => v.config.selectedLineColor || "#fbbf24"), In = (e, t) => {
602
+ if (zn()) return;
603
+ let n = mn.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
604
+ let t = mn.value[e.id];
1044
605
  return t && t.key === n.key;
1045
606
  }) : null, a = r ? i.map((e) => e.id) : [e.id], o = r ? {
1046
607
  ...e,
1047
608
  bundleEdges: i
1048
609
  } : e;
1049
- if (t && (t.ctrlKey || t.metaKey)) a.every((e) => B.value.includes(e)) ? B.value = B.value.filter((e) => !a.includes(e)) : B.value = [...B.value, ...a.filter((e) => !B.value.includes(e))];
610
+ 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, Mn.value);
1050
611
  else {
1051
- let e = a.length === B.value.length && a.every((e) => B.value.includes(e));
1052
- B.value = e ? [] : a, z.value = [];
612
+ let e = a.length === z.value.length && a.every((e) => z.value.includes(e));
613
+ z.value = e ? [] : V([], a, Mn.value), R.value = [];
1053
614
  }
1054
- y("edge-select", hn(e) ? o : null), V();
1055
- }, bn = 0, xn = (e = 200) => {
1056
- bn = performance.now() + e;
1057
- }, Sn = () => performance.now() < bn, Cn = () => {
1058
- z.value = [], B.value = [], y("node-select", null), y("edge-select", null), V();
1059
- }, wn = (e) => {
1060
- if (Sn()) return;
615
+ y("edge-select", kn(e) ? o : null), B();
616
+ }, Ln = 0, Rn = (e = 200) => {
617
+ Ln = performance.now() + e;
618
+ }, zn = () => performance.now() < Ln, Bn = () => {
619
+ R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B();
620
+ }, Vn = (e) => {
621
+ if (zn()) return;
1061
622
  let t = e.target;
1062
- t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || Cn();
1063
- }, Tn = d({
623
+ t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || Bn();
624
+ }, Hn = d({
1064
625
  width: 1e3,
1065
626
  height: 650
1066
- }), H = d(1), En = d(0), Dn = d(0), On = t(() => -An.value / 2 + En.value), kn = t(() => -jn.value / 2 + Dn.value), An = t(() => v.width ?? Tn.value.width), jn = t(() => v.height ?? Tn.value.height), Mn = null;
627
+ }), Un = d(1), Wn = d(0), Gn = d(0), Kn = t(() => -Jn.value / 2 + Wn.value), qn = t(() => -Yn.value / 2 + Gn.value), Jn = t(() => v.width ?? Hn.value.width), Yn = t(() => v.height ?? Hn.value.height), Xn = null;
1067
628
  l(() => {
1068
- let e = D.value;
629
+ let e = O.value;
1069
630
  if (e) {
1070
631
  let t = e.getBoundingClientRect();
1071
- t.width > 0 && t.height > 0 && (Tn.value = {
632
+ t.width > 0 && t.height > 0 && (Hn.value = {
1072
633
  width: t.width,
1073
634
  height: t.height
1074
635
  });
1075
636
  }
1076
- e && typeof ResizeObserver < "u" && (Mn = new ResizeObserver(() => {
637
+ e && typeof ResizeObserver < "u" && (Xn = new ResizeObserver(() => {
1077
638
  let t = e.getBoundingClientRect();
1078
- t.width > 0 && t.height > 0 && (Tn.value = {
639
+ t.width > 0 && t.height > 0 && (Hn.value = {
1079
640
  width: t.width,
1080
641
  height: t.height
1081
642
  });
1082
- }), Mn.observe(e));
643
+ }), Xn.observe(e));
1083
644
  }), c(() => {
1084
- Mn &&= (Mn.disconnect(), null), wr(), qn();
645
+ Xn &&= (Xn.disconnect(), null), Lr &&= (cancelAnimationFrame(Lr), 0), q &&= (cancelAnimationFrame(q), 0), Z &&= (cancelAnimationFrame(Z), 0), si(), hr();
1085
646
  });
1086
- let U = t(() => An.value / H.value), W = t(() => jn.value / H.value), Nn = (e) => {
647
+ let H = t(() => Jn.value / Un.value), U = t(() => Yn.value / Un.value), Zn = t(() => ({
648
+ x0: Kn.value - Nt,
649
+ y0: qn.value - Nt,
650
+ x1: Kn.value + H.value + Nt,
651
+ y1: qn.value + U.value + Nt
652
+ })), Qn = t(() => {
653
+ let e = Zn.value;
654
+ return w.value.filter((t) => {
655
+ let { w: n, h: r } = I(t);
656
+ 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;
657
+ });
658
+ }), W = t(() => {
659
+ let e = Zn.value;
660
+ return M.value.filter((t) => {
661
+ if (!Ci(t)) return !1;
662
+ let n = P(t.from), r = P(t.to);
663
+ if (!n || !r) return !1;
664
+ let i = I(n).w / 2, a = I(n).h / 2, o = I(r).w / 2, s = I(r).h / 2;
665
+ 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;
666
+ });
667
+ }), $n = (e) => {
1087
668
  if (v.config.enableZoom === !1) return;
1088
669
  e.preventDefault();
1089
- let t = D.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(At, Math.max(kt, H.value * c)), u = An.value / l, d = jn.value / l;
1090
- En.value += (o - u) * i, Dn.value += (s - d) * a, H.value = l;
1091
- }, G = d(null), K = d(null), Pn = (e) => {
670
+ let t = O.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(Mt, Math.max(jt, Un.value * c)), u = Jn.value / l, d = Yn.value / l;
671
+ Wn.value += (o - u) * i, Gn.value += (s - d) * a, Un.value = l;
672
+ }, G = d(null), K = d(null), er = (e) => {
673
+ let t = O.value, n = t ? t.getBoundingClientRect() : null;
1092
674
  G.value = {
1093
675
  startX: e.clientX,
1094
676
  startY: e.clientY,
1095
677
  lastX: e.clientX,
1096
678
  lastY: e.clientY,
1097
- moved: !1
1098
- }, Kn();
1099
- }, Fn = (e) => {
1100
- let t = G.value, n = D.value;
679
+ moved: !1,
680
+ rectWidth: n && n.width ? n.width : 0,
681
+ rectHeight: n && n.height ? n.height : 0
682
+ }, mr();
683
+ }, tr = (e) => {
684
+ let t = G.value, n = O.value;
1101
685
  if (!t || !n) return;
1102
- let r = n.getBoundingClientRect();
1103
- if (!r.width || !r.height) return;
686
+ let r = t.rectWidth, i = t.rectHeight;
687
+ if (!r || !i) return;
1104
688
  if (!t.moved) {
1105
689
  if (Math.hypot(e.clientX - t.startX, e.clientY - t.startY) < 4) return;
1106
690
  t.moved = !0, t.lastX = e.clientX, t.lastY = e.clientY;
1107
691
  return;
1108
692
  }
1109
- let i = e.clientX - t.lastX, a = e.clientY - t.lastY;
1110
- t.lastX = e.clientX, t.lastY = e.clientY, En.value -= i * (U.value / r.width), Dn.value -= a * (W.value / r.height);
1111
- }, In = () => {
693
+ let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
694
+ t.lastX = e.clientX, t.lastY = e.clientY, Wn.value -= a * (H.value / r), Gn.value -= o * (U.value / i);
695
+ }, nr = () => {
1112
696
  let e = G.value;
1113
- G.value = null, e && e.moved && xn(), Jn();
1114
- }, Ln = (e) => {
697
+ G.value = null, e && e.moved && Rn(), gr();
698
+ }, rr = (e) => {
1115
699
  let t = X(e);
1116
700
  K.value = {
1117
701
  start: {
@@ -1125,8 +709,8 @@ var b = {
1125
709
  startClientX: e.clientX,
1126
710
  startClientY: e.clientY,
1127
711
  moved: !1
1128
- }, Kn();
1129
- }, Rn = (e) => {
712
+ }, mr();
713
+ }, ir = (e) => {
1130
714
  let t = K.value;
1131
715
  if (!t) return;
1132
716
  let n = X(e);
@@ -1134,7 +718,7 @@ var b = {
1134
718
  x: n.x,
1135
719
  y: n.y
1136
720
  }, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
1137
- }, zn = t(() => {
721
+ }, ar = t(() => {
1138
722
  let e = K.value;
1139
723
  return e ? {
1140
724
  x: Math.min(e.start.x, e.current.x),
@@ -1147,7 +731,7 @@ var b = {
1147
731
  width: 0,
1148
732
  height: 0
1149
733
  };
1150
- }), Bn = () => {
734
+ }), or = () => {
1151
735
  let e = K.value;
1152
736
  if (K.value = null, e && e.moved) {
1153
737
  let t = {
@@ -1155,103 +739,150 @@ var b = {
1155
739
  y: Math.min(e.start.y, e.current.y),
1156
740
  w: Math.abs(e.current.x - e.start.x),
1157
741
  h: Math.abs(e.current.y - e.start.y)
1158
- }, n = T.value.filter((e) => {
742
+ }, n = w.value.filter((e) => {
1159
743
  let n = L(e), r = e.x + n.x, i = e.y + n.y;
1160
744
  return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
1161
745
  });
1162
- if (n.length) {
1163
- let e = new Set(z.value);
1164
- n.forEach((t) => e.add(t.id)), z.value = [...e], V();
1165
- }
1166
- xn();
746
+ n.length && (R.value = V(R.value, n.map((e) => e.id), jn.value), B()), Rn();
1167
747
  }
1168
- Jn();
1169
- }, Vn = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), Hn = (e) => {
1170
- if (D.value) {
748
+ gr();
749
+ }, sr = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), cr = (e) => {
750
+ if (O.value) {
1171
751
  if (e.button === 1) {
1172
752
  if (v.config.enablePan === !1) return;
1173
- e.preventDefault(), Pn(e);
753
+ e.preventDefault(), er(e);
1174
754
  return;
1175
755
  }
1176
- if (e.button === 0 && !Vn(e.target)) {
756
+ if (e.button === 0 && !sr(e.target)) {
1177
757
  if (e.ctrlKey || e.metaKey) {
1178
758
  if (v.config.enableMarquee === !1) return;
1179
- e.preventDefault(), Ln(e);
759
+ e.preventDefault(), rr(e);
1180
760
  return;
1181
761
  }
1182
- v.config.enablePan !== !1 && (e.preventDefault(), Pn(e));
762
+ v.config.enablePan !== !1 && (e.preventDefault(), er(e));
1183
763
  }
1184
764
  }
1185
- }, Un = !1, Wn = (e) => {
1186
- G.value ? Fn(e) : K.value && Rn(e);
1187
- }, Gn = () => {
1188
- G.value && In(), K.value && Bn();
1189
- }, Kn = () => {
1190
- Un || (Un = !0, window.addEventListener("mousemove", Wn, !0), window.addEventListener("mouseup", Gn, !0));
1191
- }, qn = () => {
1192
- Un && (Un = !1, window.removeEventListener("mousemove", Wn, !0), window.removeEventListener("mouseup", Gn, !0));
1193
- }, Jn = () => {
1194
- !G.value && !K.value && qn();
1195
- }, Yn = t(() => {
1196
- if (q.value && q.value.side) return { cursor: dr(q.value.side) };
765
+ }, lr = !1, q = 0, ur = null, dr = () => {
766
+ q = 0;
767
+ let e = ur;
768
+ ur = null, e && (G.value ? tr(e) : K.value && ir(e));
769
+ }, fr = (e) => {
770
+ ur = e, q ||= requestAnimationFrame(dr);
771
+ }, pr = () => {
772
+ q && (cancelAnimationFrame(q), dr()), G.value && nr(), K.value && or();
773
+ }, mr = () => {
774
+ lr || (lr = !0, window.addEventListener("mousemove", fr, !0), window.addEventListener("mouseup", pr, !0));
775
+ }, hr = () => {
776
+ lr && (lr = !1, window.removeEventListener("mousemove", fr, !0), window.removeEventListener("mouseup", pr, !0));
777
+ }, gr = () => {
778
+ !G.value && !K.value && hr();
779
+ }, _r = t(() => {
780
+ if (J.value && J.value.side) return { cursor: Gr(J.value.side) };
1197
781
  if (K.value) return { cursor: "crosshair" };
1198
782
  if (G.value && G.value.moved) return { cursor: "grabbing" };
1199
- }), Xn = t(() => v.config.showGrid !== !1), Zn = t(() => v.config.gridColor || "#1a2240"), Qn = t(() => 40 / H.value), $n = t(() => v.config.showCenterPoint === !0), er = t(() => v.config.showEdgeTextBg === !0), tr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), nr = t(() => v.config.showNodeHandles === !0), rr = (e) => e.borderColor || I(e) || "#94a3b8", ir = (e) => e.borderWidth || 0, ar = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, or = (e, t) => {
783
+ }), vr = t(() => v.config.showGrid !== !1), yr = t(() => v.config.gridColor || "#1a2240"), br = t(() => {
784
+ let e = Number(v.config.gridStep);
785
+ return (Number.isFinite(e) && e > 0 ? e : 40) / Un.value;
786
+ }), xr = t(() => {
787
+ let e = Number(v.config.gridOpacity);
788
+ return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
789
+ }), Sr = t(() => {
790
+ 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) => ({
791
+ offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
792
+ color: e.color,
793
+ opacity: e.opacity
794
+ })) : null, n = t && t.length ? t : [{
795
+ offset: "0%",
796
+ color: e.startColor || "#0f1729",
797
+ opacity: e.startOpacity
798
+ }, {
799
+ offset: "100%",
800
+ color: e.endColor || "#060a14",
801
+ opacity: e.endOpacity
802
+ }];
803
+ return {
804
+ cx: e.cx || "50%",
805
+ cy: e.cy || "50%",
806
+ r: e.r || "60%",
807
+ stops: n
808
+ };
809
+ }), Cr = t(() => v.config.showCenterPoint === !0), wr = t(() => v.config.showEdgeTextBg === !0), Tr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Er = t(() => v.config.showNodeHandles === !0), Dr = t(() => v.config.showStatusDot !== !1), Or = (e, t) => {
810
+ let n = Number(e);
811
+ return Number.isFinite(n) && n >= 0 ? n : t;
812
+ }, kr = t(() => {
813
+ let e = v.config.motionFx ?? v.config.fx;
814
+ return typeof e == "boolean" ? e : M.value.length <= Or(v.config.fxMotionMaxEdges, 200);
815
+ }), Ar = t(() => {
816
+ let e = v.config.glowFx ?? v.config.fx;
817
+ return typeof e == "boolean" ? e : M.value.length <= Or(v.config.fxGlowMaxEdges, 500);
818
+ }), jr = t(() => {
819
+ let e = v.config.breatheFx ?? v.config.fx;
820
+ return typeof e == "boolean" ? e : w.value.length <= Or(v.config.fxBreatheMaxNodes, 300);
821
+ }), Mr = (e) => e.animated !== !1, Nr = (e) => e.borderColor || F(e) || "#94a3b8", Pr = (e) => e.borderWidth || 0, Fr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Ir = (e, t) => {
1200
822
  if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
1201
823
  e.stopPropagation();
1202
- let n = F(t), r = X(e);
1203
- if (Rt.value = {
824
+ let n = P(t), r = X(e);
825
+ if (Kt.value = {
1204
826
  x: r.x - n.x,
1205
827
  y: r.y - n.y
1206
- }, O = {
828
+ }, Jt = {
1207
829
  x: e.clientX,
1208
830
  y: e.clientY
1209
- }, k = !1, Bt = !!(e.ctrlKey || e.metaKey), z.value.length > 1 && z.value.includes(t)) {
831
+ }, Yt = !1, Xt = !!(e.ctrlKey || e.metaKey), R.value.length > 1 && R.value.includes(t)) {
1210
832
  let e = {};
1211
- z.value.forEach((t) => {
1212
- let n = F(t);
833
+ R.value.forEach((t) => {
834
+ let n = P(t);
1213
835
  n && (e[t] = {
1214
836
  x: n.x,
1215
837
  y: n.y
1216
838
  });
1217
- }), zt.value = {
839
+ }), qt.value = {
1218
840
  origins: e,
1219
841
  start: {
1220
842
  x: r.x,
1221
843
  y: r.y
1222
844
  }
1223
845
  };
1224
- } else zt.value = null;
1225
- E.value = t, y("node-drag-start", n);
1226
- }, sr = (e) => {
1227
- if (q.value) {
1228
- pr(e);
846
+ } else qt.value = null;
847
+ D.value = t, y("node-drag-start", n);
848
+ }, Lr = 0, Rr = null, zr = () => {
849
+ Lr = 0;
850
+ let e = Rr;
851
+ Rr = null, e && Vr(e);
852
+ }, Br = (e) => {
853
+ (J.value || D.value) && (Rr = {
854
+ clientX: e.clientX,
855
+ clientY: e.clientY
856
+ }, Lr ||= requestAnimationFrame(zr));
857
+ }, Vr = (e) => {
858
+ if (J.value) {
859
+ qr(e);
1229
860
  return;
1230
861
  }
1231
- if (!E.value) return;
862
+ if (!D.value) return;
1232
863
  let t = X(e);
1233
- !k && O && Math.hypot(e.clientX - O.x, e.clientY - O.y) > Ot && (k = !0, !Bt && !z.value.includes(E.value) && (z.value = [E.value], B.value = [], y("node-select", F(E.value)), V()));
1234
- let n = zt.value;
864
+ !Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !R.value.includes(D.value) && (R.value = V([], [D.value], jn.value), z.value = [], y("node-select", R.value.includes(D.value) ? P(D.value) : null), B()));
865
+ let n = qt.value;
1235
866
  if (n) {
1236
867
  let e = t.x - n.start.x, r = t.y - n.start.y;
1237
- T.value = T.value.map((t) => n.origins[t.id] ? {
868
+ w.value = w.value.map((t) => n.origins[t.id] ? {
1238
869
  ...t,
1239
870
  x: n.origins[t.id].x + e,
1240
871
  y: n.origins[t.id].y + r
1241
872
  } : t);
1242
- } else T.value = T.value.map((e) => e.id === E.value ? {
873
+ } else w.value = w.value.map((e) => e.id === D.value ? {
1243
874
  ...e,
1244
- x: t.x - Rt.value.x,
1245
- y: t.y - Rt.value.y
875
+ x: t.x - Kt.value.x,
876
+ y: t.y - Kt.value.y
1246
877
  } : e);
1247
- y("update:nodes", T.value);
1248
- }, cr = () => {
1249
- if (q.value) {
1250
- mr();
878
+ T();
879
+ }, Hr = () => {
880
+ if (Lr && (cancelAnimationFrame(Lr), zr()), J.value) {
881
+ Jr();
1251
882
  return;
1252
883
  }
1253
- E.value && (k && xn(), E.value = null, zt.value = null, O = null, k = !1, y("node-drag-end"));
1254
- }, q = d(null), lr = (e, t, n) => Math.min(n, Math.max(t, e)), ur = (e) => {
884
+ D.value && (Yt && Rn(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
885
+ }, J = d(null), Ur = (e, t, n) => Math.min(n, Math.max(t, e)), Wr = (e) => {
1255
886
  let t = L(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
1256
887
  return [
1257
888
  {
@@ -1295,10 +926,10 @@ var b = {
1295
926
  y: 0
1296
927
  }
1297
928
  ];
1298
- }, dr = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", fr = (e, t, n) => {
929
+ }, 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) => {
1299
930
  if (!v.editable || v.config.nodeResizable === !1 || !t) return;
1300
- let { w: r, h: i } = fn(t);
1301
- q.value = {
931
+ let { w: r, h: i } = I(t);
932
+ J.value = {
1302
933
  id: t.id,
1303
934
  side: n,
1304
935
  anchorX: n.includes("e") ? t.x - r / 2 : n.includes("w") ? t.x + r / 2 : null,
@@ -1306,35 +937,35 @@ var b = {
1306
937
  startW: r,
1307
938
  startH: i
1308
939
  }, y("node-resize-start", t);
1309
- }, pr = (e) => {
1310
- let t = q.value;
940
+ }, qr = (e) => {
941
+ let t = J.value;
1311
942
  if (!t) return;
1312
- let n = F(t.id);
943
+ let n = P(t.id);
1313
944
  if (!n) return;
1314
945
  let r = X(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
1315
946
  if (t.anchorX !== null) {
1316
947
  let e = t.side.includes("e");
1317
- i = lr(e ? r.x - t.anchorX : t.anchorX - r.x, jt, Mt), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
948
+ i = Ur(e ? r.x - t.anchorX : t.anchorX - r.x, Ft, It), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
1318
949
  }
1319
950
  if (t.anchorY !== null) {
1320
951
  let e = t.side.includes("s");
1321
- a = lr(e ? r.y - t.anchorY : t.anchorY - r.y, Nt, Pt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
952
+ a = Ur(e ? r.y - t.anchorY : t.anchorY - r.y, Lt, Rt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
1322
953
  }
1323
- T.value = T.value.map((e) => e.id === t.id ? {
954
+ w.value = w.value.map((e) => e.id === t.id ? {
1324
955
  ...e,
1325
956
  x: o,
1326
957
  y: s,
1327
958
  width: i,
1328
959
  height: a
1329
- } : e), y("update:nodes", T.value);
1330
- }, mr = () => {
1331
- let e = q.value;
1332
- q.value = null, e && (xn(), y("node-resize-end", F(e.id) || null));
1333
- }, hr = t(() => v.editable && v.config.nodeResizable !== !1), J = t(() => {
1334
- if (!hr.value) return null;
1335
- let e = z.value;
1336
- return e.length === 1 && F(e[0]) || null;
1337
- }), Y = d(null), gr = (e) => {
960
+ } : e), T();
961
+ }, Jr = () => {
962
+ let e = J.value;
963
+ J.value = null, e && (Rn(), y("node-resize-end", P(e.id) || null));
964
+ }, Yr = t(() => v.editable && v.config.nodeResizable !== !1), Xr = t(() => {
965
+ if (!Yr.value) return null;
966
+ let e = R.value;
967
+ return e.length === 1 && P(e[0]) || null;
968
+ }), Y = d(null), Zr = (e) => {
1338
969
  let t = L(e);
1339
970
  return [
1340
971
  {
@@ -1358,8 +989,8 @@ var b = {
1358
989
  y: 0
1359
990
  }
1360
991
  ];
1361
- }, _r = (e, t) => {
1362
- let n = D.value;
992
+ }, Qr = (e, t) => {
993
+ let n = O.value;
1363
994
  if (!n) return null;
1364
995
  let r = e, i = t;
1365
996
  if (e && typeof e == "object" && (r = e.clientX, i = e.clientY), r == null || i == null) return null;
@@ -1372,8 +1003,8 @@ var b = {
1372
1003
  x: s.x,
1373
1004
  y: s.y
1374
1005
  };
1375
- }, vr = (e, t) => {
1376
- let n = D.value;
1006
+ }, $r = (e, t) => {
1007
+ let n = O.value;
1377
1008
  if (!n) return null;
1378
1009
  let r = n.createSVGPoint();
1379
1010
  r.x = Number(e) || 0, r.y = Number(t) || 0;
@@ -1384,12 +1015,12 @@ var b = {
1384
1015
  x: a.x,
1385
1016
  y: a.y
1386
1017
  };
1387
- }, X = (e) => _r(e) ?? {
1018
+ }, X = (e) => Qr(e) ?? {
1388
1019
  x: 0,
1389
1020
  y: 0
1390
- }, yr = (e, t, n) => {
1391
- let r = F(t);
1392
- if (!r || !D.value) return;
1021
+ }, ei = (e, t, n) => {
1022
+ let r = P(t);
1023
+ if (!r || !O.value) return;
1393
1024
  let i = X(e);
1394
1025
  Y.value = {
1395
1026
  fromId: t,
@@ -1403,17 +1034,24 @@ var b = {
1403
1034
  try {
1404
1035
  e.target.setPointerCapture?.(e.pointerId);
1405
1036
  } catch {}
1406
- Cr();
1407
- }, br = (e) => {
1408
- Y.value && Er(e);
1409
- }, xr = () => {
1410
- Y.value && Dr();
1411
- }, Sr = !1, Cr = () => {
1412
- Sr || (Sr = !0, window.addEventListener("mousemove", br, !0), window.addEventListener("mouseup", xr, !0));
1413
- }, wr = () => {
1414
- Sr && (Sr = !1, window.removeEventListener("mousemove", br, !0), window.removeEventListener("mouseup", xr, !0));
1415
- }, Tr = (e, t, n) => {
1416
- let r = T.value;
1037
+ oi();
1038
+ }, Z = 0, ti = null, ni = () => {
1039
+ Z = 0;
1040
+ let e = ti;
1041
+ ti = null, e && Y.value && li(e);
1042
+ }, ri = (e) => {
1043
+ Y.value && (ti = {
1044
+ clientX: e.clientX,
1045
+ clientY: e.clientY
1046
+ }, Z ||= requestAnimationFrame(ni));
1047
+ }, ii = () => {
1048
+ Z && (cancelAnimationFrame(Z), ni()), Y.value && ui();
1049
+ }, ai = !1, oi = () => {
1050
+ ai || (ai = !0, window.addEventListener("mousemove", ri, !0), window.addEventListener("mouseup", ii, !0));
1051
+ }, si = () => {
1052
+ ai && (ai = !1, window.removeEventListener("mousemove", ri, !0), window.removeEventListener("mouseup", ii, !0));
1053
+ }, ci = (e, t, n) => {
1054
+ let r = w.value;
1417
1055
  for (let i = r.length - 1; i >= 0; i--) {
1418
1056
  let a = r[i];
1419
1057
  if (a.id === n) continue;
@@ -1421,15 +1059,15 @@ var b = {
1421
1059
  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;
1422
1060
  }
1423
1061
  return null;
1424
- }, Er = (e) => {
1062
+ }, li = (e) => {
1425
1063
  let t = Y.value;
1426
1064
  if (!t) return;
1427
1065
  let n = X(e);
1428
1066
  t.px = n.x, t.py = n.y;
1429
- let r = Tr(n.x, n.y, t.fromId);
1067
+ let r = ci(n.x, n.y, t.fromId);
1430
1068
  t.overId = r ? r.id : null;
1431
- }, Dr = () => {
1432
- wr();
1069
+ }, ui = () => {
1070
+ si();
1433
1071
  let e = Y.value;
1434
1072
  if (Y.value = null, !e || !e.overId || e.overId === e.fromId) return;
1435
1073
  let t = {
@@ -1440,9 +1078,9 @@ var b = {
1440
1078
  fromAnchor: "edge",
1441
1079
  toAnchor: "edge"
1442
1080
  };
1443
- A.value.push(t), y("edge-create", t);
1444
- }, Or = (e, t, n) => {
1445
- let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = fn(e);
1081
+ k.value.push(t), y("edge-create", t);
1082
+ }, di = (e, t, n) => {
1083
+ let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = I(e);
1446
1084
  if (!n || n === "center" || a === 0 && o === 0) return {
1447
1085
  x: r,
1448
1086
  y: i
@@ -1452,23 +1090,23 @@ var b = {
1452
1090
  x: r + a * p,
1453
1091
  y: i + o * p
1454
1092
  };
1455
- }, kr = t(() => {
1093
+ }, fi = t(() => {
1456
1094
  let e = /* @__PURE__ */ new Map();
1457
1095
  M.value.forEach((t) => {
1458
- let n = P.value[t.id];
1096
+ let n = mn.value[t.id];
1459
1097
  n && !n.hidden && (e.has(n.key) || e.set(n.key, []), e.get(n.key).push(t));
1460
1098
  });
1461
1099
  let t = {};
1462
1100
  return e.forEach((e, n) => {
1463
- let [r, i] = n.split("__"), a = F(r), o = F(i);
1101
+ let [r, i] = n.split("__"), a = P(r), o = P(i);
1464
1102
  if (!a || !o) return;
1465
- 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 = Dt;
1103
+ 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;
1466
1104
  if (m > 1) {
1467
- let e = (m - 1) / 2 * Dt, t = (e) => {
1468
- let { w: t, h: n } = fn(e);
1105
+ let e = (m - 1) / 2 * Ot, t = (e) => {
1106
+ let { w: t, h: n } = I(e);
1469
1107
  return Math.max(4, (Math.abs(f) * t + Math.abs(p) * n) / 2 - 6);
1470
1108
  }, n = Math.min(1, t(a) / e, t(o) / e);
1471
- ee = Dt * Math.max(.35, n);
1109
+ ee = Ot * Math.max(.35, n);
1472
1110
  }
1473
1111
  let h = {};
1474
1112
  e.forEach((e, t) => {
@@ -1484,12 +1122,12 @@ var b = {
1484
1122
  bulge: Math.min(l * .15, 50)
1485
1123
  };
1486
1124
  }), t;
1487
- }), Ar = (e) => {
1488
- let t = P.value[e.id], n = t && kr.value[t.key];
1125
+ }), pi = (e) => {
1126
+ let t = mn.value[e.id], n = t && fi.value[t.key];
1489
1127
  if (!n) return null;
1490
- let r = F(e.from), i = F(e.to);
1128
+ let r = P(e.from), i = P(e.to);
1491
1129
  if (!r || !i) return null;
1492
- let a = n.slots[e.id] || 0, o = a * n.gap, s = Or(r, i, e.fromAnchor), c = Or(i, r, e.toAnchor);
1130
+ let a = n.slots[e.id] || 0, o = a * n.gap, s = di(r, i, e.fromAnchor), c = di(i, r, e.toAnchor);
1493
1131
  return {
1494
1132
  frame: n,
1495
1133
  slot: a,
@@ -1502,12 +1140,12 @@ var b = {
1502
1140
  y: c.y + n.ny * o
1503
1141
  }
1504
1142
  };
1505
- }, jr = (e) => {
1506
- let t = Ar(e);
1143
+ }, mi = (e) => {
1144
+ let t = pi(e);
1507
1145
  if (!t) return "";
1508
1146
  let { from: n, to: r, frame: i, slot: a } = t, o = a * i.gap;
1509
- if (Lt.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1510
- if (Lt.value === "polyline") {
1147
+ if (E.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1148
+ if (E.value === "polyline") {
1511
1149
  if (i.dominant === "v") {
1512
1150
  let e = (n.y + r.y) / 2 + o;
1513
1151
  return `M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`;
@@ -1517,18 +1155,18 @@ var b = {
1517
1155
  }
1518
1156
  let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
1519
1157
  return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
1520
- }, Mr = (e, t) => {
1521
- let n = Ar(e);
1158
+ }, hi = (e, t) => {
1159
+ let n = pi(e);
1522
1160
  if (!n) return {
1523
1161
  x: 0,
1524
1162
  y: 0
1525
1163
  };
1526
1164
  let { from: r, to: i, frame: a, slot: o } = n, s = o * a.gap;
1527
- if (Lt.value === "straight") return {
1165
+ if (E.value === "straight") return {
1528
1166
  x: r.x + (i.x - r.x) * t,
1529
1167
  y: r.y + (i.y - r.y) * t
1530
1168
  };
1531
- if (Lt.value === "polyline") {
1169
+ if (E.value === "polyline") {
1532
1170
  if (a.dominant === "v") {
1533
1171
  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);
1534
1172
  return c <= n ? {
@@ -1559,19 +1197,19 @@ var b = {
1559
1197
  x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
1560
1198
  y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
1561
1199
  };
1562
- }, Nr = t(() => Y.value ? F(Y.value.fromId) : null), Pr = t(() => Y.value && Y.value.overId ? F(Y.value.overId) : null), Fr = t(() => Nr.value ? I(Nr.value) : "#00f0ff"), Ir = t(() => {
1200
+ }, gi = t(() => Y.value ? P(Y.value.fromId) : null), _i = t(() => Y.value && Y.value.overId ? P(Y.value.overId) : null), vi = t(() => gi.value ? F(gi.value) : "#00f0ff"), yi = t(() => {
1563
1201
  let e = Y.value;
1564
1202
  if (!e) return {
1565
1203
  x: 0,
1566
1204
  y: 0
1567
1205
  };
1568
- let t = Pr.value;
1569
- return t && Nr.value ? Or(t, Nr.value, "edge") : {
1206
+ let t = _i.value;
1207
+ return t && gi.value ? di(t, gi.value, "edge") : {
1570
1208
  x: e.px,
1571
1209
  y: e.py
1572
1210
  };
1573
- }), Lr = t(() => {
1574
- let e = Pr.value;
1211
+ }), bi = t(() => {
1212
+ let e = _i.value;
1575
1213
  if (!e) return null;
1576
1214
  let t = L(e);
1577
1215
  return {
@@ -1580,8 +1218,8 @@ var b = {
1580
1218
  w: t.width + 8,
1581
1219
  h: t.height + 8
1582
1220
  };
1583
- }), Rr = (e) => {
1584
- let t = e.nodeIds.map((e) => F(e)).filter(Boolean);
1221
+ }), xi = (e) => {
1222
+ let t = e.nodeIds.map((e) => P(e)).filter(Boolean);
1585
1223
  if (t.length === 0) return null;
1586
1224
  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;
1587
1225
  return {
@@ -1590,21 +1228,38 @@ var b = {
1590
1228
  width: a - r,
1591
1229
  height: o - i
1592
1230
  };
1593
- }, zr = t(() => v.groups.map((e) => ({
1231
+ }, Si = t(() => v.groups.map((e) => ({
1594
1232
  ...e,
1595
- rect: Rr(e)
1596
- })).filter((e) => e.rect)), Z = (e) => hn(e) ? vn.value : (F(e.from), e.centerText && e.centerText.color || "#00f0ff"), Q = (e) => {
1597
- let t = P.value[e.id];
1233
+ rect: xi(e)
1234
+ })).filter((e) => e.rect)), Q = (e) => kn(e) ? Fn.value : (P(e.from), e.centerText && e.centerText.color || "#00f0ff"), Ci = (e) => {
1235
+ let t = mn.value[e.id];
1598
1236
  return !!t && !t.hidden;
1599
- }, Br = t(() => [...new Set(M.value.map(Z))].map((e) => ({
1237
+ }, wi = t(() => [...new Set(M.value.map(Q))].map((e) => ({
1600
1238
  key: String(e).replace("#", ""),
1601
1239
  color: e
1602
- }))), Vr = (e) => {
1240
+ }))), Ti = (e) => {
1603
1241
  let t = e.endMarker;
1604
1242
  if (!t || t === "none") return "";
1605
- let n = Z(e) || "#00f0ff", r = String(n).replace("#", "");
1243
+ let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
1606
1244
  return `url(#${t === "dot" ? "edge-dot" : "edge-arrow"}-${r})`;
1607
- }, $ = (e) => jr(e), Hr = (e, t = 1) => `${2 / e.speed * t}s`, Ur = (e) => `${3 / e.speed}s`, Wr = (e) => x(e).text, Gr = (e) => !!e && String(x(e).text ?? "").trim() !== "", Kr = (e, t) => {
1245
+ }, Ei = /* @__PURE__ */ new Map(), Di = {
1246
+ nodes: null,
1247
+ edges: null,
1248
+ mode: null,
1249
+ epoch: -1
1250
+ }, Oi = () => {
1251
+ let e = Di;
1252
+ (e.nodes !== w.value || e.edges !== M.value || e.mode !== E.value || e.epoch !== zt) && (Di = {
1253
+ nodes: w.value,
1254
+ edges: M.value,
1255
+ mode: E.value,
1256
+ epoch: zt
1257
+ }, Ei = /* @__PURE__ */ new Map());
1258
+ }, $ = (e) => {
1259
+ Oi();
1260
+ let t = Ei.get(e.id);
1261
+ return t === void 0 && (t = mi(e), Ei.set(e.id, t)), t;
1262
+ }, ki = (e, t = 1) => `${2 / e.speed * t}s`, Ai = (e) => `${3 / e.speed}s`, ji = (e) => x(e).text, Mi = (e) => !!e && String(x(e).text ?? "").trim() !== "", Ni = (e, t) => {
1608
1263
  if (!e) return null;
1609
1264
  let n = x(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1610
1265
  for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
@@ -1612,57 +1267,75 @@ var b = {
1612
1267
  w: Math.max(14, a * r + 8),
1613
1268
  h: Math.max(12, r + 6)
1614
1269
  };
1615
- }, qr = (e, t) => {
1616
- let n = Mr(e, Math.max(0, t - .005)), r = Mr(e, Math.min(1, t + .005));
1270
+ }, Pi = (e, t) => {
1271
+ let n = hi(e, Math.max(0, t - .005)), r = hi(e, Math.min(1, t + .005));
1617
1272
  return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
1618
- }, Jr = (e) => {
1273
+ }, Fi = (e) => {
1619
1274
  let t = e % 180;
1620
1275
  return t > 90 && (t -= 180), t < -90 && (t += 180), t;
1621
- }, Yr = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(x(e).rotation || 0) + (n || 0)})`, Xr = t(() => M.value.map((e) => {
1622
- let t = P.value[e.id];
1623
- if (!t || t.hidden) return null;
1624
- let n = F(e.from), r = F(e.to);
1625
- return !n || !r ? null : {
1626
- id: e.id,
1627
- edge: e,
1628
- info: t,
1629
- color: n && oe[n.type] || "#00f0ff",
1630
- start: Mr(e, .28),
1631
- center: Mr(e, .5),
1632
- end: Mr(e, .72),
1633
- startAngle: Jr(qr(e, .28)),
1634
- centerAngle: Jr(qr(e, .5)),
1635
- endAngle: Jr(qr(e, .72)),
1636
- fromBox: Kr(e.fromText, e),
1637
- centerBox: Kr(e.centerText, e),
1638
- toBox: Kr(e.toText, e)
1639
- };
1640
- }).filter(Boolean));
1276
+ }, Ii = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(x(e).rotation || 0) + (n || 0)})`, Li = t(() => {
1277
+ let e = [];
1278
+ for (let t of W.value) {
1279
+ let n = mn.value[t.id];
1280
+ if (!n) continue;
1281
+ let r = n.merged && n.representative, i = !n.merged && (t.fromText || t.centerText || t.toText);
1282
+ if (!r && !i) continue;
1283
+ let a = P(t.from), o = P(t.to);
1284
+ a && o && e.push({
1285
+ id: t.id,
1286
+ edge: t,
1287
+ info: n,
1288
+ color: a && ie[a.type] || "#00f0ff",
1289
+ start: hi(t, .28),
1290
+ center: hi(t, .5),
1291
+ end: hi(t, .72),
1292
+ startAngle: Fi(Pi(t, .28)),
1293
+ centerAngle: Fi(Pi(t, .5)),
1294
+ endAngle: Fi(Pi(t, .72)),
1295
+ fromBox: Ni(t.fromText, t),
1296
+ centerBox: Ni(t.centerText, t),
1297
+ toBox: Ni(t.toText, t)
1298
+ });
1299
+ }
1300
+ return e;
1301
+ });
1641
1302
  return te({
1642
- resetDataBaseline: Xt,
1643
- getData: Zt,
1644
- removeSelected: Qt,
1645
- addNodes: $t,
1646
- addEdges: en,
1647
- updateNodes: tn,
1648
- updateEdges: nn,
1649
- clientToSvg: _r,
1650
- svgToClient: vr
1303
+ resetDataBaseline: on,
1304
+ getData: sn,
1305
+ setData: pn,
1306
+ removeSelected: cn,
1307
+ addNodes: ln,
1308
+ addEdges: un,
1309
+ updateNodes: dn,
1310
+ updateEdges: fn,
1311
+ clientToSvg: Qr,
1312
+ svgToClient: $r
1651
1313
  }), (t, c) => (u(), r("svg", {
1652
1314
  ref_key: "svgRef",
1653
- ref: D,
1315
+ ref: O,
1654
1316
  class: "topology-svg",
1655
- style: s(Yn.value),
1656
- viewBox: `${On.value} ${kn.value} ${U.value} ${W.value}`,
1657
- onMousedown: Hn,
1658
- onMousemove: sr,
1659
- onMouseup: cr,
1660
- onMouseleave: cr,
1661
- onClick: wn,
1662
- onWheel: g(Nn, ["prevent"])
1317
+ style: s(_r.value),
1318
+ viewBox: `${Kn.value} ${qn.value} ${H.value} ${U.value}`,
1319
+ onMousedown: cr,
1320
+ onMousemove: Br,
1321
+ onMouseup: Hr,
1322
+ onMouseleave: Hr,
1323
+ onClick: Vn,
1324
+ onWheel: g($n, ["prevent"])
1663
1325
  }, [
1664
1326
  i("defs", null, [
1665
- 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><radialGradient id=\"bg-grid\" cx=\"50%\" cy=\"50%\" r=\"60%\"><stop offset=\"0%\" stop-color=\"#0f1729\"></stop><stop offset=\"100%\" stop-color=\"#060a14\"></stop></radialGradient>", 3),
1327
+ 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),
1328
+ i("radialGradient", {
1329
+ id: "bg-grid",
1330
+ cx: Sr.value.cx,
1331
+ cy: Sr.value.cy,
1332
+ r: Sr.value.r
1333
+ }, [(u(!0), r(e, null, f(Sr.value.stops, (e, t) => (u(), r("stop", {
1334
+ key: `bg-stop-${t}`,
1335
+ offset: e.offset,
1336
+ "stop-color": e.color,
1337
+ "stop-opacity": e.opacity
1338
+ }, null, 8, se))), 128))], 8, oe),
1666
1339
  (u(!0), r(e, null, f(ee(b), (e, t) => (u(), r("radialGradient", {
1667
1340
  key: `breath-${t}`,
1668
1341
  id: `breath-grad-${t}`
@@ -1684,7 +1357,7 @@ var b = {
1684
1357
  }, null, 8, de)
1685
1358
  ], 8, ce))), 128)),
1686
1359
  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),
1687
- (u(!0), r(e, null, f(Br.value, (e) => (u(), r("marker", {
1360
+ (u(!0), r(e, null, f(wi.value, (e) => (u(), r("marker", {
1688
1361
  key: `m-arrow-${e.key}`,
1689
1362
  id: `edge-arrow-${e.key}`,
1690
1363
  viewBox: "0 0 10 10",
@@ -1698,7 +1371,7 @@ var b = {
1698
1371
  d: "M1,2.5 L9,5 L1,7.5 Z",
1699
1372
  fill: e.color
1700
1373
  }, null, 8, pe)], 8, fe))), 128)),
1701
- (u(!0), r(e, null, f(Br.value, (e) => (u(), r("marker", {
1374
+ (u(!0), r(e, null, f(wi.value, (e) => (u(), r("marker", {
1702
1375
  key: `m-dot-${e.key}`,
1703
1376
  id: `edge-dot-${e.key}`,
1704
1377
  viewBox: "0 0 10 10",
@@ -1716,31 +1389,31 @@ var b = {
1716
1389
  }, null, 8, he)], 8, me))), 128))
1717
1390
  ]),
1718
1391
  i("rect", {
1719
- width: U.value,
1720
- height: W.value,
1721
- x: On.value,
1722
- y: kn.value,
1392
+ width: H.value,
1393
+ height: U.value,
1394
+ x: Kn.value,
1395
+ y: qn.value,
1723
1396
  fill: "url(#bg-grid)"
1724
1397
  }, null, 8, ge),
1725
- Xn.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1398
+ vr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1726
1399
  id: "grid",
1727
- width: Qn.value,
1728
- height: Qn.value,
1400
+ width: br.value,
1401
+ height: br.value,
1729
1402
  patternUnits: "userSpaceOnUse"
1730
1403
  }, [i("path", {
1731
- d: `M ${Qn.value} 0 L 0 0 0 ${Qn.value}`,
1404
+ d: `M ${br.value} 0 L 0 0 0 ${br.value}`,
1732
1405
  fill: "none",
1733
- stroke: Zn.value,
1406
+ stroke: yr.value,
1734
1407
  "stroke-width": "0.5"
1735
1408
  }, null, 8, ve)], 8, _e), i("rect", {
1736
- width: U.value,
1737
- height: W.value,
1738
- x: On.value,
1739
- y: kn.value,
1409
+ width: H.value,
1410
+ height: U.value,
1411
+ x: Kn.value,
1412
+ y: qn.value,
1740
1413
  fill: "url(#grid)",
1741
- opacity: "0.5"
1414
+ opacity: xr.value
1742
1415
  }, null, 8, ye)], 64)) : n("", !0),
1743
- $n.value ? (u(), r("g", be, [...c[5] ||= [
1416
+ Cr.value ? (u(), r("g", be, [...c[5] ||= [
1744
1417
  i("line", {
1745
1418
  x1: "-22",
1746
1419
  y1: "0",
@@ -1772,7 +1445,7 @@ var b = {
1772
1445
  opacity: "0.8"
1773
1446
  }, null, -1)
1774
1447
  ]])) : n("", !0),
1775
- (u(!0), r(e, null, f(zr.value, (e) => (u(), r("g", { key: e.id }, [
1448
+ (u(!0), r(e, null, f(Si.value, (e) => (u(), r("g", { key: e.id }, [
1776
1449
  i("rect", {
1777
1450
  x: e.rect.x,
1778
1451
  y: e.rect.y,
@@ -1834,39 +1507,39 @@ var b = {
1834
1507
  "letter-spacing": "0.5"
1835
1508
  }, m(e.label), 9, De)
1836
1509
  ]))), 128)),
1837
- (u(!0), r(e, null, f(M.value, (t) => (u(), r(e, { key: `base-${t.id}` }, [Q(t) ? (u(), r("path", {
1838
- key: 0,
1839
- d: $(t),
1510
+ (u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
1511
+ key: `base-${e.id}`,
1512
+ d: $(e),
1840
1513
  fill: "none",
1841
1514
  stroke: "#1a2744",
1842
1515
  "stroke-width": "2",
1843
1516
  "stroke-linecap": "round",
1844
- "marker-end": Vr(t)
1845
- }, null, 8, Oe)) : n("", !0)], 64))), 128)),
1846
- (u(!0), r(e, null, f(M.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Q(t) ? (u(), r("path", {
1517
+ "marker-end": Ti(e)
1518
+ }, null, 8, Oe))), 128)),
1519
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Ar.value ? (u(), r("path", {
1847
1520
  key: 0,
1848
1521
  d: $(t),
1849
1522
  fill: "none",
1850
- stroke: Z(t),
1523
+ stroke: Q(t),
1851
1524
  "stroke-width": "2",
1852
1525
  "stroke-linecap": "round",
1853
1526
  opacity: "0.15",
1854
1527
  filter: "url(#glow-strong)"
1855
1528
  }, null, 8, ke)) : n("", !0)], 64))), 128)),
1856
- (u(!0), r(e, null, f(M.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [Q(t) && hn(t) ? (u(), r("path", {
1529
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [kn(t) ? (u(), r("path", {
1857
1530
  key: 0,
1858
1531
  d: $(t),
1859
1532
  fill: "none",
1860
- stroke: vn.value,
1533
+ stroke: Fn.value,
1861
1534
  "stroke-width": "4",
1862
1535
  opacity: "0.35",
1863
1536
  filter: "url(#glow-strong)"
1864
1537
  }, null, 8, Ae)) : n("", !0)], 64))), 128)),
1865
- (u(!0), r(e, null, f(M.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [Q(t) ? (u(), r("g", je, [
1538
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [kr.value && Mr(t) ? (u(), r("g", je, [
1866
1539
  i("path", {
1867
1540
  d: $(t),
1868
1541
  fill: "none",
1869
- stroke: Z(t),
1542
+ stroke: Q(t),
1870
1543
  "stroke-width": "2.5",
1871
1544
  "stroke-linecap": "round",
1872
1545
  "stroke-dasharray": "12 40",
@@ -1875,13 +1548,13 @@ var b = {
1875
1548
  attributeName: "stroke-dashoffset",
1876
1549
  from: "0",
1877
1550
  to: "-52",
1878
- dur: Hr(t),
1551
+ dur: ki(t),
1879
1552
  repeatCount: "indefinite"
1880
1553
  }, null, 8, Ne)], 8, Me),
1881
1554
  i("path", {
1882
1555
  d: $(t),
1883
1556
  fill: "none",
1884
- stroke: Z(t),
1557
+ stroke: Q(t),
1885
1558
  "stroke-width": "1.5",
1886
1559
  "stroke-linecap": "round",
1887
1560
  "stroke-dasharray": "6 60",
@@ -1890,13 +1563,13 @@ var b = {
1890
1563
  attributeName: "stroke-dashoffset",
1891
1564
  from: "-30",
1892
1565
  to: "-82",
1893
- dur: Hr(t, 1.3),
1566
+ dur: ki(t, 1.3),
1894
1567
  repeatCount: "indefinite"
1895
1568
  }, null, 8, Fe)], 8, Pe),
1896
1569
  i("path", {
1897
1570
  d: $(t),
1898
1571
  fill: "none",
1899
- stroke: Z(t),
1572
+ stroke: Q(t),
1900
1573
  "stroke-width": "6",
1901
1574
  "stroke-linecap": "round",
1902
1575
  "stroke-dasharray": "4 80",
@@ -1906,37 +1579,37 @@ var b = {
1906
1579
  attributeName: "stroke-dashoffset",
1907
1580
  from: "0",
1908
1581
  to: "-84",
1909
- dur: Hr(t, .8),
1582
+ dur: ki(t, .8),
1910
1583
  repeatCount: "indefinite"
1911
1584
  }, null, 8, Le)], 8, Ie)
1912
1585
  ])) : n("", !0)], 64))), 128)),
1913
- (u(!0), r(e, null, f(M.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [Q(t) ? (u(), r("g", Re, [i("circle", {
1586
+ (u(!0), r(e, null, f(W.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [kr.value && Mr(t) ? (u(), r("g", Re, [i("circle", {
1914
1587
  r: "3",
1915
- fill: Z(t),
1588
+ fill: Q(t),
1916
1589
  opacity: "0.9",
1917
1590
  filter: "url(#glow-core)"
1918
1591
  }, [i("animateMotion", {
1919
1592
  path: $(t),
1920
- dur: Ur(t),
1593
+ dur: Ai(t),
1921
1594
  repeatCount: "indefinite"
1922
1595
  }, null, 8, Be)], 8, ze), i("circle", {
1923
1596
  r: "8",
1924
- fill: Z(t),
1597
+ fill: Q(t),
1925
1598
  opacity: "0.2",
1926
1599
  filter: "url(#glow-strong)"
1927
1600
  }, [i("animateMotion", {
1928
1601
  path: $(t),
1929
- dur: Ur(t),
1602
+ dur: Ai(t),
1930
1603
  repeatCount: "indefinite"
1931
1604
  }, null, 8, He)], 8, Ve)])) : n("", !0)], 64))), 128)),
1932
- (u(!0), r(e, null, f(Xr.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1605
+ (u(!0), r(e, null, f(Li.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1933
1606
  key: 0,
1934
1607
  transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
1935
1608
  }, [i("rect", {
1936
1609
  x: "-7",
1937
- y: -C(t.edge, null) / 2,
1610
+ y: -S(t.edge, null) / 2,
1938
1611
  width: 14,
1939
- height: C(t.edge, null),
1612
+ height: S(t.edge, null),
1940
1613
  rx: "2",
1941
1614
  fill: "#FFFFFF",
1942
1615
  opacity: "0.9",
@@ -1946,94 +1619,94 @@ var b = {
1946
1619
  y: "0",
1947
1620
  "dominant-baseline": "central",
1948
1621
  "text-anchor": "middle",
1949
- "font-size": C(t.edge, null),
1950
- fill: w(t.edge, null),
1622
+ "font-size": S(t.edge, null),
1623
+ fill: C(t.edge, null),
1951
1624
  "font-family": "'SF Mono', monospace",
1952
1625
  opacity: "1"
1953
1626
  }, m(t.info.count), 9, Ge)], 8, Ue)) : t.info.merged ? n("", !0) : (u(), r("g", Ke, [
1954
- Gr(t.edge.fromText) ? (u(), r("g", {
1627
+ Mi(t.edge.fromText) ? (u(), r("g", {
1955
1628
  key: 0,
1956
- transform: Yr(t.edge.fromText, t.start, t.startAngle)
1957
- }, [er.value ? (u(), r("rect", {
1629
+ transform: Ii(t.edge.fromText, t.start, t.startAngle)
1630
+ }, [wr.value ? (u(), r("rect", {
1958
1631
  key: 0,
1959
1632
  x: -t.fromBox.w / 2,
1960
1633
  y: -t.fromBox.h / 2,
1961
1634
  width: t.fromBox.w,
1962
1635
  height: t.fromBox.h,
1963
1636
  rx: "3",
1964
- fill: tr.value,
1637
+ fill: Tr.value,
1965
1638
  opacity: "0.92",
1966
- stroke: w(t.edge, t.edge.fromText),
1639
+ stroke: C(t.edge, t.edge.fromText),
1967
1640
  "stroke-opacity": "0.35",
1968
1641
  "stroke-width": "0.6"
1969
1642
  }, null, 8, Je)) : n("", !0), i("text", {
1970
1643
  y: "0",
1971
1644
  "dominant-baseline": "central",
1972
1645
  "text-anchor": "middle",
1973
- "font-size": C(t.edge, t.edge.fromText),
1974
- fill: w(t.edge, t.edge.fromText),
1646
+ "font-size": S(t.edge, t.edge.fromText),
1647
+ fill: C(t.edge, t.edge.fromText),
1975
1648
  "font-family": "'SF Mono', monospace",
1976
1649
  "font-weight": "500",
1977
1650
  opacity: "0.9"
1978
- }, m(Wr(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1979
- Gr(t.edge.centerText) ? (u(), r("g", {
1651
+ }, m(ji(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1652
+ Mi(t.edge.centerText) ? (u(), r("g", {
1980
1653
  key: 1,
1981
- transform: Yr(t.edge.centerText, t.center, t.centerAngle)
1982
- }, [er.value ? (u(), r("rect", {
1654
+ transform: Ii(t.edge.centerText, t.center, t.centerAngle)
1655
+ }, [wr.value ? (u(), r("rect", {
1983
1656
  key: 0,
1984
1657
  x: -t.centerBox.w / 2,
1985
1658
  y: -t.centerBox.h / 2,
1986
1659
  width: t.centerBox.w,
1987
1660
  height: t.centerBox.h,
1988
1661
  rx: "3",
1989
- fill: tr.value,
1662
+ fill: Tr.value,
1990
1663
  opacity: "0.92",
1991
- stroke: w(t.edge, t.edge.centerText),
1664
+ stroke: C(t.edge, t.edge.centerText),
1992
1665
  "stroke-opacity": "0.35",
1993
1666
  "stroke-width": "0.6"
1994
1667
  }, null, 8, Ze)) : n("", !0), i("text", {
1995
1668
  y: "0",
1996
1669
  "dominant-baseline": "central",
1997
1670
  "text-anchor": "middle",
1998
- "font-size": C(t.edge, t.edge.centerText),
1999
- fill: w(t.edge, t.edge.centerText),
1671
+ "font-size": S(t.edge, t.edge.centerText),
1672
+ fill: C(t.edge, t.edge.centerText),
2000
1673
  "font-family": "'SF Mono', monospace",
2001
1674
  "font-weight": "600",
2002
1675
  opacity: "1"
2003
- }, m(Wr(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
2004
- Gr(t.edge.toText) ? (u(), r("g", {
1676
+ }, m(ji(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1677
+ Mi(t.edge.toText) ? (u(), r("g", {
2005
1678
  key: 2,
2006
- transform: Yr(t.edge.toText, t.end, t.endAngle)
2007
- }, [er.value ? (u(), r("rect", {
1679
+ transform: Ii(t.edge.toText, t.end, t.endAngle)
1680
+ }, [wr.value ? (u(), r("rect", {
2008
1681
  key: 0,
2009
1682
  x: -t.toBox.w / 2,
2010
1683
  y: -t.toBox.h / 2,
2011
1684
  width: t.toBox.w,
2012
1685
  height: t.toBox.h,
2013
1686
  rx: "3",
2014
- fill: tr.value,
1687
+ fill: Tr.value,
2015
1688
  opacity: "0.92",
2016
- stroke: w(t.edge, t.edge.toText),
1689
+ stroke: C(t.edge, t.edge.toText),
2017
1690
  "stroke-opacity": "0.35",
2018
1691
  "stroke-width": "0.6"
2019
1692
  }, null, 8, et)) : n("", !0), i("text", {
2020
1693
  y: "0",
2021
1694
  "dominant-baseline": "central",
2022
1695
  "text-anchor": "middle",
2023
- "font-size": C(t.edge, t.edge.toText),
2024
- fill: w(t.edge, t.edge.toText),
1696
+ "font-size": S(t.edge, t.edge.toText),
1697
+ fill: C(t.edge, t.edge.toText),
2025
1698
  "font-family": "'SF Mono', monospace",
2026
1699
  "font-weight": "500",
2027
1700
  opacity: "0.9"
2028
- }, m(Wr(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1701
+ }, m(ji(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
2029
1702
  ]))], 64))), 128)),
2030
1703
  Y.value ? (u(), r("g", nt, [
2031
1704
  i("line", {
2032
1705
  x1: Y.value.ax,
2033
1706
  y1: Y.value.ay,
2034
- x2: Ir.value.x,
2035
- y2: Ir.value.y,
2036
- stroke: Fr.value,
1707
+ x2: yi.value.x,
1708
+ y2: yi.value.y,
1709
+ stroke: vi.value,
2037
1710
  "stroke-width": "2",
2038
1711
  "stroke-dasharray": "6 6",
2039
1712
  "stroke-linecap": "round",
@@ -2043,58 +1716,79 @@ var b = {
2043
1716
  cx: Y.value.px,
2044
1717
  cy: Y.value.py,
2045
1718
  r: "3.5",
2046
- fill: Fr.value,
1719
+ fill: vi.value,
2047
1720
  opacity: "0.9"
2048
1721
  }, null, 8, it),
2049
- Y.value.overId && Lr.value ? (u(), r("rect", {
1722
+ Y.value.overId && bi.value ? (u(), r("rect", {
2050
1723
  key: 0,
2051
- x: Lr.value.x,
2052
- y: Lr.value.y,
2053
- width: Lr.value.w,
2054
- height: Lr.value.h,
1724
+ x: bi.value.x,
1725
+ y: bi.value.y,
1726
+ width: bi.value.w,
1727
+ height: bi.value.h,
2055
1728
  rx: "6",
2056
1729
  fill: "none",
2057
- stroke: Fr.value,
1730
+ stroke: vi.value,
2058
1731
  "stroke-width": "1.5",
2059
1732
  "stroke-dasharray": "6 4",
2060
1733
  opacity: "0.9"
2061
1734
  }, null, 8, at)) : n("", !0)
2062
1735
  ])) : n("", !0),
2063
- (u(!0), r(e, null, f(T.value, (a) => (u(), r("g", {
1736
+ (u(!0), r(e, null, f(W.value, (e) => (u(), r("path", {
1737
+ key: `hit-${e.id}`,
1738
+ d: $(e),
1739
+ fill: "none",
1740
+ stroke: "transparent",
1741
+ "stroke-width": "14",
1742
+ style: {
1743
+ "pointer-events": "stroke",
1744
+ cursor: "pointer"
1745
+ },
1746
+ onClick: g((t) => In(e, t), ["stop"])
1747
+ }, null, 8, ot))), 128)),
1748
+ (u(!0), r(e, null, f(Qn.value, (a) => (u(), r("g", {
2064
1749
  key: a.id,
2065
1750
  transform: `translate(${a.x}, ${a.y})`,
2066
- class: o(["topology-node", E.value === a.id ? "dragging" : ""]),
2067
- onMousedown: (e) => or(e, a.id),
2068
- onClick: (e) => _n(a, e),
1751
+ class: o(["topology-node", D.value === a.id ? "dragging" : ""]),
1752
+ onMousedown: (e) => Ir(e, a.id),
1753
+ onClick: (e) => Pn(a, e),
2069
1754
  style: s({
2070
1755
  cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
2071
- color: I(a)
1756
+ color: F(a)
2072
1757
  })
2073
1758
  }, [
2074
- pn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1759
+ i("rect", {
1760
+ class: "node-hit-area",
1761
+ x: wn(a).x,
1762
+ y: wn(a).y,
1763
+ width: wn(a).width,
1764
+ height: wn(a).height,
1765
+ fill: "transparent",
1766
+ "pointer-events": "all"
1767
+ }, null, 8, ct),
1768
+ Dn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
2075
1769
  key: 0,
2076
1770
  x: L(a).x,
2077
1771
  y: L(a).y,
2078
1772
  width: L(a).width,
2079
1773
  height: L(a).height,
2080
1774
  rx: "6",
2081
- fill: pn(a),
1775
+ fill: Dn(a),
2082
1776
  opacity: "0.15"
2083
- }, null, 8, st)) : n("", !0),
2084
- R(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1777
+ }, null, 8, lt)) : n("", !0),
1778
+ En(a) && _.viewMode !== "3d" ? (u(), r("rect", {
2085
1779
  key: 1,
2086
- x: R(a).x,
2087
- y: R(a).y,
2088
- width: R(a).width,
2089
- height: R(a).height,
1780
+ x: En(a).x,
1781
+ y: En(a).y,
1782
+ width: En(a).width,
1783
+ height: En(a).height,
2090
1784
  rx: "6",
2091
1785
  fill: "none",
2092
- stroke: rr(a),
2093
- "stroke-width": ir(a),
2094
- "stroke-dasharray": ar(a),
1786
+ stroke: Nr(a),
1787
+ "stroke-width": Pr(a),
1788
+ "stroke-dasharray": Fr(a),
2095
1789
  opacity: "0.8"
2096
- }, null, 8, ct)) : n("", !0),
2097
- mn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1790
+ }, null, 8, ut)) : n("", !0),
1791
+ On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
2098
1792
  key: 2,
2099
1793
  x: L(a).x,
2100
1794
  y: L(a).y,
@@ -2102,32 +1796,32 @@ var b = {
2102
1796
  height: L(a).height,
2103
1797
  rx: "6",
2104
1798
  fill: "none",
2105
- stroke: gn.value,
1799
+ stroke: Nn.value,
2106
1800
  "stroke-width": "2.5",
2107
1801
  transform: "scale(1.1)",
2108
1802
  style: { "pointer-events": "none" }
2109
- }, null, 8, lt)) : n("", !0),
2110
- an(a) ? (u(), r(e, { key: 3 }, [i("rect", {
1803
+ }, null, 8, dt)) : n("", !0),
1804
+ _n(a) ? (u(), r(e, { key: 3 }, [i("rect", {
2111
1805
  x: "-4",
2112
1806
  y: "-10",
2113
1807
  width: "8",
2114
1808
  height: "20",
2115
- fill: rn(a).color,
1809
+ fill: gn(a).color,
2116
1810
  opacity: "0.06"
2117
- }, null, 8, ut), i("text", {
1811
+ }, null, 8, ft), i("text", {
2118
1812
  y: "4",
2119
1813
  transform: `rotate(${a.rotation || 0} 0 4)`,
2120
1814
  "text-anchor": "middle",
2121
- fill: ae(a) || I(a) || rn(a).color,
2122
- "font-size": ie(a, 12),
1815
+ fill: Ht(a) || F(a) || gn(a).color,
1816
+ "font-size": Vt(a, 12),
2123
1817
  "font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
2124
1818
  "font-weight": "600"
2125
- }, m(a.label), 9, dt)], 64)) : (u(), r(e, { key: 4 }, [i("g", { transform: cn(a) }, [
2126
- a.state === "none" ? n("", !0) : (u(), r("circle", {
1819
+ }, m(a.label), 9, pt)], 64)) : (u(), r(e, { key: 4 }, [
1820
+ i("g", { transform: bn(a) }, [a.state !== "none" && jr.value ? (u(), r("circle", {
2127
1821
  key: 0,
2128
1822
  r: "30",
2129
1823
  fill: "none",
2130
- stroke: rn(a).color,
1824
+ stroke: gn(a).color,
2131
1825
  "stroke-width": "2.5",
2132
1826
  opacity: "0"
2133
1827
  }, [...c[6] ||= [i("animate", {
@@ -2140,10 +1834,9 @@ var b = {
2140
1834
  values: "0.4;0.05;0.4",
2141
1835
  dur: "2s",
2142
1836
  repeatCount: "indefinite"
2143
- }, null, -1)]], 8, pt)),
2144
- i("g", mt, [p(t.$slots, "node-icon", {
1837
+ }, null, -1)]], 8, ht)) : n("", !0), i("g", gt, [p(t.$slots, "node-icon", {
2145
1838
  node: a,
2146
- color: I(a),
1839
+ color: F(a),
2147
1840
  viewMode: _.viewMode
2148
1841
  }, () => [i("rect", {
2149
1842
  x: "-18",
@@ -2151,84 +1844,76 @@ var b = {
2151
1844
  width: "36",
2152
1845
  height: "36",
2153
1846
  rx: "6",
2154
- fill: I(a),
1847
+ fill: F(a),
2155
1848
  opacity: "0.9"
2156
- }, null, 8, ht)])]),
2157
- i("g", gt, [i("circle", {
1849
+ }, null, 8, _t)])])], 8, mt),
1850
+ Dr.value ? (u(), r("g", {
1851
+ key: 0,
1852
+ transform: xn(a)
1853
+ }, [i("circle", {
2158
1854
  r: "4",
2159
- fill: rn(a).color,
1855
+ fill: gn(a).color,
2160
1856
  stroke: "#0a0e1a",
2161
1857
  "stroke-width": "2"
2162
- }, null, 8, _t)])
2163
- ], 8, ft), i("text", {
2164
- y: un(a),
2165
- transform: `rotate(${a.rotation || 0} 0 ${un(a)})`,
2166
- "text-anchor": "middle",
2167
- fill: ae(a),
2168
- "font-size": ie(a),
2169
- "font-weight": Ft(a),
2170
- "font-family": "'Segoe UI', system-ui, sans-serif",
2171
- opacity: "0.9"
2172
- }, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
2173
- key: t,
2174
- x: "0",
2175
- dy: t === 0 ? 0 : "1.2em"
2176
- }, m(e), 9, yt))), 128))], 8, vt)], 64)),
2177
- nr.value ? (u(), r("g", bt, [(u(!0), r(e, null, f(gr(a), (e) => (u(), r("circle", {
1858
+ }, null, 8, yt)], 8, vt)) : n("", !0),
1859
+ i("text", {
1860
+ y: Cn(a),
1861
+ transform: `rotate(${a.rotation || 0} 0 ${Cn(a)})`,
1862
+ "text-anchor": "middle",
1863
+ fill: Ht(a),
1864
+ "font-size": Vt(a),
1865
+ "font-weight": Ut(a),
1866
+ "font-family": "'Segoe UI', system-ui, sans-serif",
1867
+ opacity: "0.9"
1868
+ }, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
1869
+ key: t,
1870
+ x: "0",
1871
+ dy: t === 0 ? 0 : "1.2em"
1872
+ }, m(e), 9, xt))), 128))], 8, bt)
1873
+ ], 64)),
1874
+ Er.value ? (u(), r("g", St, [(u(!0), r(e, null, f(Zr(a), (e) => (u(), r("circle", {
2178
1875
  key: e.side,
2179
1876
  cx: e.x,
2180
1877
  cy: e.y,
2181
1878
  r: "4.5",
2182
1879
  class: "node-handle",
2183
1880
  fill: "#0a0e1a",
2184
- stroke: I(a),
1881
+ stroke: F(a),
2185
1882
  "stroke-width": "1.5",
2186
- onPointerdown: g((t) => yr(t, a.id, e), ["stop", "prevent"]),
2187
- onPointermove: g(Er, ["stop"]),
2188
- onPointerup: g(Dr, ["stop"]),
2189
- onPointercancel: g(Dr, ["stop"]),
2190
- onLostpointercapture: Dr,
1883
+ onPointerdown: g((t) => ei(t, a.id, e), ["stop", "prevent"]),
1884
+ onPointermove: g(li, ["stop"]),
1885
+ onPointerup: g(ui, ["stop"]),
1886
+ onPointercancel: g(ui, ["stop"]),
1887
+ onLostpointercapture: ui,
2191
1888
  onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
2192
1889
  onClick: c[1] ||= g(() => {}, ["stop"])
2193
- }, null, 40, xt))), 128))])) : n("", !0)
2194
- ], 46, ot))), 128)),
2195
- (u(!0), r(e, null, f(M.value, (t) => (u(), r(e, { key: `hit-${t.id}` }, [Q(t) ? (u(), r("path", {
2196
- key: 0,
2197
- d: $(t),
2198
- fill: "none",
2199
- stroke: "transparent",
2200
- "stroke-width": "14",
2201
- style: {
2202
- "pointer-events": "stroke",
2203
- cursor: "pointer"
2204
- },
2205
- onClick: g((e) => yn(t, e), ["stop"])
2206
- }, null, 8, St)) : n("", !0)], 64))), 128)),
2207
- J.value ? (u(), r("g", Ct, [(u(!0), r(e, null, f(ur(J.value), (e) => (u(), r("rect", {
1890
+ }, null, 40, Ct))), 128))])) : n("", !0)
1891
+ ], 46, st))), 128)),
1892
+ Xr.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(Wr(Xr.value), (e) => (u(), r("rect", {
2208
1893
  key: e.side,
2209
- x: J.value.x + e.x - 4.5,
2210
- y: J.value.y + e.y - 4.5,
1894
+ x: Xr.value.x + e.x - 4.5,
1895
+ y: Xr.value.y + e.y - 4.5,
2211
1896
  width: "9",
2212
1897
  height: "9",
2213
1898
  rx: "2",
2214
1899
  class: o(["node-resize-handle", `rt-${e.side}`]),
2215
- onMousedown: g((t) => fr(t, J.value, e.side), ["stop", "prevent"]),
1900
+ onMousedown: g((t) => Kr(t, Xr.value, e.side), ["stop", "prevent"]),
2216
1901
  onClick: c[2] ||= g(() => {}, ["stop"])
2217
- }, null, 42, wt))), 128))])) : n("", !0),
1902
+ }, null, 42, Tt))), 128))])) : n("", !0),
2218
1903
  K.value ? (u(), r("rect", {
2219
1904
  key: 4,
2220
1905
  class: "marquee-box",
2221
- x: zn.value.x,
2222
- y: zn.value.y,
2223
- width: zn.value.width,
2224
- height: zn.value.height,
1906
+ x: ar.value.x,
1907
+ y: ar.value.y,
1908
+ width: ar.value.width,
1909
+ height: ar.value.height,
2225
1910
  rx: "2",
2226
1911
  "vector-effect": "non-scaling-stroke"
2227
- }, null, 8, Tt)) : n("", !0)
2228
- ], 44, se));
1912
+ }, null, 8, Et)) : n("", !0)
1913
+ ], 44, ae));
2229
1914
  }
2230
- }, C = { install(e) {
2231
- e.component("Topology", Ft);
1915
+ }, Bt = { install(e) {
1916
+ e.component("Topology", zt);
2232
1917
  } };
2233
1918
  //#endregion
2234
- export { Ft as Topology, C as default, ae as initialEdges, ie as initialGroups, x as initialNodes, oe as nodeColors, b as nodeStates };
1919
+ export { zt as Topology, Bt as default, ie as nodeColors, b as nodeStates };