UNPKG

764 kBJavaScriptView Raw
1import { l as qr, c as Ji, W as ti, d as ri, P as Ca, Q as $l, Y as pp, U as yp, t as mp, j as bp, at as Ep, au as wp, av as xp } from "./mermaid-9f2aa176.js";
2import { a as Tp } from "./createText-03b82060.js";
3var Qi = function() {
4 var de = function(ee, H, te, S) {
5 for (te = te || {}, S = ee.length; S--; te[ee[S]] = H)
6 ;
7 return te;
8 }, Pe = [1, 4], _ = [1, 13], fe = [1, 12], Q = [1, 15], C = [1, 16], T = [1, 20], x = [1, 19], I = [6, 7, 8], z = [1, 26], Y = [1, 24], P = [1, 25], Z = [6, 7, 11], A = [1, 6, 13, 15, 16, 19, 22], $ = [1, 33], U = [1, 34], J = [1, 6, 7, 11, 13, 15, 16, 19, 22], ne = {
9 trace: function() {
10 },
11 yy: {},
12 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 },
13 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" },
14 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]],
15 performAction: function(H, te, S, V, R, q, ve) {
16 var pe = q.length - 1;
17 switch (R) {
18 case 6:
19 case 7:
20 return V;
21 case 8:
22 V.getLogger().trace("Stop NL ");
23 break;
24 case 9:
25 V.getLogger().trace("Stop EOF ");
26 break;
27 case 11:
28 V.getLogger().trace("Stop NL2 ");
29 break;
30 case 12:
31 V.getLogger().trace("Stop EOF2 ");
32 break;
33 case 15:
34 V.getLogger().info("Node: ", q[pe].id), V.addNode(q[pe - 1].length, q[pe].id, q[pe].descr, q[pe].type);
35 break;
36 case 16:
37 V.getLogger().trace("Icon: ", q[pe]), V.decorateNode({ icon: q[pe] });
38 break;
39 case 17:
40 case 21:
41 V.decorateNode({ class: q[pe] });
42 break;
43 case 18:
44 V.getLogger().trace("SPACELIST");
45 break;
46 case 19:
47 V.getLogger().trace("Node: ", q[pe].id), V.addNode(0, q[pe].id, q[pe].descr, q[pe].type);
48 break;
49 case 20:
50 V.decorateNode({ icon: q[pe] });
51 break;
52 case 25:
53 V.getLogger().trace("node found ..", q[pe - 2]), this.$ = { id: q[pe - 1], descr: q[pe - 1], type: V.getType(q[pe - 2], q[pe]) };
54 break;
55 case 26:
56 this.$ = { id: q[pe], descr: q[pe], type: V.nodeType.DEFAULT };
57 break;
58 case 27:
59 V.getLogger().trace("node found ..", q[pe - 3]), this.$ = { id: q[pe - 3], descr: q[pe - 1], type: V.getType(q[pe - 2], q[pe]) };
60 break;
61 }
62 },
63 table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: Pe }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: Pe }, { 6: _, 7: [1, 10], 9: 9, 12: 11, 13: fe, 14: 14, 15: Q, 16: C, 17: 17, 18: 18, 19: T, 22: x }, de(I, [2, 3]), { 1: [2, 2] }, de(I, [2, 4]), de(I, [2, 5]), { 1: [2, 6], 6: _, 12: 21, 13: fe, 14: 14, 15: Q, 16: C, 17: 17, 18: 18, 19: T, 22: x }, { 6: _, 9: 22, 12: 11, 13: fe, 14: 14, 15: Q, 16: C, 17: 17, 18: 18, 19: T, 22: x }, { 6: z, 7: Y, 10: 23, 11: P }, de(Z, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: T, 22: x }), de(Z, [2, 18]), de(Z, [2, 19]), de(Z, [2, 20]), de(Z, [2, 21]), de(Z, [2, 23]), de(Z, [2, 24]), de(Z, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: z, 7: Y, 10: 32, 11: P }, { 1: [2, 7], 6: _, 12: 21, 13: fe, 14: 14, 15: Q, 16: C, 17: 17, 18: 18, 19: T, 22: x }, de(A, [2, 14], { 7: $, 11: U }), de(J, [2, 8]), de(J, [2, 9]), de(J, [2, 10]), de(Z, [2, 15]), de(Z, [2, 16]), de(Z, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, de(A, [2, 13], { 7: $, 11: U }), de(J, [2, 11]), de(J, [2, 12]), { 21: [1, 37] }, de(Z, [2, 25]), de(Z, [2, 27])],
64 defaultActions: { 2: [2, 1], 6: [2, 2] },
65 parseError: function(H, te) {
66 if (te.recoverable)
67 this.trace(H);
68 else {
69 var S = new Error(H);
70 throw S.hash = te, S;
71 }
72 },
73 parse: function(H) {
74 var te = this, S = [0], V = [], R = [null], q = [], ve = this.table, pe = "", Ae = 0, Ne = 0, Ye = 2, at = 1, dt = q.slice.call(arguments, 1), Re = Object.create(this.lexer), Ve = { yy: {} };
75 for (var Ze in this.yy)
76 Object.prototype.hasOwnProperty.call(this.yy, Ze) && (Ve.yy[Ze] = this.yy[Ze]);
77 Re.setInput(H, Ve.yy), Ve.yy.lexer = Re, Ve.yy.parser = this, typeof Re.yylloc > "u" && (Re.yylloc = {});
78 var nt = Re.yylloc;
79 q.push(nt);
80 var ht = Re.options && Re.options.ranges;
81 typeof Ve.yy.parseError == "function" ? this.parseError = Ve.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
82 function it() {
83 var jt;
84 return jt = V.pop() || Re.lex() || at, typeof jt != "number" && (jt instanceof Array && (V = jt, jt = V.pop()), jt = te.symbols_[jt] || jt), jt;
85 }
86 for (var tt, yt, Et, Pt, gt = {}, dr, qt, nn, Kr; ; ) {
87 if (yt = S[S.length - 1], this.defaultActions[yt] ? Et = this.defaultActions[yt] : ((tt === null || typeof tt > "u") && (tt = it()), Et = ve[yt] && ve[yt][tt]), typeof Et > "u" || !Et.length || !Et[0]) {
88 var Da = "";
89 Kr = [];
90 for (dr in ve[yt])
91 this.terminals_[dr] && dr > Ye && Kr.push("'" + this.terminals_[dr] + "'");
92 Re.showPosition ? Da = "Parse error on line " + (Ae + 1) + `:
93` + Re.showPosition() + `
94Expecting ` + Kr.join(", ") + ", got '" + (this.terminals_[tt] || tt) + "'" : Da = "Parse error on line " + (Ae + 1) + ": Unexpected " + (tt == at ? "end of input" : "'" + (this.terminals_[tt] || tt) + "'"), this.parseError(Da, {
95 text: Re.match,
96 token: this.terminals_[tt] || tt,
97 line: Re.yylineno,
98 loc: nt,
99 expected: Kr
100 });
101 }
102 if (Et[0] instanceof Array && Et.length > 1)
103 throw new Error("Parse Error: multiple actions possible at state: " + yt + ", token: " + tt);
104 switch (Et[0]) {
105 case 1:
106 S.push(tt), R.push(Re.yytext), q.push(Re.yylloc), S.push(Et[1]), tt = null, Ne = Re.yyleng, pe = Re.yytext, Ae = Re.yylineno, nt = Re.yylloc;
107 break;
108 case 2:
109 if (qt = this.productions_[Et[1]][1], gt.$ = R[R.length - qt], gt._$ = {
110 first_line: q[q.length - (qt || 1)].first_line,
111 last_line: q[q.length - 1].last_line,
112 first_column: q[q.length - (qt || 1)].first_column,
113 last_column: q[q.length - 1].last_column
114 }, ht && (gt._$.range = [
115 q[q.length - (qt || 1)].range[0],
116 q[q.length - 1].range[1]
117 ]), Pt = this.performAction.apply(gt, [
118 pe,
119 Ne,
120 Ae,
121 Ve.yy,
122 Et[1],
123 R,
124 q
125 ].concat(dt)), typeof Pt < "u")
126 return Pt;
127 qt && (S = S.slice(0, -1 * qt * 2), R = R.slice(0, -1 * qt), q = q.slice(0, -1 * qt)), S.push(this.productions_[Et[1]][0]), R.push(gt.$), q.push(gt._$), nn = ve[S[S.length - 2]][S[S.length - 1]], S.push(nn);
128 break;
129 case 3:
130 return !0;
131 }
132 }
133 return !0;
134 }
135 }, le = function() {
136 var ee = {
137 EOF: 1,
138 parseError: function(te, S) {
139 if (this.yy.parser)
140 this.yy.parser.parseError(te, S);
141 else
142 throw new Error(te);
143 },
144 // resets the lexer, sets new input
145 setInput: function(H, te) {
146 return this.yy = te || this.yy || {}, this._input = H, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
147 first_line: 1,
148 first_column: 0,
149 last_line: 1,
150 last_column: 0
151 }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
152 },
153 // consumes and returns one char from the input
154 input: function() {
155 var H = this._input[0];
156 this.yytext += H, this.yyleng++, this.offset++, this.match += H, this.matched += H;
157 var te = H.match(/(?:\r\n?|\n).*/g);
158 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), H;
159 },
160 // unshifts one char (or a string) into the input
161 unput: function(H) {
162 var te = H.length, S = H.split(/(?:\r\n?|\n)/g);
163 this._input = H + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - te), this.offset -= te;
164 var V = this.match.split(/(?:\r\n?|\n)/g);
165 this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), S.length - 1 && (this.yylineno -= S.length - 1);
166 var R = this.yylloc.range;
167 return this.yylloc = {
168 first_line: this.yylloc.first_line,
169 last_line: this.yylineno + 1,
170 first_column: this.yylloc.first_column,
171 last_column: S ? (S.length === V.length ? this.yylloc.first_column : 0) + V[V.length - S.length].length - S[0].length : this.yylloc.first_column - te
172 }, this.options.ranges && (this.yylloc.range = [R[0], R[0] + this.yyleng - te]), this.yyleng = this.yytext.length, this;
173 },
174 // When called from action, caches matched text and appends it on next action
175 more: function() {
176 return this._more = !0, this;
177 },
178 // 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.
179 reject: function() {
180 if (this.options.backtrack_lexer)
181 this._backtrack = !0;
182 else
183 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).
184` + this.showPosition(), {
185 text: "",
186 token: null,
187 line: this.yylineno
188 });
189 return this;
190 },
191 // retain first n characters of the match
192 less: function(H) {
193 this.unput(this.match.slice(H));
194 },
195 // displays already matched input, i.e. for error messages
196 pastInput: function() {
197 var H = this.matched.substr(0, this.matched.length - this.match.length);
198 return (H.length > 20 ? "..." : "") + H.substr(-20).replace(/\n/g, "");
199 },
200 // displays upcoming input, i.e. for error messages
201 upcomingInput: function() {
202 var H = this.match;
203 return H.length < 20 && (H += this._input.substr(0, 20 - H.length)), (H.substr(0, 20) + (H.length > 20 ? "..." : "")).replace(/\n/g, "");
204 },
205 // displays the character position where the lexing error occurred, i.e. for error messages
206 showPosition: function() {
207 var H = this.pastInput(), te = new Array(H.length + 1).join("-");
208 return H + this.upcomingInput() + `
209` + te + "^";
210 },
211 // test the lexed token: return FALSE when not a match, otherwise return token
212 test_match: function(H, te) {
213 var S, V, R;
214 if (this.options.backtrack_lexer && (R = {
215 yylineno: this.yylineno,
216 yylloc: {
217 first_line: this.yylloc.first_line,
218 last_line: this.last_line,
219 first_column: this.yylloc.first_column,
220 last_column: this.yylloc.last_column
221 },
222 yytext: this.yytext,
223 match: this.match,
224 matches: this.matches,
225 matched: this.matched,
226 yyleng: this.yyleng,
227 offset: this.offset,
228 _more: this._more,
229 _input: this._input,
230 yy: this.yy,
231 conditionStack: this.conditionStack.slice(0),
232 done: this.done
233 }, this.options.ranges && (R.yylloc.range = this.yylloc.range.slice(0))), V = H[0].match(/(?:\r\n?|\n).*/g), V && (this.yylineno += V.length), this.yylloc = {
234 first_line: this.yylloc.last_line,
235 last_line: this.yylineno + 1,
236 first_column: this.yylloc.last_column,
237 last_column: V ? V[V.length - 1].length - V[V.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + H[0].length
238 }, this.yytext += H[0], this.match += H[0], this.matches = H, 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(H[0].length), this.matched += H[0], S = this.performAction.call(this, this.yy, this, te, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), S)
239 return S;
240 if (this._backtrack) {
241 for (var q in R)
242 this[q] = R[q];
243 return !1;
244 }
245 return !1;
246 },
247 // return next match in input
248 next: function() {
249 if (this.done)
250 return this.EOF;
251 this._input || (this.done = !0);
252 var H, te, S, V;
253 this._more || (this.yytext = "", this.match = "");
254 for (var R = this._currentRules(), q = 0; q < R.length; q++)
255 if (S = this._input.match(this.rules[R[q]]), S && (!te || S[0].length > te[0].length)) {
256 if (te = S, V = q, this.options.backtrack_lexer) {
257 if (H = this.test_match(S, R[q]), H !== !1)
258 return H;
259 if (this._backtrack) {
260 te = !1;
261 continue;
262 } else
263 return !1;
264 } else if (!this.options.flex)
265 break;
266 }
267 return te ? (H = this.test_match(te, R[V]), H !== !1 ? H : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
268` + this.showPosition(), {
269 text: "",
270 token: null,
271 line: this.yylineno
272 });
273 },
274 // return next match that has a token
275 lex: function() {
276 var te = this.next();
277 return te || this.lex();
278 },
279 // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
280 begin: function(te) {
281 this.conditionStack.push(te);
282 },
283 // pop the previously active lexer condition state off the condition stack
284 popState: function() {
285 var te = this.conditionStack.length - 1;
286 return te > 0 ? this.conditionStack.pop() : this.conditionStack[0];
287 },
288 // produce the lexer rule set which is active for the currently active lexer condition state
289 _currentRules: function() {
290 return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
291 },
292 // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
293 topState: function(te) {
294 return te = this.conditionStack.length - 1 - Math.abs(te || 0), te >= 0 ? this.conditionStack[te] : "INITIAL";
295 },
296 // alias for begin(condition)
297 pushState: function(te) {
298 this.begin(te);
299 },
300 // return the number of states currently on the stack
301 stateStackSize: function() {
302 return this.conditionStack.length;
303 },
304 options: { "case-insensitive": !0 },
305 performAction: function(te, S, V, R) {
306 switch (V) {
307 case 0:
308 return te.getLogger().trace("Found comment", S.yytext), 6;
309 case 1:
310 return 8;
311 case 2:
312 this.begin("CLASS");
313 break;
314 case 3:
315 return this.popState(), 16;
316 case 4:
317 this.popState();
318 break;
319 case 5:
320 te.getLogger().trace("Begin icon"), this.begin("ICON");
321 break;
322 case 6:
323 return te.getLogger().trace("SPACELINE"), 6;
324 case 7:
325 return 7;
326 case 8:
327 return 15;
328 case 9:
329 te.getLogger().trace("end icon"), this.popState();
330 break;
331 case 10:
332 return te.getLogger().trace("Exploding node"), this.begin("NODE"), 19;
333 case 11:
334 return te.getLogger().trace("Cloud"), this.begin("NODE"), 19;
335 case 12:
336 return te.getLogger().trace("Explosion Bang"), this.begin("NODE"), 19;
337 case 13:
338 return te.getLogger().trace("Cloud Bang"), this.begin("NODE"), 19;
339 case 14:
340 return this.begin("NODE"), 19;
341 case 15:
342 return this.begin("NODE"), 19;
343 case 16:
344 return this.begin("NODE"), 19;
345 case 17:
346 return this.begin("NODE"), 19;
347 case 18:
348 return 13;
349 case 19:
350 return 22;
351 case 20:
352 return 11;
353 case 21:
354 this.begin("NSTR2");
355 break;
356 case 22:
357 return "NODE_DESCR";
358 case 23:
359 this.popState();
360 break;
361 case 24:
362 te.getLogger().trace("Starting NSTR"), this.begin("NSTR");
363 break;
364 case 25:
365 return te.getLogger().trace("description:", S.yytext), "NODE_DESCR";
366 case 26:
367 this.popState();
368 break;
369 case 27:
370 return this.popState(), te.getLogger().trace("node end ))"), "NODE_DEND";
371 case 28:
372 return this.popState(), te.getLogger().trace("node end )"), "NODE_DEND";
373 case 29:
374 return this.popState(), te.getLogger().trace("node end ...", S.yytext), "NODE_DEND";
375 case 30:
376 return this.popState(), te.getLogger().trace("node end (("), "NODE_DEND";
377 case 31:
378 return this.popState(), te.getLogger().trace("node end (-"), "NODE_DEND";
379 case 32:
380 return this.popState(), te.getLogger().trace("node end (-"), "NODE_DEND";
381 case 33:
382 return this.popState(), te.getLogger().trace("node end (("), "NODE_DEND";
383 case 34:
384 return this.popState(), te.getLogger().trace("node end (("), "NODE_DEND";
385 case 35:
386 return te.getLogger().trace("Long description:", S.yytext), 20;
387 case 36:
388 return te.getLogger().trace("Long description:", S.yytext), 20;
389 }
390 },
391 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],
392 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 } }
393 };
394 return ee;
395 }();
396 ne.lexer = le;
397 function j() {
398 this.yy = {};
399 }
400 return j.prototype = ne, ne.Parser = j, new j();
401}();
402Qi.parser = Qi;
403const Cp = Qi;
404let or = [], _l = 0, ji = {};
405const Dp = () => {
406 or = [], _l = 0, ji = {};
407}, Sp = function(de) {
408 for (let Pe = or.length - 1; Pe >= 0; Pe--)
409 if (or[Pe].level < de)
410 return or[Pe];
411 return null;
412}, Lp = () => or.length > 0 ? or[0] : null, Ap = (de, Pe, _, fe) => {
413 var I, z;
414 qr.info("addNode", de, Pe, _, fe);
415 const Q = Ji();
416 let C = ((I = Q.mindmap) == null ? void 0 : I.padding) ?? ti.mindmap.padding;
417 switch (fe) {
418 case St.ROUNDED_RECT:
419 case St.RECT:
420 case St.HEXAGON:
421 C *= 2;
422 }
423 const T = {
424 id: _l++,
425 nodeId: ri(Pe, Q),
426 level: de,
427 descr: ri(_, Q),
428 type: fe,
429 children: [],
430 width: ((z = Q.mindmap) == null ? void 0 : z.maxNodeWidth) ?? ti.mindmap.maxNodeWidth,
431 padding: C
432 }, x = Sp(de);
433 if (x)
434 x.children.push(T), or.push(T);
435 else if (or.length === 0)
436 or.push(T);
437 else
438 throw new Error(
439 'There can be only one root. No parent could be found for ("' + T.descr + '")'
440 );
441}, St = {
442 DEFAULT: 0,
443 NO_BORDER: 0,
444 ROUNDED_RECT: 1,
445 RECT: 2,
446 CIRCLE: 3,
447 CLOUD: 4,
448 BANG: 5,
449 HEXAGON: 6
450}, Op = (de, Pe) => {
451 switch (qr.debug("In get type", de, Pe), de) {
452 case "[":
453 return St.RECT;
454 case "(":
455 return Pe === ")" ? St.ROUNDED_RECT : St.CLOUD;
456 case "((":
457 return St.CIRCLE;
458 case ")":
459 return St.CLOUD;
460 case "))":
461 return St.BANG;
462 case "{{":
463 return St.HEXAGON;
464 default:
465 return St.DEFAULT;
466 }
467}, Np = (de, Pe) => {
468 ji[de] = Pe;
469}, Ip = (de) => {
470 if (!de)
471 return;
472 const Pe = Ji(), _ = or[or.length - 1];
473 de.icon && (_.icon = ri(de.icon, Pe)), de.class && (_.class = ri(de.class, Pe));
474}, Mp = (de) => {
475 switch (de) {
476 case St.DEFAULT:
477 return "no-border";
478 case St.RECT:
479 return "rect";
480 case St.ROUNDED_RECT:
481 return "rounded-rect";
482 case St.CIRCLE:
483 return "circle";
484 case St.CLOUD:
485 return "cloud";
486 case St.BANG:
487 return "bang";
488 case St.HEXAGON:
489 return "hexgon";
490 default:
491 return "no-border";
492 }
493}, Rp = () => qr, kp = (de) => ji[de], Pp = {
494 clear: Dp,
495 addNode: Ap,
496 getMindmap: Lp,
497 nodeType: St,
498 getType: Op,
499 setElementForId: Np,
500 decorateNode: Ip,
501 type2Str: Mp,
502 getLogger: Rp,
503 getElementById: kp
504}, Bp = Pp;
505var Yl = { exports: {} };
506(function(de, Pe) {
507 (function(_, fe) {
508 de.exports = fe();
509 })(Ca, function() {
510 function _(t) {
511 "@babel/helpers - typeof";
512 return _ = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
513 return typeof e;
514 } : function(e) {
515 return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
516 }, _(t);
517 }
518 function fe(t, e) {
519 if (!(t instanceof e))
520 throw new TypeError("Cannot call a class as a function");
521 }
522 function Q(t, e) {
523 for (var r = 0; r < e.length; r++) {
524 var a = e[r];
525 a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(t, a.key, a);
526 }
527 }
528 function C(t, e, r) {
529 return e && Q(t.prototype, e), r && Q(t, r), Object.defineProperty(t, "prototype", {
530 writable: !1
531 }), t;
532 }
533 function T(t, e, r) {
534 return e in t ? Object.defineProperty(t, e, {
535 value: r,
536 enumerable: !0,
537 configurable: !0,
538 writable: !0
539 }) : t[e] = r, t;
540 }
541 function x(t, e) {
542 return I(t) || z(t, e) || Y(t, e) || Z();
543 }
544 function I(t) {
545 if (Array.isArray(t))
546 return t;
547 }
548 function z(t, e) {
549 var r = t == null ? null : typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
550 if (r != null) {
551 var a = [], n = !0, i = !1, s, o;
552 try {
553 for (r = r.call(t); !(n = (s = r.next()).done) && (a.push(s.value), !(e && a.length === e)); n = !0)
554 ;
555 } catch (u) {
556 i = !0, o = u;
557 } finally {
558 try {
559 !n && r.return != null && r.return();
560 } finally {
561 if (i)
562 throw o;
563 }
564 }
565 return a;
566 }
567 }
568 function Y(t, e) {
569 if (t) {
570 if (typeof t == "string")
571 return P(t, e);
572 var r = Object.prototype.toString.call(t).slice(8, -1);
573 if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set")
574 return Array.from(t);
575 if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
576 return P(t, e);
577 }
578 }
579 function P(t, e) {
580 (e == null || e > t.length) && (e = t.length);
581 for (var r = 0, a = new Array(e); r < e; r++)
582 a[r] = t[r];
583 return a;
584 }
585 function Z() {
586 throw new TypeError(`Invalid attempt to destructure non-iterable instance.
587In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
588 }
589 var A = typeof window > "u" ? null : window, $ = A ? A.navigator : null;
590 A && A.document;
591 var U = _(""), J = _({}), ne = _(function() {
592 }), le = typeof HTMLElement > "u" ? "undefined" : _(HTMLElement), j = function(e) {
593 return e && e.instanceString && H(e.instanceString) ? e.instanceString() : null;
594 }, ee = function(e) {
595 return e != null && _(e) == U;
596 }, H = function(e) {
597 return e != null && _(e) === ne;
598 }, te = function(e) {
599 return !pe(e) && (Array.isArray ? Array.isArray(e) : e != null && e instanceof Array);
600 }, S = function(e) {
601 return e != null && _(e) === J && !te(e) && e.constructor === Object;
602 }, V = function(e) {
603 return e != null && _(e) === J;
604 }, R = function(e) {
605 return e != null && _(e) === _(1) && !isNaN(e);
606 }, q = function(e) {
607 return R(e) && Math.floor(e) === e;
608 }, ve = function(e) {
609 if (le !== "undefined")
610 return e != null && e instanceof HTMLElement;
611 }, pe = function(e) {
612 return Ae(e) || Ne(e);
613 }, Ae = function(e) {
614 return j(e) === "collection" && e._private.single;
615 }, Ne = function(e) {
616 return j(e) === "collection" && !e._private.single;
617 }, Ye = function(e) {
618 return j(e) === "core";
619 }, at = function(e) {
620 return j(e) === "stylesheet";
621 }, dt = function(e) {
622 return j(e) === "event";
623 }, Re = function(e) {
624 return e == null ? !0 : !!(e === "" || e.match(/^\s+$/));
625 }, Ve = function(e) {
626 return typeof HTMLElement > "u" ? !1 : e instanceof HTMLElement;
627 }, Ze = function(e) {
628 return S(e) && R(e.x1) && R(e.x2) && R(e.y1) && R(e.y2);
629 }, nt = function(e) {
630 return V(e) && H(e.then);
631 }, ht = function() {
632 return $ && $.userAgent.match(/msie|trident|edge/i);
633 }, it = function(e, r) {
634 r || (r = function() {
635 if (arguments.length === 1)
636 return arguments[0];
637 if (arguments.length === 0)
638 return "undefined";
639 for (var i = [], s = 0; s < arguments.length; s++)
640 i.push(arguments[s]);
641 return i.join("$");
642 });
643 var a = function n() {
644 var i = this, s = arguments, o, u = r.apply(i, s), l = n.cache;
645 return (o = l[u]) || (o = l[u] = e.apply(i, s)), o;
646 };
647 return a.cache = {}, a;
648 }, tt = it(function(t) {
649 return t.replace(/([A-Z])/g, function(e) {
650 return "-" + e.toLowerCase();
651 });
652 }), yt = it(function(t) {
653 return t.replace(/(-\w)/g, function(e) {
654 return e[1].toUpperCase();
655 });
656 }), Et = it(function(t, e) {
657 return t + e[0].toUpperCase() + e.substring(1);
658 }, function(t, e) {
659 return t + "$" + e;
660 }), Pt = function(e) {
661 return Re(e) ? e : e.charAt(0).toUpperCase() + e.substring(1);
662 }, gt = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))", dr = "rgb[a]?\\((" + gt + "[%]?)\\s*,\\s*(" + gt + "[%]?)\\s*,\\s*(" + gt + "[%]?)(?:\\s*,\\s*(" + gt + "))?\\)", qt = "rgb[a]?\\((?:" + gt + "[%]?)\\s*,\\s*(?:" + gt + "[%]?)\\s*,\\s*(?:" + gt + "[%]?)(?:\\s*,\\s*(?:" + gt + "))?\\)", nn = "hsl[a]?\\((" + gt + ")\\s*,\\s*(" + gt + "[%])\\s*,\\s*(" + gt + "[%])(?:\\s*,\\s*(" + gt + "))?\\)", Kr = "hsl[a]?\\((?:" + gt + ")\\s*,\\s*(?:" + gt + "[%])\\s*,\\s*(?:" + gt + "[%])(?:\\s*,\\s*(?:" + gt + "))?\\)", Da = "\\#[0-9a-fA-F]{3}", jt = "\\#[0-9a-fA-F]{6}", es = function(e, r) {
663 return e < r ? -1 : e > r ? 1 : 0;
664 }, Kl = function(e, r) {
665 return -1 * es(e, r);
666 }, He = Object.assign != null ? Object.assign.bind(Object) : function(t) {
667 for (var e = arguments, r = 1; r < e.length; r++) {
668 var a = e[r];
669 if (a != null)
670 for (var n = Object.keys(a), i = 0; i < n.length; i++) {
671 var s = n[i];
672 t[s] = a[s];
673 }
674 }
675 return t;
676 }, Zl = function(e) {
677 if (!(!(e.length === 4 || e.length === 7) || e[0] !== "#")) {
678 var r = e.length === 4, a, n, i, s = 16;
679 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];
680 }
681 }, Ql = function(e) {
682 var r, a, n, i, s, o, u, l;
683 function f(c, y, p) {
684 return p < 0 && (p += 1), p > 1 && (p -= 1), p < 1 / 6 ? c + (y - c) * 6 * p : p < 1 / 2 ? y : p < 2 / 3 ? c + (y - c) * (2 / 3 - p) * 6 : c;
685 }
686 var h = new RegExp("^" + nn + "$").exec(e);
687 if (h) {
688 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)))
689 return;
690 if (n === 0)
691 o = u = l = Math.round(i * 255);
692 else {
693 var v = i < 0.5 ? i * (1 + n) : i + n - i * n, d = 2 * i - v;
694 o = Math.round(255 * f(d, v, a + 1 / 3)), u = Math.round(255 * f(d, v, a)), l = Math.round(255 * f(d, v, a - 1 / 3));
695 }
696 r = [o, u, l, s];
697 }
698 return r;
699 }, Jl = function(e) {
700 var r, a = new RegExp("^" + dr + "$").exec(e);
701 if (a) {
702 r = [];
703 for (var n = [], i = 1; i <= 3; i++) {
704 var s = a[i];
705 if (s[s.length - 1] === "%" && (n[i] = !0), s = parseFloat(s), n[i] && (s = s / 100 * 255), s < 0 || s > 255)
706 return;
707 r.push(Math.floor(s));
708 }
709 var o = n[1] || n[2] || n[3], u = n[1] && n[2] && n[3];
710 if (o && !u)
711 return;
712 var l = a[4];
713 if (l !== void 0) {
714 if (l = parseFloat(l), l < 0 || l > 1)
715 return;
716 r.push(l);
717 }
718 }
719 return r;
720 }, jl = function(e) {
721 return tu[e.toLowerCase()];
722 }, eu = function(e) {
723 return (te(e) ? e : null) || jl(e) || Zl(e) || Jl(e) || Ql(e);
724 }, tu = {
725 // special colour names
726 transparent: [0, 0, 0, 0],
727 // NB alpha === 0
728 // regular colours
729 aliceblue: [240, 248, 255],
730 antiquewhite: [250, 235, 215],
731 aqua: [0, 255, 255],
732 aquamarine: [127, 255, 212],
733 azure: [240, 255, 255],
734 beige: [245, 245, 220],
735 bisque: [255, 228, 196],
736 black: [0, 0, 0],
737 blanchedalmond: [255, 235, 205],
738 blue: [0, 0, 255],
739 blueviolet: [138, 43, 226],
740 brown: [165, 42, 42],
741 burlywood: [222, 184, 135],
742 cadetblue: [95, 158, 160],
743 chartreuse: [127, 255, 0],
744 chocolate: [210, 105, 30],
745 coral: [255, 127, 80],
746 cornflowerblue: [100, 149, 237],
747 cornsilk: [255, 248, 220],
748 crimson: [220, 20, 60],
749 cyan: [0, 255, 255],
750 darkblue: [0, 0, 139],
751 darkcyan: [0, 139, 139],
752 darkgoldenrod: [184, 134, 11],
753 darkgray: [169, 169, 169],
754 darkgreen: [0, 100, 0],
755 darkgrey: [169, 169, 169],
756 darkkhaki: [189, 183, 107],
757 darkmagenta: [139, 0, 139],
758 darkolivegreen: [85, 107, 47],
759 darkorange: [255, 140, 0],
760 darkorchid: [153, 50, 204],
761 darkred: [139, 0, 0],
762 darksalmon: [233, 150, 122],
763 darkseagreen: [143, 188, 143],
764 darkslateblue: [72, 61, 139],
765 darkslategray: [47, 79, 79],
766 darkslategrey: [47, 79, 79],
767 darkturquoise: [0, 206, 209],
768 darkviolet: [148, 0, 211],
769 deeppink: [255, 20, 147],
770 deepskyblue: [0, 191, 255],
771 dimgray: [105, 105, 105],
772 dimgrey: [105, 105, 105],
773 dodgerblue: [30, 144, 255],
774 firebrick: [178, 34, 34],
775 floralwhite: [255, 250, 240],
776 forestgreen: [34, 139, 34],
777 fuchsia: [255, 0, 255],
778 gainsboro: [220, 220, 220],
779 ghostwhite: [248, 248, 255],
780 gold: [255, 215, 0],
781 goldenrod: [218, 165, 32],
782 gray: [128, 128, 128],
783 grey: [128, 128, 128],
784 green: [0, 128, 0],
785 greenyellow: [173, 255, 47],
786 honeydew: [240, 255, 240],
787 hotpink: [255, 105, 180],
788 indianred: [205, 92, 92],
789 indigo: [75, 0, 130],
790 ivory: [255, 255, 240],
791 khaki: [240, 230, 140],
792 lavender: [230, 230, 250],
793 lavenderblush: [255, 240, 245],
794 lawngreen: [124, 252, 0],
795 lemonchiffon: [255, 250, 205],
796 lightblue: [173, 216, 230],
797 lightcoral: [240, 128, 128],
798 lightcyan: [224, 255, 255],
799 lightgoldenrodyellow: [250, 250, 210],
800 lightgray: [211, 211, 211],
801 lightgreen: [144, 238, 144],
802 lightgrey: [211, 211, 211],
803 lightpink: [255, 182, 193],
804 lightsalmon: [255, 160, 122],
805 lightseagreen: [32, 178, 170],
806 lightskyblue: [135, 206, 250],
807 lightslategray: [119, 136, 153],
808 lightslategrey: [119, 136, 153],
809 lightsteelblue: [176, 196, 222],
810 lightyellow: [255, 255, 224],
811 lime: [0, 255, 0],
812 limegreen: [50, 205, 50],
813 linen: [250, 240, 230],
814 magenta: [255, 0, 255],
815 maroon: [128, 0, 0],
816 mediumaquamarine: [102, 205, 170],
817 mediumblue: [0, 0, 205],
818 mediumorchid: [186, 85, 211],
819 mediumpurple: [147, 112, 219],
820 mediumseagreen: [60, 179, 113],
821 mediumslateblue: [123, 104, 238],
822 mediumspringgreen: [0, 250, 154],
823 mediumturquoise: [72, 209, 204],
824 mediumvioletred: [199, 21, 133],
825 midnightblue: [25, 25, 112],
826 mintcream: [245, 255, 250],
827 mistyrose: [255, 228, 225],
828 moccasin: [255, 228, 181],
829 navajowhite: [255, 222, 173],
830 navy: [0, 0, 128],
831 oldlace: [253, 245, 230],
832 olive: [128, 128, 0],
833 olivedrab: [107, 142, 35],
834 orange: [255, 165, 0],
835 orangered: [255, 69, 0],
836 orchid: [218, 112, 214],
837 palegoldenrod: [238, 232, 170],
838 palegreen: [152, 251, 152],
839 paleturquoise: [175, 238, 238],
840 palevioletred: [219, 112, 147],
841 papayawhip: [255, 239, 213],
842 peachpuff: [255, 218, 185],
843 peru: [205, 133, 63],
844 pink: [255, 192, 203],
845 plum: [221, 160, 221],
846 powderblue: [176, 224, 230],
847 purple: [128, 0, 128],
848 red: [255, 0, 0],
849 rosybrown: [188, 143, 143],
850 royalblue: [65, 105, 225],
851 saddlebrown: [139, 69, 19],
852 salmon: [250, 128, 114],
853 sandybrown: [244, 164, 96],
854 seagreen: [46, 139, 87],
855 seashell: [255, 245, 238],
856 sienna: [160, 82, 45],
857 silver: [192, 192, 192],
858 skyblue: [135, 206, 235],
859 slateblue: [106, 90, 205],
860 slategray: [112, 128, 144],
861 slategrey: [112, 128, 144],
862 snow: [255, 250, 250],
863 springgreen: [0, 255, 127],
864 steelblue: [70, 130, 180],
865 tan: [210, 180, 140],
866 teal: [0, 128, 128],
867 thistle: [216, 191, 216],
868 tomato: [255, 99, 71],
869 turquoise: [64, 224, 208],
870 violet: [238, 130, 238],
871 wheat: [245, 222, 179],
872 white: [255, 255, 255],
873 whitesmoke: [245, 245, 245],
874 yellow: [255, 255, 0],
875 yellowgreen: [154, 205, 50]
876 }, ts = function(e) {
877 for (var r = e.map, a = e.keys, n = a.length, i = 0; i < n; i++) {
878 var s = a[i];
879 if (S(s))
880 throw Error("Tried to set map with object key");
881 i < a.length - 1 ? (r[s] == null && (r[s] = {}), r = r[s]) : r[s] = e.value;
882 }
883 }, rs = function(e) {
884 for (var r = e.map, a = e.keys, n = a.length, i = 0; i < n; i++) {
885 var s = a[i];
886 if (S(s))
887 throw Error("Tried to get map with object key");
888 if (r = r[s], r == null)
889 return r;
890 }
891 return r;
892 };
893 function ru(t) {
894 var e = typeof t;
895 return t != null && (e == "object" || e == "function");
896 }
897 var kr = ru, Sa = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof Ca < "u" ? Ca : typeof self < "u" ? self : {};
898 function au(t, e) {
899 return e = { exports: {} }, t(e, e.exports), e.exports;
900 }
901 var nu = typeof Sa == "object" && Sa && Sa.Object === Object && Sa, iu = nu, su = typeof self == "object" && self && self.Object === Object && self, ou = iu || su || Function("return this")(), sn = ou, lu = function() {
902 return sn.Date.now();
903 }, ai = lu, uu = /\s/;
904 function fu(t) {
905 for (var e = t.length; e-- && uu.test(t.charAt(e)); )
906 ;
907 return e;
908 }
909 var hu = fu, vu = /^\s+/;
910 function cu(t) {
911 return t && t.slice(0, hu(t) + 1).replace(vu, "");
912 }
913 var du = cu, gu = sn.Symbol, Zr = gu, as = Object.prototype, pu = as.hasOwnProperty, yu = as.toString, La = Zr ? Zr.toStringTag : void 0;
914 function mu(t) {
915 var e = pu.call(t, La), r = t[La];
916 try {
917 t[La] = void 0;
918 var a = !0;
919 } catch {
920 }
921 var n = yu.call(t);
922 return a && (e ? t[La] = r : delete t[La]), n;
923 }
924 var bu = mu, Eu = Object.prototype, wu = Eu.toString;
925 function xu(t) {
926 return wu.call(t);
927 }
928 var Tu = xu, Cu = "[object Null]", Du = "[object Undefined]", ns = Zr ? Zr.toStringTag : void 0;
929 function Su(t) {
930 return t == null ? t === void 0 ? Du : Cu : ns && ns in Object(t) ? bu(t) : Tu(t);
931 }
932 var is = Su;
933 function Lu(t) {
934 return t != null && typeof t == "object";
935 }
936 var Au = Lu, Ou = "[object Symbol]";
937 function Nu(t) {
938 return typeof t == "symbol" || Au(t) && is(t) == Ou;
939 }
940 var Aa = Nu, ss = 0 / 0, Iu = /^[-+]0x[0-9a-f]+$/i, Mu = /^0b[01]+$/i, Ru = /^0o[0-7]+$/i, ku = parseInt;
941 function Pu(t) {
942 if (typeof t == "number")
943 return t;
944 if (Aa(t))
945 return ss;
946 if (kr(t)) {
947 var e = typeof t.valueOf == "function" ? t.valueOf() : t;
948 t = kr(e) ? e + "" : e;
949 }
950 if (typeof t != "string")
951 return t === 0 ? t : +t;
952 t = du(t);
953 var r = Mu.test(t);
954 return r || Ru.test(t) ? ku(t.slice(2), r ? 2 : 8) : Iu.test(t) ? ss : +t;
955 }
956 var os = Pu, Bu = "Expected a function", Fu = Math.max, Gu = Math.min;
957 function zu(t, e, r) {
958 var a, n, i, s, o, u, l = 0, f = !1, h = !1, v = !0;
959 if (typeof t != "function")
960 throw new TypeError(Bu);
961 e = os(e) || 0, kr(r) && (f = !!r.leading, h = "maxWait" in r, i = h ? Fu(os(r.maxWait) || 0, e) : i, v = "trailing" in r ? !!r.trailing : v);
962 function d(L) {
963 var w = a, k = n;
964 return a = n = void 0, l = L, s = t.apply(k, w), s;
965 }
966 function c(L) {
967 return l = L, o = setTimeout(g, e), f ? d(L) : s;
968 }
969 function y(L) {
970 var w = L - u, k = L - l, D = e - w;
971 return h ? Gu(D, i - k) : D;
972 }
973 function p(L) {
974 var w = L - u, k = L - l;
975 return u === void 0 || w >= e || w < 0 || h && k >= i;
976 }
977 function g() {
978 var L = ai();
979 if (p(L))
980 return m(L);
981 o = setTimeout(g, y(L));
982 }
983 function m(L) {
984 return o = void 0, v && a ? d(L) : (a = n = void 0, s);
985 }
986 function b() {
987 o !== void 0 && clearTimeout(o), l = 0, a = u = n = o = void 0;
988 }
989 function E() {
990 return o === void 0 ? s : m(ai());
991 }
992 function M() {
993 var L = ai(), w = p(L);
994 if (a = arguments, n = this, u = L, w) {
995 if (o === void 0)
996 return c(u);
997 if (h)
998 return clearTimeout(o), o = setTimeout(g, e), d(u);
999 }
1000 return o === void 0 && (o = setTimeout(g, e)), s;
1001 }
1002 return M.cancel = b, M.flush = E, M;
1003 }
1004 var on = zu, ni = A ? A.performance : null, ls = ni && ni.now ? function() {
1005 return ni.now();
1006 } : function() {
1007 return Date.now();
1008 }, Vu = function() {
1009 if (A) {
1010 if (A.requestAnimationFrame)
1011 return function(t) {
1012 A.requestAnimationFrame(t);
1013 };
1014 if (A.mozRequestAnimationFrame)
1015 return function(t) {
1016 A.mozRequestAnimationFrame(t);
1017 };
1018 if (A.webkitRequestAnimationFrame)
1019 return function(t) {
1020 A.webkitRequestAnimationFrame(t);
1021 };
1022 if (A.msRequestAnimationFrame)
1023 return function(t) {
1024 A.msRequestAnimationFrame(t);
1025 };
1026 }
1027 return function(t) {
1028 t && setTimeout(function() {
1029 t(ls());
1030 }, 1e3 / 60);
1031 };
1032 }(), ln = function(e) {
1033 return Vu(e);
1034 }, gr = ls, Qr = 9261, us = 65599, Oa = 5381, fs = function(e) {
1035 for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qr, a = r, n; n = e.next(), !n.done; )
1036 a = a * us + n.value | 0;
1037 return a;
1038 }, Na = function(e) {
1039 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Qr;
1040 return r * us + e | 0;
1041 }, Ia = function(e) {
1042 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Oa;
1043 return (r << 5) + r + e | 0;
1044 }, Uu = function(e, r) {
1045 return e * 2097152 + r;
1046 }, wr = function(e) {
1047 return e[0] * 2097152 + e[1];
1048 }, un = function(e, r) {
1049 return [Na(e[0], r[0]), Ia(e[1], r[1])];
1050 }, $u = function(e, r) {
1051 var a = {
1052 value: 0,
1053 done: !1
1054 }, n = 0, i = e.length, s = {
1055 next: function() {
1056 return n < i ? a.value = e[n++] : a.done = !0, a;
1057 }
1058 };
1059 return fs(s, r);
1060 }, Pr = function(e, r) {
1061 var a = {
1062 value: 0,
1063 done: !1
1064 }, n = 0, i = e.length, s = {
1065 next: function() {
1066 return n < i ? a.value = e.charCodeAt(n++) : a.done = !0, a;
1067 }
1068 };
1069 return fs(s, r);
1070 }, hs = function() {
1071 return _u(arguments);
1072 }, _u = function(e) {
1073 for (var r, a = 0; a < e.length; a++) {
1074 var n = e[a];
1075 a === 0 ? r = Pr(n) : r = Pr(n, r);
1076 }
1077 return r;
1078 }, vs = !0, Yu = console.warn != null, Hu = console.trace != null, ii = Number.MAX_SAFE_INTEGER || 9007199254740991, cs = function() {
1079 return !0;
1080 }, fn = function() {
1081 return !1;
1082 }, ds = function() {
1083 return 0;
1084 }, si = function() {
1085 }, xt = function(e) {
1086 throw new Error(e);
1087 }, gs = function(e) {
1088 if (e !== void 0)
1089 vs = !!e;
1090 else
1091 return vs;
1092 }, vt = function(e) {
1093 gs() && (Yu ? console.warn(e) : (console.log(e), Hu && console.trace()));
1094 }, Xu = function(e) {
1095 return He({}, e);
1096 }, lr = function(e) {
1097 return e == null ? e : te(e) ? e.slice() : S(e) ? Xu(e) : e;
1098 }, Wu = function(e) {
1099 return e.slice();
1100 }, ps = function(e, r) {
1101 for (
1102 // loop :)
1103 r = e = "";
1104 // b - result , a - numeric letiable
1105 e++ < 36;
1106 //
1107 r += e * 51 & 52 ? (
1108 // return a random number or 4
1109 (e ^ 15 ? (
1110 // generate a random number from 0 to 15
1111 8 ^ Math.random() * (e ^ 20 ? 16 : 4)
1112 ) : 4).toString(16)
1113 ) : "-"
1114 )
1115 ;
1116 return r;
1117 }, qu = {}, ys = function() {
1118 return qu;
1119 }, At = function(e) {
1120 var r = Object.keys(e);
1121 return function(a) {
1122 for (var n = {}, i = 0; i < r.length; i++) {
1123 var s = r[i], o = a == null ? void 0 : a[s];
1124 n[s] = o === void 0 ? e[s] : o;
1125 }
1126 return n;
1127 };
1128 }, xr = function(e, r, a) {
1129 for (var n = e.length - 1; n >= 0 && !(e[n] === r && (e.splice(n, 1), a)); n--)
1130 ;
1131 }, oi = function(e) {
1132 e.splice(0, e.length);
1133 }, Ku = function(e, r) {
1134 for (var a = 0; a < r.length; a++) {
1135 var n = r[a];
1136 e.push(n);
1137 }
1138 }, er = function(e, r, a) {
1139 return a && (r = Et(a, r)), e[r];
1140 }, Tr = function(e, r, a, n) {
1141 a && (r = Et(a, r)), e[r] = n;
1142 }, Zu = /* @__PURE__ */ function() {
1143 function t() {
1144 fe(this, t), this._obj = {};
1145 }
1146 return C(t, [{
1147 key: "set",
1148 value: function(r, a) {
1149 return this._obj[r] = a, this;
1150 }
1151 }, {
1152 key: "delete",
1153 value: function(r) {
1154 return this._obj[r] = void 0, this;
1155 }
1156 }, {
1157 key: "clear",
1158 value: function() {
1159 this._obj = {};
1160 }
1161 }, {
1162 key: "has",
1163 value: function(r) {
1164 return this._obj[r] !== void 0;
1165 }
1166 }, {
1167 key: "get",
1168 value: function(r) {
1169 return this._obj[r];
1170 }
1171 }]), t;
1172 }(), ur = typeof Map < "u" ? Map : Zu, Qu = "undefined", Ju = /* @__PURE__ */ function() {
1173 function t(e) {
1174 if (fe(this, t), this._obj = /* @__PURE__ */ Object.create(null), this.size = 0, e != null) {
1175 var r;
1176 e.instanceString != null && e.instanceString() === this.instanceString() ? r = e.toArray() : r = e;
1177 for (var a = 0; a < r.length; a++)
1178 this.add(r[a]);
1179 }
1180 }
1181 return C(t, [{
1182 key: "instanceString",
1183 value: function() {
1184 return "set";
1185 }
1186 }, {
1187 key: "add",
1188 value: function(r) {
1189 var a = this._obj;
1190 a[r] !== 1 && (a[r] = 1, this.size++);
1191 }
1192 }, {
1193 key: "delete",
1194 value: function(r) {
1195 var a = this._obj;
1196 a[r] === 1 && (a[r] = 0, this.size--);
1197 }
1198 }, {
1199 key: "clear",
1200 value: function() {
1201 this._obj = /* @__PURE__ */ Object.create(null);
1202 }
1203 }, {
1204 key: "has",
1205 value: function(r) {
1206 return this._obj[r] === 1;
1207 }
1208 }, {
1209 key: "toArray",
1210 value: function() {
1211 var r = this;
1212 return Object.keys(this._obj).filter(function(a) {
1213 return r.has(a);
1214 });
1215 }
1216 }, {
1217 key: "forEach",
1218 value: function(r, a) {
1219 return this.toArray().forEach(r, a);
1220 }
1221 }]), t;
1222 }(), Jr = (typeof Set > "u" ? "undefined" : _(Set)) !== Qu ? Set : Ju, hn = function(e, r) {
1223 var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0;
1224 if (e === void 0 || r === void 0 || !Ye(e)) {
1225 xt("An element must have a core reference and parameters set");
1226 return;
1227 }
1228 var n = r.group;
1229 if (n == null && (r.data && r.data.source != null && r.data.target != null ? n = "edges" : n = "nodes"), n !== "nodes" && n !== "edges") {
1230 xt("An element must be of type `nodes` or `edges`; you specified `" + n + "`");
1231 return;
1232 }
1233 this.length = 1, this[0] = this;
1234 var i = this._private = {
1235 cy: e,
1236 single: !0,
1237 // indicates this is an element
1238 data: r.data || {},
1239 // data object
1240 position: r.position || {
1241 x: 0,
1242 y: 0
1243 },
1244 // (x, y) position pair
1245 autoWidth: void 0,
1246 // width and height of nodes calculated by the renderer when set to special 'auto' value
1247 autoHeight: void 0,
1248 autoPadding: void 0,
1249 compoundBoundsClean: !1,
1250 // whether the compound dimensions need to be recalculated the next time dimensions are read
1251 listeners: [],
1252 // array of bound listeners
1253 group: n,
1254 // string; 'nodes' or 'edges'
1255 style: {},
1256 // properties as set by the style
1257 rstyle: {},
1258 // properties for style sent from the renderer to the core
1259 styleCxts: [],
1260 // applied style contexts from the styler
1261 styleKeys: {},
1262 // per-group keys of style property values
1263 removed: !0,
1264 // whether it's inside the vis; true if removed (set true here since we call restore)
1265 selected: !!r.selected,
1266 // whether it's selected
1267 selectable: r.selectable === void 0 ? !0 : !!r.selectable,
1268 // whether it's selectable
1269 locked: !!r.locked,
1270 // whether the element is locked (cannot be moved)
1271 grabbed: !1,
1272 // whether the element is grabbed by the mouse; renderer sets this privately
1273 grabbable: r.grabbable === void 0 ? !0 : !!r.grabbable,
1274 // whether the element can be grabbed
1275 pannable: r.pannable === void 0 ? n === "edges" : !!r.pannable,
1276 // whether the element has passthrough panning enabled
1277 active: !1,
1278 // whether the element is active from user interaction
1279 classes: new Jr(),
1280 // map ( className => true )
1281 animation: {
1282 // object for currently-running animations
1283 current: [],
1284 queue: []
1285 },
1286 rscratch: {},
1287 // object in which the renderer can store information
1288 scratch: r.scratch || {},
1289 // scratch objects
1290 edges: [],
1291 // array of connected edges
1292 children: [],
1293 // array of children
1294 parent: r.parent && r.parent.isNode() ? r.parent : null,
1295 // parent ref
1296 traversalCache: {},
1297 // cache of output of traversal functions
1298 backgrounding: !1,
1299 // whether background images are loading
1300 bbCache: null,
1301 // cache of the current bounding box
1302 bbCacheShift: {
1303 x: 0,
1304 y: 0
1305 },
1306 // shift applied to cached bb to be applied on next get
1307 bodyBounds: null,
1308 // bounds cache of element body, w/o overlay
1309 overlayBounds: null,
1310 // bounds cache of element body, including overlay
1311 labelBounds: {
1312 // bounds cache of labels
1313 all: null,
1314 source: null,
1315 target: null,
1316 main: null
1317 },
1318 arrowBounds: {
1319 // bounds cache of edge arrows
1320 source: null,
1321 target: null,
1322 "mid-source": null,
1323 "mid-target": null
1324 }
1325 };
1326 if (i.position.x == null && (i.position.x = 0), i.position.y == null && (i.position.y = 0), r.renderedPosition) {
1327 var s = r.renderedPosition, o = e.pan(), u = e.zoom();
1328 i.position = {
1329 x: (s.x - o.x) / u,
1330 y: (s.y - o.y) / u
1331 };
1332 }
1333 var l = [];
1334 te(r.classes) ? l = r.classes : ee(r.classes) && (l = r.classes.split(/\s+/));
1335 for (var f = 0, h = l.length; f < h; f++) {
1336 var v = l[f];
1337 !v || v === "" || i.classes.add(v);
1338 }
1339 this.createEmitter();
1340 var d = r.style || r.css;
1341 d && (vt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."), this.style(d)), (a === void 0 || a) && this.restore();
1342 }, ms = function(e) {
1343 return e = {
1344 bfs: e.bfs || !e.dfs,
1345 dfs: e.dfs || !e.bfs
1346 }, function(a, n, i) {
1347 var s;
1348 S(a) && !pe(a) && (s = a, a = s.roots || s.root, n = s.visit, i = s.directed), i = arguments.length === 2 && !H(n) ? n : i, n = H(n) ? n : function() {
1349 };
1350 for (var o = this._private.cy, u = a = ee(a) ? this.filter(a) : a, l = [], f = [], h = {}, v = {}, d = {}, c = 0, y, p = this.byGroup(), g = p.nodes, m = p.edges, b = 0; b < u.length; b++) {
1351 var E = u[b], M = E.id();
1352 E.isNode() && (l.unshift(E), e.bfs && (d[M] = !0, f.push(E)), v[M] = 0);
1353 }
1354 for (var L = function() {
1355 var X = e.bfs ? l.shift() : l.pop(), B = X.id();
1356 if (e.dfs) {
1357 if (d[B])
1358 return "continue";
1359 d[B] = !0, f.push(X);
1360 }
1361 var re = v[B], K = h[B], W = K != null ? K.source() : null, ae = K != null ? K.target() : null, ue = K == null ? void 0 : X.same(W) ? ae[0] : W[0], me = void 0;
1362 if (me = n(X, K, ue, c++, re), me === !0)
1363 return y = X, "break";
1364 if (me === !1)
1365 return "break";
1366 for (var ie = X.connectedEdges().filter(function(De) {
1367 return (!i || De.source().same(X)) && m.has(De);
1368 }), ge = 0; ge < ie.length; ge++) {
1369 var Ee = ie[ge], Ce = Ee.connectedNodes().filter(function(De) {
1370 return !De.same(X) && g.has(De);
1371 }), we = Ce.id();
1372 Ce.length !== 0 && !d[we] && (Ce = Ce[0], l.push(Ce), e.bfs && (d[we] = !0, f.push(Ce)), h[we] = Ee, v[we] = v[B] + 1);
1373 }
1374 }; l.length !== 0; ) {
1375 var w = L();
1376 if (w !== "continue" && w === "break")
1377 break;
1378 }
1379 for (var k = o.collection(), D = 0; D < f.length; D++) {
1380 var F = f[D], G = h[F.id()];
1381 G != null && k.push(G), k.push(F);
1382 }
1383 return {
1384 path: o.collection(k),
1385 found: o.collection(y)
1386 };
1387 };
1388 }, Ma = {
1389 breadthFirstSearch: ms({
1390 bfs: !0
1391 }),
1392 depthFirstSearch: ms({
1393 dfs: !0
1394 })
1395 };
1396 Ma.bfs = Ma.breadthFirstSearch, Ma.dfs = Ma.depthFirstSearch;
1397 var ju = au(function(t, e) {
1398 (function() {
1399 var r, a, n, i, s, o, u, l, f, h, v, d, c, y, p;
1400 n = Math.floor, h = Math.min, a = function(g, m) {
1401 return g < m ? -1 : g > m ? 1 : 0;
1402 }, f = function(g, m, b, E, M) {
1403 var L;
1404 if (b == null && (b = 0), M == null && (M = a), b < 0)
1405 throw new Error("lo must be non-negative");
1406 for (E == null && (E = g.length); b < E; )
1407 L = n((b + E) / 2), M(m, g[L]) < 0 ? E = L : b = L + 1;
1408 return [].splice.apply(g, [b, b - b].concat(m)), m;
1409 }, o = function(g, m, b) {
1410 return b == null && (b = a), g.push(m), y(g, 0, g.length - 1, b);
1411 }, s = function(g, m) {
1412 var b, E;
1413 return m == null && (m = a), b = g.pop(), g.length ? (E = g[0], g[0] = b, p(g, 0, m)) : E = b, E;
1414 }, l = function(g, m, b) {
1415 var E;
1416 return b == null && (b = a), E = g[0], g[0] = m, p(g, 0, b), E;
1417 }, u = function(g, m, b) {
1418 var E;
1419 return b == null && (b = a), g.length && b(g[0], m) < 0 && (E = [g[0], m], m = E[0], g[0] = E[1], p(g, 0, b)), m;
1420 }, i = function(g, m) {
1421 var b, E, M, L, w, k;
1422 for (m == null && (m = a), L = (function() {
1423 k = [];
1424 for (var D = 0, F = n(g.length / 2); 0 <= F ? D < F : D > F; 0 <= F ? D++ : D--)
1425 k.push(D);
1426 return k;
1427 }).apply(this).reverse(), w = [], E = 0, M = L.length; E < M; E++)
1428 b = L[E], w.push(p(g, b, m));
1429 return w;
1430 }, c = function(g, m, b) {
1431 var E;
1432 if (b == null && (b = a), E = g.indexOf(m), E !== -1)
1433 return y(g, 0, E, b), p(g, E, b);
1434 }, v = function(g, m, b) {
1435 var E, M, L, w, k;
1436 if (b == null && (b = a), M = g.slice(0, m), !M.length)
1437 return M;
1438 for (i(M, b), k = g.slice(m), L = 0, w = k.length; L < w; L++)
1439 E = k[L], u(M, E, b);
1440 return M.sort(b).reverse();
1441 }, d = function(g, m, b) {
1442 var E, M, L, w, k, D, F, G, N;
1443 if (b == null && (b = a), m * 10 <= g.length) {
1444 if (L = g.slice(0, m).sort(b), !L.length)
1445 return L;
1446 for (M = L[L.length - 1], F = g.slice(m), w = 0, D = F.length; w < D; w++)
1447 E = F[w], b(E, M) < 0 && (f(L, E, 0, null, b), L.pop(), M = L[L.length - 1]);
1448 return L;
1449 }
1450 for (i(g, b), N = [], k = 0, G = h(m, g.length); 0 <= G ? k < G : k > G; 0 <= G ? ++k : --k)
1451 N.push(s(g, b));
1452 return N;
1453 }, y = function(g, m, b, E) {
1454 var M, L, w;
1455 for (E == null && (E = a), M = g[b]; b > m; ) {
1456 if (w = b - 1 >> 1, L = g[w], E(M, L) < 0) {
1457 g[b] = L, b = w;
1458 continue;
1459 }
1460 break;
1461 }
1462 return g[b] = M;
1463 }, p = function(g, m, b) {
1464 var E, M, L, w, k;
1465 for (b == null && (b = a), M = g.length, k = m, L = g[m], E = 2 * m + 1; E < M; )
1466 w = E + 1, w < M && !(b(g[E], g[w]) < 0) && (E = w), g[m] = g[E], m = E, E = 2 * m + 1;
1467 return g[m] = L, y(g, k, m, b);
1468 }, r = function() {
1469 g.push = o, g.pop = s, g.replace = l, g.pushpop = u, g.heapify = i, g.updateItem = c, g.nlargest = v, g.nsmallest = d;
1470 function g(m) {
1471 this.cmp = m ?? a, this.nodes = [];
1472 }
1473 return g.prototype.push = function(m) {
1474 return o(this.nodes, m, this.cmp);
1475 }, g.prototype.pop = function() {
1476 return s(this.nodes, this.cmp);
1477 }, g.prototype.peek = function() {
1478 return this.nodes[0];
1479 }, g.prototype.contains = function(m) {
1480 return this.nodes.indexOf(m) !== -1;
1481 }, g.prototype.replace = function(m) {
1482 return l(this.nodes, m, this.cmp);
1483 }, g.prototype.pushpop = function(m) {
1484 return u(this.nodes, m, this.cmp);
1485 }, g.prototype.heapify = function() {
1486 return i(this.nodes, this.cmp);
1487 }, g.prototype.updateItem = function(m) {
1488 return c(this.nodes, m, this.cmp);
1489 }, g.prototype.clear = function() {
1490 return this.nodes = [];
1491 }, g.prototype.empty = function() {
1492 return this.nodes.length === 0;
1493 }, g.prototype.size = function() {
1494 return this.nodes.length;
1495 }, g.prototype.clone = function() {
1496 var m;
1497 return m = new g(), m.nodes = this.nodes.slice(0), m;
1498 }, g.prototype.toArray = function() {
1499 return this.nodes.slice(0);
1500 }, g.prototype.insert = g.prototype.push, g.prototype.top = g.prototype.peek, g.prototype.front = g.prototype.peek, g.prototype.has = g.prototype.contains, g.prototype.copy = g.prototype.clone, g;
1501 }(), function(g, m) {
1502 return t.exports = m();
1503 }(this, function() {
1504 return r;
1505 });
1506 }).call(Sa);
1507 }), Ra = ju, ef = At({
1508 root: null,
1509 weight: function(e) {
1510 return 1;
1511 },
1512 directed: !1
1513 }), tf = {
1514 dijkstra: function(e) {
1515 if (!S(e)) {
1516 var r = arguments;
1517 e = {
1518 root: r[0],
1519 weight: r[1],
1520 directed: r[2]
1521 };
1522 }
1523 var a = ef(e), n = a.root, i = a.weight, s = a.directed, o = this, u = i, l = ee(n) ? this.filter(n)[0] : n[0], f = {}, h = {}, v = {}, d = this.byGroup(), c = d.nodes, y = d.edges;
1524 y.unmergeBy(function(re) {
1525 return re.isLoop();
1526 });
1527 for (var p = function(K) {
1528 return f[K.id()];
1529 }, g = function(K, W) {
1530 f[K.id()] = W, m.updateItem(K);
1531 }, m = new Ra(function(re, K) {
1532 return p(re) - p(K);
1533 }), b = 0; b < c.length; b++) {
1534 var E = c[b];
1535 f[E.id()] = E.same(l) ? 0 : 1 / 0, m.push(E);
1536 }
1537 for (var M = function(K, W) {
1538 for (var ae = (s ? K.edgesTo(W) : K.edgesWith(W)).intersect(y), ue = 1 / 0, me, ie = 0; ie < ae.length; ie++) {
1539 var ge = ae[ie], Ee = u(ge);
1540 (Ee < ue || !me) && (ue = Ee, me = ge);
1541 }
1542 return {
1543 edge: me,
1544 dist: ue
1545 };
1546 }; m.size() > 0; ) {
1547 var L = m.pop(), w = p(L), k = L.id();
1548 if (v[k] = w, w !== 1 / 0)
1549 for (var D = L.neighborhood().intersect(c), F = 0; F < D.length; F++) {
1550 var G = D[F], N = G.id(), X = M(L, G), B = w + X.dist;
1551 B < p(G) && (g(G, B), h[N] = {
1552 node: L,
1553 edge: X.edge
1554 });
1555 }
1556 }
1557 return {
1558 distanceTo: function(K) {
1559 var W = ee(K) ? c.filter(K)[0] : K[0];
1560 return v[W.id()];
1561 },
1562 pathTo: function(K) {
1563 var W = ee(K) ? c.filter(K)[0] : K[0], ae = [], ue = W, me = ue.id();
1564 if (W.length > 0)
1565 for (ae.unshift(W); h[me]; ) {
1566 var ie = h[me];
1567 ae.unshift(ie.edge), ae.unshift(ie.node), ue = ie.node, me = ue.id();
1568 }
1569 return o.spawn(ae);
1570 }
1571 };
1572 }
1573 }, rf = {
1574 // kruskal's algorithm (finds min spanning tree, assuming undirected graph)
1575 // implemented from pseudocode from wikipedia
1576 kruskal: function(e) {
1577 e = e || function(b) {
1578 return 1;
1579 };
1580 for (var r = this.byGroup(), a = r.nodes, n = r.edges, i = a.length, s = new Array(i), o = a, u = function(E) {
1581 for (var M = 0; M < s.length; M++) {
1582 var L = s[M];
1583 if (L.has(E))
1584 return M;
1585 }
1586 }, l = 0; l < i; l++)
1587 s[l] = this.spawn(a[l]);
1588 for (var f = n.sort(function(b, E) {
1589 return e(b) - e(E);
1590 }), h = 0; h < f.length; h++) {
1591 var v = f[h], d = v.source()[0], c = v.target()[0], y = u(d), p = u(c), g = s[y], m = s[p];
1592 y !== p && (o.merge(v), g.merge(m), s.splice(p, 1));
1593 }
1594 return o;
1595 }
1596 }, af = At({
1597 root: null,
1598 goal: null,
1599 weight: function(e) {
1600 return 1;
1601 },
1602 heuristic: function(e) {
1603 return 0;
1604 },
1605 directed: !1
1606 }), nf = {
1607 // Implemented from pseudocode from wikipedia
1608 aStar: function(e) {
1609 var r = this.cy(), a = af(e), n = a.root, i = a.goal, s = a.heuristic, o = a.directed, u = a.weight;
1610 n = r.collection(n)[0], i = r.collection(i)[0];
1611 var l = n.id(), f = i.id(), h = {}, v = {}, d = {}, c = new Ra(function(me, ie) {
1612 return v[me.id()] - v[ie.id()];
1613 }), y = new Jr(), p = {}, g = {}, m = function(ie, ge) {
1614 c.push(ie), y.add(ge);
1615 }, b, E, M = function() {
1616 b = c.pop(), E = b.id(), y.delete(E);
1617 }, L = function(ie) {
1618 return y.has(ie);
1619 };
1620 m(n, l), h[l] = 0, v[l] = s(n);
1621 for (var w = 0; c.size() > 0; ) {
1622 if (M(), w++, E === f) {
1623 for (var k = [], D = i, F = f, G = g[F]; k.unshift(D), G != null && k.unshift(G), D = p[F], D != null; )
1624 F = D.id(), G = g[F];
1625 return {
1626 found: !0,
1627 distance: h[E],
1628 path: this.spawn(k),
1629 steps: w
1630 };
1631 }
1632 d[E] = !0;
1633 for (var N = b._private.edges, X = 0; X < N.length; X++) {
1634 var B = N[X];
1635 if (this.hasElementWithId(B.id()) && !(o && B.data("source") !== E)) {
1636 var re = B.source(), K = B.target(), W = re.id() !== E ? re : K, ae = W.id();
1637 if (this.hasElementWithId(ae) && !d[ae]) {
1638 var ue = h[E] + u(B);
1639 if (!L(ae)) {
1640 h[ae] = ue, v[ae] = ue + s(W), m(W, ae), p[ae] = b, g[ae] = B;
1641 continue;
1642 }
1643 ue < h[ae] && (h[ae] = ue, v[ae] = ue + s(W), p[ae] = b, g[ae] = B);
1644 }
1645 }
1646 }
1647 }
1648 return {
1649 found: !1,
1650 distance: void 0,
1651 path: void 0,
1652 steps: w
1653 };
1654 }
1655 }, sf = At({
1656 weight: function(e) {
1657 return 1;
1658 },
1659 directed: !1
1660 }), of = {
1661 // Implemented from pseudocode from wikipedia
1662 floydWarshall: function(e) {
1663 for (var r = this.cy(), a = sf(e), n = a.weight, i = a.directed, s = n, o = this.byGroup(), u = o.nodes, l = o.edges, f = u.length, h = f * f, v = function(Ee) {
1664 return u.indexOf(Ee);
1665 }, d = function(Ee) {
1666 return u[Ee];
1667 }, c = new Array(h), y = 0; y < h; y++) {
1668 var p = y % f, g = (y - p) / f;
1669 g === p ? c[y] = 0 : c[y] = 1 / 0;
1670 }
1671 for (var m = new Array(h), b = new Array(h), E = 0; E < l.length; E++) {
1672 var M = l[E], L = M.source()[0], w = M.target()[0];
1673 if (L !== w) {
1674 var k = v(L), D = v(w), F = k * f + D, G = s(M);
1675 if (c[F] > G && (c[F] = G, m[F] = D, b[F] = M), !i) {
1676 var N = D * f + k;
1677 !i && c[N] > G && (c[N] = G, m[N] = k, b[N] = M);
1678 }
1679 }
1680 }
1681 for (var X = 0; X < f; X++)
1682 for (var B = 0; B < f; B++)
1683 for (var re = B * f + X, K = 0; K < f; K++) {
1684 var W = B * f + K, ae = X * f + K;
1685 c[re] + c[ae] < c[W] && (c[W] = c[re] + c[ae], m[W] = m[re]);
1686 }
1687 var ue = function(Ee) {
1688 return (ee(Ee) ? r.filter(Ee) : Ee)[0];
1689 }, me = function(Ee) {
1690 return v(ue(Ee));
1691 }, ie = {
1692 distance: function(Ee, Ce) {
1693 var we = me(Ee), De = me(Ce);
1694 return c[we * f + De];
1695 },
1696 path: function(Ee, Ce) {
1697 var we = me(Ee), De = me(Ce), se = d(we);
1698 if (we === De)
1699 return se.collection();
1700 if (m[we * f + De] == null)
1701 return r.collection();
1702 var xe = r.collection(), Le = we, Se;
1703 for (xe.merge(se); we !== De; )
1704 Le = we, we = m[we * f + De], Se = b[Le * f + we], xe.merge(Se), xe.merge(d(we));
1705 return xe;
1706 }
1707 };
1708 return ie;
1709 }
1710 // floydWarshall
1711 }, lf = At({
1712 weight: function(e) {
1713 return 1;
1714 },
1715 directed: !1,
1716 root: null
1717 }), uf = {
1718 // Implemented from pseudocode from wikipedia
1719 bellmanFord: function(e) {
1720 var r = this, a = lf(e), n = a.weight, i = a.directed, s = a.root, o = n, u = this, l = this.cy(), f = this.byGroup(), h = f.edges, v = f.nodes, d = v.length, c = new ur(), y = !1, p = [];
1721 s = l.collection(s)[0], h.unmergeBy(function(ze) {
1722 return ze.isLoop();
1723 });
1724 for (var g = h.length, m = function(Be) {
1725 var $e = c.get(Be.id());
1726 return $e || ($e = {}, c.set(Be.id(), $e)), $e;
1727 }, b = function(Be) {
1728 return (ee(Be) ? l.$(Be) : Be)[0];
1729 }, E = function(Be) {
1730 return m(b(Be)).dist;
1731 }, M = function(Be) {
1732 for (var $e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : s, rt = b(Be), je = [], We = rt; ; ) {
1733 if (We == null)
1734 return r.spawn();
1735 var et = m(We), he = et.edge, O = et.pred;
1736 if (je.unshift(We[0]), We.same($e) && je.length > 0)
1737 break;
1738 he != null && je.unshift(he), We = O;
1739 }
1740 return u.spawn(je);
1741 }, L = 0; L < d; L++) {
1742 var w = v[L], k = m(w);
1743 w.same(s) ? k.dist = 0 : k.dist = 1 / 0, k.pred = null, k.edge = null;
1744 }
1745 for (var D = !1, F = function(Be, $e, rt, je, We, et) {
1746 var he = je.dist + et;
1747 he < We.dist && !rt.same(je.edge) && (We.dist = he, We.pred = Be, We.edge = rt, D = !0);
1748 }, G = 1; G < d; G++) {
1749 D = !1;
1750 for (var N = 0; N < g; N++) {
1751 var X = h[N], B = X.source(), re = X.target(), K = o(X), W = m(B), ae = m(re);
1752 F(B, re, X, W, ae, K), i || F(re, B, X, ae, W, K);
1753 }
1754 if (!D)
1755 break;
1756 }
1757 if (D)
1758 for (var ue = [], me = 0; me < g; me++) {
1759 var ie = h[me], ge = ie.source(), Ee = ie.target(), Ce = o(ie), we = m(ge).dist, De = m(Ee).dist;
1760 if (we + Ce < De || !i && De + Ce < we)
1761 if (y || (vt("Graph contains a negative weight cycle for Bellman-Ford"), y = !0), e.findNegativeWeightCycles !== !1) {
1762 var se = [];
1763 we + Ce < De && se.push(ge), !i && De + Ce < we && se.push(Ee);
1764 for (var xe = se.length, Le = 0; Le < xe; Le++) {
1765 var Se = se[Le], Oe = [Se];
1766 Oe.push(m(Se).edge);
1767 for (var Fe = m(Se).pred; Oe.indexOf(Fe) === -1; )
1768 Oe.push(Fe), Oe.push(m(Fe).edge), Fe = m(Fe).pred;
1769 Oe = Oe.slice(Oe.indexOf(Fe));
1770 for (var Xe = Oe[0].id(), Ie = 0, Me = 2; Me < Oe.length; Me += 2)
1771 Oe[Me].id() < Xe && (Xe = Oe[Me].id(), Ie = Me);
1772 Oe = Oe.slice(Ie).concat(Oe.slice(0, Ie)), Oe.push(Oe[0]);
1773 var Ue = Oe.map(function(ze) {
1774 return ze.id();
1775 }).join(",");
1776 ue.indexOf(Ue) === -1 && (p.push(u.spawn(Oe)), ue.push(Ue));
1777 }
1778 } else
1779 break;
1780 }
1781 return {
1782 distanceTo: E,
1783 pathTo: M,
1784 hasNegativeWeightCycle: y,
1785 negativeWeightCycles: p
1786 };
1787 }
1788 // bellmanFord
1789 }, ff = Math.sqrt(2), hf = function(e, r, a) {
1790 a.length === 0 && xt("Karger-Stein must be run on a connected (sub)graph");
1791 for (var n = a[e], i = n[1], s = n[2], o = r[i], u = r[s], l = a, f = l.length - 1; f >= 0; f--) {
1792 var h = l[f], v = h[1], d = h[2];
1793 (r[v] === o && r[d] === u || r[v] === u && r[d] === o) && l.splice(f, 1);
1794 }
1795 for (var c = 0; c < l.length; c++) {
1796 var y = l[c];
1797 y[1] === u ? (l[c] = y.slice(), l[c][1] = o) : y[2] === u && (l[c] = y.slice(), l[c][2] = o);
1798 }
1799 for (var p = 0; p < r.length; p++)
1800 r[p] === u && (r[p] = o);
1801 return l;
1802 }, li = function(e, r, a, n) {
1803 for (; a > n; ) {
1804 var i = Math.floor(Math.random() * r.length);
1805 r = hf(i, e, r), a--;
1806 }
1807 return r;
1808 }, vf = {
1809 // Computes the minimum cut of an undirected graph
1810 // Returns the correct answer with high probability
1811 kargerStein: function() {
1812 var e = this, r = this.byGroup(), a = r.nodes, n = r.edges;
1813 n.unmergeBy(function(ae) {
1814 return ae.isLoop();
1815 });
1816 var i = a.length, s = n.length, o = Math.ceil(Math.pow(Math.log(i) / Math.LN2, 2)), u = Math.floor(i / ff);
1817 if (i < 2) {
1818 xt("At least 2 nodes are required for Karger-Stein algorithm");
1819 return;
1820 }
1821 for (var l = [], f = 0; f < s; f++) {
1822 var h = n[f];
1823 l.push([f, a.indexOf(h.source()), a.indexOf(h.target())]);
1824 }
1825 for (var v = 1 / 0, d = [], c = new Array(i), y = new Array(i), p = new Array(i), g = function(ue, me) {
1826 for (var ie = 0; ie < i; ie++)
1827 me[ie] = ue[ie];
1828 }, m = 0; m <= o; m++) {
1829 for (var b = 0; b < i; b++)
1830 y[b] = b;
1831 var E = li(y, l.slice(), i, u), M = E.slice();
1832 g(y, p);
1833 var L = li(y, E, u, 2), w = li(p, M, u, 2);
1834 L.length <= w.length && L.length < v ? (v = L.length, d = L, g(y, c)) : w.length <= L.length && w.length < v && (v = w.length, d = w, g(p, c));
1835 }
1836 for (var k = this.spawn(d.map(function(ae) {
1837 return n[ae[0]];
1838 })), D = this.spawn(), F = this.spawn(), G = c[0], N = 0; N < c.length; N++) {
1839 var X = c[N], B = a[N];
1840 X === G ? D.merge(B) : F.merge(B);
1841 }
1842 var re = function(ue) {
1843 var me = e.spawn();
1844 return ue.forEach(function(ie) {
1845 me.merge(ie), ie.connectedEdges().forEach(function(ge) {
1846 e.contains(ge) && !k.contains(ge) && me.merge(ge);
1847 });
1848 }), me;
1849 }, K = [re(D), re(F)], W = {
1850 cut: k,
1851 components: K,
1852 // n.b. partitions are included to be compatible with the old api spec
1853 // (could be removed in a future major version)
1854 partition1: D,
1855 partition2: F
1856 };
1857 return W;
1858 }
1859 }, cf = function(e) {
1860 return {
1861 x: e.x,
1862 y: e.y
1863 };
1864 }, vn = function(e, r, a) {
1865 return {
1866 x: e.x * r + a.x,
1867 y: e.y * r + a.y
1868 };
1869 }, bs = function(e, r, a) {
1870 return {
1871 x: (e.x - a.x) / r,
1872 y: (e.y - a.y) / r
1873 };
1874 }, jr = function(e) {
1875 return {
1876 x: e[0],
1877 y: e[1]
1878 };
1879 }, df = function(e) {
1880 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++) {
1881 var s = e[i];
1882 isFinite(s) && (n = Math.min(s, n));
1883 }
1884 return n;
1885 }, gf = function(e) {
1886 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++) {
1887 var s = e[i];
1888 isFinite(s) && (n = Math.max(s, n));
1889 }
1890 return n;
1891 }, pf = function(e) {
1892 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++) {
1893 var o = e[s];
1894 isFinite(o) && (n += o, i++);
1895 }
1896 return n / i;
1897 }, yf = function(e) {
1898 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;
1899 n ? e = e.slice(r, a) : (a < e.length && e.splice(a, e.length - a), r > 0 && e.splice(0, r));
1900 for (var o = 0, u = e.length - 1; u >= 0; u--) {
1901 var l = e[u];
1902 s ? isFinite(l) || (e[u] = -1 / 0, o++) : e.splice(u, 1);
1903 }
1904 i && e.sort(function(v, d) {
1905 return v - d;
1906 });
1907 var f = e.length, h = Math.floor(f / 2);
1908 return f % 2 !== 0 ? e[h + 1 + o] : (e[h - 1 + o] + e[h + o]) / 2;
1909 }, mf = function(e) {
1910 return Math.PI * e / 180;
1911 }, cn = function(e, r) {
1912 return Math.atan2(r, e) - Math.PI / 2;
1913 }, ui = Math.log2 || function(t) {
1914 return Math.log(t) / Math.log(2);
1915 }, Es = function(e) {
1916 return e > 0 ? 1 : e < 0 ? -1 : 0;
1917 }, Br = function(e, r) {
1918 return Math.sqrt(Fr(e, r));
1919 }, Fr = function(e, r) {
1920 var a = r.x - e.x, n = r.y - e.y;
1921 return a * a + n * n;
1922 }, bf = function(e) {
1923 for (var r = e.length, a = 0, n = 0; n < r; n++)
1924 a += e[n];
1925 for (var i = 0; i < r; i++)
1926 e[i] = e[i] / a;
1927 return e;
1928 }, Lt = function(e, r, a, n) {
1929 return (1 - n) * (1 - n) * e + 2 * (1 - n) * n * r + n * n * a;
1930 }, ea = function(e, r, a, n) {
1931 return {
1932 x: Lt(e.x, r.x, a.x, n),
1933 y: Lt(e.y, r.y, a.y, n)
1934 };
1935 }, Ef = function(e, r, a, n) {
1936 var i = {
1937 x: r.x - e.x,
1938 y: r.y - e.y
1939 }, s = Br(e, r), o = {
1940 x: i.x / s,
1941 y: i.y / s
1942 };
1943 return a = a ?? 0, n = n ?? a * s, {
1944 x: e.x + o.x * n,
1945 y: e.y + o.y * n
1946 };
1947 }, ka = function(e, r, a) {
1948 return Math.max(e, Math.min(a, r));
1949 }, Yt = function(e) {
1950 if (e == null)
1951 return {
1952 x1: 1 / 0,
1953 y1: 1 / 0,
1954 x2: -1 / 0,
1955 y2: -1 / 0,
1956 w: 0,
1957 h: 0
1958 };
1959 if (e.x1 != null && e.y1 != null) {
1960 if (e.x2 != null && e.y2 != null && e.x2 >= e.x1 && e.y2 >= e.y1)
1961 return {
1962 x1: e.x1,
1963 y1: e.y1,
1964 x2: e.x2,
1965 y2: e.y2,
1966 w: e.x2 - e.x1,
1967 h: e.y2 - e.y1
1968 };
1969 if (e.w != null && e.h != null && e.w >= 0 && e.h >= 0)
1970 return {
1971 x1: e.x1,
1972 y1: e.y1,
1973 x2: e.x1 + e.w,
1974 y2: e.y1 + e.h,
1975 w: e.w,
1976 h: e.h
1977 };
1978 }
1979 }, wf = function(e) {
1980 return {
1981 x1: e.x1,
1982 x2: e.x2,
1983 w: e.w,
1984 y1: e.y1,
1985 y2: e.y2,
1986 h: e.h
1987 };
1988 }, xf = function(e) {
1989 e.x1 = 1 / 0, e.y1 = 1 / 0, e.x2 = -1 / 0, e.y2 = -1 / 0, e.w = 0, e.h = 0;
1990 }, Tf = function(e, r, a) {
1991 return {
1992 x1: e.x1 + r,
1993 x2: e.x2 + r,
1994 y1: e.y1 + a,
1995 y2: e.y2 + a,
1996 w: e.w,
1997 h: e.h
1998 };
1999 }, ws = function(e, r) {
2000 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;
2001 }, Cf = function(e, r, a) {
2002 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;
2003 }, dn = function(e) {
2004 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
2005 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;
2006 }, gn = function(e) {
2007 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0], a, n, i, s;
2008 if (r.length === 1)
2009 a = n = i = s = r[0];
2010 else if (r.length === 2)
2011 a = i = r[0], s = n = r[1];
2012 else if (r.length === 4) {
2013 var o = x(r, 4);
2014 a = o[0], n = o[1], i = o[2], s = o[3];
2015 }
2016 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;
2017 }, xs = function(e, r) {
2018 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;
2019 }, fi = function(e, r) {
2020 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);
2021 }, ta = function(e, r, a) {
2022 return e.x1 <= r && r <= e.x2 && e.y1 <= a && a <= e.y2;
2023 }, Df = function(e, r) {
2024 return ta(e, r.x, r.y);
2025 }, Ts = function(e, r) {
2026 return ta(e, r.x1, r.y1) && ta(e, r.x2, r.y2);
2027 }, Cs = function(e, r, a, n, i, s, o) {
2028 var u = Fa(i, s), l = i / 2, f = s / 2, h;
2029 {
2030 var v = a - l + u - o, d = n - f - o, c = a + l - u + o, y = d;
2031 if (h = Cr(e, r, a, n, v, d, c, y, !1), h.length > 0)
2032 return h;
2033 }
2034 {
2035 var p = a + l + o, g = n - f + u - o, m = p, b = n + f - u + o;
2036 if (h = Cr(e, r, a, n, p, g, m, b, !1), h.length > 0)
2037 return h;
2038 }
2039 {
2040 var E = a - l + u - o, M = n + f + o, L = a + l - u + o, w = M;
2041 if (h = Cr(e, r, a, n, E, M, L, w, !1), h.length > 0)
2042 return h;
2043 }
2044 {
2045 var k = a - l - o, D = n - f + u - o, F = k, G = n + f - u + o;
2046 if (h = Cr(e, r, a, n, k, D, F, G, !1), h.length > 0)
2047 return h;
2048 }
2049 var N;
2050 {
2051 var X = a - l + u, B = n - f + u;
2052 if (N = Pa(e, r, a, n, X, B, u + o), N.length > 0 && N[0] <= X && N[1] <= B)
2053 return [N[0], N[1]];
2054 }
2055 {
2056 var re = a + l - u, K = n - f + u;
2057 if (N = Pa(e, r, a, n, re, K, u + o), N.length > 0 && N[0] >= re && N[1] <= K)
2058 return [N[0], N[1]];
2059 }
2060 {
2061 var W = a + l - u, ae = n + f - u;
2062 if (N = Pa(e, r, a, n, W, ae, u + o), N.length > 0 && N[0] >= W && N[1] >= ae)
2063 return [N[0], N[1]];
2064 }
2065 {
2066 var ue = a - l + u, me = n + f - u;
2067 if (N = Pa(e, r, a, n, ue, me, u + o), N.length > 0 && N[0] <= ue && N[1] >= me)
2068 return [N[0], N[1]];
2069 }
2070 return [];
2071 }, Sf = function(e, r, a, n, i, s, o) {
2072 var u = o, l = Math.min(a, i), f = Math.max(a, i), h = Math.min(n, s), v = Math.max(n, s);
2073 return l - u <= e && e <= f + u && h - u <= r && r <= v + u;
2074 }, Lf = function(e, r, a, n, i, s, o, u, l) {
2075 var f = {
2076 x1: Math.min(a, o, i) - l,
2077 x2: Math.max(a, o, i) + l,
2078 y1: Math.min(n, u, s) - l,
2079 y2: Math.max(n, u, s) + l
2080 };
2081 return !(e < f.x1 || e > f.x2 || r < f.y1 || r > f.y2);
2082 }, Af = function(e, r, a, n) {
2083 a -= n;
2084 var i = r * r - 4 * e * a;
2085 if (i < 0)
2086 return [];
2087 var s = Math.sqrt(i), o = 2 * e, u = (-r + s) / o, l = (-r - s) / o;
2088 return [u, l];
2089 }, Of = function(e, r, a, n, i) {
2090 var s = 1e-5;
2091 e === 0 && (e = s), r /= e, a /= e, n /= e;
2092 var o, u, l, f, h, v, d, c;
2093 if (u = (3 * a - r * r) / 9, l = -(27 * n) + r * (9 * a - 2 * (r * r)), l /= 54, o = u * u * u + l * l, i[1] = 0, d = r / 3, o > 0) {
2094 h = l + Math.sqrt(o), h = h < 0 ? -Math.pow(-h, 1 / 3) : Math.pow(h, 1 / 3), v = l - Math.sqrt(o), v = v < 0 ? -Math.pow(-v, 1 / 3) : Math.pow(v, 1 / 3), i[0] = -d + h + v, d += (h + v) / 2, i[4] = i[2] = -d, d = Math.sqrt(3) * (-v + h) / 2, i[3] = d, i[5] = -d;
2095 return;
2096 }
2097 if (i[5] = i[3] = 0, o === 0) {
2098 c = l < 0 ? -Math.pow(-l, 1 / 3) : Math.pow(l, 1 / 3), i[0] = -d + 2 * c, i[4] = i[2] = -(c + d);
2099 return;
2100 }
2101 u = -u, f = u * u * u, f = Math.acos(l / Math.sqrt(f)), c = 2 * Math.sqrt(u), i[0] = -d + c * Math.cos(f / 3), i[2] = -d + c * Math.cos((f + 2 * Math.PI) / 3), i[4] = -d + c * Math.cos((f + 4 * Math.PI) / 3);
2102 }, Nf = function(e, r, a, n, i, s, o, u) {
2103 var l = 1 * a * a - 4 * a * i + 2 * a * o + 4 * i * i - 4 * i * o + o * o + n * n - 4 * n * s + 2 * n * u + 4 * s * s - 4 * s * u + u * u, 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 * u - 6 * s * s + 3 * s * u, 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 * u - n * r + 2 * s * s + 2 * s * r - u * r, v = 1 * a * i - a * a + a * e - i * e + n * s - n * n + n * r - s * r, d = [];
2104 Of(l, f, h, v, d);
2105 for (var c = 1e-7, y = [], p = 0; p < 6; p += 2)
2106 Math.abs(d[p + 1]) < c && d[p] >= 0 && d[p] <= 1 && y.push(d[p]);
2107 y.push(1), y.push(0);
2108 for (var g = -1, m, b, E, M = 0; M < y.length; M++)
2109 m = Math.pow(1 - y[M], 2) * a + 2 * (1 - y[M]) * y[M] * i + y[M] * y[M] * o, b = Math.pow(1 - y[M], 2) * n + 2 * (1 - y[M]) * y[M] * s + y[M] * y[M] * u, E = Math.pow(m - e, 2) + Math.pow(b - r, 2), g >= 0 ? E < g && (g = E) : g = E;
2110 return g;
2111 }, If = function(e, r, a, n, i, s) {
2112 var o = [e - a, r - n], u = [i - a, s - n], l = u[0] * u[0] + u[1] * u[1], f = o[0] * o[0] + o[1] * o[1], h = o[0] * u[0] + o[1] * u[1], v = h * h / l;
2113 return h < 0 ? f : v > l ? (e - i) * (e - i) + (r - s) * (r - s) : f - v;
2114 }, Ht = function(e, r, a) {
2115 for (var n, i, s, o, u, l = 0, f = 0; f < a.length / 2; f++)
2116 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))
2117 if (n >= e && e >= s || n <= e && e <= s)
2118 u = (e - n) / (s - n) * (o - i) + i, u > r && l++;
2119 else
2120 continue;
2121 return l % 2 !== 0;
2122 }, pr = function(e, r, a, n, i, s, o, u, l) {
2123 var f = new Array(a.length), h;
2124 u[0] != null ? (h = Math.atan(u[1] / u[0]), u[0] < 0 ? h = h + Math.PI / 2 : h = -h - Math.PI / 2) : h = u;
2125 for (var v = Math.cos(-h), d = Math.sin(-h), c = 0; c < f.length / 2; c++)
2126 f[c * 2] = s / 2 * (a[c * 2] * v - a[c * 2 + 1] * d), f[c * 2 + 1] = o / 2 * (a[c * 2 + 1] * v + a[c * 2] * d), f[c * 2] += n, f[c * 2 + 1] += i;
2127 var y;
2128 if (l > 0) {
2129 var p = yn(f, -l);
2130 y = pn(p);
2131 } else
2132 y = f;
2133 return Ht(e, r, y);
2134 }, Mf = function(e, r, a, n, i, s, o) {
2135 for (var u = new Array(a.length), l = s / 2, f = o / 2, h = ci(s, o), v = h * h, d = 0; d < a.length / 4; d++) {
2136 var c = void 0, y = void 0;
2137 d === 0 ? c = a.length - 2 : c = d * 4 - 2, y = d * 4 + 2;
2138 var p = n + l * a[d * 4], g = i + f * a[d * 4 + 1], m = -a[c] * a[y] - a[c + 1] * a[y + 1], b = h / Math.tan(Math.acos(m) / 2), E = p - b * a[c], M = g - b * a[c + 1], L = p + b * a[y], w = g + b * a[y + 1];
2139 u[d * 4] = E, u[d * 4 + 1] = M, u[d * 4 + 2] = L, u[d * 4 + 3] = w;
2140 var k = a[c + 1], D = -a[c], F = k * a[y] + D * a[y + 1];
2141 F < 0 && (k *= -1, D *= -1);
2142 var G = E + k * h, N = M + D * h, X = Math.pow(G - e, 2) + Math.pow(N - r, 2);
2143 if (X <= v)
2144 return !0;
2145 }
2146 return Ht(e, r, u);
2147 }, pn = function(e) {
2148 for (var r = new Array(e.length / 2), a, n, i, s, o, u, l, f, h = 0; h < e.length / 4; h++) {
2149 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], u = e[(h + 1) * 4 + 1], l = e[(h + 1) * 4 + 2], f = e[(h + 1) * 4 + 3]) : (o = e[0], u = e[1], l = e[2], f = e[3]);
2150 var v = Cr(a, n, i, s, o, u, l, f, !0);
2151 r[h * 2] = v[0], r[h * 2 + 1] = v[1];
2152 }
2153 return r;
2154 }, yn = function(e, r) {
2155 for (var a = new Array(e.length * 2), n, i, s, o, u = 0; u < e.length / 2; u++) {
2156 n = e[u * 2], i = e[u * 2 + 1], u < e.length / 2 - 1 ? (s = e[(u + 1) * 2], o = e[(u + 1) * 2 + 1]) : (s = e[0], o = e[1]);
2157 var l = o - i, f = -(s - n), h = Math.sqrt(l * l + f * f), v = l / h, d = f / h;
2158 a[u * 4] = n + v * r, a[u * 4 + 1] = i + d * r, a[u * 4 + 2] = s + v * r, a[u * 4 + 3] = o + d * r;
2159 }
2160 return a;
2161 }, Rf = function(e, r, a, n, i, s) {
2162 var o = a - e, u = n - r;
2163 o /= i, u /= s;
2164 var l = Math.sqrt(o * o + u * u), f = l - 1;
2165 if (f < 0)
2166 return [];
2167 var h = f / l;
2168 return [(a - e) * h + e, (n - r) * h + r];
2169 }, Gr = function(e, r, a, n, i, s, o) {
2170 return e -= i, r -= s, e /= a / 2 + o, r /= n / 2 + o, e * e + r * r <= 1;
2171 }, Pa = function(e, r, a, n, i, s, o) {
2172 var u = [a - e, n - r], l = [e - i, r - s], f = u[0] * u[0] + u[1] * u[1], h = 2 * (l[0] * u[0] + l[1] * u[1]), v = l[0] * l[0] + l[1] * l[1] - o * o, d = h * h - 4 * f * v;
2173 if (d < 0)
2174 return [];
2175 var c = (-h + Math.sqrt(d)) / (2 * f), y = (-h - Math.sqrt(d)) / (2 * f), p = Math.min(c, y), g = Math.max(c, y), m = [];
2176 if (p >= 0 && p <= 1 && m.push(p), g >= 0 && g <= 1 && m.push(g), m.length === 0)
2177 return [];
2178 var b = m[0] * u[0] + e, E = m[0] * u[1] + r;
2179 if (m.length > 1) {
2180 if (m[0] == m[1])
2181 return [b, E];
2182 var M = m[1] * u[0] + e, L = m[1] * u[1] + r;
2183 return [b, E, M, L];
2184 } else
2185 return [b, E];
2186 }, hi = function(e, r, a) {
2187 return r <= e && e <= a || a <= e && e <= r ? e : e <= r && r <= a || a <= r && r <= e ? r : a;
2188 }, Cr = function(e, r, a, n, i, s, o, u, l) {
2189 var f = e - i, h = a - e, v = o - i, d = r - s, c = n - r, y = u - s, p = v * d - y * f, g = h * d - c * f, m = y * h - v * c;
2190 if (m !== 0) {
2191 var b = p / m, E = g / m, M = 1e-3, L = 0 - M, w = 1 + M;
2192 return L <= b && b <= w && L <= E && E <= w ? [e + b * h, r + b * c] : l ? [e + b * h, r + b * c] : [];
2193 } else
2194 return p === 0 || g === 0 ? hi(e, a, o) === o ? [o, u] : hi(e, a, i) === i ? [i, s] : hi(i, o, a) === a ? [a, n] : [] : [];
2195 }, Ba = function(e, r, a, n, i, s, o, u) {
2196 var l = [], f, h = new Array(a.length), v = !0;
2197 s == null && (v = !1);
2198 var d;
2199 if (v) {
2200 for (var c = 0; c < h.length / 2; c++)
2201 h[c * 2] = a[c * 2] * s + n, h[c * 2 + 1] = a[c * 2 + 1] * o + i;
2202 if (u > 0) {
2203 var y = yn(h, -u);
2204 d = pn(y);
2205 } else
2206 d = h;
2207 } else
2208 d = a;
2209 for (var p, g, m, b, E = 0; E < d.length / 2; E++)
2210 p = d[E * 2], g = d[E * 2 + 1], E < d.length / 2 - 1 ? (m = d[(E + 1) * 2], b = d[(E + 1) * 2 + 1]) : (m = d[0], b = d[1]), f = Cr(e, r, n, i, p, g, m, b), f.length !== 0 && l.push(f[0], f[1]);
2211 return l;
2212 }, kf = function(e, r, a, n, i, s, o, u) {
2213 for (var l = [], f, h = new Array(a.length), v = s / 2, d = o / 2, c = ci(s, o), y = 0; y < a.length / 4; y++) {
2214 var p = void 0, g = void 0;
2215 y === 0 ? p = a.length - 2 : p = y * 4 - 2, g = y * 4 + 2;
2216 var m = n + v * a[y * 4], b = i + d * a[y * 4 + 1], E = -a[p] * a[g] - a[p + 1] * a[g + 1], M = c / Math.tan(Math.acos(E) / 2), L = m - M * a[p], w = b - M * a[p + 1], k = m + M * a[g], D = b + M * a[g + 1];
2217 y === 0 ? (h[a.length - 2] = L, h[a.length - 1] = w) : (h[y * 4 - 2] = L, h[y * 4 - 1] = w), h[y * 4] = k, h[y * 4 + 1] = D;
2218 var F = a[p + 1], G = -a[p], N = F * a[g] + G * a[g + 1];
2219 N < 0 && (F *= -1, G *= -1);
2220 var X = L + F * c, B = w + G * c;
2221 f = Pa(e, r, n, i, X, B, c), f.length !== 0 && l.push(f[0], f[1]);
2222 }
2223 for (var re = 0; re < h.length / 4; re++)
2224 f = Cr(e, r, n, i, h[re * 4], h[re * 4 + 1], h[re * 4 + 2], h[re * 4 + 3], !1), f.length !== 0 && l.push(f[0], f[1]);
2225 if (l.length > 2) {
2226 for (var K = [l[0], l[1]], W = Math.pow(K[0] - e, 2) + Math.pow(K[1] - r, 2), ae = 1; ae < l.length / 2; ae++) {
2227 var ue = Math.pow(l[ae * 2] - e, 2) + Math.pow(l[ae * 2 + 1] - r, 2);
2228 ue <= W && (K[0] = l[ae * 2], K[1] = l[ae * 2 + 1], W = ue);
2229 }
2230 return K;
2231 }
2232 return l;
2233 }, mn = function(e, r, a) {
2234 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;
2235 return s < 0 && (s = 1e-5), [r[0] + s * n[0], r[1] + s * n[1]];
2236 }, $t = function(e, r) {
2237 var a = vi(e, r);
2238 return a = Ds(a), a;
2239 }, Ds = function(e) {
2240 for (var r, a, n = e.length / 2, i = 1 / 0, s = 1 / 0, o = -1 / 0, u = -1 / 0, l = 0; l < n; l++)
2241 r = e[2 * l], a = e[2 * l + 1], i = Math.min(i, r), o = Math.max(o, r), s = Math.min(s, a), u = Math.max(u, a);
2242 for (var f = 2 / (o - i), h = 2 / (u - s), v = 0; v < n; v++)
2243 r = e[2 * v] = e[2 * v] * f, a = e[2 * v + 1] = e[2 * v + 1] * h, i = Math.min(i, r), o = Math.max(o, r), s = Math.min(s, a), u = Math.max(u, a);
2244 if (s < -1)
2245 for (var d = 0; d < n; d++)
2246 a = e[2 * d + 1] = e[2 * d + 1] + (-1 - s);
2247 return e;
2248 }, vi = function(e, r) {
2249 var a = 1 / e * 2 * Math.PI, n = e % 2 === 0 ? Math.PI / 2 + a / 2 : Math.PI / 2;
2250 n += r;
2251 for (var i = new Array(e * 2), s, o = 0; o < e; o++)
2252 s = o * a + n, i[2 * o] = Math.cos(s), i[2 * o + 1] = Math.sin(-s);
2253 return i;
2254 }, Fa = function(e, r) {
2255 return Math.min(e / 4, r / 4, 8);
2256 }, ci = function(e, r) {
2257 return Math.min(e / 10, r / 10, 8);
2258 }, Ss = function() {
2259 return 8;
2260 }, Pf = function(e, r, a) {
2261 return [e - 2 * r + a, 2 * (r - e), e];
2262 }, di = function(e, r) {
2263 return {
2264 heightOffset: Math.min(15, 0.05 * r),
2265 widthOffset: Math.min(100, 0.25 * e),
2266 ctrlPtOffsetPct: 0.05
2267 };
2268 }, Bf = At({
2269 dampingFactor: 0.8,
2270 precision: 1e-6,
2271 iterations: 200,
2272 weight: function(e) {
2273 return 1;
2274 }
2275 }), Ff = {
2276 pageRank: function(e) {
2277 for (var r = Bf(e), a = r.dampingFactor, n = r.precision, i = r.iterations, s = r.weight, o = this._private.cy, u = this.byGroup(), l = u.nodes, f = u.edges, h = l.length, v = h * h, d = f.length, c = new Array(v), y = new Array(h), p = (1 - a) / h, g = 0; g < h; g++) {
2278 for (var m = 0; m < h; m++) {
2279 var b = g * h + m;
2280 c[b] = 0;
2281 }
2282 y[g] = 0;
2283 }
2284 for (var E = 0; E < d; E++) {
2285 var M = f[E], L = M.data("source"), w = M.data("target");
2286 if (L !== w) {
2287 var k = l.indexOfId(L), D = l.indexOfId(w), F = s(M), G = D * h + k;
2288 c[G] += F, y[k] += F;
2289 }
2290 }
2291 for (var N = 1 / h + p, X = 0; X < h; X++)
2292 if (y[X] === 0)
2293 for (var B = 0; B < h; B++) {
2294 var re = B * h + X;
2295 c[re] = N;
2296 }
2297 else
2298 for (var K = 0; K < h; K++) {
2299 var W = K * h + X;
2300 c[W] = c[W] / y[X] + p;
2301 }
2302 for (var ae = new Array(h), ue = new Array(h), me, ie = 0; ie < h; ie++)
2303 ae[ie] = 1;
2304 for (var ge = 0; ge < i; ge++) {
2305 for (var Ee = 0; Ee < h; Ee++)
2306 ue[Ee] = 0;
2307 for (var Ce = 0; Ce < h; Ce++)
2308 for (var we = 0; we < h; we++) {
2309 var De = Ce * h + we;
2310 ue[Ce] += c[De] * ae[we];
2311 }
2312 bf(ue), me = ae, ae = ue, ue = me;
2313 for (var se = 0, xe = 0; xe < h; xe++) {
2314 var Le = me[xe] - ae[xe];
2315 se += Le * Le;
2316 }
2317 if (se < n)
2318 break;
2319 }
2320 var Se = {
2321 rank: function(Fe) {
2322 return Fe = o.collection(Fe)[0], ae[l.indexOf(Fe)];
2323 }
2324 };
2325 return Se;
2326 }
2327 // pageRank
2328 }, Ls = At({
2329 root: null,
2330 weight: function(e) {
2331 return 1;
2332 },
2333 directed: !1,
2334 alpha: 0
2335 }), ra = {
2336 degreeCentralityNormalized: function(e) {
2337 e = Ls(e);
2338 var r = this.cy(), a = this.nodes(), n = a.length;
2339 if (e.directed) {
2340 for (var f = {}, h = {}, v = 0, d = 0, c = 0; c < n; c++) {
2341 var y = a[c], p = y.id();
2342 e.root = y;
2343 var g = this.degreeCentrality(e);
2344 v < g.indegree && (v = g.indegree), d < g.outdegree && (d = g.outdegree), f[p] = g.indegree, h[p] = g.outdegree;
2345 }
2346 return {
2347 indegree: function(b) {
2348 return v == 0 ? 0 : (ee(b) && (b = r.filter(b)), f[b.id()] / v);
2349 },
2350 outdegree: function(b) {
2351 return d === 0 ? 0 : (ee(b) && (b = r.filter(b)), h[b.id()] / d);
2352 }
2353 };
2354 } else {
2355 for (var i = {}, s = 0, o = 0; o < n; o++) {
2356 var u = a[o];
2357 e.root = u;
2358 var l = this.degreeCentrality(e);
2359 s < l.degree && (s = l.degree), i[u.id()] = l.degree;
2360 }
2361 return {
2362 degree: function(b) {
2363 return s === 0 ? 0 : (ee(b) && (b = r.filter(b)), i[b.id()] / s);
2364 }
2365 };
2366 }
2367 },
2368 // degreeCentralityNormalized
2369 // Implemented from the algorithm in Opsahl's paper
2370 // "Node centrality in weighted networks: Generalizing degree and shortest paths"
2371 // check the heading 2 "Degree"
2372 degreeCentrality: function(e) {
2373 e = Ls(e);
2374 var r = this.cy(), a = this, n = e, i = n.root, s = n.weight, o = n.directed, u = n.alpha;
2375 if (i = r.collection(i)[0], o) {
2376 for (var d = i.connectedEdges(), c = d.filter(function(L) {
2377 return L.target().same(i) && a.has(L);
2378 }), y = d.filter(function(L) {
2379 return L.source().same(i) && a.has(L);
2380 }), p = c.length, g = y.length, m = 0, b = 0, E = 0; E < c.length; E++)
2381 m += s(c[E]);
2382 for (var M = 0; M < y.length; M++)
2383 b += s(y[M]);
2384 return {
2385 indegree: Math.pow(p, 1 - u) * Math.pow(m, u),
2386 outdegree: Math.pow(g, 1 - u) * Math.pow(b, u)
2387 };
2388 } else {
2389 for (var l = i.connectedEdges().intersection(a), f = l.length, h = 0, v = 0; v < l.length; v++)
2390 h += s(l[v]);
2391 return {
2392 degree: Math.pow(f, 1 - u) * Math.pow(h, u)
2393 };
2394 }
2395 }
2396 // degreeCentrality
2397 };
2398 ra.dc = ra.degreeCentrality, ra.dcn = ra.degreeCentralityNormalised = ra.degreeCentralityNormalized;
2399 var As = At({
2400 harmonic: !0,
2401 weight: function() {
2402 return 1;
2403 },
2404 directed: !1,
2405 root: null
2406 }), aa = {
2407 closenessCentralityNormalized: function(e) {
2408 for (var r = As(e), a = r.harmonic, n = r.weight, i = r.directed, s = this.cy(), o = {}, u = 0, l = this.nodes(), f = this.floydWarshall({
2409 weight: n,
2410 directed: i
2411 }), h = 0; h < l.length; h++) {
2412 for (var v = 0, d = l[h], c = 0; c < l.length; c++)
2413 if (h !== c) {
2414 var y = f.distance(d, l[c]);
2415 a ? v += 1 / y : v += y;
2416 }
2417 a || (v = 1 / v), u < v && (u = v), o[d.id()] = v;
2418 }
2419 return {
2420 closeness: function(g) {
2421 return u == 0 ? 0 : (ee(g) ? g = s.filter(g)[0].id() : g = g.id(), o[g] / u);
2422 }
2423 };
2424 },
2425 // Implemented from pseudocode from wikipedia
2426 closenessCentrality: function(e) {
2427 var r = As(e), a = r.root, n = r.weight, i = r.directed, s = r.harmonic;
2428 a = this.filter(a)[0];
2429 for (var o = this.dijkstra({
2430 root: a,
2431 weight: n,
2432 directed: i
2433 }), u = 0, l = this.nodes(), f = 0; f < l.length; f++) {
2434 var h = l[f];
2435 if (!h.same(a)) {
2436 var v = o.distanceTo(h);
2437 s ? u += 1 / v : u += v;
2438 }
2439 }
2440 return s ? u : 1 / u;
2441 }
2442 // closenessCentrality
2443 };
2444 aa.cc = aa.closenessCentrality, aa.ccn = aa.closenessCentralityNormalised = aa.closenessCentralityNormalized;
2445 var Gf = At({
2446 weight: null,
2447 directed: !1
2448 }), gi = {
2449 // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes
2450 betweennessCentrality: function(e) {
2451 for (var r = Gf(e), a = r.directed, n = r.weight, i = n != null, s = this.cy(), o = this.nodes(), u = {}, l = {}, f = 0, h = {
2452 set: function(b, E) {
2453 l[b] = E, E > f && (f = E);
2454 },
2455 get: function(b) {
2456 return l[b];
2457 }
2458 }, v = 0; v < o.length; v++) {
2459 var d = o[v], c = d.id();
2460 a ? u[c] = d.outgoers().nodes() : u[c] = d.openNeighborhood().nodes(), h.set(c, 0);
2461 }
2462 for (var y = function(b) {
2463 for (var E = o[b].id(), M = [], L = {}, w = {}, k = {}, D = new Ra(function(we, De) {
2464 return k[we] - k[De];
2465 }), F = 0; F < o.length; F++) {
2466 var G = o[F].id();
2467 L[G] = [], w[G] = 0, k[G] = 1 / 0;
2468 }
2469 for (w[E] = 1, k[E] = 0, D.push(E); !D.empty(); ) {
2470 var N = D.pop();
2471 if (M.push(N), i)
2472 for (var X = 0; X < u[N].length; X++) {
2473 var B = u[N][X], re = s.getElementById(N), K = void 0;
2474 re.edgesTo(B).length > 0 ? K = re.edgesTo(B)[0] : K = B.edgesTo(re)[0];
2475 var W = n(K);
2476 B = B.id(), k[B] > k[N] + W && (k[B] = k[N] + W, D.nodes.indexOf(B) < 0 ? D.push(B) : D.updateItem(B), w[B] = 0, L[B] = []), k[B] == k[N] + W && (w[B] = w[B] + w[N], L[B].push(N));
2477 }
2478 else
2479 for (var ae = 0; ae < u[N].length; ae++) {
2480 var ue = u[N][ae].id();
2481 k[ue] == 1 / 0 && (D.push(ue), k[ue] = k[N] + 1), k[ue] == k[N] + 1 && (w[ue] = w[ue] + w[N], L[ue].push(N));
2482 }
2483 }
2484 for (var me = {}, ie = 0; ie < o.length; ie++)
2485 me[o[ie].id()] = 0;
2486 for (; M.length > 0; ) {
2487 for (var ge = M.pop(), Ee = 0; Ee < L[ge].length; Ee++) {
2488 var Ce = L[ge][Ee];
2489 me[Ce] = me[Ce] + w[Ce] / w[ge] * (1 + me[ge]);
2490 }
2491 ge != o[b].id() && h.set(ge, h.get(ge) + me[ge]);
2492 }
2493 }, p = 0; p < o.length; p++)
2494 y(p);
2495 var g = {
2496 betweenness: function(b) {
2497 var E = s.collection(b).id();
2498 return h.get(E);
2499 },
2500 betweennessNormalized: function(b) {
2501 if (f == 0)
2502 return 0;
2503 var E = s.collection(b).id();
2504 return h.get(E) / f;
2505 }
2506 };
2507 return g.betweennessNormalised = g.betweennessNormalized, g;
2508 }
2509 // betweennessCentrality
2510 };
2511 gi.bc = gi.betweennessCentrality;
2512 var zf = At({
2513 expandFactor: 2,
2514 // affects time of computation and cluster granularity to some extent: M * M
2515 inflateFactor: 2,
2516 // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j)
2517 multFactor: 1,
2518 // optional self loops for each node. Use a neutral value to improve cluster computations.
2519 maxIterations: 20,
2520 // maximum number of iterations of the MCL algorithm in a single run
2521 attributes: [
2522 // attributes/features used to group nodes, ie. similarity values between nodes
2523 function(t) {
2524 return 1;
2525 }
2526 ]
2527 }), Vf = function(e) {
2528 return zf(e);
2529 }, Uf = function(e, r) {
2530 for (var a = 0, n = 0; n < r.length; n++)
2531 a += r[n](e);
2532 return a;
2533 }, $f = function(e, r, a) {
2534 for (var n = 0; n < r; n++)
2535 e[n * r + n] = a;
2536 }, Os = function(e, r) {
2537 for (var a, n = 0; n < r; n++) {
2538 a = 0;
2539 for (var i = 0; i < r; i++)
2540 a += e[i * r + n];
2541 for (var s = 0; s < r; s++)
2542 e[s * r + n] = e[s * r + n] / a;
2543 }
2544 }, _f = function(e, r, a) {
2545 for (var n = new Array(a * a), i = 0; i < a; i++) {
2546 for (var s = 0; s < a; s++)
2547 n[i * a + s] = 0;
2548 for (var o = 0; o < a; o++)
2549 for (var u = 0; u < a; u++)
2550 n[i * a + u] += e[i * a + o] * r[o * a + u];
2551 }
2552 return n;
2553 }, Yf = function(e, r, a) {
2554 for (var n = e.slice(0), i = 1; i < a; i++)
2555 e = _f(e, n, r);
2556 return e;
2557 }, Hf = function(e, r, a) {
2558 for (var n = new Array(r * r), i = 0; i < r * r; i++)
2559 n[i] = Math.pow(e[i], a);
2560 return Os(n, r), n;
2561 }, Xf = function(e, r, a, n) {
2562 for (var i = 0; i < a; i++) {
2563 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);
2564 if (s !== o)
2565 return !1;
2566 }
2567 return !0;
2568 }, Wf = function(e, r, a, n) {
2569 for (var i = [], s = 0; s < r; s++) {
2570 for (var o = [], u = 0; u < r; u++)
2571 Math.round(e[s * r + u] * 1e3) / 1e3 > 0 && o.push(a[u]);
2572 o.length !== 0 && i.push(n.collection(o));
2573 }
2574 return i;
2575 }, qf = function(e, r) {
2576 for (var a = 0; a < e.length; a++)
2577 if (!r[a] || e[a].id() !== r[a].id())
2578 return !1;
2579 return !0;
2580 }, Kf = function(e) {
2581 for (var r = 0; r < e.length; r++)
2582 for (var a = 0; a < e.length; a++)
2583 r != a && qf(e[r], e[a]) && e.splice(a, 1);
2584 return e;
2585 }, Ns = function(e) {
2586 for (var r = this.nodes(), a = this.edges(), n = this.cy(), i = Vf(e), s = {}, o = 0; o < r.length; o++)
2587 s[r[o].id()] = o;
2588 for (var u = r.length, l = u * u, f = new Array(l), h, v = 0; v < l; v++)
2589 f[v] = 0;
2590 for (var d = 0; d < a.length; d++) {
2591 var c = a[d], y = s[c.source().id()], p = s[c.target().id()], g = Uf(c, i.attributes);
2592 f[y * u + p] += g, f[p * u + y] += g;
2593 }
2594 $f(f, u, i.multFactor), Os(f, u);
2595 for (var m = !0, b = 0; m && b < i.maxIterations; )
2596 m = !1, h = Yf(f, u, i.expandFactor), f = Hf(h, u, i.inflateFactor), Xf(f, h, l, 4) || (m = !0), b++;
2597 var E = Wf(f, u, r, n);
2598 return E = Kf(E), E;
2599 }, Zf = {
2600 markovClustering: Ns,
2601 mcl: Ns
2602 }, Qf = function(e) {
2603 return e;
2604 }, Is = function(e, r) {
2605 return Math.abs(r - e);
2606 }, Ms = function(e, r, a) {
2607 return e + Is(r, a);
2608 }, Rs = function(e, r, a) {
2609 return e + Math.pow(a - r, 2);
2610 }, Jf = function(e) {
2611 return Math.sqrt(e);
2612 }, jf = function(e, r, a) {
2613 return Math.max(e, Is(r, a));
2614 }, Ga = function(e, r, a, n, i) {
2615 for (var s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : Qf, o = n, u, l, f = 0; f < e; f++)
2616 u = r(f), l = a(f), o = i(o, u, l);
2617 return s(o);
2618 }, na = {
2619 euclidean: function(e, r, a) {
2620 return e >= 2 ? Ga(e, r, a, 0, Rs, Jf) : Ga(e, r, a, 0, Ms);
2621 },
2622 squaredEuclidean: function(e, r, a) {
2623 return Ga(e, r, a, 0, Rs);
2624 },
2625 manhattan: function(e, r, a) {
2626 return Ga(e, r, a, 0, Ms);
2627 },
2628 max: function(e, r, a) {
2629 return Ga(e, r, a, -1 / 0, jf);
2630 }
2631 };
2632 na["squared-euclidean"] = na.squaredEuclidean, na.squaredeuclidean = na.squaredEuclidean;
2633 function bn(t, e, r, a, n, i) {
2634 var s;
2635 return H(t) ? s = t : s = na[t] || na.euclidean, e === 0 && H(t) ? s(n, i) : s(e, r, a, n, i);
2636 }
2637 var eh = At({
2638 k: 2,
2639 m: 2,
2640 sensitivityThreshold: 1e-4,
2641 distance: "euclidean",
2642 maxIterations: 10,
2643 attributes: [],
2644 testMode: !1,
2645 testCentroids: null
2646 }), pi = function(e) {
2647 return eh(e);
2648 }, En = function(e, r, a, n, i) {
2649 var s = i !== "kMedoids", o = s ? function(h) {
2650 return a[h];
2651 } : function(h) {
2652 return n[h](a);
2653 }, u = function(v) {
2654 return n[v](r);
2655 }, l = a, f = r;
2656 return bn(e, n.length, o, u, l, f);
2657 }, yi = function(e, r, a) {
2658 for (var n = a.length, i = new Array(n), s = new Array(n), o = new Array(r), u = null, l = 0; l < n; l++)
2659 i[l] = e.min(a[l]).value, s[l] = e.max(a[l]).value;
2660 for (var f = 0; f < r; f++) {
2661 u = [];
2662 for (var h = 0; h < n; h++)
2663 u[h] = Math.random() * (s[h] - i[h]) + i[h];
2664 o[f] = u;
2665 }
2666 return o;
2667 }, ks = function(e, r, a, n, i) {
2668 for (var s = 1 / 0, o = 0, u = 0; u < r.length; u++) {
2669 var l = En(a, e, r[u], n, i);
2670 l < s && (s = l, o = u);
2671 }
2672 return o;
2673 }, Ps = function(e, r, a) {
2674 for (var n = [], i = null, s = 0; s < r.length; s++)
2675 i = r[s], a[i.id()] === e && n.push(i);
2676 return n;
2677 }, th = function(e, r, a) {
2678 return Math.abs(r - e) <= a;
2679 }, rh = function(e, r, a) {
2680 for (var n = 0; n < e.length; n++)
2681 for (var i = 0; i < e[n].length; i++) {
2682 var s = Math.abs(e[n][i] - r[n][i]);
2683 if (s > a)
2684 return !1;
2685 }
2686 return !0;
2687 }, ah = function(e, r, a) {
2688 for (var n = 0; n < a; n++)
2689 if (e === r[n])
2690 return !0;
2691 return !1;
2692 }, Bs = function(e, r) {
2693 var a = new Array(r);
2694 if (e.length < 50)
2695 for (var n = 0; n < r; n++) {
2696 for (var i = e[Math.floor(Math.random() * e.length)]; ah(i, a, n); )
2697 i = e[Math.floor(Math.random() * e.length)];
2698 a[n] = i;
2699 }
2700 else
2701 for (var s = 0; s < r; s++)
2702 a[s] = e[Math.floor(Math.random() * e.length)];
2703 return a;
2704 }, Fs = function(e, r, a) {
2705 for (var n = 0, i = 0; i < r.length; i++)
2706 n += En("manhattan", r[i], e, a, "kMedoids");
2707 return n;
2708 }, nh = function(e) {
2709 var r = this.cy(), a = this.nodes(), n = null, i = pi(e), s = new Array(i.k), o = {}, u;
2710 i.testMode ? typeof i.testCentroids == "number" ? (i.testCentroids, u = yi(a, i.k, i.attributes)) : _(i.testCentroids) === "object" ? u = i.testCentroids : u = yi(a, i.k, i.attributes) : u = yi(a, i.k, i.attributes);
2711 for (var l = !0, f = 0; l && f < i.maxIterations; ) {
2712 for (var h = 0; h < a.length; h++)
2713 n = a[h], o[n.id()] = ks(n, u, i.distance, i.attributes, "kMeans");
2714 l = !1;
2715 for (var v = 0; v < i.k; v++) {
2716 var d = Ps(v, a, o);
2717 if (d.length !== 0) {
2718 for (var c = i.attributes.length, y = u[v], p = new Array(c), g = new Array(c), m = 0; m < c; m++) {
2719 g[m] = 0;
2720 for (var b = 0; b < d.length; b++)
2721 n = d[b], g[m] += i.attributes[m](n);
2722 p[m] = g[m] / d.length, th(p[m], y[m], i.sensitivityThreshold) || (l = !0);
2723 }
2724 u[v] = p, s[v] = r.collection(d);
2725 }
2726 }
2727 f++;
2728 }
2729 return s;
2730 }, ih = function(e) {
2731 var r = this.cy(), a = this.nodes(), n = null, i = pi(e), s = new Array(i.k), o, u = {}, l, f = new Array(i.k);
2732 i.testMode ? typeof i.testCentroids == "number" || (_(i.testCentroids) === "object" ? o = i.testCentroids : o = Bs(a, i.k)) : o = Bs(a, i.k);
2733 for (var h = !0, v = 0; h && v < i.maxIterations; ) {
2734 for (var d = 0; d < a.length; d++)
2735 n = a[d], u[n.id()] = ks(n, o, i.distance, i.attributes, "kMedoids");
2736 h = !1;
2737 for (var c = 0; c < o.length; c++) {
2738 var y = Ps(c, a, u);
2739 if (y.length !== 0) {
2740 f[c] = Fs(o[c], y, i.attributes);
2741 for (var p = 0; p < y.length; p++)
2742 l = Fs(y[p], y, i.attributes), l < f[c] && (f[c] = l, o[c] = y[p], h = !0);
2743 s[c] = r.collection(y);
2744 }
2745 }
2746 v++;
2747 }
2748 return s;
2749 }, sh = function(e, r, a, n, i) {
2750 for (var s, o, u = 0; u < r.length; u++)
2751 for (var l = 0; l < e.length; l++)
2752 n[u][l] = Math.pow(a[u][l], i.m);
2753 for (var f = 0; f < e.length; f++)
2754 for (var h = 0; h < i.attributes.length; h++) {
2755 s = 0, o = 0;
2756 for (var v = 0; v < r.length; v++)
2757 s += n[v][f] * i.attributes[h](r[v]), o += n[v][f];
2758 e[f][h] = s / o;
2759 }
2760 }, oh = function(e, r, a, n, i) {
2761 for (var s = 0; s < e.length; s++)
2762 r[s] = e[s].slice();
2763 for (var o, u, l, f = 2 / (i.m - 1), h = 0; h < a.length; h++)
2764 for (var v = 0; v < n.length; v++) {
2765 o = 0;
2766 for (var d = 0; d < a.length; d++)
2767 u = En(i.distance, n[v], a[h], i.attributes, "cmeans"), l = En(i.distance, n[v], a[d], i.attributes, "cmeans"), o += Math.pow(u / l, f);
2768 e[v][h] = 1 / o;
2769 }
2770 }, lh = function(e, r, a, n) {
2771 for (var i = new Array(a.k), s = 0; s < i.length; s++)
2772 i[s] = [];
2773 for (var o, u, l = 0; l < r.length; l++) {
2774 o = -1 / 0, u = -1;
2775 for (var f = 0; f < r[0].length; f++)
2776 r[l][f] > o && (o = r[l][f], u = f);
2777 i[u].push(e[l]);
2778 }
2779 for (var h = 0; h < i.length; h++)
2780 i[h] = n.collection(i[h]);
2781 return i;
2782 }, Gs = function(e) {
2783 var r = this.cy(), a = this.nodes(), n = pi(e), i, s, o, u, l;
2784 u = new Array(a.length);
2785 for (var f = 0; f < a.length; f++)
2786 u[f] = new Array(n.k);
2787 o = new Array(a.length);
2788 for (var h = 0; h < a.length; h++)
2789 o[h] = new Array(n.k);
2790 for (var v = 0; v < a.length; v++) {
2791 for (var d = 0, c = 0; c < n.k; c++)
2792 o[v][c] = Math.random(), d += o[v][c];
2793 for (var y = 0; y < n.k; y++)
2794 o[v][y] = o[v][y] / d;
2795 }
2796 s = new Array(n.k);
2797 for (var p = 0; p < n.k; p++)
2798 s[p] = new Array(n.attributes.length);
2799 l = new Array(a.length);
2800 for (var g = 0; g < a.length; g++)
2801 l[g] = new Array(n.k);
2802 for (var m = !0, b = 0; m && b < n.maxIterations; )
2803 m = !1, sh(s, a, o, l, n), oh(o, u, s, a, n), rh(o, u, n.sensitivityThreshold) || (m = !0), b++;
2804 return i = lh(a, o, n, r), {
2805 clusters: i,
2806 degreeOfMembership: o
2807 };
2808 }, uh = {
2809 kMeans: nh,
2810 kMedoids: ih,
2811 fuzzyCMeans: Gs,
2812 fcm: Gs
2813 }, fh = At({
2814 distance: "euclidean",
2815 // distance metric to compare nodes
2816 linkage: "min",
2817 // linkage criterion : how to determine the distance between clusters of nodes
2818 mode: "threshold",
2819 // mode:'threshold' => clusters must be threshold distance apart
2820 threshold: 1 / 0,
2821 // the distance threshold
2822 // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters
2823 addDendrogram: !1,
2824 // whether to add the dendrogram to the graph for viz
2825 dendrogramDepth: 0,
2826 // depth at which dendrogram branches are merged into the returned clusters
2827 attributes: []
2828 // array of attr functions
2829 }), hh = {
2830 single: "min",
2831 complete: "max"
2832 }, vh = function(e) {
2833 var r = fh(e), a = hh[r.linkage];
2834 return a != null && (r.linkage = a), r;
2835 }, zs = function(e, r, a, n, i) {
2836 for (var s = 0, o = 1 / 0, u, l = i.attributes, f = function(D, F) {
2837 return bn(i.distance, l.length, function(G) {
2838 return l[G](D);
2839 }, function(G) {
2840 return l[G](F);
2841 }, D, F);
2842 }, h = 0; h < e.length; h++) {
2843 var v = e[h].key, d = a[v][n[v]];
2844 d < o && (s = v, o = d);
2845 }
2846 if (i.mode === "threshold" && o >= i.threshold || i.mode === "dendrogram" && e.length === 1)
2847 return !1;
2848 var c = r[s], y = r[n[s]], p;
2849 i.mode === "dendrogram" ? p = {
2850 left: c,
2851 right: y,
2852 key: c.key
2853 } : p = {
2854 value: c.value.concat(y.value),
2855 key: c.key
2856 }, e[c.index] = p, e.splice(y.index, 1), r[c.key] = p;
2857 for (var g = 0; g < e.length; g++) {
2858 var m = e[g];
2859 c.key === m.key ? u = 1 / 0 : i.linkage === "min" ? (u = a[c.key][m.key], a[c.key][m.key] > a[y.key][m.key] && (u = a[y.key][m.key])) : i.linkage === "max" ? (u = a[c.key][m.key], a[c.key][m.key] < a[y.key][m.key] && (u = a[y.key][m.key])) : i.linkage === "mean" ? u = (a[c.key][m.key] * c.size + a[y.key][m.key] * y.size) / (c.size + y.size) : i.mode === "dendrogram" ? u = f(m.value, c.value) : u = f(m.value[0], c.value[0]), a[c.key][m.key] = a[m.key][c.key] = u;
2860 }
2861 for (var b = 0; b < e.length; b++) {
2862 var E = e[b].key;
2863 if (n[E] === c.key || n[E] === y.key) {
2864 for (var M = E, L = 0; L < e.length; L++) {
2865 var w = e[L].key;
2866 a[E][w] < a[E][M] && (M = w);
2867 }
2868 n[E] = M;
2869 }
2870 e[b].index = b;
2871 }
2872 return c.key = y.key = c.index = y.index = null, !0;
2873 }, wn = function t(e, r, a) {
2874 e && (e.value ? r.push(e.value) : (e.left && t(e.left, r), e.right && t(e.right, r)));
2875 }, ch = function t(e, r) {
2876 if (!e)
2877 return "";
2878 if (e.left && e.right) {
2879 var a = t(e.left, r), n = t(e.right, r), i = r.add({
2880 group: "nodes",
2881 data: {
2882 id: a + "," + n
2883 }
2884 });
2885 return r.add({
2886 group: "edges",
2887 data: {
2888 source: a,
2889 target: i.id()
2890 }
2891 }), r.add({
2892 group: "edges",
2893 data: {
2894 source: n,
2895 target: i.id()
2896 }
2897 }), i.id();
2898 } else if (e.value)
2899 return e.value.id();
2900 }, dh = function t(e, r, a) {
2901 if (!e)
2902 return [];
2903 var n = [], i = [], s = [];
2904 return r === 0 ? (e.left && wn(e.left, n), e.right && wn(e.right, i), s = n.concat(i), [a.collection(s)]) : r === 1 ? e.value ? [a.collection(e.value)] : (e.left && wn(e.left, n), e.right && wn(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));
2905 }, Vs = function(e) {
2906 for (var r = this.cy(), a = this.nodes(), n = vh(e), i = n.attributes, s = function(b, E) {
2907 return bn(n.distance, i.length, function(M) {
2908 return i[M](b);
2909 }, function(M) {
2910 return i[M](E);
2911 }, b, E);
2912 }, o = [], u = [], l = [], f = [], h = 0; h < a.length; h++) {
2913 var v = {
2914 value: n.mode === "dendrogram" ? a[h] : [a[h]],
2915 key: h,
2916 index: h
2917 };
2918 o[h] = v, f[h] = v, u[h] = [], l[h] = 0;
2919 }
2920 for (var d = 0; d < o.length; d++)
2921 for (var c = 0; c <= d; c++) {
2922 var y = void 0;
2923 n.mode === "dendrogram" ? y = d === c ? 1 / 0 : s(o[d].value, o[c].value) : y = d === c ? 1 / 0 : s(o[d].value[0], o[c].value[0]), u[d][c] = y, u[c][d] = y, y < u[d][l[d]] && (l[d] = c);
2924 }
2925 for (var p = zs(o, f, u, l, n); p; )
2926 p = zs(o, f, u, l, n);
2927 var g;
2928 return n.mode === "dendrogram" ? (g = dh(o[0], n.dendrogramDepth, r), n.addDendrogram && ch(o[0], r)) : (g = new Array(o.length), o.forEach(function(m, b) {
2929 m.key = m.index = null, g[b] = r.collection(m.value);
2930 })), g;
2931 }, gh = {
2932 hierarchicalClustering: Vs,
2933 hca: Vs
2934 }, ph = At({
2935 distance: "euclidean",
2936 // distance metric to compare attributes between two nodes
2937 preference: "median",
2938 // suitability of a data point to serve as an exemplar
2939 damping: 0.8,
2940 // damping factor between [0.5, 1)
2941 maxIterations: 1e3,
2942 // max number of iterations to run
2943 minIterations: 100,
2944 // min number of iterations to run in order for clustering to stop
2945 attributes: [
2946 // functions to quantify the similarity between any two points
2947 // e.g. node => node.data('weight')
2948 ]
2949 }), yh = function(e) {
2950 var r = e.damping, a = e.preference;
2951 0.5 <= r && r < 1 || xt("Damping must range on [0.5, 1). Got: ".concat(r));
2952 var n = ["median", "mean", "min", "max"];
2953 return n.some(function(i) {
2954 return i === a;
2955 }) || R(a) || xt("Preference must be one of [".concat(n.map(function(i) {
2956 return "'".concat(i, "'");
2957 }).join(", "), "] or a number. Got: ").concat(a)), ph(e);
2958 }, mh = function(e, r, a, n) {
2959 var i = function(o, u) {
2960 return n[u](o);
2961 };
2962 return -bn(e, n.length, function(s) {
2963 return i(r, s);
2964 }, function(s) {
2965 return i(a, s);
2966 }, r, a);
2967 }, bh = function(e, r) {
2968 var a = null;
2969 return r === "median" ? a = yf(e) : r === "mean" ? a = pf(e) : r === "min" ? a = df(e) : r === "max" ? a = gf(e) : a = r, a;
2970 }, Eh = function(e, r, a) {
2971 for (var n = [], i = 0; i < e; i++)
2972 r[i * e + i] + a[i * e + i] > 0 && n.push(i);
2973 return n;
2974 }, Us = function(e, r, a) {
2975 for (var n = [], i = 0; i < e; i++) {
2976 for (var s = -1, o = -1 / 0, u = 0; u < a.length; u++) {
2977 var l = a[u];
2978 r[i * e + l] > o && (s = l, o = r[i * e + l]);
2979 }
2980 s > 0 && n.push(s);
2981 }
2982 for (var f = 0; f < a.length; f++)
2983 n[a[f]] = a[f];
2984 return n;
2985 }, wh = function(e, r, a) {
2986 for (var n = Us(e, r, a), i = 0; i < a.length; i++) {
2987 for (var s = [], o = 0; o < n.length; o++)
2988 n[o] === a[i] && s.push(o);
2989 for (var u = -1, l = -1 / 0, f = 0; f < s.length; f++) {
2990 for (var h = 0, v = 0; v < s.length; v++)
2991 h += r[s[v] * e + s[f]];
2992 h > l && (u = f, l = h);
2993 }
2994 a[i] = s[u];
2995 }
2996 return n = Us(e, r, a), n;
2997 }, $s = function(e) {
2998 for (var r = this.cy(), a = this.nodes(), n = yh(e), i = {}, s = 0; s < a.length; s++)
2999 i[a[s].id()] = s;
3000 var o, u, l, f, h, v;
3001 o = a.length, u = o * o, l = new Array(u);
3002 for (var d = 0; d < u; d++)
3003 l[d] = -1 / 0;
3004 for (var c = 0; c < o; c++)
3005 for (var y = 0; y < o; y++)
3006 c !== y && (l[c * o + y] = mh(n.distance, a[c], a[y], n.attributes));
3007 f = bh(l, n.preference);
3008 for (var p = 0; p < o; p++)
3009 l[p * o + p] = f;
3010 h = new Array(u);
3011 for (var g = 0; g < u; g++)
3012 h[g] = 0;
3013 v = new Array(u);
3014 for (var m = 0; m < u; m++)
3015 v[m] = 0;
3016 for (var b = new Array(o), E = new Array(o), M = new Array(o), L = 0; L < o; L++)
3017 b[L] = 0, E[L] = 0, M[L] = 0;
3018 for (var w = new Array(o * n.minIterations), k = 0; k < w.length; k++)
3019 w[k] = 0;
3020 var D;
3021 for (D = 0; D < n.maxIterations; D++) {
3022 for (var F = 0; F < o; F++) {
3023 for (var G = -1 / 0, N = -1 / 0, X = -1, B = 0, re = 0; re < o; re++)
3024 b[re] = h[F * o + re], B = v[F * o + re] + l[F * o + re], B >= G ? (N = G, G = B, X = re) : B > N && (N = B);
3025 for (var K = 0; K < o; K++)
3026 h[F * o + K] = (1 - n.damping) * (l[F * o + K] - G) + n.damping * b[K];
3027 h[F * o + X] = (1 - n.damping) * (l[F * o + X] - N) + n.damping * b[X];
3028 }
3029 for (var W = 0; W < o; W++) {
3030 for (var ae = 0, ue = 0; ue < o; ue++)
3031 b[ue] = v[ue * o + W], E[ue] = Math.max(0, h[ue * o + W]), ae += E[ue];
3032 ae -= E[W], E[W] = h[W * o + W], ae += E[W];
3033 for (var me = 0; me < o; me++)
3034 v[me * o + W] = (1 - n.damping) * Math.min(0, ae - E[me]) + n.damping * b[me];
3035 v[W * o + W] = (1 - n.damping) * (ae - E[W]) + n.damping * b[W];
3036 }
3037 for (var ie = 0, ge = 0; ge < o; ge++) {
3038 var Ee = v[ge * o + ge] + h[ge * o + ge] > 0 ? 1 : 0;
3039 w[D % n.minIterations * o + ge] = Ee, ie += Ee;
3040 }
3041 if (ie > 0 && (D >= n.minIterations - 1 || D == n.maxIterations - 1)) {
3042 for (var Ce = 0, we = 0; we < o; we++) {
3043 M[we] = 0;
3044 for (var De = 0; De < n.minIterations; De++)
3045 M[we] += w[De * o + we];
3046 (M[we] === 0 || M[we] === n.minIterations) && Ce++;
3047 }
3048 if (Ce === o)
3049 break;
3050 }
3051 }
3052 for (var se = Eh(o, h, v), xe = wh(o, l, se), Le = {}, Se = 0; Se < se.length; Se++)
3053 Le[se[Se]] = [];
3054 for (var Oe = 0; Oe < a.length; Oe++) {
3055 var Fe = i[a[Oe].id()], Xe = xe[Fe];
3056 Xe != null && Le[Xe].push(a[Oe]);
3057 }
3058 for (var Ie = new Array(se.length), Me = 0; Me < se.length; Me++)
3059 Ie[Me] = r.collection(Le[se[Me]]);
3060 return Ie;
3061 }, xh = {
3062 affinityPropagation: $s,
3063 ap: $s
3064 }, Th = At({
3065 root: void 0,
3066 directed: !1
3067 }), Ch = {
3068 hierholzer: function(e) {
3069 if (!S(e)) {
3070 var r = arguments;
3071 e = {
3072 root: r[0],
3073 directed: r[1]
3074 };
3075 }
3076 var a = Th(e), n = a.root, i = a.directed, s = this, o = !1, u, l, f;
3077 n && (f = ee(n) ? this.filter(n)[0].id() : n[0].id());
3078 var h = {}, v = {};
3079 i ? s.forEach(function(m) {
3080 var b = m.id();
3081 if (m.isNode()) {
3082 var E = m.indegree(!0), M = m.outdegree(!0), L = E - M, w = M - E;
3083 L == 1 ? u ? o = !0 : u = b : w == 1 ? l ? o = !0 : l = b : (w > 1 || L > 1) && (o = !0), h[b] = [], m.outgoers().forEach(function(k) {
3084 k.isEdge() && h[b].push(k.id());
3085 });
3086 } else
3087 v[b] = [void 0, m.target().id()];
3088 }) : s.forEach(function(m) {
3089 var b = m.id();
3090 if (m.isNode()) {
3091 var E = m.degree(!0);
3092 E % 2 && (u ? l ? o = !0 : l = b : u = b), h[b] = [], m.connectedEdges().forEach(function(M) {
3093 return h[b].push(M.id());
3094 });
3095 } else
3096 v[b] = [m.source().id(), m.target().id()];
3097 });
3098 var d = {
3099 found: !1,
3100 trail: void 0
3101 };
3102 if (o)
3103 return d;
3104 if (l && u)
3105 if (i) {
3106 if (f && l != f)
3107 return d;
3108 f = l;
3109 } else {
3110 if (f && l != f && u != f)
3111 return d;
3112 f || (f = l);
3113 }
3114 else
3115 f || (f = s[0].id());
3116 var c = function(b) {
3117 for (var E = b, M = [b], L, w, k; h[E].length; )
3118 L = h[E].shift(), w = v[L][0], k = v[L][1], E != k ? (h[k] = h[k].filter(function(D) {
3119 return D != L;
3120 }), E = k) : !i && E != w && (h[w] = h[w].filter(function(D) {
3121 return D != L;
3122 }), E = w), M.unshift(L), M.unshift(E);
3123 return M;
3124 }, y = [], p = [];
3125 for (p = c(f); p.length != 1; )
3126 h[p[0]].length == 0 ? (y.unshift(s.getElementById(p.shift())), y.unshift(s.getElementById(p.shift()))) : p = c(p.shift()).concat(p);
3127 y.unshift(s.getElementById(p.shift()));
3128 for (var g in h)
3129 if (h[g].length)
3130 return d;
3131 return d.found = !0, d.trail = this.spawn(y, !0), d;
3132 }
3133 }, xn = function() {
3134 var e = this, r = {}, a = 0, n = 0, i = [], s = [], o = {}, u = function(v, d) {
3135 for (var c = s.length - 1, y = [], p = e.spawn(); s[c].x != v || s[c].y != d; )
3136 y.push(s.pop().edge), c--;
3137 y.push(s.pop().edge), y.forEach(function(g) {
3138 var m = g.connectedNodes().intersection(e);
3139 p.merge(g), m.forEach(function(b) {
3140 var E = b.id(), M = b.connectedEdges().intersection(e);
3141 p.merge(b), r[E].cutVertex ? p.merge(M.filter(function(L) {
3142 return L.isLoop();
3143 })) : p.merge(M);
3144 });
3145 }), i.push(p);
3146 }, l = function h(v, d, c) {
3147 v === c && (n += 1), r[d] = {
3148 id: a,
3149 low: a++,
3150 cutVertex: !1
3151 };
3152 var y = e.getElementById(d).connectedEdges().intersection(e);
3153 if (y.size() === 0)
3154 i.push(e.spawn(e.getElementById(d)));
3155 else {
3156 var p, g, m, b;
3157 y.forEach(function(E) {
3158 p = E.source().id(), g = E.target().id(), m = p === d ? g : p, m !== c && (b = E.id(), o[b] || (o[b] = !0, s.push({
3159 x: d,
3160 y: m,
3161 edge: E
3162 })), m in r ? r[d].low = Math.min(r[d].low, r[m].id) : (h(v, m, d), r[d].low = Math.min(r[d].low, r[m].low), r[d].id <= r[m].low && (r[d].cutVertex = !0, u(d, m))));
3163 });
3164 }
3165 };
3166 e.forEach(function(h) {
3167 if (h.isNode()) {
3168 var v = h.id();
3169 v in r || (n = 0, l(v, v), r[v].cutVertex = n > 1);
3170 }
3171 });
3172 var f = Object.keys(r).filter(function(h) {
3173 return r[h].cutVertex;
3174 }).map(function(h) {
3175 return e.getElementById(h);
3176 });
3177 return {
3178 cut: e.spawn(f),
3179 components: i
3180 };
3181 }, Dh = {
3182 hopcroftTarjanBiconnected: xn,
3183 htbc: xn,
3184 htb: xn,
3185 hopcroftTarjanBiconnectedComponents: xn
3186 }, Tn = function() {
3187 var e = this, r = {}, a = 0, n = [], i = [], s = e.spawn(e), o = function u(l) {
3188 i.push(l), r[l] = {
3189 index: a,
3190 low: a++,
3191 explored: !1
3192 };
3193 var f = e.getElementById(l).connectedEdges().intersection(e);
3194 if (f.forEach(function(y) {
3195 var p = y.target().id();
3196 p !== l && (p in r || u(p), r[p].explored || (r[l].low = Math.min(r[l].low, r[p].low)));
3197 }), r[l].index === r[l].low) {
3198 for (var h = e.spawn(); ; ) {
3199 var v = i.pop();
3200 if (h.merge(e.getElementById(v)), r[v].low = r[l].index, r[v].explored = !0, v === l)
3201 break;
3202 }
3203 var d = h.edgesWith(h), c = h.merge(d);
3204 n.push(c), s = s.difference(c);
3205 }
3206 };
3207 return e.forEach(function(u) {
3208 if (u.isNode()) {
3209 var l = u.id();
3210 l in r || o(l);
3211 }
3212 }), {
3213 cut: s,
3214 components: n
3215 };
3216 }, Sh = {
3217 tarjanStronglyConnected: Tn,
3218 tsc: Tn,
3219 tscc: Tn,
3220 tarjanStronglyConnectedComponents: Tn
3221 }, _s = {};
3222 [Ma, tf, rf, nf, of, uf, vf, Ff, ra, aa, gi, Zf, uh, gh, xh, Ch, Dh, Sh].forEach(function(t) {
3223 He(_s, t);
3224 });
3225 /*!
3226 Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
3227 Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
3228 Licensed under The MIT License (http://opensource.org/licenses/MIT)
3229 */
3230 var Ys = 0, Hs = 1, Xs = 2, yr = function t(e) {
3231 if (!(this instanceof t))
3232 return new t(e);
3233 this.id = "Thenable/1.0.7", this.state = Ys, this.fulfillValue = void 0, this.rejectReason = void 0, this.onFulfilled = [], this.onRejected = [], this.proxy = {
3234 then: this.then.bind(this)
3235 }, typeof e == "function" && e.call(this, this.fulfill.bind(this), this.reject.bind(this));
3236 };
3237 yr.prototype = {
3238 /* promise resolving methods */
3239 fulfill: function(e) {
3240 return Ws(this, Hs, "fulfillValue", e);
3241 },
3242 reject: function(e) {
3243 return Ws(this, Xs, "rejectReason", e);
3244 },
3245 /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */
3246 then: function(e, r) {
3247 var a = this, n = new yr();
3248 return a.onFulfilled.push(Zs(e, n, "fulfill")), a.onRejected.push(Zs(r, n, "reject")), qs(a), n.proxy;
3249 }
3250 };
3251 var Ws = function(e, r, a, n) {
3252 return e.state === Ys && (e.state = r, e[a] = n, qs(e)), e;
3253 }, qs = function(e) {
3254 e.state === Hs ? Ks(e, "onFulfilled", e.fulfillValue) : e.state === Xs && Ks(e, "onRejected", e.rejectReason);
3255 }, Ks = function(e, r, a) {
3256 if (e[r].length !== 0) {
3257 var n = e[r];
3258 e[r] = [];
3259 var i = function() {
3260 for (var o = 0; o < n.length; o++)
3261 n[o](a);
3262 };
3263 typeof setImmediate == "function" ? setImmediate(i) : setTimeout(i, 0);
3264 }
3265 }, Zs = function(e, r, a) {
3266 return function(n) {
3267 if (typeof e != "function")
3268 r[a].call(r, n);
3269 else {
3270 var i;
3271 try {
3272 i = e(n);
3273 } catch (s) {
3274 r.reject(s);
3275 return;
3276 }
3277 Lh(r, i);
3278 }
3279 };
3280 }, Lh = function t(e, r) {
3281 if (e === r || e.proxy === r) {
3282 e.reject(new TypeError("cannot resolve promise with itself"));
3283 return;
3284 }
3285 var a;
3286 if (_(r) === "object" && r !== null || typeof r == "function")
3287 try {
3288 a = r.then;
3289 } catch (i) {
3290 e.reject(i);
3291 return;
3292 }
3293 if (typeof a == "function") {
3294 var n = !1;
3295 try {
3296 a.call(
3297 r,
3298 /* resolvePromise */
3299 /* [Promises/A+ 2.3.3.3.1] */
3300 function(i) {
3301 n || (n = !0, i === r ? e.reject(new TypeError("circular thenable chain")) : t(e, i));
3302 },
3303 /* rejectPromise */
3304 /* [Promises/A+ 2.3.3.3.2] */
3305 function(i) {
3306 n || (n = !0, e.reject(i));
3307 }
3308 );
3309 } catch (i) {
3310 n || e.reject(i);
3311 }
3312 return;
3313 }
3314 e.fulfill(r);
3315 };
3316 yr.all = function(t) {
3317 return new yr(function(e, r) {
3318 for (var a = new Array(t.length), n = 0, i = function(u, l) {
3319 a[u] = l, n++, n === t.length && e(a);
3320 }, s = 0; s < t.length; s++)
3321 (function(o) {
3322 var u = t[o], l = u != null && u.then != null;
3323 if (l)
3324 u.then(function(h) {
3325 i(o, h);
3326 }, function(h) {
3327 r(h);
3328 });
3329 else {
3330 var f = u;
3331 i(o, f);
3332 }
3333 })(s);
3334 });
3335 }, yr.resolve = function(t) {
3336 return new yr(function(e, r) {
3337 e(t);
3338 });
3339 }, yr.reject = function(t) {
3340 return new yr(function(e, r) {
3341 r(t);
3342 });
3343 };
3344 var ia = typeof Promise < "u" ? Promise : yr, mi = function(e, r, a) {
3345 var n = Ye(e), i = !n, s = this._private = He({
3346 duration: 1e3
3347 }, r, a);
3348 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 && H(s.complete) && s.completes.push(s.complete), i) {
3349 var o = e.position();
3350 s.startPosition = s.startPosition || {
3351 x: o.x,
3352 y: o.y
3353 }, s.startStyle = s.startStyle || e.cy().style().getAnimationStartStyle(e, s.style);
3354 }
3355 if (n) {
3356 var u = e.pan();
3357 s.startPan = {
3358 x: u.x,
3359 y: u.y
3360 }, s.startZoom = e.zoom();
3361 }
3362 this.length = 1, this[0] = this;
3363 }, zr = mi.prototype;
3364 He(zr, {
3365 instanceString: function() {
3366 return "animation";
3367 },
3368 hook: function() {
3369 var e = this._private;
3370 if (!e.hooked) {
3371 var r, a = e.target._private.animation;
3372 e.queue ? r = a.queue : r = a.current, r.push(this), pe(e.target) && e.target.cy().addToAnimationPool(e.target), e.hooked = !0;
3373 }
3374 return this;
3375 },
3376 play: function() {
3377 var e = this._private;
3378 return e.progress === 1 && (e.progress = 0), e.playing = !0, e.started = !1, e.stopped = !1, this.hook(), this;
3379 },
3380 playing: function() {
3381 return this._private.playing;
3382 },
3383 apply: function() {
3384 var e = this._private;
3385 return e.applying = !0, e.started = !1, e.stopped = !1, this.hook(), this;
3386 },
3387 applying: function() {
3388 return this._private.applying;
3389 },
3390 pause: function() {
3391 var e = this._private;
3392 return e.playing = !1, e.started = !1, this;
3393 },
3394 stop: function() {
3395 var e = this._private;
3396 return e.playing = !1, e.started = !1, e.stopped = !0, this;
3397 },
3398 rewind: function() {
3399 return this.progress(0);
3400 },
3401 fastforward: function() {
3402 return this.progress(1);
3403 },
3404 time: function(e) {
3405 var r = this._private;
3406 return e === void 0 ? r.progress * r.duration : this.progress(e / r.duration);
3407 },
3408 progress: function(e) {
3409 var r = this._private, a = r.playing;
3410 return e === void 0 ? r.progress : (a && this.pause(), r.progress = e, r.started = !1, a && this.play(), this);
3411 },
3412 completed: function() {
3413 return this._private.progress === 1;
3414 },
3415 reverse: function() {
3416 var e = this._private, r = e.playing;
3417 r && this.pause(), e.progress = 1 - e.progress, e.started = !1;
3418 var a = function(l, f) {
3419 var h = e[l];
3420 h != null && (e[l] = e[f], e[f] = h);
3421 };
3422 if (a("zoom", "startZoom"), a("pan", "startPan"), a("position", "startPosition"), e.style)
3423 for (var n = 0; n < e.style.length; n++) {
3424 var i = e.style[n], s = i.name, o = e.startStyle[s];
3425 e.startStyle[s] = i, e.style[n] = o;
3426 }
3427 return r && this.play(), this;
3428 },
3429 promise: function(e) {
3430 var r = this._private, a;
3431 switch (e) {
3432 case "frame":
3433 a = r.frames;
3434 break;
3435 default:
3436 case "complete":
3437 case "completed":
3438 a = r.completes;
3439 }
3440 return new ia(function(n, i) {
3441 a.push(function() {
3442 n();
3443 });
3444 });
3445 }
3446 }), zr.complete = zr.completed, zr.run = zr.play, zr.running = zr.playing;
3447 var Ah = {
3448 animated: function() {
3449 return function() {
3450 var r = this, a = r.length !== void 0, n = a ? r : [r], i = this._private.cy || this;
3451 if (!i.styleEnabled())
3452 return !1;
3453 var s = n[0];
3454 if (s)
3455 return s._private.animation.current.length > 0;
3456 };
3457 },
3458 // animated
3459 clearQueue: function() {
3460 return function() {
3461 var r = this, a = r.length !== void 0, n = a ? r : [r], i = this._private.cy || this;
3462 if (!i.styleEnabled())
3463 return this;
3464 for (var s = 0; s < n.length; s++) {
3465 var o = n[s];
3466 o._private.animation.queue = [];
3467 }
3468 return this;
3469 };
3470 },
3471 // clearQueue
3472 delay: function() {
3473 return function(r, a) {
3474 var n = this._private.cy || this;
3475 return n.styleEnabled() ? this.animate({
3476 delay: r,
3477 duration: r,
3478 complete: a
3479 }) : this;
3480 };
3481 },
3482 // delay
3483 delayAnimation: function() {
3484 return function(r, a) {
3485 var n = this._private.cy || this;
3486 return n.styleEnabled() ? this.animation({
3487 delay: r,
3488 duration: r,
3489 complete: a
3490 }) : this;
3491 };
3492 },
3493 // delay
3494 animation: function() {
3495 return function(r, a) {
3496 var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this, u = !i, l = !u;
3497 if (!o.styleEnabled())
3498 return this;
3499 var f = o.style();
3500 r = He({}, r, a);
3501 var h = Object.keys(r).length === 0;
3502 if (h)
3503 return new mi(s[0], r);
3504 switch (r.duration === void 0 && (r.duration = 400), r.duration) {
3505 case "slow":
3506 r.duration = 600;
3507 break;
3508 case "fast":
3509 r.duration = 200;
3510 break;
3511 }
3512 if (l && (r.style = f.getPropsList(r.style || r.css), r.css = void 0), l && r.renderedPosition != null) {
3513 var v = r.renderedPosition, d = o.pan(), c = o.zoom();
3514 r.position = bs(v, c, d);
3515 }
3516 if (u && r.panBy != null) {
3517 var y = r.panBy, p = o.pan();
3518 r.pan = {
3519 x: p.x + y.x,
3520 y: p.y + y.y
3521 };
3522 }
3523 var g = r.center || r.centre;
3524 if (u && g != null) {
3525 var m = o.getCenterPan(g.eles, r.zoom);
3526 m != null && (r.pan = m);
3527 }
3528 if (u && r.fit != null) {
3529 var b = r.fit, E = o.getFitViewport(b.eles || b.boundingBox, b.padding);
3530 E != null && (r.pan = E.pan, r.zoom = E.zoom);
3531 }
3532 if (u && S(r.zoom)) {
3533 var M = o.getZoomedViewport(r.zoom);
3534 M != null ? (M.zoomed && (r.zoom = M.zoom), M.panned && (r.pan = M.pan)) : r.zoom = null;
3535 }
3536 return new mi(s[0], r);
3537 };
3538 },
3539 // animate
3540 animate: function() {
3541 return function(r, a) {
3542 var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this;
3543 if (!o.styleEnabled())
3544 return this;
3545 a && (r = He({}, r, a));
3546 for (var u = 0; u < s.length; u++) {
3547 var l = s[u], f = l.animated() && (r.queue === void 0 || r.queue), h = l.animation(r, f ? {
3548 queue: !0
3549 } : void 0);
3550 h.play();
3551 }
3552 return this;
3553 };
3554 },
3555 // animate
3556 stop: function() {
3557 return function(r, a) {
3558 var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this;
3559 if (!o.styleEnabled())
3560 return this;
3561 for (var u = 0; u < s.length; u++) {
3562 for (var l = s[u], f = l._private, h = f.animation.current, v = 0; v < h.length; v++) {
3563 var d = h[v], c = d._private;
3564 a && (c.duration = 0);
3565 }
3566 r && (f.animation.queue = []), a || (f.animation.current = []);
3567 }
3568 return o.notify("draw"), this;
3569 };
3570 }
3571 // stop
3572 }, Oh = Array.isArray, Cn = Oh, Nh = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Ih = /^\w*$/;
3573 function Mh(t, e) {
3574 if (Cn(t))
3575 return !1;
3576 var r = typeof t;
3577 return r == "number" || r == "symbol" || r == "boolean" || t == null || Aa(t) ? !0 : Ih.test(t) || !Nh.test(t) || e != null && t in Object(e);
3578 }
3579 var Rh = Mh, kh = "[object AsyncFunction]", Ph = "[object Function]", Bh = "[object GeneratorFunction]", Fh = "[object Proxy]";
3580 function Gh(t) {
3581 if (!kr(t))
3582 return !1;
3583 var e = is(t);
3584 return e == Ph || e == Bh || e == kh || e == Fh;
3585 }
3586 var zh = Gh, Vh = sn["__core-js_shared__"], bi = Vh, Qs = function() {
3587 var t = /[^.]+$/.exec(bi && bi.keys && bi.keys.IE_PROTO || "");
3588 return t ? "Symbol(src)_1." + t : "";
3589 }();
3590 function Uh(t) {
3591 return !!Qs && Qs in t;
3592 }
3593 var $h = Uh, _h = Function.prototype, Yh = _h.toString;
3594 function Hh(t) {
3595 if (t != null) {
3596 try {
3597 return Yh.call(t);
3598 } catch {
3599 }
3600 try {
3601 return t + "";
3602 } catch {
3603 }
3604 }
3605 return "";
3606 }
3607 var Xh = Hh, Wh = /[\\^$.*+?()[\]{}|]/g, qh = /^\[object .+?Constructor\]$/, Kh = Function.prototype, Zh = Object.prototype, Qh = Kh.toString, Jh = Zh.hasOwnProperty, jh = RegExp(
3608 "^" + Qh.call(Jh).replace(Wh, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
3609 );
3610 function ev(t) {
3611 if (!kr(t) || $h(t))
3612 return !1;
3613 var e = zh(t) ? jh : qh;
3614 return e.test(Xh(t));
3615 }
3616 var tv = ev;
3617 function rv(t, e) {
3618 return t == null ? void 0 : t[e];
3619 }
3620 var av = rv;
3621 function nv(t, e) {
3622 var r = av(t, e);
3623 return tv(r) ? r : void 0;
3624 }
3625 var Ei = nv, iv = Ei(Object, "create"), za = iv;
3626 function sv() {
3627 this.__data__ = za ? za(null) : {}, this.size = 0;
3628 }
3629 var ov = sv;
3630 function lv(t) {
3631 var e = this.has(t) && delete this.__data__[t];
3632 return this.size -= e ? 1 : 0, e;
3633 }
3634 var uv = lv, fv = "__lodash_hash_undefined__", hv = Object.prototype, vv = hv.hasOwnProperty;
3635 function cv(t) {
3636 var e = this.__data__;
3637 if (za) {
3638 var r = e[t];
3639 return r === fv ? void 0 : r;
3640 }
3641 return vv.call(e, t) ? e[t] : void 0;
3642 }
3643 var dv = cv, gv = Object.prototype, pv = gv.hasOwnProperty;
3644 function yv(t) {
3645 var e = this.__data__;
3646 return za ? e[t] !== void 0 : pv.call(e, t);
3647 }
3648 var mv = yv, bv = "__lodash_hash_undefined__";
3649 function Ev(t, e) {
3650 var r = this.__data__;
3651 return this.size += this.has(t) ? 0 : 1, r[t] = za && e === void 0 ? bv : e, this;
3652 }
3653 var wv = Ev;
3654 function sa(t) {
3655 var e = -1, r = t == null ? 0 : t.length;
3656 for (this.clear(); ++e < r; ) {
3657 var a = t[e];
3658 this.set(a[0], a[1]);
3659 }
3660 }
3661 sa.prototype.clear = ov, sa.prototype.delete = uv, sa.prototype.get = dv, sa.prototype.has = mv, sa.prototype.set = wv;
3662 var Js = sa;
3663 function xv() {
3664 this.__data__ = [], this.size = 0;
3665 }
3666 var Tv = xv;
3667 function Cv(t, e) {
3668 return t === e || t !== t && e !== e;
3669 }
3670 var js = Cv;
3671 function Dv(t, e) {
3672 for (var r = t.length; r--; )
3673 if (js(t[r][0], e))
3674 return r;
3675 return -1;
3676 }
3677 var Dn = Dv, Sv = Array.prototype, Lv = Sv.splice;
3678 function Av(t) {
3679 var e = this.__data__, r = Dn(e, t);
3680 if (r < 0)
3681 return !1;
3682 var a = e.length - 1;
3683 return r == a ? e.pop() : Lv.call(e, r, 1), --this.size, !0;
3684 }
3685 var Ov = Av;
3686 function Nv(t) {
3687 var e = this.__data__, r = Dn(e, t);
3688 return r < 0 ? void 0 : e[r][1];
3689 }
3690 var Iv = Nv;
3691 function Mv(t) {
3692 return Dn(this.__data__, t) > -1;
3693 }
3694 var Rv = Mv;
3695 function kv(t, e) {
3696 var r = this.__data__, a = Dn(r, t);
3697 return a < 0 ? (++this.size, r.push([t, e])) : r[a][1] = e, this;
3698 }
3699 var Pv = kv;
3700 function oa(t) {
3701 var e = -1, r = t == null ? 0 : t.length;
3702 for (this.clear(); ++e < r; ) {
3703 var a = t[e];
3704 this.set(a[0], a[1]);
3705 }
3706 }
3707 oa.prototype.clear = Tv, oa.prototype.delete = Ov, oa.prototype.get = Iv, oa.prototype.has = Rv, oa.prototype.set = Pv;
3708 var Bv = oa, Fv = Ei(sn, "Map"), Gv = Fv;
3709 function zv() {
3710 this.size = 0, this.__data__ = {
3711 hash: new Js(),
3712 map: new (Gv || Bv)(),
3713 string: new Js()
3714 };
3715 }
3716 var Vv = zv;
3717 function Uv(t) {
3718 var e = typeof t;
3719 return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
3720 }
3721 var $v = Uv;
3722 function _v(t, e) {
3723 var r = t.__data__;
3724 return $v(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
3725 }
3726 var Sn = _v;
3727 function Yv(t) {
3728 var e = Sn(this, t).delete(t);
3729 return this.size -= e ? 1 : 0, e;
3730 }
3731 var Hv = Yv;
3732 function Xv(t) {
3733 return Sn(this, t).get(t);
3734 }
3735 var Wv = Xv;
3736 function qv(t) {
3737 return Sn(this, t).has(t);
3738 }
3739 var Kv = qv;
3740 function Zv(t, e) {
3741 var r = Sn(this, t), a = r.size;
3742 return r.set(t, e), this.size += r.size == a ? 0 : 1, this;
3743 }
3744 var Qv = Zv;
3745 function la(t) {
3746 var e = -1, r = t == null ? 0 : t.length;
3747 for (this.clear(); ++e < r; ) {
3748 var a = t[e];
3749 this.set(a[0], a[1]);
3750 }
3751 }
3752 la.prototype.clear = Vv, la.prototype.delete = Hv, la.prototype.get = Wv, la.prototype.has = Kv, la.prototype.set = Qv;
3753 var eo = la, Jv = "Expected a function";
3754 function wi(t, e) {
3755 if (typeof t != "function" || e != null && typeof e != "function")
3756 throw new TypeError(Jv);
3757 var r = function() {
3758 var a = arguments, n = e ? e.apply(this, a) : a[0], i = r.cache;
3759 if (i.has(n))
3760 return i.get(n);
3761 var s = t.apply(this, a);
3762 return r.cache = i.set(n, s) || i, s;
3763 };
3764 return r.cache = new (wi.Cache || eo)(), r;
3765 }
3766 wi.Cache = eo;
3767 var jv = wi, ec = 500;
3768 function tc(t) {
3769 var e = jv(t, function(a) {
3770 return r.size === ec && r.clear(), a;
3771 }), r = e.cache;
3772 return e;
3773 }
3774 var rc = tc, ac = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, nc = /\\(\\)?/g, ic = rc(function(t) {
3775 var e = [];
3776 return t.charCodeAt(0) === 46 && e.push(""), t.replace(ac, function(r, a, n, i) {
3777 e.push(n ? i.replace(nc, "$1") : a || r);
3778 }), e;
3779 }), to = ic;
3780 function sc(t, e) {
3781 for (var r = -1, a = t == null ? 0 : t.length, n = Array(a); ++r < a; )
3782 n[r] = e(t[r], r, t);
3783 return n;
3784 }
3785 var ro = sc, oc = 1 / 0, ao = Zr ? Zr.prototype : void 0, no = ao ? ao.toString : void 0;
3786 function io(t) {
3787 if (typeof t == "string")
3788 return t;
3789 if (Cn(t))
3790 return ro(t, io) + "";
3791 if (Aa(t))
3792 return no ? no.call(t) : "";
3793 var e = t + "";
3794 return e == "0" && 1 / t == -oc ? "-0" : e;
3795 }
3796 var lc = io;
3797 function uc(t) {
3798 return t == null ? "" : lc(t);
3799 }
3800 var so = uc;
3801 function fc(t, e) {
3802 return Cn(t) ? t : Rh(t, e) ? [t] : to(so(t));
3803 }
3804 var oo = fc, hc = 1 / 0;
3805 function vc(t) {
3806 if (typeof t == "string" || Aa(t))
3807 return t;
3808 var e = t + "";
3809 return e == "0" && 1 / t == -hc ? "-0" : e;
3810 }
3811 var xi = vc;
3812 function cc(t, e) {
3813 e = oo(e, t);
3814 for (var r = 0, a = e.length; t != null && r < a; )
3815 t = t[xi(e[r++])];
3816 return r && r == a ? t : void 0;
3817 }
3818 var dc = cc;
3819 function gc(t, e, r) {
3820 var a = t == null ? void 0 : dc(t, e);
3821 return a === void 0 ? r : a;
3822 }
3823 var pc = gc, yc = function() {
3824 try {
3825 var t = Ei(Object, "defineProperty");
3826 return t({}, "", {}), t;
3827 } catch {
3828 }
3829 }(), lo = yc;
3830 function mc(t, e, r) {
3831 e == "__proto__" && lo ? lo(t, e, {
3832 configurable: !0,
3833 enumerable: !0,
3834 value: r,
3835 writable: !0
3836 }) : t[e] = r;
3837 }
3838 var bc = mc, Ec = Object.prototype, wc = Ec.hasOwnProperty;
3839 function xc(t, e, r) {
3840 var a = t[e];
3841 (!(wc.call(t, e) && js(a, r)) || r === void 0 && !(e in t)) && bc(t, e, r);
3842 }
3843 var Tc = xc, Cc = 9007199254740991, Dc = /^(?:0|[1-9]\d*)$/;
3844 function Sc(t, e) {
3845 var r = typeof t;
3846 return e = e ?? Cc, !!e && (r == "number" || r != "symbol" && Dc.test(t)) && t > -1 && t % 1 == 0 && t < e;
3847 }
3848 var Lc = Sc;
3849 function Ac(t, e, r, a) {
3850 if (!kr(t))
3851 return t;
3852 e = oo(e, t);
3853 for (var n = -1, i = e.length, s = i - 1, o = t; o != null && ++n < i; ) {
3854 var u = xi(e[n]), l = r;
3855 if (u === "__proto__" || u === "constructor" || u === "prototype")
3856 return t;
3857 if (n != s) {
3858 var f = o[u];
3859 l = a ? a(f, u, o) : void 0, l === void 0 && (l = kr(f) ? f : Lc(e[n + 1]) ? [] : {});
3860 }
3861 Tc(o, u, l), o = o[u];
3862 }
3863 return t;
3864 }
3865 var Oc = Ac;
3866 function Nc(t, e, r) {
3867 return t == null ? t : Oc(t, e, r);
3868 }
3869 var Ic = Nc;
3870 function Mc(t, e) {
3871 var r = -1, a = t.length;
3872 for (e || (e = Array(a)); ++r < a; )
3873 e[r] = t[r];
3874 return e;
3875 }
3876 var Rc = Mc;
3877 function kc(t) {
3878 return Cn(t) ? ro(t, xi) : Aa(t) ? [t] : Rc(to(so(t)));
3879 }
3880 var Pc = kc, Bc = {
3881 // access data field
3882 data: function(e) {
3883 var r = {
3884 field: "data",
3885 bindingEvent: "data",
3886 allowBinding: !1,
3887 allowSetting: !1,
3888 allowGetting: !1,
3889 settingEvent: "data",
3890 settingTriggersEvent: !1,
3891 triggerFnName: "trigger",
3892 immutableKeys: {},
3893 // key => true if immutable
3894 updateStyle: !1,
3895 beforeGet: function(n) {
3896 },
3897 beforeSet: function(n, i) {
3898 },
3899 onSet: function(n) {
3900 },
3901 canSet: function(n) {
3902 return !0;
3903 }
3904 };
3905 return e = He({}, r, e), function(n, i) {
3906 var s = e, o = this, u = o.length !== void 0, l = u ? o : [o], f = u ? o[0] : o;
3907 if (ee(n)) {
3908 var h = n.indexOf(".") !== -1, v = h && Pc(n);
3909 if (s.allowGetting && i === void 0) {
3910 var d;
3911 return f && (s.beforeGet(f), v && f._private[s.field][n] === void 0 ? d = pc(f._private[s.field], v) : d = f._private[s.field][n]), d;
3912 } else if (s.allowSetting && i !== void 0) {
3913 var c = !s.immutableKeys[n];
3914 if (c) {
3915 var y = T({}, n, i);
3916 s.beforeSet(o, y);
3917 for (var p = 0, g = l.length; p < g; p++) {
3918 var m = l[p];
3919 s.canSet(m) && (v && f._private[s.field][n] === void 0 ? Ic(m._private[s.field], v, i) : m._private[s.field][n] = i);
3920 }
3921 s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent);
3922 }
3923 }
3924 } else if (s.allowSetting && S(n)) {
3925 var b = n, E, M, L = Object.keys(b);
3926 s.beforeSet(o, b);
3927 for (var w = 0; w < L.length; w++) {
3928 E = L[w], M = b[E];
3929 var k = !s.immutableKeys[E];
3930 if (k)
3931 for (var D = 0; D < l.length; D++) {
3932 var F = l[D];
3933 s.canSet(F) && (F._private[s.field][E] = M);
3934 }
3935 }
3936 s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent);
3937 } else if (s.allowBinding && H(n)) {
3938 var G = n;
3939 o.on(s.bindingEvent, G);
3940 } else if (s.allowGetting && n === void 0) {
3941 var N;
3942 return f && (s.beforeGet(f), N = f._private[s.field]), N;
3943 }
3944 return o;
3945 };
3946 },
3947 // data
3948 // remove data field
3949 removeData: function(e) {
3950 var r = {
3951 field: "data",
3952 event: "data",
3953 triggerFnName: "trigger",
3954 triggerEvent: !1,
3955 immutableKeys: {}
3956 // key => true if immutable
3957 };
3958 return e = He({}, r, e), function(n) {
3959 var i = e, s = this, o = s.length !== void 0, u = o ? s : [s];
3960 if (ee(n)) {
3961 for (var l = n.split(/\s+/), f = l.length, h = 0; h < f; h++) {
3962 var v = l[h];
3963 if (!Re(v)) {
3964 var d = !i.immutableKeys[v];
3965 if (d)
3966 for (var c = 0, y = u.length; c < y; c++)
3967 u[c]._private[i.field][v] = void 0;
3968 }
3969 }
3970 i.triggerEvent && s[i.triggerFnName](i.event);
3971 } else if (n === void 0) {
3972 for (var p = 0, g = u.length; p < g; p++)
3973 for (var m = u[p]._private[i.field], b = Object.keys(m), E = 0; E < b.length; E++) {
3974 var M = b[E], L = !i.immutableKeys[M];
3975 L && (m[M] = void 0);
3976 }
3977 i.triggerEvent && s[i.triggerFnName](i.event);
3978 }
3979 return s;
3980 };
3981 }
3982 // removeData
3983 }, Fc = {
3984 eventAliasesOn: function(e) {
3985 var r = e;
3986 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) {
3987 var i = this, s = Array.prototype.slice.call(arguments, 0);
3988 return new ia(function(o, u) {
3989 var l = function(d) {
3990 i.off.apply(i, h), o(d);
3991 }, f = s.concat([l]), h = f.concat([]);
3992 i.on.apply(i, f);
3993 });
3994 };
3995 }
3996 }, ct = {};
3997 [Ah, Bc, Fc].forEach(function(t) {
3998 He(ct, t);
3999 });
4000 var Gc = {
4001 animate: ct.animate(),
4002 animation: ct.animation(),
4003 animated: ct.animated(),
4004 clearQueue: ct.clearQueue(),
4005 delay: ct.delay(),
4006 delayAnimation: ct.delayAnimation(),
4007 stop: ct.stop()
4008 }, Ln = {
4009 classes: function(e) {
4010 var r = this;
4011 if (e === void 0) {
4012 var a = [];
4013 return r[0]._private.classes.forEach(function(c) {
4014 return a.push(c);
4015 }), a;
4016 } else
4017 te(e) || (e = (e || "").match(/\S+/g) || []);
4018 for (var n = [], i = new Jr(e), s = 0; s < r.length; s++) {
4019 for (var o = r[s], u = o._private, l = u.classes, f = !1, h = 0; h < e.length; h++) {
4020 var v = e[h], d = l.has(v);
4021 if (!d) {
4022 f = !0;
4023 break;
4024 }
4025 }
4026 f || (f = l.size !== e.length), f && (u.classes = i, n.push(o));
4027 }
4028 return n.length > 0 && this.spawn(n).updateStyle().emit("class"), r;
4029 },
4030 addClass: function(e) {
4031 return this.toggleClass(e, !0);
4032 },
4033 hasClass: function(e) {
4034 var r = this[0];
4035 return r != null && r._private.classes.has(e);
4036 },
4037 toggleClass: function(e, r) {
4038 te(e) || (e = e.match(/\S+/g) || []);
4039 for (var a = this, n = r === void 0, i = [], s = 0, o = a.length; s < o; s++)
4040 for (var u = a[s], l = u._private.classes, f = !1, h = 0; h < e.length; h++) {
4041 var v = e[h], d = l.has(v), c = !1;
4042 r || n && !d ? (l.add(v), c = !0) : (!r || n && d) && (l.delete(v), c = !0), !f && c && (i.push(u), f = !0);
4043 }
4044 return i.length > 0 && this.spawn(i).updateStyle().emit("class"), a;
4045 },
4046 removeClass: function(e) {
4047 return this.toggleClass(e, !1);
4048 },
4049 flashClass: function(e, r) {
4050 var a = this;
4051 if (r == null)
4052 r = 250;
4053 else if (r === 0)
4054 return a;
4055 return a.addClass(e), setTimeout(function() {
4056 a.removeClass(e);
4057 }, r), a;
4058 }
4059 };
4060 Ln.className = Ln.classNames = Ln.classes;
4061 var st = {
4062 metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",
4063 // chars we need to escape in let names, etc
4064 comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",
4065 // binary comparison op (used in data selectors)
4066 boolOp: "\\?|\\!|\\^",
4067 // boolean (unary) operators (used in data selectors)
4068 string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,
4069 // string literals (used in data selectors) -- doublequotes | singlequotes
4070 number: gt,
4071 // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123
4072 meta: "degree|indegree|outdegree",
4073 // allowed metadata fields (i.e. allowed functions to use from Collection)
4074 separator: "\\s*,\\s*",
4075 // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass
4076 descendant: "\\s+",
4077 child: "\\s+>\\s+",
4078 subject: "\\$",
4079 group: "node|edge|\\*",
4080 directedEdge: "\\s+->\\s+",
4081 undirectedEdge: "\\s+<->\\s+"
4082 };
4083 st.variable = "(?:[\\w-.]|(?:\\\\" + st.metaChar + "))+", st.className = "(?:[\\w-]|(?:\\\\" + st.metaChar + "))+", st.value = st.string + "|" + st.number, st.id = st.variable, function() {
4084 var t, e, r;
4085 for (t = st.comparatorOp.split("|"), r = 0; r < t.length; r++)
4086 e = t[r], st.comparatorOp += "|@" + e;
4087 for (t = st.comparatorOp.split("|"), r = 0; r < t.length; r++)
4088 e = t[r], !(e.indexOf("!") >= 0) && e !== "=" && (st.comparatorOp += "|\\!" + e);
4089 }();
4090 var pt = function() {
4091 return {
4092 checks: []
4093 };
4094 }, ke = {
4095 /** E.g. node */
4096 GROUP: 0,
4097 /** A collection of elements */
4098 COLLECTION: 1,
4099 /** A filter(ele) function */
4100 FILTER: 2,
4101 /** E.g. [foo > 1] */
4102 DATA_COMPARE: 3,
4103 /** E.g. [foo] */
4104 DATA_EXIST: 4,
4105 /** E.g. [?foo] */
4106 DATA_BOOL: 5,
4107 /** E.g. [[degree > 2]] */
4108 META_COMPARE: 6,
4109 /** E.g. :selected */
4110 STATE: 7,
4111 /** E.g. #foo */
4112 ID: 8,
4113 /** E.g. .foo */
4114 CLASS: 9,
4115 /** E.g. #foo <-> #bar */
4116 UNDIRECTED_EDGE: 10,
4117 /** E.g. #foo -> #bar */
4118 DIRECTED_EDGE: 11,
4119 /** E.g. $#foo -> #bar */
4120 NODE_SOURCE: 12,
4121 /** E.g. #foo -> $#bar */
4122 NODE_TARGET: 13,
4123 /** E.g. $#foo <-> #bar */
4124 NODE_NEIGHBOR: 14,
4125 /** E.g. #foo > #bar */
4126 CHILD: 15,
4127 /** E.g. #foo #bar */
4128 DESCENDANT: 16,
4129 /** E.g. $#foo > #bar */
4130 PARENT: 17,
4131 /** E.g. $#foo #bar */
4132 ANCESTOR: 18,
4133 /** E.g. #foo > $bar > #baz */
4134 COMPOUND_SPLIT: 19,
4135 /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */
4136 TRUE: 20
4137 }, Ti = [{
4138 selector: ":selected",
4139 matches: function(e) {
4140 return e.selected();
4141 }
4142 }, {
4143 selector: ":unselected",
4144 matches: function(e) {
4145 return !e.selected();
4146 }
4147 }, {
4148 selector: ":selectable",
4149 matches: function(e) {
4150 return e.selectable();
4151 }
4152 }, {
4153 selector: ":unselectable",
4154 matches: function(e) {
4155 return !e.selectable();
4156 }
4157 }, {
4158 selector: ":locked",
4159 matches: function(e) {
4160 return e.locked();
4161 }
4162 }, {
4163 selector: ":unlocked",
4164 matches: function(e) {
4165 return !e.locked();
4166 }
4167 }, {
4168 selector: ":visible",
4169 matches: function(e) {
4170 return e.visible();
4171 }
4172 }, {
4173 selector: ":hidden",
4174 matches: function(e) {
4175 return !e.visible();
4176 }
4177 }, {
4178 selector: ":transparent",
4179 matches: function(e) {
4180 return e.transparent();
4181 }
4182 }, {
4183 selector: ":grabbed",
4184 matches: function(e) {
4185 return e.grabbed();
4186 }
4187 }, {
4188 selector: ":free",
4189 matches: function(e) {
4190 return !e.grabbed();
4191 }
4192 }, {
4193 selector: ":removed",
4194 matches: function(e) {
4195 return e.removed();
4196 }
4197 }, {
4198 selector: ":inside",
4199 matches: function(e) {
4200 return !e.removed();
4201 }
4202 }, {
4203 selector: ":grabbable",
4204 matches: function(e) {
4205 return e.grabbable();
4206 }
4207 }, {
4208 selector: ":ungrabbable",
4209 matches: function(e) {
4210 return !e.grabbable();
4211 }
4212 }, {
4213 selector: ":animated",
4214 matches: function(e) {
4215 return e.animated();
4216 }
4217 }, {
4218 selector: ":unanimated",
4219 matches: function(e) {
4220 return !e.animated();
4221 }
4222 }, {
4223 selector: ":parent",
4224 matches: function(e) {
4225 return e.isParent();
4226 }
4227 }, {
4228 selector: ":childless",
4229 matches: function(e) {
4230 return e.isChildless();
4231 }
4232 }, {
4233 selector: ":child",
4234 matches: function(e) {
4235 return e.isChild();
4236 }
4237 }, {
4238 selector: ":orphan",
4239 matches: function(e) {
4240 return e.isOrphan();
4241 }
4242 }, {
4243 selector: ":nonorphan",
4244 matches: function(e) {
4245 return e.isChild();
4246 }
4247 }, {
4248 selector: ":compound",
4249 matches: function(e) {
4250 return e.isNode() ? e.isParent() : e.source().isParent() || e.target().isParent();
4251 }
4252 }, {
4253 selector: ":loop",
4254 matches: function(e) {
4255 return e.isLoop();
4256 }
4257 }, {
4258 selector: ":simple",
4259 matches: function(e) {
4260 return e.isSimple();
4261 }
4262 }, {
4263 selector: ":active",
4264 matches: function(e) {
4265 return e.active();
4266 }
4267 }, {
4268 selector: ":inactive",
4269 matches: function(e) {
4270 return !e.active();
4271 }
4272 }, {
4273 selector: ":backgrounding",
4274 matches: function(e) {
4275 return e.backgrounding();
4276 }
4277 }, {
4278 selector: ":nonbackgrounding",
4279 matches: function(e) {
4280 return !e.backgrounding();
4281 }
4282 }].sort(function(t, e) {
4283 return Kl(t.selector, e.selector);
4284 }), zc = function() {
4285 for (var t = {}, e, r = 0; r < Ti.length; r++)
4286 e = Ti[r], t[e.selector] = e.matches;
4287 return t;
4288 }(), Vc = function(e, r) {
4289 return zc[e](r);
4290 }, Uc = "(" + Ti.map(function(t) {
4291 return t.selector;
4292 }).join("|") + ")", ua = function(e) {
4293 return e.replace(new RegExp("\\\\(" + st.metaChar + ")", "g"), function(r, a) {
4294 return a;
4295 });
4296 }, Dr = function(e, r, a) {
4297 e[e.length - 1] = a;
4298 }, Ci = [{
4299 name: "group",
4300 // just used for identifying when debugging
4301 query: !0,
4302 regex: "(" + st.group + ")",
4303 populate: function(e, r, a) {
4304 var n = x(a, 1), i = n[0];
4305 r.checks.push({
4306 type: ke.GROUP,
4307 value: i === "*" ? i : i + "s"
4308 });
4309 }
4310 }, {
4311 name: "state",
4312 query: !0,
4313 regex: Uc,
4314 populate: function(e, r, a) {
4315 var n = x(a, 1), i = n[0];
4316 r.checks.push({
4317 type: ke.STATE,
4318 value: i
4319 });
4320 }
4321 }, {
4322 name: "id",
4323 query: !0,
4324 regex: "\\#(" + st.id + ")",
4325 populate: function(e, r, a) {
4326 var n = x(a, 1), i = n[0];
4327 r.checks.push({
4328 type: ke.ID,
4329 value: ua(i)
4330 });
4331 }
4332 }, {
4333 name: "className",
4334 query: !0,
4335 regex: "\\.(" + st.className + ")",
4336 populate: function(e, r, a) {
4337 var n = x(a, 1), i = n[0];
4338 r.checks.push({
4339 type: ke.CLASS,
4340 value: ua(i)
4341 });
4342 }
4343 }, {
4344 name: "dataExists",
4345 query: !0,
4346 regex: "\\[\\s*(" + st.variable + ")\\s*\\]",
4347 populate: function(e, r, a) {
4348 var n = x(a, 1), i = n[0];
4349 r.checks.push({
4350 type: ke.DATA_EXIST,
4351 field: ua(i)
4352 });
4353 }
4354 }, {
4355 name: "dataCompare",
4356 query: !0,
4357 regex: "\\[\\s*(" + st.variable + ")\\s*(" + st.comparatorOp + ")\\s*(" + st.value + ")\\s*\\]",
4358 populate: function(e, r, a) {
4359 var n = x(a, 3), i = n[0], s = n[1], o = n[2], u = new RegExp("^" + st.string + "$").exec(o) != null;
4360 u ? o = o.substring(1, o.length - 1) : o = parseFloat(o), r.checks.push({
4361 type: ke.DATA_COMPARE,
4362 field: ua(i),
4363 operator: s,
4364 value: o
4365 });
4366 }
4367 }, {
4368 name: "dataBool",
4369 query: !0,
4370 regex: "\\[\\s*(" + st.boolOp + ")\\s*(" + st.variable + ")\\s*\\]",
4371 populate: function(e, r, a) {
4372 var n = x(a, 2), i = n[0], s = n[1];
4373 r.checks.push({
4374 type: ke.DATA_BOOL,
4375 field: ua(s),
4376 operator: i
4377 });
4378 }
4379 }, {
4380 name: "metaCompare",
4381 query: !0,
4382 regex: "\\[\\[\\s*(" + st.meta + ")\\s*(" + st.comparatorOp + ")\\s*(" + st.number + ")\\s*\\]\\]",
4383 populate: function(e, r, a) {
4384 var n = x(a, 3), i = n[0], s = n[1], o = n[2];
4385 r.checks.push({
4386 type: ke.META_COMPARE,
4387 field: ua(i),
4388 operator: s,
4389 value: parseFloat(o)
4390 });
4391 }
4392 }, {
4393 name: "nextQuery",
4394 separator: !0,
4395 regex: st.separator,
4396 populate: function(e, r) {
4397 var a = e.currentSubject, n = e.edgeCount, i = e.compoundCount, s = e[e.length - 1];
4398 a != null && (s.subject = a, e.currentSubject = null), s.edgeCount = n, s.compoundCount = i, e.edgeCount = 0, e.compoundCount = 0;
4399 var o = e[e.length++] = pt();
4400 return o;
4401 }
4402 }, {
4403 name: "directedEdge",
4404 separator: !0,
4405 regex: st.directedEdge,
4406 populate: function(e, r) {
4407 if (e.currentSubject == null) {
4408 var a = pt(), n = r, i = pt();
4409 return a.checks.push({
4410 type: ke.DIRECTED_EDGE,
4411 source: n,
4412 target: i
4413 }), Dr(e, r, a), e.edgeCount++, i;
4414 } else {
4415 var s = pt(), o = r, u = pt();
4416 return s.checks.push({
4417 type: ke.NODE_SOURCE,
4418 source: o,
4419 target: u
4420 }), Dr(e, r, s), e.edgeCount++, u;
4421 }
4422 }
4423 }, {
4424 name: "undirectedEdge",
4425 separator: !0,
4426 regex: st.undirectedEdge,
4427 populate: function(e, r) {
4428 if (e.currentSubject == null) {
4429 var a = pt(), n = r, i = pt();
4430 return a.checks.push({
4431 type: ke.UNDIRECTED_EDGE,
4432 nodes: [n, i]
4433 }), Dr(e, r, a), e.edgeCount++, i;
4434 } else {
4435 var s = pt(), o = r, u = pt();
4436 return s.checks.push({
4437 type: ke.NODE_NEIGHBOR,
4438 node: o,
4439 neighbor: u
4440 }), Dr(e, r, s), u;
4441 }
4442 }
4443 }, {
4444 name: "child",
4445 separator: !0,
4446 regex: st.child,
4447 populate: function(e, r) {
4448 if (e.currentSubject == null) {
4449 var a = pt(), n = pt(), i = e[e.length - 1];
4450 return a.checks.push({
4451 type: ke.CHILD,
4452 parent: i,
4453 child: n
4454 }), Dr(e, r, a), e.compoundCount++, n;
4455 } else if (e.currentSubject === r) {
4456 var s = pt(), o = e[e.length - 1], u = pt(), l = pt(), f = pt(), h = pt();
4457 return s.checks.push({
4458 type: ke.COMPOUND_SPLIT,
4459 left: o,
4460 right: u,
4461 subject: l
4462 }), l.checks = r.checks, r.checks = [{
4463 type: ke.TRUE
4464 }], h.checks.push({
4465 type: ke.TRUE
4466 }), u.checks.push({
4467 type: ke.PARENT,
4468 // type is swapped on right side queries
4469 parent: h,
4470 child: f
4471 // empty for now
4472 }), Dr(e, o, s), e.currentSubject = l, e.compoundCount++, f;
4473 } else {
4474 var v = pt(), d = pt(), c = [{
4475 type: ke.PARENT,
4476 parent: v,
4477 child: d
4478 }];
4479 return v.checks = r.checks, r.checks = c, e.compoundCount++, d;
4480 }
4481 }
4482 }, {
4483 name: "descendant",
4484 separator: !0,
4485 regex: st.descendant,
4486 populate: function(e, r) {
4487 if (e.currentSubject == null) {
4488 var a = pt(), n = pt(), i = e[e.length - 1];
4489 return a.checks.push({
4490 type: ke.DESCENDANT,
4491 ancestor: i,
4492 descendant: n
4493 }), Dr(e, r, a), e.compoundCount++, n;
4494 } else if (e.currentSubject === r) {
4495 var s = pt(), o = e[e.length - 1], u = pt(), l = pt(), f = pt(), h = pt();
4496 return s.checks.push({
4497 type: ke.COMPOUND_SPLIT,
4498 left: o,
4499 right: u,
4500 subject: l
4501 }), l.checks = r.checks, r.checks = [{
4502 type: ke.TRUE
4503 }], h.checks.push({
4504 type: ke.TRUE
4505 }), u.checks.push({
4506 type: ke.ANCESTOR,
4507 // type is swapped on right side queries
4508 ancestor: h,
4509 descendant: f
4510 // empty for now
4511 }), Dr(e, o, s), e.currentSubject = l, e.compoundCount++, f;
4512 } else {
4513 var v = pt(), d = pt(), c = [{
4514 type: ke.ANCESTOR,
4515 ancestor: v,
4516 descendant: d
4517 }];
4518 return v.checks = r.checks, r.checks = c, e.compoundCount++, d;
4519 }
4520 }
4521 }, {
4522 name: "subject",
4523 modifier: !0,
4524 regex: st.subject,
4525 populate: function(e, r) {
4526 if (e.currentSubject != null && e.currentSubject !== r)
4527 return vt("Redefinition of subject in selector `" + e.toString() + "`"), !1;
4528 e.currentSubject = r;
4529 var a = e[e.length - 1], n = a.checks[0], i = n == null ? null : n.type;
4530 i === ke.DIRECTED_EDGE ? n.type = ke.NODE_TARGET : i === ke.UNDIRECTED_EDGE && (n.type = ke.NODE_NEIGHBOR, n.node = n.nodes[1], n.neighbor = n.nodes[0], n.nodes = null);
4531 }
4532 }];
4533 Ci.forEach(function(t) {
4534 return t.regexObj = new RegExp("^" + t.regex);
4535 });
4536 var $c = function(e) {
4537 for (var r, a, n, i = 0; i < Ci.length; i++) {
4538 var s = Ci[i], o = s.name, u = e.match(s.regexObj);
4539 if (u != null) {
4540 a = u, r = s, n = o;
4541 var l = u[0];
4542 e = e.substring(l.length);
4543 break;
4544 }
4545 }
4546 return {
4547 expr: r,
4548 match: a,
4549 name: n,
4550 remaining: e
4551 };
4552 }, _c = function(e) {
4553 var r = e.match(/^\s+/);
4554 if (r) {
4555 var a = r[0];
4556 e = e.substring(a.length);
4557 }
4558 return e;
4559 }, Yc = function(e) {
4560 var r = this, a = r.inputText = e, n = r[0] = pt();
4561 for (r.length = 1, a = _c(a); ; ) {
4562 var i = $c(a);
4563 if (i.expr == null)
4564 return vt("The selector `" + e + "`is invalid"), !1;
4565 var s = i.match.slice(1), o = i.expr.populate(r, n, s);
4566 if (o === !1)
4567 return !1;
4568 if (o != null && (n = o), a = i.remaining, a.match(/^\s*$/))
4569 break;
4570 }
4571 var u = r[r.length - 1];
4572 r.currentSubject != null && (u.subject = r.currentSubject), u.edgeCount = r.edgeCount, u.compoundCount = r.compoundCount;
4573 for (var l = 0; l < r.length; l++) {
4574 var f = r[l];
4575 if (f.compoundCount > 0 && f.edgeCount > 0)
4576 return vt("The selector `" + e + "` is invalid because it uses both a compound selector and an edge selector"), !1;
4577 if (f.edgeCount > 1)
4578 return vt("The selector `" + e + "` is invalid because it uses multiple edge selectors"), !1;
4579 f.edgeCount === 1 && vt("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.");
4580 }
4581 return !0;
4582 }, Hc = function() {
4583 if (this.toStringCache != null)
4584 return this.toStringCache;
4585 for (var e = function(f) {
4586 return f ?? "";
4587 }, r = function(f) {
4588 return ee(f) ? '"' + f + '"' : e(f);
4589 }, a = function(f) {
4590 return " " + f + " ";
4591 }, n = function(f, h) {
4592 var v = f.type, d = f.value;
4593 switch (v) {
4594 case ke.GROUP: {
4595 var c = e(d);
4596 return c.substring(0, c.length - 1);
4597 }
4598 case ke.DATA_COMPARE: {
4599 var y = f.field, p = f.operator;
4600 return "[" + y + a(e(p)) + r(d) + "]";
4601 }
4602 case ke.DATA_BOOL: {
4603 var g = f.operator, m = f.field;
4604 return "[" + e(g) + m + "]";
4605 }
4606 case ke.DATA_EXIST: {
4607 var b = f.field;
4608 return "[" + b + "]";
4609 }
4610 case ke.META_COMPARE: {
4611 var E = f.operator, M = f.field;
4612 return "[[" + M + a(e(E)) + r(d) + "]]";
4613 }
4614 case ke.STATE:
4615 return d;
4616 case ke.ID:
4617 return "#" + d;
4618 case ke.CLASS:
4619 return "." + d;
4620 case ke.PARENT:
4621 case ke.CHILD:
4622 return i(f.parent, h) + a(">") + i(f.child, h);
4623 case ke.ANCESTOR:
4624 case ke.DESCENDANT:
4625 return i(f.ancestor, h) + " " + i(f.descendant, h);
4626 case ke.COMPOUND_SPLIT: {
4627 var L = i(f.left, h), w = i(f.subject, h), k = i(f.right, h);
4628 return L + (L.length > 0 ? " " : "") + w + k;
4629 }
4630 case ke.TRUE:
4631 return "";
4632 }
4633 }, i = function(f, h) {
4634 return f.checks.reduce(function(v, d, c) {
4635 return v + (h === f && c === 0 ? "$" : "") + n(d, h);
4636 }, "");
4637 }, s = "", o = 0; o < this.length; o++) {
4638 var u = this[o];
4639 s += i(u, u.subject), this.length > 1 && o < this.length - 1 && (s += ", ");
4640 }
4641 return this.toStringCache = s, s;
4642 }, Xc = {
4643 parse: Yc,
4644 toString: Hc
4645 }, uo = function(e, r, a) {
4646 var n, i = ee(e), s = R(e), o = ee(a), u, l, f = !1, h = !1, v = !1;
4647 switch (r.indexOf("!") >= 0 && (r = r.replace("!", ""), h = !0), r.indexOf("@") >= 0 && (r = r.replace("@", ""), f = !0), (i || o || f) && (u = !i && !s ? "" : "" + e, l = "" + a), f && (e = u = u.toLowerCase(), a = l = l.toLowerCase()), r) {
4648 case "*=":
4649 n = u.indexOf(l) >= 0;
4650 break;
4651 case "$=":
4652 n = u.indexOf(l, u.length - l.length) >= 0;
4653 break;
4654 case "^=":
4655 n = u.indexOf(l) === 0;
4656 break;
4657 case "=":
4658 n = e === a;
4659 break;
4660 case ">":
4661 v = !0, n = e > a;
4662 break;
4663 case ">=":
4664 v = !0, n = e >= a;
4665 break;
4666 case "<":
4667 v = !0, n = e < a;
4668 break;
4669 case "<=":
4670 v = !0, n = e <= a;
4671 break;
4672 default:
4673 n = !1;
4674 break;
4675 }
4676 return h && (e != null || !v) && (n = !n), n;
4677 }, Wc = function(e, r) {
4678 switch (r) {
4679 case "?":
4680 return !!e;
4681 case "!":
4682 return !e;
4683 case "^":
4684 return e === void 0;
4685 }
4686 }, qc = function(e) {
4687 return e !== void 0;
4688 }, Di = function(e, r) {
4689 return e.data(r);
4690 }, Kc = function(e, r) {
4691 return e[r]();
4692 }, Tt = [], wt = function(e, r) {
4693 return e.checks.every(function(a) {
4694 return Tt[a.type](a, r);
4695 });
4696 };
4697 Tt[ke.GROUP] = function(t, e) {
4698 var r = t.value;
4699 return r === "*" || r === e.group();
4700 }, Tt[ke.STATE] = function(t, e) {
4701 var r = t.value;
4702 return Vc(r, e);
4703 }, Tt[ke.ID] = function(t, e) {
4704 var r = t.value;
4705 return e.id() === r;
4706 }, Tt[ke.CLASS] = function(t, e) {
4707 var r = t.value;
4708 return e.hasClass(r);
4709 }, Tt[ke.META_COMPARE] = function(t, e) {
4710 var r = t.field, a = t.operator, n = t.value;
4711 return uo(Kc(e, r), a, n);
4712 }, Tt[ke.DATA_COMPARE] = function(t, e) {
4713 var r = t.field, a = t.operator, n = t.value;
4714 return uo(Di(e, r), a, n);
4715 }, Tt[ke.DATA_BOOL] = function(t, e) {
4716 var r = t.field, a = t.operator;
4717 return Wc(Di(e, r), a);
4718 }, Tt[ke.DATA_EXIST] = function(t, e) {
4719 var r = t.field;
4720 return t.operator, qc(Di(e, r));
4721 }, Tt[ke.UNDIRECTED_EDGE] = function(t, e) {
4722 var r = t.nodes[0], a = t.nodes[1], n = e.source(), i = e.target();
4723 return wt(r, n) && wt(a, i) || wt(a, n) && wt(r, i);
4724 }, Tt[ke.NODE_NEIGHBOR] = function(t, e) {
4725 return wt(t.node, e) && e.neighborhood().some(function(r) {
4726 return r.isNode() && wt(t.neighbor, r);
4727 });
4728 }, Tt[ke.DIRECTED_EDGE] = function(t, e) {
4729 return wt(t.source, e.source()) && wt(t.target, e.target());
4730 }, Tt[ke.NODE_SOURCE] = function(t, e) {
4731 return wt(t.source, e) && e.outgoers().some(function(r) {
4732 return r.isNode() && wt(t.target, r);
4733 });
4734 }, Tt[ke.NODE_TARGET] = function(t, e) {
4735 return wt(t.target, e) && e.incomers().some(function(r) {
4736 return r.isNode() && wt(t.source, r);
4737 });
4738 }, Tt[ke.CHILD] = function(t, e) {
4739 return wt(t.child, e) && wt(t.parent, e.parent());
4740 }, Tt[ke.PARENT] = function(t, e) {
4741 return wt(t.parent, e) && e.children().some(function(r) {
4742 return wt(t.child, r);
4743 });
4744 }, Tt[ke.DESCENDANT] = function(t, e) {
4745 return wt(t.descendant, e) && e.ancestors().some(function(r) {
4746 return wt(t.ancestor, r);
4747 });
4748 }, Tt[ke.ANCESTOR] = function(t, e) {
4749 return wt(t.ancestor, e) && e.descendants().some(function(r) {
4750 return wt(t.descendant, r);
4751 });
4752 }, Tt[ke.COMPOUND_SPLIT] = function(t, e) {
4753 return wt(t.subject, e) && wt(t.left, e) && wt(t.right, e);
4754 }, Tt[ke.TRUE] = function() {
4755 return !0;
4756 }, Tt[ke.COLLECTION] = function(t, e) {
4757 var r = t.value;
4758 return r.has(e);
4759 }, Tt[ke.FILTER] = function(t, e) {
4760 var r = t.value;
4761 return r(e);
4762 };
4763 var Zc = function(e) {
4764 var r = this;
4765 if (r.length === 1 && r[0].checks.length === 1 && r[0].checks[0].type === ke.ID)
4766 return e.getElementById(r[0].checks[0].value).collection();
4767 var a = function(i) {
4768 for (var s = 0; s < r.length; s++) {
4769 var o = r[s];
4770 if (wt(o, i))
4771 return !0;
4772 }
4773 return !1;
4774 };
4775 return r.text() == null && (a = function() {
4776 return !0;
4777 }), e.filter(a);
4778 }, Qc = function(e) {
4779 for (var r = this, a = 0; a < r.length; a++) {
4780 var n = r[a];
4781 if (wt(n, e))
4782 return !0;
4783 }
4784 return !1;
4785 }, Jc = {
4786 matches: Qc,
4787 filter: Zc
4788 }, Sr = function(e) {
4789 this.inputText = e, this.currentSubject = null, this.compoundCount = 0, this.edgeCount = 0, this.length = 0, e == null || ee(e) && e.match(/^\s*$/) || (pe(e) ? this.addQuery({
4790 checks: [{
4791 type: ke.COLLECTION,
4792 value: e.collection()
4793 }]
4794 }) : H(e) ? this.addQuery({
4795 checks: [{
4796 type: ke.FILTER,
4797 value: e
4798 }]
4799 }) : ee(e) ? this.parse(e) || (this.invalid = !0) : xt("A selector must be created from a string; found "));
4800 }, Lr = Sr.prototype;
4801 [Xc, Jc].forEach(function(t) {
4802 return He(Lr, t);
4803 }), Lr.text = function() {
4804 return this.inputText;
4805 }, Lr.size = function() {
4806 return this.length;
4807 }, Lr.eq = function(t) {
4808 return this[t];
4809 }, Lr.sameText = function(t) {
4810 return !this.invalid && !t.invalid && this.text() === t.text();
4811 }, Lr.addQuery = function(t) {
4812 this[this.length++] = t;
4813 }, Lr.selector = Lr.toString;
4814 var Ar = {
4815 allAre: function(e) {
4816 var r = new Sr(e);
4817 return this.every(function(a) {
4818 return r.matches(a);
4819 });
4820 },
4821 is: function(e) {
4822 var r = new Sr(e);
4823 return this.some(function(a) {
4824 return r.matches(a);
4825 });
4826 },
4827 some: function(e, r) {
4828 for (var a = 0; a < this.length; a++) {
4829 var n = r ? e.apply(r, [this[a], a, this]) : e(this[a], a, this);
4830 if (n)
4831 return !0;
4832 }
4833 return !1;
4834 },
4835 every: function(e, r) {
4836 for (var a = 0; a < this.length; a++) {
4837 var n = r ? e.apply(r, [this[a], a, this]) : e(this[a], a, this);
4838 if (!n)
4839 return !1;
4840 }
4841 return !0;
4842 },
4843 same: function(e) {
4844 if (this === e)
4845 return !0;
4846 e = this.cy().collection(e);
4847 var r = this.length, a = e.length;
4848 return r !== a ? !1 : r === 1 ? this[0] === e[0] : this.every(function(n) {
4849 return e.hasElementWithId(n.id());
4850 });
4851 },
4852 anySame: function(e) {
4853 return e = this.cy().collection(e), this.some(function(r) {
4854 return e.hasElementWithId(r.id());
4855 });
4856 },
4857 allAreNeighbors: function(e) {
4858 e = this.cy().collection(e);
4859 var r = this.neighborhood();
4860 return e.every(function(a) {
4861 return r.hasElementWithId(a.id());
4862 });
4863 },
4864 contains: function(e) {
4865 e = this.cy().collection(e);
4866 var r = this;
4867 return e.every(function(a) {
4868 return r.hasElementWithId(a.id());
4869 });
4870 }
4871 };
4872 Ar.allAreNeighbours = Ar.allAreNeighbors, Ar.has = Ar.contains, Ar.equal = Ar.equals = Ar.same;
4873 var Zt = function(e, r) {
4874 return function(n, i, s, o) {
4875 var u = n, l = this, f;
4876 if (u == null ? f = "" : pe(u) && u.length === 1 && (f = u.id()), l.length === 1 && f) {
4877 var h = l[0]._private, v = h.traversalCache = h.traversalCache || {}, d = v[r] = v[r] || [], c = Pr(f), y = d[c];
4878 return y || (d[c] = e.call(l, n, i, s, o));
4879 } else
4880 return e.call(l, n, i, s, o);
4881 };
4882 }, fa = {
4883 parent: function(e) {
4884 var r = [];
4885 if (this.length === 1) {
4886 var a = this[0]._private.parent;
4887 if (a)
4888 return a;
4889 }
4890 for (var n = 0; n < this.length; n++) {
4891 var i = this[n], s = i._private.parent;
4892 s && r.push(s);
4893 }
4894 return this.spawn(r, !0).filter(e);
4895 },
4896 parents: function(e) {
4897 for (var r = [], a = this.parent(); a.nonempty(); ) {
4898 for (var n = 0; n < a.length; n++) {
4899 var i = a[n];
4900 r.push(i);
4901 }
4902 a = a.parent();
4903 }
4904 return this.spawn(r, !0).filter(e);
4905 },
4906 commonAncestors: function(e) {
4907 for (var r, a = 0; a < this.length; a++) {
4908 var n = this[a], i = n.parents();
4909 r = r || i, r = r.intersect(i);
4910 }
4911 return r.filter(e);
4912 },
4913 orphans: function(e) {
4914 return this.stdFilter(function(r) {
4915 return r.isOrphan();
4916 }).filter(e);
4917 },
4918 nonorphans: function(e) {
4919 return this.stdFilter(function(r) {
4920 return r.isChild();
4921 }).filter(e);
4922 },
4923 children: Zt(function(t) {
4924 for (var e = [], r = 0; r < this.length; r++)
4925 for (var a = this[r], n = a._private.children, i = 0; i < n.length; i++)
4926 e.push(n[i]);
4927 return this.spawn(e, !0).filter(t);
4928 }, "children"),
4929 siblings: function(e) {
4930 return this.parent().children().not(this).filter(e);
4931 },
4932 isParent: function() {
4933 var e = this[0];
4934 if (e)
4935 return e.isNode() && e._private.children.length !== 0;
4936 },
4937 isChildless: function() {
4938 var e = this[0];
4939 if (e)
4940 return e.isNode() && e._private.children.length === 0;
4941 },
4942 isChild: function() {
4943 var e = this[0];
4944 if (e)
4945 return e.isNode() && e._private.parent != null;
4946 },
4947 isOrphan: function() {
4948 var e = this[0];
4949 if (e)
4950 return e.isNode() && e._private.parent == null;
4951 },
4952 descendants: function(e) {
4953 var r = [];
4954 function a(n) {
4955 for (var i = 0; i < n.length; i++) {
4956 var s = n[i];
4957 r.push(s), s.children().nonempty() && a(s.children());
4958 }
4959 }
4960 return a(this.children()), this.spawn(r, !0).filter(e);
4961 }
4962 };
4963 function Si(t, e, r, a) {
4964 for (var n = [], i = new Jr(), s = t.cy(), o = s.hasCompoundNodes(), u = 0; u < t.length; u++) {
4965 var l = t[u];
4966 r ? n.push(l) : o && a(n, i, l);
4967 }
4968 for (; n.length > 0; ) {
4969 var f = n.shift();
4970 e(f), i.add(f.id()), o && a(n, i, f);
4971 }
4972 return t;
4973 }
4974 function fo(t, e, r) {
4975 if (r.isParent())
4976 for (var a = r._private.children, n = 0; n < a.length; n++) {
4977 var i = a[n];
4978 e.has(i.id()) || t.push(i);
4979 }
4980 }
4981 fa.forEachDown = function(t) {
4982 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
4983 return Si(this, t, e, fo);
4984 };
4985 function ho(t, e, r) {
4986 if (r.isChild()) {
4987 var a = r._private.parent;
4988 e.has(a.id()) || t.push(a);
4989 }
4990 }
4991 fa.forEachUp = function(t) {
4992 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
4993 return Si(this, t, e, ho);
4994 };
4995 function jc(t, e, r) {
4996 ho(t, e, r), fo(t, e, r);
4997 }
4998 fa.forEachUpAndDown = function(t) {
4999 var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
5000 return Si(this, t, e, jc);
5001 }, fa.ancestors = fa.parents;
5002 var Va, vo;
5003 Va = vo = {
5004 data: ct.data({
5005 field: "data",
5006 bindingEvent: "data",
5007 allowBinding: !0,
5008 allowSetting: !0,
5009 settingEvent: "data",
5010 settingTriggersEvent: !0,
5011 triggerFnName: "trigger",
5012 allowGetting: !0,
5013 immutableKeys: {
5014 id: !0,
5015 source: !0,
5016 target: !0,
5017 parent: !0
5018 },
5019 updateStyle: !0
5020 }),
5021 removeData: ct.removeData({
5022 field: "data",
5023 event: "data",
5024 triggerFnName: "trigger",
5025 triggerEvent: !0,
5026 immutableKeys: {
5027 id: !0,
5028 source: !0,
5029 target: !0,
5030 parent: !0
5031 },
5032 updateStyle: !0
5033 }),
5034 scratch: ct.data({
5035 field: "scratch",
5036 bindingEvent: "scratch",
5037 allowBinding: !0,
5038 allowSetting: !0,
5039 settingEvent: "scratch",
5040 settingTriggersEvent: !0,
5041 triggerFnName: "trigger",
5042 allowGetting: !0,
5043 updateStyle: !0
5044 }),
5045 removeScratch: ct.removeData({
5046 field: "scratch",
5047 event: "scratch",
5048 triggerFnName: "trigger",
5049 triggerEvent: !0,
5050 updateStyle: !0
5051 }),
5052 rscratch: ct.data({
5053 field: "rscratch",
5054 allowBinding: !1,
5055 allowSetting: !0,
5056 settingTriggersEvent: !1,
5057 allowGetting: !0
5058 }),
5059 removeRscratch: ct.removeData({
5060 field: "rscratch",
5061 triggerEvent: !1
5062 }),
5063 id: function() {
5064 var e = this[0];
5065 if (e)
5066 return e._private.data.id;
5067 }
5068 }, Va.attr = Va.data, Va.removeAttr = Va.removeData;
5069 var ed = vo, An = {};
5070 function Li(t) {
5071 return function(e) {
5072 var r = this;
5073 if (e === void 0 && (e = !0), r.length !== 0)
5074 if (r.isNode() && !r.removed()) {
5075 for (var a = 0, n = r[0], i = n._private.edges, s = 0; s < i.length; s++) {
5076 var o = i[s];
5077 !e && o.isLoop() || (a += t(n, o));
5078 }
5079 return a;
5080 } else
5081 return;
5082 };
5083 }
5084 He(An, {
5085 degree: Li(function(t, e) {
5086 return e.source().same(e.target()) ? 2 : 1;
5087 }),
5088 indegree: Li(function(t, e) {
5089 return e.target().same(t) ? 1 : 0;
5090 }),
5091 outdegree: Li(function(t, e) {
5092 return e.source().same(t) ? 1 : 0;
5093 })
5094 });
5095 function ha(t, e) {
5096 return function(r) {
5097 for (var a, n = this.nodes(), i = 0; i < n.length; i++) {
5098 var s = n[i], o = s[t](r);
5099 o !== void 0 && (a === void 0 || e(o, a)) && (a = o);
5100 }
5101 return a;
5102 };
5103 }
5104 He(An, {
5105 minDegree: ha("degree", function(t, e) {
5106 return t < e;
5107 }),
5108 maxDegree: ha("degree", function(t, e) {
5109 return t > e;
5110 }),
5111 minIndegree: ha("indegree", function(t, e) {
5112 return t < e;
5113 }),
5114 maxIndegree: ha("indegree", function(t, e) {
5115 return t > e;
5116 }),
5117 minOutdegree: ha("outdegree", function(t, e) {
5118 return t < e;
5119 }),
5120 maxOutdegree: ha("outdegree", function(t, e) {
5121 return t > e;
5122 })
5123 }), He(An, {
5124 totalDegree: function(e) {
5125 for (var r = 0, a = this.nodes(), n = 0; n < a.length; n++)
5126 r += a[n].degree(e);
5127 return r;
5128 }
5129 });
5130 var tr, co, go = function(e, r, a) {
5131 for (var n = 0; n < e.length; n++) {
5132 var i = e[n];
5133 if (!i.locked()) {
5134 var s = i._private.position, o = {
5135 x: r.x != null ? r.x - s.x : 0,
5136 y: r.y != null ? r.y - s.y : 0
5137 };
5138 i.isParent() && !(o.x === 0 && o.y === 0) && i.children().shift(o, a), i.dirtyBoundingBoxCache();
5139 }
5140 }
5141 }, po = {
5142 field: "position",
5143 bindingEvent: "position",
5144 allowBinding: !0,
5145 allowSetting: !0,
5146 settingEvent: "position",
5147 settingTriggersEvent: !0,
5148 triggerFnName: "emitAndNotify",
5149 allowGetting: !0,
5150 validKeys: ["x", "y"],
5151 beforeGet: function(e) {
5152 e.updateCompoundBounds();
5153 },
5154 beforeSet: function(e, r) {
5155 go(e, r, !1);
5156 },
5157 onSet: function(e) {
5158 e.dirtyCompoundBoundsCache();
5159 },
5160 canSet: function(e) {
5161 return !e.locked();
5162 }
5163 };
5164 tr = co = {
5165 position: ct.data(po),
5166 // position but no notification to renderer
5167 silentPosition: ct.data(He({}, po, {
5168 allowBinding: !1,
5169 allowSetting: !0,
5170 settingTriggersEvent: !1,
5171 allowGetting: !1,
5172 beforeSet: function(e, r) {
5173 go(e, r, !0);
5174 },
5175 onSet: function(e) {
5176 e.dirtyCompoundBoundsCache();
5177 }
5178 })),
5179 positions: function(e, r) {
5180 if (S(e))
5181 r ? this.silentPosition(e) : this.position(e);
5182 else if (H(e)) {
5183 var a = e, n = this.cy();
5184 n.startBatch();
5185 for (var i = 0; i < this.length; i++) {
5186 var s = this[i], o = void 0;
5187 (o = a(s, i)) && (r ? s.silentPosition(o) : s.position(o));
5188 }
5189 n.endBatch();
5190 }
5191 return this;
5192 },
5193 silentPositions: function(e) {
5194 return this.positions(e, !0);
5195 },
5196 shift: function(e, r, a) {
5197 var n;
5198 if (S(e) ? (n = {
5199 x: R(e.x) ? e.x : 0,
5200 y: R(e.y) ? e.y : 0
5201 }, a = r) : ee(e) && R(r) && (n = {
5202 x: 0,
5203 y: 0
5204 }, n[e] = r), n != null) {
5205 var i = this.cy();
5206 i.startBatch();
5207 for (var s = 0; s < this.length; s++) {
5208 var o = this[s];
5209 if (!(i.hasCompoundNodes() && o.isChild() && o.ancestors().anySame(this))) {
5210 var u = o.position(), l = {
5211 x: u.x + n.x,
5212 y: u.y + n.y
5213 };
5214 a ? o.silentPosition(l) : o.position(l);
5215 }
5216 }
5217 i.endBatch();
5218 }
5219 return this;
5220 },
5221 silentShift: function(e, r) {
5222 return S(e) ? this.shift(e, !0) : ee(e) && R(r) && this.shift(e, r, !0), this;
5223 },
5224 // get/set the rendered (i.e. on screen) positon of the element
5225 renderedPosition: function(e, r) {
5226 var a = this[0], n = this.cy(), i = n.zoom(), s = n.pan(), o = S(e) ? e : void 0, u = o !== void 0 || r !== void 0 && ee(e);
5227 if (a && a.isNode())
5228 if (u)
5229 for (var l = 0; l < this.length; l++) {
5230 var f = this[l];
5231 r !== void 0 ? f.position(e, (r - s[e]) / i) : o !== void 0 && f.position(bs(o, i, s));
5232 }
5233 else {
5234 var h = a.position();
5235 return o = vn(h, i, s), e === void 0 ? o : o[e];
5236 }
5237 else if (!u)
5238 return;
5239 return this;
5240 },
5241 // get/set the position relative to the parent
5242 relativePosition: function(e, r) {
5243 var a = this[0], n = this.cy(), i = S(e) ? e : void 0, s = i !== void 0 || r !== void 0 && ee(e), o = n.hasCompoundNodes();
5244 if (a && a.isNode())
5245 if (s)
5246 for (var u = 0; u < this.length; u++) {
5247 var l = this[u], f = o ? l.parent() : null, h = f && f.length > 0, v = h;
5248 h && (f = f[0]);
5249 var d = v ? f.position() : {
5250 x: 0,
5251 y: 0
5252 };
5253 r !== void 0 ? l.position(e, r + d[e]) : i !== void 0 && l.position({
5254 x: i.x + d.x,
5255 y: i.y + d.y
5256 });
5257 }
5258 else {
5259 var c = a.position(), y = o ? a.parent() : null, p = y && y.length > 0, g = p;
5260 p && (y = y[0]);
5261 var m = g ? y.position() : {
5262 x: 0,
5263 y: 0
5264 };
5265 return i = {
5266 x: c.x - m.x,
5267 y: c.y - m.y
5268 }, e === void 0 ? i : i[e];
5269 }
5270 else if (!s)
5271 return;
5272 return this;
5273 }
5274 }, tr.modelPosition = tr.point = tr.position, tr.modelPositions = tr.points = tr.positions, tr.renderedPoint = tr.renderedPosition, tr.relativePoint = tr.relativePosition;
5275 var td = co, va, Or;
5276 va = Or = {}, Or.renderedBoundingBox = function(t) {
5277 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, u = e.y2 * a + n.y;
5278 return {
5279 x1: i,
5280 x2: s,
5281 y1: o,
5282 y2: u,
5283 w: s - i,
5284 h: u - o
5285 };
5286 }, Or.dirtyCompoundBoundsCache = function() {
5287 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy();
5288 return !e.styleEnabled() || !e.hasCompoundNodes() ? this : (this.forEachUp(function(r) {
5289 if (r.isParent()) {
5290 var a = r._private;
5291 a.compoundBoundsClean = !1, a.bbCache = null, t || r.emitAndNotify("bounds");
5292 }
5293 }), this);
5294 }, Or.updateCompoundBounds = function() {
5295 var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy();
5296 if (!e.styleEnabled() || !e.hasCompoundNodes())
5297 return this;
5298 if (!t && e.batching())
5299 return this;
5300 function r(s) {
5301 if (!s.isParent())
5302 return;
5303 var o = s._private, u = s.children(), l = s.pstyle("compound-sizing-wrt-labels").value === "include", f = {
5304 width: {
5305 val: s.pstyle("min-width").pfValue,
5306 left: s.pstyle("min-width-bias-left"),
5307 right: s.pstyle("min-width-bias-right")
5308 },
5309 height: {
5310 val: s.pstyle("min-height").pfValue,
5311 top: s.pstyle("min-height-bias-top"),
5312 bottom: s.pstyle("min-height-bias-bottom")
5313 }
5314 }, h = u.boundingBox({
5315 includeLabels: l,
5316 includeOverlays: !1,
5317 // updating the compound bounds happens outside of the regular
5318 // cache cycle (i.e. before fired events)
5319 useCache: !1
5320 }), v = o.position;
5321 (h.w === 0 || h.h === 0) && (h = {
5322 w: s.pstyle("width").pfValue,
5323 h: s.pstyle("height").pfValue
5324 }, h.x1 = v.x - h.w / 2, h.x2 = v.x + h.w / 2, h.y1 = v.y - h.h / 2, h.y2 = v.y + h.h / 2);
5325 function d(D, F, G) {
5326 var N = 0, X = 0, B = F + G;
5327 return D > 0 && B > 0 && (N = F / B * D, X = G / B * D), {
5328 biasDiff: N,
5329 biasComplementDiff: X
5330 };
5331 }
5332 function c(D, F, G, N) {
5333 if (G.units === "%")
5334 switch (N) {
5335 case "width":
5336 return D > 0 ? G.pfValue * D : 0;
5337 case "height":
5338 return F > 0 ? G.pfValue * F : 0;
5339 case "average":
5340 return D > 0 && F > 0 ? G.pfValue * (D + F) / 2 : 0;
5341 case "min":
5342 return D > 0 && F > 0 ? D > F ? G.pfValue * F : G.pfValue * D : 0;
5343 case "max":
5344 return D > 0 && F > 0 ? D > F ? G.pfValue * D : G.pfValue * F : 0;
5345 default:
5346 return 0;
5347 }
5348 else
5349 return G.units === "px" ? G.pfValue : 0;
5350 }
5351 var y = f.width.left.value;
5352 f.width.left.units === "px" && f.width.val > 0 && (y = y * 100 / f.width.val);
5353 var p = f.width.right.value;
5354 f.width.right.units === "px" && f.width.val > 0 && (p = p * 100 / f.width.val);
5355 var g = f.height.top.value;
5356 f.height.top.units === "px" && f.height.val > 0 && (g = g * 100 / f.height.val);
5357 var m = f.height.bottom.value;
5358 f.height.bottom.units === "px" && f.height.val > 0 && (m = m * 100 / f.height.val);
5359 var b = d(f.width.val - h.w, y, p), E = b.biasDiff, M = b.biasComplementDiff, L = d(f.height.val - h.h, g, m), w = L.biasDiff, k = L.biasComplementDiff;
5360 o.autoPadding = c(h.w, h.h, s.pstyle("padding"), s.pstyle("padding-relative-to").value), o.autoWidth = Math.max(h.w, f.width.val), v.x = (-E + h.x1 + h.x2 + M) / 2, o.autoHeight = Math.max(h.h, f.height.val), v.y = (-w + h.y1 + h.y2 + k) / 2;
5361 }
5362 for (var a = 0; a < this.length; a++) {
5363 var n = this[a], i = n._private;
5364 (!i.compoundBoundsClean || t) && (r(n), e.batching() || (i.compoundBoundsClean = !0));
5365 }
5366 return this;
5367 };
5368 var Qt = function(e) {
5369 return e === 1 / 0 || e === -1 / 0 ? 0 : e;
5370 }, rr = function(e, r, a, n, i) {
5371 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);
5372 }, Vr = function(e, r) {
5373 return r == null ? e : rr(e, r.x1, r.y1, r.x2, r.y2);
5374 }, Ua = function(e, r, a) {
5375 return er(e, r, a);
5376 }, On = function(e, r, a) {
5377 if (!r.cy().headless()) {
5378 var n = r._private, i = n.rstyle, s = i.arrowWidth / 2, o = r.pstyle(a + "-arrow-shape").value, u, l;
5379 if (o !== "none") {
5380 a === "source" ? (u = i.srcX, l = i.srcY) : a === "target" ? (u = i.tgtX, l = i.tgtY) : (u = i.midX, l = i.midY);
5381 var f = n.arrowBounds = n.arrowBounds || {}, h = f[a] = f[a] || {};
5382 h.x1 = u - s, h.y1 = l - s, h.x2 = u + s, h.y2 = l + s, h.w = h.x2 - h.x1, h.h = h.y2 - h.y1, dn(h, 1), rr(e, h.x1, h.y1, h.x2, h.y2);
5383 }
5384 }
5385 }, Ai = function(e, r, a) {
5386 if (!r.cy().headless()) {
5387 var n;
5388 a ? n = a + "-" : n = "";
5389 var i = r._private, s = i.rstyle, o = r.pstyle(n + "label").strValue;
5390 if (o) {
5391 var u = r.pstyle("text-halign"), l = r.pstyle("text-valign"), f = Ua(s, "labelWidth", a), h = Ua(s, "labelHeight", a), v = Ua(s, "labelX", a), d = Ua(s, "labelY", a), c = r.pstyle(n + "text-margin-x").pfValue, y = r.pstyle(n + "text-margin-y").pfValue, p = r.isEdge(), g = 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, L = 2, w = h, k = f, D = k / 2, F = w / 2, G, N, X, B;
5392 if (p)
5393 G = v - D, N = v + D, X = d - F, B = d + F;
5394 else {
5395 switch (u.value) {
5396 case "left":
5397 G = v - k, N = v;
5398 break;
5399 case "center":
5400 G = v - D, N = v + D;
5401 break;
5402 case "right":
5403 G = v, N = v + k;
5404 break;
5405 }
5406 switch (l.value) {
5407 case "top":
5408 X = d - w, B = d;
5409 break;
5410 case "center":
5411 X = d - F, B = d + F;
5412 break;
5413 case "bottom":
5414 X = d, B = d + w;
5415 break;
5416 }
5417 }
5418 G += c - Math.max(m, E) - M - L, N += c + Math.max(m, E) + M + L, X += y - Math.max(m, E) - M - L, B += y + Math.max(m, E) + M + L;
5419 var re = a || "main", K = i.labelBounds, W = K[re] = K[re] || {};
5420 W.x1 = G, W.y1 = X, W.x2 = N, W.y2 = B, W.w = N - G, W.h = B - X;
5421 var ae = p && g.strValue === "autorotate", ue = g.pfValue != null && g.pfValue !== 0;
5422 if (ae || ue) {
5423 var me = ae ? Ua(i.rstyle, "labelAngle", a) : g.pfValue, ie = Math.cos(me), ge = Math.sin(me), Ee = (G + N) / 2, Ce = (X + B) / 2;
5424 if (!p) {
5425 switch (u.value) {
5426 case "left":
5427 Ee = N;
5428 break;
5429 case "right":
5430 Ee = G;
5431 break;
5432 }
5433 switch (l.value) {
5434 case "top":
5435 Ce = B;
5436 break;
5437 case "bottom":
5438 Ce = X;
5439 break;
5440 }
5441 }
5442 var we = function(Xe, Ie) {
5443 return Xe = Xe - Ee, Ie = Ie - Ce, {
5444 x: Xe * ie - Ie * ge + Ee,
5445 y: Xe * ge + Ie * ie + Ce
5446 };
5447 }, De = we(G, X), se = we(G, B), xe = we(N, X), Le = we(N, B);
5448 G = Math.min(De.x, se.x, xe.x, Le.x), N = Math.max(De.x, se.x, xe.x, Le.x), X = Math.min(De.y, se.y, xe.y, Le.y), B = Math.max(De.y, se.y, xe.y, Le.y);
5449 }
5450 var Se = re + "Rot", Oe = K[Se] = K[Se] || {};
5451 Oe.x1 = G, Oe.y1 = X, Oe.x2 = N, Oe.y2 = B, Oe.w = N - G, Oe.h = B - X, rr(e, G, X, N, B), rr(i.labelBounds.all, G, X, N, B);
5452 }
5453 return e;
5454 }
5455 }, rd = function(e, r) {
5456 if (!r.cy().headless()) {
5457 var a = r.pstyle("outline-opacity").value, n = r.pstyle("outline-width").value;
5458 if (a > 0 && n > 0) {
5459 var i = r.pstyle("outline-offset").value, s = r.pstyle("shape").value, o = n + i, u = (e.w + o * 2) / e.w, l = (e.h + o * 2) / e.h, f = 0, h = 0;
5460 ["diamond", "pentagon", "round-triangle"].includes(s) ? (u = (e.w + o * 2.4) / e.w, h = -o / 3.6) : ["concave-hexagon", "rhomboid", "right-rhomboid"].includes(s) ? u = (e.w + o * 2.4) / e.w : s === "star" ? (u = (e.w + o * 2.8) / e.w, l = (e.h + o * 2.6) / e.h, h = -o / 3.8) : s === "triangle" ? (u = (e.w + o * 2.8) / e.w, l = (e.h + o * 2.4) / e.h, h = -o / 1.4) : s === "vee" && (u = (e.w + o * 4.4) / e.w, l = (e.h + o * 3.8) / e.h, h = -o * 0.5);
5461 var v = e.h * l - e.h, d = e.w * u - e.w;
5462 if (gn(e, [Math.ceil(v / 2), Math.ceil(d / 2)]), f != 0 || h !== 0) {
5463 var c = Tf(e, f, h);
5464 ws(e, c);
5465 }
5466 }
5467 }
5468 }, ad = function(e, r) {
5469 var a = e._private.cy, n = a.styleEnabled(), i = a.headless(), s = Yt(), o = e._private, u = e.isNode(), l = e.isEdge(), f, h, v, d, c, y, p = o.rstyle, g = u && n ? e.pstyle("bounds-expansion").pfValue : [0], m = function(Ue) {
5470 return Ue.pstyle("display").value !== "none";
5471 }, b = !n || m(e) && (!l || m(e.source()) && m(e.target()));
5472 if (b) {
5473 var E = 0, M = 0;
5474 n && r.includeOverlays && (E = e.pstyle("overlay-opacity").value, E !== 0 && (M = e.pstyle("overlay-padding").value));
5475 var L = 0, w = 0;
5476 n && r.includeUnderlays && (L = e.pstyle("underlay-opacity").value, L !== 0 && (w = e.pstyle("underlay-padding").value));
5477 var k = Math.max(M, w), D = 0, F = 0;
5478 if (n && (D = e.pstyle("width").pfValue, F = D / 2), u && r.includeNodes) {
5479 var G = e.position();
5480 c = G.x, y = G.y;
5481 var N = e.outerWidth(), X = N / 2, B = e.outerHeight(), re = B / 2;
5482 f = c - X, h = c + X, v = y - re, d = y + re, rr(s, f, v, h, d), n && r.includeOutlines && rd(s, e);
5483 } else if (l && r.includeEdges)
5484 if (n && !i) {
5485 var K = e.pstyle("curve-style").strValue;
5486 if (f = Math.min(p.srcX, p.midX, p.tgtX), h = Math.max(p.srcX, p.midX, p.tgtX), v = Math.min(p.srcY, p.midY, p.tgtY), d = Math.max(p.srcY, p.midY, p.tgtY), f -= F, h += F, v -= F, d += F, rr(s, f, v, h, d), K === "haystack") {
5487 var W = p.haystackPts;
5488 if (W && W.length === 2) {
5489 if (f = W[0].x, v = W[0].y, h = W[1].x, d = W[1].y, f > h) {
5490 var ae = f;
5491 f = h, h = ae;
5492 }
5493 if (v > d) {
5494 var ue = v;
5495 v = d, d = ue;
5496 }
5497 rr(s, f - F, v - F, h + F, d + F);
5498 }
5499 } else if (K === "bezier" || K === "unbundled-bezier" || K === "segments" || K === "taxi") {
5500 var me;
5501 switch (K) {
5502 case "bezier":
5503 case "unbundled-bezier":
5504 me = p.bezierPts;
5505 break;
5506 case "segments":
5507 case "taxi":
5508 me = p.linePts;
5509 break;
5510 }
5511 if (me != null)
5512 for (var ie = 0; ie < me.length; ie++) {
5513 var ge = me[ie];
5514 f = ge.x - F, h = ge.x + F, v = ge.y - F, d = ge.y + F, rr(s, f, v, h, d);
5515 }
5516 }
5517 } else {
5518 var Ee = e.source(), Ce = Ee.position(), we = e.target(), De = we.position();
5519 if (f = Ce.x, h = De.x, v = Ce.y, d = De.y, f > h) {
5520 var se = f;
5521 f = h, h = se;
5522 }
5523 if (v > d) {
5524 var xe = v;
5525 v = d, d = xe;
5526 }
5527 f -= F, h += F, v -= F, d += F, rr(s, f, v, h, d);
5528 }
5529 if (n && r.includeEdges && l && (On(s, e, "mid-source"), On(s, e, "mid-target"), On(s, e, "source"), On(s, e, "target")), n) {
5530 var Le = e.pstyle("ghost").value === "yes";
5531 if (Le) {
5532 var Se = e.pstyle("ghost-offset-x").pfValue, Oe = e.pstyle("ghost-offset-y").pfValue;
5533 rr(s, s.x1 + Se, s.y1 + Oe, s.x2 + Se, s.y2 + Oe);
5534 }
5535 }
5536 var Fe = o.bodyBounds = o.bodyBounds || {};
5537 xs(Fe, s), gn(Fe, g), dn(Fe, 1), n && (f = s.x1, h = s.x2, v = s.y1, d = s.y2, rr(s, f - k, v - k, h + k, d + k));
5538 var Xe = o.overlayBounds = o.overlayBounds || {};
5539 xs(Xe, s), gn(Xe, g), dn(Xe, 1);
5540 var Ie = o.labelBounds = o.labelBounds || {};
5541 Ie.all != null ? xf(Ie.all) : Ie.all = Yt(), n && r.includeLabels && (r.includeMainLabels && Ai(s, e, null), l && (r.includeSourceLabels && Ai(s, e, "source"), r.includeTargetLabels && Ai(s, e, "target")));
5542 }
5543 return s.x1 = Qt(s.x1), s.y1 = Qt(s.y1), s.x2 = Qt(s.x2), s.y2 = Qt(s.y2), s.w = Qt(s.x2 - s.x1), s.h = Qt(s.y2 - s.y1), s.w > 0 && s.h > 0 && b && (gn(s, g), dn(s, 1)), s;
5544 }, yo = function(e) {
5545 var r = 0, a = function(s) {
5546 return (s ? 1 : 0) << r++;
5547 }, n = 0;
5548 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 += a(e.includeOutlines), n;
5549 }, mo = function(e) {
5550 if (e.isEdge()) {
5551 var r = e.source().position(), a = e.target().position(), n = function(s) {
5552 return Math.round(s);
5553 };
5554 return $u([n(r.x), n(r.y), n(a.x), n(a.y)]);
5555 } else
5556 return 0;
5557 }, bo = function(e, r) {
5558 var a = e._private, n, i = e.isEdge(), s = r == null ? Eo : yo(r), o = s === Eo, u = mo(e), l = a.bbCachePosKey === u, f = r.useCache && l, h = function(y) {
5559 return y._private.bbCache == null || y._private.styleDirty;
5560 }, v = !f || h(e) || i && h(e.source()) || h(e.target());
5561 if (v ? (l || e.recalculateRenderedStyle(f), n = ad(e, $a), a.bbCache = n, a.bbCachePosKey = u) : n = a.bbCache, !o) {
5562 var d = e.isNode();
5563 n = Yt(), (r.includeNodes && d || r.includeEdges && !d) && (r.includeOverlays ? Vr(n, a.overlayBounds) : Vr(n, a.bodyBounds)), r.includeLabels && (r.includeMainLabels && (!i || r.includeSourceLabels && r.includeTargetLabels) ? Vr(n, a.labelBounds.all) : (r.includeMainLabels && Vr(n, a.labelBounds.mainRot), r.includeSourceLabels && Vr(n, a.labelBounds.sourceRot), r.includeTargetLabels && Vr(n, a.labelBounds.targetRot))), n.w = n.x2 - n.x1, n.h = n.y2 - n.y1;
5564 }
5565 return n;
5566 }, $a = {
5567 includeNodes: !0,
5568 includeEdges: !0,
5569 includeLabels: !0,
5570 includeMainLabels: !0,
5571 includeSourceLabels: !0,
5572 includeTargetLabels: !0,
5573 includeOverlays: !0,
5574 includeUnderlays: !0,
5575 includeOutlines: !0,
5576 useCache: !0
5577 }, Eo = yo($a), wo = At($a);
5578 Or.boundingBox = function(t) {
5579 var e;
5580 if (this.length === 1 && this[0]._private.bbCache != null && !this[0]._private.styleDirty && (t === void 0 || t.useCache === void 0 || t.useCache === !0))
5581 t === void 0 ? t = $a : t = wo(t), e = bo(this[0], t);
5582 else {
5583 e = Yt(), t = t || $a;
5584 var r = wo(t), a = this, n = a.cy(), i = n.styleEnabled();
5585 if (i)
5586 for (var s = 0; s < a.length; s++) {
5587 var o = a[s], u = o._private, l = mo(o), f = u.bbCachePosKey === l, h = r.useCache && f && !u.styleDirty;
5588 o.recalculateRenderedStyle(h);
5589 }
5590 this.updateCompoundBounds(!t.useCache);
5591 for (var v = 0; v < a.length; v++) {
5592 var d = a[v];
5593 Vr(e, bo(d, r));
5594 }
5595 }
5596 return e.x1 = Qt(e.x1), e.y1 = Qt(e.y1), e.x2 = Qt(e.x2), e.y2 = Qt(e.y2), e.w = Qt(e.x2 - e.x1), e.h = Qt(e.y2 - e.y1), e;
5597 }, Or.dirtyBoundingBoxCache = function() {
5598 for (var t = 0; t < this.length; t++) {
5599 var e = this[t]._private;
5600 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;
5601 }
5602 return this.emitAndNotify("bounds"), this;
5603 }, Or.boundingBoxAt = function(t) {
5604 var e = this.nodes(), r = this.cy(), a = r.hasCompoundNodes(), n = r.collection();
5605 if (a && (n = e.filter(function(l) {
5606 return l.isParent();
5607 }), e = e.not(n)), S(t)) {
5608 var i = t;
5609 t = function() {
5610 return i;
5611 };
5612 }
5613 var s = function(f, h) {
5614 return f._private.bbAtOldPos = t(f, h);
5615 }, o = function(f) {
5616 return f._private.bbAtOldPos;
5617 };
5618 r.startBatch(), e.forEach(s).silentPositions(t), a && (n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), n.updateCompoundBounds(!0));
5619 var u = wf(this.boundingBox({
5620 useCache: !1
5621 }));
5622 return e.silentPositions(o), a && (n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), n.updateCompoundBounds(!0)), r.endBatch(), u;
5623 }, va.boundingbox = va.bb = va.boundingBox, va.renderedBoundingbox = va.renderedBoundingBox;
5624 var nd = Or, _a, Ya;
5625 _a = Ya = {};
5626 var xo = function(e) {
5627 e.uppercaseName = Pt(e.name), e.autoName = "auto" + e.uppercaseName, e.labelName = "label" + e.uppercaseName, e.outerName = "outer" + e.uppercaseName, e.uppercaseOuterName = Pt(e.outerName), _a[e.name] = function() {
5628 var a = this[0], n = a._private, i = n.cy, s = i._private.styleEnabled;
5629 if (a)
5630 if (s) {
5631 if (a.isParent())
5632 return a.updateCompoundBounds(), n[e.autoName] || 0;
5633 var o = a.pstyle(e.name);
5634 switch (o.strValue) {
5635 case "label":
5636 return a.recalculateRenderedStyle(), n.rstyle[e.labelName] || 0;
5637 default:
5638 return o.pfValue;
5639 }
5640 } else
5641 return 1;
5642 }, _a["outer" + e.uppercaseName] = function() {
5643 var a = this[0], n = a._private, i = n.cy, s = i._private.styleEnabled;
5644 if (a)
5645 if (s) {
5646 var o = a[e.name](), u = a.pstyle("border-width").pfValue, l = 2 * a.padding();
5647 return o + u + l;
5648 } else
5649 return 1;
5650 }, _a["rendered" + e.uppercaseName] = function() {
5651 var a = this[0];
5652 if (a) {
5653 var n = a[e.name]();
5654 return n * this.cy().zoom();
5655 }
5656 }, _a["rendered" + e.uppercaseOuterName] = function() {
5657 var a = this[0];
5658 if (a) {
5659 var n = a[e.outerName]();
5660 return n * this.cy().zoom();
5661 }
5662 };
5663 };
5664 xo({
5665 name: "width"
5666 }), xo({
5667 name: "height"
5668 }), Ya.padding = function() {
5669 var t = this[0], e = t._private;
5670 return t.isParent() ? (t.updateCompoundBounds(), e.autoPadding !== void 0 ? e.autoPadding : t.pstyle("padding").pfValue) : t.pstyle("padding").pfValue;
5671 }, Ya.paddedHeight = function() {
5672 var t = this[0];
5673 return t.height() + 2 * t.padding();
5674 }, Ya.paddedWidth = function() {
5675 var t = this[0];
5676 return t.width() + 2 * t.padding();
5677 };
5678 var id = Ya, sd = function(e, r) {
5679 if (e.isEdge())
5680 return r(e);
5681 }, od = function(e, r) {
5682 if (e.isEdge()) {
5683 var a = e.cy();
5684 return vn(r(e), a.zoom(), a.pan());
5685 }
5686 }, ld = function(e, r) {
5687 if (e.isEdge()) {
5688 var a = e.cy(), n = a.pan(), i = a.zoom();
5689 return r(e).map(function(s) {
5690 return vn(s, i, n);
5691 });
5692 }
5693 }, ud = function(e) {
5694 return e.renderer().getControlPoints(e);
5695 }, fd = function(e) {
5696 return e.renderer().getSegmentPoints(e);
5697 }, hd = function(e) {
5698 return e.renderer().getSourceEndpoint(e);
5699 }, vd = function(e) {
5700 return e.renderer().getTargetEndpoint(e);
5701 }, cd = function(e) {
5702 return e.renderer().getEdgeMidpoint(e);
5703 }, To = {
5704 controlPoints: {
5705 get: ud,
5706 mult: !0
5707 },
5708 segmentPoints: {
5709 get: fd,
5710 mult: !0
5711 },
5712 sourceEndpoint: {
5713 get: hd
5714 },
5715 targetEndpoint: {
5716 get: vd
5717 },
5718 midpoint: {
5719 get: cd
5720 }
5721 }, dd = function(e) {
5722 return "rendered" + e[0].toUpperCase() + e.substr(1);
5723 }, gd = Object.keys(To).reduce(function(t, e) {
5724 var r = To[e], a = dd(e);
5725 return t[e] = function() {
5726 return sd(this, r.get);
5727 }, r.mult ? t[a] = function() {
5728 return ld(this, r.get);
5729 } : t[a] = function() {
5730 return od(this, r.get);
5731 }, t;
5732 }, {}), pd = He({}, td, nd, id, gd);
5733 /*!
5734 Event object based on jQuery events, MIT license
5735
5736 https://jquery.org/license/
5737 https://tldrlegal.com/license/mit-license
5738 https://github.com/jquery/jquery/blob/master/src/event.js
5739 */
5740 var Co = function(e, r) {
5741 this.recycle(e, r);
5742 };
5743 function Ha() {
5744 return !1;
5745 }
5746 function Nn() {
5747 return !0;
5748 }
5749 Co.prototype = {
5750 instanceString: function() {
5751 return "event";
5752 },
5753 recycle: function(e, r) {
5754 if (this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = Ha, e != null && e.preventDefault ? (this.type = e.type, this.isDefaultPrevented = e.defaultPrevented ? Nn : 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) {
5755 var a = this.position, n = this.cy.zoom(), i = this.cy.pan();
5756 this.renderedPosition = {
5757 x: a.x * n + i.x,
5758 y: a.y * n + i.y
5759 };
5760 }
5761 this.timeStamp = e && e.timeStamp || Date.now();
5762 },
5763 preventDefault: function() {
5764 this.isDefaultPrevented = Nn;
5765 var e = this.originalEvent;
5766 e && e.preventDefault && e.preventDefault();
5767 },
5768 stopPropagation: function() {
5769 this.isPropagationStopped = Nn;
5770 var e = this.originalEvent;
5771 e && e.stopPropagation && e.stopPropagation();
5772 },
5773 stopImmediatePropagation: function() {
5774 this.isImmediatePropagationStopped = Nn, this.stopPropagation();
5775 },
5776 isDefaultPrevented: Ha,
5777 isPropagationStopped: Ha,
5778 isImmediatePropagationStopped: Ha
5779 };
5780 var Do = /^([^.]+)(\.(?:[^.]+))?$/, yd = ".*", So = {
5781 qualifierCompare: function(e, r) {
5782 return e === r;
5783 },
5784 eventMatches: function() {
5785 return !0;
5786 },
5787 addEventFields: function() {
5788 },
5789 callbackContext: function(e) {
5790 return e;
5791 },
5792 beforeEmit: function() {
5793 },
5794 afterEmit: function() {
5795 },
5796 bubble: function() {
5797 return !1;
5798 },
5799 parent: function() {
5800 return null;
5801 },
5802 context: null
5803 }, Lo = Object.keys(So), md = {};
5804 function In() {
5805 for (var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : md, e = arguments.length > 1 ? arguments[1] : void 0, r = 0; r < Lo.length; r++) {
5806 var a = Lo[r];
5807 this[a] = t[a] || So[a];
5808 }
5809 this.context = e || this.context, this.listeners = [], this.emitting = 0;
5810 }
5811 var Nr = In.prototype, Ao = function(e, r, a, n, i, s, o) {
5812 H(n) && (i = n, n = null), o && (s == null ? s = o : s = He({}, s, o));
5813 for (var u = te(a) ? a : a.split(/\s+/), l = 0; l < u.length; l++) {
5814 var f = u[l];
5815 if (!Re(f)) {
5816 var h = f.match(Do);
5817 if (h) {
5818 var v = h[1], d = h[2] ? h[2] : null, c = r(e, f, v, d, n, i, s);
5819 if (c === !1)
5820 break;
5821 }
5822 }
5823 }
5824 }, Oo = function(e, r) {
5825 return e.addEventFields(e.context, r), new Co(r.type, r);
5826 }, bd = function(e, r, a) {
5827 if (dt(a)) {
5828 r(e, a);
5829 return;
5830 } else if (S(a)) {
5831 r(e, Oo(e, a));
5832 return;
5833 }
5834 for (var n = te(a) ? a : a.split(/\s+/), i = 0; i < n.length; i++) {
5835 var s = n[i];
5836 if (!Re(s)) {
5837 var o = s.match(Do);
5838 if (o) {
5839 var u = o[1], l = o[2] ? o[2] : null, f = Oo(e, {
5840 type: u,
5841 namespace: l,
5842 target: e.context
5843 });
5844 r(e, f);
5845 }
5846 }
5847 }
5848 };
5849 Nr.on = Nr.addListener = function(t, e, r, a, n) {
5850 return Ao(this, function(i, s, o, u, l, f, h) {
5851 H(f) && i.listeners.push({
5852 event: s,
5853 // full event string
5854 callback: f,
5855 // callback to run
5856 type: o,
5857 // the event type (e.g. 'click')
5858 namespace: u,
5859 // the event namespace (e.g. ".foo")
5860 qualifier: l,
5861 // a restriction on whether to match this emitter
5862 conf: h
5863 // additional configuration
5864 });
5865 }, t, e, r, a, n), this;
5866 }, Nr.one = function(t, e, r, a) {
5867 return this.on(t, e, r, a, {
5868 one: !0
5869 });
5870 }, Nr.removeListener = Nr.off = function(t, e, r, a) {
5871 var n = this;
5872 this.emitting !== 0 && (this.listeners = Wu(this.listeners));
5873 for (var i = this.listeners, s = function(l) {
5874 var f = i[l];
5875 Ao(n, function(h, v, d, c, y, p) {
5876 if ((f.type === d || t === "*") && (!c && f.namespace !== ".*" || f.namespace === c) && (!y || h.qualifierCompare(f.qualifier, y)) && (!p || f.callback === p))
5877 return i.splice(l, 1), !1;
5878 }, t, e, r, a);
5879 }, o = i.length - 1; o >= 0; o--)
5880 s(o);
5881 return this;
5882 }, Nr.removeAllListeners = function() {
5883 return this.removeListener("*");
5884 }, Nr.emit = Nr.trigger = function(t, e, r) {
5885 var a = this.listeners, n = a.length;
5886 return this.emitting++, te(e) || (e = [e]), bd(this, function(i, s) {
5887 r != null && (a = [{
5888 event: s.event,
5889 type: s.type,
5890 namespace: s.namespace,
5891 callback: r
5892 }], n = a.length);
5893 for (var o = function(f) {
5894 var h = a[f];
5895 if (h.type === s.type && (!h.namespace || h.namespace === s.namespace || h.namespace === yd) && i.eventMatches(i.context, h, s)) {
5896 var v = [s];
5897 e != null && Ku(v, e), i.beforeEmit(i.context, h, s), h.conf && h.conf.one && (i.listeners = i.listeners.filter(function(y) {
5898 return y !== h;
5899 }));
5900 var d = i.callbackContext(i.context, h, s), c = h.callback.apply(d, v);
5901 i.afterEmit(i.context, h, s), c === !1 && (s.stopPropagation(), s.preventDefault());
5902 }
5903 }, u = 0; u < n; u++)
5904 o(u);
5905 i.bubble(i.context) && !s.isPropagationStopped() && i.parent(i.context).emit(s, e);
5906 }, t), this.emitting--, this;
5907 };
5908 var Ed = {
5909 qualifierCompare: function(e, r) {
5910 return e == null || r == null ? e == null && r == null : e.sameText(r);
5911 },
5912 eventMatches: function(e, r, a) {
5913 var n = r.qualifier;
5914 return n != null ? e !== a.target && Ae(a.target) && n.matches(a.target) : !0;
5915 },
5916 addEventFields: function(e, r) {
5917 r.cy = e.cy(), r.target = e;
5918 },
5919 callbackContext: function(e, r, a) {
5920 return r.qualifier != null ? a.target : e;
5921 },
5922 beforeEmit: function(e, r) {
5923 r.conf && r.conf.once && r.conf.onceCollection.removeListener(r.event, r.qualifier, r.callback);
5924 },
5925 bubble: function() {
5926 return !0;
5927 },
5928 parent: function(e) {
5929 return e.isChild() ? e.parent() : e.cy();
5930 }
5931 }, Mn = function(e) {
5932 return ee(e) ? new Sr(e) : e;
5933 }, No = {
5934 createEmitter: function() {
5935 for (var e = 0; e < this.length; e++) {
5936 var r = this[e], a = r._private;
5937 a.emitter || (a.emitter = new In(Ed, r));
5938 }
5939 return this;
5940 },
5941 emitter: function() {
5942 return this._private.emitter;
5943 },
5944 on: function(e, r, a) {
5945 for (var n = Mn(r), i = 0; i < this.length; i++) {
5946 var s = this[i];
5947 s.emitter().on(e, n, a);
5948 }
5949 return this;
5950 },
5951 removeListener: function(e, r, a) {
5952 for (var n = Mn(r), i = 0; i < this.length; i++) {
5953 var s = this[i];
5954 s.emitter().removeListener(e, n, a);
5955 }
5956 return this;
5957 },
5958 removeAllListeners: function() {
5959 for (var e = 0; e < this.length; e++) {
5960 var r = this[e];
5961 r.emitter().removeAllListeners();
5962 }
5963 return this;
5964 },
5965 one: function(e, r, a) {
5966 for (var n = Mn(r), i = 0; i < this.length; i++) {
5967 var s = this[i];
5968 s.emitter().one(e, n, a);
5969 }
5970 return this;
5971 },
5972 once: function(e, r, a) {
5973 for (var n = Mn(r), i = 0; i < this.length; i++) {
5974 var s = this[i];
5975 s.emitter().on(e, n, a, {
5976 once: !0,
5977 onceCollection: this
5978 });
5979 }
5980 },
5981 emit: function(e, r) {
5982 for (var a = 0; a < this.length; a++) {
5983 var n = this[a];
5984 n.emitter().emit(e, r);
5985 }
5986 return this;
5987 },
5988 emitAndNotify: function(e, r) {
5989 if (this.length !== 0)
5990 return this.cy().notify(e, this), this.emit(e, r), this;
5991 }
5992 };
5993 ct.eventAliasesOn(No);
5994 var Io = {
5995 nodes: function(e) {
5996 return this.filter(function(r) {
5997 return r.isNode();
5998 }).filter(e);
5999 },
6000 edges: function(e) {
6001 return this.filter(function(r) {
6002 return r.isEdge();
6003 }).filter(e);
6004 },
6005 // internal helper to get nodes and edges as separate collections with single iteration over elements
6006 byGroup: function() {
6007 for (var e = this.spawn(), r = this.spawn(), a = 0; a < this.length; a++) {
6008 var n = this[a];
6009 n.isNode() ? e.push(n) : r.push(n);
6010 }
6011 return {
6012 nodes: e,
6013 edges: r
6014 };
6015 },
6016 filter: function(e, r) {
6017 if (e === void 0)
6018 return this;
6019 if (ee(e) || pe(e))
6020 return new Sr(e).filter(this);
6021 if (H(e)) {
6022 for (var a = this.spawn(), n = this, i = 0; i < n.length; i++) {
6023 var s = n[i], o = r ? e.apply(r, [s, i, n]) : e(s, i, n);
6024 o && a.push(s);
6025 }
6026 return a;
6027 }
6028 return this.spawn();
6029 },
6030 not: function(e) {
6031 if (e) {
6032 ee(e) && (e = this.filter(e));
6033 for (var r = this.spawn(), a = 0; a < this.length; a++) {
6034 var n = this[a], i = e.has(n);
6035 i || r.push(n);
6036 }
6037 return r;
6038 } else
6039 return this;
6040 },
6041 absoluteComplement: function() {
6042 var e = this.cy();
6043 return e.mutableElements().not(this);
6044 },
6045 intersect: function(e) {
6046 if (ee(e)) {
6047 var r = e;
6048 return this.filter(r);
6049 }
6050 for (var a = this.spawn(), n = this, i = e, s = this.length < e.length, o = s ? n : i, u = s ? i : n, l = 0; l < o.length; l++) {
6051 var f = o[l];
6052 u.has(f) && a.push(f);
6053 }
6054 return a;
6055 },
6056 xor: function(e) {
6057 var r = this._private.cy;
6058 ee(e) && (e = r.$(e));
6059 var a = this.spawn(), n = this, i = e, s = function(u, l) {
6060 for (var f = 0; f < u.length; f++) {
6061 var h = u[f], v = h._private.data.id, d = l.hasElementWithId(v);
6062 d || a.push(h);
6063 }
6064 };
6065 return s(n, i), s(i, n), a;
6066 },
6067 diff: function(e) {
6068 var r = this._private.cy;
6069 ee(e) && (e = r.$(e));
6070 var a = this.spawn(), n = this.spawn(), i = this.spawn(), s = this, o = e, u = function(f, h, v) {
6071 for (var d = 0; d < f.length; d++) {
6072 var c = f[d], y = c._private.data.id, p = h.hasElementWithId(y);
6073 p ? i.merge(c) : v.push(c);
6074 }
6075 };
6076 return u(s, o, a), u(o, s, n), {
6077 left: a,
6078 right: n,
6079 both: i
6080 };
6081 },
6082 add: function(e) {
6083 var r = this._private.cy;
6084 if (!e)
6085 return this;
6086 if (ee(e)) {
6087 var a = e;
6088 e = r.mutableElements().filter(a);
6089 }
6090 for (var n = this.spawnSelf(), i = 0; i < e.length; i++) {
6091 var s = e[i], o = !this.has(s);
6092 o && n.push(s);
6093 }
6094 return n;
6095 },
6096 // in place merge on calling collection
6097 merge: function(e) {
6098 var r = this._private, a = r.cy;
6099 if (!e)
6100 return this;
6101 if (e && ee(e)) {
6102 var n = e;
6103 e = a.mutableElements().filter(n);
6104 }
6105 for (var i = r.map, s = 0; s < e.length; s++) {
6106 var o = e[s], u = o._private.data.id, l = !i.has(u);
6107 if (l) {
6108 var f = this.length++;
6109 this[f] = o, i.set(u, {
6110 ele: o,
6111 index: f
6112 });
6113 }
6114 }
6115 return this;
6116 },
6117 unmergeAt: function(e) {
6118 var r = this[e], a = r.id(), n = this._private, i = n.map;
6119 this[e] = void 0, i.delete(a);
6120 var s = e === this.length - 1;
6121 if (this.length > 1 && !s) {
6122 var o = this.length - 1, u = this[o], l = u._private.data.id;
6123 this[o] = void 0, this[e] = u, i.set(l, {
6124 ele: u,
6125 index: e
6126 });
6127 }
6128 return this.length--, this;
6129 },
6130 // remove single ele in place in calling collection
6131 unmergeOne: function(e) {
6132 e = e[0];
6133 var r = this._private, a = e._private.data.id, n = r.map, i = n.get(a);
6134 if (!i)
6135 return this;
6136 var s = i.index;
6137 return this.unmergeAt(s), this;
6138 },
6139 // remove eles in place on calling collection
6140 unmerge: function(e) {
6141 var r = this._private.cy;
6142 if (!e)
6143 return this;
6144 if (e && ee(e)) {
6145 var a = e;
6146 e = r.mutableElements().filter(a);
6147 }
6148 for (var n = 0; n < e.length; n++)
6149 this.unmergeOne(e[n]);
6150 return this;
6151 },
6152 unmergeBy: function(e) {
6153 for (var r = this.length - 1; r >= 0; r--) {
6154 var a = this[r];
6155 e(a) && this.unmergeAt(r);
6156 }
6157 return this;
6158 },
6159 map: function(e, r) {
6160 for (var a = [], n = this, i = 0; i < n.length; i++) {
6161 var s = n[i], o = r ? e.apply(r, [s, i, n]) : e(s, i, n);
6162 a.push(o);
6163 }
6164 return a;
6165 },
6166 reduce: function(e, r) {
6167 for (var a = r, n = this, i = 0; i < n.length; i++)
6168 a = e(a, n[i], i, n);
6169 return a;
6170 },
6171 max: function(e, r) {
6172 for (var a = -1 / 0, n, i = this, s = 0; s < i.length; s++) {
6173 var o = i[s], u = r ? e.apply(r, [o, s, i]) : e(o, s, i);
6174 u > a && (a = u, n = o);
6175 }
6176 return {
6177 value: a,
6178 ele: n
6179 };
6180 },
6181 min: function(e, r) {
6182 for (var a = 1 / 0, n, i = this, s = 0; s < i.length; s++) {
6183 var o = i[s], u = r ? e.apply(r, [o, s, i]) : e(o, s, i);
6184 u < a && (a = u, n = o);
6185 }
6186 return {
6187 value: a,
6188 ele: n
6189 };
6190 }
6191 }, lt = Io;
6192 lt.u = lt["|"] = lt["+"] = lt.union = lt.or = lt.add, lt["\\"] = lt["!"] = lt["-"] = lt.difference = lt.relativeComplement = lt.subtract = lt.not, lt.n = lt["&"] = lt["."] = lt.and = lt.intersection = lt.intersect, lt["^"] = lt["(+)"] = lt["(-)"] = lt.symmetricDifference = lt.symdiff = lt.xor, lt.fnFilter = lt.filterFn = lt.stdFilter = lt.filter, lt.complement = lt.abscomp = lt.absoluteComplement;
6193 var wd = {
6194 isNode: function() {
6195 return this.group() === "nodes";
6196 },
6197 isEdge: function() {
6198 return this.group() === "edges";
6199 },
6200 isLoop: function() {
6201 return this.isEdge() && this.source()[0] === this.target()[0];
6202 },
6203 isSimple: function() {
6204 return this.isEdge() && this.source()[0] !== this.target()[0];
6205 },
6206 group: function() {
6207 var e = this[0];
6208 if (e)
6209 return e._private.group;
6210 }
6211 }, Mo = function(e, r) {
6212 var a = e.cy(), n = a.hasCompoundNodes();
6213 function i(f) {
6214 var h = f.pstyle("z-compound-depth");
6215 return h.value === "auto" ? n ? f.zDepth() : 0 : h.value === "bottom" ? -1 : h.value === "top" ? ii : 0;
6216 }
6217 var s = i(e) - i(r);
6218 if (s !== 0)
6219 return s;
6220 function o(f) {
6221 var h = f.pstyle("z-index-compare");
6222 return h.value === "auto" && f.isNode() ? 1 : 0;
6223 }
6224 var u = o(e) - o(r);
6225 if (u !== 0)
6226 return u;
6227 var l = e.pstyle("z-index").value - r.pstyle("z-index").value;
6228 return l !== 0 ? l : e.poolIndex() - r.poolIndex();
6229 }, Rn = {
6230 forEach: function(e, r) {
6231 if (H(e))
6232 for (var a = this.length, n = 0; n < a; n++) {
6233 var i = this[n], s = r ? e.apply(r, [i, n, this]) : e(i, n, this);
6234 if (s === !1)
6235 break;
6236 }
6237 return this;
6238 },
6239 toArray: function() {
6240 for (var e = [], r = 0; r < this.length; r++)
6241 e.push(this[r]);
6242 return e;
6243 },
6244 slice: function(e, r) {
6245 var a = [], n = this.length;
6246 r == null && (r = n), e == null && (e = 0), e < 0 && (e = n + e), r < 0 && (r = n + r);
6247 for (var i = e; i >= 0 && i < r && i < n; i++)
6248 a.push(this[i]);
6249 return this.spawn(a);
6250 },
6251 size: function() {
6252 return this.length;
6253 },
6254 eq: function(e) {
6255 return this[e] || this.spawn();
6256 },
6257 first: function() {
6258 return this[0] || this.spawn();
6259 },
6260 last: function() {
6261 return this[this.length - 1] || this.spawn();
6262 },
6263 empty: function() {
6264 return this.length === 0;
6265 },
6266 nonempty: function() {
6267 return !this.empty();
6268 },
6269 sort: function(e) {
6270 if (!H(e))
6271 return this;
6272 var r = this.toArray().sort(e);
6273 return this.spawn(r);
6274 },
6275 sortByZIndex: function() {
6276 return this.sort(Mo);
6277 },
6278 zDepth: function() {
6279 var e = this[0];
6280 if (e) {
6281 var r = e._private, a = r.group;
6282 if (a === "nodes") {
6283 var n = r.data.parent ? e.parents().size() : 0;
6284 return e.isParent() ? n : ii - 1;
6285 } else {
6286 var i = r.source, s = r.target, o = i.zDepth(), u = s.zDepth();
6287 return Math.max(o, u, 0);
6288 }
6289 }
6290 }
6291 };
6292 Rn.each = Rn.forEach;
6293 var xd = function() {
6294 var e = "undefined", r = (typeof Symbol > "u" ? "undefined" : _(Symbol)) != e && _(Symbol.iterator) != e;
6295 r && (Rn[Symbol.iterator] = function() {
6296 var a = this, n = {
6297 value: void 0,
6298 done: !1
6299 }, i = 0, s = this.length;
6300 return T({
6301 next: function() {
6302 return i < s ? n.value = a[i++] : (n.value = void 0, n.done = !0), n;
6303 }
6304 }, Symbol.iterator, function() {
6305 return this;
6306 });
6307 });
6308 };
6309 xd();
6310 var Td = At({
6311 nodeDimensionsIncludeLabels: !1
6312 }), kn = {
6313 // Calculates and returns node dimensions { x, y } based on options given
6314 layoutDimensions: function(e) {
6315 e = Td(e);
6316 var r;
6317 if (!this.takesUpSpace())
6318 r = {
6319 w: 0,
6320 h: 0
6321 };
6322 else if (e.nodeDimensionsIncludeLabels) {
6323 var a = this.boundingBox();
6324 r = {
6325 w: a.w,
6326 h: a.h
6327 };
6328 } else
6329 r = {
6330 w: this.outerWidth(),
6331 h: this.outerHeight()
6332 };
6333 return (r.w === 0 || r.h === 0) && (r.w = r.h = 1), r;
6334 },
6335 // using standard layout options, apply position function (w/ or w/o animation)
6336 layoutPositions: function(e, r, a) {
6337 var n = this.nodes().filter(function(M) {
6338 return !M.isParent();
6339 }), i = this.cy(), s = r.eles, o = function(L) {
6340 return L.id();
6341 }, u = it(a, o);
6342 e.emit({
6343 type: "layoutstart",
6344 layout: e
6345 }), e.animations = [];
6346 var l = function(L, w, k) {
6347 var D = {
6348 x: w.x1 + w.w / 2,
6349 y: w.y1 + w.h / 2
6350 }, F = {
6351 // scale from center of bounding box (not necessarily 0,0)
6352 x: (k.x - D.x) * L,
6353 y: (k.y - D.y) * L
6354 };
6355 return {
6356 x: D.x + F.x,
6357 y: D.y + F.y
6358 };
6359 }, f = r.spacingFactor && r.spacingFactor !== 1, h = function() {
6360 if (!f)
6361 return null;
6362 for (var L = Yt(), w = 0; w < n.length; w++) {
6363 var k = n[w], D = u(k, w);
6364 Cf(L, D.x, D.y);
6365 }
6366 return L;
6367 }, v = h(), d = it(function(M, L) {
6368 var w = u(M, L);
6369 if (f) {
6370 var k = Math.abs(r.spacingFactor);
6371 w = l(k, v, w);
6372 }
6373 return r.transform != null && (w = r.transform(M, w)), w;
6374 }, o);
6375 if (r.animate) {
6376 for (var c = 0; c < n.length; c++) {
6377 var y = n[c], p = d(y, c), g = r.animateFilter == null || r.animateFilter(y, c);
6378 if (g) {
6379 var m = y.animation({
6380 position: p,
6381 duration: r.animationDuration,
6382 easing: r.animationEasing
6383 });
6384 e.animations.push(m);
6385 } else
6386 y.position(p);
6387 }
6388 if (r.fit) {
6389 var b = i.animation({
6390 fit: {
6391 boundingBox: s.boundingBoxAt(d),
6392 padding: r.padding
6393 },
6394 duration: r.animationDuration,
6395 easing: r.animationEasing
6396 });
6397 e.animations.push(b);
6398 } else if (r.zoom !== void 0 && r.pan !== void 0) {
6399 var E = i.animation({
6400 zoom: r.zoom,
6401 pan: r.pan,
6402 duration: r.animationDuration,
6403 easing: r.animationEasing
6404 });
6405 e.animations.push(E);
6406 }
6407 e.animations.forEach(function(M) {
6408 return M.play();
6409 }), e.one("layoutready", r.ready), e.emit({
6410 type: "layoutready",
6411 layout: e
6412 }), ia.all(e.animations.map(function(M) {
6413 return M.promise();
6414 })).then(function() {
6415 e.one("layoutstop", r.stop), e.emit({
6416 type: "layoutstop",
6417 layout: e
6418 });
6419 });
6420 } else
6421 n.positions(d), 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({
6422 type: "layoutready",
6423 layout: e
6424 }), e.one("layoutstop", r.stop), e.emit({
6425 type: "layoutstop",
6426 layout: e
6427 });
6428 return this;
6429 },
6430 layout: function(e) {
6431 var r = this.cy();
6432 return r.makeLayout(He({}, e, {
6433 eles: this
6434 }));
6435 }
6436 };
6437 kn.createLayout = kn.makeLayout = kn.layout;
6438 function Ro(t, e, r) {
6439 var a = r._private, n = a.styleCache = a.styleCache || [], i;
6440 return (i = n[t]) != null || (i = n[t] = e(r)), i;
6441 }
6442 function Pn(t, e) {
6443 return t = Pr(t), function(a) {
6444 return Ro(t, e, a);
6445 };
6446 }
6447 function Bn(t, e) {
6448 t = Pr(t);
6449 var r = function(n) {
6450 return e.call(n);
6451 };
6452 return function() {
6453 var n = this[0];
6454 if (n)
6455 return Ro(t, r, n);
6456 };
6457 }
6458 var Ot = {
6459 recalculateRenderedStyle: function(e) {
6460 var r = this.cy(), a = r.renderer(), n = r.styleEnabled();
6461 return a && n && a.recalculateRenderedStyle(this, e), this;
6462 },
6463 dirtyStyleCache: function() {
6464 var e = this.cy(), r = function(i) {
6465 return i._private.styleCache = null;
6466 };
6467 if (e.hasCompoundNodes()) {
6468 var a;
6469 a = this.spawnSelf().merge(this.descendants()).merge(this.parents()), a.merge(a.connectedEdges()), a.forEach(r);
6470 } else
6471 this.forEach(function(n) {
6472 r(n), n.connectedEdges().forEach(r);
6473 });
6474 return this;
6475 },
6476 // fully updates (recalculates) the style for the elements
6477 updateStyle: function(e) {
6478 var r = this._private.cy;
6479 if (!r.styleEnabled())
6480 return this;
6481 if (r.batching()) {
6482 var a = r._private.batchStyleEles;
6483 return a.merge(this), this;
6484 }
6485 var n = r.hasCompoundNodes(), i = this;
6486 e = !!(e || e === void 0), n && (i = this.spawnSelf().merge(this.descendants()).merge(this.parents()));
6487 var s = i;
6488 return e ? s.emitAndNotify("style") : s.emit("style"), i.forEach(function(o) {
6489 return o._private.styleDirty = !0;
6490 }), this;
6491 },
6492 // private: clears dirty flag and recalculates style
6493 cleanStyle: function() {
6494 var e = this.cy();
6495 if (e.styleEnabled())
6496 for (var r = 0; r < this.length; r++) {
6497 var a = this[r];
6498 a._private.styleDirty && (a._private.styleDirty = !1, e.style().apply(a));
6499 }
6500 },
6501 // get the internal parsed style object for the specified property
6502 parsedStyle: function(e) {
6503 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, a = this[0], n = a.cy();
6504 if (n.styleEnabled() && a) {
6505 this.cleanStyle();
6506 var i = a._private.style[e];
6507 return i ?? (r ? n.style().getDefaultProperty(e) : null);
6508 }
6509 },
6510 numericStyle: function(e) {
6511 var r = this[0];
6512 if (r.cy().styleEnabled() && r) {
6513 var a = r.pstyle(e);
6514 return a.pfValue !== void 0 ? a.pfValue : a.value;
6515 }
6516 },
6517 numericStyleUnits: function(e) {
6518 var r = this[0];
6519 if (r.cy().styleEnabled() && r)
6520 return r.pstyle(e).units;
6521 },
6522 // get the specified css property as a rendered value (i.e. on-screen value)
6523 // or get the whole rendered style if no property specified (NB doesn't allow setting)
6524 renderedStyle: function(e) {
6525 var r = this.cy();
6526 if (!r.styleEnabled())
6527 return this;
6528 var a = this[0];
6529 if (a)
6530 return r.style().getRenderedStyle(a, e);
6531 },
6532 // read the calculated css style of the element or override the style (via a bypass)
6533 style: function(e, r) {
6534 var a = this.cy();
6535 if (!a.styleEnabled())
6536 return this;
6537 var n = !1, i = a.style();
6538 if (S(e)) {
6539 var s = e;
6540 i.applyBypass(this, s, n), this.emitAndNotify("style");
6541 } else if (ee(e))
6542 if (r === void 0) {
6543 var o = this[0];
6544 return o ? i.getStylePropertyValue(o, e) : void 0;
6545 } else
6546 i.applyBypass(this, e, r, n), this.emitAndNotify("style");
6547 else if (e === void 0) {
6548 var u = this[0];
6549 return u ? i.getRawStyle(u) : void 0;
6550 }
6551 return this;
6552 },
6553 removeStyle: function(e) {
6554 var r = this.cy();
6555 if (!r.styleEnabled())
6556 return this;
6557 var a = !1, n = r.style(), i = this;
6558 if (e === void 0)
6559 for (var s = 0; s < i.length; s++) {
6560 var o = i[s];
6561 n.removeAllBypasses(o, a);
6562 }
6563 else {
6564 e = e.split(/\s+/);
6565 for (var u = 0; u < i.length; u++) {
6566 var l = i[u];
6567 n.removeBypasses(l, e, a);
6568 }
6569 }
6570 return this.emitAndNotify("style"), this;
6571 },
6572 show: function() {
6573 return this.css("display", "element"), this;
6574 },
6575 hide: function() {
6576 return this.css("display", "none"), this;
6577 },
6578 effectiveOpacity: function() {
6579 var e = this.cy();
6580 if (!e.styleEnabled())
6581 return 1;
6582 var r = e.hasCompoundNodes(), a = this[0];
6583 if (a) {
6584 var n = a._private, i = a.pstyle("opacity").value;
6585 if (!r)
6586 return i;
6587 var s = n.data.parent ? a.parents() : null;
6588 if (s)
6589 for (var o = 0; o < s.length; o++) {
6590 var u = s[o], l = u.pstyle("opacity").value;
6591 i = l * i;
6592 }
6593 return i;
6594 }
6595 },
6596 transparent: function() {
6597 var e = this.cy();
6598 if (!e.styleEnabled())
6599 return !1;
6600 var r = this[0], a = r.cy().hasCompoundNodes();
6601 if (r)
6602 return a ? r.effectiveOpacity() === 0 : r.pstyle("opacity").value === 0;
6603 },
6604 backgrounding: function() {
6605 var e = this.cy();
6606 if (!e.styleEnabled())
6607 return !1;
6608 var r = this[0];
6609 return !!r._private.backgrounding;
6610 }
6611 };
6612 function Oi(t, e) {
6613 var r = t._private, a = r.data.parent ? t.parents() : null;
6614 if (a)
6615 for (var n = 0; n < a.length; n++) {
6616 var i = a[n];
6617 if (!e(i))
6618 return !1;
6619 }
6620 return !0;
6621 }
6622 function Ni(t) {
6623 var e = t.ok, r = t.edgeOkViaNode || t.ok, a = t.parentOk || t.ok;
6624 return function() {
6625 var n = this.cy();
6626 if (!n.styleEnabled())
6627 return !0;
6628 var i = this[0], s = n.hasCompoundNodes();
6629 if (i) {
6630 var o = i._private;
6631 if (!e(i))
6632 return !1;
6633 if (i.isNode())
6634 return !s || Oi(i, a);
6635 var u = o.source, l = o.target;
6636 return r(u) && (!s || Oi(u, r)) && (u === l || r(l) && (!s || Oi(l, r)));
6637 }
6638 };
6639 }
6640 var ca = Pn("eleTakesUpSpace", function(t) {
6641 return t.pstyle("display").value === "element" && t.width() !== 0 && (t.isNode() ? t.height() !== 0 : !0);
6642 });
6643 Ot.takesUpSpace = Bn("takesUpSpace", Ni({
6644 ok: ca
6645 }));
6646 var Cd = Pn("eleInteractive", function(t) {
6647 return t.pstyle("events").value === "yes" && t.pstyle("visibility").value === "visible" && ca(t);
6648 }), Dd = Pn("parentInteractive", function(t) {
6649 return t.pstyle("visibility").value === "visible" && ca(t);
6650 });
6651 Ot.interactive = Bn("interactive", Ni({
6652 ok: Cd,
6653 parentOk: Dd,
6654 edgeOkViaNode: ca
6655 })), Ot.noninteractive = function() {
6656 var t = this[0];
6657 if (t)
6658 return !t.interactive();
6659 };
6660 var Sd = Pn("eleVisible", function(t) {
6661 return t.pstyle("visibility").value === "visible" && t.pstyle("opacity").pfValue !== 0 && ca(t);
6662 }), Ld = ca;
6663 Ot.visible = Bn("visible", Ni({
6664 ok: Sd,
6665 edgeOkViaNode: Ld
6666 })), Ot.hidden = function() {
6667 var t = this[0];
6668 if (t)
6669 return !t.visible();
6670 }, Ot.isBundledBezier = Bn("isBundledBezier", function() {
6671 return this.cy().styleEnabled() ? !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace() : !1;
6672 }), Ot.bypass = Ot.css = Ot.style, Ot.renderedCss = Ot.renderedStyle, Ot.removeBypass = Ot.removeCss = Ot.removeStyle, Ot.pstyle = Ot.parsedStyle;
6673 var Ir = {};
6674 function ko(t) {
6675 return function() {
6676 var e = arguments, r = [];
6677 if (e.length === 2) {
6678 var a = e[0], n = e[1];
6679 this.on(t.event, a, n);
6680 } else if (e.length === 1 && H(e[0])) {
6681 var i = e[0];
6682 this.on(t.event, i);
6683 } else if (e.length === 0 || e.length === 1 && te(e[0])) {
6684 for (var s = e.length === 1 ? e[0] : null, o = 0; o < this.length; o++) {
6685 var u = this[o], l = !t.ableField || u._private[t.ableField], f = u._private[t.field] != t.value;
6686 if (t.overrideAble) {
6687 var h = t.overrideAble(u);
6688 if (h !== void 0 && (l = h, !h))
6689 return this;
6690 }
6691 l && (u._private[t.field] = t.value, f && r.push(u));
6692 }
6693 var v = this.spawn(r);
6694 v.updateStyle(), v.emit(t.event), s && v.emit(s);
6695 }
6696 return this;
6697 };
6698 }
6699 function da(t) {
6700 Ir[t.field] = function() {
6701 var e = this[0];
6702 if (e) {
6703 if (t.overrideField) {
6704 var r = t.overrideField(e);
6705 if (r !== void 0)
6706 return r;
6707 }
6708 return e._private[t.field];
6709 }
6710 }, Ir[t.on] = ko({
6711 event: t.on,
6712 field: t.field,
6713 ableField: t.ableField,
6714 overrideAble: t.overrideAble,
6715 value: !0
6716 }), Ir[t.off] = ko({
6717 event: t.off,
6718 field: t.field,
6719 ableField: t.ableField,
6720 overrideAble: t.overrideAble,
6721 value: !1
6722 });
6723 }
6724 da({
6725 field: "locked",
6726 overrideField: function(e) {
6727 return e.cy().autolock() ? !0 : void 0;
6728 },
6729 on: "lock",
6730 off: "unlock"
6731 }), da({
6732 field: "grabbable",
6733 overrideField: function(e) {
6734 return e.cy().autoungrabify() || e.pannable() ? !1 : void 0;
6735 },
6736 on: "grabify",
6737 off: "ungrabify"
6738 }), da({
6739 field: "selected",
6740 ableField: "selectable",
6741 overrideAble: function(e) {
6742 return e.cy().autounselectify() ? !1 : void 0;
6743 },
6744 on: "select",
6745 off: "unselect"
6746 }), da({
6747 field: "selectable",
6748 overrideField: function(e) {
6749 return e.cy().autounselectify() ? !1 : void 0;
6750 },
6751 on: "selectify",
6752 off: "unselectify"
6753 }), Ir.deselect = Ir.unselect, Ir.grabbed = function() {
6754 var t = this[0];
6755 if (t)
6756 return t._private.grabbed;
6757 }, da({
6758 field: "active",
6759 on: "activate",
6760 off: "unactivate"
6761 }), da({
6762 field: "pannable",
6763 on: "panify",
6764 off: "unpanify"
6765 }), Ir.inactive = function() {
6766 var t = this[0];
6767 if (t)
6768 return !t._private.active;
6769 };
6770 var Bt = {}, Po = function(e) {
6771 return function(a) {
6772 for (var n = this, i = [], s = 0; s < n.length; s++) {
6773 var o = n[s];
6774 if (o.isNode()) {
6775 for (var u = !1, l = o.connectedEdges(), f = 0; f < l.length; f++) {
6776 var h = l[f], v = h.source(), d = h.target();
6777 if (e.noIncomingEdges && d === o && v !== o || e.noOutgoingEdges && v === o && d !== o) {
6778 u = !0;
6779 break;
6780 }
6781 }
6782 u || i.push(o);
6783 }
6784 }
6785 return this.spawn(i, !0).filter(a);
6786 };
6787 }, Bo = function(e) {
6788 return function(r) {
6789 for (var a = this, n = [], i = 0; i < a.length; i++) {
6790 var s = a[i];
6791 if (s.isNode())
6792 for (var o = s.connectedEdges(), u = 0; u < o.length; u++) {
6793 var l = o[u], f = l.source(), h = l.target();
6794 e.outgoing && f === s ? (n.push(l), n.push(h)) : e.incoming && h === s && (n.push(l), n.push(f));
6795 }
6796 }
6797 return this.spawn(n, !0).filter(r);
6798 };
6799 }, Fo = function(e) {
6800 return function(r) {
6801 for (var a = this, n = [], i = {}; ; ) {
6802 var s = e.outgoing ? a.outgoers() : a.incomers();
6803 if (s.length === 0)
6804 break;
6805 for (var o = !1, u = 0; u < s.length; u++) {
6806 var l = s[u], f = l.id();
6807 i[f] || (i[f] = !0, n.push(l), o = !0);
6808 }
6809 if (!o)
6810 break;
6811 a = s;
6812 }
6813 return this.spawn(n, !0).filter(r);
6814 };
6815 };
6816 Bt.clearTraversalCache = function() {
6817 for (var t = 0; t < this.length; t++)
6818 this[t]._private.traversalCache = null;
6819 }, He(Bt, {
6820 // get the root nodes in the DAG
6821 roots: Po({
6822 noIncomingEdges: !0
6823 }),
6824 // get the leaf nodes in the DAG
6825 leaves: Po({
6826 noOutgoingEdges: !0
6827 }),
6828 // normally called children in graph theory
6829 // these nodes =edges=> outgoing nodes
6830 outgoers: Zt(Bo({
6831 outgoing: !0
6832 }), "outgoers"),
6833 // aka DAG descendants
6834 successors: Fo({
6835 outgoing: !0
6836 }),
6837 // normally called parents in graph theory
6838 // these nodes <=edges= incoming nodes
6839 incomers: Zt(Bo({
6840 incoming: !0
6841 }), "incomers"),
6842 // aka DAG ancestors
6843 predecessors: Fo({
6844 incoming: !0
6845 })
6846 }), He(Bt, {
6847 neighborhood: Zt(function(t) {
6848 for (var e = [], r = this.nodes(), a = 0; a < r.length; a++)
6849 for (var n = r[a], i = n.connectedEdges(), s = 0; s < i.length; s++) {
6850 var o = i[s], u = o.source(), l = o.target(), f = n === u ? l : u;
6851 f.length > 0 && e.push(f[0]), e.push(o[0]);
6852 }
6853 return this.spawn(e, !0).filter(t);
6854 }, "neighborhood"),
6855 closedNeighborhood: function(e) {
6856 return this.neighborhood().add(this).filter(e);
6857 },
6858 openNeighborhood: function(e) {
6859 return this.neighborhood(e);
6860 }
6861 }), Bt.neighbourhood = Bt.neighborhood, Bt.closedNeighbourhood = Bt.closedNeighborhood, Bt.openNeighbourhood = Bt.openNeighborhood, He(Bt, {
6862 source: Zt(function(e) {
6863 var r = this[0], a;
6864 return r && (a = r._private.source || r.cy().collection()), a && e ? a.filter(e) : a;
6865 }, "source"),
6866 target: Zt(function(e) {
6867 var r = this[0], a;
6868 return r && (a = r._private.target || r.cy().collection()), a && e ? a.filter(e) : a;
6869 }, "target"),
6870 sources: Go({
6871 attr: "source"
6872 }),
6873 targets: Go({
6874 attr: "target"
6875 })
6876 });
6877 function Go(t) {
6878 return function(r) {
6879 for (var a = [], n = 0; n < this.length; n++) {
6880 var i = this[n], s = i._private[t.attr];
6881 s && a.push(s);
6882 }
6883 return this.spawn(a, !0).filter(r);
6884 };
6885 }
6886 He(Bt, {
6887 edgesWith: Zt(zo(), "edgesWith"),
6888 edgesTo: Zt(zo({
6889 thisIsSrc: !0
6890 }), "edgesTo")
6891 });
6892 function zo(t) {
6893 return function(r) {
6894 var a = [], n = this._private.cy, i = t || {};
6895 ee(r) && (r = n.$(r));
6896 for (var s = 0; s < r.length; s++)
6897 for (var o = r[s]._private.edges, u = 0; u < o.length; u++) {
6898 var l = o[u], f = l._private.data, h = this.hasElementWithId(f.source) && r.hasElementWithId(f.target), v = r.hasElementWithId(f.source) && this.hasElementWithId(f.target), d = h || v;
6899 d && ((i.thisIsSrc || i.thisIsTgt) && (i.thisIsSrc && !h || i.thisIsTgt && !v) || a.push(l));
6900 }
6901 return this.spawn(a, !0);
6902 };
6903 }
6904 He(Bt, {
6905 connectedEdges: Zt(function(t) {
6906 for (var e = [], r = this, a = 0; a < r.length; a++) {
6907 var n = r[a];
6908 if (n.isNode())
6909 for (var i = n._private.edges, s = 0; s < i.length; s++) {
6910 var o = i[s];
6911 e.push(o);
6912 }
6913 }
6914 return this.spawn(e, !0).filter(t);
6915 }, "connectedEdges"),
6916 connectedNodes: Zt(function(t) {
6917 for (var e = [], r = this, a = 0; a < r.length; a++) {
6918 var n = r[a];
6919 n.isEdge() && (e.push(n.source()[0]), e.push(n.target()[0]));
6920 }
6921 return this.spawn(e, !0).filter(t);
6922 }, "connectedNodes"),
6923 parallelEdges: Zt(Vo(), "parallelEdges"),
6924 codirectedEdges: Zt(Vo({
6925 codirected: !0
6926 }), "codirectedEdges")
6927 });
6928 function Vo(t) {
6929 var e = {
6930 codirected: !1
6931 };
6932 return t = He({}, e, t), function(a) {
6933 for (var n = [], i = this.edges(), s = t, o = 0; o < i.length; o++)
6934 for (var u = i[o], l = u._private, f = l.source, h = f._private.data.id, v = l.data.target, d = f._private.edges, c = 0; c < d.length; c++) {
6935 var y = d[c], p = y._private.data, g = p.target, m = p.source, b = g === v && m === h, E = h === g && v === m;
6936 (s.codirected && b || !s.codirected && (b || E)) && n.push(y);
6937 }
6938 return this.spawn(n, !0).filter(a);
6939 };
6940 }
6941 He(Bt, {
6942 components: function(e) {
6943 var r = this, a = r.cy(), n = a.collection(), i = e == null ? r.nodes() : e.nodes(), s = [];
6944 e != null && i.empty() && (i = e.sources());
6945 var o = function(f, h) {
6946 n.merge(f), i.unmerge(f), h.merge(f);
6947 };
6948 if (i.empty())
6949 return r.spawn();
6950 var u = function() {
6951 var f = a.collection();
6952 s.push(f);
6953 var h = i[0];
6954 o(h, f), r.bfs({
6955 directed: !1,
6956 roots: h,
6957 visit: function(d) {
6958 return o(d, f);
6959 }
6960 }), f.forEach(function(v) {
6961 v.connectedEdges().forEach(function(d) {
6962 r.has(d) && f.has(d.source()) && f.has(d.target()) && f.merge(d);
6963 });
6964 });
6965 };
6966 do
6967 u();
6968 while (i.length > 0);
6969 return s;
6970 },
6971 component: function() {
6972 var e = this[0];
6973 return e.cy().mutableElements().components(e)[0];
6974 }
6975 }), Bt.componentsOf = Bt.components;
6976 var Nt = function(e, r) {
6977 var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
6978 if (e === void 0) {
6979 xt("A collection must have a reference to the core");
6980 return;
6981 }
6982 var i = new ur(), s = !1;
6983 if (!r)
6984 r = [];
6985 else if (r.length > 0 && S(r[0]) && !Ae(r[0])) {
6986 s = !0;
6987 for (var o = [], u = new Jr(), l = 0, f = r.length; l < f; l++) {
6988 var h = r[l];
6989 h.data == null && (h.data = {});
6990 var v = h.data;
6991 if (v.id == null)
6992 v.id = ps();
6993 else if (e.hasElementWithId(v.id) || u.has(v.id))
6994 continue;
6995 var d = new hn(e, h, !1);
6996 o.push(d), u.add(v.id);
6997 }
6998 r = o;
6999 }
7000 this.length = 0;
7001 for (var c = 0, y = r.length; c < y; c++) {
7002 var p = r[c][0];
7003 if (p != null) {
7004 var g = p._private.data.id;
7005 (!a || !i.has(g)) && (a && i.set(g, {
7006 index: this.length,
7007 ele: p
7008 }), this[this.length] = p, this.length++);
7009 }
7010 }
7011 this._private = {
7012 eles: this,
7013 cy: e,
7014 get map() {
7015 return this.lazyMap == null && this.rebuildMap(), this.lazyMap;
7016 },
7017 set map(m) {
7018 this.lazyMap = m;
7019 },
7020 rebuildMap: function() {
7021 for (var b = this.lazyMap = new ur(), E = this.eles, M = 0; M < E.length; M++) {
7022 var L = E[M];
7023 b.set(L.id(), {
7024 index: M,
7025 ele: L
7026 });
7027 }
7028 }
7029 }, a && (this._private.map = i), s && !n && this.restore();
7030 }, mt = hn.prototype = Nt.prototype = Object.create(Array.prototype);
7031 mt.instanceString = function() {
7032 return "collection";
7033 }, mt.spawn = function(t, e) {
7034 return new Nt(this.cy(), t, e);
7035 }, mt.spawnSelf = function() {
7036 return this.spawn(this);
7037 }, mt.cy = function() {
7038 return this._private.cy;
7039 }, mt.renderer = function() {
7040 return this._private.cy.renderer();
7041 }, mt.element = function() {
7042 return this[0];
7043 }, mt.collection = function() {
7044 return Ne(this) ? this : new Nt(this._private.cy, [this]);
7045 }, mt.unique = function() {
7046 return new Nt(this._private.cy, this, !0);
7047 }, mt.hasElementWithId = function(t) {
7048 return t = "" + t, this._private.map.has(t);
7049 }, mt.getElementById = function(t) {
7050 t = "" + t;
7051 var e = this._private.cy, r = this._private.map.get(t);
7052 return r ? r.ele : new Nt(e);
7053 }, mt.$id = mt.getElementById, mt.poolIndex = function() {
7054 var t = this._private.cy, e = t._private.elements, r = this[0]._private.data.id;
7055 return e._private.map.get(r).index;
7056 }, mt.indexOf = function(t) {
7057 var e = t[0]._private.data.id;
7058 return this._private.map.get(e).index;
7059 }, mt.indexOfId = function(t) {
7060 return t = "" + t, this._private.map.get(t).index;
7061 }, mt.json = function(t) {
7062 var e = this.element(), r = this.cy();
7063 if (e == null && t)
7064 return this;
7065 if (e != null) {
7066 var a = e._private;
7067 if (S(t)) {
7068 if (r.startBatch(), t.data) {
7069 e.data(t.data);
7070 var n = a.data;
7071 if (e.isEdge()) {
7072 var i = !1, s = {}, o = t.data.source, u = t.data.target;
7073 o != null && o != n.source && (s.source = "" + o, i = !0), u != null && u != n.target && (s.target = "" + u, i = !0), i && (e = e.move(s));
7074 } else {
7075 var l = "parent" in t.data, f = t.data.parent;
7076 l && (f != null || n.parent != null) && f != n.parent && (f === void 0 && (f = null), f != null && (f = "" + f), e = e.move({
7077 parent: f
7078 }));
7079 }
7080 }
7081 t.position && e.position(t.position);
7082 var h = function(y, p, g) {
7083 var m = t[y];
7084 m != null && m !== a[y] && (m ? e[p]() : e[g]());
7085 };
7086 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;
7087 } else if (t === void 0) {
7088 var v = {
7089 data: lr(a.data),
7090 position: lr(a.position),
7091 group: a.group,
7092 removed: a.removed,
7093 selected: a.selected,
7094 selectable: a.selectable,
7095 locked: a.locked,
7096 grabbable: a.grabbable,
7097 pannable: a.pannable,
7098 classes: null
7099 };
7100 v.classes = "";
7101 var d = 0;
7102 return a.classes.forEach(function(c) {
7103 return v.classes += d++ === 0 ? c : " " + c;
7104 }), v;
7105 }
7106 }
7107 }, mt.jsons = function() {
7108 for (var t = [], e = 0; e < this.length; e++) {
7109 var r = this[e], a = r.json();
7110 t.push(a);
7111 }
7112 return t;
7113 }, mt.clone = function() {
7114 for (var t = this.cy(), e = [], r = 0; r < this.length; r++) {
7115 var a = this[r], n = a.json(), i = new hn(t, n, !1);
7116 e.push(i);
7117 }
7118 return new Nt(t, e);
7119 }, mt.copy = mt.clone, mt.restore = function() {
7120 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, u = 0, l = r.length; u < l; u++) {
7121 var f = r[u];
7122 e && !f.removed() || (f.isNode() ? i.push(f) : s.push(f));
7123 }
7124 o = i.concat(s);
7125 var h, v = function() {
7126 o.splice(h, 1), h--;
7127 };
7128 for (h = 0; h < o.length; h++) {
7129 var d = o[h], c = d._private, y = c.data;
7130 if (d.clearTraversalCache(), !(!e && !c.removed)) {
7131 if (y.id === void 0)
7132 y.id = ps();
7133 else if (R(y.id))
7134 y.id = "" + y.id;
7135 else if (Re(y.id) || !ee(y.id)) {
7136 xt("Can not create element with invalid string ID `" + y.id + "`"), v();
7137 continue;
7138 } else if (a.hasElementWithId(y.id)) {
7139 xt("Can not create second element with ID `" + y.id + "`"), v();
7140 continue;
7141 }
7142 }
7143 var p = y.id;
7144 if (d.isNode()) {
7145 var g = c.position;
7146 g.x == null && (g.x = 0), g.y == null && (g.y = 0);
7147 }
7148 if (d.isEdge()) {
7149 for (var m = d, b = ["source", "target"], E = b.length, M = !1, L = 0; L < E; L++) {
7150 var w = b[L], k = y[w];
7151 R(k) && (k = y[w] = "" + y[w]), k == null || k === "" ? (xt("Can not create edge `" + p + "` with unspecified " + w), M = !0) : a.hasElementWithId(k) || (xt("Can not create edge `" + p + "` with nonexistant " + w + " `" + k + "`"), M = !0);
7152 }
7153 if (M) {
7154 v();
7155 continue;
7156 }
7157 var D = a.getElementById(y.source), F = a.getElementById(y.target);
7158 D.same(F) ? D._private.edges.push(m) : (D._private.edges.push(m), F._private.edges.push(m)), m._private.source = D, m._private.target = F;
7159 }
7160 c.map = new ur(), c.map.set(p, {
7161 ele: d,
7162 index: 0
7163 }), c.removed = !1, e && a.addToPool(d);
7164 }
7165 for (var G = 0; G < i.length; G++) {
7166 var N = i[G], X = N._private.data;
7167 R(X.parent) && (X.parent = "" + X.parent);
7168 var B = X.parent, re = B != null;
7169 if (re || N._private.parent) {
7170 var K = N._private.parent ? a.collection().merge(N._private.parent) : a.getElementById(B);
7171 if (K.empty())
7172 X.parent = void 0;
7173 else if (K[0].removed())
7174 vt("Node added with missing parent, reference to parent removed"), X.parent = void 0, N._private.parent = null;
7175 else {
7176 for (var W = !1, ae = K; !ae.empty(); ) {
7177 if (N.same(ae)) {
7178 W = !0, X.parent = void 0;
7179 break;
7180 }
7181 ae = ae.parent();
7182 }
7183 W || (K[0]._private.children.push(N), N._private.parent = K[0], n.hasCompoundNodes = !0);
7184 }
7185 }
7186 }
7187 if (o.length > 0) {
7188 for (var ue = o.length === r.length ? r : new Nt(a, o), me = 0; me < ue.length; me++) {
7189 var ie = ue[me];
7190 ie.isNode() || (ie.parallelEdges().clearTraversalCache(), ie.source().clearTraversalCache(), ie.target().clearTraversalCache());
7191 }
7192 var ge;
7193 n.hasCompoundNodes ? ge = a.collection().merge(ue).merge(ue.connectedNodes()).merge(ue.parent()) : ge = ue, ge.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t), t ? ue.emitAndNotify("add") : e && ue.emit("add");
7194 }
7195 return r;
7196 }, mt.removed = function() {
7197 var t = this[0];
7198 return t && t._private.removed;
7199 }, mt.inside = function() {
7200 var t = this[0];
7201 return t && !t._private.removed;
7202 }, mt.remove = function() {
7203 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;
7204 function s(B) {
7205 for (var re = B._private.edges, K = 0; K < re.length; K++)
7206 u(re[K]);
7207 }
7208 function o(B) {
7209 for (var re = B._private.children, K = 0; K < re.length; K++)
7210 u(re[K]);
7211 }
7212 function u(B) {
7213 var re = n[B.id()];
7214 e && B.removed() || re || (n[B.id()] = !0, B.isNode() ? (a.push(B), s(B), o(B)) : a.unshift(B));
7215 }
7216 for (var l = 0, f = r.length; l < f; l++) {
7217 var h = r[l];
7218 u(h);
7219 }
7220 function v(B, re) {
7221 var K = B._private.edges;
7222 xr(K, re), B.clearTraversalCache();
7223 }
7224 function d(B) {
7225 B.clearTraversalCache();
7226 }
7227 var c = [];
7228 c.ids = {};
7229 function y(B, re) {
7230 re = re[0], B = B[0];
7231 var K = B._private.children, W = B.id();
7232 xr(K, re), re._private.parent = null, c.ids[W] || (c.ids[W] = !0, c.push(B));
7233 }
7234 r.dirtyCompoundBoundsCache(), e && i.removeFromPool(a);
7235 for (var p = 0; p < a.length; p++) {
7236 var g = a[p];
7237 if (g.isEdge()) {
7238 var m = g.source()[0], b = g.target()[0];
7239 v(m, g), v(b, g);
7240 for (var E = g.parallelEdges(), M = 0; M < E.length; M++) {
7241 var L = E[M];
7242 d(L), L.isBundledBezier() && L.dirtyBoundingBoxCache();
7243 }
7244 } else {
7245 var w = g.parent();
7246 w.length !== 0 && y(w, g);
7247 }
7248 e && (g._private.removed = !0);
7249 }
7250 var k = i._private.elements;
7251 i._private.hasCompoundNodes = !1;
7252 for (var D = 0; D < k.length; D++) {
7253 var F = k[D];
7254 if (F.isParent()) {
7255 i._private.hasCompoundNodes = !0;
7256 break;
7257 }
7258 }
7259 var G = new Nt(this.cy(), a);
7260 G.size() > 0 && (t ? G.emitAndNotify("remove") : e && G.emit("remove"));
7261 for (var N = 0; N < c.length; N++) {
7262 var X = c[N];
7263 (!e || !X.removed()) && X.updateStyle();
7264 }
7265 return G;
7266 }, mt.move = function(t) {
7267 var e = this._private.cy, r = this, a = !1, n = !1, i = function(c) {
7268 return c == null ? c : "" + c;
7269 };
7270 if (t.source !== void 0 || t.target !== void 0) {
7271 var s = i(t.source), o = i(t.target), u = s != null && e.hasElementWithId(s), l = o != null && e.hasElementWithId(o);
7272 (u || l) && (e.batch(function() {
7273 r.remove(a, n), r.emitAndNotify("moveout");
7274 for (var d = 0; d < r.length; d++) {
7275 var c = r[d], y = c._private.data;
7276 c.isEdge() && (u && (y.source = s), l && (y.target = o));
7277 }
7278 r.restore(a, n);
7279 }), r.emitAndNotify("move"));
7280 } else if (t.parent !== void 0) {
7281 var f = i(t.parent), h = f === null || e.hasElementWithId(f);
7282 if (h) {
7283 var v = f === null ? void 0 : f;
7284 e.batch(function() {
7285 var d = r.remove(a, n);
7286 d.emitAndNotify("moveout");
7287 for (var c = 0; c < r.length; c++) {
7288 var y = r[c], p = y._private.data;
7289 y.isNode() && (p.parent = v);
7290 }
7291 d.restore(a, n);
7292 }), r.emitAndNotify("move");
7293 }
7294 }
7295 return this;
7296 }, [_s, Gc, Ln, Ar, fa, ed, An, pd, No, Io, wd, Rn, kn, Ot, Ir, Bt].forEach(function(t) {
7297 He(mt, t);
7298 });
7299 var Ad = {
7300 add: function(e) {
7301 var r, a = this;
7302 if (pe(e)) {
7303 var n = e;
7304 if (n._private.cy === a)
7305 r = n.restore();
7306 else {
7307 for (var i = [], s = 0; s < n.length; s++) {
7308 var o = n[s];
7309 i.push(o.json());
7310 }
7311 r = new Nt(a, i);
7312 }
7313 } else if (te(e)) {
7314 var u = e;
7315 r = new Nt(a, u);
7316 } else if (S(e) && (te(e.nodes) || te(e.edges))) {
7317 for (var l = e, f = [], h = ["nodes", "edges"], v = 0, d = h.length; v < d; v++) {
7318 var c = h[v], y = l[c];
7319 if (te(y))
7320 for (var p = 0, g = y.length; p < g; p++) {
7321 var m = He({
7322 group: c
7323 }, y[p]);
7324 f.push(m);
7325 }
7326 }
7327 r = new Nt(a, f);
7328 } else {
7329 var b = e;
7330 r = new hn(a, b).collection();
7331 }
7332 return r;
7333 },
7334 remove: function(e) {
7335 if (!pe(e)) {
7336 if (ee(e)) {
7337 var r = e;
7338 e = this.$(r);
7339 }
7340 }
7341 return e.remove();
7342 }
7343 };
7344 /*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */
7345 function Od(t, e, r, a) {
7346 var n = 4, i = 1e-3, s = 1e-7, o = 10, u = 11, l = 1 / (u - 1), f = typeof Float32Array < "u";
7347 if (arguments.length !== 4)
7348 return !1;
7349 for (var h = 0; h < 4; ++h)
7350 if (typeof arguments[h] != "number" || isNaN(arguments[h]) || !isFinite(arguments[h]))
7351 return !1;
7352 t = Math.min(t, 1), r = Math.min(r, 1), t = Math.max(t, 0), r = Math.max(r, 0);
7353 var v = f ? new Float32Array(u) : new Array(u);
7354 function d(F, G) {
7355 return 1 - 3 * G + 3 * F;
7356 }
7357 function c(F, G) {
7358 return 3 * G - 6 * F;
7359 }
7360 function y(F) {
7361 return 3 * F;
7362 }
7363 function p(F, G, N) {
7364 return ((d(G, N) * F + c(G, N)) * F + y(G)) * F;
7365 }
7366 function g(F, G, N) {
7367 return 3 * d(G, N) * F * F + 2 * c(G, N) * F + y(G);
7368 }
7369 function m(F, G) {
7370 for (var N = 0; N < n; ++N) {
7371 var X = g(G, t, r);
7372 if (X === 0)
7373 return G;
7374 var B = p(G, t, r) - F;
7375 G -= B / X;
7376 }
7377 return G;
7378 }
7379 function b() {
7380 for (var F = 0; F < u; ++F)
7381 v[F] = p(F * l, t, r);
7382 }
7383 function E(F, G, N) {
7384 var X, B, re = 0;
7385 do
7386 B = G + (N - G) / 2, X = p(B, t, r) - F, X > 0 ? N = B : G = B;
7387 while (Math.abs(X) > s && ++re < o);
7388 return B;
7389 }
7390 function M(F) {
7391 for (var G = 0, N = 1, X = u - 1; N !== X && v[N] <= F; ++N)
7392 G += l;
7393 --N;
7394 var B = (F - v[N]) / (v[N + 1] - v[N]), re = G + B * l, K = g(re, t, r);
7395 return K >= i ? m(F, re) : K === 0 ? re : E(F, G, G + l);
7396 }
7397 var L = !1;
7398 function w() {
7399 L = !0, (t !== e || r !== a) && b();
7400 }
7401 var k = function(G) {
7402 return L || w(), t === e && r === a ? G : G === 0 ? 0 : G === 1 ? 1 : p(M(G), e, a);
7403 };
7404 k.getControlPoints = function() {
7405 return [{
7406 x: t,
7407 y: e
7408 }, {
7409 x: r,
7410 y: a
7411 }];
7412 };
7413 var D = "generateBezier(" + [t, e, r, a] + ")";
7414 return k.toString = function() {
7415 return D;
7416 }, k;
7417 }
7418 /*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */
7419 var Nd = function() {
7420 function t(a) {
7421 return -a.tension * a.x - a.friction * a.v;
7422 }
7423 function e(a, n, i) {
7424 var s = {
7425 x: a.x + i.dx * n,
7426 v: a.v + i.dv * n,
7427 tension: a.tension,
7428 friction: a.friction
7429 };
7430 return {
7431 dx: s.v,
7432 dv: t(s)
7433 };
7434 }
7435 function r(a, n) {
7436 var i = {
7437 dx: a.v,
7438 dv: t(a)
7439 }, s = e(a, n * 0.5, i), o = e(a, n * 0.5, s), u = e(a, n, o), l = 1 / 6 * (i.dx + 2 * (s.dx + o.dx) + u.dx), f = 1 / 6 * (i.dv + 2 * (s.dv + o.dv) + u.dv);
7440 return a.x = a.x + l * n, a.v = a.v + f * n, a;
7441 }
7442 return function a(n, i, s) {
7443 var o = {
7444 x: -1,
7445 v: 0,
7446 tension: null,
7447 friction: null
7448 }, u = [0], l = 0, f = 1 / 1e4, h = 16 / 1e3, v, d, c;
7449 for (n = parseFloat(n) || 500, i = parseFloat(i) || 20, s = s || null, o.tension = n, o.friction = i, v = s !== null, v ? (l = a(n, i), d = l / s * h) : d = h; c = r(c || o, d), u.push(1 + c.x), l += 16, Math.abs(c.x) > f && Math.abs(c.v) > f; )
7450 ;
7451 return v ? function(y) {
7452 return u[y * (u.length - 1) | 0];
7453 } : l;
7454 };
7455 }(), bt = function(e, r, a, n) {
7456 var i = Od(e, r, a, n);
7457 return function(s, o, u) {
7458 return s + (o - s) * i(u);
7459 };
7460 }, Fn = {
7461 linear: function(e, r, a) {
7462 return e + (r - e) * a;
7463 },
7464 // default easings
7465 ease: bt(0.25, 0.1, 0.25, 1),
7466 "ease-in": bt(0.42, 0, 1, 1),
7467 "ease-out": bt(0, 0, 0.58, 1),
7468 "ease-in-out": bt(0.42, 0, 0.58, 1),
7469 // sine
7470 "ease-in-sine": bt(0.47, 0, 0.745, 0.715),
7471 "ease-out-sine": bt(0.39, 0.575, 0.565, 1),
7472 "ease-in-out-sine": bt(0.445, 0.05, 0.55, 0.95),
7473 // quad
7474 "ease-in-quad": bt(0.55, 0.085, 0.68, 0.53),
7475 "ease-out-quad": bt(0.25, 0.46, 0.45, 0.94),
7476 "ease-in-out-quad": bt(0.455, 0.03, 0.515, 0.955),
7477 // cubic
7478 "ease-in-cubic": bt(0.55, 0.055, 0.675, 0.19),
7479 "ease-out-cubic": bt(0.215, 0.61, 0.355, 1),
7480 "ease-in-out-cubic": bt(0.645, 0.045, 0.355, 1),
7481 // quart
7482 "ease-in-quart": bt(0.895, 0.03, 0.685, 0.22),
7483 "ease-out-quart": bt(0.165, 0.84, 0.44, 1),
7484 "ease-in-out-quart": bt(0.77, 0, 0.175, 1),
7485 // quint
7486 "ease-in-quint": bt(0.755, 0.05, 0.855, 0.06),
7487 "ease-out-quint": bt(0.23, 1, 0.32, 1),
7488 "ease-in-out-quint": bt(0.86, 0, 0.07, 1),
7489 // expo
7490 "ease-in-expo": bt(0.95, 0.05, 0.795, 0.035),
7491 "ease-out-expo": bt(0.19, 1, 0.22, 1),
7492 "ease-in-out-expo": bt(1, 0, 0, 1),
7493 // circ
7494 "ease-in-circ": bt(0.6, 0.04, 0.98, 0.335),
7495 "ease-out-circ": bt(0.075, 0.82, 0.165, 1),
7496 "ease-in-out-circ": bt(0.785, 0.135, 0.15, 0.86),
7497 // user param easings...
7498 spring: function(e, r, a) {
7499 if (a === 0)
7500 return Fn.linear;
7501 var n = Nd(e, r, a);
7502 return function(i, s, o) {
7503 return i + (s - i) * n(o);
7504 };
7505 },
7506 "cubic-bezier": bt
7507 };
7508 function Uo(t, e, r, a, n) {
7509 if (a === 1 || e === r)
7510 return r;
7511 var i = n(e, r, a);
7512 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;
7513 }
7514 function $o(t, e) {
7515 return t.pfValue != null || t.value != null ? t.pfValue != null && (e == null || e.type.units !== "%") ? t.pfValue : t.value : t;
7516 }
7517 function ga(t, e, r, a, n) {
7518 var i = n != null ? n.type : null;
7519 r < 0 ? r = 0 : r > 1 && (r = 1);
7520 var s = $o(t, n), o = $o(e, n);
7521 if (R(s) && R(o))
7522 return Uo(i, s, o, r, a);
7523 if (te(s) && te(o)) {
7524 for (var u = [], l = 0; l < o.length; l++) {
7525 var f = s[l], h = o[l];
7526 if (f != null && h != null) {
7527 var v = Uo(i, f, h, r, a);
7528 u.push(v);
7529 } else
7530 u.push(h);
7531 }
7532 return u;
7533 }
7534 }
7535 function Id(t, e, r, a) {
7536 var n = !a, i = t._private, s = e._private, o = s.easing, u = s.startTime, l = a ? t : t.cy(), f = l.style();
7537 if (!s.easingImpl)
7538 if (o == null)
7539 s.easingImpl = Fn.linear;
7540 else {
7541 var h;
7542 if (ee(o)) {
7543 var v = f.parse("transition-timing-function", o);
7544 h = v.value;
7545 } else
7546 h = o;
7547 var d, c;
7548 ee(h) ? (d = h, c = []) : (d = h[1], c = h.slice(2).map(function(ue) {
7549 return +ue;
7550 })), c.length > 0 ? (d === "spring" && c.push(s.duration), s.easingImpl = Fn[d].apply(null, c)) : s.easingImpl = Fn[d];
7551 }
7552 var y = s.easingImpl, p;
7553 if (s.duration === 0 ? p = 1 : p = (r - u) / s.duration, s.applying && (p = s.progress), p < 0 ? p = 0 : p > 1 && (p = 1), s.delay == null) {
7554 var g = s.startPosition, m = s.position;
7555 if (m && n && !t.locked()) {
7556 var b = {};
7557 Xa(g.x, m.x) && (b.x = ga(g.x, m.x, p, y)), Xa(g.y, m.y) && (b.y = ga(g.y, m.y, p, y)), t.position(b);
7558 }
7559 var E = s.startPan, M = s.pan, L = i.pan, w = M != null && a;
7560 w && (Xa(E.x, M.x) && (L.x = ga(E.x, M.x, p, y)), Xa(E.y, M.y) && (L.y = ga(E.y, M.y, p, y)), t.emit("pan"));
7561 var k = s.startZoom, D = s.zoom, F = D != null && a;
7562 F && (Xa(k, D) && (i.zoom = ka(i.minZoom, ga(k, D, p, y), i.maxZoom)), t.emit("zoom")), (w || F) && t.emit("viewport");
7563 var G = s.style;
7564 if (G && G.length > 0 && n) {
7565 for (var N = 0; N < G.length; N++) {
7566 var X = G[N], B = X.name, re = X, K = s.startStyle[B], W = f.properties[K.name], ae = ga(K, re, p, y, W);
7567 f.overrideBypass(t, B, ae);
7568 }
7569 t.emit("style");
7570 }
7571 }
7572 return s.progress = p, p;
7573 }
7574 function Xa(t, e) {
7575 return t == null || e == null ? !1 : R(t) && R(e) ? !0 : !!(t && e);
7576 }
7577 function Md(t, e, r, a) {
7578 var n = e._private;
7579 n.started = !0, n.startTime = r - n.progress * n.duration;
7580 }
7581 function _o(t, e) {
7582 var r = e._private.aniEles, a = [];
7583 function n(f, h) {
7584 var v = f._private, d = v.animation.current, c = v.animation.queue, y = !1;
7585 if (d.length === 0) {
7586 var p = c.shift();
7587 p && d.push(p);
7588 }
7589 for (var g = function(L) {
7590 for (var w = L.length - 1; w >= 0; w--) {
7591 var k = L[w];
7592 k();
7593 }
7594 L.splice(0, L.length);
7595 }, m = d.length - 1; m >= 0; m--) {
7596 var b = d[m], E = b._private;
7597 if (E.stopped) {
7598 d.splice(m, 1), E.hooked = !1, E.playing = !1, E.started = !1, g(E.frames);
7599 continue;
7600 }
7601 !E.playing && !E.applying || (E.playing && E.applying && (E.applying = !1), E.started || Md(f, b, t), Id(f, b, t, h), E.applying && (E.applying = !1), g(E.frames), E.step != null && E.step(t), b.completed() && (d.splice(m, 1), E.hooked = !1, E.playing = !1, E.started = !1, g(E.completes)), y = !0);
7602 }
7603 return !h && d.length === 0 && c.length === 0 && a.push(f), y;
7604 }
7605 for (var i = !1, s = 0; s < r.length; s++) {
7606 var o = r[s], u = n(o);
7607 i = i || u;
7608 }
7609 var l = n(e, !0);
7610 (i || l) && (r.length > 0 ? e.notify("draw", r) : e.notify("draw")), r.unmerge(a), e.emit("step");
7611 }
7612 var Rd = {
7613 // pull in animation functions
7614 animate: ct.animate(),
7615 animation: ct.animation(),
7616 animated: ct.animated(),
7617 clearQueue: ct.clearQueue(),
7618 delay: ct.delay(),
7619 delayAnimation: ct.delayAnimation(),
7620 stop: ct.stop(),
7621 addToAnimationPool: function(e) {
7622 var r = this;
7623 r.styleEnabled() && r._private.aniEles.merge(e);
7624 },
7625 stopAnimationLoop: function() {
7626 this._private.animationsRunning = !1;
7627 },
7628 startAnimationLoop: function() {
7629 var e = this;
7630 if (e._private.animationsRunning = !0, !e.styleEnabled())
7631 return;
7632 function r() {
7633 e._private.animationsRunning && ln(function(i) {
7634 _o(i, e), r();
7635 });
7636 }
7637 var a = e.renderer();
7638 a && a.beforeRender ? a.beforeRender(function(i, s) {
7639 _o(s, e);
7640 }, a.beforeRenderPriorities.animations) : r();
7641 }
7642 }, kd = {
7643 qualifierCompare: function(e, r) {
7644 return e == null || r == null ? e == null && r == null : e.sameText(r);
7645 },
7646 eventMatches: function(e, r, a) {
7647 var n = r.qualifier;
7648 return n != null ? e !== a.target && Ae(a.target) && n.matches(a.target) : !0;
7649 },
7650 addEventFields: function(e, r) {
7651 r.cy = e, r.target = e;
7652 },
7653 callbackContext: function(e, r, a) {
7654 return r.qualifier != null ? a.target : e;
7655 }
7656 }, Gn = function(e) {
7657 return ee(e) ? new Sr(e) : e;
7658 }, Yo = {
7659 createEmitter: function() {
7660 var e = this._private;
7661 return e.emitter || (e.emitter = new In(kd, this)), this;
7662 },
7663 emitter: function() {
7664 return this._private.emitter;
7665 },
7666 on: function(e, r, a) {
7667 return this.emitter().on(e, Gn(r), a), this;
7668 },
7669 removeListener: function(e, r, a) {
7670 return this.emitter().removeListener(e, Gn(r), a), this;
7671 },
7672 removeAllListeners: function() {
7673 return this.emitter().removeAllListeners(), this;
7674 },
7675 one: function(e, r, a) {
7676 return this.emitter().one(e, Gn(r), a), this;
7677 },
7678 once: function(e, r, a) {
7679 return this.emitter().one(e, Gn(r), a), this;
7680 },
7681 emit: function(e, r) {
7682 return this.emitter().emit(e, r), this;
7683 },
7684 emitAndNotify: function(e, r) {
7685 return this.emit(e), this.notify(e, r), this;
7686 }
7687 };
7688 ct.eventAliasesOn(Yo);
7689 var Ii = {
7690 png: function(e) {
7691 var r = this._private.renderer;
7692 return e = e || {}, r.png(e);
7693 },
7694 jpg: function(e) {
7695 var r = this._private.renderer;
7696 return e = e || {}, e.bg = e.bg || "#fff", r.jpg(e);
7697 }
7698 };
7699 Ii.jpeg = Ii.jpg;
7700 var zn = {
7701 layout: function(e) {
7702 var r = this;
7703 if (e == null) {
7704 xt("Layout options must be specified to make a layout");
7705 return;
7706 }
7707 if (e.name == null) {
7708 xt("A `name` must be specified to make a layout");
7709 return;
7710 }
7711 var a = e.name, n = r.extension("layout", a);
7712 if (n == null) {
7713 xt("No such layout `" + a + "` found. Did you forget to import it and `cytoscape.use()` it?");
7714 return;
7715 }
7716 var i;
7717 ee(e.eles) ? i = r.$(e.eles) : i = e.eles != null ? e.eles : r.$();
7718 var s = new n(He({}, e, {
7719 cy: r,
7720 eles: i
7721 }));
7722 return s;
7723 }
7724 };
7725 zn.createLayout = zn.makeLayout = zn.layout;
7726 var Pd = {
7727 notify: function(e, r) {
7728 var a = this._private;
7729 if (this.batching()) {
7730 a.batchNotifications = a.batchNotifications || {};
7731 var n = a.batchNotifications[e] = a.batchNotifications[e] || this.collection();
7732 r != null && n.merge(r);
7733 return;
7734 }
7735 if (a.notificationsEnabled) {
7736 var i = this.renderer();
7737 this.destroyed() || !i || i.notify(e, r);
7738 }
7739 },
7740 notifications: function(e) {
7741 var r = this._private;
7742 return e === void 0 ? r.notificationsEnabled : (r.notificationsEnabled = !!e, this);
7743 },
7744 noNotifications: function(e) {
7745 this.notifications(!1), e(), this.notifications(!0);
7746 },
7747 batching: function() {
7748 return this._private.batchCount > 0;
7749 },
7750 startBatch: function() {
7751 var e = this._private;
7752 return e.batchCount == null && (e.batchCount = 0), e.batchCount === 0 && (e.batchStyleEles = this.collection(), e.batchNotifications = {}), e.batchCount++, this;
7753 },
7754 endBatch: function() {
7755 var e = this._private;
7756 if (e.batchCount === 0)
7757 return this;
7758 if (e.batchCount--, e.batchCount === 0) {
7759 e.batchStyleEles.updateStyle();
7760 var r = this.renderer();
7761 Object.keys(e.batchNotifications).forEach(function(a) {
7762 var n = e.batchNotifications[a];
7763 n.empty() ? r.notify(a) : r.notify(a, n);
7764 });
7765 }
7766 return this;
7767 },
7768 batch: function(e) {
7769 return this.startBatch(), e(), this.endBatch(), this;
7770 },
7771 // for backwards compatibility
7772 batchData: function(e) {
7773 var r = this;
7774 return this.batch(function() {
7775 for (var a = Object.keys(e), n = 0; n < a.length; n++) {
7776 var i = a[n], s = e[i], o = r.getElementById(i);
7777 o.data(s);
7778 }
7779 });
7780 }
7781 }, Bd = At({
7782 hideEdgesOnViewport: !1,
7783 textureOnViewport: !1,
7784 motionBlur: !1,
7785 motionBlurOpacity: 0.05,
7786 pixelRatio: void 0,
7787 desktopTapThreshold: 4,
7788 touchTapThreshold: 8,
7789 wheelSensitivity: 1,
7790 debug: !1,
7791 showFps: !1
7792 }), Mi = {
7793 renderTo: function(e, r, a, n) {
7794 var i = this._private.renderer;
7795 return i.renderTo(e, r, a, n), this;
7796 },
7797 renderer: function() {
7798 return this._private.renderer;
7799 },
7800 forceRender: function() {
7801 return this.notify("draw"), this;
7802 },
7803 resize: function() {
7804 return this.invalidateSize(), this.emitAndNotify("resize"), this;
7805 },
7806 initRenderer: function(e) {
7807 var r = this, a = r.extension("renderer", e.name);
7808 if (a == null) {
7809 xt("Can not initialise: No such renderer `".concat(e.name, "` found. Did you forget to import it and `cytoscape.use()` it?"));
7810 return;
7811 }
7812 e.wheelSensitivity !== void 0 && vt("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.");
7813 var n = Bd(e);
7814 n.cy = r, r._private.renderer = new a(n), this.notify("init");
7815 },
7816 destroyRenderer: function() {
7817 var e = this;
7818 e.notify("destroy");
7819 var r = e.container();
7820 if (r)
7821 for (r._cyreg = null; r.childNodes.length > 0; )
7822 r.removeChild(r.childNodes[0]);
7823 e._private.renderer = null, e.mutableElements().forEach(function(a) {
7824 var n = a._private;
7825 n.rscratch = {}, n.rstyle = {}, n.animation.current = [], n.animation.queue = [];
7826 });
7827 },
7828 onRender: function(e) {
7829 return this.on("render", e);
7830 },
7831 offRender: function(e) {
7832 return this.off("render", e);
7833 }
7834 };
7835 Mi.invalidateDimensions = Mi.resize;
7836 var Vn = {
7837 // get a collection
7838 // - empty collection on no args
7839 // - collection of elements in the graph on selector arg
7840 // - guarantee a returned collection when elements or collection specified
7841 collection: function(e, r) {
7842 return ee(e) ? this.$(e) : pe(e) ? e.collection() : te(e) ? (r || (r = {}), new Nt(this, e, r.unique, r.removed)) : new Nt(this);
7843 },
7844 nodes: function(e) {
7845 var r = this.$(function(a) {
7846 return a.isNode();
7847 });
7848 return e ? r.filter(e) : r;
7849 },
7850 edges: function(e) {
7851 var r = this.$(function(a) {
7852 return a.isEdge();
7853 });
7854 return e ? r.filter(e) : r;
7855 },
7856 // search the graph like jQuery
7857 $: function(e) {
7858 var r = this._private.elements;
7859 return e ? r.filter(e) : r.spawnSelf();
7860 },
7861 mutableElements: function() {
7862 return this._private.elements;
7863 }
7864 };
7865 Vn.elements = Vn.filter = Vn.$;
7866 var Ft = {}, Wa = "t", Fd = "f";
7867 Ft.apply = function(t) {
7868 for (var e = this, r = e._private, a = r.cy, n = a.collection(), i = 0; i < t.length; i++) {
7869 var s = t[i], o = e.getContextMeta(s);
7870 if (!o.empty) {
7871 var u = e.getContextStyle(o), l = e.applyContextStyle(o, u, s);
7872 s._private.appliedInitStyle ? e.updateTransitions(s, l.diffProps) : s._private.appliedInitStyle = !0;
7873 var f = e.updateStyleHints(s);
7874 f && n.push(s);
7875 }
7876 }
7877 return n;
7878 }, Ft.getPropertiesDiff = function(t, e) {
7879 var r = this, a = r._private.propDiffs = r._private.propDiffs || {}, n = t + "-" + e, i = a[n];
7880 if (i)
7881 return i;
7882 for (var s = [], o = {}, u = 0; u < r.length; u++) {
7883 var l = r[u], f = t[u] === Wa, h = e[u] === Wa, v = f !== h, d = l.mappedProperties.length > 0;
7884 if (v || h && d) {
7885 var c = void 0;
7886 v && d || v ? c = l.properties : d && (c = l.mappedProperties);
7887 for (var y = 0; y < c.length; y++) {
7888 for (var p = c[y], g = p.name, m = !1, b = u + 1; b < r.length; b++) {
7889 var E = r[b], M = e[b] === Wa;
7890 if (M && (m = E.properties[p.name] != null, m))
7891 break;
7892 }
7893 !o[g] && !m && (o[g] = !0, s.push(g));
7894 }
7895 }
7896 }
7897 return a[n] = s, s;
7898 }, Ft.getContextMeta = function(t) {
7899 for (var e = this, r = "", a, n = t._private.styleCxtKey || "", i = 0; i < e.length; i++) {
7900 var s = e[i], o = s.selector && s.selector.matches(t);
7901 o ? r += Wa : r += Fd;
7902 }
7903 return a = e.getPropertiesDiff(n, r), t._private.styleCxtKey = r, {
7904 key: r,
7905 diffPropNames: a,
7906 empty: a.length === 0
7907 };
7908 }, Ft.getContextStyle = function(t) {
7909 var e = t.key, r = this, a = this._private.contextStyles = this._private.contextStyles || {};
7910 if (a[e])
7911 return a[e];
7912 for (var n = {
7913 _private: {
7914 key: e
7915 }
7916 }, i = 0; i < r.length; i++) {
7917 var s = r[i], o = e[i] === Wa;
7918 if (o)
7919 for (var u = 0; u < s.properties.length; u++) {
7920 var l = s.properties[u];
7921 n[l.name] = l;
7922 }
7923 }
7924 return a[e] = n, n;
7925 }, Ft.applyContextStyle = function(t, e, r) {
7926 for (var a = this, n = t.diffPropNames, i = {}, s = a.types, o = 0; o < n.length; o++) {
7927 var u = n[o], l = e[u], f = r.pstyle(u);
7928 if (!l)
7929 if (f)
7930 f.bypass ? l = {
7931 name: u,
7932 deleteBypassed: !0
7933 } : l = {
7934 name: u,
7935 delete: !0
7936 };
7937 else
7938 continue;
7939 if (f !== l) {
7940 if (l.mapped === s.fn && f != null && f.mapping != null && f.mapping.value === l.value) {
7941 var h = f.mapping, v = h.fnValue = l.value(r);
7942 if (v === h.prevFnValue)
7943 continue;
7944 }
7945 var d = i[u] = {
7946 prev: f
7947 };
7948 a.applyParsedProperty(r, l), d.next = r.pstyle(u), d.next && d.next.bypass && (d.next = d.next.bypassed);
7949 }
7950 }
7951 return {
7952 diffProps: i
7953 };
7954 }, Ft.updateStyleHints = function(t) {
7955 var e = t._private, r = this, a = r.propertyGroupNames, n = r.propertyGroupKeys, i = function(Oe, Fe, Xe) {
7956 return r.getPropertiesHash(Oe, Fe, Xe);
7957 }, s = e.styleKey;
7958 if (t.removed())
7959 return !1;
7960 var o = e.group === "nodes", u = t._private.style;
7961 a = Object.keys(u);
7962 for (var l = 0; l < n.length; l++) {
7963 var f = n[l];
7964 e.styleKeys[f] = [Qr, Oa];
7965 }
7966 for (var h = function(Oe, Fe) {
7967 return e.styleKeys[Fe][0] = Na(Oe, e.styleKeys[Fe][0]);
7968 }, v = function(Oe, Fe) {
7969 return e.styleKeys[Fe][1] = Ia(Oe, e.styleKeys[Fe][1]);
7970 }, d = function(Oe, Fe) {
7971 h(Oe, Fe), v(Oe, Fe);
7972 }, c = function(Oe, Fe) {
7973 for (var Xe = 0; Xe < Oe.length; Xe++) {
7974 var Ie = Oe.charCodeAt(Xe);
7975 h(Ie, Fe), v(Ie, Fe);
7976 }
7977 }, y = 2e9, p = function(Oe) {
7978 return -128 < Oe && Oe < 128 && Math.floor(Oe) !== Oe ? y - (Oe * 1024 | 0) : Oe;
7979 }, g = 0; g < a.length; g++) {
7980 var m = a[g], b = u[m];
7981 if (b != null) {
7982 var E = this.properties[m], M = E.type, L = E.groupKey, w = void 0;
7983 E.hashOverride != null ? w = E.hashOverride(t, b) : b.pfValue != null && (w = b.pfValue);
7984 var k = E.enums == null ? b.value : null, D = w != null, F = k != null, G = D || F, N = b.units;
7985 if (M.number && G && !M.multiple) {
7986 var X = D ? w : k;
7987 d(p(X), L), !D && N != null && c(N, L);
7988 } else
7989 c(b.strValue, L);
7990 }
7991 }
7992 for (var B = [Qr, Oa], re = 0; re < n.length; re++) {
7993 var K = n[re], W = e.styleKeys[K];
7994 B[0] = Na(W[0], B[0]), B[1] = Ia(W[1], B[1]);
7995 }
7996 e.styleKey = Uu(B[0], B[1]);
7997 var ae = e.styleKeys;
7998 e.labelDimsKey = wr(ae.labelDimensions);
7999 var ue = i(t, ["label"], ae.labelDimensions);
8000 if (e.labelKey = wr(ue), e.labelStyleKey = wr(un(ae.commonLabel, ue)), !o) {
8001 var me = i(t, ["source-label"], ae.labelDimensions);
8002 e.sourceLabelKey = wr(me), e.sourceLabelStyleKey = wr(un(ae.commonLabel, me));
8003 var ie = i(t, ["target-label"], ae.labelDimensions);
8004 e.targetLabelKey = wr(ie), e.targetLabelStyleKey = wr(un(ae.commonLabel, ie));
8005 }
8006 if (o) {
8007 var ge = e.styleKeys, Ee = ge.nodeBody, Ce = ge.nodeBorder, we = ge.nodeOutline, De = ge.backgroundImage, se = ge.compound, xe = ge.pie, Le = [Ee, Ce, we, De, se, xe].filter(function(Se) {
8008 return Se != null;
8009 }).reduce(un, [Qr, Oa]);
8010 e.nodeKey = wr(Le), e.hasPie = xe != null && xe[0] !== Qr && xe[1] !== Oa;
8011 }
8012 return s !== e.styleKey;
8013 }, Ft.clearStyleHints = function(t) {
8014 var e = t._private;
8015 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;
8016 }, Ft.applyParsedProperty = function(t, e) {
8017 var r = this, a = e, n = t._private.style, i, s = r.types, o = r.properties[a.name].type, u = a.bypass, l = n[a.name], f = l && l.bypass, h = t._private, v = "mapping", d = function(Ee) {
8018 return Ee == null ? null : Ee.pfValue != null ? Ee.pfValue : Ee.value;
8019 }, c = function() {
8020 var Ee = d(l), Ce = d(a);
8021 r.checkTriggers(t, a.name, Ee, Ce);
8022 };
8023 if (e.name === "curve-style" && t.isEdge() && // loops must be bundled beziers
8024 (e.value !== "bezier" && t.isLoop() || // edges connected to compound nodes can not be haystacks
8025 e.value === "haystack" && (t.source().isParent() || t.target().isParent())) && (a = e = this.parse(e.name, "bezier", u)), a.delete)
8026 return n[a.name] = void 0, c(), !0;
8027 if (a.deleteBypassed)
8028 return l ? l.bypass ? (l.bypassed = void 0, c(), !0) : !1 : (c(), !0);
8029 if (a.deleteBypass)
8030 return l ? l.bypass ? (n[a.name] = l.bypassed, c(), !0) : !1 : (c(), !0);
8031 var y = function() {
8032 vt("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");
8033 };
8034 switch (a.mapped) {
8035 case s.mapData: {
8036 for (var p = a.field.split("."), g = h.data, m = 0; m < p.length && g; m++) {
8037 var b = p[m];
8038 g = g[b];
8039 }
8040 if (g == null)
8041 return y(), !1;
8042 var E;
8043 if (R(g)) {
8044 var M = a.fieldMax - a.fieldMin;
8045 M === 0 ? E = 0 : E = (g - a.fieldMin) / M;
8046 } else
8047 return vt("Do not use continuous mappers without specifying numeric data (i.e. `" + a.field + ": " + g + "` for `" + t.id() + "` is non-numeric)"), !1;
8048 if (E < 0 ? E = 0 : E > 1 && (E = 1), o.color) {
8049 var L = a.valueMin[0], w = a.valueMax[0], k = a.valueMin[1], D = a.valueMax[1], F = a.valueMin[2], G = a.valueMax[2], N = a.valueMin[3] == null ? 1 : a.valueMin[3], X = a.valueMax[3] == null ? 1 : a.valueMax[3], B = [Math.round(L + (w - L) * E), Math.round(k + (D - k) * E), Math.round(F + (G - F) * E), Math.round(N + (X - N) * E)];
8050 i = {
8051 // colours are simple, so just create the flat property instead of expensive string parsing
8052 bypass: a.bypass,
8053 // we're a bypass if the mapping property is a bypass
8054 name: a.name,
8055 value: B,
8056 strValue: "rgb(" + B[0] + ", " + B[1] + ", " + B[2] + ")"
8057 };
8058 } else if (o.number) {
8059 var re = a.valueMin + (a.valueMax - a.valueMin) * E;
8060 i = this.parse(a.name, re, a.bypass, v);
8061 } else
8062 return !1;
8063 if (!i)
8064 return y(), !1;
8065 i.mapping = a, a = i;
8066 break;
8067 }
8068 case s.data: {
8069 for (var K = a.field.split("."), W = h.data, ae = 0; ae < K.length && W; ae++) {
8070 var ue = K[ae];
8071 W = W[ue];
8072 }
8073 if (W != null && (i = this.parse(a.name, W, a.bypass, v)), !i)
8074 return y(), !1;
8075 i.mapping = a, a = i;
8076 break;
8077 }
8078 case s.fn: {
8079 var me = a.value, ie = a.fnValue != null ? a.fnValue : me(t);
8080 if (a.prevFnValue = ie, ie == null)
8081 return vt("Custom function mappers may not return null (i.e. `" + a.name + "` for ele `" + t.id() + "` is null)"), !1;
8082 if (i = this.parse(a.name, ie, a.bypass, v), !i)
8083 return vt("Custom function mappers may not return invalid values for the property type (i.e. `" + a.name + "` for ele `" + t.id() + "` is invalid)"), !1;
8084 i.mapping = lr(a), a = i;
8085 break;
8086 }
8087 case void 0:
8088 break;
8089 default:
8090 return !1;
8091 }
8092 return u ? (f ? a.bypassed = l.bypassed : a.bypassed = l, n[a.name] = a) : f ? l.bypassed = a : n[a.name] = a, c(), !0;
8093 }, Ft.cleanElements = function(t, e) {
8094 for (var r = 0; r < t.length; r++) {
8095 var a = t[r];
8096 if (this.clearStyleHints(a), a.dirtyCompoundBoundsCache(), a.dirtyBoundingBoxCache(), !e)
8097 a._private.style = {};
8098 else
8099 for (var n = a._private.style, i = Object.keys(n), s = 0; s < i.length; s++) {
8100 var o = i[s], u = n[o];
8101 u != null && (u.bypass ? u.bypassed = null : n[o] = null);
8102 }
8103 }
8104 }, Ft.update = function() {
8105 var t = this._private.cy, e = t.mutableElements();
8106 e.updateStyle();
8107 }, Ft.updateTransitions = function(t, e) {
8108 var r = this, a = t._private, n = t.pstyle("transition-property").value, i = t.pstyle("transition-duration").pfValue, s = t.pstyle("transition-delay").pfValue;
8109 if (n.length > 0 && i > 0) {
8110 for (var o = {}, u = !1, l = 0; l < n.length; l++) {
8111 var f = n[l], h = t.pstyle(f), v = e[f];
8112 if (v) {
8113 var d = v.prev, c = d, y = v.next != null ? v.next : h, p = !1, g = void 0, m = 1e-6;
8114 c && (R(c.pfValue) && R(y.pfValue) ? (p = y.pfValue - c.pfValue, g = c.pfValue + m * p) : R(c.value) && R(y.value) ? (p = y.value - c.value, g = c.value + m * p) : te(c.value) && te(y.value) && (p = c.value[0] !== y.value[0] || c.value[1] !== y.value[1] || c.value[2] !== y.value[2], g = c.strValue), p && (o[f] = y.strValue, this.applyBypass(t, f, g), u = !0));
8115 }
8116 }
8117 if (!u)
8118 return;
8119 a.transitioning = !0, new ia(function(b) {
8120 s > 0 ? t.delayAnimation(s).play().promise().then(b) : b();
8121 }).then(function() {
8122 return t.animation({
8123 style: o,
8124 duration: i,
8125 easing: t.pstyle("transition-timing-function").value,
8126 queue: !1
8127 }).play().promise();
8128 }).then(function() {
8129 r.removeBypasses(t, n), t.emitAndNotify("style"), a.transitioning = !1;
8130 });
8131 } else
8132 a.transitioning && (this.removeBypasses(t, n), t.emitAndNotify("style"), a.transitioning = !1);
8133 }, Ft.checkTrigger = function(t, e, r, a, n, i) {
8134 var s = this.properties[e], o = n(s);
8135 o != null && o(r, a) && i(s);
8136 }, Ft.checkZOrderTrigger = function(t, e, r, a) {
8137 var n = this;
8138 this.checkTrigger(t, e, r, a, function(i) {
8139 return i.triggersZOrder;
8140 }, function() {
8141 n._private.cy.notify("zorder", t);
8142 });
8143 }, Ft.checkBoundsTrigger = function(t, e, r, a) {
8144 this.checkTrigger(t, e, r, a, function(n) {
8145 return n.triggersBounds;
8146 }, function(n) {
8147 t.dirtyCompoundBoundsCache(), t.dirtyBoundingBoxCache(), // only for beziers -- so performance of other edges isn't affected
8148 n.triggersBoundsOfParallelBeziers && e === "curve-style" && (r === "bezier" || a === "bezier") && t.parallelEdges().forEach(function(i) {
8149 i.isBundledBezier() && i.dirtyBoundingBoxCache();
8150 }), n.triggersBoundsOfConnectedEdges && e === "display" && (r === "none" || a === "none") && t.connectedEdges().forEach(function(i) {
8151 i.dirtyBoundingBoxCache();
8152 });
8153 });
8154 }, Ft.checkTriggers = function(t, e, r, a) {
8155 t.dirtyStyleCache(), this.checkZOrderTrigger(t, e, r, a), this.checkBoundsTrigger(t, e, r, a);
8156 };
8157 var qa = {};
8158 qa.applyBypass = function(t, e, r, a) {
8159 var n = this, i = [], s = !0;
8160 if (e === "*" || e === "**") {
8161 if (r !== void 0)
8162 for (var o = 0; o < n.properties.length; o++) {
8163 var u = n.properties[o], l = u.name, f = this.parse(l, r, !0);
8164 f && i.push(f);
8165 }
8166 } else if (ee(e)) {
8167 var h = this.parse(e, r, !0);
8168 h && i.push(h);
8169 } else if (S(e)) {
8170 var v = e;
8171 a = r;
8172 for (var d = Object.keys(v), c = 0; c < d.length; c++) {
8173 var y = d[c], p = v[y];
8174 if (p === void 0 && (p = v[yt(y)]), p !== void 0) {
8175 var g = this.parse(y, p, !0);
8176 g && i.push(g);
8177 }
8178 }
8179 } else
8180 return !1;
8181 if (i.length === 0)
8182 return !1;
8183 for (var m = !1, b = 0; b < t.length; b++) {
8184 for (var E = t[b], M = {}, L = void 0, w = 0; w < i.length; w++) {
8185 var k = i[w];
8186 if (a) {
8187 var D = E.pstyle(k.name);
8188 L = M[k.name] = {
8189 prev: D
8190 };
8191 }
8192 m = this.applyParsedProperty(E, lr(k)) || m, a && (L.next = E.pstyle(k.name));
8193 }
8194 m && this.updateStyleHints(E), a && this.updateTransitions(E, M, s);
8195 }
8196 return m;
8197 }, qa.overrideBypass = function(t, e, r) {
8198 e = tt(e);
8199 for (var a = 0; a < t.length; a++) {
8200 var n = t[a], i = n._private.style[e], s = this.properties[e].type, o = s.color, u = s.mutiple, l = i ? i.pfValue != null ? i.pfValue : i.value : null;
8201 !i || !i.bypass ? this.applyBypass(n, e, r) : (i.value = r, i.pfValue != null && (i.pfValue = r), o ? i.strValue = "rgb(" + r.join(",") + ")" : u ? i.strValue = r.join(" ") : i.strValue = "" + r, this.updateStyleHints(n)), this.checkTriggers(n, e, l, r);
8202 }
8203 }, qa.removeAllBypasses = function(t, e) {
8204 return this.removeBypasses(t, this.propertyNames, e);
8205 }, qa.removeBypasses = function(t, e, r) {
8206 for (var a = !0, n = 0; n < t.length; n++) {
8207 for (var i = t[n], s = {}, o = 0; o < e.length; o++) {
8208 var u = e[o], l = this.properties[u], f = i.pstyle(l.name);
8209 if (!(!f || !f.bypass)) {
8210 var h = "", v = this.parse(u, h, !0), d = s[l.name] = {
8211 prev: f
8212 };
8213 this.applyParsedProperty(i, v), d.next = i.pstyle(l.name);
8214 }
8215 }
8216 this.updateStyleHints(i), r && this.updateTransitions(i, s, a);
8217 }
8218 };
8219 var Ri = {};
8220 Ri.getEmSizeInPixels = function() {
8221 var t = this.containerCss("font-size");
8222 return t != null ? parseFloat(t) : 1;
8223 }, Ri.containerCss = function(t) {
8224 var e = this._private.cy, r = e.container(), a = e.window();
8225 if (a && r && a.getComputedStyle)
8226 return a.getComputedStyle(r).getPropertyValue(t);
8227 };
8228 var fr = {};
8229 fr.getRenderedStyle = function(t, e) {
8230 return e ? this.getStylePropertyValue(t, e, !0) : this.getRawStyle(t, !0);
8231 }, fr.getRawStyle = function(t, e) {
8232 var r = this;
8233 if (t = t[0], t) {
8234 for (var a = {}, n = 0; n < r.properties.length; n++) {
8235 var i = r.properties[n], s = r.getStylePropertyValue(t, i.name, e);
8236 s != null && (a[i.name] = s, a[yt(i.name)] = s);
8237 }
8238 return a;
8239 }
8240 }, fr.getIndexedStyle = function(t, e, r, a) {
8241 var n = t.pstyle(e)[r][a];
8242 return n ?? t.cy().style().getDefaultProperty(e)[r][0];
8243 }, fr.getStylePropertyValue = function(t, e, r) {
8244 var a = this;
8245 if (t = t[0], t) {
8246 var n = a.properties[e];
8247 n.alias && (n = n.pointsTo);
8248 var i = n.type, s = t.pstyle(n.name);
8249 if (s) {
8250 var o = s.value, u = s.units, l = s.strValue;
8251 if (r && i.number && o != null && R(o)) {
8252 var f = t.cy().zoom(), h = function(p) {
8253 return p * f;
8254 }, v = function(p, g) {
8255 return h(p) + g;
8256 }, d = te(o), c = d ? u.every(function(y) {
8257 return y != null;
8258 }) : u != null;
8259 return c ? d ? o.map(function(y, p) {
8260 return v(y, u[p]);
8261 }).join(" ") : v(o, u) : d ? o.map(function(y) {
8262 return ee(y) ? y : "" + h(y);
8263 }).join(" ") : "" + h(o);
8264 } else if (l != null)
8265 return l;
8266 }
8267 return null;
8268 }
8269 }, fr.getAnimationStartStyle = function(t, e) {
8270 for (var r = {}, a = 0; a < e.length; a++) {
8271 var n = e[a], i = n.name, s = t.pstyle(i);
8272 s !== void 0 && (S(s) ? s = this.parse(i, s.strValue) : s = this.parse(i, s)), s && (r[i] = s);
8273 }
8274 return r;
8275 }, fr.getPropsList = function(t) {
8276 var e = this, r = [], a = t, n = e.properties;
8277 if (a)
8278 for (var i = Object.keys(a), s = 0; s < i.length; s++) {
8279 var o = i[s], u = a[o], l = n[o] || n[tt(o)], f = this.parse(l.name, u);
8280 f && r.push(f);
8281 }
8282 return r;
8283 }, fr.getNonDefaultPropertiesHash = function(t, e, r) {
8284 var a = r.slice(), n, i, s, o, u, l;
8285 for (u = 0; u < e.length; u++)
8286 if (n = e[u], i = t.pstyle(n, !1), i != null)
8287 if (i.pfValue != null)
8288 a[0] = Na(o, a[0]), a[1] = Ia(o, a[1]);
8289 else
8290 for (s = i.strValue, l = 0; l < s.length; l++)
8291 o = s.charCodeAt(l), a[0] = Na(o, a[0]), a[1] = Ia(o, a[1]);
8292 return a;
8293 }, fr.getPropertiesHash = fr.getNonDefaultPropertiesHash;
8294 var Un = {};
8295 Un.appendFromJson = function(t) {
8296 for (var e = this, r = 0; r < t.length; r++) {
8297 var a = t[r], n = a.selector, i = a.style || a.css, s = Object.keys(i);
8298 e.selector(n);
8299 for (var o = 0; o < s.length; o++) {
8300 var u = s[o], l = i[u];
8301 e.css(u, l);
8302 }
8303 }
8304 return e;
8305 }, Un.fromJson = function(t) {
8306 var e = this;
8307 return e.resetToDefault(), e.appendFromJson(t), e;
8308 }, Un.json = function() {
8309 for (var t = [], e = this.defaultLength; e < this.length; e++) {
8310 for (var r = this[e], a = r.selector, n = r.properties, i = {}, s = 0; s < n.length; s++) {
8311 var o = n[s];
8312 i[o.name] = o.strValue;
8313 }
8314 t.push({
8315 selector: a ? a.toString() : "core",
8316 style: i
8317 });
8318 }
8319 return t;
8320 };
8321 var ki = {};
8322 ki.appendFromString = function(t) {
8323 var e = this, r = this, a = "" + t, n, i, s;
8324 a = a.replace(/[/][*](\s|.)+?[*][/]/g, "");
8325 function o() {
8326 a.length > n.length ? a = a.substr(n.length) : a = "";
8327 }
8328 function u() {
8329 i.length > s.length ? i = i.substr(s.length) : i = "";
8330 }
8331 for (; ; ) {
8332 var l = a.match(/^\s*$/);
8333 if (l)
8334 break;
8335 var f = a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);
8336 if (!f) {
8337 vt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + a);
8338 break;
8339 }
8340 n = f[0];
8341 var h = f[1];
8342 if (h !== "core") {
8343 var v = new Sr(h);
8344 if (v.invalid) {
8345 vt("Skipping parsing of block: Invalid selector found in string stylesheet: " + h), o();
8346 continue;
8347 }
8348 }
8349 var d = f[2], c = !1;
8350 i = d;
8351 for (var y = []; ; ) {
8352 var p = i.match(/^\s*$/);
8353 if (p)
8354 break;
8355 var g = i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);
8356 if (!g) {
8357 vt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + d), c = !0;
8358 break;
8359 }
8360 s = g[0];
8361 var m = g[1], b = g[2], E = e.properties[m];
8362 if (!E) {
8363 vt("Skipping property: Invalid property name in: " + s), u();
8364 continue;
8365 }
8366 var M = r.parse(m, b);
8367 if (!M) {
8368 vt("Skipping property: Invalid property definition in: " + s), u();
8369 continue;
8370 }
8371 y.push({
8372 name: m,
8373 val: b
8374 }), u();
8375 }
8376 if (c) {
8377 o();
8378 break;
8379 }
8380 r.selector(h);
8381 for (var L = 0; L < y.length; L++) {
8382 var w = y[L];
8383 r.css(w.name, w.val);
8384 }
8385 o();
8386 }
8387 return r;
8388 }, ki.fromString = function(t) {
8389 var e = this;
8390 return e.resetToDefault(), e.appendFromString(t), e;
8391 };
8392 var It = {};
8393 (function() {
8394 var t = gt, e = qt, r = Kr, a = Da, n = jt, i = function(Le) {
8395 return "^" + Le + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$";
8396 }, s = function(Le) {
8397 var Se = t + "|\\w+|" + e + "|" + r + "|" + a + "|" + n;
8398 return "^" + Le + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + t + ")\\s*\\,\\s*(" + t + ")\\s*,\\s*(" + Se + ")\\s*\\,\\s*(" + Se + ")\\)$";
8399 }, o = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"];
8400 It.types = {
8401 time: {
8402 number: !0,
8403 min: 0,
8404 units: "s|ms",
8405 implicitUnits: "ms"
8406 },
8407 percent: {
8408 number: !0,
8409 min: 0,
8410 max: 100,
8411 units: "%",
8412 implicitUnits: "%"
8413 },
8414 percentages: {
8415 number: !0,
8416 min: 0,
8417 max: 100,
8418 units: "%",
8419 implicitUnits: "%",
8420 multiple: !0
8421 },
8422 zeroOneNumber: {
8423 number: !0,
8424 min: 0,
8425 max: 1,
8426 unitless: !0
8427 },
8428 zeroOneNumbers: {
8429 number: !0,
8430 min: 0,
8431 max: 1,
8432 unitless: !0,
8433 multiple: !0
8434 },
8435 nOneOneNumber: {
8436 number: !0,
8437 min: -1,
8438 max: 1,
8439 unitless: !0
8440 },
8441 nonNegativeInt: {
8442 number: !0,
8443 min: 0,
8444 integer: !0,
8445 unitless: !0
8446 },
8447 nonNegativeNumber: {
8448 number: !0,
8449 min: 0,
8450 unitless: !0
8451 },
8452 position: {
8453 enums: ["parent", "origin"]
8454 },
8455 nodeSize: {
8456 number: !0,
8457 min: 0,
8458 enums: ["label"]
8459 },
8460 number: {
8461 number: !0,
8462 unitless: !0
8463 },
8464 numbers: {
8465 number: !0,
8466 unitless: !0,
8467 multiple: !0
8468 },
8469 positiveNumber: {
8470 number: !0,
8471 unitless: !0,
8472 min: 0,
8473 strictMin: !0
8474 },
8475 size: {
8476 number: !0,
8477 min: 0
8478 },
8479 bidirectionalSize: {
8480 number: !0
8481 },
8482 // allows negative
8483 bidirectionalSizeMaybePercent: {
8484 number: !0,
8485 allowPercent: !0
8486 },
8487 // allows negative
8488 bidirectionalSizes: {
8489 number: !0,
8490 multiple: !0
8491 },
8492 // allows negative
8493 sizeMaybePercent: {
8494 number: !0,
8495 min: 0,
8496 allowPercent: !0
8497 },
8498 axisDirection: {
8499 enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"]
8500 },
8501 paddingRelativeTo: {
8502 enums: ["width", "height", "average", "min", "max"]
8503 },
8504 bgWH: {
8505 number: !0,
8506 min: 0,
8507 allowPercent: !0,
8508 enums: ["auto"],
8509 multiple: !0
8510 },
8511 bgPos: {
8512 number: !0,
8513 allowPercent: !0,
8514 multiple: !0
8515 },
8516 bgRelativeTo: {
8517 enums: ["inner", "include-padding"],
8518 multiple: !0
8519 },
8520 bgRepeat: {
8521 enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"],
8522 multiple: !0
8523 },
8524 bgFit: {
8525 enums: ["none", "contain", "cover"],
8526 multiple: !0
8527 },
8528 bgCrossOrigin: {
8529 enums: ["anonymous", "use-credentials", "null"],
8530 multiple: !0
8531 },
8532 bgClip: {
8533 enums: ["none", "node"],
8534 multiple: !0
8535 },
8536 bgContainment: {
8537 enums: ["inside", "over"],
8538 multiple: !0
8539 },
8540 color: {
8541 color: !0
8542 },
8543 colors: {
8544 color: !0,
8545 multiple: !0
8546 },
8547 fill: {
8548 enums: ["solid", "linear-gradient", "radial-gradient"]
8549 },
8550 bool: {
8551 enums: ["yes", "no"]
8552 },
8553 bools: {
8554 enums: ["yes", "no"],
8555 multiple: !0
8556 },
8557 lineStyle: {
8558 enums: ["solid", "dotted", "dashed"]
8559 },
8560 lineCap: {
8561 enums: ["butt", "round", "square"]
8562 },
8563 borderStyle: {
8564 enums: ["solid", "dotted", "dashed", "double"]
8565 },
8566 curveStyle: {
8567 enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi"]
8568 },
8569 fontFamily: {
8570 regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'
8571 },
8572 fontStyle: {
8573 enums: ["italic", "normal", "oblique"]
8574 },
8575 fontWeight: {
8576 enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900]
8577 },
8578 textDecoration: {
8579 enums: ["none", "underline", "overline", "line-through"]
8580 },
8581 textTransform: {
8582 enums: ["none", "uppercase", "lowercase"]
8583 },
8584 textWrap: {
8585 enums: ["none", "wrap", "ellipsis"]
8586 },
8587 textOverflowWrap: {
8588 enums: ["whitespace", "anywhere"]
8589 },
8590 textBackgroundShape: {
8591 enums: ["rectangle", "roundrectangle", "round-rectangle"]
8592 },
8593 nodeShape: {
8594 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", "right-rhomboid", "polygon"]
8595 },
8596 overlayShape: {
8597 enums: ["roundrectangle", "round-rectangle", "ellipse"]
8598 },
8599 compoundIncludeLabels: {
8600 enums: ["include", "exclude"]
8601 },
8602 arrowShape: {
8603 enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"]
8604 },
8605 arrowFill: {
8606 enums: ["filled", "hollow"]
8607 },
8608 arrowWidth: {
8609 number: !0,
8610 units: "%|px|em",
8611 implicitUnits: "px",
8612 enums: ["match-line"]
8613 },
8614 display: {
8615 enums: ["element", "none"]
8616 },
8617 visibility: {
8618 enums: ["hidden", "visible"]
8619 },
8620 zCompoundDepth: {
8621 enums: ["bottom", "orphan", "auto", "top"]
8622 },
8623 zIndexCompare: {
8624 enums: ["auto", "manual"]
8625 },
8626 valign: {
8627 enums: ["top", "center", "bottom"]
8628 },
8629 halign: {
8630 enums: ["left", "center", "right"]
8631 },
8632 justification: {
8633 enums: ["left", "center", "right", "auto"]
8634 },
8635 text: {
8636 string: !0
8637 },
8638 data: {
8639 mapping: !0,
8640 regex: i("data")
8641 },
8642 layoutData: {
8643 mapping: !0,
8644 regex: i("layoutData")
8645 },
8646 scratch: {
8647 mapping: !0,
8648 regex: i("scratch")
8649 },
8650 mapData: {
8651 mapping: !0,
8652 regex: s("mapData")
8653 },
8654 mapLayoutData: {
8655 mapping: !0,
8656 regex: s("mapLayoutData")
8657 },
8658 mapScratch: {
8659 mapping: !0,
8660 regex: s("mapScratch")
8661 },
8662 fn: {
8663 mapping: !0,
8664 fn: !0
8665 },
8666 url: {
8667 regexes: o,
8668 singleRegexMatchValue: !0
8669 },
8670 urls: {
8671 regexes: o,
8672 singleRegexMatchValue: !0,
8673 multiple: !0
8674 },
8675 propList: {
8676 propList: !0
8677 },
8678 angle: {
8679 number: !0,
8680 units: "deg|rad",
8681 implicitUnits: "rad"
8682 },
8683 textRotation: {
8684 number: !0,
8685 units: "deg|rad",
8686 implicitUnits: "rad",
8687 enums: ["none", "autorotate"]
8688 },
8689 polygonPointList: {
8690 number: !0,
8691 multiple: !0,
8692 evenMultiple: !0,
8693 min: -1,
8694 max: 1,
8695 unitless: !0
8696 },
8697 edgeDistances: {
8698 enums: ["intersection", "node-position", "endpoints"]
8699 },
8700 edgeEndpoint: {
8701 number: !0,
8702 multiple: !0,
8703 units: "%|px|em|deg|rad",
8704 implicitUnits: "px",
8705 enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"],
8706 singleEnum: !0,
8707 validate: function(Le, Se) {
8708 switch (Le.length) {
8709 case 2:
8710 return Se[0] !== "deg" && Se[0] !== "rad" && Se[1] !== "deg" && Se[1] !== "rad";
8711 case 1:
8712 return ee(Le[0]) || Se[0] === "deg" || Se[0] === "rad";
8713 default:
8714 return !1;
8715 }
8716 }
8717 },
8718 easing: {
8719 regexes: ["^(spring)\\s*\\(\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*,\\s*(" + t + ")\\s*\\)$"],
8720 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"]
8721 },
8722 gradientDirection: {
8723 enums: [
8724 "to-bottom",
8725 "to-top",
8726 "to-left",
8727 "to-right",
8728 "to-bottom-right",
8729 "to-bottom-left",
8730 "to-top-right",
8731 "to-top-left",
8732 "to-right-bottom",
8733 "to-left-bottom",
8734 "to-right-top",
8735 "to-left-top"
8736 // different order
8737 ]
8738 },
8739 boundsExpansion: {
8740 number: !0,
8741 multiple: !0,
8742 min: 0,
8743 validate: function(Le) {
8744 var Se = Le.length;
8745 return Se === 1 || Se === 2 || Se === 4;
8746 }
8747 }
8748 };
8749 var u = {
8750 zeroNonZero: function(Le, Se) {
8751 return (Le == null || Se == null) && Le !== Se || Le == 0 && Se != 0 ? !0 : Le != 0 && Se == 0;
8752 },
8753 any: function(Le, Se) {
8754 return Le != Se;
8755 },
8756 emptyNonEmpty: function(Le, Se) {
8757 var Oe = Re(Le), Fe = Re(Se);
8758 return Oe && !Fe || !Oe && Fe;
8759 }
8760 }, l = It.types, f = [{
8761 name: "label",
8762 type: l.text,
8763 triggersBounds: u.any,
8764 triggersZOrder: u.emptyNonEmpty
8765 }, {
8766 name: "text-rotation",
8767 type: l.textRotation,
8768 triggersBounds: u.any
8769 }, {
8770 name: "text-margin-x",
8771 type: l.bidirectionalSize,
8772 triggersBounds: u.any
8773 }, {
8774 name: "text-margin-y",
8775 type: l.bidirectionalSize,
8776 triggersBounds: u.any
8777 }], h = [{
8778 name: "source-label",
8779 type: l.text,
8780 triggersBounds: u.any
8781 }, {
8782 name: "source-text-rotation",
8783 type: l.textRotation,
8784 triggersBounds: u.any
8785 }, {
8786 name: "source-text-margin-x",
8787 type: l.bidirectionalSize,
8788 triggersBounds: u.any
8789 }, {
8790 name: "source-text-margin-y",
8791 type: l.bidirectionalSize,
8792 triggersBounds: u.any
8793 }, {
8794 name: "source-text-offset",
8795 type: l.size,
8796 triggersBounds: u.any
8797 }], v = [{
8798 name: "target-label",
8799 type: l.text,
8800 triggersBounds: u.any
8801 }, {
8802 name: "target-text-rotation",
8803 type: l.textRotation,
8804 triggersBounds: u.any
8805 }, {
8806 name: "target-text-margin-x",
8807 type: l.bidirectionalSize,
8808 triggersBounds: u.any
8809 }, {
8810 name: "target-text-margin-y",
8811 type: l.bidirectionalSize,
8812 triggersBounds: u.any
8813 }, {
8814 name: "target-text-offset",
8815 type: l.size,
8816 triggersBounds: u.any
8817 }], d = [{
8818 name: "font-family",
8819 type: l.fontFamily,
8820 triggersBounds: u.any
8821 }, {
8822 name: "font-style",
8823 type: l.fontStyle,
8824 triggersBounds: u.any
8825 }, {
8826 name: "font-weight",
8827 type: l.fontWeight,
8828 triggersBounds: u.any
8829 }, {
8830 name: "font-size",
8831 type: l.size,
8832 triggersBounds: u.any
8833 }, {
8834 name: "text-transform",
8835 type: l.textTransform,
8836 triggersBounds: u.any
8837 }, {
8838 name: "text-wrap",
8839 type: l.textWrap,
8840 triggersBounds: u.any
8841 }, {
8842 name: "text-overflow-wrap",
8843 type: l.textOverflowWrap,
8844 triggersBounds: u.any
8845 }, {
8846 name: "text-max-width",
8847 type: l.size,
8848 triggersBounds: u.any
8849 }, {
8850 name: "text-outline-width",
8851 type: l.size,
8852 triggersBounds: u.any
8853 }, {
8854 name: "line-height",
8855 type: l.positiveNumber,
8856 triggersBounds: u.any
8857 }], c = [{
8858 name: "text-valign",
8859 type: l.valign,
8860 triggersBounds: u.any
8861 }, {
8862 name: "text-halign",
8863 type: l.halign,
8864 triggersBounds: u.any
8865 }, {
8866 name: "color",
8867 type: l.color
8868 }, {
8869 name: "text-outline-color",
8870 type: l.color
8871 }, {
8872 name: "text-outline-opacity",
8873 type: l.zeroOneNumber
8874 }, {
8875 name: "text-background-color",
8876 type: l.color
8877 }, {
8878 name: "text-background-opacity",
8879 type: l.zeroOneNumber
8880 }, {
8881 name: "text-background-padding",
8882 type: l.size,
8883 triggersBounds: u.any
8884 }, {
8885 name: "text-border-opacity",
8886 type: l.zeroOneNumber
8887 }, {
8888 name: "text-border-color",
8889 type: l.color
8890 }, {
8891 name: "text-border-width",
8892 type: l.size,
8893 triggersBounds: u.any
8894 }, {
8895 name: "text-border-style",
8896 type: l.borderStyle,
8897 triggersBounds: u.any
8898 }, {
8899 name: "text-background-shape",
8900 type: l.textBackgroundShape,
8901 triggersBounds: u.any
8902 }, {
8903 name: "text-justification",
8904 type: l.justification
8905 }], y = [{
8906 name: "events",
8907 type: l.bool,
8908 triggersZOrder: u.any
8909 }, {
8910 name: "text-events",
8911 type: l.bool,
8912 triggersZOrder: u.any
8913 }], p = [{
8914 name: "display",
8915 type: l.display,
8916 triggersZOrder: u.any,
8917 triggersBounds: u.any,
8918 triggersBoundsOfConnectedEdges: !0
8919 }, {
8920 name: "visibility",
8921 type: l.visibility,
8922 triggersZOrder: u.any
8923 }, {
8924 name: "opacity",
8925 type: l.zeroOneNumber,
8926 triggersZOrder: u.zeroNonZero
8927 }, {
8928 name: "text-opacity",
8929 type: l.zeroOneNumber
8930 }, {
8931 name: "min-zoomed-font-size",
8932 type: l.size
8933 }, {
8934 name: "z-compound-depth",
8935 type: l.zCompoundDepth,
8936 triggersZOrder: u.any
8937 }, {
8938 name: "z-index-compare",
8939 type: l.zIndexCompare,
8940 triggersZOrder: u.any
8941 }, {
8942 name: "z-index",
8943 type: l.number,
8944 triggersZOrder: u.any
8945 }], g = [{
8946 name: "overlay-padding",
8947 type: l.size,
8948 triggersBounds: u.any
8949 }, {
8950 name: "overlay-color",
8951 type: l.color
8952 }, {
8953 name: "overlay-opacity",
8954 type: l.zeroOneNumber,
8955 triggersBounds: u.zeroNonZero
8956 }, {
8957 name: "overlay-shape",
8958 type: l.overlayShape,
8959 triggersBounds: u.any
8960 }], m = [{
8961 name: "underlay-padding",
8962 type: l.size,
8963 triggersBounds: u.any
8964 }, {
8965 name: "underlay-color",
8966 type: l.color
8967 }, {
8968 name: "underlay-opacity",
8969 type: l.zeroOneNumber,
8970 triggersBounds: u.zeroNonZero
8971 }, {
8972 name: "underlay-shape",
8973 type: l.overlayShape,
8974 triggersBounds: u.any
8975 }], b = [{
8976 name: "transition-property",
8977 type: l.propList
8978 }, {
8979 name: "transition-duration",
8980 type: l.time
8981 }, {
8982 name: "transition-delay",
8983 type: l.time
8984 }, {
8985 name: "transition-timing-function",
8986 type: l.easing
8987 }], E = function(Le, Se) {
8988 return Se.value === "label" ? -Le.poolIndex() : Se.pfValue;
8989 }, M = [{
8990 name: "height",
8991 type: l.nodeSize,
8992 triggersBounds: u.any,
8993 hashOverride: E
8994 }, {
8995 name: "width",
8996 type: l.nodeSize,
8997 triggersBounds: u.any,
8998 hashOverride: E
8999 }, {
9000 name: "shape",
9001 type: l.nodeShape,
9002 triggersBounds: u.any
9003 }, {
9004 name: "shape-polygon-points",
9005 type: l.polygonPointList,
9006 triggersBounds: u.any
9007 }, {
9008 name: "background-color",
9009 type: l.color
9010 }, {
9011 name: "background-fill",
9012 type: l.fill
9013 }, {
9014 name: "background-opacity",
9015 type: l.zeroOneNumber
9016 }, {
9017 name: "background-blacken",
9018 type: l.nOneOneNumber
9019 }, {
9020 name: "background-gradient-stop-colors",
9021 type: l.colors
9022 }, {
9023 name: "background-gradient-stop-positions",
9024 type: l.percentages
9025 }, {
9026 name: "background-gradient-direction",
9027 type: l.gradientDirection
9028 }, {
9029 name: "padding",
9030 type: l.sizeMaybePercent,
9031 triggersBounds: u.any
9032 }, {
9033 name: "padding-relative-to",
9034 type: l.paddingRelativeTo,
9035 triggersBounds: u.any
9036 }, {
9037 name: "bounds-expansion",
9038 type: l.boundsExpansion,
9039 triggersBounds: u.any
9040 }], L = [{
9041 name: "border-color",
9042 type: l.color
9043 }, {
9044 name: "border-opacity",
9045 type: l.zeroOneNumber
9046 }, {
9047 name: "border-width",
9048 type: l.size,
9049 triggersBounds: u.any
9050 }, {
9051 name: "border-style",
9052 type: l.borderStyle
9053 }], w = [{
9054 name: "outline-color",
9055 type: l.color
9056 }, {
9057 name: "outline-opacity",
9058 type: l.zeroOneNumber
9059 }, {
9060 name: "outline-width",
9061 type: l.size,
9062 triggersBounds: u.any
9063 }, {
9064 name: "outline-style",
9065 type: l.borderStyle
9066 }, {
9067 name: "outline-offset",
9068 type: l.size,
9069 triggersBounds: u.any
9070 }], k = [{
9071 name: "background-image",
9072 type: l.urls
9073 }, {
9074 name: "background-image-crossorigin",
9075 type: l.bgCrossOrigin
9076 }, {
9077 name: "background-image-opacity",
9078 type: l.zeroOneNumbers
9079 }, {
9080 name: "background-image-containment",
9081 type: l.bgContainment
9082 }, {
9083 name: "background-image-smoothing",
9084 type: l.bools
9085 }, {
9086 name: "background-position-x",
9087 type: l.bgPos
9088 }, {
9089 name: "background-position-y",
9090 type: l.bgPos
9091 }, {
9092 name: "background-width-relative-to",
9093 type: l.bgRelativeTo
9094 }, {
9095 name: "background-height-relative-to",
9096 type: l.bgRelativeTo
9097 }, {
9098 name: "background-repeat",
9099 type: l.bgRepeat
9100 }, {
9101 name: "background-fit",
9102 type: l.bgFit
9103 }, {
9104 name: "background-clip",
9105 type: l.bgClip
9106 }, {
9107 name: "background-width",
9108 type: l.bgWH
9109 }, {
9110 name: "background-height",
9111 type: l.bgWH
9112 }, {
9113 name: "background-offset-x",
9114 type: l.bgPos
9115 }, {
9116 name: "background-offset-y",
9117 type: l.bgPos
9118 }], D = [{
9119 name: "position",
9120 type: l.position,
9121 triggersBounds: u.any
9122 }, {
9123 name: "compound-sizing-wrt-labels",
9124 type: l.compoundIncludeLabels,
9125 triggersBounds: u.any
9126 }, {
9127 name: "min-width",
9128 type: l.size,
9129 triggersBounds: u.any
9130 }, {
9131 name: "min-width-bias-left",
9132 type: l.sizeMaybePercent,
9133 triggersBounds: u.any
9134 }, {
9135 name: "min-width-bias-right",
9136 type: l.sizeMaybePercent,
9137 triggersBounds: u.any
9138 }, {
9139 name: "min-height",
9140 type: l.size,
9141 triggersBounds: u.any
9142 }, {
9143 name: "min-height-bias-top",
9144 type: l.sizeMaybePercent,
9145 triggersBounds: u.any
9146 }, {
9147 name: "min-height-bias-bottom",
9148 type: l.sizeMaybePercent,
9149 triggersBounds: u.any
9150 }], F = [{
9151 name: "line-style",
9152 type: l.lineStyle
9153 }, {
9154 name: "line-color",
9155 type: l.color
9156 }, {
9157 name: "line-fill",
9158 type: l.fill
9159 }, {
9160 name: "line-cap",
9161 type: l.lineCap
9162 }, {
9163 name: "line-opacity",
9164 type: l.zeroOneNumber
9165 }, {
9166 name: "line-dash-pattern",
9167 type: l.numbers
9168 }, {
9169 name: "line-dash-offset",
9170 type: l.number
9171 }, {
9172 name: "line-gradient-stop-colors",
9173 type: l.colors
9174 }, {
9175 name: "line-gradient-stop-positions",
9176 type: l.percentages
9177 }, {
9178 name: "curve-style",
9179 type: l.curveStyle,
9180 triggersBounds: u.any,
9181 triggersBoundsOfParallelBeziers: !0
9182 }, {
9183 name: "haystack-radius",
9184 type: l.zeroOneNumber,
9185 triggersBounds: u.any
9186 }, {
9187 name: "source-endpoint",
9188 type: l.edgeEndpoint,
9189 triggersBounds: u.any
9190 }, {
9191 name: "target-endpoint",
9192 type: l.edgeEndpoint,
9193 triggersBounds: u.any
9194 }, {
9195 name: "control-point-step-size",
9196 type: l.size,
9197 triggersBounds: u.any
9198 }, {
9199 name: "control-point-distances",
9200 type: l.bidirectionalSizes,
9201 triggersBounds: u.any
9202 }, {
9203 name: "control-point-weights",
9204 type: l.numbers,
9205 triggersBounds: u.any
9206 }, {
9207 name: "segment-distances",
9208 type: l.bidirectionalSizes,
9209 triggersBounds: u.any
9210 }, {
9211 name: "segment-weights",
9212 type: l.numbers,
9213 triggersBounds: u.any
9214 }, {
9215 name: "taxi-turn",
9216 type: l.bidirectionalSizeMaybePercent,
9217 triggersBounds: u.any
9218 }, {
9219 name: "taxi-turn-min-distance",
9220 type: l.size,
9221 triggersBounds: u.any
9222 }, {
9223 name: "taxi-direction",
9224 type: l.axisDirection,
9225 triggersBounds: u.any
9226 }, {
9227 name: "edge-distances",
9228 type: l.edgeDistances,
9229 triggersBounds: u.any
9230 }, {
9231 name: "arrow-scale",
9232 type: l.positiveNumber,
9233 triggersBounds: u.any
9234 }, {
9235 name: "loop-direction",
9236 type: l.angle,
9237 triggersBounds: u.any
9238 }, {
9239 name: "loop-sweep",
9240 type: l.angle,
9241 triggersBounds: u.any
9242 }, {
9243 name: "source-distance-from-node",
9244 type: l.size,
9245 triggersBounds: u.any
9246 }, {
9247 name: "target-distance-from-node",
9248 type: l.size,
9249 triggersBounds: u.any
9250 }], G = [{
9251 name: "ghost",
9252 type: l.bool,
9253 triggersBounds: u.any
9254 }, {
9255 name: "ghost-offset-x",
9256 type: l.bidirectionalSize,
9257 triggersBounds: u.any
9258 }, {
9259 name: "ghost-offset-y",
9260 type: l.bidirectionalSize,
9261 triggersBounds: u.any
9262 }, {
9263 name: "ghost-opacity",
9264 type: l.zeroOneNumber
9265 }], N = [{
9266 name: "selection-box-color",
9267 type: l.color
9268 }, {
9269 name: "selection-box-opacity",
9270 type: l.zeroOneNumber
9271 }, {
9272 name: "selection-box-border-color",
9273 type: l.color
9274 }, {
9275 name: "selection-box-border-width",
9276 type: l.size
9277 }, {
9278 name: "active-bg-color",
9279 type: l.color
9280 }, {
9281 name: "active-bg-opacity",
9282 type: l.zeroOneNumber
9283 }, {
9284 name: "active-bg-size",
9285 type: l.size
9286 }, {
9287 name: "outside-texture-bg-color",
9288 type: l.color
9289 }, {
9290 name: "outside-texture-bg-opacity",
9291 type: l.zeroOneNumber
9292 }], X = [];
9293 It.pieBackgroundN = 16, X.push({
9294 name: "pie-size",
9295 type: l.sizeMaybePercent
9296 });
9297 for (var B = 1; B <= It.pieBackgroundN; B++)
9298 X.push({
9299 name: "pie-" + B + "-background-color",
9300 type: l.color
9301 }), X.push({
9302 name: "pie-" + B + "-background-size",
9303 type: l.percent
9304 }), X.push({
9305 name: "pie-" + B + "-background-opacity",
9306 type: l.zeroOneNumber
9307 });
9308 var re = [], K = It.arrowPrefixes = ["source", "mid-source", "target", "mid-target"];
9309 [{
9310 name: "arrow-shape",
9311 type: l.arrowShape,
9312 triggersBounds: u.any
9313 }, {
9314 name: "arrow-color",
9315 type: l.color
9316 }, {
9317 name: "arrow-fill",
9318 type: l.arrowFill
9319 }, {
9320 name: "arrow-width",
9321 type: l.arrowWidth
9322 }].forEach(function(xe) {
9323 K.forEach(function(Le) {
9324 var Se = Le + "-" + xe.name, Oe = xe.type, Fe = xe.triggersBounds;
9325 re.push({
9326 name: Se,
9327 type: Oe,
9328 triggersBounds: Fe
9329 });
9330 });
9331 }, {});
9332 var W = It.properties = [].concat(y, b, p, g, m, G, c, d, f, h, v, M, L, w, k, X, D, F, re, N), ae = It.propertyGroups = {
9333 // common to all eles
9334 behavior: y,
9335 transition: b,
9336 visibility: p,
9337 overlay: g,
9338 underlay: m,
9339 ghost: G,
9340 // labels
9341 commonLabel: c,
9342 labelDimensions: d,
9343 mainLabel: f,
9344 sourceLabel: h,
9345 targetLabel: v,
9346 // node props
9347 nodeBody: M,
9348 nodeBorder: L,
9349 nodeOutline: w,
9350 backgroundImage: k,
9351 pie: X,
9352 compound: D,
9353 // edge props
9354 edgeLine: F,
9355 edgeArrow: re,
9356 core: N
9357 }, ue = It.propertyGroupNames = {}, me = It.propertyGroupKeys = Object.keys(ae);
9358 me.forEach(function(xe) {
9359 ue[xe] = ae[xe].map(function(Le) {
9360 return Le.name;
9361 }), ae[xe].forEach(function(Le) {
9362 return Le.groupKey = xe;
9363 });
9364 });
9365 var ie = It.aliases = [{
9366 name: "content",
9367 pointsTo: "label"
9368 }, {
9369 name: "control-point-distance",
9370 pointsTo: "control-point-distances"
9371 }, {
9372 name: "control-point-weight",
9373 pointsTo: "control-point-weights"
9374 }, {
9375 name: "edge-text-rotation",
9376 pointsTo: "text-rotation"
9377 }, {
9378 name: "padding-left",
9379 pointsTo: "padding"
9380 }, {
9381 name: "padding-right",
9382 pointsTo: "padding"
9383 }, {
9384 name: "padding-top",
9385 pointsTo: "padding"
9386 }, {
9387 name: "padding-bottom",
9388 pointsTo: "padding"
9389 }];
9390 It.propertyNames = W.map(function(xe) {
9391 return xe.name;
9392 });
9393 for (var ge = 0; ge < W.length; ge++) {
9394 var Ee = W[ge];
9395 W[Ee.name] = Ee;
9396 }
9397 for (var Ce = 0; Ce < ie.length; Ce++) {
9398 var we = ie[Ce], De = W[we.pointsTo], se = {
9399 name: we.name,
9400 alias: !0,
9401 pointsTo: De
9402 };
9403 W.push(se), W[we.name] = se;
9404 }
9405 })(), It.getDefaultProperty = function(t) {
9406 return this.getDefaultProperties()[t];
9407 }, It.getDefaultProperties = function() {
9408 var t = this._private;
9409 if (t.defaultProperties != null)
9410 return t.defaultProperties;
9411 for (var e = He({
9412 // core props
9413 "selection-box-color": "#ddd",
9414 "selection-box-opacity": 0.65,
9415 "selection-box-border-color": "#aaa",
9416 "selection-box-border-width": 1,
9417 "active-bg-color": "black",
9418 "active-bg-opacity": 0.15,
9419 "active-bg-size": 30,
9420 "outside-texture-bg-color": "#000",
9421 "outside-texture-bg-opacity": 0.125,
9422 // common node/edge props
9423 events: "yes",
9424 "text-events": "no",
9425 "text-valign": "top",
9426 "text-halign": "center",
9427 "text-justification": "auto",
9428 "line-height": 1,
9429 color: "#000",
9430 "text-outline-color": "#000",
9431 "text-outline-width": 0,
9432 "text-outline-opacity": 1,
9433 "text-opacity": 1,
9434 "text-decoration": "none",
9435 "text-transform": "none",
9436 "text-wrap": "none",
9437 "text-overflow-wrap": "whitespace",
9438 "text-max-width": 9999,
9439 "text-background-color": "#000",
9440 "text-background-opacity": 0,
9441 "text-background-shape": "rectangle",
9442 "text-background-padding": 0,
9443 "text-border-opacity": 0,
9444 "text-border-width": 0,
9445 "text-border-style": "solid",
9446 "text-border-color": "#000",
9447 "font-family": "Helvetica Neue, Helvetica, sans-serif",
9448 "font-style": "normal",
9449 "font-weight": "normal",
9450 "font-size": 16,
9451 "min-zoomed-font-size": 0,
9452 "text-rotation": "none",
9453 "source-text-rotation": "none",
9454 "target-text-rotation": "none",
9455 visibility: "visible",
9456 display: "element",
9457 opacity: 1,
9458 "z-compound-depth": "auto",
9459 "z-index-compare": "auto",
9460 "z-index": 0,
9461 label: "",
9462 "text-margin-x": 0,
9463 "text-margin-y": 0,
9464 "source-label": "",
9465 "source-text-offset": 0,
9466 "source-text-margin-x": 0,
9467 "source-text-margin-y": 0,
9468 "target-label": "",
9469 "target-text-offset": 0,
9470 "target-text-margin-x": 0,
9471 "target-text-margin-y": 0,
9472 "overlay-opacity": 0,
9473 "overlay-color": "#000",
9474 "overlay-padding": 10,
9475 "overlay-shape": "round-rectangle",
9476 "underlay-opacity": 0,
9477 "underlay-color": "#000",
9478 "underlay-padding": 10,
9479 "underlay-shape": "round-rectangle",
9480 "transition-property": "none",
9481 "transition-duration": 0,
9482 "transition-delay": 0,
9483 "transition-timing-function": "linear",
9484 // node props
9485 "background-blacken": 0,
9486 "background-color": "#999",
9487 "background-fill": "solid",
9488 "background-opacity": 1,
9489 "background-image": "none",
9490 "background-image-crossorigin": "anonymous",
9491 "background-image-opacity": 1,
9492 "background-image-containment": "inside",
9493 "background-image-smoothing": "yes",
9494 "background-position-x": "50%",
9495 "background-position-y": "50%",
9496 "background-offset-x": 0,
9497 "background-offset-y": 0,
9498 "background-width-relative-to": "include-padding",
9499 "background-height-relative-to": "include-padding",
9500 "background-repeat": "no-repeat",
9501 "background-fit": "none",
9502 "background-clip": "node",
9503 "background-width": "auto",
9504 "background-height": "auto",
9505 "border-color": "#000",
9506 "border-opacity": 1,
9507 "border-width": 0,
9508 "border-style": "solid",
9509 "outline-color": "#999",
9510 "outline-opacity": 1,
9511 "outline-width": 0,
9512 "outline-offset": 0,
9513 "outline-style": "solid",
9514 height: 30,
9515 width: 30,
9516 shape: "ellipse",
9517 "shape-polygon-points": "-1, -1, 1, -1, 1, 1, -1, 1",
9518 "bounds-expansion": 0,
9519 // node gradient
9520 "background-gradient-direction": "to-bottom",
9521 "background-gradient-stop-colors": "#999",
9522 "background-gradient-stop-positions": "0%",
9523 // ghost props
9524 ghost: "no",
9525 "ghost-offset-y": 0,
9526 "ghost-offset-x": 0,
9527 "ghost-opacity": 0,
9528 // compound props
9529 padding: 0,
9530 "padding-relative-to": "width",
9531 position: "origin",
9532 "compound-sizing-wrt-labels": "include",
9533 "min-width": 0,
9534 "min-width-bias-left": 0,
9535 "min-width-bias-right": 0,
9536 "min-height": 0,
9537 "min-height-bias-top": 0,
9538 "min-height-bias-bottom": 0
9539 }, {
9540 // node pie bg
9541 "pie-size": "100%"
9542 }, [{
9543 name: "pie-{{i}}-background-color",
9544 value: "black"
9545 }, {
9546 name: "pie-{{i}}-background-size",
9547 value: "0%"
9548 }, {
9549 name: "pie-{{i}}-background-opacity",
9550 value: 1
9551 }].reduce(function(u, l) {
9552 for (var f = 1; f <= It.pieBackgroundN; f++) {
9553 var h = l.name.replace("{{i}}", f), v = l.value;
9554 u[h] = v;
9555 }
9556 return u;
9557 }, {}), {
9558 // edge props
9559 "line-style": "solid",
9560 "line-color": "#999",
9561 "line-fill": "solid",
9562 "line-cap": "butt",
9563 "line-opacity": 1,
9564 "line-gradient-stop-colors": "#999",
9565 "line-gradient-stop-positions": "0%",
9566 "control-point-step-size": 40,
9567 "control-point-weights": 0.5,
9568 "segment-weights": 0.5,
9569 "segment-distances": 20,
9570 "taxi-turn": "50%",
9571 "taxi-turn-min-distance": 10,
9572 "taxi-direction": "auto",
9573 "edge-distances": "intersection",
9574 "curve-style": "haystack",
9575 "haystack-radius": 0,
9576 "arrow-scale": 1,
9577 "loop-direction": "-45deg",
9578 "loop-sweep": "-90deg",
9579 "source-distance-from-node": 0,
9580 "target-distance-from-node": 0,
9581 "source-endpoint": "outside-to-node",
9582 "target-endpoint": "outside-to-node",
9583 "line-dash-pattern": [6, 3],
9584 "line-dash-offset": 0
9585 }, [{
9586 name: "arrow-shape",
9587 value: "none"
9588 }, {
9589 name: "arrow-color",
9590 value: "#999"
9591 }, {
9592 name: "arrow-fill",
9593 value: "filled"
9594 }, {
9595 name: "arrow-width",
9596 value: 1
9597 }].reduce(function(u, l) {
9598 return It.arrowPrefixes.forEach(function(f) {
9599 var h = f + "-" + l.name, v = l.value;
9600 u[h] = v;
9601 }), u;
9602 }, {})), r = {}, a = 0; a < this.properties.length; a++) {
9603 var n = this.properties[a];
9604 if (!n.pointsTo) {
9605 var i = n.name, s = e[i], o = this.parse(i, s);
9606 r[i] = o;
9607 }
9608 }
9609 return t.defaultProperties = r, t.defaultProperties;
9610 }, It.addDefaultStylesheet = function() {
9611 this.selector(":parent").css({
9612 shape: "rectangle",
9613 padding: 10,
9614 "background-color": "#eee",
9615 "border-color": "#ccc",
9616 "border-width": 1
9617 }).selector("edge").css({
9618 width: 3
9619 }).selector(":loop").css({
9620 "curve-style": "bezier"
9621 }).selector("edge:compound").css({
9622 "curve-style": "bezier",
9623 "source-endpoint": "outside-to-line",
9624 "target-endpoint": "outside-to-line"
9625 }).selector(":selected").css({
9626 "background-color": "#0169D9",
9627 "line-color": "#0169D9",
9628 "source-arrow-color": "#0169D9",
9629 "target-arrow-color": "#0169D9",
9630 "mid-source-arrow-color": "#0169D9",
9631 "mid-target-arrow-color": "#0169D9"
9632 }).selector(":parent:selected").css({
9633 "background-color": "#CCE1F9",
9634 "border-color": "#aec8e5"
9635 }).selector(":active").css({
9636 "overlay-color": "black",
9637 "overlay-padding": 10,
9638 "overlay-opacity": 0.25
9639 }), this.defaultLength = this.length;
9640 };
9641 var $n = {};
9642 $n.parse = function(t, e, r, a) {
9643 var n = this;
9644 if (H(e))
9645 return n.parseImplWarn(t, e, r, a);
9646 var i = a === "mapping" || a === !0 || a === !1 || a == null ? "dontcare" : a, s = r ? "t" : "f", o = "" + e, u = hs(t, o, s, i), l = n.propCache = n.propCache || [], f;
9647 return (f = l[u]) || (f = l[u] = n.parseImplWarn(t, e, r, a)), (r || a === "mapping") && (f = lr(f), f && (f.value = lr(f.value))), f;
9648 }, $n.parseImplWarn = function(t, e, r, a) {
9649 var n = this.parseImpl(t, e, r, a);
9650 return !n && e != null && vt("The style property `".concat(t, ": ").concat(e, "` is invalid")), n && (n.name === "width" || n.name === "height") && e === "label" && vt("The style value of `label` is deprecated for `" + n.name + "`"), n;
9651 }, $n.parseImpl = function(t, e, r, a) {
9652 var n = this;
9653 t = tt(t);
9654 var i = n.properties[t], s = e, o = n.types;
9655 if (!i || e === void 0)
9656 return null;
9657 i.alias && (i = i.pointsTo, t = i.name);
9658 var u = ee(e);
9659 u && (e = e.trim());
9660 var l = i.type;
9661 if (!l)
9662 return null;
9663 if (r && (e === "" || e === null))
9664 return {
9665 name: t,
9666 value: e,
9667 bypass: !0,
9668 deleteBypass: !0
9669 };
9670 if (H(e))
9671 return {
9672 name: t,
9673 value: e,
9674 strValue: "fn",
9675 mapped: o.fn,
9676 bypass: r
9677 };
9678 var f, h;
9679 if (!(!u || a || e.length < 7 || e[1] !== "a")) {
9680 if (e.length >= 7 && e[0] === "d" && (f = new RegExp(o.data.regex).exec(e))) {
9681 if (r)
9682 return !1;
9683 var v = o.data;
9684 return {
9685 name: t,
9686 value: f,
9687 strValue: "" + e,
9688 mapped: v,
9689 field: f[1],
9690 bypass: r
9691 };
9692 } else if (e.length >= 10 && e[0] === "m" && (h = new RegExp(o.mapData.regex).exec(e))) {
9693 if (r || l.multiple)
9694 return !1;
9695 var d = o.mapData;
9696 if (!(l.color || l.number))
9697 return !1;
9698 var c = this.parse(t, h[4]);
9699 if (!c || c.mapped)
9700 return !1;
9701 var y = this.parse(t, h[5]);
9702 if (!y || y.mapped)
9703 return !1;
9704 if (c.pfValue === y.pfValue || c.strValue === y.strValue)
9705 return vt("`" + t + ": " + e + "` is not a valid mapper because the output range is zero; converting to `" + t + ": " + c.strValue + "`"), this.parse(t, c.strValue);
9706 if (l.color) {
9707 var p = c.value, g = y.value, m = p[0] === g[0] && p[1] === g[1] && p[2] === g[2] && // optional alpha
9708 (p[3] === g[3] || (p[3] == null || p[3] === 1) && (g[3] == null || g[3] === 1));
9709 if (m)
9710 return !1;
9711 }
9712 return {
9713 name: t,
9714 value: h,
9715 strValue: "" + e,
9716 mapped: d,
9717 field: h[1],
9718 fieldMin: parseFloat(h[2]),
9719 // min & max are numeric
9720 fieldMax: parseFloat(h[3]),
9721 valueMin: c.value,
9722 valueMax: y.value,
9723 bypass: r
9724 };
9725 }
9726 }
9727 if (l.multiple && a !== "multiple") {
9728 var b;
9729 if (u ? b = e.split(/\s+/) : te(e) ? b = e : b = [e], l.evenMultiple && b.length % 2 !== 0)
9730 return null;
9731 for (var E = [], M = [], L = [], w = "", k = !1, D = 0; D < b.length; D++) {
9732 var F = n.parse(t, b[D], r, "multiple");
9733 k = k || ee(F.value), E.push(F.value), L.push(F.pfValue != null ? F.pfValue : F.value), M.push(F.units), w += (D > 0 ? " " : "") + F.strValue;
9734 }
9735 return l.validate && !l.validate(E, M) ? null : l.singleEnum && k ? E.length === 1 && ee(E[0]) ? {
9736 name: t,
9737 value: E[0],
9738 strValue: E[0],
9739 bypass: r
9740 } : null : {
9741 name: t,
9742 value: E,
9743 pfValue: L,
9744 strValue: w,
9745 bypass: r,
9746 units: M
9747 };
9748 }
9749 var G = function() {
9750 for (var Le = 0; Le < l.enums.length; Le++) {
9751 var Se = l.enums[Le];
9752 if (Se === e)
9753 return {
9754 name: t,
9755 value: e,
9756 strValue: "" + e,
9757 bypass: r
9758 };
9759 }
9760 return null;
9761 };
9762 if (l.number) {
9763 var N, X = "px";
9764 if (l.units && (N = l.units), l.implicitUnits && (X = l.implicitUnits), !l.unitless)
9765 if (u) {
9766 var B = "px|em" + (l.allowPercent ? "|\\%" : "");
9767 N && (B = N);
9768 var re = e.match("^(" + gt + ")(" + B + ")?$");
9769 re && (e = re[1], N = re[2] || X);
9770 } else
9771 (!N || l.implicitUnits) && (N = X);
9772 if (e = parseFloat(e), isNaN(e) && l.enums === void 0)
9773 return null;
9774 if (isNaN(e) && l.enums !== void 0)
9775 return e = s, G();
9776 if (l.integer && !q(e) || l.min !== void 0 && (e < l.min || l.strictMin && e === l.min) || l.max !== void 0 && (e > l.max || l.strictMax && e === l.max))
9777 return null;
9778 var K = {
9779 name: t,
9780 value: e,
9781 strValue: "" + e + (N || ""),
9782 units: N,
9783 bypass: r
9784 };
9785 return l.unitless || N !== "px" && N !== "em" ? K.pfValue = e : K.pfValue = N === "px" || !N ? e : this.getEmSizeInPixels() * e, (N === "ms" || N === "s") && (K.pfValue = N === "ms" ? e : 1e3 * e), (N === "deg" || N === "rad") && (K.pfValue = N === "rad" ? e : mf(e)), N === "%" && (K.pfValue = e / 100), K;
9786 } else if (l.propList) {
9787 var W = [], ae = "" + e;
9788 if (ae !== "none") {
9789 for (var ue = ae.split(/\s*,\s*|\s+/), me = 0; me < ue.length; me++) {
9790 var ie = ue[me].trim();
9791 n.properties[ie] ? W.push(ie) : vt("`" + ie + "` is not a valid property name");
9792 }
9793 if (W.length === 0)
9794 return null;
9795 }
9796 return {
9797 name: t,
9798 value: W,
9799 strValue: W.length === 0 ? "none" : W.join(" "),
9800 bypass: r
9801 };
9802 } else if (l.color) {
9803 var ge = eu(e);
9804 return ge ? {
9805 name: t,
9806 value: ge,
9807 pfValue: ge,
9808 strValue: "rgb(" + ge[0] + "," + ge[1] + "," + ge[2] + ")",
9809 // n.b. no spaces b/c of multiple support
9810 bypass: r
9811 } : null;
9812 } else if (l.regex || l.regexes) {
9813 if (l.enums) {
9814 var Ee = G();
9815 if (Ee)
9816 return Ee;
9817 }
9818 for (var Ce = l.regexes ? l.regexes : [l.regex], we = 0; we < Ce.length; we++) {
9819 var De = new RegExp(Ce[we]), se = De.exec(e);
9820 if (se)
9821 return {
9822 name: t,
9823 value: l.singleRegexMatchValue ? se[1] : se,
9824 strValue: "" + e,
9825 bypass: r
9826 };
9827 }
9828 return null;
9829 } else
9830 return l.string ? {
9831 name: t,
9832 value: "" + e,
9833 strValue: "" + e,
9834 bypass: r
9835 } : l.enums ? G() : null;
9836 };
9837 var Gt = function t(e) {
9838 if (!(this instanceof t))
9839 return new t(e);
9840 if (!Ye(e)) {
9841 xt("A style must have a core reference");
9842 return;
9843 }
9844 this._private = {
9845 cy: e,
9846 coreStyle: {}
9847 }, this.length = 0, this.resetToDefault();
9848 }, zt = Gt.prototype;
9849 zt.instanceString = function() {
9850 return "style";
9851 }, zt.clear = function() {
9852 for (var t = this._private, e = t.cy, r = e.elements(), a = 0; a < this.length; a++)
9853 this[a] = void 0;
9854 return this.length = 0, t.contextStyles = {}, t.propDiffs = {}, this.cleanElements(r, !0), r.forEach(function(n) {
9855 var i = n[0]._private;
9856 i.styleDirty = !0, i.appliedInitStyle = !1;
9857 }), this;
9858 }, zt.resetToDefault = function() {
9859 return this.clear(), this.addDefaultStylesheet(), this;
9860 }, zt.core = function(t) {
9861 return this._private.coreStyle[t] || this.getDefaultProperty(t);
9862 }, zt.selector = function(t) {
9863 var e = t === "core" ? null : new Sr(t), r = this.length++;
9864 return this[r] = {
9865 selector: e,
9866 properties: [],
9867 mappedProperties: [],
9868 index: r
9869 }, this;
9870 }, zt.css = function() {
9871 var t = this, e = arguments;
9872 if (e.length === 1)
9873 for (var r = e[0], a = 0; a < t.properties.length; a++) {
9874 var n = t.properties[a], i = r[n.name];
9875 i === void 0 && (i = r[yt(n.name)]), i !== void 0 && this.cssRule(n.name, i);
9876 }
9877 else
9878 e.length === 2 && this.cssRule(e[0], e[1]);
9879 return this;
9880 }, zt.style = zt.css, zt.cssRule = function(t, e) {
9881 var r = this.parse(t, e);
9882 if (r) {
9883 var a = this.length - 1;
9884 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);
9885 var n = !this[a].selector;
9886 n && (this._private.coreStyle[r.name] = r);
9887 }
9888 return this;
9889 }, zt.append = function(t) {
9890 return at(t) ? t.appendToStyle(this) : te(t) ? this.appendFromJson(t) : ee(t) && this.appendFromString(t), this;
9891 }, Gt.fromJson = function(t, e) {
9892 var r = new Gt(t);
9893 return r.fromJson(e), r;
9894 }, Gt.fromString = function(t, e) {
9895 return new Gt(t).fromString(e);
9896 }, [Ft, qa, Ri, fr, Un, ki, It, $n].forEach(function(t) {
9897 He(zt, t);
9898 }), Gt.types = zt.types, Gt.properties = zt.properties, Gt.propertyGroups = zt.propertyGroups, Gt.propertyGroupNames = zt.propertyGroupNames, Gt.propertyGroupKeys = zt.propertyGroupKeys;
9899 var Gd = {
9900 style: function(e) {
9901 if (e) {
9902 var r = this.setStyle(e);
9903 r.update();
9904 }
9905 return this._private.style;
9906 },
9907 setStyle: function(e) {
9908 var r = this._private;
9909 return at(e) ? r.style = e.generateStyle(this) : te(e) ? r.style = Gt.fromJson(this, e) : ee(e) ? r.style = Gt.fromString(this, e) : r.style = Gt(this), r.style;
9910 },
9911 // e.g. cy.data() changed => recalc ele mappers
9912 updateStyle: function() {
9913 this.mutableElements().updateStyle();
9914 }
9915 }, zd = "single", Ur = {
9916 autolock: function(e) {
9917 if (e !== void 0)
9918 this._private.autolock = !!e;
9919 else
9920 return this._private.autolock;
9921 return this;
9922 },
9923 autoungrabify: function(e) {
9924 if (e !== void 0)
9925 this._private.autoungrabify = !!e;
9926 else
9927 return this._private.autoungrabify;
9928 return this;
9929 },
9930 autounselectify: function(e) {
9931 if (e !== void 0)
9932 this._private.autounselectify = !!e;
9933 else
9934 return this._private.autounselectify;
9935 return this;
9936 },
9937 selectionType: function(e) {
9938 var r = this._private;
9939 if (r.selectionType == null && (r.selectionType = zd), e !== void 0)
9940 (e === "additive" || e === "single") && (r.selectionType = e);
9941 else
9942 return r.selectionType;
9943 return this;
9944 },
9945 panningEnabled: function(e) {
9946 if (e !== void 0)
9947 this._private.panningEnabled = !!e;
9948 else
9949 return this._private.panningEnabled;
9950 return this;
9951 },
9952 userPanningEnabled: function(e) {
9953 if (e !== void 0)
9954 this._private.userPanningEnabled = !!e;
9955 else
9956 return this._private.userPanningEnabled;
9957 return this;
9958 },
9959 zoomingEnabled: function(e) {
9960 if (e !== void 0)
9961 this._private.zoomingEnabled = !!e;
9962 else
9963 return this._private.zoomingEnabled;
9964 return this;
9965 },
9966 userZoomingEnabled: function(e) {
9967 if (e !== void 0)
9968 this._private.userZoomingEnabled = !!e;
9969 else
9970 return this._private.userZoomingEnabled;
9971 return this;
9972 },
9973 boxSelectionEnabled: function(e) {
9974 if (e !== void 0)
9975 this._private.boxSelectionEnabled = !!e;
9976 else
9977 return this._private.boxSelectionEnabled;
9978 return this;
9979 },
9980 pan: function() {
9981 var e = arguments, r = this._private.pan, a, n, i, s, o;
9982 switch (e.length) {
9983 case 0:
9984 return r;
9985 case 1:
9986 if (ee(e[0]))
9987 return a = e[0], r[a];
9988 if (S(e[0])) {
9989 if (!this._private.panningEnabled)
9990 return this;
9991 i = e[0], s = i.x, o = i.y, R(s) && (r.x = s), R(o) && (r.y = o), this.emit("pan viewport");
9992 }
9993 break;
9994 case 2:
9995 if (!this._private.panningEnabled)
9996 return this;
9997 a = e[0], n = e[1], (a === "x" || a === "y") && R(n) && (r[a] = n), this.emit("pan viewport");
9998 break;
9999 }
10000 return this.notify("viewport"), this;
10001 },
10002 panBy: function(e, r) {
10003 var a = arguments, n = this._private.pan, i, s, o, u, l;
10004 if (!this._private.panningEnabled)
10005 return this;
10006 switch (a.length) {
10007 case 1:
10008 S(e) && (o = a[0], u = o.x, l = o.y, R(u) && (n.x += u), R(l) && (n.y += l), this.emit("pan viewport"));
10009 break;
10010 case 2:
10011 i = e, s = r, (i === "x" || i === "y") && R(s) && (n[i] += s), this.emit("pan viewport");
10012 break;
10013 }
10014 return this.notify("viewport"), this;
10015 },
10016 fit: function(e, r) {
10017 var a = this.getFitViewport(e, r);
10018 if (a) {
10019 var n = this._private;
10020 n.zoom = a.zoom, n.pan = a.pan, this.emit("pan zoom viewport"), this.notify("viewport");
10021 }
10022 return this;
10023 },
10024 getFitViewport: function(e, r) {
10025 if (R(e) && r === void 0 && (r = e, e = void 0), !(!this._private.panningEnabled || !this._private.zoomingEnabled)) {
10026 var a;
10027 if (ee(e)) {
10028 var n = e;
10029 e = this.$(n);
10030 } else if (Ze(e)) {
10031 var i = e;
10032 a = {
10033 x1: i.x1,
10034 y1: i.y1,
10035 x2: i.x2,
10036 y2: i.y2
10037 }, a.w = a.x2 - a.x1, a.h = a.y2 - a.y1;
10038 } else
10039 pe(e) || (e = this.mutableElements());
10040 if (!(pe(e) && e.empty())) {
10041 a = a || e.boundingBox();
10042 var s = this.width(), o = this.height(), u;
10043 if (r = R(r) ? r : 0, !isNaN(s) && !isNaN(o) && s > 0 && o > 0 && !isNaN(a.w) && !isNaN(a.h) && a.w > 0 && a.h > 0) {
10044 u = Math.min((s - 2 * r) / a.w, (o - 2 * r) / a.h), u = u > this._private.maxZoom ? this._private.maxZoom : u, u = u < this._private.minZoom ? this._private.minZoom : u;
10045 var l = {
10046 // now pan to middle
10047 x: (s - u * (a.x1 + a.x2)) / 2,
10048 y: (o - u * (a.y1 + a.y2)) / 2
10049 };
10050 return {
10051 zoom: u,
10052 pan: l
10053 };
10054 }
10055 }
10056 }
10057 },
10058 zoomRange: function(e, r) {
10059 var a = this._private;
10060 if (r == null) {
10061 var n = e;
10062 e = n.min, r = n.max;
10063 }
10064 return R(e) && R(r) && e <= r ? (a.minZoom = e, a.maxZoom = r) : R(e) && r === void 0 && e <= a.maxZoom ? a.minZoom = e : R(r) && e === void 0 && r >= a.minZoom && (a.maxZoom = r), this;
10065 },
10066 minZoom: function(e) {
10067 return e === void 0 ? this._private.minZoom : this.zoomRange({
10068 min: e
10069 });
10070 },
10071 maxZoom: function(e) {
10072 return e === void 0 ? this._private.maxZoom : this.zoomRange({
10073 max: e
10074 });
10075 },
10076 getZoomedViewport: function(e) {
10077 var r = this._private, a = r.pan, n = r.zoom, i, s, o = !1;
10078 if (r.zoomingEnabled || (o = !0), R(e) ? s = e : S(e) && (s = e.level, e.position != null ? i = vn(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 || !R(s) || s === n || i != null && (!R(i.x) || !R(i.y)))
10079 return null;
10080 if (i != null) {
10081 var u = a, l = n, f = s, h = {
10082 x: -f / l * (i.x - u.x) + i.x,
10083 y: -f / l * (i.y - u.y) + i.y
10084 };
10085 return {
10086 zoomed: !0,
10087 panned: !0,
10088 zoom: f,
10089 pan: h
10090 };
10091 } else
10092 return {
10093 zoomed: !0,
10094 panned: !1,
10095 zoom: s,
10096 pan: a
10097 };
10098 },
10099 zoom: function(e) {
10100 if (e === void 0)
10101 return this._private.zoom;
10102 var r = this.getZoomedViewport(e), a = this._private;
10103 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);
10104 },
10105 viewport: function(e) {
10106 var r = this._private, a = !0, n = !0, i = [], s = !1, o = !1;
10107 if (!e)
10108 return this;
10109 if (R(e.zoom) || (a = !1), S(e.pan) || (n = !1), !a && !n)
10110 return this;
10111 if (a) {
10112 var u = e.zoom;
10113 u < r.minZoom || u > r.maxZoom || !r.zoomingEnabled ? s = !0 : (r.zoom = u, i.push("zoom"));
10114 }
10115 if (n && (!s || !e.cancelOnFailedZoom) && r.panningEnabled) {
10116 var l = e.pan;
10117 R(l.x) && (r.pan.x = l.x, o = !1), R(l.y) && (r.pan.y = l.y, o = !1), o || i.push("pan");
10118 }
10119 return i.length > 0 && (i.push("viewport"), this.emit(i.join(" ")), this.notify("viewport")), this;
10120 },
10121 center: function(e) {
10122 var r = this.getCenterPan(e);
10123 return r && (this._private.pan = r, this.emit("pan viewport"), this.notify("viewport")), this;
10124 },
10125 getCenterPan: function(e, r) {
10126 if (this._private.panningEnabled) {
10127 if (ee(e)) {
10128 var a = e;
10129 e = this.mutableElements().filter(a);
10130 } else
10131 pe(e) || (e = this.mutableElements());
10132 if (e.length !== 0) {
10133 var n = e.boundingBox(), i = this.width(), s = this.height();
10134 r = r === void 0 ? this._private.zoom : r;
10135 var o = {
10136 // middle
10137 x: (i - r * (n.x1 + n.x2)) / 2,
10138 y: (s - r * (n.y1 + n.y2)) / 2
10139 };
10140 return o;
10141 }
10142 }
10143 },
10144 reset: function() {
10145 return !this._private.panningEnabled || !this._private.zoomingEnabled ? this : (this.viewport({
10146 pan: {
10147 x: 0,
10148 y: 0
10149 },
10150 zoom: 1
10151 }), this);
10152 },
10153 invalidateSize: function() {
10154 this._private.sizeCache = null;
10155 },
10156 size: function() {
10157 var e = this._private, r = e.container, a = this;
10158 return e.sizeCache = e.sizeCache || (r ? function() {
10159 var n = a.window().getComputedStyle(r), i = function(o) {
10160 return parseFloat(n.getPropertyValue(o));
10161 };
10162 return {
10163 width: r.clientWidth - i("padding-left") - i("padding-right"),
10164 height: r.clientHeight - i("padding-top") - i("padding-bottom")
10165 };
10166 }() : {
10167 // fallback if no container (not 0 b/c can be used for dividing etc)
10168 width: 1,
10169 height: 1
10170 });
10171 },
10172 width: function() {
10173 return this.size().width;
10174 },
10175 height: function() {
10176 return this.size().height;
10177 },
10178 extent: function() {
10179 var e = this._private.pan, r = this._private.zoom, a = this.renderedExtent(), n = {
10180 x1: (a.x1 - e.x) / r,
10181 x2: (a.x2 - e.x) / r,
10182 y1: (a.y1 - e.y) / r,
10183 y2: (a.y2 - e.y) / r
10184 };
10185 return n.w = n.x2 - n.x1, n.h = n.y2 - n.y1, n;
10186 },
10187 renderedExtent: function() {
10188 var e = this.width(), r = this.height();
10189 return {
10190 x1: 0,
10191 y1: 0,
10192 x2: e,
10193 y2: r,
10194 w: e,
10195 h: r
10196 };
10197 },
10198 multiClickDebounceTime: function(e) {
10199 if (e)
10200 this._private.multiClickDebounceTime = e;
10201 else
10202 return this._private.multiClickDebounceTime;
10203 return this;
10204 }
10205 };
10206 Ur.centre = Ur.center, Ur.autolockNodes = Ur.autolock, Ur.autoungrabifyNodes = Ur.autoungrabify;
10207 var Ka = {
10208 data: ct.data({
10209 field: "data",
10210 bindingEvent: "data",
10211 allowBinding: !0,
10212 allowSetting: !0,
10213 settingEvent: "data",
10214 settingTriggersEvent: !0,
10215 triggerFnName: "trigger",
10216 allowGetting: !0,
10217 updateStyle: !0
10218 }),
10219 removeData: ct.removeData({
10220 field: "data",
10221 event: "data",
10222 triggerFnName: "trigger",
10223 triggerEvent: !0,
10224 updateStyle: !0
10225 }),
10226 scratch: ct.data({
10227 field: "scratch",
10228 bindingEvent: "scratch",
10229 allowBinding: !0,
10230 allowSetting: !0,
10231 settingEvent: "scratch",
10232 settingTriggersEvent: !0,
10233 triggerFnName: "trigger",
10234 allowGetting: !0,
10235 updateStyle: !0
10236 }),
10237 removeScratch: ct.removeData({
10238 field: "scratch",
10239 event: "scratch",
10240 triggerFnName: "trigger",
10241 triggerEvent: !0,
10242 updateStyle: !0
10243 })
10244 };
10245 Ka.attr = Ka.data, Ka.removeAttr = Ka.removeData;
10246 var Za = function(e) {
10247 var r = this;
10248 e = He({}, e);
10249 var a = e.container;
10250 a && !ve(a) && ve(a[0]) && (a = a[0]);
10251 var n = a ? a._cyreg : null;
10252 n = n || {}, n && n.cy && (n.cy.destroy(), n = {});
10253 var i = n.readies = n.readies || [];
10254 a && (a._cyreg = n), n.cy = r;
10255 var s = A !== void 0 && a !== void 0 && !e.headless, o = e;
10256 o.layout = He({
10257 name: s ? "grid" : "null"
10258 }, o.layout), o.renderer = He({
10259 name: s ? "canvas" : "null"
10260 }, o.renderer);
10261 var u = function(c, y, p) {
10262 return y !== void 0 ? y : p !== void 0 ? p : c;
10263 }, l = this._private = {
10264 container: a,
10265 // html dom ele container
10266 ready: !1,
10267 // whether ready has been triggered
10268 options: o,
10269 // cached options
10270 elements: new Nt(this),
10271 // elements in the graph
10272 listeners: [],
10273 // list of listeners
10274 aniEles: new Nt(this),
10275 // elements being animated
10276 data: o.data || {},
10277 // data for the core
10278 scratch: {},
10279 // scratch object for core
10280 layout: null,
10281 renderer: null,
10282 destroyed: !1,
10283 // whether destroy was called
10284 notificationsEnabled: !0,
10285 // whether notifications are sent to the renderer
10286 minZoom: 1e-50,
10287 maxZoom: 1e50,
10288 zoomingEnabled: u(!0, o.zoomingEnabled),
10289 userZoomingEnabled: u(!0, o.userZoomingEnabled),
10290 panningEnabled: u(!0, o.panningEnabled),
10291 userPanningEnabled: u(!0, o.userPanningEnabled),
10292 boxSelectionEnabled: u(!0, o.boxSelectionEnabled),
10293 autolock: u(!1, o.autolock, o.autolockNodes),
10294 autoungrabify: u(!1, o.autoungrabify, o.autoungrabifyNodes),
10295 autounselectify: u(!1, o.autounselectify),
10296 styleEnabled: o.styleEnabled === void 0 ? s : o.styleEnabled,
10297 zoom: R(o.zoom) ? o.zoom : 1,
10298 pan: {
10299 x: S(o.pan) && R(o.pan.x) ? o.pan.x : 0,
10300 y: S(o.pan) && R(o.pan.y) ? o.pan.y : 0
10301 },
10302 animation: {
10303 // object for currently-running animations
10304 current: [],
10305 queue: []
10306 },
10307 hasCompoundNodes: !1,
10308 multiClickDebounceTime: u(250, o.multiClickDebounceTime)
10309 };
10310 this.createEmitter(), this.selectionType(o.selectionType), this.zoomRange({
10311 min: o.minZoom,
10312 max: o.maxZoom
10313 });
10314 var f = function(c, y) {
10315 var p = c.some(nt);
10316 if (p)
10317 return ia.all(c).then(y);
10318 y(c);
10319 };
10320 l.styleEnabled && r.setStyle([]);
10321 var h = He({}, o, o.renderer);
10322 r.initRenderer(h);
10323 var v = function(c, y, p) {
10324 r.notifications(!1);
10325 var g = r.mutableElements();
10326 g.length > 0 && g.remove(), c != null && (S(c) || te(c)) && r.add(c), r.one("layoutready", function(b) {
10327 r.notifications(!0), r.emit(b), r.one("load", y), r.emitAndNotify("load");
10328 }).one("layoutstop", function() {
10329 r.one("done", p), r.emit("done");
10330 });
10331 var m = He({}, r._private.options.layout);
10332 m.eles = r.elements(), r.layout(m).run();
10333 };
10334 f([o.style, o.elements], function(d) {
10335 var c = d[0], y = d[1];
10336 l.styleEnabled && r.style().append(c), v(y, function() {
10337 r.startAnimationLoop(), l.ready = !0, H(o.ready) && r.on("ready", o.ready);
10338 for (var p = 0; p < i.length; p++) {
10339 var g = i[p];
10340 r.on("ready", g);
10341 }
10342 n && (n.readies = []), r.emit("ready");
10343 }, o.done);
10344 });
10345 }, _n = Za.prototype;
10346 He(_n, {
10347 instanceString: function() {
10348 return "core";
10349 },
10350 isReady: function() {
10351 return this._private.ready;
10352 },
10353 destroyed: function() {
10354 return this._private.destroyed;
10355 },
10356 ready: function(e) {
10357 return this.isReady() ? this.emitter().emit("ready", [], e) : this.on("ready", e), this;
10358 },
10359 destroy: function() {
10360 var e = this;
10361 if (!e.destroyed())
10362 return e.stopAnimationLoop(), e.destroyRenderer(), this.emit("destroy"), e._private.destroyed = !0, e;
10363 },
10364 hasElementWithId: function(e) {
10365 return this._private.elements.hasElementWithId(e);
10366 },
10367 getElementById: function(e) {
10368 return this._private.elements.getElementById(e);
10369 },
10370 hasCompoundNodes: function() {
10371 return this._private.hasCompoundNodes;
10372 },
10373 headless: function() {
10374 return this._private.renderer.isHeadless();
10375 },
10376 styleEnabled: function() {
10377 return this._private.styleEnabled;
10378 },
10379 addToPool: function(e) {
10380 return this._private.elements.merge(e), this;
10381 },
10382 removeFromPool: function(e) {
10383 return this._private.elements.unmerge(e), this;
10384 },
10385 container: function() {
10386 return this._private.container || null;
10387 },
10388 window: function() {
10389 var e = this._private.container;
10390 if (e == null)
10391 return A;
10392 var r = this._private.container.ownerDocument;
10393 return r === void 0 || r == null ? A : r.defaultView || A;
10394 },
10395 mount: function(e) {
10396 if (e != null) {
10397 var r = this, a = r._private, n = a.options;
10398 return !ve(e) && ve(e[0]) && (e = e[0]), r.stopAnimationLoop(), r.destroyRenderer(), a.container = e, a.styleEnabled = !0, r.invalidateSize(), r.initRenderer(He({}, n, n.renderer, {
10399 // allow custom renderer name to be re-used, otherwise use canvas
10400 name: n.renderer.name === "null" ? "canvas" : n.renderer.name
10401 })), r.startAnimationLoop(), r.style(n.style), r.emit("mount"), r;
10402 }
10403 },
10404 unmount: function() {
10405 var e = this;
10406 return e.stopAnimationLoop(), e.destroyRenderer(), e.initRenderer({
10407 name: "null"
10408 }), e.emit("unmount"), e;
10409 },
10410 options: function() {
10411 return lr(this._private.options);
10412 },
10413 json: function(e) {
10414 var r = this, a = r._private, n = r.mutableElements(), i = function(E) {
10415 return r.getElementById(E.id());
10416 };
10417 if (S(e)) {
10418 if (r.startBatch(), e.elements) {
10419 var s = {}, o = function(E, M) {
10420 for (var L = [], w = [], k = 0; k < E.length; k++) {
10421 var D = E[k];
10422 if (!D.data.id) {
10423 vt("cy.json() cannot handle elements without an ID attribute");
10424 continue;
10425 }
10426 var F = "" + D.data.id, G = r.getElementById(F);
10427 s[F] = !0, G.length !== 0 ? w.push({
10428 ele: G,
10429 json: D
10430 }) : (M && (D.group = M), L.push(D));
10431 }
10432 r.add(L);
10433 for (var N = 0; N < w.length; N++) {
10434 var X = w[N], B = X.ele, re = X.json;
10435 B.json(re);
10436 }
10437 };
10438 if (te(e.elements))
10439 o(e.elements);
10440 else
10441 for (var u = ["nodes", "edges"], l = 0; l < u.length; l++) {
10442 var f = u[l], h = e.elements[f];
10443 te(h) && o(h, f);
10444 }
10445 var v = r.collection();
10446 n.filter(function(b) {
10447 return !s[b.id()];
10448 }).forEach(function(b) {
10449 b.isParent() ? v.merge(b) : b.remove();
10450 }), v.forEach(function(b) {
10451 return b.children().move({
10452 parent: null
10453 });
10454 }), v.forEach(function(b) {
10455 return i(b).remove();
10456 });
10457 }
10458 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);
10459 for (var d = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"], c = 0; c < d.length; c++) {
10460 var y = d[c];
10461 e[y] != null && r[y](e[y]);
10462 }
10463 return r.endBatch(), this;
10464 } else {
10465 var p = !!e, g = {};
10466 p ? g.elements = this.elements().map(function(b) {
10467 return b.json();
10468 }) : (g.elements = {}, n.forEach(function(b) {
10469 var E = b.group();
10470 g.elements[E] || (g.elements[E] = []), g.elements[E].push(b.json());
10471 })), this._private.styleEnabled && (g.style = r.style().json()), g.data = lr(r.data());
10472 var m = a.options;
10473 return g.zoomingEnabled = a.zoomingEnabled, g.userZoomingEnabled = a.userZoomingEnabled, g.zoom = a.zoom, g.minZoom = a.minZoom, g.maxZoom = a.maxZoom, g.panningEnabled = a.panningEnabled, g.userPanningEnabled = a.userPanningEnabled, g.pan = lr(a.pan), g.boxSelectionEnabled = a.boxSelectionEnabled, g.renderer = lr(m.renderer), g.hideEdgesOnViewport = m.hideEdgesOnViewport, g.textureOnViewport = m.textureOnViewport, g.wheelSensitivity = m.wheelSensitivity, g.motionBlur = m.motionBlur, g.multiClickDebounceTime = m.multiClickDebounceTime, g;
10474 }
10475 }
10476 }), _n.$id = _n.getElementById, [Ad, Rd, Yo, Ii, zn, Pd, Mi, Vn, Gd, Ur, Ka].forEach(function(t) {
10477 He(_n, t);
10478 });
10479 var Vd = {
10480 fit: !0,
10481 // whether to fit the viewport to the graph
10482 directed: !1,
10483 // whether the tree is directed downwards (or edges can point in any direction if false)
10484 padding: 30,
10485 // padding on fit
10486 circle: !1,
10487 // put depths in concentric circles if true, put depths top down if false
10488 grid: !1,
10489 // whether to create an even grid into which the DAG is placed (circle:false only)
10490 spacingFactor: 1.75,
10491 // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap)
10492 boundingBox: void 0,
10493 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10494 avoidOverlap: !0,
10495 // prevents node overlap, may overflow boundingBox if not enough space
10496 nodeDimensionsIncludeLabels: !1,
10497 // Excludes the label when calculating node bounding boxes for the layout algorithm
10498 roots: void 0,
10499 // the roots of the trees
10500 depthSort: void 0,
10501 // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
10502 animate: !1,
10503 // whether to transition the node positions
10504 animationDuration: 500,
10505 // duration of animation in ms if enabled
10506 animationEasing: void 0,
10507 // easing of animation if enabled,
10508 animateFilter: function(e, r) {
10509 return !0;
10510 },
10511 // 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
10512 ready: void 0,
10513 // callback on layoutready
10514 stop: void 0,
10515 // callback on layoutstop
10516 transform: function(e, r) {
10517 return r;
10518 }
10519 // transform a given node position. Useful for changing flow direction in discrete layouts
10520 }, Ud = {
10521 maximal: !1,
10522 // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also
10523 acyclic: !1
10524 // whether the tree is acyclic and thus a node could be shifted (due to the maximal option) multiple times without causing an infinite loop; setting to true sets maximal to true also; if you are uncertain whether a tree is acyclic, set to false to avoid potential infinite loops
10525 }, pa = function(e) {
10526 return e.scratch("breadthfirst");
10527 }, Ho = function(e, r) {
10528 return e.scratch("breadthfirst", r);
10529 };
10530 function Xo(t) {
10531 this.options = He({}, Vd, Ud, t);
10532 }
10533 Xo.prototype.run = function() {
10534 var t = this.options, e = t, r = t.cy, a = e.eles, n = a.nodes().filter(function(Ie) {
10535 return !Ie.isParent();
10536 }), i = a, s = e.directed, o = e.acyclic || e.maximal || e.maximalAdjustments > 0, u = Yt(e.boundingBox ? e.boundingBox : {
10537 x1: 0,
10538 y1: 0,
10539 w: r.width(),
10540 h: r.height()
10541 }), l;
10542 if (pe(e.roots))
10543 l = e.roots;
10544 else if (te(e.roots)) {
10545 for (var f = [], h = 0; h < e.roots.length; h++) {
10546 var v = e.roots[h], d = r.getElementById(v);
10547 f.push(d);
10548 }
10549 l = r.collection(f);
10550 } else if (ee(e.roots))
10551 l = r.$(e.roots);
10552 else if (s)
10553 l = n.roots();
10554 else {
10555 var c = a.components();
10556 l = r.collection();
10557 for (var y = function(Me) {
10558 var Ue = c[Me], ze = Ue.maxDegree(!1), Be = Ue.filter(function($e) {
10559 return $e.degree(!1) === ze;
10560 });
10561 l = l.add(Be);
10562 }, p = 0; p < c.length; p++)
10563 y(p);
10564 }
10565 var g = [], m = {}, b = function(Me, Ue) {
10566 g[Ue] == null && (g[Ue] = []);
10567 var ze = g[Ue].length;
10568 g[Ue].push(Me), Ho(Me, {
10569 index: ze,
10570 depth: Ue
10571 });
10572 }, E = function(Me, Ue) {
10573 var ze = pa(Me), Be = ze.depth, $e = ze.index;
10574 g[Be][$e] = null, b(Me, Ue);
10575 };
10576 i.bfs({
10577 roots: l,
10578 directed: e.directed,
10579 visit: function(Me, Ue, ze, Be, $e) {
10580 var rt = Me[0], je = rt.id();
10581 b(rt, $e), m[je] = !0;
10582 }
10583 });
10584 for (var M = [], L = 0; L < n.length; L++) {
10585 var w = n[L];
10586 m[w.id()] || M.push(w);
10587 }
10588 var k = function(Me) {
10589 for (var Ue = g[Me], ze = 0; ze < Ue.length; ze++) {
10590 var Be = Ue[ze];
10591 if (Be == null) {
10592 Ue.splice(ze, 1), ze--;
10593 continue;
10594 }
10595 Ho(Be, {
10596 depth: Me,
10597 index: ze
10598 });
10599 }
10600 }, D = function() {
10601 for (var Me = 0; Me < g.length; Me++)
10602 k(Me);
10603 }, F = function(Me, Ue) {
10604 for (var ze = pa(Me), Be = Me.incomers().filter(function(O) {
10605 return O.isNode() && a.has(O);
10606 }), $e = -1, rt = Me.id(), je = 0; je < Be.length; je++) {
10607 var We = Be[je], et = pa(We);
10608 $e = Math.max($e, et.depth);
10609 }
10610 if (ze.depth <= $e) {
10611 if (!e.acyclic && Ue[rt])
10612 return null;
10613 var he = $e + 1;
10614 return E(Me, he), Ue[rt] = he, !0;
10615 }
10616 return !1;
10617 };
10618 if (s && o) {
10619 var G = [], N = {}, X = function(Me) {
10620 return G.push(Me);
10621 }, B = function() {
10622 return G.shift();
10623 };
10624 for (n.forEach(function(Ie) {
10625 return G.push(Ie);
10626 }); G.length > 0; ) {
10627 var re = B(), K = F(re, N);
10628 if (K)
10629 re.outgoers().filter(function(Ie) {
10630 return Ie.isNode() && a.has(Ie);
10631 }).forEach(X);
10632 else if (K === null) {
10633 vt("Detected double maximal shift for node `" + re.id() + "`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");
10634 break;
10635 }
10636 }
10637 }
10638 D();
10639 var W = 0;
10640 if (e.avoidOverlap)
10641 for (var ae = 0; ae < n.length; ae++) {
10642 var ue = n[ae], me = ue.layoutDimensions(e), ie = me.w, ge = me.h;
10643 W = Math.max(W, ie, ge);
10644 }
10645 var Ee = {}, Ce = function(Me) {
10646 if (Ee[Me.id()])
10647 return Ee[Me.id()];
10648 for (var Ue = pa(Me).depth, ze = Me.neighborhood(), Be = 0, $e = 0, rt = 0; rt < ze.length; rt++) {
10649 var je = ze[rt];
10650 if (!(je.isEdge() || je.isParent() || !n.has(je))) {
10651 var We = pa(je);
10652 if (We != null) {
10653 var et = We.index, he = We.depth;
10654 if (!(et == null || he == null)) {
10655 var O = g[he].length;
10656 he < Ue && (Be += et / O, $e++);
10657 }
10658 }
10659 }
10660 }
10661 return $e = Math.max(1, $e), Be = Be / $e, $e === 0 && (Be = 0), Ee[Me.id()] = Be, Be;
10662 }, we = function(Me, Ue) {
10663 var ze = Ce(Me), Be = Ce(Ue), $e = ze - Be;
10664 return $e === 0 ? es(Me.id(), Ue.id()) : $e;
10665 };
10666 e.depthSort !== void 0 && (we = e.depthSort);
10667 for (var De = 0; De < g.length; De++)
10668 g[De].sort(we), k(De);
10669 for (var se = [], xe = 0; xe < M.length; xe++)
10670 se.push(M[xe]);
10671 g.unshift(se), D();
10672 for (var Le = 0, Se = 0; Se < g.length; Se++)
10673 Le = Math.max(g[Se].length, Le);
10674 var Oe = {
10675 x: u.x1 + u.w / 2,
10676 y: u.x1 + u.h / 2
10677 }, Fe = g.reduce(function(Ie, Me) {
10678 return Math.max(Ie, Me.length);
10679 }, 0), Xe = function(Me) {
10680 var Ue = pa(Me), ze = Ue.depth, Be = Ue.index, $e = g[ze].length, rt = Math.max(u.w / ((e.grid ? Fe : $e) + 1), W), je = Math.max(u.h / (g.length + 1), W), We = Math.min(u.w / 2 / g.length, u.h / 2 / g.length);
10681 if (We = Math.max(We, W), e.circle) {
10682 var he = We * ze + We - (g.length > 0 && g[0].length <= 3 ? We / 2 : 0), O = 2 * Math.PI / g[ze].length * Be;
10683 return ze === 0 && g[0].length === 1 && (he = 1), {
10684 x: Oe.x + he * Math.cos(O),
10685 y: Oe.y + he * Math.sin(O)
10686 };
10687 } else {
10688 var et = {
10689 x: Oe.x + (Be + 1 - ($e + 1) / 2) * rt,
10690 y: (ze + 1) * je
10691 };
10692 return et;
10693 }
10694 };
10695 return a.nodes().layoutPositions(this, e, Xe), this;
10696 };
10697 var $d = {
10698 fit: !0,
10699 // whether to fit the viewport to the graph
10700 padding: 30,
10701 // the padding on fit
10702 boundingBox: void 0,
10703 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10704 avoidOverlap: !0,
10705 // prevents node overlap, may overflow boundingBox and radius if not enough space
10706 nodeDimensionsIncludeLabels: !1,
10707 // Excludes the label when calculating node bounding boxes for the layout algorithm
10708 spacingFactor: void 0,
10709 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
10710 radius: void 0,
10711 // the radius of the circle
10712 startAngle: 3 / 2 * Math.PI,
10713 // where nodes start in radians
10714 sweep: void 0,
10715 // how many radians should be between the first and last node (defaults to full circle)
10716 clockwise: !0,
10717 // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
10718 sort: void 0,
10719 // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
10720 animate: !1,
10721 // whether to transition the node positions
10722 animationDuration: 500,
10723 // duration of animation in ms if enabled
10724 animationEasing: void 0,
10725 // easing of animation if enabled
10726 animateFilter: function(e, r) {
10727 return !0;
10728 },
10729 // 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
10730 ready: void 0,
10731 // callback on layoutready
10732 stop: void 0,
10733 // callback on layoutstop
10734 transform: function(e, r) {
10735 return r;
10736 }
10737 // transform a given node position. Useful for changing flow direction in discrete layouts
10738 };
10739 function Wo(t) {
10740 this.options = He({}, $d, t);
10741 }
10742 Wo.prototype.run = function() {
10743 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");
10744 e.sort && (i = i.sort(e.sort));
10745 for (var s = Yt(e.boundingBox ? e.boundingBox : {
10746 x1: 0,
10747 y1: 0,
10748 w: r.width(),
10749 h: r.height()
10750 }), o = {
10751 x: s.x1 + s.w / 2,
10752 y: s.y1 + s.h / 2
10753 }, u = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / i.length : e.sweep, l = u / Math.max(1, i.length - 1), f, h = 0, v = 0; v < i.length; v++) {
10754 var d = i[v], c = d.layoutDimensions(e), y = c.w, p = c.h;
10755 h = Math.max(h, y, p);
10756 }
10757 if (R(e.radius) ? f = e.radius : i.length <= 1 ? f = 0 : f = Math.min(s.h, s.w) / 2 - h, i.length > 1 && e.avoidOverlap) {
10758 h *= 1.75;
10759 var g = Math.cos(l) - Math.cos(0), m = Math.sin(l) - Math.sin(0), b = Math.sqrt(h * h / (g * g + m * m));
10760 f = Math.max(b, f);
10761 }
10762 var E = function(L, w) {
10763 var k = e.startAngle + w * l * (n ? 1 : -1), D = f * Math.cos(k), F = f * Math.sin(k), G = {
10764 x: o.x + D,
10765 y: o.y + F
10766 };
10767 return G;
10768 };
10769 return a.nodes().layoutPositions(this, e, E), this;
10770 };
10771 var _d = {
10772 fit: !0,
10773 // whether to fit the viewport to the graph
10774 padding: 30,
10775 // the padding on fit
10776 startAngle: 3 / 2 * Math.PI,
10777 // where nodes start in radians
10778 sweep: void 0,
10779 // how many radians should be between the first and last node (defaults to full circle)
10780 clockwise: !0,
10781 // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
10782 equidistant: !1,
10783 // whether levels have an equal radial distance betwen them, may cause bounding box overflow
10784 minNodeSpacing: 10,
10785 // min spacing between outside of nodes (used for radius adjustment)
10786 boundingBox: void 0,
10787 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10788 avoidOverlap: !0,
10789 // prevents node overlap, may overflow boundingBox if not enough space
10790 nodeDimensionsIncludeLabels: !1,
10791 // Excludes the label when calculating node bounding boxes for the layout algorithm
10792 height: void 0,
10793 // height of layout area (overrides container height)
10794 width: void 0,
10795 // width of layout area (overrides container width)
10796 spacingFactor: void 0,
10797 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
10798 concentric: function(e) {
10799 return e.degree();
10800 },
10801 levelWidth: function(e) {
10802 return e.maxDegree() / 4;
10803 },
10804 animate: !1,
10805 // whether to transition the node positions
10806 animationDuration: 500,
10807 // duration of animation in ms if enabled
10808 animationEasing: void 0,
10809 // easing of animation if enabled
10810 animateFilter: function(e, r) {
10811 return !0;
10812 },
10813 // 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
10814 ready: void 0,
10815 // callback on layoutready
10816 stop: void 0,
10817 // callback on layoutstop
10818 transform: function(e, r) {
10819 return r;
10820 }
10821 // transform a given node position. Useful for changing flow direction in discrete layouts
10822 };
10823 function qo(t) {
10824 this.options = He({}, _d, t);
10825 }
10826 qo.prototype.run = function() {
10827 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 = Yt(e.boundingBox ? e.boundingBox : {
10828 x1: 0,
10829 y1: 0,
10830 w: a.width(),
10831 h: a.height()
10832 }), o = {
10833 x: s.x1 + s.w / 2,
10834 y: s.y1 + s.h / 2
10835 }, u = [], l = 0, f = 0; f < i.length; f++) {
10836 var h = i[f], v = void 0;
10837 v = e.concentric(h), u.push({
10838 value: v,
10839 node: h
10840 }), h._private.scratch.concentric = v;
10841 }
10842 i.updateStyle();
10843 for (var d = 0; d < i.length; d++) {
10844 var c = i[d], y = c.layoutDimensions(e);
10845 l = Math.max(l, y.w, y.h);
10846 }
10847 u.sort(function(Ie, Me) {
10848 return Me.value - Ie.value;
10849 });
10850 for (var p = e.levelWidth(i), g = [[]], m = g[0], b = 0; b < u.length; b++) {
10851 var E = u[b];
10852 if (m.length > 0) {
10853 var M = Math.abs(m[0].value - E.value);
10854 M >= p && (m = [], g.push(m));
10855 }
10856 m.push(E);
10857 }
10858 var L = l + e.minNodeSpacing;
10859 if (!e.avoidOverlap) {
10860 var w = g.length > 0 && g[0].length > 1, k = Math.min(s.w, s.h) / 2 - L, D = k / (g.length + w ? 1 : 0);
10861 L = Math.min(L, D);
10862 }
10863 for (var F = 0, G = 0; G < g.length; G++) {
10864 var N = g[G], X = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / N.length : e.sweep, B = N.dTheta = X / Math.max(1, N.length - 1);
10865 if (N.length > 1 && e.avoidOverlap) {
10866 var re = Math.cos(B) - Math.cos(0), K = Math.sin(B) - Math.sin(0), W = Math.sqrt(L * L / (re * re + K * K));
10867 F = Math.max(W, F);
10868 }
10869 N.r = F, F += L;
10870 }
10871 if (e.equidistant) {
10872 for (var ae = 0, ue = 0, me = 0; me < g.length; me++) {
10873 var ie = g[me], ge = ie.r - ue;
10874 ae = Math.max(ae, ge);
10875 }
10876 ue = 0;
10877 for (var Ee = 0; Ee < g.length; Ee++) {
10878 var Ce = g[Ee];
10879 Ee === 0 && (ue = Ce.r), Ce.r = ue, ue += ae;
10880 }
10881 }
10882 for (var we = {}, De = 0; De < g.length; De++)
10883 for (var se = g[De], xe = se.dTheta, Le = se.r, Se = 0; Se < se.length; Se++) {
10884 var Oe = se[Se], Fe = e.startAngle + (r ? 1 : -1) * xe * Se, Xe = {
10885 x: o.x + Le * Math.cos(Fe),
10886 y: o.y + Le * Math.sin(Fe)
10887 };
10888 we[Oe.node.id()] = Xe;
10889 }
10890 return n.nodes().layoutPositions(this, e, function(Ie) {
10891 var Me = Ie.id();
10892 return we[Me];
10893 }), this;
10894 };
10895 var Pi, Yd = {
10896 // Called on `layoutready`
10897 ready: function() {
10898 },
10899 // Called on `layoutstop`
10900 stop: function() {
10901 },
10902 // Whether to animate while running the layout
10903 // true : Animate continuously as the layout is running
10904 // false : Just show the end result
10905 // 'end' : Animate with the end result, from the initial positions to the end positions
10906 animate: !0,
10907 // Easing of the animation for animate:'end'
10908 animationEasing: void 0,
10909 // The duration of the animation for animate:'end'
10910 animationDuration: void 0,
10911 // A function that determines whether the node should be animated
10912 // All nodes animated by default on animate enabled
10913 // Non-animated nodes are positioned immediately when the layout starts
10914 animateFilter: function(e, r) {
10915 return !0;
10916 },
10917 // The layout animates only after this many milliseconds for animate:true
10918 // (prevents flashing on fast runs)
10919 animationThreshold: 250,
10920 // Number of iterations between consecutive screen positions update
10921 refresh: 20,
10922 // Whether to fit the network view after when done
10923 fit: !0,
10924 // Padding on fit
10925 padding: 30,
10926 // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
10927 boundingBox: void 0,
10928 // Excludes the label when calculating node bounding boxes for the layout algorithm
10929 nodeDimensionsIncludeLabels: !1,
10930 // Randomize the initial positions of the nodes (true) or use existing positions (false)
10931 randomize: !1,
10932 // Extra spacing between components in non-compound graphs
10933 componentSpacing: 40,
10934 // Node repulsion (non overlapping) multiplier
10935 nodeRepulsion: function(e) {
10936 return 2048;
10937 },
10938 // Node repulsion (overlapping) multiplier
10939 nodeOverlap: 4,
10940 // Ideal edge (non nested) length
10941 idealEdgeLength: function(e) {
10942 return 32;
10943 },
10944 // Divisor to compute edge forces
10945 edgeElasticity: function(e) {
10946 return 32;
10947 },
10948 // Nesting factor (multiplier) to compute ideal edge length for nested edges
10949 nestingFactor: 1.2,
10950 // Gravity force (constant)
10951 gravity: 1,
10952 // Maximum number of iterations to perform
10953 numIter: 1e3,
10954 // Initial temperature (maximum node displacement)
10955 initialTemp: 1e3,
10956 // Cooling factor (how the temperature is reduced between consecutive iterations
10957 coolingFactor: 0.99,
10958 // Lower temperature threshold (below this point the layout will end)
10959 minTemp: 1
10960 };
10961 function Yn(t) {
10962 this.options = He({}, Yd, t), this.options.layout = this;
10963 var e = this.options.eles.nodes(), r = this.options.eles.edges(), a = r.filter(function(n) {
10964 var i = n.source().data("id"), s = n.target().data("id"), o = e.some(function(l) {
10965 return l.data("id") === i;
10966 }), u = e.some(function(l) {
10967 return l.data("id") === s;
10968 });
10969 return !o || !u;
10970 });
10971 this.options.eles = this.options.eles.not(a);
10972 }
10973 Yn.prototype.run = function() {
10974 var t = this.options, e = t.cy, r = this;
10975 r.stopped = !1, (t.animate === !0 || t.animate === !1) && r.emit({
10976 type: "layoutstart",
10977 layout: r
10978 }), t.debug === !0 ? Pi = !0 : Pi = !1;
10979 var a = Hd(e, r, t);
10980 Pi && qd(a), t.randomize && Kd(a);
10981 var n = gr(), i = function() {
10982 Zd(a, e, t), t.fit === !0 && e.fit(t.padding);
10983 }, s = function(v) {
10984 return !(r.stopped || v >= t.numIter || (Qd(a, t), a.temperature = a.temperature * t.coolingFactor, a.temperature < t.minTemp));
10985 }, o = function() {
10986 if (t.animate === !0 || t.animate === !1)
10987 i(), r.one("layoutstop", t.stop), r.emit({
10988 type: "layoutstop",
10989 layout: r
10990 });
10991 else {
10992 var v = t.eles.nodes(), d = Ko(a, t, v);
10993 v.layoutPositions(r, t, d);
10994 }
10995 }, u = 0, l = !0;
10996 if (t.animate === !0) {
10997 var f = function h() {
10998 for (var v = 0; l && v < t.refresh; )
10999 l = s(u), u++, v++;
11000 if (!l)
11001 Qo(a, t), o();
11002 else {
11003 var d = gr();
11004 d - n >= t.animationThreshold && i(), ln(h);
11005 }
11006 };
11007 f();
11008 } else {
11009 for (; l; )
11010 l = s(u), u++;
11011 Qo(a, t), o();
11012 }
11013 return this;
11014 }, Yn.prototype.stop = function() {
11015 return this.stopped = !0, this.thread && this.thread.stop(), this.emit("layoutstop"), this;
11016 }, Yn.prototype.destroy = function() {
11017 return this.thread && this.thread.stop(), this;
11018 };
11019 var Hd = function(e, r, a) {
11020 for (var n = a.eles.edges(), i = a.eles.nodes(), s = Yt(a.boundingBox ? a.boundingBox : {
11021 x1: 0,
11022 y1: 0,
11023 w: e.width(),
11024 h: e.height()
11025 }), o = {
11026 isCompound: e.hasCompoundNodes(),
11027 layoutNodes: [],
11028 idToIndex: {},
11029 nodeSize: i.size(),
11030 graphSet: [],
11031 indexToGraph: [],
11032 layoutEdges: [],
11033 edgeSize: n.size(),
11034 temperature: a.initialTemp,
11035 clientWidth: s.w,
11036 clientHeight: s.h,
11037 boundingBox: s
11038 }, u = a.eles.components(), l = {}, f = 0; f < u.length; f++)
11039 for (var h = u[f], v = 0; v < h.length; v++) {
11040 var d = h[v];
11041 l[d.id()] = f;
11042 }
11043 for (var f = 0; f < o.nodeSize; f++) {
11044 var c = i[f], y = c.layoutDimensions(a), p = {};
11045 p.isLocked = c.locked(), p.id = c.data("id"), p.parentId = c.data("parent"), p.cmptId = l[c.id()], p.children = [], p.positionX = c.position("x"), p.positionY = c.position("y"), p.offsetX = 0, p.offsetY = 0, p.height = y.w, p.width = y.h, p.maxX = p.positionX + p.width / 2, p.minX = p.positionX - p.width / 2, p.maxY = p.positionY + p.height / 2, p.minY = p.positionY - p.height / 2, p.padLeft = parseFloat(c.style("padding")), p.padRight = parseFloat(c.style("padding")), p.padTop = parseFloat(c.style("padding")), p.padBottom = parseFloat(c.style("padding")), p.nodeRepulsion = H(a.nodeRepulsion) ? a.nodeRepulsion(c) : a.nodeRepulsion, o.layoutNodes.push(p), o.idToIndex[p.id] = f;
11046 }
11047 for (var g = [], m = 0, b = -1, E = [], f = 0; f < o.nodeSize; f++) {
11048 var c = o.layoutNodes[f], M = c.parentId;
11049 M != null ? o.layoutNodes[o.idToIndex[M]].children.push(c.id) : (g[++b] = c.id, E.push(c.id));
11050 }
11051 for (o.graphSet.push(E); m <= b; ) {
11052 var L = g[m++], w = o.idToIndex[L], d = o.layoutNodes[w], k = d.children;
11053 if (k.length > 0) {
11054 o.graphSet.push(k);
11055 for (var f = 0; f < k.length; f++)
11056 g[++b] = k[f];
11057 }
11058 }
11059 for (var f = 0; f < o.graphSet.length; f++)
11060 for (var D = o.graphSet[f], v = 0; v < D.length; v++) {
11061 var F = o.idToIndex[D[v]];
11062 o.indexToGraph[F] = f;
11063 }
11064 for (var f = 0; f < o.edgeSize; f++) {
11065 var G = n[f], N = {};
11066 N.id = G.data("id"), N.sourceId = G.data("source"), N.targetId = G.data("target");
11067 var X = H(a.idealEdgeLength) ? a.idealEdgeLength(G) : a.idealEdgeLength, B = H(a.edgeElasticity) ? a.edgeElasticity(G) : a.edgeElasticity, re = o.idToIndex[N.sourceId], K = o.idToIndex[N.targetId], W = o.indexToGraph[re], ae = o.indexToGraph[K];
11068 if (W != ae) {
11069 for (var ue = Xd(N.sourceId, N.targetId, o), me = o.graphSet[ue], ie = 0, p = o.layoutNodes[re]; me.indexOf(p.id) === -1; )
11070 p = o.layoutNodes[o.idToIndex[p.parentId]], ie++;
11071 for (p = o.layoutNodes[K]; me.indexOf(p.id) === -1; )
11072 p = o.layoutNodes[o.idToIndex[p.parentId]], ie++;
11073 X *= ie * a.nestingFactor;
11074 }
11075 N.idealLength = X, N.elasticity = B, o.layoutEdges.push(N);
11076 }
11077 return o;
11078 }, Xd = function(e, r, a) {
11079 var n = Wd(e, r, 0, a);
11080 return 2 > n.count ? 0 : n.graph;
11081 }, Wd = function t(e, r, a, n) {
11082 var i = n.graphSet[a];
11083 if (-1 < i.indexOf(e) && -1 < i.indexOf(r))
11084 return {
11085 count: 2,
11086 graph: a
11087 };
11088 for (var s = 0, o = 0; o < i.length; o++) {
11089 var u = i[o], l = n.idToIndex[u], f = n.layoutNodes[l].children;
11090 if (f.length !== 0) {
11091 var h = n.indexToGraph[n.idToIndex[f[0]]], v = t(e, r, h, n);
11092 if (v.count !== 0)
11093 if (v.count === 1) {
11094 if (s++, s === 2)
11095 break;
11096 } else
11097 return v;
11098 }
11099 }
11100 return {
11101 count: s,
11102 graph: a
11103 };
11104 }, qd, Kd = function(e, r) {
11105 for (var a = e.clientWidth, n = e.clientHeight, i = 0; i < e.nodeSize; i++) {
11106 var s = e.layoutNodes[i];
11107 s.children.length === 0 && !s.isLocked && (s.positionX = Math.random() * a, s.positionY = Math.random() * n);
11108 }
11109 }, Ko = function(e, r, a) {
11110 var n = e.boundingBox, i = {
11111 x1: 1 / 0,
11112 x2: -1 / 0,
11113 y1: 1 / 0,
11114 y2: -1 / 0
11115 };
11116 return r.boundingBox && (a.forEach(function(s) {
11117 var o = e.layoutNodes[e.idToIndex[s.data("id")]];
11118 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);
11119 }), i.w = i.x2 - i.x1, i.h = i.y2 - i.y1), function(s, o) {
11120 var u = e.layoutNodes[e.idToIndex[s.data("id")]];
11121 if (r.boundingBox) {
11122 var l = (u.positionX - i.x1) / i.w, f = (u.positionY - i.y1) / i.h;
11123 return {
11124 x: n.x1 + l * n.w,
11125 y: n.y1 + f * n.h
11126 };
11127 } else
11128 return {
11129 x: u.positionX,
11130 y: u.positionY
11131 };
11132 };
11133 }, Zd = function(e, r, a) {
11134 var n = a.layout, i = a.eles.nodes(), s = Ko(e, a, i);
11135 i.positions(s), e.ready !== !0 && (e.ready = !0, n.one("layoutready", a.ready), n.emit({
11136 type: "layoutready",
11137 layout: this
11138 }));
11139 }, Qd = function(e, r, a) {
11140 Jd(e, r), tg(e), rg(e, r), ag(e), ng(e);
11141 }, Jd = function(e, r) {
11142 for (var a = 0; a < e.graphSet.length; a++)
11143 for (var n = e.graphSet[a], i = n.length, s = 0; s < i; s++)
11144 for (var o = e.layoutNodes[e.idToIndex[n[s]]], u = s + 1; u < i; u++) {
11145 var l = e.layoutNodes[e.idToIndex[n[u]]];
11146 jd(o, l, e, r);
11147 }
11148 }, Zo = function(e) {
11149 return -e + 2 * e * Math.random();
11150 }, jd = function(e, r, a, n) {
11151 var i = e.cmptId, s = r.cmptId;
11152 if (!(i !== s && !a.isCompound)) {
11153 var o = r.positionX - e.positionX, u = r.positionY - e.positionY, l = 1;
11154 o === 0 && u === 0 && (o = Zo(l), u = Zo(l));
11155 var f = eg(e, r, o, u);
11156 if (f > 0)
11157 var h = n.nodeOverlap * f, v = Math.sqrt(o * o + u * u), d = h * o / v, c = h * u / v;
11158 else
11159 var y = Hn(e, o, u), p = Hn(r, -1 * o, -1 * u), g = p.x - y.x, m = p.y - y.y, b = g * g + m * m, v = Math.sqrt(b), h = (e.nodeRepulsion + r.nodeRepulsion) / b, d = h * g / v, c = h * m / v;
11160 e.isLocked || (e.offsetX -= d, e.offsetY -= c), r.isLocked || (r.offsetX += d, r.offsetY += c);
11161 }
11162 }, eg = function(e, r, a, n) {
11163 if (a > 0)
11164 var i = e.maxX - r.minX;
11165 else
11166 var i = r.maxX - e.minX;
11167 if (n > 0)
11168 var s = e.maxY - r.minY;
11169 else
11170 var s = r.maxY - e.minY;
11171 return i >= 0 && s >= 0 ? Math.sqrt(i * i + s * s) : 0;
11172 }, Hn = function(e, r, a) {
11173 var n = e.positionX, i = e.positionY, s = e.height || 1, o = e.width || 1, u = a / r, l = s / o, f = {};
11174 return r === 0 && 0 < a || r === 0 && 0 > a ? (f.x = n, f.y = i + s / 2, f) : 0 < r && -1 * l <= u && u <= l ? (f.x = n + o / 2, f.y = i + o * a / 2 / r, f) : 0 > r && -1 * l <= u && u <= l ? (f.x = n - o / 2, f.y = i - o * a / 2 / r, f) : 0 < a && (u <= -1 * l || u >= l) ? (f.x = n + s * r / 2 / a, f.y = i + s / 2, f) : (0 > a && (u <= -1 * l || u >= l) && (f.x = n - s * r / 2 / a, f.y = i - s / 2), f);
11175 }, tg = function(e, r) {
11176 for (var a = 0; a < e.edgeSize; a++) {
11177 var n = e.layoutEdges[a], i = e.idToIndex[n.sourceId], s = e.layoutNodes[i], o = e.idToIndex[n.targetId], u = e.layoutNodes[o], l = u.positionX - s.positionX, f = u.positionY - s.positionY;
11178 if (!(l === 0 && f === 0)) {
11179 var h = Hn(s, l, f), v = Hn(u, -1 * l, -1 * f), d = v.x - h.x, c = v.y - h.y, y = Math.sqrt(d * d + c * c), p = Math.pow(n.idealLength - y, 2) / n.elasticity;
11180 if (y !== 0)
11181 var g = p * d / y, m = p * c / y;
11182 else
11183 var g = 0, m = 0;
11184 s.isLocked || (s.offsetX += g, s.offsetY += m), u.isLocked || (u.offsetX -= g, u.offsetY -= m);
11185 }
11186 }
11187 }, rg = function(e, r) {
11188 if (r.gravity !== 0)
11189 for (var a = 1, n = 0; n < e.graphSet.length; n++) {
11190 var i = e.graphSet[n], s = i.length;
11191 if (n === 0)
11192 var o = e.clientHeight / 2, u = e.clientWidth / 2;
11193 else
11194 var l = e.layoutNodes[e.idToIndex[i[0]]], f = e.layoutNodes[e.idToIndex[l.parentId]], o = f.positionX, u = f.positionY;
11195 for (var h = 0; h < s; h++) {
11196 var v = e.layoutNodes[e.idToIndex[i[h]]];
11197 if (!v.isLocked) {
11198 var d = o - v.positionX, c = u - v.positionY, y = Math.sqrt(d * d + c * c);
11199 if (y > a) {
11200 var p = r.gravity * d / y, g = r.gravity * c / y;
11201 v.offsetX += p, v.offsetY += g;
11202 }
11203 }
11204 }
11205 }
11206 }, ag = function(e, r) {
11207 var a = [], n = 0, i = -1;
11208 for (a.push.apply(a, e.graphSet[0]), i += e.graphSet[0].length; n <= i; ) {
11209 var s = a[n++], o = e.idToIndex[s], u = e.layoutNodes[o], l = u.children;
11210 if (0 < l.length && !u.isLocked) {
11211 for (var f = u.offsetX, h = u.offsetY, v = 0; v < l.length; v++) {
11212 var d = e.layoutNodes[e.idToIndex[l[v]]];
11213 d.offsetX += f, d.offsetY += h, a[++i] = l[v];
11214 }
11215 u.offsetX = 0, u.offsetY = 0;
11216 }
11217 }
11218 }, ng = function(e, r) {
11219 for (var a = 0; a < e.nodeSize; a++) {
11220 var n = e.layoutNodes[a];
11221 0 < n.children.length && (n.maxX = void 0, n.minX = void 0, n.maxY = void 0, n.minY = void 0);
11222 }
11223 for (var a = 0; a < e.nodeSize; a++) {
11224 var n = e.layoutNodes[a];
11225 if (!(0 < n.children.length || n.isLocked)) {
11226 var i = ig(n.offsetX, n.offsetY, e.temperature);
11227 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);
11228 }
11229 }
11230 for (var a = 0; a < e.nodeSize; a++) {
11231 var n = e.layoutNodes[a];
11232 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);
11233 }
11234 }, ig = function(e, r, a) {
11235 var n = Math.sqrt(e * e + r * r);
11236 if (n > a)
11237 var i = {
11238 x: a * e / n,
11239 y: a * r / n
11240 };
11241 else
11242 var i = {
11243 x: e,
11244 y: r
11245 };
11246 return i;
11247 }, sg = function t(e, r) {
11248 var a = e.parentId;
11249 if (a != null) {
11250 var n = r.layoutNodes[r.idToIndex[a]], i = !1;
11251 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)
11252 return t(n, r);
11253 }
11254 }, Qo = function(e, r) {
11255 for (var a = e.layoutNodes, n = [], i = 0; i < a.length; i++) {
11256 var s = a[i], o = s.cmptId, u = n[o] = n[o] || [];
11257 u.push(s);
11258 }
11259 for (var l = 0, i = 0; i < n.length; i++) {
11260 var f = n[i];
11261 if (f) {
11262 f.x1 = 1 / 0, f.x2 = -1 / 0, f.y1 = 1 / 0, f.y2 = -1 / 0;
11263 for (var h = 0; h < f.length; h++) {
11264 var v = f[h];
11265 f.x1 = Math.min(f.x1, v.positionX - v.width / 2), f.x2 = Math.max(f.x2, v.positionX + v.width / 2), f.y1 = Math.min(f.y1, v.positionY - v.height / 2), f.y2 = Math.max(f.y2, v.positionY + v.height / 2);
11266 }
11267 f.w = f.x2 - f.x1, f.h = f.y2 - f.y1, l += f.w * f.h;
11268 }
11269 }
11270 n.sort(function(m, b) {
11271 return b.w * b.h - m.w * m.h;
11272 });
11273 for (var d = 0, c = 0, y = 0, p = 0, g = Math.sqrt(l) * e.clientWidth / e.clientHeight, i = 0; i < n.length; i++) {
11274 var f = n[i];
11275 if (f) {
11276 for (var h = 0; h < f.length; h++) {
11277 var v = f[h];
11278 v.isLocked || (v.positionX += d - f.x1, v.positionY += c - f.y1);
11279 }
11280 d += f.w + r.componentSpacing, y += f.w + r.componentSpacing, p = Math.max(p, f.h), y > g && (c += p + r.componentSpacing, d = 0, y = 0, p = 0);
11281 }
11282 }
11283 }, og = {
11284 fit: !0,
11285 // whether to fit the viewport to the graph
11286 padding: 30,
11287 // padding used on fit
11288 boundingBox: void 0,
11289 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
11290 avoidOverlap: !0,
11291 // prevents node overlap, may overflow boundingBox if not enough space
11292 avoidOverlapPadding: 10,
11293 // extra spacing around nodes when avoidOverlap: true
11294 nodeDimensionsIncludeLabels: !1,
11295 // Excludes the label when calculating node bounding boxes for the layout algorithm
11296 spacingFactor: void 0,
11297 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
11298 condense: !1,
11299 // uses all available space on false, uses minimal space on true
11300 rows: void 0,
11301 // force num of rows in the grid
11302 cols: void 0,
11303 // force num of columns in the grid
11304 position: function(e) {
11305 },
11306 // returns { row, col } for element
11307 sort: void 0,
11308 // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
11309 animate: !1,
11310 // whether to transition the node positions
11311 animationDuration: 500,
11312 // duration of animation in ms if enabled
11313 animationEasing: void 0,
11314 // easing of animation if enabled
11315 animateFilter: function(e, r) {
11316 return !0;
11317 },
11318 // 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
11319 ready: void 0,
11320 // callback on layoutready
11321 stop: void 0,
11322 // callback on layoutstop
11323 transform: function(e, r) {
11324 return r;
11325 }
11326 // transform a given node position. Useful for changing flow direction in discrete layouts
11327 };
11328 function Jo(t) {
11329 this.options = He({}, og, t);
11330 }
11331 Jo.prototype.run = function() {
11332 var t = this.options, e = t, r = t.cy, a = e.eles, n = a.nodes().not(":parent");
11333 e.sort && (n = n.sort(e.sort));
11334 var i = Yt(e.boundingBox ? e.boundingBox : {
11335 x1: 0,
11336 y1: 0,
11337 w: r.width(),
11338 h: r.height()
11339 });
11340 if (i.h === 0 || i.w === 0)
11341 a.nodes().layoutPositions(this, e, function(Ee) {
11342 return {
11343 x: i.x1,
11344 y: i.y1
11345 };
11346 });
11347 else {
11348 var s = n.size(), o = Math.sqrt(s * i.h / i.w), u = Math.round(o), l = Math.round(i.w / i.h * o), f = function(Ce) {
11349 if (Ce == null)
11350 return Math.min(u, l);
11351 var we = Math.min(u, l);
11352 we == u ? u = Ce : l = Ce;
11353 }, h = function(Ce) {
11354 if (Ce == null)
11355 return Math.max(u, l);
11356 var we = Math.max(u, l);
11357 we == u ? u = Ce : l = Ce;
11358 }, v = e.rows, d = e.cols != null ? e.cols : e.columns;
11359 if (v != null && d != null)
11360 u = v, l = d;
11361 else if (v != null && d == null)
11362 u = v, l = Math.ceil(s / u);
11363 else if (v == null && d != null)
11364 l = d, u = Math.ceil(s / l);
11365 else if (l * u > s) {
11366 var c = f(), y = h();
11367 (c - 1) * y >= s ? f(c - 1) : (y - 1) * c >= s && h(y - 1);
11368 } else
11369 for (; l * u < s; ) {
11370 var p = f(), g = h();
11371 (g + 1) * p >= s ? h(g + 1) : f(p + 1);
11372 }
11373 var m = i.w / l, b = i.h / u;
11374 if (e.condense && (m = 0, b = 0), e.avoidOverlap)
11375 for (var E = 0; E < n.length; E++) {
11376 var M = n[E], L = M._private.position;
11377 (L.x == null || L.y == null) && (L.x = 0, L.y = 0);
11378 var w = M.layoutDimensions(e), k = e.avoidOverlapPadding, D = w.w + k, F = w.h + k;
11379 m = Math.max(m, D), b = Math.max(b, F);
11380 }
11381 for (var G = {}, N = function(Ce, we) {
11382 return !!G["c-" + Ce + "-" + we];
11383 }, X = function(Ce, we) {
11384 G["c-" + Ce + "-" + we] = !0;
11385 }, B = 0, re = 0, K = function() {
11386 re++, re >= l && (re = 0, B++);
11387 }, W = {}, ae = 0; ae < n.length; ae++) {
11388 var ue = n[ae], me = e.position(ue);
11389 if (me && (me.row !== void 0 || me.col !== void 0)) {
11390 var ie = {
11391 row: me.row,
11392 col: me.col
11393 };
11394 if (ie.col === void 0)
11395 for (ie.col = 0; N(ie.row, ie.col); )
11396 ie.col++;
11397 else if (ie.row === void 0)
11398 for (ie.row = 0; N(ie.row, ie.col); )
11399 ie.row++;
11400 W[ue.id()] = ie, X(ie.row, ie.col);
11401 }
11402 }
11403 var ge = function(Ce, we) {
11404 var De, se;
11405 if (Ce.locked() || Ce.isParent())
11406 return !1;
11407 var xe = W[Ce.id()];
11408 if (xe)
11409 De = xe.col * m + m / 2 + i.x1, se = xe.row * b + b / 2 + i.y1;
11410 else {
11411 for (; N(B, re); )
11412 K();
11413 De = re * m + m / 2 + i.x1, se = B * b + b / 2 + i.y1, X(B, re), K();
11414 }
11415 return {
11416 x: De,
11417 y: se
11418 };
11419 };
11420 n.layoutPositions(this, e, ge);
11421 }
11422 return this;
11423 };
11424 var lg = {
11425 ready: function() {
11426 },
11427 // on layoutready
11428 stop: function() {
11429 }
11430 // on layoutstop
11431 };
11432 function Bi(t) {
11433 this.options = He({}, lg, t);
11434 }
11435 Bi.prototype.run = function() {
11436 var t = this.options, e = t.eles, r = this;
11437 return t.cy, r.emit("layoutstart"), e.nodes().positions(function() {
11438 return {
11439 x: 0,
11440 y: 0
11441 };
11442 }), r.one("layoutready", t.ready), r.emit("layoutready"), r.one("layoutstop", t.stop), r.emit("layoutstop"), this;
11443 }, Bi.prototype.stop = function() {
11444 return this;
11445 };
11446 var ug = {
11447 positions: void 0,
11448 // map of (node id) => (position obj); or function(node){ return somPos; }
11449 zoom: void 0,
11450 // the zoom level to set (prob want fit = false if set)
11451 pan: void 0,
11452 // the pan level to set (prob want fit = false if set)
11453 fit: !0,
11454 // whether to fit to viewport
11455 padding: 30,
11456 // padding on fit
11457 spacingFactor: void 0,
11458 // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
11459 animate: !1,
11460 // whether to transition the node positions
11461 animationDuration: 500,
11462 // duration of animation in ms if enabled
11463 animationEasing: void 0,
11464 // easing of animation if enabled
11465 animateFilter: function(e, r) {
11466 return !0;
11467 },
11468 // 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
11469 ready: void 0,
11470 // callback on layoutready
11471 stop: void 0,
11472 // callback on layoutstop
11473 transform: function(e, r) {
11474 return r;
11475 }
11476 // transform a given node position. Useful for changing flow direction in discrete layouts
11477 };
11478 function jo(t) {
11479 this.options = He({}, ug, t);
11480 }
11481 jo.prototype.run = function() {
11482 var t = this.options, e = t.eles, r = e.nodes(), a = H(t.positions);
11483 function n(i) {
11484 if (t.positions == null)
11485 return cf(i.position());
11486 if (a)
11487 return t.positions(i);
11488 var s = t.positions[i._private.data.id];
11489 return s ?? null;
11490 }
11491 return r.layoutPositions(this, t, function(i, s) {
11492 var o = n(i);
11493 return i.locked() || o == null ? !1 : o;
11494 }), this;
11495 };
11496 var fg = {
11497 fit: !0,
11498 // whether to fit to viewport
11499 padding: 30,
11500 // fit padding
11501 boundingBox: void 0,
11502 // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
11503 animate: !1,
11504 // whether to transition the node positions
11505 animationDuration: 500,
11506 // duration of animation in ms if enabled
11507 animationEasing: void 0,
11508 // easing of animation if enabled
11509 animateFilter: function(e, r) {
11510 return !0;
11511 },
11512 // 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
11513 ready: void 0,
11514 // callback on layoutready
11515 stop: void 0,
11516 // callback on layoutstop
11517 transform: function(e, r) {
11518 return r;
11519 }
11520 // transform a given node position. Useful for changing flow direction in discrete layouts
11521 };
11522 function el(t) {
11523 this.options = He({}, fg, t);
11524 }
11525 el.prototype.run = function() {
11526 var t = this.options, e = t.cy, r = t.eles, a = Yt(t.boundingBox ? t.boundingBox : {
11527 x1: 0,
11528 y1: 0,
11529 w: e.width(),
11530 h: e.height()
11531 }), n = function(s, o) {
11532 return {
11533 x: a.x1 + Math.round(Math.random() * a.w),
11534 y: a.y1 + Math.round(Math.random() * a.h)
11535 };
11536 };
11537 return r.nodes().layoutPositions(this, t, n), this;
11538 };
11539 var hg = [{
11540 name: "breadthfirst",
11541 impl: Xo
11542 }, {
11543 name: "circle",
11544 impl: Wo
11545 }, {
11546 name: "concentric",
11547 impl: qo
11548 }, {
11549 name: "cose",
11550 impl: Yn
11551 }, {
11552 name: "grid",
11553 impl: Jo
11554 }, {
11555 name: "null",
11556 impl: Bi
11557 }, {
11558 name: "preset",
11559 impl: jo
11560 }, {
11561 name: "random",
11562 impl: el
11563 }];
11564 function tl(t) {
11565 this.options = t, this.notifications = 0;
11566 }
11567 var rl = function() {
11568 }, al = function() {
11569 throw new Error("A headless instance can not render images");
11570 };
11571 tl.prototype = {
11572 recalculateRenderedStyle: rl,
11573 notify: function() {
11574 this.notifications++;
11575 },
11576 init: rl,
11577 isHeadless: function() {
11578 return !0;
11579 },
11580 png: al,
11581 jpg: al
11582 };
11583 var Fi = {};
11584 Fi.arrowShapeWidth = 0.3, Fi.registerArrowShapes = function() {
11585 var t = this.arrowShapes = {}, e = this, r = function(l, f, h, v, d, c, y) {
11586 var p = d.x - h / 2 - y, g = d.x + h / 2 + y, m = d.y - h / 2 - y, b = d.y + h / 2 + y, E = p <= l && l <= g && m <= f && f <= b;
11587 return E;
11588 }, a = function(l, f, h, v, d) {
11589 var c = l * Math.cos(v) - f * Math.sin(v), y = l * Math.sin(v) + f * Math.cos(v), p = c * h, g = y * h, m = p + d.x, b = g + d.y;
11590 return {
11591 x: m,
11592 y: b
11593 };
11594 }, n = function(l, f, h, v) {
11595 for (var d = [], c = 0; c < l.length; c += 2) {
11596 var y = l[c], p = l[c + 1];
11597 d.push(a(y, p, f, h, v));
11598 }
11599 return d;
11600 }, i = function(l) {
11601 for (var f = [], h = 0; h < l.length; h++) {
11602 var v = l[h];
11603 f.push(v.x, v.y);
11604 }
11605 return f;
11606 }, s = function(l) {
11607 return l.pstyle("width").pfValue * l.pstyle("arrow-scale").pfValue * 2;
11608 }, o = function(l, f) {
11609 ee(f) && (f = t[f]), t[l] = He({
11610 name: l,
11611 points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3],
11612 collide: function(v, d, c, y, p, g) {
11613 var m = i(n(this.points, c + 2 * g, y, p)), b = Ht(v, d, m);
11614 return b;
11615 },
11616 roughCollide: r,
11617 draw: function(v, d, c, y) {
11618 var p = n(this.points, d, c, y);
11619 e.arrowShapeImpl("polygon")(v, p);
11620 },
11621 spacing: function(v) {
11622 return 0;
11623 },
11624 gap: s
11625 }, f);
11626 };
11627 o("none", {
11628 collide: fn,
11629 roughCollide: fn,
11630 draw: si,
11631 spacing: ds,
11632 gap: ds
11633 }), o("triangle", {
11634 points: [-0.15, -0.3, 0, 0, 0.15, -0.3]
11635 }), o("arrow", "triangle"), o("triangle-backcurve", {
11636 points: t.triangle.points,
11637 controlPoint: [0, -0.15],
11638 roughCollide: r,
11639 draw: function(l, f, h, v, d) {
11640 var c = n(this.points, f, h, v), y = this.controlPoint, p = a(y[0], y[1], f, h, v);
11641 e.arrowShapeImpl(this.name)(l, c, p);
11642 },
11643 gap: function(l) {
11644 return s(l) * 0.8;
11645 }
11646 }), o("triangle-tee", {
11647 points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
11648 pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4],
11649 collide: function(l, f, h, v, d, c, y) {
11650 var p = i(n(this.points, h + 2 * y, v, d)), g = i(n(this.pointsTee, h + 2 * y, v, d)), m = Ht(l, f, p) || Ht(l, f, g);
11651 return m;
11652 },
11653 draw: function(l, f, h, v, d) {
11654 var c = n(this.points, f, h, v), y = n(this.pointsTee, f, h, v);
11655 e.arrowShapeImpl(this.name)(l, c, y);
11656 }
11657 }), o("circle-triangle", {
11658 radius: 0.15,
11659 pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15],
11660 collide: function(l, f, h, v, d, c, y) {
11661 var p = d, g = Math.pow(p.x - l, 2) + Math.pow(p.y - f, 2) <= Math.pow((h + 2 * y) * this.radius, 2), m = i(n(this.points, h + 2 * y, v, d));
11662 return Ht(l, f, m) || g;
11663 },
11664 draw: function(l, f, h, v, d) {
11665 var c = n(this.pointsTr, f, h, v);
11666 e.arrowShapeImpl(this.name)(l, c, v.x, v.y, this.radius * f);
11667 },
11668 spacing: function(l) {
11669 return e.getArrowWidth(l.pstyle("width").pfValue, l.pstyle("arrow-scale").value) * this.radius;
11670 }
11671 }), o("triangle-cross", {
11672 points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
11673 baseCrossLinePts: [
11674 -0.15,
11675 -0.4,
11676 // first half of the rectangle
11677 -0.15,
11678 -0.4,
11679 0.15,
11680 -0.4,
11681 // second half of the rectangle
11682 0.15,
11683 -0.4
11684 ],
11685 crossLinePts: function(l, f) {
11686 var h = this.baseCrossLinePts.slice(), v = f / l, d = 3, c = 5;
11687 return h[d] = h[d] - v, h[c] = h[c] - v, h;
11688 },
11689 collide: function(l, f, h, v, d, c, y) {
11690 var p = i(n(this.points, h + 2 * y, v, d)), g = i(n(this.crossLinePts(h, c), h + 2 * y, v, d)), m = Ht(l, f, p) || Ht(l, f, g);
11691 return m;
11692 },
11693 draw: function(l, f, h, v, d) {
11694 var c = n(this.points, f, h, v), y = n(this.crossLinePts(f, d), f, h, v);
11695 e.arrowShapeImpl(this.name)(l, c, y);
11696 }
11697 }), o("vee", {
11698 points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15],
11699 gap: function(l) {
11700 return s(l) * 0.525;
11701 }
11702 }), o("circle", {
11703 radius: 0.15,
11704 collide: function(l, f, h, v, d, c, y) {
11705 var p = d, g = Math.pow(p.x - l, 2) + Math.pow(p.y - f, 2) <= Math.pow((h + 2 * y) * this.radius, 2);
11706 return g;
11707 },
11708 draw: function(l, f, h, v, d) {
11709 e.arrowShapeImpl(this.name)(l, v.x, v.y, this.radius * f);
11710 },
11711 spacing: function(l) {
11712 return e.getArrowWidth(l.pstyle("width").pfValue, l.pstyle("arrow-scale").value) * this.radius;
11713 }
11714 }), o("tee", {
11715 points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0],
11716 spacing: function(l) {
11717 return 1;
11718 },
11719 gap: function(l) {
11720 return 1;
11721 }
11722 }), o("square", {
11723 points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3]
11724 }), o("diamond", {
11725 points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0],
11726 gap: function(l) {
11727 return l.pstyle("width").pfValue * l.pstyle("arrow-scale").value;
11728 }
11729 }), o("chevron", {
11730 points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15],
11731 gap: function(l) {
11732 return 0.95 * l.pstyle("width").pfValue * l.pstyle("arrow-scale").value;
11733 }
11734 });
11735 };
11736 var $r = {};
11737 $r.projectIntoViewport = function(t, e) {
11738 var r = this.cy, a = this.findContainerClientCoords(), n = a[0], i = a[1], s = a[4], o = r.pan(), u = r.zoom(), l = ((t - n) / s - o.x) / u, f = ((e - i) / s - o.y) / u;
11739 return [l, f];
11740 }, $r.findContainerClientCoords = function() {
11741 if (this.containerBB)
11742 return this.containerBB;
11743 var t = this.container, e = t.getBoundingClientRect(), r = this.cy.window().getComputedStyle(t), a = function(g) {
11744 return parseFloat(r.getPropertyValue(g));
11745 }, n = {
11746 left: a("padding-left"),
11747 right: a("padding-right"),
11748 top: a("padding-top"),
11749 bottom: a("padding-bottom")
11750 }, i = {
11751 left: a("border-left-width"),
11752 right: a("border-right-width"),
11753 top: a("border-top-width"),
11754 bottom: a("border-bottom-width")
11755 }, s = t.clientWidth, o = t.clientHeight, u = n.left + n.right, l = n.top + n.bottom, f = i.left + i.right, h = e.width / (s + f), v = s - u, d = o - l, c = e.left + n.left + i.left, y = e.top + n.top + i.top;
11756 return this.containerBB = [c, y, v, d, h];
11757 }, $r.invalidateContainerClientCoordsCache = function() {
11758 this.containerBB = null;
11759 }, $r.findNearestElement = function(t, e, r, a) {
11760 return this.findNearestElements(t, e, r, a)[0];
11761 }, $r.findNearestElements = function(t, e, r, a) {
11762 var n = this, i = this, s = i.getCachedZSortedEles(), o = [], u = i.cy.zoom(), l = i.cy.hasCompoundNodes(), f = (a ? 24 : 8) / u, h = (a ? 8 : 2) / u, v = (a ? 8 : 2) / u, d = 1 / 0, c, y;
11763 r && (s = s.interactive);
11764 function p(w, k) {
11765 if (w.isNode()) {
11766 if (y)
11767 return;
11768 y = w, o.push(w);
11769 }
11770 if (w.isEdge() && (k == null || k < d))
11771 if (c) {
11772 if (c.pstyle("z-compound-depth").value === w.pstyle("z-compound-depth").value && c.pstyle("z-compound-depth").value === w.pstyle("z-compound-depth").value) {
11773 for (var D = 0; D < o.length; D++)
11774 if (o[D].isEdge()) {
11775 o[D] = w, c = w, d = k ?? d;
11776 break;
11777 }
11778 }
11779 } else
11780 o.push(w), c = w, d = k ?? d;
11781 }
11782 function g(w) {
11783 var k = w.outerWidth() + 2 * h, D = w.outerHeight() + 2 * h, F = k / 2, G = D / 2, N = w.position();
11784 if (N.x - F <= t && t <= N.x + F && N.y - G <= e && e <= N.y + G) {
11785 var X = i.nodeShapes[n.getNodeShape(w)];
11786 if (X.checkPoint(t, e, 0, k, D, N.x, N.y))
11787 return p(w, 0), !0;
11788 }
11789 }
11790 function m(w) {
11791 var k = w._private, D = k.rscratch, F = w.pstyle("width").pfValue, G = w.pstyle("arrow-scale").value, N = F / 2 + f, X = N * N, B = N * 2, ae = k.source, ue = k.target, re;
11792 if (D.edgeType === "segments" || D.edgeType === "straight" || D.edgeType === "haystack") {
11793 for (var K = D.allpts, W = 0; W + 3 < K.length; W += 2)
11794 if (Sf(t, e, K[W], K[W + 1], K[W + 2], K[W + 3], B) && X > (re = If(t, e, K[W], K[W + 1], K[W + 2], K[W + 3])))
11795 return p(w, re), !0;
11796 } else if (D.edgeType === "bezier" || D.edgeType === "multibezier" || D.edgeType === "self" || D.edgeType === "compound") {
11797 for (var K = D.allpts, W = 0; W + 5 < D.allpts.length; W += 4)
11798 if (Lf(t, e, K[W], K[W + 1], K[W + 2], K[W + 3], K[W + 4], K[W + 5], B) && X > (re = Nf(t, e, K[W], K[W + 1], K[W + 2], K[W + 3], K[W + 4], K[W + 5])))
11799 return p(w, re), !0;
11800 }
11801 for (var ae = ae || k.source, ue = ue || k.target, me = n.getArrowWidth(F, G), ie = [{
11802 name: "source",
11803 x: D.arrowStartX,
11804 y: D.arrowStartY,
11805 angle: D.srcArrowAngle
11806 }, {
11807 name: "target",
11808 x: D.arrowEndX,
11809 y: D.arrowEndY,
11810 angle: D.tgtArrowAngle
11811 }, {
11812 name: "mid-source",
11813 x: D.midX,
11814 y: D.midY,
11815 angle: D.midsrcArrowAngle
11816 }, {
11817 name: "mid-target",
11818 x: D.midX,
11819 y: D.midY,
11820 angle: D.midtgtArrowAngle
11821 }], W = 0; W < ie.length; W++) {
11822 var ge = ie[W], Ee = i.arrowShapes[w.pstyle(ge.name + "-arrow-shape").value], Ce = w.pstyle("width").pfValue;
11823 if (Ee.roughCollide(t, e, me, ge.angle, {
11824 x: ge.x,
11825 y: ge.y
11826 }, Ce, f) && Ee.collide(t, e, me, ge.angle, {
11827 x: ge.x,
11828 y: ge.y
11829 }, Ce, f))
11830 return p(w), !0;
11831 }
11832 l && o.length > 0 && (g(ae), g(ue));
11833 }
11834 function b(w, k, D) {
11835 return er(w, k, D);
11836 }
11837 function E(w, k) {
11838 var D = w._private, F = v, G;
11839 k ? G = k + "-" : G = "", w.boundingBox();
11840 var N = D.labelBounds[k || "main"], X = w.pstyle(G + "label").value, B = w.pstyle("text-events").strValue === "yes";
11841 if (!(!B || !X)) {
11842 var re = b(D.rscratch, "labelX", k), K = b(D.rscratch, "labelY", k), W = b(D.rscratch, "labelAngle", k), ae = w.pstyle(G + "text-margin-x").pfValue, ue = w.pstyle(G + "text-margin-y").pfValue, me = N.x1 - F - ae, ie = N.x2 + F - ae, ge = N.y1 - F - ue, Ee = N.y2 + F - ue;
11843 if (W) {
11844 var Ce = Math.cos(W), we = Math.sin(W), De = function(Xe, Ie) {
11845 return Xe = Xe - re, Ie = Ie - K, {
11846 x: Xe * Ce - Ie * we + re,
11847 y: Xe * we + Ie * Ce + K
11848 };
11849 }, se = De(me, ge), xe = De(me, Ee), Le = De(ie, ge), Se = De(ie, Ee), Oe = [
11850 // with the margin added after the rotation is applied
11851 se.x + ae,
11852 se.y + ue,
11853 Le.x + ae,
11854 Le.y + ue,
11855 Se.x + ae,
11856 Se.y + ue,
11857 xe.x + ae,
11858 xe.y + ue
11859 ];
11860 if (Ht(t, e, Oe))
11861 return p(w), !0;
11862 } else if (ta(N, t, e))
11863 return p(w), !0;
11864 }
11865 }
11866 for (var M = s.length - 1; M >= 0; M--) {
11867 var L = s[M];
11868 L.isNode() ? g(L) || E(L) : m(L) || E(L) || E(L, "source") || E(L, "target");
11869 }
11870 return o;
11871 }, $r.getAllInBox = function(t, e, r, a) {
11872 var n = this.getCachedZSortedEles().interactive, i = [], s = Math.min(t, r), o = Math.max(t, r), u = Math.min(e, a), l = Math.max(e, a);
11873 t = s, r = o, e = u, a = l;
11874 for (var f = Yt({
11875 x1: t,
11876 y1: e,
11877 x2: r,
11878 y2: a
11879 }), h = 0; h < n.length; h++) {
11880 var v = n[h];
11881 if (v.isNode()) {
11882 var d = v, c = d.boundingBox({
11883 includeNodes: !0,
11884 includeEdges: !1,
11885 includeLabels: !1
11886 });
11887 fi(f, c) && !Ts(c, f) && i.push(d);
11888 } else {
11889 var y = v, p = y._private, g = p.rscratch;
11890 if (g.startX != null && g.startY != null && !ta(f, g.startX, g.startY) || g.endX != null && g.endY != null && !ta(f, g.endX, g.endY))
11891 continue;
11892 if (g.edgeType === "bezier" || g.edgeType === "multibezier" || g.edgeType === "self" || g.edgeType === "compound" || g.edgeType === "segments" || g.edgeType === "haystack") {
11893 for (var m = p.rstyle.bezierPts || p.rstyle.linePts || p.rstyle.haystackPts, b = !0, E = 0; E < m.length; E++)
11894 if (!Df(f, m[E])) {
11895 b = !1;
11896 break;
11897 }
11898 b && i.push(y);
11899 } else
11900 (g.edgeType === "haystack" || g.edgeType === "straight") && i.push(y);
11901 }
11902 }
11903 return i;
11904 };
11905 var Xn = {};
11906 Xn.calculateArrowAngles = function(t) {
11907 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", u, l, f, h, v, d, g, m;
11908 if (r ? (f = e.haystackPts[0], h = e.haystackPts[1], v = e.haystackPts[2], d = e.haystackPts[3]) : (f = e.arrowStartX, h = e.arrowStartY, v = e.arrowEndX, d = e.arrowEndY), g = e.midX, m = e.midY, i)
11909 u = f - e.segpts[0], l = h - e.segpts[1];
11910 else if (n || s || o || a) {
11911 var c = e.allpts, y = Lt(c[0], c[2], c[4], 0.1), p = Lt(c[1], c[3], c[5], 0.1);
11912 u = f - y, l = h - p;
11913 } else
11914 u = f - g, l = h - m;
11915 e.srcArrowAngle = cn(u, l);
11916 var g = e.midX, m = e.midY;
11917 if (r && (g = (f + v) / 2, m = (h + d) / 2), u = v - f, l = d - h, i) {
11918 var c = e.allpts;
11919 if (c.length / 2 % 2 === 0) {
11920 var b = c.length / 2, E = b - 2;
11921 u = c[b] - c[E], l = c[b + 1] - c[E + 1];
11922 } else {
11923 var b = c.length / 2 - 1, E = b - 2, M = b + 2;
11924 u = c[b] - c[E], l = c[b + 1] - c[E + 1];
11925 }
11926 } else if (n || s || o) {
11927 var c = e.allpts, L = e.ctrlpts, w, k, D, F;
11928 if (L.length / 2 % 2 === 0) {
11929 var G = c.length / 2 - 1, N = G + 2, X = N + 2;
11930 w = Lt(c[G], c[N], c[X], 0), k = Lt(c[G + 1], c[N + 1], c[X + 1], 0), D = Lt(c[G], c[N], c[X], 1e-4), F = Lt(c[G + 1], c[N + 1], c[X + 1], 1e-4);
11931 } else {
11932 var N = c.length / 2 - 1, G = N - 2, X = N + 2;
11933 w = Lt(c[G], c[N], c[X], 0.4999), k = Lt(c[G + 1], c[N + 1], c[X + 1], 0.4999), D = Lt(c[G], c[N], c[X], 0.5), F = Lt(c[G + 1], c[N + 1], c[X + 1], 0.5);
11934 }
11935 u = D - w, l = F - k;
11936 }
11937 if (e.midtgtArrowAngle = cn(u, l), e.midDispX = u, e.midDispY = l, u *= -1, l *= -1, i) {
11938 var c = e.allpts;
11939 if (c.length / 2 % 2 !== 0) {
11940 var b = c.length / 2 - 1, M = b + 2;
11941 u = -(c[M] - c[b]), l = -(c[M + 1] - c[b + 1]);
11942 }
11943 }
11944 if (e.midsrcArrowAngle = cn(u, l), i)
11945 u = v - e.segpts[e.segpts.length - 2], l = d - e.segpts[e.segpts.length - 1];
11946 else if (n || s || o || a) {
11947 var c = e.allpts, B = c.length, y = Lt(c[B - 6], c[B - 4], c[B - 2], 0.9), p = Lt(c[B - 5], c[B - 3], c[B - 1], 0.9);
11948 u = v - y, l = d - p;
11949 } else
11950 u = v - g, l = d - m;
11951 e.tgtArrowAngle = cn(u, l);
11952 }, Xn.getArrowWidth = Xn.getArrowHeight = function(t, e) {
11953 var r = this.arrowWidthCache = this.arrowWidthCache || {}, a = r[t + ", " + e];
11954 return a || (a = Math.max(Math.pow(t * 13.37, 0.9), 29) * e, r[t + ", " + e] = a, a);
11955 };
11956 var Vt = {};
11957 Vt.findMidptPtsEtc = function(t, e) {
11958 var r = e.posPts, a = e.intersectionPts, n = e.vectorNormInverse, i, s = t.pstyle("source-endpoint"), o = t.pstyle("target-endpoint"), u = s.units != null && o.units != null, l = function(M, L, w, k) {
11959 var D = k - L, F = w - M, G = Math.sqrt(F * F + D * D);
11960 return {
11961 x: -D / G,
11962 y: F / G
11963 };
11964 }, f = t.pstyle("edge-distances").value;
11965 switch (f) {
11966 case "node-position":
11967 i = r;
11968 break;
11969 case "intersection":
11970 i = a;
11971 break;
11972 case "endpoints": {
11973 if (u) {
11974 var h = this.manualEndptToPx(t.source()[0], s), v = x(h, 2), d = v[0], c = v[1], y = this.manualEndptToPx(t.target()[0], o), p = x(y, 2), g = p[0], m = p[1], b = {
11975 x1: d,
11976 y1: c,
11977 x2: g,
11978 y2: m
11979 };
11980 n = l(d, c, g, m), i = b;
11981 } else
11982 vt("Edge ".concat(t.id(), " has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")), i = a;
11983 break;
11984 }
11985 }
11986 return {
11987 midptPts: i,
11988 vectorNormInverse: n
11989 };
11990 }, Vt.findHaystackPoints = function(t) {
11991 for (var e = 0; e < t.length; e++) {
11992 var r = t[e], a = r._private, n = a.rscratch;
11993 if (!n.haystack) {
11994 var i = Math.random() * 2 * Math.PI;
11995 n.source = {
11996 x: Math.cos(i),
11997 y: Math.sin(i)
11998 }, i = Math.random() * 2 * Math.PI, n.target = {
11999 x: Math.cos(i),
12000 y: Math.sin(i)
12001 };
12002 }
12003 var s = a.source, o = a.target, u = s.position(), l = o.position(), f = s.width(), h = o.width(), v = s.height(), d = o.height(), c = r.pstyle("haystack-radius").value, y = c / 2;
12004 n.haystackPts = n.allpts = [n.source.x * f * y + u.x, n.source.y * v * y + u.y, n.target.x * h * y + l.x, n.target.y * d * y + l.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);
12005 }
12006 }, Vt.findSegmentsPoints = function(t, e) {
12007 var r = t._private.rscratch, a = t.pstyle("segment-weights"), n = t.pstyle("segment-distances"), i = Math.min(a.pfValue.length, n.pfValue.length);
12008 r.edgeType = "segments", r.segpts = [];
12009 for (var s = 0; s < i; s++) {
12010 var o = a.pfValue[s], u = n.pfValue[s], l = 1 - o, f = o, h = this.findMidptPtsEtc(t, e), v = h.midptPts, d = h.vectorNormInverse, c = {
12011 x: v.x1 * l + v.x2 * f,
12012 y: v.y1 * l + v.y2 * f
12013 };
12014 r.segpts.push(c.x + d.x * u, c.y + d.y * u);
12015 }
12016 }, Vt.findLoopPoints = function(t, e, r, a) {
12017 var n = t._private.rscratch, i = e.dirCounts, s = e.srcPos, o = t.pstyle("control-point-distances"), u = o ? o.pfValue[0] : void 0, l = t.pstyle("loop-direction").pfValue, f = t.pstyle("loop-sweep").pfValue, h = t.pstyle("control-point-step-size").pfValue;
12018 n.edgeType = "self";
12019 var v = r, d = h;
12020 a && (v = 0, d = u);
12021 var c = l - Math.PI / 2, y = c - f / 2, p = c + f / 2, g = l + "_" + f;
12022 v = i[g] === void 0 ? i[g] = 0 : ++i[g], n.ctrlpts = [s.x + Math.cos(y) * 1.4 * d * (v / 3 + 1), s.y + Math.sin(y) * 1.4 * d * (v / 3 + 1), s.x + Math.cos(p) * 1.4 * d * (v / 3 + 1), s.y + Math.sin(p) * 1.4 * d * (v / 3 + 1)];
12023 }, Vt.findCompoundLoopPoints = function(t, e, r, a) {
12024 var n = t._private.rscratch;
12025 n.edgeType = "compound";
12026 var i = e.srcPos, s = e.tgtPos, o = e.srcW, u = e.srcH, l = e.tgtW, f = e.tgtH, h = t.pstyle("control-point-step-size").pfValue, v = t.pstyle("control-point-distances"), d = v ? v.pfValue[0] : void 0, c = r, y = h;
12027 a && (c = 0, y = d);
12028 var p = 50, g = {
12029 x: i.x - o / 2,
12030 y: i.y - u / 2
12031 }, m = {
12032 x: s.x - l / 2,
12033 y: s.y - f / 2
12034 }, b = {
12035 x: Math.min(g.x, m.x),
12036 y: Math.min(g.y, m.y)
12037 }, E = 0.5, M = Math.max(E, Math.log(o * 0.01)), L = Math.max(E, Math.log(l * 0.01));
12038 n.ctrlpts = [b.x, b.y - (1 + Math.pow(p, 1.12) / 100) * y * (c / 3 + 1) * M, b.x - (1 + Math.pow(p, 1.12) / 100) * y * (c / 3 + 1) * L, b.y];
12039 }, Vt.findStraightEdgePoints = function(t) {
12040 t._private.rscratch.edgeType = "straight";
12041 }, Vt.findBezierPoints = function(t, e, r, a, n) {
12042 var i = t._private.rscratch, s = t.pstyle("control-point-step-size").pfValue, o = t.pstyle("control-point-distances"), u = t.pstyle("control-point-weights"), l = o && u ? Math.min(o.value.length, u.value.length) : 1, f = o ? o.pfValue[0] : void 0, h = u.value[0], v = a;
12043 i.edgeType = v ? "multibezier" : "bezier", i.ctrlpts = [];
12044 for (var d = 0; d < l; d++) {
12045 var c = (0.5 - e.eles.length / 2 + r) * s * (n ? -1 : 1), y = void 0, p = Es(c);
12046 v && (f = o ? o.pfValue[d] : s, h = u.value[d]), a ? y = f : y = f !== void 0 ? p * f : void 0;
12047 var g = y !== void 0 ? y : c, m = 1 - h, b = h, E = this.findMidptPtsEtc(t, e), M = E.midptPts, L = E.vectorNormInverse, w = {
12048 x: M.x1 * m + M.x2 * b,
12049 y: M.y1 * m + M.y2 * b
12050 };
12051 i.ctrlpts.push(w.x + L.x * g, w.y + L.y * g);
12052 }
12053 }, Vt.findTaxiPoints = function(t, e) {
12054 var r = t._private.rscratch;
12055 r.edgeType = "segments";
12056 var a = "vertical", n = "horizontal", i = "leftward", s = "rightward", o = "downward", u = "upward", l = "auto", f = e.posPts, h = e.srcW, v = e.srcH, d = e.tgtW, c = e.tgtH, y = t.pstyle("edge-distances").value, p = y !== "node-position", g = t.pstyle("taxi-direction").value, m = g, b = t.pstyle("taxi-turn"), E = b.units === "%", M = b.pfValue, L = M < 0, w = t.pstyle("taxi-turn-min-distance").pfValue, k = p ? (h + d) / 2 : 0, D = p ? (v + c) / 2 : 0, F = f.x2 - f.x1, G = f.y2 - f.y1, N = function(be, Ge) {
12057 return be > 0 ? Math.max(be - Ge, 0) : Math.min(be + Ge, 0);
12058 }, X = N(F, k), B = N(G, D), re = !1;
12059 m === l ? g = Math.abs(X) > Math.abs(B) ? n : a : m === u || m === o ? (g = a, re = !0) : (m === i || m === s) && (g = n, re = !0);
12060 var K = g === a, W = K ? B : X, ae = K ? G : F, ue = Es(ae), me = !1;
12061 !(re && (E || L)) && (m === o && ae < 0 || m === u && ae > 0 || m === i && ae > 0 || m === s && ae < 0) && (ue *= -1, W = ue * Math.abs(W), me = !0);
12062 var ie;
12063 if (E) {
12064 var ge = M < 0 ? 1 + M : M;
12065 ie = ge * W;
12066 } else {
12067 var Ee = M < 0 ? W : 0;
12068 ie = Ee + M * ue;
12069 }
12070 var Ce = function(be) {
12071 return Math.abs(be) < w || Math.abs(be) >= Math.abs(W);
12072 }, we = Ce(ie), De = Ce(Math.abs(W) - Math.abs(ie)), se = we || De;
12073 if (se && !me)
12074 if (K) {
12075 var xe = Math.abs(ae) <= v / 2, Le = Math.abs(F) <= d / 2;
12076 if (xe) {
12077 var Se = (f.x1 + f.x2) / 2, Oe = f.y1, Fe = f.y2;
12078 r.segpts = [Se, Oe, Se, Fe];
12079 } else if (Le) {
12080 var Xe = (f.y1 + f.y2) / 2, Ie = f.x1, Me = f.x2;
12081 r.segpts = [Ie, Xe, Me, Xe];
12082 } else
12083 r.segpts = [f.x1, f.y2];
12084 } else {
12085 var Ue = Math.abs(ae) <= h / 2, ze = Math.abs(G) <= c / 2;
12086 if (Ue) {
12087 var Be = (f.y1 + f.y2) / 2, $e = f.x1, rt = f.x2;
12088 r.segpts = [$e, Be, rt, Be];
12089 } else if (ze) {
12090 var je = (f.x1 + f.x2) / 2, We = f.y1, et = f.y2;
12091 r.segpts = [je, We, je, et];
12092 } else
12093 r.segpts = [f.x2, f.y1];
12094 }
12095 else if (K) {
12096 var he = f.y1 + ie + (p ? v / 2 * ue : 0), O = f.x1, oe = f.x2;
12097 r.segpts = [O, he, oe, he];
12098 } else {
12099 var Te = f.x1 + ie + (p ? h / 2 * ue : 0), ce = f.y1, ye = f.y2;
12100 r.segpts = [Te, ce, Te, ye];
12101 }
12102 }, Vt.tryToCorrectInvalidPoints = function(t, e) {
12103 var r = t._private.rscratch;
12104 if (r.edgeType === "bezier") {
12105 var a = e.srcPos, n = e.tgtPos, i = e.srcW, s = e.srcH, o = e.tgtW, u = e.tgtH, l = e.srcShape, f = e.tgtShape, h = !R(r.startX) || !R(r.startY), v = !R(r.arrowStartX) || !R(r.arrowStartY), d = !R(r.endX) || !R(r.endY), c = !R(r.arrowEndX) || !R(r.arrowEndY), y = 3, p = this.getArrowWidth(t.pstyle("width").pfValue, t.pstyle("arrow-scale").value) * this.arrowShapeWidth, g = y * p, m = Br({
12106 x: r.ctrlpts[0],
12107 y: r.ctrlpts[1]
12108 }, {
12109 x: r.startX,
12110 y: r.startY
12111 }), b = m < g, E = Br({
12112 x: r.ctrlpts[0],
12113 y: r.ctrlpts[1]
12114 }, {
12115 x: r.endX,
12116 y: r.endY
12117 }), M = E < g, L = !1;
12118 if (h || v || b) {
12119 L = !0;
12120 var w = {
12121 // delta
12122 x: r.ctrlpts[0] - a.x,
12123 y: r.ctrlpts[1] - a.y
12124 }, k = Math.sqrt(w.x * w.x + w.y * w.y), D = {
12125 // normalised delta
12126 x: w.x / k,
12127 y: w.y / k
12128 }, F = Math.max(i, s), G = {
12129 // *2 radius guarantees outside shape
12130 x: r.ctrlpts[0] + D.x * 2 * F,
12131 y: r.ctrlpts[1] + D.y * 2 * F
12132 }, N = l.intersectLine(a.x, a.y, i, s, G.x, G.y, 0);
12133 b ? (r.ctrlpts[0] = r.ctrlpts[0] + D.x * (g - m), r.ctrlpts[1] = r.ctrlpts[1] + D.y * (g - m)) : (r.ctrlpts[0] = N[0] + D.x * g, r.ctrlpts[1] = N[1] + D.y * g);
12134 }
12135 if (d || c || M) {
12136 L = !0;
12137 var X = {
12138 // delta
12139 x: r.ctrlpts[0] - n.x,
12140 y: r.ctrlpts[1] - n.y
12141 }, B = Math.sqrt(X.x * X.x + X.y * X.y), re = {
12142 // normalised delta
12143 x: X.x / B,
12144 y: X.y / B
12145 }, K = Math.max(i, s), W = {
12146 // *2 radius guarantees outside shape
12147 x: r.ctrlpts[0] + re.x * 2 * K,
12148 y: r.ctrlpts[1] + re.y * 2 * K
12149 }, ae = f.intersectLine(n.x, n.y, o, u, W.x, W.y, 0);
12150 M ? (r.ctrlpts[0] = r.ctrlpts[0] + re.x * (g - E), r.ctrlpts[1] = r.ctrlpts[1] + re.y * (g - E)) : (r.ctrlpts[0] = ae[0] + re.x * g, r.ctrlpts[1] = ae[1] + re.y * g);
12151 }
12152 L && this.findEndpoints(t);
12153 }
12154 }, Vt.storeAllpts = function(t) {
12155 var e = t._private.rscratch;
12156 if (e.edgeType === "multibezier" || e.edgeType === "bezier" || e.edgeType === "self" || e.edgeType === "compound") {
12157 e.allpts = [], e.allpts.push(e.startX, e.startY);
12158 for (var r = 0; r + 1 < e.ctrlpts.length; r += 2)
12159 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);
12160 e.allpts.push(e.endX, e.endY);
12161 var a, n;
12162 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 = Lt(e.allpts[a], e.allpts[a + 2], e.allpts[a + 4], n), e.midY = Lt(e.allpts[a + 1], e.allpts[a + 3], e.allpts[a + 5], n));
12163 } else if (e.edgeType === "straight")
12164 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;
12165 else if (e.edgeType === "segments")
12166 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) {
12167 var i = e.segpts.length / 2, s = i - 2;
12168 e.midX = (e.segpts[s] + e.segpts[i]) / 2, e.midY = (e.segpts[s + 1] + e.segpts[i + 1]) / 2;
12169 } else {
12170 var o = e.segpts.length / 2 - 1;
12171 e.midX = e.segpts[o], e.midY = e.segpts[o + 1];
12172 }
12173 }, Vt.checkForInvalidEdgeWarning = function(t) {
12174 var e = t[0]._private.rscratch;
12175 e.nodesOverlap || R(e.startX) && R(e.startY) && R(e.endX) && R(e.endY) ? e.loggedErr = !1 : e.loggedErr || (e.loggedErr = !0, vt("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."));
12176 }, Vt.findEdgeControlPoints = function(t) {
12177 var e = this;
12178 if (!(!t || t.length === 0)) {
12179 for (var r = this, a = r.cy, n = a.hasCompoundNodes(), i = {
12180 map: new ur(),
12181 get: function(w) {
12182 var k = this.map.get(w[0]);
12183 return k != null ? k.get(w[1]) : null;
12184 },
12185 set: function(w, k) {
12186 var D = this.map.get(w[0]);
12187 D == null && (D = new ur(), this.map.set(w[0], D)), D.set(w[1], k);
12188 }
12189 }, s = [], o = [], u = 0; u < t.length; u++) {
12190 var l = t[u], f = l._private, h = l.pstyle("curve-style").value;
12191 if (!(l.removed() || !l.takesUpSpace())) {
12192 if (h === "haystack") {
12193 o.push(l);
12194 continue;
12195 }
12196 var v = h === "unbundled-bezier" || h === "segments" || h === "straight" || h === "straight-triangle" || h === "taxi", d = h === "unbundled-bezier" || h === "bezier", c = f.source, y = f.target, p = c.poolIndex(), g = y.poolIndex(), m = [p, g].sort(), b = i.get(m);
12197 b == null && (b = {
12198 eles: []
12199 }, i.set(m, b), s.push(m)), b.eles.push(l), v && (b.hasUnbundled = !0), d && (b.hasBezier = !0);
12200 }
12201 }
12202 for (var E = function(w) {
12203 var k = s[w], D = i.get(k), F = void 0;
12204 if (!D.hasUnbundled) {
12205 var G = D.eles[0].parallelEdges().filter(function(et) {
12206 return et.isBundledBezier();
12207 });
12208 oi(D.eles), G.forEach(function(et) {
12209 return D.eles.push(et);
12210 }), D.eles.sort(function(et, he) {
12211 return et.poolIndex() - he.poolIndex();
12212 });
12213 }
12214 var N = D.eles[0], X = N.source(), B = N.target();
12215 if (X.poolIndex() > B.poolIndex()) {
12216 var re = X;
12217 X = B, B = re;
12218 }
12219 var K = D.srcPos = X.position(), W = D.tgtPos = B.position(), ae = D.srcW = X.outerWidth(), ue = D.srcH = X.outerHeight(), me = D.tgtW = B.outerWidth(), ie = D.tgtH = B.outerHeight(), ge = D.srcShape = r.nodeShapes[e.getNodeShape(X)], Ee = D.tgtShape = r.nodeShapes[e.getNodeShape(B)];
12220 D.dirCounts = {
12221 north: 0,
12222 west: 0,
12223 south: 0,
12224 east: 0,
12225 northwest: 0,
12226 southwest: 0,
12227 northeast: 0,
12228 southeast: 0
12229 };
12230 for (var Ce = 0; Ce < D.eles.length; Ce++) {
12231 var we = D.eles[Ce], De = we[0]._private.rscratch, se = we.pstyle("curve-style").value, xe = se === "unbundled-bezier" || se === "segments" || se === "taxi", Le = !X.same(we.source());
12232 if (!D.calculatedIntersection && X !== B && (D.hasBezier || D.hasUnbundled)) {
12233 D.calculatedIntersection = !0;
12234 var Se = ge.intersectLine(K.x, K.y, ae, ue, W.x, W.y, 0), Oe = D.srcIntn = Se, Fe = Ee.intersectLine(W.x, W.y, me, ie, K.x, K.y, 0), Xe = D.tgtIntn = Fe, Ie = D.intersectionPts = {
12235 x1: Se[0],
12236 x2: Fe[0],
12237 y1: Se[1],
12238 y2: Fe[1]
12239 }, Me = D.posPts = {
12240 x1: K.x,
12241 x2: W.x,
12242 y1: K.y,
12243 y2: W.y
12244 }, Ue = Fe[1] - Se[1], ze = Fe[0] - Se[0], Be = Math.sqrt(ze * ze + Ue * Ue), $e = D.vector = {
12245 x: ze,
12246 y: Ue
12247 }, rt = D.vectorNorm = {
12248 x: $e.x / Be,
12249 y: $e.y / Be
12250 }, je = {
12251 x: -rt.y,
12252 y: rt.x
12253 };
12254 D.nodesOverlap = !R(Be) || Ee.checkPoint(Se[0], Se[1], 0, me, ie, W.x, W.y) || ge.checkPoint(Fe[0], Fe[1], 0, ae, ue, K.x, K.y), D.vectorNormInverse = je, F = {
12255 nodesOverlap: D.nodesOverlap,
12256 dirCounts: D.dirCounts,
12257 calculatedIntersection: !0,
12258 hasBezier: D.hasBezier,
12259 hasUnbundled: D.hasUnbundled,
12260 eles: D.eles,
12261 srcPos: W,
12262 tgtPos: K,
12263 srcW: me,
12264 srcH: ie,
12265 tgtW: ae,
12266 tgtH: ue,
12267 srcIntn: Xe,
12268 tgtIntn: Oe,
12269 srcShape: Ee,
12270 tgtShape: ge,
12271 posPts: {
12272 x1: Me.x2,
12273 y1: Me.y2,
12274 x2: Me.x1,
12275 y2: Me.y1
12276 },
12277 intersectionPts: {
12278 x1: Ie.x2,
12279 y1: Ie.y2,
12280 x2: Ie.x1,
12281 y2: Ie.y1
12282 },
12283 vector: {
12284 x: -$e.x,
12285 y: -$e.y
12286 },
12287 vectorNorm: {
12288 x: -rt.x,
12289 y: -rt.y
12290 },
12291 vectorNormInverse: {
12292 x: -je.x,
12293 y: -je.y
12294 }
12295 };
12296 }
12297 var We = Le ? F : D;
12298 De.nodesOverlap = We.nodesOverlap, De.srcIntn = We.srcIntn, De.tgtIntn = We.tgtIntn, n && (X.isParent() || X.isChild() || B.isParent() || B.isChild()) && (X.parents().anySame(B) || B.parents().anySame(X) || X.same(B) && X.isParent()) ? e.findCompoundLoopPoints(we, We, Ce, xe) : X === B ? e.findLoopPoints(we, We, Ce, xe) : se === "segments" ? e.findSegmentsPoints(we, We) : se === "taxi" ? e.findTaxiPoints(we, We) : se === "straight" || !xe && D.eles.length % 2 === 1 && Ce === Math.floor(D.eles.length / 2) ? e.findStraightEdgePoints(we) : e.findBezierPoints(we, We, Ce, xe, Le), e.findEndpoints(we), e.tryToCorrectInvalidPoints(we, We), e.checkForInvalidEdgeWarning(we), e.storeAllpts(we), e.storeEdgeProjections(we), e.calculateArrowAngles(we), e.recalculateEdgeLabelProjections(we), e.calculateLabelAngles(we);
12299 }
12300 }, M = 0; M < s.length; M++)
12301 E(M);
12302 this.findHaystackPoints(o);
12303 }
12304 };
12305 function nl(t) {
12306 var e = [];
12307 if (t != null) {
12308 for (var r = 0; r < t.length; r += 2) {
12309 var a = t[r], n = t[r + 1];
12310 e.push({
12311 x: a,
12312 y: n
12313 });
12314 }
12315 return e;
12316 }
12317 }
12318 Vt.getSegmentPoints = function(t) {
12319 var e = t[0]._private.rscratch, r = e.edgeType;
12320 if (r === "segments")
12321 return this.recalculateRenderedStyle(t), nl(e.segpts);
12322 }, Vt.getControlPoints = function(t) {
12323 var e = t[0]._private.rscratch, r = e.edgeType;
12324 if (r === "bezier" || r === "multibezier" || r === "self" || r === "compound")
12325 return this.recalculateRenderedStyle(t), nl(e.ctrlpts);
12326 }, Vt.getEdgeMidpoint = function(t) {
12327 var e = t[0]._private.rscratch;
12328 return this.recalculateRenderedStyle(t), {
12329 x: e.midX,
12330 y: e.midY
12331 };
12332 };
12333 var Qa = {};
12334 Qa.manualEndptToPx = function(t, e) {
12335 var r = this, a = t.position(), n = t.outerWidth(), i = t.outerHeight();
12336 if (e.value.length === 2) {
12337 var s = [e.pfValue[0], e.pfValue[1]];
12338 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;
12339 } else {
12340 var o = e.pfValue[0];
12341 o = -Math.PI / 2 + o;
12342 var u = 2 * Math.max(n, i), l = [a.x + Math.cos(o) * u, a.y + Math.sin(o) * u];
12343 return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x, a.y, n, i, l[0], l[1], 0);
12344 }
12345 }, Qa.findEndpoints = function(t) {
12346 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, u = t.pstyle("source-arrow-shape").value, l = t.pstyle("target-distance-from-node").pfValue, f = t.pstyle("source-distance-from-node").pfValue, h = t.pstyle("curve-style").value, v = t._private.rscratch, d = v.edgeType, c = h === "taxi", y = d === "self" || d === "compound", p = d === "bezier" || d === "multibezier" || y, g = d !== "bezier", m = d === "straight" || d === "segments", b = d === "segments", E = p || g || m, M = y || c, L = t.pstyle("source-endpoint"), w = M ? "outside-to-node" : L.value, k = t.pstyle("target-endpoint"), D = M ? "outside-to-node" : k.value;
12347 v.srcManEndpt = L, v.tgtManEndpt = k;
12348 var F, G, N, X;
12349 if (p) {
12350 var B = [v.ctrlpts[0], v.ctrlpts[1]], re = g ? [v.ctrlpts[v.ctrlpts.length - 2], v.ctrlpts[v.ctrlpts.length - 1]] : B;
12351 F = re, G = B;
12352 } else if (m) {
12353 var K = b ? v.segpts.slice(0, 2) : [s.x, s.y], W = b ? v.segpts.slice(v.segpts.length - 2) : [i.x, i.y];
12354 F = W, G = K;
12355 }
12356 if (D === "inside-to-node")
12357 r = [s.x, s.y];
12358 else if (k.units)
12359 r = this.manualEndptToPx(n, k);
12360 else if (D === "outside-to-line")
12361 r = v.tgtIntn;
12362 else if (D === "outside-to-node" || D === "outside-to-node-or-label" ? N = F : (D === "outside-to-line" || D === "outside-to-line-or-label") && (N = [i.x, i.y]), r = e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x, s.y, n.outerWidth(), n.outerHeight(), N[0], N[1], 0), D === "outside-to-node-or-label" || D === "outside-to-line-or-label") {
12363 var ae = n._private.rscratch, ue = ae.labelWidth, me = ae.labelHeight, ie = ae.labelX, ge = ae.labelY, Ee = ue / 2, Ce = me / 2, we = n.pstyle("text-valign").value;
12364 we === "top" ? ge -= Ce : we === "bottom" && (ge += Ce);
12365 var De = n.pstyle("text-halign").value;
12366 De === "left" ? ie -= Ee : De === "right" && (ie += Ee);
12367 var se = Ba(N[0], N[1], [ie - Ee, ge - Ce, ie + Ee, ge - Ce, ie + Ee, ge + Ce, ie - Ee, ge + Ce], s.x, s.y);
12368 if (se.length > 0) {
12369 var xe = i, Le = Fr(xe, jr(r)), Se = Fr(xe, jr(se)), Oe = Le;
12370 if (Se < Le && (r = se, Oe = Se), se.length > 2) {
12371 var Fe = Fr(xe, {
12372 x: se[2],
12373 y: se[3]
12374 });
12375 Fe < Oe && (r = [se[2], se[3]]);
12376 }
12377 }
12378 }
12379 var Xe = mn(r, F, e.arrowShapes[o].spacing(t) + l), Ie = mn(r, F, e.arrowShapes[o].gap(t) + l);
12380 if (v.endX = Ie[0], v.endY = Ie[1], v.arrowEndX = Xe[0], v.arrowEndY = Xe[1], w === "inside-to-node")
12381 r = [i.x, i.y];
12382 else if (L.units)
12383 r = this.manualEndptToPx(a, L);
12384 else if (w === "outside-to-line")
12385 r = v.srcIntn;
12386 else if (w === "outside-to-node" || w === "outside-to-node-or-label" ? X = G : (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") {
12387 var Me = a._private.rscratch, Ue = Me.labelWidth, ze = Me.labelHeight, Be = Me.labelX, $e = Me.labelY, rt = Ue / 2, je = ze / 2, We = a.pstyle("text-valign").value;
12388 We === "top" ? $e -= je : We === "bottom" && ($e += je);
12389 var et = a.pstyle("text-halign").value;
12390 et === "left" ? Be -= rt : et === "right" && (Be += rt);
12391 var he = Ba(X[0], X[1], [Be - rt, $e - je, Be + rt, $e - je, Be + rt, $e + je, Be - rt, $e + je], i.x, i.y);
12392 if (he.length > 0) {
12393 var O = s, oe = Fr(O, jr(r)), Te = Fr(O, jr(he)), ce = oe;
12394 if (Te < oe && (r = [he[0], he[1]], ce = Te), he.length > 2) {
12395 var ye = Fr(O, {
12396 x: he[2],
12397 y: he[3]
12398 });
12399 ye < ce && (r = [he[2], he[3]]);
12400 }
12401 }
12402 }
12403 var _e = mn(r, G, e.arrowShapes[u].spacing(t) + f), be = mn(r, G, e.arrowShapes[u].gap(t) + f);
12404 v.startX = be[0], v.startY = be[1], v.arrowStartX = _e[0], v.arrowStartY = _e[1], E && (!R(v.startX) || !R(v.startY) || !R(v.endX) || !R(v.endY) ? v.badLine = !0 : v.badLine = !1);
12405 }, Qa.getSourceEndpoint = function(t) {
12406 var e = t[0]._private.rscratch;
12407 switch (this.recalculateRenderedStyle(t), e.edgeType) {
12408 case "haystack":
12409 return {
12410 x: e.haystackPts[0],
12411 y: e.haystackPts[1]
12412 };
12413 default:
12414 return {
12415 x: e.arrowStartX,
12416 y: e.arrowStartY
12417 };
12418 }
12419 }, Qa.getTargetEndpoint = function(t) {
12420 var e = t[0]._private.rscratch;
12421 switch (this.recalculateRenderedStyle(t), e.edgeType) {
12422 case "haystack":
12423 return {
12424 x: e.haystackPts[2],
12425 y: e.haystackPts[3]
12426 };
12427 default:
12428 return {
12429 x: e.arrowEndX,
12430 y: e.arrowEndY
12431 };
12432 }
12433 };
12434 var Gi = {};
12435 function vg(t, e, r) {
12436 for (var a = function(l, f, h, v) {
12437 return Lt(l, f, h, v);
12438 }, n = e._private, i = n.rstyle.bezierPts, s = 0; s < t.bezierProjPcts.length; s++) {
12439 var o = t.bezierProjPcts[s];
12440 i.push({
12441 x: a(r[0], r[2], r[4], o),
12442 y: a(r[1], r[3], r[5], o)
12443 });
12444 }
12445 }
12446 Gi.storeEdgeProjections = function(t) {
12447 var e = t._private, r = e.rscratch, a = r.edgeType;
12448 if (e.rstyle.bezierPts = null, e.rstyle.linePts = null, e.rstyle.haystackPts = null, a === "multibezier" || a === "bezier" || a === "self" || a === "compound") {
12449 e.rstyle.bezierPts = [];
12450 for (var n = 0; n + 5 < r.allpts.length; n += 4)
12451 vg(this, t, r.allpts.slice(n, n + 6));
12452 } else if (a === "segments")
12453 for (var i = e.rstyle.linePts = [], n = 0; n + 1 < r.allpts.length; n += 2)
12454 i.push({
12455 x: r.allpts[n],
12456 y: r.allpts[n + 1]
12457 });
12458 else if (a === "haystack") {
12459 var s = r.haystackPts;
12460 e.rstyle.haystackPts = [{
12461 x: s[0],
12462 y: s[1]
12463 }, {
12464 x: s[2],
12465 y: s[3]
12466 }];
12467 }
12468 e.rstyle.arrowWidth = this.getArrowWidth(t.pstyle("width").pfValue, t.pstyle("arrow-scale").value) * this.arrowShapeWidth;
12469 }, Gi.recalculateEdgeProjections = function(t) {
12470 this.findEdgeControlPoints(t);
12471 };
12472 var hr = {};
12473 hr.recalculateNodeLabelProjection = function(t) {
12474 var e = t.pstyle("label").strValue;
12475 if (!Re(e)) {
12476 var r, a, n = t._private, i = t.width(), s = t.height(), o = t.padding(), u = t.position(), l = t.pstyle("text-halign").strValue, f = t.pstyle("text-valign").strValue, h = n.rscratch, v = n.rstyle;
12477 switch (l) {
12478 case "left":
12479 r = u.x - i / 2 - o;
12480 break;
12481 case "right":
12482 r = u.x + i / 2 + o;
12483 break;
12484 default:
12485 r = u.x;
12486 }
12487 switch (f) {
12488 case "top":
12489 a = u.y - s / 2 - o;
12490 break;
12491 case "bottom":
12492 a = u.y + s / 2 + o;
12493 break;
12494 default:
12495 a = u.y;
12496 }
12497 h.labelX = r, h.labelY = a, v.labelX = r, v.labelY = a, this.calculateLabelAngles(t), this.applyLabelDimensions(t);
12498 }
12499 };
12500 var il = function(e, r) {
12501 var a = Math.atan(r / e);
12502 return e === 0 && a < 0 && (a = a * -1), a;
12503 }, sl = function(e, r) {
12504 var a = r.x - e.x, n = r.y - e.y;
12505 return il(a, n);
12506 }, cg = function(e, r, a, n) {
12507 var i = ka(0, n - 1e-3, 1), s = ka(0, n + 1e-3, 1), o = ea(e, r, a, i), u = ea(e, r, a, s);
12508 return sl(o, u);
12509 };
12510 hr.recalculateEdgeLabelProjections = function(t) {
12511 var e, r = t._private, a = r.rscratch, n = this, i = {
12512 mid: t.pstyle("label").strValue,
12513 source: t.pstyle("source-label").strValue,
12514 target: t.pstyle("target-label").strValue
12515 };
12516 if (i.mid || i.source || i.target) {
12517 e = {
12518 x: a.midX,
12519 y: a.midY
12520 };
12521 var s = function(h, v, d) {
12522 Tr(r.rscratch, h, v, d), Tr(r.rstyle, h, v, d);
12523 };
12524 s("labelX", null, e.x), s("labelY", null, e.y);
12525 var o = il(a.midDispX, a.midDispY);
12526 s("labelAutoAngle", null, o);
12527 var u = function f() {
12528 if (f.cache)
12529 return f.cache;
12530 for (var h = [], v = 0; v + 5 < a.allpts.length; v += 4) {
12531 var d = {
12532 x: a.allpts[v],
12533 y: a.allpts[v + 1]
12534 }, c = {
12535 x: a.allpts[v + 2],
12536 y: a.allpts[v + 3]
12537 }, y = {
12538 x: a.allpts[v + 4],
12539 y: a.allpts[v + 5]
12540 };
12541 h.push({
12542 p0: d,
12543 p1: c,
12544 p2: y,
12545 startDist: 0,
12546 length: 0,
12547 segments: []
12548 });
12549 }
12550 var p = r.rstyle.bezierPts, g = n.bezierProjPcts.length;
12551 function m(w, k, D, F, G) {
12552 var N = Br(k, D), X = w.segments[w.segments.length - 1], B = {
12553 p0: k,
12554 p1: D,
12555 t0: F,
12556 t1: G,
12557 startDist: X ? X.startDist + X.length : 0,
12558 length: N
12559 };
12560 w.segments.push(B), w.length += N;
12561 }
12562 for (var b = 0; b < h.length; b++) {
12563 var E = h[b], M = h[b - 1];
12564 M && (E.startDist = M.startDist + M.length), m(E, E.p0, p[b * g], 0, n.bezierProjPcts[0]);
12565 for (var L = 0; L < g - 1; L++)
12566 m(E, p[b * g + L], p[b * g + L + 1], n.bezierProjPcts[L], n.bezierProjPcts[L + 1]);
12567 m(E, p[b * g + g - 1], E.p2, n.bezierProjPcts[g - 1], 1);
12568 }
12569 return f.cache = h;
12570 }, l = function(h) {
12571 var v, d = h === "source";
12572 if (i[h]) {
12573 var c = t.pstyle(h + "-text-offset").pfValue;
12574 switch (a.edgeType) {
12575 case "self":
12576 case "compound":
12577 case "bezier":
12578 case "multibezier": {
12579 for (var y = u(), p, g = 0, m = 0, b = 0; b < y.length; b++) {
12580 for (var E = y[d ? b : y.length - 1 - b], M = 0; M < E.segments.length; M++) {
12581 var L = E.segments[d ? M : E.segments.length - 1 - M], w = b === y.length - 1 && M === E.segments.length - 1;
12582 if (g = m, m += L.length, m >= c || w) {
12583 p = {
12584 cp: E,
12585 segment: L
12586 };
12587 break;
12588 }
12589 }
12590 if (p)
12591 break;
12592 }
12593 var k = p.cp, D = p.segment, F = (c - g) / D.length, G = D.t1 - D.t0, N = d ? D.t0 + G * F : D.t1 - G * F;
12594 N = ka(0, N, 1), e = ea(k.p0, k.p1, k.p2, N), v = cg(k.p0, k.p1, k.p2, N);
12595 break;
12596 }
12597 case "straight":
12598 case "segments":
12599 case "haystack": {
12600 for (var X = 0, B, re, K, W, ae = a.allpts.length, ue = 0; ue + 3 < ae && (d ? (K = {
12601 x: a.allpts[ue],
12602 y: a.allpts[ue + 1]
12603 }, W = {
12604 x: a.allpts[ue + 2],
12605 y: a.allpts[ue + 3]
12606 }) : (K = {
12607 x: a.allpts[ae - 2 - ue],
12608 y: a.allpts[ae - 1 - ue]
12609 }, W = {
12610 x: a.allpts[ae - 4 - ue],
12611 y: a.allpts[ae - 3 - ue]
12612 }), B = Br(K, W), re = X, X += B, !(X >= c)); ue += 2)
12613 ;
12614 var me = c - re, ie = me / B;
12615 ie = ka(0, ie, 1), e = Ef(K, W, ie), v = sl(K, W);
12616 break;
12617 }
12618 }
12619 s("labelX", h, e.x), s("labelY", h, e.y), s("labelAutoAngle", h, v);
12620 }
12621 };
12622 l("source"), l("target"), this.applyLabelDimensions(t);
12623 }
12624 }, hr.applyLabelDimensions = function(t) {
12625 this.applyPrefixedLabelDimensions(t), t.isEdge() && (this.applyPrefixedLabelDimensions(t, "source"), this.applyPrefixedLabelDimensions(t, "target"));
12626 }, hr.applyPrefixedLabelDimensions = function(t, e) {
12627 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) || [], u = s !== "wrap" ? 1 : Math.max(o.length, 1), l = n.height / u, f = l * i, h = n.width, v = n.height + (u - 1) * (i - 1) * l;
12628 Tr(r.rstyle, "labelWidth", e, h), Tr(r.rscratch, "labelWidth", e, h), Tr(r.rstyle, "labelHeight", e, v), Tr(r.rscratch, "labelHeight", e, v), Tr(r.rscratch, "labelLineHeight", e, f);
12629 }, hr.getLabelText = function(t, e) {
12630 var r = t._private, a = e ? e + "-" : "", n = t.pstyle(a + "label").strValue, i = t.pstyle("text-transform").value, s = function(me, ie) {
12631 return ie ? (Tr(r.rscratch, me, e, ie), ie) : er(r.rscratch, me, e);
12632 };
12633 if (!n)
12634 return "";
12635 i == "none" || (i == "uppercase" ? n = n.toUpperCase() : i == "lowercase" && (n = n.toLowerCase()));
12636 var o = t.pstyle("text-wrap").value;
12637 if (o === "wrap") {
12638 var u = s("labelKey");
12639 if (u != null && s("labelWrapKey") === u)
12640 return s("labelWrapCachedText");
12641 for (var l = "​", f = n.split(`
12642`), h = t.pstyle("text-max-width").pfValue, v = t.pstyle("text-overflow-wrap").value, d = v === "anywhere", c = [], y = /[\s\u200b]+/, p = d ? "" : " ", g = 0; g < f.length; g++) {
12643 var m = f[g], b = this.calculateLabelDimensions(t, m), E = b.width;
12644 if (d) {
12645 var M = m.split("").join(l);
12646 m = M;
12647 }
12648 if (E > h) {
12649 for (var L = m.split(y), w = "", k = 0; k < L.length; k++) {
12650 var D = L[k], F = w.length === 0 ? D : w + p + D, G = this.calculateLabelDimensions(t, F), N = G.width;
12651 N <= h ? w += D + p : (w && c.push(w), w = D + p);
12652 }
12653 w.match(/^[\s\u200b]+$/) || c.push(w);
12654 } else
12655 c.push(m);
12656 }
12657 s("labelWrapCachedLines", c), n = s("labelWrapCachedText", c.join(`
12658`)), s("labelWrapKey", u);
12659 } else if (o === "ellipsis") {
12660 var X = t.pstyle("text-max-width").pfValue, B = "", re = "…", K = !1;
12661 if (this.calculateLabelDimensions(t, n).width < X)
12662 return n;
12663 for (var W = 0; W < n.length; W++) {
12664 var ae = this.calculateLabelDimensions(t, B + n[W] + re).width;
12665 if (ae > X)
12666 break;
12667 B += n[W], W === n.length - 1 && (K = !0);
12668 }
12669 return K || (B += re), B;
12670 }
12671 return n;
12672 }, hr.getLabelJustification = function(t) {
12673 var e = t.pstyle("text-justification").strValue, r = t.pstyle("text-halign").strValue;
12674 if (e === "auto")
12675 if (t.isNode())
12676 switch (r) {
12677 case "left":
12678 return "right";
12679 case "right":
12680 return "left";
12681 default:
12682 return "center";
12683 }
12684 else
12685 return "center";
12686 else
12687 return e;
12688 }, hr.calculateLabelDimensions = function(t, e) {
12689 var r = this, a = Pr(e, t._private.labelDimsKey), n = r.labelDimCache || (r.labelDimCache = []), i = n[a];
12690 if (i != null)
12691 return i;
12692 var s = 0, o = t.pstyle("font-style").strValue, u = t.pstyle("font-size").pfValue, l = t.pstyle("font-family").strValue, f = t.pstyle("font-weight").strValue, h = this.labelCalcCanvas, v = this.labelCalcCanvasContext;
12693 if (!h) {
12694 h = this.labelCalcCanvas = document.createElement("canvas"), v = this.labelCalcCanvasContext = h.getContext("2d");
12695 var d = h.style;
12696 d.position = "absolute", d.left = "-9999px", d.top = "-9999px", d.zIndex = "-1", d.visibility = "hidden", d.pointerEvents = "none";
12697 }
12698 v.font = "".concat(o, " ").concat(f, " ").concat(u, "px ").concat(l);
12699 for (var c = 0, y = 0, p = e.split(`
12700`), g = 0; g < p.length; g++) {
12701 var m = p[g], b = v.measureText(m), E = Math.ceil(b.width), M = u;
12702 c = Math.max(E, c), y += M;
12703 }
12704 return c += s, y += s, n[a] = {
12705 width: c,
12706 height: y
12707 };
12708 }, hr.calculateLabelAngle = function(t, e) {
12709 var r = t._private, a = r.rscratch, n = t.isEdge(), i = e ? e + "-" : "", s = t.pstyle(i + "text-rotation"), o = s.strValue;
12710 return o === "none" ? 0 : n && o === "autorotate" ? a.labelAutoAngle : o === "autorotate" ? 0 : s.pfValue;
12711 }, hr.calculateLabelAngles = function(t) {
12712 var e = this, r = t.isEdge(), a = t._private, n = a.rscratch;
12713 n.labelAngle = e.calculateLabelAngle(t), r && (n.sourceLabelAngle = e.calculateLabelAngle(t, "source"), n.targetLabelAngle = e.calculateLabelAngle(t, "target"));
12714 };
12715 var ol = {}, ll = 28, ul = !1;
12716 ol.getNodeShape = function(t) {
12717 var e = this, r = t.pstyle("shape").value;
12718 if (r === "cutrectangle" && (t.width() < ll || t.height() < ll))
12719 return ul || (vt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"), ul = !0), "rectangle";
12720 if (t.isParent())
12721 return r === "rectangle" || r === "roundrectangle" || r === "round-rectangle" || r === "cutrectangle" || r === "cut-rectangle" || r === "barrel" ? r : "rectangle";
12722 if (r === "polygon") {
12723 var a = t.pstyle("shape-polygon-points").value;
12724 return e.nodeShapes.makePolygon(a).name;
12725 }
12726 return r;
12727 };
12728 var Wn = {};
12729 Wn.registerCalculationListeners = function() {
12730 var t = this.cy, e = t.collection(), r = this, a = function(s) {
12731 var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
12732 if (e.merge(s), o)
12733 for (var u = 0; u < s.length; u++) {
12734 var l = s[u], f = l._private, h = f.rstyle;
12735 h.clean = !1, h.cleanConnected = !1;
12736 }
12737 };
12738 r.binder(t).on("bounds.* dirty.*", function(s) {
12739 var o = s.target;
12740 a(o);
12741 }).on("style.* background.*", function(s) {
12742 var o = s.target;
12743 a(o, !1);
12744 });
12745 var n = function(s) {
12746 if (s) {
12747 var o = r.onUpdateEleCalcsFns;
12748 e.cleanStyle();
12749 for (var u = 0; u < e.length; u++) {
12750 var l = e[u], f = l._private.rstyle;
12751 l.isNode() && !f.cleanConnected && (a(l.connectedEdges()), f.cleanConnected = !0);
12752 }
12753 if (o)
12754 for (var h = 0; h < o.length; h++) {
12755 var v = o[h];
12756 v(s, e);
12757 }
12758 r.recalculateRenderedStyle(e), e = t.collection();
12759 }
12760 };
12761 r.flushRenderedStyleQueue = function() {
12762 n(!0);
12763 }, r.beforeRender(n, r.beforeRenderPriorities.eleCalcs);
12764 }, Wn.onUpdateEleCalcs = function(t) {
12765 var e = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || [];
12766 e.push(t);
12767 }, Wn.recalculateRenderedStyle = function(t, e) {
12768 var r = function(E) {
12769 return E._private.rstyle.cleanConnected;
12770 }, a = [], n = [];
12771 if (!this.destroyed) {
12772 e === void 0 && (e = !0);
12773 for (var i = 0; i < t.length; i++) {
12774 var s = t[i], o = s._private, u = o.rstyle;
12775 s.isEdge() && (!r(s.source()) || !r(s.target())) && (u.clean = !1), !(e && u.clean || s.removed()) && s.pstyle("display").value !== "none" && (o.group === "nodes" ? n.push(s) : a.push(s), u.clean = !0);
12776 }
12777 for (var l = 0; l < n.length; l++) {
12778 var f = n[l], h = f._private, v = h.rstyle, d = f.position();
12779 this.recalculateNodeLabelProjection(f), v.nodeX = d.x, v.nodeY = d.y, v.nodeW = f.pstyle("width").pfValue, v.nodeH = f.pstyle("height").pfValue;
12780 }
12781 this.recalculateEdgeProjections(a);
12782 for (var c = 0; c < a.length; c++) {
12783 var y = a[c], p = y._private, g = p.rstyle, m = p.rscratch;
12784 g.srcX = m.arrowStartX, g.srcY = m.arrowStartY, g.tgtX = m.arrowEndX, g.tgtY = m.arrowEndY, g.midX = m.midX, g.midY = m.midY, g.labelAngle = m.labelAngle, g.sourceLabelAngle = m.sourceLabelAngle, g.targetLabelAngle = m.targetLabelAngle;
12785 }
12786 }
12787 };
12788 var qn = {};
12789 qn.updateCachedGrabbedEles = function() {
12790 var t = this.cachedZSortedEles;
12791 if (t) {
12792 t.drag = [], t.nondrag = [];
12793 for (var e = [], r = 0; r < t.length; r++) {
12794 var a = t[r], n = a._private.rscratch;
12795 a.grabbed() && !a.isParent() ? e.push(a) : n.inDragLayer ? t.drag.push(a) : t.nondrag.push(a);
12796 }
12797 for (var r = 0; r < e.length; r++) {
12798 var a = e[r];
12799 t.drag.push(a);
12800 }
12801 }
12802 }, qn.invalidateCachedZSortedEles = function() {
12803 this.cachedZSortedEles = null;
12804 }, qn.getCachedZSortedEles = function(t) {
12805 if (t || !this.cachedZSortedEles) {
12806 var e = this.cy.mutableElements().toArray();
12807 e.sort(Mo), e.interactive = e.filter(function(r) {
12808 return r.interactive();
12809 }), this.cachedZSortedEles = e, this.updateCachedGrabbedEles();
12810 } else
12811 e = this.cachedZSortedEles;
12812 return e;
12813 };
12814 var fl = {};
12815 [$r, Xn, Vt, Qa, Gi, hr, ol, Wn, qn].forEach(function(t) {
12816 He(fl, t);
12817 });
12818 var hl = {};
12819 hl.getCachedImage = function(t, e, r) {
12820 var a = this, n = a.imageCache = a.imageCache || {}, i = n[t];
12821 if (i)
12822 return i.image.complete || i.image.addEventListener("load", r), i.image;
12823 i = n[t] = n[t] || {};
12824 var s = i.image = new Image();
12825 s.addEventListener("load", r), s.addEventListener("error", function() {
12826 s.error = !0;
12827 });
12828 var o = "data:", u = t.substring(0, o.length).toLowerCase() === o;
12829 return u || (e = e === "null" ? null : e, s.crossOrigin = e), s.src = t, s;
12830 };
12831 var ya = {};
12832 ya.registerBinding = function(t, e, r, a) {
12833 var n = Array.prototype.slice.apply(arguments, [1]), i = this.binder(t);
12834 return i.on.apply(i, n);
12835 }, ya.binder = function(t) {
12836 var e = this, r = e.cy.window(), a = t === r || t === r.document || t === r.document.body || Ve(t);
12837 if (e.supportsPassiveEvents == null) {
12838 var n = !1;
12839 try {
12840 var i = Object.defineProperty({}, "passive", {
12841 get: function() {
12842 return n = !0, !0;
12843 }
12844 });
12845 r.addEventListener("test", null, i);
12846 } catch {
12847 }
12848 e.supportsPassiveEvents = n;
12849 }
12850 var s = function(u, l, f) {
12851 var h = Array.prototype.slice.call(arguments);
12852 return a && e.supportsPassiveEvents && (h[2] = {
12853 capture: f ?? !1,
12854 passive: !1,
12855 once: !1
12856 }), e.bindings.push({
12857 target: t,
12858 args: h
12859 }), (t.addEventListener || t.on).apply(t, h), this;
12860 };
12861 return {
12862 on: s,
12863 addEventListener: s,
12864 addListener: s,
12865 bind: s
12866 };
12867 }, ya.nodeIsDraggable = function(t) {
12868 return t && t.isNode() && !t.locked() && t.grabbable();
12869 }, ya.nodeIsGrabbable = function(t) {
12870 return this.nodeIsDraggable(t) && t.interactive();
12871 }, ya.load = function() {
12872 var t = this, e = t.cy.window(), r = function(O) {
12873 return O.selected();
12874 }, a = function(O, oe, Te, ce) {
12875 O == null && (O = t.cy);
12876 for (var ye = 0; ye < oe.length; ye++) {
12877 var _e = oe[ye];
12878 O.emit({
12879 originalEvent: Te,
12880 type: _e,
12881 position: ce
12882 });
12883 }
12884 }, n = function(O) {
12885 return O.shiftKey || O.metaKey || O.ctrlKey;
12886 }, i = function(O, oe) {
12887 var Te = !0;
12888 if (t.cy.hasCompoundNodes() && O && O.pannable())
12889 for (var ce = 0; oe && ce < oe.length; ce++) {
12890 var O = oe[ce];
12891 if (O.isNode() && O.isParent() && !O.pannable()) {
12892 Te = !1;
12893 break;
12894 }
12895 }
12896 else
12897 Te = !0;
12898 return Te;
12899 }, s = function(O) {
12900 O[0]._private.grabbed = !0;
12901 }, o = function(O) {
12902 O[0]._private.grabbed = !1;
12903 }, u = function(O) {
12904 O[0]._private.rscratch.inDragLayer = !0;
12905 }, l = function(O) {
12906 O[0]._private.rscratch.inDragLayer = !1;
12907 }, f = function(O) {
12908 O[0]._private.rscratch.isGrabTarget = !0;
12909 }, h = function(O) {
12910 O[0]._private.rscratch.isGrabTarget = !1;
12911 }, v = function(O, oe) {
12912 var Te = oe.addToList, ce = Te.has(O);
12913 !ce && O.grabbable() && !O.locked() && (Te.merge(O), s(O));
12914 }, d = function(O, oe) {
12915 if (O.cy().hasCompoundNodes() && !(oe.inDragLayer == null && oe.addToList == null)) {
12916 var Te = O.descendants();
12917 oe.inDragLayer && (Te.forEach(u), Te.connectedEdges().forEach(u)), oe.addToList && v(Te, oe);
12918 }
12919 }, c = function(O, oe) {
12920 oe = oe || {};
12921 var Te = O.cy().hasCompoundNodes();
12922 oe.inDragLayer && (O.forEach(u), O.neighborhood().stdFilter(function(ce) {
12923 return !Te || ce.isEdge();
12924 }).forEach(u)), oe.addToList && O.forEach(function(ce) {
12925 v(ce, oe);
12926 }), d(O, oe), g(O, {
12927 inDragLayer: oe.inDragLayer
12928 }), t.updateCachedGrabbedEles();
12929 }, y = c, p = function(O) {
12930 O && (t.getCachedZSortedEles().forEach(function(oe) {
12931 o(oe), l(oe), h(oe);
12932 }), t.updateCachedGrabbedEles());
12933 }, g = function(O, oe) {
12934 if (!(oe.inDragLayer == null && oe.addToList == null) && O.cy().hasCompoundNodes()) {
12935 var Te = O.ancestors().orphans();
12936 if (!Te.same(O)) {
12937 var ce = Te.descendants().spawnSelf().merge(Te).unmerge(O).unmerge(O.descendants()), ye = ce.connectedEdges();
12938 oe.inDragLayer && (ye.forEach(u), ce.forEach(u)), oe.addToList && ce.forEach(function(_e) {
12939 v(_e, oe);
12940 });
12941 }
12942 }
12943 }, m = function() {
12944 document.activeElement != null && document.activeElement.blur != null && document.activeElement.blur();
12945 }, b = typeof MutationObserver < "u", E = typeof ResizeObserver < "u";
12946 b ? (t.removeObserver = new MutationObserver(function(he) {
12947 for (var O = 0; O < he.length; O++) {
12948 var oe = he[O], Te = oe.removedNodes;
12949 if (Te)
12950 for (var ce = 0; ce < Te.length; ce++) {
12951 var ye = Te[ce];
12952 if (ye === t.container) {
12953 t.destroy();
12954 break;
12955 }
12956 }
12957 }
12958 }), t.container.parentNode && t.removeObserver.observe(t.container.parentNode, {
12959 childList: !0
12960 })) : t.registerBinding(t.container, "DOMNodeRemoved", function(he) {
12961 t.destroy();
12962 });
12963 var M = on(function() {
12964 t.cy.resize();
12965 }, 100);
12966 b && (t.styleObserver = new MutationObserver(M), t.styleObserver.observe(t.container, {
12967 attributes: !0
12968 })), t.registerBinding(e, "resize", M), E && (t.resizeObserver = new ResizeObserver(M), t.resizeObserver.observe(t.container));
12969 var L = function(O, oe) {
12970 for (; O != null; )
12971 oe(O), O = O.parentNode;
12972 }, w = function() {
12973 t.invalidateContainerClientCoordsCache();
12974 };
12975 L(t.container, function(he) {
12976 t.registerBinding(he, "transitionend", w), t.registerBinding(he, "animationend", w), t.registerBinding(he, "scroll", w);
12977 }), t.registerBinding(t.container, "contextmenu", function(he) {
12978 he.preventDefault();
12979 });
12980 var k = function() {
12981 return t.selection[4] !== 0;
12982 }, D = function(O) {
12983 for (var oe = t.findContainerClientCoords(), Te = oe[0], ce = oe[1], ye = oe[2], _e = oe[3], be = O.touches ? O.touches : [O], Ge = !1, Qe = 0; Qe < be.length; Qe++) {
12984 var ft = be[Qe];
12985 if (Te <= ft.clientX && ft.clientX <= Te + ye && ce <= ft.clientY && ft.clientY <= ce + _e) {
12986 Ge = !0;
12987 break;
12988 }
12989 }
12990 if (!Ge)
12991 return !1;
12992 for (var qe = t.container, ot = O.target, Ke = ot.parentNode, Je = !1; Ke; ) {
12993 if (Ke === qe) {
12994 Je = !0;
12995 break;
12996 }
12997 Ke = Ke.parentNode;
12998 }
12999 return !!Je;
13000 };
13001 t.registerBinding(t.container, "mousedown", function(O) {
13002 if (D(O)) {
13003 O.preventDefault(), m(), t.hoverData.capture = !0, t.hoverData.which = O.which;
13004 var oe = t.cy, Te = [O.clientX, O.clientY], ce = t.projectIntoViewport(Te[0], Te[1]), ye = t.selection, _e = t.findNearestElements(ce[0], ce[1], !0, !1), be = _e[0], Ge = t.dragData.possibleDragElements;
13005 t.hoverData.mdownPos = ce, t.hoverData.mdownGPos = Te;
13006 var Qe = function() {
13007 t.hoverData.tapholdCancelled = !1, clearTimeout(t.hoverData.tapholdTimeout), t.hoverData.tapholdTimeout = setTimeout(function() {
13008 if (!t.hoverData.tapholdCancelled) {
13009 var Ct = t.hoverData.down;
13010 Ct ? Ct.emit({
13011 originalEvent: O,
13012 type: "taphold",
13013 position: {
13014 x: ce[0],
13015 y: ce[1]
13016 }
13017 }) : oe.emit({
13018 originalEvent: O,
13019 type: "taphold",
13020 position: {
13021 x: ce[0],
13022 y: ce[1]
13023 }
13024 });
13025 }
13026 }, t.tapholdDuration);
13027 };
13028 if (O.which == 3) {
13029 t.hoverData.cxtStarted = !0;
13030 var ft = {
13031 originalEvent: O,
13032 type: "cxttapstart",
13033 position: {
13034 x: ce[0],
13035 y: ce[1]
13036 }
13037 };
13038 be ? (be.activate(), be.emit(ft), t.hoverData.down = be) : oe.emit(ft), t.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(), t.hoverData.cxtDragged = !1;
13039 } else if (O.which == 1) {
13040 be && be.activate();
13041 {
13042 if (be != null && t.nodeIsGrabbable(be)) {
13043 var qe = function(Ct) {
13044 return {
13045 originalEvent: O,
13046 type: Ct,
13047 position: {
13048 x: ce[0],
13049 y: ce[1]
13050 }
13051 };
13052 }, ot = function(Ct) {
13053 Ct.emit(qe("grab"));
13054 };
13055 if (f(be), !be.selected())
13056 Ge = t.dragData.possibleDragElements = oe.collection(), y(be, {
13057 addToList: Ge
13058 }), be.emit(qe("grabon")).emit(qe("grab"));
13059 else {
13060 Ge = t.dragData.possibleDragElements = oe.collection();
13061 var Ke = oe.$(function(Je) {
13062 return Je.isNode() && Je.selected() && t.nodeIsGrabbable(Je);
13063 });
13064 c(Ke, {
13065 addToList: Ge
13066 }), be.emit(qe("grabon")), Ke.forEach(ot);
13067 }
13068 t.redrawHint("eles", !0), t.redrawHint("drag", !0);
13069 }
13070 t.hoverData.down = be, t.hoverData.downs = _e, t.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime();
13071 }
13072 a(be, ["mousedown", "tapstart", "vmousedown"], O, {
13073 x: ce[0],
13074 y: ce[1]
13075 }), be == null ? (ye[4] = 1, t.data.bgActivePosistion = {
13076 x: ce[0],
13077 y: ce[1]
13078 }, t.redrawHint("select", !0), t.redraw()) : be.pannable() && (ye[4] = 1), Qe();
13079 }
13080 ye[0] = ye[2] = ce[0], ye[1] = ye[3] = ce[1];
13081 }
13082 }, !1), t.registerBinding(e, "mousemove", function(O) {
13083 var oe = t.hoverData.capture;
13084 if (!(!oe && !D(O))) {
13085 var Te = !1, ce = t.cy, ye = ce.zoom(), _e = [O.clientX, O.clientY], be = t.projectIntoViewport(_e[0], _e[1]), Ge = t.hoverData.mdownPos, Qe = t.hoverData.mdownGPos, ft = t.selection, qe = null;
13086 !t.hoverData.draggingEles && !t.hoverData.dragging && !t.hoverData.selecting && (qe = t.findNearestElement(be[0], be[1], !0, !1));
13087 var ot = t.hoverData.last, Ke = t.hoverData.down, Je = [be[0] - ft[2], be[1] - ft[3]], Ct = t.dragData.possibleDragElements, Rt;
13088 if (Qe) {
13089 var ar = _e[0] - Qe[0], nr = ar * ar, kt = _e[1] - Qe[1], Jt = kt * kt, _t = nr + Jt;
13090 t.hoverData.isOverThresholdDrag = Rt = _t >= t.desktopTapThreshold2;
13091 }
13092 var Er = n(O);
13093 Rt && (t.hoverData.tapholdCancelled = !0);
13094 var Rr = function() {
13095 var cr = t.hoverData.dragDelta = t.hoverData.dragDelta || [];
13096 cr.length === 0 ? (cr.push(Je[0]), cr.push(Je[1])) : (cr[0] += Je[0], cr[1] += Je[1]);
13097 };
13098 Te = !0, a(qe, ["mousemove", "vmousemove", "tapdrag"], O, {
13099 x: be[0],
13100 y: be[1]
13101 });
13102 var xa = function() {
13103 t.data.bgActivePosistion = void 0, t.hoverData.selecting || ce.emit({
13104 originalEvent: O,
13105 type: "boxstart",
13106 position: {
13107 x: be[0],
13108 y: be[1]
13109 }
13110 }), ft[4] = 1, t.hoverData.selecting = !0, t.redrawHint("select", !0), t.redraw();
13111 };
13112 if (t.hoverData.which === 3) {
13113 if (Rt) {
13114 var Xr = {
13115 originalEvent: O,
13116 type: "cxtdrag",
13117 position: {
13118 x: be[0],
13119 y: be[1]
13120 }
13121 };
13122 Ke ? Ke.emit(Xr) : ce.emit(Xr), t.hoverData.cxtDragged = !0, (!t.hoverData.cxtOver || qe !== t.hoverData.cxtOver) && (t.hoverData.cxtOver && t.hoverData.cxtOver.emit({
13123 originalEvent: O,
13124 type: "cxtdragout",
13125 position: {
13126 x: be[0],
13127 y: be[1]
13128 }
13129 }), t.hoverData.cxtOver = qe, qe && qe.emit({
13130 originalEvent: O,
13131 type: "cxtdragover",
13132 position: {
13133 x: be[0],
13134 y: be[1]
13135 }
13136 }));
13137 }
13138 } else if (t.hoverData.dragging) {
13139 if (Te = !0, ce.panningEnabled() && ce.userPanningEnabled()) {
13140 var Ta;
13141 if (t.hoverData.justStartedPan) {
13142 var Jn = t.hoverData.mdownPos;
13143 Ta = {
13144 x: (be[0] - Jn[0]) * ye,
13145 y: (be[1] - Jn[1]) * ye
13146 }, t.hoverData.justStartedPan = !1;
13147 } else
13148 Ta = {
13149 x: Je[0] * ye,
13150 y: Je[1] * ye
13151 };
13152 ce.panBy(Ta), ce.emit("dragpan"), t.hoverData.dragged = !0;
13153 }
13154 be = t.projectIntoViewport(O.clientX, O.clientY);
13155 } else if (ft[4] == 1 && (Ke == null || Ke.pannable())) {
13156 if (Rt) {
13157 if (!t.hoverData.dragging && ce.boxSelectionEnabled() && (Er || !ce.panningEnabled() || !ce.userPanningEnabled()))
13158 xa();
13159 else if (!t.hoverData.selecting && ce.panningEnabled() && ce.userPanningEnabled()) {
13160 var Wr = i(Ke, t.hoverData.downs);
13161 Wr && (t.hoverData.dragging = !0, t.hoverData.justStartedPan = !0, ft[4] = 0, t.data.bgActivePosistion = jr(Ge), t.redrawHint("select", !0), t.redraw());
13162 }
13163 Ke && Ke.pannable() && Ke.active() && Ke.unactivate();
13164 }
13165 } else {
13166 if (Ke && Ke.pannable() && Ke.active() && Ke.unactivate(), (!Ke || !Ke.grabbed()) && qe != ot && (ot && a(ot, ["mouseout", "tapdragout"], O, {
13167 x: be[0],
13168 y: be[1]
13169 }), qe && a(qe, ["mouseover", "tapdragover"], O, {
13170 x: be[0],
13171 y: be[1]
13172 }), t.hoverData.last = qe), Ke)
13173 if (Rt) {
13174 if (ce.boxSelectionEnabled() && Er)
13175 Ke && Ke.grabbed() && (p(Ct), Ke.emit("freeon"), Ct.emit("free"), t.dragData.didDrag && (Ke.emit("dragfreeon"), Ct.emit("dragfree"))), xa();
13176 else if (Ke && Ke.grabbed() && t.nodeIsDraggable(Ke)) {
13177 var Xt = !t.dragData.didDrag;
13178 Xt && t.redrawHint("eles", !0), t.dragData.didDrag = !0, t.hoverData.draggingEles || c(Ct, {
13179 inDragLayer: !0
13180 });
13181 var Ut = {
13182 x: 0,
13183 y: 0
13184 };
13185 if (R(Je[0]) && R(Je[1]) && (Ut.x += Je[0], Ut.y += Je[1], Xt)) {
13186 var Wt = t.hoverData.dragDelta;
13187 Wt && R(Wt[0]) && R(Wt[1]) && (Ut.x += Wt[0], Ut.y += Wt[1]);
13188 }
13189 t.hoverData.draggingEles = !0, Ct.silentShift(Ut).emit("position drag"), t.redrawHint("drag", !0), t.redraw();
13190 }
13191 } else
13192 Rr();
13193 Te = !0;
13194 }
13195 if (ft[2] = be[0], ft[3] = be[1], Te)
13196 return O.stopPropagation && O.stopPropagation(), O.preventDefault && O.preventDefault(), !1;
13197 }
13198 }, !1);
13199 var F, G, N;
13200 t.registerBinding(e, "mouseup", function(O) {
13201 var oe = t.hoverData.capture;
13202 if (oe) {
13203 t.hoverData.capture = !1;
13204 var Te = t.cy, ce = t.projectIntoViewport(O.clientX, O.clientY), ye = t.selection, _e = t.findNearestElement(ce[0], ce[1], !0, !1), be = t.dragData.possibleDragElements, Ge = t.hoverData.down, Qe = n(O);
13205 if (t.data.bgActivePosistion && (t.redrawHint("select", !0), t.redraw()), t.hoverData.tapholdCancelled = !0, t.data.bgActivePosistion = void 0, Ge && Ge.unactivate(), t.hoverData.which === 3) {
13206 var ft = {
13207 originalEvent: O,
13208 type: "cxttapend",
13209 position: {
13210 x: ce[0],
13211 y: ce[1]
13212 }
13213 };
13214 if (Ge ? Ge.emit(ft) : Te.emit(ft), !t.hoverData.cxtDragged) {
13215 var qe = {
13216 originalEvent: O,
13217 type: "cxttap",
13218 position: {
13219 x: ce[0],
13220 y: ce[1]
13221 }
13222 };
13223 Ge ? Ge.emit(qe) : Te.emit(qe);
13224 }
13225 t.hoverData.cxtDragged = !1, t.hoverData.which = null;
13226 } else if (t.hoverData.which === 1) {
13227 if (a(_e, ["mouseup", "tapend", "vmouseup"], O, {
13228 x: ce[0],
13229 y: ce[1]
13230 }), !t.dragData.didDrag && // didn't move a node around
13231 !t.hoverData.dragged && // didn't pan
13232 !t.hoverData.selecting && // not box selection
13233 !t.hoverData.isOverThresholdDrag && (a(Ge, ["click", "tap", "vclick"], O, {
13234 x: ce[0],
13235 y: ce[1]
13236 }), G = !1, O.timeStamp - N <= Te.multiClickDebounceTime() ? (F && clearTimeout(F), G = !0, N = null, a(Ge, ["dblclick", "dbltap", "vdblclick"], O, {
13237 x: ce[0],
13238 y: ce[1]
13239 })) : (F = setTimeout(function() {
13240 G || a(Ge, ["oneclick", "onetap", "voneclick"], O, {
13241 x: ce[0],
13242 y: ce[1]
13243 });
13244 }, Te.multiClickDebounceTime()), N = O.timeStamp)), Ge == null && !t.dragData.didDrag && !t.hoverData.selecting && !t.hoverData.dragged && !n(O) && (Te.$(r).unselect(["tapunselect"]), be.length > 0 && t.redrawHint("eles", !0), t.dragData.possibleDragElements = be = Te.collection()), _e == Ge && !t.dragData.didDrag && !t.hoverData.selecting && _e != null && _e._private.selectable && (t.hoverData.dragging || (Te.selectionType() === "additive" || Qe ? _e.selected() ? _e.unselect(["tapunselect"]) : _e.select(["tapselect"]) : Qe || (Te.$(r).unmerge(_e).unselect(["tapunselect"]), _e.select(["tapselect"]))), t.redrawHint("eles", !0)), t.hoverData.selecting) {
13245 var ot = Te.collection(t.getAllInBox(ye[0], ye[1], ye[2], ye[3]));
13246 t.redrawHint("select", !0), ot.length > 0 && t.redrawHint("eles", !0), Te.emit({
13247 type: "boxend",
13248 originalEvent: O,
13249 position: {
13250 x: ce[0],
13251 y: ce[1]
13252 }
13253 });
13254 var Ke = function(Rt) {
13255 return Rt.selectable() && !Rt.selected();
13256 };
13257 Te.selectionType() === "additive" || Qe || Te.$(r).unmerge(ot).unselect(), ot.emit("box").stdFilter(Ke).select().emit("boxselect"), t.redraw();
13258 }
13259 if (t.hoverData.dragging && (t.hoverData.dragging = !1, t.redrawHint("select", !0), t.redrawHint("eles", !0), t.redraw()), !ye[4]) {
13260 t.redrawHint("drag", !0), t.redrawHint("eles", !0);
13261 var Je = Ge && Ge.grabbed();
13262 p(be), Je && (Ge.emit("freeon"), be.emit("free"), t.dragData.didDrag && (Ge.emit("dragfreeon"), be.emit("dragfree")));
13263 }
13264 }
13265 ye[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;
13266 }
13267 }, !1);
13268 var X = function(O) {
13269 if (!t.scrollingPage) {
13270 var oe = t.cy, Te = oe.zoom(), ce = oe.pan(), ye = t.projectIntoViewport(O.clientX, O.clientY), _e = [ye[0] * Te + ce.x, ye[1] * Te + ce.y];
13271 if (t.hoverData.draggingEles || t.hoverData.dragging || t.hoverData.cxtStarted || k()) {
13272 O.preventDefault();
13273 return;
13274 }
13275 if (oe.panningEnabled() && oe.userPanningEnabled() && oe.zoomingEnabled() && oe.userZoomingEnabled()) {
13276 O.preventDefault(), t.data.wheelZooming = !0, clearTimeout(t.data.wheelTimeout), t.data.wheelTimeout = setTimeout(function() {
13277 t.data.wheelZooming = !1, t.redrawHint("eles", !0), t.redraw();
13278 }, 150);
13279 var be;
13280 O.deltaY != null ? be = O.deltaY / -250 : O.wheelDeltaY != null ? be = O.wheelDeltaY / 1e3 : be = O.wheelDelta / 1e3, be = be * t.wheelSensitivity;
13281 var Ge = O.deltaMode === 1;
13282 Ge && (be *= 33);
13283 var Qe = oe.zoom() * Math.pow(10, be);
13284 O.type === "gesturechange" && (Qe = t.gestureStartZoom * O.scale), oe.zoom({
13285 level: Qe,
13286 renderedPosition: {
13287 x: _e[0],
13288 y: _e[1]
13289 }
13290 }), oe.emit(O.type === "gesturechange" ? "pinchzoom" : "scrollzoom");
13291 }
13292 }
13293 };
13294 t.registerBinding(t.container, "wheel", X, !0), t.registerBinding(e, "scroll", function(O) {
13295 t.scrollingPage = !0, clearTimeout(t.scrollingPageTimeout), t.scrollingPageTimeout = setTimeout(function() {
13296 t.scrollingPage = !1;
13297 }, 250);
13298 }, !0), t.registerBinding(t.container, "gesturestart", function(O) {
13299 t.gestureStartZoom = t.cy.zoom(), t.hasTouchStarted || O.preventDefault();
13300 }, !0), t.registerBinding(t.container, "gesturechange", function(he) {
13301 t.hasTouchStarted || X(he);
13302 }, !0), t.registerBinding(t.container, "mouseout", function(O) {
13303 var oe = t.projectIntoViewport(O.clientX, O.clientY);
13304 t.cy.emit({
13305 originalEvent: O,
13306 type: "mouseout",
13307 position: {
13308 x: oe[0],
13309 y: oe[1]
13310 }
13311 });
13312 }, !1), t.registerBinding(t.container, "mouseover", function(O) {
13313 var oe = t.projectIntoViewport(O.clientX, O.clientY);
13314 t.cy.emit({
13315 originalEvent: O,
13316 type: "mouseover",
13317 position: {
13318 x: oe[0],
13319 y: oe[1]
13320 }
13321 });
13322 }, !1);
13323 var B, re, K, W, ae, ue, me, ie, ge, Ee, Ce, we, De, se = function(O, oe, Te, ce) {
13324 return Math.sqrt((Te - O) * (Te - O) + (ce - oe) * (ce - oe));
13325 }, xe = function(O, oe, Te, ce) {
13326 return (Te - O) * (Te - O) + (ce - oe) * (ce - oe);
13327 }, Le;
13328 t.registerBinding(t.container, "touchstart", Le = function(O) {
13329 if (t.hasTouchStarted = !0, !!D(O)) {
13330 m(), t.touchData.capture = !0, t.data.bgActivePosistion = void 0;
13331 var oe = t.cy, Te = t.touchData.now, ce = t.touchData.earlier;
13332 if (O.touches[0]) {
13333 var ye = t.projectIntoViewport(O.touches[0].clientX, O.touches[0].clientY);
13334 Te[0] = ye[0], Te[1] = ye[1];
13335 }
13336 if (O.touches[1]) {
13337 var ye = t.projectIntoViewport(O.touches[1].clientX, O.touches[1].clientY);
13338 Te[2] = ye[0], Te[3] = ye[1];
13339 }
13340 if (O.touches[2]) {
13341 var ye = t.projectIntoViewport(O.touches[2].clientX, O.touches[2].clientY);
13342 Te[4] = ye[0], Te[5] = ye[1];
13343 }
13344 if (O.touches[1]) {
13345 t.touchData.singleTouchMoved = !0, p(t.dragData.touchDragEles);
13346 var _e = t.findContainerClientCoords();
13347 ge = _e[0], Ee = _e[1], Ce = _e[2], we = _e[3], B = O.touches[0].clientX - ge, re = O.touches[0].clientY - Ee, K = O.touches[1].clientX - ge, W = O.touches[1].clientY - Ee, De = 0 <= B && B <= Ce && 0 <= K && K <= Ce && 0 <= re && re <= we && 0 <= W && W <= we;
13348 var be = oe.pan(), Ge = oe.zoom();
13349 ae = se(B, re, K, W), ue = xe(B, re, K, W), me = [(B + K) / 2, (re + W) / 2], ie = [(me[0] - be.x) / Ge, (me[1] - be.y) / Ge];
13350 var Qe = 200, ft = Qe * Qe;
13351 if (ue < ft && !O.touches[2]) {
13352 var qe = t.findNearestElement(Te[0], Te[1], !0, !0), ot = t.findNearestElement(Te[2], Te[3], !0, !0);
13353 qe && qe.isNode() ? (qe.activate().emit({
13354 originalEvent: O,
13355 type: "cxttapstart",
13356 position: {
13357 x: Te[0],
13358 y: Te[1]
13359 }
13360 }), t.touchData.start = qe) : ot && ot.isNode() ? (ot.activate().emit({
13361 originalEvent: O,
13362 type: "cxttapstart",
13363 position: {
13364 x: Te[0],
13365 y: Te[1]
13366 }
13367 }), t.touchData.start = ot) : oe.emit({
13368 originalEvent: O,
13369 type: "cxttapstart",
13370 position: {
13371 x: Te[0],
13372 y: Te[1]
13373 }
13374 }), t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxt = !0, t.touchData.cxtDragged = !1, t.data.bgActivePosistion = void 0, t.redraw();
13375 return;
13376 }
13377 }
13378 if (O.touches[2])
13379 oe.boxSelectionEnabled() && O.preventDefault();
13380 else if (!O.touches[1]) {
13381 if (O.touches[0]) {
13382 var Ke = t.findNearestElements(Te[0], Te[1], !0, !0), Je = Ke[0];
13383 if (Je != null && (Je.activate(), t.touchData.start = Je, t.touchData.starts = Ke, t.nodeIsGrabbable(Je))) {
13384 var Ct = t.dragData.touchDragEles = oe.collection(), Rt = null;
13385 t.redrawHint("eles", !0), t.redrawHint("drag", !0), Je.selected() ? (Rt = oe.$(function(_t) {
13386 return _t.selected() && t.nodeIsGrabbable(_t);
13387 }), c(Rt, {
13388 addToList: Ct
13389 })) : y(Je, {
13390 addToList: Ct
13391 }), f(Je);
13392 var ar = function(Er) {
13393 return {
13394 originalEvent: O,
13395 type: Er,
13396 position: {
13397 x: Te[0],
13398 y: Te[1]
13399 }
13400 };
13401 };
13402 Je.emit(ar("grabon")), Rt ? Rt.forEach(function(_t) {
13403 _t.emit(ar("grab"));
13404 }) : Je.emit(ar("grab"));
13405 }
13406 a(Je, ["touchstart", "tapstart", "vmousedown"], O, {
13407 x: Te[0],
13408 y: Te[1]
13409 }), Je == null && (t.data.bgActivePosistion = {
13410 x: ye[0],
13411 y: ye[1]
13412 }, 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() {
13413 t.touchData.singleTouchMoved === !1 && !t.pinching && !t.touchData.selecting && a(t.touchData.start, ["taphold"], O, {
13414 x: Te[0],
13415 y: Te[1]
13416 });
13417 }, t.tapholdDuration);
13418 }
13419 }
13420 if (O.touches.length >= 1) {
13421 for (var nr = t.touchData.startPosition = [null, null, null, null, null, null], kt = 0; kt < Te.length; kt++)
13422 nr[kt] = ce[kt] = Te[kt];
13423 var Jt = O.touches[0];
13424 t.touchData.startGPosition = [Jt.clientX, Jt.clientY];
13425 }
13426 }
13427 }, !1);
13428 var Se;
13429 t.registerBinding(window, "touchmove", Se = function(O) {
13430 var oe = t.touchData.capture;
13431 if (!(!oe && !D(O))) {
13432 var Te = t.selection, ce = t.cy, ye = t.touchData.now, _e = t.touchData.earlier, be = ce.zoom();
13433 if (O.touches[0]) {
13434 var Ge = t.projectIntoViewport(O.touches[0].clientX, O.touches[0].clientY);
13435 ye[0] = Ge[0], ye[1] = Ge[1];
13436 }
13437 if (O.touches[1]) {
13438 var Ge = t.projectIntoViewport(O.touches[1].clientX, O.touches[1].clientY);
13439 ye[2] = Ge[0], ye[3] = Ge[1];
13440 }
13441 if (O.touches[2]) {
13442 var Ge = t.projectIntoViewport(O.touches[2].clientX, O.touches[2].clientY);
13443 ye[4] = Ge[0], ye[5] = Ge[1];
13444 }
13445 var Qe = t.touchData.startGPosition, ft;
13446 if (oe && O.touches[0] && Qe) {
13447 for (var qe = [], ot = 0; ot < ye.length; ot++)
13448 qe[ot] = ye[ot] - _e[ot];
13449 var Ke = O.touches[0].clientX - Qe[0], Je = Ke * Ke, Ct = O.touches[0].clientY - Qe[1], Rt = Ct * Ct, ar = Je + Rt;
13450 ft = ar >= t.touchTapThreshold2;
13451 }
13452 if (oe && t.touchData.cxt) {
13453 O.preventDefault();
13454 var nr = O.touches[0].clientX - ge, kt = O.touches[0].clientY - Ee, Jt = O.touches[1].clientX - ge, _t = O.touches[1].clientY - Ee, Er = xe(nr, kt, Jt, _t), Rr = Er / ue, xa = 150, Xr = xa * xa, Ta = 1.5, Jn = Ta * Ta;
13455 if (Rr >= Jn || Er >= Xr) {
13456 t.touchData.cxt = !1, t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13457 var Wr = {
13458 originalEvent: O,
13459 type: "cxttapend",
13460 position: {
13461 x: ye[0],
13462 y: ye[1]
13463 }
13464 };
13465 t.touchData.start ? (t.touchData.start.unactivate().emit(Wr), t.touchData.start = null) : ce.emit(Wr);
13466 }
13467 }
13468 if (oe && t.touchData.cxt) {
13469 var Wr = {
13470 originalEvent: O,
13471 type: "cxtdrag",
13472 position: {
13473 x: ye[0],
13474 y: ye[1]
13475 }
13476 };
13477 t.data.bgActivePosistion = void 0, t.redrawHint("select", !0), t.touchData.start ? t.touchData.start.emit(Wr) : ce.emit(Wr), t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxtDragged = !0;
13478 var Xt = t.findNearestElement(ye[0], ye[1], !0, !0);
13479 (!t.touchData.cxtOver || Xt !== t.touchData.cxtOver) && (t.touchData.cxtOver && t.touchData.cxtOver.emit({
13480 originalEvent: O,
13481 type: "cxtdragout",
13482 position: {
13483 x: ye[0],
13484 y: ye[1]
13485 }
13486 }), t.touchData.cxtOver = Xt, Xt && Xt.emit({
13487 originalEvent: O,
13488 type: "cxtdragover",
13489 position: {
13490 x: ye[0],
13491 y: ye[1]
13492 }
13493 }));
13494 } else if (oe && O.touches[2] && ce.boxSelectionEnabled())
13495 O.preventDefault(), t.data.bgActivePosistion = void 0, this.lastThreeTouch = +/* @__PURE__ */ new Date(), t.touchData.selecting || ce.emit({
13496 originalEvent: O,
13497 type: "boxstart",
13498 position: {
13499 x: ye[0],
13500 y: ye[1]
13501 }
13502 }), t.touchData.selecting = !0, t.touchData.didSelect = !0, Te[4] = 1, !Te || Te.length === 0 || Te[0] === void 0 ? (Te[0] = (ye[0] + ye[2] + ye[4]) / 3, Te[1] = (ye[1] + ye[3] + ye[5]) / 3, Te[2] = (ye[0] + ye[2] + ye[4]) / 3 + 1, Te[3] = (ye[1] + ye[3] + ye[5]) / 3 + 1) : (Te[2] = (ye[0] + ye[2] + ye[4]) / 3, Te[3] = (ye[1] + ye[3] + ye[5]) / 3), t.redrawHint("select", !0), t.redraw();
13503 else if (oe && O.touches[1] && !t.touchData.didSelect && ce.zoomingEnabled() && ce.panningEnabled() && ce.userZoomingEnabled() && ce.userPanningEnabled()) {
13504 O.preventDefault(), t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13505 var Ut = t.dragData.touchDragEles;
13506 if (Ut) {
13507 t.redrawHint("drag", !0);
13508 for (var Wt = 0; Wt < Ut.length; Wt++) {
13509 var jn = Ut[Wt]._private;
13510 jn.grabbed = !1, jn.rscratch.inDragLayer = !1;
13511 }
13512 }
13513 var cr = t.touchData.start, nr = O.touches[0].clientX - ge, kt = O.touches[0].clientY - Ee, Jt = O.touches[1].clientX - ge, _t = O.touches[1].clientY - Ee, Bl = se(nr, kt, Jt, _t), op = Bl / ae;
13514 if (De) {
13515 var lp = nr - B, up = kt - re, fp = Jt - K, hp = _t - W, vp = (lp + fp) / 2, cp = (up + hp) / 2, rn = ce.zoom(), Wi = rn * op, ei = ce.pan(), Fl = ie[0] * rn + ei.x, Gl = ie[1] * rn + ei.y, dp = {
13516 x: -Wi / rn * (Fl - ei.x - vp) + Fl,
13517 y: -Wi / rn * (Gl - ei.y - cp) + Gl
13518 };
13519 if (cr && cr.active()) {
13520 var Ut = t.dragData.touchDragEles;
13521 p(Ut), t.redrawHint("drag", !0), t.redrawHint("eles", !0), cr.unactivate().emit("freeon"), Ut.emit("free"), t.dragData.didDrag && (cr.emit("dragfreeon"), Ut.emit("dragfree"));
13522 }
13523 ce.viewport({
13524 zoom: Wi,
13525 pan: dp,
13526 cancelOnFailedZoom: !0
13527 }), ce.emit("pinchzoom"), ae = Bl, B = nr, re = kt, K = Jt, W = _t, t.pinching = !0;
13528 }
13529 if (O.touches[0]) {
13530 var Ge = t.projectIntoViewport(O.touches[0].clientX, O.touches[0].clientY);
13531 ye[0] = Ge[0], ye[1] = Ge[1];
13532 }
13533 if (O.touches[1]) {
13534 var Ge = t.projectIntoViewport(O.touches[1].clientX, O.touches[1].clientY);
13535 ye[2] = Ge[0], ye[3] = Ge[1];
13536 }
13537 if (O.touches[2]) {
13538 var Ge = t.projectIntoViewport(O.touches[2].clientX, O.touches[2].clientY);
13539 ye[4] = Ge[0], ye[5] = Ge[1];
13540 }
13541 } else if (O.touches[0] && !t.touchData.didSelect) {
13542 var ir = t.touchData.start, qi = t.touchData.last, Xt;
13543 if (!t.hoverData.draggingEles && !t.swipePanning && (Xt = t.findNearestElement(ye[0], ye[1], !0, !0)), oe && ir != null && O.preventDefault(), oe && ir != null && t.nodeIsDraggable(ir))
13544 if (ft) {
13545 var Ut = t.dragData.touchDragEles, zl = !t.dragData.didDrag;
13546 zl && c(Ut, {
13547 inDragLayer: !0
13548 }), t.dragData.didDrag = !0;
13549 var an = {
13550 x: 0,
13551 y: 0
13552 };
13553 if (R(qe[0]) && R(qe[1]) && (an.x += qe[0], an.y += qe[1], zl)) {
13554 t.redrawHint("eles", !0);
13555 var sr = t.touchData.dragDelta;
13556 sr && R(sr[0]) && R(sr[1]) && (an.x += sr[0], an.y += sr[1]);
13557 }
13558 t.hoverData.draggingEles = !0, Ut.silentShift(an).emit("position drag"), t.redrawHint("drag", !0), t.touchData.startPosition[0] == _e[0] && t.touchData.startPosition[1] == _e[1] && t.redrawHint("eles", !0), t.redraw();
13559 } else {
13560 var sr = t.touchData.dragDelta = t.touchData.dragDelta || [];
13561 sr.length === 0 ? (sr.push(qe[0]), sr.push(qe[1])) : (sr[0] += qe[0], sr[1] += qe[1]);
13562 }
13563 if (a(ir || Xt, ["touchmove", "tapdrag", "vmousemove"], O, {
13564 x: ye[0],
13565 y: ye[1]
13566 }), (!ir || !ir.grabbed()) && Xt != qi && (qi && qi.emit({
13567 originalEvent: O,
13568 type: "tapdragout",
13569 position: {
13570 x: ye[0],
13571 y: ye[1]
13572 }
13573 }), Xt && Xt.emit({
13574 originalEvent: O,
13575 type: "tapdragover",
13576 position: {
13577 x: ye[0],
13578 y: ye[1]
13579 }
13580 })), t.touchData.last = Xt, oe)
13581 for (var Wt = 0; Wt < ye.length; Wt++)
13582 ye[Wt] && t.touchData.startPosition[Wt] && ft && (t.touchData.singleTouchMoved = !0);
13583 if (oe && (ir == null || ir.pannable()) && ce.panningEnabled() && ce.userPanningEnabled()) {
13584 var gp = i(ir, t.touchData.starts);
13585 gp && (O.preventDefault(), t.data.bgActivePosistion || (t.data.bgActivePosistion = jr(t.touchData.startPosition)), t.swipePanning ? (ce.panBy({
13586 x: qe[0] * be,
13587 y: qe[1] * be
13588 }), ce.emit("dragpan")) : ft && (t.swipePanning = !0, ce.panBy({
13589 x: Ke * be,
13590 y: Ct * be
13591 }), ce.emit("dragpan"), ir && (ir.unactivate(), t.redrawHint("select", !0), t.touchData.start = null)));
13592 var Ge = t.projectIntoViewport(O.touches[0].clientX, O.touches[0].clientY);
13593 ye[0] = Ge[0], ye[1] = Ge[1];
13594 }
13595 }
13596 for (var ot = 0; ot < ye.length; ot++)
13597 _e[ot] = ye[ot];
13598 oe && O.touches.length > 0 && !t.hoverData.draggingEles && !t.swipePanning && t.data.bgActivePosistion != null && (t.data.bgActivePosistion = void 0, t.redrawHint("select", !0), t.redraw());
13599 }
13600 }, !1);
13601 var Oe;
13602 t.registerBinding(e, "touchcancel", Oe = function(O) {
13603 var oe = t.touchData.start;
13604 t.touchData.capture = !1, oe && oe.unactivate();
13605 });
13606 var Fe, Xe, Ie, Me;
13607 if (t.registerBinding(e, "touchend", Fe = function(O) {
13608 var oe = t.touchData.start, Te = t.touchData.capture;
13609 if (Te)
13610 O.touches.length === 0 && (t.touchData.capture = !1), O.preventDefault();
13611 else
13612 return;
13613 var ce = t.selection;
13614 t.swipePanning = !1, t.hoverData.draggingEles = !1;
13615 var ye = t.cy, _e = ye.zoom(), be = t.touchData.now, Ge = t.touchData.earlier;
13616 if (O.touches[0]) {
13617 var Qe = t.projectIntoViewport(O.touches[0].clientX, O.touches[0].clientY);
13618 be[0] = Qe[0], be[1] = Qe[1];
13619 }
13620 if (O.touches[1]) {
13621 var Qe = t.projectIntoViewport(O.touches[1].clientX, O.touches[1].clientY);
13622 be[2] = Qe[0], be[3] = Qe[1];
13623 }
13624 if (O.touches[2]) {
13625 var Qe = t.projectIntoViewport(O.touches[2].clientX, O.touches[2].clientY);
13626 be[4] = Qe[0], be[5] = Qe[1];
13627 }
13628 oe && oe.unactivate();
13629 var ft;
13630 if (t.touchData.cxt) {
13631 if (ft = {
13632 originalEvent: O,
13633 type: "cxttapend",
13634 position: {
13635 x: be[0],
13636 y: be[1]
13637 }
13638 }, oe ? oe.emit(ft) : ye.emit(ft), !t.touchData.cxtDragged) {
13639 var qe = {
13640 originalEvent: O,
13641 type: "cxttap",
13642 position: {
13643 x: be[0],
13644 y: be[1]
13645 }
13646 };
13647 oe ? oe.emit(qe) : ye.emit(qe);
13648 }
13649 t.touchData.start && (t.touchData.start._private.grabbed = !1), t.touchData.cxt = !1, t.touchData.start = null, t.redraw();
13650 return;
13651 }
13652 if (!O.touches[2] && ye.boxSelectionEnabled() && t.touchData.selecting) {
13653 t.touchData.selecting = !1;
13654 var ot = ye.collection(t.getAllInBox(ce[0], ce[1], ce[2], ce[3]));
13655 ce[0] = void 0, ce[1] = void 0, ce[2] = void 0, ce[3] = void 0, ce[4] = 0, t.redrawHint("select", !0), ye.emit({
13656 type: "boxend",
13657 originalEvent: O,
13658 position: {
13659 x: be[0],
13660 y: be[1]
13661 }
13662 });
13663 var Ke = function(Xr) {
13664 return Xr.selectable() && !Xr.selected();
13665 };
13666 ot.emit("box").stdFilter(Ke).select().emit("boxselect"), ot.nonempty() && t.redrawHint("eles", !0), t.redraw();
13667 }
13668 if (oe != null && oe.unactivate(), O.touches[2])
13669 t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13670 else if (!O.touches[1]) {
13671 if (!O.touches[0]) {
13672 if (!O.touches[0]) {
13673 t.data.bgActivePosistion = void 0, t.redrawHint("select", !0);
13674 var Je = t.dragData.touchDragEles;
13675 if (oe != null) {
13676 var Ct = oe._private.grabbed;
13677 p(Je), t.redrawHint("drag", !0), t.redrawHint("eles", !0), Ct && (oe.emit("freeon"), Je.emit("free"), t.dragData.didDrag && (oe.emit("dragfreeon"), Je.emit("dragfree"))), a(oe, ["touchend", "tapend", "vmouseup", "tapdragout"], O, {
13678 x: be[0],
13679 y: be[1]
13680 }), oe.unactivate(), t.touchData.start = null;
13681 } else {
13682 var Rt = t.findNearestElement(be[0], be[1], !0, !0);
13683 a(Rt, ["touchend", "tapend", "vmouseup", "tapdragout"], O, {
13684 x: be[0],
13685 y: be[1]
13686 });
13687 }
13688 var ar = t.touchData.startPosition[0] - be[0], nr = ar * ar, kt = t.touchData.startPosition[1] - be[1], Jt = kt * kt, _t = nr + Jt, Er = _t * _e * _e;
13689 t.touchData.singleTouchMoved || (oe || ye.$(":selected").unselect(["tapunselect"]), a(oe, ["tap", "vclick"], O, {
13690 x: be[0],
13691 y: be[1]
13692 }), Xe = !1, O.timeStamp - Me <= ye.multiClickDebounceTime() ? (Ie && clearTimeout(Ie), Xe = !0, Me = null, a(oe, ["dbltap", "vdblclick"], O, {
13693 x: be[0],
13694 y: be[1]
13695 })) : (Ie = setTimeout(function() {
13696 Xe || a(oe, ["onetap", "voneclick"], O, {
13697 x: be[0],
13698 y: be[1]
13699 });
13700 }, ye.multiClickDebounceTime()), Me = O.timeStamp)), oe != null && !t.dragData.didDrag && oe._private.selectable && Er < t.touchTapThreshold2 && !t.pinching && (ye.selectionType() === "single" ? (ye.$(r).unmerge(oe).unselect(["tapunselect"]), oe.select(["tapselect"])) : oe.selected() ? oe.unselect(["tapunselect"]) : oe.select(["tapselect"]), t.redrawHint("eles", !0)), t.touchData.singleTouchMoved = !0;
13701 }
13702 }
13703 }
13704 for (var Rr = 0; Rr < be.length; Rr++)
13705 Ge[Rr] = be[Rr];
13706 t.dragData.didDrag = !1, O.touches.length === 0 && (t.touchData.dragDelta = [], t.touchData.startPosition = [null, null, null, null, null, null], t.touchData.startGPosition = null, t.touchData.didSelect = !1), O.touches.length < 2 && (O.touches.length === 1 && (t.touchData.startGPosition = [O.touches[0].clientX, O.touches[0].clientY]), t.pinching = !1, t.redrawHint("eles", !0), t.redraw());
13707 }, !1), typeof TouchEvent > "u") {
13708 var Ue = [], ze = function(O) {
13709 return {
13710 clientX: O.clientX,
13711 clientY: O.clientY,
13712 force: 1,
13713 identifier: O.pointerId,
13714 pageX: O.pageX,
13715 pageY: O.pageY,
13716 radiusX: O.width / 2,
13717 radiusY: O.height / 2,
13718 screenX: O.screenX,
13719 screenY: O.screenY,
13720 target: O.target
13721 };
13722 }, Be = function(O) {
13723 return {
13724 event: O,
13725 touch: ze(O)
13726 };
13727 }, $e = function(O) {
13728 Ue.push(Be(O));
13729 }, rt = function(O) {
13730 for (var oe = 0; oe < Ue.length; oe++) {
13731 var Te = Ue[oe];
13732 if (Te.event.pointerId === O.pointerId) {
13733 Ue.splice(oe, 1);
13734 return;
13735 }
13736 }
13737 }, je = function(O) {
13738 var oe = Ue.filter(function(Te) {
13739 return Te.event.pointerId === O.pointerId;
13740 })[0];
13741 oe.event = O, oe.touch = ze(O);
13742 }, We = function(O) {
13743 O.touches = Ue.map(function(oe) {
13744 return oe.touch;
13745 });
13746 }, et = function(O) {
13747 return O.pointerType === "mouse" || O.pointerType === 4;
13748 };
13749 t.registerBinding(t.container, "pointerdown", function(he) {
13750 et(he) || (he.preventDefault(), $e(he), We(he), Le(he));
13751 }), t.registerBinding(t.container, "pointerup", function(he) {
13752 et(he) || (rt(he), We(he), Fe(he));
13753 }), t.registerBinding(t.container, "pointercancel", function(he) {
13754 et(he) || (rt(he), We(he), Oe(he));
13755 }), t.registerBinding(t.container, "pointermove", function(he) {
13756 et(he) || (he.preventDefault(), je(he), We(he), Se(he));
13757 });
13758 }
13759 };
13760 var mr = {};
13761 mr.generatePolygon = function(t, e) {
13762 return this.nodeShapes[t] = {
13763 renderer: this,
13764 name: t,
13765 points: e,
13766 draw: function(a, n, i, s, o) {
13767 this.renderer.nodeShapeImpl("polygon", a, n, i, s, o, this.points);
13768 },
13769 intersectLine: function(a, n, i, s, o, u, l) {
13770 return Ba(o, u, this.points, a, n, i / 2, s / 2, l);
13771 },
13772 checkPoint: function(a, n, i, s, o, u, l) {
13773 return pr(a, n, this.points, u, l, s, o, [0, -1], i);
13774 }
13775 };
13776 }, mr.generateEllipse = function() {
13777 return this.nodeShapes.ellipse = {
13778 renderer: this,
13779 name: "ellipse",
13780 draw: function(e, r, a, n, i) {
13781 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13782 },
13783 intersectLine: function(e, r, a, n, i, s, o) {
13784 return Rf(i, s, e, r, a / 2 + o, n / 2 + o);
13785 },
13786 checkPoint: function(e, r, a, n, i, s, o) {
13787 return Gr(e, r, n, i, s, o, a);
13788 }
13789 };
13790 }, mr.generateRoundPolygon = function(t, e) {
13791 for (var r = new Array(e.length * 2), a = 0; a < e.length / 2; a++) {
13792 var n = a * 2, i = void 0;
13793 a < e.length / 2 - 1 ? i = (a + 1) * 2 : i = 0, r[a * 4] = e[n], r[a * 4 + 1] = e[n + 1];
13794 var s = e[i] - e[n], o = e[i + 1] - e[n + 1], u = Math.sqrt(s * s + o * o);
13795 r[a * 4 + 2] = s / u, r[a * 4 + 3] = o / u;
13796 }
13797 return this.nodeShapes[t] = {
13798 renderer: this,
13799 name: t,
13800 points: r,
13801 draw: function(f, h, v, d, c) {
13802 this.renderer.nodeShapeImpl("round-polygon", f, h, v, d, c, this.points);
13803 },
13804 intersectLine: function(f, h, v, d, c, y, p) {
13805 return kf(c, y, this.points, f, h, v, d);
13806 },
13807 checkPoint: function(f, h, v, d, c, y, p) {
13808 return Mf(f, h, this.points, y, p, d, c);
13809 }
13810 };
13811 }, mr.generateRoundRectangle = function() {
13812 return this.nodeShapes["round-rectangle"] = this.nodeShapes.roundrectangle = {
13813 renderer: this,
13814 name: "round-rectangle",
13815 points: $t(4, 0),
13816 draw: function(e, r, a, n, i) {
13817 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13818 },
13819 intersectLine: function(e, r, a, n, i, s, o) {
13820 return Cs(i, s, e, r, a, n, o);
13821 },
13822 checkPoint: function(e, r, a, n, i, s, o) {
13823 var u = Fa(n, i), l = u * 2;
13824 return !!(pr(e, r, this.points, s, o, n, i - l, [0, -1], a) || pr(e, r, this.points, s, o, n - l, i, [0, -1], a) || Gr(e, r, l, l, s - n / 2 + u, o - i / 2 + u, a) || Gr(e, r, l, l, s + n / 2 - u, o - i / 2 + u, a) || Gr(e, r, l, l, s + n / 2 - u, o + i / 2 - u, a) || Gr(e, r, l, l, s - n / 2 + u, o + i / 2 - u, a));
13825 }
13826 };
13827 }, mr.generateCutRectangle = function() {
13828 return this.nodeShapes["cut-rectangle"] = this.nodeShapes.cutrectangle = {
13829 renderer: this,
13830 name: "cut-rectangle",
13831 cornerLength: Ss(),
13832 points: $t(4, 0),
13833 draw: function(e, r, a, n, i) {
13834 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13835 },
13836 generateCutTrianglePts: function(e, r, a, n) {
13837 var i = this.cornerLength, s = r / 2, o = e / 2, u = a - o, l = a + o, f = n - s, h = n + s;
13838 return {
13839 topLeft: [u, f + i, u + i, f, u + i, f + i],
13840 topRight: [l - i, f, l, f + i, l - i, f + i],
13841 bottomRight: [l, h - i, l - i, h, l - i, h - i],
13842 bottomLeft: [u + i, h, u, h - i, u + i, h - i]
13843 };
13844 },
13845 intersectLine: function(e, r, a, n, i, s, o) {
13846 var u = this.generateCutTrianglePts(a + 2 * o, n + 2 * o, e, r), l = [].concat.apply([], [u.topLeft.splice(0, 4), u.topRight.splice(0, 4), u.bottomRight.splice(0, 4), u.bottomLeft.splice(0, 4)]);
13847 return Ba(i, s, l, e, r);
13848 },
13849 checkPoint: function(e, r, a, n, i, s, o) {
13850 if (pr(e, r, this.points, s, o, n, i - 2 * this.cornerLength, [0, -1], a) || pr(e, r, this.points, s, o, n - 2 * this.cornerLength, i, [0, -1], a))
13851 return !0;
13852 var u = this.generateCutTrianglePts(n, i, s, o);
13853 return Ht(e, r, u.topLeft) || Ht(e, r, u.topRight) || Ht(e, r, u.bottomRight) || Ht(e, r, u.bottomLeft);
13854 }
13855 };
13856 }, mr.generateBarrel = function() {
13857 return this.nodeShapes.barrel = {
13858 renderer: this,
13859 name: "barrel",
13860 points: $t(4, 0),
13861 draw: function(e, r, a, n, i) {
13862 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13863 },
13864 intersectLine: function(e, r, a, n, i, s, o) {
13865 var u = 0.15, l = 0.5, f = 0.85, h = this.generateBarrelBezierPts(a + 2 * o, n + 2 * o, e, r), v = function(y) {
13866 var p = ea({
13867 x: y[0],
13868 y: y[1]
13869 }, {
13870 x: y[2],
13871 y: y[3]
13872 }, {
13873 x: y[4],
13874 y: y[5]
13875 }, u), g = ea({
13876 x: y[0],
13877 y: y[1]
13878 }, {
13879 x: y[2],
13880 y: y[3]
13881 }, {
13882 x: y[4],
13883 y: y[5]
13884 }, l), m = ea({
13885 x: y[0],
13886 y: y[1]
13887 }, {
13888 x: y[2],
13889 y: y[3]
13890 }, {
13891 x: y[4],
13892 y: y[5]
13893 }, f);
13894 return [y[0], y[1], p.x, p.y, g.x, g.y, m.x, m.y, y[4], y[5]];
13895 }, d = [].concat(v(h.topLeft), v(h.topRight), v(h.bottomRight), v(h.bottomLeft));
13896 return Ba(i, s, d, e, r);
13897 },
13898 generateBarrelBezierPts: function(e, r, a, n) {
13899 var i = r / 2, s = e / 2, o = a - s, u = a + s, l = n - i, f = n + i, h = di(e, r), v = h.heightOffset, d = h.widthOffset, c = h.ctrlPtOffsetPct * e, y = {
13900 topLeft: [o, l + v, o + c, l, o + d, l],
13901 topRight: [u - d, l, u - c, l, u, l + v],
13902 bottomRight: [u, f - v, u - c, f, u - d, f],
13903 bottomLeft: [o + d, f, o + c, f, o, f - v]
13904 };
13905 return y.topLeft.isTop = !0, y.topRight.isTop = !0, y.bottomLeft.isBottom = !0, y.bottomRight.isBottom = !0, y;
13906 },
13907 checkPoint: function(e, r, a, n, i, s, o) {
13908 var u = di(n, i), l = u.heightOffset, f = u.widthOffset;
13909 if (pr(e, r, this.points, s, o, n, i - 2 * l, [0, -1], a) || pr(e, r, this.points, s, o, n - 2 * f, i, [0, -1], a))
13910 return !0;
13911 for (var h = this.generateBarrelBezierPts(n, i, s, o), v = function(w, k, D) {
13912 var F = D[4], G = D[2], N = D[0], X = D[5], B = D[1], re = Math.min(F, N), K = Math.max(F, N), W = Math.min(X, B), ae = Math.max(X, B);
13913 if (re <= w && w <= K && W <= k && k <= ae) {
13914 var ue = Pf(F, G, N), me = Af(ue[0], ue[1], ue[2], w), ie = me.filter(function(ge) {
13915 return 0 <= ge && ge <= 1;
13916 });
13917 if (ie.length > 0)
13918 return ie[0];
13919 }
13920 return null;
13921 }, d = Object.keys(h), c = 0; c < d.length; c++) {
13922 var y = d[c], p = h[y], g = v(e, r, p);
13923 if (g != null) {
13924 var m = p[5], b = p[3], E = p[1], M = Lt(m, b, E, g);
13925 if (p.isTop && M <= r || p.isBottom && r <= M)
13926 return !0;
13927 }
13928 }
13929 return !1;
13930 }
13931 };
13932 }, mr.generateBottomRoundrectangle = function() {
13933 return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes.bottomroundrectangle = {
13934 renderer: this,
13935 name: "bottom-round-rectangle",
13936 points: $t(4, 0),
13937 draw: function(e, r, a, n, i) {
13938 this.renderer.nodeShapeImpl(this.name, e, r, a, n, i);
13939 },
13940 intersectLine: function(e, r, a, n, i, s, o) {
13941 var u = e - (a / 2 + o), l = r - (n / 2 + o), f = l, h = e + (a / 2 + o), v = Cr(i, s, e, r, u, l, h, f, !1);
13942 return v.length > 0 ? v : Cs(i, s, e, r, a, n, o);
13943 },
13944 checkPoint: function(e, r, a, n, i, s, o) {
13945 var u = Fa(n, i), l = 2 * u;
13946 if (pr(e, r, this.points, s, o, n, i - l, [0, -1], a) || pr(e, r, this.points, s, o, n - l, i, [0, -1], a))
13947 return !0;
13948 var f = n / 2 + 2 * a, h = i / 2 + 2 * a, v = [s - f, o - h, s - f, o, s + f, o, s + f, o - h];
13949 return !!(Ht(e, r, v) || Gr(e, r, l, l, s + n / 2 - u, o + i / 2 - u, a) || Gr(e, r, l, l, s - n / 2 + u, o + i / 2 - u, a));
13950 }
13951 };
13952 }, mr.registerNodeShapes = function() {
13953 var t = this.nodeShapes = {}, e = this;
13954 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();
13955 {
13956 var r = [0, 1, 1, 0, 0, -1, -1, 0];
13957 this.generatePolygon("diamond", r), this.generateRoundPolygon("round-diamond", r);
13958 }
13959 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));
13960 var a = new Array(20);
13961 {
13962 var n = vi(5, 0), i = vi(5, Math.PI / 5), s = 0.5 * (3 - Math.sqrt(5));
13963 s *= 1.57;
13964 for (var o = 0; o < i.length / 2; o++)
13965 i[o * 2] *= s, i[o * 2 + 1] *= s;
13966 for (var o = 0; o < 20 / 4; o++)
13967 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];
13968 }
13969 a = Ds(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.generatePolygon("right-rhomboid", [-0.333, -1, 1, -1, 0.333, 1, -1, 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]);
13970 {
13971 var u = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1];
13972 this.generatePolygon("tag", u), this.generateRoundPolygon("round-tag", u);
13973 }
13974 t.makePolygon = function(l) {
13975 var f = l.join("$"), h = "polygon-" + f, v;
13976 return (v = this[h]) ? v : e.generatePolygon(h, l);
13977 };
13978 };
13979 var Ja = {};
13980 Ja.timeToRender = function() {
13981 return this.redrawTotalTime / this.redrawCount;
13982 }, Ja.redraw = function(t) {
13983 t = t || ys();
13984 var e = this;
13985 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;
13986 }, Ja.beforeRender = function(t, e) {
13987 if (!this.destroyed) {
13988 e == null && xt("Priority is not optional for beforeRender");
13989 var r = this.beforeRenderCallbacks;
13990 r.push({
13991 fn: t,
13992 priority: e
13993 }), r.sort(function(a, n) {
13994 return n.priority - a.priority;
13995 });
13996 }
13997 };
13998 var vl = function(e, r, a) {
13999 for (var n = e.beforeRenderCallbacks, i = 0; i < n.length; i++)
14000 n[i].fn(r, a);
14001 };
14002 Ja.startRenderLoop = function() {
14003 var t = this, e = t.cy;
14004 if (!t.renderLoopStarted) {
14005 t.renderLoopStarted = !0;
14006 var r = function a(n) {
14007 if (!t.destroyed) {
14008 if (!e.batching())
14009 if (t.requestedFrame && !t.skipFrame) {
14010 vl(t, !0, n);
14011 var i = gr();
14012 t.render(t.renderOptions);
14013 var s = t.lastDrawTime = gr();
14014 t.averageRedrawTime === void 0 && (t.averageRedrawTime = s - i), t.redrawCount === void 0 && (t.redrawCount = 0), t.redrawCount++, t.redrawTotalTime === void 0 && (t.redrawTotalTime = 0);
14015 var o = s - i;
14016 t.redrawTotalTime += o, t.lastRedrawTime = o, t.averageRedrawTime = t.averageRedrawTime / 2 + o / 2, t.requestedFrame = !1;
14017 } else
14018 vl(t, !1, n);
14019 t.skipFrame = !1, ln(a);
14020 }
14021 };
14022 ln(r);
14023 }
14024 };
14025 var dg = function(e) {
14026 this.init(e);
14027 }, cl = dg, ma = cl.prototype;
14028 ma.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"], ma.init = function(t) {
14029 var e = this;
14030 e.options = t, e.cy = t.cy;
14031 var r = e.container = t.cy.container(), a = e.cy.window();
14032 if (a) {
14033 var n = a.document, i = n.head, s = "__________cytoscape_stylesheet", o = "__________cytoscape_container", u = n.getElementById(s) != null;
14034 if (r.className.indexOf(o) < 0 && (r.className = (r.className || "") + " " + o), !u) {
14035 var l = n.createElement("style");
14036 l.id = s, l.textContent = "." + o + " { position: relative; }", i.insertBefore(l, i.children[0]);
14037 }
14038 var f = a.getComputedStyle(r), h = f.getPropertyValue("position");
14039 h === "static" && vt("A Cytoscape container has style position:static and so can not use UI extensions properly");
14040 }
14041 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 = {
14042 down: null,
14043 last: null,
14044 downTime: null,
14045 triggerMode: null,
14046 dragging: !1,
14047 initialPan: [null, null],
14048 capture: !1
14049 }, e.dragData = {
14050 possibleDragElements: []
14051 }, e.touchData = {
14052 start: null,
14053 capture: !1,
14054 // These 3 fields related to tap, taphold events
14055 startPosition: [null, null, null, null, null, null],
14056 singleTouchStartTime: null,
14057 singleTouchMoved: !0,
14058 now: [null, null, null, null, null, null],
14059 earlier: [null, null, null, null, null, null]
14060 }, 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 = R(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 = {
14061 // higher priority execs before lower one
14062 animations: 400,
14063 eleCalcs: 300,
14064 eleTxrDeq: 200,
14065 lyrTxrDeq: 150,
14066 lyrTxrSkip: 100
14067 }, e.registerNodeShapes(), e.registerArrowShapes(), e.registerCalculationListeners();
14068 }, ma.notify = function(t, e) {
14069 var r = this, a = r.cy;
14070 if (!this.destroyed) {
14071 if (t === "init") {
14072 r.load();
14073 return;
14074 }
14075 if (t === "destroy") {
14076 r.destroy();
14077 return;
14078 }
14079 (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();
14080 }
14081 }, ma.destroy = function() {
14082 var t = this;
14083 t.destroyed = !0, t.cy.stopAnimationLoop();
14084 for (var e = 0; e < t.bindings.length; e++) {
14085 var r = t.bindings[e], a = r, n = a.target;
14086 (n.off || n.removeEventListener).apply(n, a.args);
14087 }
14088 if (t.bindings = [], t.beforeRenderCallbacks = [], t.onUpdateEleCalcsFns = [], t.removeObserver && t.removeObserver.disconnect(), t.styleObserver && t.styleObserver.disconnect(), t.resizeObserver && t.resizeObserver.disconnect(), t.labelCalcDiv)
14089 try {
14090 document.body.removeChild(t.labelCalcDiv);
14091 } catch {
14092 }
14093 }, ma.isHeadless = function() {
14094 return !1;
14095 }, [Fi, fl, hl, ya, mr, Ja].forEach(function(t) {
14096 He(ma, t);
14097 });
14098 var zi = 1e3 / 60, dl = {
14099 setupDequeueing: function(e) {
14100 return function() {
14101 var a = this, n = this.renderer;
14102 if (!a.dequeueingSetup) {
14103 a.dequeueingSetup = !0;
14104 var i = on(function() {
14105 n.redrawHint("eles", !0), n.redrawHint("drag", !0), n.redraw();
14106 }, e.deqRedrawThreshold), s = function(l, f) {
14107 var h = gr(), v = n.averageRedrawTime, d = n.lastRedrawTime, c = [], y = n.cy.extent(), p = n.getPixelRatio();
14108 for (l || n.flushRenderedStyleQueue(); ; ) {
14109 var g = gr(), m = g - h, b = g - f;
14110 if (d < zi) {
14111 var E = zi - (l ? v : 0);
14112 if (b >= e.deqFastCost * E)
14113 break;
14114 } else if (l) {
14115 if (m >= e.deqCost * d || m >= e.deqAvgCost * v)
14116 break;
14117 } else if (b >= e.deqNoDrawCost * zi)
14118 break;
14119 var M = e.deq(a, p, y);
14120 if (M.length > 0)
14121 for (var L = 0; L < M.length; L++)
14122 c.push(M[L]);
14123 else
14124 break;
14125 }
14126 c.length > 0 && (e.onDeqd(a, c), !l && e.shouldRedraw(a, c, p, y) && i());
14127 }, o = e.priority || si;
14128 n.beforeRender(s, o(a));
14129 }
14130 };
14131 }
14132 }, gg = /* @__PURE__ */ function() {
14133 function t(e) {
14134 var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : fn;
14135 fe(this, t), this.idsByKey = new ur(), this.keyForId = new ur(), this.cachesByLvl = new ur(), this.lvls = [], this.getKey = e, this.doesEleInvalidateKey = r;
14136 }
14137 return C(t, [{
14138 key: "getIdsFor",
14139 value: function(r) {
14140 r == null && xt("Can not get id list for null key");
14141 var a = this.idsByKey, n = this.idsByKey.get(r);
14142 return n || (n = new Jr(), a.set(r, n)), n;
14143 }
14144 }, {
14145 key: "addIdForKey",
14146 value: function(r, a) {
14147 r != null && this.getIdsFor(r).add(a);
14148 }
14149 }, {
14150 key: "deleteIdForKey",
14151 value: function(r, a) {
14152 r != null && this.getIdsFor(r).delete(a);
14153 }
14154 }, {
14155 key: "getNumberOfIdsForKey",
14156 value: function(r) {
14157 return r == null ? 0 : this.getIdsFor(r).size;
14158 }
14159 }, {
14160 key: "updateKeyMappingFor",
14161 value: function(r) {
14162 var a = r.id(), n = this.keyForId.get(a), i = this.getKey(r);
14163 this.deleteIdForKey(n, a), this.addIdForKey(i, a), this.keyForId.set(a, i);
14164 }
14165 }, {
14166 key: "deleteKeyMappingFor",
14167 value: function(r) {
14168 var a = r.id(), n = this.keyForId.get(a);
14169 this.deleteIdForKey(n, a), this.keyForId.delete(a);
14170 }
14171 }, {
14172 key: "keyHasChangedFor",
14173 value: function(r) {
14174 var a = r.id(), n = this.keyForId.get(a), i = this.getKey(r);
14175 return n !== i;
14176 }
14177 }, {
14178 key: "isInvalid",
14179 value: function(r) {
14180 return this.keyHasChangedFor(r) || this.doesEleInvalidateKey(r);
14181 }
14182 }, {
14183 key: "getCachesAt",
14184 value: function(r) {
14185 var a = this.cachesByLvl, n = this.lvls, i = a.get(r);
14186 return i || (i = new ur(), a.set(r, i), n.push(r)), i;
14187 }
14188 }, {
14189 key: "getCache",
14190 value: function(r, a) {
14191 return this.getCachesAt(a).get(r);
14192 }
14193 }, {
14194 key: "get",
14195 value: function(r, a) {
14196 var n = this.getKey(r), i = this.getCache(n, a);
14197 return i != null && this.updateKeyMappingFor(r), i;
14198 }
14199 }, {
14200 key: "getForCachedKey",
14201 value: function(r, a) {
14202 var n = this.keyForId.get(r.id()), i = this.getCache(n, a);
14203 return i;
14204 }
14205 }, {
14206 key: "hasCache",
14207 value: function(r, a) {
14208 return this.getCachesAt(a).has(r);
14209 }
14210 }, {
14211 key: "has",
14212 value: function(r, a) {
14213 var n = this.getKey(r);
14214 return this.hasCache(n, a);
14215 }
14216 }, {
14217 key: "setCache",
14218 value: function(r, a, n) {
14219 n.key = r, this.getCachesAt(a).set(r, n);
14220 }
14221 }, {
14222 key: "set",
14223 value: function(r, a, n) {
14224 var i = this.getKey(r);
14225 this.setCache(i, a, n), this.updateKeyMappingFor(r);
14226 }
14227 }, {
14228 key: "deleteCache",
14229 value: function(r, a) {
14230 this.getCachesAt(a).delete(r);
14231 }
14232 }, {
14233 key: "delete",
14234 value: function(r, a) {
14235 var n = this.getKey(r);
14236 this.deleteCache(n, a);
14237 }
14238 }, {
14239 key: "invalidateKey",
14240 value: function(r) {
14241 var a = this;
14242 this.lvls.forEach(function(n) {
14243 return a.deleteCache(r, n);
14244 });
14245 }
14246 // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key)
14247 }, {
14248 key: "invalidate",
14249 value: function(r) {
14250 var a = r.id(), n = this.keyForId.get(a);
14251 this.deleteKeyMappingFor(r);
14252 var i = this.doesEleInvalidateKey(r);
14253 return i && this.invalidateKey(n), i || this.getNumberOfIdsForKey(n) === 0;
14254 }
14255 }]), t;
14256 }(), gl = 25, Kn = 50, Zn = -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 = {
14257 dequeue: "dequeue",
14258 downscale: "downscale",
14259 highQuality: "highQuality"
14260 }, Ng = At({
14261 getKey: null,
14262 doesEleInvalidateKey: fn,
14263 drawElement: null,
14264 getBoundingBox: null,
14265 getRotationPoint: null,
14266 getRotationOffset: null,
14267 isVisible: cs,
14268 allowEdgeTxrCaching: !0,
14269 allowParentTxrCaching: !0
14270 }), ja = function(e, r) {
14271 var a = this;
14272 a.renderer = e, a.onDequeues = [];
14273 var n = Ng(r);
14274 He(a, n), a.lookup = new gg(n.getKey, n.doesEleInvalidateKey), a.setupDequeueing();
14275 }, Dt = ja.prototype;
14276 Dt.reasons = ba, Dt.getTextureQueue = function(t) {
14277 var e = this;
14278 return e.eleImgCaches = e.eleImgCaches || {}, e.eleImgCaches[t] = e.eleImgCaches[t] || [];
14279 }, Dt.getRetiredTextureQueue = function(t) {
14280 var e = this, r = e.eleImgCaches.retired = e.eleImgCaches.retired || {}, a = r[t] = r[t] || [];
14281 return a;
14282 }, Dt.getElementQueue = function() {
14283 var t = this, e = t.eleCacheQueue = t.eleCacheQueue || new Ra(function(r, a) {
14284 return a.reqs - r.reqs;
14285 });
14286 return e;
14287 }, Dt.getElementKeyToQueue = function() {
14288 var t = this, e = t.eleKeyToCacheQueue = t.eleKeyToCacheQueue || {};
14289 return e;
14290 }, Dt.getElement = function(t, e, r, a, n) {
14291 var i = this, s = this.renderer, o = s.cy.zoom(), u = this.lookup;
14292 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())
14293 return null;
14294 if (a == null && (a = Math.ceil(ui(o * r))), a < Zn)
14295 a = Zn;
14296 else if (o >= pg || a > Vi)
14297 return null;
14298 var l = Math.pow(2, a), f = e.h * l, h = e.w * l, v = s.eleTextBiggerThanMin(t, l);
14299 if (!this.isVisible(t, v))
14300 return null;
14301 var d = u.get(t, a);
14302 if (d && d.invalidated && (d.invalidated = !1, d.texture.invalidatedWidth -= d.width), d)
14303 return d;
14304 var c;
14305 if (f <= gl ? c = gl : f <= Kn ? c = Kn : c = Math.ceil(f / Kn) * Kn, f > Eg || h > bg)
14306 return null;
14307 var y = i.getTextureQueue(c), p = y[y.length - 2], g = function() {
14308 return i.recycleTexture(c, h) || i.addTexture(c, h);
14309 };
14310 p || (p = y[y.length - 1]), p || (p = g()), p.width - p.usedWidth < h && (p = g());
14311 for (var m = function(K) {
14312 return K && K.scaledLabelShown === v;
14313 }, b = n && n === ba.dequeue, E = n && n === ba.highQuality, M = n && n === ba.downscale, L, w = a + 1; w <= Vi; w++) {
14314 var k = u.get(t, w);
14315 if (k) {
14316 L = k;
14317 break;
14318 }
14319 }
14320 var D = L && L.level === a + 1 ? L : null, F = function() {
14321 p.context.drawImage(D.texture.canvas, D.x, 0, D.width, D.height, p.usedWidth, 0, h, f);
14322 };
14323 if (p.context.setTransform(1, 0, 0, 1, 0, 0), p.context.clearRect(p.usedWidth, 0, h, c), m(D))
14324 F();
14325 else if (m(L))
14326 if (E) {
14327 for (var G = L.level; G > a; G--)
14328 D = i.getElement(t, e, r, G, ba.downscale);
14329 F();
14330 } else
14331 return i.queueElement(t, L.level - 1), L;
14332 else {
14333 var N;
14334 if (!b && !E && !M)
14335 for (var X = a - 1; X >= Zn; X--) {
14336 var B = u.get(t, X);
14337 if (B) {
14338 N = B;
14339 break;
14340 }
14341 }
14342 if (m(N))
14343 return i.queueElement(t, a), N;
14344 p.context.translate(p.usedWidth, 0), p.context.scale(l, l), this.drawElement(p.context, t, e, v, !1), p.context.scale(1 / l, 1 / l), p.context.translate(-p.usedWidth, 0);
14345 }
14346 return d = {
14347 x: p.usedWidth,
14348 texture: p,
14349 level: a,
14350 scale: l,
14351 width: h,
14352 height: f,
14353 scaledLabelShown: v
14354 }, p.usedWidth += Math.ceil(h + yg), p.eleCaches.push(d), u.set(t, a, d), i.checkTextureFullness(p), d;
14355 }, Dt.invalidateElements = function(t) {
14356 for (var e = 0; e < t.length; e++)
14357 this.invalidateElement(t[e]);
14358 }, Dt.invalidateElement = function(t) {
14359 var e = this, r = e.lookup, a = [], n = r.isInvalid(t);
14360 if (n) {
14361 for (var i = Zn; i <= Vi; i++) {
14362 var s = r.getForCachedKey(t, i);
14363 s && a.push(s);
14364 }
14365 var o = r.invalidate(t);
14366 if (o)
14367 for (var u = 0; u < a.length; u++) {
14368 var l = a[u], f = l.texture;
14369 f.invalidatedWidth += l.width, l.invalidated = !0, e.checkTextureUtility(f);
14370 }
14371 e.removeFromQueue(t);
14372 }
14373 }, Dt.checkTextureUtility = function(t) {
14374 t.invalidatedWidth >= wg * t.width && this.retireTexture(t);
14375 }, Dt.checkTextureFullness = function(t) {
14376 var e = this, r = e.getTextureQueue(t.height);
14377 t.usedWidth / t.width > xg && t.fullnessChecks >= Tg ? xr(r, t) : t.fullnessChecks++;
14378 }, Dt.retireTexture = function(t) {
14379 var e = this, r = t.height, a = e.getTextureQueue(r), n = this.lookup;
14380 xr(a, t), t.retired = !0;
14381 for (var i = t.eleCaches, s = 0; s < i.length; s++) {
14382 var o = i[s];
14383 n.deleteCache(o.key, o.level);
14384 }
14385 oi(i);
14386 var u = e.getRetiredTextureQueue(r);
14387 u.push(t);
14388 }, Dt.addTexture = function(t, e) {
14389 var r = this, a = r.getTextureQueue(t), n = {};
14390 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;
14391 }, Dt.recycleTexture = function(t, e) {
14392 for (var r = this, a = r.getTextureQueue(t), n = r.getRetiredTextureQueue(t), i = 0; i < n.length; i++) {
14393 var s = n[i];
14394 if (s.width >= e)
14395 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), xr(n, s), a.push(s), s;
14396 }
14397 }, Dt.queueElement = function(t, e) {
14398 var r = this, a = r.getElementQueue(), n = r.getElementKeyToQueue(), i = this.getKey(t), s = n[i];
14399 if (s)
14400 s.level = Math.max(s.level, e), s.eles.merge(t), s.reqs++, a.updateItem(s);
14401 else {
14402 var o = {
14403 eles: t.spawn().merge(t),
14404 level: e,
14405 reqs: 1,
14406 key: i
14407 };
14408 a.push(o), n[i] = o;
14409 }
14410 }, Dt.dequeue = function(t) {
14411 for (var e = this, r = e.getElementQueue(), a = e.getElementKeyToQueue(), n = [], i = e.lookup, s = 0; s < Og && r.size() > 0; s++) {
14412 var o = r.pop(), u = o.key, l = o.eles[0], f = i.hasCache(l, o.level);
14413 if (a[u] = null, f)
14414 continue;
14415 n.push(o);
14416 var h = e.getBoundingBox(l);
14417 e.getElement(l, h, t, o.level, ba.dequeue);
14418 }
14419 return n;
14420 }, Dt.removeFromQueue = function(t) {
14421 var e = this, r = e.getElementQueue(), a = e.getElementKeyToQueue(), n = this.getKey(t), i = a[n];
14422 i != null && (i.eles.length === 1 ? (i.reqs = ii, r.updateItem(i), r.pop(), a[n] = null) : i.eles.unmerge(t));
14423 }, Dt.onDequeue = function(t) {
14424 this.onDequeues.push(t);
14425 }, Dt.offDequeue = function(t) {
14426 xr(this.onDequeues, t);
14427 }, Dt.setupDequeueing = dl.setupDequeueing({
14428 deqRedrawThreshold: Ag,
14429 deqCost: Cg,
14430 deqAvgCost: Dg,
14431 deqNoDrawCost: Sg,
14432 deqFastCost: Lg,
14433 deq: function(e, r, a) {
14434 return e.dequeue(r, a);
14435 },
14436 onDeqd: function(e, r) {
14437 for (var a = 0; a < e.onDequeues.length; a++) {
14438 var n = e.onDequeues[a];
14439 n(r);
14440 }
14441 },
14442 shouldRedraw: function(e, r, a, n) {
14443 for (var i = 0; i < r.length; i++)
14444 for (var s = r[i].eles, o = 0; o < s.length; o++) {
14445 var u = s[o].boundingBox();
14446 if (fi(u, n))
14447 return !0;
14448 }
14449 return !1;
14450 },
14451 priority: function(e) {
14452 return e.renderer.beforeRenderPriorities.eleTxrDeq;
14453 }
14454 });
14455 var Ig = 1, en = -4, Qn = 2, Mg = 3.99, Rg = 50, kg = 50, Pg = 0.15, Bg = 0.1, Fg = 0.9, Gg = 0.9, zg = 1, pl = 250, Vg = 4e3 * 4e3, Ug = !0, yl = function(e) {
14456 var r = this, a = r.renderer = e, n = a.cy;
14457 r.layersByLevel = {}, r.firstGet = !0, r.lastInvalidationTime = gr() - 2 * pl, r.skipping = !1, r.eleTxrDeqs = n.collection(), r.scheduleElementRefinement = on(function() {
14458 r.refineElementTextures(r.eleTxrDeqs), r.eleTxrDeqs.unmerge(r.eleTxrDeqs);
14459 }, kg), a.beforeRender(function(s, o) {
14460 o - r.lastInvalidationTime <= pl ? r.skipping = !0 : r.skipping = !1;
14461 }, a.beforeRenderPriorities.lyrTxrSkip);
14462 var i = function(o, u) {
14463 return u.reqs - o.reqs;
14464 };
14465 r.layersQueue = new Ra(i), r.setupDequeueing();
14466 }, Mt = yl.prototype, ml = 0, $g = Math.pow(2, 53) - 1;
14467 Mt.makeLayer = function(t, e) {
14468 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 = {
14469 id: ml = ++ml % $g,
14470 bb: t,
14471 level: e,
14472 width: a,
14473 height: n,
14474 canvas: i,
14475 context: i.getContext("2d"),
14476 eles: [],
14477 elesQueue: [],
14478 reqs: 0
14479 }, o = s.context, u = -s.bb.x1, l = -s.bb.y1;
14480 return o.scale(r, r), o.translate(u, l), s;
14481 }, Mt.getLayers = function(t, e, r) {
14482 var a = this, n = a.renderer, i = n.cy, s = i.zoom(), o = a.firstGet;
14483 if (a.firstGet = !1, r == null) {
14484 if (r = Math.ceil(ui(s * e)), r < en)
14485 r = en;
14486 else if (s >= Mg || r > Qn)
14487 return null;
14488 }
14489 a.validateLayersElesOrdering(r, t);
14490 var u = a.layersByLevel, l = Math.pow(2, r), f = u[r] = u[r] || [], h, v = a.levelIsComplete(r, t), d, c = function() {
14491 var F = function(re) {
14492 if (a.validateLayersElesOrdering(re, t), a.levelIsComplete(re, t))
14493 return d = u[re], !0;
14494 }, G = function(re) {
14495 if (!d)
14496 for (var K = r + re; en <= K && K <= Qn && !F(K); K += re)
14497 ;
14498 };
14499 G(1), G(-1);
14500 for (var N = f.length - 1; N >= 0; N--) {
14501 var X = f[N];
14502 X.invalid && xr(f, X);
14503 }
14504 };
14505 if (!v)
14506 c();
14507 else
14508 return f;
14509 var y = function() {
14510 if (!h) {
14511 h = Yt();
14512 for (var F = 0; F < t.length; F++)
14513 ws(h, t[F].boundingBox());
14514 }
14515 return h;
14516 }, p = function(F) {
14517 F = F || {};
14518 var G = F.after;
14519 y();
14520 var N = h.w * l * (h.h * l);
14521 if (N > Vg)
14522 return null;
14523 var X = a.makeLayer(h, r);
14524 if (G != null) {
14525 var B = f.indexOf(G) + 1;
14526 f.splice(B, 0, X);
14527 } else
14528 (F.insert === void 0 || F.insert) && f.unshift(X);
14529 return X;
14530 };
14531 if (a.skipping && !o)
14532 return null;
14533 for (var g = null, m = t.length / Ig, b = !o, E = 0; E < t.length; E++) {
14534 var M = t[E], L = M._private.rscratch, w = L.imgLayerCaches = L.imgLayerCaches || {}, k = w[r];
14535 if (k) {
14536 g = k;
14537 continue;
14538 }
14539 if ((!g || g.eles.length >= m || !Ts(g.bb, M.boundingBox())) && (g = p({
14540 insert: !0,
14541 after: g
14542 }), !g))
14543 return null;
14544 d || b ? a.queueLayer(g, M) : a.drawEleInLayer(g, M, r, e), g.eles.push(M), w[r] = g;
14545 }
14546 return d || (b ? null : f);
14547 }, Mt.getEleLevelForLayerLevel = function(t, e) {
14548 return t;
14549 }, Mt.drawEleInLayer = function(t, e, r, a) {
14550 var n = this, i = this.renderer, s = t.context, o = e.boundingBox();
14551 o.w === 0 || o.h === 0 || !e.visible() || (r = n.getEleLevelForLayerLevel(r, a), i.setImgSmoothing(s, !1), i.drawCachedElement(s, e, null, null, r, Ug), i.setImgSmoothing(s, !0));
14552 }, Mt.levelIsComplete = function(t, e) {
14553 var r = this, a = r.layersByLevel[t];
14554 if (!a || a.length === 0)
14555 return !1;
14556 for (var n = 0, i = 0; i < a.length; i++) {
14557 var s = a[i];
14558 if (s.reqs > 0 || s.invalid)
14559 return !1;
14560 n += s.eles.length;
14561 }
14562 return n === e.length;
14563 }, Mt.validateLayersElesOrdering = function(t, e) {
14564 var r = this.layersByLevel[t];
14565 if (r)
14566 for (var a = 0; a < r.length; a++) {
14567 for (var n = r[a], i = -1, s = 0; s < e.length; s++)
14568 if (n.eles[0] === e[s]) {
14569 i = s;
14570 break;
14571 }
14572 if (i < 0) {
14573 this.invalidateLayer(n);
14574 continue;
14575 }
14576 for (var o = i, s = 0; s < n.eles.length; s++)
14577 if (n.eles[s] !== e[o + s]) {
14578 this.invalidateLayer(n);
14579 break;
14580 }
14581 }
14582 }, Mt.updateElementsInLayers = function(t, e) {
14583 for (var r = this, a = Ae(t[0]), n = 0; n < t.length; n++)
14584 for (var i = a ? null : t[n], s = a ? t[n] : t[n].ele, o = s._private.rscratch, u = o.imgLayerCaches = o.imgLayerCaches || {}, l = en; l <= Qn; l++) {
14585 var f = u[l];
14586 f && (i && r.getEleLevelForLayerLevel(f.level) !== i.level || e(f, s, i));
14587 }
14588 }, Mt.haveLayers = function() {
14589 for (var t = this, e = !1, r = en; r <= Qn; r++) {
14590 var a = t.layersByLevel[r];
14591 if (a && a.length > 0) {
14592 e = !0;
14593 break;
14594 }
14595 }
14596 return e;
14597 }, Mt.invalidateElements = function(t) {
14598 var e = this;
14599 t.length !== 0 && (e.lastInvalidationTime = gr(), !(t.length === 0 || !e.haveLayers()) && e.updateElementsInLayers(t, function(a, n, i) {
14600 e.invalidateLayer(a);
14601 }));
14602 }, Mt.invalidateLayer = function(t) {
14603 if (this.lastInvalidationTime = gr(), !t.invalid) {
14604 var e = t.level, r = t.eles, a = this.layersByLevel[e];
14605 xr(a, t), t.elesQueue = [], t.invalid = !0, t.replacement && (t.replacement.invalid = !0);
14606 for (var n = 0; n < r.length; n++) {
14607 var i = r[n]._private.rscratch.imgLayerCaches;
14608 i && (i[e] = null);
14609 }
14610 }
14611 }, Mt.refineElementTextures = function(t) {
14612 var e = this;
14613 e.updateElementsInLayers(t, function(a, n, i) {
14614 var s = a.replacement;
14615 if (s || (s = a.replacement = e.makeLayer(a.bb, a.level), s.replaces = a, s.eles = a.eles), !s.reqs)
14616 for (var o = 0; o < s.eles.length; o++)
14617 e.queueLayer(s, s.eles[o]);
14618 });
14619 }, Mt.enqueueElementRefinement = function(t) {
14620 this.eleTxrDeqs.merge(t), this.scheduleElementRefinement();
14621 }, Mt.queueLayer = function(t, e) {
14622 var r = this, a = r.layersQueue, n = t.elesQueue, i = n.hasId = n.hasId || {};
14623 if (!t.replacement) {
14624 if (e) {
14625 if (i[e.id()])
14626 return;
14627 n.push(e), i[e.id()] = !0;
14628 }
14629 t.reqs ? (t.reqs++, a.updateItem(t)) : (t.reqs = 1, a.push(t));
14630 }
14631 }, Mt.dequeue = function(t) {
14632 for (var e = this, r = e.layersQueue, a = [], n = 0; n < zg && r.size() !== 0; ) {
14633 var i = r.peek();
14634 if (i.replacement) {
14635 r.pop();
14636 continue;
14637 }
14638 if (i.replaces && i !== i.replaces.replacement) {
14639 r.pop();
14640 continue;
14641 }
14642 if (i.invalid) {
14643 r.pop();
14644 continue;
14645 }
14646 var s = i.elesQueue.shift();
14647 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());
14648 }
14649 return a;
14650 }, Mt.applyLayerReplacement = function(t) {
14651 var e = this, r = e.layersByLevel[t.level], a = t.replaces, n = r.indexOf(a);
14652 if (!(n < 0 || a.invalid)) {
14653 r[n] = t;
14654 for (var i = 0; i < t.eles.length; i++) {
14655 var s = t.eles[i]._private, o = s.imgLayerCaches = s.imgLayerCaches || {};
14656 o && (o[t.level] = t);
14657 }
14658 e.requestRedraw();
14659 }
14660 }, Mt.requestRedraw = on(function() {
14661 var t = this.renderer;
14662 t.redrawHint("eles", !0), t.redrawHint("drag", !0), t.redraw();
14663 }, 100), Mt.setupDequeueing = dl.setupDequeueing({
14664 deqRedrawThreshold: Rg,
14665 deqCost: Pg,
14666 deqAvgCost: Bg,
14667 deqNoDrawCost: Fg,
14668 deqFastCost: Gg,
14669 deq: function(e, r) {
14670 return e.dequeue(r);
14671 },
14672 onDeqd: si,
14673 shouldRedraw: cs,
14674 priority: function(e) {
14675 return e.renderer.beforeRenderPriorities.lyrTxrDeq;
14676 }
14677 });
14678 var bl = {}, El;
14679 function _g(t, e) {
14680 for (var r = 0; r < e.length; r++) {
14681 var a = e[r];
14682 t.lineTo(a.x, a.y);
14683 }
14684 }
14685 function Yg(t, e, r) {
14686 for (var a, n = 0; n < e.length; n++) {
14687 var i = e[n];
14688 n === 0 && (a = i), t.lineTo(i.x, i.y);
14689 }
14690 t.quadraticCurveTo(r.x, r.y, a.x, a.y);
14691 }
14692 function wl(t, e, r) {
14693 t.beginPath && t.beginPath();
14694 for (var a = e, n = 0; n < a.length; n++) {
14695 var i = a[n];
14696 t.lineTo(i.x, i.y);
14697 }
14698 var s = r, o = r[0];
14699 t.moveTo(o.x, o.y);
14700 for (var n = 1; n < s.length; n++) {
14701 var i = s[n];
14702 t.lineTo(i.x, i.y);
14703 }
14704 t.closePath && t.closePath();
14705 }
14706 function Hg(t, e, r, a, n) {
14707 t.beginPath && t.beginPath(), t.arc(r, a, n, 0, Math.PI * 2, !1);
14708 var i = e, s = i[0];
14709 t.moveTo(s.x, s.y);
14710 for (var o = 0; o < i.length; o++) {
14711 var u = i[o];
14712 t.lineTo(u.x, u.y);
14713 }
14714 t.closePath && t.closePath();
14715 }
14716 function Xg(t, e, r, a) {
14717 t.arc(e, r, a, 0, Math.PI * 2, !1);
14718 }
14719 bl.arrowShapeImpl = function(t) {
14720 return (El || (El = {
14721 polygon: _g,
14722 "triangle-backcurve": Yg,
14723 "triangle-tee": wl,
14724 "circle-triangle": Hg,
14725 "triangle-cross": wl,
14726 circle: Xg
14727 }))[t];
14728 };
14729 var vr = {};
14730 vr.drawElement = function(t, e, r, a, n, i) {
14731 var s = this;
14732 e.isNode() ? s.drawNode(t, e, r, a, n, i) : s.drawEdge(t, e, r, a, n, i);
14733 }, vr.drawElementOverlay = function(t, e) {
14734 var r = this;
14735 e.isNode() ? r.drawNodeOverlay(t, e) : r.drawEdgeOverlay(t, e);
14736 }, vr.drawElementUnderlay = function(t, e) {
14737 var r = this;
14738 e.isNode() ? r.drawNodeUnderlay(t, e) : r.drawEdgeUnderlay(t, e);
14739 }, vr.drawCachedElementPortion = function(t, e, r, a, n, i, s, o) {
14740 var u = this, l = r.getBoundingBox(e);
14741 if (!(l.w === 0 || l.h === 0)) {
14742 var f = r.getElement(e, l, a, n, i);
14743 if (f != null) {
14744 var h = o(u, e);
14745 if (h === 0)
14746 return;
14747 var v = s(u, e), d = l.x1, c = l.y1, y = l.w, p = l.h, g, m, b, E, M;
14748 if (v !== 0) {
14749 var L = r.getRotationPoint(e);
14750 b = L.x, E = L.y, t.translate(b, E), t.rotate(v), M = u.getImgSmoothing(t), M || u.setImgSmoothing(t, !0);
14751 var w = r.getRotationOffset(e);
14752 g = w.x, m = w.y;
14753 } else
14754 g = d, m = c;
14755 var k;
14756 h !== 1 && (k = t.globalAlpha, t.globalAlpha = k * h), t.drawImage(f.texture.canvas, f.x, 0, f.width, f.height, g, m, y, p), h !== 1 && (t.globalAlpha = k), v !== 0 && (t.rotate(-v), t.translate(-b, -E), M || u.setImgSmoothing(t, !1));
14757 } else
14758 r.drawElement(t, e);
14759 }
14760 };
14761 var Wg = function() {
14762 return 0;
14763 }, qg = function(e, r) {
14764 return e.getTextAngle(r, null);
14765 }, Kg = function(e, r) {
14766 return e.getTextAngle(r, "source");
14767 }, Zg = function(e, r) {
14768 return e.getTextAngle(r, "target");
14769 }, Qg = function(e, r) {
14770 return r.effectiveOpacity();
14771 }, Ui = function(e, r) {
14772 return r.pstyle("text-opacity").pfValue * r.effectiveOpacity();
14773 };
14774 vr.drawCachedElement = function(t, e, r, a, n, i) {
14775 var s = this, o = s.data, u = o.eleTxrCache, l = o.lblTxrCache, f = o.slbTxrCache, h = o.tlbTxrCache, v = e.boundingBox(), d = i === !0 ? u.reasons.highQuality : null;
14776 if (!(v.w === 0 || v.h === 0 || !e.visible()) && (!a || fi(v, a))) {
14777 var c = e.isEdge(), y = e.element()._private.rscratch.badLine;
14778 s.drawElementUnderlay(t, e), s.drawCachedElementPortion(t, e, u, r, n, d, Wg, Qg), (!c || !y) && s.drawCachedElementPortion(t, e, l, r, n, d, qg, Ui), c && !y && (s.drawCachedElementPortion(t, e, f, r, n, d, Kg, Ui), s.drawCachedElementPortion(t, e, h, r, n, d, Zg, Ui)), s.drawElementOverlay(t, e);
14779 }
14780 }, vr.drawElements = function(t, e) {
14781 for (var r = this, a = 0; a < e.length; a++) {
14782 var n = e[a];
14783 r.drawElement(t, n);
14784 }
14785 }, vr.drawCachedElements = function(t, e, r, a) {
14786 for (var n = this, i = 0; i < e.length; i++) {
14787 var s = e[i];
14788 n.drawCachedElement(t, s, r, a);
14789 }
14790 }, vr.drawCachedNodes = function(t, e, r, a) {
14791 for (var n = this, i = 0; i < e.length; i++) {
14792 var s = e[i];
14793 s.isNode() && n.drawCachedElement(t, s, r, a);
14794 }
14795 }, vr.drawLayeredElements = function(t, e, r, a) {
14796 var n = this, i = n.data.lyrTxrCache.getLayers(e, r);
14797 if (i)
14798 for (var s = 0; s < i.length; s++) {
14799 var o = i[s], u = o.bb;
14800 u.w === 0 || u.h === 0 || t.drawImage(o.canvas, u.x1, u.y1, u.w, u.h);
14801 }
14802 else
14803 n.drawCachedElements(t, e, r, a);
14804 };
14805 var br = {};
14806 br.drawEdge = function(t, e, r) {
14807 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;
14808 if (!(i && !e.visible()) && !(o.badLine || o.allpts == null || isNaN(o.allpts[0]))) {
14809 var u;
14810 r && (u = r, t.translate(-u.x1, -u.y1));
14811 var l = i ? e.pstyle("opacity").value : 1, f = i ? e.pstyle("line-opacity").value : 1, h = e.pstyle("curve-style").value, v = e.pstyle("line-style").value, d = e.pstyle("width").pfValue, c = e.pstyle("line-cap").value, y = l * f, p = l * f, g = function() {
14812 var N = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : y;
14813 h === "straight-triangle" ? (s.eleStrokeStyle(t, e, N), s.drawEdgeTrianglePath(e, t, o.allpts)) : (t.lineWidth = d, t.lineCap = c, s.eleStrokeStyle(t, e, N), s.drawEdgePath(e, t, o.allpts, v), t.lineCap = "butt");
14814 }, m = function() {
14815 n && s.drawEdgeOverlay(t, e);
14816 }, b = function() {
14817 n && s.drawEdgeUnderlay(t, e);
14818 }, E = function() {
14819 var N = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : p;
14820 s.drawArrowheads(t, e, N);
14821 }, M = function() {
14822 s.drawElementText(t, e, null, a);
14823 };
14824 t.lineJoin = "round";
14825 var L = e.pstyle("ghost").value === "yes";
14826 if (L) {
14827 var w = e.pstyle("ghost-offset-x").pfValue, k = e.pstyle("ghost-offset-y").pfValue, D = e.pstyle("ghost-opacity").value, F = y * D;
14828 t.translate(w, k), g(F), E(F), t.translate(-w, -k);
14829 }
14830 b(), g(), E(), m(), M(), r && t.translate(u.x1, u.y1);
14831 }
14832 };
14833 var xl = function(e) {
14834 if (!["overlay", "underlay"].includes(e))
14835 throw new Error("Invalid state");
14836 return function(r, a) {
14837 if (a.visible()) {
14838 var n = a.pstyle("".concat(e, "-opacity")).value;
14839 if (n !== 0) {
14840 var i = this, s = i.usePaths(), o = a._private.rscratch, u = a.pstyle("".concat(e, "-padding")).pfValue, l = 2 * u, f = a.pstyle("".concat(e, "-color")).value;
14841 r.lineWidth = l, 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");
14842 }
14843 }
14844 };
14845 };
14846 br.drawEdgeOverlay = xl("overlay"), br.drawEdgeUnderlay = xl("underlay"), br.drawEdgePath = function(t, e, r, a) {
14847 var n = t._private.rscratch, i = e, s, o = !1, u = this.usePaths(), l = t.pstyle("line-dash-pattern").pfValue, f = t.pstyle("line-dash-offset").pfValue;
14848 if (u) {
14849 var h = r.join("$"), v = n.pathCacheKey && n.pathCacheKey === h;
14850 v ? (s = e = n.pathCache, o = !0) : (s = e = new Path2D(), n.pathCacheKey = h, n.pathCache = s);
14851 }
14852 if (i.setLineDash)
14853 switch (a) {
14854 case "dotted":
14855 i.setLineDash([1, 1]);
14856 break;
14857 case "dashed":
14858 i.setLineDash(l), i.lineDashOffset = f;
14859 break;
14860 case "solid":
14861 i.setLineDash([]);
14862 break;
14863 }
14864 if (!o && !n.badLine)
14865 switch (e.beginPath && e.beginPath(), e.moveTo(r[0], r[1]), n.edgeType) {
14866 case "bezier":
14867 case "self":
14868 case "compound":
14869 case "multibezier":
14870 for (var d = 2; d + 3 < r.length; d += 4)
14871 e.quadraticCurveTo(r[d], r[d + 1], r[d + 2], r[d + 3]);
14872 break;
14873 case "straight":
14874 case "segments":
14875 case "haystack":
14876 for (var c = 2; c + 1 < r.length; c += 2)
14877 e.lineTo(r[c], r[c + 1]);
14878 break;
14879 }
14880 e = i, u ? e.stroke(s) : e.stroke(), e.setLineDash && e.setLineDash([]);
14881 }, br.drawEdgeTrianglePath = function(t, e, r) {
14882 e.fillStyle = e.strokeStyle;
14883 for (var a = t.pstyle("width").pfValue, n = 0; n + 1 < r.length; n += 2) {
14884 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], u = [o[0] * a / 2, o[1] * a / 2];
14885 e.beginPath(), e.moveTo(r[n] - u[0], r[n + 1] - u[1]), e.lineTo(r[n] + u[0], r[n + 1] + u[1]), e.lineTo(r[n + 2], r[n + 3]), e.closePath(), e.fill();
14886 }
14887 }, br.drawArrowheads = function(t, e, r) {
14888 var a = e._private.rscratch, n = a.edgeType === "haystack";
14889 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);
14890 }, br.drawArrowhead = function(t, e, r, a, n, i, s) {
14891 if (!(isNaN(a) || a == null || isNaN(n) || n == null || isNaN(i) || i == null)) {
14892 var o = this, u = e.pstyle(r + "-arrow-shape").value;
14893 if (u !== "none") {
14894 var l = e.pstyle(r + "-arrow-fill").value === "hollow" ? "both" : "filled", f = e.pstyle(r + "-arrow-fill").value, h = e.pstyle("width").pfValue, v = e.pstyle(r + "-arrow-width"), d = v.value === "match-line" ? h : v.pfValue;
14895 v.units === "%" && (d *= h);
14896 var c = e.pstyle("opacity").value;
14897 s === void 0 && (s = c);
14898 var y = t.globalCompositeOperation;
14899 (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, l, h, u, d, a, n, i), t.globalCompositeOperation = y);
14900 var p = e.pstyle(r + "-arrow-color").value;
14901 o.colorFillStyle(t, p[0], p[1], p[2], s), o.colorStrokeStyle(t, p[0], p[1], p[2], s), o.drawArrowShape(e, t, f, h, u, d, a, n, i);
14902 }
14903 }
14904 }, br.drawArrowShape = function(t, e, r, a, n, i, s, o, u) {
14905 var l = this, f = this.usePaths() && n !== "triangle-cross", h = !1, v, d = e, c = {
14906 x: s,
14907 y: o
14908 }, y = t.pstyle("arrow-scale").value, p = this.getArrowWidth(a, y), g = l.arrowShapes[n];
14909 if (f) {
14910 var m = l.arrowPathCache = l.arrowPathCache || [], b = Pr(n), E = m[b];
14911 E != null ? (v = e = E, h = !0) : (v = e = new Path2D(), m[b] = v);
14912 }
14913 h || (e.beginPath && e.beginPath(), f ? g.draw(e, 1, 0, {
14914 x: 0,
14915 y: 0
14916 }, 1) : g.draw(e, p, u, c, a), e.closePath && e.closePath()), e = d, f && (e.translate(s, o), e.rotate(u), e.scale(p, p)), (r === "filled" || r === "both") && (f ? e.fill(v) : e.fill()), (r === "hollow" || r === "both") && (e.lineWidth = i / (f ? p : 1), e.lineJoin = "miter", f ? e.stroke(v) : e.stroke()), f && (e.scale(1 / p, 1 / p), e.rotate(-u), e.translate(-s, -o));
14917 };
14918 var $i = {};
14919 $i.safeDrawImage = function(t, e, r, a, n, i, s, o, u, l) {
14920 if (!(n <= 0 || i <= 0 || u <= 0 || l <= 0))
14921 try {
14922 t.drawImage(e, r, a, n, i, s, o, u, l);
14923 } catch (f) {
14924 vt(f);
14925 }
14926 }, $i.drawInscribedImage = function(t, e, r, a, n) {
14927 var i = this, s = r.position(), o = s.x, u = s.y, l = r.cy().style(), f = l.getIndexedStyle.bind(l), h = f(r, "background-fit", "value", a), v = f(r, "background-repeat", "value", a), d = r.width(), c = r.height(), y = r.padding() * 2, p = d + (f(r, "background-width-relative-to", "value", a) === "inner" ? 0 : y), g = c + (f(r, "background-height-relative-to", "value", a) === "inner" ? 0 : y), m = r._private.rscratch, b = f(r, "background-clip", "value", a), E = b === "node", M = f(r, "background-image-opacity", "value", a) * n, L = f(r, "background-image-smoothing", "value", a), w = e.width || e.cachedW, k = e.height || e.cachedH;
14928 (w == null || k == null) && (document.body.appendChild(e), w = e.cachedW = e.width || e.offsetWidth, k = e.cachedH = e.height || e.offsetHeight, document.body.removeChild(e));
14929 var D = w, F = k;
14930 if (f(r, "background-width", "value", a) !== "auto" && (f(r, "background-width", "units", a) === "%" ? D = f(r, "background-width", "pfValue", a) * p : D = f(r, "background-width", "pfValue", a)), f(r, "background-height", "value", a) !== "auto" && (f(r, "background-height", "units", a) === "%" ? F = f(r, "background-height", "pfValue", a) * g : F = f(r, "background-height", "pfValue", a)), !(D === 0 || F === 0)) {
14931 if (h === "contain") {
14932 var G = Math.min(p / D, g / F);
14933 D *= G, F *= G;
14934 } else if (h === "cover") {
14935 var G = Math.max(p / D, g / F);
14936 D *= G, F *= G;
14937 }
14938 var N = o - p / 2, X = f(r, "background-position-x", "units", a), B = f(r, "background-position-x", "pfValue", a);
14939 X === "%" ? N += (p - D) * B : N += B;
14940 var re = f(r, "background-offset-x", "units", a), K = f(r, "background-offset-x", "pfValue", a);
14941 re === "%" ? N += (p - D) * K : N += K;
14942 var W = u - g / 2, ae = f(r, "background-position-y", "units", a), ue = f(r, "background-position-y", "pfValue", a);
14943 ae === "%" ? W += (g - F) * ue : W += ue;
14944 var me = f(r, "background-offset-y", "units", a), ie = f(r, "background-offset-y", "pfValue", a);
14945 me === "%" ? W += (g - F) * ie : W += ie, m.pathCache && (N -= o, W -= u, o = 0, u = 0);
14946 var ge = t.globalAlpha;
14947 t.globalAlpha = M;
14948 var Ee = i.getImgSmoothing(t), Ce = !1;
14949 if (L === "no" && Ee ? (i.setImgSmoothing(t, !1), Ce = !0) : L === "yes" && !Ee && (i.setImgSmoothing(t, !0), Ce = !0), v === "no-repeat")
14950 E && (t.save(), m.pathCache ? t.clip(m.pathCache) : (i.nodeShapes[i.getNodeShape(r)].draw(t, o, u, p, g), t.clip())), i.safeDrawImage(t, e, 0, 0, w, k, N, W, D, F), E && t.restore();
14951 else {
14952 var we = t.createPattern(e, v);
14953 t.fillStyle = we, i.nodeShapes[i.getNodeShape(r)].draw(t, o, u, p, g), t.translate(N, W), t.fill(), t.translate(-N, -W);
14954 }
14955 t.globalAlpha = ge, Ce && i.setImgSmoothing(t, Ee);
14956 }
14957 };
14958 var _r = {};
14959 _r.eleTextBiggerThanMin = function(t, e) {
14960 if (!e) {
14961 var r = t.cy().zoom(), a = this.getPixelRatio(), n = Math.ceil(ui(r * a));
14962 e = Math.pow(2, n);
14963 }
14964 var i = t.pstyle("font-size").pfValue * e, s = t.pstyle("min-zoomed-font-size").pfValue;
14965 return !(i < s);
14966 }, _r.drawElementText = function(t, e, r, a, n) {
14967 var i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this;
14968 if (a == null) {
14969 if (i && !s.eleTextBiggerThanMin(e))
14970 return;
14971 } else if (a === !1)
14972 return;
14973 if (e.isNode()) {
14974 var o = e.pstyle("label");
14975 if (!o || !o.value)
14976 return;
14977 var u = s.getLabelJustification(e);
14978 t.textAlign = u, t.textBaseline = "bottom";
14979 } else {
14980 var l = e.element()._private.rscratch.badLine, f = e.pstyle("label"), h = e.pstyle("source-label"), v = e.pstyle("target-label");
14981 if (l || (!f || !f.value) && (!h || !h.value) && (!v || !v.value))
14982 return;
14983 t.textAlign = "center", t.textBaseline = "bottom";
14984 }
14985 var d = !r, c;
14986 r && (c = r, t.translate(-c.x1, -c.y1)), n == null ? (s.drawText(t, e, null, d, i), e.isEdge() && (s.drawText(t, e, "source", d, i), s.drawText(t, e, "target", d, i))) : s.drawText(t, e, n, d, i), r && t.translate(c.x1, c.y1);
14987 }, _r.getFontCache = function(t) {
14988 var e;
14989 this.fontCaches = this.fontCaches || [];
14990 for (var r = 0; r < this.fontCaches.length; r++)
14991 if (e = this.fontCaches[r], e.context === t)
14992 return e;
14993 return e = {
14994 context: t
14995 }, this.fontCaches.push(e), e;
14996 }, _r.setupTextStyle = function(t, e) {
14997 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, u = e.pstyle("text-outline-opacity").value * o, l = e.pstyle("color").value, f = e.pstyle("text-outline-color").value;
14998 t.font = a + " " + s + " " + n + " " + i, t.lineJoin = "round", this.colorFillStyle(t, l[0], l[1], l[2], o), this.colorStrokeStyle(t, f[0], f[1], f[2], u);
14999 };
15000 function _i(t, e, r, a, n) {
15001 var i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5, s = arguments.length > 6 ? arguments[6] : void 0;
15002 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(), s ? t.stroke() : t.fill();
15003 }
15004 _r.getTextAngle = function(t, e) {
15005 var r, a = t._private, n = a.rscratch, i = e ? e + "-" : "", s = t.pstyle(i + "text-rotation"), o = er(n, "labelAngle", e);
15006 return s.strValue === "autorotate" ? r = t.isEdge() ? o : 0 : s.strValue === "none" ? r = 0 : r = s.pfValue, r;
15007 }, _r.drawText = function(t, e, r) {
15008 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;
15009 if (!(n && (o === 0 || e.pstyle("text-opacity").value === 0))) {
15010 r === "main" && (r = null);
15011 var u = er(s, "labelX", r), l = er(s, "labelY", r), f, h, v = this.getLabelText(e, r);
15012 if (v != null && v !== "" && !isNaN(u) && !isNaN(l)) {
15013 this.setupTextStyle(t, e, n);
15014 var d = r ? r + "-" : "", c = er(s, "labelWidth", r), y = er(s, "labelHeight", r), p = e.pstyle(d + "text-margin-x").pfValue, g = e.pstyle(d + "text-margin-y").pfValue, m = e.isEdge(), b = e.pstyle("text-halign").value, E = e.pstyle("text-valign").value;
15015 m && (b = "center", E = "center"), u += p, l += g;
15016 var M;
15017 switch (a ? M = this.getTextAngle(e, r) : M = 0, M !== 0 && (f = u, h = l, t.translate(f, h), t.rotate(M), u = 0, l = 0), E) {
15018 case "top":
15019 break;
15020 case "center":
15021 l += y / 2;
15022 break;
15023 case "bottom":
15024 l += y;
15025 break;
15026 }
15027 var L = e.pstyle("text-background-opacity").value, w = e.pstyle("text-border-opacity").value, k = e.pstyle("text-border-width").pfValue, D = e.pstyle("text-background-padding").pfValue, F = e.pstyle("text-background-shape").strValue, G = F.indexOf("round") === 0, N = 2;
15028 if (L > 0 || k > 0 && w > 0) {
15029 var X = u - D;
15030 switch (b) {
15031 case "left":
15032 X -= c;
15033 break;
15034 case "center":
15035 X -= c / 2;
15036 break;
15037 }
15038 var B = l - y - D, re = c + 2 * D, K = y + 2 * D;
15039 if (L > 0) {
15040 var W = t.fillStyle, ae = e.pstyle("text-background-color").value;
15041 t.fillStyle = "rgba(" + ae[0] + "," + ae[1] + "," + ae[2] + "," + L * o + ")", G ? _i(t, X, B, re, K, N) : t.fillRect(X, B, re, K), t.fillStyle = W;
15042 }
15043 if (k > 0 && w > 0) {
15044 var ue = t.strokeStyle, me = t.lineWidth, ie = e.pstyle("text-border-color").value, ge = e.pstyle("text-border-style").value;
15045 if (t.strokeStyle = "rgba(" + ie[0] + "," + ie[1] + "," + ie[2] + "," + w * o + ")", t.lineWidth = k, t.setLineDash)
15046 switch (ge) {
15047 case "dotted":
15048 t.setLineDash([1, 1]);
15049 break;
15050 case "dashed":
15051 t.setLineDash([4, 2]);
15052 break;
15053 case "double":
15054 t.lineWidth = k / 4, t.setLineDash([]);
15055 break;
15056 case "solid":
15057 t.setLineDash([]);
15058 break;
15059 }
15060 if (G ? _i(t, X, B, re, K, N, "stroke") : t.strokeRect(X, B, re, K), ge === "double") {
15061 var Ee = k / 2;
15062 G ? _i(t, X + Ee, B + Ee, re - Ee * 2, K - Ee * 2, N, "stroke") : t.strokeRect(X + Ee, B + Ee, re - Ee * 2, K - Ee * 2);
15063 }
15064 t.setLineDash && t.setLineDash([]), t.lineWidth = me, t.strokeStyle = ue;
15065 }
15066 }
15067 var Ce = 2 * e.pstyle("text-outline-width").pfValue;
15068 if (Ce > 0 && (t.lineWidth = Ce), e.pstyle("text-wrap").value === "wrap") {
15069 var we = er(s, "labelWrapCachedLines", r), De = er(s, "labelLineHeight", r), se = c / 2, xe = this.getLabelJustification(e);
15070 switch (xe === "auto" || (b === "left" ? xe === "left" ? u += -c : xe === "center" && (u += -se) : b === "center" ? xe === "left" ? u += -se : xe === "right" && (u += se) : b === "right" && (xe === "center" ? u += se : xe === "right" && (u += c))), E) {
15071 case "top":
15072 l -= (we.length - 1) * De;
15073 break;
15074 case "center":
15075 case "bottom":
15076 l -= (we.length - 1) * De;
15077 break;
15078 }
15079 for (var Le = 0; Le < we.length; Le++)
15080 Ce > 0 && t.strokeText(we[Le], u, l), t.fillText(we[Le], u, l), l += De;
15081 } else
15082 Ce > 0 && t.strokeText(v, u, l), t.fillText(v, u, l);
15083 M !== 0 && (t.rotate(-M), t.translate(-f, -h));
15084 }
15085 }
15086 };
15087 var Ea = {};
15088 Ea.drawNode = function(t, e, r) {
15089 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, u, l = e._private, f = l.rscratch, h = e.position();
15090 if (!(!R(h.x) || !R(h.y)) && !(i && !e.visible())) {
15091 var v = i ? e.effectiveOpacity() : 1, d = s.usePaths(), c, y = !1, p = e.padding();
15092 o = e.width() + 2 * p, u = e.height() + 2 * p;
15093 var g;
15094 r && (g = r, t.translate(-g.x1, -g.y1));
15095 for (var m = e.pstyle("background-image"), b = m.value, E = new Array(b.length), M = new Array(b.length), L = 0, w = 0; w < b.length; w++) {
15096 var k = b[w], D = E[w] = k != null && k !== "none";
15097 if (D) {
15098 var F = e.cy().style().getIndexedStyle(e, "background-image-crossorigin", "value", w);
15099 L++, M[w] = s.getCachedImage(k, F, function() {
15100 l.backgroundTimestamp = Date.now(), e.emitAndNotify("background");
15101 });
15102 }
15103 }
15104 var G = e.pstyle("background-blacken").value, N = e.pstyle("border-width").pfValue, X = e.pstyle("background-opacity").value * v, B = e.pstyle("border-color").value, re = e.pstyle("border-style").value, K = e.pstyle("border-opacity").value * v, W = e.pstyle("outline-width").pfValue, ae = e.pstyle("outline-color").value, ue = e.pstyle("outline-style").value, me = e.pstyle("outline-opacity").value * v, ie = e.pstyle("outline-offset").value;
15105 t.lineJoin = "miter";
15106 var ge = function() {
15107 var he = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : X;
15108 s.eleFillStyle(t, e, he);
15109 }, Ee = function() {
15110 var he = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : K;
15111 s.colorStrokeStyle(t, B[0], B[1], B[2], he);
15112 }, Ce = function() {
15113 var he = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : me;
15114 s.colorStrokeStyle(t, ae[0], ae[1], ae[2], he);
15115 }, we = function(he, O, oe, Te) {
15116 var ce = s.nodePathCache = s.nodePathCache || [], ye = hs(oe === "polygon" ? oe + "," + Te.join(",") : oe, "" + O, "" + he), _e = ce[ye], be, Ge = !1;
15117 return _e != null ? (be = _e, Ge = !0, f.pathCache = be) : (be = new Path2D(), ce[ye] = f.pathCache = be), {
15118 path: be,
15119 cacheHit: Ge
15120 };
15121 }, De = e.pstyle("shape").strValue, se = e.pstyle("shape-polygon-points").pfValue;
15122 if (d) {
15123 t.translate(h.x, h.y);
15124 var xe = we(o, u, De, se);
15125 c = xe.path, y = xe.cacheHit;
15126 }
15127 var Le = function() {
15128 if (!y) {
15129 var he = h;
15130 d && (he = {
15131 x: 0,
15132 y: 0
15133 }), s.nodeShapes[s.getNodeShape(e)].draw(c || t, he.x, he.y, o, u);
15134 }
15135 d ? t.fill(c) : t.fill();
15136 }, Se = function() {
15137 for (var he = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : v, O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, oe = l.backgrounding, Te = 0, ce = 0; ce < M.length; ce++) {
15138 var ye = e.cy().style().getIndexedStyle(e, "background-image-containment", "value", ce);
15139 if (O && ye === "over" || !O && ye === "inside") {
15140 Te++;
15141 continue;
15142 }
15143 E[ce] && M[ce].complete && !M[ce].error && (Te++, s.drawInscribedImage(t, M[ce], e, ce, he));
15144 }
15145 l.backgrounding = Te !== L, oe !== l.backgrounding && e.updateStyle(!1);
15146 }, Oe = function() {
15147 var he = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, O = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : v;
15148 s.hasPie(e) && (s.drawPie(t, e, O), he && (d || s.nodeShapes[s.getNodeShape(e)].draw(t, h.x, h.y, o, u)));
15149 }, Fe = function() {
15150 var he = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : v, O = (G > 0 ? G : -G) * he, oe = G > 0 ? 0 : 255;
15151 G !== 0 && (s.colorFillStyle(t, oe, oe, oe, O), d ? t.fill(c) : t.fill());
15152 }, Xe = function() {
15153 if (N > 0) {
15154 if (t.lineWidth = N, t.lineCap = "butt", t.setLineDash)
15155 switch (re) {
15156 case "dotted":
15157 t.setLineDash([1, 1]);
15158 break;
15159 case "dashed":
15160 t.setLineDash([4, 2]);
15161 break;
15162 case "solid":
15163 case "double":
15164 t.setLineDash([]);
15165 break;
15166 }
15167 if (d ? t.stroke(c) : t.stroke(), re === "double") {
15168 t.lineWidth = N / 3;
15169 var he = t.globalCompositeOperation;
15170 t.globalCompositeOperation = "destination-out", d ? t.stroke(c) : t.stroke(), t.globalCompositeOperation = he;
15171 }
15172 t.setLineDash && t.setLineDash([]);
15173 }
15174 }, Ie = function() {
15175 if (W > 0) {
15176 if (t.lineWidth = W, t.lineCap = "butt", t.setLineDash)
15177 switch (ue) {
15178 case "dotted":
15179 t.setLineDash([1, 1]);
15180 break;
15181 case "dashed":
15182 t.setLineDash([4, 2]);
15183 break;
15184 case "solid":
15185 case "double":
15186 t.setLineDash([]);
15187 break;
15188 }
15189 var he = h;
15190 d && (he = {
15191 x: 0,
15192 y: 0
15193 });
15194 var O = s.getNodeShape(e), oe = (o + N + (W + ie)) / o, Te = (u + N + (W + ie)) / u, ce = o * oe, ye = u * Te, _e = s.nodeShapes[O].points, be;
15195 if (d) {
15196 var Ge = we(ce, ye, O, _e);
15197 be = Ge.path;
15198 }
15199 if (O === "ellipse")
15200 s.drawEllipsePath(be || t, he.x, he.y, ce, ye);
15201 else if (["round-diamond", "round-heptagon", "round-hexagon", "round-octagon", "round-pentagon", "round-polygon", "round-triangle", "round-tag"].includes(O)) {
15202 var Qe = 0, ft = 0, qe = 0;
15203 O === "round-diamond" ? Qe = (N + ie + W) * 1.4 : O === "round-heptagon" ? (Qe = (N + ie + W) * 1.075, qe = -(N / 2 + ie + W) / 35) : O === "round-hexagon" ? Qe = (N + ie + W) * 1.12 : O === "round-pentagon" ? (Qe = (N + ie + W) * 1.13, qe = -(N / 2 + ie + W) / 15) : O === "round-tag" ? (Qe = (N + ie + W) * 1.12, ft = (N / 2 + W + ie) * 0.07) : O === "round-triangle" && (Qe = (N + ie + W) * (Math.PI / 2), qe = -(N + ie / 2 + W) / Math.PI), Qe !== 0 && (oe = (o + Qe) / o, Te = (u + Qe) / u), s.drawRoundPolygonPath(be || t, he.x + ft, he.y + qe, o * oe, u * Te, _e);
15204 } else if (["roundrectangle", "round-rectangle"].includes(O))
15205 s.drawRoundRectanglePath(be || t, he.x, he.y, ce, ye);
15206 else if (["cutrectangle", "cut-rectangle"].includes(O))
15207 s.drawCutRectanglePath(be || t, he.x, he.y, ce, ye);
15208 else if (["bottomroundrectangle", "bottom-round-rectangle"].includes(O))
15209 s.drawBottomRoundRectanglePath(be || t, he.x, he.y, ce, ye);
15210 else if (O === "barrel")
15211 s.drawBarrelPath(be || t, he.x, he.y, ce, ye);
15212 else if (O.startsWith("polygon") || ["rhomboid", "right-rhomboid", "round-tag", "tag", "vee"].includes(O)) {
15213 var ot = (N + W + ie) / o;
15214 _e = pn(yn(_e, ot)), s.drawPolygonPath(be || t, he.x, he.y, o, u, _e);
15215 } else {
15216 var Ke = (N + W + ie) / o;
15217 _e = pn(yn(_e, -Ke)), s.drawPolygonPath(be || t, he.x, he.y, o, u, _e);
15218 }
15219 if (d ? t.stroke(be) : t.stroke(), ue === "double") {
15220 t.lineWidth = N / 3;
15221 var Je = t.globalCompositeOperation;
15222 t.globalCompositeOperation = "destination-out", d ? t.stroke(be) : t.stroke(), t.globalCompositeOperation = Je;
15223 }
15224 t.setLineDash && t.setLineDash([]);
15225 }
15226 }, Me = function() {
15227 n && s.drawNodeOverlay(t, e, h, o, u);
15228 }, Ue = function() {
15229 n && s.drawNodeUnderlay(t, e, h, o, u);
15230 }, ze = function() {
15231 s.drawElementText(t, e, null, a);
15232 }, Be = e.pstyle("ghost").value === "yes";
15233 if (Be) {
15234 var $e = e.pstyle("ghost-offset-x").pfValue, rt = e.pstyle("ghost-offset-y").pfValue, je = e.pstyle("ghost-opacity").value, We = je * v;
15235 t.translate($e, rt), Ce(), Ie(), ge(je * X), Le(), Se(We, !0), Ee(je * K), Xe(), Oe(G !== 0 || N !== 0), Se(We, !1), Fe(We), t.translate(-$e, -rt);
15236 }
15237 d && t.translate(-h.x, -h.y), Ue(), d && t.translate(h.x, h.y), Ce(), Ie(), ge(), Le(), Se(v, !0), Ee(), Xe(), Oe(G !== 0 || N !== 0), Se(v, !1), Fe(), d && t.translate(-h.x, -h.y), ze(), Me(), r && t.translate(g.x1, g.y1);
15238 }
15239 };
15240 var Tl = function(e) {
15241 if (!["overlay", "underlay"].includes(e))
15242 throw new Error("Invalid state");
15243 return function(r, a, n, i, s) {
15244 var o = this;
15245 if (a.visible()) {
15246 var u = a.pstyle("".concat(e, "-padding")).pfValue, l = a.pstyle("".concat(e, "-opacity")).value, f = a.pstyle("".concat(e, "-color")).value, h = a.pstyle("".concat(e, "-shape")).value;
15247 if (l > 0) {
15248 if (n = n || a.position(), i == null || s == null) {
15249 var v = a.padding();
15250 i = a.width() + 2 * v, s = a.height() + 2 * v;
15251 }
15252 o.colorFillStyle(r, f[0], f[1], f[2], l), o.nodeShapes[h].draw(r, n.x, n.y, i + u * 2, s + u * 2), r.fill();
15253 }
15254 }
15255 };
15256 };
15257 Ea.drawNodeOverlay = Tl("overlay"), Ea.drawNodeUnderlay = Tl("underlay"), Ea.hasPie = function(t) {
15258 return t = t[0], t._private.hasPie;
15259 }, Ea.drawPie = function(t, e, r, a) {
15260 e = e[0], a = a || e.position();
15261 var n = e.cy().style(), i = e.pstyle("pie-size"), s = a.x, o = a.y, u = e.width(), l = e.height(), f = Math.min(u, l) / 2, h = 0, v = this.usePaths();
15262 v && (s = 0, o = 0), i.units === "%" ? f = f * i.pfValue : i.pfValue !== void 0 && (f = i.pfValue / 2);
15263 for (var d = 1; d <= n.pieBackgroundN; d++) {
15264 var c = e.pstyle("pie-" + d + "-background-size").value, y = e.pstyle("pie-" + d + "-background-color").value, p = e.pstyle("pie-" + d + "-background-opacity").value * r, g = c / 100;
15265 g + h > 1 && (g = 1 - h);
15266 var m = 1.5 * Math.PI + 2 * Math.PI * h, b = 2 * Math.PI * g, E = m + b;
15267 c === 0 || h >= 1 || h + g > 1 || (t.beginPath(), t.moveTo(s, o), t.arc(s, o, f, m, E), t.closePath(), this.colorFillStyle(t, y[0], y[1], y[2], p), t.fill(), h += g);
15268 }
15269 };
15270 var Kt = {}, Jg = 100;
15271 Kt.getPixelRatio = function() {
15272 var t = this.data.contexts[0];
15273 if (this.forcedPixelRatio != null)
15274 return this.forcedPixelRatio;
15275 var e = t.backingStorePixelRatio || t.webkitBackingStorePixelRatio || t.mozBackingStorePixelRatio || t.msBackingStorePixelRatio || t.oBackingStorePixelRatio || t.backingStorePixelRatio || 1;
15276 return (window.devicePixelRatio || 1) / e;
15277 }, Kt.paintCache = function(t) {
15278 for (var e = this.paintCaches = this.paintCaches || [], r = !0, a, n = 0; n < e.length; n++)
15279 if (a = e[n], a.context === t) {
15280 r = !1;
15281 break;
15282 }
15283 return r && (a = {
15284 context: t
15285 }, e.push(a)), a;
15286 }, Kt.createGradientStyleFor = function(t, e, r, a, n) {
15287 var i, s = this.usePaths(), o = r.pstyle(e + "-gradient-stop-colors").value, u = r.pstyle(e + "-gradient-stop-positions").pfValue;
15288 if (a === "radial-gradient")
15289 if (r.isEdge()) {
15290 var l = r.sourceEndpoint(), f = r.targetEndpoint(), h = r.midpoint(), v = Br(l, h), d = Br(f, h);
15291 i = t.createRadialGradient(h.x, h.y, 0, h.x, h.y, Math.max(v, d));
15292 } else {
15293 var c = s ? {
15294 x: 0,
15295 y: 0
15296 } : r.position(), y = r.paddedWidth(), p = r.paddedHeight();
15297 i = t.createRadialGradient(c.x, c.y, 0, c.x, c.y, Math.max(y, p));
15298 }
15299 else if (r.isEdge()) {
15300 var g = r.sourceEndpoint(), m = r.targetEndpoint();
15301 i = t.createLinearGradient(g.x, g.y, m.x, m.y);
15302 } else {
15303 var b = s ? {
15304 x: 0,
15305 y: 0
15306 } : r.position(), E = r.paddedWidth(), M = r.paddedHeight(), L = E / 2, w = M / 2, k = r.pstyle("background-gradient-direction").value;
15307 switch (k) {
15308 case "to-bottom":
15309 i = t.createLinearGradient(b.x, b.y - w, b.x, b.y + w);
15310 break;
15311 case "to-top":
15312 i = t.createLinearGradient(b.x, b.y + w, b.x, b.y - w);
15313 break;
15314 case "to-left":
15315 i = t.createLinearGradient(b.x + L, b.y, b.x - L, b.y);
15316 break;
15317 case "to-right":
15318 i = t.createLinearGradient(b.x - L, b.y, b.x + L, b.y);
15319 break;
15320 case "to-bottom-right":
15321 case "to-right-bottom":
15322 i = t.createLinearGradient(b.x - L, b.y - w, b.x + L, b.y + w);
15323 break;
15324 case "to-top-right":
15325 case "to-right-top":
15326 i = t.createLinearGradient(b.x - L, b.y + w, b.x + L, b.y - w);
15327 break;
15328 case "to-bottom-left":
15329 case "to-left-bottom":
15330 i = t.createLinearGradient(b.x + L, b.y - w, b.x - L, b.y + w);
15331 break;
15332 case "to-top-left":
15333 case "to-left-top":
15334 i = t.createLinearGradient(b.x + L, b.y + w, b.x - L, b.y - w);
15335 break;
15336 }
15337 }
15338 if (!i)
15339 return null;
15340 for (var D = u.length === o.length, F = o.length, G = 0; G < F; G++)
15341 i.addColorStop(D ? u[G] : G / (F - 1), "rgba(" + o[G][0] + "," + o[G][1] + "," + o[G][2] + "," + n + ")");
15342 return i;
15343 }, Kt.gradientFillStyle = function(t, e, r, a) {
15344 var n = this.createGradientStyleFor(t, "background", e, r, a);
15345 if (!n)
15346 return null;
15347 t.fillStyle = n;
15348 }, Kt.colorFillStyle = function(t, e, r, a, n) {
15349 t.fillStyle = "rgba(" + e + "," + r + "," + a + "," + n + ")";
15350 }, Kt.eleFillStyle = function(t, e, r) {
15351 var a = e.pstyle("background-fill").value;
15352 if (a === "linear-gradient" || a === "radial-gradient")
15353 this.gradientFillStyle(t, e, a, r);
15354 else {
15355 var n = e.pstyle("background-color").value;
15356 this.colorFillStyle(t, n[0], n[1], n[2], r);
15357 }
15358 }, Kt.gradientStrokeStyle = function(t, e, r, a) {
15359 var n = this.createGradientStyleFor(t, "line", e, r, a);
15360 if (!n)
15361 return null;
15362 t.strokeStyle = n;
15363 }, Kt.colorStrokeStyle = function(t, e, r, a, n) {
15364 t.strokeStyle = "rgba(" + e + "," + r + "," + a + "," + n + ")";
15365 }, Kt.eleStrokeStyle = function(t, e, r) {
15366 var a = e.pstyle("line-fill").value;
15367 if (a === "linear-gradient" || a === "radial-gradient")
15368 this.gradientStrokeStyle(t, e, a, r);
15369 else {
15370 var n = e.pstyle("line-color").value;
15371 this.colorStrokeStyle(t, n[0], n[1], n[2], r);
15372 }
15373 }, Kt.matchCanvasSize = function(t) {
15374 var e = this, r = e.data, a = e.findContainerClientCoords(), n = a[2], i = a[3], s = e.getPixelRatio(), o = e.motionBlurPxRatio;
15375 (t === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE] || t === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG]) && (s = o);
15376 var u = n * s, l = i * s, f;
15377 if (!(u === e.canvasWidth && l === e.canvasHeight)) {
15378 e.fontCaches = null;
15379 var h = r.canvasContainer;
15380 h.style.width = n + "px", h.style.height = i + "px";
15381 for (var v = 0; v < e.CANVAS_LAYERS; v++)
15382 f = r.canvases[v], f.width = u, f.height = l, f.style.width = n + "px", f.style.height = i + "px";
15383 for (var v = 0; v < e.BUFFER_COUNT; v++)
15384 f = r.bufferCanvases[v], f.width = u, f.height = l, f.style.width = n + "px", f.style.height = i + "px";
15385 e.textureMult = 1, s <= 1 && (f = r.bufferCanvases[e.TEXTURE_BUFFER], e.textureMult = 2, f.width = u * e.textureMult, f.height = l * e.textureMult), e.canvasWidth = u, e.canvasHeight = l;
15386 }
15387 }, Kt.renderTo = function(t, e, r, a) {
15388 this.render({
15389 forcedContext: t,
15390 forcedZoom: e,
15391 forcedPan: r,
15392 drawAllLayers: !0,
15393 forcedPxRatio: a
15394 });
15395 }, Kt.render = function(t) {
15396 t = t || ys();
15397 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, u = s.cy, l = s.data, f = l.canvasNeedsRedraw, h = s.textureOnViewport && !e && (s.pinching || s.hoverData.dragging || s.swipePanning || s.data.wheelZooming), v = t.motionBlur !== void 0 ? t.motionBlur : s.motionBlur, d = s.motionBlurPxRatio, c = u.hasCompoundNodes(), y = s.hoverData.draggingEles, p = !!(s.hoverData.selecting || s.touchData.selecting);
15398 v = v && !e && s.motionBlurEnabled && !p;
15399 var g = v;
15400 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), v && (s.mbFrames == null && (s.mbFrames = 0), s.mbFrames++, s.mbFrames < 3 && (g = !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);
15401 var m = u.style(), b = u.zoom(), E = n !== void 0 ? n : b, M = u.pan(), L = {
15402 x: M.x,
15403 y: M.y
15404 }, w = {
15405 zoom: b,
15406 pan: {
15407 x: M.x,
15408 y: M.y
15409 }
15410 }, k = s.prevViewport, D = k === void 0 || w.zoom !== k.zoom || w.pan.x !== k.pan.x || w.pan.y !== k.pan.y;
15411 !D && !(y && !c) && (s.motionBlurPxRatio = 1), i && (L = i), E *= o, L.x *= o, L.y *= o;
15412 var F = s.getCachedZSortedEles();
15413 function G(Ie, Me, Ue, ze, Be) {
15414 var $e = Ie.globalCompositeOperation;
15415 Ie.globalCompositeOperation = "destination-out", s.colorFillStyle(Ie, 255, 255, 255, s.motionBlurTransparency), Ie.fillRect(Me, Ue, ze, Be), Ie.globalCompositeOperation = $e;
15416 }
15417 function N(Ie, Me) {
15418 var Ue, ze, Be, $e;
15419 !s.clearingMotionBlur && (Ie === l.bufferContexts[s.MOTIONBLUR_BUFFER_NODE] || Ie === l.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]) ? (Ue = {
15420 x: M.x * d,
15421 y: M.y * d
15422 }, ze = b * d, Be = s.canvasWidth * d, $e = s.canvasHeight * d) : (Ue = L, ze = E, Be = s.canvasWidth, $e = s.canvasHeight), Ie.setTransform(1, 0, 0, 1, 0, 0), Me === "motionBlur" ? G(Ie, 0, 0, Be, $e) : !e && (Me === void 0 || Me) && Ie.clearRect(0, 0, Be, $e), r || (Ie.translate(Ue.x, Ue.y), Ie.scale(ze, ze)), i && Ie.translate(i.x, i.y), n && Ie.scale(n, n);
15423 }
15424 if (h || (s.textureDrawLastFrame = !1), h) {
15425 if (s.textureDrawLastFrame = !0, !s.textureCache) {
15426 s.textureCache = {}, s.textureCache.bb = u.mutableElements().boundingBox(), s.textureCache.texture = s.data.bufferCanvases[s.TEXTURE_BUFFER];
15427 var X = s.data.bufferContexts[s.TEXTURE_BUFFER];
15428 X.setTransform(1, 0, 0, 1, 0, 0), X.clearRect(0, 0, s.canvasWidth * s.textureMult, s.canvasHeight * s.textureMult), s.render({
15429 forcedContext: X,
15430 drawOnlyNodeLayer: !0,
15431 forcedPxRatio: o * s.textureMult
15432 });
15433 var w = s.textureCache.viewport = {
15434 zoom: u.zoom(),
15435 pan: u.pan(),
15436 width: s.canvasWidth,
15437 height: s.canvasHeight
15438 };
15439 w.mpan = {
15440 x: (0 - w.pan.x) / w.zoom,
15441 y: (0 - w.pan.y) / w.zoom
15442 };
15443 }
15444 f[s.DRAG] = !1, f[s.NODE] = !1;
15445 var B = l.contexts[s.NODE], re = s.textureCache.texture, w = s.textureCache.viewport;
15446 B.setTransform(1, 0, 0, 1, 0, 0), v ? G(B, 0, 0, w.width, w.height) : B.clearRect(0, 0, w.width, w.height);
15447 var K = m.core("outside-texture-bg-color").value, W = m.core("outside-texture-bg-opacity").value;
15448 s.colorFillStyle(B, K[0], K[1], K[2], W), B.fillRect(0, 0, w.width, w.height);
15449 var b = u.zoom();
15450 N(B, !1), B.clearRect(w.mpan.x, w.mpan.y, w.width / w.zoom / o, w.height / w.zoom / o), B.drawImage(re, w.mpan.x, w.mpan.y, w.width / w.zoom / o, w.height / w.zoom / o);
15451 } else
15452 s.textureOnViewport && !e && (s.textureCache = null);
15453 var ae = u.extent(), ue = s.pinching || s.hoverData.dragging || s.swipePanning || s.data.wheelZooming || s.hoverData.draggingEles || s.cy.animated(), me = s.hideEdgesOnViewport && ue, ie = [];
15454 if (ie[s.NODE] = !f[s.NODE] && v && !s.clearedForMotionBlur[s.NODE] || s.clearingMotionBlur, ie[s.NODE] && (s.clearedForMotionBlur[s.NODE] = !0), ie[s.DRAG] = !f[s.DRAG] && v && !s.clearedForMotionBlur[s.DRAG] || s.clearingMotionBlur, ie[s.DRAG] && (s.clearedForMotionBlur[s.DRAG] = !0), f[s.NODE] || r || a || ie[s.NODE]) {
15455 var ge = v && !ie[s.NODE] && d !== 1, B = e || (ge ? s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE] : l.contexts[s.NODE]), Ee = v && !ge ? "motionBlur" : void 0;
15456 N(B, Ee), me ? s.drawCachedNodes(B, F.nondrag, o, ae) : s.drawLayeredElements(B, F.nondrag, o, ae), s.debug && s.drawDebugPoints(B, F.nondrag), !r && !v && (f[s.NODE] = !1);
15457 }
15458 if (!a && (f[s.DRAG] || r || ie[s.DRAG])) {
15459 var ge = v && !ie[s.DRAG] && d !== 1, B = e || (ge ? s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG] : l.contexts[s.DRAG]);
15460 N(B, v && !ge ? "motionBlur" : void 0), me ? s.drawCachedNodes(B, F.drag, o, ae) : s.drawCachedElements(B, F.drag, o, ae), s.debug && s.drawDebugPoints(B, F.drag), !r && !v && (f[s.DRAG] = !1);
15461 }
15462 if (s.showFps || !a && f[s.SELECT_BOX] && !r) {
15463 var B = e || l.contexts[s.SELECT_BOX];
15464 if (N(B), s.selection[4] == 1 && (s.hoverData.selecting || s.touchData.selecting)) {
15465 var b = s.cy.zoom(), Ce = m.core("selection-box-border-width").value / b;
15466 B.lineWidth = Ce, B.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 + ")", B.fillRect(s.selection[0], s.selection[1], s.selection[2] - s.selection[0], s.selection[3] - s.selection[1]), Ce > 0 && (B.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 + ")", B.strokeRect(s.selection[0], s.selection[1], s.selection[2] - s.selection[0], s.selection[3] - s.selection[1]));
15467 }
15468 if (l.bgActivePosistion && !s.hoverData.selecting) {
15469 var b = s.cy.zoom(), we = l.bgActivePosistion;
15470 B.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 + ")", B.beginPath(), B.arc(we.x, we.y, m.core("active-bg-size").pfValue / b, 0, 2 * Math.PI), B.fill();
15471 }
15472 var De = s.lastRedrawTime;
15473 if (s.showFps && De) {
15474 De = Math.round(De);
15475 var se = Math.round(1e3 / De);
15476 B.setTransform(1, 0, 0, 1, 0, 0), B.fillStyle = "rgba(255, 0, 0, 0.75)", B.strokeStyle = "rgba(255, 0, 0, 0.75)", B.lineWidth = 1, B.fillText("1 frame = " + De + " ms = " + se + " fps", 0, 20);
15477 var xe = 60;
15478 B.strokeRect(0, 30, 250, 20), B.fillRect(0, 30, 250 * Math.min(se / xe, 1), 20);
15479 }
15480 r || (f[s.SELECT_BOX] = !1);
15481 }
15482 if (v && d !== 1) {
15483 var Le = l.contexts[s.NODE], Se = s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE], Oe = l.contexts[s.DRAG], Fe = s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG], Xe = function(Me, Ue, ze) {
15484 Me.setTransform(1, 0, 0, 1, 0, 0), ze || !g ? Me.clearRect(0, 0, s.canvasWidth, s.canvasHeight) : G(Me, 0, 0, s.canvasWidth, s.canvasHeight);
15485 var Be = d;
15486 Me.drawImage(
15487 Ue,
15488 // img
15489 0,
15490 0,
15491 // sx, sy
15492 s.canvasWidth * Be,
15493 s.canvasHeight * Be,
15494 // sw, sh
15495 0,
15496 0,
15497 // x, y
15498 s.canvasWidth,
15499 s.canvasHeight
15500 // w, h
15501 );
15502 };
15503 (f[s.NODE] || ie[s.NODE]) && (Xe(Le, Se, ie[s.NODE]), f[s.NODE] = !1), (f[s.DRAG] || ie[s.DRAG]) && (Xe(Oe, Fe, ie[s.DRAG]), f[s.DRAG] = !1);
15504 }
15505 s.prevViewport = w, s.clearingMotionBlur && (s.clearingMotionBlur = !1, s.motionBlurCleared = !0, s.motionBlur = !0), v && (s.motionBlurTimeout = setTimeout(function() {
15506 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();
15507 }, Jg)), e || u.emit("render");
15508 };
15509 var Mr = {};
15510 Mr.drawPolygonPath = function(t, e, r, a, n, i) {
15511 var s = a / 2, o = n / 2;
15512 t.beginPath && t.beginPath(), t.moveTo(e + s * i[0], r + o * i[1]);
15513 for (var u = 1; u < i.length / 2; u++)
15514 t.lineTo(e + s * i[u * 2], r + o * i[u * 2 + 1]);
15515 t.closePath();
15516 }, Mr.drawRoundPolygonPath = function(t, e, r, a, n, i) {
15517 var s = a / 2, o = n / 2, u = ci(a, n);
15518 t.beginPath && t.beginPath();
15519 for (var l = 0; l < i.length / 4; l++) {
15520 var f = void 0, h = void 0;
15521 l === 0 ? f = i.length - 2 : f = l * 4 - 2, h = l * 4 + 2;
15522 var v = e + s * i[l * 4], d = r + o * i[l * 4 + 1], c = -i[f] * i[h] - i[f + 1] * i[h + 1], y = u / Math.tan(Math.acos(c) / 2), p = v - y * i[f], g = d - y * i[f + 1], m = v + y * i[h], b = d + y * i[h + 1];
15523 l === 0 ? t.moveTo(p, g) : t.lineTo(p, g), t.arcTo(v, d, m, b, u);
15524 }
15525 t.closePath();
15526 }, Mr.drawRoundRectanglePath = function(t, e, r, a, n) {
15527 var i = a / 2, s = n / 2, o = Fa(a, n);
15528 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();
15529 }, Mr.drawBottomRoundRectanglePath = function(t, e, r, a, n) {
15530 var i = a / 2, s = n / 2, o = Fa(a, n);
15531 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();
15532 }, Mr.drawCutRectanglePath = function(t, e, r, a, n) {
15533 var i = a / 2, s = n / 2, o = Ss();
15534 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();
15535 }, Mr.drawBarrelPath = function(t, e, r, a, n) {
15536 var i = a / 2, s = n / 2, o = e - i, u = e + i, l = r - s, f = r + s, h = di(a, n), v = h.widthOffset, d = h.heightOffset, c = h.ctrlPtOffsetPct * v;
15537 t.beginPath && t.beginPath(), t.moveTo(o, l + d), t.lineTo(o, f - d), t.quadraticCurveTo(o + c, f, o + v, f), t.lineTo(u - v, f), t.quadraticCurveTo(u - c, f, u, f - d), t.lineTo(u, l + d), t.quadraticCurveTo(u - c, l, u - v, l), t.lineTo(o + v, l), t.quadraticCurveTo(o + c, l, o, l + d), t.closePath();
15538 };
15539 for (var Cl = Math.sin(0), Dl = Math.cos(0), Yi = {}, Hi = {}, Sl = Math.PI / 40, wa = 0 * Math.PI; wa < 2 * Math.PI; wa += Sl)
15540 Yi[wa] = Math.sin(wa), Hi[wa] = Math.cos(wa);
15541 Mr.drawEllipsePath = function(t, e, r, a, n) {
15542 if (t.beginPath && t.beginPath(), t.ellipse)
15543 t.ellipse(e, r, a / 2, n / 2, 0, 0, 2 * Math.PI);
15544 else
15545 for (var i, s, o = a / 2, u = n / 2, l = 0 * Math.PI; l < 2 * Math.PI; l += Sl)
15546 i = e - o * Yi[l] * Cl + o * Hi[l] * Dl, s = r + u * Hi[l] * Cl + u * Yi[l] * Dl, l === 0 ? t.moveTo(i, s) : t.lineTo(i, s);
15547 t.closePath();
15548 };
15549 var tn = {};
15550 tn.createBuffer = function(t, e) {
15551 var r = document.createElement("canvas");
15552 return r.width = t, r.height = e, [r, r.getContext("2d")];
15553 }, tn.bufferCanvasImage = function(t) {
15554 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 = R(t.maxWidth) || R(t.maxHeight), u = this.getPixelRatio(), l = 1;
15555 if (t.scale !== void 0)
15556 i *= t.scale, s *= t.scale, l = t.scale;
15557 else if (o) {
15558 var f = 1 / 0, h = 1 / 0;
15559 R(t.maxWidth) && (f = l * t.maxWidth / i), R(t.maxHeight) && (h = l * t.maxHeight / s), l = Math.min(f, h), i *= l, s *= l;
15560 }
15561 o || (i *= u, s *= u, l *= u);
15562 var v = document.createElement("canvas");
15563 v.width = i, v.height = s, v.style.width = i + "px", v.style.height = s + "px";
15564 var d = v.getContext("2d");
15565 if (i > 0 && s > 0) {
15566 d.clearRect(0, 0, i, s), d.globalCompositeOperation = "source-over";
15567 var c = this.getCachedZSortedEles();
15568 if (t.full)
15569 d.translate(-a.x1 * l, -a.y1 * l), d.scale(l, l), this.drawElements(d, c), d.scale(1 / l, 1 / l), d.translate(a.x1 * l, a.y1 * l);
15570 else {
15571 var y = e.pan(), p = {
15572 x: y.x * l,
15573 y: y.y * l
15574 };
15575 l *= e.zoom(), d.translate(p.x, p.y), d.scale(l, l), this.drawElements(d, c), d.scale(1 / l, 1 / l), d.translate(-p.x, -p.y);
15576 }
15577 t.bg && (d.globalCompositeOperation = "destination-over", d.fillStyle = t.bg, d.rect(0, 0, i, s), d.fill());
15578 }
15579 return v;
15580 };
15581 function jg(t, e) {
15582 for (var r = atob(t), a = new ArrayBuffer(r.length), n = new Uint8Array(a), i = 0; i < r.length; i++)
15583 n[i] = r.charCodeAt(i);
15584 return new Blob([a], {
15585 type: e
15586 });
15587 }
15588 function Ll(t) {
15589 var e = t.indexOf(",");
15590 return t.substr(e + 1);
15591 }
15592 function Al(t, e, r) {
15593 var a = function() {
15594 return e.toDataURL(r, t.quality);
15595 };
15596 switch (t.output) {
15597 case "blob-promise":
15598 return new ia(function(n, i) {
15599 try {
15600 e.toBlob(function(s) {
15601 s != null ? n(s) : i(new Error("`canvas.toBlob()` sent a null value in its callback"));
15602 }, r, t.quality);
15603 } catch (s) {
15604 i(s);
15605 }
15606 });
15607 case "blob":
15608 return jg(Ll(a()), r);
15609 case "base64":
15610 return Ll(a());
15611 case "base64uri":
15612 default:
15613 return a();
15614 }
15615 }
15616 tn.png = function(t) {
15617 return Al(t, this.bufferCanvasImage(t), "image/png");
15618 }, tn.jpg = function(t) {
15619 return Al(t, this.bufferCanvasImage(t), "image/jpeg");
15620 };
15621 var Ol = {};
15622 Ol.nodeShapeImpl = function(t, e, r, a, n, i, s) {
15623 switch (t) {
15624 case "ellipse":
15625 return this.drawEllipsePath(e, r, a, n, i);
15626 case "polygon":
15627 return this.drawPolygonPath(e, r, a, n, i, s);
15628 case "round-polygon":
15629 return this.drawRoundPolygonPath(e, r, a, n, i, s);
15630 case "roundrectangle":
15631 case "round-rectangle":
15632 return this.drawRoundRectanglePath(e, r, a, n, i);
15633 case "cutrectangle":
15634 case "cut-rectangle":
15635 return this.drawCutRectanglePath(e, r, a, n, i);
15636 case "bottomroundrectangle":
15637 case "bottom-round-rectangle":
15638 return this.drawBottomRoundRectanglePath(e, r, a, n, i);
15639 case "barrel":
15640 return this.drawBarrelPath(e, r, a, n, i);
15641 }
15642 };
15643 var ep = Nl, ut = Nl.prototype;
15644 ut.CANVAS_LAYERS = 3, ut.SELECT_BOX = 0, ut.DRAG = 1, ut.NODE = 2, ut.BUFFER_COUNT = 3, ut.TEXTURE_BUFFER = 0, ut.MOTIONBLUR_BUFFER_NODE = 1, ut.MOTIONBLUR_BUFFER_DRAG = 2;
15645 function Nl(t) {
15646 var e = this;
15647 e.data = {
15648 canvases: new Array(ut.CANVAS_LAYERS),
15649 contexts: new Array(ut.CANVAS_LAYERS),
15650 canvasNeedsRedraw: new Array(ut.CANVAS_LAYERS),
15651 bufferCanvases: new Array(ut.BUFFER_COUNT),
15652 bufferContexts: new Array(ut.CANVAS_LAYERS)
15653 };
15654 var r = "-webkit-tap-highlight-color", a = "rgba(0,0,0,0)";
15655 e.data.canvasContainer = document.createElement("div");
15656 var n = e.data.canvasContainer.style;
15657 e.data.canvasContainer.style[r] = a, n.position = "relative", n.zIndex = "0", n.overflow = "hidden";
15658 var i = t.cy.container();
15659 i.appendChild(e.data.canvasContainer), i.style[r] = a;
15660 var s = {
15661 "-webkit-user-select": "none",
15662 "-moz-user-select": "-moz-none",
15663 "user-select": "none",
15664 "-webkit-tap-highlight-color": "rgba(0,0,0,0)",
15665 "outline-style": "none"
15666 };
15667 ht() && (s["-ms-touch-action"] = "none", s["touch-action"] = "none");
15668 for (var o = 0; o < ut.CANVAS_LAYERS; o++) {
15669 var u = e.data.canvases[o] = document.createElement("canvas");
15670 e.data.contexts[o] = u.getContext("2d"), Object.keys(s).forEach(function(De) {
15671 u.style[De] = s[De];
15672 }), u.style.position = "absolute", u.setAttribute("data-id", "layer" + o), u.style.zIndex = String(ut.CANVAS_LAYERS - o), e.data.canvasContainer.appendChild(u), e.data.canvasNeedsRedraw[o] = !1;
15673 }
15674 e.data.topCanvas = e.data.canvases[0], e.data.canvases[ut.NODE].setAttribute("data-id", "layer" + ut.NODE + "-node"), e.data.canvases[ut.SELECT_BOX].setAttribute("data-id", "layer" + ut.SELECT_BOX + "-selectbox"), e.data.canvases[ut.DRAG].setAttribute("data-id", "layer" + ut.DRAG + "-drag");
15675 for (var o = 0; o < ut.BUFFER_COUNT; o++)
15676 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";
15677 e.pathsEnabled = !0;
15678 var l = Yt(), f = function(se) {
15679 return {
15680 x: (se.x1 + se.x2) / 2,
15681 y: (se.y1 + se.y2) / 2
15682 };
15683 }, h = function(se) {
15684 return {
15685 x: -se.w / 2,
15686 y: -se.h / 2
15687 };
15688 }, v = function(se) {
15689 var xe = se[0]._private, Le = xe.oldBackgroundTimestamp === xe.backgroundTimestamp;
15690 return !Le;
15691 }, d = function(se) {
15692 return se[0]._private.nodeKey;
15693 }, c = function(se) {
15694 return se[0]._private.labelStyleKey;
15695 }, y = function(se) {
15696 return se[0]._private.sourceLabelStyleKey;
15697 }, p = function(se) {
15698 return se[0]._private.targetLabelStyleKey;
15699 }, g = function(se, xe, Le, Se, Oe) {
15700 return e.drawElement(se, xe, Le, !1, !1, Oe);
15701 }, m = function(se, xe, Le, Se, Oe) {
15702 return e.drawElementText(se, xe, Le, Se, "main", Oe);
15703 }, b = function(se, xe, Le, Se, Oe) {
15704 return e.drawElementText(se, xe, Le, Se, "source", Oe);
15705 }, E = function(se, xe, Le, Se, Oe) {
15706 return e.drawElementText(se, xe, Le, Se, "target", Oe);
15707 }, M = function(se) {
15708 return se.boundingBox(), se[0]._private.bodyBounds;
15709 }, L = function(se) {
15710 return se.boundingBox(), se[0]._private.labelBounds.main || l;
15711 }, w = function(se) {
15712 return se.boundingBox(), se[0]._private.labelBounds.source || l;
15713 }, k = function(se) {
15714 return se.boundingBox(), se[0]._private.labelBounds.target || l;
15715 }, D = function(se, xe) {
15716 return xe;
15717 }, F = function(se) {
15718 return f(M(se));
15719 }, G = function(se, xe, Le) {
15720 var Se = se ? se + "-" : "";
15721 return {
15722 x: xe.x + Le.pstyle(Se + "text-margin-x").pfValue,
15723 y: xe.y + Le.pstyle(Se + "text-margin-y").pfValue
15724 };
15725 }, N = function(se, xe, Le) {
15726 var Se = se[0]._private.rscratch;
15727 return {
15728 x: Se[xe],
15729 y: Se[Le]
15730 };
15731 }, X = function(se) {
15732 return G("", N(se, "labelX", "labelY"), se);
15733 }, B = function(se) {
15734 return G("source", N(se, "sourceLabelX", "sourceLabelY"), se);
15735 }, re = function(se) {
15736 return G("target", N(se, "targetLabelX", "targetLabelY"), se);
15737 }, K = function(se) {
15738 return h(M(se));
15739 }, W = function(se) {
15740 return h(w(se));
15741 }, ae = function(se) {
15742 return h(k(se));
15743 }, ue = function(se) {
15744 var xe = L(se), Le = h(L(se));
15745 if (se.isNode()) {
15746 switch (se.pstyle("text-halign").value) {
15747 case "left":
15748 Le.x = -xe.w;
15749 break;
15750 case "right":
15751 Le.x = 0;
15752 break;
15753 }
15754 switch (se.pstyle("text-valign").value) {
15755 case "top":
15756 Le.y = -xe.h;
15757 break;
15758 case "bottom":
15759 Le.y = 0;
15760 break;
15761 }
15762 }
15763 return Le;
15764 }, me = e.data.eleTxrCache = new ja(e, {
15765 getKey: d,
15766 doesEleInvalidateKey: v,
15767 drawElement: g,
15768 getBoundingBox: M,
15769 getRotationPoint: F,
15770 getRotationOffset: K,
15771 allowEdgeTxrCaching: !1,
15772 allowParentTxrCaching: !1
15773 }), ie = e.data.lblTxrCache = new ja(e, {
15774 getKey: c,
15775 drawElement: m,
15776 getBoundingBox: L,
15777 getRotationPoint: X,
15778 getRotationOffset: ue,
15779 isVisible: D
15780 }), ge = e.data.slbTxrCache = new ja(e, {
15781 getKey: y,
15782 drawElement: b,
15783 getBoundingBox: w,
15784 getRotationPoint: B,
15785 getRotationOffset: W,
15786 isVisible: D
15787 }), Ee = e.data.tlbTxrCache = new ja(e, {
15788 getKey: p,
15789 drawElement: E,
15790 getBoundingBox: k,
15791 getRotationPoint: re,
15792 getRotationOffset: ae,
15793 isVisible: D
15794 }), Ce = e.data.lyrTxrCache = new yl(e);
15795 e.onUpdateEleCalcs(function(se, xe) {
15796 me.invalidateElements(xe), ie.invalidateElements(xe), ge.invalidateElements(xe), Ee.invalidateElements(xe), Ce.invalidateElements(xe);
15797 for (var Le = 0; Le < xe.length; Le++) {
15798 var Se = xe[Le]._private;
15799 Se.oldBackgroundTimestamp = Se.backgroundTimestamp;
15800 }
15801 });
15802 var we = function(se) {
15803 for (var xe = 0; xe < se.length; xe++)
15804 Ce.enqueueElementRefinement(se[xe].ele);
15805 };
15806 me.onDequeue(we), ie.onDequeue(we), ge.onDequeue(we), Ee.onDequeue(we);
15807 }
15808 ut.redrawHint = function(t, e) {
15809 var r = this;
15810 switch (t) {
15811 case "eles":
15812 r.data.canvasNeedsRedraw[ut.NODE] = e;
15813 break;
15814 case "drag":
15815 r.data.canvasNeedsRedraw[ut.DRAG] = e;
15816 break;
15817 case "select":
15818 r.data.canvasNeedsRedraw[ut.SELECT_BOX] = e;
15819 break;
15820 }
15821 };
15822 var tp = typeof Path2D < "u";
15823 ut.path2dEnabled = function(t) {
15824 if (t === void 0)
15825 return this.pathsEnabled;
15826 this.pathsEnabled = !!t;
15827 }, ut.usePaths = function() {
15828 return tp && this.pathsEnabled;
15829 }, ut.setImgSmoothing = function(t, e) {
15830 t.imageSmoothingEnabled != null ? t.imageSmoothingEnabled = e : (t.webkitImageSmoothingEnabled = e, t.mozImageSmoothingEnabled = e, t.msImageSmoothingEnabled = e);
15831 }, ut.getImgSmoothing = function(t) {
15832 return t.imageSmoothingEnabled != null ? t.imageSmoothingEnabled : t.webkitImageSmoothingEnabled || t.mozImageSmoothingEnabled || t.msImageSmoothingEnabled;
15833 }, ut.makeOffscreenCanvas = function(t, e) {
15834 var r;
15835 return (typeof OffscreenCanvas > "u" ? "undefined" : _(OffscreenCanvas)) !== "undefined" ? r = new OffscreenCanvas(t, e) : (r = document.createElement("canvas"), r.width = t, r.height = e), r;
15836 }, [bl, vr, br, $i, _r, Ea, Kt, Mr, tn, Ol].forEach(function(t) {
15837 He(ut, t);
15838 });
15839 var rp = [{
15840 name: "null",
15841 impl: tl
15842 }, {
15843 name: "base",
15844 impl: cl
15845 }, {
15846 name: "canvas",
15847 impl: ep
15848 }], ap = [{
15849 type: "layout",
15850 extensions: hg
15851 }, {
15852 type: "renderer",
15853 extensions: rp
15854 }], Il = {}, Ml = {};
15855 function Rl(t, e, r) {
15856 var a = r, n = function(k) {
15857 vt("Can not register `" + e + "` for `" + t + "` since `" + k + "` already exists in the prototype and can not be overridden");
15858 };
15859 if (t === "core") {
15860 if (Za.prototype[e])
15861 return n(e);
15862 Za.prototype[e] = r;
15863 } else if (t === "collection") {
15864 if (Nt.prototype[e])
15865 return n(e);
15866 Nt.prototype[e] = r;
15867 } else if (t === "layout") {
15868 for (var i = function(k) {
15869 this.options = k, r.call(this, k), S(this._private) || (this._private = {}), this._private.cy = k.cy, this._private.listeners = [], this.createEmitter();
15870 }, s = i.prototype = Object.create(r.prototype), o = [], u = 0; u < o.length; u++) {
15871 var l = o[u];
15872 s[l] = s[l] || function() {
15873 return this;
15874 };
15875 }
15876 s.start && !s.run ? s.run = function() {
15877 return this.start(), this;
15878 } : !s.start && s.run && (s.start = function() {
15879 return this.run(), this;
15880 });
15881 var f = r.prototype.stop;
15882 s.stop = function() {
15883 var w = this.options;
15884 if (w && w.animate) {
15885 var k = this.animations;
15886 if (k)
15887 for (var D = 0; D < k.length; D++)
15888 k[D].stop();
15889 }
15890 return f ? f.call(this) : this.emit("layoutstop"), this;
15891 }, s.destroy || (s.destroy = function() {
15892 return this;
15893 }), s.cy = function() {
15894 return this._private.cy;
15895 };
15896 var h = function(k) {
15897 return k._private.cy;
15898 }, v = {
15899 addEventFields: function(k, D) {
15900 D.layout = k, D.cy = h(k), D.target = k;
15901 },
15902 bubble: function() {
15903 return !0;
15904 },
15905 parent: function(k) {
15906 return h(k);
15907 }
15908 };
15909 He(s, {
15910 createEmitter: function() {
15911 return this._private.emitter = new In(v, this), this;
15912 },
15913 emitter: function() {
15914 return this._private.emitter;
15915 },
15916 on: function(k, D) {
15917 return this.emitter().on(k, D), this;
15918 },
15919 one: function(k, D) {
15920 return this.emitter().one(k, D), this;
15921 },
15922 once: function(k, D) {
15923 return this.emitter().one(k, D), this;
15924 },
15925 removeListener: function(k, D) {
15926 return this.emitter().removeListener(k, D), this;
15927 },
15928 removeAllListeners: function() {
15929 return this.emitter().removeAllListeners(), this;
15930 },
15931 emit: function(k, D) {
15932 return this.emitter().emit(k, D), this;
15933 }
15934 }), ct.eventAliasesOn(s), a = i;
15935 } else if (t === "renderer" && e !== "null" && e !== "base") {
15936 var d = kl("renderer", "base"), c = d.prototype, y = r, p = r.prototype, g = function() {
15937 d.apply(this, arguments), y.apply(this, arguments);
15938 }, m = g.prototype;
15939 for (var b in c) {
15940 var E = c[b], M = p[b] != null;
15941 if (M)
15942 return n(b);
15943 m[b] = E;
15944 }
15945 for (var L in p)
15946 m[L] = p[L];
15947 c.clientFunctions.forEach(function(w) {
15948 m[w] = m[w] || function() {
15949 xt("Renderer does not implement `renderer." + w + "()` on its prototype");
15950 };
15951 }), a = g;
15952 } else if (t === "__proto__" || t === "constructor" || t === "prototype")
15953 return xt(t + " is an illegal type to be registered, possibly lead to prototype pollutions");
15954 return ts({
15955 map: Il,
15956 keys: [t, e],
15957 value: a
15958 });
15959 }
15960 function kl(t, e) {
15961 return rs({
15962 map: Il,
15963 keys: [t, e]
15964 });
15965 }
15966 function np(t, e, r, a, n) {
15967 return ts({
15968 map: Ml,
15969 keys: [t, e, r, a],
15970 value: n
15971 });
15972 }
15973 function ip(t, e, r, a) {
15974 return rs({
15975 map: Ml,
15976 keys: [t, e, r, a]
15977 });
15978 }
15979 var Xi = function() {
15980 if (arguments.length === 2)
15981 return kl.apply(null, arguments);
15982 if (arguments.length === 3)
15983 return Rl.apply(null, arguments);
15984 if (arguments.length === 4)
15985 return ip.apply(null, arguments);
15986 if (arguments.length === 5)
15987 return np.apply(null, arguments);
15988 xt("Invalid extension access syntax");
15989 };
15990 Za.prototype.extension = Xi, ap.forEach(function(t) {
15991 t.extensions.forEach(function(e) {
15992 Rl(t.type, e.name, e.impl);
15993 });
15994 });
15995 var Pl = function t() {
15996 if (!(this instanceof t))
15997 return new t();
15998 this.length = 0;
15999 }, Yr = Pl.prototype;
16000 Yr.instanceString = function() {
16001 return "stylesheet";
16002 }, Yr.selector = function(t) {
16003 var e = this.length++;
16004 return this[e] = {
16005 selector: t,
16006 properties: []
16007 }, this;
16008 }, Yr.css = function(t, e) {
16009 var r = this.length - 1;
16010 if (ee(t))
16011 this[r].properties.push({
16012 name: t,
16013 value: e
16014 });
16015 else if (S(t))
16016 for (var a = t, n = Object.keys(a), i = 0; i < n.length; i++) {
16017 var s = n[i], o = a[s];
16018 if (o != null) {
16019 var u = Gt.properties[s] || Gt.properties[yt(s)];
16020 if (u != null) {
16021 var l = u.name, f = o;
16022 this[r].properties.push({
16023 name: l,
16024 value: f
16025 });
16026 }
16027 }
16028 }
16029 return this;
16030 }, Yr.style = Yr.css, Yr.generateStyle = function(t) {
16031 var e = new Gt(t);
16032 return this.appendToStyle(e);
16033 }, Yr.appendToStyle = function(t) {
16034 for (var e = 0; e < this.length; e++) {
16035 var r = this[e], a = r.selector, n = r.properties;
16036 t.selector(a);
16037 for (var i = 0; i < n.length; i++) {
16038 var s = n[i];
16039 t.css(s.name, s.value);
16040 }
16041 }
16042 return t;
16043 };
16044 var sp = "3.28.1", Hr = function(e) {
16045 if (e === void 0 && (e = {}), S(e))
16046 return new Za(e);
16047 if (ee(e))
16048 return Xi.apply(Xi, arguments);
16049 };
16050 return Hr.use = function(t) {
16051 var e = Array.prototype.slice.call(arguments, 1);
16052 return e.unshift(Hr), t.apply(null, e), this;
16053 }, Hr.warnings = function(t) {
16054 return gs(t);
16055 }, Hr.version = sp, Hr.stylesheet = Hr.Stylesheet = Pl, Hr;
16056 });
16057})(Yl);
16058var Fp = Yl.exports;
16059const Hl = /* @__PURE__ */ $l(Fp);
16060var Xl = { exports: {} }, Ki = { exports: {} }, Zi = { exports: {} }, Vl;
16061function Gp() {
16062 return Vl || (Vl = 1, function(de, Pe) {
16063 (function(fe, Q) {
16064 de.exports = Q();
16065 })(Ca, function() {
16066 return (
16067 /******/
16068 function(_) {
16069 var fe = {};
16070 function Q(C) {
16071 if (fe[C])
16072 return fe[C].exports;
16073 var T = fe[C] = {
16074 /******/
16075 i: C,
16076 /******/
16077 l: !1,
16078 /******/
16079 exports: {}
16080 /******/
16081 };
16082 return _[C].call(T.exports, T, T.exports, Q), T.l = !0, T.exports;
16083 }
16084 return Q.m = _, Q.c = fe, Q.i = function(C) {
16085 return C;
16086 }, Q.d = function(C, T, x) {
16087 Q.o(C, T) || Object.defineProperty(C, T, {
16088 /******/
16089 configurable: !1,
16090 /******/
16091 enumerable: !0,
16092 /******/
16093 get: x
16094 /******/
16095 });
16096 }, Q.n = function(C) {
16097 var T = C && C.__esModule ? (
16098 /******/
16099 function() {
16100 return C.default;
16101 }
16102 ) : (
16103 /******/
16104 function() {
16105 return C;
16106 }
16107 );
16108 return Q.d(T, "a", T), T;
16109 }, Q.o = function(C, T) {
16110 return Object.prototype.hasOwnProperty.call(C, T);
16111 }, Q.p = "", Q(Q.s = 26);
16112 }([
16113 /* 0 */
16114 /***/
16115 function(_, fe, Q) {
16116 function C() {
16117 }
16118 C.QUALITY = 1, C.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, C.DEFAULT_INCREMENTAL = !1, C.DEFAULT_ANIMATION_ON_LAYOUT = !0, C.DEFAULT_ANIMATION_DURING_LAYOUT = !1, C.DEFAULT_ANIMATION_PERIOD = 50, C.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, C.DEFAULT_GRAPH_MARGIN = 15, C.NODE_DIMENSIONS_INCLUDE_LABELS = !1, C.SIMPLE_NODE_SIZE = 40, C.SIMPLE_NODE_HALF_SIZE = C.SIMPLE_NODE_SIZE / 2, C.EMPTY_COMPOUND_NODE_SIZE = 40, C.MIN_EDGE_LENGTH = 1, C.WORLD_BOUNDARY = 1e6, C.INITIAL_WORLD_BOUNDARY = C.WORLD_BOUNDARY / 1e3, C.WORLD_CENTER_X = 1200, C.WORLD_CENTER_Y = 900, _.exports = C;
16119 },
16120 /* 1 */
16121 /***/
16122 function(_, fe, Q) {
16123 var C = Q(2), T = Q(8), x = Q(9);
16124 function I(Y, P, Z) {
16125 C.call(this, Z), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = Z, this.bendpoints = [], this.source = Y, this.target = P;
16126 }
16127 I.prototype = Object.create(C.prototype);
16128 for (var z in C)
16129 I[z] = C[z];
16130 I.prototype.getSource = function() {
16131 return this.source;
16132 }, I.prototype.getTarget = function() {
16133 return this.target;
16134 }, I.prototype.isInterGraph = function() {
16135 return this.isInterGraph;
16136 }, I.prototype.getLength = function() {
16137 return this.length;
16138 }, I.prototype.isOverlapingSourceAndTarget = function() {
16139 return this.isOverlapingSourceAndTarget;
16140 }, I.prototype.getBendpoints = function() {
16141 return this.bendpoints;
16142 }, I.prototype.getLca = function() {
16143 return this.lca;
16144 }, I.prototype.getSourceInLca = function() {
16145 return this.sourceInLca;
16146 }, I.prototype.getTargetInLca = function() {
16147 return this.targetInLca;
16148 }, I.prototype.getOtherEnd = function(Y) {
16149 if (this.source === Y)
16150 return this.target;
16151 if (this.target === Y)
16152 return this.source;
16153 throw "Node is not incident with this edge";
16154 }, I.prototype.getOtherEndInGraph = function(Y, P) {
16155 for (var Z = this.getOtherEnd(Y), A = P.getGraphManager().getRoot(); ; ) {
16156 if (Z.getOwner() == P)
16157 return Z;
16158 if (Z.getOwner() == A)
16159 break;
16160 Z = Z.getOwner().getParent();
16161 }
16162 return null;
16163 }, I.prototype.updateLength = function() {
16164 var Y = new Array(4);
16165 this.isOverlapingSourceAndTarget = T.getIntersection(this.target.getRect(), this.source.getRect(), Y), this.isOverlapingSourceAndTarget || (this.lengthX = Y[0] - Y[2], this.lengthY = Y[1] - Y[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));
16166 }, I.prototype.updateLengthSimple = function() {
16167 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);
16168 }, _.exports = I;
16169 },
16170 /* 2 */
16171 /***/
16172 function(_, fe, Q) {
16173 function C(T) {
16174 this.vGraphObject = T;
16175 }
16176 _.exports = C;
16177 },
16178 /* 3 */
16179 /***/
16180 function(_, fe, Q) {
16181 var C = Q(2), T = Q(10), x = Q(13), I = Q(0), z = Q(16), Y = Q(4);
16182 function P(A, $, U, J) {
16183 U == null && J == null && (J = $), C.call(this, J), A.graphManager != null && (A = A.graphManager), this.estimatedSize = T.MIN_VALUE, this.inclusionTreeDepth = T.MAX_VALUE, this.vGraphObject = J, this.edges = [], this.graphManager = A, U != null && $ != null ? this.rect = new x($.x, $.y, U.width, U.height) : this.rect = new x();
16184 }
16185 P.prototype = Object.create(C.prototype);
16186 for (var Z in C)
16187 P[Z] = C[Z];
16188 P.prototype.getEdges = function() {
16189 return this.edges;
16190 }, P.prototype.getChild = function() {
16191 return this.child;
16192 }, P.prototype.getOwner = function() {
16193 return this.owner;
16194 }, P.prototype.getWidth = function() {
16195 return this.rect.width;
16196 }, P.prototype.setWidth = function(A) {
16197 this.rect.width = A;
16198 }, P.prototype.getHeight = function() {
16199 return this.rect.height;
16200 }, P.prototype.setHeight = function(A) {
16201 this.rect.height = A;
16202 }, P.prototype.getCenterX = function() {
16203 return this.rect.x + this.rect.width / 2;
16204 }, P.prototype.getCenterY = function() {
16205 return this.rect.y + this.rect.height / 2;
16206 }, P.prototype.getCenter = function() {
16207 return new Y(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2);
16208 }, P.prototype.getLocation = function() {
16209 return new Y(this.rect.x, this.rect.y);
16210 }, P.prototype.getRect = function() {
16211 return this.rect;
16212 }, P.prototype.getDiagonal = function() {
16213 return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height);
16214 }, P.prototype.getHalfTheDiagonal = function() {
16215 return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2;
16216 }, P.prototype.setRect = function(A, $) {
16217 this.rect.x = A.x, this.rect.y = A.y, this.rect.width = $.width, this.rect.height = $.height;
16218 }, P.prototype.setCenter = function(A, $) {
16219 this.rect.x = A - this.rect.width / 2, this.rect.y = $ - this.rect.height / 2;
16220 }, P.prototype.setLocation = function(A, $) {
16221 this.rect.x = A, this.rect.y = $;
16222 }, P.prototype.moveBy = function(A, $) {
16223 this.rect.x += A, this.rect.y += $;
16224 }, P.prototype.getEdgeListToNode = function(A) {
16225 var $ = [], U = this;
16226 return U.edges.forEach(function(J) {
16227 if (J.target == A) {
16228 if (J.source != U)
16229 throw "Incorrect edge source!";
16230 $.push(J);
16231 }
16232 }), $;
16233 }, P.prototype.getEdgesBetween = function(A) {
16234 var $ = [], U = this;
16235 return U.edges.forEach(function(J) {
16236 if (!(J.source == U || J.target == U))
16237 throw "Incorrect edge source and/or target";
16238 (J.target == A || J.source == A) && $.push(J);
16239 }), $;
16240 }, P.prototype.getNeighborsList = function() {
16241 var A = /* @__PURE__ */ new Set(), $ = this;
16242 return $.edges.forEach(function(U) {
16243 if (U.source == $)
16244 A.add(U.target);
16245 else {
16246 if (U.target != $)
16247 throw "Incorrect incidency!";
16248 A.add(U.source);
16249 }
16250 }), A;
16251 }, P.prototype.withChildren = function() {
16252 var A = /* @__PURE__ */ new Set(), $, U;
16253 if (A.add(this), this.child != null)
16254 for (var J = this.child.getNodes(), ne = 0; ne < J.length; ne++)
16255 $ = J[ne], U = $.withChildren(), U.forEach(function(le) {
16256 A.add(le);
16257 });
16258 return A;
16259 }, P.prototype.getNoOfChildren = function() {
16260 var A = 0, $;
16261 if (this.child == null)
16262 A = 1;
16263 else
16264 for (var U = this.child.getNodes(), J = 0; J < U.length; J++)
16265 $ = U[J], A += $.getNoOfChildren();
16266 return A == 0 && (A = 1), A;
16267 }, P.prototype.getEstimatedSize = function() {
16268 if (this.estimatedSize == T.MIN_VALUE)
16269 throw "assert failed";
16270 return this.estimatedSize;
16271 }, P.prototype.calcEstimatedSize = function() {
16272 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);
16273 }, P.prototype.scatter = function() {
16274 var A, $, U = -I.INITIAL_WORLD_BOUNDARY, J = I.INITIAL_WORLD_BOUNDARY;
16275 A = I.WORLD_CENTER_X + z.nextDouble() * (J - U) + U;
16276 var ne = -I.INITIAL_WORLD_BOUNDARY, le = I.INITIAL_WORLD_BOUNDARY;
16277 $ = I.WORLD_CENTER_Y + z.nextDouble() * (le - ne) + ne, this.rect.x = A, this.rect.y = $;
16278 }, P.prototype.updateBounds = function() {
16279 if (this.getChild() == null)
16280 throw "assert failed";
16281 if (this.getChild().getNodes().length != 0) {
16282 var A = this.getChild();
16283 if (A.updateBounds(!0), this.rect.x = A.getLeft(), this.rect.y = A.getTop(), this.setWidth(A.getRight() - A.getLeft()), this.setHeight(A.getBottom() - A.getTop()), I.NODE_DIMENSIONS_INCLUDE_LABELS) {
16284 var $ = A.getRight() - A.getLeft(), U = A.getBottom() - A.getTop();
16285 this.labelWidth > $ && (this.rect.x -= (this.labelWidth - $) / 2, this.setWidth(this.labelWidth)), this.labelHeight > U && (this.labelPos == "center" ? this.rect.y -= (this.labelHeight - U) / 2 : this.labelPos == "top" && (this.rect.y -= this.labelHeight - U), this.setHeight(this.labelHeight));
16286 }
16287 }
16288 }, P.prototype.getInclusionTreeDepth = function() {
16289 if (this.inclusionTreeDepth == T.MAX_VALUE)
16290 throw "assert failed";
16291 return this.inclusionTreeDepth;
16292 }, P.prototype.transform = function(A) {
16293 var $ = this.rect.x;
16294 $ > I.WORLD_BOUNDARY ? $ = I.WORLD_BOUNDARY : $ < -I.WORLD_BOUNDARY && ($ = -I.WORLD_BOUNDARY);
16295 var U = this.rect.y;
16296 U > I.WORLD_BOUNDARY ? U = I.WORLD_BOUNDARY : U < -I.WORLD_BOUNDARY && (U = -I.WORLD_BOUNDARY);
16297 var J = new Y($, U), ne = A.inverseTransformPoint(J);
16298 this.setLocation(ne.x, ne.y);
16299 }, P.prototype.getLeft = function() {
16300 return this.rect.x;
16301 }, P.prototype.getRight = function() {
16302 return this.rect.x + this.rect.width;
16303 }, P.prototype.getTop = function() {
16304 return this.rect.y;
16305 }, P.prototype.getBottom = function() {
16306 return this.rect.y + this.rect.height;
16307 }, P.prototype.getParent = function() {
16308 return this.owner == null ? null : this.owner.getParent();
16309 }, _.exports = P;
16310 },
16311 /* 4 */
16312 /***/
16313 function(_, fe, Q) {
16314 function C(T, x) {
16315 T == null && x == null ? (this.x = 0, this.y = 0) : (this.x = T, this.y = x);
16316 }
16317 C.prototype.getX = function() {
16318 return this.x;
16319 }, C.prototype.getY = function() {
16320 return this.y;
16321 }, C.prototype.setX = function(T) {
16322 this.x = T;
16323 }, C.prototype.setY = function(T) {
16324 this.y = T;
16325 }, C.prototype.getDifference = function(T) {
16326 return new DimensionD(this.x - T.x, this.y - T.y);
16327 }, C.prototype.getCopy = function() {
16328 return new C(this.x, this.y);
16329 }, C.prototype.translate = function(T) {
16330 return this.x += T.width, this.y += T.height, this;
16331 }, _.exports = C;
16332 },
16333 /* 5 */
16334 /***/
16335 function(_, fe, Q) {
16336 var C = Q(2), T = Q(10), x = Q(0), I = Q(6), z = Q(3), Y = Q(1), P = Q(13), Z = Q(12), A = Q(11);
16337 function $(J, ne, le) {
16338 C.call(this, le), this.estimatedSize = T.MIN_VALUE, this.margin = x.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = J, ne != null && ne instanceof I ? this.graphManager = ne : ne != null && ne instanceof Layout && (this.graphManager = ne.graphManager);
16339 }
16340 $.prototype = Object.create(C.prototype);
16341 for (var U in C)
16342 $[U] = C[U];
16343 $.prototype.getNodes = function() {
16344 return this.nodes;
16345 }, $.prototype.getEdges = function() {
16346 return this.edges;
16347 }, $.prototype.getGraphManager = function() {
16348 return this.graphManager;
16349 }, $.prototype.getParent = function() {
16350 return this.parent;
16351 }, $.prototype.getLeft = function() {
16352 return this.left;
16353 }, $.prototype.getRight = function() {
16354 return this.right;
16355 }, $.prototype.getTop = function() {
16356 return this.top;
16357 }, $.prototype.getBottom = function() {
16358 return this.bottom;
16359 }, $.prototype.isConnected = function() {
16360 return this.isConnected;
16361 }, $.prototype.add = function(J, ne, le) {
16362 if (ne == null && le == null) {
16363 var j = J;
16364 if (this.graphManager == null)
16365 throw "Graph has no graph mgr!";
16366 if (this.getNodes().indexOf(j) > -1)
16367 throw "Node already in graph!";
16368 return j.owner = this, this.getNodes().push(j), j;
16369 } else {
16370 var ee = J;
16371 if (!(this.getNodes().indexOf(ne) > -1 && this.getNodes().indexOf(le) > -1))
16372 throw "Source or target not in graph!";
16373 if (!(ne.owner == le.owner && ne.owner == this))
16374 throw "Both owners must be this graph!";
16375 return ne.owner != le.owner ? null : (ee.source = ne, ee.target = le, ee.isInterGraph = !1, this.getEdges().push(ee), ne.edges.push(ee), le != ne && le.edges.push(ee), ee);
16376 }
16377 }, $.prototype.remove = function(J) {
16378 var ne = J;
16379 if (J instanceof z) {
16380 if (ne == null)
16381 throw "Node is null!";
16382 if (!(ne.owner != null && ne.owner == this))
16383 throw "Owner graph is invalid!";
16384 if (this.graphManager == null)
16385 throw "Owner graph manager is invalid!";
16386 for (var le = ne.edges.slice(), j, ee = le.length, H = 0; H < ee; H++)
16387 j = le[H], j.isInterGraph ? this.graphManager.remove(j) : j.source.owner.remove(j);
16388 var te = this.nodes.indexOf(ne);
16389 if (te == -1)
16390 throw "Node not in owner node list!";
16391 this.nodes.splice(te, 1);
16392 } else if (J instanceof Y) {
16393 var j = J;
16394 if (j == null)
16395 throw "Edge is null!";
16396 if (!(j.source != null && j.target != null))
16397 throw "Source and/or target is null!";
16398 if (!(j.source.owner != null && j.target.owner != null && j.source.owner == this && j.target.owner == this))
16399 throw "Source and/or target owner is invalid!";
16400 var S = j.source.edges.indexOf(j), V = j.target.edges.indexOf(j);
16401 if (!(S > -1 && V > -1))
16402 throw "Source and/or target doesn't know this edge!";
16403 j.source.edges.splice(S, 1), j.target != j.source && j.target.edges.splice(V, 1);
16404 var te = j.source.owner.getEdges().indexOf(j);
16405 if (te == -1)
16406 throw "Not in owner's edge list!";
16407 j.source.owner.getEdges().splice(te, 1);
16408 }
16409 }, $.prototype.updateLeftTop = function() {
16410 for (var J = T.MAX_VALUE, ne = T.MAX_VALUE, le, j, ee, H = this.getNodes(), te = H.length, S = 0; S < te; S++) {
16411 var V = H[S];
16412 le = V.getTop(), j = V.getLeft(), J > le && (J = le), ne > j && (ne = j);
16413 }
16414 return J == T.MAX_VALUE ? null : (H[0].getParent().paddingLeft != null ? ee = H[0].getParent().paddingLeft : ee = this.margin, this.left = ne - ee, this.top = J - ee, new Z(this.left, this.top));
16415 }, $.prototype.updateBounds = function(J) {
16416 for (var ne = T.MAX_VALUE, le = -T.MAX_VALUE, j = T.MAX_VALUE, ee = -T.MAX_VALUE, H, te, S, V, R, q = this.nodes, ve = q.length, pe = 0; pe < ve; pe++) {
16417 var Ae = q[pe];
16418 J && Ae.child != null && Ae.updateBounds(), H = Ae.getLeft(), te = Ae.getRight(), S = Ae.getTop(), V = Ae.getBottom(), ne > H && (ne = H), le < te && (le = te), j > S && (j = S), ee < V && (ee = V);
16419 }
16420 var Ne = new P(ne, j, le - ne, ee - j);
16421 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 ? R = q[0].getParent().paddingLeft : R = this.margin, this.left = Ne.x - R, this.right = Ne.x + Ne.width + R, this.top = Ne.y - R, this.bottom = Ne.y + Ne.height + R;
16422 }, $.calculateBounds = function(J) {
16423 for (var ne = T.MAX_VALUE, le = -T.MAX_VALUE, j = T.MAX_VALUE, ee = -T.MAX_VALUE, H, te, S, V, R = J.length, q = 0; q < R; q++) {
16424 var ve = J[q];
16425 H = ve.getLeft(), te = ve.getRight(), S = ve.getTop(), V = ve.getBottom(), ne > H && (ne = H), le < te && (le = te), j > S && (j = S), ee < V && (ee = V);
16426 }
16427 var pe = new P(ne, j, le - ne, ee - j);
16428 return pe;
16429 }, $.prototype.getInclusionTreeDepth = function() {
16430 return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth();
16431 }, $.prototype.getEstimatedSize = function() {
16432 if (this.estimatedSize == T.MIN_VALUE)
16433 throw "assert failed";
16434 return this.estimatedSize;
16435 }, $.prototype.calcEstimatedSize = function() {
16436 for (var J = 0, ne = this.nodes, le = ne.length, j = 0; j < le; j++) {
16437 var ee = ne[j];
16438 J += ee.calcEstimatedSize();
16439 }
16440 return J == 0 ? this.estimatedSize = x.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = J / Math.sqrt(this.nodes.length), this.estimatedSize;
16441 }, $.prototype.updateConnected = function() {
16442 var J = this;
16443 if (this.nodes.length == 0) {
16444 this.isConnected = !0;
16445 return;
16446 }
16447 var ne = new A(), le = /* @__PURE__ */ new Set(), j = this.nodes[0], ee, H, te = j.withChildren();
16448 for (te.forEach(function(pe) {
16449 ne.push(pe), le.add(pe);
16450 }); ne.length !== 0; ) {
16451 j = ne.shift(), ee = j.getEdges();
16452 for (var S = ee.length, V = 0; V < S; V++) {
16453 var R = ee[V];
16454 if (H = R.getOtherEndInGraph(j, this), H != null && !le.has(H)) {
16455 var q = H.withChildren();
16456 q.forEach(function(pe) {
16457 ne.push(pe), le.add(pe);
16458 });
16459 }
16460 }
16461 }
16462 if (this.isConnected = !1, le.size >= this.nodes.length) {
16463 var ve = 0;
16464 le.forEach(function(pe) {
16465 pe.owner == J && ve++;
16466 }), ve == this.nodes.length && (this.isConnected = !0);
16467 }
16468 }, _.exports = $;
16469 },
16470 /* 6 */
16471 /***/
16472 function(_, fe, Q) {
16473 var C, T = Q(1);
16474 function x(I) {
16475 C = Q(5), this.layout = I, this.graphs = [], this.edges = [];
16476 }
16477 x.prototype.addRoot = function() {
16478 var I = this.layout.newGraph(), z = this.layout.newNode(null), Y = this.add(I, z);
16479 return this.setRootGraph(Y), this.rootGraph;
16480 }, x.prototype.add = function(I, z, Y, P, Z) {
16481 if (Y == null && P == null && Z == null) {
16482 if (I == null)
16483 throw "Graph is null!";
16484 if (z == null)
16485 throw "Parent node is null!";
16486 if (this.graphs.indexOf(I) > -1)
16487 throw "Graph already in this graph mgr!";
16488 if (this.graphs.push(I), I.parent != null)
16489 throw "Already has a parent!";
16490 if (z.child != null)
16491 throw "Already has a child!";
16492 return I.parent = z, z.child = I, I;
16493 } else {
16494 Z = Y, P = z, Y = I;
16495 var A = P.getOwner(), $ = Z.getOwner();
16496 if (!(A != null && A.getGraphManager() == this))
16497 throw "Source not in this graph mgr!";
16498 if (!($ != null && $.getGraphManager() == this))
16499 throw "Target not in this graph mgr!";
16500 if (A == $)
16501 return Y.isInterGraph = !1, A.add(Y, P, Z);
16502 if (Y.isInterGraph = !0, Y.source = P, Y.target = Z, this.edges.indexOf(Y) > -1)
16503 throw "Edge already in inter-graph edge list!";
16504 if (this.edges.push(Y), !(Y.source != null && Y.target != null))
16505 throw "Edge source and/or target is null!";
16506 if (!(Y.source.edges.indexOf(Y) == -1 && Y.target.edges.indexOf(Y) == -1))
16507 throw "Edge already in source and/or target incidency list!";
16508 return Y.source.edges.push(Y), Y.target.edges.push(Y), Y;
16509 }
16510 }, x.prototype.remove = function(I) {
16511 if (I instanceof C) {
16512 var z = I;
16513 if (z.getGraphManager() != this)
16514 throw "Graph not in this graph mgr";
16515 if (!(z == this.rootGraph || z.parent != null && z.parent.graphManager == this))
16516 throw "Invalid parent node!";
16517 var Y = [];
16518 Y = Y.concat(z.getEdges());
16519 for (var P, Z = Y.length, A = 0; A < Z; A++)
16520 P = Y[A], z.remove(P);
16521 var $ = [];
16522 $ = $.concat(z.getNodes());
16523 var U;
16524 Z = $.length;
16525 for (var A = 0; A < Z; A++)
16526 U = $[A], z.remove(U);
16527 z == this.rootGraph && this.setRootGraph(null);
16528 var J = this.graphs.indexOf(z);
16529 this.graphs.splice(J, 1), z.parent = null;
16530 } else if (I instanceof T) {
16531 if (P = I, P == null)
16532 throw "Edge is null!";
16533 if (!P.isInterGraph)
16534 throw "Not an inter-graph edge!";
16535 if (!(P.source != null && P.target != null))
16536 throw "Source and/or target is null!";
16537 if (!(P.source.edges.indexOf(P) != -1 && P.target.edges.indexOf(P) != -1))
16538 throw "Source and/or target doesn't know this edge!";
16539 var J = P.source.edges.indexOf(P);
16540 if (P.source.edges.splice(J, 1), J = P.target.edges.indexOf(P), P.target.edges.splice(J, 1), !(P.source.owner != null && P.source.owner.getGraphManager() != null))
16541 throw "Edge owner graph or owner graph manager is null!";
16542 if (P.source.owner.getGraphManager().edges.indexOf(P) == -1)
16543 throw "Not in owner graph manager's edge list!";
16544 var J = P.source.owner.getGraphManager().edges.indexOf(P);
16545 P.source.owner.getGraphManager().edges.splice(J, 1);
16546 }
16547 }, x.prototype.updateBounds = function() {
16548 this.rootGraph.updateBounds(!0);
16549 }, x.prototype.getGraphs = function() {
16550 return this.graphs;
16551 }, x.prototype.getAllNodes = function() {
16552 if (this.allNodes == null) {
16553 for (var I = [], z = this.getGraphs(), Y = z.length, P = 0; P < Y; P++)
16554 I = I.concat(z[P].getNodes());
16555 this.allNodes = I;
16556 }
16557 return this.allNodes;
16558 }, x.prototype.resetAllNodes = function() {
16559 this.allNodes = null;
16560 }, x.prototype.resetAllEdges = function() {
16561 this.allEdges = null;
16562 }, x.prototype.resetAllNodesToApplyGravitation = function() {
16563 this.allNodesToApplyGravitation = null;
16564 }, x.prototype.getAllEdges = function() {
16565 if (this.allEdges == null) {
16566 var I = [], z = this.getGraphs();
16567 z.length;
16568 for (var Y = 0; Y < z.length; Y++)
16569 I = I.concat(z[Y].getEdges());
16570 I = I.concat(this.edges), this.allEdges = I;
16571 }
16572 return this.allEdges;
16573 }, x.prototype.getAllNodesToApplyGravitation = function() {
16574 return this.allNodesToApplyGravitation;
16575 }, x.prototype.setAllNodesToApplyGravitation = function(I) {
16576 if (this.allNodesToApplyGravitation != null)
16577 throw "assert failed";
16578 this.allNodesToApplyGravitation = I;
16579 }, x.prototype.getRoot = function() {
16580 return this.rootGraph;
16581 }, x.prototype.setRootGraph = function(I) {
16582 if (I.getGraphManager() != this)
16583 throw "Root not in this graph mgr!";
16584 this.rootGraph = I, I.parent == null && (I.parent = this.layout.newNode("Root node"));
16585 }, x.prototype.getLayout = function() {
16586 return this.layout;
16587 }, x.prototype.isOneAncestorOfOther = function(I, z) {
16588 if (!(I != null && z != null))
16589 throw "assert failed";
16590 if (I == z)
16591 return !0;
16592 var Y = I.getOwner(), P;
16593 do {
16594 if (P = Y.getParent(), P == null)
16595 break;
16596 if (P == z)
16597 return !0;
16598 if (Y = P.getOwner(), Y == null)
16599 break;
16600 } while (!0);
16601 Y = z.getOwner();
16602 do {
16603 if (P = Y.getParent(), P == null)
16604 break;
16605 if (P == I)
16606 return !0;
16607 if (Y = P.getOwner(), Y == null)
16608 break;
16609 } while (!0);
16610 return !1;
16611 }, x.prototype.calcLowestCommonAncestors = function() {
16612 for (var I, z, Y, P, Z, A = this.getAllEdges(), $ = A.length, U = 0; U < $; U++) {
16613 if (I = A[U], z = I.source, Y = I.target, I.lca = null, I.sourceInLca = z, I.targetInLca = Y, z == Y) {
16614 I.lca = z.getOwner();
16615 continue;
16616 }
16617 for (P = z.getOwner(); I.lca == null; ) {
16618 for (I.targetInLca = Y, Z = Y.getOwner(); I.lca == null; ) {
16619 if (Z == P) {
16620 I.lca = Z;
16621 break;
16622 }
16623 if (Z == this.rootGraph)
16624 break;
16625 if (I.lca != null)
16626 throw "assert failed";
16627 I.targetInLca = Z.getParent(), Z = I.targetInLca.getOwner();
16628 }
16629 if (P == this.rootGraph)
16630 break;
16631 I.lca == null && (I.sourceInLca = P.getParent(), P = I.sourceInLca.getOwner());
16632 }
16633 if (I.lca == null)
16634 throw "assert failed";
16635 }
16636 }, x.prototype.calcLowestCommonAncestor = function(I, z) {
16637 if (I == z)
16638 return I.getOwner();
16639 var Y = I.getOwner();
16640 do {
16641 if (Y == null)
16642 break;
16643 var P = z.getOwner();
16644 do {
16645 if (P == null)
16646 break;
16647 if (P == Y)
16648 return P;
16649 P = P.getParent().getOwner();
16650 } while (!0);
16651 Y = Y.getParent().getOwner();
16652 } while (!0);
16653 return Y;
16654 }, x.prototype.calcInclusionTreeDepths = function(I, z) {
16655 I == null && z == null && (I = this.rootGraph, z = 1);
16656 for (var Y, P = I.getNodes(), Z = P.length, A = 0; A < Z; A++)
16657 Y = P[A], Y.inclusionTreeDepth = z, Y.child != null && this.calcInclusionTreeDepths(Y.child, z + 1);
16658 }, x.prototype.includesInvalidEdge = function() {
16659 for (var I, z = this.edges.length, Y = 0; Y < z; Y++)
16660 if (I = this.edges[Y], this.isOneAncestorOfOther(I.source, I.target))
16661 return !0;
16662 return !1;
16663 }, _.exports = x;
16664 },
16665 /* 7 */
16666 /***/
16667 function(_, fe, Q) {
16668 var C = Q(0);
16669 function T() {
16670 }
16671 for (var x in C)
16672 T[x] = C[x];
16673 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, _.exports = T;
16674 },
16675 /* 8 */
16676 /***/
16677 function(_, fe, Q) {
16678 var C = Q(12);
16679 function T() {
16680 }
16681 T.calcSeparationAmount = function(x, I, z, Y) {
16682 if (!x.intersects(I))
16683 throw "assert failed";
16684 var P = new Array(2);
16685 this.decideDirectionsForOverlappingNodes(x, I, P), z[0] = Math.min(x.getRight(), I.getRight()) - Math.max(x.x, I.x), z[1] = Math.min(x.getBottom(), I.getBottom()) - Math.max(x.y, I.y), x.getX() <= I.getX() && x.getRight() >= I.getRight() ? z[0] += Math.min(I.getX() - x.getX(), x.getRight() - I.getRight()) : I.getX() <= x.getX() && I.getRight() >= x.getRight() && (z[0] += Math.min(x.getX() - I.getX(), I.getRight() - x.getRight())), x.getY() <= I.getY() && x.getBottom() >= I.getBottom() ? z[1] += Math.min(I.getY() - x.getY(), x.getBottom() - I.getBottom()) : I.getY() <= x.getY() && I.getBottom() >= x.getBottom() && (z[1] += Math.min(x.getY() - I.getY(), I.getBottom() - x.getBottom()));
16686 var Z = Math.abs((I.getCenterY() - x.getCenterY()) / (I.getCenterX() - x.getCenterX()));
16687 I.getCenterY() === x.getCenterY() && I.getCenterX() === x.getCenterX() && (Z = 1);
16688 var A = Z * z[0], $ = z[1] / Z;
16689 z[0] < $ ? $ = z[0] : A = z[1], z[0] = -1 * P[0] * ($ / 2 + Y), z[1] = -1 * P[1] * (A / 2 + Y);
16690 }, T.decideDirectionsForOverlappingNodes = function(x, I, z) {
16691 x.getCenterX() < I.getCenterX() ? z[0] = -1 : z[0] = 1, x.getCenterY() < I.getCenterY() ? z[1] = -1 : z[1] = 1;
16692 }, T.getIntersection2 = function(x, I, z) {
16693 var Y = x.getCenterX(), P = x.getCenterY(), Z = I.getCenterX(), A = I.getCenterY();
16694 if (x.intersects(I))
16695 return z[0] = Y, z[1] = P, z[2] = Z, z[3] = A, !0;
16696 var $ = x.getX(), U = x.getY(), J = x.getRight(), ne = x.getX(), le = x.getBottom(), j = x.getRight(), ee = x.getWidthHalf(), H = x.getHeightHalf(), te = I.getX(), S = I.getY(), V = I.getRight(), R = I.getX(), q = I.getBottom(), ve = I.getRight(), pe = I.getWidthHalf(), Ae = I.getHeightHalf(), Ne = !1, Ye = !1;
16697 if (Y === Z) {
16698 if (P > A)
16699 return z[0] = Y, z[1] = U, z[2] = Z, z[3] = q, !1;
16700 if (P < A)
16701 return z[0] = Y, z[1] = le, z[2] = Z, z[3] = S, !1;
16702 } else if (P === A) {
16703 if (Y > Z)
16704 return z[0] = $, z[1] = P, z[2] = V, z[3] = A, !1;
16705 if (Y < Z)
16706 return z[0] = J, z[1] = P, z[2] = te, z[3] = A, !1;
16707 } else {
16708 var at = x.height / x.width, dt = I.height / I.width, Re = (A - P) / (Z - Y), Ve = void 0, Ze = void 0, nt = void 0, ht = void 0, it = void 0, tt = void 0;
16709 if (-at === Re ? Y > Z ? (z[0] = ne, z[1] = le, Ne = !0) : (z[0] = J, z[1] = U, Ne = !0) : at === Re && (Y > Z ? (z[0] = $, z[1] = U, Ne = !0) : (z[0] = j, z[1] = le, Ne = !0)), -dt === Re ? Z > Y ? (z[2] = R, z[3] = q, Ye = !0) : (z[2] = V, z[3] = S, Ye = !0) : dt === Re && (Z > Y ? (z[2] = te, z[3] = S, Ye = !0) : (z[2] = ve, z[3] = q, Ye = !0)), Ne && Ye)
16710 return !1;
16711 if (Y > Z ? P > A ? (Ve = this.getCardinalDirection(at, Re, 4), Ze = this.getCardinalDirection(dt, Re, 2)) : (Ve = this.getCardinalDirection(-at, Re, 3), Ze = this.getCardinalDirection(-dt, Re, 1)) : P > A ? (Ve = this.getCardinalDirection(-at, Re, 1), Ze = this.getCardinalDirection(-dt, Re, 3)) : (Ve = this.getCardinalDirection(at, Re, 2), Ze = this.getCardinalDirection(dt, Re, 4)), !Ne)
16712 switch (Ve) {
16713 case 1:
16714 ht = U, nt = Y + -H / Re, z[0] = nt, z[1] = ht;
16715 break;
16716 case 2:
16717 nt = j, ht = P + ee * Re, z[0] = nt, z[1] = ht;
16718 break;
16719 case 3:
16720 ht = le, nt = Y + H / Re, z[0] = nt, z[1] = ht;
16721 break;
16722 case 4:
16723 nt = ne, ht = P + -ee * Re, z[0] = nt, z[1] = ht;
16724 break;
16725 }
16726 if (!Ye)
16727 switch (Ze) {
16728 case 1:
16729 tt = S, it = Z + -Ae / Re, z[2] = it, z[3] = tt;
16730 break;
16731 case 2:
16732 it = ve, tt = A + pe * Re, z[2] = it, z[3] = tt;
16733 break;
16734 case 3:
16735 tt = q, it = Z + Ae / Re, z[2] = it, z[3] = tt;
16736 break;
16737 case 4:
16738 it = R, tt = A + -pe * Re, z[2] = it, z[3] = tt;
16739 break;
16740 }
16741 }
16742 return !1;
16743 }, T.getCardinalDirection = function(x, I, z) {
16744 return x > I ? z : 1 + z % 4;
16745 }, T.getIntersection = function(x, I, z, Y) {
16746 if (Y == null)
16747 return this.getIntersection2(x, I, z);
16748 var P = x.x, Z = x.y, A = I.x, $ = I.y, U = z.x, J = z.y, ne = Y.x, le = Y.y, j = void 0, ee = void 0, H = void 0, te = void 0, S = void 0, V = void 0, R = void 0, q = void 0, ve = void 0;
16749 return H = $ - Z, S = P - A, R = A * Z - P * $, te = le - J, V = U - ne, q = ne * J - U * le, ve = H * V - te * S, ve === 0 ? null : (j = (S * q - V * R) / ve, ee = (te * R - H * q) / ve, new C(j, ee));
16750 }, T.angleOfVector = function(x, I, z, Y) {
16751 var P = void 0;
16752 return x !== z ? (P = Math.atan((Y - I) / (z - x)), z < x ? P += Math.PI : Y < I && (P += this.TWO_PI)) : Y < I ? P = this.ONE_AND_HALF_PI : P = this.HALF_PI, P;
16753 }, T.doIntersect = function(x, I, z, Y) {
16754 var P = x.x, Z = x.y, A = I.x, $ = I.y, U = z.x, J = z.y, ne = Y.x, le = Y.y, j = (A - P) * (le - J) - (ne - U) * ($ - Z);
16755 if (j === 0)
16756 return !1;
16757 var ee = ((le - J) * (ne - P) + (U - ne) * (le - Z)) / j, H = ((Z - $) * (ne - P) + (A - P) * (le - Z)) / j;
16758 return 0 < ee && ee < 1 && 0 < H && H < 1;
16759 }, 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, _.exports = T;
16760 },
16761 /* 9 */
16762 /***/
16763 function(_, fe, Q) {
16764 function C() {
16765 }
16766 C.sign = function(T) {
16767 return T > 0 ? 1 : T < 0 ? -1 : 0;
16768 }, C.floor = function(T) {
16769 return T < 0 ? Math.ceil(T) : Math.floor(T);
16770 }, C.ceil = function(T) {
16771 return T < 0 ? Math.floor(T) : Math.ceil(T);
16772 }, _.exports = C;
16773 },
16774 /* 10 */
16775 /***/
16776 function(_, fe, Q) {
16777 function C() {
16778 }
16779 C.MAX_VALUE = 2147483647, C.MIN_VALUE = -2147483648, _.exports = C;
16780 },
16781 /* 11 */
16782 /***/
16783 function(_, fe, Q) {
16784 var C = function() {
16785 function P(Z, A) {
16786 for (var $ = 0; $ < A.length; $++) {
16787 var U = A[$];
16788 U.enumerable = U.enumerable || !1, U.configurable = !0, "value" in U && (U.writable = !0), Object.defineProperty(Z, U.key, U);
16789 }
16790 }
16791 return function(Z, A, $) {
16792 return A && P(Z.prototype, A), $ && P(Z, $), Z;
16793 };
16794 }();
16795 function T(P, Z) {
16796 if (!(P instanceof Z))
16797 throw new TypeError("Cannot call a class as a function");
16798 }
16799 var x = function(Z) {
16800 return { value: Z, next: null, prev: null };
16801 }, I = function(Z, A, $, U) {
16802 return Z !== null ? Z.next = A : U.head = A, $ !== null ? $.prev = A : U.tail = A, A.prev = Z, A.next = $, U.length++, A;
16803 }, z = function(Z, A) {
16804 var $ = Z.prev, U = Z.next;
16805 return $ !== null ? $.next = U : A.head = U, U !== null ? U.prev = $ : A.tail = $, Z.prev = Z.next = null, A.length--, Z;
16806 }, Y = function() {
16807 function P(Z) {
16808 var A = this;
16809 T(this, P), this.length = 0, this.head = null, this.tail = null, Z != null && Z.forEach(function($) {
16810 return A.push($);
16811 });
16812 }
16813 return C(P, [{
16814 key: "size",
16815 value: function() {
16816 return this.length;
16817 }
16818 }, {
16819 key: "insertBefore",
16820 value: function(A, $) {
16821 return I($.prev, x(A), $, this);
16822 }
16823 }, {
16824 key: "insertAfter",
16825 value: function(A, $) {
16826 return I($, x(A), $.next, this);
16827 }
16828 }, {
16829 key: "insertNodeBefore",
16830 value: function(A, $) {
16831 return I($.prev, A, $, this);
16832 }
16833 }, {
16834 key: "insertNodeAfter",
16835 value: function(A, $) {
16836 return I($, A, $.next, this);
16837 }
16838 }, {
16839 key: "push",
16840 value: function(A) {
16841 return I(this.tail, x(A), null, this);
16842 }
16843 }, {
16844 key: "unshift",
16845 value: function(A) {
16846 return I(null, x(A), this.head, this);
16847 }
16848 }, {
16849 key: "remove",
16850 value: function(A) {
16851 return z(A, this);
16852 }
16853 }, {
16854 key: "pop",
16855 value: function() {
16856 return z(this.tail, this).value;
16857 }
16858 }, {
16859 key: "popNode",
16860 value: function() {
16861 return z(this.tail, this);
16862 }
16863 }, {
16864 key: "shift",
16865 value: function() {
16866 return z(this.head, this).value;
16867 }
16868 }, {
16869 key: "shiftNode",
16870 value: function() {
16871 return z(this.head, this);
16872 }
16873 }, {
16874 key: "get_object_at",
16875 value: function(A) {
16876 if (A <= this.length()) {
16877 for (var $ = 1, U = this.head; $ < A; )
16878 U = U.next, $++;
16879 return U.value;
16880 }
16881 }
16882 }, {
16883 key: "set_object_at",
16884 value: function(A, $) {
16885 if (A <= this.length()) {
16886 for (var U = 1, J = this.head; U < A; )
16887 J = J.next, U++;
16888 J.value = $;
16889 }
16890 }
16891 }]), P;
16892 }();
16893 _.exports = Y;
16894 },
16895 /* 12 */
16896 /***/
16897 function(_, fe, Q) {
16898 function C(T, x, I) {
16899 this.x = null, this.y = null, T == null && x == null && I == null ? (this.x = 0, this.y = 0) : typeof T == "number" && typeof x == "number" && I == null ? (this.x = T, this.y = x) : T.constructor.name == "Point" && x == null && I == null && (I = T, this.x = I.x, this.y = I.y);
16900 }
16901 C.prototype.getX = function() {
16902 return this.x;
16903 }, C.prototype.getY = function() {
16904 return this.y;
16905 }, C.prototype.getLocation = function() {
16906 return new C(this.x, this.y);
16907 }, C.prototype.setLocation = function(T, x, I) {
16908 T.constructor.name == "Point" && x == null && I == null ? (I = T, this.setLocation(I.x, I.y)) : typeof T == "number" && typeof x == "number" && I == 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)));
16909 }, C.prototype.move = function(T, x) {
16910 this.x = T, this.y = x;
16911 }, C.prototype.translate = function(T, x) {
16912 this.x += T, this.y += x;
16913 }, C.prototype.equals = function(T) {
16914 if (T.constructor.name == "Point") {
16915 var x = T;
16916 return this.x == x.x && this.y == x.y;
16917 }
16918 return this == T;
16919 }, C.prototype.toString = function() {
16920 return new C().constructor.name + "[x=" + this.x + ",y=" + this.y + "]";
16921 }, _.exports = C;
16922 },
16923 /* 13 */
16924 /***/
16925 function(_, fe, Q) {
16926 function C(T, x, I, z) {
16927 this.x = 0, this.y = 0, this.width = 0, this.height = 0, T != null && x != null && I != null && z != null && (this.x = T, this.y = x, this.width = I, this.height = z);
16928 }
16929 C.prototype.getX = function() {
16930 return this.x;
16931 }, C.prototype.setX = function(T) {
16932 this.x = T;
16933 }, C.prototype.getY = function() {
16934 return this.y;
16935 }, C.prototype.setY = function(T) {
16936 this.y = T;
16937 }, C.prototype.getWidth = function() {
16938 return this.width;
16939 }, C.prototype.setWidth = function(T) {
16940 this.width = T;
16941 }, C.prototype.getHeight = function() {
16942 return this.height;
16943 }, C.prototype.setHeight = function(T) {
16944 this.height = T;
16945 }, C.prototype.getRight = function() {
16946 return this.x + this.width;
16947 }, C.prototype.getBottom = function() {
16948 return this.y + this.height;
16949 }, C.prototype.intersects = function(T) {
16950 return !(this.getRight() < T.x || this.getBottom() < T.y || T.getRight() < this.x || T.getBottom() < this.y);
16951 }, C.prototype.getCenterX = function() {
16952 return this.x + this.width / 2;
16953 }, C.prototype.getMinX = function() {
16954 return this.getX();
16955 }, C.prototype.getMaxX = function() {
16956 return this.getX() + this.width;
16957 }, C.prototype.getCenterY = function() {
16958 return this.y + this.height / 2;
16959 }, C.prototype.getMinY = function() {
16960 return this.getY();
16961 }, C.prototype.getMaxY = function() {
16962 return this.getY() + this.height;
16963 }, C.prototype.getWidthHalf = function() {
16964 return this.width / 2;
16965 }, C.prototype.getHeightHalf = function() {
16966 return this.height / 2;
16967 }, _.exports = C;
16968 },
16969 /* 14 */
16970 /***/
16971 function(_, fe, Q) {
16972 var C = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(x) {
16973 return typeof x;
16974 } : function(x) {
16975 return x && typeof Symbol == "function" && x.constructor === Symbol && x !== Symbol.prototype ? "symbol" : typeof x;
16976 };
16977 function T() {
16978 }
16979 T.lastID = 0, T.createID = function(x) {
16980 return T.isPrimitive(x) ? x : (x.uniqueID != null || (x.uniqueID = T.getString(), T.lastID++), x.uniqueID);
16981 }, T.getString = function(x) {
16982 return x == null && (x = T.lastID), "Object#" + x;
16983 }, T.isPrimitive = function(x) {
16984 var I = typeof x > "u" ? "undefined" : C(x);
16985 return x == null || I != "object" && I != "function";
16986 }, _.exports = T;
16987 },
16988 /* 15 */
16989 /***/
16990 function(_, fe, Q) {
16991 function C(U) {
16992 if (Array.isArray(U)) {
16993 for (var J = 0, ne = Array(U.length); J < U.length; J++)
16994 ne[J] = U[J];
16995 return ne;
16996 } else
16997 return Array.from(U);
16998 }
16999 var T = Q(0), x = Q(6), I = Q(3), z = Q(1), Y = Q(5), P = Q(4), Z = Q(17), A = Q(27);
17000 function $(U) {
17001 A.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, U != null && (this.isRemoteUse = U);
17002 }
17003 $.RANDOM_SEED = 1, $.prototype = Object.create(A.prototype), $.prototype.getGraphManager = function() {
17004 return this.graphManager;
17005 }, $.prototype.getAllNodes = function() {
17006 return this.graphManager.getAllNodes();
17007 }, $.prototype.getAllEdges = function() {
17008 return this.graphManager.getAllEdges();
17009 }, $.prototype.getAllNodesToApplyGravitation = function() {
17010 return this.graphManager.getAllNodesToApplyGravitation();
17011 }, $.prototype.newGraphManager = function() {
17012 var U = new x(this);
17013 return this.graphManager = U, U;
17014 }, $.prototype.newGraph = function(U) {
17015 return new Y(null, this.graphManager, U);
17016 }, $.prototype.newNode = function(U) {
17017 return new I(this.graphManager, U);
17018 }, $.prototype.newEdge = function(U) {
17019 return new z(null, null, U);
17020 }, $.prototype.checkLayoutSuccess = function() {
17021 return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge();
17022 }, $.prototype.runLayout = function() {
17023 this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters();
17024 var U;
17025 return this.checkLayoutSuccess() ? U = !1 : U = this.layout(), T.ANIMATE === "during" ? !1 : (U && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, U);
17026 }, $.prototype.doPostLayout = function() {
17027 this.incremental || this.transform(), this.update();
17028 }, $.prototype.update2 = function() {
17029 if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) {
17030 for (var U = this.graphManager.getAllEdges(), J = 0; J < U.length; J++)
17031 U[J];
17032 for (var ne = this.graphManager.getRoot().getNodes(), J = 0; J < ne.length; J++)
17033 ne[J];
17034 this.update(this.graphManager.getRoot());
17035 }
17036 }, $.prototype.update = function(U) {
17037 if (U == null)
17038 this.update2();
17039 else if (U instanceof I) {
17040 var J = U;
17041 if (J.getChild() != null)
17042 for (var ne = J.getChild().getNodes(), le = 0; le < ne.length; le++)
17043 update(ne[le]);
17044 if (J.vGraphObject != null) {
17045 var j = J.vGraphObject;
17046 j.update(J);
17047 }
17048 } else if (U instanceof z) {
17049 var ee = U;
17050 if (ee.vGraphObject != null) {
17051 var H = ee.vGraphObject;
17052 H.update(ee);
17053 }
17054 } else if (U instanceof Y) {
17055 var te = U;
17056 if (te.vGraphObject != null) {
17057 var S = te.vGraphObject;
17058 S.update(te);
17059 }
17060 }
17061 }, $.prototype.initParameters = function() {
17062 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);
17063 }, $.prototype.transform = function(U) {
17064 if (U == null)
17065 this.transform(new P(0, 0));
17066 else {
17067 var J = new Z(), ne = this.graphManager.getRoot().updateLeftTop();
17068 if (ne != null) {
17069 J.setWorldOrgX(U.x), J.setWorldOrgY(U.y), J.setDeviceOrgX(ne.x), J.setDeviceOrgY(ne.y);
17070 for (var le = this.getAllNodes(), j, ee = 0; ee < le.length; ee++)
17071 j = le[ee], j.transform(J);
17072 }
17073 }
17074 }, $.prototype.positionNodesRandomly = function(U) {
17075 if (U == null)
17076 this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0);
17077 else
17078 for (var J, ne, le = U.getNodes(), j = 0; j < le.length; j++)
17079 J = le[j], ne = J.getChild(), ne == null || ne.getNodes().length == 0 ? J.scatter() : (this.positionNodesRandomly(ne), J.updateBounds());
17080 }, $.prototype.getFlatForest = function() {
17081 for (var U = [], J = !0, ne = this.graphManager.getRoot().getNodes(), le = !0, j = 0; j < ne.length; j++)
17082 ne[j].getChild() != null && (le = !1);
17083 if (!le)
17084 return U;
17085 var ee = /* @__PURE__ */ new Set(), H = [], te = /* @__PURE__ */ new Map(), S = [];
17086 for (S = S.concat(ne); S.length > 0 && J; ) {
17087 for (H.push(S[0]); H.length > 0 && J; ) {
17088 var V = H[0];
17089 H.splice(0, 1), ee.add(V);
17090 for (var R = V.getEdges(), j = 0; j < R.length; j++) {
17091 var q = R[j].getOtherEnd(V);
17092 if (te.get(V) != q)
17093 if (!ee.has(q))
17094 H.push(q), te.set(q, V);
17095 else {
17096 J = !1;
17097 break;
17098 }
17099 }
17100 }
17101 if (!J)
17102 U = [];
17103 else {
17104 var ve = [].concat(C(ee));
17105 U.push(ve);
17106 for (var j = 0; j < ve.length; j++) {
17107 var pe = ve[j], Ae = S.indexOf(pe);
17108 Ae > -1 && S.splice(Ae, 1);
17109 }
17110 ee = /* @__PURE__ */ new Set(), te = /* @__PURE__ */ new Map();
17111 }
17112 }
17113 return U;
17114 }, $.prototype.createDummyNodesForBendpoints = function(U) {
17115 for (var J = [], ne = U.source, le = this.graphManager.calcLowestCommonAncestor(U.source, U.target), j = 0; j < U.bendpoints.length; j++) {
17116 var ee = this.newNode(null);
17117 ee.setRect(new Point(0, 0), new Dimension(1, 1)), le.add(ee);
17118 var H = this.newEdge(null);
17119 this.graphManager.add(H, ne, ee), J.add(ee), ne = ee;
17120 }
17121 var H = this.newEdge(null);
17122 return this.graphManager.add(H, ne, U.target), this.edgeToDummyNodes.set(U, J), U.isInterGraph() ? this.graphManager.remove(U) : le.remove(U), J;
17123 }, $.prototype.createBendpointsFromDummyNodes = function() {
17124 var U = [];
17125 U = U.concat(this.graphManager.getAllEdges()), U = [].concat(C(this.edgeToDummyNodes.keys())).concat(U);
17126 for (var J = 0; J < U.length; J++) {
17127 var ne = U[J];
17128 if (ne.bendpoints.length > 0) {
17129 for (var le = this.edgeToDummyNodes.get(ne), j = 0; j < le.length; j++) {
17130 var ee = le[j], H = new P(ee.getCenterX(), ee.getCenterY()), te = ne.bendpoints.get(j);
17131 te.x = H.x, te.y = H.y, ee.getOwner().remove(ee);
17132 }
17133 this.graphManager.add(ne, ne.source, ne.target);
17134 }
17135 }
17136 }, $.transform = function(U, J, ne, le) {
17137 if (ne != null && le != null) {
17138 var j = J;
17139 if (U <= 50) {
17140 var ee = J / ne;
17141 j -= (J - ee) / 50 * (50 - U);
17142 } else {
17143 var H = J * le;
17144 j += (H - J) / 50 * (U - 50);
17145 }
17146 return j;
17147 } else {
17148 var te, S;
17149 return U <= 50 ? (te = 9 * J / 500, S = J / 10) : (te = 9 * J / 50, S = -8 * J), te * U + S;
17150 }
17151 }, $.findCenterOfTree = function(U) {
17152 var J = [];
17153 J = J.concat(U);
17154 var ne = [], le = /* @__PURE__ */ new Map(), j = !1, ee = null;
17155 (J.length == 1 || J.length == 2) && (j = !0, ee = J[0]);
17156 for (var H = 0; H < J.length; H++) {
17157 var te = J[H], S = te.getNeighborsList().size;
17158 le.set(te, te.getNeighborsList().size), S == 1 && ne.push(te);
17159 }
17160 var V = [];
17161 for (V = V.concat(ne); !j; ) {
17162 var R = [];
17163 R = R.concat(V), V = [];
17164 for (var H = 0; H < J.length; H++) {
17165 var te = J[H], q = J.indexOf(te);
17166 q >= 0 && J.splice(q, 1);
17167 var ve = te.getNeighborsList();
17168 ve.forEach(function(Ne) {
17169 if (ne.indexOf(Ne) < 0) {
17170 var Ye = le.get(Ne), at = Ye - 1;
17171 at == 1 && V.push(Ne), le.set(Ne, at);
17172 }
17173 });
17174 }
17175 ne = ne.concat(V), (J.length == 1 || J.length == 2) && (j = !0, ee = J[0]);
17176 }
17177 return ee;
17178 }, $.prototype.setGraphManager = function(U) {
17179 this.graphManager = U;
17180 }, _.exports = $;
17181 },
17182 /* 16 */
17183 /***/
17184 function(_, fe, Q) {
17185 function C() {
17186 }
17187 C.seed = 1, C.x = 0, C.nextDouble = function() {
17188 return C.x = Math.sin(C.seed++) * 1e4, C.x - Math.floor(C.x);
17189 }, _.exports = C;
17190 },
17191 /* 17 */
17192 /***/
17193 function(_, fe, Q) {
17194 var C = Q(4);
17195 function T(x, I) {
17196 this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1;
17197 }
17198 T.prototype.getWorldOrgX = function() {
17199 return this.lworldOrgX;
17200 }, T.prototype.setWorldOrgX = function(x) {
17201 this.lworldOrgX = x;
17202 }, T.prototype.getWorldOrgY = function() {
17203 return this.lworldOrgY;
17204 }, T.prototype.setWorldOrgY = function(x) {
17205 this.lworldOrgY = x;
17206 }, T.prototype.getWorldExtX = function() {
17207 return this.lworldExtX;
17208 }, T.prototype.setWorldExtX = function(x) {
17209 this.lworldExtX = x;
17210 }, T.prototype.getWorldExtY = function() {
17211 return this.lworldExtY;
17212 }, T.prototype.setWorldExtY = function(x) {
17213 this.lworldExtY = x;
17214 }, T.prototype.getDeviceOrgX = function() {
17215 return this.ldeviceOrgX;
17216 }, T.prototype.setDeviceOrgX = function(x) {
17217 this.ldeviceOrgX = x;
17218 }, T.prototype.getDeviceOrgY = function() {
17219 return this.ldeviceOrgY;
17220 }, T.prototype.setDeviceOrgY = function(x) {
17221 this.ldeviceOrgY = x;
17222 }, T.prototype.getDeviceExtX = function() {
17223 return this.ldeviceExtX;
17224 }, T.prototype.setDeviceExtX = function(x) {
17225 this.ldeviceExtX = x;
17226 }, T.prototype.getDeviceExtY = function() {
17227 return this.ldeviceExtY;
17228 }, T.prototype.setDeviceExtY = function(x) {
17229 this.ldeviceExtY = x;
17230 }, T.prototype.transformX = function(x) {
17231 var I = 0, z = this.lworldExtX;
17232 return z != 0 && (I = this.ldeviceOrgX + (x - this.lworldOrgX) * this.ldeviceExtX / z), I;
17233 }, T.prototype.transformY = function(x) {
17234 var I = 0, z = this.lworldExtY;
17235 return z != 0 && (I = this.ldeviceOrgY + (x - this.lworldOrgY) * this.ldeviceExtY / z), I;
17236 }, T.prototype.inverseTransformX = function(x) {
17237 var I = 0, z = this.ldeviceExtX;
17238 return z != 0 && (I = this.lworldOrgX + (x - this.ldeviceOrgX) * this.lworldExtX / z), I;
17239 }, T.prototype.inverseTransformY = function(x) {
17240 var I = 0, z = this.ldeviceExtY;
17241 return z != 0 && (I = this.lworldOrgY + (x - this.ldeviceOrgY) * this.lworldExtY / z), I;
17242 }, T.prototype.inverseTransformPoint = function(x) {
17243 var I = new C(this.inverseTransformX(x.x), this.inverseTransformY(x.y));
17244 return I;
17245 }, _.exports = T;
17246 },
17247 /* 18 */
17248 /***/
17249 function(_, fe, Q) {
17250 function C(A) {
17251 if (Array.isArray(A)) {
17252 for (var $ = 0, U = Array(A.length); $ < A.length; $++)
17253 U[$] = A[$];
17254 return U;
17255 } else
17256 return Array.from(A);
17257 }
17258 var T = Q(15), x = Q(7), I = Q(0), z = Q(8), Y = Q(9);
17259 function P() {
17260 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;
17261 }
17262 P.prototype = Object.create(T.prototype);
17263 for (var Z in T)
17264 P[Z] = T[Z];
17265 P.prototype.initParameters = function() {
17266 T.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = x.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = [];
17267 }, P.prototype.calcIdealEdgeLengths = function() {
17268 for (var A, $, U, J, ne, le, j = this.getGraphManager().getAllEdges(), ee = 0; ee < j.length; ee++)
17269 A = j[ee], A.idealLength = this.idealEdgeLength, A.isInterGraph && (U = A.getSource(), J = A.getTarget(), ne = A.getSourceInLca().getEstimatedSize(), le = A.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (A.idealLength += ne + le - 2 * I.SIMPLE_NODE_SIZE), $ = A.getLca().getInclusionTreeDepth(), A.idealLength += x.DEFAULT_EDGE_LENGTH * x.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (U.getInclusionTreeDepth() + J.getInclusionTreeDepth() - 2 * $));
17270 }, P.prototype.initSpringEmbedder = function() {
17271 var A = this.getAllNodes().length;
17272 this.incremental ? (A > x.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * x.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (A - 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) : (A > x.ADAPTATION_LOWER_NODE_LIMIT ? this.coolingFactor = Math.max(x.COOLING_ADAPTATION_FACTOR, 1 - (A - 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();
17273 }, P.prototype.calcSpringForces = function() {
17274 for (var A = this.getAllEdges(), $, U = 0; U < A.length; U++)
17275 $ = A[U], this.calcSpringForce($, $.idealLength);
17276 }, P.prototype.calcRepulsionForces = function() {
17277 var A = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, $ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, U, J, ne, le, j = this.getAllNodes(), ee;
17278 if (this.useFRGridVariant)
17279 for (this.totalIterations % x.GRID_CALCULATION_CHECK_PERIOD == 1 && A && this.updateGrid(), ee = /* @__PURE__ */ new Set(), U = 0; U < j.length; U++)
17280 ne = j[U], this.calculateRepulsionForceOfANode(ne, ee, A, $), ee.add(ne);
17281 else
17282 for (U = 0; U < j.length; U++)
17283 for (ne = j[U], J = U + 1; J < j.length; J++)
17284 le = j[J], ne.getOwner() == le.getOwner() && this.calcRepulsionForce(ne, le);
17285 }, P.prototype.calcGravitationalForces = function() {
17286 for (var A, $ = this.getAllNodesToApplyGravitation(), U = 0; U < $.length; U++)
17287 A = $[U], this.calcGravitationalForce(A);
17288 }, P.prototype.moveNodes = function() {
17289 for (var A = this.getAllNodes(), $, U = 0; U < A.length; U++)
17290 $ = A[U], $.move();
17291 }, P.prototype.calcSpringForce = function(A, $) {
17292 var U = A.getSource(), J = A.getTarget(), ne, le, j, ee;
17293 if (this.uniformLeafNodeSizes && U.getChild() == null && J.getChild() == null)
17294 A.updateLengthSimple();
17295 else if (A.updateLength(), A.isOverlapingSourceAndTarget)
17296 return;
17297 ne = A.getLength(), ne != 0 && (le = this.springConstant * (ne - $), j = le * (A.lengthX / ne), ee = le * (A.lengthY / ne), U.springForceX += j, U.springForceY += ee, J.springForceX -= j, J.springForceY -= ee);
17298 }, P.prototype.calcRepulsionForce = function(A, $) {
17299 var U = A.getRect(), J = $.getRect(), ne = new Array(2), le = new Array(4), j, ee, H, te, S, V, R;
17300 if (U.intersects(J)) {
17301 z.calcSeparationAmount(U, J, ne, x.DEFAULT_EDGE_LENGTH / 2), V = 2 * ne[0], R = 2 * ne[1];
17302 var q = A.noOfChildren * $.noOfChildren / (A.noOfChildren + $.noOfChildren);
17303 A.repulsionForceX -= q * V, A.repulsionForceY -= q * R, $.repulsionForceX += q * V, $.repulsionForceY += q * R;
17304 } else
17305 this.uniformLeafNodeSizes && A.getChild() == null && $.getChild() == null ? (j = J.getCenterX() - U.getCenterX(), ee = J.getCenterY() - U.getCenterY()) : (z.getIntersection(U, J, le), j = le[2] - le[0], ee = le[3] - le[1]), Math.abs(j) < x.MIN_REPULSION_DIST && (j = Y.sign(j) * x.MIN_REPULSION_DIST), Math.abs(ee) < x.MIN_REPULSION_DIST && (ee = Y.sign(ee) * x.MIN_REPULSION_DIST), H = j * j + ee * ee, te = Math.sqrt(H), S = this.repulsionConstant * A.noOfChildren * $.noOfChildren / H, V = S * j / te, R = S * ee / te, A.repulsionForceX -= V, A.repulsionForceY -= R, $.repulsionForceX += V, $.repulsionForceY += R;
17306 }, P.prototype.calcGravitationalForce = function(A) {
17307 var $, U, J, ne, le, j, ee, H;
17308 $ = A.getOwner(), U = ($.getRight() + $.getLeft()) / 2, J = ($.getTop() + $.getBottom()) / 2, ne = A.getCenterX() - U, le = A.getCenterY() - J, j = Math.abs(ne) + A.getWidth() / 2, ee = Math.abs(le) + A.getHeight() / 2, A.getOwner() == this.graphManager.getRoot() ? (H = $.getEstimatedSize() * this.gravityRangeFactor, (j > H || ee > H) && (A.gravitationForceX = -this.gravityConstant * ne, A.gravitationForceY = -this.gravityConstant * le)) : (H = $.getEstimatedSize() * this.compoundGravityRangeFactor, (j > H || ee > H) && (A.gravitationForceX = -this.gravityConstant * ne * this.compoundGravityConstant, A.gravitationForceY = -this.gravityConstant * le * this.compoundGravityConstant));
17309 }, P.prototype.isConverged = function() {
17310 var A, $ = !1;
17311 return this.totalIterations > this.maxIterations / 3 && ($ = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), A = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, A || $;
17312 }, P.prototype.animate = function() {
17313 this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++);
17314 }, P.prototype.calcNoOfChildrenForAllNodes = function() {
17315 for (var A, $ = this.graphManager.getAllNodes(), U = 0; U < $.length; U++)
17316 A = $[U], A.noOfChildren = A.getNoOfChildren();
17317 }, P.prototype.calcGrid = function(A) {
17318 var $ = 0, U = 0;
17319 $ = parseInt(Math.ceil((A.getRight() - A.getLeft()) / this.repulsionRange)), U = parseInt(Math.ceil((A.getBottom() - A.getTop()) / this.repulsionRange));
17320 for (var J = new Array($), ne = 0; ne < $; ne++)
17321 J[ne] = new Array(U);
17322 for (var ne = 0; ne < $; ne++)
17323 for (var le = 0; le < U; le++)
17324 J[ne][le] = new Array();
17325 return J;
17326 }, P.prototype.addNodeToGrid = function(A, $, U) {
17327 var J = 0, ne = 0, le = 0, j = 0;
17328 J = parseInt(Math.floor((A.getRect().x - $) / this.repulsionRange)), ne = parseInt(Math.floor((A.getRect().width + A.getRect().x - $) / this.repulsionRange)), le = parseInt(Math.floor((A.getRect().y - U) / this.repulsionRange)), j = parseInt(Math.floor((A.getRect().height + A.getRect().y - U) / this.repulsionRange));
17329 for (var ee = J; ee <= ne; ee++)
17330 for (var H = le; H <= j; H++)
17331 this.grid[ee][H].push(A), A.setGridCoordinates(J, ne, le, j);
17332 }, P.prototype.updateGrid = function() {
17333 var A, $, U = this.getAllNodes();
17334 for (this.grid = this.calcGrid(this.graphManager.getRoot()), A = 0; A < U.length; A++)
17335 $ = U[A], this.addNodeToGrid($, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop());
17336 }, P.prototype.calculateRepulsionForceOfANode = function(A, $, U, J) {
17337 if (this.totalIterations % x.GRID_CALCULATION_CHECK_PERIOD == 1 && U || J) {
17338 var ne = /* @__PURE__ */ new Set();
17339 A.surrounding = new Array();
17340 for (var le, j = this.grid, ee = A.startX - 1; ee < A.finishX + 2; ee++)
17341 for (var H = A.startY - 1; H < A.finishY + 2; H++)
17342 if (!(ee < 0 || H < 0 || ee >= j.length || H >= j[0].length)) {
17343 for (var te = 0; te < j[ee][H].length; te++)
17344 if (le = j[ee][H][te], !(A.getOwner() != le.getOwner() || A == le) && !$.has(le) && !ne.has(le)) {
17345 var S = Math.abs(A.getCenterX() - le.getCenterX()) - (A.getWidth() / 2 + le.getWidth() / 2), V = Math.abs(A.getCenterY() - le.getCenterY()) - (A.getHeight() / 2 + le.getHeight() / 2);
17346 S <= this.repulsionRange && V <= this.repulsionRange && ne.add(le);
17347 }
17348 }
17349 A.surrounding = [].concat(C(ne));
17350 }
17351 for (ee = 0; ee < A.surrounding.length; ee++)
17352 this.calcRepulsionForce(A, A.surrounding[ee]);
17353 }, P.prototype.calcRepulsionRange = function() {
17354 return 0;
17355 }, _.exports = P;
17356 },
17357 /* 19 */
17358 /***/
17359 function(_, fe, Q) {
17360 var C = Q(1), T = Q(7);
17361 function x(z, Y, P) {
17362 C.call(this, z, Y, P), this.idealLength = T.DEFAULT_EDGE_LENGTH;
17363 }
17364 x.prototype = Object.create(C.prototype);
17365 for (var I in C)
17366 x[I] = C[I];
17367 _.exports = x;
17368 },
17369 /* 20 */
17370 /***/
17371 function(_, fe, Q) {
17372 var C = Q(3);
17373 function T(I, z, Y, P) {
17374 C.call(this, I, z, Y, 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 = [];
17375 }
17376 T.prototype = Object.create(C.prototype);
17377 for (var x in C)
17378 T[x] = C[x];
17379 T.prototype.setGridCoordinates = function(I, z, Y, P) {
17380 this.startX = I, this.finishX = z, this.startY = Y, this.finishY = P;
17381 }, _.exports = T;
17382 },
17383 /* 21 */
17384 /***/
17385 function(_, fe, Q) {
17386 function C(T, x) {
17387 this.width = 0, this.height = 0, T !== null && x !== null && (this.height = x, this.width = T);
17388 }
17389 C.prototype.getWidth = function() {
17390 return this.width;
17391 }, C.prototype.setWidth = function(T) {
17392 this.width = T;
17393 }, C.prototype.getHeight = function() {
17394 return this.height;
17395 }, C.prototype.setHeight = function(T) {
17396 this.height = T;
17397 }, _.exports = C;
17398 },
17399 /* 22 */
17400 /***/
17401 function(_, fe, Q) {
17402 var C = Q(14);
17403 function T() {
17404 this.map = {}, this.keys = [];
17405 }
17406 T.prototype.put = function(x, I) {
17407 var z = C.createID(x);
17408 this.contains(z) || (this.map[z] = I, this.keys.push(x));
17409 }, T.prototype.contains = function(x) {
17410 return C.createID(x), this.map[x] != null;
17411 }, T.prototype.get = function(x) {
17412 var I = C.createID(x);
17413 return this.map[I];
17414 }, T.prototype.keySet = function() {
17415 return this.keys;
17416 }, _.exports = T;
17417 },
17418 /* 23 */
17419 /***/
17420 function(_, fe, Q) {
17421 var C = Q(14);
17422 function T() {
17423 this.set = {};
17424 }
17425 T.prototype.add = function(x) {
17426 var I = C.createID(x);
17427 this.contains(I) || (this.set[I] = x);
17428 }, T.prototype.remove = function(x) {
17429 delete this.set[C.createID(x)];
17430 }, T.prototype.clear = function() {
17431 this.set = {};
17432 }, T.prototype.contains = function(x) {
17433 return this.set[C.createID(x)] == x;
17434 }, T.prototype.isEmpty = function() {
17435 return this.size() === 0;
17436 }, T.prototype.size = function() {
17437 return Object.keys(this.set).length;
17438 }, T.prototype.addAllTo = function(x) {
17439 for (var I = Object.keys(this.set), z = I.length, Y = 0; Y < z; Y++)
17440 x.push(this.set[I[Y]]);
17441 }, T.prototype.size = function() {
17442 return Object.keys(this.set).length;
17443 }, T.prototype.addAll = function(x) {
17444 for (var I = x.length, z = 0; z < I; z++) {
17445 var Y = x[z];
17446 this.add(Y);
17447 }
17448 }, _.exports = T;
17449 },
17450 /* 24 */
17451 /***/
17452 function(_, fe, Q) {
17453 var C = function() {
17454 function z(Y, P) {
17455 for (var Z = 0; Z < P.length; Z++) {
17456 var A = P[Z];
17457 A.enumerable = A.enumerable || !1, A.configurable = !0, "value" in A && (A.writable = !0), Object.defineProperty(Y, A.key, A);
17458 }
17459 }
17460 return function(Y, P, Z) {
17461 return P && z(Y.prototype, P), Z && z(Y, Z), Y;
17462 };
17463 }();
17464 function T(z, Y) {
17465 if (!(z instanceof Y))
17466 throw new TypeError("Cannot call a class as a function");
17467 }
17468 var x = Q(11), I = function() {
17469 function z(Y, P) {
17470 T(this, z), (P !== null || P !== void 0) && (this.compareFunction = this._defaultCompareFunction);
17471 var Z = void 0;
17472 Y instanceof x ? Z = Y.size() : Z = Y.length, this._quicksort(Y, 0, Z - 1);
17473 }
17474 return C(z, [{
17475 key: "_quicksort",
17476 value: function(P, Z, A) {
17477 if (Z < A) {
17478 var $ = this._partition(P, Z, A);
17479 this._quicksort(P, Z, $), this._quicksort(P, $ + 1, A);
17480 }
17481 }
17482 }, {
17483 key: "_partition",
17484 value: function(P, Z, A) {
17485 for (var $ = this._get(P, Z), U = Z, J = A; ; ) {
17486 for (; this.compareFunction($, this._get(P, J)); )
17487 J--;
17488 for (; this.compareFunction(this._get(P, U), $); )
17489 U++;
17490 if (U < J)
17491 this._swap(P, U, J), U++, J--;
17492 else
17493 return J;
17494 }
17495 }
17496 }, {
17497 key: "_get",
17498 value: function(P, Z) {
17499 return P instanceof x ? P.get_object_at(Z) : P[Z];
17500 }
17501 }, {
17502 key: "_set",
17503 value: function(P, Z, A) {
17504 P instanceof x ? P.set_object_at(Z, A) : P[Z] = A;
17505 }
17506 }, {
17507 key: "_swap",
17508 value: function(P, Z, A) {
17509 var $ = this._get(P, Z);
17510 this._set(P, Z, this._get(P, A)), this._set(P, A, $);
17511 }
17512 }, {
17513 key: "_defaultCompareFunction",
17514 value: function(P, Z) {
17515 return Z > P;
17516 }
17517 }]), z;
17518 }();
17519 _.exports = I;
17520 },
17521 /* 25 */
17522 /***/
17523 function(_, fe, Q) {
17524 var C = function() {
17525 function I(z, Y) {
17526 for (var P = 0; P < Y.length; P++) {
17527 var Z = Y[P];
17528 Z.enumerable = Z.enumerable || !1, Z.configurable = !0, "value" in Z && (Z.writable = !0), Object.defineProperty(z, Z.key, Z);
17529 }
17530 }
17531 return function(z, Y, P) {
17532 return Y && I(z.prototype, Y), P && I(z, P), z;
17533 };
17534 }();
17535 function T(I, z) {
17536 if (!(I instanceof z))
17537 throw new TypeError("Cannot call a class as a function");
17538 }
17539 var x = function() {
17540 function I(z, Y) {
17541 var P = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, Z = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, A = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1;
17542 T(this, I), this.sequence1 = z, this.sequence2 = Y, this.match_score = P, this.mismatch_penalty = Z, this.gap_penalty = A, this.iMax = z.length + 1, this.jMax = Y.length + 1, this.grid = new Array(this.iMax);
17543 for (var $ = 0; $ < this.iMax; $++) {
17544 this.grid[$] = new Array(this.jMax);
17545 for (var U = 0; U < this.jMax; U++)
17546 this.grid[$][U] = 0;
17547 }
17548 this.tracebackGrid = new Array(this.iMax);
17549 for (var J = 0; J < this.iMax; J++) {
17550 this.tracebackGrid[J] = new Array(this.jMax);
17551 for (var ne = 0; ne < this.jMax; ne++)
17552 this.tracebackGrid[J][ne] = [null, null, null];
17553 }
17554 this.alignments = [], this.score = -1, this.computeGrids();
17555 }
17556 return C(I, [{
17557 key: "getScore",
17558 value: function() {
17559 return this.score;
17560 }
17561 }, {
17562 key: "getAlignments",
17563 value: function() {
17564 return this.alignments;
17565 }
17566 // Main dynamic programming procedure
17567 }, {
17568 key: "computeGrids",
17569 value: function() {
17570 for (var Y = 1; Y < this.jMax; Y++)
17571 this.grid[0][Y] = this.grid[0][Y - 1] + this.gap_penalty, this.tracebackGrid[0][Y] = [!1, !1, !0];
17572 for (var P = 1; P < this.iMax; P++)
17573 this.grid[P][0] = this.grid[P - 1][0] + this.gap_penalty, this.tracebackGrid[P][0] = [!1, !0, !1];
17574 for (var Z = 1; Z < this.iMax; Z++)
17575 for (var A = 1; A < this.jMax; A++) {
17576 var $ = void 0;
17577 this.sequence1[Z - 1] === this.sequence2[A - 1] ? $ = this.grid[Z - 1][A - 1] + this.match_score : $ = this.grid[Z - 1][A - 1] + this.mismatch_penalty;
17578 var U = this.grid[Z - 1][A] + this.gap_penalty, J = this.grid[Z][A - 1] + this.gap_penalty, ne = [$, U, J], le = this.arrayAllMaxIndexes(ne);
17579 this.grid[Z][A] = ne[le[0]], this.tracebackGrid[Z][A] = [le.includes(0), le.includes(1), le.includes(2)];
17580 }
17581 this.score = this.grid[this.iMax - 1][this.jMax - 1];
17582 }
17583 // Gets all possible valid sequence combinations
17584 }, {
17585 key: "alignmentTraceback",
17586 value: function() {
17587 var Y = [];
17588 for (Y.push({
17589 pos: [this.sequence1.length, this.sequence2.length],
17590 seq1: "",
17591 seq2: ""
17592 }); Y[0]; ) {
17593 var P = Y[0], Z = this.tracebackGrid[P.pos[0]][P.pos[1]];
17594 Z[0] && Y.push({
17595 pos: [P.pos[0] - 1, P.pos[1] - 1],
17596 seq1: this.sequence1[P.pos[0] - 1] + P.seq1,
17597 seq2: this.sequence2[P.pos[1] - 1] + P.seq2
17598 }), Z[1] && Y.push({
17599 pos: [P.pos[0] - 1, P.pos[1]],
17600 seq1: this.sequence1[P.pos[0] - 1] + P.seq1,
17601 seq2: "-" + P.seq2
17602 }), Z[2] && Y.push({
17603 pos: [P.pos[0], P.pos[1] - 1],
17604 seq1: "-" + P.seq1,
17605 seq2: this.sequence2[P.pos[1] - 1] + P.seq2
17606 }), P.pos[0] === 0 && P.pos[1] === 0 && this.alignments.push({
17607 sequence1: P.seq1,
17608 sequence2: P.seq2
17609 }), Y.shift();
17610 }
17611 return this.alignments;
17612 }
17613 // Helper Functions
17614 }, {
17615 key: "getAllIndexes",
17616 value: function(Y, P) {
17617 for (var Z = [], A = -1; (A = Y.indexOf(P, A + 1)) !== -1; )
17618 Z.push(A);
17619 return Z;
17620 }
17621 }, {
17622 key: "arrayAllMaxIndexes",
17623 value: function(Y) {
17624 return this.getAllIndexes(Y, Math.max.apply(null, Y));
17625 }
17626 }]), I;
17627 }();
17628 _.exports = x;
17629 },
17630 /* 26 */
17631 /***/
17632 function(_, fe, Q) {
17633 var C = function() {
17634 };
17635 C.FDLayout = Q(18), C.FDLayoutConstants = Q(7), C.FDLayoutEdge = Q(19), C.FDLayoutNode = Q(20), C.DimensionD = Q(21), C.HashMap = Q(22), C.HashSet = Q(23), C.IGeometry = Q(8), C.IMath = Q(9), C.Integer = Q(10), C.Point = Q(12), C.PointD = Q(4), C.RandomSeed = Q(16), C.RectangleD = Q(13), C.Transform = Q(17), C.UniqueIDGeneretor = Q(14), C.Quicksort = Q(24), C.LinkedList = Q(11), C.LGraphObject = Q(2), C.LGraph = Q(5), C.LEdge = Q(1), C.LGraphManager = Q(6), C.LNode = Q(3), C.Layout = Q(15), C.LayoutConstants = Q(0), C.NeedlemanWunsch = Q(25), _.exports = C;
17636 },
17637 /* 27 */
17638 /***/
17639 function(_, fe, Q) {
17640 function C() {
17641 this.listeners = [];
17642 }
17643 var T = C.prototype;
17644 T.addListener = function(x, I) {
17645 this.listeners.push({
17646 event: x,
17647 callback: I
17648 });
17649 }, T.removeListener = function(x, I) {
17650 for (var z = this.listeners.length; z >= 0; z--) {
17651 var Y = this.listeners[z];
17652 Y.event === x && Y.callback === I && this.listeners.splice(z, 1);
17653 }
17654 }, T.emit = function(x, I) {
17655 for (var z = 0; z < this.listeners.length; z++) {
17656 var Y = this.listeners[z];
17657 x === Y.event && Y.callback(I);
17658 }
17659 }, _.exports = C;
17660 }
17661 /******/
17662 ])
17663 );
17664 });
17665 }(Zi)), Zi.exports;
17666}
17667var Ul;
17668function zp() {
17669 return Ul || (Ul = 1, function(de, Pe) {
17670 (function(fe, Q) {
17671 de.exports = Q(Gp());
17672 })(Ca, function(_) {
17673 return (
17674 /******/
17675 function(fe) {
17676 var Q = {};
17677 function C(T) {
17678 if (Q[T])
17679 return Q[T].exports;
17680 var x = Q[T] = {
17681 /******/
17682 i: T,
17683 /******/
17684 l: !1,
17685 /******/
17686 exports: {}
17687 /******/
17688 };
17689 return fe[T].call(x.exports, x, x.exports, C), x.l = !0, x.exports;
17690 }
17691 return C.m = fe, C.c = Q, C.i = function(T) {
17692 return T;
17693 }, C.d = function(T, x, I) {
17694 C.o(T, x) || Object.defineProperty(T, x, {
17695 /******/
17696 configurable: !1,
17697 /******/
17698 enumerable: !0,
17699 /******/
17700 get: I
17701 /******/
17702 });
17703 }, C.n = function(T) {
17704 var x = T && T.__esModule ? (
17705 /******/
17706 function() {
17707 return T.default;
17708 }
17709 ) : (
17710 /******/
17711 function() {
17712 return T;
17713 }
17714 );
17715 return C.d(x, "a", x), x;
17716 }, C.o = function(T, x) {
17717 return Object.prototype.hasOwnProperty.call(T, x);
17718 }, C.p = "", C(C.s = 7);
17719 }([
17720 /* 0 */
17721 /***/
17722 function(fe, Q) {
17723 fe.exports = _;
17724 },
17725 /* 1 */
17726 /***/
17727 function(fe, Q, C) {
17728 var T = C(0).FDLayoutConstants;
17729 function x() {
17730 }
17731 for (var I in T)
17732 x[I] = T[I];
17733 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, fe.exports = x;
17734 },
17735 /* 2 */
17736 /***/
17737 function(fe, Q, C) {
17738 var T = C(0).FDLayoutEdge;
17739 function x(z, Y, P) {
17740 T.call(this, z, Y, P);
17741 }
17742 x.prototype = Object.create(T.prototype);
17743 for (var I in T)
17744 x[I] = T[I];
17745 fe.exports = x;
17746 },
17747 /* 3 */
17748 /***/
17749 function(fe, Q, C) {
17750 var T = C(0).LGraph;
17751 function x(z, Y, P) {
17752 T.call(this, z, Y, P);
17753 }
17754 x.prototype = Object.create(T.prototype);
17755 for (var I in T)
17756 x[I] = T[I];
17757 fe.exports = x;
17758 },
17759 /* 4 */
17760 /***/
17761 function(fe, Q, C) {
17762 var T = C(0).LGraphManager;
17763 function x(z) {
17764 T.call(this, z);
17765 }
17766 x.prototype = Object.create(T.prototype);
17767 for (var I in T)
17768 x[I] = T[I];
17769 fe.exports = x;
17770 },
17771 /* 5 */
17772 /***/
17773 function(fe, Q, C) {
17774 var T = C(0).FDLayoutNode, x = C(0).IMath;
17775 function I(Y, P, Z, A) {
17776 T.call(this, Y, P, Z, A);
17777 }
17778 I.prototype = Object.create(T.prototype);
17779 for (var z in T)
17780 I[z] = T[z];
17781 I.prototype.move = function() {
17782 var Y = this.graphManager.getLayout();
17783 this.displacementX = Y.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY = Y.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren, Math.abs(this.displacementX) > Y.coolingFactor * Y.maxNodeDisplacement && (this.displacementX = Y.coolingFactor * Y.maxNodeDisplacement * x.sign(this.displacementX)), Math.abs(this.displacementY) > Y.coolingFactor * Y.maxNodeDisplacement && (this.displacementY = Y.coolingFactor * Y.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), Y.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;
17784 }, I.prototype.propogateDisplacementToChildren = function(Y, P) {
17785 for (var Z = this.getChild().getNodes(), A, $ = 0; $ < Z.length; $++)
17786 A = Z[$], A.getChild() == null ? (A.moveBy(Y, P), A.displacementX += Y, A.displacementY += P) : A.propogateDisplacementToChildren(Y, P);
17787 }, I.prototype.setPred1 = function(Y) {
17788 this.pred1 = Y;
17789 }, I.prototype.getPred1 = function() {
17790 return pred1;
17791 }, I.prototype.getPred2 = function() {
17792 return pred2;
17793 }, I.prototype.setNext = function(Y) {
17794 this.next = Y;
17795 }, I.prototype.getNext = function() {
17796 return next;
17797 }, I.prototype.setProcessed = function(Y) {
17798 this.processed = Y;
17799 }, I.prototype.isProcessed = function() {
17800 return processed;
17801 }, fe.exports = I;
17802 },
17803 /* 6 */
17804 /***/
17805 function(fe, Q, C) {
17806 var T = C(0).FDLayout, x = C(4), I = C(3), z = C(5), Y = C(2), P = C(1), Z = C(0).FDLayoutConstants, A = C(0).LayoutConstants, $ = C(0).Point, U = C(0).PointD, J = C(0).Layout, ne = C(0).Integer, le = C(0).IGeometry, j = C(0).LGraph, ee = C(0).Transform;
17807 function H() {
17808 T.call(this), this.toBeTiled = {};
17809 }
17810 H.prototype = Object.create(T.prototype);
17811 for (var te in T)
17812 H[te] = T[te];
17813 H.prototype.newGraphManager = function() {
17814 var S = new x(this);
17815 return this.graphManager = S, S;
17816 }, H.prototype.newGraph = function(S) {
17817 return new I(null, this.graphManager, S);
17818 }, H.prototype.newNode = function(S) {
17819 return new z(this.graphManager, S);
17820 }, H.prototype.newEdge = function(S) {
17821 return new Y(null, null, S);
17822 }, H.prototype.initParameters = function() {
17823 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 = Z.DEFAULT_SPRING_STRENGTH, this.repulsionConstant = Z.DEFAULT_REPULSION_STRENGTH, this.gravityConstant = Z.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = Z.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = Z.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = Z.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 / Z.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = Z.CONVERGENCE_CHECK_PERIOD / this.maxIterations, this.coolingAdjuster = 1);
17824 }, H.prototype.layout = function() {
17825 var S = A.DEFAULT_CREATE_BENDS_AS_NEEDED;
17826 return S && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout();
17827 }, H.prototype.classicLayout = function() {
17828 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) {
17829 if (P.TREE_REDUCTION_ON_INCREMENTAL) {
17830 this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
17831 var V = new Set(this.getAllNodes()), R = this.nodesWithGravity.filter(function(pe) {
17832 return V.has(pe);
17833 });
17834 this.graphManager.setAllNodesToApplyGravitation(R);
17835 }
17836 } else {
17837 var S = this.getFlatForest();
17838 if (S.length > 0)
17839 this.positionNodesRadially(S);
17840 else {
17841 this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation();
17842 var V = new Set(this.getAllNodes()), R = this.nodesWithGravity.filter(function(q) {
17843 return V.has(q);
17844 });
17845 this.graphManager.setAllNodesToApplyGravitation(R), this.positionNodesRandomly();
17846 }
17847 }
17848 return this.initSpringEmbedder(), this.runSpringEmbedder(), !0;
17849 }, H.prototype.tick = function() {
17850 if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished)
17851 if (this.prunedNodesAll.length > 0)
17852 this.isTreeGrowing = !0;
17853 else
17854 return !0;
17855 if (this.totalIterations % Z.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) {
17856 if (this.isConverged())
17857 if (this.prunedNodesAll.length > 0)
17858 this.isTreeGrowing = !0;
17859 else
17860 return !0;
17861 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));
17862 }
17863 if (this.isTreeGrowing) {
17864 if (this.growTreeIterations % 10 == 0)
17865 if (this.prunedNodesAll.length > 0) {
17866 this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation();
17867 var S = new Set(this.getAllNodes()), V = this.nodesWithGravity.filter(function(ve) {
17868 return S.has(ve);
17869 });
17870 this.graphManager.setAllNodesToApplyGravitation(V), this.graphManager.updateBounds(), this.updateGrid(), this.coolingFactor = Z.DEFAULT_COOLING_FACTOR_INCREMENTAL;
17871 } else
17872 this.isTreeGrowing = !1, this.isGrowthFinished = !0;
17873 this.growTreeIterations++;
17874 }
17875 if (this.isGrowthFinished) {
17876 if (this.isConverged())
17877 return !0;
17878 this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), this.coolingFactor = Z.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++;
17879 }
17880 var R = !this.isTreeGrowing && !this.isGrowthFinished, q = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished;
17881 return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(R, q), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1;
17882 }, H.prototype.getPositionsData = function() {
17883 for (var S = this.graphManager.getAllNodes(), V = {}, R = 0; R < S.length; R++) {
17884 var q = S[R].rect, ve = S[R].id;
17885 V[ve] = {
17886 id: ve,
17887 x: q.getCenterX(),
17888 y: q.getCenterY(),
17889 w: q.width,
17890 h: q.height
17891 };
17892 }
17893 return V;
17894 }, H.prototype.runSpringEmbedder = function() {
17895 this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod;
17896 var S = !1;
17897 if (Z.ANIMATE === "during")
17898 this.emit("layoutstarted");
17899 else {
17900 for (; !S; )
17901 S = this.tick();
17902 this.graphManager.updateBounds();
17903 }
17904 }, H.prototype.calculateNodesToApplyGravitationTo = function() {
17905 var S = [], V, R = this.graphManager.getGraphs(), q = R.length, ve;
17906 for (ve = 0; ve < q; ve++)
17907 V = R[ve], V.updateConnected(), V.isConnected || (S = S.concat(V.getNodes()));
17908 return S;
17909 }, H.prototype.createBendpoints = function() {
17910 var S = [];
17911 S = S.concat(this.graphManager.getAllEdges());
17912 var V = /* @__PURE__ */ new Set(), R;
17913 for (R = 0; R < S.length; R++) {
17914 var q = S[R];
17915 if (!V.has(q)) {
17916 var ve = q.getSource(), pe = q.getTarget();
17917 if (ve == pe)
17918 q.getBendpoints().push(new U()), q.getBendpoints().push(new U()), this.createDummyNodesForBendpoints(q), V.add(q);
17919 else {
17920 var Ae = [];
17921 if (Ae = Ae.concat(ve.getEdgeListToNode(pe)), Ae = Ae.concat(pe.getEdgeListToNode(ve)), !V.has(Ae[0])) {
17922 if (Ae.length > 1) {
17923 var Ne;
17924 for (Ne = 0; Ne < Ae.length; Ne++) {
17925 var Ye = Ae[Ne];
17926 Ye.getBendpoints().push(new U()), this.createDummyNodesForBendpoints(Ye);
17927 }
17928 }
17929 Ae.forEach(function(at) {
17930 V.add(at);
17931 });
17932 }
17933 }
17934 }
17935 if (V.size == S.length)
17936 break;
17937 }
17938 }, H.prototype.positionNodesRadially = function(S) {
17939 for (var V = new $(0, 0), R = Math.ceil(Math.sqrt(S.length)), q = 0, ve = 0, pe = 0, Ae = new U(0, 0), Ne = 0; Ne < S.length; Ne++) {
17940 Ne % R == 0 && (pe = 0, ve = q, Ne != 0 && (ve += P.DEFAULT_COMPONENT_SEPERATION), q = 0);
17941 var Ye = S[Ne], at = J.findCenterOfTree(Ye);
17942 V.x = pe, V.y = ve, Ae = H.radialLayout(Ye, at, V), Ae.y > q && (q = Math.floor(Ae.y)), pe = Math.floor(Ae.x + P.DEFAULT_COMPONENT_SEPERATION);
17943 }
17944 this.transform(new U(A.WORLD_CENTER_X - Ae.x / 2, A.WORLD_CENTER_Y - Ae.y / 2));
17945 }, H.radialLayout = function(S, V, R) {
17946 var q = Math.max(this.maxDiagonalInTree(S), P.DEFAULT_RADIAL_SEPARATION);
17947 H.branchRadialLayout(V, null, 0, 359, 0, q);
17948 var ve = j.calculateBounds(S), pe = new ee();
17949 pe.setDeviceOrgX(ve.getMinX()), pe.setDeviceOrgY(ve.getMinY()), pe.setWorldOrgX(R.x), pe.setWorldOrgY(R.y);
17950 for (var Ae = 0; Ae < S.length; Ae++) {
17951 var Ne = S[Ae];
17952 Ne.transform(pe);
17953 }
17954 var Ye = new U(ve.getMaxX(), ve.getMaxY());
17955 return pe.inverseTransformPoint(Ye);
17956 }, H.branchRadialLayout = function(S, V, R, q, ve, pe) {
17957 var Ae = (q - R + 1) / 2;
17958 Ae < 0 && (Ae += 180);
17959 var Ne = (Ae + R) % 360, Ye = Ne * le.TWO_PI / 360, at = ve * Math.cos(Ye), dt = ve * Math.sin(Ye);
17960 S.setCenter(at, dt);
17961 var Re = [];
17962 Re = Re.concat(S.getEdges());
17963 var Ve = Re.length;
17964 V != null && Ve--;
17965 for (var Ze = 0, nt = Re.length, ht, it = S.getEdgesBetween(V); it.length > 1; ) {
17966 var tt = it[0];
17967 it.splice(0, 1);
17968 var yt = Re.indexOf(tt);
17969 yt >= 0 && Re.splice(yt, 1), nt--, Ve--;
17970 }
17971 V != null ? ht = (Re.indexOf(it[0]) + 1) % nt : ht = 0;
17972 for (var Et = Math.abs(q - R) / Ve, Pt = ht; Ze != Ve; Pt = ++Pt % nt) {
17973 var gt = Re[Pt].getOtherEnd(S);
17974 if (gt != V) {
17975 var dr = (R + Ze * Et) % 360, qt = (dr + Et) % 360;
17976 H.branchRadialLayout(gt, S, dr, qt, ve + pe, pe), Ze++;
17977 }
17978 }
17979 }, H.maxDiagonalInTree = function(S) {
17980 for (var V = ne.MIN_VALUE, R = 0; R < S.length; R++) {
17981 var q = S[R], ve = q.getDiagonal();
17982 ve > V && (V = ve);
17983 }
17984 return V;
17985 }, H.prototype.calcRepulsionRange = function() {
17986 return 2 * (this.level + 1) * this.idealEdgeLength;
17987 }, H.prototype.groupZeroDegreeMembers = function() {
17988 var S = this, V = {};
17989 this.memberGroups = {}, this.idToDummyNode = {};
17990 for (var R = [], q = this.graphManager.getAllNodes(), ve = 0; ve < q.length; ve++) {
17991 var pe = q[ve], Ae = pe.getParent();
17992 this.getNodeDegreeWithChildren(pe) === 0 && (Ae.id == null || !this.getToBeTiled(Ae)) && R.push(pe);
17993 }
17994 for (var ve = 0; ve < R.length; ve++) {
17995 var pe = R[ve], Ne = pe.getParent().id;
17996 typeof V[Ne] > "u" && (V[Ne] = []), V[Ne] = V[Ne].concat(pe);
17997 }
17998 Object.keys(V).forEach(function(Ye) {
17999 if (V[Ye].length > 1) {
18000 var at = "DummyCompound_" + Ye;
18001 S.memberGroups[at] = V[Ye];
18002 var dt = V[Ye][0].getParent(), Re = new z(S.graphManager);
18003 Re.id = at, Re.paddingLeft = dt.paddingLeft || 0, Re.paddingRight = dt.paddingRight || 0, Re.paddingBottom = dt.paddingBottom || 0, Re.paddingTop = dt.paddingTop || 0, S.idToDummyNode[at] = Re;
18004 var Ve = S.getGraphManager().add(S.newGraph(), Re), Ze = dt.getChild();
18005 Ze.add(Re);
18006 for (var nt = 0; nt < V[Ye].length; nt++) {
18007 var ht = V[Ye][nt];
18008 Ze.remove(ht), Ve.add(ht);
18009 }
18010 }
18011 });
18012 }, H.prototype.clearCompounds = function() {
18013 var S = {}, V = {};
18014 this.performDFSOnCompounds();
18015 for (var R = 0; R < this.compoundOrder.length; R++)
18016 V[this.compoundOrder[R].id] = this.compoundOrder[R], S[this.compoundOrder[R].id] = [].concat(this.compoundOrder[R].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[R].getChild()), this.compoundOrder[R].child = null;
18017 this.graphManager.resetAllNodes(), this.tileCompoundMembers(S, V);
18018 }, H.prototype.clearZeroDegreeMembers = function() {
18019 var S = this, V = this.tiledZeroDegreePack = [];
18020 Object.keys(this.memberGroups).forEach(function(R) {
18021 var q = S.idToDummyNode[R];
18022 V[R] = S.tileNodes(S.memberGroups[R], q.paddingLeft + q.paddingRight), q.rect.width = V[R].width, q.rect.height = V[R].height;
18023 });
18024 }, H.prototype.repopulateCompounds = function() {
18025 for (var S = this.compoundOrder.length - 1; S >= 0; S--) {
18026 var V = this.compoundOrder[S], R = V.id, q = V.paddingLeft, ve = V.paddingTop;
18027 this.adjustLocations(this.tiledMemberPack[R], V.rect.x, V.rect.y, q, ve);
18028 }
18029 }, H.prototype.repopulateZeroDegreeMembers = function() {
18030 var S = this, V = this.tiledZeroDegreePack;
18031 Object.keys(V).forEach(function(R) {
18032 var q = S.idToDummyNode[R], ve = q.paddingLeft, pe = q.paddingTop;
18033 S.adjustLocations(V[R], q.rect.x, q.rect.y, ve, pe);
18034 });
18035 }, H.prototype.getToBeTiled = function(S) {
18036 var V = S.id;
18037 if (this.toBeTiled[V] != null)
18038 return this.toBeTiled[V];
18039 var R = S.getChild();
18040 if (R == null)
18041 return this.toBeTiled[V] = !1, !1;
18042 for (var q = R.getNodes(), ve = 0; ve < q.length; ve++) {
18043 var pe = q[ve];
18044 if (this.getNodeDegree(pe) > 0)
18045 return this.toBeTiled[V] = !1, !1;
18046 if (pe.getChild() == null) {
18047 this.toBeTiled[pe.id] = !1;
18048 continue;
18049 }
18050 if (!this.getToBeTiled(pe))
18051 return this.toBeTiled[V] = !1, !1;
18052 }
18053 return this.toBeTiled[V] = !0, !0;
18054 }, H.prototype.getNodeDegree = function(S) {
18055 S.id;
18056 for (var V = S.getEdges(), R = 0, q = 0; q < V.length; q++) {
18057 var ve = V[q];
18058 ve.getSource().id !== ve.getTarget().id && (R = R + 1);
18059 }
18060 return R;
18061 }, H.prototype.getNodeDegreeWithChildren = function(S) {
18062 var V = this.getNodeDegree(S);
18063 if (S.getChild() == null)
18064 return V;
18065 for (var R = S.getChild().getNodes(), q = 0; q < R.length; q++) {
18066 var ve = R[q];
18067 V += this.getNodeDegreeWithChildren(ve);
18068 }
18069 return V;
18070 }, H.prototype.performDFSOnCompounds = function() {
18071 this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes());
18072 }, H.prototype.fillCompexOrderByDFS = function(S) {
18073 for (var V = 0; V < S.length; V++) {
18074 var R = S[V];
18075 R.getChild() != null && this.fillCompexOrderByDFS(R.getChild().getNodes()), this.getToBeTiled(R) && this.compoundOrder.push(R);
18076 }
18077 }, H.prototype.adjustLocations = function(S, V, R, q, ve) {
18078 V += q, R += ve;
18079 for (var pe = V, Ae = 0; Ae < S.rows.length; Ae++) {
18080 var Ne = S.rows[Ae];
18081 V = pe;
18082 for (var Ye = 0, at = 0; at < Ne.length; at++) {
18083 var dt = Ne[at];
18084 dt.rect.x = V, dt.rect.y = R, V += dt.rect.width + S.horizontalPadding, dt.rect.height > Ye && (Ye = dt.rect.height);
18085 }
18086 R += Ye + S.verticalPadding;
18087 }
18088 }, H.prototype.tileCompoundMembers = function(S, V) {
18089 var R = this;
18090 this.tiledMemberPack = [], Object.keys(S).forEach(function(q) {
18091 var ve = V[q];
18092 R.tiledMemberPack[q] = R.tileNodes(S[q], ve.paddingLeft + ve.paddingRight), ve.rect.width = R.tiledMemberPack[q].width, ve.rect.height = R.tiledMemberPack[q].height;
18093 });
18094 }, H.prototype.tileNodes = function(S, V) {
18095 var R = P.TILING_PADDING_VERTICAL, q = P.TILING_PADDING_HORIZONTAL, ve = {
18096 rows: [],
18097 rowWidth: [],
18098 rowHeight: [],
18099 width: 0,
18100 height: V,
18101 // assume minHeight equals to minWidth
18102 verticalPadding: R,
18103 horizontalPadding: q
18104 };
18105 S.sort(function(Ne, Ye) {
18106 return Ne.rect.width * Ne.rect.height > Ye.rect.width * Ye.rect.height ? -1 : Ne.rect.width * Ne.rect.height < Ye.rect.width * Ye.rect.height ? 1 : 0;
18107 });
18108 for (var pe = 0; pe < S.length; pe++) {
18109 var Ae = S[pe];
18110 ve.rows.length == 0 ? this.insertNodeToRow(ve, Ae, 0, V) : this.canAddHorizontal(ve, Ae.rect.width, Ae.rect.height) ? this.insertNodeToRow(ve, Ae, this.getShortestRowIndex(ve), V) : this.insertNodeToRow(ve, Ae, ve.rows.length, V), this.shiftToLastRow(ve);
18111 }
18112 return ve;
18113 }, H.prototype.insertNodeToRow = function(S, V, R, q) {
18114 var ve = q;
18115 if (R == S.rows.length) {
18116 var pe = [];
18117 S.rows.push(pe), S.rowWidth.push(ve), S.rowHeight.push(0);
18118 }
18119 var Ae = S.rowWidth[R] + V.rect.width;
18120 S.rows[R].length > 0 && (Ae += S.horizontalPadding), S.rowWidth[R] = Ae, S.width < Ae && (S.width = Ae);
18121 var Ne = V.rect.height;
18122 R > 0 && (Ne += S.verticalPadding);
18123 var Ye = 0;
18124 Ne > S.rowHeight[R] && (Ye = S.rowHeight[R], S.rowHeight[R] = Ne, Ye = S.rowHeight[R] - Ye), S.height += Ye, S.rows[R].push(V);
18125 }, H.prototype.getShortestRowIndex = function(S) {
18126 for (var V = -1, R = Number.MAX_VALUE, q = 0; q < S.rows.length; q++)
18127 S.rowWidth[q] < R && (V = q, R = S.rowWidth[q]);
18128 return V;
18129 }, H.prototype.getLongestRowIndex = function(S) {
18130 for (var V = -1, R = Number.MIN_VALUE, q = 0; q < S.rows.length; q++)
18131 S.rowWidth[q] > R && (V = q, R = S.rowWidth[q]);
18132 return V;
18133 }, H.prototype.canAddHorizontal = function(S, V, R) {
18134 var q = this.getShortestRowIndex(S);
18135 if (q < 0)
18136 return !0;
18137 var ve = S.rowWidth[q];
18138 if (ve + S.horizontalPadding + V <= S.width)
18139 return !0;
18140 var pe = 0;
18141 S.rowHeight[q] < R && q > 0 && (pe = R + S.verticalPadding - S.rowHeight[q]);
18142 var Ae;
18143 S.width - ve >= V + S.horizontalPadding ? Ae = (S.height + pe) / (ve + V + S.horizontalPadding) : Ae = (S.height + pe) / S.width, pe = R + S.verticalPadding;
18144 var Ne;
18145 return S.width < V ? Ne = (S.height + pe) / V : Ne = (S.height + pe) / S.width, Ne < 1 && (Ne = 1 / Ne), Ae < 1 && (Ae = 1 / Ae), Ae < Ne;
18146 }, H.prototype.shiftToLastRow = function(S) {
18147 var V = this.getLongestRowIndex(S), R = S.rowWidth.length - 1, q = S.rows[V], ve = q[q.length - 1], pe = ve.width + S.horizontalPadding;
18148 if (S.width - S.rowWidth[R] > pe && V != R) {
18149 q.splice(-1, 1), S.rows[R].push(ve), S.rowWidth[V] = S.rowWidth[V] - pe, S.rowWidth[R] = S.rowWidth[R] + pe, S.width = S.rowWidth[instance.getLongestRowIndex(S)];
18150 for (var Ae = Number.MIN_VALUE, Ne = 0; Ne < q.length; Ne++)
18151 q[Ne].height > Ae && (Ae = q[Ne].height);
18152 V > 0 && (Ae += S.verticalPadding);
18153 var Ye = S.rowHeight[V] + S.rowHeight[R];
18154 S.rowHeight[V] = Ae, S.rowHeight[R] < ve.height + S.verticalPadding && (S.rowHeight[R] = ve.height + S.verticalPadding);
18155 var at = S.rowHeight[V] + S.rowHeight[R];
18156 S.height += at - Ye, this.shiftToLastRow(S);
18157 }
18158 }, H.prototype.tilingPreLayout = function() {
18159 P.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers());
18160 }, H.prototype.tilingPostLayout = function() {
18161 P.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds());
18162 }, H.prototype.reduceTrees = function() {
18163 for (var S = [], V = !0, R; V; ) {
18164 var q = this.graphManager.getAllNodes(), ve = [];
18165 V = !1;
18166 for (var pe = 0; pe < q.length; pe++)
18167 R = q[pe], R.getEdges().length == 1 && !R.getEdges()[0].isInterGraph && R.getChild() == null && (ve.push([R, R.getEdges()[0], R.getOwner()]), V = !0);
18168 if (V == !0) {
18169 for (var Ae = [], Ne = 0; Ne < ve.length; Ne++)
18170 ve[Ne][0].getEdges().length == 1 && (Ae.push(ve[Ne]), ve[Ne][0].getOwner().remove(ve[Ne][0]));
18171 S.push(Ae), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
18172 }
18173 }
18174 this.prunedNodesAll = S;
18175 }, H.prototype.growTree = function(S) {
18176 for (var V = S.length, R = S[V - 1], q, ve = 0; ve < R.length; ve++)
18177 q = R[ve], this.findPlaceforPrunedNode(q), q[2].add(q[0]), q[2].add(q[1], q[1].source, q[1].target);
18178 S.splice(S.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges();
18179 }, H.prototype.findPlaceforPrunedNode = function(S) {
18180 var V, R, q = S[0];
18181 q == S[1].source ? R = S[1].target : R = S[1].source;
18182 var ve = R.startX, pe = R.finishX, Ae = R.startY, Ne = R.finishY, Ye = 0, at = 0, dt = 0, Re = 0, Ve = [Ye, dt, at, Re];
18183 if (Ae > 0)
18184 for (var Ze = ve; Ze <= pe; Ze++)
18185 Ve[0] += this.grid[Ze][Ae - 1].length + this.grid[Ze][Ae].length - 1;
18186 if (pe < this.grid.length - 1)
18187 for (var Ze = Ae; Ze <= Ne; Ze++)
18188 Ve[1] += this.grid[pe + 1][Ze].length + this.grid[pe][Ze].length - 1;
18189 if (Ne < this.grid[0].length - 1)
18190 for (var Ze = ve; Ze <= pe; Ze++)
18191 Ve[2] += this.grid[Ze][Ne + 1].length + this.grid[Ze][Ne].length - 1;
18192 if (ve > 0)
18193 for (var Ze = Ae; Ze <= Ne; Ze++)
18194 Ve[3] += this.grid[ve - 1][Ze].length + this.grid[ve][Ze].length - 1;
18195 for (var nt = ne.MAX_VALUE, ht, it, tt = 0; tt < Ve.length; tt++)
18196 Ve[tt] < nt ? (nt = Ve[tt], ht = 1, it = tt) : Ve[tt] == nt && ht++;
18197 if (ht == 3 && nt == 0)
18198 Ve[0] == 0 && Ve[1] == 0 && Ve[2] == 0 ? V = 1 : Ve[0] == 0 && Ve[1] == 0 && Ve[3] == 0 ? V = 0 : Ve[0] == 0 && Ve[2] == 0 && Ve[3] == 0 ? V = 3 : Ve[1] == 0 && Ve[2] == 0 && Ve[3] == 0 && (V = 2);
18199 else if (ht == 2 && nt == 0) {
18200 var yt = Math.floor(Math.random() * 2);
18201 Ve[0] == 0 && Ve[1] == 0 ? yt == 0 ? V = 0 : V = 1 : Ve[0] == 0 && Ve[2] == 0 ? yt == 0 ? V = 0 : V = 2 : Ve[0] == 0 && Ve[3] == 0 ? yt == 0 ? V = 0 : V = 3 : Ve[1] == 0 && Ve[2] == 0 ? yt == 0 ? V = 1 : V = 2 : Ve[1] == 0 && Ve[3] == 0 ? yt == 0 ? V = 1 : V = 3 : yt == 0 ? V = 2 : V = 3;
18202 } else if (ht == 4 && nt == 0) {
18203 var yt = Math.floor(Math.random() * 4);
18204 V = yt;
18205 } else
18206 V = it;
18207 V == 0 ? q.setCenter(R.getCenterX(), R.getCenterY() - R.getHeight() / 2 - Z.DEFAULT_EDGE_LENGTH - q.getHeight() / 2) : V == 1 ? q.setCenter(R.getCenterX() + R.getWidth() / 2 + Z.DEFAULT_EDGE_LENGTH + q.getWidth() / 2, R.getCenterY()) : V == 2 ? q.setCenter(R.getCenterX(), R.getCenterY() + R.getHeight() / 2 + Z.DEFAULT_EDGE_LENGTH + q.getHeight() / 2) : q.setCenter(R.getCenterX() - R.getWidth() / 2 - Z.DEFAULT_EDGE_LENGTH - q.getWidth() / 2, R.getCenterY());
18208 }, fe.exports = H;
18209 },
18210 /* 7 */
18211 /***/
18212 function(fe, Q, C) {
18213 var T = {};
18214 T.layoutBase = C(0), T.CoSEConstants = C(1), T.CoSEEdge = C(2), T.CoSEGraph = C(3), T.CoSEGraphManager = C(4), T.CoSELayout = C(6), T.CoSENode = C(5), fe.exports = T;
18215 }
18216 /******/
18217 ])
18218 );
18219 });
18220 }(Ki)), Ki.exports;
18221}
18222(function(de, Pe) {
18223 (function(fe, Q) {
18224 de.exports = Q(zp());
18225 })(Ca, function(_) {
18226 return (
18227 /******/
18228 function(fe) {
18229 var Q = {};
18230 function C(T) {
18231 if (Q[T])
18232 return Q[T].exports;
18233 var x = Q[T] = {
18234 /******/
18235 i: T,
18236 /******/
18237 l: !1,
18238 /******/
18239 exports: {}
18240 /******/
18241 };
18242 return fe[T].call(x.exports, x, x.exports, C), x.l = !0, x.exports;
18243 }
18244 return C.m = fe, C.c = Q, C.i = function(T) {
18245 return T;
18246 }, C.d = function(T, x, I) {
18247 C.o(T, x) || Object.defineProperty(T, x, {
18248 /******/
18249 configurable: !1,
18250 /******/
18251 enumerable: !0,
18252 /******/
18253 get: I
18254 /******/
18255 });
18256 }, C.n = function(T) {
18257 var x = T && T.__esModule ? (
18258 /******/
18259 function() {
18260 return T.default;
18261 }
18262 ) : (
18263 /******/
18264 function() {
18265 return T;
18266 }
18267 );
18268 return C.d(x, "a", x), x;
18269 }, C.o = function(T, x) {
18270 return Object.prototype.hasOwnProperty.call(T, x);
18271 }, C.p = "", C(C.s = 1);
18272 }([
18273 /* 0 */
18274 /***/
18275 function(fe, Q) {
18276 fe.exports = _;
18277 },
18278 /* 1 */
18279 /***/
18280 function(fe, Q, C) {
18281 var T = C(0).layoutBase.LayoutConstants, x = C(0).layoutBase.FDLayoutConstants, I = C(0).CoSEConstants, z = C(0).CoSELayout, Y = C(0).CoSENode, P = C(0).layoutBase.PointD, Z = C(0).layoutBase.DimensionD, A = {
18282 // Called on `layoutready`
18283 ready: function() {
18284 },
18285 // Called on `layoutstop`
18286 stop: function() {
18287 },
18288 // 'draft', 'default' or 'proof"
18289 // - 'draft' fast cooling rate
18290 // - 'default' moderate cooling rate
18291 // - "proof" slow cooling rate
18292 quality: "default",
18293 // include labels in node dimensions
18294 nodeDimensionsIncludeLabels: !1,
18295 // number of ticks per frame; higher is faster but more jerky
18296 refresh: 30,
18297 // Whether to fit the network view after when done
18298 fit: !0,
18299 // Padding on fit
18300 padding: 10,
18301 // Whether to enable incremental mode
18302 randomize: !0,
18303 // Node repulsion (non overlapping) multiplier
18304 nodeRepulsion: 4500,
18305 // Ideal edge (non nested) length
18306 idealEdgeLength: 50,
18307 // Divisor to compute edge forces
18308 edgeElasticity: 0.45,
18309 // Nesting factor (multiplier) to compute ideal edge length for nested edges
18310 nestingFactor: 0.1,
18311 // Gravity force (constant)
18312 gravity: 0.25,
18313 // Maximum number of iterations to perform
18314 numIter: 2500,
18315 // For enabling tiling
18316 tile: !0,
18317 // Type of layout animation. The option set is {'during', 'end', false}
18318 animate: "end",
18319 // Duration for animate:end
18320 animationDuration: 500,
18321 // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function)
18322 tilingPaddingVertical: 10,
18323 // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function)
18324 tilingPaddingHorizontal: 10,
18325 // Gravity range (constant) for compounds
18326 gravityRangeCompound: 1.5,
18327 // Gravity force (constant) for compounds
18328 gravityCompound: 1,
18329 // Gravity range (constant)
18330 gravityRange: 3.8,
18331 // Initial cooling factor for incremental layout
18332 initialEnergyOnIncremental: 0.5
18333 };
18334 function $(le, j) {
18335 var ee = {};
18336 for (var H in le)
18337 ee[H] = le[H];
18338 for (var H in j)
18339 ee[H] = j[H];
18340 return ee;
18341 }
18342 function U(le) {
18343 this.options = $(A, le), J(this.options);
18344 }
18345 var J = function(j) {
18346 j.nodeRepulsion != null && (I.DEFAULT_REPULSION_STRENGTH = x.DEFAULT_REPULSION_STRENGTH = j.nodeRepulsion), j.idealEdgeLength != null && (I.DEFAULT_EDGE_LENGTH = x.DEFAULT_EDGE_LENGTH = j.idealEdgeLength), j.edgeElasticity != null && (I.DEFAULT_SPRING_STRENGTH = x.DEFAULT_SPRING_STRENGTH = j.edgeElasticity), j.nestingFactor != null && (I.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = x.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = j.nestingFactor), j.gravity != null && (I.DEFAULT_GRAVITY_STRENGTH = x.DEFAULT_GRAVITY_STRENGTH = j.gravity), j.numIter != null && (I.MAX_ITERATIONS = x.MAX_ITERATIONS = j.numIter), j.gravityRange != null && (I.DEFAULT_GRAVITY_RANGE_FACTOR = x.DEFAULT_GRAVITY_RANGE_FACTOR = j.gravityRange), j.gravityCompound != null && (I.DEFAULT_COMPOUND_GRAVITY_STRENGTH = x.DEFAULT_COMPOUND_GRAVITY_STRENGTH = j.gravityCompound), j.gravityRangeCompound != null && (I.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = x.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = j.gravityRangeCompound), j.initialEnergyOnIncremental != null && (I.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, I.NODE_DIMENSIONS_INCLUDE_LABELS = x.NODE_DIMENSIONS_INCLUDE_LABELS = T.NODE_DIMENSIONS_INCLUDE_LABELS = j.nodeDimensionsIncludeLabels, I.DEFAULT_INCREMENTAL = x.DEFAULT_INCREMENTAL = T.DEFAULT_INCREMENTAL = !j.randomize, I.ANIMATE = x.ANIMATE = T.ANIMATE = j.animate, I.TILE = j.tile, I.TILING_PADDING_VERTICAL = typeof j.tilingPaddingVertical == "function" ? j.tilingPaddingVertical.call() : j.tilingPaddingVertical, I.TILING_PADDING_HORIZONTAL = typeof j.tilingPaddingHorizontal == "function" ? j.tilingPaddingHorizontal.call() : j.tilingPaddingHorizontal;
18347 };
18348 U.prototype.run = function() {
18349 var le, j, ee = this.options;
18350 this.idToLNode = {};
18351 var H = this.layout = new z(), te = this;
18352 te.stopped = !1, this.cy = this.options.cy, this.cy.trigger({ type: "layoutstart", layout: this });
18353 var S = H.newGraphManager();
18354 this.gm = S;
18355 var V = this.options.eles.nodes(), R = this.options.eles.edges();
18356 this.root = S.addRoot(), this.processChildrenList(this.root, this.getTopMostNodes(V), H);
18357 for (var q = 0; q < R.length; q++) {
18358 var ve = R[q], pe = this.idToLNode[ve.data("source")], Ae = this.idToLNode[ve.data("target")];
18359 if (pe !== Ae && pe.getEdgesBetween(Ae).length == 0) {
18360 var Ne = S.add(H.newEdge(), pe, Ae);
18361 Ne.id = ve.id();
18362 }
18363 }
18364 var Ye = function(Re, Ve) {
18365 typeof Re == "number" && (Re = Ve);
18366 var Ze = Re.data("id"), nt = te.idToLNode[Ze];
18367 return {
18368 x: nt.getRect().getCenterX(),
18369 y: nt.getRect().getCenterY()
18370 };
18371 }, at = function dt() {
18372 for (var Re = function() {
18373 ee.fit && ee.cy.fit(ee.eles, ee.padding), le || (le = !0, te.cy.one("layoutready", ee.ready), te.cy.trigger({ type: "layoutready", layout: te }));
18374 }, Ve = te.options.refresh, Ze, nt = 0; nt < Ve && !Ze; nt++)
18375 Ze = te.stopped || te.layout.tick();
18376 if (Ze) {
18377 H.checkLayoutSuccess() && !H.isSubLayout && H.doPostLayout(), H.tilingPostLayout && H.tilingPostLayout(), H.isLayoutFinished = !0, te.options.eles.nodes().positions(Ye), Re(), te.cy.one("layoutstop", te.options.stop), te.cy.trigger({ type: "layoutstop", layout: te }), j && cancelAnimationFrame(j), le = !1;
18378 return;
18379 }
18380 var ht = te.layout.getPositionsData();
18381 ee.eles.nodes().positions(function(it, tt) {
18382 if (typeof it == "number" && (it = tt), !it.isParent()) {
18383 for (var yt = it.id(), Et = ht[yt], Pt = it; Et == null && (Et = ht[Pt.data("parent")] || ht["DummyCompound_" + Pt.data("parent")], ht[yt] = Et, Pt = Pt.parent()[0], Pt != null); )
18384 ;
18385 return Et != null ? {
18386 x: Et.x,
18387 y: Et.y
18388 } : {
18389 x: it.position("x"),
18390 y: it.position("y")
18391 };
18392 }
18393 }), Re(), j = requestAnimationFrame(dt);
18394 };
18395 return H.addListener("layoutstarted", function() {
18396 te.options.animate === "during" && (j = requestAnimationFrame(at));
18397 }), H.runLayout(), this.options.animate !== "during" && (te.options.eles.nodes().not(":parent").layoutPositions(te, te.options, Ye), le = !1), this;
18398 }, U.prototype.getTopMostNodes = function(le) {
18399 for (var j = {}, ee = 0; ee < le.length; ee++)
18400 j[le[ee].id()] = !0;
18401 var H = le.filter(function(te, S) {
18402 typeof te == "number" && (te = S);
18403 for (var V = te.parent()[0]; V != null; ) {
18404 if (j[V.id()])
18405 return !1;
18406 V = V.parent()[0];
18407 }
18408 return !0;
18409 });
18410 return H;
18411 }, U.prototype.processChildrenList = function(le, j, ee) {
18412 for (var H = j.length, te = 0; te < H; te++) {
18413 var S = j[te], V = S.children(), R, q = S.layoutDimensions({
18414 nodeDimensionsIncludeLabels: this.options.nodeDimensionsIncludeLabels
18415 });
18416 if (S.outerWidth() != null && S.outerHeight() != null ? R = le.add(new Y(ee.graphManager, new P(S.position("x") - q.w / 2, S.position("y") - q.h / 2), new Z(parseFloat(q.w), parseFloat(q.h)))) : R = le.add(new Y(this.graphManager)), R.id = S.data("id"), R.paddingLeft = parseInt(S.css("padding")), R.paddingTop = parseInt(S.css("padding")), R.paddingRight = parseInt(S.css("padding")), R.paddingBottom = parseInt(S.css("padding")), this.options.nodeDimensionsIncludeLabels && S.isParent()) {
18417 var ve = S.boundingBox({ includeLabels: !0, includeNodes: !1 }).w, pe = S.boundingBox({ includeLabels: !0, includeNodes: !1 }).h, Ae = S.css("text-halign");
18418 R.labelWidth = ve, R.labelHeight = pe, R.labelPos = Ae;
18419 }
18420 if (this.idToLNode[S.data("id")] = R, isNaN(R.rect.x) && (R.rect.x = 0), isNaN(R.rect.y) && (R.rect.y = 0), V != null && V.length > 0) {
18421 var Ne;
18422 Ne = ee.getGraphManager().add(ee.newGraph(), R), this.processChildrenList(Ne, V, ee);
18423 }
18424 }
18425 }, U.prototype.stop = function() {
18426 return this.stopped = !0, this;
18427 };
18428 var ne = function(j) {
18429 j("layout", "cose-bilkent", U);
18430 };
18431 typeof cytoscape < "u" && ne(cytoscape), fe.exports = ne;
18432 }
18433 /******/
18434 ])
18435 );
18436 });
18437})(Xl);
18438var Vp = Xl.exports;
18439const Up = /* @__PURE__ */ $l(Vp), $p = 12, _p = function(de, Pe, _, fe) {
18440 Pe.append("path").attr("id", "node-" + _.id).attr("class", "node-bkg node-" + de.type2Str(_.type)).attr(
18441 "d",
18442 `M0 ${_.height - 5} v${-_.height + 2 * 5} q0,-5 5,-5 h${_.width - 2 * 5} q5,0 5,5 v${_.height - 5} H0 Z`
18443 ), Pe.append("line").attr("class", "node-line-" + fe).attr("x1", 0).attr("y1", _.height).attr("x2", _.width).attr("y2", _.height);
18444}, Yp = function(de, Pe, _) {
18445 Pe.append("rect").attr("id", "node-" + _.id).attr("class", "node-bkg node-" + de.type2Str(_.type)).attr("height", _.height).attr("width", _.width);
18446}, Hp = function(de, Pe, _) {
18447 const fe = _.width, Q = _.height, C = 0.15 * fe, T = 0.25 * fe, x = 0.35 * fe, I = 0.2 * fe;
18448 Pe.append("path").attr("id", "node-" + _.id).attr("class", "node-bkg node-" + de.type2Str(_.type)).attr(
18449 "d",
18450 `M0 0 a${C},${C} 0 0,1 ${fe * 0.25},${-1 * fe * 0.1}
18451 a${x},${x} 1 0,1 ${fe * 0.4},${-1 * fe * 0.1}
18452 a${T},${T} 1 0,1 ${fe * 0.35},${1 * fe * 0.2}
18453
18454 a${C},${C} 1 0,1 ${fe * 0.15},${1 * Q * 0.35}
18455 a${I},${I} 1 0,1 ${-1 * fe * 0.15},${1 * Q * 0.65}
18456
18457 a${T},${C} 1 0,1 ${-1 * fe * 0.25},${fe * 0.15}
18458 a${x},${x} 1 0,1 ${-1 * fe * 0.5},0
18459 a${C},${C} 1 0,1 ${-1 * fe * 0.25},${-1 * fe * 0.15}
18460
18461 a${C},${C} 1 0,1 ${-1 * fe * 0.1},${-1 * Q * 0.35}
18462 a${I},${I} 1 0,1 ${fe * 0.1},${-1 * Q * 0.65}
18463
18464 H0 V0 Z`
18465 );
18466}, Xp = function(de, Pe, _) {
18467 const fe = _.width, Q = _.height, C = 0.15 * fe;
18468 Pe.append("path").attr("id", "node-" + _.id).attr("class", "node-bkg node-" + de.type2Str(_.type)).attr(
18469 "d",
18470 `M0 0 a${C},${C} 1 0,0 ${fe * 0.25},${-1 * Q * 0.1}
18471 a${C},${C} 1 0,0 ${fe * 0.25},0
18472 a${C},${C} 1 0,0 ${fe * 0.25},0
18473 a${C},${C} 1 0,0 ${fe * 0.25},${1 * Q * 0.1}
18474
18475 a${C},${C} 1 0,0 ${fe * 0.15},${1 * Q * 0.33}
18476 a${C * 0.8},${C * 0.8} 1 0,0 0,${1 * Q * 0.34}
18477 a${C},${C} 1 0,0 ${-1 * fe * 0.15},${1 * Q * 0.33}
18478
18479 a${C},${C} 1 0,0 ${-1 * fe * 0.25},${Q * 0.15}
18480 a${C},${C} 1 0,0 ${-1 * fe * 0.25},0
18481 a${C},${C} 1 0,0 ${-1 * fe * 0.25},0
18482 a${C},${C} 1 0,0 ${-1 * fe * 0.25},${-1 * Q * 0.15}
18483
18484 a${C},${C} 1 0,0 ${-1 * fe * 0.1},${-1 * Q * 0.33}
18485 a${C * 0.8},${C * 0.8} 1 0,0 0,${-1 * Q * 0.34}
18486 a${C},${C} 1 0,0 ${fe * 0.1},${-1 * Q * 0.33}
18487
18488 H0 V0 Z`
18489 );
18490}, Wp = function(de, Pe, _) {
18491 Pe.append("circle").attr("id", "node-" + _.id).attr("class", "node-bkg node-" + de.type2Str(_.type)).attr("r", _.width / 2);
18492};
18493function qp(de, Pe, _, fe, Q) {
18494 return de.insert("polygon", ":first-child").attr(
18495 "points",
18496 fe.map(function(C) {
18497 return C.x + "," + C.y;
18498 }).join(" ")
18499 ).attr("transform", "translate(" + (Q.width - Pe) / 2 + ", " + _ + ")");
18500}
18501const Kp = function(de, Pe, _) {
18502 const fe = _.height, C = fe / 4, T = _.width - _.padding + 2 * C, x = [
18503 { x: C, y: 0 },
18504 { x: T - C, y: 0 },
18505 { x: T, y: -fe / 2 },
18506 { x: T - C, y: -fe },
18507 { x: C, y: -fe },
18508 { x: 0, y: -fe / 2 }
18509 ];
18510 qp(Pe, T, fe, x, _);
18511}, Zp = function(de, Pe, _) {
18512 Pe.append("rect").attr("id", "node-" + _.id).attr("class", "node-bkg node-" + de.type2Str(_.type)).attr("height", _.height).attr("rx", _.padding).attr("ry", _.padding).attr("width", _.width);
18513}, Qp = function(de, Pe, _, fe, Q) {
18514 const C = Q.htmlLabels, T = fe % ($p - 1), x = Pe.append("g");
18515 _.section = T;
18516 let I = "section-" + T;
18517 T < 0 && (I += " section-root"), x.attr("class", (_.class ? _.class + " " : "") + "mindmap-node " + I);
18518 const z = x.append("g"), Y = x.append("g"), P = _.descr.replace(/(<br\/*>)/g, `
18519`);
18520 Tp(Y, P, {
18521 useHtmlLabels: C,
18522 width: _.width,
18523 classes: "mindmap-node-label"
18524 }), C || Y.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle");
18525 const Z = Y.node().getBBox(), [A] = pp(Q.fontSize);
18526 if (_.height = Z.height + A * 1.1 * 0.5 + _.padding, _.width = Z.width + 2 * _.padding, _.icon)
18527 if (_.type === de.nodeType.CIRCLE)
18528 _.height += 50, _.width += 50, x.append("foreignObject").attr("height", "50px").attr("width", _.width).attr("style", "text-align: center;").append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + T + " " + _.icon), Y.attr(
18529 "transform",
18530 "translate(" + _.width / 2 + ", " + (_.height / 2 - 1.5 * _.padding) + ")"
18531 );
18532 else {
18533 _.width += 50;
18534 const $ = _.height;
18535 _.height = Math.max($, 60);
18536 const U = Math.abs(_.height - $);
18537 x.append("foreignObject").attr("width", "60px").attr("height", _.height).attr("style", "text-align: center;margin-top:" + U / 2 + "px;").append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + T + " " + _.icon), Y.attr(
18538 "transform",
18539 "translate(" + (25 + _.width / 2) + ", " + (U / 2 + _.padding / 2) + ")"
18540 );
18541 }
18542 else if (C) {
18543 const $ = (_.width - Z.width) / 2, U = (_.height - Z.height) / 2;
18544 Y.attr("transform", "translate(" + $ + ", " + U + ")");
18545 } else {
18546 const $ = _.width / 2, U = _.padding / 2;
18547 Y.attr("transform", "translate(" + $ + ", " + U + ")");
18548 }
18549 switch (_.type) {
18550 case de.nodeType.DEFAULT:
18551 _p(de, z, _, T);
18552 break;
18553 case de.nodeType.ROUNDED_RECT:
18554 Zp(de, z, _);
18555 break;
18556 case de.nodeType.RECT:
18557 Yp(de, z, _);
18558 break;
18559 case de.nodeType.CIRCLE:
18560 z.attr("transform", "translate(" + _.width / 2 + ", " + +_.height / 2 + ")"), Wp(de, z, _);
18561 break;
18562 case de.nodeType.CLOUD:
18563 Hp(de, z, _);
18564 break;
18565 case de.nodeType.BANG:
18566 Xp(de, z, _);
18567 break;
18568 case de.nodeType.HEXAGON:
18569 Kp(de, z, _);
18570 break;
18571 }
18572 return de.setElementForId(_.id, x), _.height;
18573}, Jp = function(de, Pe) {
18574 const _ = de.getElementById(Pe.id), fe = Pe.x || 0, Q = Pe.y || 0;
18575 _.attr("transform", "translate(" + fe + "," + Q + ")");
18576};
18577Hl.use(Up);
18578function Wl(de, Pe, _, fe, Q) {
18579 Qp(de, Pe, _, fe, Q), _.children && _.children.forEach((C, T) => {
18580 Wl(de, Pe, C, fe < 0 ? T : fe, Q);
18581 });
18582}
18583function jp(de, Pe) {
18584 Pe.edges().map((_, fe) => {
18585 const Q = _.data();
18586 if (_[0]._private.bodyBounds) {
18587 const C = _[0]._private.rscratch;
18588 qr.trace("Edge: ", fe, Q), de.insert("path").attr(
18589 "d",
18590 `M ${C.startX},${C.startY} L ${C.midX},${C.midY} L${C.endX},${C.endY} `
18591 ).attr("class", "edge section-edge-" + Q.section + " edge-depth-" + Q.depth);
18592 }
18593 });
18594}
18595function ql(de, Pe, _, fe) {
18596 Pe.add({
18597 group: "nodes",
18598 data: {
18599 id: de.id.toString(),
18600 labelText: de.descr,
18601 height: de.height,
18602 width: de.width,
18603 level: fe,
18604 nodeId: de.id,
18605 padding: de.padding,
18606 type: de.type
18607 },
18608 position: {
18609 x: de.x,
18610 y: de.y
18611 }
18612 }), de.children && de.children.forEach((Q) => {
18613 ql(Q, Pe, _, fe + 1), Pe.add({
18614 group: "edges",
18615 data: {
18616 id: `${de.id}_${Q.id}`,
18617 source: de.id,
18618 target: Q.id,
18619 depth: fe,
18620 section: Q.section
18621 }
18622 });
18623 });
18624}
18625function ey(de, Pe) {
18626 return new Promise((_) => {
18627 const fe = bp("body").append("div").attr("id", "cy").attr("style", "display:none"), Q = Hl({
18628 container: document.getElementById("cy"),
18629 // container to render in
18630 style: [
18631 {
18632 selector: "edge",
18633 style: {
18634 "curve-style": "bezier"
18635 }
18636 }
18637 ]
18638 });
18639 fe.remove(), ql(de, Q, Pe, 0), Q.nodes().forEach(function(C) {
18640 C.layoutDimensions = () => {
18641 const T = C.data();
18642 return { w: T.width, h: T.height };
18643 };
18644 }), Q.layout({
18645 name: "cose-bilkent",
18646 // @ts-ignore Types for cose-bilkent are not correct?
18647 quality: "proof",
18648 styleEnabled: !1,
18649 animate: !1
18650 }).run(), Q.ready((C) => {
18651 qr.info("Ready", C), _(Q);
18652 });
18653 });
18654}
18655function ty(de, Pe) {
18656 Pe.nodes().map((_, fe) => {
18657 const Q = _.data();
18658 Q.x = _.position().x, Q.y = _.position().y, Jp(de, Q);
18659 const C = de.getElementById(Q.nodeId);
18660 qr.info("Id:", fe, "Position: (", _.position().x, ", ", _.position().y, ")", Q), C.attr(
18661 "transform",
18662 `translate(${_.position().x - Q.width / 2}, ${_.position().y - Q.height / 2})`
18663 ), C.attr("attr", `apa-${fe})`);
18664 });
18665}
18666const ry = async (de, Pe, _, fe) => {
18667 var P, Z;
18668 qr.debug(`Rendering mindmap diagram
18669` + de);
18670 const Q = fe.db, C = Q.getMindmap();
18671 if (!C)
18672 return;
18673 const T = Ji();
18674 T.htmlLabels = !1;
18675 const x = yp(Pe), I = x.append("g");
18676 I.attr("class", "mindmap-edges");
18677 const z = x.append("g");
18678 z.attr("class", "mindmap-nodes"), Wl(Q, z, C, -1, T);
18679 const Y = await ey(C, T);
18680 jp(I, Y), ty(Q, Y), mp(
18681 void 0,
18682 x,
18683 ((P = T.mindmap) == null ? void 0 : P.padding) ?? ti.mindmap.padding,
18684 ((Z = T.mindmap) == null ? void 0 : Z.useMaxWidth) ?? ti.mindmap.useMaxWidth
18685 );
18686}, ay = {
18687 draw: ry
18688}, ny = (de) => {
18689 let Pe = "";
18690 for (let _ = 0; _ < de.THEME_COLOR_LIMIT; _++)
18691 de["lineColor" + _] = de["lineColor" + _] || de["cScaleInv" + _], Ep(de["lineColor" + _]) ? de["lineColor" + _] = wp(de["lineColor" + _], 20) : de["lineColor" + _] = xp(de["lineColor" + _], 20);
18692 for (let _ = 0; _ < de.THEME_COLOR_LIMIT; _++) {
18693 const fe = "" + (17 - 3 * _);
18694 Pe += `
18695 .section-${_ - 1} rect, .section-${_ - 1} path, .section-${_ - 1} circle, .section-${_ - 1} polygon, .section-${_ - 1} path {
18696 fill: ${de["cScale" + _]};
18697 }
18698 .section-${_ - 1} text {
18699 fill: ${de["cScaleLabel" + _]};
18700 }
18701 .node-icon-${_ - 1} {
18702 font-size: 40px;
18703 color: ${de["cScaleLabel" + _]};
18704 }
18705 .section-edge-${_ - 1}{
18706 stroke: ${de["cScale" + _]};
18707 }
18708 .edge-depth-${_ - 1}{
18709 stroke-width: ${fe};
18710 }
18711 .section-${_ - 1} line {
18712 stroke: ${de["cScaleInv" + _]} ;
18713 stroke-width: 3;
18714 }
18715
18716 .disabled, .disabled circle, .disabled text {
18717 fill: lightgray;
18718 }
18719 .disabled text {
18720 fill: #efefef;
18721 }
18722 `;
18723 }
18724 return Pe;
18725}, iy = (de) => `
18726 .edge {
18727 stroke-width: 3;
18728 }
18729 ${ny(de)}
18730 .section-root rect, .section-root path, .section-root circle, .section-root polygon {
18731 fill: ${de.git0};
18732 }
18733 .section-root text {
18734 fill: ${de.gitBranchLabel0};
18735 }
18736 .icon-container {
18737 height:100%;
18738 display: flex;
18739 justify-content: center;
18740 align-items: center;
18741 }
18742 .edge {
18743 fill: none;
18744 }
18745 .mindmap-node-label {
18746 dy: 1em;
18747 alignment-baseline: middle;
18748 text-anchor: middle;
18749 dominant-baseline: middle;
18750 text-align: center;
18751 }
18752`, sy = iy, uy = {
18753 db: Bp,
18754 renderer: ay,
18755 parser: Cp,
18756 styles: sy
18757};
18758export {
18759 uy as diagram
18760};