@linkurious/ogma-linkurious-parser 4.1.6 → 4.1.8

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.
Files changed (46) hide show
  1. package/dist/index.cjs +4 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.ts +5 -5
  4. package/dist/index.mjs +4082 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/ogma/features/nodeGrouping.d.ts +15 -1
  7. package/dist/tools/ogmaTool.d.ts +3 -1
  8. package/package.json +23 -21
  9. package/dist/captions/captions.js +0 -115
  10. package/dist/captions/captions.js.map +0 -1
  11. package/dist/filters/filters.js +0 -167
  12. package/dist/filters/filters.js.map +0 -1
  13. package/dist/index.js +0 -56
  14. package/dist/index.js.map +0 -1
  15. package/dist/ogma/features/OgmaStore.js +0 -37
  16. package/dist/ogma/features/OgmaStore.js.map +0 -1
  17. package/dist/ogma/features/captions.js +0 -117
  18. package/dist/ogma/features/captions.js.map +0 -1
  19. package/dist/ogma/features/nodeGrouping.js +0 -283
  20. package/dist/ogma/features/nodeGrouping.js.map +0 -1
  21. package/dist/ogma/features/reactive.js +0 -132
  22. package/dist/ogma/features/reactive.js.map +0 -1
  23. package/dist/ogma/features/selectors.js +0 -97
  24. package/dist/ogma/features/selectors.js.map +0 -1
  25. package/dist/ogma/features/styles.js +0 -689
  26. package/dist/ogma/features/styles.js.map +0 -1
  27. package/dist/ogma/features/transformations.js +0 -86
  28. package/dist/ogma/features/transformations.js.map +0 -1
  29. package/dist/ogma/index.js +0 -326
  30. package/dist/ogma/index.js.map +0 -1
  31. package/dist/styles/edgeAttributes.js +0 -115
  32. package/dist/styles/edgeAttributes.js.map +0 -1
  33. package/dist/styles/itemAttributes.js +0 -133
  34. package/dist/styles/itemAttributes.js.map +0 -1
  35. package/dist/styles/nodeAttributes.js +0 -228
  36. package/dist/styles/nodeAttributes.js.map +0 -1
  37. package/dist/styles/styleRule.js +0 -194
  38. package/dist/styles/styleRule.js.map +0 -1
  39. package/dist/styles/styleRules.js +0 -292
  40. package/dist/styles/styleRules.js.map +0 -1
  41. package/dist/tools/colorPalette.js +0 -145
  42. package/dist/tools/colorPalette.js.map +0 -1
  43. package/dist/tools/ogmaTool.js +0 -86
  44. package/dist/tools/ogmaTool.js.map +0 -1
  45. package/dist/tools/tools.js +0 -409
  46. package/dist/tools/tools.js.map +0 -1
package/dist/index.mjs ADDED
@@ -0,0 +1,4082 @@
1
+ import { CurrencyFormat as B, PropertyTypeName as pr, AutoRangeScale as Ut, OgmaEdgeShape as br, SelectorType as S, ForceLayoutMode as yr, EntityType as P } from "@linkurious/rest-client";
2
+ import vr from "@linkurious/ogma";
3
+ import { BehaviorSubject as mr } from "rxjs";
4
+ var X = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
+ function Oe(r) {
6
+ return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
7
+ }
8
+ function _r() {
9
+ this.__data__ = [], this.size = 0;
10
+ }
11
+ var Cr = _r;
12
+ function Sr(r, e) {
13
+ return r === e || r !== r && e !== e;
14
+ }
15
+ var Le = Sr, Ar = Le;
16
+ function xr(r, e) {
17
+ for (var t = r.length; t--; )
18
+ if (Ar(r[t][0], e))
19
+ return t;
20
+ return -1;
21
+ }
22
+ var se = xr, $r = se, Er = Array.prototype, Fr = Er.splice;
23
+ function Tr(r) {
24
+ var e = this.__data__, t = $r(e, r);
25
+ if (t < 0)
26
+ return !1;
27
+ var i = e.length - 1;
28
+ return t == i ? e.pop() : Fr.call(e, t, 1), --this.size, !0;
29
+ }
30
+ var wr = Tr, Nr = se;
31
+ function Dr(r) {
32
+ var e = this.__data__, t = Nr(e, r);
33
+ return t < 0 ? void 0 : e[t][1];
34
+ }
35
+ var Or = Dr, Lr = se;
36
+ function Pr(r) {
37
+ return Lr(this.__data__, r) > -1;
38
+ }
39
+ var Ir = Pr, Mr = se;
40
+ function Rr(r, e) {
41
+ var t = this.__data__, i = Mr(t, r);
42
+ return i < 0 ? (++this.size, t.push([r, e])) : t[i][1] = e, this;
43
+ }
44
+ var Br = Rr, zr = Cr, Gr = wr, Ur = Or, jr = Ir, kr = Br;
45
+ function j(r) {
46
+ var e = -1, t = r == null ? 0 : r.length;
47
+ for (this.clear(); ++e < t; ) {
48
+ var i = r[e];
49
+ this.set(i[0], i[1]);
50
+ }
51
+ }
52
+ j.prototype.clear = zr;
53
+ j.prototype.delete = Gr;
54
+ j.prototype.get = Ur;
55
+ j.prototype.has = jr;
56
+ j.prototype.set = kr;
57
+ var ae = j, Hr = ae;
58
+ function Vr() {
59
+ this.__data__ = new Hr(), this.size = 0;
60
+ }
61
+ var Kr = Vr;
62
+ function qr(r) {
63
+ var e = this.__data__, t = e.delete(r);
64
+ return this.size = e.size, t;
65
+ }
66
+ var Wr = qr;
67
+ function Yr(r) {
68
+ return this.__data__.get(r);
69
+ }
70
+ var Jr = Yr;
71
+ function Zr(r) {
72
+ return this.__data__.has(r);
73
+ }
74
+ var Xr = Zr, Qr = typeof X == "object" && X && X.Object === Object && X, jt = Qr, ei = jt, ti = typeof self == "object" && self && self.Object === Object && self, ri = ei || ti || Function("return this")(), N = ri, ii = N, ni = ii.Symbol, Y = ni, We = Y, kt = Object.prototype, si = kt.hasOwnProperty, ai = kt.toString, q = We ? We.toStringTag : void 0;
75
+ function oi(r) {
76
+ var e = si.call(r, q), t = r[q];
77
+ try {
78
+ r[q] = void 0;
79
+ var i = !0;
80
+ } catch {
81
+ }
82
+ var n = ai.call(r);
83
+ return i && (e ? r[q] = t : delete r[q]), n;
84
+ }
85
+ var ui = oi, li = Object.prototype, ci = li.toString;
86
+ function di(r) {
87
+ return ci.call(r);
88
+ }
89
+ var gi = di, Ye = Y, hi = ui, fi = gi, pi = "[object Null]", bi = "[object Undefined]", Je = Ye ? Ye.toStringTag : void 0;
90
+ function yi(r) {
91
+ return r == null ? r === void 0 ? bi : pi : Je && Je in Object(r) ? hi(r) : fi(r);
92
+ }
93
+ var J = yi;
94
+ function vi(r) {
95
+ var e = typeof r;
96
+ return r != null && (e == "object" || e == "function");
97
+ }
98
+ var oe = vi, mi = J, _i = oe, Ci = "[object AsyncFunction]", Si = "[object Function]", Ai = "[object GeneratorFunction]", xi = "[object Proxy]";
99
+ function $i(r) {
100
+ if (!_i(r))
101
+ return !1;
102
+ var e = mi(r);
103
+ return e == Si || e == Ai || e == Ci || e == xi;
104
+ }
105
+ var Ht = $i, Ei = N, Fi = Ei["__core-js_shared__"], Ti = Fi, fe = Ti, Ze = function() {
106
+ var r = /[^.]+$/.exec(fe && fe.keys && fe.keys.IE_PROTO || "");
107
+ return r ? "Symbol(src)_1." + r : "";
108
+ }();
109
+ function wi(r) {
110
+ return !!Ze && Ze in r;
111
+ }
112
+ var Ni = wi, Di = Function.prototype, Oi = Di.toString;
113
+ function Li(r) {
114
+ if (r != null) {
115
+ try {
116
+ return Oi.call(r);
117
+ } catch {
118
+ }
119
+ try {
120
+ return r + "";
121
+ } catch {
122
+ }
123
+ }
124
+ return "";
125
+ }
126
+ var Vt = Li, Pi = Ht, Ii = Ni, Mi = oe, Ri = Vt, Bi = /[\\^$.*+?()[\]{}|]/g, zi = /^\[object .+?Constructor\]$/, Gi = Function.prototype, Ui = Object.prototype, ji = Gi.toString, ki = Ui.hasOwnProperty, Hi = RegExp(
127
+ "^" + ji.call(ki).replace(Bi, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
128
+ );
129
+ function Vi(r) {
130
+ if (!Mi(r) || Ii(r))
131
+ return !1;
132
+ var e = Pi(r) ? Hi : zi;
133
+ return e.test(Ri(r));
134
+ }
135
+ var Ki = Vi;
136
+ function qi(r, e) {
137
+ return r == null ? void 0 : r[e];
138
+ }
139
+ var Wi = qi, Yi = Ki, Ji = Wi;
140
+ function Zi(r, e) {
141
+ var t = Ji(r, e);
142
+ return Yi(t) ? t : void 0;
143
+ }
144
+ var M = Zi, Xi = M, Qi = N, en = Xi(Qi, "Map"), Pe = en, tn = M, rn = tn(Object, "create"), ue = rn, Xe = ue;
145
+ function nn() {
146
+ this.__data__ = Xe ? Xe(null) : {}, this.size = 0;
147
+ }
148
+ var sn = nn;
149
+ function an(r) {
150
+ var e = this.has(r) && delete this.__data__[r];
151
+ return this.size -= e ? 1 : 0, e;
152
+ }
153
+ var on = an, un = ue, ln = "__lodash_hash_undefined__", cn = Object.prototype, dn = cn.hasOwnProperty;
154
+ function gn(r) {
155
+ var e = this.__data__;
156
+ if (un) {
157
+ var t = e[r];
158
+ return t === ln ? void 0 : t;
159
+ }
160
+ return dn.call(e, r) ? e[r] : void 0;
161
+ }
162
+ var hn = gn, fn = ue, pn = Object.prototype, bn = pn.hasOwnProperty;
163
+ function yn(r) {
164
+ var e = this.__data__;
165
+ return fn ? e[r] !== void 0 : bn.call(e, r);
166
+ }
167
+ var vn = yn, mn = ue, _n = "__lodash_hash_undefined__";
168
+ function Cn(r, e) {
169
+ var t = this.__data__;
170
+ return this.size += this.has(r) ? 0 : 1, t[r] = mn && e === void 0 ? _n : e, this;
171
+ }
172
+ var Sn = Cn, An = sn, xn = on, $n = hn, En = vn, Fn = Sn;
173
+ function k(r) {
174
+ var e = -1, t = r == null ? 0 : r.length;
175
+ for (this.clear(); ++e < t; ) {
176
+ var i = r[e];
177
+ this.set(i[0], i[1]);
178
+ }
179
+ }
180
+ k.prototype.clear = An;
181
+ k.prototype.delete = xn;
182
+ k.prototype.get = $n;
183
+ k.prototype.has = En;
184
+ k.prototype.set = Fn;
185
+ var Tn = k, Qe = Tn, wn = ae, Nn = Pe;
186
+ function Dn() {
187
+ this.size = 0, this.__data__ = {
188
+ hash: new Qe(),
189
+ map: new (Nn || wn)(),
190
+ string: new Qe()
191
+ };
192
+ }
193
+ var On = Dn;
194
+ function Ln(r) {
195
+ var e = typeof r;
196
+ return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? r !== "__proto__" : r === null;
197
+ }
198
+ var Pn = Ln, In = Pn;
199
+ function Mn(r, e) {
200
+ var t = r.__data__;
201
+ return In(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
202
+ }
203
+ var le = Mn, Rn = le;
204
+ function Bn(r) {
205
+ var e = Rn(this, r).delete(r);
206
+ return this.size -= e ? 1 : 0, e;
207
+ }
208
+ var zn = Bn, Gn = le;
209
+ function Un(r) {
210
+ return Gn(this, r).get(r);
211
+ }
212
+ var jn = Un, kn = le;
213
+ function Hn(r) {
214
+ return kn(this, r).has(r);
215
+ }
216
+ var Vn = Hn, Kn = le;
217
+ function qn(r, e) {
218
+ var t = Kn(this, r), i = t.size;
219
+ return t.set(r, e), this.size += t.size == i ? 0 : 1, this;
220
+ }
221
+ var Wn = qn, Yn = On, Jn = zn, Zn = jn, Xn = Vn, Qn = Wn;
222
+ function H(r) {
223
+ var e = -1, t = r == null ? 0 : r.length;
224
+ for (this.clear(); ++e < t; ) {
225
+ var i = r[e];
226
+ this.set(i[0], i[1]);
227
+ }
228
+ }
229
+ H.prototype.clear = Yn;
230
+ H.prototype.delete = Jn;
231
+ H.prototype.get = Zn;
232
+ H.prototype.has = Xn;
233
+ H.prototype.set = Qn;
234
+ var Ie = H, es = ae, ts = Pe, rs = Ie, is = 200;
235
+ function ns(r, e) {
236
+ var t = this.__data__;
237
+ if (t instanceof es) {
238
+ var i = t.__data__;
239
+ if (!ts || i.length < is - 1)
240
+ return i.push([r, e]), this.size = ++t.size, this;
241
+ t = this.__data__ = new rs(i);
242
+ }
243
+ return t.set(r, e), this.size = t.size, this;
244
+ }
245
+ var ss = ns, as = ae, os = Kr, us = Wr, ls = Jr, cs = Xr, ds = ss;
246
+ function V(r) {
247
+ var e = this.__data__ = new as(r);
248
+ this.size = e.size;
249
+ }
250
+ V.prototype.clear = os;
251
+ V.prototype.delete = us;
252
+ V.prototype.get = ls;
253
+ V.prototype.has = cs;
254
+ V.prototype.set = ds;
255
+ var Kt = V, gs = "__lodash_hash_undefined__";
256
+ function hs(r) {
257
+ return this.__data__.set(r, gs), this;
258
+ }
259
+ var fs = hs;
260
+ function ps(r) {
261
+ return this.__data__.has(r);
262
+ }
263
+ var bs = ps, ys = Ie, vs = fs, ms = bs;
264
+ function te(r) {
265
+ var e = -1, t = r == null ? 0 : r.length;
266
+ for (this.__data__ = new ys(); ++e < t; )
267
+ this.add(r[e]);
268
+ }
269
+ te.prototype.add = te.prototype.push = vs;
270
+ te.prototype.has = ms;
271
+ var _s = te;
272
+ function Cs(r, e) {
273
+ for (var t = -1, i = r == null ? 0 : r.length; ++t < i; )
274
+ if (e(r[t], t, r))
275
+ return !0;
276
+ return !1;
277
+ }
278
+ var Ss = Cs;
279
+ function As(r, e) {
280
+ return r.has(e);
281
+ }
282
+ var xs = As, $s = _s, Es = Ss, Fs = xs, Ts = 1, ws = 2;
283
+ function Ns(r, e, t, i, n, s) {
284
+ var a = t & Ts, o = r.length, l = e.length;
285
+ if (o != l && !(a && l > o))
286
+ return !1;
287
+ var c = s.get(r), d = s.get(e);
288
+ if (c && d)
289
+ return c == e && d == r;
290
+ var g = -1, h = !0, y = t & ws ? new $s() : void 0;
291
+ for (s.set(r, e), s.set(e, r); ++g < o; ) {
292
+ var _ = r[g], f = e[g];
293
+ if (i)
294
+ var A = a ? i(f, _, g, e, r, s) : i(_, f, g, r, e, s);
295
+ if (A !== void 0) {
296
+ if (A)
297
+ continue;
298
+ h = !1;
299
+ break;
300
+ }
301
+ if (y) {
302
+ if (!Es(e, function(x, $) {
303
+ if (!Fs(y, $) && (_ === x || n(_, x, t, i, s)))
304
+ return y.push($);
305
+ })) {
306
+ h = !1;
307
+ break;
308
+ }
309
+ } else if (!(_ === f || n(_, f, t, i, s))) {
310
+ h = !1;
311
+ break;
312
+ }
313
+ }
314
+ return s.delete(r), s.delete(e), h;
315
+ }
316
+ var qt = Ns, Ds = N, Os = Ds.Uint8Array, Ls = Os;
317
+ function Ps(r) {
318
+ var e = -1, t = Array(r.size);
319
+ return r.forEach(function(i, n) {
320
+ t[++e] = [n, i];
321
+ }), t;
322
+ }
323
+ var Is = Ps;
324
+ function Ms(r) {
325
+ var e = -1, t = Array(r.size);
326
+ return r.forEach(function(i) {
327
+ t[++e] = i;
328
+ }), t;
329
+ }
330
+ var Rs = Ms, et = Y, tt = Ls, Bs = Le, zs = qt, Gs = Is, Us = Rs, js = 1, ks = 2, Hs = "[object Boolean]", Vs = "[object Date]", Ks = "[object Error]", qs = "[object Map]", Ws = "[object Number]", Ys = "[object RegExp]", Js = "[object Set]", Zs = "[object String]", Xs = "[object Symbol]", Qs = "[object ArrayBuffer]", ea = "[object DataView]", rt = et ? et.prototype : void 0, pe = rt ? rt.valueOf : void 0;
331
+ function ta(r, e, t, i, n, s, a) {
332
+ switch (t) {
333
+ case ea:
334
+ if (r.byteLength != e.byteLength || r.byteOffset != e.byteOffset)
335
+ return !1;
336
+ r = r.buffer, e = e.buffer;
337
+ case Qs:
338
+ return !(r.byteLength != e.byteLength || !s(new tt(r), new tt(e)));
339
+ case Hs:
340
+ case Vs:
341
+ case Ws:
342
+ return Bs(+r, +e);
343
+ case Ks:
344
+ return r.name == e.name && r.message == e.message;
345
+ case Ys:
346
+ case Zs:
347
+ return r == e + "";
348
+ case qs:
349
+ var o = Gs;
350
+ case Js:
351
+ var l = i & js;
352
+ if (o || (o = Us), r.size != e.size && !l)
353
+ return !1;
354
+ var c = a.get(r);
355
+ if (c)
356
+ return c == e;
357
+ i |= ks, a.set(r, e);
358
+ var d = zs(o(r), o(e), i, n, s, a);
359
+ return a.delete(r), d;
360
+ case Xs:
361
+ if (pe)
362
+ return pe.call(r) == pe.call(e);
363
+ }
364
+ return !1;
365
+ }
366
+ var ra = ta;
367
+ function ia(r, e) {
368
+ for (var t = -1, i = e.length, n = r.length; ++t < i; )
369
+ r[n + t] = e[t];
370
+ return r;
371
+ }
372
+ var Wt = ia, na = Array.isArray, T = na, sa = Wt, aa = T;
373
+ function oa(r, e, t) {
374
+ var i = e(r);
375
+ return aa(r) ? i : sa(i, t(r));
376
+ }
377
+ var ua = oa;
378
+ function la(r, e) {
379
+ for (var t = -1, i = r == null ? 0 : r.length, n = 0, s = []; ++t < i; ) {
380
+ var a = r[t];
381
+ e(a, t, r) && (s[n++] = a);
382
+ }
383
+ return s;
384
+ }
385
+ var ca = la;
386
+ function da() {
387
+ return [];
388
+ }
389
+ var ga = da, ha = ca, fa = ga, pa = Object.prototype, ba = pa.propertyIsEnumerable, it = Object.getOwnPropertySymbols, ya = it ? function(r) {
390
+ return r == null ? [] : (r = Object(r), ha(it(r), function(e) {
391
+ return ba.call(r, e);
392
+ }));
393
+ } : fa, va = ya;
394
+ function ma(r, e) {
395
+ for (var t = -1, i = Array(r); ++t < r; )
396
+ i[t] = e(t);
397
+ return i;
398
+ }
399
+ var _a = ma;
400
+ function Ca(r) {
401
+ return r != null && typeof r == "object";
402
+ }
403
+ var Z = Ca, Sa = J, Aa = Z, xa = "[object Arguments]";
404
+ function $a(r) {
405
+ return Aa(r) && Sa(r) == xa;
406
+ }
407
+ var Ea = $a, nt = Ea, Fa = Z, Yt = Object.prototype, Ta = Yt.hasOwnProperty, wa = Yt.propertyIsEnumerable, Na = nt(/* @__PURE__ */ function() {
408
+ return arguments;
409
+ }()) ? nt : function(r) {
410
+ return Fa(r) && Ta.call(r, "callee") && !wa.call(r, "callee");
411
+ }, Me = Na, re = { exports: {} };
412
+ function Da() {
413
+ return !1;
414
+ }
415
+ var Oa = Da;
416
+ re.exports;
417
+ (function(r, e) {
418
+ var t = N, i = Oa, n = e && !e.nodeType && e, s = n && !0 && r && !r.nodeType && r, a = s && s.exports === n, o = a ? t.Buffer : void 0, l = o ? o.isBuffer : void 0, c = l || i;
419
+ r.exports = c;
420
+ })(re, re.exports);
421
+ var Jt = re.exports, La = 9007199254740991, Pa = /^(?:0|[1-9]\d*)$/;
422
+ function Ia(r, e) {
423
+ var t = typeof r;
424
+ return e = e ?? La, !!e && (t == "number" || t != "symbol" && Pa.test(r)) && r > -1 && r % 1 == 0 && r < e;
425
+ }
426
+ var Re = Ia, Ma = 9007199254740991;
427
+ function Ra(r) {
428
+ return typeof r == "number" && r > -1 && r % 1 == 0 && r <= Ma;
429
+ }
430
+ var Be = Ra, Ba = J, za = Be, Ga = Z, Ua = "[object Arguments]", ja = "[object Array]", ka = "[object Boolean]", Ha = "[object Date]", Va = "[object Error]", Ka = "[object Function]", qa = "[object Map]", Wa = "[object Number]", Ya = "[object Object]", Ja = "[object RegExp]", Za = "[object Set]", Xa = "[object String]", Qa = "[object WeakMap]", eo = "[object ArrayBuffer]", to = "[object DataView]", ro = "[object Float32Array]", io = "[object Float64Array]", no = "[object Int8Array]", so = "[object Int16Array]", ao = "[object Int32Array]", oo = "[object Uint8Array]", uo = "[object Uint8ClampedArray]", lo = "[object Uint16Array]", co = "[object Uint32Array]", b = {};
431
+ b[ro] = b[io] = b[no] = b[so] = b[ao] = b[oo] = b[uo] = b[lo] = b[co] = !0;
432
+ b[Ua] = b[ja] = b[eo] = b[ka] = b[to] = b[Ha] = b[Va] = b[Ka] = b[qa] = b[Wa] = b[Ya] = b[Ja] = b[Za] = b[Xa] = b[Qa] = !1;
433
+ function go(r) {
434
+ return Ga(r) && za(r.length) && !!b[Ba(r)];
435
+ }
436
+ var ho = go;
437
+ function fo(r) {
438
+ return function(e) {
439
+ return r(e);
440
+ };
441
+ }
442
+ var Zt = fo, ie = { exports: {} };
443
+ ie.exports;
444
+ (function(r, e) {
445
+ var t = jt, i = e && !e.nodeType && e, n = i && !0 && r && !r.nodeType && r, s = n && n.exports === i, a = s && t.process, o = function() {
446
+ try {
447
+ var l = n && n.require && n.require("util").types;
448
+ return l || a && a.binding && a.binding("util");
449
+ } catch {
450
+ }
451
+ }();
452
+ r.exports = o;
453
+ })(ie, ie.exports);
454
+ var po = ie.exports, bo = ho, yo = Zt, st = po, at = st && st.isTypedArray, vo = at ? yo(at) : bo, Xt = vo, mo = _a, _o = Me, Co = T, So = Jt, Ao = Re, xo = Xt, $o = Object.prototype, Eo = $o.hasOwnProperty;
455
+ function Fo(r, e) {
456
+ var t = Co(r), i = !t && _o(r), n = !t && !i && So(r), s = !t && !i && !n && xo(r), a = t || i || n || s, o = a ? mo(r.length, String) : [], l = o.length;
457
+ for (var c in r)
458
+ (e || Eo.call(r, c)) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
459
+ (c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
460
+ n && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
461
+ s && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
462
+ Ao(c, l))) && o.push(c);
463
+ return o;
464
+ }
465
+ var To = Fo, wo = Object.prototype;
466
+ function No(r) {
467
+ var e = r && r.constructor, t = typeof e == "function" && e.prototype || wo;
468
+ return r === t;
469
+ }
470
+ var Do = No;
471
+ function Oo(r, e) {
472
+ return function(t) {
473
+ return r(e(t));
474
+ };
475
+ }
476
+ var Lo = Oo, Po = Lo, Io = Po(Object.keys, Object), Mo = Io, Ro = Do, Bo = Mo, zo = Object.prototype, Go = zo.hasOwnProperty;
477
+ function Uo(r) {
478
+ if (!Ro(r))
479
+ return Bo(r);
480
+ var e = [];
481
+ for (var t in Object(r))
482
+ Go.call(r, t) && t != "constructor" && e.push(t);
483
+ return e;
484
+ }
485
+ var jo = Uo, ko = Ht, Ho = Be;
486
+ function Vo(r) {
487
+ return r != null && Ho(r.length) && !ko(r);
488
+ }
489
+ var ce = Vo, Ko = To, qo = jo, Wo = ce;
490
+ function Yo(r) {
491
+ return Wo(r) ? Ko(r) : qo(r);
492
+ }
493
+ var ze = Yo, Jo = ua, Zo = va, Xo = ze;
494
+ function Qo(r) {
495
+ return Jo(r, Xo, Zo);
496
+ }
497
+ var eu = Qo, ot = eu, tu = 1, ru = Object.prototype, iu = ru.hasOwnProperty;
498
+ function nu(r, e, t, i, n, s) {
499
+ var a = t & tu, o = ot(r), l = o.length, c = ot(e), d = c.length;
500
+ if (l != d && !a)
501
+ return !1;
502
+ for (var g = l; g--; ) {
503
+ var h = o[g];
504
+ if (!(a ? h in e : iu.call(e, h)))
505
+ return !1;
506
+ }
507
+ var y = s.get(r), _ = s.get(e);
508
+ if (y && _)
509
+ return y == e && _ == r;
510
+ var f = !0;
511
+ s.set(r, e), s.set(e, r);
512
+ for (var A = a; ++g < l; ) {
513
+ h = o[g];
514
+ var x = r[h], $ = e[h];
515
+ if (i)
516
+ var R = a ? i($, x, h, e, r, s) : i(x, $, h, r, e, s);
517
+ if (!(R === void 0 ? x === $ || n(x, $, t, i, s) : R)) {
518
+ f = !1;
519
+ break;
520
+ }
521
+ A || (A = h == "constructor");
522
+ }
523
+ if (f && !A) {
524
+ var v = r.constructor, O = e.constructor;
525
+ v != O && "constructor" in r && "constructor" in e && !(typeof v == "function" && v instanceof v && typeof O == "function" && O instanceof O) && (f = !1);
526
+ }
527
+ return s.delete(r), s.delete(e), f;
528
+ }
529
+ var su = nu, au = M, ou = N, uu = au(ou, "DataView"), lu = uu, cu = M, du = N, gu = cu(du, "Promise"), hu = gu, fu = M, pu = N, bu = fu(pu, "Set"), yu = bu, vu = M, mu = N, _u = vu(mu, "WeakMap"), Cu = _u, Se = lu, Ae = Pe, xe = hu, $e = yu, Ee = Cu, Qt = J, K = Vt, ut = "[object Map]", Su = "[object Object]", lt = "[object Promise]", ct = "[object Set]", dt = "[object WeakMap]", gt = "[object DataView]", Au = K(Se), xu = K(Ae), $u = K(xe), Eu = K($e), Fu = K(Ee), L = Qt;
530
+ (Se && L(new Se(new ArrayBuffer(1))) != gt || Ae && L(new Ae()) != ut || xe && L(xe.resolve()) != lt || $e && L(new $e()) != ct || Ee && L(new Ee()) != dt) && (L = function(r) {
531
+ var e = Qt(r), t = e == Su ? r.constructor : void 0, i = t ? K(t) : "";
532
+ if (i)
533
+ switch (i) {
534
+ case Au:
535
+ return gt;
536
+ case xu:
537
+ return ut;
538
+ case $u:
539
+ return lt;
540
+ case Eu:
541
+ return ct;
542
+ case Fu:
543
+ return dt;
544
+ }
545
+ return e;
546
+ });
547
+ var Tu = L, be = Kt, wu = qt, Nu = ra, Du = su, ht = Tu, ft = T, pt = Jt, Ou = Xt, Lu = 1, bt = "[object Arguments]", yt = "[object Array]", Q = "[object Object]", Pu = Object.prototype, vt = Pu.hasOwnProperty;
548
+ function Iu(r, e, t, i, n, s) {
549
+ var a = ft(r), o = ft(e), l = a ? yt : ht(r), c = o ? yt : ht(e);
550
+ l = l == bt ? Q : l, c = c == bt ? Q : c;
551
+ var d = l == Q, g = c == Q, h = l == c;
552
+ if (h && pt(r)) {
553
+ if (!pt(e))
554
+ return !1;
555
+ a = !0, d = !1;
556
+ }
557
+ if (h && !d)
558
+ return s || (s = new be()), a || Ou(r) ? wu(r, e, t, i, n, s) : Nu(r, e, l, t, i, n, s);
559
+ if (!(t & Lu)) {
560
+ var y = d && vt.call(r, "__wrapped__"), _ = g && vt.call(e, "__wrapped__");
561
+ if (y || _) {
562
+ var f = y ? r.value() : r, A = _ ? e.value() : e;
563
+ return s || (s = new be()), n(f, A, t, i, s);
564
+ }
565
+ }
566
+ return h ? (s || (s = new be()), Du(r, e, t, i, n, s)) : !1;
567
+ }
568
+ var Mu = Iu, Ru = Mu, mt = Z;
569
+ function er(r, e, t, i, n) {
570
+ return r === e ? !0 : r == null || e == null || !mt(r) && !mt(e) ? r !== r && e !== e : Ru(r, e, t, i, er, n);
571
+ }
572
+ var Ge = er, Bu = Ge;
573
+ function zu(r, e) {
574
+ return Bu(r, e);
575
+ }
576
+ var Gu = zu;
577
+ const Uu = /* @__PURE__ */ Oe(Gu);
578
+ var _t = Y, ju = Me, ku = T, Ct = _t ? _t.isConcatSpreadable : void 0;
579
+ function Hu(r) {
580
+ return ku(r) || ju(r) || !!(Ct && r && r[Ct]);
581
+ }
582
+ var Vu = Hu, Ku = Wt, qu = Vu;
583
+ function tr(r, e, t, i, n) {
584
+ var s = -1, a = r.length;
585
+ for (t || (t = qu), n || (n = []); ++s < a; ) {
586
+ var o = r[s];
587
+ e > 0 && t(o) ? e > 1 ? tr(o, e - 1, t, i, n) : Ku(n, o) : i || (n[n.length] = o);
588
+ }
589
+ return n;
590
+ }
591
+ var Wu = tr;
592
+ function Yu(r, e) {
593
+ for (var t = -1, i = r == null ? 0 : r.length, n = Array(i); ++t < i; )
594
+ n[t] = e(r[t], t, r);
595
+ return n;
596
+ }
597
+ var rr = Yu, Ju = J, Zu = Z, Xu = "[object Symbol]";
598
+ function Qu(r) {
599
+ return typeof r == "symbol" || Zu(r) && Ju(r) == Xu;
600
+ }
601
+ var de = Qu, el = T, tl = de, rl = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, il = /^\w*$/;
602
+ function nl(r, e) {
603
+ if (el(r))
604
+ return !1;
605
+ var t = typeof r;
606
+ return t == "number" || t == "symbol" || t == "boolean" || r == null || tl(r) ? !0 : il.test(r) || !rl.test(r) || e != null && r in Object(e);
607
+ }
608
+ var Ue = nl, ir = Ie, sl = "Expected a function";
609
+ function je(r, e) {
610
+ if (typeof r != "function" || e != null && typeof e != "function")
611
+ throw new TypeError(sl);
612
+ var t = function() {
613
+ var i = arguments, n = e ? e.apply(this, i) : i[0], s = t.cache;
614
+ if (s.has(n))
615
+ return s.get(n);
616
+ var a = r.apply(this, i);
617
+ return t.cache = s.set(n, a) || s, a;
618
+ };
619
+ return t.cache = new (je.Cache || ir)(), t;
620
+ }
621
+ je.Cache = ir;
622
+ var al = je, ol = al, ul = 500;
623
+ function ll(r) {
624
+ var e = ol(r, function(i) {
625
+ return t.size === ul && t.clear(), i;
626
+ }), t = e.cache;
627
+ return e;
628
+ }
629
+ var cl = ll, dl = cl, gl = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, hl = /\\(\\)?/g, fl = dl(function(r) {
630
+ var e = [];
631
+ return r.charCodeAt(0) === 46 && e.push(""), r.replace(gl, function(t, i, n, s) {
632
+ e.push(n ? s.replace(hl, "$1") : i || t);
633
+ }), e;
634
+ }), pl = fl, St = Y, bl = rr, yl = T, vl = de, ml = 1 / 0, At = St ? St.prototype : void 0, xt = At ? At.toString : void 0;
635
+ function nr(r) {
636
+ if (typeof r == "string")
637
+ return r;
638
+ if (yl(r))
639
+ return bl(r, nr) + "";
640
+ if (vl(r))
641
+ return xt ? xt.call(r) : "";
642
+ var e = r + "";
643
+ return e == "0" && 1 / r == -ml ? "-0" : e;
644
+ }
645
+ var _l = nr, Cl = _l;
646
+ function Sl(r) {
647
+ return r == null ? "" : Cl(r);
648
+ }
649
+ var Al = Sl, xl = T, $l = Ue, El = pl, Fl = Al;
650
+ function Tl(r, e) {
651
+ return xl(r) ? r : $l(r, e) ? [r] : El(Fl(r));
652
+ }
653
+ var sr = Tl, wl = de, Nl = 1 / 0;
654
+ function Dl(r) {
655
+ if (typeof r == "string" || wl(r))
656
+ return r;
657
+ var e = r + "";
658
+ return e == "0" && 1 / r == -Nl ? "-0" : e;
659
+ }
660
+ var ge = Dl, Ol = sr, Ll = ge;
661
+ function Pl(r, e) {
662
+ e = Ol(e, r);
663
+ for (var t = 0, i = e.length; r != null && t < i; )
664
+ r = r[Ll(e[t++])];
665
+ return t && t == i ? r : void 0;
666
+ }
667
+ var ke = Pl, Il = Kt, Ml = Ge, Rl = 1, Bl = 2;
668
+ function zl(r, e, t, i) {
669
+ var n = t.length, s = n, a = !i;
670
+ if (r == null)
671
+ return !s;
672
+ for (r = Object(r); n--; ) {
673
+ var o = t[n];
674
+ if (a && o[2] ? o[1] !== r[o[0]] : !(o[0] in r))
675
+ return !1;
676
+ }
677
+ for (; ++n < s; ) {
678
+ o = t[n];
679
+ var l = o[0], c = r[l], d = o[1];
680
+ if (a && o[2]) {
681
+ if (c === void 0 && !(l in r))
682
+ return !1;
683
+ } else {
684
+ var g = new Il();
685
+ if (i)
686
+ var h = i(c, d, l, r, e, g);
687
+ if (!(h === void 0 ? Ml(d, c, Rl | Bl, i, g) : h))
688
+ return !1;
689
+ }
690
+ }
691
+ return !0;
692
+ }
693
+ var Gl = zl, Ul = oe;
694
+ function jl(r) {
695
+ return r === r && !Ul(r);
696
+ }
697
+ var ar = jl, kl = ar, Hl = ze;
698
+ function Vl(r) {
699
+ for (var e = Hl(r), t = e.length; t--; ) {
700
+ var i = e[t], n = r[i];
701
+ e[t] = [i, n, kl(n)];
702
+ }
703
+ return e;
704
+ }
705
+ var Kl = Vl;
706
+ function ql(r, e) {
707
+ return function(t) {
708
+ return t == null ? !1 : t[r] === e && (e !== void 0 || r in Object(t));
709
+ };
710
+ }
711
+ var or = ql, Wl = Gl, Yl = Kl, Jl = or;
712
+ function Zl(r) {
713
+ var e = Yl(r);
714
+ return e.length == 1 && e[0][2] ? Jl(e[0][0], e[0][1]) : function(t) {
715
+ return t === r || Wl(t, r, e);
716
+ };
717
+ }
718
+ var Xl = Zl, Ql = ke;
719
+ function ec(r, e, t) {
720
+ var i = r == null ? void 0 : Ql(r, e);
721
+ return i === void 0 ? t : i;
722
+ }
723
+ var tc = ec;
724
+ function rc(r, e) {
725
+ return r != null && e in Object(r);
726
+ }
727
+ var ic = rc, nc = sr, sc = Me, ac = T, oc = Re, uc = Be, lc = ge;
728
+ function cc(r, e, t) {
729
+ e = nc(e, r);
730
+ for (var i = -1, n = e.length, s = !1; ++i < n; ) {
731
+ var a = lc(e[i]);
732
+ if (!(s = r != null && t(r, a)))
733
+ break;
734
+ r = r[a];
735
+ }
736
+ return s || ++i != n ? s : (n = r == null ? 0 : r.length, !!n && uc(n) && oc(a, n) && (ac(r) || sc(r)));
737
+ }
738
+ var dc = cc, gc = ic, hc = dc;
739
+ function fc(r, e) {
740
+ return r != null && hc(r, e, gc);
741
+ }
742
+ var pc = fc, bc = Ge, yc = tc, vc = pc, mc = Ue, _c = ar, Cc = or, Sc = ge, Ac = 1, xc = 2;
743
+ function $c(r, e) {
744
+ return mc(r) && _c(e) ? Cc(Sc(r), e) : function(t) {
745
+ var i = yc(t, r);
746
+ return i === void 0 && i === e ? vc(t, r) : bc(e, i, Ac | xc);
747
+ };
748
+ }
749
+ var Ec = $c;
750
+ function Fc(r) {
751
+ return r;
752
+ }
753
+ var he = Fc;
754
+ function Tc(r) {
755
+ return function(e) {
756
+ return e == null ? void 0 : e[r];
757
+ };
758
+ }
759
+ var wc = Tc, Nc = ke;
760
+ function Dc(r) {
761
+ return function(e) {
762
+ return Nc(e, r);
763
+ };
764
+ }
765
+ var Oc = Dc, Lc = wc, Pc = Oc, Ic = Ue, Mc = ge;
766
+ function Rc(r) {
767
+ return Ic(r) ? Lc(Mc(r)) : Pc(r);
768
+ }
769
+ var Bc = Rc, zc = Xl, Gc = Ec, Uc = he, jc = T, kc = Bc;
770
+ function Hc(r) {
771
+ return typeof r == "function" ? r : r == null ? Uc : typeof r == "object" ? jc(r) ? Gc(r[0], r[1]) : zc(r) : kc(r);
772
+ }
773
+ var Vc = Hc;
774
+ function Kc(r) {
775
+ return function(e, t, i) {
776
+ for (var n = -1, s = Object(e), a = i(e), o = a.length; o--; ) {
777
+ var l = a[r ? o : ++n];
778
+ if (t(s[l], l, s) === !1)
779
+ break;
780
+ }
781
+ return e;
782
+ };
783
+ }
784
+ var qc = Kc, Wc = qc, Yc = Wc(), Jc = Yc, Zc = Jc, Xc = ze;
785
+ function Qc(r, e) {
786
+ return r && Zc(r, e, Xc);
787
+ }
788
+ var ed = Qc, td = ce;
789
+ function rd(r, e) {
790
+ return function(t, i) {
791
+ if (t == null)
792
+ return t;
793
+ if (!td(t))
794
+ return r(t, i);
795
+ for (var n = t.length, s = e ? n : -1, a = Object(t); (e ? s-- : ++s < n) && i(a[s], s, a) !== !1; )
796
+ ;
797
+ return t;
798
+ };
799
+ }
800
+ var id = rd, nd = ed, sd = id, ad = sd(nd), od = ad, ud = od, ld = ce;
801
+ function cd(r, e) {
802
+ var t = -1, i = ld(r) ? Array(r.length) : [];
803
+ return ud(r, function(n, s, a) {
804
+ i[++t] = e(n, s, a);
805
+ }), i;
806
+ }
807
+ var dd = cd;
808
+ function gd(r, e) {
809
+ var t = r.length;
810
+ for (r.sort(e); t--; )
811
+ r[t] = r[t].value;
812
+ return r;
813
+ }
814
+ var hd = gd, $t = de;
815
+ function fd(r, e) {
816
+ if (r !== e) {
817
+ var t = r !== void 0, i = r === null, n = r === r, s = $t(r), a = e !== void 0, o = e === null, l = e === e, c = $t(e);
818
+ if (!o && !c && !s && r > e || s && a && l && !o && !c || i && a && l || !t && l || !n)
819
+ return 1;
820
+ if (!i && !s && !c && r < e || c && t && n && !i && !s || o && t && n || !a && n || !l)
821
+ return -1;
822
+ }
823
+ return 0;
824
+ }
825
+ var pd = fd, bd = pd;
826
+ function yd(r, e, t) {
827
+ for (var i = -1, n = r.criteria, s = e.criteria, a = n.length, o = t.length; ++i < a; ) {
828
+ var l = bd(n[i], s[i]);
829
+ if (l) {
830
+ if (i >= o)
831
+ return l;
832
+ var c = t[i];
833
+ return l * (c == "desc" ? -1 : 1);
834
+ }
835
+ }
836
+ return r.index - e.index;
837
+ }
838
+ var vd = yd, ye = rr, md = ke, _d = Vc, Cd = dd, Sd = hd, Ad = Zt, xd = vd, $d = he, Ed = T;
839
+ function Fd(r, e, t) {
840
+ e.length ? e = ye(e, function(s) {
841
+ return Ed(s) ? function(a) {
842
+ return md(a, s.length === 1 ? s[0] : s);
843
+ } : s;
844
+ }) : e = [$d];
845
+ var i = -1;
846
+ e = ye(e, Ad(_d));
847
+ var n = Cd(r, function(s, a, o) {
848
+ var l = ye(e, function(c) {
849
+ return c(s);
850
+ });
851
+ return { criteria: l, index: ++i, value: s };
852
+ });
853
+ return Sd(n, function(s, a) {
854
+ return xd(s, a, t);
855
+ });
856
+ }
857
+ var Td = Fd;
858
+ function wd(r, e, t) {
859
+ switch (t.length) {
860
+ case 0:
861
+ return r.call(e);
862
+ case 1:
863
+ return r.call(e, t[0]);
864
+ case 2:
865
+ return r.call(e, t[0], t[1]);
866
+ case 3:
867
+ return r.call(e, t[0], t[1], t[2]);
868
+ }
869
+ return r.apply(e, t);
870
+ }
871
+ var Nd = wd, Dd = Nd, Et = Math.max;
872
+ function Od(r, e, t) {
873
+ return e = Et(e === void 0 ? r.length - 1 : e, 0), function() {
874
+ for (var i = arguments, n = -1, s = Et(i.length - e, 0), a = Array(s); ++n < s; )
875
+ a[n] = i[e + n];
876
+ n = -1;
877
+ for (var o = Array(e + 1); ++n < e; )
878
+ o[n] = i[n];
879
+ return o[e] = t(a), Dd(r, this, o);
880
+ };
881
+ }
882
+ var Ld = Od;
883
+ function Pd(r) {
884
+ return function() {
885
+ return r;
886
+ };
887
+ }
888
+ var Id = Pd, Md = M, Rd = function() {
889
+ try {
890
+ var r = Md(Object, "defineProperty");
891
+ return r({}, "", {}), r;
892
+ } catch {
893
+ }
894
+ }(), Bd = Rd, zd = Id, Ft = Bd, Gd = he, Ud = Ft ? function(r, e) {
895
+ return Ft(r, "toString", {
896
+ configurable: !0,
897
+ enumerable: !1,
898
+ value: zd(e),
899
+ writable: !0
900
+ });
901
+ } : Gd, jd = Ud, kd = 800, Hd = 16, Vd = Date.now;
902
+ function Kd(r) {
903
+ var e = 0, t = 0;
904
+ return function() {
905
+ var i = Vd(), n = Hd - (i - t);
906
+ if (t = i, n > 0) {
907
+ if (++e >= kd)
908
+ return arguments[0];
909
+ } else
910
+ e = 0;
911
+ return r.apply(void 0, arguments);
912
+ };
913
+ }
914
+ var qd = Kd, Wd = jd, Yd = qd, Jd = Yd(Wd), Zd = Jd, Xd = he, Qd = Ld, eg = Zd;
915
+ function tg(r, e) {
916
+ return eg(Qd(r, e, Xd), r + "");
917
+ }
918
+ var rg = tg, ig = Le, ng = ce, sg = Re, ag = oe;
919
+ function og(r, e, t) {
920
+ if (!ag(t))
921
+ return !1;
922
+ var i = typeof e;
923
+ return (i == "number" ? ng(t) && sg(e, t.length) : i == "string" && e in t) ? ig(t[e], r) : !1;
924
+ }
925
+ var ug = og, lg = Wu, cg = Td, dg = rg, Tt = ug, gg = dg(function(r, e) {
926
+ if (r == null)
927
+ return [];
928
+ var t = e.length;
929
+ return t > 1 && Tt(r, e[0], e[1]) ? e = [] : t > 2 && Tt(e[0], e[1], e[2]) && (e = [e[0]]), cg(r, lg(e, 1), []);
930
+ }), hg = gg;
931
+ const z = /* @__PURE__ */ Oe(hg), fg = /\S+\.(gif|jpe?g|tiff|png|bmp|svg)$/i, pg = [
932
+ "label",
933
+ "Label",
934
+ "name",
935
+ "Name",
936
+ "title",
937
+ "Title",
938
+ "rdfs:label"
939
+ ];
940
+ class u {
941
+ static isEqual(e, t) {
942
+ return Uu(e, t);
943
+ }
944
+ /**
945
+ * Check that a value is defined : not null and not undefined
946
+ *
947
+ * @param {any} value
948
+ * @return {boolean}
949
+ */
950
+ static isDefined(e) {
951
+ return e != null;
952
+ }
953
+ /**
954
+ * Truncate a text
955
+ */
956
+ static truncate(e, t, i = 0) {
957
+ const n = "…";
958
+ if (!u.isDefined(e))
959
+ return "";
960
+ const s = `${e}`;
961
+ if (s.length <= i + 1)
962
+ return s;
963
+ const a = i - 1;
964
+ switch (t) {
965
+ case "middle":
966
+ return s.substring(0, Math.ceil(a / 2)) + n + s.substring(s.length - Math.floor(a / 2));
967
+ case "end":
968
+ return s.substring(0, a) + n;
969
+ }
970
+ }
971
+ /**
972
+ * Return a value from a nested object depending on a keyPath
973
+ */
974
+ static getIn(e, t) {
975
+ return t.reduce((i, n) => i && i[n] !== void 0 ? i[n] : void 0, e);
976
+ }
977
+ /**
978
+ * Return a clone of an object
979
+ */
980
+ static clone(e) {
981
+ return typeof e == "object" ? JSON.parse(
982
+ JSON.stringify(e, (t, i) => i instanceof Set ? {} : i)
983
+ ) : e;
984
+ }
985
+ /**
986
+ * Get the amount of hidden neighbors from a list of nodes
987
+ *
988
+ * @param nodes
989
+ */
990
+ static getHiddenNeighbors(e) {
991
+ return e.reduce((t, i) => {
992
+ const n = i.getData("statistics");
993
+ if (n !== void 0) {
994
+ const s = n.degree !== void 0 && !n.supernode ? n.degree - u.getDegreeWithoutSelfConnection(i) : n.supernodeDegree;
995
+ if (s !== void 0 && s > 0)
996
+ return t += s;
997
+ }
998
+ return t;
999
+ }, 0);
1000
+ }
1001
+ /**
1002
+ * Return the visible degree of a node without self connection (self edge)
1003
+ *
1004
+ * @param {Node} node
1005
+ * @return {number}
1006
+ */
1007
+ static getDegreeWithoutSelfConnection(e) {
1008
+ return e.getAdjacentNodes({ policy: "exclude-sources", filter: "raw" }).size;
1009
+ }
1010
+ /**
1011
+ * Return a formatted version of a number
1012
+ */
1013
+ static formatNumber(e) {
1014
+ let t = 1, i = "";
1015
+ const n = e < 0 ? "-" : "";
1016
+ e = Math.abs(e), e >= 1e6 ? (t = 1e6, i = "M") : e >= 1e3 && (t = 1e3, i = "k");
1017
+ const s = e / t;
1018
+ return s < 10 && s % 1 !== 0 ? n + s.toFixed(1) + i : n + Math.floor(s) + i;
1019
+ }
1020
+ /**
1021
+ * Return true if a string is not composed only by invisible char
1022
+ *
1023
+ * @param {string} value
1024
+ * @return {boolean}
1025
+ */
1026
+ static isStringFilled(e) {
1027
+ return e.trim() !== "";
1028
+ }
1029
+ static getValueFromLkProperty(e) {
1030
+ if (typeof e == "object" && "type" in e) {
1031
+ if (!("original" in e) && !("value" in e))
1032
+ return null;
1033
+ if ("original" in e)
1034
+ return `${e.original}`;
1035
+ if ("value" in e)
1036
+ return u.formatDate(
1037
+ new Date(
1038
+ new Date(e.value).getTime() + u.timezoneToMilliseconds(e.timezone)
1039
+ ).toISOString()
1040
+ );
1041
+ }
1042
+ return e;
1043
+ }
1044
+ /**
1045
+ * Return a formatted date as a string
1046
+ */
1047
+ static formatDate(e, t, i) {
1048
+ let n = e;
1049
+ i !== void 0 && (n = new Date(e).getTime() + i * 1e3);
1050
+ const s = new Date(n);
1051
+ if (isNaN(s.getUTCFullYear()))
1052
+ return null;
1053
+ let a = s.getFullYear() + "-" + ((s.getUTCMonth() + 1).toString().length === 1 ? "0" + (s.getUTCMonth() + 1) : s.getUTCMonth() + 1) + "-" + (s.getUTCDate().toString().length === 1 ? "0" + s.getUTCDate() : s.getUTCDate());
1054
+ return t && (a += " " + (s.getUTCHours().toString().length === 1 ? "0" + s.getUTCHours() : s.getUTCHours()) + ":" + (s.getUTCMinutes().toString().length === 1 ? "0" + s.getUTCMinutes() : s.getUTCMinutes()) + ":" + (s.getUTCSeconds().toString().length === 1 ? "0" + s.getUTCSeconds() : s.getUTCSeconds())), a;
1055
+ }
1056
+ /**
1057
+ * From "+03:00" return the offset in milliseconds
1058
+ * @param timezone
1059
+ */
1060
+ static timezoneToMilliseconds(e) {
1061
+ if (e === void 0 || e === "Z")
1062
+ return 0;
1063
+ const t = e[0], [i, n] = e.slice(1).split(":");
1064
+ return t === "+" ? this.sanitizeFormattedNumber(i) * 36e5 + this.sanitizeFormattedNumber(n) * 6e4 : (this.sanitizeFormattedNumber(i) * 36e5 + this.sanitizeFormattedNumber(n) * 6e4) * -1;
1065
+ }
1066
+ static sanitizeFormattedNumber(e) {
1067
+ return e.length === 2 && e.startsWith("0") ? u.parseNumber(e[1]) : u.parseNumber(e);
1068
+ }
1069
+ /**
1070
+ * Return true if `n` is (or can be parsed as) a float, but is NOT an integer
1071
+ *
1072
+ * @param {any} n
1073
+ * @return {number} a number (NaN is `n` cannot be parsed as a number)
1074
+ */
1075
+ static parseNumber(e) {
1076
+ if (typeof e == "string") {
1077
+ if (e.trim() === "")
1078
+ return Number.NaN;
1079
+ e = +e.replace(",", ".").replace(" ", "");
1080
+ }
1081
+ return typeof e != "number" || !isFinite(e) ? Number.NaN : e;
1082
+ }
1083
+ /**
1084
+ * Return an Array without duplicated keys
1085
+ *
1086
+ * @param {Array<any>} arr
1087
+ * @param {string} key
1088
+ * @return {Array<any>}
1089
+ */
1090
+ static uniqBy(e, t) {
1091
+ const i = /* @__PURE__ */ new Set();
1092
+ if (t) {
1093
+ const n = [];
1094
+ for (let s = 0; s < e.length; ++s)
1095
+ e[s] && e[s][t] && !i.has(e[s][t]) ? (i.add(e[s][t]), n.push(e[s])) : e[s][t] || n.push(e[s]);
1096
+ return n;
1097
+ }
1098
+ return typeof e[0] == "object" ? Array.from(new Set(e.map((n) => JSON.stringify(n)))).map((n) => JSON.parse(n)) : Array.from(new Set(e));
1099
+ }
1100
+ /**
1101
+ * Return 'image' or 'url' depending on the given string
1102
+ *
1103
+ * @param {string} value
1104
+ * @return {"image" | "url"}
1105
+ */
1106
+ static getType(e) {
1107
+ if (u.isURLImage(e))
1108
+ return "imageUrl";
1109
+ if (u.isImage(e))
1110
+ return "image";
1111
+ if (u.isUrl(e))
1112
+ return "url";
1113
+ }
1114
+ /**
1115
+ * Return true if the given string is an url that match the schema handled by LKE
1116
+ *
1117
+ * @param {string} value
1118
+ * @return {boolean}
1119
+ */
1120
+ static isUrl(e) {
1121
+ try {
1122
+ return new URL(e), !0;
1123
+ } catch {
1124
+ return !1;
1125
+ }
1126
+ }
1127
+ /**
1128
+ * Return true if the given string is an image extension
1129
+ *
1130
+ * @param {string} value
1131
+ * @return {boolean}
1132
+ */
1133
+ static isImage(e) {
1134
+ return fg.test(e);
1135
+ }
1136
+ /**
1137
+ * Return true if the given string is an url with an image extension
1138
+ *
1139
+ * @param {string} value
1140
+ * @return {boolean}
1141
+ */
1142
+ static isURLImage(e) {
1143
+ if (u.isUrl(e)) {
1144
+ const t = new URL(e);
1145
+ return u.isImage(t.pathname);
1146
+ }
1147
+ return !1;
1148
+ }
1149
+ /**
1150
+ * Return true if a value is not undefined, not null and not an empty string
1151
+ */
1152
+ static valueExists(e) {
1153
+ return u.isDefined(e) && (typeof e != "string" || u.isStringFilled(e));
1154
+ }
1155
+ /**
1156
+ * Return true if `n` is (or can be parsed as) a number
1157
+ */
1158
+ static isNumber(e) {
1159
+ return e = u.parseNumber(e), u.isDefined(e) && e === e;
1160
+ }
1161
+ /**
1162
+ * return the correct property value
1163
+ */
1164
+ static getPropertyValue(e, t, i) {
1165
+ if (typeof e == "object" && !Array.isArray(e)) {
1166
+ if ("status" in e)
1167
+ return t && "original" in e ? e.original : void 0;
1168
+ if ((e.type === "date" || e.type === "datetime") && i)
1169
+ return u.formatDate(e.value, e.type === "datetime");
1170
+ if (e.type === "date" || e.type === "datetime")
1171
+ return new Date(e.value).getTime();
1172
+ }
1173
+ return e;
1174
+ }
1175
+ /**
1176
+ * Parse the given value and return a float number or NaN
1177
+ *
1178
+ * @param {any} n
1179
+ * @return {number}
1180
+ */
1181
+ static parseFloat(e) {
1182
+ return u.parseNumber(e);
1183
+ }
1184
+ /**
1185
+ * Format a currency value to string.
1186
+ *
1187
+ * eg: 4123 -> 4.123,00 $
1188
+ */
1189
+ static formatCurrencyValue(e, t) {
1190
+ const i = e < 0 ? "- " : "";
1191
+ switch (t.format) {
1192
+ case B.SYMBOL_COMMAS_DOT:
1193
+ return `${i}${t.symbol !== void 0 ? t.symbol + " " : ""}${u.formatNumberToCurrency(e, ",", ".")}`;
1194
+ case B.SYMBOL_COMMAS:
1195
+ return `${i}${t.symbol !== void 0 ? t.symbol + " " : ""}${u.formatNumberToCurrency(e, ",")}`;
1196
+ case B.DOTS_COMMA_SYMBOL:
1197
+ return `${i}${u.formatNumberToCurrency(e, ".", ",")}${t.symbol !== void 0 ? " " + t.symbol : ""}`;
1198
+ case B.DOTS_SYMBOL:
1199
+ return `${i}${u.formatNumberToCurrency(e, ".")}${t.symbol !== void 0 ? " " + t.symbol : ""}`;
1200
+ case B.SPACES_COMMA_SYMBOL:
1201
+ return `${i}${u.formatNumberToCurrency(e, " ", ",")}${t.symbol !== void 0 ? " " + t.symbol : ""}`;
1202
+ case B.SPACES_SYMBOL:
1203
+ return `${i}${u.formatNumberToCurrency(e, " ")}${t.symbol !== void 0 ? " " + t.symbol : ""}`;
1204
+ default:
1205
+ throw Error(`Cannot format property value ${e}, unknown format ${t.format}.`);
1206
+ }
1207
+ }
1208
+ static formatNumberToCurrency(e, t, i) {
1209
+ if (!Number.isFinite(e))
1210
+ return e.toString();
1211
+ const [n, s] = i ? Math.abs(e).toFixed(2).split(".") : [Math.abs(e).toFixed(0), void 0];
1212
+ let a = -1;
1213
+ const o = n.split("").reverse().map((l) => (a++, a > 0 && a % 3 === 0 ? l + t : l)).reverse().join("");
1214
+ return i ? o + i + s : o;
1215
+ }
1216
+ }
1217
+ class w {
1218
+ /**
1219
+ * Return label for each node
1220
+ */
1221
+ static getText(e, t, i) {
1222
+ const n = "categories" in e ? e.categories : [e.type];
1223
+ if (w.captionExist(n, t))
1224
+ return "categories" in e ? w.generateNodeCaption(e, t, i) || null : w.generateEdgeCaption(e, t, i) || null;
1225
+ if (e.properties !== void 0) {
1226
+ const s = pg.find((a) => e.properties[a] !== void 0);
1227
+ if (s !== void 0 && u.isDefined(e.properties[s]))
1228
+ return `${u.getValueFromLkProperty(
1229
+ e.properties[s]
1230
+ )}`.trim();
1231
+ }
1232
+ return null;
1233
+ }
1234
+ /**
1235
+ * Return a readable string from an LkProperty
1236
+ */
1237
+ static getLabel(e, t) {
1238
+ if (typeof e == "object" && "type" in e) {
1239
+ if (!("original" in e) && !("value" in e))
1240
+ return null;
1241
+ if ("original" in e)
1242
+ return `${e.original}`;
1243
+ if ("value" in e)
1244
+ return u.formatDate(
1245
+ new Date(
1246
+ new Date(e.value).getTime() + u.timezoneToMilliseconds(e.timezone)
1247
+ ).toISOString()
1248
+ );
1249
+ } else if ((t == null ? void 0 : t.name) === pr.NUMBER && t.options !== void 0)
1250
+ return u.formatCurrencyValue(e, t.options);
1251
+ return `${e}`.trim();
1252
+ }
1253
+ /**
1254
+ * Return true if caption configuration exists in schema
1255
+ */
1256
+ static captionExist(e, t) {
1257
+ return e.some((i) => u.isDefined(t[i]));
1258
+ }
1259
+ /**
1260
+ * Generate text from node data and captions schema
1261
+ */
1262
+ static generateNodeCaption(e, t, i) {
1263
+ const n = e.categories, s = [];
1264
+ let a = [];
1265
+ return n.forEach((o) => {
1266
+ t[o] && t[o].active && (t[o].displayName && s.push(o), a = [...a, ...t[o].properties]);
1267
+ }), u.uniqBy(a).forEach((o) => {
1268
+ if (e.properties[o] !== void 0) {
1269
+ const l = i ? w.getPropertyType(i, o, n[0]) : void 0;
1270
+ s.push(this.getLabel(e.properties[o], l));
1271
+ }
1272
+ }), s.filter((o) => o !== null).join(" - ").trim();
1273
+ }
1274
+ static getPropertyType(e, t, i) {
1275
+ const n = e.find((a) => a.itemType === i), s = n == null ? void 0 : n.properties.find(
1276
+ (a) => a.propertyKey === t
1277
+ );
1278
+ return s == null ? void 0 : s.propertyType;
1279
+ }
1280
+ /**
1281
+ * Generate text from edge data and captions schema
1282
+ */
1283
+ static generateEdgeCaption(e, t, i) {
1284
+ const n = e.type, s = [];
1285
+ let a = [];
1286
+ return t[n] && t[n].active ? (t[n].displayName && s.push(n), a = [...a, ...t[n].properties], u.uniqBy(a).forEach((o) => {
1287
+ if (u.isDefined(e.properties[o])) {
1288
+ const l = i ? w.getPropertyType(i, o, n) : void 0;
1289
+ s.push(w.getLabel(e.properties[o], l));
1290
+ }
1291
+ }), s.join(" - ").trim()) : "";
1292
+ }
1293
+ }
1294
+ var ur = { exports: {} }, lr = { exports: {} };
1295
+ (function() {
1296
+ var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", e = {
1297
+ // Bit-wise rotation left
1298
+ rotl: function(t, i) {
1299
+ return t << i | t >>> 32 - i;
1300
+ },
1301
+ // Bit-wise rotation right
1302
+ rotr: function(t, i) {
1303
+ return t << 32 - i | t >>> i;
1304
+ },
1305
+ // Swap big-endian to little-endian and vice versa
1306
+ endian: function(t) {
1307
+ if (t.constructor == Number)
1308
+ return e.rotl(t, 8) & 16711935 | e.rotl(t, 24) & 4278255360;
1309
+ for (var i = 0; i < t.length; i++)
1310
+ t[i] = e.endian(t[i]);
1311
+ return t;
1312
+ },
1313
+ // Generate an array of any length of random bytes
1314
+ randomBytes: function(t) {
1315
+ for (var i = []; t > 0; t--)
1316
+ i.push(Math.floor(Math.random() * 256));
1317
+ return i;
1318
+ },
1319
+ // Convert a byte array to big-endian 32-bit words
1320
+ bytesToWords: function(t) {
1321
+ for (var i = [], n = 0, s = 0; n < t.length; n++, s += 8)
1322
+ i[s >>> 5] |= t[n] << 24 - s % 32;
1323
+ return i;
1324
+ },
1325
+ // Convert big-endian 32-bit words to a byte array
1326
+ wordsToBytes: function(t) {
1327
+ for (var i = [], n = 0; n < t.length * 32; n += 8)
1328
+ i.push(t[n >>> 5] >>> 24 - n % 32 & 255);
1329
+ return i;
1330
+ },
1331
+ // Convert a byte array to a hex string
1332
+ bytesToHex: function(t) {
1333
+ for (var i = [], n = 0; n < t.length; n++)
1334
+ i.push((t[n] >>> 4).toString(16)), i.push((t[n] & 15).toString(16));
1335
+ return i.join("");
1336
+ },
1337
+ // Convert a hex string to a byte array
1338
+ hexToBytes: function(t) {
1339
+ for (var i = [], n = 0; n < t.length; n += 2)
1340
+ i.push(parseInt(t.substr(n, 2), 16));
1341
+ return i;
1342
+ },
1343
+ // Convert a byte array to a base-64 string
1344
+ bytesToBase64: function(t) {
1345
+ for (var i = [], n = 0; n < t.length; n += 3)
1346
+ for (var s = t[n] << 16 | t[n + 1] << 8 | t[n + 2], a = 0; a < 4; a++)
1347
+ n * 8 + a * 6 <= t.length * 8 ? i.push(r.charAt(s >>> 6 * (3 - a) & 63)) : i.push("=");
1348
+ return i.join("");
1349
+ },
1350
+ // Convert a base-64 string to a byte array
1351
+ base64ToBytes: function(t) {
1352
+ t = t.replace(/[^A-Z0-9+\/]/ig, "");
1353
+ for (var i = [], n = 0, s = 0; n < t.length; s = ++n % 4)
1354
+ s != 0 && i.push((r.indexOf(t.charAt(n - 1)) & Math.pow(2, -2 * s + 8) - 1) << s * 2 | r.indexOf(t.charAt(n)) >>> 6 - s * 2);
1355
+ return i;
1356
+ }
1357
+ };
1358
+ lr.exports = e;
1359
+ })();
1360
+ var bg = lr.exports, Fe = {
1361
+ // UTF-8 encoding
1362
+ utf8: {
1363
+ // Convert a string to a byte array
1364
+ stringToBytes: function(r) {
1365
+ return Fe.bin.stringToBytes(unescape(encodeURIComponent(r)));
1366
+ },
1367
+ // Convert a byte array to a string
1368
+ bytesToString: function(r) {
1369
+ return decodeURIComponent(escape(Fe.bin.bytesToString(r)));
1370
+ }
1371
+ },
1372
+ // Binary encoding
1373
+ bin: {
1374
+ // Convert a string to a byte array
1375
+ stringToBytes: function(r) {
1376
+ for (var e = [], t = 0; t < r.length; t++)
1377
+ e.push(r.charCodeAt(t) & 255);
1378
+ return e;
1379
+ },
1380
+ // Convert a byte array to a string
1381
+ bytesToString: function(r) {
1382
+ for (var e = [], t = 0; t < r.length; t++)
1383
+ e.push(String.fromCharCode(r[t]));
1384
+ return e.join("");
1385
+ }
1386
+ }
1387
+ }, wt = Fe;
1388
+ (function() {
1389
+ var r = bg, e = wt.utf8, t = wt.bin, i = function(s) {
1390
+ s.constructor == String ? s = e.stringToBytes(s) : typeof Buffer < "u" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(s) ? s = Array.prototype.slice.call(s, 0) : Array.isArray(s) || (s = s.toString());
1391
+ var a = r.bytesToWords(s), o = s.length * 8, l = [], c = 1732584193, d = -271733879, g = -1732584194, h = 271733878, y = -1009589776;
1392
+ a[o >> 5] |= 128 << 24 - o % 32, a[(o + 64 >>> 9 << 4) + 15] = o;
1393
+ for (var _ = 0; _ < a.length; _ += 16) {
1394
+ for (var f = c, A = d, x = g, $ = h, R = y, v = 0; v < 80; v++) {
1395
+ if (v < 16)
1396
+ l[v] = a[_ + v];
1397
+ else {
1398
+ var O = l[v - 3] ^ l[v - 8] ^ l[v - 14] ^ l[v - 16];
1399
+ l[v] = O << 1 | O >>> 31;
1400
+ }
1401
+ var fr = (c << 5 | c >>> 27) + y + (l[v] >>> 0) + (v < 20 ? (d & g | ~d & h) + 1518500249 : v < 40 ? (d ^ g ^ h) + 1859775393 : v < 60 ? (d & g | d & h | g & h) - 1894007588 : (d ^ g ^ h) - 899497514);
1402
+ y = h, h = g, g = d << 30 | d >>> 2, d = c, c = fr;
1403
+ }
1404
+ c += f, d += A, g += x, h += $, y += R;
1405
+ }
1406
+ return [c, d, g, h, y];
1407
+ }, n = function(s, a) {
1408
+ var o = r.wordsToBytes(i(s));
1409
+ return a && a.asBytes ? o : a && a.asString ? t.bytesToString(o) : r.bytesToHex(o);
1410
+ };
1411
+ n._blocksize = 16, n._digestsize = 20, ur.exports = n;
1412
+ })();
1413
+ var yg = ur.exports;
1414
+ const He = /* @__PURE__ */ Oe(yg), F = "#7f7f7f", Nt = [
1415
+ "#9467bd",
1416
+ "#e377c2",
1417
+ "#1f77b4",
1418
+ "#17becf",
1419
+ "#2ca02c",
1420
+ "#bcbd22",
1421
+ "#d62728",
1422
+ "#ff7f0e",
1423
+ "#8c564b",
1424
+ "#c5b0d5",
1425
+ "#f7b6d2",
1426
+ "#aec7e8",
1427
+ "#9edae5",
1428
+ "#98df8a",
1429
+ "#dbdb8d",
1430
+ "#ff9896",
1431
+ "#ffbb78",
1432
+ "#c49c94"
1433
+ ];
1434
+ class E {
1435
+ constructor(e) {
1436
+ this.colorsCache = /* @__PURE__ */ new Map(), this._rulesMap = {}, this.refresh(e);
1437
+ }
1438
+ /**
1439
+ * Refresh the rules
1440
+ */
1441
+ refresh(e) {
1442
+ e.color !== void 0 && (this.colorsCache = /* @__PURE__ */ new Map()), this._rulesMap = {
1443
+ color: e.color ? [...e.color].reverse() : this._rulesMap.color,
1444
+ icon: e.icon ? [...e.icon].reverse() : this._rulesMap.icon,
1445
+ image: e.image ? [...e.image].reverse() : this._rulesMap.image,
1446
+ shape: e.shape ? [...e.shape].reverse() : this._rulesMap.shape,
1447
+ size: e.size ? [...e.size].reverse() : this._rulesMap.size,
1448
+ width: e.width ? [...e.width].reverse() : this._rulesMap.width
1449
+ };
1450
+ }
1451
+ /**
1452
+ * Return the color for a node when style color is auto
1453
+ */
1454
+ static autoColor(e, t) {
1455
+ return u.isDefined(e) ? Nt[E.getRandomUniqueColorPaletteIndex(e, Nt.length, t)] : F;
1456
+ }
1457
+ /**
1458
+ * Return a number from 0 to number of occurrence in a palette based on a property
1459
+ */
1460
+ static getRandomUniqueColorPaletteIndex(e, t, i) {
1461
+ return i && (e = e.toLowerCase()), +("0x" + He(e).substr(-4)) % t;
1462
+ }
1463
+ /**
1464
+ * Get color of a type
1465
+ */
1466
+ static getTypeColor(e, t) {
1467
+ return typeof e.style.color == "object" && e.style.color.input[0] !== "properties" ? E.autoColor(t, e.style.color.ignoreCase) : !u.isDefined(e.input) && typeof e.style.color != "object" ? e.style.color : null;
1468
+ }
1469
+ /**
1470
+ * return the corresponding size to the value with a linear function
1471
+ * @param value
1472
+ * @param lower
1473
+ * @param higher
1474
+ * @param extrema
1475
+ */
1476
+ static getAutomaticRangeStyleLinear(e, { max: t, min: i }, n, s) {
1477
+ if (t !== void 0 && i !== void 0) {
1478
+ if (t === i || isNaN(e))
1479
+ return "100%";
1480
+ const a = (s - n) / (t - i), o = (n * t - s * i) / (t - i);
1481
+ return `${Math.floor(e * a + o)}%`;
1482
+ }
1483
+ }
1484
+ /**
1485
+ * return the corresponding size to the value with a logarithmic function
1486
+ * @param value
1487
+ * @param lower
1488
+ * @param higher
1489
+ * @param extrema
1490
+ */
1491
+ static getAutomaticRangeStyleLog(e, { max: t, min: i }, n, s) {
1492
+ if (i !== void 0 && t !== void 0) {
1493
+ if (t === i || isNaN(e))
1494
+ return "100%";
1495
+ i < 1 && (e += Math.abs(i) + 1, t += Math.abs(i) + 1, i += Math.abs(i) + 1);
1496
+ const a = (s - n) / (Math.log(t) - Math.log(i)), o = (n * Math.log(t) - s * Math.log(i)) / (Math.log(t) - Math.log(i));
1497
+ return `${Math.floor(a * Math.log(e) + o)}%`;
1498
+ }
1499
+ }
1500
+ isAutoRange(e) {
1501
+ return typeof e == "object" && (e == null ? void 0 : e.type) === "autoRange";
1502
+ }
1503
+ }
1504
+ class W extends E {
1505
+ constructor(e) {
1506
+ super(e);
1507
+ }
1508
+ /**
1509
+ * Return rule that can be applied to the data
1510
+ */
1511
+ static matchStyle(e, t) {
1512
+ if (t !== void 0) {
1513
+ for (let i = 0; i < e.length; ++i)
1514
+ if (e[i].canApplyTo(t))
1515
+ return e[i];
1516
+ }
1517
+ }
1518
+ /**
1519
+ * Generate color for a given edge (call only if _rulesMap.color exists)
1520
+ */
1521
+ color(e) {
1522
+ if (!u.isDefined(e))
1523
+ return F;
1524
+ let t;
1525
+ for (let i = 0; i < this._rulesMap.color.length; ++i) {
1526
+ const n = this._rulesMap.color[i];
1527
+ if (n.canApplyTo(e)) {
1528
+ if (typeof n.style.color == "string")
1529
+ t = n.style.color;
1530
+ else if (typeof n.style.color == "object") {
1531
+ const s = u.getIn(e, n.style.color.input);
1532
+ t = E.autoColor(`${s}`, n.style.color.ignoreCase);
1533
+ }
1534
+ break;
1535
+ }
1536
+ }
1537
+ return u.isDefined(t) ? t : F;
1538
+ }
1539
+ /**
1540
+ * Generate shape for a given node
1541
+ */
1542
+ shape(e) {
1543
+ var t;
1544
+ if (this._rulesMap.shape !== void 0)
1545
+ return (t = W.matchStyle(this._rulesMap.shape, e)) == null ? void 0 : t.style.shape;
1546
+ }
1547
+ /**
1548
+ * Generate size for a given node
1549
+ */
1550
+ width(e) {
1551
+ if (this._rulesMap.width !== void 0) {
1552
+ const t = W.matchStyle(this._rulesMap.width, e);
1553
+ if (t !== void 0) {
1554
+ const i = t == null ? void 0 : t.style.width;
1555
+ if (i !== void 0 && this.isAutoRange(i)) {
1556
+ if (i.input !== void 0 && i.max !== void 0 && i.min !== void 0) {
1557
+ const n = i.input[1], s = u.parseNumber(e.properties[n]), a = i.scale && i.scale === Ut.LOGARITHMIC;
1558
+ return W.getAutomaticRangeWidth(s, t, a);
1559
+ }
1560
+ } else
1561
+ return i;
1562
+ }
1563
+ }
1564
+ }
1565
+ /**
1566
+ * return the corresponding width to the value
1567
+ * @param value
1568
+ * @param rule
1569
+ * @param isLog
1570
+ */
1571
+ static getAutomaticRangeWidth(e, t, i = !1) {
1572
+ return i ? this.getAutomaticRangeStyleLog(
1573
+ e,
1574
+ t.style.width,
1575
+ 50,
1576
+ 200
1577
+ /* MAX */
1578
+ ) : this.getAutomaticRangeStyleLinear(
1579
+ e,
1580
+ t.style.width,
1581
+ 50,
1582
+ 200
1583
+ /* MAX */
1584
+ );
1585
+ }
1586
+ /**
1587
+ * Return an object containing all node attributes needed by Ogma to style a node
1588
+ */
1589
+ all(e) {
1590
+ return u.isDefined(e) ? {
1591
+ color: this.color(e),
1592
+ shape: this.shape(e),
1593
+ width: this.width(e)
1594
+ } : {
1595
+ color: F,
1596
+ shape: br.ARROW,
1597
+ width: "100%"
1598
+ };
1599
+ }
1600
+ }
1601
+ class U extends E {
1602
+ constructor(e) {
1603
+ super(e);
1604
+ }
1605
+ /**
1606
+ * Run the callback if an item match with a style in the array of rules
1607
+ */
1608
+ static matchStyle(e, t, i) {
1609
+ if (u.isDefined(t) && u.isDefined(e)) {
1610
+ for (let n = 0; n < e.length; ++n)
1611
+ if (e[n].canApplyTo(t)) {
1612
+ i(e[n]);
1613
+ break;
1614
+ }
1615
+ }
1616
+ }
1617
+ /**
1618
+ * Generate color for a given node (call only if _rulesMap.color is defined
1619
+ */
1620
+ color(e) {
1621
+ if (!u.isDefined(e))
1622
+ return [F];
1623
+ const t = He(JSON.stringify(e)), i = this.colorsCache.get(t);
1624
+ if (i !== void 0)
1625
+ return i;
1626
+ let n = [];
1627
+ for (let a = 0; a < e.categories.length; ++a) {
1628
+ let o = null;
1629
+ for (let l = 0; l < this._rulesMap.color.length; ++l) {
1630
+ const c = this._rulesMap.color[l];
1631
+ if (!(c.itemType !== void 0 && c.itemType !== null && c.itemType !== e.categories[a]) && c.canApplyTo(e)) {
1632
+ if (typeof c.style.color == "object") {
1633
+ const d = u.getIn(e, c.style.color.input);
1634
+ Array.isArray(d) ? o = E.autoColor(e.categories[a], c.style.color.ignoreCase) : o = E.autoColor(`${d}`, c.style.color.ignoreCase);
1635
+ } else
1636
+ o = c.style.color;
1637
+ break;
1638
+ }
1639
+ }
1640
+ n.push(o);
1641
+ }
1642
+ n = n.filter((a) => u.isDefined(a)), n.length === 0 && (n = [F]);
1643
+ const s = n.length === 1 ? n[0] : n;
1644
+ return this.colorsCache.set(t, s), s;
1645
+ }
1646
+ /**
1647
+ * Generate icon for a given node
1648
+ */
1649
+ icon(e) {
1650
+ var a, o;
1651
+ const t = this.color(e), i = Array.isArray(t) ? t[0] : t;
1652
+ let n = {};
1653
+ const s = [...this._rulesMap.image || [], ...this._rulesMap.icon || []];
1654
+ if (!u.isDefined(e))
1655
+ return {
1656
+ icon: {},
1657
+ image: {}
1658
+ };
1659
+ for (let l = 0; l < s.length; ++l)
1660
+ if (s[l].canApplyTo(e)) {
1661
+ const c = s[l].style;
1662
+ if ("icon" in c && typeof c.icon == "object")
1663
+ n = {
1664
+ icon: {
1665
+ content: (a = c.icon) == null ? void 0 : a.content,
1666
+ font: (o = c.icon) == null ? void 0 : o.font,
1667
+ scale: 0.5,
1668
+ color: ne.isBright(i) ? "#000000" : "#FFFFFF"
1669
+ }
1670
+ };
1671
+ else if ("image" in c && typeof c.image == "object") {
1672
+ const d = U.getImageUrlFromStyleRule(
1673
+ c.image.url,
1674
+ e,
1675
+ this._baseUrl
1676
+ );
1677
+ d !== void 0 && (n = {
1678
+ image: {
1679
+ url: d,
1680
+ scale: c.image.scale,
1681
+ fit: c.image.fit,
1682
+ tile: c.image.tile,
1683
+ minVisibleSize: 0
1684
+ }
1685
+ });
1686
+ }
1687
+ break;
1688
+ }
1689
+ return n;
1690
+ }
1691
+ /**
1692
+ * Generate shape for a given node
1693
+ */
1694
+ shape(e) {
1695
+ let t;
1696
+ return this._rulesMap.shape !== void 0 && U.matchStyle(this._rulesMap.shape, e, (i) => {
1697
+ t = i.style.shape;
1698
+ }), t;
1699
+ }
1700
+ /**
1701
+ * Generate size for a given node
1702
+ */
1703
+ size(e) {
1704
+ let t;
1705
+ return this._rulesMap.size !== void 0 && U.matchStyle(
1706
+ this._rulesMap.size,
1707
+ e,
1708
+ (i) => {
1709
+ const n = i.style.size;
1710
+ if (this.isAutoRange(n)) {
1711
+ if (n.input !== void 0 && n.max !== void 0 && n.min !== void 0) {
1712
+ const s = n.input[1], a = u.parseNumber(e.properties[s]), o = n.scale && n.scale === Ut.LOGARITHMIC;
1713
+ t = U.getAutomaticRangeSize(a, i, o);
1714
+ }
1715
+ } else
1716
+ t = n;
1717
+ }
1718
+ ), t;
1719
+ }
1720
+ /**
1721
+ * return the corresponding size to the value
1722
+ * @param value
1723
+ * @param rule
1724
+ * @param isLog
1725
+ */
1726
+ static getAutomaticRangeSize(e, t, i = !1) {
1727
+ return i ? this.getAutomaticRangeStyleLog(
1728
+ e,
1729
+ t.style.size,
1730
+ 50,
1731
+ 500
1732
+ /* MAX */
1733
+ ) : this.getAutomaticRangeStyleLinear(
1734
+ e,
1735
+ t.style.size,
1736
+ 50,
1737
+ 500
1738
+ /* MAX */
1739
+ );
1740
+ }
1741
+ /**
1742
+ * Return an object containing all node attributes needed by Ogma to style a node
1743
+ */
1744
+ all(e) {
1745
+ if (!u.isDefined(e))
1746
+ return {
1747
+ color: F
1748
+ };
1749
+ const t = this.icon(e);
1750
+ return {
1751
+ radius: this.size(e),
1752
+ color: this.color(e),
1753
+ shape: this.shape(e),
1754
+ icon: t.icon,
1755
+ image: t.image
1756
+ };
1757
+ }
1758
+ /**
1759
+ * Return the value of the image url from a style rule or undefined
1760
+ * @param value
1761
+ * @param itemData
1762
+ * @param baseUrl
1763
+ */
1764
+ static getImageUrlFromStyleRule(e, t, i) {
1765
+ let n;
1766
+ return typeof e == "string" && ["imageUrl", "image"].includes(u.getType(e)) ? n = e : typeof e == "object" && (n = u.getIn(t, e.path)), n !== void 0 && i !== void 0 ? new URL(n, i).href : n;
1767
+ }
1768
+ /**
1769
+ * Set the base url (it will be used for image url while styling nodes)
1770
+ * @param baseUrl bse url
1771
+ */
1772
+ setBaseUrl(e) {
1773
+ this._baseUrl = e;
1774
+ }
1775
+ }
1776
+ var vg = /* @__PURE__ */ ((r) => (r.AUTO_RANGE = "autoRange", r))(vg || {});
1777
+ class C {
1778
+ constructor(e) {
1779
+ this.type = e.type, this.input = e.input, this.index = e.index, this.itemType = e.itemType, this.style = e.style, this.value = e.value;
1780
+ }
1781
+ static isAutomaticRange(e) {
1782
+ return e.style !== void 0 && (e.style.width !== void 0 && e.style.width.type === "autoRange" || e.style.size !== void 0 && e.style.size.type === "autoRange");
1783
+ }
1784
+ /**
1785
+ * Return an int describing specificity of the style. 4 = very specific / 1 = not specific
1786
+ *
1787
+ * @return {number}
1788
+ */
1789
+ get specificity() {
1790
+ return this.itemType !== void 0 && this.input !== void 0 ? 4 : this.itemType === void 0 && this.input !== void 0 ? 3 : this.itemType !== void 0 && this.input === void 0 ? 2 : 1;
1791
+ }
1792
+ /**
1793
+ * Return true if this style match values
1794
+ */
1795
+ matchValues(e, t, i) {
1796
+ return u.isDefined(t) ? (e === this.itemType || !u.isDefined(this.itemType)) && u.isEqual(["properties", ...t], this.input) && u.isEqual(i, this.value) || this.type === "any" && !u.isDefined(this.input) && typeof this.style.color == "object" && this.style.color.input[1] === t[0] : u.isDefined(this.itemType) ? e === this.itemType && !u.isDefined(this.input) : !u.isDefined(this.input);
1797
+ }
1798
+ static inputExists(e, t) {
1799
+ return e !== S.ANY;
1800
+ }
1801
+ /**
1802
+ * Return true if a style can apply to a node
1803
+ */
1804
+ canApplyTo(e) {
1805
+ const t = "categories" in e ? e.categories : [e.type];
1806
+ let i = !1;
1807
+ switch (this.type) {
1808
+ case S.ANY:
1809
+ i = C.checkAny(e, this.style);
1810
+ break;
1811
+ case S.NO_VALUE:
1812
+ C.inputExists(this.type, this.input) && (i = C.checkNoValue(e, this.input));
1813
+ break;
1814
+ case S.NAN:
1815
+ C.inputExists(this.type, this.input) && (i = C.checkNan(e, this.input));
1816
+ break;
1817
+ case S.RANGE:
1818
+ C.inputExists(this.type, this.input) && (i = C.checkRange(
1819
+ u.getIn(e, this.input),
1820
+ this.value
1821
+ ));
1822
+ break;
1823
+ case S.IS:
1824
+ C.inputExists(this.type, this.input) && (i = C.checkIs(e, this.input, this.value));
1825
+ break;
1826
+ }
1827
+ return i && C.checkItemType(t, this.itemType);
1828
+ }
1829
+ /**
1830
+ * Return true or false on rule type 'any' if the current node match the rule
1831
+ */
1832
+ static checkAny(e, t) {
1833
+ return typeof t.color == "object" ? u.isDefined(u.getIn(e, t.color.input)) : !0;
1834
+ }
1835
+ /**
1836
+ * Return true or false on rule type 'noValue' if the current node match the rule
1837
+ */
1838
+ static checkNoValue(e, t) {
1839
+ return !u.valueExists(u.getIn(e, t));
1840
+ }
1841
+ /**
1842
+ * Return true or false on rule type 'NaN' if the current node match the rule
1843
+ */
1844
+ static checkNan(e, t) {
1845
+ return !u.isNumber(u.getIn(e, t));
1846
+ }
1847
+ /**
1848
+ * Return true if predicate is true for the node value
1849
+ *
1850
+ * @param value
1851
+ * @param comparator
1852
+ * @return {boolean}
1853
+ */
1854
+ static checkRange(e, t) {
1855
+ return (t["<="] === void 0 || e <= t["<="]) && (t["<"] === void 0 || e < t["<"]) && (t[">"] === void 0 || e > t[">"]) && (t[">="] === void 0 || e >= t[">="]);
1856
+ }
1857
+ /**
1858
+ * Return true or false on rule type 'is' if the current node match the rule
1859
+ */
1860
+ static checkIs(e, t, i) {
1861
+ if (!u.isDefined(t))
1862
+ return !1;
1863
+ const n = u.getIn(e, t);
1864
+ let s = n;
1865
+ if (u.isDefined(n) && typeof n == "object" && (n.type === "date" || n.type === "datetime")) {
1866
+ let a = n.timezone;
1867
+ n.timezone === "Z" && (a = "+00:00"), s = u.formatDate(
1868
+ n.value,
1869
+ n.type === "datetime",
1870
+ u.timezoneToMilliseconds(a) / 1e3
1871
+ );
1872
+ }
1873
+ return u.isEqual(s, i);
1874
+ }
1875
+ /**
1876
+ * Check that value of itemType match for the node
1877
+ */
1878
+ static checkItemType(e, t) {
1879
+ return C.matchCategory(e, t) || C.matchAny(t);
1880
+ }
1881
+ /**
1882
+ * Return true if itemType is defined and category exists in an array of categories
1883
+ *
1884
+ * @param {Array<string> | string} types
1885
+ * @param {string} itemType
1886
+ * @return {boolean}
1887
+ */
1888
+ static matchCategory(e, t) {
1889
+ return u.isDefined(t) && (Array.isArray(e) ? e.includes(t) : u.isEqual(e, t));
1890
+ }
1891
+ /**
1892
+ * Return true if itemType is undefined
1893
+ *
1894
+ * @param {string} itemType
1895
+ * @return {boolean}
1896
+ */
1897
+ static matchAny(e) {
1898
+ return e === void 0;
1899
+ }
1900
+ /**
1901
+ * Return the color for a type
1902
+ */
1903
+ getTypeColor(e) {
1904
+ let t;
1905
+ return C.checkItemType([e], this.itemType) && this.type === S.ANY && !u.isDefined(this.input) && (t = E.getTypeColor(this, e)), t;
1906
+ }
1907
+ }
1908
+ var D = /* @__PURE__ */ ((r) => (r.COLOR = "color", r.ICON = "icon", r.SIZE = "size", r.IMAGE = "image", r.SHAPE = "shape", r.WIDTH = "width", r))(D || {});
1909
+ const G = ["specificity", "itemType", "index"];
1910
+ class p {
1911
+ constructor(e) {
1912
+ this._rules = e;
1913
+ }
1914
+ /**
1915
+ * Return an array of StyleRule with only 'color' rules and sorted by specificity, itemType and index
1916
+ *
1917
+ * @return {Array<StyleRule>}
1918
+ */
1919
+ get color() {
1920
+ return z(p.getBy("color", this._rules), G);
1921
+ }
1922
+ /**
1923
+ * Return an array of StyleRule with only 'icon' rules and sorted by specificity, itemType and index
1924
+ *
1925
+ * @return {Array<StyleRule>}
1926
+ */
1927
+ get icon() {
1928
+ return z(
1929
+ [
1930
+ ...p.getBy("icon", this._rules) || [],
1931
+ ...p.getBy("image", this._rules) || []
1932
+ ],
1933
+ G
1934
+ );
1935
+ }
1936
+ /**
1937
+ * Return an array of StyleRule with only 'image' rules and sorted by specificity, itemType and index
1938
+ *
1939
+ * @return {Array<StyleRule>}
1940
+ */
1941
+ get image() {
1942
+ return z(p.getBy("image", this._rules), G);
1943
+ }
1944
+ /**
1945
+ * Return an array of StyleRule with only 'shape' rules and sorted by specificity, itemType and index
1946
+ *
1947
+ * @return {Array<StyleRule>}
1948
+ */
1949
+ get shape() {
1950
+ return z(p.getBy("shape", this._rules), G);
1951
+ }
1952
+ /**
1953
+ * Return an array of StyleRule with only 'size' rules and sorted by specificity, itemType and index
1954
+ *
1955
+ * @return {Array<StyleRule>}
1956
+ */
1957
+ get size() {
1958
+ return z(p.getBy("size", this._rules), G);
1959
+ }
1960
+ /**
1961
+ * Return an array of StyleRule with only 'width' rules and sorted by specificity, itemType and index
1962
+ *
1963
+ * @return {Array<StyleRule>}
1964
+ */
1965
+ get width() {
1966
+ return z(p.getBy("width", this._rules), G);
1967
+ }
1968
+ /**
1969
+ * Return an object containing for each node style a sorted array of StyleRule
1970
+ *
1971
+ * @return {{[key: string]: Array<StyleRule>} }
1972
+ */
1973
+ get nodeRules() {
1974
+ return {
1975
+ color: this.color,
1976
+ icon: this.icon,
1977
+ image: this.image,
1978
+ shape: this.shape,
1979
+ size: this.size
1980
+ };
1981
+ }
1982
+ /**
1983
+ * Return an object containing for each edge style a sorted array of StyleRule
1984
+ *
1985
+ * @return { {[key: string]: Array<StyleRule>}}
1986
+ */
1987
+ get edgeRules() {
1988
+ return {
1989
+ color: this.color,
1990
+ shape: this.shape,
1991
+ width: this.width
1992
+ };
1993
+ }
1994
+ /**
1995
+ * Generate a legend with an array of style rules and existing items in visualization
1996
+ */
1997
+ generateLegend(e) {
1998
+ const t = {};
1999
+ return e.length === 0 || ("categories" in e[0] ? Object.keys(this.nodeRules).forEach((i) => {
2000
+ t[i] = p.getLegendForStyle(
2001
+ i,
2002
+ this.nodeRules[i],
2003
+ e
2004
+ );
2005
+ }) : Object.keys(this.edgeRules).forEach((i) => {
2006
+ t[i] = p.getLegendForStyle(
2007
+ i,
2008
+ this.edgeRules[i],
2009
+ e
2010
+ );
2011
+ })), t;
2012
+ }
2013
+ /**
2014
+ * Return the legend for a specific style type (color, icon, image...)
2015
+ */
2016
+ static getLegendForStyle(e, t, i) {
2017
+ const n = [], s = i.filter((a) => a);
2018
+ for (let a = 0; a < t.length; a++) {
2019
+ const o = new C(t[a]);
2020
+ if (s.some((c) => o.canApplyTo(c)))
2021
+ if (e === "color" && typeof o.style.color == "object")
2022
+ p.addLegendAutoColors(s, o, n);
2023
+ else if (e === "icon" && "image" in o.style) {
2024
+ const c = u.isDefined(o.input) ? `${p.getTypeLabel(o.itemType)}.${o.input[1]} ${p.sanitizeValue(o.type, o.value)}` : `${p.getTypeLabel(o.itemType)}`, d = o.style.image;
2025
+ if (!(d.url && typeof d.url == "object" && d.url.type === "data")) {
2026
+ const g = o.style.image;
2027
+ p.updateLegend(n, { label: c, value: g });
2028
+ }
2029
+ } else {
2030
+ const c = u.isDefined(o.input) ? `${p.getTypeLabel(o.itemType)}.${o.input[1]} ${p.sanitizeValue(o.type, o.value)}` : `${p.getTypeLabel(o.itemType)}`, d = o.style[e];
2031
+ p.updateLegend(n, { label: c, value: d });
2032
+ }
2033
+ }
2034
+ return n;
2035
+ }
2036
+ /**
2037
+ * Sanitize value for legend
2038
+ */
2039
+ static sanitizeValue(e, t) {
2040
+ let i = "";
2041
+ switch (e) {
2042
+ case S.NO_VALUE:
2043
+ return "is undefined";
2044
+ case S.NAN:
2045
+ return "is not an number";
2046
+ case S.RANGE:
2047
+ return Object.keys(t).forEach((n, s) => {
2048
+ s > 0 && (i += " and "), i += `${n} ${t[n]}`;
2049
+ }), i;
2050
+ }
2051
+ return typeof t == "object" ? `= ${JSON.stringify(t)}` : `= ${t}`;
2052
+ }
2053
+ /**
2054
+ * Add items in legend for automatic coloring
2055
+ */
2056
+ static addLegendAutoColors(e, t, i) {
2057
+ const n = t.style.color, s = n.input[1];
2058
+ e.forEach((a) => {
2059
+ const o = u.getIn(a, n.input);
2060
+ if (Array.isArray(o))
2061
+ o.forEach((l) => {
2062
+ const c = n.input.includes("properties") ? `${p.getTypeLabel(t.itemType)}.${s} = ${l}` : `${p.getTypeLabel(l)}`, d = E.autoColor(l, n.ignoreCase);
2063
+ p.updateLegend(i, { label: c, value: d });
2064
+ });
2065
+ else {
2066
+ const l = n.input.includes("properties") ? `${p.getTypeLabel(t.itemType)}.${s} = ${o}` : `${p.getTypeLabel(o)}`, c = E.autoColor(o, n.ignoreCase);
2067
+ p.updateLegend(i, { label: l, value: c });
2068
+ }
2069
+ });
2070
+ }
2071
+ /**
2072
+ * Return the label of item type for a legend item
2073
+ */
2074
+ static getTypeLabel(e) {
2075
+ return e === void 0 ? "All" : e === null ? "Others" : e;
2076
+ }
2077
+ /**
2078
+ * Check if a legend item already exists and overwrite it / push it
2079
+ */
2080
+ static updateLegend(e, { label: t, value: i }) {
2081
+ const n = e.map((s) => s.label).indexOf(t);
2082
+ n < 0 ? e.push({ label: t, value: i }) : e[n] = { label: t, value: i };
2083
+ }
2084
+ /**
2085
+ * return an array of StyleRule, containing only the desired style
2086
+ */
2087
+ static getBy(e, t) {
2088
+ return t.filter((i) => {
2089
+ switch (e) {
2090
+ case "color":
2091
+ return i.style.color !== void 0;
2092
+ case "icon":
2093
+ return "icon" in i.style && i.style.icon !== void 0;
2094
+ case "image":
2095
+ return "image" in i.style && i.style.image !== void 0;
2096
+ case "shape":
2097
+ return i.style.shape !== void 0;
2098
+ case "size":
2099
+ return "size" in i.style && i.style.size !== void 0;
2100
+ case "width":
2101
+ return "width" in i.style && i.style.width !== void 0;
2102
+ }
2103
+ }).map((i) => p.getRule(i, e));
2104
+ }
2105
+ /**
2106
+ * From a RawStyle, generate a StyleRule of a specific style
2107
+ */
2108
+ static getRule(e, t) {
2109
+ const i = u.clone(e);
2110
+ return i.style = { [t]: i.style[t] }, new C(i);
2111
+ }
2112
+ /**
2113
+ * Check for non unique index in styles rules and update them if exists
2114
+ */
2115
+ static sanitizeStylesIndex(e) {
2116
+ const t = [], i = u.clone(e);
2117
+ let n = Math.max(...e.node.map((s) => s.index), ...e.edge.map((s) => s.index)) + 1;
2118
+ return i.node = i.node.map((s) => (t.includes(s.index) ? (s.index = n, n++) : t.push(s.index), s)), i.edge = i.edge.map((s) => (t.includes(s.index) ? (s.index = n, n++) : t.push(s.index), s)), i;
2119
+ }
2120
+ }
2121
+ const Dt = {
2122
+ text: {
2123
+ style: "bold",
2124
+ backgroundColor: "#fff",
2125
+ minVisibleSize: 0
2126
+ },
2127
+ outerStroke: { width: 2 },
2128
+ outline: !1
2129
+ }, Ot = {
2130
+ text: {
2131
+ style: "bold",
2132
+ backgroundColor: "#fff",
2133
+ minVisibleSize: 0
2134
+ },
2135
+ outline: !1
2136
+ }, mg = {
2137
+ color: "#FFF",
2138
+ width: 7,
2139
+ scalingMethod: "scaled",
2140
+ strokeWidth: 0,
2141
+ hideNonAdjacentEdges: !1
2142
+ }, _g = {
2143
+ color: "#FFF",
2144
+ scalingMethod: "scaled",
2145
+ width: 4
2146
+ }, Cg = "'roboto', sans-serif", Lt = "#000", ve = "#FFF", Pt = "#7f7f7f", It = 0.2;
2147
+ class Sg {
2148
+ constructor(e, t) {
2149
+ this._nodeAttributes = new U({}), this._edgeAttributes = new W({}), this._ogma = e, this._defaultConfiguration = t, this._nodeAttributes.setBaseUrl(t.baseUrl);
2150
+ }
2151
+ /**
2152
+ * Set nodes default styles based on the configuration
2153
+ */
2154
+ setNodesDefaultStyles() {
2155
+ this._ogma.styles.setHoveredNodeAttributes(Dt), this._ogma.styles.setSelectedNodeAttributes(Dt), this._nodeDefaultStylesRules = this._ogma.styles.addRule({
2156
+ nodeAttributes: {
2157
+ text: {
2158
+ padding: 5,
2159
+ minVisibleSize: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.minVisibleSize ? this._defaultConfiguration.node.text.minVisibleSize : 12,
2160
+ maxLineLength: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.maxLineLength !== void 0 ? this._defaultConfiguration.node.text.maxLineLength : 30,
2161
+ position: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.nodePosition !== void 0 ? this._defaultConfiguration.node.text.nodePosition : "bottom",
2162
+ backgroundColor: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.backgroundColor !== void 0 ? this._defaultConfiguration.node.text.backgroundColor : void 0,
2163
+ font: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.font !== void 0 ? this._defaultConfiguration.node.text.font : "'roboto', sans-serif",
2164
+ color: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.color !== void 0 ? this._defaultConfiguration.node.text.color : "black",
2165
+ size: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.size !== void 0 ? this._defaultConfiguration.node.text.size : 14,
2166
+ margin: 5
2167
+ },
2168
+ radius: this.defaultNodeRadius(this._defaultConfiguration.node),
2169
+ icon: {
2170
+ minVisibleSize: 15
2171
+ },
2172
+ color: Pt,
2173
+ shape: this._defaultConfiguration.node.shape !== void 0 ? this._defaultConfiguration.node.shape : "circle",
2174
+ innerStroke: {
2175
+ width: 3
2176
+ },
2177
+ outline: !1
2178
+ }
2179
+ });
2180
+ }
2181
+ /**
2182
+ * Set edges default styles based on the configuration
2183
+ */
2184
+ setEdgesDefaultStyles() {
2185
+ var e;
2186
+ this._ogma.styles.setHoveredEdgeAttributes(Ot), this._ogma.styles.setSelectedEdgeAttributes(Ot), this._edgeDefaultStylesRules = this._ogma.styles.addRule({
2187
+ edgeAttributes: {
2188
+ text: {
2189
+ minVisibleSize: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.minVisibleSize ? this._defaultConfiguration.edge.text.minVisibleSize : 3,
2190
+ maxLineLength: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.maxLineLength !== void 0 ? this._defaultConfiguration.edge.text.maxLineLength : 30,
2191
+ backgroundColor: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.backgroundColor !== void 0 ? this._defaultConfiguration.edge.text.backgroundColor : void 0,
2192
+ font: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.font !== void 0 ? this._defaultConfiguration.edge.text.font : "'roboto', sans-serif",
2193
+ color: ((e = this._defaultConfiguration.edge) == null ? void 0 : e.text) !== void 0 && this._defaultConfiguration.edge.text.color !== void 0 ? this._defaultConfiguration.edge.text.color : "black",
2194
+ size: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.size !== void 0 ? this._defaultConfiguration.edge.text.size : 14
2195
+ },
2196
+ width: this.defaultEdgeWidth(this._defaultConfiguration.edge),
2197
+ shape: this._defaultConfiguration.edge.shape !== void 0 ? this._defaultConfiguration.edge.shape : "arrow",
2198
+ color: Pt
2199
+ }
2200
+ });
2201
+ }
2202
+ /**
2203
+ * Set nodes default styles based on the configuration
2204
+ */
2205
+ setNodesDefaultHalo() {
2206
+ this._nodeDefaultHaloRules = this._ogma.styles.addRule({
2207
+ nodeSelector: (e) => e && !e.hasClass("filtered"),
2208
+ nodeAttributes: {
2209
+ halo: (e) => e !== void 0 && !e.hasClass("filtered") && (e.isSelected() || e.getAdjacentNodes({}).isSelected().includes(!0) || e.getAdjacentEdges().isSelected().includes(!0)) ? {
2210
+ ...mg,
2211
+ scalingMethod: this._ogma.geo.enabled() ? "fixed" : "scaled"
2212
+ } : null
2213
+ },
2214
+ // recalculate the rule *only* when itself or adjacent
2215
+ // elements change their selection status
2216
+ nodeDependencies: {
2217
+ self: {
2218
+ selection: !0
2219
+ },
2220
+ adjacentNodes: {
2221
+ selection: !0
2222
+ },
2223
+ adjacentEdges: {
2224
+ selection: !0
2225
+ }
2226
+ }
2227
+ });
2228
+ }
2229
+ /**
2230
+ * Set edges default styles based on the configuration
2231
+ */
2232
+ setEdgesDefaultHalo() {
2233
+ this._edgeDefaultHaloRules = this._ogma.styles.addRule({
2234
+ edgeSelector: (e) => e && e.getSource() && e.getTarget() && !e.hasClass("filtered"),
2235
+ edgeAttributes: {
2236
+ halo: (e) => e && !e.hasClass("filtered") && (e.isSelected() || e.getSource().isSelected() || e.getTarget().isSelected()) ? {
2237
+ ..._g,
2238
+ scalingMethod: this._ogma.geo.enabled() ? "fixed" : "scaled"
2239
+ } : null
2240
+ },
2241
+ // this rule will only be invoked when the selection status
2242
+ // of the edge or it's extremities is changed
2243
+ edgeDependencies: {
2244
+ self: {
2245
+ selection: !0
2246
+ },
2247
+ extremities: {
2248
+ selection: !0
2249
+ }
2250
+ }
2251
+ });
2252
+ }
2253
+ /**
2254
+ * Return the default node radius set in configuration or 5
2255
+ *
2256
+ * @returns {number}
2257
+ */
2258
+ defaultNodeRadius(e) {
2259
+ return this.defaultStylesHas(e, ["nodeRadius"]) ? e.nodeRadius : 5;
2260
+ }
2261
+ /**
2262
+ * Return the default edge width set in configuration or 1
2263
+ *
2264
+ * @returns {number}
2265
+ */
2266
+ defaultEdgeWidth(e) {
2267
+ return this.defaultStylesHas(e, ["edgeWidth"]) ? e.edgeWidth : 1;
2268
+ }
2269
+ /**
2270
+ * Check if a style property exists in the default styles object
2271
+ */
2272
+ defaultStylesHas(e, t) {
2273
+ return u.isDefined(e) ? u.getIn(e, t) !== void 0 : !1;
2274
+ }
2275
+ /**
2276
+ * Set styles for the class "filtered"
2277
+ */
2278
+ setFilterClass() {
2279
+ this._ogma.styles.createClass({
2280
+ name: "filtered",
2281
+ nodeAttributes: {
2282
+ opacity: It,
2283
+ layer: (e) => e.getMetaNode() !== null ? 1 : -1,
2284
+ detectable: !1,
2285
+ badges: {
2286
+ topRight: {
2287
+ text: null
2288
+ },
2289
+ bottomRight: {
2290
+ text: null
2291
+ }
2292
+ },
2293
+ text: null,
2294
+ color: "rgb(240, 240, 240)",
2295
+ innerStroke: {
2296
+ width: 1,
2297
+ color: F,
2298
+ minVisibleSize: 1
2299
+ },
2300
+ shape: "circle",
2301
+ image: null,
2302
+ icon: null,
2303
+ radius: "50%"
2304
+ },
2305
+ edgeAttributes: {
2306
+ opacity: It,
2307
+ layer: (e) => {
2308
+ const t = e.getExtremities().getMetaNode().some((i) => i !== null);
2309
+ return !e.isVirtual() && t ? 1 : -1;
2310
+ },
2311
+ detectable: !1,
2312
+ text: null,
2313
+ color: F,
2314
+ shape: "line",
2315
+ width: 0.2
2316
+ }
2317
+ });
2318
+ }
2319
+ /**
2320
+ * Set the class for exported nodes and edges
2321
+ */
2322
+ setExportClass(e) {
2323
+ this._exportClass ? this._exportClass.update({
2324
+ nodeAttributes: {
2325
+ text: {
2326
+ maxLineLength: e ? 30 : 0
2327
+ },
2328
+ halo: null
2329
+ }
2330
+ }) : this._exportClass = this._ogma.styles.createClass({
2331
+ name: "exported",
2332
+ nodeAttributes: {
2333
+ text: {
2334
+ minVisibleSize: 0,
2335
+ size: 12,
2336
+ maxLineLength: e ? 30 : 0
2337
+ },
2338
+ halo: null
2339
+ },
2340
+ edgeAttributes: {
2341
+ text: {
2342
+ minVisibleSize: 0,
2343
+ size: 12
2344
+ },
2345
+ halo: null
2346
+ }
2347
+ });
2348
+ }
2349
+ /**
2350
+ * Set the rule to display badges
2351
+ */
2352
+ setBadgeRule() {
2353
+ this._ogma.styles.createClass({
2354
+ name: "degreeIndicator",
2355
+ nodeAttributes: {
2356
+ badges: {
2357
+ topRight: (e) => {
2358
+ if (e !== void 0) {
2359
+ const t = u.getHiddenNeighbors(e.toList()), i = u.formatNumber(t);
2360
+ if (t > 0) {
2361
+ const n = Array.isArray(e.getAttribute("color")) ? e.getAttribute("color")[0] : e.getAttribute("color"), s = ne.isBright(n) ? Lt : ve, a = e.getData(["statistics", "supernode"]);
2362
+ let o = null;
2363
+ return +i != 0 && (o = a ? i + "+" : i), {
2364
+ color: "inherit",
2365
+ minVisibleSize: 20,
2366
+ stroke: {
2367
+ width: 0,
2368
+ color: null
2369
+ },
2370
+ text: {
2371
+ font: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.font !== void 0 ? this._defaultConfiguration.node.text.font : Cg,
2372
+ scale: 0.4,
2373
+ color: s,
2374
+ content: o
2375
+ }
2376
+ };
2377
+ }
2378
+ }
2379
+ }
2380
+ }
2381
+ }
2382
+ }), this._ogma.styles.createClass({
2383
+ name: "pinnedIndicator",
2384
+ nodeAttributes: {
2385
+ badges: {
2386
+ bottomRight: (e) => {
2387
+ if (e !== void 0 && !e.getAttribute("layoutable"))
2388
+ return {
2389
+ color: this._findPinBadgeBackgroundColor(e),
2390
+ minVisibleSize: 20,
2391
+ scale: this._findPinBadgeScale(e),
2392
+ stroke: {
2393
+ width: 0,
2394
+ color: null
2395
+ },
2396
+ text: {
2397
+ font: "FontAwesome",
2398
+ scale: 0.4,
2399
+ color: this._findPinBadgeTextColor(e),
2400
+ content: e.getAttribute("layoutable") ? null : ""
2401
+ }
2402
+ };
2403
+ }
2404
+ }
2405
+ },
2406
+ nodeDependencies: {
2407
+ self: { attributes: ["layoutable"] }
2408
+ }
2409
+ }), this._ogma.events.on("addNodes", (e) => e.nodes.addClass("degreeIndicator")), this._ogma.events.on("addNodes", (e) => e.nodes.addClass("pinnedIndicator"));
2410
+ }
2411
+ /**
2412
+ * Delete the rule to display badges
2413
+ */
2414
+ deleteBadgeRule() {
2415
+ this._ogma.getNodes().removeClasses(["degreeIndicator", "pinnedIndicator"], 0);
2416
+ }
2417
+ /**
2418
+ * set text overlap to true or false
2419
+ *
2420
+ * @param {boolean} overlap
2421
+ */
2422
+ toggleTextOverlap(e) {
2423
+ this._ogma.setOptions({ texts: { preventOverlap: e } });
2424
+ }
2425
+ /**
2426
+ * refresh nodes and edge rules
2427
+ *
2428
+ */
2429
+ refreshRules() {
2430
+ this._nodeDefaultStylesRules.refresh(), this._edgeDefaultStylesRules.refresh();
2431
+ }
2432
+ /**
2433
+ * Create / refresh an ogma rule for node colors
2434
+ */
2435
+ refreshNodeColors(e) {
2436
+ u.isDefined(this._ogmaNodeColor) ? (this._nodeAttributes.refresh({ color: e }), this._ogmaNodeColor.refresh()) : (this._nodeAttributes.refresh({ color: e }), this._ogmaNodeColor = this._ogma.styles.addRule({
2437
+ nodeAttributes: {
2438
+ color: (t) => {
2439
+ if (t !== void 0)
2440
+ return this._nodeAttributes.color(t.getData());
2441
+ }
2442
+ },
2443
+ nodeDependencies: { self: { data: !0 } }
2444
+ }));
2445
+ }
2446
+ /**
2447
+ * Return an array of StyleRules with only the style that need to be applied
2448
+ */
2449
+ getStyleRule(e, t) {
2450
+ return new p(e)[t];
2451
+ }
2452
+ initNodeColors(e) {
2453
+ const t = this.getStyleRule(
2454
+ e,
2455
+ D.COLOR
2456
+ );
2457
+ this.refreshNodeColors(t);
2458
+ }
2459
+ initNodesIcons(e) {
2460
+ const t = this.getStyleRule(
2461
+ e,
2462
+ D.ICON
2463
+ );
2464
+ this.refreshNodeIcons(t);
2465
+ }
2466
+ initNodesSizes(e) {
2467
+ const t = this.getStyleRule(e, D.SIZE);
2468
+ this.refreshNodeSize(t);
2469
+ }
2470
+ initNodesShapes(e) {
2471
+ const t = this.getStyleRule(
2472
+ e,
2473
+ D.SHAPE
2474
+ );
2475
+ this.refreshNodeShape(t);
2476
+ }
2477
+ initEdgesWidth(e) {
2478
+ const t = this.getStyleRule(
2479
+ e,
2480
+ D.WIDTH
2481
+ );
2482
+ this.refreshEdgeWidth(t);
2483
+ }
2484
+ initEdgesShape(e) {
2485
+ const t = this.getStyleRule(
2486
+ e,
2487
+ D.SHAPE
2488
+ );
2489
+ this.refreshEdgeShape(t);
2490
+ }
2491
+ initEdgesColor(e) {
2492
+ const t = this.getStyleRule(
2493
+ e,
2494
+ D.COLOR
2495
+ );
2496
+ this.refreshEdgeColors(t);
2497
+ }
2498
+ /**
2499
+ * Create / refresh an ogma rule for node icons
2500
+ *
2501
+ * @param {Array<any>} iconStyleRules
2502
+ */
2503
+ refreshNodeIcons(e) {
2504
+ u.isDefined(this._ogmaNodeIcon) ? (this._nodeAttributes.refresh({ icon: e }), this._ogmaNodeIcon.refresh()) : (this._nodeAttributes.refresh({ icon: e }), this._ogmaNodeIcon = this._ogma.styles.addRule({
2505
+ nodeAttributes: {
2506
+ icon: (t) => {
2507
+ if (t !== void 0)
2508
+ return this._nodeAttributes.icon(t.getData()).icon;
2509
+ },
2510
+ image: (t) => {
2511
+ if (t !== void 0 && !t.isVirtual())
2512
+ return this._nodeAttributes.icon(t.getData()).image;
2513
+ }
2514
+ },
2515
+ nodeDependencies: { self: { data: !0 } }
2516
+ }));
2517
+ }
2518
+ /**
2519
+ * Create / refresh an ogma rule for node sizes
2520
+ *
2521
+ * @param {Array<any>} sizeStyleRules
2522
+ */
2523
+ refreshNodeSize(e) {
2524
+ u.isDefined(this._ogmaNodeSize) ? (this._nodeAttributes.refresh({ size: e }), this._ogmaNodeSize.refresh()) : (this._nodeAttributes.refresh({ size: e }), this._ogmaNodeSize = this._ogma.styles.addRule({
2525
+ nodeAttributes: {
2526
+ radius: (t) => {
2527
+ if (t !== void 0)
2528
+ return this._nodeAttributes.size(t.getData());
2529
+ }
2530
+ },
2531
+ nodeDependencies: { self: { data: !0 } }
2532
+ }));
2533
+ }
2534
+ /**
2535
+ * Create / refresh an ogma rule for node images
2536
+ *
2537
+ * @param {Array<any>} shapeStyleRules
2538
+ */
2539
+ refreshNodeShape(e) {
2540
+ u.isDefined(this._ogmaNodeShape) ? (this._nodeAttributes.refresh({ shape: e }), this._ogmaNodeShape.refresh()) : (this._nodeAttributes.refresh({ shape: e }), this._ogmaNodeShape = this._ogma.styles.addRule({
2541
+ nodeAttributes: {
2542
+ shape: (t) => {
2543
+ if (t !== void 0)
2544
+ return this._nodeAttributes.shape(t.getData());
2545
+ }
2546
+ },
2547
+ nodeSelector: (t) => t !== void 0 && !t.isVirtual(),
2548
+ nodeDependencies: { self: { data: !0 } }
2549
+ }));
2550
+ }
2551
+ /**
2552
+ * Create / refresh an ogma rule for edge colors
2553
+ */
2554
+ refreshEdgeColors(e) {
2555
+ u.isDefined(this._ogmaEdgeColor) ? (this._edgeAttributes.refresh({ color: e }), this._ogmaEdgeColor.refresh()) : (this._edgeAttributes.refresh({ color: e }), this._ogmaEdgeColor = this._ogma.styles.addRule({
2556
+ edgeAttributes: {
2557
+ color: (t) => {
2558
+ if (t !== void 0)
2559
+ return this._edgeAttributes.color(t.getData());
2560
+ }
2561
+ },
2562
+ edgeDependencies: { self: { data: !0 } }
2563
+ }));
2564
+ }
2565
+ /**
2566
+ * Create / refresh an ogma rule for edge width
2567
+ *
2568
+ * @param {Array<LKStyleRule>} widthStyleRules
2569
+ */
2570
+ refreshEdgeWidth(e) {
2571
+ u.isDefined(this._ogmaEdgeWidth) ? (this._edgeAttributes.refresh({ width: e }), this._ogmaEdgeWidth.refresh()) : (this._edgeAttributes.refresh({ width: e }), this._ogmaEdgeWidth = this._ogma.styles.addRule({
2572
+ edgeAttributes: {
2573
+ width: (t) => {
2574
+ if (t !== void 0)
2575
+ return this._edgeAttributes.width(t.getData());
2576
+ }
2577
+ },
2578
+ edgeDependencies: {
2579
+ self: { data: !0 }
2580
+ }
2581
+ }));
2582
+ }
2583
+ /**
2584
+ * Create / refresh an ogma rule for edge width
2585
+ *
2586
+ * @param {Array<LKStyleRule>} shapeStyleRules
2587
+ */
2588
+ refreshEdgeShape(e) {
2589
+ u.isDefined(this._ogmaEdgeShape) ? (this._edgeAttributes.refresh({ shape: e }), this._ogmaEdgeShape.refresh()) : (this._edgeAttributes.refresh({ shape: e }), this._ogmaEdgeShape = this._ogma.styles.addRule({
2590
+ edgeAttributes: {
2591
+ shape: (t) => {
2592
+ if (t !== void 0)
2593
+ return this._edgeAttributes.shape(t.getData());
2594
+ }
2595
+ },
2596
+ edgeDependencies: { self: { data: !0 } }
2597
+ }));
2598
+ }
2599
+ /**
2600
+ * Get node radius
2601
+ * This is a workaround for an ogma issue where the radius of virtual nodes is always set to 5
2602
+ * TODO: check if this is still needed after ogma release the new improvement for transformation v5.X
2603
+ */
2604
+ _getNodeRadius(e) {
2605
+ var t;
2606
+ if (e.isVirtual()) {
2607
+ const { width: i, height: n } = (t = e.getSubNodes()) == null ? void 0 : t.getBoundingBox();
2608
+ return Math.max(i, n);
2609
+ } else
2610
+ return e.getAttribute("radius");
2611
+ }
2612
+ /**
2613
+ * Calculate the scale of the pin badge related to the node radius
2614
+ * This is useful when dealing wih huge nodes, and we don't want the badge to be big
2615
+ * If the node is small enough, the badge will be 0.46 of the node radius
2616
+ * Else it will be 5 / radius
2617
+ */
2618
+ _findPinBadgeScale(e) {
2619
+ return this._getNodeRadius(e) * 0.46 > 5 ? 0.17 : 0.46;
2620
+ }
2621
+ /**
2622
+ * Find the color of the pin badge text
2623
+ */
2624
+ _findPinBadgeTextColor(e) {
2625
+ if (e.isVirtual())
2626
+ return ve;
2627
+ const t = Array.isArray(e.getAttribute("color")) ? e.getAttribute("color")[0] : e.getAttribute("color");
2628
+ return ne.isBright(t) ? Lt : ve;
2629
+ }
2630
+ /**
2631
+ * Find the color of the pin badge background
2632
+ */
2633
+ _findPinBadgeBackgroundColor(e) {
2634
+ return e.isVirtual() ? F : "inherit";
2635
+ }
2636
+ }
2637
+ class Ag {
2638
+ constructor(e, t, i) {
2639
+ this._nodeMaxTextLength = t, this._edgeMaxTextLength = i, this._captionSchema = { node: {}, edge: {} }, this._graphSchema = { node: [], edge: [] }, this._ogma = e;
2640
+ }
2641
+ set graphSchema(e) {
2642
+ this._graphSchema = e;
2643
+ }
2644
+ /**
2645
+ * Refresh the schema
2646
+ */
2647
+ refreshSchema(e) {
2648
+ this._captionSchema = e;
2649
+ }
2650
+ /**
2651
+ * Refresh visualization captions rules
2652
+ */
2653
+ async initVizCaptions(e) {
2654
+ this._ogma.LKCaptions.nodesCaptionsRule ? (this._ogma.LKCaptions.refreshSchema(e), await this._ogma.LKCaptions.updateNodeCaptions()) : this._ogma.LKCaptions.updateNodeCaptions(e.node), this._ogma.LKCaptions.edgesCaptionsRule ? (this._ogma.LKCaptions.refreshSchema(e), await this._ogma.LKCaptions.updateEdgeCaptions()) : this._ogma.LKCaptions.updateEdgeCaptions(e.edge);
2655
+ }
2656
+ /**
2657
+ * Create or update nodeCaptionRule
2658
+ */
2659
+ updateNodeCaptions(e) {
2660
+ if (e && (this._captionSchema.node = e), !u.isDefined(this.nodesCaptionsRule))
2661
+ this.nodesCaptionsRule = this._ogma.styles.addRule({
2662
+ nodeAttributes: {
2663
+ text: {
2664
+ content: (t) => {
2665
+ if (t === void 0)
2666
+ return "";
2667
+ const i = w.getText(
2668
+ t.getData(),
2669
+ this._captionSchema.node,
2670
+ this._graphSchema.node
2671
+ );
2672
+ return u.isDefined(this._nodeMaxTextLength) ? u.truncate(i, "middle", this._nodeMaxTextLength) : i;
2673
+ }
2674
+ }
2675
+ },
2676
+ // We ignore virtual nodes as they have their proper caption
2677
+ nodeSelector: (t) => !t.isVirtual(),
2678
+ nodeDependencies: { self: { data: !0 } }
2679
+ });
2680
+ else
2681
+ return this.nodesCaptionsRule.refresh();
2682
+ }
2683
+ /**
2684
+ * Create or update edgeCaptionRule
2685
+ */
2686
+ updateEdgeCaptions(e) {
2687
+ if (e && (this._captionSchema.edge = e), !u.isDefined(this.edgesCaptionsRule))
2688
+ this.edgesCaptionsRule = this._ogma.styles.addRule({
2689
+ edgeAttributes: {
2690
+ text: {
2691
+ content: (t) => {
2692
+ if (t === void 0 || t.getData() === void 0)
2693
+ return "";
2694
+ const i = w.getText(
2695
+ t.getData(),
2696
+ this._captionSchema.edge,
2697
+ this._graphSchema.edge
2698
+ );
2699
+ return u.isDefined(this._edgeMaxTextLength) ? u.truncate(i, "middle", this._edgeMaxTextLength) : i;
2700
+ }
2701
+ }
2702
+ },
2703
+ edgeSelector: (t) => !t.isVirtual(),
2704
+ // ogma will trigger the rendering if data change or the shape change (to trigger the rendering when edges are grouped)
2705
+ edgeDependencies: { self: { data: !0, attributes: ["shape.style"] } }
2706
+ });
2707
+ else
2708
+ return this.edgesCaptionsRule.refresh();
2709
+ }
2710
+ }
2711
+ function I(r) {
2712
+ return typeof r == "function";
2713
+ }
2714
+ function xg(r) {
2715
+ return I(r == null ? void 0 : r.lift);
2716
+ }
2717
+ function cr(r) {
2718
+ return function(e) {
2719
+ if (xg(e))
2720
+ return e.lift(function(t) {
2721
+ try {
2722
+ return r(t, this);
2723
+ } catch (i) {
2724
+ this.error(i);
2725
+ }
2726
+ });
2727
+ throw new TypeError("Unable to lift unknown Observable type");
2728
+ };
2729
+ }
2730
+ var Te = function(r, e) {
2731
+ return Te = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
2732
+ t.__proto__ = i;
2733
+ } || function(t, i) {
2734
+ for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
2735
+ }, Te(r, e);
2736
+ };
2737
+ function Ve(r, e) {
2738
+ if (typeof e != "function" && e !== null)
2739
+ throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
2740
+ Te(r, e);
2741
+ function t() {
2742
+ this.constructor = r;
2743
+ }
2744
+ r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
2745
+ }
2746
+ function Mt(r) {
2747
+ var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], i = 0;
2748
+ if (t) return t.call(r);
2749
+ if (r && typeof r.length == "number") return {
2750
+ next: function() {
2751
+ return r && i >= r.length && (r = void 0), { value: r && r[i++], done: !r };
2752
+ }
2753
+ };
2754
+ throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
2755
+ }
2756
+ function we(r, e) {
2757
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
2758
+ if (!t) return r;
2759
+ var i = t.call(r), n, s = [], a;
2760
+ try {
2761
+ for (; (e === void 0 || e-- > 0) && !(n = i.next()).done; ) s.push(n.value);
2762
+ } catch (o) {
2763
+ a = { error: o };
2764
+ } finally {
2765
+ try {
2766
+ n && !n.done && (t = i.return) && t.call(i);
2767
+ } finally {
2768
+ if (a) throw a.error;
2769
+ }
2770
+ }
2771
+ return s;
2772
+ }
2773
+ function Ne(r, e, t) {
2774
+ if (t || arguments.length === 2) for (var i = 0, n = e.length, s; i < n; i++)
2775
+ (s || !(i in e)) && (s || (s = Array.prototype.slice.call(e, 0, i)), s[i] = e[i]);
2776
+ return r.concat(s || Array.prototype.slice.call(e));
2777
+ }
2778
+ function $g(r) {
2779
+ var e = function(i) {
2780
+ Error.call(i), i.stack = new Error().stack;
2781
+ }, t = r(e);
2782
+ return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
2783
+ }
2784
+ var me = $g(function(r) {
2785
+ return function(t) {
2786
+ r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
2787
+ ` + t.map(function(i, n) {
2788
+ return n + 1 + ") " + i.toString();
2789
+ }).join(`
2790
+ `) : "", this.name = "UnsubscriptionError", this.errors = t;
2791
+ };
2792
+ });
2793
+ function Rt(r, e) {
2794
+ if (r) {
2795
+ var t = r.indexOf(e);
2796
+ 0 <= t && r.splice(t, 1);
2797
+ }
2798
+ }
2799
+ var Ke = function() {
2800
+ function r(e) {
2801
+ this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
2802
+ }
2803
+ return r.prototype.unsubscribe = function() {
2804
+ var e, t, i, n, s;
2805
+ if (!this.closed) {
2806
+ this.closed = !0;
2807
+ var a = this._parentage;
2808
+ if (a)
2809
+ if (this._parentage = null, Array.isArray(a))
2810
+ try {
2811
+ for (var o = Mt(a), l = o.next(); !l.done; l = o.next()) {
2812
+ var c = l.value;
2813
+ c.remove(this);
2814
+ }
2815
+ } catch (f) {
2816
+ e = { error: f };
2817
+ } finally {
2818
+ try {
2819
+ l && !l.done && (t = o.return) && t.call(o);
2820
+ } finally {
2821
+ if (e) throw e.error;
2822
+ }
2823
+ }
2824
+ else
2825
+ a.remove(this);
2826
+ var d = this.initialTeardown;
2827
+ if (I(d))
2828
+ try {
2829
+ d();
2830
+ } catch (f) {
2831
+ s = f instanceof me ? f.errors : [f];
2832
+ }
2833
+ var g = this._finalizers;
2834
+ if (g) {
2835
+ this._finalizers = null;
2836
+ try {
2837
+ for (var h = Mt(g), y = h.next(); !y.done; y = h.next()) {
2838
+ var _ = y.value;
2839
+ try {
2840
+ Bt(_);
2841
+ } catch (f) {
2842
+ s = s ?? [], f instanceof me ? s = Ne(Ne([], we(s)), we(f.errors)) : s.push(f);
2843
+ }
2844
+ }
2845
+ } catch (f) {
2846
+ i = { error: f };
2847
+ } finally {
2848
+ try {
2849
+ y && !y.done && (n = h.return) && n.call(h);
2850
+ } finally {
2851
+ if (i) throw i.error;
2852
+ }
2853
+ }
2854
+ }
2855
+ if (s)
2856
+ throw new me(s);
2857
+ }
2858
+ }, r.prototype.add = function(e) {
2859
+ var t;
2860
+ if (e && e !== this)
2861
+ if (this.closed)
2862
+ Bt(e);
2863
+ else {
2864
+ if (e instanceof r) {
2865
+ if (e.closed || e._hasParent(this))
2866
+ return;
2867
+ e._addParent(this);
2868
+ }
2869
+ (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
2870
+ }
2871
+ }, r.prototype._hasParent = function(e) {
2872
+ var t = this._parentage;
2873
+ return t === e || Array.isArray(t) && t.includes(e);
2874
+ }, r.prototype._addParent = function(e) {
2875
+ var t = this._parentage;
2876
+ this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
2877
+ }, r.prototype._removeParent = function(e) {
2878
+ var t = this._parentage;
2879
+ t === e ? this._parentage = null : Array.isArray(t) && Rt(t, e);
2880
+ }, r.prototype.remove = function(e) {
2881
+ var t = this._finalizers;
2882
+ t && Rt(t, e), e instanceof r && e._removeParent(this);
2883
+ }, r.EMPTY = function() {
2884
+ var e = new r();
2885
+ return e.closed = !0, e;
2886
+ }(), r;
2887
+ }();
2888
+ Ke.EMPTY;
2889
+ function Eg(r) {
2890
+ return r instanceof Ke || r && "closed" in r && I(r.remove) && I(r.add) && I(r.unsubscribe);
2891
+ }
2892
+ function Bt(r) {
2893
+ I(r) ? r() : r.unsubscribe();
2894
+ }
2895
+ var Fg = {
2896
+ useDeprecatedNextContext: !1
2897
+ }, Tg = {
2898
+ setTimeout: function(r, e) {
2899
+ for (var t = [], i = 2; i < arguments.length; i++)
2900
+ t[i - 2] = arguments[i];
2901
+ return setTimeout.apply(void 0, Ne([r, e], we(t)));
2902
+ },
2903
+ clearTimeout: function(r) {
2904
+ return clearTimeout(r);
2905
+ },
2906
+ delegate: void 0
2907
+ };
2908
+ function wg(r) {
2909
+ Tg.setTimeout(function() {
2910
+ throw r;
2911
+ });
2912
+ }
2913
+ function zt() {
2914
+ }
2915
+ var dr = function(r) {
2916
+ Ve(e, r);
2917
+ function e(t) {
2918
+ var i = r.call(this) || this;
2919
+ return i.isStopped = !1, t ? (i.destination = t, Eg(t) && t.add(i)) : i.destination = Pg, i;
2920
+ }
2921
+ return e.create = function(t, i, n) {
2922
+ return new Og(t, i, n);
2923
+ }, e.prototype.next = function(t) {
2924
+ this.isStopped || this._next(t);
2925
+ }, e.prototype.error = function(t) {
2926
+ this.isStopped || (this.isStopped = !0, this._error(t));
2927
+ }, e.prototype.complete = function() {
2928
+ this.isStopped || (this.isStopped = !0, this._complete());
2929
+ }, e.prototype.unsubscribe = function() {
2930
+ this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
2931
+ }, e.prototype._next = function(t) {
2932
+ this.destination.next(t);
2933
+ }, e.prototype._error = function(t) {
2934
+ try {
2935
+ this.destination.error(t);
2936
+ } finally {
2937
+ this.unsubscribe();
2938
+ }
2939
+ }, e.prototype._complete = function() {
2940
+ try {
2941
+ this.destination.complete();
2942
+ } finally {
2943
+ this.unsubscribe();
2944
+ }
2945
+ }, e;
2946
+ }(Ke), Ng = Function.prototype.bind;
2947
+ function _e(r, e) {
2948
+ return Ng.call(r, e);
2949
+ }
2950
+ var Dg = function() {
2951
+ function r(e) {
2952
+ this.partialObserver = e;
2953
+ }
2954
+ return r.prototype.next = function(e) {
2955
+ var t = this.partialObserver;
2956
+ if (t.next)
2957
+ try {
2958
+ t.next(e);
2959
+ } catch (i) {
2960
+ ee(i);
2961
+ }
2962
+ }, r.prototype.error = function(e) {
2963
+ var t = this.partialObserver;
2964
+ if (t.error)
2965
+ try {
2966
+ t.error(e);
2967
+ } catch (i) {
2968
+ ee(i);
2969
+ }
2970
+ else
2971
+ ee(e);
2972
+ }, r.prototype.complete = function() {
2973
+ var e = this.partialObserver;
2974
+ if (e.complete)
2975
+ try {
2976
+ e.complete();
2977
+ } catch (t) {
2978
+ ee(t);
2979
+ }
2980
+ }, r;
2981
+ }(), Og = function(r) {
2982
+ Ve(e, r);
2983
+ function e(t, i, n) {
2984
+ var s = r.call(this) || this, a;
2985
+ if (I(t) || !t)
2986
+ a = {
2987
+ next: t ?? void 0,
2988
+ error: i ?? void 0,
2989
+ complete: n ?? void 0
2990
+ };
2991
+ else {
2992
+ var o;
2993
+ s && Fg.useDeprecatedNextContext ? (o = Object.create(t), o.unsubscribe = function() {
2994
+ return s.unsubscribe();
2995
+ }, a = {
2996
+ next: t.next && _e(t.next, o),
2997
+ error: t.error && _e(t.error, o),
2998
+ complete: t.complete && _e(t.complete, o)
2999
+ }) : a = t;
3000
+ }
3001
+ return s.destination = new Dg(a), s;
3002
+ }
3003
+ return e;
3004
+ }(dr);
3005
+ function ee(r) {
3006
+ wg(r);
3007
+ }
3008
+ function Lg(r) {
3009
+ throw r;
3010
+ }
3011
+ var Pg = {
3012
+ closed: !0,
3013
+ next: zt,
3014
+ error: Lg,
3015
+ complete: zt
3016
+ };
3017
+ function Ig(r) {
3018
+ return r;
3019
+ }
3020
+ function gr(r, e, t, i, n) {
3021
+ return new Mg(r, e, t, i, n);
3022
+ }
3023
+ var Mg = function(r) {
3024
+ Ve(e, r);
3025
+ function e(t, i, n, s, a, o) {
3026
+ var l = r.call(this, t) || this;
3027
+ return l.onFinalize = a, l.shouldUnsubscribe = o, l._next = i ? function(c) {
3028
+ try {
3029
+ i(c);
3030
+ } catch (d) {
3031
+ t.error(d);
3032
+ }
3033
+ } : r.prototype._next, l._error = s ? function(c) {
3034
+ try {
3035
+ s(c);
3036
+ } catch (d) {
3037
+ t.error(d);
3038
+ } finally {
3039
+ this.unsubscribe();
3040
+ }
3041
+ } : r.prototype._error, l._complete = n ? function() {
3042
+ try {
3043
+ n();
3044
+ } catch (c) {
3045
+ t.error(c);
3046
+ } finally {
3047
+ this.unsubscribe();
3048
+ }
3049
+ } : r.prototype._complete, l;
3050
+ }
3051
+ return e.prototype.unsubscribe = function() {
3052
+ var t;
3053
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
3054
+ var i = this.closed;
3055
+ r.prototype.unsubscribe.call(this), !i && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
3056
+ }
3057
+ }, e;
3058
+ }(dr);
3059
+ function Rg(r, e) {
3060
+ return cr(function(t, i) {
3061
+ var n = 0;
3062
+ t.subscribe(gr(i, function(s) {
3063
+ i.next(r.call(e, s, n++));
3064
+ }));
3065
+ });
3066
+ }
3067
+ function Bg(r, e) {
3068
+ return e === void 0 && (e = Ig), r = r ?? zg, cr(function(t, i) {
3069
+ var n, s = !0;
3070
+ t.subscribe(gr(i, function(a) {
3071
+ var o = e(a);
3072
+ (s || !r(n, o)) && (s = !1, n = o, i.next(a));
3073
+ }));
3074
+ });
3075
+ }
3076
+ function zg(r, e) {
3077
+ return r === e;
3078
+ }
3079
+ class Gg extends mr {
3080
+ constructor(e) {
3081
+ super(e);
3082
+ }
3083
+ /**
3084
+ * Modify Ogma state based on a method
3085
+ */
3086
+ dispatch(e) {
3087
+ this.next(e(this.value));
3088
+ }
3089
+ /**
3090
+ * Return a piece of state
3091
+ */
3092
+ selectStore(e) {
3093
+ return this.pipe(
3094
+ Rg(e),
3095
+ Bg((t, i) => u.isEqual(t, i))
3096
+ );
3097
+ }
3098
+ /**
3099
+ * Clear the state of Ogma
3100
+ */
3101
+ clear() {
3102
+ this.next({
3103
+ selection: new hr(),
3104
+ items: { node: [], edge: [] },
3105
+ changes: void 0,
3106
+ animation: !1
3107
+ });
3108
+ }
3109
+ }
3110
+ class Ug {
3111
+ constructor(e) {
3112
+ this._store = new Gg({
3113
+ selection: new hr(),
3114
+ items: { node: [], edge: [] },
3115
+ changes: void 0,
3116
+ animation: !1
3117
+ }), this._ogma = e, this.listenToSelectionEvents();
3118
+ }
3119
+ get store() {
3120
+ return this._store;
3121
+ }
3122
+ /**
3123
+ * Listen to ogma events and update the state
3124
+ */
3125
+ listenToSelectionEvents() {
3126
+ let e = Date.now(), t = !1;
3127
+ this._ogma.events.on("animate", (i) => {
3128
+ if (i.updatesPositions === !1)
3129
+ return;
3130
+ t || (t = !0, this._store.dispatch((a) => ({ ...a, animation: !0 })));
3131
+ const n = Math.max(e, Date.now() + i.duration);
3132
+ if (n === e)
3133
+ return;
3134
+ e = n;
3135
+ const s = e - Date.now() + 16;
3136
+ clearTimeout(this._animationThrottle), this._animationThrottle = setTimeout(() => {
3137
+ t = !1, this._store.dispatch((a) => ({ ...a, animation: !1 }));
3138
+ }, s);
3139
+ }), this._ogma.events.on("dragStart", () => {
3140
+ this._store.dispatch((i) => ({ ...i, animation: !0 }));
3141
+ }), this._ogma.events.on("dragEnd", () => {
3142
+ this._store.dispatch((i) => ({ ...i, animation: !1 }));
3143
+ }), this._ogma.events.on("addNodes", () => {
3144
+ this._store.dispatch(this.storeItems.bind(this));
3145
+ }), this._ogma.events.on("removeNodes", () => {
3146
+ this._store.dispatch(this.storeItems.bind(this));
3147
+ }), this._ogma.events.on("addEdges", () => {
3148
+ this._store.dispatch(this.storeItems.bind(this));
3149
+ }), this._ogma.events.on("removeEdges", () => {
3150
+ this._store.dispatch(this.storeItems.bind(this));
3151
+ }), this._ogma.events.on("nodesSelected", () => {
3152
+ this._store.dispatch(this.storeNodeSelection.bind(this));
3153
+ }), this._ogma.events.on("edgesSelected", () => {
3154
+ this._store.dispatch(this.storeEdgeSelection.bind(this));
3155
+ }), this._ogma.events.on("nodesUnselected", () => {
3156
+ this._store.dispatch(this.storeNodeSelection.bind(this));
3157
+ }), this._ogma.events.on("edgesUnselected", () => {
3158
+ this._store.dispatch(this.storeEdgeSelection.bind(this));
3159
+ }), this._ogma.events.on("updateNodeData", (i) => {
3160
+ i !== void 0 && i.changes.forEach((n) => {
3161
+ this._store.dispatch((s) => ({
3162
+ ...s,
3163
+ changes: {
3164
+ entityType: "node",
3165
+ input: n.property,
3166
+ value: n.newValues[0]
3167
+ }
3168
+ }));
3169
+ });
3170
+ }), this._ogma.events.on("updateEdgeData", (i) => {
3171
+ i !== void 0 && i.changes.forEach((n) => {
3172
+ this._store.dispatch((s) => ({
3173
+ ...s,
3174
+ changes: {
3175
+ entityType: "edge",
3176
+ input: n.property,
3177
+ value: n.newValues[0]
3178
+ }
3179
+ }));
3180
+ });
3181
+ });
3182
+ }
3183
+ /**
3184
+ * Store new items in state
3185
+ */
3186
+ storeItems(e) {
3187
+ return {
3188
+ ...e,
3189
+ items: {
3190
+ node: this._ogma.getNodes().getId(),
3191
+ edge: this._ogma.getEdges().getId()
3192
+ }
3193
+ };
3194
+ }
3195
+ /**
3196
+ * Store new node selection in state
3197
+ */
3198
+ storeNodeSelection(e) {
3199
+ return {
3200
+ ...e,
3201
+ selection: this._ogma.getSelectedNodes()
3202
+ };
3203
+ }
3204
+ /**
3205
+ * store new edge selection in state
3206
+ */
3207
+ storeEdgeSelection(e) {
3208
+ return {
3209
+ ...e,
3210
+ selection: this._ogma.getSelectedEdges()
3211
+ };
3212
+ }
3213
+ }
3214
+ class hr {
3215
+ constructor() {
3216
+ this.size = 0, this.isNode = !0;
3217
+ }
3218
+ }
3219
+ const jg = 750, kg = {
3220
+ steps: 40,
3221
+ alignSiblings: !0,
3222
+ charge: 5,
3223
+ theta: 0.34,
3224
+ duration: jg
3225
+ };
3226
+ class Xg extends vr {
3227
+ constructor(e, t) {
3228
+ super(e), this._configuration = e, Object.setPrototypeOf(this, new.target.prototype), this.initOgmaLinkuriousParser(!0, t);
3229
+ }
3230
+ /**
3231
+ * Initialize the Ogma instance with the configuration and the base url
3232
+ * @param init used to know if the instance is initialized for the first time (used in setConfigOgma)
3233
+ * @param baseUrl base url used for relative image urls
3234
+ * @private
3235
+ */
3236
+ initOgmaLinkuriousParser(e, t) {
3237
+ this.nodeCategoriesWatcher = this.schema.watchNodeNonObjectProperty({
3238
+ path: "categories",
3239
+ unwindArrays: !0,
3240
+ filter: "all"
3241
+ }), this.edgeTypeWatcher = this.schema.watchEdgeNonObjectProperty({
3242
+ path: "type",
3243
+ filter: "all"
3244
+ }), this.setOptions({
3245
+ interactions: {
3246
+ zoom: {
3247
+ maxValue: (i) => 128 / i.smallestNodeSize
3248
+ },
3249
+ selection: {
3250
+ enabled: !1
3251
+ }
3252
+ }
3253
+ }), this._reactive === void 0 ? (this._reactive = new Ug(this), this.store = this._reactive.store) : this._reactive.listenToSelectionEvents(), this.initSelection(), this.setConfigOgma(this._configuration, e, t), this.LKTransformation = new qg(this), this.LkNodeGroupingTransformation = new Vg(this), this.LKStyles.setNodesDefaultHalo(), this.LKStyles.setEdgesDefaultHalo(), this.LKStyles.setBadgeRule(), this.LKStyles.setFilterClass();
3254
+ }
3255
+ /**
3256
+ * Initialize selection behavior
3257
+ */
3258
+ initSelection() {
3259
+ this.events.onClick((e) => {
3260
+ if (e !== void 0 && e.button === "left")
3261
+ if (e.target !== null) {
3262
+ const t = navigator.platform === "MacIntel" ? "cmd" : "ctrl";
3263
+ this.keyboard.isKeyPressed(t) ? (e.target.isNode && this.getSelectedEdges().size > 0 && this.getSelectedEdges().setSelected(!1), !e.target.isNode && this.getSelectedNodes().size > 0 && this.getSelectedNodes().setSelected(!1), e.target.isSelected() ? e.target.setSelected(!1) : e.target.setSelected(!0)) : (this.getSelectedNodes().setSelected(!1), this.getSelectedEdges().setSelected(!1), e.target.setSelected(!0));
3264
+ } else
3265
+ this.getSelectedNodes().setSelected(!1), this.getSelectedEdges().setSelected(!1);
3266
+ });
3267
+ }
3268
+ setStyles(e, t) {
3269
+ var i, n, s, a;
3270
+ this.LKStyles = new Sg(this, {
3271
+ node: ((n = (i = e == null ? void 0 : e.options) == null ? void 0 : i.styles) == null ? void 0 : n.node) || {},
3272
+ edge: ((a = (s = e == null ? void 0 : e.options) == null ? void 0 : s.styles) == null ? void 0 : a.edge) || {},
3273
+ baseUrl: t
3274
+ }), this.LKStyles.setNodesDefaultStyles(), this.LKStyles.setEdgesDefaultStyles();
3275
+ }
3276
+ setCaptions(e) {
3277
+ var n, s, a, o, l, c, d, g;
3278
+ const t = (o = (a = (s = (n = e == null ? void 0 : e.options) == null ? void 0 : n.styles) == null ? void 0 : s.node) == null ? void 0 : a.text) == null ? void 0 : o.maxTextLength, i = (g = (d = (c = (l = e == null ? void 0 : e.options) == null ? void 0 : l.styles) == null ? void 0 : c.edge) == null ? void 0 : d.text) == null ? void 0 : g.maxTextLength;
3279
+ this.LKCaptions = new Ag(this, t, i);
3280
+ }
3281
+ /**
3282
+ * Returns Ogma Layout parameters according to visualization layout settings
3283
+ * */
3284
+ getForceLayoutParams(e, t = 0) {
3285
+ let i = 300 - 0.052 * this.getNodes().size;
3286
+ return i < 40 && (i = 40), {
3287
+ steps: e === yr.FAST ? i : 300,
3288
+ alignSiblings: this.getNodes().size > 3,
3289
+ duration: t,
3290
+ charge: 20,
3291
+ gravity: 0.08,
3292
+ theta: this.getNodes().size > 100 ? 0.8 : 0.34
3293
+ };
3294
+ }
3295
+ getRadialLayoutParams(e, t = 0) {
3296
+ return {
3297
+ centralNode: e,
3298
+ radiusDelta: 1,
3299
+ nodeGap: 10,
3300
+ repulsion: this.getNodes().size > 80 ? 1 : 6,
3301
+ duration: t
3302
+ };
3303
+ }
3304
+ getHierarchicalLayoutParams(e, t, i = 0) {
3305
+ return {
3306
+ direction: e,
3307
+ roots: [t],
3308
+ duration: i
3309
+ };
3310
+ }
3311
+ /**
3312
+ * Initialize graph.
3313
+ * add nodes and edges to the viz and init the selection.
3314
+ */
3315
+ async init(e) {
3316
+ this.clearGraph();
3317
+ let t, i = [];
3318
+ const n = e.nodes.map((a) => (a.attributes.selected && (t = P.NODE, i.push(a.id)), delete a.attributes.selected, a)), s = e.edges.map((a) => (a.attributes !== void 0 && (a.attributes.selected && ((t === void 0 || t === P.NODE) && (t = P.EDGE, i = []), i.push(a.id)), delete a.attributes.selected), a));
3319
+ await this.addGraphAfterValidation({
3320
+ nodes: n,
3321
+ edges: s
3322
+ }), t === P.NODE ? this.getNodes(i).setSelected(!0) : t === P.EDGE && this.getEdges(i).setSelected(!0);
3323
+ }
3324
+ async initVisualization(e) {
3325
+ await this.init(e);
3326
+ const t = p.sanitizeStylesIndex(e.design.styles);
3327
+ this.LKStyles.initNodeColors(t.node), this.LKStyles.initNodesIcons(t.node), this.LKStyles.initNodesSizes(t.node), this.LKStyles.initNodesShapes(t.node), this.LKStyles.initEdgesWidth(t.edge), this.LKStyles.initEdgesShape(t.edge), this.LKStyles.initEdgesColor(t.edge), await this.LKCaptions.initVizCaptions({
3328
+ node: e.nodeFields.captions || {},
3329
+ edge: e.edgeFields.captions || {}
3330
+ }), this.LKTransformation.groupedEdges = e.edgeGrouping, await this.LKTransformation.initTransformation(), this.LKTransformation.initEdgeGroupingStyle();
3331
+ }
3332
+ /**
3333
+ * Adding nodes then adding edges to the graph
3334
+ */
3335
+ async addGraphAfterValidation(e) {
3336
+ const t = await this.addNodes(e.nodes), i = await this.addEdges(e.edges);
3337
+ return {
3338
+ nodes: t,
3339
+ edges: i
3340
+ };
3341
+ }
3342
+ /**
3343
+ * Adding edges to the graph after filtering disconnected ones
3344
+ */
3345
+ addEdges(e, t) {
3346
+ return super.addEdges(e, { ...t, ignoreInvalid: !0 });
3347
+ }
3348
+ /**
3349
+ * Return the list of non filtered nodes
3350
+ */
3351
+ getNonFilteredNodes(e) {
3352
+ return u.isDefined(e) ? this.getNodes(e).filter((t) => !t.hasClass("filtered")) : (
3353
+ // take only none virtual nodes
3354
+ this.getNodes("raw").filter((t) => !t.hasClass("filtered"))
3355
+ );
3356
+ }
3357
+ /**
3358
+ * Return the list of filtered nodes
3359
+ * @param items items to check if they are filtered
3360
+ * @param filter type of nodes to check if they are filtered ( nodes that are visible, raw nodes (none virtual) or all nodes)
3361
+ */
3362
+ getFilteredNodes(e, t = "raw") {
3363
+ return u.isDefined(e) ? this.getNodes(e).filter((i) => i.hasClass("filtered")) : this.getNodes(t).filter((i) => i.hasClass("filtered"));
3364
+ }
3365
+ /**
3366
+ * Return the list of non filtered edges
3367
+ */
3368
+ getNonFilteredEdges(e) {
3369
+ return u.isDefined(e) ? this.getEdges(e).filter((t) => !t.hasClass("filtered")) : this.getEdges("raw").filter((t) => !t.hasClass("filtered"));
3370
+ }
3371
+ /**
3372
+ * Return the list of filtered edges
3373
+ */
3374
+ getFilteredEdges(e, t = "raw") {
3375
+ return u.isDefined(e) ? this.getEdges(e).filter((i) => i.hasClass("filtered")) : this.getEdges(t).filter((i) => i.hasClass("filtered"));
3376
+ }
3377
+ /**
3378
+ * Do a full reset on ogma and streams of ogma
3379
+ */
3380
+ shutDown() {
3381
+ this.destroy(), this.store && this.store.clear();
3382
+ }
3383
+ /**
3384
+ * Reset the Ogma instance so that it can be used fresh in the next visulization
3385
+ */
3386
+ clearOgmaState() {
3387
+ this.reset(), this.store && this.store.clear(), this.initOgmaLinkuriousParser();
3388
+ }
3389
+ /**
3390
+ * Updates the Ogma config when config changes in LKE. If init, options were already set by the Ogma.reset()
3391
+ */
3392
+ setConfigOgma(e, t, i) {
3393
+ e && (this._configuration = e), t || this.setOptions({
3394
+ ...this._configuration.options,
3395
+ renderer: this._configuration.renderer
3396
+ }), this.setStyles(this._configuration, i), this.setCaptions(this._configuration);
3397
+ }
3398
+ }
3399
+ const Ce = {
3400
+ lightsalmon: { hex: "#FFA07A", rgb: "rbg(255,160,122)" },
3401
+ salmon: { hex: "#FA8072", rgb: "rgb(250,128,114)" },
3402
+ darksalmon: { hex: "#E9967A", rgb: "rgb(233,150,122)" },
3403
+ lightcoral: { hex: "#F08080", rgb: "rgb(240,128,128)" },
3404
+ indianred: { hex: "#CD5C5C", rgb: "rgb(205,92,92)" },
3405
+ crimson: { hex: "#DC143C", rgb: "rgb(220,20,60)" },
3406
+ firebrick: { hex: "#B22222", rgb: "rgb(178,34,34)" },
3407
+ red: { hex: "#FF0000", rgb: "rgb(255,0,0)" },
3408
+ darkred: { hex: "#8B0000", rgb: "rgb(139,0,0)" },
3409
+ coral: { hex: "#FF7F50", rgb: "rgb(255,127,80)" },
3410
+ tomato: { hex: "#FF6347", rgb: "rgb(255,99,71)" },
3411
+ orangered: { hex: "#FF4500", rgb: "rgb(255,69,0)" },
3412
+ gold: { hex: "#FFD700", rgb: "rgb(255,215,0)" },
3413
+ orange: { hex: "#FFA500", rgb: "rgb(255,165,0)" },
3414
+ darkorange: { hex: "#FF8C00", rgb: "rgb(255,140,0)" },
3415
+ lightyellow: { hex: "#FFFFE0", rgb: "rgb(255,255,224)" },
3416
+ lemonchiffon: { hex: "#FFFACD", rgb: "rgb(255,250,205)" },
3417
+ lightgoldenrodyellow: { hex: "#FAFAD2", rgb: "rgb(250,250,210)" },
3418
+ papayawhip: { hex: "#FFEFD5", rgb: "rgb(255,239,213)" },
3419
+ moccasin: { hex: "#FFE4B5", rgb: "rgb(255,228,181)" },
3420
+ peachpuff: { hex: "#FFDAB9", rgb: "rgb(255,218,185)" },
3421
+ palegoldenrod: { hex: "#EEE8AA", rgb: "rgb(238,232,170)" },
3422
+ khaki: { hex: "#F0E68C", rgb: "rgb(240,230,140)" },
3423
+ darkkhaki: { hex: "#BDB76B", rgb: "rgb(189,183,107)" },
3424
+ yellow: { hex: "#FFFF00", rgb: "rgb(255,255,0)" },
3425
+ lawngreen: { hex: "#7CFC00", rgb: "rgb(124,252,0)" },
3426
+ chartreuse: { hex: "#7FFF00", rgb: "rgb(127,255,0)" },
3427
+ limegreen: { hex: "#32CD32", rgb: "rgb(50,205,50)" },
3428
+ lime: { hex: "#00FF00", rgb: "rgb(0.255.0)" },
3429
+ forestgreen: { hex: "#228B22", rgb: "rgb(34,139,34)" },
3430
+ green: { hex: "#008000", rgb: "rgb(0,128,0)" },
3431
+ darkgreen: { hex: "#006400", rgb: "rgb(0,100,0)" },
3432
+ greenyellow: { hex: "#ADFF2F", rgb: "rgb(173,255,47)" },
3433
+ yellowgreen: { hex: "#9ACD32", rgb: "rgb(154,205,50)" },
3434
+ springgreen: { hex: "#00FF7F", rgb: "rgb(0,255,127)" },
3435
+ mediumspringgreen: { hex: "#00FA9A", rgb: "rgb(0,250,154)" },
3436
+ lightgreen: { hex: "#90EE90", rgb: "rgb(144,238,144)" },
3437
+ palegreen: { hex: "#98FB98", rgb: "rgb(152,251,152)" },
3438
+ darkseagreen: { hex: "#8FBC8F", rgb: "rgb(143,188,143)" },
3439
+ mediumseagreen: { hex: "#3CB371", rgb: "rgb(60,179,113)" },
3440
+ seagreen: { hex: "#2E8B57", rgb: "rgb(46,139,87)" },
3441
+ olive: { hex: "#808000", rgb: "rgb(128,128,0)" },
3442
+ darkolivegreen: { hex: "#556B2F", rgb: "rgb(85,107,47)" },
3443
+ olivedrab: { hex: "#6B8E23", rgb: "rgb(107,142,35)" },
3444
+ lightcyan: { hex: "#E0FFFF", rgb: "rgb(224,255,255)" },
3445
+ cyan: { hex: "#00FFFF", rgb: "rgb(0,255,255)" },
3446
+ aqua: { hex: "#00FFFF", rgb: "rgb(0,255,255)" },
3447
+ aquamarine: { hex: "#7FFFD4", rgb: "rgb(127,255,212)" },
3448
+ mediumaquamarine: { hex: "#66CDAA", rgb: "rgb(102,205,170)" },
3449
+ paleturquoise: { hex: "#AFEEEE", rgb: "rgb(175,238,238)" },
3450
+ turquoise: { hex: "#40E0D0", rgb: "rgb(64,224,208)" },
3451
+ mediumturquoise: { hex: "#48D1CC", rgb: "rgb(72,209,204)" },
3452
+ darkturquoise: { hex: "#00CED1", rgb: "rgb(0,206,209)" },
3453
+ lightseagreen: { hex: "#20B2AA", rgb: "rgb(32,178,170)" },
3454
+ cadetblue: { hex: "#5F9EA0", rgb: "rgb(95,158,160)" },
3455
+ darkcyan: { hex: "#008B8B", rgb: "rgb(0,139,139)" },
3456
+ teal: { hex: "#008080", rgb: "rgb(0,128,128)" },
3457
+ powderblue: { hex: "#B0E0E6", rgb: "rgb(176,224,230)" },
3458
+ lightblue: { hex: "#ADD8E6", rgb: "rgb(173,216,230)" },
3459
+ lightskyblue: { hex: "#87CEFA", rgb: "rgb(135,206,250)" },
3460
+ skyblue: { hex: "#87CEEB", rgb: "rgb(135,206,235)" },
3461
+ deepskyblue: { hex: "#00BFFF", rgb: "rgb(0,191,255)" },
3462
+ lightsteelblue: { hex: "#B0C4DE", rgb: "rgb(176,196,222)" },
3463
+ dodgerblue: { hex: "#1E90FF", rgb: "rgb(30,144,255)" },
3464
+ cornflowerblue: { hex: "#6495ED", rgb: "rgb(100,149,237)" },
3465
+ steelblue: { hex: "#4682B4", rgb: "rgb(70,130,180)" },
3466
+ royalblue: { hex: "#4169E1", rgb: "rgb(65,105,225)" },
3467
+ blue: { hex: "#0000FF", rgb: "rgb(0,0,255)" },
3468
+ mediumblue: { hex: "#0000CD", rgb: "rgb(0,0,205)" },
3469
+ darkblue: { hex: "#00008B", rgb: "rgb(0,0,139)" },
3470
+ navy: { hex: "#000080", rgb: "rgb(0,0,128)" },
3471
+ midnightblue: { hex: "#191970", rgb: "rgb(25,25,112)" },
3472
+ mediumslateblue: { hex: "#7B68EE", rgb: "rgb(123,104,238)" },
3473
+ slateblue: { hex: "#6A5ACD", rgb: "rgb(106,90,205)" },
3474
+ darkslateblue: { hex: "#483D8B", rgb: "rgb(72,61,139)" },
3475
+ lavender: { hex: "#E6E6FA", rgb: "rgb(230,230,250)" },
3476
+ thistle: { hex: "#D8BFD8", rgb: "rgb(216,191,216)" },
3477
+ plum: { hex: "#DDA0DD", rgb: "rgb(221,160,221)" },
3478
+ violet: { hex: "#EE82EE", rgb: "rgb(238,130,238)" },
3479
+ orchid: { hex: "#DA70D6", rgb: "rgb(218,112,214)" },
3480
+ fuchsia: { hex: "#FF00FF", rgb: "rgb(255,0,255)" },
3481
+ magenta: { hex: "#FF00FF", rgb: "rgb(255,0,255)" },
3482
+ mediumorchid: { hex: "#BA55D3", rgb: "rgb(186,85,211)" },
3483
+ mediumpurple: { hex: "#9370DB", rgb: "rgb(147,112,219)" },
3484
+ blueviolet: { hex: "#8A2BE2", rgb: "rgb(138,43,226)" },
3485
+ darkviolet: { hex: "#9400D3", rgb: "rgb(148,0,211)" },
3486
+ darkorchid: { hex: "#9932CC", rgb: "rgb(153,50,204)" },
3487
+ darkmagenta: { hex: "#8B008B", rgb: "rgb(139,0,139)" },
3488
+ purple: { hex: "#800080", rgb: "rgb(128,0,128)" },
3489
+ indigo: { hex: "#4B0082", rgb: "rgb(75,0,130)" },
3490
+ pink: { hex: "#FFC0CB", rgb: "rgb(255,192,203)" },
3491
+ lightpink: { hex: "#FFB6C1", rgb: "rgb(255,182,193)" },
3492
+ hotpink: { hex: "#FF69B4", rgb: "rgb(255,105,180)" },
3493
+ deeppink: { hex: "#FF1493", rgb: "rgb(255,20,147)" },
3494
+ palevioletred: { hex: "#DB7093", rgb: "rgb(219,112,147)" },
3495
+ mediumvioletred: { hex: "#C71585", rgb: "rgb(199,21,133)" },
3496
+ white: { hex: "#FFFFFF", rgb: "rgb(255,255,255)" },
3497
+ snow: { hex: "#FFFAFA", rgb: "rgb(255,250,250)" },
3498
+ honeydew: { hex: "#F0FFF0", rgb: "rgb(240,255,240)" },
3499
+ mintcream: { hex: "#F5FFFA", rgb: "rgb(245,255,250)" },
3500
+ azure: { hex: "#F0FFFF", rgb: "rgb(240,255,255)" },
3501
+ aliceblue: { hex: "#F0F8FF", rgb: "rgb(240,248,255)" },
3502
+ ghostwhite: { hex: "#F8F8FF", rgb: "rgb(248,248,255)" },
3503
+ whitesmoke: { hex: "#F5F5F5", rgb: "rgb(245,245,245)" },
3504
+ seashell: { hex: "#FFF5EE", rgb: "rgb(255,245,238)" },
3505
+ beige: { hex: "#F5F5DC", rgb: "rgb(245,245,220)" },
3506
+ oldlace: { hex: "#FDF5E6", rgb: "rgb(253,245,230)" },
3507
+ floralwhite: { hex: "#FFFAF0", rgb: "rgb(255,250,240)" },
3508
+ ivory: { hex: "#FFFFF0", rgb: "rgb(255,255,240)" },
3509
+ antiquewhite: { hex: "#FAEBD7", rgb: "rgb(250,235,215)" },
3510
+ linen: { hex: "#FAF0E6", rgb: "rgb(250,240,230)" },
3511
+ lavenderblush: { hex: "#FFF0F5", rgb: "rgb(255,240,245)" },
3512
+ mistyrose: { hex: "#FFE4E1", rgb: "rgb(255,228,225)" },
3513
+ gainsboro: { hex: "#DCDCDC", rgb: "rgb(220,220,220)" },
3514
+ lightgray: { hex: "#D3D3D3", rgb: "rgb(211,211,211)" },
3515
+ silver: { hex: "#C0C0C0", rgb: "rgb(192,192,192)" },
3516
+ darkgray: { hex: "#A9A9A9", rgb: "rgb(169,169,169)" },
3517
+ gray: { hex: "#808080", rgb: "rgb(128,128,128)" },
3518
+ dimgray: { hex: "#696969", rgb: "rgb(105,105,105)" },
3519
+ lightslategray: { hex: "#778899", rgb: "rgb(119,136,153)" },
3520
+ slategray: { hex: "#708090", rgb: "rgb(112,128,144)" },
3521
+ darkslategray: { hex: "#2F4F4F", rgb: "rgb(47,79,79)" },
3522
+ black: { hex: "#000000", rgb: "rgb(0,0,0)" },
3523
+ cornsilk: { hex: "#FFF8DC", rgb: "rgb(255,248,220)" },
3524
+ blanchedalmond: { hex: "#FFEBCD", rgb: "rgb(255,235,205)" },
3525
+ bisque: { hex: "#FFE4C4", rgb: "rgb(255,228,196)" },
3526
+ navajowhite: { hex: "#FFDEAD", rgb: "rgb(255,222,173)" },
3527
+ wheat: { hex: "#F5DEB3", rgb: "rgb(245,222,179)" },
3528
+ burlywood: { hex: "#DEB887", rgb: "rgb(222,184,135)" },
3529
+ tan: { hex: "#D2B48C", rgb: "rgb(210,180,140)" },
3530
+ rosybrown: { hex: "#BC8F8F", rgb: "rgb(188,143,143)" },
3531
+ sandybrown: { hex: "#F4A460", rgb: "rgb(244,164,96)" },
3532
+ goldenrod: { hex: "#DAA520", rgb: "rgb(218,165,32)" },
3533
+ peru: { hex: "#CD853F", rgb: "rgb(205,133,63)" },
3534
+ chocolate: { hex: "#D2691E", rgb: "rgb(210,105,30)" },
3535
+ saddlebrown: { hex: "#8B4513", rgb: "rgb(139,69,19)" },
3536
+ sienna: { hex: "#A0522D", rgb: "rgb(160,82,45)" },
3537
+ brown: { hex: "#A52A2A", rgb: "rgb(165,42,42)" },
3538
+ maroon: { hex: "#800000", rgb: "rgb(128,0,0)" }
3539
+ };
3540
+ class ne {
3541
+ /**
3542
+ * Get the amount of hidden neighbors from a list of nodes
3543
+ *
3544
+ * @param nodes
3545
+ */
3546
+ static getHiddenNeighbors(e) {
3547
+ return e.reduce((t, i) => {
3548
+ const n = i.getData("statistics");
3549
+ if (n !== void 0) {
3550
+ const s = n.degree !== void 0 && !n.supernode ? n.degree - u.getDegreeWithoutSelfConnection(i) : n.supernodeDegree;
3551
+ if (s !== void 0 && s > 0)
3552
+ return t += s;
3553
+ }
3554
+ return t;
3555
+ }, 0);
3556
+ }
3557
+ /**
3558
+ * Return the visible degree of a node without self connection (self edge)
3559
+ *
3560
+ * @param {Node} node
3561
+ * @return {number}
3562
+ */
3563
+ static getDegreeWithoutSelfConnection(e) {
3564
+ return e.getAdjacentNodes({ policy: "exclude-sources", filter: "all" }).size;
3565
+ }
3566
+ /**
3567
+ * Return true if the color tone is "bright"
3568
+ *
3569
+ * @param {string} color
3570
+ * @returns {boolean}
3571
+ */
3572
+ static isBright(e) {
3573
+ if (e === null || !u.isStringFilled(e))
3574
+ return !0;
3575
+ const t = /#[A-Fa-f0-9]{3,6}/, i = /^rgb\(\s*([01]?\d\d?|2[0-4]\d|25[0-5])\s*,\s*([01]?\d\d?|2[0-4]\d|25[0-5])\s*,\s*([01]?\d\d?|2[0-4]\d|25[0-5])\s*\)$/i, n = /^rgba\(\s*([01]?\d\d?|2[0-4]\d|25[0-5])\s*,\s*([01]?\d\d?|2[0-4]\d|25[0-5])\s*,\s*([01]?\d\d?|2[0-4]\d|25[0-5])\s*,\s*(?:0|1|0?\.\d+)\s*\)$/i;
3576
+ let s;
3577
+ if (t.test(e)) {
3578
+ e.length < 5 && (e += e.slice(1)), e = e.replace("#", "");
3579
+ const c = parseInt(e[0].toString() + e[1].toString(), 16), d = parseInt(e[2].toString() + e[3].toString(), 16), g = parseInt(e[4].toString() + e[5].toString(), 16);
3580
+ s = `rgb(${c}, ${d}, ${g})`;
3581
+ } else if (i.test(e) || n.test(e) || Ce[e.toLowerCase()] !== void 0)
3582
+ s = u.isDefined(Ce[e.toLowerCase()]) ? Ce[e.toLowerCase()].rgb : e;
3583
+ else
3584
+ return !0;
3585
+ const [a, o, l] = /rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(,\d{1,3})?\)/.exec(s.replace(/\s/g, "")).slice(1, 4);
3586
+ return !u.isDefined(a) || !u.isDefined(o) || !u.isDefined(l) ? (console.warn("The given color is not a valid rgb formatted color"), !0) : (+a * 299 + +o * 587 + +l * 114) / 1e3 > 255 * 0.7;
3587
+ }
3588
+ static isNode(e) {
3589
+ return e.isNode;
3590
+ }
3591
+ static isNodeList(e) {
3592
+ return e.isNode;
3593
+ }
3594
+ static topologicalSort(e) {
3595
+ let i = e.toArray().find((a) => a.getDegree() === 1);
3596
+ const n = /* @__PURE__ */ new Set(), s = [];
3597
+ for (; i; ) {
3598
+ s.push(i), n.add(i);
3599
+ const a = i.getAdjacentNodes().filter((o) => !n.has(o)).get(0);
3600
+ i = a === void 0 ? null : a;
3601
+ }
3602
+ return s.map((a) => a.getId());
3603
+ }
3604
+ static isStar(e) {
3605
+ for (const t of e.toArray()) {
3606
+ const i = t.getAdjacentNodes();
3607
+ if (t.getDegree() > 2 && i.getDegree().every((s) => s === 1) && i.size + 1 === e.size) return t;
3608
+ }
3609
+ return !1;
3610
+ }
3611
+ }
3612
+ const De = "LKE_NODE_GROUPING_EDGE", Hg = "LKE_NODE_GROUPING_NODE";
3613
+ class Vg {
3614
+ constructor(e) {
3615
+ this._ogma = e;
3616
+ }
3617
+ /**
3618
+ * Set the grouping rule
3619
+ * @param rule of grouping
3620
+ */
3621
+ setGroupingRule(e) {
3622
+ this.groupRule = e;
3623
+ }
3624
+ /**
3625
+ * create a node grouping transformation
3626
+ * It uses groupRule to define the rule
3627
+ * Group the nodes based on a category type and a property value
3628
+ */
3629
+ async initTransformation() {
3630
+ this.transformation === void 0 ? this.transformation = this._ogma.transformations.addNodeGrouping({
3631
+ groupIdFunction: (e) => {
3632
+ var t;
3633
+ if (!this._isRuleNotApplicableToNode(e)) {
3634
+ const i = this._findGroupingPropertyValue(e);
3635
+ return `${(t = this.groupRule) == null ? void 0 : t.groupingOptions.itemTypes.join("-")}-${i}`.toLowerCase().trim();
3636
+ }
3637
+ },
3638
+ nodeGenerator: (e) => ({
3639
+ data: {
3640
+ categories: [Hg],
3641
+ properties: {},
3642
+ nodeGroupId: this._findNodeGroupId(e)
3643
+ }
3644
+ }),
3645
+ edgeGenerator: () => ({
3646
+ data: {
3647
+ type: De
3648
+ }
3649
+ }),
3650
+ showContents: !0,
3651
+ padding: 10
3652
+ }) : await this.refreshTransformation();
3653
+ }
3654
+ /**
3655
+ * refresh the transformation
3656
+ * Called when there is a change in the rule
3657
+ */
3658
+ async refreshTransformation() {
3659
+ this.transformation !== void 0 ? (await this.transformation.refresh(), await this._unpinNodes(this._getAllTransformationRawNodes())) : await this.initTransformation();
3660
+ }
3661
+ /**
3662
+ * init node grouping style
3663
+ */
3664
+ initNodeGroupingStyle() {
3665
+ this.nodeGroupingStyleRule = this._ogma.styles.addRule({
3666
+ nodeAttributes: {
3667
+ // Any default style will go here
3668
+ text: {
3669
+ content: (e) => this._getNodeGroupingCaption(e),
3670
+ style: "bold"
3671
+ },
3672
+ layer: -1,
3673
+ color: "rgba(240, 240, 240)",
3674
+ innerStroke: {
3675
+ color: "#7f7f7f",
3676
+ width: 2
3677
+ }
3678
+ },
3679
+ nodeSelector: (e) => e.isVirtual() && u.isDefined(e.getSubNodes()),
3680
+ // the style will be updated when data object is updated
3681
+ nodeDependencies: { self: { data: !0 } }
3682
+ });
3683
+ }
3684
+ async refreshNodeGroupingStyle() {
3685
+ var e;
3686
+ await ((e = this.nodeGroupingStyleRule) == null ? void 0 : e.refresh());
3687
+ }
3688
+ /**
3689
+ * run layout on all subnodes of virtual nodes
3690
+ */
3691
+ async runLayoutOnAllSubNodes() {
3692
+ await this._ogma.transformations.afterNextUpdate();
3693
+ const e = this._getAllTransformationRawNodes(), t = [];
3694
+ for (let i = 0; i < e.length; i++) {
3695
+ const n = e[i];
3696
+ t.push(this.runSubNodesLayout(n));
3697
+ }
3698
+ await Promise.all(t);
3699
+ }
3700
+ /**
3701
+ * Run the layout on the subnodes of the virtual node
3702
+ * @param subNodes nodes part of a virtual node
3703
+ */
3704
+ async runSubNodesLayout(e) {
3705
+ if (e.size === 0 || e.size === 1)
3706
+ return;
3707
+ if (e.size === 2) {
3708
+ await this._runTwoNodesLayout(e);
3709
+ return;
3710
+ }
3711
+ if (e.getAdjacentEdges({ bothExtremities: !0 }).size === 0) return this._runCirclePack(e);
3712
+ const i = this.isStar(e);
3713
+ if (i) {
3714
+ const s = e.filter((l) => l !== i), a = this._runCircularLayout({
3715
+ radii: s.getAttribute("radius"),
3716
+ cx: i.getAttribute("x"),
3717
+ cy: i.getAttribute("y"),
3718
+ clockwise: !1,
3719
+ distanceRatio: 5
3720
+ });
3721
+ await i.toList().concat(s).setAttributes([i.getPosition(), ...a]);
3722
+ return;
3723
+ }
3724
+ if (e.getDegree().every((s) => s > 0 && s <= 2)) {
3725
+ await this._runChainLayout(e);
3726
+ return;
3727
+ }
3728
+ return await this._runForceLayout(e);
3729
+ }
3730
+ /**
3731
+ * Get the virtual nodes of the transformation
3732
+ * @private
3733
+ */
3734
+ getVirtualNodesOfTransformation() {
3735
+ return this.transformation.getContext().metaNodes;
3736
+ }
3737
+ /**
3738
+ * Set the node group pin
3739
+ * @param nodeGroups object containing the node group id and the layoutable attribute
3740
+ */
3741
+ async setNodeGroupPin(e) {
3742
+ this._ogma.getNodes().filter((t) => t.isVirtual()).forEach((t) => {
3743
+ const i = e.find(
3744
+ (n) => n.id === t.getData("nodeGroupId")
3745
+ );
3746
+ i !== void 0 && t.setAttribute("layoutable", i.attributes.layoutable ?? !1);
3747
+ });
3748
+ }
3749
+ /**
3750
+ * Return the caption of a virtual node
3751
+ * @param node reference to the virtual node
3752
+ */
3753
+ _getNodeGroupingCaption(e) {
3754
+ var t;
3755
+ if (e !== void 0 && e.isVirtual() && ((t = e.getSubNodes()) == null ? void 0 : t.get(0)) !== void 0) {
3756
+ const i = e.getSubNodes().get(0).getData(["properties", this.groupRule.groupingOptions.propertyKey]), n = u.getValueFromLkProperty(i), s = e.getSubNodes().filter((a) => !a.hasClass("filtered")).size;
3757
+ return `${n} (${s})`;
3758
+ }
3759
+ }
3760
+ /**
3761
+ * Run the circle pack layout on the subnodes
3762
+ * @param subNodes
3763
+ */
3764
+ async _runCirclePack(e) {
3765
+ await this._ogma.algorithms.circlePack({
3766
+ nodes: e,
3767
+ margin: 10,
3768
+ sort: "asc"
3769
+ });
3770
+ }
3771
+ async _runChainLayout(e) {
3772
+ const t = this._ogma.getNodes(ne.topologicalSort(e));
3773
+ await this._ogma.layouts.grid({
3774
+ nodes: t,
3775
+ // TODO: test that visually
3776
+ colDistance: Math.max(...e.getAttribute("radius").map(Number)) * 4,
3777
+ rows: 1
3778
+ });
3779
+ }
3780
+ async _runForceLayout(e) {
3781
+ await this._ogma.layouts.force({
3782
+ nodes: e,
3783
+ ...kg
3784
+ });
3785
+ }
3786
+ _isRuleNotApplicableToNode(e) {
3787
+ var i;
3788
+ const t = e.getData([
3789
+ "properties",
3790
+ ((i = this.groupRule) == null ? void 0 : i.groupingOptions.propertyKey) ?? ""
3791
+ ]);
3792
+ return (
3793
+ // if the group rule is not defined
3794
+ this.groupRule === void 0 || // if rule is applied to a different category
3795
+ this.groupRule.groupingOptions.itemTypes.every(
3796
+ (n) => !e.getData("categories").includes(n)
3797
+ ) || // if the property value is not defined
3798
+ !u.isDefined(t) || // if the property value is missing
3799
+ typeof t == "object" && t.status === "missing"
3800
+ );
3801
+ }
3802
+ /**
3803
+ * Unpin list of nodes
3804
+ * @param nodes
3805
+ * @private
3806
+ */
3807
+ async _unpinNodes(e) {
3808
+ await Promise.all(
3809
+ e.map((t) => {
3810
+ if (t !== null)
3811
+ return t.setAttribute("layoutable", !0);
3812
+ })
3813
+ );
3814
+ }
3815
+ /**
3816
+ * Get all the raw nodes part of the transformation
3817
+ * @private
3818
+ */
3819
+ _getAllTransformationRawNodes() {
3820
+ return this.getVirtualNodesOfTransformation().getSubNodes();
3821
+ }
3822
+ _findGroupingPropertyValue(e) {
3823
+ var i;
3824
+ const t = e.getData([
3825
+ "properties",
3826
+ ((i = this.groupRule) == null ? void 0 : i.groupingOptions.propertyKey) ?? ""
3827
+ ]);
3828
+ return `${u.getValueFromLkProperty(t)}`;
3829
+ }
3830
+ /**
3831
+ * Return a hashed string that represents the group id
3832
+ */
3833
+ _findNodeGroupId(e) {
3834
+ var i, n;
3835
+ const t = this._findGroupingPropertyValue(e.get(0));
3836
+ return He(
3837
+ `${(i = this.groupRule) == null ? void 0 : i.name}-${(n = this.groupRule) == null ? void 0 : n.groupingOptions.itemTypes.join(
3838
+ "-"
3839
+ )}-${t}`
3840
+ );
3841
+ }
3842
+ _runCircularLayout({
3843
+ radii: e,
3844
+ clockwise: t = !0,
3845
+ cx: i = 0,
3846
+ cy: n = 0,
3847
+ startAngle: s = 3 / 2 * Math.PI,
3848
+ getRadius: a = (l) => Number(l),
3849
+ distanceRatio: o = 0
3850
+ }) {
3851
+ const l = e.length;
3852
+ if (l === 0) return [];
3853
+ if (l === 1) return [{ x: i, y: n }];
3854
+ const c = e.map(a).reduce((A, x) => Math.max(A, x), 0) * (2 + o), g = (2 * Math.PI - 2 * Math.PI / l) / Math.max(1, l - 1), h = Math.cos(g) - Math.cos(0), y = Math.sin(g) - Math.sin(0), _ = Math.sqrt(c * c / (h * h + y * y)), f = Math.max(_, 0);
3855
+ return e.map((A, x) => {
3856
+ const $ = s + x * g * (t ? 1 : -1), R = f * Math.cos($), v = f * Math.sin($);
3857
+ return {
3858
+ x: i + R,
3859
+ y: n + v
3860
+ };
3861
+ });
3862
+ }
3863
+ async _runTwoNodesLayout(e) {
3864
+ const t = e.getAttribute("radius").map(Number), i = e.getPosition(), n = Math.min(...t);
3865
+ await e.setAttributes([
3866
+ i[0],
3867
+ { x: i[0].x + n + t[0] + t[1], y: i[0].y }
3868
+ ]);
3869
+ }
3870
+ isStar(e) {
3871
+ for (const t of e.getId()) {
3872
+ const i = this._ogma.getNode(t), n = i.getAdjacentNodes();
3873
+ if (i.getDegree() > 2 && n.getDegree().every((a) => a === 1) && n.size + 1 === e.size) return i;
3874
+ }
3875
+ return !1;
3876
+ }
3877
+ }
3878
+ const Kg = {
3879
+ color: "#000000",
3880
+ shape: {
3881
+ style: "dashed",
3882
+ head: "arrow"
3883
+ },
3884
+ width: 1.5
3885
+ };
3886
+ class qg {
3887
+ constructor(e) {
3888
+ this._ogma = e, this.groupedEdges = {};
3889
+ }
3890
+ /**
3891
+ * create an edge grouping transformation by edge type
3892
+ */
3893
+ async initTransformation() {
3894
+ this.transformation === void 0 ? this.transformation = this._ogma.transformations.addEdgeGrouping({
3895
+ separateEdgesByDirection: !0,
3896
+ selector: (e) => this.groupedEdges[e.getData("type")],
3897
+ groupIdFunction: (e) => e.getData("type"),
3898
+ generator: (e) => ({
3899
+ data: {
3900
+ properties: {
3901
+ originalType: e.getData("type")[0]
3902
+ }
3903
+ }
3904
+ })
3905
+ }) : await this.transformation.refresh();
3906
+ }
3907
+ /**
3908
+ * init edge grouping style
3909
+ */
3910
+ initEdgeGroupingStyle() {
3911
+ this.edgeGroupingStyleRule = this._ogma.styles.addRule({
3912
+ edgeAttributes: {
3913
+ ...Kg,
3914
+ ...this.edgeGroupStyle,
3915
+ text: {
3916
+ content: (e) => {
3917
+ if (e !== void 0 && e.getSubEdges() !== null && e.getData("type") !== De) {
3918
+ const t = e.getSubEdges().filter((i) => !i.hasClass("filtered")).size;
3919
+ return `${e.getData(["properties", "originalType"])} (${t})`;
3920
+ }
3921
+ },
3922
+ style: "bold"
3923
+ }
3924
+ },
3925
+ edgeSelector: (e) => e.isVirtual() && e.getSubEdges() && e.getSubEdges().filter((t) => !t.hasClass("filtered")).size > 0 && e.getData("type") !== De,
3926
+ edgeDependencies: { self: { data: !0 } }
3927
+ });
3928
+ }
3929
+ refreshEdgeGroupingStyle() {
3930
+ this.edgeGroupingStyleRule !== void 0 && this.edgeGroupingStyleRule.refresh();
3931
+ }
3932
+ }
3933
+ const m = class m {
3934
+ /**
3935
+ * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).
3936
+ *
3937
+ * Notes:
3938
+ * 1. `filterRules` are rules that match what should be filtered/hidden.
3939
+ * 2. `filterRules` are combined inclusively: as soon as one rule returns `true` for
3940
+ * an item, the item can be hidden/filtered.
3941
+ *
3942
+ * @param filterRules
3943
+ * @param itemData
3944
+ */
3945
+ static isFiltered(e, t) {
3946
+ return u.isDefined(t) ? "categories" in t ? m.getFilterFunction(e, !0)(t) : m.getFilterFunction(e, !1)(t) : !1;
3947
+ }
3948
+ static getFilterFunction(e, t) {
3949
+ const i = JSON.stringify(e, null, ""), n = t ? m.nodeCache : m.edgeCache;
3950
+ let s = n.get(i);
3951
+ return s || (s = m.createFilterFunction(e, t), n.size > m.FILTER_CACHE_SIZE && n.clear(), n.set(i, s)), s;
3952
+ }
3953
+ static createFilterFunction(e, t) {
3954
+ const i = e.map(
3955
+ (n) => m.filterToFilterFunction(n, t)
3956
+ );
3957
+ return (n) => {
3958
+ for (const s of i)
3959
+ if (s(n))
3960
+ return !0;
3961
+ return !1;
3962
+ };
3963
+ }
3964
+ static filterToFilterFunction(e, t) {
3965
+ switch (e.type) {
3966
+ case S.ANY:
3967
+ return m.createAnyFilterFunction(e, t);
3968
+ case S.IS:
3969
+ return m.createIsFilterFunction(e, t);
3970
+ case S.NO_VALUE:
3971
+ return m.createNoValueFilterFunction(e, t);
3972
+ case S.RANGE:
3973
+ return m.createRangeFilterFunction(e, t);
3974
+ case S.NAN:
3975
+ return m.createNaNFilterFunction(e, t);
3976
+ }
3977
+ }
3978
+ static createAnyFilterFunction(e, t) {
3979
+ return t ? (i) => e.itemType === void 0 ? !0 : i.categories.includes(e.itemType) : (i) => i.type === e.itemType;
3980
+ }
3981
+ static createIsFilterFunction(e, t) {
3982
+ return t ? (i) => i.categories.includes(e.itemType) && u.getPropertyValue(u.getIn(i, e.input), !0) === e.value : (i) => i.type === e.itemType && u.getPropertyValue(u.getIn(i, e.input), !0) === e.value;
3983
+ }
3984
+ static createNoValueFilterFunction(e, t) {
3985
+ return t ? (i) => i.categories.includes(e.itemType) && !u.isDefined(u.getPropertyValue(u.getIn(i, e.input), !0)) : (i) => i.type === e.itemType && !u.isDefined(u.getPropertyValue(u.getIn(i, e.input), !0));
3986
+ }
3987
+ static createNaNFilterFunction(e, t) {
3988
+ return t ? (i) => i.categories.includes(e.itemType) && m.isNotANumber(u.getPropertyValue(u.getIn(i, e.input), !0)) : (i) => i.type === e.itemType && m.isNotANumber(u.getPropertyValue(u.getIn(i, e.input), !0));
3989
+ }
3990
+ static isNotANumber(e) {
3991
+ return u.isDefined(e) && !u.isNumber(e);
3992
+ }
3993
+ static createRangeFilterFunction(e, t) {
3994
+ return t ? (i) => i.categories.includes(e.itemType) && m.valueShouldBeHidden(
3995
+ u.getPropertyValue(u.getIn(i, e.input), !1),
3996
+ e.value
3997
+ ) : (i) => i.type === e.itemType && m.valueShouldBeHidden(
3998
+ u.getPropertyValue(u.getIn(i, e.input), !1),
3999
+ e.value
4000
+ );
4001
+ }
4002
+ /**
4003
+ * Returns true if `value` should be filtered/hidden.
4004
+ *
4005
+ * `range` describes what should be filtered/hidden:
4006
+ * - e.g. {"<":10, ">=":20} => hide any value in ]-inf, 10[ *OR* in [20, +inf[
4007
+ * - e.g. {"<=":10} => hide any value in ]-inf, 10]
4008
+ * - e.g. {">=":20} => hide any value in [20, +inf[
4009
+ *
4010
+ * Returns false (i.e. will not filter/hide) if `value` is not a number.
4011
+ */
4012
+ static valueShouldBeHidden(e, t) {
4013
+ const i = u.parseFloat(e);
4014
+ return Number.isNaN(i) ? !1 : t["<"] !== void 0 && i < t["<"] || t["<="] !== void 0 && i <= t["<="] || t[">"] !== void 0 && i > t[">"] || t[">="] !== void 0 && i >= t[">="];
4015
+ }
4016
+ };
4017
+ m.nodeCache = /* @__PURE__ */ new Map(), m.edgeCache = /* @__PURE__ */ new Map(), m.FILTER_CACHE_SIZE = 5;
4018
+ let Gt = m;
4019
+ const Qg = (r) => r.selection.size, eh = (r) => {
4020
+ switch (r.selection.size) {
4021
+ case 1:
4022
+ return "selection";
4023
+ case 0:
4024
+ return "noSelection";
4025
+ default:
4026
+ return "multiSelection";
4027
+ }
4028
+ }, th = (r) => {
4029
+ if (r.selection.size !== 0)
4030
+ return r.selection.isNode ? P.NODE : P.EDGE;
4031
+ }, qe = (r) => r.selection.size === 1 ? r.selection.get(0) : void 0, rh = (r) => {
4032
+ const e = qe(r);
4033
+ if (e !== void 0)
4034
+ return e.isNode ? e.getData("categories") : [e.getData("type")];
4035
+ }, ih = (r) => {
4036
+ const e = qe(r);
4037
+ if (e !== void 0)
4038
+ return e.isNode ? "node" : "edge";
4039
+ }, Wg = (r) => {
4040
+ const e = qe(r);
4041
+ if (e !== void 0) {
4042
+ const t = e.getData().properties;
4043
+ return Object.keys(t).map((i) => ({
4044
+ key: i,
4045
+ value: t[i]
4046
+ }));
4047
+ }
4048
+ return [];
4049
+ }, nh = (r) => Wg(r).length > 0;
4050
+ export {
4051
+ jg as ANIMATION_DURATION,
4052
+ F as BASE_GREY,
4053
+ w as Captions,
4054
+ Ag as CaptionsViz,
4055
+ W as EdgeAttributes,
4056
+ It as FILTER_OPACITY,
4057
+ Gt as Filters,
4058
+ Ce as HTML_COLORS,
4059
+ E as ItemAttributes,
4060
+ De as LKE_NODE_GROUPING_EDGE,
4061
+ Xg as LKOgma,
4062
+ U as NodeAttributes,
4063
+ Gg as OgmaStore,
4064
+ ne as OgmaTools,
4065
+ Nt as PALETTE,
4066
+ C as StyleRule,
4067
+ vg as StyleRuleType,
4068
+ p as StyleRules,
4069
+ D as StyleType,
4070
+ Sg as StylesViz,
4071
+ u as Tools,
4072
+ qg as TransformationsViz,
4073
+ th as getSelectionEntity,
4074
+ Wg as getSelectionProperties,
4075
+ Qg as getSelectionSize,
4076
+ eh as getSelectionState,
4077
+ qe as getUniqSelection,
4078
+ ih as getUniqSelectionEntity,
4079
+ rh as getUniqSelectionTypes,
4080
+ nh as hasSelectionProperties
4081
+ };
4082
+ //# sourceMappingURL=index.mjs.map