@linkurious/ogma-linkurious-parser 4.1.7 → 4.1.9

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 (47) 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 +4099 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/ogma/features/nodeGrouping.d.ts +15 -1
  7. package/dist/styles/styleRules.d.ts +8 -0
  8. package/dist/tools/ogmaTool.d.ts +3 -1
  9. package/package.json +23 -21
  10. package/dist/captions/captions.js +0 -115
  11. package/dist/captions/captions.js.map +0 -1
  12. package/dist/filters/filters.js +0 -167
  13. package/dist/filters/filters.js.map +0 -1
  14. package/dist/index.js +0 -56
  15. package/dist/index.js.map +0 -1
  16. package/dist/ogma/features/OgmaStore.js +0 -37
  17. package/dist/ogma/features/OgmaStore.js.map +0 -1
  18. package/dist/ogma/features/captions.js +0 -117
  19. package/dist/ogma/features/captions.js.map +0 -1
  20. package/dist/ogma/features/nodeGrouping.js +0 -283
  21. package/dist/ogma/features/nodeGrouping.js.map +0 -1
  22. package/dist/ogma/features/reactive.js +0 -132
  23. package/dist/ogma/features/reactive.js.map +0 -1
  24. package/dist/ogma/features/selectors.js +0 -97
  25. package/dist/ogma/features/selectors.js.map +0 -1
  26. package/dist/ogma/features/styles.js +0 -689
  27. package/dist/ogma/features/styles.js.map +0 -1
  28. package/dist/ogma/features/transformations.js +0 -86
  29. package/dist/ogma/features/transformations.js.map +0 -1
  30. package/dist/ogma/index.js +0 -326
  31. package/dist/ogma/index.js.map +0 -1
  32. package/dist/styles/edgeAttributes.js +0 -115
  33. package/dist/styles/edgeAttributes.js.map +0 -1
  34. package/dist/styles/itemAttributes.js +0 -133
  35. package/dist/styles/itemAttributes.js.map +0 -1
  36. package/dist/styles/nodeAttributes.js +0 -228
  37. package/dist/styles/nodeAttributes.js.map +0 -1
  38. package/dist/styles/styleRule.js +0 -194
  39. package/dist/styles/styleRule.js.map +0 -1
  40. package/dist/styles/styleRules.js +0 -292
  41. package/dist/styles/styleRules.js.map +0 -1
  42. package/dist/tools/colorPalette.js +0 -145
  43. package/dist/tools/colorPalette.js.map +0 -1
  44. package/dist/tools/ogmaTool.js +0 -86
  45. package/dist/tools/ogmaTool.js.map +0 -1
  46. package/dist/tools/tools.js +0 -409
  47. package/dist/tools/tools.js.map +0 -1
package/dist/index.mjs ADDED
@@ -0,0 +1,4099 @@
1
+ import { CurrencyFormat as B, PropertyTypeName as pr, AutoRangeScale as Ut, OgmaEdgeShape as br, SelectorType as S, ForceLayoutMode as yr, EntityType as I } 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 Ir(r) {
37
+ return Lr(this.__data__, r) > -1;
38
+ }
39
+ var Pr = Ir, 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 = Pr, 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, Ii = Ht, Pi = 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) || Pi(r))
131
+ return !1;
132
+ var e = Ii(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"), Ie = 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 = Ie;
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 In = Ln, Pn = In;
199
+ function Mn(r, e) {
200
+ var t = r.__data__;
201
+ return Pn(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 Pe = H, es = ae, ts = Ie, rs = Pe, 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 = Pe, 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 Is(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 Ps = Is;
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 = Ps, 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, Ia = /^(?:0|[1-9]\d*)$/;
422
+ function Pa(r, e) {
423
+ var t = typeof r;
424
+ return e = e ?? La, !!e && (t == "number" || t != "symbol" && Ia.test(r)) && r > -1 && r % 1 == 0 && r < e;
425
+ }
426
+ var Re = Pa, 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, Io = Lo, Po = Io(Object.keys, Object), Mo = Po, 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 = Ie, 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]", Iu = Object.prototype, vt = Iu.hasOwnProperty;
548
+ function Pu(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 = Pu, 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 = Pe, 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 Il(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 = Il, Pl = 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 Pl();
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, Ic = Oc, Pc = Ue, Mc = ge;
766
+ function Rc(r) {
767
+ return Pc(r) ? Lc(Mc(r)) : Ic(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 Id(r) {
884
+ return function() {
885
+ return r;
886
+ };
887
+ }
888
+ var Pd = Id, Md = M, Rd = function() {
889
+ try {
890
+ var r = Md(Object, "defineProperty");
891
+ return r({}, "", {}), r;
892
+ } catch {
893
+ }
894
+ }(), Bd = Rd, zd = Pd, 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), E = "#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 F {
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[F.getRandomUniqueColorPaletteIndex(e, Nt.length, t)] : E;
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" ? F.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 F {
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 E;
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 = F.autoColor(`${s}`, n.style.color.ignoreCase);
1533
+ }
1534
+ break;
1535
+ }
1536
+ }
1537
+ return u.isDefined(t) ? t : E;
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: E,
1596
+ shape: br.ARROW,
1597
+ width: "100%"
1598
+ };
1599
+ }
1600
+ }
1601
+ class U extends F {
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 [E];
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 = F.autoColor(e.categories[a], c.style.color.ignoreCase) : o = F.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 = [E]);
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: E
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 = F.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 = F.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 = F.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
+ * Return the color of item type from the list of styles
2079
+ */
2080
+ getColorForType(e) {
2081
+ const t = this.color.map((i) => i.getTypeColor(e)).filter((i) => u.isDefined(i));
2082
+ return t.length > 0 ? t[t.length - 1] : E;
2083
+ }
2084
+ /**
2085
+ * Return the icon of item type from the list of styles
2086
+ */
2087
+ getIconForType(e) {
2088
+ const t = this.icon.filter((i) => !u.isDefined(i.input) && i.itemType === e).map((i) => {
2089
+ var n;
2090
+ return (n = i.style.icon) == null ? void 0 : n.content;
2091
+ }).filter((i) => u.isDefined(i));
2092
+ return t.length > 0 ? t[t.length - 1] : void 0;
2093
+ }
2094
+ /**
2095
+ * Check if a legend item already exists and overwrite it / push it
2096
+ */
2097
+ static updateLegend(e, { label: t, value: i }) {
2098
+ const n = e.map((s) => s.label).indexOf(t);
2099
+ n < 0 ? e.push({ label: t, value: i }) : e[n] = { label: t, value: i };
2100
+ }
2101
+ /**
2102
+ * return an array of StyleRule, containing only the desired style
2103
+ */
2104
+ static getBy(e, t) {
2105
+ return t.filter((i) => {
2106
+ switch (e) {
2107
+ case "color":
2108
+ return i.style.color !== void 0;
2109
+ case "icon":
2110
+ return "icon" in i.style && i.style.icon !== void 0;
2111
+ case "image":
2112
+ return "image" in i.style && i.style.image !== void 0;
2113
+ case "shape":
2114
+ return i.style.shape !== void 0;
2115
+ case "size":
2116
+ return "size" in i.style && i.style.size !== void 0;
2117
+ case "width":
2118
+ return "width" in i.style && i.style.width !== void 0;
2119
+ }
2120
+ }).map((i) => p.getRule(i, e));
2121
+ }
2122
+ /**
2123
+ * From a RawStyle, generate a StyleRule of a specific style
2124
+ */
2125
+ static getRule(e, t) {
2126
+ const i = u.clone(e);
2127
+ return i.style = { [t]: i.style[t] }, new C(i);
2128
+ }
2129
+ /**
2130
+ * Check for non unique index in styles rules and update them if exists
2131
+ */
2132
+ static sanitizeStylesIndex(e) {
2133
+ const t = [], i = u.clone(e);
2134
+ let n = Math.max(...e.node.map((s) => s.index), ...e.edge.map((s) => s.index)) + 1;
2135
+ 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;
2136
+ }
2137
+ }
2138
+ const Dt = {
2139
+ text: {
2140
+ style: "bold",
2141
+ backgroundColor: "#fff",
2142
+ minVisibleSize: 0
2143
+ },
2144
+ outerStroke: { width: 2 },
2145
+ outline: !1
2146
+ }, Ot = {
2147
+ text: {
2148
+ style: "bold",
2149
+ backgroundColor: "#fff",
2150
+ minVisibleSize: 0
2151
+ },
2152
+ outline: !1
2153
+ }, mg = {
2154
+ color: "#FFF",
2155
+ width: 7,
2156
+ scalingMethod: "scaled",
2157
+ strokeWidth: 0,
2158
+ hideNonAdjacentEdges: !1
2159
+ }, _g = {
2160
+ color: "#FFF",
2161
+ scalingMethod: "scaled",
2162
+ width: 4
2163
+ }, Cg = "'roboto', sans-serif", Lt = "#000", ve = "#FFF", It = "#7f7f7f", Pt = 0.2;
2164
+ class Sg {
2165
+ constructor(e, t) {
2166
+ this._nodeAttributes = new U({}), this._edgeAttributes = new W({}), this._ogma = e, this._defaultConfiguration = t, this._nodeAttributes.setBaseUrl(t.baseUrl);
2167
+ }
2168
+ /**
2169
+ * Set nodes default styles based on the configuration
2170
+ */
2171
+ setNodesDefaultStyles() {
2172
+ this._ogma.styles.setHoveredNodeAttributes(Dt), this._ogma.styles.setSelectedNodeAttributes(Dt), this._nodeDefaultStylesRules = this._ogma.styles.addRule({
2173
+ nodeAttributes: {
2174
+ text: {
2175
+ padding: 5,
2176
+ minVisibleSize: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.minVisibleSize ? this._defaultConfiguration.node.text.minVisibleSize : 12,
2177
+ maxLineLength: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.maxLineLength !== void 0 ? this._defaultConfiguration.node.text.maxLineLength : 30,
2178
+ position: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.nodePosition !== void 0 ? this._defaultConfiguration.node.text.nodePosition : "bottom",
2179
+ backgroundColor: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.backgroundColor !== void 0 ? this._defaultConfiguration.node.text.backgroundColor : void 0,
2180
+ font: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.font !== void 0 ? this._defaultConfiguration.node.text.font : "'roboto', sans-serif",
2181
+ color: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.color !== void 0 ? this._defaultConfiguration.node.text.color : "black",
2182
+ size: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.size !== void 0 ? this._defaultConfiguration.node.text.size : 14,
2183
+ margin: 5
2184
+ },
2185
+ radius: this.defaultNodeRadius(this._defaultConfiguration.node),
2186
+ icon: {
2187
+ minVisibleSize: 15
2188
+ },
2189
+ color: It,
2190
+ shape: this._defaultConfiguration.node.shape !== void 0 ? this._defaultConfiguration.node.shape : "circle",
2191
+ innerStroke: {
2192
+ width: 3
2193
+ },
2194
+ outline: !1
2195
+ }
2196
+ });
2197
+ }
2198
+ /**
2199
+ * Set edges default styles based on the configuration
2200
+ */
2201
+ setEdgesDefaultStyles() {
2202
+ var e;
2203
+ this._ogma.styles.setHoveredEdgeAttributes(Ot), this._ogma.styles.setSelectedEdgeAttributes(Ot), this._edgeDefaultStylesRules = this._ogma.styles.addRule({
2204
+ edgeAttributes: {
2205
+ text: {
2206
+ minVisibleSize: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.minVisibleSize ? this._defaultConfiguration.edge.text.minVisibleSize : 3,
2207
+ maxLineLength: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.maxLineLength !== void 0 ? this._defaultConfiguration.edge.text.maxLineLength : 30,
2208
+ backgroundColor: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.backgroundColor !== void 0 ? this._defaultConfiguration.edge.text.backgroundColor : void 0,
2209
+ font: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.font !== void 0 ? this._defaultConfiguration.edge.text.font : "'roboto', sans-serif",
2210
+ 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",
2211
+ size: this._defaultConfiguration.edge.text !== void 0 && this._defaultConfiguration.edge.text.size !== void 0 ? this._defaultConfiguration.edge.text.size : 14
2212
+ },
2213
+ width: this.defaultEdgeWidth(this._defaultConfiguration.edge),
2214
+ shape: this._defaultConfiguration.edge.shape !== void 0 ? this._defaultConfiguration.edge.shape : "arrow",
2215
+ color: It
2216
+ }
2217
+ });
2218
+ }
2219
+ /**
2220
+ * Set nodes default styles based on the configuration
2221
+ */
2222
+ setNodesDefaultHalo() {
2223
+ this._nodeDefaultHaloRules = this._ogma.styles.addRule({
2224
+ nodeSelector: (e) => e && !e.hasClass("filtered"),
2225
+ nodeAttributes: {
2226
+ halo: (e) => e !== void 0 && !e.hasClass("filtered") && (e.isSelected() || e.getAdjacentNodes({}).isSelected().includes(!0) || e.getAdjacentEdges().isSelected().includes(!0)) ? {
2227
+ ...mg,
2228
+ scalingMethod: this._ogma.geo.enabled() ? "fixed" : "scaled"
2229
+ } : null
2230
+ },
2231
+ // recalculate the rule *only* when itself or adjacent
2232
+ // elements change their selection status
2233
+ nodeDependencies: {
2234
+ self: {
2235
+ selection: !0
2236
+ },
2237
+ adjacentNodes: {
2238
+ selection: !0
2239
+ },
2240
+ adjacentEdges: {
2241
+ selection: !0
2242
+ }
2243
+ }
2244
+ });
2245
+ }
2246
+ /**
2247
+ * Set edges default styles based on the configuration
2248
+ */
2249
+ setEdgesDefaultHalo() {
2250
+ this._edgeDefaultHaloRules = this._ogma.styles.addRule({
2251
+ edgeSelector: (e) => e && e.getSource() && e.getTarget() && !e.hasClass("filtered"),
2252
+ edgeAttributes: {
2253
+ halo: (e) => e && !e.hasClass("filtered") && (e.isSelected() || e.getSource().isSelected() || e.getTarget().isSelected()) ? {
2254
+ ..._g,
2255
+ scalingMethod: this._ogma.geo.enabled() ? "fixed" : "scaled"
2256
+ } : null
2257
+ },
2258
+ // this rule will only be invoked when the selection status
2259
+ // of the edge or it's extremities is changed
2260
+ edgeDependencies: {
2261
+ self: {
2262
+ selection: !0
2263
+ },
2264
+ extremities: {
2265
+ selection: !0
2266
+ }
2267
+ }
2268
+ });
2269
+ }
2270
+ /**
2271
+ * Return the default node radius set in configuration or 5
2272
+ *
2273
+ * @returns {number}
2274
+ */
2275
+ defaultNodeRadius(e) {
2276
+ return this.defaultStylesHas(e, ["nodeRadius"]) ? e.nodeRadius : 5;
2277
+ }
2278
+ /**
2279
+ * Return the default edge width set in configuration or 1
2280
+ *
2281
+ * @returns {number}
2282
+ */
2283
+ defaultEdgeWidth(e) {
2284
+ return this.defaultStylesHas(e, ["edgeWidth"]) ? e.edgeWidth : 1;
2285
+ }
2286
+ /**
2287
+ * Check if a style property exists in the default styles object
2288
+ */
2289
+ defaultStylesHas(e, t) {
2290
+ return u.isDefined(e) ? u.getIn(e, t) !== void 0 : !1;
2291
+ }
2292
+ /**
2293
+ * Set styles for the class "filtered"
2294
+ */
2295
+ setFilterClass() {
2296
+ this._ogma.styles.createClass({
2297
+ name: "filtered",
2298
+ nodeAttributes: {
2299
+ opacity: Pt,
2300
+ layer: (e) => e.getMetaNode() !== null ? 1 : -1,
2301
+ detectable: !1,
2302
+ badges: {
2303
+ topRight: {
2304
+ text: null
2305
+ },
2306
+ bottomRight: {
2307
+ text: null
2308
+ }
2309
+ },
2310
+ text: null,
2311
+ color: "rgb(240, 240, 240)",
2312
+ innerStroke: {
2313
+ width: 1,
2314
+ color: E,
2315
+ minVisibleSize: 1
2316
+ },
2317
+ shape: "circle",
2318
+ image: null,
2319
+ icon: null,
2320
+ radius: "50%"
2321
+ },
2322
+ edgeAttributes: {
2323
+ opacity: Pt,
2324
+ layer: (e) => {
2325
+ const t = e.getExtremities().getMetaNode().some((i) => i !== null);
2326
+ return !e.isVirtual() && t ? 1 : -1;
2327
+ },
2328
+ detectable: !1,
2329
+ text: null,
2330
+ color: E,
2331
+ shape: "line",
2332
+ width: 0.2
2333
+ }
2334
+ });
2335
+ }
2336
+ /**
2337
+ * Set the class for exported nodes and edges
2338
+ */
2339
+ setExportClass(e) {
2340
+ this._exportClass ? this._exportClass.update({
2341
+ nodeAttributes: {
2342
+ text: {
2343
+ maxLineLength: e ? 30 : 0
2344
+ },
2345
+ halo: null
2346
+ }
2347
+ }) : this._exportClass = this._ogma.styles.createClass({
2348
+ name: "exported",
2349
+ nodeAttributes: {
2350
+ text: {
2351
+ minVisibleSize: 0,
2352
+ size: 12,
2353
+ maxLineLength: e ? 30 : 0
2354
+ },
2355
+ halo: null
2356
+ },
2357
+ edgeAttributes: {
2358
+ text: {
2359
+ minVisibleSize: 0,
2360
+ size: 12
2361
+ },
2362
+ halo: null
2363
+ }
2364
+ });
2365
+ }
2366
+ /**
2367
+ * Set the rule to display badges
2368
+ */
2369
+ setBadgeRule() {
2370
+ this._ogma.styles.createClass({
2371
+ name: "degreeIndicator",
2372
+ nodeAttributes: {
2373
+ badges: {
2374
+ topRight: (e) => {
2375
+ if (e !== void 0) {
2376
+ const t = u.getHiddenNeighbors(e.toList()), i = u.formatNumber(t);
2377
+ if (t > 0) {
2378
+ 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"]);
2379
+ let o = null;
2380
+ return +i != 0 && (o = a ? i + "+" : i), {
2381
+ color: "inherit",
2382
+ minVisibleSize: 20,
2383
+ stroke: {
2384
+ width: 0,
2385
+ color: null
2386
+ },
2387
+ text: {
2388
+ font: this._defaultConfiguration.node.text !== void 0 && this._defaultConfiguration.node.text.font !== void 0 ? this._defaultConfiguration.node.text.font : Cg,
2389
+ scale: 0.4,
2390
+ color: s,
2391
+ content: o
2392
+ }
2393
+ };
2394
+ }
2395
+ }
2396
+ }
2397
+ }
2398
+ }
2399
+ }), this._ogma.styles.createClass({
2400
+ name: "pinnedIndicator",
2401
+ nodeAttributes: {
2402
+ badges: {
2403
+ bottomRight: (e) => {
2404
+ if (e !== void 0 && !e.getAttribute("layoutable"))
2405
+ return {
2406
+ color: this._findPinBadgeBackgroundColor(e),
2407
+ minVisibleSize: 20,
2408
+ scale: this._findPinBadgeScale(e),
2409
+ stroke: {
2410
+ width: 0,
2411
+ color: null
2412
+ },
2413
+ text: {
2414
+ font: "FontAwesome",
2415
+ scale: 0.4,
2416
+ color: this._findPinBadgeTextColor(e),
2417
+ content: e.getAttribute("layoutable") ? null : ""
2418
+ }
2419
+ };
2420
+ }
2421
+ }
2422
+ },
2423
+ nodeDependencies: {
2424
+ self: { attributes: ["layoutable"] }
2425
+ }
2426
+ }), this._ogma.events.on("addNodes", (e) => e.nodes.addClass("degreeIndicator")), this._ogma.events.on("addNodes", (e) => e.nodes.addClass("pinnedIndicator"));
2427
+ }
2428
+ /**
2429
+ * Delete the rule to display badges
2430
+ */
2431
+ deleteBadgeRule() {
2432
+ this._ogma.getNodes().removeClasses(["degreeIndicator", "pinnedIndicator"], 0);
2433
+ }
2434
+ /**
2435
+ * set text overlap to true or false
2436
+ *
2437
+ * @param {boolean} overlap
2438
+ */
2439
+ toggleTextOverlap(e) {
2440
+ this._ogma.setOptions({ texts: { preventOverlap: e } });
2441
+ }
2442
+ /**
2443
+ * refresh nodes and edge rules
2444
+ *
2445
+ */
2446
+ refreshRules() {
2447
+ this._nodeDefaultStylesRules.refresh(), this._edgeDefaultStylesRules.refresh();
2448
+ }
2449
+ /**
2450
+ * Create / refresh an ogma rule for node colors
2451
+ */
2452
+ refreshNodeColors(e) {
2453
+ u.isDefined(this._ogmaNodeColor) ? (this._nodeAttributes.refresh({ color: e }), this._ogmaNodeColor.refresh()) : (this._nodeAttributes.refresh({ color: e }), this._ogmaNodeColor = this._ogma.styles.addRule({
2454
+ nodeAttributes: {
2455
+ color: (t) => {
2456
+ if (t !== void 0)
2457
+ return this._nodeAttributes.color(t.getData());
2458
+ }
2459
+ },
2460
+ nodeDependencies: { self: { data: !0 } }
2461
+ }));
2462
+ }
2463
+ /**
2464
+ * Return an array of StyleRules with only the style that need to be applied
2465
+ */
2466
+ getStyleRule(e, t) {
2467
+ return new p(e)[t];
2468
+ }
2469
+ initNodeColors(e) {
2470
+ const t = this.getStyleRule(
2471
+ e,
2472
+ D.COLOR
2473
+ );
2474
+ this.refreshNodeColors(t);
2475
+ }
2476
+ initNodesIcons(e) {
2477
+ const t = this.getStyleRule(
2478
+ e,
2479
+ D.ICON
2480
+ );
2481
+ this.refreshNodeIcons(t);
2482
+ }
2483
+ initNodesSizes(e) {
2484
+ const t = this.getStyleRule(e, D.SIZE);
2485
+ this.refreshNodeSize(t);
2486
+ }
2487
+ initNodesShapes(e) {
2488
+ const t = this.getStyleRule(
2489
+ e,
2490
+ D.SHAPE
2491
+ );
2492
+ this.refreshNodeShape(t);
2493
+ }
2494
+ initEdgesWidth(e) {
2495
+ const t = this.getStyleRule(
2496
+ e,
2497
+ D.WIDTH
2498
+ );
2499
+ this.refreshEdgeWidth(t);
2500
+ }
2501
+ initEdgesShape(e) {
2502
+ const t = this.getStyleRule(
2503
+ e,
2504
+ D.SHAPE
2505
+ );
2506
+ this.refreshEdgeShape(t);
2507
+ }
2508
+ initEdgesColor(e) {
2509
+ const t = this.getStyleRule(
2510
+ e,
2511
+ D.COLOR
2512
+ );
2513
+ this.refreshEdgeColors(t);
2514
+ }
2515
+ /**
2516
+ * Create / refresh an ogma rule for node icons
2517
+ *
2518
+ * @param {Array<any>} iconStyleRules
2519
+ */
2520
+ refreshNodeIcons(e) {
2521
+ u.isDefined(this._ogmaNodeIcon) ? (this._nodeAttributes.refresh({ icon: e }), this._ogmaNodeIcon.refresh()) : (this._nodeAttributes.refresh({ icon: e }), this._ogmaNodeIcon = this._ogma.styles.addRule({
2522
+ nodeAttributes: {
2523
+ icon: (t) => {
2524
+ if (t !== void 0)
2525
+ return this._nodeAttributes.icon(t.getData()).icon;
2526
+ },
2527
+ image: (t) => {
2528
+ if (t !== void 0 && !t.isVirtual())
2529
+ return this._nodeAttributes.icon(t.getData()).image;
2530
+ }
2531
+ },
2532
+ nodeDependencies: { self: { data: !0 } }
2533
+ }));
2534
+ }
2535
+ /**
2536
+ * Create / refresh an ogma rule for node sizes
2537
+ *
2538
+ * @param {Array<any>} sizeStyleRules
2539
+ */
2540
+ refreshNodeSize(e) {
2541
+ u.isDefined(this._ogmaNodeSize) ? (this._nodeAttributes.refresh({ size: e }), this._ogmaNodeSize.refresh()) : (this._nodeAttributes.refresh({ size: e }), this._ogmaNodeSize = this._ogma.styles.addRule({
2542
+ nodeAttributes: {
2543
+ radius: (t) => {
2544
+ if (t !== void 0)
2545
+ return this._nodeAttributes.size(t.getData());
2546
+ }
2547
+ },
2548
+ nodeDependencies: { self: { data: !0 } }
2549
+ }));
2550
+ }
2551
+ /**
2552
+ * Create / refresh an ogma rule for node images
2553
+ *
2554
+ * @param {Array<any>} shapeStyleRules
2555
+ */
2556
+ refreshNodeShape(e) {
2557
+ u.isDefined(this._ogmaNodeShape) ? (this._nodeAttributes.refresh({ shape: e }), this._ogmaNodeShape.refresh()) : (this._nodeAttributes.refresh({ shape: e }), this._ogmaNodeShape = this._ogma.styles.addRule({
2558
+ nodeAttributes: {
2559
+ shape: (t) => {
2560
+ if (t !== void 0)
2561
+ return this._nodeAttributes.shape(t.getData());
2562
+ }
2563
+ },
2564
+ nodeSelector: (t) => t !== void 0 && !t.isVirtual(),
2565
+ nodeDependencies: { self: { data: !0 } }
2566
+ }));
2567
+ }
2568
+ /**
2569
+ * Create / refresh an ogma rule for edge colors
2570
+ */
2571
+ refreshEdgeColors(e) {
2572
+ u.isDefined(this._ogmaEdgeColor) ? (this._edgeAttributes.refresh({ color: e }), this._ogmaEdgeColor.refresh()) : (this._edgeAttributes.refresh({ color: e }), this._ogmaEdgeColor = this._ogma.styles.addRule({
2573
+ edgeAttributes: {
2574
+ color: (t) => {
2575
+ if (t !== void 0)
2576
+ return this._edgeAttributes.color(t.getData());
2577
+ }
2578
+ },
2579
+ edgeDependencies: { self: { data: !0 } }
2580
+ }));
2581
+ }
2582
+ /**
2583
+ * Create / refresh an ogma rule for edge width
2584
+ *
2585
+ * @param {Array<LKStyleRule>} widthStyleRules
2586
+ */
2587
+ refreshEdgeWidth(e) {
2588
+ u.isDefined(this._ogmaEdgeWidth) ? (this._edgeAttributes.refresh({ width: e }), this._ogmaEdgeWidth.refresh()) : (this._edgeAttributes.refresh({ width: e }), this._ogmaEdgeWidth = this._ogma.styles.addRule({
2589
+ edgeAttributes: {
2590
+ width: (t) => {
2591
+ if (t !== void 0)
2592
+ return this._edgeAttributes.width(t.getData());
2593
+ }
2594
+ },
2595
+ edgeDependencies: {
2596
+ self: { data: !0 }
2597
+ }
2598
+ }));
2599
+ }
2600
+ /**
2601
+ * Create / refresh an ogma rule for edge width
2602
+ *
2603
+ * @param {Array<LKStyleRule>} shapeStyleRules
2604
+ */
2605
+ refreshEdgeShape(e) {
2606
+ u.isDefined(this._ogmaEdgeShape) ? (this._edgeAttributes.refresh({ shape: e }), this._ogmaEdgeShape.refresh()) : (this._edgeAttributes.refresh({ shape: e }), this._ogmaEdgeShape = this._ogma.styles.addRule({
2607
+ edgeAttributes: {
2608
+ shape: (t) => {
2609
+ if (t !== void 0)
2610
+ return this._edgeAttributes.shape(t.getData());
2611
+ }
2612
+ },
2613
+ edgeDependencies: { self: { data: !0 } }
2614
+ }));
2615
+ }
2616
+ /**
2617
+ * Get node radius
2618
+ * This is a workaround for an ogma issue where the radius of virtual nodes is always set to 5
2619
+ * TODO: check if this is still needed after ogma release the new improvement for transformation v5.X
2620
+ */
2621
+ _getNodeRadius(e) {
2622
+ var t;
2623
+ if (e.isVirtual()) {
2624
+ const { width: i, height: n } = (t = e.getSubNodes()) == null ? void 0 : t.getBoundingBox();
2625
+ return Math.max(i, n);
2626
+ } else
2627
+ return e.getAttribute("radius");
2628
+ }
2629
+ /**
2630
+ * Calculate the scale of the pin badge related to the node radius
2631
+ * This is useful when dealing wih huge nodes, and we don't want the badge to be big
2632
+ * If the node is small enough, the badge will be 0.46 of the node radius
2633
+ * Else it will be 5 / radius
2634
+ */
2635
+ _findPinBadgeScale(e) {
2636
+ return this._getNodeRadius(e) * 0.46 > 5 ? 0.17 : 0.46;
2637
+ }
2638
+ /**
2639
+ * Find the color of the pin badge text
2640
+ */
2641
+ _findPinBadgeTextColor(e) {
2642
+ if (e.isVirtual())
2643
+ return ve;
2644
+ const t = Array.isArray(e.getAttribute("color")) ? e.getAttribute("color")[0] : e.getAttribute("color");
2645
+ return ne.isBright(t) ? Lt : ve;
2646
+ }
2647
+ /**
2648
+ * Find the color of the pin badge background
2649
+ */
2650
+ _findPinBadgeBackgroundColor(e) {
2651
+ return e.isVirtual() ? E : "inherit";
2652
+ }
2653
+ }
2654
+ class Ag {
2655
+ constructor(e, t, i) {
2656
+ this._nodeMaxTextLength = t, this._edgeMaxTextLength = i, this._captionSchema = { node: {}, edge: {} }, this._graphSchema = { node: [], edge: [] }, this._ogma = e;
2657
+ }
2658
+ set graphSchema(e) {
2659
+ this._graphSchema = e;
2660
+ }
2661
+ /**
2662
+ * Refresh the schema
2663
+ */
2664
+ refreshSchema(e) {
2665
+ this._captionSchema = e;
2666
+ }
2667
+ /**
2668
+ * Refresh visualization captions rules
2669
+ */
2670
+ async initVizCaptions(e) {
2671
+ 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);
2672
+ }
2673
+ /**
2674
+ * Create or update nodeCaptionRule
2675
+ */
2676
+ updateNodeCaptions(e) {
2677
+ if (e && (this._captionSchema.node = e), !u.isDefined(this.nodesCaptionsRule))
2678
+ this.nodesCaptionsRule = this._ogma.styles.addRule({
2679
+ nodeAttributes: {
2680
+ text: {
2681
+ content: (t) => {
2682
+ if (t === void 0)
2683
+ return "";
2684
+ const i = w.getText(
2685
+ t.getData(),
2686
+ this._captionSchema.node,
2687
+ this._graphSchema.node
2688
+ );
2689
+ return u.isDefined(this._nodeMaxTextLength) ? u.truncate(i, "middle", this._nodeMaxTextLength) : i;
2690
+ }
2691
+ }
2692
+ },
2693
+ // We ignore virtual nodes as they have their proper caption
2694
+ nodeSelector: (t) => !t.isVirtual(),
2695
+ nodeDependencies: { self: { data: !0 } }
2696
+ });
2697
+ else
2698
+ return this.nodesCaptionsRule.refresh();
2699
+ }
2700
+ /**
2701
+ * Create or update edgeCaptionRule
2702
+ */
2703
+ updateEdgeCaptions(e) {
2704
+ if (e && (this._captionSchema.edge = e), !u.isDefined(this.edgesCaptionsRule))
2705
+ this.edgesCaptionsRule = this._ogma.styles.addRule({
2706
+ edgeAttributes: {
2707
+ text: {
2708
+ content: (t) => {
2709
+ if (t === void 0 || t.getData() === void 0)
2710
+ return "";
2711
+ const i = w.getText(
2712
+ t.getData(),
2713
+ this._captionSchema.edge,
2714
+ this._graphSchema.edge
2715
+ );
2716
+ return u.isDefined(this._edgeMaxTextLength) ? u.truncate(i, "middle", this._edgeMaxTextLength) : i;
2717
+ }
2718
+ }
2719
+ },
2720
+ edgeSelector: (t) => !t.isVirtual(),
2721
+ // ogma will trigger the rendering if data change or the shape change (to trigger the rendering when edges are grouped)
2722
+ edgeDependencies: { self: { data: !0, attributes: ["shape.style"] } }
2723
+ });
2724
+ else
2725
+ return this.edgesCaptionsRule.refresh();
2726
+ }
2727
+ }
2728
+ function P(r) {
2729
+ return typeof r == "function";
2730
+ }
2731
+ function xg(r) {
2732
+ return P(r == null ? void 0 : r.lift);
2733
+ }
2734
+ function cr(r) {
2735
+ return function(e) {
2736
+ if (xg(e))
2737
+ return e.lift(function(t) {
2738
+ try {
2739
+ return r(t, this);
2740
+ } catch (i) {
2741
+ this.error(i);
2742
+ }
2743
+ });
2744
+ throw new TypeError("Unable to lift unknown Observable type");
2745
+ };
2746
+ }
2747
+ var Te = function(r, e) {
2748
+ return Te = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
2749
+ t.__proto__ = i;
2750
+ } || function(t, i) {
2751
+ for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
2752
+ }, Te(r, e);
2753
+ };
2754
+ function Ve(r, e) {
2755
+ if (typeof e != "function" && e !== null)
2756
+ throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
2757
+ Te(r, e);
2758
+ function t() {
2759
+ this.constructor = r;
2760
+ }
2761
+ r.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
2762
+ }
2763
+ function Mt(r) {
2764
+ var e = typeof Symbol == "function" && Symbol.iterator, t = e && r[e], i = 0;
2765
+ if (t) return t.call(r);
2766
+ if (r && typeof r.length == "number") return {
2767
+ next: function() {
2768
+ return r && i >= r.length && (r = void 0), { value: r && r[i++], done: !r };
2769
+ }
2770
+ };
2771
+ throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
2772
+ }
2773
+ function we(r, e) {
2774
+ var t = typeof Symbol == "function" && r[Symbol.iterator];
2775
+ if (!t) return r;
2776
+ var i = t.call(r), n, s = [], a;
2777
+ try {
2778
+ for (; (e === void 0 || e-- > 0) && !(n = i.next()).done; ) s.push(n.value);
2779
+ } catch (o) {
2780
+ a = { error: o };
2781
+ } finally {
2782
+ try {
2783
+ n && !n.done && (t = i.return) && t.call(i);
2784
+ } finally {
2785
+ if (a) throw a.error;
2786
+ }
2787
+ }
2788
+ return s;
2789
+ }
2790
+ function Ne(r, e, t) {
2791
+ if (t || arguments.length === 2) for (var i = 0, n = e.length, s; i < n; i++)
2792
+ (s || !(i in e)) && (s || (s = Array.prototype.slice.call(e, 0, i)), s[i] = e[i]);
2793
+ return r.concat(s || Array.prototype.slice.call(e));
2794
+ }
2795
+ function $g(r) {
2796
+ var e = function(i) {
2797
+ Error.call(i), i.stack = new Error().stack;
2798
+ }, t = r(e);
2799
+ return t.prototype = Object.create(Error.prototype), t.prototype.constructor = t, t;
2800
+ }
2801
+ var me = $g(function(r) {
2802
+ return function(t) {
2803
+ r(this), this.message = t ? t.length + ` errors occurred during unsubscription:
2804
+ ` + t.map(function(i, n) {
2805
+ return n + 1 + ") " + i.toString();
2806
+ }).join(`
2807
+ `) : "", this.name = "UnsubscriptionError", this.errors = t;
2808
+ };
2809
+ });
2810
+ function Rt(r, e) {
2811
+ if (r) {
2812
+ var t = r.indexOf(e);
2813
+ 0 <= t && r.splice(t, 1);
2814
+ }
2815
+ }
2816
+ var Ke = function() {
2817
+ function r(e) {
2818
+ this.initialTeardown = e, this.closed = !1, this._parentage = null, this._finalizers = null;
2819
+ }
2820
+ return r.prototype.unsubscribe = function() {
2821
+ var e, t, i, n, s;
2822
+ if (!this.closed) {
2823
+ this.closed = !0;
2824
+ var a = this._parentage;
2825
+ if (a)
2826
+ if (this._parentage = null, Array.isArray(a))
2827
+ try {
2828
+ for (var o = Mt(a), l = o.next(); !l.done; l = o.next()) {
2829
+ var c = l.value;
2830
+ c.remove(this);
2831
+ }
2832
+ } catch (f) {
2833
+ e = { error: f };
2834
+ } finally {
2835
+ try {
2836
+ l && !l.done && (t = o.return) && t.call(o);
2837
+ } finally {
2838
+ if (e) throw e.error;
2839
+ }
2840
+ }
2841
+ else
2842
+ a.remove(this);
2843
+ var d = this.initialTeardown;
2844
+ if (P(d))
2845
+ try {
2846
+ d();
2847
+ } catch (f) {
2848
+ s = f instanceof me ? f.errors : [f];
2849
+ }
2850
+ var g = this._finalizers;
2851
+ if (g) {
2852
+ this._finalizers = null;
2853
+ try {
2854
+ for (var h = Mt(g), y = h.next(); !y.done; y = h.next()) {
2855
+ var _ = y.value;
2856
+ try {
2857
+ Bt(_);
2858
+ } catch (f) {
2859
+ s = s ?? [], f instanceof me ? s = Ne(Ne([], we(s)), we(f.errors)) : s.push(f);
2860
+ }
2861
+ }
2862
+ } catch (f) {
2863
+ i = { error: f };
2864
+ } finally {
2865
+ try {
2866
+ y && !y.done && (n = h.return) && n.call(h);
2867
+ } finally {
2868
+ if (i) throw i.error;
2869
+ }
2870
+ }
2871
+ }
2872
+ if (s)
2873
+ throw new me(s);
2874
+ }
2875
+ }, r.prototype.add = function(e) {
2876
+ var t;
2877
+ if (e && e !== this)
2878
+ if (this.closed)
2879
+ Bt(e);
2880
+ else {
2881
+ if (e instanceof r) {
2882
+ if (e.closed || e._hasParent(this))
2883
+ return;
2884
+ e._addParent(this);
2885
+ }
2886
+ (this._finalizers = (t = this._finalizers) !== null && t !== void 0 ? t : []).push(e);
2887
+ }
2888
+ }, r.prototype._hasParent = function(e) {
2889
+ var t = this._parentage;
2890
+ return t === e || Array.isArray(t) && t.includes(e);
2891
+ }, r.prototype._addParent = function(e) {
2892
+ var t = this._parentage;
2893
+ this._parentage = Array.isArray(t) ? (t.push(e), t) : t ? [t, e] : e;
2894
+ }, r.prototype._removeParent = function(e) {
2895
+ var t = this._parentage;
2896
+ t === e ? this._parentage = null : Array.isArray(t) && Rt(t, e);
2897
+ }, r.prototype.remove = function(e) {
2898
+ var t = this._finalizers;
2899
+ t && Rt(t, e), e instanceof r && e._removeParent(this);
2900
+ }, r.EMPTY = function() {
2901
+ var e = new r();
2902
+ return e.closed = !0, e;
2903
+ }(), r;
2904
+ }();
2905
+ Ke.EMPTY;
2906
+ function Eg(r) {
2907
+ return r instanceof Ke || r && "closed" in r && P(r.remove) && P(r.add) && P(r.unsubscribe);
2908
+ }
2909
+ function Bt(r) {
2910
+ P(r) ? r() : r.unsubscribe();
2911
+ }
2912
+ var Fg = {
2913
+ useDeprecatedNextContext: !1
2914
+ }, Tg = {
2915
+ setTimeout: function(r, e) {
2916
+ for (var t = [], i = 2; i < arguments.length; i++)
2917
+ t[i - 2] = arguments[i];
2918
+ return setTimeout.apply(void 0, Ne([r, e], we(t)));
2919
+ },
2920
+ clearTimeout: function(r) {
2921
+ return clearTimeout(r);
2922
+ },
2923
+ delegate: void 0
2924
+ };
2925
+ function wg(r) {
2926
+ Tg.setTimeout(function() {
2927
+ throw r;
2928
+ });
2929
+ }
2930
+ function zt() {
2931
+ }
2932
+ var dr = function(r) {
2933
+ Ve(e, r);
2934
+ function e(t) {
2935
+ var i = r.call(this) || this;
2936
+ return i.isStopped = !1, t ? (i.destination = t, Eg(t) && t.add(i)) : i.destination = Ig, i;
2937
+ }
2938
+ return e.create = function(t, i, n) {
2939
+ return new Og(t, i, n);
2940
+ }, e.prototype.next = function(t) {
2941
+ this.isStopped || this._next(t);
2942
+ }, e.prototype.error = function(t) {
2943
+ this.isStopped || (this.isStopped = !0, this._error(t));
2944
+ }, e.prototype.complete = function() {
2945
+ this.isStopped || (this.isStopped = !0, this._complete());
2946
+ }, e.prototype.unsubscribe = function() {
2947
+ this.closed || (this.isStopped = !0, r.prototype.unsubscribe.call(this), this.destination = null);
2948
+ }, e.prototype._next = function(t) {
2949
+ this.destination.next(t);
2950
+ }, e.prototype._error = function(t) {
2951
+ try {
2952
+ this.destination.error(t);
2953
+ } finally {
2954
+ this.unsubscribe();
2955
+ }
2956
+ }, e.prototype._complete = function() {
2957
+ try {
2958
+ this.destination.complete();
2959
+ } finally {
2960
+ this.unsubscribe();
2961
+ }
2962
+ }, e;
2963
+ }(Ke), Ng = Function.prototype.bind;
2964
+ function _e(r, e) {
2965
+ return Ng.call(r, e);
2966
+ }
2967
+ var Dg = function() {
2968
+ function r(e) {
2969
+ this.partialObserver = e;
2970
+ }
2971
+ return r.prototype.next = function(e) {
2972
+ var t = this.partialObserver;
2973
+ if (t.next)
2974
+ try {
2975
+ t.next(e);
2976
+ } catch (i) {
2977
+ ee(i);
2978
+ }
2979
+ }, r.prototype.error = function(e) {
2980
+ var t = this.partialObserver;
2981
+ if (t.error)
2982
+ try {
2983
+ t.error(e);
2984
+ } catch (i) {
2985
+ ee(i);
2986
+ }
2987
+ else
2988
+ ee(e);
2989
+ }, r.prototype.complete = function() {
2990
+ var e = this.partialObserver;
2991
+ if (e.complete)
2992
+ try {
2993
+ e.complete();
2994
+ } catch (t) {
2995
+ ee(t);
2996
+ }
2997
+ }, r;
2998
+ }(), Og = function(r) {
2999
+ Ve(e, r);
3000
+ function e(t, i, n) {
3001
+ var s = r.call(this) || this, a;
3002
+ if (P(t) || !t)
3003
+ a = {
3004
+ next: t ?? void 0,
3005
+ error: i ?? void 0,
3006
+ complete: n ?? void 0
3007
+ };
3008
+ else {
3009
+ var o;
3010
+ s && Fg.useDeprecatedNextContext ? (o = Object.create(t), o.unsubscribe = function() {
3011
+ return s.unsubscribe();
3012
+ }, a = {
3013
+ next: t.next && _e(t.next, o),
3014
+ error: t.error && _e(t.error, o),
3015
+ complete: t.complete && _e(t.complete, o)
3016
+ }) : a = t;
3017
+ }
3018
+ return s.destination = new Dg(a), s;
3019
+ }
3020
+ return e;
3021
+ }(dr);
3022
+ function ee(r) {
3023
+ wg(r);
3024
+ }
3025
+ function Lg(r) {
3026
+ throw r;
3027
+ }
3028
+ var Ig = {
3029
+ closed: !0,
3030
+ next: zt,
3031
+ error: Lg,
3032
+ complete: zt
3033
+ };
3034
+ function Pg(r) {
3035
+ return r;
3036
+ }
3037
+ function gr(r, e, t, i, n) {
3038
+ return new Mg(r, e, t, i, n);
3039
+ }
3040
+ var Mg = function(r) {
3041
+ Ve(e, r);
3042
+ function e(t, i, n, s, a, o) {
3043
+ var l = r.call(this, t) || this;
3044
+ return l.onFinalize = a, l.shouldUnsubscribe = o, l._next = i ? function(c) {
3045
+ try {
3046
+ i(c);
3047
+ } catch (d) {
3048
+ t.error(d);
3049
+ }
3050
+ } : r.prototype._next, l._error = s ? function(c) {
3051
+ try {
3052
+ s(c);
3053
+ } catch (d) {
3054
+ t.error(d);
3055
+ } finally {
3056
+ this.unsubscribe();
3057
+ }
3058
+ } : r.prototype._error, l._complete = n ? function() {
3059
+ try {
3060
+ n();
3061
+ } catch (c) {
3062
+ t.error(c);
3063
+ } finally {
3064
+ this.unsubscribe();
3065
+ }
3066
+ } : r.prototype._complete, l;
3067
+ }
3068
+ return e.prototype.unsubscribe = function() {
3069
+ var t;
3070
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
3071
+ var i = this.closed;
3072
+ r.prototype.unsubscribe.call(this), !i && ((t = this.onFinalize) === null || t === void 0 || t.call(this));
3073
+ }
3074
+ }, e;
3075
+ }(dr);
3076
+ function Rg(r, e) {
3077
+ return cr(function(t, i) {
3078
+ var n = 0;
3079
+ t.subscribe(gr(i, function(s) {
3080
+ i.next(r.call(e, s, n++));
3081
+ }));
3082
+ });
3083
+ }
3084
+ function Bg(r, e) {
3085
+ return e === void 0 && (e = Pg), r = r ?? zg, cr(function(t, i) {
3086
+ var n, s = !0;
3087
+ t.subscribe(gr(i, function(a) {
3088
+ var o = e(a);
3089
+ (s || !r(n, o)) && (s = !1, n = o, i.next(a));
3090
+ }));
3091
+ });
3092
+ }
3093
+ function zg(r, e) {
3094
+ return r === e;
3095
+ }
3096
+ class Gg extends mr {
3097
+ constructor(e) {
3098
+ super(e);
3099
+ }
3100
+ /**
3101
+ * Modify Ogma state based on a method
3102
+ */
3103
+ dispatch(e) {
3104
+ this.next(e(this.value));
3105
+ }
3106
+ /**
3107
+ * Return a piece of state
3108
+ */
3109
+ selectStore(e) {
3110
+ return this.pipe(
3111
+ Rg(e),
3112
+ Bg((t, i) => u.isEqual(t, i))
3113
+ );
3114
+ }
3115
+ /**
3116
+ * Clear the state of Ogma
3117
+ */
3118
+ clear() {
3119
+ this.next({
3120
+ selection: new hr(),
3121
+ items: { node: [], edge: [] },
3122
+ changes: void 0,
3123
+ animation: !1
3124
+ });
3125
+ }
3126
+ }
3127
+ class Ug {
3128
+ constructor(e) {
3129
+ this._store = new Gg({
3130
+ selection: new hr(),
3131
+ items: { node: [], edge: [] },
3132
+ changes: void 0,
3133
+ animation: !1
3134
+ }), this._ogma = e, this.listenToSelectionEvents();
3135
+ }
3136
+ get store() {
3137
+ return this._store;
3138
+ }
3139
+ /**
3140
+ * Listen to ogma events and update the state
3141
+ */
3142
+ listenToSelectionEvents() {
3143
+ let e = Date.now(), t = !1;
3144
+ this._ogma.events.on("animate", (i) => {
3145
+ if (i.updatesPositions === !1)
3146
+ return;
3147
+ t || (t = !0, this._store.dispatch((a) => ({ ...a, animation: !0 })));
3148
+ const n = Math.max(e, Date.now() + i.duration);
3149
+ if (n === e)
3150
+ return;
3151
+ e = n;
3152
+ const s = e - Date.now() + 16;
3153
+ clearTimeout(this._animationThrottle), this._animationThrottle = setTimeout(() => {
3154
+ t = !1, this._store.dispatch((a) => ({ ...a, animation: !1 }));
3155
+ }, s);
3156
+ }), this._ogma.events.on("dragStart", () => {
3157
+ this._store.dispatch((i) => ({ ...i, animation: !0 }));
3158
+ }), this._ogma.events.on("dragEnd", () => {
3159
+ this._store.dispatch((i) => ({ ...i, animation: !1 }));
3160
+ }), this._ogma.events.on("addNodes", () => {
3161
+ this._store.dispatch(this.storeItems.bind(this));
3162
+ }), this._ogma.events.on("removeNodes", () => {
3163
+ this._store.dispatch(this.storeItems.bind(this));
3164
+ }), this._ogma.events.on("addEdges", () => {
3165
+ this._store.dispatch(this.storeItems.bind(this));
3166
+ }), this._ogma.events.on("removeEdges", () => {
3167
+ this._store.dispatch(this.storeItems.bind(this));
3168
+ }), this._ogma.events.on("nodesSelected", () => {
3169
+ this._store.dispatch(this.storeNodeSelection.bind(this));
3170
+ }), this._ogma.events.on("edgesSelected", () => {
3171
+ this._store.dispatch(this.storeEdgeSelection.bind(this));
3172
+ }), this._ogma.events.on("nodesUnselected", () => {
3173
+ this._store.dispatch(this.storeNodeSelection.bind(this));
3174
+ }), this._ogma.events.on("edgesUnselected", () => {
3175
+ this._store.dispatch(this.storeEdgeSelection.bind(this));
3176
+ }), this._ogma.events.on("updateNodeData", (i) => {
3177
+ i !== void 0 && i.changes.forEach((n) => {
3178
+ this._store.dispatch((s) => ({
3179
+ ...s,
3180
+ changes: {
3181
+ entityType: "node",
3182
+ input: n.property,
3183
+ value: n.newValues[0]
3184
+ }
3185
+ }));
3186
+ });
3187
+ }), this._ogma.events.on("updateEdgeData", (i) => {
3188
+ i !== void 0 && i.changes.forEach((n) => {
3189
+ this._store.dispatch((s) => ({
3190
+ ...s,
3191
+ changes: {
3192
+ entityType: "edge",
3193
+ input: n.property,
3194
+ value: n.newValues[0]
3195
+ }
3196
+ }));
3197
+ });
3198
+ });
3199
+ }
3200
+ /**
3201
+ * Store new items in state
3202
+ */
3203
+ storeItems(e) {
3204
+ return {
3205
+ ...e,
3206
+ items: {
3207
+ node: this._ogma.getNodes().getId(),
3208
+ edge: this._ogma.getEdges().getId()
3209
+ }
3210
+ };
3211
+ }
3212
+ /**
3213
+ * Store new node selection in state
3214
+ */
3215
+ storeNodeSelection(e) {
3216
+ return {
3217
+ ...e,
3218
+ selection: this._ogma.getSelectedNodes()
3219
+ };
3220
+ }
3221
+ /**
3222
+ * store new edge selection in state
3223
+ */
3224
+ storeEdgeSelection(e) {
3225
+ return {
3226
+ ...e,
3227
+ selection: this._ogma.getSelectedEdges()
3228
+ };
3229
+ }
3230
+ }
3231
+ class hr {
3232
+ constructor() {
3233
+ this.size = 0, this.isNode = !0;
3234
+ }
3235
+ }
3236
+ const jg = 750, kg = {
3237
+ steps: 40,
3238
+ alignSiblings: !0,
3239
+ charge: 5,
3240
+ theta: 0.34,
3241
+ duration: jg
3242
+ };
3243
+ class Xg extends vr {
3244
+ constructor(e, t) {
3245
+ super(e), this._configuration = e, Object.setPrototypeOf(this, new.target.prototype), this.initOgmaLinkuriousParser(!0, t);
3246
+ }
3247
+ /**
3248
+ * Initialize the Ogma instance with the configuration and the base url
3249
+ * @param init used to know if the instance is initialized for the first time (used in setConfigOgma)
3250
+ * @param baseUrl base url used for relative image urls
3251
+ * @private
3252
+ */
3253
+ initOgmaLinkuriousParser(e, t) {
3254
+ this.nodeCategoriesWatcher = this.schema.watchNodeNonObjectProperty({
3255
+ path: "categories",
3256
+ unwindArrays: !0,
3257
+ filter: "all"
3258
+ }), this.edgeTypeWatcher = this.schema.watchEdgeNonObjectProperty({
3259
+ path: "type",
3260
+ filter: "all"
3261
+ }), this.setOptions({
3262
+ interactions: {
3263
+ zoom: {
3264
+ maxValue: (i) => 128 / i.smallestNodeSize
3265
+ },
3266
+ selection: {
3267
+ enabled: !1
3268
+ }
3269
+ }
3270
+ }), 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();
3271
+ }
3272
+ /**
3273
+ * Initialize selection behavior
3274
+ */
3275
+ initSelection() {
3276
+ this.events.onClick((e) => {
3277
+ if (e !== void 0 && e.button === "left")
3278
+ if (e.target !== null) {
3279
+ const t = navigator.platform === "MacIntel" ? "cmd" : "ctrl";
3280
+ 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));
3281
+ } else
3282
+ this.getSelectedNodes().setSelected(!1), this.getSelectedEdges().setSelected(!1);
3283
+ });
3284
+ }
3285
+ setStyles(e, t) {
3286
+ var i, n, s, a;
3287
+ this.LKStyles = new Sg(this, {
3288
+ node: ((n = (i = e == null ? void 0 : e.options) == null ? void 0 : i.styles) == null ? void 0 : n.node) || {},
3289
+ edge: ((a = (s = e == null ? void 0 : e.options) == null ? void 0 : s.styles) == null ? void 0 : a.edge) || {},
3290
+ baseUrl: t
3291
+ }), this.LKStyles.setNodesDefaultStyles(), this.LKStyles.setEdgesDefaultStyles();
3292
+ }
3293
+ setCaptions(e) {
3294
+ var n, s, a, o, l, c, d, g;
3295
+ 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;
3296
+ this.LKCaptions = new Ag(this, t, i);
3297
+ }
3298
+ /**
3299
+ * Returns Ogma Layout parameters according to visualization layout settings
3300
+ * */
3301
+ getForceLayoutParams(e, t = 0) {
3302
+ let i = 300 - 0.052 * this.getNodes().size;
3303
+ return i < 40 && (i = 40), {
3304
+ steps: e === yr.FAST ? i : 300,
3305
+ alignSiblings: this.getNodes().size > 3,
3306
+ duration: t,
3307
+ charge: 20,
3308
+ gravity: 0.08,
3309
+ theta: this.getNodes().size > 100 ? 0.8 : 0.34
3310
+ };
3311
+ }
3312
+ getRadialLayoutParams(e, t = 0) {
3313
+ return {
3314
+ centralNode: e,
3315
+ radiusDelta: 1,
3316
+ nodeGap: 10,
3317
+ repulsion: this.getNodes().size > 80 ? 1 : 6,
3318
+ duration: t
3319
+ };
3320
+ }
3321
+ getHierarchicalLayoutParams(e, t, i = 0) {
3322
+ return {
3323
+ direction: e,
3324
+ roots: [t],
3325
+ duration: i
3326
+ };
3327
+ }
3328
+ /**
3329
+ * Initialize graph.
3330
+ * add nodes and edges to the viz and init the selection.
3331
+ */
3332
+ async init(e) {
3333
+ this.clearGraph();
3334
+ let t, i = [];
3335
+ const n = e.nodes.map((a) => (a.attributes.selected && (t = I.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 === I.NODE) && (t = I.EDGE, i = []), i.push(a.id)), delete a.attributes.selected), a));
3336
+ await this.addGraphAfterValidation({
3337
+ nodes: n,
3338
+ edges: s
3339
+ }), t === I.NODE ? this.getNodes(i).setSelected(!0) : t === I.EDGE && this.getEdges(i).setSelected(!0);
3340
+ }
3341
+ async initVisualization(e) {
3342
+ await this.init(e);
3343
+ const t = p.sanitizeStylesIndex(e.design.styles);
3344
+ 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({
3345
+ node: e.nodeFields.captions || {},
3346
+ edge: e.edgeFields.captions || {}
3347
+ }), this.LKTransformation.groupedEdges = e.edgeGrouping, await this.LKTransformation.initTransformation(), this.LKTransformation.initEdgeGroupingStyle();
3348
+ }
3349
+ /**
3350
+ * Adding nodes then adding edges to the graph
3351
+ */
3352
+ async addGraphAfterValidation(e) {
3353
+ const t = await this.addNodes(e.nodes), i = await this.addEdges(e.edges);
3354
+ return {
3355
+ nodes: t,
3356
+ edges: i
3357
+ };
3358
+ }
3359
+ /**
3360
+ * Adding edges to the graph after filtering disconnected ones
3361
+ */
3362
+ addEdges(e, t) {
3363
+ return super.addEdges(e, { ...t, ignoreInvalid: !0 });
3364
+ }
3365
+ /**
3366
+ * Return the list of non filtered nodes
3367
+ */
3368
+ getNonFilteredNodes(e) {
3369
+ return u.isDefined(e) ? this.getNodes(e).filter((t) => !t.hasClass("filtered")) : (
3370
+ // take only none virtual nodes
3371
+ this.getNodes("raw").filter((t) => !t.hasClass("filtered"))
3372
+ );
3373
+ }
3374
+ /**
3375
+ * Return the list of filtered nodes
3376
+ * @param items items to check if they are filtered
3377
+ * @param filter type of nodes to check if they are filtered ( nodes that are visible, raw nodes (none virtual) or all nodes)
3378
+ */
3379
+ getFilteredNodes(e, t = "raw") {
3380
+ return u.isDefined(e) ? this.getNodes(e).filter((i) => i.hasClass("filtered")) : this.getNodes(t).filter((i) => i.hasClass("filtered"));
3381
+ }
3382
+ /**
3383
+ * Return the list of non filtered edges
3384
+ */
3385
+ getNonFilteredEdges(e) {
3386
+ return u.isDefined(e) ? this.getEdges(e).filter((t) => !t.hasClass("filtered")) : this.getEdges("raw").filter((t) => !t.hasClass("filtered"));
3387
+ }
3388
+ /**
3389
+ * Return the list of filtered edges
3390
+ */
3391
+ getFilteredEdges(e, t = "raw") {
3392
+ return u.isDefined(e) ? this.getEdges(e).filter((i) => i.hasClass("filtered")) : this.getEdges(t).filter((i) => i.hasClass("filtered"));
3393
+ }
3394
+ /**
3395
+ * Do a full reset on ogma and streams of ogma
3396
+ */
3397
+ shutDown() {
3398
+ this.destroy(), this.store && this.store.clear();
3399
+ }
3400
+ /**
3401
+ * Reset the Ogma instance so that it can be used fresh in the next visulization
3402
+ */
3403
+ clearOgmaState() {
3404
+ this.reset(), this.store && this.store.clear(), this.initOgmaLinkuriousParser();
3405
+ }
3406
+ /**
3407
+ * Updates the Ogma config when config changes in LKE. If init, options were already set by the Ogma.reset()
3408
+ */
3409
+ setConfigOgma(e, t, i) {
3410
+ e && (this._configuration = e), t || this.setOptions({
3411
+ ...this._configuration.options,
3412
+ renderer: this._configuration.renderer
3413
+ }), this.setStyles(this._configuration, i), this.setCaptions(this._configuration);
3414
+ }
3415
+ }
3416
+ const Ce = {
3417
+ lightsalmon: { hex: "#FFA07A", rgb: "rbg(255,160,122)" },
3418
+ salmon: { hex: "#FA8072", rgb: "rgb(250,128,114)" },
3419
+ darksalmon: { hex: "#E9967A", rgb: "rgb(233,150,122)" },
3420
+ lightcoral: { hex: "#F08080", rgb: "rgb(240,128,128)" },
3421
+ indianred: { hex: "#CD5C5C", rgb: "rgb(205,92,92)" },
3422
+ crimson: { hex: "#DC143C", rgb: "rgb(220,20,60)" },
3423
+ firebrick: { hex: "#B22222", rgb: "rgb(178,34,34)" },
3424
+ red: { hex: "#FF0000", rgb: "rgb(255,0,0)" },
3425
+ darkred: { hex: "#8B0000", rgb: "rgb(139,0,0)" },
3426
+ coral: { hex: "#FF7F50", rgb: "rgb(255,127,80)" },
3427
+ tomato: { hex: "#FF6347", rgb: "rgb(255,99,71)" },
3428
+ orangered: { hex: "#FF4500", rgb: "rgb(255,69,0)" },
3429
+ gold: { hex: "#FFD700", rgb: "rgb(255,215,0)" },
3430
+ orange: { hex: "#FFA500", rgb: "rgb(255,165,0)" },
3431
+ darkorange: { hex: "#FF8C00", rgb: "rgb(255,140,0)" },
3432
+ lightyellow: { hex: "#FFFFE0", rgb: "rgb(255,255,224)" },
3433
+ lemonchiffon: { hex: "#FFFACD", rgb: "rgb(255,250,205)" },
3434
+ lightgoldenrodyellow: { hex: "#FAFAD2", rgb: "rgb(250,250,210)" },
3435
+ papayawhip: { hex: "#FFEFD5", rgb: "rgb(255,239,213)" },
3436
+ moccasin: { hex: "#FFE4B5", rgb: "rgb(255,228,181)" },
3437
+ peachpuff: { hex: "#FFDAB9", rgb: "rgb(255,218,185)" },
3438
+ palegoldenrod: { hex: "#EEE8AA", rgb: "rgb(238,232,170)" },
3439
+ khaki: { hex: "#F0E68C", rgb: "rgb(240,230,140)" },
3440
+ darkkhaki: { hex: "#BDB76B", rgb: "rgb(189,183,107)" },
3441
+ yellow: { hex: "#FFFF00", rgb: "rgb(255,255,0)" },
3442
+ lawngreen: { hex: "#7CFC00", rgb: "rgb(124,252,0)" },
3443
+ chartreuse: { hex: "#7FFF00", rgb: "rgb(127,255,0)" },
3444
+ limegreen: { hex: "#32CD32", rgb: "rgb(50,205,50)" },
3445
+ lime: { hex: "#00FF00", rgb: "rgb(0.255.0)" },
3446
+ forestgreen: { hex: "#228B22", rgb: "rgb(34,139,34)" },
3447
+ green: { hex: "#008000", rgb: "rgb(0,128,0)" },
3448
+ darkgreen: { hex: "#006400", rgb: "rgb(0,100,0)" },
3449
+ greenyellow: { hex: "#ADFF2F", rgb: "rgb(173,255,47)" },
3450
+ yellowgreen: { hex: "#9ACD32", rgb: "rgb(154,205,50)" },
3451
+ springgreen: { hex: "#00FF7F", rgb: "rgb(0,255,127)" },
3452
+ mediumspringgreen: { hex: "#00FA9A", rgb: "rgb(0,250,154)" },
3453
+ lightgreen: { hex: "#90EE90", rgb: "rgb(144,238,144)" },
3454
+ palegreen: { hex: "#98FB98", rgb: "rgb(152,251,152)" },
3455
+ darkseagreen: { hex: "#8FBC8F", rgb: "rgb(143,188,143)" },
3456
+ mediumseagreen: { hex: "#3CB371", rgb: "rgb(60,179,113)" },
3457
+ seagreen: { hex: "#2E8B57", rgb: "rgb(46,139,87)" },
3458
+ olive: { hex: "#808000", rgb: "rgb(128,128,0)" },
3459
+ darkolivegreen: { hex: "#556B2F", rgb: "rgb(85,107,47)" },
3460
+ olivedrab: { hex: "#6B8E23", rgb: "rgb(107,142,35)" },
3461
+ lightcyan: { hex: "#E0FFFF", rgb: "rgb(224,255,255)" },
3462
+ cyan: { hex: "#00FFFF", rgb: "rgb(0,255,255)" },
3463
+ aqua: { hex: "#00FFFF", rgb: "rgb(0,255,255)" },
3464
+ aquamarine: { hex: "#7FFFD4", rgb: "rgb(127,255,212)" },
3465
+ mediumaquamarine: { hex: "#66CDAA", rgb: "rgb(102,205,170)" },
3466
+ paleturquoise: { hex: "#AFEEEE", rgb: "rgb(175,238,238)" },
3467
+ turquoise: { hex: "#40E0D0", rgb: "rgb(64,224,208)" },
3468
+ mediumturquoise: { hex: "#48D1CC", rgb: "rgb(72,209,204)" },
3469
+ darkturquoise: { hex: "#00CED1", rgb: "rgb(0,206,209)" },
3470
+ lightseagreen: { hex: "#20B2AA", rgb: "rgb(32,178,170)" },
3471
+ cadetblue: { hex: "#5F9EA0", rgb: "rgb(95,158,160)" },
3472
+ darkcyan: { hex: "#008B8B", rgb: "rgb(0,139,139)" },
3473
+ teal: { hex: "#008080", rgb: "rgb(0,128,128)" },
3474
+ powderblue: { hex: "#B0E0E6", rgb: "rgb(176,224,230)" },
3475
+ lightblue: { hex: "#ADD8E6", rgb: "rgb(173,216,230)" },
3476
+ lightskyblue: { hex: "#87CEFA", rgb: "rgb(135,206,250)" },
3477
+ skyblue: { hex: "#87CEEB", rgb: "rgb(135,206,235)" },
3478
+ deepskyblue: { hex: "#00BFFF", rgb: "rgb(0,191,255)" },
3479
+ lightsteelblue: { hex: "#B0C4DE", rgb: "rgb(176,196,222)" },
3480
+ dodgerblue: { hex: "#1E90FF", rgb: "rgb(30,144,255)" },
3481
+ cornflowerblue: { hex: "#6495ED", rgb: "rgb(100,149,237)" },
3482
+ steelblue: { hex: "#4682B4", rgb: "rgb(70,130,180)" },
3483
+ royalblue: { hex: "#4169E1", rgb: "rgb(65,105,225)" },
3484
+ blue: { hex: "#0000FF", rgb: "rgb(0,0,255)" },
3485
+ mediumblue: { hex: "#0000CD", rgb: "rgb(0,0,205)" },
3486
+ darkblue: { hex: "#00008B", rgb: "rgb(0,0,139)" },
3487
+ navy: { hex: "#000080", rgb: "rgb(0,0,128)" },
3488
+ midnightblue: { hex: "#191970", rgb: "rgb(25,25,112)" },
3489
+ mediumslateblue: { hex: "#7B68EE", rgb: "rgb(123,104,238)" },
3490
+ slateblue: { hex: "#6A5ACD", rgb: "rgb(106,90,205)" },
3491
+ darkslateblue: { hex: "#483D8B", rgb: "rgb(72,61,139)" },
3492
+ lavender: { hex: "#E6E6FA", rgb: "rgb(230,230,250)" },
3493
+ thistle: { hex: "#D8BFD8", rgb: "rgb(216,191,216)" },
3494
+ plum: { hex: "#DDA0DD", rgb: "rgb(221,160,221)" },
3495
+ violet: { hex: "#EE82EE", rgb: "rgb(238,130,238)" },
3496
+ orchid: { hex: "#DA70D6", rgb: "rgb(218,112,214)" },
3497
+ fuchsia: { hex: "#FF00FF", rgb: "rgb(255,0,255)" },
3498
+ magenta: { hex: "#FF00FF", rgb: "rgb(255,0,255)" },
3499
+ mediumorchid: { hex: "#BA55D3", rgb: "rgb(186,85,211)" },
3500
+ mediumpurple: { hex: "#9370DB", rgb: "rgb(147,112,219)" },
3501
+ blueviolet: { hex: "#8A2BE2", rgb: "rgb(138,43,226)" },
3502
+ darkviolet: { hex: "#9400D3", rgb: "rgb(148,0,211)" },
3503
+ darkorchid: { hex: "#9932CC", rgb: "rgb(153,50,204)" },
3504
+ darkmagenta: { hex: "#8B008B", rgb: "rgb(139,0,139)" },
3505
+ purple: { hex: "#800080", rgb: "rgb(128,0,128)" },
3506
+ indigo: { hex: "#4B0082", rgb: "rgb(75,0,130)" },
3507
+ pink: { hex: "#FFC0CB", rgb: "rgb(255,192,203)" },
3508
+ lightpink: { hex: "#FFB6C1", rgb: "rgb(255,182,193)" },
3509
+ hotpink: { hex: "#FF69B4", rgb: "rgb(255,105,180)" },
3510
+ deeppink: { hex: "#FF1493", rgb: "rgb(255,20,147)" },
3511
+ palevioletred: { hex: "#DB7093", rgb: "rgb(219,112,147)" },
3512
+ mediumvioletred: { hex: "#C71585", rgb: "rgb(199,21,133)" },
3513
+ white: { hex: "#FFFFFF", rgb: "rgb(255,255,255)" },
3514
+ snow: { hex: "#FFFAFA", rgb: "rgb(255,250,250)" },
3515
+ honeydew: { hex: "#F0FFF0", rgb: "rgb(240,255,240)" },
3516
+ mintcream: { hex: "#F5FFFA", rgb: "rgb(245,255,250)" },
3517
+ azure: { hex: "#F0FFFF", rgb: "rgb(240,255,255)" },
3518
+ aliceblue: { hex: "#F0F8FF", rgb: "rgb(240,248,255)" },
3519
+ ghostwhite: { hex: "#F8F8FF", rgb: "rgb(248,248,255)" },
3520
+ whitesmoke: { hex: "#F5F5F5", rgb: "rgb(245,245,245)" },
3521
+ seashell: { hex: "#FFF5EE", rgb: "rgb(255,245,238)" },
3522
+ beige: { hex: "#F5F5DC", rgb: "rgb(245,245,220)" },
3523
+ oldlace: { hex: "#FDF5E6", rgb: "rgb(253,245,230)" },
3524
+ floralwhite: { hex: "#FFFAF0", rgb: "rgb(255,250,240)" },
3525
+ ivory: { hex: "#FFFFF0", rgb: "rgb(255,255,240)" },
3526
+ antiquewhite: { hex: "#FAEBD7", rgb: "rgb(250,235,215)" },
3527
+ linen: { hex: "#FAF0E6", rgb: "rgb(250,240,230)" },
3528
+ lavenderblush: { hex: "#FFF0F5", rgb: "rgb(255,240,245)" },
3529
+ mistyrose: { hex: "#FFE4E1", rgb: "rgb(255,228,225)" },
3530
+ gainsboro: { hex: "#DCDCDC", rgb: "rgb(220,220,220)" },
3531
+ lightgray: { hex: "#D3D3D3", rgb: "rgb(211,211,211)" },
3532
+ silver: { hex: "#C0C0C0", rgb: "rgb(192,192,192)" },
3533
+ darkgray: { hex: "#A9A9A9", rgb: "rgb(169,169,169)" },
3534
+ gray: { hex: "#808080", rgb: "rgb(128,128,128)" },
3535
+ dimgray: { hex: "#696969", rgb: "rgb(105,105,105)" },
3536
+ lightslategray: { hex: "#778899", rgb: "rgb(119,136,153)" },
3537
+ slategray: { hex: "#708090", rgb: "rgb(112,128,144)" },
3538
+ darkslategray: { hex: "#2F4F4F", rgb: "rgb(47,79,79)" },
3539
+ black: { hex: "#000000", rgb: "rgb(0,0,0)" },
3540
+ cornsilk: { hex: "#FFF8DC", rgb: "rgb(255,248,220)" },
3541
+ blanchedalmond: { hex: "#FFEBCD", rgb: "rgb(255,235,205)" },
3542
+ bisque: { hex: "#FFE4C4", rgb: "rgb(255,228,196)" },
3543
+ navajowhite: { hex: "#FFDEAD", rgb: "rgb(255,222,173)" },
3544
+ wheat: { hex: "#F5DEB3", rgb: "rgb(245,222,179)" },
3545
+ burlywood: { hex: "#DEB887", rgb: "rgb(222,184,135)" },
3546
+ tan: { hex: "#D2B48C", rgb: "rgb(210,180,140)" },
3547
+ rosybrown: { hex: "#BC8F8F", rgb: "rgb(188,143,143)" },
3548
+ sandybrown: { hex: "#F4A460", rgb: "rgb(244,164,96)" },
3549
+ goldenrod: { hex: "#DAA520", rgb: "rgb(218,165,32)" },
3550
+ peru: { hex: "#CD853F", rgb: "rgb(205,133,63)" },
3551
+ chocolate: { hex: "#D2691E", rgb: "rgb(210,105,30)" },
3552
+ saddlebrown: { hex: "#8B4513", rgb: "rgb(139,69,19)" },
3553
+ sienna: { hex: "#A0522D", rgb: "rgb(160,82,45)" },
3554
+ brown: { hex: "#A52A2A", rgb: "rgb(165,42,42)" },
3555
+ maroon: { hex: "#800000", rgb: "rgb(128,0,0)" }
3556
+ };
3557
+ class ne {
3558
+ /**
3559
+ * Get the amount of hidden neighbors from a list of nodes
3560
+ *
3561
+ * @param nodes
3562
+ */
3563
+ static getHiddenNeighbors(e) {
3564
+ return e.reduce((t, i) => {
3565
+ const n = i.getData("statistics");
3566
+ if (n !== void 0) {
3567
+ const s = n.degree !== void 0 && !n.supernode ? n.degree - u.getDegreeWithoutSelfConnection(i) : n.supernodeDegree;
3568
+ if (s !== void 0 && s > 0)
3569
+ return t += s;
3570
+ }
3571
+ return t;
3572
+ }, 0);
3573
+ }
3574
+ /**
3575
+ * Return the visible degree of a node without self connection (self edge)
3576
+ *
3577
+ * @param {Node} node
3578
+ * @return {number}
3579
+ */
3580
+ static getDegreeWithoutSelfConnection(e) {
3581
+ return e.getAdjacentNodes({ policy: "exclude-sources", filter: "all" }).size;
3582
+ }
3583
+ /**
3584
+ * Return true if the color tone is "bright"
3585
+ *
3586
+ * @param {string} color
3587
+ * @returns {boolean}
3588
+ */
3589
+ static isBright(e) {
3590
+ if (e === null || !u.isStringFilled(e))
3591
+ return !0;
3592
+ 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;
3593
+ let s;
3594
+ if (t.test(e)) {
3595
+ e.length < 5 && (e += e.slice(1)), e = e.replace("#", "");
3596
+ 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);
3597
+ s = `rgb(${c}, ${d}, ${g})`;
3598
+ } else if (i.test(e) || n.test(e) || Ce[e.toLowerCase()] !== void 0)
3599
+ s = u.isDefined(Ce[e.toLowerCase()]) ? Ce[e.toLowerCase()].rgb : e;
3600
+ else
3601
+ return !0;
3602
+ 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);
3603
+ 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;
3604
+ }
3605
+ static isNode(e) {
3606
+ return e.isNode;
3607
+ }
3608
+ static isNodeList(e) {
3609
+ return e.isNode;
3610
+ }
3611
+ static topologicalSort(e) {
3612
+ let i = e.toArray().find((a) => a.getDegree() === 1);
3613
+ const n = /* @__PURE__ */ new Set(), s = [];
3614
+ for (; i; ) {
3615
+ s.push(i), n.add(i);
3616
+ const a = i.getAdjacentNodes().filter((o) => !n.has(o)).get(0);
3617
+ i = a === void 0 ? null : a;
3618
+ }
3619
+ return s.map((a) => a.getId());
3620
+ }
3621
+ static isStar(e) {
3622
+ for (const t of e.toArray()) {
3623
+ const i = t.getAdjacentNodes();
3624
+ if (t.getDegree() > 2 && i.getDegree().every((s) => s === 1) && i.size + 1 === e.size) return t;
3625
+ }
3626
+ return !1;
3627
+ }
3628
+ }
3629
+ const De = "LKE_NODE_GROUPING_EDGE", Hg = "LKE_NODE_GROUPING_NODE";
3630
+ class Vg {
3631
+ constructor(e) {
3632
+ this._ogma = e;
3633
+ }
3634
+ /**
3635
+ * Set the grouping rule
3636
+ * @param rule of grouping
3637
+ */
3638
+ setGroupingRule(e) {
3639
+ this.groupRule = e;
3640
+ }
3641
+ /**
3642
+ * create a node grouping transformation
3643
+ * It uses groupRule to define the rule
3644
+ * Group the nodes based on a category type and a property value
3645
+ */
3646
+ async initTransformation() {
3647
+ this.transformation === void 0 ? this.transformation = this._ogma.transformations.addNodeGrouping({
3648
+ groupIdFunction: (e) => {
3649
+ var t;
3650
+ if (!this._isRuleNotApplicableToNode(e)) {
3651
+ const i = this._findGroupingPropertyValue(e);
3652
+ return `${(t = this.groupRule) == null ? void 0 : t.groupingOptions.itemTypes.join("-")}-${i}`.toLowerCase().trim();
3653
+ }
3654
+ },
3655
+ nodeGenerator: (e) => ({
3656
+ data: {
3657
+ categories: [Hg],
3658
+ properties: {},
3659
+ nodeGroupId: this._findNodeGroupId(e)
3660
+ }
3661
+ }),
3662
+ edgeGenerator: () => ({
3663
+ data: {
3664
+ type: De
3665
+ }
3666
+ }),
3667
+ showContents: !0,
3668
+ padding: 10
3669
+ }) : await this.refreshTransformation();
3670
+ }
3671
+ /**
3672
+ * refresh the transformation
3673
+ * Called when there is a change in the rule
3674
+ */
3675
+ async refreshTransformation() {
3676
+ this.transformation !== void 0 ? (await this.transformation.refresh(), await this._unpinNodes(this._getAllTransformationRawNodes())) : await this.initTransformation();
3677
+ }
3678
+ /**
3679
+ * init node grouping style
3680
+ */
3681
+ initNodeGroupingStyle() {
3682
+ this.nodeGroupingStyleRule = this._ogma.styles.addRule({
3683
+ nodeAttributes: {
3684
+ // Any default style will go here
3685
+ text: {
3686
+ content: (e) => this._getNodeGroupingCaption(e),
3687
+ style: "bold"
3688
+ },
3689
+ layer: -1,
3690
+ color: "rgba(240, 240, 240)",
3691
+ innerStroke: {
3692
+ color: "#7f7f7f",
3693
+ width: 2
3694
+ }
3695
+ },
3696
+ nodeSelector: (e) => e.isVirtual() && u.isDefined(e.getSubNodes()),
3697
+ // the style will be updated when data object is updated
3698
+ nodeDependencies: { self: { data: !0 } }
3699
+ });
3700
+ }
3701
+ async refreshNodeGroupingStyle() {
3702
+ var e;
3703
+ await ((e = this.nodeGroupingStyleRule) == null ? void 0 : e.refresh());
3704
+ }
3705
+ /**
3706
+ * run layout on all subnodes of virtual nodes
3707
+ */
3708
+ async runLayoutOnAllSubNodes() {
3709
+ await this._ogma.transformations.afterNextUpdate();
3710
+ const e = this._getAllTransformationRawNodes(), t = [];
3711
+ for (let i = 0; i < e.length; i++) {
3712
+ const n = e[i];
3713
+ t.push(this.runSubNodesLayout(n));
3714
+ }
3715
+ await Promise.all(t);
3716
+ }
3717
+ /**
3718
+ * Run the layout on the subnodes of the virtual node
3719
+ * @param subNodes nodes part of a virtual node
3720
+ */
3721
+ async runSubNodesLayout(e) {
3722
+ if (e.size === 0 || e.size === 1)
3723
+ return;
3724
+ if (e.size === 2) {
3725
+ await this._runTwoNodesLayout(e);
3726
+ return;
3727
+ }
3728
+ if (e.getAdjacentEdges({ bothExtremities: !0 }).size === 0) return this._runCirclePack(e);
3729
+ const i = this.isStar(e);
3730
+ if (i) {
3731
+ const s = e.filter((l) => l !== i), a = this._runCircularLayout({
3732
+ radii: s.getAttribute("radius"),
3733
+ cx: i.getAttribute("x"),
3734
+ cy: i.getAttribute("y"),
3735
+ clockwise: !1,
3736
+ distanceRatio: 5
3737
+ });
3738
+ await i.toList().concat(s).setAttributes([i.getPosition(), ...a]);
3739
+ return;
3740
+ }
3741
+ if (e.getDegree().every((s) => s > 0 && s <= 2)) {
3742
+ await this._runChainLayout(e);
3743
+ return;
3744
+ }
3745
+ return await this._runForceLayout(e);
3746
+ }
3747
+ /**
3748
+ * Get the virtual nodes of the transformation
3749
+ * @private
3750
+ */
3751
+ getVirtualNodesOfTransformation() {
3752
+ return this.transformation.getContext().metaNodes;
3753
+ }
3754
+ /**
3755
+ * Set the node group pin
3756
+ * @param nodeGroups object containing the node group id and the layoutable attribute
3757
+ */
3758
+ async setNodeGroupPin(e) {
3759
+ this._ogma.getNodes().filter((t) => t.isVirtual()).forEach((t) => {
3760
+ const i = e.find(
3761
+ (n) => n.id === t.getData("nodeGroupId")
3762
+ );
3763
+ i !== void 0 && t.setAttribute("layoutable", i.attributes.layoutable ?? !1);
3764
+ });
3765
+ }
3766
+ /**
3767
+ * Return the caption of a virtual node
3768
+ * @param node reference to the virtual node
3769
+ */
3770
+ _getNodeGroupingCaption(e) {
3771
+ var t;
3772
+ if (e !== void 0 && e.isVirtual() && ((t = e.getSubNodes()) == null ? void 0 : t.get(0)) !== void 0) {
3773
+ 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;
3774
+ return `${n} (${s})`;
3775
+ }
3776
+ }
3777
+ /**
3778
+ * Run the circle pack layout on the subnodes
3779
+ * @param subNodes
3780
+ */
3781
+ async _runCirclePack(e) {
3782
+ await this._ogma.algorithms.circlePack({
3783
+ nodes: e,
3784
+ margin: 10,
3785
+ sort: "asc"
3786
+ });
3787
+ }
3788
+ async _runChainLayout(e) {
3789
+ const t = this._ogma.getNodes(ne.topologicalSort(e));
3790
+ await this._ogma.layouts.grid({
3791
+ nodes: t,
3792
+ // TODO: test that visually
3793
+ colDistance: Math.max(...e.getAttribute("radius").map(Number)) * 4,
3794
+ rows: 1
3795
+ });
3796
+ }
3797
+ async _runForceLayout(e) {
3798
+ await this._ogma.layouts.force({
3799
+ nodes: e,
3800
+ ...kg
3801
+ });
3802
+ }
3803
+ _isRuleNotApplicableToNode(e) {
3804
+ var i;
3805
+ const t = e.getData([
3806
+ "properties",
3807
+ ((i = this.groupRule) == null ? void 0 : i.groupingOptions.propertyKey) ?? ""
3808
+ ]);
3809
+ return (
3810
+ // if the group rule is not defined
3811
+ this.groupRule === void 0 || // if rule is applied to a different category
3812
+ this.groupRule.groupingOptions.itemTypes.every(
3813
+ (n) => !e.getData("categories").includes(n)
3814
+ ) || // if the property value is not defined
3815
+ !u.isDefined(t) || // if the property value is missing
3816
+ typeof t == "object" && t.status === "missing"
3817
+ );
3818
+ }
3819
+ /**
3820
+ * Unpin list of nodes
3821
+ * @param nodes
3822
+ * @private
3823
+ */
3824
+ async _unpinNodes(e) {
3825
+ await Promise.all(
3826
+ e.map((t) => {
3827
+ if (t !== null)
3828
+ return t.setAttribute("layoutable", !0);
3829
+ })
3830
+ );
3831
+ }
3832
+ /**
3833
+ * Get all the raw nodes part of the transformation
3834
+ * @private
3835
+ */
3836
+ _getAllTransformationRawNodes() {
3837
+ return this.getVirtualNodesOfTransformation().getSubNodes();
3838
+ }
3839
+ _findGroupingPropertyValue(e) {
3840
+ var i;
3841
+ const t = e.getData([
3842
+ "properties",
3843
+ ((i = this.groupRule) == null ? void 0 : i.groupingOptions.propertyKey) ?? ""
3844
+ ]);
3845
+ return `${u.getValueFromLkProperty(t)}`;
3846
+ }
3847
+ /**
3848
+ * Return a hashed string that represents the group id
3849
+ */
3850
+ _findNodeGroupId(e) {
3851
+ var i, n;
3852
+ const t = this._findGroupingPropertyValue(e.get(0));
3853
+ return He(
3854
+ `${(i = this.groupRule) == null ? void 0 : i.name}-${(n = this.groupRule) == null ? void 0 : n.groupingOptions.itemTypes.join(
3855
+ "-"
3856
+ )}-${t}`
3857
+ );
3858
+ }
3859
+ _runCircularLayout({
3860
+ radii: e,
3861
+ clockwise: t = !0,
3862
+ cx: i = 0,
3863
+ cy: n = 0,
3864
+ startAngle: s = 3 / 2 * Math.PI,
3865
+ getRadius: a = (l) => Number(l),
3866
+ distanceRatio: o = 0
3867
+ }) {
3868
+ const l = e.length;
3869
+ if (l === 0) return [];
3870
+ if (l === 1) return [{ x: i, y: n }];
3871
+ 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);
3872
+ return e.map((A, x) => {
3873
+ const $ = s + x * g * (t ? 1 : -1), R = f * Math.cos($), v = f * Math.sin($);
3874
+ return {
3875
+ x: i + R,
3876
+ y: n + v
3877
+ };
3878
+ });
3879
+ }
3880
+ async _runTwoNodesLayout(e) {
3881
+ const t = e.getAttribute("radius").map(Number), i = e.getPosition(), n = Math.min(...t);
3882
+ await e.setAttributes([
3883
+ i[0],
3884
+ { x: i[0].x + n + t[0] + t[1], y: i[0].y }
3885
+ ]);
3886
+ }
3887
+ isStar(e) {
3888
+ for (const t of e.getId()) {
3889
+ const i = this._ogma.getNode(t), n = i.getAdjacentNodes();
3890
+ if (i.getDegree() > 2 && n.getDegree().every((a) => a === 1) && n.size + 1 === e.size) return i;
3891
+ }
3892
+ return !1;
3893
+ }
3894
+ }
3895
+ const Kg = {
3896
+ color: "#000000",
3897
+ shape: {
3898
+ style: "dashed",
3899
+ head: "arrow"
3900
+ },
3901
+ width: 1.5
3902
+ };
3903
+ class qg {
3904
+ constructor(e) {
3905
+ this._ogma = e, this.groupedEdges = {};
3906
+ }
3907
+ /**
3908
+ * create an edge grouping transformation by edge type
3909
+ */
3910
+ async initTransformation() {
3911
+ this.transformation === void 0 ? this.transformation = this._ogma.transformations.addEdgeGrouping({
3912
+ separateEdgesByDirection: !0,
3913
+ selector: (e) => this.groupedEdges[e.getData("type")],
3914
+ groupIdFunction: (e) => e.getData("type"),
3915
+ generator: (e) => ({
3916
+ data: {
3917
+ properties: {
3918
+ originalType: e.getData("type")[0]
3919
+ }
3920
+ }
3921
+ })
3922
+ }) : await this.transformation.refresh();
3923
+ }
3924
+ /**
3925
+ * init edge grouping style
3926
+ */
3927
+ initEdgeGroupingStyle() {
3928
+ this.edgeGroupingStyleRule = this._ogma.styles.addRule({
3929
+ edgeAttributes: {
3930
+ ...Kg,
3931
+ ...this.edgeGroupStyle,
3932
+ text: {
3933
+ content: (e) => {
3934
+ if (e !== void 0 && e.getSubEdges() !== null && e.getData("type") !== De) {
3935
+ const t = e.getSubEdges().filter((i) => !i.hasClass("filtered")).size;
3936
+ return `${e.getData(["properties", "originalType"])} (${t})`;
3937
+ }
3938
+ },
3939
+ style: "bold"
3940
+ }
3941
+ },
3942
+ edgeSelector: (e) => e.isVirtual() && e.getSubEdges() && e.getSubEdges().filter((t) => !t.hasClass("filtered")).size > 0 && e.getData("type") !== De,
3943
+ edgeDependencies: { self: { data: !0 } }
3944
+ });
3945
+ }
3946
+ refreshEdgeGroupingStyle() {
3947
+ this.edgeGroupingStyleRule !== void 0 && this.edgeGroupingStyleRule.refresh();
3948
+ }
3949
+ }
3950
+ const m = class m {
3951
+ /**
3952
+ * Returns whether the node/edge should be *filtered* (a.k.a. *hidden*).
3953
+ *
3954
+ * Notes:
3955
+ * 1. `filterRules` are rules that match what should be filtered/hidden.
3956
+ * 2. `filterRules` are combined inclusively: as soon as one rule returns `true` for
3957
+ * an item, the item can be hidden/filtered.
3958
+ *
3959
+ * @param filterRules
3960
+ * @param itemData
3961
+ */
3962
+ static isFiltered(e, t) {
3963
+ return u.isDefined(t) ? "categories" in t ? m.getFilterFunction(e, !0)(t) : m.getFilterFunction(e, !1)(t) : !1;
3964
+ }
3965
+ static getFilterFunction(e, t) {
3966
+ const i = JSON.stringify(e, null, ""), n = t ? m.nodeCache : m.edgeCache;
3967
+ let s = n.get(i);
3968
+ return s || (s = m.createFilterFunction(e, t), n.size > m.FILTER_CACHE_SIZE && n.clear(), n.set(i, s)), s;
3969
+ }
3970
+ static createFilterFunction(e, t) {
3971
+ const i = e.map(
3972
+ (n) => m.filterToFilterFunction(n, t)
3973
+ );
3974
+ return (n) => {
3975
+ for (const s of i)
3976
+ if (s(n))
3977
+ return !0;
3978
+ return !1;
3979
+ };
3980
+ }
3981
+ static filterToFilterFunction(e, t) {
3982
+ switch (e.type) {
3983
+ case S.ANY:
3984
+ return m.createAnyFilterFunction(e, t);
3985
+ case S.IS:
3986
+ return m.createIsFilterFunction(e, t);
3987
+ case S.NO_VALUE:
3988
+ return m.createNoValueFilterFunction(e, t);
3989
+ case S.RANGE:
3990
+ return m.createRangeFilterFunction(e, t);
3991
+ case S.NAN:
3992
+ return m.createNaNFilterFunction(e, t);
3993
+ }
3994
+ }
3995
+ static createAnyFilterFunction(e, t) {
3996
+ return t ? (i) => e.itemType === void 0 ? !0 : i.categories.includes(e.itemType) : (i) => i.type === e.itemType;
3997
+ }
3998
+ static createIsFilterFunction(e, t) {
3999
+ 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;
4000
+ }
4001
+ static createNoValueFilterFunction(e, t) {
4002
+ 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));
4003
+ }
4004
+ static createNaNFilterFunction(e, t) {
4005
+ 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));
4006
+ }
4007
+ static isNotANumber(e) {
4008
+ return u.isDefined(e) && !u.isNumber(e);
4009
+ }
4010
+ static createRangeFilterFunction(e, t) {
4011
+ return t ? (i) => i.categories.includes(e.itemType) && m.valueShouldBeHidden(
4012
+ u.getPropertyValue(u.getIn(i, e.input), !1),
4013
+ e.value
4014
+ ) : (i) => i.type === e.itemType && m.valueShouldBeHidden(
4015
+ u.getPropertyValue(u.getIn(i, e.input), !1),
4016
+ e.value
4017
+ );
4018
+ }
4019
+ /**
4020
+ * Returns true if `value` should be filtered/hidden.
4021
+ *
4022
+ * `range` describes what should be filtered/hidden:
4023
+ * - e.g. {"<":10, ">=":20} => hide any value in ]-inf, 10[ *OR* in [20, +inf[
4024
+ * - e.g. {"<=":10} => hide any value in ]-inf, 10]
4025
+ * - e.g. {">=":20} => hide any value in [20, +inf[
4026
+ *
4027
+ * Returns false (i.e. will not filter/hide) if `value` is not a number.
4028
+ */
4029
+ static valueShouldBeHidden(e, t) {
4030
+ const i = u.parseFloat(e);
4031
+ 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[">="];
4032
+ }
4033
+ };
4034
+ m.nodeCache = /* @__PURE__ */ new Map(), m.edgeCache = /* @__PURE__ */ new Map(), m.FILTER_CACHE_SIZE = 5;
4035
+ let Gt = m;
4036
+ const Qg = (r) => r.selection.size, eh = (r) => {
4037
+ switch (r.selection.size) {
4038
+ case 1:
4039
+ return "selection";
4040
+ case 0:
4041
+ return "noSelection";
4042
+ default:
4043
+ return "multiSelection";
4044
+ }
4045
+ }, th = (r) => {
4046
+ if (r.selection.size !== 0)
4047
+ return r.selection.isNode ? I.NODE : I.EDGE;
4048
+ }, qe = (r) => r.selection.size === 1 ? r.selection.get(0) : void 0, rh = (r) => {
4049
+ const e = qe(r);
4050
+ if (e !== void 0)
4051
+ return e.isNode ? e.getData("categories") : [e.getData("type")];
4052
+ }, ih = (r) => {
4053
+ const e = qe(r);
4054
+ if (e !== void 0)
4055
+ return e.isNode ? "node" : "edge";
4056
+ }, Wg = (r) => {
4057
+ const e = qe(r);
4058
+ if (e !== void 0) {
4059
+ const t = e.getData().properties;
4060
+ return Object.keys(t).map((i) => ({
4061
+ key: i,
4062
+ value: t[i]
4063
+ }));
4064
+ }
4065
+ return [];
4066
+ }, nh = (r) => Wg(r).length > 0;
4067
+ export {
4068
+ jg as ANIMATION_DURATION,
4069
+ E as BASE_GREY,
4070
+ w as Captions,
4071
+ Ag as CaptionsViz,
4072
+ W as EdgeAttributes,
4073
+ Pt as FILTER_OPACITY,
4074
+ Gt as Filters,
4075
+ Ce as HTML_COLORS,
4076
+ F as ItemAttributes,
4077
+ De as LKE_NODE_GROUPING_EDGE,
4078
+ Xg as LKOgma,
4079
+ U as NodeAttributes,
4080
+ Gg as OgmaStore,
4081
+ ne as OgmaTools,
4082
+ Nt as PALETTE,
4083
+ C as StyleRule,
4084
+ vg as StyleRuleType,
4085
+ p as StyleRules,
4086
+ D as StyleType,
4087
+ Sg as StylesViz,
4088
+ u as Tools,
4089
+ qg as TransformationsViz,
4090
+ th as getSelectionEntity,
4091
+ Wg as getSelectionProperties,
4092
+ Qg as getSelectionSize,
4093
+ eh as getSelectionState,
4094
+ qe as getUniqSelection,
4095
+ ih as getUniqSelectionEntity,
4096
+ rh as getUniqSelectionTypes,
4097
+ nh as hasSelectionProperties
4098
+ };
4099
+ //# sourceMappingURL=index.mjs.map