@skydesign/tf 0.2.2 → 0.3.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.
@@ -1,3537 +0,0 @@
1
- function za(t) {
2
- return JSON.stringify(JSON.stringify(t)).slice(1, -1);
3
- }
4
- function ge(t) {
5
- try {
6
- return JSON.parse(t);
7
- } catch {
8
- const e = JSON.parse(`"${t}"`);
9
- return JSON.parse(e);
10
- }
11
- }
12
- var Wn = { value: () => {
13
- } };
14
- function Le() {
15
- for (var t = 0, e = arguments.length, n = {}, r; t < e; ++t) {
16
- if (!(r = arguments[t] + "") || r in n || /[\s.]/.test(r)) throw new Error("illegal type: " + r);
17
- n[r] = [];
18
- }
19
- return new fe(n);
20
- }
21
- function fe(t) {
22
- this._ = t;
23
- }
24
- function Gn(t, e) {
25
- return t.trim().split(/^|\s+/).map(function(n) {
26
- var r = "", i = n.indexOf(".");
27
- if (i >= 0 && (r = n.slice(i + 1), n = n.slice(0, i)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
28
- return { type: n, name: r };
29
- });
30
- }
31
- fe.prototype = Le.prototype = {
32
- constructor: fe,
33
- on: function(t, e) {
34
- var n = this._, r = Gn(t + "", n), i, a = -1, o = r.length;
35
- if (arguments.length < 2) {
36
- for (; ++a < o; ) if ((i = (t = r[a]).type) && (i = Vn(n[i], t.name))) return i;
37
- return;
38
- }
39
- if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
40
- for (; ++a < o; )
41
- if (i = (t = r[a]).type) n[i] = Ue(n[i], t.name, e);
42
- else if (e == null) for (i in n) n[i] = Ue(n[i], t.name, null);
43
- return this;
44
- },
45
- copy: function() {
46
- var t = {}, e = this._;
47
- for (var n in e) t[n] = e[n].slice();
48
- return new fe(t);
49
- },
50
- call: function(t, e) {
51
- if ((i = arguments.length - 2) > 0) for (var n = new Array(i), r = 0, i, a; r < i; ++r) n[r] = arguments[r + 2];
52
- if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
53
- for (a = this._[t], r = 0, i = a.length; r < i; ++r) a[r].value.apply(e, n);
54
- },
55
- apply: function(t, e, n) {
56
- if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
57
- for (var r = this._[t], i = 0, a = r.length; i < a; ++i) r[i].value.apply(e, n);
58
- }
59
- };
60
- function Vn(t, e) {
61
- for (var n = 0, r = t.length, i; n < r; ++n)
62
- if ((i = t[n]).name === e)
63
- return i.value;
64
- }
65
- function Ue(t, e, n) {
66
- for (var r = 0, i = t.length; r < i; ++r)
67
- if (t[r].name === e) {
68
- t[r] = Wn, t = t.slice(0, r).concat(t.slice(r + 1));
69
- break;
70
- }
71
- return n != null && t.push({ name: e, value: n }), t;
72
- }
73
- var Ie = "http://www.w3.org/1999/xhtml";
74
- const Ze = {
75
- svg: "http://www.w3.org/2000/svg",
76
- xhtml: Ie,
77
- xlink: "http://www.w3.org/1999/xlink",
78
- xml: "http://www.w3.org/XML/1998/namespace",
79
- xmlns: "http://www.w3.org/2000/xmlns/"
80
- };
81
- function be(t) {
82
- var e = t += "", n = e.indexOf(":");
83
- return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), Ze.hasOwnProperty(e) ? { space: Ze[e], local: t } : t;
84
- }
85
- function qn(t) {
86
- return function() {
87
- var e = this.ownerDocument, n = this.namespaceURI;
88
- return n === Ie && e.documentElement.namespaceURI === Ie ? e.createElement(t) : e.createElementNS(n, t);
89
- };
90
- }
91
- function Un(t) {
92
- return function() {
93
- return this.ownerDocument.createElementNS(t.space, t.local);
94
- };
95
- }
96
- function mn(t) {
97
- var e = be(t);
98
- return (e.local ? Un : qn)(e);
99
- }
100
- function Zn() {
101
- }
102
- function Oe(t) {
103
- return t == null ? Zn : function() {
104
- return this.querySelector(t);
105
- };
106
- }
107
- function Kn(t) {
108
- typeof t != "function" && (t = Oe(t));
109
- for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
110
- for (var a = e[i], o = a.length, s = r[i] = new Array(o), c, l, u = 0; u < o; ++u)
111
- (c = a[u]) && (l = t.call(c, c.__data__, u, a)) && ("__data__" in c && (l.__data__ = c.__data__), s[u] = l);
112
- return new bt(r, this._parents);
113
- }
114
- function Qn(t) {
115
- return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
116
- }
117
- function Jn() {
118
- return [];
119
- }
120
- function yn(t) {
121
- return t == null ? Jn : function() {
122
- return this.querySelectorAll(t);
123
- };
124
- }
125
- function jn(t) {
126
- return function() {
127
- return Qn(t.apply(this, arguments));
128
- };
129
- }
130
- function tr(t) {
131
- typeof t == "function" ? t = jn(t) : t = yn(t);
132
- for (var e = this._groups, n = e.length, r = [], i = [], a = 0; a < n; ++a)
133
- for (var o = e[a], s = o.length, c, l = 0; l < s; ++l)
134
- (c = o[l]) && (r.push(t.call(c, c.__data__, l, o)), i.push(c));
135
- return new bt(r, i);
136
- }
137
- function xn(t) {
138
- return function() {
139
- return this.matches(t);
140
- };
141
- }
142
- function _n(t) {
143
- return function(e) {
144
- return e.matches(t);
145
- };
146
- }
147
- var er = Array.prototype.find;
148
- function nr(t) {
149
- return function() {
150
- return er.call(this.children, t);
151
- };
152
- }
153
- function rr() {
154
- return this.firstElementChild;
155
- }
156
- function ir(t) {
157
- return this.select(t == null ? rr : nr(typeof t == "function" ? t : _n(t)));
158
- }
159
- var or = Array.prototype.filter;
160
- function ar() {
161
- return Array.from(this.children);
162
- }
163
- function sr(t) {
164
- return function() {
165
- return or.call(this.children, t);
166
- };
167
- }
168
- function lr(t) {
169
- return this.selectAll(t == null ? ar : sr(typeof t == "function" ? t : _n(t)));
170
- }
171
- function cr(t) {
172
- typeof t != "function" && (t = xn(t));
173
- for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
174
- for (var a = e[i], o = a.length, s = r[i] = [], c, l = 0; l < o; ++l)
175
- (c = a[l]) && t.call(c, c.__data__, l, a) && s.push(c);
176
- return new bt(r, this._parents);
177
- }
178
- function vn(t) {
179
- return new Array(t.length);
180
- }
181
- function ur() {
182
- return new bt(this._enter || this._groups.map(vn), this._parents);
183
- }
184
- function me(t, e) {
185
- this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
186
- }
187
- me.prototype = {
188
- constructor: me,
189
- appendChild: function(t) {
190
- return this._parent.insertBefore(t, this._next);
191
- },
192
- insertBefore: function(t, e) {
193
- return this._parent.insertBefore(t, e);
194
- },
195
- querySelector: function(t) {
196
- return this._parent.querySelector(t);
197
- },
198
- querySelectorAll: function(t) {
199
- return this._parent.querySelectorAll(t);
200
- }
201
- };
202
- function fr(t) {
203
- return function() {
204
- return t;
205
- };
206
- }
207
- function hr(t, e, n, r, i, a) {
208
- for (var o = 0, s, c = e.length, l = a.length; o < l; ++o)
209
- (s = e[o]) ? (s.__data__ = a[o], r[o] = s) : n[o] = new me(t, a[o]);
210
- for (; o < c; ++o)
211
- (s = e[o]) && (i[o] = s);
212
- }
213
- function dr(t, e, n, r, i, a, o) {
214
- var s, c, l = /* @__PURE__ */ new Map(), u = e.length, h = a.length, d = new Array(u), m;
215
- for (s = 0; s < u; ++s)
216
- (c = e[s]) && (d[s] = m = o.call(c, c.__data__, s, e) + "", l.has(m) ? i[s] = c : l.set(m, c));
217
- for (s = 0; s < h; ++s)
218
- m = o.call(t, a[s], s, a) + "", (c = l.get(m)) ? (r[s] = c, c.__data__ = a[s], l.delete(m)) : n[s] = new me(t, a[s]);
219
- for (s = 0; s < u; ++s)
220
- (c = e[s]) && l.get(d[s]) === c && (i[s] = c);
221
- }
222
- function pr(t) {
223
- return t.__data__;
224
- }
225
- function gr(t, e) {
226
- if (!arguments.length) return Array.from(this, pr);
227
- var n = e ? dr : hr, r = this._parents, i = this._groups;
228
- typeof t != "function" && (t = fr(t));
229
- for (var a = i.length, o = new Array(a), s = new Array(a), c = new Array(a), l = 0; l < a; ++l) {
230
- var u = r[l], h = i[l], d = h.length, m = mr(t.call(u, u && u.__data__, l, r)), A = m.length, _ = s[l] = new Array(A), S = o[l] = new Array(A), w = c[l] = new Array(d);
231
- n(u, h, _, S, w, m, e);
232
- for (var ot = 0, lt = 0, B, E; ot < A; ++ot)
233
- if (B = _[ot]) {
234
- for (ot >= lt && (lt = ot + 1); !(E = S[lt]) && ++lt < A; ) ;
235
- B._next = E || null;
236
- }
237
- }
238
- return o = new bt(o, r), o._enter = s, o._exit = c, o;
239
- }
240
- function mr(t) {
241
- return typeof t == "object" && "length" in t ? t : Array.from(t);
242
- }
243
- function yr() {
244
- return new bt(this._exit || this._groups.map(vn), this._parents);
245
- }
246
- function xr(t, e, n) {
247
- var r = this.enter(), i = this, a = this.exit();
248
- return typeof t == "function" ? (r = t(r), r && (r = r.selection())) : r = r.append(t + ""), e != null && (i = e(i), i && (i = i.selection())), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i;
249
- }
250
- function _r(t) {
251
- for (var e = t.selection ? t.selection() : t, n = this._groups, r = e._groups, i = n.length, a = r.length, o = Math.min(i, a), s = new Array(i), c = 0; c < o; ++c)
252
- for (var l = n[c], u = r[c], h = l.length, d = s[c] = new Array(h), m, A = 0; A < h; ++A)
253
- (m = l[A] || u[A]) && (d[A] = m);
254
- for (; c < i; ++c)
255
- s[c] = n[c];
256
- return new bt(s, this._parents);
257
- }
258
- function vr() {
259
- for (var t = this._groups, e = -1, n = t.length; ++e < n; )
260
- for (var r = t[e], i = r.length - 1, a = r[i], o; --i >= 0; )
261
- (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o);
262
- return this;
263
- }
264
- function wr(t) {
265
- t || (t = br);
266
- function e(h, d) {
267
- return h && d ? t(h.__data__, d.__data__) : !h - !d;
268
- }
269
- for (var n = this._groups, r = n.length, i = new Array(r), a = 0; a < r; ++a) {
270
- for (var o = n[a], s = o.length, c = i[a] = new Array(s), l, u = 0; u < s; ++u)
271
- (l = o[u]) && (c[u] = l);
272
- c.sort(e);
273
- }
274
- return new bt(i, this._parents).order();
275
- }
276
- function br(t, e) {
277
- return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
278
- }
279
- function Er() {
280
- var t = arguments[0];
281
- return arguments[0] = this, t.apply(null, arguments), this;
282
- }
283
- function $r() {
284
- return Array.from(this);
285
- }
286
- function Nr() {
287
- for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
288
- for (var r = t[e], i = 0, a = r.length; i < a; ++i) {
289
- var o = r[i];
290
- if (o) return o;
291
- }
292
- return null;
293
- }
294
- function Cr() {
295
- let t = 0;
296
- for (const e of this) ++t;
297
- return t;
298
- }
299
- function kr() {
300
- return !this.node();
301
- }
302
- function Ar(t) {
303
- for (var e = this._groups, n = 0, r = e.length; n < r; ++n)
304
- for (var i = e[n], a = 0, o = i.length, s; a < o; ++a)
305
- (s = i[a]) && t.call(s, s.__data__, a, i);
306
- return this;
307
- }
308
- function Mr(t) {
309
- return function() {
310
- this.removeAttribute(t);
311
- };
312
- }
313
- function Sr(t) {
314
- return function() {
315
- this.removeAttributeNS(t.space, t.local);
316
- };
317
- }
318
- function Ir(t, e) {
319
- return function() {
320
- this.setAttribute(t, e);
321
- };
322
- }
323
- function Pr(t, e) {
324
- return function() {
325
- this.setAttributeNS(t.space, t.local, e);
326
- };
327
- }
328
- function Yr(t, e) {
329
- return function() {
330
- var n = e.apply(this, arguments);
331
- n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
332
- };
333
- }
334
- function Tr(t, e) {
335
- return function() {
336
- var n = e.apply(this, arguments);
337
- n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
338
- };
339
- }
340
- function zr(t, e) {
341
- var n = be(t);
342
- if (arguments.length < 2) {
343
- var r = this.node();
344
- return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n);
345
- }
346
- return this.each((e == null ? n.local ? Sr : Mr : typeof e == "function" ? n.local ? Tr : Yr : n.local ? Pr : Ir)(n, e));
347
- }
348
- function wn(t) {
349
- return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
350
- }
351
- function Dr(t) {
352
- return function() {
353
- this.style.removeProperty(t);
354
- };
355
- }
356
- function Rr(t, e, n) {
357
- return function() {
358
- this.style.setProperty(t, e, n);
359
- };
360
- }
361
- function Br(t, e, n) {
362
- return function() {
363
- var r = e.apply(this, arguments);
364
- r == null ? this.style.removeProperty(t) : this.style.setProperty(t, r, n);
365
- };
366
- }
367
- function Fr(t, e, n) {
368
- return arguments.length > 1 ? this.each((e == null ? Dr : typeof e == "function" ? Br : Rr)(t, e, n ?? "")) : Vt(this.node(), t);
369
- }
370
- function Vt(t, e) {
371
- return t.style.getPropertyValue(e) || wn(t).getComputedStyle(t, null).getPropertyValue(e);
372
- }
373
- function Lr(t) {
374
- return function() {
375
- delete this[t];
376
- };
377
- }
378
- function Or(t, e) {
379
- return function() {
380
- this[t] = e;
381
- };
382
- }
383
- function Hr(t, e) {
384
- return function() {
385
- var n = e.apply(this, arguments);
386
- n == null ? delete this[t] : this[t] = n;
387
- };
388
- }
389
- function Xr(t, e) {
390
- return arguments.length > 1 ? this.each((e == null ? Lr : typeof e == "function" ? Hr : Or)(t, e)) : this.node()[t];
391
- }
392
- function bn(t) {
393
- return t.trim().split(/^|\s+/);
394
- }
395
- function He(t) {
396
- return t.classList || new En(t);
397
- }
398
- function En(t) {
399
- this._node = t, this._names = bn(t.getAttribute("class") || "");
400
- }
401
- En.prototype = {
402
- add: function(t) {
403
- var e = this._names.indexOf(t);
404
- e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
405
- },
406
- remove: function(t) {
407
- var e = this._names.indexOf(t);
408
- e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
409
- },
410
- contains: function(t) {
411
- return this._names.indexOf(t) >= 0;
412
- }
413
- };
414
- function $n(t, e) {
415
- for (var n = He(t), r = -1, i = e.length; ++r < i; ) n.add(e[r]);
416
- }
417
- function Nn(t, e) {
418
- for (var n = He(t), r = -1, i = e.length; ++r < i; ) n.remove(e[r]);
419
- }
420
- function Wr(t) {
421
- return function() {
422
- $n(this, t);
423
- };
424
- }
425
- function Gr(t) {
426
- return function() {
427
- Nn(this, t);
428
- };
429
- }
430
- function Vr(t, e) {
431
- return function() {
432
- (e.apply(this, arguments) ? $n : Nn)(this, t);
433
- };
434
- }
435
- function qr(t, e) {
436
- var n = bn(t + "");
437
- if (arguments.length < 2) {
438
- for (var r = He(this.node()), i = -1, a = n.length; ++i < a; ) if (!r.contains(n[i])) return !1;
439
- return !0;
440
- }
441
- return this.each((typeof e == "function" ? Vr : e ? Wr : Gr)(n, e));
442
- }
443
- function Ur() {
444
- this.textContent = "";
445
- }
446
- function Zr(t) {
447
- return function() {
448
- this.textContent = t;
449
- };
450
- }
451
- function Kr(t) {
452
- return function() {
453
- var e = t.apply(this, arguments);
454
- this.textContent = e ?? "";
455
- };
456
- }
457
- function Qr(t) {
458
- return arguments.length ? this.each(t == null ? Ur : (typeof t == "function" ? Kr : Zr)(t)) : this.node().textContent;
459
- }
460
- function Jr() {
461
- this.innerHTML = "";
462
- }
463
- function jr(t) {
464
- return function() {
465
- this.innerHTML = t;
466
- };
467
- }
468
- function ti(t) {
469
- return function() {
470
- var e = t.apply(this, arguments);
471
- this.innerHTML = e ?? "";
472
- };
473
- }
474
- function ei(t) {
475
- return arguments.length ? this.each(t == null ? Jr : (typeof t == "function" ? ti : jr)(t)) : this.node().innerHTML;
476
- }
477
- function ni() {
478
- this.nextSibling && this.parentNode.appendChild(this);
479
- }
480
- function ri() {
481
- return this.each(ni);
482
- }
483
- function ii() {
484
- this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
485
- }
486
- function oi() {
487
- return this.each(ii);
488
- }
489
- function ai(t) {
490
- var e = typeof t == "function" ? t : mn(t);
491
- return this.select(function() {
492
- return this.appendChild(e.apply(this, arguments));
493
- });
494
- }
495
- function si() {
496
- return null;
497
- }
498
- function li(t, e) {
499
- var n = typeof t == "function" ? t : mn(t), r = e == null ? si : typeof e == "function" ? e : Oe(e);
500
- return this.select(function() {
501
- return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null);
502
- });
503
- }
504
- function ci() {
505
- var t = this.parentNode;
506
- t && t.removeChild(this);
507
- }
508
- function ui() {
509
- return this.each(ci);
510
- }
511
- function fi() {
512
- var t = this.cloneNode(!1), e = this.parentNode;
513
- return e ? e.insertBefore(t, this.nextSibling) : t;
514
- }
515
- function hi() {
516
- var t = this.cloneNode(!0), e = this.parentNode;
517
- return e ? e.insertBefore(t, this.nextSibling) : t;
518
- }
519
- function di(t) {
520
- return this.select(t ? hi : fi);
521
- }
522
- function pi(t) {
523
- return arguments.length ? this.property("__data__", t) : this.node().__data__;
524
- }
525
- function gi(t) {
526
- return function(e) {
527
- t.call(this, e, this.__data__);
528
- };
529
- }
530
- function mi(t) {
531
- return t.trim().split(/^|\s+/).map(function(e) {
532
- var n = "", r = e.indexOf(".");
533
- return r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), { type: e, name: n };
534
- });
535
- }
536
- function yi(t) {
537
- return function() {
538
- var e = this.__on;
539
- if (e) {
540
- for (var n = 0, r = -1, i = e.length, a; n < i; ++n)
541
- a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++r] = a;
542
- ++r ? e.length = r : delete this.__on;
543
- }
544
- };
545
- }
546
- function xi(t, e, n) {
547
- return function() {
548
- var r = this.__on, i, a = gi(e);
549
- if (r) {
550
- for (var o = 0, s = r.length; o < s; ++o)
551
- if ((i = r[o]).type === t.type && i.name === t.name) {
552
- this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = e;
553
- return;
554
- }
555
- }
556
- this.addEventListener(t.type, a, n), i = { type: t.type, name: t.name, value: e, listener: a, options: n }, r ? r.push(i) : this.__on = [i];
557
- };
558
- }
559
- function _i(t, e, n) {
560
- var r = mi(t + ""), i, a = r.length, o;
561
- if (arguments.length < 2) {
562
- var s = this.node().__on;
563
- if (s) {
564
- for (var c = 0, l = s.length, u; c < l; ++c)
565
- for (i = 0, u = s[c]; i < a; ++i)
566
- if ((o = r[i]).type === u.type && o.name === u.name)
567
- return u.value;
568
- }
569
- return;
570
- }
571
- for (s = e ? xi : yi, i = 0; i < a; ++i) this.each(s(r[i], e, n));
572
- return this;
573
- }
574
- function Cn(t, e, n) {
575
- var r = wn(t), i = r.CustomEvent;
576
- typeof i == "function" ? i = new i(e, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(e, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(e, !1, !1)), t.dispatchEvent(i);
577
- }
578
- function vi(t, e) {
579
- return function() {
580
- return Cn(this, t, e);
581
- };
582
- }
583
- function wi(t, e) {
584
- return function() {
585
- return Cn(this, t, e.apply(this, arguments));
586
- };
587
- }
588
- function bi(t, e) {
589
- return this.each((typeof e == "function" ? wi : vi)(t, e));
590
- }
591
- function* Ei() {
592
- for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
593
- for (var r = t[e], i = 0, a = r.length, o; i < a; ++i)
594
- (o = r[i]) && (yield o);
595
- }
596
- var kn = [null];
597
- function bt(t, e) {
598
- this._groups = t, this._parents = e;
599
- }
600
- function ne() {
601
- return new bt([[document.documentElement]], kn);
602
- }
603
- function $i() {
604
- return this;
605
- }
606
- bt.prototype = ne.prototype = {
607
- constructor: bt,
608
- select: Kn,
609
- selectAll: tr,
610
- selectChild: ir,
611
- selectChildren: lr,
612
- filter: cr,
613
- data: gr,
614
- enter: ur,
615
- exit: yr,
616
- join: xr,
617
- merge: _r,
618
- selection: $i,
619
- order: vr,
620
- sort: wr,
621
- call: Er,
622
- nodes: $r,
623
- node: Nr,
624
- size: Cr,
625
- empty: kr,
626
- each: Ar,
627
- attr: zr,
628
- style: Fr,
629
- property: Xr,
630
- classed: qr,
631
- text: Qr,
632
- html: ei,
633
- raise: ri,
634
- lower: oi,
635
- append: ai,
636
- insert: li,
637
- remove: ui,
638
- clone: di,
639
- datum: pi,
640
- on: _i,
641
- dispatch: bi,
642
- [Symbol.iterator]: Ei
643
- };
644
- function V(t) {
645
- return typeof t == "string" ? new bt([[document.querySelector(t)]], [document.documentElement]) : new bt([[t]], kn);
646
- }
647
- function Ni(t) {
648
- let e;
649
- for (; e = t.sourceEvent; ) t = e;
650
- return t;
651
- }
652
- function Rt(t, e) {
653
- if (t = Ni(t), e === void 0 && (e = t.currentTarget), e) {
654
- var n = e.ownerSVGElement || e;
655
- if (n.createSVGPoint) {
656
- var r = n.createSVGPoint();
657
- return r.x = t.clientX, r.y = t.clientY, r = r.matrixTransform(e.getScreenCTM().inverse()), [r.x, r.y];
658
- }
659
- if (e.getBoundingClientRect) {
660
- var i = e.getBoundingClientRect();
661
- return [t.clientX - i.left - e.clientLeft, t.clientY - i.top - e.clientTop];
662
- }
663
- }
664
- return [t.pageX, t.pageY];
665
- }
666
- const Pe = { capture: !0, passive: !1 };
667
- function Ye(t) {
668
- t.preventDefault(), t.stopImmediatePropagation();
669
- }
670
- function Ci(t) {
671
- var e = t.document.documentElement, n = V(t).on("dragstart.drag", Ye, Pe);
672
- "onselectstart" in e ? n.on("selectstart.drag", Ye, Pe) : (e.__noselect = e.style.MozUserSelect, e.style.MozUserSelect = "none");
673
- }
674
- function ki(t, e) {
675
- var n = t.document.documentElement, r = V(t).on("dragstart.drag", null);
676
- e && (r.on("click.drag", Ye, Pe), setTimeout(function() {
677
- r.on("click.drag", null);
678
- }, 0)), "onselectstart" in n ? r.on("selectstart.drag", null) : (n.style.MozUserSelect = n.__noselect, delete n.__noselect);
679
- }
680
- function Xe(t, e, n) {
681
- t.prototype = e.prototype = n, n.constructor = t;
682
- }
683
- function An(t, e) {
684
- var n = Object.create(t.prototype);
685
- for (var r in e) n[r] = e[r];
686
- return n;
687
- }
688
- function re() {
689
- }
690
- var Jt = 0.7, ye = 1 / Jt, Gt = "\\s*([+-]?\\d+)\\s*", jt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", Mt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Ai = /^#([0-9a-f]{3,8})$/, Mi = new RegExp(`^rgb\\(${Gt},${Gt},${Gt}\\)$`), Si = new RegExp(`^rgb\\(${Mt},${Mt},${Mt}\\)$`), Ii = new RegExp(`^rgba\\(${Gt},${Gt},${Gt},${jt}\\)$`), Pi = new RegExp(`^rgba\\(${Mt},${Mt},${Mt},${jt}\\)$`), Yi = new RegExp(`^hsl\\(${jt},${Mt},${Mt}\\)$`), Ti = new RegExp(`^hsla\\(${jt},${Mt},${Mt},${jt}\\)$`), Ke = {
691
- aliceblue: 15792383,
692
- antiquewhite: 16444375,
693
- aqua: 65535,
694
- aquamarine: 8388564,
695
- azure: 15794175,
696
- beige: 16119260,
697
- bisque: 16770244,
698
- black: 0,
699
- blanchedalmond: 16772045,
700
- blue: 255,
701
- blueviolet: 9055202,
702
- brown: 10824234,
703
- burlywood: 14596231,
704
- cadetblue: 6266528,
705
- chartreuse: 8388352,
706
- chocolate: 13789470,
707
- coral: 16744272,
708
- cornflowerblue: 6591981,
709
- cornsilk: 16775388,
710
- crimson: 14423100,
711
- cyan: 65535,
712
- darkblue: 139,
713
- darkcyan: 35723,
714
- darkgoldenrod: 12092939,
715
- darkgray: 11119017,
716
- darkgreen: 25600,
717
- darkgrey: 11119017,
718
- darkkhaki: 12433259,
719
- darkmagenta: 9109643,
720
- darkolivegreen: 5597999,
721
- darkorange: 16747520,
722
- darkorchid: 10040012,
723
- darkred: 9109504,
724
- darksalmon: 15308410,
725
- darkseagreen: 9419919,
726
- darkslateblue: 4734347,
727
- darkslategray: 3100495,
728
- darkslategrey: 3100495,
729
- darkturquoise: 52945,
730
- darkviolet: 9699539,
731
- deeppink: 16716947,
732
- deepskyblue: 49151,
733
- dimgray: 6908265,
734
- dimgrey: 6908265,
735
- dodgerblue: 2003199,
736
- firebrick: 11674146,
737
- floralwhite: 16775920,
738
- forestgreen: 2263842,
739
- fuchsia: 16711935,
740
- gainsboro: 14474460,
741
- ghostwhite: 16316671,
742
- gold: 16766720,
743
- goldenrod: 14329120,
744
- gray: 8421504,
745
- green: 32768,
746
- greenyellow: 11403055,
747
- grey: 8421504,
748
- honeydew: 15794160,
749
- hotpink: 16738740,
750
- indianred: 13458524,
751
- indigo: 4915330,
752
- ivory: 16777200,
753
- khaki: 15787660,
754
- lavender: 15132410,
755
- lavenderblush: 16773365,
756
- lawngreen: 8190976,
757
- lemonchiffon: 16775885,
758
- lightblue: 11393254,
759
- lightcoral: 15761536,
760
- lightcyan: 14745599,
761
- lightgoldenrodyellow: 16448210,
762
- lightgray: 13882323,
763
- lightgreen: 9498256,
764
- lightgrey: 13882323,
765
- lightpink: 16758465,
766
- lightsalmon: 16752762,
767
- lightseagreen: 2142890,
768
- lightskyblue: 8900346,
769
- lightslategray: 7833753,
770
- lightslategrey: 7833753,
771
- lightsteelblue: 11584734,
772
- lightyellow: 16777184,
773
- lime: 65280,
774
- limegreen: 3329330,
775
- linen: 16445670,
776
- magenta: 16711935,
777
- maroon: 8388608,
778
- mediumaquamarine: 6737322,
779
- mediumblue: 205,
780
- mediumorchid: 12211667,
781
- mediumpurple: 9662683,
782
- mediumseagreen: 3978097,
783
- mediumslateblue: 8087790,
784
- mediumspringgreen: 64154,
785
- mediumturquoise: 4772300,
786
- mediumvioletred: 13047173,
787
- midnightblue: 1644912,
788
- mintcream: 16121850,
789
- mistyrose: 16770273,
790
- moccasin: 16770229,
791
- navajowhite: 16768685,
792
- navy: 128,
793
- oldlace: 16643558,
794
- olive: 8421376,
795
- olivedrab: 7048739,
796
- orange: 16753920,
797
- orangered: 16729344,
798
- orchid: 14315734,
799
- palegoldenrod: 15657130,
800
- palegreen: 10025880,
801
- paleturquoise: 11529966,
802
- palevioletred: 14381203,
803
- papayawhip: 16773077,
804
- peachpuff: 16767673,
805
- peru: 13468991,
806
- pink: 16761035,
807
- plum: 14524637,
808
- powderblue: 11591910,
809
- purple: 8388736,
810
- rebeccapurple: 6697881,
811
- red: 16711680,
812
- rosybrown: 12357519,
813
- royalblue: 4286945,
814
- saddlebrown: 9127187,
815
- salmon: 16416882,
816
- sandybrown: 16032864,
817
- seagreen: 3050327,
818
- seashell: 16774638,
819
- sienna: 10506797,
820
- silver: 12632256,
821
- skyblue: 8900331,
822
- slateblue: 6970061,
823
- slategray: 7372944,
824
- slategrey: 7372944,
825
- snow: 16775930,
826
- springgreen: 65407,
827
- steelblue: 4620980,
828
- tan: 13808780,
829
- teal: 32896,
830
- thistle: 14204888,
831
- tomato: 16737095,
832
- turquoise: 4251856,
833
- violet: 15631086,
834
- wheat: 16113331,
835
- white: 16777215,
836
- whitesmoke: 16119285,
837
- yellow: 16776960,
838
- yellowgreen: 10145074
839
- };
840
- Xe(re, te, {
841
- copy(t) {
842
- return Object.assign(new this.constructor(), this, t);
843
- },
844
- displayable() {
845
- return this.rgb().displayable();
846
- },
847
- hex: Qe,
848
- // Deprecated! Use color.formatHex.
849
- formatHex: Qe,
850
- formatHex8: zi,
851
- formatHsl: Di,
852
- formatRgb: Je,
853
- toString: Je
854
- });
855
- function Qe() {
856
- return this.rgb().formatHex();
857
- }
858
- function zi() {
859
- return this.rgb().formatHex8();
860
- }
861
- function Di() {
862
- return Mn(this).formatHsl();
863
- }
864
- function Je() {
865
- return this.rgb().formatRgb();
866
- }
867
- function te(t) {
868
- var e, n;
869
- return t = (t + "").trim().toLowerCase(), (e = Ai.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? je(e) : n === 3 ? new _t(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? ae(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? ae(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = Mi.exec(t)) ? new _t(e[1], e[2], e[3], 1) : (e = Si.exec(t)) ? new _t(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = Ii.exec(t)) ? ae(e[1], e[2], e[3], e[4]) : (e = Pi.exec(t)) ? ae(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = Yi.exec(t)) ? nn(e[1], e[2] / 100, e[3] / 100, 1) : (e = Ti.exec(t)) ? nn(e[1], e[2] / 100, e[3] / 100, e[4]) : Ke.hasOwnProperty(t) ? je(Ke[t]) : t === "transparent" ? new _t(NaN, NaN, NaN, 0) : null;
870
- }
871
- function je(t) {
872
- return new _t(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
873
- }
874
- function ae(t, e, n, r) {
875
- return r <= 0 && (t = e = n = NaN), new _t(t, e, n, r);
876
- }
877
- function Ri(t) {
878
- return t instanceof re || (t = te(t)), t ? (t = t.rgb(), new _t(t.r, t.g, t.b, t.opacity)) : new _t();
879
- }
880
- function Te(t, e, n, r) {
881
- return arguments.length === 1 ? Ri(t) : new _t(t, e, n, r ?? 1);
882
- }
883
- function _t(t, e, n, r) {
884
- this.r = +t, this.g = +e, this.b = +n, this.opacity = +r;
885
- }
886
- Xe(_t, Te, An(re, {
887
- brighter(t) {
888
- return t = t == null ? ye : Math.pow(ye, t), new _t(this.r * t, this.g * t, this.b * t, this.opacity);
889
- },
890
- darker(t) {
891
- return t = t == null ? Jt : Math.pow(Jt, t), new _t(this.r * t, this.g * t, this.b * t, this.opacity);
892
- },
893
- rgb() {
894
- return this;
895
- },
896
- clamp() {
897
- return new _t(Lt(this.r), Lt(this.g), Lt(this.b), xe(this.opacity));
898
- },
899
- displayable() {
900
- return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
901
- },
902
- hex: tn,
903
- // Deprecated! Use color.formatHex.
904
- formatHex: tn,
905
- formatHex8: Bi,
906
- formatRgb: en,
907
- toString: en
908
- }));
909
- function tn() {
910
- return `#${Ft(this.r)}${Ft(this.g)}${Ft(this.b)}`;
911
- }
912
- function Bi() {
913
- return `#${Ft(this.r)}${Ft(this.g)}${Ft(this.b)}${Ft((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
914
- }
915
- function en() {
916
- const t = xe(this.opacity);
917
- return `${t === 1 ? "rgb(" : "rgba("}${Lt(this.r)}, ${Lt(this.g)}, ${Lt(this.b)}${t === 1 ? ")" : `, ${t})`}`;
918
- }
919
- function xe(t) {
920
- return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
921
- }
922
- function Lt(t) {
923
- return Math.max(0, Math.min(255, Math.round(t) || 0));
924
- }
925
- function Ft(t) {
926
- return t = Lt(t), (t < 16 ? "0" : "") + t.toString(16);
927
- }
928
- function nn(t, e, n, r) {
929
- return r <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new kt(t, e, n, r);
930
- }
931
- function Mn(t) {
932
- if (t instanceof kt) return new kt(t.h, t.s, t.l, t.opacity);
933
- if (t instanceof re || (t = te(t)), !t) return new kt();
934
- if (t instanceof kt) return t;
935
- t = t.rgb();
936
- var e = t.r / 255, n = t.g / 255, r = t.b / 255, i = Math.min(e, n, r), a = Math.max(e, n, r), o = NaN, s = a - i, c = (a + i) / 2;
937
- return s ? (e === a ? o = (n - r) / s + (n < r) * 6 : n === a ? o = (r - e) / s + 2 : o = (e - n) / s + 4, s /= c < 0.5 ? a + i : 2 - a - i, o *= 60) : s = c > 0 && c < 1 ? 0 : o, new kt(o, s, c, t.opacity);
938
- }
939
- function Fi(t, e, n, r) {
940
- return arguments.length === 1 ? Mn(t) : new kt(t, e, n, r ?? 1);
941
- }
942
- function kt(t, e, n, r) {
943
- this.h = +t, this.s = +e, this.l = +n, this.opacity = +r;
944
- }
945
- Xe(kt, Fi, An(re, {
946
- brighter(t) {
947
- return t = t == null ? ye : Math.pow(ye, t), new kt(this.h, this.s, this.l * t, this.opacity);
948
- },
949
- darker(t) {
950
- return t = t == null ? Jt : Math.pow(Jt, t), new kt(this.h, this.s, this.l * t, this.opacity);
951
- },
952
- rgb() {
953
- var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, r = n + (n < 0.5 ? n : 1 - n) * e, i = 2 * n - r;
954
- return new _t(
955
- Ce(t >= 240 ? t - 240 : t + 120, i, r),
956
- Ce(t, i, r),
957
- Ce(t < 120 ? t + 240 : t - 120, i, r),
958
- this.opacity
959
- );
960
- },
961
- clamp() {
962
- return new kt(rn(this.h), se(this.s), se(this.l), xe(this.opacity));
963
- },
964
- displayable() {
965
- return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
966
- },
967
- formatHsl() {
968
- const t = xe(this.opacity);
969
- return `${t === 1 ? "hsl(" : "hsla("}${rn(this.h)}, ${se(this.s) * 100}%, ${se(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
970
- }
971
- }));
972
- function rn(t) {
973
- return t = (t || 0) % 360, t < 0 ? t + 360 : t;
974
- }
975
- function se(t) {
976
- return Math.max(0, Math.min(1, t || 0));
977
- }
978
- function Ce(t, e, n) {
979
- return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
980
- }
981
- const Sn = (t) => () => t;
982
- function Li(t, e) {
983
- return function(n) {
984
- return t + n * e;
985
- };
986
- }
987
- function Oi(t, e, n) {
988
- return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(r) {
989
- return Math.pow(t + r * e, n);
990
- };
991
- }
992
- function Hi(t) {
993
- return (t = +t) == 1 ? In : function(e, n) {
994
- return n - e ? Oi(e, n, t) : Sn(isNaN(e) ? n : e);
995
- };
996
- }
997
- function In(t, e) {
998
- var n = e - t;
999
- return n ? Li(t, n) : Sn(isNaN(t) ? e : t);
1000
- }
1001
- const on = (function t(e) {
1002
- var n = Hi(e);
1003
- function r(i, a) {
1004
- var o = n((i = Te(i)).r, (a = Te(a)).r), s = n(i.g, a.g), c = n(i.b, a.b), l = In(i.opacity, a.opacity);
1005
- return function(u) {
1006
- return i.r = o(u), i.g = s(u), i.b = c(u), i.opacity = l(u), i + "";
1007
- };
1008
- }
1009
- return r.gamma = t, r;
1010
- })(1);
1011
- function zt(t, e) {
1012
- return t = +t, e = +e, function(n) {
1013
- return t * (1 - n) + e * n;
1014
- };
1015
- }
1016
- var ze = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, ke = new RegExp(ze.source, "g");
1017
- function Xi(t) {
1018
- return function() {
1019
- return t;
1020
- };
1021
- }
1022
- function Wi(t) {
1023
- return function(e) {
1024
- return t(e) + "";
1025
- };
1026
- }
1027
- function Gi(t, e) {
1028
- var n = ze.lastIndex = ke.lastIndex = 0, r, i, a, o = -1, s = [], c = [];
1029
- for (t = t + "", e = e + ""; (r = ze.exec(t)) && (i = ke.exec(e)); )
1030
- (a = i.index) > n && (a = e.slice(n, a), s[o] ? s[o] += a : s[++o] = a), (r = r[0]) === (i = i[0]) ? s[o] ? s[o] += i : s[++o] = i : (s[++o] = null, c.push({ i: o, x: zt(r, i) })), n = ke.lastIndex;
1031
- return n < e.length && (a = e.slice(n), s[o] ? s[o] += a : s[++o] = a), s.length < 2 ? c[0] ? Wi(c[0].x) : Xi(e) : (e = c.length, function(l) {
1032
- for (var u = 0, h; u < e; ++u) s[(h = c[u]).i] = h.x(l);
1033
- return s.join("");
1034
- });
1035
- }
1036
- var an = 180 / Math.PI, De = {
1037
- translateX: 0,
1038
- translateY: 0,
1039
- rotate: 0,
1040
- skewX: 0,
1041
- scaleX: 1,
1042
- scaleY: 1
1043
- };
1044
- function Pn(t, e, n, r, i, a) {
1045
- var o, s, c;
1046
- return (o = Math.sqrt(t * t + e * e)) && (t /= o, e /= o), (c = t * n + e * r) && (n -= t * c, r -= e * c), (s = Math.sqrt(n * n + r * r)) && (n /= s, r /= s, c /= s), t * r < e * n && (t = -t, e = -e, c = -c, o = -o), {
1047
- translateX: i,
1048
- translateY: a,
1049
- rotate: Math.atan2(e, t) * an,
1050
- skewX: Math.atan(c) * an,
1051
- scaleX: o,
1052
- scaleY: s
1053
- };
1054
- }
1055
- var le;
1056
- function Vi(t) {
1057
- const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
1058
- return e.isIdentity ? De : Pn(e.a, e.b, e.c, e.d, e.e, e.f);
1059
- }
1060
- function qi(t) {
1061
- return t == null || (le || (le = document.createElementNS("http://www.w3.org/2000/svg", "g")), le.setAttribute("transform", t), !(t = le.transform.baseVal.consolidate())) ? De : (t = t.matrix, Pn(t.a, t.b, t.c, t.d, t.e, t.f));
1062
- }
1063
- function Yn(t, e, n, r) {
1064
- function i(l) {
1065
- return l.length ? l.pop() + " " : "";
1066
- }
1067
- function a(l, u, h, d, m, A) {
1068
- if (l !== h || u !== d) {
1069
- var _ = m.push("translate(", null, e, null, n);
1070
- A.push({ i: _ - 4, x: zt(l, h) }, { i: _ - 2, x: zt(u, d) });
1071
- } else (h || d) && m.push("translate(" + h + e + d + n);
1072
- }
1073
- function o(l, u, h, d) {
1074
- l !== u ? (l - u > 180 ? u += 360 : u - l > 180 && (l += 360), d.push({ i: h.push(i(h) + "rotate(", null, r) - 2, x: zt(l, u) })) : u && h.push(i(h) + "rotate(" + u + r);
1075
- }
1076
- function s(l, u, h, d) {
1077
- l !== u ? d.push({ i: h.push(i(h) + "skewX(", null, r) - 2, x: zt(l, u) }) : u && h.push(i(h) + "skewX(" + u + r);
1078
- }
1079
- function c(l, u, h, d, m, A) {
1080
- if (l !== h || u !== d) {
1081
- var _ = m.push(i(m) + "scale(", null, ",", null, ")");
1082
- A.push({ i: _ - 4, x: zt(l, h) }, { i: _ - 2, x: zt(u, d) });
1083
- } else (h !== 1 || d !== 1) && m.push(i(m) + "scale(" + h + "," + d + ")");
1084
- }
1085
- return function(l, u) {
1086
- var h = [], d = [];
1087
- return l = t(l), u = t(u), a(l.translateX, l.translateY, u.translateX, u.translateY, h, d), o(l.rotate, u.rotate, h, d), s(l.skewX, u.skewX, h, d), c(l.scaleX, l.scaleY, u.scaleX, u.scaleY, h, d), l = u = null, function(m) {
1088
- for (var A = -1, _ = d.length, S; ++A < _; ) h[(S = d[A]).i] = S.x(m);
1089
- return h.join("");
1090
- };
1091
- };
1092
- }
1093
- var Ui = Yn(Vi, "px, ", "px)", "deg)"), Zi = Yn(qi, ", ", ")", ")"), Ki = 1e-12;
1094
- function sn(t) {
1095
- return ((t = Math.exp(t)) + 1 / t) / 2;
1096
- }
1097
- function Qi(t) {
1098
- return ((t = Math.exp(t)) - 1 / t) / 2;
1099
- }
1100
- function Ji(t) {
1101
- return ((t = Math.exp(2 * t)) - 1) / (t + 1);
1102
- }
1103
- const ji = (function t(e, n, r) {
1104
- function i(a, o) {
1105
- var s = a[0], c = a[1], l = a[2], u = o[0], h = o[1], d = o[2], m = u - s, A = h - c, _ = m * m + A * A, S, w;
1106
- if (_ < Ki)
1107
- w = Math.log(d / l) / e, S = function(G) {
1108
- return [
1109
- s + G * m,
1110
- c + G * A,
1111
- l * Math.exp(e * G * w)
1112
- ];
1113
- };
1114
- else {
1115
- var ot = Math.sqrt(_), lt = (d * d - l * l + r * _) / (2 * l * n * ot), B = (d * d - l * l - r * _) / (2 * d * n * ot), E = Math.log(Math.sqrt(lt * lt + 1) - lt), $ = Math.log(Math.sqrt(B * B + 1) - B);
1116
- w = ($ - E) / e, S = function(G) {
1117
- var dt = G * w, et = sn(E), b = l / (n * ot) * (et * Ji(e * dt + E) - Qi(E));
1118
- return [
1119
- s + b * m,
1120
- c + b * A,
1121
- l * et / sn(e * dt + E)
1122
- ];
1123
- };
1124
- }
1125
- return S.duration = w * 1e3 * e / Math.SQRT2, S;
1126
- }
1127
- return i.rho = function(a) {
1128
- var o = Math.max(1e-3, +a), s = o * o, c = s * s;
1129
- return t(o, s, c);
1130
- }, i;
1131
- })(Math.SQRT2, 2, 4);
1132
- var qt = 0, Kt = 0, Ut = 0, Tn = 1e3, _e, Qt, ve = 0, Ot = 0, Ee = 0, ee = typeof performance == "object" && performance.now ? performance : Date, zn = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
1133
- setTimeout(t, 17);
1134
- };
1135
- function We() {
1136
- return Ot || (zn(to), Ot = ee.now() + Ee);
1137
- }
1138
- function to() {
1139
- Ot = 0;
1140
- }
1141
- function we() {
1142
- this._call = this._time = this._next = null;
1143
- }
1144
- we.prototype = Dn.prototype = {
1145
- constructor: we,
1146
- restart: function(t, e, n) {
1147
- if (typeof t != "function") throw new TypeError("callback is not a function");
1148
- n = (n == null ? We() : +n) + (e == null ? 0 : +e), !this._next && Qt !== this && (Qt ? Qt._next = this : _e = this, Qt = this), this._call = t, this._time = n, Re();
1149
- },
1150
- stop: function() {
1151
- this._call && (this._call = null, this._time = 1 / 0, Re());
1152
- }
1153
- };
1154
- function Dn(t, e, n) {
1155
- var r = new we();
1156
- return r.restart(t, e, n), r;
1157
- }
1158
- function eo() {
1159
- We(), ++qt;
1160
- for (var t = _e, e; t; )
1161
- (e = Ot - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
1162
- --qt;
1163
- }
1164
- function ln() {
1165
- Ot = (ve = ee.now()) + Ee, qt = Kt = 0;
1166
- try {
1167
- eo();
1168
- } finally {
1169
- qt = 0, ro(), Ot = 0;
1170
- }
1171
- }
1172
- function no() {
1173
- var t = ee.now(), e = t - ve;
1174
- e > Tn && (Ee -= e, ve = t);
1175
- }
1176
- function ro() {
1177
- for (var t, e = _e, n, r = 1 / 0; e; )
1178
- e._call ? (r > e._time && (r = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : _e = n);
1179
- Qt = t, Re(r);
1180
- }
1181
- function Re(t) {
1182
- if (!qt) {
1183
- Kt && (Kt = clearTimeout(Kt));
1184
- var e = t - Ot;
1185
- e > 24 ? (t < 1 / 0 && (Kt = setTimeout(ln, t - ee.now() - Ee)), Ut && (Ut = clearInterval(Ut))) : (Ut || (ve = ee.now(), Ut = setInterval(no, Tn)), qt = 1, zn(ln));
1186
- }
1187
- }
1188
- function cn(t, e, n) {
1189
- var r = new we();
1190
- return e = e == null ? 0 : +e, r.restart((i) => {
1191
- r.stop(), t(i + e);
1192
- }, e, n), r;
1193
- }
1194
- var io = Le("start", "end", "cancel", "interrupt"), oo = [], Rn = 0, un = 1, Be = 2, he = 3, fn = 4, Fe = 5, de = 6;
1195
- function $e(t, e, n, r, i, a) {
1196
- var o = t.__transition;
1197
- if (!o) t.__transition = {};
1198
- else if (n in o) return;
1199
- ao(t, n, {
1200
- name: e,
1201
- index: r,
1202
- // For context during callback.
1203
- group: i,
1204
- // For context during callback.
1205
- on: io,
1206
- tween: oo,
1207
- time: a.time,
1208
- delay: a.delay,
1209
- duration: a.duration,
1210
- ease: a.ease,
1211
- timer: null,
1212
- state: Rn
1213
- });
1214
- }
1215
- function Ge(t, e) {
1216
- var n = At(t, e);
1217
- if (n.state > Rn) throw new Error("too late; already scheduled");
1218
- return n;
1219
- }
1220
- function St(t, e) {
1221
- var n = At(t, e);
1222
- if (n.state > he) throw new Error("too late; already running");
1223
- return n;
1224
- }
1225
- function At(t, e) {
1226
- var n = t.__transition;
1227
- if (!n || !(n = n[e])) throw new Error("transition not found");
1228
- return n;
1229
- }
1230
- function ao(t, e, n) {
1231
- var r = t.__transition, i;
1232
- r[e] = n, n.timer = Dn(a, 0, n.time);
1233
- function a(l) {
1234
- n.state = un, n.timer.restart(o, n.delay, n.time), n.delay <= l && o(l - n.delay);
1235
- }
1236
- function o(l) {
1237
- var u, h, d, m;
1238
- if (n.state !== un) return c();
1239
- for (u in r)
1240
- if (m = r[u], m.name === n.name) {
1241
- if (m.state === he) return cn(o);
1242
- m.state === fn ? (m.state = de, m.timer.stop(), m.on.call("interrupt", t, t.__data__, m.index, m.group), delete r[u]) : +u < e && (m.state = de, m.timer.stop(), m.on.call("cancel", t, t.__data__, m.index, m.group), delete r[u]);
1243
- }
1244
- if (cn(function() {
1245
- n.state === he && (n.state = fn, n.timer.restart(s, n.delay, n.time), s(l));
1246
- }), n.state = Be, n.on.call("start", t, t.__data__, n.index, n.group), n.state === Be) {
1247
- for (n.state = he, i = new Array(d = n.tween.length), u = 0, h = -1; u < d; ++u)
1248
- (m = n.tween[u].value.call(t, t.__data__, n.index, n.group)) && (i[++h] = m);
1249
- i.length = h + 1;
1250
- }
1251
- }
1252
- function s(l) {
1253
- for (var u = l < n.duration ? n.ease.call(null, l / n.duration) : (n.timer.restart(c), n.state = Fe, 1), h = -1, d = i.length; ++h < d; )
1254
- i[h].call(t, u);
1255
- n.state === Fe && (n.on.call("end", t, t.__data__, n.index, n.group), c());
1256
- }
1257
- function c() {
1258
- n.state = de, n.timer.stop(), delete r[e];
1259
- for (var l in r) return;
1260
- delete t.__transition;
1261
- }
1262
- }
1263
- function pe(t, e) {
1264
- var n = t.__transition, r, i, a = !0, o;
1265
- if (n) {
1266
- e = e == null ? null : e + "";
1267
- for (o in n) {
1268
- if ((r = n[o]).name !== e) {
1269
- a = !1;
1270
- continue;
1271
- }
1272
- i = r.state > Be && r.state < Fe, r.state = de, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", t, t.__data__, r.index, r.group), delete n[o];
1273
- }
1274
- a && delete t.__transition;
1275
- }
1276
- }
1277
- function so(t) {
1278
- return this.each(function() {
1279
- pe(this, t);
1280
- });
1281
- }
1282
- function lo(t, e) {
1283
- var n, r;
1284
- return function() {
1285
- var i = St(this, t), a = i.tween;
1286
- if (a !== n) {
1287
- r = n = a;
1288
- for (var o = 0, s = r.length; o < s; ++o)
1289
- if (r[o].name === e) {
1290
- r = r.slice(), r.splice(o, 1);
1291
- break;
1292
- }
1293
- }
1294
- i.tween = r;
1295
- };
1296
- }
1297
- function co(t, e, n) {
1298
- var r, i;
1299
- if (typeof n != "function") throw new Error();
1300
- return function() {
1301
- var a = St(this, t), o = a.tween;
1302
- if (o !== r) {
1303
- i = (r = o).slice();
1304
- for (var s = { name: e, value: n }, c = 0, l = i.length; c < l; ++c)
1305
- if (i[c].name === e) {
1306
- i[c] = s;
1307
- break;
1308
- }
1309
- c === l && i.push(s);
1310
- }
1311
- a.tween = i;
1312
- };
1313
- }
1314
- function uo(t, e) {
1315
- var n = this._id;
1316
- if (t += "", arguments.length < 2) {
1317
- for (var r = At(this.node(), n).tween, i = 0, a = r.length, o; i < a; ++i)
1318
- if ((o = r[i]).name === t)
1319
- return o.value;
1320
- return null;
1321
- }
1322
- return this.each((e == null ? lo : co)(n, t, e));
1323
- }
1324
- function Ve(t, e, n) {
1325
- var r = t._id;
1326
- return t.each(function() {
1327
- var i = St(this, r);
1328
- (i.value || (i.value = {}))[e] = n.apply(this, arguments);
1329
- }), function(i) {
1330
- return At(i, r).value[e];
1331
- };
1332
- }
1333
- function Bn(t, e) {
1334
- var n;
1335
- return (typeof e == "number" ? zt : e instanceof te ? on : (n = te(e)) ? (e = n, on) : Gi)(t, e);
1336
- }
1337
- function fo(t) {
1338
- return function() {
1339
- this.removeAttribute(t);
1340
- };
1341
- }
1342
- function ho(t) {
1343
- return function() {
1344
- this.removeAttributeNS(t.space, t.local);
1345
- };
1346
- }
1347
- function po(t, e, n) {
1348
- var r, i = n + "", a;
1349
- return function() {
1350
- var o = this.getAttribute(t);
1351
- return o === i ? null : o === r ? a : a = e(r = o, n);
1352
- };
1353
- }
1354
- function go(t, e, n) {
1355
- var r, i = n + "", a;
1356
- return function() {
1357
- var o = this.getAttributeNS(t.space, t.local);
1358
- return o === i ? null : o === r ? a : a = e(r = o, n);
1359
- };
1360
- }
1361
- function mo(t, e, n) {
1362
- var r, i, a;
1363
- return function() {
1364
- var o, s = n(this), c;
1365
- return s == null ? void this.removeAttribute(t) : (o = this.getAttribute(t), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = e(r = o, s)));
1366
- };
1367
- }
1368
- function yo(t, e, n) {
1369
- var r, i, a;
1370
- return function() {
1371
- var o, s = n(this), c;
1372
- return s == null ? void this.removeAttributeNS(t.space, t.local) : (o = this.getAttributeNS(t.space, t.local), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = e(r = o, s)));
1373
- };
1374
- }
1375
- function xo(t, e) {
1376
- var n = be(t), r = n === "transform" ? Zi : Bn;
1377
- return this.attrTween(t, typeof e == "function" ? (n.local ? yo : mo)(n, r, Ve(this, "attr." + t, e)) : e == null ? (n.local ? ho : fo)(n) : (n.local ? go : po)(n, r, e));
1378
- }
1379
- function _o(t, e) {
1380
- return function(n) {
1381
- this.setAttribute(t, e.call(this, n));
1382
- };
1383
- }
1384
- function vo(t, e) {
1385
- return function(n) {
1386
- this.setAttributeNS(t.space, t.local, e.call(this, n));
1387
- };
1388
- }
1389
- function wo(t, e) {
1390
- var n, r;
1391
- function i() {
1392
- var a = e.apply(this, arguments);
1393
- return a !== r && (n = (r = a) && vo(t, a)), n;
1394
- }
1395
- return i._value = e, i;
1396
- }
1397
- function bo(t, e) {
1398
- var n, r;
1399
- function i() {
1400
- var a = e.apply(this, arguments);
1401
- return a !== r && (n = (r = a) && _o(t, a)), n;
1402
- }
1403
- return i._value = e, i;
1404
- }
1405
- function Eo(t, e) {
1406
- var n = "attr." + t;
1407
- if (arguments.length < 2) return (n = this.tween(n)) && n._value;
1408
- if (e == null) return this.tween(n, null);
1409
- if (typeof e != "function") throw new Error();
1410
- var r = be(t);
1411
- return this.tween(n, (r.local ? wo : bo)(r, e));
1412
- }
1413
- function $o(t, e) {
1414
- return function() {
1415
- Ge(this, t).delay = +e.apply(this, arguments);
1416
- };
1417
- }
1418
- function No(t, e) {
1419
- return e = +e, function() {
1420
- Ge(this, t).delay = e;
1421
- };
1422
- }
1423
- function Co(t) {
1424
- var e = this._id;
1425
- return arguments.length ? this.each((typeof t == "function" ? $o : No)(e, t)) : At(this.node(), e).delay;
1426
- }
1427
- function ko(t, e) {
1428
- return function() {
1429
- St(this, t).duration = +e.apply(this, arguments);
1430
- };
1431
- }
1432
- function Ao(t, e) {
1433
- return e = +e, function() {
1434
- St(this, t).duration = e;
1435
- };
1436
- }
1437
- function Mo(t) {
1438
- var e = this._id;
1439
- return arguments.length ? this.each((typeof t == "function" ? ko : Ao)(e, t)) : At(this.node(), e).duration;
1440
- }
1441
- function So(t, e) {
1442
- if (typeof e != "function") throw new Error();
1443
- return function() {
1444
- St(this, t).ease = e;
1445
- };
1446
- }
1447
- function Io(t) {
1448
- var e = this._id;
1449
- return arguments.length ? this.each(So(e, t)) : At(this.node(), e).ease;
1450
- }
1451
- function Po(t, e) {
1452
- return function() {
1453
- var n = e.apply(this, arguments);
1454
- if (typeof n != "function") throw new Error();
1455
- St(this, t).ease = n;
1456
- };
1457
- }
1458
- function Yo(t) {
1459
- if (typeof t != "function") throw new Error();
1460
- return this.each(Po(this._id, t));
1461
- }
1462
- function To(t) {
1463
- typeof t != "function" && (t = xn(t));
1464
- for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i)
1465
- for (var a = e[i], o = a.length, s = r[i] = [], c, l = 0; l < o; ++l)
1466
- (c = a[l]) && t.call(c, c.__data__, l, a) && s.push(c);
1467
- return new Yt(r, this._parents, this._name, this._id);
1468
- }
1469
- function zo(t) {
1470
- if (t._id !== this._id) throw new Error();
1471
- for (var e = this._groups, n = t._groups, r = e.length, i = n.length, a = Math.min(r, i), o = new Array(r), s = 0; s < a; ++s)
1472
- for (var c = e[s], l = n[s], u = c.length, h = o[s] = new Array(u), d, m = 0; m < u; ++m)
1473
- (d = c[m] || l[m]) && (h[m] = d);
1474
- for (; s < r; ++s)
1475
- o[s] = e[s];
1476
- return new Yt(o, this._parents, this._name, this._id);
1477
- }
1478
- function Do(t) {
1479
- return (t + "").trim().split(/^|\s+/).every(function(e) {
1480
- var n = e.indexOf(".");
1481
- return n >= 0 && (e = e.slice(0, n)), !e || e === "start";
1482
- });
1483
- }
1484
- function Ro(t, e, n) {
1485
- var r, i, a = Do(e) ? Ge : St;
1486
- return function() {
1487
- var o = a(this, t), s = o.on;
1488
- s !== r && (i = (r = s).copy()).on(e, n), o.on = i;
1489
- };
1490
- }
1491
- function Bo(t, e) {
1492
- var n = this._id;
1493
- return arguments.length < 2 ? At(this.node(), n).on.on(t) : this.each(Ro(n, t, e));
1494
- }
1495
- function Fo(t) {
1496
- return function() {
1497
- var e = this.parentNode;
1498
- for (var n in this.__transition) if (+n !== t) return;
1499
- e && e.removeChild(this);
1500
- };
1501
- }
1502
- function Lo() {
1503
- return this.on("end.remove", Fo(this._id));
1504
- }
1505
- function Oo(t) {
1506
- var e = this._name, n = this._id;
1507
- typeof t != "function" && (t = Oe(t));
1508
- for (var r = this._groups, i = r.length, a = new Array(i), o = 0; o < i; ++o)
1509
- for (var s = r[o], c = s.length, l = a[o] = new Array(c), u, h, d = 0; d < c; ++d)
1510
- (u = s[d]) && (h = t.call(u, u.__data__, d, s)) && ("__data__" in u && (h.__data__ = u.__data__), l[d] = h, $e(l[d], e, n, d, l, At(u, n)));
1511
- return new Yt(a, this._parents, e, n);
1512
- }
1513
- function Ho(t) {
1514
- var e = this._name, n = this._id;
1515
- typeof t != "function" && (t = yn(t));
1516
- for (var r = this._groups, i = r.length, a = [], o = [], s = 0; s < i; ++s)
1517
- for (var c = r[s], l = c.length, u, h = 0; h < l; ++h)
1518
- if (u = c[h]) {
1519
- for (var d = t.call(u, u.__data__, h, c), m, A = At(u, n), _ = 0, S = d.length; _ < S; ++_)
1520
- (m = d[_]) && $e(m, e, n, _, d, A);
1521
- a.push(d), o.push(u);
1522
- }
1523
- return new Yt(a, o, e, n);
1524
- }
1525
- var Xo = ne.prototype.constructor;
1526
- function Wo() {
1527
- return new Xo(this._groups, this._parents);
1528
- }
1529
- function Go(t, e) {
1530
- var n, r, i;
1531
- return function() {
1532
- var a = Vt(this, t), o = (this.style.removeProperty(t), Vt(this, t));
1533
- return a === o ? null : a === n && o === r ? i : i = e(n = a, r = o);
1534
- };
1535
- }
1536
- function Fn(t) {
1537
- return function() {
1538
- this.style.removeProperty(t);
1539
- };
1540
- }
1541
- function Vo(t, e, n) {
1542
- var r, i = n + "", a;
1543
- return function() {
1544
- var o = Vt(this, t);
1545
- return o === i ? null : o === r ? a : a = e(r = o, n);
1546
- };
1547
- }
1548
- function qo(t, e, n) {
1549
- var r, i, a;
1550
- return function() {
1551
- var o = Vt(this, t), s = n(this), c = s + "";
1552
- return s == null && (c = s = (this.style.removeProperty(t), Vt(this, t))), o === c ? null : o === r && c === i ? a : (i = c, a = e(r = o, s));
1553
- };
1554
- }
1555
- function Uo(t, e) {
1556
- var n, r, i, a = "style." + e, o = "end." + a, s;
1557
- return function() {
1558
- var c = St(this, t), l = c.on, u = c.value[a] == null ? s || (s = Fn(e)) : void 0;
1559
- (l !== n || i !== u) && (r = (n = l).copy()).on(o, i = u), c.on = r;
1560
- };
1561
- }
1562
- function Zo(t, e, n) {
1563
- var r = (t += "") == "transform" ? Ui : Bn;
1564
- return e == null ? this.styleTween(t, Go(t, r)).on("end.style." + t, Fn(t)) : typeof e == "function" ? this.styleTween(t, qo(t, r, Ve(this, "style." + t, e))).each(Uo(this._id, t)) : this.styleTween(t, Vo(t, r, e), n).on("end.style." + t, null);
1565
- }
1566
- function Ko(t, e, n) {
1567
- return function(r) {
1568
- this.style.setProperty(t, e.call(this, r), n);
1569
- };
1570
- }
1571
- function Qo(t, e, n) {
1572
- var r, i;
1573
- function a() {
1574
- var o = e.apply(this, arguments);
1575
- return o !== i && (r = (i = o) && Ko(t, o, n)), r;
1576
- }
1577
- return a._value = e, a;
1578
- }
1579
- function Jo(t, e, n) {
1580
- var r = "style." + (t += "");
1581
- if (arguments.length < 2) return (r = this.tween(r)) && r._value;
1582
- if (e == null) return this.tween(r, null);
1583
- if (typeof e != "function") throw new Error();
1584
- return this.tween(r, Qo(t, e, n ?? ""));
1585
- }
1586
- function jo(t) {
1587
- return function() {
1588
- this.textContent = t;
1589
- };
1590
- }
1591
- function ta(t) {
1592
- return function() {
1593
- var e = t(this);
1594
- this.textContent = e ?? "";
1595
- };
1596
- }
1597
- function ea(t) {
1598
- return this.tween("text", typeof t == "function" ? ta(Ve(this, "text", t)) : jo(t == null ? "" : t + ""));
1599
- }
1600
- function na(t) {
1601
- return function(e) {
1602
- this.textContent = t.call(this, e);
1603
- };
1604
- }
1605
- function ra(t) {
1606
- var e, n;
1607
- function r() {
1608
- var i = t.apply(this, arguments);
1609
- return i !== n && (e = (n = i) && na(i)), e;
1610
- }
1611
- return r._value = t, r;
1612
- }
1613
- function ia(t) {
1614
- var e = "text";
1615
- if (arguments.length < 1) return (e = this.tween(e)) && e._value;
1616
- if (t == null) return this.tween(e, null);
1617
- if (typeof t != "function") throw new Error();
1618
- return this.tween(e, ra(t));
1619
- }
1620
- function oa() {
1621
- for (var t = this._name, e = this._id, n = Ln(), r = this._groups, i = r.length, a = 0; a < i; ++a)
1622
- for (var o = r[a], s = o.length, c, l = 0; l < s; ++l)
1623
- if (c = o[l]) {
1624
- var u = At(c, e);
1625
- $e(c, t, n, l, o, {
1626
- time: u.time + u.delay + u.duration,
1627
- delay: 0,
1628
- duration: u.duration,
1629
- ease: u.ease
1630
- });
1631
- }
1632
- return new Yt(r, this._parents, t, n);
1633
- }
1634
- function aa() {
1635
- var t, e, n = this, r = n._id, i = n.size();
1636
- return new Promise(function(a, o) {
1637
- var s = { value: o }, c = { value: function() {
1638
- --i === 0 && a();
1639
- } };
1640
- n.each(function() {
1641
- var l = St(this, r), u = l.on;
1642
- u !== t && (e = (t = u).copy(), e._.cancel.push(s), e._.interrupt.push(s), e._.end.push(c)), l.on = e;
1643
- }), i === 0 && a();
1644
- });
1645
- }
1646
- var sa = 0;
1647
- function Yt(t, e, n, r) {
1648
- this._groups = t, this._parents = e, this._name = n, this._id = r;
1649
- }
1650
- function Ln() {
1651
- return ++sa;
1652
- }
1653
- var It = ne.prototype;
1654
- Yt.prototype = {
1655
- constructor: Yt,
1656
- select: Oo,
1657
- selectAll: Ho,
1658
- selectChild: It.selectChild,
1659
- selectChildren: It.selectChildren,
1660
- filter: To,
1661
- merge: zo,
1662
- selection: Wo,
1663
- transition: oa,
1664
- call: It.call,
1665
- nodes: It.nodes,
1666
- node: It.node,
1667
- size: It.size,
1668
- empty: It.empty,
1669
- each: It.each,
1670
- on: Bo,
1671
- attr: xo,
1672
- attrTween: Eo,
1673
- style: Zo,
1674
- styleTween: Jo,
1675
- text: ea,
1676
- textTween: ia,
1677
- remove: Lo,
1678
- tween: uo,
1679
- delay: Co,
1680
- duration: Mo,
1681
- ease: Io,
1682
- easeVarying: Yo,
1683
- end: aa,
1684
- [Symbol.iterator]: It[Symbol.iterator]
1685
- };
1686
- function la(t) {
1687
- return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
1688
- }
1689
- var ca = {
1690
- time: null,
1691
- // Set on use.
1692
- delay: 0,
1693
- duration: 250,
1694
- ease: la
1695
- };
1696
- function ua(t, e) {
1697
- for (var n; !(n = t.__transition) || !(n = n[e]); )
1698
- if (!(t = t.parentNode))
1699
- throw new Error(`transition ${e} not found`);
1700
- return n;
1701
- }
1702
- function fa(t) {
1703
- var e, n;
1704
- t instanceof Yt ? (e = t._id, t = t._name) : (e = Ln(), (n = ca).time = We(), t = t == null ? null : t + "");
1705
- for (var r = this._groups, i = r.length, a = 0; a < i; ++a)
1706
- for (var o = r[a], s = o.length, c, l = 0; l < s; ++l)
1707
- (c = o[l]) && $e(c, t, e, l, o, n || ua(c, e));
1708
- return new Yt(r, this._parents, t, e);
1709
- }
1710
- ne.prototype.interrupt = so;
1711
- ne.prototype.transition = fa;
1712
- const ce = (t) => () => t;
1713
- function ha(t, {
1714
- sourceEvent: e,
1715
- target: n,
1716
- transform: r,
1717
- dispatch: i
1718
- }) {
1719
- Object.defineProperties(this, {
1720
- type: { value: t, enumerable: !0, configurable: !0 },
1721
- sourceEvent: { value: e, enumerable: !0, configurable: !0 },
1722
- target: { value: n, enumerable: !0, configurable: !0 },
1723
- transform: { value: r, enumerable: !0, configurable: !0 },
1724
- _: { value: i }
1725
- });
1726
- }
1727
- function Pt(t, e, n) {
1728
- this.k = t, this.x = e, this.y = n;
1729
- }
1730
- Pt.prototype = {
1731
- constructor: Pt,
1732
- scale: function(t) {
1733
- return t === 1 ? this : new Pt(this.k * t, this.x, this.y);
1734
- },
1735
- translate: function(t, e) {
1736
- return t === 0 & e === 0 ? this : new Pt(this.k, this.x + this.k * t, this.y + this.k * e);
1737
- },
1738
- apply: function(t) {
1739
- return [t[0] * this.k + this.x, t[1] * this.k + this.y];
1740
- },
1741
- applyX: function(t) {
1742
- return t * this.k + this.x;
1743
- },
1744
- applyY: function(t) {
1745
- return t * this.k + this.y;
1746
- },
1747
- invert: function(t) {
1748
- return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k];
1749
- },
1750
- invertX: function(t) {
1751
- return (t - this.x) / this.k;
1752
- },
1753
- invertY: function(t) {
1754
- return (t - this.y) / this.k;
1755
- },
1756
- rescaleX: function(t) {
1757
- return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t));
1758
- },
1759
- rescaleY: function(t) {
1760
- return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t));
1761
- },
1762
- toString: function() {
1763
- return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
1764
- }
1765
- };
1766
- var Ht = new Pt(1, 0, 0);
1767
- da.prototype = Pt.prototype;
1768
- function da(t) {
1769
- for (; !t.__zoom; ) if (!(t = t.parentNode)) return Ht;
1770
- return t.__zoom;
1771
- }
1772
- function Ae(t) {
1773
- t.stopImmediatePropagation();
1774
- }
1775
- function Zt(t) {
1776
- t.preventDefault(), t.stopImmediatePropagation();
1777
- }
1778
- function pa(t) {
1779
- return (!t.ctrlKey || t.type === "wheel") && !t.button;
1780
- }
1781
- function ga() {
1782
- var t = this;
1783
- return t instanceof SVGElement ? (t = t.ownerSVGElement || t, t.hasAttribute("viewBox") ? (t = t.viewBox.baseVal, [[t.x, t.y], [t.x + t.width, t.y + t.height]]) : [[0, 0], [t.width.baseVal.value, t.height.baseVal.value]]) : [[0, 0], [t.clientWidth, t.clientHeight]];
1784
- }
1785
- function hn() {
1786
- return this.__zoom || Ht;
1787
- }
1788
- function ma(t) {
1789
- return -t.deltaY * (t.deltaMode === 1 ? 0.05 : t.deltaMode ? 1 : 2e-3) * (t.ctrlKey ? 10 : 1);
1790
- }
1791
- function ya() {
1792
- return navigator.maxTouchPoints || "ontouchstart" in this;
1793
- }
1794
- function xa(t, e, n) {
1795
- var r = t.invertX(e[0][0]) - n[0][0], i = t.invertX(e[1][0]) - n[1][0], a = t.invertY(e[0][1]) - n[0][1], o = t.invertY(e[1][1]) - n[1][1];
1796
- return t.translate(
1797
- i > r ? (r + i) / 2 : Math.min(0, r) || Math.max(0, i),
1798
- o > a ? (a + o) / 2 : Math.min(0, a) || Math.max(0, o)
1799
- );
1800
- }
1801
- function qe() {
1802
- var t = pa, e = ga, n = xa, r = ma, i = ya, a = [0, 1 / 0], o = [[-1 / 0, -1 / 0], [1 / 0, 1 / 0]], s = 250, c = ji, l = Le("start", "zoom", "end"), u, h, d, m = 500, A = 150, _ = 0, S = 10;
1803
- function w(f) {
1804
- f.property("__zoom", hn).on("wheel.zoom", dt, { passive: !1 }).on("mousedown.zoom", et).on("dblclick.zoom", b).filter(i).on("touchstart.zoom", J).on("touchmove.zoom", Z).on("touchend.zoom touchcancel.zoom", I).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1805
- }
1806
- w.transform = function(f, y, p, N) {
1807
- var P = f.selection ? f.selection() : f;
1808
- P.property("__zoom", hn), f !== P ? E(f, y, p, N) : P.interrupt().each(function() {
1809
- $(this, arguments).event(N).start().zoom(null, typeof y == "function" ? y.apply(this, arguments) : y).end();
1810
- });
1811
- }, w.scaleBy = function(f, y, p, N) {
1812
- w.scaleTo(f, function() {
1813
- var P = this.__zoom.k, D = typeof y == "function" ? y.apply(this, arguments) : y;
1814
- return P * D;
1815
- }, p, N);
1816
- }, w.scaleTo = function(f, y, p, N) {
1817
- w.transform(f, function() {
1818
- var P = e.apply(this, arguments), D = this.__zoom, T = p == null ? B(P) : typeof p == "function" ? p.apply(this, arguments) : p, q = D.invert(T), ct = typeof y == "function" ? y.apply(this, arguments) : y;
1819
- return n(lt(ot(D, ct), T, q), P, o);
1820
- }, p, N);
1821
- }, w.translateBy = function(f, y, p, N) {
1822
- w.transform(f, function() {
1823
- return n(this.__zoom.translate(
1824
- typeof y == "function" ? y.apply(this, arguments) : y,
1825
- typeof p == "function" ? p.apply(this, arguments) : p
1826
- ), e.apply(this, arguments), o);
1827
- }, null, N);
1828
- }, w.translateTo = function(f, y, p, N, P) {
1829
- w.transform(f, function() {
1830
- var D = e.apply(this, arguments), T = this.__zoom, q = N == null ? B(D) : typeof N == "function" ? N.apply(this, arguments) : N;
1831
- return n(Ht.translate(q[0], q[1]).scale(T.k).translate(
1832
- typeof y == "function" ? -y.apply(this, arguments) : -y,
1833
- typeof p == "function" ? -p.apply(this, arguments) : -p
1834
- ), D, o);
1835
- }, N, P);
1836
- };
1837
- function ot(f, y) {
1838
- return y = Math.max(a[0], Math.min(a[1], y)), y === f.k ? f : new Pt(y, f.x, f.y);
1839
- }
1840
- function lt(f, y, p) {
1841
- var N = y[0] - p[0] * f.k, P = y[1] - p[1] * f.k;
1842
- return N === f.x && P === f.y ? f : new Pt(f.k, N, P);
1843
- }
1844
- function B(f) {
1845
- return [(+f[0][0] + +f[1][0]) / 2, (+f[0][1] + +f[1][1]) / 2];
1846
- }
1847
- function E(f, y, p, N) {
1848
- f.on("start.zoom", function() {
1849
- $(this, arguments).event(N).start();
1850
- }).on("interrupt.zoom end.zoom", function() {
1851
- $(this, arguments).event(N).end();
1852
- }).tween("zoom", function() {
1853
- var P = this, D = arguments, T = $(P, D).event(N), q = e.apply(P, D), ct = p == null ? B(q) : typeof p == "function" ? p.apply(P, D) : p, nt = Math.max(q[1][0] - q[0][0], q[1][1] - q[0][1]), v = P.__zoom, H = typeof y == "function" ? y.apply(P, D) : y, tt = c(v.invert(ct).concat(nt / v.k), H.invert(ct).concat(nt / H.k));
1854
- return function(j) {
1855
- if (j === 1) j = H;
1856
- else {
1857
- var g = tt(j), x = nt / g[2];
1858
- j = new Pt(x, ct[0] - g[0] * x, ct[1] - g[1] * x);
1859
- }
1860
- T.zoom(null, j);
1861
- };
1862
- });
1863
- }
1864
- function $(f, y, p) {
1865
- return !p && f.__zooming || new G(f, y);
1866
- }
1867
- function G(f, y) {
1868
- this.that = f, this.args = y, this.active = 0, this.sourceEvent = null, this.extent = e.apply(f, y), this.taps = 0;
1869
- }
1870
- G.prototype = {
1871
- event: function(f) {
1872
- return f && (this.sourceEvent = f), this;
1873
- },
1874
- start: function() {
1875
- return ++this.active === 1 && (this.that.__zooming = this, this.emit("start")), this;
1876
- },
1877
- zoom: function(f, y) {
1878
- return this.mouse && f !== "mouse" && (this.mouse[1] = y.invert(this.mouse[0])), this.touch0 && f !== "touch" && (this.touch0[1] = y.invert(this.touch0[0])), this.touch1 && f !== "touch" && (this.touch1[1] = y.invert(this.touch1[0])), this.that.__zoom = y, this.emit("zoom"), this;
1879
- },
1880
- end: function() {
1881
- return --this.active === 0 && (delete this.that.__zooming, this.emit("end")), this;
1882
- },
1883
- emit: function(f) {
1884
- var y = V(this.that).datum();
1885
- l.call(
1886
- f,
1887
- this.that,
1888
- new ha(f, {
1889
- sourceEvent: this.sourceEvent,
1890
- target: w,
1891
- transform: this.that.__zoom,
1892
- dispatch: l
1893
- }),
1894
- y
1895
- );
1896
- }
1897
- };
1898
- function dt(f, ...y) {
1899
- if (!t.apply(this, arguments)) return;
1900
- var p = $(this, y).event(f), N = this.__zoom, P = Math.max(a[0], Math.min(a[1], N.k * Math.pow(2, r.apply(this, arguments)))), D = Rt(f);
1901
- if (p.wheel)
1902
- (p.mouse[0][0] !== D[0] || p.mouse[0][1] !== D[1]) && (p.mouse[1] = N.invert(p.mouse[0] = D)), clearTimeout(p.wheel);
1903
- else {
1904
- if (N.k === P) return;
1905
- p.mouse = [D, N.invert(D)], pe(this), p.start();
1906
- }
1907
- Zt(f), p.wheel = setTimeout(T, A), p.zoom("mouse", n(lt(ot(N, P), p.mouse[0], p.mouse[1]), p.extent, o));
1908
- function T() {
1909
- p.wheel = null, p.end();
1910
- }
1911
- }
1912
- function et(f, ...y) {
1913
- if (d || !t.apply(this, arguments)) return;
1914
- var p = f.currentTarget, N = $(this, y, !0).event(f), P = V(f.view).on("mousemove.zoom", ct, !0).on("mouseup.zoom", nt, !0), D = Rt(f, p), T = f.clientX, q = f.clientY;
1915
- Ci(f.view), Ae(f), N.mouse = [D, this.__zoom.invert(D)], pe(this), N.start();
1916
- function ct(v) {
1917
- if (Zt(v), !N.moved) {
1918
- var H = v.clientX - T, tt = v.clientY - q;
1919
- N.moved = H * H + tt * tt > _;
1920
- }
1921
- N.event(v).zoom("mouse", n(lt(N.that.__zoom, N.mouse[0] = Rt(v, p), N.mouse[1]), N.extent, o));
1922
- }
1923
- function nt(v) {
1924
- P.on("mousemove.zoom mouseup.zoom", null), ki(v.view, N.moved), Zt(v), N.event(v).end();
1925
- }
1926
- }
1927
- function b(f, ...y) {
1928
- if (t.apply(this, arguments)) {
1929
- var p = this.__zoom, N = Rt(f.changedTouches ? f.changedTouches[0] : f, this), P = p.invert(N), D = p.k * (f.shiftKey ? 0.5 : 2), T = n(lt(ot(p, D), N, P), e.apply(this, y), o);
1930
- Zt(f), s > 0 ? V(this).transition().duration(s).call(E, T, N, f) : V(this).call(w.transform, T, N, f);
1931
- }
1932
- }
1933
- function J(f, ...y) {
1934
- if (t.apply(this, arguments)) {
1935
- var p = f.touches, N = p.length, P = $(this, y, f.changedTouches.length === N).event(f), D, T, q, ct;
1936
- for (Ae(f), T = 0; T < N; ++T)
1937
- q = p[T], ct = Rt(q, this), ct = [ct, this.__zoom.invert(ct), q.identifier], P.touch0 ? !P.touch1 && P.touch0[2] !== ct[2] && (P.touch1 = ct, P.taps = 0) : (P.touch0 = ct, D = !0, P.taps = 1 + !!u);
1938
- u && (u = clearTimeout(u)), D && (P.taps < 2 && (h = ct[0], u = setTimeout(function() {
1939
- u = null;
1940
- }, m)), pe(this), P.start());
1941
- }
1942
- }
1943
- function Z(f, ...y) {
1944
- if (this.__zooming) {
1945
- var p = $(this, y).event(f), N = f.changedTouches, P = N.length, D, T, q, ct;
1946
- for (Zt(f), D = 0; D < P; ++D)
1947
- T = N[D], q = Rt(T, this), p.touch0 && p.touch0[2] === T.identifier ? p.touch0[0] = q : p.touch1 && p.touch1[2] === T.identifier && (p.touch1[0] = q);
1948
- if (T = p.that.__zoom, p.touch1) {
1949
- var nt = p.touch0[0], v = p.touch0[1], H = p.touch1[0], tt = p.touch1[1], j = (j = H[0] - nt[0]) * j + (j = H[1] - nt[1]) * j, g = (g = tt[0] - v[0]) * g + (g = tt[1] - v[1]) * g;
1950
- T = ot(T, Math.sqrt(j / g)), q = [(nt[0] + H[0]) / 2, (nt[1] + H[1]) / 2], ct = [(v[0] + tt[0]) / 2, (v[1] + tt[1]) / 2];
1951
- } else if (p.touch0) q = p.touch0[0], ct = p.touch0[1];
1952
- else return;
1953
- p.zoom("touch", n(lt(T, q, ct), p.extent, o));
1954
- }
1955
- }
1956
- function I(f, ...y) {
1957
- if (this.__zooming) {
1958
- var p = $(this, y).event(f), N = f.changedTouches, P = N.length, D, T;
1959
- for (Ae(f), d && clearTimeout(d), d = setTimeout(function() {
1960
- d = null;
1961
- }, m), D = 0; D < P; ++D)
1962
- T = N[D], p.touch0 && p.touch0[2] === T.identifier ? delete p.touch0 : p.touch1 && p.touch1[2] === T.identifier && delete p.touch1;
1963
- if (p.touch1 && !p.touch0 && (p.touch0 = p.touch1, delete p.touch1), p.touch0) p.touch0[1] = this.__zoom.invert(p.touch0[0]);
1964
- else if (p.end(), p.taps === 2 && (T = Rt(T, this), Math.hypot(h[0] - T[0], h[1] - T[1]) < S)) {
1965
- var q = V(this).on("dblclick.zoom");
1966
- q && q.apply(this, arguments);
1967
- }
1968
- }
1969
- }
1970
- return w.wheelDelta = function(f) {
1971
- return arguments.length ? (r = typeof f == "function" ? f : ce(+f), w) : r;
1972
- }, w.filter = function(f) {
1973
- return arguments.length ? (t = typeof f == "function" ? f : ce(!!f), w) : t;
1974
- }, w.touchable = function(f) {
1975
- return arguments.length ? (i = typeof f == "function" ? f : ce(!!f), w) : i;
1976
- }, w.extent = function(f) {
1977
- return arguments.length ? (e = typeof f == "function" ? f : ce([[+f[0][0], +f[0][1]], [+f[1][0], +f[1][1]]]), w) : e;
1978
- }, w.scaleExtent = function(f) {
1979
- return arguments.length ? (a[0] = +f[0], a[1] = +f[1], w) : [a[0], a[1]];
1980
- }, w.translateExtent = function(f) {
1981
- return arguments.length ? (o[0][0] = +f[0][0], o[1][0] = +f[1][0], o[0][1] = +f[0][1], o[1][1] = +f[1][1], w) : [[o[0][0], o[0][1]], [o[1][0], o[1][1]]];
1982
- }, w.constrain = function(f) {
1983
- return arguments.length ? (n = f, w) : n;
1984
- }, w.duration = function(f) {
1985
- return arguments.length ? (s = +f, w) : s;
1986
- }, w.interpolate = function(f) {
1987
- return arguments.length ? (c = f, w) : c;
1988
- }, w.on = function() {
1989
- var f = l.on.apply(l, arguments);
1990
- return f === l ? w : f;
1991
- }, w.clickDistance = function(f) {
1992
- return arguments.length ? (_ = (f = +f) * f, w) : Math.sqrt(_);
1993
- }, w.tapDistance = function(f) {
1994
- return arguments.length ? (S = +f, w) : S;
1995
- }, w;
1996
- }
1997
- const Ne = {
1998
- // Edge Routing
1999
- horizontalExtension: 30,
2000
- minEdgeDistance: 50,
2001
- minVerticalSegment: 20,
2002
- loopRadius: 40,
2003
- edgeSpacing: 80,
2004
- cornerRadius: 4,
2005
- // Arrow
2006
- arrowWidth: 10,
2007
- arrowHeight: 6,
2008
- // Label
2009
- labelHeight: 15,
2010
- labelFontSize: 10,
2011
- labelPadding: 6,
2012
- labelCornerRadius: 4,
2013
- // Node
2014
- nodeSpacing: 50,
2015
- // Path Selection
2016
- nearlyHorizontalThreshold: 5,
2017
- nearlyAlignedThreshold: 30
2018
- };
2019
- function Da(t) {
2020
- return {
2021
- ...Ne,
2022
- ...t
2023
- };
2024
- }
2025
- const _a = 0.6, va = /mono|fira|consolas|courier|menlo|roboto mono|ui-monospace/i, dn = {
2026
- i: 0.27,
2027
- l: 0.27,
2028
- j: 0.27,
2029
- I: 0.29,
2030
- ".": 0.28,
2031
- ",": 0.28,
2032
- ":": 0.28,
2033
- ";": 0.28,
2034
- "'": 0.2,
2035
- "|": 0.26,
2036
- "!": 0.3,
2037
- f: 0.32,
2038
- t: 0.34,
2039
- r: 0.38,
2040
- "(": 0.34,
2041
- ")": 0.34,
2042
- "[": 0.34,
2043
- "]": 0.34,
2044
- " ": 0.28
2045
- }, pn = {
2046
- m: 0.85,
2047
- w: 0.74,
2048
- M: 0.83,
2049
- W: 0.86,
2050
- "@": 0.92
2051
- };
2052
- function wa(t) {
2053
- if (t in dn) return dn[t];
2054
- if (t in pn) return pn[t];
2055
- const e = t.charCodeAt(0);
2056
- return e >= 48 && e <= 57 ? 0.57 : e >= 65 && e <= 90 ? 0.66 : e >= 97 && e <= 122 ? 0.53 : e >= 33 && e <= 126 ? 0.5 : e > 11904 ? 1 : 0.55;
2057
- }
2058
- function ba(t) {
2059
- return !!t && va.test(t);
2060
- }
2061
- function Ea(t, e, n) {
2062
- if (!t) return 0;
2063
- if (ba(e))
2064
- return t.length * n * _a;
2065
- let r = 0;
2066
- for (const i of t) r += wa(i);
2067
- return r * n;
2068
- }
2069
- function $a(t, e, n) {
2070
- const o = (t.clientWidth || 800) / e, s = 32 / (n * o);
2071
- return Math.max(3, s);
2072
- }
2073
- function Me(t, e, n) {
2074
- const r = t.attr("font-family") || void 0, i = parseFloat(t.attr("font-size") || "12") || 12, a = (l) => Ea(l, r, i);
2075
- if (t.text(n), a(n) <= e) return;
2076
- const o = "...";
2077
- let s = 0, c = n.length;
2078
- for (; s < c; ) {
2079
- const l = Math.floor((s + c + 1) / 2);
2080
- a(n.slice(0, l) + o) <= e ? s = l : c = l - 1;
2081
- }
2082
- s > 0 ? t.text(n.slice(0, s) + o) : t.text(o);
2083
- }
2084
- class On {
2085
- constructor(e, n, r, i, a) {
2086
- this.type = e, this._gvid = n, this.name = r, this._draw_ = i, this._ldraw_ = a;
2087
- }
2088
- }
2089
- class Hn extends On {
2090
- // Reference to the edge this virtual node represents
2091
- constructor({
2092
- _gvid: e,
2093
- name: n,
2094
- _draw_: r,
2095
- _ldraw_: i,
2096
- bb: a,
2097
- pos: o,
2098
- width: s,
2099
- height: c,
2100
- label: l
2101
- }) {
2102
- super("node", e, n, r, i), this.virtualNode = !1, this.bb = a, this.pos = o, this.width = s, this.height = c, this.label = l;
2103
- }
2104
- /**
2105
- * Get parsed position as [x, y] coordinates
2106
- */
2107
- getPosition() {
2108
- if (!this.pos) return null;
2109
- const [e, n] = this.pos.split(",").map(Number);
2110
- return [e, n];
2111
- }
2112
- /**
2113
- * Get width in points (1 inch = 72 points)
2114
- */
2115
- getWidthPoints() {
2116
- return parseFloat(this.width || "1") * 72;
2117
- }
2118
- /**
2119
- * Get height in points (1 inch = 72 points)
2120
- */
2121
- getHeightPoints() {
2122
- return parseFloat(this.height || "0.5") * 72;
2123
- }
2124
- /**
2125
- * Get bounding box coordinates (x, y is top-left corner)
2126
- * Note: Graphviz pos is center, so we calculate top-left
2127
- */
2128
- getBounds() {
2129
- const e = this.getPosition();
2130
- if (!e) return null;
2131
- const [n, r] = e, i = this.getWidthPoints(), a = this.getHeightPoints();
2132
- return {
2133
- x: n - i / 2,
2134
- y: r - a / 2,
2135
- width: i,
2136
- height: a
2137
- };
2138
- }
2139
- /**
2140
- * Left side input point (1/4 from top)
2141
- */
2142
- leftIn() {
2143
- const e = this.getBounds();
2144
- return e ? {
2145
- x: e.x,
2146
- y: Math.trunc(e.y + e.height / 4)
2147
- } : null;
2148
- }
2149
- /**
2150
- * Left side output point (3/4 from top)
2151
- */
2152
- leftOut() {
2153
- const e = this.getBounds();
2154
- return e ? {
2155
- x: e.x,
2156
- y: Math.trunc(e.y + e.height / 4 * 3)
2157
- } : null;
2158
- }
2159
- /**
2160
- * Right side output point (1/4 from top)
2161
- */
2162
- rightOut() {
2163
- const e = this.getBounds();
2164
- return e ? {
2165
- x: e.x + e.width,
2166
- y: Math.trunc(e.y + e.height / 4)
2167
- } : null;
2168
- }
2169
- /**
2170
- * Right side input point (3/4 from top)
2171
- */
2172
- rightIn() {
2173
- const e = this.getBounds();
2174
- return e ? {
2175
- x: e.x + e.width,
2176
- y: Math.trunc(e.y + e.height / 4 * 3)
2177
- } : null;
2178
- }
2179
- }
2180
- class Na extends On {
2181
- constructor({
2182
- _gvid: e,
2183
- name: n,
2184
- _draw_: r,
2185
- _ldraw_: i,
2186
- _hdraw_: a,
2187
- _tdraw_: o,
2188
- head: s,
2189
- tail: c,
2190
- label: l
2191
- }) {
2192
- if (super("edge", e, n, r, i), this.isBaseEdge = !1, this.depth = 0, this.baseOffset = 0, this.midY = 0, this._hdraw_ = a, this._tdraw_ = o, this.head = s, this.tail = c, this.label = l, l)
2193
- try {
2194
- this.edgeContent = ge(l), this.edgeIndex = this.edgeContent.index, this.edgeColor = this.edgeContent.color;
2195
- } catch (u) {
2196
- console.warn(`Failed to decode edge label for ${n}:`, u);
2197
- }
2198
- }
2199
- /**
2200
- * Set the source and target node references
2201
- */
2202
- setNodes(e, n) {
2203
- this.sourceNode = e, this.targetNode = n;
2204
- }
2205
- /**
2206
- * Determine edge direction based on source/target node positions
2207
- * - "right": source is left of target (edge goes left → right)
2208
- * - "left": source is right of target (edge goes right → left)
2209
- * - "self": source and target are the same node
2210
- */
2211
- getDirection() {
2212
- if (!this.sourceNode || !this.targetNode) return null;
2213
- const e = this.sourceNode.getPosition(), n = this.targetNode.getPosition();
2214
- return !e || !n ? null : this.sourceNode._gvid === this.targetNode._gvid ? "self" : e[0] < n[0] ? "right" : "left";
2215
- }
2216
- /**
2217
- * Get the start point (source port) based on edge direction
2218
- * - Right edge: source node's rightOut
2219
- * - Left edge: source node's leftOut
2220
- * - Self-loop: source node's leftOut
2221
- */
2222
- getStartPoint() {
2223
- if (!this.sourceNode) return null;
2224
- const e = this.getDirection();
2225
- if (!e) return null;
2226
- switch (e) {
2227
- case "right":
2228
- return this.sourceNode.rightOut();
2229
- case "left":
2230
- return this.sourceNode.leftOut();
2231
- case "self":
2232
- return this.sourceNode.leftOut();
2233
- }
2234
- }
2235
- /**
2236
- * Get the end point (target port) based on edge direction
2237
- * - Right edge: target node's leftIn
2238
- * - Left edge: target node's rightIn
2239
- * - Self-loop: target node's rightIn
2240
- */
2241
- getEndPoint() {
2242
- if (!this.targetNode) return null;
2243
- const e = this.getDirection();
2244
- if (!e) return null;
2245
- switch (e) {
2246
- case "right":
2247
- return this.targetNode.leftIn();
2248
- case "left":
2249
- return this.targetNode.rightIn();
2250
- case "self":
2251
- return this.targetNode.rightIn();
2252
- }
2253
- }
2254
- /**
2255
- * Get the label text for this edge
2256
- * Priority: edgeContent.text > parsed label > _ldraw_ operations
2257
- * @returns The label text or null if no label
2258
- */
2259
- getLabelText() {
2260
- var e;
2261
- if ((e = this.edgeContent) != null && e.elems && this.edgeContent.elems.length > 0)
2262
- return this.edgeContent.elems.map((n) => n.text).join(" ");
2263
- if (this.label)
2264
- return this.label.replace(/<[^>]*>/g, " ").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim() || null;
2265
- if (this._ldraw_) {
2266
- const n = [];
2267
- if (this._ldraw_.forEach((r) => {
2268
- r.op === "T" && r.text && n.push(r.text);
2269
- }), n.length > 0)
2270
- return n.join(" ");
2271
- }
2272
- return null;
2273
- }
2274
- /**
2275
- * Get the stroke color for this edge
2276
- * Priority: edgeColor from EdgeContent > _draw_ operations > default
2277
- * @returns The color string or default gray if not found
2278
- */
2279
- getColor() {
2280
- const e = "#9AA4B2";
2281
- if (this.edgeColor)
2282
- return this.edgeColor;
2283
- if (this._draw_) {
2284
- for (const n of this._draw_)
2285
- if (n.op === "c" && n.color)
2286
- return n.color;
2287
- }
2288
- if (this._hdraw_) {
2289
- for (const n of this._hdraw_)
2290
- if (n.op === "c" && n.color)
2291
- return n.color;
2292
- }
2293
- return e;
2294
- }
2295
- }
2296
- class Xn {
2297
- constructor(e, n = 0) {
2298
- this.index = e, this.aboveY = n, this.belowY = n;
2299
- }
2300
- /** Allocate space above current aboveY, returns the new Y position */
2301
- allocateAbove(e) {
2302
- return this.aboveY -= e, this.aboveY;
2303
- }
2304
- /** Allocate space below current belowY, returns the new Y position */
2305
- allocateBelow(e) {
2306
- const n = this.belowY;
2307
- return this.belowY += e, n;
2308
- }
2309
- /** Get the current range of allocated Y coordinates */
2310
- getRange() {
2311
- return { above: this.aboveY, below: this.belowY };
2312
- }
2313
- }
2314
- class Ca extends Xn {
2315
- constructor(e, n = 0) {
2316
- super(e, n), this.nodes = [];
2317
- }
2318
- addNode(e, n = !0) {
2319
- if (this.nodes.push(e), !n) return;
2320
- const r = e.getPosition();
2321
- if (r) {
2322
- const i = e.height ? parseFloat(e.height) * 72 : 40, a = r[1] - i / 2, o = r[1] + i / 2;
2323
- this.aboveY = Math.min(this.aboveY, a), this.belowY = Math.max(this.belowY, o);
2324
- }
2325
- }
2326
- }
2327
- class ka extends Xn {
2328
- constructor(e, n, r = 0) {
2329
- super(Math.min(e, n), r), this.edges = [], this.baseEdgeIndex = -1, this.sourceColIndex = e, this.targetColIndex = n;
2330
- }
2331
- addEdge(e) {
2332
- this.edges.push(e);
2333
- }
2334
- /** Set the base edge for this column */
2335
- setBaseEdge(e, n) {
2336
- this.baseEdge = e, this.baseEdgeIndex = n ?? this.edges.indexOf(e);
2337
- }
2338
- /** Get the key for this edge column */
2339
- getKey() {
2340
- const e = Math.min(this.sourceColIndex, this.targetColIndex), n = Math.max(this.sourceColIndex, this.targetColIndex);
2341
- return `${e}-${n}`;
2342
- }
2343
- }
2344
- function Aa(t) {
2345
- if (!t) return [];
2346
- const e = [], n = /<TD[^>]*>(.*?)<\/TD>/gi;
2347
- let r;
2348
- for (; (r = n.exec(t)) !== null; ) {
2349
- let i = r[1];
2350
- i = i.replace(/<[^>]+>/g, "").trim(), i && e.push(i);
2351
- }
2352
- if (e.length === 0) {
2353
- const i = t.replace(/<[^>]+>/g, "").trim();
2354
- i && e.push(i);
2355
- }
2356
- return e;
2357
- }
2358
- function Ra(t) {
2359
- const e = V(t).select("svg"), n = e.select("g#graph0");
2360
- if (e.empty() || n.empty()) {
2361
- console.warn("SVG or graph group not found");
2362
- return;
2363
- }
2364
- e.attr("width", "100%").attr("height", "100%");
2365
- const r = qe().scaleExtent([0.1, 2]).on("zoom", (o) => {
2366
- n.attr("transform", o.transform.toString());
2367
- });
2368
- e.call(r);
2369
- const i = e.node(), a = n.node();
2370
- if (i && a) {
2371
- const o = a.getBBox(), s = i.parentElement;
2372
- if (s) {
2373
- const c = s.clientWidth, l = s.clientHeight, u = o.width, h = o.height, d = o.x + u / 2, m = o.y + h / 2, A = 0.8 / Math.max(u / c, h / l), _ = [
2374
- c / 2 - A * d,
2375
- l / 2 - A * m
2376
- ];
2377
- e.call(
2378
- r.transform,
2379
- Ht.translate(_[0], _[1]).scale(A)
2380
- );
2381
- }
2382
- }
2383
- }
2384
- function Ma(t) {
2385
- if (!t.sourceNode) return null;
2386
- const e = t.sourceNode.getPosition();
2387
- if (!e) return null;
2388
- const r = 50 / 72, i = new Hn({
2389
- _gvid: -1e3 - t._gvid,
2390
- // Negative ID to distinguish from real nodes
2391
- name: `virtual_edge_${t._gvid}`,
2392
- label: t.label,
2393
- pos: `${e[0]},${e[1]}`,
2394
- // Same position as source node
2395
- width: "0.5",
2396
- // Small width
2397
- height: r.toString()
2398
- // Height matches node spacing
2399
- });
2400
- return i.virtualNode = !0, i.edge = t, t.virtualNode = i, i;
2401
- }
2402
- function Sa(t, e, n) {
2403
- const r = e.nodes, i = r.findIndex((a) => a._gvid === n._gvid);
2404
- if (i === -1) {
2405
- r.push(t);
2406
- return;
2407
- }
2408
- r.splice(i, 0, t);
2409
- }
2410
- function Ia(t, e) {
2411
- const r = [], i = /* @__PURE__ */ new Map();
2412
- t.forEach((l) => {
2413
- const u = l.getPosition();
2414
- if (!u) return;
2415
- const h = u[0];
2416
- let d = r.findIndex(
2417
- (m) => Math.abs(h - m) <= 20
2418
- );
2419
- d === -1 && (d = r.length, r.push(h)), i.set(l._gvid, d);
2420
- });
2421
- const a = r.map((l, u) => ({ x: l, i: u })).sort((l, u) => l.x - u.x).map((l, u) => ({ oldIndex: l.i, newIndex: u })), o = /* @__PURE__ */ new Map();
2422
- a.forEach(({ oldIndex: l, newIndex: u }) => {
2423
- o.set(l, u);
2424
- });
2425
- for (const [l, u] of i)
2426
- i.set(l, o.get(u) ?? u);
2427
- const s = /* @__PURE__ */ new Map();
2428
- t.forEach((l) => {
2429
- const u = i.get(l._gvid);
2430
- u !== void 0 && (s.has(u) || s.set(u, new Ca(u, 0)), s.get(u).addNode(l, !1));
2431
- }), e.forEach((l) => {
2432
- if (!l.sourceNode || !l.targetNode || l.sourceNode._gvid !== l.targetNode._gvid) return;
2433
- const u = i.get(l.sourceNode._gvid);
2434
- if (u === void 0) return;
2435
- const h = s.get(u);
2436
- if (!h) return;
2437
- const d = Ma(l);
2438
- d && Sa(d, h, l.sourceNode);
2439
- });
2440
- const c = /* @__PURE__ */ new Map();
2441
- return e.forEach((l) => {
2442
- if (!l.sourceNode || !l.targetNode) return;
2443
- const u = i.get(l.sourceNode._gvid), h = i.get(l.targetNode._gvid);
2444
- if (u === void 0 || h === void 0) return;
2445
- l.depth = Math.abs(h - u) - 1, l.depth < 0 && (l.depth = 0);
2446
- const d = Math.min(u, h), m = Math.max(u, h), A = `${d}-${m}`;
2447
- c.has(A) || c.set(A, new ka(u, h, 0)), c.get(A).addEdge(l);
2448
- }), c.forEach((l) => {
2449
- l.edges.sort((u, h) => {
2450
- const d = u.getStartPoint(), m = u.getEndPoint(), A = d && m ? (d.y + m.y) / 2 : 0, _ = h.getStartPoint(), S = h.getEndPoint();
2451
- return (_ && S ? (_.y + S.y) / 2 : 0) - A;
2452
- });
2453
- }), { nodeColumnMap: i, nodeColumns: s, edgeColumns: c };
2454
- }
2455
- function Pa(t, e) {
2456
- t.forEach((n) => {
2457
- if (n.nodes.length === 0) return;
2458
- let r = !0;
2459
- n.nodes.forEach((i) => {
2460
- const a = i.getPosition();
2461
- if (!a) return;
2462
- const o = i.height ? parseFloat(i.height) * 72 : 40, s = e - a[1], c = s - o / 2, l = s + o / 2;
2463
- r ? (n.aboveY = c, n.belowY = l, r = !1) : (n.aboveY = Math.min(n.aboveY, c), n.belowY = Math.max(n.belowY, l));
2464
- });
2465
- });
2466
- }
2467
- function Ya(t, e) {
2468
- t.length !== 0 && e.forEach((n) => {
2469
- const r = n.edges;
2470
- if (r.length === 0) return;
2471
- const i = r.filter((h) => h.depth === 0);
2472
- if (i.length === 0) return;
2473
- const a = Math.floor(i.length / 2), o = i[a];
2474
- o.isBaseEdge = !0, o.baseDirection = void 0;
2475
- const s = r.indexOf(o);
2476
- n.setBaseEdge(o, s);
2477
- const c = o.getStartPoint(), l = o.getEndPoint(), u = c && l ? (c.y + l.y) / 2 : 0;
2478
- i.forEach((h) => {
2479
- if (h === o) return;
2480
- const d = h.getStartPoint(), m = h.getEndPoint();
2481
- (d && m ? (d.y + m.y) / 2 : 0) > u ? h.baseDirection = "above" : h.baseDirection = "below";
2482
- });
2483
- });
2484
- }
2485
- function ue(t, e, n, r = Ne) {
2486
- const i = t.getStartPoint(), a = t.getEndPoint(), o = t.getDirection();
2487
- if (!i || !a || !o || o === "self")
2488
- return;
2489
- const s = { x: i.x, y: e - i.y }, c = { x: a.x, y: e - a.y };
2490
- let l = { x: c.x, y: c.y };
2491
- o === "right" ? l = { x: c.x - r.arrowWidth, y: c.y } : o === "left" && (l = { x: c.x + r.arrowWidth, y: c.y });
2492
- const u = r.horizontalExtension, h = r.minEdgeDistance, d = r.minVerticalSegment, m = (E) => {
2493
- if (E.length < 2) return E;
2494
- const $ = [E[0]];
2495
- for (let G = 1; G < E.length; G++) {
2496
- const dt = $[$.length - 1];
2497
- (Math.abs(E[G].x - dt.x) > 0.1 || Math.abs(E[G].y - dt.y) > 0.1) && $.push(E[G]);
2498
- }
2499
- return $;
2500
- };
2501
- let A;
2502
- const _ = t.baseDirection === void 0;
2503
- t.baseDirection === "above" ? A = Math.min(s.y, l.y) : t.baseDirection === "below" ? A = Math.max(s.y, l.y) : A = (s.y + l.y) / 2;
2504
- let S = A;
2505
- if (!_ && n && n.midY !== void 0) {
2506
- if (t.baseDirection === "above") {
2507
- const E = n.midY - h;
2508
- S > E && (S = E);
2509
- } else if (t.baseDirection === "below") {
2510
- const E = n.midY + h;
2511
- S < E && (S = E);
2512
- }
2513
- }
2514
- const w = Math.abs(s.y - l.y) < 5, ot = (E, $) => {
2515
- const G = Math.abs(s.y - $), dt = Math.abs($ - l.y), et = o === "right" ? s.x + u : s.x - u, b = o === "right" ? l.x - u : l.x + u;
2516
- let J = [], Z = $;
2517
- switch (E) {
2518
- case "straight":
2519
- if (w) {
2520
- const y = (s.y + l.y) / 2;
2521
- Math.abs($ - y) < d ? (J = [s, l], Z = y) : (J = [
2522
- s,
2523
- { x: et, y: s.y },
2524
- // H: horizontal extension
2525
- { x: et, y: $ },
2526
- // V: vertical to midY
2527
- { x: b, y: $ },
2528
- // H: horizontal at midY
2529
- { x: b, y: l.y },
2530
- // V: vertical to end
2531
- l
2532
- // H: horizontal to end
2533
- ], Z = $);
2534
- } else
2535
- return null;
2536
- break;
2537
- case "2seg":
2538
- G < dt ? Math.abs($ - s.y) < d ? (J = [s, { x: l.x, y: s.y }, l], Z = s.y) : (J = [
2539
- s,
2540
- { x: et, y: s.y },
2541
- // H: horizontal extension
2542
- { x: et, y: $ },
2543
- // V: vertical to midY
2544
- { x: b, y: $ },
2545
- // H: horizontal at midY
2546
- { x: b, y: l.y },
2547
- // V: vertical to end
2548
- l
2549
- // H: horizontal to end
2550
- ], Z = $) : Math.abs($ - l.y) < d ? (J = [
2551
- s,
2552
- { x: et, y: s.y },
2553
- // H: horizontal extension
2554
- { x: et, y: l.y },
2555
- // V: vertical to end.y
2556
- l
2557
- // H: horizontal to end
2558
- ], Z = l.y) : (J = [
2559
- s,
2560
- { x: et, y: s.y },
2561
- // H: horizontal extension
2562
- { x: et, y: $ },
2563
- // V: vertical to midY
2564
- { x: b, y: $ },
2565
- // H: horizontal at midY
2566
- { x: b, y: l.y },
2567
- // V: vertical to end
2568
- l
2569
- // H: horizontal to end
2570
- ], Z = $);
2571
- break;
2572
- case "3seg":
2573
- const f = $;
2574
- J = [
2575
- s,
2576
- { x: et, y: s.y },
2577
- { x: et, y: f },
2578
- { x: b, y: f },
2579
- { x: b, y: l.y },
2580
- l
2581
- ], Z = f;
2582
- break;
2583
- case "4seg":
2584
- J = [
2585
- s,
2586
- { x: et, y: s.y },
2587
- // H: horizontal extension from start
2588
- { x: et, y: $ },
2589
- // V: vertical to midY
2590
- { x: b, y: $ },
2591
- // H: horizontal at midY to end extension
2592
- l
2593
- // Final segment (may be H or V depending on pathEnd.y vs testMidY)
2594
- ], Z = $;
2595
- break;
2596
- case "5seg":
2597
- if (G < d)
2598
- J = [
2599
- s,
2600
- { x: et, y: s.y },
2601
- // H: horizontal extension
2602
- { x: b, y: $ },
2603
- // H: horizontal at midY (skip V since start.y ≈ testMidY)
2604
- { x: b, y: l.y },
2605
- // V: vertical to end Y
2606
- l
2607
- // H: horizontal to end
2608
- ], Z = $;
2609
- else if (dt < d)
2610
- J = [
2611
- s,
2612
- { x: et, y: s.y },
2613
- // H: horizontal extension
2614
- { x: et, y: $ },
2615
- // V: vertical to midY
2616
- { x: b, y: $ },
2617
- // H: horizontal at midY
2618
- l
2619
- // H: horizontal to end (skip V since testMidY ≈ pathEnd.y)
2620
- ], Z = $;
2621
- else
2622
- return null;
2623
- break;
2624
- case "6seg":
2625
- J = [
2626
- s,
2627
- { x: et, y: s.y },
2628
- { x: et, y: $ },
2629
- { x: b, y: $ },
2630
- { x: b, y: l.y },
2631
- l
2632
- ], Z = $;
2633
- break;
2634
- }
2635
- const I = m(J);
2636
- return I.length > 0 ? { points: I, actualMidY: Z } : null;
2637
- };
2638
- let lt;
2639
- _ ? lt = w ? ["straight", "3seg"] : ["3seg"] : lt = w ? ["straight", "3seg", "4seg", "5seg", "6seg"] : ["3seg", "4seg", "5seg", "6seg"];
2640
- for (const E of lt) {
2641
- const $ = ot(E, S);
2642
- if ($)
2643
- return { midY: $.actualMidY, points: $.points };
2644
- }
2645
- const B = ot("6seg", S);
2646
- return B ? { midY: B.actualMidY, points: B.points } : void 0;
2647
- }
2648
- function gn(t, e) {
2649
- if (t.length < 2) return "";
2650
- if (e === 0 || t.length === 2)
2651
- return `M${t[0].x},${t[0].y} ${t.slice(1).map((i) => `L${i.x},${i.y}`).join(" ")}`;
2652
- const n = [];
2653
- n.push(`M${t[0].x},${t[0].y}`);
2654
- for (let i = 1; i < t.length - 1; i++) {
2655
- const a = t[i - 1], o = t[i], s = t[i + 1], c = Math.sqrt((o.x - a.x) ** 2 + (o.y - a.y) ** 2), l = Math.sqrt((s.x - o.x) ** 2 + (s.y - o.y) ** 2), u = Math.min(c, l) / 2, h = Math.min(e, u);
2656
- if (h > 0) {
2657
- const d = h / c, m = h / l, A = {
2658
- x: o.x - (o.x - a.x) * d,
2659
- y: o.y - (o.y - a.y) * d
2660
- }, _ = {
2661
- x: o.x + (s.x - o.x) * m,
2662
- y: o.y + (s.y - o.y) * m
2663
- };
2664
- n.push(`L${A.x},${A.y}`), n.push(`Q${o.x},${o.y} ${_.x},${_.y}`);
2665
- } else
2666
- n.push(`L${o.x},${o.y}`);
2667
- }
2668
- const r = t[t.length - 1];
2669
- return n.push(`L${r.x},${r.y}`), n.join(" ");
2670
- }
2671
- function Ta(t, e, n, r = Ne, i = !0, a, o, s, c, l, u, h, d = !1, m, A) {
2672
- var $, G, dt, et;
2673
- const _ = u != null && t.edgeIndex === u, S = t.getColor(), w = e.append("g").attr("class", _ ? "edge selected" : "edge").attr("id", `edge_${t._gvid}`).attr("data-edge-id", t.edgeIndex !== void 0 ? String(t.edgeIndex) : "").attr("data-is-base", t.isBaseEdge ? "true" : "false").attr("data-color", S).attr("data-source-node-id", (($ = t.sourceNode) == null ? void 0 : $.name) || "").attr("data-target-node-id", ((G = t.targetNode) == null ? void 0 : G.name) || ""), ot = t.getStartPoint(), lt = t.getEndPoint(), B = t.getDirection(), E = r.arrowWidth;
2674
- if (ot && lt && B) {
2675
- const b = { x: ot.x, y: n - ot.y }, J = { x: lt.x, y: n - lt.y }, Z = { x: J.x, y: J.y };
2676
- let I = { x: J.x, y: J.y };
2677
- B === "right" ? I = { x: J.x - E, y: J.y } : B === "left" ? I = { x: J.x + E, y: J.y } : B === "self" && (I = { x: J.x + E, y: J.y });
2678
- let f;
2679
- const y = r.loopRadius, p = r.horizontalExtension, N = r.cornerRadius;
2680
- if (i)
2681
- if (B === "self")
2682
- if (t.virtualNode) {
2683
- const v = t.virtualNode.getPosition();
2684
- if (v) {
2685
- const H = n - v[1];
2686
- t.midY = H;
2687
- const tt = [
2688
- b,
2689
- // leftOut of source node
2690
- { x: b.x - p, y: b.y },
2691
- // Extend left
2692
- { x: b.x - p, y: H },
2693
- // Go to virtual node height
2694
- { x: I.x + p, y: H },
2695
- // Horizontal segment through virtual node
2696
- { x: I.x + p, y: I.y },
2697
- // Go down to rightIn
2698
- I
2699
- // rightIn of source node
2700
- ];
2701
- f = gn(tt, N);
2702
- } else {
2703
- const H = b.x - y, tt = b.y - y, j = I.x + y, g = I.y - y;
2704
- f = `M${b.x},${b.y} C${H},${tt} ${j},${g} ${I.x},${I.y}`;
2705
- }
2706
- } else {
2707
- const v = b.x - y, H = b.y - y, tt = I.x + y, j = I.y - y;
2708
- f = `M${b.x},${b.y} C${v},${H} ${tt},${j} ${I.x},${I.y}`;
2709
- }
2710
- else {
2711
- let v;
2712
- if (t.orthogonalPathPoints && t.orthogonalPathPoints.length > 0)
2713
- v = t.orthogonalPathPoints;
2714
- else {
2715
- const H = Math.abs(b.y - t.midY), tt = Math.abs(t.midY - I.y), j = 20, g = H >= j, x = tt >= j, F = B === "right" ? b.x + p : b.x - p, C = B === "right" ? I.x - p : I.x + p;
2716
- if (v = [], !g && !x) {
2717
- const W = (b.y + I.y) / 2;
2718
- v.push(
2719
- b,
2720
- { x: F, y: W },
2721
- { x: C, y: W },
2722
- I
2723
- );
2724
- } else g ? x ? v.push(
2725
- b,
2726
- { x: F, y: b.y },
2727
- { x: F, y: t.midY },
2728
- { x: C, y: t.midY },
2729
- { x: C, y: I.y },
2730
- I
2731
- ) : v.push(
2732
- b,
2733
- { x: F, y: b.y },
2734
- { x: F, y: t.midY },
2735
- { x: C, y: t.midY },
2736
- I
2737
- ) : v.push(
2738
- b,
2739
- { x: F, y: t.midY },
2740
- { x: C, y: t.midY },
2741
- { x: C, y: I.y },
2742
- I
2743
- );
2744
- }
2745
- f = gn(v, N);
2746
- }
2747
- else if (B === "self") {
2748
- const v = b.x - y, H = b.y - y, tt = I.x + y, j = I.y - y;
2749
- f = `M${b.x},${b.y} C${v},${H} ${tt},${j} ${I.x},${I.y}`;
2750
- } else {
2751
- const v = I.x - b.x, H = 0.4, tt = b.x + v * H, j = b.y, g = I.x - v * H, x = I.y;
2752
- f = `M${b.x},${b.y} C${tt},${j} ${g},${x} ${I.x},${I.y}`;
2753
- }
2754
- const P = d && t.isBaseEdge ? "#000000" : t.getColor(), D = d && t.isBaseEdge ? 4 : 1.5;
2755
- w.append("path").attr("d", f).attr("fill", "none").attr("stroke", "transparent").attr("stroke-width", 10).attr("class", "edge-hit-area").style("cursor", "pointer"), w.append("path").attr("d", f).attr("fill", "none").attr("stroke", P).attr("stroke-width", D).attr("class", "edge-path").style("pointer-events", "none"), w.on("mouseenter", function() {
2756
- V(this).raise();
2757
- const v = V(this).select(".arrow-group");
2758
- if (!v.empty()) {
2759
- const F = v.attr("data-base-transform") || "";
2760
- v.attr("transform", F + " scale(1.3)");
2761
- }
2762
- const H = e.select(".edge.selected").size() > 0, tt = V(this).classed("selected"), j = V(this).attr("data-source-node-id"), g = V(this).attr("data-target-node-id"), x = V(this).attr("id");
2763
- H && !tt ? (V(this).classed("hover-highlight", !0), e.selectAll(".node").each(function() {
2764
- const F = V(this).attr("data-node-id");
2765
- (F === j || F === g) && V(this).classed("hover-highlight", !0);
2766
- })) : (e.selectAll(".edge").each(function() {
2767
- V(this).attr("id") !== x && V(this).classed("dimmed", !0);
2768
- }), e.selectAll(".node").each(function() {
2769
- const F = V(this).attr("data-node-id");
2770
- F !== j && F !== g && V(this).classed("dimmed", !0);
2771
- }));
2772
- }).on("mouseleave", function() {
2773
- const v = V(this).select(".arrow-group");
2774
- if (!v.empty()) {
2775
- const H = v.attr("data-base-transform") || "";
2776
- v.attr("transform", H);
2777
- }
2778
- e.selectAll(".edge.hover-highlight").classed("hover-highlight", !1), e.selectAll(".node.hover-highlight").classed("hover-highlight", !1), e.selectAll(".edge.dimmed").classed("dimmed", !1), e.selectAll(".node.dimmed").classed("dimmed", !1);
2779
- });
2780
- const T = 12;
2781
- let q = "";
2782
- B === "right" ? q = `translate(${Z.x - T / 2}, ${Z.y})` : B === "left" ? q = `translate(${Z.x + T / 2}, ${Z.y}) rotate(180)` : B === "self" && (q = `translate(${Z.x + T / 2}, ${Z.y}) rotate(180)`), w.append("g").attr("class", "arrow-group").attr("transform", q).attr("data-base-transform", q).append("use").attr("class", "edge-arrow").attr("href", "#arrow-right").attr("width", T).attr("height", T).attr("x", -T / 2).attr("y", -T / 2).attr("fill", P).attr("stroke", P).style("stroke-width", 0);
2783
- const nt = {
2784
- x: (b.x + I.x) / 2,
2785
- y: t.midY
2786
- };
2787
- if (w.attr("data-label-center-x", nt.x).attr("data-label-center-y", nt.y), t.label) {
2788
- let v = "";
2789
- (dt = t.edgeContent) != null && dt.elems && t.edgeContent.elems.length > 0 && (v = t.edgeContent.elems.map((Y) => Y.text).join(" ")), v || (v = Aa(t.label).map((ut) => ut.length > 20 ? ut.slice(0, 20) + "..." : ut).join(" "));
2790
- const H = v.length > 60 ? v.slice(0, 60) + "..." : v, tt = r.labelFontSize, j = tt * 0.6, g = H.length * j, x = tt, F = r.labelPadding, C = 16, W = _ ? 16 : 0, O = t.edgeIndex !== void 0, k = O && m !== void 0 && m(t.edgeIndex) !== void 0, U = O && A !== void 0 && A(t.edgeIndex) !== void 0, X = (k ? C : 0) + (U ? C : 0) + W, M = g + F * 2 + X, ht = x + F * 2, pt = r.labelCornerRadius, K = nt.y, R = nt.x, Q = (Y) => V(`g.edge[data-edge-id="${Y}"]`), L = 12, z = w.append("g").attr("class", "label-area");
2791
- z.append("rect").attr("class", "label-bg").attr("x", R - M / 2).attr("y", K - ht / 2).attr("width", M).attr("height", ht).attr("rx", 5).attr("ry", 5).attr("fill", "var(--bg-primary, #fff)").attr("stroke", "var(--border-primary, #CDCFD5)").attr("stroke-width", 1.5);
2792
- const Et = R - M / 2 + C / 2, at = R + M / 2 - C / 2 - W, gt = R + M / 2 - W / 2, it = R + (k ? C / 2 : 0) - (U ? C / 2 : 0) - (_ ? W / 2 : 0);
2793
- if (O && h && w.style("cursor", "pointer").on("click", function(Y) {
2794
- Y.stopPropagation(), !_ && h(t.edgeIndex);
2795
- }), (et = t.edgeContent) != null && et.elems && t.edgeContent.elems.length > 0) {
2796
- const vt = t.edgeContent.elems.map((ft) => {
2797
- const rt = ft.text.length * 6.2, st = ft.background && ft.background !== "transparent", xt = rt + 2;
2798
- return { textWidth: rt, hasBackground: st, totalWidth: xt };
2799
- }), $t = vt.reduce((ft, rt, st) => ft + rt.totalWidth + (st > 0, 0), 0);
2800
- let wt = it - $t / 2;
2801
- t.edgeContent.elems.forEach((ft, rt) => {
2802
- const st = vt[rt];
2803
- rt > 0 && (wt += 0), st.hasBackground && z.append("rect").attr("x", wt).attr("y", K - 10 / 2 - 2).attr("width", st.totalWidth).attr("height", 14).attr("rx", 2).attr("ry", 2).attr("fill", ft.background).style("pointer-events", "none"), z.append("text").attr("class", "label-text-elem").attr("x", wt + 1).attr("y", K).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "Inter, Helvetica, Arial").attr("font-size", "10px").attr("font-weight", "500").attr("fill", ft.color && ft.color.length > 0 ? ft.color : P).style("pointer-events", "none").text(ft.text), wt += st.totalWidth;
2804
- });
2805
- } else
2806
- z.append("text").attr("class", "label-text").attr("x", it).attr("y", K).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "Inter, Helvetica, Arial").attr("font-size", "10px").attr("fill", P).style("pointer-events", "none").text(H);
2807
- if (d && w.append("circle").attr("cx", nt.x).attr("cy", nt.y).attr("r", 4).attr("fill", "blue").attr("opacity", 0.8).style("pointer-events", "none").attr("class", "debug-label-center"), k && m) {
2808
- const Y = m(t.edgeIndex), ut = z.append("g").attr("class", "nav-btn-group prev-btn-group");
2809
- ut.append("rect").attr("class", "nav-btn-area prev-btn-area").attr("x", R - M / 2).attr("y", K - ht / 2).attr("width", C).attr("height", ht).attr("fill", "transparent").attr("rx", pt).style("cursor", "pointer").style("pointer-events", "all"), ut.append("use").attr("class", "nav-icon prev-icon").attr("href", "#nav-left").attr("x", Et - L / 2).attr("y", K - L / 2).attr("width", L).attr("height", L).attr("fill", "#888"), ut.on("click", function(mt) {
2810
- mt.stopPropagation();
2811
- const yt = Q(Y);
2812
- if (!yt.empty()) {
2813
- if (a && o && s && c && l) {
2814
- const Nt = yt.node();
2815
- if (Nt) {
2816
- const vt = V(Nt), $t = vt.attr("data-label-center-x"), wt = vt.attr("data-label-center-y");
2817
- let ft, rt;
2818
- if ($t && wt)
2819
- ft = parseFloat($t), rt = parseFloat(wt);
2820
- else {
2821
- const Wt = vt.select(".debug-label-center").node(), Dt = vt.select(".label-text").node();
2822
- if (Wt)
2823
- ft = parseFloat(Wt.getAttribute("cx") || "0"), rt = parseFloat(Wt.getAttribute("cy") || "0");
2824
- else if (Dt)
2825
- ft = parseFloat(Dt.getAttribute("x") || "0"), rt = parseFloat(Dt.getAttribute("y") || "0");
2826
- else {
2827
- const Tt = Nt.getBBox();
2828
- ft = Tt.x + Tt.width / 2, rt = Tt.y + Tt.height / 2;
2829
- }
2830
- }
2831
- const st = s.clientWidth, xt = 1.2 * c / st, Ct = c / 2 - ft * xt, Xt = l / 2 - rt * xt, ie = o.select("g");
2832
- ie.selectAll("g.edge, g.node").style("pointer-events", "none"), o.transition().duration(500).call(
2833
- a.transform,
2834
- Ht.translate(Ct, Xt).scale(xt)
2835
- ).on("end", () => {
2836
- ie.selectAll("g.edge, g.node").style("pointer-events", null);
2837
- });
2838
- }
2839
- }
2840
- h && h(Y);
2841
- }
2842
- });
2843
- }
2844
- if (U && A && t.edgeIndex !== void 0) {
2845
- const Y = A(t.edgeIndex), ut = _ ? at : R + M / 2 - C / 2, mt = z.append("g").attr("class", "nav-btn-group next-btn-group");
2846
- mt.append("rect").attr("class", "nav-btn-area next-btn-area").attr("x", R + M / 2 - C - W).attr("y", K - ht / 2).attr("width", C).attr("height", ht).attr("fill", "transparent").attr("rx", pt).style("cursor", "pointer").style("pointer-events", "all"), mt.append("use").attr("class", "nav-icon next-icon").attr("href", "#nav-right").attr("x", ut - L / 2).attr("y", K - L / 2).attr("width", L).attr("height", L).attr("fill", "#888"), mt.on("click", function(yt) {
2847
- yt.stopPropagation();
2848
- const Nt = Q(Y);
2849
- if (!Nt.empty()) {
2850
- if (a && o && s && c && l) {
2851
- const vt = Nt.node();
2852
- if (vt) {
2853
- const $t = V(vt), wt = $t.attr("data-label-center-x"), ft = $t.attr("data-label-center-y");
2854
- let rt, st;
2855
- if (wt && ft)
2856
- rt = parseFloat(wt), st = parseFloat(ft);
2857
- else {
2858
- const Dt = $t.select(".debug-label-center").node(), Tt = $t.select(".label-text").node();
2859
- if (Dt)
2860
- rt = parseFloat(Dt.getAttribute("cx") || "0"), st = parseFloat(Dt.getAttribute("cy") || "0");
2861
- else if (Tt)
2862
- rt = parseFloat(Tt.getAttribute("x") || "0"), st = parseFloat(Tt.getAttribute("y") || "0");
2863
- else {
2864
- const oe = vt.getBBox();
2865
- rt = oe.x + oe.width / 2, st = oe.y + oe.height / 2;
2866
- }
2867
- }
2868
- const xt = s.clientWidth, Ct = 1.2 * c / xt, Xt = c / 2 - rt * Ct, ie = l / 2 - st * Ct, Wt = o.select("g");
2869
- Wt.selectAll("g.edge, g.node").style("pointer-events", "none"), o.transition().duration(500).call(
2870
- a.transform,
2871
- Ht.translate(Xt, ie).scale(Ct)
2872
- ).on("end", () => {
2873
- Wt.selectAll("g.edge, g.node").style("pointer-events", null);
2874
- });
2875
- }
2876
- }
2877
- h && h(Y);
2878
- }
2879
- });
2880
- }
2881
- _ && O && h && w.append("text").attr("class", "close-btn").attr("x", gt).attr("y", K).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "Arial").attr("font-size", "12px").attr("font-weight", "bold").attr("fill", "#888").style("cursor", "pointer").text("✕").on("mouseenter", function() {
2882
- V(this).attr("fill", "#EF4444");
2883
- }).on("mouseleave", function() {
2884
- V(this).attr("fill", "#888");
2885
- }).on("click", function(Y) {
2886
- Y.stopPropagation(), h(null);
2887
- });
2888
- } else t._ldraw_ && t._ldraw_.forEach((v) => {
2889
- if (v.op === "T" && v.text) {
2890
- const H = v.size || 10, tt = H * 0.6, j = v.text.length * tt, g = H, x = 6, F = j + x * 2, C = g + x * 2, W = 4, O = nt.y;
2891
- w.append("rect").attr("x", nt.x - F / 2).attr("y", O - C / 2).attr("width", F).attr("height", C).attr("rx", W).attr("ry", W).attr("fill", "white").attr("stroke", "#d0d0d0").attr("stroke-width", 0.5), w.append("text").attr("x", nt.x).attr("y", O).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", v.face || "Inter, Helvetica, Arial").attr("font-size", `${H}px`).attr("fill", v.color || "#666").text(v.text);
2892
- }
2893
- });
2894
- if (d) {
2895
- let v;
2896
- t.depth === 0 ? v = `d:0 dir:${t.baseDirection || "base"} off:${t.baseOffset} id:${t._gvid}` : v = `d:${t.depth} dir:${t.baseDirection || "?"} midY:${Math.round(t.midY)} id:${t._gvid}`, w.append("text").attr("x", nt.x).attr("y", nt.y + 15).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "monospace").attr("font-size", "9px").attr("fill", "#999").text(v);
2897
- }
2898
- } else
2899
- t._draw_ && t._draw_.forEach((b) => {
2900
- if (b.op === "b" && b.points) {
2901
- const J = b.points.map(([I, f]) => [I, n - f]), Z = `M${J[0][0]},${J[0][1]} C${J.slice(1).map((I) => `${I[0]},${I[1]}`).join(" ")}`;
2902
- w.append("path").attr("d", Z).attr("fill", "none").attr("stroke", b.color || "#9AA4B2").attr("stroke-width", 2);
2903
- }
2904
- }), t._hdraw_ && t._hdraw_.forEach((b) => {
2905
- if (b.op === "P" && b.points) {
2906
- const J = b.points.map(([Z, I]) => [Z, n - I]);
2907
- w.append("polygon").attr("points", J.map((Z) => Z.join(",")).join(" ")).attr("fill", b.color || "#9AA4B2");
2908
- }
2909
- }), t._ldraw_ && Bt(w, t._ldraw_, n);
2910
- }
2911
- function Se(t, e, n, r, i) {
2912
- const a = i.topLeft || 0, o = i.topRight || 0, s = i.bottomRight || 0, c = i.bottomLeft || 0;
2913
- return `
2914
- M ${t + a} ${e}
2915
- L ${t + n - o} ${e}
2916
- ${o ? `Q ${t + n} ${e} ${t + n} ${e + o}` : ""}
2917
- L ${t + n} ${e + r - s}
2918
- ${s ? `Q ${t + n} ${e + r} ${t + n - s} ${e + r}` : ""}
2919
- L ${t + c} ${e + r}
2920
- ${c ? `Q ${t} ${e + r} ${t} ${e + r - c}` : ""}
2921
- L ${t} ${e + a}
2922
- ${a ? `Q ${t} ${e} ${t + a} ${e}` : ""}
2923
- Z
2924
- `.trim().replace(/\s+/g, " ");
2925
- }
2926
- function Ba(t, e, n, r, i = !0, a = Ne, o = !0, s = 14, c = !1, l, u, h, d, m, A = !0, _ = {}) {
2927
- var j;
2928
- const S = _.headless === !0;
2929
- t.innerHTML = "";
2930
- const w = ((j = e.bb) == null ? void 0 : j.split(",").map(Number)) || [0, 0, 1e3, 800], [, , ot, lt] = w;
2931
- let B = ot;
2932
- const E = lt, $ = V(t).append("svg").attr("width", "100%").attr("height", "100%").attr("viewBox", `0 0 ${B} ${E}`);
2933
- $.append("defs").html(`
2934
- <style>
2935
- @keyframes selected-pulse {
2936
- 0%, 100% {
2937
- stroke-opacity: 1;
2938
- }
2939
- 50% {
2940
- stroke-opacity: 0.7;
2941
- }
2942
- }
2943
- .edge {
2944
- cursor: pointer;
2945
- }
2946
- .edge path {
2947
- /* No transition on dash properties to avoid conflict with animation */
2948
- }
2949
- .edge use {
2950
- transition: transform 0.2s ease;
2951
- }
2952
- .edge text {
2953
- transition: font-weight 0.2s ease;
2954
- }
2955
- /* Marching ants animation keyframe */
2956
- @keyframes marching-ants {
2957
- 0% { stroke-dashoffset: 0; }
2958
- 100% { stroke-dashoffset: -12; }
2959
- }
2960
- /* Arrow group scaling transition (JS handles actual transform) */
2961
- .edge .arrow-group {
2962
- transition: transform 0.15s ease;
2963
- }
2964
- /* Hover effect: marching ants dashed line */
2965
- .edge:hover:not(.selected) path.edge-path {
2966
- stroke-dasharray: 6 6;
2967
- stroke-width: 4px;
2968
- animation: marching-ants 0.6s linear infinite;
2969
- }
2970
- /* Selected effect: marching ants dashed line */
2971
- .edge.selected path.edge-path {
2972
- stroke-dasharray: 6 6;
2973
- stroke-width: 4px;
2974
- animation: marching-ants 0.6s linear infinite;
2975
- }
2976
- .close-btn {
2977
- cursor: pointer;
2978
- }
2979
- /* Nav icon visibility - controlled purely by CSS */
2980
- .nav-icon {
2981
- opacity: 0;
2982
- transition: opacity 0.15s ease, fill 0.15s ease;
2983
- pointer-events: none;
2984
- }
2985
- /* Show nav icons when hovering over the label area group */
2986
- .label-area:hover .nav-icon {
2987
- opacity: 1;
2988
- }
2989
- /* Also show nav icons when hovering on selected edge's nav button */
2990
- .nav-btn-group:hover .nav-icon {
2991
- fill: #3B82F6 !important;
2992
- opacity: 1;
2993
- }
2994
- .nav-btn-area {
2995
- transition: fill 0.15s ease;
2996
- }
2997
- .nav-btn-group:hover .nav-btn-area {
2998
- fill: rgba(59, 130, 246, 0.1);
2999
- }
3000
- /* Dimmed state for edge hover focus effect */
3001
- .edge.dimmed,
3002
- .node.dimmed {
3003
- opacity: 0.3;
3004
- transition: opacity 0.2s ease;
3005
- }
3006
- .edge:not(.dimmed),
3007
- .node:not(.dimmed) {
3008
- transition: opacity 0.2s ease;
3009
- }
3010
- /* Selection-based dimming - unrelated elements when edge is selected */
3011
- .edge.selection-dimmed,
3012
- .node.selection-dimmed {
3013
- opacity: 0.3;
3014
- transition: opacity 0.2s ease;
3015
- }
3016
- /* Hover highlight overrides selection-dimmed to restore visibility */
3017
- .edge.hover-highlight,
3018
- .node.hover-highlight {
3019
- opacity: 1 !important;
3020
- transition: opacity 0.2s ease;
3021
- }
3022
- /* Selected edge should always be at full opacity */
3023
- .edge.selected {
3024
- opacity: 1 !important;
3025
- }
3026
- </style>
3027
- <symbol id="arrow-right" viewBox="0 0 12 12">
3028
- <path d="M11.53 5.46967C11.8229 5.76256 11.8229 6.23744 11.53 6.53033L6.75736 11.303C6.46447 11.5959 5.98959 11.5959 5.6967 11.303C5.40381 11.0101 5.40381 10.5352 5.6967 10.2423L9.93934 6L5.6967 1.75736C5.40381 1.46447 5.40381 0.989593 5.6967 0.696699C5.98959 0.403806 6.46447 0.403806 6.75736 0.696699L11.53 5.46967ZM0 5.25H11V6.75H0V5.25Z"/>
3029
- </symbol>
3030
- <symbol id="nav-left" viewBox="0 0 32 32">
3031
- <path d="M20.7073 25.2921C20.8002 25.385 20.8739 25.4953 20.9242 25.6167C20.9745 25.7381 21.0004 25.8682 21.0004 25.9996C21.0004 26.131 20.9745 26.2611 20.9242 26.3825C20.8739 26.5039 20.8002 26.6142 20.7073 26.7071C20.6144 26.8 20.5041 26.8737 20.3827 26.924C20.2613 26.9743 20.1312 27.0001 19.9998 27.0001C19.8684 27.0001 19.7383 26.9743 19.6169 26.924C19.4955 26.8737 19.3852 26.8 19.2923 26.7071L9.29231 16.7071C9.19933 16.6142 9.12557 16.5039 9.07525 16.3825C9.02493 16.2611 8.99902 16.131 8.99902 15.9996C8.99902 15.8682 9.02493 15.738 9.07525 15.6166C9.12557 15.4952 9.19933 15.385 9.29231 15.2921L19.2923 5.29208C19.4799 5.10444 19.7344 4.99902 19.9998 4.99902C20.2652 4.99902 20.5197 5.10444 20.7073 5.29208C20.895 5.47972 21.0004 5.73422 21.0004 5.99958C21.0004 6.26494 20.895 6.51944 20.7073 6.70708L11.4136 15.9996L20.7073 25.2921Z"/>
3032
- </symbol>
3033
- <symbol id="nav-right" viewBox="0 0 32 32">
3034
- <path d="M22.7076 16.7071L12.7076 26.7071C12.6147 26.8 12.5044 26.8737 12.383 26.924C12.2616 26.9743 12.1315 27.0001 12.0001 27.0001C11.8687 27.0001 11.7386 26.9743 11.6172 26.924C11.4958 26.8737 11.3855 26.8 11.2926 26.7071C11.1997 26.6142 11.126 26.5039 11.0757 26.3825C11.0254 26.2611 10.9995 26.131 10.9995 25.9996C10.9995 25.8682 11.0254 25.7381 11.0757 25.6167C11.126 25.4953 11.1997 25.385 11.2926 25.2921L20.5863 15.9996L11.2926 6.70708C11.1049 6.51944 10.9995 6.26494 10.9995 5.99958C10.9995 5.73422 11.1049 5.47972 11.2926 5.29208C11.4802 5.10444 11.7347 4.99902 12.0001 4.99902C12.2654 4.99902 12.5199 5.10444 12.7076 5.29208L22.7076 15.2921C22.8005 15.385 22.8743 15.4952 22.9246 15.6166C22.975 15.738 23.0009 15.8682 23.0009 15.9996C23.0009 16.131 22.975 16.2611 22.9246 16.3825C22.8743 16.5039 22.8005 16.6142 22.7076 16.7071Z"/>
3035
- </symbol>
3036
- `);
3037
- const G = $.append("g").attr("id", "graph0"), et = (e.objects || []).map(
3038
- (g) => new Hn({
3039
- _gvid: g._gvid,
3040
- name: g.name,
3041
- _draw_: g._draw_,
3042
- _ldraw_: g._ldraw_,
3043
- bb: g.bb,
3044
- pos: g.pos,
3045
- // Apply custom node dimensions if provided (convert points to inches)
3046
- width: h !== void 0 ? String(h / 72) : g.width,
3047
- height: d !== void 0 ? String(d / 72) : g.height,
3048
- label: g.label
3049
- })
3050
- ), b = /* @__PURE__ */ new Map();
3051
- et.forEach((g) => {
3052
- b.set(g._gvid, g);
3053
- });
3054
- const Z = (e.edges || []).map((g) => {
3055
- const x = new Na({
3056
- _gvid: g._gvid,
3057
- name: g.name,
3058
- _draw_: g._draw_,
3059
- _ldraw_: g._ldraw_,
3060
- _hdraw_: g._hdraw_,
3061
- _tdraw_: g._tdraw_,
3062
- head: g.head,
3063
- tail: g.tail,
3064
- label: g.label
3065
- }), F = g.tail !== void 0 ? b.get(g.tail) : void 0, C = g.head !== void 0 ? b.get(g.head) : void 0;
3066
- return F && C && x.setNodes(F, C), x;
3067
- }), { nodeColumnMap: I, nodeColumns: f, edgeColumns: y } = Ia(
3068
- et,
3069
- Z
3070
- ), p = Array.from(f.keys()).sort((g, x) => g - x), N = p.length, P = 80;
3071
- let D;
3072
- if (m !== void 0)
3073
- D = m, B = (N > 1 ? (N - 1) * D : 0) + 2 * P;
3074
- else {
3075
- const g = B - 2 * P;
3076
- D = N > 1 ? g / (N - 1) : 0;
3077
- }
3078
- if (p.forEach((g, x) => {
3079
- const F = f.get(g);
3080
- if (!F) return;
3081
- const C = F.nodes;
3082
- if (C.length === 0) return;
3083
- const W = N > 1 ? P + x * D : B / 2;
3084
- C.sort((R, Q) => {
3085
- const L = R.getPosition(), z = Q.getPosition();
3086
- return !L || !z ? 0 : z[1] - L[1];
3087
- });
3088
- const O = 50, k = C.filter((R) => !R.virtualNode), U = k.length;
3089
- if (U === 0) {
3090
- let R = (E + C.reduce((Q, L) => Q + L.getHeightPoints(), 0)) / 2;
3091
- C.forEach((Q) => {
3092
- const L = Q.getHeightPoints();
3093
- R -= L / 2, Q.pos = `${W},${R}`, R -= L / 2;
3094
- });
3095
- return;
3096
- }
3097
- let X, M;
3098
- if (U % 2 === 1) {
3099
- const R = Math.floor(U / 2), Q = k[R];
3100
- M = C.indexOf(Q), X = E / 2;
3101
- } else {
3102
- const R = U / 2 - 1, Q = k[R];
3103
- M = C.indexOf(Q), X = E / 2;
3104
- }
3105
- const ht = C[M], pt = ht.getHeightPoints();
3106
- ht.pos = `${W},${X}`;
3107
- let K = X + pt / 2;
3108
- for (let R = M - 1; R >= 0; R--) {
3109
- const Q = C[R], L = C[R + 1], z = Q.getHeightPoints(), Et = Q.virtualNode || L.virtualNode ? 0 : O;
3110
- K += Et + z / 2, Q.pos = `${W},${K}`, K += z / 2;
3111
- }
3112
- K = X - pt / 2;
3113
- for (let R = M + 1; R < C.length; R++) {
3114
- const Q = C[R], L = C[R - 1], z = Q.getHeightPoints(), Et = Q.virtualNode || L.virtualNode ? 0 : O;
3115
- K -= Et + z / 2, Q.pos = `${W},${K}`, K -= z / 2;
3116
- }
3117
- }), m !== void 0 && $.attr("viewBox", `0 0 ${B} ${E}`), f.forEach((g) => {
3118
- g.nodes.forEach((x) => {
3119
- const F = x.getPosition();
3120
- if (!F) return;
3121
- const [C, W] = F, O = x.getWidthPoints(), k = x.getHeightPoints(), U = x.virtualNode;
3122
- if (U && !c) return;
3123
- const X = G.append("g").attr("class", U ? "node virtual-node" : "node").attr("id", x.name).attr("data-node-id", x.name);
3124
- let M = null;
3125
- try {
3126
- x.label && (M = ge(x.label));
3127
- } catch (at) {
3128
- console.warn(`Failed to decode node label for ${x.name}:`, at);
3129
- }
3130
- M != null && M.key && X.attr("data-key", M.key);
3131
- const ht = c && U, pt = (M == null ? void 0 : M.tags) || [], K = (M == null ? void 0 : M.label) || "", R = (M == null ? void 0 : M.text) || "", Q = (M == null ? void 0 : M.color) || "var(--text-primary, #171921)", L = (M == null ? void 0 : M.background) || "white", z = L !== "white";
3132
- if ((pt.length > 0 || K.length > 0) && !U) {
3133
- const at = k / 2, gt = k / 2, it = E - W - k / 2, Y = 4, ut = "var(--border-primary, #CDCFD5)";
3134
- X.append("path").attr("d", Se(
3135
- C - O / 2,
3136
- it,
3137
- O,
3138
- at,
3139
- { topLeft: Y, topRight: Y }
3140
- )).attr("fill", z ? L : "var(--bg-quaternary, #E1E2E5)").attr("stroke", ut).attr("stroke-width", 1), z && X.append("line").attr("x1", C - O / 2).attr("y1", it + at).attr("x2", C + O / 2).attr("y2", it + at).attr("stroke", Q).attr("stroke-width", 1), X.append("path").attr("d", Se(
3141
- C - O / 2,
3142
- it + at,
3143
- O,
3144
- gt,
3145
- { bottomLeft: Y, bottomRight: Y }
3146
- )).attr("fill", z ? L : "var(--bg-primary, #fff)").attr("stroke", ut).attr("stroke-width", 1);
3147
- const mt = X.append("rect").attr("x", C - O / 2 - 4).attr("y", it - 4).attr("width", O + 8).attr("height", k + 8).attr("rx", 5).attr("ry", 5).attr("fill", "none").attr("stroke", "var(--gray-700, #43444C)").attr("stroke-width", 2).attr("opacity", 0).style("pointer-events", "none");
3148
- X.style("cursor", "pointer").on("mouseenter", function() {
3149
- if (mt.attr("opacity", 1), G.select(".edge.selected").size() > 0)
3150
- return;
3151
- const st = V(this).attr("data-node-id"), xt = /* @__PURE__ */ new Set([st]);
3152
- G.selectAll(".edge").each(function() {
3153
- const Ct = V(this).attr("data-source-node-id"), Xt = V(this).attr("data-target-node-id");
3154
- Ct === st || Xt === st ? Ct === st ? xt.add(Xt) : xt.add(Ct) : V(this).classed("dimmed", !0);
3155
- }), G.selectAll(".node").each(function() {
3156
- const Ct = V(this).attr("data-node-id");
3157
- xt.has(Ct) || V(this).classed("dimmed", !0);
3158
- });
3159
- }).on("mouseleave", function() {
3160
- mt.attr("opacity", 0), G.selectAll(".edge.dimmed").classed("dimmed", !1), G.selectAll(".node.dimmed").classed("dimmed", !1);
3161
- });
3162
- let yt = C - O / 2 + 8;
3163
- const Nt = it + at / 2, vt = 7.2, $t = 6, wt = 18, ft = 4;
3164
- if (pt.forEach((rt) => {
3165
- const xt = rt.length * vt + $t * 2;
3166
- X.append("rect").attr("x", yt).attr("y", Nt - wt / 2).attr("width", xt).attr("height", wt).attr("rx", 5).attr("ry", 5).attr("fill", "var(--bg-warning-primary, #FFF8E1)").attr("stroke", "var(--border-warning-light, #FFD66D)").attr("stroke-width", 1), X.append("text").attr("x", yt + $t).attr("y", Nt).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-inter), Inter, Helvetica, Arial").attr("font-size", "12px").attr("font-weight", "500").attr("fill", "var(--text-warning-primary, #CD7004)").text(rt), yt += xt + ft;
3167
- }), K) {
3168
- const rt = C + O / 2 - 8 - yt, st = X.append("text").attr("x", yt).attr("y", Nt).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-inter), Inter, Helvetica, Arial").attr("font-size", "12px").attr("font-weight", "600").attr("fill", Q);
3169
- Me(st, rt, K);
3170
- }
3171
- if (R) {
3172
- const rt = O - 16, st = X.append("text").attr("x", C - O / 2 + 8).attr("y", it + at + gt / 2).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-fira-code), Fira Code, monospace").attr("font-size", "12px").attr("font-weight", "400").attr("fill", Q);
3173
- Me(st, rt, R);
3174
- }
3175
- } else {
3176
- const gt = ht ? "#EF4444" : "var(--border-primary, #CDCFD5)", it = X.append("path").attr("d", Se(
3177
- C - O / 2,
3178
- E - W - k / 2,
3179
- O,
3180
- k,
3181
- { topLeft: 4, topRight: 4, bottomLeft: 4, bottomRight: 4 }
3182
- )).attr("fill", z ? L : "var(--bg-primary, #fff)").attr("stroke", gt).attr("stroke-width", ht ? 2 : 1);
3183
- if (!U) {
3184
- const Y = X.append("rect").attr("x", C - O / 2 - 4).attr("y", E - W - k / 2 - 4).attr("width", O + 8).attr("height", k + 8).attr("rx", 5).attr("ry", 5).attr("fill", "none").attr("stroke", "#000000").attr("stroke-width", 2).attr("opacity", 0).style("pointer-events", "none");
3185
- it.style("cursor", "pointer").on("mouseenter", function() {
3186
- Y.attr("opacity", 1);
3187
- }).on("mouseleave", function() {
3188
- Y.attr("opacity", 0);
3189
- });
3190
- }
3191
- if (M)
3192
- if (U) {
3193
- const Y = K || R;
3194
- X.append("text").attr("x", C).attr("y", E - W).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("font-family", "Inter, Helvetica, Arial").attr("font-size", "10px").attr("fill", "#991B1B").text(
3195
- Y.length > 20 ? Y.slice(0, 20) + "..." : Y
3196
- );
3197
- } else {
3198
- const Y = R || K, ut = O - 16, mt = X.append("text").attr("x", C - O / 2 + 8).attr("y", E - W).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", "var(--font-fira-code), Fira Code, monospace").attr("font-size", "12px").attr("font-weight", "400").attr("fill", Q);
3199
- Me(mt, ut, Y);
3200
- }
3201
- }
3202
- !x.label && x._ldraw_ && x._ldraw_.length > 0 && !U && x._ldraw_.forEach((at) => {
3203
- at.op === "T" && at.text && X.append("text").attr("x", C - O / 2 + 8).attr("y", E - W).attr("text-anchor", "start").attr("dominant-baseline", "middle").attr("font-family", at.face || "Inter, Helvetica, Arial").attr("font-size", `${at.size || 11}px`).attr("fill", at.color || "#334155").text(at.text);
3204
- });
3205
- });
3206
- }), o) {
3207
- Pa(f, E), Ya(Z, y);
3208
- const g = a.loopRadius, x = a.edgeSpacing, F = a.labelHeight;
3209
- y.forEach((k) => {
3210
- const U = k.edges;
3211
- if (U.length === 0) return;
3212
- const X = k.baseEdge, M = k.baseEdgeIndex;
3213
- if (!X || M < 0) return;
3214
- const ht = X.getStartPoint(), pt = X.getEndPoint();
3215
- if (!ht || !pt) return;
3216
- const K = E - ht.y, R = E - pt.y;
3217
- X.midY = (K + R) / 2;
3218
- const Q = ue(
3219
- X,
3220
- E,
3221
- void 0,
3222
- a
3223
- );
3224
- Q && (X.midY = Q.midY, X.orthogonalPathPoints = Q.points), k.aboveY = X.midY, k.belowY = X.midY;
3225
- for (let L = M - 1; L >= 0; L--) {
3226
- const z = U[L];
3227
- if (z.depth !== 0) continue;
3228
- if (z.getDirection() === "self") {
3229
- const Y = z.getStartPoint();
3230
- Y && (z.midY = E - Y.y - g);
3231
- continue;
3232
- }
3233
- const at = z.label ? x + F : x;
3234
- z.midY = k.aboveY - at, k.aboveY = z.midY, z.baseDirection = "above", z.baseOffset = -(M - L);
3235
- const gt = L < U.length - 1 ? U[L + 1] : void 0, it = ue(
3236
- z,
3237
- E,
3238
- gt,
3239
- a
3240
- );
3241
- it && (z.midY = it.midY, z.orthogonalPathPoints = it.points, k.aboveY = z.midY);
3242
- }
3243
- for (let L = M + 1; L < U.length; L++) {
3244
- const z = U[L];
3245
- if (z.depth !== 0) continue;
3246
- if (z.getDirection() === "self") {
3247
- const Y = z.getStartPoint();
3248
- Y && (z.midY = E - Y.y - g);
3249
- continue;
3250
- }
3251
- const at = z.label ? x + F : x;
3252
- z.midY = k.belowY + at, k.belowY = z.midY, z.baseDirection = "below", z.baseOffset = L - M;
3253
- const gt = L > 0 ? U[L - 1] : void 0, it = ue(
3254
- z,
3255
- E,
3256
- gt,
3257
- a
3258
- );
3259
- it && (z.midY = it.midY, z.orthogonalPathPoints = it.points, k.belowY = z.midY);
3260
- }
3261
- });
3262
- const C = [];
3263
- y.forEach((k) => {
3264
- const U = k.edges;
3265
- U.length === 0 || k.baseEdge || !U.every((M) => M.depth > 0) || U.forEach((M) => {
3266
- if (M.getDirection() !== "self")
3267
- C.push(M);
3268
- else {
3269
- const ht = M.getStartPoint();
3270
- ht && (M.midY = E - ht.y - g);
3271
- }
3272
- });
3273
- }), C.sort((k, U) => k.depth - U.depth);
3274
- let W = 1 / 0, O = -1 / 0;
3275
- y.forEach((k) => {
3276
- k.aboveY !== 0 && (W = Math.min(W, k.aboveY)), k.belowY !== 0 && (O = Math.max(O, k.belowY));
3277
- }), f.forEach((k) => {
3278
- k.aboveY !== 0 && (W = Math.min(W, k.aboveY)), k.belowY !== 0 && (O = Math.max(O, k.belowY));
3279
- }), C.forEach((k) => {
3280
- if (!k.sourceNode || !k.targetNode) return;
3281
- const U = I.get(k.sourceNode._gvid), X = I.get(k.targetNode._gvid);
3282
- if (U === void 0 || X === void 0) return;
3283
- const M = Math.min(U, X), ht = Math.max(U, X), pt = [];
3284
- for (let Y = M; Y <= ht; Y++) {
3285
- const ut = f.get(Y);
3286
- ut && pt.push(...ut.nodes);
3287
- }
3288
- const K = pt.map((Y) => {
3289
- const ut = Y.getPosition();
3290
- if (!ut) return null;
3291
- const mt = E - ut[1], yt = Y.height ? parseFloat(Y.height) * 72 : 40;
3292
- return { y: mt, height: yt, bottomY: mt + yt / 2 };
3293
- }).filter(
3294
- (Y) => Y !== null
3295
- ).sort((Y, ut) => Y.y - ut.y);
3296
- let R;
3297
- if (K.length === 0)
3298
- R = (W + O) / 2;
3299
- else if (K.length % 2 === 1)
3300
- R = K[Math.floor(K.length / 2)].bottomY;
3301
- else {
3302
- const Y = K.length / 2;
3303
- R = (K[Y - 1].bottomY + K[Y].bottomY) / 2;
3304
- }
3305
- const Q = k.getStartPoint(), L = k.getEndPoint(), Et = (Q && L ? E - (Q.y + L.y) / 2 : R) < R ? "above" : "below";
3306
- k.baseDirection = Et;
3307
- const at = k.label ? x + F : x;
3308
- let gt;
3309
- Et === "above" ? (k.midY = W - at, gt = W, W = k.midY) : (k.midY = O + at, gt = O, O = k.midY);
3310
- const it = ue(
3311
- k,
3312
- E,
3313
- { midY: gt },
3314
- a
3315
- );
3316
- it && (k.midY = it.midY, k.orthogonalPathPoints = it.points, Et === "above" ? W = Math.min(W, it.midY) : O = Math.max(O, it.midY));
3317
- });
3318
- }
3319
- const T = Z.map((g) => g.edgeIndex).filter((g) => g !== void 0).sort((g, x) => g - x), q = (g) => {
3320
- const x = T.indexOf(g);
3321
- if (x > 0)
3322
- return T[x - 1];
3323
- }, ct = (g) => {
3324
- const x = T.indexOf(g);
3325
- if (x >= 0 && x < T.length - 1)
3326
- return T[x + 1];
3327
- }, nt = qe().scaleExtent([0.1, $a(t, B, s)]).on("zoom", (g) => {
3328
- const x = g.transform;
3329
- !isNaN(x.x) && !isNaN(x.y) && !isNaN(x.k) && G.attr("transform", x.toString());
3330
- });
3331
- if (S || $.call(nt), !S && !A && ($.on("wheel.zoom", null), $.on("dblclick.zoom", null)), Z.forEach((g) => {
3332
- if (r != null) {
3333
- if (i) {
3334
- if (g.depth > r) return;
3335
- } else if (g.depth !== r) return;
3336
- }
3337
- Ta(
3338
- g,
3339
- G,
3340
- E,
3341
- a,
3342
- o,
3343
- nt,
3344
- $,
3345
- t,
3346
- B,
3347
- E,
3348
- l,
3349
- u,
3350
- c,
3351
- q,
3352
- ct
3353
- );
3354
- }), c) {
3355
- const g = G.node();
3356
- if (g) {
3357
- const x = g.getBBox(), F = x.x + x.width / 2, C = x.y + x.height / 2;
3358
- G.append("rect").attr("x", x.x).attr("y", x.y).attr("width", x.width).attr("height", x.height).attr("fill", "none").attr("stroke", "yellow").attr("stroke-width", 3).attr("opacity", 0.8).style("pointer-events", "none").attr("class", "debug-root-border"), G.append("circle").attr("cx", F).attr("cy", C).attr("r", 10).attr("fill", "yellow").attr("stroke", "orange").attr("stroke-width", 2).attr("opacity", 0.9).style("pointer-events", "none").attr("class", "debug-geometric-center");
3359
- }
3360
- }
3361
- let v;
3362
- if (_.initialTransform)
3363
- v = _.initialTransform;
3364
- else if (S)
3365
- v = {
3366
- x: B / 2 - B / 2 * 0.9,
3367
- y: E / 2 - E / 2 * 0.9,
3368
- k: 0.9
3369
- };
3370
- else {
3371
- const g = G.node(), x = g ? g.getBBox() : { x: 0, y: 0, width: B, height: E }, F = 0.9 * B / x.width, C = x.x + x.width / 2, W = x.y + x.height / 2;
3372
- v = {
3373
- x: B / 2 - C * F,
3374
- y: E / 2 - W * F,
3375
- k: F
3376
- };
3377
- }
3378
- const H = `translate(${v.x},${v.y}) scale(${v.k})`;
3379
- if (S ? G.attr("transform", H) : $.call(
3380
- nt.transform,
3381
- Ht.translate(v.x, v.y).scale(v.k)
3382
- ), c) {
3383
- const g = Math.max(B, E) * 3e-3;
3384
- $.append("circle").attr("cx", B / 2).attr("cy", E / 2).attr("r", g).attr("fill", "red").attr("opacity", 0.9).style("pointer-events", "none").attr("class", "debug-center-marker");
3385
- }
3386
- const tt = Z.filter((g) => g.edgeIndex !== void 0).map((g) => {
3387
- var x, F;
3388
- return {
3389
- id: g._gvid,
3390
- index: g.edgeIndex,
3391
- sourceNodeId: ((x = g.sourceNode) == null ? void 0 : x.name) || "",
3392
- targetNodeId: ((F = g.targetNode) == null ? void 0 : F.name) || "",
3393
- label: g.getLabelText()
3394
- };
3395
- }).sort((g, x) => g.index - x.index);
3396
- return {
3397
- zoomBehavior: nt,
3398
- svgElement: $.node(),
3399
- gElement: G.node(),
3400
- baseFontSize: s,
3401
- viewBoxWidth: B,
3402
- edges: tt,
3403
- initialTransform: v
3404
- };
3405
- }
3406
- function Bt(t, e, n) {
3407
- let r = "#000000", i = "#000000", a = "#000000";
3408
- e.forEach((o) => {
3409
- switch (o.op) {
3410
- case "c":
3411
- o.color && (r = o.color);
3412
- break;
3413
- case "C":
3414
- o.color && (i = o.color);
3415
- break;
3416
- case "F":
3417
- o.color && (a = o.color);
3418
- break;
3419
- case "T":
3420
- o.pt && o.text && t.append("text").attr("x", o.pt[0]).attr("y", n - o.pt[1]).attr(
3421
- "text-anchor",
3422
- o.align === "l" ? "start" : o.align === "r" ? "end" : "middle"
3423
- ).attr("font-family", o.face || "Inter, Helvetica, Arial").attr("font-size", `${o.size || 12}px`).attr("fill", o.color || a).text(o.text);
3424
- break;
3425
- case "p":
3426
- if (o.points) {
3427
- const s = o.points.map(([c, l]) => [c, n - l]);
3428
- t.append("polygon").attr("points", s.map((c) => c.join(",")).join(" ")).attr("fill", i).attr("stroke", r);
3429
- }
3430
- break;
3431
- case "P":
3432
- if (o.points) {
3433
- const s = o.points.map(([c, l]) => [c, n - l]);
3434
- t.append("polygon").attr("points", s.map((c) => c.join(",")).join(" ")).attr("fill", "none").attr("stroke", r);
3435
- }
3436
- break;
3437
- case "e":
3438
- if (o.rect) {
3439
- const [s, c, l, u] = o.rect;
3440
- t.append("ellipse").attr("cx", s).attr("cy", n - c).attr("rx", l).attr("ry", u).attr("fill", i).attr("stroke", r);
3441
- }
3442
- break;
3443
- case "E":
3444
- if (o.rect) {
3445
- const [s, c, l, u] = o.rect;
3446
- t.append("ellipse").attr("cx", s).attr("cy", n - c).attr("rx", l).attr("ry", u).attr("fill", "none").attr("stroke", r);
3447
- }
3448
- break;
3449
- case "b":
3450
- if (o.points) {
3451
- const s = o.points.map(([l, u]) => [l, n - u]), c = `M${s[0][0]},${s[0][1]} C${s.slice(1).map((l) => `${l[0]},${l[1]}`).join(" ")}`;
3452
- t.append("path").attr("d", c).attr("fill", "none").attr("stroke", r).attr("stroke-width", 1);
3453
- }
3454
- break;
3455
- case "B":
3456
- if (o.points) {
3457
- const s = o.points.map(([l, u]) => [l, n - u]), c = `M${s[0][0]},${s[0][1]} C${s.slice(1).map((l) => `${l[0]},${l[1]}`).join(" ")}`;
3458
- t.append("path").attr("d", c).attr("fill", i).attr("stroke", r).attr("stroke-width", 1);
3459
- }
3460
- break;
3461
- case "L":
3462
- if (o.points) {
3463
- const c = `M${o.points.map(([l, u]) => [l, n - u]).map((l) => `${l[0]},${l[1]}`).join(" L")}`;
3464
- t.append("path").attr("d", c).attr("fill", "none").attr("stroke", r).attr("stroke-width", 1);
3465
- }
3466
- break;
3467
- }
3468
- });
3469
- }
3470
- function Fa(t, e, n = 14) {
3471
- var A;
3472
- t.innerHTML = "";
3473
- const r = ((A = e.bb) == null ? void 0 : A.split(",").map(Number)) || [0, 0, 1e3, 800], [, , i, a] = r, o = V(t).append("svg").attr("width", "100%").attr("height", "100%").attr("viewBox", `0 0 ${i} ${a}`);
3474
- o.append("defs").html(`
3475
- <style>
3476
- .node rect, .node ellipse, .node polygon {
3477
- cursor: pointer;
3478
- }
3479
- .edge {
3480
- cursor: pointer;
3481
- }
3482
- </style>
3483
- `);
3484
- const s = o.append("g").attr("id", "graph0");
3485
- (e.objects || []).forEach((_) => {
3486
- const S = s.append("g").attr("class", "node").attr("id", _.name);
3487
- _._draw_ && Bt(S, _._draw_, a), _._ldraw_ && Bt(S, _._ldraw_, a);
3488
- });
3489
- const l = e.edges || [];
3490
- l.forEach((_) => {
3491
- const S = s.append("g").attr("class", "edge").attr("id", `edge_${_._gvid}`);
3492
- _._draw_ && Bt(S, _._draw_, a), _._hdraw_ && Bt(S, _._hdraw_, a), _._tdraw_ && Bt(S, _._tdraw_, a), _._ldraw_ && Bt(S, _._ldraw_, a);
3493
- });
3494
- const u = qe().scaleExtent([0.1, 10]).on("zoom", (_) => {
3495
- s.attr("transform", _.transform.toString());
3496
- });
3497
- o.call(u);
3498
- const h = t.clientWidth || 800, d = n * (h / i), m = l.filter((_) => {
3499
- if (!_.label) return !1;
3500
- try {
3501
- const S = ge(_.label);
3502
- return (S == null ? void 0 : S.index) !== void 0;
3503
- } catch {
3504
- return !1;
3505
- }
3506
- }).map((_) => {
3507
- var w;
3508
- const S = ge(_.label);
3509
- return {
3510
- id: _._gvid,
3511
- index: S.index,
3512
- sourceNodeId: String(_.tail ?? ""),
3513
- targetNodeId: String(_.head ?? ""),
3514
- label: ((w = S.elems) == null ? void 0 : w.map((ot) => ot.text).join(" ")) || null
3515
- };
3516
- }).sort((_, S) => _.index - S.index);
3517
- return {
3518
- zoomBehavior: u,
3519
- svgElement: o.node(),
3520
- gElement: s.node(),
3521
- baseFontSize: d,
3522
- viewBoxWidth: i,
3523
- edges: m
3524
- };
3525
- }
3526
- export {
3527
- Ne as D,
3528
- Ba as a,
3529
- Ra as b,
3530
- Da as c,
3531
- ge as d,
3532
- za as e,
3533
- Ht as i,
3534
- Fa as r,
3535
- V as s,
3536
- da as t
3537
- };