UNPKG

757 kBJavaScriptView Raw
1import { d as yp, c as nn, l as qr, j as ei, t as mp, aA as bp, aB as Ep, aC as wp } from "./mermaid-9357f3d0.js";
2import { c as xp } from "./createText-8ca1146d.js";
3import { c as Ca, g as Tp } from "./_commonjsHelpers-10dfc225.js";
4var Ki = function() {
5 var he = function(j, Y, te, L) {
6 for (te = te || {}, L = j.length; L--; te[j[L]] = Y)
7 ;
8 return te;
9 }, fe = [1, 4], ee = [1, 13], ve = [1, 12], H = [1, 15], O = [1, 16], T = [1, 20], x = [1, 19], S = [6, 7, 8], G = [1, 26], U = [1, 24], P = [1, 25], K = [6, 7, 11], D = [1, 6, 13, 15, 16, 19, 22], V = [1, 33], _ = [1, 34], Q = [1, 6, 7, 11, 13, 15, 16, 19, 22], ne = {
10 trace: function() {
11 },
12 yy: {},
13 symbols_: { error: 2, start: 3, mindMap: 4, spaceLines: 5, SPACELINE: 6, NL: 7, MINDMAP: 8, document: 9, stop: 10, EOF: 11, statement: 12, SPACELIST: 13, node: 14, ICON: 15, CLASS: 16, nodeWithId: 17, nodeWithoutId: 18, NODE_DSTART: 19, NODE_DESCR: 20, NODE_DEND: 21, NODE_ID: 22, $accept: 0, $end: 1 },
14 terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" },
15 productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]],
16 performAction: function(Y, te, L, $, k, q, ce) {
17 var pe = q.length - 1;
18 switch (k) {
19 case 6:
20 case 7:
21 return $;
22 case 8:
23 $.getLogger().trace("Stop NL ");
24 break;
25 case 9:
26 $.getLogger().trace("Stop EOF ");
27 break;
28 case 11:
29 $.getLogger().trace("Stop NL2 ");
30 break;
31 case 12:
32 $.getLogger().trace("Stop EOF2 ");
33 break;
34 case 15:
35 $.getLogger().info("Node: ", q[pe].id), $.addNode(q[pe - 1].length, q[pe].id, q[pe].descr, q[pe].type);
36 break;
37 case 16:
38 $.getLogger().trace("Icon: ", q[pe]), $.decorateNode({ icon: q[pe] });
39 break;
40 case 17:
41 case 21:
42 $.decorateNode({ class: q[pe] });
43 break;
44 case 18:
45 $.getLogger().trace("SPACELIST");
46 break;
47 case 19:
48 $.getLogger().trace("Node: ", q[pe].id), $.addNode(0, q[pe].id, q[pe].descr, q[pe].type);
49 break;
50 case 20:
51 $.decorateNode({ icon: q[pe] });
52 break;
53 case 25:
54 $.getLogger().trace("node found ..", q[pe - 2]), this.$ = { id: q[pe - 1], descr: q[pe - 1], type: $.getType(q[pe - 2], q[pe]) };
55 break;
56 case 26:
57 this.$ = { id: q[pe], descr: q[pe], type: $.nodeType.DEFAULT };
58 break;
59 case 27:
60 $.getLogger().trace("node found ..", q[pe - 3]), this.$ = { id: q[pe - 3], descr: q[pe - 1], type: $.getType(q[pe - 2], q[pe]) };
61 break;
62 }
63 },
64 table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: fe }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: fe }, { 6: ee, 7: [1, 10], 9: 9, 12: 11, 13: ve, 14: 14, 15: H, 16: O, 17: 17, 18: 18, 19: T, 22: x }, he(S, [2, 3]), { 1: [2, 2] }, he(S, [2, 4]), he(S, [2, 5]), { 1: [2, 6], 6: ee, 12: 21, 13: ve, 14: 14, 15: H, 16: O, 17: 17, 18: 18, 19: T, 22: x }, { 6: ee, 9: 22, 12: 11, 13: ve, 14: 14, 15: H, 16: O, 17: 17, 18: 18, 19: T, 22: x }, { 6: G, 7: U, 10: 23, 11: P }, he(K, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: T, 22: x }), he(K, [2, 18]), he(K, [2, 19]), he(K, [2, 20]), he(K, [2, 21]), he(K, [2, 23]), he(K, [2, 24]), he(K, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: G, 7: U, 10: 32, 11: P }, { 1: [2, 7], 6: ee, 12: 21, 13: ve, 14: 14, 15: H, 16: O, 17: 17, 18: 18, 19: T, 22: x }, he(D, [2, 14], { 7: V, 11: _ }), he(Q, [2, 8]), he(Q, [2, 9]), he(Q, [2, 10]), he(K, [2, 15]), he(K, [2, 16]), he(K, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, he(D, [2, 13], { 7: V, 11: _ }), he(Q, [2, 11]), he(Q, [2, 12]), { 21: [1, 37] }, he(K, [2, 25]), he(K, [2, 27])],
65 defaultActions: { 2: [2, 1], 6: [2, 2] },
66 parseError: function(Y, te) {
67 if (te.recoverable)
68 this.trace(Y);
69 else {
70 var L = new Error(Y);
71 throw L.hash = te, L;
72 }
73 },
74 parse: function(Y) {
75 var te = this, L = [0], $ = [], k = [null], q = [], ce = this.table, pe = "", Ae = 0, Ne = 0, _e = 2, tt = 1, ct = q.slice.call(arguments, 1), Pe = Object.create(this.lexer), $e = { yy: {} };
76 for (var Xe in this.yy)
77 Object.prototype.hasOwnProperty.call(this.yy, Xe) && ($e.yy[Xe] = this.yy[Xe]);
78 Pe.setInput(Y, $e.yy), $e.yy.lexer = Pe, $e.yy.parser = this, typeof Pe.yylloc > "u" && (Pe.yylloc = {});
79 var rt = Pe.yylloc;
80 q.push(rt);
81 var lt = Pe.options && Pe.options.ranges;
82 typeof $e.yy.parseError == "function" ? this.parseError = $e.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
83 function nt() {
84 var jt;
85 return jt = $.pop() || Pe.lex() || tt, typeof jt != "number" && (jt instanceof Array && ($ = jt, jt = $.pop()), jt = te.symbols_[jt] || jt), jt;
86 }
87 for (var je, pt, Et, kt, vt = {}, vr, qt, on, Kr; ; ) {
88 if (pt = L[L.length - 1], this.defaultActions[pt] ? Et = this.defaultActions[pt] : ((je === null || typeof je > "u") && (je = nt()), Et = ce[pt] && ce[pt][je]), typeof Et > "u" || !Et.length || !Et[0]) {
89 var Da = "";
90 Kr = [];
91 for (vr in ce[pt])
92 this.terminals_[vr] && vr > _e && Kr.push("'" + this.terminals_[vr] + "'");
93 Pe.showPosition ? Da = "Parse error on line " + (Ae + 1) + `:
94` + Pe.showPosition() + `
95Expecting ` + Kr.join(", ") + ", got '" + (this.terminals_[je] || je) + "'" : Da = "Parse error on line " + (Ae + 1) + ": Unexpected " + (je == tt ? "end of input" : "'" + (this.terminals_[je] || je) + "'"), this.parseError(Da, {
96 text: Pe.match,
97 token: this.terminals_[je] || je,
98 line: Pe.yylineno,
99 loc: rt,
100 expected: Kr
101 });
102 }
103 if (Et[0] instanceof Array && Et.length > 1)
104 throw new Error("Parse Error: multiple actions possible at state: " + pt + ", token: " + je);
105 switch (Et[0]) {
106 case 1:
107 L.push(je), k.push(Pe.yytext), q.push(Pe.yylloc), L.push(Et[1]), je = null, Ne = Pe.yyleng, pe = Pe.yytext, Ae = Pe.yylineno, rt = Pe.yylloc;
108 break;
109 case 2:
110 if (qt = this.productions_[Et[1]][1], vt.$ = k[k.length - qt], vt._$ = {
111 first_line: q[q.length - (qt || 1)].first_line,
112 last_line: q[q.length - 1].last_line,
113 first_column: q[q.length - (qt || 1)].first_column,
114 last_column: q[q.length - 1].last_column
115 }, lt && (vt._$.range = [
116 q[q.length - (qt || 1)].range[0],
117 q[q.length - 1].range[1]
118 ]), kt = this.performAction.apply(vt, [
119 pe,
120 Ne,
121 Ae,
122 $e.yy,
123 Et[1],
124 k,
125 q
126 ].concat(ct)), typeof kt < "u")
127 return kt;
128 qt && (L = L.slice(0, -1 * qt * 2), k = k.slice(0, -1 * qt), q = q.slice(0, -1 * qt)), L.push(this.productions_[Et[1]][0]), k.push(vt.$), q.push(vt._$), on = ce[L[L.length - 2]][L[L.length - 1]], L.push(on);
129 break;
130 case 3:
131 return !0;
132 }
133 }
134 return !0;
135 }
136 }, ue = function() {
137 var j = {
138 EOF: 1,
139 parseError: function(te, L) {
140 if (this.yy.parser)
141 this.yy.parser.parseError(te, L);
142 else
143 throw new Error(te);
144 },
145 // resets the lexer, sets new input
146 setInput: function(Y, te) {
147 return this.yy = te || this.yy || {}, this._input = Y, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
148 first_line: 1,
149 first_column: 0,
150 last_line: 1,
151 last_column: 0
152 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
153 },
154 // consumes and returns one char from the input
155 input: function() {
156 var Y = this._input[0];
157 this.yytext += Y, this.yyleng++, this.offset++, this.match += Y, this.matched += Y;
158 var te = Y.match(/(?:\r\n?|\n).*/g);
159 return te ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), Y;
160 },
161 // unshifts one char (or a string) into the input
162 unput: function(Y) {
163 var te = Y.length, L = Y.split(/(?:\r\n?|\n)/g);
164 this._input = Y + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - te), this.offset -= te;
165 var $ = this.match.split(/(?:\r\n?|\n)/g);
166 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), L.length - 1 && (this.yylineno -= L.length - 1);
167 var k = this.yylloc.range;
168 return this.yylloc = {
169 first_line: this.yylloc.first_line,
170 last_line: this.yylineno + 1,
171 first_column: this.yylloc.first_column,
172 last_column: L ? (L.length === $.length ? this.yylloc.first_column : 0) + $[$.length - L.length].length - L[0].length : this.yylloc.first_column - te
173 }, this.options.ranges && (this.yylloc.range = [k[0], k[0] + this.yyleng - te]), this.yyleng = this.yytext.length, this;
174 },
175 // When called from action, caches matched text and appends it on next action
176 more: function() {
177 return this._more = !0, this;
178 },
179 // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
180 reject: function() {
181 if (this.options.backtrack_lexer)
182 this._backtrack = !0;
183 else
184 return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
185` + this.showPosition(), {
186 text: "",
187 token: null,
188 line: this.yylineno
189 });
190 return this;
191 },
192 // retain first n characters of the match
193 less: function(Y) {
194 this.unput(this.match.slice(Y));
195 },
196 // displays already matched input, i.e. for error messages
197 pastInput: function() {
198 var Y = this.matched.substr(0, this.matched.length - this.match.length);
199 return (Y.length > 20 ? "..." : "") + Y.substr(-20).replace(/\n/g, "");
200 },
201 // displays upcoming input, i.e. for error messages
202 upcomingInput: function() {
203 var Y = this.match;
204 return Y.length < 20 && (Y += this._input.substr(0, 20 - Y.length)), (Y.substr(0, 20) + (Y.length > 20 ? "..." : "")).replace(/\n/g, "");
205 },
206 // displays the character position where the lexing error occurred, i.e. for error messages
207 showPosition: function() {
208 var Y = this.pastInput(), te = new Array(Y.length + 1).join("-");
209 return Y + this.upcomingInput() + `
210` + te + "^";
211 },
212 // test the lexed token: return FALSE when not a match, otherwise return token
213 test_match: function(Y, te) {
214 var L, $, k;
215 if (this.options.backtrack_lexer && (k = {
216 yylineno: this.yylineno,
217 yylloc: {
218 first_line: this.yylloc.first_line,
219 last_line: this.last_line,
220 first_column: this.yylloc.first_column,
221 last_column: this.yylloc.last_column
222 },
223 yytext: this.yytext,
224 match: this.match,
225 matches: this.matches,
226 matched: this.matched,
227 yyleng: this.yyleng,
228 offset: this.offset,
229 _more: this._more,
230 _input: this._input,
231 yy: this.yy,
232 conditionStack: this.conditionStack.slice(0),
233 done: this.done
234 }, this.options.ranges && (k.yylloc.range = this.yylloc.range.slice(0))), $ = Y[0].match(/(?:\r\n?|\n).*/g), $ && (this.yylineno += $.length), this.yylloc = {
235 first_line: this.yylloc.last_line,
236 last_line: this.yylineno + 1,
237 first_column: this.yylloc.last_column,
238 last_column: $ ? $[$.length - 1].length - $[$.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + Y[0].length
239 }, this.yytext += Y[0], this.match += Y[0], this.matches = Y, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(Y[0].length), this.matched += Y[0], L = this.performAction.call(this, this.yy, this, te, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), L)
240 return L;
241 if (this._backtrack) {
242 for (var q in k)
243 this[q] = k[q];
244 return !1;
245 }
246 return !1;
247 },
248 // return next match in input
249 next: function() {
250 if (this.done)
251 return this.EOF;
252 this._input || (this.done = !0);
253 var Y, te, L, $;
254 this._more || (this.yytext = "", this.match = "");
255 for (var k = this._currentRules(), q = 0; q < k.length; q++)
256 if (L = this._input.match(this.rules[k[q]]), L && (!te || L[0].length > te[0].length)) {
257 if (te = L, $ = q, this.options.backtrack_lexer) {
258 if (Y = this.test_match(L, k[q]), Y !== !1)
259 return Y;
260 if (this._backtrack) {
261 te = !1;
262 continue;
263 } else
264 return !1;
265 } else if (!this.options.flex)
266 break;
267 }
268 return te ? (Y = this.test_match(te, k[$]), Y !== !1 ? Y : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
269` + this.showPosition(), {
270 text: "",
271 token: null,
272 line: this.yylineno
273 });
274 },
275 // return next match that has a token
276 lex: function() {
277 var te = this.next();
278 return te || this.lex();
279 },
280 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
281 begin: function(te) {
282 this.conditionStack.push(te);
283 },
284 // pop the previously active lexer condition state off the condition stack
285 popState: function() {
286 var te = this.conditionStack.length - 1;
287 return te > 0 ? this.conditionStack.pop() : this.conditionStack[0];
288 },
289 // produce the lexer rule set which is active for the currently active lexer condition state
290 _currentRules: function() {
291 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
292 },
293 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
294 topState: function(te) {
295 return te = this.conditionStack.length - 1 - Math.abs(te || 0), te >= 0 ? this.conditionStack[te] : "INITIAL";
296 },
297 // alias for begin(condition)
298 pushState: function(te) {
299 this.begin(te);
300 },
301 // return the number of states currently on the stack
302 stateStackSize: function() {
303 return this.conditionStack.length;
304 },
305 options: { "case-insensitive": !0 },
306 performAction: function(te, L, $, k) {
307 switch ($) {
308 case 0:
309 return te.getLogger().trace("Found comment", L.yytext), 6;
310 case 1:
311 return 8;
312 case 2:
313 this.begin("CLASS");
314 break;
315 case 3:
316 return this.popState(), 16;
317 case 4:
318 this.popState();
319 break;
320 case 5:
321 te.getLogger().trace("Begin icon"), this.begin("ICON");
322 break;
323 case 6:
324 return te.getLogger().trace("SPACELINE"), 6;
325 case 7:
326 return 7;
327 case 8:
328 return 15;
329 case 9:
330 te.getLogger().trace("end icon"), this.popState();
331 break;
332 case 10:
333 return te.getLogger().trace("Exploding node"), this.begin("NODE"), 19;
334 case 11:
335 return te.getLogger().trace("Cloud"), this.begin("NODE"), 19;
336 case 12:
337 return te.getLogger().trace("Explosion Bang"), this.begin("NODE"), 19;
338 case 13:
339 return te.getLogger().trace("Cloud Bang"), this.begin("NODE"), 19;
340 case 14:
341 return this.begin("NODE"), 19;
342 case 15:
343 return this.begin("NODE"), 19;
344 case 16:
345 return this.begin("NODE"), 19;
346 case 17:
347 return this.begin("NODE"), 19;
348 case 18:
349 return 13;
350 case 19:
351 return 22;
352 case 20:
353 return 11;
354 case 21:
355 this.begin("NSTR2");
356 break;
357 case 22:
358 return "NODE_DESCR";
359 case 23:
360 this.popState();
361 break;
362 case 24:
363 te.getLogger().trace("Starting NSTR"), this.begin("NSTR");
364 break;
365 case 25:
366 return te.getLogger().trace("description:", L.yytext), "NODE_DESCR";
367 case 26:
368 this.popState();
369 break;
370 case 27:
371 return this.popState(), te.getLogger().trace("node end ))"), "NODE_DEND";
372 case 28:
373 return this.popState(), te.getLogger().trace("node end )"), "NODE_DEND";
374 case 29:
375 return this.popState(), te.getLogger().trace("node end ...", L.yytext), "NODE_DEND";
376 case 30:
377 return this.popState(), te.getLogger().trace("node end (("), "NODE_DEND";
378 case 31:
379 return this.popState(), te.getLogger().trace("node end (-"), "NODE_DEND";
380 case 32:
381 return this.popState(), te.getLogger().trace("node end (-"), "NODE_DEND";
382 case 33:
383 return this.popState(), te.getLogger().trace("node end (("), "NODE_DEND";
384 case 34:
385 return this.popState(), te.getLogger().trace("node end (("), "NODE_DEND";
386 case 35:
387 return te.getLogger().trace("Long description:", L.yytext), 20;
388 case 36:
389 return te.getLogger().trace("Long description:", L.yytext), 20;
390 }
391 },
392 rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\-\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i],
393 conditions: { CLASS: { rules: [3, 4], inclusive: !1 }, ICON: { rules: [8, 9], inclusive: !1 }, NSTR2: { rules: [22, 23], inclusive: !1 }, NSTR: { rules: [25, 26], inclusive: !1 }, NODE: { rules: [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], inclusive: !0 } }
394 };
395 return j;
396 }();
397 ne.lexer = ue;
398 function J() {
399 this.yy = {};
400 }
401 return J.prototype = ne, ne.Parser = J, new J();
402}();
403Ki.parser = Ki;
404const Cp = Ki, sn = (he) => yp(he, nn());
405let Jt = [], Uu = 0, Ji = {};
406const Dp = () => {
407 Jt = [], Uu = 0, Ji = {};
408}, Sp = function(he) {
409 for (let fe = Jt.length - 1; fe >= 0; fe--)
410 if (Jt[fe].level < he)
411 return Jt[fe];
412 return null;
413}, Lp = () => Jt.length > 0 ? Jt[0] : null, Ap = (he, fe, ee, ve) => {
414 qr.info("addNode", he, fe, ee, ve);
415 const H = nn(), O = {
416 id: Uu++,
417 nodeId: sn(fe),
418 level: he,
419 descr: sn(ee),
420 type: ve,
421 children: [],
422 width: nn().mindmap.maxNodeWidth
423 };
424 switch (O.type) {
425 case yt.ROUNDED_RECT:
426 O.padding = 2 * H.mindmap.padding;
427 break;
428 case yt.RECT:
429 O.padding = 2 * H.mindmap.padding;
430 break;
431 case yt.HEXAGON:
432 O.padding = 2 * H.mindmap.padding;
433 break;
434 default:
435 O.padding = H.mindmap.padding;
436 }
437 const T = Sp(he);
438 if (T)
439 T.children.push(O), Jt.push(O);
440 else if (Jt.length === 0)
441 Jt.push(O);
442 else {
443 let x = new Error(
444 'There can be only one root. No parent could be found for ("' + O.descr + '")'
445 );
446 throw x.hash = {
447 text: "branch " + name,
448 token: "branch " + name,
449 line: "1",
450 loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
451 expected: ['"checkout ' + name + '"']
452 }, x;
453 }
454}, yt = {
455 DEFAULT: 0,
456 NO_BORDER: 0,
457 ROUNDED_RECT: 1,
458 RECT: 2,
459 CIRCLE: 3,
460 CLOUD: 4,
461 BANG: 5,
462 HEXAGON: 6
463}, Op = (he, fe) => {
464 switch (qr.debug("In get type", he, fe), he) {
465 case "[":
466 return yt.RECT;
467 case "(":
468 return fe === ")" ? yt.ROUNDED_RECT : yt.CLOUD;
469 case "((":
470 return yt.CIRCLE;
471 case ")":
472 return yt.CLOUD;
473 case "))":
474 return yt.BANG;
475 case "{{":
476 return yt.HEXAGON;
477 default:
478 return yt.DEFAULT;
479 }
480}, Yu = (he, fe) => {
481 Ji[he] = fe;
482}, Np = (he) => {
483 const fe = Jt[Jt.length - 1];
484 he && he.icon && (fe.icon = sn(he.icon)), he && he.class && (fe.class = sn(he.class));
485}, Wr = (he) => {
486 switch (he) {
487 case yt.DEFAULT:
488 return "no-border";
489 case yt.RECT:
490 return "rect";
491 case yt.ROUNDED_RECT:
492 return "rounded-rect";
493 case yt.CIRCLE:
494 return "circle";
495 case yt.CLOUD:
496 return "cloud";
497 case yt.BANG:
498 return "bang";
499 case yt.HEXAGON:
500 return "hexgon";
501 default:
502 return "no-border";
503 }
504};
505let Hu;
506const Mp = (he) => {
507 Hu = he;
508}, Ip = () => qr, Rp = (he) => Jt[he], ji = (he) => Ji[he], kp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
509 __proto__: null,
510 addNode: Ap,
511 clear: Dp,
512 decorateNode: Np,
513 getElementById: ji,
514 getLogger: Ip,
515 getMindmap: Lp,
516 getNodeById: Rp,
517 getType: Op,
518 nodeType: yt,
519 get parseError() {
520 return Hu;
521 },
522 sanitizeText: sn,
523 setElementForId: Yu,
524 setErrorHandler: Mp,
525 type2Str: Wr
526}, Symbol.toStringTag, { value: "Module" })), Xu = 12, Pp = function(he, fe, ee) {
527 he.append("path").attr("id", "node-" + fe.id).attr("class", "node-bkg node-" + Wr(fe.type)).attr(
528 "d",
529 `M0 ${fe.height - 5} v${-fe.height + 2 * 5} q0,-5 5,-5 h${fe.width - 2 * 5} q5,0 5,5 v${fe.height - 5} H0 Z`
530 ), he.append("line").attr("class", "node-line-" + ee).attr("x1", 0).attr("y1", fe.height).attr("x2", fe.width).attr("y2", fe.height);
531}, Bp = function(he, fe) {
532 he.append("rect").attr("id", "node-" + fe.id).attr("class", "node-bkg node-" + Wr(fe.type)).attr("height", fe.height).attr("width", fe.width);
533}, Fp = function(he, fe) {
534 const ee = fe.width, ve = fe.height, H = 0.15 * ee, O = 0.25 * ee, T = 0.35 * ee, x = 0.2 * ee;
535 he.append("path").attr("id", "node-" + fe.id).attr("class", "node-bkg node-" + Wr(fe.type)).attr(
536 "d",
537 `M0 0 a${H},${H} 0 0,1 ${ee * 0.25},${-1 * ee * 0.1}
538 a${T},${T} 1 0,1 ${ee * 0.4},${-1 * ee * 0.1}
539 a${O},${O} 1 0,1 ${ee * 0.35},${1 * ee * 0.2}
540
541 a${H},${H} 1 0,1 ${ee * 0.15},${1 * ve * 0.35}
542 a${x},${x} 1 0,1 ${-1 * ee * 0.15},${1 * ve * 0.65}
543
544 a${O},${H} 1 0,1 ${-1 * ee * 0.25},${ee * 0.15}
545 a${T},${T} 1 0,1 ${-1 * ee * 0.5},0
546 a${H},${H} 1 0,1 ${-1 * ee * 0.25},${-1 * ee * 0.15}
547
548 a${H},${H} 1 0,1 ${-1 * ee * 0.1},${-1 * ve * 0.35}
549 a${x},${x} 1 0,1 ${ee * 0.1},${-1 * ve * 0.65}
550
551 H0 V0 Z`
552 );
553}, zp = function(he, fe) {
554 const ee = fe.width, ve = fe.height, H = 0.15 * ee;
555 he.append("path").attr("id", "node-" + fe.id).attr("class", "node-bkg node-" + Wr(fe.type)).attr(
556 "d",
557 `M0 0 a${H},${H} 1 0,0 ${ee * 0.25},${-1 * ve * 0.1}
558 a${H},${H} 1 0,0 ${ee * 0.25},0
559 a${H},${H} 1 0,0 ${ee * 0.25},0
560 a${H},${H} 1 0,0 ${ee * 0.25},${1 * ve * 0.1}
561
562 a${H},${H} 1 0,0 ${ee * 0.15},${1 * ve * 0.33}
563 a${H * 0.8},${H * 0.8} 1 0,0 0,${1 * ve * 0.34}
564 a${H},${H} 1 0,0 ${-1 * ee * 0.15},${1 * ve * 0.33}
565
566 a${H},${H} 1 0,0 ${-1 * ee * 0.25},${ve * 0.15}
567 a${H},${H} 1 0,0 ${-1 * ee * 0.25},0
568 a${H},${H} 1 0,0 ${-1 * ee * 0.25},0
569 a${H},${H} 1 0,0 ${-1 * ee * 0.25},${-1 * ve * 0.15}
570
571 a${H},${H} 1 0,0 ${-1 * ee * 0.1},${-1 * ve * 0.33}
572 a${H * 0.8},${H * 0.8} 1 0,0 0,${-1 * ve * 0.34}
573 a${H},${H} 1 0,0 ${ee * 0.1},${-1 * ve * 0.33}
574
575 H0 V0 Z`
576 );
577}, Gp = function(he, fe) {
578 he.append("circle").attr("id", "node-" + fe.id).attr("class", "node-bkg node-" + Wr(fe.type)).attr("r", fe.width / 2);
579};
580function $p(he, fe, ee, ve, H) {
581 return he.insert("polygon", ":first-child").attr(
582 "points",
583 ve.map(function(O) {
584 return O.x + "," + O.y;
585 }).join(" ")
586 ).attr("transform", "translate(" + (H.width - fe) / 2 + ", " + ee + ")");
587}
588const Vp = function(he, fe) {
589 const ee = fe.height, H = ee / 4, O = fe.width - fe.padding + 2 * H, T = [
590 { x: H, y: 0 },
591 { x: O - H, y: 0 },
592 { x: O, y: -ee / 2 },
593 { x: O - H, y: -ee },
594 { x: H, y: -ee },
595 { x: 0, y: -ee / 2 }
596 ];
597 $p(he, O, ee, T, fe);
598}, _p = function(he, fe) {
599 he.append("rect").attr("id", "node-" + fe.id).attr("class", "node-bkg node-" + Wr(fe.type)).attr("height", fe.height).attr("rx", fe.padding).attr("ry", fe.padding).attr("width", fe.width);
600}, Up = function(he, fe, ee, ve) {
601 const H = ve.htmlLabels, O = ee % (Xu - 1), T = he.append("g");
602 fe.section = O;
603 let x = "section-" + O;
604 O < 0 && (x += " section-root"), T.attr("class", (fe.class ? fe.class + " " : "") + "mindmap-node " + x);
605 const S = T.append("g"), G = T.append("g"), U = fe.descr.replace(/(<br\/*>)/g, `
606`);
607 xp(G, U, {
608 useHtmlLabels: H,
609 width: fe.width,
610 classes: "mindmap-node-label"
611 }), H || G.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle");
612 const P = G.node().getBBox(), K = ve.fontSize.replace ? ve.fontSize.replace("px", "") : ve.fontSize;
613 if (fe.height = P.height + K * 1.1 * 0.5 + fe.padding, fe.width = P.width + 2 * fe.padding, fe.icon)
614 if (fe.type === yt.CIRCLE)
615 fe.height += 50, fe.width += 50, T.append("foreignObject").attr("height", "50px").attr("width", fe.width).attr("style", "text-align: center;").append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + O + " " + fe.icon), G.attr(
616 "transform",
617 "translate(" + fe.width / 2 + ", " + (fe.height / 2 - 1.5 * fe.padding) + ")"
618 );
619 else {
620 fe.width += 50;
621 const D = fe.height;
622 fe.height = Math.max(D, 60);
623 const V = Math.abs(fe.height - D);
624 T.append("foreignObject").attr("width", "60px").attr("height", fe.height).attr("style", "text-align: center;margin-top:" + V / 2 + "px;").append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + O + " " + fe.icon), G.attr(
625 "transform",
626 "translate(" + (25 + fe.width / 2) + ", " + (V / 2 + fe.padding / 2) + ")"
627 );
628 }
629 else if (H) {
630 const D = (fe.width - P.width) / 2, V = (fe.height - P.height) / 2;
631 G.attr("transform", "translate(" + D + ", " + V + ")");
632 } else {
633 const D = fe.width / 2, V = fe.padding / 2;
634 G.attr("transform", "translate(" + D + ", " + V + ")");
635 }
636 switch (fe.type) {
637 case yt.DEFAULT:
638 Pp(S, fe, O);
639 break;
640 case yt.ROUNDED_RECT:
641 _p(S, fe);
642 break;
643 case yt.RECT:
644 Bp(S, fe);
645 break;
646 case yt.CIRCLE:
647 S.attr("transform", "translate(" + fe.width / 2 + ", " + +fe.height / 2 + ")"), Gp(S, fe);
648 break;
649 case yt.CLOUD:
650 Fp(S, fe);
651 break;
652 case yt.BANG:
653 zp(S, fe);
654 break;
655 case yt.HEXAGON:
656 Vp(S, fe);
657 break;
658 }
659 return Yu(fe.id, T), fe.height;
660}, Yp = function(fe, ee, ve, H, O) {
661 const T = O % (Xu - 1), x = ve.x + ve.width / 2, S = ve.y + ve.height / 2, G = ee.x + ee.width / 2, U = ee.y + ee.height / 2, P = G > x ? x + Math.abs(x - G) / 2 : x - Math.abs(x - G) / 2, K = U > S ? S + Math.abs(S - U) / 2 : S - Math.abs(S - U) / 2, D = G > x ? Math.abs(x - P) / 2 + x : -Math.abs(x - P) / 2 + x, V = U > S ? Math.abs(S - K) / 2 + S : -Math.abs(S - K) / 2 + S;
662 fe.append("path").attr(
663 "d",
664 ve.direction === "TB" || ve.direction === "BT" ? `M${x},${S} Q${x},${V} ${P},${K} T${G},${U}` : `M${x},${S} Q${D},${S} ${P},${K} T${G},${U}`
665 ).attr("class", "edge section-edge-" + T + " edge-depth-" + H);
666}, Hp = function(he) {
667 const fe = ji(he.id), ee = he.x || 0, ve = he.y || 0;
668 fe.attr("transform", "translate(" + ee + "," + ve + ")");
669}, qu = { drawNode: Up, positionNode: Hp, drawEdge: Yp };
670var Zi = {}, Xp = {
671 get exports() {
672 return Zi;
673 },
674 set exports(he) {
675 Zi = he;
676 }
677};
678(function(he, fe) {
679 (function(ee, ve) {
680 he.exports = ve();
681 })(Ca, function() {
682 function ee(t) {
683 return ee = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
684 return typeof e;
685 } : function(e) {
686 return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
687 }, ee(t);
688 }
689 function ve(t, e) {
690 if (!(t instanceof e))
691 throw new TypeError("Cannot call a class as a function");
692 }
693 function H(t, e) {
694 for (var r = 0; r < e.length; r++) {
695 var a = e[r];
696 a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(t, a.key, a);
697 }
698 }
699 function O(t, e, r) {
700 return e && H(t.prototype, e), r && H(t, r), Object.defineProperty(t, "prototype", {
701 writable: !1
702 }), t;
703 }
704 function T(t, e, r) {
705 return e in t ? Object.defineProperty(t, e, {
706 value: r,
707 enumerable: !0,
708 configurable: !0,
709 writable: !0
710 }) : t[e] = r, t;
711 }
712 function x(t, e) {
713 return S(t) || G(t, e) || U(t, e) || K();
714 }
715 function S(t) {
716 if (Array.isArray(t))
717 return t;
718 }
719 function G(t, e) {
720 var r = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
721 if (r != null) {
722 var a = [], n = !0, i = !1, s, o;
723 try {
724 for (r = r.call(t); !(n = (s = r.next()).done) && (a.push(s.value), !(e && a.length === e)); n = !0)
725 ;
726 } catch (l) {
727 i = !0, o = l;
728 } finally {
729 try {
730 !n && r.return != null && r.return();
731 } finally {
732 if (i)
733 throw o;
734 }
735 }
736 return a;
737 }
738 }
739 function U(t, e) {
740 if (t) {
741 if (typeof t == "string")
742 return P(t, e);
743 var r = Object.prototype.toString.call(t).slice(8, -1);
744 if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set")
745 return Array.from(t);
746 if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
747 return P(t, e);
748 }
749 }
750 function P(t, e) {
751 (e == null || e > t.length) && (e = t.length);
752 for (var r = 0, a = new Array(e); r < e; r++)
753 a[r] = t[r];
754 return a;
755 }
756 function K() {
757 throw new TypeError(`Invalid attempt to destructure non-iterable instance.
758In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
759 }
760 var D = typeof window > "u" ? null : window, V = D ? D.navigator : null;
761 D && D.document;
762 var _ = ee(""), Q = ee({}), ne = ee(function() {
763 }), ue = typeof HTMLElement > "u" ? "undefined" : ee(HTMLElement), J = function(e) {
764 return e && e.instanceString && Y(e.instanceString) ? e.instanceString() : null;
765 }, j = function(e) {
766 return e != null && ee(e) == _;
767 }, Y = function(e) {
768 return e != null && ee(e) === ne;
769 }, te = function(e) {
770 return !pe(e) && (Array.isArray ? Array.isArray(e) : e != null && e instanceof Array);
771 }, L = function(e) {
772 return e != null && ee(e) === Q && !te(e) && e.constructor === Object;
773 }, $ = function(e) {
774 return e != null && ee(e) === Q;
775 }, k = function(e) {
776 return e != null && ee(e) === ee(1) && !isNaN(e);
777 }, q = function(e) {
778 return k(e) && Math.floor(e) === e;
779 }, ce = function(e) {
780 if (ue !== "undefined")
781 return e != null && e instanceof HTMLElement;
782 }, pe = function(e) {
783 return Ae(e) || Ne(e);
784 }, Ae = function(e) {
785 return J(e) === "collection" && e._private.single;
786 }, Ne = function(e) {
787 return J(e) === "collection" && !e._private.single;
788 }, _e = function(e) {
789 return J(e) === "core";
790 }, tt = function(e) {
791 return J(e) === "stylesheet";
792 }, ct = function(e) {
793 return J(e) === "event";
794 }, Pe = function(e) {
795 return e == null ? !0 : !!(e === "" || e.match(/^\s+$/));
796 }, $e = function(e) {
797 return typeof HTMLElement > "u" ? !1 : e instanceof HTMLElement;
798 }, Xe = function(e) {
799 return L(e) && k(e.x1) && k(e.x2) && k(e.y1) && k(e.y2);
800 }, rt = function(e) {
801 return $(e) && Y(e.then);
802 }, lt = function() {
803 return V && V.userAgent.match(/msie|trident|edge/i);
804 }, nt = function(e, r) {
805 r || (r = function() {
806 if (arguments.length === 1)
807 return arguments[0];
808 if (arguments.length === 0)
809 return "undefined";
810 for (var i = [], s = 0; s < arguments.length; s++)
811 i.push(arguments[s]);
812 return i.join("$");
813 });
814 var a = function n() {
815 var i = this, s = arguments, o, l = r.apply(i, s), u = n.cache;
816 return (o = u[l]) || (o = u[l] = e.apply(i, s)), o;
817 };
818 return a.cache = {}, a;
819 }, je = nt(function(t) {
820 return t.replace(/([A-Z])/g, function(e) {
821 return "-" + e.toLowerCase();
822 });
823 }), pt = nt(function(t) {
824 return t.replace(/(-\w)/g, function(e) {
825 return e[1].toUpperCase();
826 });
827 }), Et = nt(function(t, e) {
828 return t + e[0].toUpperCase() + e.substring(1);
829 }, function(t, e) {
830 return t + "$" + e;
831 }), kt = function(e) {
832 return Pe(e) ? e : e.charAt(0).toUpperCase() + e.substring(1);
833 }, vt = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))", vr = "rgb[a]?\\((" + vt + "[%]?)\\s*,\\s*(" + vt + "[%]?)\\s*,\\s*(" + vt + "[%]?)(?:\\s*,\\s*(" + vt + "))?\\)", qt = "rgb[a]?\\((?:" + vt + "[%]?)\\s*,\\s*(?:" + vt + "[%]?)\\s*,\\s*(?:" + vt + "[%]?)(?:\\s*,\\s*(?:" + vt + "))?\\)", on = "hsl[a]?\\((" + vt + ")\\s*,\\s*(" + vt + "[%])\\s*,\\s*(" + vt + "[%])(?:\\s*,\\s*(" + vt + "))?\\)", Kr = "hsl[a]?\\((?:" + vt + ")\\s*,\\s*(?:" + vt + "[%])\\s*,\\s*(?:" + vt + "[%])(?:\\s*,\\s*(?:" + vt + "))?\\)", Da = "\\#[0-9a-fA-F]{3}", jt = "\\#[0-9a-fA-F]{6}", es = function(e, r) {
834 return e < r ? -1 : e > r ? 1 : 0;
835 }, Qu = function(e, r) {
836 return -1 * es(e, r);
837 }, Ue = Object.assign != null ? Object.assign.bind(Object) : function(t) {
838 for (var e = arguments, r = 1; r < e.length; r++) {
839 var a = e[r];
840 if (a != null)
841 for (var n = Object.keys(a), i = 0; i < n.length; i++) {
842 var s = n[i];
843 t[s] = a[s];
844 }
845 }
846 return t;
847 }, Ju = function(e) {
848 if (!(!(e.length === 4 || e.length === 7) || e[0] !== "#")) {
849 var r = e.length === 4, a, n, i, s = 16;
850 return r ? (a = parseInt(e[1] + e[1], s), n = parseInt(e[2] + e[2], s), i = parseInt(e[3] + e[3], s)) : (a = parseInt(e[1] + e[2], s), n = parseInt(e[3] + e[4], s), i = parseInt(e[5] + e[6], s)), [a, n, i];
851 }
852 }, ju = function(e) {
853 var r, a, n, i, s, o, l, u;
854 function f(d, g, y) {
855 return y < 0 && (y += 1), y > 1 && (y -= 1), y < 1 / 6 ? d + (g - d) * 6 * y : y < 1 / 2 ? g : y < 2 / 3 ? d + (g - d) * (2 / 3 - y) * 6 : d;
856 }
857 var h = new RegExp("^" + on + "$").exec(e);
858 if (h) {
859 if (a = parseInt(h[1]), a < 0 ? a = (360 - -1 * a % 360) % 360 : a > 360 && (a = a % 360), a /= 360, n = parseFloat(h[2]), n < 0 || n > 100 || (n = n / 100, i = parseFloat(h[3]), i < 0 || i > 100) || (i = i / 100, s = h[4], s !== void 0 && (s = parseFloat(s), s < 0 || s > 1)))
860 return;
861 if (n === 0)
862 o = l = u = Math.round(i * 255);
863 else {
864 var c = i < 0.5 ? i * (1 + n) : i + n - i * n, v = 2 * i - c;
865 o = Math.round(255 * f(v, c, a + 1 / 3)), l = Math.round(255 * f(v, c, a)), u = Math.round(255 * f(v, c, a - 1 / 3));
866 }
867 r = [o, l, u, s];
868 }
869 return r;
870 }, el = function(e) {
871 var r, a = new RegExp("^" + vr + "$").exec(e);
872 if (a) {
873 r = [];
874 for (var n = [], i = 1; i <= 3; i++) {
875 var s = a[i];
876 if (s[s.length - 1] === "%" && (n[i] = !0), s = parseFloat(s), n[i] && (s = s / 100 * 255), s < 0 || s > 255)
877 return;
878 r.push(Math.floor(s));
879 }
880 var o = n[1] || n[2] || n[3], l = n[1] && n[2] && n[3];
881 if (o && !l)
882 return;
883 var u = a[4];
884 if (u !== void 0) {
885 if (u = parseFloat(u), u < 0 || u > 1)
886 return;
887 r.push(u);
888 }
889 }
890 return r;
891 }, tl = function(e) {
892 return al[e.toLowerCase()];
893 }, rl = function(e) {
894 return (te(e) ? e : null) || tl(e) || Ju(e) || el(e) || ju(e);
895 }, al = {
896 // special colour names
897 transparent: [0, 0, 0, 0],
898 // NB alpha === 0
899 // regular colours
900 aliceblue: [240, 248, 255],
901 antiquewhite: [250, 235, 215],
902 aqua: [0, 255, 255],
903 aquamarine: [127, 255, 212],
904 azure: [240, 255, 255],
905 beige: [245, 245, 220],
906 bisque: [255, 228, 196],
907 black: [0, 0, 0],
908 blanchedalmond: [255, 235, 205],
909 blue: [0, 0, 255],
910 blueviolet: [138, 43, 226],
911 brown: [165, 42, 42],
912 burlywood: [222, 184, 135],
913 cadetblue: [95, 158, 160],
914 chartreuse: [127, 255, 0],
915 chocolate: [210, 105, 30],
916 coral: [255, 127, 80],
917 cornflowerblue: [100, 149, 237],
918 cornsilk: [255, 248, 220],
919 crimson: [220, 20, 60],
920 cyan: [0, 255, 255],
921 darkblue: [0, 0, 139],
922 darkcyan: [0, 139, 139],
923 darkgoldenrod: [184, 134, 11],
924 darkgray: [169, 169, 169],
925 darkgreen: [0, 100, 0],
926 darkgrey: [169, 169, 169],
927 darkkhaki: [189, 183, 107],
928 darkmagenta: [139, 0, 139],
929 darkolivegreen: [85, 107, 47],
930 darkorange: [255, 140, 0],
931 darkorchid: [153, 50, 204],
932 darkred: [139, 0, 0],
933 darksalmon: [233, 150, 122],
934 darkseagreen: [143, 188, 143],
935 darkslateblue: [72, 61, 139],
936 darkslategray: [47, 79, 79],
937 darkslategrey: [47, 79, 79],
938 darkturquoise: [0, 206, 209],
939 darkviolet: [148, 0, 211],
940 deeppink: [255, 20, 147],
941 deepskyblue: [0, 191, 255],
942 dimgray: [105, 105, 105],
943 dimgrey: [105, 105, 105],
944 dodgerblue: [30, 144, 255],
945 firebrick: [178, 34, 34],
946 floralwhite: [255, 250, 240],
947 forestgreen: [34, 139, 34],
948 fuchsia: [255, 0, 255],
949 gainsboro: [220, 220, 220],
950 ghostwhite: [248, 248, 255],
951 gold: [255, 215, 0],
952 goldenrod: [218, 165, 32],
953 gray: [128, 128, 128],
954 grey: [128, 128, 128],
955 green: [0, 128, 0],
956 greenyellow: [173, 255, 47],
957 honeydew: [240, 255, 240],
958 hotpink: [255, 105, 180],
959 indianred: [205, 92, 92],
960 indigo: [75, 0, 130],
961 ivory: [255, 255, 240],
962 khaki: [240, 230, 140],
963 lavender: [230, 230, 250],
964 lavenderblush: [255, 240, 245],
965 lawngreen: [124, 252, 0],
966 lemonchiffon: [255, 250, 205],
967 lightblue: [173, 216, 230],
968 lightcoral: [240, 128, 128],
969 lightcyan: [224, 255, 255],
970 lightgoldenrodyellow: [250, 250, 210],
971 lightgray: [211, 211, 211],
972 lightgreen: [144, 238, 144],
973 lightgrey: [211, 211, 211],
974 lightpink: [255, 182, 193],
975 lightsalmon: [255, 160, 122],
976 lightseagreen: [32, 178, 170],
977 lightskyblue: [135, 206, 250],
978 lightslategray: [119, 136, 153],
979 lightslategrey: [119, 136, 153],
980 lightsteelblue: [176, 196, 222],
981 lightyellow: [255, 255, 224],
982 lime: [0, 255, 0],
983 limegreen: [50, 205, 50],
984 linen: [250, 240, 230],
985 magenta: [255, 0, 255],
986 maroon: [128, 0, 0],
987 mediumaquamarine: [102, 205, 170],
988 mediumblue: [0, 0, 205],
989 mediumorchid: [186, 85, 211],
990 mediumpurple: [147, 112, 219],
991 mediumseagreen: [60, 179, 113],
992 mediumslateblue: [123, 104, 238],
993 mediumspringgreen: [0, 250, 154],
994 mediumturquoise: [72, 209, 204],
995 mediumvioletred: [199, 21, 133],
996 midnightblue: [25, 25, 112],
997 mintcream: [245, 255, 250],
998 mistyrose: [255, 228, 225],
999 moccasin: [255, 228, 181],
1000 navajowhite: [255, 222, 173],
1001 navy: [0, 0, 128],
1002 oldlace: [253, 245, 230],
1003 olive: [128, 128, 0],
1004 olivedrab: [107, 142, 35],
1005 orange: [255, 165, 0],
1006 orangered: [255, 69, 0],
1007 orchid: [218, 112, 214],
1008 palegoldenrod: [238, 232, 170],
1009 palegreen: [152, 251, 152],
1010 paleturquoise: [175, 238, 238],
1011 palevioletred: [219, 112, 147],
1012 papayawhip: [255, 239, 213],
1013 peachpuff: [255, 218, 185],
1014 peru: [205, 133, 63],
1015 pink: [255, 192, 203],
1016 plum: [221, 160, 221],
1017 powderblue: [176, 224, 230],
1018 purple: [128, 0, 128],
1019 red: [255, 0, 0],
1020 rosybrown: [188, 143, 143],
1021 royalblue: [65, 105, 225],
1022 saddlebrown: [139, 69, 19],
1023 salmon: [250, 128, 114],
1024 sandybrown: [244, 164, 96],
1025 seagreen: [46, 139, 87],
1026 seashell: [255, 245, 238],
1027 sienna: [160, 82, 45],
1028 silver: [192, 192, 192],
1029 skyblue: [135, 206, 235],
1030 slateblue: [106, 90, 205],
1031 slategray: [112, 128, 144],
1032 slategrey: [112, 128, 144],
1033 snow: [255, 250, 250],
1034 springgreen: [0, 255, 127],
1035 steelblue: [70, 130, 180],
1036 tan: [210, 180, 140],
1037 teal: [0, 128, 128],
1038 thistle: [216, 191, 216],
1039 tomato: [255, 99, 71],
1040 turquoise: [64, 224, 208],
1041 violet: [238, 130, 238],
1042 wheat: [245, 222, 179],
1043 white: [255, 255, 255],
1044 whitesmoke: [245, 245, 245],
1045 yellow: [255, 255, 0],
1046 yellowgreen: [154, 205, 50]
1047 }, ts = function(e) {
1048 for (var r = e.map, a = e.keys, n = a.length, i = 0; i < n; i++) {
1049 var s = a[i];
1050 if (L(s))
1051 throw Error("Tried to set map with object key");
1052 i < a.length - 1 ? (r[s] == null && (r[s] = {}), r = r[s]) : r[s] = e.value;
1053 }
1054 }, rs = function(e) {
1055 for (var r = e.map, a = e.keys, n = a.length, i = 0; i < n; i++) {
1056 var s = a[i];
1057 if (L(s))
1058 throw Error("Tried to get map with object key");
1059 if (r = r[s], r == null)
1060 return r;
1061 }
1062 return r;
1063 };
1064 function nl(t) {
1065 var e = typeof t;
1066 return t != null && (e == "object" || e == "function");
1067 }
1068 var Rr = nl, Sa = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof Ca < "u" ? Ca : typeof self < "u" ? self : {};
1069 function il(t, e) {
1070 return e = { exports: {} }, t(e, e.exports), e.exports;
1071 }
1072 var sl = typeof Sa == "object" && Sa && Sa.Object === Object && Sa, ol = sl, ul = typeof self == "object" && self && self.Object === Object && self, ll = ol || ul || Function("return this")(), un = ll, fl = function() {
1073 return un.Date.now();
1074 }, ai = fl, hl = /\s/;
1075 function cl(t) {
1076 for (var e = t.length; e-- && hl.test(t.charAt(e)); )
1077 ;
1078 return e;
1079 }
1080 var vl = cl, dl = /^\s+/;
1081 function gl(t) {
1082 return t && t.slice(0, vl(t) + 1).replace(dl, "");
1083 }
1084 var pl = gl, yl = un.Symbol, Zr = yl, as = Object.prototype, ml = as.hasOwnProperty, bl = as.toString, La = Zr ? Zr.toStringTag : void 0;
1085 function El(t) {
1086 var e = ml.call(t, La), r = t[La];
1087 try {
1088 t[La] = void 0;
1089 var a = !0;
1090 } catch {
1091 }
1092 var n = bl.call(t);
1093 return a && (e ? t[La] = r : delete t[La]), n;
1094 }
1095 var wl = El, xl = Object.prototype, Tl = xl.toString;
1096 function Cl(t) {
1097 return Tl.call(t);
1098 }
1099 var Dl = Cl, Sl = "[object Null]", Ll = "[object Undefined]", ns = Zr ? Zr.toStringTag : void 0;
1100 function Al(t) {
1101 return t == null ? t === void 0 ? Ll : Sl : ns && ns in Object(t) ? wl(t) : Dl(t);
1102 }
1103 var is = Al;
1104 function Ol(t) {
1105 return t != null && typeof t == "object";
1106 }
1107 var Nl = Ol, Ml = "[object Symbol]";
1108 function Il(t) {
1109 return typeof t == "symbol" || Nl(t) && is(t) == Ml;
1110 }
1111 var Aa = Il, ss = 0 / 0, Rl = /^[-+]0x[0-9a-f]+$/i, kl = /^0b[01]+$/i, Pl = /^0o[0-7]+$/i, Bl = parseInt;
1112 function Fl(t) {
1113 if (typeof t == "number")
1114 return t;
1115 if (Aa(t))
1116 return ss;
1117 if (Rr(t)) {
1118 var e = typeof t.valueOf == "function" ? t.valueOf() : t;
1119 t = Rr(e) ? e + "" : e;
1120 }
1121 if (typeof t != "string")
1122 return t === 0 ? t : +t;
1123 t = pl(t);
1124 var r = kl.test(t);
1125 return r || Pl.test(t) ? Bl(t.slice(2), r ? 2 : 8) : Rl.test(t) ? ss : +t;
1126 }
1127 var os = Fl, zl = "Expected a function", Gl = Math.max, $l = Math.min;
1128 function Vl(t, e, r) {
1129 var a, n, i, s, o, l, u = 0, f = !1, h = !1, c = !0;
1130 if (typeof t != "function")
1131 throw new TypeError(zl);
1132 e = os(e) || 0, Rr(r) && (f = !!r.leading, h = "maxWait" in r, i = h ? Gl(os(r.maxWait) || 0, e) : i, c = "trailing" in r ? !!r.trailing : c);
1133 function v(A) {
1134 var w = a, I = n;
1135 return a = n = void 0, u = A, s = t.apply(I, w), s;
1136 }
1137 function d(A) {
1138 return u = A, o = setTimeout(p, e), f ? v(A) : s;
1139 }
1140 function g(A) {
1141 var w = A - l, I = A - u, C = e - w;
1142 return h ? $l(C, i - I) : C;
1143 }
1144 function y(A) {
1145 var w = A - l, I = A - u;
1146 return l === void 0 || w >= e || w < 0 || h && I >= i;
1147 }
1148 function p() {
1149 var A = ai();
1150 if (y(A))
1151 return m(A);
1152 o = setTimeout(p, g(A));
1153 }
1154 function m(A) {
1155 return o = void 0, c && a ? v(A) : (a = n = void 0, s);
1156 }
1157 function b() {
1158 o !== void 0 && clearTimeout(o), u = 0, a = l = n = o = void 0;
1159 }
1160 function E() {
1161 return o === void 0 ? s : m(ai());
1162 }
1163 function M() {
1164 var A = ai(), w = y(A);
1165 if (a = arguments, n = this, l = A, w) {
1166 if (o === void 0)
1167 return d(l);
1168 if (h)
1169 return clearTimeout(o), o = setTimeout(p, e), v(l);
1170 }
1171 return o === void 0 && (o = setTimeout(p, e)), s;
1172 }
1173 return M.cancel = b, M.flush = E, M;
1174 }
1175 var ln = Vl, ni = D ? D.performance : null, us = ni && ni.now ? function() {
1176 return ni.now();
1177 } : function() {
1178 return Date.now();
1179 }, _l = function() {
1180 if (D) {
1181 if (D.requestAnimationFrame)
1182 return function(t) {
1183 D.requestAnimationFrame(t);
1184 };
1185 if (D.mozRequestAnimationFrame)
1186 return function(t) {
1187 D.mozRequestAnimationFrame(t);
1188 };
1189 if (D.webkitRequestAnimationFrame)
1190 return function(t) {
1191 D.webkitRequestAnimationFrame(t);
1192 };
1193 if (D.msRequestAnimationFrame)
1194 return function(t) {
1195 D.msRequestAnimationFrame(t);
1196 };
1197 }
1198 return function(t) {
1199 t && setTimeout(function() {
1200 t(us());
1201 }, 1e3 / 60);
1202 };
1203 }(), fn = function(e) {
1204 return _l(e);
1205 }, dr = us, Qr = 9261, ls = 65599, Oa = 5381, fs = function(e) {
1206 for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qr, a = r, n; n = e.next(), !n.done; )
1207 a = a * ls + n.value | 0;
1208 return a;
1209 }, Na = function(e) {
1210 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qr;
1211 return r * ls + e | 0;
1212 }, Ma = function(e) {
1213 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Oa;
1214 return (r << 5) + r + e | 0;
1215 }, Ul = function(e, r) {
1216 return e * 2097152 + r;
1217 }, Er = function(e) {
1218 return e[0] * 2097152 + e[1];
1219 }, hn = function(e, r) {
1220 return [Na(e[0], r[0]), Ma(e[1], r[1])];
1221 }, Yl = function(e, r) {
1222 var a = {
1223 value: 0,
1224 done: !1
1225 }, n = 0, i = e.length, s = {
1226 next: function() {
1227 return n < i ? a.value = e[n++] : a.done = !0, a;
1228 }
1229 };
1230 return fs(s, r);
1231 }, kr = function(e, r) {
1232 var a = {
1233 value: 0,
1234 done: !1
1235 }, n = 0, i = e.length, s = {
1236 next: function() {
1237 return n < i ? a.value = e.charCodeAt(n++) : a.done = !0, a;
1238 }
1239 };
1240 return fs(s, r);
1241 }, hs = function() {
1242 return Hl(arguments);
1243 }, Hl = function(e) {
1244 for (var r, a = 0; a < e.length; a++) {
1245 var n = e[a];
1246 a === 0 ? r = kr(n) : r = kr(n, r);
1247 }
1248 return r;
1249 }, cs = !0, Xl = console.warn != null, ql = console.trace != null, ii = Number.MAX_SAFE_INTEGER || 9007199254740991, vs = function() {
1250 return !0;
1251 }, cn = function() {
1252 return !1;
1253 }, ds = function() {
1254 return 0;
1255 }, si = function() {
1256 }, xt = function(e) {
1257 throw new Error(e);
1258 }, gs = function(e) {
1259 if (e !== void 0)
1260 cs = !!e;
1261 else
1262 return cs;
1263 }, ft = function(e) {
1264 gs() && (Xl ? console.warn(e) : (console.log(e), ql && console.trace()));
1265 }, Wl = function(e) {
1266 return Ue({}, e);
1267 }, or = function(e) {
1268 return e == null ? e : te(e) ? e.slice() : L(e) ? Wl(e) : e;
1269 }, Kl = function(e) {
1270 return e.slice();
1271 }, ps = function(e, r) {
1272 for (
1273 // loop :)
1274 r = e = "";
1275 // b - result , a - numeric letiable
1276 e++ < 36;
1277 //
1278 r += e * 51 & 52 ? (
1279 // return a random number or 4
1280 (e ^ 15 ? (
1281 // generate a random number from 0 to 15
1282 8 ^ Math.random() * (e ^ 20 ? 16 : 4)
1283 ) : 4).toString(16)
1284 ) : "-"
1285 )
1286 ;
1287 return r;
1288 }, Zl = {}, ys = function() {
1289 return Zl;
1290 }, Lt = function(e) {
1291 var r = Object.keys(e);
1292 return function(a) {
1293 for (var n = {}, i = 0; i < r.length; i++) {
1294 var s = r[i], o = a == null ? void 0 : a[s];
1295 n[s] = o === void 0 ? e[s] : o;
1296 }
1297 return n;
1298 };
1299 }, wr = function(e, r, a) {
1300 for (var n = e.length - 1; n >= 0 && !(e[n] === r && (e.splice(n, 1), a)); n--)
1301 ;
1302 }, oi = function(e) {
1303 e.splice(0, e.length);
1304 }, Ql = function(e, r) {
1305 for (var a = 0; a < r.length; a++) {
1306 var n = r[a];
1307 e.push(n);
1308 }
1309 }, er = function(e, r, a) {
1310 return a && (r = Et(a, r)), e[r];
1311 }, xr = function(e, r, a, n) {
1312 a && (r = Et(a, r)), e[r] = n;
1313 }, Jl = /* @__PURE__ */ function() {
1314 function t() {
1315 ve(this, t), this._obj = {};
1316 }
1317 return O(t, [{
1318 key: "set",
1319 value: function(r, a) {
1320 return this._obj[r] = a, this;
1321 }
1322 }, {
1323 key: "delete",
1324 value: function(r) {
1325 return this._obj[r] = void 0, this;
1326 }
1327 }, {
1328 key: "clear",
1329 value: function() {
1330 this._obj = {};
1331 }
1332 }, {
1333 key: "has",
1334 value: function(r) {
1335 return this._obj[r] !== void 0;
1336 }
1337 }, {
1338 key: "get",
1339 value: function(r) {
1340 return this._obj[r];
1341 }
1342 }]), t;
1343 }(), ur = typeof Map < "u" ? Map : Jl, jl = "undefined", ef = /* @__PURE__ */ function() {
1344 function t(e) {
1345 if (ve(this, t), this._obj = /* @__PURE__ */ Object.create(null), this.size = 0, e != null) {
1346 var r;
1347 e.instanceString != null && e.instanceString() === this.instanceString() ? r = e.toArray() : r = e;
1348 for (var a = 0; a < r.length; a++)
1349 this.add(r[a]);
1350 }
1351 }
1352 return O(t, [{
1353 key: "instanceString",
1354 value: function() {
1355 return "set";
1356 }
1357 }, {
1358 key: "add",
1359 value: function(r) {
1360 var a = this._obj;
1361 a[r] !== 1 && (a[r] = 1, this.size++);
1362 }
1363 }, {
1364 key: "delete",
1365 value: function(r) {
1366 var a = this._obj;
1367 a[r] === 1 && (a[r] = 0, this.size--);
1368 }
1369 }, {
1370 key: "clear",
1371 value: function() {
1372 this._obj = /* @__PURE__ */ Object.create(null);
1373 }
1374 }, {
1375 key: "has",
1376 value: function(r) {
1377 return this._obj[r] === 1;
1378 }
1379 }, {
1380 key: "toArray",
1381 value: function() {
1382 var r = this;
1383 return Object.keys(this._obj).filter(function(a) {
1384 return r.has(a);
1385 });
1386 }
1387 }, {
1388 key: "forEach",
1389 value: function(r, a) {
1390 return this.toArray().forEach(r, a);
1391 }
1392 }]), t;
1393 }(), Jr = (typeof Set > "u" ? "undefined" : ee(Set)) !== jl ? Set : ef, vn = function(e, r) {
1394 var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0;
1395 if (e === void 0 || r === void 0 || !_e(e)) {
1396 xt("An element must have a core reference and parameters set");
1397 return;
1398 }
1399 var n = r.group;
1400 if (n == null && (r.data && r.data.source != null && r.data.target != null ? n = "edges" : n = "nodes"), n !== "nodes" && n !== "edges") {
1401 xt("An element must be of type `nodes` or `edges`; you specified `" + n + "`");
1402 return;
1403 }
1404 this.length = 1, this[0] = this;
1405 var i = this._private = {
1406 cy: e,
1407 single: !0,
1408 // indicates this is an element
1409 data: r.data || {},
1410 // data object
1411 position: r.position || {
1412 x: 0,
1413 y: 0
1414 },
1415 // (x, y) position pair
1416 autoWidth: void 0,
1417 // width and height of nodes calculated by the renderer when set to special 'auto' value
1418 autoHeight: void 0,
1419 autoPadding: void 0,
1420 compoundBoundsClean: !1,
1421 // whether the compound dimensions need to be recalculated the next time dimensions are read
1422 listeners: [],
1423 // array of bound listeners
1424 group: n,
1425 // string; 'nodes' or 'edges'
1426 style: {},
1427 // properties as set by the style
1428 rstyle: {},
1429 // properties for style sent from the renderer to the core
1430 styleCxts: [],
1431 // applied style contexts from the styler
1432 styleKeys: {},
1433 // per-group keys of style property values
1434 removed: !0,
1435 // whether it's inside the vis; true if removed (set true here since we call restore)
1436 selected: !!r.selected,
1437 // whether it's selected
1438 selectable: r.selectable === void 0 ? !0 : !!r.selectable,
1439 // whether it's selectable
1440 locked: !!r.locked,
1441 // whether the element is locked (cannot be moved)
1442 grabbed: !1,
1443 // whether the element is grabbed by the mouse; renderer sets this privately
1444 grabbable: r.grabbable === void 0 ? !0 : !!r.grabbable,
1445 // whether the element can be grabbed
1446 pannable: r.pannable === void 0 ? n === "edges" : !!r.pannable,
1447 // whether the element has passthrough panning enabled
1448 active: !1,
1449 // whether the element is active from user interaction
1450 classes: new Jr(),
1451 // map ( className => true )
1452 animation: {
1453 // object for currently-running animations
1454 current: [],
1455 queue: []
1456 },
1457 rscratch: {},
1458 // object in which the renderer can store information
1459 scratch: r.scratch || {},
1460 // scratch objects
1461 edges: [],
1462 // array of connected edges
1463 children: [],
1464 // array of children
1465 parent: r.parent && r.parent.isNode() ? r.parent : null,
1466 // parent ref
1467 traversalCache: {},
1468 // cache of output of traversal functions
1469 backgrounding: !1,
1470 // whether background images are loading
1471 bbCache: null,
1472 // cache of the current bounding box
1473 bbCacheShift: {
1474 x: 0,
1475 y: 0
1476 },
1477 // shift applied to cached bb to be applied on next get
1478 bodyBounds: null,
1479 // bounds cache of element body, w/o overlay
1480 overlayBounds: null,
1481 // bounds cache of element body, including overlay
1482 labelBounds: {
1483 // bounds cache of labels
1484 all: null,
1485 source: null,
1486 target: null,
1487 main: null
1488 },
1489 arrowBounds: {
1490 // bounds cache of edge arrows
1491 source: null,
1492 target: null,
1493 "mid-source": null,
1494 "mid-target": null
1495 }
1496 };
1497 if (i.position.x == null && (i.position.x = 0), i.position.y == null && (i.position.y = 0), r.renderedPosition) {
1498 var s = r.renderedPosition, o = e.pan(), l = e.zoom();
1499 i.position = {
1500 x: (s.x - o.x) / l,
1501 y: (s.y - o.y) / l
1502 };
1503 }
1504 var u = [];
1505 te(r.classes) ? u = r.classes : j(r.classes) && (u = r.classes.split(/\s+/));
1506 for (var f = 0, h = u.length; f < h; f++) {
1507 var c = u[f];
1508 !c || c === "" || i.classes.add(c);
1509 }
1510 this.createEmitter();
1511 var v = r.style || r.css;
1512 v && (ft("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."), this.style(v)), (a === void 0 || a) && this.restore();
1513 }, ms = function(e) {
1514 return e = {
1515 bfs: e.bfs || !e.dfs,
1516 dfs: e.dfs || !e.bfs
1517 }, function(a, n, i) {
1518 var s;
1519 L(a) && !pe(a) && (s = a, a = s.roots || s.root, n = s.visit, i = s.directed), i = arguments.length === 2 && !Y(n) ? n : i, n = Y(n) ? n : function() {
1520 };
1521 for (var o = this._private.cy, l = a = j(a) ? this.filter(a) : a, u = [], f = [], h = {}, c = {}, v = {}, d = 0, g, y = this.byGroup(), p = y.nodes, m = y.edges, b = 0; b < l.length; b++) {
1522 var E = l[b], M = E.id();
1523 E.isNode() && (u.unshift(E), e.bfs && (v[M] = !0, f.push(E)), c[M] = 0);
1524 }
1525 for (var A = function() {
1526 var X = e.bfs ? u.shift() : u.pop(), z = X.id();
1527 if (e.dfs) {
1528 if (v[z])
1529 return "continue";
1530 v[z] = !0, f.push(X);
1531 }
1532 var re = c[z], W = h[z], Z = W != null ? W.source() : null, ie = W != null ? W.target() : null, oe = W == null ? void 0 : X.same(Z) ? ie[0] : Z[0], ge = void 0;
1533 if (ge = n(X, W, oe, d++, re), ge === !0)
1534 return g = X, "break";
1535 if (ge === !1)
1536 return "break";
1537 for (var se = X.connectedEdges().filter(function(ye) {
1538 return (!i || ye.source().same(X)) && m.has(ye);
1539 }), de = 0; de < se.length; de++) {
1540 var we = se[de], Te = we.connectedNodes().filter(function(ye) {
1541 return !ye.same(X) && p.has(ye);
1542 }), Ee = Te.id();
1543 Te.length !== 0 && !v[Ee] && (Te = Te[0], u.push(Te), e.bfs && (v[Ee] = !0, f.push(Te)), h[Ee] = we, c[Ee] = c[z] + 1);
1544 }
1545 }; u.length !== 0; ) {
1546 var w = A();
1547 if (w !== "continue" && w === "break")
1548 break;
1549 }
1550 for (var I = o.collection(), C = 0; C < f.length; C++) {
1551 var B = f[C], F = h[B.id()];
1552 F != null && I.push(F), I.push(B);
1553 }
1554 return {
1555 path: o.collection(I),
1556 found: o.collection(g)
1557 };
1558 };
1559 }, Ia = {
1560 breadthFirstSearch: ms({
1561 bfs: !0
1562 }),
1563 depthFirstSearch: ms({
1564 dfs: !0
1565 })
1566 };
1567 Ia.bfs = Ia.breadthFirstSearch, Ia.dfs = Ia.depthFirstSearch;
1568 var tf = il(function(t, e) {
1569 (function() {
1570 var r, a, n, i, s, o, l, u, f, h, c, v, d, g, y;
1571 n = Math.floor, h = Math.min, a = function(p, m) {
1572 return p < m ? -1 : p > m ? 1 : 0;
1573 }, f = function(p, m, b, E, M) {
1574 var A;
1575 if (b == null && (b = 0), M == null && (M = a), b < 0)
1576 throw new Error("lo must be non-negative");
1577 for (E == null && (E = p.length); b < E; )
1578 A = n((b + E) / 2), M(m, p[A]) < 0 ? E = A : b = A + 1;
1579 return [].splice.apply(p, [b, b - b].concat(m)), m;
1580 }, o = function(p, m, b) {
1581 return b == null && (b = a), p.push(m), g(p, 0, p.length - 1, b);
1582 }, s = function(p, m) {
1583 var b, E;
1584 return m == null && (m = a), b = p.pop(), p.length ? (E = p[0], p[0] = b, y(p, 0, m)) : E = b, E;
1585 }, u = function(p, m, b) {
1586 var E;
1587 return b == null && (b = a), E = p[0], p[0] = m, y(p, 0, b), E;
1588 }, l = function(p, m, b) {
1589 var E;
1590 return b == null && (b = a), p.length && b(p[0], m) < 0 && (E = [p[0], m], m = E[0], p[0] = E[1], y(p, 0, b)), m;
1591 }, i = function(p, m) {
1592 var b, E, M, A, w, I;
1593 for (m == null && (m = a), A = function() {
1594 I = [];
1595 for (var C = 0, B = n(p.length / 2); 0 <= B ? C < B : C > B; 0 <= B ? C++ : C--)
1596 I.push(C);
1597 return I;
1598 }.apply(this).reverse(), w = [], E = 0, M = A.length; E < M; E++)
1599 b = A[E], w.push(y(p, b, m));
1600 return w;
1601 }, d = function(p, m, b) {
1602 var E;
1603 if (b == null && (b = a), E = p.indexOf(m), E !== -1)
1604 return g(p, 0, E, b), y(p, E, b);
1605 }, c = function(p, m, b) {
1606 var E, M, A, w, I;
1607 if (b == null && (b = a), M = p.slice(0, m), !M.length)
1608 return M;
1609 for (i(M, b), I = p.slice(m), A = 0, w = I.length; A < w; A++)
1610 E = I[A], l(M, E, b);
1611 return M.sort(b).reverse();
1612 }, v = function(p, m, b) {
1613 var E, M, A, w, I, C, B, F, R;
1614 if (b == null && (b = a), m * 10 <= p.length) {
1615 if (A = p.slice(0, m).sort(b), !A.length)
1616 return A;
1617 for (M = A[A.length - 1], B = p.slice(m), w = 0, C = B.length; w < C; w++)
1618 E = B[w], b(E, M) < 0 && (f(A, E, 0, null, b), A.pop(), M = A[A.length - 1]);
1619 return A;
1620 }
1621 for (i(p, b), R = [], I = 0, F = h(m, p.length); 0 <= F ? I < F : I > F; 0 <= F ? ++I : --I)
1622 R.push(s(p, b));
1623 return R;
1624 }, g = function(p, m, b, E) {
1625 var M, A, w;
1626 for (E == null && (E = a), M = p[b]; b > m; ) {
1627 if (w = b - 1 >> 1, A = p[w], E(M, A) < 0) {
1628 p[b] = A, b = w;
1629 continue;
1630 }
1631 break;
1632 }
1633 return p[b] = M;
1634 }, y = function(p, m, b) {
1635 var E, M, A, w, I;
1636 for (b == null && (b = a), M = p.length, I = m, A = p[m], E = 2 * m + 1; E < M; )
1637 w = E + 1, w < M && !(b(p[E], p[w]) < 0) && (E = w), p[m] = p[E], m = E, E = 2 * m + 1;
1638 return p[m] = A, g(p, I, m, b);
1639 }, r = function() {
1640 p.push = o, p.pop = s, p.replace = u, p.pushpop = l, p.heapify = i, p.updateItem = d, p.nlargest = c, p.nsmallest = v;
1641 function p(m) {
1642 this.cmp = m ?? a, this.nodes = [];
1643 }
1644 return p.prototype.push = function(m) {
1645 return o(this.nodes, m, this.cmp);
1646 }, p.prototype.pop = function() {
1647 return s(this.nodes, this.cmp);
1648 }, p.prototype.peek = function() {
1649 return this.nodes[0];
1650 }, p.prototype.contains = function(m) {
1651 return this.nodes.indexOf(m) !== -1;
1652 }, p.prototype.replace = function(m) {
1653 return u(this.nodes, m, this.cmp);
1654 }, p.prototype.pushpop = function(m) {
1655 return l(this.nodes, m, this.cmp);
1656 }, p.prototype.heapify = function() {
1657 return i(this.nodes, this.cmp);
1658 }, p.prototype.updateItem = function(m) {
1659 return d(this.nodes, m, this.cmp);
1660 }, p.prototype.clear = function() {
1661 return this.nodes = [];
1662 }, p.prototype.empty = function() {
1663 return this.nodes.length === 0;
1664 }, p.prototype.size = function() {
1665 return this.nodes.length;
1666 }, p.prototype.clone = function() {
1667 var m;
1668 return m = new p(), m.nodes = this.nodes.slice(0), m;
1669 }, p.prototype.toArray = function() {
1670 return this.nodes.slice(0);
1671 }, p.prototype.insert = p.prototype.push, p.prototype.top = p.prototype.peek, p.prototype.front = p.prototype.peek, p.prototype.has = p.prototype.contains, p.prototype.copy = p.prototype.clone, p;
1672 }(), function(p, m) {
1673 return t.exports = m();
1674 }(this, function() {
1675 return r;
1676 });
1677 }).call(Sa);
1678 }), Ra = tf, rf = Lt({
1679 root: null,
1680 weight: function(e) {
1681 return 1;
1682 },
1683 directed: !1
1684 }), af = {
1685 dijkstra: function(e) {
1686 if (!L(e)) {
1687 var r = arguments;
1688 e = {
1689 root: r[0],
1690 weight: r[1],
1691 directed: r[2]
1692 };
1693 }
1694 var a = rf(e), n = a.root, i = a.weight, s = a.directed, o = this, l = i, u = j(n) ? this.filter(n)[0] : n[0], f = {}, h = {}, c = {}, v = this.byGroup(), d = v.nodes, g = v.edges;
1695 g.unmergeBy(function(re) {
1696 return re.isLoop();
1697 });
1698 for (var y = function(W) {
1699 return f[W.id()];
1700 }, p = function(W, Z) {
1701 f[W.id()] = Z, m.updateItem(W);
1702 }, m = new Ra(function(re, W) {
1703 return y(re) - y(W);
1704 }), b = 0; b < d.length; b++) {
1705 var E = d[b];
1706 f[E.id()] = E.same(u) ? 0 : 1 / 0, m.push(E);
1707 }
1708 for (var M = function(W, Z) {
1709 for (var ie = (s ? W.edgesTo(Z) : W.edgesWith(Z)).intersect(g), oe = 1 / 0, ge, se = 0; se < ie.length; se++) {
1710 var de = ie[se], we = l(de);
1711 (we < oe || !ge) && (oe = we, ge = de);
1712 }
1713 return {
1714 edge: ge,
1715 dist: oe
1716 };
1717 }; m.size() > 0; ) {
1718 var A = m.pop(), w = y(A), I = A.id();
1719 if (c[I] = w, w !== 1 / 0)
1720 for (var C = A.neighborhood().intersect(d), B = 0; B < C.length; B++) {
1721 var F = C[B], R = F.id(), X = M(A, F), z = w + X.dist;
1722 z < y(F) && (p(F, z), h[R] = {
1723 node: A,
1724 edge: X.edge
1725 });
1726 }
1727 }
1728 return {
1729 distanceTo: function(W) {
1730 var Z = j(W) ? d.filter(W)[0] : W[0];
1731 return c[Z.id()];
1732 },
1733 pathTo: function(W) {
1734 var Z = j(W) ? d.filter(W)[0] : W[0], ie = [], oe = Z, ge = oe.id();
1735 if (Z.length > 0)
1736 for (ie.unshift(Z); h[ge]; ) {
1737 var se = h[ge];
1738 ie.unshift(se.edge), ie.unshift(se.node), oe = se.node, ge = oe.id();
1739 }
1740 return o.spawn(ie);
1741 }
1742 };
1743 }
1744 }, nf = {
1745 // kruskal's algorithm (finds min spanning tree, assuming undirected graph)
1746 // implemented from pseudocode from wikipedia
1747 kruskal: function(e) {
1748 e = e || function(b) {
1749 return 1;
1750 };
1751 for (var r = this.byGroup(), a = r.nodes, n = r.edges, i = a.length, s = new Array(i), o = a, l = function(E) {
1752 for (var M = 0; M < s.length; M++) {
1753 var A = s[M];
1754 if (A.has(E))
1755 return M;
1756 }
1757 }, u = 0; u < i; u++)
1758 s[u] = this.spawn(a[u]);
1759 for (var f = n.sort(function(b, E) {
1760 return e(b) - e(E);
1761 }), h = 0; h < f.length; h++) {
1762 var c = f[h], v = c.source()[0], d = c.target()[0], g = l(v), y = l(d), p = s[g], m = s[y];
1763 g !== y && (o.merge(c), p.merge(m), s.splice(y, 1));
1764 }
1765 return o;
1766 }
1767 }, sf = Lt({
1768 root: null,
1769 goal: null,
1770 weight: function(e) {
1771 return 1;
1772 },
1773 heuristic: function(e) {
1774 return 0;
1775 },
1776 directed: !1
1777 }), of = {
1778 // Implemented from pseudocode from wikipedia
1779 aStar: function(e) {
1780 var r = this.cy(), a = sf(e), n = a.root, i = a.goal, s = a.heuristic, o = a.directed, l = a.weight;
1781 n = r.collection(n)[0], i = r.collection(i)[0];
1782 var u = n.id(), f = i.id(), h = {}, c = {}, v = {}, d = new Ra(function(ge, se) {
1783 return c[ge.id()] - c[se.id()];
1784 }), g = new Jr(), y = {}, p = {}, m = function(se, de) {
1785 d.push(se), g.add(de);
1786 }, b, E, M = function() {
1787 b = d.pop(), E = b.id(), g.delete(E);
1788 }, A = function(se) {
1789 return g.has(se);
1790 };
1791 m(n, u), h[u] = 0, c[u] = s(n);
1792 for (var w = 0; d.size() > 0; ) {
1793 if (M(), w++, E === f) {
1794 for (var I = [], C = i, B = f, F = p[B]; I.unshift(C), F != null && I.unshift(F), C = y[B], C != null; )
1795 B = C.id(), F = p[B];
1796 return {
1797 found: !0,
1798 distance: h[E],
1799 path: this.spawn(I),
1800 steps: w
1801 };
1802 }
1803 v[E] = !0;
1804 for (var R = b._private.edges, X = 0; X < R.length; X++) {
1805 var z = R[X];
1806 if (this.hasElementWithId(z.id()) && !(o && z.data("source") !== E)) {
1807 var re = z.source(), W = z.target(), Z = re.id() !== E ? re : W, ie = Z.id();
1808 if (this.hasElementWithId(ie) && !v[ie]) {
1809 var oe = h[E] + l(z);
1810 if (!A(ie)) {
1811 h[ie] = oe, c[ie] = oe + s(Z), m(Z, ie), y[ie] = b, p[ie] = z;
1812 continue;
1813 }
1814 oe < h[ie] && (h[ie] = oe, c[ie] = oe + s(Z), y[ie] = b, p[ie] = z);
1815 }
1816 }
1817 }
1818 }
1819 return {
1820 found: !1,
1821 distance: void 0,
1822 path: void 0,
1823 steps: w
1824 };
1825 }
1826 }, uf = Lt({
1827 weight: function(e) {
1828 return 1;
1829 },
1830 directed: !1
1831 }), lf = {
1832 // Implemented from pseudocode from wikipedia
1833 floydWarshall: function(e) {
1834 for (var r = this.cy(), a = uf(e), n = a.weight, i = a.directed, s = n, o = this.byGroup(), l = o.nodes, u = o.edges, f = l.length, h = f * f, c = function(we) {
1835 return l.indexOf(we);
1836 }, v = function(we) {
1837 return l[we];
1838 }, d = new Array(h), g = 0; g < h; g++) {
1839 var y = g % f, p = (g - y) / f;
1840 p === y ? d[g] = 0 : d[g] = 1 / 0;
1841 }
1842 for (var m = new Array(h), b = new Array(h), E = 0; E < u.length; E++) {
1843 var M = u[E], A = M.source()[0], w = M.target()[0];
1844 if (A !== w) {
1845 var I = c(A), C = c(w), B = I * f + C, F = s(M);
1846 if (d[B] > F && (d[B] = F, m[B] = C, b[B] = M), !i) {
1847 var R = C * f + I;
1848 !i && d[R] > F && (d[R] = F, m[R] = I, b[R] = M);
1849 }
1850 }
1851 }
1852 for (var X = 0; X < f; X++)
1853 for (var z = 0; z < f; z++)
1854 for (var re = z * f + X, W = 0; W < f; W++) {
1855 var Z = z * f + W, ie = X * f + W;
1856 d[re] + d[ie] < d[Z] && (d[Z] = d[re] + d[ie], m[Z] = m[re]);
1857 }
1858 var oe = function(we) {
1859 return (j(we) ? r.filter(we) : we)[0];
1860 }, ge = function(we) {
1861 return c(oe(we));
1862 }, se = {
1863 distance: function(we, Te) {
1864 var Ee = ge(we), ye = ge(Te);
1865 return d[Ee * f + ye];
1866 },
1867 path: function(we, Te) {
1868 var Ee = ge(we), ye = ge(Te), ae = v(Ee);
1869 if (Ee === ye)
1870 return ae.collection();
1871 if (m[Ee * f + ye] == null)
1872 return r.collection();
1873 var xe = r.collection(), Ce = Ee, Oe;
1874 for (xe.merge(ae); Ee !== ye; )
1875 Ce = Ee, Ee = m[Ee * f + ye], Oe = b[Ce * f + Ee], xe.merge(Oe), xe.merge(v(Ee));
1876 return xe;
1877 }
1878 };
1879 return se;
1880 }
1881 // floydWarshall
1882 }, ff = Lt({
1883 weight: function(e) {
1884 return 1;
1885 },
1886 directed: !1,
1887 root: null
1888 }), hf = {
1889 // Implemented from pseudocode from wikipedia
1890 bellmanFord: function(e) {
1891 var r = this, a = ff(e), n = a.weight, i = a.directed, s = a.root, o = n, l = this, u = this.cy(), f = this.byGroup(), h = f.edges, c = f.nodes, v = c.length, d = new ur(), g = !1, y = [];
1892 s = u.collection(s)[0], h.unmergeBy(function(Fe) {
1893 return Fe.isLoop();
1894 });
1895 for (var p = h.length, m = function(ke) {
1896 var Ge = d.get(ke.id());
1897 return Ge || (Ge = {}, d.set(ke.id(), Ge)), Ge;
1898 }, b = function(ke) {
1899 return (j(ke) ? u.$(ke) : ke)[0];
1900 }, E = function(ke) {
1901 return m(b(ke)).dist;
1902 }, M = function(ke) {
1903 for (var Ge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : s, et = b(ke), We = [], Ye = et; ; ) {
1904 if (Ye == null)
1905 return r.spawn();
1906 var Se = m(Ye), N = Se.edge, le = Se.pred;
1907 if (We.unshift(Ye[0]), Ye.same(Ge) && We.length > 0)
1908 break;
1909 N != null && We.unshift(N), Ye = le;
1910 }
1911 return l.spawn(We);
1912 }, A = 0; A < v; A++) {
1913 var w = c[A], I = m(w);
1914 w.same(s) ? I.dist = 0 : I.dist = 1 / 0, I.pred = null, I.edge = null;
1915 }
1916 for (var C = !1, B = function(ke, Ge, et, We, Ye, Se) {
1917 var N = We.dist + Se;
1918 N < Ye.dist && !et.same(We.edge) && (Ye.dist = N, Ye.pred = ke, Ye.edge = et, C = !0);
1919 }, F = 1; F < v; F++) {
1920 C = !1;
1921 for (var R = 0; R < p; R++) {
1922 var X = h[R], z = X.source(), re = X.target(), W = o(X), Z = m(z), ie = m(re);
1923 B(z, re, X, Z, ie, W), i || B(re, z, X, ie, Z, W);
1924 }
1925 if (!C)
1926 break;
1927 }
1928 if (C)
1929 for (var oe = [], ge = 0; ge < p; ge++) {
1930 var se = h[ge], de = se.source(), we = se.target(), Te = o(se), Ee = m(de).dist, ye = m(we).dist;
1931 if (Ee + Te < ye || !i && ye + Te < Ee)
1932 if (g || (ft("Graph contains a negative weight cycle for Bellman-Ford"), g = !0), e.findNegativeWeightCycles !== !1) {
1933 var ae = [];
1934 Ee + Te < ye && ae.push(de), !i && ye + Te < Ee && ae.push(we);
1935 for (var xe = ae.length, Ce = 0; Ce < xe; Ce++) {
1936 var Oe = ae[Ce], Ie = [Oe];
1937 Ie.push(m(Oe).edge);
1938 for (var He = m(Oe).pred; Ie.indexOf(He) === -1; )
1939 Ie.push(He), Ie.push(m(He).edge), He = m(He).pred;
1940 Ie = Ie.slice(Ie.indexOf(He));
1941 for (var qe = Ie[0].id(), Re = 0, Me = 2; Me < Ie.length; Me += 2)
1942 Ie[Me].id() < qe && (qe = Ie[Me].id(), Re = Me);
1943 Ie = Ie.slice(Re).concat(Ie.slice(0, Re)), Ie.push(Ie[0]);
1944 var Ve = Ie.map(function(Fe) {
1945 return Fe.id();
1946 }).join(",");
1947 oe.indexOf(Ve) === -1 && (y.push(l.spawn(Ie)), oe.push(Ve));
1948 }
1949 } else
1950 break;
1951 }
1952 return {
1953 distanceTo: E,
1954 pathTo: M,
1955 hasNegativeWeightCycle: g,
1956 negativeWeightCycles: y
1957 };
1958 }
1959 // bellmanFord
1960 }, cf = Math.sqrt(2), vf = function(e, r, a) {
1961 a.length === 0 && xt("Karger-Stein must be run on a connected (sub)graph");
1962 for (var n = a[e], i = n[1], s = n[2], o = r[i], l = r[s], u = a, f = u.length - 1; f >= 0; f--) {
1963 var h = u[f], c = h[1], v = h[2];
1964 (r[c] === o && r[v] === l || r[c] === l && r[v] === o) && u.splice(f, 1);
1965 }
1966 for (var d = 0; d < u.length; d++) {
1967 var g = u[d];
1968 g[1] === l ? (u[d] = g.slice(), u[d][1] = o) : g[2] === l && (u[d] = g.slice(), u[d][2] = o);
1969 }
1970 for (var y = 0; y < r.length; y++)
1971 r[y] === l && (r[y] = o);
1972 return u;
1973 }, ui = function(e, r, a, n) {
1974 for (; a > n; ) {
1975 var i = Math.floor(Math.random() * r.length);
1976 r = vf(i, e, r), a--;
1977 }
1978 return r;
1979 }, df = {
1980 // Computes the minimum cut of an undirected graph
1981 // Returns the correct answer with high probability
1982 kargerStein: function() {
1983 var e = this, r = this.byGroup(), a = r.nodes, n = r.edges;
1984 n.unmergeBy(function(ie) {
1985 return ie.isLoop();
1986 });
1987 var i = a.length, s = n.length, o = Math.ceil(Math.pow(Math.log(i) / Math.LN2, 2)), l = Math.floor(i / cf);
1988 if (i < 2) {
1989 xt("At least 2 nodes are required for Karger-Stein algorithm");
1990 return;
1991 }
1992 for (var u = [], f = 0; f < s; f++) {
1993 var h = n[f];
1994 u.push([f, a.indexOf(h.source()), a.indexOf(h.target())]);
1995 }
1996 for (var c = 1 / 0, v = [], d = new Array(i), g = new Array(i), y = new Array(i), p = function(oe, ge) {
1997 for (var se = 0; se < i; se++)
1998 ge[se] = oe[se];
1999 }, m = 0; m <= o; m++) {
2000 for (var b = 0; b < i; b++)
2001 g[b] = b;
2002 var E = ui(g, u.slice(), i, l), M = E.slice();
2003 p(g, y);
2004 var A = ui(g, E, l, 2), w = ui(y, M, l, 2);
2005 A.length <= w.length && A.length < c ? (c = A.length, v = A, p(g, d)) : w.length <= A.length && w.length < c && (c = w.length, v = w, p(y, d));
2006 }
2007 for (var I = this.spawn(v.map(function(ie) {
2008 return n[ie[0]];
2009 })), C = this.spawn(), B = this.spawn(), F = d[0], R = 0; R < d.length; R++) {
2010 var X = d[R], z = a[R];
2011 X === F ? C.merge(z) : B.merge(z);
2012 }
2013 var re = function(oe) {
2014 var ge = e.spawn();
2015 return oe.forEach(function(se) {
2016 ge.merge(se), se.connectedEdges().forEach(function(de) {
2017 e.contains(de) && !I.contains(de) && ge.merge(de);
2018 });
2019 }), ge;
2020 }, W = [re(C), re(B)], Z = {
2021 cut: I,
2022 components: W,
2023 // n.b. partitions are included to be compatible with the old api spec
2024 // (could be removed in a future major version)
2025 partition1: C,
2026 partition2: B
2027 };
2028 return Z;
2029 }
2030 }, gf = function(e) {
2031 return {
2032 x: e.x,
2033 y: e.y
2034 };
2035 }, dn = function(e, r, a) {
2036 return {
2037 x: e.x * r + a.x,
2038 y: e.y * r + a.y
2039 };
2040 }, bs = function(e, r, a) {
2041 return {
2042 x: (e.x - a.x) / r,
2043 y: (e.y - a.y) / r
2044 };
2045 }, jr = function(e) {
2046 return {
2047 x: e[0],
2048 y: e[1]
2049 };
2050 }, pf = function(e) {
2051 for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = 1 / 0, i = r; i < a; i++) {
2052 var s = e[i];
2053 isFinite(s) && (n = Math.min(s, n));
2054 }
2055 return n;
2056 }, yf = function(e) {
2057 for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = -1 / 0, i = r; i < a; i++) {
2058 var s = e[i];
2059 isFinite(s) && (n = Math.max(s, n));
2060 }
2061 return n;
2062 }, mf = function(e) {
2063 for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = 0, i = 0, s = r; s < a; s++) {
2064 var o = e[s];
2065 isFinite(o) && (n += o, i++);
2066 }
2067 return n / i;
2068 }, bf = function(e) {
2069 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0;
2070 n ? e = e.slice(r, a) : (a < e.length && e.splice(a, e.length - a), r > 0 && e.splice(0, r));
2071 for (var o = 0, l = e.length - 1; l >= 0; l--) {
2072 var u = e[l];
2073 s ? isFinite(u) || (e[l] = -1 / 0, o++) : e.splice(l, 1);
2074 }
2075 i && e.sort(function(c, v) {
2076 return c - v;
2077 });
2078 var f = e.length, h = Math.floor(f / 2);
2079 return f % 2 !== 0 ? e[h + 1 + o] : (e[h - 1 + o] + e[h + o]) / 2;
2080 }, Ef = function(e) {
2081 return Math.PI * e / 180;
2082 }, gn = function(e, r) {
2083 return Math.atan2(r, e) - Math.PI / 2;
2084 }, li = Math.log2 || function(t) {
2085 return Math.log(t) / Math.log(2);
2086 }, Es = function(e) {
2087 return e > 0 ? 1 : e < 0 ? -1 : 0;
2088 }, Pr = function(e, r) {
2089 return Math.sqrt(Br(e, r));
2090 }, Br = function(e, r) {
2091 var a = r.x - e.x, n = r.y - e.y;
2092 return a * a + n * n;
2093 }, wf = function(e) {
2094 for (var r = e.length, a = 0, n = 0; n < r; n++)
2095 a += e[n];
2096 for (var i = 0; i < r; i++)
2097 e[i] = e[i] / a;
2098 return e;
2099 }, St = function(e, r, a, n) {
2100 return (1 - n) * (1 - n) * e + 2 * (1 - n) * n * r + n * n * a;
2101 }, ea = function(e, r, a, n) {
2102 return {
2103 x: St(e.x, r.x, a.x, n),
2104 y: St(e.y, r.y, a.y, n)
2105 };
2106 }, xf = function(e, r, a, n) {
2107 var i = {
2108 x: r.x - e.x,
2109 y: r.y - e.y
2110 }, s = Pr(e, r), o = {
2111 x: i.x / s,
2112 y: i.y / s
2113 };
2114 return a = a ?? 0, n = n ?? a * s, {
2115 x: e.x + o.x * n,
2116 y: e.y + o.y * n
2117 };
2118 }, ka = function(e, r, a) {
2119 return Math.max(e, Math.min(a, r));
2120 }, Ut = function(e) {
2121 if (e == null)
2122 return {
2123 x1: 1 / 0,
2124 y1: 1 / 0,
2125 x2: -1 / 0,
2126 y2: -1 / 0,
2127 w: 0,
2128 h: 0
2129 };
2130 if (e.x1 != null && e.y1 != null) {
2131 if (e.x2 != null && e.y2 != null && e.x2 >= e.x1 && e.y2 >= e.y1)
2132 return {
2133 x1: e.x1,
2134 y1: e.y1,
2135 x2: e.x2,
2136 y2: e.y2,
2137 w: e.x2 - e.x1,
2138 h: e.y2 - e.y1
2139 };
2140 if (e.w != null && e.h != null && e.w >= 0 && e.h >= 0)
2141 return {
2142 x1: e.x1,
2143 y1: e.y1,
2144 x2: e.x1 + e.w,
2145 y2: e.y1 + e.h,
2146 w: e.w,
2147 h: e.h
2148 };
2149 }
2150 }, Tf = function(e) {
2151 return {
2152 x1: e.x1,
2153 x2: e.x2,
2154 w: e.w,
2155 y1: e.y1,
2156 y2: e.y2,
2157 h: e.h
2158 };
2159 }, Cf = function(e) {
2160 e.x1 = 1 / 0, e.y1 = 1 / 0, e.x2 = -1 / 0, e.y2 = -1 / 0, e.w = 0, e.h = 0;
2161 }, Df = function(e, r) {
2162 e.x1 = Math.min(e.x1, r.x1), e.x2 = Math.max(e.x2, r.x2), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, r.y1), e.y2 = Math.max(e.y2, r.y2), e.h = e.y2 - e.y1;
2163 }, Sf = function(e, r, a) {
2164 e.x1 = Math.min(e.x1, r), e.x2 = Math.max(e.x2, r), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, a), e.y2 = Math.max(e.y2, a), e.h = e.y2 - e.y1;
2165 }, pn = function(e) {
2166 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
2167 return e.x1 -= r, e.x2 += r, e.y1 -= r, e.y2 += r, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e;
2168 }, fi = function(e) {
2169 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0], a, n, i, s;
2170 if (r.length === 1)
2171 a = n = i = s = r[0];
2172 else if (r.length === 2)
2173 a = i = r[0], s = n = r[1];
2174 else if (r.length === 4) {
2175 var o = x(r, 4);
2176 a = o[0], n = o[1], i = o[2], s = o[3];
2177 }
2178 return e.x1 -= s, e.x2 += n, e.y1 -= a, e.y2 += i, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e;
2179 }, ws = function(e, r) {
2180 e.x1 = r.x1, e.y1 = r.y1, e.x2 = r.x2, e.y2 = r.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1;
2181 }, hi = function(e, r) {
2182 return !(e.x1 > r.x2 || r.x1 > e.x2 || e.x2 < r.x1 || r.x2 < e.x1 || e.y2 < r.y1 || r.y2 < e.y1 || e.y1 > r.y2 || r.y1 > e.y2);
2183 }, ta = function(e, r, a) {
2184 return e.x1 <= r && r <= e.x2 && e.y1 <= a && a <= e.y2;
2185 }, Lf = function(e, r) {
2186 return ta(e, r.x, r.y);
2187 }, xs = function(e, r) {
2188 return ta(e, r.x1, r.y1) && ta(e, r.x2, r.y2);
2189 }, Ts = function(e, r, a, n, i, s, o) {
2190 var l = Fa(i, s), u = i / 2, f = s / 2, h;
2191 {
2192 var c = a - u + l - o, v = n - f - o, d = a + u - l + o, g = v;
2193 if (h = Tr(e, r, a, n, c, v, d, g, !1), h.length > 0)
2194 return h;
2195 }
2196 {
2197 var y = a + u + o, p = n - f + l - o, m = y, b = n + f - l + o;
2198 if (h = Tr(e, r, a, n, y, p, m, b, !1), h.length > 0)
2199 return h;
2200 }
2201 {
2202 var E = a - u + l - o, M = n + f + o, A = a + u - l + o, w = M;
2203 if (h = Tr(e, r, a, n, E, M, A, w, !1), h.length > 0)
2204 return h;
2205 }
2206 {
2207 var I = a - u - o, C = n - f + l - o, B = I, F = n + f - l + o;
2208 if (h = Tr(e, r, a, n, I, C, B, F, !1), h.length > 0)
2209 return h;
2210 }
2211 var R;
2212 {
2213 var X = a - u + l, z = n - f + l;
2214 if (R = Pa(e, r, a, n, X, z, l + o), R.length > 0 && R[0] <= X && R[1] <= z)
2215 return [R[0], R[1]];
2216 }
2217 {
2218 var re = a + u - l, W = n - f + l;
2219 if (R = Pa(e, r, a, n, re, W, l + o), R.length > 0 && R[0] >= re && R[1] <= W)
2220 return [R[0], R[1]];
2221 }
2222 {
2223 var Z = a + u - l, ie = n + f - l;
2224 if (R = Pa(e, r, a, n, Z, ie, l + o), R.length > 0 && R[0] >= Z && R[1] >= ie)
2225 return [R[0], R[1]];
2226 }
2227 {
2228 var oe = a - u + l, ge = n + f - l;
2229 if (R = Pa(e, r, a, n, oe, ge, l + o), R.length > 0 && R[0] <= oe && R[1] >= ge)
2230 return [R[0], R[1]];
2231 }
2232 return [];
2233 }, Af = function(e, r, a, n, i, s, o) {
2234 var l = o, u = Math.min(a, i), f = Math.max(a, i), h = Math.min(n, s), c = Math.max(n, s);
2235 return u - l <= e && e <= f + l && h - l <= r && r <= c + l;
2236 }, Of = function(e, r, a, n, i, s, o, l, u) {
2237 var f = {
2238 x1: Math.min(a, o, i) - u,
2239 x2: Math.max(a, o, i) + u,
2240 y1: Math.min(n, l, s) - u,
2241 y2: Math.max(n, l, s) + u
2242 };
2243 return !(e < f.x1 || e > f.x2 || r < f.y1 || r > f.y2);
2244 }, Nf = function(e, r, a, n) {
2245 a -= n;
2246 var i = r * r - 4 * e * a;
2247 if (i < 0)
2248 return [];
2249 var s = Math.sqrt(i), o = 2 * e, l = (-r + s) / o, u = (-r - s) / o;
2250 return [l, u];
2251 }, Mf = function(e, r, a, n, i) {
2252 var s = 1e-5;
2253 e === 0 && (e = s), r /= e, a /= e, n /= e;
2254 var o, l, u, f, h, c, v, d;
2255 if (l = (3 * a - r * r) / 9, u = -(27 * n) + r * (9 * a - 2 * (r * r)), u /= 54, o = l * l * l + u * u, i[1] = 0, v = r / 3, o > 0) {
2256 h = u + Math.sqrt(o), h = h < 0 ? -Math.pow(-h, 1 / 3) : Math.pow(h, 1 / 3), c = u - Math.sqrt(o), c = c < 0 ? -Math.pow(-c, 1 / 3) : Math.pow(c, 1 / 3), i[0] = -v + h + c, v += (h + c) / 2, i[4] = i[2] = -v, v = Math.sqrt(3) * (-c + h) / 2, i[3] = v, i[5] = -v;
2257 return;
2258 }
2259 if (i[5] = i[3] = 0, o === 0) {
2260 d = u < 0 ? -Math.pow(-u, 1 / 3) : Math.pow(u, 1 / 3), i[0] = -v + 2 * d, i[4] = i[2] = -(d + v);
2261 return;
2262 }
2263 l = -l, f = l * l * l, f = Math.acos(u / Math.sqrt(f)), d = 2 * Math.sqrt(l), i[0] = -v + d * Math.cos(f / 3), i[2] = -v + d * Math.cos((f + 2 * Math.PI) / 3), i[4] = -v + d * Math.cos((f + 4 * Math.PI) / 3);
2264 }, If = function(e, r, a, n, i, s, o, l) {
2265 var u = 1 * a * a - 4 * a * i + 2 * a * o + 4 * i * i - 4 * i * o + o * o + n * n - 4 * n * s + 2 * n * l + 4 * s * s - 4 * s * l + l * l, f = 1 * 9 * a * i - 3 * a * a - 3 * a * o - 6 * i * i + 3 * i * o + 9 * n * s - 3 * n * n - 3 * n * l - 6 * s * s + 3 * s * l, h = 1 * 3 * a * a - 6 * a * i + a * o - a * e + 2 * i * i + 2 * i * e - o * e + 3 * n * n - 6 * n * s + n * l - n * r + 2 * s * s + 2 * s * r - l * r, c = 1 * a * i - a * a + a * e - i * e + n * s - n * n + n * r - s * r, v = [];
2266 Mf(u, f, h, c, v);
2267 for (var d = 1e-7, g = [], y = 0; y < 6; y += 2)
2268 Math.abs(v[y + 1]) < d && v[y] >= 0 && v[y] <= 1 && g.push(v[y]);
2269 g.push(1), g.push(0);
2270 for (var p = -1, m, b, E, M = 0; M < g.length; M++)
2271 m = Math.pow(1 - g[M], 2) * a + 2 * (1 - g[M]) * g[M] * i + g[M] * g[M] * o, b = Math.pow(1 - g[M], 2) * n + 2 * (1 - g[M]) * g[M] * s + g[M] * g[M] * l, E = Math.pow(m - e, 2) + Math.pow(b - r, 2), p >= 0 ? E < p && (p = E) : p = E;
2272 return p;
2273 }, Rf = function(e, r, a, n, i, s) {
2274 var o = [e - a, r - n], l = [i - a, s - n], u = l[0] * l[0] + l[1] * l[1], f = o[0] * o[0] + o[1] * o[1], h = o[0] * l[0] + o[1] * l[1], c = h * h / u;
2275 return h < 0 ? f : c > u ? (e - i) * (e - i) + (r - s) * (r - s) : f - c;
2276 }, Yt = function(e, r, a) {
2277 for (var n, i, s, o, l, u = 0, f = 0; f < a.length / 2; f++)
2278 if (n = a[f * 2], i = a[f * 2 + 1], f + 1 < a.length / 2 ? (s = a[(f + 1) * 2], o = a[(f + 1) * 2 + 1]) : (s = a[(f + 1 - a.length / 2) * 2], o = a[(f + 1 - a.length / 2) * 2 + 1]), !(n == e && s == e))
2279 if (n >= e && e >= s || n <= e && e <= s)
2280 l = (e - n) / (s - n) * (o - i) + i, l > r && u++;
2281 else
2282 continue;
2283 return u % 2 !== 0;
2284 }, gr = function(e, r, a, n, i, s, o, l, u) {
2285 var f = new Array(a.length), h;
2286 l[0] != null ? (h = Math.atan(l[1] / l[0]), l[0] < 0 ? h = h + Math.PI / 2 : h = -h - Math.PI / 2) : h = l;
2287 for (var c = Math.cos(-h), v = Math.sin(-h), d = 0; d < f.length / 2; d++)
2288 f[d * 2] = s / 2 * (a[d * 2] * c - a[d * 2 + 1] * v), f[d * 2 + 1] = o / 2 * (a[d * 2 + 1] * c + a[d * 2] * v), f[d * 2] += n, f[d * 2 + 1] += i;
2289 var g;
2290 if (u > 0) {
2291 var y = Ds(f, -u);
2292 g = Cs(y);
2293 } else
2294 g = f;
2295 return Yt(e, r, g);
2296 }, kf = function(e, r, a, n, i, s, o) {
2297 for (var l = new Array(a.length), u = s / 2, f = o / 2, h = di(s, o), c = h * h, v = 0; v < a.length / 4; v++) {
2298 var d = void 0, g = void 0;
2299 v === 0 ? d = a.length - 2 : d = v * 4 - 2, g = v * 4 + 2;
2300 var y = n + u * a[v * 4], p = i + f * a[v * 4 + 1], m = -a[d] * a[g] - a[d + 1] * a[g + 1], b = h / Math.tan(Math.acos(m) / 2), E = y - b * a[d], M = p - b * a[d + 1], A = y + b * a[g], w = p + b * a[g + 1];
2301 l[v * 4] = E, l[v * 4 + 1] = M, l[v * 4 + 2] = A, l[v * 4 + 3] = w;
2302 var I = a[d + 1], C = -a[d], B = I * a[g] + C * a[g + 1];
2303 B < 0 && (I *= -1, C *= -1);
2304 var F = E + I * h, R = M + C * h, X = Math.pow(F - e, 2) + Math.pow(R - r, 2);
2305 if (X <= c)
2306 return !0;
2307 }
2308 return Yt(e, r, l);
2309 }, Cs = function(e) {
2310 for (var r = new Array(e.length / 2), a, n, i, s, o, l, u, f, h = 0; h < e.length / 4; h++) {
2311 a = e[h * 4], n = e[h * 4 + 1], i = e[h * 4 + 2], s = e[h * 4 + 3], h < e.length / 4 - 1 ? (o = e[(h + 1) * 4], l = e[(h + 1) * 4 + 1], u = e[(h + 1) * 4 + 2], f = e[(h + 1) * 4 + 3]) : (o = e[0], l = e[1], u = e[2], f = e[3]);
2312 var c = Tr(a, n, i, s, o, l, u, f, !0);
2313 r[h * 2] = c[0], r[h * 2 + 1] = c[1];
2314 }
2315 return r;
2316 }, Ds = function(e, r) {
2317 for (var a = new Array(e.length * 2), n, i, s, o, l = 0; l < e.length / 2; l++) {
2318 n = e[l * 2], i = e[l * 2 + 1], l < e.length / 2 - 1 ? (s = e[(l + 1) * 2], o = e[(l + 1) * 2 + 1]) : (s = e[0], o = e[1]);
2319 var u = o - i, f = -(s - n), h = Math.sqrt(u * u + f * f), c = u / h, v = f / h;
2320 a[l * 4] = n + c * r, a[l * 4 + 1] = i + v * r, a[l * 4 + 2] = s + c * r, a[l * 4 + 3] = o + v * r;
2321 }
2322 return a;
2323 }, Pf = function(e, r, a, n, i, s) {
2324 var o = a - e, l = n - r;
2325 o /= i, l /= s;
2326 var u = Math.sqrt(o * o + l * l), f = u - 1;
2327 if (f < 0)
2328 return [];
2329 var h = f / u;
2330 return [(a - e) * h + e, (n - r) * h + r];
2331 }, Fr = function(e, r, a, n, i, s, o) {
2332 return e -= i, r -= s, e /= a / 2 + o, r /= n / 2 + o, e * e + r * r <= 1;
2333 }, Pa = function(e, r, a, n, i, s, o) {
2334 var l = [a - e, n - r], u = [e - i, r - s], f = l[0] * l[0] + l[1] * l[1], h = 2 * (u[0] * l[0] + u[1] * l[1]), c = u[0] * u[0] + u[1] * u[1] - o * o, v = h * h - 4 * f * c;
2335 if (v < 0)
2336 return [];
2337 var d = (-h + Math.sqrt(v)) / (2 * f), g = (-h - Math.sqrt(v)) / (2 * f), y = Math.min(d, g), p = Math.max(d, g), m = [];
2338 if (y >= 0 && y <= 1 && m.push(y), p >= 0 && p <= 1 && m.push(p), m.length === 0)
2339 return [];
2340 var b = m[0] * l[0] + e, E = m[0] * l[1] + r;
2341 if (m.length > 1) {
2342 if (m[0] == m[1])
2343 return [b, E];
2344 var M = m[1] * l[0] + e, A = m[1] * l[1] + r;
2345 return [b, E, M, A];
2346 } else
2347 return [b, E];
2348 }, ci = function(e, r, a) {
2349 return r <= e && e <= a || a <= e && e <= r ? e : e <= r && r <= a || a <= r && r <= e ? r : a;
2350 }, Tr = function(e, r, a, n, i, s, o, l, u) {
2351 var f = e - i, h = a - e, c = o - i, v = r - s, d = n - r, g = l - s, y = c * v - g * f, p = h * v - d * f, m = g * h - c * d;
2352 if (m !== 0) {
2353 var b = y / m, E = p / m, M = 1e-3, A = 0 - M, w = 1 + M;
2354 return A <= b && b <= w && A <= E && E <= w ? [e + b * h, r + b * d] : u ? [e + b * h, r + b * d] : [];
2355 } else
2356 return y === 0 || p === 0 ? ci(e, a, o) === o ? [o, l] : ci(e, a, i) === i ? [i, s] : ci(i, o, a) === a ? [a, n] : [] : [];
2357 }, Ba = function(e, r, a, n, i, s, o, l) {
2358 var u = [], f, h = new Array(a.length), c = !0;
2359 s == null && (c = !1);
2360 var v;
2361 if (c) {
2362 for (var d = 0; d < h.length / 2; d++)
2363 h[d * 2] = a[d * 2] * s + n, h[d * 2 + 1] = a[d * 2 + 1] * o + i;
2364 if (l > 0) {
2365 var g = Ds(h, -l);
2366 v = Cs(g);
2367 } else
2368 v = h;
2369 } else
2370 v = a;
2371 for (var y, p, m, b, E = 0; E < v.length / 2; E++)
2372 y = v[E * 2], p = v[E * 2 + 1], E < v.length / 2 - 1 ? (m = v[(E + 1) * 2], b = v[(E + 1) * 2 + 1]) : (m = v[0], b = v[1]), f = Tr(e, r, n, i, y, p, m, b), f.length !== 0 && u.push(f[0], f[1]);
2373 return u;
2374 }, Bf = function(e, r, a, n, i, s, o, l) {
2375 for (var u = [], f, h = new Array(a.length), c = s / 2, v = o / 2, d = di(s, o), g = 0; g < a.length / 4; g++) {
2376 var y = void 0, p = void 0;
2377 g === 0 ? y = a.length - 2 : y = g * 4 - 2, p = g * 4 + 2;
2378 var m = n + c * a[g * 4], b = i + v * a[g * 4 + 1], E = -a[y] * a[p] - a[y + 1] * a[p + 1], M = d / Math.tan(Math.acos(E) / 2), A = m - M * a[y], w = b - M * a[y + 1], I = m + M * a[p], C = b + M * a[p + 1];
2379 g === 0 ? (h[a.length - 2] = A, h[a.length - 1] = w) : (h[g * 4 - 2] = A, h[g * 4 - 1] = w), h[g * 4] = I, h[g * 4 + 1] = C;
2380 var B = a[y + 1], F = -a[y], R = B * a[p] + F * a[p + 1];
2381 R < 0 && (B *= -1, F *= -1);
2382 var X = A + B * d, z = w + F * d;
2383 f = Pa(e, r, n, i, X, z, d), f.length !== 0 && u.push(f[0], f[1]);
2384 }
2385 for (var re = 0; re < h.length / 4; re++)
2386 f = Tr(e, r, n, i, h[re * 4], h[re * 4 + 1], h[re * 4 + 2], h[re * 4 + 3], !1), f.length !== 0 && u.push(f[0], f[1]);
2387 if (u.length > 2) {
2388 for (var W = [u[0], u[1]], Z = Math.pow(W[0] - e, 2) + Math.pow(W[1] - r, 2), ie = 1; ie < u.length / 2; ie++) {
2389 var oe = Math.pow(u[ie * 2] - e, 2) + Math.pow(u[ie * 2 + 1] - r, 2);
2390 oe <= Z && (W[0] = u[ie * 2], W[1] = u[ie * 2 + 1], Z = oe);
2391 }
2392 return W;
2393 }
2394 return u;
2395 }, yn = function(e, r, a) {
2396 var n = [e[0] - r[0], e[1] - r[1]], i = Math.sqrt(n[0] * n[0] + n[1] * n[1]), s = (i - a) / i;
2397 return s < 0 && (s = 1e-5), [r[0] + s * n[0], r[1] + s * n[1]];
2398 }, $t = function(e, r) {
2399 var a = vi(e, r);
2400 return a = Ss(a), a;
2401 }, Ss = function(e) {
2402 for (var r, a, n = e.length / 2, i = 1 / 0, s = 1 / 0, o = -1 / 0, l = -1 / 0, u = 0; u < n; u++)
2403 r = e[2 * u], a = e[2 * u + 1], i = Math.min(i, r), o = Math.max(o, r), s = Math.min(s, a), l = Math.max(l, a);
2404 for (var f = 2 / (o - i), h = 2 / (l - s), c = 0; c < n; c++)
2405 r = e[2 * c] = e[2 * c] * f, a = e[2 * c + 1] = e[2 * c + 1] * h, i = Math.min(i, r), o = Math.max(o, r), s = Math.min(s, a), l = Math.max(l, a);
2406 if (s < -1)
2407 for (var v = 0; v < n; v++)
2408 a = e[2 * v + 1] = e[2 * v + 1] + (-1 - s);
2409 return e;
2410 }, vi = function(e, r) {
2411 var a = 1 / e * 2 * Math.PI, n = e % 2 === 0 ? Math.PI / 2 + a / 2 : Math.PI / 2;
2412 n += r;
2413 for (var i = new Array(e * 2), s, o = 0; o < e; o++)
2414 s = o * a + n, i[2 * o] = Math.cos(s), i[2 * o + 1] = Math.sin(-s);
2415 return i;
2416 }, Fa = function(e, r) {
2417 return Math.min(e / 4, r / 4, 8);
2418 }, di = function(e, r) {
2419 return Math.min(e / 10, r / 10, 8);
2420 }, Ls = function() {
2421 return 8;
2422 }, Ff = function(e, r, a) {
2423 return [e - 2 * r + a, 2 * (r - e), e];
2424 }, gi = function(e, r) {
2425 return {
2426 heightOffset: Math.min(15, 0.05 * r),
2427 widthOffset: Math.min(100, 0.25 * e),
2428 ctrlPtOffsetPct: 0.05
2429 };
2430 }, zf = Lt({
2431 dampingFactor: 0.8,
2432 precision: 1e-6,
2433 iterations: 200,
2434 weight: function(e) {
2435 return 1;
2436 }
2437 }), Gf = {
2438 pageRank: function(e) {
2439 for (var r = zf(e), a = r.dampingFactor, n = r.precision, i = r.iterations, s = r.weight, o = this._private.cy, l = this.byGroup(), u = l.nodes, f = l.edges, h = u.length, c = h * h, v = f.length, d = new Array(c), g = new Array(h), y = (1 - a) / h, p = 0; p < h; p++) {
2440 for (var m = 0; m < h; m++) {
2441 var b = p * h + m;
2442 d[b] = 0;
2443 }
2444 g[p] = 0;
2445 }
2446 for (var E = 0; E < v; E++) {
2447 var M = f[E], A = M.data("source"), w = M.data("target");
2448 if (A !== w) {
2449 var I = u.indexOfId(A), C = u.indexOfId(w), B = s(M), F = C * h + I;
2450 d[F] += B, g[I] += B;
2451 }
2452 }
2453 for (var R = 1 / h + y, X = 0; X < h; X++)
2454 if (g[X] === 0)
2455 for (var z = 0; z < h; z++) {
2456 var re = z * h + X;
2457 d[re] = R;
2458 }
2459 else
2460 for (var W = 0; W < h; W++) {
2461 var Z = W * h + X;
2462 d[Z] = d[Z] / g[X] + y;
2463 }
2464 for (var ie = new Array(h), oe = new Array(h), ge, se = 0; se < h; se++)
2465 ie[se] = 1;
2466 for (var de = 0; de < i; de++) {
2467 for (var we = 0; we < h; we++)
2468 oe[we] = 0;
2469 for (var Te = 0; Te < h; Te++)
2470 for (var Ee = 0; Ee < h; Ee++) {
2471 var ye = Te * h + Ee;
2472 oe[Te] += d[ye] * ie[Ee];
2473 }
2474 wf(oe), ge = ie, ie = oe, oe = ge;
2475 for (var ae = 0, xe = 0; xe < h; xe++) {
2476 var Ce = ge[xe] - ie[xe];
2477 ae += Ce * Ce;
2478 }
2479 if (ae < n)
2480 break;
2481 }
2482 var Oe = {
2483 rank: function(He) {
2484 return He = o.collection(He)[0], ie[u.indexOf(He)];
2485 }
2486 };
2487 return Oe;
2488 }
2489 // pageRank
2490 }, As = Lt({
2491 root: null,
2492 weight: function(e) {
2493 return 1;
2494 },
2495 directed: !1,
2496 alpha: 0
2497 }), ra = {
2498 degreeCentralityNormalized: function(e) {
2499 e = As(e);
2500 var r = this.cy(), a = this.nodes(), n = a.length;
2501 if (e.directed) {
2502 for (var f = {}, h = {}, c = 0, v = 0, d = 0; d < n; d++) {
2503 var g = a[d], y = g.id();
2504 e.root = g;
2505 var p = this.degreeCentrality(e);
2506 c < p.indegree && (c = p.indegree), v < p.outdegree && (v = p.outdegree), f[y] = p.indegree, h[y] = p.outdegree;
2507 }
2508 return {
2509 indegree: function(b) {
2510 return c == 0 ? 0 : (j(b) && (b = r.filter(b)), f[b.id()] / c);
2511 },
2512 outdegree: function(b) {
2513 return v === 0 ? 0 : (j(b) && (b = r.filter(b)), h[b.id()] / v);
2514 }
2515 };
2516 } else {
2517 for (var i = {}, s = 0, o = 0; o < n; o++) {
2518 var l = a[o];
2519 e.root = l;
2520 var u = this.degreeCentrality(e);
2521 s < u.degree && (s = u.degree), i[l.id()] = u.degree;
2522 }
2523 return {
2524 degree: function(b) {
2525 return s === 0 ? 0 : (j(b) && (b = r.filter(b)), i[b.id()] / s);
2526 }
2527 };
2528 }
2529 },
2530 // degreeCentralityNormalized
2531 // Implemented from the algorithm in Opsahl's paper
2532 // "Node centrality in weighted networks: Generalizing degree and shortest paths"
2533 // check the heading 2 "Degree"
2534 degreeCentrality: function(e) {
2535 e = As(e);
2536 var r = this.cy(), a = this, n = e, i = n.root, s = n.weight, o = n.directed, l = n.alpha;
2537 if (i = r.collection(i)[0], o) {
2538 for (var v = i.connectedEdges(), d = v.filter(function(A) {
2539 return A.target().same(i) && a.has(A);
2540 }), g = v.filter(function(A) {
2541 return A.source().same(i) && a.has(A);
2542 }), y = d.length, p = g.length, m = 0, b = 0, E = 0; E < d.length; E++)
2543 m += s(d[E]);
2544 for (var M = 0; M < g.length; M++)
2545 b += s(g[M]);
2546 return {
2547 indegree: Math.pow(y, 1 - l) * Math.pow(m, l),
2548 outdegree: Math.pow(p, 1 - l) * Math.pow(b, l)
2549 };
2550 } else {
2551 for (var u = i.connectedEdges().intersection(a), f = u.length, h = 0, c = 0; c < u.length; c++)
2552 h += s(u[c]);
2553 return {
2554 degree: Math.pow(f, 1 - l) * Math.pow(h, l)
2555 };
2556 }
2557 }
2558 // degreeCentrality
2559 };
2560 ra.dc = ra.degreeCentrality, ra.dcn = ra.degreeCentralityNormalised = ra.degreeCentralityNormalized;
2561 var Os = Lt({
2562 harmonic: !0,
2563 weight: function() {
2564 return 1;
2565 },
2566 directed: !1,
2567 root: null
2568 }), aa = {
2569 closenessCentralityNormalized: function(e) {
2570 for (var r = Os(e), a = r.harmonic, n = r.weight, i = r.directed, s = this.cy(), o = {}, l = 0, u = this.nodes(), f = this.floydWarshall({
2571 weight: n,
2572 directed: i
2573 }), h = 0; h < u.length; h++) {
2574 for (var c = 0, v = u[h], d = 0; d < u.length; d++)
2575 if (h !== d) {
2576 var g = f.distance(v, u[d]);
2577 a ? c += 1 / g : c += g;
2578 }
2579 a || (c = 1 / c), l < c && (l = c), o[v.id()] = c;
2580 }
2581 return {
2582 closeness: function(p) {
2583 return l == 0 ? 0 : (j(p) ? p = s.filter(p)[0].id() : p = p.id(), o[p] / l);
2584 }
2585 };
2586 },
2587 // Implemented from pseudocode from wikipedia
2588 closenessCentrality: function(e) {
2589 var r = Os(e), a = r.root, n = r.weight, i = r.directed, s = r.harmonic;
2590 a = this.filter(a)[0];
2591 for (var o = this.dijkstra({
2592 root: a,
2593 weight: n,
2594 directed: i
2595 }), l = 0, u = this.nodes(), f = 0; f < u.length; f++) {
2596 var h = u[f];
2597 if (!h.same(a)) {
2598 var c = o.distanceTo(h);
2599 s ? l += 1 / c : l += c;
2600 }
2601 }
2602 return s ? l : 1 / l;
2603 }
2604 // closenessCentrality
2605 };
2606 aa.cc = aa.closenessCentrality, aa.ccn = aa.closenessCentralityNormalised = aa.closenessCentralityNormalized;
2607 var $f = Lt({
2608 weight: null,
2609 directed: !1
2610 }), pi = {
2611 // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes
2612 betweennessCentrality: function(e) {
2613 for (var r = $f(e), a = r.directed, n = r.weight, i = n != null, s = this.cy(), o = this.nodes(), l = {}, u = {}, f = 0, h = {
2614 set: function(b, E) {
2615 u[b] = E, E > f && (f = E);
2616 },
2617 get: function(b) {
2618 return u[b];
2619 }
2620 }, c = 0; c < o.length; c++) {
2621 var v = o[c], d = v.id();
2622 a ? l[d] = v.outgoers().nodes() : l[d] = v.openNeighborhood().nodes(), h.set(d, 0);
2623 }
2624 for (var g = function(b) {
2625 for (var E = o[b].id(), M = [], A = {}, w = {}, I = {}, C = new Ra(function(Ee, ye) {
2626 return I[Ee] - I[ye];
2627 }), B = 0; B < o.length; B++) {
2628 var F = o[B].id();
2629 A[F] = [], w[F] = 0, I[F] = 1 / 0;
2630 }
2631 for (w[E] = 1, I[E] = 0, C.push(E); !C.empty(); ) {
2632 var R = C.pop();
2633 if (M.push(R), i)
2634 for (var X = 0; X < l[R].length; X++) {
2635 var z = l[R][X], re = s.getElementById(R), W = void 0;
2636 re.edgesTo(z).length > 0 ? W = re.edgesTo(z)[0] : W = z.edgesTo(re)[0];
2637 var Z = n(W);
2638 z = z.id(), I[z] > I[R] + Z && (I[z] = I[R] + Z, C.nodes.indexOf(z) < 0 ? C.push(z) : C.updateItem(z), w[z] = 0, A[z] = []), I[z] == I[R] + Z && (w[z] = w[z] + w[R], A[z].push(R));
2639 }
2640 else
2641 for (var ie = 0; ie < l[R].length; ie++) {
2642 var oe = l[R][ie].id();
2643 I[oe] == 1 / 0 && (C.push(oe), I[oe] = I[R] + 1), I[oe] == I[R] + 1 && (w[oe] = w[oe] + w[R], A[oe].push(R));
2644 }
2645 }
2646 for (var ge = {}, se = 0; se < o.length; se++)
2647 ge[o[se].id()] = 0;
2648 for (; M.length > 0; ) {
2649 for (var de = M.pop(), we = 0; we < A[de].length; we++) {
2650 var Te = A[de][we];
2651 ge[Te] = ge[Te] + w[Te] / w[de] * (1 + ge[de]);
2652 }
2653 de != o[b].id() && h.set(de, h.get(de) + ge[de]);
2654 }
2655 }, y = 0; y < o.length; y++)
2656 g(y);
2657 var p = {
2658 betweenness: function(b) {
2659 var E = s.collection(b).id();
2660 return h.get(E);
2661 },
2662 betweennessNormalized: function(b) {
2663 if (f == 0)
2664 return 0;
2665 var E = s.collection(b).id();
2666 return h.get(E) / f;
2667 }
2668 };
2669 return p.betweennessNormalised = p.betweennessNormalized, p;
2670 }
2671 // betweennessCentrality
2672 };
2673 pi.bc = pi.betweennessCentrality;
2674 var Vf = Lt({
2675 expandFactor: 2,
2676 // affects time of computation and cluster granularity to some extent: M * M
2677 inflateFactor: 2,
2678 // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j)
2679 multFactor: 1,
2680 // optional self loops for each node. Use a neutral value to improve cluster computations.
2681 maxIterations: 20,
2682 // maximum number of iterations of the MCL algorithm in a single run
2683 attributes: [
2684 // attributes/features used to group nodes, ie. similarity values between nodes
2685 function(t) {
2686 return 1;
2687 }
2688 ]
2689 }), _f = function(e) {
2690 return Vf(e);
2691 }, Uf = function(e, r) {
2692 for (var a = 0, n = 0; n < r.length; n++)
2693 a += r[n](e);
2694 return a;
2695 }, Yf = function(e, r, a) {
2696 for (var n = 0; n < r; n++)
2697 e[n * r + n] = a;
2698 }, Ns = function(e, r) {
2699 for (var a, n = 0; n < r; n++) {
2700 a = 0;
2701 for (var i = 0; i < r; i++)
2702 a += e[i * r + n];
2703 for (var s = 0; s < r; s++)
2704 e[s * r + n] = e[s * r + n] / a;
2705 }
2706 }, Hf = function(e, r, a) {
2707 for (var n = new Array(a * a), i = 0; i < a; i++) {
2708 for (var s = 0; s < a; s++)
2709 n[i * a + s] = 0;
2710 for (var o = 0; o < a; o++)
2711 for (var l = 0; l < a; l++)
2712 n[i * a + l] += e[i * a + o] * r[o * a + l];
2713 }
2714 return n;
2715 }, Xf = function(e, r, a) {
2716 for (var n = e.slice(0), i = 1; i < a; i++)
2717 e = Hf(e, n, r);
2718 return e;
2719 }, qf = function(e, r, a) {
2720 for (var n = new Array(r * r), i = 0; i < r * r; i++)
2721 n[i] = Math.pow(e[i], a);
2722 return Ns(n, r), n;
2723 }, Wf = function(e, r, a, n) {
2724 for (var i = 0; i < a; i++) {
2725 var s = Math.round(e[i] * Math.pow(10, n)) / Math.pow(10, n), o = Math.round(r[i] * Math.pow(10, n)) / Math.pow(10, n);
2726 if (s !== o)
2727 return !1;
2728 }
2729 return !0;
2730 }, Kf = function(e, r, a, n) {
2731 for (var i = [], s = 0; s < r; s++) {
2732 for (var o = [], l = 0; l < r; l++)
2733 Math.round(e[s * r + l] * 1e3) / 1e3 > 0 && o.push(a[l]);
2734 o.length !== 0 && i.push(n.collection(o));
2735 }
2736 return i;
2737 }, Zf = function(e, r) {
2738 for (var a = 0; a < e.length; a++)
2739 if (!r[a] || e[a].id() !== r[a].id())
2740 return !1;
2741 return !0;
2742 }, Qf = function(e) {
2743 for (var r = 0; r < e.length; r++)
2744 for (var a = 0; a < e.length; a++)
2745 r != a && Zf(e[r], e[a]) && e.splice(a, 1);
2746 return e;
2747 }, Ms = function(e) {
2748 for (var r = this.nodes(), a = this.edges(), n = this.cy(), i = _f(e), s = {}, o = 0; o < r.length; o++)
2749 s[r[o].id()] = o;
2750 for (var l = r.length, u = l * l, f = new Array(u), h, c = 0; c < u; c++)
2751 f[c] = 0;
2752 for (var v = 0; v < a.length; v++) {
2753 var d = a[v], g = s[d.source().id()], y = s[d.target().id()], p = Uf(d, i.attributes);
2754 f[g * l + y] += p, f[y * l + g] += p;
2755 }
2756 Yf(f, l, i.multFactor), Ns(f, l);
2757 for (var m = !0, b = 0; m && b < i.maxIterations; )
2758 m = !1, h = Xf(f, l, i.expandFactor), f = qf(h, l, i.inflateFactor), Wf(f, h, u, 4) || (m = !0), b++;
2759 var E = Kf(f, l, r, n);
2760 return E = Qf(E), E;
2761 }, Jf = {
2762 markovClustering: Ms,
2763 mcl: Ms
2764 }, jf = function(e) {
2765 return e;
2766 }, Is = function(e, r) {
2767 return Math.abs(r - e);
2768 }, Rs = function(e, r, a) {
2769 return e + Is(r, a);
2770 }, ks = function(e, r, a) {
2771 return e + Math.pow(a - r, 2);
2772 }, eh = function(e) {
2773 return Math.sqrt(e);
2774 }, th = function(e, r, a) {
2775 return Math.max(e, Is(r, a));
2776 }, za = function(e, r, a, n, i) {
2777 for (var s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : jf, o = n, l, u, f = 0; f < e; f++)
2778 l = r(f), u = a(f), o = i(o, l, u);
2779 return s(o);
2780 }, na = {
2781 euclidean: function(e, r, a) {
2782 return e >= 2 ? za(e, r, a, 0, ks, eh) : za(e, r, a, 0, Rs);
2783 },
2784 squaredEuclidean: function(e, r, a) {
2785 return za(e, r, a, 0, ks);
2786 },
2787 manhattan: function(e, r, a) {
2788 return za(e, r, a, 0, Rs);
2789 },
2790 max: function(e, r, a) {
2791 return za(e, r, a, -1 / 0, th);
2792 }
2793 };
2794 na["squared-euclidean"] = na.squaredEuclidean, na.squaredeuclidean = na.squaredEuclidean;
2795 function mn(t, e, r, a, n, i) {
2796 var s;
2797 return Y(t) ? s = t : s = na[t] || na.euclidean, e === 0 && Y(t) ? s(n, i) : s(e, r, a, n, i);
2798 }
2799 var rh = Lt({
2800 k: 2,
2801 m: 2,
2802 sensitivityThreshold: 1e-4,
2803 distance: "euclidean",
2804 maxIterations: 10,
2805 attributes: [],
2806 testMode: !1,
2807 testCentroids: null
2808 }), yi = function(e) {
2809 return rh(e);
2810 }, bn = function(e, r, a, n, i) {
2811 var s = i !== "kMedoids", o = s ? function(h) {
2812 return a[h];
2813 } : function(h) {
2814 return n[h](a);
2815 }, l = function(c) {
2816 return n[c](r);
2817 }, u = a, f = r;
2818 return mn(e, n.length, o, l, u, f);
2819 }, mi = function(e, r, a) {
2820 for (var n = a.length, i = new Array(n), s = new Array(n), o = new Array(r), l = null, u = 0; u < n; u++)
2821 i[u] = e.min(a[u]).value, s[u] = e.max(a[u]).value;
2822 for (var f = 0; f < r; f++) {
2823 l = [];
2824 for (var h = 0; h < n; h++)
2825 l[h] = Math.random() * (s[h] - i[h]) + i[h];
2826 o[f] = l;
2827 }
2828 return o;
2829 }, Ps = function(e, r, a, n, i) {
2830 for (var s = 1 / 0, o = 0, l = 0; l < r.length; l++) {
2831 var u = bn(a, e, r[l], n, i);
2832 u < s && (s = u, o = l);
2833 }
2834 return o;
2835 }, Bs = function(e, r, a) {
2836 for (var n = [], i = null, s = 0; s < r.length; s++)
2837 i = r[s], a[i.id()] === e && n.push(i);
2838 return n;
2839 }, ah = function(e, r, a) {
2840 return Math.abs(r - e) <= a;
2841 }, nh = function(e, r, a) {
2842 for (var n = 0; n < e.length; n++)
2843 for (var i = 0; i < e[n].length; i++) {
2844 var s = Math.abs(e[n][i] - r[n][i]);
2845 if (s > a)
2846 return !1;
2847 }
2848 return !0;
2849 }, ih = function(e, r, a) {
2850 for (var n = 0; n < a; n++)
2851 if (e === r[n])
2852 return !0;
2853 return !1;
2854 }, Fs = function(e, r) {
2855 var a = new Array(r);
2856 if (e.length < 50)
2857 for (var n = 0; n < r; n++) {
2858 for (var i = e[Math.floor(Math.random() * e.length)]; ih(i, a, n); )
2859 i = e[Math.floor(Math.random() * e.length)];
2860 a[n] = i;
2861 }
2862 else
2863 for (var s = 0; s < r; s++)
2864 a[s] = e[Math.floor(Math.random() * e.length)];
2865 return a;
2866 }, zs = function(e, r, a) {
2867 for (var n = 0, i = 0; i < r.length; i++)
2868 n += bn("manhattan", r[i], e, a, "kMedoids");
2869 return n;
2870 }, sh = function(e) {
2871 var r = this.cy(), a = this.nodes(), n = null, i = yi(e), s = new Array(i.k), o = {}, l;
2872 i.testMode ? typeof i.testCentroids == "number" ? (i.testCentroids, l = mi(a, i.k, i.attributes)) : ee(i.testCentroids) === "object" ? l = i.testCentroids : l = mi(a, i.k, i.attributes) : l = mi(a, i.k, i.attributes);
2873 for (var u = !0, f = 0; u && f < i.maxIterations; ) {
2874 for (var h = 0; h < a.length; h++)
2875 n = a[h], o[n.id()] = Ps(n, l, i.distance, i.attributes, "kMeans");
2876 u = !1;
2877 for (var c = 0; c < i.k; c++) {
2878 var v = Bs(c, a, o);
2879 if (v.length !== 0) {
2880 for (var d = i.attributes.length, g = l[c], y = new Array(d), p = new Array(d), m = 0; m < d; m++) {
2881 p[m] = 0;
2882 for (var b = 0; b < v.length; b++)
2883 n = v[b], p[m] += i.attributes[m](n);
2884 y[m] = p[m] / v.length, ah(y[m], g[m], i.sensitivityThreshold) || (u = !0);
2885 }
2886 l[c] = y, s[c] = r.collection(v);
2887 }
2888 }
2889 f++;
2890 }
2891 return s;
2892 }, oh = function(e) {
2893 var r = this.cy(), a = this.nodes(), n = null, i = yi(e), s = new Array(i.k), o, l = {}, u, f = new Array(i.k);
2894 i.testMode ? typeof i.testCentroids == "number" || (ee(i.testCentroids) === "object" ? o = i.testCentroids : o = Fs(a, i.k)) : o = Fs(a, i.k);
2895 for (var h = !0, c = 0; h && c < i.maxIterations; ) {
2896 for (var v = 0; v < a.length; v++)
2897 n = a[v], l[n.id()] = Ps(n, o, i.distance, i.attributes, "kMedoids");
2898 h = !1;
2899 for (var d = 0; d < o.length; d++) {
2900 var g = Bs(d, a, l);
2901 if (g.length !== 0) {
2902 f[d] = zs(o[d], g, i.attributes);
2903 for (var y = 0; y < g.length; y++)
2904 u = zs(g[y], g, i.attributes), u < f[d] && (f[d] = u, o[d] = g[y], h = !0);
2905 s[d] = r.collection(g);
2906 }
2907 }
2908 c++;
2909 }
2910 return s;
2911 }, uh = function(e, r, a, n, i) {
2912 for (var s, o, l = 0; l < r.length; l++)
2913 for (var u = 0; u < e.length; u++)
2914 n[l][u] = Math.pow(a[l][u], i.m);
2915 for (var f = 0; f < e.length; f++)
2916 for (var h = 0; h < i.attributes.length; h++) {
2917 s = 0, o = 0;
2918 for (var c = 0; c < r.length; c++)
2919 s += n[c][f] * i.attributes[h](r[c]), o += n[c][f];
2920 e[f][h] = s / o;
2921 }
2922 }, lh = function(e, r, a, n, i) {
2923 for (var s = 0; s < e.length; s++)
2924 r[s] = e[s].slice();
2925 for (var o, l, u, f = 2 / (i.m - 1), h = 0; h < a.length; h++)
2926 for (var c = 0; c < n.length; c++) {
2927 o = 0;
2928 for (var v = 0; v < a.length; v++)
2929 l = bn(i.distance, n[c], a[h], i.attributes, "cmeans"), u = bn(i.distance, n[c], a[v], i.attributes, "cmeans"), o += Math.pow(l / u, f);
2930 e[c][h] = 1 / o;
2931 }
2932 }, fh = function(e, r, a, n) {
2933 for (var i = new Array(a.k), s = 0; s < i.length; s++)
2934 i[s] = [];
2935 for (var o, l, u = 0; u < r.length; u++) {
2936 o = -1 / 0, l = -1;
2937 for (var f = 0; f < r[0].length; f++)
2938 r[u][f] > o && (o = r[u][f], l = f);
2939 i[l].push(e[u]);
2940 }
2941 for (var h = 0; h < i.length; h++)
2942 i[h] = n.collection(i[h]);
2943 return i;
2944 }, Gs = function(e) {
2945 var r = this.cy(), a = this.nodes(), n = yi(e), i, s, o, l, u;
2946 l = new Array(a.length);
2947 for (var f = 0; f < a.length; f++)
2948 l[f] = new Array(n.k);
2949 o = new Array(a.length);
2950 for (var h = 0; h < a.length; h++)
2951 o[h] = new Array(n.k);
2952 for (var c = 0; c < a.length; c++) {
2953 for (var v = 0, d = 0; d < n.k; d++)
2954 o[c][d] = Math.random(), v += o[c][d];
2955 for (var g = 0; g < n.k; g++)
2956 o[c][g] = o[c][g] / v;
2957 }
2958 s = new Array(n.k);
2959 for (var y = 0; y < n.k; y++)
2960 s[y] = new Array(n.attributes.length);
2961 u = new Array(a.length);
2962 for (var p = 0; p < a.length; p++)
2963 u[p] = new Array(n.k);
2964 for (var m = !0, b = 0; m && b < n.maxIterations; )
2965 m = !1, uh(s, a, o, u, n), lh(o, l, s, a, n), nh(o, l, n.sensitivityThreshold) || (m = !0), b++;
2966 return i = fh(a, o, n, r), {
2967 clusters: i,
2968 degreeOfMembership: o
2969 };
2970 }, hh = {
2971 kMeans: sh,
2972 kMedoids: oh,
2973 fuzzyCMeans: Gs,
2974 fcm: Gs
2975 }, ch = Lt({
2976 distance: "euclidean",
2977 // distance metric to compare nodes
2978 linkage: "min",
2979 // linkage criterion : how to determine the distance between clusters of nodes
2980 mode: "threshold",
2981 // mode:'threshold' => clusters must be threshold distance apart
2982 threshold: 1 / 0,
2983 // the distance threshold
2984 // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters
2985 addDendrogram: !1,
2986 // whether to add the dendrogram to the graph for viz
2987 dendrogramDepth: 0,
2988 // depth at which dendrogram branches are merged into the returned clusters
2989 attributes: []
2990 // array of attr functions
2991 }), vh = {
2992 single: "min",
2993 complete: "max"
2994 }, dh = function(e) {
2995 var r = ch(e), a = vh[r.linkage];
2996 return a != null && (r.linkage = a), r;
2997 }, $s = function(e, r, a, n, i) {
2998 for (var s = 0, o = 1 / 0, l, u = i.attributes, f = function(C, B) {
2999 return mn(i.distance, u.length, function(F) {
3000 return u[F](C);
3001 }, function(F) {
3002 return u[F](B);
3003 }, C, B);
3004 }, h = 0; h < e.length; h++) {
3005 var c = e[h].key, v = a[c][n[c]];
3006 v < o && (s = c, o = v);
3007 }
3008 if (i.mode === "threshold" && o >= i.threshold || i.mode === "dendrogram" && e.length === 1)
3009 return !1;
3010 var d = r[s], g = r[n[s]], y;
3011 i.mode === "dendrogram" ? y = {
3012 left: d,
3013 right: g,
3014 key: d.key
3015 } : y = {
3016 value: d.value.concat(g.value),
3017 key: d.key
3018 }, e[d.index] = y, e.splice(g.index, 1), r[d.key] = y;
3019 for (var p = 0; p < e.length; p++) {
3020 var m = e[p];
3021 d.key === m.key ? l = 1 / 0 : i.linkage === "min" ? (l = a[d.key][m.key], a[d.key][m.key] > a[g.key][m.key] && (l = a[g.key][m.key])) : i.linkage === "max" ? (l = a[d.key][m.key], a[d.key][m.key] < a[g.key][m.key] && (l = a[g.key][m.key])) : i.linkage === "mean" ? l = (a[d.key][m.key] * d.size + a[g.key][m.key] * g.size) / (d.size + g.size) : i.mode === "dendrogram" ? l = f(m.value, d.value) : l = f(m.value[0], d.value[0]), a[d.key][m.key] = a[m.key][d.key] = l;
3022 }
3023 for (var b = 0; b < e.length; b++) {
3024 var E = e[b].key;
3025 if (n[E] === d.key || n[E] === g.key) {
3026 for (var M = E, A = 0; A < e.length; A++) {
3027 var w = e[A].key;
3028 a[E][w] < a[E][M] && (M = w);
3029 }
3030 n[E] = M;
3031 }
3032 e[b].index = b;
3033 }
3034 return d.key = g.key = d.index = g.index = null, !0;
3035 }, En = function t(e, r, a) {
3036 e && (e.value ? r.push(e.value) : (e.left && t(e.left, r), e.right && t(e.right, r)));
3037 }, gh = function t(e, r) {
3038 if (!e)
3039 return "";
3040 if (e.left && e.right) {
3041 var a = t(e.left, r), n = t(e.right, r), i = r.add({
3042 group: "nodes",
3043 data: {
3044 id: a + "," + n
3045 }
3046 });
3047 return r.add({
3048 group: "edges",
3049 data: {
3050 source: a,
3051 target: i.id()
3052 }
3053 }), r.add({
3054 group: "edges",
3055 data: {
3056 source: n,
3057 target: i.id()
3058 }
3059 }), i.id();
3060 } else if (e.value)
3061 return e.value.id();
3062 }, ph = function t(e, r, a) {
3063 if (!e)
3064 return [];
3065 var n = [], i = [], s = [];
3066 return r === 0 ? (e.left && En(e.left, n), e.right && En(e.right, i), s = n.concat(i), [a.collection(s)]) : r === 1 ? e.value ? [a.collection(e.value)] : (e.left && En(e.left, n), e.right && En(e.right, i), [a.collection(n), a.collection(i)]) : e.value ? [a.collection(e.value)] : (e.left && (n = t(e.left, r - 1, a)), e.right && (i = t(e.right, r - 1, a)), n.concat(i));
3067 }, Vs = function(e) {
3068 for (var r = this.cy(), a = this.nodes(), n = dh(e), i = n.attributes, s = function(b, E) {
3069 return mn(n.distance, i.length, function(M) {
3070 return i[M](b);
3071 }, function(M) {
3072 return i[M](E);
3073 }, b, E);
3074 }, o = [], l = [], u = [], f = [], h = 0; h < a.length; h++) {
3075 var c = {
3076 value: n.mode === "dendrogram" ? a[h] : [a[h]],
3077 key: h,
3078 index: h
3079 };
3080 o[h] = c, f[h] = c, l[h] = [], u[h] = 0;
3081 }
3082 for (var v = 0; v < o.length; v++)
3083 for (var d = 0; d <= v; d++) {
3084 var g = void 0;
3085 n.mode === "dendrogram" ? g = v === d ? 1 / 0 : s(o[v].value, o[d].value) : g = v === d ? 1 / 0 : s(o[v].value[0], o[d].value[0]), l[v][d] = g, l[d][v] = g, g < l[v][u[v]] && (u[v] = d);
3086 }
3087 for (var y = $s(o, f, l, u, n); y; )
3088 y = $s(o, f, l, u, n);
3089 var p;
3090 return n.mode === "dendrogram" ? (p = ph(o[0], n.dendrogramDepth, r), n.addDendrogram && gh(o[0], r)) : (p = new Array(o.length), o.forEach(function(m, b) {
3091 m.key = m.index = null, p[b] = r.collection(m.value);
3092 })), p;
3093 }, yh = {
3094 hierarchicalClustering: Vs,
3095 hca: Vs
3096 }, mh = Lt({
3097 distance: "euclidean",
3098 // distance metric to compare attributes between two nodes
3099 preference: "median",
3100 // suitability of a data point to serve as an exemplar
3101 damping: 0.8,
3102 // damping factor between [0.5, 1)
3103 maxIterations: 1e3,
3104 // max number of iterations to run
3105 minIterations: 100,
3106 // min number of iterations to run in order for clustering to stop
3107 attributes: [
3108 // functions to quantify the similarity between any two points
3109 // e.g. node => node.data('weight')
3110 ]
3111 }), bh = function(e) {
3112 var r = e.damping, a = e.preference;
3113 0.5 <= r && r < 1 || xt("Damping must range on [0.5, 1). Got: ".concat(r));
3114 var n = ["median", "mean", "min", "max"];
3115 return n.some(function(i) {
3116 return i === a;
3117 }) || k(a) || xt("Preference must be one of [".concat(n.map(function(i) {
3118 return "'".concat(i, "'");
3119 }).join(", "), "] or a number. Got: ").concat(a)), mh(e);
3120 }, Eh = function(e, r, a, n) {
3121 var i = function(o, l) {
3122 return n[l](o);
3123 };
3124 return -mn(e, n.length, function(s) {
3125 return i(r, s);
3126 }, function(s) {
3127 return i(a, s);
3128 }, r, a);
3129 }, wh = function(e, r) {
3130 var a = null;
3131 return r === "median" ? a = bf(e) : r === "mean" ? a = mf(e) : r === "min" ? a = pf(e) : r === "max" ? a = yf(e) : a = r, a;
3132 }, xh = function(e, r, a) {
3133 for (var n = [], i = 0; i < e; i++)
3134 r[i * e + i] + a[i * e + i] > 0 && n.push(i);
3135 return n;
3136 }, _s = function(e, r, a) {
3137 for (var n = [], i = 0; i < e; i++) {
3138 for (var s = -1, o = -1 / 0, l = 0; l < a.length; l++) {
3139 var u = a[l];
3140 r[i * e + u] > o && (s = u, o = r[i * e + u]);
3141 }
3142 s > 0 && n.push(s);
3143 }
3144 for (var f = 0; f < a.length; f++)
3145 n[a[f]] = a[f];
3146 return n;
3147 }, Th = function(e, r, a) {
3148 for (var n = _s(e, r, a), i = 0; i < a.length; i++) {
3149 for (var s = [], o = 0; o < n.length; o++)
3150 n[o] === a[i] && s.push(o);
3151 for (var l = -1, u = -1 / 0, f = 0; f < s.length; f++) {
3152 for (var h = 0, c = 0; c < s.length; c++)
3153 h += r[s[c] * e + s[f]];
3154 h > u && (l = f, u = h);
3155 }
3156 a[i] = s[l];
3157 }
3158 return n = _s(e, r, a), n;
3159 }, Us = function(e) {
3160 for (var r = this.cy(), a = this.nodes(), n = bh(e), i = {}, s = 0; s < a.length; s++)
3161 i[a[s].id()] = s;
3162 var o, l, u, f, h, c;
3163 o = a.length, l = o * o, u = new Array(l);
3164 for (var v = 0; v < l; v++)
3165 u[v] = -1 / 0;
3166 for (var d = 0; d < o; d++)
3167 for (var g = 0; g < o; g++)
3168 d !== g && (u[d * o + g] = Eh(n.distance, a[d], a[g], n.attributes));
3169 f = wh(u, n.preference);
3170 for (var y = 0; y < o; y++)
3171 u[y * o + y] = f;
3172 h = new Array(l);
3173 for (var p = 0; p < l; p++)
3174 h[p] = 0;
3175 c = new Array(l);
3176 for (var m = 0; m < l; m++)
3177 c[m] = 0;
3178 for (var b = new Array(o), E = new Array(o), M = new Array(o), A = 0; A < o; A++)
3179 b[A] = 0, E[A] = 0, M[A] = 0;
3180 for (var w = new Array(o * n.minIterations), I = 0; I < w.length; I++)
3181 w[I] = 0;
3182 var C;
3183 for (C = 0; C < n.maxIterations; C++) {
3184 for (var B = 0; B < o; B++) {
3185 for (var F = -1 / 0, R = -1 / 0, X = -1, z = 0, re = 0; re < o; re++)
3186 b[re] = h[B * o + re], z = c[B * o + re] + u[B * o + re], z >= F ? (R = F, F = z, X = re) : z > R && (R = z);
3187 for (var W = 0; W < o; W++)
3188 h[B * o + W] = (1 - n.damping) * (u[B * o + W] - F) + n.damping * b[W];
3189 h[B * o + X] = (1 - n.damping) * (u[B * o + X] - R) + n.damping * b[X];
3190 }
3191 for (var Z = 0; Z < o; Z++) {
3192 for (var ie = 0, oe = 0; oe < o; oe++)
3193 b[oe] = c[oe * o + Z], E[oe] = Math.max(0, h[oe * o + Z]), ie += E[oe];
3194 ie -= E[Z], E[Z] = h[Z * o + Z], ie += E[Z];
3195 for (var ge = 0; ge < o; ge++)
3196 c[ge * o + Z] = (1 - n.damping) * Math.min(0, ie - E[ge]) + n.damping * b[ge];
3197 c[Z * o + Z] = (1 - n.damping) * (ie - E[Z]) + n.damping * b[Z];
3198 }
3199 for (var se = 0, de = 0; de < o; de++) {
3200 var we = c[de * o + de] + h[de * o + de] > 0 ? 1 : 0;
3201 w[C % n.minIterations * o + de] = we, se += we;
3202 }
3203 if (se > 0 && (C >= n.minIterations - 1 || C == n.maxIterations - 1)) {
3204 for (var Te = 0, Ee = 0; Ee < o; Ee++) {
3205 M[Ee] = 0;
3206 for (var ye = 0; ye < n.minIterations; ye++)
3207 M[Ee] += w[ye * o + Ee];
3208 (M[Ee] === 0 || M[Ee] === n.minIterations) && Te++;
3209 }
3210 if (Te === o)
3211 break;
3212 }
3213 }
3214 for (var ae = xh(o, h, c), xe = Th(o, u, ae), Ce = {}, Oe = 0; Oe < ae.length; Oe++)
3215 Ce[ae[Oe]] = [];
3216 for (var Ie = 0; Ie < a.length; Ie++) {
3217 var He = i[a[Ie].id()], qe = xe[He];
3218 qe != null && Ce[qe].push(a[Ie]);
3219 }
3220 for (var Re = new Array(ae.length), Me = 0; Me < ae.length; Me++)
3221 Re[Me] = r.collection(Ce[ae[Me]]);
3222 return Re;
3223 }, Ch = {
3224 affinityPropagation: Us,
3225 ap: Us
3226 }, Dh = Lt({
3227 root: void 0,
3228 directed: !1
3229 }), Sh = {
3230 hierholzer: function(e) {
3231 if (!L(e)) {
3232 var r = arguments;
3233 e = {
3234 root: r[0],
3235 directed: r[1]
3236 };
3237 }
3238 var a = Dh(e), n = a.root, i = a.directed, s = this, o = !1, l, u, f;
3239 n && (f = j(n) ? this.filter(n)[0].id() : n[0].id());
3240 var h = {}, c = {};
3241 i ? s.forEach(function(m) {
3242 var b = m.id();
3243 if (m.isNode()) {
3244 var E = m.indegree(!0), M = m.outdegree(!0), A = E - M, w = M - E;
3245 A == 1 ? l ? o = !0 : l = b : w == 1 ? u ? o = !0 : u = b : (w > 1 || A > 1) && (o = !0), h[b] = [], m.outgoers().forEach(function(I) {
3246 I.isEdge() && h[b].push(I.id());
3247 });
3248 } else
3249 c[b] = [void 0, m.target().id()];
3250 }) : s.forEach(function(m) {
3251 var b = m.id();
3252 if (m.isNode()) {
3253 var E = m.degree(!0);
3254 E % 2 && (l ? u ? o = !0 : u = b : l = b), h[b] = [], m.connectedEdges().forEach(function(M) {
3255 return h[b].push(M.id());
3256 });
3257 } else
3258 c[b] = [m.source().id(), m.target().id()];
3259 });
3260 var v = {
3261 found: !1,
3262 trail: void 0
3263 };
3264 if (o)
3265 return v;
3266 if (u && l)
3267 if (i) {
3268 if (f && u != f)
3269 return v;
3270 f = u;
3271 } else {
3272 if (f && u != f && l != f)
3273 return v;
3274 f || (f = u);
3275 }
3276 else
3277 f || (f = s[0].id());
3278 var d = function(b) {
3279 for (var E = b, M = [b], A, w, I; h[E].length; )
3280 A = h[E].shift(), w = c[A][0], I = c[A][1], E != I ? (h[I] = h[I].filter(function(C) {
3281 return C != A;
3282 }), E = I) : !i && E != w && (h[w] = h[w].filter(function(C) {
3283 return C != A;
3284 }), E = w), M.unshift(A), M.unshift(E);
3285 return M;
3286 }, g = [], y = [];
3287 for (y = d(f); y.length != 1; )
3288 h[y[0]].length == 0 ? (g.unshift(s.getElementById(y.shift())), g.unshift(s.getElementById(y.shift()))) : y = d(y.shift()).concat(y);
3289 g.unshift(s.getElementById(y.shift()));
3290 for (var p in h)
3291 if (h[p].length)
3292 return v;
3293 return v.found = !0, v.trail = this.spawn(g, !0), v;
3294 }
3295 }, wn = function() {
3296 var e = this, r = {}, a = 0, n = 0, i = [], s = [], o = {}, l = function(c, v) {
3297 for (var d = s.length - 1, g = [], y = e.spawn(); s[d].x != c || s[d].y != v; )
3298 g.push(s.pop().edge), d--;
3299 g.push(s.pop().edge), g.forEach(function(p) {
3300 var m = p.connectedNodes().intersection(e);
3301 y.merge(p), m.forEach(function(b) {
3302 var E = b.id(), M = b.connectedEdges().intersection(e);
3303 y.merge(b), r[E].cutVertex ? y.merge(M.filter(function(A) {
3304 return A.isLoop();
3305 })) : y.merge(M);
3306 });
3307 }), i.push(y);
3308 }, u = function h(c, v, d) {
3309 c === d && (n += 1), r[v] = {
3310 id: a,
3311 low: a++,
3312 cutVertex: !1
3313 };
3314 var g = e.getElementById(v).connectedEdges().intersection(e);
3315 if (g.size() === 0)
3316 i.push(e.spawn(e.getElementById(v)));
3317 else {
3318 var y, p, m, b;
3319 g.forEach(function(E) {
3320 y = E.source().id(), p = E.target().id(), m = y === v ? p : y, m !== d && (b = E.id(), o[b] || (o[b] = !0, s.push({
3321 x: v,
3322 y: m,
3323 edge: E
3324 })), m in r ? r[v].low = Math.min(r[v].low, r[m].id) : (h(c, m, v), r[v].low = Math.min(r[v].low, r[m].low), r[v].id <= r[m].low && (r[v].cutVertex = !0, l(v, m))));
3325 });
3326 }
3327 };
3328 e.forEach(function(h) {
3329 if (h.isNode()) {
3330 var c = h.id();
3331 c in r || (n = 0, u(c, c), r[c].cutVertex = n > 1);
3332 }
3333 });
3334 var f = Object.keys(r).filter(function(h) {
3335 return r[h].cutVertex;
3336 }).map(function(h) {
3337 return e.getElementById(h);
3338 });
3339 return {
3340 cut: e.spawn(f),
3341 components: i
3342 };
3343 }, Lh = {
3344 hopcroftTarjanBiconnected: wn,
3345 htbc: wn,
3346 htb: wn,
3347 hopcroftTarjanBiconnectedComponents: wn
3348 }, xn = function() {
3349 var e = this, r = {}, a = 0, n = [], i = [], s = e.spawn(e), o = function l(u) {
3350 i.push(u), r[u] = {
3351 index: a,
3352 low: a++,
3353 explored: !1
3354 };
3355 var f = e.getElementById(u).connectedEdges().intersection(e);
3356 if (f.forEach(function(g) {
3357 var y = g.target().id();
3358 y !== u && (y in r || l(y), r[y].explored || (r[u].low = Math.min(r[u].low, r[y].low)));
3359 }), r[u].index === r[u].low) {
3360 for (var h = e.spawn(); ; ) {
3361 var c = i.pop();
3362 if (h.merge(e.getElementById(c)), r[c].low = r[u].index, r[c].explored = !0, c === u)
3363 break;
3364 }
3365 var v = h.edgesWith(h), d = h.merge(v);
3366 n.push(d), s = s.difference(d);
3367 }
3368 };
3369 return e.forEach(function(l) {
3370 if (l.isNode()) {
3371 var u = l.id();
3372 u in r || o(u);
3373 }
3374 }), {
3375 cut: s,
3376 components: n
3377 };
3378 }, Ah = {
3379 tarjanStronglyConnected: xn,
3380 tsc: xn,
3381 tscc: xn,
3382 tarjanStronglyConnectedComponents: xn
3383 }, Ys = {};
3384 [Ia, af, nf, of, lf, hf, df, Gf, ra, aa, pi, Jf, hh, yh, Ch, Sh, Lh, Ah].forEach(function(t) {
3385 Ue(Ys, t);
3386 });
3387 /*!
3388 Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
3389 Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
3390 Licensed under The MIT License (http://opensource.org/licenses/MIT)
3391 */
3392 var Hs = 0, Xs = 1, qs = 2, pr = function t(e) {
3393 if (!(this instanceof t))
3394 return new t(e);
3395 this.id = "Thenable/1.0.7", this.state = Hs, this.fulfillValue = void 0, this.rejectReason = void 0, this.onFulfilled = [], this.onRejected = [], this.proxy = {
3396 then: this.then.bind(this)
3397 }, typeof e == "function" && e.call(this, this.fulfill.bind(this), this.reject.bind(this));
3398 };
3399 pr.prototype = {
3400 /* promise resolving methods */
3401 fulfill: function(e) {
3402 return Ws(this, Xs, "fulfillValue", e);
3403 },
3404 reject: function(e) {
3405 return Ws(this, qs, "rejectReason", e);
3406 },
3407 /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */
3408 then: function(e, r) {
3409 var a = this, n = new pr();
3410 return a.onFulfilled.push(Qs(e, n, "fulfill")), a.onRejected.push(Qs(r, n, "reject")), Ks(a), n.proxy;
3411 }
3412 };
3413 var Ws = function(e, r, a, n) {
3414 return e.state === Hs && (e.state = r, e[a] = n, Ks(e)), e;
3415 }, Ks = function(e) {
3416 e.state === Xs ? Zs(e, "onFulfilled", e.fulfillValue) : e.state === qs && Zs(e, "onRejected", e.rejectReason);
3417 }, Zs = function(e, r, a) {
3418 if (e[r].length !== 0) {
3419 var n = e[r];
3420 e[r] = [];
3421 var i = function() {
3422 for (var o = 0; o < n.length; o++)
3423 n[o](a);
3424 };
3425 typeof setImmediate == "function" ? setImmediate(i) : setTimeout(i, 0);
3426 }
3427 }, Qs = function(e, r, a) {
3428 return function(n) {
3429 if (typeof e != "function")
3430 r[a].call(r, n);
3431 else {
3432 var i;
3433 try {
3434 i = e(n);
3435 } catch (s) {
3436 r.reject(s);
3437 return;
3438 }
3439 Oh(r, i);
3440 }
3441 };
3442 }, Oh = function t(e, r) {
3443 if (e === r || e.proxy === r) {
3444 e.reject(new TypeError("cannot resolve promise with itself"));
3445 return;
3446 }
3447 var a;
3448 if (ee(r) === "object" && r !== null || typeof r == "function")
3449 try {
3450 a = r.then;
3451 } catch (i) {
3452 e.reject(i);
3453 return;
3454 }
3455 if (typeof a == "function") {
3456 var n = !1;
3457 try {
3458 a.call(
3459 r,
3460 /* resolvePromise */
3461 /* [Promises/A+ 2.3.3.3.1] */
3462 function(i) {
3463 n || (n = !0, i === r ? e.reject(new TypeError("circular thenable chain")) : t(e, i));
3464 },
3465 /* rejectPromise */
3466 /* [Promises/A+ 2.3.3.3.2] */
3467 function(i) {
3468 n || (n = !0, e.reject(i));
3469 }
3470 );
3471 } catch (i) {
3472 n || e.reject(i);
3473 }
3474 return;
3475 }
3476 e.fulfill(r);
3477 };
3478 pr.all = function(t) {
3479 return new pr(function(e, r) {
3480 for (var a = new Array(t.length), n = 0, i = function(l, u) {
3481 a[l] = u, n++, n === t.length && e(a);
3482 }, s = 0; s < t.length; s++)
3483 (function(o) {
3484 var l = t[o], u = l != null && l.then != null;
3485 if (u)
3486 l.then(function(h) {
3487 i(o, h);
3488 }, function(h) {
3489 r(h);
3490 });
3491 else {
3492 var f = l;
3493 i(o, f);
3494 }
3495 })(s);
3496 });
3497 }, pr.resolve = function(t) {
3498 return new pr(function(e, r) {
3499 e(t);
3500 });
3501 }, pr.reject = function(t) {
3502 return new pr(function(e, r) {
3503 r(t);
3504 });
3505 };
3506 var ia = typeof Promise < "u" ? Promise : pr, bi = function(e, r, a) {
3507 var n = _e(e), i = !n, s = this._private = Ue({
3508 duration: 1e3
3509 }, r, a);
3510 if (s.target = e, s.style = s.style || s.css, s.started = !1, s.playing = !1, s.hooked = !1, s.applying = !1, s.progress = 0, s.completes = [], s.frames = [], s.complete && Y(s.complete) && s.completes.push(s.complete), i) {
3511 var o = e.position();
3512 s.startPosition = s.startPosition || {
3513 x: o.x,
3514 y: o.y
3515 }, s.startStyle = s.startStyle || e.cy().style().getAnimationStartStyle(e, s.style);
3516 }
3517 if (n) {
3518 var l = e.pan();
3519 s.startPan = {
3520 x: l.x,
3521 y: l.y
3522 }, s.startZoom = e.zoom();
3523 }
3524 this.length = 1, this[0] = this;
3525 }, zr = bi.prototype;
3526 Ue(zr, {
3527 instanceString: function() {
3528 return "animation";
3529 },
3530 hook: function() {
3531 var e = this._private;
3532 if (!e.hooked) {
3533 var r, a = e.target._private.animation;
3534 e.queue ? r = a.queue : r = a.current, r.push(this), pe(e.target) && e.target.cy().addToAnimationPool(e.target), e.hooked = !0;
3535 }
3536 return this;
3537 },
3538 play: function() {
3539 var e = this._private;
3540 return e.progress === 1 && (e.progress = 0), e.playing = !0, e.started = !1, e.stopped = !1, this.hook(), this;
3541 },
3542 playing: function() {
3543 return this._private.playing;
3544 },
3545 apply: function() {
3546 var e = this._private;
3547 return e.applying = !0, e.started = !1, e.stopped = !1, this.hook(), this;
3548 },
3549 applying: function() {
3550 return this._private.applying;
3551 },
3552 pause: function() {
3553 var e = this._private;
3554 return e.playing = !1, e.started = !1, this;
3555 },
3556 stop: function() {
3557 var e = this._private;
3558 return e.playing = !1, e.started = !1, e.stopped = !0, this;
3559 },
3560 rewind: function() {
3561 return this.progress(0);
3562 },
3563 fastforward: function() {
3564 return this.progress(1);
3565 },
3566 time: function(e) {
3567 var r = this._private;
3568 return e === void 0 ? r.progress * r.duration : this.progress(e / r.duration);
3569 },
3570 progress: function(e) {
3571 var r = this._private, a = r.playing;
3572 return e === void 0 ? r.progress : (a && this.pause(), r.progress = e, r.started = !1, a && this.play(), this);
3573 },
3574 completed: function() {
3575 return this._private.progress === 1;
3576 },
3577 reverse: function() {
3578 var e = this._private, r = e.playing;
3579 r && this.pause(), e.progress = 1 - e.progress, e.started = !1;
3580 var a = function(u, f) {
3581 var h = e[u];
3582 h != null && (e[u] = e[f], e[f] = h);
3583 };
3584 if (a("zoom", "startZoom"), a("pan", "startPan"), a("position", "startPosition"), e.style)
3585 for (var n = 0; n < e.style.length; n++) {
3586 var i = e.style[n], s = i.name, o = e.startStyle[s];
3587 e.startStyle[s] = i, e.style[n] = o;
3588 }
3589 return r && this.play(), this;
3590 },
3591 promise: function(e) {
3592 var r = this._private, a;
3593 switch (e) {
3594 case "frame":
3595 a = r.frames;
3596 break;
3597 default:
3598 case "complete":
3599 case "completed":
3600 a = r.completes;
3601 }
3602 return new ia(function(n, i) {
3603 a.push(function() {
3604 n();
3605 });
3606 });
3607 }
3608 }), zr.complete = zr.completed, zr.run = zr.play, zr.running = zr.playing;
3609 var Nh = {
3610 animated: function() {
3611 return function() {
3612 var r = this, a = r.length !== void 0, n = a ? r : [r], i = this._private.cy || this;
3613 if (!i.styleEnabled())
3614 return !1;
3615 var s = n[0];
3616 if (s)
3617 return s._private.animation.current.length > 0;
3618 };
3619 },
3620 // animated
3621 clearQueue: function() {
3622 return function() {
3623 var r = this, a = r.length !== void 0, n = a ? r : [r], i = this._private.cy || this;
3624 if (!i.styleEnabled())
3625 return this;
3626 for (var s = 0; s < n.length; s++) {
3627 var o = n[s];
3628 o._private.animation.queue = [];
3629 }
3630 return this;
3631 };
3632 },
3633 // clearQueue
3634 delay: function() {
3635 return function(r, a) {
3636 var n = this._private.cy || this;
3637 return n.styleEnabled() ? this.animate({
3638 delay: r,
3639 duration: r,
3640 complete: a
3641 }) : this;
3642 };
3643 },
3644 // delay
3645 delayAnimation: function() {
3646 return function(r, a) {
3647 var n = this._private.cy || this;
3648 return n.styleEnabled() ? this.animation({
3649 delay: r,
3650 duration: r,
3651 complete: a
3652 }) : this;
3653 };
3654 },
3655 // delay
3656 animation: function() {
3657 return function(r, a) {
3658 var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this, l = !i, u = !l;
3659 if (!o.styleEnabled())
3660 return this;
3661 var f = o.style();
3662 r = Ue({}, r, a);
3663 var h = Object.keys(r).length === 0;
3664 if (h)
3665 return new bi(s[0], r);
3666 switch (r.duration === void 0 && (r.duration = 400), r.duration) {
3667 case "slow":
3668 r.duration = 600;
3669 break;
3670 case "fast":
3671 r.duration = 200;
3672 break;
3673 }
3674 if (u && (r.style = f.getPropsList(r.style || r.css), r.css = void 0), u && r.renderedPosition != null) {
3675 var c = r.renderedPosition, v = o.pan(), d = o.zoom();
3676 r.position = bs(c, d, v);
3677 }
3678 if (l && r.panBy != null) {
3679 var g = r.panBy, y = o.pan();
3680 r.pan = {
3681 x: y.x + g.x,
3682 y: y.y + g.y
3683 };
3684 }
3685 var p = r.center || r.centre;
3686 if (l && p != null) {
3687 var m = o.getCenterPan(p.eles, r.zoom);
3688 m != null && (r.pan = m);
3689 }
3690 if (l && r.fit != null) {
3691 var b = r.fit, E = o.getFitViewport(b.eles || b.boundingBox, b.padding);
3692 E != null && (r.pan = E.pan, r.zoom = E.zoom);
3693 }
3694 if (l && L(r.zoom)) {
3695 var M = o.getZoomedViewport(r.zoom);
3696 M != null ? (M.zoomed && (r.zoom = M.zoom), M.panned && (r.pan = M.pan)) : r.zoom = null;
3697 }
3698 return new bi(s[0], r);
3699 };
3700 },
3701 // animate
3702 animate: function() {
3703 return function(r, a) {
3704 var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this;
3705 if (!o.styleEnabled())
3706 return this;
3707 a && (r = Ue({}, r, a));
3708 for (var l = 0; l < s.length; l++) {
3709 var u = s[l], f = u.animated() && (r.queue === void 0 || r.queue), h = u.animation(r, f ? {
3710 queue: !0
3711 } : void 0);
3712 h.play();
3713 }
3714 return this;
3715 };
3716 },
3717 // animate
3718 stop: function() {
3719 return function(r, a) {
3720 var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this;
3721 if (!o.styleEnabled())
3722 return this;
3723 for (var l = 0; l < s.length; l++) {
3724 for (var u = s[l], f = u._private, h = f.animation.current, c = 0; c < h.length; c++) {
3725 var v = h[c], d = v._private;
3726 a && (d.duration = 0);
3727 }
3728 r && (f.animation.queue = []), a || (f.animation.current = []);
3729 }
3730 return o.notify("draw"), this;
3731 };
3732 }
3733 // stop
3734 }, Mh = Array.isArray, Tn = Mh, Ih = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Rh = /^\w*$/;
3735 function kh(t, e) {
3736 if (Tn(t))
3737 return !1;
3738 var r = typeof t;
3739 return r == "number" || r == "symbol" || r == "boolean" || t == null || Aa(t) ? !0 : Rh.test(t) || !Ih.test(t) || e != null && t in Object(e);
3740 }
3741 var Ph = kh, Bh = "[object AsyncFunction]", Fh = "[object Function]", zh = "[object GeneratorFunction]", Gh = "[object Proxy]";
3742 function $h(t) {
3743 if (!Rr(t))
3744 return !1;
3745 var e = is(t);
3746 return e == Fh || e == zh || e == Bh || e == Gh;
3747 }
3748 var Vh = $h, _h = un["__core-js_shared__"], Ei = _h, Js = function() {
3749 var t = /[^.]+$/.exec(Ei && Ei.keys && Ei.keys.IE_PROTO || "");
3750 return t ? "Symbol(src)_1." + t : "";
3751 }();
3752 function Uh(t) {
3753 return !!Js && Js in t;
3754 }
3755 var Yh = Uh, Hh = Function.prototype, Xh = Hh.toString;
3756 function qh(t) {
3757 if (t != null) {
3758 try {
3759 return Xh.call(t);
3760 } catch {
3761 }
3762 try {
3763 return t + "";
3764 } catch {
3765 }
3766 }
3767 return "";
3768 }
3769 var Wh = qh, Kh = /[\\^$.*+?()[\]{}|]/g, Zh = /^\[object .+?Constructor\]$/, Qh = Function.prototype, Jh = Object.prototype, jh = Qh.toString, ec = Jh.hasOwnProperty, tc = RegExp(
3770 "^" + jh.call(ec).replace(Kh, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
3771 );
3772 function rc(t) {
3773 if (!Rr(t) || Yh(t))
3774 return !1;
3775 var e = Vh(t) ? tc : Zh;
3776 return e.test(Wh(t));
3777 }
3778 var ac = rc;
3779 function nc(t, e) {
3780 return t == null ? void 0 : t[e];
3781 }
3782 var ic = nc;
3783 function sc(t, e) {
3784 var r = ic(t, e);
3785 return ac(r) ? r : void 0;
3786 }
3787 var wi = sc, oc = wi(Object, "create"), Ga = oc;
3788 function uc() {
3789 this.__data__ = Ga ? Ga(null) : {}, this.size = 0;
3790 }
3791 var lc = uc;
3792 function fc(t) {
3793 var e = this.has(t) && delete this.__data__[t];
3794 return this.size -= e ? 1 : 0, e;
3795 }
3796 var hc = fc, cc = "__lodash_hash_undefined__", vc = Object.prototype, dc = vc.hasOwnProperty;
3797 function gc(t) {
3798 var e = this.__data__;
3799 if (Ga) {
3800 var r = e[t];
3801 return r === cc ? void 0 : r;
3802 }
3803 return dc.call(e, t) ? e[t] : void 0;
3804 }
3805 var pc = gc, yc = Object.prototype, mc = yc.hasOwnProperty;
3806 function bc(t) {
3807 var e = this.__data__;
3808 return Ga ? e[t] !== void 0 : mc.call(e, t);
3809 }
3810 var Ec = bc, wc = "__lodash_hash_undefined__";
3811 function xc(t, e) {
3812 var r = this.__data__;
3813 return this.size += this.has(t) ? 0 : 1, r[t] = Ga && e === void 0 ? wc : e, this;
3814 }
3815 var Tc = xc;
3816 function sa(t) {
3817 var e = -1, r = t == null ? 0 : t.length;
3818 for (this.clear(); ++e < r; ) {
3819 var a = t[e];
3820 this.set(a[0], a[1]);
3821 }
3822 }
3823 sa.prototype.clear = lc, sa.prototype.delete = hc, sa.prototype.get = pc, sa.prototype.has = Ec, sa.prototype.set = Tc;
3824 var js = sa;
3825 function Cc() {
3826 this.__data__ = [], this.size = 0;
3827 }
3828 var Dc = Cc;
3829 function Sc(t, e) {
3830 return t === e || t !== t && e !== e;
3831 }
3832 var eo = Sc;
3833 function Lc(t, e) {
3834 for (var r = t.length; r--; )
3835 if (eo(t[r][0], e))
3836 return r;
3837 return -1;
3838 }
3839 var Cn = Lc, Ac = Array.prototype, Oc = Ac.splice;
3840 function Nc(t) {
3841 var e = this.__data__, r = Cn(e, t);
3842 if (r < 0)
3843 return !1;
3844 var a = e.length - 1;
3845 return r == a ? e.pop() : Oc.call(e, r, 1), --this.size, !0;
3846 }
3847 var Mc = Nc;
3848 function Ic(t) {
3849 var e = this.__data__, r = Cn(e, t);
3850 return r < 0 ? void 0 : e[r][1];
3851 }
3852 var Rc = Ic;
3853 function kc(t) {
3854 return Cn(this.__data__, t) > -1;
3855 }
3856 var Pc = kc;
3857 function Bc(t, e) {
3858 var r = this.__data__, a = Cn(r, t);
3859 return a < 0 ? (++this.size, r.push([t, e])) : r[a][1] = e, this;
3860 }
3861 var Fc = Bc;
3862 function oa(t) {
3863 var e = -1, r = t == null ? 0 : t.length;
3864 for (this.clear(); ++e < r; ) {
3865 var a = t[e];
3866 this.set(a[0], a[1]);
3867 }
3868 }
3869 oa.prototype.clear = Dc, oa.prototype.delete = Mc, oa.prototype.get = Rc, oa.prototype.has = Pc, oa.prototype.set = Fc;
3870 var zc = oa, Gc = wi(un, "Map"), $c = Gc;
3871 function Vc() {
3872 this.size = 0, this.__data__ = {
3873 hash: new js(),
3874 map: new ($c || zc)(),
3875 string: new js()
3876 };
3877 }
3878 var _c = Vc;
3879 function Uc(t) {
3880 var e = typeof t;
3881 return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
3882 }
3883 var Yc = Uc;
3884 function Hc(t, e) {
3885 var r = t.__data__;
3886 return Yc(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
3887 }
3888 var Dn = Hc;
3889 function Xc(t) {
3890 var e = Dn(this, t).delete(t);
3891 return this.size -= e ? 1 : 0, e;
3892 }
3893 var qc = Xc;
3894 function Wc(t) {
3895 return Dn(this, t).get(t);
3896 }
3897 var Kc = Wc;
3898 function Zc(t) {
3899 return Dn(this, t).has(t);
3900 }
3901 var Qc = Zc;
3902 function Jc(t, e) {
3903 var r = Dn(this, t), a = r.size;
3904 return r.set(t, e), this.size += r.size == a ? 0 : 1, this;
3905 }
3906 var jc = Jc;
3907 function ua(t) {
3908 var e = -1, r = t == null ? 0 : t.length;
3909 for (this.clear(); ++e < r; ) {
3910 var a = t[e];
3911 this.set(a[0], a[1]);
3912 }
3913 }
3914 ua.prototype.clear = _c, ua.prototype.delete = qc, ua.prototype.get = Kc, ua.prototype.has = Qc, ua.prototype.set = jc;
3915 var to = ua, ev = "Expected a function";
3916 function xi(t, e) {
3917 if (typeof t != "function" || e != null && typeof e != "function")
3918 throw new TypeError(ev);
3919 var r = function() {
3920 var a = arguments, n = e ? e.apply(this, a) : a[0], i = r.cache;
3921 if (i.has(n))
3922 return i.get(n);
3923 var s = t.apply(this, a);
3924 return r.cache = i.set(n, s) || i, s;
3925 };
3926 return r.cache = new (xi.Cache || to)(), r;
3927 }
3928 xi.Cache = to;
3929 var tv = xi, rv = 500;
3930 function av(t) {
3931 var e = tv(t, function(a) {
3932 return r.size === rv && r.clear(), a;
3933 }), r = e.cache;
3934 return e;
3935 }
3936 var nv = av, iv = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, sv = /\\(\\)?/g, ov = nv(function(t) {
3937 var e = [];
3938 return t.charCodeAt(0) === 46 && e.push(""), t.replace(iv, function(r, a, n, i) {
3939 e.push(n ? i.replace(sv, "$1") : a || r);
3940 }), e;
3941 }), ro = ov;
3942 function uv(t, e) {
3943 for (var r = -1, a = t == null ? 0 : t.length, n = Array(a); ++r < a; )
3944 n[r] = e(t[r], r, t);
3945 return n;
3946 }
3947 var ao = uv, lv = 1 / 0, no = Zr ? Zr.prototype : void 0, io = no ? no.toString : void 0;
3948 function so(t) {
3949 if (typeof t == "string")
3950 return t;
3951 if (Tn(t))
3952 return ao(t, so) + "";
3953 if (Aa(t))
3954 return io ? io.call(t) : "";
3955 var e = t + "";
3956 return e == "0" && 1 / t == -lv ? "-0" : e;
3957 }
3958 var fv = so;
3959 function hv(t) {
3960 return t == null ? "" : fv(t);
3961 }
3962 var oo = hv;
3963 function cv(t, e) {
3964 return Tn(t) ? t : Ph(t, e) ? [t] : ro(oo(t));
3965 }
3966 var uo = cv, vv = 1 / 0;
3967 function dv(t) {
3968 if (typeof t == "string" || Aa(t))
3969 return t;
3970 var e = t + "";
3971 return e == "0" && 1 / t == -vv ? "-0" : e;
3972 }
3973 var Ti = dv;
3974 function gv(t, e) {
3975 e = uo(e, t);
3976 for (var r = 0, a = e.length; t != null && r < a; )
3977 t = t[Ti(e[r++])];
3978 return r && r == a ? t : void 0;
3979 }
3980 var pv = gv;
3981 function yv(t, e, r) {
3982 var a = t == null ? void 0 : pv(t, e);
3983 return a === void 0 ? r : a;
3984 }
3985 var mv = yv, bv = function() {
3986 try {
3987 var t = wi(Object, "defineProperty");
3988 return t({}, "", {}), t;
3989 } catch {
3990 }
3991 }(), lo = bv;
3992 function Ev(t, e, r) {
3993 e == "__proto__" && lo ? lo(t, e, {
3994 configurable: !0,
3995 enumerable: !0,
3996 value: r,
3997 writable: !0
3998 }) : t[e] = r;
3999 }
4000 var wv = Ev, xv = Object.prototype, Tv = xv.hasOwnProperty;
4001 function Cv(t, e, r) {
4002 var a = t[e];
4003 (!(Tv.call(t, e) && eo(a, r)) || r === void 0 && !(e in t)) && wv(t, e, r);
4004 }
4005 var Dv = Cv, Sv = 9007199254740991, Lv = /^(?:0|[1-9]\d*)$/;
4006 function Av(t, e) {
4007 var r = typeof t;
4008 return e = e ?? Sv, !!e && (r == "number" || r != "symbol" && Lv.test(t)) && t > -1 && t % 1 == 0 && t < e;
4009 }
4010 var Ov = Av;
4011 function Nv(t, e, r, a) {
4012 if (!Rr(t))
4013 return t;
4014 e = uo(e, t);
4015 for (var n = -1, i = e.length, s = i - 1, o = t; o != null && ++n < i; ) {
4016 var l = Ti(e[n]), u = r;
4017 if (l === "__proto__" || l === "constructor" || l === "prototype")
4018 return t;
4019 if (n != s) {
4020 var f = o[l];
4021 u = a ? a(f, l, o) : void 0, u === void 0 && (u = Rr(f) ? f : Ov(e[n + 1]) ? [] : {});
4022 }
4023 Dv(o, l, u), o = o[l];
4024 }
4025 return t;
4026 }
4027 var Mv = Nv;
4028 function Iv(t, e, r) {
4029 return t == null ? t : Mv(t, e, r);
4030 }
4031 var Rv = Iv;
4032 function kv(t, e) {
4033 var r = -1, a = t.length;
4034 for (e || (e = Array(a)); ++r < a; )
4035 e[r] = t[r];
4036 return e;
4037 }
4038 var Pv = kv;
4039 function Bv(t) {
4040 return Tn(t) ? ao(t, Ti) : Aa(t) ? [t] : Pv(ro(oo(t)));
4041 }
4042 var Fv = Bv, zv = {
4043 // access data field
4044 data: function(e) {
4045 var r = {
4046 field: "data",
4047 bindingEvent: "data",
4048 allowBinding: !1,
4049 allowSetting: !1,
4050 allowGetting: !1,
4051 settingEvent: "data",
4052 settingTriggersEvent: !1,
4053 triggerFnName: "trigger",
4054 immutableKeys: {},
4055 // key => true if immutable
4056 updateStyle: !1,
4057 beforeGet: function(n) {
4058 },
4059 beforeSet: function(n, i) {
4060 },
4061 onSet: function(n) {
4062 },
4063 canSet: function(n) {
4064 return !0;
4065 }
4066 };
4067 return e = Ue({}, r, e), function(n, i) {
4068 var s = e, o = this, l = o.length !== void 0, u = l ? o : [o], f = l ? o[0] : o;
4069 if (j(n)) {
4070 var h = n.indexOf(".") !== -1, c = h && Fv(n);
4071 if (s.allowGetting && i === void 0) {
4072 var v;
4073 return f && (s.beforeGet(f), c && f._private[s.field][n] === void 0 ? v = mv(f._private[s.field], c) : v = f._private[s.field][n]), v;
4074 } else if (s.allowSetting && i !== void 0) {
4075 var d = !s.immutableKeys[n];
4076 if (d) {
4077 var g = T({}, n, i);
4078 s.beforeSet(o, g);
4079 for (var y = 0, p = u.length; y < p; y++) {
4080 var m = u[y];
4081 s.canSet(m) && (c && f._private[s.field][n] === void 0 ? Rv(m._private[s.field], c, i) : m._private[s.field][n] = i);
4082 }
4083 s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent);
4084 }
4085 }
4086 } else if (s.allowSetting && L(n)) {
4087 var b = n, E, M, A = Object.keys(b);
4088 s.beforeSet(o, b);
4089 for (var w = 0; w < A.length; w++) {
4090 E = A[w], M = b[E];
4091 var I = !s.immutableKeys[E];
4092 if (I)
4093 for (var C = 0; C < u.length; C++) {
4094 var B = u[C];
4095 s.canSet(B) && (B._private[s.field][E] = M);
4096 }
4097 }
4098 s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent);
4099 } else if (s.allowBinding && Y(n)) {
4100 var F = n;
4101 o.on(s.bindingEvent, F);
4102 } else if (s.allowGetting && n === void 0) {
4103 var R;
4104 return f && (s.beforeGet(f), R = f._private[s.field]), R;
4105 }
4106 return o;
4107 };
4108 },
4109 // data
4110 // remove data field
4111 removeData: function(e) {
4112 var r = {
4113 field: "data",
4114 event: "data",
4115 triggerFnName: "trigger",
4116 triggerEvent: !1,
4117 immutableKeys: {}
4118 // key => true if immutable
4119 };
4120 return e = Ue({}, r, e), function(n) {
4121 var i = e, s = this, o = s.length !== void 0, l = o ? s : [s];
4122 if (j(n)) {
4123 for (var u = n.split(/\s+/), f = u.length, h = 0; h < f; h++) {
4124 var c = u[h];
4125 if (!Pe(c)) {
4126 var v = !i.immutableKeys[c];
4127 if (v)
4128 for (var d = 0, g = l.length; d < g; d++)
4129 l[d]._private[i.field][c] = void 0;
4130 }
4131 }
4132 i.triggerEvent && s[i.triggerFnName](i.event);
4133 } else if (n === void 0) {
4134 for (var y = 0, p = l.length; y < p; y++)
4135 for (var m = l[y]._private[i.field], b = Object.keys(m), E = 0; E < b.length; E++) {
4136 var M = b[E], A = !i.immutableKeys[M];
4137 A && (m[M] = void 0);
4138 }
4139 i.triggerEvent && s[i.triggerFnName](i.event);
4140 }
4141 return s;
4142 };
4143 }
4144 // removeData
4145 }, Gv = {
4146 eventAliasesOn: function(e) {
4147 var r = e;
4148 r.addListener = r.listen = r.bind = r.on, r.unlisten = r.unbind = r.off = r.removeListener, r.trigger = r.emit, r.pon = r.promiseOn = function(a, n) {
4149 var i = this, s = Array.prototype.slice.call(arguments, 0);
4150 return new ia(function(o, l) {
4151 var u = function(v) {
4152 i.off.apply(i, h), o(v);
4153 }, f = s.concat([u]), h = f.concat([]);
4154 i.on.apply(i, f);
4155 });
4156 };
4157 }
4158 }, ht = {};
4159 [Nh, zv, Gv].forEach(function(t) {
4160 Ue(ht, t);
4161 });
4162 var $v = {
4163 animate: ht.animate(),
4164 animation: ht.animation(),
4165 animated: ht.animated(),
4166 clearQueue: ht.clearQueue(),
4167 delay: ht.delay(),
4168 delayAnimation: ht.delayAnimation(),
4169 stop: ht.stop()
4170 }, Sn = {
4171 classes: function(e) {
4172 var r = this;
4173 if (e === void 0) {
4174 var a = [];
4175 return r[0]._private.classes.forEach(function(d) {
4176 return a.push(d);
4177 }), a;
4178 } else
4179 te(e) || (e = (e || "").match(/\S+/g) || []);
4180 for (var n = [], i = new Jr(e), s = 0; s < r.length; s++) {
4181 for (var o = r[s], l = o._private, u = l.classes, f = !1, h = 0; h < e.length; h++) {
4182 var c = e[h], v = u.has(c);
4183 if (!v) {
4184 f = !0;
4185 break;
4186 }
4187 }
4188 f || (f = u.size !== e.length), f && (l.classes = i, n.push(o));
4189 }
4190 return n.length > 0 && this.spawn(n).updateStyle().emit("class"), r;
4191 },
4192 addClass: function(e) {
4193 return this.toggleClass(e, !0);
4194 },
4195 hasClass: function(e) {
4196 var r = this[0];
4197 return r != null && r._private.classes.has(e);
4198 },
4199 toggleClass: function(e, r) {
4200 te(e) || (e = e.match(/\S+/g) || []);
4201 for (var a = this, n = r === void 0, i = [], s = 0, o = a.length; s < o; s++)
4202 for (var l = a[s], u = l._private.classes, f = !1, h = 0; h < e.length; h++) {
4203 var c = e[h], v = u.has(c), d = !1;
4204 r || n && !v ? (u.add(c), d = !0) : (!r || n && v) && (u.delete(c), d = !0), !f && d && (i.push(l), f = !0);
4205 }
4206 return i.length > 0 && this.spawn(i).updateStyle().emit("class"), a;
4207 },
4208 removeClass: function(e) {
4209 return this.toggleClass(e, !1);
4210 },
4211 flashClass: function(e, r) {
4212 var a = this;
4213 if (r == null)
4214 r = 250;
4215 else if (r === 0)
4216 return a;
4217 return a.addClass(e), setTimeout(function() {
4218 a.removeClass(e);
4219 }, r), a;
4220 }
4221 };
4222 Sn.className = Sn.classNames = Sn.classes;
4223 var it = {
4224 metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",
4225 // chars we need to escape in let names, etc
4226 comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",
4227 // binary comparison op (used in data selectors)
4228 boolOp: "\\?|\\!|\\^",
4229 // boolean (unary) operators (used in data selectors)
4230 string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,
4231 // string literals (used in data selectors) -- doublequotes | singlequotes
4232 number: vt,
4233 // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123
4234 meta: "degree|indegree|outdegree",
4235 // allowed metadata fields (i.e. allowed functions to use from Collection)
4236 separator: "\\s*,\\s*",
4237 // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass
4238 descendant: "\\s+",
4239 child: "\\s+>\\s+",
4240 subject: "\\$",
4241 group: "node|edge|\\*",
4242 directedEdge: "\\s+->\\s+",
4243 undirectedEdge: "\\s+<->\\s+"
4244 };
4245 it.variable = "(?:[\\w-.]|(?:\\\\" + it.metaChar + "))+", it.className = "(?:[\\w-]|(?:\\\\" + it.metaChar + "))+", it.value = it.string + "|" + it.number, it.id = it.variable, function() {
4246 var t, e, r;
4247 for (t = it.comparatorOp.split("|"), r = 0; r < t.length; r++)
4248 e = t[r], it.comparatorOp += "|@" + e;
4249 for (t = it.comparatorOp.split("|"), r = 0; r < t.length; r++)
4250 e = t[r], !(e.indexOf("!") >= 0) && e !== "=" && (it.comparatorOp += "|\\!" + e);
4251 }();
4252 var gt = function() {
4253 return {
4254 checks: []
4255 };
4256 }, Be = {
4257 /** E.g. node */
4258 GROUP: 0,
4259 /** A collection of elements */
4260 COLLECTION: 1,
4261 /** A filter(ele) function */
4262 FILTER: 2,
4263 /** E.g. [foo > 1] */
4264 DATA_COMPARE: 3,
4265 /** E.g. [foo] */
4266 DATA_EXIST: 4,
4267 /** E.g. [?foo] */
4268 DATA_BOOL: 5,
4269 /** E.g. [[degree > 2]] */
4270 META_COMPARE: 6,
4271 /** E.g. :selected */
4272 STATE: 7,
4273 /** E.g. #foo */
4274 ID: 8,
4275 /** E.g. .foo */
4276 CLASS: 9,
4277 /** E.g. #foo <-> #bar */
4278 UNDIRECTED_EDGE: 10,
4279 /** E.g. #foo -> #bar */
4280 DIRECTED_EDGE: 11,
4281 /** E.g. $#foo -> #bar */
4282 NODE_SOURCE: 12,
4283 /** E.g. #foo -> $#bar */
4284 NODE_TARGET: 13,
4285 /** E.g. $#foo <-> #bar */
4286 NODE_NEIGHBOR: 14,
4287 /** E.g. #foo > #bar */
4288 CHILD: 15,
4289 /** E.g. #foo #bar */
4290 DESCENDANT: 16,
4291 /** E.g. $#foo > #bar */
4292 PARENT: 17,
4293 /** E.g. $#foo #bar */
4294 ANCESTOR: 18,
4295 /** E.g. #foo > $bar > #baz */
4296 COMPOUND_SPLIT: 19,
4297 /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */
4298 TRUE: 20
4299 }, Ci = [{
4300 selector: ":selected",
4301 matches: function(e) {
4302 return e.selected();
4303 }
4304 }, {
4305 selector: ":unselected",
4306 matches: function(e) {
4307 return !e.selected();
4308 }
4309 }, {
4310 selector: ":selectable",
4311 matches: function(e) {
4312 return e.selectable();
4313 }
4314 }, {
4315 selector: ":unselectable",
4316 matches: function(e) {
4317 return !e.selectable();
4318 }
4319 }, {
4320 selector: ":locked",
4321 matches: function(e) {
4322 return e.locked();
4323 }
4324 }, {
4325 selector: ":unlocked",
4326 matches: function(e) {
4327 return !e.locked();
4328 }
4329 }, {
4330 selector: ":visible",
4331 matches: function(e) {
4332 return e.visible();
4333 }
4334 }, {
4335 selector: ":hidden",
4336 matches: function(e) {
4337 return !e.visible();
4338 }
4339 }, {
4340 selector: ":transparent",
4341 matches: function(e) {
4342 return e.transparent();
4343 }
4344 }, {
4345 selector: ":grabbed",
4346 matches: function(e) {
4347 return e.grabbed();
4348 }
4349 }, {
4350 selector: ":free",
4351 matches: function(e) {
4352 return !e.grabbed();
4353 }
4354 }, {
4355 selector: ":removed",
4356 matches: function(e) {
4357 return e.removed();
4358 }
4359 }, {
4360 selector: ":inside",
4361 matches: function(e) {
4362 return !e.removed();
4363 }
4364 }, {
4365 selector: ":grabbable",
4366 matches: function(e) {
4367 return e.grabbable();
4368 }
4369 }, {
4370 selector: ":ungrabbable",
4371 matches: function(e) {
4372 return !e.grabbable();
4373 }
4374 }, {
4375 selector: ":animated",
4376 matches: function(e) {
4377 return e.animated();
4378 }
4379 }, {
4380 selector: ":unanimated",
4381 matches: function(e) {
4382 return !e.animated();
4383 }
4384 }, {
4385 selector: ":parent",
4386 matches: function(e) {
4387 return e.isParent();
4388 }
4389 }, {
4390 selector: ":childless",
4391 matches: function(e) {
4392 return e.isChildless();
4393 }
4394 }, {
4395 selector: ":child",
4396 matches: function(e) {
4397 return e.isChild();
4398 }
4399 }, {
4400 selector: ":orphan",
4401 matches: function(e) {
4402 return e.isOrphan();
4403 }
4404 }, {
4405 selector: ":nonorphan",
4406 matches: function(e) {
4407 return e.isChild();
4408 }
4409 }, {
4410 selector: ":compound",
4411 matches: function(e) {
4412 return e.isNode() ? e.isParent() : e.source().isParent() || e.target().isParent();
4413 }
4414 }, {
4415 selector: ":loop",
4416 matches: function(e) {
4417 return e.isLoop();
4418 }
4419 }, {
4420 selector: ":simple",
4421 matches: function(e) {
4422 return e.isSimple();
4423 }
4424 }, {
4425 selector: ":active",
4426 matches: function(e) {
4427 return e.active();
4428 }
4429 }, {
4430 selector: ":inactive",
4431 matches: function(e) {
4432 return !e.active();
4433 }
4434 }, {
4435 selector: ":backgrounding",
4436 matches: function(e) {
4437 return e.backgrounding();
4438 }
4439 }, {
4440 selector: ":nonbackgrounding",
4441 matches: function(e) {
4442 return !e.backgrounding();
4443 }
4444 }].sort(function(t, e) {
4445 return Qu(t.selector, e.selector);
4446 }), Vv = function() {
4447 for (var t = {}, e, r = 0; r < Ci.length; r++)
4448 e = Ci[r], t[e.selector] = e.matches;
4449 return t;
4450 }(), _v = function(e, r) {
4451 return Vv[e](r);
4452 }, Uv = "(" + Ci.map(function(t) {
4453 return t.selector;
4454 }).join("|") + ")", la = function(e) {
4455 return e.replace(new RegExp("\\\\(" + it.metaChar + ")", "g"), function(r, a) {
4456 return a;
4457 });
4458 }, Cr = function(e, r, a) {
4459 e[e.length - 1] = a;
4460 }, Di = [{
4461 name: "group",
4462 // just used for identifying when debugging
4463 query: !0,
4464 regex: "(" + it.group + ")",
4465 populate: function(e, r, a) {
4466 var n = x(a, 1), i = n[0];
4467 r.checks.push({
4468 type: Be.GROUP,
4469 value: i === "*" ? i : i + "s"
4470 });
4471 }
4472 }, {
4473 name: "state",
4474 query: !0,
4475 regex: Uv,
4476 populate: function(e, r, a) {
4477 var n = x(a, 1), i = n[0];
4478 r.checks.push({
4479 type: Be.STATE,
4480 value: i
4481 });
4482 }
4483 }, {
4484 name: "id",
4485 query: !0,
4486 regex: "\\#(" + it.id + ")",
4487 populate: function(e, r, a) {
4488 var n = x(a, 1), i = n[0];
4489 r.checks.push({
4490 type: Be.ID,
4491 value: la(i)
4492 });
4493 }
4494 }, {
4495 name: "className",
4496 query: !0,
4497 regex: "\\.(" + it.className + ")",
4498 populate: function(e, r, a) {
4499 var n = x(a, 1), i = n[0];
4500 r.checks.push({
4501 type: Be.CLASS,
4502 value: la(i)
4503 });
4504 }
4505 }, {
4506 name: "dataExists",
4507 query: !0,
4508 regex: "\\[\\s*(" + it.variable + ")\\s*\\]",
4509 populate: function(e, r, a) {
4510 var n = x(a, 1), i = n[0];
4511 r.checks.push({
4512 type: Be.DATA_EXIST,
4513 field: la(i)
4514 });
4515 }
4516 }, {
4517 name: "dataCompare",
4518 query: !0,
4519 regex: "\\[\\s*(" + it.variable + ")\\s*(" + it.comparatorOp + ")\\s*(" + it.value + ")\\s*\\]",
4520 populate: function(e, r, a) {
4521 var n = x(a, 3), i = n[0], s = n[1], o = n[2], l = new RegExp("^" + it.string + "$").exec(o) != null;
4522 l ? o = o.substring(1, o.length - 1) : o = parseFloat(o), r.checks.push({
4523 type: Be.DATA_COMPARE,
4524 field: la(i),
4525 operator: s,
4526 value: o
4527 });
4528 }
4529 }, {
4530 name: "dataBool",
4531 query: !0,
4532 regex: "\\[\\s*(" + it.boolOp + ")\\s*(" + it.variable + ")\\s*\\]",
4533 populate: function(e, r, a) {
4534 var n = x(a, 2), i = n[0], s = n[1];
4535 r.checks.push({
4536 type: Be.DATA_BOOL,
4537 field: la(s),
4538 operator: i
4539 });
4540 }
4541 }, {
4542 name: "metaCompare",
4543 query: !0,
4544 regex: "\\[\\[\\s*(" + it.meta + ")\\s*(" + it.comparatorOp + ")\\s*(" + it.number + ")\\s*\\]\\]",
4545 populate: function(e, r, a) {
4546 var n = x(a, 3), i = n[0], s = n[1], o = n[2];
4547 r.checks.push({
4548 type: Be.META_COMPARE,
4549 field: la(i),
4550 operator: s,
4551 value: parseFloat(o)
4552 });
4553 }
4554 }, {
4555 name: "nextQuery",
4556 separator: !0,
4557 regex: it.separator,
4558 populate: function(e, r) {
4559 var a = e.currentSubject, n = e.edgeCount, i = e.compoundCount, s = e[e.length - 1];
4560 a != null && (s.subject = a, e.currentSubject = null), s.edgeCount = n, s.compoundCount = i, e.edgeCount = 0, e.compoundCount = 0;
4561 var o = e[e.length++] = gt();
4562 return o;
4563 }
4564 }, {
4565 name: "directedEdge",
4566 separator: !0,
4567 regex: it.directedEdge,
4568 populate: function(e, r) {
4569 if (e.currentSubject == null) {
4570 var a = gt(), n = r, i = gt();
4571 return a.checks.push({
4572 type: Be.DIRECTED_EDGE,
4573 source: n,
4574 target: i
4575 }), Cr(e, r, a), e.edgeCount++, i;
4576 } else {
4577 var s = gt(), o = r, l = gt();
4578 return s.checks.push({
4579 type: Be.NODE_SOURCE,
4580 source: o,
4581 target: l
4582 }), Cr(e, r, s), e.edgeCount++, l;
4583 }
4584 }
4585 }, {
4586 name: "undirectedEdge",
4587 separator: !0,
4588 regex: it.undirectedEdge,
4589 populate: function(e, r) {
4590 if (e.currentSubject == null) {
4591 var a = gt(), n = r, i = gt();
4592 return a.checks.push({
4593 type: Be.UNDIRECTED_EDGE,
4594 nodes: [n, i]
4595 }), Cr(e, r, a), e.edgeCount++, i;
4596 } else {
4597 var s = gt(), o = r, l = gt();
4598 return s.checks.push({
4599 type: Be.NODE_NEIGHBOR,
4600 node: o,
4601 neighbor: l
4602 }), Cr(e, r, s), l;
4603 }
4604 }
4605 }, {
4606 name: "child",
4607 separator: !0,
4608 regex: it.child,
4609 populate: function(e, r) {
4610 if (e.currentSubject == null) {
4611 var a = gt(), n = gt(), i = e[e.length - 1];
4612 return a.checks.push({
4613 type: Be.CHILD,
4614 parent: i,
4615 child: n
4616 }), Cr(e, r, a), e.compoundCount++, n;
4617 } else if (e.currentSubject === r) {
4618 var s = gt(), o = e[e.length - 1], l = gt(), u = gt(), f = gt(), h = gt();
4619 return s.checks.push({
4620 type: Be.COMPOUND_SPLIT,
4621 left: o,
4622 right: l,
4623 subject: u
4624 }), u.checks = r.checks, r.checks = [{
4625 type: Be.TRUE
4626 }], h.checks.push({
4627 type: Be.TRUE
4628 }), l.checks.push({
4629 type: Be.PARENT,
4630 // type is swapped on right side queries
4631 parent: h,
4632 child: f
4633 // empty for now
4634 }), Cr(e, o, s), e.currentSubject = u, e.compoundCount++, f;
4635 } else {
4636 var c = gt(), v = gt(), d = [{
4637 type: Be.PARENT,
4638 parent: c,
4639 child: v
4640 }];
4641 return c.checks = r.checks, r.checks = d, e.compoundCount++, v;
4642 }
4643 }
4644 }, {
4645 name: "descendant",
4646 separator: !0,
4647 regex: it.descendant,
4648 populate: function(e, r) {
4649 if (e.currentSubject == null) {
4650 var a = gt(), n = gt(), i = e[e.length - 1];
4651 return a.checks.push({
4652 type: Be.DESCENDANT,
4653 ancestor: i,
4654 descendant: n
4655 }), Cr(e, r, a), e.compoundCount++, n;
4656 } else if (e.currentSubject === r) {
4657 var s = gt(), o = e[e.length - 1], l = gt(), u = gt(), f = gt(), h = gt();
4658 return s.checks.push({
4659 type: Be.COMPOUND_SPLIT,
4660 left: o,
4661 right: l,
4662 subject: u
4663 }), u.checks = r.checks, r.checks = [{
4664 type: Be.TRUE
4665 }], h.checks.push({
4666 type: Be.TRUE
4667 }), l.checks.push({
4668 type: Be.ANCESTOR,
4669 // type is swapped on right side queries
4670 ancestor: h,
4671 descendant: f
4672 // empty for now
4673 }), Cr(e, o, s), e.currentSubject = u, e.compoundCount++, f;
4674 } else {
4675 var c = gt(), v = gt(), d = [{
4676 type: Be.ANCESTOR,
4677 ancestor: c,
4678 descendant: v
4679 }];
4680 return c.checks = r.checks, r.checks = d, e.compoundCount++, v;
4681 }
4682 }
4683 }, {
4684 name: "subject",
4685 modifier: !0,
4686 regex: it.subject,
4687 populate: function(e, r) {
4688 if (e.currentSubject != null && e.currentSubject !== r)
4689 return ft("Redefinition of subject in selector `" + e.toString() + "`"), !1;
4690 e.currentSubject = r;
4691 var a = e[e.length - 1], n = a.checks[0], i = n == null ? null : n.type;
4692 i === Be.DIRECTED_EDGE ? n.type = Be.NODE_TARGET : i === Be.UNDIRECTED_EDGE && (n.type = Be.NODE_NEIGHBOR, n.node = n.nodes[1], n.neighbor = n.nodes[0], n.nodes = null);
4693 }
4694 }];
4695 Di.forEach(function(t) {
4696 return t.regexObj = new RegExp("^" + t.regex);
4697 });
4698 var Yv = function(e) {
4699 for (var r, a, n, i = 0; i < Di.length; i++) {
4700 var s = Di[i], o = s.name, l = e.match(s.regexObj);
4701 if (l != null) {
4702 a = l, r = s, n = o;
4703 var u = l[0];
4704 e = e.substring(u.length);
4705 break;
4706 }
4707 }
4708 return {
4709 expr: r,
4710 match: a,
4711 name: n,
4712 remaining: e
4713 };
4714 }, Hv = function(e) {
4715 var r = e.match(/^\s+/);
4716 if (r) {
4717 var a = r[0];
4718 e = e.substring(a.length);
4719 }
4720 return e;
4721 }, Xv = function(e) {
4722 var r = this, a = r.inputText = e, n = r[0] = gt();
4723 for (r.length = 1, a = Hv(a); ; ) {
4724 var i = Yv(a);
4725 if (i.expr == null)
4726 return ft("The selector `" + e + "`is invalid"), !1;
4727 var s = i.match.slice(1), o = i.expr.populate(r, n, s);
4728 if (o === !1)
4729 return !1;
4730 if (o != null && (n = o), a = i.remaining, a.match(/^\s*$/))
4731 break;
4732 }
4733 var l = r[r.length - 1];
4734 r.currentSubject != null && (l.subject = r.currentSubject), l.edgeCount = r.edgeCount, l.compoundCount = r.compoundCount;
4735 for (var u = 0; u < r.length; u++) {
4736 var f = r[u];
4737 if (f.compoundCount > 0 && f.edgeCount > 0)
4738 return ft("The selector `" + e + "` is invalid because it uses both a compound selector and an edge selector"), !1;
4739 if (f.edgeCount > 1)
4740 return ft("The selector `" + e + "` is invalid because it uses multiple edge selectors"), !1;
4741 f.edgeCount === 1 && ft("The selector `" + e + "` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.");
4742 }
4743 return !0;
4744 }, qv = function() {
4745 if (this.toStringCache != null)
4746 return this.toStringCache;
4747 for (var e = function(f) {
4748 return f ?? "";
4749 }, r = function(f) {
4750 return j(f) ? '"' + f + '"' : e(f);
4751 }, a = function(f) {
4752 return " " + f + " ";
4753 }, n = function(f, h) {
4754 var c = f.type, v = f.value;
4755 switch (c) {
4756 case Be.GROUP: {
4757 var d = e(v);
4758 return d.substring(0, d.length - 1);
4759 }
4760 case Be.DATA_COMPARE: {
4761 var g = f.field, y = f.operator;
4762 return "[" + g + a(e(y)) + r(v) + "]";
4763 }
4764 case Be.DATA_BOOL: {
4765 var p = f.operator, m = f.field;
4766 return "[" + e(p) + m + "]";
4767 }
4768 case Be.DATA_EXIST: {
4769 var b = f.field;
4770 return "[" + b + "]";
4771 }
4772 case Be.META_COMPARE: {
4773 var E = f.operator, M = f.field;
4774 return "[[" + M + a(e(E)) + r(v) + "]]";
4775 }
4776 case Be.STATE:
4777 return v;
4778 case Be.ID:
4779 return "#" + v;
4780 case Be.CLASS:
4781 return "." + v;
4782 case Be.PARENT:
4783 case Be.CHILD:
4784 return i(f.parent, h) + a(">") + i(f.child, h);
4785 case Be.ANCESTOR:
4786 case Be.DESCENDANT:
4787 return i(f.ancestor, h) + " " + i(f.descendant, h);
4788 case Be.COMPOUND_SPLIT: {
4789 var A = i(f.left, h), w = i(f.subject, h), I = i(f.right, h);
4790 return A + (A.length > 0 ? " " : "") + w + I;
4791 }
4792 case Be.TRUE:
4793 return "";
4794 }
4795 }, i = function(f, h) {
4796 return f.checks.reduce(function(c, v, d) {
4797 return c + (h === f && d === 0 ? "$" : "") + n(v, h);
4798 }, "");
4799 }, s = "", o = 0; o < this.length; o++) {
4800 var l = this[o];
4801 s += i(l, l.subject), this.length > 1 && o < this.length - 1 && (s += ", ");
4802 }
4803 return this.toStringCache = s, s;
4804 }, Wv = {
4805 parse: Xv,
4806 toString: qv
4807 }, fo = function(e, r, a) {
4808 var n, i = j(e), s = k(e), o = j(a), l, u, f = !1, h = !1, c = !1;
4809 switch (r.indexOf("!") >= 0 && (r = r.replace("!", ""), h = !0), r.indexOf("@") >= 0 && (r = r.replace("@", ""), f = !0), (i || o || f) && (l = !i && !s ? "" : "" + e, u = "" + a), f && (e = l = l.toLowerCase(), a = u = u.toLowerCase()), r) {
4810 case "*=":
4811 n = l.indexOf(u) >= 0;
4812 break;
4813 case "$=":
4814 n = l.indexOf(u, l.length - u.length) >= 0;
4815 break;
4816 case "^=":
4817 n = l.indexOf(u) === 0;
4818 break;
4819 case "=":
4820 n = e === a;
4821 break;
4822 case ">":
4823 c = !0, n = e > a;
4824 break;
4825 case ">=":
4826 c = !0, n = e >= a;
4827 break;
4828 case "<":
4829 c = !0, n = e < a;
4830 break;
4831 case "<=":
4832 c = !0, n = e <= a;
4833 break;
4834 default:
4835 n = !1;
4836 break;
4837 }
4838 return h && (e != null || !c) && (n = !n), n;
4839 }, Kv = function(e, r) {
4840 switch (r) {
4841 case "?":
4842 return !!e;
4843 case "!":
4844 return !e;
4845 case "^":
4846 return e === void 0;
4847 }
4848 }, Zv = function(e) {
4849 return e !== void 0;
4850 }, Si = function(e, r) {
4851 return e.data(r);
4852 }, Qv = function(e, r) {
4853 return e[r]();
4854 }, Tt = [], wt = function(e, r) {
4855 return e.checks.every(function(a) {
4856 return Tt[a.type](a, r);
4857 });
4858 };
4859 Tt[Be.GROUP] = function(t, e) {
4860 var r = t.value;
4861 return r === "*" || r === e.group();
4862 }, Tt[Be.STATE] = function(t, e) {
4863 var r = t.value;
4864 return _v(r, e);
4865 }, Tt[Be.ID] = function(t, e) {
4866 var r = t.value;
4867 return e.id() === r;
4868 }, Tt[Be.CLASS] = function(t, e) {
4869 var r = t.value;
4870 return e.hasClass(r);
4871 }, Tt[Be.META_COMPARE] = function(t, e) {
4872 var r = t.field, a = t.operator, n = t.value;
4873 return fo(Qv(e, r), a, n);
4874 }, Tt[Be.DATA_COMPARE] = function(t, e) {
4875 var r = t.field, a = t.operator, n = t.value;
4876 return fo(Si(e, r), a, n);
4877 }, Tt[Be.DATA_BOOL] = function(t, e) {
4878 var r = t.field, a = t.operator;
4879 return Kv(Si(e, r), a);
4880 }, Tt[Be.DATA_EXIST] = function(t, e) {
4881 var r = t.field;
4882 return t.operator, Zv(Si(e, r));
4883 }, Tt[Be.UNDIRECTED_EDGE] = function(t, e) {
4884 var r = t.nodes[0], a = t.nodes[1], n = e.source(), i = e.target();
4885 return wt(r, n) && wt(a, i) || wt(a, n) && wt(r, i);
4886 }, Tt[Be.NODE_NEIGHBOR] = function(t, e) {
4887 return wt(t.node, e) && e.neighborhood().some(function(r) {
4888 return r.isNode() && wt(t.neighbor, r);
4889 });
4890 }, Tt[Be.DIRECTED_EDGE] = function(t, e) {
4891 return wt(t.source, e.source()) && wt(t.target, e.target());
4892 }, Tt[Be.NODE_SOURCE] = function(t, e) {
4893 return wt(t.source, e) && e.outgoers().some(function(r) {
4894 return r.isNode() && wt(t.target, r);
4895 });
4896 }, Tt[Be.NODE_TARGET] = function(t, e) {
4897 return wt(t.target, e) && e.incomers().some(function(r) {
4898 return r.isNode() && wt(t.source, r);
4899 });
4900 }, Tt[Be.CHILD] = function(t, e) {
4901 return wt(t.child, e) && wt(t.parent, e.parent());
4902 }, Tt[Be.PARENT] = function(t, e) {
4903 return wt(t.parent, e) && e.children().some(function(r) {
4904 return wt(t.child, r);
4905 });
4906 }, Tt[Be.DESCENDANT] = function(t, e) {
4907 return wt(t.descendant, e) && e.ancestors().some(function(r) {
4908 return wt(t.ancestor, r);
4909 });
4910 }, Tt[Be.ANCESTOR] = function(t, e) {
4911 return wt(t.ancestor, e) && e.descendants().some(function(r) {
4912 return wt(t.descendant, r);
4913 });
4914 }, Tt[Be.COMPOUND_SPLIT] = function(t, e) {
4915 return wt(t.subject, e) && wt(t.left, e) && wt(t.right, e);
4916 }, Tt[Be.TRUE] = function() {
4917 return !0;
4918 }, Tt[Be.COLLECTION] = function(t, e) {
4919 var r = t.value;
4920 return r.has(e);
4921 }, Tt[Be.FILTER] = function(t, e) {
4922 var r = t.value;
4923 return r(e);
4924 };
4925 var Jv = function(e) {
4926 var r = this;
4927 if (r.length === 1 && r[0].checks.length === 1 && r[0].checks[0].type === Be.ID)
4928 return e.getElementById(r[0].checks[0].value).collection();
4929 var a = function(i) {
4930 for (var s = 0; s < r.length; s++) {
4931 var o = r[s];
4932 if (wt(o, i))
4933 return !0;
4934 }
4935 return !1;
4936 };
4937 return r.text() == null && (a = function() {
4938 return !0;
4939 }), e.filter(a);
4940 }, jv = function(e) {
4941 for (var r = this, a = 0; a < r.length; a++) {
4942 var n = r[a];
4943 if (wt(n, e))
4944 return !0;
4945 }
4946 return !1;
4947 }, ed = {
4948 matches: jv,
4949 filter: Jv
4950 }, Dr = function(e) {
4951 this.inputText = e, this.currentSubject = null, this.compoundCount = 0, this.edgeCount = 0, this.length = 0, e == null || j(e) && e.match(/^\s*$/) || (pe(e) ? this.addQuery({
4952 checks: [{
4953 type: Be.COLLECTION,
4954 value: e.collection()
4955 }]
4956 }) : Y(e) ? this.addQuery({
4957 checks: [{
4958 type: Be.FILTER,
4959 value: e
4960 }]
4961 }) : j(e) ? this.parse(e) || (this.invalid = !0) : xt("A selector must be created from a string; found "));
4962 }, Sr = Dr.prototype;
4963 [Wv, ed].forEach(function(t) {
4964 return Ue(Sr, t);
4965 }), Sr.text = function() {
4966 return this.inputText;
4967 }, Sr.size = function() {
4968 return this.length;
4969 }, Sr.eq = function(t) {
4970 return this[t];
4971 }, Sr.sameText = function(t) {
4972 return !this.invalid && !t.invalid && this.text() === t.text();
4973 }, Sr.addQuery = function(t) {
4974 this[this.length++] = t;
4975 }, Sr.selector = Sr.toString;
4976 var Lr = {
4977 allAre: function(e) {
4978 var r = new Dr(e);
4979 return this.every(function(a) {
4980 return r.matches(a);
4981 });
4982 },
4983 is: function(e) {
4984 var r = new Dr(e);
4985 return this.some(function(a) {
4986 return r.matches(a);
4987 });
4988 },
4989 some: function(e, r) {
4990 for (var a = 0; a < this.length; a++) {
4991 var n = r ? e.apply(r, [this[a], a, this]) : e(this[a], a, this);
4992 if (n)
4993 return !0;
4994 }
4995 return !1;
4996 },
4997 every: function(e, r) {
4998 for (var a = 0; a < this.length; a++) {
4999 var n = r ? e.apply(r, [this[a], a, this]) : e(this[a], a, this);
5000 if (!n)
5001 return !1;
5002 }
5003 return !0;
5004 },
5005 same: function(e) {
5006 if (this === e)
5007 return !0;
5008 e = this.cy().collection(e);
5009 var r = this.length, a = e.length;
5010 return r !== a ? !1 : r === 1 ? this[0] === e[0] : this.every(function(n) {
5011 return e.hasElementWithId(n.id());
5012 });
5013 },
5014 anySame: function(e) {
5015 return e = this.cy().collection(e), this.some(function(r) {
5016 return e.hasElementWithId(r.id());
5017 });
5018 },
5019 allAreNeighbors: function(e) {
5020 e = this.cy().collection(e);
5021 var r = this.neighborhood();
5022 return e.every(function(a) {
5023 return r.hasElementWithId(a.id());
5024 });
5025 },
5026 contains: function(e) {
5027 e = this.cy().collection(e);
5028 var r = this;
5029 return e.every(function(a) {
5030 return r.hasElementWithId(a.id());
5031 });
5032 }
5033 };
5034 Lr.allAreNeighbours = Lr.allAreNeighbors, Lr.has = Lr.contains, Lr.equal = Lr.equals = Lr.same;
5035 var Kt = function(e, r) {
5036 return function(n, i, s, o) {
5037 var l = n, u = this, f;
5038 if (l == null ? f = "" : pe(l) && l.length === 1 && (f = l.id()), u.length === 1 && f) {
5039 var h = u[0]._private, c = h.traversalCache = h.traversalCache || {}, v = c[r] = c[r] || [], d = kr(f), g = v[d];
5040 return g || (v[d] = e.call(u, n, i, s, o));
5041 } else
5042 return e.call(u, n, i, s, o);
5043 };
5044 }, fa = {
5045 parent: function(e) {
5046 var r = [];
5047 if (this.length === 1) {
5048 var a = this[0]._private.parent;
5049 if (a)
5050 return a;
5051 }
5052 for (var n = 0; n < this.length; n++) {
5053 var i = this[n], s = i._private.parent;
5054 s && r.push(s);
5055 }
5056 return this.spawn(r, !0).filter(e);
5057 },
5058 parents: function(e) {
5059 for (var r = [], a = this.parent(); a.nonempty(); ) {
5060 for (var n = 0; n < a.length; n++) {
5061 var i = a[n];
5062 r.push(i);
5063 }
5064 a = a.parent();
5065 }
5066 return this.spawn(r, !0).filter(e);
5067 },
5068 commonAncestors: function(e) {
5069 for (var r, a = 0; a < this.length; a++) {
5070 var n = this[a], i = n.parents();
5071 r = r || i, r = r.intersect(i);
5072 }
5073 return r.filter(e);
5074 },
5075 orphans: function(e) {
5076 return this.stdFilter(function(r) {
5077 return r.isOrphan();
5078 }).filter(e);
5079 },
5080 nonorphans: function(e) {
5081 return this.stdFilter(function(r) {
5082 return r.isChild();
5083 }).filter(e);
5084 },
5085 children: Kt(function(t) {
5086 for (var e = [], r = 0; r < this.length; r++)
5087 for (var a = this[r], n = a._private.children, i = 0; i < n.length; i++)
5088 e.push(n[i]);
5089 return this.spawn(e, !0).filter(t);
5090 }, "children"),
5091 siblings: function(e) {
5092 return this.parent().children().not(this).filter(e);
5093 },
5094 isParent: function() {
5095 var e = this[0];
5096 if (e)
5097 return e.isNode() && e._private.children.length !== 0;
5098 },
5099 isChildless: function() {
5100 var e = this[0];
5101 if (e)
5102 return e.isNode() && e._private.children.length === 0;
5103 },
5104 isChild: function() {
5105 var e = this[0];
5106 if (e)
5107 return e.isNode() && e._private.parent != null;
5108 },
5109 isOrphan: function() {
5110 var e = this[0];
5111 if (e)
5112 return e.isNode() && e._private.parent == null;
5113 },
5114 descendants: function(e) {
5115 var r = [];
5116 function a(n) {
5117 for (var i = 0; i < n.length; i++) {
5118 var s = n[i];
5119 r.push(s), s.children().nonempty() && a(s.children());
5120 }
5121 }
5122 return a(this.children()), this.spawn(r, !0).filter(e);
5123 }
5124 };
5125 function Li(t, e, r, a) {
5126 for (var n = [], i = new Jr(), s = t.cy(), o = s.hasCompoundNodes(), l = 0; l < t.length; l++) {
5127 var u = t[l];
5128 r ? n.push(u) : o && a(n, i, u);
5129 }
5130 for (; n.length > 0; ) {
5131 var f = n.shift();
5132 e(f), i.add(f.id()), o && a(n, i, f);
5133 }
5134 return t;
5135 }
5136 function ho(t, e, r) {
5137 if (r.isParent())
5138 for (var a = r._private.children, n = 0; n < a.length; n++) {
5139 var i = a[n];
5140 e.has(i.id()) || t.push(i);
5141 }
5142 }
5143 fa.forEachDown = function(t) {
5144 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
5145 return Li(this, t, e, ho);
5146 };
5147 function co(t, e, r) {
5148 if (r.isChild()) {
5149 var a = r._private.parent;
5150 e.has(a.id()) || t.push(a);
5151 }
5152 }
5153 fa.forEachUp = function(t) {
5154 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
5155 return Li(this, t, e, co);
5156 };
5157 function td(t, e, r) {
5158 co(t, e, r), ho(t, e, r);
5159 }
5160 fa.forEachUpAndDown = function(t) {
5161 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
5162 return Li(this, t, e, td);
5163 }, fa.ancestors = fa.parents;
5164 var $a, vo;
5165 $a = vo = {
5166 data: ht.data({
5167 field: "data",
5168 bindingEvent: "data",
5169 allowBinding: !0,
5170 allowSetting: !0,
5171 settingEvent: "data",
5172 settingTriggersEvent: !0,
5173 triggerFnName: "trigger",
5174 allowGetting: !0,
5175 immutableKeys: {
5176 id: !0,
5177 source: !0,
5178 target: !0,
5179 parent: !0
5180 },
5181 updateStyle: !0
5182 }),
5183 removeData: ht.removeData({
5184 field: "data",
5185 event: "data",
5186 triggerFnName: "trigger",
5187 triggerEvent: !0,
5188 immutableKeys: {
5189 id: !0,
5190 source: !0,
5191 target: !0,
5192 parent: !0
5193 },
5194 updateStyle: !0
5195 }),
5196 scratch: ht.data({
5197 field: "scratch",
5198 bindingEvent: "scratch",
5199 allowBinding: !0,
5200 allowSetting: !0,
5201 settingEvent: "scratch",
5202 settingTriggersEvent: !0,
5203 triggerFnName: "trigger",
5204 allowGetting: !0,
5205 updateStyle: !0
5206 }),
5207 removeScratch: ht.removeData({
5208 field: "scratch",
5209 event: "scratch",
5210 triggerFnName: "trigger",
5211 triggerEvent: !0,
5212 updateStyle: !0
5213 }),
5214 rscratch: ht.data({
5215 field: "rscratch",
5216 allowBinding: !1,
5217 allowSetting: !0,
5218 settingTriggersEvent: !1,
5219 allowGetting: !0
5220 }),
5221 removeRscratch: ht.removeData({
5222 field: "rscratch",
5223 triggerEvent: !1
5224 }),
5225 id: function() {
5226 var e = this[0];
5227 if (e)
5228 return e._private.data.id;
5229 }
5230 }, $a.attr = $a.data, $a.removeAttr = $a.removeData;
5231 var rd = vo, Ln = {};
5232 function Ai(t) {
5233 return function(e) {
5234 var r = this;
5235 if (e === void 0 && (e = !0), r.length !== 0)
5236 if (r.isNode() && !r.removed()) {
5237 for (var a = 0, n = r[0], i = n._private.edges, s = 0; s < i.length; s++) {
5238 var o = i[s];
5239 !e && o.isLoop() || (a += t(n, o));
5240 }
5241 return a;
5242 } else
5243 return;
5244 };
5245 }
5246 Ue(Ln, {
5247 degree: Ai(function(t, e) {
5248 return e.source().same(e.target()) ? 2 : 1;
5249 }),
5250 indegree: Ai(function(t, e) {
5251 return e.target().same(t) ? 1 : 0;
5252 }),
5253 outdegree: Ai(function(t, e) {
5254 return e.source().same(t) ? 1 : 0;
5255 })
5256 });
5257 function ha(t, e) {
5258 return function(r) {
5259 for (var a, n = this.nodes(), i = 0; i < n.length; i++) {
5260 var s = n[i], o = s[t](r);
5261 o !== void 0 && (a === void 0 || e(o, a)) && (a = o);
5262 }
5263 return a;
5264 };
5265 }
5266 Ue(Ln, {
5267 minDegree: ha("degree", function(t, e) {
5268 return t < e;
5269 }),
5270 maxDegree: ha("degree", function(t, e) {
5271 return t > e;
5272 }),
5273 minIndegree: ha("indegree", function(t, e) {
5274 return t < e;
5275 }),
5276 maxIndegree: ha("indegree", function(t, e) {
5277 return t > e;
5278 }),
5279 minOutdegree: ha("outdegree", function(t, e) {
5280 return t < e;
5281 }),
5282 maxOutdegree: ha("outdegree", function(t, e) {
5283 return t > e;
5284 })
5285 }), Ue(Ln, {
5286 totalDegree: function(e) {
5287 for (var r = 0, a = this.nodes(), n = 0; n < a.length; n++)
5288 r += a[n].degree(e);
5289 return r;
5290 }
5291 });
5292 var tr, go, po = function(e, r, a) {
5293 for (var n = 0; n < e.length; n++) {
5294 var i = e[n];
5295 if (!i.locked()) {
5296 var s = i._private.position, o = {
5297 x: r.x != null ? r.x - s.x : 0,
5298 y: r.y != null ? r.y - s.y : 0
5299 };
5300 i.isParent() && !(o.x === 0 && o.y === 0) && i.children().shift(o, a), i.dirtyBoundingBoxCache();
5301 }
5302 }
5303 }, yo = {
5304 field: "position",
5305 bindingEvent: "position",
5306 allowBinding: !0,
5307 allowSetting: !0,
5308 settingEvent: "position",
5309 settingTriggersEvent: !0,
5310 triggerFnName: "emitAndNotify",
5311 allowGetting: !0,
5312 validKeys: ["x", "y"],
5313 beforeGet: function(e) {
5314 e.updateCompoundBounds();
5315 },
5316 beforeSet: function(e, r) {
5317 po(e, r, !1);
5318 },
5319 onSet: function(e) {
5320 e.dirtyCompoundBoundsCache();
5321 },
5322 canSet: function(e) {
5323 return !e.locked();
5324 }
5325 };
5326 tr = go = {
5327 position: ht.data(yo),
5328 // position but no notification to renderer
5329 silentPosition: ht.data(Ue({}, yo, {
5330 allowBinding: !1,
5331 allowSetting: !0,
5332 settingTriggersEvent: !1,
5333 allowGetting: !1,
5334 beforeSet: function(e, r) {
5335 po(e, r, !0);
5336 },
5337 onSet: function(e) {
5338 e.dirtyCompoundBoundsCache();
5339 }
5340 })),
5341 positions: function(e, r) {
5342 if (L(e))
5343 r ? this.silentPosition(e) : this.position(e);
5344 else if (Y(e)) {
5345 var a = e, n = this.cy();
5346 n.startBatch();
5347 for (var i = 0; i < this.length; i++) {
5348 var s = this[i], o = void 0;
5349 (o = a(s, i)) && (r ? s.silentPosition(o) : s.position(o));
5350 }
5351 n.endBatch();
5352 }
5353 return this;
5354 },
5355 silentPositions: function(e) {
5356 return this.positions(e, !0);
5357 },
5358 shift: function(e, r, a) {
5359 var n;
5360 if (L(e) ? (n = {
5361 x: k(e.x) ? e.x : 0,
5362 y: k(e.y) ? e.y : 0
5363 }, a = r) : j(e) && k(r) && (n = {
5364 x: 0,
5365 y: 0
5366 }, n[e] = r), n != null) {
5367 var i = this.cy();
5368 i.startBatch();
5369 for (var s = 0; s < this.length; s++) {
5370 var o = this[s];
5371 if (!(i.hasCompoundNodes() && o.isChild() && o.ancestors().anySame(this))) {
5372 var l = o.position(), u = {
5373 x: l.x + n.x,
5374 y: l.y + n.y
5375 };
5376 a ? o.silentPosition(u) : o.position(u);
5377 }
5378 }
5379 i.endBatch();
5380 }
5381 return this;
5382 },
5383 silentShift: function(e, r) {
5384 return L(e) ? this.shift(e, !0) : j(e) && k(r) && this.shift(e, r, !0), this;
5385 },
5386 // get/set the rendered (i.e. on screen) positon of the element
5387 renderedPosition: function(e, r) {
5388 var a = this[0], n = this.cy(), i = n.zoom(), s = n.pan(), o = L(e) ? e : void 0, l = o !== void 0 || r !== void 0 && j(e);
5389 if (a && a.isNode())
5390 if (l)
5391 for (var u = 0; u < this.length; u++) {
5392 var f = this[u];
5393 r !== void 0 ? f.position(e, (r - s[e]) / i) : o !== void 0 && f.position(bs(o, i, s));
5394 }
5395 else {
5396 var h = a.position();
5397 return o = dn(h, i, s), e === void 0 ? o : o[e];
5398 }
5399 else if (!l)
5400 return;
5401 return this;
5402 },
5403 // get/set the position relative to the parent
5404 relativePosition: function(e, r) {
5405 var a = this[0], n = this.cy(), i = L(e) ? e : void 0, s = i !== void 0 || r !== void 0 && j(e), o = n.hasCompoundNodes();
5406 if (a && a.isNode())
5407 if (s)
5408 for (var l = 0; l < this.length; l++) {
5409 var u = this[l], f = o ? u.parent() : null, h = f && f.length > 0, c = h;
5410 h && (f = f[0]);
5411 var v = c ? f.position() : {
5412 x: 0,
5413 y: 0
5414 };
5415 r !== void 0 ? u.position(e, r + v[e]) : i !== void 0 && u.position({
5416 x: i.x + v.x,
5417 y: i.y + v.y
5418 });
5419 }
5420 else {
5421 var d = a.position(), g = o ? a.parent() : null, y = g && g.length > 0, p = y;
5422 y && (g = g[0]);
5423 var m = p ? g.position() : {
5424 x: 0,
5425 y: 0
5426 };
5427 return i = {
5428 x: d.x - m.x,
5429 y: d.y - m.y
5430 }, e === void 0 ? i : i[e];
5431 }
5432 else if (!s)
5433 return;
5434 return this;
5435 }
5436 }, tr.modelPosition = tr.point = tr.position, tr.modelPositions = tr.points = tr.positions, tr.renderedPoint = tr.renderedPosition, tr.relativePoint = tr.relativePosition;
5437 var ad = go, ca, Ar;
5438 ca = Ar = {}, Ar.renderedBoundingBox = function(t) {
5439 var e = this.boundingBox(t), r = this.cy(), a = r.zoom(), n = r.pan(), i = e.x1 * a + n.x, s = e.x2 * a + n.x, o = e.y1 * a + n.y, l = e.y2 * a + n.y;
5440 return {
5441 x1: i,
5442 x2: s,
5443 y1: o,
5444 y2: l,
5445 w: s - i,
5446 h: l - o
5447 };
5448 }, Ar.dirtyCompoundBoundsCache = function() {
5449 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy();
5450 return !e.styleEnabled() || !e.hasCompoundNodes() ? this : (this.forEachUp(function(r) {
5451 if (r.isParent()) {
5452 var a = r._private;
5453 a.compoundBoundsClean = !1, a.bbCache = null, t || r.emitAndNotify("bounds");
5454 }
5455 }), this);
5456 }, Ar.updateCompoundBounds = function() {
5457 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy();
5458 if (!e.styleEnabled() || !e.hasCompoundNodes())
5459 return this;
5460 if (!t && e.batching())
5461 return this;
5462 function r(s) {
5463 if (!s.isParent())
5464 return;
5465 var o = s._private, l = s.children(), u = s.pstyle("compound-sizing-wrt-labels").value === "include", f = {
5466 width: {
5467 val: s.pstyle("min-width").pfValue,
5468 left: s.pstyle("min-width-bias-left"),
5469 right: s.pstyle("min-width-bias-right")
5470 },
5471 height: {
5472 val: s.pstyle("min-height").pfValue,
5473 top: s.pstyle("min-height-bias-top"),
5474 bottom: s.pstyle("min-height-bias-bottom")
5475 }
5476 }, h = l.boundingBox({
5477 includeLabels: u,
5478 includeOverlays: !1,
5479 // updating the compound bounds happens outside of the regular
5480 // cache cycle (i.e. before fired events)
5481 useCache: !1
5482 }), c = o.position;
5483 (h.w === 0 || h.h === 0) && (h = {
5484 w: s.pstyle("width").pfValue,
5485 h: s.pstyle("height").pfValue
5486 }, h.x1 = c.x - h.w / 2, h.x2 = c.x + h.w / 2, h.y1 = c.y - h.h / 2, h.y2 = c.y + h.h / 2);
5487 function v(C, B, F) {
5488 var R = 0, X = 0, z = B + F;
5489 return C > 0 && z > 0 && (R = B / z * C, X = F / z * C), {
5490 biasDiff: R,
5491 biasComplementDiff: X
5492 };
5493 }
5494 function d(C, B, F, R) {
5495 if (F.units === "%")
5496 switch (R) {
5497 case "width":
5498 return C > 0 ? F.pfValue * C : 0;
5499 case "height":
5500 return B > 0 ? F.pfValue * B : 0;
5501 case "average":
5502 return C > 0 && B > 0 ? F.pfValue * (C + B) / 2 : 0;
5503 case "min":
5504 return C > 0 && B > 0 ? C > B ? F.pfValue * B : F.pfValue * C : 0;
5505 case "max":
5506 return C > 0 && B > 0 ? C > B ? F.pfValue * C : F.pfValue * B : 0;
5507 default:
5508 return 0;
5509 }
5510 else
5511 return F.units === "px" ? F.pfValue : 0;
5512 }
5513 var g = f.width.left.value;
5514 f.width.left.units === "px" && f.width.val > 0 && (g = g * 100 / f.width.val);
5515 var y = f.width.right.value;
5516 f.width.right.units === "px" && f.width.val > 0 && (y = y * 100 / f.width.val);
5517 var p = f.height.top.value;
5518 f.height.top.units === "px" && f.height.val > 0 && (p = p * 100 / f.height.val);
5519 var m = f.height.bottom.value;
5520 f.height.bottom.units === "px" && f.height.val > 0 && (m = m * 100 / f.height.val);
5521 var b = v(f.width.val - h.w, g, y), E = b.biasDiff, M = b.biasComplementDiff, A = v(f.height.val - h.h, p, m), w = A.biasDiff, I = A.biasComplementDiff;
5522 o.autoPadding = d(h.w, h.h, s.pstyle("padding"), s.pstyle("padding-relative-to").value), o.autoWidth = Math.max(h.w, f.width.val), c.x = (-E + h.x1 + h.x2 + M) / 2, o.autoHeight = Math.max(h.h, f.height.val), c.y = (-w + h.y1 + h.y2 + I) / 2;
5523 }
5524 for (var a = 0; a < this.length; a++) {
5525 var n = this[a], i = n._private;
5526 (!i.compoundBoundsClean || t) && (r(n), e.batching() || (i.compoundBoundsClean = !0));
5527 }
5528 return this;
5529 };
5530 var Zt = function(e) {
5531 return e === 1 / 0 || e === -1 / 0 ? 0 : e;
5532 }, rr = function(e, r, a, n, i) {
5533 n - r === 0 || i - a === 0 || r == null || a == null || n == null || i == null || (e.x1 = r < e.x1 ? r : e.x1, e.x2 = n > e.x2 ? n : e.x2, e.y1 = a < e.y1 ? a : e.y1, e.y2 = i > e.y2 ? i : e.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1);
5534 }, Gr = function(e, r) {
5535 return r == null ? e : rr(e, r.x1, r.y1, r.x2, r.y2);
5536 }, Va = function(e, r, a) {
5537 return er(e, r, a);
5538 }, An = function(e, r, a) {
5539 if (!r.cy().headless()) {
5540 var n = r._private, i = n.rstyle, s = i.arrowWidth / 2, o = r.pstyle(a + "-arrow-shape").value, l, u;
5541 if (o !== "none") {
5542 a === "source" ? (l = i.srcX, u = i.srcY) : a === "target" ? (l = i.tgtX, u = i.tgtY) : (l = i.midX, u = i.midY);
5543 var f = n.arrowBounds = n.arrowBounds || {}, h = f[a] = f[a] || {};
5544 h.x1 = l - s, h.y1 = u - s, h.x2 = l + s, h.y2 = u + s, h.w = h.x2 - h.x1, h.h = h.y2 - h.y1, pn(h, 1), rr(e, h.x1, h.y1, h.x2, h.y2);
5545 }
5546 }
5547 }, Oi = function(e, r, a) {
5548 if (!r.cy().headless()) {
5549 var n;
5550 a ? n = a + "-" : n = "";
5551 var i = r._private, s = i.rstyle, o = r.pstyle(n + "label").strValue;
5552 if (o) {
5553 var l = r.pstyle("text-halign"), u = r.pstyle("text-valign"), f = Va(s, "labelWidth", a), h = Va(s, "labelHeight", a), c = Va(s, "labelX", a), v = Va(s, "labelY", a), d = r.pstyle(n + "text-margin-x").pfValue, g = r.pstyle(n + "text-margin-y").pfValue, y = r.isEdge(), p = r.pstyle(n + "text-rotation"), m = r.pstyle("text-outline-width").pfValue, b = r.pstyle("text-border-width").pfValue, E = b / 2, M = r.pstyle("text-background-padding").pfValue, A = 2, w = h, I = f, C = I / 2, B = w / 2, F, R, X, z;
5554 if (y)
5555 F = c - C, R = c + C, X = v - B, z = v + B;
5556 else {
5557 switch (l.value) {
5558 case "left":
5559 F = c - I, R = c;
5560 break;
5561 case "center":
5562 F = c - C, R = c + C;
5563 break;
5564 case "right":
5565 F = c, R = c + I;
5566 break;
5567 }
5568 switch (u.value) {
5569 case "top":
5570 X = v - w, z = v;
5571 break;
5572 case "center":
5573 X = v - B, z = v + B;
5574 break;
5575 case "bottom":
5576 X = v, z = v + w;
5577 break;
5578 }
5579 }
5580 F += d - Math.max(m, E) - M - A, R += d + Math.max(m, E) + M + A, X += g - Math.max(m, E) - M - A, z += g + Math.max(m, E) + M + A;
5581 var re = a || "main", W = i.labelBounds, Z = W[re] = W[re] || {};
5582 Z.x1 = F, Z.y1 = X, Z.x2 = R, Z.y2 = z, Z.w = R - F, Z.h = z - X;
5583 var ie = y && p.strValue === "autorotate", oe = p.pfValue != null && p.pfValue !== 0;
5584 if (ie || oe) {
5585 var ge = ie ? Va(i.rstyle, "labelAngle", a) : p.pfValue, se = Math.cos(ge), de = Math.sin(ge), we = (F + R) / 2, Te = (X + z) / 2;
5586 if (!y) {
5587 switch (l.value) {
5588 case "left":
5589 we = R;
5590 break;
5591 case "right":
5592 we = F;
5593 break;
5594 }
5595 switch (u.value) {
5596 case "top":
5597 Te = z;
5598 break;
5599 case "bottom":
5600 Te = X;
5601 break;
5602 }
5603 }
5604 var Ee = function(qe, Re) {
5605 return qe = qe - we, Re = Re - Te, {
5606 x: qe * se - Re * de + we,
5607 y: qe * de + Re * se + Te
5608 };
5609 }, ye = Ee(F, X), ae = Ee(F, z), xe = Ee(R, X), Ce = Ee(R, z);
5610 F = Math.min(ye.x, ae.x, xe.x, Ce.x), R = Math.max(ye.x, ae.x, xe.x, Ce.x), X = Math.min(ye.y, ae.y, xe.y, Ce.y), z = Math.max(ye.y, ae.y, xe.y, Ce.y);
5611 }
5612 var Oe = re + "Rot", Ie = W[Oe] = W[Oe] || {};
5613 Ie.x1 = F, Ie.y1 = X, Ie.x2 = R, Ie.y2 = z, Ie.w = R - F, Ie.h = z - X, rr(e, F, X, R, z), rr(i.labelBounds.all, F, X, R, z);
5614 }
5615 return e;
5616 }
5617 }, nd = function(e, r) {
5618 var a = e._private.cy, n = a.styleEnabled(), i = a.headless(), s = Ut(), o = e._private, l = e.isNode(), u = e.isEdge(), f, h, c, v, d, g, y = o.rstyle, p = l && n ? e.pstyle("bounds-expansion").pfValue : [0], m = function(Ve) {
5619 return Ve.pstyle("display").value !== "none";
5620 }, b = !n || m(e) && (!u || m(e.source()) && m(e.target()));
5621 if (b) {
5622 var E = 0, M = 0;
5623 n && r.includeOverlays && (E = e.pstyle("overlay-opacity").value, E !== 0 && (M = e.pstyle("overlay-padding").value));
5624 var A = 0, w = 0;
5625 n && r.includeUnderlays && (A = e.pstyle("underlay-opacity").value, A !== 0 && (w = e.pstyle("underlay-padding").value));
5626 var I = Math.max(M, w), C = 0, B = 0;
5627 if (n && (C = e.pstyle("width").pfValue, B = C / 2), l && r.includeNodes) {
5628 var F = e.position();
5629 d = F.x, g = F.y;
5630 var R = e.outerWidth(), X = R / 2, z = e.outerHeight(), re = z / 2;
5631 f = d - X, h = d + X, c = g - re, v = g + re, rr(s, f, c, h, v);
5632 } else if (u && r.includeEdges)
5633 if (n && !i) {
5634 var W = e.pstyle("curve-style").strValue;
5635 if (f = Math.min(y.srcX, y.midX, y.tgtX), h = Math.max(y.srcX, y.midX, y.tgtX), c = Math.min(y.srcY, y.midY, y.tgtY), v = Math.max(y.srcY, y.midY, y.tgtY), f -= B, h += B, c -= B, v += B, rr(s, f, c, h, v), W === "haystack") {
5636 var Z = y.haystackPts;
5637 if (Z && Z.length === 2) {
5638 if (f = Z[0].x, c = Z[0].y, h = Z[1].x, v = Z[1].y, f > h) {
5639 var ie = f;
5640 f = h, h = ie;
5641 }
5642 if (c > v) {
5643 var oe = c;
5644 c = v, v = oe;
5645 }
5646 rr(s, f - B, c - B, h + B, v + B);
5647 }
5648 } else if (W === "bezier" || W === "unbundled-bezier" || W === "segments" || W === "taxi") {
5649 var ge;
5650 switch (W) {
5651 case "bezier":
5652 case "unbundled-bezier":
5653 ge = y.bezierPts;
5654 break;
5655 case "segments":
5656 case "taxi":
5657 ge = y.linePts;
5658 break;
5659 }
5660 if (ge != null)
5661 for (var se = 0; se < ge.length; se++) {
5662 var de = ge[se];
5663 f = de.x - B, h = de.x + B, c = de.y - B, v = de.y + B, rr(s, f, c, h, v);
5664 }
5665 }
5666 } else {
5667 var we = e.source(), Te = we.position(), Ee = e.target(), ye = Ee.position();
5668 if (f = Te.x, h = ye.x, c = Te.y, v = ye.y, f > h) {
5669 var ae = f;
5670 f = h, h = ae;
5671 }
5672 if (c > v) {
5673 var xe = c;
5674 c = v, v = xe;
5675 }
5676 f -= B, h += B, c -= B, v += B, rr(s, f, c, h, v);
5677 }
5678 if (n && r.includeEdges && u && (An(s, e, "mid-source"), An(s, e, "mid-target"), An(s, e, "source"), An(s, e, "target")), n) {
5679 var Ce = e.pstyle("ghost").value === "yes";
5680 if (Ce) {
5681 var Oe = e.pstyle("ghost-offset-x").pfValue, Ie = e.pstyle("ghost-offset-y").pfValue;
5682 rr(s, s.x1 + Oe, s.y1 + Ie, s.x2 + Oe, s.y2 + Ie);
5683 }
5684 }
5685 var He = o.bodyBounds = o.bodyBounds || {};
5686 ws(He, s), fi(He, p), pn(He, 1), n && (f = s.x1, h = s.x2, c = s.y1, v = s.y2, rr(s, f - I, c - I, h + I, v + I));
5687 var qe = o.overlayBounds = o.overlayBounds || {};
5688 ws(qe, s), fi(qe, p), pn(qe, 1);
5689 var Re = o.labelBounds = o.labelBounds || {};
5690 Re.all != null ? Cf(Re.all) : Re.all = Ut(), n && r.includeLabels && (r.includeMainLabels && Oi(s, e, null), u && (r.includeSourceLabels && Oi(s, e, "source"), r.includeTargetLabels && Oi(s, e, "target")));
5691 }
5692 return s.x1 = Zt(s.x1), s.y1 = Zt(s.y1), s.x2 = Zt(s.x2), s.y2 = Zt(s.y2), s.w = Zt(s.x2 - s.x1), s.h = Zt(s.y2 - s.y1), s.w > 0 && s.h > 0 && b && (fi(s, p), pn(s, 1)), s;
5693 }, mo = function(e) {
5694 var r = 0, a = function(s) {
5695 return (s ? 1 : 0) << r++;
5696 }, n = 0;
5697 return n += a(e.incudeNodes), n += a(e.includeEdges), n += a(e.includeLabels), n += a(e.includeMainLabels), n += a(e.includeSourceLabels), n += a(e.includeTargetLabels), n += a(e.includeOverlays), n;
5698 }, bo = function(e) {
5699 if (e.isEdge()) {
5700 var r = e.source().position(), a = e.target().position(), n = function(s) {
5701 return Math.round(s);
5702 };
5703 return Yl([n(r.x), n(r.y), n(a.x), n(a.y)]);
5704 } else
5705 return 0;
5706 }, Eo = function(e, r) {
5707 var a = e._private, n, i = e.isEdge(), s = r == null ? wo : mo(r), o = s === wo, l = bo(e), u = a.bbCachePosKey === l, f = r.useCache && u, h = function(g) {
5708 return g._private.bbCache == null || g._private.styleDirty;
5709 }, c = !f || h(e) || i && h(e.source()) || h(e.target());
5710 if (c ? (u || e.recalculateRenderedStyle(f), n = nd(e, _a), a.bbCache = n, a.bbCachePosKey = l) : n = a.bbCache, !o) {
5711 var v = e.isNode();
5712 n = Ut(), (r.includeNodes && v || r.includeEdges && !v) && (r.includeOverlays ? Gr(n, a.overlayBounds) : Gr(n, a.bodyBounds)), r.includeLabels && (r.includeMainLabels && (!i || r.includeSourceLabels && r.includeTargetLabels) ? Gr(n, a.labelBounds.all) : (r.includeMainLabels && Gr(n, a.labelBounds.mainRot), r.includeSourceLabels && Gr(n, a.labelBounds.sourceRot), r.includeTargetLabels && Gr(n, a.labelBounds.targetRot))), n.w = n.x2 - n.x1, n.h = n.y2 - n.y1;
5713 }
5714 return n;
5715 }, _a = {
5716 includeNodes: !0,
5717 includeEdges: !0,
5718 includeLabels: !0,
5719 includeMainLabels: !0,
5720 includeSourceLabels: !0,
5721 includeTargetLabels: !0,
5722 includeOverlays: !0,
5723 includeUnderlays: !0,
5724 useCache: !0
5725 }, wo = mo(_a), xo = Lt(_a);
5726 Ar.boundingBox = function(t) {
5727 var e;
5728 if (this.length === 1 && this[0]._private.bbCache != null && !this[0]._private.styleDirty && (t === void 0 || t.useCache === void 0 || t.useCache === !0))
5729 t === void 0 ? t = _a : t = xo(t), e = Eo(this[0], t);
5730 else {
5731 e = Ut(), t = t || _a;
5732 var r = xo(t), a = this, n = a.cy(), i = n.styleEnabled();
5733 if (i)
5734 for (var s = 0; s < a.length; s++) {
5735 var o = a[s], l = o._private, u = bo(o), f = l.bbCachePosKey === u, h = r.useCache && f && !l.styleDirty;
5736 o.recalculateRenderedStyle(h);
5737 }
5738 this.updateCompoundBounds(!t.useCache);
5739 for (var c = 0; c < a.length; c++) {
5740 var v = a[c];
5741 Gr(e, Eo(v, r));
5742 }
5743 }
5744 return e.x1 = Zt(e.x1), e.y1 = Zt(e.y1), e.x2 = Zt(e.x2), e.y2 = Zt(e.y2), e.w = Zt(e.x2 - e.x1), e.h = Zt(e.y2 - e.y1), e;
5745 }, Ar.dirtyBoundingBoxCache = function() {
5746 for (var t = 0; t < this.length; t++) {
5747 var e = this[t]._private;
5748 e.bbCache = null, e.bbCachePosKey = null, e.bodyBounds = null, e.overlayBounds = null, e.labelBounds.all = null, e.labelBounds.source = null, e.labelBounds.target = null, e.labelBounds.main = null, e.labelBounds.sourceRot = null, e.labelBounds.targetRot = null, e.labelBounds.mainRot = null, e.arrowBounds.source = null, e.arrowBounds.target = null, e.arrowBounds["mid-source"] = null, e.arrowBounds["mid-target"] = null;
5749 }
5750 return this.emitAndNotify("bounds"), this;
5751 }, Ar.boundingBoxAt = function(t) {
5752 var e = this.nodes(), r = this.cy(), a = r.hasCompoundNodes(), n = r.collection();
5753 if (a && (n = e.filter(function(u) {
5754 return u.isParent();
5755 }), e = e.not(n)), L(t)) {
5756 var i = t;
5757 t = function() {
5758 return i;
5759 };
5760 }
5761 var s = function(f, h) {
5762 return f._private.bbAtOldPos = t(f, h);
5763 }, o = function(f) {
5764 return f._private.bbAtOldPos;
5765 };
5766 r.startBatch(), e.forEach(s).silentPositions(t), a && (n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), n.updateCompoundBounds(!0));
5767 var l = Tf(this.boundingBox({
5768 useCache: !1
5769 }));
5770 return e.silentPositions(o), a && (n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), n.updateCompoundBounds(!0)), r.endBatch(), l;
5771 }, ca.boundingbox = ca.bb = ca.boundingBox, ca.renderedBoundingbox = ca.renderedBoundingBox;
5772 var id = Ar, Ua, Ya;
5773 Ua = Ya = {};
5774 var To = function(e) {
5775 e.uppercaseName = kt(e.name), e.autoName = "auto" + e.uppercaseName, e.labelName = "label" + e.uppercaseName, e.outerName = "outer" + e.uppercaseName, e.uppercaseOuterName = kt(e.outerName), Ua[e.name] = function() {
5776 var a = this[0], n = a._private, i = n.cy, s = i._private.styleEnabled;
5777 if (a)
5778 if (s) {
5779 if (a.isParent())
5780 return a.updateCompoundBounds(), n[e.autoName] || 0;
5781 var o = a.pstyle(e.name);
5782 switch (o.strValue) {
5783 case "label":
5784 return a.recalculateRenderedStyle(), n.rstyle[e.labelName] || 0;
5785 default:
5786 return o.pfValue;
5787 }
5788 } else
5789 return 1;
5790 }, Ua["outer" + e.uppercaseName] = function() {
5791 var a = this[0], n = a._private, i = n.cy, s = i._private.styleEnabled;
5792 if (a)
5793 if (s) {
5794 var o = a[e.name](), l = a.pstyle("border-width").pfValue, u = 2 * a.padding();
5795 return o + l + u;
5796 } else
5797 return 1;
5798 }, Ua["rendered" + e.uppercaseName] = function() {
5799 var a = this[0];
5800 if (a) {
5801 var n = a[e.name]();
5802 return n * this.cy().zoom();
5803 }
5804 }, Ua["rendered" + e.uppercaseOuterName] = function() {
5805 var a = this[0];
5806 if (a) {
5807 var n = a[e.outerName]();
5808 return n * this.cy().zoom();
5809 }
5810 };
5811 };
5812 To({
5813 name: "width"
5814 }), To({
5815 name: "height"
5816 }), Ya.padding = function() {
5817 var t = this[0], e = t._private;
5818 return t.isParent() ? (t.updateCompoundBounds(), e.autoPadding !== void 0 ? e.autoPadding : t.pstyle("padding").pfValue) : t.pstyle("padding").pfValue;
5819 }, Ya.paddedHeight = function() {
5820 var t = this[0];
5821 return t.height() + 2 * t.padding();
5822 }, Ya.paddedWidth = function() {
5823 var t = this[0];
5824 return t.width() + 2 * t.padding();
5825 };
5826 var sd = Ya, od = function(e, r) {
5827 if (e.isEdge())
5828 return r(e);
5829 }, ud = function(e, r) {
5830 if (e.isEdge()) {
5831 var a = e.cy();
5832 return dn(r(e), a.zoom(), a.pan());
5833 }
5834 }, ld = function(e, r) {
5835 if (e.isEdge()) {
5836 var a = e.cy(), n = a.pan(), i = a.zoom();
5837 return r(e).map(function(s) {
5838 return dn(s, i, n);
5839 });
5840 }
5841 }, fd = function(e) {
5842 return e.renderer().getControlPoints(e);
5843 }, hd = function(e) {
5844 return e.renderer().getSegmentPoints(e);
5845 }, cd = function(e) {
5846 return e.renderer().getSourceEndpoint(e);
5847 }, vd = function(e) {
5848 return e.renderer().getTargetEndpoint(e);
5849 }, dd = function(e) {
5850 return e.renderer().getEdgeMidpoint(e);
5851 }, Co = {
5852 controlPoints: {
5853 get: fd,
5854 mult: !0
5855 },
5856 segmentPoints: {
5857 get: hd,
5858 mult: !0
5859 },
5860 sourceEndpoint: {
5861 get: cd
5862 },
5863 targetEndpoint: {
5864 get: vd
5865 },
5866 midpoint: {
5867 get: dd
5868 }
5869 }, gd = function(e) {
5870 return "rendered" + e[0].toUpperCase() + e.substr(1);
5871 }, pd = Object.keys(Co).reduce(function(t, e) {
5872 var r = Co[e], a = gd(e);
5873 return t[e] = function() {
5874 return od(this, r.get);
5875 }, r.mult ? t[a] = function() {
5876 return ld(this, r.get);
5877 } : t[a] = function() {
5878 return ud(this, r.get);
5879 }, t;
5880 }, {}), yd = Ue({}, ad, id, sd, pd);
5881 /*!
5882 Event object based on jQuery events, MIT license
5883
5884 https://jquery.org/license/
5885 https://tldrlegal.com/license/mit-license
5886 https://github.com/jquery/jquery/blob/master/src/event.js
5887 */
5888 var Do = function(e, r) {
5889 this.recycle(e, r);
5890 };
5891 function Ha() {
5892 return !1;
5893 }
5894 function On() {
5895 return !0;
5896 }
5897 Do.prototype = {
5898 instanceString: function() {
5899 return "event";
5900 },
5901 recycle: function(e, r) {
5902 if (this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = Ha, e != null && e.preventDefault ? (this.type = e.type, this.isDefaultPrevented = e.defaultPrevented ? On : Ha) : e != null && e.type ? r = e : this.type = e, r != null && (this.originalEvent = r.originalEvent, this.type = r.type != null ? r.type : this.type, this.cy = r.cy, this.target = r.target, this.position = r.position, this.renderedPosition = r.renderedPosition, this.namespace = r.namespace, this.layout = r.layout), this.cy != null && this.position != null && this.renderedPosition == null) {
5903 var a = this.position, n = this.cy.zoom(), i = this.cy.pan();
5904 this.renderedPosition = {
5905 x: a.x * n + i.x,
5906 y: a.y * n + i.y
5907 };
5908 }
5909 this.timeStamp = e && e.timeStamp || Date.now();
5910 },
5911 preventDefault: function() {
5912 this.isDefaultPrevented = On;
5913 var e = this.originalEvent;
5914 e && e.preventDefault && e.preventDefault();
5915 },
5916 stopPropagation: function() {
5917 this.isPropagationStopped = On;
5918 var e = this.originalEvent;
5919 e && e.stopPropagation && e.stopPropagation();
5920 },
5921 stopImmediatePropagation: function() {
5922 this.isImmediatePropagationStopped = On, this.stopPropagation();
5923 },
5924 isDefaultPrevented: Ha,
5925 isPropagationStopped: Ha,
5926 isImmediatePropagationStopped: Ha
5927 };
5928 var So = /^([^.]+)(\.(?:[^.]+))?$/, md = ".*", Lo = {
5929 qualifierCompare: function(e, r) {
5930 return e === r;
5931 },
5932 eventMatches: function() {
5933 return !0;
5934 },
5935 addEventFields: function() {
5936 },
5937 callbackContext: function(e) {
5938 return e;
5939 },
5940 beforeEmit: function() {
5941 },
5942 afterEmit: function() {
5943 },
5944 bubble: function() {
5945 return !1;
5946 },
5947 parent: function() {
5948 return null;
5949 },
5950 context: null
5951 }, Ao = Object.keys(Lo), bd = {};
5952 function Nn() {
5953 for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : bd, e = arguments.length > 1 ? arguments[1] : void 0, r = 0; r < Ao.length; r++) {
5954 var a = Ao[r];
5955 this[a] = t[a] || Lo[a];
5956 }
5957 this.context = e || this.context, this.listeners = [], this.emitting = 0;
5958 }
5959 var Or = Nn.prototype, Oo = function(e, r, a, n, i, s, o) {
5960 Y(n) && (i = n, n = null), o && (s == null ? s = o : s = Ue({}, s, o));
5961 for (var l = te(a) ? a : a.split(/\s+/), u = 0; u < l.length; u++) {
5962 var f = l[u];
5963 if (!Pe(f)) {
5964 var h = f.match(So);
5965 if (h) {
5966 var c = h[1], v = h[2] ? h[2] : null, d = r(e, f, c, v, n, i, s);
5967 if (d === !1)
5968 break;
5969 }
5970 }
5971 }
5972 }, No = function(e, r) {
5973 return e.addEventFields(e.context, r), new Do(r.type, r);
5974 }, Ed = function(e, r, a) {
5975 if (ct(a)) {
5976 r(e, a);
5977 return;
5978 } else if (L(a)) {
5979 r(e, No(e, a));
5980 return;
5981 }
5982 for (var n = te(a) ? a : a.split(/\s+/), i = 0; i < n.length; i++) {
5983 var s = n[i];
5984 if (!Pe(s)) {
5985 var o = s.match(So);
5986 if (o) {
5987 var l = o[1], u = o[2] ? o[2] : null, f = No(e, {
5988 type: l,
5989 namespace: u,
5990 target: e.context
5991 });
5992 r(e, f);
5993 }
5994 }
5995 }
5996 };
5997 Or.on = Or.addListener = function(t, e, r, a, n) {
5998 return Oo(this, function(i, s, o, l, u, f, h) {
5999 Y(f) && i.listeners.push({
6000 event: s,
6001 // full event string
6002 callback: f,
6003 // callback to run
6004 type: o,
6005 // the event type (e.g. 'click')
6006 namespace: l,
6007 // the event namespace (e.g. ".foo")
6008 qualifier: u,
6009 // a restriction on whether to match this emitter
6010 conf: h
6011 // additional configuration
6012 });
6013 }, t, e, r, a, n), this;
6014 }, Or.one = function(t, e, r, a) {
6015 return this.on(t, e, r, a, {
6016 one: !0
6017 });
6018 }, Or.removeListener = Or.off = function(t, e, r, a) {
6019 var n = this;
6020 this.emitting !== 0 && (this.listeners = Kl(this.listeners));
6021 for (var i = this.listeners, s = function(u) {
6022 var f = i[u];
6023 Oo(n, function(h, c, v, d, g, y) {
6024 if ((f.type === v || t === "*") && (!d && f.namespace !== ".*" || f.namespace === d) && (!g || h.qualifierCompare(f.qualifier, g)) && (!y || f.callback === y))
6025 return i.splice(u, 1), !1;
6026 }, t, e, r, a);
6027 }, o = i.length - 1; o >= 0; o--)
6028 s(o);
6029 return this;
6030 }, Or.removeAllListeners = function() {
6031 return this.removeListener("*");
6032 }, Or.emit = Or.trigger = function(t, e, r) {
6033 var a = this.listeners, n = a.length;
6034 return this.emitting++, te(e) || (e = [e]), Ed(this, function(i, s) {
6035 r != null && (a = [{
6036 event: s.event,
6037 type: s.type,
6038 namespace: s.namespace,
6039 callback: r
6040 }], n = a.length);
6041 for (var o = function(f) {
6042 var h = a[f];
6043 if (h.type === s.type && (!h.namespace || h.namespace === s.namespace || h.namespace === md) && i.eventMatches(i.context, h, s)) {
6044 var c = [s];
6045 e != null && Ql(c, e), i.beforeEmit(i.context, h, s), h.conf && h.conf.one && (i.listeners = i.listeners.filter(function(g) {
6046 return g !== h;
6047 }));
6048 var v = i.callbackContext(i.context, h, s), d = h.callback.apply(v, c);
6049 i.afterEmit(i.context, h, s), d === !1 && (s.stopPropagation(), s.preventDefault());
6050 }
6051 }, l = 0; l < n; l++)
6052 o(l);
6053 i.bubble(i.context) && !s.isPropagationStopped() && i.parent(i.context).emit(s, e);
6054 }, t), this.emitting--, this;
6055 };
6056 var wd = {
6057 qualifierCompare: function(e, r) {
6058 return e == null || r == null ? e == null && r == null : e.sameText(r);
6059 },
6060 eventMatches: function(e, r, a) {
6061 var n = r.qualifier;
6062 return n != null ? e !== a.target && Ae(a.target) && n.matches(a.target) : !0;
6063 },
6064 addEventFields: function(e, r) {
6065 r.cy = e.cy(), r.target = e;
6066 },
6067 callbackContext: function(e, r, a) {
6068 return r.qualifier != null ? a.target : e;
6069 },
6070 beforeEmit: function(e, r) {
6071 r.conf && r.conf.once && r.conf.onceCollection.removeListener(r.event, r.qualifier, r.callback);
6072 },
6073 bubble: function() {
6074 return !0;
6075 },
6076 parent: function(e) {
6077 return e.isChild() ? e.parent() : e.cy();
6078 }
6079 }, Mn = function(e) {
6080 return j(e) ? new Dr(e) : e;
6081 }, Mo = {
6082 createEmitter: function() {
6083 for (var e = 0; e < this.length; e++) {
6084 var r = this[e], a = r._private;
6085 a.emitter || (a.emitter = new Nn(wd, r));
6086 }
6087 return this;
6088 },
6089 emitter: function() {
6090 return this._private.emitter;
6091 },
6092 on: function(e, r, a) {
6093 for (var n = Mn(r), i = 0; i < this.length; i++) {
6094 var s = this[i];
6095 s.emitter().on(e, n, a);
6096 }
6097 return this;
6098 },
6099 removeListener: function(e, r, a) {
6100 for (var n = Mn(r), i = 0; i < this.length; i++) {
6101 var s = this[i];
6102 s.emitter().removeListener(e, n, a);
6103 }
6104 return this;
6105 },
6106 removeAllListeners: function() {
6107 for (var e = 0; e < this.length; e++) {
6108 var r = this[e];
6109 r.emitter().removeAllListeners();
6110 }
6111 return this;
6112 },
6113 one: function(e, r, a) {
6114 for (var n = Mn(r), i = 0; i < this.length; i++) {
6115 var s = this[i];
6116 s.emitter().one(e, n, a);
6117 }
6118 return this;
6119 },
6120 once: function(e, r, a) {
6121 for (var n = Mn(r), i = 0; i < this.length; i++) {
6122 var s = this[i];
6123 s.emitter().on(e, n, a, {
6124 once: !0,
6125 onceCollection: this
6126 });
6127 }
6128 },
6129 emit: function(e, r) {
6130 for (var a = 0; a < this.length; a++) {
6131 var n = this[a];
6132 n.emitter().emit(e, r);
6133 }
6134 return this;
6135 },
6136 emitAndNotify: function(e, r) {
6137 if (this.length !== 0)
6138 return this.cy().notify(e, this), this.emit(e, r), this;
6139 }
6140 };
6141 ht.eventAliasesOn(Mo);
6142 var Io = {
6143 nodes: function(e) {
6144 return this.filter(function(r) {
6145 return r.isNode();
6146 }).filter(e);
6147 },
6148 edges: function(e) {
6149 return this.filter(function(r) {
6150 return r.isEdge();
6151 }).filter(e);
6152 },
6153 // internal helper to get nodes and edges as separate collections with single iteration over elements
6154 byGroup: function() {
6155 for (var e = this.spawn(), r = this.spawn(), a = 0; a < this.length; a++) {
6156 var n = this[a];
6157 n.isNode() ? e.push(n) : r.push(n);
6158 }
6159 return {
6160 nodes: e,
6161 edges: r
6162 };
6163 },
6164 filter: function(e, r) {
6165 if (e === void 0)
6166 return this;
6167 if (j(e) || pe(e))
6168 return new Dr(e).filter(this);
6169 if (Y(e)) {
6170 for (var a = this.spawn(), n = this, i = 0; i < n.length; i++) {
6171 var s = n[i], o = r ? e.apply(r, [s, i, n]) : e(s, i, n);
6172 o && a.push(s);
6173 }
6174 return a;
6175 }
6176 return this.spawn();
6177 },
6178 not: function(e) {
6179 if (e) {
6180 j(e) && (e = this.filter(e));
6181 for (var r = this.spawn(), a = 0; a < this.length; a++) {
6182 var n = this[a], i = e.has(n);
6183 i || r.push(n);
6184 }
6185 return r;
6186 } else
6187 return this;
6188 },
6189 absoluteComplement: function() {
6190 var e = this.cy();
6191 return e.mutableElements().not(this);
6192 },
6193 intersect: function(e) {
6194 if (j(e)) {
6195 var r = e;
6196 return this.filter(r);
6197 }
6198 for (var a = this.spawn(), n = this, i = e, s = this.length < e.length, o = s ? n : i, l = s ? i : n, u = 0; u < o.length; u++) {
6199 var f = o[u];
6200 l.has(f) && a.push(f);
6201 }
6202 return a;
6203 },
6204 xor: function(e) {
6205 var r = this._private.cy;
6206 j(e) && (e = r.$(e));
6207 var a = this.spawn(), n = this, i = e, s = function(l, u) {
6208 for (var f = 0; f < l.length; f++) {
6209 var h = l[f], c = h._private.data.id, v = u.hasElementWithId(c);
6210 v || a.push(h);
6211 }
6212 };
6213 return s(n, i), s(i, n), a;
6214 },
6215 diff: function(e) {
6216 var r = this._private.cy;
6217 j(e) && (e = r.$(e));
6218 var a = this.spawn(), n = this.spawn(), i = this.spawn(), s = this, o = e, l = function(f, h, c) {
6219 for (var v = 0; v < f.length; v++) {
6220 var d = f[v], g = d._private.data.id, y = h.hasElementWithId(g);
6221 y ? i.merge(d) : c.push(d);
6222 }
6223 };
6224 return l(s, o, a), l(o, s, n), {
6225 left: a,
6226 right: n,
6227 both: i
6228 };
6229 },
6230 add: function(e) {
6231 var r = this._private.cy;
6232 if (!e)
6233 return this;
6234 if (j(e)) {
6235 var a = e;
6236 e = r.mutableElements().filter(a);
6237 }
6238 for (var n = this.spawnSelf(), i = 0; i < e.length; i++) {
6239 var s = e[i], o = !this.has(s);
6240 o && n.push(s);
6241 }
6242 return n;
6243 },
6244 // in place merge on calling collection
6245 merge: function(e) {
6246 var r = this._private, a = r.cy;
6247 if (!e)
6248 return this;
6249 if (e && j(e)) {
6250 var n = e;
6251 e = a.mutableElements().filter(n);
6252 }
6253 for (var i = r.map, s = 0; s < e.length; s++) {
6254 var o = e[s], l = o._private.data.id, u = !i.has(l);
6255 if (u) {
6256 var f = this.length++;
6257 this[f] = o, i.set(l, {
6258 ele: o,
6259 index: f
6260 });
6261 }
6262 }
6263 return this;
6264 },
6265 unmergeAt: function(e) {
6266 var r = this[e], a = r.id(), n = this._private, i = n.map;
6267 this[e] = void 0, i.delete(a);
6268 var s = e === this.length - 1;
6269 if (this.length > 1 && !s) {
6270 var o = this.length - 1, l = this[o], u = l._private.data.id;
6271 this[o] = void 0, this[e] = l, i.set(u, {
6272 ele: l,
6273 index: e
6274 });
6275 }
6276 return this.length--, this;
6277 },
6278 // remove single ele in place in calling collection
6279 unmergeOne: function(e) {
6280 e = e[0];
6281 var r = this._private, a = e._private.data.id, n = r.map, i = n.get(a);
6282 if (!i)
6283 return this;
6284 var s = i.index;
6285 return this.unmergeAt(s), this;
6286 },
6287 // remove eles in place on calling collection
6288 unmerge: function(e) {
6289 var r = this._private.cy;
6290 if (!e)
6291 return this;
6292 if (e && j(e)) {
6293 var a = e;
6294 e = r.mutableElements().filter(a);
6295 }
6296 for (var n = 0; n < e.length; n++)
6297 this.unmergeOne(e[n]);
6298 return this;
6299 },
6300 unmergeBy: function(e) {
6301 for (var r = this.length - 1; r >= 0; r--) {
6302 var a = this[r];
6303 e(a) && this.unmergeAt(r);
6304 }
6305 return this;
6306 },
6307 map: function(e, r) {
6308 for (var a = [], n = this, i = 0; i < n.length; i++) {
6309 var s = n[i], o = r ? e.apply(r, [s, i, n]) : e(s, i, n);
6310 a.push(o);
6311 }
6312 return a;
6313 },
6314 reduce: function(e, r) {
6315 for (var a = r, n = this, i = 0; i < n.length; i++)
6316 a = e(a, n[i], i, n);
6317 return a;
6318 },
6319 max: function(e, r) {
6320 for (var a = -1 / 0, n, i = this, s = 0; s < i.length; s++) {
6321 var o = i[s], l = r ? e.apply(r, [o, s, i]) : e(o, s, i);
6322 l > a && (a = l, n = o);
6323 }
6324 return {
6325 value: a,
6326 ele: n
6327 };
6328 },
6329 min: function(e, r) {
6330 for (var a = 1 / 0, n, i = this, s = 0; s < i.length; s++) {
6331 var o = i[s], l = r ? e.apply(r, [o, s, i]) : e(o, s, i);
6332 l < a && (a = l, n = o);
6333 }
6334 return {
6335 value: a,
6336 ele: n
6337 };
6338 }
6339 }, st = Io;
6340 st.u = st["|"] = st["+"] = st.union = st.or = st.add, st["\\"] = st["!"] = st["-"] = st.difference = st.relativeComplement = st.subtract = st.not, st.n = st["&"] = st["."] = st.and = st.intersection = st.intersect, st["^"] = st["(+)"] = st["(-)"] = st.symmetricDifference = st.symdiff = st.xor, st.fnFilter = st.filterFn = st.stdFilter = st.filter, st.complement = st.abscomp = st.absoluteComplement;
6341 var xd = {
6342 isNode: function() {
6343 return this.group() === "nodes";
6344 },
6345 isEdge: function() {
6346 return this.group() === "edges";
6347 },
6348 isLoop: function() {
6349 return this.isEdge() && this.source()[0] === this.target()[0];
6350 },
6351 isSimple: function() {
6352 return this.isEdge() && this.source()[0] !== this.target()[0];
6353 },
6354 group: function() {
6355 var e = this[0];
6356 if (e)
6357 return e._private.group;
6358 }
6359 }, Ro = function(e, r) {
6360 var a = e.cy(), n = a.hasCompoundNodes();
6361 function i(f) {
6362 var h = f.pstyle("z-compound-depth");
6363 return h.value === "auto" ? n ? f.zDepth() : 0 : h.value === "bottom" ? -1 : h.value === "top" ? ii : 0;
6364 }
6365 var s = i(e) - i(r);
6366 if (s !== 0)
6367 return s;
6368 function o(f) {
6369 var h = f.pstyle("z-index-compare");
6370 return h.value === "auto" && f.isNode() ? 1 : 0;
6371 }
6372 var l = o(e) - o(r);
6373 if (l !== 0)
6374 return l;
6375 var u = e.pstyle("z-index").value - r.pstyle("z-index").value;
6376 return u !== 0 ? u : e.poolIndex() - r.poolIndex();
6377 }, In = {
6378 forEach: function(e, r) {
6379 if (Y(e))
6380 for (var a = this.length, n = 0; n < a; n++) {
6381 var i = this[n], s = r ? e.apply(r, [i, n, this]) : e(i, n, this);
6382 if (s === !1)
6383 break;
6384 }
6385 return this;
6386 },
6387 toArray: function() {
6388 for (var e = [], r = 0; r < this.length; r++)
6389 e.push(this[r]);
6390 return e;
6391 },
6392 slice: function(e, r) {
6393 var a = [], n = this.length;
6394 r == null && (r = n), e == null && (e = 0), e < 0 && (e = n + e), r < 0 && (r = n + r);
6395 for (var i = e; i >= 0 && i < r && i < n; i++)
6396 a.push(this[i]);
6397 return this.spawn(a);
6398 },
6399 size: function() {
6400 return this.length;
6401 },
6402 eq: function(e) {
6403 return this[e] || this.spawn();
6404 },
6405 first: function() {
6406 return this[0] || this.spawn();
6407 },
6408 last: function() {
6409 return this[this.length - 1] || this.spawn();
6410 },
6411 empty: function() {
6412 return this.length === 0;
6413 },
6414 nonempty: function() {
6415 return !this.empty();
6416 },
6417 sort: function(e) {
6418 if (!Y(e))
6419 return this;
6420 var r = this.toArray().sort(e);
6421 return this.spawn(r);
6422 },
6423 sortByZIndex: function() {
6424 return this.sort(Ro);
6425 },
6426 zDepth: function() {
6427 var e = this[0];
6428 if (e) {
6429 var r = e._private, a = r.group;
6430 if (a === "nodes") {
6431 var n = r.data.parent ? e.parents().size() : 0;
6432 return e.isParent() ? n : ii - 1;
6433 } else {
6434 var i = r.source, s = r.target, o = i.zDepth(), l = s.zDepth();
6435 return Math.max(o, l, 0);
6436 }
6437 }
6438 }
6439 };
6440 In.each = In.forEach;
6441 var Td = function() {
6442 var e = "undefined", r = (typeof Symbol > "u" ? "undefined" : ee(Symbol)) != e && ee(Symbol.iterator) != e;
6443 r && (In[Symbol.iterator] = function() {
6444 var a = this, n = {
6445 value: void 0,
6446 done: !1
6447 }, i = 0, s = this.length;
6448 return T({
6449 next: function() {
6450 return i < s ? n.value = a[i++] : (n.value = void 0, n.done = !0), n;
6451 }
6452 }, Symbol.iterator, function() {
6453 return this;
6454 });
6455 });
6456 };
6457 Td();
6458 var Cd = Lt({
6459 nodeDimensionsIncludeLabels: !1
6460 }), Rn = {
6461 // Calculates and returns node dimensions { x, y } based on options given
6462 layoutDimensions: function(e) {
6463 e = Cd(e);
6464 var r;
6465 if (!this.takesUpSpace())
6466 r = {
6467 w: 0,
6468 h: 0
6469 };
6470 else if (e.nodeDimensionsIncludeLabels) {
6471 var a = this.boundingBox();
6472 r = {
6473 w: a.w,
6474 h: a.h
6475 };
6476 } else
6477 r = {
6478 w: this.outerWidth(),
6479 h: this.outerHeight()
6480 };
6481 return (r.w === 0 || r.h === 0) && (r.w = r.h = 1), r;
6482 },
6483 // using standard layout options, apply position function (w/ or w/o animation)
6484 layoutPositions: function(e, r, a) {
6485 var n = this.nodes().filter(function(M) {
6486 return !M.isParent();
6487 }), i = this.cy(), s = r.eles, o = function(A) {
6488 return A.id();
6489 }, l = nt(a, o);
6490 e.emit({
6491 type: "layoutstart",
6492 layout: e
6493 }), e.animations = [];
6494 var u = function(A, w, I) {
6495 var C = {
6496 x: w.x1 + w.w / 2,
6497 y: w.y1 + w.h / 2
6498 }, B = {
6499 // scale from center of bounding box (not necessarily 0,0)
6500 x: (I.x - C.x) * A,
6501 y: (I.y - C.y) * A
6502 };
6503 return {
6504 x: C.x + B.x,
6505 y: C.y + B.y
6506 };
6507 }, f = r.spacingFactor && r.spacingFactor !== 1, h = function() {
6508 if (!f)
6509 return null;
6510 for (var A = Ut(), w = 0; w < n.length; w++) {
6511 var I = n[w], C = l(I, w);
6512 Sf(A, C.x, C.y);
6513 }
6514 return A;
6515 }, c = h(), v = nt(function(M, A) {
6516 var w = l(M, A);
6517 if (f) {
6518 var I = Math.abs(r.spacingFactor);
6519 w = u(I, c, w);
6520 }
6521 return r.transform != null && (w = r.transform(M, w)), w;
6522 }, o);
6523 if (r.animate) {
6524 for (var d = 0; d < n.length; d++) {
6525 var g = n[d], y = v(g, d), p = r.animateFilter == null || r.animateFilter(g, d);
6526 if (p) {
6527 var m = g.animation({
6528 position: y,
6529 duration: r.animationDuration,
6530 easing: r.animationEasing
6531 });
6532 e.animations.push(m);
6533 } else
6534 g.position(y);
6535 }
6536 if (r.fit) {
6537 var b = i.animation({
6538 fit: {
6539 boundingBox: s.boundingBoxAt(v),
6540 padding: r.padding
6541 },
6542 duration: r.animationDuration,
6543 easing: r.animationEasing
6544 });
6545 e.animations.push(b);
6546 } else if (r.zoom !== void 0 && r.pan !== void 0) {
6547 var E = i.animation({
6548 zoom: r.zoom,
6549 pan: r.pan,
6550 duration: r.animationDuration,
6551 easing: r.animationEasing
6552 });
6553 e.animations.push(E);
6554 }
6555 e.animations.forEach(function(M) {
6556 return M.play();
6557 }), e.one("layoutready", r.ready), e.emit({
6558 type: "layoutready",
6559 layout: e
6560 }), ia.all(e.animations.map(function(M) {
6561 return M.promise();
6562 })).then(function() {
6563 e.one("layoutstop", r.stop), e.emit({
6564 type: "layoutstop",
6565 layout: e
6566 });
6567 });
6568 } else
6569 n.positions(v), r.fit && i.fit(r.eles, r.padding), r.zoom != null && i.zoom(r.zoom), r.pan && i.pan(r.pan), e.one("layoutready", r.ready), e.emit({
6570 type: "layoutready",
6571 layout: e
6572 }), e.one("layoutstop", r.stop), e.emit({
6573 type: "layoutstop",
6574 layout: e
6575 });
6576 return this;
6577 },
6578 layout: function(e) {
6579 var r = this.cy();
6580 return r.makeLayout(Ue({}, e, {
6581 eles: this
6582 }));
6583 }
6584 };
6585 Rn.createLayout = Rn.makeLayout = Rn.layout;
6586 function ko(t, e, r) {
6587 var a = r._private, n = a.styleCache = a.styleCache || [], i;
6588 return (i = n[t]) != null || (i = n[t] = e(r)), i;
6589 }
6590 function kn(t, e) {
6591 return t = kr(t), function(a) {
6592 return ko(t, e, a);
6593 };
6594 }
6595 function Pn(t, e) {
6596 t = kr(t);
6597 var r = function(n) {
6598 return e.call(n);
6599 };
6600 return function() {
6601 var n = this[0];
6602 if (n)
6603 return ko(t, r, n);
6604 };
6605 }
6606 var At = {
6607 recalculateRenderedStyle: function(e) {
6608 var r = this.cy(), a = r.renderer(), n = r.styleEnabled();
6609 return a && n && a.recalculateRenderedStyle(this, e), this;
6610 },
6611 dirtyStyleCache: function() {
6612 var e = this.cy(), r = function(i) {
6613 return i._private.styleCache = null;
6614 };
6615 if (e.hasCompoundNodes()) {
6616 var a;
6617 a = this.spawnSelf().merge(this.descendants()).merge(this.parents()), a.merge(a.connectedEdges()), a.forEach(r);
6618 } else
6619 this.forEach(function(n) {
6620 r(n), n.connectedEdges().forEach(r);
6621 });
6622 return this;
6623 },
6624 // fully updates (recalculates) the style for the elements
6625 updateStyle: function(e) {
6626 var r = this._private.cy;
6627 if (!r.styleEnabled())
6628 return this;
6629 if (r.batching()) {
6630 var a = r._private.batchStyleEles;
6631 return a.merge(this), this;
6632 }
6633 var n = r.hasCompoundNodes(), i = this;
6634 e = !!(e || e === void 0), n && (i = this.spawnSelf().merge(this.descendants()).merge(this.parents()));
6635 var s = i;
6636 return e ? s.emitAndNotify("style") : s.emit("style"), i.forEach(function(o) {
6637 return o._private.styleDirty = !0;
6638 }), this;
6639 },
6640 // private: clears dirty flag and recalculates style
6641 cleanStyle: function() {
6642 var e = this.cy();
6643 if (e.styleEnabled())
6644 for (var r = 0; r < this.length; r++) {
6645 var a = this[r];
6646 a._private.styleDirty && (a._private.styleDirty = !1, e.style().apply(a));
6647 }
6648 },
6649 // get the internal parsed style object for the specified property
6650 parsedStyle: function(e) {
6651 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, a = this[0], n = a.cy();
6652 if (n.styleEnabled() && a) {
6653 this.cleanStyle();
6654 var i = a._private.style[e];
6655 return i ?? (r ? n.style().getDefaultProperty(e) : null);
6656 }
6657 },
6658 numericStyle: function(e) {
6659 var r = this[0];
6660 if (r.cy().styleEnabled() && r) {
6661 var a = r.pstyle(e);
6662 return a.pfValue !== void 0 ? a.pfValue : a.value;
6663 }
6664 },
6665 numericStyleUnits: function(e) {
6666 var r = this[0];
6667 if (r.cy().styleEnabled() && r)
6668 return r.pstyle(e).units;
6669 },
6670 // get the specified css property as a rendered value (i.e. on-screen value)
6671 // or get the whole rendered style if no property specified (NB doesn't allow setting)
6672 renderedStyle: function(e) {
6673 var r = this.cy();
6674 if (!r.styleEnabled())
6675 return this;
6676 var a = this[0];
6677 if (a)
6678 return r.style().getRenderedStyle(a, e);
6679 },
6680 // read the calculated css style of the element or override the style (via a bypass)
6681 style: function(e, r) {
6682 var a = this.cy();
6683 if (!a.styleEnabled())
6684 return this;
6685 var n = !1, i = a.style();
6686 if (L(e)) {
6687 var s = e;
6688 i.applyBypass(this, s, n), this.emitAndNotify("style");
6689 } else if (j(e))
6690 if (r === void 0) {
6691 var o = this[0];
6692 return o ? i.getStylePropertyValue(o, e) : void 0;
6693 } else
6694 i.applyBypass(this, e, r, n), this.emitAndNotify("style");
6695 else if (e === void 0) {
6696 var l = this[0];
6697 return l ? i.getRawStyle(l) : void 0;
6698 }
6699 return this;
6700 },
6701 removeStyle: function(e) {
6702 var r = this.cy();
6703 if (!r.styleEnabled())
6704 return this;
6705 var a = !1, n = r.style(), i = this;
6706 if (e === void 0)
6707 for (var s = 0; s < i.length; s++) {
6708 var o = i[s];
6709 n.removeAllBypasses(o, a);
6710 }
6711 else {
6712 e = e.split(/\s+/);
6713 for (var l = 0; l < i.length; l++) {
6714 var u = i[l];
6715 n.removeBypasses(u, e, a);
6716 }
6717 }
6718 return this.emitAndNotify("style"), this;
6719 },
6720 show: function() {
6721 return this.css("display", "element"), this;
6722 },
6723 hide: function() {
6724 return this.css("display", "none"), this;
6725 },
6726 effectiveOpacity: function() {
6727 var e = this.cy();
6728 if (!e.styleEnabled())
6729 return 1;
6730 var r = e.hasCompoundNodes(), a = this[0];
6731 if (a) {
6732 var n = a._private, i = a.pstyle("opacity").value;
6733 if (!r)
6734 return i;
6735 var s = n.data.parent ? a.parents() : null;
6736 if (s)
6737 for (var o = 0; o < s.length; o++) {
6738 var l = s[o], u = l.pstyle("opacity").value;
6739 i = u * i;
6740 }
6741 return i;
6742 }
6743 },
6744 transparent: function() {
6745 var e = this.cy();
6746 if (!e.styleEnabled())
6747 return !1;
6748 var r = this[0], a = r.cy().hasCompoundNodes();
6749 if (r)
6750 return a ? r.effectiveOpacity() === 0 : r.pstyle("opacity").value === 0;
6751 },
6752 backgrounding: function() {
6753 var e = this.cy();
6754 if (!e.styleEnabled())
6755 return !1;
6756 var r = this[0];
6757 return !!r._private.backgrounding;
6758 }
6759 };
6760 function Ni(t, e) {
6761 var r = t._private, a = r.data.parent ? t.parents() : null;
6762 if (a)
6763 for (var n = 0; n < a.length; n++) {
6764 var i = a[n];
6765 if (!e(i))
6766 return !1;
6767 }
6768 return !0;
6769 }
6770 function Mi(t) {
6771 var e = t.ok, r = t.edgeOkViaNode || t.ok, a = t.parentOk || t.ok;
6772 return function() {
6773 var n = this.cy();
6774 if (!n.styleEnabled())
6775 return !0;
6776 var i = this[0], s = n.hasCompoundNodes();
6777 if (i) {
6778 var o = i._private;
6779 if (!e(i))
6780 return !1;
6781 if (i.isNode())
6782 return !s || Ni(i, a);
6783 var l = o.source, u = o.target;
6784 return r(l) && (!s || Ni(l, r)) && (l === u || r(u) && (!s || Ni(u, r)));
6785 }
6786 };
6787 }
6788 var va = kn("eleTakesUpSpace", function(t) {
6789 return t.pstyle("display").value === "element" && t.width() !== 0 && (t.isNode() ? t.height() !== 0 : !0);
6790 });
6791 At.takesUpSpace = Pn("takesUpSpace", Mi({
6792 ok: va
6793 }));
6794 var Dd = kn("eleInteractive", function(t) {
6795 return t.pstyle("events").value === "yes" && t.pstyle("visibility").value === "visible" && va(t);
6796 }), Sd = kn("parentInteractive", function(t) {
6797 return t.pstyle("visibility").value === "visible" && va(t);
6798 });
6799 At.interactive = Pn("interactive", Mi({
6800 ok: Dd,
6801 parentOk: Sd,
6802 edgeOkViaNode: va
6803 })), At.noninteractive = function() {
6804 var t = this[0];
6805 if (t)
6806 return !t.interactive();
6807 };
6808 var Ld = kn("eleVisible", function(t) {
6809 return t.pstyle("visibility").value === "visible" && t.pstyle("opacity").pfValue !== 0 && va(t);
6810 }), Ad = va;
6811 At.visible = Pn("visible", Mi({
6812 ok: Ld,
6813 edgeOkViaNode: Ad
6814 })), At.hidden = function() {
6815 var t = this[0];
6816 if (t)
6817 return !t.visible();
6818 }, At.isBundledBezier = Pn("isBundledBezier", function() {
6819 return this.cy().styleEnabled() ? !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace() : !1;
6820 }), At.bypass = At.css = At.style, At.renderedCss = At.renderedStyle, At.removeBypass = At.removeCss = At.removeStyle, At.pstyle = At.parsedStyle;
6821 var Nr = {};
6822 function Po(t) {
6823 return function() {
6824 var e = arguments, r = [];
6825 if (e.length === 2) {
6826 var a = e[0], n = e[1];
6827 this.on(t.event, a, n);
6828 } else if (e.length === 1 && Y(e[0])) {
6829 var i = e[0];
6830 this.on(t.event, i);
6831 } else if (e.length === 0 || e.length === 1 && te(e[0])) {
6832 for (var s = e.length === 1 ? e[0] : null, o = 0; o < this.length; o++) {
6833 var l = this[o], u = !t.ableField || l._private[t.ableField], f = l._private[t.field] != t.value;
6834 if (t.overrideAble) {
6835 var h = t.overrideAble(l);
6836 if (h !== void 0 && (u = h, !h))
6837 return this;
6838 }
6839 u && (l._private[t.field] = t.value, f && r.push(l));
6840 }
6841 var c = this.spawn(r);
6842 c.updateStyle(), c.emit(t.event), s && c.emit(s);
6843 }
6844 return this;
6845 };
6846 }
6847 function da(t) {
6848 Nr[t.field] = function() {
6849 var e = this[0];
6850 if (e) {
6851 if (t.overrideField) {
6852 var r = t.overrideField(e);
6853 if (r !== void 0)
6854 return r;
6855 }
6856 return e._private[t.field];
6857 }
6858 }, Nr[t.on] = Po({
6859 event: t.on,
6860 field: t.field,
6861 ableField: t.ableField,
6862 overrideAble: t.overrideAble,
6863 value: !0
6864 }), Nr[t.off] = Po({
6865 event: t.off,
6866 field: t.field,
6867 ableField: t.ableField,
6868 overrideAble: t.overrideAble,
6869 value: !1
6870 });
6871 }
6872 da({
6873 field: "locked",
6874 overrideField: function(e) {
6875 return e.cy().autolock() ? !0 : void 0;
6876 },
6877 on: "lock",
6878 off: "unlock"
6879 }), da({
6880 field: "grabbable",
6881 overrideField: function(e) {
6882 return e.cy().autoungrabify() || e.pannable() ? !1 : void 0;
6883 },
6884 on: "grabify",
6885 off: "ungrabify"
6886 }), da({
6887 field: "selected",
6888 ableField: "selectable",
6889 overrideAble: function(e) {
6890 return e.cy().autounselectify() ? !1 : void 0;
6891 },
6892 on: "select",
6893 off: "unselect"
6894 }), da({
6895 field: "selectable",
6896 overrideField: function(e) {
6897 return e.cy().autounselectify() ? !1 : void 0;
6898 },
6899 on: "selectify",
6900 off: "unselectify"
6901 }), Nr.deselect = Nr.unselect, Nr.grabbed = function() {
6902 var t = this[0];
6903 if (t)
6904 return t._private.grabbed;
6905 }, da({
6906 field: "active",
6907 on: "activate",
6908 off: "unactivate"
6909 }), da({
6910 field: "pannable",
6911 on: "panify",
6912 off: "unpanify"
6913 }), Nr.inactive = function() {
6914 var t = this[0];
6915 if (t)
6916 return !t._private.active;
6917 };
6918 var Pt = {}, Bo = function(e) {
6919 return function(a) {
6920 for (var n = this, i = [], s = 0; s < n.length; s++) {
6921 var o = n[s];
6922 if (o.isNode()) {
6923 for (var l = !1, u = o.connectedEdges(), f = 0; f < u.length; f++) {
6924 var h = u[f], c = h.source(), v = h.target();
6925 if (e.noIncomingEdges && v === o && c !== o || e.noOutgoingEdges && c === o && v !== o) {
6926 l = !0;
6927 break;
6928 }
6929 }
6930 l || i.push(o);
6931 }
6932 }
6933 return this.spawn(i, !0).filter(a);
6934 };
6935 }, Fo = function(e) {
6936 return function(r) {
6937 for (var a = this, n = [], i = 0; i < a.length; i++) {
6938 var s = a[i];
6939 if (s.isNode())
6940 for (var o = s.connectedEdges(), l = 0; l < o.length; l++) {
6941 var u = o[l], f = u.source(), h = u.target();
6942 e.outgoing && f === s ? (n.push(u), n.push(h)) : e.incoming && h === s && (n.push(u), n.push(f));
6943 }
6944 }
6945 return this.spawn(n, !0).filter(r);
6946 };
6947 }, zo = function(e) {
6948 return function(r) {
6949 for (var a = this, n = [], i = {}; ; ) {
6950 var s = e.outgoing ? a.outgoers() : a.incomers();
6951 if (s.length === 0)
6952 break;
6953 for (var o = !1, l = 0; l < s.length; l++) {
6954 var u = s[l], f = u.id();
6955 i[f] || (i[f] = !0, n.push(u), o = !0);
6956 }
6957 if (!o)
6958 break;
6959 a = s;
6960 }
6961 return this.spawn(n, !0).filter(r);
6962 };
6963 };
6964 Pt.clearTraversalCache = function() {
6965 for (var t = 0; t < this.length; t++)
6966 this[t]._private.traversalCache = null;
6967 }, Ue(Pt, {
6968 // get the root nodes in the DAG
6969 roots: Bo({
6970 noIncomingEdges: !0
6971 }),
6972 // get the leaf nodes in the DAG
6973 leaves: Bo({
6974 noOutgoingEdges: !0
6975 }),
6976 // normally called children in graph theory
6977 // these nodes =edges=> outgoing nodes
6978 outgoers: Kt(Fo({
6979 outgoing: !0
6980 }), "outgoers"),
6981 // aka DAG descendants
6982 successors: zo({
6983 outgoing: !0
6984 }),
6985 // normally called parents in graph theory
6986 // these nodes <=edges= incoming nodes
6987 incomers: Kt(Fo({
6988 incoming: !0
6989 }), "incomers"),
6990 // aka DAG ancestors
6991 predecessors: zo({
6992 incoming: !0
6993 })
6994 }), Ue(Pt, {
6995 neighborhood: Kt(function(t) {
6996 for (var e = [], r = this.nodes(), a = 0; a < r.length; a++)
6997 for (var n = r[a], i = n.connectedEdges(), s = 0; s < i.length; s++) {
6998 var o = i[s], l = o.source(), u = o.target(), f = n === l ? u : l;
6999 f.length > 0 && e.push(f[0]), e.push(o[0]);
7000 }
7001 return this.spawn(e, !0).filter(t);
7002 }, "neighborhood"),
7003 closedNeighborhood: function(e) {
7004 return this.neighborhood().add(this).filter(e);
7005 },
7006 openNeighborhood: function(e) {
7007 return this.neighborhood(e);
7008 }
7009 }), Pt.neighbourhood = Pt.neighborhood, Pt.closedNeighbourhood = Pt.closedNeighborhood, Pt.openNeighbourhood = Pt.openNeighborhood, Ue(Pt, {
7010 source: Kt(function(e) {
7011 var r = this[0], a;
7012 return r && (a = r._private.source || r.cy().collection()), a && e ? a.filter(e) : a;
7013 }, "source"),
7014 target: Kt(function(e) {
7015 var r = this[0], a;
7016 return r && (a = r._private.target || r.cy().collection()), a && e ? a.filter(e) : a;
7017 }, "target"),
7018 sources: Go({
7019 attr: "source"
7020 }),
7021 targets: Go({
7022 attr: "target"
7023 })
7024 });
7025 function Go(t) {
7026 return function(r) {
7027 for (var a = [], n = 0; n < this.length; n++) {
7028 var i = this[n], s = i._private[t.attr];
7029 s && a.push(s);
7030 }
7031 return this.spawn(a, !0).filter(r);
7032 };
7033 }
7034 Ue(Pt, {
7035 edgesWith: Kt($o(), "edgesWith"),
7036 edgesTo: Kt($o({
7037 thisIsSrc: !0
7038 }), "edgesTo")
7039 });
7040 function $o(t) {
7041 return function(r) {
7042 var a = [], n = this._private.cy, i = t || {};
7043 j(r) && (r = n.$(r));
7044 for (var s = 0; s < r.length; s++)
7045 for (var o = r[s]._private.edges, l = 0; l < o.length; l++) {
7046 var u = o[l], f = u._private.data, h = this.hasElementWithId(f.source) && r.hasElementWithId(f.target), c = r.hasElementWithId(f.source) && this.hasElementWithId(f.target), v = h || c;
7047 v && ((i.thisIsSrc || i.thisIsTgt) && (i.thisIsSrc && !h || i.thisIsTgt && !c) || a.push(u));
7048 }
7049 return this.spawn(a, !0);
7050 };
7051 }
7052 Ue(Pt, {
7053 connectedEdges: Kt(function(t) {
7054 for (var e = [], r = this, a = 0; a < r.length; a++) {
7055 var n = r[a];
7056 if (n.isNode())
7057 for (var i = n._private.edges, s = 0; s < i.length; s++) {
7058 var o = i[s];
7059 e.push(o);
7060 }
7061 }
7062 return this.spawn(e, !0).filter(t);
7063 }, "connectedEdges"),
7064 connectedNodes: Kt(function(t) {
7065 for (var e = [], r = this, a = 0; a < r.length; a++) {
7066 var n = r[a];
7067 n.isEdge() && (e.push(n.source()[0]), e.push(n.target()[0]));
7068 }
7069 return this.spawn(e, !0).filter(t);
7070 }, "connectedNodes"),
7071 parallelEdges: Kt(Vo(), "parallelEdges"),
7072 codirectedEdges: Kt(Vo({
7073 codirected: !0
7074 }), "codirectedEdges")
7075 });
7076 function Vo(t) {
7077 var e = {
7078 codirected: !1
7079 };
7080 return t = Ue({}, e, t), function(a) {
7081 for (var n = [], i = this.edges(), s = t, o = 0; o < i.length; o++)
7082 for (var l = i[o], u = l._private, f = u.source, h = f._private.data.id, c = u.data.target, v = f._private.edges, d = 0; d < v.length; d++) {
7083 var g = v[d], y = g._private.data, p = y.target, m = y.source, b = p === c && m === h, E = h === p && c === m;
7084 (s.codirected && b || !s.codirected && (b || E)) && n.push(g);
7085 }
7086 return this.spawn(n, !0).filter(a);
7087 };
7088 }
7089 Ue(Pt, {
7090 components: function(e) {
7091 var r = this, a = r.cy(), n = a.collection(), i = e == null ? r.nodes() : e.nodes(), s = [];
7092 e != null && i.empty() && (i = e.sources());
7093 var o = function(f, h) {
7094 n.merge(f), i.unmerge(f), h.merge(f);
7095 };
7096 if (i.empty())
7097 return r.spawn();
7098 var l = function() {
7099 var f = a.collection();
7100 s.push(f);
7101 var h = i[0];
7102 o(h, f), r.bfs({
7103 directed: !1,
7104 roots: h,
7105 visit: function(v) {
7106 return o(v, f);
7107 }
7108 }), f.forEach(function(c) {
7109 c.connectedEdges().forEach(function(v) {
7110 r.has(v) && f.has(v.source()) && f.has(v.target()) && f.merge(v);
7111 });
7112 });
7113 };
7114 do
7115 l();
7116 while (i.length > 0);
7117 return s;
7118 },
7119 component: function() {
7120 var e = this[0];
7121 return e.cy().mutableElements().components(e)[0];
7122 }
7123 }), Pt.componentsOf = Pt.components;
7124 var Ot = function(e, r) {
7125 var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
7126 if (e === void 0) {
7127 xt("A collection must have a reference to the core");
7128 return;
7129 }
7130 var i = new ur(), s = !1;
7131 if (!r)
7132 r = [];
7133 else if (r.length > 0 && L(r[0]) && !Ae(r[0])) {
7134 s = !0;
7135 for (var o = [], l = new Jr(), u = 0, f = r.length; u < f; u++) {
7136 var h = r[u];
7137 h.data == null && (h.data = {});
7138 var c = h.data;
7139 if (c.id == null)
7140 c.id = ps();
7141 else if (e.hasElementWithId(c.id) || l.has(c.id))
7142 continue;
7143 var v = new vn(e, h, !1);
7144 o.push(v), l.add(c.id);
7145 }
7146 r = o;
7147 }
7148 this.length = 0;
7149 for (var d = 0, g = r.length; d < g; d++) {
7150 var y = r[d][0];
7151 if (y != null) {
7152 var p = y._private.data.id;
7153 (!a || !i.has(p)) && (a && i.set(p, {
7154 index: this.length,
7155 ele: y
7156 }), this[this.length] = y, this.length++);
7157 }
7158 }
7159 this._private = {
7160 eles: this,
7161 cy: e,
7162 get map() {
7163 return this.lazyMap == null && this.rebuildMap(), this.lazyMap;
7164 },
7165 set map(m) {
7166 this.lazyMap = m;
7167 },
7168 rebuildMap: function() {
7169 for (var b = this.lazyMap = new ur(), E = this.eles, M = 0; M < E.length; M++) {
7170 var A = E[M];
7171 b.set(A.id(), {
7172 index: M,
7173 ele: A
7174 });
7175 }
7176 }
7177 }, a && (this._private.map = i), s && !n && this.restore();
7178 }, mt = vn.prototype = Ot.prototype = Object.create(Array.prototype);
7179 mt.instanceString = function() {
7180 return "collection";
7181 }, mt.spawn = function(t, e) {
7182 return new Ot(this.cy(), t, e);
7183 }, mt.spawnSelf = function() {
7184 return this.spawn(this);
7185 }, mt.cy = function() {
7186 return this._private.cy;
7187 }, mt.renderer = function() {
7188 return this._private.cy.renderer();
7189 }, mt.element = function() {
7190 return this[0];
7191 }, mt.collection = function() {
7192 return Ne(this) ? this : new Ot(this._private.cy, [this]);
7193 }, mt.unique = function() {
7194 return new Ot(this._private.cy, this, !0);
7195 }, mt.hasElementWithId = function(t) {
7196 return t = "" + t, this._private.map.has(t);
7197 }, mt.getElementById = function(t) {
7198 t = "" + t;
7199 var e = this._private.cy, r = this._private.map.get(t);
7200 return r ? r.ele : new Ot(e);
7201 }, mt.$id = mt.getElementById, mt.poolIndex = function() {
7202 var t = this._private.cy, e = t._private.elements, r = this[0]._private.data.id;
7203 return e._private.map.get(r).index;
7204 }, mt.indexOf = function(t) {
7205 var e = t[0]._private.data.id;
7206 return this._private.map.get(e).index;
7207 }, mt.indexOfId = function(t) {
7208 return t = "" + t, this._private.map.get(t).index;
7209 }, mt.json = function(t) {
7210 var e = this.element(), r = this.cy();
7211 if (e == null && t)
7212 return this;
7213 if (e != null) {
7214 var a = e._private;
7215 if (L(t)) {
7216 if (r.startBatch(), t.data) {
7217 e.data(t.data);
7218 var n = a.data;
7219 if (e.isEdge()) {
7220 var i = !1, s = {}, o = t.data.source, l = t.data.target;
7221 o != null && o != n.source && (s.source = "" + o, i = !0), l != null && l != n.target && (s.target = "" + l, i = !0), i && (e = e.move(s));
7222 } else {
7223 var u = "parent" in t.data, f = t.data.parent;
7224 u && (f != null || n.parent != null) && f != n.parent && (f === void 0 && (f = null), f != null && (f = "" + f), e = e.move({
7225 parent: f
7226 }));
7227 }
7228 }
7229 t.position && e.position(t.position);
7230 var h = function(g, y, p) {
7231 var m = t[g];
7232 m != null && m !== a[g] && (m ? e[y]() : e[p]());
7233 };
7234 return h("removed", "remove", "restore"), h("selected", "select", "unselect"), h("selectable", "selectify", "unselectify"), h("locked", "lock", "unlock"), h("grabbable", "grabify", "ungrabify"), h("pannable", "panify", "unpanify"), t.classes != null && e.classes(t.classes), r.endBatch(), this;
7235 } else if (t === void 0) {
7236 var c = {
7237 data: or(a.data),
7238 position: or(a.position),
7239 group: a.group,
7240 removed: a.removed,
7241 selected: a.selected,
7242 selectable: a.selectable,
7243 locked: a.locked,
7244 grabbable: a.grabbable,
7245 pannable: a.pannable,
7246 classes: null
7247 };
7248 c.classes = "";
7249 var v = 0;
7250 return a.classes.forEach(function(d) {
7251 return c.classes += v++ === 0 ? d : " " + d;
7252 }), c;
7253 }
7254 }
7255 }, mt.jsons = function() {
7256 for (var t = [], e = 0; e < this.length; e++) {
7257 var r = this[e], a = r.json();
7258 t.push(a);
7259 }
7260 return t;
7261 }, mt.clone = function() {
7262 for (var t = this.cy(), e = [], r = 0; r < this.length; r++) {
7263 var a = this[r], n = a.json(), i = new vn(t, n, !1);
7264 e.push(i);
7265 }
7266 return new Ot(t, e);
7267 }, mt.copy = mt.clone, mt.restore = function() {
7268 for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, r = this, a = r.cy(), n = a._private, i = [], s = [], o, l = 0, u = r.length; l < u; l++) {
7269 var f = r[l];
7270 e && !f.removed() || (f.isNode() ? i.push(f) : s.push(f));
7271 }
7272 o = i.concat(s);
7273 var h, c = function() {
7274 o.splice(h, 1), h--;
7275 };
7276 for (h = 0; h < o.length; h++) {
7277 var v = o[h], d = v._private, g = d.data;
7278 if (v.clearTraversalCache(), !(!e && !d.removed)) {
7279 if (g.id === void 0)
7280 g.id = ps();
7281 else if (k(g.id))
7282 g.id = "" + g.id;
7283 else if (Pe(g.id) || !j(g.id)) {
7284 xt("Can not create element with invalid string ID `" + g.id + "`"), c();
7285 continue;
7286 } else if (a.hasElementWithId(g.id)) {
7287 xt("Can not create second element with ID `" + g.id + "`"), c();
7288 continue;
7289 }
7290 }
7291 var y = g.id;
7292 if (v.isNode()) {
7293 var p = d.position;
7294 p.x == null && (p.x = 0), p.y == null && (p.y = 0);
7295 }
7296 if (v.isEdge()) {
7297 for (var m = v, b = ["source", "target"], E = b.length, M = !1, A = 0; A < E; A++) {
7298 var w = b[A], I = g[w];
7299 k(I) && (I = g[w] = "" + g[w]), I == null || I === "" ? (xt("Can not create edge `" + y + "` with unspecified " + w), M = !0) : a.hasElementWithId(I) || (xt("Can not create edge `" + y + "` with nonexistant " + w + " `" + I + "`"), M = !0);
7300 }
7301 if (M) {
7302 c();
7303 continue;
7304 }
7305 var C = a.getElementById(g.source), B = a.getElementById(g.target);
7306 C.same(B) ? C._private.edges.push(m) : (C._private.edges.push(m), B._private.edges.push(m)), m._private.source = C, m._private.target = B;
7307 }
7308 d.map = new ur(), d.map.set(y, {
7309 ele: v,
7310 index: 0
7311 }), d.removed = !1, e && a.addToPool(v);
7312 }
7313 for (var F = 0; F < i.length; F++) {
7314 var R = i[F], X = R._private.data;
7315 k(X.parent) && (X.parent = "" + X.parent);
7316 var z = X.parent, re = z != null;
7317 if (re || R._private.parent) {
7318 var W = R._private.parent ? a.collection().merge(R._private.parent) : a.getElementById(z);
7319 if (W.empty())
7320 X.parent = void 0;
7321 else if (W[0].removed())
7322 ft("Node added with missing parent, reference to parent removed"), X.parent = void 0, R._private.parent = null;
7323 else {
7324 for (var Z = !1, ie = W; !ie.empty(); ) {
7325 if (R.same(ie)) {
7326 Z = !0, X.parent = void 0;
7327 break;
7328 }
7329 ie = ie.parent();
7330 }
7331 Z || (W[0]._private.children.push(R), R._private.parent = W[0], n.hasCompoundNodes = !0);
7332 }
7333 }
7334 }
7335 if (o.length > 0) {
7336 for (var oe = o.length === r.length ? r : new Ot(a, o), ge = 0; ge < oe.length; ge++) {
7337 var se = oe[ge];
7338 se.isNode() || (se.parallelEdges().clearTraversalCache(), se.source().clearTraversalCache(), se.target().clearTraversalCache());
7339 }
7340 var de;
7341 n.hasCompoundNodes ? de = a.collection().merge(oe).merge(oe.connectedNodes()).merge(oe.parent()) : de = oe, de.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t), t ? oe.emitAndNotify("add") : e && oe.emit("add");
7342 }
7343 return r;
7344 }, mt.removed = function() {
7345 var t = this[0];
7346 return t && t._private.removed;
7347 }, mt.inside = function() {
7348 var t = this[0];
7349 return t && !t._private.removed;
7350 }, mt.remove = function() {
7351 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, r = this, a = [], n = {}, i = r._private.cy;
7352 function s(z) {
7353 for (var re = z._private.edges, W = 0; W < re.length; W++)
7354 l(re[W]);
7355 }
7356 function o(z) {
7357 for (var re = z._private.children, W = 0; W < re.length; W++)
7358 l(re[W]);
7359 }
7360 function l(z) {
7361 var re = n[z.id()];
7362 e && z.removed() || re || (n[z.id()] = !0, z.isNode() ? (a.push(z), s(z), o(z)) : a.unshift(z));
7363 }
7364 for (var u = 0, f = r.length; u < f; u++) {
7365 var h = r[u];
7366 l(h);
7367 }
7368 function c(z, re) {
7369 var W = z._private.edges;
7370 wr(W, re), z.clearTraversalCache();
7371 }
7372 function v(z) {
7373 z.clearTraversalCache();
7374 }
7375 var d = [];
7376 d.ids = {};
7377 function g(z, re) {
7378 re = re[0], z = z[0];
7379 var W = z._private.children, Z = z.id();
7380 wr(W, re), re._private.parent = null, d.ids[Z] || (d.ids[Z] = !0, d.push(z));
7381 }
7382 r.dirtyCompoundBoundsCache(), e && i.removeFromPool(a);
7383 for (var y = 0; y < a.length; y++) {
7384 var p = a[y];
7385 if (p.isEdge()) {
7386 var m = p.source()[0], b = p.target()[0];
7387 c(m, p), c(b, p);
7388 for (var E = p.parallelEdges(), M = 0; M < E.length; M++) {
7389 var A = E[M];
7390 v(A), A.isBundledBezier() && A.dirtyBoundingBoxCache();
7391 }
7392 } else {
7393 var w = p.parent();
7394 w.length !== 0 && g(w, p);
7395 }
7396 e && (p._private.removed = !0);
7397 }
7398 var I = i._private.elements;
7399 i._private.hasCompoundNodes = !1;
7400 for (var C = 0; C < I.length; C++) {
7401 var B = I[C];
7402 if (B.isParent()) {
7403 i._private.hasCompoundNodes = !0;
7404 break;
7405 }
7406 }
7407 var F = new Ot(this.cy(), a);
7408 F.size() > 0 && (t ? F.emitAndNotify("remove") : e && F.emit("remove"));
7409 for (var R = 0; R < d.length; R++) {
7410 var X = d[R];
7411 (!e || !X.removed()) && X.updateStyle();
7412 }
7413 return F;
7414 }, mt.move = function(t) {
7415 var e = this._private.cy, r = this, a = !1, n = !1, i = function(d) {
7416 return d == null ? d : "" + d;
7417 };
7418 if (t.source !== void 0 || t.target !== void 0) {
7419 var s = i(t.source), o = i(t.target), l = s != null && e.hasElementWithId(s), u = o != null && e.hasElementWithId(o);
7420 (l || u) && (e.batch(function() {
7421 r.remove(a, n), r.emitAndNotify("moveout");
7422 for (var v = 0; v < r.length; v++) {
7423 var d = r[v], g = d._private.data;
7424 d.isEdge() && (l && (g.source = s), u && (g.target = o));
7425 }
7426 r.restore(a, n);
7427 }), r.emitAndNotify("move"));
7428 } else if (t.parent !== void 0) {
7429 var f = i(t.parent), h = f === null || e.hasElementWithId(f);
7430 if (h) {
7431 var c = f === null ? void 0 : f;
7432 e.batch(function() {
7433 var v = r.remove(a, n);
7434 v.emitAndNotify("moveout");
7435 for (var d = 0; d < r.length; d++) {
7436 var g = r[d], y = g._private.data;
7437 g.isNode() && (y.parent = c);
7438 }
7439 v.restore(a, n);
7440 }), r.emitAndNotify("move");
7441 }
7442 }
7443 return this;
7444 }, [Ys, $v, Sn, Lr, fa, rd, Ln, yd, Mo, Io, xd, In, Rn, At, Nr, Pt].forEach(function(t) {
7445 Ue(mt, t);
7446 });
7447 var Od = {
7448 add: function(e) {
7449 var r, a = this;
7450 if (pe(e)) {
7451 var n = e;
7452 if (n._private.cy === a)
7453 r = n.restore();
7454 else {
7455 for (var i = [], s = 0; s < n.length; s++) {
7456 var o = n[s];
7457 i.push(o.json());
7458 }
7459 r = new Ot(a, i);
7460 }
7461 } else if (te(e)) {
7462 var l = e;
7463 r = new Ot(a, l);
7464 } else if (L(e) && (te(e.nodes) || te(e.edges))) {
7465 for (var u = e, f = [], h = ["nodes", "edges"], c = 0, v = h.length; c < v; c++) {
7466 var d = h[c], g = u[d];
7467 if (te(g))
7468 for (var y = 0, p = g.length; y < p; y++) {
7469 var m = Ue({
7470 group: d
7471 }, g[y]);
7472 f.push(m);
7473 }
7474 }
7475 r = new Ot(a, f);
7476 } else {
7477 var b = e;
7478 r = new vn(a, b).collection();
7479 }
7480 return r;
7481 },
7482 remove: function(e) {
7483 if (!pe(e)) {
7484 if (j(e)) {
7485 var r = e;
7486 e = this.$(r);
7487 }
7488 }
7489 return e.remove();
7490 }
7491 };
7492 /*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */
7493 function Nd(t, e, r, a) {
7494 var n = 4, i = 1e-3, s = 1e-7, o = 10, l = 11, u = 1 / (l - 1), f = typeof Float32Array < "u";
7495 if (arguments.length !== 4)
7496 return !1;
7497 for (var h = 0; h < 4; ++h)
7498 if (typeof arguments[h] != "number" || isNaN(arguments[h]) || !isFinite(arguments[h]))
7499 return !1;
7500 t = Math.min(t, 1), r = Math.min(r, 1), t = Math.max(t, 0), r = Math.max(r, 0);
7501 var c = f ? new Float32Array(l) : new Array(l);
7502 function v(B, F) {
7503 return 1 - 3 * F + 3 * B;
7504 }
7505 function d(B, F) {
7506 return 3 * F - 6 * B;
7507 }
7508 function g(B) {
7509 return 3 * B;
7510 }
7511 function y(B, F, R) {
7512 return ((v(F, R) * B + d(F, R)) * B + g(F)) * B;
7513 }
7514 function p(B, F, R) {
7515 return 3 * v(F, R) * B * B + 2 * d(F, R) * B + g(F);
7516 }
7517 function m(B, F) {
7518 for (var R = 0; R < n; ++R) {
7519 var X = p(F, t, r);
7520 if (X === 0)
7521 return F;
7522 var z = y(F, t, r) - B;
7523 F -= z / X;
7524 }
7525 return F;
7526 }
7527 function b() {
7528 for (var B = 0; B < l; ++B)
7529 c[B] = y(B * u, t, r);
7530 }
7531 function E(B, F, R) {
7532 var X, z, re = 0;
7533 do
7534 z = F + (R - F) / 2, X = y(z, t, r) - B, X > 0 ? R = z : F = z;
7535 while (Math.abs(X) > s && ++re < o);
7536 return z;
7537 }
7538 function M(B) {
7539 for (var F = 0, R = 1, X = l - 1; R !== X && c[R] <= B; ++R)
7540 F += u;
7541 --R;
7542 var z = (B - c[R]) / (c[R + 1] - c[R]), re = F + z * u, W = p(re, t, r);
7543 return W >= i ? m(B, re) : W === 0 ? re : E(B, F, F + u);
7544 }
7545 var A = !1;
7546 function w() {
7547 A = !0, (t !== e || r !== a) && b();
7548 }
7549 var I = function(F) {
7550 return A || w(), t === e && r === a ? F : F === 0 ? 0 : F === 1 ? 1 : y(M(F), e, a);
7551 };
7552 I.getControlPoints = function() {
7553 return [{
7554 x: t,
7555 y: e
7556 }, {
7557 x: r,
7558 y: a
7559 }];
7560 };
7561 var C = "generateBezier(" + [t, e, r, a] + ")";
7562 return I.toString = function() {
7563 return C;
7564 }, I;
7565 }
7566 /*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */
7567 var Md = function() {
7568 function t(a) {
7569 return -a.tension * a.x - a.friction * a.v;
7570 }
7571 function e(a, n, i) {
7572 var s = {
7573 x: a.x + i.dx * n,
7574 v: a.v + i.dv * n,
7575 tension: a.tension,
7576 friction: a.friction
7577 };
7578 return {
7579 dx: s.v,
7580 dv: t(s)
7581 };
7582 }
7583 function r(a, n) {
7584 var i = {
7585 dx: a.v,
7586 dv: t(a)
7587 }, s = e(a, n * 0.5, i), o = e(a, n * 0.5, s), l = e(a, n, o), u = 1 / 6 * (i.dx + 2 * (s.dx + o.dx) + l.dx), f = 1 / 6 * (i.dv + 2 * (s.dv + o.dv) + l.dv);
7588 return a.x = a.x + u * n, a.v = a.v + f * n, a;
7589 }
7590 return function a(n, i, s) {
7591 var o = {
7592 x: -1,
7593 v: 0,
7594 tension: null,
7595 friction: null
7596 }, l = [0], u = 0, f = 1 / 1e4, h = 16 / 1e3, c, v, d;
7597 for (n = parseFloat(n) || 500, i = parseFloat(i) || 20, s = s || null, o.tension = n, o.friction = i, c = s !== null, c ? (u = a(n, i), v = u / s * h) : v = h; d = r(d || o, v), l.push(1 + d.x), u += 16, Math.abs(d.x) > f && Math.abs(d.v) > f; )
7598 ;
7599 return c ? function(g) {
7600 return l[g * (l.length - 1) | 0];
7601 } : u;
7602 };
7603 }(), bt = function(e, r, a, n) {
7604 var i = Nd(e, r, a, n);
7605 return function(s, o, l) {
7606 return s + (o - s) * i(l);
7607 };
7608 }, Bn = {
7609 linear: function(e, r, a) {
7610 return e + (r - e) * a;
7611 },
7612 // default easings
7613 ease: bt(0.25, 0.1, 0.25, 1),
7614 "ease-in": bt(0.42, 0, 1, 1),
7615 "ease-out": bt(0, 0, 0.58, 1),
7616 "ease-in-out": bt(0.42, 0, 0.58, 1),
7617 // sine
7618 "ease-in-sine": bt(0.47, 0, 0.745, 0.715),
7619 "ease-out-sine": bt(0.39, 0.575, 0.565, 1),
7620 "ease-in-out-sine": bt(0.445, 0.05, 0.55, 0.95),
7621 // quad
7622 "ease-in-quad": bt(0.55, 0.085, 0.68, 0.53),
7623 "ease-out-quad": bt(0.25, 0.46, 0.45, 0.94),
7624 "ease-in-out-quad": bt(0.455, 0.03, 0.515, 0.955),
7625 // cubic
7626 "ease-in-cubic": bt(0.55, 0.055, 0.675, 0.19),
7627 "ease-out-cubic": bt(0.215, 0.61, 0.355, 1),
7628 "ease-in-out-cubic": bt(0.645, 0.045, 0.355, 1),
7629 // quart
7630 "ease-in-quart": bt(0.895, 0.03, 0.685, 0.22),
7631 "ease-out-quart": bt(0.165, 0.84, 0.44, 1),
7632 "ease-in-out-quart": bt(0.77, 0, 0.175, 1),
7633 // quint
7634 "ease-in-quint": bt(0.755, 0.05, 0.855, 0.06),
7635 "ease-out-quint": bt(0.23, 1, 0.32, 1),
7636 "ease-in-out-quint": bt(0.86, 0, 0.07, 1),
7637 // expo
7638 "ease-in-expo": bt(0.95, 0.05, 0.795, 0.035),
7639 "ease-out-expo": bt(0.19, 1, 0.22, 1),
7640 "ease-in-out-expo": bt(1, 0, 0, 1),
7641 // circ
7642 "ease-in-circ": bt(0.6, 0.04, 0.98, 0.335),
7643 "ease-out-circ": bt(0.075, 0.82, 0.165, 1),
7644 "ease-in-out-circ": bt(0.785, 0.135, 0.15, 0.86),
7645 // user param easings...
7646 spring: function(e, r, a) {
7647 if (a === 0)
7648 return Bn.linear;
7649 var n = Md(e, r, a);
7650 return function(i, s, o) {
7651 return i + (s - i) * n(o);
7652 };
7653 },
7654 "cubic-bezier": bt
7655 };
7656 function _o(t, e, r, a, n) {
7657 if (a === 1 || e === r)
7658 return r;
7659 var i = n(e, r, a);
7660 return t == null || ((t.roundValue || t.color) && (i = Math.round(i)), t.min !== void 0 && (i = Math.max(i, t.min)), t.max !== void 0 && (i = Math.min(i, t.max))), i;
7661 }
7662 function Uo(t, e) {
7663 return t.pfValue != null || t.value != null ? t.pfValue != null && (e == null || e.type.units !== "%") ? t.pfValue : t.value : t;
7664 }
7665 function ga(t, e, r, a, n) {
7666 var i = n != null ? n.type : null;
7667 r < 0 ? r = 0 : r > 1 && (r = 1);
7668 var s = Uo(t, n), o = Uo(e, n);
7669 if (k(s) && k(o))
7670 return _o(i, s, o, r, a);
7671 if (te(s) && te(o)) {
7672 for (var l = [], u = 0; u < o.length; u++) {
7673 var f = s[u], h = o[u];
7674 if (f != null && h != null) {
7675 var c = _o(i, f, h, r, a);
7676 l.push(c);
7677 } else
7678 l.push(h);
7679 }
7680 return l;
7681 }
7682 }
7683 function Id(t, e, r, a) {
7684 var n = !a, i = t._private, s = e._private, o = s.easing, l = s.startTime, u = a ? t : t.cy(), f = u.style();
7685 if (!s.easingImpl)
7686 if (o == null)
7687 s.easingImpl = Bn.linear;
7688 else {
7689 var h;
7690 if (j(o)) {
7691 var c = f.parse("transition-timing-function", o);
7692 h = c.value;
7693 } else
7694 h = o;
7695 var v, d;
7696 j(h) ? (v = h, d = []) : (v = h[1], d = h.slice(2).map(function(oe) {
7697 return +oe;
7698 })), d.length > 0 ? (v === "spring" && d.push(s.duration), s.easingImpl = Bn[v].apply(null, d)) : s.easingImpl = Bn[v];
7699 }
7700 var g = s.easingImpl, y;
7701 if (s.duration === 0 ? y = 1 : y = (r - l) / s.duration, s.applying && (y = s.progress), y < 0 ? y = 0 : y > 1 && (y = 1), s.delay == null) {
7702 var p = s.startPosition, m = s.position;
7703 if (m && n && !t.locked()) {
7704 var b = {};
7705 Xa(p.x, m.x) && (b.x = ga(p.x, m.x, y, g)), Xa(p.y, m.y) && (b.y = ga(p.y, m.y, y, g)), t.position(b);
7706 }
7707 var E = s.startPan, M = s.pan, A = i.pan, w = M != null && a;
7708 w && (Xa(E.x, M.x) && (A.x = ga(E.x, M.x, y, g)), Xa(E.y, M.y) && (A.y = ga(E.y, M.y, y, g)), t.emit("pan"));
7709 var I = s.startZoom, C = s.zoom, B = C != null && a;
7710 B && (Xa(I, C) && (i.zoom = ka(i.minZoom, ga(I, C, y, g), i.maxZoom)), t.emit("zoom")), (w || B) && t.emit("viewport");
7711 var F = s.style;
7712 if (F && F.length > 0 && n) {
7713 for (var R = 0; R < F.length; R++) {
7714 var X = F[R], z = X.name, re = X, W = s.startStyle[z], Z = f.properties[W.name], ie = ga(W, re, y, g, Z);
7715 f.overrideBypass(t, z, ie);
7716 }
7717 t.emit("style");
7718 }
7719 }
7720 return s.progress = y, y;
7721 }
7722 function Xa(t, e) {
7723 return t == null || e == null ? !1 : k(t) && k(e) ? !0 : !!(t && e);
7724 }
7725 function Rd(t, e, r, a) {
7726 var n = e._private;
7727 n.started = !0, n.startTime = r - n.progress * n.duration;
7728 }
7729 function Yo(t, e) {
7730 var r = e._private.aniEles, a = [];
7731 function n(f, h) {
7732 var c = f._private, v = c.animation.current, d = c.animation.queue, g = !1;
7733 if (v.length === 0) {
7734 var y = d.shift();
7735 y && v.push(y);
7736 }
7737 for (var p = function(A) {
7738 for (var w = A.length - 1; w >= 0; w--) {
7739 var I = A[w];
7740 I();
7741 }
7742 A.splice(0, A.length);
7743 }, m = v.length - 1; m >= 0; m--) {
7744 var b = v[m], E = b._private;
7745 if (E.stopped) {
7746 v.splice(m, 1), E.hooked = !1, E.playing = !1, E.started = !1, p(E.frames);
7747 continue;
7748 }
7749 !E.playing && !E.applying || (E.playing && E.applying && (E.applying = !1), E.started || Rd(f, b, t), Id(f, b, t, h), E.applying && (E.applying = !1), p(E.frames), E.step != null && E.step(t), b.completed() && (v.splice(m, 1), E.hooked = !1, E.playing = !1, E.started = !1, p(E.completes)), g = !0);
7750 }
7751 return !h && v.length === 0 && d.length === 0 && a.push(f), g;
7752 }
7753 for (var i = !1, s = 0; s < r.length; s++) {
7754 var o = r[s], l = n(o);
7755 i = i || l;
7756 }
7757 var u = n(e, !0);
7758 (i || u) && (r.length > 0 ? e.notify("draw", r) : e.notify("draw")), r.unmerge(a), e.emit("step");
7759 }
7760 var kd = {
7761 // pull in animation functions
7762 animate: ht.animate(),
7763 animation: ht.animation(),
7764 animated: ht.animated(),
7765 clearQueue: ht.clearQueue(),
7766 delay: ht.delay(),
7767 delayAnimation: ht.delayAnimation(),
7768 stop: ht.stop(),
7769 addToAnimationPool: function(e) {
7770 var r = this;
7771 r.styleEnabled() && r._private.aniEles.merge(e);
7772 },
7773 stopAnimationLoop: function() {
7774 this._private.animationsRunning = !1;
7775 },
7776 startAnimationLoop: function() {
7777 var e = this;
7778 if (e._private.animationsRunning = !0, !e.styleEnabled())
7779 return;
7780 function r() {
7781 e._private.animationsRunning && fn(function(i) {
7782 Yo(i, e), r();
7783 });
7784 }
7785 var a = e.renderer();
7786 a && a.beforeRender ? a.beforeRender(function(i, s) {
7787 Yo(s, e);
7788 }, a.beforeRenderPriorities.animations) : r();
7789 }
7790 }, Pd = {
7791 qualifierCompare: function(e, r) {
7792 return e == null || r == null ? e == null && r == null : e.sameText(r);
7793 },
7794 eventMatches: function(e, r, a) {
7795 var n = r.qualifier;
7796 return n != null ? e !== a.target && Ae(a.target) && n.matches(a.target) : !0;
7797 },
7798 addEventFields: function(e, r) {
7799 r.cy = e, r.target = e;
7800 },
7801 callbackContext: function(e, r, a) {
7802 return r.qualifier != null ? a.target : e;
7803 }
7804 }, Fn = function(e) {
7805 return j(e) ? new Dr(e) : e;
7806 }, Ho = {
7807 createEmitter: function() {
7808 var e = this._private;
7809 return e.emitter || (e.emitter = new Nn(Pd, this)), this;
7810 },
7811 emitter: function() {
7812 return this._private.emitter;
7813 },
7814 on: function(e, r, a) {
7815 return this.emitter().on(e, Fn(r), a), this;
7816 },
7817 removeListener: function(e, r, a) {
7818 return this.emitter().removeListener(e, Fn(r), a), this;
7819 },
7820 removeAllListeners: function() {
7821 return this.emitter().removeAllListeners(), this;
7822 },
7823 one: function(e, r, a) {
7824 return this.emitter().one(e, Fn(r), a), this;
7825 },
7826 once: function(e, r, a) {
7827 return this.emitter().one(e, Fn(r), a), this;
7828 },
7829 emit: function(e, r) {
7830 return this.emitter().emit(e, r), this;
7831 },
7832 emitAndNotify: function(e, r) {
7833 return this.emit(e), this.notify(e, r), this;
7834 }
7835 };
7836 ht.eventAliasesOn(Ho);
7837 var Ii = {
7838 png: function(e) {
7839 var r = this._private.renderer;
7840 return e = e || {}, r.png(e);
7841 },
7842 jpg: function(e) {
7843 var r = this._private.renderer;
7844 return e = e || {}, e.bg = e.bg || "#fff", r.jpg(e);
7845 }
7846 };
7847 Ii.jpeg = Ii.jpg;
7848 var zn = {
7849 layout: function(e) {
7850 var r = this;
7851 if (e == null) {
7852 xt("Layout options must be specified to make a layout");
7853 return;
7854 }
7855 if (e.name == null) {
7856 xt("A `name` must be specified to make a layout");
7857 return;
7858 }
7859 var a = e.name, n = r.extension("layout", a);
7860 if (n == null) {
7861 xt("No such layout `" + a + "` found. Did you forget to import it and `cytoscape.use()` it?");
7862 return;
7863 }
7864 var i;
7865 j(e.eles) ? i = r.$(e.eles) : i = e.eles != null ? e.eles : r.$();
7866 var s = new n(Ue({}, e, {
7867 cy: r,
7868 eles: i
7869 }));
7870 return s;
7871 }
7872 };
7873 zn.createLayout = zn.makeLayout = zn.layout;
7874 var Bd = {
7875 notify: function(e, r) {
7876 var a = this._private;
7877 if (this.batching()) {
7878 a.batchNotifications = a.batchNotifications || {};
7879 var n = a.batchNotifications[e] = a.batchNotifications[e] || this.collection();
7880 r != null && n.merge(r);
7881 return;
7882 }
7883 if (a.notificationsEnabled) {
7884 var i = this.renderer();
7885 this.destroyed() || !i || i.notify(e, r);
7886 }
7887 },
7888 notifications: function(e) {
7889 var r = this._private;
7890 return e === void 0 ? r.notificationsEnabled : (r.notificationsEnabled = !!e, this);
7891 },
7892 noNotifications: function(e) {
7893 this.notifications(!1), e(), this.notifications(!0);
7894 },
7895 batching: function() {
7896 return this._private.batchCount > 0;
7897 },
7898 startBatch: function() {
7899 var e = this._private;
7900 return e.batchCount == null && (e.batchCount = 0), e.batchCount === 0 && (e.batchStyleEles = this.collection(), e.batchNotifications = {}), e.batchCount++, this;
7901 },
7902 endBatch: function() {
7903 var e = this._private;
7904 if (e.batchCount === 0)
7905 return this;
7906 if (e.batchCount--, e.batchCount === 0) {
7907 e.batchStyleEles.updateStyle();
7908 var r = this.renderer();
7909 Object.keys(e.batchNotifications).forEach(function(a) {
7910 var n = e.batchNotifications[a];
7911 n.empty() ? r.notify(a) : r.notify(a, n);
7912 });
7913 }
7914 return this;
7915 },
7916 batch: function(e) {
7917 return this.startBatch(), e(), this.endBatch(), this;
7918 },
7919 // for backwards compatibility
7920 batchData: function(e) {
7921 var r = this;
7922 return this.batch(function() {
7923 for (var a = Object.keys(e), n = 0; n < a.length; n++) {
7924 var i = a[n], s = e[i], o = r.getElementById(i);
7925 o.data(s);
7926 }
7927 });
7928 }
7929 }, Fd = Lt({
7930 hideEdgesOnViewport: !1,
7931 textureOnViewport: !1,
7932 motionBlur: !1,
7933 motionBlurOpacity: 0.05,
7934 pixelRatio: void 0,
7935 desktopTapThreshold: 4,
7936 touchTapThreshold: 8,
7937 wheelSensitivity: 1,
7938 debug: !1,
7939 showFps: !1
7940 }), Ri = {
7941 renderTo: function(e, r, a, n) {
7942 var i = this._private.renderer;
7943 return i.renderTo(e, r, a, n), this;
7944 },
7945 renderer: function() {
7946 return this._private.renderer;
7947 },
7948 forceRender: function() {
7949 return this.notify("draw"), this;
7950 },
7951 resize: function() {
7952 return this.invalidateSize(), this.emitAndNotify("resize"), this;
7953 },
7954 initRenderer: function(e) {
7955 var r = this, a = r.extension("renderer", e.name);
7956 if (a == null) {
7957 xt("Can not initialise: No such renderer `".concat(e.name, "` found. Did you forget to import it and `cytoscape.use()` it?"));
7958 return;
7959 }
7960 e.wheelSensitivity !== void 0 && ft("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");
7961 var n = Fd(e);
7962 n.cy = r, r._private.renderer = new a(n), this.notify("init");
7963 },
7964 destroyRenderer: function() {
7965 var e = this;
7966 e.notify("destroy");
7967 var r = e.container();
7968 if (r)
7969 for (r._cyreg = null; r.childNodes.length > 0; )
7970 r.removeChild(r.childNodes[0]);
7971 e._private.renderer = null, e.mutableElements().forEach(function(a) {
7972 var n = a._private;
7973 n.rscratch = {}, n.rstyle = {}, n.animation.current = [], n.animation.queue = [];
7974 });
7975 },
7976 onRender: function(e) {
7977 return this.on("render", e);
7978 },
7979 offRender: function(e) {
7980 return this.off("render", e);
7981 }
7982 };
7983 Ri.invalidateDimensions = Ri.resize;
7984 var Gn = {
7985 // get a collection
7986 // - empty collection on no args
7987 // - collection of elements in the graph on selector arg
7988 // - guarantee a returned collection when elements or collection specified
7989 collection: function(e, r) {
7990 return j(e) ? this.$(e) : pe(e) ? e.collection() : te(e) ? (r || (r = {}), new Ot(this, e, r.unique, r.removed)) : new Ot(this);
7991 },
7992 nodes: function(e) {
7993 var r = this.$(function(a) {
7994 return a.isNode();
7995 });
7996 return e ? r.filter(e) : r;
7997 },
7998 edges: function(e) {
7999 var r = this.$(function(a) {
8000 return a.isEdge();
8001 });
8002 return e ? r.filter(e) : r;
8003 },
8004 // search the graph like jQuery
8005 $: function(e) {
8006 var r = this._private.elements;
8007 return e ? r.filter(e) : r.spawnSelf();
8008 },
8009 mutableElements: function() {
8010 return this._private.elements;
8011 }
8012 };
8013 Gn.elements = Gn.filter = Gn.$;
8014 var Bt = {}, qa = "t", zd = "f";
8015 Bt.apply = function(t) {
8016 for (var e = this, r = e._private, a = r.cy, n = a.collection(), i = 0; i < t.length; i++) {
8017 var s = t[i], o = e.getContextMeta(s);
8018 if (!o.empty) {
8019 var l = e.getContextStyle(o), u = e.applyContextStyle(o, l, s);
8020 s._private.appliedInitStyle ? e.updateTransitions(s, u.diffProps) : s._private.appliedInitStyle = !0;
8021 var f = e.updateStyleHints(s);
8022 f && n.push(s);
8023 }
8024 }
8025 return n;
8026 }, Bt.getPropertiesDiff = function(t, e) {
8027 var r = this, a = r._private.propDiffs = r._private.propDiffs || {}, n = t + "-" + e, i = a[n];
8028 if (i)
8029 return i;
8030 for (var s = [], o = {}, l = 0; l < r.length; l++) {
8031 var u = r[l], f = t[l] === qa, h = e[l] === qa, c = f !== h, v = u.mappedProperties.length > 0;
8032 if (c || h && v) {
8033 var d = void 0;
8034 c && v || c ? d = u.properties : v && (d = u.mappedProperties);
8035 for (var g = 0; g < d.length; g++) {
8036 for (var y = d[g], p = y.name, m = !1, b = l + 1; b < r.length; b++) {
8037 var E = r[b], M = e[b] === qa;
8038 if (M && (m = E.properties[y.name] != null, m))
8039 break;
8040 }
8041 !o[p] && !m && (o[p] = !0, s.push(p));
8042 }
8043 }
8044 }
8045 return a[n] = s, s;
8046 }, Bt.getContextMeta = function(t) {
8047 for (var e = this, r = "", a, n = t._private.styleCxtKey || "", i = 0; i < e.length; i++) {
8048 var s = e[i], o = s.selector && s.selector.matches(t);
8049 o ? r += qa : r += zd;
8050 }
8051 return a = e.getPropertiesDiff(n, r), t._private.styleCxtKey = r, {
8052 key: r,
8053 diffPropNames: a,
8054 empty: a.length === 0
8055 };
8056 }, Bt.getContextStyle = function(t) {
8057 var e = t.key, r = this, a = this._private.contextStyles = this._private.contextStyles || {};
8058 if (a[e])
8059 return a[e];
8060 for (var n = {
8061 _private: {
8062 key: e
8063 }
8064 }, i = 0; i < r.length; i++) {
8065 var s = r[i], o = e[i] === qa;
8066 if (o)
8067 for (var l = 0; l < s.properties.length; l++) {
8068 var u = s.properties[l];
8069 n[u.name] = u;
8070 }
8071 }
8072 return a[e] = n, n;
8073 }, Bt.applyContextStyle = function(t, e, r) {
8074 for (var a = this, n = t.diffPropNames, i = {}, s = a.types, o = 0; o < n.length; o++) {
8075 var l = n[o], u = e[l], f = r.pstyle(l);
8076 if (!u)
8077 if (f)
8078 f.bypass ? u = {
8079 name: l,
8080 deleteBypassed: !0
8081 } : u = {
8082 name: l,
8083 delete: !0
8084 };
8085 else
8086 continue;
8087 if (f !== u) {
8088 if (u.mapped === s.fn && f != null && f.mapping != null && f.mapping.value === u.value) {
8089 var h = f.mapping, c = h.fnValue = u.value(r);
8090 if (c === h.prevFnValue)
8091 continue;
8092 }
8093 var v = i[l] = {
8094 prev: f
8095 };
8096 a.applyParsedProperty(r, u), v.next = r.pstyle(l), v.next && v.next.bypass && (v.next = v.next.bypassed);
8097 }
8098 }
8099 return {
8100 diffProps: i
8101 };
8102 }, Bt.updateStyleHints = function(t) {
8103 var e = t._private, r = this, a = r.propertyGroupNames, n = r.propertyGroupKeys, i = function(Oe, Ie, He) {
8104 return r.getPropertiesHash(Oe, Ie, He);
8105 }, s = e.styleKey;
8106 if (t.removed())
8107 return !1;
8108 var o = e.group === "nodes", l = t._private.style;
8109 a = Object.keys(l);
8110 for (var u = 0; u < n.length; u++) {
8111 var f = n[u];
8112 e.styleKeys[f] = [Qr, Oa];
8113 }
8114 for (var h = function(Oe, Ie) {
8115 return e.styleKeys[Ie][0] = Na(Oe, e.styleKeys[Ie][0]);
8116 }, c = function(Oe, Ie) {
8117 return e.styleKeys[Ie][1] = Ma(Oe, e.styleKeys[Ie][1]);
8118 }, v = function(Oe, Ie) {
8119 h(Oe, Ie), c(Oe, Ie);
8120 }, d = function(Oe, Ie) {
8121 for (var He = 0; He < Oe.length; He++) {
8122 var qe = Oe.charCodeAt(He);
8123 h(qe, Ie), c(qe, Ie);
8124 }
8125 }, g = 2e9, y = function(Oe) {
8126 return -128 < Oe && Oe < 128 && Math.floor(Oe) !== Oe ? g - (Oe * 1024 | 0) : Oe;
8127 }, p = 0; p < a.length; p++) {
8128 var m = a[p], b = l[m];
8129 if (b != null) {
8130 var E = this.properties[m], M = E.type, A = E.groupKey, w = void 0;
8131 E.hashOverride != null ? w = E.hashOverride(t, b) : b.pfValue != null && (w = b.pfValue);
8132 var I = E.enums == null ? b.value : null, C = w != null, B = I != null, F = C || B, R = b.units;
8133 if (M.number && F && !M.multiple) {
8134 var X = C ? w : I;
8135 v(y(X), A), !C && R != null && d(R, A);
8136 } else
8137 d(b.strValue, A);
8138 }
8139 }
8140 for (var z = [Qr, Oa], re = 0; re < n.length; re++) {
8141 var W = n[re], Z = e.styleKeys[W];
8142 z[0] = Na(Z[0], z[0]), z[1] = Ma(Z[1], z[1]);
8143 }
8144 e.styleKey = Ul(z[0], z[1]);
8145 var ie = e.styleKeys;
8146 e.labelDimsKey = Er(ie.labelDimensions);
8147 var oe = i(t, ["label"], ie.labelDimensions);
8148 if (e.labelKey = Er(oe), e.labelStyleKey = Er(hn(ie.commonLabel, oe)), !o) {
8149 var ge = i(t, ["source-label"], ie.labelDimensions);
8150 e.sourceLabelKey = Er(ge), e.sourceLabelStyleKey = Er(hn(ie.commonLabel, ge));
8151 var se = i(t, ["target-label"], ie.labelDimensions);
8152 e.targetLabelKey = Er(se), e.targetLabelStyleKey = Er(hn(ie.commonLabel, se));
8153 }
8154 if (o) {
8155 var de = e.styleKeys, we = de.nodeBody, Te = de.nodeBorder, Ee = de.backgroundImage, ye = de.compound, ae = de.pie, xe = [we, Te, Ee, ye, ae].filter(function(Ce) {
8156 return Ce != null;
8157 }).reduce(hn, [Qr, Oa]);
8158 e.nodeKey = Er(xe), e.hasPie = ae != null && ae[0] !== Qr && ae[1] !== Oa;
8159 }
8160 return s !== e.styleKey;
8161 }, Bt.clearStyleHints = function(t) {
8162 var e = t._private;
8163 e.styleCxtKey = "", e.styleKeys = {}, e.styleKey = null, e.labelKey = null, e.labelStyleKey = null, e.sourceLabelKey = null, e.sourceLabelStyleKey = null, e.targetLabelKey = null, e.targetLabelStyleKey = null, e.nodeKey = null, e.hasPie = null;
8164 }, Bt.applyParsedProperty = function(t, e) {
8165 var r = this, a = e, n = t._private.style, i, s = r.types, o = r.properties[a.name].type, l = a.bypass, u = n[a.name], f = u && u.bypass, h = t._private, c = "mapping", v = function(we) {
8166 return we == null ? null : we.pfValue != null ? we.pfValue : we.value;
8167 }, d = function() {
8168 var we = v(u), Te = v(a);
8169 r.checkTriggers(t, a.name, we, Te);
8170 };
8171 if (a && a.name.substr(0, 3) === "pie" && ft("The pie style properties are deprecated. Create charts using background images instead."), e.name === "curve-style" && t.isEdge() && // loops must be bundled beziers
8172 (e.value !== "bezier" && t.isLoop() || // edges connected to compound nodes can not be haystacks
8173 e.value === "haystack" && (t.source().isParent() || t.target().isParent())) && (a = e = this.parse(e.name, "bezier", l)), a.delete)
8174 return n[a.name] = void 0, d(), !0;
8175 if (a.deleteBypassed)
8176 return u ? u.bypass ? (u.bypassed = void 0, d(), !0) : !1 : (d(), !0);
8177 if (a.deleteBypass)
8178 return u ? u.bypass ? (n[a.name] = u.bypassed, d(), !0) : !1 : (d(), !0);
8179 var g = function() {
8180 ft("Do not assign mappings to elements without corresponding data (i.e. ele `" + t.id() + "` has no mapping for property `" + a.name + "` with data field `" + a.field + "`); try a `[" + a.field + "]` selector to limit scope to elements with `" + a.field + "` defined");
8181 };
8182 switch (a.mapped) {
8183 case s.mapData: {
8184 for (var y = a.field.split("."), p = h.data, m = 0; m < y.length && p; m++) {
8185 var b = y[m];
8186 p = p[b];
8187 }
8188 if (p == null)
8189 return g(), !1;
8190 var E;
8191 if (k(p)) {
8192 var M = a.fieldMax - a.fieldMin;
8193 M === 0 ? E = 0 : E = (p - a.fieldMin) / M;
8194 } else
8195 return ft("Do not use continuous mappers without specifying numeric data (i.e. `" + a.field + ": " + p + "` for `" + t.id() + "` is non-numeric)"), !1;
8196 if (E < 0 ? E = 0 : E > 1 && (E = 1), o.color) {
8197 var A = a.valueMin[0], w = a.valueMax[0], I = a.valueMin[1], C = a.valueMax[1], B = a.valueMin[2], F = a.valueMax[2], R = a.valueMin[3] == null ? 1 : a.valueMin[3], X = a.valueMax[3] == null ? 1 : a.valueMax[3], z = [Math.round(A + (w - A) * E), Math.round(I + (C - I) * E), Math.round(B + (F - B) * E), Math.round(R + (X - R) * E)];
8198 i = {
8199 // colours are simple, so just create the flat property instead of expensive string parsing
8200 bypass: a.bypass,
8201 // we're a bypass if the mapping property is a bypass
8202 name: a.name,
8203 value: z,
8204 strValue: "rgb(" + z[0] + ", " + z[1] + ", " + z[2] + ")"
8205 };
8206 } else if (o.number) {
8207 var re = a.valueMin + (a.valueMax - a.valueMin) * E;
8208 i = this.parse(a.name, re, a.bypass, c);
8209 } else
8210 return !1;
8211 if (!i)
8212 return g(), !1;
8213 i.mapping = a, a = i;
8214 break;
8215 }
8216 case s.data: {
8217 for (var W = a.field.split("."), Z = h.data, ie = 0; ie < W.length && Z; ie++) {
8218 var oe = W[ie];
8219 Z = Z[oe];
8220 }
8221 if (Z != null && (i = this.parse(a.name, Z, a.bypass, c)), !i)
8222 return g(), !1;
8223 i.mapping = a, a = i;
8224 break;
8225 }
8226 case s.fn: {
8227 var ge = a.value, se = a.fnValue != null ? a.fnValue : ge(t);
8228 if (a.prevFnValue = se, se == null)
8229 return ft("Custom function mappers may not return null (i.e. `" + a.name + "` for ele `" + t.id() + "` is null)"), !1;
8230 if (i = this.parse(a.name, se, a.bypass, c), !i)
8231 return ft("Custom function mappers may not return invalid values for the property type (i.e. `" + a.name + "` for ele `" + t.id() + "` is invalid)"), !1;
8232 i.mapping = or(a), a = i;
8233 break;
8234 }
8235 case void 0:
8236 break;
8237 default:
8238 return !1;
8239 }
8240 return l ? (f ? a.bypassed = u.bypassed : a.bypassed = u, n[a.name] = a) : f ? u.bypassed = a : n[a.name] = a, d(), !0;
8241 }, Bt.cleanElements = function(t, e) {
8242 for (var r = 0; r < t.length; r++) {
8243 var a = t[r];
8244 if (this.clearStyleHints(a), a.dirtyCompoundBoundsCache(), a.dirtyBoundingBoxCache(), !e)
8245 a._private.style = {};
8246 else
8247 for (var n = a._private.style, i = Object.keys(n), s = 0; s < i.length; s++) {
8248 var o = i[s], l = n[o];
8249 l != null && (l.bypass ? l.bypassed = null : n[o] = null);
8250 }
8251 }
8252 }, Bt.update = function() {
8253 var t = this._private.cy, e = t.mutableElements();
8254 e.updateStyle();
8255 }, Bt.updateTransitions = function(t, e) {
8256 var r = this, a = t._private, n = t.pstyle("transition-property").value, i = t.pstyle("transition-duration").pfValue, s = t.pstyle("transition-delay").pfValue;
8257 if (n.length > 0 && i > 0) {
8258 for (var o = {}, l = !1, u = 0; u < n.length; u++) {
8259 var f = n[u], h = t.pstyle(f), c = e[f];
8260 if (c) {
8261 var v = c.prev, d = v, g = c.next != null ? c.next : h, y = !1, p = void 0, m = 1e-6;
8262 d && (k(d.pfValue) && k(g.pfValue) ? (y = g.pfValue - d.pfValue, p = d.pfValue + m * y) : k(d.value) && k(g.value) ? (y = g.value - d.value, p = d.value + m * y) : te(d.value) && te(g.value) && (y = d.value[0] !== g.value[0] || d.value[1] !== g.value[1] || d.value[2] !== g.value[2], p = d.strValue), y && (o[f] = g.strValue, this.applyBypass(t, f, p), l = !0));
8263 }
8264 }
8265 if (!l)
8266 return;
8267 a.transitioning = !0, new ia(function(b) {
8268 s > 0 ? t.delayAnimation(s).play().promise().then(b) : b();
8269 }).then(function() {
8270 return t.animation({
8271 style: o,
8272 duration: i,
8273 easing: t.pstyle("transition-timing-function").value,
8274 queue: !1
8275 }).play().promise();
8276 }).then(function() {
8277 r.removeBypasses(t, n), t.emitAndNotify("style"), a.transitioning = !1;
8278 });
8279 } else
8280 a.transitioning && (this.removeBypasses(t, n), t.emitAndNotify("style"), a.transitioning = !1);
8281 }, Bt.checkTrigger = function(t, e, r, a, n, i) {
8282 var s = this.properties[e], o = n(s);
8283 o != null && o(r, a) && i(s);
8284 }, Bt.checkZOrderTrigger = function(t, e, r, a) {
8285 var n = this;
8286 this.checkTrigger(t, e, r, a, function(i) {
8287 return i.triggersZOrder;
8288 }, function() {
8289 n._private.cy.notify("zorder", t);
8290 });
8291 }, Bt.checkBoundsTrigger = function(t, e, r, a) {
8292 this.checkTrigger(t, e, r, a, function(n) {
8293 return n.triggersBounds;
8294 }, function(n) {
8295 t.dirtyCompoundBoundsCache(), t.dirtyBoundingBoxCache(), // only for beziers -- so performance of other edges isn't affected
8296 n.triggersBoundsOfParallelBeziers && (e === "curve-style" && (r === "bezier" || a === "bezier") || e === "display" && (r === "none" || a === "none")) && t.parallelEdges().forEach(function(i) {
8297 i.isBundledBezier() && i.dirtyBoundingBoxCache();
8298 });
8299 });
8300 }, Bt.checkTriggers = function(t, e, r, a) {
8301 t.dirtyStyleCache(), this.checkZOrderTrigger(t, e, r, a), this.checkBoundsTrigger(t, e, r, a);
8302 };
8303 var Wa = {};
8304 Wa.applyBypass = function(t, e, r, a) {
8305 var n = this, i = [], s = !0;
8306 if (e === "*" || e === "**") {
8307 if (r !== void 0)
8308 for (var o = 0; o < n.properties.length; o++) {
8309 var l = n.properties[o], u = l.name, f = this.parse(u, r, !0);
8310 f && i.push(f);
8311 }
8312 } else if (j(e)) {
8313 var h = this.parse(e, r, !0);
8314 h && i.push(h);
8315 } else if (L(e)) {
8316 var c = e;
8317 a = r;
8318 for (var v = Object.keys(c), d = 0; d < v.length; d++) {
8319 var g = v[d], y = c[g];
8320 if (y === void 0 && (y = c[pt(g)]), y !== void 0) {
8321 var p = this.parse(g, y, !0);
8322 p && i.push(p);
8323 }
8324 }
8325 } else
8326 return !1;
8327 if (i.length === 0)
8328 return !1;
8329 for (var m = !1, b = 0; b < t.length; b++) {
8330 for (var E = t[b], M = {}, A = void 0, w = 0; w < i.length; w++) {
8331 var I = i[w];
8332 if (a) {
8333 var C = E.pstyle(I.name);
8334 A = M[I.name] = {
8335 prev: C
8336 };
8337 }
8338 m = this.applyParsedProperty(E, or(I)) || m, a && (A.next = E.pstyle(I.name));
8339 }
8340 m && this.updateStyleHints(E), a && this.updateTransitions(E, M, s);
8341 }
8342 return m;
8343 }, Wa.overrideBypass = function(t, e, r) {
8344 e = je(e);
8345 for (var a = 0; a < t.length; a++) {
8346 var n = t[a], i = n._private.style[e], s = this.properties[e].type, o = s.color, l = s.mutiple, u = i ? i.pfValue != null ? i.pfValue : i.value : null;
8347 !i || !i.bypass ? this.applyBypass(n, e, r) : (i.value = r, i.pfValue != null && (i.pfValue = r), o ? i.strValue = "rgb(" + r.join(",") + ")" : l ? i.strValue = r.join(" ") : i.strValue = "" + r, this.updateStyleHints(n)), this.checkTriggers(n, e, u, r);
8348 }
8349 }, Wa.removeAllBypasses = function(t, e) {
8350 return this.removeBypasses(t, this.propertyNames, e);
8351 }, Wa.removeBypasses = function(t, e, r) {
8352 for (var a = !0, n = 0; n < t.length; n++) {
8353 for (var i = t[n], s = {}, o = 0; o < e.length; o++) {
8354 var l = e[o], u = this.properties[l], f = i.pstyle(u.name);
8355 if (!(!f || !f.bypass)) {
8356 var h = "", c = this.parse(l, h, !0), v = s[u.name] = {
8357 prev: f
8358 };
8359 this.applyParsedProperty(i, c), v.next = i.pstyle(u.name);
8360 }
8361 }
8362 this.updateStyleHints(i), r && this.updateTransitions(i, s, a);
8363 }
8364 };
8365 var ki = {};
8366 ki.getEmSizeInPixels = function() {
8367 var t = this.containerCss("font-size");
8368 return t != null ? parseFloat(t) : 1;
8369 }, ki.containerCss = function(t) {
8370 var e = this._private.cy, r = e.container();
8371 if (D && r && D.getComputedStyle)
8372 return D.getComputedStyle(r).getPropertyValue(t);
8373 };
8374 var lr = {};
8375 lr.getRenderedStyle = function(t, e) {
8376 return e ? this.getStylePropertyValue(t, e, !0) : this.getRawStyle(t, !0);
8377 }, lr.getRawStyle = function(t, e) {
8378 var r = this;
8379 if (t = t[0], t) {
8380 for (var a = {}, n = 0; n < r.properties.length; n++) {
8381 var i = r.properties[n], s = r.getStylePropertyValue(t, i.name, e);
8382 s != null && (a[i.name] = s, a[pt(i.name)] = s);
8383 }
8384 return a;
8385 }
8386 }, lr.getIndexedStyle = function(t, e, r, a) {
8387 var n = t.pstyle(e)[r][a];
8388 return n ?? t.cy().style().getDefaultProperty(e)[r][0];
8389 }, lr.getStylePropertyValue = function(t, e, r) {
8390 var a = this;
8391 if (t = t[0], t) {
8392 var n = a.properties[e];
8393 n.alias && (n = n.pointsTo);
8394 var i = n.type, s = t.pstyle(n.name);
8395 if (s) {
8396 var o = s.value, l = s.units, u = s.strValue;
8397 if (r && i.number && o != null && k(o)) {
8398 var f = t.cy().zoom(), h = function(y) {
8399 return y * f;
8400 }, c = function(y, p) {
8401 return h(y) + p;
8402 }, v = te(o), d = v ? l.every(function(g) {
8403 return g != null;
8404 }) : l != null;
8405 return d ? v ? o.map(function(g, y) {
8406 return c(g, l[y]);
8407 }).join(" ") : c(o, l) : v ? o.map(function(g) {
8408 return j(g) ? g : "" + h(g);
8409 }).join(" ") : "" + h(o);
8410 } else if (u != null)
8411 return u;
8412 }
8413 return null;
8414 }
8415 }, lr.getAnimationStartStyle = function(t, e) {
8416 for (var r = {}, a = 0; a < e.length; a++) {
8417 var n = e[a], i = n.name, s = t.pstyle(i);
8418 s !== void 0 && (L(s) ? s = this.parse(i, s.strValue) : s = this.parse(i, s)), s && (r[i] = s);
8419 }
8420 return r;
8421 }, lr.getPropsList = function(t) {
8422 var e = this, r = [], a = t, n = e.properties;
8423 if (a)
8424 for (var i = Object.keys(a), s = 0; s < i.length; s++) {
8425 var o = i[s], l = a[o], u = n[o] || n[je(o)], f = this.parse(u.name, l);
8426 f && r.push(f);
8427 }
8428 return r;
8429 }, lr.getNonDefaultPropertiesHash = function(t, e, r) {
8430 var a = r.slice(), n, i, s, o, l, u;
8431 for (l = 0; l < e.length; l++)
8432 if (n = e[l], i = t.pstyle(n, !1), i != null)
8433 if (i.pfValue != null)
8434 a[0] = Na(o, a[0]), a[1] = Ma(o, a[1]);
8435 else
8436 for (s = i.strValue, u = 0; u < s.length; u++)
8437 o = s.charCodeAt(u), a[0] = Na(o, a[0]), a[1] = Ma(o, a[1]);
8438 return a;
8439 }, lr.getPropertiesHash = lr.getNonDefaultPropertiesHash;
8440 var $n = {};
8441 $n.appendFromJson = function(t) {
8442 for (var e = this, r = 0; r < t.length; r++) {
8443 var a = t[r], n = a.selector, i = a.style || a.css, s = Object.keys(i);
8444 e.selector(n);
8445 for (var o = 0; o < s.length; o++) {
8446 var l = s[o], u = i[l];
8447 e.css(l, u);
8448 }
8449 }
8450 return e;
8451 }, $n.fromJson = function(t) {
8452 var e = this;
8453 return e.resetToDefault(), e.appendFromJson(t), e;
8454 }, $n.json = function() {
8455 for (var t = [], e = this.defaultLength; e < this.length; e++) {
8456 for (var r = this[e], a = r.selector, n = r.properties, i = {}, s = 0; s < n.length; s++) {
8457 var o = n[s];
8458 i[o.name] = o.strValue;
8459 }
8460 t.push({
8461 selector: a ? a.toString() : "core",
8462 style: i
8463 });
8464 }
8465 return t;
8466 };
8467 var Pi = {};
8468 Pi.appendFromString = function(t) {
8469 var e = this, r = this, a = "" + t, n, i, s;
8470 a = a.replace(/[/][*](\s|.)+?[*][/]/g, "");
8471 function o() {
8472 a.length > n.length ? a = a.substr(n.length) : a = "";
8473 }
8474 function l() {
8475 i.length > s.length ? i = i.substr(s.length) : i = "";
8476 }
8477 for (; ; ) {
8478 var u = a.match(/^\s*$/);
8479 if (u)
8480 break;
8481 var f = a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);
8482 if (!f) {
8483 ft("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + a);
8484 break;
8485 }
8486 n = f[0];
8487 var h = f[1];
8488 if (h !== "core") {
8489 var c = new Dr(h);
8490 if (c.invalid) {
8491 ft("Skipping parsing of block: Invalid selector found in string stylesheet: " + h), o();
8492 continue;
8493 }
8494 }
8495 var v = f[2], d = !1;
8496 i = v;
8497 for (var g = []; ; ) {
8498 var y = i.match(/^\s*$/);
8499 if (y)
8500 break;
8501 var p = i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);
8502 if (!p) {
8503 ft("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + v), d = !0;
8504 break;
8505 }
8506 s = p[0];
8507 var m = p[1], b = p[2], E = e.properties[m];
8508 if (!E) {
8509 ft("Skipping property: Invalid property name in: " + s), l();
8510 continue;
8511 }
8512 var M = r.parse(m, b);
8513 if (!M) {
8514 ft("Skipping property: Invalid property definition in: " + s), l();
8515 continue;
8516 }
8517 g.push({
8518 name: m,
8519 val: b
8520 }), l();
8521 }
8522 if (d) {
8523 o();
8524 break;
8525 }
8526 r.selector(h);
8527 for (var A = 0; A < g.length; A++) {
8528 var w = g[A];
8529 r.css(w.name, w.val);
8530 }
8531 o();
8532 }
8533 return r;
8534 }, Pi.fromString = function(t) {
8535 var e = this;
8536 return e.resetToDefault(), e.appendFromString(t), e;
8537 };
8538 var Nt = {};
8539 (function() {
8540 var t = vt, e = qt, r = Kr, a = Da, n = jt, i = function(xe) {
8541 return "^" + xe + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$";
8542 }, s = function(xe) {
8543 var Ce = t + "|\\w+|" + e + "|" + r + "|" + a + "|" + n;
8544 return "^" + xe + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + t + ")\\s*\\,\\s*(" + t + ")\\s*,\\s*(" + Ce + ")\\s*\\,\\s*(" + Ce + ")\\)$";
8545 }, o = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"];
8546 Nt.types = {
8547 time: {
8548 number: !0,
8549 min: 0,
8550 units: "s|ms",
8551 implicitUnits: "ms"
8552 },
8553 percent: {
8554 number: !0,
8555 min: 0,
8556 max: 100,
8557 units: "%",
8558 implicitUnits: "%"
8559 },
8560 percentages: {
8561 number: !0,
8562 min: 0,
8563 max: 100,
8564 units: "%",
8565 implicitUnits: "%",
8566 multiple: !0
8567 },
8568 zeroOneNumber: {
8569 number: !0,
8570 min: 0,
8571 max: 1,
8572 unitless: !0
8573 },
8574 zeroOneNumbers: {
8575 number: !0,
8576 min: 0,
8577 max: 1,
8578 unitless: !0,
8579 multiple: !0
8580 },
8581 nOneOneNumber: {
8582 number: !0,
8583 min: -1,
8584 max: 1,
8585 unitless: !0
8586 },
8587 nonNegativeInt: {
8588 number: !0,
8589 min: 0,
8590 integer: !0,
8591 unitless: !0
8592 },
8593 position: {
8594 enums: ["parent", "origin"]
8595 },
8596 nodeSize: {
8597 number: !0,
8598 min: 0,
8599 enums: ["label"]
8600 },
8601 number: {
8602 number: !0,
8603 unitless: !0
8604 },
8605 numbers: {
8606 number: !0,
8607 unitless: !0,
8608 multiple: !0
8609 },
8610 positiveNumber: {
8611 number: !0,
8612 unitless: !0,
8613 min: 0,
8614 strictMin: !0
8615 },
8616 size: {
8617 number: !0,
8618 min: 0
8619 },
8620 bidirectionalSize: {
8621 number: !0
8622 },
8623 // allows negative
8624 bidirectionalSizeMaybePercent: {
8625 number: !0,
8626 allowPercent: !0
8627 },
8628 // allows negative
8629 bidirectionalSizes: {
8630 number: !0,
8631 multiple: !0
8632 },
8633 // allows negative
8634 sizeMaybePercent: {
8635 number: !0,
8636 min: 0,
8637 allowPercent: !0
8638 },
8639 axisDirection: {
8640 enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"]
8641 },
8642 paddingRelativeTo: {
8643 enums: ["width", "height", "average", "min", "max"]
8644 },
8645 bgWH: {
8646 number: !0,
8647 min: 0,
8648 allowPercent: !0,
8649 enums: ["auto"],
8650 multiple: !0
8651 },
8652 bgPos: {
8653 number: !0,
8654 allowPercent: !0,
8655 multiple: !0
8656 },
8657 bgRelativeTo: {
8658 enums: ["inner", "include-padding"],
8659 multiple: !0
8660 },
8661 bgRepeat: {
8662 enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"],
8663 multiple: !0
8664 },
8665 bgFit: {
8666 enums: ["none", "contain", "cover"],
8667 multiple: !0
8668 },
8669 bgCrossOrigin: {
8670 enums: ["anonymous", "use-credentials"],
8671 multiple: !0
8672 },
8673 bgClip: {
8674 enums: ["none", "node"],
8675 multiple: !0
8676 },
8677 bgContainment: {
8678 enums: ["inside", "over"],
8679 multiple: !0
8680 },
8681 color: {
8682 color: !0
8683 },
8684 colors: {
8685 color: !0,
8686 multiple: !0
8687 },
8688 fill: {
8689 enums: ["solid", "linear-gradient", "radial-gradient"]
8690 },
8691 bool: {
8692 enums: ["yes", "no"]
8693 },
8694 bools: {
8695 enums: ["yes", "no"],
8696 multiple: !0
8697 },
8698 lineStyle: {
8699 enums: ["solid", "dotted", "dashed"]
8700 },
8701 lineCap: {
8702 enums: ["butt", "round", "square"]
8703 },
8704 borderStyle: {
8705 enums: ["solid", "dotted", "dashed", "double"]
8706 },
8707 curveStyle: {
8708 enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi"]
8709 },
8710 fontFamily: {
8711 regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'
8712 },
8713 fontStyle: {
8714 enums: ["italic", "normal", "oblique"]
8715 },
8716 fontWeight: {
8717 enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900]
8718 },
8719 textDecoration: {
8720 enums: ["none", "underline", "overline", "line-through"]
8721 },
8722 textTransform: {
8723 enums: ["none", "uppercase", "lowercase"]
8724 },
8725 textWrap: {
8726 enums: ["none", "wrap", "ellipsis"]
8727 },
8728 textOverflowWrap: {
8729 enums: ["whitespace", "anywhere"]
8730 },
8731 textBackgroundShape: {
8732 enums: ["rectangle", "roundrectangle", "round-rectangle"]
8733 },
8734 nodeShape: {
8735 enums: ["rectangle", "roundrectangle", "round-rectangle", "cutrectangle", "cut-rectangle", "bottomroundrectangle", "bottom-round-rectangle", "barrel", "ellipse", "triangle", "round-triangle", "square", "pentagon", "round-pentagon", "hexagon", "round-hexagon", "concavehexagon", "concave-hexagon", "heptagon", "round-heptagon", "octagon", "round-octagon", "tag", "round-tag", "star", "diamond", "round-diamond", "vee", "rhomboid", "polygon"]
8736 },
8737 overlayShape: {
8738 enums: ["roundrectangle", "round-rectangle", "ellipse"]
8739 },
8740 compoundIncludeLabels: {
8741 enums: ["include", "exclude"]
8742 },
8743 arrowShape: {
8744 enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"]
8745 },
8746 arrowFill: {
8747 enums: ["filled", "hollow"]
8748 },
8749 display: {
8750 enums: ["element", "none"]
8751 },
8752 visibility: {
8753 enums: ["hidden", "visible"]
8754 },
8755 zCompoundDepth: {
8756 enums: ["bottom", "orphan", "auto", "top"]
8757 },
8758 zIndexCompare: {
8759 enums: ["auto", "manual"]
8760 },
8761 valign: {
8762 enums: ["top", "center", "bottom"]
8763 },
8764 halign: {
8765 enums: ["left", "center", "right"]
8766 },
8767 justification: {
8768 enums: ["left", "center", "right", "auto"]
8769 },
8770 text: {
8771 string: !0
8772 },
8773 data: {
8774 mapping: !0,
8775 regex: i("data")
8776 },
8777 layoutData: {
8778 mapping: !0,
8779 regex: i("layoutData")
8780 },
8781 scratch: {
8782 mapping: !0,
8783 regex: i("scratch")
8784 },
8785 mapData: {
8786 mapping: !0,
8787 regex: s("mapData")
8788 },
8789 mapLayoutData: {
8790 mapping: !0,
8791 regex: s("mapLayoutData")
8792 },
8793 mapScratch: {
8794 mapping: !0,
8795 regex: s("mapScratch")
8796 },
8797 fn: {
8798 mapping: !0,
8799 fn: !0
8800 },
8801 url: {
8802 regexes: o,
8803 singleRegexMatchValue: !0
8804 },
8805 urls: {
8806 regexes: o,
8807 singleRegexMatchValue: !0,
8808 multiple: !0
8809 },
8810 propList: {
8811 propList: !0
8812 },
8813 angle: {
8814 number: !0,
8815 units: "deg|rad",
8816 implicitUnits: "rad"
8817 },
8818 textRotation: {
8819 number: !0,
8820 units: "deg|rad",
8821 implicitUnits: "rad",
8822 enums: ["none", "autorotate"]
8823 },
8824 polygonPointList: {
8825 number: !0,
8826 multiple: !0,
8827 evenMultiple: !0,
8828 min: -1,
8829 max: 1,
8830 unitless: !0
8831 },
8832 edgeDistances: {
8833 enums: ["intersection", "node-position"]
8834 },
8835 edgeEndpoint: {
8836 number: !0,
8837 multiple: !0,
8838 units: "%|px|em|deg|rad",
8839 implicitUnits: "px",
8840 enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"],
8841 singleEnum: !0,
8842 validate: function(xe, Ce) {
8843 switch (xe.length) {
8844 case 2:
8845 return Ce[0] !== "deg" && Ce[0] !== "rad" && Ce[1] !== "deg" && Ce[1] !== "rad";
8846 case 1:
8847 return j(xe[0]) || Ce[0] === "deg" || Ce[0] === "rad";
8848 default:
8849 return !1;
8850 }
8851 }
8852 },
8853 easing: {
8854 regexes: ["^(spring)\\s*\\(\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*\\)$"],
8855 enums: ["linear", "ease", "ease-in", "ease-out", "ease-in-out", "ease-in-sine", "ease-out-sine", "ease-in-out-sine", "ease-in-quad", "ease-out-quad", "ease-in-out-quad", "ease-in-cubic", "ease-out-cubic", "ease-in-out-cubic", "ease-in-quart", "ease-out-quart", "ease-in-out-quart", "ease-in-quint", "ease-out-quint", "ease-in-out-quint", "ease-in-expo", "ease-out-expo", "ease-in-out-expo", "ease-in-circ", "ease-out-circ", "ease-in-out-circ"]
8856 },
8857 gradientDirection: {
8858 enums: [
8859 "to-bottom",
8860 "to-top",
8861 "to-left",
8862 "to-right",
8863 "to-bottom-right",
8864 "to-bottom-left",
8865 "to-top-right",
8866 "to-top-left",
8867 "to-right-bottom",
8868 "to-left-bottom",
8869 "to-right-top",
8870 "to-left-top"
8871 // different order
8872 ]
8873 },
8874 boundsExpansion: {
8875 number: !0,
8876 multiple: !0,
8877 min: 0,
8878 validate: function(xe) {
8879 var Ce = xe.length;
8880 return Ce === 1 || Ce === 2 || Ce === 4;
8881 }
8882 }
8883 };
8884 var l = {
8885 zeroNonZero: function(xe, Ce) {
8886 return (xe == null || Ce == null) && xe !== Ce || xe == 0 && Ce != 0 ? !0 : xe != 0 && Ce == 0;
8887 },
8888 any: function(xe, Ce) {
8889 return xe != Ce;
8890 },
8891 emptyNonEmpty: function(xe, Ce) {
8892 var Oe = Pe(xe), Ie = Pe(Ce);
8893 return Oe && !Ie || !Oe && Ie;
8894 }
8895 }, u = Nt.types, f = [{
8896 name: "label",
8897 type: u.text,
8898 triggersBounds: l.any,
8899 triggersZOrder: l.emptyNonEmpty
8900 }, {
8901 name: "text-rotation",
8902 type: u.textRotation,
8903 triggersBounds: l.any
8904 }, {
8905 name: "text-margin-x",
8906 type: u.bidirectionalSize,
8907 triggersBounds: l.any
8908 }, {
8909 name: "text-margin-y",
8910 type: u.bidirectionalSize,
8911 triggersBounds: l.any
8912 }], h = [{
8913 name: "source-label",
8914 type: u.text,
8915 triggersBounds: l.any
8916 }, {
8917 name: "source-text-rotation",
8918 type: u.textRotation,
8919 triggersBounds: l.any
8920 }, {
8921 name: "source-text-margin-x",
8922 type: u.bidirectionalSize,
8923 triggersBounds: l.any
8924 }, {
8925 name: "source-text-margin-y",
8926 type: u.bidirectionalSize,
8927 triggersBounds: l.any
8928 }, {
8929 name: "source-text-offset",
8930 type: u.size,
8931 triggersBounds: l.any
8932 }], c = [{
8933 name: "target-label",
8934 type: u.text,
8935 triggersBounds: l.any
8936 }, {
8937 name: "target-text-rotation",
8938 type: u.textRotation,
8939 triggersBounds: l.any
8940 }, {
8941 name: "target-text-margin-x",
8942 type: u.bidirectionalSize,
8943 triggersBounds: l.any
8944 }, {
8945 name: "target-text-margin-y",
8946 type: u.bidirectionalSize,
8947 triggersBounds: l.any
8948 }, {
8949 name: "target-text-offset",
8950 type: u.size,
8951 triggersBounds: l.any
8952 }], v = [{
8953 name: "font-family",
8954 type: u.fontFamily,
8955 triggersBounds: l.any
8956 }, {
8957 name: "font-style",
8958 type: u.fontStyle,
8959 triggersBounds: l.any
8960 }, {
8961 name: "font-weight",
8962 type: u.fontWeight,
8963 triggersBounds: l.any
8964 }, {
8965 name: "font-size",
8966 type: u.size,
8967 triggersBounds: l.any
8968 }, {
8969 name: "text-transform",
8970 type: u.textTransform,
8971 triggersBounds: l.any
8972 }, {
8973 name: "text-wrap",
8974 type: u.textWrap,
8975 triggersBounds: l.any
8976 }, {
8977 name: "text-overflow-wrap",
8978 type: u.textOverflowWrap,
8979 triggersBounds: l.any
8980 }, {
8981 name: "text-max-width",
8982 type: u.size,
8983 triggersBounds: l.any
8984 }, {
8985 name: "text-outline-width",
8986 type: u.size,
8987 triggersBounds: l.any
8988 }, {
8989 name: "line-height",
8990 type: u.positiveNumber,
8991 triggersBounds: l.any
8992 }], d = [{
8993 name: "text-valign",
8994 type: u.valign,
8995 triggersBounds: l.any
8996 }, {
8997 name: "text-halign",
8998 type: u.halign,
8999 triggersBounds: l.any
9000 }, {
9001 name: "color",
9002 type: u.color
9003 }, {
9004 name: "text-outline-color",
9005 type: u.color
9006 }, {
9007 name: "text-outline-opacity",
9008 type: u.zeroOneNumber
9009 }, {
9010 name: "text-background-color",
9011 type: u.color
9012 }, {
9013 name: "text-background-opacity",
9014 type: u.zeroOneNumber
9015 }, {
9016 name: "text-background-padding",
9017 type: u.size,
9018 triggersBounds: l.any
9019 }, {
9020 name: "text-border-opacity",
9021 type: u.zeroOneNumber
9022 }, {
9023 name: "text-border-color",
9024 type: u.color
9025 }, {
9026 name: "text-border-width",
9027 type: u.size,
9028 triggersBounds: l.any
9029 }, {
9030 name: "text-border-style",
9031 type: u.borderStyle,
9032 triggersBounds: l.any
9033 }, {
9034 name: "text-background-shape",
9035 type: u.textBackgroundShape,
9036 triggersBounds: l.any
9037 }, {
9038 name: "text-justification",
9039 type: u.justification
9040 }], g = [{
9041 name: "events",
9042 type: u.bool
9043 }, {
9044 name: "text-events",
9045 type: u.bool
9046 }], y = [{
9047 name: "display",
9048 type: u.display,
9049 triggersZOrder: l.any,
9050 triggersBounds: l.any,
9051 triggersBoundsOfParallelBeziers: !0
9052 }, {
9053 name: "visibility",
9054 type: u.visibility,
9055 triggersZOrder: l.any
9056 }, {
9057 name: "opacity",
9058 type: u.zeroOneNumber,
9059 triggersZOrder: l.zeroNonZero
9060 }, {
9061 name: "text-opacity",
9062 type: u.zeroOneNumber
9063 }, {
9064 name: "min-zoomed-font-size",
9065 type: u.size
9066 }, {
9067 name: "z-compound-depth",
9068 type: u.zCompoundDepth,
9069 triggersZOrder: l.any
9070 }, {
9071 name: "z-index-compare",
9072 type: u.zIndexCompare,
9073 triggersZOrder: l.any
9074 }, {
9075 name: "z-index",
9076 type: u.nonNegativeInt,
9077 triggersZOrder: l.any
9078 }], p = [{
9079 name: "overlay-padding",
9080 type: u.size,
9081 triggersBounds: l.any
9082 }, {
9083 name: "overlay-color",
9084 type: u.color
9085 }, {
9086 name: "overlay-opacity",
9087 type: u.zeroOneNumber,
9088 triggersBounds: l.zeroNonZero
9089 }, {
9090 name: "overlay-shape",
9091 type: u.overlayShape,
9092 triggersBounds: l.any
9093 }], m = [{
9094 name: "underlay-padding",
9095 type: u.size,
9096 triggersBounds: l.any
9097 }, {
9098 name: "underlay-color",
9099 type: u.color
9100 }, {
9101 name: "underlay-opacity",
9102 type: u.zeroOneNumber,
9103 triggersBounds: l.zeroNonZero
9104 }, {
9105 name: "underlay-shape",
9106 type: u.overlayShape,
9107 triggersBounds: l.any
9108 }], b = [{
9109 name: "transition-property",
9110 type: u.propList
9111 }, {
9112 name: "transition-duration",
9113 type: u.time
9114 }, {
9115 name: "transition-delay",
9116 type: u.time
9117 }, {
9118 name: "transition-timing-function",
9119 type: u.easing
9120 }], E = function(xe, Ce) {
9121 return Ce.value === "label" ? -xe.poolIndex() : Ce.pfValue;
9122 }, M = [{
9123 name: "height",
9124 type: u.nodeSize,
9125 triggersBounds: l.any,
9126 hashOverride: E
9127 }, {
9128 name: "width",
9129 type: u.nodeSize,
9130 triggersBounds: l.any,
9131 hashOverride: E
9132 }, {
9133 name: "shape",
9134 type: u.nodeShape,
9135 triggersBounds: l.any
9136 }, {
9137 name: "shape-polygon-points",
9138 type: u.polygonPointList,
9139 triggersBounds: l.any
9140 }, {
9141 name: "background-color",
9142 type: u.color
9143 }, {
9144 name: "background-fill",
9145 type: u.fill
9146 }, {
9147 name: "background-opacity",
9148 type: u.zeroOneNumber
9149 }, {
9150 name: "background-blacken",
9151 type: u.nOneOneNumber
9152 }, {
9153 name: "background-gradient-stop-colors",
9154 type: u.colors
9155 }, {
9156 name: "background-gradient-stop-positions",
9157 type: u.percentages
9158 }, {
9159 name: "background-gradient-direction",
9160 type: u.gradientDirection
9161 }, {
9162 name: "padding",
9163 type: u.sizeMaybePercent,
9164 triggersBounds: l.any
9165 }, {
9166 name: "padding-relative-to",
9167 type: u.paddingRelativeTo,
9168 triggersBounds: l.any
9169 }, {
9170 name: "bounds-expansion",
9171 type: u.boundsExpansion,
9172 triggersBounds: l.any
9173 }], A = [{
9174 name: "border-color",
9175 type: u.color
9176 }, {
9177 name: "border-opacity",
9178 type: u.zeroOneNumber
9179 }, {
9180 name: "border-width",
9181 type: u.size,
9182 triggersBounds: l.any
9183 }, {
9184 name: "border-style",
9185 type: u.borderStyle
9186 }], w = [{
9187 name: "background-image",
9188 type: u.urls
9189 }, {
9190 name: "background-image-crossorigin",
9191 type: u.bgCrossOrigin
9192 }, {
9193 name: "background-image-opacity",
9194 type: u.zeroOneNumbers
9195 }, {
9196 name: "background-image-containment",
9197 type: u.bgContainment
9198 }, {
9199 name: "background-image-smoothing",
9200 type: u.bools
9201 }, {
9202 name: "background-position-x",
9203 type: u.bgPos
9204 }, {
9205 name: "background-position-y",
9206 type: u.bgPos
9207 }, {
9208 name: "background-width-relative-to",
9209 type: u.bgRelativeTo
9210 }, {
9211 name: "background-height-relative-to",
9212 type: u.bgRelativeTo
9213 }, {
9214 name: "background-repeat",
9215 type: u.bgRepeat
9216 }, {
9217 name: "background-fit",
9218 type: u.bgFit
9219 }, {
9220 name: "background-clip",
9221 type: u.bgClip
9222 }, {
9223 name: "background-width",
9224 type: u.bgWH
9225 }, {
9226 name: "background-height",
9227 type: u.bgWH
9228 }, {
9229 name: "background-offset-x",
9230 type: u.bgPos
9231 }, {
9232 name: "background-offset-y",
9233 type: u.bgPos
9234 }], I = [{
9235 name: "position",
9236 type: u.position,
9237 triggersBounds: l.any
9238 }, {
9239 name: "compound-sizing-wrt-labels",
9240 type: u.compoundIncludeLabels,
9241 triggersBounds: l.any
9242 }, {
9243 name: "min-width",
9244 type: u.size,
9245 triggersBounds: l.any
9246 }, {
9247 name: "min-width-bias-left",
9248 type: u.sizeMaybePercent,
9249 triggersBounds: l.any
9250 }, {
9251 name: "min-width-bias-right",
9252 type: u.sizeMaybePercent,
9253 triggersBounds: l.any
9254 }, {
9255 name: "min-height",
9256 type: u.size,
9257 triggersBounds: l.any
9258 }, {
9259 name: "min-height-bias-top",
9260 type: u.sizeMaybePercent,
9261 triggersBounds: l.any
9262 }, {
9263 name: "min-height-bias-bottom",
9264 type: u.sizeMaybePercent,
9265 triggersBounds: l.any
9266 }], C = [{
9267 name: "line-style",
9268 type: u.lineStyle
9269 }, {
9270 name: "line-color",
9271 type: u.color
9272 }, {
9273 name: "line-fill",
9274 type: u.fill
9275 }, {
9276 name: "line-cap",
9277 type: u.lineCap
9278 }, {
9279 name: "line-opacity",
9280 type: u.zeroOneNumber
9281 }, {
9282 name: "line-dash-pattern",
9283 type: u.numbers
9284 }, {
9285 name: "line-dash-offset",
9286 type: u.number
9287 }, {
9288 name: "line-gradient-stop-colors",
9289 type: u.colors
9290 }, {
9291 name: "line-gradient-stop-positions",
9292 type: u.percentages
9293 }, {
9294 name: "curve-style",
9295 type: u.curveStyle,
9296 triggersBounds: l.any,
9297 triggersBoundsOfParallelBeziers: !0
9298 }, {
9299 name: "haystack-radius",
9300 type: u.zeroOneNumber,
9301 triggersBounds: l.any
9302 }, {
9303 name: "source-endpoint",
9304 type: u.edgeEndpoint,
9305 triggersBounds: l.any
9306 }, {
9307 name: "target-endpoint",
9308 type: u.edgeEndpoint,
9309 triggersBounds: l.any
9310 }, {
9311 name: "control-point-step-size",
9312 type: u.size,
9313 triggersBounds: l.any
9314 }, {
9315 name: "control-point-distances",
9316 type: u.bidirectionalSizes,
9317 triggersBounds: l.any
9318 }, {
9319 name: "control-point-weights",
9320 type: u.numbers,
9321 triggersBounds: l.any
9322 }, {
9323 name: "segment-distances",
9324 type: u.bidirectionalSizes,
9325 triggersBounds: l.any
9326 }, {
9327 name: "segment-weights",
9328 type: u.numbers,
9329 triggersBounds: l.any
9330 }, {
9331 name: "taxi-turn",
9332 type: u.bidirectionalSizeMaybePercent,
9333 triggersBounds: l.any
9334 }, {
9335 name: "taxi-turn-min-distance",
9336 type: u.size,
9337 triggersBounds: l.any
9338 }, {
9339 name: "taxi-direction",
9340 type: u.axisDirection,
9341 triggersBounds: l.any
9342 }, {
9343 name: "edge-distances",
9344 type: u.edgeDistances,
9345 triggersBounds: l.any
9346 }, {
9347 name: "arrow-scale",
9348 type: u.positiveNumber,
9349 triggersBounds: l.any
9350 }, {
9351 name: "loop-direction",
9352 type: u.angle,
9353 triggersBounds: l.any
9354 }, {
9355 name: "loop-sweep",
9356 type: u.angle,
9357 triggersBounds: l.any
9358 }, {
9359 name: "source-distance-from-node",
9360 type: u.size,
9361 triggersBounds: l.any
9362 }, {
9363 name: "target-distance-from-node",
9364 type: u.size,
9365 triggersBounds: l.any
9366 }], B = [{
9367 name: "ghost",
9368 type: u.bool,
9369 triggersBounds: l.any
9370 }, {
9371 name: "ghost-offset-x",
9372 type: u.bidirectionalSize,
9373 triggersBounds: l.any
9374 }, {
9375 name: "ghost-offset-y",
9376 type: u.bidirectionalSize,
9377 triggersBounds: l.any
9378 }, {
9379 name: "ghost-opacity",
9380 type: u.zeroOneNumber
9381 }], F = [{
9382 name: "selection-box-color",
9383 type: u.color
9384 }, {
9385 name: "selection-box-opacity",
9386 type: u.zeroOneNumber
9387 }, {
9388 name: "selection-box-border-color",
9389 type: u.color
9390 }, {
9391 name: "selection-box-border-width",
9392 type: u.size
9393 }, {
9394 name: "active-bg-color",
9395 type: u.color
9396 }, {
9397 name: "active-bg-opacity",
9398 type: u.zeroOneNumber
9399 }, {
9400 name: "active-bg-size",
9401 type: u.size
9402 }, {
9403 name: "outside-texture-bg-color",
9404 type: u.color
9405 }, {
9406 name: "outside-texture-bg-opacity",
9407 type: u.zeroOneNumber
9408 }], R = [];
9409 Nt.pieBackgroundN = 16, R.push({
9410 name: "pie-size",
9411 type: u.sizeMaybePercent
9412 });
9413 for (var X = 1; X <= Nt.pieBackgroundN; X++)
9414 R.push({
9415 name: "pie-" + X + "-background-color",
9416 type: u.color
9417 }), R.push({
9418 name: "pie-" + X + "-background-size",
9419 type: u.percent
9420 }), R.push({
9421 name: "pie-" + X + "-background-opacity",
9422 type: u.zeroOneNumber
9423 });
9424 var z = [], re = Nt.arrowPrefixes = ["source", "mid-source", "target", "mid-target"];
9425 [{
9426 name: "arrow-shape",
9427 type: u.arrowShape,
9428 triggersBounds: l.any
9429 }, {
9430 name: "arrow-color",
9431 type: u.color
9432 }, {
9433 name: "arrow-fill",
9434 type: u.arrowFill
9435 }].forEach(function(ae) {
9436 re.forEach(function(xe) {
9437 var Ce = xe + "-" + ae.name, Oe = ae.type, Ie = ae.triggersBounds;
9438 z.push({
9439 name: Ce,
9440 type: Oe,
9441 triggersBounds: Ie
9442 });
9443 });
9444 }, {});
9445 var W = Nt.properties = [].concat(g, b, y, p, m, B, d, v, f, h, c, M, A, w, R, I, C, z, F), Z = Nt.propertyGroups = {
9446 // common to all eles
9447 behavior: g,
9448 transition: b,
9449 visibility: y,
9450 overlay: p,
9451 underlay: m,
9452 ghost: B,
9453 // labels
9454 commonLabel: d,
9455 labelDimensions: v,
9456 mainLabel: f,
9457 sourceLabel: h,
9458 targetLabel: c,
9459 // node props
9460 nodeBody: M,
9461 nodeBorder: A,
9462 backgroundImage: w,
9463 pie: R,
9464 compound: I,
9465 // edge props
9466 edgeLine: C,
9467 edgeArrow: z,
9468 core: F
9469 }, ie = Nt.propertyGroupNames = {}, oe = Nt.propertyGroupKeys = Object.keys(Z);
9470 oe.forEach(function(ae) {
9471 ie[ae] = Z[ae].map(function(xe) {
9472 return xe.name;
9473 }), Z[ae].forEach(function(xe) {
9474 return xe.groupKey = ae;
9475 });
9476 });
9477 var ge = Nt.aliases = [{
9478 name: "content",
9479 pointsTo: "label"
9480 }, {
9481 name: "control-point-distance",
9482 pointsTo: "control-point-distances"
9483 }, {
9484 name: "control-point-weight",
9485 pointsTo: "control-point-weights"
9486 }, {
9487 name: "edge-text-rotation",
9488 pointsTo: "text-rotation"
9489 }, {
9490 name: "padding-left",
9491 pointsTo: "padding"
9492 }, {
9493 name: "padding-right",
9494 pointsTo: "padding"
9495 }, {
9496 name: "padding-top",
9497 pointsTo: "padding"
9498 }, {
9499 name: "padding-bottom",
9500 pointsTo: "padding"
9501 }];
9502 Nt.propertyNames = W.map(function(ae) {
9503 return ae.name;
9504 });
9505 for (var se = 0; se < W.length; se++) {
9506 var de = W[se];
9507 W[de.name] = de;
9508 }
9509 for (var we = 0; we < ge.length; we++) {
9510 var Te = ge[we], Ee = W[Te.pointsTo], ye = {
9511 name: Te.name,
9512 alias: !0,
9513 pointsTo: Ee
9514 };
9515 W.push(ye), W[Te.name] = ye;
9516 }
9517 })(), Nt.getDefaultProperty = function(t) {
9518 return this.getDefaultProperties()[t];
9519 }, Nt.getDefaultProperties = function() {
9520 var t = this._private;
9521 if (t.defaultProperties != null)
9522 return t.defaultProperties;
9523 for (var e = Ue({
9524 // core props
9525 "selection-box-color": "#ddd",
9526 "selection-box-opacity": 0.65,
9527 "selection-box-border-color": "#aaa",
9528 "selection-box-border-width": 1,
9529 "active-bg-color": "black",
9530 "active-bg-opacity": 0.15,
9531 "active-bg-size": 30,
9532 "outside-texture-bg-color": "#000",
9533 "outside-texture-bg-opacity": 0.125,
9534 // common node/edge props
9535 events: "yes",
9536 "text-events": "no",
9537 "text-valign": "top",
9538 "text-halign": "center",
9539 "text-justification": "auto",
9540 "line-height": 1,
9541 color: "#000",
9542 "text-outline-color": "#000",
9543 "text-outline-width": 0,
9544 "text-outline-opacity": 1,
9545 "text-opacity": 1,
9546 "text-decoration": "none",
9547 "text-transform": "none",
9548 "text-wrap": "none",
9549 "text-overflow-wrap": "whitespace",
9550 "text-max-width": 9999,
9551 "text-background-color": "#000",
9552 "text-background-opacity": 0,
9553 "text-background-shape": "rectangle",
9554 "text-background-padding": 0,
9555 "text-border-opacity": 0,
9556 "text-border-width": 0,
9557 "text-border-style": "solid",
9558 "text-border-color": "#000",
9559 "font-family": "Helvetica Neue, Helvetica, sans-serif",
9560 "font-style": "normal",
9561 "font-weight": "normal",
9562 "font-size": 16,
9563 "min-zoomed-font-size": 0,
9564 "text-rotation": "none",
9565 "source-text-rotation": "none",
9566 "target-text-rotation": "none",
9567 visibility: "visible",
9568 display: "element",
9569 opacity: 1,
9570 "z-compound-depth": "auto",
9571 "z-index-compare": "auto",
9572 "z-index": 0,
9573 label: "",
9574 "text-margin-x": 0,
9575 "text-margin-y": 0,
9576 "source-label": "",
9577 "source-text-offset": 0,
9578 "source-text-margin-x": 0,
9579 "source-text-margin-y": 0,
9580 "target-label": "",
9581 "target-text-offset": 0,
9582 "target-text-margin-x": 0,
9583 "target-text-margin-y": 0,
9584 "overlay-opacity": 0,
9585 "overlay-color": "#000",
9586 "overlay-padding": 10,
9587 "overlay-shape": "round-rectangle",
9588 "underlay-opacity": 0,
9589 "underlay-color": "#000",
9590 "underlay-padding": 10,
9591 "underlay-shape": "round-rectangle",
9592 "transition-property": "none",
9593 "transition-duration": 0,
9594 "transition-delay": 0,
9595 "transition-timing-function": "linear",
9596 // node props
9597 "background-blacken": 0,
9598 "background-color": "#999",
9599 "background-fill": "solid",
9600 "background-opacity": 1,
9601 "background-image": "none",
9602 "background-image-crossorigin": "anonymous",
9603 "background-image-opacity": 1,
9604 "background-image-containment": "inside",
9605 "background-image-smoothing": "yes",
9606 "background-position-x": "50%",
9607 "background-position-y": "50%",
9608 "background-offset-x": 0,
9609 "background-offset-y": 0,
9610 "background-width-relative-to": "include-padding",
9611 "background-height-relative-to": "include-padding",
9612 "background-repeat": "no-repeat",
9613 "background-fit": "none",
9614 "background-clip": "node",
9615 "background-width": "auto",
9616 "background-height": "auto",
9617 "border-color": "#000",
9618 "border-opacity": 1,
9619 "border-width": 0,
9620 "border-style": "solid",
9621 height: 30,
9622 width: 30,
9623 shape: "ellipse",
9624 "shape-polygon-points": "-1, -1, 1, -1, 1, 1, -1, 1",
9625 "bounds-expansion": 0,
9626 // node gradient
9627 "background-gradient-direction": "to-bottom",
9628 "background-gradient-stop-colors": "#999",
9629 "background-gradient-stop-positions": "0%",
9630 // ghost props
9631 ghost: "no",
9632 "ghost-offset-y": 0,
9633 "ghost-offset-x": 0,
9634 "ghost-opacity": 0,
9635 // compound props
9636 padding: 0,
9637 "padding-relative-to": "width",
9638 position: "origin",
9639 "compound-sizing-wrt-labels": "include",
9640 "min-width": 0,
9641 "min-width-bias-left": 0,
9642 "min-width-bias-right": 0,
9643 "min-height": 0,
9644 "min-height-bias-top": 0,
9645 "min-height-bias-bottom": 0
9646 }, {
9647 // node pie bg
9648 "pie-size": "100%"
9649 }, [{
9650 name: "pie-{{i}}-background-color",
9651 value: "black"
9652 }, {
9653 name: "pie-{{i}}-background-size",
9654 value: "0%"
9655 }, {
9656 name: "pie-{{i}}-background-opacity",
9657 value: 1
9658 }].reduce(function(l, u) {
9659 for (var f = 1; f <= Nt.pieBackgroundN; f++) {
9660 var h = u.name.replace("{{i}}", f), c = u.value;
9661 l[h] = c;
9662 }
9663 return l;
9664 }, {}), {
9665 // edge props
9666 "line-style": "solid",
9667 "line-color": "#999",
9668 "line-fill": "solid",
9669 "line-cap": "butt",
9670 "line-opacity": 1,
9671 "line-gradient-stop-colors": "#999",
9672 "line-gradient-stop-positions": "0%",
9673 "control-point-step-size": 40,
9674 "control-point-weights": 0.5,
9675 "segment-weights": 0.5,
9676 "segment-distances": 20,
9677 "taxi-turn": "50%",
9678 "taxi-turn-min-distance": 10,
9679 "taxi-direction": "auto",
9680 "edge-distances": "intersection",
9681 "curve-style": "haystack",
9682 "haystack-radius": 0,
9683 "arrow-scale": 1,
9684 "loop-direction": "-45deg",
9685 "loop-sweep": "-90deg",
9686 "source-distance-from-node": 0,
9687 "target-distance-from-node": 0,
9688 "source-endpoint": "outside-to-node",
9689 "target-endpoint": "outside-to-node",
9690 "line-dash-pattern": [6, 3],
9691 "line-dash-offset": 0
9692 }, [{
9693 name: "arrow-shape",
9694 value: "none"
9695 }, {
9696 name: "arrow-color",
9697 value: "#999"
9698 }, {
9699 name: "arrow-fill",
9700 value: "filled"
9701 }].reduce(function(l, u) {
9702 return Nt.arrowPrefixes.forEach(function(f) {
9703 var h = f + "-" + u.name, c = u.value;
9704 l[h] = c;
9705 }), l;
9706 }, {})), r = {}, a = 0; a < this.properties.length; a++) {
9707 var n = this.properties[a];
9708 if (!n.pointsTo) {
9709 var i = n.name, s = e[i], o = this.parse(i, s);
9710 r[i] = o;
9711 }
9712 }
9713 return t.defaultProperties = r, t.defaultProperties;
9714 }, Nt.addDefaultStylesheet = function() {
9715 this.selector(":parent").css({
9716 shape: "rectangle",
9717 padding: 10,
9718 "background-color": "#eee",
9719 "border-color": "#ccc",
9720 "border-width": 1
9721 }).selector("edge").css({
9722 width: 3
9723 }).selector(":loop").css({
9724 "curve-style": "bezier"
9725 }).selector("edge:compound").css({
9726 "curve-style": "bezier",
9727 "source-endpoint": "outside-to-line",
9728 "target-endpoint": "outside-to-line"
9729 }).selector(":selected").css({
9730 "background-color": "#0169D9",
9731 "line-color": "#0169D9",
9732 "source-arrow-color": "#0169D9",
9733 "target-arrow-color": "#0169D9",
9734 "mid-source-arrow-color": "#0169D9",
9735 "mid-target-arrow-color": "#0169D9"
9736 }).selector(":parent:selected").css({
9737 "background-color": "#CCE1F9",
9738 "border-color": "#aec8e5"
9739 }).selector(":active").css({
9740 "overlay-color": "black",
9741 "overlay-padding": 10,
9742 "overlay-opacity": 0.25
9743 }), this.defaultLength = this.length;
9744 };
9745 var Vn = {};
9746 Vn.parse = function(t, e, r, a) {
9747 var n = this;
9748 if (Y(e))
9749 return n.parseImplWarn(t, e, r, a);
9750 var i = a === "mapping" || a === !0 || a === !1 || a == null ? "dontcare" : a, s = r ? "t" : "f", o = "" + e, l = hs(t, o, s, i), u = n.propCache = n.propCache || [], f;
9751 return (f = u[l]) || (f = u[l] = n.parseImplWarn(t, e, r, a)), (r || a === "mapping") && (f = or(f), f && (f.value = or(f.value))), f;
9752 }, Vn.parseImplWarn = function(t, e, r, a) {
9753 var n = this.parseImpl(t, e, r, a);
9754 return !n && e != null && ft("The style property `".concat(t, ": ").concat(e, "` is invalid")), n && (n.name === "width" || n.name === "height") && e === "label" && ft("The style value of `label` is deprecated for `" + n.name + "`"), n;
9755 }, Vn.parseImpl = function(t, e, r, a) {
9756 var n = this;
9757 t = je(t);
9758 var i = n.properties[t], s = e, o = n.types;
9759 if (!i || e === void 0)
9760 return null;
9761 i.alias && (i = i.pointsTo, t = i.name);
9762 var l = j(e);
9763 l && (e = e.trim());
9764 var u = i.type;
9765 if (!u)
9766 return null;
9767 if (r && (e === "" || e === null))
9768 return {
9769 name: t,
9770 value: e,
9771 bypass: !0,
9772 deleteBypass: !0
9773 };
9774 if (Y(e))
9775 return {
9776 name: t,
9777 value: e,
9778 strValue: "fn",
9779 mapped: o.fn,
9780 bypass: r
9781 };
9782 var f, h;
9783 if (!(!l || a || e.length < 7 || e[1] !== "a")) {
9784 if (e.length >= 7 && e[0] === "d" && (f = new RegExp(o.data.regex).exec(e))) {
9785 if (r)
9786 return !1;
9787 var c = o.data;
9788 return {
9789 name: t,
9790 value: f,
9791 strValue: "" + e,
9792 mapped: c,
9793 field: f[1],
9794 bypass: r
9795 };
9796 } else if (e.length >= 10 && e[0] === "m" && (h = new RegExp(o.mapData.regex).exec(e))) {
9797 if (r || u.multiple)
9798 return !1;
9799 var v = o.mapData;
9800 if (!(u.color || u.number))
9801 return !1;
9802 var d = this.parse(t, h[4]);
9803 if (!d || d.mapped)
9804 return !1;
9805 var g = this.parse(t, h[5]);
9806 if (!g || g.mapped)
9807 return !1;
9808 if (d.pfValue === g.pfValue || d.strValue === g.strValue)
9809 return ft("`" + t + ": " + e + "` is not a valid mapper because the output range is zero; converting to `" + t + ": " + d.strValue + "`"), this.parse(t, d.strValue);
9810 if (u.color) {
9811 var y = d.value, p = g.value, m = y[0] === p[0] && y[1] === p[1] && y[2] === p[2] && // optional alpha
9812 (y[3] === p[3] || (y[3] == null || y[3] === 1) && (p[3] == null || p[3] === 1));
9813 if (m)
9814 return !1;
9815 }
9816 return {
9817 name: t,
9818 value: h,
9819 strValue: "" + e,
9820 mapped: v,
9821 field: h[1],
9822 fieldMin: parseFloat(h[2]),
9823 // min & max are numeric
9824 fieldMax: parseFloat(h[3]),
9825 valueMin: d.value,
9826 valueMax: g.value,
9827 bypass: r
9828 };
9829 }
9830 }
9831 if (u.multiple && a !== "multiple") {
9832 var b;
9833 if (l ? b = e.split(/\s+/) : te(e) ? b = e : b = [e], u.evenMultiple && b.length % 2 !== 0)
9834 return null;
9835 for (var E = [], M = [], A = [], w = "", I = !1, C = 0; C < b.length; C++) {
9836 var B = n.parse(t, b[C], r, "multiple");
9837 I = I || j(B.value), E.push(B.value), A.push(B.pfValue != null ? B.pfValue : B.value), M.push(B.units), w += (C > 0 ? " " : "") + B.strValue;
9838 }
9839 return u.validate && !u.validate(E, M) ? null : u.singleEnum && I ? E.length === 1 && j(E[0]) ? {
9840 name: t,
9841 value: E[0],
9842 strValue: E[0],
9843 bypass: r
9844 } : null : {
9845 name: t,
9846 value: E,
9847 pfValue: A,
9848 strValue: w,
9849 bypass: r,
9850 units: M
9851 };
9852 }
9853 var F = function() {
9854 for (var Ce = 0; Ce < u.enums.length; Ce++) {
9855 var Oe = u.enums[Ce];
9856 if (Oe === e)
9857 return {
9858 name: t,
9859 value: e,
9860 strValue: "" + e,
9861 bypass: r
9862 };
9863 }
9864 return null;
9865 };
9866 if (u.number) {
9867 var R, X = "px";
9868 if (u.units && (R = u.units), u.implicitUnits && (X = u.implicitUnits), !u.unitless)
9869 if (l) {
9870 var z = "px|em" + (u.allowPercent ? "|\\%" : "");
9871 R && (z = R);
9872 var re = e.match("^(" + vt + ")(" + z + ")?$");
9873 re && (e = re[1], R = re[2] || X);
9874 } else
9875 (!R || u.implicitUnits) && (R = X);
9876 if (e = parseFloat(e), isNaN(e) && u.enums === void 0)
9877 return null;
9878 if (isNaN(e) && u.enums !== void 0)
9879 return e = s, F();
9880 if (u.integer && !q(e) || u.min !== void 0 && (e < u.min || u.strictMin && e === u.min) || u.max !== void 0 && (e > u.max || u.strictMax && e === u.max))
9881 return null;
9882 var W = {
9883 name: t,
9884 value: e,
9885 strValue: "" + e + (R || ""),
9886 units: R,
9887 bypass: r
9888 };
9889 return u.unitless || R !== "px" && R !== "em" ? W.pfValue = e : W.pfValue = R === "px" || !R ? e : this.getEmSizeInPixels() * e, (R === "ms" || R === "s") && (W.pfValue = R === "ms" ? e : 1e3 * e), (R === "deg" || R === "rad") && (W.pfValue = R === "rad" ? e : Ef(e)), R === "%" && (W.pfValue = e / 100), W;
9890 } else if (u.propList) {
9891 var Z = [], ie = "" + e;
9892 if (ie !== "none") {
9893 for (var oe = ie.split(/\s*,\s*|\s+/), ge = 0; ge < oe.length; ge++) {
9894 var se = oe[ge].trim();
9895 n.properties[se] ? Z.push(se) : ft("`" + se + "` is not a valid property name");
9896 }
9897 if (Z.length === 0)
9898 return null;
9899 }
9900 return {
9901 name: t,
9902 value: Z,
9903 strValue: Z.length === 0 ? "none" : Z.join(" "),
9904 bypass: r
9905 };
9906 } else if (u.color) {
9907 var de = rl(e);
9908 return de ? {
9909 name: t,
9910 value: de,
9911 pfValue: de,
9912 strValue: "rgb(" + de[0] + "," + de[1] + "," + de[2] + ")",
9913 // n.b. no spaces b/c of multiple support
9914 bypass: r
9915 } : null;
9916 } else if (u.regex || u.regexes) {
9917 if (u.enums) {
9918 var we = F();
9919 if (we)
9920 return we;
9921 }
9922 for (var Te = u.regexes ? u.regexes : [u.regex], Ee = 0; Ee < Te.length; Ee++) {
9923 var ye = new RegExp(Te[Ee]), ae = ye.exec(e);
9924 if (ae)
9925 return {
9926 name: t,
9927 value: u.singleRegexMatchValue ? ae[1] : ae,
9928 strValue: "" + e,
9929 bypass: r
9930 };
9931 }
9932 return null;
9933 } else
9934 return u.string ? {
9935 name: t,
9936 value: "" + e,
9937 strValue: "" + e,
9938 bypass: r
9939 } : u.enums ? F() : null;
9940 };
9941 var Ft = function t(e) {
9942 if (!(this instanceof t))
9943 return new t(e);
9944 if (!_e(e)) {
9945 xt("A style must have a core reference");
9946 return;
9947 }
9948 this._private = {
9949 cy: e,
9950 coreStyle: {}
9951 }, this.length = 0, this.resetToDefault();
9952 }, zt = Ft.prototype;
9953 zt.instanceString = function() {
9954 return "style";
9955 }, zt.clear = function() {
9956 for (var t = this._private, e = t.cy, r = e.elements(), a = 0; a < this.length; a++)
9957 this[a] = void 0;
9958 return this.length = 0, t.contextStyles = {}, t.propDiffs = {}, this.cleanElements(r, !0), r.forEach(function(n) {
9959 var i = n[0]._private;
9960 i.styleDirty = !0, i.appliedInitStyle = !1;
9961 }), this;
9962 }, zt.resetToDefault = function() {
9963 return this.clear(), this.addDefaultStylesheet(), this;
9964 }, zt.core = function(t) {
9965 return this._private.coreStyle[t] || this.getDefaultProperty(t);
9966 }, zt.selector = function(t) {
9967 var e = t === "core" ? null : new Dr(t), r = this.length++;
9968 return this[r] = {
9969 selector: e,
9970 properties: [],
9971 mappedProperties: [],
9972 index: r
9973 }, this;
9974 }, zt.css = function() {
9975 var t = this, e = arguments;
9976 if (e.length === 1)
9977 for (var r = e[0], a = 0; a < t.properties.length; a++) {
9978 var n = t.properties[a], i = r[n.name];
9979 i === void 0 && (i = r[pt(n.name)]), i !== void 0 && this.cssRule(n.name, i);
9980 }
9981 else
9982 e.length === 2 && this.cssRule(e[0], e[1]);
9983 return this;
9984 }, zt.style = zt.css, zt.cssRule = function(t, e) {
9985 var r = this.parse(t, e);
9986 if (r) {
9987 var a = this.length - 1;
9988 this[a].properties.push(r), this[a].properties[r.name] = r, r.name.match(/pie-(\d+)-background-size/) && r.value && (this._private.hasPie = !0), r.mapped && this[a].mappedProperties.push(r);
9989 var n = !this[a].selector;
9990 n && (this._private.coreStyle[r.name] = r);
9991 }
9992 return this;
9993 }, zt.append = function(t) {
9994 return tt(t) ? t.appendToStyle(this) : te(t) ? this.appendFromJson(t) : j(t) && this.appendFromString(t), this;
9995 }, Ft.fromJson = function(t, e) {
9996 var r = new Ft(t);
9997 return r.fromJson(e), r;
9998 }, Ft.fromString = function(t, e) {
9999 return new Ft(t).fromString(e);
10000 }, [Bt, Wa, ki, lr, $n, Pi, Nt, Vn].forEach(function(t) {
10001 Ue(zt, t);
10002 }), Ft.types = zt.types, Ft.properties = zt.properties, Ft.propertyGroups = zt.propertyGroups, Ft.propertyGroupNames = zt.propertyGroupNames, Ft.propertyGroupKeys = zt.propertyGroupKeys;
10003 var Gd = {
10004 style: function(e) {
10005 if (e) {
10006 var r = this.setStyle(e);
10007 r.update();
10008 }
10009 return this._private.style;
10010 },
10011 setStyle: function(e) {
10012 var r = this._private;
10013 return tt(e) ? r.style = e.generateStyle(this) : te(e) ? r.style = Ft.fromJson(this, e) : j(e) ? r.style = Ft.fromString(this, e) : r.style = Ft(this), r.style;
10014 },
10015 // e.g. cy.data() changed => recalc ele mappers
10016 updateStyle: function() {
10017 this.mutableElements().updateStyle();
10018 }
10019 }, $d = "single", $r = {
10020 autolock: function(e) {
10021 if (e !== void 0)
10022 this._private.autolock = !!e;
10023 else
10024 return this._private.autolock;
10025 return this;
10026 },
10027 autoungrabify: function(e) {
10028 if (e !== void 0)
10029 this._private.autoungrabify = !!e;
10030 else
10031 return this._private.autoungrabify;
10032 return this;
10033 },
10034 autounselectify: function(e) {
10035 if (e !== void 0)
10036 this._private.autounselectify = !!e;
10037 else
10038 return this._private.autounselectify;
10039 return this;
10040 },
10041 selectionType: function(e) {
10042 var r = this._private;
10043 if (r.selectionType == null && (r.selectionType = $d), e !== void 0)
10044 (e === "additive" || e === "single") && (r.selectionType = e);
10045 else
10046 return r.selectionType;
10047 return this;
10048 },
10049 panningEnabled: function(e) {
10050 if (e !== void 0)
10051 this._private.panningEnabled = !!e;
10052 else
10053 return this._private.panningEnabled;
10054 return this;
10055 },
10056 userPanningEnabled: function(e) {
10057 if (e !== void 0)
10058 this._private.userPanningEnabled = !!e;
10059 else
10060 return this._private.userPanningEnabled;
10061 return this;
10062 },
10063 zoomingEnabled: function(e) {
10064 if (e !== void 0)
10065 this._private.zoomingEnabled = !!e;
10066 else
10067 return this._private.zoomingEnabled;
10068 return this;
10069 },
10070 userZoomingEnabled: function(e) {
10071 if (e !== void 0)
10072 this._private.userZoomingEnabled = !!e;
10073 else
10074 return this._private.userZoomingEnabled;
10075 return this;
10076 },
10077 boxSelectionEnabled: function(e) {
10078 if (e !== void 0)
10079 this._private.boxSelectionEnabled = !!e;
10080 else
10081 return this._private.boxSelectionEnabled;
10082 return this;
10083 },
10084 pan: function() {
10085 var e = arguments, r = this._private.pan, a, n, i, s, o;
10086 switch (e.length) {
10087 case 0:
10088 return r;
10089 case 1:
10090 if (j(e[0]))
10091 return a = e[0], r[a];
10092 if (L(e[0])) {
10093 if (!this._private.panningEnabled)
10094 return this;
10095 i = e[0], s = i.x, o = i.y, k(s) && (r.x = s), k(o) && (r.y = o), this.emit("pan viewport");
10096 }
10097 break;
10098 case 2:
10099 if (!this._private.panningEnabled)
10100 return this;
10101 a = e[0], n = e[1], (a === "x" || a === "y") && k(n) && (r[a] = n), this.emit("pan viewport");
10102 break;
10103 }
10104 return this.notify("viewport"), this;
10105 },
10106 panBy: function(e, r) {
10107 var a = arguments, n = this._private.pan, i, s, o, l, u;
10108 if (!this._private.panningEnabled)
10109 return this;
10110 switch (a.length) {
10111 case 1:
10112 L(e) && (o = a[0], l = o.x, u = o.y, k(l) && (n.x += l), k(u) && (n.y += u), this.emit("pan viewport"));
10113 break;
10114 case 2:
10115 i = e, s = r, (i === "x" || i === "y") && k(s) && (n[i] += s), this.emit("pan viewport");
10116 break;
10117 }
10118 return this.notify("viewport"), this;
10119 },
10120 fit: function(e, r) {
10121 var a = this.getFitViewport(e, r);
10122 if (a) {
10123 var n = this._private;
10124 n.zoom = a.zoom, n.pan = a.pan, this.emit("pan zoom viewport"), this.notify("viewport");
10125 }
10126 return this;
10127 },
10128 getFitViewport: function(e, r) {
10129 if (k(e) && r === void 0 && (r = e, e = void 0), !(!this._private.panningEnabled || !this._private.zoomingEnabled)) {
10130 var a;
10131 if (j(e)) {
10132 var n = e;
10133 e = this.$(n);
10134 } else if (Xe(e)) {
10135 var i = e;
10136 a = {
10137 x1: i.x1,
10138 y1: i.y1,
10139 x2: i.x2,
10140 y2: i.y2
10141 }, a.w = a.x2 - a.x1, a.h = a.y2 - a.y1;
10142 } else
10143 pe(e) || (e = this.mutableElements());
10144 if (!(pe(e) && e.empty())) {
10145 a = a || e.boundingBox();
10146 var s = this.width(), o = this.height(), l;
10147 if (r = k(r) ? r : 0, !isNaN(s) && !isNaN(o) && s > 0 && o > 0 && !isNaN(a.w) && !isNaN(a.h) && a.w > 0 && a.h > 0) {
10148 l = Math.min((s - 2 * r) / a.w, (o - 2 * r) / a.h), l = l > this._private.maxZoom ? this._private.maxZoom : l, l = l < this._private.minZoom ? this._private.minZoom : l;
10149 var u = {
10150 // now pan to middle
10151 x: (s - l * (a.x1 + a.x2)) / 2,
10152 y: (o - l * (a.y1 + a.y2)) / 2
10153 };
10154 return {
10155 zoom: l,
10156 pan: u
10157 };
10158 }
10159 }
10160 }
10161 },
10162 zoomRange: function(e, r) {
10163 var a = this._private;
10164 if (r == null) {
10165 var n = e;
10166 e = n.min, r = n.max;
10167 }
10168 return k(e) && k(r) && e <= r ? (a.minZoom = e, a.maxZoom = r) : k(e) && r === void 0 && e <= a.maxZoom ? a.minZoom = e : k(r) && e === void 0 && r >= a.minZoom && (a.maxZoom = r), this;
10169 },
10170 minZoom: function(e) {
10171 return e === void 0 ? this._private.minZoom : this.zoomRange({
10172 min: e
10173 });
10174 },
10175 maxZoom: function(e) {
10176 return e === void 0 ? this._private.maxZoom : this.zoomRange({
10177 max: e
10178 });
10179 },
10180 getZoomedViewport: function(e) {
10181 var r = this._private, a = r.pan, n = r.zoom, i, s, o = !1;
10182 if (r.zoomingEnabled || (o = !0), k(e) ? s = e : L(e) && (s = e.level, e.position != null ? i = dn(e.position, n, a) : e.renderedPosition != null && (i = e.renderedPosition), i != null && !r.panningEnabled && (o = !0)), s = s > r.maxZoom ? r.maxZoom : s, s = s < r.minZoom ? r.minZoom : s, o || !k(s) || s === n || i != null && (!k(i.x) || !k(i.y)))
10183 return null;
10184 if (i != null) {
10185 var l = a, u = n, f = s, h = {
10186 x: -f / u * (i.x - l.x) + i.x,
10187 y: -f / u * (i.y - l.y) + i.y
10188 };
10189 return {
10190 zoomed: !0,
10191 panned: !0,
10192 zoom: f,
10193 pan: h
10194 };
10195 } else
10196 return {
10197 zoomed: !0,
10198 panned: !1,
10199 zoom: s,
10200 pan: a
10201 };
10202 },
10203 zoom: function(e) {
10204 if (e === void 0)
10205 return this._private.zoom;
10206 var r = this.getZoomedViewport(e), a = this._private;
10207 return r == null || !r.zoomed ? this : (a.zoom = r.zoom, r.panned && (a.pan.x = r.pan.x, a.pan.y = r.pan.y), this.emit("zoom" + (r.panned ? " pan" : "") + " viewport"), this.notify("viewport"), this);
10208 },
10209 viewport: function(e) {
10210 var r = this._private, a = !0, n = !0, i = [], s = !1, o = !1;
10211 if (!e)
10212 return this;
10213 if (k(e.zoom) || (a = !1), L(e.pan) || (n = !1), !a && !n)
10214 return this;
10215 if (a) {
10216 var l = e.zoom;
10217 l < r.minZoom || l > r.maxZoom || !r.zoomingEnabled ? s = !0 : (r.zoom = l, i.push("zoom"));
10218 }
10219 if (n && (!s || !e.cancelOnFailedZoom) && r.panningEnabled) {
10220 var u = e.pan;
10221 k(u.x) && (r.pan.x = u.x, o = !1), k(u.y) && (r.pan.y = u.y, o = !1), o || i.push("pan");
10222 }
10223 return i.length > 0 && (i.push("viewport"), this.emit(i.join(" ")), this.notify("viewport")), this;
10224 },
10225 center: function(e) {
10226 var r = this.getCenterPan(e);
10227 return r && (this._private.pan = r, this.emit("pan viewport"), this.notify("viewport")), this;
10228 },
10229 getCenterPan: function(e, r) {
10230 if (this._private.panningEnabled) {
10231 if (j(e)) {
10232 var a = e;
10233 e = this.mutableElements().filter(a);
10234 } else
10235 pe(e) || (e = this.mutableElements());
10236 if (e.length !== 0) {
10237 var n = e.boundingBox(), i = this.width(), s = this.height();
10238 r = r === void 0 ? this._private.zoom : r;
10239 var o = {
10240 // middle
10241 x: (i - r * (n.x1 + n.x2)) / 2,
10242 y: (s - r * (n.y1 + n.y2)) / 2
10243 };
10244 return o;
10245 }
10246 }
10247 },
10248 reset: function() {
10249 return !this._private.panningEnabled || !this._private.zoomingEnabled ? this : (this.viewport({
10250 pan: {
10251 x: 0,
10252 y: 0
10253 },
10254 zoom: 1
10255 }), this);
10256 },
10257 invalidateSize: function() {
10258 this._private.sizeCache = null;
10259 },
10260 size: function() {
10261 var e = this._private, r = e.container;
10262 return e.sizeCache = e.sizeCache || (r ? function() {
10263 var a = D.getComputedStyle(r), n = function(s) {
10264 return parseFloat(a.getPropertyValue(s));
10265 };
10266 return {
10267 width: r.clientWidth - n("padding-left") - n("padding-right"),
10268 height: r.clientHeight - n("padding-top") - n("padding-bottom")
10269 };
10270 }() : {
10271 // fallback if no container (not 0 b/c can be used for dividing etc)
10272 width: 1,
10273 height: 1
10274 });
10275 },
10276 width: function() {
10277 return this.size().width;
10278 },
10279 height: function() {
10280 return this.size().height;
10281 },
10282 extent: function() {
10283 var e = this._private.pan, r = this._private.zoom, a = this.renderedExtent(), n = {
10284 x1: (a.x1 - e.x) / r,
10285 x2: (a.x2 - e.x) / r,
10286 y1: (a.y1 - e.y) / r,
10287 y2: (a.y2 - e.y) / r
10288 };
10289 return n.w = n.x2 - n.x1, n.h = n.y2 - n.y1, n;
10290 },
10291 renderedExtent: function() {
10292 var e = this.width(), r = this.height();
10293 return {
10294 x1: 0,
10295 y1: 0,
10296 x2: e,
10297 y2: r,
10298 w: e,
10299 h: r
10300 };
10301 },
10302 multiClickDebounceTime: function(e) {
10303 if (e)
10304 this._private.multiClickDebounceTime = e;
10305 else
10306 return this._private.multiClickDebounceTime;
10307 return this;
10308 }
10309 };
10310 $r.centre = $r.center, $r.autolockNodes = $r.autolock, $r.autoungrabifyNodes = $r.autoungrabify;
10311 var Ka = {
10312 data: ht.data({
10313 field: "data",
10314 bindingEvent: "data",
10315 allowBinding: !0,
10316 allowSetting: !0,
10317 settingEvent: "data",
10318 settingTriggersEvent: !0,
10319 triggerFnName: "trigger",
10320 allowGetting: !0,
10321 updateStyle: !0
10322 }),
10323 removeData: ht.removeData({
10324 field: "data",
10325 event: "data",
10326 triggerFnName: "trigger",
10327 triggerEvent: !0,
10328 updateStyle: !0
10329 }),
10330 scratch: ht.data({
10331 field: "scratch",
10332 bindingEvent: "scratch",
10333 allowBinding: !0,
10334 allowSetting: !0,
10335 settingEvent: "scratch",
10336 settingTriggersEvent: !0,
10337 triggerFnName: "trigger",
10338 allowGetting: !0,
10339 updateStyle: !0
10340 }),
10341 removeScratch: ht.removeData({
10342 field: "scratch",
10343 event: "scratch",
10344 triggerFnName: "trigger",
10345 triggerEvent: !0,
10346 updateStyle: !0
10347 })
10348 };
10349 Ka.attr = Ka.data, Ka.removeAttr = Ka.removeData;
10350 var Za = function(e) {
10351 var r = this;
10352 e = Ue({}, e);
10353 var a = e.container;
10354 a && !ce(a) && ce(a[0]) && (a = a[0]);
10355 var n = a ? a._cyreg : null;
10356 n = n || {}, n && n.cy && (n.cy.destroy(), n = {});
10357 var i = n.readies = n.readies || [];
10358 a && (a._cyreg = n), n.cy = r;
10359 var s = D !== void 0 && a !== void 0 && !e.headless, o = e;
10360 o.layout = Ue({
10361 name: s ? "grid" : "null"
10362 }, o.layout), o.renderer = Ue({
10363 name: s ? "canvas" : "null"
10364 }, o.renderer);
10365 var l = function(d, g, y) {
10366 return g !== void 0 ? g : y !== void 0 ? y : d;
10367 }, u = this._private = {
10368 container: a,
10369 // html dom ele container
10370 ready: !1,
10371 // whether ready has been triggered
10372 options: o,
10373 // cached options
10374 elements: new Ot(this),
10375 // elements in the graph
10376 listeners: [],
10377 // list of listeners
10378 aniEles: new Ot(this),
10379 // elements being animated
10380 data: o.data || {},
10381 // data for the core
10382 scratch: {},
10383 // scratch object for core
10384 layout: null,
10385 renderer: null,
10386 destroyed: !1,
10387 // whether destroy was called
10388 notificationsEnabled: !0,
10389 // whether notifications are sent to the renderer
10390 minZoom: 1e-50,
10391 maxZoom: 1e50,
10392 zoomingEnabled: l(!0, o.zoomingEnabled),
10393 userZoomingEnabled: l(!0, o.userZoomingEnabled),
10394 panningEnabled: l(!0, o.panningEnabled),
10395 userPanningEnabled: l(!0, o.userPanningEnabled),
10396 boxSelectionEnabled: l(!0, o.boxSelectionEnabled),
10397 autolock: l(!1, o.autolock, o.autolockNodes),
10398 autoungrabify: l(!1, o.autoungrabify, o.autoungrabifyNodes),
10399 autounselectify: l(!1, o.autounselectify),
10400 styleEnabled: o.styleEnabled === void 0 ? s : o.styleEnabled,
10401 zoom: k(o.zoom) ? o.zoom : 1,
10402 pan: {
10403 x: L(o.pan) && k(o.pan.x) ? o.pan.x : 0,
10404 y: L(o.pan) && k(o.pan.y) ? o.pan.y : 0
10405 },
10406 animation: {
10407 // object for currently-running animations
10408 current: [],
10409 queue: []
10410 },
10411 hasCompoundNodes: !1,
10412 multiClickDebounceTime: l(250, o.multiClickDebounceTime)
10413 };
10414 this.createEmitter(), this.selectionType(o.selectionType), this.zoomRange({
10415 min: o.minZoom,
10416 max: o.maxZoom
10417 });
10418 var f = function(d, g) {
10419 var y = d.some(rt);
10420 if (y)
10421 return ia.all(d).then(g);
10422 g(d);
10423 };
10424 u.styleEnabled && r.setStyle([]);
10425 var h = Ue({}, o, o.renderer);
10426 r.initRenderer(h);
10427 var c = function(d, g, y) {
10428 r.notifications(!1);
10429 var p = r.mutableElements();
10430 p.length > 0 && p.remove(), d != null && (L(d) || te(d)) && r.add(d), r.one("layoutready", function(b) {
10431 r.notifications(!0), r.emit(b), r.one("load", g), r.emitAndNotify("load");
10432 }).one("layoutstop", function() {
10433 r.one("done", y), r.emit("done");
10434 });
10435 var m = Ue({}, r._private.options.layout);
10436 m.eles = r.elements(), r.layout(m).run();
10437 };
10438 f([o.style, o.elements], function(v) {
10439 var d = v[0], g = v[1];
10440 u.styleEnabled && r.style().append(d), c(g, function() {
10441 r.startAnimationLoop(), u.ready = !0, Y(o.ready) && r.on("ready", o.ready);
10442 for (var y = 0; y < i.length; y++) {
10443 var p = i[y];
10444 r.on("ready", p);
10445 }
10446 n && (n.readies = []), r.emit("ready");
10447 }, o.done);
10448 });
10449 }, _n = Za.prototype;
10450 Ue(_n, {
10451 instanceString: function() {
10452 return "core";
10453 },
10454 isReady: function() {
10455 return this._private.ready;
10456 },
10457 destroyed: function() {
10458 return this._private.destroyed;
10459 },
10460 ready: function(e) {
10461 return this.isReady() ? this.emitter().emit("ready", [], e) : this.on("ready", e), this;
10462 },
10463 destroy: function() {
10464 var e = this;
10465 if (!e.destroyed())
10466 return e.stopAnimationLoop(), e.destroyRenderer(), this.emit("destroy"), e._private.destroyed = !0, e;
10467 },
10468 hasElementWithId: function(e) {
10469 return this._private.elements.hasElementWithId(e);
10470 },
10471 getElementById: function(e) {
10472 return this._private.elements.getElementById(e);
10473 },
10474 hasCompoundNodes: function() {
10475 return this._private.hasCompoundNodes;
10476 },
10477 headless: function() {
10478 return this._private.renderer.isHeadless();
10479 },
10480 styleEnabled: function() {
10481 return this._private.styleEnabled;
10482 },
10483 addToPool: function(e) {
10484 return this._private.elements.merge(e), this;
10485 },
10486 removeFromPool: function(e) {
10487 return this._private.elements.unmerge(e), this;
10488 },
10489 container: function() {
10490 return this._private.container || null;
10491 },
10492 mount: function(e) {
10493 if (e != null) {
10494 var r = this, a = r._private, n = a.options;
10495 return !ce(e) && ce(e[0]) && (e = e[0]), r.stopAnimationLoop(), r.destroyRenderer(), a.container = e, a.styleEnabled = !0, r.invalidateSize(), r.initRenderer(Ue({}, n, n.renderer, {
10496 // allow custom renderer name to be re-used, otherwise use canvas
10497 name: n.renderer.name === "null" ? "canvas" : n.renderer.name
10498 })), r.startAnimationLoop(), r.style(n.style), r.emit("mount"), r;
10499 }
10500 },
10501 unmount: function() {
10502 var e = this;
10503 return e.stopAnimationLoop(), e.destroyRenderer(), e.initRenderer({
10504 name: "null"
10505 }), e.emit("unmount"), e;
10506 },
10507 options: function() {
10508 return or(this._private.options);
10509 },
10510 json: function(e) {
10511 var r = this, a = r._private, n = r.mutableElements(), i = function(E) {
10512 return r.getElementById(E.id());
10513 };
10514 if (L(e)) {
10515 if (r.startBatch(), e.elements) {
10516 var s = {}, o = function(E, M) {
10517 for (var A = [], w = [], I = 0; I < E.length; I++) {
10518 var C = E[I];
10519 if (!C.data.id) {
10520 ft("cy.json() cannot handle elements without an ID attribute");
10521 continue;
10522 }
10523 var B = "" + C.data.id, F = r.getElementById(B);
10524 s[B] = !0, F.length !== 0 ? w.push({
10525 ele: F,
10526 json: C
10527 }) : (M && (C.group = M), A.push(C));
10528 }
10529 r.add(A);
10530 for (var R = 0; R < w.length; R++) {
10531 var X = w[R], z = X.ele, re = X.json;
10532 z.json(re);
10533 }
10534 };
10535 if (te(e.elements))
10536 o(e.elements);
10537 else
10538 for (var l = ["nodes", "edges"], u = 0; u < l.length; u++) {
10539 var f = l[u], h = e.elements[f];
10540 te(h) && o(h, f);
10541 }
10542 var c = r.collection();
10543 n.filter(function(b) {
10544 return !s[b.id()];
10545 }).forEach(function(b) {
10546 b.isParent() ? c.merge(b) : b.remove();
10547 }), c.forEach(function(b) {
10548 return b.children().move({
10549 parent: null
10550 });
10551 }), c.forEach(function(b) {
10552 return i(b).remove();
10553 });
10554 }
10555 e.style && r.style(e.style), e.zoom != null && e.zoom !== a.zoom && r.zoom(e.zoom), e.pan && (e.pan.x !== a.pan.x || e.pan.y !== a.pan.y) && r.pan(e.pan), e.data && r.data(e.data);
10556 for (var v = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"], d = 0; d < v.length; d++) {
10557 var g = v[d];
10558 e[g] != null && r[g](e[g]);
10559 }
10560 return r.endBatch(), this;
10561 } else {
10562 var y = !!e, p = {};
10563 y ? p.elements = this.elements().map(function(b) {
10564 return b.json();
10565 }) : (p.elements = {}, n.forEach(function(b) {
10566 var E = b.group();
10567 p.elements[E] || (p.elements[E] = []), p.elements[E].push(b.json());
10568 })), this._private.styleEnabled && (p.style = r.style().json()), p.data = or(r.data());
10569 var m = a.options;
10570 return p.zoomingEnabled = a.zoomingEnabled, p.userZoomingEnabled = a.userZoomingEnabled, p.zoom = a.zoom, p.minZoom = a.minZoom, p.maxZoom = a.maxZoom, p.panningEnabled = a.panningEnabled, p.userPanningEnabled = a.userPanningEnabled, p.pan = or(a.pan), p.boxSelectionEnabled = a.boxSelectionEnabled, p.renderer = or(m.renderer), p.hideEdgesOnViewport = m.hideEdgesOnViewport, p.textureOnViewport = m.textureOnViewport, p.wheelSensitivity = m.wheelSensitivity, p.motionBlur = m.motionBlur, p.multiClickDebounceTime = m.multiClickDebounceTime, p;
10571 }
10572 }
10573 }), _n.$id = _n.getElementById, [Od, kd, Ho, Ii, zn, Bd, Ri, Gn, Gd, $r, Ka].forEach(function(t) {
10574 Ue(_n, t);
10575 });
10576 var Vd = {
10577 fit: !0,
10578 // whether to fit the viewport to the graph
10579 directed: !1,
10580 // whether the tree is directed downwards (or edges can point in any direction if false)
10581 padding: 30,
10582 // padding on fit
10583 circle: !1,
10584 // put depths in concentric circles if true, put depths top down if false
10585 grid: !1,
10586 // whether to create an even grid into which the DAG is placed (circle:false only)
10587 spacingFactor: 1.75,
10588 // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap)
10589 boundingBox: void 0,
10590 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10591 avoidOverlap: !0,
10592 // prevents node overlap, may overflow boundingBox if not enough space
10593 nodeDimensionsIncludeLabels: !1,
10594 // Excludes the label when calculating node bounding boxes for the layout algorithm
10595 roots: void 0,
10596 // the roots of the trees
10597 maximal: !1,
10598 // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only)
10599 depthSort: void 0,
10600 // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
10601 animate: !1,
10602 // whether to transition the node positions
10603 animationDuration: 500,
10604 // duration of animation in ms if enabled
10605 animationEasing: void 0,
10606 // easing of animation if enabled,
10607 animateFilter: function(e, r) {
10608 return !0;
10609 },
10610 // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
10611 ready: void 0,
10612 // callback on layoutready
10613 stop: void 0,
10614 // callback on layoutstop
10615 transform: function(e, r) {
10616 return r;
10617 }
10618 // transform a given node position. Useful for changing flow direction in discrete layouts
10619 }, pa = function(e) {
10620 return e.scratch("breadthfirst");
10621 }, Xo = function(e, r) {
10622 return e.scratch("breadthfirst", r);
10623 };
10624 function qo(t) {
10625 this.options = Ue({}, Vd, t);
10626 }
10627 qo.prototype.run = function() {
10628 var t = this.options, e = t, r = t.cy, a = e.eles, n = a.nodes().filter(function(Re) {
10629 return !Re.isParent();
10630 }), i = a, s = e.directed, o = e.maximal || e.maximalAdjustments > 0, l = Ut(e.boundingBox ? e.boundingBox : {
10631 x1: 0,
10632 y1: 0,
10633 w: r.width(),
10634 h: r.height()
10635 }), u;
10636 if (pe(e.roots))
10637 u = e.roots;
10638 else if (te(e.roots)) {
10639 for (var f = [], h = 0; h < e.roots.length; h++) {
10640 var c = e.roots[h], v = r.getElementById(c);
10641 f.push(v);
10642 }
10643 u = r.collection(f);
10644 } else if (j(e.roots))
10645 u = r.$(e.roots);
10646 else if (s)
10647 u = n.roots();
10648 else {
10649 var d = a.components();
10650 u = r.collection();
10651 for (var g = function(Me) {
10652 var Ve = d[Me], Fe = Ve.maxDegree(!1), ke = Ve.filter(function(Ge) {
10653 return Ge.degree(!1) === Fe;
10654 });
10655 u = u.add(ke);
10656 }, y = 0; y < d.length; y++)
10657 g(y);
10658 }
10659 var p = [], m = {}, b = function(Me, Ve) {
10660 p[Ve] == null && (p[Ve] = []);
10661 var Fe = p[Ve].length;
10662 p[Ve].push(Me), Xo(Me, {
10663 index: Fe,
10664 depth: Ve
10665 });
10666 }, E = function(Me, Ve) {
10667 var Fe = pa(Me), ke = Fe.depth, Ge = Fe.index;
10668 p[ke][Ge] = null, b(Me, Ve);
10669 };
10670 i.bfs({
10671 roots: u,
10672 directed: e.directed,
10673 visit: function(Me, Ve, Fe, ke, Ge) {
10674 var et = Me[0], We = et.id();
10675 b(et, Ge), m[We] = !0;
10676 }
10677 });
10678 for (var M = [], A = 0; A < n.length; A++) {
10679 var w = n[A];
10680 m[w.id()] || M.push(w);
10681 }
10682 var I = function(Me) {
10683 for (var Ve = p[Me], Fe = 0; Fe < Ve.length; Fe++) {
10684 var ke = Ve[Fe];
10685 if (ke == null) {
10686 Ve.splice(Fe, 1), Fe--;
10687 continue;
10688 }
10689 Xo(ke, {
10690 depth: Me,
10691 index: Fe
10692 });
10693 }
10694 }, C = function() {
10695 for (var Me = 0; Me < p.length; Me++)
10696 I(Me);
10697 }, B = function(Me, Ve) {
10698 for (var Fe = pa(Me), ke = Me.incomers().filter(function(N) {
10699 return N.isNode() && a.has(N);
10700 }), Ge = -1, et = Me.id(), We = 0; We < ke.length; We++) {
10701 var Ye = ke[We], Se = pa(Ye);
10702 Ge = Math.max(Ge, Se.depth);
10703 }
10704 return Fe.depth <= Ge ? Ve[et] ? null : (E(Me, Ge + 1), Ve[et] = !0, !0) : !1;
10705 };
10706 if (s && o) {
10707 var F = [], R = {}, X = function(Me) {
10708 return F.push(Me);
10709 }, z = function() {
10710 return F.shift();
10711 };
10712 for (n.forEach(function(Re) {
10713 return F.push(Re);
10714 }); F.length > 0; ) {
10715 var re = z(), W = B(re, R);
10716 if (W)
10717 re.outgoers().filter(function(Re) {
10718 return Re.isNode() && a.has(Re);
10719 }).forEach(X);
10720 else if (W === null) {
10721 ft("Detected double maximal shift for node `" + re.id() + "`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");
10722 break;
10723 }
10724 }
10725 }
10726 C();
10727 var Z = 0;
10728 if (e.avoidOverlap)
10729 for (var ie = 0; ie < n.length; ie++) {
10730 var oe = n[ie], ge = oe.layoutDimensions(e), se = ge.w, de = ge.h;
10731 Z = Math.max(Z, se, de);
10732 }
10733 var we = {}, Te = function(Me) {
10734 if (we[Me.id()])
10735 return we[Me.id()];
10736 for (var Ve = pa(Me).depth, Fe = Me.neighborhood(), ke = 0, Ge = 0, et = 0; et < Fe.length; et++) {
10737 var We = Fe[et];
10738 if (!(We.isEdge() || We.isParent() || !n.has(We))) {
10739 var Ye = pa(We);
10740 if (Ye != null) {
10741 var Se = Ye.index, N = Ye.depth;
10742 if (!(Se == null || N == null)) {
10743 var le = p[N].length;
10744 N < Ve && (ke += Se / le, Ge++);
10745 }
10746 }
10747 }
10748 }
10749 return Ge = Math.max(1, Ge), ke = ke / Ge, Ge === 0 && (ke = 0), we[Me.id()] = ke, ke;
10750 }, Ee = function(Me, Ve) {
10751 var Fe = Te(Me), ke = Te(Ve), Ge = Fe - ke;
10752 return Ge === 0 ? es(Me.id(), Ve.id()) : Ge;
10753 };
10754 e.depthSort !== void 0 && (Ee = e.depthSort);
10755 for (var ye = 0; ye < p.length; ye++)
10756 p[ye].sort(Ee), I(ye);
10757 for (var ae = [], xe = 0; xe < M.length; xe++)
10758 ae.push(M[xe]);
10759 p.unshift(ae), C();
10760 for (var Ce = 0, Oe = 0; Oe < p.length; Oe++)
10761 Ce = Math.max(p[Oe].length, Ce);
10762 var Ie = {
10763 x: l.x1 + l.w / 2,
10764 y: l.x1 + l.h / 2
10765 }, He = p.reduce(function(Re, Me) {
10766 return Math.max(Re, Me.length);
10767 }, 0), qe = function(Me) {
10768 var Ve = pa(Me), Fe = Ve.depth, ke = Ve.index, Ge = p[Fe].length, et = Math.max(l.w / ((e.grid ? He : Ge) + 1), Z), We = Math.max(l.h / (p.length + 1), Z), Ye = Math.min(l.w / 2 / p.length, l.h / 2 / p.length);
10769 if (Ye = Math.max(Ye, Z), e.circle) {
10770 var N = Ye * Fe + Ye - (p.length > 0 && p[0].length <= 3 ? Ye / 2 : 0), le = 2 * Math.PI / p[Fe].length * ke;
10771 return Fe === 0 && p[0].length === 1 && (N = 1), {
10772 x: Ie.x + N * Math.cos(le),
10773 y: Ie.y + N * Math.sin(le)
10774 };
10775 } else {
10776 var Se = {
10777 x: Ie.x + (ke + 1 - (Ge + 1) / 2) * et,
10778 y: (Fe + 1) * We
10779 };
10780 return Se;
10781 }
10782 };
10783 return a.nodes().layoutPositions(this, e, qe), this;
10784 };
10785 var _d = {
10786 fit: !0,
10787 // whether to fit the viewport to the graph
10788 padding: 30,
10789 // the padding on fit
10790 boundingBox: void 0,
10791 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10792 avoidOverlap: !0,
10793 // prevents node overlap, may overflow boundingBox and radius if not enough space
10794 nodeDimensionsIncludeLabels: !1,
10795 // Excludes the label when calculating node bounding boxes for the layout algorithm
10796 spacingFactor: void 0,
10797 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
10798 radius: void 0,
10799 // the radius of the circle
10800 startAngle: 3 / 2 * Math.PI,
10801 // where nodes start in radians
10802 sweep: void 0,
10803 // how many radians should be between the first and last node (defaults to full circle)
10804 clockwise: !0,
10805 // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
10806 sort: void 0,
10807 // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
10808 animate: !1,
10809 // whether to transition the node positions
10810 animationDuration: 500,
10811 // duration of animation in ms if enabled
10812 animationEasing: void 0,
10813 // easing of animation if enabled
10814 animateFilter: function(e, r) {
10815 return !0;
10816 },
10817 // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
10818 ready: void 0,
10819 // callback on layoutready
10820 stop: void 0,
10821 // callback on layoutstop
10822 transform: function(e, r) {
10823 return r;
10824 }
10825 // transform a given node position. Useful for changing flow direction in discrete layouts
10826 };
10827 function Wo(t) {
10828 this.options = Ue({}, _d, t);
10829 }
10830 Wo.prototype.run = function() {
10831 var t = this.options, e = t, r = t.cy, a = e.eles, n = e.counterclockwise !== void 0 ? !e.counterclockwise : e.clockwise, i = a.nodes().not(":parent");
10832 e.sort && (i = i.sort(e.sort));
10833 for (var s = Ut(e.boundingBox ? e.boundingBox : {
10834 x1: 0,
10835 y1: 0,
10836 w: r.width(),
10837 h: r.height()
10838 }), o = {
10839 x: s.x1 + s.w / 2,
10840 y: s.y1 + s.h / 2
10841 }, l = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / i.length : e.sweep, u = l / Math.max(1, i.length - 1), f, h = 0, c = 0; c < i.length; c++) {
10842 var v = i[c], d = v.layoutDimensions(e), g = d.w, y = d.h;
10843 h = Math.max(h, g, y);
10844 }
10845 if (k(e.radius) ? f = e.radius : i.length <= 1 ? f = 0 : f = Math.min(s.h, s.w) / 2 - h, i.length > 1 && e.avoidOverlap) {
10846 h *= 1.75;
10847 var p = Math.cos(u) - Math.cos(0), m = Math.sin(u) - Math.sin(0), b = Math.sqrt(h * h / (p * p + m * m));
10848 f = Math.max(b, f);
10849 }
10850 var E = function(A, w) {
10851 var I = e.startAngle + w * u * (n ? 1 : -1), C = f * Math.cos(I), B = f * Math.sin(I), F = {
10852 x: o.x + C,
10853 y: o.y + B
10854 };
10855 return F;
10856 };
10857 return a.nodes().layoutPositions(this, e, E), this;
10858 };
10859 var Ud = {
10860 fit: !0,
10861 // whether to fit the viewport to the graph
10862 padding: 30,
10863 // the padding on fit
10864 startAngle: 3 / 2 * Math.PI,
10865 // where nodes start in radians
10866 sweep: void 0,
10867 // how many radians should be between the first and last node (defaults to full circle)
10868 clockwise: !0,
10869 // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
10870 equidistant: !1,
10871 // whether levels have an equal radial distance betwen them, may cause bounding box overflow
10872 minNodeSpacing: 10,
10873 // min spacing between outside of nodes (used for radius adjustment)
10874 boundingBox: void 0,
10875 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10876 avoidOverlap: !0,
10877 // prevents node overlap, may overflow boundingBox if not enough space
10878 nodeDimensionsIncludeLabels: !1,
10879 // Excludes the label when calculating node bounding boxes for the layout algorithm
10880 height: void 0,
10881 // height of layout area (overrides container height)
10882 width: void 0,
10883 // width of layout area (overrides container width)
10884 spacingFactor: void 0,
10885 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
10886 concentric: function(e) {
10887 return e.degree();
10888 },
10889 levelWidth: function(e) {
10890 return e.maxDegree() / 4;
10891 },
10892 animate: !1,
10893 // whether to transition the node positions
10894 animationDuration: 500,
10895 // duration of animation in ms if enabled
10896 animationEasing: void 0,
10897 // easing of animation if enabled
10898 animateFilter: function(e, r) {
10899 return !0;
10900 },
10901 // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
10902 ready: void 0,
10903 // callback on layoutready
10904 stop: void 0,
10905 // callback on layoutstop
10906 transform: function(e, r) {
10907 return r;
10908 }
10909 // transform a given node position. Useful for changing flow direction in discrete layouts
10910 };
10911 function Ko(t) {
10912 this.options = Ue({}, Ud, t);
10913 }
10914 Ko.prototype.run = function() {
10915 for (var t = this.options, e = t, r = e.counterclockwise !== void 0 ? !e.counterclockwise : e.clockwise, a = t.cy, n = e.eles, i = n.nodes().not(":parent"), s = Ut(e.boundingBox ? e.boundingBox : {
10916 x1: 0,
10917 y1: 0,
10918 w: a.width(),
10919 h: a.height()
10920 }), o = {
10921 x: s.x1 + s.w / 2,
10922 y: s.y1 + s.h / 2
10923 }, l = [], u = 0, f = 0; f < i.length; f++) {
10924 var h = i[f], c = void 0;
10925 c = e.concentric(h), l.push({
10926 value: c,
10927 node: h
10928 }), h._private.scratch.concentric = c;
10929 }
10930 i.updateStyle();
10931 for (var v = 0; v < i.length; v++) {
10932 var d = i[v], g = d.layoutDimensions(e);
10933 u = Math.max(u, g.w, g.h);
10934 }
10935 l.sort(function(Re, Me) {
10936 return Me.value - Re.value;
10937 });
10938 for (var y = e.levelWidth(i), p = [[]], m = p[0], b = 0; b < l.length; b++) {
10939 var E = l[b];
10940 if (m.length > 0) {
10941 var M = Math.abs(m[0].value - E.value);
10942 M >= y && (m = [], p.push(m));
10943 }
10944 m.push(E);
10945 }
10946 var A = u + e.minNodeSpacing;
10947 if (!e.avoidOverlap) {
10948 var w = p.length > 0 && p[0].length > 1, I = Math.min(s.w, s.h) / 2 - A, C = I / (p.length + w ? 1 : 0);
10949 A = Math.min(A, C);
10950 }
10951 for (var B = 0, F = 0; F < p.length; F++) {
10952 var R = p[F], X = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / R.length : e.sweep, z = R.dTheta = X / Math.max(1, R.length - 1);
10953 if (R.length > 1 && e.avoidOverlap) {
10954 var re = Math.cos(z) - Math.cos(0), W = Math.sin(z) - Math.sin(0), Z = Math.sqrt(A * A / (re * re + W * W));
10955 B = Math.max(Z, B);
10956 }
10957 R.r = B, B += A;
10958 }
10959 if (e.equidistant) {
10960 for (var ie = 0, oe = 0, ge = 0; ge < p.length; ge++) {
10961 var se = p[ge], de = se.r - oe;
10962 ie = Math.max(ie, de);
10963 }
10964 oe = 0;
10965 for (var we = 0; we < p.length; we++) {
10966 var Te = p[we];
10967 we === 0 && (oe = Te.r), Te.r = oe, oe += ie;
10968 }
10969 }
10970 for (var Ee = {}, ye = 0; ye < p.length; ye++)
10971 for (var ae = p[ye], xe = ae.dTheta, Ce = ae.r, Oe = 0; Oe < ae.length; Oe++) {
10972 var Ie = ae[Oe], He = e.startAngle + (r ? 1 : -1) * xe * Oe, qe = {
10973 x: o.x + Ce * Math.cos(He),
10974 y: o.y + Ce * Math.sin(He)
10975 };
10976 Ee[Ie.node.id()] = qe;
10977 }
10978 return n.nodes().layoutPositions(this, e, function(Re) {
10979 var Me = Re.id();
10980 return Ee[Me];
10981 }), this;
10982 };
10983 var Bi, Yd = {
10984 // Called on `layoutready`
10985 ready: function() {
10986 },
10987 // Called on `layoutstop`
10988 stop: function() {
10989 },
10990 // Whether to animate while running the layout
10991 // true : Animate continuously as the layout is running
10992 // false : Just show the end result
10993 // 'end' : Animate with the end result, from the initial positions to the end positions
10994 animate: !0,
10995 // Easing of the animation for animate:'end'
10996 animationEasing: void 0,
10997 // The duration of the animation for animate:'end'
10998 animationDuration: void 0,
10999 // A function that determines whether the node should be animated
11000 // All nodes animated by default on animate enabled
11001 // Non-animated nodes are positioned immediately when the layout starts
11002 animateFilter: function(e, r) {
11003 return !0;
11004 },
11005 // The layout animates only after this many milliseconds for animate:true
11006 // (prevents flashing on fast runs)
11007 animationThreshold: 250,
11008 // Number of iterations between consecutive screen positions update
11009 refresh: 20,
11010 // Whether to fit the network view after when done
11011 fit: !0,
11012 // Padding on fit
11013 padding: 30,
11014 // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
11015 boundingBox: void 0,
11016 // Excludes the label when calculating node bounding boxes for the layout algorithm
11017 nodeDimensionsIncludeLabels: !1,
11018 // Randomize the initial positions of the nodes (true) or use existing positions (false)
11019 randomize: !1,
11020 // Extra spacing between components in non-compound graphs
11021 componentSpacing: 40,
11022 // Node repulsion (non overlapping) multiplier
11023 nodeRepulsion: function(e) {
11024 return 2048;
11025 },
11026 // Node repulsion (overlapping) multiplier
11027 nodeOverlap: 4,
11028 // Ideal edge (non nested) length
11029 idealEdgeLength: function(e) {
11030 return 32;
11031 },
11032 // Divisor to compute edge forces
11033 edgeElasticity: function(e) {
11034 return 32;
11035 },
11036 // Nesting factor (multiplier) to compute ideal edge length for nested edges
11037 nestingFactor: 1.2,
11038 // Gravity force (constant)
11039 gravity: 1,
11040 // Maximum number of iterations to perform
11041 numIter: 1e3,
11042 // Initial temperature (maximum node displacement)
11043 initialTemp: 1e3,
11044 // Cooling factor (how the temperature is reduced between consecutive iterations
11045 coolingFactor: 0.99,
11046 // Lower temperature threshold (below this point the layout will end)
11047 minTemp: 1
11048 };
11049 function Un(t) {
11050 this.options = Ue({}, Yd, t), this.options.layout = this;
11051 }
11052 Un.prototype.run = function() {
11053 var t = this.options, e = t.cy, r = this;
11054 r.stopped = !1, (t.animate === !0 || t.animate === !1) && r.emit({
11055 type: "layoutstart",
11056 layout: r
11057 }), t.debug === !0 ? Bi = !0 : Bi = !1;
11058 var a = Hd(e, r, t);
11059 Bi && Wd(a), t.randomize && Kd(a);
11060 var n = dr(), i = function() {
11061 Zd(a, e, t), t.fit === !0 && e.fit(t.padding);
11062 }, s = function(c) {
11063 return !(r.stopped || c >= t.numIter || (Qd(a, t), a.temperature = a.temperature * t.coolingFactor, a.temperature < t.minTemp));
11064 }, o = function() {
11065 if (t.animate === !0 || t.animate === !1)
11066 i(), r.one("layoutstop", t.stop), r.emit({
11067 type: "layoutstop",
11068 layout: r
11069 });
11070 else {
11071 var c = t.eles.nodes(), v = Zo(a, t, c);
11072 c.layoutPositions(r, t, v);
11073 }
11074 }, l = 0, u = !0;
11075 if (t.animate === !0) {
11076 var f = function h() {
11077 for (var c = 0; u && c < t.refresh; )
11078 u = s(l), l++, c++;
11079 if (!u)
11080 Jo(a, t), o();
11081 else {
11082 var v = dr();
11083 v - n >= t.animationThreshold && i(), fn(h);
11084 }
11085 };
11086 f();
11087 } else {
11088 for (; u; )
11089 u = s(l), l++;
11090 Jo(a, t), o();
11091 }
11092 return this;
11093 }, Un.prototype.stop = function() {
11094 return this.stopped = !0, this.thread && this.thread.stop(), this.emit("layoutstop"), this;
11095 }, Un.prototype.destroy = function() {
11096 return this.thread && this.thread.stop(), this;
11097 };
11098 var Hd = function(e, r, a) {
11099 for (var n = a.eles.edges(), i = a.eles.nodes(), s = {
11100 isCompound: e.hasCompoundNodes(),
11101 layoutNodes: [],
11102 idToIndex: {},
11103 nodeSize: i.size(),
11104 graphSet: [],
11105 indexToGraph: [],
11106 layoutEdges: [],
11107 edgeSize: n.size(),
11108 temperature: a.initialTemp,
11109 clientWidth: e.width(),
11110 clientHeight: e.width(),
11111 boundingBox: Ut(a.boundingBox ? a.boundingBox : {
11112 x1: 0,
11113 y1: 0,
11114 w: e.width(),
11115 h: e.height()
11116 })
11117 }, o = a.eles.components(), l = {}, u = 0; u < o.length; u++)
11118 for (var f = o[u], h = 0; h < f.length; h++) {
11119 var c = f[h];
11120 l[c.id()] = u;
11121 }
11122 for (var u = 0; u < s.nodeSize; u++) {
11123 var v = i[u], d = v.layoutDimensions(a), g = {};
11124 g.isLocked = v.locked(), g.id = v.data("id"), g.parentId = v.data("parent"), g.cmptId = l[v.id()], g.children = [], g.positionX = v.position("x"), g.positionY = v.position("y"), g.offsetX = 0, g.offsetY = 0, g.height = d.w, g.width = d.h, g.maxX = g.positionX + g.width / 2, g.minX = g.positionX - g.width / 2, g.maxY = g.positionY + g.height / 2, g.minY = g.positionY - g.height / 2, g.padLeft = parseFloat(v.style("padding")), g.padRight = parseFloat(v.style("padding")), g.padTop = parseFloat(v.style("padding")), g.padBottom = parseFloat(v.style("padding")), g.nodeRepulsion = Y(a.nodeRepulsion) ? a.nodeRepulsion(v) : a.nodeRepulsion, s.layoutNodes.push(g), s.idToIndex[g.id] = u;
11125 }
11126 for (var y = [], p = 0, m = -1, b = [], u = 0; u < s.nodeSize; u++) {
11127 var v = s.layoutNodes[u], E = v.parentId;
11128 E != null ? s.layoutNodes[s.idToIndex[E]].children.push(v.id) : (y[++m] = v.id, b.push(v.id));
11129 }
11130 for (s.graphSet.push(b); p <= m; ) {
11131 var M = y[p++], A = s.idToIndex[M], c = s.layoutNodes[A], w = c.children;
11132 if (w.length > 0) {
11133 s.graphSet.push(w);
11134 for (var u = 0; u < w.length; u++)
11135 y[++m] = w[u];
11136 }
11137 }
11138 for (var u = 0; u < s.graphSet.length; u++)
11139 for (var I = s.graphSet[u], h = 0; h < I.length; h++) {
11140 var C = s.idToIndex[I[h]];
11141 s.indexToGraph[C] = u;
11142 }
11143 for (var u = 0; u < s.edgeSize; u++) {
11144 var B = n[u], F = {};
11145 F.id = B.data("id"), F.sourceId = B.data("source"), F.targetId = B.data("target");
11146 var R = Y(a.idealEdgeLength) ? a.idealEdgeLength(B) : a.idealEdgeLength, X = Y(a.edgeElasticity) ? a.edgeElasticity(B) : a.edgeElasticity, z = s.idToIndex[F.sourceId], re = s.idToIndex[F.targetId], W = s.indexToGraph[z], Z = s.indexToGraph[re];
11147 if (W != Z) {
11148 for (var ie = Xd(F.sourceId, F.targetId, s), oe = s.graphSet[ie], ge = 0, g = s.layoutNodes[z]; oe.indexOf(g.id) === -1; )
11149 g = s.layoutNodes[s.idToIndex[g.parentId]], ge++;
11150 for (g = s.layoutNodes[re]; oe.indexOf(g.id) === -1; )
11151 g = s.layoutNodes[s.idToIndex[g.parentId]], ge++;
11152 R *= ge * a.nestingFactor;
11153 }
11154 F.idealLength = R, F.elasticity = X, s.layoutEdges.push(F);
11155 }
11156 return s;
11157 }, Xd = function(e, r, a) {
11158 var n = qd(e, r, 0, a);
11159 return 2 > n.count ? 0 : n.graph;
11160 }, qd = function t(e, r, a, n) {
11161 var i = n.graphSet[a];
11162 if (-1 < i.indexOf(e) && -1 < i.indexOf(r))
11163 return {
11164 count: 2,
11165 graph: a
11166 };
11167 for (var s = 0, o = 0; o < i.length; o++) {
11168 var l = i[o], u = n.idToIndex[l], f = n.layoutNodes[u].children;
11169 if (f.length !== 0) {
11170 var h = n.indexToGraph[n.idToIndex[f[0]]], c = t(e, r, h, n);
11171 if (c.count !== 0)
11172 if (c.count === 1) {
11173 if (s++, s === 2)
11174 break;
11175 } else
11176 return c;
11177 }
11178 }
11179 return {
11180 count: s,
11181 graph: a
11182 };
11183 }, Wd, Kd = function(e, r) {
11184 for (var a = e.clientWidth, n = e.clientHeight, i = 0; i < e.nodeSize; i++) {
11185 var s = e.layoutNodes[i];
11186 s.children.length === 0 && !s.isLocked && (s.positionX = Math.random() * a, s.positionY = Math.random() * n);
11187 }
11188 }, Zo = function(e, r, a) {
11189 var n = e.boundingBox, i = {
11190 x1: 1 / 0,
11191 x2: -1 / 0,
11192 y1: 1 / 0,
11193 y2: -1 / 0
11194 };
11195 return r.boundingBox && (a.forEach(function(s) {
11196 var o = e.layoutNodes[e.idToIndex[s.data("id")]];
11197 i.x1 = Math.min(i.x1, o.positionX), i.x2 = Math.max(i.x2, o.positionX), i.y1 = Math.min(i.y1, o.positionY), i.y2 = Math.max(i.y2, o.positionY);
11198 }), i.w = i.x2 - i.x1, i.h = i.y2 - i.y1), function(s, o) {
11199 var l = e.layoutNodes[e.idToIndex[s.data("id")]];
11200 if (r.boundingBox) {
11201 var u = (l.positionX - i.x1) / i.w, f = (l.positionY - i.y1) / i.h;
11202 return {
11203 x: n.x1 + u * n.w,
11204 y: n.y1 + f * n.h
11205 };
11206 } else
11207 return {
11208 x: l.positionX,
11209 y: l.positionY
11210 };
11211 };
11212 }, Zd = function(e, r, a) {
11213 var n = a.layout, i = a.eles.nodes(), s = Zo(e, a, i);
11214 i.positions(s), e.ready !== !0 && (e.ready = !0, n.one("layoutready", a.ready), n.emit({
11215 type: "layoutready",
11216 layout: this
11217 }));
11218 }, Qd = function(e, r, a) {
11219 Jd(e, r), tg(e), rg(e, r), ag(e), ng(e);
11220 }, Jd = function(e, r) {
11221 for (var a = 0; a < e.graphSet.length; a++)
11222 for (var n = e.graphSet[a], i = n.length, s = 0; s < i; s++)
11223 for (var o = e.layoutNodes[e.idToIndex[n[s]]], l = s + 1; l < i; l++) {
11224 var u = e.layoutNodes[e.idToIndex[n[l]]];
11225 jd(o, u, e, r);
11226 }
11227 }, Qo = function(e) {
11228 return -e + 2 * e * Math.random();
11229 }, jd = function(e, r, a, n) {
11230 var i = e.cmptId, s = r.cmptId;
11231 if (!(i !== s && !a.isCompound)) {
11232 var o = r.positionX - e.positionX, l = r.positionY - e.positionY, u = 1;
11233 o === 0 && l === 0 && (o = Qo(u), l = Qo(u));
11234 var f = eg(e, r, o, l);
11235 if (f > 0)
11236 var h = n.nodeOverlap * f, c = Math.sqrt(o * o + l * l), v = h * o / c, d = h * l / c;
11237 else
11238 var g = Yn(e, o, l), y = Yn(r, -1 * o, -1 * l), p = y.x - g.x, m = y.y - g.y, b = p * p + m * m, c = Math.sqrt(b), h = (e.nodeRepulsion + r.nodeRepulsion) / b, v = h * p / c, d = h * m / c;
11239 e.isLocked || (e.offsetX -= v, e.offsetY -= d), r.isLocked || (r.offsetX += v, r.offsetY += d);
11240 }
11241 }, eg = function(e, r, a, n) {
11242 if (a > 0)
11243 var i = e.maxX - r.minX;
11244 else
11245 var i = r.maxX - e.minX;
11246 if (n > 0)
11247 var s = e.maxY - r.minY;
11248 else
11249 var s = r.maxY - e.minY;
11250 return i >= 0 && s >= 0 ? Math.sqrt(i * i + s * s) : 0;
11251 }, Yn = function(e, r, a) {
11252 var n = e.positionX, i = e.positionY, s = e.height || 1, o = e.width || 1, l = a / r, u = s / o, f = {};
11253 return r === 0 && 0 < a || r === 0 && 0 > a ? (f.x = n, f.y = i + s / 2, f) : 0 < r && -1 * u <= l && l <= u ? (f.x = n + o / 2, f.y = i + o * a / 2 / r, f) : 0 > r && -1 * u <= l && l <= u ? (f.x = n - o / 2, f.y = i - o * a / 2 / r, f) : 0 < a && (l <= -1 * u || l >= u) ? (f.x = n + s * r / 2 / a, f.y = i + s / 2, f) : (0 > a && (l <= -1 * u || l >= u) && (f.x = n - s * r / 2 / a, f.y = i - s / 2), f);
11254 }, tg = function(e, r) {
11255 for (var a = 0; a < e.edgeSize; a++) {
11256 var n = e.layoutEdges[a], i = e.idToIndex[n.sourceId], s = e.layoutNodes[i], o = e.idToIndex[n.targetId], l = e.layoutNodes[o], u = l.positionX - s.positionX, f = l.positionY - s.positionY;
11257 if (!(u === 0 && f === 0)) {
11258 var h = Yn(s, u, f), c = Yn(l, -1 * u, -1 * f), v = c.x - h.x, d = c.y - h.y, g = Math.sqrt(v * v + d * d), y = Math.pow(n.idealLength - g, 2) / n.elasticity;
11259 if (g !== 0)
11260 var p = y * v / g, m = y * d / g;
11261 else
11262 var p = 0, m = 0;
11263 s.isLocked || (s.offsetX += p, s.offsetY += m), l.isLocked || (l.offsetX -= p, l.offsetY -= m);
11264 }
11265 }
11266 }, rg = function(e, r) {
11267 if (r.gravity !== 0)
11268 for (var a = 1, n = 0; n < e.graphSet.length; n++) {
11269 var i = e.graphSet[n], s = i.length;
11270 if (n === 0)
11271 var o = e.clientHeight / 2, l = e.clientWidth / 2;
11272 else
11273 var u = e.layoutNodes[e.idToIndex[i[0]]], f = e.layoutNodes[e.idToIndex[u.parentId]], o = f.positionX, l = f.positionY;
11274 for (var h = 0; h < s; h++) {
11275 var c = e.layoutNodes[e.idToIndex[i[h]]];
11276 if (!c.isLocked) {
11277 var v = o - c.positionX, d = l - c.positionY, g = Math.sqrt(v * v + d * d);
11278 if (g > a) {
11279 var y = r.gravity * v / g, p = r.gravity * d / g;
11280 c.offsetX += y, c.offsetY += p;
11281 }
11282 }
11283 }
11284 }
11285 }, ag = function(e, r) {
11286 var a = [], n = 0, i = -1;
11287 for (a.push.apply(a, e.graphSet[0]), i += e.graphSet[0].length; n <= i; ) {
11288 var s = a[n++], o = e.idToIndex[s], l = e.layoutNodes[o], u = l.children;
11289 if (0 < u.length && !l.isLocked) {
11290 for (var f = l.offsetX, h = l.offsetY, c = 0; c < u.length; c++) {
11291 var v = e.layoutNodes[e.idToIndex[u[c]]];
11292 v.offsetX += f, v.offsetY += h, a[++i] = u[c];
11293 }
11294 l.offsetX = 0, l.offsetY = 0;
11295 }
11296 }
11297 }, ng = function(e, r) {
11298 for (var a = 0; a < e.nodeSize; a++) {
11299 var n = e.layoutNodes[a];
11300 0 < n.children.length && (n.maxX = void 0, n.minX = void 0, n.maxY = void 0, n.minY = void 0);
11301 }
11302 for (var a = 0; a < e.nodeSize; a++) {
11303 var n = e.layoutNodes[a];
11304 if (!(0 < n.children.length || n.isLocked)) {
11305 var i = ig(n.offsetX, n.offsetY, e.temperature);
11306 n.positionX += i.x, n.positionY += i.y, n.offsetX = 0, n.offsetY = 0, n.minX = n.positionX - n.width, n.maxX = n.positionX + n.width, n.minY = n.positionY - n.height, n.maxY = n.positionY + n.height, sg(n, e);
11307 }
11308 }
11309 for (var a = 0; a < e.nodeSize; a++) {
11310 var n = e.layoutNodes[a];
11311 0 < n.children.length && !n.isLocked && (n.positionX = (n.maxX + n.minX) / 2, n.positionY = (n.maxY + n.minY) / 2, n.width = n.maxX - n.minX, n.height = n.maxY - n.minY);
11312 }
11313 }, ig = function(e, r, a) {
11314 var n = Math.sqrt(e * e + r * r);
11315 if (n > a)
11316 var i = {
11317 x: a * e / n,
11318 y: a * r / n
11319 };
11320 else
11321 var i = {
11322 x: e,
11323 y: r
11324 };
11325 return i;
11326 }, sg = function t(e, r) {
11327 var a = e.parentId;
11328 if (a != null) {
11329 var n = r.layoutNodes[r.idToIndex[a]], i = !1;
11330 if ((n.maxX == null || e.maxX + n.padRight > n.maxX) && (n.maxX = e.maxX + n.padRight, i = !0), (n.minX == null || e.minX - n.padLeft < n.minX) && (n.minX = e.minX - n.padLeft, i = !0), (n.maxY == null || e.maxY + n.padBottom > n.maxY) && (n.maxY = e.maxY + n.padBottom, i = !0), (n.minY == null || e.minY - n.padTop < n.minY) && (n.minY = e.minY - n.padTop, i = !0), i)
11331 return t(n, r);
11332 }
11333 }, Jo = function(e, r) {
11334 for (var a = e.layoutNodes, n = [], i = 0; i < a.length; i++) {
11335 var s = a[i], o = s.cmptId, l = n[o] = n[o] || [];
11336 l.push(s);
11337 }
11338 for (var u = 0, i = 0; i < n.length; i++) {
11339 var f = n[i];
11340 if (f) {
11341 f.x1 = 1 / 0, f.x2 = -1 / 0, f.y1 = 1 / 0, f.y2 = -1 / 0;
11342 for (var h = 0; h < f.length; h++) {
11343 var c = f[h];
11344 f.x1 = Math.min(f.x1, c.positionX - c.width / 2), f.x2 = Math.max(f.x2, c.positionX + c.width / 2), f.y1 = Math.min(f.y1, c.positionY - c.height / 2), f.y2 = Math.max(f.y2, c.positionY + c.height / 2);
11345 }
11346 f.w = f.x2 - f.x1, f.h = f.y2 - f.y1, u += f.w * f.h;
11347 }
11348 }
11349 n.sort(function(m, b) {
11350 return b.w * b.h - m.w * m.h;
11351 });
11352 for (var v = 0, d = 0, g = 0, y = 0, p = Math.sqrt(u) * e.clientWidth / e.clientHeight, i = 0; i < n.length; i++) {
11353 var f = n[i];
11354 if (f) {
11355 for (var h = 0; h < f.length; h++) {
11356 var c = f[h];
11357 c.isLocked || (c.positionX += v - f.x1, c.positionY += d - f.y1);
11358 }
11359 v += f.w + r.componentSpacing, g += f.w + r.componentSpacing, y = Math.max(y, f.h), g > p && (d += y + r.componentSpacing, v = 0, g = 0, y = 0);
11360 }
11361 }
11362 }, og = {
11363 fit: !0,
11364 // whether to fit the viewport to the graph
11365 padding: 30,
11366 // padding used on fit
11367 boundingBox: void 0,
11368 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
11369 avoidOverlap: !0,
11370 // prevents node overlap, may overflow boundingBox if not enough space
11371 avoidOverlapPadding: 10,
11372 // extra spacing around nodes when avoidOverlap: true
11373 nodeDimensionsIncludeLabels: !1,
11374 // Excludes the label when calculating node bounding boxes for the layout algorithm
11375 spacingFactor: void 0,
11376 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
11377 condense: !1,
11378 // uses all available space on false, uses minimal space on true
11379 rows: void 0,
11380 // force num of rows in the grid
11381 cols: void 0,
11382 // force num of columns in the grid
11383 position: function(e) {
11384 },
11385 // returns { row, col } for element
11386 sort: void 0,
11387 // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
11388 animate: !1,
11389 // whether to transition the node positions
11390 animationDuration: 500,
11391 // duration of animation in ms if enabled
11392 animationEasing: void 0,
11393 // easing of animation if enabled
11394 animateFilter: function(e, r) {
11395 return !0;
11396 },
11397 // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
11398 ready: void 0,
11399 // callback on layoutready
11400 stop: void 0,
11401 // callback on layoutstop
11402 transform: function(e, r) {
11403 return r;
11404 }
11405 // transform a given node position. Useful for changing flow direction in discrete layouts
11406 };
11407 function jo(t) {
11408 this.options = Ue({}, og, t);
11409 }
11410 jo.prototype.run = function() {
11411 var t = this.options, e = t, r = t.cy, a = e.eles, n = a.nodes().not(":parent");
11412 e.sort && (n = n.sort(e.sort));
11413 var i = Ut(e.boundingBox ? e.boundingBox : {
11414 x1: 0,
11415 y1: 0,
11416 w: r.width(),
11417 h: r.height()
11418 });
11419 if (i.h === 0 || i.w === 0)
11420 a.nodes().layoutPositions(this, e, function(we) {
11421 return {
11422 x: i.x1,
11423 y: i.y1
11424 };
11425 });
11426 else {
11427 var s = n.size(), o = Math.sqrt(s * i.h / i.w), l = Math.round(o), u = Math.round(i.w / i.h * o), f = function(Te) {
11428 if (Te == null)
11429 return Math.min(l, u);
11430 var Ee = Math.min(l, u);
11431 Ee == l ? l = Te : u = Te;
11432 }, h = function(Te) {
11433 if (Te == null)
11434 return Math.max(l, u);
11435 var Ee = Math.max(l, u);
11436 Ee == l ? l = Te : u = Te;
11437 }, c = e.rows, v = e.cols != null ? e.cols : e.columns;
11438 if (c != null && v != null)
11439 l = c, u = v;
11440 else if (c != null && v == null)
11441 l = c, u = Math.ceil(s / l);
11442 else if (c == null && v != null)
11443 u = v, l = Math.ceil(s / u);
11444 else if (u * l > s) {
11445 var d = f(), g = h();
11446 (d - 1) * g >= s ? f(d - 1) : (g - 1) * d >= s && h(g - 1);
11447 } else
11448 for (; u * l < s; ) {
11449 var y = f(), p = h();
11450 (p + 1) * y >= s ? h(p + 1) : f(y + 1);
11451 }
11452 var m = i.w / u, b = i.h / l;
11453 if (e.condense && (m = 0, b = 0), e.avoidOverlap)
11454 for (var E = 0; E < n.length; E++) {
11455 var M = n[E], A = M._private.position;
11456 (A.x == null || A.y == null) && (A.x = 0, A.y = 0);
11457 var w = M.layoutDimensions(e), I = e.avoidOverlapPadding, C = w.w + I, B = w.h + I;
11458 m = Math.max(m, C), b = Math.max(b, B);
11459 }
11460 for (var F = {}, R = function(Te, Ee) {
11461 return !!F["c-" + Te + "-" + Ee];
11462 }, X = function(Te, Ee) {
11463 F["c-" + Te + "-" + Ee] = !0;
11464 }, z = 0, re = 0, W = function() {
11465 re++, re >= u && (re = 0, z++);
11466 }, Z = {}, ie = 0; ie < n.length; ie++) {
11467 var oe = n[ie], ge = e.position(oe);
11468 if (ge && (ge.row !== void 0 || ge.col !== void 0)) {
11469 var se = {
11470 row: ge.row,
11471 col: ge.col
11472 };
11473 if (se.col === void 0)
11474 for (se.col = 0; R(se.row, se.col); )
11475 se.col++;
11476 else if (se.row === void 0)
11477 for (se.row = 0; R(se.row, se.col); )
11478 se.row++;
11479 Z[oe.id()] = se, X(se.row, se.col);
11480 }
11481 }
11482 var de = function(Te, Ee) {
11483 var ye, ae;
11484 if (Te.locked() || Te.isParent())
11485 return !1;
11486 var xe = Z[Te.id()];
11487 if (xe)
11488 ye = xe.col * m + m / 2 + i.x1, ae = xe.row * b + b / 2 + i.y1;
11489 else {
11490 for (; R(z, re); )
11491 W();
11492 ye = re * m + m / 2 + i.x1, ae = z * b + b / 2 + i.y1, X(z, re), W();
11493 }
11494 return {
11495 x: ye,
11496 y: ae
11497 };
11498 };
11499 n.layoutPositions(this, e, de);
11500 }
11501 return this;
11502 };
11503 var ug = {
11504 ready: function() {
11505 },
11506 // on layoutready
11507 stop: function() {
11508 }
11509 // on layoutstop
11510 };
11511 function Fi(t) {
11512 this.options = Ue({}, ug, t);
11513 }
11514 Fi.prototype.run = function() {
11515 var t = this.options, e = t.eles, r = this;
11516 return t.cy, r.emit("layoutstart"), e.nodes().positions(function() {
11517 return {
11518 x: 0,
11519 y: 0
11520 };
11521 }), r.one("layoutready", t.ready), r.emit("layoutready"), r.one("layoutstop", t.stop), r.emit("layoutstop"), this;
11522 }, Fi.prototype.stop = function() {
11523 return this;
11524 };
11525 var lg = {
11526 positions: void 0,
11527 // map of (node id) => (position obj); or function(node){ return somPos; }
11528 zoom: void 0,
11529 // the zoom level to set (prob want fit = false if set)
11530 pan: void 0,
11531 // the pan level to set (prob want fit = false if set)
11532 fit: !0,
11533 // whether to fit to viewport
11534 padding: 30,
11535 // padding on fit
11536 animate: !1,
11537 // whether to transition the node positions
11538 animationDuration: 500,
11539 // duration of animation in ms if enabled
11540 animationEasing: void 0,
11541 // easing of animation if enabled
11542 animateFilter: function(e, r) {
11543 return !0;
11544 },
11545 // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
11546 ready: void 0,
11547 // callback on layoutready
11548 stop: void 0,
11549 // callback on layoutstop
11550 transform: function(e, r) {
11551 return r;
11552 }
11553 // transform a given node position. Useful for changing flow direction in discrete layouts
11554 };
11555 function eu(t) {
11556 this.options = Ue({}, lg, t);
11557 }
11558 eu.prototype.run = function() {
11559 var t = this.options, e = t.eles, r = e.nodes(), a = Y(t.positions);
11560 function n(i) {
11561 if (t.positions == null)
11562 return gf(i.position());
11563 if (a)
11564 return t.positions(i);
11565 var s = t.positions[i._private.data.id];
11566 return s ?? null;
11567 }
11568 return r.layoutPositions(this, t, function(i, s) {
11569 var o = n(i);
11570 return i.locked() || o == null ? !1 : o;
11571 }), this;
11572 };
11573 var fg = {
11574 fit: !0,
11575 // whether to fit to viewport
11576 padding: 30,
11577 // fit padding
11578 boundingBox: void 0,
11579 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
11580 animate: !1,
11581 // whether to transition the node positions
11582 animationDuration: 500,
11583 // duration of animation in ms if enabled
11584 animationEasing: void 0,
11585 // easing of animation if enabled
11586 animateFilter: function(e, r) {
11587 return !0;
11588 },
11589 // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts
11590 ready: void 0,
11591 // callback on layoutready
11592 stop: void 0,
11593 // callback on layoutstop
11594 transform: function(e, r) {
11595 return r;
11596 }
11597 // transform a given node position. Useful for changing flow direction in discrete layouts
11598 };
11599 function tu(t) {
11600 this.options = Ue({}, fg, t);
11601 }
11602 tu.prototype.run = function() {
11603 var t = this.options, e = t.cy, r = t.eles, a = Ut(t.boundingBox ? t.boundingBox : {
11604 x1: 0,
11605 y1: 0,
11606 w: e.width(),
11607 h: e.height()
11608 }), n = function(s, o) {
11609 return {
11610 x: a.x1 + Math.round(Math.random() * a.w),
11611 y: a.y1 + Math.round(Math.random() * a.h)
11612 };
11613 };
11614 return r.nodes().layoutPositions(this, t, n), this;
11615 };
11616 var hg = [{
11617 name: "breadthfirst",
11618 impl: qo
11619 }, {
11620 name: "circle",
11621 impl: Wo
11622 }, {
11623 name: "concentric",
11624 impl: Ko
11625 }, {
11626 name: "cose",
11627 impl: Un
11628 }, {
11629 name: "grid",
11630 impl: jo
11631 }, {
11632 name: "null",
11633 impl: Fi
11634 }, {
11635 name: "preset",
11636 impl: eu
11637 }, {
11638 name: "random",
11639 impl: tu
11640 }];
11641 function ru(t) {
11642 this.options = t, this.notifications = 0;
11643 }
11644 var au = function() {
11645 }, nu = function() {
11646 throw new Error("A headless instance can not render images");
11647 };
11648 ru.prototype = {
11649 recalculateRenderedStyle: au,
11650 notify: function() {
11651 this.notifications++;
11652 },
11653 init: au,
11654 isHeadless: function() {
11655 return !0;
11656 },
11657 png: nu,
11658 jpg: nu
11659 };
11660 var zi = {};
11661 zi.arrowShapeWidth = 0.3, zi.registerArrowShapes = function() {
11662 var t = this.arrowShapes = {}, e = this, r = function(u, f, h, c, v, d, g) {
11663 var y = v.x - h / 2 - g, p = v.x + h / 2 + g, m = v.y - h / 2 - g, b = v.y + h / 2 + g, E = y <= u && u <= p && m <= f && f <= b;
11664 return E;
11665 }, a = function(u, f, h, c, v) {
11666 var d = u * Math.cos(c) - f * Math.sin(c), g = u * Math.sin(c) + f * Math.cos(c), y = d * h, p = g * h, m = y + v.x, b = p + v.y;
11667 return {
11668 x: m,
11669 y: b
11670 };
11671 }, n = function(u, f, h, c) {
11672 for (var v = [], d = 0; d < u.length; d += 2) {
11673 var g = u[d], y = u[d + 1];
11674 v.push(a(g, y, f, h, c));
11675 }
11676 return v;
11677 }, i = function(u) {
11678 for (var f = [], h = 0; h < u.length; h++) {
11679 var c = u[h];
11680 f.push(c.x, c.y);
11681 }
11682 return f;
11683 }, s = function(u) {
11684 return u.pstyle("width").pfValue * u.pstyle("arrow-scale").pfValue * 2;
11685 }, o = function(u, f) {
11686 j(f) && (f = t[f]), t[u] = Ue({
11687 name: u,
11688 points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3],
11689 collide: function(c, v, d, g, y, p) {
11690 var m = i(n(this.points, d + 2 * p, g, y)), b = Yt(c, v, m);
11691 return b;
11692 },
11693 roughCollide: r,
11694 draw: function(c, v, d, g) {
11695 var y = n(this.points, v, d, g);
11696 e.arrowShapeImpl("polygon")(c, y);
11697 },
11698 spacing: function(c) {
11699 return 0;
11700 },
11701 gap: s
11702 }, f);
11703 };
11704 o("none", {
11705 collide: cn,
11706 roughCollide: cn,
11707 draw: si,
11708 spacing: ds,
11709 gap: ds
11710 }), o("triangle", {
11711 points: [-0.15, -0.3, 0, 0, 0.15, -0.3]
11712 }), o("arrow", "triangle"), o("triangle-backcurve", {
11713 points: t.triangle.points,
11714 controlPoint: [0, -0.15],
11715 roughCollide: r,
11716 draw: function(u, f, h, c, v) {
11717 var d = n(this.points, f, h, c), g = this.controlPoint, y = a(g[0], g[1], f, h, c);
11718 e.arrowShapeImpl(this.name)(u, d, y);
11719 },
11720 gap: function(u) {
11721 return s(u) * 0.8;
11722 }
11723 }), o("triangle-tee", {
11724 points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
11725 pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4],
11726 collide: function(u, f, h, c, v, d, g) {
11727 var y = i(n(this.points, h + 2 * g, c, v)), p = i(n(this.pointsTee, h + 2 * g, c, v)), m = Yt(u, f, y) || Yt(u, f, p);
11728 return m;
11729 },
11730 draw: function(u, f, h, c, v) {
11731 var d = n(this.points, f, h, c), g = n(this.pointsTee, f, h, c);
11732 e.arrowShapeImpl(this.name)(u, d, g);
11733 }
11734 }), o("circle-triangle", {
11735 radius: 0.15,
11736 pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15],
11737 collide: function(u, f, h, c, v, d, g) {
11738 var y = v, p = Math.pow(y.x - u, 2) + Math.pow(y.y - f, 2) <= Math.pow((h + 2 * g) * this.radius, 2), m = i(n(this.points, h + 2 * g, c, v));
11739 return Yt(u, f, m) || p;
11740 },
11741 draw: function(u, f, h, c, v) {
11742 var d = n(this.pointsTr, f, h, c);
11743 e.arrowShapeImpl(this.name)(u, d, c.x, c.y, this.radius * f);
11744 },
11745 spacing: function(u) {
11746 return e.getArrowWidth(u.pstyle("width").pfValue, u.pstyle("arrow-scale").value) * this.radius;
11747 }
11748 }), o("triangle-cross", {
11749 points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
11750 baseCrossLinePts: [
11751 -0.15,
11752 -0.4,
11753 // first half of the rectangle
11754 -0.15,
11755 -0.4,
11756 0.15,
11757 -0.4,
11758 // second half of the rectangle
11759 0.15,
11760 -0.4
11761 ],
11762 crossLinePts: function(u, f) {
11763 var h = this.baseCrossLinePts.slice(), c = f / u, v = 3, d = 5;
11764 return h[v] = h[v] - c, h[d] = h[d] - c, h;
11765 },
11766 collide: function(u, f, h, c, v, d, g) {
11767 var y = i(n(this.points, h + 2 * g, c, v)), p = i(n(this.crossLinePts(h, d), h + 2 * g, c, v)), m = Yt(u, f, y) || Yt(u, f, p);
11768 return m;
11769 },
11770 draw: function(u, f, h, c, v) {
11771 var d = n(this.points, f, h, c), g = n(this.crossLinePts(f, v), f, h, c);
11772 e.arrowShapeImpl(this.name)(u, d, g);
11773 }
11774 }), o("vee", {
11775 points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15],
11776 gap: function(u) {
11777 return s(u) * 0.525;
11778 }
11779 }), o("circle", {
11780 radius: 0.15,
11781 collide: function(u, f, h, c, v, d, g) {
11782 var y = v, p = Math.pow(y.x - u, 2) + Math.pow(y.y - f, 2) <= Math.pow((h + 2 * g) * this.radius, 2);
11783 return p;
11784 },
11785 draw: function(u, f, h, c, v) {
11786 e.arrowShapeImpl(this.name)(u, c.x, c.y, this.radius * f);
11787 },
11788 spacing: function(u) {
11789 return e.getArrowWidth(u.pstyle("width").pfValue, u.pstyle("arrow-scale").value) * this.radius;
11790 }
11791 }), o("tee", {
11792 points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0],
11793 spacing: function(u) {
11794 return 1;
11795 },
11796 gap: function(u) {
11797 return 1;
11798 }
11799 }), o("square", {
11800 points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3]
11801 }), o("diamond", {
11802 points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0],
11803 gap: function(u) {
11804 return u.pstyle("width").pfValue * u.pstyle("arrow-scale").value;
11805 }
11806 }), o("chevron", {
11807 points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15],
11808 gap: function(u) {
11809 return 0.95 * u.pstyle("width").pfValue * u.pstyle("arrow-scale").value;
11810 }
11811 });
11812 };
11813 var Vr = {};
11814 Vr.projectIntoViewport = function(t, e) {
11815 var r = this.cy, a = this.findContainerClientCoords(), n = a[0], i = a[1], s = a[4], o = r.pan(), l = r.zoom(), u = ((t - n) / s - o.x) / l, f = ((e - i) / s - o.y) / l;
11816 return [u, f];
11817 }, Vr.findContainerClientCoords = function() {
11818 if (this.containerBB)
11819 return this.containerBB;
11820 var t = this.container, e = t.getBoundingClientRect(), r = D.getComputedStyle(t), a = function(p) {
11821 return parseFloat(r.getPropertyValue(p));
11822 }, n = {
11823 left: a("padding-left"),
11824 right: a("padding-right"),
11825 top: a("padding-top"),
11826 bottom: a("padding-bottom")
11827 }, i = {
11828 left: a("border-left-width"),
11829 right: a("border-right-width"),
11830 top: a("border-top-width"),
11831 bottom: a("border-bottom-width")
11832 }, s = t.clientWidth, o = t.clientHeight, l = n.left + n.right, u = n.top + n.bottom, f = i.left + i.right, h = e.width / (s + f), c = s - l, v = o - u, d = e.left + n.left + i.left, g = e.top + n.top + i.top;
11833 return this.containerBB = [d, g, c, v, h];
11834 }, Vr.invalidateContainerClientCoordsCache = function() {
11835 this.containerBB = null;
11836 }, Vr.findNearestElement = function(t, e, r, a) {
11837 return this.findNearestElements(t, e, r, a)[0];
11838 }, Vr.findNearestElements = function(t, e, r, a) {
11839 var n = this, i = this, s = i.getCachedZSortedEles(), o = [], l = i.cy.zoom(), u = i.cy.hasCompoundNodes(), f = (a ? 24 : 8) / l, h = (a ? 8 : 2) / l, c = (a ? 8 : 2) / l, v = 1 / 0, d, g;
11840 r && (s = s.interactive);
11841 function y(w, I) {
11842 if (w.isNode()) {
11843 if (g)
11844 return;
11845 g = w, o.push(w);
11846 }
11847 if (w.isEdge() && (I == null || I < v))
11848 if (d) {
11849 if (d.pstyle("z-compound-depth").value === w.pstyle("z-compound-depth").value && d.pstyle("z-compound-depth").value === w.pstyle("z-compound-depth").value) {
11850 for (var C = 0; C < o.length; C++)
11851 if (o[C].isEdge()) {
11852 o[C] = w, d = w, v = I ?? v;
11853 break;
11854 }
11855 }
11856 } else
11857 o.push(w), d = w, v = I ?? v;
11858 }
11859 function p(w) {
11860 var I = w.outerWidth() + 2 * h, C = w.outerHeight() + 2 * h, B = I / 2, F = C / 2, R = w.position();
11861 if (R.x - B <= t && t <= R.x + B && R.y - F <= e && e <= R.y + F) {
11862 var X = i.nodeShapes[n.getNodeShape(w)];
11863 if (X.checkPoint(t, e, 0, I, C, R.x, R.y))
11864 return y(w, 0), !0;
11865 }
11866 }
11867 function m(w) {
11868 var I = w._private, C = I.rscratch, B = w.pstyle("width").pfValue, F = w.pstyle("arrow-scale").value, R = B / 2 + f, X = R * R, z = R * 2, ie = I.source, oe = I.target, re;
11869 if (C.edgeType === "segments" || C.edgeType === "straight" || C.edgeType === "haystack") {
11870 for (var W = C.allpts, Z = 0; Z + 3 < W.length; Z += 2)
11871 if (Af(t, e, W[Z], W[Z + 1], W[Z + 2], W[Z + 3], z) && X > (re = Rf(t, e, W[Z], W[Z + 1], W[Z + 2], W[Z + 3])))
11872 return y(w, re), !0;
11873 } else if (C.edgeType === "bezier" || C.edgeType === "multibezier" || C.edgeType === "self" || C.edgeType === "compound") {
11874 for (var W = C.allpts, Z = 0; Z + 5 < C.allpts.length; Z += 4)
11875 if (Of(t, e, W[Z], W[Z + 1], W[Z + 2], W[Z + 3], W[Z + 4], W[Z + 5], z) && X > (re = If(t, e, W[Z], W[Z + 1], W[Z + 2], W[Z + 3], W[Z + 4], W[Z + 5])))
11876 return y(w, re), !0;
11877 }
11878 for (var ie = ie || I.source, oe = oe || I.target, ge = n.getArrowWidth(B, F), se = [{
11879 name: "source",
11880 x: C.arrowStartX,
11881 y: C.arrowStartY,
11882 angle: C.srcArrowAngle
11883 }, {
11884 name: "target",
11885 x: C.arrowEndX,
11886 y: C.arrowEndY,
11887 angle: C.tgtArrowAngle
11888 }, {
11889 name: "mid-source",
11890 x: C.midX,
11891 y: C.midY,
11892 angle: C.midsrcArrowAngle
11893 }, {
11894 name: "mid-target",
11895 x: C.midX,
11896 y: C.midY,
11897 angle: C.midtgtArrowAngle
11898 }], Z = 0; Z < se.length; Z++) {
11899 var de = se[Z], we = i.arrowShapes[w.pstyle(de.name + "-arrow-shape").value], Te = w.pstyle("width").pfValue;
11900 if (we.roughCollide(t, e, ge, de.angle, {
11901 x: de.x,
11902 y: de.y
11903 }, Te, f) && we.collide(t, e, ge, de.angle, {
11904 x: de.x,
11905 y: de.y
11906 }, Te, f))
11907 return y(w), !0;
11908 }
11909 u && o.length > 0 && (p(ie), p(oe));
11910 }
11911 function b(w, I, C) {
11912 return er(w, I, C);
11913 }
11914 function E(w, I) {
11915 var C = w._private, B = c, F;
11916 I ? F = I + "-" : F = "", w.boundingBox();
11917 var R = C.labelBounds[I || "main"], X = w.pstyle(F + "label").value, z = w.pstyle("text-events").strValue === "yes";
11918 if (!(!z || !X)) {
11919 var re = b(C.rscratch, "labelX", I), W = b(C.rscratch, "labelY", I), Z = b(C.rscratch, "labelAngle", I), ie = w.pstyle(F + "text-margin-x").pfValue, oe = w.pstyle(F + "text-margin-y").pfValue, ge = R.x1 - B - ie, se = R.x2 + B - ie, de = R.y1 - B - oe, we = R.y2 + B - oe;
11920 if (Z) {
11921 var Te = Math.cos(Z), Ee = Math.sin(Z), ye = function(qe, Re) {
11922 return qe = qe - re, Re = Re - W, {
11923 x: qe * Te - Re * Ee + re,
11924 y: qe * Ee + Re * Te + W
11925 };
11926 }, ae = ye(ge, de), xe = ye(ge, we), Ce = ye(se, de), Oe = ye(se, we), Ie = [
11927 // with the margin added after the rotation is applied
11928 ae.x + ie,
11929 ae.y + oe,
11930 Ce.x + ie,
11931 Ce.y + oe,
11932 Oe.x + ie,
11933 Oe.y + oe,
11934 xe.x + ie,
11935 xe.y + oe
11936 ];
11937 if (Yt(t, e, Ie))
11938 return y(w), !0;
11939 } else if (ta(R, t, e))
11940 return y(w), !0;
11941 }
11942 }
11943 for (var M = s.length - 1; M >= 0; M--) {
11944 var A = s[M];
11945 A.isNode() ? p(A) || E(A) : m(A) || E(A) || E(A, "source") || E(A, "target");
11946 }
11947 return o;
11948 }, Vr.getAllInBox = function(t, e, r, a) {
11949 var n = this.getCachedZSortedEles().interactive, i = [], s = Math.min(t, r), o = Math.max(t, r), l = Math.min(e, a), u = Math.max(e, a);
11950 t = s, r = o, e = l, a = u;
11951 for (var f = Ut({
11952 x1: t,
11953 y1: e,
11954 x2: r,
11955 y2: a
11956 }), h = 0; h < n.length; h++) {
11957 var c = n[h];
11958 if (c.isNode()) {
11959 var v = c, d = v.boundingBox({
11960 includeNodes: !0,
11961 includeEdges: !1,
11962 includeLabels: !1
11963 });
11964 hi(f, d) && !xs(d, f) && i.push(v);
11965 } else {
11966 var g = c, y = g._private, p = y.rscratch;
11967 if (p.startX != null && p.startY != null && !ta(f, p.startX, p.startY) || p.endX != null && p.endY != null && !ta(f, p.endX, p.endY))
11968 continue;
11969 if (p.edgeType === "bezier" || p.edgeType === "multibezier" || p.edgeType === "self" || p.edgeType === "compound" || p.edgeType === "segments" || p.edgeType === "haystack") {
11970 for (var m = y.rstyle.bezierPts || y.rstyle.linePts || y.rstyle.haystackPts, b = !0, E = 0; E < m.length; E++)
11971 if (!Lf(f, m[E])) {
11972 b = !1;
11973 break;
11974 }
11975 b && i.push(g);
11976 } else
11977 (p.edgeType === "haystack" || p.edgeType === "straight") && i.push(g);
11978 }
11979 }
11980 return i;
11981 };
11982 var Hn = {};
11983 Hn.calculateArrowAngles = function(t) {
11984 var e = t._private.rscratch, r = e.edgeType === "haystack", a = e.edgeType === "bezier", n = e.edgeType === "multibezier", i = e.edgeType === "segments", s = e.edgeType === "compound", o = e.edgeType === "self", l, u, f, h, c, v, p, m;
11985 if (r ? (f = e.haystackPts[0], h = e.haystackPts[1], c = e.haystackPts[2], v = e.haystackPts[3]) : (f = e.arrowStartX, h = e.arrowStartY, c = e.arrowEndX, v = e.arrowEndY), p = e.midX, m = e.midY, i)
11986 l = f - e.segpts[0], u = h - e.segpts[1];
11987 else if (n || s || o || a) {
11988 var d = e.allpts, g = St(d[0], d[2], d[4], 0.1), y = St(d[1], d[3], d[5], 0.1);
11989 l = f - g, u = h - y;
11990 } else
11991 l = f - p, u = h - m;
11992 e.srcArrowAngle = gn(l, u);
11993 var p = e.midX, m = e.midY;
11994 if (r && (p = (f + c) / 2, m = (h + v) / 2), l = c - f, u = v - h, i) {
11995 var d = e.allpts;
11996 if (d.length / 2 % 2 === 0) {
11997 var b = d.length / 2, E = b - 2;
11998 l = d[b] - d[E], u = d[b + 1] - d[E + 1];
11999 } else {
12000 var b = d.length / 2 - 1, E = b - 2, M = b + 2;
12001 l = d[b] - d[E], u = d[b + 1] - d[E + 1];
12002 }
12003 } else if (n || s || o) {
12004 var d = e.allpts, A = e.ctrlpts, w, I, C, B;
12005 if (A.length / 2 % 2 === 0) {
12006 var F = d.length / 2 - 1, R = F + 2, X = R + 2;
12007 w = St(d[F], d[R], d[X], 0), I = St(d[F + 1], d[R + 1], d[X + 1], 0), C = St(d[F], d[R], d[X], 1e-4), B = St(d[F + 1], d[R + 1], d[X + 1], 1e-4);
12008 } else {
12009 var R = d.length / 2 - 1, F = R - 2, X = R + 2;
12010 w = St(d[F], d[R], d[X], 0.4999), I = St(d[F + 1], d[R + 1], d[X + 1], 0.4999), C = St(d[F], d[R], d[X], 0.5), B = St(d[F + 1], d[R + 1], d[X + 1], 0.5);
12011 }
12012 l = C - w, u = B - I;
12013 }
12014 if (e.midtgtArrowAngle = gn(l, u), e.midDispX = l, e.midDispY = u, l *= -1, u *= -1, i) {
12015 var d = e.allpts;
12016 if (d.length / 2 % 2 !== 0) {
12017 var b = d.length / 2 - 1, M = b + 2;
12018 l = -(d[M] - d[b]), u = -(d[M + 1] - d[b + 1]);
12019 }
12020 }
12021 if (e.midsrcArrowAngle = gn(l, u), i)
12022 l = c - e.segpts[e.segpts.length - 2], u = v - e.segpts[e.segpts.length - 1];
12023 else if (n || s || o || a) {
12024 var d = e.allpts, z = d.length, g = St(d[z - 6], d[z - 4], d[z - 2], 0.9), y = St(d[z - 5], d[z - 3], d[z - 1], 0.9);
12025 l = c - g, u = v - y;
12026 } else
12027 l = c - p, u = v - m;
12028 e.tgtArrowAngle = gn(l, u);
12029 }, Hn.getArrowWidth = Hn.getArrowHeight = function(t, e) {
12030 var r = this.arrowWidthCache = this.arrowWidthCache || {}, a = r[t + ", " + e];
12031 return a || (a = Math.max(Math.pow(t * 13.37, 0.9), 29) * e, r[t + ", " + e] = a, a);
12032 };
12033 var Vt = {};
12034 Vt.findHaystackPoints = function(t) {
12035 for (var e = 0; e < t.length; e++) {
12036 var r = t[e], a = r._private, n = a.rscratch;
12037 if (!n.haystack) {
12038 var i = Math.random() * 2 * Math.PI;
12039 n.source = {
12040 x: Math.cos(i),
12041 y: Math.sin(i)
12042 }, i = Math.random() * 2 * Math.PI, n.target = {
12043 x: Math.cos(i),
12044 y: Math.sin(i)
12045 };
12046 }
12047 var s = a.source, o = a.target, l = s.position(), u = o.position(), f = s.width(), h = o.width(), c = s.height(), v = o.height(), d = r.pstyle("haystack-radius").value, g = d / 2;
12048 n.haystackPts = n.allpts = [n.source.x * f * g + l.x, n.source.y * c * g + l.y, n.target.x * h * g + u.x, n.target.y * v * g + u.y], n.midX = (n.allpts[0] + n.allpts[2]) / 2, n.midY = (n.allpts[1] + n.allpts[3]) / 2, n.edgeType = "haystack", n.haystack = !0, this.storeEdgeProjections(r), this.calculateArrowAngles(r), this.recalculateEdgeLabelProjections(r), this.calculateLabelAngles(r);
12049 }
12050 }, Vt.findSegmentsPoints = function(t, e) {
12051 var r = t._private.rscratch, a = e.posPts, n = e.intersectionPts, i = e.vectorNormInverse, s = t.pstyle("edge-distances").value, o = t.pstyle("segment-weights"), l = t.pstyle("segment-distances"), u = Math.min(o.pfValue.length, l.pfValue.length);
12052 r.edgeType = "segments", r.segpts = [];
12053 for (var f = 0; f < u; f++) {
12054 var h = o.pfValue[f], c = l.pfValue[f], v = 1 - h, d = h, g = s === "node-position" ? a : n, y = {
12055 x: g.x1 * v + g.x2 * d,
12056 y: g.y1 * v + g.y2 * d
12057 };
12058 r.segpts.push(y.x + i.x * c, y.y + i.y * c);
12059 }
12060 }, Vt.findLoopPoints = function(t, e, r, a) {
12061 var n = t._private.rscratch, i = e.dirCounts, s = e.srcPos, o = t.pstyle("control-point-distances"), l = o ? o.pfValue[0] : void 0, u = t.pstyle("loop-direction").pfValue, f = t.pstyle("loop-sweep").pfValue, h = t.pstyle("control-point-step-size").pfValue;
12062 n.edgeType = "self";
12063 var c = r, v = h;
12064 a && (c = 0, v = l);
12065 var d = u - Math.PI / 2, g = d - f / 2, y = d + f / 2, p = u + "_" + f;
12066 c = i[p] === void 0 ? i[p] = 0 : ++i[p], n.ctrlpts = [s.x + Math.cos(g) * 1.4 * v * (c / 3 + 1), s.y + Math.sin(g) * 1.4 * v * (c / 3 + 1), s.x + Math.cos(y) * 1.4 * v * (c / 3 + 1), s.y + Math.sin(y) * 1.4 * v * (c / 3 + 1)];
12067 }, Vt.findCompoundLoopPoints = function(t, e, r, a) {
12068 var n = t._private.rscratch;
12069 n.edgeType = "compound";
12070 var i = e.srcPos, s = e.tgtPos, o = e.srcW, l = e.srcH, u = e.tgtW, f = e.tgtH, h = t.pstyle("control-point-step-size").pfValue, c = t.pstyle("control-point-distances"), v = c ? c.pfValue[0] : void 0, d = r, g = h;
12071 a && (d = 0, g = v);
12072 var y = 50, p = {
12073 x: i.x - o / 2,
12074 y: i.y - l / 2
12075 }, m = {
12076 x: s.x - u / 2,
12077 y: s.y - f / 2
12078 }, b = {
12079 x: Math.min(p.x, m.x),
12080 y: Math.min(p.y, m.y)
12081 }, E = 0.5, M = Math.max(E, Math.log(o * 0.01)), A = Math.max(E, Math.log(u * 0.01));
12082 n.ctrlpts = [b.x, b.y - (1 + Math.pow(y, 1.12) / 100) * g * (d / 3 + 1) * M, b.x - (1 + Math.pow(y, 1.12) / 100) * g * (d / 3 + 1) * A, b.y];
12083 }, Vt.findStraightEdgePoints = function(t) {
12084 t._private.rscratch.edgeType = "straight";
12085 }, Vt.findBezierPoints = function(t, e, r, a, n) {
12086 var i = t._private.rscratch, s = e.vectorNormInverse, o = e.posPts, l = e.intersectionPts, u = t.pstyle("edge-distances").value, f = t.pstyle("control-point-step-size").pfValue, h = t.pstyle("control-point-distances"), c = t.pstyle("control-point-weights"), v = h && c ? Math.min(h.value.length, c.value.length) : 1, d = h ? h.pfValue[0] : void 0, g = c.value[0], y = a;
12087 i.edgeType = y ? "multibezier" : "bezier", i.ctrlpts = [];
12088 for (var p = 0; p < v; p++) {
12089 var m = (0.5 - e.eles.length / 2 + r) * f * (n ? -1 : 1), b = void 0, E = Es(m);
12090 y && (d = h ? h.pfValue[p] : f, g = c.value[p]), a ? b = d : b = d !== void 0 ? E * d : void 0;
12091 var M = b !== void 0 ? b : m, A = 1 - g, w = g, I = u === "node-position" ? o : l, C = {
12092 x: I.x1 * A + I.x2 * w,
12093 y: I.y1 * A + I.y2 * w
12094 };
12095 i.ctrlpts.push(C.x + s.x * M, C.y + s.y * M);
12096 }
12097 }, Vt.findTaxiPoints = function(t, e) {
12098 var r = t._private.rscratch;
12099 r.edgeType = "segments";
12100 var a = "vertical", n = "horizontal", i = "leftward", s = "rightward", o = "downward", l = "upward", u = "auto", f = e.posPts, h = e.srcW, c = e.srcH, v = e.tgtW, d = e.tgtH, g = t.pstyle("edge-distances").value, y = g !== "node-position", p = t.pstyle("taxi-direction").value, m = p, b = t.pstyle("taxi-turn"), E = b.units === "%", M = b.pfValue, A = M < 0, w = t.pstyle("taxi-turn-min-distance").pfValue, I = y ? (h + v) / 2 : 0, C = y ? (c + d) / 2 : 0, B = f.x2 - f.x1, F = f.y2 - f.y1, R = function(ze, at) {
12101 return ze > 0 ? Math.max(ze - at, 0) : Math.min(ze + at, 0);
12102 }, X = R(B, I), z = R(F, C), re = !1;
12103 m === u ? p = Math.abs(X) > Math.abs(z) ? n : a : m === l || m === o ? (p = a, re = !0) : (m === i || m === s) && (p = n, re = !0);
12104 var W = p === a, Z = W ? z : X, ie = W ? F : B, oe = Es(ie), ge = !1;
12105 !(re && (E || A)) && (m === o && ie < 0 || m === l && ie > 0 || m === i && ie > 0 || m === s && ie < 0) && (oe *= -1, Z = oe * Math.abs(Z), ge = !0);
12106 var se;
12107 if (E) {
12108 var de = M < 0 ? 1 + M : M;
12109 se = de * Z;
12110 } else {
12111 var we = M < 0 ? Z : 0;
12112 se = we + M * oe;
12113 }
12114 var Te = function(ze) {
12115 return Math.abs(ze) < w || Math.abs(ze) >= Math.abs(Z);
12116 }, Ee = Te(se), ye = Te(Math.abs(Z) - Math.abs(se)), ae = Ee || ye;
12117 if (ae && !ge)
12118 if (W) {
12119 var xe = Math.abs(ie) <= c / 2, Ce = Math.abs(B) <= v / 2;
12120 if (xe) {
12121 var Oe = (f.x1 + f.x2) / 2, Ie = f.y1, He = f.y2;
12122 r.segpts = [Oe, Ie, Oe, He];
12123 } else if (Ce) {
12124 var qe = (f.y1 + f.y2) / 2, Re = f.x1, Me = f.x2;
12125 r.segpts = [Re, qe, Me, qe];
12126 } else
12127 r.segpts = [f.x1, f.y2];
12128 } else {
12129 var Ve = Math.abs(ie) <= h / 2, Fe = Math.abs(F) <= d / 2;
12130 if (Ve) {
12131 var ke = (f.y1 + f.y2) / 2, Ge = f.x1, et = f.x2;
12132 r.segpts = [Ge, ke, et, ke];
12133 } else if (Fe) {
12134 var We = (f.x1 + f.x2) / 2, Ye = f.y1, Se = f.y2;
12135 r.segpts = [We, Ye, We, Se];
12136 } else
12137 r.segpts = [f.x2, f.y1];
12138 }
12139 else if (W) {
12140 var N = f.y1 + se + (y ? c / 2 * oe : 0), le = f.x1, De = f.x2;
12141 r.segpts = [le, N, De, N];
12142 } else {
12143 var me = f.x1 + se + (y ? h / 2 * oe : 0), be = f.y1, Ke = f.y2;
12144 r.segpts = [me, be, me, Ke];
12145 }
12146 }, Vt.tryToCorrectInvalidPoints = function(t, e) {
12147 var r = t._private.rscratch;
12148 if (r.edgeType === "bezier") {
12149 var a = e.srcPos, n = e.tgtPos, i = e.srcW, s = e.srcH, o = e.tgtW, l = e.tgtH, u = e.srcShape, f = e.tgtShape, h = !k(r.startX) || !k(r.startY), c = !k(r.arrowStartX) || !k(r.arrowStartY), v = !k(r.endX) || !k(r.endY), d = !k(r.arrowEndX) || !k(r.arrowEndY), g = 3, y = this.getArrowWidth(t.pstyle("width").pfValue, t.pstyle("arrow-scale").value) * this.arrowShapeWidth, p = g * y, m = Pr({
12150 x: r.ctrlpts[0],
12151 y: r.ctrlpts[1]
12152 }, {
12153 x: r.startX,
12154 y: r.startY
12155 }), b = m < p, E = Pr({
12156 x: r.ctrlpts[0],
12157 y: r.ctrlpts[1]
12158 }, {
12159 x: r.endX,
12160 y: r.endY
12161 }), M = E < p, A = !1;
12162 if (h || c || b) {
12163 A = !0;
12164 var w = {
12165 // delta
12166 x: r.ctrlpts[0] - a.x,
12167 y: r.ctrlpts[1] - a.y
12168 }, I = Math.sqrt(w.x * w.x + w.y * w.y), C = {
12169 // normalised delta
12170 x: w.x / I,
12171 y: w.y / I
12172 }, B = Math.max(i, s), F = {
12173 // *2 radius guarantees outside shape
12174 x: r.ctrlpts[0] + C.x * 2 * B,
12175 y: r.ctrlpts[1] + C.y * 2 * B
12176 }, R = u.intersectLine(a.x, a.y, i, s, F.x, F.y, 0);
12177 b ? (r.ctrlpts[0] = r.ctrlpts[0] + C.x * (p - m), r.ctrlpts[1] = r.ctrlpts[1] + C.y * (p - m)) : (r.ctrlpts[0] = R[0] + C.x * p, r.ctrlpts[1] = R[1] + C.y * p);
12178 }
12179 if (v || d || M) {
12180 A = !0;
12181 var X = {
12182 // delta
12183 x: r.ctrlpts[0] - n.x,
12184 y: r.ctrlpts[1] - n.y
12185 }, z = Math.sqrt(X.x * X.x + X.y * X.y), re = {
12186 // normalised delta
12187 x: X.x / z,
12188 y: X.y / z
12189 }, W = Math.max(i, s), Z = {
12190 // *2 radius guarantees outside shape
12191 x: r.ctrlpts[0] + re.x * 2 * W,
12192 y: r.ctrlpts[1] + re.y * 2 * W
12193 }, ie = f.intersectLine(n.x, n.y, o, l, Z.x, Z.y, 0);
12194 M ? (r.ctrlpts[0] = r.ctrlpts[0] + re.x * (p - E), r.ctrlpts[1] = r.ctrlpts[1] + re.y * (p - E)) : (r.ctrlpts[0] = ie[0] + re.x * p, r.ctrlpts[1] = ie[1] + re.y * p);
12195 }
12196 A && this.findEndpoints(t);
12197 }
12198 }, Vt.storeAllpts = function(t) {
12199 var e = t._private.rscratch;
12200 if (e.edgeType === "multibezier" || e.edgeType === "bezier" || e.edgeType === "self" || e.edgeType === "compound") {
12201 e.allpts = [], e.allpts.push(e.startX, e.startY);
12202 for (var r = 0; r + 1 < e.ctrlpts.length; r += 2)
12203 e.allpts.push(e.ctrlpts[r], e.ctrlpts[r + 1]), r + 3 < e.ctrlpts.length && e.allpts.push((e.ctrlpts[r] + e.ctrlpts[r + 2]) / 2, (e.ctrlpts[r + 1] + e.ctrlpts[r + 3]) / 2);
12204 e.allpts.push(e.endX, e.endY);
12205 var a, n;
12206 e.ctrlpts.length / 2 % 2 === 0 ? (a = e.allpts.length / 2 - 1, e.midX = e.allpts[a], e.midY = e.allpts[a + 1]) : (a = e.allpts.length / 2 - 3, n = 0.5, e.midX = St(e.allpts[a], e.allpts[a + 2], e.allpts[a + 4], n), e.midY = St(e.allpts[a + 1], e.allpts[a + 3], e.allpts[a + 5], n));
12207 } else if (e.edgeType === "straight")
12208 e.allpts = [e.startX, e.startY, e.endX, e.endY], e.midX = (e.startX + e.endX + e.arrowStartX + e.arrowEndX) / 4, e.midY = (e.startY + e.endY + e.arrowStartY + e.arrowEndY) / 4;
12209 else if (e.edgeType === "segments")
12210 if (e.allpts = [], e.allpts.push(e.startX, e.startY), e.allpts.push.apply(e.allpts, e.segpts), e.allpts.push(e.endX, e.endY), e.segpts.length % 4 === 0) {
12211 var i = e.segpts.length / 2, s = i - 2;
12212 e.midX = (e.segpts[s] + e.segpts[i]) / 2, e.midY = (e.segpts[s + 1] + e.segpts[i + 1]) / 2;
12213 } else {
12214 var o = e.segpts.length / 2 - 1;
12215 e.midX = e.segpts[o], e.midY = e.segpts[o + 1];
12216 }
12217 }, Vt.checkForInvalidEdgeWarning = function(t) {
12218 var e = t[0]._private.rscratch;
12219 e.nodesOverlap || k(e.startX) && k(e.startY) && k(e.endX) && k(e.endY) ? e.loggedErr = !1 : e.loggedErr || (e.loggedErr = !0, ft("Edge `" + t.id() + "` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."));
12220 }, Vt.findEdgeControlPoints = function(t) {
12221 var e = this;
12222 if (!(!t || t.length === 0)) {
12223 for (var r = this, a = r.cy, n = a.hasCompoundNodes(), i = {
12224 map: new ur(),
12225 get: function(w) {
12226 var I = this.map.get(w[0]);
12227 return I != null ? I.get(w[1]) : null;
12228 },
12229 set: function(w, I) {
12230 var C = this.map.get(w[0]);
12231 C == null && (C = new ur(), this.map.set(w[0], C)), C.set(w[1], I);
12232 }
12233 }, s = [], o = [], l = 0; l < t.length; l++) {
12234 var u = t[l], f = u._private, h = u.pstyle("curve-style").value;
12235 if (!(u.removed() || !u.takesUpSpace())) {
12236 if (h === "haystack") {
12237 o.push(u);
12238 continue;
12239 }
12240 var c = h === "unbundled-bezier" || h === "segments" || h === "straight" || h === "straight-triangle" || h === "taxi", v = h === "unbundled-bezier" || h === "bezier", d = f.source, g = f.target, y = d.poolIndex(), p = g.poolIndex(), m = [y, p].sort(), b = i.get(m);
12241 b == null && (b = {
12242 eles: []
12243 }, i.set(m, b), s.push(m)), b.eles.push(u), c && (b.hasUnbundled = !0), v && (b.hasBezier = !0);
12244 }
12245 }
12246 for (var E = function(w) {
12247 var I = s[w], C = i.get(I), B = void 0;
12248 if (!C.hasUnbundled) {
12249 var F = C.eles[0].parallelEdges().filter(function(Se) {
12250 return Se.isBundledBezier();
12251 });
12252 oi(C.eles), F.forEach(function(Se) {
12253 return C.eles.push(Se);
12254 }), C.eles.sort(function(Se, N) {
12255 return Se.poolIndex() - N.poolIndex();
12256 });
12257 }
12258 var R = C.eles[0], X = R.source(), z = R.target();
12259 if (X.poolIndex() > z.poolIndex()) {
12260 var re = X;
12261 X = z, z = re;
12262 }
12263 var W = C.srcPos = X.position(), Z = C.tgtPos = z.position(), ie = C.srcW = X.outerWidth(), oe = C.srcH = X.outerHeight(), ge = C.tgtW = z.outerWidth(), se = C.tgtH = z.outerHeight(), de = C.srcShape = r.nodeShapes[e.getNodeShape(X)], we = C.tgtShape = r.nodeShapes[e.getNodeShape(z)];
12264 C.dirCounts = {
12265 north: 0,
12266 west: 0,
12267 south: 0,
12268 east: 0,
12269 northwest: 0,
12270 southwest: 0,
12271 northeast: 0,
12272 southeast: 0
12273 };
12274 for (var Te = 0; Te < C.eles.length; Te++) {
12275 var Ee = C.eles[Te], ye = Ee[0]._private.rscratch, ae = Ee.pstyle("curve-style").value, xe = ae === "unbundled-bezier" || ae === "segments" || ae === "taxi", Ce = !X.same(Ee.source());
12276 if (!C.calculatedIntersection && X !== z && (C.hasBezier || C.hasUnbundled)) {
12277 C.calculatedIntersection = !0;
12278 var Oe = de.intersectLine(W.x, W.y, ie, oe, Z.x, Z.y, 0), Ie = C.srcIntn = Oe, He = we.intersectLine(Z.x, Z.y, ge, se, W.x, W.y, 0), qe = C.tgtIntn = He, Re = C.intersectionPts = {
12279 x1: Oe[0],
12280 x2: He[0],
12281 y1: Oe[1],
12282 y2: He[1]
12283 }, Me = C.posPts = {
12284 x1: W.x,
12285 x2: Z.x,
12286 y1: W.y,
12287 y2: Z.y
12288 }, Ve = He[1] - Oe[1], Fe = He[0] - Oe[0], ke = Math.sqrt(Fe * Fe + Ve * Ve), Ge = C.vector = {
12289 x: Fe,
12290 y: Ve
12291 }, et = C.vectorNorm = {
12292 x: Ge.x / ke,
12293 y: Ge.y / ke
12294 }, We = {
12295 x: -et.y,
12296 y: et.x
12297 };
12298 C.nodesOverlap = !k(ke) || we.checkPoint(Oe[0], Oe[1], 0, ge, se, Z.x, Z.y) || de.checkPoint(He[0], He[1], 0, ie, oe, W.x, W.y), C.vectorNormInverse = We, B = {
12299 nodesOverlap: C.nodesOverlap,
12300 dirCounts: C.dirCounts,
12301 calculatedIntersection: !0,
12302 hasBezier: C.hasBezier,
12303 hasUnbundled: C.hasUnbundled,
12304 eles: C.eles,
12305 srcPos: Z,
12306 tgtPos: W,
12307 srcW: ge,
12308 srcH: se,
12309 tgtW: ie,
12310 tgtH: oe,
12311 srcIntn: qe,
12312 tgtIntn: Ie,
12313 srcShape: we,
12314 tgtShape: de,
12315 posPts: {
12316 x1: Me.x2,
12317 y1: Me.y2,
12318 x2: Me.x1,
12319 y2: Me.y1
12320 },
12321 intersectionPts: {
12322 x1: Re.x2,
12323 y1: Re.y2,
12324 x2: Re.x1,
12325 y2: Re.y1
12326 },
12327 vector: {
12328 x: -Ge.x,
12329 y: -Ge.y
12330 },
12331 vectorNorm: {
12332 x: -et.x,
12333 y: -et.y
12334 },
12335 vectorNormInverse: {
12336 x: -We.x,
12337 y: -We.y
12338 }
12339 };
12340 }
12341 var Ye = Ce ? B : C;
12342 ye.nodesOverlap = Ye.nodesOverlap, ye.srcIntn = Ye.srcIntn, ye.tgtIntn = Ye.tgtIntn, n && (X.isParent() || X.isChild() || z.isParent() || z.isChild()) && (X.parents().anySame(z) || z.parents().anySame(X) || X.same(z) && X.isParent()) ? e.findCompoundLoopPoints(Ee, Ye, Te, xe) : X === z ? e.findLoopPoints(Ee, Ye, Te, xe) : ae === "segments" ? e.findSegmentsPoints(Ee, Ye) : ae === "taxi" ? e.findTaxiPoints(Ee, Ye) : ae === "straight" || !xe && C.eles.length % 2 === 1 && Te === Math.floor(C.eles.length / 2) ? e.findStraightEdgePoints(Ee) : e.findBezierPoints(Ee, Ye, Te, xe, Ce), e.findEndpoints(Ee), e.tryToCorrectInvalidPoints(Ee, Ye), e.checkForInvalidEdgeWarning(Ee), e.storeAllpts(Ee), e.storeEdgeProjections(Ee), e.calculateArrowAngles(Ee), e.recalculateEdgeLabelProjections(Ee), e.calculateLabelAngles(Ee);
12343 }
12344 }, M = 0; M < s.length; M++)
12345 E(M);
12346 this.findHaystackPoints(o);
12347 }
12348 };
12349 function iu(t) {
12350 var e = [];
12351 if (t != null) {
12352 for (var r = 0; r < t.length; r += 2) {
12353 var a = t[r], n = t[r + 1];
12354 e.push({
12355 x: a,
12356 y: n
12357 });
12358 }
12359 return e;
12360 }
12361 }
12362 Vt.getSegmentPoints = function(t) {
12363 var e = t[0]._private.rscratch, r = e.edgeType;
12364 if (r === "segments")
12365 return this.recalculateRenderedStyle(t), iu(e.segpts);
12366 }, Vt.getControlPoints = function(t) {
12367 var e = t[0]._private.rscratch, r = e.edgeType;
12368 if (r === "bezier" || r === "multibezier" || r === "self" || r === "compound")
12369 return this.recalculateRenderedStyle(t), iu(e.ctrlpts);
12370 }, Vt.getEdgeMidpoint = function(t) {
12371 var e = t[0]._private.rscratch;
12372 return this.recalculateRenderedStyle(t), {
12373 x: e.midX,
12374 y: e.midY
12375 };
12376 };
12377 var Qa = {};
12378 Qa.manualEndptToPx = function(t, e) {
12379 var r = this, a = t.position(), n = t.outerWidth(), i = t.outerHeight();
12380 if (e.value.length === 2) {
12381 var s = [e.pfValue[0], e.pfValue[1]];
12382 return e.units[0] === "%" && (s[0] = s[0] * n), e.units[1] === "%" && (s[1] = s[1] * i), s[0] += a.x, s[1] += a.y, s;
12383 } else {
12384 var o = e.pfValue[0];
12385 o = -Math.PI / 2 + o;
12386 var l = 2 * Math.max(n, i), u = [a.x + Math.cos(o) * l, a.y + Math.sin(o) * l];
12387 return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x, a.y, n, i, u[0], u[1], 0);
12388 }
12389 }, Qa.findEndpoints = function(t) {
12390 var e = this, r, a = t.source()[0], n = t.target()[0], i = a.position(), s = n.position(), o = t.pstyle("target-arrow-shape").value, l = t.pstyle("source-arrow-shape").value, u = t.pstyle("target-distance-from-node").pfValue, f = t.pstyle("source-distance-from-node").pfValue, h = t.pstyle("curve-style").value, c = t._private.rscratch, v = c.edgeType, d = h === "taxi", g = v === "self" || v === "compound", y = v === "bezier" || v === "multibezier" || g, p = v !== "bezier", m = v === "straight" || v === "segments", b = v === "segments", E = y || p || m, M = g || d, A = t.pstyle("source-endpoint"), w = M ? "outside-to-node" : A.value, I = t.pstyle("target-endpoint"), C = M ? "outside-to-node" : I.value;
12391 c.srcManEndpt = A, c.tgtManEndpt = I;
12392 var B, F, R, X;
12393 if (y) {
12394 var z = [c.ctrlpts[0], c.ctrlpts[1]], re = p ? [c.ctrlpts[c.ctrlpts.length - 2], c.ctrlpts[c.ctrlpts.length - 1]] : z;
12395 B = re, F = z;
12396 } else if (m) {
12397 var W = b ? c.segpts.slice(0, 2) : [s.x, s.y], Z = b ? c.segpts.slice(c.segpts.length - 2) : [i.x, i.y];
12398 B = Z, F = W;
12399 }
12400 if (C === "inside-to-node")
12401 r = [s.x, s.y];
12402 else if (I.units)
12403 r = this.manualEndptToPx(n, I);
12404 else if (C === "outside-to-line")
12405 r = c.tgtIntn;
12406 else if (C === "outside-to-node" || C === "outside-to-node-or-label" ? R = B : (C === "outside-to-line" || C === "outside-to-line-or-label") && (R = [i.x, i.y]), r = e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x, s.y, n.outerWidth(), n.outerHeight(), R[0], R[1], 0), C === "outside-to-node-or-label" || C === "outside-to-line-or-label") {
12407 var ie = n._private.rscratch, oe = ie.labelWidth, ge = ie.labelHeight, se = ie.labelX, de = ie.labelY, we = oe / 2, Te = ge / 2, Ee = n.pstyle("text-valign").value;
12408 Ee === "top" ? de -= Te : Ee === "bottom" && (de += Te);
12409 var ye = n.pstyle("text-halign").value;
12410 ye === "left" ? se -= we : ye === "right" && (se += we);
12411 var ae = Ba(R[0], R[1], [se - we, de - Te, se + we, de - Te, se + we, de + Te, se - we, de + Te], s.x, s.y);
12412 if (ae.length > 0) {
12413 var xe = i, Ce = Br(xe, jr(r)), Oe = Br(xe, jr(ae)), Ie = Ce;
12414 if (Oe < Ce && (r = ae, Ie = Oe), ae.length > 2) {
12415 var He = Br(xe, {
12416 x: ae[2],
12417 y: ae[3]
12418 });
12419 He < Ie && (r = [ae[2], ae[3]]);
12420 }
12421 }
12422 }
12423 var qe = yn(r, B, e.arrowShapes[o].spacing(t) + u), Re = yn(r, B, e.arrowShapes[o].gap(t) + u);
12424 if (c.endX = Re[0], c.endY = Re[1], c.arrowEndX = qe[0], c.arrowEndY = qe[1], w === "inside-to-node")
12425 r = [i.x, i.y];
12426 else if (A.units)
12427 r = this.manualEndptToPx(a, A);
12428 else if (w === "outside-to-line")
12429 r = c.srcIntn;
12430 else if (w === "outside-to-node" || w === "outside-to-node-or-label" ? X = F : (w === "outside-to-line" || w === "outside-to-line-or-label") && (X = [s.x, s.y]), r = e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x, i.y, a.outerWidth(), a.outerHeight(), X[0], X[1], 0), w === "outside-to-node-or-label" || w === "outside-to-line-or-label") {
12431 var Me = a._private.rscratch, Ve = Me.labelWidth, Fe = Me.labelHeight, ke = Me.labelX, Ge = Me.labelY, et = Ve / 2, We = Fe / 2, Ye = a.pstyle("text-valign").value;
12432 Ye === "top" ? Ge -= We : Ye === "bottom" && (Ge += We);
12433 var Se = a.pstyle("text-halign").value;
12434 Se === "left" ? ke -= et : Se === "right" && (ke += et);
12435 var N = Ba(X[0], X[1], [ke - et, Ge - We, ke + et, Ge - We, ke + et, Ge + We, ke - et, Ge + We], i.x, i.y);
12436 if (N.length > 0) {
12437 var le = s, De = Br(le, jr(r)), me = Br(le, jr(N)), be = De;
12438 if (me < De && (r = [N[0], N[1]], be = me), N.length > 2) {
12439 var Ke = Br(le, {
12440 x: N[2],
12441 y: N[3]
12442 });
12443 Ke < be && (r = [N[2], N[3]]);
12444 }
12445 }
12446 }
12447 var Le = yn(r, F, e.arrowShapes[l].spacing(t) + f), ze = yn(r, F, e.arrowShapes[l].gap(t) + f);
12448 c.startX = ze[0], c.startY = ze[1], c.arrowStartX = Le[0], c.arrowStartY = Le[1], E && (!k(c.startX) || !k(c.startY) || !k(c.endX) || !k(c.endY) ? c.badLine = !0 : c.badLine = !1);
12449 }, Qa.getSourceEndpoint = function(t) {
12450 var e = t[0]._private.rscratch;
12451 switch (this.recalculateRenderedStyle(t), e.edgeType) {
12452 case "haystack":
12453 return {
12454 x: e.haystackPts[0],
12455 y: e.haystackPts[1]
12456 };
12457 default:
12458 return {
12459 x: e.arrowStartX,
12460 y: e.arrowStartY
12461 };
12462 }
12463 }, Qa.getTargetEndpoint = function(t) {
12464 var e = t[0]._private.rscratch;
12465 switch (this.recalculateRenderedStyle(t), e.edgeType) {
12466 case "haystack":
12467 return {
12468 x: e.haystackPts[2],
12469 y: e.haystackPts[3]
12470 };
12471 default:
12472 return {
12473 x: e.arrowEndX,
12474 y: e.arrowEndY
12475 };
12476 }
12477 };
12478 var Gi = {};
12479 function cg(t, e, r) {
12480 for (var a = function(u, f, h, c) {
12481 return St(u, f, h, c);
12482 }, n = e._private, i = n.rstyle.bezierPts, s = 0; s < t.bezierProjPcts.length; s++) {
12483 var o = t.bezierProjPcts[s];
12484 i.push({
12485 x: a(r[0], r[2], r[4], o),
12486 y: a(r[1], r[3], r[5], o)
12487 });
12488 }
12489 }
12490 Gi.storeEdgeProjections = function(t) {
12491 var e = t._private, r = e.rscratch, a = r.edgeType;
12492 if (e.rstyle.bezierPts = null, e.rstyle.linePts = null, e.rstyle.haystackPts = null, a === "multibezier" || a === "bezier" || a === "self" || a === "compound") {
12493 e.rstyle.bezierPts = [];
12494 for (var n = 0; n + 5 < r.allpts.length; n += 4)
12495 cg(this, t, r.allpts.slice(n, n + 6));
12496 } else if (a === "segments")
12497 for (var i = e.rstyle.linePts = [], n = 0; n + 1 < r.allpts.length; n += 2)
12498 i.push({
12499 x: r.allpts[n],
12500 y: r.allpts[n + 1]
12501 });
12502 else if (a === "haystack") {
12503 var s = r.haystackPts;
12504 e.rstyle.haystackPts = [{
12505 x: s[0],
12506 y: s[1]
12507 }, {
12508 x: s[2],
12509 y: s[3]
12510 }];
12511 }
12512 e.rstyle.arrowWidth = this.getArrowWidth(t.pstyle("width").pfValue, t.pstyle("arrow-scale").value) * this.arrowShapeWidth;
12513 }, Gi.recalculateEdgeProjections = function(t) {
12514 this.findEdgeControlPoints(t);
12515 };
12516 var fr = {};
12517 fr.recalculateNodeLabelProjection = function(t) {
12518 var e = t.pstyle("label").strValue;
12519 if (!Pe(e)) {
12520 var r, a, n = t._private, i = t.width(), s = t.height(), o = t.padding(), l = t.position(), u = t.pstyle("text-halign").strValue, f = t.pstyle("text-valign").strValue, h = n.rscratch, c = n.rstyle;
12521 switch (u) {
12522 case "left":
12523 r = l.x - i / 2 - o;
12524 break;
12525 case "right":
12526 r = l.x + i / 2 + o;
12527 break;
12528 default:
12529 r = l.x;
12530 }
12531 switch (f) {
12532 case "top":
12533 a = l.y - s / 2 - o;
12534 break;
12535 case "bottom":
12536 a = l.y + s / 2 + o;
12537 break;
12538 default:
12539 a = l.y;
12540 }
12541 h.labelX = r, h.labelY = a, c.labelX = r, c.labelY = a, this.calculateLabelAngles(t), this.applyLabelDimensions(t);
12542 }
12543 };
12544 var su = function(e, r) {
12545 var a = Math.atan(r / e);
12546 return e === 0 && a < 0 && (a = a * -1), a;
12547 }, ou = function(e, r) {
12548 var a = r.x - e.x, n = r.y - e.y;
12549 return su(a, n);
12550 }, vg = function(e, r, a, n) {
12551 var i = ka(0, n - 1e-3, 1), s = ka(0, n + 1e-3, 1), o = ea(e, r, a, i), l = ea(e, r, a, s);
12552 return ou(o, l);
12553 };
12554 fr.recalculateEdgeLabelProjections = function(t) {
12555 var e, r = t._private, a = r.rscratch, n = this, i = {
12556 mid: t.pstyle("label").strValue,
12557 source: t.pstyle("source-label").strValue,
12558 target: t.pstyle("target-label").strValue
12559 };
12560 if (i.mid || i.source || i.target) {
12561 e = {
12562 x: a.midX,
12563 y: a.midY
12564 };
12565 var s = function(h, c, v) {
12566 xr(r.rscratch, h, c, v), xr(r.rstyle, h, c, v);
12567 };
12568 s("labelX", null, e.x), s("labelY", null, e.y);
12569 var o = su(a.midDispX, a.midDispY);
12570 s("labelAutoAngle", null, o);
12571 var l = function f() {
12572 if (f.cache)
12573 return f.cache;
12574 for (var h = [], c = 0; c + 5 < a.allpts.length; c += 4) {
12575 var v = {
12576 x: a.allpts[c],
12577 y: a.allpts[c + 1]
12578 }, d = {
12579 x: a.allpts[c + 2],
12580 y: a.allpts[c + 3]
12581 }, g = {
12582 x: a.allpts[c + 4],
12583 y: a.allpts[c + 5]
12584 };
12585 h.push({
12586 p0: v,
12587 p1: d,
12588 p2: g,
12589 startDist: 0,
12590 length: 0,
12591 segments: []
12592 });
12593 }
12594 var y = r.rstyle.bezierPts, p = n.bezierProjPcts.length;
12595 function m(w, I, C, B, F) {
12596 var R = Pr(I, C), X = w.segments[w.segments.length - 1], z = {
12597 p0: I,
12598 p1: C,
12599 t0: B,
12600 t1: F,
12601 startDist: X ? X.startDist + X.length : 0,
12602 length: R
12603 };
12604 w.segments.push(z), w.length += R;
12605 }
12606 for (var b = 0; b < h.length; b++) {
12607 var E = h[b], M = h[b - 1];
12608 M && (E.startDist = M.startDist + M.length), m(E, E.p0, y[b * p], 0, n.bezierProjPcts[0]);
12609 for (var A = 0; A < p - 1; A++)
12610 m(E, y[b * p + A], y[b * p + A + 1], n.bezierProjPcts[A], n.bezierProjPcts[A + 1]);
12611 m(E, y[b * p + p - 1], E.p2, n.bezierProjPcts[p - 1], 1);
12612 }
12613 return f.cache = h;
12614 }, u = function(h) {
12615 var c, v = h === "source";
12616 if (i[h]) {
12617 var d = t.pstyle(h + "-text-offset").pfValue;
12618 switch (a.edgeType) {
12619 case "self":
12620 case "compound":
12621 case "bezier":
12622 case "multibezier": {
12623 for (var g = l(), y, p = 0, m = 0, b = 0; b < g.length; b++) {
12624 for (var E = g[v ? b : g.length - 1 - b], M = 0; M < E.segments.length; M++) {
12625 var A = E.segments[v ? M : E.segments.length - 1 - M], w = b === g.length - 1 && M === E.segments.length - 1;
12626 if (p = m, m += A.length, m >= d || w) {
12627 y = {
12628 cp: E,
12629 segment: A
12630 };
12631 break;
12632 }
12633 }
12634 if (y)
12635 break;
12636 }
12637 var I = y.cp, C = y.segment, B = (d - p) / C.length, F = C.t1 - C.t0, R = v ? C.t0 + F * B : C.t1 - F * B;
12638 R = ka(0, R, 1), e = ea(I.p0, I.p1, I.p2, R), c = vg(I.p0, I.p1, I.p2, R);
12639 break;
12640 }
12641 case "straight":
12642 case "segments":
12643 case "haystack": {
12644 for (var X = 0, z, re, W, Z, ie = a.allpts.length, oe = 0; oe + 3 < ie && (v ? (W = {
12645 x: a.allpts[oe],
12646 y: a.allpts[oe + 1]
12647 }, Z = {
12648 x: a.allpts[oe + 2],
12649 y: a.allpts[oe + 3]
12650 }) : (W = {
12651 x: a.allpts[ie - 2 - oe],
12652 y: a.allpts[ie - 1 - oe]
12653 }, Z = {
12654 x: a.allpts[ie - 4 - oe],
12655 y: a.allpts[ie - 3 - oe]
12656 }), z = Pr(W, Z), re = X, X += z, !(X >= d)); oe += 2)
12657 ;
12658 var ge = d - re, se = ge / z;
12659 se = ka(0, se, 1), e = xf(W, Z, se), c = ou(W, Z);
12660 break;
12661 }
12662 }
12663 s("labelX", h, e.x), s("labelY", h, e.y), s("labelAutoAngle", h, c);
12664 }
12665 };
12666 u("source"), u("target"), this.applyLabelDimensions(t);
12667 }
12668 }, fr.applyLabelDimensions = function(t) {
12669 this.applyPrefixedLabelDimensions(t), t.isEdge() && (this.applyPrefixedLabelDimensions(t, "source"), this.applyPrefixedLabelDimensions(t, "target"));
12670 }, fr.applyPrefixedLabelDimensions = function(t, e) {
12671 var r = t._private, a = this.getLabelText(t, e), n = this.calculateLabelDimensions(t, a), i = t.pstyle("line-height").pfValue, s = t.pstyle("text-wrap").strValue, o = er(r.rscratch, "labelWrapCachedLines", e) || [], l = s !== "wrap" ? 1 : Math.max(o.length, 1), u = n.height / l, f = u * i, h = n.width, c = n.height + (l - 1) * (i - 1) * u;
12672 xr(r.rstyle, "labelWidth", e, h), xr(r.rscratch, "labelWidth", e, h), xr(r.rstyle, "labelHeight", e, c), xr(r.rscratch, "labelHeight", e, c), xr(r.rscratch, "labelLineHeight", e, f);
12673 }, fr.getLabelText = function(t, e) {
12674 var r = t._private, a = e ? e + "-" : "", n = t.pstyle(a + "label").strValue, i = t.pstyle("text-transform").value, s = function(ge, se) {
12675 return se ? (xr(r.rscratch, ge, e, se), se) : er(r.rscratch, ge, e);
12676 };
12677 if (!n)
12678 return "";
12679 i == "none" || (i == "uppercase" ? n = n.toUpperCase() : i == "lowercase" && (n = n.toLowerCase()));
12680 var o = t.pstyle("text-wrap").value;
12681 if (o === "wrap") {
12682 var l = s("labelKey");
12683 if (l != null && s("labelWrapKey") === l)
12684 return s("labelWrapCachedText");
12685 for (var u = "​", f = n.split(`
12686`), h = t.pstyle("text-max-width").pfValue, c = t.pstyle("text-overflow-wrap").value, v = c === "anywhere", d = [], g = /[\s\u200b]+/, y = v ? "" : " ", p = 0; p < f.length; p++) {
12687 var m = f[p], b = this.calculateLabelDimensions(t, m), E = b.width;
12688 if (v) {
12689 var M = m.split("").join(u);
12690 m = M;
12691 }
12692 if (E > h) {
12693 for (var A = m.split(g), w = "", I = 0; I < A.length; I++) {
12694 var C = A[I], B = w.length === 0 ? C : w + y + C, F = this.calculateLabelDimensions(t, B), R = F.width;
12695 R <= h ? w += C + y : (w && d.push(w), w = C + y);
12696 }
12697 w.match(/^[\s\u200b]+$/) || d.push(w);
12698 } else
12699 d.push(m);
12700 }
12701 s("labelWrapCachedLines", d), n = s("labelWrapCachedText", d.join(`
12702`)), s("labelWrapKey", l);
12703 } else if (o === "ellipsis") {
12704 var X = t.pstyle("text-max-width").pfValue, z = "", re = "…", W = !1;
12705 if (this.calculateLabelDimensions(t, n).width < X)
12706 return n;
12707 for (var Z = 0; Z < n.length; Z++) {
12708 var ie = this.calculateLabelDimensions(t, z + n[Z] + re).width;
12709 if (ie > X)
12710 break;
12711 z += n[Z], Z === n.length - 1 && (W = !0);
12712 }
12713 return W || (z += re), z;
12714 }
12715 return n;
12716 }, fr.getLabelJustification = function(t) {
12717 var e = t.pstyle("text-justification").strValue, r = t.pstyle("text-halign").strValue;
12718 if (e === "auto")
12719 if (t.isNode())
12720 switch (r) {
12721 case "left":
12722 return "right";
12723 case "right":
12724 return "left";
12725 default:
12726 return "center";
12727 }
12728 else
12729 return "center";
12730 else
12731 return e;
12732 }, fr.calculateLabelDimensions = function(t, e) {
12733 var r = this, a = kr(e, t._private.labelDimsKey), n = r.labelDimCache || (r.labelDimCache = []), i = n[a];
12734 if (i != null)
12735 return i;
12736 var s = 0, o = t.pstyle("font-style").strValue, l = t.pstyle("font-size").pfValue, u = t.pstyle("font-family").strValue, f = t.pstyle("font-weight").strValue, h = this.labelCalcCanvas, c = this.labelCalcCanvasContext;
12737 if (!h) {
12738 h = this.labelCalcCanvas = document.createElement("canvas"), c = this.labelCalcCanvasContext = h.getContext("2d");
12739 var v = h.style;
12740 v.position = "absolute", v.left = "-9999px", v.top = "-9999px", v.zIndex = "-1", v.visibility = "hidden", v.pointerEvents = "none";
12741 }
12742 c.font = "".concat(o, " ").concat(f, " ").concat(l, "px ").concat(u);
12743 for (var d = 0, g = 0, y = e.split(`
12744`), p = 0; p < y.length; p++) {
12745 var m = y[p], b = c.measureText(m), E = Math.ceil(b.width), M = l;
12746 d = Math.max(E, d), g += M;
12747 }
12748 return d += s, g += s, n[a] = {
12749 width: d,
12750 height: g
12751 };
12752 }, fr.calculateLabelAngle = function(t, e) {
12753 var r = t._private, a = r.rscratch, n = t.isEdge(), i = e ? e + "-" : "", s = t.pstyle(i + "text-rotation"), o = s.strValue;
12754 return o === "none" ? 0 : n && o === "autorotate" ? a.labelAutoAngle : o === "autorotate" ? 0 : s.pfValue;
12755 }, fr.calculateLabelAngles = function(t) {
12756 var e = this, r = t.isEdge(), a = t._private, n = a.rscratch;
12757 n.labelAngle = e.calculateLabelAngle(t), r && (n.sourceLabelAngle = e.calculateLabelAngle(t, "source"), n.targetLabelAngle = e.calculateLabelAngle(t, "target"));
12758 };
12759 var uu = {}, lu = 28, fu = !1;
12760 uu.getNodeShape = function(t) {
12761 var e = this, r = t.pstyle("shape").value;
12762 if (r === "cutrectangle" && (t.width() < lu || t.height() < lu))
12763 return fu || (ft("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"), fu = !0), "rectangle";
12764 if (t.isParent())
12765 return r === "rectangle" || r === "roundrectangle" || r === "round-rectangle" || r === "cutrectangle" || r === "cut-rectangle" || r === "barrel" ? r : "rectangle";
12766 if (r === "polygon") {
12767 var a = t.pstyle("shape-polygon-points").value;
12768 return e.nodeShapes.makePolygon(a).name;
12769 }
12770 return r;
12771 };
12772 var Xn = {};
12773 Xn.registerCalculationListeners = function() {
12774 var t = this.cy, e = t.collection(), r = this, a = function(s) {
12775 var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
12776 if (e.merge(s), o)
12777 for (var l = 0; l < s.length; l++) {
12778 var u = s[l], f = u._private, h = f.rstyle;
12779 h.clean = !1, h.cleanConnected = !1;
12780 }
12781 };
12782 r.binder(t).on("bounds.* dirty.*", function(s) {
12783 var o = s.target;
12784 a(o);
12785 }).on("style.* background.*", function(s) {
12786 var o = s.target;
12787 a(o, !1);
12788 });
12789 var n = function(s) {
12790 if (s) {
12791 var o = r.onUpdateEleCalcsFns;
12792 e.cleanStyle();
12793 for (var l = 0; l < e.length; l++) {
12794 var u = e[l], f = u._private.rstyle;
12795 u.isNode() && !f.cleanConnected && (a(u.connectedEdges()), f.cleanConnected = !0);
12796 }
12797 if (o)
12798 for (var h = 0; h < o.length; h++) {
12799 var c = o[h];
12800 c(s, e);
12801 }
12802 r.recalculateRenderedStyle(e), e = t.collection();
12803 }
12804 };
12805 r.flushRenderedStyleQueue = function() {
12806 n(!0);
12807 }, r.beforeRender(n, r.beforeRenderPriorities.eleCalcs);
12808 }, Xn.onUpdateEleCalcs = function(t) {
12809 var e = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || [];
12810 e.push(t);
12811 }, Xn.recalculateRenderedStyle = function(t, e) {
12812 var r = function(E) {
12813 return E._private.rstyle.cleanConnected;
12814 }, a = [], n = [];
12815 if (!this.destroyed) {
12816 e === void 0 && (e = !0);
12817 for (var i = 0; i < t.length; i++) {
12818 var s = t[i], o = s._private, l = o.rstyle;
12819 s.isEdge() && (!r(s.source()) || !r(s.target())) && (l.clean = !1), !(e && l.clean || s.removed()) && s.pstyle("display").value !== "none" && (o.group === "nodes" ? n.push(s) : a.push(s), l.clean = !0);
12820 }
12821 for (var u = 0; u < n.length; u++) {
12822 var f = n[u], h = f._private, c = h.rstyle, v = f.position();
12823 this.recalculateNodeLabelProjection(f), c.nodeX = v.x, c.nodeY = v.y, c.nodeW = f.pstyle("width").pfValue, c.nodeH = f.pstyle("height").pfValue;
12824 }
12825 this.recalculateEdgeProjections(a);
12826 for (var d = 0; d < a.length; d++) {
12827 var g = a[d], y = g._private, p = y.rstyle, m = y.rscratch;
12828 p.srcX = m.arrowStartX, p.srcY = m.arrowStartY, p.tgtX = m.arrowEndX, p.tgtY = m.arrowEndY, p.midX = m.midX, p.midY = m.midY, p.labelAngle = m.labelAngle, p.sourceLabelAngle = m.sourceLabelAngle, p.targetLabelAngle = m.targetLabelAngle;
12829 }
12830 }
12831 };
12832 var qn = {};
12833 qn.updateCachedGrabbedEles = function() {
12834 var t = this.cachedZSortedEles;
12835 if (t) {
12836 t.drag = [], t.nondrag = [];
12837 for (var e = [], r = 0; r < t.length; r++) {
12838 var a = t[r], n = a._private.rscratch;
12839 a.grabbed() && !a.isParent() ? e.push(a) : n.inDragLayer ? t.drag.push(a) : t.nondrag.push(a);
12840 }
12841 for (var r = 0; r < e.length; r++) {
12842 var a = e[r];
12843 t.drag.push(a);
12844 }
12845 }
12846 }, qn.invalidateCachedZSortedEles = function() {
12847 this.cachedZSortedEles = null;
12848 }, qn.getCachedZSortedEles = function(t) {
12849 if (t || !this.cachedZSortedEles) {
12850 var e = this.cy.mutableElements().toArray();
12851 e.sort(Ro), e.interactive = e.filter(function(r) {
12852 return r.interactive();
12853 }), this.cachedZSortedEles = e, this.updateCachedGrabbedEles();
12854 } else
12855 e = this.cachedZSortedEles;
12856 return e;
12857 };
12858 var hu = {};
12859 [Vr, Hn, Vt, Qa, Gi, fr, uu, Xn, qn].forEach(function(t) {
12860 Ue(hu, t);
12861 });
12862 var cu = {};
12863 cu.getCachedImage = function(t, e, r) {
12864 var a = this, n = a.imageCache = a.imageCache || {}, i = n[t];
12865 if (i)
12866 return i.image.complete || i.image.addEventListener("load", r), i.image;
12867 i = n[t] = n[t] || {};
12868 var s = i.image = new Image();
12869 s.addEventListener("load", r), s.addEventListener("error", function() {
12870 s.error = !0;
12871 });
12872 var o = "data:", l = t.substring(0, o.length).toLowerCase() === o;
12873 return l || (s.crossOrigin = e), s.src = t, s;
12874 };
12875 var ya = {};
12876 ya.registerBinding = function(t, e, r, a) {
12877 var n = Array.prototype.slice.apply(arguments, [1]), i = this.binder(t);
12878 return i.on.apply(i, n);
12879 }, ya.binder = function(t) {
12880 var e = this, r = t === window || t === document || t === document.body || $e(t);
12881 if (e.supportsPassiveEvents == null) {
12882 var a = !1;
12883 try {
12884 var n = Object.defineProperty({}, "passive", {
12885 get: function() {
12886 return a = !0, !0;
12887 }
12888 });
12889 window.addEventListener("test", null, n);
12890 } catch {
12891 }
12892 e.supportsPassiveEvents = a;
12893 }
12894 var i = function(o, l, u) {
12895 var f = Array.prototype.slice.call(arguments);
12896 return r && e.supportsPassiveEvents && (f[2] = {
12897 capture: u ?? !1,
12898 passive: !1,
12899 once: !1
12900 }), e.bindings.push({
12901 target: t,
12902 args: f
12903 }), (t.addEventListener || t.on).apply(t, f), this;
12904 };
12905 return {
12906 on: i,
12907 addEventListener: i,
12908 addListener: i,
12909 bind: i
12910 };
12911 }, ya.nodeIsDraggable = function(t) {
12912 return t && t.isNode() && !t.locked() && t.grabbable();
12913 }, ya.nodeIsGrabbable = function(t) {
12914 return this.nodeIsDraggable(t) && t.interactive();
12915 }, ya.load = function() {
12916 var t = this, e = function(N) {
12917 return N.selected();
12918 }, r = function(N, le, De, me) {
12919 N == null && (N = t.cy);
12920 for (var be = 0; be < le.length; be++) {
12921 var Ke = le[be];
12922 N.emit({
12923 originalEvent: De,
12924 type: Ke,
12925 position: me
12926 });
12927 }
12928 }, a = function(N) {
12929 return N.shiftKey || N.metaKey || N.ctrlKey;
12930 }, n = function(N, le) {
12931 var De = !0;
12932 if (t.cy.hasCompoundNodes() && N && N.pannable())
12933 for (var me = 0; le && me < le.length; me++) {
12934 var N = le[me];
12935 if (N.isNode() && N.isParent() && !N.pannable()) {
12936 De = !1;
12937 break;
12938 }
12939 }
12940 else
12941 De = !0;
12942 return De;
12943 }, i = function(N) {
12944 N[0]._private.grabbed = !0;
12945 }, s = function(N) {
12946 N[0]._private.grabbed = !1;
12947 }, o = function(N) {
12948 N[0]._private.rscratch.inDragLayer = !0;
12949 }, l = function(N) {
12950 N[0]._private.rscratch.inDragLayer = !1;
12951 }, u = function(N) {
12952 N[0]._private.rscratch.isGrabTarget = !0;
12953 }, f = function(N) {
12954 N[0]._private.rscratch.isGrabTarget = !1;
12955 }, h = function(N, le) {
12956 var De = le.addToList, me = De.has(N);
12957 !me && N.grabbable() && !N.locked() && (De.merge(N), i(N));
12958 }, c = function(N, le) {
12959 if (N.cy().hasCompoundNodes() && !(le.inDragLayer == null && le.addToList == null)) {
12960 var De = N.descendants();
12961 le.inDragLayer && (De.forEach(o), De.connectedEdges().forEach(o)), le.addToList && h(De, le);
12962 }
12963 }, v = function(N, le) {
12964 le = le || {};
12965 var De = N.cy().hasCompoundNodes();
12966 le.inDragLayer && (N.forEach(o), N.neighborhood().stdFilter(function(me) {
12967 return !De || me.isEdge();
12968 }).forEach(o)), le.addToList && N.forEach(function(me) {
12969 h(me, le);
12970 }), c(N, le), y(N, {
12971 inDragLayer: le.inDragLayer
12972 }), t.updateCachedGrabbedEles();
12973 }, d = v, g = function(N) {
12974 N && (t.getCachedZSortedEles().forEach(function(le) {
12975 s(le), l(le), f(le);
12976 }), t.updateCachedGrabbedEles());
12977 }, y = function(N, le) {
12978 if (!(le.inDragLayer == null && le.addToList == null) && N.cy().hasCompoundNodes()) {
12979 var De = N.ancestors().orphans();
12980 if (!De.same(N)) {
12981 var me = De.descendants().spawnSelf().merge(De).unmerge(N).unmerge(N.descendants()), be = me.connectedEdges();
12982 le.inDragLayer && (be.forEach(o), me.forEach(o)), le.addToList && me.forEach(function(Ke) {
12983 h(Ke, le);
12984 });
12985 }
12986 }
12987 }, p = function() {
12988 document.activeElement != null && document.activeElement.blur != null && document.activeElement.blur();
12989 }, m = typeof MutationObserver < "u", b = typeof ResizeObserver < "u";
12990 m ? (t.removeObserver = new MutationObserver(function(Se) {
12991 for (var N = 0; N < Se.length; N++) {
12992 var le = Se[N], De = le.removedNodes;
12993 if (De)
12994 for (var me = 0; me < De.length; me++) {
12995 var be = De[me];
12996 if (be === t.container) {
12997 t.destroy();
12998 break;
12999 }
13000 }
13001 }
13002 }), t.container.parentNode && t.removeObserver.observe(t.container.parentNode, {
13003 childList: !0
13004 })) : t.registerBinding(t.container, "DOMNodeRemoved", function(Se) {
13005 t.destroy();
13006 });
13007 var E = ln(function() {
13008 t.cy.resize();
13009 }, 100);
13010 m && (t.styleObserver = new MutationObserver(E), t.styleObserver.observe(t.container, {
13011 attributes: !0
13012 })), t.registerBinding(window, "resize", E), b && (t.resizeObserver = new ResizeObserver(E), t.resizeObserver.observe(t.container));
13013 var M = function(N, le) {
13014 for (; N != null; )
13015 le(N), N = N.parentNode;
13016 }, A = function() {
13017 t.invalidateContainerClientCoordsCache();
13018 };
13019 M(t.container, function(Se) {
13020 t.registerBinding(Se, "transitionend", A), t.registerBinding(Se, "animationend", A), t.registerBinding(Se, "scroll", A);
13021 }), t.registerBinding(t.container, "contextmenu", function(Se) {
13022 Se.preventDefault();
13023 });
13024 var w = function() {
13025 return t.selection[4] !== 0;
13026 }, I = function(N) {
13027 for (var le = t.findContainerClientCoords(), De = le[0], me = le[1], be = le[2], Ke = le[3], Le = N.touches ? N.touches : [N], ze = !1, at = 0; at < Le.length; at++) {
13028 var dt = Le[at];
13029 if (De <= dt.clientX && dt.clientX <= De + be && me <= dt.clientY && dt.clientY <= me + Ke) {
13030 ze = !0;
13031 break;
13032 }
13033 }
13034 if (!ze)
13035 return !1;
13036 for (var Qe = t.container, ut = N.target, Ze = ut.parentNode, Je = !1; Ze; ) {
13037 if (Ze === Qe) {
13038 Je = !0;
13039 break;
13040 }
13041 Ze = Ze.parentNode;
13042 }
13043 return !!Je;
13044 };
13045 t.registerBinding(t.container, "mousedown", function(N) {
13046 if (I(N)) {
13047 N.preventDefault(), p(), t.hoverData.capture = !0, t.hoverData.which = N.which;
13048 var le = t.cy, De = [N.clientX, N.clientY], me = t.projectIntoViewport(De[0], De[1]), be = t.selection, Ke = t.findNearestElements(me[0], me[1], !0, !1), Le = Ke[0], ze = t.dragData.possibleDragElements;
13049 t.hoverData.mdownPos = me, t.hoverData.mdownGPos = De;
13050 var at = function() {
13051 t.hoverData.tapholdCancelled = !1, clearTimeout(t.hoverData.tapholdTimeout), t.hoverData.tapholdTimeout = setTimeout(function() {
13052 if (!t.hoverData.tapholdCancelled) {
13053 var Ct = t.hoverData.down;
13054 Ct ? Ct.emit({
13055 originalEvent: N,
13056 type: "taphold",
13057 position: {
13058 x: me[0],
13059 y: me[1]
13060 }
13061 }) : le.emit({
13062 originalEvent: N,
13063 type: "taphold",
13064 position: {
13065 x: me[0],
13066 y: me[1]
13067 }
13068 });
13069 }
13070 }, t.tapholdDuration);
13071 };
13072 if (N.which == 3) {
13073 t.hoverData.cxtStarted = !0;
13074 var dt = {
13075 originalEvent: N,
13076 type: "cxttapstart",
13077 position: {
13078 x: me[0],
13079 y: me[1]
13080 }
13081 };
13082 Le ? (Le.activate(), Le.emit(dt), t.hoverData.down = Le) : le.emit(dt), t.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(), t.hoverData.cxtDragged = !1;
13083 } else if (N.which == 1) {
13084 Le && Le.activate();
13085 {
13086 if (Le != null && t.nodeIsGrabbable(Le)) {
13087 var Qe = function(Ct) {
13088 return {
13089 originalEvent: N,
13090 type: Ct,
13091 position: {
13092 x: me[0],
13093 y: me[1]
13094 }
13095 };
13096 }, ut = function(Ct) {
13097 Ct.emit(Qe("grab"));
13098 };
13099 if (u(Le), !Le.selected())
13100 ze = t.dragData.possibleDragElements = le.collection(), d(Le, {
13101 addToList: ze
13102 }), Le.emit(Qe("grabon")).emit(Qe("grab"));
13103 else {
13104 ze = t.dragData.possibleDragElements = le.collection();
13105 var Ze = le.$(function(Je) {
13106 return Je.isNode() && Je.selected() && t.nodeIsGrabbable(Je);
13107 });
13108 v(Ze, {
13109 addToList: ze
13110 }), Le.emit(Qe("grabon")), Ze.forEach(ut);
13111 }
13112 t.redrawHint("eles", !0), t.redrawHint("drag", !0);
13113 }
13114 t.hoverData.down = Le, t.hoverData.downs = Ke, t.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime();
13115 }
13116 r(Le, ["mousedown", "tapstart", "vmousedown"], N, {
13117 x: me[0],
13118 y: me[1]
13119 }), Le == null ? (be[4] = 1, t.data.bgActivePosistion = {
13120 x: me[0],
13121 y: me[1]
13122 }, t.redrawHint("select", !0), t.redraw()) : Le.pannable() && (be[4] = 1), at();
13123 }
13124 be[0] = be[2] = me[0], be[1] = be[3] = me[1];
13125 }
13126 }, !1), t.registerBinding(window, "mousemove", function(N) {
13127 var le = t.hoverData.capture;
13128 if (!(!le && !I(N))) {
13129 var De = !1, me = t.cy, be = me.zoom(), Ke = [N.clientX, N.clientY], Le = t.projectIntoViewport(Ke[0], Ke[1]), ze = t.hoverData.mdownPos, at = t.hoverData.mdownGPos, dt = t.selection, Qe = null;
13130 !t.hoverData.draggingEles && !t.hoverData.dragging && !t.hoverData.selecting && (Qe = t.findNearestElement(Le[0], Le[1], !0, !1));
13131 var ut = t.hoverData.last, Ze = t.hoverData.down, Je = [Le[0] - dt[2], Le[1] - dt[3]], Ct = t.dragData.possibleDragElements, It;
13132 if (at) {
13133 var ar = Ke[0] - at[0], nr = ar * ar, Rt = Ke[1] - at[1], Qt = Rt * Rt, _t = nr + Qt;
13134 t.hoverData.isOverThresholdDrag = It = _t >= t.desktopTapThreshold2;
13135 }
13136 var br = a(N);
13137 It && (t.hoverData.tapholdCancelled = !0);
13138 var Ir = function() {
13139 var cr = t.hoverData.dragDelta = t.hoverData.dragDelta || [];
13140 cr.length === 0 ? (cr.push(Je[0]), cr.push(Je[1])) : (cr[0] += Je[0], cr[1] += Je[1]);
13141 };
13142 De = !0, r(Qe, ["mousemove", "vmousemove", "tapdrag"], N, {
13143 x: Le[0],
13144 y: Le[1]
13145 });
13146 var xa = function() {
13147 t.data.bgActivePosistion = void 0, t.hoverData.selecting || me.emit({
13148 originalEvent: N,
13149 type: "boxstart",
13150 position: {
13151 x: Le[0],
13152 y: Le[1]
13153 }
13154 }), dt[4] = 1, t.hoverData.selecting = !0, t.redrawHint("select", !0), t.redraw();
13155 };
13156 if (t.hoverData.which === 3) {
13157 if (It) {
13158 var Hr = {
13159 originalEvent: N,
13160 type: "cxtdrag",
13161 position: {
13162 x: Le[0],
13163 y: Le[1]
13164 }
13165 };
13166 Ze ? Ze.emit(Hr) : me.emit(Hr), t.hoverData.cxtDragged = !0, (!t.hoverData.cxtOver || Qe !== t.hoverData.cxtOver) && (t.hoverData.cxtOver && t.hoverData.cxtOver.emit({
13167 originalEvent: N,
13168 type: "cxtdragout",
13169 position: {
13170 x: Le[0],
13171 y: Le[1]
13172 }
13173 }), t.hoverData.cxtOver = Qe, Qe && Qe.emit({
13174 originalEvent: N,
13175 type: "cxtdragover",
13176 position: {
13177 x: Le[0],
13178 y: Le[1]
13179 }
13180 }));
13181 }
13182 } else if (t.hoverData.dragging) {
13183 if (De = !0, me.panningEnabled() && me.userPanningEnabled()) {
13184 var Ta;
13185 if (t.hoverData.justStartedPan) {
13186 var Qn = t.hoverData.mdownPos;
13187 Ta = {
13188 x: (Le[0] - Qn[0]) * be,
13189 y: (Le[1] - Qn[1]) * be
13190 }, t.hoverData.justStartedPan = !1;
13191 } else
13192 Ta = {
13193 x: Je[0] * be,
13194 y: Je[1] * be
13195 };
13196 me.panBy(Ta), me.emit("dragpan"), t.hoverData.dragged = !0;
13197 }
13198 Le = t.projectIntoViewport(N.clientX, N.clientY);
13199 } else if (dt[4] == 1 && (Ze == null || Ze.pannable())) {
13200 if (It) {
13201 if (!t.hoverData.dragging && me.boxSelectionEnabled() && (br || !me.panningEnabled() || !me.userPanningEnabled()))
13202 xa();
13203 else if (!t.hoverData.selecting && me.panningEnabled() && me.userPanningEnabled()) {
13204 var Xr = n(Ze, t.hoverData.downs);
13205 Xr && (t.hoverData.dragging = !0, t.hoverData.justStartedPan = !0, dt[4] = 0, t.data.bgActivePosistion = jr(ze), t.redrawHint("select", !0), t.redraw());
13206 }
13207 Ze && Ze.pannable() && Ze.active() && Ze.unactivate();
13208 }
13209 } else {
13210 if (Ze && Ze.pannable() && Ze.active() && Ze.unactivate(), (!Ze || !Ze.grabbed()) && Qe != ut && (ut && r(ut, ["mouseout", "tapdragout"], N, {
13211 x: Le[0],
13212 y: Le[1]
13213 }), Qe && r(Qe, ["mouseover", "tapdragover"], N, {
13214 x: Le[0],
13215 y: Le[1]
13216 }), t.hoverData.last = Qe), Ze)
13217 if (It) {
13218 if (me.boxSelectionEnabled() && br)
13219 Ze && Ze.grabbed() && (g(Ct), Ze.emit("freeon"), Ct.emit("free"), t.dragData.didDrag && (Ze.emit("dragfreeon"), Ct.emit("dragfree"))), xa();
13220 else if (Ze && Ze.grabbed() && t.nodeIsDraggable(Ze)) {
13221 var Ht = !t.dragData.didDrag;
13222 Ht && t.redrawHint("eles", !0), t.dragData.didDrag = !0, t.hoverData.draggingEles || v(Ct, {
13223 inDragLayer: !0
13224 });
13225 var Gt = {
13226 x: 0,
13227 y: 0
13228 };
13229 if (k(Je[0]) && k(Je[1]) && (Gt.x += Je[0], Gt.y += Je[1], Ht)) {
13230 var Xt = t.hoverData.dragDelta;
13231 Xt && k(Xt[0]) && k(Xt[1]) && (Gt.x += Xt[0], Gt.y += Xt[1]);
13232 }
13233 t.hoverData.draggingEles = !0, Ct.silentShift(Gt).emit("position drag"), t.redrawHint("drag", !0), t.redraw();
13234 }
13235 } else
13236 Ir();
13237 De = !0;
13238 }
13239 if (dt[2] = Le[0], dt[3] = Le[1], De)
13240 return N.stopPropagation && N.stopPropagation(), N.preventDefault && N.preventDefault(), !1;
13241 }
13242 }, !1);
13243 var C, B, F;
13244 t.registerBinding(window, "mouseup", function(N) {
13245 var le = t.hoverData.capture;
13246 if (le) {
13247 t.hoverData.capture = !1;
13248 var De = t.cy, me = t.projectIntoViewport(N.clientX, N.clientY), be = t.selection, Ke = t.findNearestElement(me[0], me[1], !0, !1), Le = t.dragData.possibleDragElements, ze = t.hoverData.down, at = a(N);
13249 if (t.data.bgActivePosistion && (t.redrawHint("select", !0), t.redraw()), t.hoverData.tapholdCancelled = !0, t.data.bgActivePosistion = void 0, ze && ze.unactivate(), t.hoverData.which === 3) {
13250 var dt = {
13251 originalEvent: N,
13252 type: "cxttapend",
13253 position: {
13254 x: me[0],
13255 y: me[1]
13256 }
13257 };
13258 if (ze ? ze.emit(dt) : De.emit(dt), !t.hoverData.cxtDragged) {
13259 var Qe = {
13260 originalEvent: N,
13261 type: "cxttap",
13262 position: {
13263 x: me[0],
13264 y: me[1]
13265 }
13266 };
13267 ze ? ze.emit(Qe) : De.emit(Qe);
13268 }
13269 t.hoverData.cxtDragged = !1, t.hoverData.which = null;
13270 } else if (t.hoverData.which === 1) {
13271 if (r(Ke, ["mouseup", "tapend", "vmouseup"], N, {
13272 x: me[0],
13273 y: me[1]
13274 }), !t.dragData.didDrag && // didn't move a node around
13275 !t.hoverData.dragged && // didn't pan
13276 !t.hoverData.selecting && // not box selection
13277 !t.hoverData.isOverThresholdDrag && (r(ze, ["click", "tap", "vclick"], N, {
13278 x: me[0],
13279 y: me[1]
13280 }), B = !1, N.timeStamp - F <= De.multiClickDebounceTime() ? (C && clearTimeout(C), B = !0, F = null, r(ze, ["dblclick", "dbltap", "vdblclick"], N, {
13281 x: me[0],
13282 y: me[1]
13283 })) : (C = setTimeout(function() {
13284 B || r(ze, ["oneclick", "onetap", "voneclick"], N, {
13285 x: me[0],
13286 y: me[1]
13287 });
13288 }, De.multiClickDebounceTime()), F = N.timeStamp)), ze == null && !t.dragData.didDrag && !t.hoverData.selecting && !t.hoverData.dragged && !a(N) && (De.$(e).unselect(["tapunselect"]), Le.length > 0 && t.redrawHint("eles", !0), t.dragData.possibleDragElements = Le = De.collection()), Ke == ze && !t.dragData.didDrag && !t.hoverData.selecting && Ke != null && Ke._private.selectable && (t.hoverData.dragging || (De.selectionType() === "additive" || at ? Ke.selected() ? Ke.unselect(["tapunselect"]) : Ke.select(["tapselect"]) : at || (De.$(e).unmerge(Ke).unselect(["tapunselect"]), Ke.select(["tapselect"]))), t.redrawHint("eles", !0)), t.hoverData.selecting) {
13289 var ut = De.collection(t.getAllInBox(be[0], be[1], be[2], be[3]));
13290 t.redrawHint("select", !0), ut.length > 0 && t.redrawHint("eles", !0), De.emit({
13291 type: "boxend",
13292 originalEvent: N,
13293 position: {
13294 x: me[0],
13295 y: me[1]
13296 }
13297 });
13298 var Ze = function(It) {
13299 return It.selectable() && !It.selected();
13300 };
13301 De.selectionType() === "additive" || at || De.$(e).unmerge(ut).unselect(), ut.emit("box").stdFilter(Ze).select().emit("boxselect"), t.redraw();
13302 }
13303 if (t.hoverData.dragging && (t.hoverData.dragging = !1, t.redrawHint("select", !0), t.redrawHint("eles", !0), t.redraw()), !be[4]) {
13304 t.redrawHint("drag", !0), t.redrawHint("eles", !0);
13305 var Je = ze && ze.grabbed();
13306 g(Le), Je && (ze.emit("freeon"), Le.emit("free"), t.dragData.didDrag && (ze.emit("dragfreeon"), Le.emit("dragfree")));
13307 }
13308 }
13309 be[4] = 0, t.hoverData.down = null, t.hoverData.cxtStarted = !1, t.hoverData.draggingEles = !1, t.hoverData.selecting = !1, t.hoverData.isOverThresholdDrag = !1, t.dragData.didDrag = !1, t.hoverData.dragged = !1, t.hoverData.dragDelta = [], t.hoverData.mdownPos = null, t.hoverData.mdownGPos = null;
13310 }
13311 }, !1);
13312 var R = function(N) {
13313 if (!t.scrollingPage) {
13314 var le = t.cy, De = le.zoom(), me = le.pan(), be = t.projectIntoViewport(N.clientX, N.clientY), Ke = [be[0] * De + me.x, be[1] * De + me.y];
13315 if (t.hoverData.draggingEles || t.hoverData.dragging || t.hoverData.cxtStarted || w()) {
13316 N.preventDefault();
13317 return;
13318 }
13319 if (le.panningEnabled() && le.userPanningEnabled() && le.zoomingEnabled() && le.userZoomingEnabled()) {
13320 N.preventDefault(), t.data.wheelZooming = !0, clearTimeout(t.data.wheelTimeout), t.data.wheelTimeout = setTimeout(function() {
13321 t.data.wheelZooming = !1, t.redrawHint("eles", !0), t.redraw();
13322 }, 150);
13323 var Le;
13324 N.deltaY != null ? Le = N.deltaY / -250 : N.wheelDeltaY != null ? Le = N.wheelDeltaY / 1e3 : Le = N.wheelDelta / 1e3, Le = Le * t.wheelSensitivity;
13325 var ze = N.deltaMode === 1;
13326 ze && (Le *= 33);
13327 var at = le.zoom() * Math.pow(10, Le);
13328 N.type === "gesturechange" && (at = t.gestureStartZoom * N.scale), le.zoom({
13329 level: at,
13330 renderedPosition: {
13331 x: Ke[0],
13332 y: Ke[1]
13333 }
13334 }), le.emit(N.type === "gesturechange" ? "pinchzoom" : "scrollzoom");
13335 }
13336 }
13337 };
13338 t.registerBinding(t.container, "wheel", R, !0), t.registerBinding(window, "scroll", function(N) {
13339 t.scrollingPage = !0, clearTimeout(t.scrollingPageTimeout), t.scrollingPageTimeout = setTimeout(function() {
13340 t.scrollingPage = !1;
13341 }, 250);
13342 }, !0), t.registerBinding(t.container, "gesturestart", function(N) {
13343 t.gestureStartZoom = t.cy.zoom(), t.hasTouchStarted || N.preventDefault();
13344 }, !0), t.registerBinding(t.container, "gesturechange", function(Se) {
13345 t.hasTouchStarted || R(Se);
13346 }, !0), t.registerBinding(t.container, "mouseout", function(N) {
13347 var le = t.projectIntoViewport(N.clientX, N.clientY);
13348 t.cy.emit({
13349 originalEvent: N,
13350 type: "mouseout",
13351 position: {
13352 x: le[0],
13353 y: le[1]
13354 }
13355 });
13356 }, !1), t.registerBinding(t.container, "mouseover", function(N) {
13357 var le = t.projectIntoViewport(N.clientX, N.clientY);
13358 t.cy.emit({
13359 originalEvent: N,
13360 type: "mouseover",
13361 position: {
13362 x: le[0],
13363 y: le[1]
13364 }
13365 });
13366 }, !1);
13367 var X, z, re, W, Z, ie, oe, ge, se, de, we, Te, Ee, ye = function(N, le, De, me) {
13368 return Math.sqrt((De - N) * (De - N) + (me - le) * (me - le));
13369 }, ae = function(N, le, De, me) {
13370 return (De - N) * (De - N) + (me - le) * (me - le);
13371 }, xe;
13372 t.registerBinding(t.container, "touchstart", xe = function(N) {
13373 if (t.hasTouchStarted = !0, !!I(N)) {
13374 p(), t.touchData.capture = !0, t.data.bgActivePosistion = void 0;
13375 var le = t.cy, De = t.touchData.now, me = t.touchData.earlier;
13376 if (N.touches[0]) {
13377 var be = t.projectIntoViewport(N.touches[0].clientX, N.touches[0].clientY);
13378 De[0] = be[0], De[1] = be[1];
13379 }
13380 if (N.touches[1]) {
13381 var be = t.projectIntoViewport(N.touches[1].clientX, N.touches[1].clientY);
13382 De[2] = be[0], De[3] = be[1];
13383 }
13384 if (N.touches[2]) {
13385 var be = t.projectIntoViewport(N.touches[2].clientX, N.touches[2].clientY);
13386 De[4] = be[0], De[5] = be[1];
13387 }
13388 if (N.touches[1]) {
13389 t.touchData.singleTouchMoved = !0, g(t.dragData.touchDragEles);
13390 var Ke = t.findContainerClientCoords();
13391 se = Ke[0], de = Ke[1], we = Ke[2], Te = Ke[3], X = N.touches[0].clientX - se, z = N.touches[0].clientY - de, re = N.touches[1].clientX - se, W = N.touches[1].clientY - de, Ee = 0 <= X && X <= we && 0 <= re && re <= we && 0 <= z && z <= Te && 0 <= W && W <= Te;
13392 var Le = le.pan(), ze = le.zoom();
13393 Z = ye(X, z, re, W), ie = ae(X, z, re, W), oe = [(X + re) / 2, (z + W) / 2], ge = [(oe[0] - Le.x) / ze, (oe[1] - Le.y) / ze];
13394 var at = 200, dt = at * at;
13395 if (ie < dt && !N.touches[2]) {
13396 var Qe = t.findNearestElement(De[0], De[1], !0, !0), ut = t.findNearestElement(De[2], De[3], !0, !0);
13397 Qe && Qe.isNode() ? (Qe.activate().emit({
13398 originalEvent: N,
13399 type: "cxttapstart",
13400 position: {
13401 x: De[0],
13402 y: De[1]
13403 }
13404 }), t.touchData.start = Qe) : ut && ut.isNode() ? (ut.activate().emit({
13405 originalEvent: N,
13406 type: "cxttapstart",
13407 position: {
13408 x: De[0],
13409 y: De[1]
13410 }
13411 }), t.touchData.start = ut) : le.emit({
13412 originalEvent: N,
13413 type: "cxttapstart",
13414 position: {
13415 x: De[0],
13416 y: De[1]
13417 }
13418 }), t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxt = !0, t.touchData.cxtDragged = !1, t.data.bgActivePosistion = void 0, t.redraw();
13419 return;
13420 }
13421 }
13422 if (N.touches[2])
13423 le.boxSelectionEnabled() && N.preventDefault();
13424 else if (!N.touches[1]) {
13425 if (N.touches[0]) {
13426 var Ze = t.findNearestElements(De[0], De[1], !0, !0), Je = Ze[0];
13427 if (Je != null && (Je.activate(), t.touchData.start = Je, t.touchData.starts = Ze, t.nodeIsGrabbable(Je))) {
13428 var Ct = t.dragData.touchDragEles = le.collection(), It = null;
13429 t.redrawHint("eles", !0), t.redrawHint("drag", !0), Je.selected() ? (It = le.$(function(_t) {
13430 return _t.selected() && t.nodeIsGrabbable(_t);
13431 }), v(It, {
13432 addToList: Ct
13433 })) : d(Je, {
13434 addToList: Ct
13435 }), u(Je);
13436 var ar = function(br) {
13437 return {
13438 originalEvent: N,
13439 type: br,
13440 position: {
13441 x: De[0],
13442 y: De[1]
13443 }
13444 };
13445 };
13446 Je.emit(ar("grabon")), It ? It.forEach(function(_t) {
13447 _t.emit(ar("grab"));
13448 }) : Je.emit(ar("grab"));
13449 }
13450 r(Je, ["touchstart", "tapstart", "vmousedown"], N, {
13451 x: De[0],
13452 y: De[1]
13453 }), Je == null && (t.data.bgActivePosistion = {
13454 x: be[0],
13455 y: be[1]
13456 }, t.redrawHint("select", !0), t.redraw()), t.touchData.singleTouchMoved = !1, t.touchData.singleTouchStartTime = +/* @__PURE__ */ new Date(), clearTimeout(t.touchData.tapholdTimeout), t.touchData.tapholdTimeout = setTimeout(function() {
13457 t.touchData.singleTouchMoved === !1 && !t.pinching && !t.touchData.selecting && r(t.touchData.start, ["taphold"], N, {
13458 x: De[0],
13459 y: De[1]
13460 });
13461 }, t.tapholdDuration);
13462 }
13463 }
13464 if (N.touches.length >= 1) {
13465 for (var nr = t.touchData.startPosition = [], Rt = 0; Rt < De.length; Rt++)
13466 nr[Rt] = me[Rt] = De[Rt];
13467 var Qt = N.touches[0];
13468 t.touchData.startGPosition = [Qt.clientX, Qt.clientY];
13469 }
13470 }
13471 }, !1);
13472 var Ce;
13473 t.registerBinding(window, "touchmove", Ce = function(N) {
13474 var le = t.touchData.capture;
13475 if (!(!le && !I(N))) {
13476 var De = t.selection, me = t.cy, be = t.touchData.now, Ke = t.touchData.earlier, Le = me.zoom();
13477 if (N.touches[0]) {
13478 var ze = t.projectIntoViewport(N.touches[0].clientX, N.touches[0].clientY);
13479 be[0] = ze[0], be[1] = ze[1];
13480 }
13481 if (N.touches[1]) {
13482 var ze = t.projectIntoViewport(N.touches[1].clientX, N.touches[1].clientY);
13483 be[2] = ze[0], be[3] = ze[1];
13484 }
13485 if (N.touches[2]) {
13486 var ze = t.projectIntoViewport(N.touches[2].clientX, N.touches[2].clientY);
13487 be[4] = ze[0], be[5] = ze[1];
13488 }
13489 var at = t.touchData.startGPosition, dt;
13490 if (le && N.touches[0] && at) {
13491 for (var Qe = [], ut = 0; ut < be.length; ut++)
13492 Qe[ut] = be[ut] - Ke[ut];
13493 var Ze = N.touches[0].clientX - at[0], Je = Ze * Ze, Ct = N.touches[0].clientY - at[1], It = Ct * Ct, ar = Je + It;
13494 dt = ar >= t.touchTapThreshold2;
13495 }
13496 if (le && t.touchData.cxt) {
13497 N.preventDefault();
13498 var nr = N.touches[0].clientX - se, Rt = N.touches[0].clientY - de, Qt = N.touches[1].clientX - se, _t = N.touches[1].clientY - de, br = ae(nr, Rt, Qt, _t), Ir = br / ie, xa = 150, Hr = xa * xa, Ta = 1.5, Qn = Ta * Ta;
13499 if (Ir >= Qn || br >= Hr) {
13500 t.touchData.cxt = !1, t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13501 var Xr = {
13502 originalEvent: N,
13503 type: "cxttapend",
13504 position: {
13505 x: be[0],
13506 y: be[1]
13507 }
13508 };
13509 t.touchData.start ? (t.touchData.start.unactivate().emit(Xr), t.touchData.start = null) : me.emit(Xr);
13510 }
13511 }
13512 if (le && t.touchData.cxt) {
13513 var Xr = {
13514 originalEvent: N,
13515 type: "cxtdrag",
13516 position: {
13517 x: be[0],
13518 y: be[1]
13519 }
13520 };
13521 t.data.bgActivePosistion = void 0, t.redrawHint("select", !0), t.touchData.start ? t.touchData.start.emit(Xr) : me.emit(Xr), t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxtDragged = !0;
13522 var Ht = t.findNearestElement(be[0], be[1], !0, !0);
13523 (!t.touchData.cxtOver || Ht !== t.touchData.cxtOver) && (t.touchData.cxtOver && t.touchData.cxtOver.emit({
13524 originalEvent: N,
13525 type: "cxtdragout",
13526 position: {
13527 x: be[0],
13528 y: be[1]
13529 }
13530 }), t.touchData.cxtOver = Ht, Ht && Ht.emit({
13531 originalEvent: N,
13532 type: "cxtdragover",
13533 position: {
13534 x: be[0],
13535 y: be[1]
13536 }
13537 }));
13538 } else if (le && N.touches[2] && me.boxSelectionEnabled())
13539 N.preventDefault(), t.data.bgActivePosistion = void 0, this.lastThreeTouch = +/* @__PURE__ */ new Date(), t.touchData.selecting || me.emit({
13540 originalEvent: N,
13541 type: "boxstart",
13542 position: {
13543 x: be[0],
13544 y: be[1]
13545 }
13546 }), t.touchData.selecting = !0, t.touchData.didSelect = !0, De[4] = 1, !De || De.length === 0 || De[0] === void 0 ? (De[0] = (be[0] + be[2] + be[4]) / 3, De[1] = (be[1] + be[3] + be[5]) / 3, De[2] = (be[0] + be[2] + be[4]) / 3 + 1, De[3] = (be[1] + be[3] + be[5]) / 3 + 1) : (De[2] = (be[0] + be[2] + be[4]) / 3, De[3] = (be[1] + be[3] + be[5]) / 3), t.redrawHint("select", !0), t.redraw();
13547 else if (le && N.touches[1] && !t.touchData.didSelect && me.zoomingEnabled() && me.panningEnabled() && me.userZoomingEnabled() && me.userPanningEnabled()) {
13548 N.preventDefault(), t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13549 var Gt = t.dragData.touchDragEles;
13550 if (Gt) {
13551 t.redrawHint("drag", !0);
13552 for (var Xt = 0; Xt < Gt.length; Xt++) {
13553 var Jn = Gt[Xt]._private;
13554 Jn.grabbed = !1, Jn.rscratch.inDragLayer = !1;
13555 }
13556 }
13557 var cr = t.touchData.start, nr = N.touches[0].clientX - se, Rt = N.touches[0].clientY - de, Qt = N.touches[1].clientX - se, _t = N.touches[1].clientY - de, Fu = ye(nr, Rt, Qt, _t), up = Fu / Z;
13558 if (Ee) {
13559 var lp = nr - X, fp = Rt - z, hp = Qt - re, cp = _t - W, vp = (lp + hp) / 2, dp = (fp + cp) / 2, rn = me.zoom(), qi = rn * up, jn = me.pan(), zu = ge[0] * rn + jn.x, Gu = ge[1] * rn + jn.y, gp = {
13560 x: -qi / rn * (zu - jn.x - vp) + zu,
13561 y: -qi / rn * (Gu - jn.y - dp) + Gu
13562 };
13563 if (cr && cr.active()) {
13564 var Gt = t.dragData.touchDragEles;
13565 g(Gt), t.redrawHint("drag", !0), t.redrawHint("eles", !0), cr.unactivate().emit("freeon"), Gt.emit("free"), t.dragData.didDrag && (cr.emit("dragfreeon"), Gt.emit("dragfree"));
13566 }
13567 me.viewport({
13568 zoom: qi,
13569 pan: gp,
13570 cancelOnFailedZoom: !0
13571 }), me.emit("pinchzoom"), Z = Fu, X = nr, z = Rt, re = Qt, W = _t, t.pinching = !0;
13572 }
13573 if (N.touches[0]) {
13574 var ze = t.projectIntoViewport(N.touches[0].clientX, N.touches[0].clientY);
13575 be[0] = ze[0], be[1] = ze[1];
13576 }
13577 if (N.touches[1]) {
13578 var ze = t.projectIntoViewport(N.touches[1].clientX, N.touches[1].clientY);
13579 be[2] = ze[0], be[3] = ze[1];
13580 }
13581 if (N.touches[2]) {
13582 var ze = t.projectIntoViewport(N.touches[2].clientX, N.touches[2].clientY);
13583 be[4] = ze[0], be[5] = ze[1];
13584 }
13585 } else if (N.touches[0] && !t.touchData.didSelect) {
13586 var ir = t.touchData.start, Wi = t.touchData.last, Ht;
13587 if (!t.hoverData.draggingEles && !t.swipePanning && (Ht = t.findNearestElement(be[0], be[1], !0, !0)), le && ir != null && N.preventDefault(), le && ir != null && t.nodeIsDraggable(ir))
13588 if (dt) {
13589 var Gt = t.dragData.touchDragEles, $u = !t.dragData.didDrag;
13590 $u && v(Gt, {
13591 inDragLayer: !0
13592 }), t.dragData.didDrag = !0;
13593 var an = {
13594 x: 0,
13595 y: 0
13596 };
13597 if (k(Qe[0]) && k(Qe[1]) && (an.x += Qe[0], an.y += Qe[1], $u)) {
13598 t.redrawHint("eles", !0);
13599 var sr = t.touchData.dragDelta;
13600 sr && k(sr[0]) && k(sr[1]) && (an.x += sr[0], an.y += sr[1]);
13601 }
13602 t.hoverData.draggingEles = !0, Gt.silentShift(an).emit("position drag"), t.redrawHint("drag", !0), t.touchData.startPosition[0] == Ke[0] && t.touchData.startPosition[1] == Ke[1] && t.redrawHint("eles", !0), t.redraw();
13603 } else {
13604 var sr = t.touchData.dragDelta = t.touchData.dragDelta || [];
13605 sr.length === 0 ? (sr.push(Qe[0]), sr.push(Qe[1])) : (sr[0] += Qe[0], sr[1] += Qe[1]);
13606 }
13607 if (r(ir || Ht, ["touchmove", "tapdrag", "vmousemove"], N, {
13608 x: be[0],
13609 y: be[1]
13610 }), (!ir || !ir.grabbed()) && Ht != Wi && (Wi && Wi.emit({
13611 originalEvent: N,
13612 type: "tapdragout",
13613 position: {
13614 x: be[0],
13615 y: be[1]
13616 }
13617 }), Ht && Ht.emit({
13618 originalEvent: N,
13619 type: "tapdragover",
13620 position: {
13621 x: be[0],
13622 y: be[1]
13623 }
13624 })), t.touchData.last = Ht, le)
13625 for (var Xt = 0; Xt < be.length; Xt++)
13626 be[Xt] && t.touchData.startPosition[Xt] && dt && (t.touchData.singleTouchMoved = !0);
13627 if (le && (ir == null || ir.pannable()) && me.panningEnabled() && me.userPanningEnabled()) {
13628 var pp = n(ir, t.touchData.starts);
13629 pp && (N.preventDefault(), t.data.bgActivePosistion || (t.data.bgActivePosistion = jr(t.touchData.startPosition)), t.swipePanning ? (me.panBy({
13630 x: Qe[0] * Le,
13631 y: Qe[1] * Le
13632 }), me.emit("dragpan")) : dt && (t.swipePanning = !0, me.panBy({
13633 x: Ze * Le,
13634 y: Ct * Le
13635 }), me.emit("dragpan"), ir && (ir.unactivate(), t.redrawHint("select", !0), t.touchData.start = null)));
13636 var ze = t.projectIntoViewport(N.touches[0].clientX, N.touches[0].clientY);
13637 be[0] = ze[0], be[1] = ze[1];
13638 }
13639 }
13640 for (var ut = 0; ut < be.length; ut++)
13641 Ke[ut] = be[ut];
13642 le && N.touches.length > 0 && !t.hoverData.draggingEles && !t.swipePanning && t.data.bgActivePosistion != null && (t.data.bgActivePosistion = void 0, t.redrawHint("select", !0), t.redraw());
13643 }
13644 }, !1);
13645 var Oe;
13646 t.registerBinding(window, "touchcancel", Oe = function(N) {
13647 var le = t.touchData.start;
13648 t.touchData.capture = !1, le && le.unactivate();
13649 });
13650 var Ie, He, qe, Re;
13651 if (t.registerBinding(window, "touchend", Ie = function(N) {
13652 var le = t.touchData.start, De = t.touchData.capture;
13653 if (De)
13654 N.touches.length === 0 && (t.touchData.capture = !1), N.preventDefault();
13655 else
13656 return;
13657 var me = t.selection;
13658 t.swipePanning = !1, t.hoverData.draggingEles = !1;
13659 var be = t.cy, Ke = be.zoom(), Le = t.touchData.now, ze = t.touchData.earlier;
13660 if (N.touches[0]) {
13661 var at = t.projectIntoViewport(N.touches[0].clientX, N.touches[0].clientY);
13662 Le[0] = at[0], Le[1] = at[1];
13663 }
13664 if (N.touches[1]) {
13665 var at = t.projectIntoViewport(N.touches[1].clientX, N.touches[1].clientY);
13666 Le[2] = at[0], Le[3] = at[1];
13667 }
13668 if (N.touches[2]) {
13669 var at = t.projectIntoViewport(N.touches[2].clientX, N.touches[2].clientY);
13670 Le[4] = at[0], Le[5] = at[1];
13671 }
13672 le && le.unactivate();
13673 var dt;
13674 if (t.touchData.cxt) {
13675 if (dt = {
13676 originalEvent: N,
13677 type: "cxttapend",
13678 position: {
13679 x: Le[0],
13680 y: Le[1]
13681 }
13682 }, le ? le.emit(dt) : be.emit(dt), !t.touchData.cxtDragged) {
13683 var Qe = {
13684 originalEvent: N,
13685 type: "cxttap",
13686 position: {
13687 x: Le[0],
13688 y: Le[1]
13689 }
13690 };
13691 le ? le.emit(Qe) : be.emit(Qe);
13692 }
13693 t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxt = !1, t.touchData.start = null, t.redraw();
13694 return;
13695 }
13696 if (!N.touches[2] && be.boxSelectionEnabled() && t.touchData.selecting) {
13697 t.touchData.selecting = !1;
13698 var ut = be.collection(t.getAllInBox(me[0], me[1], me[2], me[3]));
13699 me[0] = void 0, me[1] = void 0, me[2] = void 0, me[3] = void 0, me[4] = 0, t.redrawHint("select", !0), be.emit({
13700 type: "boxend",
13701 originalEvent: N,
13702 position: {
13703 x: Le[0],
13704 y: Le[1]
13705 }
13706 });
13707 var Ze = function(Hr) {
13708 return Hr.selectable() && !Hr.selected();
13709 };
13710 ut.emit("box").stdFilter(Ze).select().emit("boxselect"), ut.nonempty() && t.redrawHint("eles", !0), t.redraw();
13711 }
13712 if (le != null && le.unactivate(), N.touches[2])
13713 t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13714 else if (!N.touches[1]) {
13715 if (!N.touches[0]) {
13716 if (!N.touches[0]) {
13717 t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13718 var Je = t.dragData.touchDragEles;
13719 if (le != null) {
13720 var Ct = le._private.grabbed;
13721 g(Je), t.redrawHint("drag", !0), t.redrawHint("eles", !0), Ct && (le.emit("freeon"), Je.emit("free"), t.dragData.didDrag && (le.emit("dragfreeon"), Je.emit("dragfree"))), r(le, ["touchend", "tapend", "vmouseup", "tapdragout"], N, {
13722 x: Le[0],
13723 y: Le[1]
13724 }), le.unactivate(), t.touchData.start = null;
13725 } else {
13726 var It = t.findNearestElement(Le[0], Le[1], !0, !0);
13727 r(It, ["touchend", "tapend", "vmouseup", "tapdragout"], N, {
13728 x: Le[0],
13729 y: Le[1]
13730 });
13731 }
13732 var ar = t.touchData.startPosition[0] - Le[0], nr = ar * ar, Rt = t.touchData.startPosition[1] - Le[1], Qt = Rt * Rt, _t = nr + Qt, br = _t * Ke * Ke;
13733 t.touchData.singleTouchMoved || (le || be.$(":selected").unselect(["tapunselect"]), r(le, ["tap", "vclick"], N, {
13734 x: Le[0],
13735 y: Le[1]
13736 }), He = !1, N.timeStamp - Re <= be.multiClickDebounceTime() ? (qe && clearTimeout(qe), He = !0, Re = null, r(le, ["dbltap", "vdblclick"], N, {
13737 x: Le[0],
13738 y: Le[1]
13739 })) : (qe = setTimeout(function() {
13740 He || r(le, ["onetap", "voneclick"], N, {
13741 x: Le[0],
13742 y: Le[1]
13743 });
13744 }, be.multiClickDebounceTime()), Re = N.timeStamp)), le != null && !t.dragData.didDrag && le._private.selectable && br < t.touchTapThreshold2 && !t.pinching && (be.selectionType() === "single" ? (be.$(e).unmerge(le).unselect(["tapunselect"]), le.select(["tapselect"])) : le.selected() ? le.unselect(["tapunselect"]) : le.select(["tapselect"]), t.redrawHint("eles", !0)), t.touchData.singleTouchMoved = !0;
13745 }
13746 }
13747 }
13748 for (var Ir = 0; Ir < Le.length; Ir++)
13749 ze[Ir] = Le[Ir];
13750 t.dragData.didDrag = !1, N.touches.length === 0 && (t.touchData.dragDelta = [], t.touchData.startPosition = null, t.touchData.startGPosition = null, t.touchData.didSelect = !1), N.touches.length < 2 && (N.touches.length === 1 && (t.touchData.startGPosition = [N.touches[0].clientX, N.touches[0].clientY]), t.pinching = !1, t.redrawHint("eles", !0), t.redraw());
13751 }, !1), typeof TouchEvent > "u") {
13752 var Me = [], Ve = function(N) {
13753 return {
13754 clientX: N.clientX,
13755 clientY: N.clientY,
13756 force: 1,
13757 identifier: N.pointerId,
13758 pageX: N.pageX,
13759 pageY: N.pageY,
13760 radiusX: N.width / 2,
13761 radiusY: N.height / 2,
13762 screenX: N.screenX,
13763 screenY: N.screenY,
13764 target: N.target
13765 };
13766 }, Fe = function(N) {
13767 return {
13768 event: N,
13769 touch: Ve(N)
13770 };
13771 }, ke = function(N) {
13772 Me.push(Fe(N));
13773 }, Ge = function(N) {
13774 for (var le = 0; le < Me.length; le++) {
13775 var De = Me[le];
13776 if (De.event.pointerId === N.pointerId) {
13777 Me.splice(le, 1);
13778 return;
13779 }
13780 }
13781 }, et = function(N) {
13782 var le = Me.filter(function(De) {
13783 return De.event.pointerId === N.pointerId;
13784 })[0];
13785 le.event = N, le.touch = Ve(N);
13786 }, We = function(N) {
13787 N.touches = Me.map(function(le) {
13788 return le.touch;
13789 });
13790 }, Ye = function(N) {
13791 return N.pointerType === "mouse" || N.pointerType === 4;
13792 };
13793 t.registerBinding(t.container, "pointerdown", function(Se) {
13794 Ye(Se) || (Se.preventDefault(), ke(Se), We(Se), xe(Se));
13795 }), t.registerBinding(t.container, "pointerup", function(Se) {
13796 Ye(Se) || (Ge(Se), We(Se), Ie(Se));
13797 }), t.registerBinding(t.container, "pointercancel", function(Se) {
13798 Ye(Se) || (Ge(Se), We(Se), Oe(Se));
13799 }), t.registerBinding(t.container, "pointermove", function(Se) {
13800 Ye(Se) || (Se.preventDefault(), et(Se), We(Se), Ce(Se));
13801 });
13802 }
13803 };
13804 var yr = {};
13805 yr.generatePolygon = function(t, e) {
13806 return this.nodeShapes[t] = {
13807 renderer: this,
13808 name: t,
13809 points: e,
13810 draw: function(a, n, i, s, o) {
13811 this.renderer.nodeShapeImpl("polygon", a, n, i, s, o, this.points);
13812 },
13813 intersectLine: function(a, n, i, s, o, l, u) {
13814 return Ba(o, l, this.points, a, n, i / 2, s / 2, u);
13815 },
13816 checkPoint: function(a, n, i, s, o, l, u) {
13817 return gr(a, n, this.points, l, u, s, o, [0, -1], i);
13818 }
13819 };
13820 }, yr.generateEllipse = function() {
13821 return this.nodeShapes.ellipse = {
13822 renderer: this,
13823 name: "ellipse",
13824 draw: function(e, r, a, n, i) {
13825 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13826 },
13827 intersectLine: function(e, r, a, n, i, s, o) {
13828 return Pf(i, s, e, r, a / 2 + o, n / 2 + o);
13829 },
13830 checkPoint: function(e, r, a, n, i, s, o) {
13831 return Fr(e, r, n, i, s, o, a);
13832 }
13833 };
13834 }, yr.generateRoundPolygon = function(t, e) {
13835 for (var r = new Array(e.length * 2), a = 0; a < e.length / 2; a++) {
13836 var n = a * 2, i = void 0;
13837 a < e.length / 2 - 1 ? i = (a + 1) * 2 : i = 0, r[a * 4] = e[n], r[a * 4 + 1] = e[n + 1];
13838 var s = e[i] - e[n], o = e[i + 1] - e[n + 1], l = Math.sqrt(s * s + o * o);
13839 r[a * 4 + 2] = s / l, r[a * 4 + 3] = o / l;
13840 }
13841 return this.nodeShapes[t] = {
13842 renderer: this,
13843 name: t,
13844 points: r,
13845 draw: function(f, h, c, v, d) {
13846 this.renderer.nodeShapeImpl("round-polygon", f, h, c, v, d, this.points);
13847 },
13848 intersectLine: function(f, h, c, v, d, g, y) {
13849 return Bf(d, g, this.points, f, h, c, v);
13850 },
13851 checkPoint: function(f, h, c, v, d, g, y) {
13852 return kf(f, h, this.points, g, y, v, d);
13853 }
13854 };
13855 }, yr.generateRoundRectangle = function() {
13856 return this.nodeShapes["round-rectangle"] = this.nodeShapes.roundrectangle = {
13857 renderer: this,
13858 name: "round-rectangle",
13859 points: $t(4, 0),
13860 draw: function(e, r, a, n, i) {
13861 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13862 },
13863 intersectLine: function(e, r, a, n, i, s, o) {
13864 return Ts(i, s, e, r, a, n, o);
13865 },
13866 checkPoint: function(e, r, a, n, i, s, o) {
13867 var l = Fa(n, i), u = l * 2;
13868 return !!(gr(e, r, this.points, s, o, n, i - u, [0, -1], a) || gr(e, r, this.points, s, o, n - u, i, [0, -1], a) || Fr(e, r, u, u, s - n / 2 + l, o - i / 2 + l, a) || Fr(e, r, u, u, s + n / 2 - l, o - i / 2 + l, a) || Fr(e, r, u, u, s + n / 2 - l, o + i / 2 - l, a) || Fr(e, r, u, u, s - n / 2 + l, o + i / 2 - l, a));
13869 }
13870 };
13871 }, yr.generateCutRectangle = function() {
13872 return this.nodeShapes["cut-rectangle"] = this.nodeShapes.cutrectangle = {
13873 renderer: this,
13874 name: "cut-rectangle",
13875 cornerLength: Ls(),
13876 points: $t(4, 0),
13877 draw: function(e, r, a, n, i) {
13878 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13879 },
13880 generateCutTrianglePts: function(e, r, a, n) {
13881 var i = this.cornerLength, s = r / 2, o = e / 2, l = a - o, u = a + o, f = n - s, h = n + s;
13882 return {
13883 topLeft: [l, f + i, l + i, f, l + i, f + i],
13884 topRight: [u - i, f, u, f + i, u - i, f + i],
13885 bottomRight: [u, h - i, u - i, h, u - i, h - i],
13886 bottomLeft: [l + i, h, l, h - i, l + i, h - i]
13887 };
13888 },
13889 intersectLine: function(e, r, a, n, i, s, o) {
13890 var l = this.generateCutTrianglePts(a + 2 * o, n + 2 * o, e, r), u = [].concat.apply([], [l.topLeft.splice(0, 4), l.topRight.splice(0, 4), l.bottomRight.splice(0, 4), l.bottomLeft.splice(0, 4)]);
13891 return Ba(i, s, u, e, r);
13892 },
13893 checkPoint: function(e, r, a, n, i, s, o) {
13894 if (gr(e, r, this.points, s, o, n, i - 2 * this.cornerLength, [0, -1], a) || gr(e, r, this.points, s, o, n - 2 * this.cornerLength, i, [0, -1], a))
13895 return !0;
13896 var l = this.generateCutTrianglePts(n, i, s, o);
13897 return Yt(e, r, l.topLeft) || Yt(e, r, l.topRight) || Yt(e, r, l.bottomRight) || Yt(e, r, l.bottomLeft);
13898 }
13899 };
13900 }, yr.generateBarrel = function() {
13901 return this.nodeShapes.barrel = {
13902 renderer: this,
13903 name: "barrel",
13904 points: $t(4, 0),
13905 draw: function(e, r, a, n, i) {
13906 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13907 },
13908 intersectLine: function(e, r, a, n, i, s, o) {
13909 var l = 0.15, u = 0.5, f = 0.85, h = this.generateBarrelBezierPts(a + 2 * o, n + 2 * o, e, r), c = function(g) {
13910 var y = ea({
13911 x: g[0],
13912 y: g[1]
13913 }, {
13914 x: g[2],
13915 y: g[3]
13916 }, {
13917 x: g[4],
13918 y: g[5]
13919 }, l), p = ea({
13920 x: g[0],
13921 y: g[1]
13922 }, {
13923 x: g[2],
13924 y: g[3]
13925 }, {
13926 x: g[4],
13927 y: g[5]
13928 }, u), m = ea({
13929 x: g[0],
13930 y: g[1]
13931 }, {
13932 x: g[2],
13933 y: g[3]
13934 }, {
13935 x: g[4],
13936 y: g[5]
13937 }, f);
13938 return [g[0], g[1], y.x, y.y, p.x, p.y, m.x, m.y, g[4], g[5]];
13939 }, v = [].concat(c(h.topLeft), c(h.topRight), c(h.bottomRight), c(h.bottomLeft));
13940 return Ba(i, s, v, e, r);
13941 },
13942 generateBarrelBezierPts: function(e, r, a, n) {
13943 var i = r / 2, s = e / 2, o = a - s, l = a + s, u = n - i, f = n + i, h = gi(e, r), c = h.heightOffset, v = h.widthOffset, d = h.ctrlPtOffsetPct * e, g = {
13944 topLeft: [o, u + c, o + d, u, o + v, u],
13945 topRight: [l - v, u, l - d, u, l, u + c],
13946 bottomRight: [l, f - c, l - d, f, l - v, f],
13947 bottomLeft: [o + v, f, o + d, f, o, f - c]
13948 };
13949 return g.topLeft.isTop = !0, g.topRight.isTop = !0, g.bottomLeft.isBottom = !0, g.bottomRight.isBottom = !0, g;
13950 },
13951 checkPoint: function(e, r, a, n, i, s, o) {
13952 var l = gi(n, i), u = l.heightOffset, f = l.widthOffset;
13953 if (gr(e, r, this.points, s, o, n, i - 2 * u, [0, -1], a) || gr(e, r, this.points, s, o, n - 2 * f, i, [0, -1], a))
13954 return !0;
13955 for (var h = this.generateBarrelBezierPts(n, i, s, o), c = function(w, I, C) {
13956 var B = C[4], F = C[2], R = C[0], X = C[5], z = C[1], re = Math.min(B, R), W = Math.max(B, R), Z = Math.min(X, z), ie = Math.max(X, z);
13957 if (re <= w && w <= W && Z <= I && I <= ie) {
13958 var oe = Ff(B, F, R), ge = Nf(oe[0], oe[1], oe[2], w), se = ge.filter(function(de) {
13959 return 0 <= de && de <= 1;
13960 });
13961 if (se.length > 0)
13962 return se[0];
13963 }
13964 return null;
13965 }, v = Object.keys(h), d = 0; d < v.length; d++) {
13966 var g = v[d], y = h[g], p = c(e, r, y);
13967 if (p != null) {
13968 var m = y[5], b = y[3], E = y[1], M = St(m, b, E, p);
13969 if (y.isTop && M <= r || y.isBottom && r <= M)
13970 return !0;
13971 }
13972 }
13973 return !1;
13974 }
13975 };
13976 }, yr.generateBottomRoundrectangle = function() {
13977 return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes.bottomroundrectangle = {
13978 renderer: this,
13979 name: "bottom-round-rectangle",
13980 points: $t(4, 0),
13981 draw: function(e, r, a, n, i) {
13982 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13983 },
13984 intersectLine: function(e, r, a, n, i, s, o) {
13985 var l = e - (a / 2 + o), u = r - (n / 2 + o), f = u, h = e + (a / 2 + o), c = Tr(i, s, e, r, l, u, h, f, !1);
13986 return c.length > 0 ? c : Ts(i, s, e, r, a, n, o);
13987 },
13988 checkPoint: function(e, r, a, n, i, s, o) {
13989 var l = Fa(n, i), u = 2 * l;
13990 if (gr(e, r, this.points, s, o, n, i - u, [0, -1], a) || gr(e, r, this.points, s, o, n - u, i, [0, -1], a))
13991 return !0;
13992 var f = n / 2 + 2 * a, h = i / 2 + 2 * a, c = [s - f, o - h, s - f, o, s + f, o, s + f, o - h];
13993 return !!(Yt(e, r, c) || Fr(e, r, u, u, s + n / 2 - l, o + i / 2 - l, a) || Fr(e, r, u, u, s - n / 2 + l, o + i / 2 - l, a));
13994 }
13995 };
13996 }, yr.registerNodeShapes = function() {
13997 var t = this.nodeShapes = {}, e = this;
13998 this.generateEllipse(), this.generatePolygon("triangle", $t(3, 0)), this.generateRoundPolygon("round-triangle", $t(3, 0)), this.generatePolygon("rectangle", $t(4, 0)), t.square = t.rectangle, this.generateRoundRectangle(), this.generateCutRectangle(), this.generateBarrel(), this.generateBottomRoundrectangle();
13999 {
14000 var r = [0, 1, 1, 0, 0, -1, -1, 0];
14001 this.generatePolygon("diamond", r), this.generateRoundPolygon("round-diamond", r);
14002 }
14003 this.generatePolygon("pentagon", $t(5, 0)), this.generateRoundPolygon("round-pentagon", $t(5, 0)), this.generatePolygon("hexagon", $t(6, 0)), this.generateRoundPolygon("round-hexagon", $t(6, 0)), this.generatePolygon("heptagon", $t(7, 0)), this.generateRoundPolygon("round-heptagon", $t(7, 0)), this.generatePolygon("octagon", $t(8, 0)), this.generateRoundPolygon("round-octagon", $t(8, 0));
14004 var a = new Array(20);
14005 {
14006 var n = vi(5, 0), i = vi(5, Math.PI / 5), s = 0.5 * (3 - Math.sqrt(5));
14007 s *= 1.57;
14008 for (var o = 0; o < i.length / 2; o++)
14009 i[o * 2] *= s, i[o * 2 + 1] *= s;
14010 for (var o = 0; o < 20 / 4; o++)
14011 a[o * 4] = n[o * 2], a[o * 4 + 1] = n[o * 2 + 1], a[o * 4 + 2] = i[o * 2], a[o * 4 + 3] = i[o * 2 + 1];
14012 }
14013 a = Ss(a), this.generatePolygon("star", a), this.generatePolygon("vee", [-1, -1, 0, -0.333, 1, -1, 0, 1]), this.generatePolygon("rhomboid", [-1, -1, 0.333, -1, 1, 1, -0.333, 1]), this.nodeShapes.concavehexagon = this.generatePolygon("concave-hexagon", [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]);
14014 {
14015 var l = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1];
14016 this.generatePolygon("tag", l), this.generateRoundPolygon("round-tag", l);
14017 }
14018 t.makePolygon = function(u) {
14019 var f = u.join("$"), h = "polygon-" + f, c;
14020 return (c = this[h]) ? c : e.generatePolygon(h, u);
14021 };
14022 };
14023 var Ja = {};
14024 Ja.timeToRender = function() {
14025 return this.redrawTotalTime / this.redrawCount;
14026 }, Ja.redraw = function(t) {
14027 t = t || ys();
14028 var e = this;
14029 e.averageRedrawTime === void 0 && (e.averageRedrawTime = 0), e.lastRedrawTime === void 0 && (e.lastRedrawTime = 0), e.lastDrawTime === void 0 && (e.lastDrawTime = 0), e.requestedFrame = !0, e.renderOptions = t;
14030 }, Ja.beforeRender = function(t, e) {
14031 if (!this.destroyed) {
14032 e == null && xt("Priority is not optional for beforeRender");
14033 var r = this.beforeRenderCallbacks;
14034 r.push({
14035 fn: t,
14036 priority: e
14037 }), r.sort(function(a, n) {
14038 return n.priority - a.priority;
14039 });
14040 }
14041 };
14042 var vu = function(e, r, a) {
14043 for (var n = e.beforeRenderCallbacks, i = 0; i < n.length; i++)
14044 n[i].fn(r, a);
14045 };
14046 Ja.startRenderLoop = function() {
14047 var t = this, e = t.cy;
14048 if (!t.renderLoopStarted) {
14049 t.renderLoopStarted = !0;
14050 var r = function a(n) {
14051 if (!t.destroyed) {
14052 if (!e.batching())
14053 if (t.requestedFrame && !t.skipFrame) {
14054 vu(t, !0, n);
14055 var i = dr();
14056 t.render(t.renderOptions);
14057 var s = t.lastDrawTime = dr();
14058 t.averageRedrawTime === void 0 && (t.averageRedrawTime = s - i), t.redrawCount === void 0 && (t.redrawCount = 0), t.redrawCount++, t.redrawTotalTime === void 0 && (t.redrawTotalTime = 0);
14059 var o = s - i;
14060 t.redrawTotalTime += o, t.lastRedrawTime = o, t.averageRedrawTime = t.averageRedrawTime / 2 + o / 2, t.requestedFrame = !1;
14061 } else
14062 vu(t, !1, n);
14063 t.skipFrame = !1, fn(a);
14064 }
14065 };
14066 fn(r);
14067 }
14068 };
14069 var dg = function(e) {
14070 this.init(e);
14071 }, du = dg, ma = du.prototype;
14072 ma.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"], ma.init = function(t) {
14073 var e = this;
14074 e.options = t, e.cy = t.cy;
14075 var r = e.container = t.cy.container();
14076 if (D) {
14077 var a = D.document, n = a.head, i = "__________cytoscape_stylesheet", s = "__________cytoscape_container", o = a.getElementById(i) != null;
14078 if (r.className.indexOf(s) < 0 && (r.className = (r.className || "") + " " + s), !o) {
14079 var l = a.createElement("style");
14080 l.id = i, l.innerHTML = "." + s + " { position: relative; }", n.insertBefore(l, n.children[0]);
14081 }
14082 var u = D.getComputedStyle(r), f = u.getPropertyValue("position");
14083 f === "static" && ft("A Cytoscape container has style position:static and so can not use UI extensions properly");
14084 }
14085 e.selection = [void 0, void 0, void 0, void 0, 0], e.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95], e.hoverData = {
14086 down: null,
14087 last: null,
14088 downTime: null,
14089 triggerMode: null,
14090 dragging: !1,
14091 initialPan: [null, null],
14092 capture: !1
14093 }, e.dragData = {
14094 possibleDragElements: []
14095 }, e.touchData = {
14096 start: null,
14097 capture: !1,
14098 // These 3 fields related to tap, taphold events
14099 startPosition: [null, null, null, null, null, null],
14100 singleTouchStartTime: null,
14101 singleTouchMoved: !0,
14102 now: [null, null, null, null, null, null],
14103 earlier: [null, null, null, null, null, null]
14104 }, e.redraws = 0, e.showFps = t.showFps, e.debug = t.debug, e.hideEdgesOnViewport = t.hideEdgesOnViewport, e.textureOnViewport = t.textureOnViewport, e.wheelSensitivity = t.wheelSensitivity, e.motionBlurEnabled = t.motionBlur, e.forcedPixelRatio = k(t.pixelRatio) ? t.pixelRatio : null, e.motionBlur = t.motionBlur, e.motionBlurOpacity = t.motionBlurOpacity, e.motionBlurTransparency = 1 - e.motionBlurOpacity, e.motionBlurPxRatio = 1, e.mbPxRBlurry = 1, e.minMbLowQualFrames = 4, e.fullQualityMb = !1, e.clearedForMotionBlur = [], e.desktopTapThreshold = t.desktopTapThreshold, e.desktopTapThreshold2 = t.desktopTapThreshold * t.desktopTapThreshold, e.touchTapThreshold = t.touchTapThreshold, e.touchTapThreshold2 = t.touchTapThreshold * t.touchTapThreshold, e.tapholdDuration = 500, e.bindings = [], e.beforeRenderCallbacks = [], e.beforeRenderPriorities = {
14105 // higher priority execs before lower one
14106 animations: 400,
14107 eleCalcs: 300,
14108 eleTxrDeq: 200,
14109 lyrTxrDeq: 150,
14110 lyrTxrSkip: 100
14111 }, e.registerNodeShapes(), e.registerArrowShapes(), e.registerCalculationListeners();
14112 }, ma.notify = function(t, e) {
14113 var r = this, a = r.cy;
14114 if (!this.destroyed) {
14115 if (t === "init") {
14116 r.load();
14117 return;
14118 }
14119 if (t === "destroy") {
14120 r.destroy();
14121 return;
14122 }
14123 (t === "add" || t === "remove" || t === "move" && a.hasCompoundNodes() || t === "load" || t === "zorder" || t === "mount") && r.invalidateCachedZSortedEles(), t === "viewport" && r.redrawHint("select", !0), (t === "load" || t === "resize" || t === "mount") && (r.invalidateContainerClientCoordsCache(), r.matchCanvasSize(r.container)), r.redrawHint("eles", !0), r.redrawHint("drag", !0), this.startRenderLoop(), this.redraw();
14124 }
14125 }, ma.destroy = function() {
14126 var t = this;
14127 t.destroyed = !0, t.cy.stopAnimationLoop();
14128 for (var e = 0; e < t.bindings.length; e++) {
14129 var r = t.bindings[e], a = r, n = a.target;
14130 (n.off || n.removeEventListener).apply(n, a.args);
14131 }
14132 if (t.bindings = [], t.beforeRenderCallbacks = [], t.onUpdateEleCalcsFns = [], t.removeObserver && t.removeObserver.disconnect(), t.styleObserver && t.styleObserver.disconnect(), t.resizeObserver && t.resizeObserver.disconnect(), t.labelCalcDiv)
14133 try {
14134 document.body.removeChild(t.labelCalcDiv);
14135 } catch {
14136 }
14137 }, ma.isHeadless = function() {
14138 return !1;
14139 }, [zi, hu, cu, ya, yr, Ja].forEach(function(t) {
14140 Ue(ma, t);
14141 });
14142 var $i = 1e3 / 60, gu = {
14143 setupDequeueing: function(e) {
14144 return function() {
14145 var a = this, n = this.renderer;
14146 if (!a.dequeueingSetup) {
14147 a.dequeueingSetup = !0;
14148 var i = ln(function() {
14149 n.redrawHint("eles", !0), n.redrawHint("drag", !0), n.redraw();
14150 }, e.deqRedrawThreshold), s = function(u, f) {
14151 var h = dr(), c = n.averageRedrawTime, v = n.lastRedrawTime, d = [], g = n.cy.extent(), y = n.getPixelRatio();
14152 for (u || n.flushRenderedStyleQueue(); ; ) {
14153 var p = dr(), m = p - h, b = p - f;
14154 if (v < $i) {
14155 var E = $i - (u ? c : 0);
14156 if (b >= e.deqFastCost * E)
14157 break;
14158 } else if (u) {
14159 if (m >= e.deqCost * v || m >= e.deqAvgCost * c)
14160 break;
14161 } else if (b >= e.deqNoDrawCost * $i)
14162 break;
14163 var M = e.deq(a, y, g);
14164 if (M.length > 0)
14165 for (var A = 0; A < M.length; A++)
14166 d.push(M[A]);
14167 else
14168 break;
14169 }
14170 d.length > 0 && (e.onDeqd(a, d), !u && e.shouldRedraw(a, d, y, g) && i());
14171 }, o = e.priority || si;
14172 n.beforeRender(s, o(a));
14173 }
14174 };
14175 }
14176 }, gg = /* @__PURE__ */ function() {
14177 function t(e) {
14178 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : cn;
14179 ve(this, t), this.idsByKey = new ur(), this.keyForId = new ur(), this.cachesByLvl = new ur(), this.lvls = [], this.getKey = e, this.doesEleInvalidateKey = r;
14180 }
14181 return O(t, [{
14182 key: "getIdsFor",
14183 value: function(r) {
14184 r == null && xt("Can not get id list for null key");
14185 var a = this.idsByKey, n = this.idsByKey.get(r);
14186 return n || (n = new Jr(), a.set(r, n)), n;
14187 }
14188 }, {
14189 key: "addIdForKey",
14190 value: function(r, a) {
14191 r != null && this.getIdsFor(r).add(a);
14192 }
14193 }, {
14194 key: "deleteIdForKey",
14195 value: function(r, a) {
14196 r != null && this.getIdsFor(r).delete(a);
14197 }
14198 }, {
14199 key: "getNumberOfIdsForKey",
14200 value: function(r) {
14201 return r == null ? 0 : this.getIdsFor(r).size;
14202 }
14203 }, {
14204 key: "updateKeyMappingFor",
14205 value: function(r) {
14206 var a = r.id(), n = this.keyForId.get(a), i = this.getKey(r);
14207 this.deleteIdForKey(n, a), this.addIdForKey(i, a), this.keyForId.set(a, i);
14208 }
14209 }, {
14210 key: "deleteKeyMappingFor",
14211 value: function(r) {
14212 var a = r.id(), n = this.keyForId.get(a);
14213 this.deleteIdForKey(n, a), this.keyForId.delete(a);
14214 }
14215 }, {
14216 key: "keyHasChangedFor",
14217 value: function(r) {
14218 var a = r.id(), n = this.keyForId.get(a), i = this.getKey(r);
14219 return n !== i;
14220 }
14221 }, {
14222 key: "isInvalid",
14223 value: function(r) {
14224 return this.keyHasChangedFor(r) || this.doesEleInvalidateKey(r);
14225 }
14226 }, {
14227 key: "getCachesAt",
14228 value: function(r) {
14229 var a = this.cachesByLvl, n = this.lvls, i = a.get(r);
14230 return i || (i = new ur(), a.set(r, i), n.push(r)), i;
14231 }
14232 }, {
14233 key: "getCache",
14234 value: function(r, a) {
14235 return this.getCachesAt(a).get(r);
14236 }
14237 }, {
14238 key: "get",
14239 value: function(r, a) {
14240 var n = this.getKey(r), i = this.getCache(n, a);
14241 return i != null && this.updateKeyMappingFor(r), i;
14242 }
14243 }, {
14244 key: "getForCachedKey",
14245 value: function(r, a) {
14246 var n = this.keyForId.get(r.id()), i = this.getCache(n, a);
14247 return i;
14248 }
14249 }, {
14250 key: "hasCache",
14251 value: function(r, a) {
14252 return this.getCachesAt(a).has(r);
14253 }
14254 }, {
14255 key: "has",
14256 value: function(r, a) {
14257 var n = this.getKey(r);
14258 return this.hasCache(n, a);
14259 }
14260 }, {
14261 key: "setCache",
14262 value: function(r, a, n) {
14263 n.key = r, this.getCachesAt(a).set(r, n);
14264 }
14265 }, {
14266 key: "set",
14267 value: function(r, a, n) {
14268 var i = this.getKey(r);
14269 this.setCache(i, a, n), this.updateKeyMappingFor(r);
14270 }
14271 }, {
14272 key: "deleteCache",
14273 value: function(r, a) {
14274 this.getCachesAt(a).delete(r);
14275 }
14276 }, {
14277 key: "delete",
14278 value: function(r, a) {
14279 var n = this.getKey(r);
14280 this.deleteCache(n, a);
14281 }
14282 }, {
14283 key: "invalidateKey",
14284 value: function(r) {
14285 var a = this;
14286 this.lvls.forEach(function(n) {
14287 return a.deleteCache(r, n);
14288 });
14289 }
14290 // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key)
14291 }, {
14292 key: "invalidate",
14293 value: function(r) {
14294 var a = r.id(), n = this.keyForId.get(a);
14295 this.deleteKeyMappingFor(r);
14296 var i = this.doesEleInvalidateKey(r);
14297 return i && this.invalidateKey(n), i || this.getNumberOfIdsForKey(n) === 0;
14298 }
14299 }]), t;
14300 }(), pu = 25, Wn = 50, Kn = -4, Vi = 3, pg = 7.99, yg = 8, mg = 1024, bg = 1024, Eg = 1024, wg = 0.2, xg = 0.8, Tg = 10, Cg = 0.15, Dg = 0.1, Sg = 0.9, Lg = 0.9, Ag = 100, Og = 1, ba = {
14301 dequeue: "dequeue",
14302 downscale: "downscale",
14303 highQuality: "highQuality"
14304 }, Ng = Lt({
14305 getKey: null,
14306 doesEleInvalidateKey: cn,
14307 drawElement: null,
14308 getBoundingBox: null,
14309 getRotationPoint: null,
14310 getRotationOffset: null,
14311 isVisible: vs,
14312 allowEdgeTxrCaching: !0,
14313 allowParentTxrCaching: !0
14314 }), ja = function(e, r) {
14315 var a = this;
14316 a.renderer = e, a.onDequeues = [];
14317 var n = Ng(r);
14318 Ue(a, n), a.lookup = new gg(n.getKey, n.doesEleInvalidateKey), a.setupDequeueing();
14319 }, Dt = ja.prototype;
14320 Dt.reasons = ba, Dt.getTextureQueue = function(t) {
14321 var e = this;
14322 return e.eleImgCaches = e.eleImgCaches || {}, e.eleImgCaches[t] = e.eleImgCaches[t] || [];
14323 }, Dt.getRetiredTextureQueue = function(t) {
14324 var e = this, r = e.eleImgCaches.retired = e.eleImgCaches.retired || {}, a = r[t] = r[t] || [];
14325 return a;
14326 }, Dt.getElementQueue = function() {
14327 var t = this, e = t.eleCacheQueue = t.eleCacheQueue || new Ra(function(r, a) {
14328 return a.reqs - r.reqs;
14329 });
14330 return e;
14331 }, Dt.getElementKeyToQueue = function() {
14332 var t = this, e = t.eleKeyToCacheQueue = t.eleKeyToCacheQueue || {};
14333 return e;
14334 }, Dt.getElement = function(t, e, r, a, n) {
14335 var i = this, s = this.renderer, o = s.cy.zoom(), l = this.lookup;
14336 if (!e || e.w === 0 || e.h === 0 || isNaN(e.w) || isNaN(e.h) || !t.visible() || t.removed() || !i.allowEdgeTxrCaching && t.isEdge() || !i.allowParentTxrCaching && t.isParent())
14337 return null;
14338 if (a == null && (a = Math.ceil(li(o * r))), a < Kn)
14339 a = Kn;
14340 else if (o >= pg || a > Vi)
14341 return null;
14342 var u = Math.pow(2, a), f = e.h * u, h = e.w * u, c = s.eleTextBiggerThanMin(t, u);
14343 if (!this.isVisible(t, c))
14344 return null;
14345 var v = l.get(t, a);
14346 if (v && v.invalidated && (v.invalidated = !1, v.texture.invalidatedWidth -= v.width), v)
14347 return v;
14348 var d;
14349 if (f <= pu ? d = pu : f <= Wn ? d = Wn : d = Math.ceil(f / Wn) * Wn, f > Eg || h > bg)
14350 return null;
14351 var g = i.getTextureQueue(d), y = g[g.length - 2], p = function() {
14352 return i.recycleTexture(d, h) || i.addTexture(d, h);
14353 };
14354 y || (y = g[g.length - 1]), y || (y = p()), y.width - y.usedWidth < h && (y = p());
14355 for (var m = function(W) {
14356 return W && W.scaledLabelShown === c;
14357 }, b = n && n === ba.dequeue, E = n && n === ba.highQuality, M = n && n === ba.downscale, A, w = a + 1; w <= Vi; w++) {
14358 var I = l.get(t, w);
14359 if (I) {
14360 A = I;
14361 break;
14362 }
14363 }
14364 var C = A && A.level === a + 1 ? A : null, B = function() {
14365 y.context.drawImage(C.texture.canvas, C.x, 0, C.width, C.height, y.usedWidth, 0, h, f);
14366 };
14367 if (y.context.setTransform(1, 0, 0, 1, 0, 0), y.context.clearRect(y.usedWidth, 0, h, d), m(C))
14368 B();
14369 else if (m(A))
14370 if (E) {
14371 for (var F = A.level; F > a; F--)
14372 C = i.getElement(t, e, r, F, ba.downscale);
14373 B();
14374 } else
14375 return i.queueElement(t, A.level - 1), A;
14376 else {
14377 var R;
14378 if (!b && !E && !M)
14379 for (var X = a - 1; X >= Kn; X--) {
14380 var z = l.get(t, X);
14381 if (z) {
14382 R = z;
14383 break;
14384 }
14385 }
14386 if (m(R))
14387 return i.queueElement(t, a), R;
14388 y.context.translate(y.usedWidth, 0), y.context.scale(u, u), this.drawElement(y.context, t, e, c, !1), y.context.scale(1 / u, 1 / u), y.context.translate(-y.usedWidth, 0);
14389 }
14390 return v = {
14391 x: y.usedWidth,
14392 texture: y,
14393 level: a,
14394 scale: u,
14395 width: h,
14396 height: f,
14397 scaledLabelShown: c
14398 }, y.usedWidth += Math.ceil(h + yg), y.eleCaches.push(v), l.set(t, a, v), i.checkTextureFullness(y), v;
14399 }, Dt.invalidateElements = function(t) {
14400 for (var e = 0; e < t.length; e++)
14401 this.invalidateElement(t[e]);
14402 }, Dt.invalidateElement = function(t) {
14403 var e = this, r = e.lookup, a = [], n = r.isInvalid(t);
14404 if (n) {
14405 for (var i = Kn; i <= Vi; i++) {
14406 var s = r.getForCachedKey(t, i);
14407 s && a.push(s);
14408 }
14409 var o = r.invalidate(t);
14410 if (o)
14411 for (var l = 0; l < a.length; l++) {
14412 var u = a[l], f = u.texture;
14413 f.invalidatedWidth += u.width, u.invalidated = !0, e.checkTextureUtility(f);
14414 }
14415 e.removeFromQueue(t);
14416 }
14417 }, Dt.checkTextureUtility = function(t) {
14418 t.invalidatedWidth >= wg * t.width && this.retireTexture(t);
14419 }, Dt.checkTextureFullness = function(t) {
14420 var e = this, r = e.getTextureQueue(t.height);
14421 t.usedWidth / t.width > xg && t.fullnessChecks >= Tg ? wr(r, t) : t.fullnessChecks++;
14422 }, Dt.retireTexture = function(t) {
14423 var e = this, r = t.height, a = e.getTextureQueue(r), n = this.lookup;
14424 wr(a, t), t.retired = !0;
14425 for (var i = t.eleCaches, s = 0; s < i.length; s++) {
14426 var o = i[s];
14427 n.deleteCache(o.key, o.level);
14428 }
14429 oi(i);
14430 var l = e.getRetiredTextureQueue(r);
14431 l.push(t);
14432 }, Dt.addTexture = function(t, e) {
14433 var r = this, a = r.getTextureQueue(t), n = {};
14434 return a.push(n), n.eleCaches = [], n.height = t, n.width = Math.max(mg, e), n.usedWidth = 0, n.invalidatedWidth = 0, n.fullnessChecks = 0, n.canvas = r.renderer.makeOffscreenCanvas(n.width, n.height), n.context = n.canvas.getContext("2d"), n;
14435 }, Dt.recycleTexture = function(t, e) {
14436 for (var r = this, a = r.getTextureQueue(t), n = r.getRetiredTextureQueue(t), i = 0; i < n.length; i++) {
14437 var s = n[i];
14438 if (s.width >= e)
14439 return s.retired = !1, s.usedWidth = 0, s.invalidatedWidth = 0, s.fullnessChecks = 0, oi(s.eleCaches), s.context.setTransform(1, 0, 0, 1, 0, 0), s.context.clearRect(0, 0, s.width, s.height), wr(n, s), a.push(s), s;
14440 }
14441 }, Dt.queueElement = function(t, e) {
14442 var r = this, a = r.getElementQueue(), n = r.getElementKeyToQueue(), i = this.getKey(t), s = n[i];
14443 if (s)
14444 s.level = Math.max(s.level, e), s.eles.merge(t), s.reqs++, a.updateItem(s);
14445 else {
14446 var o = {
14447 eles: t.spawn().merge(t),
14448 level: e,
14449 reqs: 1,
14450 key: i
14451 };
14452 a.push(o), n[i] = o;
14453 }
14454 }, Dt.dequeue = function(t) {
14455 for (var e = this, r = e.getElementQueue(), a = e.getElementKeyToQueue(), n = [], i = e.lookup, s = 0; s < Og && r.size() > 0; s++) {
14456 var o = r.pop(), l = o.key, u = o.eles[0], f = i.hasCache(u, o.level);
14457 if (a[l] = null, f)
14458 continue;
14459 n.push(o);
14460 var h = e.getBoundingBox(u);
14461 e.getElement(u, h, t, o.level, ba.dequeue);
14462 }
14463 return n;
14464 }, Dt.removeFromQueue = function(t) {
14465 var e = this, r = e.getElementQueue(), a = e.getElementKeyToQueue(), n = this.getKey(t), i = a[n];
14466 i != null && (i.eles.length === 1 ? (i.reqs = ii, r.updateItem(i), r.pop(), a[n] = null) : i.eles.unmerge(t));
14467 }, Dt.onDequeue = function(t) {
14468 this.onDequeues.push(t);
14469 }, Dt.offDequeue = function(t) {
14470 wr(this.onDequeues, t);
14471 }, Dt.setupDequeueing = gu.setupDequeueing({
14472 deqRedrawThreshold: Ag,
14473 deqCost: Cg,
14474 deqAvgCost: Dg,
14475 deqNoDrawCost: Sg,
14476 deqFastCost: Lg,
14477 deq: function(e, r, a) {
14478 return e.dequeue(r, a);
14479 },
14480 onDeqd: function(e, r) {
14481 for (var a = 0; a < e.onDequeues.length; a++) {
14482 var n = e.onDequeues[a];
14483 n(r);
14484 }
14485 },
14486 shouldRedraw: function(e, r, a, n) {
14487 for (var i = 0; i < r.length; i++)
14488 for (var s = r[i].eles, o = 0; o < s.length; o++) {
14489 var l = s[o].boundingBox();
14490 if (hi(l, n))
14491 return !0;
14492 }
14493 return !1;
14494 },
14495 priority: function(e) {
14496 return e.renderer.beforeRenderPriorities.eleTxrDeq;
14497 }
14498 });
14499 var Mg = 1, en = -4, Zn = 2, Ig = 3.99, Rg = 50, kg = 50, Pg = 0.15, Bg = 0.1, Fg = 0.9, zg = 0.9, Gg = 1, yu = 250, $g = 4e3 * 4e3, Vg = !0, mu = function(e) {
14500 var r = this, a = r.renderer = e, n = a.cy;
14501 r.layersByLevel = {}, r.firstGet = !0, r.lastInvalidationTime = dr() - 2 * yu, r.skipping = !1, r.eleTxrDeqs = n.collection(), r.scheduleElementRefinement = ln(function() {
14502 r.refineElementTextures(r.eleTxrDeqs), r.eleTxrDeqs.unmerge(r.eleTxrDeqs);
14503 }, kg), a.beforeRender(function(s, o) {
14504 o - r.lastInvalidationTime <= yu ? r.skipping = !0 : r.skipping = !1;
14505 }, a.beforeRenderPriorities.lyrTxrSkip);
14506 var i = function(o, l) {
14507 return l.reqs - o.reqs;
14508 };
14509 r.layersQueue = new Ra(i), r.setupDequeueing();
14510 }, Mt = mu.prototype, bu = 0, _g = Math.pow(2, 53) - 1;
14511 Mt.makeLayer = function(t, e) {
14512 var r = Math.pow(2, e), a = Math.ceil(t.w * r), n = Math.ceil(t.h * r), i = this.renderer.makeOffscreenCanvas(a, n), s = {
14513 id: bu = ++bu % _g,
14514 bb: t,
14515 level: e,
14516 width: a,
14517 height: n,
14518 canvas: i,
14519 context: i.getContext("2d"),
14520 eles: [],
14521 elesQueue: [],
14522 reqs: 0
14523 }, o = s.context, l = -s.bb.x1, u = -s.bb.y1;
14524 return o.scale(r, r), o.translate(l, u), s;
14525 }, Mt.getLayers = function(t, e, r) {
14526 var a = this, n = a.renderer, i = n.cy, s = i.zoom(), o = a.firstGet;
14527 if (a.firstGet = !1, r == null) {
14528 if (r = Math.ceil(li(s * e)), r < en)
14529 r = en;
14530 else if (s >= Ig || r > Zn)
14531 return null;
14532 }
14533 a.validateLayersElesOrdering(r, t);
14534 var l = a.layersByLevel, u = Math.pow(2, r), f = l[r] = l[r] || [], h, c = a.levelIsComplete(r, t), v, d = function() {
14535 var B = function(re) {
14536 if (a.validateLayersElesOrdering(re, t), a.levelIsComplete(re, t))
14537 return v = l[re], !0;
14538 }, F = function(re) {
14539 if (!v)
14540 for (var W = r + re; en <= W && W <= Zn && !B(W); W += re)
14541 ;
14542 };
14543 F(1), F(-1);
14544 for (var R = f.length - 1; R >= 0; R--) {
14545 var X = f[R];
14546 X.invalid && wr(f, X);
14547 }
14548 };
14549 if (!c)
14550 d();
14551 else
14552 return f;
14553 var g = function() {
14554 if (!h) {
14555 h = Ut();
14556 for (var B = 0; B < t.length; B++)
14557 Df(h, t[B].boundingBox());
14558 }
14559 return h;
14560 }, y = function(B) {
14561 B = B || {};
14562 var F = B.after;
14563 g();
14564 var R = h.w * u * (h.h * u);
14565 if (R > $g)
14566 return null;
14567 var X = a.makeLayer(h, r);
14568 if (F != null) {
14569 var z = f.indexOf(F) + 1;
14570 f.splice(z, 0, X);
14571 } else
14572 (B.insert === void 0 || B.insert) && f.unshift(X);
14573 return X;
14574 };
14575 if (a.skipping && !o)
14576 return null;
14577 for (var p = null, m = t.length / Mg, b = !o, E = 0; E < t.length; E++) {
14578 var M = t[E], A = M._private.rscratch, w = A.imgLayerCaches = A.imgLayerCaches || {}, I = w[r];
14579 if (I) {
14580 p = I;
14581 continue;
14582 }
14583 if ((!p || p.eles.length >= m || !xs(p.bb, M.boundingBox())) && (p = y({
14584 insert: !0,
14585 after: p
14586 }), !p))
14587 return null;
14588 v || b ? a.queueLayer(p, M) : a.drawEleInLayer(p, M, r, e), p.eles.push(M), w[r] = p;
14589 }
14590 return v || (b ? null : f);
14591 }, Mt.getEleLevelForLayerLevel = function(t, e) {
14592 return t;
14593 }, Mt.drawEleInLayer = function(t, e, r, a) {
14594 var n = this, i = this.renderer, s = t.context, o = e.boundingBox();
14595 o.w === 0 || o.h === 0 || !e.visible() || (r = n.getEleLevelForLayerLevel(r, a), i.setImgSmoothing(s, !1), i.drawCachedElement(s, e, null, null, r, Vg), i.setImgSmoothing(s, !0));
14596 }, Mt.levelIsComplete = function(t, e) {
14597 var r = this, a = r.layersByLevel[t];
14598 if (!a || a.length === 0)
14599 return !1;
14600 for (var n = 0, i = 0; i < a.length; i++) {
14601 var s = a[i];
14602 if (s.reqs > 0 || s.invalid)
14603 return !1;
14604 n += s.eles.length;
14605 }
14606 return n === e.length;
14607 }, Mt.validateLayersElesOrdering = function(t, e) {
14608 var r = this.layersByLevel[t];
14609 if (r)
14610 for (var a = 0; a < r.length; a++) {
14611 for (var n = r[a], i = -1, s = 0; s < e.length; s++)
14612 if (n.eles[0] === e[s]) {
14613 i = s;
14614 break;
14615 }
14616 if (i < 0) {
14617 this.invalidateLayer(n);
14618 continue;
14619 }
14620 for (var o = i, s = 0; s < n.eles.length; s++)
14621 if (n.eles[s] !== e[o + s]) {
14622 this.invalidateLayer(n);
14623 break;
14624 }
14625 }
14626 }, Mt.updateElementsInLayers = function(t, e) {
14627 for (var r = this, a = Ae(t[0]), n = 0; n < t.length; n++)
14628 for (var i = a ? null : t[n], s = a ? t[n] : t[n].ele, o = s._private.rscratch, l = o.imgLayerCaches = o.imgLayerCaches || {}, u = en; u <= Zn; u++) {
14629 var f = l[u];
14630 f && (i && r.getEleLevelForLayerLevel(f.level) !== i.level || e(f, s, i));
14631 }
14632 }, Mt.haveLayers = function() {
14633 for (var t = this, e = !1, r = en; r <= Zn; r++) {
14634 var a = t.layersByLevel[r];
14635 if (a && a.length > 0) {
14636 e = !0;
14637 break;
14638 }
14639 }
14640 return e;
14641 }, Mt.invalidateElements = function(t) {
14642 var e = this;
14643 t.length !== 0 && (e.lastInvalidationTime = dr(), !(t.length === 0 || !e.haveLayers()) && e.updateElementsInLayers(t, function(a, n, i) {
14644 e.invalidateLayer(a);
14645 }));
14646 }, Mt.invalidateLayer = function(t) {
14647 if (this.lastInvalidationTime = dr(), !t.invalid) {
14648 var e = t.level, r = t.eles, a = this.layersByLevel[e];
14649 wr(a, t), t.elesQueue = [], t.invalid = !0, t.replacement && (t.replacement.invalid = !0);
14650 for (var n = 0; n < r.length; n++) {
14651 var i = r[n]._private.rscratch.imgLayerCaches;
14652 i && (i[e] = null);
14653 }
14654 }
14655 }, Mt.refineElementTextures = function(t) {
14656 var e = this;
14657 e.updateElementsInLayers(t, function(a, n, i) {
14658 var s = a.replacement;
14659 if (s || (s = a.replacement = e.makeLayer(a.bb, a.level), s.replaces = a, s.eles = a.eles), !s.reqs)
14660 for (var o = 0; o < s.eles.length; o++)
14661 e.queueLayer(s, s.eles[o]);
14662 });
14663 }, Mt.enqueueElementRefinement = function(t) {
14664 this.eleTxrDeqs.merge(t), this.scheduleElementRefinement();
14665 }, Mt.queueLayer = function(t, e) {
14666 var r = this, a = r.layersQueue, n = t.elesQueue, i = n.hasId = n.hasId || {};
14667 if (!t.replacement) {
14668 if (e) {
14669 if (i[e.id()])
14670 return;
14671 n.push(e), i[e.id()] = !0;
14672 }
14673 t.reqs ? (t.reqs++, a.updateItem(t)) : (t.reqs = 1, a.push(t));
14674 }
14675 }, Mt.dequeue = function(t) {
14676 for (var e = this, r = e.layersQueue, a = [], n = 0; n < Gg && r.size() !== 0; ) {
14677 var i = r.peek();
14678 if (i.replacement) {
14679 r.pop();
14680 continue;
14681 }
14682 if (i.replaces && i !== i.replaces.replacement) {
14683 r.pop();
14684 continue;
14685 }
14686 if (i.invalid) {
14687 r.pop();
14688 continue;
14689 }
14690 var s = i.elesQueue.shift();
14691 s && (e.drawEleInLayer(i, s, i.level, t), n++), a.length === 0 && a.push(!0), i.elesQueue.length === 0 && (r.pop(), i.reqs = 0, i.replaces && e.applyLayerReplacement(i), e.requestRedraw());
14692 }
14693 return a;
14694 }, Mt.applyLayerReplacement = function(t) {
14695 var e = this, r = e.layersByLevel[t.level], a = t.replaces, n = r.indexOf(a);
14696 if (!(n < 0 || a.invalid)) {
14697 r[n] = t;
14698 for (var i = 0; i < t.eles.length; i++) {
14699 var s = t.eles[i]._private, o = s.imgLayerCaches = s.imgLayerCaches || {};
14700 o && (o[t.level] = t);
14701 }
14702 e.requestRedraw();
14703 }
14704 }, Mt.requestRedraw = ln(function() {
14705 var t = this.renderer;
14706 t.redrawHint("eles", !0), t.redrawHint("drag", !0), t.redraw();
14707 }, 100), Mt.setupDequeueing = gu.setupDequeueing({
14708 deqRedrawThreshold: Rg,
14709 deqCost: Pg,
14710 deqAvgCost: Bg,
14711 deqNoDrawCost: Fg,
14712 deqFastCost: zg,
14713 deq: function(e, r) {
14714 return e.dequeue(r);
14715 },
14716 onDeqd: si,
14717 shouldRedraw: vs,
14718 priority: function(e) {
14719 return e.renderer.beforeRenderPriorities.lyrTxrDeq;
14720 }
14721 });
14722 var Eu = {}, wu;
14723 function Ug(t, e) {
14724 for (var r = 0; r < e.length; r++) {
14725 var a = e[r];
14726 t.lineTo(a.x, a.y);
14727 }
14728 }
14729 function Yg(t, e, r) {
14730 for (var a, n = 0; n < e.length; n++) {
14731 var i = e[n];
14732 n === 0 && (a = i), t.lineTo(i.x, i.y);
14733 }
14734 t.quadraticCurveTo(r.x, r.y, a.x, a.y);
14735 }
14736 function xu(t, e, r) {
14737 t.beginPath && t.beginPath();
14738 for (var a = e, n = 0; n < a.length; n++) {
14739 var i = a[n];
14740 t.lineTo(i.x, i.y);
14741 }
14742 var s = r, o = r[0];
14743 t.moveTo(o.x, o.y);
14744 for (var n = 1; n < s.length; n++) {
14745 var i = s[n];
14746 t.lineTo(i.x, i.y);
14747 }
14748 t.closePath && t.closePath();
14749 }
14750 function Hg(t, e, r, a, n) {
14751 t.beginPath && t.beginPath(), t.arc(r, a, n, 0, Math.PI * 2, !1);
14752 var i = e, s = i[0];
14753 t.moveTo(s.x, s.y);
14754 for (var o = 0; o < i.length; o++) {
14755 var l = i[o];
14756 t.lineTo(l.x, l.y);
14757 }
14758 t.closePath && t.closePath();
14759 }
14760 function Xg(t, e, r, a) {
14761 t.arc(e, r, a, 0, Math.PI * 2, !1);
14762 }
14763 Eu.arrowShapeImpl = function(t) {
14764 return (wu || (wu = {
14765 polygon: Ug,
14766 "triangle-backcurve": Yg,
14767 "triangle-tee": xu,
14768 "circle-triangle": Hg,
14769 "triangle-cross": xu,
14770 circle: Xg
14771 }))[t];
14772 };
14773 var hr = {};
14774 hr.drawElement = function(t, e, r, a, n, i) {
14775 var s = this;
14776 e.isNode() ? s.drawNode(t, e, r, a, n, i) : s.drawEdge(t, e, r, a, n, i);
14777 }, hr.drawElementOverlay = function(t, e) {
14778 var r = this;
14779 e.isNode() ? r.drawNodeOverlay(t, e) : r.drawEdgeOverlay(t, e);
14780 }, hr.drawElementUnderlay = function(t, e) {
14781 var r = this;
14782 e.isNode() ? r.drawNodeUnderlay(t, e) : r.drawEdgeUnderlay(t, e);
14783 }, hr.drawCachedElementPortion = function(t, e, r, a, n, i, s, o) {
14784 var l = this, u = r.getBoundingBox(e);
14785 if (!(u.w === 0 || u.h === 0)) {
14786 var f = r.getElement(e, u, a, n, i);
14787 if (f != null) {
14788 var h = o(l, e);
14789 if (h === 0)
14790 return;
14791 var c = s(l, e), v = u.x1, d = u.y1, g = u.w, y = u.h, p, m, b, E, M;
14792 if (c !== 0) {
14793 var A = r.getRotationPoint(e);
14794 b = A.x, E = A.y, t.translate(b, E), t.rotate(c), M = l.getImgSmoothing(t), M || l.setImgSmoothing(t, !0);
14795 var w = r.getRotationOffset(e);
14796 p = w.x, m = w.y;
14797 } else
14798 p = v, m = d;
14799 var I;
14800 h !== 1 && (I = t.globalAlpha, t.globalAlpha = I * h), t.drawImage(f.texture.canvas, f.x, 0, f.width, f.height, p, m, g, y), h !== 1 && (t.globalAlpha = I), c !== 0 && (t.rotate(-c), t.translate(-b, -E), M || l.setImgSmoothing(t, !1));
14801 } else
14802 r.drawElement(t, e);
14803 }
14804 };
14805 var qg = function() {
14806 return 0;
14807 }, Wg = function(e, r) {
14808 return e.getTextAngle(r, null);
14809 }, Kg = function(e, r) {
14810 return e.getTextAngle(r, "source");
14811 }, Zg = function(e, r) {
14812 return e.getTextAngle(r, "target");
14813 }, Qg = function(e, r) {
14814 return r.effectiveOpacity();
14815 }, _i = function(e, r) {
14816 return r.pstyle("text-opacity").pfValue * r.effectiveOpacity();
14817 };
14818 hr.drawCachedElement = function(t, e, r, a, n, i) {
14819 var s = this, o = s.data, l = o.eleTxrCache, u = o.lblTxrCache, f = o.slbTxrCache, h = o.tlbTxrCache, c = e.boundingBox(), v = i === !0 ? l.reasons.highQuality : null;
14820 if (!(c.w === 0 || c.h === 0 || !e.visible()) && (!a || hi(c, a))) {
14821 var d = e.isEdge(), g = e.element()._private.rscratch.badLine;
14822 s.drawElementUnderlay(t, e), s.drawCachedElementPortion(t, e, l, r, n, v, qg, Qg), (!d || !g) && s.drawCachedElementPortion(t, e, u, r, n, v, Wg, _i), d && !g && (s.drawCachedElementPortion(t, e, f, r, n, v, Kg, _i), s.drawCachedElementPortion(t, e, h, r, n, v, Zg, _i)), s.drawElementOverlay(t, e);
14823 }
14824 }, hr.drawElements = function(t, e) {
14825 for (var r = this, a = 0; a < e.length; a++) {
14826 var n = e[a];
14827 r.drawElement(t, n);
14828 }
14829 }, hr.drawCachedElements = function(t, e, r, a) {
14830 for (var n = this, i = 0; i < e.length; i++) {
14831 var s = e[i];
14832 n.drawCachedElement(t, s, r, a);
14833 }
14834 }, hr.drawCachedNodes = function(t, e, r, a) {
14835 for (var n = this, i = 0; i < e.length; i++) {
14836 var s = e[i];
14837 s.isNode() && n.drawCachedElement(t, s, r, a);
14838 }
14839 }, hr.drawLayeredElements = function(t, e, r, a) {
14840 var n = this, i = n.data.lyrTxrCache.getLayers(e, r);
14841 if (i)
14842 for (var s = 0; s < i.length; s++) {
14843 var o = i[s], l = o.bb;
14844 l.w === 0 || l.h === 0 || t.drawImage(o.canvas, l.x1, l.y1, l.w, l.h);
14845 }
14846 else
14847 n.drawCachedElements(t, e, r, a);
14848 };
14849 var mr = {};
14850 mr.drawEdge = function(t, e, r) {
14851 var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this, o = e._private.rscratch;
14852 if (!(i && !e.visible()) && !(o.badLine || o.allpts == null || isNaN(o.allpts[0]))) {
14853 var l;
14854 r && (l = r, t.translate(-l.x1, -l.y1));
14855 var u = i ? e.pstyle("opacity").value : 1, f = i ? e.pstyle("line-opacity").value : 1, h = e.pstyle("curve-style").value, c = e.pstyle("line-style").value, v = e.pstyle("width").pfValue, d = e.pstyle("line-cap").value, g = u * f, y = u * f, p = function() {
14856 var R = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : g;
14857 h === "straight-triangle" ? (s.eleStrokeStyle(t, e, R), s.drawEdgeTrianglePath(e, t, o.allpts)) : (t.lineWidth = v, t.lineCap = d, s.eleStrokeStyle(t, e, R), s.drawEdgePath(e, t, o.allpts, c), t.lineCap = "butt");
14858 }, m = function() {
14859 n && s.drawEdgeOverlay(t, e);
14860 }, b = function() {
14861 n && s.drawEdgeUnderlay(t, e);
14862 }, E = function() {
14863 var R = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : y;
14864 s.drawArrowheads(t, e, R);
14865 }, M = function() {
14866 s.drawElementText(t, e, null, a);
14867 };
14868 t.lineJoin = "round";
14869 var A = e.pstyle("ghost").value === "yes";
14870 if (A) {
14871 var w = e.pstyle("ghost-offset-x").pfValue, I = e.pstyle("ghost-offset-y").pfValue, C = e.pstyle("ghost-opacity").value, B = g * C;
14872 t.translate(w, I), p(B), E(B), t.translate(-w, -I);
14873 }
14874 b(), p(), E(), m(), M(), r && t.translate(l.x1, l.y1);
14875 }
14876 };
14877 var Tu = function(e) {
14878 if (!["overlay", "underlay"].includes(e))
14879 throw new Error("Invalid state");
14880 return function(r, a) {
14881 if (a.visible()) {
14882 var n = a.pstyle("".concat(e, "-opacity")).value;
14883 if (n !== 0) {
14884 var i = this, s = i.usePaths(), o = a._private.rscratch, l = a.pstyle("".concat(e, "-padding")).pfValue, u = 2 * l, f = a.pstyle("".concat(e, "-color")).value;
14885 r.lineWidth = u, o.edgeType === "self" && !s ? r.lineCap = "butt" : r.lineCap = "round", i.colorStrokeStyle(r, f[0], f[1], f[2], n), i.drawEdgePath(a, r, o.allpts, "solid");
14886 }
14887 }
14888 };
14889 };
14890 mr.drawEdgeOverlay = Tu("overlay"), mr.drawEdgeUnderlay = Tu("underlay"), mr.drawEdgePath = function(t, e, r, a) {
14891 var n = t._private.rscratch, i = e, s, o = !1, l = this.usePaths(), u = t.pstyle("line-dash-pattern").pfValue, f = t.pstyle("line-dash-offset").pfValue;
14892 if (l) {
14893 var h = r.join("$"), c = n.pathCacheKey && n.pathCacheKey === h;
14894 c ? (s = e = n.pathCache, o = !0) : (s = e = new Path2D(), n.pathCacheKey = h, n.pathCache = s);
14895 }
14896 if (i.setLineDash)
14897 switch (a) {
14898 case "dotted":
14899 i.setLineDash([1, 1]);
14900 break;
14901 case "dashed":
14902 i.setLineDash(u), i.lineDashOffset = f;
14903 break;
14904 case "solid":
14905 i.setLineDash([]);
14906 break;
14907 }
14908 if (!o && !n.badLine)
14909 switch (e.beginPath && e.beginPath(), e.moveTo(r[0], r[1]), n.edgeType) {
14910 case "bezier":
14911 case "self":
14912 case "compound":
14913 case "multibezier":
14914 for (var v = 2; v + 3 < r.length; v += 4)
14915 e.quadraticCurveTo(r[v], r[v + 1], r[v + 2], r[v + 3]);
14916 break;
14917 case "straight":
14918 case "segments":
14919 case "haystack":
14920 for (var d = 2; d + 1 < r.length; d += 2)
14921 e.lineTo(r[d], r[d + 1]);
14922 break;
14923 }
14924 e = i, l ? e.stroke(s) : e.stroke(), e.setLineDash && e.setLineDash([]);
14925 }, mr.drawEdgeTrianglePath = function(t, e, r) {
14926 e.fillStyle = e.strokeStyle;
14927 for (var a = t.pstyle("width").pfValue, n = 0; n + 1 < r.length; n += 2) {
14928 var i = [r[n + 2] - r[n], r[n + 3] - r[n + 1]], s = Math.sqrt(i[0] * i[0] + i[1] * i[1]), o = [i[1] / s, -i[0] / s], l = [o[0] * a / 2, o[1] * a / 2];
14929 e.beginPath(), e.moveTo(r[n] - l[0], r[n + 1] - l[1]), e.lineTo(r[n] + l[0], r[n + 1] + l[1]), e.lineTo(r[n + 2], r[n + 3]), e.closePath(), e.fill();
14930 }
14931 }, mr.drawArrowheads = function(t, e, r) {
14932 var a = e._private.rscratch, n = a.edgeType === "haystack";
14933 n || this.drawArrowhead(t, e, "source", a.arrowStartX, a.arrowStartY, a.srcArrowAngle, r), this.drawArrowhead(t, e, "mid-target", a.midX, a.midY, a.midtgtArrowAngle, r), this.drawArrowhead(t, e, "mid-source", a.midX, a.midY, a.midsrcArrowAngle, r), n || this.drawArrowhead(t, e, "target", a.arrowEndX, a.arrowEndY, a.tgtArrowAngle, r);
14934 }, mr.drawArrowhead = function(t, e, r, a, n, i, s) {
14935 if (!(isNaN(a) || a == null || isNaN(n) || n == null || isNaN(i) || i == null)) {
14936 var o = this, l = e.pstyle(r + "-arrow-shape").value;
14937 if (l !== "none") {
14938 var u = e.pstyle(r + "-arrow-fill").value === "hollow" ? "both" : "filled", f = e.pstyle(r + "-arrow-fill").value, h = e.pstyle("width").pfValue, c = e.pstyle("opacity").value;
14939 s === void 0 && (s = c);
14940 var v = t.globalCompositeOperation;
14941 (s !== 1 || f === "hollow") && (t.globalCompositeOperation = "destination-out", o.colorFillStyle(t, 255, 255, 255, 1), o.colorStrokeStyle(t, 255, 255, 255, 1), o.drawArrowShape(e, t, u, h, l, a, n, i), t.globalCompositeOperation = v);
14942 var d = e.pstyle(r + "-arrow-color").value;
14943 o.colorFillStyle(t, d[0], d[1], d[2], s), o.colorStrokeStyle(t, d[0], d[1], d[2], s), o.drawArrowShape(e, t, f, h, l, a, n, i);
14944 }
14945 }
14946 }, mr.drawArrowShape = function(t, e, r, a, n, i, s, o) {
14947 var l = this, u = this.usePaths() && n !== "triangle-cross", f = !1, h, c = e, v = {
14948 x: i,
14949 y: s
14950 }, d = t.pstyle("arrow-scale").value, g = this.getArrowWidth(a, d), y = l.arrowShapes[n];
14951 if (u) {
14952 var p = l.arrowPathCache = l.arrowPathCache || [], m = kr(n), b = p[m];
14953 b != null ? (h = e = b, f = !0) : (h = e = new Path2D(), p[m] = h);
14954 }
14955 f || (e.beginPath && e.beginPath(), u ? y.draw(e, 1, 0, {
14956 x: 0,
14957 y: 0
14958 }, 1) : y.draw(e, g, o, v, a), e.closePath && e.closePath()), e = c, u && (e.translate(i, s), e.rotate(o), e.scale(g, g)), (r === "filled" || r === "both") && (u ? e.fill(h) : e.fill()), (r === "hollow" || r === "both") && (e.lineWidth = (y.matchEdgeWidth ? a : 1) / (u ? g : 1), e.lineJoin = "miter", u ? e.stroke(h) : e.stroke()), u && (e.scale(1 / g, 1 / g), e.rotate(-o), e.translate(-i, -s));
14959 };
14960 var Ui = {};
14961 Ui.safeDrawImage = function(t, e, r, a, n, i, s, o, l, u) {
14962 if (!(n <= 0 || i <= 0 || l <= 0 || u <= 0))
14963 try {
14964 t.drawImage(e, r, a, n, i, s, o, l, u);
14965 } catch (f) {
14966 ft(f);
14967 }
14968 }, Ui.drawInscribedImage = function(t, e, r, a, n) {
14969 var i = this, s = r.position(), o = s.x, l = s.y, u = r.cy().style(), f = u.getIndexedStyle.bind(u), h = f(r, "background-fit", "value", a), c = f(r, "background-repeat", "value", a), v = r.width(), d = r.height(), g = r.padding() * 2, y = v + (f(r, "background-width-relative-to", "value", a) === "inner" ? 0 : g), p = d + (f(r, "background-height-relative-to", "value", a) === "inner" ? 0 : g), m = r._private.rscratch, b = f(r, "background-clip", "value", a), E = b === "node", M = f(r, "background-image-opacity", "value", a) * n, A = f(r, "background-image-smoothing", "value", a), w = e.width || e.cachedW, I = e.height || e.cachedH;
14970 (w == null || I == null) && (document.body.appendChild(e), w = e.cachedW = e.width || e.offsetWidth, I = e.cachedH = e.height || e.offsetHeight, document.body.removeChild(e));
14971 var C = w, B = I;
14972 if (f(r, "background-width", "value", a) !== "auto" && (f(r, "background-width", "units", a) === "%" ? C = f(r, "background-width", "pfValue", a) * y : C = f(r, "background-width", "pfValue", a)), f(r, "background-height", "value", a) !== "auto" && (f(r, "background-height", "units", a) === "%" ? B = f(r, "background-height", "pfValue", a) * p : B = f(r, "background-height", "pfValue", a)), !(C === 0 || B === 0)) {
14973 if (h === "contain") {
14974 var F = Math.min(y / C, p / B);
14975 C *= F, B *= F;
14976 } else if (h === "cover") {
14977 var F = Math.max(y / C, p / B);
14978 C *= F, B *= F;
14979 }
14980 var R = o - y / 2, X = f(r, "background-position-x", "units", a), z = f(r, "background-position-x", "pfValue", a);
14981 X === "%" ? R += (y - C) * z : R += z;
14982 var re = f(r, "background-offset-x", "units", a), W = f(r, "background-offset-x", "pfValue", a);
14983 re === "%" ? R += (y - C) * W : R += W;
14984 var Z = l - p / 2, ie = f(r, "background-position-y", "units", a), oe = f(r, "background-position-y", "pfValue", a);
14985 ie === "%" ? Z += (p - B) * oe : Z += oe;
14986 var ge = f(r, "background-offset-y", "units", a), se = f(r, "background-offset-y", "pfValue", a);
14987 ge === "%" ? Z += (p - B) * se : Z += se, m.pathCache && (R -= o, Z -= l, o = 0, l = 0);
14988 var de = t.globalAlpha;
14989 t.globalAlpha = M;
14990 var we = i.getImgSmoothing(t), Te = !1;
14991 if (A === "no" && we ? (i.setImgSmoothing(t, !1), Te = !0) : A === "yes" && !we && (i.setImgSmoothing(t, !0), Te = !0), c === "no-repeat")
14992 E && (t.save(), m.pathCache ? t.clip(m.pathCache) : (i.nodeShapes[i.getNodeShape(r)].draw(t, o, l, y, p), t.clip())), i.safeDrawImage(t, e, 0, 0, w, I, R, Z, C, B), E && t.restore();
14993 else {
14994 var Ee = t.createPattern(e, c);
14995 t.fillStyle = Ee, i.nodeShapes[i.getNodeShape(r)].draw(t, o, l, y, p), t.translate(R, Z), t.fill(), t.translate(-R, -Z);
14996 }
14997 t.globalAlpha = de, Te && i.setImgSmoothing(t, we);
14998 }
14999 };
15000 var _r = {};
15001 _r.eleTextBiggerThanMin = function(t, e) {
15002 if (!e) {
15003 var r = t.cy().zoom(), a = this.getPixelRatio(), n = Math.ceil(li(r * a));
15004 e = Math.pow(2, n);
15005 }
15006 var i = t.pstyle("font-size").pfValue * e, s = t.pstyle("min-zoomed-font-size").pfValue;
15007 return !(i < s);
15008 }, _r.drawElementText = function(t, e, r, a, n) {
15009 var i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this;
15010 if (a == null) {
15011 if (i && !s.eleTextBiggerThanMin(e))
15012 return;
15013 } else if (a === !1)
15014 return;
15015 if (e.isNode()) {
15016 var o = e.pstyle("label");
15017 if (!o || !o.value)
15018 return;
15019 var l = s.getLabelJustification(e);
15020 t.textAlign = l, t.textBaseline = "bottom";
15021 } else {
15022 var u = e.element()._private.rscratch.badLine, f = e.pstyle("label"), h = e.pstyle("source-label"), c = e.pstyle("target-label");
15023 if (u || (!f || !f.value) && (!h || !h.value) && (!c || !c.value))
15024 return;
15025 t.textAlign = "center", t.textBaseline = "bottom";
15026 }
15027 var v = !r, d;
15028 r && (d = r, t.translate(-d.x1, -d.y1)), n == null ? (s.drawText(t, e, null, v, i), e.isEdge() && (s.drawText(t, e, "source", v, i), s.drawText(t, e, "target", v, i))) : s.drawText(t, e, n, v, i), r && t.translate(d.x1, d.y1);
15029 }, _r.getFontCache = function(t) {
15030 var e;
15031 this.fontCaches = this.fontCaches || [];
15032 for (var r = 0; r < this.fontCaches.length; r++)
15033 if (e = this.fontCaches[r], e.context === t)
15034 return e;
15035 return e = {
15036 context: t
15037 }, this.fontCaches.push(e), e;
15038 }, _r.setupTextStyle = function(t, e) {
15039 var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0, a = e.pstyle("font-style").strValue, n = e.pstyle("font-size").pfValue + "px", i = e.pstyle("font-family").strValue, s = e.pstyle("font-weight").strValue, o = r ? e.effectiveOpacity() * e.pstyle("text-opacity").value : 1, l = e.pstyle("text-outline-opacity").value * o, u = e.pstyle("color").value, f = e.pstyle("text-outline-color").value;
15040 t.font = a + " " + s + " " + n + " " + i, t.lineJoin = "round", this.colorFillStyle(t, u[0], u[1], u[2], o), this.colorStrokeStyle(t, f[0], f[1], f[2], l);
15041 };
15042 function Jg(t, e, r, a, n) {
15043 var i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5;
15044 t.beginPath(), t.moveTo(e + i, r), t.lineTo(e + a - i, r), t.quadraticCurveTo(e + a, r, e + a, r + i), t.lineTo(e + a, r + n - i), t.quadraticCurveTo(e + a, r + n, e + a - i, r + n), t.lineTo(e + i, r + n), t.quadraticCurveTo(e, r + n, e, r + n - i), t.lineTo(e, r + i), t.quadraticCurveTo(e, r, e + i, r), t.closePath(), t.fill();
15045 }
15046 _r.getTextAngle = function(t, e) {
15047 var r, a = t._private, n = a.rscratch, i = e ? e + "-" : "", s = t.pstyle(i + "text-rotation"), o = er(n, "labelAngle", e);
15048 return s.strValue === "autorotate" ? r = t.isEdge() ? o : 0 : s.strValue === "none" ? r = 0 : r = s.pfValue, r;
15049 }, _r.drawText = function(t, e, r) {
15050 var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = e._private, s = i.rscratch, o = n ? e.effectiveOpacity() : 1;
15051 if (!(n && (o === 0 || e.pstyle("text-opacity").value === 0))) {
15052 r === "main" && (r = null);
15053 var l = er(s, "labelX", r), u = er(s, "labelY", r), f, h, c = this.getLabelText(e, r);
15054 if (c != null && c !== "" && !isNaN(l) && !isNaN(u)) {
15055 this.setupTextStyle(t, e, n);
15056 var v = r ? r + "-" : "", d = er(s, "labelWidth", r), g = er(s, "labelHeight", r), y = e.pstyle(v + "text-margin-x").pfValue, p = e.pstyle(v + "text-margin-y").pfValue, m = e.isEdge(), b = e.pstyle("text-halign").value, E = e.pstyle("text-valign").value;
15057 m && (b = "center", E = "center"), l += y, u += p;
15058 var M;
15059 switch (a ? M = this.getTextAngle(e, r) : M = 0, M !== 0 && (f = l, h = u, t.translate(f, h), t.rotate(M), l = 0, u = 0), E) {
15060 case "top":
15061 break;
15062 case "center":
15063 u += g / 2;
15064 break;
15065 case "bottom":
15066 u += g;
15067 break;
15068 }
15069 var A = e.pstyle("text-background-opacity").value, w = e.pstyle("text-border-opacity").value, I = e.pstyle("text-border-width").pfValue, C = e.pstyle("text-background-padding").pfValue;
15070 if (A > 0 || I > 0 && w > 0) {
15071 var B = l - C;
15072 switch (b) {
15073 case "left":
15074 B -= d;
15075 break;
15076 case "center":
15077 B -= d / 2;
15078 break;
15079 }
15080 var F = u - g - C, R = d + 2 * C, X = g + 2 * C;
15081 if (A > 0) {
15082 var z = t.fillStyle, re = e.pstyle("text-background-color").value;
15083 t.fillStyle = "rgba(" + re[0] + "," + re[1] + "," + re[2] + "," + A * o + ")";
15084 var W = e.pstyle("text-background-shape").strValue;
15085 W.indexOf("round") === 0 ? Jg(t, B, F, R, X, 2) : t.fillRect(B, F, R, X), t.fillStyle = z;
15086 }
15087 if (I > 0 && w > 0) {
15088 var Z = t.strokeStyle, ie = t.lineWidth, oe = e.pstyle("text-border-color").value, ge = e.pstyle("text-border-style").value;
15089 if (t.strokeStyle = "rgba(" + oe[0] + "," + oe[1] + "," + oe[2] + "," + w * o + ")", t.lineWidth = I, t.setLineDash)
15090 switch (ge) {
15091 case "dotted":
15092 t.setLineDash([1, 1]);
15093 break;
15094 case "dashed":
15095 t.setLineDash([4, 2]);
15096 break;
15097 case "double":
15098 t.lineWidth = I / 4, t.setLineDash([]);
15099 break;
15100 case "solid":
15101 t.setLineDash([]);
15102 break;
15103 }
15104 if (t.strokeRect(B, F, R, X), ge === "double") {
15105 var se = I / 2;
15106 t.strokeRect(B + se, F + se, R - se * 2, X - se * 2);
15107 }
15108 t.setLineDash && t.setLineDash([]), t.lineWidth = ie, t.strokeStyle = Z;
15109 }
15110 }
15111 var de = 2 * e.pstyle("text-outline-width").pfValue;
15112 if (de > 0 && (t.lineWidth = de), e.pstyle("text-wrap").value === "wrap") {
15113 var we = er(s, "labelWrapCachedLines", r), Te = er(s, "labelLineHeight", r), Ee = d / 2, ye = this.getLabelJustification(e);
15114 switch (ye === "auto" || (b === "left" ? ye === "left" ? l += -d : ye === "center" && (l += -Ee) : b === "center" ? ye === "left" ? l += -Ee : ye === "right" && (l += Ee) : b === "right" && (ye === "center" ? l += Ee : ye === "right" && (l += d))), E) {
15115 case "top":
15116 u -= (we.length - 1) * Te;
15117 break;
15118 case "center":
15119 case "bottom":
15120 u -= (we.length - 1) * Te;
15121 break;
15122 }
15123 for (var ae = 0; ae < we.length; ae++)
15124 de > 0 && t.strokeText(we[ae], l, u), t.fillText(we[ae], l, u), u += Te;
15125 } else
15126 de > 0 && t.strokeText(c, l, u), t.fillText(c, l, u);
15127 M !== 0 && (t.rotate(-M), t.translate(-f, -h));
15128 }
15129 }
15130 };
15131 var Ea = {};
15132 Ea.drawNode = function(t, e, r) {
15133 var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this, o, l, u = e._private, f = u.rscratch, h = e.position();
15134 if (!(!k(h.x) || !k(h.y)) && !(i && !e.visible())) {
15135 var c = i ? e.effectiveOpacity() : 1, v = s.usePaths(), d, g = !1, y = e.padding();
15136 o = e.width() + 2 * y, l = e.height() + 2 * y;
15137 var p;
15138 r && (p = r, t.translate(-p.x1, -p.y1));
15139 for (var m = e.pstyle("background-image"), b = m.value, E = new Array(b.length), M = new Array(b.length), A = 0, w = 0; w < b.length; w++) {
15140 var I = b[w], C = E[w] = I != null && I !== "none";
15141 if (C) {
15142 var B = e.cy().style().getIndexedStyle(e, "background-image-crossorigin", "value", w);
15143 A++, M[w] = s.getCachedImage(I, B, function() {
15144 u.backgroundTimestamp = Date.now(), e.emitAndNotify("background");
15145 });
15146 }
15147 }
15148 var F = e.pstyle("background-blacken").value, R = e.pstyle("border-width").pfValue, X = e.pstyle("background-opacity").value * c, z = e.pstyle("border-color").value, re = e.pstyle("border-style").value, W = e.pstyle("border-opacity").value * c;
15149 t.lineJoin = "miter";
15150 var Z = function() {
15151 var ke = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : X;
15152 s.eleFillStyle(t, e, ke);
15153 }, ie = function() {
15154 var ke = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : W;
15155 s.colorStrokeStyle(t, z[0], z[1], z[2], ke);
15156 }, oe = e.pstyle("shape").strValue, ge = e.pstyle("shape-polygon-points").pfValue;
15157 if (v) {
15158 t.translate(h.x, h.y);
15159 var se = s.nodePathCache = s.nodePathCache || [], de = hs(oe === "polygon" ? oe + "," + ge.join(",") : oe, "" + l, "" + o), we = se[de];
15160 we != null ? (d = we, g = !0, f.pathCache = d) : (d = new Path2D(), se[de] = f.pathCache = d);
15161 }
15162 var Te = function() {
15163 if (!g) {
15164 var ke = h;
15165 v && (ke = {
15166 x: 0,
15167 y: 0
15168 }), s.nodeShapes[s.getNodeShape(e)].draw(d || t, ke.x, ke.y, o, l);
15169 }
15170 v ? t.fill(d) : t.fill();
15171 }, Ee = function() {
15172 for (var ke = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : c, Ge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, et = u.backgrounding, We = 0, Ye = 0; Ye < M.length; Ye++) {
15173 var Se = e.cy().style().getIndexedStyle(e, "background-image-containment", "value", Ye);
15174 if (Ge && Se === "over" || !Ge && Se === "inside") {
15175 We++;
15176 continue;
15177 }
15178 E[Ye] && M[Ye].complete && !M[Ye].error && (We++, s.drawInscribedImage(t, M[Ye], e, Ye, ke));
15179 }
15180 u.backgrounding = We !== A, et !== u.backgrounding && e.updateStyle(!1);
15181 }, ye = function() {
15182 var ke = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, Ge = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : c;
15183 s.hasPie(e) && (s.drawPie(t, e, Ge), ke && (v || s.nodeShapes[s.getNodeShape(e)].draw(t, h.x, h.y, o, l)));
15184 }, ae = function() {
15185 var ke = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : c, Ge = (F > 0 ? F : -F) * ke, et = F > 0 ? 0 : 255;
15186 F !== 0 && (s.colorFillStyle(t, et, et, et, Ge), v ? t.fill(d) : t.fill());
15187 }, xe = function() {
15188 if (R > 0) {
15189 if (t.lineWidth = R, t.lineCap = "butt", t.setLineDash)
15190 switch (re) {
15191 case "dotted":
15192 t.setLineDash([1, 1]);
15193 break;
15194 case "dashed":
15195 t.setLineDash([4, 2]);
15196 break;
15197 case "solid":
15198 case "double":
15199 t.setLineDash([]);
15200 break;
15201 }
15202 if (v ? t.stroke(d) : t.stroke(), re === "double") {
15203 t.lineWidth = R / 3;
15204 var ke = t.globalCompositeOperation;
15205 t.globalCompositeOperation = "destination-out", v ? t.stroke(d) : t.stroke(), t.globalCompositeOperation = ke;
15206 }
15207 t.setLineDash && t.setLineDash([]);
15208 }
15209 }, Ce = function() {
15210 n && s.drawNodeOverlay(t, e, h, o, l);
15211 }, Oe = function() {
15212 n && s.drawNodeUnderlay(t, e, h, o, l);
15213 }, Ie = function() {
15214 s.drawElementText(t, e, null, a);
15215 }, He = e.pstyle("ghost").value === "yes";
15216 if (He) {
15217 var qe = e.pstyle("ghost-offset-x").pfValue, Re = e.pstyle("ghost-offset-y").pfValue, Me = e.pstyle("ghost-opacity").value, Ve = Me * c;
15218 t.translate(qe, Re), Z(Me * X), Te(), Ee(Ve, !0), ie(Me * W), xe(), ye(F !== 0 || R !== 0), Ee(Ve, !1), ae(Ve), t.translate(-qe, -Re);
15219 }
15220 v && t.translate(-h.x, -h.y), Oe(), v && t.translate(h.x, h.y), Z(), Te(), Ee(c, !0), ie(), xe(), ye(F !== 0 || R !== 0), Ee(c, !1), ae(), v && t.translate(-h.x, -h.y), Ie(), Ce(), r && t.translate(p.x1, p.y1);
15221 }
15222 };
15223 var Cu = function(e) {
15224 if (!["overlay", "underlay"].includes(e))
15225 throw new Error("Invalid state");
15226 return function(r, a, n, i, s) {
15227 var o = this;
15228 if (a.visible()) {
15229 var l = a.pstyle("".concat(e, "-padding")).pfValue, u = a.pstyle("".concat(e, "-opacity")).value, f = a.pstyle("".concat(e, "-color")).value, h = a.pstyle("".concat(e, "-shape")).value;
15230 if (u > 0) {
15231 if (n = n || a.position(), i == null || s == null) {
15232 var c = a.padding();
15233 i = a.width() + 2 * c, s = a.height() + 2 * c;
15234 }
15235 o.colorFillStyle(r, f[0], f[1], f[2], u), o.nodeShapes[h].draw(r, n.x, n.y, i + l * 2, s + l * 2), r.fill();
15236 }
15237 }
15238 };
15239 };
15240 Ea.drawNodeOverlay = Cu("overlay"), Ea.drawNodeUnderlay = Cu("underlay"), Ea.hasPie = function(t) {
15241 return t = t[0], t._private.hasPie;
15242 }, Ea.drawPie = function(t, e, r, a) {
15243 e = e[0], a = a || e.position();
15244 var n = e.cy().style(), i = e.pstyle("pie-size"), s = a.x, o = a.y, l = e.width(), u = e.height(), f = Math.min(l, u) / 2, h = 0, c = this.usePaths();
15245 c && (s = 0, o = 0), i.units === "%" ? f = f * i.pfValue : i.pfValue !== void 0 && (f = i.pfValue / 2);
15246 for (var v = 1; v <= n.pieBackgroundN; v++) {
15247 var d = e.pstyle("pie-" + v + "-background-size").value, g = e.pstyle("pie-" + v + "-background-color").value, y = e.pstyle("pie-" + v + "-background-opacity").value * r, p = d / 100;
15248 p + h > 1 && (p = 1 - h);
15249 var m = 1.5 * Math.PI + 2 * Math.PI * h, b = 2 * Math.PI * p, E = m + b;
15250 d === 0 || h >= 1 || h + p > 1 || (t.beginPath(), t.moveTo(s, o), t.arc(s, o, f, m, E), t.closePath(), this.colorFillStyle(t, g[0], g[1], g[2], y), t.fill(), h += p);
15251 }
15252 };
15253 var Wt = {}, jg = 100;
15254 Wt.getPixelRatio = function() {
15255 var t = this.data.contexts[0];
15256 if (this.forcedPixelRatio != null)
15257 return this.forcedPixelRatio;
15258 var e = t.backingStorePixelRatio || t.webkitBackingStorePixelRatio || t.mozBackingStorePixelRatio || t.msBackingStorePixelRatio || t.oBackingStorePixelRatio || t.backingStorePixelRatio || 1;
15259 return (window.devicePixelRatio || 1) / e;
15260 }, Wt.paintCache = function(t) {
15261 for (var e = this.paintCaches = this.paintCaches || [], r = !0, a, n = 0; n < e.length; n++)
15262 if (a = e[n], a.context === t) {
15263 r = !1;
15264 break;
15265 }
15266 return r && (a = {
15267 context: t
15268 }, e.push(a)), a;
15269 }, Wt.createGradientStyleFor = function(t, e, r, a, n) {
15270 var i, s = this.usePaths(), o = r.pstyle(e + "-gradient-stop-colors").value, l = r.pstyle(e + "-gradient-stop-positions").pfValue;
15271 if (a === "radial-gradient")
15272 if (r.isEdge()) {
15273 var u = r.sourceEndpoint(), f = r.targetEndpoint(), h = r.midpoint(), c = Pr(u, h), v = Pr(f, h);
15274 i = t.createRadialGradient(h.x, h.y, 0, h.x, h.y, Math.max(c, v));
15275 } else {
15276 var d = s ? {
15277 x: 0,
15278 y: 0
15279 } : r.position(), g = r.paddedWidth(), y = r.paddedHeight();
15280 i = t.createRadialGradient(d.x, d.y, 0, d.x, d.y, Math.max(g, y));
15281 }
15282 else if (r.isEdge()) {
15283 var p = r.sourceEndpoint(), m = r.targetEndpoint();
15284 i = t.createLinearGradient(p.x, p.y, m.x, m.y);
15285 } else {
15286 var b = s ? {
15287 x: 0,
15288 y: 0
15289 } : r.position(), E = r.paddedWidth(), M = r.paddedHeight(), A = E / 2, w = M / 2, I = r.pstyle("background-gradient-direction").value;
15290 switch (I) {
15291 case "to-bottom":
15292 i = t.createLinearGradient(b.x, b.y - w, b.x, b.y + w);
15293 break;
15294 case "to-top":
15295 i = t.createLinearGradient(b.x, b.y + w, b.x, b.y - w);
15296 break;
15297 case "to-left":
15298 i = t.createLinearGradient(b.x + A, b.y, b.x - A, b.y);
15299 break;
15300 case "to-right":
15301 i = t.createLinearGradient(b.x - A, b.y, b.x + A, b.y);
15302 break;
15303 case "to-bottom-right":
15304 case "to-right-bottom":
15305 i = t.createLinearGradient(b.x - A, b.y - w, b.x + A, b.y + w);
15306 break;
15307 case "to-top-right":
15308 case "to-right-top":
15309 i = t.createLinearGradient(b.x - A, b.y + w, b.x + A, b.y - w);
15310 break;
15311 case "to-bottom-left":
15312 case "to-left-bottom":
15313 i = t.createLinearGradient(b.x + A, b.y - w, b.x - A, b.y + w);
15314 break;
15315 case "to-top-left":
15316 case "to-left-top":
15317 i = t.createLinearGradient(b.x + A, b.y + w, b.x - A, b.y - w);
15318 break;
15319 }
15320 }
15321 if (!i)
15322 return null;
15323 for (var C = l.length === o.length, B = o.length, F = 0; F < B; F++)
15324 i.addColorStop(C ? l[F] : F / (B - 1), "rgba(" + o[F][0] + "," + o[F][1] + "," + o[F][2] + "," + n + ")");
15325 return i;
15326 }, Wt.gradientFillStyle = function(t, e, r, a) {
15327 var n = this.createGradientStyleFor(t, "background", e, r, a);
15328 if (!n)
15329 return null;
15330 t.fillStyle = n;
15331 }, Wt.colorFillStyle = function(t, e, r, a, n) {
15332 t.fillStyle = "rgba(" + e + "," + r + "," + a + "," + n + ")";
15333 }, Wt.eleFillStyle = function(t, e, r) {
15334 var a = e.pstyle("background-fill").value;
15335 if (a === "linear-gradient" || a === "radial-gradient")
15336 this.gradientFillStyle(t, e, a, r);
15337 else {
15338 var n = e.pstyle("background-color").value;
15339 this.colorFillStyle(t, n[0], n[1], n[2], r);
15340 }
15341 }, Wt.gradientStrokeStyle = function(t, e, r, a) {
15342 var n = this.createGradientStyleFor(t, "line", e, r, a);
15343 if (!n)
15344 return null;
15345 t.strokeStyle = n;
15346 }, Wt.colorStrokeStyle = function(t, e, r, a, n) {
15347 t.strokeStyle = "rgba(" + e + "," + r + "," + a + "," + n + ")";
15348 }, Wt.eleStrokeStyle = function(t, e, r) {
15349 var a = e.pstyle("line-fill").value;
15350 if (a === "linear-gradient" || a === "radial-gradient")
15351 this.gradientStrokeStyle(t, e, a, r);
15352 else {
15353 var n = e.pstyle("line-color").value;
15354 this.colorStrokeStyle(t, n[0], n[1], n[2], r);
15355 }
15356 }, Wt.matchCanvasSize = function(t) {
15357 var e = this, r = e.data, a = e.findContainerClientCoords(), n = a[2], i = a[3], s = e.getPixelRatio(), o = e.motionBlurPxRatio;
15358 (t === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE] || t === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG]) && (s = o);
15359 var l = n * s, u = i * s, f;
15360 if (!(l === e.canvasWidth && u === e.canvasHeight)) {
15361 e.fontCaches = null;
15362 var h = r.canvasContainer;
15363 h.style.width = n + "px", h.style.height = i + "px";
15364 for (var c = 0; c < e.CANVAS_LAYERS; c++)
15365 f = r.canvases[c], f.width = l, f.height = u, f.style.width = n + "px", f.style.height = i + "px";
15366 for (var c = 0; c < e.BUFFER_COUNT; c++)
15367 f = r.bufferCanvases[c], f.width = l, f.height = u, f.style.width = n + "px", f.style.height = i + "px";
15368 e.textureMult = 1, s <= 1 && (f = r.bufferCanvases[e.TEXTURE_BUFFER], e.textureMult = 2, f.width = l * e.textureMult, f.height = u * e.textureMult), e.canvasWidth = l, e.canvasHeight = u;
15369 }
15370 }, Wt.renderTo = function(t, e, r, a) {
15371 this.render({
15372 forcedContext: t,
15373 forcedZoom: e,
15374 forcedPan: r,
15375 drawAllLayers: !0,
15376 forcedPxRatio: a
15377 });
15378 }, Wt.render = function(t) {
15379 t = t || ys();
15380 var e = t.forcedContext, r = t.drawAllLayers, a = t.drawOnlyNodeLayer, n = t.forcedZoom, i = t.forcedPan, s = this, o = t.forcedPxRatio === void 0 ? this.getPixelRatio() : t.forcedPxRatio, l = s.cy, u = s.data, f = u.canvasNeedsRedraw, h = s.textureOnViewport && !e && (s.pinching || s.hoverData.dragging || s.swipePanning || s.data.wheelZooming), c = t.motionBlur !== void 0 ? t.motionBlur : s.motionBlur, v = s.motionBlurPxRatio, d = l.hasCompoundNodes(), g = s.hoverData.draggingEles, y = !!(s.hoverData.selecting || s.touchData.selecting);
15381 c = c && !e && s.motionBlurEnabled && !y;
15382 var p = c;
15383 e || (s.prevPxRatio !== o && (s.invalidateContainerClientCoordsCache(), s.matchCanvasSize(s.container), s.redrawHint("eles", !0), s.redrawHint("drag", !0)), s.prevPxRatio = o), !e && s.motionBlurTimeout && clearTimeout(s.motionBlurTimeout), c && (s.mbFrames == null && (s.mbFrames = 0), s.mbFrames++, s.mbFrames < 3 && (p = !1), s.mbFrames > s.minMbLowQualFrames && (s.motionBlurPxRatio = s.mbPxRBlurry)), s.clearingMotionBlur && (s.motionBlurPxRatio = 1), s.textureDrawLastFrame && !h && (f[s.NODE] = !0, f[s.SELECT_BOX] = !0);
15384 var m = l.style(), b = l.zoom(), E = n !== void 0 ? n : b, M = l.pan(), A = {
15385 x: M.x,
15386 y: M.y
15387 }, w = {
15388 zoom: b,
15389 pan: {
15390 x: M.x,
15391 y: M.y
15392 }
15393 }, I = s.prevViewport, C = I === void 0 || w.zoom !== I.zoom || w.pan.x !== I.pan.x || w.pan.y !== I.pan.y;
15394 !C && !(g && !d) && (s.motionBlurPxRatio = 1), i && (A = i), E *= o, A.x *= o, A.y *= o;
15395 var B = s.getCachedZSortedEles();
15396 function F(Re, Me, Ve, Fe, ke) {
15397 var Ge = Re.globalCompositeOperation;
15398 Re.globalCompositeOperation = "destination-out", s.colorFillStyle(Re, 255, 255, 255, s.motionBlurTransparency), Re.fillRect(Me, Ve, Fe, ke), Re.globalCompositeOperation = Ge;
15399 }
15400 function R(Re, Me) {
15401 var Ve, Fe, ke, Ge;
15402 !s.clearingMotionBlur && (Re === u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE] || Re === u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]) ? (Ve = {
15403 x: M.x * v,
15404 y: M.y * v
15405 }, Fe = b * v, ke = s.canvasWidth * v, Ge = s.canvasHeight * v) : (Ve = A, Fe = E, ke = s.canvasWidth, Ge = s.canvasHeight), Re.setTransform(1, 0, 0, 1, 0, 0), Me === "motionBlur" ? F(Re, 0, 0, ke, Ge) : !e && (Me === void 0 || Me) && Re.clearRect(0, 0, ke, Ge), r || (Re.translate(Ve.x, Ve.y), Re.scale(Fe, Fe)), i && Re.translate(i.x, i.y), n && Re.scale(n, n);
15406 }
15407 if (h || (s.textureDrawLastFrame = !1), h) {
15408 if (s.textureDrawLastFrame = !0, !s.textureCache) {
15409 s.textureCache = {}, s.textureCache.bb = l.mutableElements().boundingBox(), s.textureCache.texture = s.data.bufferCanvases[s.TEXTURE_BUFFER];
15410 var X = s.data.bufferContexts[s.TEXTURE_BUFFER];
15411 X.setTransform(1, 0, 0, 1, 0, 0), X.clearRect(0, 0, s.canvasWidth * s.textureMult, s.canvasHeight * s.textureMult), s.render({
15412 forcedContext: X,
15413 drawOnlyNodeLayer: !0,
15414 forcedPxRatio: o * s.textureMult
15415 });
15416 var w = s.textureCache.viewport = {
15417 zoom: l.zoom(),
15418 pan: l.pan(),
15419 width: s.canvasWidth,
15420 height: s.canvasHeight
15421 };
15422 w.mpan = {
15423 x: (0 - w.pan.x) / w.zoom,
15424 y: (0 - w.pan.y) / w.zoom
15425 };
15426 }
15427 f[s.DRAG] = !1, f[s.NODE] = !1;
15428 var z = u.contexts[s.NODE], re = s.textureCache.texture, w = s.textureCache.viewport;
15429 z.setTransform(1, 0, 0, 1, 0, 0), c ? F(z, 0, 0, w.width, w.height) : z.clearRect(0, 0, w.width, w.height);
15430 var W = m.core("outside-texture-bg-color").value, Z = m.core("outside-texture-bg-opacity").value;
15431 s.colorFillStyle(z, W[0], W[1], W[2], Z), z.fillRect(0, 0, w.width, w.height);
15432 var b = l.zoom();
15433 R(z, !1), z.clearRect(w.mpan.x, w.mpan.y, w.width / w.zoom / o, w.height / w.zoom / o), z.drawImage(re, w.mpan.x, w.mpan.y, w.width / w.zoom / o, w.height / w.zoom / o);
15434 } else
15435 s.textureOnViewport && !e && (s.textureCache = null);
15436 var ie = l.extent(), oe = s.pinching || s.hoverData.dragging || s.swipePanning || s.data.wheelZooming || s.hoverData.draggingEles || s.cy.animated(), ge = s.hideEdgesOnViewport && oe, se = [];
15437 if (se[s.NODE] = !f[s.NODE] && c && !s.clearedForMotionBlur[s.NODE] || s.clearingMotionBlur, se[s.NODE] && (s.clearedForMotionBlur[s.NODE] = !0), se[s.DRAG] = !f[s.DRAG] && c && !s.clearedForMotionBlur[s.DRAG] || s.clearingMotionBlur, se[s.DRAG] && (s.clearedForMotionBlur[s.DRAG] = !0), f[s.NODE] || r || a || se[s.NODE]) {
15438 var de = c && !se[s.NODE] && v !== 1, z = e || (de ? s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE] : u.contexts[s.NODE]), we = c && !de ? "motionBlur" : void 0;
15439 R(z, we), ge ? s.drawCachedNodes(z, B.nondrag, o, ie) : s.drawLayeredElements(z, B.nondrag, o, ie), s.debug && s.drawDebugPoints(z, B.nondrag), !r && !c && (f[s.NODE] = !1);
15440 }
15441 if (!a && (f[s.DRAG] || r || se[s.DRAG])) {
15442 var de = c && !se[s.DRAG] && v !== 1, z = e || (de ? s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG] : u.contexts[s.DRAG]);
15443 R(z, c && !de ? "motionBlur" : void 0), ge ? s.drawCachedNodes(z, B.drag, o, ie) : s.drawCachedElements(z, B.drag, o, ie), s.debug && s.drawDebugPoints(z, B.drag), !r && !c && (f[s.DRAG] = !1);
15444 }
15445 if (s.showFps || !a && f[s.SELECT_BOX] && !r) {
15446 var z = e || u.contexts[s.SELECT_BOX];
15447 if (R(z), s.selection[4] == 1 && (s.hoverData.selecting || s.touchData.selecting)) {
15448 var b = s.cy.zoom(), Te = m.core("selection-box-border-width").value / b;
15449 z.lineWidth = Te, z.fillStyle = "rgba(" + m.core("selection-box-color").value[0] + "," + m.core("selection-box-color").value[1] + "," + m.core("selection-box-color").value[2] + "," + m.core("selection-box-opacity").value + ")", z.fillRect(s.selection[0], s.selection[1], s.selection[2] - s.selection[0], s.selection[3] - s.selection[1]), Te > 0 && (z.strokeStyle = "rgba(" + m.core("selection-box-border-color").value[0] + "," + m.core("selection-box-border-color").value[1] + "," + m.core("selection-box-border-color").value[2] + "," + m.core("selection-box-opacity").value + ")", z.strokeRect(s.selection[0], s.selection[1], s.selection[2] - s.selection[0], s.selection[3] - s.selection[1]));
15450 }
15451 if (u.bgActivePosistion && !s.hoverData.selecting) {
15452 var b = s.cy.zoom(), Ee = u.bgActivePosistion;
15453 z.fillStyle = "rgba(" + m.core("active-bg-color").value[0] + "," + m.core("active-bg-color").value[1] + "," + m.core("active-bg-color").value[2] + "," + m.core("active-bg-opacity").value + ")", z.beginPath(), z.arc(Ee.x, Ee.y, m.core("active-bg-size").pfValue / b, 0, 2 * Math.PI), z.fill();
15454 }
15455 var ye = s.lastRedrawTime;
15456 if (s.showFps && ye) {
15457 ye = Math.round(ye);
15458 var ae = Math.round(1e3 / ye);
15459 z.setTransform(1, 0, 0, 1, 0, 0), z.fillStyle = "rgba(255, 0, 0, 0.75)", z.strokeStyle = "rgba(255, 0, 0, 0.75)", z.lineWidth = 1, z.fillText("1 frame = " + ye + " ms = " + ae + " fps", 0, 20);
15460 var xe = 60;
15461 z.strokeRect(0, 30, 250, 20), z.fillRect(0, 30, 250 * Math.min(ae / xe, 1), 20);
15462 }
15463 r || (f[s.SELECT_BOX] = !1);
15464 }
15465 if (c && v !== 1) {
15466 var Ce = u.contexts[s.NODE], Oe = s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE], Ie = u.contexts[s.DRAG], He = s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG], qe = function(Me, Ve, Fe) {
15467 Me.setTransform(1, 0, 0, 1, 0, 0), Fe || !p ? Me.clearRect(0, 0, s.canvasWidth, s.canvasHeight) : F(Me, 0, 0, s.canvasWidth, s.canvasHeight);
15468 var ke = v;
15469 Me.drawImage(
15470 Ve,
15471 // img
15472 0,
15473 0,
15474 // sx, sy
15475 s.canvasWidth * ke,
15476 s.canvasHeight * ke,
15477 // sw, sh
15478 0,
15479 0,
15480 // x, y
15481 s.canvasWidth,
15482 s.canvasHeight
15483 // w, h
15484 );
15485 };
15486 (f[s.NODE] || se[s.NODE]) && (qe(Ce, Oe, se[s.NODE]), f[s.NODE] = !1), (f[s.DRAG] || se[s.DRAG]) && (qe(Ie, He, se[s.DRAG]), f[s.DRAG] = !1);
15487 }
15488 s.prevViewport = w, s.clearingMotionBlur && (s.clearingMotionBlur = !1, s.motionBlurCleared = !0, s.motionBlur = !0), c && (s.motionBlurTimeout = setTimeout(function() {
15489 s.motionBlurTimeout = null, s.clearedForMotionBlur[s.NODE] = !1, s.clearedForMotionBlur[s.DRAG] = !1, s.motionBlur = !1, s.clearingMotionBlur = !h, s.mbFrames = 0, f[s.NODE] = !0, f[s.DRAG] = !0, s.redraw();
15490 }, jg)), e || l.emit("render");
15491 };
15492 var Mr = {};
15493 Mr.drawPolygonPath = function(t, e, r, a, n, i) {
15494 var s = a / 2, o = n / 2;
15495 t.beginPath && t.beginPath(), t.moveTo(e + s * i[0], r + o * i[1]);
15496 for (var l = 1; l < i.length / 2; l++)
15497 t.lineTo(e + s * i[l * 2], r + o * i[l * 2 + 1]);
15498 t.closePath();
15499 }, Mr.drawRoundPolygonPath = function(t, e, r, a, n, i) {
15500 var s = a / 2, o = n / 2, l = di(a, n);
15501 t.beginPath && t.beginPath();
15502 for (var u = 0; u < i.length / 4; u++) {
15503 var f = void 0, h = void 0;
15504 u === 0 ? f = i.length - 2 : f = u * 4 - 2, h = u * 4 + 2;
15505 var c = e + s * i[u * 4], v = r + o * i[u * 4 + 1], d = -i[f] * i[h] - i[f + 1] * i[h + 1], g = l / Math.tan(Math.acos(d) / 2), y = c - g * i[f], p = v - g * i[f + 1], m = c + g * i[h], b = v + g * i[h + 1];
15506 u === 0 ? t.moveTo(y, p) : t.lineTo(y, p), t.arcTo(c, v, m, b, l);
15507 }
15508 t.closePath();
15509 }, Mr.drawRoundRectanglePath = function(t, e, r, a, n) {
15510 var i = a / 2, s = n / 2, o = Fa(a, n);
15511 t.beginPath && t.beginPath(), t.moveTo(e, r - s), t.arcTo(e + i, r - s, e + i, r, o), t.arcTo(e + i, r + s, e, r + s, o), t.arcTo(e - i, r + s, e - i, r, o), t.arcTo(e - i, r - s, e, r - s, o), t.lineTo(e, r - s), t.closePath();
15512 }, Mr.drawBottomRoundRectanglePath = function(t, e, r, a, n) {
15513 var i = a / 2, s = n / 2, o = Fa(a, n);
15514 t.beginPath && t.beginPath(), t.moveTo(e, r - s), t.lineTo(e + i, r - s), t.lineTo(e + i, r), t.arcTo(e + i, r + s, e, r + s, o), t.arcTo(e - i, r + s, e - i, r, o), t.lineTo(e - i, r - s), t.lineTo(e, r - s), t.closePath();
15515 }, Mr.drawCutRectanglePath = function(t, e, r, a, n) {
15516 var i = a / 2, s = n / 2, o = Ls();
15517 t.beginPath && t.beginPath(), t.moveTo(e - i + o, r - s), t.lineTo(e + i - o, r - s), t.lineTo(e + i, r - s + o), t.lineTo(e + i, r + s - o), t.lineTo(e + i - o, r + s), t.lineTo(e - i + o, r + s), t.lineTo(e - i, r + s - o), t.lineTo(e - i, r - s + o), t.closePath();
15518 }, Mr.drawBarrelPath = function(t, e, r, a, n) {
15519 var i = a / 2, s = n / 2, o = e - i, l = e + i, u = r - s, f = r + s, h = gi(a, n), c = h.widthOffset, v = h.heightOffset, d = h.ctrlPtOffsetPct * c;
15520 t.beginPath && t.beginPath(), t.moveTo(o, u + v), t.lineTo(o, f - v), t.quadraticCurveTo(o + d, f, o + c, f), t.lineTo(l - c, f), t.quadraticCurveTo(l - d, f, l, f - v), t.lineTo(l, u + v), t.quadraticCurveTo(l - d, u, l - c, u), t.lineTo(o + c, u), t.quadraticCurveTo(o + d, u, o, u + v), t.closePath();
15521 };
15522 for (var Du = Math.sin(0), Su = Math.cos(0), Yi = {}, Hi = {}, Lu = Math.PI / 40, wa = 0 * Math.PI; wa < 2 * Math.PI; wa += Lu)
15523 Yi[wa] = Math.sin(wa), Hi[wa] = Math.cos(wa);
15524 Mr.drawEllipsePath = function(t, e, r, a, n) {
15525 if (t.beginPath && t.beginPath(), t.ellipse)
15526 t.ellipse(e, r, a / 2, n / 2, 0, 0, 2 * Math.PI);
15527 else
15528 for (var i, s, o = a / 2, l = n / 2, u = 0 * Math.PI; u < 2 * Math.PI; u += Lu)
15529 i = e - o * Yi[u] * Du + o * Hi[u] * Su, s = r + l * Hi[u] * Du + l * Yi[u] * Su, u === 0 ? t.moveTo(i, s) : t.lineTo(i, s);
15530 t.closePath();
15531 };
15532 var tn = {};
15533 tn.createBuffer = function(t, e) {
15534 var r = document.createElement("canvas");
15535 return r.width = t, r.height = e, [r, r.getContext("2d")];
15536 }, tn.bufferCanvasImage = function(t) {
15537 var e = this.cy, r = e.mutableElements(), a = r.boundingBox(), n = this.findContainerClientCoords(), i = t.full ? Math.ceil(a.w) : n[2], s = t.full ? Math.ceil(a.h) : n[3], o = k(t.maxWidth) || k(t.maxHeight), l = this.getPixelRatio(), u = 1;
15538 if (t.scale !== void 0)
15539 i *= t.scale, s *= t.scale, u = t.scale;
15540 else if (o) {
15541 var f = 1 / 0, h = 1 / 0;
15542 k(t.maxWidth) && (f = u * t.maxWidth / i), k(t.maxHeight) && (h = u * t.maxHeight / s), u = Math.min(f, h), i *= u, s *= u;
15543 }
15544 o || (i *= l, s *= l, u *= l);
15545 var c = document.createElement("canvas");
15546 c.width = i, c.height = s, c.style.width = i + "px", c.style.height = s + "px";
15547 var v = c.getContext("2d");
15548 if (i > 0 && s > 0) {
15549 v.clearRect(0, 0, i, s), v.globalCompositeOperation = "source-over";
15550 var d = this.getCachedZSortedEles();
15551 if (t.full)
15552 v.translate(-a.x1 * u, -a.y1 * u), v.scale(u, u), this.drawElements(v, d), v.scale(1 / u, 1 / u), v.translate(a.x1 * u, a.y1 * u);
15553 else {
15554 var g = e.pan(), y = {
15555 x: g.x * u,
15556 y: g.y * u
15557 };
15558 u *= e.zoom(), v.translate(y.x, y.y), v.scale(u, u), this.drawElements(v, d), v.scale(1 / u, 1 / u), v.translate(-y.x, -y.y);
15559 }
15560 t.bg && (v.globalCompositeOperation = "destination-over", v.fillStyle = t.bg, v.rect(0, 0, i, s), v.fill());
15561 }
15562 return c;
15563 };
15564 function ep(t, e) {
15565 for (var r = atob(t), a = new ArrayBuffer(r.length), n = new Uint8Array(a), i = 0; i < r.length; i++)
15566 n[i] = r.charCodeAt(i);
15567 return new Blob([a], {
15568 type: e
15569 });
15570 }
15571 function Au(t) {
15572 var e = t.indexOf(",");
15573 return t.substr(e + 1);
15574 }
15575 function Ou(t, e, r) {
15576 var a = function() {
15577 return e.toDataURL(r, t.quality);
15578 };
15579 switch (t.output) {
15580 case "blob-promise":
15581 return new ia(function(n, i) {
15582 try {
15583 e.toBlob(function(s) {
15584 s != null ? n(s) : i(new Error("`canvas.toBlob()` sent a null value in its callback"));
15585 }, r, t.quality);
15586 } catch (s) {
15587 i(s);
15588 }
15589 });
15590 case "blob":
15591 return ep(Au(a()), r);
15592 case "base64":
15593 return Au(a());
15594 case "base64uri":
15595 default:
15596 return a();
15597 }
15598 }
15599 tn.png = function(t) {
15600 return Ou(t, this.bufferCanvasImage(t), "image/png");
15601 }, tn.jpg = function(t) {
15602 return Ou(t, this.bufferCanvasImage(t), "image/jpeg");
15603 };
15604 var Nu = {};
15605 Nu.nodeShapeImpl = function(t, e, r, a, n, i, s) {
15606 switch (t) {
15607 case "ellipse":
15608 return this.drawEllipsePath(e, r, a, n, i);
15609 case "polygon":
15610 return this.drawPolygonPath(e, r, a, n, i, s);
15611 case "round-polygon":
15612 return this.drawRoundPolygonPath(e, r, a, n, i, s);
15613 case "roundrectangle":
15614 case "round-rectangle":
15615 return this.drawRoundRectanglePath(e, r, a, n, i);
15616 case "cutrectangle":
15617 case "cut-rectangle":
15618 return this.drawCutRectanglePath(e, r, a, n, i);
15619 case "bottomroundrectangle":
15620 case "bottom-round-rectangle":
15621 return this.drawBottomRoundRectanglePath(e, r, a, n, i);
15622 case "barrel":
15623 return this.drawBarrelPath(e, r, a, n, i);
15624 }
15625 };
15626 var tp = Mu, ot = Mu.prototype;
15627 ot.CANVAS_LAYERS = 3, ot.SELECT_BOX = 0, ot.DRAG = 1, ot.NODE = 2, ot.BUFFER_COUNT = 3, ot.TEXTURE_BUFFER = 0, ot.MOTIONBLUR_BUFFER_NODE = 1, ot.MOTIONBLUR_BUFFER_DRAG = 2;
15628 function Mu(t) {
15629 var e = this;
15630 e.data = {
15631 canvases: new Array(ot.CANVAS_LAYERS),
15632 contexts: new Array(ot.CANVAS_LAYERS),
15633 canvasNeedsRedraw: new Array(ot.CANVAS_LAYERS),
15634 bufferCanvases: new Array(ot.BUFFER_COUNT),
15635 bufferContexts: new Array(ot.CANVAS_LAYERS)
15636 };
15637 var r = "-webkit-tap-highlight-color", a = "rgba(0,0,0,0)";
15638 e.data.canvasContainer = document.createElement("div");
15639 var n = e.data.canvasContainer.style;
15640 e.data.canvasContainer.style[r] = a, n.position = "relative", n.zIndex = "0", n.overflow = "hidden";
15641 var i = t.cy.container();
15642 i.appendChild(e.data.canvasContainer), i.style[r] = a;
15643 var s = {
15644 "-webkit-user-select": "none",
15645 "-moz-user-select": "-moz-none",
15646 "user-select": "none",
15647 "-webkit-tap-highlight-color": "rgba(0,0,0,0)",
15648 "outline-style": "none"
15649 };
15650 lt() && (s["-ms-touch-action"] = "none", s["touch-action"] = "none");
15651 for (var o = 0; o < ot.CANVAS_LAYERS; o++) {
15652 var l = e.data.canvases[o] = document.createElement("canvas");
15653 e.data.contexts[o] = l.getContext("2d"), Object.keys(s).forEach(function(ye) {
15654 l.style[ye] = s[ye];
15655 }), l.style.position = "absolute", l.setAttribute("data-id", "layer" + o), l.style.zIndex = String(ot.CANVAS_LAYERS - o), e.data.canvasContainer.appendChild(l), e.data.canvasNeedsRedraw[o] = !1;
15656 }
15657 e.data.topCanvas = e.data.canvases[0], e.data.canvases[ot.NODE].setAttribute("data-id", "layer" + ot.NODE + "-node"), e.data.canvases[ot.SELECT_BOX].setAttribute("data-id", "layer" + ot.SELECT_BOX + "-selectbox"), e.data.canvases[ot.DRAG].setAttribute("data-id", "layer" + ot.DRAG + "-drag");
15658 for (var o = 0; o < ot.BUFFER_COUNT; o++)
15659 e.data.bufferCanvases[o] = document.createElement("canvas"), e.data.bufferContexts[o] = e.data.bufferCanvases[o].getContext("2d"), e.data.bufferCanvases[o].style.position = "absolute", e.data.bufferCanvases[o].setAttribute("data-id", "buffer" + o), e.data.bufferCanvases[o].style.zIndex = String(-o - 1), e.data.bufferCanvases[o].style.visibility = "hidden";
15660 e.pathsEnabled = !0;
15661 var u = Ut(), f = function(ae) {
15662 return {
15663 x: (ae.x1 + ae.x2) / 2,
15664 y: (ae.y1 + ae.y2) / 2
15665 };
15666 }, h = function(ae) {
15667 return {
15668 x: -ae.w / 2,
15669 y: -ae.h / 2
15670 };
15671 }, c = function(ae) {
15672 var xe = ae[0]._private, Ce = xe.oldBackgroundTimestamp === xe.backgroundTimestamp;
15673 return !Ce;
15674 }, v = function(ae) {
15675 return ae[0]._private.nodeKey;
15676 }, d = function(ae) {
15677 return ae[0]._private.labelStyleKey;
15678 }, g = function(ae) {
15679 return ae[0]._private.sourceLabelStyleKey;
15680 }, y = function(ae) {
15681 return ae[0]._private.targetLabelStyleKey;
15682 }, p = function(ae, xe, Ce, Oe, Ie) {
15683 return e.drawElement(ae, xe, Ce, !1, !1, Ie);
15684 }, m = function(ae, xe, Ce, Oe, Ie) {
15685 return e.drawElementText(ae, xe, Ce, Oe, "main", Ie);
15686 }, b = function(ae, xe, Ce, Oe, Ie) {
15687 return e.drawElementText(ae, xe, Ce, Oe, "source", Ie);
15688 }, E = function(ae, xe, Ce, Oe, Ie) {
15689 return e.drawElementText(ae, xe, Ce, Oe, "target", Ie);
15690 }, M = function(ae) {
15691 return ae.boundingBox(), ae[0]._private.bodyBounds;
15692 }, A = function(ae) {
15693 return ae.boundingBox(), ae[0]._private.labelBounds.main || u;
15694 }, w = function(ae) {
15695 return ae.boundingBox(), ae[0]._private.labelBounds.source || u;
15696 }, I = function(ae) {
15697 return ae.boundingBox(), ae[0]._private.labelBounds.target || u;
15698 }, C = function(ae, xe) {
15699 return xe;
15700 }, B = function(ae) {
15701 return f(M(ae));
15702 }, F = function(ae, xe, Ce) {
15703 var Oe = ae ? ae + "-" : "";
15704 return {
15705 x: xe.x + Ce.pstyle(Oe + "text-margin-x").pfValue,
15706 y: xe.y + Ce.pstyle(Oe + "text-margin-y").pfValue
15707 };
15708 }, R = function(ae, xe, Ce) {
15709 var Oe = ae[0]._private.rscratch;
15710 return {
15711 x: Oe[xe],
15712 y: Oe[Ce]
15713 };
15714 }, X = function(ae) {
15715 return F("", R(ae, "labelX", "labelY"), ae);
15716 }, z = function(ae) {
15717 return F("source", R(ae, "sourceLabelX", "sourceLabelY"), ae);
15718 }, re = function(ae) {
15719 return F("target", R(ae, "targetLabelX", "targetLabelY"), ae);
15720 }, W = function(ae) {
15721 return h(M(ae));
15722 }, Z = function(ae) {
15723 return h(w(ae));
15724 }, ie = function(ae) {
15725 return h(I(ae));
15726 }, oe = function(ae) {
15727 var xe = A(ae), Ce = h(A(ae));
15728 if (ae.isNode()) {
15729 switch (ae.pstyle("text-halign").value) {
15730 case "left":
15731 Ce.x = -xe.w;
15732 break;
15733 case "right":
15734 Ce.x = 0;
15735 break;
15736 }
15737 switch (ae.pstyle("text-valign").value) {
15738 case "top":
15739 Ce.y = -xe.h;
15740 break;
15741 case "bottom":
15742 Ce.y = 0;
15743 break;
15744 }
15745 }
15746 return Ce;
15747 }, ge = e.data.eleTxrCache = new ja(e, {
15748 getKey: v,
15749 doesEleInvalidateKey: c,
15750 drawElement: p,
15751 getBoundingBox: M,
15752 getRotationPoint: B,
15753 getRotationOffset: W,
15754 allowEdgeTxrCaching: !1,
15755 allowParentTxrCaching: !1
15756 }), se = e.data.lblTxrCache = new ja(e, {
15757 getKey: d,
15758 drawElement: m,
15759 getBoundingBox: A,
15760 getRotationPoint: X,
15761 getRotationOffset: oe,
15762 isVisible: C
15763 }), de = e.data.slbTxrCache = new ja(e, {
15764 getKey: g,
15765 drawElement: b,
15766 getBoundingBox: w,
15767 getRotationPoint: z,
15768 getRotationOffset: Z,
15769 isVisible: C
15770 }), we = e.data.tlbTxrCache = new ja(e, {
15771 getKey: y,
15772 drawElement: E,
15773 getBoundingBox: I,
15774 getRotationPoint: re,
15775 getRotationOffset: ie,
15776 isVisible: C
15777 }), Te = e.data.lyrTxrCache = new mu(e);
15778 e.onUpdateEleCalcs(function(ae, xe) {
15779 ge.invalidateElements(xe), se.invalidateElements(xe), de.invalidateElements(xe), we.invalidateElements(xe), Te.invalidateElements(xe);
15780 for (var Ce = 0; Ce < xe.length; Ce++) {
15781 var Oe = xe[Ce]._private;
15782 Oe.oldBackgroundTimestamp = Oe.backgroundTimestamp;
15783 }
15784 });
15785 var Ee = function(ae) {
15786 for (var xe = 0; xe < ae.length; xe++)
15787 Te.enqueueElementRefinement(ae[xe].ele);
15788 };
15789 ge.onDequeue(Ee), se.onDequeue(Ee), de.onDequeue(Ee), we.onDequeue(Ee);
15790 }
15791 ot.redrawHint = function(t, e) {
15792 var r = this;
15793 switch (t) {
15794 case "eles":
15795 r.data.canvasNeedsRedraw[ot.NODE] = e;
15796 break;
15797 case "drag":
15798 r.data.canvasNeedsRedraw[ot.DRAG] = e;
15799 break;
15800 case "select":
15801 r.data.canvasNeedsRedraw[ot.SELECT_BOX] = e;
15802 break;
15803 }
15804 };
15805 var rp = typeof Path2D < "u";
15806 ot.path2dEnabled = function(t) {
15807 if (t === void 0)
15808 return this.pathsEnabled;
15809 this.pathsEnabled = !!t;
15810 }, ot.usePaths = function() {
15811 return rp && this.pathsEnabled;
15812 }, ot.setImgSmoothing = function(t, e) {
15813 t.imageSmoothingEnabled != null ? t.imageSmoothingEnabled = e : (t.webkitImageSmoothingEnabled = e, t.mozImageSmoothingEnabled = e, t.msImageSmoothingEnabled = e);
15814 }, ot.getImgSmoothing = function(t) {
15815 return t.imageSmoothingEnabled != null ? t.imageSmoothingEnabled : t.webkitImageSmoothingEnabled || t.mozImageSmoothingEnabled || t.msImageSmoothingEnabled;
15816 }, ot.makeOffscreenCanvas = function(t, e) {
15817 var r;
15818 return (typeof OffscreenCanvas > "u" ? "undefined" : ee(OffscreenCanvas)) !== "undefined" ? r = new OffscreenCanvas(t, e) : (r = document.createElement("canvas"), r.width = t, r.height = e), r;
15819 }, [Eu, hr, mr, Ui, _r, Ea, Wt, Mr, tn, Nu].forEach(function(t) {
15820 Ue(ot, t);
15821 });
15822 var ap = [{
15823 name: "null",
15824 impl: ru
15825 }, {
15826 name: "base",
15827 impl: du
15828 }, {
15829 name: "canvas",
15830 impl: tp
15831 }], np = [{
15832 type: "layout",
15833 extensions: hg
15834 }, {
15835 type: "renderer",
15836 extensions: ap
15837 }], Iu = {}, Ru = {};
15838 function ku(t, e, r) {
15839 var a = r, n = function(I) {
15840 ft("Can not register `" + e + "` for `" + t + "` since `" + I + "` already exists in the prototype and can not be overridden");
15841 };
15842 if (t === "core") {
15843 if (Za.prototype[e])
15844 return n(e);
15845 Za.prototype[e] = r;
15846 } else if (t === "collection") {
15847 if (Ot.prototype[e])
15848 return n(e);
15849 Ot.prototype[e] = r;
15850 } else if (t === "layout") {
15851 for (var i = function(I) {
15852 this.options = I, r.call(this, I), L(this._private) || (this._private = {}), this._private.cy = I.cy, this._private.listeners = [], this.createEmitter();
15853 }, s = i.prototype = Object.create(r.prototype), o = [], l = 0; l < o.length; l++) {
15854 var u = o[l];
15855 s[u] = s[u] || function() {
15856 return this;
15857 };
15858 }
15859 s.start && !s.run ? s.run = function() {
15860 return this.start(), this;
15861 } : !s.start && s.run && (s.start = function() {
15862 return this.run(), this;
15863 });
15864 var f = r.prototype.stop;
15865 s.stop = function() {
15866 var w = this.options;
15867 if (w && w.animate) {
15868 var I = this.animations;
15869 if (I)
15870 for (var C = 0; C < I.length; C++)
15871 I[C].stop();
15872 }
15873 return f ? f.call(this) : this.emit("layoutstop"), this;
15874 }, s.destroy || (s.destroy = function() {
15875 return this;
15876 }), s.cy = function() {
15877 return this._private.cy;
15878 };
15879 var h = function(I) {
15880 return I._private.cy;
15881 }, c = {
15882 addEventFields: function(I, C) {
15883 C.layout = I, C.cy = h(I), C.target = I;
15884 },
15885 bubble: function() {
15886 return !0;
15887 },
15888 parent: function(I) {
15889 return h(I);
15890 }
15891 };
15892 Ue(s, {
15893 createEmitter: function() {
15894 return this._private.emitter = new Nn(c, this), this;
15895 },
15896 emitter: function() {
15897 return this._private.emitter;
15898 },
15899 on: function(I, C) {
15900 return this.emitter().on(I, C), this;
15901 },
15902 one: function(I, C) {
15903 return this.emitter().one(I, C), this;
15904 },
15905 once: function(I, C) {
15906 return this.emitter().one(I, C), this;
15907 },
15908 removeListener: function(I, C) {
15909 return this.emitter().removeListener(I, C), this;
15910 },
15911 removeAllListeners: function() {
15912 return this.emitter().removeAllListeners(), this;
15913 },
15914 emit: function(I, C) {
15915 return this.emitter().emit(I, C), this;
15916 }
15917 }), ht.eventAliasesOn(s), a = i;
15918 } else if (t === "renderer" && e !== "null" && e !== "base") {
15919 var v = Pu("renderer", "base"), d = v.prototype, g = r, y = r.prototype, p = function() {
15920 v.apply(this, arguments), g.apply(this, arguments);
15921 }, m = p.prototype;
15922 for (var b in d) {
15923 var E = d[b], M = y[b] != null;
15924 if (M)
15925 return n(b);
15926 m[b] = E;
15927 }
15928 for (var A in y)
15929 m[A] = y[A];
15930 d.clientFunctions.forEach(function(w) {
15931 m[w] = m[w] || function() {
15932 xt("Renderer does not implement `renderer." + w + "()` on its prototype");
15933 };
15934 }), a = p;
15935 } else if (t === "__proto__" || t === "constructor" || t === "prototype")
15936 return xt(t + " is an illegal type to be registered, possibly lead to prototype pollutions");
15937 return ts({
15938 map: Iu,
15939 keys: [t, e],
15940 value: a
15941 });
15942 }
15943 function Pu(t, e) {
15944 return rs({
15945 map: Iu,
15946 keys: [t, e]
15947 });
15948 }
15949 function ip(t, e, r, a, n) {
15950 return ts({
15951 map: Ru,
15952 keys: [t, e, r, a],
15953 value: n
15954 });
15955 }
15956 function sp(t, e, r, a) {
15957 return rs({
15958 map: Ru,
15959 keys: [t, e, r, a]
15960 });
15961 }
15962 var Xi = function() {
15963 if (arguments.length === 2)
15964 return Pu.apply(null, arguments);
15965 if (arguments.length === 3)
15966 return ku.apply(null, arguments);
15967 if (arguments.length === 4)
15968 return sp.apply(null, arguments);
15969 if (arguments.length === 5)
15970 return ip.apply(null, arguments);
15971 xt("Invalid extension access syntax");
15972 };
15973 Za.prototype.extension = Xi, np.forEach(function(t) {
15974 t.extensions.forEach(function(e) {
15975 ku(t.type, e.name, e.impl);
15976 });
15977 });
15978 var Bu = function t() {
15979 if (!(this instanceof t))
15980 return new t();
15981 this.length = 0;
15982 }, Ur = Bu.prototype;
15983 Ur.instanceString = function() {
15984 return "stylesheet";
15985 }, Ur.selector = function(t) {
15986 var e = this.length++;
15987 return this[e] = {
15988 selector: t,
15989 properties: []
15990 }, this;
15991 }, Ur.css = function(t, e) {
15992 var r = this.length - 1;
15993 if (j(t))
15994 this[r].properties.push({
15995 name: t,
15996 value: e
15997 });
15998 else if (L(t))
15999 for (var a = t, n = Object.keys(a), i = 0; i < n.length; i++) {
16000 var s = n[i], o = a[s];
16001 if (o != null) {
16002 var l = Ft.properties[s] || Ft.properties[pt(s)];
16003 if (l != null) {
16004 var u = l.name, f = o;
16005 this[r].properties.push({
16006 name: u,
16007 value: f
16008 });
16009 }
16010 }
16011 }
16012 return this;
16013 }, Ur.style = Ur.css, Ur.generateStyle = function(t) {
16014 var e = new Ft(t);
16015 return this.appendToStyle(e);
16016 }, Ur.appendToStyle = function(t) {
16017 for (var e = 0; e < this.length; e++) {
16018 var r = this[e], a = r.selector, n = r.properties;
16019 t.selector(a);
16020 for (var i = 0; i < n.length; i++) {
16021 var s = n[i];
16022 t.css(s.name, s.value);
16023 }
16024 }
16025 return t;
16026 };
16027 var op = "3.23.0", Yr = function(e) {
16028 if (e === void 0 && (e = {}), L(e))
16029 return new Za(e);
16030 if (j(e))
16031 return Xi.apply(Xi, arguments);
16032 };
16033 return Yr.use = function(t) {
16034 var e = Array.prototype.slice.call(arguments, 1);
16035 return e.unshift(Yr), t.apply(null, e), this;
16036 }, Yr.warnings = function(t) {
16037 return gs(t);
16038 }, Yr.version = op, Yr.stylesheet = Yr.Stylesheet = Bu, Yr;
16039 });
16040})(Xp);
16041const Wu = Zi;
16042var Qi = {}, qp = {
16043 get exports() {
16044 return Qi;
16045 },
16046 set exports(he) {
16047 Qi = he;
16048 }
16049}, ti = {}, Wp = {
16050 get exports() {
16051 return ti;
16052 },
16053 set exports(he) {
16054 ti = he;
16055 }
16056}, ri = {}, Kp = {
16057 get exports() {
16058 return ri;
16059 },
16060 set exports(he) {
16061 ri = he;
16062 }
16063}, Vu;
16064function Zp() {
16065 return Vu || (Vu = 1, function(he, fe) {
16066 (function(ve, H) {
16067 he.exports = H();
16068 })(Ca, function() {
16069 return (
16070 /******/
16071 function(ee) {
16072 var ve = {};
16073 function H(O) {
16074 if (ve[O])
16075 return ve[O].exports;
16076 var T = ve[O] = {
16077 /******/
16078 i: O,
16079 /******/
16080 l: !1,
16081 /******/
16082 exports: {}
16083 /******/
16084 };
16085 return ee[O].call(T.exports, T, T.exports, H), T.l = !0, T.exports;
16086 }
16087 return H.m = ee, H.c = ve, H.i = function(O) {
16088 return O;
16089 }, H.d = function(O, T, x) {
16090 H.o(O, T) || Object.defineProperty(O, T, {
16091 /******/
16092 configurable: !1,
16093 /******/
16094 enumerable: !0,
16095 /******/
16096 get: x
16097 /******/
16098 });
16099 }, H.n = function(O) {
16100 var T = O && O.__esModule ? (
16101 /******/
16102 function() {
16103 return O.default;
16104 }
16105 ) : (
16106 /******/
16107 function() {
16108 return O;
16109 }
16110 );
16111 return H.d(T, "a", T), T;
16112 }, H.o = function(O, T) {
16113 return Object.prototype.hasOwnProperty.call(O, T);
16114 }, H.p = "", H(H.s = 26);
16115 }([
16116 /* 0 */
16117 /***/
16118 function(ee, ve, H) {
16119 function O() {
16120 }
16121 O.QUALITY = 1, O.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, O.DEFAULT_INCREMENTAL = !1, O.DEFAULT_ANIMATION_ON_LAYOUT = !0, O.DEFAULT_ANIMATION_DURING_LAYOUT = !1, O.DEFAULT_ANIMATION_PERIOD = 50, O.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, O.DEFAULT_GRAPH_MARGIN = 15, O.NODE_DIMENSIONS_INCLUDE_LABELS = !1, O.SIMPLE_NODE_SIZE = 40, O.SIMPLE_NODE_HALF_SIZE = O.SIMPLE_NODE_SIZE / 2, O.EMPTY_COMPOUND_NODE_SIZE = 40, O.MIN_EDGE_LENGTH = 1, O.WORLD_BOUNDARY = 1e6, O.INITIAL_WORLD_BOUNDARY = O.WORLD_BOUNDARY / 1e3, O.WORLD_CENTER_X = 1200, O.WORLD_CENTER_Y = 900, ee.exports = O;
16122 },
16123 /* 1 */
16124 /***/
16125 function(ee, ve, H) {
16126 var O = H(2), T = H(8), x = H(9);
16127 function S(U, P, K) {
16128 O.call(this, K), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = K, this.bendpoints = [], this.source = U, this.target = P;
16129 }
16130 S.prototype = Object.create(O.prototype);
16131 for (var G in O)
16132 S[G] = O[G];
16133 S.prototype.getSource = function() {
16134 return this.source;
16135 }, S.prototype.getTarget = function() {
16136 return this.target;
16137 }, S.prototype.isInterGraph = function() {
16138 return this.isInterGraph;
16139 }, S.prototype.getLength = function() {
16140 return this.length;
16141 }, S.prototype.isOverlapingSourceAndTarget = function() {
16142 return this.isOverlapingSourceAndTarget;
16143 }, S.prototype.getBendpoints = function() {
16144 return this.bendpoints;
16145 }, S.prototype.getLca = function() {
16146 return this.lca;
16147 }, S.prototype.getSourceInLca = function() {
16148 return this.sourceInLca;
16149 }, S.prototype.getTargetInLca = function() {
16150 return this.targetInLca;
16151 }, S.prototype.getOtherEnd = function(U) {
16152 if (this.source === U)
16153 return this.target;
16154 if (this.target === U)
16155 return this.source;
16156 throw "Node is not incident with this edge";
16157 }, S.prototype.getOtherEndInGraph = function(U, P) {
16158 for (var K = this.getOtherEnd(U), D = P.getGraphManager().getRoot(); ; ) {
16159 if (K.getOwner() == P)
16160 return K;
16161 if (K.getOwner() == D)
16162 break;
16163 K = K.getOwner().getParent();
16164 }
16165 return null;
16166 }, S.prototype.updateLength = function() {
16167 var U = new Array(4);
16168 this.isOverlapingSourceAndTarget = T.getIntersection(this.target.getRect(), this.source.getRect(), U), this.isOverlapingSourceAndTarget || (this.lengthX = U[0] - U[2], this.lengthY = U[1] - U[3], Math.abs(this.lengthX) < 1 && (this.lengthX = x.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = x.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY));
16169 }, S.prototype.updateLengthSimple = function() {
16170 this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = x.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = x.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY);
16171 }, ee.exports = S;
16172 },
16173 /* 2 */
16174 /***/
16175 function(ee, ve, H) {
16176 function O(T) {
16177 this.vGraphObject = T;
16178 }
16179 ee.exports = O;
16180 },
16181 /* 3 */
16182 /***/
16183 function(ee, ve, H) {
16184 var O = H(2), T = H(10), x = H(13), S = H(0), G = H(16), U = H(4);
16185 function P(D, V, _, Q) {
16186 _ == null && Q == null && (Q = V), O.call(this, Q), D.graphManager != null && (D = D.graphManager), this.estimatedSize = T.MIN_VALUE, this.inclusionTreeDepth = T.MAX_VALUE, this.vGraphObject = Q, this.edges = [], this.graphManager = D, _ != null && V != null ? this.rect = new x(V.x, V.y, _.width, _.height) : this.rect = new x();
16187 }
16188 P.prototype = Object.create(O.prototype);
16189 for (var K in O)
16190 P[K] = O[K];
16191 P.prototype.getEdges = function() {
16192 return this.edges;
16193 }, P.prototype.getChild = function() {
16194 return this.child;
16195 }, P.prototype.getOwner = function() {
16196 return this.owner;
16197 }, P.prototype.getWidth = function() {
16198 return this.rect.width;
16199 }, P.prototype.setWidth = function(D) {
16200 this.rect.width = D;
16201 }, P.prototype.getHeight = function() {
16202 return this.rect.height;
16203 }, P.prototype.setHeight = function(D) {
16204 this.rect.height = D;
16205 }, P.prototype.getCenterX = function() {
16206 return this.rect.x + this.rect.width / 2;
16207 }, P.prototype.getCenterY = function() {
16208 return this.rect.y + this.rect.height / 2;
16209 }, P.prototype.getCenter = function() {
16210 return new U(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
16211 }, P.prototype.getLocation = function() {
16212 return new U(this.rect.x, this.rect.y);
16213 }, P.prototype.getRect = function() {
16214 return this.rect;
16215 }, P.prototype.getDiagonal = function() {
16216 return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
16217 }, P.prototype.getHalfTheDiagonal = function() {
16218 return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
16219 }, P.prototype.setRect = function(D, V) {
16220 this.rect.x = D.x, this.rect.y = D.y, this.rect.width = V.width, this.rect.height = V.height;
16221 }, P.prototype.setCenter = function(D, V) {
16222 this.rect.x = D - this.rect.width / 2, this.rect.y = V - this.rect.height / 2;
16223 }, P.prototype.setLocation = function(D, V) {
16224 this.rect.x = D, this.rect.y = V;
16225 }, P.prototype.moveBy = function(D, V) {
16226 this.rect.x += D, this.rect.y += V;
16227 }, P.prototype.getEdgeListToNode = function(D) {
16228 var V = [], _ = this;
16229 return _.edges.forEach(function(Q) {
16230 if (Q.target == D) {
16231 if (Q.source != _)
16232 throw "Incorrect edge source!";
16233 V.push(Q);
16234 }
16235 }), V;
16236 }, P.prototype.getEdgesBetween = function(D) {
16237 var V = [], _ = this;
16238 return _.edges.forEach(function(Q) {
16239 if (!(Q.source == _ || Q.target == _))
16240 throw "Incorrect edge source and/or target";
16241 (Q.target == D || Q.source == D) && V.push(Q);
16242 }), V;
16243 }, P.prototype.getNeighborsList = function() {
16244 var D = /* @__PURE__ */ new Set(), V = this;
16245 return V.edges.forEach(function(_) {
16246 if (_.source == V)
16247 D.add(_.target);
16248 else {
16249 if (_.target != V)
16250 throw "Incorrect incidency!";
16251 D.add(_.source);
16252 }
16253 }), D;
16254 }, P.prototype.withChildren = function() {
16255 var D = /* @__PURE__ */ new Set(), V, _;
16256 if (D.add(this), this.child != null)
16257 for (var Q = this.child.getNodes(), ne = 0; ne < Q.length; ne++)
16258 V = Q[ne], _ = V.withChildren(), _.forEach(function(ue) {
16259 D.add(ue);
16260 });
16261 return D;
16262 }, P.prototype.getNoOfChildren = function() {
16263 var D = 0, V;
16264 if (this.child == null)
16265 D = 1;
16266 else
16267 for (var _ = this.child.getNodes(), Q = 0; Q < _.length; Q++)
16268 V = _[Q], D += V.getNoOfChildren();
16269 return D == 0 && (D = 1), D;
16270 }, P.prototype.getEstimatedSize = function() {
16271 if (this.estimatedSize == T.MIN_VALUE)
16272 throw "assert failed";
16273 return this.estimatedSize;
16274 }, P.prototype.calcEstimatedSize = function() {
16275 return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize);
16276 }, P.prototype.scatter = function() {
16277 var D, V, _ = -S.INITIAL_WORLD_BOUNDARY, Q = S.INITIAL_WORLD_BOUNDARY;
16278 D = S.WORLD_CENTER_X + G.nextDouble() * (Q - _) + _;
16279 var ne = -S.INITIAL_WORLD_BOUNDARY, ue = S.INITIAL_WORLD_BOUNDARY;
16280 V = S.WORLD_CENTER_Y + G.nextDouble() * (ue - ne) + ne, this.rect.x = D, this.rect.y = V;
16281 }, P.prototype.updateBounds = function() {
16282 if (this.getChild() == null)
16283 throw "assert failed";
16284 if (this.getChild().getNodes().length != 0) {
16285 var D = this.getChild();
16286 if (D.updateBounds(!0), this.rect.x = D.getLeft(), this.rect.y = D.getTop(), this.setWidth(D.getRight() - D.getLeft()), this.setHeight(D.getBottom() - D.getTop()), S.NODE_DIMENSIONS_INCLUDE_LABELS) {
16287 var V = D.getRight() - D.getLeft(), _ = D.getBottom() - D.getTop();
16288 this.labelWidth > V && (this.rect.x -= (this.labelWidth - V) / 2, this.setWidth(this.labelWidth)), this.labelHeight > _ && (this.labelPos == "center" ? this.rect.y -= (this.labelHeight - _) / 2 : this.labelPos == "top" && (this.rect.y -= this.labelHeight - _), this.setHeight(this.labelHeight));
16289 }
16290 }
16291 }, P.prototype.getInclusionTreeDepth = function() {
16292 if (this.inclusionTreeDepth == T.MAX_VALUE)
16293 throw "assert failed";
16294 return this.inclusionTreeDepth;
16295 }, P.prototype.transform = function(D) {
16296 var V = this.rect.x;
16297 V > S.WORLD_BOUNDARY ? V = S.WORLD_BOUNDARY : V < -S.WORLD_BOUNDARY && (V = -S.WORLD_BOUNDARY);
16298 var _ = this.rect.y;
16299 _ > S.WORLD_BOUNDARY ? _ = S.WORLD_BOUNDARY : _ < -S.WORLD_BOUNDARY && (_ = -S.WORLD_BOUNDARY);
16300 var Q = new U(V, _), ne = D.inverseTransformPoint(Q);
16301 this.setLocation(ne.x, ne.y);
16302 }, P.prototype.getLeft = function() {
16303 return this.rect.x;
16304 }, P.prototype.getRight = function() {
16305 return this.rect.x + this.rect.width;
16306 }, P.prototype.getTop = function() {
16307 return this.rect.y;
16308 }, P.prototype.getBottom = function() {
16309 return this.rect.y + this.rect.height;
16310 }, P.prototype.getParent = function() {
16311 return this.owner == null ? null : this.owner.getParent();
16312 }, ee.exports = P;
16313 },
16314 /* 4 */
16315 /***/
16316 function(ee, ve, H) {
16317 function O(T, x) {
16318 T == null && x == null ? (this.x = 0, this.y = 0) : (this.x = T, this.y = x);
16319 }
16320 O.prototype.getX = function() {
16321 return this.x;
16322 }, O.prototype.getY = function() {
16323 return this.y;
16324 }, O.prototype.setX = function(T) {
16325 this.x = T;
16326 }, O.prototype.setY = function(T) {
16327 this.y = T;
16328 }, O.prototype.getDifference = function(T) {
16329 return new DimensionD(this.x - T.x, this.y - T.y);
16330 }, O.prototype.getCopy = function() {
16331 return new O(this.x, this.y);
16332 }, O.prototype.translate = function(T) {
16333 return this.x += T.width, this.y += T.height, this;
16334 }, ee.exports = O;
16335 },
16336 /* 5 */
16337 /***/
16338 function(ee, ve, H) {
16339 var O = H(2), T = H(10), x = H(0), S = H(6), G = H(3), U = H(1), P = H(13), K = H(12), D = H(11);
16340 function V(Q, ne, ue) {
16341 O.call(this, ue), this.estimatedSize = T.MIN_VALUE, this.margin = x.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = Q, ne != null && ne instanceof S ? this.graphManager = ne : ne != null && ne instanceof Layout && (this.graphManager = ne.graphManager);
16342 }
16343 V.prototype = Object.create(O.prototype);
16344 for (var _ in O)
16345 V[_] = O[_];
16346 V.prototype.getNodes = function() {
16347 return this.nodes;
16348 }, V.prototype.getEdges = function() {
16349 return this.edges;
16350 }, V.prototype.getGraphManager = function() {
16351 return this.graphManager;
16352 }, V.prototype.getParent = function() {
16353 return this.parent;
16354 }, V.prototype.getLeft = function() {
16355 return this.left;
16356 }, V.prototype.getRight = function() {
16357 return this.right;
16358 }, V.prototype.getTop = function() {
16359 return this.top;
16360 }, V.prototype.getBottom = function() {
16361 return this.bottom;
16362 }, V.prototype.isConnected = function() {
16363 return this.isConnected;
16364 }, V.prototype.add = function(Q, ne, ue) {
16365 if (ne == null && ue == null) {
16366 var J = Q;
16367 if (this.graphManager == null)
16368 throw "Graph has no graph mgr!";
16369 if (this.getNodes().indexOf(J) > -1)
16370 throw "Node already in graph!";
16371 return J.owner = this, this.getNodes().push(J), J;
16372 } else {
16373 var j = Q;
16374 if (!(this.getNodes().indexOf(ne) > -1 && this.getNodes().indexOf(ue) > -1))
16375 throw "Source or target not in graph!";
16376 if (!(ne.owner == ue.owner && ne.owner == this))
16377 throw "Both owners must be this graph!";
16378 return ne.owner != ue.owner ? null : (j.source = ne, j.target = ue, j.isInterGraph = !1, this.getEdges().push(j), ne.edges.push(j), ue != ne && ue.edges.push(j), j);
16379 }
16380 }, V.prototype.remove = function(Q) {
16381 var ne = Q;
16382 if (Q instanceof G) {
16383 if (ne == null)
16384 throw "Node is null!";
16385 if (!(ne.owner != null && ne.owner == this))
16386 throw "Owner graph is invalid!";
16387 if (this.graphManager == null)
16388 throw "Owner graph manager is invalid!";
16389 for (var ue = ne.edges.slice(), J, j = ue.length, Y = 0; Y < j; Y++)
16390 J = ue[Y], J.isInterGraph ? this.graphManager.remove(J) : J.source.owner.remove(J);
16391 var te = this.nodes.indexOf(ne);
16392 if (te == -1)
16393 throw "Node not in owner node list!";
16394 this.nodes.splice(te, 1);
16395 } else if (Q instanceof U) {
16396 var J = Q;
16397 if (J == null)
16398 throw "Edge is null!";
16399 if (!(J.source != null && J.target != null))
16400 throw "Source and/or target is null!";
16401 if (!(J.source.owner != null && J.target.owner != null && J.source.owner == this && J.target.owner == this))
16402 throw "Source and/or target owner is invalid!";
16403 var L = J.source.edges.indexOf(J), $ = J.target.edges.indexOf(J);
16404 if (!(L > -1 && $ > -1))
16405 throw "Source and/or target doesn't know this edge!";
16406 J.source.edges.splice(L, 1), J.target != J.source && J.target.edges.splice($, 1);
16407 var te = J.source.owner.getEdges().indexOf(J);
16408 if (te == -1)
16409 throw "Not in owner's edge list!";
16410 J.source.owner.getEdges().splice(te, 1);
16411 }
16412 }, V.prototype.updateLeftTop = function() {
16413 for (var Q = T.MAX_VALUE, ne = T.MAX_VALUE, ue, J, j, Y = this.getNodes(), te = Y.length, L = 0; L < te; L++) {
16414 var $ = Y[L];
16415 ue = $.getTop(), J = $.getLeft(), Q > ue && (Q = ue), ne > J && (ne = J);
16416 }
16417 return Q == T.MAX_VALUE ? null : (Y[0].getParent().paddingLeft != null ? j = Y[0].getParent().paddingLeft : j = this.margin, this.left = ne - j, this.top = Q - j, new K(this.left, this.top));
16418 }, V.prototype.updateBounds = function(Q) {
16419 for (var ne = T.MAX_VALUE, ue = -T.MAX_VALUE, J = T.MAX_VALUE, j = -T.MAX_VALUE, Y, te, L, $, k, q = this.nodes, ce = q.length, pe = 0; pe < ce; pe++) {
16420 var Ae = q[pe];
16421 Q && Ae.child != null && Ae.updateBounds(), Y = Ae.getLeft(), te = Ae.getRight(), L = Ae.getTop(), $ = Ae.getBottom(), ne > Y && (ne = Y), ue < te && (ue = te), J > L && (J = L), j < $ && (j = $);
16422 }
16423 var Ne = new P(ne, J, ue - ne, j - J);
16424 ne == T.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), q[0].getParent().paddingLeft != null ? k = q[0].getParent().paddingLeft : k = this.margin, this.left = Ne.x - k, this.right = Ne.x + Ne.width + k, this.top = Ne.y - k, this.bottom = Ne.y + Ne.height + k;
16425 }, V.calculateBounds = function(Q) {
16426 for (var ne = T.MAX_VALUE, ue = -T.MAX_VALUE, J = T.MAX_VALUE, j = -T.MAX_VALUE, Y, te, L, $, k = Q.length, q = 0; q < k; q++) {
16427 var ce = Q[q];
16428 Y = ce.getLeft(), te = ce.getRight(), L = ce.getTop(), $ = ce.getBottom(), ne > Y && (ne = Y), ue < te && (ue = te), J > L && (J = L), j < $ && (j = $);
16429 }
16430 var pe = new P(ne, J, ue - ne, j - J);
16431 return pe;
16432 }, V.prototype.getInclusionTreeDepth = function() {
16433 return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
16434 }, V.prototype.getEstimatedSize = function() {
16435 if (this.estimatedSize == T.MIN_VALUE)
16436 throw "assert failed";
16437 return this.estimatedSize;
16438 }, V.prototype.calcEstimatedSize = function() {
16439 for (var Q = 0, ne = this.nodes, ue = ne.length, J = 0; J < ue; J++) {
16440 var j = ne[J];
16441 Q += j.calcEstimatedSize();
16442 }
16443 return Q == 0 ? this.estimatedSize = x.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = Q / Math.sqrt(this.nodes.length), this.estimatedSize;
16444 }, V.prototype.updateConnected = function() {
16445 var Q = this;
16446 if (this.nodes.length == 0) {
16447 this.isConnected = !0;
16448 return;
16449 }
16450 var ne = new D(), ue = /* @__PURE__ */ new Set(), J = this.nodes[0], j, Y, te = J.withChildren();
16451 for (te.forEach(function(pe) {
16452 ne.push(pe), ue.add(pe);
16453 }); ne.length !== 0; ) {
16454 J = ne.shift(), j = J.getEdges();
16455 for (var L = j.length, $ = 0; $ < L; $++) {
16456 var k = j[$];
16457 if (Y = k.getOtherEndInGraph(J, this), Y != null && !ue.has(Y)) {
16458 var q = Y.withChildren();
16459 q.forEach(function(pe) {
16460 ne.push(pe), ue.add(pe);
16461 });
16462 }
16463 }
16464 }
16465 if (this.isConnected = !1, ue.size >= this.nodes.length) {
16466 var ce = 0;
16467 ue.forEach(function(pe) {
16468 pe.owner == Q && ce++;
16469 }), ce == this.nodes.length && (this.isConnected = !0);
16470 }
16471 }, ee.exports = V;
16472 },
16473 /* 6 */
16474 /***/
16475 function(ee, ve, H) {
16476 var O, T = H(1);
16477 function x(S) {
16478 O = H(5), this.layout = S, this.graphs = [], this.edges = [];
16479 }
16480 x.prototype.addRoot = function() {
16481 var S = this.layout.newGraph(), G = this.layout.newNode(null), U = this.add(S, G);
16482 return this.setRootGraph(U), this.rootGraph;
16483 }, x.prototype.add = function(S, G, U, P, K) {
16484 if (U == null && P == null && K == null) {
16485 if (S == null)
16486 throw "Graph is null!";
16487 if (G == null)
16488 throw "Parent node is null!";
16489 if (this.graphs.indexOf(S) > -1)
16490 throw "Graph already in this graph mgr!";
16491 if (this.graphs.push(S), S.parent != null)
16492 throw "Already has a parent!";
16493 if (G.child != null)
16494 throw "Already has a child!";
16495 return S.parent = G, G.child = S, S;
16496 } else {
16497 K = U, P = G, U = S;
16498 var D = P.getOwner(), V = K.getOwner();
16499 if (!(D != null && D.getGraphManager() == this))
16500 throw "Source not in this graph mgr!";
16501 if (!(V != null && V.getGraphManager() == this))
16502 throw "Target not in this graph mgr!";
16503 if (D == V)
16504 return U.isInterGraph = !1, D.add(U, P, K);
16505 if (U.isInterGraph = !0, U.source = P, U.target = K, this.edges.indexOf(U) > -1)
16506 throw "Edge already in inter-graph edge list!";
16507 if (this.edges.push(U), !(U.source != null && U.target != null))
16508 throw "Edge source and/or target is null!";
16509 if (!(U.source.edges.indexOf(U) == -1 && U.target.edges.indexOf(U) == -1))
16510 throw "Edge already in source and/or target incidency list!";
16511 return U.source.edges.push(U), U.target.edges.push(U), U;
16512 }
16513 }, x.prototype.remove = function(S) {
16514 if (S instanceof O) {
16515 var G = S;
16516 if (G.getGraphManager() != this)
16517 throw "Graph not in this graph mgr";
16518 if (!(G == this.rootGraph || G.parent != null && G.parent.graphManager == this))
16519 throw "Invalid parent node!";
16520 var U = [];
16521 U = U.concat(G.getEdges());
16522 for (var P, K = U.length, D = 0; D < K; D++)
16523 P = U[D], G.remove(P);
16524 var V = [];
16525 V = V.concat(G.getNodes());
16526 var _;
16527 K = V.length;
16528 for (var D = 0; D < K; D++)
16529 _ = V[D], G.remove(_);
16530 G == this.rootGraph && this.setRootGraph(null);
16531 var Q = this.graphs.indexOf(G);
16532 this.graphs.splice(Q, 1), G.parent = null;
16533 } else if (S instanceof T) {
16534 if (P = S, P == null)
16535 throw "Edge is null!";
16536 if (!P.isInterGraph)
16537 throw "Not an inter-graph edge!";
16538 if (!(P.source != null && P.target != null))
16539 throw "Source and/or target is null!";
16540 if (!(P.source.edges.indexOf(P) != -1 && P.target.edges.indexOf(P) != -1))
16541 throw "Source and/or target doesn't know this edge!";
16542 var Q = P.source.edges.indexOf(P);
16543 if (P.source.edges.splice(Q, 1), Q = P.target.edges.indexOf(P), P.target.edges.splice(Q, 1), !(P.source.owner != null && P.source.owner.getGraphManager() != null))
16544 throw "Edge owner graph or owner graph manager is null!";
16545 if (P.source.owner.getGraphManager().edges.indexOf(P) == -1)
16546 throw "Not in owner graph manager's edge list!";
16547 var Q = P.source.owner.getGraphManager().edges.indexOf(P);
16548 P.source.owner.getGraphManager().edges.splice(Q, 1);
16549 }
16550 }, x.prototype.updateBounds = function() {
16551 this.rootGraph.updateBounds(!0);
16552 }, x.prototype.getGraphs = function() {
16553 return this.graphs;
16554 }, x.prototype.getAllNodes = function() {
16555 if (this.allNodes == null) {
16556 for (var S = [], G = this.getGraphs(), U = G.length, P = 0; P < U; P++)
16557 S = S.concat(G[P].getNodes());
16558 this.allNodes = S;
16559 }
16560 return this.allNodes;
16561 }, x.prototype.resetAllNodes = function() {
16562 this.allNodes = null;
16563 }, x.prototype.resetAllEdges = function() {
16564 this.allEdges = null;
16565 }, x.prototype.resetAllNodesToApplyGravitation = function() {
16566 this.allNodesToApplyGravitation = null;
16567 }, x.prototype.getAllEdges = function() {
16568 if (this.allEdges == null) {
16569 var S = [], G = this.getGraphs();
16570 G.length;
16571 for (var U = 0; U < G.length; U++)
16572 S = S.concat(G[U].getEdges());
16573 S = S.concat(this.edges), this.allEdges = S;
16574 }
16575 return this.allEdges;
16576 }, x.prototype.getAllNodesToApplyGravitation = function() {
16577 return this.allNodesToApplyGravitation;
16578 }, x.prototype.setAllNodesToApplyGravitation = function(S) {
16579 if (this.allNodesToApplyGravitation != null)
16580 throw "assert failed";
16581 this.allNodesToApplyGravitation = S;
16582 }, x.prototype.getRoot = function() {
16583 return this.rootGraph;
16584 }, x.prototype.setRootGraph = function(S) {
16585 if (S.getGraphManager() != this)
16586 throw "Root not in this graph mgr!";
16587 this.rootGraph = S, S.parent == null && (S.parent = this.layout.newNode("Root node"));
16588 }, x.prototype.getLayout = function() {
16589 return this.layout;
16590 }, x.prototype.isOneAncestorOfOther = function(S, G) {
16591 if (!(S != null && G != null))
16592 throw "assert failed";
16593 if (S == G)
16594 return !0;
16595 var U = S.getOwner(), P;
16596 do {
16597 if (P = U.getParent(), P == null)
16598 break;
16599 if (P == G)
16600 return !0;
16601 if (U = P.getOwner(), U == null)
16602 break;
16603 } while (!0);
16604 U = G.getOwner();
16605 do {
16606 if (P = U.getParent(), P == null)
16607 break;
16608 if (P == S)
16609 return !0;
16610 if (U = P.getOwner(), U == null)
16611 break;
16612 } while (!0);
16613 return !1;
16614 }, x.prototype.calcLowestCommonAncestors = function() {
16615 for (var S, G, U, P, K, D = this.getAllEdges(), V = D.length, _ = 0; _ < V; _++) {
16616 if (S = D[_], G = S.source, U = S.target, S.lca = null, S.sourceInLca = G, S.targetInLca = U, G == U) {
16617 S.lca = G.getOwner();
16618 continue;
16619 }
16620 for (P = G.getOwner(); S.lca == null; ) {
16621 for (S.targetInLca = U, K = U.getOwner(); S.lca == null; ) {
16622 if (K == P) {
16623 S.lca = K;
16624 break;
16625 }
16626 if (K == this.rootGraph)
16627 break;
16628 if (S.lca != null)
16629 throw "assert failed";
16630 S.targetInLca = K.getParent(), K = S.targetInLca.getOwner();
16631 }
16632 if (P == this.rootGraph)
16633 break;
16634 S.lca == null && (S.sourceInLca = P.getParent(), P = S.sourceInLca.getOwner());
16635 }
16636 if (S.lca == null)
16637 throw "assert failed";
16638 }
16639 }, x.prototype.calcLowestCommonAncestor = function(S, G) {
16640 if (S == G)
16641 return S.getOwner();
16642 var U = S.getOwner();
16643 do {
16644 if (U == null)
16645 break;
16646 var P = G.getOwner();
16647 do {
16648 if (P == null)
16649 break;
16650 if (P == U)
16651 return P;
16652 P = P.getParent().getOwner();
16653 } while (!0);
16654 U = U.getParent().getOwner();
16655 } while (!0);
16656 return U;
16657 }, x.prototype.calcInclusionTreeDepths = function(S, G) {
16658 S == null && G == null && (S = this.rootGraph, G = 1);
16659 for (var U, P = S.getNodes(), K = P.length, D = 0; D < K; D++)
16660 U = P[D], U.inclusionTreeDepth = G, U.child != null && this.calcInclusionTreeDepths(U.child, G + 1);
16661 }, x.prototype.includesInvalidEdge = function() {
16662 for (var S, G = this.edges.length, U = 0; U < G; U++)
16663 if (S = this.edges[U], this.isOneAncestorOfOther(S.source, S.target))
16664 return !0;
16665 return !1;
16666 }, ee.exports = x;
16667 },
16668 /* 7 */
16669 /***/
16670 function(ee, ve, H) {
16671 var O = H(0);
16672 function T() {
16673 }
16674 for (var x in O)
16675 T[x] = O[x];
16676 T.MAX_ITERATIONS = 2500, T.DEFAULT_EDGE_LENGTH = 50, T.DEFAULT_SPRING_STRENGTH = 0.45, T.DEFAULT_REPULSION_STRENGTH = 4500, T.DEFAULT_GRAVITY_STRENGTH = 0.4, T.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, T.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, T.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, T.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, T.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, T.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3, T.COOLING_ADAPTATION_FACTOR = 0.33, T.ADAPTATION_LOWER_NODE_LIMIT = 1e3, T.ADAPTATION_UPPER_NODE_LIMIT = 5e3, T.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, T.MAX_NODE_DISPLACEMENT = T.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, T.MIN_REPULSION_DIST = T.DEFAULT_EDGE_LENGTH / 10, T.CONVERGENCE_CHECK_PERIOD = 100, T.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1, T.MIN_EDGE_LENGTH = 1, T.GRID_CALCULATION_CHECK_PERIOD = 10, ee.exports = T;
16677 },
16678 /* 8 */
16679 /***/
16680 function(ee, ve, H) {
16681 var O = H(12);
16682 function T() {
16683 }
16684 T.calcSeparationAmount = function(x, S, G, U) {
16685 if (!x.intersects(S))
16686 throw "assert failed";
16687 var P = new Array(2);
16688 this.decideDirectionsForOverlappingNodes(x, S, P), G[0] = Math.min(x.getRight(), S.getRight()) - Math.max(x.x, S.x), G[1] = Math.min(x.getBottom(), S.getBottom()) - Math.max(x.y, S.y), x.getX() <= S.getX() && x.getRight() >= S.getRight() ? G[0] += Math.min(S.getX() - x.getX(), x.getRight() - S.getRight()) : S.getX() <= x.getX() && S.getRight() >= x.getRight() && (G[0] += Math.min(x.getX() - S.getX(), S.getRight() - x.getRight())), x.getY() <= S.getY() && x.getBottom() >= S.getBottom() ? G[1] += Math.min(S.getY() - x.getY(), x.getBottom() - S.getBottom()) : S.getY() <= x.getY() && S.getBottom() >= x.getBottom() && (G[1] += Math.min(x.getY() - S.getY(), S.getBottom() - x.getBottom()));
16689 var K = Math.abs((S.getCenterY() - x.getCenterY()) / (S.getCenterX() - x.getCenterX()));
16690 S.getCenterY() === x.getCenterY() && S.getCenterX() === x.getCenterX() && (K = 1);
16691 var D = K * G[0], V = G[1] / K;
16692 G[0] < V ? V = G[0] : D = G[1], G[0] = -1 * P[0] * (V / 2 + U), G[1] = -1 * P[1] * (D / 2 + U);
16693 }, T.decideDirectionsForOverlappingNodes = function(x, S, G) {
16694 x.getCenterX() < S.getCenterX() ? G[0] = -1 : G[0] = 1, x.getCenterY() < S.getCenterY() ? G[1] = -1 : G[1] = 1;
16695 }, T.getIntersection2 = function(x, S, G) {
16696 var U = x.getCenterX(), P = x.getCenterY(), K = S.getCenterX(), D = S.getCenterY();
16697 if (x.intersects(S))
16698 return G[0] = U, G[1] = P, G[2] = K, G[3] = D, !0;
16699 var V = x.getX(), _ = x.getY(), Q = x.getRight(), ne = x.getX(), ue = x.getBottom(), J = x.getRight(), j = x.getWidthHalf(), Y = x.getHeightHalf(), te = S.getX(), L = S.getY(), $ = S.getRight(), k = S.getX(), q = S.getBottom(), ce = S.getRight(), pe = S.getWidthHalf(), Ae = S.getHeightHalf(), Ne = !1, _e = !1;
16700 if (U === K) {
16701 if (P > D)
16702 return G[0] = U, G[1] = _, G[2] = K, G[3] = q, !1;
16703 if (P < D)
16704 return G[0] = U, G[1] = ue, G[2] = K, G[3] = L, !1;
16705 } else if (P === D) {
16706 if (U > K)
16707 return G[0] = V, G[1] = P, G[2] = $, G[3] = D, !1;
16708 if (U < K)
16709 return G[0] = Q, G[1] = P, G[2] = te, G[3] = D, !1;
16710 } else {
16711 var tt = x.height / x.width, ct = S.height / S.width, Pe = (D - P) / (K - U), $e = void 0, Xe = void 0, rt = void 0, lt = void 0, nt = void 0, je = void 0;
16712 if (-tt === Pe ? U > K ? (G[0] = ne, G[1] = ue, Ne = !0) : (G[0] = Q, G[1] = _, Ne = !0) : tt === Pe && (U > K ? (G[0] = V, G[1] = _, Ne = !0) : (G[0] = J, G[1] = ue, Ne = !0)), -ct === Pe ? K > U ? (G[2] = k, G[3] = q, _e = !0) : (G[2] = $, G[3] = L, _e = !0) : ct === Pe && (K > U ? (G[2] = te, G[3] = L, _e = !0) : (G[2] = ce, G[3] = q, _e = !0)), Ne && _e)
16713 return !1;
16714 if (U > K ? P > D ? ($e = this.getCardinalDirection(tt, Pe, 4), Xe = this.getCardinalDirection(ct, Pe, 2)) : ($e = this.getCardinalDirection(-tt, Pe, 3), Xe = this.getCardinalDirection(-ct, Pe, 1)) : P > D ? ($e = this.getCardinalDirection(-tt, Pe, 1), Xe = this.getCardinalDirection(-ct, Pe, 3)) : ($e = this.getCardinalDirection(tt, Pe, 2), Xe = this.getCardinalDirection(ct, Pe, 4)), !Ne)
16715 switch ($e) {
16716 case 1:
16717 lt = _, rt = U + -Y / Pe, G[0] = rt, G[1] = lt;
16718 break;
16719 case 2:
16720 rt = J, lt = P + j * Pe, G[0] = rt, G[1] = lt;
16721 break;
16722 case 3:
16723 lt = ue, rt = U + Y / Pe, G[0] = rt, G[1] = lt;
16724 break;
16725 case 4:
16726 rt = ne, lt = P + -j * Pe, G[0] = rt, G[1] = lt;
16727 break;
16728 }
16729 if (!_e)
16730 switch (Xe) {
16731 case 1:
16732 je = L, nt = K + -Ae / Pe, G[2] = nt, G[3] = je;
16733 break;
16734 case 2:
16735 nt = ce, je = D + pe * Pe, G[2] = nt, G[3] = je;
16736 break;
16737 case 3:
16738 je = q, nt = K + Ae / Pe, G[2] = nt, G[3] = je;
16739 break;
16740 case 4:
16741 nt = k, je = D + -pe * Pe, G[2] = nt, G[3] = je;
16742 break;
16743 }
16744 }
16745 return !1;
16746 }, T.getCardinalDirection = function(x, S, G) {
16747 return x > S ? G : 1 + G % 4;
16748 }, T.getIntersection = function(x, S, G, U) {
16749 if (U == null)
16750 return this.getIntersection2(x, S, G);
16751 var P = x.x, K = x.y, D = S.x, V = S.y, _ = G.x, Q = G.y, ne = U.x, ue = U.y, J = void 0, j = void 0, Y = void 0, te = void 0, L = void 0, $ = void 0, k = void 0, q = void 0, ce = void 0;
16752 return Y = V - K, L = P - D, k = D * K - P * V, te = ue - Q, $ = _ - ne, q = ne * Q - _ * ue, ce = Y * $ - te * L, ce === 0 ? null : (J = (L * q - $ * k) / ce, j = (te * k - Y * q) / ce, new O(J, j));
16753 }, T.angleOfVector = function(x, S, G, U) {
16754 var P = void 0;
16755 return x !== G ? (P = Math.atan((U - S) / (G - x)), G < x ? P += Math.PI : U < S && (P += this.TWO_PI)) : U < S ? P = this.ONE_AND_HALF_PI : P = this.HALF_PI, P;
16756 }, T.doIntersect = function(x, S, G, U) {
16757 var P = x.x, K = x.y, D = S.x, V = S.y, _ = G.x, Q = G.y, ne = U.x, ue = U.y, J = (D - P) * (ue - Q) - (ne - _) * (V - K);
16758 if (J === 0)
16759 return !1;
16760 var j = ((ue - Q) * (ne - P) + (_ - ne) * (ue - K)) / J, Y = ((K - V) * (ne - P) + (D - P) * (ue - K)) / J;
16761 return 0 < j && j < 1 && 0 < Y && Y < 1;
16762 }, T.HALF_PI = 0.5 * Math.PI, T.ONE_AND_HALF_PI = 1.5 * Math.PI, T.TWO_PI = 2 * Math.PI, T.THREE_PI = 3 * Math.PI, ee.exports = T;
16763 },
16764 /* 9 */
16765 /***/
16766 function(ee, ve, H) {
16767 function O() {
16768 }
16769 O.sign = function(T) {
16770 return T > 0 ? 1 : T < 0 ? -1 : 0;
16771 }, O.floor = function(T) {
16772 return T < 0 ? Math.ceil(T) : Math.floor(T);
16773 }, O.ceil = function(T) {
16774 return T < 0 ? Math.floor(T) : Math.ceil(T);
16775 }, ee.exports = O;
16776 },
16777 /* 10 */
16778 /***/
16779 function(ee, ve, H) {
16780 function O() {
16781 }
16782 O.MAX_VALUE = 2147483647, O.MIN_VALUE = -2147483648, ee.exports = O;
16783 },
16784 /* 11 */
16785 /***/
16786 function(ee, ve, H) {
16787 var O = function() {
16788 function P(K, D) {
16789 for (var V = 0; V < D.length; V++) {
16790 var _ = D[V];
16791 _.enumerable = _.enumerable || !1, _.configurable = !0, "value" in _ && (_.writable = !0), Object.defineProperty(K, _.key, _);
16792 }
16793 }
16794 return function(K, D, V) {
16795 return D && P(K.prototype, D), V && P(K, V), K;
16796 };
16797 }();
16798 function T(P, K) {
16799 if (!(P instanceof K))
16800 throw new TypeError("Cannot call a class as a function");
16801 }
16802 var x = function(K) {
16803 return { value: K, next: null, prev: null };
16804 }, S = function(K, D, V, _) {
16805 return K !== null ? K.next = D : _.head = D, V !== null ? V.prev = D : _.tail = D, D.prev = K, D.next = V, _.length++, D;
16806 }, G = function(K, D) {
16807 var V = K.prev, _ = K.next;
16808 return V !== null ? V.next = _ : D.head = _, _ !== null ? _.prev = V : D.tail = V, K.prev = K.next = null, D.length--, K;
16809 }, U = function() {
16810 function P(K) {
16811 var D = this;
16812 T(this, P), this.length = 0, this.head = null, this.tail = null, K != null && K.forEach(function(V) {
16813 return D.push(V);
16814 });
16815 }
16816 return O(P, [{
16817 key: "size",
16818 value: function() {
16819 return this.length;
16820 }
16821 }, {
16822 key: "insertBefore",
16823 value: function(D, V) {
16824 return S(V.prev, x(D), V, this);
16825 }
16826 }, {
16827 key: "insertAfter",
16828 value: function(D, V) {
16829 return S(V, x(D), V.next, this);
16830 }
16831 }, {
16832 key: "insertNodeBefore",
16833 value: function(D, V) {
16834 return S(V.prev, D, V, this);
16835 }
16836 }, {
16837 key: "insertNodeAfter",
16838 value: function(D, V) {
16839 return S(V, D, V.next, this);
16840 }
16841 }, {
16842 key: "push",
16843 value: function(D) {
16844 return S(this.tail, x(D), null, this);
16845 }
16846 }, {
16847 key: "unshift",
16848 value: function(D) {
16849 return S(null, x(D), this.head, this);
16850 }
16851 }, {
16852 key: "remove",
16853 value: function(D) {
16854 return G(D, this);
16855 }
16856 }, {
16857 key: "pop",
16858 value: function() {
16859 return G(this.tail, this).value;
16860 }
16861 }, {
16862 key: "popNode",
16863 value: function() {
16864 return G(this.tail, this);
16865 }
16866 }, {
16867 key: "shift",
16868 value: function() {
16869 return G(this.head, this).value;
16870 }
16871 }, {
16872 key: "shiftNode",
16873 value: function() {
16874 return G(this.head, this);
16875 }
16876 }, {
16877 key: "get_object_at",
16878 value: function(D) {
16879 if (D <= this.length()) {
16880 for (var V = 1, _ = this.head; V < D; )
16881 _ = _.next, V++;
16882 return _.value;
16883 }
16884 }
16885 }, {
16886 key: "set_object_at",
16887 value: function(D, V) {
16888 if (D <= this.length()) {
16889 for (var _ = 1, Q = this.head; _ < D; )
16890 Q = Q.next, _++;
16891 Q.value = V;
16892 }
16893 }
16894 }]), P;
16895 }();
16896 ee.exports = U;
16897 },
16898 /* 12 */
16899 /***/
16900 function(ee, ve, H) {
16901 function O(T, x, S) {
16902 this.x = null, this.y = null, T == null && x == null && S == null ? (this.x = 0, this.y = 0) : typeof T == "number" && typeof x == "number" && S == null ? (this.x = T, this.y = x) : T.constructor.name == "Point" && x == null && S == null && (S = T, this.x = S.x, this.y = S.y);
16903 }
16904 O.prototype.getX = function() {
16905 return this.x;
16906 }, O.prototype.getY = function() {
16907 return this.y;
16908 }, O.prototype.getLocation = function() {
16909 return new O(this.x, this.y);
16910 }, O.prototype.setLocation = function(T, x, S) {
16911 T.constructor.name == "Point" && x == null && S == null ? (S = T, this.setLocation(S.x, S.y)) : typeof T == "number" && typeof x == "number" && S == null && (parseInt(T) == T && parseInt(x) == x ? this.move(T, x) : (this.x = Math.floor(T + 0.5), this.y = Math.floor(x + 0.5)));
16912 }, O.prototype.move = function(T, x) {
16913 this.x = T, this.y = x;
16914 }, O.prototype.translate = function(T, x) {
16915 this.x += T, this.y += x;
16916 }, O.prototype.equals = function(T) {
16917 if (T.constructor.name == "Point") {
16918 var x = T;
16919 return this.x == x.x && this.y == x.y;
16920 }
16921 return this == T;
16922 }, O.prototype.toString = function() {
16923 return new O().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
16924 }, ee.exports = O;
16925 },
16926 /* 13 */
16927 /***/
16928 function(ee, ve, H) {
16929 function O(T, x, S, G) {
16930 this.x = 0, this.y = 0, this.width = 0, this.height = 0, T != null && x != null && S != null && G != null && (this.x = T, this.y = x, this.width = S, this.height = G);
16931 }
16932 O.prototype.getX = function() {
16933 return this.x;
16934 }, O.prototype.setX = function(T) {
16935 this.x = T;
16936 }, O.prototype.getY = function() {
16937 return this.y;
16938 }, O.prototype.setY = function(T) {
16939 this.y = T;
16940 }, O.prototype.getWidth = function() {
16941 return this.width;
16942 }, O.prototype.setWidth = function(T) {
16943 this.width = T;
16944 }, O.prototype.getHeight = function() {
16945 return this.height;
16946 }, O.prototype.setHeight = function(T) {
16947 this.height = T;
16948 }, O.prototype.getRight = function() {
16949 return this.x + this.width;
16950 }, O.prototype.getBottom = function() {
16951 return this.y + this.height;
16952 }, O.prototype.intersects = function(T) {
16953 return !(this.getRight() < T.x || this.getBottom() < T.y || T.getRight() < this.x || T.getBottom() < this.y);
16954 }, O.prototype.getCenterX = function() {
16955 return this.x + this.width / 2;
16956 }, O.prototype.getMinX = function() {
16957 return this.getX();
16958 }, O.prototype.getMaxX = function() {
16959 return this.getX() + this.width;
16960 }, O.prototype.getCenterY = function() {
16961 return this.y + this.height / 2;
16962 }, O.prototype.getMinY = function() {
16963 return this.getY();
16964 }, O.prototype.getMaxY = function() {
16965 return this.getY() + this.height;
16966 }, O.prototype.getWidthHalf = function() {
16967 return this.width / 2;
16968 }, O.prototype.getHeightHalf = function() {
16969 return this.height / 2;
16970 }, ee.exports = O;
16971 },
16972 /* 14 */
16973 /***/
16974 function(ee, ve, H) {
16975 var O = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(x) {
16976 return typeof x;
16977 } : function(x) {
16978 return x && typeof Symbol == "function" && x.constructor === Symbol && x !== Symbol.prototype ? "symbol" : typeof x;
16979 };
16980 function T() {
16981 }
16982 T.lastID = 0, T.createID = function(x) {
16983 return T.isPrimitive(x) ? x : (x.uniqueID != null || (x.uniqueID = T.getString(), T.lastID++), x.uniqueID);
16984 }, T.getString = function(x) {
16985 return x == null && (x = T.lastID), "Object#" + x;
16986 }, T.isPrimitive = function(x) {
16987 var S = typeof x > "u" ? "undefined" : O(x);
16988 return x == null || S != "object" && S != "function";
16989 }, ee.exports = T;
16990 },
16991 /* 15 */
16992 /***/
16993 function(ee, ve, H) {
16994 function O(_) {
16995 if (Array.isArray(_)) {
16996 for (var Q = 0, ne = Array(_.length); Q < _.length; Q++)
16997 ne[Q] = _[Q];
16998 return ne;
16999 } else
17000 return Array.from(_);
17001 }
17002 var T = H(0), x = H(6), S = H(3), G = H(1), U = H(5), P = H(4), K = H(17), D = H(27);
17003 function V(_) {
17004 D.call(this), this.layoutQuality = T.QUALITY, this.createBendsAsNeeded = T.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = T.DEFAULT_INCREMENTAL, this.animationOnLayout = T.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = T.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = T.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = T.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new x(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, _ != null && (this.isRemoteUse = _);
17005 }
17006 V.RANDOM_SEED = 1, V.prototype = Object.create(D.prototype), V.prototype.getGraphManager = function() {
17007 return this.graphManager;
17008 }, V.prototype.getAllNodes = function() {
17009 return this.graphManager.getAllNodes();
17010 }, V.prototype.getAllEdges = function() {
17011 return this.graphManager.getAllEdges();
17012 }, V.prototype.getAllNodesToApplyGravitation = function() {
17013 return this.graphManager.getAllNodesToApplyGravitation();
17014 }, V.prototype.newGraphManager = function() {
17015 var _ = new x(this);
17016 return this.graphManager = _, _;
17017 }, V.prototype.newGraph = function(_) {
17018 return new U(null, this.graphManager, _);
17019 }, V.prototype.newNode = function(_) {
17020 return new S(this.graphManager, _);
17021 }, V.prototype.newEdge = function(_) {
17022 return new G(null, null, _);
17023 }, V.prototype.checkLayoutSuccess = function() {
17024 return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
17025 }, V.prototype.runLayout = function() {
17026 this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters();
17027 var _;
17028 return this.checkLayoutSuccess() ? _ = !1 : _ = this.layout(), T.ANIMATE === "during" ? !1 : (_ && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, _);
17029 }, V.prototype.doPostLayout = function() {
17030 this.incremental || this.transform(), this.update();
17031 }, V.prototype.update2 = function() {
17032 if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) {
17033 for (var _ = this.graphManager.getAllEdges(), Q = 0; Q < _.length; Q++)
17034 _[Q];
17035 for (var ne = this.graphManager.getRoot().getNodes(), Q = 0; Q < ne.length; Q++)
17036 ne[Q];
17037 this.update(this.graphManager.getRoot());
17038 }
17039 }, V.prototype.update = function(_) {
17040 if (_ == null)
17041 this.update2();
17042 else if (_ instanceof S) {
17043 var Q = _;
17044 if (Q.getChild() != null)
17045 for (var ne = Q.getChild().getNodes(), ue = 0; ue < ne.length; ue++)
17046 update(ne[ue]);
17047 if (Q.vGraphObject != null) {
17048 var J = Q.vGraphObject;
17049 J.update(Q);
17050 }
17051 } else if (_ instanceof G) {
17052 var j = _;
17053 if (j.vGraphObject != null) {
17054 var Y = j.vGraphObject;
17055 Y.update(j);
17056 }
17057 } else if (_ instanceof U) {
17058 var te = _;
17059 if (te.vGraphObject != null) {
17060 var L = te.vGraphObject;
17061 L.update(te);
17062 }
17063 }
17064 }, V.prototype.initParameters = function() {
17065 this.isSubLayout || (this.layoutQuality = T.QUALITY, this.animationDuringLayout = T.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = T.DEFAULT_ANIMATION_PERIOD, this.animationOnLayout = T.DEFAULT_ANIMATION_ON_LAYOUT, this.incremental = T.DEFAULT_INCREMENTAL, this.createBendsAsNeeded = T.DEFAULT_CREATE_BENDS_AS_NEEDED, this.uniformLeafNodeSizes = T.DEFAULT_UNIFORM_LEAF_NODE_SIZES), this.animationDuringLayout && (this.animationOnLayout = !1);
17066 }, V.prototype.transform = function(_) {
17067 if (_ == null)
17068 this.transform(new P(0, 0));
17069 else {
17070 var Q = new K(), ne = this.graphManager.getRoot().updateLeftTop();
17071 if (ne != null) {
17072 Q.setWorldOrgX(_.x), Q.setWorldOrgY(_.y), Q.setDeviceOrgX(ne.x), Q.setDeviceOrgY(ne.y);
17073 for (var ue = this.getAllNodes(), J, j = 0; j < ue.length; j++)
17074 J = ue[j], J.transform(Q);
17075 }
17076 }
17077 }, V.prototype.positionNodesRandomly = function(_) {
17078 if (_ == null)
17079 this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0);
17080 else
17081 for (var Q, ne, ue = _.getNodes(), J = 0; J < ue.length; J++)
17082 Q = ue[J], ne = Q.getChild(), ne == null || ne.getNodes().length == 0 ? Q.scatter() : (this.positionNodesRandomly(ne), Q.updateBounds());
17083 }, V.prototype.getFlatForest = function() {
17084 for (var _ = [], Q = !0, ne = this.graphManager.getRoot().getNodes(), ue = !0, J = 0; J < ne.length; J++)
17085 ne[J].getChild() != null && (ue = !1);
17086 if (!ue)
17087 return _;
17088 var j = /* @__PURE__ */ new Set(), Y = [], te = /* @__PURE__ */ new Map(), L = [];
17089 for (L = L.concat(ne); L.length > 0 && Q; ) {
17090 for (Y.push(L[0]); Y.length > 0 && Q; ) {
17091 var $ = Y[0];
17092 Y.splice(0, 1), j.add($);
17093 for (var k = $.getEdges(), J = 0; J < k.length; J++) {
17094 var q = k[J].getOtherEnd($);
17095 if (te.get($) != q)
17096 if (!j.has(q))
17097 Y.push(q), te.set(q, $);
17098 else {
17099 Q = !1;
17100 break;
17101 }
17102 }
17103 }
17104 if (!Q)
17105 _ = [];
17106 else {
17107 var ce = [].concat(O(j));
17108 _.push(ce);
17109 for (var J = 0; J < ce.length; J++) {
17110 var pe = ce[J], Ae = L.indexOf(pe);
17111 Ae > -1 && L.splice(Ae, 1);
17112 }
17113 j = /* @__PURE__ */ new Set(), te = /* @__PURE__ */ new Map();
17114 }
17115 }
17116 return _;
17117 }, V.prototype.createDummyNodesForBendpoints = function(_) {
17118 for (var Q = [], ne = _.source, ue = this.graphManager.calcLowestCommonAncestor(_.source, _.target), J = 0; J < _.bendpoints.length; J++) {
17119 var j = this.newNode(null);
17120 j.setRect(new Point(0, 0), new Dimension(1, 1)), ue.add(j);
17121 var Y = this.newEdge(null);
17122 this.graphManager.add(Y, ne, j), Q.add(j), ne = j;
17123 }
17124 var Y = this.newEdge(null);
17125 return this.graphManager.add(Y, ne, _.target), this.edgeToDummyNodes.set(_, Q), _.isInterGraph() ? this.graphManager.remove(_) : ue.remove(_), Q;
17126 }, V.prototype.createBendpointsFromDummyNodes = function() {
17127 var _ = [];
17128 _ = _.concat(this.graphManager.getAllEdges()), _ = [].concat(O(this.edgeToDummyNodes.keys())).concat(_);
17129 for (var Q = 0; Q < _.length; Q++) {
17130 var ne = _[Q];
17131 if (ne.bendpoints.length > 0) {
17132 for (var ue = this.edgeToDummyNodes.get(ne), J = 0; J < ue.length; J++) {
17133 var j = ue[J], Y = new P(j.getCenterX(), j.getCenterY()), te = ne.bendpoints.get(J);
17134 te.x = Y.x, te.y = Y.y, j.getOwner().remove(j);
17135 }
17136 this.graphManager.add(ne, ne.source, ne.target);
17137 }
17138 }
17139 }, V.transform = function(_, Q, ne, ue) {
17140 if (ne != null && ue != null) {
17141 var J = Q;
17142 if (_ <= 50) {
17143 var j = Q / ne;
17144 J -= (Q - j) / 50 * (50 - _);
17145 } else {
17146 var Y = Q * ue;
17147 J += (Y - Q) / 50 * (_ - 50);
17148 }
17149 return J;
17150 } else {
17151 var te, L;
17152 return _ <= 50 ? (te = 9 * Q / 500, L = Q / 10) : (te = 9 * Q / 50, L = -8 * Q), te * _ + L;
17153 }
17154 }, V.findCenterOfTree = function(_) {
17155 var Q = [];
17156 Q = Q.concat(_);
17157 var ne = [], ue = /* @__PURE__ */ new Map(), J = !1, j = null;
17158 (Q.length == 1 || Q.length == 2) && (J = !0, j = Q[0]);
17159 for (var Y = 0; Y < Q.length; Y++) {
17160 var te = Q[Y], L = te.getNeighborsList().size;
17161 ue.set(te, te.getNeighborsList().size), L == 1 && ne.push(te);
17162 }
17163 var $ = [];
17164 for ($ = $.concat(ne); !J; ) {
17165 var k = [];
17166 k = k.concat($), $ = [];
17167 for (var Y = 0; Y < Q.length; Y++) {
17168 var te = Q[Y], q = Q.indexOf(te);
17169 q >= 0 && Q.splice(q, 1);
17170 var ce = te.getNeighborsList();
17171 ce.forEach(function(Ne) {
17172 if (ne.indexOf(Ne) < 0) {
17173 var _e = ue.get(Ne), tt = _e - 1;
17174 tt == 1 && $.push(Ne), ue.set(Ne, tt);
17175 }
17176 });
17177 }
17178 ne = ne.concat($), (Q.length == 1 || Q.length == 2) && (J = !0, j = Q[0]);
17179 }
17180 return j;
17181 }, V.prototype.setGraphManager = function(_) {
17182 this.graphManager = _;
17183 }, ee.exports = V;
17184 },
17185 /* 16 */
17186 /***/
17187 function(ee, ve, H) {
17188 function O() {
17189 }
17190 O.seed = 1, O.x = 0, O.nextDouble = function() {
17191 return O.x = Math.sin(O.seed++) * 1e4, O.x - Math.floor(O.x);
17192 }, ee.exports = O;
17193 },
17194 /* 17 */
17195 /***/
17196 function(ee, ve, H) {
17197 var O = H(4);
17198 function T(x, S) {
17199 this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1;
17200 }
17201 T.prototype.getWorldOrgX = function() {
17202 return this.lworldOrgX;
17203 }, T.prototype.setWorldOrgX = function(x) {
17204 this.lworldOrgX = x;
17205 }, T.prototype.getWorldOrgY = function() {
17206 return this.lworldOrgY;
17207 }, T.prototype.setWorldOrgY = function(x) {
17208 this.lworldOrgY = x;
17209 }, T.prototype.getWorldExtX = function() {
17210 return this.lworldExtX;
17211 }, T.prototype.setWorldExtX = function(x) {
17212 this.lworldExtX = x;
17213 }, T.prototype.getWorldExtY = function() {
17214 return this.lworldExtY;
17215 }, T.prototype.setWorldExtY = function(x) {
17216 this.lworldExtY = x;
17217 }, T.prototype.getDeviceOrgX = function() {
17218 return this.ldeviceOrgX;
17219 }, T.prototype.setDeviceOrgX = function(x) {
17220 this.ldeviceOrgX = x;
17221 }, T.prototype.getDeviceOrgY = function() {
17222 return this.ldeviceOrgY;
17223 }, T.prototype.setDeviceOrgY = function(x) {
17224 this.ldeviceOrgY = x;
17225 }, T.prototype.getDeviceExtX = function() {
17226 return this.ldeviceExtX;
17227 }, T.prototype.setDeviceExtX = function(x) {
17228 this.ldeviceExtX = x;
17229 }, T.prototype.getDeviceExtY = function() {
17230 return this.ldeviceExtY;
17231 }, T.prototype.setDeviceExtY = function(x) {
17232 this.ldeviceExtY = x;
17233 }, T.prototype.transformX = function(x) {
17234 var S = 0, G = this.lworldExtX;
17235 return G != 0 && (S = this.ldeviceOrgX + (x - this.lworldOrgX) * this.ldeviceExtX / G), S;
17236 }, T.prototype.transformY = function(x) {
17237 var S = 0, G = this.lworldExtY;
17238 return G != 0 && (S = this.ldeviceOrgY + (x - this.lworldOrgY) * this.ldeviceExtY / G), S;
17239 }, T.prototype.inverseTransformX = function(x) {
17240 var S = 0, G = this.ldeviceExtX;
17241 return G != 0 && (S = this.lworldOrgX + (x - this.ldeviceOrgX) * this.lworldExtX / G), S;
17242 }, T.prototype.inverseTransformY = function(x) {
17243 var S = 0, G = this.ldeviceExtY;
17244 return G != 0 && (S = this.lworldOrgY + (x - this.ldeviceOrgY) * this.lworldExtY / G), S;
17245 }, T.prototype.inverseTransformPoint = function(x) {
17246 var S = new O(this.inverseTransformX(x.x), this.inverseTransformY(x.y));
17247 return S;
17248 }, ee.exports = T;
17249 },
17250 /* 18 */
17251 /***/
17252 function(ee, ve, H) {
17253 function O(D) {
17254 if (Array.isArray(D)) {
17255 for (var V = 0, _ = Array(D.length); V < D.length; V++)
17256 _[V] = D[V];
17257 return _;
17258 } else
17259 return Array.from(D);
17260 }
17261 var T = H(15), x = H(7), S = H(0), G = H(8), U = H(9);
17262 function P() {
17263 T.call(this), this.useSmartIdealEdgeLengthCalculation = x.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.idealEdgeLength = x.DEFAULT_EDGE_LENGTH, this.springConstant = x.DEFAULT_SPRING_STRENGTH, this.repulsionConstant = x.DEFAULT_REPULSION_STRENGTH, this.gravityConstant = x.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = x.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = x.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = x.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.displacementThresholdPerNode = 3 * x.DEFAULT_EDGE_LENGTH / 100, this.coolingFactor = x.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.initialCoolingFactor = x.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.totalDisplacement = 0, this.oldTotalDisplacement = 0, this.maxIterations = x.MAX_ITERATIONS;
17264 }
17265 P.prototype = Object.create(T.prototype);
17266 for (var K in T)
17267 P[K] = T[K];
17268 P.prototype.initParameters = function() {
17269 T.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = x.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = [];
17270 }, P.prototype.calcIdealEdgeLengths = function() {
17271 for (var D, V, _, Q, ne, ue, J = this.getGraphManager().getAllEdges(), j = 0; j < J.length; j++)
17272 D = J[j], D.idealLength = this.idealEdgeLength, D.isInterGraph && (_ = D.getSource(), Q = D.getTarget(), ne = D.getSourceInLca().getEstimatedSize(), ue = D.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (D.idealLength += ne + ue - 2 * S.SIMPLE_NODE_SIZE), V = D.getLca().getInclusionTreeDepth(), D.idealLength += x.DEFAULT_EDGE_LENGTH * x.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (_.getInclusionTreeDepth() + Q.getInclusionTreeDepth() - 2 * V));
17273 }, P.prototype.initSpringEmbedder = function() {
17274 var D = this.getAllNodes().length;
17275 this.incremental ? (D > x.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * x.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (D - x.ADAPTATION_LOWER_NODE_LIMIT) / (x.ADAPTATION_UPPER_NODE_LIMIT - x.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - x.COOLING_ADAPTATION_FACTOR))), this.maxNodeDisplacement = x.MAX_NODE_DISPLACEMENT_INCREMENTAL) : (D > x.ADAPTATION_LOWER_NODE_LIMIT ? this.coolingFactor = Math.max(x.COOLING_ADAPTATION_FACTOR, 1 - (D - x.ADAPTATION_LOWER_NODE_LIMIT) / (x.ADAPTATION_UPPER_NODE_LIMIT - x.ADAPTATION_LOWER_NODE_LIMIT) * (1 - x.COOLING_ADAPTATION_FACTOR)) : this.coolingFactor = 1, this.initialCoolingFactor = this.coolingFactor, this.maxNodeDisplacement = x.MAX_NODE_DISPLACEMENT), this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations), this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length, this.repulsionRange = this.calcRepulsionRange();
17276 }, P.prototype.calcSpringForces = function() {
17277 for (var D = this.getAllEdges(), V, _ = 0; _ < D.length; _++)
17278 V = D[_], this.calcSpringForce(V, V.idealLength);
17279 }, P.prototype.calcRepulsionForces = function() {
17280 var D = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, V = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, _, Q, ne, ue, J = this.getAllNodes(), j;
17281 if (this.useFRGridVariant)
17282 for (this.totalIterations % x.GRID_CALCULATION_CHECK_PERIOD == 1 && D && this.updateGrid(), j = /* @__PURE__ */ new Set(), _ = 0; _ < J.length; _++)
17283 ne = J[_], this.calculateRepulsionForceOfANode(ne, j, D, V), j.add(ne);
17284 else
17285 for (_ = 0; _ < J.length; _++)
17286 for (ne = J[_], Q = _ + 1; Q < J.length; Q++)
17287 ue = J[Q], ne.getOwner() == ue.getOwner() && this.calcRepulsionForce(ne, ue);
17288 }, P.prototype.calcGravitationalForces = function() {
17289 for (var D, V = this.getAllNodesToApplyGravitation(), _ = 0; _ < V.length; _++)
17290 D = V[_], this.calcGravitationalForce(D);
17291 }, P.prototype.moveNodes = function() {
17292 for (var D = this.getAllNodes(), V, _ = 0; _ < D.length; _++)
17293 V = D[_], V.move();
17294 }, P.prototype.calcSpringForce = function(D, V) {
17295 var _ = D.getSource(), Q = D.getTarget(), ne, ue, J, j;
17296 if (this.uniformLeafNodeSizes && _.getChild() == null && Q.getChild() == null)
17297 D.updateLengthSimple();
17298 else if (D.updateLength(), D.isOverlapingSourceAndTarget)
17299 return;
17300 ne = D.getLength(), ne != 0 && (ue = this.springConstant * (ne - V), J = ue * (D.lengthX / ne), j = ue * (D.lengthY / ne), _.springForceX += J, _.springForceY += j, Q.springForceX -= J, Q.springForceY -= j);
17301 }, P.prototype.calcRepulsionForce = function(D, V) {
17302 var _ = D.getRect(), Q = V.getRect(), ne = new Array(2), ue = new Array(4), J, j, Y, te, L, $, k;
17303 if (_.intersects(Q)) {
17304 G.calcSeparationAmount(_, Q, ne, x.DEFAULT_EDGE_LENGTH / 2), $ = 2 * ne[0], k = 2 * ne[1];
17305 var q = D.noOfChildren * V.noOfChildren / (D.noOfChildren + V.noOfChildren);
17306 D.repulsionForceX -= q * $, D.repulsionForceY -= q * k, V.repulsionForceX += q * $, V.repulsionForceY += q * k;
17307 } else
17308 this.uniformLeafNodeSizes && D.getChild() == null && V.getChild() == null ? (J = Q.getCenterX() - _.getCenterX(), j = Q.getCenterY() - _.getCenterY()) : (G.getIntersection(_, Q, ue), J = ue[2] - ue[0], j = ue[3] - ue[1]), Math.abs(J) < x.MIN_REPULSION_DIST && (J = U.sign(J) * x.MIN_REPULSION_DIST), Math.abs(j) < x.MIN_REPULSION_DIST && (j = U.sign(j) * x.MIN_REPULSION_DIST), Y = J * J + j * j, te = Math.sqrt(Y), L = this.repulsionConstant * D.noOfChildren * V.noOfChildren / Y, $ = L * J / te, k = L * j / te, D.repulsionForceX -= $, D.repulsionForceY -= k, V.repulsionForceX += $, V.repulsionForceY += k;
17309 }, P.prototype.calcGravitationalForce = function(D) {
17310 var V, _, Q, ne, ue, J, j, Y;
17311 V = D.getOwner(), _ = (V.getRight() + V.getLeft()) / 2, Q = (V.getTop() + V.getBottom()) / 2, ne = D.getCenterX() - _, ue = D.getCenterY() - Q, J = Math.abs(ne) + D.getWidth() / 2, j = Math.abs(ue) + D.getHeight() / 2, D.getOwner() == this.graphManager.getRoot() ? (Y = V.getEstimatedSize() * this.gravityRangeFactor, (J > Y || j > Y) && (D.gravitationForceX = -this.gravityConstant * ne, D.gravitationForceY = -this.gravityConstant * ue)) : (Y = V.getEstimatedSize() * this.compoundGravityRangeFactor, (J > Y || j > Y) && (D.gravitationForceX = -this.gravityConstant * ne * this.compoundGravityConstant, D.gravitationForceY = -this.gravityConstant * ue * this.compoundGravityConstant));
17312 }, P.prototype.isConverged = function() {
17313 var D, V = !1;
17314 return this.totalIterations > this.maxIterations / 3 && (V = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), D = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, D || V;
17315 }, P.prototype.animate = function() {
17316 this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++);
17317 }, P.prototype.calcNoOfChildrenForAllNodes = function() {
17318 for (var D, V = this.graphManager.getAllNodes(), _ = 0; _ < V.length; _++)
17319 D = V[_], D.noOfChildren = D.getNoOfChildren();
17320 }, P.prototype.calcGrid = function(D) {
17321 var V = 0, _ = 0;
17322 V = parseInt(Math.ceil((D.getRight() - D.getLeft()) / this.repulsionRange)), _ = parseInt(Math.ceil((D.getBottom() - D.getTop()) / this.repulsionRange));
17323 for (var Q = new Array(V), ne = 0; ne < V; ne++)
17324 Q[ne] = new Array(_);
17325 for (var ne = 0; ne < V; ne++)
17326 for (var ue = 0; ue < _; ue++)
17327 Q[ne][ue] = new Array();
17328 return Q;
17329 }, P.prototype.addNodeToGrid = function(D, V, _) {
17330 var Q = 0, ne = 0, ue = 0, J = 0;
17331 Q = parseInt(Math.floor((D.getRect().x - V) / this.repulsionRange)), ne = parseInt(Math.floor((D.getRect().width + D.getRect().x - V) / this.repulsionRange)), ue = parseInt(Math.floor((D.getRect().y - _) / this.repulsionRange)), J = parseInt(Math.floor((D.getRect().height + D.getRect().y - _) / this.repulsionRange));
17332 for (var j = Q; j <= ne; j++)
17333 for (var Y = ue; Y <= J; Y++)
17334 this.grid[j][Y].push(D), D.setGridCoordinates(Q, ne, ue, J);
17335 }, P.prototype.updateGrid = function() {
17336 var D, V, _ = this.getAllNodes();
17337 for (this.grid = this.calcGrid(this.graphManager.getRoot()), D = 0; D < _.length; D++)
17338 V = _[D], this.addNodeToGrid(V, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
17339 }, P.prototype.calculateRepulsionForceOfANode = function(D, V, _, Q) {
17340 if (this.totalIterations % x.GRID_CALCULATION_CHECK_PERIOD == 1 && _ || Q) {
17341 var ne = /* @__PURE__ */ new Set();
17342 D.surrounding = new Array();
17343 for (var ue, J = this.grid, j = D.startX - 1; j < D.finishX + 2; j++)
17344 for (var Y = D.startY - 1; Y < D.finishY + 2; Y++)
17345 if (!(j < 0 || Y < 0 || j >= J.length || Y >= J[0].length)) {
17346 for (var te = 0; te < J[j][Y].length; te++)
17347 if (ue = J[j][Y][te], !(D.getOwner() != ue.getOwner() || D == ue) && !V.has(ue) && !ne.has(ue)) {
17348 var L = Math.abs(D.getCenterX() - ue.getCenterX()) - (D.getWidth() / 2 + ue.getWidth() / 2), $ = Math.abs(D.getCenterY() - ue.getCenterY()) - (D.getHeight() / 2 + ue.getHeight() / 2);
17349 L <= this.repulsionRange && $ <= this.repulsionRange && ne.add(ue);
17350 }
17351 }
17352 D.surrounding = [].concat(O(ne));
17353 }
17354 for (j = 0; j < D.surrounding.length; j++)
17355 this.calcRepulsionForce(D, D.surrounding[j]);
17356 }, P.prototype.calcRepulsionRange = function() {
17357 return 0;
17358 }, ee.exports = P;
17359 },
17360 /* 19 */
17361 /***/
17362 function(ee, ve, H) {
17363 var O = H(1), T = H(7);
17364 function x(G, U, P) {
17365 O.call(this, G, U, P), this.idealLength = T.DEFAULT_EDGE_LENGTH;
17366 }
17367 x.prototype = Object.create(O.prototype);
17368 for (var S in O)
17369 x[S] = O[S];
17370 ee.exports = x;
17371 },
17372 /* 20 */
17373 /***/
17374 function(ee, ve, H) {
17375 var O = H(3);
17376 function T(S, G, U, P) {
17377 O.call(this, S, G, U, P), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0, this.startX = 0, this.finishX = 0, this.startY = 0, this.finishY = 0, this.surrounding = [];
17378 }
17379 T.prototype = Object.create(O.prototype);
17380 for (var x in O)
17381 T[x] = O[x];
17382 T.prototype.setGridCoordinates = function(S, G, U, P) {
17383 this.startX = S, this.finishX = G, this.startY = U, this.finishY = P;
17384 }, ee.exports = T;
17385 },
17386 /* 21 */
17387 /***/
17388 function(ee, ve, H) {
17389 function O(T, x) {
17390 this.width = 0, this.height = 0, T !== null && x !== null && (this.height = x, this.width = T);
17391 }
17392 O.prototype.getWidth = function() {
17393 return this.width;
17394 }, O.prototype.setWidth = function(T) {
17395 this.width = T;
17396 }, O.prototype.getHeight = function() {
17397 return this.height;
17398 }, O.prototype.setHeight = function(T) {
17399 this.height = T;
17400 }, ee.exports = O;
17401 },
17402 /* 22 */
17403 /***/
17404 function(ee, ve, H) {
17405 var O = H(14);
17406 function T() {
17407 this.map = {}, this.keys = [];
17408 }
17409 T.prototype.put = function(x, S) {
17410 var G = O.createID(x);
17411 this.contains(G) || (this.map[G] = S, this.keys.push(x));
17412 }, T.prototype.contains = function(x) {
17413 return O.createID(x), this.map[x] != null;
17414 }, T.prototype.get = function(x) {
17415 var S = O.createID(x);
17416 return this.map[S];
17417 }, T.prototype.keySet = function() {
17418 return this.keys;
17419 }, ee.exports = T;
17420 },
17421 /* 23 */
17422 /***/
17423 function(ee, ve, H) {
17424 var O = H(14);
17425 function T() {
17426 this.set = {};
17427 }
17428 T.prototype.add = function(x) {
17429 var S = O.createID(x);
17430 this.contains(S) || (this.set[S] = x);
17431 }, T.prototype.remove = function(x) {
17432 delete this.set[O.createID(x)];
17433 }, T.prototype.clear = function() {
17434 this.set = {};
17435 }, T.prototype.contains = function(x) {
17436 return this.set[O.createID(x)] == x;
17437 }, T.prototype.isEmpty = function() {
17438 return this.size() === 0;
17439 }, T.prototype.size = function() {
17440 return Object.keys(this.set).length;
17441 }, T.prototype.addAllTo = function(x) {
17442 for (var S = Object.keys(this.set), G = S.length, U = 0; U < G; U++)
17443 x.push(this.set[S[U]]);
17444 }, T.prototype.size = function() {
17445 return Object.keys(this.set).length;
17446 }, T.prototype.addAll = function(x) {
17447 for (var S = x.length, G = 0; G < S; G++) {
17448 var U = x[G];
17449 this.add(U);
17450 }
17451 }, ee.exports = T;
17452 },
17453 /* 24 */
17454 /***/
17455 function(ee, ve, H) {
17456 var O = function() {
17457 function G(U, P) {
17458 for (var K = 0; K < P.length; K++) {
17459 var D = P[K];
17460 D.enumerable = D.enumerable || !1, D.configurable = !0, "value" in D && (D.writable = !0), Object.defineProperty(U, D.key, D);
17461 }
17462 }
17463 return function(U, P, K) {
17464 return P && G(U.prototype, P), K && G(U, K), U;
17465 };
17466 }();
17467 function T(G, U) {
17468 if (!(G instanceof U))
17469 throw new TypeError("Cannot call a class as a function");
17470 }
17471 var x = H(11), S = function() {
17472 function G(U, P) {
17473 T(this, G), (P !== null || P !== void 0) && (this.compareFunction = this._defaultCompareFunction);
17474 var K = void 0;
17475 U instanceof x ? K = U.size() : K = U.length, this._quicksort(U, 0, K - 1);
17476 }
17477 return O(G, [{
17478 key: "_quicksort",
17479 value: function(P, K, D) {
17480 if (K < D) {
17481 var V = this._partition(P, K, D);
17482 this._quicksort(P, K, V), this._quicksort(P, V + 1, D);
17483 }
17484 }
17485 }, {
17486 key: "_partition",
17487 value: function(P, K, D) {
17488 for (var V = this._get(P, K), _ = K, Q = D; ; ) {
17489 for (; this.compareFunction(V, this._get(P, Q)); )
17490 Q--;
17491 for (; this.compareFunction(this._get(P, _), V); )
17492 _++;
17493 if (_ < Q)
17494 this._swap(P, _, Q), _++, Q--;
17495 else
17496 return Q;
17497 }
17498 }
17499 }, {
17500 key: "_get",
17501 value: function(P, K) {
17502 return P instanceof x ? P.get_object_at(K) : P[K];
17503 }
17504 }, {
17505 key: "_set",
17506 value: function(P, K, D) {
17507 P instanceof x ? P.set_object_at(K, D) : P[K] = D;
17508 }
17509 }, {
17510 key: "_swap",
17511 value: function(P, K, D) {
17512 var V = this._get(P, K);
17513 this._set(P, K, this._get(P, D)), this._set(P, D, V);
17514 }
17515 }, {
17516 key: "_defaultCompareFunction",
17517 value: function(P, K) {
17518 return K > P;
17519 }
17520 }]), G;
17521 }();
17522 ee.exports = S;
17523 },
17524 /* 25 */
17525 /***/
17526 function(ee, ve, H) {
17527 var O = function() {
17528 function S(G, U) {
17529 for (var P = 0; P < U.length; P++) {
17530 var K = U[P];
17531 K.enumerable = K.enumerable || !1, K.configurable = !0, "value" in K && (K.writable = !0), Object.defineProperty(G, K.key, K);
17532 }
17533 }
17534 return function(G, U, P) {
17535 return U && S(G.prototype, U), P && S(G, P), G;
17536 };
17537 }();
17538 function T(S, G) {
17539 if (!(S instanceof G))
17540 throw new TypeError("Cannot call a class as a function");
17541 }
17542 var x = function() {
17543 function S(G, U) {
17544 var P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, K = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, D = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
17545 T(this, S), this.sequence1 = G, this.sequence2 = U, this.match_score = P, this.mismatch_penalty = K, this.gap_penalty = D, this.iMax = G.length + 1, this.jMax = U.length + 1, this.grid = new Array(this.iMax);
17546 for (var V = 0; V < this.iMax; V++) {
17547 this.grid[V] = new Array(this.jMax);
17548 for (var _ = 0; _ < this.jMax; _++)
17549 this.grid[V][_] = 0;
17550 }
17551 this.tracebackGrid = new Array(this.iMax);
17552 for (var Q = 0; Q < this.iMax; Q++) {
17553 this.tracebackGrid[Q] = new Array(this.jMax);
17554 for (var ne = 0; ne < this.jMax; ne++)
17555 this.tracebackGrid[Q][ne] = [null, null, null];
17556 }
17557 this.alignments = [], this.score = -1, this.computeGrids();
17558 }
17559 return O(S, [{
17560 key: "getScore",
17561 value: function() {
17562 return this.score;
17563 }
17564 }, {
17565 key: "getAlignments",
17566 value: function() {
17567 return this.alignments;
17568 }
17569 // Main dynamic programming procedure
17570 }, {
17571 key: "computeGrids",
17572 value: function() {
17573 for (var U = 1; U < this.jMax; U++)
17574 this.grid[0][U] = this.grid[0][U - 1] + this.gap_penalty, this.tracebackGrid[0][U] = [!1, !1, !0];
17575 for (var P = 1; P < this.iMax; P++)
17576 this.grid[P][0] = this.grid[P - 1][0] + this.gap_penalty, this.tracebackGrid[P][0] = [!1, !0, !1];
17577 for (var K = 1; K < this.iMax; K++)
17578 for (var D = 1; D < this.jMax; D++) {
17579 var V = void 0;
17580 this.sequence1[K - 1] === this.sequence2[D - 1] ? V = this.grid[K - 1][D - 1] + this.match_score : V = this.grid[K - 1][D - 1] + this.mismatch_penalty;
17581 var _ = this.grid[K - 1][D] + this.gap_penalty, Q = this.grid[K][D - 1] + this.gap_penalty, ne = [V, _, Q], ue = this.arrayAllMaxIndexes(ne);
17582 this.grid[K][D] = ne[ue[0]], this.tracebackGrid[K][D] = [ue.includes(0), ue.includes(1), ue.includes(2)];
17583 }
17584 this.score = this.grid[this.iMax - 1][this.jMax - 1];
17585 }
17586 // Gets all possible valid sequence combinations
17587 }, {
17588 key: "alignmentTraceback",
17589 value: function() {
17590 var U = [];
17591 for (U.push({
17592 pos: [this.sequence1.length, this.sequence2.length],
17593 seq1: "",
17594 seq2: ""
17595 }); U[0]; ) {
17596 var P = U[0], K = this.tracebackGrid[P.pos[0]][P.pos[1]];
17597 K[0] && U.push({
17598 pos: [P.pos[0] - 1, P.pos[1] - 1],
17599 seq1: this.sequence1[P.pos[0] - 1] + P.seq1,
17600 seq2: this.sequence2[P.pos[1] - 1] + P.seq2
17601 }), K[1] && U.push({
17602 pos: [P.pos[0] - 1, P.pos[1]],
17603 seq1: this.sequence1[P.pos[0] - 1] + P.seq1,
17604 seq2: "-" + P.seq2
17605 }), K[2] && U.push({
17606 pos: [P.pos[0], P.pos[1] - 1],
17607 seq1: "-" + P.seq1,
17608 seq2: this.sequence2[P.pos[1] - 1] + P.seq2
17609 }), P.pos[0] === 0 && P.pos[1] === 0 && this.alignments.push({
17610 sequence1: P.seq1,
17611 sequence2: P.seq2
17612 }), U.shift();
17613 }
17614 return this.alignments;
17615 }
17616 // Helper Functions
17617 }, {
17618 key: "getAllIndexes",
17619 value: function(U, P) {
17620 for (var K = [], D = -1; (D = U.indexOf(P, D + 1)) !== -1; )
17621 K.push(D);
17622 return K;
17623 }
17624 }, {
17625 key: "arrayAllMaxIndexes",
17626 value: function(U) {
17627 return this.getAllIndexes(U, Math.max.apply(null, U));
17628 }
17629 }]), S;
17630 }();
17631 ee.exports = x;
17632 },
17633 /* 26 */
17634 /***/
17635 function(ee, ve, H) {
17636 var O = function() {
17637 };
17638 O.FDLayout = H(18), O.FDLayoutConstants = H(7), O.FDLayoutEdge = H(19), O.FDLayoutNode = H(20), O.DimensionD = H(21), O.HashMap = H(22), O.HashSet = H(23), O.IGeometry = H(8), O.IMath = H(9), O.Integer = H(10), O.Point = H(12), O.PointD = H(4), O.RandomSeed = H(16), O.RectangleD = H(13), O.Transform = H(17), O.UniqueIDGeneretor = H(14), O.Quicksort = H(24), O.LinkedList = H(11), O.LGraphObject = H(2), O.LGraph = H(5), O.LEdge = H(1), O.LGraphManager = H(6), O.LNode = H(3), O.Layout = H(15), O.LayoutConstants = H(0), O.NeedlemanWunsch = H(25), ee.exports = O;
17639 },
17640 /* 27 */
17641 /***/
17642 function(ee, ve, H) {
17643 function O() {
17644 this.listeners = [];
17645 }
17646 var T = O.prototype;
17647 T.addListener = function(x, S) {
17648 this.listeners.push({
17649 event: x,
17650 callback: S
17651 });
17652 }, T.removeListener = function(x, S) {
17653 for (var G = this.listeners.length; G >= 0; G--) {
17654 var U = this.listeners[G];
17655 U.event === x && U.callback === S && this.listeners.splice(G, 1);
17656 }
17657 }, T.emit = function(x, S) {
17658 for (var G = 0; G < this.listeners.length; G++) {
17659 var U = this.listeners[G];
17660 x === U.event && U.callback(S);
17661 }
17662 }, ee.exports = O;
17663 }
17664 /******/
17665 ])
17666 );
17667 });
17668 }(Kp)), ri;
17669}
17670var _u;
17671function Qp() {
17672 return _u || (_u = 1, function(he, fe) {
17673 (function(ve, H) {
17674 he.exports = H(Zp());
17675 })(Ca, function(ee) {
17676 return (
17677 /******/
17678 function(ve) {
17679 var H = {};
17680 function O(T) {
17681 if (H[T])
17682 return H[T].exports;
17683 var x = H[T] = {
17684 /******/
17685 i: T,
17686 /******/
17687 l: !1,
17688 /******/
17689 exports: {}
17690 /******/
17691 };
17692 return ve[T].call(x.exports, x, x.exports, O), x.l = !0, x.exports;
17693 }
17694 return O.m = ve, O.c = H, O.i = function(T) {
17695 return T;
17696 }, O.d = function(T, x, S) {
17697 O.o(T, x) || Object.defineProperty(T, x, {
17698 /******/
17699 configurable: !1,
17700 /******/
17701 enumerable: !0,
17702 /******/
17703 get: S
17704 /******/
17705 });
17706 }, O.n = function(T) {
17707 var x = T && T.__esModule ? (
17708 /******/
17709 function() {
17710 return T.default;
17711 }
17712 ) : (
17713 /******/
17714 function() {
17715 return T;
17716 }
17717 );
17718 return O.d(x, "a", x), x;
17719 }, O.o = function(T, x) {
17720 return Object.prototype.hasOwnProperty.call(T, x);
17721 }, O.p = "", O(O.s = 7);
17722 }([
17723 /* 0 */
17724 /***/
17725 function(ve, H) {
17726 ve.exports = ee;
17727 },
17728 /* 1 */
17729 /***/
17730 function(ve, H, O) {
17731 var T = O(0).FDLayoutConstants;
17732 function x() {
17733 }
17734 for (var S in T)
17735 x[S] = T[S];
17736 x.DEFAULT_USE_MULTI_LEVEL_SCALING = !1, x.DEFAULT_RADIAL_SEPARATION = T.DEFAULT_EDGE_LENGTH, x.DEFAULT_COMPONENT_SEPERATION = 60, x.TILE = !0, x.TILING_PADDING_VERTICAL = 10, x.TILING_PADDING_HORIZONTAL = 10, x.TREE_REDUCTION_ON_INCREMENTAL = !1, ve.exports = x;
17737 },
17738 /* 2 */
17739 /***/
17740 function(ve, H, O) {
17741 var T = O(0).FDLayoutEdge;
17742 function x(G, U, P) {
17743 T.call(this, G, U, P);
17744 }
17745 x.prototype = Object.create(T.prototype);
17746 for (var S in T)
17747 x[S] = T[S];
17748 ve.exports = x;
17749 },
17750 /* 3 */
17751 /***/
17752 function(ve, H, O) {
17753 var T = O(0).LGraph;
17754 function x(G, U, P) {
17755 T.call(this, G, U, P);
17756 }
17757 x.prototype = Object.create(T.prototype);
17758 for (var S in T)
17759 x[S] = T[S];
17760 ve.exports = x;
17761 },
17762 /* 4 */
17763 /***/
17764 function(ve, H, O) {
17765 var T = O(0).LGraphManager;
17766 function x(G) {
17767 T.call(this, G);
17768 }
17769 x.prototype = Object.create(T.prototype);
17770 for (var S in T)
17771 x[S] = T[S];
17772 ve.exports = x;
17773 },
17774 /* 5 */
17775 /***/
17776 function(ve, H, O) {
17777 var T = O(0).FDLayoutNode, x = O(0).IMath;
17778 function S(U, P, K, D) {
17779 T.call(this, U, P, K, D);
17780 }
17781 S.prototype = Object.create(T.prototype);
17782 for (var G in T)
17783 S[G] = T[G];
17784 S.prototype.move = function() {
17785 var U = this.graphManager.getLayout();
17786 this.displacementX = U.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY = U.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren, Math.abs(this.displacementX) > U.coolingFactor * U.maxNodeDisplacement && (this.displacementX = U.coolingFactor * U.maxNodeDisplacement * x.sign(this.displacementX)), Math.abs(this.displacementY) > U.coolingFactor * U.maxNodeDisplacement && (this.displacementY = U.coolingFactor * U.maxNodeDisplacement * x.sign(this.displacementY)), this.child == null ? this.moveBy(this.displacementX, this.displacementY) : this.child.getNodes().length == 0 ? this.moveBy(this.displacementX, this.displacementY) : this.propogateDisplacementToChildren(this.displacementX, this.displacementY), U.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0;
17787 }, S.prototype.propogateDisplacementToChildren = function(U, P) {
17788 for (var K = this.getChild().getNodes(), D, V = 0; V < K.length; V++)
17789 D = K[V], D.getChild() == null ? (D.moveBy(U, P), D.displacementX += U, D.displacementY += P) : D.propogateDisplacementToChildren(U, P);
17790 }, S.prototype.setPred1 = function(U) {
17791 this.pred1 = U;
17792 }, S.prototype.getPred1 = function() {
17793 return pred1;
17794 }, S.prototype.getPred2 = function() {
17795 return pred2;
17796 }, S.prototype.setNext = function(U) {
17797 this.next = U;
17798 }, S.prototype.getNext = function() {
17799 return next;
17800 }, S.prototype.setProcessed = function(U) {
17801 this.processed = U;
17802 }, S.prototype.isProcessed = function() {
17803 return processed;
17804 }, ve.exports = S;
17805 },
17806 /* 6 */
17807 /***/
17808 function(ve, H, O) {
17809 var T = O(0).FDLayout, x = O(4), S = O(3), G = O(5), U = O(2), P = O(1), K = O(0).FDLayoutConstants, D = O(0).LayoutConstants, V = O(0).Point, _ = O(0).PointD, Q = O(0).Layout, ne = O(0).Integer, ue = O(0).IGeometry, J = O(0).LGraph, j = O(0).Transform;
17810 function Y() {
17811 T.call(this), this.toBeTiled = {};
17812 }
17813 Y.prototype = Object.create(T.prototype);
17814 for (var te in T)
17815 Y[te] = T[te];
17816 Y.prototype.newGraphManager = function() {
17817 var L = new x(this);
17818 return this.graphManager = L, L;
17819 }, Y.prototype.newGraph = function(L) {
17820 return new S(null, this.graphManager, L);
17821 }, Y.prototype.newNode = function(L) {
17822 return new G(this.graphManager, L);
17823 }, Y.prototype.newEdge = function(L) {
17824 return new U(null, null, L);
17825 }, Y.prototype.initParameters = function() {
17826 T.prototype.initParameters.call(this, arguments), this.isSubLayout || (P.DEFAULT_EDGE_LENGTH < 10 ? this.idealEdgeLength = 10 : this.idealEdgeLength = P.DEFAULT_EDGE_LENGTH, this.useSmartIdealEdgeLengthCalculation = P.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.springConstant = K.DEFAULT_SPRING_STRENGTH, this.repulsionConstant = K.DEFAULT_REPULSION_STRENGTH, this.gravityConstant = K.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = K.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = K.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = K.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.prunedNodesAll = [], this.growTreeIterations = 0, this.afterGrowthIterations = 0, this.isTreeGrowing = !1, this.isGrowthFinished = !1, this.coolingCycle = 0, this.maxCoolingCycle = this.maxIterations / K.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = K.CONVERGENCE_CHECK_PERIOD / this.maxIterations, this.coolingAdjuster = 1);
17827 }, Y.prototype.layout = function() {
17828 var L = D.DEFAULT_CREATE_BENDS_AS_NEEDED;
17829 return L && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout();
17830 }, Y.prototype.classicLayout = function() {
17831 if (this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(), this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity), this.calcNoOfChildrenForAllNodes(), this.graphManager.calcLowestCommonAncestors(), this.graphManager.calcInclusionTreeDepths(), this.graphManager.getRoot().calcEstimatedSize(), this.calcIdealEdgeLengths(), this.incremental) {
17832 if (P.TREE_REDUCTION_ON_INCREMENTAL) {
17833 this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
17834 var $ = new Set(this.getAllNodes()), k = this.nodesWithGravity.filter(function(pe) {
17835 return $.has(pe);
17836 });
17837 this.graphManager.setAllNodesToApplyGravitation(k);
17838 }
17839 } else {
17840 var L = this.getFlatForest();
17841 if (L.length > 0)
17842 this.positionNodesRadially(L);
17843 else {
17844 this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
17845 var $ = new Set(this.getAllNodes()), k = this.nodesWithGravity.filter(function(q) {
17846 return $.has(q);
17847 });
17848 this.graphManager.setAllNodesToApplyGravitation(k), this.positionNodesRandomly();
17849 }
17850 }
17851 return this.initSpringEmbedder(), this.runSpringEmbedder(), !0;
17852 }, Y.prototype.tick = function() {
17853 if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished)
17854 if (this.prunedNodesAll.length > 0)
17855 this.isTreeGrowing = !0;
17856 else
17857 return !0;
17858 if (this.totalIterations % K.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
17859 if (this.isConverged())
17860 if (this.prunedNodesAll.length > 0)
17861 this.isTreeGrowing = !0;
17862 else
17863 return !0;
17864 this.coolingCycle++, this.layoutQuality == 0 ? this.coolingAdjuster = this.coolingCycle : this.layoutQuality == 1 && (this.coolingAdjuster = this.coolingCycle / 3), this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature), this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor));
17865 }
17866 if (this.isTreeGrowing) {
17867 if (this.growTreeIterations % 10 == 0)
17868 if (this.prunedNodesAll.length > 0) {
17869 this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation();
17870 var L = new Set(this.getAllNodes()), $ = this.nodesWithGravity.filter(function(ce) {
17871 return L.has(ce);
17872 });
17873 this.graphManager.setAllNodesToApplyGravitation($), this.graphManager.updateBounds(), this.updateGrid(), this.coolingFactor = K.DEFAULT_COOLING_FACTOR_INCREMENTAL;
17874 } else
17875 this.isTreeGrowing = !1, this.isGrowthFinished = !0;
17876 this.growTreeIterations++;
17877 }
17878 if (this.isGrowthFinished) {
17879 if (this.isConverged())
17880 return !0;
17881 this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), this.coolingFactor = K.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++;
17882 }
17883 var k = !this.isTreeGrowing && !this.isGrowthFinished, q = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
17884 return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(k, q), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1;
17885 }, Y.prototype.getPositionsData = function() {
17886 for (var L = this.graphManager.getAllNodes(), $ = {}, k = 0; k < L.length; k++) {
17887 var q = L[k].rect, ce = L[k].id;
17888 $[ce] = {
17889 id: ce,
17890 x: q.getCenterX(),
17891 y: q.getCenterY(),
17892 w: q.width,
17893 h: q.height
17894 };
17895 }
17896 return $;
17897 }, Y.prototype.runSpringEmbedder = function() {
17898 this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod;
17899 var L = !1;
17900 if (K.ANIMATE === "during")
17901 this.emit("layoutstarted");
17902 else {
17903 for (; !L; )
17904 L = this.tick();
17905 this.graphManager.updateBounds();
17906 }
17907 }, Y.prototype.calculateNodesToApplyGravitationTo = function() {
17908 var L = [], $, k = this.graphManager.getGraphs(), q = k.length, ce;
17909 for (ce = 0; ce < q; ce++)
17910 $ = k[ce], $.updateConnected(), $.isConnected || (L = L.concat($.getNodes()));
17911 return L;
17912 }, Y.prototype.createBendpoints = function() {
17913 var L = [];
17914 L = L.concat(this.graphManager.getAllEdges());
17915 var $ = /* @__PURE__ */ new Set(), k;
17916 for (k = 0; k < L.length; k++) {
17917 var q = L[k];
17918 if (!$.has(q)) {
17919 var ce = q.getSource(), pe = q.getTarget();
17920 if (ce == pe)
17921 q.getBendpoints().push(new _()), q.getBendpoints().push(new _()), this.createDummyNodesForBendpoints(q), $.add(q);
17922 else {
17923 var Ae = [];
17924 if (Ae = Ae.concat(ce.getEdgeListToNode(pe)), Ae = Ae.concat(pe.getEdgeListToNode(ce)), !$.has(Ae[0])) {
17925 if (Ae.length > 1) {
17926 var Ne;
17927 for (Ne = 0; Ne < Ae.length; Ne++) {
17928 var _e = Ae[Ne];
17929 _e.getBendpoints().push(new _()), this.createDummyNodesForBendpoints(_e);
17930 }
17931 }
17932 Ae.forEach(function(tt) {
17933 $.add(tt);
17934 });
17935 }
17936 }
17937 }
17938 if ($.size == L.length)
17939 break;
17940 }
17941 }, Y.prototype.positionNodesRadially = function(L) {
17942 for (var $ = new V(0, 0), k = Math.ceil(Math.sqrt(L.length)), q = 0, ce = 0, pe = 0, Ae = new _(0, 0), Ne = 0; Ne < L.length; Ne++) {
17943 Ne % k == 0 && (pe = 0, ce = q, Ne != 0 && (ce += P.DEFAULT_COMPONENT_SEPERATION), q = 0);
17944 var _e = L[Ne], tt = Q.findCenterOfTree(_e);
17945 $.x = pe, $.y = ce, Ae = Y.radialLayout(_e, tt, $), Ae.y > q && (q = Math.floor(Ae.y)), pe = Math.floor(Ae.x + P.DEFAULT_COMPONENT_SEPERATION);
17946 }
17947 this.transform(new _(D.WORLD_CENTER_X - Ae.x / 2, D.WORLD_CENTER_Y - Ae.y / 2));
17948 }, Y.radialLayout = function(L, $, k) {
17949 var q = Math.max(this.maxDiagonalInTree(L), P.DEFAULT_RADIAL_SEPARATION);
17950 Y.branchRadialLayout($, null, 0, 359, 0, q);
17951 var ce = J.calculateBounds(L), pe = new j();
17952 pe.setDeviceOrgX(ce.getMinX()), pe.setDeviceOrgY(ce.getMinY()), pe.setWorldOrgX(k.x), pe.setWorldOrgY(k.y);
17953 for (var Ae = 0; Ae < L.length; Ae++) {
17954 var Ne = L[Ae];
17955 Ne.transform(pe);
17956 }
17957 var _e = new _(ce.getMaxX(), ce.getMaxY());
17958 return pe.inverseTransformPoint(_e);
17959 }, Y.branchRadialLayout = function(L, $, k, q, ce, pe) {
17960 var Ae = (q - k + 1) / 2;
17961 Ae < 0 && (Ae += 180);
17962 var Ne = (Ae + k) % 360, _e = Ne * ue.TWO_PI / 360, tt = ce * Math.cos(_e), ct = ce * Math.sin(_e);
17963 L.setCenter(tt, ct);
17964 var Pe = [];
17965 Pe = Pe.concat(L.getEdges());
17966 var $e = Pe.length;
17967 $ != null && $e--;
17968 for (var Xe = 0, rt = Pe.length, lt, nt = L.getEdgesBetween($); nt.length > 1; ) {
17969 var je = nt[0];
17970 nt.splice(0, 1);
17971 var pt = Pe.indexOf(je);
17972 pt >= 0 && Pe.splice(pt, 1), rt--, $e--;
17973 }
17974 $ != null ? lt = (Pe.indexOf(nt[0]) + 1) % rt : lt = 0;
17975 for (var Et = Math.abs(q - k) / $e, kt = lt; Xe != $e; kt = ++kt % rt) {
17976 var vt = Pe[kt].getOtherEnd(L);
17977 if (vt != $) {
17978 var vr = (k + Xe * Et) % 360, qt = (vr + Et) % 360;
17979 Y.branchRadialLayout(vt, L, vr, qt, ce + pe, pe), Xe++;
17980 }
17981 }
17982 }, Y.maxDiagonalInTree = function(L) {
17983 for (var $ = ne.MIN_VALUE, k = 0; k < L.length; k++) {
17984 var q = L[k], ce = q.getDiagonal();
17985 ce > $ && ($ = ce);
17986 }
17987 return $;
17988 }, Y.prototype.calcRepulsionRange = function() {
17989 return 2 * (this.level + 1) * this.idealEdgeLength;
17990 }, Y.prototype.groupZeroDegreeMembers = function() {
17991 var L = this, $ = {};
17992 this.memberGroups = {}, this.idToDummyNode = {};
17993 for (var k = [], q = this.graphManager.getAllNodes(), ce = 0; ce < q.length; ce++) {
17994 var pe = q[ce], Ae = pe.getParent();
17995 this.getNodeDegreeWithChildren(pe) === 0 && (Ae.id == null || !this.getToBeTiled(Ae)) && k.push(pe);
17996 }
17997 for (var ce = 0; ce < k.length; ce++) {
17998 var pe = k[ce], Ne = pe.getParent().id;
17999 typeof $[Ne] > "u" && ($[Ne] = []), $[Ne] = $[Ne].concat(pe);
18000 }
18001 Object.keys($).forEach(function(_e) {
18002 if ($[_e].length > 1) {
18003 var tt = "DummyCompound_" + _e;
18004 L.memberGroups[tt] = $[_e];
18005 var ct = $[_e][0].getParent(), Pe = new G(L.graphManager);
18006 Pe.id = tt, Pe.paddingLeft = ct.paddingLeft || 0, Pe.paddingRight = ct.paddingRight || 0, Pe.paddingBottom = ct.paddingBottom || 0, Pe.paddingTop = ct.paddingTop || 0, L.idToDummyNode[tt] = Pe;
18007 var $e = L.getGraphManager().add(L.newGraph(), Pe), Xe = ct.getChild();
18008 Xe.add(Pe);
18009 for (var rt = 0; rt < $[_e].length; rt++) {
18010 var lt = $[_e][rt];
18011 Xe.remove(lt), $e.add(lt);
18012 }
18013 }
18014 });
18015 }, Y.prototype.clearCompounds = function() {
18016 var L = {}, $ = {};
18017 this.performDFSOnCompounds();
18018 for (var k = 0; k < this.compoundOrder.length; k++)
18019 $[this.compoundOrder[k].id] = this.compoundOrder[k], L[this.compoundOrder[k].id] = [].concat(this.compoundOrder[k].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[k].getChild()), this.compoundOrder[k].child = null;
18020 this.graphManager.resetAllNodes(), this.tileCompoundMembers(L, $);
18021 }, Y.prototype.clearZeroDegreeMembers = function() {
18022 var L = this, $ = this.tiledZeroDegreePack = [];
18023 Object.keys(this.memberGroups).forEach(function(k) {
18024 var q = L.idToDummyNode[k];
18025 $[k] = L.tileNodes(L.memberGroups[k], q.paddingLeft + q.paddingRight), q.rect.width = $[k].width, q.rect.height = $[k].height;
18026 });
18027 }, Y.prototype.repopulateCompounds = function() {
18028 for (var L = this.compoundOrder.length - 1; L >= 0; L--) {
18029 var $ = this.compoundOrder[L], k = $.id, q = $.paddingLeft, ce = $.paddingTop;
18030 this.adjustLocations(this.tiledMemberPack[k], $.rect.x, $.rect.y, q, ce);
18031 }
18032 }, Y.prototype.repopulateZeroDegreeMembers = function() {
18033 var L = this, $ = this.tiledZeroDegreePack;
18034 Object.keys($).forEach(function(k) {
18035 var q = L.idToDummyNode[k], ce = q.paddingLeft, pe = q.paddingTop;
18036 L.adjustLocations($[k], q.rect.x, q.rect.y, ce, pe);
18037 });
18038 }, Y.prototype.getToBeTiled = function(L) {
18039 var $ = L.id;
18040 if (this.toBeTiled[$] != null)
18041 return this.toBeTiled[$];
18042 var k = L.getChild();
18043 if (k == null)
18044 return this.toBeTiled[$] = !1, !1;
18045 for (var q = k.getNodes(), ce = 0; ce < q.length; ce++) {
18046 var pe = q[ce];
18047 if (this.getNodeDegree(pe) > 0)
18048 return this.toBeTiled[$] = !1, !1;
18049 if (pe.getChild() == null) {
18050 this.toBeTiled[pe.id] = !1;
18051 continue;
18052 }
18053 if (!this.getToBeTiled(pe))
18054 return this.toBeTiled[$] = !1, !1;
18055 }
18056 return this.toBeTiled[$] = !0, !0;
18057 }, Y.prototype.getNodeDegree = function(L) {
18058 L.id;
18059 for (var $ = L.getEdges(), k = 0, q = 0; q < $.length; q++) {
18060 var ce = $[q];
18061 ce.getSource().id !== ce.getTarget().id && (k = k + 1);
18062 }
18063 return k;
18064 }, Y.prototype.getNodeDegreeWithChildren = function(L) {
18065 var $ = this.getNodeDegree(L);
18066 if (L.getChild() == null)
18067 return $;
18068 for (var k = L.getChild().getNodes(), q = 0; q < k.length; q++) {
18069 var ce = k[q];
18070 $ += this.getNodeDegreeWithChildren(ce);
18071 }
18072 return $;
18073 }, Y.prototype.performDFSOnCompounds = function() {
18074 this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
18075 }, Y.prototype.fillCompexOrderByDFS = function(L) {
18076 for (var $ = 0; $ < L.length; $++) {
18077 var k = L[$];
18078 k.getChild() != null && this.fillCompexOrderByDFS(k.getChild().getNodes()), this.getToBeTiled(k) && this.compoundOrder.push(k);
18079 }
18080 }, Y.prototype.adjustLocations = function(L, $, k, q, ce) {
18081 $ += q, k += ce;
18082 for (var pe = $, Ae = 0; Ae < L.rows.length; Ae++) {
18083 var Ne = L.rows[Ae];
18084 $ = pe;
18085 for (var _e = 0, tt = 0; tt < Ne.length; tt++) {
18086 var ct = Ne[tt];
18087 ct.rect.x = $, ct.rect.y = k, $ += ct.rect.width + L.horizontalPadding, ct.rect.height > _e && (_e = ct.rect.height);
18088 }
18089 k += _e + L.verticalPadding;
18090 }
18091 }, Y.prototype.tileCompoundMembers = function(L, $) {
18092 var k = this;
18093 this.tiledMemberPack = [], Object.keys(L).forEach(function(q) {
18094 var ce = $[q];
18095 k.tiledMemberPack[q] = k.tileNodes(L[q], ce.paddingLeft + ce.paddingRight), ce.rect.width = k.tiledMemberPack[q].width, ce.rect.height = k.tiledMemberPack[q].height;
18096 });
18097 }, Y.prototype.tileNodes = function(L, $) {
18098 var k = P.TILING_PADDING_VERTICAL, q = P.TILING_PADDING_HORIZONTAL, ce = {
18099 rows: [],
18100 rowWidth: [],
18101 rowHeight: [],
18102 width: 0,
18103 height: $,
18104 // assume minHeight equals to minWidth
18105 verticalPadding: k,
18106 horizontalPadding: q
18107 };
18108 L.sort(function(Ne, _e) {
18109 return Ne.rect.width * Ne.rect.height > _e.rect.width * _e.rect.height ? -1 : Ne.rect.width * Ne.rect.height < _e.rect.width * _e.rect.height ? 1 : 0;
18110 });
18111 for (var pe = 0; pe < L.length; pe++) {
18112 var Ae = L[pe];
18113 ce.rows.length == 0 ? this.insertNodeToRow(ce, Ae, 0, $) : this.canAddHorizontal(ce, Ae.rect.width, Ae.rect.height) ? this.insertNodeToRow(ce, Ae, this.getShortestRowIndex(ce), $) : this.insertNodeToRow(ce, Ae, ce.rows.length, $), this.shiftToLastRow(ce);
18114 }
18115 return ce;
18116 }, Y.prototype.insertNodeToRow = function(L, $, k, q) {
18117 var ce = q;
18118 if (k == L.rows.length) {
18119 var pe = [];
18120 L.rows.push(pe), L.rowWidth.push(ce), L.rowHeight.push(0);
18121 }
18122 var Ae = L.rowWidth[k] + $.rect.width;
18123 L.rows[k].length > 0 && (Ae += L.horizontalPadding), L.rowWidth[k] = Ae, L.width < Ae && (L.width = Ae);
18124 var Ne = $.rect.height;
18125 k > 0 && (Ne += L.verticalPadding);
18126 var _e = 0;
18127 Ne > L.rowHeight[k] && (_e = L.rowHeight[k], L.rowHeight[k] = Ne, _e = L.rowHeight[k] - _e), L.height += _e, L.rows[k].push($);
18128 }, Y.prototype.getShortestRowIndex = function(L) {
18129 for (var $ = -1, k = Number.MAX_VALUE, q = 0; q < L.rows.length; q++)
18130 L.rowWidth[q] < k && ($ = q, k = L.rowWidth[q]);
18131 return $;
18132 }, Y.prototype.getLongestRowIndex = function(L) {
18133 for (var $ = -1, k = Number.MIN_VALUE, q = 0; q < L.rows.length; q++)
18134 L.rowWidth[q] > k && ($ = q, k = L.rowWidth[q]);
18135 return $;
18136 }, Y.prototype.canAddHorizontal = function(L, $, k) {
18137 var q = this.getShortestRowIndex(L);
18138 if (q < 0)
18139 return !0;
18140 var ce = L.rowWidth[q];
18141 if (ce + L.horizontalPadding + $ <= L.width)
18142 return !0;
18143 var pe = 0;
18144 L.rowHeight[q] < k && q > 0 && (pe = k + L.verticalPadding - L.rowHeight[q]);
18145 var Ae;
18146 L.width - ce >= $ + L.horizontalPadding ? Ae = (L.height + pe) / (ce + $ + L.horizontalPadding) : Ae = (L.height + pe) / L.width, pe = k + L.verticalPadding;
18147 var Ne;
18148 return L.width < $ ? Ne = (L.height + pe) / $ : Ne = (L.height + pe) / L.width, Ne < 1 && (Ne = 1 / Ne), Ae < 1 && (Ae = 1 / Ae), Ae < Ne;
18149 }, Y.prototype.shiftToLastRow = function(L) {
18150 var $ = this.getLongestRowIndex(L), k = L.rowWidth.length - 1, q = L.rows[$], ce = q[q.length - 1], pe = ce.width + L.horizontalPadding;
18151 if (L.width - L.rowWidth[k] > pe && $ != k) {
18152 q.splice(-1, 1), L.rows[k].push(ce), L.rowWidth[$] = L.rowWidth[$] - pe, L.rowWidth[k] = L.rowWidth[k] + pe, L.width = L.rowWidth[instance.getLongestRowIndex(L)];
18153 for (var Ae = Number.MIN_VALUE, Ne = 0; Ne < q.length; Ne++)
18154 q[Ne].height > Ae && (Ae = q[Ne].height);
18155 $ > 0 && (Ae += L.verticalPadding);
18156 var _e = L.rowHeight[$] + L.rowHeight[k];
18157 L.rowHeight[$] = Ae, L.rowHeight[k] < ce.height + L.verticalPadding && (L.rowHeight[k] = ce.height + L.verticalPadding);
18158 var tt = L.rowHeight[$] + L.rowHeight[k];
18159 L.height += tt - _e, this.shiftToLastRow(L);
18160 }
18161 }, Y.prototype.tilingPreLayout = function() {
18162 P.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers());
18163 }, Y.prototype.tilingPostLayout = function() {
18164 P.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds());
18165 }, Y.prototype.reduceTrees = function() {
18166 for (var L = [], $ = !0, k; $; ) {
18167 var q = this.graphManager.getAllNodes(), ce = [];
18168 $ = !1;
18169 for (var pe = 0; pe < q.length; pe++)
18170 k = q[pe], k.getEdges().length == 1 && !k.getEdges()[0].isInterGraph && k.getChild() == null && (ce.push([k, k.getEdges()[0], k.getOwner()]), $ = !0);
18171 if ($ == !0) {
18172 for (var Ae = [], Ne = 0; Ne < ce.length; Ne++)
18173 ce[Ne][0].getEdges().length == 1 && (Ae.push(ce[Ne]), ce[Ne][0].getOwner().remove(ce[Ne][0]));
18174 L.push(Ae), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
18175 }
18176 }
18177 this.prunedNodesAll = L;
18178 }, Y.prototype.growTree = function(L) {
18179 for (var $ = L.length, k = L[$ - 1], q, ce = 0; ce < k.length; ce++)
18180 q = k[ce], this.findPlaceforPrunedNode(q), q[2].add(q[0]), q[2].add(q[1], q[1].source, q[1].target);
18181 L.splice(L.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
18182 }, Y.prototype.findPlaceforPrunedNode = function(L) {
18183 var $, k, q = L[0];
18184 q == L[1].source ? k = L[1].target : k = L[1].source;
18185 var ce = k.startX, pe = k.finishX, Ae = k.startY, Ne = k.finishY, _e = 0, tt = 0, ct = 0, Pe = 0, $e = [_e, ct, tt, Pe];
18186 if (Ae > 0)
18187 for (var Xe = ce; Xe <= pe; Xe++)
18188 $e[0] += this.grid[Xe][Ae - 1].length + this.grid[Xe][Ae].length - 1;
18189 if (pe < this.grid.length - 1)
18190 for (var Xe = Ae; Xe <= Ne; Xe++)
18191 $e[1] += this.grid[pe + 1][Xe].length + this.grid[pe][Xe].length - 1;
18192 if (Ne < this.grid[0].length - 1)
18193 for (var Xe = ce; Xe <= pe; Xe++)
18194 $e[2] += this.grid[Xe][Ne + 1].length + this.grid[Xe][Ne].length - 1;
18195 if (ce > 0)
18196 for (var Xe = Ae; Xe <= Ne; Xe++)
18197 $e[3] += this.grid[ce - 1][Xe].length + this.grid[ce][Xe].length - 1;
18198 for (var rt = ne.MAX_VALUE, lt, nt, je = 0; je < $e.length; je++)
18199 $e[je] < rt ? (rt = $e[je], lt = 1, nt = je) : $e[je] == rt && lt++;
18200 if (lt == 3 && rt == 0)
18201 $e[0] == 0 && $e[1] == 0 && $e[2] == 0 ? $ = 1 : $e[0] == 0 && $e[1] == 0 && $e[3] == 0 ? $ = 0 : $e[0] == 0 && $e[2] == 0 && $e[3] == 0 ? $ = 3 : $e[1] == 0 && $e[2] == 0 && $e[3] == 0 && ($ = 2);
18202 else if (lt == 2 && rt == 0) {
18203 var pt = Math.floor(Math.random() * 2);
18204 $e[0] == 0 && $e[1] == 0 ? pt == 0 ? $ = 0 : $ = 1 : $e[0] == 0 && $e[2] == 0 ? pt == 0 ? $ = 0 : $ = 2 : $e[0] == 0 && $e[3] == 0 ? pt == 0 ? $ = 0 : $ = 3 : $e[1] == 0 && $e[2] == 0 ? pt == 0 ? $ = 1 : $ = 2 : $e[1] == 0 && $e[3] == 0 ? pt == 0 ? $ = 1 : $ = 3 : pt == 0 ? $ = 2 : $ = 3;
18205 } else if (lt == 4 && rt == 0) {
18206 var pt = Math.floor(Math.random() * 4);
18207 $ = pt;
18208 } else
18209 $ = nt;
18210 $ == 0 ? q.setCenter(k.getCenterX(), k.getCenterY() - k.getHeight() / 2 - K.DEFAULT_EDGE_LENGTH - q.getHeight() / 2) : $ == 1 ? q.setCenter(k.getCenterX() + k.getWidth() / 2 + K.DEFAULT_EDGE_LENGTH + q.getWidth() / 2, k.getCenterY()) : $ == 2 ? q.setCenter(k.getCenterX(), k.getCenterY() + k.getHeight() / 2 + K.DEFAULT_EDGE_LENGTH + q.getHeight() / 2) : q.setCenter(k.getCenterX() - k.getWidth() / 2 - K.DEFAULT_EDGE_LENGTH - q.getWidth() / 2, k.getCenterY());
18211 }, ve.exports = Y;
18212 },
18213 /* 7 */
18214 /***/
18215 function(ve, H, O) {
18216 var T = {};
18217 T.layoutBase = O(0), T.CoSEConstants = O(1), T.CoSEEdge = O(2), T.CoSEGraph = O(3), T.CoSEGraphManager = O(4), T.CoSELayout = O(6), T.CoSENode = O(5), ve.exports = T;
18218 }
18219 /******/
18220 ])
18221 );
18222 });
18223 }(Wp)), ti;
18224}
18225(function(he, fe) {
18226 (function(ve, H) {
18227 he.exports = H(Qp());
18228 })(Ca, function(ee) {
18229 return (
18230 /******/
18231 function(ve) {
18232 var H = {};
18233 function O(T) {
18234 if (H[T])
18235 return H[T].exports;
18236 var x = H[T] = {
18237 /******/
18238 i: T,
18239 /******/
18240 l: !1,
18241 /******/
18242 exports: {}
18243 /******/
18244 };
18245 return ve[T].call(x.exports, x, x.exports, O), x.l = !0, x.exports;
18246 }
18247 return O.m = ve, O.c = H, O.i = function(T) {
18248 return T;
18249 }, O.d = function(T, x, S) {
18250 O.o(T, x) || Object.defineProperty(T, x, {
18251 /******/
18252 configurable: !1,
18253 /******/
18254 enumerable: !0,
18255 /******/
18256 get: S
18257 /******/
18258 });
18259 }, O.n = function(T) {
18260 var x = T && T.__esModule ? (
18261 /******/
18262 function() {
18263 return T.default;
18264 }
18265 ) : (
18266 /******/
18267 function() {
18268 return T;
18269 }
18270 );
18271 return O.d(x, "a", x), x;
18272 }, O.o = function(T, x) {
18273 return Object.prototype.hasOwnProperty.call(T, x);
18274 }, O.p = "", O(O.s = 1);
18275 }([
18276 /* 0 */
18277 /***/
18278 function(ve, H) {
18279 ve.exports = ee;
18280 },
18281 /* 1 */
18282 /***/
18283 function(ve, H, O) {
18284 var T = O(0).layoutBase.LayoutConstants, x = O(0).layoutBase.FDLayoutConstants, S = O(0).CoSEConstants, G = O(0).CoSELayout, U = O(0).CoSENode, P = O(0).layoutBase.PointD, K = O(0).layoutBase.DimensionD, D = {
18285 // Called on `layoutready`
18286 ready: function() {
18287 },
18288 // Called on `layoutstop`
18289 stop: function() {
18290 },
18291 // 'draft', 'default' or 'proof"
18292 // - 'draft' fast cooling rate
18293 // - 'default' moderate cooling rate
18294 // - "proof" slow cooling rate
18295 quality: "default",
18296 // include labels in node dimensions
18297 nodeDimensionsIncludeLabels: !1,
18298 // number of ticks per frame; higher is faster but more jerky
18299 refresh: 30,
18300 // Whether to fit the network view after when done
18301 fit: !0,
18302 // Padding on fit
18303 padding: 10,
18304 // Whether to enable incremental mode
18305 randomize: !0,
18306 // Node repulsion (non overlapping) multiplier
18307 nodeRepulsion: 4500,
18308 // Ideal edge (non nested) length
18309 idealEdgeLength: 50,
18310 // Divisor to compute edge forces
18311 edgeElasticity: 0.45,
18312 // Nesting factor (multiplier) to compute ideal edge length for nested edges
18313 nestingFactor: 0.1,
18314 // Gravity force (constant)
18315 gravity: 0.25,
18316 // Maximum number of iterations to perform
18317 numIter: 2500,
18318 // For enabling tiling
18319 tile: !0,
18320 // Type of layout animation. The option set is {'during', 'end', false}
18321 animate: "end",
18322 // Duration for animate:end
18323 animationDuration: 500,
18324 // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
18325 tilingPaddingVertical: 10,
18326 // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
18327 tilingPaddingHorizontal: 10,
18328 // Gravity range (constant) for compounds
18329 gravityRangeCompound: 1.5,
18330 // Gravity force (constant) for compounds
18331 gravityCompound: 1,
18332 // Gravity range (constant)
18333 gravityRange: 3.8,
18334 // Initial cooling factor for incremental layout
18335 initialEnergyOnIncremental: 0.5
18336 };
18337 function V(ue, J) {
18338 var j = {};
18339 for (var Y in ue)
18340 j[Y] = ue[Y];
18341 for (var Y in J)
18342 j[Y] = J[Y];
18343 return j;
18344 }
18345 function _(ue) {
18346 this.options = V(D, ue), Q(this.options);
18347 }
18348 var Q = function(J) {
18349 J.nodeRepulsion != null && (S.DEFAULT_REPULSION_STRENGTH = x.DEFAULT_REPULSION_STRENGTH = J.nodeRepulsion), J.idealEdgeLength != null && (S.DEFAULT_EDGE_LENGTH = x.DEFAULT_EDGE_LENGTH = J.idealEdgeLength), J.edgeElasticity != null && (S.DEFAULT_SPRING_STRENGTH = x.DEFAULT_SPRING_STRENGTH = J.edgeElasticity), J.nestingFactor != null && (S.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = x.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = J.nestingFactor), J.gravity != null && (S.DEFAULT_GRAVITY_STRENGTH = x.DEFAULT_GRAVITY_STRENGTH = J.gravity), J.numIter != null && (S.MAX_ITERATIONS = x.MAX_ITERATIONS = J.numIter), J.gravityRange != null && (S.DEFAULT_GRAVITY_RANGE_FACTOR = x.DEFAULT_GRAVITY_RANGE_FACTOR = J.gravityRange), J.gravityCompound != null && (S.DEFAULT_COMPOUND_GRAVITY_STRENGTH = x.DEFAULT_COMPOUND_GRAVITY_STRENGTH = J.gravityCompound), J.gravityRangeCompound != null && (S.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = x.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = J.gravityRangeCompound), J.initialEnergyOnIncremental != null && (S.DEFAULT_COOLING_FACTOR_INCREMENTAL = x.DEFAULT_COOLING_FACTOR_INCREMENTAL = J.initialEnergyOnIncremental), J.quality == "draft" ? T.QUALITY = 0 : J.quality == "proof" ? T.QUALITY = 2 : T.QUALITY = 1, S.NODE_DIMENSIONS_INCLUDE_LABELS = x.NODE_DIMENSIONS_INCLUDE_LABELS = T.NODE_DIMENSIONS_INCLUDE_LABELS = J.nodeDimensionsIncludeLabels, S.DEFAULT_INCREMENTAL = x.DEFAULT_INCREMENTAL = T.DEFAULT_INCREMENTAL = !J.randomize, S.ANIMATE = x.ANIMATE = T.ANIMATE = J.animate, S.TILE = J.tile, S.TILING_PADDING_VERTICAL = typeof J.tilingPaddingVertical == "function" ? J.tilingPaddingVertical.call() : J.tilingPaddingVertical, S.TILING_PADDING_HORIZONTAL = typeof J.tilingPaddingHorizontal == "function" ? J.tilingPaddingHorizontal.call() : J.tilingPaddingHorizontal;
18350 };
18351 _.prototype.run = function() {
18352 var ue, J, j = this.options;
18353 this.idToLNode = {};
18354 var Y = this.layout = new G(), te = this;
18355 te.stopped = !1, this.cy = this.options.cy, this.cy.trigger({ type: "layoutstart", layout: this });
18356 var L = Y.newGraphManager();
18357 this.gm = L;
18358 var $ = this.options.eles.nodes(), k = this.options.eles.edges();
18359 this.root = L.addRoot(), this.processChildrenList(this.root, this.getTopMostNodes($), Y);
18360 for (var q = 0; q < k.length; q++) {
18361 var ce = k[q], pe = this.idToLNode[ce.data("source")], Ae = this.idToLNode[ce.data("target")];
18362 if (pe !== Ae && pe.getEdgesBetween(Ae).length == 0) {
18363 var Ne = L.add(Y.newEdge(), pe, Ae);
18364 Ne.id = ce.id();
18365 }
18366 }
18367 var _e = function(Pe, $e) {
18368 typeof Pe == "number" && (Pe = $e);
18369 var Xe = Pe.data("id"), rt = te.idToLNode[Xe];
18370 return {
18371 x: rt.getRect().getCenterX(),
18372 y: rt.getRect().getCenterY()
18373 };
18374 }, tt = function ct() {
18375 for (var Pe = function() {
18376 j.fit && j.cy.fit(j.eles, j.padding), ue || (ue = !0, te.cy.one("layoutready", j.ready), te.cy.trigger({ type: "layoutready", layout: te }));
18377 }, $e = te.options.refresh, Xe, rt = 0; rt < $e && !Xe; rt++)
18378 Xe = te.stopped || te.layout.tick();
18379 if (Xe) {
18380 Y.checkLayoutSuccess() && !Y.isSubLayout && Y.doPostLayout(), Y.tilingPostLayout && Y.tilingPostLayout(), Y.isLayoutFinished = !0, te.options.eles.nodes().positions(_e), Pe(), te.cy.one("layoutstop", te.options.stop), te.cy.trigger({ type: "layoutstop", layout: te }), J && cancelAnimationFrame(J), ue = !1;
18381 return;
18382 }
18383 var lt = te.layout.getPositionsData();
18384 j.eles.nodes().positions(function(nt, je) {
18385 if (typeof nt == "number" && (nt = je), !nt.isParent()) {
18386 for (var pt = nt.id(), Et = lt[pt], kt = nt; Et == null && (Et = lt[kt.data("parent")] || lt["DummyCompound_" + kt.data("parent")], lt[pt] = Et, kt = kt.parent()[0], kt != null); )
18387 ;
18388 return Et != null ? {
18389 x: Et.x,
18390 y: Et.y
18391 } : {
18392 x: nt.position("x"),
18393 y: nt.position("y")
18394 };
18395 }
18396 }), Pe(), J = requestAnimationFrame(ct);
18397 };
18398 return Y.addListener("layoutstarted", function() {
18399 te.options.animate === "during" && (J = requestAnimationFrame(tt));
18400 }), Y.runLayout(), this.options.animate !== "during" && (te.options.eles.nodes().not(":parent").layoutPositions(te, te.options, _e), ue = !1), this;
18401 }, _.prototype.getTopMostNodes = function(ue) {
18402 for (var J = {}, j = 0; j < ue.length; j++)
18403 J[ue[j].id()] = !0;
18404 var Y = ue.filter(function(te, L) {
18405 typeof te == "number" && (te = L);
18406 for (var $ = te.parent()[0]; $ != null; ) {
18407 if (J[$.id()])
18408 return !1;
18409 $ = $.parent()[0];
18410 }
18411 return !0;
18412 });
18413 return Y;
18414 }, _.prototype.processChildrenList = function(ue, J, j) {
18415 for (var Y = J.length, te = 0; te < Y; te++) {
18416 var L = J[te], $ = L.children(), k, q = L.layoutDimensions({
18417 nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels
18418 });
18419 if (L.outerWidth() != null && L.outerHeight() != null ? k = ue.add(new U(j.graphManager, new P(L.position("x") - q.w / 2, L.position("y") - q.h / 2), new K(parseFloat(q.w), parseFloat(q.h)))) : k = ue.add(new U(this.graphManager)), k.id = L.data("id"), k.paddingLeft = parseInt(L.css("padding")), k.paddingTop = parseInt(L.css("padding")), k.paddingRight = parseInt(L.css("padding")), k.paddingBottom = parseInt(L.css("padding")), this.options.nodeDimensionsIncludeLabels && L.isParent()) {
18420 var ce = L.boundingBox({ includeLabels: !0, includeNodes: !1 }).w, pe = L.boundingBox({ includeLabels: !0, includeNodes: !1 }).h, Ae = L.css("text-halign");
18421 k.labelWidth = ce, k.labelHeight = pe, k.labelPos = Ae;
18422 }
18423 if (this.idToLNode[L.data("id")] = k, isNaN(k.rect.x) && (k.rect.x = 0), isNaN(k.rect.y) && (k.rect.y = 0), $ != null && $.length > 0) {
18424 var Ne;
18425 Ne = j.getGraphManager().add(j.newGraph(), k), this.processChildrenList(Ne, $, j);
18426 }
18427 }
18428 }, _.prototype.stop = function() {
18429 return this.stopped = !0, this;
18430 };
18431 var ne = function(J) {
18432 J("layout", "cose-bilkent", _);
18433 };
18434 typeof cytoscape < "u" && ne(cytoscape), ve.exports = ne;
18435 }
18436 /******/
18437 ])
18438 );
18439 });
18440})(qp);
18441const Jp = /* @__PURE__ */ Tp(Qi);
18442Wu.use(Jp);
18443function Ku(he, fe, ee, ve) {
18444 qu.drawNode(he, fe, ee, ve), fe.children && fe.children.forEach((H, O) => {
18445 Ku(he, H, ee < 0 ? O : ee, ve);
18446 });
18447}
18448function jp(he, fe) {
18449 fe.edges().map((ee, ve) => {
18450 const H = ee.data();
18451 if (ee[0]._private.bodyBounds) {
18452 const O = ee[0]._private.rscratch;
18453 qr.trace("Edge: ", ve, H), he.insert("path").attr(
18454 "d",
18455 `M ${O.startX},${O.startY} L ${O.midX},${O.midY} L${O.endX},${O.endY} `
18456 ).attr("class", "edge section-edge-" + H.section + " edge-depth-" + H.depth);
18457 }
18458 });
18459}
18460function Zu(he, fe, ee, ve) {
18461 fe.add({
18462 group: "nodes",
18463 data: {
18464 id: he.id,
18465 labelText: he.descr,
18466 height: he.height,
18467 width: he.width,
18468 level: ve,
18469 nodeId: he.id,
18470 padding: he.padding,
18471 type: he.type
18472 },
18473 position: {
18474 x: he.x,
18475 y: he.y
18476 }
18477 }), he.children && he.children.forEach((H) => {
18478 Zu(H, fe, ee, ve + 1), fe.add({
18479 group: "edges",
18480 data: {
18481 id: `${he.id}_${H.id}`,
18482 source: he.id,
18483 target: H.id,
18484 depth: ve,
18485 section: H.section
18486 }
18487 });
18488 });
18489}
18490function ey(he, fe) {
18491 return new Promise((ee) => {
18492 const ve = ei("body").append("div").attr("id", "cy").attr("style", "display:none"), H = Wu({
18493 container: document.getElementById("cy"),
18494 // container to render in
18495 style: [
18496 {
18497 selector: "edge",
18498 style: {
18499 "curve-style": "bezier"
18500 }
18501 }
18502 ]
18503 });
18504 ve.remove(), Zu(he, H, fe, 0), H.nodes().forEach(function(O) {
18505 O.layoutDimensions = () => {
18506 const T = O.data();
18507 return { w: T.width, h: T.height };
18508 };
18509 }), H.layout({
18510 name: "cose-bilkent",
18511 quality: "proof",
18512 // headless: true,
18513 styleEnabled: !1,
18514 animate: !1
18515 }).run(), H.ready((O) => {
18516 qr.info("Ready", O), ee(H);
18517 });
18518 });
18519}
18520function ty(he) {
18521 he.nodes().map((fe, ee) => {
18522 const ve = fe.data();
18523 ve.x = fe.position().x, ve.y = fe.position().y, qu.positionNode(ve);
18524 const H = ji(ve.nodeId);
18525 qr.info("Id:", ee, "Position: (", fe.position().x, ", ", fe.position().y, ")", ve), H.attr(
18526 "transform",
18527 `translate(${fe.position().x - ve.width / 2}, ${fe.position().y - ve.height / 2})`
18528 ), H.attr("attr", `apa-${ee})`);
18529 });
18530}
18531const ry = async (he, fe, ee, ve) => {
18532 const H = nn();
18533 H.htmlLabels = !1, ve.db.clear(), ve.parser.parse(he), qr.debug(`Rendering mindmap diagram
18534` + he, ve.parser);
18535 const O = nn().securityLevel;
18536 let T;
18537 O === "sandbox" && (T = ei("#i" + fe));
18538 const S = (O === "sandbox" ? ei(T.nodes()[0].contentDocument.body) : ei("body")).select("#" + fe);
18539 S.append("g");
18540 const G = ve.db.getMindmap(), U = S.append("g");
18541 U.attr("class", "mindmap-edges");
18542 const P = S.append("g");
18543 P.attr("class", "mindmap-nodes"), Ku(P, G, -1, H);
18544 const K = await ey(G, H);
18545 jp(U, K), ty(K), mp(void 0, S, H.mindmap.padding, H.mindmap.useMaxWidth);
18546}, ay = {
18547 draw: ry
18548}, ny = (he) => {
18549 let fe = "";
18550 for (let ee = 0; ee < he.THEME_COLOR_LIMIT; ee++)
18551 he["lineColor" + ee] = he["lineColor" + ee] || he["cScaleInv" + ee], bp(he["lineColor" + ee]) ? he["lineColor" + ee] = Ep(he["lineColor" + ee], 20) : he["lineColor" + ee] = wp(he["lineColor" + ee], 20);
18552 for (let ee = 0; ee < he.THEME_COLOR_LIMIT; ee++) {
18553 const ve = "" + (17 - 3 * ee);
18554 fe += `
18555 .section-${ee - 1} rect, .section-${ee - 1} path, .section-${ee - 1} circle, .section-${ee - 1} polygon, .section-${ee - 1} path {
18556 fill: ${he["cScale" + ee]};
18557 }
18558 .section-${ee - 1} text {
18559 fill: ${he["cScaleLabel" + ee]};
18560 }
18561 .node-icon-${ee - 1} {
18562 font-size: 40px;
18563 color: ${he["cScaleLabel" + ee]};
18564 }
18565 .section-edge-${ee - 1}{
18566 stroke: ${he["cScale" + ee]};
18567 }
18568 .edge-depth-${ee - 1}{
18569 stroke-width: ${ve};
18570 }
18571 .section-${ee - 1} line {
18572 stroke: ${he["cScaleInv" + ee]} ;
18573 stroke-width: 3;
18574 }
18575
18576 .disabled, .disabled circle, .disabled text {
18577 fill: lightgray;
18578 }
18579 .disabled text {
18580 fill: #efefef;
18581 }
18582 `;
18583 }
18584 return fe;
18585}, iy = (he) => `
18586 .edge {
18587 stroke-width: 3;
18588 }
18589 ${ny(he)}
18590 .section-root rect, .section-root path, .section-root circle, .section-root polygon {
18591 fill: ${he.git0};
18592 }
18593 .section-root text {
18594 fill: ${he.gitBranchLabel0};
18595 }
18596 .icon-container {
18597 height:100%;
18598 display: flex;
18599 justify-content: center;
18600 align-items: center;
18601 }
18602 .edge {
18603 fill: none;
18604 }
18605 .mindmap-node-label {
18606 dy: 1em;
18607 alignment-baseline: middle;
18608 text-anchor: middle;
18609 dominant-baseline: middle;
18610 text-align: center;
18611 }
18612`, sy = iy, fy = {
18613 db: kp,
18614 renderer: ay,
18615 parser: Cp,
18616 styles: sy
18617};
18618export {
18619 fy as diagram
18620};