vue3-network-graph 0.1.0 → 0.1.1

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, x = 60, At = .2, jt = 5, Mt = 160, Nt = 140, Pt = 12, Ft = 4e3, It = 12, Lt = 4e3, Rt = {
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, Rt = 0, zt = () => {
297
+ Rt++;
298
+ }, S = (e) => e && typeof e == "object" ? {
804
299
  text: e.text,
805
300
  rotation: e.rotation || 0,
806
301
  fontSize: e.fontSize,
@@ -810,80 +305,96 @@ 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
+ }, Bt = (e, t = 11) => e.fontSize || t, Vt = (e) => e.fontColor || "#000000", Ht = (e, t = 500) => e.fontWeight || t, C = (e, t) => e.fontSize || S(t).fontSize || 8, w = (e, t) => e.fontColor || S(t).color || "#000000", T = d(v.nodes.map((e) => ({ ...e }))), Ut = null, Wt = () => {
309
+ Ut = T.value, y("update:nodes", T.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 === Ut) return;
314
+ let n = null, r = null;
315
+ try {
316
+ n = JSON.stringify(t), r = JSON.stringify(T.value);
317
+ } catch {
318
+ n = null;
319
+ }
320
+ (n === null || n !== r) && (zt(), T.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
345
  let i = new Set(T.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({
350
+ }), $t = "", N = null, en = () => JSON.parse(JSON.stringify({
841
351
  nodes: T.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
379
  T,
870
- A,
871
- j
872
- ], () => Yt(), { deep: !0 }), h(Ht, (e) => {
873
- e ? Xt() : N &&= (clearTimeout(N), null);
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 = 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));
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 && (T.value = T.value.filter((t) => !e.has(t.id)), Wt()), 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) => {
397
+ }, ln = (e) => {
887
398
  let t = (Array.isArray(e) ? e : [e]).filter((e) => e && typeof e == "object"), n = new Set(T.value.map((e) => e.id)), r = [];
888
399
  for (let e of t) {
889
400
  let t = JSON.parse(JSON.stringify(e));
@@ -891,8 +402,8 @@ var b = {
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 ? (T.value = [...T.value, ...r], Wt(), 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();
@@ -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 ? (Wt(), 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) ? (T.value = JSON.parse(JSON.stringify(t.nodes)), Wt()) : (T.value = (Array.isArray(v.nodes) ? v.nodes : []).map((e) => ({ ...e })), Ut = T.value), R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B(), on(), en();
469
+ };
470
+ h(() => v.edges, (e) => {
471
+ zt();
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,130 +521,172 @@ 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 T.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, x), n = vn(e.height, x);
998
533
  return {
999
- sx: t / S,
1000
- sy: n / S
534
+ sx: t / x,
535
+ sy: n / x
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 = Bt(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) : x),
562
+ h: vn(e.height, t ? 26 : x)
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: T.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 = t(() => v.config.selectedBorderColor || "#fbbf24"), jn = (e, t) => {
580
+ if (!In()) {
1031
581
  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);
582
+ let t = R.value.indexOf(e.id);
583
+ t >= 0 ? R.value.splice(t, 1) : R.value.push(e.id);
1034
584
  } else {
1035
- let t = z.value.length === 1 && z.value[0] === e.id;
1036
- z.value = t ? [] : [e.id], B.value = [];
585
+ let t = R.value.length === 1 && R.value[0] === e.id;
586
+ R.value = t ? [] : [e.id], z.value = [];
1037
587
  }
1038
- y("node-click", e), y("node-select", mn(e) ? e : null), V();
588
+ y("node-click", e), y("node-select", On(e) ? e : null), B();
1039
589
  }
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];
590
+ }, Mn = t(() => v.config.selectedLineColor || "#fbbf24"), Nn = (e, t) => {
591
+ if (In()) return;
592
+ let n = mn.value[e.id], r = !!(n && n.merged && n.representative), i = r ? M.value.filter((e) => {
593
+ let t = mn.value[e.id];
1044
594
  return t && t.key === n.key;
1045
595
  }) : null, a = r ? i.map((e) => e.id) : [e.id], o = r ? {
1046
596
  ...e,
1047
597
  bundleEdges: i
1048
598
  } : 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))];
599
+ if (t && (t.ctrlKey || t.metaKey)) a.every((e) => z.value.includes(e)) ? z.value = z.value.filter((e) => !a.includes(e)) : z.value = [...z.value, ...a.filter((e) => !z.value.includes(e))];
1050
600
  else {
1051
- let e = a.length === B.value.length && a.every((e) => B.value.includes(e));
1052
- B.value = e ? [] : a, z.value = [];
601
+ let e = a.length === z.value.length && a.every((e) => z.value.includes(e));
602
+ z.value = e ? [] : a, R.value = [];
1053
603
  }
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;
604
+ y("edge-select", kn(e) ? o : null), B();
605
+ }, Pn = 0, Fn = (e = 200) => {
606
+ Pn = performance.now() + e;
607
+ }, In = () => performance.now() < Pn, Ln = () => {
608
+ R.value = [], z.value = [], y("node-select", null), y("edge-select", null), B();
609
+ }, Rn = (e) => {
610
+ if (In()) return;
1061
611
  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({
612
+ t && t.closest && (t.closest(".topology-node") || t.closest(".node-resize-layer") || t.closest(".node-handles")) || Ln();
613
+ }, zn = d({
1064
614
  width: 1e3,
1065
615
  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;
616
+ }), Bn = d(1), Vn = d(0), Hn = d(0), Un = t(() => -Gn.value / 2 + Vn.value), Wn = t(() => -Kn.value / 2 + Hn.value), Gn = t(() => v.width ?? zn.value.width), Kn = t(() => v.height ?? zn.value.height), qn = null;
1067
617
  l(() => {
1068
- let e = D.value;
618
+ let e = O.value;
1069
619
  if (e) {
1070
620
  let t = e.getBoundingClientRect();
1071
- t.width > 0 && t.height > 0 && (Tn.value = {
621
+ t.width > 0 && t.height > 0 && (zn.value = {
1072
622
  width: t.width,
1073
623
  height: t.height
1074
624
  });
1075
625
  }
1076
- e && typeof ResizeObserver < "u" && (Mn = new ResizeObserver(() => {
626
+ e && typeof ResizeObserver < "u" && (qn = new ResizeObserver(() => {
1077
627
  let t = e.getBoundingClientRect();
1078
- t.width > 0 && t.height > 0 && (Tn.value = {
628
+ t.width > 0 && t.height > 0 && (zn.value = {
1079
629
  width: t.width,
1080
630
  height: t.height
1081
631
  });
1082
- }), Mn.observe(e));
632
+ }), qn.observe(e));
1083
633
  }), c(() => {
1084
- Mn &&= (Mn.disconnect(), null), wr(), qn();
634
+ qn &&= (qn.disconnect(), null), q &&= (cancelAnimationFrame(q), 0), K &&= (cancelAnimationFrame(K), 0), Z &&= (cancelAnimationFrame(Z), 0), ni(), fr();
1085
635
  });
1086
- let U = t(() => An.value / H.value), W = t(() => jn.value / H.value), Nn = (e) => {
636
+ let V = t(() => Gn.value / Bn.value), H = t(() => Kn.value / Bn.value), Jn = t(() => ({
637
+ x0: Un.value - Mt,
638
+ y0: Wn.value - Mt,
639
+ x1: Un.value + V.value + Mt,
640
+ y1: Wn.value + H.value + Mt
641
+ })), Yn = t(() => {
642
+ let e = Jn.value;
643
+ return T.value.filter((t) => {
644
+ let { w: n, h: r } = I(t);
645
+ 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;
646
+ });
647
+ }), U = t(() => {
648
+ let e = Jn.value;
649
+ return M.value.filter((t) => {
650
+ if (!vi(t)) return !1;
651
+ let n = P(t.from), r = P(t.to);
652
+ if (!n || !r) return !1;
653
+ let i = I(n).w / 2, a = I(n).h / 2, o = I(r).w / 2, s = I(r).h / 2;
654
+ 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;
655
+ });
656
+ }), Xn = (e) => {
1087
657
  if (v.config.enableZoom === !1) return;
1088
658
  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) => {
1092
- G.value = {
659
+ let t = O.value.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = n / t.width, a = r / t.height, o = V.value, s = H.value, c = e.deltaY > 0 ? .9 : 1.1, l = Math.min(jt, Math.max(At, Bn.value * c)), u = Gn.value / l, d = Kn.value / l;
660
+ Vn.value += (o - u) * i, Hn.value += (s - d) * a, Bn.value = l;
661
+ }, W = d(null), G = d(null), Zn = (e) => {
662
+ let t = O.value, n = t ? t.getBoundingClientRect() : null;
663
+ W.value = {
1093
664
  startX: e.clientX,
1094
665
  startY: e.clientY,
1095
666
  lastX: e.clientX,
1096
667
  lastY: e.clientY,
1097
- moved: !1
1098
- }, Kn();
1099
- }, Fn = (e) => {
1100
- let t = G.value, n = D.value;
668
+ moved: !1,
669
+ rectWidth: n && n.width ? n.width : 0,
670
+ rectHeight: n && n.height ? n.height : 0
671
+ }, dr();
672
+ }, Qn = (e) => {
673
+ let t = W.value, n = O.value;
1101
674
  if (!t || !n) return;
1102
- let r = n.getBoundingClientRect();
1103
- if (!r.width || !r.height) return;
675
+ let r = t.rectWidth, i = t.rectHeight;
676
+ if (!r || !i) return;
1104
677
  if (!t.moved) {
1105
678
  if (Math.hypot(e.clientX - t.startX, e.clientY - t.startY) < 4) return;
1106
679
  t.moved = !0, t.lastX = e.clientX, t.lastY = e.clientY;
1107
680
  return;
1108
681
  }
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 = () => {
1112
- let e = G.value;
1113
- G.value = null, e && e.moved && xn(), Jn();
1114
- }, Ln = (e) => {
682
+ let a = e.clientX - t.lastX, o = e.clientY - t.lastY;
683
+ t.lastX = e.clientX, t.lastY = e.clientY, Vn.value -= a * (V.value / r), Hn.value -= o * (H.value / i);
684
+ }, $n = () => {
685
+ let e = W.value;
686
+ W.value = null, e && e.moved && Fn(), pr();
687
+ }, er = (e) => {
1115
688
  let t = X(e);
1116
- K.value = {
689
+ G.value = {
1117
690
  start: {
1118
691
  x: t.x,
1119
692
  y: t.y
@@ -1125,17 +698,17 @@ var b = {
1125
698
  startClientX: e.clientX,
1126
699
  startClientY: e.clientY,
1127
700
  moved: !1
1128
- }, Kn();
1129
- }, Rn = (e) => {
1130
- let t = K.value;
701
+ }, dr();
702
+ }, tr = (e) => {
703
+ let t = G.value;
1131
704
  if (!t) return;
1132
705
  let n = X(e);
1133
706
  t.current = {
1134
707
  x: n.x,
1135
708
  y: n.y
1136
709
  }, !t.moved && Math.hypot(e.clientX - t.startClientX, e.clientY - t.startClientY) > 3 && (t.moved = !0);
1137
- }, zn = t(() => {
1138
- let e = K.value;
710
+ }, nr = t(() => {
711
+ let e = G.value;
1139
712
  return e ? {
1140
713
  x: Math.min(e.start.x, e.current.x),
1141
714
  y: Math.min(e.start.y, e.current.y),
@@ -1147,9 +720,9 @@ var b = {
1147
720
  width: 0,
1148
721
  height: 0
1149
722
  };
1150
- }), Bn = () => {
1151
- let e = K.value;
1152
- if (K.value = null, e && e.moved) {
723
+ }), rr = () => {
724
+ let e = G.value;
725
+ if (G.value = null, e && e.moved) {
1153
726
  let t = {
1154
727
  x: Math.min(e.start.x, e.current.x),
1155
728
  y: Math.min(e.start.y, e.current.y),
@@ -1160,78 +733,129 @@ var b = {
1160
733
  return !(r + n.width < t.x || r > t.x + t.w || i + n.height < t.y || i > t.y + t.h);
1161
734
  });
1162
735
  if (n.length) {
1163
- let e = new Set(z.value);
1164
- n.forEach((t) => e.add(t.id)), z.value = [...e], V();
736
+ let e = new Set(R.value);
737
+ n.forEach((t) => e.add(t.id)), R.value = [...e], B();
1165
738
  }
1166
- xn();
739
+ Fn();
1167
740
  }
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) {
741
+ pr();
742
+ }, ir = (e) => !e || typeof e.closest != "function" ? !1 : !!(e.closest(".topology-node") || e.closest(".node-handles") || e.closest(".node-resize-layer")), ar = (e) => {
743
+ if (O.value) {
1171
744
  if (e.button === 1) {
1172
745
  if (v.config.enablePan === !1) return;
1173
- e.preventDefault(), Pn(e);
746
+ e.preventDefault(), Zn(e);
1174
747
  return;
1175
748
  }
1176
- if (e.button === 0 && !Vn(e.target)) {
749
+ if (e.button === 0 && !ir(e.target)) {
1177
750
  if (e.ctrlKey || e.metaKey) {
1178
751
  if (v.config.enableMarquee === !1) return;
1179
- e.preventDefault(), Ln(e);
752
+ e.preventDefault(), er(e);
1180
753
  return;
1181
754
  }
1182
- v.config.enablePan !== !1 && (e.preventDefault(), Pn(e));
755
+ v.config.enablePan !== !1 && (e.preventDefault(), Zn(e));
1183
756
  }
1184
757
  }
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) };
1197
- if (K.value) return { cursor: "crosshair" };
1198
- 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) => {
758
+ }, or = !1, K = 0, sr = null, cr = () => {
759
+ K = 0;
760
+ let e = sr;
761
+ sr = null, e && (W.value ? Qn(e) : G.value && tr(e));
762
+ }, lr = (e) => {
763
+ sr = e, K ||= requestAnimationFrame(cr);
764
+ }, ur = () => {
765
+ K && (cancelAnimationFrame(K), cr()), W.value && $n(), G.value && rr();
766
+ }, dr = () => {
767
+ or || (or = !0, window.addEventListener("mousemove", lr, !0), window.addEventListener("mouseup", ur, !0));
768
+ }, fr = () => {
769
+ or && (or = !1, window.removeEventListener("mousemove", lr, !0), window.removeEventListener("mouseup", ur, !0));
770
+ }, pr = () => {
771
+ !W.value && !G.value && fr();
772
+ }, mr = t(() => {
773
+ if (J.value && J.value.side) return { cursor: Br(J.value.side) };
774
+ if (G.value) return { cursor: "crosshair" };
775
+ if (W.value && W.value.moved) return { cursor: "grabbing" };
776
+ }), hr = t(() => v.config.showGrid !== !1), gr = t(() => v.config.gridColor || "#1a2240"), _r = t(() => {
777
+ let e = Number(v.config.gridStep);
778
+ return (Number.isFinite(e) && e > 0 ? e : 40) / Bn.value;
779
+ }), vr = t(() => {
780
+ let e = Number(v.config.gridOpacity);
781
+ return Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : .5;
782
+ }), yr = t(() => {
783
+ 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) => ({
784
+ offset: e.offset == null ? t === 0 ? "0%" : "100%" : e.offset,
785
+ color: e.color,
786
+ opacity: e.opacity
787
+ })) : null, n = t && t.length ? t : [{
788
+ offset: "0%",
789
+ color: e.startColor || "#0f1729",
790
+ opacity: e.startOpacity
791
+ }, {
792
+ offset: "100%",
793
+ color: e.endColor || "#060a14",
794
+ opacity: e.endOpacity
795
+ }];
796
+ return {
797
+ cx: e.cx || "50%",
798
+ cy: e.cy || "50%",
799
+ r: e.r || "60%",
800
+ stops: n
801
+ };
802
+ }), br = t(() => v.config.showCenterPoint === !0), xr = t(() => v.config.showEdgeTextBg === !0), Sr = t(() => v.config.edgeTextBgColor || "#0a0e1a"), Cr = t(() => v.config.showNodeHandles === !0), wr = t(() => v.config.showStatusDot !== !1), Tr = (e, t) => {
803
+ let n = Number(e);
804
+ return Number.isFinite(n) && n >= 0 ? n : t;
805
+ }, Er = t(() => {
806
+ let e = v.config.motionFx ?? v.config.fx;
807
+ return typeof e == "boolean" ? e : M.value.length <= Tr(v.config.fxMotionMaxEdges, 200);
808
+ }), Dr = t(() => {
809
+ let e = v.config.glowFx ?? v.config.fx;
810
+ return typeof e == "boolean" ? e : M.value.length <= Tr(v.config.fxGlowMaxEdges, 500);
811
+ }), Or = t(() => {
812
+ let e = v.config.breatheFx ?? v.config.fx;
813
+ return typeof e == "boolean" ? e : T.value.length <= Tr(v.config.fxBreatheMaxNodes, 300);
814
+ }), kr = (e) => e.borderColor || F(e) || "#94a3b8", Ar = (e) => e.borderWidth || 0, jr = (e) => e.borderStyle === "dashed" ? "8 5" : void 0, Mr = (e, t) => {
1200
815
  if (e.button !== 0 || !v.editable || v.config.nodeDraggable === !1) return;
1201
816
  e.stopPropagation();
1202
- let n = F(t), r = X(e);
1203
- if (Rt.value = {
817
+ let n = P(t), r = X(e);
818
+ if (Kt.value = {
1204
819
  x: r.x - n.x,
1205
820
  y: r.y - n.y
1206
- }, O = {
821
+ }, Jt = {
1207
822
  x: e.clientX,
1208
823
  y: e.clientY
1209
- }, k = !1, Bt = !!(e.ctrlKey || e.metaKey), z.value.length > 1 && z.value.includes(t)) {
824
+ }, Yt = !1, Xt = !!(e.ctrlKey || e.metaKey), R.value.length > 1 && R.value.includes(t)) {
1210
825
  let e = {};
1211
- z.value.forEach((t) => {
1212
- let n = F(t);
826
+ R.value.forEach((t) => {
827
+ let n = P(t);
1213
828
  n && (e[t] = {
1214
829
  x: n.x,
1215
830
  y: n.y
1216
831
  });
1217
- }), zt.value = {
832
+ }), qt.value = {
1218
833
  origins: e,
1219
834
  start: {
1220
835
  x: r.x,
1221
836
  y: r.y
1222
837
  }
1223
838
  };
1224
- } else zt.value = null;
1225
- E.value = t, y("node-drag-start", n);
1226
- }, sr = (e) => {
1227
- if (q.value) {
1228
- pr(e);
839
+ } else qt.value = null;
840
+ D.value = t, y("node-drag-start", n);
841
+ }, q = 0, Nr = null, Pr = () => {
842
+ q = 0;
843
+ let e = Nr;
844
+ Nr = null, e && Ir(e);
845
+ }, Fr = (e) => {
846
+ (J.value || D.value) && (Nr = {
847
+ clientX: e.clientX,
848
+ clientY: e.clientY
849
+ }, q ||= requestAnimationFrame(Pr));
850
+ }, Ir = (e) => {
851
+ if (J.value) {
852
+ Hr(e);
1229
853
  return;
1230
854
  }
1231
- if (!E.value) return;
855
+ if (!D.value) return;
1232
856
  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;
857
+ !Yt && Jt && Math.hypot(e.clientX - Jt.x, e.clientY - Jt.y) > kt && (Yt = !0, !Xt && !R.value.includes(D.value) && (R.value = [D.value], z.value = [], y("node-select", P(D.value)), B()));
858
+ let n = qt.value;
1235
859
  if (n) {
1236
860
  let e = t.x - n.start.x, r = t.y - n.start.y;
1237
861
  T.value = T.value.map((t) => n.origins[t.id] ? {
@@ -1239,19 +863,19 @@ var b = {
1239
863
  x: n.origins[t.id].x + e,
1240
864
  y: n.origins[t.id].y + r
1241
865
  } : t);
1242
- } else T.value = T.value.map((e) => e.id === E.value ? {
866
+ } else T.value = T.value.map((e) => e.id === D.value ? {
1243
867
  ...e,
1244
- x: t.x - Rt.value.x,
1245
- y: t.y - Rt.value.y
868
+ x: t.x - Kt.value.x,
869
+ y: t.y - Kt.value.y
1246
870
  } : e);
1247
- y("update:nodes", T.value);
1248
- }, cr = () => {
1249
- if (q.value) {
1250
- mr();
871
+ Wt();
872
+ }, Lr = () => {
873
+ if (q && (cancelAnimationFrame(q), Pr()), J.value) {
874
+ Ur();
1251
875
  return;
1252
876
  }
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) => {
877
+ D.value && (Yt && Fn(), D.value = null, qt.value = null, Jt = null, Yt = !1, y("node-drag-end"));
878
+ }, J = d(null), Rr = (e, t, n) => Math.min(n, Math.max(t, e)), zr = (e) => {
1255
879
  let t = L(e), n = t.x, r = t.y, i = t.x + t.width, a = t.y + t.height;
1256
880
  return [
1257
881
  {
@@ -1295,10 +919,10 @@ var b = {
1295
919
  y: 0
1296
920
  }
1297
921
  ];
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) => {
922
+ }, Br = (e) => e === "nw" || e === "se" ? "nwse-resize" : e === "ne" || e === "sw" ? "nesw-resize" : e === "n" || e === "s" ? "ns-resize" : "ew-resize", Vr = (e, t, n) => {
1299
923
  if (!v.editable || v.config.nodeResizable === !1 || !t) return;
1300
- let { w: r, h: i } = fn(t);
1301
- q.value = {
924
+ let { w: r, h: i } = I(t);
925
+ J.value = {
1302
926
  id: t.id,
1303
927
  side: n,
1304
928
  anchorX: n.includes("e") ? t.x - r / 2 : n.includes("w") ? t.x + r / 2 : null,
@@ -1306,19 +930,19 @@ var b = {
1306
930
  startW: r,
1307
931
  startH: i
1308
932
  }, y("node-resize-start", t);
1309
- }, pr = (e) => {
1310
- let t = q.value;
933
+ }, Hr = (e) => {
934
+ let t = J.value;
1311
935
  if (!t) return;
1312
- let n = F(t.id);
936
+ let n = P(t.id);
1313
937
  if (!n) return;
1314
938
  let r = X(e), i = t.startW, a = t.startH, o = n.x, s = n.y;
1315
939
  if (t.anchorX !== null) {
1316
940
  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;
941
+ i = Rr(e ? r.x - t.anchorX : t.anchorX - r.x, Pt, Ft), o = e ? t.anchorX + i / 2 : t.anchorX - i / 2;
1318
942
  }
1319
943
  if (t.anchorY !== null) {
1320
944
  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;
945
+ a = Rr(e ? r.y - t.anchorY : t.anchorY - r.y, It, Lt), s = e ? t.anchorY + a / 2 : t.anchorY - a / 2;
1322
946
  }
1323
947
  T.value = T.value.map((e) => e.id === t.id ? {
1324
948
  ...e,
@@ -1326,15 +950,15 @@ var b = {
1326
950
  y: s,
1327
951
  width: i,
1328
952
  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) => {
953
+ } : e), Wt();
954
+ }, Ur = () => {
955
+ let e = J.value;
956
+ J.value = null, e && (Fn(), y("node-resize-end", P(e.id) || null));
957
+ }, Wr = t(() => v.editable && v.config.nodeResizable !== !1), Gr = t(() => {
958
+ if (!Wr.value) return null;
959
+ let e = R.value;
960
+ return e.length === 1 && P(e[0]) || null;
961
+ }), Y = d(null), Kr = (e) => {
1338
962
  let t = L(e);
1339
963
  return [
1340
964
  {
@@ -1358,8 +982,8 @@ var b = {
1358
982
  y: 0
1359
983
  }
1360
984
  ];
1361
- }, _r = (e, t) => {
1362
- let n = D.value;
985
+ }, qr = (e, t) => {
986
+ let n = O.value;
1363
987
  if (!n) return null;
1364
988
  let r = e, i = t;
1365
989
  if (e && typeof e == "object" && (r = e.clientX, i = e.clientY), r == null || i == null) return null;
@@ -1372,8 +996,8 @@ var b = {
1372
996
  x: s.x,
1373
997
  y: s.y
1374
998
  };
1375
- }, vr = (e, t) => {
1376
- let n = D.value;
999
+ }, Jr = (e, t) => {
1000
+ let n = O.value;
1377
1001
  if (!n) return null;
1378
1002
  let r = n.createSVGPoint();
1379
1003
  r.x = Number(e) || 0, r.y = Number(t) || 0;
@@ -1384,12 +1008,12 @@ var b = {
1384
1008
  x: a.x,
1385
1009
  y: a.y
1386
1010
  };
1387
- }, X = (e) => _r(e) ?? {
1011
+ }, X = (e) => qr(e) ?? {
1388
1012
  x: 0,
1389
1013
  y: 0
1390
- }, yr = (e, t, n) => {
1391
- let r = F(t);
1392
- if (!r || !D.value) return;
1014
+ }, Yr = (e, t, n) => {
1015
+ let r = P(t);
1016
+ if (!r || !O.value) return;
1393
1017
  let i = X(e);
1394
1018
  Y.value = {
1395
1019
  fromId: t,
@@ -1403,16 +1027,23 @@ var b = {
1403
1027
  try {
1404
1028
  e.target.setPointerCapture?.(e.pointerId);
1405
1029
  } 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) => {
1030
+ ti();
1031
+ }, Z = 0, Xr = null, Zr = () => {
1032
+ Z = 0;
1033
+ let e = Xr;
1034
+ Xr = null, e && Y.value && ii(e);
1035
+ }, Qr = (e) => {
1036
+ Y.value && (Xr = {
1037
+ clientX: e.clientX,
1038
+ clientY: e.clientY
1039
+ }, Z ||= requestAnimationFrame(Zr));
1040
+ }, $r = () => {
1041
+ Z && (cancelAnimationFrame(Z), Zr()), Y.value && ai();
1042
+ }, ei = !1, ti = () => {
1043
+ ei || (ei = !0, window.addEventListener("mousemove", Qr, !0), window.addEventListener("mouseup", $r, !0));
1044
+ }, ni = () => {
1045
+ ei && (ei = !1, window.removeEventListener("mousemove", Qr, !0), window.removeEventListener("mouseup", $r, !0));
1046
+ }, ri = (e, t, n) => {
1416
1047
  let r = T.value;
1417
1048
  for (let i = r.length - 1; i >= 0; i--) {
1418
1049
  let a = r[i];
@@ -1421,15 +1052,15 @@ var b = {
1421
1052
  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
1053
  }
1423
1054
  return null;
1424
- }, Er = (e) => {
1055
+ }, ii = (e) => {
1425
1056
  let t = Y.value;
1426
1057
  if (!t) return;
1427
1058
  let n = X(e);
1428
1059
  t.px = n.x, t.py = n.y;
1429
- let r = Tr(n.x, n.y, t.fromId);
1060
+ let r = ri(n.x, n.y, t.fromId);
1430
1061
  t.overId = r ? r.id : null;
1431
- }, Dr = () => {
1432
- wr();
1062
+ }, ai = () => {
1063
+ ni();
1433
1064
  let e = Y.value;
1434
1065
  if (Y.value = null, !e || !e.overId || e.overId === e.fromId) return;
1435
1066
  let t = {
@@ -1440,9 +1071,9 @@ var b = {
1440
1071
  fromAnchor: "edge",
1441
1072
  toAnchor: "edge"
1442
1073
  };
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);
1074
+ k.value.push(t), y("edge-create", t);
1075
+ }, oi = (e, t, n) => {
1076
+ let r = e.x, i = e.y, a = t.x - r, o = t.y - i, { w: s, h: c } = I(e);
1446
1077
  if (!n || n === "center" || a === 0 && o === 0) return {
1447
1078
  x: r,
1448
1079
  y: i
@@ -1452,23 +1083,23 @@ var b = {
1452
1083
  x: r + a * p,
1453
1084
  y: i + o * p
1454
1085
  };
1455
- }, kr = t(() => {
1086
+ }, si = t(() => {
1456
1087
  let e = /* @__PURE__ */ new Map();
1457
1088
  M.value.forEach((t) => {
1458
- let n = P.value[t.id];
1089
+ let n = mn.value[t.id];
1459
1090
  n && !n.hidden && (e.has(n.key) || e.set(n.key, []), e.get(n.key).push(t));
1460
1091
  });
1461
1092
  let t = {};
1462
1093
  return e.forEach((e, n) => {
1463
- let [r, i] = n.split("__"), a = F(r), o = F(i);
1094
+ let [r, i] = n.split("__"), a = P(r), o = P(i);
1464
1095
  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;
1096
+ 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
1097
  if (m > 1) {
1467
- let e = (m - 1) / 2 * Dt, t = (e) => {
1468
- let { w: t, h: n } = fn(e);
1098
+ let e = (m - 1) / 2 * Ot, t = (e) => {
1099
+ let { w: t, h: n } = I(e);
1469
1100
  return Math.max(4, (Math.abs(f) * t + Math.abs(p) * n) / 2 - 6);
1470
1101
  }, n = Math.min(1, t(a) / e, t(o) / e);
1471
- ee = Dt * Math.max(.35, n);
1102
+ ee = Ot * Math.max(.35, n);
1472
1103
  }
1473
1104
  let h = {};
1474
1105
  e.forEach((e, t) => {
@@ -1484,12 +1115,12 @@ var b = {
1484
1115
  bulge: Math.min(l * .15, 50)
1485
1116
  };
1486
1117
  }), t;
1487
- }), Ar = (e) => {
1488
- let t = P.value[e.id], n = t && kr.value[t.key];
1118
+ }), ci = (e) => {
1119
+ let t = mn.value[e.id], n = t && si.value[t.key];
1489
1120
  if (!n) return null;
1490
- let r = F(e.from), i = F(e.to);
1121
+ let r = P(e.from), i = P(e.to);
1491
1122
  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);
1123
+ let a = n.slots[e.id] || 0, o = a * n.gap, s = oi(r, i, e.fromAnchor), c = oi(i, r, e.toAnchor);
1493
1124
  return {
1494
1125
  frame: n,
1495
1126
  slot: a,
@@ -1502,12 +1133,12 @@ var b = {
1502
1133
  y: c.y + n.ny * o
1503
1134
  }
1504
1135
  };
1505
- }, jr = (e) => {
1506
- let t = Ar(e);
1136
+ }, li = (e) => {
1137
+ let t = ci(e);
1507
1138
  if (!t) return "";
1508
1139
  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") {
1140
+ if (E.value === "straight") return `M ${n.x} ${n.y} L ${r.x} ${r.y}`;
1141
+ if (E.value === "polyline") {
1511
1142
  if (i.dominant === "v") {
1512
1143
  let e = (n.y + r.y) / 2 + o;
1513
1144
  return `M ${n.x} ${n.y} L ${n.x} ${e} L ${r.x} ${e} L ${r.x} ${r.y}`;
@@ -1517,18 +1148,18 @@ var b = {
1517
1148
  }
1518
1149
  let s = (n.x + r.x) / 2 + i.nx * i.bulge, c = (n.y + r.y) / 2 + i.ny * i.bulge;
1519
1150
  return `M ${n.x} ${n.y} Q ${s} ${c} ${r.x} ${r.y}`;
1520
- }, Mr = (e, t) => {
1521
- let n = Ar(e);
1151
+ }, ui = (e, t) => {
1152
+ let n = ci(e);
1522
1153
  if (!n) return {
1523
1154
  x: 0,
1524
1155
  y: 0
1525
1156
  };
1526
1157
  let { from: r, to: i, frame: a, slot: o } = n, s = o * a.gap;
1527
- if (Lt.value === "straight") return {
1158
+ if (E.value === "straight") return {
1528
1159
  x: r.x + (i.x - r.x) * t,
1529
1160
  y: r.y + (i.y - r.y) * t
1530
1161
  };
1531
- if (Lt.value === "polyline") {
1162
+ if (E.value === "polyline") {
1532
1163
  if (a.dominant === "v") {
1533
1164
  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
1165
  return c <= n ? {
@@ -1559,19 +1190,19 @@ var b = {
1559
1190
  x: (1 - t) * (1 - t) * r.x + 2 * (1 - t) * t * c + t * t * i.x,
1560
1191
  y: (1 - t) * (1 - t) * r.y + 2 * (1 - t) * t * l + t * t * i.y
1561
1192
  };
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(() => {
1193
+ }, di = t(() => Y.value ? P(Y.value.fromId) : null), fi = t(() => Y.value && Y.value.overId ? P(Y.value.overId) : null), pi = t(() => di.value ? F(di.value) : "#00f0ff"), mi = t(() => {
1563
1194
  let e = Y.value;
1564
1195
  if (!e) return {
1565
1196
  x: 0,
1566
1197
  y: 0
1567
1198
  };
1568
- let t = Pr.value;
1569
- return t && Nr.value ? Or(t, Nr.value, "edge") : {
1199
+ let t = fi.value;
1200
+ return t && di.value ? oi(t, di.value, "edge") : {
1570
1201
  x: e.px,
1571
1202
  y: e.py
1572
1203
  };
1573
- }), Lr = t(() => {
1574
- let e = Pr.value;
1204
+ }), hi = t(() => {
1205
+ let e = fi.value;
1575
1206
  if (!e) return null;
1576
1207
  let t = L(e);
1577
1208
  return {
@@ -1580,8 +1211,8 @@ var b = {
1580
1211
  w: t.width + 8,
1581
1212
  h: t.height + 8
1582
1213
  };
1583
- }), Rr = (e) => {
1584
- let t = e.nodeIds.map((e) => F(e)).filter(Boolean);
1214
+ }), gi = (e) => {
1215
+ let t = e.nodeIds.map((e) => P(e)).filter(Boolean);
1585
1216
  if (t.length === 0) return null;
1586
1217
  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
1218
  return {
@@ -1590,79 +1221,114 @@ var b = {
1590
1221
  width: a - r,
1591
1222
  height: o - i
1592
1223
  };
1593
- }, zr = t(() => v.groups.map((e) => ({
1224
+ }, _i = t(() => v.groups.map((e) => ({
1594
1225
  ...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];
1226
+ rect: gi(e)
1227
+ })).filter((e) => e.rect)), Q = (e) => kn(e) ? Mn.value : (P(e.from), e.centerText && e.centerText.color || "#00f0ff"), vi = (e) => {
1228
+ let t = mn.value[e.id];
1598
1229
  return !!t && !t.hidden;
1599
- }, Br = t(() => [...new Set(M.value.map(Z))].map((e) => ({
1230
+ }, yi = t(() => [...new Set(M.value.map(Q))].map((e) => ({
1600
1231
  key: String(e).replace("#", ""),
1601
1232
  color: e
1602
- }))), Vr = (e) => {
1233
+ }))), bi = (e) => {
1603
1234
  let t = e.endMarker;
1604
1235
  if (!t || t === "none") return "";
1605
- let n = Z(e) || "#00f0ff", r = String(n).replace("#", "");
1236
+ let n = Q(e) || "#00f0ff", r = String(n).replace("#", "");
1606
1237
  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) => {
1238
+ }, xi = /* @__PURE__ */ new Map(), Si = {
1239
+ nodes: null,
1240
+ edges: null,
1241
+ mode: null,
1242
+ epoch: -1
1243
+ }, Ci = () => {
1244
+ let e = Si;
1245
+ (e.nodes !== T.value || e.edges !== M.value || e.mode !== E.value || e.epoch !== Rt) && (Si = {
1246
+ nodes: T.value,
1247
+ edges: M.value,
1248
+ mode: E.value,
1249
+ epoch: Rt
1250
+ }, xi = /* @__PURE__ */ new Map());
1251
+ }, $ = (e) => {
1252
+ Ci();
1253
+ let t = xi.get(e.id);
1254
+ return t === void 0 && (t = li(e), xi.set(e.id, t)), t;
1255
+ }, wi = (e, t = 1) => `${2 / e.speed * t}s`, Ti = (e) => `${3 / e.speed}s`, Ei = (e) => S(e).text, Di = (e) => !!e && String(S(e).text ?? "").trim() !== "", Oi = (e, t) => {
1608
1256
  if (!e) return null;
1609
- let n = x(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1257
+ let n = S(e), r = Number(t.fontSize) || Number(n.fontSize) || 8, i = String(n.text ?? ""), a = 0;
1610
1258
  for (let e of i) a += e.charCodeAt(0) > 11904 ? 1 : .62;
1611
1259
  return {
1612
1260
  w: Math.max(14, a * r + 8),
1613
1261
  h: Math.max(12, r + 6)
1614
1262
  };
1615
- }, qr = (e, t) => {
1616
- let n = Mr(e, Math.max(0, t - .005)), r = Mr(e, Math.min(1, t + .005));
1263
+ }, ki = (e, t) => {
1264
+ let n = ui(e, Math.max(0, t - .005)), r = ui(e, Math.min(1, t + .005));
1617
1265
  return Math.atan2(r.y - n.y, r.x - n.x) * 180 / Math.PI;
1618
- }, Jr = (e) => {
1266
+ }, Ai = (e) => {
1619
1267
  let t = e % 180;
1620
1268
  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));
1269
+ }, ji = (e, t, n) => `translate(${t.x}, ${t.y}) rotate(${(S(e).rotation || 0) + (n || 0)})`, Mi = t(() => {
1270
+ let e = [];
1271
+ for (let t of U.value) {
1272
+ let n = mn.value[t.id];
1273
+ if (!n) continue;
1274
+ let r = n.merged && n.representative, i = !n.merged && (t.fromText || t.centerText || t.toText);
1275
+ if (!r && !i) continue;
1276
+ let a = P(t.from), o = P(t.to);
1277
+ a && o && e.push({
1278
+ id: t.id,
1279
+ edge: t,
1280
+ info: n,
1281
+ color: a && ie[a.type] || "#00f0ff",
1282
+ start: ui(t, .28),
1283
+ center: ui(t, .5),
1284
+ end: ui(t, .72),
1285
+ startAngle: Ai(ki(t, .28)),
1286
+ centerAngle: Ai(ki(t, .5)),
1287
+ endAngle: Ai(ki(t, .72)),
1288
+ fromBox: Oi(t.fromText, t),
1289
+ centerBox: Oi(t.centerText, t),
1290
+ toBox: Oi(t.toText, t)
1291
+ });
1292
+ }
1293
+ return e;
1294
+ });
1641
1295
  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
1296
+ resetDataBaseline: on,
1297
+ getData: sn,
1298
+ setData: pn,
1299
+ removeSelected: cn,
1300
+ addNodes: ln,
1301
+ addEdges: un,
1302
+ updateNodes: dn,
1303
+ updateEdges: fn,
1304
+ clientToSvg: qr,
1305
+ svgToClient: Jr
1651
1306
  }), (t, c) => (u(), r("svg", {
1652
1307
  ref_key: "svgRef",
1653
- ref: D,
1308
+ ref: O,
1654
1309
  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"])
1310
+ style: s(mr.value),
1311
+ viewBox: `${Un.value} ${Wn.value} ${V.value} ${H.value}`,
1312
+ onMousedown: ar,
1313
+ onMousemove: Fr,
1314
+ onMouseup: Lr,
1315
+ onMouseleave: Lr,
1316
+ onClick: Rn,
1317
+ onWheel: g(Xn, ["prevent"])
1663
1318
  }, [
1664
1319
  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),
1320
+ 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),
1321
+ i("radialGradient", {
1322
+ id: "bg-grid",
1323
+ cx: yr.value.cx,
1324
+ cy: yr.value.cy,
1325
+ r: yr.value.r
1326
+ }, [(u(!0), r(e, null, f(yr.value.stops, (e, t) => (u(), r("stop", {
1327
+ key: `bg-stop-${t}`,
1328
+ offset: e.offset,
1329
+ "stop-color": e.color,
1330
+ "stop-opacity": e.opacity
1331
+ }, null, 8, se))), 128))], 8, oe),
1666
1332
  (u(!0), r(e, null, f(ee(b), (e, t) => (u(), r("radialGradient", {
1667
1333
  key: `breath-${t}`,
1668
1334
  id: `breath-grad-${t}`
@@ -1684,7 +1350,7 @@ var b = {
1684
1350
  }, null, 8, de)
1685
1351
  ], 8, ce))), 128)),
1686
1352
  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", {
1353
+ (u(!0), r(e, null, f(yi.value, (e) => (u(), r("marker", {
1688
1354
  key: `m-arrow-${e.key}`,
1689
1355
  id: `edge-arrow-${e.key}`,
1690
1356
  viewBox: "0 0 10 10",
@@ -1698,7 +1364,7 @@ var b = {
1698
1364
  d: "M1,2.5 L9,5 L1,7.5 Z",
1699
1365
  fill: e.color
1700
1366
  }, null, 8, pe)], 8, fe))), 128)),
1701
- (u(!0), r(e, null, f(Br.value, (e) => (u(), r("marker", {
1367
+ (u(!0), r(e, null, f(yi.value, (e) => (u(), r("marker", {
1702
1368
  key: `m-dot-${e.key}`,
1703
1369
  id: `edge-dot-${e.key}`,
1704
1370
  viewBox: "0 0 10 10",
@@ -1716,31 +1382,31 @@ var b = {
1716
1382
  }, null, 8, he)], 8, me))), 128))
1717
1383
  ]),
1718
1384
  i("rect", {
1719
- width: U.value,
1720
- height: W.value,
1721
- x: On.value,
1722
- y: kn.value,
1385
+ width: V.value,
1386
+ height: H.value,
1387
+ x: Un.value,
1388
+ y: Wn.value,
1723
1389
  fill: "url(#bg-grid)"
1724
1390
  }, null, 8, ge),
1725
- Xn.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1391
+ hr.value ? (u(), r(e, { key: 0 }, [i("pattern", {
1726
1392
  id: "grid",
1727
- width: Qn.value,
1728
- height: Qn.value,
1393
+ width: _r.value,
1394
+ height: _r.value,
1729
1395
  patternUnits: "userSpaceOnUse"
1730
1396
  }, [i("path", {
1731
- d: `M ${Qn.value} 0 L 0 0 0 ${Qn.value}`,
1397
+ d: `M ${_r.value} 0 L 0 0 0 ${_r.value}`,
1732
1398
  fill: "none",
1733
- stroke: Zn.value,
1399
+ stroke: gr.value,
1734
1400
  "stroke-width": "0.5"
1735
1401
  }, null, 8, ve)], 8, _e), i("rect", {
1736
- width: U.value,
1737
- height: W.value,
1738
- x: On.value,
1739
- y: kn.value,
1402
+ width: V.value,
1403
+ height: H.value,
1404
+ x: Un.value,
1405
+ y: Wn.value,
1740
1406
  fill: "url(#grid)",
1741
- opacity: "0.5"
1407
+ opacity: vr.value
1742
1408
  }, null, 8, ye)], 64)) : n("", !0),
1743
- $n.value ? (u(), r("g", be, [...c[5] ||= [
1409
+ br.value ? (u(), r("g", be, [...c[5] ||= [
1744
1410
  i("line", {
1745
1411
  x1: "-22",
1746
1412
  y1: "0",
@@ -1772,7 +1438,7 @@ var b = {
1772
1438
  opacity: "0.8"
1773
1439
  }, null, -1)
1774
1440
  ]])) : n("", !0),
1775
- (u(!0), r(e, null, f(zr.value, (e) => (u(), r("g", { key: e.id }, [
1441
+ (u(!0), r(e, null, f(_i.value, (e) => (u(), r("g", { key: e.id }, [
1776
1442
  i("rect", {
1777
1443
  x: e.rect.x,
1778
1444
  y: e.rect.y,
@@ -1834,39 +1500,39 @@ var b = {
1834
1500
  "letter-spacing": "0.5"
1835
1501
  }, m(e.label), 9, De)
1836
1502
  ]))), 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),
1503
+ (u(!0), r(e, null, f(U.value, (e) => (u(), r("path", {
1504
+ key: `base-${e.id}`,
1505
+ d: $(e),
1840
1506
  fill: "none",
1841
1507
  stroke: "#1a2744",
1842
1508
  "stroke-width": "2",
1843
1509
  "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", {
1510
+ "marker-end": bi(e)
1511
+ }, null, 8, Oe))), 128)),
1512
+ (u(!0), r(e, null, f(U.value, (t) => (u(), r(e, { key: `glow-${t.id}` }, [Dr.value ? (u(), r("path", {
1847
1513
  key: 0,
1848
1514
  d: $(t),
1849
1515
  fill: "none",
1850
- stroke: Z(t),
1516
+ stroke: Q(t),
1851
1517
  "stroke-width": "2",
1852
1518
  "stroke-linecap": "round",
1853
1519
  opacity: "0.15",
1854
1520
  filter: "url(#glow-strong)"
1855
1521
  }, 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", {
1522
+ (u(!0), r(e, null, f(U.value, (t) => (u(), r(e, { key: `sel-${t.id}` }, [kn(t) ? (u(), r("path", {
1857
1523
  key: 0,
1858
1524
  d: $(t),
1859
1525
  fill: "none",
1860
- stroke: vn.value,
1526
+ stroke: Mn.value,
1861
1527
  "stroke-width": "4",
1862
1528
  opacity: "0.35",
1863
1529
  filter: "url(#glow-strong)"
1864
1530
  }, 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, [
1531
+ (u(!0), r(e, null, f(U.value, (t) => (u(), r(e, { key: `flow-${t.id}` }, [Er.value ? (u(), r("g", je, [
1866
1532
  i("path", {
1867
1533
  d: $(t),
1868
1534
  fill: "none",
1869
- stroke: Z(t),
1535
+ stroke: Q(t),
1870
1536
  "stroke-width": "2.5",
1871
1537
  "stroke-linecap": "round",
1872
1538
  "stroke-dasharray": "12 40",
@@ -1875,13 +1541,13 @@ var b = {
1875
1541
  attributeName: "stroke-dashoffset",
1876
1542
  from: "0",
1877
1543
  to: "-52",
1878
- dur: Hr(t),
1544
+ dur: wi(t),
1879
1545
  repeatCount: "indefinite"
1880
1546
  }, null, 8, Ne)], 8, Me),
1881
1547
  i("path", {
1882
1548
  d: $(t),
1883
1549
  fill: "none",
1884
- stroke: Z(t),
1550
+ stroke: Q(t),
1885
1551
  "stroke-width": "1.5",
1886
1552
  "stroke-linecap": "round",
1887
1553
  "stroke-dasharray": "6 60",
@@ -1890,13 +1556,13 @@ var b = {
1890
1556
  attributeName: "stroke-dashoffset",
1891
1557
  from: "-30",
1892
1558
  to: "-82",
1893
- dur: Hr(t, 1.3),
1559
+ dur: wi(t, 1.3),
1894
1560
  repeatCount: "indefinite"
1895
1561
  }, null, 8, Fe)], 8, Pe),
1896
1562
  i("path", {
1897
1563
  d: $(t),
1898
1564
  fill: "none",
1899
- stroke: Z(t),
1565
+ stroke: Q(t),
1900
1566
  "stroke-width": "6",
1901
1567
  "stroke-linecap": "round",
1902
1568
  "stroke-dasharray": "4 80",
@@ -1906,30 +1572,30 @@ var b = {
1906
1572
  attributeName: "stroke-dashoffset",
1907
1573
  from: "0",
1908
1574
  to: "-84",
1909
- dur: Hr(t, .8),
1575
+ dur: wi(t, .8),
1910
1576
  repeatCount: "indefinite"
1911
1577
  }, null, 8, Le)], 8, Ie)
1912
1578
  ])) : 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", {
1579
+ (u(!0), r(e, null, f(U.value, (t) => (u(), r(e, { key: `particle-${t.id}` }, [Er.value ? (u(), r("g", Re, [i("circle", {
1914
1580
  r: "3",
1915
- fill: Z(t),
1581
+ fill: Q(t),
1916
1582
  opacity: "0.9",
1917
1583
  filter: "url(#glow-core)"
1918
1584
  }, [i("animateMotion", {
1919
1585
  path: $(t),
1920
- dur: Ur(t),
1586
+ dur: Ti(t),
1921
1587
  repeatCount: "indefinite"
1922
1588
  }, null, 8, Be)], 8, ze), i("circle", {
1923
1589
  r: "8",
1924
- fill: Z(t),
1590
+ fill: Q(t),
1925
1591
  opacity: "0.2",
1926
1592
  filter: "url(#glow-strong)"
1927
1593
  }, [i("animateMotion", {
1928
1594
  path: $(t),
1929
- dur: Ur(t),
1595
+ dur: Ti(t),
1930
1596
  repeatCount: "indefinite"
1931
1597
  }, 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", {
1598
+ (u(!0), r(e, null, f(Mi.value, (t) => (u(), r(e, { key: `text-${t.id}` }, [t.info.merged && t.info.representative ? (u(), r("g", {
1933
1599
  key: 0,
1934
1600
  transform: `translate(${t.center.x}, ${t.center.y}) rotate(${t.centerAngle})`
1935
1601
  }, [i("rect", {
@@ -1951,17 +1617,17 @@ var b = {
1951
1617
  "font-family": "'SF Mono', monospace",
1952
1618
  opacity: "1"
1953
1619
  }, 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", {
1620
+ Di(t.edge.fromText) ? (u(), r("g", {
1955
1621
  key: 0,
1956
- transform: Yr(t.edge.fromText, t.start, t.startAngle)
1957
- }, [er.value ? (u(), r("rect", {
1622
+ transform: ji(t.edge.fromText, t.start, t.startAngle)
1623
+ }, [xr.value ? (u(), r("rect", {
1958
1624
  key: 0,
1959
1625
  x: -t.fromBox.w / 2,
1960
1626
  y: -t.fromBox.h / 2,
1961
1627
  width: t.fromBox.w,
1962
1628
  height: t.fromBox.h,
1963
1629
  rx: "3",
1964
- fill: tr.value,
1630
+ fill: Sr.value,
1965
1631
  opacity: "0.92",
1966
1632
  stroke: w(t.edge, t.edge.fromText),
1967
1633
  "stroke-opacity": "0.35",
@@ -1975,18 +1641,18 @@ var b = {
1975
1641
  "font-family": "'SF Mono', monospace",
1976
1642
  "font-weight": "500",
1977
1643
  opacity: "0.9"
1978
- }, m(Wr(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1979
- Gr(t.edge.centerText) ? (u(), r("g", {
1644
+ }, m(Ei(t.edge.fromText)), 9, Ye)], 8, qe)) : n("", !0),
1645
+ Di(t.edge.centerText) ? (u(), r("g", {
1980
1646
  key: 1,
1981
- transform: Yr(t.edge.centerText, t.center, t.centerAngle)
1982
- }, [er.value ? (u(), r("rect", {
1647
+ transform: ji(t.edge.centerText, t.center, t.centerAngle)
1648
+ }, [xr.value ? (u(), r("rect", {
1983
1649
  key: 0,
1984
1650
  x: -t.centerBox.w / 2,
1985
1651
  y: -t.centerBox.h / 2,
1986
1652
  width: t.centerBox.w,
1987
1653
  height: t.centerBox.h,
1988
1654
  rx: "3",
1989
- fill: tr.value,
1655
+ fill: Sr.value,
1990
1656
  opacity: "0.92",
1991
1657
  stroke: w(t.edge, t.edge.centerText),
1992
1658
  "stroke-opacity": "0.35",
@@ -2000,18 +1666,18 @@ var b = {
2000
1666
  "font-family": "'SF Mono', monospace",
2001
1667
  "font-weight": "600",
2002
1668
  opacity: "1"
2003
- }, m(Wr(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
2004
- Gr(t.edge.toText) ? (u(), r("g", {
1669
+ }, m(Ei(t.edge.centerText)), 9, Qe)], 8, Xe)) : n("", !0),
1670
+ Di(t.edge.toText) ? (u(), r("g", {
2005
1671
  key: 2,
2006
- transform: Yr(t.edge.toText, t.end, t.endAngle)
2007
- }, [er.value ? (u(), r("rect", {
1672
+ transform: ji(t.edge.toText, t.end, t.endAngle)
1673
+ }, [xr.value ? (u(), r("rect", {
2008
1674
  key: 0,
2009
1675
  x: -t.toBox.w / 2,
2010
1676
  y: -t.toBox.h / 2,
2011
1677
  width: t.toBox.w,
2012
1678
  height: t.toBox.h,
2013
1679
  rx: "3",
2014
- fill: tr.value,
1680
+ fill: Sr.value,
2015
1681
  opacity: "0.92",
2016
1682
  stroke: w(t.edge, t.edge.toText),
2017
1683
  "stroke-opacity": "0.35",
@@ -2025,15 +1691,15 @@ var b = {
2025
1691
  "font-family": "'SF Mono', monospace",
2026
1692
  "font-weight": "500",
2027
1693
  opacity: "0.9"
2028
- }, m(Wr(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
1694
+ }, m(Ei(t.edge.toText)), 9, tt)], 8, $e)) : n("", !0)
2029
1695
  ]))], 64))), 128)),
2030
1696
  Y.value ? (u(), r("g", nt, [
2031
1697
  i("line", {
2032
1698
  x1: Y.value.ax,
2033
1699
  y1: Y.value.ay,
2034
- x2: Ir.value.x,
2035
- y2: Ir.value.y,
2036
- stroke: Fr.value,
1700
+ x2: mi.value.x,
1701
+ y2: mi.value.y,
1702
+ stroke: pi.value,
2037
1703
  "stroke-width": "2",
2038
1704
  "stroke-dasharray": "6 6",
2039
1705
  "stroke-linecap": "round",
@@ -2043,58 +1709,79 @@ var b = {
2043
1709
  cx: Y.value.px,
2044
1710
  cy: Y.value.py,
2045
1711
  r: "3.5",
2046
- fill: Fr.value,
1712
+ fill: pi.value,
2047
1713
  opacity: "0.9"
2048
1714
  }, null, 8, it),
2049
- Y.value.overId && Lr.value ? (u(), r("rect", {
1715
+ Y.value.overId && hi.value ? (u(), r("rect", {
2050
1716
  key: 0,
2051
- x: Lr.value.x,
2052
- y: Lr.value.y,
2053
- width: Lr.value.w,
2054
- height: Lr.value.h,
1717
+ x: hi.value.x,
1718
+ y: hi.value.y,
1719
+ width: hi.value.w,
1720
+ height: hi.value.h,
2055
1721
  rx: "6",
2056
1722
  fill: "none",
2057
- stroke: Fr.value,
1723
+ stroke: pi.value,
2058
1724
  "stroke-width": "1.5",
2059
1725
  "stroke-dasharray": "6 4",
2060
1726
  opacity: "0.9"
2061
1727
  }, null, 8, at)) : n("", !0)
2062
1728
  ])) : n("", !0),
2063
- (u(!0), r(e, null, f(T.value, (a) => (u(), r("g", {
1729
+ (u(!0), r(e, null, f(U.value, (e) => (u(), r("path", {
1730
+ key: `hit-${e.id}`,
1731
+ d: $(e),
1732
+ fill: "none",
1733
+ stroke: "transparent",
1734
+ "stroke-width": "14",
1735
+ style: {
1736
+ "pointer-events": "stroke",
1737
+ cursor: "pointer"
1738
+ },
1739
+ onClick: g((t) => Nn(e, t), ["stop"])
1740
+ }, null, 8, ot))), 128)),
1741
+ (u(!0), r(e, null, f(Yn.value, (a) => (u(), r("g", {
2064
1742
  key: a.id,
2065
1743
  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),
1744
+ class: o(["topology-node", D.value === a.id ? "dragging" : ""]),
1745
+ onMousedown: (e) => Mr(e, a.id),
1746
+ onClick: (e) => jn(a, e),
2069
1747
  style: s({
2070
1748
  cursor: v.editable && v.config.nodeDraggable !== !1 ? "grab" : "default",
2071
- color: I(a)
1749
+ color: F(a)
2072
1750
  })
2073
1751
  }, [
2074
- pn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1752
+ i("rect", {
1753
+ class: "node-hit-area",
1754
+ x: wn(a).x,
1755
+ y: wn(a).y,
1756
+ width: wn(a).width,
1757
+ height: wn(a).height,
1758
+ fill: "transparent",
1759
+ "pointer-events": "all"
1760
+ }, null, 8, ct),
1761
+ Dn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
2075
1762
  key: 0,
2076
1763
  x: L(a).x,
2077
1764
  y: L(a).y,
2078
1765
  width: L(a).width,
2079
1766
  height: L(a).height,
2080
1767
  rx: "6",
2081
- fill: pn(a),
1768
+ fill: Dn(a),
2082
1769
  opacity: "0.15"
2083
- }, null, 8, st)) : n("", !0),
2084
- R(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1770
+ }, null, 8, lt)) : n("", !0),
1771
+ En(a) && _.viewMode !== "3d" ? (u(), r("rect", {
2085
1772
  key: 1,
2086
- x: R(a).x,
2087
- y: R(a).y,
2088
- width: R(a).width,
2089
- height: R(a).height,
1773
+ x: En(a).x,
1774
+ y: En(a).y,
1775
+ width: En(a).width,
1776
+ height: En(a).height,
2090
1777
  rx: "6",
2091
1778
  fill: "none",
2092
- stroke: rr(a),
2093
- "stroke-width": ir(a),
2094
- "stroke-dasharray": ar(a),
1779
+ stroke: kr(a),
1780
+ "stroke-width": Ar(a),
1781
+ "stroke-dasharray": jr(a),
2095
1782
  opacity: "0.8"
2096
- }, null, 8, ct)) : n("", !0),
2097
- mn(a) && _.viewMode !== "3d" ? (u(), r("rect", {
1783
+ }, null, 8, ut)) : n("", !0),
1784
+ On(a) && _.viewMode !== "3d" ? (u(), r("rect", {
2098
1785
  key: 2,
2099
1786
  x: L(a).x,
2100
1787
  y: L(a).y,
@@ -2102,32 +1789,32 @@ var b = {
2102
1789
  height: L(a).height,
2103
1790
  rx: "6",
2104
1791
  fill: "none",
2105
- stroke: gn.value,
1792
+ stroke: An.value,
2106
1793
  "stroke-width": "2.5",
2107
1794
  transform: "scale(1.1)",
2108
1795
  style: { "pointer-events": "none" }
2109
- }, null, 8, lt)) : n("", !0),
2110
- an(a) ? (u(), r(e, { key: 3 }, [i("rect", {
1796
+ }, null, 8, dt)) : n("", !0),
1797
+ _n(a) ? (u(), r(e, { key: 3 }, [i("rect", {
2111
1798
  x: "-4",
2112
1799
  y: "-10",
2113
1800
  width: "8",
2114
1801
  height: "20",
2115
- fill: rn(a).color,
1802
+ fill: gn(a).color,
2116
1803
  opacity: "0.06"
2117
- }, null, 8, ut), i("text", {
1804
+ }, null, 8, ft), i("text", {
2118
1805
  y: "4",
2119
1806
  transform: `rotate(${a.rotation || 0} 0 4)`,
2120
1807
  "text-anchor": "middle",
2121
- fill: ae(a) || I(a) || rn(a).color,
2122
- "font-size": ie(a, 12),
1808
+ fill: Vt(a) || F(a) || gn(a).color,
1809
+ "font-size": Bt(a, 12),
2123
1810
  "font-family": "'SF Mono', 'Cascadia Code', 'Consolas', monospace",
2124
1811
  "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", {
1812
+ }, m(a.label), 9, pt)], 64)) : (u(), r(e, { key: 4 }, [
1813
+ i("g", { transform: bn(a) }, [a.state !== "none" && Or.value ? (u(), r("circle", {
2127
1814
  key: 0,
2128
1815
  r: "30",
2129
1816
  fill: "none",
2130
- stroke: rn(a).color,
1817
+ stroke: gn(a).color,
2131
1818
  "stroke-width": "2.5",
2132
1819
  opacity: "0"
2133
1820
  }, [...c[6] ||= [i("animate", {
@@ -2140,10 +1827,9 @@ var b = {
2140
1827
  values: "0.4;0.05;0.4",
2141
1828
  dur: "2s",
2142
1829
  repeatCount: "indefinite"
2143
- }, null, -1)]], 8, pt)),
2144
- i("g", mt, [p(t.$slots, "node-icon", {
1830
+ }, null, -1)]], 8, ht)) : n("", !0), i("g", gt, [p(t.$slots, "node-icon", {
2145
1831
  node: a,
2146
- color: I(a),
1832
+ color: F(a),
2147
1833
  viewMode: _.viewMode
2148
1834
  }, () => [i("rect", {
2149
1835
  x: "-18",
@@ -2151,84 +1837,76 @@ var b = {
2151
1837
  width: "36",
2152
1838
  height: "36",
2153
1839
  rx: "6",
2154
- fill: I(a),
1840
+ fill: F(a),
2155
1841
  opacity: "0.9"
2156
- }, null, 8, ht)])]),
2157
- i("g", gt, [i("circle", {
1842
+ }, null, 8, _t)])])], 8, mt),
1843
+ wr.value ? (u(), r("g", {
1844
+ key: 0,
1845
+ transform: xn(a)
1846
+ }, [i("circle", {
2158
1847
  r: "4",
2159
- fill: rn(a).color,
1848
+ fill: gn(a).color,
2160
1849
  stroke: "#0a0e1a",
2161
1850
  "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", {
1851
+ }, null, 8, yt)], 8, vt)) : n("", !0),
1852
+ i("text", {
1853
+ y: Cn(a),
1854
+ transform: `rotate(${a.rotation || 0} 0 ${Cn(a)})`,
1855
+ "text-anchor": "middle",
1856
+ fill: Vt(a),
1857
+ "font-size": Bt(a),
1858
+ "font-weight": Ht(a),
1859
+ "font-family": "'Segoe UI', system-ui, sans-serif",
1860
+ opacity: "0.9"
1861
+ }, [(u(!0), r(e, null, f(String(a.label ?? "").split("\n"), (e, t) => (u(), r("tspan", {
1862
+ key: t,
1863
+ x: "0",
1864
+ dy: t === 0 ? 0 : "1.2em"
1865
+ }, m(e), 9, xt))), 128))], 8, bt)
1866
+ ], 64)),
1867
+ Cr.value ? (u(), r("g", St, [(u(!0), r(e, null, f(Kr(a), (e) => (u(), r("circle", {
2178
1868
  key: e.side,
2179
1869
  cx: e.x,
2180
1870
  cy: e.y,
2181
1871
  r: "4.5",
2182
1872
  class: "node-handle",
2183
1873
  fill: "#0a0e1a",
2184
- stroke: I(a),
1874
+ stroke: F(a),
2185
1875
  "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,
1876
+ onPointerdown: g((t) => Yr(t, a.id, e), ["stop", "prevent"]),
1877
+ onPointermove: g(ii, ["stop"]),
1878
+ onPointerup: g(ai, ["stop"]),
1879
+ onPointercancel: g(ai, ["stop"]),
1880
+ onLostpointercapture: ai,
2191
1881
  onMousedown: c[0] ||= g(() => {}, ["stop", "prevent"]),
2192
1882
  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", {
1883
+ }, null, 40, Ct))), 128))])) : n("", !0)
1884
+ ], 46, st))), 128)),
1885
+ Gr.value ? (u(), r("g", wt, [(u(!0), r(e, null, f(zr(Gr.value), (e) => (u(), r("rect", {
2208
1886
  key: e.side,
2209
- x: J.value.x + e.x - 4.5,
2210
- y: J.value.y + e.y - 4.5,
1887
+ x: Gr.value.x + e.x - 4.5,
1888
+ y: Gr.value.y + e.y - 4.5,
2211
1889
  width: "9",
2212
1890
  height: "9",
2213
1891
  rx: "2",
2214
1892
  class: o(["node-resize-handle", `rt-${e.side}`]),
2215
- onMousedown: g((t) => fr(t, J.value, e.side), ["stop", "prevent"]),
1893
+ onMousedown: g((t) => Vr(t, Gr.value, e.side), ["stop", "prevent"]),
2216
1894
  onClick: c[2] ||= g(() => {}, ["stop"])
2217
- }, null, 42, wt))), 128))])) : n("", !0),
2218
- K.value ? (u(), r("rect", {
1895
+ }, null, 42, Tt))), 128))])) : n("", !0),
1896
+ G.value ? (u(), r("rect", {
2219
1897
  key: 4,
2220
1898
  class: "marquee-box",
2221
- x: zn.value.x,
2222
- y: zn.value.y,
2223
- width: zn.value.width,
2224
- height: zn.value.height,
1899
+ x: nr.value.x,
1900
+ y: nr.value.y,
1901
+ width: nr.value.width,
1902
+ height: nr.value.height,
2225
1903
  rx: "2",
2226
1904
  "vector-effect": "non-scaling-stroke"
2227
- }, null, 8, Tt)) : n("", !0)
2228
- ], 44, se));
1905
+ }, null, 8, Et)) : n("", !0)
1906
+ ], 44, ae));
2229
1907
  }
2230
- }, C = { install(e) {
2231
- e.component("Topology", Ft);
1908
+ }, zt = { install(e) {
1909
+ e.component("Topology", Rt);
2232
1910
  } };
2233
1911
  //#endregion
2234
- export { Ft as Topology, C as default, ae as initialEdges, ie as initialGroups, x as initialNodes, oe as nodeColors, b as nodeStates };
1912
+ export { Rt as Topology, zt as default, ie as nodeColors, b as nodeStates };