`), n.body.evidence.length) {
let o = "";
n.body.evidence.forEach((a, i) => {
o += `${typeof a == "object" ? Object.values(a)[0] : a}`, i !== n.body.evidence.length - 1 && (o += ", ");
}), t += `
Evidence:${o}
`;
}
t += `
Comment:${n.body.comment}
`;
}), e.push(`
${t}
`);
}
return e.join(`
`);
}
},
watch: {
annotationEntry: {
deep: !0,
immediate: !0,
handler: function(e, t) {
e !== t && (this.entryIndex = 0, e != null && e.length && this.emitActiveItemChange());
}
},
entry: {
deep: !0,
immediate: !0,
handler: function(e, t) {
e && e !== t && (this.resetSubmission(), this.updatePrevSubmissions());
}
}
},
mounted: function() {
var e;
(e = this.$annotator) == null || e.authenticate(this.userApiKey).then((t) => {
t.name && t.email && t.canUpdate ? (this.creator = t, t.orcid || (this.creator.orcid = "0000-0000-0000-0000"), this.authenticated = !0) : this.errorMessage = "", this.updatePrevSubmissions();
});
}
}, Nu = (e) => (Ci("data-v-52f81058"), e = e(), _i(), e), Ege = {
key: 0,
class: "toggle-button"
}, Oge = { class: "block" }, Fge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("div", { class: "title" }, "Feature Annotations", -1)), Tge = { class: "title-buttons" }, Age = { key: 0 }, Ige = ["href"], Pge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("strong", { class: "sub-title" }, "Previous submissions:", -1)), Lge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("strong", null, "Evidence: ", -1)), Rge = ["href"], Nge = { key: 1 }, Mge = { key: 2 }, Dge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("strong", null, "Comment: ", -1)), Bge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("strong", { class: "sub-title" }, "Suggest changes:", -1)), zge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("strong", null, "Evidence:", -1)), jge = /* @__PURE__ */ Nu(() => /* @__PURE__ */ D("strong", null, "Comment:", -1)), Vge = { class: "sub-title" };
function Hge(e, t, n, r, o, a) {
const i = ua, s = fB, l = Ru, u = oB, c = iS, d = mr, p = ma, h = uQ, f = Eg, v = dQ, m = a$, g = Bo, b = Gve, x = Kve, w = um, k = s$;
return S(), re(k, { class: "main" }, {
default: N(() => [
n.annotationEntry.length > 1 ? (S(), L("div", Ege, [
q(s, {
width: "auto",
trigger: "hover",
teleported: !1
}, {
reference: N(() => [
q(i, {
class: "button",
onClick: a.previous,
disabled: this.entryIndex === 0
}, {
default: N(() => [
Oe(" Previous ")
]),
_: 1
}, 8, ["onClick", "disabled"])
]),
default: N(() => [
D("span", null, ge(a.previousLabel), 1)
]),
_: 1
}),
q(s, {
width: "auto",
trigger: "hover",
teleported: !1
}, {
reference: N(() => [
q(i, {
class: "button",
onClick: a.next,
disabled: this.entryIndex === this.annotationEntry.length - 1
}, {
default: N(() => [
Oe(" Next ")
]),
_: 1
}, 8, ["onClick", "disabled"])
]),
default: N(() => [
D("span", null, ge(a.nextLabel), 1)
]),
_: 1
})
])) : J("", !0),
D("div", Oge, [
q(u, { class: "info-field" }, {
default: N(() => [
Fge,
D("div", Tge, [
q(l, { content: a.updatedCopyContent }, null, 8, ["content"])
])
]),
_: 1
}),
a.entry ? (S(), L(Re, { key: 0 }, [
(S(!0), L(Re, null, mt(e.displayPair, (C, _) => Be((S(), re(u, {
class: "dialog-text",
key: C
}, {
default: N(() => [
D("strong", null, ge(_) + ": ", 1),
Oe(" "),
_ !== "Ontology" ? (S(), L("span", Age, ge(a.entry[C]), 1)) : (S(), L("a", {
key: 1,
href: a.ontologyLink,
target: "_blank"
}, ge(a.entry[C]), 9, Ige))
]),
_: 2
}, 1024)), [
[ht, a.entry[C]]
])), 128)),
e.prevSubs.length > 0 ? (S(), L(Re, { key: 0 }, [
Be(D("div", {
class: "hide",
onClick: t[0] || (t[0] = (C) => e.showSubmissions = !1)
}, [
Oe(" Hide previous submissions "),
q(d, null, {
default: N(() => [
q(c)
]),
_: 1
})
], 512), [
[ht, e.showSubmissions]
]),
Be(D("div", {
class: "hide",
onClick: t[1] || (t[1] = (C) => e.showSubmissions = !0)
}, [
Oe(" Show previous " + ge(e.prevSubs.length) + " submission(s) ", 1),
q(d, null, {
default: N(() => [
q(p)
]),
_: 1
})
], 512), [
[ht, !e.showSubmissions]
]),
e.showSubmissions ? (S(), L(Re, { key: 0 }, [
q(u, { class: "dialog-spacer" }),
q(u, { class: "dialog-text" }, {
default: N(() => [
Pge
]),
_: 1
}),
(S(!0), L(Re, null, mt(e.prevSubs, (C, _) => (S(), L("div", {
class: "entry",
key: _
}, [
C.creator ? (S(), re(u, {
key: 0,
class: "dialog-text"
}, {
default: N(() => [
D("strong", null, ge(a.formatTime(C.created)), 1),
Oe(" " + ge(C.creator.name), 1)
]),
_: 2
}, 1024)) : J("", !0),
q(u, { class: "dialog-text" }, {
default: N(() => [
Lge,
(S(!0), L(Re, null, mt(a.processEvidences(C), ($, O) => (S(), re(u, {
key: $,
class: "dialog-text"
}, {
default: N(() => [
typeof $ == "object" ? (S(), L("a", {
key: 0,
href: Object.values($)[0],
target: "_blank"
}, ge(Object.keys($)[0]), 9, Rge)) : (S(), L("span", Nge, ge($), 1)),
O !== C.body.evidence.length - 1 ? (S(), L("span", Mge, ", ")) : J("", !0)
]),
_: 2
}, 1024))), 128))
]),
_: 2
}, 1024),
q(u, { class: "dialog-text" }, {
default: N(() => [
Dge,
Oe(" " + ge(C.body.comment), 1)
]),
_: 2
}, 1024)
]))), 128))
], 64)) : J("", !0)
], 64)) : J("", !0),
e.authenticated || a.offlineAnnotationEnabled ? (S(), L(Re, { key: 1 }, [
a.isEditable ? (S(), L(Re, { key: 0 }, [
q(u, { class: "dialog-spacer" }),
e.editing ? (S(), L(Re, { key: 1 }, [
q(u, { class: "dialog-text" }, {
default: N(() => [
Bge
]),
_: 1
}),
a.isDeleted ? J("", !0) : (S(), L(Re, { key: 0 }, [
q(u, { class: "dialog-text" }, {
default: N(() => [
zge
]),
_: 1
}),
(S(!0), L(Re, null, mt(e.evidence, (C, _) => (S(), re(u, { key: C }, {
default: N(() => [
q(m, { span: 20 }, {
default: N(() => [
Oe(ge(e.evidence[_]), 1)
]),
_: 2
}, 1024),
q(m, { span: 4 }, {
default: N(() => [
q(d, { class: "standard-icon" }, {
default: N(() => [
q(g, {
onClick: ($) => a.removeEvidence(_)
}, null, 8, ["onClick"])
]),
_: 2
}, 1024)
]),
_: 2
}, 1024)
]),
_: 2
}, 1024))), 128)),
q(u, null, {
default: N(() => [
q(w, {
size: "small",
placeholder: "Enter",
modelValue: e.newEvidence,
"onUpdate:modelValue": t[4] || (t[4] = (C) => e.newEvidence = C),
onChange: t[5] || (t[5] = (C) => a.evidenceEntered(C))
}, {
prepend: N(() => [
q(x, {
teleported: !1,
modelValue: e.evidencePrefix,
"onUpdate:modelValue": t[3] || (t[3] = (C) => e.evidencePrefix = C),
placeholder: "Other:",
class: "select-box",
"popper-class": "flatmap_dropdown"
}, {
default: N(() => [
(S(!0), L(Re, null, mt(e.evidencePrefixes, (C) => (S(), re(b, {
key: C.label,
value: C.value
}, {
default: N(() => [
q(u, null, {
default: N(() => [
q(m, { span: 12 }, {
default: N(() => [
Oe(ge(C.label), 1)
]),
_: 2
}, 1024)
]),
_: 2
}, 1024)
]),
_: 2
}, 1032, ["value"]))), 128))
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
})
], 64)),
q(u, null, {
default: N(() => [
jge
]),
_: 1
}),
q(u, { class: "dialog-text" }, {
default: N(() => [
q(w, {
type: "textarea",
autosize: { minRows: 2, maxRows: 4 },
placeholder: "Enter",
modelValue: e.comment,
"onUpdate:modelValue": t[6] || (t[6] = (C) => e.comment = C)
}, null, 8, ["modelValue"])
]),
_: 1
}),
q(u, { class: "dialog-text" }, {
default: N(() => [
q(i, {
class: "button",
type: "primary",
plain: "",
onClick: a.submit
}, {
default: N(() => [
Oe(" Submit ")
]),
_: 1
}, 8, ["onClick"])
]),
_: 1
})
], 64)) : (S(), re(u, { key: 0 }, {
default: N(() => [
q(d, { class: "standard-icon" }, {
default: N(() => [
q(h, {
onClick: t[2] || (t[2] = (C) => e.editing = !0)
})
]),
_: 1
}),
a.isDeleted ? (S(), re(d, {
key: 0,
class: "standard-icon"
}, {
default: N(() => [
q(f, { onClick: a.submit }, null, 8, ["onClick"])
]),
_: 1
})) : a.isPositionUpdated ? (S(), re(d, {
key: 1,
class: "standard-icon"
}, {
default: N(() => [
q(v, { onClick: a.submit }, null, 8, ["onClick"])
]),
_: 1
})) : J("", !0)
]),
_: 1
})),
e.errorMessage ? (S(), re(u, {
key: 2,
class: "dialog-text"
}, {
default: N(() => [
D("strong", Vge, ge(e.errorMessage), 1)
]),
_: 1
})) : J("", !0)
], 64)) : J("", !0)
], 64)) : J("", !0)
], 64)) : J("", !0)
])
]),
_: 1
});
}
const Uge = /* @__PURE__ */ wl($ge, [["render", Hge], ["__scopeId", "data-v-52f81058"]]), qge = {
name: "CreateTooltipContent",
components: {
Button: ua,
Col: a$,
Container: i$,
Header: cB,
Input: um,
Main: s$
},
props: {
createData: {
type: Object
}
},
watch: {
"createData.shape": {
handler: function(e, t) {
this.group = e, t !== void 0 && this.$emit("cancel-create");
},
immediate: !0
}
},
computed: {
confirmText: function() {
return this.createData.editingIndex > -1 ? "Edit" : "Confirm";
}
},
data: function() {
return {
group: "default",
region: "",
showPoint: !1
};
},
methods: {
confirm: function() {
this.$emit(
"confirm-create",
{
region: "__annotation/" + this.region,
group: this.group,
shape: this.createData.shape,
editingIndex: this.createData.editingIndex
}
), this.group = this.createData.shape;
},
cancel: function() {
this.$emit("cancel-create");
}
}
}, Kge = (e) => (Ci("data-v-d61c5879"), e = e(), _i(), e), Gge = /* @__PURE__ */ Kge(() => /* @__PURE__ */ D("span", { class: "create-text" }, " Primitives will be created in the __annotation region ", -1));
function Wge(e, t, n, r, o, a) {
const i = cB, s = a$, l = oB, u = um, c = ua, d = s$, p = i$;
return S(), re(p, { class: "create-container" }, {
default: N(() => [
q(i, {
height: "30px",
class: "header"
}, {
default: N(() => [
D("div", null, "Create " + ge(n.createData.shape), 1)
]),
_: 1
}),
q(d, { class: "slides-block" }, {
default: N(() => [
Gge,
Be(q(l, { class: "row" }, {
default: N(() => [
q(s, {
offset: 0,
span: 8
}, {
default: N(() => [
Oe(" Position: ")
]),
_: 1
}),
q(s, {
offset: 0,
span: 16
}, {
default: N(() => [
(S(!0), L(Re, null, mt(n.createData.points, ({ value: h, i: f }) => (S(), re(l, {
key: f,
class: "value"
}, {
default: N(() => [
Oe(ge(f), 1)
]),
_: 2
}, 1024))), 128))
]),
_: 1
})
]),
_: 1
}, 512), [
[ht, e.showPoint]
]),
q(l, { class: "row" }, {
default: N(() => [
q(s, {
offset: 0,
span: 8
}, {
default: N(() => [
Oe(" Region: ")
]),
_: 1
}),
q(s, {
offset: 0,
span: 16
}, {
default: N(() => [
q(u, {
modelValue: e.region,
"onUpdate:modelValue": t[0] || (t[0] = (h) => e.region = h),
placeholder: "__annotation",
size: "small"
}, null, 8, ["modelValue"])
]),
_: 1
})
]),
_: 1
}),
q(l, { class: "row" }, {
default: N(() => [
q(s, {
offset: 0,
span: 8
}, {
default: N(() => [
Oe(" Group: ")
]),
_: 1
}),
q(s, {
offset: 0,
span: 16
}, {
default: N(() => [
q(u, {
modelValue: e.group,
"onUpdate:modelValue": t[1] || (t[1] = (h) => e.group = h),
placeholder: n.createData.shape,
size: "small"
}, null, 8, ["modelValue", "placeholder"])
]),
_: 1
})
]),
_: 1
}),
q(l, null, {
default: N(() => [
q(s, {
offset: 0,
span: 12
}, {
default: N(() => [
q(c, {
type: "primary",
plain: "",
onClick: a.confirm
}, {
default: N(() => [
Oe(ge(a.confirmText), 1)
]),
_: 1
}, 8, ["onClick"])
]),
_: 1
}),
q(s, {
offset: 0,
span: 12
}, {
default: N(() => [
q(c, {
type: "primary",
plain: "",
onClick: a.cancel
}, {
default: N(() => [
Oe(" Cancel ")
]),
_: 1
}, 8, ["onClick"])
]),
_: 1
})
]),
_: 1
})
]),
_: 1
})
]),
_: 1
});
}
const Yge = /* @__PURE__ */ wl(qge, [["render", Wge], ["__scopeId", "data-v-d61c5879"]]);
function cr(e) {
"@babel/helpers - typeof";
return cr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
return typeof t;
} : function(t) {
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
}, cr(e);
}
function c$(e, t) {
if (!(e instanceof t))
throw new TypeError("Cannot call a class as a function");
}
function Xge(e, t) {
for (var n = 0; n < t.length; n++) {
var r = t[n];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
}
}
function d$(e, t, n) {
return t && Xge(e.prototype, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
function gB(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e;
}
function Ta(e, t) {
return Zge(e) || Jge(e, t) || mB(e, t) || Qge();
}
function Zge(e) {
if (Array.isArray(e)) return e;
}
function Jge(e, t) {
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
if (n != null) {
var r = [], o = !0, a = !1, i, s;
try {
for (n = n.call(e); !(o = (i = n.next()).done) && (r.push(i.value), !(t && r.length === t)); o = !0)
;
} catch (l) {
a = !0, s = l;
} finally {
try {
!o && n.return != null && n.return();
} finally {
if (a) throw s;
}
}
return r;
}
}
function mB(e, t) {
if (e) {
if (typeof e == "string") return SO(e, t);
var n = Object.prototype.toString.call(e).slice(8, -1);
if (n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set") return Array.from(e);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return SO(e, t);
}
}
function SO(e, t) {
(t == null || t > e.length) && (t = e.length);
for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n];
return r;
}
function Qge() {
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function yB(e, t) {
var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
if (!n) {
if (Array.isArray(e) || (n = mB(e)) || t) {
n && (e = n);
var r = 0, o = function() {
};
return {
s: o,
n: function() {
return r >= e.length ? {
done: !0
} : {
done: !1,
value: e[r++]
};
},
e: function(l) {
throw l;
},
f: o
};
}
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
var a = !0, i = !1, s;
return {
s: function() {
n = n.call(e);
},
n: function() {
var l = n.next();
return a = l.done, l;
},
e: function(l) {
i = !0, s = l;
},
f: function() {
try {
!a && n.return != null && n.return();
} finally {
if (i) throw s;
}
}
};
}
var ir = typeof window > "u" ? null : window, $O = ir ? ir.navigator : null;
ir && ir.document;
var e0e = cr(""), bB = cr({}), t0e = cr(function() {
}), n0e = typeof HTMLElement > "u" ? "undefined" : cr(HTMLElement), eh = function(e) {
return e && e.instanceString && Nn(e.instanceString) ? e.instanceString() : null;
}, gt = function(e) {
return e != null && cr(e) == e0e;
}, Nn = function(e) {
return e != null && cr(e) === t0e;
}, dn = function(e) {
return !Mo(e) && (Array.isArray ? Array.isArray(e) : e != null && e instanceof Array);
}, Xt = function(e) {
return e != null && cr(e) === bB && !dn(e) && e.constructor === Object;
}, r0e = function(e) {
return e != null && cr(e) === bB;
}, Ze = function(e) {
return e != null && cr(e) === cr(1) && !isNaN(e);
}, o0e = function(e) {
return Ze(e) && Math.floor(e) === e;
}, Dg = function(e) {
if (n0e !== "undefined")
return e != null && e instanceof HTMLElement;
}, Mo = function(e) {
return th(e) || wB(e);
}, th = function(e) {
return eh(e) === "collection" && e._private.single;
}, wB = function(e) {
return eh(e) === "collection" && !e._private.single;
}, p$ = function(e) {
return eh(e) === "core";
}, xB = function(e) {
return eh(e) === "stylesheet";
}, a0e = function(e) {
return eh(e) === "event";
}, ol = function(e) {
return e == null ? !0 : !!(e === "" || e.match(/^\s+$/));
}, i0e = function(e) {
return typeof HTMLElement > "u" ? !1 : e instanceof HTMLElement;
}, s0e = function(e) {
return Xt(e) && Ze(e.x1) && Ze(e.x2) && Ze(e.y1) && Ze(e.y2);
}, l0e = function(e) {
return r0e(e) && Nn(e.then);
}, u0e = function() {
return $O && $O.userAgent.match(/msie|trident|edge/i);
}, of = function(e, t) {
t || (t = function() {
if (arguments.length === 1)
return arguments[0];
if (arguments.length === 0)
return "undefined";
for (var r = [], o = 0; o < arguments.length; o++)
r.push(arguments[o]);
return r.join("$");
});
var n = function r() {
var o = this, a = arguments, i, s = t.apply(o, a), l = r.cache;
return (i = l[s]) || (i = l[s] = e.apply(o, a)), i;
};
return n.cache = {}, n;
}, f$ = of(function(e) {
return e.replace(/([A-Z])/g, function(t) {
return "-" + t.toLowerCase();
});
}), dm = of(function(e) {
return e.replace(/(-\w)/g, function(t) {
return t[1].toUpperCase();
});
}), kB = of(function(e, t) {
return e + t[0].toUpperCase() + t.substring(1);
}, function(e, t) {
return e + "$" + t;
}), EO = function(e) {
return ol(e) ? e : e.charAt(0).toUpperCase() + e.substring(1);
}, lr = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))", c0e = "rgb[a]?\\((" + lr + "[%]?)\\s*,\\s*(" + lr + "[%]?)\\s*,\\s*(" + lr + "[%]?)(?:\\s*,\\s*(" + lr + "))?\\)", d0e = "rgb[a]?\\((?:" + lr + "[%]?)\\s*,\\s*(?:" + lr + "[%]?)\\s*,\\s*(?:" + lr + "[%]?)(?:\\s*,\\s*(?:" + lr + "))?\\)", p0e = "hsl[a]?\\((" + lr + ")\\s*,\\s*(" + lr + "[%])\\s*,\\s*(" + lr + "[%])(?:\\s*,\\s*(" + lr + "))?\\)", f0e = "hsl[a]?\\((?:" + lr + ")\\s*,\\s*(?:" + lr + "[%])\\s*,\\s*(?:" + lr + "[%])(?:\\s*,\\s*(?:" + lr + "))?\\)", h0e = "\\#[0-9a-fA-F]{3}", v0e = "\\#[0-9a-fA-F]{6}", CB = function(e, t) {
return e < t ? -1 : e > t ? 1 : 0;
}, g0e = function(e, t) {
return -1 * CB(e, t);
}, _t = Object.assign != null ? Object.assign.bind(Object) : function(e) {
for (var t = arguments, n = 1; n < t.length; n++) {
var r = t[n];
if (r != null)
for (var o = Object.keys(r), a = 0; a < o.length; a++) {
var i = o[a];
e[i] = r[i];
}
}
return e;
}, m0e = function(e) {
if (!(!(e.length === 4 || e.length === 7) || e[0] !== "#")) {
var t = e.length === 4, n, r, o, a = 16;
return t ? (n = parseInt(e[1] + e[1], a), r = parseInt(e[2] + e[2], a), o = parseInt(e[3] + e[3], a)) : (n = parseInt(e[1] + e[2], a), r = parseInt(e[3] + e[4], a), o = parseInt(e[5] + e[6], a)), [n, r, o];
}
}, y0e = function(e) {
var t, n, r, o, a, i, s, l;
function u(h, f, v) {
return v < 0 && (v += 1), v > 1 && (v -= 1), v < 1 / 6 ? h + (f - h) * 6 * v : v < 1 / 2 ? f : v < 2 / 3 ? h + (f - h) * (2 / 3 - v) * 6 : h;
}
var c = new RegExp("^" + p0e + "$").exec(e);
if (c) {
if (n = parseInt(c[1]), n < 0 ? n = (360 - -1 * n % 360) % 360 : n > 360 && (n = n % 360), n /= 360, r = parseFloat(c[2]), r < 0 || r > 100 || (r = r / 100, o = parseFloat(c[3]), o < 0 || o > 100) || (o = o / 100, a = c[4], a !== void 0 && (a = parseFloat(a), a < 0 || a > 1)))
return;
if (r === 0)
i = s = l = Math.round(o * 255);
else {
var d = o < 0.5 ? o * (1 + r) : o + r - o * r, p = 2 * o - d;
i = Math.round(255 * u(p, d, n + 1 / 3)), s = Math.round(255 * u(p, d, n)), l = Math.round(255 * u(p, d, n - 1 / 3));
}
t = [i, s, l, a];
}
return t;
}, b0e = function(e) {
var t, n = new RegExp("^" + c0e + "$").exec(e);
if (n) {
t = [];
for (var r = [], o = 1; o <= 3; o++) {
var a = n[o];
if (a[a.length - 1] === "%" && (r[o] = !0), a = parseFloat(a), r[o] && (a = a / 100 * 255), a < 0 || a > 255)
return;
t.push(Math.floor(a));
}
var i = r[1] || r[2] || r[3], s = r[1] && r[2] && r[3];
if (i && !s)
return;
var l = n[4];
if (l !== void 0) {
if (l = parseFloat(l), l < 0 || l > 1)
return;
t.push(l);
}
}
return t;
}, w0e = function(e) {
return k0e[e.toLowerCase()];
}, x0e = function(e) {
return (dn(e) ? e : null) || w0e(e) || m0e(e) || b0e(e) || y0e(e);
}, k0e = {
// special colour names
transparent: [0, 0, 0, 0],
// NB alpha === 0
// regular colours
aliceblue: [240, 248, 255],
antiquewhite: [250, 235, 215],
aqua: [0, 255, 255],
aquamarine: [127, 255, 212],
azure: [240, 255, 255],
beige: [245, 245, 220],
bisque: [255, 228, 196],
black: [0, 0, 0],
blanchedalmond: [255, 235, 205],
blue: [0, 0, 255],
blueviolet: [138, 43, 226],
brown: [165, 42, 42],
burlywood: [222, 184, 135],
cadetblue: [95, 158, 160],
chartreuse: [127, 255, 0],
chocolate: [210, 105, 30],
coral: [255, 127, 80],
cornflowerblue: [100, 149, 237],
cornsilk: [255, 248, 220],
crimson: [220, 20, 60],
cyan: [0, 255, 255],
darkblue: [0, 0, 139],
darkcyan: [0, 139, 139],
darkgoldenrod: [184, 134, 11],
darkgray: [169, 169, 169],
darkgreen: [0, 100, 0],
darkgrey: [169, 169, 169],
darkkhaki: [189, 183, 107],
darkmagenta: [139, 0, 139],
darkolivegreen: [85, 107, 47],
darkorange: [255, 140, 0],
darkorchid: [153, 50, 204],
darkred: [139, 0, 0],
darksalmon: [233, 150, 122],
darkseagreen: [143, 188, 143],
darkslateblue: [72, 61, 139],
darkslategray: [47, 79, 79],
darkslategrey: [47, 79, 79],
darkturquoise: [0, 206, 209],
darkviolet: [148, 0, 211],
deeppink: [255, 20, 147],
deepskyblue: [0, 191, 255],
dimgray: [105, 105, 105],
dimgrey: [105, 105, 105],
dodgerblue: [30, 144, 255],
firebrick: [178, 34, 34],
floralwhite: [255, 250, 240],
forestgreen: [34, 139, 34],
fuchsia: [255, 0, 255],
gainsboro: [220, 220, 220],
ghostwhite: [248, 248, 255],
gold: [255, 215, 0],
goldenrod: [218, 165, 32],
gray: [128, 128, 128],
grey: [128, 128, 128],
green: [0, 128, 0],
greenyellow: [173, 255, 47],
honeydew: [240, 255, 240],
hotpink: [255, 105, 180],
indianred: [205, 92, 92],
indigo: [75, 0, 130],
ivory: [255, 255, 240],
khaki: [240, 230, 140],
lavender: [230, 230, 250],
lavenderblush: [255, 240, 245],
lawngreen: [124, 252, 0],
lemonchiffon: [255, 250, 205],
lightblue: [173, 216, 230],
lightcoral: [240, 128, 128],
lightcyan: [224, 255, 255],
lightgoldenrodyellow: [250, 250, 210],
lightgray: [211, 211, 211],
lightgreen: [144, 238, 144],
lightgrey: [211, 211, 211],
lightpink: [255, 182, 193],
lightsalmon: [255, 160, 122],
lightseagreen: [32, 178, 170],
lightskyblue: [135, 206, 250],
lightslategray: [119, 136, 153],
lightslategrey: [119, 136, 153],
lightsteelblue: [176, 196, 222],
lightyellow: [255, 255, 224],
lime: [0, 255, 0],
limegreen: [50, 205, 50],
linen: [250, 240, 230],
magenta: [255, 0, 255],
maroon: [128, 0, 0],
mediumaquamarine: [102, 205, 170],
mediumblue: [0, 0, 205],
mediumorchid: [186, 85, 211],
mediumpurple: [147, 112, 219],
mediumseagreen: [60, 179, 113],
mediumslateblue: [123, 104, 238],
mediumspringgreen: [0, 250, 154],
mediumturquoise: [72, 209, 204],
mediumvioletred: [199, 21, 133],
midnightblue: [25, 25, 112],
mintcream: [245, 255, 250],
mistyrose: [255, 228, 225],
moccasin: [255, 228, 181],
navajowhite: [255, 222, 173],
navy: [0, 0, 128],
oldlace: [253, 245, 230],
olive: [128, 128, 0],
olivedrab: [107, 142, 35],
orange: [255, 165, 0],
orangered: [255, 69, 0],
orchid: [218, 112, 214],
palegoldenrod: [238, 232, 170],
palegreen: [152, 251, 152],
paleturquoise: [175, 238, 238],
palevioletred: [219, 112, 147],
papayawhip: [255, 239, 213],
peachpuff: [255, 218, 185],
peru: [205, 133, 63],
pink: [255, 192, 203],
plum: [221, 160, 221],
powderblue: [176, 224, 230],
purple: [128, 0, 128],
red: [255, 0, 0],
rosybrown: [188, 143, 143],
royalblue: [65, 105, 225],
saddlebrown: [139, 69, 19],
salmon: [250, 128, 114],
sandybrown: [244, 164, 96],
seagreen: [46, 139, 87],
seashell: [255, 245, 238],
sienna: [160, 82, 45],
silver: [192, 192, 192],
skyblue: [135, 206, 235],
slateblue: [106, 90, 205],
slategray: [112, 128, 144],
slategrey: [112, 128, 144],
snow: [255, 250, 250],
springgreen: [0, 255, 127],
steelblue: [70, 130, 180],
tan: [210, 180, 140],
teal: [0, 128, 128],
thistle: [216, 191, 216],
tomato: [255, 99, 71],
turquoise: [64, 224, 208],
violet: [238, 130, 238],
wheat: [245, 222, 179],
white: [255, 255, 255],
whitesmoke: [245, 245, 245],
yellow: [255, 255, 0],
yellowgreen: [154, 205, 50]
}, _B = function(e) {
for (var t = e.map, n = e.keys, r = n.length, o = 0; o < r; o++) {
var a = n[o];
if (Xt(a))
throw Error("Tried to set map with object key");
o < n.length - 1 ? (t[a] == null && (t[a] = {}), t = t[a]) : t[a] = e.value;
}
}, SB = function(e) {
for (var t = e.map, n = e.keys, r = n.length, o = 0; o < r; o++) {
var a = n[o];
if (Xt(a))
throw Error("Tried to get map with object key");
if (t = t[a], t == null)
return t;
}
return t;
};
function C0e(e) {
var t = typeof e;
return e != null && (t == "object" || t == "function");
}
var du = C0e, mp = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function _0e(e, t) {
return t = { exports: {} }, e(t, t.exports), t.exports;
}
var S0e = typeof mp == "object" && mp && mp.Object === Object && mp, $0e = S0e, E0e = typeof self == "object" && self && self.Object === Object && self, O0e = $0e || E0e || Function("return this")(), pm = O0e, F0e = function() {
return pm.Date.now();
}, cy = F0e, T0e = /\s/;
function A0e(e) {
for (var t = e.length; t-- && T0e.test(e.charAt(t)); )
;
return t;
}
var I0e = A0e, P0e = /^\s+/;
function L0e(e) {
return e && e.slice(0, I0e(e) + 1).replace(P0e, "");
}
var R0e = L0e, N0e = pm.Symbol, Kc = N0e, $B = Object.prototype, M0e = $B.hasOwnProperty, D0e = $B.toString, Qd = Kc ? Kc.toStringTag : void 0;
function B0e(e) {
var t = M0e.call(e, Qd), n = e[Qd];
try {
e[Qd] = void 0;
var r = !0;
} catch {
}
var o = D0e.call(e);
return r && (t ? e[Qd] = n : delete e[Qd]), o;
}
var z0e = B0e, j0e = Object.prototype, V0e = j0e.toString;
function H0e(e) {
return V0e.call(e);
}
var U0e = H0e, q0e = "[object Null]", K0e = "[object Undefined]", OO = Kc ? Kc.toStringTag : void 0;
function G0e(e) {
return e == null ? e === void 0 ? K0e : q0e : OO && OO in Object(e) ? z0e(e) : U0e(e);
}
var EB = G0e;
function W0e(e) {
return e != null && typeof e == "object";
}
var Y0e = W0e, X0e = "[object Symbol]";
function Z0e(e) {
return typeof e == "symbol" || Y0e(e) && EB(e) == X0e;
}
var nh = Z0e, FO = NaN, J0e = /^[-+]0x[0-9a-f]+$/i, Q0e = /^0b[01]+$/i, eme = /^0o[0-7]+$/i, tme = parseInt;
function nme(e) {
if (typeof e == "number")
return e;
if (nh(e))
return FO;
if (du(e)) {
var t = typeof e.valueOf == "function" ? e.valueOf() : e;
e = du(t) ? t + "" : t;
}
if (typeof e != "string")
return e === 0 ? e : +e;
e = R0e(e);
var n = Q0e.test(e);
return n || eme.test(e) ? tme(e.slice(2), n ? 2 : 8) : J0e.test(e) ? FO : +e;
}
var TO = nme, rme = "Expected a function", ome = Math.max, ame = Math.min;
function ime(e, t, n) {
var r, o, a, i, s, l, u = 0, c = !1, d = !1, p = !0;
if (typeof e != "function")
throw new TypeError(rme);
t = TO(t) || 0, du(n) && (c = !!n.leading, d = "maxWait" in n, a = d ? ome(TO(n.maxWait) || 0, t) : a, p = "trailing" in n ? !!n.trailing : p);
function h(C) {
var _ = r, $ = o;
return r = o = void 0, u = C, i = e.apply($, _), i;
}
function f(C) {
return u = C, s = setTimeout(g, t), c ? h(C) : i;
}
function v(C) {
var _ = C - l, $ = C - u, O = t - _;
return d ? ame(O, a - $) : O;
}
function m(C) {
var _ = C - l, $ = C - u;
return l === void 0 || _ >= t || _ < 0 || d && $ >= a;
}
function g() {
var C = cy();
if (m(C))
return b(C);
s = setTimeout(g, v(C));
}
function b(C) {
return s = void 0, p && r ? h(C) : (r = o = void 0, i);
}
function x() {
s !== void 0 && clearTimeout(s), u = 0, r = l = o = s = void 0;
}
function w() {
return s === void 0 ? i : b(cy());
}
function k() {
var C = cy(), _ = m(C);
if (r = arguments, o = this, l = C, _) {
if (s === void 0)
return f(l);
if (d)
return clearTimeout(s), s = setTimeout(g, t), h(l);
}
return s === void 0 && (s = setTimeout(g, t)), i;
}
return k.cancel = x, k.flush = w, k;
}
var fm = ime, dy = ir ? ir.performance : null, OB = dy && dy.now ? function() {
return dy.now();
} : function() {
return Date.now();
}, sme = function() {
if (ir) {
if (ir.requestAnimationFrame)
return function(e) {
ir.requestAnimationFrame(e);
};
if (ir.mozRequestAnimationFrame)
return function(e) {
ir.mozRequestAnimationFrame(e);
};
if (ir.webkitRequestAnimationFrame)
return function(e) {
ir.webkitRequestAnimationFrame(e);
};
if (ir.msRequestAnimationFrame)
return function(e) {
ir.msRequestAnimationFrame(e);
};
}
return function(e) {
e && setTimeout(function() {
e(OB());
}, 1e3 / 60);
};
}(), Bg = function(e) {
return sme(e);
}, ns = OB, wc = 9261, FB = 65599, yp = 5381, TB = function(e) {
for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : wc, n = t, r; r = e.next(), !r.done; )
n = n * FB + r.value | 0;
return n;
}, af = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : wc;
return t * FB + e | 0;
}, sf = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : yp;
return (t << 5) + t + e | 0;
}, lme = function(e, t) {
return e * 2097152 + t;
}, _s = function(e) {
return e[0] * 2097152 + e[1];
}, nv = function(e, t) {
return [af(e[0], t[0]), sf(e[1], t[1])];
}, ume = function(e, t) {
var n = {
value: 0,
done: !1
}, r = 0, o = e.length, a = {
next: function() {
return r < o ? n.value = e[r++] : n.done = !0, n;
}
};
return TB(a, t);
}, pu = function(e, t) {
var n = {
value: 0,
done: !1
}, r = 0, o = e.length, a = {
next: function() {
return r < o ? n.value = e.charCodeAt(r++) : n.done = !0, n;
}
};
return TB(a, t);
}, AB = function() {
return cme(arguments);
}, cme = function(e) {
for (var t, n = 0; n < e.length; n++) {
var r = e[n];
n === 0 ? t = pu(r) : t = pu(r, t);
}
return t;
}, AO = !0, dme = console.warn != null, pme = console.trace != null, h$ = Number.MAX_SAFE_INTEGER || 9007199254740991, IB = function() {
return !0;
}, zg = function() {
return !1;
}, IO = function() {
return 0;
}, v$ = function() {
}, Un = function(e) {
throw new Error(e);
}, PB = function(e) {
if (e !== void 0)
AO = !!e;
else
return AO;
}, sn = function(e) {
PB() && (dme ? console.warn(e) : (console.log(e), pme && console.trace()));
}, fme = function(e) {
return _t({}, e);
}, ai = function(e) {
return e == null ? e : dn(e) ? e.slice() : Xt(e) ? fme(e) : e;
}, hme = function(e) {
return e.slice();
}, LB = function(e, t) {
for (
// loop :)
t = e = "";
// b - result , a - numeric letiable
e++ < 36;
//
t += e * 51 & 52 ? (
// return a random number or 4
(e ^ 15 ? (
// generate a random number from 0 to 15
8 ^ Math.random() * (e ^ 20 ? 16 : 4)
) : 4).toString(16)
) : "-"
)
;
return t;
}, vme = {}, RB = function() {
return vme;
}, Br = function(e) {
var t = Object.keys(e);
return function(n) {
for (var r = {}, o = 0; o < t.length; o++) {
var a = t[o], i = n == null ? void 0 : n[a];
r[a] = i === void 0 ? e[a] : i;
}
return r;
};
}, al = function(e, t, n) {
for (var r = e.length - 1; r >= 0; r--)
e[r] === t && e.splice(r, 1);
}, g$ = function(e) {
e.splice(0, e.length);
}, gme = function(e, t) {
for (var n = 0; n < t.length; n++) {
var r = t[n];
e.push(r);
}
}, La = function(e, t, n) {
return n && (t = kB(n, t)), e[t];
}, zs = function(e, t, n, r) {
n && (t = kB(n, t)), e[t] = r;
}, mme = /* @__PURE__ */ function() {
function e() {
c$(this, e), this._obj = {};
}
return d$(e, [{
key: "set",
value: function(t, n) {
return this._obj[t] = n, this;
}
}, {
key: "delete",
value: function(t) {
return this._obj[t] = void 0, this;
}
}, {
key: "clear",
value: function() {
this._obj = {};
}
}, {
key: "has",
value: function(t) {
return this._obj[t] !== void 0;
}
}, {
key: "get",
value: function(t) {
return this._obj[t];
}
}]), e;
}(), ii = typeof Map < "u" ? Map : mme, yme = "undefined", bme = /* @__PURE__ */ function() {
function e(t) {
if (c$(this, e), this._obj = /* @__PURE__ */ Object.create(null), this.size = 0, t != null) {
var n;
t.instanceString != null && t.instanceString() === this.instanceString() ? n = t.toArray() : n = t;
for (var r = 0; r < n.length; r++)
this.add(n[r]);
}
}
return d$(e, [{
key: "instanceString",
value: function() {
return "set";
}
}, {
key: "add",
value: function(t) {
var n = this._obj;
n[t] !== 1 && (n[t] = 1, this.size++);
}
}, {
key: "delete",
value: function(t) {
var n = this._obj;
n[t] === 1 && (n[t] = 0, this.size--);
}
}, {
key: "clear",
value: function() {
this._obj = /* @__PURE__ */ Object.create(null);
}
}, {
key: "has",
value: function(t) {
return this._obj[t] === 1;
}
}, {
key: "toArray",
value: function() {
var t = this;
return Object.keys(this._obj).filter(function(n) {
return t.has(n);
});
}
}, {
key: "forEach",
value: function(t, n) {
return this.toArray().forEach(t, n);
}
}]), e;
}(), gd = (typeof Set > "u" ? "undefined" : cr(Set)) !== yme ? Set : bme, hm = function(e, t) {
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0;
if (e === void 0 || t === void 0 || !p$(e)) {
Un("An element must have a core reference and parameters set");
return;
}
var r = t.group;
if (r == null && (t.data && t.data.source != null && t.data.target != null ? r = "edges" : r = "nodes"), r !== "nodes" && r !== "edges") {
Un("An element must be of type `nodes` or `edges`; you specified `" + r + "`");
return;
}
this.length = 1, this[0] = this;
var o = this._private = {
cy: e,
single: !0,
// indicates this is an element
data: t.data || {},
// data object
position: t.position || {
x: 0,
y: 0
},
// (x, y) position pair
autoWidth: void 0,
// width and height of nodes calculated by the renderer when set to special 'auto' value
autoHeight: void 0,
autoPadding: void 0,
compoundBoundsClean: !1,
// whether the compound dimensions need to be recalculated the next time dimensions are read
listeners: [],
// array of bound listeners
group: r,
// string; 'nodes' or 'edges'
style: {},
// properties as set by the style
rstyle: {},
// properties for style sent from the renderer to the core
styleCxts: [],
// applied style contexts from the styler
styleKeys: {},
// per-group keys of style property values
removed: !0,
// whether it's inside the vis; true if removed (set true here since we call restore)
selected: !!t.selected,
// whether it's selected
selectable: t.selectable === void 0 ? !0 : !!t.selectable,
// whether it's selectable
locked: !!t.locked,
// whether the element is locked (cannot be moved)
grabbed: !1,
// whether the element is grabbed by the mouse; renderer sets this privately
grabbable: t.grabbable === void 0 ? !0 : !!t.grabbable,
// whether the element can be grabbed
pannable: t.pannable === void 0 ? r === "edges" : !!t.pannable,
// whether the element has passthrough panning enabled
active: !1,
// whether the element is active from user interaction
classes: new gd(),
// map ( className => true )
animation: {
// object for currently-running animations
current: [],
queue: []
},
rscratch: {},
// object in which the renderer can store information
scratch: t.scratch || {},
// scratch objects
edges: [],
// array of connected edges
children: [],
// array of children
parent: t.parent && t.parent.isNode() ? t.parent : null,
// parent ref
traversalCache: {},
// cache of output of traversal functions
backgrounding: !1,
// whether background images are loading
bbCache: null,
// cache of the current bounding box
bbCacheShift: {
x: 0,
y: 0
},
// shift applied to cached bb to be applied on next get
bodyBounds: null,
// bounds cache of element body, w/o overlay
overlayBounds: null,
// bounds cache of element body, including overlay
labelBounds: {
// bounds cache of labels
all: null,
source: null,
target: null,
main: null
},
arrowBounds: {
// bounds cache of edge arrows
source: null,
target: null,
"mid-source": null,
"mid-target": null
}
};
if (o.position.x == null && (o.position.x = 0), o.position.y == null && (o.position.y = 0), t.renderedPosition) {
var a = t.renderedPosition, i = e.pan(), s = e.zoom();
o.position = {
x: (a.x - i.x) / s,
y: (a.y - i.y) / s
};
}
var l = [];
dn(t.classes) ? l = t.classes : gt(t.classes) && (l = t.classes.split(/\s+/));
for (var u = 0, c = l.length; u < c; u++) {
var d = l[u];
!d || d === "" || o.classes.add(d);
}
this.createEmitter();
var p = t.style || t.css;
p && (sn("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."), this.style(p)), (n === void 0 || n) && this.restore();
}, PO = function(e) {
return e = {
bfs: e.bfs || !e.dfs,
dfs: e.dfs || !e.bfs
}, function(t, n, r) {
var o;
Xt(t) && !Mo(t) && (o = t, t = o.roots || o.root, n = o.visit, r = o.directed), r = arguments.length === 2 && !Nn(n) ? n : r, n = Nn(n) ? n : function() {
};
for (var a = this._private.cy, i = t = gt(t) ? this.filter(t) : t, s = [], l = [], u = {}, c = {}, d = {}, p = 0, h, f = this.byGroup(), v = f.nodes, m = f.edges, g = 0; g < i.length; g++) {
var b = i[g], x = b.id();
b.isNode() && (s.unshift(b), e.bfs && (d[x] = !0, l.push(b)), c[x] = 0);
}
for (var w = function() {
var F = e.bfs ? s.shift() : s.pop(), A = F.id();
if (e.dfs) {
if (d[A])
return "continue";
d[A] = !0, l.push(F);
}
var T = c[A], R = u[A], M = R != null ? R.source() : null, j = R != null ? R.target() : null, P = R == null ? void 0 : F.same(M) ? j[0] : M[0], V = void 0;
if (V = n(F, R, P, p++, T), V === !0)
return h = F, "break";
if (V === !1)
return "break";
for (var U = F.connectedEdges().filter(function(me) {
return (!r || me.source().same(F)) && m.has(me);
}), G = 0; G < U.length; G++) {
var se = U[G], ae = se.connectedNodes().filter(function(me) {
return !me.same(F) && v.has(me);
}), de = ae.id();
ae.length !== 0 && !d[de] && (ae = ae[0], s.push(ae), e.bfs && (d[de] = !0, l.push(ae)), u[de] = se, c[de] = c[A] + 1);
}
}; s.length !== 0; ) {
var k = w();
if (k !== "continue" && k === "break")
break;
}
for (var C = a.collection(), _ = 0; _ < l.length; _++) {
var $ = l[_], O = u[$.id()];
O != null && C.push(O), C.push($);
}
return {
path: a.collection(C),
found: a.collection(h)
};
};
}, lf = {
breadthFirstSearch: PO({
bfs: !0
}),
depthFirstSearch: PO({
dfs: !0
})
};
lf.bfs = lf.breadthFirstSearch;
lf.dfs = lf.depthFirstSearch;
var wme = _0e(function(e, t) {
(function() {
var n, r, o, a, i, s, l, u, c, d, p, h, f, v, m;
o = Math.floor, d = Math.min, r = function(g, b) {
return g < b ? -1 : g > b ? 1 : 0;
}, c = function(g, b, x, w, k) {
var C;
if (x == null && (x = 0), k == null && (k = r), x < 0)
throw new Error("lo must be non-negative");
for (w == null && (w = g.length); x < w; )
C = o((x + w) / 2), k(b, g[C]) < 0 ? w = C : x = C + 1;
return [].splice.apply(g, [x, x - x].concat(b)), b;
}, s = function(g, b, x) {
return x == null && (x = r), g.push(b), v(g, 0, g.length - 1, x);
}, i = function(g, b) {
var x, w;
return b == null && (b = r), x = g.pop(), g.length ? (w = g[0], g[0] = x, m(g, 0, b)) : w = x, w;
}, u = function(g, b, x) {
var w;
return x == null && (x = r), w = g[0], g[0] = b, m(g, 0, x), w;
}, l = function(g, b, x) {
var w;
return x == null && (x = r), g.length && x(g[0], b) < 0 && (w = [g[0], b], b = w[0], g[0] = w[1], m(g, 0, x)), b;
}, a = function(g, b) {
var x, w, k, C, _, $;
for (b == null && (b = r), C = (function() {
$ = [];
for (var O = 0, F = o(g.length / 2); 0 <= F ? O < F : O > F; 0 <= F ? O++ : O--)
$.push(O);
return $;
}).apply(this).reverse(), _ = [], w = 0, k = C.length; w < k; w++)
x = C[w], _.push(m(g, x, b));
return _;
}, f = function(g, b, x) {
var w;
if (x == null && (x = r), w = g.indexOf(b), w !== -1)
return v(g, 0, w, x), m(g, w, x);
}, p = function(g, b, x) {
var w, k, C, _, $;
if (x == null && (x = r), k = g.slice(0, b), !k.length)
return k;
for (a(k, x), $ = g.slice(b), C = 0, _ = $.length; C < _; C++)
w = $[C], l(k, w, x);
return k.sort(x).reverse();
}, h = function(g, b, x) {
var w, k, C, _, $, O, F, A, T;
if (x == null && (x = r), b * 10 <= g.length) {
if (C = g.slice(0, b).sort(x), !C.length)
return C;
for (k = C[C.length - 1], F = g.slice(b), _ = 0, O = F.length; _ < O; _++)
w = F[_], x(w, k) < 0 && (c(C, w, 0, null, x), C.pop(), k = C[C.length - 1]);
return C;
}
for (a(g, x), T = [], $ = 0, A = d(b, g.length); 0 <= A ? $ < A : $ > A; 0 <= A ? ++$ : --$)
T.push(i(g, x));
return T;
}, v = function(g, b, x, w) {
var k, C, _;
for (w == null && (w = r), k = g[x]; x > b; ) {
if (_ = x - 1 >> 1, C = g[_], w(k, C) < 0) {
g[x] = C, x = _;
continue;
}
break;
}
return g[x] = k;
}, m = function(g, b, x) {
var w, k, C, _, $;
for (x == null && (x = r), k = g.length, $ = b, C = g[b], w = 2 * b + 1; w < k; )
_ = w + 1, _ < k && !(x(g[w], g[_]) < 0) && (w = _), g[b] = g[w], b = w, w = 2 * b + 1;
return g[b] = C, v(g, $, b, x);
}, n = function() {
g.push = s, g.pop = i, g.replace = u, g.pushpop = l, g.heapify = a, g.updateItem = f, g.nlargest = p, g.nsmallest = h;
function g(b) {
this.cmp = b ?? r, this.nodes = [];
}
return g.prototype.push = function(b) {
return s(this.nodes, b, this.cmp);
}, g.prototype.pop = function() {
return i(this.nodes, this.cmp);
}, g.prototype.peek = function() {
return this.nodes[0];
}, g.prototype.contains = function(b) {
return this.nodes.indexOf(b) !== -1;
}, g.prototype.replace = function(b) {
return u(this.nodes, b, this.cmp);
}, g.prototype.pushpop = function(b) {
return l(this.nodes, b, this.cmp);
}, g.prototype.heapify = function() {
return a(this.nodes, this.cmp);
}, g.prototype.updateItem = function(b) {
return f(this.nodes, b, this.cmp);
}, g.prototype.clear = function() {
return this.nodes = [];
}, g.prototype.empty = function() {
return this.nodes.length === 0;
}, g.prototype.size = function() {
return this.nodes.length;
}, g.prototype.clone = function() {
var b;
return b = new g(), b.nodes = this.nodes.slice(0), b;
}, g.prototype.toArray = function() {
return this.nodes.slice(0);
}, 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;
}(), function(g, b) {
return e.exports = b();
}(this, function() {
return n;
});
}).call(mp);
}), rh = wme, xme = Br({
root: null,
weight: function(e) {
return 1;
},
directed: !1
}), kme = {
dijkstra: function(e) {
if (!Xt(e)) {
var t = arguments;
e = {
root: t[0],
weight: t[1],
directed: t[2]
};
}
var n = xme(e), r = n.root, o = n.weight, a = n.directed, i = this, s = o, l = gt(r) ? this.filter(r)[0] : r[0], u = {}, c = {}, d = {}, p = this.byGroup(), h = p.nodes, f = p.edges;
f.unmergeBy(function(M) {
return M.isLoop();
});
for (var v = function(M) {
return u[M.id()];
}, m = function(M, j) {
u[M.id()] = j, g.updateItem(M);
}, g = new rh(function(M, j) {
return v(M) - v(j);
}), b = 0; b < h.length; b++) {
var x = h[b];
u[x.id()] = x.same(l) ? 0 : 1 / 0, g.push(x);
}
for (var w = function(M, j) {
for (var P = (a ? M.edgesTo(j) : M.edgesWith(j)).intersect(f), V = 1 / 0, U, G = 0; G < P.length; G++) {
var se = P[G], ae = s(se);
(ae < V || !U) && (V = ae, U = se);
}
return {
edge: U,
dist: V
};
}; g.size() > 0; ) {
var k = g.pop(), C = v(k), _ = k.id();
if (d[_] = C, C !== 1 / 0)
for (var $ = k.neighborhood().intersect(h), O = 0; O < $.length; O++) {
var F = $[O], A = F.id(), T = w(k, F), R = C + T.dist;
R < v(F) && (m(F, R), c[A] = {
node: k,
edge: T.edge
});
}
}
return {
distanceTo: function(M) {
var j = gt(M) ? h.filter(M)[0] : M[0];
return d[j.id()];
},
pathTo: function(M) {
var j = gt(M) ? h.filter(M)[0] : M[0], P = [], V = j, U = V.id();
if (j.length > 0)
for (P.unshift(j); c[U]; ) {
var G = c[U];
P.unshift(G.edge), P.unshift(G.node), V = G.node, U = V.id();
}
return i.spawn(P);
}
};
}
}, Cme = {
// kruskal's algorithm (finds min spanning tree, assuming undirected graph)
// implemented from pseudocode from wikipedia
kruskal: function(e) {
e = e || function(b) {
return 1;
};
for (var t = this.byGroup(), n = t.nodes, r = t.edges, o = n.length, a = new Array(o), i = n, s = function(b) {
for (var x = 0; x < a.length; x++) {
var w = a[x];
if (w.has(b))
return x;
}
}, l = 0; l < o; l++)
a[l] = this.spawn(n[l]);
for (var u = r.sort(function(b, x) {
return e(b) - e(x);
}), c = 0; c < u.length; c++) {
var d = u[c], p = d.source()[0], h = d.target()[0], f = s(p), v = s(h), m = a[f], g = a[v];
f !== v && (i.merge(d), m.merge(g), a.splice(v, 1));
}
return i;
}
}, _me = Br({
root: null,
goal: null,
weight: function(e) {
return 1;
},
heuristic: function(e) {
return 0;
},
directed: !1
}), Sme = {
// Implemented from pseudocode from wikipedia
aStar: function(e) {
var t = this.cy(), n = _me(e), r = n.root, o = n.goal, a = n.heuristic, i = n.directed, s = n.weight;
r = t.collection(r)[0], o = t.collection(o)[0];
var l = r.id(), u = o.id(), c = {}, d = {}, p = {}, h = new rh(function(G, se) {
return d[G.id()] - d[se.id()];
}), f = new gd(), v = {}, m = {}, g = function(G, se) {
h.push(G), f.add(se);
}, b, x, w = function() {
b = h.pop(), x = b.id(), f.delete(x);
}, k = function(G) {
return f.has(G);
};
g(r, l), c[l] = 0, d[l] = a(r);
for (var C = 0; h.size() > 0; ) {
if (w(), C++, x === u) {
for (var _ = [], $ = o, O = u, F = m[O]; _.unshift($), F != null && _.unshift(F), $ = v[O], $ != null; )
O = $.id(), F = m[O];
return {
found: !0,
distance: c[x],
path: this.spawn(_),
steps: C
};
}
p[x] = !0;
for (var A = b._private.edges, T = 0; T < A.length; T++) {
var R = A[T];
if (this.hasElementWithId(R.id()) && !(i && R.data("source") !== x)) {
var M = R.source(), j = R.target(), P = M.id() !== x ? M : j, V = P.id();
if (this.hasElementWithId(V) && !p[V]) {
var U = c[x] + s(R);
if (!k(V)) {
c[V] = U, d[V] = U + a(P), g(P, V), v[V] = b, m[V] = R;
continue;
}
U < c[V] && (c[V] = U, d[V] = U + a(P), v[V] = b, m[V] = R);
}
}
}
}
return {
found: !1,
distance: void 0,
path: void 0,
steps: C
};
}
}, $me = Br({
weight: function(e) {
return 1;
},
directed: !1
}), Eme = {
// Implemented from pseudocode from wikipedia
floydWarshall: function(e) {
for (var t = this.cy(), n = $me(e), r = n.weight, o = n.directed, a = r, i = this.byGroup(), s = i.nodes, l = i.edges, u = s.length, c = u * u, d = function(ae) {
return s.indexOf(ae);
}, p = function(ae) {
return s[ae];
}, h = new Array(c), f = 0; f < c; f++) {
var v = f % u, m = (f - v) / u;
m === v ? h[f] = 0 : h[f] = 1 / 0;
}
for (var g = new Array(c), b = new Array(c), x = 0; x < l.length; x++) {
var w = l[x], k = w.source()[0], C = w.target()[0];
if (k !== C) {
var _ = d(k), $ = d(C), O = _ * u + $, F = a(w);
if (h[O] > F && (h[O] = F, g[O] = $, b[O] = w), !o) {
var A = $ * u + _;
!o && h[A] > F && (h[A] = F, g[A] = _, b[A] = w);
}
}
}
for (var T = 0; T < u; T++)
for (var R = 0; R < u; R++)
for (var M = R * u + T, j = 0; j < u; j++) {
var P = R * u + j, V = T * u + j;
h[M] + h[V] < h[P] && (h[P] = h[M] + h[V], g[P] = g[M]);
}
var U = function(ae) {
return (gt(ae) ? t.filter(ae) : ae)[0];
}, G = function(ae) {
return d(U(ae));
}, se = {
distance: function(ae, de) {
var me = G(ae), te = G(de);
return h[me * u + te];
},
path: function(ae, de) {
var me = G(ae), te = G(de), oe = p(me);
if (me === te)
return oe.collection();
if (g[me * u + te] == null)
return t.collection();
var ne = t.collection(), ee = me, Z;
for (ne.merge(oe); me !== te; )
ee = me, me = g[me * u + te], Z = b[ee * u + me], ne.merge(Z), ne.merge(p(me));
return ne;
}
};
return se;
}
// floydWarshall
}, Ome = Br({
weight: function(e) {
return 1;
},
directed: !1,
root: null
}), Fme = {
// Implemented from pseudocode from wikipedia
bellmanFord: function(e) {
var t = this, n = Ome(e), r = n.weight, o = n.directed, a = n.root, i = r, s = this, l = this.cy(), u = this.byGroup(), c = u.edges, d = u.nodes, p = d.length, h = new ii(), f = !1, v = [];
a = l.collection(a)[0], c.unmergeBy(function(Ie) {
return Ie.isLoop();
});
for (var m = c.length, g = function(Ie) {
var Ae = h.get(Ie.id());
return Ae || (Ae = {}, h.set(Ie.id(), Ae)), Ae;
}, b = function(Ie) {
return (gt(Ie) ? l.$(Ie) : Ie)[0];
}, x = function(Ie) {
return g(b(Ie)).dist;
}, w = function(Ie) {
for (var Ae = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : a, qe = b(Ie), et = [], He = qe; ; ) {
if (He == null)
return t.spawn();
var ot = g(He), tt = ot.edge, Qe = ot.pred;
if (et.unshift(He[0]), He.same(Ae) && et.length > 0)
break;
tt != null && et.unshift(tt), He = Qe;
}
return s.spawn(et);
}, k = 0; k < p; k++) {
var C = d[k], _ = g(C);
C.same(a) ? _.dist = 0 : _.dist = 1 / 0, _.pred = null, _.edge = null;
}
for (var $ = !1, O = function(Ie, Ae, qe, et, He, ot) {
var tt = et.dist + ot;
tt < He.dist && !qe.same(et.edge) && (He.dist = tt, He.pred = Ie, He.edge = qe, $ = !0);
}, F = 1; F < p; F++) {
$ = !1;
for (var A = 0; A < m; A++) {
var T = c[A], R = T.source(), M = T.target(), j = i(T), P = g(R), V = g(M);
O(R, M, T, P, V, j), o || O(M, R, T, V, P, j);
}
if (!$)
break;
}
if ($)
for (var U = [], G = 0; G < m; G++) {
var se = c[G], ae = se.source(), de = se.target(), me = i(se), te = g(ae).dist, oe = g(de).dist;
if (te + me < oe || !o && oe + me < te)
if (f || (sn("Graph contains a negative weight cycle for Bellman-Ford"), f = !0), e.findNegativeWeightCycles !== !1) {
var ne = [];
te + me < oe && ne.push(ae), !o && oe + me < te && ne.push(de);
for (var ee = ne.length, Z = 0; Z < ee; Z++) {
var le = ne[Z], pe = [le];
pe.push(g(le).edge);
for (var ke = g(le).pred; pe.indexOf(ke) === -1; )
pe.push(ke), pe.push(g(ke).edge), ke = g(ke).pred;
pe = pe.slice(pe.indexOf(ke));
for (var Ne = pe[0].id(), De = 0, _e = 2; _e < pe.length; _e += 2)
pe[_e].id() < Ne && (Ne = pe[_e].id(), De = _e);
pe = pe.slice(De).concat(pe.slice(0, De)), pe.push(pe[0]);
var Fe = pe.map(function(Ie) {
return Ie.id();
}).join(",");
U.indexOf(Fe) === -1 && (v.push(s.spawn(pe)), U.push(Fe));
}
} else
break;
}
return {
distanceTo: x,
pathTo: w,
hasNegativeWeightCycle: f,
negativeWeightCycles: v
};
}
// bellmanFord
}, Tme = Math.sqrt(2), Ame = function(e, t, n) {
n.length === 0 && Un("Karger-Stein must be run on a connected (sub)graph");
for (var r = n[e], o = r[1], a = r[2], i = t[o], s = t[a], l = n, u = l.length - 1; u >= 0; u--) {
var c = l[u], d = c[1], p = c[2];
(t[d] === i && t[p] === s || t[d] === s && t[p] === i) && l.splice(u, 1);
}
for (var h = 0; h < l.length; h++) {
var f = l[h];
f[1] === s ? (l[h] = f.slice(), l[h][1] = i) : f[2] === s && (l[h] = f.slice(), l[h][2] = i);
}
for (var v = 0; v < t.length; v++)
t[v] === s && (t[v] = i);
return l;
}, py = function(e, t, n, r) {
for (; n > r; ) {
var o = Math.floor(Math.random() * t.length);
t = Ame(o, e, t), n--;
}
return t;
}, Ime = {
// Computes the minimum cut of an undirected graph
// Returns the correct answer with high probability
kargerStein: function() {
var e = this, t = this.byGroup(), n = t.nodes, r = t.edges;
r.unmergeBy(function(V) {
return V.isLoop();
});
var o = n.length, a = r.length, i = Math.ceil(Math.pow(Math.log(o) / Math.LN2, 2)), s = Math.floor(o / Tme);
if (o < 2) {
Un("At least 2 nodes are required for Karger-Stein algorithm");
return;
}
for (var l = [], u = 0; u < a; u++) {
var c = r[u];
l.push([u, n.indexOf(c.source()), n.indexOf(c.target())]);
}
for (var d = 1 / 0, p = [], h = new Array(o), f = new Array(o), v = new Array(o), m = function(V, U) {
for (var G = 0; G < o; G++)
U[G] = V[G];
}, g = 0; g <= i; g++) {
for (var b = 0; b < o; b++)
f[b] = b;
var x = py(f, l.slice(), o, s), w = x.slice();
m(f, v);
var k = py(f, x, s, 2), C = py(v, w, s, 2);
k.length <= C.length && k.length < d ? (d = k.length, p = k, m(f, h)) : C.length <= k.length && C.length < d && (d = C.length, p = C, m(v, h));
}
for (var _ = this.spawn(p.map(function(V) {
return r[V[0]];
})), $ = this.spawn(), O = this.spawn(), F = h[0], A = 0; A < h.length; A++) {
var T = h[A], R = n[A];
T === F ? $.merge(R) : O.merge(R);
}
var M = function(V) {
var U = e.spawn();
return V.forEach(function(G) {
U.merge(G), G.connectedEdges().forEach(function(se) {
e.contains(se) && !_.contains(se) && U.merge(se);
});
}), U;
}, j = [M($), M(O)], P = {
cut: _,
components: j,
// n.b. partitions are included to be compatible with the old api spec
// (could be removed in a future major version)
partition1: $,
partition2: O
};
return P;
}
}, Pme = function(e) {
return {
x: e.x,
y: e.y
};
}, vm = function(e, t, n) {
return {
x: e.x * t + n.x,
y: e.y * t + n.y
};
}, NB = function(e, t, n) {
return {
x: (e.x - n.x) / t,
y: (e.y - n.y) / t
};
}, xc = function(e) {
return {
x: e[0],
y: e[1]
};
}, Lme = function(e) {
for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, r = 1 / 0, o = t; o < n; o++) {
var a = e[o];
isFinite(a) && (r = Math.min(a, r));
}
return r;
}, Rme = function(e) {
for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, r = -1 / 0, o = t; o < n; o++) {
var a = e[o];
isFinite(a) && (r = Math.max(a, r));
}
return r;
}, Nme = function(e) {
for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, r = 0, o = 0, a = t; a < n; a++) {
var i = e[a];
isFinite(i) && (r += i, o++);
}
return r / o;
}, Mme = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0;
r ? e = e.slice(t, n) : (n < e.length && e.splice(n, e.length - n), t > 0 && e.splice(0, t));
for (var i = 0, s = e.length - 1; s >= 0; s--) {
var l = e[s];
a ? isFinite(l) || (e[s] = -1 / 0, i++) : e.splice(s, 1);
}
o && e.sort(function(d, p) {
return d - p;
});
var u = e.length, c = Math.floor(u / 2);
return u % 2 !== 0 ? e[c + 1 + i] : (e[c - 1 + i] + e[c + i]) / 2;
}, Dme = function(e) {
return Math.PI * e / 180;
}, rv = function(e, t) {
return Math.atan2(t, e) - Math.PI / 2;
}, m$ = Math.log2 || function(e) {
return Math.log(e) / Math.log(2);
}, MB = function(e) {
return e > 0 ? 1 : e < 0 ? -1 : 0;
}, fu = function(e, t) {
return Math.sqrt(Dl(e, t));
}, Dl = function(e, t) {
var n = t.x - e.x, r = t.y - e.y;
return n * n + r * r;
}, Bme = function(e) {
for (var t = e.length, n = 0, r = 0; r < t; r++)
n += e[r];
for (var o = 0; o < t; o++)
e[o] = e[o] / n;
return e;
}, gr = function(e, t, n, r) {
return (1 - r) * (1 - r) * e + 2 * (1 - r) * r * t + r * r * n;
}, Sc = function(e, t, n, r) {
return {
x: gr(e.x, t.x, n.x, r),
y: gr(e.y, t.y, n.y, r)
};
}, zme = function(e, t, n, r) {
var o = {
x: t.x - e.x,
y: t.y - e.y
}, a = fu(e, t), i = {
x: o.x / a,
y: o.y / a
};
return n = n ?? 0, r = r ?? n * a, {
x: e.x + i.x * r,
y: e.y + i.y * r
};
}, uf = function(e, t, n) {
return Math.max(e, Math.min(n, t));
}, Fo = function(e) {
if (e == null)
return {
x1: 1 / 0,
y1: 1 / 0,
x2: -1 / 0,
y2: -1 / 0,
w: 0,
h: 0
};
if (e.x1 != null && e.y1 != null) {
if (e.x2 != null && e.y2 != null && e.x2 >= e.x1 && e.y2 >= e.y1)
return {
x1: e.x1,
y1: e.y1,
x2: e.x2,
y2: e.y2,
w: e.x2 - e.x1,
h: e.y2 - e.y1
};
if (e.w != null && e.h != null && e.w >= 0 && e.h >= 0)
return {
x1: e.x1,
y1: e.y1,
x2: e.x1 + e.w,
y2: e.y1 + e.h,
w: e.w,
h: e.h
};
}
}, jme = function(e) {
return {
x1: e.x1,
x2: e.x2,
w: e.w,
y1: e.y1,
y2: e.y2,
h: e.h
};
}, Vme = function(e) {
e.x1 = 1 / 0, e.y1 = 1 / 0, e.x2 = -1 / 0, e.y2 = -1 / 0, e.w = 0, e.h = 0;
}, Hme = function(e, t, n) {
return {
x1: e.x1 + t,
x2: e.x2 + t,
y1: e.y1 + n,
y2: e.y2 + n,
w: e.w,
h: e.h
};
}, DB = function(e, t) {
e.x1 = Math.min(e.x1, t.x1), e.x2 = Math.max(e.x2, t.x2), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, t.y1), e.y2 = Math.max(e.y2, t.y2), e.h = e.y2 - e.y1;
}, Ume = function(e, t, n) {
e.x1 = Math.min(e.x1, t), e.x2 = Math.max(e.x2, t), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, n), e.y2 = Math.max(e.y2, n), e.h = e.y2 - e.y1;
}, Kv = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
return e.x1 -= t, e.x2 += t, e.y1 -= t, e.y2 += t, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e;
}, Gv = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0], n, r, o, a;
if (t.length === 1)
n = r = o = a = t[0];
else if (t.length === 2)
n = o = t[0], a = r = t[1];
else if (t.length === 4) {
var i = Ta(t, 4);
n = i[0], r = i[1], o = i[2], a = i[3];
}
return e.x1 -= a, e.x2 += r, e.y1 -= n, e.y2 += o, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e;
}, LO = function(e, t) {
e.x1 = t.x1, e.y1 = t.y1, e.x2 = t.x2, e.y2 = t.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1;
}, y$ = function(e, t) {
return !(e.x1 > t.x2 || t.x1 > e.x2 || e.x2 < t.x1 || t.x2 < e.x1 || e.y2 < t.y1 || t.y2 < e.y1 || e.y1 > t.y2 || t.y1 > e.y2);
}, Gc = function(e, t, n) {
return e.x1 <= t && t <= e.x2 && e.y1 <= n && n <= e.y2;
}, qme = function(e, t) {
return Gc(e, t.x, t.y);
}, BB = function(e, t) {
return Gc(e, t.x1, t.y1) && Gc(e, t.x2, t.y2);
}, zB = function(e, t, n, r, o, a, i) {
var s = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : "auto", l = s === "auto" ? hu(o, a) : s, u = o / 2, c = a / 2;
l = Math.min(l, u, c);
var d = l !== u, p = l !== c, h;
if (d) {
var f = n - u + l - i, v = r - c - i, m = n + u - l + i, g = v;
if (h = qs(e, t, n, r, f, v, m, g, !1), h.length > 0)
return h;
}
if (p) {
var b = n + u + i, x = r - c + l - i, w = b, k = r + c - l + i;
if (h = qs(e, t, n, r, b, x, w, k, !1), h.length > 0)
return h;
}
if (d) {
var C = n - u + l - i, _ = r + c + i, $ = n + u - l + i, O = _;
if (h = qs(e, t, n, r, C, _, $, O, !1), h.length > 0)
return h;
}
if (p) {
var F = n - u - i, A = r - c + l - i, T = F, R = r + c - l + i;
if (h = qs(e, t, n, r, F, A, T, R, !1), h.length > 0)
return h;
}
var M;
{
var j = n - u + l, P = r - c + l;
if (M = bp(e, t, n, r, j, P, l + i), M.length > 0 && M[0] <= j && M[1] <= P)
return [M[0], M[1]];
}
{
var V = n + u - l, U = r - c + l;
if (M = bp(e, t, n, r, V, U, l + i), M.length > 0 && M[0] >= V && M[1] <= U)
return [M[0], M[1]];
}
{
var G = n + u - l, se = r + c - l;
if (M = bp(e, t, n, r, G, se, l + i), M.length > 0 && M[0] >= G && M[1] >= se)
return [M[0], M[1]];
}
{
var ae = n - u + l, de = r + c - l;
if (M = bp(e, t, n, r, ae, de, l + i), M.length > 0 && M[0] <= ae && M[1] >= de)
return [M[0], M[1]];
}
return [];
}, Kme = function(e, t, n, r, o, a, i) {
var s = i, l = Math.min(n, o), u = Math.max(n, o), c = Math.min(r, a), d = Math.max(r, a);
return l - s <= e && e <= u + s && c - s <= t && t <= d + s;
}, Gme = function(e, t, n, r, o, a, i, s, l) {
var u = {
x1: Math.min(n, i, o) - l,
x2: Math.max(n, i, o) + l,
y1: Math.min(r, s, a) - l,
y2: Math.max(r, s, a) + l
};
return !(e < u.x1 || e > u.x2 || t < u.y1 || t > u.y2);
}, Wme = function(e, t, n, r) {
n -= r;
var o = t * t - 4 * e * n;
if (o < 0)
return [];
var a = Math.sqrt(o), i = 2 * e, s = (-t + a) / i, l = (-t - a) / i;
return [s, l];
}, Yme = function(e, t, n, r, o) {
var a = 1e-5;
e === 0 && (e = a), t /= e, n /= e, r /= e;
var i, s, l, u, c, d, p, h;
if (s = (3 * n - t * t) / 9, l = -(27 * r) + t * (9 * n - 2 * (t * t)), l /= 54, i = s * s * s + l * l, o[1] = 0, p = t / 3, i > 0) {
c = l + Math.sqrt(i), c = c < 0 ? -Math.pow(-c, 1 / 3) : Math.pow(c, 1 / 3), d = l - Math.sqrt(i), d = d < 0 ? -Math.pow(-d, 1 / 3) : Math.pow(d, 1 / 3), o[0] = -p + c + d, p += (c + d) / 2, o[4] = o[2] = -p, p = Math.sqrt(3) * (-d + c) / 2, o[3] = p, o[5] = -p;
return;
}
if (o[5] = o[3] = 0, i === 0) {
h = l < 0 ? -Math.pow(-l, 1 / 3) : Math.pow(l, 1 / 3), o[0] = -p + 2 * h, o[4] = o[2] = -(h + p);
return;
}
s = -s, u = s * s * s, u = Math.acos(l / Math.sqrt(u)), h = 2 * Math.sqrt(s), o[0] = -p + h * Math.cos(u / 3), o[2] = -p + h * Math.cos((u + 2 * Math.PI) / 3), o[4] = -p + h * Math.cos((u + 4 * Math.PI) / 3);
}, Xme = function(e, t, n, r, o, a, i, s) {
var l = 1 * n * n - 4 * n * o + 2 * n * i + 4 * o * o - 4 * o * i + i * i + r * r - 4 * r * a + 2 * r * s + 4 * a * a - 4 * a * s + s * s, u = 1 * 9 * n * o - 3 * n * n - 3 * n * i - 6 * o * o + 3 * o * i + 9 * r * a - 3 * r * r - 3 * r * s - 6 * a * a + 3 * a * s, c = 1 * 3 * n * n - 6 * n * o + n * i - n * e + 2 * o * o + 2 * o * e - i * e + 3 * r * r - 6 * r * a + r * s - r * t + 2 * a * a + 2 * a * t - s * t, d = 1 * n * o - n * n + n * e - o * e + r * a - r * r + r * t - a * t, p = [];
Yme(l, u, c, d, p);
for (var h = 1e-7, f = [], v = 0; v < 6; v += 2)
Math.abs(p[v + 1]) < h && p[v] >= 0 && p[v] <= 1 && f.push(p[v]);
f.push(1), f.push(0);
for (var m = -1, g, b, x, w = 0; w < f.length; w++)
g = Math.pow(1 - f[w], 2) * n + 2 * (1 - f[w]) * f[w] * o + f[w] * f[w] * i, b = Math.pow(1 - f[w], 2) * r + 2 * (1 - f[w]) * f[w] * a + f[w] * f[w] * s, x = Math.pow(g - e, 2) + Math.pow(b - t, 2), m >= 0 ? x < m && (m = x) : m = x;
return m;
}, Zme = function(e, t, n, r, o, a) {
var i = [e - n, t - r], s = [o - n, a - r], l = s[0] * s[0] + s[1] * s[1], u = i[0] * i[0] + i[1] * i[1], c = i[0] * s[0] + i[1] * s[1], d = c * c / l;
return c < 0 ? u : d > l ? (e - o) * (e - o) + (t - a) * (t - a) : u - d;
}, ho = function(e, t, n) {
for (var r, o, a, i, s, l = 0, u = 0; u < n.length / 2; u++)
if (r = n[u * 2], o = n[u * 2 + 1], u + 1 < n.length / 2 ? (a = n[(u + 1) * 2], i = n[(u + 1) * 2 + 1]) : (a = n[(u + 1 - n.length / 2) * 2], i = n[(u + 1 - n.length / 2) * 2 + 1]), !(r == e && a == e)) if (r >= e && e >= a || r <= e && e <= a)
s = (e - r) / (a - r) * (i - o) + o, s > t && l++;
else
continue;
return l % 2 !== 0;
}, rs = function(e, t, n, r, o, a, i, s, l) {
var u = new Array(n.length), c;
s[0] != null ? (c = Math.atan(s[1] / s[0]), s[0] < 0 ? c = c + Math.PI / 2 : c = -c - Math.PI / 2) : c = s;
for (var d = Math.cos(-c), p = Math.sin(-c), h = 0; h < u.length / 2; h++)
u[h * 2] = a / 2 * (n[h * 2] * d - n[h * 2 + 1] * p), u[h * 2 + 1] = i / 2 * (n[h * 2 + 1] * d + n[h * 2] * p), u[h * 2] += r, u[h * 2 + 1] += o;
var f;
if (l > 0) {
var v = Vg(u, -l);
f = jg(v);
} else
f = u;
return ho(e, t, f);
}, Jme = function(e, t, n, r, o, a, i, s) {
for (var l = new Array(n.length * 2), u = 0; u < s.length; u++) {
var c = s[u];
l[u * 4 + 0] = c.startX, l[u * 4 + 1] = c.startY, l[u * 4 + 2] = c.stopX, l[u * 4 + 3] = c.stopY;
var d = Math.pow(c.cx - e, 2) + Math.pow(c.cy - t, 2);
if (d <= Math.pow(c.radius, 2))
return !0;
}
return ho(e, t, l);
}, jg = function(e) {
for (var t = new Array(e.length / 2), n, r, o, a, i, s, l, u, c = 0; c < e.length / 4; c++) {
n = e[c * 4], r = e[c * 4 + 1], o = e[c * 4 + 2], a = e[c * 4 + 3], c < e.length / 4 - 1 ? (i = e[(c + 1) * 4], s = e[(c + 1) * 4 + 1], l = e[(c + 1) * 4 + 2], u = e[(c + 1) * 4 + 3]) : (i = e[0], s = e[1], l = e[2], u = e[3]);
var d = qs(n, r, o, a, i, s, l, u, !0);
t[c * 2] = d[0], t[c * 2 + 1] = d[1];
}
return t;
}, Vg = function(e, t) {
for (var n = new Array(e.length * 2), r, o, a, i, s = 0; s < e.length / 2; s++) {
r = e[s * 2], o = e[s * 2 + 1], s < e.length / 2 - 1 ? (a = e[(s + 1) * 2], i = e[(s + 1) * 2 + 1]) : (a = e[0], i = e[1]);
var l = i - o, u = -(a - r), c = Math.sqrt(l * l + u * u), d = l / c, p = u / c;
n[s * 4] = r + d * t, n[s * 4 + 1] = o + p * t, n[s * 4 + 2] = a + d * t, n[s * 4 + 3] = i + p * t;
}
return n;
}, Qme = function(e, t, n, r, o, a) {
var i = n - e, s = r - t;
i /= o, s /= a;
var l = Math.sqrt(i * i + s * s), u = l - 1;
if (u < 0)
return [];
var c = u / l;
return [(n - e) * c + e, (r - t) * c + t];
}, ql = function(e, t, n, r, o, a, i) {
return e -= o, t -= a, e /= n / 2 + i, t /= r / 2 + i, e * e + t * t <= 1;
}, bp = function(e, t, n, r, o, a, i) {
var s = [n - e, r - t], l = [e - o, t - a], u = s[0] * s[0] + s[1] * s[1], c = 2 * (l[0] * s[0] + l[1] * s[1]), d = l[0] * l[0] + l[1] * l[1] - i * i, p = c * c - 4 * u * d;
if (p < 0)
return [];
var h = (-c + Math.sqrt(p)) / (2 * u), f = (-c - Math.sqrt(p)) / (2 * u), v = Math.min(h, f), m = Math.max(h, f), g = [];
if (v >= 0 && v <= 1 && g.push(v), m >= 0 && m <= 1 && g.push(m), g.length === 0)
return [];
var b = g[0] * s[0] + e, x = g[0] * s[1] + t;
if (g.length > 1) {
if (g[0] == g[1])
return [b, x];
var w = g[1] * s[0] + e, k = g[1] * s[1] + t;
return [b, x, w, k];
} else
return [b, x];
}, fy = function(e, t, n) {
return t <= e && e <= n || n <= e && e <= t ? e : e <= t && t <= n || n <= t && t <= e ? t : n;
}, qs = function(e, t, n, r, o, a, i, s, l) {
var u = e - o, c = n - e, d = i - o, p = t - a, h = r - t, f = s - a, v = d * p - f * u, m = c * p - h * u, g = f * c - d * h;
if (g !== 0) {
var b = v / g, x = m / g, w = 1e-3, k = 0 - w, C = 1 + w;
return k <= b && b <= C && k <= x && x <= C ? [e + b * c, t + b * h] : l ? [e + b * c, t + b * h] : [];
} else
return v === 0 || m === 0 ? fy(e, n, i) === i ? [i, s] : fy(e, n, o) === o ? [o, a] : fy(o, i, n) === n ? [n, r] : [] : [];
}, cf = function(e, t, n, r, o, a, i, s) {
var l = [], u, c = new Array(n.length), d = !0;
a == null && (d = !1);
var p;
if (d) {
for (var h = 0; h < c.length / 2; h++)
c[h * 2] = n[h * 2] * a + r, c[h * 2 + 1] = n[h * 2 + 1] * i + o;
if (s > 0) {
var f = Vg(c, -s);
p = jg(f);
} else
p = c;
} else
p = n;
for (var v, m, g, b, x = 0; x < p.length / 2; x++)
v = p[x * 2], m = p[x * 2 + 1], x < p.length / 2 - 1 ? (g = p[(x + 1) * 2], b = p[(x + 1) * 2 + 1]) : (g = p[0], b = p[1]), u = qs(e, t, r, o, v, m, g, b), u.length !== 0 && l.push(u[0], u[1]);
return l;
}, e1e = function(e, t, n, r, o, a, i, s, l) {
var u = [], c, d = new Array(n.length * 2);
l.forEach(function(g, b) {
b === 0 ? (d[d.length - 2] = g.startX, d[d.length - 1] = g.startY) : (d[b * 4 - 2] = g.startX, d[b * 4 - 1] = g.startY), d[b * 4] = g.stopX, d[b * 4 + 1] = g.stopY, c = bp(e, t, r, o, g.cx, g.cy, g.radius), c.length !== 0 && u.push(c[0], c[1]);
});
for (var p = 0; p < d.length / 4; p++)
c = qs(e, t, r, o, d[p * 4], d[p * 4 + 1], d[p * 4 + 2], d[p * 4 + 3], !1), c.length !== 0 && u.push(c[0], c[1]);
if (u.length > 2) {
for (var h = [u[0], u[1]], f = Math.pow(h[0] - e, 2) + Math.pow(h[1] - t, 2), v = 1; v < u.length / 2; v++) {
var m = Math.pow(u[v * 2] - e, 2) + Math.pow(u[v * 2 + 1] - t, 2);
m <= f && (h[0] = u[v * 2], h[1] = u[v * 2 + 1], f = m);
}
return h;
}
return u;
}, ov = function(e, t, n) {
var r = [e[0] - t[0], e[1] - t[1]], o = Math.sqrt(r[0] * r[0] + r[1] * r[1]), a = (o - n) / o;
return a < 0 && (a = 1e-5), [t[0] + a * r[0], t[1] + a * r[1]];
}, ro = function(e, t) {
var n = jC(e, t);
return n = jB(n), n;
}, jB = function(e) {
for (var t, n, r = e.length / 2, o = 1 / 0, a = 1 / 0, i = -1 / 0, s = -1 / 0, l = 0; l < r; l++)
t = e[2 * l], n = e[2 * l + 1], o = Math.min(o, t), i = Math.max(i, t), a = Math.min(a, n), s = Math.max(s, n);
for (var u = 2 / (i - o), c = 2 / (s - a), d = 0; d < r; d++)
t = e[2 * d] = e[2 * d] * u, n = e[2 * d + 1] = e[2 * d + 1] * c, o = Math.min(o, t), i = Math.max(i, t), a = Math.min(a, n), s = Math.max(s, n);
if (a < -1)
for (var p = 0; p < r; p++)
n = e[2 * p + 1] = e[2 * p + 1] + (-1 - a);
return e;
}, jC = function(e, t) {
var n = 1 / e * 2 * Math.PI, r = e % 2 === 0 ? Math.PI / 2 + n / 2 : Math.PI / 2;
r += t;
for (var o = new Array(e * 2), a, i = 0; i < e; i++)
a = i * n + r, o[2 * i] = Math.cos(a), o[2 * i + 1] = Math.sin(-a);
return o;
}, hu = function(e, t) {
return Math.min(e / 4, t / 4, 8);
}, VB = function(e, t) {
return Math.min(e / 10, t / 10, 8);
}, b$ = function() {
return 8;
}, t1e = function(e, t, n) {
return [e - 2 * t + n, 2 * (t - e), e];
}, VC = function(e, t) {
return {
heightOffset: Math.min(15, 0.05 * t),
widthOffset: Math.min(100, 0.25 * e),
ctrlPtOffsetPct: 0.05
};
}, n1e = Br({
dampingFactor: 0.8,
precision: 1e-6,
iterations: 200,
weight: function(e) {
return 1;
}
}), r1e = {
pageRank: function(e) {
for (var t = n1e(e), n = t.dampingFactor, r = t.precision, o = t.iterations, a = t.weight, i = this._private.cy, s = this.byGroup(), l = s.nodes, u = s.edges, c = l.length, d = c * c, p = u.length, h = new Array(d), f = new Array(c), v = (1 - n) / c, m = 0; m < c; m++) {
for (var g = 0; g < c; g++) {
var b = m * c + g;
h[b] = 0;
}
f[m] = 0;
}
for (var x = 0; x < p; x++) {
var w = u[x], k = w.data("source"), C = w.data("target");
if (k !== C) {
var _ = l.indexOfId(k), $ = l.indexOfId(C), O = a(w), F = $ * c + _;
h[F] += O, f[_] += O;
}
}
for (var A = 1 / c + v, T = 0; T < c; T++)
if (f[T] === 0)
for (var R = 0; R < c; R++) {
var M = R * c + T;
h[M] = A;
}
else
for (var j = 0; j < c; j++) {
var P = j * c + T;
h[P] = h[P] / f[T] + v;
}
for (var V = new Array(c), U = new Array(c), G, se = 0; se < c; se++)
V[se] = 1;
for (var ae = 0; ae < o; ae++) {
for (var de = 0; de < c; de++)
U[de] = 0;
for (var me = 0; me < c; me++)
for (var te = 0; te < c; te++) {
var oe = me * c + te;
U[me] += h[oe] * V[te];
}
Bme(U), G = V, V = U, U = G;
for (var ne = 0, ee = 0; ee < c; ee++) {
var Z = G[ee] - V[ee];
ne += Z * Z;
}
if (ne < r)
break;
}
var le = {
rank: function(pe) {
return pe = i.collection(pe)[0], V[l.indexOf(pe)];
}
};
return le;
}
// pageRank
}, RO = Br({
root: null,
weight: function(e) {
return 1;
},
directed: !1,
alpha: 0
}), $c = {
degreeCentralityNormalized: function(e) {
e = RO(e);
var t = this.cy(), n = this.nodes(), r = n.length;
if (e.directed) {
for (var o = {}, a = {}, i = 0, s = 0, l = 0; l < r; l++) {
var u = n[l], c = u.id();
e.root = u;
var d = this.degreeCentrality(e);
i < d.indegree && (i = d.indegree), s < d.outdegree && (s = d.outdegree), o[c] = d.indegree, a[c] = d.outdegree;
}
return {
indegree: function(g) {
return i == 0 ? 0 : (gt(g) && (g = t.filter(g)), o[g.id()] / i);
},
outdegree: function(g) {
return s === 0 ? 0 : (gt(g) && (g = t.filter(g)), a[g.id()] / s);
}
};
} else {
for (var p = {}, h = 0, f = 0; f < r; f++) {
var v = n[f];
e.root = v;
var m = this.degreeCentrality(e);
h < m.degree && (h = m.degree), p[v.id()] = m.degree;
}
return {
degree: function(g) {
return h === 0 ? 0 : (gt(g) && (g = t.filter(g)), p[g.id()] / h);
}
};
}
},
// degreeCentralityNormalized
// Implemented from the algorithm in Opsahl's paper
// "Node centrality in weighted networks: Generalizing degree and shortest paths"
// check the heading 2 "Degree"
degreeCentrality: function(e) {
e = RO(e);
var t = this.cy(), n = this, r = e, o = r.root, a = r.weight, i = r.directed, s = r.alpha;
if (o = t.collection(o)[0], i) {
for (var l = o.connectedEdges(), u = l.filter(function(k) {
return k.target().same(o) && n.has(k);
}), c = l.filter(function(k) {
return k.source().same(o) && n.has(k);
}), d = u.length, p = c.length, h = 0, f = 0, v = 0; v < u.length; v++)
h += a(u[v]);
for (var m = 0; m < c.length; m++)
f += a(c[m]);
return {
indegree: Math.pow(d, 1 - s) * Math.pow(h, s),
outdegree: Math.pow(p, 1 - s) * Math.pow(f, s)
};
} else {
for (var g = o.connectedEdges().intersection(n), b = g.length, x = 0, w = 0; w < g.length; w++)
x += a(g[w]);
return {
degree: Math.pow(b, 1 - s) * Math.pow(x, s)
};
}
}
// degreeCentrality
};
$c.dc = $c.degreeCentrality;
$c.dcn = $c.degreeCentralityNormalised = $c.degreeCentralityNormalized;
var NO = Br({
harmonic: !0,
weight: function() {
return 1;
},
directed: !1,
root: null
}), Ec = {
closenessCentralityNormalized: function(e) {
for (var t = NO(e), n = t.harmonic, r = t.weight, o = t.directed, a = this.cy(), i = {}, s = 0, l = this.nodes(), u = this.floydWarshall({
weight: r,
directed: o
}), c = 0; c < l.length; c++) {
for (var d = 0, p = l[c], h = 0; h < l.length; h++)
if (c !== h) {
var f = u.distance(p, l[h]);
n ? d += 1 / f : d += f;
}
n || (d = 1 / d), s < d && (s = d), i[p.id()] = d;
}
return {
closeness: function(v) {
return s == 0 ? 0 : (gt(v) ? v = a.filter(v)[0].id() : v = v.id(), i[v] / s);
}
};
},
// Implemented from pseudocode from wikipedia
closenessCentrality: function(e) {
var t = NO(e), n = t.root, r = t.weight, o = t.directed, a = t.harmonic;
n = this.filter(n)[0];
for (var i = this.dijkstra({
root: n,
weight: r,
directed: o
}), s = 0, l = this.nodes(), u = 0; u < l.length; u++) {
var c = l[u];
if (!c.same(n)) {
var d = i.distanceTo(c);
a ? s += 1 / d : s += d;
}
}
return a ? s : 1 / s;
}
// closenessCentrality
};
Ec.cc = Ec.closenessCentrality;
Ec.ccn = Ec.closenessCentralityNormalised = Ec.closenessCentralityNormalized;
var o1e = Br({
weight: null,
directed: !1
}), HC = {
// Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes
betweennessCentrality: function(e) {
for (var t = o1e(e), n = t.directed, r = t.weight, o = r != null, a = this.cy(), i = this.nodes(), s = {}, l = {}, u = 0, c = {
set: function(g, b) {
l[g] = b, b > u && (u = b);
},
get: function(g) {
return l[g];
}
}, d = 0; d < i.length; d++) {
var p = i[d], h = p.id();
n ? s[h] = p.outgoers().nodes() : s[h] = p.openNeighborhood().nodes(), c.set(h, 0);
}
for (var f = function(g) {
for (var b = i[g].id(), x = [], w = {}, k = {}, C = {}, _ = new rh(function(me, te) {
return C[me] - C[te];
}), $ = 0; $ < i.length; $++) {
var O = i[$].id();
w[O] = [], k[O] = 0, C[O] = 1 / 0;
}
for (k[b] = 1, C[b] = 0, _.push(b); !_.empty(); ) {
var F = _.pop();
if (x.push(F), o)
for (var A = 0; A < s[F].length; A++) {
var T = s[F][A], R = a.getElementById(F), M = void 0;
R.edgesTo(T).length > 0 ? M = R.edgesTo(T)[0] : M = T.edgesTo(R)[0];
var j = r(M);
T = T.id(), C[T] > C[F] + j && (C[T] = C[F] + j, _.nodes.indexOf(T) < 0 ? _.push(T) : _.updateItem(T), k[T] = 0, w[T] = []), C[T] == C[F] + j && (k[T] = k[T] + k[F], w[T].push(F));
}
else
for (var P = 0; P < s[F].length; P++) {
var V = s[F][P].id();
C[V] == 1 / 0 && (_.push(V), C[V] = C[F] + 1), C[V] == C[F] + 1 && (k[V] = k[V] + k[F], w[V].push(F));
}
}
for (var U = {}, G = 0; G < i.length; G++)
U[i[G].id()] = 0;
for (; x.length > 0; ) {
for (var se = x.pop(), ae = 0; ae < w[se].length; ae++) {
var de = w[se][ae];
U[de] = U[de] + k[de] / k[se] * (1 + U[se]);
}
se != i[g].id() && c.set(se, c.get(se) + U[se]);
}
}, v = 0; v < i.length; v++)
f(v);
var m = {
betweenness: function(g) {
var b = a.collection(g).id();
return c.get(b);
},
betweennessNormalized: function(g) {
if (u == 0)
return 0;
var b = a.collection(g).id();
return c.get(b) / u;
}
};
return m.betweennessNormalised = m.betweennessNormalized, m;
}
// betweennessCentrality
};
HC.bc = HC.betweennessCentrality;
var a1e = Br({
expandFactor: 2,
// affects time of computation and cluster granularity to some extent: M * M
inflateFactor: 2,
// affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j)
multFactor: 1,
// optional self loops for each node. Use a neutral value to improve cluster computations.
maxIterations: 20,
// maximum number of iterations of the MCL algorithm in a single run
attributes: [
// attributes/features used to group nodes, ie. similarity values between nodes
function(e) {
return 1;
}
]
}), i1e = function(e) {
return a1e(e);
}, s1e = function(e, t) {
for (var n = 0, r = 0; r < t.length; r++)
n += t[r](e);
return n;
}, l1e = function(e, t, n) {
for (var r = 0; r < t; r++)
e[r * t + r] = n;
}, HB = function(e, t) {
for (var n, r = 0; r < t; r++) {
n = 0;
for (var o = 0; o < t; o++)
n += e[o * t + r];
for (var a = 0; a < t; a++)
e[a * t + r] = e[a * t + r] / n;
}
}, u1e = function(e, t, n) {
for (var r = new Array(n * n), o = 0; o < n; o++) {
for (var a = 0; a < n; a++)
r[o * n + a] = 0;
for (var i = 0; i < n; i++)
for (var s = 0; s < n; s++)
r[o * n + s] += e[o * n + i] * t[i * n + s];
}
return r;
}, c1e = function(e, t, n) {
for (var r = e.slice(0), o = 1; o < n; o++)
e = u1e(e, r, t);
return e;
}, d1e = function(e, t, n) {
for (var r = new Array(t * t), o = 0; o < t * t; o++)
r[o] = Math.pow(e[o], n);
return HB(r, t), r;
}, p1e = function(e, t, n, r) {
for (var o = 0; o < n; o++) {
var a = Math.round(e[o] * Math.pow(10, r)) / Math.pow(10, r), i = Math.round(t[o] * Math.pow(10, r)) / Math.pow(10, r);
if (a !== i)
return !1;
}
return !0;
}, f1e = function(e, t, n, r) {
for (var o = [], a = 0; a < t; a++) {
for (var i = [], s = 0; s < t; s++)
Math.round(e[a * t + s] * 1e3) / 1e3 > 0 && i.push(n[s]);
i.length !== 0 && o.push(r.collection(i));
}
return o;
}, h1e = function(e, t) {
for (var n = 0; n < e.length; n++)
if (!t[n] || e[n].id() !== t[n].id())
return !1;
return !0;
}, v1e = function(e) {
for (var t = 0; t < e.length; t++)
for (var n = 0; n < e.length; n++)
t != n && h1e(e[t], e[n]) && e.splice(n, 1);
return e;
}, MO = function(e) {
for (var t = this.nodes(), n = this.edges(), r = this.cy(), o = i1e(e), a = {}, i = 0; i < t.length; i++)
a[t[i].id()] = i;
for (var s = t.length, l = s * s, u = new Array(l), c, d = 0; d < l; d++)
u[d] = 0;
for (var p = 0; p < n.length; p++) {
var h = n[p], f = a[h.source().id()], v = a[h.target().id()], m = s1e(h, o.attributes);
u[f * s + v] += m, u[v * s + f] += m;
}
l1e(u, s, o.multFactor), HB(u, s);
for (var g = !0, b = 0; g && b < o.maxIterations; )
g = !1, c = c1e(u, s, o.expandFactor), u = d1e(c, s, o.inflateFactor), p1e(u, c, l, 4) || (g = !0), b++;
var x = f1e(u, s, t, r);
return x = v1e(x), x;
}, g1e = {
markovClustering: MO,
mcl: MO
}, m1e = function(e) {
return e;
}, UB = function(e, t) {
return Math.abs(t - e);
}, DO = function(e, t, n) {
return e + UB(t, n);
}, BO = function(e, t, n) {
return e + Math.pow(n - t, 2);
}, y1e = function(e) {
return Math.sqrt(e);
}, b1e = function(e, t, n) {
return Math.max(e, UB(t, n));
}, ep = function(e, t, n, r, o) {
for (var a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : m1e, i = r, s, l, u = 0; u < e; u++)
s = t(u), l = n(u), i = o(i, s, l);
return a(i);
}, Wc = {
euclidean: function(e, t, n) {
return e >= 2 ? ep(e, t, n, 0, BO, y1e) : ep(e, t, n, 0, DO);
},
squaredEuclidean: function(e, t, n) {
return ep(e, t, n, 0, BO);
},
manhattan: function(e, t, n) {
return ep(e, t, n, 0, DO);
},
max: function(e, t, n) {
return ep(e, t, n, -1 / 0, b1e);
}
};
Wc["squared-euclidean"] = Wc.squaredEuclidean;
Wc.squaredeuclidean = Wc.squaredEuclidean;
function gm(e, t, n, r, o, a) {
var i;
return Nn(e) ? i = e : i = Wc[e] || Wc.euclidean, t === 0 && Nn(e) ? i(o, a) : i(t, n, r, o, a);
}
var w1e = Br({
k: 2,
m: 2,
sensitivityThreshold: 1e-4,
distance: "euclidean",
maxIterations: 10,
attributes: [],
testMode: !1,
testCentroids: null
}), w$ = function(e) {
return w1e(e);
}, Hg = function(e, t, n, r, o) {
var a = o !== "kMedoids", i = a ? function(c) {
return n[c];
} : function(c) {
return r[c](n);
}, s = function(c) {
return r[c](t);
}, l = n, u = t;
return gm(e, r.length, i, s, l, u);
}, hy = function(e, t, n) {
for (var r = n.length, o = new Array(r), a = new Array(r), i = new Array(t), s = null, l = 0; l < r; l++)
o[l] = e.min(n[l]).value, a[l] = e.max(n[l]).value;
for (var u = 0; u < t; u++) {
s = [];
for (var c = 0; c < r; c++)
s[c] = Math.random() * (a[c] - o[c]) + o[c];
i[u] = s;
}
return i;
}, qB = function(e, t, n, r, o) {
for (var a = 1 / 0, i = 0, s = 0; s < t.length; s++) {
var l = Hg(n, e, t[s], r, o);
l < a && (a = l, i = s);
}
return i;
}, KB = function(e, t, n) {
for (var r = [], o = null, a = 0; a < t.length; a++)
o = t[a], n[o.id()] === e && r.push(o);
return r;
}, x1e = function(e, t, n) {
return Math.abs(t - e) <= n;
}, k1e = function(e, t, n) {
for (var r = 0; r < e.length; r++)
for (var o = 0; o < e[r].length; o++) {
var a = Math.abs(e[r][o] - t[r][o]);
if (a > n)
return !1;
}
return !0;
}, C1e = function(e, t, n) {
for (var r = 0; r < n; r++)
if (e === t[r]) return !0;
return !1;
}, zO = function(e, t) {
var n = new Array(t);
if (e.length < 50)
for (var r = 0; r < t; r++) {
for (var o = e[Math.floor(Math.random() * e.length)]; C1e(o, n, r); )
o = e[Math.floor(Math.random() * e.length)];
n[r] = o;
}
else
for (var a = 0; a < t; a++)
n[a] = e[Math.floor(Math.random() * e.length)];
return n;
}, jO = function(e, t, n) {
for (var r = 0, o = 0; o < t.length; o++)
r += Hg("manhattan", t[o], e, n, "kMedoids");
return r;
}, _1e = function(e) {
var t = this.cy(), n = this.nodes(), r = null, o = w$(e), a = new Array(o.k), i = {}, s;
o.testMode ? typeof o.testCentroids == "number" ? (o.testCentroids, s = hy(n, o.k, o.attributes)) : cr(o.testCentroids) === "object" ? s = o.testCentroids : s = hy(n, o.k, o.attributes) : s = hy(n, o.k, o.attributes);
for (var l = !0, u = 0; l && u < o.maxIterations; ) {
for (var c = 0; c < n.length; c++)
r = n[c], i[r.id()] = qB(r, s, o.distance, o.attributes, "kMeans");
l = !1;
for (var d = 0; d < o.k; d++) {
var p = KB(d, n, i);
if (p.length !== 0) {
for (var h = o.attributes.length, f = s[d], v = new Array(h), m = new Array(h), g = 0; g < h; g++) {
m[g] = 0;
for (var b = 0; b < p.length; b++)
r = p[b], m[g] += o.attributes[g](r);
v[g] = m[g] / p.length, x1e(v[g], f[g], o.sensitivityThreshold) || (l = !0);
}
s[d] = v, a[d] = t.collection(p);
}
}
u++;
}
return a;
}, S1e = function(e) {
var t = this.cy(), n = this.nodes(), r = null, o = w$(e), a = new Array(o.k), i, s = {}, l, u = new Array(o.k);
o.testMode ? typeof o.testCentroids == "number" || (cr(o.testCentroids) === "object" ? i = o.testCentroids : i = zO(n, o.k)) : i = zO(n, o.k);
for (var c = !0, d = 0; c && d < o.maxIterations; ) {
for (var p = 0; p < n.length; p++)
r = n[p], s[r.id()] = qB(r, i, o.distance, o.attributes, "kMedoids");
c = !1;
for (var h = 0; h < i.length; h++) {
var f = KB(h, n, s);
if (f.length !== 0) {
u[h] = jO(i[h], f, o.attributes);
for (var v = 0; v < f.length; v++)
l = jO(f[v], f, o.attributes), l < u[h] && (u[h] = l, i[h] = f[v], c = !0);
a[h] = t.collection(f);
}
}
d++;
}
return a;
}, $1e = function(e, t, n, r, o) {
for (var a, i, s = 0; s < t.length; s++)
for (var l = 0; l < e.length; l++)
r[s][l] = Math.pow(n[s][l], o.m);
for (var u = 0; u < e.length; u++)
for (var c = 0; c < o.attributes.length; c++) {
a = 0, i = 0;
for (var d = 0; d < t.length; d++)
a += r[d][u] * o.attributes[c](t[d]), i += r[d][u];
e[u][c] = a / i;
}
}, E1e = function(e, t, n, r, o) {
for (var a = 0; a < e.length; a++)
t[a] = e[a].slice();
for (var i, s, l, u = 2 / (o.m - 1), c = 0; c < n.length; c++)
for (var d = 0; d < r.length; d++) {
i = 0;
for (var p = 0; p < n.length; p++)
s = Hg(o.distance, r[d], n[c], o.attributes, "cmeans"), l = Hg(o.distance, r[d], n[p], o.attributes, "cmeans"), i += Math.pow(s / l, u);
e[d][c] = 1 / i;
}
}, O1e = function(e, t, n, r) {
for (var o = new Array(n.k), a = 0; a < o.length; a++)
o[a] = [];
for (var i, s, l = 0; l < t.length; l++) {
i = -1 / 0, s = -1;
for (var u = 0; u < t[0].length; u++)
t[l][u] > i && (i = t[l][u], s = u);
o[s].push(e[l]);
}
for (var c = 0; c < o.length; c++)
o[c] = r.collection(o[c]);
return o;
}, VO = function(e) {
var t = this.cy(), n = this.nodes(), r = w$(e), o, a, i, s, l;
s = new Array(n.length);
for (var u = 0; u < n.length; u++)
s[u] = new Array(r.k);
i = new Array(n.length);
for (var c = 0; c < n.length; c++)
i[c] = new Array(r.k);
for (var d = 0; d < n.length; d++) {
for (var p = 0, h = 0; h < r.k; h++)
i[d][h] = Math.random(), p += i[d][h];
for (var f = 0; f < r.k; f++)
i[d][f] = i[d][f] / p;
}
a = new Array(r.k);
for (var v = 0; v < r.k; v++)
a[v] = new Array(r.attributes.length);
l = new Array(n.length);
for (var m = 0; m < n.length; m++)
l[m] = new Array(r.k);
for (var g = !0, b = 0; g && b < r.maxIterations; )
g = !1, $1e(a, n, i, l, r), E1e(i, s, a, n, r), k1e(i, s, r.sensitivityThreshold) || (g = !0), b++;
return o = O1e(n, i, r, t), {
clusters: o,
degreeOfMembership: i
};
}, F1e = {
kMeans: _1e,
kMedoids: S1e,
fuzzyCMeans: VO,
fcm: VO
}, T1e = Br({
distance: "euclidean",
// distance metric to compare nodes
linkage: "min",
// linkage criterion : how to determine the distance between clusters of nodes
mode: "threshold",
// mode:'threshold' => clusters must be threshold distance apart
threshold: 1 / 0,
// the distance threshold
// mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters
addDendrogram: !1,
// whether to add the dendrogram to the graph for viz
dendrogramDepth: 0,
// depth at which dendrogram branches are merged into the returned clusters
attributes: []
// array of attr functions
}), A1e = {
single: "min",
complete: "max"
}, I1e = function(e) {
var t = T1e(e), n = A1e[t.linkage];
return n != null && (t.linkage = n), t;
}, HO = function(e, t, n, r, o) {
for (var a = 0, i = 1 / 0, s, l = o.attributes, u = function(_, $) {
return gm(o.distance, l.length, function(O) {
return l[O](_);
}, function(O) {
return l[O]($);
}, _, $);
}, c = 0; c < e.length; c++) {
var d = e[c].key, p = n[d][r[d]];
p < i && (a = d, i = p);
}
if (o.mode === "threshold" && i >= o.threshold || o.mode === "dendrogram" && e.length === 1)
return !1;
var h = t[a], f = t[r[a]], v;
o.mode === "dendrogram" ? v = {
left: h,
right: f,
key: h.key
} : v = {
value: h.value.concat(f.value),
key: h.key
}, e[h.index] = v, e.splice(f.index, 1), t[h.key] = v;
for (var m = 0; m < e.length; m++) {
var g = e[m];
h.key === g.key ? s = 1 / 0 : o.linkage === "min" ? (s = n[h.key][g.key], n[h.key][g.key] > n[f.key][g.key] && (s = n[f.key][g.key])) : o.linkage === "max" ? (s = n[h.key][g.key], n[h.key][g.key] < n[f.key][g.key] && (s = n[f.key][g.key])) : o.linkage === "mean" ? s = (n[h.key][g.key] * h.size + n[f.key][g.key] * f.size) / (h.size + f.size) : o.mode === "dendrogram" ? s = u(g.value, h.value) : s = u(g.value[0], h.value[0]), n[h.key][g.key] = n[g.key][h.key] = s;
}
for (var b = 0; b < e.length; b++) {
var x = e[b].key;
if (r[x] === h.key || r[x] === f.key) {
for (var w = x, k = 0; k < e.length; k++) {
var C = e[k].key;
n[x][C] < n[x][w] && (w = C);
}
r[x] = w;
}
e[b].index = b;
}
return h.key = f.key = h.index = f.index = null, !0;
}, av = function e(t, n, r) {
t && (t.value ? n.push(t.value) : (t.left && e(t.left, n), t.right && e(t.right, n)));
}, P1e = function e(t, n) {
if (!t) return "";
if (t.left && t.right) {
var r = e(t.left, n), o = e(t.right, n), a = n.add({
group: "nodes",
data: {
id: r + "," + o
}
});
return n.add({
group: "edges",
data: {
source: r,
target: a.id()
}
}), n.add({
group: "edges",
data: {
source: o,
target: a.id()
}
}), a.id();
} else if (t.value)
return t.value.id();
}, L1e = function e(t, n, r) {
if (!t) return [];
var o = [], a = [], i = [];
return n === 0 ? (t.left && av(t.left, o), t.right && av(t.right, a), i = o.concat(a), [r.collection(i)]) : n === 1 ? t.value ? [r.collection(t.value)] : (t.left && av(t.left, o), t.right && av(t.right, a), [r.collection(o), r.collection(a)]) : t.value ? [r.collection(t.value)] : (t.left && (o = e(t.left, n - 1, r)), t.right && (a = e(t.right, n - 1, r)), o.concat(a));
}, UO = function(e) {
for (var t = this.cy(), n = this.nodes(), r = I1e(e), o = r.attributes, a = function(g, b) {
return gm(r.distance, o.length, function(x) {
return o[x](g);
}, function(x) {
return o[x](b);
}, g, b);
}, i = [], s = [], l = [], u = [], c = 0; c < n.length; c++) {
var d = {
value: r.mode === "dendrogram" ? n[c] : [n[c]],
key: c,
index: c
};
i[c] = d, u[c] = d, s[c] = [], l[c] = 0;
}
for (var p = 0; p < i.length; p++)
for (var h = 0; h <= p; h++) {
var f = void 0;
r.mode === "dendrogram" ? f = p === h ? 1 / 0 : a(i[p].value, i[h].value) : f = p === h ? 1 / 0 : a(i[p].value[0], i[h].value[0]), s[p][h] = f, s[h][p] = f, f < s[p][l[p]] && (l[p] = h);
}
for (var v = HO(i, u, s, l, r); v; )
v = HO(i, u, s, l, r);
var m;
return r.mode === "dendrogram" ? (m = L1e(i[0], r.dendrogramDepth, t), r.addDendrogram && P1e(i[0], t)) : (m = new Array(i.length), i.forEach(function(g, b) {
g.key = g.index = null, m[b] = t.collection(g.value);
})), m;
}, R1e = {
hierarchicalClustering: UO,
hca: UO
}, N1e = Br({
distance: "euclidean",
// distance metric to compare attributes between two nodes
preference: "median",
// suitability of a data point to serve as an exemplar
damping: 0.8,
// damping factor between [0.5, 1)
maxIterations: 1e3,
// max number of iterations to run
minIterations: 100,
// min number of iterations to run in order for clustering to stop
attributes: [
// functions to quantify the similarity between any two points
// e.g. node => node.data('weight')
]
}), M1e = function(e) {
var t = e.damping, n = e.preference;
0.5 <= t && t < 1 || Un("Damping must range on [0.5, 1). Got: ".concat(t));
var r = ["median", "mean", "min", "max"];
return r.some(function(o) {
return o === n;
}) || Ze(n) || Un("Preference must be one of [".concat(r.map(function(o) {
return "'".concat(o, "'");
}).join(", "), "] or a number. Got: ").concat(n)), N1e(e);
}, D1e = function(e, t, n, r) {
var o = function(a, i) {
return r[i](a);
};
return -gm(e, r.length, function(a) {
return o(t, a);
}, function(a) {
return o(n, a);
}, t, n);
}, B1e = function(e, t) {
var n = null;
return t === "median" ? n = Mme(e) : t === "mean" ? n = Nme(e) : t === "min" ? n = Lme(e) : t === "max" ? n = Rme(e) : n = t, n;
}, z1e = function(e, t, n) {
for (var r = [], o = 0; o < e; o++)
t[o * e + o] + n[o * e + o] > 0 && r.push(o);
return r;
}, qO = function(e, t, n) {
for (var r = [], o = 0; o < e; o++) {
for (var a = -1, i = -1 / 0, s = 0; s < n.length; s++) {
var l = n[s];
t[o * e + l] > i && (a = l, i = t[o * e + l]);
}
a > 0 && r.push(a);
}
for (var u = 0; u < n.length; u++)
r[n[u]] = n[u];
return r;
}, j1e = function(e, t, n) {
for (var r = qO(e, t, n), o = 0; o < n.length; o++) {
for (var a = [], i = 0; i < r.length; i++)
r[i] === n[o] && a.push(i);
for (var s = -1, l = -1 / 0, u = 0; u < a.length; u++) {
for (var c = 0, d = 0; d < a.length; d++)
c += t[a[d] * e + a[u]];
c > l && (s = u, l = c);
}
n[o] = a[s];
}
return r = qO(e, t, n), r;
}, KO = function(e) {
for (var t = this.cy(), n = this.nodes(), r = M1e(e), o = {}, a = 0; a < n.length; a++)
o[n[a].id()] = a;
var i, s, l, u, c, d;
i = n.length, s = i * i, l = new Array(s);
for (var p = 0; p < s; p++)
l[p] = -1 / 0;
for (var h = 0; h < i; h++)
for (var f = 0; f < i; f++)
h !== f && (l[h * i + f] = D1e(r.distance, n[h], n[f], r.attributes));
u = B1e(l, r.preference);
for (var v = 0; v < i; v++)
l[v * i + v] = u;
c = new Array(s);
for (var m = 0; m < s; m++)
c[m] = 0;
d = new Array(s);
for (var g = 0; g < s; g++)
d[g] = 0;
for (var b = new Array(i), x = new Array(i), w = new Array(i), k = 0; k < i; k++)
b[k] = 0, x[k] = 0, w[k] = 0;
for (var C = new Array(i * r.minIterations), _ = 0; _ < C.length; _++)
C[_] = 0;
var $;
for ($ = 0; $ < r.maxIterations; $++) {
for (var O = 0; O < i; O++) {
for (var F = -1 / 0, A = -1 / 0, T = -1, R = 0, M = 0; M < i; M++)
b[M] = c[O * i + M], R = d[O * i + M] + l[O * i + M], R >= F ? (A = F, F = R, T = M) : R > A && (A = R);
for (var j = 0; j < i; j++)
c[O * i + j] = (1 - r.damping) * (l[O * i + j] - F) + r.damping * b[j];
c[O * i + T] = (1 - r.damping) * (l[O * i + T] - A) + r.damping * b[T];
}
for (var P = 0; P < i; P++) {
for (var V = 0, U = 0; U < i; U++)
b[U] = d[U * i + P], x[U] = Math.max(0, c[U * i + P]), V += x[U];
V -= x[P], x[P] = c[P * i + P], V += x[P];
for (var G = 0; G < i; G++)
d[G * i + P] = (1 - r.damping) * Math.min(0, V - x[G]) + r.damping * b[G];
d[P * i + P] = (1 - r.damping) * (V - x[P]) + r.damping * b[P];
}
for (var se = 0, ae = 0; ae < i; ae++) {
var de = d[ae * i + ae] + c[ae * i + ae] > 0 ? 1 : 0;
C[$ % r.minIterations * i + ae] = de, se += de;
}
if (se > 0 && ($ >= r.minIterations - 1 || $ == r.maxIterations - 1)) {
for (var me = 0, te = 0; te < i; te++) {
w[te] = 0;
for (var oe = 0; oe < r.minIterations; oe++)
w[te] += C[oe * i + te];
(w[te] === 0 || w[te] === r.minIterations) && me++;
}
if (me === i)
break;
}
}
for (var ne = z1e(i, c, d), ee = j1e(i, l, ne), Z = {}, le = 0; le < ne.length; le++)
Z[ne[le]] = [];
for (var pe = 0; pe < n.length; pe++) {
var ke = o[n[pe].id()], Ne = ee[ke];
Ne != null && Z[Ne].push(n[pe]);
}
for (var De = new Array(ne.length), _e = 0; _e < ne.length; _e++)
De[_e] = t.collection(Z[ne[_e]]);
return De;
}, V1e = {
affinityPropagation: KO,
ap: KO
}, H1e = Br({
root: void 0,
directed: !1
}), U1e = {
hierholzer: function(e) {
if (!Xt(e)) {
var t = arguments;
e = {
root: t[0],
directed: t[1]
};
}
var n = H1e(e), r = n.root, o = n.directed, a = this, i = !1, s, l, u;
r && (u = gt(r) ? this.filter(r)[0].id() : r[0].id());
var c = {}, d = {};
o ? a.forEach(function(g) {
var b = g.id();
if (g.isNode()) {
var x = g.indegree(!0), w = g.outdegree(!0), k = x - w, C = w - x;
k == 1 ? s ? i = !0 : s = b : C == 1 ? l ? i = !0 : l = b : (C > 1 || k > 1) && (i = !0), c[b] = [], g.outgoers().forEach(function(_) {
_.isEdge() && c[b].push(_.id());
});
} else
d[b] = [void 0, g.target().id()];
}) : a.forEach(function(g) {
var b = g.id();
if (g.isNode()) {
var x = g.degree(!0);
x % 2 && (s ? l ? i = !0 : l = b : s = b), c[b] = [], g.connectedEdges().forEach(function(w) {
return c[b].push(w.id());
});
} else
d[b] = [g.source().id(), g.target().id()];
});
var p = {
found: !1,
trail: void 0
};
if (i) return p;
if (l && s)
if (o) {
if (u && l != u)
return p;
u = l;
} else {
if (u && l != u && s != u)
return p;
u || (u = l);
}
else
u || (u = a[0].id());
var h = function(g) {
for (var b = g, x = [g], w, k, C; c[b].length; )
w = c[b].shift(), k = d[w][0], C = d[w][1], b != C ? (c[C] = c[C].filter(function(_) {
return _ != w;
}), b = C) : !o && b != k && (c[k] = c[k].filter(function(_) {
return _ != w;
}), b = k), x.unshift(w), x.unshift(b);
return x;
}, f = [], v = [];
for (v = h(u); v.length != 1; )
c[v[0]].length == 0 ? (f.unshift(a.getElementById(v.shift())), f.unshift(a.getElementById(v.shift()))) : v = h(v.shift()).concat(v);
f.unshift(a.getElementById(v.shift()));
for (var m in c)
if (c[m].length)
return p;
return p.found = !0, p.trail = this.spawn(f, !0), p;
}
}, iv = function() {
var e = this, t = {}, n = 0, r = 0, o = [], a = [], i = {}, s = function(c, d) {
for (var p = a.length - 1, h = [], f = e.spawn(); a[p].x != c || a[p].y != d; )
h.push(a.pop().edge), p--;
h.push(a.pop().edge), h.forEach(function(v) {
var m = v.connectedNodes().intersection(e);
f.merge(v), m.forEach(function(g) {
var b = g.id(), x = g.connectedEdges().intersection(e);
f.merge(g), t[b].cutVertex ? f.merge(x.filter(function(w) {
return w.isLoop();
})) : f.merge(x);
});
}), o.push(f);
}, l = function c(d, p, h) {
d === h && (r += 1), t[p] = {
id: n,
low: n++,
cutVertex: !1
};
var f = e.getElementById(p).connectedEdges().intersection(e);
if (f.size() === 0)
o.push(e.spawn(e.getElementById(p)));
else {
var v, m, g, b;
f.forEach(function(x) {
v = x.source().id(), m = x.target().id(), g = v === p ? m : v, g !== h && (b = x.id(), i[b] || (i[b] = !0, a.push({
x: p,
y: g,
edge: x
})), g in t ? t[p].low = Math.min(t[p].low, t[g].id) : (c(d, g, p), t[p].low = Math.min(t[p].low, t[g].low), t[p].id <= t[g].low && (t[p].cutVertex = !0, s(p, g))));
});
}
};
e.forEach(function(c) {
if (c.isNode()) {
var d = c.id();
d in t || (r = 0, l(d, d), t[d].cutVertex = r > 1);
}
});
var u = Object.keys(t).filter(function(c) {
return t[c].cutVertex;
}).map(function(c) {
return e.getElementById(c);
});
return {
cut: e.spawn(u),
components: o
};
}, q1e = {
hopcroftTarjanBiconnected: iv,
htbc: iv,
htb: iv,
hopcroftTarjanBiconnectedComponents: iv
}, sv = function() {
var e = this, t = {}, n = 0, r = [], o = [], a = e.spawn(e), i = function s(l) {
o.push(l), t[l] = {
index: n,
low: n++,
explored: !1
};
var u = e.getElementById(l).connectedEdges().intersection(e);
if (u.forEach(function(f) {
var v = f.target().id();
v !== l && (v in t || s(v), t[v].explored || (t[l].low = Math.min(t[l].low, t[v].low)));
}), t[l].index === t[l].low) {
for (var c = e.spawn(); ; ) {
var d = o.pop();
if (c.merge(e.getElementById(d)), t[d].low = t[l].index, t[d].explored = !0, d === l)
break;
}
var p = c.edgesWith(c), h = c.merge(p);
r.push(h), a = a.difference(h);
}
};
return e.forEach(function(s) {
if (s.isNode()) {
var l = s.id();
l in t || i(l);
}
}), {
cut: a,
components: r
};
}, K1e = {
tarjanStronglyConnected: sv,
tsc: sv,
tscc: sv,
tarjanStronglyConnectedComponents: sv
}, GB = {};
[lf, kme, Cme, Sme, Eme, Fme, Ime, r1e, $c, Ec, HC, g1e, F1e, R1e, V1e, U1e, q1e, K1e].forEach(function(e) {
_t(GB, e);
});
/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/
var WB = 0, YB = 1, XB = 2, os = function e(t) {
if (!(this instanceof e)) return new e(t);
this.id = "Thenable/1.0.7", this.state = WB, this.fulfillValue = void 0, this.rejectReason = void 0, this.onFulfilled = [], this.onRejected = [], this.proxy = {
then: this.then.bind(this)
}, typeof t == "function" && t.call(this, this.fulfill.bind(this), this.reject.bind(this));
};
os.prototype = {
/* promise resolving methods */
fulfill: function(e) {
return GO(this, YB, "fulfillValue", e);
},
reject: function(e) {
return GO(this, XB, "rejectReason", e);
},
/* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */
then: function(e, t) {
var n = this, r = new os();
return n.onFulfilled.push(YO(e, r, "fulfill")), n.onRejected.push(YO(t, r, "reject")), ZB(n), r.proxy;
}
};
var GO = function(e, t, n, r) {
return e.state === WB && (e.state = t, e[n] = r, ZB(e)), e;
}, ZB = function(e) {
e.state === YB ? WO(e, "onFulfilled", e.fulfillValue) : e.state === XB && WO(e, "onRejected", e.rejectReason);
}, WO = function(e, t, n) {
if (e[t].length !== 0) {
var r = e[t];
e[t] = [];
var o = function() {
for (var a = 0; a < r.length; a++)
r[a](n);
};
typeof setImmediate == "function" ? setImmediate(o) : setTimeout(o, 0);
}
}, YO = function(e, t, n) {
return function(r) {
if (typeof e != "function")
t[n].call(t, r);
else {
var o;
try {
o = e(r);
} catch (a) {
t.reject(a);
return;
}
G1e(t, o);
}
};
}, G1e = function e(t, n) {
if (t === n || t.proxy === n) {
t.reject(new TypeError("cannot resolve promise with itself"));
return;
}
var r;
if (cr(n) === "object" && n !== null || typeof n == "function")
try {
r = n.then;
} catch (a) {
t.reject(a);
return;
}
if (typeof r == "function") {
var o = !1;
try {
r.call(
n,
/* resolvePromise */
/* [Promises/A+ 2.3.3.3.1] */
function(a) {
o || (o = !0, a === n ? t.reject(new TypeError("circular thenable chain")) : e(t, a));
},
/* rejectPromise */
/* [Promises/A+ 2.3.3.3.2] */
function(a) {
o || (o = !0, t.reject(a));
}
);
} catch (a) {
o || t.reject(a);
}
return;
}
t.fulfill(n);
};
os.all = function(e) {
return new os(function(t, n) {
for (var r = new Array(e.length), o = 0, a = function(s, l) {
r[s] = l, o++, o === e.length && t(r);
}, i = 0; i < e.length; i++)
(function(s) {
var l = e[s], u = l != null && l.then != null;
if (u)
l.then(function(d) {
a(s, d);
}, function(d) {
n(d);
});
else {
var c = l;
a(s, c);
}
})(i);
});
};
os.resolve = function(e) {
return new os(function(t, n) {
t(e);
});
};
os.reject = function(e) {
return new os(function(t, n) {
n(e);
});
};
var md = typeof Promise < "u" ? Promise : os, UC = function(e, t, n) {
var r = p$(e), o = !r, a = this._private = _t({
duration: 1e3
}, t, n);
if (a.target = e, a.style = a.style || a.css, a.started = !1, a.playing = !1, a.hooked = !1, a.applying = !1, a.progress = 0, a.completes = [], a.frames = [], a.complete && Nn(a.complete) && a.completes.push(a.complete), o) {
var i = e.position();
a.startPosition = a.startPosition || {
x: i.x,
y: i.y
}, a.startStyle = a.startStyle || e.cy().style().getAnimationStartStyle(e, a.style);
}
if (r) {
var s = e.pan();
a.startPan = {
x: s.x,
y: s.y
}, a.startZoom = e.zoom();
}
this.length = 1, this[0] = this;
}, vu = UC.prototype;
_t(vu, {
instanceString: function() {
return "animation";
},
hook: function() {
var e = this._private;
if (!e.hooked) {
var t, n = e.target._private.animation;
e.queue ? t = n.queue : t = n.current, t.push(this), Mo(e.target) && e.target.cy().addToAnimationPool(e.target), e.hooked = !0;
}
return this;
},
play: function() {
var e = this._private;
return e.progress === 1 && (e.progress = 0), e.playing = !0, e.started = !1, e.stopped = !1, this.hook(), this;
},
playing: function() {
return this._private.playing;
},
apply: function() {
var e = this._private;
return e.applying = !0, e.started = !1, e.stopped = !1, this.hook(), this;
},
applying: function() {
return this._private.applying;
},
pause: function() {
var e = this._private;
return e.playing = !1, e.started = !1, this;
},
stop: function() {
var e = this._private;
return e.playing = !1, e.started = !1, e.stopped = !0, this;
},
rewind: function() {
return this.progress(0);
},
fastforward: function() {
return this.progress(1);
},
time: function(e) {
var t = this._private;
return e === void 0 ? t.progress * t.duration : this.progress(e / t.duration);
},
progress: function(e) {
var t = this._private, n = t.playing;
return e === void 0 ? t.progress : (n && this.pause(), t.progress = e, t.started = !1, n && this.play(), this);
},
completed: function() {
return this._private.progress === 1;
},
reverse: function() {
var e = this._private, t = e.playing;
t && this.pause(), e.progress = 1 - e.progress, e.started = !1;
var n = function(s, l) {
var u = e[s];
u != null && (e[s] = e[l], e[l] = u);
};
if (n("zoom", "startZoom"), n("pan", "startPan"), n("position", "startPosition"), e.style)
for (var r = 0; r < e.style.length; r++) {
var o = e.style[r], a = o.name, i = e.startStyle[a];
e.startStyle[a] = o, e.style[r] = i;
}
return t && this.play(), this;
},
promise: function(e) {
var t = this._private, n;
switch (e) {
case "frame":
n = t.frames;
break;
default:
case "complete":
case "completed":
n = t.completes;
}
return new md(function(r, o) {
n.push(function() {
r();
});
});
}
});
vu.complete = vu.completed;
vu.run = vu.play;
vu.running = vu.playing;
var W1e = {
animated: function() {
return function() {
var e = this, t = e.length !== void 0, n = t ? e : [e], r = this._private.cy || this;
if (!r.styleEnabled())
return !1;
var o = n[0];
if (o)
return o._private.animation.current.length > 0;
};
},
// animated
clearQueue: function() {
return function() {
var e = this, t = e.length !== void 0, n = t ? e : [e], r = this._private.cy || this;
if (!r.styleEnabled())
return this;
for (var o = 0; o < n.length; o++) {
var a = n[o];
a._private.animation.queue = [];
}
return this;
};
},
// clearQueue
delay: function() {
return function(e, t) {
var n = this._private.cy || this;
return n.styleEnabled() ? this.animate({
delay: e,
duration: e,
complete: t
}) : this;
};
},
// delay
delayAnimation: function() {
return function(e, t) {
var n = this._private.cy || this;
return n.styleEnabled() ? this.animation({
delay: e,
duration: e,
complete: t
}) : this;
};
},
// delay
animation: function() {
return function(e, t) {
var n = this, r = n.length !== void 0, o = r ? n : [n], a = this._private.cy || this, i = !r, s = !i;
if (!a.styleEnabled())
return this;
var l = a.style();
e = _t({}, e, t);
var u = Object.keys(e).length === 0;
if (u)
return new UC(o[0], e);
switch (e.duration === void 0 && (e.duration = 400), e.duration) {
case "slow":
e.duration = 600;
break;
case "fast":
e.duration = 200;
break;
}
if (s && (e.style = l.getPropsList(e.style || e.css), e.css = void 0), s && e.renderedPosition != null) {
var c = e.renderedPosition, d = a.pan(), p = a.zoom();
e.position = NB(c, p, d);
}
if (i && e.panBy != null) {
var h = e.panBy, f = a.pan();
e.pan = {
x: f.x + h.x,
y: f.y + h.y
};
}
var v = e.center || e.centre;
if (i && v != null) {
var m = a.getCenterPan(v.eles, e.zoom);
m != null && (e.pan = m);
}
if (i && e.fit != null) {
var g = e.fit, b = a.getFitViewport(g.eles || g.boundingBox, g.padding);
b != null && (e.pan = b.pan, e.zoom = b.zoom);
}
if (i && Xt(e.zoom)) {
var x = a.getZoomedViewport(e.zoom);
x != null ? (x.zoomed && (e.zoom = x.zoom), x.panned && (e.pan = x.pan)) : e.zoom = null;
}
return new UC(o[0], e);
};
},
// animate
animate: function() {
return function(e, t) {
var n = this, r = n.length !== void 0, o = r ? n : [n], a = this._private.cy || this;
if (!a.styleEnabled())
return this;
t && (e = _t({}, e, t));
for (var i = 0; i < o.length; i++) {
var s = o[i], l = s.animated() && (e.queue === void 0 || e.queue), u = s.animation(e, l ? {
queue: !0
} : void 0);
u.play();
}
return this;
};
},
// animate
stop: function() {
return function(e, t) {
var n = this, r = n.length !== void 0, o = r ? n : [n], a = this._private.cy || this;
if (!a.styleEnabled())
return this;
for (var i = 0; i < o.length; i++) {
for (var s = o[i], l = s._private, u = l.animation.current, c = 0; c < u.length; c++) {
var d = u[c], p = d._private;
t && (p.duration = 0);
}
e && (l.animation.queue = []), t || (l.animation.current = []);
}
return a.notify("draw"), this;
};
}
// stop
}, Y1e = Array.isArray, mm = Y1e, X1e = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Z1e = /^\w*$/;
function J1e(e, t) {
if (mm(e))
return !1;
var n = typeof e;
return n == "number" || n == "symbol" || n == "boolean" || e == null || nh(e) ? !0 : Z1e.test(e) || !X1e.test(e) || t != null && e in Object(t);
}
var Q1e = J1e, eye = "[object AsyncFunction]", tye = "[object Function]", nye = "[object GeneratorFunction]", rye = "[object Proxy]";
function oye(e) {
if (!du(e))
return !1;
var t = EB(e);
return t == tye || t == nye || t == eye || t == rye;
}
var aye = oye, iye = pm["__core-js_shared__"], vy = iye, XO = function() {
var e = /[^.]+$/.exec(vy && vy.keys && vy.keys.IE_PROTO || "");
return e ? "Symbol(src)_1." + e : "";
}();
function sye(e) {
return !!XO && XO in e;
}
var lye = sye, uye = Function.prototype, cye = uye.toString;
function dye(e) {
if (e != null) {
try {
return cye.call(e);
} catch {
}
try {
return e + "";
} catch {
}
}
return "";
}
var pye = dye, fye = /[\\^$.*+?()[\]{}|]/g, hye = /^\[object .+?Constructor\]$/, vye = Function.prototype, gye = Object.prototype, mye = vye.toString, yye = gye.hasOwnProperty, bye = RegExp(
"^" + mye.call(yye).replace(fye, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function wye(e) {
if (!du(e) || lye(e))
return !1;
var t = aye(e) ? bye : hye;
return t.test(pye(e));
}
var xye = wye;
function kye(e, t) {
return e == null ? void 0 : e[t];
}
var Cye = kye;
function _ye(e, t) {
var n = Cye(e, t);
return xye(n) ? n : void 0;
}
var x$ = _ye, Sye = x$(Object, "create"), df = Sye;
function $ye() {
this.__data__ = df ? df(null) : {}, this.size = 0;
}
var Eye = $ye;
function Oye(e) {
var t = this.has(e) && delete this.__data__[e];
return this.size -= t ? 1 : 0, t;
}
var Fye = Oye, Tye = "__lodash_hash_undefined__", Aye = Object.prototype, Iye = Aye.hasOwnProperty;
function Pye(e) {
var t = this.__data__;
if (df) {
var n = t[e];
return n === Tye ? void 0 : n;
}
return Iye.call(t, e) ? t[e] : void 0;
}
var Lye = Pye, Rye = Object.prototype, Nye = Rye.hasOwnProperty;
function Mye(e) {
var t = this.__data__;
return df ? t[e] !== void 0 : Nye.call(t, e);
}
var Dye = Mye, Bye = "__lodash_hash_undefined__";
function zye(e, t) {
var n = this.__data__;
return this.size += this.has(e) ? 0 : 1, n[e] = df && t === void 0 ? Bye : t, this;
}
var jye = zye;
function yd(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
yd.prototype.clear = Eye;
yd.prototype.delete = Fye;
yd.prototype.get = Lye;
yd.prototype.has = Dye;
yd.prototype.set = jye;
var ZO = yd;
function Vye() {
this.__data__ = [], this.size = 0;
}
var Hye = Vye;
function Uye(e, t) {
return e === t || e !== e && t !== t;
}
var JB = Uye;
function qye(e, t) {
for (var n = e.length; n--; )
if (JB(e[n][0], t))
return n;
return -1;
}
var ym = qye, Kye = Array.prototype, Gye = Kye.splice;
function Wye(e) {
var t = this.__data__, n = ym(t, e);
if (n < 0)
return !1;
var r = t.length - 1;
return n == r ? t.pop() : Gye.call(t, n, 1), --this.size, !0;
}
var Yye = Wye;
function Xye(e) {
var t = this.__data__, n = ym(t, e);
return n < 0 ? void 0 : t[n][1];
}
var Zye = Xye;
function Jye(e) {
return ym(this.__data__, e) > -1;
}
var Qye = Jye;
function ebe(e, t) {
var n = this.__data__, r = ym(n, e);
return r < 0 ? (++this.size, n.push([e, t])) : n[r][1] = t, this;
}
var tbe = ebe;
function bd(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
bd.prototype.clear = Hye;
bd.prototype.delete = Yye;
bd.prototype.get = Zye;
bd.prototype.has = Qye;
bd.prototype.set = tbe;
var nbe = bd, rbe = x$(pm, "Map"), obe = rbe;
function abe() {
this.size = 0, this.__data__ = {
hash: new ZO(),
map: new (obe || nbe)(),
string: new ZO()
};
}
var ibe = abe;
function sbe(e) {
var t = typeof e;
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
}
var lbe = sbe;
function ube(e, t) {
var n = e.__data__;
return lbe(t) ? n[typeof t == "string" ? "string" : "hash"] : n.map;
}
var bm = ube;
function cbe(e) {
var t = bm(this, e).delete(e);
return this.size -= t ? 1 : 0, t;
}
var dbe = cbe;
function pbe(e) {
return bm(this, e).get(e);
}
var fbe = pbe;
function hbe(e) {
return bm(this, e).has(e);
}
var vbe = hbe;
function gbe(e, t) {
var n = bm(this, e), r = n.size;
return n.set(e, t), this.size += n.size == r ? 0 : 1, this;
}
var mbe = gbe;
function wd(e) {
var t = -1, n = e == null ? 0 : e.length;
for (this.clear(); ++t < n; ) {
var r = e[t];
this.set(r[0], r[1]);
}
}
wd.prototype.clear = ibe;
wd.prototype.delete = dbe;
wd.prototype.get = fbe;
wd.prototype.has = vbe;
wd.prototype.set = mbe;
var QB = wd, ybe = "Expected a function";
function k$(e, t) {
if (typeof e != "function" || t != null && typeof t != "function")
throw new TypeError(ybe);
var n = function() {
var r = arguments, o = t ? t.apply(this, r) : r[0], a = n.cache;
if (a.has(o))
return a.get(o);
var i = e.apply(this, r);
return n.cache = a.set(o, i) || a, i;
};
return n.cache = new (k$.Cache || QB)(), n;
}
k$.Cache = QB;
var bbe = k$, wbe = 500;
function xbe(e) {
var t = bbe(e, function(r) {
return n.size === wbe && n.clear(), r;
}), n = t.cache;
return t;
}
var kbe = xbe, Cbe = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, _be = /\\(\\)?/g, Sbe = kbe(function(e) {
var t = [];
return e.charCodeAt(0) === 46 && t.push(""), e.replace(Cbe, function(n, r, o, a) {
t.push(o ? a.replace(_be, "$1") : r || n);
}), t;
}), ez = Sbe;
function $be(e, t) {
for (var n = -1, r = e == null ? 0 : e.length, o = Array(r); ++n < r; )
o[n] = t(e[n], n, e);
return o;
}
var tz = $be, Ebe = 1 / 0, JO = Kc ? Kc.prototype : void 0, QO = JO ? JO.toString : void 0;
function nz(e) {
if (typeof e == "string")
return e;
if (mm(e))
return tz(e, nz) + "";
if (nh(e))
return QO ? QO.call(e) : "";
var t = e + "";
return t == "0" && 1 / e == -Ebe ? "-0" : t;
}
var Obe = nz;
function Fbe(e) {
return e == null ? "" : Obe(e);
}
var rz = Fbe;
function Tbe(e, t) {
return mm(e) ? e : Q1e(e, t) ? [e] : ez(rz(e));
}
var oz = Tbe, Abe = 1 / 0;
function Ibe(e) {
if (typeof e == "string" || nh(e))
return e;
var t = e + "";
return t == "0" && 1 / e == -Abe ? "-0" : t;
}
var C$ = Ibe;
function Pbe(e, t) {
t = oz(t, e);
for (var n = 0, r = t.length; e != null && n < r; )
e = e[C$(t[n++])];
return n && n == r ? e : void 0;
}
var Lbe = Pbe;
function Rbe(e, t, n) {
var r = e == null ? void 0 : Lbe(e, t);
return r === void 0 ? n : r;
}
var Nbe = Rbe, Mbe = function() {
try {
var e = x$(Object, "defineProperty");
return e({}, "", {}), e;
} catch {
}
}(), eF = Mbe;
function Dbe(e, t, n) {
t == "__proto__" && eF ? eF(e, t, {
configurable: !0,
enumerable: !0,
value: n,
writable: !0
}) : e[t] = n;
}
var Bbe = Dbe, zbe = Object.prototype, jbe = zbe.hasOwnProperty;
function Vbe(e, t, n) {
var r = e[t];
(!(jbe.call(e, t) && JB(r, n)) || n === void 0 && !(t in e)) && Bbe(e, t, n);
}
var Hbe = Vbe, Ube = 9007199254740991, qbe = /^(?:0|[1-9]\d*)$/;
function Kbe(e, t) {
var n = typeof e;
return t = t ?? Ube, !!t && (n == "number" || n != "symbol" && qbe.test(e)) && e > -1 && e % 1 == 0 && e < t;
}
var Gbe = Kbe;
function Wbe(e, t, n, r) {
if (!du(e))
return e;
t = oz(t, e);
for (var o = -1, a = t.length, i = a - 1, s = e; s != null && ++o < a; ) {
var l = C$(t[o]), u = n;
if (l === "__proto__" || l === "constructor" || l === "prototype")
return e;
if (o != i) {
var c = s[l];
u = r ? r(c, l, s) : void 0, u === void 0 && (u = du(c) ? c : Gbe(t[o + 1]) ? [] : {});
}
Hbe(s, l, u), s = s[l];
}
return e;
}
var Ybe = Wbe;
function Xbe(e, t, n) {
return e == null ? e : Ybe(e, t, n);
}
var Zbe = Xbe;
function Jbe(e, t) {
var n = -1, r = e.length;
for (t || (t = Array(r)); ++n < r; )
t[n] = e[n];
return t;
}
var Qbe = Jbe;
function ewe(e) {
return mm(e) ? tz(e, C$) : nh(e) ? [e] : Qbe(ez(rz(e)));
}
var twe = ewe, nwe = {
// access data field
data: function(e) {
var t = {
field: "data",
bindingEvent: "data",
allowBinding: !1,
allowSetting: !1,
allowGetting: !1,
settingEvent: "data",
settingTriggersEvent: !1,
triggerFnName: "trigger",
immutableKeys: {},
// key => true if immutable
updateStyle: !1,
beforeGet: function(n) {
},
beforeSet: function(n, r) {
},
onSet: function(n) {
},
canSet: function(n) {
return !0;
}
};
return e = _t({}, t, e), function(n, r) {
var o = e, a = this, i = a.length !== void 0, s = i ? a : [a], l = i ? a[0] : a;
if (gt(n)) {
var u = n.indexOf(".") !== -1, c = u && twe(n);
if (o.allowGetting && r === void 0) {
var d;
return l && (o.beforeGet(l), c && l._private[o.field][n] === void 0 ? d = Nbe(l._private[o.field], c) : d = l._private[o.field][n]), d;
} else if (o.allowSetting && r !== void 0) {
var p = !o.immutableKeys[n];
if (p) {
var h = gB({}, n, r);
o.beforeSet(a, h);
for (var f = 0, v = s.length; f < v; f++) {
var m = s[f];
o.canSet(m) && (c && l._private[o.field][n] === void 0 ? Zbe(m._private[o.field], c, r) : m._private[o.field][n] = r);
}
o.updateStyle && a.updateStyle(), o.onSet(a), o.settingTriggersEvent && a[o.triggerFnName](o.settingEvent);
}
}
} else if (o.allowSetting && Xt(n)) {
var g = n, b, x, w = Object.keys(g);
o.beforeSet(a, g);
for (var k = 0; k < w.length; k++) {
b = w[k], x = g[b];
var C = !o.immutableKeys[b];
if (C)
for (var _ = 0; _ < s.length; _++) {
var $ = s[_];
o.canSet($) && ($._private[o.field][b] = x);
}
}
o.updateStyle && a.updateStyle(), o.onSet(a), o.settingTriggersEvent && a[o.triggerFnName](o.settingEvent);
} else if (o.allowBinding && Nn(n)) {
var O = n;
a.on(o.bindingEvent, O);
} else if (o.allowGetting && n === void 0) {
var F;
return l && (o.beforeGet(l), F = l._private[o.field]), F;
}
return a;
};
},
// data
// remove data field
removeData: function(e) {
var t = {
field: "data",
event: "data",
triggerFnName: "trigger",
triggerEvent: !1,
immutableKeys: {}
// key => true if immutable
};
return e = _t({}, t, e), function(n) {
var r = e, o = this, a = o.length !== void 0, i = a ? o : [o];
if (gt(n)) {
for (var s = n.split(/\s+/), l = s.length, u = 0; u < l; u++) {
var c = s[u];
if (!ol(c)) {
var d = !r.immutableKeys[c];
if (d)
for (var p = 0, h = i.length; p < h; p++)
i[p]._private[r.field][c] = void 0;
}
}
r.triggerEvent && o[r.triggerFnName](r.event);
} else if (n === void 0) {
for (var f = 0, v = i.length; f < v; f++)
for (var m = i[f]._private[r.field], g = Object.keys(m), b = 0; b < g.length; b++) {
var x = g[b], w = !r.immutableKeys[x];
w && (m[x] = void 0);
}
r.triggerEvent && o[r.triggerFnName](r.event);
}
return o;
};
}
// removeData
}, rwe = {
eventAliasesOn: function(e) {
var t = e;
t.addListener = t.listen = t.bind = t.on, t.unlisten = t.unbind = t.off = t.removeListener, t.trigger = t.emit, t.pon = t.promiseOn = function(n, r) {
var o = this, a = Array.prototype.slice.call(arguments, 0);
return new md(function(i, s) {
var l = function(d) {
o.off.apply(o, c), i(d);
}, u = a.concat([l]), c = u.concat([]);
o.on.apply(o, u);
});
};
}
}, an = {};
[W1e, nwe, rwe].forEach(function(e) {
_t(an, e);
});
var owe = {
animate: an.animate(),
animation: an.animation(),
animated: an.animated(),
clearQueue: an.clearQueue(),
delay: an.delay(),
delayAnimation: an.delayAnimation(),
stop: an.stop()
}, Wv = {
classes: function(e) {
var t = this;
if (e === void 0) {
var n = [];
return t[0]._private.classes.forEach(function(h) {
return n.push(h);
}), n;
} else dn(e) || (e = (e || "").match(/\S+/g) || []);
for (var r = [], o = new gd(e), a = 0; a < t.length; a++) {
for (var i = t[a], s = i._private, l = s.classes, u = !1, c = 0; c < e.length; c++) {
var d = e[c], p = l.has(d);
if (!p) {
u = !0;
break;
}
}
u || (u = l.size !== e.length), u && (s.classes = o, r.push(i));
}
return r.length > 0 && this.spawn(r).updateStyle().emit("class"), t;
},
addClass: function(e) {
return this.toggleClass(e, !0);
},
hasClass: function(e) {
var t = this[0];
return t != null && t._private.classes.has(e);
},
toggleClass: function(e, t) {
dn(e) || (e = e.match(/\S+/g) || []);
for (var n = this, r = t === void 0, o = [], a = 0, i = n.length; a < i; a++)
for (var s = n[a], l = s._private.classes, u = !1, c = 0; c < e.length; c++) {
var d = e[c], p = l.has(d), h = !1;
t || r && !p ? (l.add(d), h = !0) : (!t || r && p) && (l.delete(d), h = !0), !u && h && (o.push(s), u = !0);
}
return o.length > 0 && this.spawn(o).updateStyle().emit("class"), n;
},
removeClass: function(e) {
return this.toggleClass(e, !1);
},
flashClass: function(e, t) {
var n = this;
if (t == null)
t = 250;
else if (t === 0)
return n;
return n.addClass(e), setTimeout(function() {
n.removeClass(e);
}, t), n;
}
};
Wv.className = Wv.classNames = Wv.classes;
var Kt = {
metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",
// chars we need to escape in let names, etc
comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",
// binary comparison op (used in data selectors)
boolOp: "\\?|\\!|\\^",
// boolean (unary) operators (used in data selectors)
string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,
// string literals (used in data selectors) -- doublequotes | singlequotes
number: lr,
// number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123
meta: "degree|indegree|outdegree",
// allowed metadata fields (i.e. allowed functions to use from Collection)
separator: "\\s*,\\s*",
// queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass
descendant: "\\s+",
child: "\\s+>\\s+",
subject: "\\$",
group: "node|edge|\\*",
directedEdge: "\\s+->\\s+",
undirectedEdge: "\\s+<->\\s+"
};
Kt.variable = "(?:[\\w-.]|(?:\\\\" + Kt.metaChar + "))+";
Kt.className = "(?:[\\w-]|(?:\\\\" + Kt.metaChar + "))+";
Kt.value = Kt.string + "|" + Kt.number;
Kt.id = Kt.variable;
(function() {
var e, t, n;
for (e = Kt.comparatorOp.split("|"), n = 0; n < e.length; n++)
t = e[n], Kt.comparatorOp += "|@" + t;
for (e = Kt.comparatorOp.split("|"), n = 0; n < e.length; n++)
t = e[n], !(t.indexOf("!") >= 0) && t !== "=" && (Kt.comparatorOp += "|\\!" + t);
})();
var cn = function() {
return {
checks: []
};
}, ct = {
/** E.g. node */
GROUP: 0,
/** A collection of elements */
COLLECTION: 1,
/** A filter(ele) function */
FILTER: 2,
/** E.g. [foo > 1] */
DATA_COMPARE: 3,
/** E.g. [foo] */
DATA_EXIST: 4,
/** E.g. [?foo] */
DATA_BOOL: 5,
/** E.g. [[degree > 2]] */
META_COMPARE: 6,
/** E.g. :selected */
STATE: 7,
/** E.g. #foo */
ID: 8,
/** E.g. .foo */
CLASS: 9,
/** E.g. #foo <-> #bar */
UNDIRECTED_EDGE: 10,
/** E.g. #foo -> #bar */
DIRECTED_EDGE: 11,
/** E.g. $#foo -> #bar */
NODE_SOURCE: 12,
/** E.g. #foo -> $#bar */
NODE_TARGET: 13,
/** E.g. $#foo <-> #bar */
NODE_NEIGHBOR: 14,
/** E.g. #foo > #bar */
CHILD: 15,
/** E.g. #foo #bar */
DESCENDANT: 16,
/** E.g. $#foo > #bar */
PARENT: 17,
/** E.g. $#foo #bar */
ANCESTOR: 18,
/** E.g. #foo > $bar > #baz */
COMPOUND_SPLIT: 19,
/** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */
TRUE: 20
}, qC = [{
selector: ":selected",
matches: function(e) {
return e.selected();
}
}, {
selector: ":unselected",
matches: function(e) {
return !e.selected();
}
}, {
selector: ":selectable",
matches: function(e) {
return e.selectable();
}
}, {
selector: ":unselectable",
matches: function(e) {
return !e.selectable();
}
}, {
selector: ":locked",
matches: function(e) {
return e.locked();
}
}, {
selector: ":unlocked",
matches: function(e) {
return !e.locked();
}
}, {
selector: ":visible",
matches: function(e) {
return e.visible();
}
}, {
selector: ":hidden",
matches: function(e) {
return !e.visible();
}
}, {
selector: ":transparent",
matches: function(e) {
return e.transparent();
}
}, {
selector: ":grabbed",
matches: function(e) {
return e.grabbed();
}
}, {
selector: ":free",
matches: function(e) {
return !e.grabbed();
}
}, {
selector: ":removed",
matches: function(e) {
return e.removed();
}
}, {
selector: ":inside",
matches: function(e) {
return !e.removed();
}
}, {
selector: ":grabbable",
matches: function(e) {
return e.grabbable();
}
}, {
selector: ":ungrabbable",
matches: function(e) {
return !e.grabbable();
}
}, {
selector: ":animated",
matches: function(e) {
return e.animated();
}
}, {
selector: ":unanimated",
matches: function(e) {
return !e.animated();
}
}, {
selector: ":parent",
matches: function(e) {
return e.isParent();
}
}, {
selector: ":childless",
matches: function(e) {
return e.isChildless();
}
}, {
selector: ":child",
matches: function(e) {
return e.isChild();
}
}, {
selector: ":orphan",
matches: function(e) {
return e.isOrphan();
}
}, {
selector: ":nonorphan",
matches: function(e) {
return e.isChild();
}
}, {
selector: ":compound",
matches: function(e) {
return e.isNode() ? e.isParent() : e.source().isParent() || e.target().isParent();
}
}, {
selector: ":loop",
matches: function(e) {
return e.isLoop();
}
}, {
selector: ":simple",
matches: function(e) {
return e.isSimple();
}
}, {
selector: ":active",
matches: function(e) {
return e.active();
}
}, {
selector: ":inactive",
matches: function(e) {
return !e.active();
}
}, {
selector: ":backgrounding",
matches: function(e) {
return e.backgrounding();
}
}, {
selector: ":nonbackgrounding",
matches: function(e) {
return !e.backgrounding();
}
}].sort(function(e, t) {
return g0e(e.selector, t.selector);
}), awe = function() {
for (var e = {}, t, n = 0; n < qC.length; n++)
t = qC[n], e[t.selector] = t.matches;
return e;
}(), iwe = function(e, t) {
return awe[e](t);
}, swe = "(" + qC.map(function(e) {
return e.selector;
}).join("|") + ")", rc = function(e) {
return e.replace(new RegExp("\\\\(" + Kt.metaChar + ")", "g"), function(t, n) {
return n;
});
}, Ss = function(e, t, n) {
e[e.length - 1] = n;
}, KC = [{
name: "group",
// just used for identifying when debugging
query: !0,
regex: "(" + Kt.group + ")",
populate: function(e, t, n) {
var r = Ta(n, 1), o = r[0];
t.checks.push({
type: ct.GROUP,
value: o === "*" ? o : o + "s"
});
}
}, {
name: "state",
query: !0,
regex: swe,
populate: function(e, t, n) {
var r = Ta(n, 1), o = r[0];
t.checks.push({
type: ct.STATE,
value: o
});
}
}, {
name: "id",
query: !0,
regex: "\\#(" + Kt.id + ")",
populate: function(e, t, n) {
var r = Ta(n, 1), o = r[0];
t.checks.push({
type: ct.ID,
value: rc(o)
});
}
}, {
name: "className",
query: !0,
regex: "\\.(" + Kt.className + ")",
populate: function(e, t, n) {
var r = Ta(n, 1), o = r[0];
t.checks.push({
type: ct.CLASS,
value: rc(o)
});
}
}, {
name: "dataExists",
query: !0,
regex: "\\[\\s*(" + Kt.variable + ")\\s*\\]",
populate: function(e, t, n) {
var r = Ta(n, 1), o = r[0];
t.checks.push({
type: ct.DATA_EXIST,
field: rc(o)
});
}
}, {
name: "dataCompare",
query: !0,
regex: "\\[\\s*(" + Kt.variable + ")\\s*(" + Kt.comparatorOp + ")\\s*(" + Kt.value + ")\\s*\\]",
populate: function(e, t, n) {
var r = Ta(n, 3), o = r[0], a = r[1], i = r[2], s = new RegExp("^" + Kt.string + "$").exec(i) != null;
s ? i = i.substring(1, i.length - 1) : i = parseFloat(i), t.checks.push({
type: ct.DATA_COMPARE,
field: rc(o),
operator: a,
value: i
});
}
}, {
name: "dataBool",
query: !0,
regex: "\\[\\s*(" + Kt.boolOp + ")\\s*(" + Kt.variable + ")\\s*\\]",
populate: function(e, t, n) {
var r = Ta(n, 2), o = r[0], a = r[1];
t.checks.push({
type: ct.DATA_BOOL,
field: rc(a),
operator: o
});
}
}, {
name: "metaCompare",
query: !0,
regex: "\\[\\[\\s*(" + Kt.meta + ")\\s*(" + Kt.comparatorOp + ")\\s*(" + Kt.number + ")\\s*\\]\\]",
populate: function(e, t, n) {
var r = Ta(n, 3), o = r[0], a = r[1], i = r[2];
t.checks.push({
type: ct.META_COMPARE,
field: rc(o),
operator: a,
value: parseFloat(i)
});
}
}, {
name: "nextQuery",
separator: !0,
regex: Kt.separator,
populate: function(e, t) {
var n = e.currentSubject, r = e.edgeCount, o = e.compoundCount, a = e[e.length - 1];
n != null && (a.subject = n, e.currentSubject = null), a.edgeCount = r, a.compoundCount = o, e.edgeCount = 0, e.compoundCount = 0;
var i = e[e.length++] = cn();
return i;
}
}, {
name: "directedEdge",
separator: !0,
regex: Kt.directedEdge,
populate: function(e, t) {
if (e.currentSubject == null) {
var n = cn(), r = t, o = cn();
return n.checks.push({
type: ct.DIRECTED_EDGE,
source: r,
target: o
}), Ss(e, t, n), e.edgeCount++, o;
} else {
var a = cn(), i = t, s = cn();
return a.checks.push({
type: ct.NODE_SOURCE,
source: i,
target: s
}), Ss(e, t, a), e.edgeCount++, s;
}
}
}, {
name: "undirectedEdge",
separator: !0,
regex: Kt.undirectedEdge,
populate: function(e, t) {
if (e.currentSubject == null) {
var n = cn(), r = t, o = cn();
return n.checks.push({
type: ct.UNDIRECTED_EDGE,
nodes: [r, o]
}), Ss(e, t, n), e.edgeCount++, o;
} else {
var a = cn(), i = t, s = cn();
return a.checks.push({
type: ct.NODE_NEIGHBOR,
node: i,
neighbor: s
}), Ss(e, t, a), s;
}
}
}, {
name: "child",
separator: !0,
regex: Kt.child,
populate: function(e, t) {
if (e.currentSubject == null) {
var n = cn(), r = cn(), o = e[e.length - 1];
return n.checks.push({
type: ct.CHILD,
parent: o,
child: r
}), Ss(e, t, n), e.compoundCount++, r;
} else if (e.currentSubject === t) {
var a = cn(), i = e[e.length - 1], s = cn(), l = cn(), u = cn(), c = cn();
return a.checks.push({
type: ct.COMPOUND_SPLIT,
left: i,
right: s,
subject: l
}), l.checks = t.checks, t.checks = [{
type: ct.TRUE
}], c.checks.push({
type: ct.TRUE
}), s.checks.push({
type: ct.PARENT,
// type is swapped on right side queries
parent: c,
child: u
// empty for now
}), Ss(e, i, a), e.currentSubject = l, e.compoundCount++, u;
} else {
var d = cn(), p = cn(), h = [{
type: ct.PARENT,
parent: d,
child: p
}];
return d.checks = t.checks, t.checks = h, e.compoundCount++, p;
}
}
}, {
name: "descendant",
separator: !0,
regex: Kt.descendant,
populate: function(e, t) {
if (e.currentSubject == null) {
var n = cn(), r = cn(), o = e[e.length - 1];
return n.checks.push({
type: ct.DESCENDANT,
ancestor: o,
descendant: r
}), Ss(e, t, n), e.compoundCount++, r;
} else if (e.currentSubject === t) {
var a = cn(), i = e[e.length - 1], s = cn(), l = cn(), u = cn(), c = cn();
return a.checks.push({
type: ct.COMPOUND_SPLIT,
left: i,
right: s,
subject: l
}), l.checks = t.checks, t.checks = [{
type: ct.TRUE
}], c.checks.push({
type: ct.TRUE
}), s.checks.push({
type: ct.ANCESTOR,
// type is swapped on right side queries
ancestor: c,
descendant: u
// empty for now
}), Ss(e, i, a), e.currentSubject = l, e.compoundCount++, u;
} else {
var d = cn(), p = cn(), h = [{
type: ct.ANCESTOR,
ancestor: d,
descendant: p
}];
return d.checks = t.checks, t.checks = h, e.compoundCount++, p;
}
}
}, {
name: "subject",
modifier: !0,
regex: Kt.subject,
populate: function(e, t) {
if (e.currentSubject != null && e.currentSubject !== t)
return sn("Redefinition of subject in selector `" + e.toString() + "`"), !1;
e.currentSubject = t;
var n = e[e.length - 1], r = n.checks[0], o = r == null ? null : r.type;
o === ct.DIRECTED_EDGE ? r.type = ct.NODE_TARGET : o === ct.UNDIRECTED_EDGE && (r.type = ct.NODE_NEIGHBOR, r.node = r.nodes[1], r.neighbor = r.nodes[0], r.nodes = null);
}
}];
KC.forEach(function(e) {
return e.regexObj = new RegExp("^" + e.regex);
});
var lwe = function(e) {
for (var t, n, r, o = 0; o < KC.length; o++) {
var a = KC[o], i = a.name, s = e.match(a.regexObj);
if (s != null) {
n = s, t = a, r = i;
var l = s[0];
e = e.substring(l.length);
break;
}
}
return {
expr: t,
match: n,
name: r,
remaining: e
};
}, uwe = function(e) {
var t = e.match(/^\s+/);
if (t) {
var n = t[0];
e = e.substring(n.length);
}
return e;
}, cwe = function(e) {
var t = this, n = t.inputText = e, r = t[0] = cn();
for (t.length = 1, n = uwe(n); ; ) {
var o = lwe(n);
if (o.expr == null)
return sn("The selector `" + e + "`is invalid"), !1;
var a = o.match.slice(1), i = o.expr.populate(t, r, a);
if (i === !1)
return !1;
if (i != null && (r = i), n = o.remaining, n.match(/^\s*$/))
break;
}
var s = t[t.length - 1];
t.currentSubject != null && (s.subject = t.currentSubject), s.edgeCount = t.edgeCount, s.compoundCount = t.compoundCount;
for (var l = 0; l < t.length; l++) {
var u = t[l];
if (u.compoundCount > 0 && u.edgeCount > 0)
return sn("The selector `" + e + "` is invalid because it uses both a compound selector and an edge selector"), !1;
if (u.edgeCount > 1)
return sn("The selector `" + e + "` is invalid because it uses multiple edge selectors"), !1;
u.edgeCount === 1 && sn("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.");
}
return !0;
}, dwe = function() {
if (this.toStringCache != null)
return this.toStringCache;
for (var e = function(l) {
return l ?? "";
}, t = function(l) {
return gt(l) ? '"' + l + '"' : e(l);
}, n = function(l) {
return " " + l + " ";
}, r = function(l, u) {
var c = l.type, d = l.value;
switch (c) {
case ct.GROUP: {
var p = e(d);
return p.substring(0, p.length - 1);
}
case ct.DATA_COMPARE: {
var h = l.field, f = l.operator;
return "[" + h + n(e(f)) + t(d) + "]";
}
case ct.DATA_BOOL: {
var v = l.operator, m = l.field;
return "[" + e(v) + m + "]";
}
case ct.DATA_EXIST: {
var g = l.field;
return "[" + g + "]";
}
case ct.META_COMPARE: {
var b = l.operator, x = l.field;
return "[[" + x + n(e(b)) + t(d) + "]]";
}
case ct.STATE:
return d;
case ct.ID:
return "#" + d;
case ct.CLASS:
return "." + d;
case ct.PARENT:
case ct.CHILD:
return o(l.parent, u) + n(">") + o(l.child, u);
case ct.ANCESTOR:
case ct.DESCENDANT:
return o(l.ancestor, u) + " " + o(l.descendant, u);
case ct.COMPOUND_SPLIT: {
var w = o(l.left, u), k = o(l.subject, u), C = o(l.right, u);
return w + (w.length > 0 ? " " : "") + k + C;
}
case ct.TRUE:
return "";
}
}, o = function(l, u) {
return l.checks.reduce(function(c, d, p) {
return c + (u === l && p === 0 ? "$" : "") + r(d, u);
}, "");
}, a = "", i = 0; i < this.length; i++) {
var s = this[i];
a += o(s, s.subject), this.length > 1 && i < this.length - 1 && (a += ", ");
}
return this.toStringCache = a, a;
}, pwe = {
parse: cwe,
toString: dwe
}, az = function(e, t, n) {
var r, o = gt(e), a = Ze(e), i = gt(n), s, l, u = !1, c = !1, d = !1;
switch (t.indexOf("!") >= 0 && (t = t.replace("!", ""), c = !0), t.indexOf("@") >= 0 && (t = t.replace("@", ""), u = !0), (o || i || u) && (s = !o && !a ? "" : "" + e, l = "" + n), u && (e = s = s.toLowerCase(), n = l = l.toLowerCase()), t) {
case "*=":
r = s.indexOf(l) >= 0;
break;
case "$=":
r = s.indexOf(l, s.length - l.length) >= 0;
break;
case "^=":
r = s.indexOf(l) === 0;
break;
case "=":
r = e === n;
break;
case ">":
d = !0, r = e > n;
break;
case ">=":
d = !0, r = e >= n;
break;
case "<":
d = !0, r = e < n;
break;
case "<=":
d = !0, r = e <= n;
break;
default:
r = !1;
break;
}
return c && (e != null || !d) && (r = !r), r;
}, fwe = function(e, t) {
switch (t) {
case "?":
return !!e;
case "!":
return !e;
case "^":
return e === void 0;
}
}, hwe = function(e) {
return e !== void 0;
}, _$ = function(e, t) {
return e.data(t);
}, vwe = function(e, t) {
return e[t]();
}, qn = [], On = function(e, t) {
return e.checks.every(function(n) {
return qn[n.type](n, t);
});
};
qn[ct.GROUP] = function(e, t) {
var n = e.value;
return n === "*" || n === t.group();
};
qn[ct.STATE] = function(e, t) {
var n = e.value;
return iwe(n, t);
};
qn[ct.ID] = function(e, t) {
var n = e.value;
return t.id() === n;
};
qn[ct.CLASS] = function(e, t) {
var n = e.value;
return t.hasClass(n);
};
qn[ct.META_COMPARE] = function(e, t) {
var n = e.field, r = e.operator, o = e.value;
return az(vwe(t, n), r, o);
};
qn[ct.DATA_COMPARE] = function(e, t) {
var n = e.field, r = e.operator, o = e.value;
return az(_$(t, n), r, o);
};
qn[ct.DATA_BOOL] = function(e, t) {
var n = e.field, r = e.operator;
return fwe(_$(t, n), r);
};
qn[ct.DATA_EXIST] = function(e, t) {
var n = e.field;
return e.operator, hwe(_$(t, n));
};
qn[ct.UNDIRECTED_EDGE] = function(e, t) {
var n = e.nodes[0], r = e.nodes[1], o = t.source(), a = t.target();
return On(n, o) && On(r, a) || On(r, o) && On(n, a);
};
qn[ct.NODE_NEIGHBOR] = function(e, t) {
return On(e.node, t) && t.neighborhood().some(function(n) {
return n.isNode() && On(e.neighbor, n);
});
};
qn[ct.DIRECTED_EDGE] = function(e, t) {
return On(e.source, t.source()) && On(e.target, t.target());
};
qn[ct.NODE_SOURCE] = function(e, t) {
return On(e.source, t) && t.outgoers().some(function(n) {
return n.isNode() && On(e.target, n);
});
};
qn[ct.NODE_TARGET] = function(e, t) {
return On(e.target, t) && t.incomers().some(function(n) {
return n.isNode() && On(e.source, n);
});
};
qn[ct.CHILD] = function(e, t) {
return On(e.child, t) && On(e.parent, t.parent());
};
qn[ct.PARENT] = function(e, t) {
return On(e.parent, t) && t.children().some(function(n) {
return On(e.child, n);
});
};
qn[ct.DESCENDANT] = function(e, t) {
return On(e.descendant, t) && t.ancestors().some(function(n) {
return On(e.ancestor, n);
});
};
qn[ct.ANCESTOR] = function(e, t) {
return On(e.ancestor, t) && t.descendants().some(function(n) {
return On(e.descendant, n);
});
};
qn[ct.COMPOUND_SPLIT] = function(e, t) {
return On(e.subject, t) && On(e.left, t) && On(e.right, t);
};
qn[ct.TRUE] = function() {
return !0;
};
qn[ct.COLLECTION] = function(e, t) {
var n = e.value;
return n.has(t);
};
qn[ct.FILTER] = function(e, t) {
var n = e.value;
return n(t);
};
var gwe = function(e) {
var t = this;
if (t.length === 1 && t[0].checks.length === 1 && t[0].checks[0].type === ct.ID)
return e.getElementById(t[0].checks[0].value).collection();
var n = function(r) {
for (var o = 0; o < t.length; o++) {
var a = t[o];
if (On(a, r))
return !0;
}
return !1;
};
return t.text() == null && (n = function() {
return !0;
}), e.filter(n);
}, mwe = function(e) {
for (var t = this, n = 0; n < t.length; n++) {
var r = t[n];
if (On(r, e))
return !0;
}
return !1;
}, ywe = {
matches: mwe,
filter: gwe
}, il = function(e) {
this.inputText = e, this.currentSubject = null, this.compoundCount = 0, this.edgeCount = 0, this.length = 0, e == null || gt(e) && e.match(/^\s*$/) || (Mo(e) ? this.addQuery({
checks: [{
type: ct.COLLECTION,
value: e.collection()
}]
}) : Nn(e) ? this.addQuery({
checks: [{
type: ct.FILTER,
value: e
}]
}) : gt(e) ? this.parse(e) || (this.invalid = !0) : Un("A selector must be created from a string; found "));
}, sl = il.prototype;
[pwe, ywe].forEach(function(e) {
return _t(sl, e);
});
sl.text = function() {
return this.inputText;
};
sl.size = function() {
return this.length;
};
sl.eq = function(e) {
return this[e];
};
sl.sameText = function(e) {
return !this.invalid && !e.invalid && this.text() === e.text();
};
sl.addQuery = function(e) {
this[this.length++] = e;
};
sl.selector = sl.toString;
var Ys = {
allAre: function(e) {
var t = new il(e);
return this.every(function(n) {
return t.matches(n);
});
},
is: function(e) {
var t = new il(e);
return this.some(function(n) {
return t.matches(n);
});
},
some: function(e, t) {
for (var n = 0; n < this.length; n++) {
var r = t ? e.apply(t, [this[n], n, this]) : e(this[n], n, this);
if (r)
return !0;
}
return !1;
},
every: function(e, t) {
for (var n = 0; n < this.length; n++) {
var r = t ? e.apply(t, [this[n], n, this]) : e(this[n], n, this);
if (!r)
return !1;
}
return !0;
},
same: function(e) {
if (this === e)
return !0;
e = this.cy().collection(e);
var t = this.length, n = e.length;
return t !== n ? !1 : t === 1 ? this[0] === e[0] : this.every(function(r) {
return e.hasElementWithId(r.id());
});
},
anySame: function(e) {
return e = this.cy().collection(e), this.some(function(t) {
return e.hasElementWithId(t.id());
});
},
allAreNeighbors: function(e) {
e = this.cy().collection(e);
var t = this.neighborhood();
return e.every(function(n) {
return t.hasElementWithId(n.id());
});
},
contains: function(e) {
e = this.cy().collection(e);
var t = this;
return e.every(function(n) {
return t.hasElementWithId(n.id());
});
}
};
Ys.allAreNeighbours = Ys.allAreNeighbors;
Ys.has = Ys.contains;
Ys.equal = Ys.equals = Ys.same;
var Jo = function(e, t) {
return function(n, r, o, a) {
var i = n, s = this, l;
if (i == null ? l = "" : Mo(i) && i.length === 1 && (l = i.id()), s.length === 1 && l) {
var u = s[0]._private, c = u.traversalCache = u.traversalCache || {}, d = c[t] = c[t] || [], p = pu(l), h = d[p];
return h || (d[p] = e.call(s, n, r, o, a));
} else
return e.call(s, n, r, o, a);
};
}, Yc = {
parent: function(e) {
var t = [];
if (this.length === 1) {
var n = this[0]._private.parent;
if (n)
return n;
}
for (var r = 0; r < this.length; r++) {
var o = this[r], a = o._private.parent;
a && t.push(a);
}
return this.spawn(t, !0).filter(e);
},
parents: function(e) {
for (var t = [], n = this.parent(); n.nonempty(); ) {
for (var r = 0; r < n.length; r++) {
var o = n[r];
t.push(o);
}
n = n.parent();
}
return this.spawn(t, !0).filter(e);
},
commonAncestors: function(e) {
for (var t, n = 0; n < this.length; n++) {
var r = this[n], o = r.parents();
t = t || o, t = t.intersect(o);
}
return t.filter(e);
},
orphans: function(e) {
return this.stdFilter(function(t) {
return t.isOrphan();
}).filter(e);
},
nonorphans: function(e) {
return this.stdFilter(function(t) {
return t.isChild();
}).filter(e);
},
children: Jo(function(e) {
for (var t = [], n = 0; n < this.length; n++)
for (var r = this[n], o = r._private.children, a = 0; a < o.length; a++)
t.push(o[a]);
return this.spawn(t, !0).filter(e);
}, "children"),
siblings: function(e) {
return this.parent().children().not(this).filter(e);
},
isParent: function() {
var e = this[0];
if (e)
return e.isNode() && e._private.children.length !== 0;
},
isChildless: function() {
var e = this[0];
if (e)
return e.isNode() && e._private.children.length === 0;
},
isChild: function() {
var e = this[0];
if (e)
return e.isNode() && e._private.parent != null;
},
isOrphan: function() {
var e = this[0];
if (e)
return e.isNode() && e._private.parent == null;
},
descendants: function(e) {
var t = [];
function n(r) {
for (var o = 0; o < r.length; o++) {
var a = r[o];
t.push(a), a.children().nonempty() && n(a.children());
}
}
return n(this.children()), this.spawn(t, !0).filter(e);
}
};
function S$(e, t, n, r) {
for (var o = [], a = new gd(), i = e.cy(), s = i.hasCompoundNodes(), l = 0; l < e.length; l++) {
var u = e[l];
n ? o.push(u) : s && r(o, a, u);
}
for (; o.length > 0; ) {
var c = o.shift();
t(c), a.add(c.id()), s && r(o, a, c);
}
return e;
}
function iz(e, t, n) {
if (n.isParent())
for (var r = n._private.children, o = 0; o < r.length; o++) {
var a = r[o];
t.has(a.id()) || e.push(a);
}
}
Yc.forEachDown = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
return S$(this, e, t, iz);
};
function sz(e, t, n) {
if (n.isChild()) {
var r = n._private.parent;
t.has(r.id()) || e.push(r);
}
}
Yc.forEachUp = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
return S$(this, e, t, sz);
};
function bwe(e, t, n) {
sz(e, t, n), iz(e, t, n);
}
Yc.forEachUpAndDown = function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
return S$(this, e, t, bwe);
};
Yc.ancestors = Yc.parents;
var pf, lz;
pf = lz = {
data: an.data({
field: "data",
bindingEvent: "data",
allowBinding: !0,
allowSetting: !0,
settingEvent: "data",
settingTriggersEvent: !0,
triggerFnName: "trigger",
allowGetting: !0,
immutableKeys: {
id: !0,
source: !0,
target: !0,
parent: !0
},
updateStyle: !0
}),
removeData: an.removeData({
field: "data",
event: "data",
triggerFnName: "trigger",
triggerEvent: !0,
immutableKeys: {
id: !0,
source: !0,
target: !0,
parent: !0
},
updateStyle: !0
}),
scratch: an.data({
field: "scratch",
bindingEvent: "scratch",
allowBinding: !0,
allowSetting: !0,
settingEvent: "scratch",
settingTriggersEvent: !0,
triggerFnName: "trigger",
allowGetting: !0,
updateStyle: !0
}),
removeScratch: an.removeData({
field: "scratch",
event: "scratch",
triggerFnName: "trigger",
triggerEvent: !0,
updateStyle: !0
}),
rscratch: an.data({
field: "rscratch",
allowBinding: !1,
allowSetting: !0,
settingTriggersEvent: !1,
allowGetting: !0
}),
removeRscratch: an.removeData({
field: "rscratch",
triggerEvent: !1
}),
id: function() {
var e = this[0];
if (e)
return e._private.data.id;
}
};
pf.attr = pf.data;
pf.removeAttr = pf.removeData;
var wwe = lz, wm = {};
function gy(e) {
return function(t) {
var n = this;
if (t === void 0 && (t = !0), n.length !== 0)
if (n.isNode() && !n.removed()) {
for (var r = 0, o = n[0], a = o._private.edges, i = 0; i < a.length; i++) {
var s = a[i];
!t && s.isLoop() || (r += e(o, s));
}
return r;
} else
return;
};
}
_t(wm, {
degree: gy(function(e, t) {
return t.source().same(t.target()) ? 2 : 1;
}),
indegree: gy(function(e, t) {
return t.target().same(e) ? 1 : 0;
}),
outdegree: gy(function(e, t) {
return t.source().same(e) ? 1 : 0;
})
});
function oc(e, t) {
return function(n) {
for (var r, o = this.nodes(), a = 0; a < o.length; a++) {
var i = o[a], s = i[e](n);
s !== void 0 && (r === void 0 || t(s, r)) && (r = s);
}
return r;
};
}
_t(wm, {
minDegree: oc("degree", function(e, t) {
return e < t;
}),
maxDegree: oc("degree", function(e, t) {
return e > t;
}),
minIndegree: oc("indegree", function(e, t) {
return e < t;
}),
maxIndegree: oc("indegree", function(e, t) {
return e > t;
}),
minOutdegree: oc("outdegree", function(e, t) {
return e < t;
}),
maxOutdegree: oc("outdegree", function(e, t) {
return e > t;
})
});
_t(wm, {
totalDegree: function(e) {
for (var t = 0, n = this.nodes(), r = 0; r < n.length; r++)
t += n[r].degree(e);
return t;
}
});
var Ba, uz, cz = function(e, t, n) {
for (var r = 0; r < e.length; r++) {
var o = e[r];
if (!o.locked()) {
var a = o._private.position, i = {
x: t.x != null ? t.x - a.x : 0,
y: t.y != null ? t.y - a.y : 0
};
o.isParent() && !(i.x === 0 && i.y === 0) && o.children().shift(i, n), o.dirtyBoundingBoxCache();
}
}
}, tF = {
field: "position",
bindingEvent: "position",
allowBinding: !0,
allowSetting: !0,
settingEvent: "position",
settingTriggersEvent: !0,
triggerFnName: "emitAndNotify",
allowGetting: !0,
validKeys: ["x", "y"],
beforeGet: function(e) {
e.updateCompoundBounds();
},
beforeSet: function(e, t) {
cz(e, t, !1);
},
onSet: function(e) {
e.dirtyCompoundBoundsCache();
},
canSet: function(e) {
return !e.locked();
}
};
Ba = uz = {
position: an.data(tF),
// position but no notification to renderer
silentPosition: an.data(_t({}, tF, {
allowBinding: !1,
allowSetting: !0,
settingTriggersEvent: !1,
allowGetting: !1,
beforeSet: function(e, t) {
cz(e, t, !0);
},
onSet: function(e) {
e.dirtyCompoundBoundsCache();
}
})),
positions: function(e, t) {
if (Xt(e))
t ? this.silentPosition(e) : this.position(e);
else if (Nn(e)) {
var n = e, r = this.cy();
r.startBatch();
for (var o = 0; o < this.length; o++) {
var a = this[o], i = void 0;
(i = n(a, o)) && (t ? a.silentPosition(i) : a.position(i));
}
r.endBatch();
}
return this;
},
silentPositions: function(e) {
return this.positions(e, !0);
},
shift: function(e, t, n) {
var r;
if (Xt(e) ? (r = {
x: Ze(e.x) ? e.x : 0,
y: Ze(e.y) ? e.y : 0
}, n = t) : gt(e) && Ze(t) && (r = {
x: 0,
y: 0
}, r[e] = t), r != null) {
var o = this.cy();
o.startBatch();
for (var a = 0; a < this.length; a++) {
var i = this[a];
if (!(o.hasCompoundNodes() && i.isChild() && i.ancestors().anySame(this))) {
var s = i.position(), l = {
x: s.x + r.x,
y: s.y + r.y
};
n ? i.silentPosition(l) : i.position(l);
}
}
o.endBatch();
}
return this;
},
silentShift: function(e, t) {
return Xt(e) ? this.shift(e, !0) : gt(e) && Ze(t) && this.shift(e, t, !0), this;
},
// get/set the rendered (i.e. on screen) positon of the element
renderedPosition: function(e, t) {
var n = this[0], r = this.cy(), o = r.zoom(), a = r.pan(), i = Xt(e) ? e : void 0, s = i !== void 0 || t !== void 0 && gt(e);
if (n && n.isNode())
if (s)
for (var l = 0; l < this.length; l++) {
var u = this[l];
t !== void 0 ? u.position(e, (t - a[e]) / o) : i !== void 0 && u.position(NB(i, o, a));
}
else {
var c = n.position();
return i = vm(c, o, a), e === void 0 ? i : i[e];
}
else if (!s)
return;
return this;
},
// get/set the position relative to the parent
relativePosition: function(e, t) {
var n = this[0], r = this.cy(), o = Xt(e) ? e : void 0, a = o !== void 0 || t !== void 0 && gt(e), i = r.hasCompoundNodes();
if (n && n.isNode())
if (a)
for (var s = 0; s < this.length; s++) {
var l = this[s], u = i ? l.parent() : null, c = u && u.length > 0, d = c;
c && (u = u[0]);
var p = d ? u.position() : {
x: 0,
y: 0
};
t !== void 0 ? l.position(e, t + p[e]) : o !== void 0 && l.position({
x: o.x + p.x,
y: o.y + p.y
});
}
else {
var h = n.position(), f = i ? n.parent() : null, v = f && f.length > 0, m = v;
v && (f = f[0]);
var g = m ? f.position() : {
x: 0,
y: 0
};
return o = {
x: h.x - g.x,
y: h.y - g.y
}, e === void 0 ? o : o[e];
}
else if (!a)
return;
return this;
}
};
Ba.modelPosition = Ba.point = Ba.position;
Ba.modelPositions = Ba.points = Ba.positions;
Ba.renderedPoint = Ba.renderedPosition;
Ba.relativePoint = Ba.relativePosition;
var xwe = uz, Oc, xl;
Oc = xl = {};
xl.renderedBoundingBox = function(e) {
var t = this.boundingBox(e), n = this.cy(), r = n.zoom(), o = n.pan(), a = t.x1 * r + o.x, i = t.x2 * r + o.x, s = t.y1 * r + o.y, l = t.y2 * r + o.y;
return {
x1: a,
x2: i,
y1: s,
y2: l,
w: i - a,
h: l - s
};
};
xl.dirtyCompoundBoundsCache = function() {
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, t = this.cy();
return !t.styleEnabled() || !t.hasCompoundNodes() ? this : (this.forEachUp(function(n) {
if (n.isParent()) {
var r = n._private;
r.compoundBoundsClean = !1, r.bbCache = null, e || n.emitAndNotify("bounds");
}
}), this);
};
xl.updateCompoundBounds = function() {
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, t = this.cy();
if (!t.styleEnabled() || !t.hasCompoundNodes())
return this;
if (!e && t.batching())
return this;
function n(i) {
if (!i.isParent())
return;
var s = i._private, l = i.children(), u = i.pstyle("compound-sizing-wrt-labels").value === "include", c = {
width: {
val: i.pstyle("min-width").pfValue,
left: i.pstyle("min-width-bias-left"),
right: i.pstyle("min-width-bias-right")
},
height: {
val: i.pstyle("min-height").pfValue,
top: i.pstyle("min-height-bias-top"),
bottom: i.pstyle("min-height-bias-bottom")
}
}, d = l.boundingBox({
includeLabels: u,
includeOverlays: !1,
// updating the compound bounds happens outside of the regular
// cache cycle (i.e. before fired events)
useCache: !1
}), p = s.position;
(d.w === 0 || d.h === 0) && (d = {
w: i.pstyle("width").pfValue,
h: i.pstyle("height").pfValue
}, d.x1 = p.x - d.w / 2, d.x2 = p.x + d.w / 2, d.y1 = p.y - d.h / 2, d.y2 = p.y + d.h / 2);
function h(O, F, A) {
var T = 0, R = 0, M = F + A;
return O > 0 && M > 0 && (T = F / M * O, R = A / M * O), {
biasDiff: T,
biasComplementDiff: R
};
}
function f(O, F, A, T) {
if (A.units === "%")
switch (T) {
case "width":
return O > 0 ? A.pfValue * O : 0;
case "height":
return F > 0 ? A.pfValue * F : 0;
case "average":
return O > 0 && F > 0 ? A.pfValue * (O + F) / 2 : 0;
case "min":
return O > 0 && F > 0 ? O > F ? A.pfValue * F : A.pfValue * O : 0;
case "max":
return O > 0 && F > 0 ? O > F ? A.pfValue * O : A.pfValue * F : 0;
default:
return 0;
}
else return A.units === "px" ? A.pfValue : 0;
}
var v = c.width.left.value;
c.width.left.units === "px" && c.width.val > 0 && (v = v * 100 / c.width.val);
var m = c.width.right.value;
c.width.right.units === "px" && c.width.val > 0 && (m = m * 100 / c.width.val);
var g = c.height.top.value;
c.height.top.units === "px" && c.height.val > 0 && (g = g * 100 / c.height.val);
var b = c.height.bottom.value;
c.height.bottom.units === "px" && c.height.val > 0 && (b = b * 100 / c.height.val);
var x = h(c.width.val - d.w, v, m), w = x.biasDiff, k = x.biasComplementDiff, C = h(c.height.val - d.h, g, b), _ = C.biasDiff, $ = C.biasComplementDiff;
s.autoPadding = f(d.w, d.h, i.pstyle("padding"), i.pstyle("padding-relative-to").value), s.autoWidth = Math.max(d.w, c.width.val), p.x = (-w + d.x1 + d.x2 + k) / 2, s.autoHeight = Math.max(d.h, c.height.val), p.y = (-_ + d.y1 + d.y2 + $) / 2;
}
for (var r = 0; r < this.length; r++) {
var o = this[r], a = o._private;
(!a.compoundBoundsClean || e) && (n(o), t.batching() || (a.compoundBoundsClean = !0));
}
return this;
};
var Yo = function(e) {
return e === 1 / 0 || e === -1 / 0 ? 0 : e;
}, Pa = function(e, t, n, r, o) {
r - t === 0 || o - n === 0 || t == null || n == null || r == null || o == null || (e.x1 = t < e.x1 ? t : e.x1, e.x2 = r > e.x2 ? r : e.x2, e.y1 = n < e.y1 ? n : e.y1, e.y2 = o > e.y2 ? o : e.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1);
}, Bl = function(e, t) {
return t == null ? e : Pa(e, t.x1, t.y1, t.x2, t.y2);
}, tp = function(e, t, n) {
return La(e, t, n);
}, lv = function(e, t, n) {
if (!t.cy().headless()) {
var r = t._private, o = r.rstyle, a = o.arrowWidth / 2, i = t.pstyle(n + "-arrow-shape").value, s, l;
if (i !== "none") {
n === "source" ? (s = o.srcX, l = o.srcY) : n === "target" ? (s = o.tgtX, l = o.tgtY) : (s = o.midX, l = o.midY);
var u = r.arrowBounds = r.arrowBounds || {}, c = u[n] = u[n] || {};
c.x1 = s - a, c.y1 = l - a, c.x2 = s + a, c.y2 = l + a, c.w = c.x2 - c.x1, c.h = c.y2 - c.y1, Kv(c, 1), Pa(e, c.x1, c.y1, c.x2, c.y2);
}
}
}, my = function(e, t, n) {
if (!t.cy().headless()) {
var r;
n ? r = n + "-" : r = "";
var o = t._private, a = o.rstyle, i = t.pstyle(r + "label").strValue;
if (i) {
var s = t.pstyle("text-halign"), l = t.pstyle("text-valign"), u = tp(a, "labelWidth", n), c = tp(a, "labelHeight", n), d = tp(a, "labelX", n), p = tp(a, "labelY", n), h = t.pstyle(r + "text-margin-x").pfValue, f = t.pstyle(r + "text-margin-y").pfValue, v = t.isEdge(), m = t.pstyle(r + "text-rotation"), g = t.pstyle("text-outline-width").pfValue, b = t.pstyle("text-border-width").pfValue, x = b / 2, w = t.pstyle("text-background-padding").pfValue, k = 2, C = c, _ = u, $ = _ / 2, O = C / 2, F, A, T, R;
if (v)
F = d - $, A = d + $, T = p - O, R = p + O;
else {
switch (s.value) {
case "left":
F = d - _, A = d;
break;
case "center":
F = d - $, A = d + $;
break;
case "right":
F = d, A = d + _;
break;
}
switch (l.value) {
case "top":
T = p - C, R = p;
break;
case "center":
T = p - O, R = p + O;
break;
case "bottom":
T = p, R = p + C;
break;
}
}
F += h - Math.max(g, x) - w - k, A += h + Math.max(g, x) + w + k, T += f - Math.max(g, x) - w - k, R += f + Math.max(g, x) + w + k;
var M = n || "main", j = o.labelBounds, P = j[M] = j[M] || {};
P.x1 = F, P.y1 = T, P.x2 = A, P.y2 = R, P.w = A - F, P.h = R - T;
var V = v && m.strValue === "autorotate", U = m.pfValue != null && m.pfValue !== 0;
if (V || U) {
var G = V ? tp(o.rstyle, "labelAngle", n) : m.pfValue, se = Math.cos(G), ae = Math.sin(G), de = (F + A) / 2, me = (T + R) / 2;
if (!v) {
switch (s.value) {
case "left":
de = A;
break;
case "right":
de = F;
break;
}
switch (l.value) {
case "top":
me = R;
break;
case "bottom":
me = T;
break;
}
}
var te = function(ke, Ne) {
return ke = ke - de, Ne = Ne - me, {
x: ke * se - Ne * ae + de,
y: ke * ae + Ne * se + me
};
}, oe = te(F, T), ne = te(F, R), ee = te(A, T), Z = te(A, R);
F = Math.min(oe.x, ne.x, ee.x, Z.x), A = Math.max(oe.x, ne.x, ee.x, Z.x), T = Math.min(oe.y, ne.y, ee.y, Z.y), R = Math.max(oe.y, ne.y, ee.y, Z.y);
}
var le = M + "Rot", pe = j[le] = j[le] || {};
pe.x1 = F, pe.y1 = T, pe.x2 = A, pe.y2 = R, pe.w = A - F, pe.h = R - T, Pa(e, F, T, A, R), Pa(o.labelBounds.all, F, T, A, R);
}
return e;
}
}, kwe = function(e, t) {
if (!t.cy().headless()) {
var n = t.pstyle("outline-opacity").value, r = t.pstyle("outline-width").value;
if (n > 0 && r > 0) {
var o = t.pstyle("outline-offset").value, a = t.pstyle("shape").value, i = r + o, s = (e.w + i * 2) / e.w, l = (e.h + i * 2) / e.h, u = 0, c = 0;
["diamond", "pentagon", "round-triangle"].includes(a) ? (s = (e.w + i * 2.4) / e.w, c = -i / 3.6) : ["concave-hexagon", "rhomboid", "right-rhomboid"].includes(a) ? s = (e.w + i * 2.4) / e.w : a === "star" ? (s = (e.w + i * 2.8) / e.w, l = (e.h + i * 2.6) / e.h, c = -i / 3.8) : a === "triangle" ? (s = (e.w + i * 2.8) / e.w, l = (e.h + i * 2.4) / e.h, c = -i / 1.4) : a === "vee" && (s = (e.w + i * 4.4) / e.w, l = (e.h + i * 3.8) / e.h, c = -i * 0.5);
var d = e.h * l - e.h, p = e.w * s - e.w;
if (Gv(e, [Math.ceil(d / 2), Math.ceil(p / 2)]), u != 0 || c !== 0) {
var h = Hme(e, u, c);
DB(e, h);
}
}
}
}, Cwe = function(e, t) {
var n = e._private.cy, r = n.styleEnabled(), o = n.headless(), a = Fo(), i = e._private, s = e.isNode(), l = e.isEdge(), u, c, d, p, h, f, v = i.rstyle, m = s && r ? e.pstyle("bounds-expansion").pfValue : [0], g = function(_e) {
return _e.pstyle("display").value !== "none";
}, b = !r || g(e) && (!l || g(e.source()) && g(e.target()));
if (b) {
var x = 0, w = 0;
r && t.includeOverlays && (x = e.pstyle("overlay-opacity").value, x !== 0 && (w = e.pstyle("overlay-padding").value));
var k = 0, C = 0;
r && t.includeUnderlays && (k = e.pstyle("underlay-opacity").value, k !== 0 && (C = e.pstyle("underlay-padding").value));
var _ = Math.max(w, C), $ = 0, O = 0;
if (r && ($ = e.pstyle("width").pfValue, O = $ / 2), s && t.includeNodes) {
var F = e.position();
h = F.x, f = F.y;
var A = e.outerWidth(), T = A / 2, R = e.outerHeight(), M = R / 2;
u = h - T, c = h + T, d = f - M, p = f + M, Pa(a, u, d, c, p), r && t.includeOutlines && kwe(a, e);
} else if (l && t.includeEdges)
if (r && !o) {
var j = e.pstyle("curve-style").strValue;
if (u = Math.min(v.srcX, v.midX, v.tgtX), c = Math.max(v.srcX, v.midX, v.tgtX), d = Math.min(v.srcY, v.midY, v.tgtY), p = Math.max(v.srcY, v.midY, v.tgtY), u -= O, c += O, d -= O, p += O, Pa(a, u, d, c, p), j === "haystack") {
var P = v.haystackPts;
if (P && P.length === 2) {
if (u = P[0].x, d = P[0].y, c = P[1].x, p = P[1].y, u > c) {
var V = u;
u = c, c = V;
}
if (d > p) {
var U = d;
d = p, p = U;
}
Pa(a, u - O, d - O, c + O, p + O);
}
} else if (j === "bezier" || j === "unbundled-bezier" || j.endsWith("segments") || j.endsWith("taxi")) {
var G;
switch (j) {
case "bezier":
case "unbundled-bezier":
G = v.bezierPts;
break;
case "segments":
case "taxi":
case "round-segments":
case "round-taxi":
G = v.linePts;
break;
}
if (G != null)
for (var se = 0; se < G.length; se++) {
var ae = G[se];
u = ae.x - O, c = ae.x + O, d = ae.y - O, p = ae.y + O, Pa(a, u, d, c, p);
}
}
} else {
var de = e.source(), me = de.position(), te = e.target(), oe = te.position();
if (u = me.x, c = oe.x, d = me.y, p = oe.y, u > c) {
var ne = u;
u = c, c = ne;
}
if (d > p) {
var ee = d;
d = p, p = ee;
}
u -= O, c += O, d -= O, p += O, Pa(a, u, d, c, p);
}
if (r && t.includeEdges && l && (lv(a, e, "mid-source"), lv(a, e, "mid-target"), lv(a, e, "source"), lv(a, e, "target")), r) {
var Z = e.pstyle("ghost").value === "yes";
if (Z) {
var le = e.pstyle("ghost-offset-x").pfValue, pe = e.pstyle("ghost-offset-y").pfValue;
Pa(a, a.x1 + le, a.y1 + pe, a.x2 + le, a.y2 + pe);
}
}
var ke = i.bodyBounds = i.bodyBounds || {};
LO(ke, a), Gv(ke, m), Kv(ke, 1), r && (u = a.x1, c = a.x2, d = a.y1, p = a.y2, Pa(a, u - _, d - _, c + _, p + _));
var Ne = i.overlayBounds = i.overlayBounds || {};
LO(Ne, a), Gv(Ne, m), Kv(Ne, 1);
var De = i.labelBounds = i.labelBounds || {};
De.all != null ? Vme(De.all) : De.all = Fo(), r && t.includeLabels && (t.includeMainLabels && my(a, e, null), l && (t.includeSourceLabels && my(a, e, "source"), t.includeTargetLabels && my(a, e, "target")));
}
return a.x1 = Yo(a.x1), a.y1 = Yo(a.y1), a.x2 = Yo(a.x2), a.y2 = Yo(a.y2), a.w = Yo(a.x2 - a.x1), a.h = Yo(a.y2 - a.y1), a.w > 0 && a.h > 0 && b && (Gv(a, m), Kv(a, 1)), a;
}, dz = function(e) {
var t = 0, n = function(o) {
return (o ? 1 : 0) << t++;
}, r = 0;
return r += n(e.incudeNodes), r += n(e.includeEdges), r += n(e.includeLabels), r += n(e.includeMainLabels), r += n(e.includeSourceLabels), r += n(e.includeTargetLabels), r += n(e.includeOverlays), r += n(e.includeOutlines), r;
}, pz = function(e) {
if (e.isEdge()) {
var t = e.source().position(), n = e.target().position(), r = function(o) {
return Math.round(o);
};
return ume([r(t.x), r(t.y), r(n.x), r(n.y)]);
} else
return 0;
}, nF = function(e, t) {
var n = e._private, r, o = e.isEdge(), a = t == null ? rF : dz(t), i = a === rF, s = pz(e), l = n.bbCachePosKey === s, u = t.useCache && l, c = function(h) {
return h._private.bbCache == null || h._private.styleDirty;
}, d = !u || c(e) || o && c(e.source()) || c(e.target());
if (d ? (l || e.recalculateRenderedStyle(u), r = Cwe(e, ff), n.bbCache = r, n.bbCachePosKey = s) : r = n.bbCache, !i) {
var p = e.isNode();
r = Fo(), (t.includeNodes && p || t.includeEdges && !p) && (t.includeOverlays ? Bl(r, n.overlayBounds) : Bl(r, n.bodyBounds)), t.includeLabels && (t.includeMainLabels && (!o || t.includeSourceLabels && t.includeTargetLabels) ? Bl(r, n.labelBounds.all) : (t.includeMainLabels && Bl(r, n.labelBounds.mainRot), t.includeSourceLabels && Bl(r, n.labelBounds.sourceRot), t.includeTargetLabels && Bl(r, n.labelBounds.targetRot))), r.w = r.x2 - r.x1, r.h = r.y2 - r.y1;
}
return r;
}, ff = {
includeNodes: !0,
includeEdges: !0,
includeLabels: !0,
includeMainLabels: !0,
includeSourceLabels: !0,
includeTargetLabels: !0,
includeOverlays: !0,
includeUnderlays: !0,
includeOutlines: !0,
useCache: !0
}, rF = dz(ff), oF = Br(ff);
xl.boundingBox = function(e) {
var t;
if (this.length === 1 && this[0]._private.bbCache != null && !this[0]._private.styleDirty && (e === void 0 || e.useCache === void 0 || e.useCache === !0))
e === void 0 ? e = ff : e = oF(e), t = nF(this[0], e);
else {
t = Fo(), e = e || ff;
var n = oF(e), r = this, o = r.cy(), a = o.styleEnabled();
if (a)
for (var i = 0; i < r.length; i++) {
var s = r[i], l = s._private, u = pz(s), c = l.bbCachePosKey === u, d = n.useCache && c && !l.styleDirty;
s.recalculateRenderedStyle(d);
}
this.updateCompoundBounds(!e.useCache);
for (var p = 0; p < r.length; p++) {
var h = r[p];
Bl(t, nF(h, n));
}
}
return t.x1 = Yo(t.x1), t.y1 = Yo(t.y1), t.x2 = Yo(t.x2), t.y2 = Yo(t.y2), t.w = Yo(t.x2 - t.x1), t.h = Yo(t.y2 - t.y1), t;
};
xl.dirtyBoundingBoxCache = function() {
for (var e = 0; e < this.length; e++) {
var t = this[e]._private;
t.bbCache = null, t.bbCachePosKey = null, t.bodyBounds = null, t.overlayBounds = null, t.labelBounds.all = null, t.labelBounds.source = null, t.labelBounds.target = null, t.labelBounds.main = null, t.labelBounds.sourceRot = null, t.labelBounds.targetRot = null, t.labelBounds.mainRot = null, t.arrowBounds.source = null, t.arrowBounds.target = null, t.arrowBounds["mid-source"] = null, t.arrowBounds["mid-target"] = null;
}
return this.emitAndNotify("bounds"), this;
};
xl.boundingBoxAt = function(e) {
var t = this.nodes(), n = this.cy(), r = n.hasCompoundNodes(), o = n.collection();
if (r && (o = t.filter(function(u) {
return u.isParent();
}), t = t.not(o)), Xt(e)) {
var a = e;
e = function() {
return a;
};
}
var i = function(u, c) {
return u._private.bbAtOldPos = e(u, c);
}, s = function(u) {
return u._private.bbAtOldPos;
};
n.startBatch(), t.forEach(i).silentPositions(e), r && (o.dirtyCompoundBoundsCache(), o.dirtyBoundingBoxCache(), o.updateCompoundBounds(!0));
var l = jme(this.boundingBox({
useCache: !1
}));
return t.silentPositions(s), r && (o.dirtyCompoundBoundsCache(), o.dirtyBoundingBoxCache(), o.updateCompoundBounds(!0)), n.endBatch(), l;
};
Oc.boundingbox = Oc.bb = Oc.boundingBox;
Oc.renderedBoundingbox = Oc.renderedBoundingBox;
var _we = xl, wp, oh;
wp = oh = {};
var fz = function(e) {
e.uppercaseName = EO(e.name), e.autoName = "auto" + e.uppercaseName, e.labelName = "label" + e.uppercaseName, e.outerName = "outer" + e.uppercaseName, e.uppercaseOuterName = EO(e.outerName), wp[e.name] = function() {
var t = this[0], n = t._private, r = n.cy, o = r._private.styleEnabled;
if (t)
if (o) {
if (t.isParent())
return t.updateCompoundBounds(), n[e.autoName] || 0;
var a = t.pstyle(e.name);
switch (a.strValue) {
case "label":
return t.recalculateRenderedStyle(), n.rstyle[e.labelName] || 0;
default:
return a.pfValue;
}
} else
return 1;
}, wp["outer" + e.uppercaseName] = function() {
var t = this[0], n = t._private, r = n.cy, o = r._private.styleEnabled;
if (t)
if (o) {
var a = t[e.name](), i = t.pstyle("border-width").pfValue, s = 2 * t.padding();
return a + i + s;
} else
return 1;
}, wp["rendered" + e.uppercaseName] = function() {
var t = this[0];
if (t) {
var n = t[e.name]();
return n * this.cy().zoom();
}
}, wp["rendered" + e.uppercaseOuterName] = function() {
var t = this[0];
if (t) {
var n = t[e.outerName]();
return n * this.cy().zoom();
}
};
};
fz({
name: "width"
});
fz({
name: "height"
});
oh.padding = function() {
var e = this[0], t = e._private;
return e.isParent() ? (e.updateCompoundBounds(), t.autoPadding !== void 0 ? t.autoPadding : e.pstyle("padding").pfValue) : e.pstyle("padding").pfValue;
};
oh.paddedHeight = function() {
var e = this[0];
return e.height() + 2 * e.padding();
};
oh.paddedWidth = function() {
var e = this[0];
return e.width() + 2 * e.padding();
};
var Swe = oh, $we = function(e, t) {
if (e.isEdge())
return t(e);
}, Ewe = function(e, t) {
if (e.isEdge()) {
var n = e.cy();
return vm(t(e), n.zoom(), n.pan());
}
}, Owe = function(e, t) {
if (e.isEdge()) {
var n = e.cy(), r = n.pan(), o = n.zoom();
return t(e).map(function(a) {
return vm(a, o, r);
});
}
}, Fwe = function(e) {
return e.renderer().getControlPoints(e);
}, Twe = function(e) {
return e.renderer().getSegmentPoints(e);
}, Awe = function(e) {
return e.renderer().getSourceEndpoint(e);
}, Iwe = function(e) {
return e.renderer().getTargetEndpoint(e);
}, Pwe = function(e) {
return e.renderer().getEdgeMidpoint(e);
}, aF = {
controlPoints: {
get: Fwe,
mult: !0
},
segmentPoints: {
get: Twe,
mult: !0
},
sourceEndpoint: {
get: Awe
},
targetEndpoint: {
get: Iwe
},
midpoint: {
get: Pwe
}
}, Lwe = function(e) {
return "rendered" + e[0].toUpperCase() + e.substr(1);
}, Rwe = Object.keys(aF).reduce(function(e, t) {
var n = aF[t], r = Lwe(t);
return e[t] = function() {
return $we(this, n.get);
}, n.mult ? e[r] = function() {
return Owe(this, n.get);
} : e[r] = function() {
return Ewe(this, n.get);
}, e;
}, {}), Nwe = _t({}, xwe, _we, Swe, Rwe);
/*!
Event object based on jQuery events, MIT license
https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*/
var hz = function(e, t) {
this.recycle(e, t);
};
function np() {
return !1;
}
function uv() {
return !0;
}
hz.prototype = {
instanceString: function() {
return "event";
},
recycle: function(e, t) {
if (this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = np, e != null && e.preventDefault ? (this.type = e.type, this.isDefaultPrevented = e.defaultPrevented ? uv : np) : e != null && e.type ? t = e : this.type = e, t != null && (this.originalEvent = t.originalEvent, this.type = t.type != null ? t.type : this.type, this.cy = t.cy, this.target = t.target, this.position = t.position, this.renderedPosition = t.renderedPosition, this.namespace = t.namespace, this.layout = t.layout), this.cy != null && this.position != null && this.renderedPosition == null) {
var n = this.position, r = this.cy.zoom(), o = this.cy.pan();
this.renderedPosition = {
x: n.x * r + o.x,
y: n.y * r + o.y
};
}
this.timeStamp = e && e.timeStamp || Date.now();
},
preventDefault: function() {
this.isDefaultPrevented = uv;
var e = this.originalEvent;
e && e.preventDefault && e.preventDefault();
},
stopPropagation: function() {
this.isPropagationStopped = uv;
var e = this.originalEvent;
e && e.stopPropagation && e.stopPropagation();
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = uv, this.stopPropagation();
},
isDefaultPrevented: np,
isPropagationStopped: np,
isImmediatePropagationStopped: np
};
var vz = /^([^.]+)(\.(?:[^.]+))?$/, Mwe = ".*", gz = {
qualifierCompare: function(e, t) {
return e === t;
},
eventMatches: function() {
return !0;
},
addEventFields: function() {
},
callbackContext: function(e) {
return e;
},
beforeEmit: function() {
},
afterEmit: function() {
},
bubble: function() {
return !1;
},
parent: function() {
return null;
},
context: null
}, iF = Object.keys(gz), Dwe = {};
function xm() {
for (var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Dwe, t = arguments.length > 1 ? arguments[1] : void 0, n = 0; n < iF.length; n++) {
var r = iF[n];
this[r] = e[r] || gz[r];
}
this.context = t || this.context, this.listeners = [], this.emitting = 0;
}
var ll = xm.prototype, mz = function(e, t, n, r, o, a, i) {
Nn(r) && (o = r, r = null), i && (a == null ? a = i : a = _t({}, a, i));
for (var s = dn(n) ? n : n.split(/\s+/), l = 0; l < s.length; l++) {
var u = s[l];
if (!ol(u)) {
var c = u.match(vz);
if (c) {
var d = c[1], p = c[2] ? c[2] : null, h = t(e, u, d, p, r, o, a);
if (h === !1)
break;
}
}
}
}, sF = function(e, t) {
return e.addEventFields(e.context, t), new hz(t.type, t);
}, Bwe = function(e, t, n) {
if (a0e(n)) {
t(e, n);
return;
} else if (Xt(n)) {
t(e, sF(e, n));
return;
}
for (var r = dn(n) ? n : n.split(/\s+/), o = 0; o < r.length; o++) {
var a = r[o];
if (!ol(a)) {
var i = a.match(vz);
if (i) {
var s = i[1], l = i[2] ? i[2] : null, u = sF(e, {
type: s,
namespace: l,
target: e.context
});
t(e, u);
}
}
}
};
ll.on = ll.addListener = function(e, t, n, r, o) {
return mz(this, function(a, i, s, l, u, c, d) {
Nn(c) && a.listeners.push({
event: i,
// full event string
callback: c,
// callback to run
type: s,
// the event type (e.g. 'click')
namespace: l,
// the event namespace (e.g. ".foo")
qualifier: u,
// a restriction on whether to match this emitter
conf: d
// additional configuration
});
}, e, t, n, r, o), this;
};
ll.one = function(e, t, n, r) {
return this.on(e, t, n, r, {
one: !0
});
};
ll.removeListener = ll.off = function(e, t, n, r) {
var o = this;
this.emitting !== 0 && (this.listeners = hme(this.listeners));
for (var a = this.listeners, i = function(l) {
var u = a[l];
mz(o, function(c, d, p, h, f, v) {
if ((u.type === p || e === "*") && (!h && u.namespace !== ".*" || u.namespace === h) && (!f || c.qualifierCompare(u.qualifier, f)) && (!v || u.callback === v))
return a.splice(l, 1), !1;
}, e, t, n, r);
}, s = a.length - 1; s >= 0; s--)
i(s);
return this;
};
ll.removeAllListeners = function() {
return this.removeListener("*");
};
ll.emit = ll.trigger = function(e, t, n) {
var r = this.listeners, o = r.length;
return this.emitting++, dn(t) || (t = [t]), Bwe(this, function(a, i) {
n != null && (r = [{
event: i.event,
type: i.type,
namespace: i.namespace,
callback: n
}], o = r.length);
for (var s = function(u) {
var c = r[u];
if (c.type === i.type && (!c.namespace || c.namespace === i.namespace || c.namespace === Mwe) && a.eventMatches(a.context, c, i)) {
var d = [i];
t != null && gme(d, t), a.beforeEmit(a.context, c, i), c.conf && c.conf.one && (a.listeners = a.listeners.filter(function(f) {
return f !== c;
}));
var p = a.callbackContext(a.context, c, i), h = c.callback.apply(p, d);
a.afterEmit(a.context, c, i), h === !1 && (i.stopPropagation(), i.preventDefault());
}
}, l = 0; l < o; l++)
s(l);
a.bubble(a.context) && !i.isPropagationStopped() && a.parent(a.context).emit(i, t);
}, e), this.emitting--, this;
};
var zwe = {
qualifierCompare: function(e, t) {
return e == null || t == null ? e == null && t == null : e.sameText(t);
},
eventMatches: function(e, t, n) {
var r = t.qualifier;
return r != null ? e !== n.target && th(n.target) && r.matches(n.target) : !0;
},
addEventFields: function(e, t) {
t.cy = e.cy(), t.target = e;
},
callbackContext: function(e, t, n) {
return t.qualifier != null ? n.target : e;
},
beforeEmit: function(e, t) {
t.conf && t.conf.once && t.conf.onceCollection.removeListener(t.event, t.qualifier, t.callback);
},
bubble: function() {
return !0;
},
parent: function(e) {
return e.isChild() ? e.parent() : e.cy();
}
}, cv = function(e) {
return gt(e) ? new il(e) : e;
}, yz = {
createEmitter: function() {
for (var e = 0; e < this.length; e++) {
var t = this[e], n = t._private;
n.emitter || (n.emitter = new xm(zwe, t));
}
return this;
},
emitter: function() {
return this._private.emitter;
},
on: function(e, t, n) {
for (var r = cv(t), o = 0; o < this.length; o++) {
var a = this[o];
a.emitter().on(e, r, n);
}
return this;
},
removeListener: function(e, t, n) {
for (var r = cv(t), o = 0; o < this.length; o++) {
var a = this[o];
a.emitter().removeListener(e, r, n);
}
return this;
},
removeAllListeners: function() {
for (var e = 0; e < this.length; e++) {
var t = this[e];
t.emitter().removeAllListeners();
}
return this;
},
one: function(e, t, n) {
for (var r = cv(t), o = 0; o < this.length; o++) {
var a = this[o];
a.emitter().one(e, r, n);
}
return this;
},
once: function(e, t, n) {
for (var r = cv(t), o = 0; o < this.length; o++) {
var a = this[o];
a.emitter().on(e, r, n, {
once: !0,
onceCollection: this
});
}
},
emit: function(e, t) {
for (var n = 0; n < this.length; n++) {
var r = this[n];
r.emitter().emit(e, t);
}
return this;
},
emitAndNotify: function(e, t) {
if (this.length !== 0)
return this.cy().notify(e, this), this.emit(e, t), this;
}
};
an.eventAliasesOn(yz);
var bz = {
nodes: function(e) {
return this.filter(function(t) {
return t.isNode();
}).filter(e);
},
edges: function(e) {
return this.filter(function(t) {
return t.isEdge();
}).filter(e);
},
// internal helper to get nodes and edges as separate collections with single iteration over elements
byGroup: function() {
for (var e = this.spawn(), t = this.spawn(), n = 0; n < this.length; n++) {
var r = this[n];
r.isNode() ? e.push(r) : t.push(r);
}
return {
nodes: e,
edges: t
};
},
filter: function(e, t) {
if (e === void 0)
return this;
if (gt(e) || Mo(e))
return new il(e).filter(this);
if (Nn(e)) {
for (var n = this.spawn(), r = this, o = 0; o < r.length; o++) {
var a = r[o], i = t ? e.apply(t, [a, o, r]) : e(a, o, r);
i && n.push(a);
}
return n;
}
return this.spawn();
},
not: function(e) {
if (e) {
gt(e) && (e = this.filter(e));
for (var t = this.spawn(), n = 0; n < this.length; n++) {
var r = this[n], o = e.has(r);
o || t.push(r);
}
return t;
} else
return this;
},
absoluteComplement: function() {
var e = this.cy();
return e.mutableElements().not(this);
},
intersect: function(e) {
if (gt(e)) {
var t = e;
return this.filter(t);
}
for (var n = this.spawn(), r = this, o = e, a = this.length < e.length, i = a ? r : o, s = a ? o : r, l = 0; l < i.length; l++) {
var u = i[l];
s.has(u) && n.push(u);
}
return n;
},
xor: function(e) {
var t = this._private.cy;
gt(e) && (e = t.$(e));
var n = this.spawn(), r = this, o = e, a = function(i, s) {
for (var l = 0; l < i.length; l++) {
var u = i[l], c = u._private.data.id, d = s.hasElementWithId(c);
d || n.push(u);
}
};
return a(r, o), a(o, r), n;
},
diff: function(e) {
var t = this._private.cy;
gt(e) && (e = t.$(e));
var n = this.spawn(), r = this.spawn(), o = this.spawn(), a = this, i = e, s = function(l, u, c) {
for (var d = 0; d < l.length; d++) {
var p = l[d], h = p._private.data.id, f = u.hasElementWithId(h);
f ? o.merge(p) : c.push(p);
}
};
return s(a, i, n), s(i, a, r), {
left: n,
right: r,
both: o
};
},
add: function(e) {
var t = this._private.cy;
if (!e)
return this;
if (gt(e)) {
var n = e;
e = t.mutableElements().filter(n);
}
for (var r = this.spawnSelf(), o = 0; o < e.length; o++) {
var a = e[o], i = !this.has(a);
i && r.push(a);
}
return r;
},
// in place merge on calling collection
merge: function(e) {
var t = this._private, n = t.cy;
if (!e)
return this;
if (e && gt(e)) {
var r = e;
e = n.mutableElements().filter(r);
}
for (var o = t.map, a = 0; a < e.length; a++) {
var i = e[a], s = i._private.data.id, l = !o.has(s);
if (l) {
var u = this.length++;
this[u] = i, o.set(s, {
ele: i,
index: u
});
}
}
return this;
},
unmergeAt: function(e) {
var t = this[e], n = t.id(), r = this._private, o = r.map;
this[e] = void 0, o.delete(n);
var a = e === this.length - 1;
if (this.length > 1 && !a) {
var i = this.length - 1, s = this[i], l = s._private.data.id;
this[i] = void 0, this[e] = s, o.set(l, {
ele: s,
index: e
});
}
return this.length--, this;
},
// remove single ele in place in calling collection
unmergeOne: function(e) {
e = e[0];
var t = this._private, n = e._private.data.id, r = t.map, o = r.get(n);
if (!o)
return this;
var a = o.index;
return this.unmergeAt(a), this;
},
// remove eles in place on calling collection
unmerge: function(e) {
var t = this._private.cy;
if (!e)
return this;
if (e && gt(e)) {
var n = e;
e = t.mutableElements().filter(n);
}
for (var r = 0; r < e.length; r++)
this.unmergeOne(e[r]);
return this;
},
unmergeBy: function(e) {
for (var t = this.length - 1; t >= 0; t--) {
var n = this[t];
e(n) && this.unmergeAt(t);
}
return this;
},
map: function(e, t) {
for (var n = [], r = this, o = 0; o < r.length; o++) {
var a = r[o], i = t ? e.apply(t, [a, o, r]) : e(a, o, r);
n.push(i);
}
return n;
},
reduce: function(e, t) {
for (var n = t, r = this, o = 0; o < r.length; o++)
n = e(n, r[o], o, r);
return n;
},
max: function(e, t) {
for (var n = -1 / 0, r, o = this, a = 0; a < o.length; a++) {
var i = o[a], s = t ? e.apply(t, [i, a, o]) : e(i, a, o);
s > n && (n = s, r = i);
}
return {
value: n,
ele: r
};
},
min: function(e, t) {
for (var n = 1 / 0, r, o = this, a = 0; a < o.length; a++) {
var i = o[a], s = t ? e.apply(t, [i, a, o]) : e(i, a, o);
s < n && (n = s, r = i);
}
return {
value: n,
ele: r
};
}
}, Jt = bz;
Jt.u = Jt["|"] = Jt["+"] = Jt.union = Jt.or = Jt.add;
Jt["\\"] = Jt["!"] = Jt["-"] = Jt.difference = Jt.relativeComplement = Jt.subtract = Jt.not;
Jt.n = Jt["&"] = Jt["."] = Jt.and = Jt.intersection = Jt.intersect;
Jt["^"] = Jt["(+)"] = Jt["(-)"] = Jt.symmetricDifference = Jt.symdiff = Jt.xor;
Jt.fnFilter = Jt.filterFn = Jt.stdFilter = Jt.filter;
Jt.complement = Jt.abscomp = Jt.absoluteComplement;
var jwe = {
isNode: function() {
return this.group() === "nodes";
},
isEdge: function() {
return this.group() === "edges";
},
isLoop: function() {
return this.isEdge() && this.source()[0] === this.target()[0];
},
isSimple: function() {
return this.isEdge() && this.source()[0] !== this.target()[0];
},
group: function() {
var e = this[0];
if (e)
return e._private.group;
}
}, wz = function(e, t) {
var n = e.cy(), r = n.hasCompoundNodes();
function o(u) {
var c = u.pstyle("z-compound-depth");
return c.value === "auto" ? r ? u.zDepth() : 0 : c.value === "bottom" ? -1 : c.value === "top" ? h$ : 0;
}
var a = o(e) - o(t);
if (a !== 0)
return a;
function i(u) {
var c = u.pstyle("z-index-compare");
return c.value === "auto" && u.isNode() ? 1 : 0;
}
var s = i(e) - i(t);
if (s !== 0)
return s;
var l = e.pstyle("z-index").value - t.pstyle("z-index").value;
return l !== 0 ? l : e.poolIndex() - t.poolIndex();
}, Ug = {
forEach: function(e, t) {
if (Nn(e))
for (var n = this.length, r = 0; r < n; r++) {
var o = this[r], a = t ? e.apply(t, [o, r, this]) : e(o, r, this);
if (a === !1)
break;
}
return this;
},
toArray: function() {
for (var e = [], t = 0; t < this.length; t++)
e.push(this[t]);
return e;
},
slice: function(e, t) {
var n = [], r = this.length;
t == null && (t = r), e == null && (e = 0), e < 0 && (e = r + e), t < 0 && (t = r + t);
for (var o = e; o >= 0 && o < t && o < r; o++)
n.push(this[o]);
return this.spawn(n);
},
size: function() {
return this.length;
},
eq: function(e) {
return this[e] || this.spawn();
},
first: function() {
return this[0] || this.spawn();
},
last: function() {
return this[this.length - 1] || this.spawn();
},
empty: function() {
return this.length === 0;
},
nonempty: function() {
return !this.empty();
},
sort: function(e) {
if (!Nn(e))
return this;
var t = this.toArray().sort(e);
return this.spawn(t);
},
sortByZIndex: function() {
return this.sort(wz);
},
zDepth: function() {
var e = this[0];
if (e) {
var t = e._private, n = t.group;
if (n === "nodes") {
var r = t.data.parent ? e.parents().size() : 0;
return e.isParent() ? r : h$ - 1;
} else {
var o = t.source, a = t.target, i = o.zDepth(), s = a.zDepth();
return Math.max(i, s, 0);
}
}
}
};
Ug.each = Ug.forEach;
var Vwe = function() {
var e = "undefined", t = (typeof Symbol > "u" ? "undefined" : cr(Symbol)) != e && cr(Symbol.iterator) != e;
t && (Ug[Symbol.iterator] = function() {
var n = this, r = {
value: void 0,
done: !1
}, o = 0, a = this.length;
return gB({
next: function() {
return o < a ? r.value = n[o++] : (r.value = void 0, r.done = !0), r;
}
}, Symbol.iterator, function() {
return this;
});
});
};
Vwe();
var Hwe = Br({
nodeDimensionsIncludeLabels: !1
}), Yv = {
// Calculates and returns node dimensions { x, y } based on options given
layoutDimensions: function(e) {
e = Hwe(e);
var t;
if (!this.takesUpSpace())
t = {
w: 0,
h: 0
};
else if (e.nodeDimensionsIncludeLabels) {
var n = this.boundingBox();
t = {
w: n.w,
h: n.h
};
} else
t = {
w: this.outerWidth(),
h: this.outerHeight()
};
return (t.w === 0 || t.h === 0) && (t.w = t.h = 1), t;
},
// using standard layout options, apply position function (w/ or w/o animation)
layoutPositions: function(e, t, n) {
var r = this.nodes().filter(function(w) {
return !w.isParent();
}), o = this.cy(), a = t.eles, i = function(w) {
return w.id();
}, s = of(n, i);
e.emit({
type: "layoutstart",
layout: e
}), e.animations = [];
var l = function(w, k, C) {
var _ = {
x: k.x1 + k.w / 2,
y: k.y1 + k.h / 2
}, $ = {
// scale from center of bounding box (not necessarily 0,0)
x: (C.x - _.x) * w,
y: (C.y - _.y) * w
};
return {
x: _.x + $.x,
y: _.y + $.y
};
}, u = t.spacingFactor && t.spacingFactor !== 1, c = function() {
if (!u)
return null;
for (var w = Fo(), k = 0; k < r.length; k++) {
var C = r[k], _ = s(C, k);
Ume(w, _.x, _.y);
}
return w;
}, d = c(), p = of(function(w, k) {
var C = s(w, k);
if (u) {
var _ = Math.abs(t.spacingFactor);
C = l(_, d, C);
}
return t.transform != null && (C = t.transform(w, C)), C;
}, i);
if (t.animate) {
for (var h = 0; h < r.length; h++) {
var f = r[h], v = p(f, h), m = t.animateFilter == null || t.animateFilter(f, h);
if (m) {
var g = f.animation({
position: v,
duration: t.animationDuration,
easing: t.animationEasing
});
e.animations.push(g);
} else
f.position(v);
}
if (t.fit) {
var b = o.animation({
fit: {
boundingBox: a.boundingBoxAt(p),
padding: t.padding
},
duration: t.animationDuration,
easing: t.animationEasing
});
e.animations.push(b);
} else if (t.zoom !== void 0 && t.pan !== void 0) {
var x = o.animation({
zoom: t.zoom,
pan: t.pan,
duration: t.animationDuration,
easing: t.animationEasing
});
e.animations.push(x);
}
e.animations.forEach(function(w) {
return w.play();
}), e.one("layoutready", t.ready), e.emit({
type: "layoutready",
layout: e
}), md.all(e.animations.map(function(w) {
return w.promise();
})).then(function() {
e.one("layoutstop", t.stop), e.emit({
type: "layoutstop",
layout: e
});
});
} else
r.positions(p), t.fit && o.fit(t.eles, t.padding), t.zoom != null && o.zoom(t.zoom), t.pan && o.pan(t.pan), e.one("layoutready", t.ready), e.emit({
type: "layoutready",
layout: e
}), e.one("layoutstop", t.stop), e.emit({
type: "layoutstop",
layout: e
});
return this;
},
layout: function(e) {
var t = this.cy();
return t.makeLayout(_t({}, e, {
eles: this
}));
}
};
Yv.createLayout = Yv.makeLayout = Yv.layout;
function xz(e, t, n) {
var r = n._private, o = r.styleCache = r.styleCache || [], a;
return (a = o[e]) != null || (a = o[e] = t(n)), a;
}
function km(e, t) {
return e = pu(e), function(n) {
return xz(e, t, n);
};
}
function Cm(e, t) {
e = pu(e);
var n = function(r) {
return t.call(r);
};
return function() {
var r = this[0];
if (r)
return xz(e, n, r);
};
}
var Lr = {
recalculateRenderedStyle: function(e) {
var t = this.cy(), n = t.renderer(), r = t.styleEnabled();
return n && r && n.recalculateRenderedStyle(this, e), this;
},
dirtyStyleCache: function() {
var e = this.cy(), t = function(r) {
return r._private.styleCache = null;
};
if (e.hasCompoundNodes()) {
var n;
n = this.spawnSelf().merge(this.descendants()).merge(this.parents()), n.merge(n.connectedEdges()), n.forEach(t);
} else
this.forEach(function(r) {
t(r), r.connectedEdges().forEach(t);
});
return this;
},
// fully updates (recalculates) the style for the elements
updateStyle: function(e) {
var t = this._private.cy;
if (!t.styleEnabled())
return this;
if (t.batching()) {
var n = t._private.batchStyleEles;
return n.merge(this), this;
}
var r = t.hasCompoundNodes(), o = this;
e = !!(e || e === void 0), r && (o = this.spawnSelf().merge(this.descendants()).merge(this.parents()));
var a = o;
return e ? a.emitAndNotify("style") : a.emit("style"), o.forEach(function(i) {
return i._private.styleDirty = !0;
}), this;
},
// private: clears dirty flag and recalculates style
cleanStyle: function() {
var e = this.cy();
if (e.styleEnabled())
for (var t = 0; t < this.length; t++) {
var n = this[t];
n._private.styleDirty && (n._private.styleDirty = !1, e.style().apply(n));
}
},
// get the internal parsed style object for the specified property
parsedStyle: function(e) {
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, n = this[0], r = n.cy();
if (r.styleEnabled() && n) {
this.cleanStyle();
var o = n._private.style[e];
return o ?? (t ? r.style().getDefaultProperty(e) : null);
}
},
numericStyle: function(e) {
var t = this[0];
if (t.cy().styleEnabled() && t) {
var n = t.pstyle(e);
return n.pfValue !== void 0 ? n.pfValue : n.value;
}
},
numericStyleUnits: function(e) {
var t = this[0];
if (t.cy().styleEnabled() && t)
return t.pstyle(e).units;
},
// get the specified css property as a rendered value (i.e. on-screen value)
// or get the whole rendered style if no property specified (NB doesn't allow setting)
renderedStyle: function(e) {
var t = this.cy();
if (!t.styleEnabled())
return this;
var n = this[0];
if (n)
return t.style().getRenderedStyle(n, e);
},
// read the calculated css style of the element or override the style (via a bypass)
style: function(e, t) {
var n = this.cy();
if (!n.styleEnabled())
return this;
var r = !1, o = n.style();
if (Xt(e)) {
var a = e;
o.applyBypass(this, a, r), this.emitAndNotify("style");
} else if (gt(e))
if (t === void 0) {
var i = this[0];
return i ? o.getStylePropertyValue(i, e) : void 0;
} else
o.applyBypass(this, e, t, r), this.emitAndNotify("style");
else if (e === void 0) {
var s = this[0];
return s ? o.getRawStyle(s) : void 0;
}
return this;
},
removeStyle: function(e) {
var t = this.cy();
if (!t.styleEnabled())
return this;
var n = !1, r = t.style(), o = this;
if (e === void 0)
for (var a = 0; a < o.length; a++) {
var i = o[a];
r.removeAllBypasses(i, n);
}
else {
e = e.split(/\s+/);
for (var s = 0; s < o.length; s++) {
var l = o[s];
r.removeBypasses(l, e, n);
}
}
return this.emitAndNotify("style"), this;
},
show: function() {
return this.css("display", "element"), this;
},
hide: function() {
return this.css("display", "none"), this;
},
effectiveOpacity: function() {
var e = this.cy();
if (!e.styleEnabled())
return 1;
var t = e.hasCompoundNodes(), n = this[0];
if (n) {
var r = n._private, o = n.pstyle("opacity").value;
if (!t)
return o;
var a = r.data.parent ? n.parents() : null;
if (a)
for (var i = 0; i < a.length; i++) {
var s = a[i], l = s.pstyle("opacity").value;
o = l * o;
}
return o;
}
},
transparent: function() {
var e = this.cy();
if (!e.styleEnabled())
return !1;
var t = this[0], n = t.cy().hasCompoundNodes();
if (t)
return n ? t.effectiveOpacity() === 0 : t.pstyle("opacity").value === 0;
},
backgrounding: function() {
var e = this.cy();
if (!e.styleEnabled())
return !1;
var t = this[0];
return !!t._private.backgrounding;
}
};
function yy(e, t) {
var n = e._private, r = n.data.parent ? e.parents() : null;
if (r)
for (var o = 0; o < r.length; o++) {
var a = r[o];
if (!t(a))
return !1;
}
return !0;
}
function $$(e) {
var t = e.ok, n = e.edgeOkViaNode || e.ok, r = e.parentOk || e.ok;
return function() {
var o = this.cy();
if (!o.styleEnabled())
return !0;
var a = this[0], i = o.hasCompoundNodes();
if (a) {
var s = a._private;
if (!t(a))
return !1;
if (a.isNode())
return !i || yy(a, r);
var l = s.source, u = s.target;
return n(l) && (!i || yy(l, n)) && (l === u || n(u) && (!i || yy(u, n)));
}
};
}
var xd = km("eleTakesUpSpace", function(e) {
return e.pstyle("display").value === "element" && e.width() !== 0 && (e.isNode() ? e.height() !== 0 : !0);
});
Lr.takesUpSpace = Cm("takesUpSpace", $$({
ok: xd
}));
var Uwe = km("eleInteractive", function(e) {
return e.pstyle("events").value === "yes" && e.pstyle("visibility").value === "visible" && xd(e);
}), qwe = km("parentInteractive", function(e) {
return e.pstyle("visibility").value === "visible" && xd(e);
});
Lr.interactive = Cm("interactive", $$({
ok: Uwe,
parentOk: qwe,
edgeOkViaNode: xd
}));
Lr.noninteractive = function() {
var e = this[0];
if (e)
return !e.interactive();
};
var Kwe = km("eleVisible", function(e) {
return e.pstyle("visibility").value === "visible" && e.pstyle("opacity").pfValue !== 0 && xd(e);
}), Gwe = xd;
Lr.visible = Cm("visible", $$({
ok: Kwe,
edgeOkViaNode: Gwe
}));
Lr.hidden = function() {
var e = this[0];
if (e)
return !e.visible();
};
Lr.isBundledBezier = Cm("isBundledBezier", function() {
return this.cy().styleEnabled() ? !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace() : !1;
});
Lr.bypass = Lr.css = Lr.style;
Lr.renderedCss = Lr.renderedStyle;
Lr.removeBypass = Lr.removeCss = Lr.removeStyle;
Lr.pstyle = Lr.parsedStyle;
var Xs = {};
function lF(e) {
return function() {
var t = arguments, n = [];
if (t.length === 2) {
var r = t[0], o = t[1];
this.on(e.event, r, o);
} else if (t.length === 1 && Nn(t[0])) {
var a = t[0];
this.on(e.event, a);
} else if (t.length === 0 || t.length === 1 && dn(t[0])) {
for (var i = t.length === 1 ? t[0] : null, s = 0; s < this.length; s++) {
var l = this[s], u = !e.ableField || l._private[e.ableField], c = l._private[e.field] != e.value;
if (e.overrideAble) {
var d = e.overrideAble(l);
if (d !== void 0 && (u = d, !d))
return this;
}
u && (l._private[e.field] = e.value, c && n.push(l));
}
var p = this.spawn(n);
p.updateStyle(), p.emit(e.event), i && p.emit(i);
}
return this;
};
}
function kd(e) {
Xs[e.field] = function() {
var t = this[0];
if (t) {
if (e.overrideField) {
var n = e.overrideField(t);
if (n !== void 0)
return n;
}
return t._private[e.field];
}
}, Xs[e.on] = lF({
event: e.on,
field: e.field,
ableField: e.ableField,
overrideAble: e.overrideAble,
value: !0
}), Xs[e.off] = lF({
event: e.off,
field: e.field,
ableField: e.ableField,
overrideAble: e.overrideAble,
value: !1
});
}
kd({
field: "locked",
overrideField: function(e) {
return e.cy().autolock() ? !0 : void 0;
},
on: "lock",
off: "unlock"
});
kd({
field: "grabbable",
overrideField: function(e) {
return e.cy().autoungrabify() || e.pannable() ? !1 : void 0;
},
on: "grabify",
off: "ungrabify"
});
kd({
field: "selected",
ableField: "selectable",
overrideAble: function(e) {
return e.cy().autounselectify() ? !1 : void 0;
},
on: "select",
off: "unselect"
});
kd({
field: "selectable",
overrideField: function(e) {
return e.cy().autounselectify() ? !1 : void 0;
},
on: "selectify",
off: "unselectify"
});
Xs.deselect = Xs.unselect;
Xs.grabbed = function() {
var e = this[0];
if (e)
return e._private.grabbed;
};
kd({
field: "active",
on: "activate",
off: "unactivate"
});
kd({
field: "pannable",
on: "panify",
off: "unpanify"
});
Xs.inactive = function() {
var e = this[0];
if (e)
return !e._private.active;
};
var Xr = {}, uF = function(e) {
return function(t) {
for (var n = this, r = [], o = 0; o < n.length; o++) {
var a = n[o];
if (a.isNode()) {
for (var i = !1, s = a.connectedEdges(), l = 0; l < s.length; l++) {
var u = s[l], c = u.source(), d = u.target();
if (e.noIncomingEdges && d === a && c !== a || e.noOutgoingEdges && c === a && d !== a) {
i = !0;
break;
}
}
i || r.push(a);
}
}
return this.spawn(r, !0).filter(t);
};
}, cF = function(e) {
return function(t) {
for (var n = this, r = [], o = 0; o < n.length; o++) {
var a = n[o];
if (a.isNode())
for (var i = a.connectedEdges(), s = 0; s < i.length; s++) {
var l = i[s], u = l.source(), c = l.target();
e.outgoing && u === a ? (r.push(l), r.push(c)) : e.incoming && c === a && (r.push(l), r.push(u));
}
}
return this.spawn(r, !0).filter(t);
};
}, dF = function(e) {
return function(t) {
for (var n = this, r = [], o = {}; ; ) {
var a = e.outgoing ? n.outgoers() : n.incomers();
if (a.length === 0)
break;
for (var i = !1, s = 0; s < a.length; s++) {
var l = a[s], u = l.id();
o[u] || (o[u] = !0, r.push(l), i = !0);
}
if (!i)
break;
n = a;
}
return this.spawn(r, !0).filter(t);
};
};
Xr.clearTraversalCache = function() {
for (var e = 0; e < this.length; e++)
this[e]._private.traversalCache = null;
};
_t(Xr, {
// get the root nodes in the DAG
roots: uF({
noIncomingEdges: !0
}),
// get the leaf nodes in the DAG
leaves: uF({
noOutgoingEdges: !0
}),
// normally called children in graph theory
// these nodes =edges=> outgoing nodes
outgoers: Jo(cF({
outgoing: !0
}), "outgoers"),
// aka DAG descendants
successors: dF({
outgoing: !0
}),
// normally called parents in graph theory
// these nodes <=edges= incoming nodes
incomers: Jo(cF({
incoming: !0
}), "incomers"),
// aka DAG ancestors
predecessors: dF({
incoming: !0
})
});
_t(Xr, {
neighborhood: Jo(function(e) {
for (var t = [], n = this.nodes(), r = 0; r < n.length; r++)
for (var o = n[r], a = o.connectedEdges(), i = 0; i < a.length; i++) {
var s = a[i], l = s.source(), u = s.target(), c = o === l ? u : l;
c.length > 0 && t.push(c[0]), t.push(s[0]);
}
return this.spawn(t, !0).filter(e);
}, "neighborhood"),
closedNeighborhood: function(e) {
return this.neighborhood().add(this).filter(e);
},
openNeighborhood: function(e) {
return this.neighborhood(e);
}
});
Xr.neighbourhood = Xr.neighborhood;
Xr.closedNeighbourhood = Xr.closedNeighborhood;
Xr.openNeighbourhood = Xr.openNeighborhood;
_t(Xr, {
source: Jo(function(e) {
var t = this[0], n;
return t && (n = t._private.source || t.cy().collection()), n && e ? n.filter(e) : n;
}, "source"),
target: Jo(function(e) {
var t = this[0], n;
return t && (n = t._private.target || t.cy().collection()), n && e ? n.filter(e) : n;
}, "target"),
sources: pF({
attr: "source"
}),
targets: pF({
attr: "target"
})
});
function pF(e) {
return function(t) {
for (var n = [], r = 0; r < this.length; r++) {
var o = this[r], a = o._private[e.attr];
a && n.push(a);
}
return this.spawn(n, !0).filter(t);
};
}
_t(Xr, {
edgesWith: Jo(fF(), "edgesWith"),
edgesTo: Jo(fF({
thisIsSrc: !0
}), "edgesTo")
});
function fF(e) {
return function(t) {
var n = [], r = this._private.cy, o = e || {};
gt(t) && (t = r.$(t));
for (var a = 0; a < t.length; a++)
for (var i = t[a]._private.edges, s = 0; s < i.length; s++) {
var l = i[s], u = l._private.data, c = this.hasElementWithId(u.source) && t.hasElementWithId(u.target), d = t.hasElementWithId(u.source) && this.hasElementWithId(u.target), p = c || d;
p && ((o.thisIsSrc || o.thisIsTgt) && (o.thisIsSrc && !c || o.thisIsTgt && !d) || n.push(l));
}
return this.spawn(n, !0);
};
}
_t(Xr, {
connectedEdges: Jo(function(e) {
for (var t = [], n = this, r = 0; r < n.length; r++) {
var o = n[r];
if (o.isNode())
for (var a = o._private.edges, i = 0; i < a.length; i++) {
var s = a[i];
t.push(s);
}
}
return this.spawn(t, !0).filter(e);
}, "connectedEdges"),
connectedNodes: Jo(function(e) {
for (var t = [], n = this, r = 0; r < n.length; r++) {
var o = n[r];
o.isEdge() && (t.push(o.source()[0]), t.push(o.target()[0]));
}
return this.spawn(t, !0).filter(e);
}, "connectedNodes"),
parallelEdges: Jo(hF(), "parallelEdges"),
codirectedEdges: Jo(hF({
codirected: !0
}), "codirectedEdges")
});
function hF(e) {
var t = {
codirected: !1
};
return e = _t({}, t, e), function(n) {
for (var r = [], o = this.edges(), a = e, i = 0; i < o.length; i++)
for (var s = o[i], l = s._private, u = l.source, c = u._private.data.id, d = l.data.target, p = u._private.edges, h = 0; h < p.length; h++) {
var f = p[h], v = f._private.data, m = v.target, g = v.source, b = m === d && g === c, x = c === m && d === g;
(a.codirected && b || !a.codirected && (b || x)) && r.push(f);
}
return this.spawn(r, !0).filter(n);
};
}
_t(Xr, {
components: function(e) {
var t = this, n = t.cy(), r = n.collection(), o = e == null ? t.nodes() : e.nodes(), a = [];
e != null && o.empty() && (o = e.sources());
var i = function(l, u) {
r.merge(l), o.unmerge(l), u.merge(l);
};
if (o.empty())
return t.spawn();
var s = function() {
var l = n.collection();
a.push(l);
var u = o[0];
i(u, l), t.bfs({
directed: !1,
roots: u,
visit: function(c) {
return i(c, l);
}
}), l.forEach(function(c) {
c.connectedEdges().forEach(function(d) {
t.has(d) && l.has(d.source()) && l.has(d.target()) && l.merge(d);
});
});
};
do
s();
while (o.length > 0);
return a;
},
component: function() {
var e = this[0];
return e.cy().mutableElements().components(e)[0];
}
});
Xr.componentsOf = Xr.components;
var Rr = function(e, t) {
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
if (e === void 0) {
Un("A collection must have a reference to the core");
return;
}
var o = new ii(), a = !1;
if (!t)
t = [];
else if (t.length > 0 && Xt(t[0]) && !th(t[0])) {
a = !0;
for (var i = [], s = new gd(), l = 0, u = t.length; l < u; l++) {
var c = t[l];
c.data == null && (c.data = {});
var d = c.data;
if (d.id == null)
d.id = LB();
else if (e.hasElementWithId(d.id) || s.has(d.id))
continue;
var p = new hm(e, c, !1);
i.push(p), s.add(d.id);
}
t = i;
}
this.length = 0;
for (var h = 0, f = t.length; h < f; h++) {
var v = t[h][0];
if (v != null) {
var m = v._private.data.id;
(!n || !o.has(m)) && (n && o.set(m, {
index: this.length,
ele: v
}), this[this.length] = v, this.length++);
}
}
this._private = {
eles: this,
cy: e,
get map() {
return this.lazyMap == null && this.rebuildMap(), this.lazyMap;
},
set map(g) {
this.lazyMap = g;
},
rebuildMap: function() {
for (var g = this.lazyMap = new ii(), b = this.eles, x = 0; x < b.length; x++) {
var w = b[x];
g.set(w.id(), {
index: x,
ele: w
});
}
}
}, n && (this._private.map = o), a && !r && this.restore();
}, kn = hm.prototype = Rr.prototype = Object.create(Array.prototype);
kn.instanceString = function() {
return "collection";
};
kn.spawn = function(e, t) {
return new Rr(this.cy(), e, t);
};
kn.spawnSelf = function() {
return this.spawn(this);
};
kn.cy = function() {
return this._private.cy;
};
kn.renderer = function() {
return this._private.cy.renderer();
};
kn.element = function() {
return this[0];
};
kn.collection = function() {
return wB(this) ? this : new Rr(this._private.cy, [this]);
};
kn.unique = function() {
return new Rr(this._private.cy, this, !0);
};
kn.hasElementWithId = function(e) {
return e = "" + e, this._private.map.has(e);
};
kn.getElementById = function(e) {
e = "" + e;
var t = this._private.cy, n = this._private.map.get(e);
return n ? n.ele : new Rr(t);
};
kn.$id = kn.getElementById;
kn.poolIndex = function() {
var e = this._private.cy, t = e._private.elements, n = this[0]._private.data.id;
return t._private.map.get(n).index;
};
kn.indexOf = function(e) {
var t = e[0]._private.data.id;
return this._private.map.get(t).index;
};
kn.indexOfId = function(e) {
return e = "" + e, this._private.map.get(e).index;
};
kn.json = function(e) {
var t = this.element(), n = this.cy();
if (t == null && e)
return this;
if (t != null) {
var r = t._private;
if (Xt(e)) {
if (n.startBatch(), e.data) {
t.data(e.data);
var o = r.data;
if (t.isEdge()) {
var a = !1, i = {}, s = e.data.source, l = e.data.target;
s != null && s != o.source && (i.source = "" + s, a = !0), l != null && l != o.target && (i.target = "" + l, a = !0), a && (t = t.move(i));
} else {
var u = "parent" in e.data, c = e.data.parent;
u && (c != null || o.parent != null) && c != o.parent && (c === void 0 && (c = null), c != null && (c = "" + c), t = t.move({
parent: c
}));
}
}
e.position && t.position(e.position);
var d = function(f, v, m) {
var g = e[f];
g != null && g !== r[f] && (g ? t[v]() : t[m]());
};
return d("removed", "remove", "restore"), d("selected", "select", "unselect"), d("selectable", "selectify", "unselectify"), d("locked", "lock", "unlock"), d("grabbable", "grabify", "ungrabify"), d("pannable", "panify", "unpanify"), e.classes != null && t.classes(e.classes), n.endBatch(), this;
} else if (e === void 0) {
var p = {
data: ai(r.data),
position: ai(r.position),
group: r.group,
removed: r.removed,
selected: r.selected,
selectable: r.selectable,
locked: r.locked,
grabbable: r.grabbable,
pannable: r.pannable,
classes: null
};
p.classes = "";
var h = 0;
return r.classes.forEach(function(f) {
return p.classes += h++ === 0 ? f : " " + f;
}), p;
}
}
};
kn.jsons = function() {
for (var e = [], t = 0; t < this.length; t++) {
var n = this[t], r = n.json();
e.push(r);
}
return e;
};
kn.clone = function() {
for (var e = this.cy(), t = [], n = 0; n < this.length; n++) {
var r = this[n], o = r.json(), a = new hm(e, o, !1);
t.push(a);
}
return new Rr(e, t);
};
kn.copy = kn.clone;
kn.restore = function() {
for (var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, n = this, r = n.cy(), o = r._private, a = [], i = [], s, l = 0, u = n.length; l < u; l++) {
var c = n[l];
t && !c.removed() || (c.isNode() ? a.push(c) : i.push(c));
}
s = a.concat(i);
var d, p = function() {
s.splice(d, 1), d--;
};
for (d = 0; d < s.length; d++) {
var h = s[d], f = h._private, v = f.data;
if (h.clearTraversalCache(), !(!t && !f.removed)) {
if (v.id === void 0)
v.id = LB();
else if (Ze(v.id))
v.id = "" + v.id;
else if (ol(v.id) || !gt(v.id)) {
Un("Can not create element with invalid string ID `" + v.id + "`"), p();
continue;
} else if (r.hasElementWithId(v.id)) {
Un("Can not create second element with ID `" + v.id + "`"), p();
continue;
}
}
var m = v.id;
if (h.isNode()) {
var g = f.position;
g.x == null && (g.x = 0), g.y == null && (g.y = 0);
}
if (h.isEdge()) {
for (var b = h, x = ["source", "target"], w = x.length, k = !1, C = 0; C < w; C++) {
var _ = x[C], $ = v[_];
Ze($) && ($ = v[_] = "" + v[_]), $ == null || $ === "" ? (Un("Can not create edge `" + m + "` with unspecified " + _), k = !0) : r.hasElementWithId($) || (Un("Can not create edge `" + m + "` with nonexistant " + _ + " `" + $ + "`"), k = !0);
}
if (k) {
p();
continue;
}
var O = r.getElementById(v.source), F = r.getElementById(v.target);
O.same(F) ? O._private.edges.push(b) : (O._private.edges.push(b), F._private.edges.push(b)), b._private.source = O, b._private.target = F;
}
f.map = new ii(), f.map.set(m, {
ele: h,
index: 0
}), f.removed = !1, t && r.addToPool(h);
}
for (var A = 0; A < a.length; A++) {
var T = a[A], R = T._private.data;
Ze(R.parent) && (R.parent = "" + R.parent);
var M = R.parent, j = M != null;
if (j || T._private.parent) {
var P = T._private.parent ? r.collection().merge(T._private.parent) : r.getElementById(M);
if (P.empty())
R.parent = void 0;
else if (P[0].removed())
sn("Node added with missing parent, reference to parent removed"), R.parent = void 0, T._private.parent = null;
else {
for (var V = !1, U = P; !U.empty(); ) {
if (T.same(U)) {
V = !0, R.parent = void 0;
break;
}
U = U.parent();
}
V || (P[0]._private.children.push(T), T._private.parent = P[0], o.hasCompoundNodes = !0);
}
}
}
if (s.length > 0) {
for (var G = s.length === n.length ? n : new Rr(r, s), se = 0; se < G.length; se++) {
var ae = G[se];
ae.isNode() || (ae.parallelEdges().clearTraversalCache(), ae.source().clearTraversalCache(), ae.target().clearTraversalCache());
}
var de;
o.hasCompoundNodes ? de = r.collection().merge(G).merge(G.connectedNodes()).merge(G.parent()) : de = G, de.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e), e ? G.emitAndNotify("add") : t && G.emit("add");
}
return n;
};
kn.removed = function() {
var e = this[0];
return e && e._private.removed;
};
kn.inside = function() {
var e = this[0];
return e && !e._private.removed;
};
kn.remove = function() {
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, n = this, r = [], o = {}, a = n._private.cy;
function i(M) {
for (var j = M._private.edges, P = 0; P < j.length; P++)
l(j[P]);
}
function s(M) {
for (var j = M._private.children, P = 0; P < j.length; P++)
l(j[P]);
}
function l(M) {
var j = o[M.id()];
t && M.removed() || j || (o[M.id()] = !0, M.isNode() ? (r.push(M), i(M), s(M)) : r.unshift(M));
}
for (var u = 0, c = n.length; u < c; u++) {
var d = n[u];
l(d);
}
function p(M, j) {
var P = M._private.edges;
al(P, j), M.clearTraversalCache();
}
function h(M) {
M.clearTraversalCache();
}
var f = [];
f.ids = {};
function v(M, j) {
j = j[0], M = M[0];
var P = M._private.children, V = M.id();
al(P, j), j._private.parent = null, f.ids[V] || (f.ids[V] = !0, f.push(M));
}
n.dirtyCompoundBoundsCache(), t && a.removeFromPool(r);
for (var m = 0; m < r.length; m++) {
var g = r[m];
if (g.isEdge()) {
var b = g.source()[0], x = g.target()[0];
p(b, g), p(x, g);
for (var w = g.parallelEdges(), k = 0; k < w.length; k++) {
var C = w[k];
h(C), C.isBundledBezier() && C.dirtyBoundingBoxCache();
}
} else {
var _ = g.parent();
_.length !== 0 && v(_, g);
}
t && (g._private.removed = !0);
}
var $ = a._private.elements;
a._private.hasCompoundNodes = !1;
for (var O = 0; O < $.length; O++) {
var F = $[O];
if (F.isParent()) {
a._private.hasCompoundNodes = !0;
break;
}
}
var A = new Rr(this.cy(), r);
A.size() > 0 && (e ? A.emitAndNotify("remove") : t && A.emit("remove"));
for (var T = 0; T < f.length; T++) {
var R = f[T];
(!t || !R.removed()) && R.updateStyle();
}
return A;
};
kn.move = function(e) {
var t = this._private.cy, n = this, r = !1, o = !1, a = function(h) {
return h == null ? h : "" + h;
};
if (e.source !== void 0 || e.target !== void 0) {
var i = a(e.source), s = a(e.target), l = i != null && t.hasElementWithId(i), u = s != null && t.hasElementWithId(s);
(l || u) && (t.batch(function() {
n.remove(r, o), n.emitAndNotify("moveout");
for (var h = 0; h < n.length; h++) {
var f = n[h], v = f._private.data;
f.isEdge() && (l && (v.source = i), u && (v.target = s));
}
n.restore(r, o);
}), n.emitAndNotify("move"));
} else if (e.parent !== void 0) {
var c = a(e.parent), d = c === null || t.hasElementWithId(c);
if (d) {
var p = c === null ? void 0 : c;
t.batch(function() {
var h = n.remove(r, o);
h.emitAndNotify("moveout");
for (var f = 0; f < n.length; f++) {
var v = n[f], m = v._private.data;
v.isNode() && (m.parent = p);
}
h.restore(r, o);
}), n.emitAndNotify("move");
}
}
return this;
};
[GB, owe, Wv, Ys, Yc, wwe, wm, Nwe, yz, bz, jwe, Ug, Yv, Lr, Xs, Xr].forEach(function(e) {
_t(kn, e);
});
var Wwe = {
add: function(e) {
var t, n = this;
if (Mo(e)) {
var r = e;
if (r._private.cy === n)
t = r.restore();
else {
for (var o = [], a = 0; a < r.length; a++) {
var i = r[a];
o.push(i.json());
}
t = new Rr(n, o);
}
} else if (dn(e)) {
var s = e;
t = new Rr(n, s);
} else if (Xt(e) && (dn(e.nodes) || dn(e.edges))) {
for (var l = e, u = [], c = ["nodes", "edges"], d = 0, p = c.length; d < p; d++) {
var h = c[d], f = l[h];
if (dn(f))
for (var v = 0, m = f.length; v < m; v++) {
var g = _t({
group: h
}, f[v]);
u.push(g);
}
}
t = new Rr(n, u);
} else {
var b = e;
t = new hm(n, b).collection();
}
return t;
},
remove: function(e) {
if (!Mo(e) && gt(e)) {
var t = e;
e = this.$(t);
}
return e.remove();
}
};
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */
function Ywe(e, t, n, r) {
var o = 4, a = 1e-3, i = 1e-7, s = 10, l = 11, u = 1 / (l - 1), c = typeof Float32Array < "u";
if (arguments.length !== 4)
return !1;
for (var d = 0; d < 4; ++d)
if (typeof arguments[d] != "number" || isNaN(arguments[d]) || !isFinite(arguments[d]))
return !1;
e = Math.min(e, 1), n = Math.min(n, 1), e = Math.max(e, 0), n = Math.max(n, 0);
var p = c ? new Float32Array(l) : new Array(l);
function h(F, A) {
return 1 - 3 * A + 3 * F;
}
function f(F, A) {
return 3 * A - 6 * F;
}
function v(F) {
return 3 * F;
}
function m(F, A, T) {
return ((h(A, T) * F + f(A, T)) * F + v(A)) * F;
}
function g(F, A, T) {
return 3 * h(A, T) * F * F + 2 * f(A, T) * F + v(A);
}
function b(F, A) {
for (var T = 0; T < o; ++T) {
var R = g(A, e, n);
if (R === 0)
return A;
var M = m(A, e, n) - F;
A -= M / R;
}
return A;
}
function x() {
for (var F = 0; F < l; ++F)
p[F] = m(F * u, e, n);
}
function w(F, A, T) {
var R, M, j = 0;
do
M = A + (T - A) / 2, R = m(M, e, n) - F, R > 0 ? T = M : A = M;
while (Math.abs(R) > i && ++j < s);
return M;
}
function k(F) {
for (var A = 0, T = 1, R = l - 1; T !== R && p[T] <= F; ++T)
A += u;
--T;
var M = (F - p[T]) / (p[T + 1] - p[T]), j = A + M * u, P = g(j, e, n);
return P >= a ? b(F, j) : P === 0 ? j : w(F, A, A + u);
}
var C = !1;
function _() {
C = !0, (e !== t || n !== r) && x();
}
var $ = function(F) {
return C || _(), e === t && n === r ? F : F === 0 ? 0 : F === 1 ? 1 : m(k(F), t, r);
};
$.getControlPoints = function() {
return [{
x: e,
y: t
}, {
x: n,
y: r
}];
};
var O = "generateBezier(" + [e, t, n, r] + ")";
return $.toString = function() {
return O;
}, $;
}
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */
var Xwe = /* @__PURE__ */ function() {
function e(r) {
return -r.tension * r.x - r.friction * r.v;
}
function t(r, o, a) {
var i = {
x: r.x + a.dx * o,
v: r.v + a.dv * o,
tension: r.tension,
friction: r.friction
};
return {
dx: i.v,
dv: e(i)
};
}
function n(r, o) {
var a = {
dx: r.v,
dv: e(r)
}, i = t(r, o * 0.5, a), s = t(r, o * 0.5, i), l = t(r, o, s), u = 1 / 6 * (a.dx + 2 * (i.dx + s.dx) + l.dx), c = 1 / 6 * (a.dv + 2 * (i.dv + s.dv) + l.dv);
return r.x = r.x + u * o, r.v = r.v + c * o, r;
}
return function r(o, a, i) {
var s = {
x: -1,
v: 0,
tension: null,
friction: null
}, l = [0], u = 0, c = 1 / 1e4, d = 16 / 1e3, p, h, f;
for (o = parseFloat(o) || 500, a = parseFloat(a) || 20, i = i || null, s.tension = o, s.friction = a, p = i !== null, p ? (u = r(o, a), h = u / i * d) : h = d; f = n(f || s, h), l.push(1 + f.x), u += 16, Math.abs(f.x) > c && Math.abs(f.v) > c; )
;
return p ? function(v) {
return l[v * (l.length - 1) | 0];
} : u;
};
}(), yn = function(e, t, n, r) {
var o = Ywe(e, t, n, r);
return function(a, i, s) {
return a + (i - a) * o(s);
};
}, Xv = {
linear: function(e, t, n) {
return e + (t - e) * n;
},
// default easings
ease: yn(0.25, 0.1, 0.25, 1),
"ease-in": yn(0.42, 0, 1, 1),
"ease-out": yn(0, 0, 0.58, 1),
"ease-in-out": yn(0.42, 0, 0.58, 1),
// sine
"ease-in-sine": yn(0.47, 0, 0.745, 0.715),
"ease-out-sine": yn(0.39, 0.575, 0.565, 1),
"ease-in-out-sine": yn(0.445, 0.05, 0.55, 0.95),
// quad
"ease-in-quad": yn(0.55, 0.085, 0.68, 0.53),
"ease-out-quad": yn(0.25, 0.46, 0.45, 0.94),
"ease-in-out-quad": yn(0.455, 0.03, 0.515, 0.955),
// cubic
"ease-in-cubic": yn(0.55, 0.055, 0.675, 0.19),
"ease-out-cubic": yn(0.215, 0.61, 0.355, 1),
"ease-in-out-cubic": yn(0.645, 0.045, 0.355, 1),
// quart
"ease-in-quart": yn(0.895, 0.03, 0.685, 0.22),
"ease-out-quart": yn(0.165, 0.84, 0.44, 1),
"ease-in-out-quart": yn(0.77, 0, 0.175, 1),
// quint
"ease-in-quint": yn(0.755, 0.05, 0.855, 0.06),
"ease-out-quint": yn(0.23, 1, 0.32, 1),
"ease-in-out-quint": yn(0.86, 0, 0.07, 1),
// expo
"ease-in-expo": yn(0.95, 0.05, 0.795, 0.035),
"ease-out-expo": yn(0.19, 1, 0.22, 1),
"ease-in-out-expo": yn(1, 0, 0, 1),
// circ
"ease-in-circ": yn(0.6, 0.04, 0.98, 0.335),
"ease-out-circ": yn(0.075, 0.82, 0.165, 1),
"ease-in-out-circ": yn(0.785, 0.135, 0.15, 0.86),
// user param easings...
spring: function(e, t, n) {
if (n === 0)
return Xv.linear;
var r = Xwe(e, t, n);
return function(o, a, i) {
return o + (a - o) * r(i);
};
},
"cubic-bezier": yn
};
function vF(e, t, n, r, o) {
if (r === 1 || t === n)
return n;
var a = o(t, n, r);
return e == null || ((e.roundValue || e.color) && (a = Math.round(a)), e.min !== void 0 && (a = Math.max(a, e.min)), e.max !== void 0 && (a = Math.min(a, e.max))), a;
}
function gF(e, t) {
return e.pfValue != null || e.value != null ? e.pfValue != null && (t == null || t.type.units !== "%") ? e.pfValue : e.value : e;
}
function ac(e, t, n, r, o) {
var a = o != null ? o.type : null;
n < 0 ? n = 0 : n > 1 && (n = 1);
var i = gF(e, o), s = gF(t, o);
if (Ze(i) && Ze(s))
return vF(a, i, s, n, r);
if (dn(i) && dn(s)) {
for (var l = [], u = 0; u < s.length; u++) {
var c = i[u], d = s[u];
if (c != null && d != null) {
var p = vF(a, c, d, n, r);
l.push(p);
} else
l.push(d);
}
return l;
}
}
function Zwe(e, t, n, r) {
var o = !r, a = e._private, i = t._private, s = i.easing, l = i.startTime, u = r ? e : e.cy(), c = u.style();
if (!i.easingImpl)
if (s == null)
i.easingImpl = Xv.linear;
else {
var d;
if (gt(s)) {
var p = c.parse("transition-timing-function", s);
d = p.value;
} else
d = s;
var h, f;
gt(d) ? (h = d, f = []) : (h = d[1], f = d.slice(2).map(function(G) {
return +G;
})), f.length > 0 ? (h === "spring" && f.push(i.duration), i.easingImpl = Xv[h].apply(null, f)) : i.easingImpl = Xv[h];
}
var v = i.easingImpl, m;
if (i.duration === 0 ? m = 1 : m = (n - l) / i.duration, i.applying && (m = i.progress), m < 0 ? m = 0 : m > 1 && (m = 1), i.delay == null) {
var g = i.startPosition, b = i.position;
if (b && o && !e.locked()) {
var x = {};
rp(g.x, b.x) && (x.x = ac(g.x, b.x, m, v)), rp(g.y, b.y) && (x.y = ac(g.y, b.y, m, v)), e.position(x);
}
var w = i.startPan, k = i.pan, C = a.pan, _ = k != null && r;
_ && (rp(w.x, k.x) && (C.x = ac(w.x, k.x, m, v)), rp(w.y, k.y) && (C.y = ac(w.y, k.y, m, v)), e.emit("pan"));
var $ = i.startZoom, O = i.zoom, F = O != null && r;
F && (rp($, O) && (a.zoom = uf(a.minZoom, ac($, O, m, v), a.maxZoom)), e.emit("zoom")), (_ || F) && e.emit("viewport");
var A = i.style;
if (A && A.length > 0 && o) {
for (var T = 0; T < A.length; T++) {
var R = A[T], M = R.name, j = R, P = i.startStyle[M], V = c.properties[P.name], U = ac(P, j, m, v, V);
c.overrideBypass(e, M, U);
}
e.emit("style");
}
}
return i.progress = m, m;
}
function rp(e, t) {
return e == null || t == null ? !1 : Ze(e) && Ze(t) ? !0 : !!(e && t);
}
function Jwe(e, t, n, r) {
var o = t._private;
o.started = !0, o.startTime = n - o.progress * o.duration;
}
function mF(e, t) {
var n = t._private.aniEles, r = [];
function o(c, d) {
var p = c._private, h = p.animation.current, f = p.animation.queue, v = !1;
if (h.length === 0) {
var m = f.shift();
m && h.push(m);
}
for (var g = function(k) {
for (var C = k.length - 1; C >= 0; C--) {
var _ = k[C];
_();
}
k.splice(0, k.length);
}, b = h.length - 1; b >= 0; b--) {
var x = h[b], w = x._private;
if (w.stopped) {
h.splice(b, 1), w.hooked = !1, w.playing = !1, w.started = !1, g(w.frames);
continue;
}
!w.playing && !w.applying || (w.playing && w.applying && (w.applying = !1), w.started || Jwe(c, x, e), Zwe(c, x, e, d), w.applying && (w.applying = !1), g(w.frames), w.step != null && w.step(e), x.completed() && (h.splice(b, 1), w.hooked = !1, w.playing = !1, w.started = !1, g(w.completes)), v = !0);
}
return !d && h.length === 0 && f.length === 0 && r.push(c), v;
}
for (var a = !1, i = 0; i < n.length; i++) {
var s = n[i], l = o(s);
a = a || l;
}
var u = o(t, !0);
(a || u) && (n.length > 0 ? t.notify("draw", n) : t.notify("draw")), n.unmerge(r), t.emit("step");
}
var Qwe = {
// pull in animation functions
animate: an.animate(),
animation: an.animation(),
animated: an.animated(),
clearQueue: an.clearQueue(),
delay: an.delay(),
delayAnimation: an.delayAnimation(),
stop: an.stop(),
addToAnimationPool: function(e) {
var t = this;
t.styleEnabled() && t._private.aniEles.merge(e);
},
stopAnimationLoop: function() {
this._private.animationsRunning = !1;
},
startAnimationLoop: function() {
var e = this;
if (e._private.animationsRunning = !0, !e.styleEnabled())
return;
function t() {
e._private.animationsRunning && Bg(function(r) {
mF(r, e), t();
});
}
var n = e.renderer();
n && n.beforeRender ? n.beforeRender(function(r, o) {
mF(o, e);
}, n.beforeRenderPriorities.animations) : t();
}
}, e2e = {
qualifierCompare: function(e, t) {
return e == null || t == null ? e == null && t == null : e.sameText(t);
},
eventMatches: function(e, t, n) {
var r = t.qualifier;
return r != null ? e !== n.target && th(n.target) && r.matches(n.target) : !0;
},
addEventFields: function(e, t) {
t.cy = e, t.target = e;
},
callbackContext: function(e, t, n) {
return t.qualifier != null ? n.target : e;
}
}, dv = function(e) {
return gt(e) ? new il(e) : e;
}, kz = {
createEmitter: function() {
var e = this._private;
return e.emitter || (e.emitter = new xm(e2e, this)), this;
},
emitter: function() {
return this._private.emitter;
},
on: function(e, t, n) {
return this.emitter().on(e, dv(t), n), this;
},
removeListener: function(e, t, n) {
return this.emitter().removeListener(e, dv(t), n), this;
},
removeAllListeners: function() {
return this.emitter().removeAllListeners(), this;
},
one: function(e, t, n) {
return this.emitter().one(e, dv(t), n), this;
},
once: function(e, t, n) {
return this.emitter().one(e, dv(t), n), this;
},
emit: function(e, t) {
return this.emitter().emit(e, t), this;
},
emitAndNotify: function(e, t) {
return this.emit(e), this.notify(e, t), this;
}
};
an.eventAliasesOn(kz);
var GC = {
png: function(e) {
var t = this._private.renderer;
return e = e || {}, t.png(e);
},
jpg: function(e) {
var t = this._private.renderer;
return e = e || {}, e.bg = e.bg || "#fff", t.jpg(e);
}
};
GC.jpeg = GC.jpg;
var Zv = {
layout: function(e) {
var t = this;
if (e == null) {
Un("Layout options must be specified to make a layout");
return;
}
if (e.name == null) {
Un("A `name` must be specified to make a layout");
return;
}
var n = e.name, r = t.extension("layout", n);
if (r == null) {
Un("No such layout `" + n + "` found. Did you forget to import it and `cytoscape.use()` it?");
return;
}
var o;
gt(e.eles) ? o = t.$(e.eles) : o = e.eles != null ? e.eles : t.$();
var a = new r(_t({}, e, {
cy: t,
eles: o
}));
return a;
}
};
Zv.createLayout = Zv.makeLayout = Zv.layout;
var t2e = {
notify: function(e, t) {
var n = this._private;
if (this.batching()) {
n.batchNotifications = n.batchNotifications || {};
var r = n.batchNotifications[e] = n.batchNotifications[e] || this.collection();
t != null && r.merge(t);
return;
}
if (n.notificationsEnabled) {
var o = this.renderer();
this.destroyed() || !o || o.notify(e, t);
}
},
notifications: function(e) {
var t = this._private;
return e === void 0 ? t.notificationsEnabled : (t.notificationsEnabled = !!e, this);
},
noNotifications: function(e) {
this.notifications(!1), e(), this.notifications(!0);
},
batching: function() {
return this._private.batchCount > 0;
},
startBatch: function() {
var e = this._private;
return e.batchCount == null && (e.batchCount = 0), e.batchCount === 0 && (e.batchStyleEles = this.collection(), e.batchNotifications = {}), e.batchCount++, this;
},
endBatch: function() {
var e = this._private;
if (e.batchCount === 0)
return this;
if (e.batchCount--, e.batchCount === 0) {
e.batchStyleEles.updateStyle();
var t = this.renderer();
Object.keys(e.batchNotifications).forEach(function(n) {
var r = e.batchNotifications[n];
r.empty() ? t.notify(n) : t.notify(n, r);
});
}
return this;
},
batch: function(e) {
return this.startBatch(), e(), this.endBatch(), this;
},
// for backwards compatibility
batchData: function(e) {
var t = this;
return this.batch(function() {
for (var n = Object.keys(e), r = 0; r < n.length; r++) {
var o = n[r], a = e[o], i = t.getElementById(o);
i.data(a);
}
});
}
}, n2e = Br({
hideEdgesOnViewport: !1,
textureOnViewport: !1,
motionBlur: !1,
motionBlurOpacity: 0.05,
pixelRatio: void 0,
desktopTapThreshold: 4,
touchTapThreshold: 8,
wheelSensitivity: 1,
debug: !1,
showFps: !1
}), WC = {
renderTo: function(e, t, n, r) {
var o = this._private.renderer;
return o.renderTo(e, t, n, r), this;
},
renderer: function() {
return this._private.renderer;
},
forceRender: function() {
return this.notify("draw"), this;
},
resize: function() {
return this.invalidateSize(), this.emitAndNotify("resize"), this;
},
initRenderer: function(e) {
var t = this, n = t.extension("renderer", e.name);
if (n == null) {
Un("Can not initialise: No such renderer `".concat(e.name, "` found. Did you forget to import it and `cytoscape.use()` it?"));
return;
}
e.wheelSensitivity !== void 0 && sn("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.");
var r = n2e(e);
r.cy = t, t._private.renderer = new n(r), this.notify("init");
},
destroyRenderer: function() {
var e = this;
e.notify("destroy");
var t = e.container();
if (t)
for (t._cyreg = null; t.childNodes.length > 0; )
t.removeChild(t.childNodes[0]);
e._private.renderer = null, e.mutableElements().forEach(function(n) {
var r = n._private;
r.rscratch = {}, r.rstyle = {}, r.animation.current = [], r.animation.queue = [];
});
},
onRender: function(e) {
return this.on("render", e);
},
offRender: function(e) {
return this.off("render", e);
}
};
WC.invalidateDimensions = WC.resize;
var Jv = {
// get a collection
// - empty collection on no args
// - collection of elements in the graph on selector arg
// - guarantee a returned collection when elements or collection specified
collection: function(e, t) {
return gt(e) ? this.$(e) : Mo(e) ? e.collection() : dn(e) ? (t || (t = {}), new Rr(this, e, t.unique, t.removed)) : new Rr(this);
},
nodes: function(e) {
var t = this.$(function(n) {
return n.isNode();
});
return e ? t.filter(e) : t;
},
edges: function(e) {
var t = this.$(function(n) {
return n.isEdge();
});
return e ? t.filter(e) : t;
},
// search the graph like jQuery
$: function(e) {
var t = this._private.elements;
return e ? t.filter(e) : t.spawnSelf();
},
mutableElements: function() {
return this._private.elements;
}
};
Jv.elements = Jv.filter = Jv.$;
var Jr = {}, Ip = "t", r2e = "f";
Jr.apply = function(e) {
for (var t = this, n = t._private, r = n.cy, o = r.collection(), a = 0; a < e.length; a++) {
var i = e[a], s = t.getContextMeta(i);
if (!s.empty) {
var l = t.getContextStyle(s), u = t.applyContextStyle(s, l, i);
i._private.appliedInitStyle ? t.updateTransitions(i, u.diffProps) : i._private.appliedInitStyle = !0;
var c = t.updateStyleHints(i);
c && o.push(i);
}
}
return o;
};
Jr.getPropertiesDiff = function(e, t) {
var n = this, r = n._private.propDiffs = n._private.propDiffs || {}, o = e + "-" + t, a = r[o];
if (a)
return a;
for (var i = [], s = {}, l = 0; l < n.length; l++) {
var u = n[l], c = e[l] === Ip, d = t[l] === Ip, p = c !== d, h = u.mappedProperties.length > 0;
if (p || d && h) {
var f = void 0;
p && h || p ? f = u.properties : h && (f = u.mappedProperties);
for (var v = 0; v < f.length; v++) {
for (var m = f[v], g = m.name, b = !1, x = l + 1; x < n.length; x++) {
var w = n[x], k = t[x] === Ip;
if (k && (b = w.properties[m.name] != null, b))
break;
}
!s[g] && !b && (s[g] = !0, i.push(g));
}
}
}
return r[o] = i, i;
};
Jr.getContextMeta = function(e) {
for (var t = this, n = "", r, o = e._private.styleCxtKey || "", a = 0; a < t.length; a++) {
var i = t[a], s = i.selector && i.selector.matches(e);
s ? n += Ip : n += r2e;
}
return r = t.getPropertiesDiff(o, n), e._private.styleCxtKey = n, {
key: n,
diffPropNames: r,
empty: r.length === 0
};
};
Jr.getContextStyle = function(e) {
var t = e.key, n = this, r = this._private.contextStyles = this._private.contextStyles || {};
if (r[t])
return r[t];
for (var o = {
_private: {
key: t
}
}, a = 0; a < n.length; a++) {
var i = n[a], s = t[a] === Ip;
if (s)
for (var l = 0; l < i.properties.length; l++) {
var u = i.properties[l];
o[u.name] = u;
}
}
return r[t] = o, o;
};
Jr.applyContextStyle = function(e, t, n) {
for (var r = this, o = e.diffPropNames, a = {}, i = r.types, s = 0; s < o.length; s++) {
var l = o[s], u = t[l], c = n.pstyle(l);
if (!u)
if (c)
c.bypass ? u = {
name: l,
deleteBypassed: !0
} : u = {
name: l,
delete: !0
};
else continue;
if (c !== u) {
if (u.mapped === i.fn && c != null && c.mapping != null && c.mapping.value === u.value) {
var d = c.mapping, p = d.fnValue = u.value(n);
if (p === d.prevFnValue)
continue;
}
var h = a[l] = {
prev: c
};
r.applyParsedProperty(n, u), h.next = n.pstyle(l), h.next && h.next.bypass && (h.next = h.next.bypassed);
}
}
return {
diffProps: a
};
};
Jr.updateStyleHints = function(e) {
var t = e._private, n = this, r = n.propertyGroupNames, o = n.propertyGroupKeys, a = function(pe, ke, Ne) {
return n.getPropertiesHash(pe, ke, Ne);
}, i = t.styleKey;
if (e.removed())
return !1;
var s = t.group === "nodes", l = e._private.style;
r = Object.keys(l);
for (var u = 0; u < o.length; u++) {
var c = o[u];
t.styleKeys[c] = [wc, yp];
}
for (var d = function(pe, ke) {
return t.styleKeys[ke][0] = af(pe, t.styleKeys[ke][0]);
}, p = function(pe, ke) {
return t.styleKeys[ke][1] = sf(pe, t.styleKeys[ke][1]);
}, h = function(pe, ke) {
d(pe, ke), p(pe, ke);
}, f = function(pe, ke) {
for (var Ne = 0; Ne < pe.length; Ne++) {
var De = pe.charCodeAt(Ne);
d(De, ke), p(De, ke);
}
}, v = 2e9, m = function(pe) {
return -128 < pe && pe < 128 && Math.floor(pe) !== pe ? v - (pe * 1024 | 0) : pe;
}, g = 0; g < r.length; g++) {
var b = r[g], x = l[b];
if (x != null) {
var w = this.properties[b], k = w.type, C = w.groupKey, _ = void 0;
w.hashOverride != null ? _ = w.hashOverride(e, x) : x.pfValue != null && (_ = x.pfValue);
var $ = w.enums == null ? x.value : null, O = _ != null, F = $ != null, A = O || F, T = x.units;
if (k.number && A && !k.multiple) {
var R = O ? _ : $;
h(m(R), C), !O && T != null && f(T, C);
} else
f(x.strValue, C);
}
}
for (var M = [wc, yp], j = 0; j < o.length; j++) {
var P = o[j], V = t.styleKeys[P];
M[0] = af(V[0], M[0]), M[1] = sf(V[1], M[1]);
}
t.styleKey = lme(M[0], M[1]);
var U = t.styleKeys;
t.labelDimsKey = _s(U.labelDimensions);
var G = a(e, ["label"], U.labelDimensions);
if (t.labelKey = _s(G), t.labelStyleKey = _s(nv(U.commonLabel, G)), !s) {
var se = a(e, ["source-label"], U.labelDimensions);
t.sourceLabelKey = _s(se), t.sourceLabelStyleKey = _s(nv(U.commonLabel, se));
var ae = a(e, ["target-label"], U.labelDimensions);
t.targetLabelKey = _s(ae), t.targetLabelStyleKey = _s(nv(U.commonLabel, ae));
}
if (s) {
var de = t.styleKeys, me = de.nodeBody, te = de.nodeBorder, oe = de.nodeOutline, ne = de.backgroundImage, ee = de.compound, Z = de.pie, le = [me, te, oe, ne, ee, Z].filter(function(pe) {
return pe != null;
}).reduce(nv, [wc, yp]);
t.nodeKey = _s(le), t.hasPie = Z != null && Z[0] !== wc && Z[1] !== yp;
}
return i !== t.styleKey;
};
Jr.clearStyleHints = function(e) {
var t = e._private;
t.styleCxtKey = "", t.styleKeys = {}, t.styleKey = null, t.labelKey = null, t.labelStyleKey = null, t.sourceLabelKey = null, t.sourceLabelStyleKey = null, t.targetLabelKey = null, t.targetLabelStyleKey = null, t.nodeKey = null, t.hasPie = null;
};
Jr.applyParsedProperty = function(e, t) {
var n = this, r = t, o = e._private.style, a, i = n.types, s = n.properties[r.name].type, l = r.bypass, u = o[r.name], c = u && u.bypass, d = e._private, p = "mapping", h = function(de) {
return de == null ? null : de.pfValue != null ? de.pfValue : de.value;
}, f = function() {
var de = h(u), me = h(r);
n.checkTriggers(e, r.name, de, me);
};
if (t.name === "curve-style" && e.isEdge() && // loops must be bundled beziers
(t.value !== "bezier" && e.isLoop() || // edges connected to compound nodes can not be haystacks
t.value === "haystack" && (e.source().isParent() || e.target().isParent())) && (r = t = this.parse(t.name, "bezier", l)), r.delete)
return o[r.name] = void 0, f(), !0;
if (r.deleteBypassed)
return u ? u.bypass ? (u.bypassed = void 0, f(), !0) : !1 : (f(), !0);
if (r.deleteBypass)
return u ? u.bypass ? (o[r.name] = u.bypassed, f(), !0) : !1 : (f(), !0);
var v = function() {
sn("Do not assign mappings to elements without corresponding data (i.e. ele `" + e.id() + "` has no mapping for property `" + r.name + "` with data field `" + r.field + "`); try a `[" + r.field + "]` selector to limit scope to elements with `" + r.field + "` defined");
};
switch (r.mapped) {
case i.mapData: {
for (var m = r.field.split("."), g = d.data, b = 0; b < m.length && g; b++) {
var x = m[b];
g = g[x];
}
if (g == null)
return v(), !1;
var w;
if (Ze(g)) {
var k = r.fieldMax - r.fieldMin;
k === 0 ? w = 0 : w = (g - r.fieldMin) / k;
} else
return sn("Do not use continuous mappers without specifying numeric data (i.e. `" + r.field + ": " + g + "` for `" + e.id() + "` is non-numeric)"), !1;
if (w < 0 ? w = 0 : w > 1 && (w = 1), s.color) {
var C = r.valueMin[0], _ = r.valueMax[0], $ = r.valueMin[1], O = r.valueMax[1], F = r.valueMin[2], A = r.valueMax[2], T = r.valueMin[3] == null ? 1 : r.valueMin[3], R = r.valueMax[3] == null ? 1 : r.valueMax[3], M = [Math.round(C + (_ - C) * w), Math.round($ + (O - $) * w), Math.round(F + (A - F) * w), Math.round(T + (R - T) * w)];
a = {
// colours are simple, so just create the flat property instead of expensive string parsing
bypass: r.bypass,
// we're a bypass if the mapping property is a bypass
name: r.name,
value: M,
strValue: "rgb(" + M[0] + ", " + M[1] + ", " + M[2] + ")"
};
} else if (s.number) {
var j = r.valueMin + (r.valueMax - r.valueMin) * w;
a = this.parse(r.name, j, r.bypass, p);
} else
return !1;
if (!a)
return v(), !1;
a.mapping = r, r = a;
break;
}
case i.data: {
for (var P = r.field.split("."), V = d.data, U = 0; U < P.length && V; U++) {
var G = P[U];
V = V[G];
}
if (V != null && (a = this.parse(r.name, V, r.bypass, p)), !a)
return v(), !1;
a.mapping = r, r = a;
break;
}
case i.fn: {
var se = r.value, ae = r.fnValue != null ? r.fnValue : se(e);
if (r.prevFnValue = ae, ae == null)
return sn("Custom function mappers may not return null (i.e. `" + r.name + "` for ele `" + e.id() + "` is null)"), !1;
if (a = this.parse(r.name, ae, r.bypass, p), !a)
return sn("Custom function mappers may not return invalid values for the property type (i.e. `" + r.name + "` for ele `" + e.id() + "` is invalid)"), !1;
a.mapping = ai(r), r = a;
break;
}
case void 0:
break;
default:
return !1;
}
return l ? (c ? r.bypassed = u.bypassed : r.bypassed = u, o[r.name] = r) : c ? u.bypassed = r : o[r.name] = r, f(), !0;
};
Jr.cleanElements = function(e, t) {
for (var n = 0; n < e.length; n++) {
var r = e[n];
if (this.clearStyleHints(r), r.dirtyCompoundBoundsCache(), r.dirtyBoundingBoxCache(), !t)
r._private.style = {};
else
for (var o = r._private.style, a = Object.keys(o), i = 0; i < a.length; i++) {
var s = a[i], l = o[s];
l != null && (l.bypass ? l.bypassed = null : o[s] = null);
}
}
};
Jr.update = function() {
var e = this._private.cy, t = e.mutableElements();
t.updateStyle();
};
Jr.updateTransitions = function(e, t) {
var n = this, r = e._private, o = e.pstyle("transition-property").value, a = e.pstyle("transition-duration").pfValue, i = e.pstyle("transition-delay").pfValue;
if (o.length > 0 && a > 0) {
for (var s = {}, l = !1, u = 0; u < o.length; u++) {
var c = o[u], d = e.pstyle(c), p = t[c];
if (p) {
var h = p.prev, f = h, v = p.next != null ? p.next : d, m = !1, g = void 0, b = 1e-6;
f && (Ze(f.pfValue) && Ze(v.pfValue) ? (m = v.pfValue - f.pfValue, g = f.pfValue + b * m) : Ze(f.value) && Ze(v.value) ? (m = v.value - f.value, g = f.value + b * m) : dn(f.value) && dn(v.value) && (m = f.value[0] !== v.value[0] || f.value[1] !== v.value[1] || f.value[2] !== v.value[2], g = f.strValue), m && (s[c] = v.strValue, this.applyBypass(e, c, g), l = !0));
}
}
if (!l)
return;
r.transitioning = !0, new md(function(x) {
i > 0 ? e.delayAnimation(i).play().promise().then(x) : x();
}).then(function() {
return e.animation({
style: s,
duration: a,
easing: e.pstyle("transition-timing-function").value,
queue: !1
}).play().promise();
}).then(function() {
n.removeBypasses(e, o), e.emitAndNotify("style"), r.transitioning = !1;
});
} else r.transitioning && (this.removeBypasses(e, o), e.emitAndNotify("style"), r.transitioning = !1);
};
Jr.checkTrigger = function(e, t, n, r, o, a) {
var i = this.properties[t], s = o(i);
s != null && s(n, r) && a(i);
};
Jr.checkZOrderTrigger = function(e, t, n, r) {
var o = this;
this.checkTrigger(e, t, n, r, function(a) {
return a.triggersZOrder;
}, function() {
o._private.cy.notify("zorder", e);
});
};
Jr.checkBoundsTrigger = function(e, t, n, r) {
this.checkTrigger(e, t, n, r, function(o) {
return o.triggersBounds;
}, function(o) {
e.dirtyCompoundBoundsCache(), e.dirtyBoundingBoxCache(), // only for beziers -- so performance of other edges isn't affected
o.triggersBoundsOfParallelBeziers && t === "curve-style" && (n === "bezier" || r === "bezier") && e.parallelEdges().forEach(function(a) {
a.isBundledBezier() && a.dirtyBoundingBoxCache();
}), o.triggersBoundsOfConnectedEdges && t === "display" && (n === "none" || r === "none") && e.connectedEdges().forEach(function(a) {
a.dirtyBoundingBoxCache();
});
});
};
Jr.checkTriggers = function(e, t, n, r) {
e.dirtyStyleCache(), this.checkZOrderTrigger(e, t, n, r), this.checkBoundsTrigger(e, t, n, r);
};
var ah = {};
ah.applyBypass = function(e, t, n, r) {
var o = this, a = [], i = !0;
if (t === "*" || t === "**") {
if (n !== void 0)
for (var s = 0; s < o.properties.length; s++) {
var l = o.properties[s], u = l.name, c = this.parse(u, n, !0);
c && a.push(c);
}
} else if (gt(t)) {
var d = this.parse(t, n, !0);
d && a.push(d);
} else if (Xt(t)) {
var p = t;
r = n;
for (var h = Object.keys(p), f = 0; f < h.length; f++) {
var v = h[f], m = p[v];
if (m === void 0 && (m = p[dm(v)]), m !== void 0) {
var g = this.parse(v, m, !0);
g && a.push(g);
}
}
} else
return !1;
if (a.length === 0)
return !1;
for (var b = !1, x = 0; x < e.length; x++) {
for (var w = e[x], k = {}, C = void 0, _ = 0; _ < a.length; _++) {
var $ = a[_];
if (r) {
var O = w.pstyle($.name);
C = k[$.name] = {
prev: O
};
}
b = this.applyParsedProperty(w, ai($)) || b, r && (C.next = w.pstyle($.name));
}
b && this.updateStyleHints(w), r && this.updateTransitions(w, k, i);
}
return b;
};
ah.overrideBypass = function(e, t, n) {
t = f$(t);
for (var r = 0; r < e.length; r++) {
var o = e[r], a = o._private.style[t], i = this.properties[t].type, s = i.color, l = i.mutiple, u = a ? a.pfValue != null ? a.pfValue : a.value : null;
!a || !a.bypass ? this.applyBypass(o, t, n) : (a.value = n, a.pfValue != null && (a.pfValue = n), s ? a.strValue = "rgb(" + n.join(",") + ")" : l ? a.strValue = n.join(" ") : a.strValue = "" + n, this.updateStyleHints(o)), this.checkTriggers(o, t, u, n);
}
};
ah.removeAllBypasses = function(e, t) {
return this.removeBypasses(e, this.propertyNames, t);
};
ah.removeBypasses = function(e, t, n) {
for (var r = !0, o = 0; o < e.length; o++) {
for (var a = e[o], i = {}, s = 0; s < t.length; s++) {
var l = t[s], u = this.properties[l], c = a.pstyle(u.name);
if (!(!c || !c.bypass)) {
var d = "", p = this.parse(l, d, !0), h = i[u.name] = {
prev: c
};
this.applyParsedProperty(a, p), h.next = a.pstyle(u.name);
}
}
this.updateStyleHints(a), n && this.updateTransitions(a, i, r);
}
};
var E$ = {};
E$.getEmSizeInPixels = function() {
var e = this.containerCss("font-size");
return e != null ? parseFloat(e) : 1;
};
E$.containerCss = function(e) {
var t = this._private.cy, n = t.container(), r = t.window();
if (r && n && r.getComputedStyle)
return r.getComputedStyle(n).getPropertyValue(e);
};
var yi = {};
yi.getRenderedStyle = function(e, t) {
return t ? this.getStylePropertyValue(e, t, !0) : this.getRawStyle(e, !0);
};
yi.getRawStyle = function(e, t) {
var n = this;
if (e = e[0], e) {
for (var r = {}, o = 0; o < n.properties.length; o++) {
var a = n.properties[o], i = n.getStylePropertyValue(e, a.name, t);
i != null && (r[a.name] = i, r[dm(a.name)] = i);
}
return r;
}
};
yi.getIndexedStyle = function(e, t, n, r) {
var o = e.pstyle(t)[n][r];
return o ?? e.cy().style().getDefaultProperty(t)[n][0];
};
yi.getStylePropertyValue = function(e, t, n) {
var r = this;
if (e = e[0], e) {
var o = r.properties[t];
o.alias && (o = o.pointsTo);
var a = o.type, i = e.pstyle(o.name);
if (i) {
var s = i.value, l = i.units, u = i.strValue;
if (n && a.number && s != null && Ze(s)) {
var c = e.cy().zoom(), d = function(v) {
return v * c;
}, p = function(v, m) {
return d(v) + m;
}, h = dn(s), f = h ? l.every(function(v) {
return v != null;
}) : l != null;
return f ? h ? s.map(function(v, m) {
return p(v, l[m]);
}).join(" ") : p(s, l) : h ? s.map(function(v) {
return gt(v) ? v : "" + d(v);
}).join(" ") : "" + d(s);
} else if (u != null)
return u;
}
return null;
}
};
yi.getAnimationStartStyle = function(e, t) {
for (var n = {}, r = 0; r < t.length; r++) {
var o = t[r], a = o.name, i = e.pstyle(a);
i !== void 0 && (Xt(i) ? i = this.parse(a, i.strValue) : i = this.parse(a, i)), i && (n[a] = i);
}
return n;
};
yi.getPropsList = function(e) {
var t = this, n = [], r = e, o = t.properties;
if (r)
for (var a = Object.keys(r), i = 0; i < a.length; i++) {
var s = a[i], l = r[s], u = o[s] || o[f$(s)], c = this.parse(u.name, l);
c && n.push(c);
}
return n;
};
yi.getNonDefaultPropertiesHash = function(e, t, n) {
var r = n.slice(), o, a, i, s, l, u;
for (l = 0; l < t.length; l++)
if (o = t[l], a = e.pstyle(o, !1), a != null)
if (a.pfValue != null)
r[0] = af(s, r[0]), r[1] = sf(s, r[1]);
else
for (i = a.strValue, u = 0; u < i.length; u++)
s = i.charCodeAt(u), r[0] = af(s, r[0]), r[1] = sf(s, r[1]);
return r;
};
yi.getPropertiesHash = yi.getNonDefaultPropertiesHash;
var _m = {};
_m.appendFromJson = function(e) {
for (var t = this, n = 0; n < e.length; n++) {
var r = e[n], o = r.selector, a = r.style || r.css, i = Object.keys(a);
t.selector(o);
for (var s = 0; s < i.length; s++) {
var l = i[s], u = a[l];
t.css(l, u);
}
}
return t;
};
_m.fromJson = function(e) {
var t = this;
return t.resetToDefault(), t.appendFromJson(e), t;
};
_m.json = function() {
for (var e = [], t = this.defaultLength; t < this.length; t++) {
for (var n = this[t], r = n.selector, o = n.properties, a = {}, i = 0; i < o.length; i++) {
var s = o[i];
a[s.name] = s.strValue;
}
e.push({
selector: r ? r.toString() : "core",
style: a
});
}
return e;
};
var O$ = {};
O$.appendFromString = function(e) {
var t = this, n = this, r = "" + e, o, a, i;
r = r.replace(/[/][*](\s|.)+?[*][/]/g, "");
function s() {
r.length > o.length ? r = r.substr(o.length) : r = "";
}
function l() {
a.length > i.length ? a = a.substr(i.length) : a = "";
}
for (; ; ) {
var u = r.match(/^\s*$/);
if (u)
break;
var c = r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);
if (!c) {
sn("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + r);
break;
}
o = c[0];
var d = c[1];
if (d !== "core") {
var p = new il(d);
if (p.invalid) {
sn("Skipping parsing of block: Invalid selector found in string stylesheet: " + d), s();
continue;
}
}
var h = c[2], f = !1;
a = h;
for (var v = []; ; ) {
var m = a.match(/^\s*$/);
if (m)
break;
var g = a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);
if (!g) {
sn("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + h), f = !0;
break;
}
i = g[0];
var b = g[1], x = g[2], w = t.properties[b];
if (!w) {
sn("Skipping property: Invalid property name in: " + i), l();
continue;
}
var k = n.parse(b, x);
if (!k) {
sn("Skipping property: Invalid property definition in: " + i), l();
continue;
}
v.push({
name: b,
val: x
}), l();
}
if (f) {
s();
break;
}
n.selector(d);
for (var C = 0; C < v.length; C++) {
var _ = v[C];
n.css(_.name, _.val);
}
s();
}
return n;
};
O$.fromString = function(e) {
var t = this;
return t.resetToDefault(), t.appendFromString(e), t;
};
var Sr = {};
(function() {
var e = lr, t = d0e, n = f0e, r = h0e, o = v0e, a = function(Z) {
return "^" + Z + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$";
}, i = function(Z) {
var le = e + "|\\w+|" + t + "|" + n + "|" + r + "|" + o;
return "^" + Z + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + e + ")\\s*\\,\\s*(" + e + ")\\s*,\\s*(" + le + ")\\s*\\,\\s*(" + le + ")\\)$";
}, s = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"];
Sr.types = {
time: {
number: !0,
min: 0,
units: "s|ms",
implicitUnits: "ms"
},
percent: {
number: !0,
min: 0,
max: 100,
units: "%",
implicitUnits: "%"
},
percentages: {
number: !0,
min: 0,
max: 100,
units: "%",
implicitUnits: "%",
multiple: !0
},
zeroOneNumber: {
number: !0,
min: 0,
max: 1,
unitless: !0
},
zeroOneNumbers: {
number: !0,
min: 0,
max: 1,
unitless: !0,
multiple: !0
},
nOneOneNumber: {
number: !0,
min: -1,
max: 1,
unitless: !0
},
nonNegativeInt: {
number: !0,
min: 0,
integer: !0,
unitless: !0
},
nonNegativeNumber: {
number: !0,
min: 0,
unitless: !0
},
position: {
enums: ["parent", "origin"]
},
nodeSize: {
number: !0,
min: 0,
enums: ["label"]
},
number: {
number: !0,
unitless: !0
},
numbers: {
number: !0,
unitless: !0,
multiple: !0
},
positiveNumber: {
number: !0,
unitless: !0,
min: 0,
strictMin: !0
},
size: {
number: !0,
min: 0
},
bidirectionalSize: {
number: !0
},
// allows negative
bidirectionalSizeMaybePercent: {
number: !0,
allowPercent: !0
},
// allows negative
bidirectionalSizes: {
number: !0,
multiple: !0
},
// allows negative
sizeMaybePercent: {
number: !0,
min: 0,
allowPercent: !0
},
axisDirection: {
enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"]
},
paddingRelativeTo: {
enums: ["width", "height", "average", "min", "max"]
},
bgWH: {
number: !0,
min: 0,
allowPercent: !0,
enums: ["auto"],
multiple: !0
},
bgPos: {
number: !0,
allowPercent: !0,
multiple: !0
},
bgRelativeTo: {
enums: ["inner", "include-padding"],
multiple: !0
},
bgRepeat: {
enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"],
multiple: !0
},
bgFit: {
enums: ["none", "contain", "cover"],
multiple: !0
},
bgCrossOrigin: {
enums: ["anonymous", "use-credentials", "null"],
multiple: !0
},
bgClip: {
enums: ["none", "node"],
multiple: !0
},
bgContainment: {
enums: ["inside", "over"],
multiple: !0
},
color: {
color: !0
},
colors: {
color: !0,
multiple: !0
},
fill: {
enums: ["solid", "linear-gradient", "radial-gradient"]
},
bool: {
enums: ["yes", "no"]
},
bools: {
enums: ["yes", "no"],
multiple: !0
},
lineStyle: {
enums: ["solid", "dotted", "dashed"]
},
lineCap: {
enums: ["butt", "round", "square"]
},
linePosition: {
enums: ["center", "inside", "outside"]
},
lineJoin: {
enums: ["round", "bevel", "miter"]
},
borderStyle: {
enums: ["solid", "dotted", "dashed", "double"]
},
curveStyle: {
enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi", "round-segments", "round-taxi"]
},
radiusType: {
enums: ["arc-radius", "influence-radius"],
multiple: !0
},
fontFamily: {
regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'
},
fontStyle: {
enums: ["italic", "normal", "oblique"]
},
fontWeight: {
enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900]
},
textDecoration: {
enums: ["none", "underline", "overline", "line-through"]
},
textTransform: {
enums: ["none", "uppercase", "lowercase"]
},
textWrap: {
enums: ["none", "wrap", "ellipsis"]
},
textOverflowWrap: {
enums: ["whitespace", "anywhere"]
},
textBackgroundShape: {
enums: ["rectangle", "roundrectangle", "round-rectangle"]
},
nodeShape: {
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"]
},
overlayShape: {
enums: ["roundrectangle", "round-rectangle", "ellipse"]
},
cornerRadius: {
number: !0,
min: 0,
units: "px|em",
implicitUnits: "px",
enums: ["auto"]
},
compoundIncludeLabels: {
enums: ["include", "exclude"]
},
arrowShape: {
enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"]
},
arrowFill: {
enums: ["filled", "hollow"]
},
arrowWidth: {
number: !0,
units: "%|px|em",
implicitUnits: "px",
enums: ["match-line"]
},
display: {
enums: ["element", "none"]
},
visibility: {
enums: ["hidden", "visible"]
},
zCompoundDepth: {
enums: ["bottom", "orphan", "auto", "top"]
},
zIndexCompare: {
enums: ["auto", "manual"]
},
valign: {
enums: ["top", "center", "bottom"]
},
halign: {
enums: ["left", "center", "right"]
},
justification: {
enums: ["left", "center", "right", "auto"]
},
text: {
string: !0
},
data: {
mapping: !0,
regex: a("data")
},
layoutData: {
mapping: !0,
regex: a("layoutData")
},
scratch: {
mapping: !0,
regex: a("scratch")
},
mapData: {
mapping: !0,
regex: i("mapData")
},
mapLayoutData: {
mapping: !0,
regex: i("mapLayoutData")
},
mapScratch: {
mapping: !0,
regex: i("mapScratch")
},
fn: {
mapping: !0,
fn: !0
},
url: {
regexes: s,
singleRegexMatchValue: !0
},
urls: {
regexes: s,
singleRegexMatchValue: !0,
multiple: !0
},
propList: {
propList: !0
},
angle: {
number: !0,
units: "deg|rad",
implicitUnits: "rad"
},
textRotation: {
number: !0,
units: "deg|rad",
implicitUnits: "rad",
enums: ["none", "autorotate"]
},
polygonPointList: {
number: !0,
multiple: !0,
evenMultiple: !0,
min: -1,
max: 1,
unitless: !0
},
edgeDistances: {
enums: ["intersection", "node-position", "endpoints"]
},
edgeEndpoint: {
number: !0,
multiple: !0,
units: "%|px|em|deg|rad",
implicitUnits: "px",
enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"],
singleEnum: !0,
validate: function(Z, le) {
switch (Z.length) {
case 2:
return le[0] !== "deg" && le[0] !== "rad" && le[1] !== "deg" && le[1] !== "rad";
case 1:
return gt(Z[0]) || le[0] === "deg" || le[0] === "rad";
default:
return !1;
}
}
},
easing: {
regexes: ["^(spring)\\s*\\(\\s*(" + e + ")\\s*,\\s*(" + e + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + e + ")\\s*,\\s*(" + e + ")\\s*,\\s*(" + e + ")\\s*,\\s*(" + e + ")\\s*\\)$"],
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"]
},
gradientDirection: {
enums: [
"to-bottom",
"to-top",
"to-left",
"to-right",
"to-bottom-right",
"to-bottom-left",
"to-top-right",
"to-top-left",
"to-right-bottom",
"to-left-bottom",
"to-right-top",
"to-left-top"
// different order
]
},
boundsExpansion: {
number: !0,
multiple: !0,
min: 0,
validate: function(Z) {
var le = Z.length;
return le === 1 || le === 2 || le === 4;
}
}
};
var l = {
zeroNonZero: function(Z, le) {
return (Z == null || le == null) && Z !== le || Z == 0 && le != 0 ? !0 : Z != 0 && le == 0;
},
any: function(Z, le) {
return Z != le;
},
emptyNonEmpty: function(Z, le) {
var pe = ol(Z), ke = ol(le);
return pe && !ke || !pe && ke;
}
}, u = Sr.types, c = [{
name: "label",
type: u.text,
triggersBounds: l.any,
triggersZOrder: l.emptyNonEmpty
}, {
name: "text-rotation",
type: u.textRotation,
triggersBounds: l.any
}, {
name: "text-margin-x",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "text-margin-y",
type: u.bidirectionalSize,
triggersBounds: l.any
}], d = [{
name: "source-label",
type: u.text,
triggersBounds: l.any
}, {
name: "source-text-rotation",
type: u.textRotation,
triggersBounds: l.any
}, {
name: "source-text-margin-x",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "source-text-margin-y",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "source-text-offset",
type: u.size,
triggersBounds: l.any
}], p = [{
name: "target-label",
type: u.text,
triggersBounds: l.any
}, {
name: "target-text-rotation",
type: u.textRotation,
triggersBounds: l.any
}, {
name: "target-text-margin-x",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "target-text-margin-y",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "target-text-offset",
type: u.size,
triggersBounds: l.any
}], h = [{
name: "font-family",
type: u.fontFamily,
triggersBounds: l.any
}, {
name: "font-style",
type: u.fontStyle,
triggersBounds: l.any
}, {
name: "font-weight",
type: u.fontWeight,
triggersBounds: l.any
}, {
name: "font-size",
type: u.size,
triggersBounds: l.any
}, {
name: "text-transform",
type: u.textTransform,
triggersBounds: l.any
}, {
name: "text-wrap",
type: u.textWrap,
triggersBounds: l.any
}, {
name: "text-overflow-wrap",
type: u.textOverflowWrap,
triggersBounds: l.any
}, {
name: "text-max-width",
type: u.size,
triggersBounds: l.any
}, {
name: "text-outline-width",
type: u.size,
triggersBounds: l.any
}, {
name: "line-height",
type: u.positiveNumber,
triggersBounds: l.any
}], f = [{
name: "text-valign",
type: u.valign,
triggersBounds: l.any
}, {
name: "text-halign",
type: u.halign,
triggersBounds: l.any
}, {
name: "color",
type: u.color
}, {
name: "text-outline-color",
type: u.color
}, {
name: "text-outline-opacity",
type: u.zeroOneNumber
}, {
name: "text-background-color",
type: u.color
}, {
name: "text-background-opacity",
type: u.zeroOneNumber
}, {
name: "text-background-padding",
type: u.size,
triggersBounds: l.any
}, {
name: "text-border-opacity",
type: u.zeroOneNumber
}, {
name: "text-border-color",
type: u.color
}, {
name: "text-border-width",
type: u.size,
triggersBounds: l.any
}, {
name: "text-border-style",
type: u.borderStyle,
triggersBounds: l.any
}, {
name: "text-background-shape",
type: u.textBackgroundShape,
triggersBounds: l.any
}, {
name: "text-justification",
type: u.justification
}], v = [{
name: "events",
type: u.bool,
triggersZOrder: l.any
}, {
name: "text-events",
type: u.bool,
triggersZOrder: l.any
}], m = [{
name: "display",
type: u.display,
triggersZOrder: l.any,
triggersBounds: l.any,
triggersBoundsOfConnectedEdges: !0
}, {
name: "visibility",
type: u.visibility,
triggersZOrder: l.any
}, {
name: "opacity",
type: u.zeroOneNumber,
triggersZOrder: l.zeroNonZero
}, {
name: "text-opacity",
type: u.zeroOneNumber
}, {
name: "min-zoomed-font-size",
type: u.size
}, {
name: "z-compound-depth",
type: u.zCompoundDepth,
triggersZOrder: l.any
}, {
name: "z-index-compare",
type: u.zIndexCompare,
triggersZOrder: l.any
}, {
name: "z-index",
type: u.number,
triggersZOrder: l.any
}], g = [{
name: "overlay-padding",
type: u.size,
triggersBounds: l.any
}, {
name: "overlay-color",
type: u.color
}, {
name: "overlay-opacity",
type: u.zeroOneNumber,
triggersBounds: l.zeroNonZero
}, {
name: "overlay-shape",
type: u.overlayShape,
triggersBounds: l.any
}, {
name: "overlay-corner-radius",
type: u.cornerRadius
}], b = [{
name: "underlay-padding",
type: u.size,
triggersBounds: l.any
}, {
name: "underlay-color",
type: u.color
}, {
name: "underlay-opacity",
type: u.zeroOneNumber,
triggersBounds: l.zeroNonZero
}, {
name: "underlay-shape",
type: u.overlayShape,
triggersBounds: l.any
}, {
name: "underlay-corner-radius",
type: u.cornerRadius
}], x = [{
name: "transition-property",
type: u.propList
}, {
name: "transition-duration",
type: u.time
}, {
name: "transition-delay",
type: u.time
}, {
name: "transition-timing-function",
type: u.easing
}], w = function(Z, le) {
return le.value === "label" ? -Z.poolIndex() : le.pfValue;
}, k = [{
name: "height",
type: u.nodeSize,
triggersBounds: l.any,
hashOverride: w
}, {
name: "width",
type: u.nodeSize,
triggersBounds: l.any,
hashOverride: w
}, {
name: "shape",
type: u.nodeShape,
triggersBounds: l.any
}, {
name: "shape-polygon-points",
type: u.polygonPointList,
triggersBounds: l.any
}, {
name: "corner-radius",
type: u.cornerRadius
}, {
name: "background-color",
type: u.color
}, {
name: "background-fill",
type: u.fill
}, {
name: "background-opacity",
type: u.zeroOneNumber
}, {
name: "background-blacken",
type: u.nOneOneNumber
}, {
name: "background-gradient-stop-colors",
type: u.colors
}, {
name: "background-gradient-stop-positions",
type: u.percentages
}, {
name: "background-gradient-direction",
type: u.gradientDirection
}, {
name: "padding",
type: u.sizeMaybePercent,
triggersBounds: l.any
}, {
name: "padding-relative-to",
type: u.paddingRelativeTo,
triggersBounds: l.any
}, {
name: "bounds-expansion",
type: u.boundsExpansion,
triggersBounds: l.any
}], C = [{
name: "border-color",
type: u.color
}, {
name: "border-opacity",
type: u.zeroOneNumber
}, {
name: "border-width",
type: u.size,
triggersBounds: l.any
}, {
name: "border-style",
type: u.borderStyle
}, {
name: "border-cap",
type: u.lineCap
}, {
name: "border-join",
type: u.lineJoin
}, {
name: "border-dash-pattern",
type: u.numbers
}, {
name: "border-dash-offset",
type: u.number
}, {
name: "border-position",
type: u.linePosition
}], _ = [{
name: "outline-color",
type: u.color
}, {
name: "outline-opacity",
type: u.zeroOneNumber
}, {
name: "outline-width",
type: u.size,
triggersBounds: l.any
}, {
name: "outline-style",
type: u.borderStyle
}, {
name: "outline-offset",
type: u.size,
triggersBounds: l.any
}], $ = [{
name: "background-image",
type: u.urls
}, {
name: "background-image-crossorigin",
type: u.bgCrossOrigin
}, {
name: "background-image-opacity",
type: u.zeroOneNumbers
}, {
name: "background-image-containment",
type: u.bgContainment
}, {
name: "background-image-smoothing",
type: u.bools
}, {
name: "background-position-x",
type: u.bgPos
}, {
name: "background-position-y",
type: u.bgPos
}, {
name: "background-width-relative-to",
type: u.bgRelativeTo
}, {
name: "background-height-relative-to",
type: u.bgRelativeTo
}, {
name: "background-repeat",
type: u.bgRepeat
}, {
name: "background-fit",
type: u.bgFit
}, {
name: "background-clip",
type: u.bgClip
}, {
name: "background-width",
type: u.bgWH
}, {
name: "background-height",
type: u.bgWH
}, {
name: "background-offset-x",
type: u.bgPos
}, {
name: "background-offset-y",
type: u.bgPos
}], O = [{
name: "position",
type: u.position,
triggersBounds: l.any
}, {
name: "compound-sizing-wrt-labels",
type: u.compoundIncludeLabels,
triggersBounds: l.any
}, {
name: "min-width",
type: u.size,
triggersBounds: l.any
}, {
name: "min-width-bias-left",
type: u.sizeMaybePercent,
triggersBounds: l.any
}, {
name: "min-width-bias-right",
type: u.sizeMaybePercent,
triggersBounds: l.any
}, {
name: "min-height",
type: u.size,
triggersBounds: l.any
}, {
name: "min-height-bias-top",
type: u.sizeMaybePercent,
triggersBounds: l.any
}, {
name: "min-height-bias-bottom",
type: u.sizeMaybePercent,
triggersBounds: l.any
}], F = [{
name: "line-style",
type: u.lineStyle
}, {
name: "line-color",
type: u.color
}, {
name: "line-fill",
type: u.fill
}, {
name: "line-cap",
type: u.lineCap
}, {
name: "line-opacity",
type: u.zeroOneNumber
}, {
name: "line-dash-pattern",
type: u.numbers
}, {
name: "line-dash-offset",
type: u.number
}, {
name: "line-outline-width",
type: u.size
}, {
name: "line-outline-color",
type: u.color
}, {
name: "line-gradient-stop-colors",
type: u.colors
}, {
name: "line-gradient-stop-positions",
type: u.percentages
}, {
name: "curve-style",
type: u.curveStyle,
triggersBounds: l.any,
triggersBoundsOfParallelBeziers: !0
}, {
name: "haystack-radius",
type: u.zeroOneNumber,
triggersBounds: l.any
}, {
name: "source-endpoint",
type: u.edgeEndpoint,
triggersBounds: l.any
}, {
name: "target-endpoint",
type: u.edgeEndpoint,
triggersBounds: l.any
}, {
name: "control-point-step-size",
type: u.size,
triggersBounds: l.any
}, {
name: "control-point-distances",
type: u.bidirectionalSizes,
triggersBounds: l.any
}, {
name: "control-point-weights",
type: u.numbers,
triggersBounds: l.any
}, {
name: "segment-distances",
type: u.bidirectionalSizes,
triggersBounds: l.any
}, {
name: "segment-weights",
type: u.numbers,
triggersBounds: l.any
}, {
name: "segment-radii",
type: u.numbers,
triggersBounds: l.any
}, {
name: "radius-type",
type: u.radiusType,
triggersBounds: l.any
}, {
name: "taxi-turn",
type: u.bidirectionalSizeMaybePercent,
triggersBounds: l.any
}, {
name: "taxi-turn-min-distance",
type: u.size,
triggersBounds: l.any
}, {
name: "taxi-direction",
type: u.axisDirection,
triggersBounds: l.any
}, {
name: "taxi-radius",
type: u.number,
triggersBounds: l.any
}, {
name: "edge-distances",
type: u.edgeDistances,
triggersBounds: l.any
}, {
name: "arrow-scale",
type: u.positiveNumber,
triggersBounds: l.any
}, {
name: "loop-direction",
type: u.angle,
triggersBounds: l.any
}, {
name: "loop-sweep",
type: u.angle,
triggersBounds: l.any
}, {
name: "source-distance-from-node",
type: u.size,
triggersBounds: l.any
}, {
name: "target-distance-from-node",
type: u.size,
triggersBounds: l.any
}], A = [{
name: "ghost",
type: u.bool,
triggersBounds: l.any
}, {
name: "ghost-offset-x",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "ghost-offset-y",
type: u.bidirectionalSize,
triggersBounds: l.any
}, {
name: "ghost-opacity",
type: u.zeroOneNumber
}], T = [{
name: "selection-box-color",
type: u.color
}, {
name: "selection-box-opacity",
type: u.zeroOneNumber
}, {
name: "selection-box-border-color",
type: u.color
}, {
name: "selection-box-border-width",
type: u.size
}, {
name: "active-bg-color",
type: u.color
}, {
name: "active-bg-opacity",
type: u.zeroOneNumber
}, {
name: "active-bg-size",
type: u.size
}, {
name: "outside-texture-bg-color",
type: u.color
}, {
name: "outside-texture-bg-opacity",
type: u.zeroOneNumber
}], R = [];
Sr.pieBackgroundN = 16, R.push({
name: "pie-size",
type: u.sizeMaybePercent
});
for (var M = 1; M <= Sr.pieBackgroundN; M++)
R.push({
name: "pie-" + M + "-background-color",
type: u.color
}), R.push({
name: "pie-" + M + "-background-size",
type: u.percent
}), R.push({
name: "pie-" + M + "-background-opacity",
type: u.zeroOneNumber
});
var j = [], P = Sr.arrowPrefixes = ["source", "mid-source", "target", "mid-target"];
[{
name: "arrow-shape",
type: u.arrowShape,
triggersBounds: l.any
}, {
name: "arrow-color",
type: u.color
}, {
name: "arrow-fill",
type: u.arrowFill
}, {
name: "arrow-width",
type: u.arrowWidth
}].forEach(function(Z) {
P.forEach(function(le) {
var pe = le + "-" + Z.name, ke = Z.type, Ne = Z.triggersBounds;
j.push({
name: pe,
type: ke,
triggersBounds: Ne
});
});
}, {});
var V = Sr.properties = [].concat(v, x, m, g, b, A, f, h, c, d, p, k, C, _, $, R, O, F, j, T), U = Sr.propertyGroups = {
// common to all eles
behavior: v,
transition: x,
visibility: m,
overlay: g,
underlay: b,
ghost: A,
// labels
commonLabel: f,
labelDimensions: h,
mainLabel: c,
sourceLabel: d,
targetLabel: p,
// node props
nodeBody: k,
nodeBorder: C,
nodeOutline: _,
backgroundImage: $,
pie: R,
compound: O,
// edge props
edgeLine: F,
edgeArrow: j,
core: T
}, G = Sr.propertyGroupNames = {}, se = Sr.propertyGroupKeys = Object.keys(U);
se.forEach(function(Z) {
G[Z] = U[Z].map(function(le) {
return le.name;
}), U[Z].forEach(function(le) {
return le.groupKey = Z;
});
});
var ae = Sr.aliases = [{
name: "content",
pointsTo: "label"
}, {
name: "control-point-distance",
pointsTo: "control-point-distances"
}, {
name: "control-point-weight",
pointsTo: "control-point-weights"
}, {
name: "segment-distance",
pointsTo: "segment-distances"
}, {
name: "segment-weight",
pointsTo: "segment-weights"
}, {
name: "segment-radius",
pointsTo: "segment-radii"
}, {
name: "edge-text-rotation",
pointsTo: "text-rotation"
}, {
name: "padding-left",
pointsTo: "padding"
}, {
name: "padding-right",
pointsTo: "padding"
}, {
name: "padding-top",
pointsTo: "padding"
}, {
name: "padding-bottom",
pointsTo: "padding"
}];
Sr.propertyNames = V.map(function(Z) {
return Z.name;
});
for (var de = 0; de < V.length; de++) {
var me = V[de];
V[me.name] = me;
}
for (var te = 0; te < ae.length; te++) {
var oe = ae[te], ne = V[oe.pointsTo], ee = {
name: oe.name,
alias: !0,
pointsTo: ne
};
V.push(ee), V[oe.name] = ee;
}
})();
Sr.getDefaultProperty = function(e) {
return this.getDefaultProperties()[e];
};
Sr.getDefaultProperties = function() {
var e = this._private;
if (e.defaultProperties != null)
return e.defaultProperties;
for (var t = _t({
// core props
"selection-box-color": "#ddd",
"selection-box-opacity": 0.65,
"selection-box-border-color": "#aaa",
"selection-box-border-width": 1,
"active-bg-color": "black",
"active-bg-opacity": 0.15,
"active-bg-size": 30,
"outside-texture-bg-color": "#000",
"outside-texture-bg-opacity": 0.125,
// common node/edge props
events: "yes",
"text-events": "no",
"text-valign": "top",
"text-halign": "center",
"text-justification": "auto",
"line-height": 1,
color: "#000",
"text-outline-color": "#000",
"text-outline-width": 0,
"text-outline-opacity": 1,
"text-opacity": 1,
"text-decoration": "none",
"text-transform": "none",
"text-wrap": "none",
"text-overflow-wrap": "whitespace",
"text-max-width": 9999,
"text-background-color": "#000",
"text-background-opacity": 0,
"text-background-shape": "rectangle",
"text-background-padding": 0,
"text-border-opacity": 0,
"text-border-width": 0,
"text-border-style": "solid",
"text-border-color": "#000",
"font-family": "Helvetica Neue, Helvetica, sans-serif",
"font-style": "normal",
"font-weight": "normal",
"font-size": 16,
"min-zoomed-font-size": 0,
"text-rotation": "none",
"source-text-rotation": "none",
"target-text-rotation": "none",
visibility: "visible",
display: "element",
opacity: 1,
"z-compound-depth": "auto",
"z-index-compare": "auto",
"z-index": 0,
label: "",
"text-margin-x": 0,
"text-margin-y": 0,
"source-label": "",
"source-text-offset": 0,
"source-text-margin-x": 0,
"source-text-margin-y": 0,
"target-label": "",
"target-text-offset": 0,
"target-text-margin-x": 0,
"target-text-margin-y": 0,
"overlay-opacity": 0,
"overlay-color": "#000",
"overlay-padding": 10,
"overlay-shape": "round-rectangle",
"overlay-corner-radius": "auto",
"underlay-opacity": 0,
"underlay-color": "#000",
"underlay-padding": 10,
"underlay-shape": "round-rectangle",
"underlay-corner-radius": "auto",
"transition-property": "none",
"transition-duration": 0,
"transition-delay": 0,
"transition-timing-function": "linear",
// node props
"background-blacken": 0,
"background-color": "#999",
"background-fill": "solid",
"background-opacity": 1,
"background-image": "none",
"background-image-crossorigin": "anonymous",
"background-image-opacity": 1,
"background-image-containment": "inside",
"background-image-smoothing": "yes",
"background-position-x": "50%",
"background-position-y": "50%",
"background-offset-x": 0,
"background-offset-y": 0,
"background-width-relative-to": "include-padding",
"background-height-relative-to": "include-padding",
"background-repeat": "no-repeat",
"background-fit": "none",
"background-clip": "node",
"background-width": "auto",
"background-height": "auto",
"border-color": "#000",
"border-opacity": 1,
"border-width": 0,
"border-style": "solid",
"border-dash-pattern": [4, 2],
"border-dash-offset": 0,
"border-cap": "butt",
"border-join": "miter",
"border-position": "center",
"outline-color": "#999",
"outline-opacity": 1,
"outline-width": 0,
"outline-offset": 0,
"outline-style": "solid",
height: 30,
width: 30,
shape: "ellipse",
"shape-polygon-points": "-1, -1, 1, -1, 1, 1, -1, 1",
"corner-radius": "auto",
"bounds-expansion": 0,
// node gradient
"background-gradient-direction": "to-bottom",
"background-gradient-stop-colors": "#999",
"background-gradient-stop-positions": "0%",
// ghost props
ghost: "no",
"ghost-offset-y": 0,
"ghost-offset-x": 0,
"ghost-opacity": 0,
// compound props
padding: 0,
"padding-relative-to": "width",
position: "origin",
"compound-sizing-wrt-labels": "include",
"min-width": 0,
"min-width-bias-left": 0,
"min-width-bias-right": 0,
"min-height": 0,
"min-height-bias-top": 0,
"min-height-bias-bottom": 0
}, {
// node pie bg
"pie-size": "100%"
}, [{
name: "pie-{{i}}-background-color",
value: "black"
}, {
name: "pie-{{i}}-background-size",
value: "0%"
}, {
name: "pie-{{i}}-background-opacity",
value: 1
}].reduce(function(l, u) {
for (var c = 1; c <= Sr.pieBackgroundN; c++) {
var d = u.name.replace("{{i}}", c), p = u.value;
l[d] = p;
}
return l;
}, {}), {
// edge props
"line-style": "solid",
"line-color": "#999",
"line-fill": "solid",
"line-cap": "butt",
"line-opacity": 1,
"line-outline-width": 0,
"line-outline-color": "#000",
"line-gradient-stop-colors": "#999",
"line-gradient-stop-positions": "0%",
"control-point-step-size": 40,
"control-point-weights": 0.5,
"segment-weights": 0.5,
"segment-distances": 20,
"segment-radii": 15,
"radius-type": "arc-radius",
"taxi-turn": "50%",
"taxi-radius": 15,
"taxi-turn-min-distance": 10,
"taxi-direction": "auto",
"edge-distances": "intersection",
"curve-style": "haystack",
"haystack-radius": 0,
"arrow-scale": 1,
"loop-direction": "-45deg",
"loop-sweep": "-90deg",
"source-distance-from-node": 0,
"target-distance-from-node": 0,
"source-endpoint": "outside-to-node",
"target-endpoint": "outside-to-node",
"line-dash-pattern": [6, 3],
"line-dash-offset": 0
}, [{
name: "arrow-shape",
value: "none"
}, {
name: "arrow-color",
value: "#999"
}, {
name: "arrow-fill",
value: "filled"
}, {
name: "arrow-width",
value: 1
}].reduce(function(l, u) {
return Sr.arrowPrefixes.forEach(function(c) {
var d = c + "-" + u.name, p = u.value;
l[d] = p;
}), l;
}, {})), n = {}, r = 0; r < this.properties.length; r++) {
var o = this.properties[r];
if (!o.pointsTo) {
var a = o.name, i = t[a], s = this.parse(a, i);
n[a] = s;
}
}
return e.defaultProperties = n, e.defaultProperties;
};
Sr.addDefaultStylesheet = function() {
this.selector(":parent").css({
shape: "rectangle",
padding: 10,
"background-color": "#eee",
"border-color": "#ccc",
"border-width": 1
}).selector("edge").css({
width: 3
}).selector(":loop").css({
"curve-style": "bezier"
}).selector("edge:compound").css({
"curve-style": "bezier",
"source-endpoint": "outside-to-line",
"target-endpoint": "outside-to-line"
}).selector(":selected").css({
"background-color": "#0169D9",
"line-color": "#0169D9",
"source-arrow-color": "#0169D9",
"target-arrow-color": "#0169D9",
"mid-source-arrow-color": "#0169D9",
"mid-target-arrow-color": "#0169D9"
}).selector(":parent:selected").css({
"background-color": "#CCE1F9",
"border-color": "#aec8e5"
}).selector(":active").css({
"overlay-color": "black",
"overlay-padding": 10,
"overlay-opacity": 0.25
}), this.defaultLength = this.length;
};
var Sm = {};
Sm.parse = function(e, t, n, r) {
var o = this;
if (Nn(t))
return o.parseImplWarn(e, t, n, r);
var a = r === "mapping" || r === !0 || r === !1 || r == null ? "dontcare" : r, i = n ? "t" : "f", s = "" + t, l = AB(e, s, i, a), u = o.propCache = o.propCache || [], c;
return (c = u[l]) || (c = u[l] = o.parseImplWarn(e, t, n, r)), (n || r === "mapping") && (c = ai(c), c && (c.value = ai(c.value))), c;
};
Sm.parseImplWarn = function(e, t, n, r) {
var o = this.parseImpl(e, t, n, r);
return !o && t != null && sn("The style property `".concat(e, ": ").concat(t, "` is invalid")), o && (o.name === "width" || o.name === "height") && t === "label" && sn("The style value of `label` is deprecated for `" + o.name + "`"), o;
};
Sm.parseImpl = function(e, t, n, r) {
var o = this;
e = f$(e);
var a = o.properties[e], i = t, s = o.types;
if (!a || t === void 0)
return null;
a.alias && (a = a.pointsTo, e = a.name);
var l = gt(t);
l && (t = t.trim());
var u = a.type;
if (!u)
return null;
if (n && (t === "" || t === null))
return {
name: e,
value: t,
bypass: !0,
deleteBypass: !0
};
if (Nn(t))
return {
name: e,
value: t,
strValue: "fn",
mapped: s.fn,
bypass: n
};
var c, d;
if (!(!l || r || t.length < 7 || t[1] !== "a")) {
if (t.length >= 7 && t[0] === "d" && (c = new RegExp(s.data.regex).exec(t))) {
if (n)
return !1;
var p = s.data;
return {
name: e,
value: c,
strValue: "" + t,
mapped: p,
field: c[1],
bypass: n
};
} else if (t.length >= 10 && t[0] === "m" && (d = new RegExp(s.mapData.regex).exec(t))) {
if (n || u.multiple)
return !1;
var h = s.mapData;
if (!(u.color || u.number))
return !1;
var f = this.parse(e, d[4]);
if (!f || f.mapped)
return !1;
var v = this.parse(e, d[5]);
if (!v || v.mapped)
return !1;
if (f.pfValue === v.pfValue || f.strValue === v.strValue)
return sn("`" + e + ": " + t + "` is not a valid mapper because the output range is zero; converting to `" + e + ": " + f.strValue + "`"), this.parse(e, f.strValue);
if (u.color) {
var m = f.value, g = v.value, b = m[0] === g[0] && m[1] === g[1] && m[2] === g[2] && // optional alpha
(m[3] === g[3] || (m[3] == null || m[3] === 1) && (g[3] == null || g[3] === 1));
if (b)
return !1;
}
return {
name: e,
value: d,
strValue: "" + t,
mapped: h,
field: d[1],
fieldMin: parseFloat(d[2]),
// min & max are numeric
fieldMax: parseFloat(d[3]),
valueMin: f.value,
valueMax: v.value,
bypass: n
};
}
}
if (u.multiple && r !== "multiple") {
var x;
if (l ? x = t.split(/\s+/) : dn(t) ? x = t : x = [t], u.evenMultiple && x.length % 2 !== 0)
return null;
for (var w = [], k = [], C = [], _ = "", $ = !1, O = 0; O < x.length; O++) {
var F = o.parse(e, x[O], n, "multiple");
$ = $ || gt(F.value), w.push(F.value), C.push(F.pfValue != null ? F.pfValue : F.value), k.push(F.units), _ += (O > 0 ? " " : "") + F.strValue;
}
return u.validate && !u.validate(w, k) ? null : u.singleEnum && $ ? w.length === 1 && gt(w[0]) ? {
name: e,
value: w[0],
strValue: w[0],
bypass: n
} : null : {
name: e,
value: w,
pfValue: C,
strValue: _,
bypass: n,
units: k
};
}
var A = function() {
for (var Z = 0; Z < u.enums.length; Z++) {
var le = u.enums[Z];
if (le === t)
return {
name: e,
value: t,
strValue: "" + t,
bypass: n
};
}
return null;
};
if (u.number) {
var T, R = "px";
if (u.units && (T = u.units), u.implicitUnits && (R = u.implicitUnits), !u.unitless)
if (l) {
var M = "px|em" + (u.allowPercent ? "|\\%" : "");
T && (M = T);
var j = t.match("^(" + lr + ")(" + M + ")?$");
j && (t = j[1], T = j[2] || R);
} else (!T || u.implicitUnits) && (T = R);
if (t = parseFloat(t), isNaN(t) && u.enums === void 0)
return null;
if (isNaN(t) && u.enums !== void 0)
return t = i, A();
if (u.integer && !o0e(t) || u.min !== void 0 && (t < u.min || u.strictMin && t === u.min) || u.max !== void 0 && (t > u.max || u.strictMax && t === u.max))
return null;
var P = {
name: e,
value: t,
strValue: "" + t + (T || ""),
units: T,
bypass: n
};
return u.unitless || T !== "px" && T !== "em" ? P.pfValue = t : P.pfValue = T === "px" || !T ? t : this.getEmSizeInPixels() * t, (T === "ms" || T === "s") && (P.pfValue = T === "ms" ? t : 1e3 * t), (T === "deg" || T === "rad") && (P.pfValue = T === "rad" ? t : Dme(t)), T === "%" && (P.pfValue = t / 100), P;
} else if (u.propList) {
var V = [], U = "" + t;
if (U !== "none") {
for (var G = U.split(/\s*,\s*|\s+/), se = 0; se < G.length; se++) {
var ae = G[se].trim();
o.properties[ae] ? V.push(ae) : sn("`" + ae + "` is not a valid property name");
}
if (V.length === 0)
return null;
}
return {
name: e,
value: V,
strValue: V.length === 0 ? "none" : V.join(" "),
bypass: n
};
} else if (u.color) {
var de = x0e(t);
return de ? {
name: e,
value: de,
pfValue: de,
strValue: "rgb(" + de[0] + "," + de[1] + "," + de[2] + ")",
// n.b. no spaces b/c of multiple support
bypass: n
} : null;
} else if (u.regex || u.regexes) {
if (u.enums) {
var me = A();
if (me)
return me;
}
for (var te = u.regexes ? u.regexes : [u.regex], oe = 0; oe < te.length; oe++) {
var ne = new RegExp(te[oe]), ee = ne.exec(t);
if (ee)
return {
name: e,
value: u.singleRegexMatchValue ? ee[1] : ee,
strValue: "" + t,
bypass: n
};
}
return null;
} else return u.string ? {
name: e,
value: "" + t,
strValue: "" + t,
bypass: n
} : u.enums ? A() : null;
};
var Wr = function e(t) {
if (!(this instanceof e))
return new e(t);
if (!p$(t)) {
Un("A style must have a core reference");
return;
}
this._private = {
cy: t,
coreStyle: {}
}, this.length = 0, this.resetToDefault();
}, Zr = Wr.prototype;
Zr.instanceString = function() {
return "style";
};
Zr.clear = function() {
for (var e = this._private, t = e.cy, n = t.elements(), r = 0; r < this.length; r++)
this[r] = void 0;
return this.length = 0, e.contextStyles = {}, e.propDiffs = {}, this.cleanElements(n, !0), n.forEach(function(o) {
var a = o[0]._private;
a.styleDirty = !0, a.appliedInitStyle = !1;
}), this;
};
Zr.resetToDefault = function() {
return this.clear(), this.addDefaultStylesheet(), this;
};
Zr.core = function(e) {
return this._private.coreStyle[e] || this.getDefaultProperty(e);
};
Zr.selector = function(e) {
var t = e === "core" ? null : new il(e), n = this.length++;
return this[n] = {
selector: t,
properties: [],
mappedProperties: [],
index: n
}, this;
};
Zr.css = function() {
var e = this, t = arguments;
if (t.length === 1)
for (var n = t[0], r = 0; r < e.properties.length; r++) {
var o = e.properties[r], a = n[o.name];
a === void 0 && (a = n[dm(o.name)]), a !== void 0 && this.cssRule(o.name, a);
}
else t.length === 2 && this.cssRule(t[0], t[1]);
return this;
};
Zr.style = Zr.css;
Zr.cssRule = function(e, t) {
var n = this.parse(e, t);
if (n) {
var r = this.length - 1;
this[r].properties.push(n), this[r].properties[n.name] = n, n.name.match(/pie-(\d+)-background-size/) && n.value && (this._private.hasPie = !0), n.mapped && this[r].mappedProperties.push(n);
var o = !this[r].selector;
o && (this._private.coreStyle[n.name] = n);
}
return this;
};
Zr.append = function(e) {
return xB(e) ? e.appendToStyle(this) : dn(e) ? this.appendFromJson(e) : gt(e) && this.appendFromString(e), this;
};
Wr.fromJson = function(e, t) {
var n = new Wr(e);
return n.fromJson(t), n;
};
Wr.fromString = function(e, t) {
return new Wr(e).fromString(t);
};
[Jr, ah, E$, yi, _m, O$, Sr, Sm].forEach(function(e) {
_t(Zr, e);
});
Wr.types = Zr.types;
Wr.properties = Zr.properties;
Wr.propertyGroups = Zr.propertyGroups;
Wr.propertyGroupNames = Zr.propertyGroupNames;
Wr.propertyGroupKeys = Zr.propertyGroupKeys;
var o2e = {
style: function(e) {
if (e) {
var t = this.setStyle(e);
t.update();
}
return this._private.style;
},
setStyle: function(e) {
var t = this._private;
return xB(e) ? t.style = e.generateStyle(this) : dn(e) ? t.style = Wr.fromJson(this, e) : gt(e) ? t.style = Wr.fromString(this, e) : t.style = Wr(this), t.style;
},
// e.g. cy.data() changed => recalc ele mappers
updateStyle: function() {
this.mutableElements().updateStyle();
}
}, a2e = "single", gu = {
autolock: function(e) {
if (e !== void 0)
this._private.autolock = !!e;
else
return this._private.autolock;
return this;
},
autoungrabify: function(e) {
if (e !== void 0)
this._private.autoungrabify = !!e;
else
return this._private.autoungrabify;
return this;
},
autounselectify: function(e) {
if (e !== void 0)
this._private.autounselectify = !!e;
else
return this._private.autounselectify;
return this;
},
selectionType: function(e) {
var t = this._private;
if (t.selectionType == null && (t.selectionType = a2e), e !== void 0)
(e === "additive" || e === "single") && (t.selectionType = e);
else
return t.selectionType;
return this;
},
panningEnabled: function(e) {
if (e !== void 0)
this._private.panningEnabled = !!e;
else
return this._private.panningEnabled;
return this;
},
userPanningEnabled: function(e) {
if (e !== void 0)
this._private.userPanningEnabled = !!e;
else
return this._private.userPanningEnabled;
return this;
},
zoomingEnabled: function(e) {
if (e !== void 0)
this._private.zoomingEnabled = !!e;
else
return this._private.zoomingEnabled;
return this;
},
userZoomingEnabled: function(e) {
if (e !== void 0)
this._private.userZoomingEnabled = !!e;
else
return this._private.userZoomingEnabled;
return this;
},
boxSelectionEnabled: function(e) {
if (e !== void 0)
this._private.boxSelectionEnabled = !!e;
else
return this._private.boxSelectionEnabled;
return this;
},
pan: function() {
var e = arguments, t = this._private.pan, n, r, o, a, i;
switch (e.length) {
case 0:
return t;
case 1:
if (gt(e[0]))
return n = e[0], t[n];
if (Xt(e[0])) {
if (!this._private.panningEnabled)
return this;
o = e[0], a = o.x, i = o.y, Ze(a) && (t.x = a), Ze(i) && (t.y = i), this.emit("pan viewport");
}
break;
case 2:
if (!this._private.panningEnabled)
return this;
n = e[0], r = e[1], (n === "x" || n === "y") && Ze(r) && (t[n] = r), this.emit("pan viewport");
break;
}
return this.notify("viewport"), this;
},
panBy: function(e, t) {
var n = arguments, r = this._private.pan, o, a, i, s, l;
if (!this._private.panningEnabled)
return this;
switch (n.length) {
case 1:
Xt(e) && (i = n[0], s = i.x, l = i.y, Ze(s) && (r.x += s), Ze(l) && (r.y += l), this.emit("pan viewport"));
break;
case 2:
o = e, a = t, (o === "x" || o === "y") && Ze(a) && (r[o] += a), this.emit("pan viewport");
break;
}
return this.notify("viewport"), this;
},
fit: function(e, t) {
var n = this.getFitViewport(e, t);
if (n) {
var r = this._private;
r.zoom = n.zoom, r.pan = n.pan, this.emit("pan zoom viewport"), this.notify("viewport");
}
return this;
},
getFitViewport: function(e, t) {
if (Ze(e) && t === void 0 && (t = e, e = void 0), !(!this._private.panningEnabled || !this._private.zoomingEnabled)) {
var n;
if (gt(e)) {
var r = e;
e = this.$(r);
} else if (s0e(e)) {
var o = e;
n = {
x1: o.x1,
y1: o.y1,
x2: o.x2,
y2: o.y2
}, n.w = n.x2 - n.x1, n.h = n.y2 - n.y1;
} else Mo(e) || (e = this.mutableElements());
if (!(Mo(e) && e.empty())) {
n = n || e.boundingBox();
var a = this.width(), i = this.height(), s;
if (t = Ze(t) ? t : 0, !isNaN(a) && !isNaN(i) && a > 0 && i > 0 && !isNaN(n.w) && !isNaN(n.h) && n.w > 0 && n.h > 0) {
s = Math.min((a - 2 * t) / n.w, (i - 2 * t) / n.h), s = s > this._private.maxZoom ? this._private.maxZoom : s, s = s < this._private.minZoom ? this._private.minZoom : s;
var l = {
// now pan to middle
x: (a - s * (n.x1 + n.x2)) / 2,
y: (i - s * (n.y1 + n.y2)) / 2
};
return {
zoom: s,
pan: l
};
}
}
}
},
zoomRange: function(e, t) {
var n = this._private;
if (t == null) {
var r = e;
e = r.min, t = r.max;
}
return Ze(e) && Ze(t) && e <= t ? (n.minZoom = e, n.maxZoom = t) : Ze(e) && t === void 0 && e <= n.maxZoom ? n.minZoom = e : Ze(t) && e === void 0 && t >= n.minZoom && (n.maxZoom = t), this;
},
minZoom: function(e) {
return e === void 0 ? this._private.minZoom : this.zoomRange({
min: e
});
},
maxZoom: function(e) {
return e === void 0 ? this._private.maxZoom : this.zoomRange({
max: e
});
},
getZoomedViewport: function(e) {
var t = this._private, n = t.pan, r = t.zoom, o, a, i = !1;
if (t.zoomingEnabled || (i = !0), Ze(e) ? a = e : Xt(e) && (a = e.level, e.position != null ? o = vm(e.position, r, n) : e.renderedPosition != null && (o = e.renderedPosition), o != null && !t.panningEnabled && (i = !0)), a = a > t.maxZoom ? t.maxZoom : a, a = a < t.minZoom ? t.minZoom : a, i || !Ze(a) || a === r || o != null && (!Ze(o.x) || !Ze(o.y)))
return null;
if (o != null) {
var s = n, l = r, u = a, c = {
x: -u / l * (o.x - s.x) + o.x,
y: -u / l * (o.y - s.y) + o.y
};
return {
zoomed: !0,
panned: !0,
zoom: u,
pan: c
};
} else
return {
zoomed: !0,
panned: !1,
zoom: a,
pan: n
};
},
zoom: function(e) {
if (e === void 0)
return this._private.zoom;
var t = this.getZoomedViewport(e), n = this._private;
return t == null || !t.zoomed ? this : (n.zoom = t.zoom, t.panned && (n.pan.x = t.pan.x, n.pan.y = t.pan.y), this.emit("zoom" + (t.panned ? " pan" : "") + " viewport"), this.notify("viewport"), this);
},
viewport: function(e) {
var t = this._private, n = !0, r = !0, o = [], a = !1, i = !1;
if (!e)
return this;
if (Ze(e.zoom) || (n = !1), Xt(e.pan) || (r = !1), !n && !r)
return this;
if (n) {
var s = e.zoom;
s < t.minZoom || s > t.maxZoom || !t.zoomingEnabled ? a = !0 : (t.zoom = s, o.push("zoom"));
}
if (r && (!a || !e.cancelOnFailedZoom) && t.panningEnabled) {
var l = e.pan;
Ze(l.x) && (t.pan.x = l.x, i = !1), Ze(l.y) && (t.pan.y = l.y, i = !1), i || o.push("pan");
}
return o.length > 0 && (o.push("viewport"), this.emit(o.join(" ")), this.notify("viewport")), this;
},
center: function(e) {
var t = this.getCenterPan(e);
return t && (this._private.pan = t, this.emit("pan viewport"), this.notify("viewport")), this;
},
getCenterPan: function(e, t) {
if (this._private.panningEnabled) {
if (gt(e)) {
var n = e;
e = this.mutableElements().filter(n);
} else Mo(e) || (e = this.mutableElements());
if (e.length !== 0) {
var r = e.boundingBox(), o = this.width(), a = this.height();
t = t === void 0 ? this._private.zoom : t;
var i = {
// middle
x: (o - t * (r.x1 + r.x2)) / 2,
y: (a - t * (r.y1 + r.y2)) / 2
};
return i;
}
}
},
reset: function() {
return !this._private.panningEnabled || !this._private.zoomingEnabled ? this : (this.viewport({
pan: {
x: 0,
y: 0
},
zoom: 1
}), this);
},
invalidateSize: function() {
this._private.sizeCache = null;
},
size: function() {
var e = this._private, t = e.container, n = this;
return e.sizeCache = e.sizeCache || (t ? function() {
var r = n.window().getComputedStyle(t), o = function(a) {
return parseFloat(r.getPropertyValue(a));
};
return {
width: t.clientWidth - o("padding-left") - o("padding-right"),
height: t.clientHeight - o("padding-top") - o("padding-bottom")
};
}() : {
// fallback if no container (not 0 b/c can be used for dividing etc)
width: 1,
height: 1
});
},
width: function() {
return this.size().width;
},
height: function() {
return this.size().height;
},
extent: function() {
var e = this._private.pan, t = this._private.zoom, n = this.renderedExtent(), r = {
x1: (n.x1 - e.x) / t,
x2: (n.x2 - e.x) / t,
y1: (n.y1 - e.y) / t,
y2: (n.y2 - e.y) / t
};
return r.w = r.x2 - r.x1, r.h = r.y2 - r.y1, r;
},
renderedExtent: function() {
var e = this.width(), t = this.height();
return {
x1: 0,
y1: 0,
x2: e,
y2: t,
w: e,
h: t
};
},
multiClickDebounceTime: function(e) {
if (e) this._private.multiClickDebounceTime = e;
else return this._private.multiClickDebounceTime;
return this;
}
};
gu.centre = gu.center;
gu.autolockNodes = gu.autolock;
gu.autoungrabifyNodes = gu.autoungrabify;
var hf = {
data: an.data({
field: "data",
bindingEvent: "data",
allowBinding: !0,
allowSetting: !0,
settingEvent: "data",
settingTriggersEvent: !0,
triggerFnName: "trigger",
allowGetting: !0,
updateStyle: !0
}),
removeData: an.removeData({
field: "data",
event: "data",
triggerFnName: "trigger",
triggerEvent: !0,
updateStyle: !0
}),
scratch: an.data({
field: "scratch",
bindingEvent: "scratch",
allowBinding: !0,
allowSetting: !0,
settingEvent: "scratch",
settingTriggersEvent: !0,
triggerFnName: "trigger",
allowGetting: !0,
updateStyle: !0
}),
removeScratch: an.removeData({
field: "scratch",
event: "scratch",
triggerFnName: "trigger",
triggerEvent: !0,
updateStyle: !0
})
};
hf.attr = hf.data;
hf.removeAttr = hf.removeData;
var vf = function(e) {
var t = this;
e = _t({}, e);
var n = e.container;
n && !Dg(n) && Dg(n[0]) && (n = n[0]);
var r = n ? n._cyreg : null;
r = r || {}, r && r.cy && (r.cy.destroy(), r = {});
var o = r.readies = r.readies || [];
n && (n._cyreg = r), r.cy = t;
var a = ir !== void 0 && n !== void 0 && !e.headless, i = e;
i.layout = _t({
name: a ? "grid" : "null"
}, i.layout), i.renderer = _t({
name: a ? "canvas" : "null"
}, i.renderer);
var s = function(p, h, f) {
return h !== void 0 ? h : f !== void 0 ? f : p;
}, l = this._private = {
container: n,
// html dom ele container
ready: !1,
// whether ready has been triggered
options: i,
// cached options
elements: new Rr(this),
// elements in the graph
listeners: [],
// list of listeners
aniEles: new Rr(this),
// elements being animated
data: i.data || {},
// data for the core
scratch: {},
// scratch object for core
layout: null,
renderer: null,
destroyed: !1,
// whether destroy was called
notificationsEnabled: !0,
// whether notifications are sent to the renderer
minZoom: 1e-50,
maxZoom: 1e50,
zoomingEnabled: s(!0, i.zoomingEnabled),
userZoomingEnabled: s(!0, i.userZoomingEnabled),
panningEnabled: s(!0, i.panningEnabled),
userPanningEnabled: s(!0, i.userPanningEnabled),
boxSelectionEnabled: s(!0, i.boxSelectionEnabled),
autolock: s(!1, i.autolock, i.autolockNodes),
autoungrabify: s(!1, i.autoungrabify, i.autoungrabifyNodes),
autounselectify: s(!1, i.autounselectify),
styleEnabled: i.styleEnabled === void 0 ? a : i.styleEnabled,
zoom: Ze(i.zoom) ? i.zoom : 1,
pan: {
x: Xt(i.pan) && Ze(i.pan.x) ? i.pan.x : 0,
y: Xt(i.pan) && Ze(i.pan.y) ? i.pan.y : 0
},
animation: {
// object for currently-running animations
current: [],
queue: []
},
hasCompoundNodes: !1,
multiClickDebounceTime: s(250, i.multiClickDebounceTime)
};
this.createEmitter(), this.selectionType(i.selectionType), this.zoomRange({
min: i.minZoom,
max: i.maxZoom
});
var u = function(p, h) {
var f = p.some(l0e);
if (f)
return md.all(p).then(h);
h(p);
};
l.styleEnabled && t.setStyle([]);
var c = _t({}, i, i.renderer);
t.initRenderer(c);
var d = function(p, h, f) {
t.notifications(!1);
var v = t.mutableElements();
v.length > 0 && v.remove(), p != null && (Xt(p) || dn(p)) && t.add(p), t.one("layoutready", function(g) {
t.notifications(!0), t.emit(g), t.one("load", h), t.emitAndNotify("load");
}).one("layoutstop", function() {
t.one("done", f), t.emit("done");
});
var m = _t({}, t._private.options.layout);
m.eles = t.elements(), t.layout(m).run();
};
u([i.style, i.elements], function(p) {
var h = p[0], f = p[1];
l.styleEnabled && t.style().append(h), d(f, function() {
t.startAnimationLoop(), l.ready = !0, Nn(i.ready) && t.on("ready", i.ready);
for (var v = 0; v < o.length; v++) {
var m = o[v];
t.on("ready", m);
}
r && (r.readies = []), t.emit("ready");
}, i.done);
});
}, qg = vf.prototype;
_t(qg, {
instanceString: function() {
return "core";
},
isReady: function() {
return this._private.ready;
},
destroyed: function() {
return this._private.destroyed;
},
ready: function(e) {
return this.isReady() ? this.emitter().emit("ready", [], e) : this.on("ready", e), this;
},
destroy: function() {
var e = this;
if (!e.destroyed())
return e.stopAnimationLoop(), e.destroyRenderer(), this.emit("destroy"), e._private.destroyed = !0, e;
},
hasElementWithId: function(e) {
return this._private.elements.hasElementWithId(e);
},
getElementById: function(e) {
return this._private.elements.getElementById(e);
},
hasCompoundNodes: function() {
return this._private.hasCompoundNodes;
},
headless: function() {
return this._private.renderer.isHeadless();
},
styleEnabled: function() {
return this._private.styleEnabled;
},
addToPool: function(e) {
return this._private.elements.merge(e), this;
},
removeFromPool: function(e) {
return this._private.elements.unmerge(e), this;
},
container: function() {
return this._private.container || null;
},
window: function() {
var e = this._private.container;
if (e == null) return ir;
var t = this._private.container.ownerDocument;
return t === void 0 || t == null ? ir : t.defaultView || ir;
},
mount: function(e) {
if (e != null) {
var t = this, n = t._private, r = n.options;
return !Dg(e) && Dg(e[0]) && (e = e[0]), t.stopAnimationLoop(), t.destroyRenderer(), n.container = e, n.styleEnabled = !0, t.invalidateSize(), t.initRenderer(_t({}, r, r.renderer, {
// allow custom renderer name to be re-used, otherwise use canvas
name: r.renderer.name === "null" ? "canvas" : r.renderer.name
})), t.startAnimationLoop(), t.style(r.style), t.emit("mount"), t;
}
},
unmount: function() {
var e = this;
return e.stopAnimationLoop(), e.destroyRenderer(), e.initRenderer({
name: "null"
}), e.emit("unmount"), e;
},
options: function() {
return ai(this._private.options);
},
json: function(e) {
var t = this, n = t._private, r = t.mutableElements(), o = function(b) {
return t.getElementById(b.id());
};
if (Xt(e)) {
if (t.startBatch(), e.elements) {
var a = {}, i = function(b, x) {
for (var w = [], k = [], C = 0; C < b.length; C++) {
var _ = b[C];
if (!_.data.id) {
sn("cy.json() cannot handle elements without an ID attribute");
continue;
}
var $ = "" + _.data.id, O = t.getElementById($);
a[$] = !0, O.length !== 0 ? k.push({
ele: O,
json: _
}) : (x && (_.group = x), w.push(_));
}
t.add(w);
for (var F = 0; F < k.length; F++) {
var A = k[F], T = A.ele, R = A.json;
T.json(R);
}
};
if (dn(e.elements))
i(e.elements);
else
for (var s = ["nodes", "edges"], l = 0; l < s.length; l++) {
var u = s[l], c = e.elements[u];
dn(c) && i(c, u);
}
var d = t.collection();
r.filter(function(b) {
return !a[b.id()];
}).forEach(function(b) {
b.isParent() ? d.merge(b) : b.remove();
}), d.forEach(function(b) {
return b.children().move({
parent: null
});
}), d.forEach(function(b) {
return o(b).remove();
});
}
e.style && t.style(e.style), e.zoom != null && e.zoom !== n.zoom && t.zoom(e.zoom), e.pan && (e.pan.x !== n.pan.x || e.pan.y !== n.pan.y) && t.pan(e.pan), e.data && t.data(e.data);
for (var p = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"], h = 0; h < p.length; h++) {
var f = p[h];
e[f] != null && t[f](e[f]);
}
return t.endBatch(), this;
} else {
var v = !!e, m = {};
v ? m.elements = this.elements().map(function(b) {
return b.json();
}) : (m.elements = {}, r.forEach(function(b) {
var x = b.group();
m.elements[x] || (m.elements[x] = []), m.elements[x].push(b.json());
})), this._private.styleEnabled && (m.style = t.style().json()), m.data = ai(t.data());
var g = n.options;
return m.zoomingEnabled = n.zoomingEnabled, m.userZoomingEnabled = n.userZoomingEnabled, m.zoom = n.zoom, m.minZoom = n.minZoom, m.maxZoom = n.maxZoom, m.panningEnabled = n.panningEnabled, m.userPanningEnabled = n.userPanningEnabled, m.pan = ai(n.pan), m.boxSelectionEnabled = n.boxSelectionEnabled, m.renderer = ai(g.renderer), m.hideEdgesOnViewport = g.hideEdgesOnViewport, m.textureOnViewport = g.textureOnViewport, m.wheelSensitivity = g.wheelSensitivity, m.motionBlur = g.motionBlur, m.multiClickDebounceTime = g.multiClickDebounceTime, m;
}
}
});
qg.$id = qg.getElementById;
[Wwe, Qwe, kz, GC, Zv, t2e, WC, Jv, o2e, gu, hf].forEach(function(e) {
_t(qg, e);
});
var i2e = {
fit: !0,
// whether to fit the viewport to the graph
directed: !1,
// whether the tree is directed downwards (or edges can point in any direction if false)
padding: 30,
// padding on fit
circle: !1,
// put depths in concentric circles if true, put depths top down if false
grid: !1,
// whether to create an even grid into which the DAG is placed (circle:false only)
spacingFactor: 1.75,
// positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap)
boundingBox: void 0,
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
avoidOverlap: !0,
// prevents node overlap, may overflow boundingBox if not enough space
nodeDimensionsIncludeLabels: !1,
// Excludes the label when calculating node bounding boxes for the layout algorithm
roots: void 0,
// the roots of the trees
depthSort: void 0,
// a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') }
animate: !1,
// whether to transition the node positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled,
animateFilter: function(e, t) {
return !0;
},
// 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
ready: void 0,
// callback on layoutready
stop: void 0,
// callback on layoutstop
transform: function(e, t) {
return t;
}
// transform a given node position. Useful for changing flow direction in discrete layouts
}, s2e = {
maximal: !1,
// 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
acyclic: !1
// 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
}, ic = function(e) {
return e.scratch("breadthfirst");
}, yF = function(e, t) {
return e.scratch("breadthfirst", t);
};
function Cz(e) {
this.options = _t({}, i2e, s2e, e);
}
Cz.prototype.run = function() {
var e = this.options, t = e, n = e.cy, r = t.eles, o = r.nodes().filter(function(_e) {
return !_e.isParent();
}), a = r, i = t.directed, s = t.acyclic || t.maximal || t.maximalAdjustments > 0, l = Fo(t.boundingBox ? t.boundingBox : {
x1: 0,
y1: 0,
w: n.width(),
h: n.height()
}), u;
if (Mo(t.roots))
u = t.roots;
else if (dn(t.roots)) {
for (var c = [], d = 0; d < t.roots.length; d++) {
var p = t.roots[d], h = n.getElementById(p);
c.push(h);
}
u = n.collection(c);
} else if (gt(t.roots))
u = n.$(t.roots);
else if (i)
u = o.roots();
else {
var f = r.components();
u = n.collection();
for (var v = function(_e) {
var Fe = f[_e], Ie = Fe.maxDegree(!1), Ae = Fe.filter(function(qe) {
return qe.degree(!1) === Ie;
});
u = u.add(Ae);
}, m = 0; m < f.length; m++)
v(m);
}
var g = [], b = {}, x = function(_e, Fe) {
g[Fe] == null && (g[Fe] = []);
var Ie = g[Fe].length;
g[Fe].push(_e), yF(_e, {
index: Ie,
depth: Fe
});
}, w = function(_e, Fe) {
var Ie = ic(_e), Ae = Ie.depth, qe = Ie.index;
g[Ae][qe] = null, x(_e, Fe);
};
a.bfs({
roots: u,
directed: t.directed,
visit: function(_e, Fe, Ie, Ae, qe) {
var et = _e[0], He = et.id();
x(et, qe), b[He] = !0;
}
});
for (var k = [], C = 0; C < o.length; C++) {
var _ = o[C];
b[_.id()] || k.push(_);
}
var $ = function(_e) {
for (var Fe = g[_e], Ie = 0; Ie < Fe.length; Ie++) {
var Ae = Fe[Ie];
if (Ae == null) {
Fe.splice(Ie, 1), Ie--;
continue;
}
yF(Ae, {
depth: _e,
index: Ie
});
}
}, O = function() {
for (var _e = 0; _e < g.length; _e++)
$(_e);
}, F = function(_e, Fe) {
for (var Ie = ic(_e), Ae = _e.incomers().filter(function(I) {
return I.isNode() && r.has(I);
}), qe = -1, et = _e.id(), He = 0; He < Ae.length; He++) {
var ot = Ae[He], tt = ic(ot);
qe = Math.max(qe, tt.depth);
}
if (Ie.depth <= qe) {
if (!t.acyclic && Fe[et])
return null;
var Qe = qe + 1;
return w(_e, Qe), Fe[et] = Qe, !0;
}
return !1;
};
if (i && s) {
var A = [], T = {}, R = function(_e) {
return A.push(_e);
}, M = function() {
return A.shift();
};
for (o.forEach(function(_e) {
return A.push(_e);
}); A.length > 0; ) {
var j = M(), P = F(j, T);
if (P)
j.outgoers().filter(function(_e) {
return _e.isNode() && r.has(_e);
}).forEach(R);
else if (P === null) {
sn("Detected double maximal shift for node `" + j.id() + "`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");
break;
}
}
}
O();
var V = 0;
if (t.avoidOverlap)
for (var U = 0; U < o.length; U++) {
var G = o[U], se = G.layoutDimensions(t), ae = se.w, de = se.h;
V = Math.max(V, ae, de);
}
var me = {}, te = function(_e) {
if (me[_e.id()])
return me[_e.id()];
for (var Fe = ic(_e).depth, Ie = _e.neighborhood(), Ae = 0, qe = 0, et = 0; et < Ie.length; et++) {
var He = Ie[et];
if (!(He.isEdge() || He.isParent() || !o.has(He))) {
var ot = ic(He);
if (ot != null) {
var tt = ot.index, Qe = ot.depth;
if (!(tt == null || Qe == null)) {
var I = g[Qe].length;
Qe < Fe && (Ae += tt / I, qe++);
}
}
}
}
return qe = Math.max(1, qe), Ae = Ae / qe, qe === 0 && (Ae = 0), me[_e.id()] = Ae, Ae;
}, oe = function(_e, Fe) {
var Ie = te(_e), Ae = te(Fe), qe = Ie - Ae;
return qe === 0 ? CB(_e.id(), Fe.id()) : qe;
};
t.depthSort !== void 0 && (oe = t.depthSort);
for (var ne = 0; ne < g.length; ne++)
g[ne].sort(oe), $(ne);
for (var ee = [], Z = 0; Z < k.length; Z++)
ee.push(k[Z]);
g.unshift(ee), O();
for (var le = 0, pe = 0; pe < g.length; pe++)
le = Math.max(g[pe].length, le);
var ke = {
x: l.x1 + l.w / 2,
y: l.x1 + l.h / 2
}, Ne = g.reduce(function(_e, Fe) {
return Math.max(_e, Fe.length);
}, 0), De = function(_e) {
var Fe = ic(_e), Ie = Fe.depth, Ae = Fe.index, qe = g[Ie].length, et = Math.max(l.w / ((t.grid ? Ne : qe) + 1), V), He = Math.max(l.h / (g.length + 1), V), ot = Math.min(l.w / 2 / g.length, l.h / 2 / g.length);
if (ot = Math.max(ot, V), t.circle) {
var tt = ot * Ie + ot - (g.length > 0 && g[0].length <= 3 ? ot / 2 : 0), Qe = 2 * Math.PI / g[Ie].length * Ae;
return Ie === 0 && g[0].length === 1 && (tt = 1), {
x: ke.x + tt * Math.cos(Qe),
y: ke.y + tt * Math.sin(Qe)
};
} else {
var I = {
x: ke.x + (Ae + 1 - (qe + 1) / 2) * et,
y: (Ie + 1) * He
};
return I;
}
};
return r.nodes().layoutPositions(this, t, De), this;
};
var l2e = {
fit: !0,
// whether to fit the viewport to the graph
padding: 30,
// the padding on fit
boundingBox: void 0,
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
avoidOverlap: !0,
// prevents node overlap, may overflow boundingBox and radius if not enough space
nodeDimensionsIncludeLabels: !1,
// Excludes the label when calculating node bounding boxes for the layout algorithm
spacingFactor: void 0,
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
radius: void 0,
// the radius of the circle
startAngle: 3 / 2 * Math.PI,
// where nodes start in radians
sweep: void 0,
// how many radians should be between the first and last node (defaults to full circle)
clockwise: !0,
// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
sort: void 0,
// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
animate: !1,
// whether to transition the node positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled
animateFilter: function(e, t) {
return !0;
},
// 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
ready: void 0,
// callback on layoutready
stop: void 0,
// callback on layoutstop
transform: function(e, t) {
return t;
}
// transform a given node position. Useful for changing flow direction in discrete layouts
};
function _z(e) {
this.options = _t({}, l2e, e);
}
_z.prototype.run = function() {
var e = this.options, t = e, n = e.cy, r = t.eles, o = t.counterclockwise !== void 0 ? !t.counterclockwise : t.clockwise, a = r.nodes().not(":parent");
t.sort && (a = a.sort(t.sort));
for (var i = Fo(t.boundingBox ? t.boundingBox : {
x1: 0,
y1: 0,
w: n.width(),
h: n.height()
}), s = {
x: i.x1 + i.w / 2,
y: i.y1 + i.h / 2
}, l = t.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / a.length : t.sweep, u = l / Math.max(1, a.length - 1), c, d = 0, p = 0; p < a.length; p++) {
var h = a[p], f = h.layoutDimensions(t), v = f.w, m = f.h;
d = Math.max(d, v, m);
}
if (Ze(t.radius) ? c = t.radius : a.length <= 1 ? c = 0 : c = Math.min(i.h, i.w) / 2 - d, a.length > 1 && t.avoidOverlap) {
d *= 1.75;
var g = Math.cos(u) - Math.cos(0), b = Math.sin(u) - Math.sin(0), x = Math.sqrt(d * d / (g * g + b * b));
c = Math.max(x, c);
}
var w = function(k, C) {
var _ = t.startAngle + C * u * (o ? 1 : -1), $ = c * Math.cos(_), O = c * Math.sin(_), F = {
x: s.x + $,
y: s.y + O
};
return F;
};
return r.nodes().layoutPositions(this, t, w), this;
};
var u2e = {
fit: !0,
// whether to fit the viewport to the graph
padding: 30,
// the padding on fit
startAngle: 3 / 2 * Math.PI,
// where nodes start in radians
sweep: void 0,
// how many radians should be between the first and last node (defaults to full circle)
clockwise: !0,
// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false)
equidistant: !1,
// whether levels have an equal radial distance betwen them, may cause bounding box overflow
minNodeSpacing: 10,
// min spacing between outside of nodes (used for radius adjustment)
boundingBox: void 0,
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
avoidOverlap: !0,
// prevents node overlap, may overflow boundingBox if not enough space
nodeDimensionsIncludeLabels: !1,
// Excludes the label when calculating node bounding boxes for the layout algorithm
height: void 0,
// height of layout area (overrides container height)
width: void 0,
// width of layout area (overrides container width)
spacingFactor: void 0,
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
concentric: function(e) {
return e.degree();
},
levelWidth: function(e) {
return e.maxDegree() / 4;
},
animate: !1,
// whether to transition the node positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled
animateFilter: function(e, t) {
return !0;
},
// 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
ready: void 0,
// callback on layoutready
stop: void 0,
// callback on layoutstop
transform: function(e, t) {
return t;
}
// transform a given node position. Useful for changing flow direction in discrete layouts
};
function Sz(e) {
this.options = _t({}, u2e, e);
}
Sz.prototype.run = function() {
for (var e = this.options, t = e, n = t.counterclockwise !== void 0 ? !t.counterclockwise : t.clockwise, r = e.cy, o = t.eles, a = o.nodes().not(":parent"), i = Fo(t.boundingBox ? t.boundingBox : {
x1: 0,
y1: 0,
w: r.width(),
h: r.height()
}), s = {
x: i.x1 + i.w / 2,
y: i.y1 + i.h / 2
}, l = [], u = 0, c = 0; c < a.length; c++) {
var d = a[c], p = void 0;
p = t.concentric(d), l.push({
value: p,
node: d
}), d._private.scratch.concentric = p;
}
a.updateStyle();
for (var h = 0; h < a.length; h++) {
var f = a[h], v = f.layoutDimensions(t);
u = Math.max(u, v.w, v.h);
}
l.sort(function(_e, Fe) {
return Fe.value - _e.value;
});
for (var m = t.levelWidth(a), g = [[]], b = g[0], x = 0; x < l.length; x++) {
var w = l[x];
if (b.length > 0) {
var k = Math.abs(b[0].value - w.value);
k >= m && (b = [], g.push(b));
}
b.push(w);
}
var C = u + t.minNodeSpacing;
if (!t.avoidOverlap) {
var _ = g.length > 0 && g[0].length > 1, $ = Math.min(i.w, i.h) / 2 - C, O = $ / (g.length + _ ? 1 : 0);
C = Math.min(C, O);
}
for (var F = 0, A = 0; A < g.length; A++) {
var T = g[A], R = t.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / T.length : t.sweep, M = T.dTheta = R / Math.max(1, T.length - 1);
if (T.length > 1 && t.avoidOverlap) {
var j = Math.cos(M) - Math.cos(0), P = Math.sin(M) - Math.sin(0), V = Math.sqrt(C * C / (j * j + P * P));
F = Math.max(V, F);
}
T.r = F, F += C;
}
if (t.equidistant) {
for (var U = 0, G = 0, se = 0; se < g.length; se++) {
var ae = g[se], de = ae.r - G;
U = Math.max(U, de);
}
G = 0;
for (var me = 0; me < g.length; me++) {
var te = g[me];
me === 0 && (G = te.r), te.r = G, G += U;
}
}
for (var oe = {}, ne = 0; ne < g.length; ne++)
for (var ee = g[ne], Z = ee.dTheta, le = ee.r, pe = 0; pe < ee.length; pe++) {
var ke = ee[pe], Ne = t.startAngle + (n ? 1 : -1) * Z * pe, De = {
x: s.x + le * Math.cos(Ne),
y: s.y + le * Math.sin(Ne)
};
oe[ke.node.id()] = De;
}
return o.nodes().layoutPositions(this, t, function(_e) {
var Fe = _e.id();
return oe[Fe];
}), this;
};
var by, c2e = {
// Called on `layoutready`
ready: function() {
},
// Called on `layoutstop`
stop: function() {
},
// Whether to animate while running the layout
// true : Animate continuously as the layout is running
// false : Just show the end result
// 'end' : Animate with the end result, from the initial positions to the end positions
animate: !0,
// Easing of the animation for animate:'end'
animationEasing: void 0,
// The duration of the animation for animate:'end'
animationDuration: void 0,
// 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
animateFilter: function(e, t) {
return !0;
},
// The layout animates only after this many milliseconds for animate:true
// (prevents flashing on fast runs)
animationThreshold: 250,
// Number of iterations between consecutive screen positions update
refresh: 20,
// Whether to fit the network view after when done
fit: !0,
// Padding on fit
padding: 30,
// Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
boundingBox: void 0,
// Excludes the label when calculating node bounding boxes for the layout algorithm
nodeDimensionsIncludeLabels: !1,
// Randomize the initial positions of the nodes (true) or use existing positions (false)
randomize: !1,
// Extra spacing between components in non-compound graphs
componentSpacing: 40,
// Node repulsion (non overlapping) multiplier
nodeRepulsion: function(e) {
return 2048;
},
// Node repulsion (overlapping) multiplier
nodeOverlap: 4,
// Ideal edge (non nested) length
idealEdgeLength: function(e) {
return 32;
},
// Divisor to compute edge forces
edgeElasticity: function(e) {
return 32;
},
// Nesting factor (multiplier) to compute ideal edge length for nested edges
nestingFactor: 1.2,
// Gravity force (constant)
gravity: 1,
// Maximum number of iterations to perform
numIter: 1e3,
// Initial temperature (maximum node displacement)
initialTemp: 1e3,
// Cooling factor (how the temperature is reduced between consecutive iterations
coolingFactor: 0.99,
// Lower temperature threshold (below this point the layout will end)
minTemp: 1
};
function $m(e) {
this.options = _t({}, c2e, e), this.options.layout = this;
var t = this.options.eles.nodes(), n = this.options.eles.edges(), r = n.filter(function(o) {
var a = o.source().data("id"), i = o.target().data("id"), s = t.some(function(u) {
return u.data("id") === a;
}), l = t.some(function(u) {
return u.data("id") === i;
});
return !s || !l;
});
this.options.eles = this.options.eles.not(r);
}
$m.prototype.run = function() {
var e = this.options, t = e.cy, n = this;
n.stopped = !1, (e.animate === !0 || e.animate === !1) && n.emit({
type: "layoutstart",
layout: n
}), e.debug === !0 ? by = !0 : by = !1;
var r = d2e(t, n, e);
by && h2e(r), e.randomize && v2e(r);
var o = ns(), a = function() {
g2e(r, t, e), e.fit === !0 && t.fit(e.padding);
}, i = function(d) {
return !(n.stopped || d >= e.numIter || (m2e(r, e), r.temperature = r.temperature * e.coolingFactor, r.temperature < e.minTemp));
}, s = function() {
if (e.animate === !0 || e.animate === !1)
a(), n.one("layoutstop", e.stop), n.emit({
type: "layoutstop",
layout: n
});
else {
var d = e.eles.nodes(), p = $z(r, e, d);
d.layoutPositions(n, e, p);
}
}, l = 0, u = !0;
if (e.animate === !0) {
var c = function d() {
for (var p = 0; u && p < e.refresh; )
u = i(l), l++, p++;
if (!u)
wF(r, e), s();
else {
var h = ns();
h - o >= e.animationThreshold && a(), Bg(d);
}
};
c();
} else {
for (; u; )
u = i(l), l++;
wF(r, e), s();
}
return this;
};
$m.prototype.stop = function() {
return this.stopped = !0, this.thread && this.thread.stop(), this.emit("layoutstop"), this;
};
$m.prototype.destroy = function() {
return this.thread && this.thread.stop(), this;
};
var d2e = function(e, t, n) {
for (var r = n.eles.edges(), o = n.eles.nodes(), a = Fo(n.boundingBox ? n.boundingBox : {
x1: 0,
y1: 0,
w: e.width(),
h: e.height()
}), i = {
isCompound: e.hasCompoundNodes(),
layoutNodes: [],
idToIndex: {},
nodeSize: o.size(),
graphSet: [],
indexToGraph: [],
layoutEdges: [],
edgeSize: r.size(),
temperature: n.initialTemp,
clientWidth: a.w,
clientHeight: a.h,
boundingBox: a
}, s = n.eles.components(), l = {}, u = 0; u < s.length; u++)
for (var c = s[u], d = 0; d < c.length; d++) {
var p = c[d];
l[p.id()] = u;
}
for (var u = 0; u < i.nodeSize; u++) {
var h = o[u], f = h.layoutDimensions(n), v = {};
v.isLocked = h.locked(), v.id = h.data("id"), v.parentId = h.data("parent"), v.cmptId = l[h.id()], v.children = [], v.positionX = h.position("x"), v.positionY = h.position("y"), v.offsetX = 0, v.offsetY = 0, v.height = f.w, v.width = f.h, v.maxX = v.positionX + v.width / 2, v.minX = v.positionX - v.width / 2, v.maxY = v.positionY + v.height / 2, v.minY = v.positionY - v.height / 2, v.padLeft = parseFloat(h.style("padding")), v.padRight = parseFloat(h.style("padding")), v.padTop = parseFloat(h.style("padding")), v.padBottom = parseFloat(h.style("padding")), v.nodeRepulsion = Nn(n.nodeRepulsion) ? n.nodeRepulsion(h) : n.nodeRepulsion, i.layoutNodes.push(v), i.idToIndex[v.id] = u;
}
for (var m = [], g = 0, b = -1, x = [], u = 0; u < i.nodeSize; u++) {
var h = i.layoutNodes[u], w = h.parentId;
w != null ? i.layoutNodes[i.idToIndex[w]].children.push(h.id) : (m[++b] = h.id, x.push(h.id));
}
for (i.graphSet.push(x); g <= b; ) {
var k = m[g++], C = i.idToIndex[k], p = i.layoutNodes[C], _ = p.children;
if (_.length > 0) {
i.graphSet.push(_);
for (var u = 0; u < _.length; u++)
m[++b] = _[u];
}
}
for (var u = 0; u < i.graphSet.length; u++)
for (var $ = i.graphSet[u], d = 0; d < $.length; d++) {
var O = i.idToIndex[$[d]];
i.indexToGraph[O] = u;
}
for (var u = 0; u < i.edgeSize; u++) {
var F = r[u], A = {};
A.id = F.data("id"), A.sourceId = F.data("source"), A.targetId = F.data("target");
var T = Nn(n.idealEdgeLength) ? n.idealEdgeLength(F) : n.idealEdgeLength, R = Nn(n.edgeElasticity) ? n.edgeElasticity(F) : n.edgeElasticity, M = i.idToIndex[A.sourceId], j = i.idToIndex[A.targetId], P = i.indexToGraph[M], V = i.indexToGraph[j];
if (P != V) {
for (var U = p2e(A.sourceId, A.targetId, i), G = i.graphSet[U], se = 0, v = i.layoutNodes[M]; G.indexOf(v.id) === -1; )
v = i.layoutNodes[i.idToIndex[v.parentId]], se++;
for (v = i.layoutNodes[j]; G.indexOf(v.id) === -1; )
v = i.layoutNodes[i.idToIndex[v.parentId]], se++;
T *= se * n.nestingFactor;
}
A.idealLength = T, A.elasticity = R, i.layoutEdges.push(A);
}
return i;
}, p2e = function(e, t, n) {
var r = f2e(e, t, 0, n);
return 2 > r.count ? 0 : r.graph;
}, f2e = function e(t, n, r, o) {
var a = o.graphSet[r];
if (-1 < a.indexOf(t) && -1 < a.indexOf(n))
return {
count: 2,
graph: r
};
for (var i = 0, s = 0; s < a.length; s++) {
var l = a[s], u = o.idToIndex[l], c = o.layoutNodes[u].children;
if (c.length !== 0) {
var d = o.indexToGraph[o.idToIndex[c[0]]], p = e(t, n, d, o);
if (p.count !== 0)
if (p.count === 1) {
if (i++, i === 2)
break;
} else
return p;
}
}
return {
count: i,
graph: r
};
}, h2e, v2e = function(e, t) {
for (var n = e.clientWidth, r = e.clientHeight, o = 0; o < e.nodeSize; o++) {
var a = e.layoutNodes[o];
a.children.length === 0 && !a.isLocked && (a.positionX = Math.random() * n, a.positionY = Math.random() * r);
}
}, $z = function(e, t, n) {
var r = e.boundingBox, o = {
x1: 1 / 0,
x2: -1 / 0,
y1: 1 / 0,
y2: -1 / 0
};
return t.boundingBox && (n.forEach(function(a) {
var i = e.layoutNodes[e.idToIndex[a.data("id")]];
o.x1 = Math.min(o.x1, i.positionX), o.x2 = Math.max(o.x2, i.positionX), o.y1 = Math.min(o.y1, i.positionY), o.y2 = Math.max(o.y2, i.positionY);
}), o.w = o.x2 - o.x1, o.h = o.y2 - o.y1), function(a, i) {
var s = e.layoutNodes[e.idToIndex[a.data("id")]];
if (t.boundingBox) {
var l = (s.positionX - o.x1) / o.w, u = (s.positionY - o.y1) / o.h;
return {
x: r.x1 + l * r.w,
y: r.y1 + u * r.h
};
} else
return {
x: s.positionX,
y: s.positionY
};
};
}, g2e = function(e, t, n) {
var r = n.layout, o = n.eles.nodes(), a = $z(e, n, o);
o.positions(a), e.ready !== !0 && (e.ready = !0, r.one("layoutready", n.ready), r.emit({
type: "layoutready",
layout: this
}));
}, m2e = function(e, t, n) {
y2e(e, t), x2e(e), k2e(e, t), C2e(e), _2e(e);
}, y2e = function(e, t) {
for (var n = 0; n < e.graphSet.length; n++)
for (var r = e.graphSet[n], o = r.length, a = 0; a < o; a++)
for (var i = e.layoutNodes[e.idToIndex[r[a]]], s = a + 1; s < o; s++) {
var l = e.layoutNodes[e.idToIndex[r[s]]];
b2e(i, l, e, t);
}
}, bF = function(e) {
return -e + 2 * e * Math.random();
}, b2e = function(e, t, n, r) {
var o = e.cmptId, a = t.cmptId;
if (!(o !== a && !n.isCompound)) {
var i = t.positionX - e.positionX, s = t.positionY - e.positionY, l = 1;
i === 0 && s === 0 && (i = bF(l), s = bF(l));
var u = w2e(e, t, i, s);
if (u > 0)
var m = r.nodeOverlap * u, v = Math.sqrt(i * i + s * s), g = m * i / v, b = m * s / v;
else
var c = Kg(e, i, s), d = Kg(t, -1 * i, -1 * s), p = d.x - c.x, h = d.y - c.y, f = p * p + h * h, v = Math.sqrt(f), m = (e.nodeRepulsion + t.nodeRepulsion) / f, g = m * p / v, b = m * h / v;
e.isLocked || (e.offsetX -= g, e.offsetY -= b), t.isLocked || (t.offsetX += g, t.offsetY += b);
}
}, w2e = function(e, t, n, r) {
if (n > 0)
var o = e.maxX - t.minX;
else
var o = t.maxX - e.minX;
if (r > 0)
var a = e.maxY - t.minY;
else
var a = t.maxY - e.minY;
return o >= 0 && a >= 0 ? Math.sqrt(o * o + a * a) : 0;
}, Kg = function(e, t, n) {
var r = e.positionX, o = e.positionY, a = e.height || 1, i = e.width || 1, s = n / t, l = a / i, u = {};
return t === 0 && 0 < n || t === 0 && 0 > n ? (u.x = r, u.y = o + a / 2, u) : 0 < t && -1 * l <= s && s <= l ? (u.x = r + i / 2, u.y = o + i * n / 2 / t, u) : 0 > t && -1 * l <= s && s <= l ? (u.x = r - i / 2, u.y = o - i * n / 2 / t, u) : 0 < n && (s <= -1 * l || s >= l) ? (u.x = r + a * t / 2 / n, u.y = o + a / 2, u) : (0 > n && (s <= -1 * l || s >= l) && (u.x = r - a * t / 2 / n, u.y = o - a / 2), u);
}, x2e = function(e, t) {
for (var n = 0; n < e.edgeSize; n++) {
var r = e.layoutEdges[n], o = e.idToIndex[r.sourceId], a = e.layoutNodes[o], i = e.idToIndex[r.targetId], s = e.layoutNodes[i], l = s.positionX - a.positionX, u = s.positionY - a.positionY;
if (!(l === 0 && u === 0)) {
var c = Kg(a, l, u), d = Kg(s, -1 * l, -1 * u), p = d.x - c.x, h = d.y - c.y, f = Math.sqrt(p * p + h * h), v = Math.pow(r.idealLength - f, 2) / r.elasticity;
if (f !== 0)
var m = v * p / f, g = v * h / f;
else
var m = 0, g = 0;
a.isLocked || (a.offsetX += m, a.offsetY += g), s.isLocked || (s.offsetX -= m, s.offsetY -= g);
}
}
}, k2e = function(e, t) {
if (t.gravity !== 0)
for (var n = 1, r = 0; r < e.graphSet.length; r++) {
var o = e.graphSet[r], a = o.length;
if (r === 0)
var l = e.clientHeight / 2, u = e.clientWidth / 2;
else
var i = e.layoutNodes[e.idToIndex[o[0]]], s = e.layoutNodes[e.idToIndex[i.parentId]], l = s.positionX, u = s.positionY;
for (var c = 0; c < a; c++) {
var d = e.layoutNodes[e.idToIndex[o[c]]];
if (!d.isLocked) {
var p = l - d.positionX, h = u - d.positionY, f = Math.sqrt(p * p + h * h);
if (f > n) {
var v = t.gravity * p / f, m = t.gravity * h / f;
d.offsetX += v, d.offsetY += m;
}
}
}
}
}, C2e = function(e, t) {
var n = [], r = 0, o = -1;
for (n.push.apply(n, e.graphSet[0]), o += e.graphSet[0].length; r <= o; ) {
var a = n[r++], i = e.idToIndex[a], s = e.layoutNodes[i], l = s.children;
if (0 < l.length && !s.isLocked) {
for (var u = s.offsetX, c = s.offsetY, d = 0; d < l.length; d++) {
var p = e.layoutNodes[e.idToIndex[l[d]]];
p.offsetX += u, p.offsetY += c, n[++o] = l[d];
}
s.offsetX = 0, s.offsetY = 0;
}
}
}, _2e = function(e, t) {
for (var n = 0; n < e.nodeSize; n++) {
var r = e.layoutNodes[n];
0 < r.children.length && (r.maxX = void 0, r.minX = void 0, r.maxY = void 0, r.minY = void 0);
}
for (var n = 0; n < e.nodeSize; n++) {
var r = e.layoutNodes[n];
if (!(0 < r.children.length || r.isLocked)) {
var o = S2e(r.offsetX, r.offsetY, e.temperature);
r.positionX += o.x, r.positionY += o.y, r.offsetX = 0, r.offsetY = 0, r.minX = r.positionX - r.width, r.maxX = r.positionX + r.width, r.minY = r.positionY - r.height, r.maxY = r.positionY + r.height, $2e(r, e);
}
}
for (var n = 0; n < e.nodeSize; n++) {
var r = e.layoutNodes[n];
0 < r.children.length && !r.isLocked && (r.positionX = (r.maxX + r.minX) / 2, r.positionY = (r.maxY + r.minY) / 2, r.width = r.maxX - r.minX, r.height = r.maxY - r.minY);
}
}, S2e = function(e, t, n) {
var r = Math.sqrt(e * e + t * t);
if (r > n)
var o = {
x: n * e / r,
y: n * t / r
};
else
var o = {
x: e,
y: t
};
return o;
}, $2e = function e(t, n) {
var r = t.parentId;
if (r != null) {
var o = n.layoutNodes[n.idToIndex[r]], a = !1;
if ((o.maxX == null || t.maxX + o.padRight > o.maxX) && (o.maxX = t.maxX + o.padRight, a = !0), (o.minX == null || t.minX - o.padLeft < o.minX) && (o.minX = t.minX - o.padLeft, a = !0), (o.maxY == null || t.maxY + o.padBottom > o.maxY) && (o.maxY = t.maxY + o.padBottom, a = !0), (o.minY == null || t.minY - o.padTop < o.minY) && (o.minY = t.minY - o.padTop, a = !0), a)
return e(o, n);
}
}, wF = function(e, t) {
for (var n = e.layoutNodes, r = [], o = 0; o < n.length; o++) {
var a = n[o], i = a.cmptId, s = r[i] = r[i] || [];
s.push(a);
}
for (var l = 0, o = 0; o < r.length; o++) {
var u = r[o];
if (u) {
u.x1 = 1 / 0, u.x2 = -1 / 0, u.y1 = 1 / 0, u.y2 = -1 / 0;
for (var c = 0; c < u.length; c++) {
var d = u[c];
u.x1 = Math.min(u.x1, d.positionX - d.width / 2), u.x2 = Math.max(u.x2, d.positionX + d.width / 2), u.y1 = Math.min(u.y1, d.positionY - d.height / 2), u.y2 = Math.max(u.y2, d.positionY + d.height / 2);
}
u.w = u.x2 - u.x1, u.h = u.y2 - u.y1, l += u.w * u.h;
}
}
r.sort(function(g, b) {
return b.w * b.h - g.w * g.h;
});
for (var p = 0, h = 0, f = 0, v = 0, m = Math.sqrt(l) * e.clientWidth / e.clientHeight, o = 0; o < r.length; o++) {
var u = r[o];
if (u) {
for (var c = 0; c < u.length; c++) {
var d = u[c];
d.isLocked || (d.positionX += p - u.x1, d.positionY += h - u.y1);
}
p += u.w + t.componentSpacing, f += u.w + t.componentSpacing, v = Math.max(v, u.h), f > m && (h += v + t.componentSpacing, p = 0, f = 0, v = 0);
}
}
}, E2e = {
fit: !0,
// whether to fit the viewport to the graph
padding: 30,
// padding used on fit
boundingBox: void 0,
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
avoidOverlap: !0,
// prevents node overlap, may overflow boundingBox if not enough space
avoidOverlapPadding: 10,
// extra spacing around nodes when avoidOverlap: true
nodeDimensionsIncludeLabels: !1,
// Excludes the label when calculating node bounding boxes for the layout algorithm
spacingFactor: void 0,
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
condense: !1,
// uses all available space on false, uses minimal space on true
rows: void 0,
// force num of rows in the grid
cols: void 0,
// force num of columns in the grid
position: function(e) {
},
// returns { row, col } for element
sort: void 0,
// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
animate: !1,
// whether to transition the node positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled
animateFilter: function(e, t) {
return !0;
},
// 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
ready: void 0,
// callback on layoutready
stop: void 0,
// callback on layoutstop
transform: function(e, t) {
return t;
}
// transform a given node position. Useful for changing flow direction in discrete layouts
};
function Ez(e) {
this.options = _t({}, E2e, e);
}
Ez.prototype.run = function() {
var e = this.options, t = e, n = e.cy, r = t.eles, o = r.nodes().not(":parent");
t.sort && (o = o.sort(t.sort));
var a = Fo(t.boundingBox ? t.boundingBox : {
x1: 0,
y1: 0,
w: n.width(),
h: n.height()
});
if (a.h === 0 || a.w === 0)
r.nodes().layoutPositions(this, t, function(me) {
return {
x: a.x1,
y: a.y1
};
});
else {
var i = o.size(), s = Math.sqrt(i * a.h / a.w), l = Math.round(s), u = Math.round(a.w / a.h * s), c = function(me) {
if (me == null)
return Math.min(l, u);
var te = Math.min(l, u);
te == l ? l = me : u = me;
}, d = function(me) {
if (me == null)
return Math.max(l, u);
var te = Math.max(l, u);
te == l ? l = me : u = me;
}, p = t.rows, h = t.cols != null ? t.cols : t.columns;
if (p != null && h != null)
l = p, u = h;
else if (p != null && h == null)
l = p, u = Math.ceil(i / l);
else if (p == null && h != null)
u = h, l = Math.ceil(i / u);
else if (u * l > i) {
var f = c(), v = d();
(f - 1) * v >= i ? c(f - 1) : (v - 1) * f >= i && d(v - 1);
} else
for (; u * l < i; ) {
var m = c(), g = d();
(g + 1) * m >= i ? d(g + 1) : c(m + 1);
}
var b = a.w / u, x = a.h / l;
if (t.condense && (b = 0, x = 0), t.avoidOverlap)
for (var w = 0; w < o.length; w++) {
var k = o[w], C = k._private.position;
(C.x == null || C.y == null) && (C.x = 0, C.y = 0);
var _ = k.layoutDimensions(t), $ = t.avoidOverlapPadding, O = _.w + $, F = _.h + $;
b = Math.max(b, O), x = Math.max(x, F);
}
for (var A = {}, T = function(me, te) {
return !!A["c-" + me + "-" + te];
}, R = function(me, te) {
A["c-" + me + "-" + te] = !0;
}, M = 0, j = 0, P = function() {
j++, j >= u && (j = 0, M++);
}, V = {}, U = 0; U < o.length; U++) {
var G = o[U], se = t.position(G);
if (se && (se.row !== void 0 || se.col !== void 0)) {
var ae = {
row: se.row,
col: se.col
};
if (ae.col === void 0)
for (ae.col = 0; T(ae.row, ae.col); )
ae.col++;
else if (ae.row === void 0)
for (ae.row = 0; T(ae.row, ae.col); )
ae.row++;
V[G.id()] = ae, R(ae.row, ae.col);
}
}
var de = function(me, te) {
var oe, ne;
if (me.locked() || me.isParent())
return !1;
var ee = V[me.id()];
if (ee)
oe = ee.col * b + b / 2 + a.x1, ne = ee.row * x + x / 2 + a.y1;
else {
for (; T(M, j); )
P();
oe = j * b + b / 2 + a.x1, ne = M * x + x / 2 + a.y1, R(M, j), P();
}
return {
x: oe,
y: ne
};
};
o.layoutPositions(this, t, de);
}
return this;
};
var O2e = {
ready: function() {
},
// on layoutready
stop: function() {
}
// on layoutstop
};
function F$(e) {
this.options = _t({}, O2e, e);
}
F$.prototype.run = function() {
var e = this.options, t = e.eles, n = this;
return e.cy, n.emit("layoutstart"), t.nodes().positions(function() {
return {
x: 0,
y: 0
};
}), n.one("layoutready", e.ready), n.emit("layoutready"), n.one("layoutstop", e.stop), n.emit("layoutstop"), this;
};
F$.prototype.stop = function() {
return this;
};
var F2e = {
positions: void 0,
// map of (node id) => (position obj); or function(node){ return somPos; }
zoom: void 0,
// the zoom level to set (prob want fit = false if set)
pan: void 0,
// the pan level to set (prob want fit = false if set)
fit: !0,
// whether to fit to viewport
padding: 30,
// padding on fit
spacingFactor: void 0,
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
animate: !1,
// whether to transition the node positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled
animateFilter: function(e, t) {
return !0;
},
// 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
ready: void 0,
// callback on layoutready
stop: void 0,
// callback on layoutstop
transform: function(e, t) {
return t;
}
// transform a given node position. Useful for changing flow direction in discrete layouts
};
function Oz(e) {
this.options = _t({}, F2e, e);
}
Oz.prototype.run = function() {
var e = this.options, t = e.eles, n = t.nodes(), r = Nn(e.positions);
function o(a) {
if (e.positions == null)
return Pme(a.position());
if (r)
return e.positions(a);
var i = e.positions[a._private.data.id];
return i ?? null;
}
return n.layoutPositions(this, e, function(a, i) {
var s = o(a);
return a.locked() || s == null ? !1 : s;
}), this;
};
var T2e = {
fit: !0,
// whether to fit to viewport
padding: 30,
// fit padding
boundingBox: void 0,
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
animate: !1,
// whether to transition the node positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled
animateFilter: function(e, t) {
return !0;
},
// 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
ready: void 0,
// callback on layoutready
stop: void 0,
// callback on layoutstop
transform: function(e, t) {
return t;
}
// transform a given node position. Useful for changing flow direction in discrete layouts
};
function Fz(e) {
this.options = _t({}, T2e, e);
}
Fz.prototype.run = function() {
var e = this.options, t = e.cy, n = e.eles, r = Fo(e.boundingBox ? e.boundingBox : {
x1: 0,
y1: 0,
w: t.width(),
h: t.height()
}), o = function(a, i) {
return {
x: r.x1 + Math.round(Math.random() * r.w),
y: r.y1 + Math.round(Math.random() * r.h)
};
};
return n.nodes().layoutPositions(this, e, o), this;
};
var A2e = [{
name: "breadthfirst",
impl: Cz
}, {
name: "circle",
impl: _z
}, {
name: "concentric",
impl: Sz
}, {
name: "cose",
impl: $m
}, {
name: "grid",
impl: Ez
}, {
name: "null",
impl: F$
}, {
name: "preset",
impl: Oz
}, {
name: "random",
impl: Fz
}];
function Tz(e) {
this.options = e, this.notifications = 0;
}
var xF = function() {
}, kF = function() {
throw new Error("A headless instance can not render images");
};
Tz.prototype = {
recalculateRenderedStyle: xF,
notify: function() {
this.notifications++;
},
init: xF,
isHeadless: function() {
return !0;
},
png: kF,
jpg: kF
};
var T$ = {};
T$.arrowShapeWidth = 0.3;
T$.registerArrowShapes = function() {
var e = this.arrowShapes = {}, t = this, n = function(l, u, c, d, p, h, f) {
var v = p.x - c / 2 - f, m = p.x + c / 2 + f, g = p.y - c / 2 - f, b = p.y + c / 2 + f, x = v <= l && l <= m && g <= u && u <= b;
return x;
}, r = function(l, u, c, d, p) {
var h = l * Math.cos(d) - u * Math.sin(d), f = l * Math.sin(d) + u * Math.cos(d), v = h * c, m = f * c, g = v + p.x, b = m + p.y;
return {
x: g,
y: b
};
}, o = function(l, u, c, d) {
for (var p = [], h = 0; h < l.length; h += 2) {
var f = l[h], v = l[h + 1];
p.push(r(f, v, u, c, d));
}
return p;
}, a = function(l) {
for (var u = [], c = 0; c < l.length; c++) {
var d = l[c];
u.push(d.x, d.y);
}
return u;
}, i = function(l) {
return l.pstyle("width").pfValue * l.pstyle("arrow-scale").pfValue * 2;
}, s = function(l, u) {
gt(u) && (u = e[u]), e[l] = _t({
name: l,
points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3],
collide: function(c, d, p, h, f, v) {
var m = a(o(this.points, p + 2 * v, h, f)), g = ho(c, d, m);
return g;
},
roughCollide: n,
draw: function(c, d, p, h) {
var f = o(this.points, d, p, h);
t.arrowShapeImpl("polygon")(c, f);
},
spacing: function(c) {
return 0;
},
gap: i
}, u);
};
s("none", {
collide: zg,
roughCollide: zg,
draw: v$,
spacing: IO,
gap: IO
}), s("triangle", {
points: [-0.15, -0.3, 0, 0, 0.15, -0.3]
}), s("arrow", "triangle"), s("triangle-backcurve", {
points: e.triangle.points,
controlPoint: [0, -0.15],
roughCollide: n,
draw: function(l, u, c, d, p) {
var h = o(this.points, u, c, d), f = this.controlPoint, v = r(f[0], f[1], u, c, d);
t.arrowShapeImpl(this.name)(l, h, v);
},
gap: function(l) {
return i(l) * 0.8;
}
}), s("triangle-tee", {
points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4],
collide: function(l, u, c, d, p, h, f) {
var v = a(o(this.points, c + 2 * f, d, p)), m = a(o(this.pointsTee, c + 2 * f, d, p)), g = ho(l, u, v) || ho(l, u, m);
return g;
},
draw: function(l, u, c, d, p) {
var h = o(this.points, u, c, d), f = o(this.pointsTee, u, c, d);
t.arrowShapeImpl(this.name)(l, h, f);
}
}), s("circle-triangle", {
radius: 0.15,
pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15],
collide: function(l, u, c, d, p, h, f) {
var v = p, m = Math.pow(v.x - l, 2) + Math.pow(v.y - u, 2) <= Math.pow((c + 2 * f) * this.radius, 2), g = a(o(this.points, c + 2 * f, d, p));
return ho(l, u, g) || m;
},
draw: function(l, u, c, d, p) {
var h = o(this.pointsTr, u, c, d);
t.arrowShapeImpl(this.name)(l, h, d.x, d.y, this.radius * u);
},
spacing: function(l) {
return t.getArrowWidth(l.pstyle("width").pfValue, l.pstyle("arrow-scale").value) * this.radius;
}
}), s("triangle-cross", {
points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0],
baseCrossLinePts: [
-0.15,
-0.4,
// first half of the rectangle
-0.15,
-0.4,
0.15,
-0.4,
// second half of the rectangle
0.15,
-0.4
],
crossLinePts: function(l, u) {
var c = this.baseCrossLinePts.slice(), d = u / l, p = 3, h = 5;
return c[p] = c[p] - d, c[h] = c[h] - d, c;
},
collide: function(l, u, c, d, p, h, f) {
var v = a(o(this.points, c + 2 * f, d, p)), m = a(o(this.crossLinePts(c, h), c + 2 * f, d, p)), g = ho(l, u, v) || ho(l, u, m);
return g;
},
draw: function(l, u, c, d, p) {
var h = o(this.points, u, c, d), f = o(this.crossLinePts(u, p), u, c, d);
t.arrowShapeImpl(this.name)(l, h, f);
}
}), s("vee", {
points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15],
gap: function(l) {
return i(l) * 0.525;
}
}), s("circle", {
radius: 0.15,
collide: function(l, u, c, d, p, h, f) {
var v = p, m = Math.pow(v.x - l, 2) + Math.pow(v.y - u, 2) <= Math.pow((c + 2 * f) * this.radius, 2);
return m;
},
draw: function(l, u, c, d, p) {
t.arrowShapeImpl(this.name)(l, d.x, d.y, this.radius * u);
},
spacing: function(l) {
return t.getArrowWidth(l.pstyle("width").pfValue, l.pstyle("arrow-scale").value) * this.radius;
}
}), s("tee", {
points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0],
spacing: function(l) {
return 1;
},
gap: function(l) {
return 1;
}
}), s("square", {
points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3]
}), s("diamond", {
points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0],
gap: function(l) {
return l.pstyle("width").pfValue * l.pstyle("arrow-scale").value;
}
}), s("chevron", {
points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15],
gap: function(l) {
return 0.95 * l.pstyle("width").pfValue * l.pstyle("arrow-scale").value;
}
});
};
var Mu = {};
Mu.projectIntoViewport = function(e, t) {
var n = this.cy, r = this.findContainerClientCoords(), o = r[0], a = r[1], i = r[4], s = n.pan(), l = n.zoom(), u = ((e - o) / i - s.x) / l, c = ((t - a) / i - s.y) / l;
return [u, c];
};
Mu.findContainerClientCoords = function() {
if (this.containerBB)
return this.containerBB;
var e = this.container, t = e.getBoundingClientRect(), n = this.cy.window().getComputedStyle(e), r = function(m) {
return parseFloat(n.getPropertyValue(m));
}, o = {
left: r("padding-left"),
right: r("padding-right"),
top: r("padding-top"),
bottom: r("padding-bottom")
}, a = {
left: r("border-left-width"),
right: r("border-right-width"),
top: r("border-top-width"),
bottom: r("border-bottom-width")
}, i = e.clientWidth, s = e.clientHeight, l = o.left + o.right, u = o.top + o.bottom, c = a.left + a.right, d = t.width / (i + c), p = i - l, h = s - u, f = t.left + o.left + a.left, v = t.top + o.top + a.top;
return this.containerBB = [f, v, p, h, d];
};
Mu.invalidateContainerClientCoordsCache = function() {
this.containerBB = null;
};
Mu.findNearestElement = function(e, t, n, r) {
return this.findNearestElements(e, t, n, r)[0];
};
Mu.findNearestElements = function(e, t, n, r) {
var o = this, a = this, i = a.getCachedZSortedEles(), s = [], l = a.cy.zoom(), u = a.cy.hasCompoundNodes(), c = (r ? 24 : 8) / l, d = (r ? 8 : 2) / l, p = (r ? 8 : 2) / l, h = 1 / 0, f, v;
n && (i = i.interactive);
function m(_, $) {
if (_.isNode()) {
if (v)
return;
v = _, s.push(_);
}
if (_.isEdge() && ($ == null || $ < h))
if (f) {
if (f.pstyle("z-compound-depth").value === _.pstyle("z-compound-depth").value && f.pstyle("z-compound-depth").value === _.pstyle("z-compound-depth").value) {
for (var O = 0; O < s.length; O++)
if (s[O].isEdge()) {
s[O] = _, f = _, h = $ ?? h;
break;
}
}
} else
s.push(_), f = _, h = $ ?? h;
}
function g(_) {
var $ = _.outerWidth() + 2 * d, O = _.outerHeight() + 2 * d, F = $ / 2, A = O / 2, T = _.position(), R = _.pstyle("corner-radius").value === "auto" ? "auto" : _.pstyle("corner-radius").pfValue, M = _._private.rscratch;
if (T.x - F <= e && e <= T.x + F && T.y - A <= t && t <= T.y + A) {
var j = a.nodeShapes[o.getNodeShape(_)];
if (j.checkPoint(e, t, 0, $, O, T.x, T.y, R, M))
return m(_, 0), !0;
}
}
function b(_) {
var $ = _._private, O = $.rscratch, F = _.pstyle("width").pfValue, A = _.pstyle("arrow-scale").value, T = F / 2 + c, R = T * T, M = T * 2, j = $.source, P = $.target, V;
if (O.edgeType === "segments" || O.edgeType === "straight" || O.edgeType === "haystack") {
for (var U = O.allpts, G = 0; G + 3 < U.length; G += 2)
if (Kme(e, t, U[G], U[G + 1], U[G + 2], U[G + 3], M) && R > (V = Zme(e, t, U[G], U[G + 1], U[G + 2], U[G + 3])))
return m(_, V), !0;
} else if (O.edgeType === "bezier" || O.edgeType === "multibezier" || O.edgeType === "self" || O.edgeType === "compound") {
for (var U = O.allpts, G = 0; G + 5 < O.allpts.length; G += 4)
if (Gme(e, t, U[G], U[G + 1], U[G + 2], U[G + 3], U[G + 4], U[G + 5], M) && R > (V = Xme(e, t, U[G], U[G + 1], U[G + 2], U[G + 3], U[G + 4], U[G + 5])))
return m(_, V), !0;
}
for (var j = j || $.source, P = P || $.target, se = o.getArrowWidth(F, A), ae = [{
name: "source",
x: O.arrowStartX,
y: O.arrowStartY,
angle: O.srcArrowAngle
}, {
name: "target",
x: O.arrowEndX,
y: O.arrowEndY,
angle: O.tgtArrowAngle
}, {
name: "mid-source",
x: O.midX,
y: O.midY,
angle: O.midsrcArrowAngle
}, {
name: "mid-target",
x: O.midX,
y: O.midY,
angle: O.midtgtArrowAngle
}], G = 0; G < ae.length; G++) {
var de = ae[G], me = a.arrowShapes[_.pstyle(de.name + "-arrow-shape").value], te = _.pstyle("width").pfValue;
if (me.roughCollide(e, t, se, de.angle, {
x: de.x,
y: de.y
}, te, c) && me.collide(e, t, se, de.angle, {
x: de.x,
y: de.y
}, te, c))
return m(_), !0;
}
u && s.length > 0 && (g(j), g(P));
}
function x(_, $, O) {
return La(_, $, O);
}
function w(_, $) {
var O = _._private, F = p, A;
$ ? A = $ + "-" : A = "", _.boundingBox();
var T = O.labelBounds[$ || "main"], R = _.pstyle(A + "label").value, M = _.pstyle("text-events").strValue === "yes";
if (!(!M || !R)) {
var j = x(O.rscratch, "labelX", $), P = x(O.rscratch, "labelY", $), V = x(O.rscratch, "labelAngle", $), U = _.pstyle(A + "text-margin-x").pfValue, G = _.pstyle(A + "text-margin-y").pfValue, se = T.x1 - F - U, ae = T.x2 + F - U, de = T.y1 - F - G, me = T.y2 + F - G;
if (V) {
var te = Math.cos(V), oe = Math.sin(V), ne = function(Ne, De) {
return Ne = Ne - j, De = De - P, {
x: Ne * te - De * oe + j,
y: Ne * oe + De * te + P
};
}, ee = ne(se, de), Z = ne(se, me), le = ne(ae, de), pe = ne(ae, me), ke = [
// with the margin added after the rotation is applied
ee.x + U,
ee.y + G,
le.x + U,
le.y + G,
pe.x + U,
pe.y + G,
Z.x + U,
Z.y + G
];
if (ho(e, t, ke))
return m(_), !0;
} else if (Gc(T, e, t))
return m(_), !0;
}
}
for (var k = i.length - 1; k >= 0; k--) {
var C = i[k];
C.isNode() ? g(C) || w(C) : b(C) || w(C) || w(C, "source") || w(C, "target");
}
return s;
};
Mu.getAllInBox = function(e, t, n, r) {
var o = this.getCachedZSortedEles().interactive, a = [], i = Math.min(e, n), s = Math.max(e, n), l = Math.min(t, r), u = Math.max(t, r);
e = i, n = s, t = l, r = u;
for (var c = Fo({
x1: e,
y1: t,
x2: n,
y2: r
}), d = 0; d < o.length; d++) {
var p = o[d];
if (p.isNode()) {
var h = p, f = h.boundingBox({
includeNodes: !0,
includeEdges: !1,
includeLabels: !1
});
y$(c, f) && !BB(f, c) && a.push(h);
} else {
var v = p, m = v._private, g = m.rscratch;
if (g.startX != null && g.startY != null && !Gc(c, g.startX, g.startY) || g.endX != null && g.endY != null && !Gc(c, g.endX, g.endY))
continue;
if (g.edgeType === "bezier" || g.edgeType === "multibezier" || g.edgeType === "self" || g.edgeType === "compound" || g.edgeType === "segments" || g.edgeType === "haystack") {
for (var b = m.rstyle.bezierPts || m.rstyle.linePts || m.rstyle.haystackPts, x = !0, w = 0; w < b.length; w++)
if (!qme(c, b[w])) {
x = !1;
break;
}
x && a.push(v);
} else (g.edgeType === "haystack" || g.edgeType === "straight") && a.push(v);
}
}
return a;
};
var Gg = {};
Gg.calculateArrowAngles = function(e) {
var t = e._private.rscratch, n = t.edgeType === "haystack", r = t.edgeType === "bezier", o = t.edgeType === "multibezier", a = t.edgeType === "segments", i = t.edgeType === "compound", s = t.edgeType === "self", l, u, c, d, p, h, g, b;
if (n ? (c = t.haystackPts[0], d = t.haystackPts[1], p = t.haystackPts[2], h = t.haystackPts[3]) : (c = t.arrowStartX, d = t.arrowStartY, p = t.arrowEndX, h = t.arrowEndY), g = t.midX, b = t.midY, a)
l = c - t.segpts[0], u = d - t.segpts[1];
else if (o || i || s || r) {
var f = t.allpts, v = gr(f[0], f[2], f[4], 0.1), m = gr(f[1], f[3], f[5], 0.1);
l = c - v, u = d - m;
} else
l = c - g, u = d - b;
t.srcArrowAngle = rv(l, u);
var g = t.midX, b = t.midY;
if (n && (g = (c + p) / 2, b = (d + h) / 2), l = p - c, u = h - d, a) {
var f = t.allpts;
if (f.length / 2 % 2 === 0) {
var x = f.length / 2, w = x - 2;
l = f[x] - f[w], u = f[x + 1] - f[w + 1];
} else if (t.isRound)
l = t.midVector[1], u = -t.midVector[0];
else {
var x = f.length / 2 - 1, w = x - 2;
l = f[x] - f[w], u = f[x + 1] - f[w + 1];
}
} else if (o || i || s) {
var f = t.allpts, k = t.ctrlpts, C, _, $, O;
if (k.length / 2 % 2 === 0) {
var F = f.length / 2 - 1, A = F + 2, T = A + 2;
C = gr(f[F], f[A], f[T], 0), _ = gr(f[F + 1], f[A + 1], f[T + 1], 0), $ = gr(f[F], f[A], f[T], 1e-4), O = gr(f[F + 1], f[A + 1], f[T + 1], 1e-4);
} else {
var A = f.length / 2 - 1, F = A - 2, T = A + 2;
C = gr(f[F], f[A], f[T], 0.4999), _ = gr(f[F + 1], f[A + 1], f[T + 1], 0.4999), $ = gr(f[F], f[A], f[T], 0.5), O = gr(f[F + 1], f[A + 1], f[T + 1], 0.5);
}
l = $ - C, u = O - _;
}
if (t.midtgtArrowAngle = rv(l, u), t.midDispX = l, t.midDispY = u, l *= -1, u *= -1, a) {
var f = t.allpts;
if (f.length / 2 % 2 !== 0 && !t.isRound) {
var x = f.length / 2 - 1, R = x + 2;
l = -(f[R] - f[x]), u = -(f[R + 1] - f[x + 1]);
}
}
if (t.midsrcArrowAngle = rv(l, u), a)
l = p - t.segpts[t.segpts.length - 2], u = h - t.segpts[t.segpts.length - 1];
else if (o || i || s || r) {
var f = t.allpts, M = f.length, v = gr(f[M - 6], f[M - 4], f[M - 2], 0.9), m = gr(f[M - 5], f[M - 3], f[M - 1], 0.9);
l = p - v, u = h - m;
} else
l = p - g, u = h - b;
t.tgtArrowAngle = rv(l, u);
};
Gg.getArrowWidth = Gg.getArrowHeight = function(e, t) {
var n = this.arrowWidthCache = this.arrowWidthCache || {}, r = n[e + ", " + t];
return r || (r = Math.max(Math.pow(e * 13.37, 0.9), 29) * t, n[e + ", " + t] = r, r);
};
var YC, XC, ni = {}, Ko = {}, CF, _F, Vl, Qv, Ri, Rl, zl, Qa, sc, pv, Az, Iz, ZC, JC, SF, $F = function(e, t, n) {
n.x = t.x - e.x, n.y = t.y - e.y, n.len = Math.sqrt(n.x * n.x + n.y * n.y), n.nx = n.x / n.len, n.ny = n.y / n.len, n.ang = Math.atan2(n.ny, n.nx);
}, I2e = function(e, t) {
t.x = e.x * -1, t.y = e.y * -1, t.nx = e.nx * -1, t.ny = e.ny * -1, t.ang = e.ang > 0 ? -(Math.PI - e.ang) : Math.PI + e.ang;
}, P2e = function(e, t, n, r, o) {
if (e !== SF ? $F(t, e, ni) : I2e(Ko, ni), $F(t, n, Ko), CF = ni.nx * Ko.ny - ni.ny * Ko.nx, _F = ni.nx * Ko.nx - ni.ny * -Ko.ny, Ri = Math.asin(Math.max(-1, Math.min(1, CF))), Math.abs(Ri) < 1e-6) {
YC = t.x, XC = t.y, zl = sc = 0;
return;
}
Vl = 1, Qv = !1, _F < 0 ? Ri < 0 ? Ri = Math.PI + Ri : (Ri = Math.PI - Ri, Vl = -1, Qv = !0) : Ri > 0 && (Vl = -1, Qv = !0), t.radius !== void 0 ? sc = t.radius : sc = r, Rl = Ri / 2, pv = Math.min(ni.len / 2, Ko.len / 2), o ? (Qa = Math.abs(Math.cos(Rl) * sc / Math.sin(Rl)), Qa > pv ? (Qa = pv, zl = Math.abs(Qa * Math.sin(Rl) / Math.cos(Rl))) : zl = sc) : (Qa = Math.min(pv, sc), zl = Math.abs(Qa * Math.sin(Rl) / Math.cos(Rl))), ZC = t.x + Ko.nx * Qa, JC = t.y + Ko.ny * Qa, YC = ZC - Ko.ny * zl * Vl, XC = JC + Ko.nx * zl * Vl, Az = t.x + ni.nx * Qa, Iz = t.y + ni.ny * Qa, SF = t;
};
function Pz(e, t) {
t.radius === 0 ? e.lineTo(t.cx, t.cy) : e.arc(t.cx, t.cy, t.radius, t.startAngle, t.endAngle, t.counterClockwise);
}
function A$(e, t, n, r) {
var o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0;
return r === 0 || t.radius === 0 ? {
cx: t.x,
cy: t.y,
radius: 0,
startX: t.x,
startY: t.y,
stopX: t.x,
stopY: t.y,
startAngle: void 0,
endAngle: void 0,
counterClockwise: void 0
} : (P2e(e, t, n, r, o), {
cx: YC,
cy: XC,
radius: zl,
startX: Az,
startY: Iz,
stopX: ZC,
stopY: JC,
startAngle: ni.ang + Math.PI / 2 * Vl,
endAngle: Ko.ang - Math.PI / 2 * Vl,
counterClockwise: Qv
});
}
var Qr = {};
Qr.findMidptPtsEtc = function(e, t) {
var n = t.posPts, r = t.intersectionPts, o = t.vectorNormInverse, a, i = e.pstyle("source-endpoint"), s = e.pstyle("target-endpoint"), l = i.units != null && s.units != null, u = function(w, k, C, _) {
var $ = _ - k, O = C - w, F = Math.sqrt(O * O + $ * $);
return {
x: -$ / F,
y: O / F
};
}, c = e.pstyle("edge-distances").value;
switch (c) {
case "node-position":
a = n;
break;
case "intersection":
a = r;
break;
case "endpoints": {
if (l) {
var d = this.manualEndptToPx(e.source()[0], i), p = Ta(d, 2), h = p[0], f = p[1], v = this.manualEndptToPx(e.target()[0], s), m = Ta(v, 2), g = m[0], b = m[1], x = {
x1: h,
y1: f,
x2: g,
y2: b
};
o = u(h, f, g, b), a = x;
} else
sn("Edge ".concat(e.id(), " has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")), a = r;
break;
}
}
return {
midptPts: a,
vectorNormInverse: o
};
};
Qr.findHaystackPoints = function(e) {
for (var t = 0; t < e.length; t++) {
var n = e[t], r = n._private, o = r.rscratch;
if (!o.haystack) {
var a = Math.random() * 2 * Math.PI;
o.source = {
x: Math.cos(a),
y: Math.sin(a)
}, a = Math.random() * 2 * Math.PI, o.target = {
x: Math.cos(a),
y: Math.sin(a)
};
}
var i = r.source, s = r.target, l = i.position(), u = s.position(), c = i.width(), d = s.width(), p = i.height(), h = s.height(), f = n.pstyle("haystack-radius").value, v = f / 2;
o.haystackPts = o.allpts = [o.source.x * c * v + l.x, o.source.y * p * v + l.y, o.target.x * d * v + u.x, o.target.y * h * v + u.y], o.midX = (o.allpts[0] + o.allpts[2]) / 2, o.midY = (o.allpts[1] + o.allpts[3]) / 2, o.edgeType = "haystack", o.haystack = !0, this.storeEdgeProjections(n), this.calculateArrowAngles(n), this.recalculateEdgeLabelProjections(n), this.calculateLabelAngles(n);
}
};
Qr.findSegmentsPoints = function(e, t) {
var n = e._private.rscratch, r = e.pstyle("segment-weights"), o = e.pstyle("segment-distances"), a = e.pstyle("segment-radii"), i = e.pstyle("radius-type"), s = Math.min(r.pfValue.length, o.pfValue.length), l = a.pfValue[a.pfValue.length - 1], u = i.pfValue[i.pfValue.length - 1];
n.edgeType = "segments", n.segpts = [], n.radii = [], n.isArcRadius = [];
for (var c = 0; c < s; c++) {
var d = r.pfValue[c], p = o.pfValue[c], h = 1 - d, f = d, v = this.findMidptPtsEtc(e, t), m = v.midptPts, g = v.vectorNormInverse, b = {
x: m.x1 * h + m.x2 * f,
y: m.y1 * h + m.y2 * f
};
n.segpts.push(b.x + g.x * p, b.y + g.y * p), n.radii.push(a.pfValue[c] !== void 0 ? a.pfValue[c] : l), n.isArcRadius.push((i.pfValue[c] !== void 0 ? i.pfValue[c] : u) === "arc-radius");
}
};
Qr.findLoopPoints = function(e, t, n, r) {
var o = e._private.rscratch, a = t.dirCounts, i = t.srcPos, s = e.pstyle("control-point-distances"), l = s ? s.pfValue[0] : void 0, u = e.pstyle("loop-direction").pfValue, c = e.pstyle("loop-sweep").pfValue, d = e.pstyle("control-point-step-size").pfValue;
o.edgeType = "self";
var p = n, h = d;
r && (p = 0, h = l);
var f = u - Math.PI / 2, v = f - c / 2, m = f + c / 2, g = u + "_" + c;
p = a[g] === void 0 ? a[g] = 0 : ++a[g], o.ctrlpts = [i.x + Math.cos(v) * 1.4 * h * (p / 3 + 1), i.y + Math.sin(v) * 1.4 * h * (p / 3 + 1), i.x + Math.cos(m) * 1.4 * h * (p / 3 + 1), i.y + Math.sin(m) * 1.4 * h * (p / 3 + 1)];
};
Qr.findCompoundLoopPoints = function(e, t, n, r) {
var o = e._private.rscratch;
o.edgeType = "compound";
var a = t.srcPos, i = t.tgtPos, s = t.srcW, l = t.srcH, u = t.tgtW, c = t.tgtH, d = e.pstyle("control-point-step-size").pfValue, p = e.pstyle("control-point-distances"), h = p ? p.pfValue[0] : void 0, f = n, v = d;
r && (f = 0, v = h);
var m = 50, g = {
x: a.x - s / 2,
y: a.y - l / 2
}, b = {
x: i.x - u / 2,
y: i.y - c / 2
}, x = {
x: Math.min(g.x, b.x),
y: Math.min(g.y, b.y)
}, w = 0.5, k = Math.max(w, Math.log(s * 0.01)), C = Math.max(w, Math.log(u * 0.01));
o.ctrlpts = [x.x, x.y - (1 + Math.pow(m, 1.12) / 100) * v * (f / 3 + 1) * k, x.x - (1 + Math.pow(m, 1.12) / 100) * v * (f / 3 + 1) * C, x.y];
};
Qr.findStraightEdgePoints = function(e) {
e._private.rscratch.edgeType = "straight";
};
Qr.findBezierPoints = function(e, t, n, r, o) {
var a = e._private.rscratch, i = e.pstyle("control-point-step-size").pfValue, s = e.pstyle("control-point-distances"), l = e.pstyle("control-point-weights"), u = s && l ? Math.min(s.value.length, l.value.length) : 1, c = s ? s.pfValue[0] : void 0, d = l.value[0], p = r;
a.edgeType = p ? "multibezier" : "bezier", a.ctrlpts = [];
for (var h = 0; h < u; h++) {
var f = (0.5 - t.eles.length / 2 + n) * i * (o ? -1 : 1), v = void 0, m = MB(f);
p && (c = s ? s.pfValue[h] : i, d = l.value[h]), r ? v = c : v = c !== void 0 ? m * c : void 0;
var g = v !== void 0 ? v : f, b = 1 - d, x = d, w = this.findMidptPtsEtc(e, t), k = w.midptPts, C = w.vectorNormInverse, _ = {
x: k.x1 * b + k.x2 * x,
y: k.y1 * b + k.y2 * x
};
a.ctrlpts.push(_.x + C.x * g, _.y + C.y * g);
}
};
Qr.findTaxiPoints = function(e, t) {
var n = e._private.rscratch;
n.edgeType = "segments";
var r = "vertical", o = "horizontal", a = "leftward", i = "rightward", s = "downward", l = "upward", u = "auto", c = t.posPts, d = t.srcW, p = t.srcH, h = t.tgtW, f = t.tgtH, v = e.pstyle("edge-distances").value, m = v !== "node-position", g = e.pstyle("taxi-direction").value, b = g, x = e.pstyle("taxi-turn"), w = x.units === "%", k = x.pfValue, C = k < 0, _ = e.pstyle("taxi-turn-min-distance").pfValue, $ = m ? (d + h) / 2 : 0, O = m ? (p + f) / 2 : 0, F = c.x2 - c.x1, A = c.y2 - c.y1, T = function(lt, rt) {
return lt > 0 ? Math.max(lt - rt, 0) : Math.min(lt + rt, 0);
}, R = T(F, $), M = T(A, O), j = !1;
b === u ? g = Math.abs(R) > Math.abs(M) ? o : r : b === l || b === s ? (g = r, j = !0) : (b === a || b === i) && (g = o, j = !0);
var P = g === r, V = P ? M : R, U = P ? A : F, G = MB(U), se = !1;
!(j && (w || C)) && (b === s && U < 0 || b === l && U > 0 || b === a && U > 0 || b === i && U < 0) && (G *= -1, V = G * Math.abs(V), se = !0);
var ae;
if (w) {
var de = k < 0 ? 1 + k : k;
ae = de * V;
} else {
var me = k < 0 ? V : 0;
ae = me + k * G;
}
var te = function(lt) {
return Math.abs(lt) < _ || Math.abs(lt) >= Math.abs(V);
}, oe = te(ae), ne = te(Math.abs(V) - Math.abs(ae)), ee = oe || ne;
if (ee && !se)
if (P) {
var Z = Math.abs(U) <= p / 2, le = Math.abs(F) <= h / 2;
if (Z) {
var pe = (c.x1 + c.x2) / 2, ke = c.y1, Ne = c.y2;
n.segpts = [pe, ke, pe, Ne];
} else if (le) {
var De = (c.y1 + c.y2) / 2, _e = c.x1, Fe = c.x2;
n.segpts = [_e, De, Fe, De];
} else
n.segpts = [c.x1, c.y2];
} else {
var Ie = Math.abs(U) <= d / 2, Ae = Math.abs(A) <= f / 2;
if (Ie) {
var qe = (c.y1 + c.y2) / 2, et = c.x1, He = c.x2;
n.segpts = [et, qe, He, qe];
} else if (Ae) {
var ot = (c.x1 + c.x2) / 2, tt = c.y1, Qe = c.y2;
n.segpts = [ot, tt, ot, Qe];
} else
n.segpts = [c.x2, c.y1];
}
else if (P) {
var I = c.y1 + ae + (m ? p / 2 * G : 0), Y = c.x1, ve = c.x2;
n.segpts = [Y, I, ve, I];
} else {
var we = c.x1 + ae + (m ? d / 2 * G : 0), ye = c.y1, Pe = c.y2;
n.segpts = [we, ye, we, Pe];
}
if (n.isRound) {
var Ce = e.pstyle("taxi-radius").value, ze = e.pstyle("radius-type").value[0] === "arc-radius";
n.radii = new Array(n.segpts.length / 2).fill(Ce), n.isArcRadius = new Array(n.segpts.length / 2).fill(ze);
}
};
Qr.tryToCorrectInvalidPoints = function(e, t) {
var n = e._private.rscratch;
if (n.edgeType === "bezier") {
var r = t.srcPos, o = t.tgtPos, a = t.srcW, i = t.srcH, s = t.tgtW, l = t.tgtH, u = t.srcShape, c = t.tgtShape, d = t.srcCornerRadius, p = t.tgtCornerRadius, h = t.srcRs, f = t.tgtRs, v = !Ze(n.startX) || !Ze(n.startY), m = !Ze(n.arrowStartX) || !Ze(n.arrowStartY), g = !Ze(n.endX) || !Ze(n.endY), b = !Ze(n.arrowEndX) || !Ze(n.arrowEndY), x = 3, w = this.getArrowWidth(e.pstyle("width").pfValue, e.pstyle("arrow-scale").value) * this.arrowShapeWidth, k = x * w, C = fu({
x: n.ctrlpts[0],
y: n.ctrlpts[1]
}, {
x: n.startX,
y: n.startY
}), _ = C < k, $ = fu({
x: n.ctrlpts[0],
y: n.ctrlpts[1]
}, {
x: n.endX,
y: n.endY
}), O = $ < k, F = !1;
if (v || m || _) {
F = !0;
var A = {
// delta
x: n.ctrlpts[0] - r.x,
y: n.ctrlpts[1] - r.y
}, T = Math.sqrt(A.x * A.x + A.y * A.y), R = {
// normalised delta
x: A.x / T,
y: A.y / T
}, M = Math.max(a, i), j = {
// *2 radius guarantees outside shape
x: n.ctrlpts[0] + R.x * 2 * M,
y: n.ctrlpts[1] + R.y * 2 * M
}, P = u.intersectLine(r.x, r.y, a, i, j.x, j.y, 0, d, h);
_ ? (n.ctrlpts[0] = n.ctrlpts[0] + R.x * (k - C), n.ctrlpts[1] = n.ctrlpts[1] + R.y * (k - C)) : (n.ctrlpts[0] = P[0] + R.x * k, n.ctrlpts[1] = P[1] + R.y * k);
}
if (g || b || O) {
F = !0;
var V = {
// delta
x: n.ctrlpts[0] - o.x,
y: n.ctrlpts[1] - o.y
}, U = Math.sqrt(V.x * V.x + V.y * V.y), G = {
// normalised delta
x: V.x / U,
y: V.y / U
}, se = Math.max(a, i), ae = {
// *2 radius guarantees outside shape
x: n.ctrlpts[0] + G.x * 2 * se,
y: n.ctrlpts[1] + G.y * 2 * se
}, de = c.intersectLine(o.x, o.y, s, l, ae.x, ae.y, 0, p, f);
O ? (n.ctrlpts[0] = n.ctrlpts[0] + G.x * (k - $), n.ctrlpts[1] = n.ctrlpts[1] + G.y * (k - $)) : (n.ctrlpts[0] = de[0] + G.x * k, n.ctrlpts[1] = de[1] + G.y * k);
}
F && this.findEndpoints(e);
}
};
Qr.storeAllpts = function(e) {
var t = e._private.rscratch;
if (t.edgeType === "multibezier" || t.edgeType === "bezier" || t.edgeType === "self" || t.edgeType === "compound") {
t.allpts = [], t.allpts.push(t.startX, t.startY);
for (var n = 0; n + 1 < t.ctrlpts.length; n += 2)
t.allpts.push(t.ctrlpts[n], t.ctrlpts[n + 1]), n + 3 < t.ctrlpts.length && t.allpts.push((t.ctrlpts[n] + t.ctrlpts[n + 2]) / 2, (t.ctrlpts[n + 1] + t.ctrlpts[n + 3]) / 2);
t.allpts.push(t.endX, t.endY);
var r, o;
t.ctrlpts.length / 2 % 2 === 0 ? (r = t.allpts.length / 2 - 1, t.midX = t.allpts[r], t.midY = t.allpts[r + 1]) : (r = t.allpts.length / 2 - 3, o = 0.5, t.midX = gr(t.allpts[r], t.allpts[r + 2], t.allpts[r + 4], o), t.midY = gr(t.allpts[r + 1], t.allpts[r + 3], t.allpts[r + 5], o));
} else if (t.edgeType === "straight")
t.allpts = [t.startX, t.startY, t.endX, t.endY], t.midX = (t.startX + t.endX + t.arrowStartX + t.arrowEndX) / 4, t.midY = (t.startY + t.endY + t.arrowStartY + t.arrowEndY) / 4;
else if (t.edgeType === "segments") {
if (t.allpts = [], t.allpts.push(t.startX, t.startY), t.allpts.push.apply(t.allpts, t.segpts), t.allpts.push(t.endX, t.endY), t.isRound) {
t.roundCorners = [];
for (var a = 2; a + 3 < t.allpts.length; a += 2) {
var i = t.radii[a / 2 - 1], s = t.isArcRadius[a / 2 - 1];
t.roundCorners.push(A$({
x: t.allpts[a - 2],
y: t.allpts[a - 1]
}, {
x: t.allpts[a],
y: t.allpts[a + 1],
radius: i
}, {
x: t.allpts[a + 2],
y: t.allpts[a + 3]
}, i, s));
}
}
if (t.segpts.length % 4 === 0) {
var l = t.segpts.length / 2, u = l - 2;
t.midX = (t.segpts[u] + t.segpts[l]) / 2, t.midY = (t.segpts[u + 1] + t.segpts[l + 1]) / 2;
} else {
var c = t.segpts.length / 2 - 1;
if (!t.isRound)
t.midX = t.segpts[c], t.midY = t.segpts[c + 1];
else {
var d = {
x: t.segpts[c],
y: t.segpts[c + 1]
}, p = t.roundCorners[c / 2], h = [d.x - p.cx, d.y - p.cy], f = p.radius / Math.sqrt(Math.pow(h[0], 2) + Math.pow(h[1], 2));
h = h.map(function(v) {
return v * f;
}), t.midX = p.cx + h[0], t.midY = p.cy + h[1], t.midVector = h;
}
}
}
};
Qr.checkForInvalidEdgeWarning = function(e) {
var t = e[0]._private.rscratch;
t.nodesOverlap || Ze(t.startX) && Ze(t.startY) && Ze(t.endX) && Ze(t.endY) ? t.loggedErr = !1 : t.loggedErr || (t.loggedErr = !0, sn("Edge `" + e.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."));
};
Qr.findEdgeControlPoints = function(e) {
var t = this;
if (!(!e || e.length === 0)) {
for (var n = this, r = n.cy, o = r.hasCompoundNodes(), a = {
map: new ii(),
get: function(C) {
var _ = this.map.get(C[0]);
return _ != null ? _.get(C[1]) : null;
},
set: function(C, _) {
var $ = this.map.get(C[0]);
$ == null && ($ = new ii(), this.map.set(C[0], $)), $.set(C[1], _);
}
}, i = [], s = [], l = 0; l < e.length; l++) {
var u = e[l], c = u._private, d = u.pstyle("curve-style").value;
if (!(u.removed() || !u.takesUpSpace())) {
if (d === "haystack") {
s.push(u);
continue;
}
var p = d === "unbundled-bezier" || d.endsWith("segments") || d === "straight" || d === "straight-triangle" || d.endsWith("taxi"), h = d === "unbundled-bezier" || d === "bezier", f = c.source, v = c.target, m = f.poolIndex(), g = v.poolIndex(), b = [m, g].sort(), x = a.get(b);
x == null && (x = {
eles: []
}, a.set(b, x), i.push(b)), x.eles.push(u), p && (x.hasUnbundled = !0), h && (x.hasBezier = !0);
}
}
for (var w = function(C) {
var _ = i[C], $ = a.get(_), O = void 0;
if (!$.hasUnbundled) {
var F = $.eles[0].parallelEdges().filter(function(ve) {
return ve.isBundledBezier();
});
g$($.eles), F.forEach(function(ve) {
return $.eles.push(ve);
}), $.eles.sort(function(ve, we) {
return ve.poolIndex() - we.poolIndex();
});
}
var A = $.eles[0], T = A.source(), R = A.target();
if (T.poolIndex() > R.poolIndex()) {
var M = T;
T = R, R = M;
}
var j = $.srcPos = T.position(), P = $.tgtPos = R.position(), V = $.srcW = T.outerWidth(), U = $.srcH = T.outerHeight(), G = $.tgtW = R.outerWidth(), se = $.tgtH = R.outerHeight(), ae = $.srcShape = n.nodeShapes[t.getNodeShape(T)], de = $.tgtShape = n.nodeShapes[t.getNodeShape(R)], me = $.srcCornerRadius = T.pstyle("corner-radius").value === "auto" ? "auto" : T.pstyle("corner-radius").pfValue, te = $.tgtCornerRadius = R.pstyle("corner-radius").value === "auto" ? "auto" : R.pstyle("corner-radius").pfValue, oe = $.tgtRs = R._private.rscratch, ne = $.srcRs = T._private.rscratch;
$.dirCounts = {
north: 0,
west: 0,
south: 0,
east: 0,
northwest: 0,
southwest: 0,
northeast: 0,
southeast: 0
};
for (var ee = 0; ee < $.eles.length; ee++) {
var Z = $.eles[ee], le = Z[0]._private.rscratch, pe = Z.pstyle("curve-style").value, ke = pe === "unbundled-bezier" || pe.endsWith("segments") || pe.endsWith("taxi"), Ne = !T.same(Z.source());
if (!$.calculatedIntersection && T !== R && ($.hasBezier || $.hasUnbundled)) {
$.calculatedIntersection = !0;
var De = ae.intersectLine(j.x, j.y, V, U, P.x, P.y, 0, me, ne), _e = $.srcIntn = De, Fe = de.intersectLine(P.x, P.y, G, se, j.x, j.y, 0, te, oe), Ie = $.tgtIntn = Fe, Ae = $.intersectionPts = {
x1: De[0],
x2: Fe[0],
y1: De[1],
y2: Fe[1]
}, qe = $.posPts = {
x1: j.x,
x2: P.x,
y1: j.y,
y2: P.y
}, et = Fe[1] - De[1], He = Fe[0] - De[0], ot = Math.sqrt(He * He + et * et), tt = $.vector = {
x: He,
y: et
}, Qe = $.vectorNorm = {
x: tt.x / ot,
y: tt.y / ot
}, I = {
x: -Qe.y,
y: Qe.x
};
$.nodesOverlap = !Ze(ot) || de.checkPoint(De[0], De[1], 0, G, se, P.x, P.y, te, oe) || ae.checkPoint(Fe[0], Fe[1], 0, V, U, j.x, j.y, me, ne), $.vectorNormInverse = I, O = {
nodesOverlap: $.nodesOverlap,
dirCounts: $.dirCounts,
calculatedIntersection: !0,
hasBezier: $.hasBezier,
hasUnbundled: $.hasUnbundled,
eles: $.eles,
srcPos: P,
tgtPos: j,
srcW: G,
srcH: se,
tgtW: V,
tgtH: U,
srcIntn: Ie,
tgtIntn: _e,
srcShape: de,
tgtShape: ae,
posPts: {
x1: qe.x2,
y1: qe.y2,
x2: qe.x1,
y2: qe.y1
},
intersectionPts: {
x1: Ae.x2,
y1: Ae.y2,
x2: Ae.x1,
y2: Ae.y1
},
vector: {
x: -tt.x,
y: -tt.y
},
vectorNorm: {
x: -Qe.x,
y: -Qe.y
},
vectorNormInverse: {
x: -I.x,
y: -I.y
}
};
}
var Y = Ne ? O : $;
le.nodesOverlap = Y.nodesOverlap, le.srcIntn = Y.srcIntn, le.tgtIntn = Y.tgtIntn, le.isRound = pe.startsWith("round"), o && (T.isParent() || T.isChild() || R.isParent() || R.isChild()) && (T.parents().anySame(R) || R.parents().anySame(T) || T.same(R) && T.isParent()) ? t.findCompoundLoopPoints(Z, Y, ee, ke) : T === R ? t.findLoopPoints(Z, Y, ee, ke) : pe.endsWith("segments") ? t.findSegmentsPoints(Z, Y) : pe.endsWith("taxi") ? t.findTaxiPoints(Z, Y) : pe === "straight" || !ke && $.eles.length % 2 === 1 && ee === Math.floor($.eles.length / 2) ? t.findStraightEdgePoints(Z) : t.findBezierPoints(Z, Y, ee, ke, Ne), t.findEndpoints(Z), t.tryToCorrectInvalidPoints(Z, Y), t.checkForInvalidEdgeWarning(Z), t.storeAllpts(Z), t.storeEdgeProjections(Z), t.calculateArrowAngles(Z), t.recalculateEdgeLabelProjections(Z), t.calculateLabelAngles(Z);
}
}, k = 0; k < i.length; k++)
w(k);
this.findHaystackPoints(s);
}
};
function Lz(e) {
var t = [];
if (e != null) {
for (var n = 0; n < e.length; n += 2) {
var r = e[n], o = e[n + 1];
t.push({
x: r,
y: o
});
}
return t;
}
}
Qr.getSegmentPoints = function(e) {
var t = e[0]._private.rscratch, n = t.edgeType;
if (n === "segments")
return this.recalculateRenderedStyle(e), Lz(t.segpts);
};
Qr.getControlPoints = function(e) {
var t = e[0]._private.rscratch, n = t.edgeType;
if (n === "bezier" || n === "multibezier" || n === "self" || n === "compound")
return this.recalculateRenderedStyle(e), Lz(t.ctrlpts);
};
Qr.getEdgeMidpoint = function(e) {
var t = e[0]._private.rscratch;
return this.recalculateRenderedStyle(e), {
x: t.midX,
y: t.midY
};
};
var ih = {};
ih.manualEndptToPx = function(e, t) {
var n = this, r = e.position(), o = e.outerWidth(), a = e.outerHeight(), i = e._private.rscratch;
if (t.value.length === 2) {
var s = [t.pfValue[0], t.pfValue[1]];
return t.units[0] === "%" && (s[0] = s[0] * o), t.units[1] === "%" && (s[1] = s[1] * a), s[0] += r.x, s[1] += r.y, s;
} else {
var l = t.pfValue[0];
l = -Math.PI / 2 + l;
var u = 2 * Math.max(o, a), c = [r.x + Math.cos(l) * u, r.y + Math.sin(l) * u];
return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x, r.y, o, a, c[0], c[1], 0, e.pstyle("corner-radius").value === "auto" ? "auto" : e.pstyle("corner-radius").pfValue, i);
}
};
ih.findEndpoints = function(e) {
var t = this, n, r = e.source()[0], o = e.target()[0], a = r.position(), i = o.position(), s = e.pstyle("target-arrow-shape").value, l = e.pstyle("source-arrow-shape").value, u = e.pstyle("target-distance-from-node").pfValue, c = e.pstyle("source-distance-from-node").pfValue, d = r._private.rscratch, p = o._private.rscratch, h = e.pstyle("curve-style").value, f = e._private.rscratch, v = f.edgeType, m = h === "taxi", g = v === "self" || v === "compound", b = v === "bezier" || v === "multibezier" || g, x = v !== "bezier", w = v === "straight" || v === "segments", k = v === "segments", C = b || x || w, _ = g || m, $ = e.pstyle("source-endpoint"), O = _ ? "outside-to-node" : $.value, F = r.pstyle("corner-radius").value === "auto" ? "auto" : r.pstyle("corner-radius").pfValue, A = e.pstyle("target-endpoint"), T = _ ? "outside-to-node" : A.value, R = o.pstyle("corner-radius").value === "auto" ? "auto" : o.pstyle("corner-radius").pfValue;
f.srcManEndpt = $, f.tgtManEndpt = A;
var M, j, P, V;
if (b) {
var U = [f.ctrlpts[0], f.ctrlpts[1]], G = x ? [f.ctrlpts[f.ctrlpts.length - 2], f.ctrlpts[f.ctrlpts.length - 1]] : U;
M = G, j = U;
} else if (w) {
var se = k ? f.segpts.slice(0, 2) : [i.x, i.y], ae = k ? f.segpts.slice(f.segpts.length - 2) : [a.x, a.y];
M = ae, j = se;
}
if (T === "inside-to-node")
n = [i.x, i.y];
else if (A.units)
n = this.manualEndptToPx(o, A);
else if (T === "outside-to-line")
n = f.tgtIntn;
else if (T === "outside-to-node" || T === "outside-to-node-or-label" ? P = M : (T === "outside-to-line" || T === "outside-to-line-or-label") && (P = [a.x, a.y]), n = t.nodeShapes[this.getNodeShape(o)].intersectLine(i.x, i.y, o.outerWidth(), o.outerHeight(), P[0], P[1], 0, R, p), T === "outside-to-node-or-label" || T === "outside-to-line-or-label") {
var de = o._private.rscratch, me = de.labelWidth, te = de.labelHeight, oe = de.labelX, ne = de.labelY, ee = me / 2, Z = te / 2, le = o.pstyle("text-valign").value;
le === "top" ? ne -= Z : le === "bottom" && (ne += Z);
var pe = o.pstyle("text-halign").value;
pe === "left" ? oe -= ee : pe === "right" && (oe += ee);
var ke = cf(P[0], P[1], [oe - ee, ne - Z, oe + ee, ne - Z, oe + ee, ne + Z, oe - ee, ne + Z], i.x, i.y);
if (ke.length > 0) {
var Ne = a, De = Dl(Ne, xc(n)), _e = Dl(Ne, xc(ke)), Fe = De;
if (_e < De && (n = ke, Fe = _e), ke.length > 2) {
var Ie = Dl(Ne, {
x: ke[2],
y: ke[3]
});
Ie < Fe && (n = [ke[2], ke[3]]);
}
}
}
var Ae = ov(n, M, t.arrowShapes[s].spacing(e) + u), qe = ov(n, M, t.arrowShapes[s].gap(e) + u);
if (f.endX = qe[0], f.endY = qe[1], f.arrowEndX = Ae[0], f.arrowEndY = Ae[1], O === "inside-to-node")
n = [a.x, a.y];
else if ($.units)
n = this.manualEndptToPx(r, $);
else if (O === "outside-to-line")
n = f.srcIntn;
else if (O === "outside-to-node" || O === "outside-to-node-or-label" ? V = j : (O === "outside-to-line" || O === "outside-to-line-or-label") && (V = [i.x, i.y]), n = t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x, a.y, r.outerWidth(), r.outerHeight(), V[0], V[1], 0, F, d), O === "outside-to-node-or-label" || O === "outside-to-line-or-label") {
var et = r._private.rscratch, He = et.labelWidth, ot = et.labelHeight, tt = et.labelX, Qe = et.labelY, I = He / 2, Y = ot / 2, ve = r.pstyle("text-valign").value;
ve === "top" ? Qe -= Y : ve === "bottom" && (Qe += Y);
var we = r.pstyle("text-halign").value;
we === "left" ? tt -= I : we === "right" && (tt += I);
var ye = cf(V[0], V[1], [tt - I, Qe - Y, tt + I, Qe - Y, tt + I, Qe + Y, tt - I, Qe + Y], a.x, a.y);
if (ye.length > 0) {
var Pe = i, Ce = Dl(Pe, xc(n)), ze = Dl(Pe, xc(ye)), lt = Ce;
if (ze < Ce && (n = [ye[0], ye[1]], lt = ze), ye.length > 2) {
var rt = Dl(Pe, {
x: ye[2],
y: ye[3]
});
rt < lt && (n = [ye[2], ye[3]]);
}
}
}
var fe = ov(n, j, t.arrowShapes[l].spacing(e) + c), Te = ov(n, j, t.arrowShapes[l].gap(e) + c);
f.startX = Te[0], f.startY = Te[1], f.arrowStartX = fe[0], f.arrowStartY = fe[1], C && (!Ze(f.startX) || !Ze(f.startY) || !Ze(f.endX) || !Ze(f.endY) ? f.badLine = !0 : f.badLine = !1);
};
ih.getSourceEndpoint = function(e) {
var t = e[0]._private.rscratch;
switch (this.recalculateRenderedStyle(e), t.edgeType) {
case "haystack":
return {
x: t.haystackPts[0],
y: t.haystackPts[1]
};
default:
return {
x: t.arrowStartX,
y: t.arrowStartY
};
}
};
ih.getTargetEndpoint = function(e) {
var t = e[0]._private.rscratch;
switch (this.recalculateRenderedStyle(e), t.edgeType) {
case "haystack":
return {
x: t.haystackPts[2],
y: t.haystackPts[3]
};
default:
return {
x: t.arrowEndX,
y: t.arrowEndY
};
}
};
var I$ = {};
function L2e(e, t, n) {
for (var r = function(l, u, c, d) {
return gr(l, u, c, d);
}, o = t._private, a = o.rstyle.bezierPts, i = 0; i < e.bezierProjPcts.length; i++) {
var s = e.bezierProjPcts[i];
a.push({
x: r(n[0], n[2], n[4], s),
y: r(n[1], n[3], n[5], s)
});
}
}
I$.storeEdgeProjections = function(e) {
var t = e._private, n = t.rscratch, r = n.edgeType;
if (t.rstyle.bezierPts = null, t.rstyle.linePts = null, t.rstyle.haystackPts = null, r === "multibezier" || r === "bezier" || r === "self" || r === "compound") {
t.rstyle.bezierPts = [];
for (var o = 0; o + 5 < n.allpts.length; o += 4)
L2e(this, e, n.allpts.slice(o, o + 6));
} else if (r === "segments")
for (var a = t.rstyle.linePts = [], o = 0; o + 1 < n.allpts.length; o += 2)
a.push({
x: n.allpts[o],
y: n.allpts[o + 1]
});
else if (r === "haystack") {
var i = n.haystackPts;
t.rstyle.haystackPts = [{
x: i[0],
y: i[1]
}, {
x: i[2],
y: i[3]
}];
}
t.rstyle.arrowWidth = this.getArrowWidth(e.pstyle("width").pfValue, e.pstyle("arrow-scale").value) * this.arrowShapeWidth;
};
I$.recalculateEdgeProjections = function(e) {
this.findEdgeControlPoints(e);
};
var Fi = {};
Fi.recalculateNodeLabelProjection = function(e) {
var t = e.pstyle("label").strValue;
if (!ol(t)) {
var n, r, o = e._private, a = e.width(), i = e.height(), s = e.padding(), l = e.position(), u = e.pstyle("text-halign").strValue, c = e.pstyle("text-valign").strValue, d = o.rscratch, p = o.rstyle;
switch (u) {
case "left":
n = l.x - a / 2 - s;
break;
case "right":
n = l.x + a / 2 + s;
break;
default:
n = l.x;
}
switch (c) {
case "top":
r = l.y - i / 2 - s;
break;
case "bottom":
r = l.y + i / 2 + s;
break;
default:
r = l.y;
}
d.labelX = n, d.labelY = r, p.labelX = n, p.labelY = r, this.calculateLabelAngles(e), this.applyLabelDimensions(e);
}
};
var Rz = function(e, t) {
var n = Math.atan(t / e);
return e === 0 && n < 0 && (n = n * -1), n;
}, Nz = function(e, t) {
var n = t.x - e.x, r = t.y - e.y;
return Rz(n, r);
}, R2e = function(e, t, n, r) {
var o = uf(0, r - 1e-3, 1), a = uf(0, r + 1e-3, 1), i = Sc(e, t, n, o), s = Sc(e, t, n, a);
return Nz(i, s);
};
Fi.recalculateEdgeLabelProjections = function(e) {
var t, n = e._private, r = n.rscratch, o = this, a = {
mid: e.pstyle("label").strValue,
source: e.pstyle("source-label").strValue,
target: e.pstyle("target-label").strValue
};
if (a.mid || a.source || a.target) {
t = {
x: r.midX,
y: r.midY
};
var i = function(c, d, p) {
zs(n.rscratch, c, d, p), zs(n.rstyle, c, d, p);
};
i("labelX", null, t.x), i("labelY", null, t.y);
var s = Rz(r.midDispX, r.midDispY);
i("labelAutoAngle", null, s);
var l = function c() {
if (c.cache)
return c.cache;
for (var d = [], p = 0; p + 5 < r.allpts.length; p += 4) {
var h = {
x: r.allpts[p],
y: r.allpts[p + 1]
}, f = {
x: r.allpts[p + 2],
y: r.allpts[p + 3]
}, v = {
x: r.allpts[p + 4],
y: r.allpts[p + 5]
};
d.push({
p0: h,
p1: f,
p2: v,
startDist: 0,
length: 0,
segments: []
});
}
var m = n.rstyle.bezierPts, g = o.bezierProjPcts.length;
function b(_, $, O, F, A) {
var T = fu($, O), R = _.segments[_.segments.length - 1], M = {
p0: $,
p1: O,
t0: F,
t1: A,
startDist: R ? R.startDist + R.length : 0,
length: T
};
_.segments.push(M), _.length += T;
}
for (var x = 0; x < d.length; x++) {
var w = d[x], k = d[x - 1];
k && (w.startDist = k.startDist + k.length), b(w, w.p0, m[x * g], 0, o.bezierProjPcts[0]);
for (var C = 0; C < g - 1; C++)
b(w, m[x * g + C], m[x * g + C + 1], o.bezierProjPcts[C], o.bezierProjPcts[C + 1]);
b(w, m[x * g + g - 1], w.p2, o.bezierProjPcts[g - 1], 1);
}
return c.cache = d;
}, u = function(c) {
var d, p = c === "source";
if (a[c]) {
var h = e.pstyle(c + "-text-offset").pfValue;
switch (r.edgeType) {
case "self":
case "compound":
case "bezier":
case "multibezier": {
for (var f = l(), v, m = 0, g = 0, b = 0; b < f.length; b++) {
for (var x = f[p ? b : f.length - 1 - b], w = 0; w < x.segments.length; w++) {
var k = x.segments[p ? w : x.segments.length - 1 - w], C = b === f.length - 1 && w === x.segments.length - 1;
if (m = g, g += k.length, g >= h || C) {
v = {
cp: x,
segment: k
};
break;
}
}
if (v)
break;
}
var _ = v.cp, $ = v.segment, O = (h - m) / $.length, F = $.t1 - $.t0, A = p ? $.t0 + F * O : $.t1 - F * O;
A = uf(0, A, 1), t = Sc(_.p0, _.p1, _.p2, A), d = R2e(_.p0, _.p1, _.p2, A);
break;
}
case "straight":
case "segments":
case "haystack": {
for (var T = 0, R, M, j, P, V = r.allpts.length, U = 0; U + 3 < V && (p ? (j = {
x: r.allpts[U],
y: r.allpts[U + 1]
}, P = {
x: r.allpts[U + 2],
y: r.allpts[U + 3]
}) : (j = {
x: r.allpts[V - 2 - U],
y: r.allpts[V - 1 - U]
}, P = {
x: r.allpts[V - 4 - U],
y: r.allpts[V - 3 - U]
}), R = fu(j, P), M = T, T += R, !(T >= h)); U += 2)
;
var G = h - M, se = G / R;
se = uf(0, se, 1), t = zme(j, P, se), d = Nz(j, P);
break;
}
}
i("labelX", c, t.x), i("labelY", c, t.y), i("labelAutoAngle", c, d);
}
};
u("source"), u("target"), this.applyLabelDimensions(e);
}
};
Fi.applyLabelDimensions = function(e) {
this.applyPrefixedLabelDimensions(e), e.isEdge() && (this.applyPrefixedLabelDimensions(e, "source"), this.applyPrefixedLabelDimensions(e, "target"));
};
Fi.applyPrefixedLabelDimensions = function(e, t) {
var n = e._private, r = this.getLabelText(e, t), o = this.calculateLabelDimensions(e, r), a = e.pstyle("line-height").pfValue, i = e.pstyle("text-wrap").strValue, s = La(n.rscratch, "labelWrapCachedLines", t) || [], l = i !== "wrap" ? 1 : Math.max(s.length, 1), u = o.height / l, c = u * a, d = o.width, p = o.height + (l - 1) * (a - 1) * u;
zs(n.rstyle, "labelWidth", t, d), zs(n.rscratch, "labelWidth", t, d), zs(n.rstyle, "labelHeight", t, p), zs(n.rscratch, "labelHeight", t, p), zs(n.rscratch, "labelLineHeight", t, c);
};
Fi.getLabelText = function(e, t) {
var n = e._private, r = t ? t + "-" : "", o = e.pstyle(r + "label").strValue, a = e.pstyle("text-transform").value, i = function(de, me) {
return me ? (zs(n.rscratch, de, t, me), me) : La(n.rscratch, de, t);
};
if (!o)
return "";
a == "none" || (a == "uppercase" ? o = o.toUpperCase() : a == "lowercase" && (o = o.toLowerCase()));
var s = e.pstyle("text-wrap").value;
if (s === "wrap") {
var l = i("labelKey");
if (l != null && i("labelWrapKey") === l)
return i("labelWrapCachedText");
for (var u = "", c = o.split(`
`), d = e.pstyle("text-max-width").pfValue, p = e.pstyle("text-overflow-wrap").value, h = p === "anywhere", f = [], v = /[\s\u200b]+|$/g, m = 0; m < c.length; m++) {
var g = c[m], b = this.calculateLabelDimensions(e, g), x = b.width;
if (h) {
var w = g.split("").join(u);
g = w;
}
if (x > d) {
var k = g.matchAll(v), C = "", _ = 0, $ = yB(k), O;
try {
for ($.s(); !(O = $.n()).done; ) {
var F = O.value, A = F[0], T = g.substring(_, F.index);
_ = F.index + A.length;
var R = C.length === 0 ? T : C + T + A, M = this.calculateLabelDimensions(e, R), j = M.width;
j <= d ? C += T + A : (C && f.push(C), C = T + A);
}
} catch (de) {
$.e(de);
} finally {
$.f();
}
C.match(/^[\s\u200b]+$/) || f.push(C);
} else
f.push(g);
}
i("labelWrapCachedLines", f), o = i("labelWrapCachedText", f.join(`
`)), i("labelWrapKey", l);
} else if (s === "ellipsis") {
var P = e.pstyle("text-max-width").pfValue, V = "", U = "…", G = !1;
if (this.calculateLabelDimensions(e, o).width < P)
return o;
for (var se = 0; se < o.length; se++) {
var ae = this.calculateLabelDimensions(e, V + o[se] + U).width;
if (ae > P)
break;
V += o[se], se === o.length - 1 && (G = !0);
}
return G || (V += U), V;
}
return o;
};
Fi.getLabelJustification = function(e) {
var t = e.pstyle("text-justification").strValue, n = e.pstyle("text-halign").strValue;
if (t === "auto")
if (e.isNode())
switch (n) {
case "left":
return "right";
case "right":
return "left";
default:
return "center";
}
else
return "center";
else
return t;
};
Fi.calculateLabelDimensions = function(e, t) {
var n = this, r = n.cy.window(), o = r.document, a = pu(t, e._private.labelDimsKey), i = n.labelDimCache || (n.labelDimCache = []), s = i[a];
if (s != null)
return s;
var l = 0, u = e.pstyle("font-style").strValue, c = e.pstyle("font-size").pfValue, d = e.pstyle("font-family").strValue, p = e.pstyle("font-weight").strValue, h = this.labelCalcCanvas, f = this.labelCalcCanvasContext;
if (!h) {
h = this.labelCalcCanvas = o.createElement("canvas"), f = this.labelCalcCanvasContext = h.getContext("2d");
var v = h.style;
v.position = "absolute", v.left = "-9999px", v.top = "-9999px", v.zIndex = "-1", v.visibility = "hidden", v.pointerEvents = "none";
}
f.font = "".concat(u, " ").concat(p, " ").concat(c, "px ").concat(d);
for (var m = 0, g = 0, b = t.split(`
`), x = 0; x < b.length; x++) {
var w = b[x], k = f.measureText(w), C = Math.ceil(k.width), _ = c;
m = Math.max(C, m), g += _;
}
return m += l, g += l, i[a] = {
width: m,
height: g
};
};
Fi.calculateLabelAngle = function(e, t) {
var n = e._private, r = n.rscratch, o = e.isEdge(), a = t ? t + "-" : "", i = e.pstyle(a + "text-rotation"), s = i.strValue;
return s === "none" ? 0 : o && s === "autorotate" ? r.labelAutoAngle : s === "autorotate" ? 0 : i.pfValue;
};
Fi.calculateLabelAngles = function(e) {
var t = this, n = e.isEdge(), r = e._private, o = r.rscratch;
o.labelAngle = t.calculateLabelAngle(e), n && (o.sourceLabelAngle = t.calculateLabelAngle(e, "source"), o.targetLabelAngle = t.calculateLabelAngle(e, "target"));
};
var Mz = {}, EF = 28, OF = !1;
Mz.getNodeShape = function(e) {
var t = this, n = e.pstyle("shape").value;
if (n === "cutrectangle" && (e.width() < EF || e.height() < EF))
return OF || (sn("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"), OF = !0), "rectangle";
if (e.isParent())
return n === "rectangle" || n === "roundrectangle" || n === "round-rectangle" || n === "cutrectangle" || n === "cut-rectangle" || n === "barrel" ? n : "rectangle";
if (n === "polygon") {
var r = e.pstyle("shape-polygon-points").value;
return t.nodeShapes.makePolygon(r).name;
}
return n;
};
var Em = {};
Em.registerCalculationListeners = function() {
var e = this.cy, t = e.collection(), n = this, r = function(a) {
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0;
if (t.merge(a), i)
for (var s = 0; s < a.length; s++) {
var l = a[s], u = l._private, c = u.rstyle;
c.clean = !1, c.cleanConnected = !1;
}
};
n.binder(e).on("bounds.* dirty.*", function(a) {
var i = a.target;
r(i);
}).on("style.* background.*", function(a) {
var i = a.target;
r(i, !1);
});
var o = function(a) {
if (a) {
var i = n.onUpdateEleCalcsFns;
t.cleanStyle();
for (var s = 0; s < t.length; s++) {
var l = t[s], u = l._private.rstyle;
l.isNode() && !u.cleanConnected && (r(l.connectedEdges()), u.cleanConnected = !0);
}
if (i)
for (var c = 0; c < i.length; c++) {
var d = i[c];
d(a, t);
}
n.recalculateRenderedStyle(t), t = e.collection();
}
};
n.flushRenderedStyleQueue = function() {
o(!0);
}, n.beforeRender(o, n.beforeRenderPriorities.eleCalcs);
};
Em.onUpdateEleCalcs = function(e) {
var t = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || [];
t.push(e);
};
Em.recalculateRenderedStyle = function(e, t) {
var n = function(x) {
return x._private.rstyle.cleanConnected;
}, r = [], o = [];
if (!this.destroyed) {
t === void 0 && (t = !0);
for (var a = 0; a < e.length; a++) {
var i = e[a], s = i._private, l = s.rstyle;
i.isEdge() && (!n(i.source()) || !n(i.target())) && (l.clean = !1), !(t && l.clean || i.removed()) && i.pstyle("display").value !== "none" && (s.group === "nodes" ? o.push(i) : r.push(i), l.clean = !0);
}
for (var u = 0; u < o.length; u++) {
var c = o[u], d = c._private, p = d.rstyle, h = c.position();
this.recalculateNodeLabelProjection(c), p.nodeX = h.x, p.nodeY = h.y, p.nodeW = c.pstyle("width").pfValue, p.nodeH = c.pstyle("height").pfValue;
}
this.recalculateEdgeProjections(r);
for (var f = 0; f < r.length; f++) {
var v = r[f], m = v._private, g = m.rstyle, b = m.rscratch;
g.srcX = b.arrowStartX, g.srcY = b.arrowStartY, g.tgtX = b.arrowEndX, g.tgtY = b.arrowEndY, g.midX = b.midX, g.midY = b.midY, g.labelAngle = b.labelAngle, g.sourceLabelAngle = b.sourceLabelAngle, g.targetLabelAngle = b.targetLabelAngle;
}
}
};
var Om = {};
Om.updateCachedGrabbedEles = function() {
var e = this.cachedZSortedEles;
if (e) {
e.drag = [], e.nondrag = [];
for (var t = [], n = 0; n < e.length; n++) {
var r = e[n], o = r._private.rscratch;
r.grabbed() && !r.isParent() ? t.push(r) : o.inDragLayer ? e.drag.push(r) : e.nondrag.push(r);
}
for (var n = 0; n < t.length; n++) {
var r = t[n];
e.drag.push(r);
}
}
};
Om.invalidateCachedZSortedEles = function() {
this.cachedZSortedEles = null;
};
Om.getCachedZSortedEles = function(e) {
if (e || !this.cachedZSortedEles) {
var t = this.cy.mutableElements().toArray();
t.sort(wz), t.interactive = t.filter(function(n) {
return n.interactive();
}), this.cachedZSortedEles = t, this.updateCachedGrabbedEles();
} else
t = this.cachedZSortedEles;
return t;
};
var Dz = {};
[Mu, Gg, Qr, ih, I$, Fi, Mz, Em, Om].forEach(function(e) {
_t(Dz, e);
});
var Bz = {};
Bz.getCachedImage = function(e, t, n) {
var r = this, o = r.imageCache = r.imageCache || {}, a = o[e];
if (a)
return a.image.complete || a.image.addEventListener("load", n), a.image;
a = o[e] = o[e] || {};
var i = a.image = new Image();
i.addEventListener("load", n), i.addEventListener("error", function() {
i.error = !0;
});
var s = "data:", l = e.substring(0, s.length).toLowerCase() === s;
return l || (t = t === "null" ? null : t, i.crossOrigin = t), i.src = e, i;
};
var Cd = {};
Cd.registerBinding = function(e, t, n, r) {
var o = Array.prototype.slice.apply(arguments, [1]), a = this.binder(e);
return a.on.apply(a, o);
};
Cd.binder = function(e) {
var t = this, n = t.cy.window(), r = e === n || e === n.document || e === n.document.body || i0e(e);
if (t.supportsPassiveEvents == null) {
var o = !1;
try {
var a = Object.defineProperty({}, "passive", {
get: function() {
return o = !0, !0;
}
});
n.addEventListener("test", null, a);
} catch {
}
t.supportsPassiveEvents = o;
}
var i = function(s, l, u) {
var c = Array.prototype.slice.call(arguments);
return r && t.supportsPassiveEvents && (c[2] = {
capture: u ?? !1,
passive: !1,
once: !1
}), t.bindings.push({
target: e,
args: c
}), (e.addEventListener || e.on).apply(e, c), this;
};
return {
on: i,
addEventListener: i,
addListener: i,
bind: i
};
};
Cd.nodeIsDraggable = function(e) {
return e && e.isNode() && !e.locked() && e.grabbable();
};
Cd.nodeIsGrabbable = function(e) {
return this.nodeIsDraggable(e) && e.interactive();
};
Cd.load = function() {
var e = this, t = e.cy.window(), n = function(I) {
return I.selected();
}, r = function(I, Y, ve, we) {
I == null && (I = e.cy);
for (var ye = 0; ye < Y.length; ye++) {
var Pe = Y[ye];
I.emit({
originalEvent: ve,
type: Pe,
position: we
});
}
}, o = function(I) {
return I.shiftKey || I.metaKey || I.ctrlKey;
}, a = function(I, Y) {
var ve = !0;
if (e.cy.hasCompoundNodes() && I && I.pannable())
for (var we = 0; Y && we < Y.length; we++) {
var I = Y[we];
if (I.isNode() && I.isParent() && !I.pannable()) {
ve = !1;
break;
}
}
else
ve = !0;
return ve;
}, i = function(I) {
I[0]._private.grabbed = !0;
}, s = function(I) {
I[0]._private.grabbed = !1;
}, l = function(I) {
I[0]._private.rscratch.inDragLayer = !0;
}, u = function(I) {
I[0]._private.rscratch.inDragLayer = !1;
}, c = function(I) {
I[0]._private.rscratch.isGrabTarget = !0;
}, d = function(I) {
I[0]._private.rscratch.isGrabTarget = !1;
}, p = function(I, Y) {
var ve = Y.addToList, we = ve.has(I);
!we && I.grabbable() && !I.locked() && (ve.merge(I), i(I));
}, h = function(I, Y) {
if (I.cy().hasCompoundNodes() && !(Y.inDragLayer == null && Y.addToList == null)) {
var ve = I.descendants();
Y.inDragLayer && (ve.forEach(l), ve.connectedEdges().forEach(l)), Y.addToList && p(ve, Y);
}
}, f = function(I, Y) {
Y = Y || {};
var ve = I.cy().hasCompoundNodes();
Y.inDragLayer && (I.forEach(l), I.neighborhood().stdFilter(function(we) {
return !ve || we.isEdge();
}).forEach(l)), Y.addToList && I.forEach(function(we) {
p(we, Y);
}), h(I, Y), g(I, {
inDragLayer: Y.inDragLayer
}), e.updateCachedGrabbedEles();
}, v = f, m = function(I) {
I && (e.getCachedZSortedEles().forEach(function(Y) {
s(Y), u(Y), d(Y);
}), e.updateCachedGrabbedEles());
}, g = function(I, Y) {
if (!(Y.inDragLayer == null && Y.addToList == null) && I.cy().hasCompoundNodes()) {
var ve = I.ancestors().orphans();
if (!ve.same(I)) {
var we = ve.descendants().spawnSelf().merge(ve).unmerge(I).unmerge(I.descendants()), ye = we.connectedEdges();
Y.inDragLayer && (ye.forEach(l), we.forEach(l)), Y.addToList && we.forEach(function(Pe) {
p(Pe, Y);
});
}
}
}, b = function() {
document.activeElement != null && document.activeElement.blur != null && document.activeElement.blur();
}, x = typeof MutationObserver < "u", w = typeof ResizeObserver < "u";
x ? (e.removeObserver = new MutationObserver(function(I) {
for (var Y = 0; Y < I.length; Y++) {
var ve = I[Y], we = ve.removedNodes;
if (we)
for (var ye = 0; ye < we.length; ye++) {
var Pe = we[ye];
if (Pe === e.container) {
e.destroy();
break;
}
}
}
}), e.container.parentNode && e.removeObserver.observe(e.container.parentNode, {
childList: !0
})) : e.registerBinding(e.container, "DOMNodeRemoved", function(I) {
e.destroy();
});
var k = fm(function() {
e.cy.resize();
}, 100);
x && (e.styleObserver = new MutationObserver(k), e.styleObserver.observe(e.container, {
attributes: !0
})), e.registerBinding(t, "resize", k), w && (e.resizeObserver = new ResizeObserver(k), e.resizeObserver.observe(e.container));
var C = function(I, Y) {
for (; I != null; )
Y(I), I = I.parentNode;
}, _ = function() {
e.invalidateContainerClientCoordsCache();
};
C(e.container, function(I) {
e.registerBinding(I, "transitionend", _), e.registerBinding(I, "animationend", _), e.registerBinding(I, "scroll", _);
}), e.registerBinding(e.container, "contextmenu", function(I) {
I.preventDefault();
});
var $ = function() {
return e.selection[4] !== 0;
}, O = function(I) {
for (var Y = e.findContainerClientCoords(), ve = Y[0], we = Y[1], ye = Y[2], Pe = Y[3], Ce = I.touches ? I.touches : [I], ze = !1, lt = 0; lt < Ce.length; lt++) {
var rt = Ce[lt];
if (ve <= rt.clientX && rt.clientX <= ve + ye && we <= rt.clientY && rt.clientY <= we + Pe) {
ze = !0;
break;
}
}
if (!ze)
return !1;
for (var fe = e.container, Te = I.target, Se = Te.parentNode, Ue = !1; Se; ) {
if (Se === fe) {
Ue = !0;
break;
}
Se = Se.parentNode;
}
return !!Ue;
};
e.registerBinding(e.container, "mousedown", function(I) {
if (O(I) && !(e.hoverData.which === 1 && I.which !== 1)) {
I.preventDefault(), b(), e.hoverData.capture = !0, e.hoverData.which = I.which;
var Y = e.cy, ve = [I.clientX, I.clientY], we = e.projectIntoViewport(ve[0], ve[1]), ye = e.selection, Pe = e.findNearestElements(we[0], we[1], !0, !1), Ce = Pe[0], ze = e.dragData.possibleDragElements;
e.hoverData.mdownPos = we, e.hoverData.mdownGPos = ve;
var lt = function() {
e.hoverData.tapholdCancelled = !1, clearTimeout(e.hoverData.tapholdTimeout), e.hoverData.tapholdTimeout = setTimeout(function() {
if (!e.hoverData.tapholdCancelled) {
var Ue = e.hoverData.down;
Ue ? Ue.emit({
originalEvent: I,
type: "taphold",
position: {
x: we[0],
y: we[1]
}
}) : Y.emit({
originalEvent: I,
type: "taphold",
position: {
x: we[0],
y: we[1]
}
});
}
}, e.tapholdDuration);
};
if (I.which == 3) {
e.hoverData.cxtStarted = !0;
var rt = {
originalEvent: I,
type: "cxttapstart",
position: {
x: we[0],
y: we[1]
}
};
Ce ? (Ce.activate(), Ce.emit(rt), e.hoverData.down = Ce) : Y.emit(rt), e.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(), e.hoverData.cxtDragged = !1;
} else if (I.which == 1) {
Ce && Ce.activate();
{
if (Ce != null && e.nodeIsGrabbable(Ce)) {
var fe = function(Ue) {
return {
originalEvent: I,
type: Ue,
position: {
x: we[0],
y: we[1]
}
};
}, Te = function(Ue) {
Ue.emit(fe("grab"));
};
if (c(Ce), !Ce.selected())
ze = e.dragData.possibleDragElements = Y.collection(), v(Ce, {
addToList: ze
}), Ce.emit(fe("grabon")).emit(fe("grab"));
else {
ze = e.dragData.possibleDragElements = Y.collection();
var Se = Y.$(function(Ue) {
return Ue.isNode() && Ue.selected() && e.nodeIsGrabbable(Ue);
});
f(Se, {
addToList: ze
}), Ce.emit(fe("grabon")), Se.forEach(Te);
}
e.redrawHint("eles", !0), e.redrawHint("drag", !0);
}
e.hoverData.down = Ce, e.hoverData.downs = Pe, e.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime();
}
r(Ce, ["mousedown", "tapstart", "vmousedown"], I, {
x: we[0],
y: we[1]
}), Ce == null ? (ye[4] = 1, e.data.bgActivePosistion = {
x: we[0],
y: we[1]
}, e.redrawHint("select", !0), e.redraw()) : Ce.pannable() && (ye[4] = 1), lt();
}
ye[0] = ye[2] = we[0], ye[1] = ye[3] = we[1];
}
}, !1), e.registerBinding(t, "mousemove", function(I) {
var Y = e.hoverData.capture;
if (!(!Y && !O(I))) {
var ve = !1, we = e.cy, ye = we.zoom(), Pe = [I.clientX, I.clientY], Ce = e.projectIntoViewport(Pe[0], Pe[1]), ze = e.hoverData.mdownPos, lt = e.hoverData.mdownGPos, rt = e.selection, fe = null;
!e.hoverData.draggingEles && !e.hoverData.dragging && !e.hoverData.selecting && (fe = e.findNearestElement(Ce[0], Ce[1], !0, !1));
var Te = e.hoverData.last, Se = e.hoverData.down, Ue = [Ce[0] - rt[2], Ce[1] - rt[3]], zt = e.dragData.possibleDragElements, Pt;
if (lt) {
var qt = Pe[0] - lt[0], Ht = qt * qt, tn = Pe[1] - lt[1], Dn = tn * tn, hn = Ht + Dn;
e.hoverData.isOverThresholdDrag = Pt = hn >= e.desktopTapThreshold2;
}
var vn = o(I);
Pt && (e.hoverData.tapholdCancelled = !0);
var Pn = function() {
var vr = e.hoverData.dragDelta = e.hoverData.dragDelta || [];
vr.length === 0 ? (vr.push(Ue[0]), vr.push(Ue[1])) : (vr[0] += Ue[0], vr[1] += Ue[1]);
};
ve = !0, r(fe, ["mousemove", "vmousemove", "tapdrag"], I, {
x: Ce[0],
y: Ce[1]
});
var Bn = function() {
e.data.bgActivePosistion = void 0, e.hoverData.selecting || we.emit({
originalEvent: I,
type: "boxstart",
position: {
x: Ce[0],
y: Ce[1]
}
}), rt[4] = 1, e.hoverData.selecting = !0, e.redrawHint("select", !0), e.redraw();
};
if (e.hoverData.which === 3) {
if (Pt) {
var Cn = {
originalEvent: I,
type: "cxtdrag",
position: {
x: Ce[0],
y: Ce[1]
}
};
Se ? Se.emit(Cn) : we.emit(Cn), e.hoverData.cxtDragged = !0, (!e.hoverData.cxtOver || fe !== e.hoverData.cxtOver) && (e.hoverData.cxtOver && e.hoverData.cxtOver.emit({
originalEvent: I,
type: "cxtdragout",
position: {
x: Ce[0],
y: Ce[1]
}
}), e.hoverData.cxtOver = fe, fe && fe.emit({
originalEvent: I,
type: "cxtdragover",
position: {
x: Ce[0],
y: Ce[1]
}
}));
}
} else if (e.hoverData.dragging) {
if (ve = !0, we.panningEnabled() && we.userPanningEnabled()) {
var hr;
if (e.hoverData.justStartedPan) {
var or = e.hoverData.mdownPos;
hr = {
x: (Ce[0] - or[0]) * ye,
y: (Ce[1] - or[1]) * ye
}, e.hoverData.justStartedPan = !1;
} else
hr = {
x: Ue[0] * ye,
y: Ue[1] * ye
};
we.panBy(hr), we.emit("dragpan"), e.hoverData.dragged = !0;
}
Ce = e.projectIntoViewport(I.clientX, I.clientY);
} else if (rt[4] == 1 && (Se == null || Se.pannable())) {
if (Pt) {
if (!e.hoverData.dragging && we.boxSelectionEnabled() && (vn || !we.panningEnabled() || !we.userPanningEnabled()))
Bn();
else if (!e.hoverData.selecting && we.panningEnabled() && we.userPanningEnabled()) {
var ar = a(Se, e.hoverData.downs);
ar && (e.hoverData.dragging = !0, e.hoverData.justStartedPan = !0, rt[4] = 0, e.data.bgActivePosistion = xc(ze), e.redrawHint("select", !0), e.redraw());
}
Se && Se.pannable() && Se.active() && Se.unactivate();
}
} else {
if (Se && Se.pannable() && Se.active() && Se.unactivate(), (!Se || !Se.grabbed()) && fe != Te && (Te && r(Te, ["mouseout", "tapdragout"], I, {
x: Ce[0],
y: Ce[1]
}), fe && r(fe, ["mouseover", "tapdragover"], I, {
x: Ce[0],
y: Ce[1]
}), e.hoverData.last = fe), Se)
if (Pt) {
if (we.boxSelectionEnabled() && vn)
Se && Se.grabbed() && (m(zt), Se.emit("freeon"), zt.emit("free"), e.dragData.didDrag && (Se.emit("dragfreeon"), zt.emit("dragfree"))), Bn();
else if (Se && Se.grabbed() && e.nodeIsDraggable(Se)) {
var nn = !e.dragData.didDrag;
nn && e.redrawHint("eles", !0), e.dragData.didDrag = !0, e.hoverData.draggingEles || f(zt, {
inDragLayer: !0
});
var gn = {
x: 0,
y: 0
};
if (Ze(Ue[0]) && Ze(Ue[1]) && (gn.x += Ue[0], gn.y += Ue[1], nn)) {
var Fn = e.hoverData.dragDelta;
Fn && Ze(Fn[0]) && Ze(Fn[1]) && (gn.x += Fn[0], gn.y += Fn[1]);
}
e.hoverData.draggingEles = !0, zt.silentShift(gn).emit("position drag"), e.redrawHint("drag", !0), e.redraw();
}
} else
Pn();
ve = !0;
}
if (rt[2] = Ce[0], rt[3] = Ce[1], ve)
return I.stopPropagation && I.stopPropagation(), I.preventDefault && I.preventDefault(), !1;
}
}, !1);
var F, A, T;
e.registerBinding(t, "mouseup", function(I) {
if (!(e.hoverData.which === 1 && I.which !== 1 && e.hoverData.capture)) {
var Y = e.hoverData.capture;
if (Y) {
e.hoverData.capture = !1;
var ve = e.cy, we = e.projectIntoViewport(I.clientX, I.clientY), ye = e.selection, Pe = e.findNearestElement(we[0], we[1], !0, !1), Ce = e.dragData.possibleDragElements, ze = e.hoverData.down, lt = o(I);
if (e.data.bgActivePosistion && (e.redrawHint("select", !0), e.redraw()), e.hoverData.tapholdCancelled = !0, e.data.bgActivePosistion = void 0, ze && ze.unactivate(), e.hoverData.which === 3) {
var rt = {
originalEvent: I,
type: "cxttapend",
position: {
x: we[0],
y: we[1]
}
};
if (ze ? ze.emit(rt) : ve.emit(rt), !e.hoverData.cxtDragged) {
var fe = {
originalEvent: I,
type: "cxttap",
position: {
x: we[0],
y: we[1]
}
};
ze ? ze.emit(fe) : ve.emit(fe);
}
e.hoverData.cxtDragged = !1, e.hoverData.which = null;
} else if (e.hoverData.which === 1) {
if (r(Pe, ["mouseup", "tapend", "vmouseup"], I, {
x: we[0],
y: we[1]
}), !e.dragData.didDrag && // didn't move a node around
!e.hoverData.dragged && // didn't pan
!e.hoverData.selecting && // not box selection
!e.hoverData.isOverThresholdDrag && (r(ze, ["click", "tap", "vclick"], I, {
x: we[0],
y: we[1]
}), A = !1, I.timeStamp - T <= ve.multiClickDebounceTime() ? (F && clearTimeout(F), A = !0, T = null, r(ze, ["dblclick", "dbltap", "vdblclick"], I, {
x: we[0],
y: we[1]
})) : (F = setTimeout(function() {
A || r(ze, ["oneclick", "onetap", "voneclick"], I, {
x: we[0],
y: we[1]
});
}, ve.multiClickDebounceTime()), T = I.timeStamp)), ze == null && !e.dragData.didDrag && !e.hoverData.selecting && !e.hoverData.dragged && !o(I) && (ve.$(n).unselect(["tapunselect"]), Ce.length > 0 && e.redrawHint("eles", !0), e.dragData.possibleDragElements = Ce = ve.collection()), Pe == ze && !e.dragData.didDrag && !e.hoverData.selecting && Pe != null && Pe._private.selectable && (e.hoverData.dragging || (ve.selectionType() === "additive" || lt ? Pe.selected() ? Pe.unselect(["tapunselect"]) : Pe.select(["tapselect"]) : lt || (ve.$(n).unmerge(Pe).unselect(["tapunselect"]), Pe.select(["tapselect"]))), e.redrawHint("eles", !0)), e.hoverData.selecting) {
var Te = ve.collection(e.getAllInBox(ye[0], ye[1], ye[2], ye[3]));
e.redrawHint("select", !0), Te.length > 0 && e.redrawHint("eles", !0), ve.emit({
type: "boxend",
originalEvent: I,
position: {
x: we[0],
y: we[1]
}
});
var Se = function(zt) {
return zt.selectable() && !zt.selected();
};
ve.selectionType() === "additive" || lt || ve.$(n).unmerge(Te).unselect(), Te.emit("box").stdFilter(Se).select().emit("boxselect"), e.redraw();
}
if (e.hoverData.dragging && (e.hoverData.dragging = !1, e.redrawHint("select", !0), e.redrawHint("eles", !0), e.redraw()), !ye[4]) {
e.redrawHint("drag", !0), e.redrawHint("eles", !0);
var Ue = ze && ze.grabbed();
m(Ce), Ue && (ze.emit("freeon"), Ce.emit("free"), e.dragData.didDrag && (ze.emit("dragfreeon"), Ce.emit("dragfree")));
}
}
ye[4] = 0, e.hoverData.down = null, e.hoverData.cxtStarted = !1, e.hoverData.draggingEles = !1, e.hoverData.selecting = !1, e.hoverData.isOverThresholdDrag = !1, e.dragData.didDrag = !1, e.hoverData.dragged = !1, e.hoverData.dragDelta = [], e.hoverData.mdownPos = null, e.hoverData.mdownGPos = null, e.hoverData.which = null;
}
}
}, !1);
var R = function(I) {
if (!e.scrollingPage) {
var Y = e.cy, ve = Y.zoom(), we = Y.pan(), ye = e.projectIntoViewport(I.clientX, I.clientY), Pe = [ye[0] * ve + we.x, ye[1] * ve + we.y];
if (e.hoverData.draggingEles || e.hoverData.dragging || e.hoverData.cxtStarted || $()) {
I.preventDefault();
return;
}
if (Y.panningEnabled() && Y.userPanningEnabled() && Y.zoomingEnabled() && Y.userZoomingEnabled()) {
I.preventDefault(), e.data.wheelZooming = !0, clearTimeout(e.data.wheelTimeout), e.data.wheelTimeout = setTimeout(function() {
e.data.wheelZooming = !1, e.redrawHint("eles", !0), e.redraw();
}, 150);
var Ce;
I.deltaY != null ? Ce = I.deltaY / -250 : I.wheelDeltaY != null ? Ce = I.wheelDeltaY / 1e3 : Ce = I.wheelDelta / 1e3, Ce = Ce * e.wheelSensitivity;
var ze = I.deltaMode === 1;
ze && (Ce *= 33);
var lt = Y.zoom() * Math.pow(10, Ce);
I.type === "gesturechange" && (lt = e.gestureStartZoom * I.scale), Y.zoom({
level: lt,
renderedPosition: {
x: Pe[0],
y: Pe[1]
}
}), Y.emit(I.type === "gesturechange" ? "pinchzoom" : "scrollzoom");
}
}
};
e.registerBinding(e.container, "wheel", R, !0), e.registerBinding(t, "scroll", function(I) {
e.scrollingPage = !0, clearTimeout(e.scrollingPageTimeout), e.scrollingPageTimeout = setTimeout(function() {
e.scrollingPage = !1;
}, 250);
}, !0), e.registerBinding(e.container, "gesturestart", function(I) {
e.gestureStartZoom = e.cy.zoom(), e.hasTouchStarted || I.preventDefault();
}, !0), e.registerBinding(e.container, "gesturechange", function(I) {
e.hasTouchStarted || R(I);
}, !0), e.registerBinding(e.container, "mouseout", function(I) {
var Y = e.projectIntoViewport(I.clientX, I.clientY);
e.cy.emit({
originalEvent: I,
type: "mouseout",
position: {
x: Y[0],
y: Y[1]
}
});
}, !1), e.registerBinding(e.container, "mouseover", function(I) {
var Y = e.projectIntoViewport(I.clientX, I.clientY);
e.cy.emit({
originalEvent: I,
type: "mouseover",
position: {
x: Y[0],
y: Y[1]
}
});
}, !1);
var M, j, P, V, U, G, se, ae, de, me, te, oe, ne, ee = function(I, Y, ve, we) {
return Math.sqrt((ve - I) * (ve - I) + (we - Y) * (we - Y));
}, Z = function(I, Y, ve, we) {
return (ve - I) * (ve - I) + (we - Y) * (we - Y);
}, le;
e.registerBinding(e.container, "touchstart", le = function(I) {
if (e.hasTouchStarted = !0, !!O(I)) {
b(), e.touchData.capture = !0, e.data.bgActivePosistion = void 0;
var Y = e.cy, ve = e.touchData.now, we = e.touchData.earlier;
if (I.touches[0]) {
var ye = e.projectIntoViewport(I.touches[0].clientX, I.touches[0].clientY);
ve[0] = ye[0], ve[1] = ye[1];
}
if (I.touches[1]) {
var ye = e.projectIntoViewport(I.touches[1].clientX, I.touches[1].clientY);
ve[2] = ye[0], ve[3] = ye[1];
}
if (I.touches[2]) {
var ye = e.projectIntoViewport(I.touches[2].clientX, I.touches[2].clientY);
ve[4] = ye[0], ve[5] = ye[1];
}
if (I.touches[1]) {
e.touchData.singleTouchMoved = !0, m(e.dragData.touchDragEles);
var Pe = e.findContainerClientCoords();
de = Pe[0], me = Pe[1], te = Pe[2], oe = Pe[3], M = I.touches[0].clientX - de, j = I.touches[0].clientY - me, P = I.touches[1].clientX - de, V = I.touches[1].clientY - me, ne = 0 <= M && M <= te && 0 <= P && P <= te && 0 <= j && j <= oe && 0 <= V && V <= oe;
var Ce = Y.pan(), ze = Y.zoom();
U = ee(M, j, P, V), G = Z(M, j, P, V), se = [(M + P) / 2, (j + V) / 2], ae = [(se[0] - Ce.x) / ze, (se[1] - Ce.y) / ze];
var lt = 200, rt = lt * lt;
if (G < rt && !I.touches[2]) {
var fe = e.findNearestElement(ve[0], ve[1], !0, !0), Te = e.findNearestElement(ve[2], ve[3], !0, !0);
fe && fe.isNode() ? (fe.activate().emit({
originalEvent: I,
type: "cxttapstart",
position: {
x: ve[0],
y: ve[1]
}
}), e.touchData.start = fe) : Te && Te.isNode() ? (Te.activate().emit({
originalEvent: I,
type: "cxttapstart",
position: {
x: ve[0],
y: ve[1]
}
}), e.touchData.start = Te) : Y.emit({
originalEvent: I,
type: "cxttapstart",
position: {
x: ve[0],
y: ve[1]
}
}), e.touchData.start && (e.touchData.start._private.grabbed = !1), e.touchData.cxt = !0, e.touchData.cxtDragged = !1, e.data.bgActivePosistion = void 0, e.redraw();
return;
}
}
if (I.touches[2])
Y.boxSelectionEnabled() && I.preventDefault();
else if (!I.touches[1] && I.touches[0]) {
var Se = e.findNearestElements(ve[0], ve[1], !0, !0), Ue = Se[0];
if (Ue != null && (Ue.activate(), e.touchData.start = Ue, e.touchData.starts = Se, e.nodeIsGrabbable(Ue))) {
var zt = e.dragData.touchDragEles = Y.collection(), Pt = null;
e.redrawHint("eles", !0), e.redrawHint("drag", !0), Ue.selected() ? (Pt = Y.$(function(hn) {
return hn.selected() && e.nodeIsGrabbable(hn);
}), f(Pt, {
addToList: zt
})) : v(Ue, {
addToList: zt
}), c(Ue);
var qt = function(hn) {
return {
originalEvent: I,
type: hn,
position: {
x: ve[0],
y: ve[1]
}
};
};
Ue.emit(qt("grabon")), Pt ? Pt.forEach(function(hn) {
hn.emit(qt("grab"));
}) : Ue.emit(qt("grab"));
}
r(Ue, ["touchstart", "tapstart", "vmousedown"], I, {
x: ve[0],
y: ve[1]
}), Ue == null && (e.data.bgActivePosistion = {
x: ye[0],
y: ye[1]
}, e.redrawHint("select", !0), e.redraw()), e.touchData.singleTouchMoved = !1, e.touchData.singleTouchStartTime = +/* @__PURE__ */ new Date(), clearTimeout(e.touchData.tapholdTimeout), e.touchData.tapholdTimeout = setTimeout(function() {
e.touchData.singleTouchMoved === !1 && !e.pinching && !e.touchData.selecting && r(e.touchData.start, ["taphold"], I, {
x: ve[0],
y: ve[1]
});
}, e.tapholdDuration);
}
if (I.touches.length >= 1) {
for (var Ht = e.touchData.startPosition = [null, null, null, null, null, null], tn = 0; tn < ve.length; tn++)
Ht[tn] = we[tn] = ve[tn];
var Dn = I.touches[0];
e.touchData.startGPosition = [Dn.clientX, Dn.clientY];
}
}
}, !1);
var pe;
e.registerBinding(t, "touchmove", pe = function(I) {
var Y = e.touchData.capture;
if (!(!Y && !O(I))) {
var ve = e.selection, we = e.cy, ye = e.touchData.now, Pe = e.touchData.earlier, Ce = we.zoom();
if (I.touches[0]) {
var ze = e.projectIntoViewport(I.touches[0].clientX, I.touches[0].clientY);
ye[0] = ze[0], ye[1] = ze[1];
}
if (I.touches[1]) {
var ze = e.projectIntoViewport(I.touches[1].clientX, I.touches[1].clientY);
ye[2] = ze[0], ye[3] = ze[1];
}
if (I.touches[2]) {
var ze = e.projectIntoViewport(I.touches[2].clientX, I.touches[2].clientY);
ye[4] = ze[0], ye[5] = ze[1];
}
var lt = e.touchData.startGPosition, rt;
if (Y && I.touches[0] && lt) {
for (var fe = [], Te = 0; Te < ye.length; Te++)
fe[Te] = ye[Te] - Pe[Te];
var Se = I.touches[0].clientX - lt[0], Ue = Se * Se, zt = I.touches[0].clientY - lt[1], Pt = zt * zt, qt = Ue + Pt;
rt = qt >= e.touchTapThreshold2;
}
if (Y && e.touchData.cxt) {
I.preventDefault();
var Ht = I.touches[0].clientX - de, tn = I.touches[0].clientY - me, Dn = I.touches[1].clientX - de, hn = I.touches[1].clientY - me, vn = Z(Ht, tn, Dn, hn), Pn = vn / G, Bn = 150, Cn = Bn * Bn, hr = 1.5, or = hr * hr;
if (Pn >= or || vn >= Cn) {
e.touchData.cxt = !1, e.data.bgActivePosistion = void 0, e.redrawHint("select", !0);
var ar = {
originalEvent: I,
type: "cxttapend",
position: {
x: ye[0],
y: ye[1]
}
};
e.touchData.start ? (e.touchData.start.unactivate().emit(ar), e.touchData.start = null) : we.emit(ar);
}
}
if (Y && e.touchData.cxt) {
var ar = {
originalEvent: I,
type: "cxtdrag",
position: {
x: ye[0],
y: ye[1]
}
};
e.data.bgActivePosistion = void 0, e.redrawHint("select", !0), e.touchData.start ? e.touchData.start.emit(ar) : we.emit(ar), e.touchData.start && (e.touchData.start._private.grabbed = !1), e.touchData.cxtDragged = !0;
var nn = e.findNearestElement(ye[0], ye[1], !0, !0);
(!e.touchData.cxtOver || nn !== e.touchData.cxtOver) && (e.touchData.cxtOver && e.touchData.cxtOver.emit({
originalEvent: I,
type: "cxtdragout",
position: {
x: ye[0],
y: ye[1]
}
}), e.touchData.cxtOver = nn, nn && nn.emit({
originalEvent: I,
type: "cxtdragover",
position: {
x: ye[0],
y: ye[1]
}
}));
} else if (Y && I.touches[2] && we.boxSelectionEnabled())
I.preventDefault(), e.data.bgActivePosistion = void 0, this.lastThreeTouch = +/* @__PURE__ */ new Date(), e.touchData.selecting || we.emit({
originalEvent: I,
type: "boxstart",
position: {
x: ye[0],
y: ye[1]
}
}), e.touchData.selecting = !0, e.touchData.didSelect = !0, ve[4] = 1, !ve || ve.length === 0 || ve[0] === void 0 ? (ve[0] = (ye[0] + ye[2] + ye[4]) / 3, ve[1] = (ye[1] + ye[3] + ye[5]) / 3, ve[2] = (ye[0] + ye[2] + ye[4]) / 3 + 1, ve[3] = (ye[1] + ye[3] + ye[5]) / 3 + 1) : (ve[2] = (ye[0] + ye[2] + ye[4]) / 3, ve[3] = (ye[1] + ye[3] + ye[5]) / 3), e.redrawHint("select", !0), e.redraw();
else if (Y && I.touches[1] && !e.touchData.didSelect && we.zoomingEnabled() && we.panningEnabled() && we.userZoomingEnabled() && we.userPanningEnabled()) {
I.preventDefault(), e.data.bgActivePosistion = void 0, e.redrawHint("select", !0);
var gn = e.dragData.touchDragEles;
if (gn) {
e.redrawHint("drag", !0);
for (var Fn = 0; Fn < gn.length; Fn++) {
var vr = gn[Fn]._private;
vr.grabbed = !1, vr.rscratch.inDragLayer = !1;
}
}
var Uo = e.touchData.start, Ht = I.touches[0].clientX - de, tn = I.touches[0].clientY - me, Dn = I.touches[1].clientX - de, hn = I.touches[1].clientY - me, B = ee(Ht, tn, Dn, hn), ce = B / U;
if (ne) {
var Le = Ht - M, We = tn - j, rn = Dn - P, Tn = hn - V, An = (Le + rn) / 2, un = (We + Tn) / 2, on = we.zoom(), qo = on * ce, Fl = we.pan(), Lh = ae[0] * on + Fl.x, Rh = ae[1] * on + Fl.y, Nh = {
x: -qo / on * (Lh - Fl.x - An) + Lh,
y: -qo / on * (Rh - Fl.y - un) + Rh
};
if (Uo && Uo.active()) {
var gn = e.dragData.touchDragEles;
m(gn), e.redrawHint("drag", !0), e.redrawHint("eles", !0), Uo.unactivate().emit("freeon"), gn.emit("free"), e.dragData.didDrag && (Uo.emit("dragfreeon"), gn.emit("dragfree"));
}
we.viewport({
zoom: qo,
pan: Nh,
cancelOnFailedZoom: !0
}), we.emit("pinchzoom"), U = B, M = Ht, j = tn, P = Dn, V = hn, e.pinching = !0;
}
if (I.touches[0]) {
var ze = e.projectIntoViewport(I.touches[0].clientX, I.touches[0].clientY);
ye[0] = ze[0], ye[1] = ze[1];
}
if (I.touches[1]) {
var ze = e.projectIntoViewport(I.touches[1].clientX, I.touches[1].clientY);
ye[2] = ze[0], ye[3] = ze[1];
}
if (I.touches[2]) {
var ze = e.projectIntoViewport(I.touches[2].clientX, I.touches[2].clientY);
ye[4] = ze[0], ye[5] = ze[1];
}
} else if (I.touches[0] && !e.touchData.didSelect) {
var Ao = e.touchData.start, Hd = e.touchData.last, nn;
if (!e.hoverData.draggingEles && !e.swipePanning && (nn = e.findNearestElement(ye[0], ye[1], !0, !0)), Y && Ao != null && I.preventDefault(), Y && Ao != null && e.nodeIsDraggable(Ao))
if (rt) {
var gn = e.dragData.touchDragEles, Mh = !e.dragData.didDrag;
Mh && f(gn, {
inDragLayer: !0
}), e.dragData.didDrag = !0;
var Tl = {
x: 0,
y: 0
};
if (Ze(fe[0]) && Ze(fe[1]) && (Tl.x += fe[0], Tl.y += fe[1], Mh)) {
e.redrawHint("eles", !0);
var to = e.touchData.dragDelta;
to && Ze(to[0]) && Ze(to[1]) && (Tl.x += to[0], Tl.y += to[1]);
}
e.hoverData.draggingEles = !0, gn.silentShift(Tl).emit("position drag"), e.redrawHint("drag", !0), e.touchData.startPosition[0] == Pe[0] && e.touchData.startPosition[1] == Pe[1] && e.redrawHint("eles", !0), e.redraw();
} else {
var to = e.touchData.dragDelta = e.touchData.dragDelta || [];
to.length === 0 ? (to.push(fe[0]), to.push(fe[1])) : (to[0] += fe[0], to[1] += fe[1]);
}
if (r(Ao || nn, ["touchmove", "tapdrag", "vmousemove"], I, {
x: ye[0],
y: ye[1]
}), (!Ao || !Ao.grabbed()) && nn != Hd && (Hd && Hd.emit({
originalEvent: I,
type: "tapdragout",
position: {
x: ye[0],
y: ye[1]
}
}), nn && nn.emit({
originalEvent: I,
type: "tapdragover",
position: {
x: ye[0],
y: ye[1]
}
})), e.touchData.last = nn, Y)
for (var Fn = 0; Fn < ye.length; Fn++)
ye[Fn] && e.touchData.startPosition[Fn] && rt && (e.touchData.singleTouchMoved = !0);
if (Y && (Ao == null || Ao.pannable()) && we.panningEnabled() && we.userPanningEnabled()) {
var P1 = a(Ao, e.touchData.starts);
P1 && (I.preventDefault(), e.data.bgActivePosistion || (e.data.bgActivePosistion = xc(e.touchData.startPosition)), e.swipePanning ? (we.panBy({
x: fe[0] * Ce,
y: fe[1] * Ce
}), we.emit("dragpan")) : rt && (e.swipePanning = !0, we.panBy({
x: Se * Ce,
y: zt * Ce
}), we.emit("dragpan"), Ao && (Ao.unactivate(), e.redrawHint("select", !0), e.touchData.start = null)));
var ze = e.projectIntoViewport(I.touches[0].clientX, I.touches[0].clientY);
ye[0] = ze[0], ye[1] = ze[1];
}
}
for (var Te = 0; Te < ye.length; Te++)
Pe[Te] = ye[Te];
Y && I.touches.length > 0 && !e.hoverData.draggingEles && !e.swipePanning && e.data.bgActivePosistion != null && (e.data.bgActivePosistion = void 0, e.redrawHint("select", !0), e.redraw());
}
}, !1);
var ke;
e.registerBinding(t, "touchcancel", ke = function(I) {
var Y = e.touchData.start;
e.touchData.capture = !1, Y && Y.unactivate();
});
var Ne, De, _e, Fe;
if (e.registerBinding(t, "touchend", Ne = function(I) {
var Y = e.touchData.start, ve = e.touchData.capture;
if (ve)
I.touches.length === 0 && (e.touchData.capture = !1), I.preventDefault();
else
return;
var we = e.selection;
e.swipePanning = !1, e.hoverData.draggingEles = !1;
var ye = e.cy, Pe = ye.zoom(), Ce = e.touchData.now, ze = e.touchData.earlier;
if (I.touches[0]) {
var lt = e.projectIntoViewport(I.touches[0].clientX, I.touches[0].clientY);
Ce[0] = lt[0], Ce[1] = lt[1];
}
if (I.touches[1]) {
var lt = e.projectIntoViewport(I.touches[1].clientX, I.touches[1].clientY);
Ce[2] = lt[0], Ce[3] = lt[1];
}
if (I.touches[2]) {
var lt = e.projectIntoViewport(I.touches[2].clientX, I.touches[2].clientY);
Ce[4] = lt[0], Ce[5] = lt[1];
}
Y && Y.unactivate();
var rt;
if (e.touchData.cxt) {
if (rt = {
originalEvent: I,
type: "cxttapend",
position: {
x: Ce[0],
y: Ce[1]
}
}, Y ? Y.emit(rt) : ye.emit(rt), !e.touchData.cxtDragged) {
var fe = {
originalEvent: I,
type: "cxttap",
position: {
x: Ce[0],
y: Ce[1]
}
};
Y ? Y.emit(fe) : ye.emit(fe);
}
e.touchData.start && (e.touchData.start._private.grabbed = !1), e.touchData.cxt = !1, e.touchData.start = null, e.redraw();
return;
}
if (!I.touches[2] && ye.boxSelectionEnabled() && e.touchData.selecting) {
e.touchData.selecting = !1;
var Te = ye.collection(e.getAllInBox(we[0], we[1], we[2], we[3]));
we[0] = void 0, we[1] = void 0, we[2] = void 0, we[3] = void 0, we[4] = 0, e.redrawHint("select", !0), ye.emit({
type: "boxend",
originalEvent: I,
position: {
x: Ce[0],
y: Ce[1]
}
});
var Se = function(Bn) {
return Bn.selectable() && !Bn.selected();
};
Te.emit("box").stdFilter(Se).select().emit("boxselect"), Te.nonempty() && e.redrawHint("eles", !0), e.redraw();
}
if (Y != null && Y.unactivate(), I.touches[2])
e.data.bgActivePosistion = void 0, e.redrawHint("select", !0);
else if (!I.touches[1] && !I.touches[0] && !I.touches[0]) {
e.data.bgActivePosistion = void 0, e.redrawHint("select", !0);
var Ue = e.dragData.touchDragEles;
if (Y != null) {
var zt = Y._private.grabbed;
m(Ue), e.redrawHint("drag", !0), e.redrawHint("eles", !0), zt && (Y.emit("freeon"), Ue.emit("free"), e.dragData.didDrag && (Y.emit("dragfreeon"), Ue.emit("dragfree"))), r(Y, ["touchend", "tapend", "vmouseup", "tapdragout"], I, {
x: Ce[0],
y: Ce[1]
}), Y.unactivate(), e.touchData.start = null;
} else {
var Pt = e.findNearestElement(Ce[0], Ce[1], !0, !0);
r(Pt, ["touchend", "tapend", "vmouseup", "tapdragout"], I, {
x: Ce[0],
y: Ce[1]
});
}
var qt = e.touchData.startPosition[0] - Ce[0], Ht = qt * qt, tn = e.touchData.startPosition[1] - Ce[1], Dn = tn * tn, hn = Ht + Dn, vn = hn * Pe * Pe;
e.touchData.singleTouchMoved || (Y || ye.$(":selected").unselect(["tapunselect"]), r(Y, ["tap", "vclick"], I, {
x: Ce[0],
y: Ce[1]
}), De = !1, I.timeStamp - Fe <= ye.multiClickDebounceTime() ? (_e && clearTimeout(_e), De = !0, Fe = null, r(Y, ["dbltap", "vdblclick"], I, {
x: Ce[0],
y: Ce[1]
})) : (_e = setTimeout(function() {
De || r(Y, ["onetap", "voneclick"], I, {
x: Ce[0],
y: Ce[1]
});
}, ye.multiClickDebounceTime()), Fe = I.timeStamp)), Y != null && !e.dragData.didDrag && Y._private.selectable && vn < e.touchTapThreshold2 && !e.pinching && (ye.selectionType() === "single" ? (ye.$(n).unmerge(Y).unselect(["tapunselect"]), Y.select(["tapselect"])) : Y.selected() ? Y.unselect(["tapunselect"]) : Y.select(["tapselect"]), e.redrawHint("eles", !0)), e.touchData.singleTouchMoved = !0;
}
for (var Pn = 0; Pn < Ce.length; Pn++)
ze[Pn] = Ce[Pn];
e.dragData.didDrag = !1, I.touches.length === 0 && (e.touchData.dragDelta = [], e.touchData.startPosition = [null, null, null, null, null, null], e.touchData.startGPosition = null, e.touchData.didSelect = !1), I.touches.length < 2 && (I.touches.length === 1 && (e.touchData.startGPosition = [I.touches[0].clientX, I.touches[0].clientY]), e.pinching = !1, e.redrawHint("eles", !0), e.redraw());
}, !1), typeof TouchEvent > "u") {
var Ie = [], Ae = function(I) {
return {
clientX: I.clientX,
clientY: I.clientY,
force: 1,
identifier: I.pointerId,
pageX: I.pageX,
pageY: I.pageY,
radiusX: I.width / 2,
radiusY: I.height / 2,
screenX: I.screenX,
screenY: I.screenY,
target: I.target
};
}, qe = function(I) {
return {
event: I,
touch: Ae(I)
};
}, et = function(I) {
Ie.push(qe(I));
}, He = function(I) {
for (var Y = 0; Y < Ie.length; Y++) {
var ve = Ie[Y];
if (ve.event.pointerId === I.pointerId) {
Ie.splice(Y, 1);
return;
}
}
}, ot = function(I) {
var Y = Ie.filter(function(ve) {
return ve.event.pointerId === I.pointerId;
})[0];
Y.event = I, Y.touch = Ae(I);
}, tt = function(I) {
I.touches = Ie.map(function(Y) {
return Y.touch;
});
}, Qe = function(I) {
return I.pointerType === "mouse" || I.pointerType === 4;
};
e.registerBinding(e.container, "pointerdown", function(I) {
Qe(I) || (I.preventDefault(), et(I), tt(I), le(I));
}), e.registerBinding(e.container, "pointerup", function(I) {
Qe(I) || (He(I), tt(I), Ne(I));
}), e.registerBinding(e.container, "pointercancel", function(I) {
Qe(I) || (He(I), tt(I), ke(I));
}), e.registerBinding(e.container, "pointermove", function(I) {
Qe(I) || (I.preventDefault(), ot(I), tt(I), pe(I));
});
}
};
var vs = {};
vs.generatePolygon = function(e, t) {
return this.nodeShapes[e] = {
renderer: this,
name: e,
points: t,
draw: function(n, r, o, a, i, s) {
this.renderer.nodeShapeImpl("polygon", n, r, o, a, i, this.points);
},
intersectLine: function(n, r, o, a, i, s, l, u) {
return cf(i, s, this.points, n, r, o / 2, a / 2, l);
},
checkPoint: function(n, r, o, a, i, s, l, u) {
return rs(n, r, this.points, s, l, a, i, [0, -1], o);
}
};
};
vs.generateEllipse = function() {
return this.nodeShapes.ellipse = {
renderer: this,
name: "ellipse",
draw: function(e, t, n, r, o, a) {
this.renderer.nodeShapeImpl(this.name, e, t, n, r, o);
},
intersectLine: function(e, t, n, r, o, a, i, s) {
return Qme(o, a, e, t, n / 2 + i, r / 2 + i);
},
checkPoint: function(e, t, n, r, o, a, i, s) {
return ql(e, t, r, o, a, i, n);
}
};
};
vs.generateRoundPolygon = function(e, t) {
return this.nodeShapes[e] = {
renderer: this,
name: e,
points: t,
getOrCreateCorners: function(n, r, o, a, i, s, l) {
if (s[l] !== void 0 && s[l + "-cx"] === n && s[l + "-cy"] === r)
return s[l];
s[l] = new Array(t.length / 2), s[l + "-cx"] = n, s[l + "-cy"] = r;
var u = o / 2, c = a / 2;
i = i === "auto" ? VB(o, a) : i;
for (var d = new Array(t.length / 2), p = 0; p < t.length / 2; p++)
d[p] = {
x: n + u * t[p * 2],
y: r + c * t[p * 2 + 1]
};
var h, f, v, m, g = d.length;
for (f = d[g - 1], h = 0; h < g; h++)
v = d[h % g], m = d[(h + 1) % g], s[l][h] = A$(f, v, m, i), f = v, v = m;
return s[l];
},
draw: function(n, r, o, a, i, s, l) {
this.renderer.nodeShapeImpl("round-polygon", n, r, o, a, i, this.points, this.getOrCreateCorners(r, o, a, i, s, l, "drawCorners"));
},
intersectLine: function(n, r, o, a, i, s, l, u, c) {
return e1e(i, s, this.points, n, r, o, a, l, this.getOrCreateCorners(n, r, o, a, u, c, "corners"));
},
checkPoint: function(n, r, o, a, i, s, l, u, c) {
return Jme(n, r, this.points, s, l, a, i, this.getOrCreateCorners(s, l, a, i, u, c, "corners"));
}
};
};
vs.generateRoundRectangle = function() {
return this.nodeShapes["round-rectangle"] = this.nodeShapes.roundrectangle = {
renderer: this,
name: "round-rectangle",
points: ro(4, 0),
draw: function(e, t, n, r, o, a) {
this.renderer.nodeShapeImpl(this.name, e, t, n, r, o, this.points, a);
},
intersectLine: function(e, t, n, r, o, a, i, s) {
return zB(o, a, e, t, n, r, i, s);
},
checkPoint: function(e, t, n, r, o, a, i, s) {
var l = r / 2, u = o / 2;
s = s === "auto" ? hu(r, o) : s, s = Math.min(l, u, s);
var c = s * 2;
return !!(rs(e, t, this.points, a, i, r, o - c, [0, -1], n) || rs(e, t, this.points, a, i, r - c, o, [0, -1], n) || ql(e, t, c, c, a - l + s, i - u + s, n) || ql(e, t, c, c, a + l - s, i - u + s, n) || ql(e, t, c, c, a + l - s, i + u - s, n) || ql(e, t, c, c, a - l + s, i + u - s, n));
}
};
};
vs.generateCutRectangle = function() {
return this.nodeShapes["cut-rectangle"] = this.nodeShapes.cutrectangle = {
renderer: this,
name: "cut-rectangle",
cornerLength: b$(),
points: ro(4, 0),
draw: function(e, t, n, r, o, a) {
this.renderer.nodeShapeImpl(this.name, e, t, n, r, o, null, a);
},
generateCutTrianglePts: function(e, t, n, r, o) {
var a = o === "auto" ? this.cornerLength : o, i = t / 2, s = e / 2, l = n - s, u = n + s, c = r - i, d = r + i;
return {
topLeft: [l, c + a, l + a, c, l + a, c + a],
topRight: [u - a, c, u, c + a, u - a, c + a],
bottomRight: [u, d - a, u - a, d, u - a, d - a],
bottomLeft: [l + a, d, l, d - a, l + a, d - a]
};
},
intersectLine: function(e, t, n, r, o, a, i, s) {
var l = this.generateCutTrianglePts(n + 2 * i, r + 2 * i, e, t, s), u = [].concat.apply([], [l.topLeft.splice(0, 4), l.topRight.splice(0, 4), l.bottomRight.splice(0, 4), l.bottomLeft.splice(0, 4)]);
return cf(o, a, u, e, t);
},
checkPoint: function(e, t, n, r, o, a, i, s) {
var l = s === "auto" ? this.cornerLength : s;
if (rs(e, t, this.points, a, i, r, o - 2 * l, [0, -1], n) || rs(e, t, this.points, a, i, r - 2 * l, o, [0, -1], n))
return !0;
var u = this.generateCutTrianglePts(r, o, a, i);
return ho(e, t, u.topLeft) || ho(e, t, u.topRight) || ho(e, t, u.bottomRight) || ho(e, t, u.bottomLeft);
}
};
};
vs.generateBarrel = function() {
return this.nodeShapes.barrel = {
renderer: this,
name: "barrel",
points: ro(4, 0),
draw: function(e, t, n, r, o, a) {
this.renderer.nodeShapeImpl(this.name, e, t, n, r, o);
},
intersectLine: function(e, t, n, r, o, a, i, s) {
var l = 0.15, u = 0.5, c = 0.85, d = this.generateBarrelBezierPts(n + 2 * i, r + 2 * i, e, t), p = function(f) {
var v = Sc({
x: f[0],
y: f[1]
}, {
x: f[2],
y: f[3]
}, {
x: f[4],
y: f[5]
}, l), m = Sc({
x: f[0],
y: f[1]
}, {
x: f[2],
y: f[3]
}, {
x: f[4],
y: f[5]
}, u), g = Sc({
x: f[0],
y: f[1]
}, {
x: f[2],
y: f[3]
}, {
x: f[4],
y: f[5]
}, c);
return [f[0], f[1], v.x, v.y, m.x, m.y, g.x, g.y, f[4], f[5]];
}, h = [].concat(p(d.topLeft), p(d.topRight), p(d.bottomRight), p(d.bottomLeft));
return cf(o, a, h, e, t);
},
generateBarrelBezierPts: function(e, t, n, r) {
var o = t / 2, a = e / 2, i = n - a, s = n + a, l = r - o, u = r + o, c = VC(e, t), d = c.heightOffset, p = c.widthOffset, h = c.ctrlPtOffsetPct * e, f = {
topLeft: [i, l + d, i + h, l, i + p, l],
topRight: [s - p, l, s - h, l, s, l + d],
bottomRight: [s, u - d, s - h, u, s - p, u],
bottomLeft: [i + p, u, i + h, u, i, u - d]
};
return f.topLeft.isTop = !0, f.topRight.isTop = !0, f.bottomLeft.isBottom = !0, f.bottomRight.isBottom = !0, f;
},
checkPoint: function(e, t, n, r, o, a, i, s) {
var l = VC(r, o), u = l.heightOffset, c = l.widthOffset;
if (rs(e, t, this.points, a, i, r, o - 2 * u, [0, -1], n) || rs(e, t, this.points, a, i, r - 2 * c, o, [0, -1], n))
return !0;
for (var d = this.generateBarrelBezierPts(r, o, a, i), p = function(C, _, $) {
var O = $[4], F = $[2], A = $[0], T = $[5], R = $[1], M = Math.min(O, A), j = Math.max(O, A), P = Math.min(T, R), V = Math.max(T, R);
if (M <= C && C <= j && P <= _ && _ <= V) {
var U = t1e(O, F, A), G = Wme(U[0], U[1], U[2], C), se = G.filter(function(ae) {
return 0 <= ae && ae <= 1;
});
if (se.length > 0)
return se[0];
}
return null;
}, h = Object.keys(d), f = 0; f < h.length; f++) {
var v = h[f], m = d[v], g = p(e, t, m);
if (g != null) {
var b = m[5], x = m[3], w = m[1], k = gr(b, x, w, g);
if (m.isTop && k <= t || m.isBottom && t <= k)
return !0;
}
}
return !1;
}
};
};
vs.generateBottomRoundrectangle = function() {
return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes.bottomroundrectangle = {
renderer: this,
name: "bottom-round-rectangle",
points: ro(4, 0),
draw: function(e, t, n, r, o, a) {
this.renderer.nodeShapeImpl(this.name, e, t, n, r, o, this.points, a);
},
intersectLine: function(e, t, n, r, o, a, i, s) {
var l = e - (n / 2 + i), u = t - (r / 2 + i), c = u, d = e + (n / 2 + i), p = qs(o, a, e, t, l, u, d, c, !1);
return p.length > 0 ? p : zB(o, a, e, t, n, r, i, s);
},
checkPoint: function(e, t, n, r, o, a, i, s) {
s = s === "auto" ? hu(r, o) : s;
var l = 2 * s;
if (rs(e, t, this.points, a, i, r, o - l, [0, -1], n) || rs(e, t, this.points, a, i, r - l, o, [0, -1], n))
return !0;
var u = r / 2 + 2 * n, c = o / 2 + 2 * n, d = [a - u, i - c, a - u, i, a + u, i, a + u, i - c];
return !!(ho(e, t, d) || ql(e, t, l, l, a + r / 2 - s, i + o / 2 - s, n) || ql(e, t, l, l, a - r / 2 + s, i + o / 2 - s, n));
}
};
};
vs.registerNodeShapes = function() {
var e = this.nodeShapes = {}, t = this;
this.generateEllipse(), this.generatePolygon("triangle", ro(3, 0)), this.generateRoundPolygon("round-triangle", ro(3, 0)), this.generatePolygon("rectangle", ro(4, 0)), e.square = e.rectangle, this.generateRoundRectangle(), this.generateCutRectangle(), this.generateBarrel(), this.generateBottomRoundrectangle();
{
var n = [0, 1, 1, 0, 0, -1, -1, 0];
this.generatePolygon("diamond", n), this.generateRoundPolygon("round-diamond", n);
}
this.generatePolygon("pentagon", ro(5, 0)), this.generateRoundPolygon("round-pentagon", ro(5, 0)), this.generatePolygon("hexagon", ro(6, 0)), this.generateRoundPolygon("round-hexagon", ro(6, 0)), this.generatePolygon("heptagon", ro(7, 0)), this.generateRoundPolygon("round-heptagon", ro(7, 0)), this.generatePolygon("octagon", ro(8, 0)), this.generateRoundPolygon("round-octagon", ro(8, 0));
var r = new Array(20);
{
var o = jC(5, 0), a = jC(5, Math.PI / 5), i = 0.5 * (3 - Math.sqrt(5));
i *= 1.57;
for (var s = 0; s < a.length / 2; s++)
a[s * 2] *= i, a[s * 2 + 1] *= i;
for (var s = 0; s < 20 / 4; s++)
r[s * 4] = o[s * 2], r[s * 4 + 1] = o[s * 2 + 1], r[s * 4 + 2] = a[s * 2], r[s * 4 + 3] = a[s * 2 + 1];
}
r = jB(r), this.generatePolygon("star", r), 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]);
{
var l = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1];
this.generatePolygon("tag", l), this.generateRoundPolygon("round-tag", l);
}
e.makePolygon = function(u) {
var c = u.join("$"), d = "polygon-" + c, p;
return (p = this[d]) ? p : t.generatePolygon(d, u);
};
};
var sh = {};
sh.timeToRender = function() {
return this.redrawTotalTime / this.redrawCount;
};
sh.redraw = function(e) {
e = e || RB();
var t = this;
t.averageRedrawTime === void 0 && (t.averageRedrawTime = 0), t.lastRedrawTime === void 0 && (t.lastRedrawTime = 0), t.lastDrawTime === void 0 && (t.lastDrawTime = 0), t.requestedFrame = !0, t.renderOptions = e;
};
sh.beforeRender = function(e, t) {
if (!this.destroyed) {
t == null && Un("Priority is not optional for beforeRender");
var n = this.beforeRenderCallbacks;
n.push({
fn: e,
priority: t
}), n.sort(function(r, o) {
return o.priority - r.priority;
});
}
};
var FF = function(e, t, n) {
for (var r = e.beforeRenderCallbacks, o = 0; o < r.length; o++)
r[o].fn(t, n);
};
sh.startRenderLoop = function() {
var e = this, t = e.cy;
if (!e.renderLoopStarted) {
e.renderLoopStarted = !0;
var n = function r(o) {
if (!e.destroyed) {
if (!t.batching()) if (e.requestedFrame && !e.skipFrame) {
FF(e, !0, o);
var a = ns();
e.render(e.renderOptions);
var i = e.lastDrawTime = ns();
e.averageRedrawTime === void 0 && (e.averageRedrawTime = i - a), e.redrawCount === void 0 && (e.redrawCount = 0), e.redrawCount++, e.redrawTotalTime === void 0 && (e.redrawTotalTime = 0);
var s = i - a;
e.redrawTotalTime += s, e.lastRedrawTime = s, e.averageRedrawTime = e.averageRedrawTime / 2 + s / 2, e.requestedFrame = !1;
} else
FF(e, !1, o);
e.skipFrame = !1, Bg(r);
}
};
Bg(n);
}
};
var N2e = function(e) {
this.init(e);
}, zz = N2e, _d = zz.prototype;
_d.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"];
_d.init = function(e) {
var t = this;
t.options = e, t.cy = e.cy;
var n = t.container = e.cy.container(), r = t.cy.window();
if (r) {
var o = r.document, a = o.head, i = "__________cytoscape_stylesheet", s = "__________cytoscape_container", l = o.getElementById(i) != null;
if (n.className.indexOf(s) < 0 && (n.className = (n.className || "") + " " + s), !l) {
var u = o.createElement("style");
u.id = i, u.textContent = "." + s + " { position: relative; }", a.insertBefore(u, a.children[0]);
}
var c = r.getComputedStyle(n), d = c.getPropertyValue("position");
d === "static" && sn("A Cytoscape container has style position:static and so can not use UI extensions properly");
}
t.selection = [void 0, void 0, void 0, void 0, 0], t.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95], t.hoverData = {
down: null,
last: null,
downTime: null,
triggerMode: null,
dragging: !1,
initialPan: [null, null],
capture: !1
}, t.dragData = {
possibleDragElements: []
}, t.touchData = {
start: null,
capture: !1,
// These 3 fields related to tap, taphold events
startPosition: [null, null, null, null, null, null],
singleTouchStartTime: null,
singleTouchMoved: !0,
now: [null, null, null, null, null, null],
earlier: [null, null, null, null, null, null]
}, t.redraws = 0, t.showFps = e.showFps, t.debug = e.debug, t.hideEdgesOnViewport = e.hideEdgesOnViewport, t.textureOnViewport = e.textureOnViewport, t.wheelSensitivity = e.wheelSensitivity, t.motionBlurEnabled = e.motionBlur, t.forcedPixelRatio = Ze(e.pixelRatio) ? e.pixelRatio : null, t.motionBlur = e.motionBlur, t.motionBlurOpacity = e.motionBlurOpacity, t.motionBlurTransparency = 1 - t.motionBlurOpacity, t.motionBlurPxRatio = 1, t.mbPxRBlurry = 1, t.minMbLowQualFrames = 4, t.fullQualityMb = !1, t.clearedForMotionBlur = [], t.desktopTapThreshold = e.desktopTapThreshold, t.desktopTapThreshold2 = e.desktopTapThreshold * e.desktopTapThreshold, t.touchTapThreshold = e.touchTapThreshold, t.touchTapThreshold2 = e.touchTapThreshold * e.touchTapThreshold, t.tapholdDuration = 500, t.bindings = [], t.beforeRenderCallbacks = [], t.beforeRenderPriorities = {
// higher priority execs before lower one
animations: 400,
eleCalcs: 300,
eleTxrDeq: 200,
lyrTxrDeq: 150,
lyrTxrSkip: 100
}, t.registerNodeShapes(), t.registerArrowShapes(), t.registerCalculationListeners();
};
_d.notify = function(e, t) {
var n = this, r = n.cy;
if (!this.destroyed) {
if (e === "init") {
n.load();
return;
}
if (e === "destroy") {
n.destroy();
return;
}
(e === "add" || e === "remove" || e === "move" && r.hasCompoundNodes() || e === "load" || e === "zorder" || e === "mount") && n.invalidateCachedZSortedEles(), e === "viewport" && n.redrawHint("select", !0), (e === "load" || e === "resize" || e === "mount") && (n.invalidateContainerClientCoordsCache(), n.matchCanvasSize(n.container)), n.redrawHint("eles", !0), n.redrawHint("drag", !0), this.startRenderLoop(), this.redraw();
}
};
_d.destroy = function() {
var e = this;
e.destroyed = !0, e.cy.stopAnimationLoop();
for (var t = 0; t < e.bindings.length; t++) {
var n = e.bindings[t], r = n, o = r.target;
(o.off || o.removeEventListener).apply(o, r.args);
}
if (e.bindings = [], e.beforeRenderCallbacks = [], e.onUpdateEleCalcsFns = [], e.removeObserver && e.removeObserver.disconnect(), e.styleObserver && e.styleObserver.disconnect(), e.resizeObserver && e.resizeObserver.disconnect(), e.labelCalcDiv)
try {
document.body.removeChild(e.labelCalcDiv);
} catch {
}
};
_d.isHeadless = function() {
return !1;
};
[T$, Dz, Bz, Cd, vs, sh].forEach(function(e) {
_t(_d, e);
});
var wy = 1e3 / 60, jz = {
setupDequeueing: function(e) {
return function() {
var t = this, n = this.renderer;
if (!t.dequeueingSetup) {
t.dequeueingSetup = !0;
var r = fm(function() {
n.redrawHint("eles", !0), n.redrawHint("drag", !0), n.redraw();
}, e.deqRedrawThreshold), o = function(i, s) {
var l = ns(), u = n.averageRedrawTime, c = n.lastRedrawTime, d = [], p = n.cy.extent(), h = n.getPixelRatio();
for (i || n.flushRenderedStyleQueue(); ; ) {
var f = ns(), v = f - l, m = f - s;
if (c < wy) {
var g = wy - (i ? u : 0);
if (m >= e.deqFastCost * g)
break;
} else if (i) {
if (v >= e.deqCost * c || v >= e.deqAvgCost * u)
break;
} else if (m >= e.deqNoDrawCost * wy)
break;
var b = e.deq(t, h, p);
if (b.length > 0)
for (var x = 0; x < b.length; x++)
d.push(b[x]);
else
break;
}
d.length > 0 && (e.onDeqd(t, d), !i && e.shouldRedraw(t, d, h, p) && r());
}, a = e.priority || v$;
n.beforeRender(o, a(t));
}
};
}
}, M2e = /* @__PURE__ */ function() {
function e(t) {
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : zg;
c$(this, e), this.idsByKey = new ii(), this.keyForId = new ii(), this.cachesByLvl = new ii(), this.lvls = [], this.getKey = t, this.doesEleInvalidateKey = n;
}
return d$(e, [{
key: "getIdsFor",
value: function(t) {
t == null && Un("Can not get id list for null key");
var n = this.idsByKey, r = this.idsByKey.get(t);
return r || (r = new gd(), n.set(t, r)), r;
}
}, {
key: "addIdForKey",
value: function(t, n) {
t != null && this.getIdsFor(t).add(n);
}
}, {
key: "deleteIdForKey",
value: function(t, n) {
t != null && this.getIdsFor(t).delete(n);
}
}, {
key: "getNumberOfIdsForKey",
value: function(t) {
return t == null ? 0 : this.getIdsFor(t).size;
}
}, {
key: "updateKeyMappingFor",
value: function(t) {
var n = t.id(), r = this.keyForId.get(n), o = this.getKey(t);
this.deleteIdForKey(r, n), this.addIdForKey(o, n), this.keyForId.set(n, o);
}
}, {
key: "deleteKeyMappingFor",
value: function(t) {
var n = t.id(), r = this.keyForId.get(n);
this.deleteIdForKey(r, n), this.keyForId.delete(n);
}
}, {
key: "keyHasChangedFor",
value: function(t) {
var n = t.id(), r = this.keyForId.get(n), o = this.getKey(t);
return r !== o;
}
}, {
key: "isInvalid",
value: function(t) {
return this.keyHasChangedFor(t) || this.doesEleInvalidateKey(t);
}
}, {
key: "getCachesAt",
value: function(t) {
var n = this.cachesByLvl, r = this.lvls, o = n.get(t);
return o || (o = new ii(), n.set(t, o), r.push(t)), o;
}
}, {
key: "getCache",
value: function(t, n) {
return this.getCachesAt(n).get(t);
}
}, {
key: "get",
value: function(t, n) {
var r = this.getKey(t), o = this.getCache(r, n);
return o != null && this.updateKeyMappingFor(t), o;
}
}, {
key: "getForCachedKey",
value: function(t, n) {
var r = this.keyForId.get(t.id()), o = this.getCache(r, n);
return o;
}
}, {
key: "hasCache",
value: function(t, n) {
return this.getCachesAt(n).has(t);
}
}, {
key: "has",
value: function(t, n) {
var r = this.getKey(t);
return this.hasCache(r, n);
}
}, {
key: "setCache",
value: function(t, n, r) {
r.key = t, this.getCachesAt(n).set(t, r);
}
}, {
key: "set",
value: function(t, n, r) {
var o = this.getKey(t);
this.setCache(o, n, r), this.updateKeyMappingFor(t);
}
}, {
key: "deleteCache",
value: function(t, n) {
this.getCachesAt(n).delete(t);
}
}, {
key: "delete",
value: function(t, n) {
var r = this.getKey(t);
this.deleteCache(r, n);
}
}, {
key: "invalidateKey",
value: function(t) {
var n = this;
this.lvls.forEach(function(r) {
return n.deleteCache(t, r);
});
}
// returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key)
}, {
key: "invalidate",
value: function(t) {
var n = t.id(), r = this.keyForId.get(n);
this.deleteKeyMappingFor(t);
var o = this.doesEleInvalidateKey(t);
return o && this.invalidateKey(r), o || this.getNumberOfIdsForKey(r) === 0;
}
}]), e;
}(), TF = 25, fv = 50, eg = -4, QC = 3, D2e = 7.99, B2e = 8, z2e = 1024, j2e = 1024, V2e = 1024, H2e = 0.2, U2e = 0.8, q2e = 10, K2e = 0.15, G2e = 0.1, W2e = 0.9, Y2e = 0.9, X2e = 100, Z2e = 1, kc = {
dequeue: "dequeue",
downscale: "downscale",
highQuality: "highQuality"
}, J2e = Br({
getKey: null,
doesEleInvalidateKey: zg,
drawElement: null,
getBoundingBox: null,
getRotationPoint: null,
getRotationOffset: null,
isVisible: IB,
allowEdgeTxrCaching: !0,
allowParentTxrCaching: !0
}), xp = function(e, t) {
var n = this;
n.renderer = e, n.onDequeues = [];
var r = J2e(t);
_t(n, r), n.lookup = new M2e(r.getKey, r.doesEleInvalidateKey), n.setupDequeueing();
}, pr = xp.prototype;
pr.reasons = kc;
pr.getTextureQueue = function(e) {
var t = this;
return t.eleImgCaches = t.eleImgCaches || {}, t.eleImgCaches[e] = t.eleImgCaches[e] || [];
};
pr.getRetiredTextureQueue = function(e) {
var t = this, n = t.eleImgCaches.retired = t.eleImgCaches.retired || {}, r = n[e] = n[e] || [];
return r;
};
pr.getElementQueue = function() {
var e = this, t = e.eleCacheQueue = e.eleCacheQueue || new rh(function(n, r) {
return r.reqs - n.reqs;
});
return t;
};
pr.getElementKeyToQueue = function() {
var e = this, t = e.eleKeyToCacheQueue = e.eleKeyToCacheQueue || {};
return t;
};
pr.getElement = function(e, t, n, r, o) {
var a = this, i = this.renderer, s = i.cy.zoom(), l = this.lookup;
if (!t || t.w === 0 || t.h === 0 || isNaN(t.w) || isNaN(t.h) || !e.visible() || e.removed() || !a.allowEdgeTxrCaching && e.isEdge() || !a.allowParentTxrCaching && e.isParent())
return null;
if (r == null && (r = Math.ceil(m$(s * n))), r < eg)
r = eg;
else if (s >= D2e || r > QC)
return null;
var u = Math.pow(2, r), c = t.h * u, d = t.w * u, p = i.eleTextBiggerThanMin(e, u);
if (!this.isVisible(e, p))
return null;
var h = l.get(e, r);
if (h && h.invalidated && (h.invalidated = !1, h.texture.invalidatedWidth -= h.width), h)
return h;
var f;
if (c <= TF ? f = TF : c <= fv ? f = fv : f = Math.ceil(c / fv) * fv, c > V2e || d > j2e)
return null;
var v = a.getTextureQueue(f), m = v[v.length - 2], g = function() {
return a.recycleTexture(f, d) || a.addTexture(f, d);
};
m || (m = v[v.length - 1]), m || (m = g()), m.width - m.usedWidth < d && (m = g());
for (var b = function(j) {
return j && j.scaledLabelShown === p;
}, x = o && o === kc.dequeue, w = o && o === kc.highQuality, k = o && o === kc.downscale, C, _ = r + 1; _ <= QC; _++) {
var $ = l.get(e, _);
if ($) {
C = $;
break;
}
}
var O = C && C.level === r + 1 ? C : null, F = function() {
m.context.drawImage(O.texture.canvas, O.x, 0, O.width, O.height, m.usedWidth, 0, d, c);
};
if (m.context.setTransform(1, 0, 0, 1, 0, 0), m.context.clearRect(m.usedWidth, 0, d, f), b(O))
F();
else if (b(C))
if (w) {
for (var A = C.level; A > r; A--)
O = a.getElement(e, t, n, A, kc.downscale);
F();
} else
return a.queueElement(e, C.level - 1), C;
else {
var T;
if (!x && !w && !k)
for (var R = r - 1; R >= eg; R--) {
var M = l.get(e, R);
if (M) {
T = M;
break;
}
}
if (b(T))
return a.queueElement(e, r), T;
m.context.translate(m.usedWidth, 0), m.context.scale(u, u), this.drawElement(m.context, e, t, p, !1), m.context.scale(1 / u, 1 / u), m.context.translate(-m.usedWidth, 0);
}
return h = {
x: m.usedWidth,
texture: m,
level: r,
scale: u,
width: d,
height: c,
scaledLabelShown: p
}, m.usedWidth += Math.ceil(d + B2e), m.eleCaches.push(h), l.set(e, r, h), a.checkTextureFullness(m), h;
};
pr.invalidateElements = function(e) {
for (var t = 0; t < e.length; t++)
this.invalidateElement(e[t]);
};
pr.invalidateElement = function(e) {
var t = this, n = t.lookup, r = [], o = n.isInvalid(e);
if (o) {
for (var a = eg; a <= QC; a++) {
var i = n.getForCachedKey(e, a);
i && r.push(i);
}
var s = n.invalidate(e);
if (s)
for (var l = 0; l < r.length; l++) {
var u = r[l], c = u.texture;
c.invalidatedWidth += u.width, u.invalidated = !0, t.checkTextureUtility(c);
}
t.removeFromQueue(e);
}
};
pr.checkTextureUtility = function(e) {
e.invalidatedWidth >= H2e * e.width && this.retireTexture(e);
};
pr.checkTextureFullness = function(e) {
var t = this, n = t.getTextureQueue(e.height);
e.usedWidth / e.width > U2e && e.fullnessChecks >= q2e ? al(n, e) : e.fullnessChecks++;
};
pr.retireTexture = function(e) {
var t = this, n = e.height, r = t.getTextureQueue(n), o = this.lookup;
al(r, e), e.retired = !0;
for (var a = e.eleCaches, i = 0; i < a.length; i++) {
var s = a[i];
o.deleteCache(s.key, s.level);
}
g$(a);
var l = t.getRetiredTextureQueue(n);
l.push(e);
};
pr.addTexture = function(e, t) {
var n = this, r = n.getTextureQueue(e), o = {};
return r.push(o), o.eleCaches = [], o.height = e, o.width = Math.max(z2e, t), o.usedWidth = 0, o.invalidatedWidth = 0, o.fullnessChecks = 0, o.canvas = n.renderer.makeOffscreenCanvas(o.width, o.height), o.context = o.canvas.getContext("2d"), o;
};
pr.recycleTexture = function(e, t) {
for (var n = this, r = n.getTextureQueue(e), o = n.getRetiredTextureQueue(e), a = 0; a < o.length; a++) {
var i = o[a];
if (i.width >= t)
return i.retired = !1, i.usedWidth = 0, i.invalidatedWidth = 0, i.fullnessChecks = 0, g$(i.eleCaches), i.context.setTransform(1, 0, 0, 1, 0, 0), i.context.clearRect(0, 0, i.width, i.height), al(o, i), r.push(i), i;
}
};
pr.queueElement = function(e, t) {
var n = this, r = n.getElementQueue(), o = n.getElementKeyToQueue(), a = this.getKey(e), i = o[a];
if (i)
i.level = Math.max(i.level, t), i.eles.merge(e), i.reqs++, r.updateItem(i);
else {
var s = {
eles: e.spawn().merge(e),
level: t,
reqs: 1,
key: a
};
r.push(s), o[a] = s;
}
};
pr.dequeue = function(e) {
for (var t = this, n = t.getElementQueue(), r = t.getElementKeyToQueue(), o = [], a = t.lookup, i = 0; i < Z2e && n.size() > 0; i++) {
var s = n.pop(), l = s.key, u = s.eles[0], c = a.hasCache(u, s.level);
if (r[l] = null, !c) {
o.push(s);
var d = t.getBoundingBox(u);
t.getElement(u, d, e, s.level, kc.dequeue);
}
}
return o;
};
pr.removeFromQueue = function(e) {
var t = this, n = t.getElementQueue(), r = t.getElementKeyToQueue(), o = this.getKey(e), a = r[o];
a != null && (a.eles.length === 1 ? (a.reqs = h$, n.updateItem(a), n.pop(), r[o] = null) : a.eles.unmerge(e));
};
pr.onDequeue = function(e) {
this.onDequeues.push(e);
};
pr.offDequeue = function(e) {
al(this.onDequeues, e);
};
pr.setupDequeueing = jz.setupDequeueing({
deqRedrawThreshold: X2e,
deqCost: K2e,
deqAvgCost: G2e,
deqNoDrawCost: W2e,
deqFastCost: Y2e,
deq: function(e, t, n) {
return e.dequeue(t, n);
},
onDeqd: function(e, t) {
for (var n = 0; n < e.onDequeues.length; n++) {
var r = e.onDequeues[n];
r(t);
}
},
shouldRedraw: function(e, t, n, r) {
for (var o = 0; o < t.length; o++)
for (var a = t[o].eles, i = 0; i < a.length; i++) {
var s = a[i].boundingBox();
if (y$(s, r))
return !0;
}
return !1;
},
priority: function(e) {
return e.renderer.beforeRenderPriorities.eleTxrDeq;
}
});
var Q2e = 1, Pp = -4, Wg = 2, exe = 3.99, txe = 50, nxe = 50, rxe = 0.15, oxe = 0.1, axe = 0.9, ixe = 0.9, sxe = 1, AF = 250, lxe = 4e3 * 4e3, uxe = !0, Vz = function(e) {
var t = this, n = t.renderer = e, r = n.cy;
t.layersByLevel = {}, t.firstGet = !0, t.lastInvalidationTime = ns() - 2 * AF, t.skipping = !1, t.eleTxrDeqs = r.collection(), t.scheduleElementRefinement = fm(function() {
t.refineElementTextures(t.eleTxrDeqs), t.eleTxrDeqs.unmerge(t.eleTxrDeqs);
}, nxe), n.beforeRender(function(a, i) {
i - t.lastInvalidationTime <= AF ? t.skipping = !0 : t.skipping = !1;
}, n.beforeRenderPriorities.lyrTxrSkip);
var o = function(a, i) {
return i.reqs - a.reqs;
};
t.layersQueue = new rh(o), t.setupDequeueing();
}, zr = Vz.prototype, IF = 0, cxe = Math.pow(2, 53) - 1;
zr.makeLayer = function(e, t) {
var n = Math.pow(2, t), r = Math.ceil(e.w * n), o = Math.ceil(e.h * n), a = this.renderer.makeOffscreenCanvas(r, o), i = {
id: IF = ++IF % cxe,
bb: e,
level: t,
width: r,
height: o,
canvas: a,
context: a.getContext("2d"),
eles: [],
elesQueue: [],
reqs: 0
}, s = i.context, l = -i.bb.x1, u = -i.bb.y1;
return s.scale(n, n), s.translate(l, u), i;
};
zr.getLayers = function(e, t, n) {
var r = this, o = r.renderer, a = o.cy, i = a.zoom(), s = r.firstGet;
if (r.firstGet = !1, n == null) {
if (n = Math.ceil(m$(i * t)), n < Pp)
n = Pp;
else if (i >= exe || n > Wg)
return null;
}
r.validateLayersElesOrdering(n, e);
var l = r.layersByLevel, u = Math.pow(2, n), c = l[n] = l[n] || [], d, p = r.levelIsComplete(n, e), h, f = function() {
var O = function(R) {
if (r.validateLayersElesOrdering(R, e), r.levelIsComplete(R, e))
return h = l[R], !0;
}, F = function(R) {
if (!h)
for (var M = n + R; Pp <= M && M <= Wg && !O(M); M += R)
;
};
F(1), F(-1);
for (var A = c.length - 1; A >= 0; A--) {
var T = c[A];
T.invalid && al(c, T);
}
};
if (!p)
f();
else
return c;
var v = function() {
if (!d) {
d = Fo();
for (var O = 0; O < e.length; O++)
DB(d, e[O].boundingBox());
}
return d;
}, m = function(O) {
O = O || {};
var F = O.after;
v();
var A = d.w * u * (d.h * u);
if (A > lxe)
return null;
var T = r.makeLayer(d, n);
if (F != null) {
var R = c.indexOf(F) + 1;
c.splice(R, 0, T);
} else (O.insert === void 0 || O.insert) && c.unshift(T);
return T;
};
if (r.skipping && !s)
return null;
for (var g = null, b = e.length / Q2e, x = !s, w = 0; w < e.length; w++) {
var k = e[w], C = k._private.rscratch, _ = C.imgLayerCaches = C.imgLayerCaches || {}, $ = _[n];
if ($) {
g = $;
continue;
}
if ((!g || g.eles.length >= b || !BB(g.bb, k.boundingBox())) && (g = m({
insert: !0,
after: g
}), !g))
return null;
h || x ? r.queueLayer(g, k) : r.drawEleInLayer(g, k, n, t), g.eles.push(k), _[n] = g;
}
return h || (x ? null : c);
};
zr.getEleLevelForLayerLevel = function(e, t) {
return e;
};
zr.drawEleInLayer = function(e, t, n, r) {
var o = this, a = this.renderer, i = e.context, s = t.boundingBox();
s.w === 0 || s.h === 0 || !t.visible() || (n = o.getEleLevelForLayerLevel(n, r), a.setImgSmoothing(i, !1), a.drawCachedElement(i, t, null, null, n, uxe), a.setImgSmoothing(i, !0));
};
zr.levelIsComplete = function(e, t) {
var n = this, r = n.layersByLevel[e];
if (!r || r.length === 0)
return !1;
for (var o = 0, a = 0; a < r.length; a++) {
var i = r[a];
if (i.reqs > 0 || i.invalid)
return !1;
o += i.eles.length;
}
return o === t.length;
};
zr.validateLayersElesOrdering = function(e, t) {
var n = this.layersByLevel[e];
if (n)
for (var r = 0; r < n.length; r++) {
for (var o = n[r], a = -1, i = 0; i < t.length; i++)
if (o.eles[0] === t[i]) {
a = i;
break;
}
if (a < 0) {
this.invalidateLayer(o);
continue;
}
for (var s = a, i = 0; i < o.eles.length; i++)
if (o.eles[i] !== t[s + i]) {
this.invalidateLayer(o);
break;
}
}
};
zr.updateElementsInLayers = function(e, t) {
for (var n = this, r = th(e[0]), o = 0; o < e.length; o++)
for (var a = r ? null : e[o], i = r ? e[o] : e[o].ele, s = i._private.rscratch, l = s.imgLayerCaches = s.imgLayerCaches || {}, u = Pp; u <= Wg; u++) {
var c = l[u];
c && (a && n.getEleLevelForLayerLevel(c.level) !== a.level || t(c, i, a));
}
};
zr.haveLayers = function() {
for (var e = this, t = !1, n = Pp; n <= Wg; n++) {
var r = e.layersByLevel[n];
if (r && r.length > 0) {
t = !0;
break;
}
}
return t;
};
zr.invalidateElements = function(e) {
var t = this;
e.length !== 0 && (t.lastInvalidationTime = ns(), !(e.length === 0 || !t.haveLayers()) && t.updateElementsInLayers(e, function(n, r, o) {
t.invalidateLayer(n);
}));
};
zr.invalidateLayer = function(e) {
if (this.lastInvalidationTime = ns(), !e.invalid) {
var t = e.level, n = e.eles, r = this.layersByLevel[t];
al(r, e), e.elesQueue = [], e.invalid = !0, e.replacement && (e.replacement.invalid = !0);
for (var o = 0; o < n.length; o++) {
var a = n[o]._private.rscratch.imgLayerCaches;
a && (a[t] = null);
}
}
};
zr.refineElementTextures = function(e) {
var t = this;
t.updateElementsInLayers(e, function(n, r, o) {
var a = n.replacement;
if (a || (a = n.replacement = t.makeLayer(n.bb, n.level), a.replaces = n, a.eles = n.eles), !a.reqs)
for (var i = 0; i < a.eles.length; i++)
t.queueLayer(a, a.eles[i]);
});
};
zr.enqueueElementRefinement = function(e) {
this.eleTxrDeqs.merge(e), this.scheduleElementRefinement();
};
zr.queueLayer = function(e, t) {
var n = this, r = n.layersQueue, o = e.elesQueue, a = o.hasId = o.hasId || {};
if (!e.replacement) {
if (t) {
if (a[t.id()])
return;
o.push(t), a[t.id()] = !0;
}
e.reqs ? (e.reqs++, r.updateItem(e)) : (e.reqs = 1, r.push(e));
}
};
zr.dequeue = function(e) {
for (var t = this, n = t.layersQueue, r = [], o = 0; o < sxe && n.size() !== 0; ) {
var a = n.peek();
if (a.replacement) {
n.pop();
continue;
}
if (a.replaces && a !== a.replaces.replacement) {
n.pop();
continue;
}
if (a.invalid) {
n.pop();
continue;
}
var i = a.elesQueue.shift();
i && (t.drawEleInLayer(a, i, a.level, e), o++), r.length === 0 && r.push(!0), a.elesQueue.length === 0 && (n.pop(), a.reqs = 0, a.replaces && t.applyLayerReplacement(a), t.requestRedraw());
}
return r;
};
zr.applyLayerReplacement = function(e) {
var t = this, n = t.layersByLevel[e.level], r = e.replaces, o = n.indexOf(r);
if (!(o < 0 || r.invalid)) {
n[o] = e;
for (var a = 0; a < e.eles.length; a++) {
var i = e.eles[a]._private, s = i.imgLayerCaches = i.imgLayerCaches || {};
s && (s[e.level] = e);
}
t.requestRedraw();
}
};
zr.requestRedraw = fm(function() {
var e = this.renderer;
e.redrawHint("eles", !0), e.redrawHint("drag", !0), e.redraw();
}, 100);
zr.setupDequeueing = jz.setupDequeueing({
deqRedrawThreshold: txe,
deqCost: rxe,
deqAvgCost: oxe,
deqNoDrawCost: axe,
deqFastCost: ixe,
deq: function(e, t) {
return e.dequeue(t);
},
onDeqd: v$,
shouldRedraw: IB,
priority: function(e) {
return e.renderer.beforeRenderPriorities.lyrTxrDeq;
}
});
var Hz = {}, PF;
function dxe(e, t) {
for (var n = 0; n < t.length; n++) {
var r = t[n];
e.lineTo(r.x, r.y);
}
}
function pxe(e, t, n) {
for (var r, o = 0; o < t.length; o++) {
var a = t[o];
o === 0 && (r = a), e.lineTo(a.x, a.y);
}
e.quadraticCurveTo(n.x, n.y, r.x, r.y);
}
function LF(e, t, n) {
e.beginPath && e.beginPath();
for (var r = t, o = 0; o < r.length; o++) {
var a = r[o];
e.lineTo(a.x, a.y);
}
var i = n, s = n[0];
e.moveTo(s.x, s.y);
for (var o = 1; o < i.length; o++) {
var a = i[o];
e.lineTo(a.x, a.y);
}
e.closePath && e.closePath();
}
function fxe(e, t, n, r, o) {
e.beginPath && e.beginPath(), e.arc(n, r, o, 0, Math.PI * 2, !1);
var a = t, i = a[0];
e.moveTo(i.x, i.y);
for (var s = 0; s < a.length; s++) {
var l = a[s];
e.lineTo(l.x, l.y);
}
e.closePath && e.closePath();
}
function hxe(e, t, n, r) {
e.arc(t, n, r, 0, Math.PI * 2, !1);
}
Hz.arrowShapeImpl = function(e) {
return (PF || (PF = {
polygon: dxe,
"triangle-backcurve": pxe,
"triangle-tee": LF,
"circle-triangle": fxe,
"triangle-cross": LF,
circle: hxe
}))[e];
};
var Ti = {};
Ti.drawElement = function(e, t, n, r, o, a) {
var i = this;
t.isNode() ? i.drawNode(e, t, n, r, o, a) : i.drawEdge(e, t, n, r, o, a);
};
Ti.drawElementOverlay = function(e, t) {
var n = this;
t.isNode() ? n.drawNodeOverlay(e, t) : n.drawEdgeOverlay(e, t);
};
Ti.drawElementUnderlay = function(e, t) {
var n = this;
t.isNode() ? n.drawNodeUnderlay(e, t) : n.drawEdgeUnderlay(e, t);
};
Ti.drawCachedElementPortion = function(e, t, n, r, o, a, i, s) {
var l = this, u = n.getBoundingBox(t);
if (!(u.w === 0 || u.h === 0)) {
var c = n.getElement(t, u, r, o, a);
if (c != null) {
var d = s(l, t);
if (d === 0)
return;
var p = i(l, t), h = u.x1, f = u.y1, v = u.w, m = u.h, g, b, x, w, k;
if (p !== 0) {
var C = n.getRotationPoint(t);
x = C.x, w = C.y, e.translate(x, w), e.rotate(p), k = l.getImgSmoothing(e), k || l.setImgSmoothing(e, !0);
var _ = n.getRotationOffset(t);
g = _.x, b = _.y;
} else
g = h, b = f;
var $;
d !== 1 && ($ = e.globalAlpha, e.globalAlpha = $ * d), e.drawImage(c.texture.canvas, c.x, 0, c.width, c.height, g, b, v, m), d !== 1 && (e.globalAlpha = $), p !== 0 && (e.rotate(-p), e.translate(-x, -w), k || l.setImgSmoothing(e, !1));
} else
n.drawElement(e, t);
}
};
var vxe = function() {
return 0;
}, gxe = function(e, t) {
return e.getTextAngle(t, null);
}, mxe = function(e, t) {
return e.getTextAngle(t, "source");
}, yxe = function(e, t) {
return e.getTextAngle(t, "target");
}, bxe = function(e, t) {
return t.effectiveOpacity();
}, xy = function(e, t) {
return t.pstyle("text-opacity").pfValue * t.effectiveOpacity();
};
Ti.drawCachedElement = function(e, t, n, r, o, a) {
var i = this, s = i.data, l = s.eleTxrCache, u = s.lblTxrCache, c = s.slbTxrCache, d = s.tlbTxrCache, p = t.boundingBox(), h = a === !0 ? l.reasons.highQuality : null;
if (!(p.w === 0 || p.h === 0 || !t.visible()) && (!r || y$(p, r))) {
var f = t.isEdge(), v = t.element()._private.rscratch.badLine;
i.drawElementUnderlay(e, t), i.drawCachedElementPortion(e, t, l, n, o, h, vxe, bxe), (!f || !v) && i.drawCachedElementPortion(e, t, u, n, o, h, gxe, xy), f && !v && (i.drawCachedElementPortion(e, t, c, n, o, h, mxe, xy), i.drawCachedElementPortion(e, t, d, n, o, h, yxe, xy)), i.drawElementOverlay(e, t);
}
};
Ti.drawElements = function(e, t) {
for (var n = this, r = 0; r < t.length; r++) {
var o = t[r];
n.drawElement(e, o);
}
};
Ti.drawCachedElements = function(e, t, n, r) {
for (var o = this, a = 0; a < t.length; a++) {
var i = t[a];
o.drawCachedElement(e, i, n, r);
}
};
Ti.drawCachedNodes = function(e, t, n, r) {
for (var o = this, a = 0; a < t.length; a++) {
var i = t[a];
i.isNode() && o.drawCachedElement(e, i, n, r);
}
};
Ti.drawLayeredElements = function(e, t, n, r) {
var o = this, a = o.data.lyrTxrCache.getLayers(t, n);
if (a)
for (var i = 0; i < a.length; i++) {
var s = a[i], l = s.bb;
l.w === 0 || l.h === 0 || e.drawImage(s.canvas, l.x1, l.y1, l.w, l.h);
}
else
o.drawCachedElements(e, t, n, r);
};
var gs = {};
gs.drawEdge = function(e, t, n) {
var r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, i = this, s = t._private.rscratch;
if (!(a && !t.visible()) && !(s.badLine || s.allpts == null || isNaN(s.allpts[0]))) {
var l;
n && (l = n, e.translate(-l.x1, -l.y1));
var u = a ? t.pstyle("opacity").value : 1, c = a ? t.pstyle("line-opacity").value : 1, d = t.pstyle("curve-style").value, p = t.pstyle("line-style").value, h = t.pstyle("width").pfValue, f = t.pstyle("line-cap").value, v = t.pstyle("line-outline-width").value, m = t.pstyle("line-outline-color").value, g = u * c, b = u * c, x = function() {
var M = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : g;
d === "straight-triangle" ? (i.eleStrokeStyle(e, t, M), i.drawEdgeTrianglePath(t, e, s.allpts)) : (e.lineWidth = h, e.lineCap = f, i.eleStrokeStyle(e, t, M), i.drawEdgePath(t, e, s.allpts, p), e.lineCap = "butt");
}, w = function() {
var M = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : g;
if (e.lineWidth = h + v, e.lineCap = f, v > 0)
i.colorStrokeStyle(e, m[0], m[1], m[2], M);
else {
e.lineCap = "butt";
return;
}
d === "straight-triangle" ? i.drawEdgeTrianglePath(t, e, s.allpts) : (i.drawEdgePath(t, e, s.allpts, p), e.lineCap = "butt");
}, k = function() {
o && i.drawEdgeOverlay(e, t);
}, C = function() {
o && i.drawEdgeUnderlay(e, t);
}, _ = function() {
var M = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : b;
i.drawArrowheads(e, t, M);
}, $ = function() {
i.drawElementText(e, t, null, r);
};
e.lineJoin = "round";
var O = t.pstyle("ghost").value === "yes";
if (O) {
var F = t.pstyle("ghost-offset-x").pfValue, A = t.pstyle("ghost-offset-y").pfValue, T = t.pstyle("ghost-opacity").value, R = g * T;
e.translate(F, A), x(R), _(R), e.translate(-F, -A);
} else
w();
C(), x(), _(), k(), $(), n && e.translate(l.x1, l.y1);
}
};
var Uz = function(e) {
if (!["overlay", "underlay"].includes(e))
throw new Error("Invalid state");
return function(t, n) {
if (n.visible()) {
var r = n.pstyle("".concat(e, "-opacity")).value;
if (r !== 0) {
var o = this, a = o.usePaths(), i = n._private.rscratch, s = n.pstyle("".concat(e, "-padding")).pfValue, l = 2 * s, u = n.pstyle("".concat(e, "-color")).value;
t.lineWidth = l, i.edgeType === "self" && !a ? t.lineCap = "butt" : t.lineCap = "round", o.colorStrokeStyle(t, u[0], u[1], u[2], r), o.drawEdgePath(n, t, i.allpts, "solid");
}
}
};
};
gs.drawEdgeOverlay = Uz("overlay");
gs.drawEdgeUnderlay = Uz("underlay");
gs.drawEdgePath = function(e, t, n, r) {
var o = e._private.rscratch, a = t, i, s = !1, l = this.usePaths(), u = e.pstyle("line-dash-pattern").pfValue, c = e.pstyle("line-dash-offset").pfValue;
if (l) {
var d = n.join("$"), p = o.pathCacheKey && o.pathCacheKey === d;
p ? (i = t = o.pathCache, s = !0) : (i = t = new Path2D(), o.pathCacheKey = d, o.pathCache = i);
}
if (a.setLineDash)
switch (r) {
case "dotted":
a.setLineDash([1, 1]);
break;
case "dashed":
a.setLineDash(u), a.lineDashOffset = c;
break;
case "solid":
a.setLineDash([]);
break;
}
if (!s && !o.badLine)
switch (t.beginPath && t.beginPath(), t.moveTo(n[0], n[1]), o.edgeType) {
case "bezier":
case "self":
case "compound":
case "multibezier":
for (var h = 2; h + 3 < n.length; h += 4)
t.quadraticCurveTo(n[h], n[h + 1], n[h + 2], n[h + 3]);
break;
case "straight":
case "haystack":
for (var f = 2; f + 1 < n.length; f += 2)
t.lineTo(n[f], n[f + 1]);
break;
case "segments":
if (o.isRound) {
var v = yB(o.roundCorners), m;
try {
for (v.s(); !(m = v.n()).done; ) {
var g = m.value;
Pz(t, g);
}
} catch (x) {
v.e(x);
} finally {
v.f();
}
t.lineTo(n[n.length - 2], n[n.length - 1]);
} else
for (var b = 2; b + 1 < n.length; b += 2)
t.lineTo(n[b], n[b + 1]);
break;
}
t = a, l ? t.stroke(i) : t.stroke(), t.setLineDash && t.setLineDash([]);
};
gs.drawEdgeTrianglePath = function(e, t, n) {
t.fillStyle = t.strokeStyle;
for (var r = e.pstyle("width").pfValue, o = 0; o + 1 < n.length; o += 2) {
var a = [n[o + 2] - n[o], n[o + 3] - n[o + 1]], i = Math.sqrt(a[0] * a[0] + a[1] * a[1]), s = [a[1] / i, -a[0] / i], l = [s[0] * r / 2, s[1] * r / 2];
t.beginPath(), t.moveTo(n[o] - l[0], n[o + 1] - l[1]), t.lineTo(n[o] + l[0], n[o + 1] + l[1]), t.lineTo(n[o + 2], n[o + 3]), t.closePath(), t.fill();
}
};
gs.drawArrowheads = function(e, t, n) {
var r = t._private.rscratch, o = r.edgeType === "haystack";
o || this.drawArrowhead(e, t, "source", r.arrowStartX, r.arrowStartY, r.srcArrowAngle, n), this.drawArrowhead(e, t, "mid-target", r.midX, r.midY, r.midtgtArrowAngle, n), this.drawArrowhead(e, t, "mid-source", r.midX, r.midY, r.midsrcArrowAngle, n), o || this.drawArrowhead(e, t, "target", r.arrowEndX, r.arrowEndY, r.tgtArrowAngle, n);
};
gs.drawArrowhead = function(e, t, n, r, o, a, i) {
if (!(isNaN(r) || r == null || isNaN(o) || o == null || isNaN(a) || a == null)) {
var s = this, l = t.pstyle(n + "-arrow-shape").value;
if (l !== "none") {
var u = t.pstyle(n + "-arrow-fill").value === "hollow" ? "both" : "filled", c = t.pstyle(n + "-arrow-fill").value, d = t.pstyle("width").pfValue, p = t.pstyle(n + "-arrow-width"), h = p.value === "match-line" ? d : p.pfValue;
p.units === "%" && (h *= d);
var f = t.pstyle("opacity").value;
i === void 0 && (i = f);
var v = e.globalCompositeOperation;
(i !== 1 || c === "hollow") && (e.globalCompositeOperation = "destination-out", s.colorFillStyle(e, 255, 255, 255, 1), s.colorStrokeStyle(e, 255, 255, 255, 1), s.drawArrowShape(t, e, u, d, l, h, r, o, a), e.globalCompositeOperation = v);
var m = t.pstyle(n + "-arrow-color").value;
s.colorFillStyle(e, m[0], m[1], m[2], i), s.colorStrokeStyle(e, m[0], m[1], m[2], i), s.drawArrowShape(t, e, c, d, l, h, r, o, a);
}
}
};
gs.drawArrowShape = function(e, t, n, r, o, a, i, s, l) {
var u = this, c = this.usePaths() && o !== "triangle-cross", d = !1, p, h = t, f = {
x: i,
y: s
}, v = e.pstyle("arrow-scale").value, m = this.getArrowWidth(r, v), g = u.arrowShapes[o];
if (c) {
var b = u.arrowPathCache = u.arrowPathCache || [], x = pu(o), w = b[x];
w != null ? (p = t = w, d = !0) : (p = t = new Path2D(), b[x] = p);
}
d || (t.beginPath && t.beginPath(), c ? g.draw(t, 1, 0, {
x: 0,
y: 0
}, 1) : g.draw(t, m, l, f, r), t.closePath && t.closePath()), t = h, c && (t.translate(i, s), t.rotate(l), t.scale(m, m)), (n === "filled" || n === "both") && (c ? t.fill(p) : t.fill()), (n === "hollow" || n === "both") && (t.lineWidth = a / (c ? m : 1), t.lineJoin = "miter", c ? t.stroke(p) : t.stroke()), c && (t.scale(1 / m, 1 / m), t.rotate(-l), t.translate(-i, -s));
};
var P$ = {};
P$.safeDrawImage = function(e, t, n, r, o, a, i, s, l, u) {
if (!(o <= 0 || a <= 0 || l <= 0 || u <= 0))
try {
e.drawImage(t, n, r, o, a, i, s, l, u);
} catch (c) {
sn(c);
}
};
P$.drawInscribedImage = function(e, t, n, r, o) {
var a = this, i = n.position(), s = i.x, l = i.y, u = n.cy().style(), c = u.getIndexedStyle.bind(u), d = c(n, "background-fit", "value", r), p = c(n, "background-repeat", "value", r), h = n.width(), f = n.height(), v = n.padding() * 2, m = h + (c(n, "background-width-relative-to", "value", r) === "inner" ? 0 : v), g = f + (c(n, "background-height-relative-to", "value", r) === "inner" ? 0 : v), b = n._private.rscratch, x = c(n, "background-clip", "value", r), w = x === "node", k = c(n, "background-image-opacity", "value", r) * o, C = c(n, "background-image-smoothing", "value", r), _ = n.pstyle("corner-radius").value;
_ !== "auto" && (_ = n.pstyle("corner-radius").pfValue);
var $ = t.width || t.cachedW, O = t.height || t.cachedH;
($ == null || O == null) && (document.body.appendChild(t), $ = t.cachedW = t.width || t.offsetWidth, O = t.cachedH = t.height || t.offsetHeight, document.body.removeChild(t));
var F = $, A = O;
if (c(n, "background-width", "value", r) !== "auto" && (c(n, "background-width", "units", r) === "%" ? F = c(n, "background-width", "pfValue", r) * m : F = c(n, "background-width", "pfValue", r)), c(n, "background-height", "value", r) !== "auto" && (c(n, "background-height", "units", r) === "%" ? A = c(n, "background-height", "pfValue", r) * g : A = c(n, "background-height", "pfValue", r)), !(F === 0 || A === 0)) {
if (d === "contain") {
var T = Math.min(m / F, g / A);
F *= T, A *= T;
} else if (d === "cover") {
var T = Math.max(m / F, g / A);
F *= T, A *= T;
}
var R = s - m / 2, M = c(n, "background-position-x", "units", r), j = c(n, "background-position-x", "pfValue", r);
M === "%" ? R += (m - F) * j : R += j;
var P = c(n, "background-offset-x", "units", r), V = c(n, "background-offset-x", "pfValue", r);
P === "%" ? R += (m - F) * V : R += V;
var U = l - g / 2, G = c(n, "background-position-y", "units", r), se = c(n, "background-position-y", "pfValue", r);
G === "%" ? U += (g - A) * se : U += se;
var ae = c(n, "background-offset-y", "units", r), de = c(n, "background-offset-y", "pfValue", r);
ae === "%" ? U += (g - A) * de : U += de, b.pathCache && (R -= s, U -= l, s = 0, l = 0);
var me = e.globalAlpha;
e.globalAlpha = k;
var te = a.getImgSmoothing(e), oe = !1;
if (C === "no" && te ? (a.setImgSmoothing(e, !1), oe = !0) : C === "yes" && !te && (a.setImgSmoothing(e, !0), oe = !0), p === "no-repeat")
w && (e.save(), b.pathCache ? e.clip(b.pathCache) : (a.nodeShapes[a.getNodeShape(n)].draw(e, s, l, m, g, _, b), e.clip())), a.safeDrawImage(e, t, 0, 0, $, O, R, U, F, A), w && e.restore();
else {
var ne = e.createPattern(t, p);
e.fillStyle = ne, a.nodeShapes[a.getNodeShape(n)].draw(e, s, l, m, g, _, b), e.translate(R, U), e.fill(), e.translate(-R, -U);
}
e.globalAlpha = me, oe && a.setImgSmoothing(e, te);
}
};
var Du = {};
Du.eleTextBiggerThanMin = function(e, t) {
if (!t) {
var n = e.cy().zoom(), r = this.getPixelRatio(), o = Math.ceil(m$(n * r));
t = Math.pow(2, o);
}
var a = e.pstyle("font-size").pfValue * t, i = e.pstyle("min-zoomed-font-size").pfValue;
return !(a < i);
};
Du.drawElementText = function(e, t, n, r, o) {
var a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, i = this;
if (r == null) {
if (a && !i.eleTextBiggerThanMin(t))
return;
} else if (r === !1)
return;
if (t.isNode()) {
var s = t.pstyle("label");
if (!s || !s.value)
return;
var l = i.getLabelJustification(t);
e.textAlign = l, e.textBaseline = "bottom";
} else {
var u = t.element()._private.rscratch.badLine, c = t.pstyle("label"), d = t.pstyle("source-label"), p = t.pstyle("target-label");
if (u || (!c || !c.value) && (!d || !d.value) && (!p || !p.value))
return;
e.textAlign = "center", e.textBaseline = "bottom";
}
var h = !n, f;
n && (f = n, e.translate(-f.x1, -f.y1)), o == null ? (i.drawText(e, t, null, h, a), t.isEdge() && (i.drawText(e, t, "source", h, a), i.drawText(e, t, "target", h, a))) : i.drawText(e, t, o, h, a), n && e.translate(f.x1, f.y1);
};
Du.getFontCache = function(e) {
var t;
this.fontCaches = this.fontCaches || [];
for (var n = 0; n < this.fontCaches.length; n++)
if (t = this.fontCaches[n], t.context === e)
return t;
return t = {
context: e
}, this.fontCaches.push(t), t;
};
Du.setupTextStyle = function(e, t) {
var n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0, r = t.pstyle("font-style").strValue, o = t.pstyle("font-size").pfValue + "px", a = t.pstyle("font-family").strValue, i = t.pstyle("font-weight").strValue, s = n ? t.effectiveOpacity() * t.pstyle("text-opacity").value : 1, l = t.pstyle("text-outline-opacity").value * s, u = t.pstyle("color").value, c = t.pstyle("text-outline-color").value;
e.font = r + " " + i + " " + o + " " + a, e.lineJoin = "round", this.colorFillStyle(e, u[0], u[1], u[2], s), this.colorStrokeStyle(e, c[0], c[1], c[2], l);
};
function ky(e, t, n, r, o) {
var a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5, i = arguments.length > 6 ? arguments[6] : void 0;
e.beginPath(), e.moveTo(t + a, n), e.lineTo(t + r - a, n), e.quadraticCurveTo(t + r, n, t + r, n + a), e.lineTo(t + r, n + o - a), e.quadraticCurveTo(t + r, n + o, t + r - a, n + o), e.lineTo(t + a, n + o), e.quadraticCurveTo(t, n + o, t, n + o - a), e.lineTo(t, n + a), e.quadraticCurveTo(t, n, t + a, n), e.closePath(), i ? e.stroke() : e.fill();
}
Du.getTextAngle = function(e, t) {
var n, r = e._private, o = r.rscratch, a = t ? t + "-" : "", i = e.pstyle(a + "text-rotation"), s = La(o, "labelAngle", t);
return i.strValue === "autorotate" ? n = e.isEdge() ? s : 0 : i.strValue === "none" ? n = 0 : n = i.pfValue, n;
};
Du.drawText = function(e, t, n) {
var r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = t._private, i = a.rscratch, s = o ? t.effectiveOpacity() : 1;
if (!(o && (s === 0 || t.pstyle("text-opacity").value === 0))) {
n === "main" && (n = null);
var l = La(i, "labelX", n), u = La(i, "labelY", n), c, d, p = this.getLabelText(t, n);
if (p != null && p !== "" && !isNaN(l) && !isNaN(u)) {
this.setupTextStyle(e, t, o);
var h = n ? n + "-" : "", f = La(i, "labelWidth", n), v = La(i, "labelHeight", n), m = t.pstyle(h + "text-margin-x").pfValue, g = t.pstyle(h + "text-margin-y").pfValue, b = t.isEdge(), x = t.pstyle("text-halign").value, w = t.pstyle("text-valign").value;
b && (x = "center", w = "center"), l += m, u += g;
var k;
switch (r ? k = this.getTextAngle(t, n) : k = 0, k !== 0 && (c = l, d = u, e.translate(c, d), e.rotate(k), l = 0, u = 0), w) {
case "top":
break;
case "center":
u += v / 2;
break;
case "bottom":
u += v;
break;
}
var C = t.pstyle("text-background-opacity").value, _ = t.pstyle("text-border-opacity").value, $ = t.pstyle("text-border-width").pfValue, O = t.pstyle("text-background-padding").pfValue, F = t.pstyle("text-background-shape").strValue, A = F.indexOf("round") === 0, T = 2;
if (C > 0 || $ > 0 && _ > 0) {
var R = l - O;
switch (x) {
case "left":
R -= f;
break;
case "center":
R -= f / 2;
break;
}
var M = u - v - O, j = f + 2 * O, P = v + 2 * O;
if (C > 0) {
var V = e.fillStyle, U = t.pstyle("text-background-color").value;
e.fillStyle = "rgba(" + U[0] + "," + U[1] + "," + U[2] + "," + C * s + ")", A ? ky(e, R, M, j, P, T) : e.fillRect(R, M, j, P), e.fillStyle = V;
}
if ($ > 0 && _ > 0) {
var G = e.strokeStyle, se = e.lineWidth, ae = t.pstyle("text-border-color").value, de = t.pstyle("text-border-style").value;
if (e.strokeStyle = "rgba(" + ae[0] + "," + ae[1] + "," + ae[2] + "," + _ * s + ")", e.lineWidth = $, e.setLineDash)
switch (de) {
case "dotted":
e.setLineDash([1, 1]);
break;
case "dashed":
e.setLineDash([4, 2]);
break;
case "double":
e.lineWidth = $ / 4, e.setLineDash([]);
break;
case "solid":
e.setLineDash([]);
break;
}
if (A ? ky(e, R, M, j, P, T, "stroke") : e.strokeRect(R, M, j, P), de === "double") {
var me = $ / 2;
A ? ky(e, R + me, M + me, j - me * 2, P - me * 2, T, "stroke") : e.strokeRect(R + me, M + me, j - me * 2, P - me * 2);
}
e.setLineDash && e.setLineDash([]), e.lineWidth = se, e.strokeStyle = G;
}
}
var te = 2 * t.pstyle("text-outline-width").pfValue;
if (te > 0 && (e.lineWidth = te), t.pstyle("text-wrap").value === "wrap") {
var oe = La(i, "labelWrapCachedLines", n), ne = La(i, "labelLineHeight", n), ee = f / 2, Z = this.getLabelJustification(t);
switch (Z === "auto" || (x === "left" ? Z === "left" ? l += -f : Z === "center" && (l += -ee) : x === "center" ? Z === "left" ? l += -ee : Z === "right" && (l += ee) : x === "right" && (Z === "center" ? l += ee : Z === "right" && (l += f))), w) {
case "top":
u -= (oe.length - 1) * ne;
break;
case "center":
case "bottom":
u -= (oe.length - 1) * ne;
break;
}
for (var le = 0; le < oe.length; le++)
te > 0 && e.strokeText(oe[le], l, u), e.fillText(oe[le], l, u), u += ne;
} else
te > 0 && e.strokeText(p, l, u), e.fillText(p, l, u);
k !== 0 && (e.rotate(-k), e.translate(-c, -d));
}
}
};
var Sd = {};
Sd.drawNode = function(e, t, n) {
var r = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, o = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, i = this, s, l, u = t._private, c = u.rscratch, d = t.position();
if (!(!Ze(d.x) || !Ze(d.y)) && !(a && !t.visible())) {
var p = a ? t.effectiveOpacity() : 1, h = i.usePaths(), f, v = !1, m = t.padding();
s = t.width() + 2 * m, l = t.height() + 2 * m;
var g;
n && (g = n, e.translate(-g.x1, -g.y1));
for (var b = t.pstyle("background-image"), x = b.value, w = new Array(x.length), k = new Array(x.length), C = 0, _ = 0; _ < x.length; _++) {
var $ = x[_], O = w[_] = $ != null && $ !== "none";
if (O) {
var F = t.cy().style().getIndexedStyle(t, "background-image-crossorigin", "value", _);
C++, k[_] = i.getCachedImage($, F, function() {
u.backgroundTimestamp = Date.now(), t.emitAndNotify("background");
});
}
}
var A = t.pstyle("background-blacken").value, T = t.pstyle("border-width").pfValue, R = t.pstyle("background-opacity").value * p, M = t.pstyle("border-color").value, j = t.pstyle("border-style").value, P = t.pstyle("border-join").value, V = t.pstyle("border-cap").value, U = t.pstyle("border-position").value, G = t.pstyle("border-dash-pattern").pfValue, se = t.pstyle("border-dash-offset").pfValue, ae = t.pstyle("border-opacity").value * p, de = t.pstyle("outline-width").pfValue, me = t.pstyle("outline-color").value, te = t.pstyle("outline-style").value, oe = t.pstyle("outline-opacity").value * p, ne = t.pstyle("outline-offset").value, ee = t.pstyle("corner-radius").value;
ee !== "auto" && (ee = t.pstyle("corner-radius").pfValue);
var Z = function() {
var Pe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : R;
i.eleFillStyle(e, t, Pe);
}, le = function() {
var Pe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ae;
i.colorStrokeStyle(e, M[0], M[1], M[2], Pe);
}, pe = function() {
var Pe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : oe;
i.colorStrokeStyle(e, me[0], me[1], me[2], Pe);
}, ke = function(Pe, Ce, ze, lt) {
var rt = i.nodePathCache = i.nodePathCache || [], fe = AB(ze === "polygon" ? ze + "," + lt.join(",") : ze, "" + Ce, "" + Pe, "" + ee), Te = rt[fe], Se, Ue = !1;
return Te != null ? (Se = Te, Ue = !0, c.pathCache = Se) : (Se = new Path2D(), rt[fe] = c.pathCache = Se), {
path: Se,
cacheHit: Ue
};
}, Ne = t.pstyle("shape").strValue, De = t.pstyle("shape-polygon-points").pfValue;
if (h) {
e.translate(d.x, d.y);
var _e = ke(s, l, Ne, De);
f = _e.path, v = _e.cacheHit;
}
var Fe = function() {
if (!v) {
var Pe = d;
h && (Pe = {
x: 0,
y: 0
}), i.nodeShapes[i.getNodeShape(t)].draw(f || e, Pe.x, Pe.y, s, l, ee, c);
}
h ? e.fill(f) : e.fill();
}, Ie = function() {
for (var Pe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : p, Ce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, ze = u.backgrounding, lt = 0, rt = 0; rt < k.length; rt++) {
var fe = t.cy().style().getIndexedStyle(t, "background-image-containment", "value", rt);
if (Ce && fe === "over" || !Ce && fe === "inside") {
lt++;
continue;
}
w[rt] && k[rt].complete && !k[rt].error && (lt++, i.drawInscribedImage(e, k[rt], t, rt, Pe));
}
u.backgrounding = lt !== C, ze !== u.backgrounding && t.updateStyle(!1);
}, Ae = function() {
var Pe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, Ce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : p;
i.hasPie(t) && (i.drawPie(e, t, Ce), Pe && (h || i.nodeShapes[i.getNodeShape(t)].draw(e, d.x, d.y, s, l, ee, c)));
}, qe = function() {
var Pe = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : p, Ce = (A > 0 ? A : -A) * Pe, ze = A > 0 ? 0 : 255;
A !== 0 && (i.colorFillStyle(e, ze, ze, ze, Ce), h ? e.fill(f) : e.fill());
}, et = function() {
if (T > 0) {
if (e.lineWidth = T, e.lineCap = V, e.lineJoin = P, e.setLineDash)
switch (j) {
case "dotted":
e.setLineDash([1, 1]);
break;
case "dashed":
e.setLineDash(G), e.lineDashOffset = se;
break;
case "solid":
case "double":
e.setLineDash([]);
break;
}
if (U !== "center") {
if (e.save(), e.lineWidth *= 2, U === "inside")
h ? e.clip(f) : e.clip();
else {
var Pe = new Path2D();
Pe.rect(-s / 2 - T, -l / 2 - T, s + 2 * T, l + 2 * T), Pe.addPath(f), e.clip(Pe, "evenodd");
}
h ? e.stroke(f) : e.stroke(), e.restore();
} else
h ? e.stroke(f) : e.stroke();
if (j === "double") {
e.lineWidth = T / 3;
var Ce = e.globalCompositeOperation;
e.globalCompositeOperation = "destination-out", h ? e.stroke(f) : e.stroke(), e.globalCompositeOperation = Ce;
}
e.setLineDash && e.setLineDash([]);
}
}, He = function() {
if (de > 0) {
if (e.lineWidth = de, e.lineCap = "butt", e.setLineDash)
switch (te) {
case "dotted":
e.setLineDash([1, 1]);
break;
case "dashed":
e.setLineDash([4, 2]);
break;
case "solid":
case "double":
e.setLineDash([]);
break;
}
var Pe = d;
h && (Pe = {
x: 0,
y: 0
});
var Ce = i.getNodeShape(t), ze = T;
U === "inside" && (ze = 0), U === "outside" && (ze *= 2);
var lt = (s + ze + (de + ne)) / s, rt = (l + ze + (de + ne)) / l, fe = s * lt, Te = l * rt, Se = i.nodeShapes[Ce].points, Ue;
if (h) {
var zt = ke(fe, Te, Ce, Se);
Ue = zt.path;
}
if (Ce === "ellipse")
i.drawEllipsePath(Ue || e, Pe.x, Pe.y, fe, Te);
else if (["round-diamond", "round-heptagon", "round-hexagon", "round-octagon", "round-pentagon", "round-polygon", "round-triangle", "round-tag"].includes(Ce)) {
var Pt = 0, qt = 0, Ht = 0;
Ce === "round-diamond" ? Pt = (ze + ne + de) * 1.4 : Ce === "round-heptagon" ? (Pt = (ze + ne + de) * 1.075, Ht = -(ze / 2 + ne + de) / 35) : Ce === "round-hexagon" ? Pt = (ze + ne + de) * 1.12 : Ce === "round-pentagon" ? (Pt = (ze + ne + de) * 1.13, Ht = -(ze / 2 + ne + de) / 15) : Ce === "round-tag" ? (Pt = (ze + ne + de) * 1.12, qt = (ze / 2 + de + ne) * 0.07) : Ce === "round-triangle" && (Pt = (ze + ne + de) * (Math.PI / 2), Ht = -(ze + ne / 2 + de) / Math.PI), Pt !== 0 && (lt = (s + Pt) / s, fe = s * lt, ["round-hexagon", "round-tag"].includes(Ce) || (rt = (l + Pt) / l, Te = l * rt)), ee = ee === "auto" ? VB(fe, Te) : ee;
for (var tn = fe / 2, Dn = Te / 2, hn = ee + (ze + de + ne) / 2, vn = new Array(Se.length / 2), Pn = new Array(Se.length / 2), Bn = 0; Bn < Se.length / 2; Bn++)
vn[Bn] = {
x: Pe.x + qt + tn * Se[Bn * 2],
y: Pe.y + Ht + Dn * Se[Bn * 2 + 1]
};
var Cn, hr, or, ar, nn = vn.length;
for (hr = vn[nn - 1], Cn = 0; Cn < nn; Cn++)
or = vn[Cn % nn], ar = vn[(Cn + 1) % nn], Pn[Cn] = A$(hr, or, ar, hn), hr = or, or = ar;
i.drawRoundPolygonPath(Ue || e, Pe.x + qt, Pe.y + Ht, s * lt, l * rt, Se, Pn);
} else if (["roundrectangle", "round-rectangle"].includes(Ce))
ee = ee === "auto" ? hu(fe, Te) : ee, i.drawRoundRectanglePath(Ue || e, Pe.x, Pe.y, fe, Te, ee + (ze + de + ne) / 2);
else if (["cutrectangle", "cut-rectangle"].includes(Ce))
ee = ee === "auto" ? b$() : ee, i.drawCutRectanglePath(Ue || e, Pe.x, Pe.y, fe, Te, null, ee + (ze + de + ne) / 4);
else if (["bottomroundrectangle", "bottom-round-rectangle"].includes(Ce))
ee = ee === "auto" ? hu(fe, Te) : ee, i.drawBottomRoundRectanglePath(Ue || e, Pe.x, Pe.y, fe, Te, ee + (ze + de + ne) / 2);
else if (Ce === "barrel")
i.drawBarrelPath(Ue || e, Pe.x, Pe.y, fe, Te);
else if (Ce.startsWith("polygon") || ["rhomboid", "right-rhomboid", "round-tag", "tag", "vee"].includes(Ce)) {
var gn = (ze + de + ne) / s;
Se = jg(Vg(Se, gn)), i.drawPolygonPath(Ue || e, Pe.x, Pe.y, s, l, Se);
} else {
var Fn = (ze + de + ne) / s;
Se = jg(Vg(Se, -Fn)), i.drawPolygonPath(Ue || e, Pe.x, Pe.y, s, l, Se);
}
if (h ? e.stroke(Ue) : e.stroke(), te === "double") {
e.lineWidth = ze / 3;
var vr = e.globalCompositeOperation;
e.globalCompositeOperation = "destination-out", h ? e.stroke(Ue) : e.stroke(), e.globalCompositeOperation = vr;
}
e.setLineDash && e.setLineDash([]);
}
}, ot = function() {
o && i.drawNodeOverlay(e, t, d, s, l);
}, tt = function() {
o && i.drawNodeUnderlay(e, t, d, s, l);
}, Qe = function() {
i.drawElementText(e, t, null, r);
}, I = t.pstyle("ghost").value === "yes";
if (I) {
var Y = t.pstyle("ghost-offset-x").pfValue, ve = t.pstyle("ghost-offset-y").pfValue, we = t.pstyle("ghost-opacity").value, ye = we * p;
e.translate(Y, ve), pe(), He(), Z(we * R), Fe(), Ie(ye, !0), le(we * ae), et(), Ae(A !== 0 || T !== 0), Ie(ye, !1), qe(ye), e.translate(-Y, -ve);
}
h && e.translate(-d.x, -d.y), tt(), h && e.translate(d.x, d.y), pe(), He(), Z(), Fe(), Ie(p, !0), le(), et(), Ae(A !== 0 || T !== 0), Ie(p, !1), qe(), h && e.translate(-d.x, -d.y), Qe(), ot(), n && e.translate(g.x1, g.y1);
}
};
var qz = function(e) {
if (!["overlay", "underlay"].includes(e))
throw new Error("Invalid state");
return function(t, n, r, o, a) {
var i = this;
if (n.visible()) {
var s = n.pstyle("".concat(e, "-padding")).pfValue, l = n.pstyle("".concat(e, "-opacity")).value, u = n.pstyle("".concat(e, "-color")).value, c = n.pstyle("".concat(e, "-shape")).value, d = n.pstyle("".concat(e, "-corner-radius")).value;
if (l > 0) {
if (r = r || n.position(), o == null || a == null) {
var p = n.padding();
o = n.width() + 2 * p, a = n.height() + 2 * p;
}
i.colorFillStyle(t, u[0], u[1], u[2], l), i.nodeShapes[c].draw(t, r.x, r.y, o + s * 2, a + s * 2, d), t.fill();
}
}
};
};
Sd.drawNodeOverlay = qz("overlay");
Sd.drawNodeUnderlay = qz("underlay");
Sd.hasPie = function(e) {
return e = e[0], e._private.hasPie;
};
Sd.drawPie = function(e, t, n, r) {
t = t[0], r = r || t.position();
var o = t.cy().style(), a = t.pstyle("pie-size"), i = r.x, s = r.y, l = t.width(), u = t.height(), c = Math.min(l, u) / 2, d = 0, p = this.usePaths();
p && (i = 0, s = 0), a.units === "%" ? c = c * a.pfValue : a.pfValue !== void 0 && (c = a.pfValue / 2);
for (var h = 1; h <= o.pieBackgroundN; h++) {
var f = t.pstyle("pie-" + h + "-background-size").value, v = t.pstyle("pie-" + h + "-background-color").value, m = t.pstyle("pie-" + h + "-background-opacity").value * n, g = f / 100;
g + d > 1 && (g = 1 - d);
var b = 1.5 * Math.PI + 2 * Math.PI * d, x = 2 * Math.PI * g, w = b + x;
f === 0 || d >= 1 || d + g > 1 || (e.beginPath(), e.moveTo(i, s), e.arc(i, s, c, b, w), e.closePath(), this.colorFillStyle(e, v[0], v[1], v[2], m), e.fill(), d += g);
}
};
var jo = {}, wxe = 100;
jo.getPixelRatio = function() {
var e = this.data.contexts[0];
if (this.forcedPixelRatio != null)
return this.forcedPixelRatio;
var t = this.cy.window(), n = e.backingStorePixelRatio || e.webkitBackingStorePixelRatio || e.mozBackingStorePixelRatio || e.msBackingStorePixelRatio || e.oBackingStorePixelRatio || e.backingStorePixelRatio || 1;
return (t.devicePixelRatio || 1) / n;
};
jo.paintCache = function(e) {
for (var t = this.paintCaches = this.paintCaches || [], n = !0, r, o = 0; o < t.length; o++)
if (r = t[o], r.context === e) {
n = !1;
break;
}
return n && (r = {
context: e
}, t.push(r)), r;
};
jo.createGradientStyleFor = function(e, t, n, r, o) {
var a, i = this.usePaths(), s = n.pstyle(t + "-gradient-stop-colors").value, l = n.pstyle(t + "-gradient-stop-positions").pfValue;
if (r === "radial-gradient")
if (n.isEdge()) {
var u = n.sourceEndpoint(), c = n.targetEndpoint(), d = n.midpoint(), p = fu(u, d), h = fu(c, d);
a = e.createRadialGradient(d.x, d.y, 0, d.x, d.y, Math.max(p, h));
} else {
var f = i ? {
x: 0,
y: 0
} : n.position(), v = n.paddedWidth(), m = n.paddedHeight();
a = e.createRadialGradient(f.x, f.y, 0, f.x, f.y, Math.max(v, m));
}
else if (n.isEdge()) {
var g = n.sourceEndpoint(), b = n.targetEndpoint();
a = e.createLinearGradient(g.x, g.y, b.x, b.y);
} else {
var x = i ? {
x: 0,
y: 0
} : n.position(), w = n.paddedWidth(), k = n.paddedHeight(), C = w / 2, _ = k / 2, $ = n.pstyle("background-gradient-direction").value;
switch ($) {
case "to-bottom":
a = e.createLinearGradient(x.x, x.y - _, x.x, x.y + _);
break;
case "to-top":
a = e.createLinearGradient(x.x, x.y + _, x.x, x.y - _);
break;
case "to-left":
a = e.createLinearGradient(x.x + C, x.y, x.x - C, x.y);
break;
case "to-right":
a = e.createLinearGradient(x.x - C, x.y, x.x + C, x.y);
break;
case "to-bottom-right":
case "to-right-bottom":
a = e.createLinearGradient(x.x - C, x.y - _, x.x + C, x.y + _);
break;
case "to-top-right":
case "to-right-top":
a = e.createLinearGradient(x.x - C, x.y + _, x.x + C, x.y - _);
break;
case "to-bottom-left":
case "to-left-bottom":
a = e.createLinearGradient(x.x + C, x.y - _, x.x - C, x.y + _);
break;
case "to-top-left":
case "to-left-top":
a = e.createLinearGradient(x.x + C, x.y + _, x.x - C, x.y - _);
break;
}
}
if (!a) return null;
for (var O = l.length === s.length, F = s.length, A = 0; A < F; A++)
a.addColorStop(O ? l[A] : A / (F - 1), "rgba(" + s[A][0] + "," + s[A][1] + "," + s[A][2] + "," + o + ")");
return a;
};
jo.gradientFillStyle = function(e, t, n, r) {
var o = this.createGradientStyleFor(e, "background", t, n, r);
if (!o) return null;
e.fillStyle = o;
};
jo.colorFillStyle = function(e, t, n, r, o) {
e.fillStyle = "rgba(" + t + "," + n + "," + r + "," + o + ")";
};
jo.eleFillStyle = function(e, t, n) {
var r = t.pstyle("background-fill").value;
if (r === "linear-gradient" || r === "radial-gradient")
this.gradientFillStyle(e, t, r, n);
else {
var o = t.pstyle("background-color").value;
this.colorFillStyle(e, o[0], o[1], o[2], n);
}
};
jo.gradientStrokeStyle = function(e, t, n, r) {
var o = this.createGradientStyleFor(e, "line", t, n, r);
if (!o) return null;
e.strokeStyle = o;
};
jo.colorStrokeStyle = function(e, t, n, r, o) {
e.strokeStyle = "rgba(" + t + "," + n + "," + r + "," + o + ")";
};
jo.eleStrokeStyle = function(e, t, n) {
var r = t.pstyle("line-fill").value;
if (r === "linear-gradient" || r === "radial-gradient")
this.gradientStrokeStyle(e, t, r, n);
else {
var o = t.pstyle("line-color").value;
this.colorStrokeStyle(e, o[0], o[1], o[2], n);
}
};
jo.matchCanvasSize = function(e) {
var t = this, n = t.data, r = t.findContainerClientCoords(), o = r[2], a = r[3], i = t.getPixelRatio(), s = t.motionBlurPxRatio;
(e === t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE] || e === t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]) && (i = s);
var l = o * i, u = a * i, c;
if (!(l === t.canvasWidth && u === t.canvasHeight)) {
t.fontCaches = null;
var d = n.canvasContainer;
d.style.width = o + "px", d.style.height = a + "px";
for (var p = 0; p < t.CANVAS_LAYERS; p++)
c = n.canvases[p], c.width = l, c.height = u, c.style.width = o + "px", c.style.height = a + "px";
for (var p = 0; p < t.BUFFER_COUNT; p++)
c = n.bufferCanvases[p], c.width = l, c.height = u, c.style.width = o + "px", c.style.height = a + "px";
t.textureMult = 1, i <= 1 && (c = n.bufferCanvases[t.TEXTURE_BUFFER], t.textureMult = 2, c.width = l * t.textureMult, c.height = u * t.textureMult), t.canvasWidth = l, t.canvasHeight = u;
}
};
jo.renderTo = function(e, t, n, r) {
this.render({
forcedContext: e,
forcedZoom: t,
forcedPan: n,
drawAllLayers: !0,
forcedPxRatio: r
});
};
jo.render = function(e) {
e = e || RB();
var t = e.forcedContext, n = e.drawAllLayers, r = e.drawOnlyNodeLayer, o = e.forcedZoom, a = e.forcedPan, i = this, s = e.forcedPxRatio === void 0 ? this.getPixelRatio() : e.forcedPxRatio, l = i.cy, u = i.data, c = u.canvasNeedsRedraw, d = i.textureOnViewport && !t && (i.pinching || i.hoverData.dragging || i.swipePanning || i.data.wheelZooming), p = e.motionBlur !== void 0 ? e.motionBlur : i.motionBlur, h = i.motionBlurPxRatio, f = l.hasCompoundNodes(), v = i.hoverData.draggingEles, m = !!(i.hoverData.selecting || i.touchData.selecting);
p = p && !t && i.motionBlurEnabled && !m;
var g = p;
t || (i.prevPxRatio !== s && (i.invalidateContainerClientCoordsCache(), i.matchCanvasSize(i.container), i.redrawHint("eles", !0), i.redrawHint("drag", !0)), i.prevPxRatio = s), !t && i.motionBlurTimeout && clearTimeout(i.motionBlurTimeout), p && (i.mbFrames == null && (i.mbFrames = 0), i.mbFrames++, i.mbFrames < 3 && (g = !1), i.mbFrames > i.minMbLowQualFrames && (i.motionBlurPxRatio = i.mbPxRBlurry)), i.clearingMotionBlur && (i.motionBlurPxRatio = 1), i.textureDrawLastFrame && !d && (c[i.NODE] = !0, c[i.SELECT_BOX] = !0);
var b = l.style(), x = l.zoom(), w = o !== void 0 ? o : x, k = l.pan(), C = {
x: k.x,
y: k.y
}, _ = {
zoom: x,
pan: {
x: k.x,
y: k.y
}
}, $ = i.prevViewport, O = $ === void 0 || _.zoom !== $.zoom || _.pan.x !== $.pan.x || _.pan.y !== $.pan.y;
!O && !(v && !f) && (i.motionBlurPxRatio = 1), a && (C = a), w *= s, C.x *= s, C.y *= s;
var F = i.getCachedZSortedEles();
function A(_e, Fe, Ie, Ae, qe) {
var et = _e.globalCompositeOperation;
_e.globalCompositeOperation = "destination-out", i.colorFillStyle(_e, 255, 255, 255, i.motionBlurTransparency), _e.fillRect(Fe, Ie, Ae, qe), _e.globalCompositeOperation = et;
}
function T(_e, Fe) {
var Ie, Ae, qe, et;
!i.clearingMotionBlur && (_e === u.bufferContexts[i.MOTIONBLUR_BUFFER_NODE] || _e === u.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]) ? (Ie = {
x: k.x * h,
y: k.y * h
}, Ae = x * h, qe = i.canvasWidth * h, et = i.canvasHeight * h) : (Ie = C, Ae = w, qe = i.canvasWidth, et = i.canvasHeight), _e.setTransform(1, 0, 0, 1, 0, 0), Fe === "motionBlur" ? A(_e, 0, 0, qe, et) : !t && (Fe === void 0 || Fe) && _e.clearRect(0, 0, qe, et), n || (_e.translate(Ie.x, Ie.y), _e.scale(Ae, Ae)), a && _e.translate(a.x, a.y), o && _e.scale(o, o);
}
if (d || (i.textureDrawLastFrame = !1), d) {
if (i.textureDrawLastFrame = !0, !i.textureCache) {
i.textureCache = {}, i.textureCache.bb = l.mutableElements().boundingBox(), i.textureCache.texture = i.data.bufferCanvases[i.TEXTURE_BUFFER];
var R = i.data.bufferContexts[i.TEXTURE_BUFFER];
R.setTransform(1, 0, 0, 1, 0, 0), R.clearRect(0, 0, i.canvasWidth * i.textureMult, i.canvasHeight * i.textureMult), i.render({
forcedContext: R,
drawOnlyNodeLayer: !0,
forcedPxRatio: s * i.textureMult
});
var _ = i.textureCache.viewport = {
zoom: l.zoom(),
pan: l.pan(),
width: i.canvasWidth,
height: i.canvasHeight
};
_.mpan = {
x: (0 - _.pan.x) / _.zoom,
y: (0 - _.pan.y) / _.zoom
};
}
c[i.DRAG] = !1, c[i.NODE] = !1;
var M = u.contexts[i.NODE], j = i.textureCache.texture, _ = i.textureCache.viewport;
M.setTransform(1, 0, 0, 1, 0, 0), p ? A(M, 0, 0, _.width, _.height) : M.clearRect(0, 0, _.width, _.height);
var P = b.core("outside-texture-bg-color").value, V = b.core("outside-texture-bg-opacity").value;
i.colorFillStyle(M, P[0], P[1], P[2], V), M.fillRect(0, 0, _.width, _.height);
var x = l.zoom();
T(M, !1), M.clearRect(_.mpan.x, _.mpan.y, _.width / _.zoom / s, _.height / _.zoom / s), M.drawImage(j, _.mpan.x, _.mpan.y, _.width / _.zoom / s, _.height / _.zoom / s);
} else i.textureOnViewport && !t && (i.textureCache = null);
var U = l.extent(), G = i.pinching || i.hoverData.dragging || i.swipePanning || i.data.wheelZooming || i.hoverData.draggingEles || i.cy.animated(), se = i.hideEdgesOnViewport && G, ae = [];
if (ae[i.NODE] = !c[i.NODE] && p && !i.clearedForMotionBlur[i.NODE] || i.clearingMotionBlur, ae[i.NODE] && (i.clearedForMotionBlur[i.NODE] = !0), ae[i.DRAG] = !c[i.DRAG] && p && !i.clearedForMotionBlur[i.DRAG] || i.clearingMotionBlur, ae[i.DRAG] && (i.clearedForMotionBlur[i.DRAG] = !0), c[i.NODE] || n || r || ae[i.NODE]) {
var de = p && !ae[i.NODE] && h !== 1, M = t || (de ? i.data.bufferContexts[i.MOTIONBLUR_BUFFER_NODE] : u.contexts[i.NODE]), me = p && !de ? "motionBlur" : void 0;
T(M, me), se ? i.drawCachedNodes(M, F.nondrag, s, U) : i.drawLayeredElements(M, F.nondrag, s, U), i.debug && i.drawDebugPoints(M, F.nondrag), !n && !p && (c[i.NODE] = !1);
}
if (!r && (c[i.DRAG] || n || ae[i.DRAG])) {
var de = p && !ae[i.DRAG] && h !== 1, M = t || (de ? i.data.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG] : u.contexts[i.DRAG]);
T(M, p && !de ? "motionBlur" : void 0), se ? i.drawCachedNodes(M, F.drag, s, U) : i.drawCachedElements(M, F.drag, s, U), i.debug && i.drawDebugPoints(M, F.drag), !n && !p && (c[i.DRAG] = !1);
}
if (i.showFps || !r && c[i.SELECT_BOX] && !n) {
var M = t || u.contexts[i.SELECT_BOX];
if (T(M), i.selection[4] == 1 && (i.hoverData.selecting || i.touchData.selecting)) {
var x = i.cy.zoom(), te = b.core("selection-box-border-width").value / x;
M.lineWidth = te, M.fillStyle = "rgba(" + b.core("selection-box-color").value[0] + "," + b.core("selection-box-color").value[1] + "," + b.core("selection-box-color").value[2] + "," + b.core("selection-box-opacity").value + ")", M.fillRect(i.selection[0], i.selection[1], i.selection[2] - i.selection[0], i.selection[3] - i.selection[1]), te > 0 && (M.strokeStyle = "rgba(" + b.core("selection-box-border-color").value[0] + "," + b.core("selection-box-border-color").value[1] + "," + b.core("selection-box-border-color").value[2] + "," + b.core("selection-box-opacity").value + ")", M.strokeRect(i.selection[0], i.selection[1], i.selection[2] - i.selection[0], i.selection[3] - i.selection[1]));
}
if (u.bgActivePosistion && !i.hoverData.selecting) {
var x = i.cy.zoom(), oe = u.bgActivePosistion;
M.fillStyle = "rgba(" + b.core("active-bg-color").value[0] + "," + b.core("active-bg-color").value[1] + "," + b.core("active-bg-color").value[2] + "," + b.core("active-bg-opacity").value + ")", M.beginPath(), M.arc(oe.x, oe.y, b.core("active-bg-size").pfValue / x, 0, 2 * Math.PI), M.fill();
}
var ne = i.lastRedrawTime;
if (i.showFps && ne) {
ne = Math.round(ne);
var ee = Math.round(1e3 / ne);
M.setTransform(1, 0, 0, 1, 0, 0), M.fillStyle = "rgba(255, 0, 0, 0.75)", M.strokeStyle = "rgba(255, 0, 0, 0.75)", M.lineWidth = 1, M.fillText("1 frame = " + ne + " ms = " + ee + " fps", 0, 20);
var Z = 60;
M.strokeRect(0, 30, 250, 20), M.fillRect(0, 30, 250 * Math.min(ee / Z, 1), 20);
}
n || (c[i.SELECT_BOX] = !1);
}
if (p && h !== 1) {
var le = u.contexts[i.NODE], pe = i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_NODE], ke = u.contexts[i.DRAG], Ne = i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_DRAG], De = function(_e, Fe, Ie) {
_e.setTransform(1, 0, 0, 1, 0, 0), Ie || !g ? _e.clearRect(0, 0, i.canvasWidth, i.canvasHeight) : A(_e, 0, 0, i.canvasWidth, i.canvasHeight);
var Ae = h;
_e.drawImage(
Fe,
// img
0,
0,
// sx, sy
i.canvasWidth * Ae,
i.canvasHeight * Ae,
// sw, sh
0,
0,
// x, y
i.canvasWidth,
i.canvasHeight
// w, h
);
};
(c[i.NODE] || ae[i.NODE]) && (De(le, pe, ae[i.NODE]), c[i.NODE] = !1), (c[i.DRAG] || ae[i.DRAG]) && (De(ke, Ne, ae[i.DRAG]), c[i.DRAG] = !1);
}
i.prevViewport = _, i.clearingMotionBlur && (i.clearingMotionBlur = !1, i.motionBlurCleared = !0, i.motionBlur = !0), p && (i.motionBlurTimeout = setTimeout(function() {
i.motionBlurTimeout = null, i.clearedForMotionBlur[i.NODE] = !1, i.clearedForMotionBlur[i.DRAG] = !1, i.motionBlur = !1, i.clearingMotionBlur = !d, i.mbFrames = 0, c[i.NODE] = !0, c[i.DRAG] = !0, i.redraw();
}, wxe)), t || l.emit("render");
};
var kl = {};
kl.drawPolygonPath = function(e, t, n, r, o, a) {
var i = r / 2, s = o / 2;
e.beginPath && e.beginPath(), e.moveTo(t + i * a[0], n + s * a[1]);
for (var l = 1; l < a.length / 2; l++)
e.lineTo(t + i * a[l * 2], n + s * a[l * 2 + 1]);
e.closePath();
};
kl.drawRoundPolygonPath = function(e, t, n, r, o, a, i) {
i.forEach(function(s) {
return Pz(e, s);
}), e.closePath();
};
kl.drawRoundRectanglePath = function(e, t, n, r, o, a) {
var i = r / 2, s = o / 2, l = a === "auto" ? hu(r, o) : Math.min(a, s, i);
e.beginPath && e.beginPath(), e.moveTo(t, n - s), e.arcTo(t + i, n - s, t + i, n, l), e.arcTo(t + i, n + s, t, n + s, l), e.arcTo(t - i, n + s, t - i, n, l), e.arcTo(t - i, n - s, t, n - s, l), e.lineTo(t, n - s), e.closePath();
};
kl.drawBottomRoundRectanglePath = function(e, t, n, r, o, a) {
var i = r / 2, s = o / 2, l = a === "auto" ? hu(r, o) : a;
e.beginPath && e.beginPath(), e.moveTo(t, n - s), e.lineTo(t + i, n - s), e.lineTo(t + i, n), e.arcTo(t + i, n + s, t, n + s, l), e.arcTo(t - i, n + s, t - i, n, l), e.lineTo(t - i, n - s), e.lineTo(t, n - s), e.closePath();
};
kl.drawCutRectanglePath = function(e, t, n, r, o, a, i) {
var s = r / 2, l = o / 2, u = i === "auto" ? b$() : i;
e.beginPath && e.beginPath(), e.moveTo(t - s + u, n - l), e.lineTo(t + s - u, n - l), e.lineTo(t + s, n - l + u), e.lineTo(t + s, n + l - u), e.lineTo(t + s - u, n + l), e.lineTo(t - s + u, n + l), e.lineTo(t - s, n + l - u), e.lineTo(t - s, n - l + u), e.closePath();
};
kl.drawBarrelPath = function(e, t, n, r, o) {
var a = r / 2, i = o / 2, s = t - a, l = t + a, u = n - i, c = n + i, d = VC(r, o), p = d.widthOffset, h = d.heightOffset, f = d.ctrlPtOffsetPct * p;
e.beginPath && e.beginPath(), e.moveTo(s, u + h), e.lineTo(s, c - h), e.quadraticCurveTo(s + f, c, s + p, c), e.lineTo(l - p, c), e.quadraticCurveTo(l - f, c, l, c - h), e.lineTo(l, u + h), e.quadraticCurveTo(l - f, u, l - p, u), e.lineTo(s + p, u), e.quadraticCurveTo(s + f, u, s, u + h), e.closePath();
};
var RF = Math.sin(0), NF = Math.cos(0), e_ = {}, t_ = {}, Kz = Math.PI / 40;
for (var lc = 0 * Math.PI; lc < 2 * Math.PI; lc += Kz)
e_[lc] = Math.sin(lc), t_[lc] = Math.cos(lc);
kl.drawEllipsePath = function(e, t, n, r, o) {
if (e.beginPath && e.beginPath(), e.ellipse)
e.ellipse(t, n, r / 2, o / 2, 0, 0, 2 * Math.PI);
else
for (var a, i, s = r / 2, l = o / 2, u = 0 * Math.PI; u < 2 * Math.PI; u += Kz)
a = t - s * e_[u] * RF + s * t_[u] * NF, i = n + l * t_[u] * RF + l * e_[u] * NF, u === 0 ? e.moveTo(a, i) : e.lineTo(a, i);
e.closePath();
};
var lh = {};
lh.createBuffer = function(e, t) {
var n = document.createElement("canvas");
return n.width = e, n.height = t, [n, n.getContext("2d")];
};
lh.bufferCanvasImage = function(e) {
var t = this.cy, n = t.mutableElements(), r = n.boundingBox(), o = this.findContainerClientCoords(), a = e.full ? Math.ceil(r.w) : o[2], i = e.full ? Math.ceil(r.h) : o[3], s = Ze(e.maxWidth) || Ze(e.maxHeight), l = this.getPixelRatio(), u = 1;
if (e.scale !== void 0)
a *= e.scale, i *= e.scale, u = e.scale;
else if (s) {
var c = 1 / 0, d = 1 / 0;
Ze(e.maxWidth) && (c = u * e.maxWidth / a), Ze(e.maxHeight) && (d = u * e.maxHeight / i), u = Math.min(c, d), a *= u, i *= u;
}
s || (a *= l, i *= l, u *= l);
var p = document.createElement("canvas");
p.width = a, p.height = i, p.style.width = a + "px", p.style.height = i + "px";
var h = p.getContext("2d");
if (a > 0 && i > 0) {
h.clearRect(0, 0, a, i), h.globalCompositeOperation = "source-over";
var f = this.getCachedZSortedEles();
if (e.full)
h.translate(-r.x1 * u, -r.y1 * u), h.scale(u, u), this.drawElements(h, f), h.scale(1 / u, 1 / u), h.translate(r.x1 * u, r.y1 * u);
else {
var v = t.pan(), m = {
x: v.x * u,
y: v.y * u
};
u *= t.zoom(), h.translate(m.x, m.y), h.scale(u, u), this.drawElements(h, f), h.scale(1 / u, 1 / u), h.translate(-m.x, -m.y);
}
e.bg && (h.globalCompositeOperation = "destination-over", h.fillStyle = e.bg, h.rect(0, 0, a, i), h.fill());
}
return p;
};
function xxe(e, t) {
for (var n = atob(e), r = new ArrayBuffer(n.length), o = new Uint8Array(r), a = 0; a < n.length; a++)
o[a] = n.charCodeAt(a);
return new Blob([r], {
type: t
});
}
function MF(e) {
var t = e.indexOf(",");
return e.substr(t + 1);
}
function Gz(e, t, n) {
var r = function() {
return t.toDataURL(n, e.quality);
};
switch (e.output) {
case "blob-promise":
return new md(function(o, a) {
try {
t.toBlob(function(i) {
i != null ? o(i) : a(new Error("`canvas.toBlob()` sent a null value in its callback"));
}, n, e.quality);
} catch (i) {
a(i);
}
});
case "blob":
return xxe(MF(r()), n);
case "base64":
return MF(r());
case "base64uri":
default:
return r();
}
}
lh.png = function(e) {
return Gz(e, this.bufferCanvasImage(e), "image/png");
};
lh.jpg = function(e) {
return Gz(e, this.bufferCanvasImage(e), "image/jpeg");
};
var Wz = {};
Wz.nodeShapeImpl = function(e, t, n, r, o, a, i, s) {
switch (e) {
case "ellipse":
return this.drawEllipsePath(t, n, r, o, a);
case "polygon":
return this.drawPolygonPath(t, n, r, o, a, i);
case "round-polygon":
return this.drawRoundPolygonPath(t, n, r, o, a, i, s);
case "roundrectangle":
case "round-rectangle":
return this.drawRoundRectanglePath(t, n, r, o, a, s);
case "cutrectangle":
case "cut-rectangle":
return this.drawCutRectanglePath(t, n, r, o, a, i, s);
case "bottomroundrectangle":
case "bottom-round-rectangle":
return this.drawBottomRoundRectanglePath(t, n, r, o, a, s);
case "barrel":
return this.drawBarrelPath(t, n, r, o, a);
}
};
var kxe = Yz, Zt = Yz.prototype;
Zt.CANVAS_LAYERS = 3;
Zt.SELECT_BOX = 0;
Zt.DRAG = 1;
Zt.NODE = 2;
Zt.BUFFER_COUNT = 3;
Zt.TEXTURE_BUFFER = 0;
Zt.MOTIONBLUR_BUFFER_NODE = 1;
Zt.MOTIONBLUR_BUFFER_DRAG = 2;
function Yz(e) {
var t = this, n = t.cy.window(), r = n.document;
t.data = {
canvases: new Array(Zt.CANVAS_LAYERS),
contexts: new Array(Zt.CANVAS_LAYERS),
canvasNeedsRedraw: new Array(Zt.CANVAS_LAYERS),
bufferCanvases: new Array(Zt.BUFFER_COUNT),
bufferContexts: new Array(Zt.CANVAS_LAYERS)
};
var o = "-webkit-tap-highlight-color", a = "rgba(0,0,0,0)";
t.data.canvasContainer = r.createElement("div");
var i = t.data.canvasContainer.style;
t.data.canvasContainer.style[o] = a, i.position = "relative", i.zIndex = "0", i.overflow = "hidden";
var s = e.cy.container();
s.appendChild(t.data.canvasContainer), s.style[o] = a;
var l = {
"-webkit-user-select": "none",
"-moz-user-select": "-moz-none",
"user-select": "none",
"-webkit-tap-highlight-color": "rgba(0,0,0,0)",
"outline-style": "none"
};
u0e() && (l["-ms-touch-action"] = "none", l["touch-action"] = "none");
for (var u = 0; u < Zt.CANVAS_LAYERS; u++) {
var c = t.data.canvases[u] = r.createElement("canvas");
t.data.contexts[u] = c.getContext("2d"), Object.keys(l).forEach(function(Z) {
c.style[Z] = l[Z];
}), c.style.position = "absolute", c.setAttribute("data-id", "layer" + u), c.style.zIndex = String(Zt.CANVAS_LAYERS - u), t.data.canvasContainer.appendChild(c), t.data.canvasNeedsRedraw[u] = !1;
}
t.data.topCanvas = t.data.canvases[0], t.data.canvases[Zt.NODE].setAttribute("data-id", "layer" + Zt.NODE + "-node"), t.data.canvases[Zt.SELECT_BOX].setAttribute("data-id", "layer" + Zt.SELECT_BOX + "-selectbox"), t.data.canvases[Zt.DRAG].setAttribute("data-id", "layer" + Zt.DRAG + "-drag");
for (var u = 0; u < Zt.BUFFER_COUNT; u++)
t.data.bufferCanvases[u] = r.createElement("canvas"), t.data.bufferContexts[u] = t.data.bufferCanvases[u].getContext("2d"), t.data.bufferCanvases[u].style.position = "absolute", t.data.bufferCanvases[u].setAttribute("data-id", "buffer" + u), t.data.bufferCanvases[u].style.zIndex = String(-u - 1), t.data.bufferCanvases[u].style.visibility = "hidden";
t.pathsEnabled = !0;
var d = Fo(), p = function(Z) {
return {
x: (Z.x1 + Z.x2) / 2,
y: (Z.y1 + Z.y2) / 2
};
}, h = function(Z) {
return {
x: -Z.w / 2,
y: -Z.h / 2
};
}, f = function(Z) {
var le = Z[0]._private, pe = le.oldBackgroundTimestamp === le.backgroundTimestamp;
return !pe;
}, v = function(Z) {
return Z[0]._private.nodeKey;
}, m = function(Z) {
return Z[0]._private.labelStyleKey;
}, g = function(Z) {
return Z[0]._private.sourceLabelStyleKey;
}, b = function(Z) {
return Z[0]._private.targetLabelStyleKey;
}, x = function(Z, le, pe, ke, Ne) {
return t.drawElement(Z, le, pe, !1, !1, Ne);
}, w = function(Z, le, pe, ke, Ne) {
return t.drawElementText(Z, le, pe, ke, "main", Ne);
}, k = function(Z, le, pe, ke, Ne) {
return t.drawElementText(Z, le, pe, ke, "source", Ne);
}, C = function(Z, le, pe, ke, Ne) {
return t.drawElementText(Z, le, pe, ke, "target", Ne);
}, _ = function(Z) {
return Z.boundingBox(), Z[0]._private.bodyBounds;
}, $ = function(Z) {
return Z.boundingBox(), Z[0]._private.labelBounds.main || d;
}, O = function(Z) {
return Z.boundingBox(), Z[0]._private.labelBounds.source || d;
}, F = function(Z) {
return Z.boundingBox(), Z[0]._private.labelBounds.target || d;
}, A = function(Z, le) {
return le;
}, T = function(Z) {
return p(_(Z));
}, R = function(Z, le, pe) {
var ke = Z ? Z + "-" : "";
return {
x: le.x + pe.pstyle(ke + "text-margin-x").pfValue,
y: le.y + pe.pstyle(ke + "text-margin-y").pfValue
};
}, M = function(Z, le, pe) {
var ke = Z[0]._private.rscratch;
return {
x: ke[le],
y: ke[pe]
};
}, j = function(Z) {
return R("", M(Z, "labelX", "labelY"), Z);
}, P = function(Z) {
return R("source", M(Z, "sourceLabelX", "sourceLabelY"), Z);
}, V = function(Z) {
return R("target", M(Z, "targetLabelX", "targetLabelY"), Z);
}, U = function(Z) {
return h(_(Z));
}, G = function(Z) {
return h(O(Z));
}, se = function(Z) {
return h(F(Z));
}, ae = function(Z) {
var le = $(Z), pe = h($(Z));
if (Z.isNode()) {
switch (Z.pstyle("text-halign").value) {
case "left":
pe.x = -le.w;
break;
case "right":
pe.x = 0;
break;
}
switch (Z.pstyle("text-valign").value) {
case "top":
pe.y = -le.h;
break;
case "bottom":
pe.y = 0;
break;
}
}
return pe;
}, de = t.data.eleTxrCache = new xp(t, {
getKey: v,
doesEleInvalidateKey: f,
drawElement: x,
getBoundingBox: _,
getRotationPoint: T,
getRotationOffset: U,
allowEdgeTxrCaching: !1,
allowParentTxrCaching: !1
}), me = t.data.lblTxrCache = new xp(t, {
getKey: m,
drawElement: w,
getBoundingBox: $,
getRotationPoint: j,
getRotationOffset: ae,
isVisible: A
}), te = t.data.slbTxrCache = new xp(t, {
getKey: g,
drawElement: k,
getBoundingBox: O,
getRotationPoint: P,
getRotationOffset: G,
isVisible: A
}), oe = t.data.tlbTxrCache = new xp(t, {
getKey: b,
drawElement: C,
getBoundingBox: F,
getRotationPoint: V,
getRotationOffset: se,
isVisible: A
}), ne = t.data.lyrTxrCache = new Vz(t);
t.onUpdateEleCalcs(function(Z, le) {
de.invalidateElements(le), me.invalidateElements(le), te.invalidateElements(le), oe.invalidateElements(le), ne.invalidateElements(le);
for (var pe = 0; pe < le.length; pe++) {
var ke = le[pe]._private;
ke.oldBackgroundTimestamp = ke.backgroundTimestamp;
}
});
var ee = function(Z) {
for (var le = 0; le < Z.length; le++)
ne.enqueueElementRefinement(Z[le].ele);
};
de.onDequeue(ee), me.onDequeue(ee), te.onDequeue(ee), oe.onDequeue(ee);
}
Zt.redrawHint = function(e, t) {
var n = this;
switch (e) {
case "eles":
n.data.canvasNeedsRedraw[Zt.NODE] = t;
break;
case "drag":
n.data.canvasNeedsRedraw[Zt.DRAG] = t;
break;
case "select":
n.data.canvasNeedsRedraw[Zt.SELECT_BOX] = t;
break;
}
};
var Cxe = typeof Path2D < "u";
Zt.path2dEnabled = function(e) {
if (e === void 0)
return this.pathsEnabled;
this.pathsEnabled = !!e;
};
Zt.usePaths = function() {
return Cxe && this.pathsEnabled;
};
Zt.setImgSmoothing = function(e, t) {
e.imageSmoothingEnabled != null ? e.imageSmoothingEnabled = t : (e.webkitImageSmoothingEnabled = t, e.mozImageSmoothingEnabled = t, e.msImageSmoothingEnabled = t);
};
Zt.getImgSmoothing = function(e) {
return e.imageSmoothingEnabled != null ? e.imageSmoothingEnabled : e.webkitImageSmoothingEnabled || e.mozImageSmoothingEnabled || e.msImageSmoothingEnabled;
};
Zt.makeOffscreenCanvas = function(e, t) {
var n;
if ((typeof OffscreenCanvas > "u" ? "undefined" : cr(OffscreenCanvas)) !== "undefined")
n = new OffscreenCanvas(e, t);
else {
var r = this.cy.window(), o = r.document;
n = o.createElement("canvas"), n.width = e, n.height = t;
}
return n;
};
[Hz, Ti, gs, P$, Du, Sd, jo, kl, lh, Wz].forEach(function(e) {
_t(Zt, e);
});
var _xe = [{
name: "null",
impl: Tz
}, {
name: "base",
impl: zz
}, {
name: "canvas",
impl: kxe
}], Sxe = [{
type: "layout",
extensions: A2e
}, {
type: "renderer",
extensions: _xe
}], Xz = {}, Zz = {};
function Jz(e, t, n) {
var r = n, o = function(_) {
sn("Can not register `" + t + "` for `" + e + "` since `" + _ + "` already exists in the prototype and can not be overridden");
};
if (e === "core") {
if (vf.prototype[t])
return o(t);
vf.prototype[t] = n;
} else if (e === "collection") {
if (Rr.prototype[t])
return o(t);
Rr.prototype[t] = n;
} else if (e === "layout") {
for (var a = function(_) {
this.options = _, n.call(this, _), Xt(this._private) || (this._private = {}), this._private.cy = _.cy, this._private.listeners = [], this.createEmitter();
}, i = a.prototype = Object.create(n.prototype), s = [], l = 0; l < s.length; l++) {
var u = s[l];
i[u] = i[u] || function() {
return this;
};
}
i.start && !i.run ? i.run = function() {
return this.start(), this;
} : !i.start && i.run && (i.start = function() {
return this.run(), this;
});
var c = n.prototype.stop;
i.stop = function() {
var _ = this.options;
if (_ && _.animate) {
var $ = this.animations;
if ($)
for (var O = 0; O < $.length; O++)
$[O].stop();
}
return c ? c.call(this) : this.emit("layoutstop"), this;
}, i.destroy || (i.destroy = function() {
return this;
}), i.cy = function() {
return this._private.cy;
};
var d = function(_) {
return _._private.cy;
}, p = {
addEventFields: function(_, $) {
$.layout = _, $.cy = d(_), $.target = _;
},
bubble: function() {
return !0;
},
parent: function(_) {
return d(_);
}
};
_t(i, {
createEmitter: function() {
return this._private.emitter = new xm(p, this), this;
},
emitter: function() {
return this._private.emitter;
},
on: function(_, $) {
return this.emitter().on(_, $), this;
},
one: function(_, $) {
return this.emitter().one(_, $), this;
},
once: function(_, $) {
return this.emitter().one(_, $), this;
},
removeListener: function(_, $) {
return this.emitter().removeListener(_, $), this;
},
removeAllListeners: function() {
return this.emitter().removeAllListeners(), this;
},
emit: function(_, $) {
return this.emitter().emit(_, $), this;
}
}), an.eventAliasesOn(i), r = a;
} else if (e === "renderer" && t !== "null" && t !== "base") {
var h = Qz("renderer", "base"), f = h.prototype, v = n, m = n.prototype, g = function() {
h.apply(this, arguments), v.apply(this, arguments);
}, b = g.prototype;
for (var x in f) {
var w = f[x], k = m[x] != null;
if (k)
return o(x);
b[x] = w;
}
for (var C in m)
b[C] = m[C];
f.clientFunctions.forEach(function(_) {
b[_] = b[_] || function() {
Un("Renderer does not implement `renderer." + _ + "()` on its prototype");
};
}), r = g;
} else if (e === "__proto__" || e === "constructor" || e === "prototype")
return Un(e + " is an illegal type to be registered, possibly lead to prototype pollutions");
return _B({
map: Xz,
keys: [e, t],
value: r
});
}
function Qz(e, t) {
return SB({
map: Xz,
keys: [e, t]
});
}
function $xe(e, t, n, r, o) {
return _B({
map: Zz,
keys: [e, t, n, r],
value: o
});
}
function Exe(e, t, n, r) {
return SB({
map: Zz,
keys: [e, t, n, r]
});
}
var n_ = function() {
if (arguments.length === 2)
return Qz.apply(null, arguments);
if (arguments.length === 3)
return Jz.apply(null, arguments);
if (arguments.length === 4)
return Exe.apply(null, arguments);
if (arguments.length === 5)
return $xe.apply(null, arguments);
Un("Invalid extension access syntax");
};
vf.prototype.extension = n_;
Sxe.forEach(function(e) {
e.extensions.forEach(function(t) {
Jz(e.type, t.name, t.impl);
});
});
var e7 = function e() {
if (!(this instanceof e))
return new e();
this.length = 0;
}, mu = e7.prototype;
mu.instanceString = function() {
return "stylesheet";
};
mu.selector = function(e) {
var t = this.length++;
return this[t] = {
selector: e,
properties: []
}, this;
};
mu.css = function(e, t) {
var n = this.length - 1;
if (gt(e))
this[n].properties.push({
name: e,
value: t
});
else if (Xt(e))
for (var r = e, o = Object.keys(r), a = 0; a < o.length; a++) {
var i = o[a], s = r[i];
if (s != null) {
var l = Wr.properties[i] || Wr.properties[dm(i)];
if (l != null) {
var u = l.name, c = s;
this[n].properties.push({
name: u,
value: c
});
}
}
}
return this;
};
mu.style = mu.css;
mu.generateStyle = function(e) {
var t = new Wr(e);
return this.appendToStyle(t);
};
mu.appendToStyle = function(e) {
for (var t = 0; t < this.length; t++) {
var n = this[t], r = n.selector, o = n.properties;
e.selector(r);
for (var a = 0; a < o.length; a++) {
var i = o[a];
e.css(i.name, i.value);
}
}
return e;
};
var Oxe = "3.30.2", ul = function(e) {
if (e === void 0 && (e = {}), Xt(e))
return new vf(e);
if (gt(e))
return n_.apply(n_, arguments);
};
ul.use = function(e) {
var t = Array.prototype.slice.call(arguments, 1);
return t.unshift(ul), e.apply(null, t), this;
};
ul.warnings = function(e) {
return PB(e);
};
ul.version = Oxe;
ul.stylesheet = ul.Stylesheet = e7;
var t7 = { exports: {} };
function L$(e) {
throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var Cy, DF;
function Fxe() {
if (DF) return Cy;
DF = 1;
function e() {
this.__data__ = [], this.size = 0;
}
return Cy = e, Cy;
}
var _y, BF;
function $d() {
if (BF) return _y;
BF = 1;
function e(t, n) {
return t === n || t !== t && n !== n;
}
return _y = e, _y;
}
var Sy, zF;
function Fm() {
if (zF) return Sy;
zF = 1;
var e = $d();
function t(n, r) {
for (var o = n.length; o--; )
if (e(n[o][0], r))
return o;
return -1;
}
return Sy = t, Sy;
}
var $y, jF;
function Txe() {
if (jF) return $y;
jF = 1;
var e = Fm(), t = Array.prototype, n = t.splice;
function r(o) {
var a = this.__data__, i = e(a, o);
if (i < 0)
return !1;
var s = a.length - 1;
return i == s ? a.pop() : n.call(a, i, 1), --this.size, !0;
}
return $y = r, $y;
}
var Ey, VF;
function Axe() {
if (VF) return Ey;
VF = 1;
var e = Fm();
function t(n) {
var r = this.__data__, o = e(r, n);
return o < 0 ? void 0 : r[o][1];
}
return Ey = t, Ey;
}
var Oy, HF;
function Ixe() {
if (HF) return Oy;
HF = 1;
var e = Fm();
function t(n) {
return e(this.__data__, n) > -1;
}
return Oy = t, Oy;
}
var Fy, UF;
function Pxe() {
if (UF) return Fy;
UF = 1;
var e = Fm();
function t(n, r) {
var o = this.__data__, a = e(o, n);
return a < 0 ? (++this.size, o.push([n, r])) : o[a][1] = r, this;
}
return Fy = t, Fy;
}
var Ty, qF;
function Tm() {
if (qF) return Ty;
qF = 1;
var e = Fxe(), t = Txe(), n = Axe(), r = Ixe(), o = Pxe();
function a(i) {
var s = -1, l = i == null ? 0 : i.length;
for (this.clear(); ++s < l; ) {
var u = i[s];
this.set(u[0], u[1]);
}
}
return a.prototype.clear = e, a.prototype.delete = t, a.prototype.get = n, a.prototype.has = r, a.prototype.set = o, Ty = a, Ty;
}
var Ay, KF;
function Lxe() {
if (KF) return Ay;
KF = 1;
var e = Tm();
function t() {
this.__data__ = new e(), this.size = 0;
}
return Ay = t, Ay;
}
var Iy, GF;
function Rxe() {
if (GF) return Iy;
GF = 1;
function e(t) {
var n = this.__data__, r = n.delete(t);
return this.size = n.size, r;
}
return Iy = e, Iy;
}
var Py, WF;
function Nxe() {
if (WF) return Py;
WF = 1;
function e(t) {
return this.__data__.get(t);
}
return Py = e, Py;
}
var Ly, YF;
function Mxe() {
if (YF) return Ly;
YF = 1;
function e(t) {
return this.__data__.has(t);
}
return Ly = e, Ly;
}
var Ry, XF;
function n7() {
if (XF) return Ry;
XF = 1;
var e = typeof vp == "object" && vp && vp.Object === Object && vp;
return Ry = e, Ry;
}
var Ny, ZF;
function qa() {
if (ZF) return Ny;
ZF = 1;
var e = n7(), t = typeof self == "object" && self && self.Object === Object && self, n = e || t || Function("return this")();
return Ny = n, Ny;
}
var My, JF;
function Ed() {
if (JF) return My;
JF = 1;
var e = qa(), t = e.Symbol;
return My = t, My;
}
var Dy, QF;
function Dxe() {
if (QF) return Dy;
QF = 1;
var e = Ed(), t = Object.prototype, n = t.hasOwnProperty, r = t.toString, o = e ? e.toStringTag : void 0;
function a(i) {
var s = n.call(i, o), l = i[o];
try {
i[o] = void 0;
var u = !0;
} catch {
}
var c = r.call(i);
return u && (s ? i[o] = l : delete i[o]), c;
}
return Dy = a, Dy;
}
var By, eT;
function Bxe() {
if (eT) return By;
eT = 1;
var e = Object.prototype, t = e.toString;
function n(r) {
return t.call(r);
}
return By = n, By;
}
var zy, tT;
function Bu() {
if (tT) return zy;
tT = 1;
var e = Ed(), t = Dxe(), n = Bxe(), r = "[object Null]", o = "[object Undefined]", a = e ? e.toStringTag : void 0;
function i(s) {
return s == null ? s === void 0 ? o : r : a && a in Object(s) ? t(s) : n(s);
}
return zy = i, zy;
}
var jy, nT;
function ya() {
if (nT) return jy;
nT = 1;
function e(t) {
var n = typeof t;
return t != null && (n == "object" || n == "function");
}
return jy = e, jy;
}
var Vy, rT;
function uh() {
if (rT) return Vy;
rT = 1;
var e = Bu(), t = ya(), n = "[object AsyncFunction]", r = "[object Function]", o = "[object GeneratorFunction]", a = "[object Proxy]";
function i(s) {
if (!t(s))
return !1;
var l = e(s);
return l == r || l == o || l == n || l == a;
}
return Vy = i, Vy;
}
var Hy, oT;
function zxe() {
if (oT) return Hy;
oT = 1;
var e = qa(), t = e["__core-js_shared__"];
return Hy = t, Hy;
}
var Uy, aT;
function jxe() {
if (aT) return Uy;
aT = 1;
var e = zxe(), t = function() {
var r = /[^.]+$/.exec(e && e.keys && e.keys.IE_PROTO || "");
return r ? "Symbol(src)_1." + r : "";
}();
function n(r) {
return !!t && t in r;
}
return Uy = n, Uy;
}
var qy, iT;
function r7() {
if (iT) return qy;
iT = 1;
var e = Function.prototype, t = e.toString;
function n(r) {
if (r != null) {
try {
return t.call(r);
} catch {
}
try {
return r + "";
} catch {
}
}
return "";
}
return qy = n, qy;
}
var Ky, sT;
function Vxe() {
if (sT) return Ky;
sT = 1;
var e = uh(), t = jxe(), n = ya(), r = r7(), o = /[\\^$.*+?()[\]{}|]/g, a = /^\[object .+?Constructor\]$/, i = Function.prototype, s = Object.prototype, l = i.toString, u = s.hasOwnProperty, c = RegExp(
"^" + l.call(u).replace(o, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function d(p) {
if (!n(p) || t(p))
return !1;
var h = e(p) ? c : a;
return h.test(r(p));
}
return Ky = d, Ky;
}
var Gy, lT;
function Hxe() {
if (lT) return Gy;
lT = 1;
function e(t, n) {
return t == null ? void 0 : t[n];
}
return Gy = e, Gy;
}
var Wy, uT;
function zu() {
if (uT) return Wy;
uT = 1;
var e = Vxe(), t = Hxe();
function n(r, o) {
var a = t(r, o);
return e(a) ? a : void 0;
}
return Wy = n, Wy;
}
var Yy, cT;
function R$() {
if (cT) return Yy;
cT = 1;
var e = zu(), t = qa(), n = e(t, "Map");
return Yy = n, Yy;
}
var Xy, dT;
function Am() {
if (dT) return Xy;
dT = 1;
var e = zu(), t = e(Object, "create");
return Xy = t, Xy;
}
var Zy, pT;
function Uxe() {
if (pT) return Zy;
pT = 1;
var e = Am();
function t() {
this.__data__ = e ? e(null) : {}, this.size = 0;
}
return Zy = t, Zy;
}
var Jy, fT;
function qxe() {
if (fT) return Jy;
fT = 1;
function e(t) {
var n = this.has(t) && delete this.__data__[t];
return this.size -= n ? 1 : 0, n;
}
return Jy = e, Jy;
}
var Qy, hT;
function Kxe() {
if (hT) return Qy;
hT = 1;
var e = Am(), t = "__lodash_hash_undefined__", n = Object.prototype, r = n.hasOwnProperty;
function o(a) {
var i = this.__data__;
if (e) {
var s = i[a];
return s === t ? void 0 : s;
}
return r.call(i, a) ? i[a] : void 0;
}
return Qy = o, Qy;
}
var eb, vT;
function Gxe() {
if (vT) return eb;
vT = 1;
var e = Am(), t = Object.prototype, n = t.hasOwnProperty;
function r(o) {
var a = this.__data__;
return e ? a[o] !== void 0 : n.call(a, o);
}
return eb = r, eb;
}
var tb, gT;
function Wxe() {
if (gT) return tb;
gT = 1;
var e = Am(), t = "__lodash_hash_undefined__";
function n(r, o) {
var a = this.__data__;
return this.size += this.has(r) ? 0 : 1, a[r] = e && o === void 0 ? t : o, this;
}
return tb = n, tb;
}
var nb, mT;
function Yxe() {
if (mT) return nb;
mT = 1;
var e = Uxe(), t = qxe(), n = Kxe(), r = Gxe(), o = Wxe();
function a(i) {
var s = -1, l = i == null ? 0 : i.length;
for (this.clear(); ++s < l; ) {
var u = i[s];
this.set(u[0], u[1]);
}
}
return a.prototype.clear = e, a.prototype.delete = t, a.prototype.get = n, a.prototype.has = r, a.prototype.set = o, nb = a, nb;
}
var rb, yT;
function Xxe() {
if (yT) return rb;
yT = 1;
var e = Yxe(), t = Tm(), n = R$();
function r() {
this.size = 0, this.__data__ = {
hash: new e(),
map: new (n || t)(),
string: new e()
};
}
return rb = r, rb;
}
var ob, bT;
function Zxe() {
if (bT) return ob;
bT = 1;
function e(t) {
var n = typeof t;
return n == "string" || n == "number" || n == "symbol" || n == "boolean" ? t !== "__proto__" : t === null;
}
return ob = e, ob;
}
var ab, wT;
function Im() {
if (wT) return ab;
wT = 1;
var e = Zxe();
function t(n, r) {
var o = n.__data__;
return e(r) ? o[typeof r == "string" ? "string" : "hash"] : o.map;
}
return ab = t, ab;
}
var ib, xT;
function Jxe() {
if (xT) return ib;
xT = 1;
var e = Im();
function t(n) {
var r = e(this, n).delete(n);
return this.size -= r ? 1 : 0, r;
}
return ib = t, ib;
}
var sb, kT;
function Qxe() {
if (kT) return sb;
kT = 1;
var e = Im();
function t(n) {
return e(this, n).get(n);
}
return sb = t, sb;
}
var lb, CT;
function eke() {
if (CT) return lb;
CT = 1;
var e = Im();
function t(n) {
return e(this, n).has(n);
}
return lb = t, lb;
}
var ub, _T;
function tke() {
if (_T) return ub;
_T = 1;
var e = Im();
function t(n, r) {
var o = e(this, n), a = o.size;
return o.set(n, r), this.size += o.size == a ? 0 : 1, this;
}
return ub = t, ub;
}
var cb, ST;
function N$() {
if (ST) return cb;
ST = 1;
var e = Xxe(), t = Jxe(), n = Qxe(), r = eke(), o = tke();
function a(i) {
var s = -1, l = i == null ? 0 : i.length;
for (this.clear(); ++s < l; ) {
var u = i[s];
this.set(u[0], u[1]);
}
}
return a.prototype.clear = e, a.prototype.delete = t, a.prototype.get = n, a.prototype.has = r, a.prototype.set = o, cb = a, cb;
}
var db, $T;
function nke() {
if ($T) return db;
$T = 1;
var e = Tm(), t = R$(), n = N$(), r = 200;
function o(a, i) {
var s = this.__data__;
if (s instanceof e) {
var l = s.__data__;
if (!t || l.length < r - 1)
return l.push([a, i]), this.size = ++s.size, this;
s = this.__data__ = new n(l);
}
return s.set(a, i), this.size = s.size, this;
}
return db = o, db;
}
var pb, ET;
function Pm() {
if (ET) return pb;
ET = 1;
var e = Tm(), t = Lxe(), n = Rxe(), r = Nxe(), o = Mxe(), a = nke();
function i(s) {
var l = this.__data__ = new e(s);
this.size = l.size;
}
return i.prototype.clear = t, i.prototype.delete = n, i.prototype.get = r, i.prototype.has = o, i.prototype.set = a, pb = i, pb;
}
var fb, OT;
function M$() {
if (OT) return fb;
OT = 1;
function e(t, n) {
for (var r = -1, o = t == null ? 0 : t.length; ++r < o && n(t[r], r, t) !== !1; )
;
return t;
}
return fb = e, fb;
}
var hb, FT;
function o7() {
if (FT) return hb;
FT = 1;
var e = zu(), t = function() {
try {
var n = e(Object, "defineProperty");
return n({}, "", {}), n;
} catch {
}
}();
return hb = t, hb;
}
var vb, TT;
function Lm() {
if (TT) return vb;
TT = 1;
var e = o7();
function t(n, r, o) {
r == "__proto__" && e ? e(n, r, {
configurable: !0,
enumerable: !0,
value: o,
writable: !0
}) : n[r] = o;
}
return vb = t, vb;
}
var gb, AT;
function Rm() {
if (AT) return gb;
AT = 1;
var e = Lm(), t = $d(), n = Object.prototype, r = n.hasOwnProperty;
function o(a, i, s) {
var l = a[i];
(!(r.call(a, i) && t(l, s)) || s === void 0 && !(i in a)) && e(a, i, s);
}
return gb = o, gb;
}
var mb, IT;
function ch() {
if (IT) return mb;
IT = 1;
var e = Rm(), t = Lm();
function n(r, o, a, i) {
var s = !a;
a || (a = {});
for (var l = -1, u = o.length; ++l < u; ) {
var c = o[l], d = i ? i(a[c], r[c], c, a, r) : void 0;
d === void 0 && (d = r[c]), s ? t(a, c, d) : e(a, c, d);
}
return a;
}
return mb = n, mb;
}
var yb, PT;
function rke() {
if (PT) return yb;
PT = 1;
function e(t, n) {
for (var r = -1, o = Array(t); ++r < t; )
o[r] = n(r);
return o;
}
return yb = e, yb;
}
var bb, LT;
function Ai() {
if (LT) return bb;
LT = 1;
function e(t) {
return t != null && typeof t == "object";
}
return bb = e, bb;
}
var wb, RT;
function oke() {
if (RT) return wb;
RT = 1;
var e = Bu(), t = Ai(), n = "[object Arguments]";
function r(o) {
return t(o) && e(o) == n;
}
return wb = r, wb;
}
var xb, NT;
function dh() {
if (NT) return xb;
NT = 1;
var e = oke(), t = Ai(), n = Object.prototype, r = n.hasOwnProperty, o = n.propertyIsEnumerable, a = e(/* @__PURE__ */ function() {
return arguments;
}()) ? e : function(i) {
return t(i) && r.call(i, "callee") && !o.call(i, "callee");
};
return xb = a, xb;
}
var kb, MT;
function rr() {
if (MT) return kb;
MT = 1;
var e = Array.isArray;
return kb = e, kb;
}
var tg = { exports: {} }, Cb, DT;
function ake() {
if (DT) return Cb;
DT = 1;
function e() {
return !1;
}
return Cb = e, Cb;
}
tg.exports;
var BT;
function Od() {
return BT || (BT = 1, function(e, t) {
var n = qa(), r = ake(), o = t && !t.nodeType && t, a = o && !0 && e && !e.nodeType && e, i = a && a.exports === o, s = i ? n.Buffer : void 0, l = s ? s.isBuffer : void 0, u = l || r;
e.exports = u;
}(tg, tg.exports)), tg.exports;
}
var _b, zT;
function Nm() {
if (zT) return _b;
zT = 1;
var e = 9007199254740991, t = /^(?:0|[1-9]\d*)$/;
function n(r, o) {
var a = typeof r;
return o = o ?? e, !!o && (a == "number" || a != "symbol" && t.test(r)) && r > -1 && r % 1 == 0 && r < o;
}
return _b = n, _b;
}
var Sb, jT;
function D$() {
if (jT) return Sb;
jT = 1;
var e = 9007199254740991;
function t(n) {
return typeof n == "number" && n > -1 && n % 1 == 0 && n <= e;
}
return Sb = t, Sb;
}
var $b, VT;
function ike() {
if (VT) return $b;
VT = 1;
var e = Bu(), t = D$(), n = Ai(), r = "[object Arguments]", o = "[object Array]", a = "[object Boolean]", i = "[object Date]", s = "[object Error]", l = "[object Function]", u = "[object Map]", c = "[object Number]", d = "[object Object]", p = "[object RegExp]", h = "[object Set]", f = "[object String]", v = "[object WeakMap]", m = "[object ArrayBuffer]", g = "[object DataView]", b = "[object Float32Array]", x = "[object Float64Array]", w = "[object Int8Array]", k = "[object Int16Array]", C = "[object Int32Array]", _ = "[object Uint8Array]", $ = "[object Uint8ClampedArray]", O = "[object Uint16Array]", F = "[object Uint32Array]", A = {};
A[b] = A[x] = A[w] = A[k] = A[C] = A[_] = A[$] = A[O] = A[F] = !0, A[r] = A[o] = A[m] = A[a] = A[g] = A[i] = A[s] = A[l] = A[u] = A[c] = A[d] = A[p] = A[h] = A[f] = A[v] = !1;
function T(R) {
return n(R) && t(R.length) && !!A[e(R)];
}
return $b = T, $b;
}
var Eb, HT;
function Mm() {
if (HT) return Eb;
HT = 1;
function e(t) {
return function(n) {
return t(n);
};
}
return Eb = e, Eb;
}
var ng = { exports: {} };
ng.exports;
var UT;
function B$() {
return UT || (UT = 1, function(e, t) {
var n = n7(), r = t && !t.nodeType && t, o = r && !0 && e && !e.nodeType && e, a = o && o.exports === r, i = a && n.process, s = function() {
try {
var l = o && o.require && o.require("util").types;
return l || i && i.binding && i.binding("util");
} catch {
}
}();
e.exports = s;
}(ng, ng.exports)), ng.exports;
}
var Ob, qT;
function ph() {
if (qT) return Ob;
qT = 1;
var e = ike(), t = Mm(), n = B$(), r = n && n.isTypedArray, o = r ? t(r) : e;
return Ob = o, Ob;
}
var Fb, KT;
function a7() {
if (KT) return Fb;
KT = 1;
var e = rke(), t = dh(), n = rr(), r = Od(), o = Nm(), a = ph(), i = Object.prototype, s = i.hasOwnProperty;
function l(u, c) {
var d = n(u), p = !d && t(u), h = !d && !p && r(u), f = !d && !p && !h && a(u), v = d || p || h || f, m = v ? e(u.length, String) : [], g = m.length;
for (var b in u)
(c || s.call(u, b)) && !(v && // Safari 9 has enumerable `arguments.length` in strict mode.
(b == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
h && (b == "offset" || b == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
f && (b == "buffer" || b == "byteLength" || b == "byteOffset") || // Skip index properties.
o(b, g))) && m.push(b);
return m;
}
return Fb = l, Fb;
}
var Tb, GT;
function Dm() {
if (GT) return Tb;
GT = 1;
var e = Object.prototype;
function t(n) {
var r = n && n.constructor, o = typeof r == "function" && r.prototype || e;
return n === o;
}
return Tb = t, Tb;
}
var Ab, WT;
function i7() {
if (WT) return Ab;
WT = 1;
function e(t, n) {
return function(r) {
return t(n(r));
};
}
return Ab = e, Ab;
}
var Ib, YT;
function ske() {
if (YT) return Ib;
YT = 1;
var e = i7(), t = e(Object.keys, Object);
return Ib = t, Ib;
}
var Pb, XT;
function z$() {
if (XT) return Pb;
XT = 1;
var e = Dm(), t = ske(), n = Object.prototype, r = n.hasOwnProperty;
function o(a) {
if (!e(a))
return t(a);
var i = [];
for (var s in Object(a))
r.call(a, s) && s != "constructor" && i.push(s);
return i;
}
return Pb = o, Pb;
}
var Lb, ZT;
function ms() {
if (ZT) return Lb;
ZT = 1;
var e = uh(), t = D$();
function n(r) {
return r != null && t(r.length) && !e(r);
}
return Lb = n, Lb;
}
var Rb, JT;
function Cl() {
if (JT) return Rb;
JT = 1;
var e = a7(), t = z$(), n = ms();
function r(o) {
return n(o) ? e(o) : t(o);
}
return Rb = r, Rb;
}
var Nb, QT;
function lke() {
if (QT) return Nb;
QT = 1;
var e = ch(), t = Cl();
function n(r, o) {
return r && e(o, t(o), r);
}
return Nb = n, Nb;
}
var Mb, e8;
function uke() {
if (e8) return Mb;
e8 = 1;
function e(t) {
var n = [];
if (t != null)
for (var r in Object(t))
n.push(r);
return n;
}
return Mb = e, Mb;
}
var Db, t8;
function cke() {
if (t8) return Db;
t8 = 1;
var e = ya(), t = Dm(), n = uke(), r = Object.prototype, o = r.hasOwnProperty;
function a(i) {
if (!e(i))
return n(i);
var s = t(i), l = [];
for (var u in i)
u == "constructor" && (s || !o.call(i, u)) || l.push(u);
return l;
}
return Db = a, Db;
}
var Bb, n8;
function ju() {
if (n8) return Bb;
n8 = 1;
var e = a7(), t = cke(), n = ms();
function r(o) {
return n(o) ? e(o, !0) : t(o);
}
return Bb = r, Bb;
}
var zb, r8;
function dke() {
if (r8) return zb;
r8 = 1;
var e = ch(), t = ju();
function n(r, o) {
return r && e(o, t(o), r);
}
return zb = n, zb;
}
var rg = { exports: {} };
rg.exports;
var o8;
function s7() {
return o8 || (o8 = 1, function(e, t) {
var n = qa(), r = t && !t.nodeType && t, o = r && !0 && e && !e.nodeType && e, a = o && o.exports === r, i = a ? n.Buffer : void 0, s = i ? i.allocUnsafe : void 0;
function l(u, c) {
if (c)
return u.slice();
var d = u.length, p = s ? s(d) : new u.constructor(d);
return u.copy(p), p;
}
e.exports = l;
}(rg, rg.exports)), rg.exports;
}
var jb, a8;
function l7() {
if (a8) return jb;
a8 = 1;
function e(t, n) {
var r = -1, o = t.length;
for (n || (n = Array(o)); ++r < o; )
n[r] = t[r];
return n;
}
return jb = e, jb;
}
var Vb, i8;
function u7() {
if (i8) return Vb;
i8 = 1;
function e(t, n) {
for (var r = -1, o = t == null ? 0 : t.length, a = 0, i = []; ++r < o; ) {
var s = t[r];
n(s, r, t) && (i[a++] = s);
}
return i;
}
return Vb = e, Vb;
}
var Hb, s8;
function c7() {
if (s8) return Hb;
s8 = 1;
function e() {
return [];
}
return Hb = e, Hb;
}
var Ub, l8;
function j$() {
if (l8) return Ub;
l8 = 1;
var e = u7(), t = c7(), n = Object.prototype, r = n.propertyIsEnumerable, o = Object.getOwnPropertySymbols, a = o ? function(i) {
return i == null ? [] : (i = Object(i), e(o(i), function(s) {
return r.call(i, s);
}));
} : t;
return Ub = a, Ub;
}
var qb, u8;
function pke() {
if (u8) return qb;
u8 = 1;
var e = ch(), t = j$();
function n(r, o) {
return e(r, t(r), o);
}
return qb = n, qb;
}
var Kb, c8;
function V$() {
if (c8) return Kb;
c8 = 1;
function e(t, n) {
for (var r = -1, o = n.length, a = t.length; ++r < o; )
t[a + r] = n[r];
return t;
}
return Kb = e, Kb;
}
var Gb, d8;
function Bm() {
if (d8) return Gb;
d8 = 1;
var e = i7(), t = e(Object.getPrototypeOf, Object);
return Gb = t, Gb;
}
var Wb, p8;
function d7() {
if (p8) return Wb;
p8 = 1;
var e = V$(), t = Bm(), n = j$(), r = c7(), o = Object.getOwnPropertySymbols, a = o ? function(i) {
for (var s = []; i; )
e(s, n(i)), i = t(i);
return s;
} : r;
return Wb = a, Wb;
}
var Yb, f8;
function fke() {
if (f8) return Yb;
f8 = 1;
var e = ch(), t = d7();
function n(r, o) {
return e(r, t(r), o);
}
return Yb = n, Yb;
}
var Xb, h8;
function p7() {
if (h8) return Xb;
h8 = 1;
var e = V$(), t = rr();
function n(r, o, a) {
var i = o(r);
return t(r) ? i : e(i, a(r));
}
return Xb = n, Xb;
}
var Zb, v8;
function f7() {
if (v8) return Zb;
v8 = 1;
var e = p7(), t = j$(), n = Cl();
function r(o) {
return e(o, n, t);
}
return Zb = r, Zb;
}
var Jb, g8;
function hke() {
if (g8) return Jb;
g8 = 1;
var e = p7(), t = d7(), n = ju();
function r(o) {
return e(o, n, t);
}
return Jb = r, Jb;
}
var Qb, m8;
function vke() {
if (m8) return Qb;
m8 = 1;
var e = zu(), t = qa(), n = e(t, "DataView");
return Qb = n, Qb;
}
var ew, y8;
function gke() {
if (y8) return ew;
y8 = 1;
var e = zu(), t = qa(), n = e(t, "Promise");
return ew = n, ew;
}
var tw, b8;
function h7() {
if (b8) return tw;
b8 = 1;
var e = zu(), t = qa(), n = e(t, "Set");
return tw = n, tw;
}
var nw, w8;
function mke() {
if (w8) return nw;
w8 = 1;
var e = zu(), t = qa(), n = e(t, "WeakMap");
return nw = n, nw;
}
var rw, x8;
function Fd() {
if (x8) return rw;
x8 = 1;
var e = vke(), t = R$(), n = gke(), r = h7(), o = mke(), a = Bu(), i = r7(), s = "[object Map]", l = "[object Object]", u = "[object Promise]", c = "[object Set]", d = "[object WeakMap]", p = "[object DataView]", h = i(e), f = i(t), v = i(n), m = i(r), g = i(o), b = a;
return (e && b(new e(new ArrayBuffer(1))) != p || t && b(new t()) != s || n && b(n.resolve()) != u || r && b(new r()) != c || o && b(new o()) != d) && (b = function(x) {
var w = a(x), k = w == l ? x.constructor : void 0, C = k ? i(k) : "";
if (C)
switch (C) {
case h:
return p;
case f:
return s;
case v:
return u;
case m:
return c;
case g:
return d;
}
return w;
}), rw = b, rw;
}
var ow, k8;
function yke() {
if (k8) return ow;
k8 = 1;
var e = Object.prototype, t = e.hasOwnProperty;
function n(r) {
var o = r.length, a = new r.constructor(o);
return o && typeof r[0] == "string" && t.call(r, "index") && (a.index = r.index, a.input = r.input), a;
}
return ow = n, ow;
}
var aw, C8;
function v7() {
if (C8) return aw;
C8 = 1;
var e = qa(), t = e.Uint8Array;
return aw = t, aw;
}
var iw, _8;
function H$() {
if (_8) return iw;
_8 = 1;
var e = v7();
function t(n) {
var r = new n.constructor(n.byteLength);
return new e(r).set(new e(n)), r;
}
return iw = t, iw;
}
var sw, S8;
function bke() {
if (S8) return sw;
S8 = 1;
var e = H$();
function t(n, r) {
var o = r ? e(n.buffer) : n.buffer;
return new n.constructor(o, n.byteOffset, n.byteLength);
}
return sw = t, sw;
}
var lw, $8;
function wke() {
if ($8) return lw;
$8 = 1;
var e = /\w*$/;
function t(n) {
var r = new n.constructor(n.source, e.exec(n));
return r.lastIndex = n.lastIndex, r;
}
return lw = t, lw;
}
var uw, E8;
function xke() {
if (E8) return uw;
E8 = 1;
var e = Ed(), t = e ? e.prototype : void 0, n = t ? t.valueOf : void 0;
function r(o) {
return n ? Object(n.call(o)) : {};
}
return uw = r, uw;
}
var cw, O8;
function g7() {
if (O8) return cw;
O8 = 1;
var e = H$();
function t(n, r) {
var o = r ? e(n.buffer) : n.buffer;
return new n.constructor(o, n.byteOffset, n.length);
}
return cw = t, cw;
}
var dw, F8;
function kke() {
if (F8) return dw;
F8 = 1;
var e = H$(), t = bke(), n = wke(), r = xke(), o = g7(), a = "[object Boolean]", i = "[object Date]", s = "[object Map]", l = "[object Number]", u = "[object RegExp]", c = "[object Set]", d = "[object String]", p = "[object Symbol]", h = "[object ArrayBuffer]", f = "[object DataView]", v = "[object Float32Array]", m = "[object Float64Array]", g = "[object Int8Array]", b = "[object Int16Array]", x = "[object Int32Array]", w = "[object Uint8Array]", k = "[object Uint8ClampedArray]", C = "[object Uint16Array]", _ = "[object Uint32Array]";
function $(O, F, A) {
var T = O.constructor;
switch (F) {
case h:
return e(O);
case a:
case i:
return new T(+O);
case f:
return t(O, A);
case v:
case m:
case g:
case b:
case x:
case w:
case k:
case C:
case _:
return o(O, A);
case s:
return new T();
case l:
case d:
return new T(O);
case u:
return n(O);
case c:
return new T();
case p:
return r(O);
}
}
return dw = $, dw;
}
var pw, T8;
function m7() {
if (T8) return pw;
T8 = 1;
var e = ya(), t = Object.create, n = /* @__PURE__ */ function() {
function r() {
}
return function(o) {
if (!e(o))
return {};
if (t)
return t(o);
r.prototype = o;
var a = new r();
return r.prototype = void 0, a;
};
}();
return pw = n, pw;
}
var fw, A8;
function y7() {
if (A8) return fw;
A8 = 1;
var e = m7(), t = Bm(), n = Dm();
function r(o) {
return typeof o.constructor == "function" && !n(o) ? e(t(o)) : {};
}
return fw = r, fw;
}
var hw, I8;
function Cke() {
if (I8) return hw;
I8 = 1;
var e = Fd(), t = Ai(), n = "[object Map]";
function r(o) {
return t(o) && e(o) == n;
}
return hw = r, hw;
}
var vw, P8;
function _ke() {
if (P8) return vw;
P8 = 1;
var e = Cke(), t = Mm(), n = B$(), r = n && n.isMap, o = r ? t(r) : e;
return vw = o, vw;
}
var gw, L8;
function Ske() {
if (L8) return gw;
L8 = 1;
var e = Fd(), t = Ai(), n = "[object Set]";
function r(o) {
return t(o) && e(o) == n;
}
return gw = r, gw;
}
var mw, R8;
function $ke() {
if (R8) return mw;
R8 = 1;
var e = Ske(), t = Mm(), n = B$(), r = n && n.isSet, o = r ? t(r) : e;
return mw = o, mw;
}
var yw, N8;
function b7() {
if (N8) return yw;
N8 = 1;
var e = Pm(), t = M$(), n = Rm(), r = lke(), o = dke(), a = s7(), i = l7(), s = pke(), l = fke(), u = f7(), c = hke(), d = Fd(), p = yke(), h = kke(), f = y7(), v = rr(), m = Od(), g = _ke(), b = ya(), x = $ke(), w = Cl(), k = ju(), C = 1, _ = 2, $ = 4, O = "[object Arguments]", F = "[object Array]", A = "[object Boolean]", T = "[object Date]", R = "[object Error]", M = "[object Function]", j = "[object GeneratorFunction]", P = "[object Map]", V = "[object Number]", U = "[object Object]", G = "[object RegExp]", se = "[object Set]", ae = "[object String]", de = "[object Symbol]", me = "[object WeakMap]", te = "[object ArrayBuffer]", oe = "[object DataView]", ne = "[object Float32Array]", ee = "[object Float64Array]", Z = "[object Int8Array]", le = "[object Int16Array]", pe = "[object Int32Array]", ke = "[object Uint8Array]", Ne = "[object Uint8ClampedArray]", De = "[object Uint16Array]", _e = "[object Uint32Array]", Fe = {};
Fe[O] = Fe[F] = Fe[te] = Fe[oe] = Fe[A] = Fe[T] = Fe[ne] = Fe[ee] = Fe[Z] = Fe[le] = Fe[pe] = Fe[P] = Fe[V] = Fe[U] = Fe[G] = Fe[se] = Fe[ae] = Fe[de] = Fe[ke] = Fe[Ne] = Fe[De] = Fe[_e] = !0, Fe[R] = Fe[M] = Fe[me] = !1;
function Ie(Ae, qe, et, He, ot, tt) {
var Qe, I = qe & C, Y = qe & _, ve = qe & $;
if (et && (Qe = ot ? et(Ae, He, ot, tt) : et(Ae)), Qe !== void 0)
return Qe;
if (!b(Ae))
return Ae;
var we = v(Ae);
if (we) {
if (Qe = p(Ae), !I)
return i(Ae, Qe);
} else {
var ye = d(Ae), Pe = ye == M || ye == j;
if (m(Ae))
return a(Ae, I);
if (ye == U || ye == O || Pe && !ot) {
if (Qe = Y || Pe ? {} : f(Ae), !I)
return Y ? l(Ae, o(Qe, Ae)) : s(Ae, r(Qe, Ae));
} else {
if (!Fe[ye])
return ot ? Ae : {};
Qe = h(Ae, ye, I);
}
}
tt || (tt = new e());
var Ce = tt.get(Ae);
if (Ce)
return Ce;
tt.set(Ae, Qe), x(Ae) ? Ae.forEach(function(rt) {
Qe.add(Ie(rt, qe, et, rt, Ae, tt));
}) : g(Ae) && Ae.forEach(function(rt, fe) {
Qe.set(fe, Ie(rt, qe, et, fe, Ae, tt));
});
var ze = ve ? Y ? c : u : Y ? k : w, lt = we ? void 0 : ze(Ae);
return t(lt || Ae, function(rt, fe) {
lt && (fe = rt, rt = Ae[fe]), n(Qe, fe, Ie(rt, qe, et, fe, Ae, tt));
}), Qe;
}
return yw = Ie, yw;
}
var bw, M8;
function Eke() {
if (M8) return bw;
M8 = 1;
var e = b7(), t = 4;
function n(r) {
return e(r, t);
}
return bw = n, bw;
}
var ww, D8;
function U$() {
if (D8) return ww;
D8 = 1;
function e(t) {
return function() {
return t;
};
}
return ww = e, ww;
}
var xw, B8;
function Oke() {
if (B8) return xw;
B8 = 1;
function e(t) {
return function(n, r, o) {
for (var a = -1, i = Object(n), s = o(n), l = s.length; l--; ) {
var u = s[t ? l : ++a];
if (r(i[u], u, i) === !1)
break;
}
return n;
};
}
return xw = e, xw;
}
var kw, z8;
function q$() {
if (z8) return kw;
z8 = 1;
var e = Oke(), t = e();
return kw = t, kw;
}
var Cw, j8;
function K$() {
if (j8) return Cw;
j8 = 1;
var e = q$(), t = Cl();
function n(r, o) {
return r && e(r, o, t);
}
return Cw = n, Cw;
}
var _w, V8;
function Fke() {
if (V8) return _w;
V8 = 1;
var e = ms();
function t(n, r) {
return function(o, a) {
if (o == null)
return o;
if (!e(o))
return n(o, a);
for (var i = o.length, s = r ? i : -1, l = Object(o); (r ? s-- : ++s < i) && a(l[s], s, l) !== !1; )
;
return o;
};
}
return _w = t, _w;
}
var Sw, H8;
function zm() {
if (H8) return Sw;
H8 = 1;
var e = K$(), t = Fke(), n = t(e);
return Sw = n, Sw;
}
var $w, U8;
function Vu() {
if (U8) return $w;
U8 = 1;
function e(t) {
return t;
}
return $w = e, $w;
}
var Ew, q8;
function w7() {
if (q8) return Ew;
q8 = 1;
var e = Vu();
function t(n) {
return typeof n == "function" ? n : e;
}
return Ew = t, Ew;
}
var Ow, K8;
function x7() {
if (K8) return Ow;
K8 = 1;
var e = M$(), t = zm(), n = w7(), r = rr();
function o(a, i) {
var s = r(a) ? e : t;
return s(a, n(i));
}
return Ow = o, Ow;
}
var G8, W8;
function k7() {
return W8 || (W8 = 1, G8 = x7()), G8;
}
var Fw, Y8;
function Tke() {
if (Y8) return Fw;
Y8 = 1;
var e = zm();
function t(n, r) {
var o = [];
return e(n, function(a, i, s) {
r(a, i, s) && o.push(a);
}), o;
}
return Fw = t, Fw;
}
var Tw, X8;
function Ake() {
if (X8) return Tw;
X8 = 1;
var e = "__lodash_hash_undefined__";
function t(n) {
return this.__data__.set(n, e), this;
}
return Tw = t, Tw;
}
var Aw, Z8;
function Ike() {
if (Z8) return Aw;
Z8 = 1;
function e(t) {
return this.__data__.has(t);
}
return Aw = e, Aw;
}
var Iw, J8;
function C7() {
if (J8) return Iw;
J8 = 1;
var e = N$(), t = Ake(), n = Ike();
function r(o) {
var a = -1, i = o == null ? 0 : o.length;
for (this.__data__ = new e(); ++a < i; )
this.add(o[a]);
}
return r.prototype.add = r.prototype.push = t, r.prototype.has = n, Iw = r, Iw;
}
var Pw, Q8;
function Pke() {
if (Q8) return Pw;
Q8 = 1;
function e(t, n) {
for (var r = -1, o = t == null ? 0 : t.length; ++r < o; )
if (n(t[r], r, t))
return !0;
return !1;
}
return Pw = e, Pw;
}
var Lw, eA;
function _7() {
if (eA) return Lw;
eA = 1;
function e(t, n) {
return t.has(n);
}
return Lw = e, Lw;
}
var Rw, tA;
function S7() {
if (tA) return Rw;
tA = 1;
var e = C7(), t = Pke(), n = _7(), r = 1, o = 2;
function a(i, s, l, u, c, d) {
var p = l & r, h = i.length, f = s.length;
if (h != f && !(p && f > h))
return !1;
var v = d.get(i), m = d.get(s);
if (v && m)
return v == s && m == i;
var g = -1, b = !0, x = l & o ? new e() : void 0;
for (d.set(i, s), d.set(s, i); ++g < h; ) {
var w = i[g], k = s[g];
if (u)
var C = p ? u(k, w, g, s, i, d) : u(w, k, g, i, s, d);
if (C !== void 0) {
if (C)
continue;
b = !1;
break;
}
if (x) {
if (!t(s, function(_, $) {
if (!n(x, $) && (w === _ || c(w, _, l, u, d)))
return x.push($);
})) {
b = !1;
break;
}
} else if (!(w === k || c(w, k, l, u, d))) {
b = !1;
break;
}
}
return d.delete(i), d.delete(s), b;
}
return Rw = a, Rw;
}
var Nw, nA;
function Lke() {
if (nA) return Nw;
nA = 1;
function e(t) {
var n = -1, r = Array(t.size);
return t.forEach(function(o, a) {
r[++n] = [a, o];
}), r;
}
return Nw = e, Nw;
}
var Mw, rA;
function G$() {
if (rA) return Mw;
rA = 1;
function e(t) {
var n = -1, r = Array(t.size);
return t.forEach(function(o) {
r[++n] = o;
}), r;
}
return Mw = e, Mw;
}
var Dw, oA;
function Rke() {
if (oA) return Dw;
oA = 1;
var e = Ed(), t = v7(), n = $d(), r = S7(), o = Lke(), a = G$(), i = 1, s = 2, l = "[object Boolean]", u = "[object Date]", c = "[object Error]", d = "[object Map]", p = "[object Number]", h = "[object RegExp]", f = "[object Set]", v = "[object String]", m = "[object Symbol]", g = "[object ArrayBuffer]", b = "[object DataView]", x = e ? e.prototype : void 0, w = x ? x.valueOf : void 0;
function k(C, _, $, O, F, A, T) {
switch ($) {
case b:
if (C.byteLength != _.byteLength || C.byteOffset != _.byteOffset)
return !1;
C = C.buffer, _ = _.buffer;
case g:
return !(C.byteLength != _.byteLength || !A(new t(C), new t(_)));
case l:
case u:
case p:
return n(+C, +_);
case c:
return C.name == _.name && C.message == _.message;
case h:
case v:
return C == _ + "";
case d:
var R = o;
case f:
var M = O & i;
if (R || (R = a), C.size != _.size && !M)
return !1;
var j = T.get(C);
if (j)
return j == _;
O |= s, T.set(C, _);
var P = r(R(C), R(_), O, F, A, T);
return T.delete(C), P;
case m:
if (w)
return w.call(C) == w.call(_);
}
return !1;
}
return Dw = k, Dw;
}
var Bw, aA;
function Nke() {
if (aA) return Bw;
aA = 1;
var e = f7(), t = 1, n = Object.prototype, r = n.hasOwnProperty;
function o(a, i, s, l, u, c) {
var d = s & t, p = e(a), h = p.length, f = e(i), v = f.length;
if (h != v && !d)
return !1;
for (var m = h; m--; ) {
var g = p[m];
if (!(d ? g in i : r.call(i, g)))
return !1;
}
var b = c.get(a), x = c.get(i);
if (b && x)
return b == i && x == a;
var w = !0;
c.set(a, i), c.set(i, a);
for (var k = d; ++m < h; ) {
g = p[m];
var C = a[g], _ = i[g];
if (l)
var $ = d ? l(_, C, g, i, a, c) : l(C, _, g, a, i, c);
if (!($ === void 0 ? C === _ || u(C, _, s, l, c) : $)) {
w = !1;
break;
}
k || (k = g == "constructor");
}
if (w && !k) {
var O = a.constructor, F = i.constructor;
O != F && "constructor" in a && "constructor" in i && !(typeof O == "function" && O instanceof O && typeof F == "function" && F instanceof F) && (w = !1);
}
return c.delete(a), c.delete(i), w;
}
return Bw = o, Bw;
}
var zw, iA;
function Mke() {
if (iA) return zw;
iA = 1;
var e = Pm(), t = S7(), n = Rke(), r = Nke(), o = Fd(), a = rr(), i = Od(), s = ph(), l = 1, u = "[object Arguments]", c = "[object Array]", d = "[object Object]", p = Object.prototype, h = p.hasOwnProperty;
function f(v, m, g, b, x, w) {
var k = a(v), C = a(m), _ = k ? c : o(v), $ = C ? c : o(m);
_ = _ == u ? d : _, $ = $ == u ? d : $;
var O = _ == d, F = $ == d, A = _ == $;
if (A && i(v)) {
if (!i(m))
return !1;
k = !0, O = !1;
}
if (A && !O)
return w || (w = new e()), k || s(v) ? t(v, m, g, b, x, w) : n(v, m, _, g, b, x, w);
if (!(g & l)) {
var T = O && h.call(v, "__wrapped__"), R = F && h.call(m, "__wrapped__");
if (T || R) {
var M = T ? v.value() : v, j = R ? m.value() : m;
return w || (w = new e()), x(M, j, g, b, w);
}
}
return A ? (w || (w = new e()), r(v, m, g, b, x, w)) : !1;
}
return zw = f, zw;
}
var jw, sA;
function $7() {
if (sA) return jw;
sA = 1;
var e = Mke(), t = Ai();
function n(r, o, a, i, s) {
return r === o ? !0 : r == null || o == null || !t(r) && !t(o) ? r !== r && o !== o : e(r, o, a, i, n, s);
}
return jw = n, jw;
}
var Vw, lA;
function Dke() {
if (lA) return Vw;
lA = 1;
var e = Pm(), t = $7(), n = 1, r = 2;
function o(a, i, s, l) {
var u = s.length, c = u, d = !l;
if (a == null)
return !c;
for (a = Object(a); u--; ) {
var p = s[u];
if (d && p[2] ? p[1] !== a[p[0]] : !(p[0] in a))
return !1;
}
for (; ++u < c; ) {
p = s[u];
var h = p[0], f = a[h], v = p[1];
if (d && p[2]) {
if (f === void 0 && !(h in a))
return !1;
} else {
var m = new e();
if (l)
var g = l(f, v, h, a, i, m);
if (!(g === void 0 ? t(v, f, n | r, l, m) : g))
return !1;
}
}
return !0;
}
return Vw = o, Vw;
}
var Hw, uA;
function E7() {
if (uA) return Hw;
uA = 1;
var e = ya();
function t(n) {
return n === n && !e(n);
}
return Hw = t, Hw;
}
var Uw, cA;
function Bke() {
if (cA) return Uw;
cA = 1;
var e = E7(), t = Cl();
function n(r) {
for (var o = t(r), a = o.length; a--; ) {
var i = o[a], s = r[i];
o[a] = [i, s, e(s)];
}
return o;
}
return Uw = n, Uw;
}
var qw, dA;
function O7() {
if (dA) return qw;
dA = 1;
function e(t, n) {
return function(r) {
return r == null ? !1 : r[t] === n && (n !== void 0 || t in Object(r));
};
}
return qw = e, qw;
}
var Kw, pA;
function zke() {
if (pA) return Kw;
pA = 1;
var e = Dke(), t = Bke(), n = O7();
function r(o) {
var a = t(o);
return a.length == 1 && a[0][2] ? n(a[0][0], a[0][1]) : function(i) {
return i === o || e(i, o, a);
};
}
return Kw = r, Kw;
}
var Gw, fA;
function Td() {
if (fA) return Gw;
fA = 1;
var e = Bu(), t = Ai(), n = "[object Symbol]";
function r(o) {
return typeof o == "symbol" || t(o) && e(o) == n;
}
return Gw = r, Gw;
}
var Ww, hA;
function W$() {
if (hA) return Ww;
hA = 1;
var e = rr(), t = Td(), n = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, r = /^\w*$/;
function o(a, i) {
if (e(a))
return !1;
var s = typeof a;
return s == "number" || s == "symbol" || s == "boolean" || a == null || t(a) ? !0 : r.test(a) || !n.test(a) || i != null && a in Object(i);
}
return Ww = o, Ww;
}
var Yw, vA;
function jke() {
if (vA) return Yw;
vA = 1;
var e = N$(), t = "Expected a function";
function n(r, o) {
if (typeof r != "function" || o != null && typeof o != "function")
throw new TypeError(t);
var a = function() {
var i = arguments, s = o ? o.apply(this, i) : i[0], l = a.cache;
if (l.has(s))
return l.get(s);
var u = r.apply(this, i);
return a.cache = l.set(s, u) || l, u;
};
return a.cache = new (n.Cache || e)(), a;
}
return n.Cache = e, Yw = n, Yw;
}
var Xw, gA;
function Vke() {
if (gA) return Xw;
gA = 1;
var e = jke(), t = 500;
function n(r) {
var o = e(r, function(i) {
return a.size === t && a.clear(), i;
}), a = o.cache;
return o;
}
return Xw = n, Xw;
}
var Zw, mA;
function Hke() {
if (mA) return Zw;
mA = 1;
var e = Vke(), t = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, n = /\\(\\)?/g, r = e(function(o) {
var a = [];
return o.charCodeAt(0) === 46 && a.push(""), o.replace(t, function(i, s, l, u) {
a.push(l ? u.replace(n, "$1") : s || i);
}), a;
});
return Zw = r, Zw;
}
var Jw, yA;
function jm() {
if (yA) return Jw;
yA = 1;
function e(t, n) {
for (var r = -1, o = t == null ? 0 : t.length, a = Array(o); ++r < o; )
a[r] = n(t[r], r, t);
return a;
}
return Jw = e, Jw;
}
var Qw, bA;
function Uke() {
if (bA) return Qw;
bA = 1;
var e = Ed(), t = jm(), n = rr(), r = Td(), o = 1 / 0, a = e ? e.prototype : void 0, i = a ? a.toString : void 0;
function s(l) {
if (typeof l == "string")
return l;
if (n(l))
return t(l, s) + "";
if (r(l))
return i ? i.call(l) : "";
var u = l + "";
return u == "0" && 1 / l == -o ? "-0" : u;
}
return Qw = s, Qw;
}
var e2, wA;
function F7() {
if (wA) return e2;
wA = 1;
var e = Uke();
function t(n) {
return n == null ? "" : e(n);
}
return e2 = t, e2;
}
var t2, xA;
function Vm() {
if (xA) return t2;
xA = 1;
var e = rr(), t = W$(), n = Hke(), r = F7();
function o(a, i) {
return e(a) ? a : t(a, i) ? [a] : n(r(a));
}
return t2 = o, t2;
}
var n2, kA;
function fh() {
if (kA) return n2;
kA = 1;
var e = Td(), t = 1 / 0;
function n(r) {
if (typeof r == "string" || e(r))
return r;
var o = r + "";
return o == "0" && 1 / r == -t ? "-0" : o;
}
return n2 = n, n2;
}
var r2, CA;
function Hm() {
if (CA) return r2;
CA = 1;
var e = Vm(), t = fh();
function n(r, o) {
o = e(o, r);
for (var a = 0, i = o.length; r != null && a < i; )
r = r[t(o[a++])];
return a && a == i ? r : void 0;
}
return r2 = n, r2;
}
var o2, _A;
function qke() {
if (_A) return o2;
_A = 1;
var e = Hm();
function t(n, r, o) {
var a = n == null ? void 0 : e(n, r);
return a === void 0 ? o : a;
}
return o2 = t, o2;
}
var a2, SA;
function Kke() {
if (SA) return a2;
SA = 1;
function e(t, n) {
return t != null && n in Object(t);
}
return a2 = e, a2;
}
var i2, $A;
function T7() {
if ($A) return i2;
$A = 1;
var e = Vm(), t = dh(), n = rr(), r = Nm(), o = D$(), a = fh();
function i(s, l, u) {
l = e(l, s);
for (var c = -1, d = l.length, p = !1; ++c < d; ) {
var h = a(l[c]);
if (!(p = s != null && u(s, h)))
break;
s = s[h];
}
return p || ++c != d ? p : (d = s == null ? 0 : s.length, !!d && o(d) && r(h, d) && (n(s) || t(s)));
}
return i2 = i, i2;
}
var s2, EA;
function A7() {
if (EA) return s2;
EA = 1;
var e = Kke(), t = T7();
function n(r, o) {
return r != null && t(r, o, e);
}
return s2 = n, s2;
}
var l2, OA;
function Gke() {
if (OA) return l2;
OA = 1;
var e = $7(), t = qke(), n = A7(), r = W$(), o = E7(), a = O7(), i = fh(), s = 1, l = 2;
function u(c, d) {
return r(c) && o(d) ? a(i(c), d) : function(p) {
var h = t(p, c);
return h === void 0 && h === d ? n(p, c) : e(d, h, s | l);
};
}
return l2 = u, l2;
}
var u2, FA;
function I7() {
if (FA) return u2;
FA = 1;
function e(t) {
return function(n) {
return n == null ? void 0 : n[t];
};
}
return u2 = e, u2;
}
var c2, TA;
function Wke() {
if (TA) return c2;
TA = 1;
var e = Hm();
function t(n) {
return function(r) {
return e(r, n);
};
}
return c2 = t, c2;
}
var d2, AA;
function Yke() {
if (AA) return d2;
AA = 1;
var e = I7(), t = Wke(), n = W$(), r = fh();
function o(a) {
return n(a) ? e(r(a)) : t(a);
}
return d2 = o, d2;
}
var p2, IA;
function ys() {
if (IA) return p2;
IA = 1;
var e = zke(), t = Gke(), n = Vu(), r = rr(), o = Yke();
function a(i) {
return typeof i == "function" ? i : i == null ? n : typeof i == "object" ? r(i) ? t(i[0], i[1]) : e(i) : o(i);
}
return p2 = a, p2;
}
var f2, PA;
function P7() {
if (PA) return f2;
PA = 1;
var e = u7(), t = Tke(), n = ys(), r = rr();
function o(a, i) {
var s = r(a) ? e : t;
return s(a, n(i, 3));
}
return f2 = o, f2;
}
var h2, LA;
function Xke() {
if (LA) return h2;
LA = 1;
var e = Object.prototype, t = e.hasOwnProperty;
function n(r, o) {
return r != null && t.call(r, o);
}
return h2 = n, h2;
}
var v2, RA;
function L7() {
if (RA) return v2;
RA = 1;
var e = Xke(), t = T7();
function n(r, o) {
return r != null && t(r, o, e);
}
return v2 = n, v2;
}
var g2, NA;
function Zke() {
if (NA) return g2;
NA = 1;
var e = z$(), t = Fd(), n = dh(), r = rr(), o = ms(), a = Od(), i = Dm(), s = ph(), l = "[object Map]", u = "[object Set]", c = Object.prototype, d = c.hasOwnProperty;
function p(h) {
if (h == null)
return !0;
if (o(h) && (r(h) || typeof h == "string" || typeof h.splice == "function" || a(h) || s(h) || n(h)))
return !h.length;
var f = t(h);
if (f == l || f == u)
return !h.size;
if (i(h))
return !e(h).length;
for (var v in h)
if (d.call(h, v))
return !1;
return !0;
}
return g2 = p, g2;
}
var m2, MA;
function R7() {
if (MA) return m2;
MA = 1;
function e(t) {
return t === void 0;
}
return m2 = e, m2;
}
var y2, DA;
function N7() {
if (DA) return y2;
DA = 1;
var e = zm(), t = ms();
function n(r, o) {
var a = -1, i = t(r) ? Array(r.length) : [];
return e(r, function(s, l, u) {
i[++a] = o(s, l, u);
}), i;
}
return y2 = n, y2;
}
var b2, BA;
function M7() {
if (BA) return b2;
BA = 1;
var e = jm(), t = ys(), n = N7(), r = rr();
function o(a, i) {
var s = r(a) ? e : n;
return s(a, t(i, 3));
}
return b2 = o, b2;
}
var w2, zA;
function Jke() {
if (zA) return w2;
zA = 1;
function e(t, n, r, o) {
var a = -1, i = t == null ? 0 : t.length;
for (o && i && (r = t[++a]); ++a < i; )
r = n(r, t[a], a, t);
return r;
}
return w2 = e, w2;
}
var x2, jA;
function Qke() {
if (jA) return x2;
jA = 1;
function e(t, n, r, o, a) {
return a(t, function(i, s, l) {
r = o ? (o = !1, i) : n(r, i, s, l);
}), r;
}
return x2 = e, x2;
}
var k2, VA;
function D7() {
if (VA) return k2;
VA = 1;
var e = Jke(), t = zm(), n = ys(), r = Qke(), o = rr();
function a(i, s, l) {
var u = o(i) ? e : r, c = arguments.length < 3;
return u(i, n(s, 4), l, c, t);
}
return k2 = a, k2;
}
var C2, HA;
function eCe() {
if (HA) return C2;
HA = 1;
var e = Bu(), t = rr(), n = Ai(), r = "[object String]";
function o(a) {
return typeof a == "string" || !t(a) && n(a) && e(a) == r;
}
return C2 = o, C2;
}
var _2, UA;
function tCe() {
if (UA) return _2;
UA = 1;
var e = I7(), t = e("length");
return _2 = t, _2;
}
var S2, qA;
function nCe() {
if (qA) return S2;
qA = 1;
var e = "\\ud800-\\udfff", t = "\\u0300-\\u036f", n = "\\ufe20-\\ufe2f", r = "\\u20d0-\\u20ff", o = t + n + r, a = "\\ufe0e\\ufe0f", i = "\\u200d", s = RegExp("[" + i + e + o + a + "]");
function l(u) {
return s.test(u);
}
return S2 = l, S2;
}
var $2, KA;
function rCe() {
if (KA) return $2;
KA = 1;
var e = "\\ud800-\\udfff", t = "\\u0300-\\u036f", n = "\\ufe20-\\ufe2f", r = "\\u20d0-\\u20ff", o = t + n + r, a = "\\ufe0e\\ufe0f", i = "[" + e + "]", s = "[" + o + "]", l = "\\ud83c[\\udffb-\\udfff]", u = "(?:" + s + "|" + l + ")", c = "[^" + e + "]", d = "(?:\\ud83c[\\udde6-\\uddff]){2}", p = "[\\ud800-\\udbff][\\udc00-\\udfff]", h = "\\u200d", f = u + "?", v = "[" + a + "]?", m = "(?:" + h + "(?:" + [c, d, p].join("|") + ")" + v + f + ")*", g = v + f + m, b = "(?:" + [c + s + "?", s, d, p, i].join("|") + ")", x = RegExp(l + "(?=" + l + ")|" + b + g, "g");
function w(k) {
for (var C = x.lastIndex = 0; x.test(k); )
++C;
return C;
}
return $2 = w, $2;
}
var E2, GA;
function oCe() {
if (GA) return E2;
GA = 1;
var e = tCe(), t = nCe(), n = rCe();
function r(o) {
return t(o) ? n(o) : e(o);
}
return E2 = r, E2;
}
var O2, WA;
function aCe() {
if (WA) return O2;
WA = 1;
var e = z$(), t = Fd(), n = ms(), r = eCe(), o = oCe(), a = "[object Map]", i = "[object Set]";
function s(l) {
if (l == null)
return 0;
if (n(l))
return r(l) ? o(l) : l.length;
var u = t(l);
return u == a || u == i ? l.size : e(l).length;
}
return O2 = s, O2;
}
var F2, YA;
function iCe() {
if (YA) return F2;
YA = 1;
var e = M$(), t = m7(), n = K$(), r = ys(), o = Bm(), a = rr(), i = Od(), s = uh(), l = ya(), u = ph();
function c(d, p, h) {
var f = a(d), v = f || i(d) || u(d);
if (p = r(p, 4), h == null) {
var m = d && d.constructor;
v ? h = f ? new m() : [] : l(d) ? h = s(m) ? t(o(d)) : {} : h = {};
}
return (v ? e : n)(d, function(g, b, x) {
return p(h, g, b, x);
}), h;
}
return F2 = c, F2;
}
var T2, XA;
function sCe() {
if (XA) return T2;
XA = 1;
var e = Ed(), t = dh(), n = rr(), r = e ? e.isConcatSpreadable : void 0;
function o(a) {
return n(a) || t(a) || !!(r && a && a[r]);
}
return T2 = o, T2;
}
var A2, ZA;
function Y$() {
if (ZA) return A2;
ZA = 1;
var e = V$(), t = sCe();
function n(r, o, a, i, s) {
var l = -1, u = r.length;
for (a || (a = t), s || (s = []); ++l < u; ) {
var c = r[l];
o > 0 && a(c) ? o > 1 ? n(c, o - 1, a, i, s) : e(s, c) : i || (s[s.length] = c);
}
return s;
}
return A2 = n, A2;
}
var I2, JA;
function lCe() {
if (JA) return I2;
JA = 1;
function e(t, n, r) {
switch (r.length) {
case 0:
return t.call(n);
case 1:
return t.call(n, r[0]);
case 2:
return t.call(n, r[0], r[1]);
case 3:
return t.call(n, r[0], r[1], r[2]);
}
return t.apply(n, r);
}
return I2 = e, I2;
}
var P2, QA;
function B7() {
if (QA) return P2;
QA = 1;
var e = lCe(), t = Math.max;
function n(r, o, a) {
return o = t(o === void 0 ? r.length - 1 : o, 0), function() {
for (var i = arguments, s = -1, l = t(i.length - o, 0), u = Array(l); ++s < l; )
u[s] = i[o + s];
s = -1;
for (var c = Array(o + 1); ++s < o; )
c[s] = i[s];
return c[o] = a(u), e(r, this, c);
};
}
return P2 = n, P2;
}
var L2, e6;
function uCe() {
if (e6) return L2;
e6 = 1;
var e = U$(), t = o7(), n = Vu(), r = t ? function(o, a) {
return t(o, "toString", {
configurable: !0,
enumerable: !1,
value: e(a),
writable: !0
});
} : n;
return L2 = r, L2;
}
var R2, t6;
function cCe() {
if (t6) return R2;
t6 = 1;
var e = 800, t = 16, n = Date.now;
function r(o) {
var a = 0, i = 0;
return function() {
var s = n(), l = t - (s - i);
if (i = s, l > 0) {
if (++a >= e)
return arguments[0];
} else
a = 0;
return o.apply(void 0, arguments);
};
}
return R2 = r, R2;
}
var N2, n6;
function z7() {
if (n6) return N2;
n6 = 1;
var e = uCe(), t = cCe(), n = t(e);
return N2 = n, N2;
}
var M2, r6;
function Um() {
if (r6) return M2;
r6 = 1;
var e = Vu(), t = B7(), n = z7();
function r(o, a) {
return n(t(o, a, e), o + "");
}
return M2 = r, M2;
}
var D2, o6;
function j7() {
if (o6) return D2;
o6 = 1;
function e(t, n, r, o) {
for (var a = t.length, i = r + (o ? 1 : -1); o ? i-- : ++i < a; )
if (n(t[i], i, t))
return i;
return -1;
}
return D2 = e, D2;
}
var B2, a6;
function dCe() {
if (a6) return B2;
a6 = 1;
function e(t) {
return t !== t;
}
return B2 = e, B2;
}
var z2, i6;
function pCe() {
if (i6) return z2;
i6 = 1;
function e(t, n, r) {
for (var o = r - 1, a = t.length; ++o < a; )
if (t[o] === n)
return o;
return -1;
}
return z2 = e, z2;
}
var j2, s6;
function fCe() {
if (s6) return j2;
s6 = 1;
var e = j7(), t = dCe(), n = pCe();
function r(o, a, i) {
return a === a ? n(o, a, i) : e(o, t, i);
}
return j2 = r, j2;
}
var V2, l6;
function hCe() {
if (l6) return V2;
l6 = 1;
var e = fCe();
function t(n, r) {
var o = n == null ? 0 : n.length;
return !!o && e(n, r, 0) > -1;
}
return V2 = t, V2;
}
var H2, u6;
function vCe() {
if (u6) return H2;
u6 = 1;
function e(t, n, r) {
for (var o = -1, a = t == null ? 0 : t.length; ++o < a; )
if (r(n, t[o]))
return !0;
return !1;
}
return H2 = e, H2;
}
var U2, c6;
function gCe() {
if (c6) return U2;
c6 = 1;
function e() {
}
return U2 = e, U2;
}
var q2, d6;
function mCe() {
if (d6) return q2;
d6 = 1;
var e = h7(), t = gCe(), n = G$(), r = 1 / 0, o = e && 1 / n(new e([, -0]))[1] == r ? function(a) {
return new e(a);
} : t;
return q2 = o, q2;
}
var K2, p6;
function yCe() {
if (p6) return K2;
p6 = 1;
var e = C7(), t = hCe(), n = vCe(), r = _7(), o = mCe(), a = G$(), i = 200;
function s(l, u, c) {
var d = -1, p = t, h = l.length, f = !0, v = [], m = v;
if (c)
f = !1, p = n;
else if (h >= i) {
var g = u ? null : o(l);
if (g)
return a(g);
f = !1, p = r, m = new e();
} else
m = u ? [] : v;
e:
for (; ++d < h; ) {
var b = l[d], x = u ? u(b) : b;
if (b = c || b !== 0 ? b : 0, f && x === x) {
for (var w = m.length; w--; )
if (m[w] === x)
continue e;
u && m.push(x), v.push(b);
} else p(m, x, c) || (m !== v && m.push(x), v.push(b));
}
return v;
}
return K2 = s, K2;
}
var G2, f6;
function V7() {
if (f6) return G2;
f6 = 1;
var e = ms(), t = Ai();
function n(r) {
return t(r) && e(r);
}
return G2 = n, G2;
}
var W2, h6;
function bCe() {
if (h6) return W2;
h6 = 1;
var e = Y$(), t = Um(), n = yCe(), r = V7(), o = t(function(a) {
return n(e(a, 1, r, !0));
});
return W2 = o, W2;
}
var Y2, v6;
function wCe() {
if (v6) return Y2;
v6 = 1;
var e = jm();
function t(n, r) {
return e(r, function(o) {
return n[o];
});
}
return Y2 = t, Y2;
}
var X2, g6;
function H7() {
if (g6) return X2;
g6 = 1;
var e = wCe(), t = Cl();
function n(r) {
return r == null ? [] : e(r, t(r));
}
return X2 = n, X2;
}
var Z2, m6;
function ba() {
if (m6) return Z2;
m6 = 1;
var e;
if (typeof L$ == "function")
try {
e = {
clone: Eke(),
constant: U$(),
each: k7(),
filter: P7(),
has: L7(),
isArray: rr(),
isEmpty: Zke(),
isFunction: uh(),
isUndefined: R7(),
keys: Cl(),
map: M7(),
reduce: D7(),
size: aCe(),
transform: iCe(),
union: bCe(),
values: H7()
};
} catch {
}
return e || (e = window._), Z2 = e, Z2;
}
var J2, y6;
function X$() {
if (y6) return J2;
y6 = 1;
var e = ba();
J2 = o;
var t = "\0", n = "\0", r = "";
function o(c) {
this._isDirected = e.has(c, "directed") ? c.directed : !0, this._isMultigraph = e.has(c, "multigraph") ? c.multigraph : !1, this._isCompound = e.has(c, "compound") ? c.compound : !1, this._label = void 0, this._defaultNodeLabelFn = e.constant(void 0), this._defaultEdgeLabelFn = e.constant(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[n] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
}
o.prototype._nodeCount = 0, o.prototype._edgeCount = 0, o.prototype.isDirected = function() {
return this._isDirected;
}, o.prototype.isMultigraph = function() {
return this._isMultigraph;
}, o.prototype.isCompound = function() {
return this._isCompound;
}, o.prototype.setGraph = function(c) {
return this._label = c, this;
}, o.prototype.graph = function() {
return this._label;
}, o.prototype.setDefaultNodeLabel = function(c) {
return e.isFunction(c) || (c = e.constant(c)), this._defaultNodeLabelFn = c, this;
}, o.prototype.nodeCount = function() {
return this._nodeCount;
}, o.prototype.nodes = function() {
return e.keys(this._nodes);
}, o.prototype.sources = function() {
var c = this;
return e.filter(this.nodes(), function(d) {
return e.isEmpty(c._in[d]);
});
}, o.prototype.sinks = function() {
var c = this;
return e.filter(this.nodes(), function(d) {
return e.isEmpty(c._out[d]);
});
}, o.prototype.setNodes = function(c, d) {
var p = arguments, h = this;
return e.each(c, function(f) {
p.length > 1 ? h.setNode(f, d) : h.setNode(f);
}), this;
}, o.prototype.setNode = function(c, d) {
return e.has(this._nodes, c) ? (arguments.length > 1 && (this._nodes[c] = d), this) : (this._nodes[c] = arguments.length > 1 ? d : this._defaultNodeLabelFn(c), this._isCompound && (this._parent[c] = n, this._children[c] = {}, this._children[n][c] = !0), this._in[c] = {}, this._preds[c] = {}, this._out[c] = {}, this._sucs[c] = {}, ++this._nodeCount, this);
}, o.prototype.node = function(c) {
return this._nodes[c];
}, o.prototype.hasNode = function(c) {
return e.has(this._nodes, c);
}, o.prototype.removeNode = function(c) {
var d = this;
if (e.has(this._nodes, c)) {
var p = function(h) {
d.removeEdge(d._edgeObjs[h]);
};
delete this._nodes[c], this._isCompound && (this._removeFromParentsChildList(c), delete this._parent[c], e.each(this.children(c), function(h) {
d.setParent(h);
}), delete this._children[c]), e.each(e.keys(this._in[c]), p), delete this._in[c], delete this._preds[c], e.each(e.keys(this._out[c]), p), delete this._out[c], delete this._sucs[c], --this._nodeCount;
}
return this;
}, o.prototype.setParent = function(c, d) {
if (!this._isCompound)
throw new Error("Cannot set parent in a non-compound graph");
if (e.isUndefined(d))
d = n;
else {
d += "";
for (var p = d; !e.isUndefined(p); p = this.parent(p))
if (p === c)
throw new Error("Setting " + d + " as parent of " + c + " would create a cycle");
this.setNode(d);
}
return this.setNode(c), this._removeFromParentsChildList(c), this._parent[c] = d, this._children[d][c] = !0, this;
}, o.prototype._removeFromParentsChildList = function(c) {
delete this._children[this._parent[c]][c];
}, o.prototype.parent = function(c) {
if (this._isCompound) {
var d = this._parent[c];
if (d !== n)
return d;
}
}, o.prototype.children = function(c) {
if (e.isUndefined(c) && (c = n), this._isCompound) {
var d = this._children[c];
if (d)
return e.keys(d);
} else {
if (c === n)
return this.nodes();
if (this.hasNode(c))
return [];
}
}, o.prototype.predecessors = function(c) {
var d = this._preds[c];
if (d)
return e.keys(d);
}, o.prototype.successors = function(c) {
var d = this._sucs[c];
if (d)
return e.keys(d);
}, o.prototype.neighbors = function(c) {
var d = this.predecessors(c);
if (d)
return e.union(d, this.successors(c));
}, o.prototype.isLeaf = function(c) {
var d;
return this.isDirected() ? d = this.successors(c) : d = this.neighbors(c), d.length === 0;
}, o.prototype.filterNodes = function(c) {
var d = new this.constructor({
directed: this._isDirected,
multigraph: this._isMultigraph,
compound: this._isCompound
});
d.setGraph(this.graph());
var p = this;
e.each(this._nodes, function(v, m) {
c(m) && d.setNode(m, v);
}), e.each(this._edgeObjs, function(v) {
d.hasNode(v.v) && d.hasNode(v.w) && d.setEdge(v, p.edge(v));
});
var h = {};
function f(v) {
var m = p.parent(v);
return m === void 0 || d.hasNode(m) ? (h[v] = m, m) : m in h ? h[m] : f(m);
}
return this._isCompound && e.each(d.nodes(), function(v) {
d.setParent(v, f(v));
}), d;
}, o.prototype.setDefaultEdgeLabel = function(c) {
return e.isFunction(c) || (c = e.constant(c)), this._defaultEdgeLabelFn = c, this;
}, o.prototype.edgeCount = function() {
return this._edgeCount;
}, o.prototype.edges = function() {
return e.values(this._edgeObjs);
}, o.prototype.setPath = function(c, d) {
var p = this, h = arguments;
return e.reduce(c, function(f, v) {
return h.length > 1 ? p.setEdge(f, v, d) : p.setEdge(f, v), v;
}), this;
}, o.prototype.setEdge = function() {
var c, d, p, h, f = !1, v = arguments[0];
typeof v == "object" && v !== null && "v" in v ? (c = v.v, d = v.w, p = v.name, arguments.length === 2 && (h = arguments[1], f = !0)) : (c = v, d = arguments[1], p = arguments[3], arguments.length > 2 && (h = arguments[2], f = !0)), c = "" + c, d = "" + d, e.isUndefined(p) || (p = "" + p);
var m = s(this._isDirected, c, d, p);
if (e.has(this._edgeLabels, m))
return f && (this._edgeLabels[m] = h), this;
if (!e.isUndefined(p) && !this._isMultigraph)
throw new Error("Cannot set a named edge when isMultigraph = false");
this.setNode(c), this.setNode(d), this._edgeLabels[m] = f ? h : this._defaultEdgeLabelFn(c, d, p);
var g = l(this._isDirected, c, d, p);
return c = g.v, d = g.w, Object.freeze(g), this._edgeObjs[m] = g, a(this._preds[d], c), a(this._sucs[c], d), this._in[d][m] = g, this._out[c][m] = g, this._edgeCount++, this;
}, o.prototype.edge = function(c, d, p) {
var h = arguments.length === 1 ? u(this._isDirected, arguments[0]) : s(this._isDirected, c, d, p);
return this._edgeLabels[h];
}, o.prototype.hasEdge = function(c, d, p) {
var h = arguments.length === 1 ? u(this._isDirected, arguments[0]) : s(this._isDirected, c, d, p);
return e.has(this._edgeLabels, h);
}, o.prototype.removeEdge = function(c, d, p) {
var h = arguments.length === 1 ? u(this._isDirected, arguments[0]) : s(this._isDirected, c, d, p), f = this._edgeObjs[h];
return f && (c = f.v, d = f.w, delete this._edgeLabels[h], delete this._edgeObjs[h], i(this._preds[d], c), i(this._sucs[c], d), delete this._in[d][h], delete this._out[c][h], this._edgeCount--), this;
}, o.prototype.inEdges = function(c, d) {
var p = this._in[c];
if (p) {
var h = e.values(p);
return d ? e.filter(h, function(f) {
return f.v === d;
}) : h;
}
}, o.prototype.outEdges = function(c, d) {
var p = this._out[c];
if (p) {
var h = e.values(p);
return d ? e.filter(h, function(f) {
return f.w === d;
}) : h;
}
}, o.prototype.nodeEdges = function(c, d) {
var p = this.inEdges(c, d);
if (p)
return p.concat(this.outEdges(c, d));
};
function a(c, d) {
c[d] ? c[d]++ : c[d] = 1;
}
function i(c, d) {
--c[d] || delete c[d];
}
function s(c, d, p, h) {
var f = "" + d, v = "" + p;
if (!c && f > v) {
var m = f;
f = v, v = m;
}
return f + r + v + r + (e.isUndefined(h) ? t : h);
}
function l(c, d, p, h) {
var f = "" + d, v = "" + p;
if (!c && f > v) {
var m = f;
f = v, v = m;
}
var g = { v: f, w: v };
return h && (g.name = h), g;
}
function u(c, d) {
return s(c, d.v, d.w, d.name);
}
return J2;
}
var b6, w6;
function xCe() {
return w6 || (w6 = 1, b6 = "2.1.8"), b6;
}
var x6, k6;
function kCe() {
return k6 || (k6 = 1, x6 = {
Graph: X$(),
version: xCe()
}), x6;
}
var Q2, C6;
function CCe() {
if (C6) return Q2;
C6 = 1;
var e = ba(), t = X$();
Q2 = {
write: n,
read: a
};
function n(i) {
var s = {
options: {
directed: i.isDirected(),
multigraph: i.isMultigraph(),
compound: i.isCompound()
},
nodes: r(i),
edges: o(i)
};
return e.isUndefined(i.graph()) || (s.value = e.clone(i.graph())), s;
}
function r(i) {
return e.map(i.nodes(), function(s) {
var l = i.node(s), u = i.parent(s), c = { v: s };
return e.isUndefined(l) || (c.value = l), e.isUndefined(u) || (c.parent = u), c;
});
}
function o(i) {
return e.map(i.edges(), function(s) {
var l = i.edge(s), u = { v: s.v, w: s.w };
return e.isUndefined(s.name) || (u.name = s.name), e.isUndefined(l) || (u.value = l), u;
});
}
function a(i) {
var s = new t(i.options).setGraph(i.value);
return e.each(i.nodes, function(l) {
s.setNode(l.v, l.value), l.parent && s.setParent(l.v, l.parent);
}), e.each(i.edges, function(l) {
s.setEdge({ v: l.v, w: l.w, name: l.name }, l.value);
}), s;
}
return Q2;
}
var ex, _6;
function _Ce() {
if (_6) return ex;
_6 = 1;
var e = ba();
ex = t;
function t(n) {
var r = {}, o = [], a;
function i(s) {
e.has(r, s) || (r[s] = !0, a.push(s), e.each(n.successors(s), i), e.each(n.predecessors(s), i));
}
return e.each(n.nodes(), function(s) {
a = [], i(s), a.length && o.push(a);
}), o;
}
return ex;
}
var tx, S6;
function U7() {
if (S6) return tx;
S6 = 1;
var e = ba();
tx = t;
function t() {
this._arr = [], this._keyIndices = {};
}
return t.prototype.size = function() {
return this._arr.length;
}, t.prototype.keys = function() {
return this._arr.map(function(n) {
return n.key;
});
}, t.prototype.has = function(n) {
return e.has(this._keyIndices, n);
}, t.prototype.priority = function(n) {
var r = this._keyIndices[n];
if (r !== void 0)
return this._arr[r].priority;
}, t.prototype.min = function() {
if (this.size() === 0)
throw new Error("Queue underflow");
return this._arr[0].key;
}, t.prototype.add = function(n, r) {
var o = this._keyIndices;
if (n = String(n), !e.has(o, n)) {
var a = this._arr, i = a.length;
return o[n] = i, a.push({ key: n, priority: r }), this._decrease(i), !0;
}
return !1;
}, t.prototype.removeMin = function() {
this._swap(0, this._arr.length - 1);
var n = this._arr.pop();
return delete this._keyIndices[n.key], this._heapify(0), n.key;
}, t.prototype.decrease = function(n, r) {
var o = this._keyIndices[n];
if (r > this._arr[o].priority)
throw new Error("New priority is greater than current priority. Key: " + n + " Old: " + this._arr[o].priority + " New: " + r);
this._arr[o].priority = r, this._decrease(o);
}, t.prototype._heapify = function(n) {
var r = this._arr, o = 2 * n, a = o + 1, i = n;
o < r.length && (i = r[o].priority < r[i].priority ? o : i, a < r.length && (i = r[a].priority < r[i].priority ? a : i), i !== n && (this._swap(n, i), this._heapify(i)));
}, t.prototype._decrease = function(n) {
for (var r = this._arr, o = r[n].priority, a; n !== 0 && (a = n >> 1, !(r[a].priority < o)); )
this._swap(n, a), n = a;
}, t.prototype._swap = function(n, r) {
var o = this._arr, a = this._keyIndices, i = o[n], s = o[r];
o[n] = s, o[r] = i, a[s.key] = n, a[i.key] = r;
}, tx;
}
var nx, $6;
function q7() {
if ($6) return nx;
$6 = 1;
var e = ba(), t = U7();
nx = r;
var n = e.constant(1);
function r(a, i, s, l) {
return o(
a,
String(i),
s || n,
l || function(u) {
return a.outEdges(u);
}
);
}
function o(a, i, s, l) {
var u = {}, c = new t(), d, p, h = function(f) {
var v = f.v !== d ? f.v : f.w, m = u[v], g = s(f), b = p.distance + g;
if (g < 0)
throw new Error("dijkstra does not allow negative edge weights. Bad edge: " + f + " Weight: " + g);
b < m.distance && (m.distance = b, m.predecessor = d, c.decrease(v, b));
};
for (a.nodes().forEach(function(f) {
var v = f === i ? 0 : Number.POSITIVE_INFINITY;
u[f] = { distance: v }, c.add(f, v);
}); c.size() > 0 && (d = c.removeMin(), p = u[d], p.distance !== Number.POSITIVE_INFINITY); )
l(d).forEach(h);
return u;
}
return nx;
}
var rx, E6;
function SCe() {
if (E6) return rx;
E6 = 1;
var e = q7(), t = ba();
rx = n;
function n(r, o, a) {
return t.transform(r.nodes(), function(i, s) {
i[s] = e(r, s, o, a);
}, {});
}
return rx;
}
var ox, O6;
function K7() {
if (O6) return ox;
O6 = 1;
var e = ba();
ox = t;
function t(n) {
var r = 0, o = [], a = {}, i = [];
function s(l) {
var u = a[l] = {
onStack: !0,
lowlink: r,
index: r++
};
if (o.push(l), n.successors(l).forEach(function(p) {
e.has(a, p) ? a[p].onStack && (u.lowlink = Math.min(u.lowlink, a[p].index)) : (s(p), u.lowlink = Math.min(u.lowlink, a[p].lowlink));
}), u.lowlink === u.index) {
var c = [], d;
do
d = o.pop(), a[d].onStack = !1, c.push(d);
while (l !== d);
i.push(c);
}
}
return n.nodes().forEach(function(l) {
e.has(a, l) || s(l);
}), i;
}
return ox;
}
var ax, F6;
function $Ce() {
if (F6) return ax;
F6 = 1;
var e = ba(), t = K7();
ax = n;
function n(r) {
return e.filter(t(r), function(o) {
return o.length > 1 || o.length === 1 && r.hasEdge(o[0], o[0]);
});
}
return ax;
}
var ix, T6;
function ECe() {
if (T6) return ix;
T6 = 1;
var e = ba();
ix = n;
var t = e.constant(1);
function n(o, a, i) {
return r(
o,
a || t,
i || function(s) {
return o.outEdges(s);
}
);
}
function r(o, a, i) {
var s = {}, l = o.nodes();
return l.forEach(function(u) {
s[u] = {}, s[u][u] = { distance: 0 }, l.forEach(function(c) {
u !== c && (s[u][c] = { distance: Number.POSITIVE_INFINITY });
}), i(u).forEach(function(c) {
var d = c.v === u ? c.w : c.v, p = a(c);
s[u][d] = { distance: p, predecessor: u };
});
}), l.forEach(function(u) {
var c = s[u];
l.forEach(function(d) {
var p = s[d];
l.forEach(function(h) {
var f = p[u], v = c[h], m = p[h], g = f.distance + v.distance;
g < m.distance && (m.distance = g, m.predecessor = v.predecessor);
});
});
}), s;
}
return ix;
}
var sx, A6;
function G7() {
if (A6) return sx;
A6 = 1;
var e = ba();
sx = t, t.CycleException = n;
function t(r) {
var o = {}, a = {}, i = [];
function s(l) {
if (e.has(a, l))
throw new n();
e.has(o, l) || (a[l] = !0, o[l] = !0, e.each(r.predecessors(l), s), delete a[l], i.push(l));
}
if (e.each(r.sinks(), s), e.size(o) !== r.nodeCount())
throw new n();
return i;
}
function n() {
}
return n.prototype = new Error(), sx;
}
var lx, I6;
function OCe() {
if (I6) return lx;
I6 = 1;
var e = G7();
lx = t;
function t(n) {
try {
e(n);
} catch (r) {
if (r instanceof e.CycleException)
return !1;
throw r;
}
return !0;
}
return lx;
}
var ux, P6;
function W7() {
if (P6) return ux;
P6 = 1;
var e = ba();
ux = t;
function t(r, o, a) {
e.isArray(o) || (o = [o]);
var i = (r.isDirected() ? r.successors : r.neighbors).bind(r), s = [], l = {};
return e.each(o, function(u) {
if (!r.hasNode(u))
throw new Error("Graph does not have node: " + u);
n(r, u, a === "post", l, i, s);
}), s;
}
function n(r, o, a, i, s, l) {
e.has(i, o) || (i[o] = !0, a || l.push(o), e.each(s(o), function(u) {
n(r, u, a, i, s, l);
}), a && l.push(o));
}
return ux;
}
var cx, L6;
function FCe() {
if (L6) return cx;
L6 = 1;
var e = W7();
cx = t;
function t(n, r) {
return e(n, r, "post");
}
return cx;
}
var dx, R6;
function TCe() {
if (R6) return dx;
R6 = 1;
var e = W7();
dx = t;
function t(n, r) {
return e(n, r, "pre");
}
return dx;
}
var px, N6;
function ACe() {
if (N6) return px;
N6 = 1;
var e = ba(), t = X$(), n = U7();
px = r;
function r(o, a) {
var i = new t(), s = {}, l = new n(), u;
function c(p) {
var h = p.v === u ? p.w : p.v, f = l.priority(h);
if (f !== void 0) {
var v = a(p);
v < f && (s[h] = u, l.decrease(h, v));
}
}
if (o.nodeCount() === 0)
return i;
e.each(o.nodes(), function(p) {
l.add(p, Number.POSITIVE_INFINITY), i.setNode(p);
}), l.decrease(o.nodes()[0], 0);
for (var d = !1; l.size() > 0; ) {
if (u = l.removeMin(), e.has(s, u))
i.setEdge(u, s[u]);
else {
if (d)
throw new Error("Input graph is not connected: " + o);
d = !0;
}
o.nodeEdges(u).forEach(c);
}
return i;
}
return px;
}
var M6, D6;
function ICe() {
return D6 || (D6 = 1, M6 = {
components: _Ce(),
dijkstra: q7(),
dijkstraAll: SCe(),
findCycles: $Ce(),
floydWarshall: ECe(),
isAcyclic: OCe(),
postorder: FCe(),
preorder: TCe(),
prim: ACe(),
tarjan: K7(),
topsort: G7()
}), M6;
}
var fx, B6;
function PCe() {
if (B6) return fx;
B6 = 1;
var e = kCe();
return fx = {
Graph: e.Graph,
json: CCe(),
alg: ICe(),
version: e.version
}, fx;
}
var hx, z6;
function Va() {
if (z6) return hx;
z6 = 1;
var e;
if (typeof L$ == "function")
try {
e = PCe();
} catch {
}
return e || (e = window.graphlib), hx = e, hx;
}
var vx, j6;
function LCe() {
if (j6) return vx;
j6 = 1;
var e = b7(), t = 1, n = 4;
function r(o) {
return e(o, t | n);
}
return vx = r, vx;
}
var gx, V6;
function qm() {
if (V6) return gx;
V6 = 1;
var e = $d(), t = ms(), n = Nm(), r = ya();
function o(a, i, s) {
if (!r(s))
return !1;
var l = typeof i;
return (l == "number" ? t(s) && n(i, s.length) : l == "string" && i in s) ? e(s[i], a) : !1;
}
return gx = o, gx;
}
var mx, H6;
function RCe() {
if (H6) return mx;
H6 = 1;
var e = Um(), t = $d(), n = qm(), r = ju(), o = Object.prototype, a = o.hasOwnProperty, i = e(function(s, l) {
s = Object(s);
var u = -1, c = l.length, d = c > 2 ? l[2] : void 0;
for (d && n(l[0], l[1], d) && (c = 1); ++u < c; )
for (var p = l[u], h = r(p), f = -1, v = h.length; ++f < v; ) {
var m = h[f], g = s[m];
(g === void 0 || t(g, o[m]) && !a.call(s, m)) && (s[m] = p[m]);
}
return s;
});
return mx = i, mx;
}
var yx, U6;
function NCe() {
if (U6) return yx;
U6 = 1;
var e = ys(), t = ms(), n = Cl();
function r(o) {
return function(a, i, s) {
var l = Object(a);
if (!t(a)) {
var u = e(i, 3);
a = n(a), i = function(d) {
return u(l[d], d, l);
};
}
var c = o(a, i, s);
return c > -1 ? l[u ? a[c] : c] : void 0;
};
}
return yx = r, yx;
}
var bx, q6;
function MCe() {
if (q6) return bx;
q6 = 1;
var e = /\s/;
function t(n) {
for (var r = n.length; r-- && e.test(n.charAt(r)); )
;
return r;
}
return bx = t, bx;
}
var wx, K6;
function DCe() {
if (K6) return wx;
K6 = 1;
var e = MCe(), t = /^\s+/;
function n(r) {
return r && r.slice(0, e(r) + 1).replace(t, "");
}
return wx = n, wx;
}
var xx, G6;
function BCe() {
if (G6) return xx;
G6 = 1;
var e = DCe(), t = ya(), n = Td(), r = NaN, o = /^[-+]0x[0-9a-f]+$/i, a = /^0b[01]+$/i, i = /^0o[0-7]+$/i, s = parseInt;
function l(u) {
if (typeof u == "number")
return u;
if (n(u))
return r;
if (t(u)) {
var c = typeof u.valueOf == "function" ? u.valueOf() : u;
u = t(c) ? c + "" : c;
}
if (typeof u != "string")
return u === 0 ? u : +u;
u = e(u);
var d = a.test(u);
return d || i.test(u) ? s(u.slice(2), d ? 2 : 8) : o.test(u) ? r : +u;
}
return xx = l, xx;
}
var kx, W6;
function Y7() {
if (W6) return kx;
W6 = 1;
var e = BCe(), t = 1 / 0, n = 17976931348623157e292;
function r(o) {
if (!o)
return o === 0 ? o : 0;
if (o = e(o), o === t || o === -t) {
var a = o < 0 ? -1 : 1;
return a * n;
}
return o === o ? o : 0;
}
return kx = r, kx;
}
var Cx, Y6;
function zCe() {
if (Y6) return Cx;
Y6 = 1;
var e = Y7();
function t(n) {
var r = e(n), o = r % 1;
return r === r ? o ? r - o : r : 0;
}
return Cx = t, Cx;
}
var _x, X6;
function jCe() {
if (X6) return _x;
X6 = 1;
var e = j7(), t = ys(), n = zCe(), r = Math.max;
function o(a, i, s) {
var l = a == null ? 0 : a.length;
if (!l)
return -1;
var u = s == null ? 0 : n(s);
return u < 0 && (u = r(l + u, 0)), e(a, t(i, 3), u);
}
return _x = o, _x;
}
var Sx, Z6;
function VCe() {
if (Z6) return Sx;
Z6 = 1;
var e = NCe(), t = jCe(), n = e(t);
return Sx = n, Sx;
}
var $x, J6;
function X7() {
if (J6) return $x;
J6 = 1;
var e = Y$();
function t(n) {
var r = n == null ? 0 : n.length;
return r ? e(n, 1) : [];
}
return $x = t, $x;
}
var Ex, Q6;
function HCe() {
if (Q6) return Ex;
Q6 = 1;
var e = q$(), t = w7(), n = ju();
function r(o, a) {
return o == null ? o : e(o, t(a), n);
}
return Ex = r, Ex;
}
var Ox, eI;
function UCe() {
if (eI) return Ox;
eI = 1;
function e(t) {
var n = t == null ? 0 : t.length;
return n ? t[n - 1] : void 0;
}
return Ox = e, Ox;
}
var Fx, tI;
function qCe() {
if (tI) return Fx;
tI = 1;
var e = Lm(), t = K$(), n = ys();
function r(o, a) {
var i = {};
return a = n(a, 3), t(o, function(s, l, u) {
e(i, l, a(s, l, u));
}), i;
}
return Fx = r, Fx;
}
var Tx, nI;
function Z$() {
if (nI) return Tx;
nI = 1;
var e = Td();
function t(n, r, o) {
for (var a = -1, i = n.length; ++a < i; ) {
var s = n[a], l = r(s);
if (l != null && (u === void 0 ? l === l && !e(l) : o(l, u)))
var u = l, c = s;
}
return c;
}
return Tx = t, Tx;
}
var Ax, rI;
function KCe() {
if (rI) return Ax;
rI = 1;
function e(t, n) {
return t > n;
}
return Ax = e, Ax;
}
var Ix, oI;
function GCe() {
if (oI) return Ix;
oI = 1;
var e = Z$(), t = KCe(), n = Vu();
function r(o) {
return o && o.length ? e(o, n, t) : void 0;
}
return Ix = r, Ix;
}
var Px, aI;
function Z7() {
if (aI) return Px;
aI = 1;
var e = Lm(), t = $d();
function n(r, o, a) {
(a !== void 0 && !t(r[o], a) || a === void 0 && !(o in r)) && e(r, o, a);
}
return Px = n, Px;
}
var Lx, iI;
function WCe() {
if (iI) return Lx;
iI = 1;
var e = Bu(), t = Bm(), n = Ai(), r = "[object Object]", o = Function.prototype, a = Object.prototype, i = o.toString, s = a.hasOwnProperty, l = i.call(Object);
function u(c) {
if (!n(c) || e(c) != r)
return !1;
var d = t(c);
if (d === null)
return !0;
var p = s.call(d, "constructor") && d.constructor;
return typeof p == "function" && p instanceof p && i.call(p) == l;
}
return Lx = u, Lx;
}
var Rx, sI;
function J7() {
if (sI) return Rx;
sI = 1;
function e(t, n) {
if (!(n === "constructor" && typeof t[n] == "function") && n != "__proto__")
return t[n];
}
return Rx = e, Rx;
}
var Nx, lI;
function YCe() {
if (lI) return Nx;
lI = 1;
var e = ch(), t = ju();
function n(r) {
return e(r, t(r));
}
return Nx = n, Nx;
}
var Mx, uI;
function XCe() {
if (uI) return Mx;
uI = 1;
var e = Z7(), t = s7(), n = g7(), r = l7(), o = y7(), a = dh(), i = rr(), s = V7(), l = Od(), u = uh(), c = ya(), d = WCe(), p = ph(), h = J7(), f = YCe();
function v(m, g, b, x, w, k, C) {
var _ = h(m, b), $ = h(g, b), O = C.get($);
if (O) {
e(m, b, O);
return;
}
var F = k ? k(_, $, b + "", m, g, C) : void 0, A = F === void 0;
if (A) {
var T = i($), R = !T && l($), M = !T && !R && p($);
F = $, T || R || M ? i(_) ? F = _ : s(_) ? F = r(_) : R ? (A = !1, F = t($, !0)) : M ? (A = !1, F = n($, !0)) : F = [] : d($) || a($) ? (F = _, a(_) ? F = f(_) : (!c(_) || u(_)) && (F = o($))) : A = !1;
}
A && (C.set($, F), w(F, $, x, k, C), C.delete($)), e(m, b, F);
}
return Mx = v, Mx;
}
var Dx, cI;
function ZCe() {
if (cI) return Dx;
cI = 1;
var e = Pm(), t = Z7(), n = q$(), r = XCe(), o = ya(), a = ju(), i = J7();
function s(l, u, c, d, p) {
l !== u && n(u, function(h, f) {
if (p || (p = new e()), o(h))
r(l, u, f, c, s, d, p);
else {
var v = d ? d(i(l, f), h, f + "", l, u, p) : void 0;
v === void 0 && (v = h), t(l, f, v);
}
}, a);
}
return Dx = s, Dx;
}
var Bx, dI;
function JCe() {
if (dI) return Bx;
dI = 1;
var e = Um(), t = qm();
function n(r) {
return e(function(o, a) {
var i = -1, s = a.length, l = s > 1 ? a[s - 1] : void 0, u = s > 2 ? a[2] : void 0;
for (l = r.length > 3 && typeof l == "function" ? (s--, l) : void 0, u && t(a[0], a[1], u) && (l = s < 3 ? void 0 : l, s = 1), o = Object(o); ++i < s; ) {
var c = a[i];
c && r(o, c, i, l);
}
return o;
});
}
return Bx = n, Bx;
}
var zx, pI;
function QCe() {
if (pI) return zx;
pI = 1;
var e = ZCe(), t = JCe(), n = t(function(r, o, a) {
e(r, o, a);
});
return zx = n, zx;
}
var jx, fI;
function Q7() {
if (fI) return jx;
fI = 1;
function e(t, n) {
return t < n;
}
return jx = e, jx;
}
var Vx, hI;
function e_e() {
if (hI) return Vx;
hI = 1;
var e = Z$(), t = Q7(), n = Vu();
function r(o) {
return o && o.length ? e(o, n, t) : void 0;
}
return Vx = r, Vx;
}
var Hx, vI;
function t_e() {
if (vI) return Hx;
vI = 1;
var e = Z$(), t = ys(), n = Q7();
function r(o, a) {
return o && o.length ? e(o, t(a, 2), n) : void 0;
}
return Hx = r, Hx;
}
var Ux, gI;
function n_e() {
if (gI) return Ux;
gI = 1;
var e = qa(), t = function() {
return e.Date.now();
};
return Ux = t, Ux;
}
var qx, mI;
function r_e() {
if (mI) return qx;
mI = 1;
var e = Rm(), t = Vm(), n = Nm(), r = ya(), o = fh();
function a(i, s, l, u) {
if (!r(i))
return i;
s = t(s, i);
for (var c = -1, d = s.length, p = d - 1, h = i; h != null && ++c < d; ) {
var f = o(s[c]), v = l;
if (f === "__proto__" || f === "constructor" || f === "prototype")
return i;
if (c != p) {
var m = h[f];
v = u ? u(m, f, h) : void 0, v === void 0 && (v = r(m) ? m : n(s[c + 1]) ? [] : {});
}
e(h, f, v), h = h[f];
}
return i;
}
return qx = a, qx;
}
var Kx, yI;
function o_e() {
if (yI) return Kx;
yI = 1;
var e = Hm(), t = r_e(), n = Vm();
function r(o, a, i) {
for (var s = -1, l = a.length, u = {}; ++s < l; ) {
var c = a[s], d = e(o, c);
i(d, c) && t(u, n(c, o), d);
}
return u;
}
return Kx = r, Kx;
}
var Gx, bI;
function a_e() {
if (bI) return Gx;
bI = 1;
var e = o_e(), t = A7();
function n(r, o) {
return e(r, o, function(a, i) {
return t(r, i);
});
}
return Gx = n, Gx;
}
var Wx, wI;
function i_e() {
if (wI) return Wx;
wI = 1;
var e = X7(), t = B7(), n = z7();
function r(o) {
return n(t(o, void 0, e), o + "");
}
return Wx = r, Wx;
}
var Yx, xI;
function s_e() {
if (xI) return Yx;
xI = 1;
var e = a_e(), t = i_e(), n = t(function(r, o) {
return r == null ? {} : e(r, o);
});
return Yx = n, Yx;
}
var Xx, kI;
function l_e() {
if (kI) return Xx;
kI = 1;
var e = Math.ceil, t = Math.max;
function n(r, o, a, i) {
for (var s = -1, l = t(e((o - r) / (a || 1)), 0), u = Array(l); l--; )
u[i ? l : ++s] = r, r += a;
return u;
}
return Xx = n, Xx;
}
var Zx, CI;
function u_e() {
if (CI) return Zx;
CI = 1;
var e = l_e(), t = qm(), n = Y7();
function r(o) {
return function(a, i, s) {
return s && typeof s != "number" && t(a, i, s) && (i = s = void 0), a = n(a), i === void 0 ? (i = a, a = 0) : i = n(i), s = s === void 0 ? a < i ? 1 : -1 : n(s), e(a, i, s, o);
};
}
return Zx = r, Zx;
}
var Jx, _I;
function c_e() {
if (_I) return Jx;
_I = 1;
var e = u_e(), t = e();
return Jx = t, Jx;
}
var Qx, SI;
function d_e() {
if (SI) return Qx;
SI = 1;
function e(t, n) {
var r = t.length;
for (t.sort(n); r--; )
t[r] = t[r].value;
return t;
}
return Qx = e, Qx;
}
var ek, $I;
function p_e() {
if ($I) return ek;
$I = 1;
var e = Td();
function t(n, r) {
if (n !== r) {
var o = n !== void 0, a = n === null, i = n === n, s = e(n), l = r !== void 0, u = r === null, c = r === r, d = e(r);
if (!u && !d && !s && n > r || s && l && c && !u && !d || a && l && c || !o && c || !i)
return 1;
if (!a && !s && !d && n < r || d && o && i && !a && !s || u && o && i || !l && i || !c)
return -1;
}
return 0;
}
return ek = t, ek;
}
var tk, EI;
function f_e() {
if (EI) return tk;
EI = 1;
var e = p_e();
function t(n, r, o) {
for (var a = -1, i = n.criteria, s = r.criteria, l = i.length, u = o.length; ++a < l; ) {
var c = e(i[a], s[a]);
if (c) {
if (a >= u)
return c;
var d = o[a];
return c * (d == "desc" ? -1 : 1);
}
}
return n.index - r.index;
}
return tk = t, tk;
}
var nk, OI;
function h_e() {
if (OI) return nk;
OI = 1;
var e = jm(), t = Hm(), n = ys(), r = N7(), o = d_e(), a = Mm(), i = f_e(), s = Vu(), l = rr();
function u(c, d, p) {
d.length ? d = e(d, function(v) {
return l(v) ? function(m) {
return t(m, v.length === 1 ? v[0] : v);
} : v;
}) : d = [s];
var h = -1;
d = e(d, a(n));
var f = r(c, function(v, m, g) {
var b = e(d, function(x) {
return x(v);
});
return { criteria: b, index: ++h, value: v };
});
return o(f, function(v, m) {
return i(v, m, p);
});
}
return nk = u, nk;
}
var rk, FI;
function v_e() {
if (FI) return rk;
FI = 1;
var e = Y$(), t = h_e(), n = Um(), r = qm(), o = n(function(a, i) {
if (a == null)
return [];
var s = i.length;
return s > 1 && r(a, i[0], i[1]) ? i = [] : s > 2 && r(i[0], i[1], i[2]) && (i = [i[0]]), t(a, e(i, 1), []);
});
return rk = o, rk;
}
var ok, TI;
function g_e() {
if (TI) return ok;
TI = 1;
var e = F7(), t = 0;
function n(r) {
var o = ++t;
return e(r) + o;
}
return ok = n, ok;
}
var ak, AI;
function m_e() {
if (AI) return ak;
AI = 1;
function e(t, n, r) {
for (var o = -1, a = t.length, i = n.length, s = {}; ++o < a; ) {
var l = o < i ? n[o] : void 0;
r(s, t[o], l);
}
return s;
}
return ak = e, ak;
}
var ik, II;
function y_e() {
if (II) return ik;
II = 1;
var e = Rm(), t = m_e();
function n(r, o) {
return t(r || [], o || [], e);
}
return ik = n, ik;
}
var sk, PI;
function In() {
if (PI) return sk;
PI = 1;
var e;
if (typeof L$ == "function")
try {
e = {
cloneDeep: LCe(),
constant: U$(),
defaults: RCe(),
each: k7(),
filter: P7(),
find: VCe(),
flatten: X7(),
forEach: x7(),
forIn: HCe(),
has: L7(),
isUndefined: R7(),
last: UCe(),
map: M7(),
mapValues: qCe(),
max: GCe(),
merge: QCe(),
min: e_e(),
minBy: t_e(),
now: n_e(),
pick: s_e(),
range: c_e(),
reduce: D7(),
sortBy: v_e(),
uniqueId: g_e(),
values: H7(),
zipObject: y_e()
};
} catch {
}
return e || (e = window._), sk = e, sk;
}
var lk, LI;
function b_e() {
if (LI) return lk;
LI = 1, lk = e;
function e() {
var r = {};
r._next = r._prev = r, this._sentinel = r;
}
e.prototype.dequeue = function() {
var r = this._sentinel, o = r._prev;
if (o !== r)
return t(o), o;
}, e.prototype.enqueue = function(r) {
var o = this._sentinel;
r._prev && r._next && t(r), r._next = o._next, o._next._prev = r, o._next = r, r._prev = o;
}, e.prototype.toString = function() {
for (var r = [], o = this._sentinel, a = o._prev; a !== o; )
r.push(JSON.stringify(a, n)), a = a._prev;
return "[" + r.join(", ") + "]";
};
function t(r) {
r._prev._next = r._next, r._next._prev = r._prev, delete r._next, delete r._prev;
}
function n(r, o) {
if (r !== "_next" && r !== "_prev")
return o;
}
return lk;
}
var uk, RI;
function w_e() {
if (RI) return uk;
RI = 1;
var e = In(), t = Va().Graph, n = b_e();
uk = o;
var r = e.constant(1);
function o(u, c) {
if (u.nodeCount() <= 1)
return [];
var d = s(u, c || r), p = a(d.graph, d.buckets, d.zeroIdx);
return e.flatten(e.map(p, function(h) {
return u.outEdges(h.v, h.w);
}), !0);
}
function a(u, c, d) {
for (var p = [], h = c[c.length - 1], f = c[0], v; u.nodeCount(); ) {
for (; v = f.dequeue(); )
i(u, c, d, v);
for (; v = h.dequeue(); )
i(u, c, d, v);
if (u.nodeCount()) {
for (var m = c.length - 2; m > 0; --m)
if (v = c[m].dequeue(), v) {
p = p.concat(i(u, c, d, v, !0));
break;
}
}
}
return p;
}
function i(u, c, d, p, h) {
var f = h ? [] : void 0;
return e.forEach(u.inEdges(p.v), function(v) {
var m = u.edge(v), g = u.node(v.v);
h && f.push({ v: v.v, w: v.w }), g.out -= m, l(c, d, g);
}), e.forEach(u.outEdges(p.v), function(v) {
var m = u.edge(v), g = v.w, b = u.node(g);
b.in -= m, l(c, d, b);
}), u.removeNode(p.v), f;
}
function s(u, c) {
var d = new t(), p = 0, h = 0;
e.forEach(u.nodes(), function(m) {
d.setNode(m, { v: m, in: 0, out: 0 });
}), e.forEach(u.edges(), function(m) {
var g = d.edge(m.v, m.w) || 0, b = c(m), x = g + b;
d.setEdge(m.v, m.w, x), h = Math.max(h, d.node(m.v).out += b), p = Math.max(p, d.node(m.w).in += b);
});
var f = e.range(h + p + 3).map(function() {
return new n();
}), v = p + 1;
return e.forEach(d.nodes(), function(m) {
l(f, v, d.node(m));
}), { graph: d, buckets: f, zeroIdx: v };
}
function l(u, c, d) {
d.out ? d.in ? u[d.out - d.in + c].enqueue(d) : u[u.length - 1].enqueue(d) : u[0].enqueue(d);
}
return uk;
}
var ck, NI;
function x_e() {
if (NI) return ck;
NI = 1;
var e = In(), t = w_e();
ck = {
run: n,
undo: o
};
function n(a) {
var i = a.graph().acyclicer === "greedy" ? t(a, s(a)) : r(a);
e.forEach(i, function(l) {
var u = a.edge(l);
a.removeEdge(l), u.forwardName = l.name, u.reversed = !0, a.setEdge(l.w, l.v, u, e.uniqueId("rev"));
});
function s(l) {
return function(u) {
return l.edge(u).weight;
};
}
}
function r(a) {
var i = [], s = {}, l = {};
function u(c) {
e.has(l, c) || (l[c] = !0, s[c] = !0, e.forEach(a.outEdges(c), function(d) {
e.has(s, d.w) ? i.push(d) : u(d.w);
}), delete s[c]);
}
return e.forEach(a.nodes(), u), i;
}
function o(a) {
e.forEach(a.edges(), function(i) {
var s = a.edge(i);
if (s.reversed) {
a.removeEdge(i);
var l = s.forwardName;
delete s.reversed, delete s.forwardName, a.setEdge(i.w, i.v, s, l);
}
});
}
return ck;
}
var dk, MI;
function wo() {
if (MI) return dk;
MI = 1;
var e = In(), t = Va().Graph;
dk = {
addDummyNode: n,
simplify: r,
asNonCompoundGraph: o,
successorWeights: a,
predecessorWeights: i,
intersectRect: s,
buildLayerMatrix: l,
normalizeRanks: u,
removeEmptyRanks: c,
addBorderNode: d,
maxRank: p,
partition: h,
time: f,
notime: v
};
function n(m, g, b, x) {
var w;
do
w = e.uniqueId(x);
while (m.hasNode(w));
return b.dummy = g, m.setNode(w, b), w;
}
function r(m) {
var g = new t().setGraph(m.graph());
return e.forEach(m.nodes(), function(b) {
g.setNode(b, m.node(b));
}), e.forEach(m.edges(), function(b) {
var x = g.edge(b.v, b.w) || { weight: 0, minlen: 1 }, w = m.edge(b);
g.setEdge(b.v, b.w, {
weight: x.weight + w.weight,
minlen: Math.max(x.minlen, w.minlen)
});
}), g;
}
function o(m) {
var g = new t({ multigraph: m.isMultigraph() }).setGraph(m.graph());
return e.forEach(m.nodes(), function(b) {
m.children(b).length || g.setNode(b, m.node(b));
}), e.forEach(m.edges(), function(b) {
g.setEdge(b, m.edge(b));
}), g;
}
function a(m) {
var g = e.map(m.nodes(), function(b) {
var x = {};
return e.forEach(m.outEdges(b), function(w) {
x[w.w] = (x[w.w] || 0) + m.edge(w).weight;
}), x;
});
return e.zipObject(m.nodes(), g);
}
function i(m) {
var g = e.map(m.nodes(), function(b) {
var x = {};
return e.forEach(m.inEdges(b), function(w) {
x[w.v] = (x[w.v] || 0) + m.edge(w).weight;
}), x;
});
return e.zipObject(m.nodes(), g);
}
function s(m, g) {
var b = m.x, x = m.y, w = g.x - b, k = g.y - x, C = m.width / 2, _ = m.height / 2;
if (!w && !k)
throw new Error("Not possible to find intersection inside of the rectangle");
var $, O;
return Math.abs(k) * C > Math.abs(w) * _ ? (k < 0 && (_ = -_), $ = _ * w / k, O = _) : (w < 0 && (C = -C), $ = C, O = C * k / w), { x: b + $, y: x + O };
}
function l(m) {
var g = e.map(e.range(p(m) + 1), function() {
return [];
});
return e.forEach(m.nodes(), function(b) {
var x = m.node(b), w = x.rank;
e.isUndefined(w) || (g[w][x.order] = b);
}), g;
}
function u(m) {
var g = e.min(e.map(m.nodes(), function(b) {
return m.node(b).rank;
}));
e.forEach(m.nodes(), function(b) {
var x = m.node(b);
e.has(x, "rank") && (x.rank -= g);
});
}
function c(m) {
var g = e.min(e.map(m.nodes(), function(k) {
return m.node(k).rank;
})), b = [];
e.forEach(m.nodes(), function(k) {
var C = m.node(k).rank - g;
b[C] || (b[C] = []), b[C].push(k);
});
var x = 0, w = m.graph().nodeRankFactor;
e.forEach(b, function(k, C) {
e.isUndefined(k) && C % w !== 0 ? --x : x && e.forEach(k, function(_) {
m.node(_).rank += x;
});
});
}
function d(m, g, b, x) {
var w = {
width: 0,
height: 0
};
return arguments.length >= 4 && (w.rank = b, w.order = x), n(m, "border", w, g);
}
function p(m) {
return e.max(e.map(m.nodes(), function(g) {
var b = m.node(g).rank;
if (!e.isUndefined(b))
return b;
}));
}
function h(m, g) {
var b = { lhs: [], rhs: [] };
return e.forEach(m, function(x) {
g(x) ? b.lhs.push(x) : b.rhs.push(x);
}), b;
}
function f(m, g) {
var b = e.now();
try {
return g();
} finally {
console.log(m + " time: " + (e.now() - b) + "ms");
}
}
function v(m, g) {
return g();
}
return dk;
}
var pk, DI;
function k_e() {
if (DI) return pk;
DI = 1;
var e = In(), t = wo();
pk = {
run: n,
undo: o
};
function n(a) {
a.graph().dummyChains = [], e.forEach(a.edges(), function(i) {
r(a, i);
});
}
function r(a, i) {
var s = i.v, l = a.node(s).rank, u = i.w, c = a.node(u).rank, d = i.name, p = a.edge(i), h = p.labelRank;
if (c !== l + 1) {
a.removeEdge(i);
var f, v, m;
for (m = 0, ++l; l < c; ++m, ++l)
p.points = [], v = {
width: 0,
height: 0,
edgeLabel: p,
edgeObj: i,
rank: l
}, f = t.addDummyNode(a, "edge", v, "_d"), l === h && (v.width = p.width, v.height = p.height, v.dummy = "edge-label", v.labelpos = p.labelpos), a.setEdge(s, f, { weight: p.weight }, d), m === 0 && a.graph().dummyChains.push(f), s = f;
a.setEdge(s, u, { weight: p.weight }, d);
}
}
function o(a) {
e.forEach(a.graph().dummyChains, function(i) {
var s = a.node(i), l = s.edgeLabel, u;
for (a.setEdge(s.edgeObj, l); s.dummy; )
u = a.successors(i)[0], a.removeNode(i), l.points.push({ x: s.x, y: s.y }), s.dummy === "edge-label" && (l.x = s.x, l.y = s.y, l.width = s.width, l.height = s.height), i = u, s = a.node(i);
});
}
return pk;
}
var fk, BI;
function Yg() {
if (BI) return fk;
BI = 1;
var e = In();
fk = {
longestPath: t,
slack: n
};
function t(r) {
var o = {};
function a(i) {
var s = r.node(i);
if (e.has(o, i))
return s.rank;
o[i] = !0;
var l = e.min(e.map(r.outEdges(i), function(u) {
return a(u.w) - r.edge(u).minlen;
}));
return (l === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
l === void 0 || // return value of _.map([]) for Lodash 4
l === null) && (l = 0), s.rank = l;
}
e.forEach(r.sources(), a);
}
function n(r, o) {
return r.node(o.w).rank - r.node(o.v).rank - r.edge(o).minlen;
}
return fk;
}
var hk, zI;
function ej() {
if (zI) return hk;
zI = 1;
var e = In(), t = Va().Graph, n = Yg().slack;
hk = r;
function r(s) {
var l = new t({ directed: !1 }), u = s.nodes()[0], c = s.nodeCount();
l.setNode(u, {});
for (var d, p; o(l, s) < c; )
d = a(l, s), p = l.hasNode(d.v) ? n(s, d) : -n(s, d), i(l, s, p);
return l;
}
function o(s, l) {
function u(c) {
e.forEach(l.nodeEdges(c), function(d) {
var p = d.v, h = c === p ? d.w : p;
!s.hasNode(h) && !n(l, d) && (s.setNode(h, {}), s.setEdge(c, h, {}), u(h));
});
}
return e.forEach(s.nodes(), u), s.nodeCount();
}
function a(s, l) {
return e.minBy(l.edges(), function(u) {
if (s.hasNode(u.v) !== s.hasNode(u.w))
return n(l, u);
});
}
function i(s, l, u) {
e.forEach(s.nodes(), function(c) {
l.node(c).rank += u;
});
}
return hk;
}
var vk, jI;
function C_e() {
if (jI) return vk;
jI = 1;
var e = In(), t = ej(), n = Yg().slack, r = Yg().longestPath, o = Va().alg.preorder, a = Va().alg.postorder, i = wo().simplify;
vk = s, s.initLowLimValues = d, s.initCutValues = l, s.calcCutValue = c, s.leaveEdge = h, s.enterEdge = f, s.exchangeEdges = v;
function s(x) {
x = i(x), r(x);
var w = t(x);
d(w), l(w, x);
for (var k, C; k = h(w); )
C = f(w, x, k), v(w, x, k, C);
}
function l(x, w) {
var k = a(x, x.nodes());
k = k.slice(0, k.length - 1), e.forEach(k, function(C) {
u(x, w, C);
});
}
function u(x, w, k) {
var C = x.node(k), _ = C.parent;
x.edge(k, _).cutvalue = c(x, w, k);
}
function c(x, w, k) {
var C = x.node(k), _ = C.parent, $ = !0, O = w.edge(k, _), F = 0;
return O || ($ = !1, O = w.edge(_, k)), F = O.weight, e.forEach(w.nodeEdges(k), function(A) {
var T = A.v === k, R = T ? A.w : A.v;
if (R !== _) {
var M = T === $, j = w.edge(A).weight;
if (F += M ? j : -j, g(x, k, R)) {
var P = x.edge(k, R).cutvalue;
F += M ? -P : P;
}
}
}), F;
}
function d(x, w) {
arguments.length < 2 && (w = x.nodes()[0]), p(x, {}, 1, w);
}
function p(x, w, k, C, _) {
var $ = k, O = x.node(C);
return w[C] = !0, e.forEach(x.neighbors(C), function(F) {
e.has(w, F) || (k = p(x, w, k, F, C));
}), O.low = $, O.lim = k++, _ ? O.parent = _ : delete O.parent, k;
}
function h(x) {
return e.find(x.edges(), function(w) {
return x.edge(w).cutvalue < 0;
});
}
function f(x, w, k) {
var C = k.v, _ = k.w;
w.hasEdge(C, _) || (C = k.w, _ = k.v);
var $ = x.node(C), O = x.node(_), F = $, A = !1;
$.lim > O.lim && (F = O, A = !0);
var T = e.filter(w.edges(), function(R) {
return A === b(x, x.node(R.v), F) && A !== b(x, x.node(R.w), F);
});
return e.minBy(T, function(R) {
return n(w, R);
});
}
function v(x, w, k, C) {
var _ = k.v, $ = k.w;
x.removeEdge(_, $), x.setEdge(C.v, C.w, {}), d(x), l(x, w), m(x, w);
}
function m(x, w) {
var k = e.find(x.nodes(), function(_) {
return !w.node(_).parent;
}), C = o(x, k);
C = C.slice(1), e.forEach(C, function(_) {
var $ = x.node(_).parent, O = w.edge(_, $), F = !1;
O || (O = w.edge($, _), F = !0), w.node(_).rank = w.node($).rank + (F ? O.minlen : -O.minlen);
});
}
function g(x, w, k) {
return x.hasEdge(w, k);
}
function b(x, w, k) {
return k.low <= w.lim && w.lim <= k.lim;
}
return vk;
}
var gk, VI;
function __e() {
if (VI) return gk;
VI = 1;
var e = Yg(), t = e.longestPath, n = ej(), r = C_e();
gk = o;
function o(l) {
switch (l.graph().ranker) {
case "network-simplex":
s(l);
break;
case "tight-tree":
i(l);
break;
case "longest-path":
a(l);
break;
default:
s(l);
}
}
var a = t;
function i(l) {
t(l), n(l);
}
function s(l) {
r(l);
}
return gk;
}
var mk, HI;
function S_e() {
if (HI) return mk;
HI = 1;
var e = In();
mk = t;
function t(o) {
var a = r(o);
e.forEach(o.graph().dummyChains, function(i) {
for (var s = o.node(i), l = s.edgeObj, u = n(o, a, l.v, l.w), c = u.path, d = u.lca, p = 0, h = c[p], f = !0; i !== l.w; ) {
if (s = o.node(i), f) {
for (; (h = c[p]) !== d && o.node(h).maxRank < s.rank; )
p++;
h === d && (f = !1);
}
if (!f) {
for (; p < c.length - 1 && o.node(h = c[p + 1]).minRank <= s.rank; )
p++;
h = c[p];
}
o.setParent(i, h), i = o.successors(i)[0];
}
});
}
function n(o, a, i, s) {
var l = [], u = [], c = Math.min(a[i].low, a[s].low), d = Math.max(a[i].lim, a[s].lim), p, h;
p = i;
do
p = o.parent(p), l.push(p);
while (p && (a[p].low > c || d > a[p].lim));
for (h = p, p = s; (p = o.parent(p)) !== h; )
u.push(p);
return { path: l.concat(u.reverse()), lca: h };
}
function r(o) {
var a = {}, i = 0;
function s(l) {
var u = i;
e.forEach(o.children(l), s), a[l] = { low: u, lim: i++ };
}
return e.forEach(o.children(), s), a;
}
return mk;
}
var yk, UI;
function $_e() {
if (UI) return yk;
UI = 1;
var e = In(), t = wo();
yk = {
run: n,
cleanup: i
};
function n(s) {
var l = t.addDummyNode(s, "root", {}, "_root"), u = o(s), c = e.max(e.values(u)) - 1, d = 2 * c + 1;
s.graph().nestingRoot = l, e.forEach(s.edges(), function(h) {
s.edge(h).minlen *= d;
});
var p = a(s) + 1;
e.forEach(s.children(), function(h) {
r(s, l, d, p, c, u, h);
}), s.graph().nodeRankFactor = d;
}
function r(s, l, u, c, d, p, h) {
var f = s.children(h);
if (!f.length) {
h !== l && s.setEdge(l, h, { weight: 0, minlen: u });
return;
}
var v = t.addBorderNode(s, "_bt"), m = t.addBorderNode(s, "_bb"), g = s.node(h);
s.setParent(v, h), g.borderTop = v, s.setParent(m, h), g.borderBottom = m, e.forEach(f, function(b) {
r(s, l, u, c, d, p, b);
var x = s.node(b), w = x.borderTop ? x.borderTop : b, k = x.borderBottom ? x.borderBottom : b, C = x.borderTop ? c : 2 * c, _ = w !== k ? 1 : d - p[h] + 1;
s.setEdge(v, w, {
weight: C,
minlen: _,
nestingEdge: !0
}), s.setEdge(k, m, {
weight: C,
minlen: _,
nestingEdge: !0
});
}), s.parent(h) || s.setEdge(l, v, { weight: 0, minlen: d + p[h] });
}
function o(s) {
var l = {};
function u(c, d) {
var p = s.children(c);
p && p.length && e.forEach(p, function(h) {
u(h, d + 1);
}), l[c] = d;
}
return e.forEach(s.children(), function(c) {
u(c, 1);
}), l;
}
function a(s) {
return e.reduce(s.edges(), function(l, u) {
return l + s.edge(u).weight;
}, 0);
}
function i(s) {
var l = s.graph();
s.removeNode(l.nestingRoot), delete l.nestingRoot, e.forEach(s.edges(), function(u) {
var c = s.edge(u);
c.nestingEdge && s.removeEdge(u);
});
}
return yk;
}
var bk, qI;
function E_e() {
if (qI) return bk;
qI = 1;
var e = In(), t = wo();
bk = n;
function n(o) {
function a(i) {
var s = o.children(i), l = o.node(i);
if (s.length && e.forEach(s, a), e.has(l, "minRank")) {
l.borderLeft = [], l.borderRight = [];
for (var u = l.minRank, c = l.maxRank + 1; u < c; ++u)
r(o, "borderLeft", "_bl", i, l, u), r(o, "borderRight", "_br", i, l, u);
}
}
e.forEach(o.children(), a);
}
function r(o, a, i, s, l, u) {
var c = { width: 0, height: 0, rank: u, borderType: a }, d = l[a][u - 1], p = t.addDummyNode(o, "border", c, i);
l[a][u] = p, o.setParent(p, s), d && o.setEdge(d, p, { weight: 1 });
}
return bk;
}
var wk, KI;
function O_e() {
if (KI) return wk;
KI = 1;
var e = In();
wk = {
adjust: t,
undo: n
};
function t(u) {
var c = u.graph().rankdir.toLowerCase();
(c === "lr" || c === "rl") && r(u);
}
function n(u) {
var c = u.graph().rankdir.toLowerCase();
(c === "bt" || c === "rl") && a(u), (c === "lr" || c === "rl") && (s(u), r(u));
}
function r(u) {
e.forEach(u.nodes(), function(c) {
o(u.node(c));
}), e.forEach(u.edges(), function(c) {
o(u.edge(c));
});
}
function o(u) {
var c = u.width;
u.width = u.height, u.height = c;
}
function a(u) {
e.forEach(u.nodes(), function(c) {
i(u.node(c));
}), e.forEach(u.edges(), function(c) {
var d = u.edge(c);
e.forEach(d.points, i), e.has(d, "y") && i(d);
});
}
function i(u) {
u.y = -u.y;
}
function s(u) {
e.forEach(u.nodes(), function(c) {
l(u.node(c));
}), e.forEach(u.edges(), function(c) {
var d = u.edge(c);
e.forEach(d.points, l), e.has(d, "x") && l(d);
});
}
function l(u) {
var c = u.x;
u.x = u.y, u.y = c;
}
return wk;
}
var xk, GI;
function F_e() {
if (GI) return xk;
GI = 1;
var e = In();
xk = t;
function t(n) {
var r = {}, o = e.filter(n.nodes(), function(u) {
return !n.children(u).length;
}), a = e.max(e.map(o, function(u) {
return n.node(u).rank;
})), i = e.map(e.range(a + 1), function() {
return [];
});
function s(u) {
if (!e.has(r, u)) {
r[u] = !0;
var c = n.node(u);
i[c.rank].push(u), e.forEach(n.successors(u), s);
}
}
var l = e.sortBy(o, function(u) {
return n.node(u).rank;
});
return e.forEach(l, s), i;
}
return xk;
}
var kk, WI;
function T_e() {
if (WI) return kk;
WI = 1;
var e = In();
kk = t;
function t(r, o) {
for (var a = 0, i = 1; i < o.length; ++i)
a += n(r, o[i - 1], o[i]);
return a;
}
function n(r, o, a) {
for (var i = e.zipObject(
a,
e.map(a, function(p, h) {
return h;
})
), s = e.flatten(e.map(o, function(p) {
return e.sortBy(e.map(r.outEdges(p), function(h) {
return { pos: i[h.w], weight: r.edge(h).weight };
}), "pos");
}), !0), l = 1; l < a.length; ) l <<= 1;
var u = 2 * l - 1;
l -= 1;
var c = e.map(new Array(u), function() {
return 0;
}), d = 0;
return e.forEach(s.forEach(function(p) {
var h = p.pos + l;
c[h] += p.weight;
for (var f = 0; h > 0; )
h % 2 && (f += c[h + 1]), h = h - 1 >> 1, c[h] += p.weight;
d += p.weight * f;
})), d;
}
return kk;
}
var Ck, YI;
function A_e() {
if (YI) return Ck;
YI = 1;
var e = In();
Ck = t;
function t(n, r) {
return e.map(r, function(o) {
var a = n.inEdges(o);
if (a.length) {
var i = e.reduce(a, function(s, l) {
var u = n.edge(l), c = n.node(l.v);
return {
sum: s.sum + u.weight * c.order,
weight: s.weight + u.weight
};
}, { sum: 0, weight: 0 });
return {
v: o,
barycenter: i.sum / i.weight,
weight: i.weight
};
} else
return { v: o };
});
}
return Ck;
}
var _k, XI;
function I_e() {
if (XI) return _k;
XI = 1;
var e = In();
_k = t;
function t(o, a) {
var i = {};
e.forEach(o, function(l, u) {
var c = i[l.v] = {
indegree: 0,
in: [],
out: [],
vs: [l.v],
i: u
};
e.isUndefined(l.barycenter) || (c.barycenter = l.barycenter, c.weight = l.weight);
}), e.forEach(a.edges(), function(l) {
var u = i[l.v], c = i[l.w];
!e.isUndefined(u) && !e.isUndefined(c) && (c.indegree++, u.out.push(i[l.w]));
});
var s = e.filter(i, function(l) {
return !l.indegree;
});
return n(s);
}
function n(o) {
var a = [];
function i(u) {
return function(c) {
c.merged || (e.isUndefined(c.barycenter) || e.isUndefined(u.barycenter) || c.barycenter >= u.barycenter) && r(u, c);
};
}
function s(u) {
return function(c) {
c.in.push(u), --c.indegree === 0 && o.push(c);
};
}
for (; o.length; ) {
var l = o.pop();
a.push(l), e.forEach(l.in.reverse(), i(l)), e.forEach(l.out, s(l));
}
return e.map(
e.filter(a, function(u) {
return !u.merged;
}),
function(u) {
return e.pick(u, ["vs", "i", "barycenter", "weight"]);
}
);
}
function r(o, a) {
var i = 0, s = 0;
o.weight && (i += o.barycenter * o.weight, s += o.weight), a.weight && (i += a.barycenter * a.weight, s += a.weight), o.vs = a.vs.concat(o.vs), o.barycenter = i / s, o.weight = s, o.i = Math.min(a.i, o.i), a.merged = !0;
}
return _k;
}
var Sk, ZI;
function P_e() {
if (ZI) return Sk;
ZI = 1;
var e = In(), t = wo();
Sk = n;
function n(a, i) {
var s = t.partition(a, function(v) {
return e.has(v, "barycenter");
}), l = s.lhs, u = e.sortBy(s.rhs, function(v) {
return -v.i;
}), c = [], d = 0, p = 0, h = 0;
l.sort(o(!!i)), h = r(c, u, h), e.forEach(l, function(v) {
h += v.vs.length, c.push(v.vs), d += v.barycenter * v.weight, p += v.weight, h = r(c, u, h);
});
var f = { vs: e.flatten(c, !0) };
return p && (f.barycenter = d / p, f.weight = p), f;
}
function r(a, i, s) {
for (var l; i.length && (l = e.last(i)).i <= s; )
i.pop(), a.push(l.vs), s++;
return s;
}
function o(a) {
return function(i, s) {
return i.barycenter < s.barycenter ? -1 : i.barycenter > s.barycenter ? 1 : a ? s.i - i.i : i.i - s.i;
};
}
return Sk;
}
var $k, JI;
function L_e() {
if (JI) return $k;
JI = 1;
var e = In(), t = A_e(), n = I_e(), r = P_e();
$k = o;
function o(s, l, u, c) {
var d = s.children(l), p = s.node(l), h = p ? p.borderLeft : void 0, f = p ? p.borderRight : void 0, v = {};
h && (d = e.filter(d, function(k) {
return k !== h && k !== f;
}));
var m = t(s, d);
e.forEach(m, function(k) {
if (s.children(k.v).length) {
var C = o(s, k.v, u, c);
v[k.v] = C, e.has(C, "barycenter") && i(k, C);
}
});
var g = n(m, u);
a(g, v);
var b = r(g, c);
if (h && (b.vs = e.flatten([h, b.vs, f], !0), s.predecessors(h).length)) {
var x = s.node(s.predecessors(h)[0]), w = s.node(s.predecessors(f)[0]);
e.has(b, "barycenter") || (b.barycenter = 0, b.weight = 0), b.barycenter = (b.barycenter * b.weight + x.order + w.order) / (b.weight + 2), b.weight += 2;
}
return b;
}
function a(s, l) {
e.forEach(s, function(u) {
u.vs = e.flatten(u.vs.map(function(c) {
return l[c] ? l[c].vs : c;
}), !0);
});
}
function i(s, l) {
e.isUndefined(s.barycenter) ? (s.barycenter = l.barycenter, s.weight = l.weight) : (s.barycenter = (s.barycenter * s.weight + l.barycenter * l.weight) / (s.weight + l.weight), s.weight += l.weight);
}
return $k;
}
var Ek, QI;
function R_e() {
if (QI) return Ek;
QI = 1;
var e = In(), t = Va().Graph;
Ek = n;
function n(o, a, i) {
var s = r(o), l = new t({ compound: !0 }).setGraph({ root: s }).setDefaultNodeLabel(function(u) {
return o.node(u);
});
return e.forEach(o.nodes(), function(u) {
var c = o.node(u), d = o.parent(u);
(c.rank === a || c.minRank <= a && a <= c.maxRank) && (l.setNode(u), l.setParent(u, d || s), e.forEach(o[i](u), function(p) {
var h = p.v === u ? p.w : p.v, f = l.edge(h, u), v = e.isUndefined(f) ? 0 : f.weight;
l.setEdge(h, u, { weight: o.edge(p).weight + v });
}), e.has(c, "minRank") && l.setNode(u, {
borderLeft: c.borderLeft[a],
borderRight: c.borderRight[a]
}));
}), l;
}
function r(o) {
for (var a; o.hasNode(a = e.uniqueId("_root")); ) ;
return a;
}
return Ek;
}
var Ok, eP;
function N_e() {
if (eP) return Ok;
eP = 1;
var e = In();
Ok = t;
function t(n, r, o) {
var a = {}, i;
e.forEach(o, function(s) {
for (var l = n.parent(s), u, c; l; ) {
if (u = n.parent(l), u ? (c = a[u], a[u] = l) : (c = i, i = l), c && c !== l) {
r.setEdge(c, l);
return;
}
l = u;
}
});
}
return Ok;
}
var Fk, tP;
function M_e() {
if (tP) return Fk;
tP = 1;
var e = In(), t = F_e(), n = T_e(), r = L_e(), o = R_e(), a = N_e(), i = Va().Graph, s = wo();
Fk = l;
function l(p) {
var h = s.maxRank(p), f = u(p, e.range(1, h + 1), "inEdges"), v = u(p, e.range(h - 1, -1, -1), "outEdges"), m = t(p);
d(p, m);
for (var g = Number.POSITIVE_INFINITY, b, x = 0, w = 0; w < 4; ++x, ++w) {
c(x % 2 ? f : v, x % 4 >= 2), m = s.buildLayerMatrix(p);
var k = n(p, m);
k < g && (w = 0, b = e.cloneDeep(m), g = k);
}
d(p, b);
}
function u(p, h, f) {
return e.map(h, function(v) {
return o(p, v, f);
});
}
function c(p, h) {
var f = new i();
e.forEach(p, function(v) {
var m = v.graph().root, g = r(v, m, f, h);
e.forEach(g.vs, function(b, x) {
v.node(b).order = x;
}), a(v, f, g.vs);
});
}
function d(p, h) {
e.forEach(h, function(f) {
e.forEach(f, function(v, m) {
p.node(v).order = m;
});
});
}
return Fk;
}
var Tk, nP;
function D_e() {
if (nP) return Tk;
nP = 1;
var e = In(), t = Va().Graph, n = wo();
Tk = {
positionX: f,
findType1Conflicts: r,
findType2Conflicts: o,
addConflict: i,
hasConflict: s,
verticalAlignment: l,
horizontalCompaction: u,
alignCoordinates: p,
findSmallestWidthAlignment: d,
balance: h
};
function r(g, b) {
var x = {};
function w(k, C) {
var _ = 0, $ = 0, O = k.length, F = e.last(C);
return e.forEach(C, function(A, T) {
var R = a(g, A), M = R ? g.node(R).order : O;
(R || A === F) && (e.forEach(C.slice($, T + 1), function(j) {
e.forEach(g.predecessors(j), function(P) {
var V = g.node(P), U = V.order;
(U < _ || M < U) && !(V.dummy && g.node(j).dummy) && i(x, P, j);
});
}), $ = T + 1, _ = M);
}), C;
}
return e.reduce(b, w), x;
}
function o(g, b) {
var x = {};
function w(C, _, $, O, F) {
var A;
e.forEach(e.range(_, $), function(T) {
A = C[T], g.node(A).dummy && e.forEach(g.predecessors(A), function(R) {
var M = g.node(R);
M.dummy && (M.order < O || M.order > F) && i(x, R, A);
});
});
}
function k(C, _) {
var $ = -1, O, F = 0;
return e.forEach(_, function(A, T) {
if (g.node(A).dummy === "border") {
var R = g.predecessors(A);
R.length && (O = g.node(R[0]).order, w(_, F, T, $, O), F = T, $ = O);
}
w(_, F, _.length, O, C.length);
}), _;
}
return e.reduce(b, k), x;
}
function a(g, b) {
if (g.node(b).dummy)
return e.find(g.predecessors(b), function(x) {
return g.node(x).dummy;
});
}
function i(g, b, x) {
if (b > x) {
var w = b;
b = x, x = w;
}
var k = g[b];
k || (g[b] = k = {}), k[x] = !0;
}
function s(g, b, x) {
if (b > x) {
var w = b;
b = x, x = w;
}
return e.has(g[b], x);
}
function l(g, b, x, w) {
var k = {}, C = {}, _ = {};
return e.forEach(b, function($) {
e.forEach($, function(O, F) {
k[O] = O, C[O] = O, _[O] = F;
});
}), e.forEach(b, function($) {
var O = -1;
e.forEach($, function(F) {
var A = w(F);
if (A.length) {
A = e.sortBy(A, function(P) {
return _[P];
});
for (var T = (A.length - 1) / 2, R = Math.floor(T), M = Math.ceil(T); R <= M; ++R) {
var j = A[R];
C[F] === F && O < _[j] && !s(x, F, j) && (C[j] = F, C[F] = k[F] = k[j], O = _[j]);
}
}
});
}), { root: k, align: C };
}
function u(g, b, x, w, k) {
var C = {}, _ = c(g, b, x, k), $ = k ? "borderLeft" : "borderRight";
function O(T, R) {
for (var M = _.nodes(), j = M.pop(), P = {}; j; )
P[j] ? T(j) : (P[j] = !0, M.push(j), M = M.concat(R(j))), j = M.pop();
}
function F(T) {
C[T] = _.inEdges(T).reduce(function(R, M) {
return Math.max(R, C[M.v] + _.edge(M));
}, 0);
}
function A(T) {
var R = _.outEdges(T).reduce(function(j, P) {
return Math.min(j, C[P.w] - _.edge(P));
}, Number.POSITIVE_INFINITY), M = g.node(T);
R !== Number.POSITIVE_INFINITY && M.borderType !== $ && (C[T] = Math.max(C[T], R));
}
return O(F, _.predecessors.bind(_)), O(A, _.successors.bind(_)), e.forEach(w, function(T) {
C[T] = C[x[T]];
}), C;
}
function c(g, b, x, w) {
var k = new t(), C = g.graph(), _ = v(C.nodesep, C.edgesep, w);
return e.forEach(b, function($) {
var O;
e.forEach($, function(F) {
var A = x[F];
if (k.setNode(A), O) {
var T = x[O], R = k.edge(T, A);
k.setEdge(T, A, Math.max(_(g, F, O), R || 0));
}
O = F;
});
}), k;
}
function d(g, b) {
return e.minBy(e.values(b), function(x) {
var w = Number.NEGATIVE_INFINITY, k = Number.POSITIVE_INFINITY;
return e.forIn(x, function(C, _) {
var $ = m(g, _) / 2;
w = Math.max(C + $, w), k = Math.min(C - $, k);
}), w - k;
});
}
function p(g, b) {
var x = e.values(b), w = e.min(x), k = e.max(x);
e.forEach(["u", "d"], function(C) {
e.forEach(["l", "r"], function(_) {
var $ = C + _, O = g[$], F;
if (O !== b) {
var A = e.values(O);
F = _ === "l" ? w - e.min(A) : k - e.max(A), F && (g[$] = e.mapValues(O, function(T) {
return T + F;
}));
}
});
});
}
function h(g, b) {
return e.mapValues(g.ul, function(x, w) {
if (b)
return g[b.toLowerCase()][w];
var k = e.sortBy(e.map(g, w));
return (k[1] + k[2]) / 2;
});
}
function f(g) {
var b = n.buildLayerMatrix(g), x = e.merge(
r(g, b),
o(g, b)
), w = {}, k;
e.forEach(["u", "d"], function(_) {
k = _ === "u" ? b : e.values(b).reverse(), e.forEach(["l", "r"], function($) {
$ === "r" && (k = e.map(k, function(T) {
return e.values(T).reverse();
}));
var O = (_ === "u" ? g.predecessors : g.successors).bind(g), F = l(g, k, x, O), A = u(
g,
k,
F.root,
F.align,
$ === "r"
);
$ === "r" && (A = e.mapValues(A, function(T) {
return -T;
})), w[_ + $] = A;
});
});
var C = d(g, w);
return p(w, C), h(w, g.graph().align);
}
function v(g, b, x) {
return function(w, k, C) {
var _ = w.node(k), $ = w.node(C), O = 0, F;
if (O += _.width / 2, e.has(_, "labelpos"))
switch (_.labelpos.toLowerCase()) {
case "l":
F = -_.width / 2;
break;
case "r":
F = _.width / 2;
break;
}
if (F && (O += x ? F : -F), F = 0, O += (_.dummy ? b : g) / 2, O += ($.dummy ? b : g) / 2, O += $.width / 2, e.has($, "labelpos"))
switch ($.labelpos.toLowerCase()) {
case "l":
F = $.width / 2;
break;
case "r":
F = -$.width / 2;
break;
}
return F && (O += x ? F : -F), F = 0, O;
};
}
function m(g, b) {
return g.node(b).width;
}
return Tk;
}
var Ak, rP;
function B_e() {
if (rP) return Ak;
rP = 1;
var e = In(), t = wo(), n = D_e().positionX;
Ak = r;
function r(a) {
a = t.asNonCompoundGraph(a), o(a), e.forEach(n(a), function(i, s) {
a.node(s).x = i;
});
}
function o(a) {
var i = t.buildLayerMatrix(a), s = a.graph().ranksep, l = 0;
e.forEach(i, function(u) {
var c = e.max(e.map(u, function(d) {
return a.node(d).height;
}));
e.forEach(u, function(d) {
a.node(d).y = l + c / 2;
}), l += c + s;
});
}
return Ak;
}
var Ik, oP;
function z_e() {
if (oP) return Ik;
oP = 1;
var e = In(), t = x_e(), n = k_e(), r = __e(), o = wo().normalizeRanks, a = S_e(), i = wo().removeEmptyRanks, s = $_e(), l = E_e(), u = O_e(), c = M_e(), d = B_e(), p = wo(), h = Va().Graph;
Ik = f;
function f(te, oe) {
var ne = oe && oe.debugTiming ? p.time : p.notime;
ne("layout", function() {
var ee = ne(" buildLayoutGraph", function() {
return O(te);
});
ne(" runLayout", function() {
v(ee, ne);
}), ne(" updateInputGraph", function() {
m(te, ee);
});
});
}
function v(te, oe) {
oe(" makeSpaceForEdgeLabels", function() {
F(te);
}), oe(" removeSelfEdges", function() {
G(te);
}), oe(" acyclic", function() {
t.run(te);
}), oe(" nestingGraph.run", function() {
s.run(te);
}), oe(" rank", function() {
r(p.asNonCompoundGraph(te));
}), oe(" injectEdgeLabelProxies", function() {
A(te);
}), oe(" removeEmptyRanks", function() {
i(te);
}), oe(" nestingGraph.cleanup", function() {
s.cleanup(te);
}), oe(" normalizeRanks", function() {
o(te);
}), oe(" assignRankMinMax", function() {
T(te);
}), oe(" removeEdgeLabelProxies", function() {
R(te);
}), oe(" normalize.run", function() {
n.run(te);
}), oe(" parentDummyChains", function() {
a(te);
}), oe(" addBorderSegments", function() {
l(te);
}), oe(" order", function() {
c(te);
}), oe(" insertSelfEdges", function() {
se(te);
}), oe(" adjustCoordinateSystem", function() {
u.adjust(te);
}), oe(" position", function() {
d(te);
}), oe(" positionSelfEdges", function() {
ae(te);
}), oe(" removeBorderNodes", function() {
U(te);
}), oe(" normalize.undo", function() {
n.undo(te);
}), oe(" fixupEdgeLabelCoords", function() {
P(te);
}), oe(" undoCoordinateSystem", function() {
u.undo(te);
}), oe(" translateGraph", function() {
M(te);
}), oe(" assignNodeIntersects", function() {
j(te);
}), oe(" reversePoints", function() {
V(te);
}), oe(" acyclic.undo", function() {
t.undo(te);
});
}
function m(te, oe) {
e.forEach(te.nodes(), function(ne) {
var ee = te.node(ne), Z = oe.node(ne);
ee && (ee.x = Z.x, ee.y = Z.y, oe.children(ne).length && (ee.width = Z.width, ee.height = Z.height));
}), e.forEach(te.edges(), function(ne) {
var ee = te.edge(ne), Z = oe.edge(ne);
ee.points = Z.points, e.has(Z, "x") && (ee.x = Z.x, ee.y = Z.y);
}), te.graph().width = oe.graph().width, te.graph().height = oe.graph().height;
}
var g = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], b = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, x = ["acyclicer", "ranker", "rankdir", "align"], w = ["width", "height"], k = { width: 0, height: 0 }, C = ["minlen", "weight", "width", "height", "labeloffset"], _ = {
minlen: 1,
weight: 1,
width: 0,
height: 0,
labeloffset: 10,
labelpos: "r"
}, $ = ["labelpos"];
function O(te) {
var oe = new h({ multigraph: !0, compound: !0 }), ne = me(te.graph());
return oe.setGraph(e.merge(
{},
b,
de(ne, g),
e.pick(ne, x)
)), e.forEach(te.nodes(), function(ee) {
var Z = me(te.node(ee));
oe.setNode(ee, e.defaults(de(Z, w), k)), oe.setParent(ee, te.parent(ee));
}), e.forEach(te.edges(), function(ee) {
var Z = me(te.edge(ee));
oe.setEdge(ee, e.merge(
{},
_,
de(Z, C),
e.pick(Z, $)
));
}), oe;
}
function F(te) {
var oe = te.graph();
oe.ranksep /= 2, e.forEach(te.edges(), function(ne) {
var ee = te.edge(ne);
ee.minlen *= 2, ee.labelpos.toLowerCase() !== "c" && (oe.rankdir === "TB" || oe.rankdir === "BT" ? ee.width += ee.labeloffset : ee.height += ee.labeloffset);
});
}
function A(te) {
e.forEach(te.edges(), function(oe) {
var ne = te.edge(oe);
if (ne.width && ne.height) {
var ee = te.node(oe.v), Z = te.node(oe.w), le = { rank: (Z.rank - ee.rank) / 2 + ee.rank, e: oe };
p.addDummyNode(te, "edge-proxy", le, "_ep");
}
});
}
function T(te) {
var oe = 0;
e.forEach(te.nodes(), function(ne) {
var ee = te.node(ne);
ee.borderTop && (ee.minRank = te.node(ee.borderTop).rank, ee.maxRank = te.node(ee.borderBottom).rank, oe = e.max(oe, ee.maxRank));
}), te.graph().maxRank = oe;
}
function R(te) {
e.forEach(te.nodes(), function(oe) {
var ne = te.node(oe);
ne.dummy === "edge-proxy" && (te.edge(ne.e).labelRank = ne.rank, te.removeNode(oe));
});
}
function M(te) {
var oe = Number.POSITIVE_INFINITY, ne = 0, ee = Number.POSITIVE_INFINITY, Z = 0, le = te.graph(), pe = le.marginx || 0, ke = le.marginy || 0;
function Ne(De) {
var _e = De.x, Fe = De.y, Ie = De.width, Ae = De.height;
oe = Math.min(oe, _e - Ie / 2), ne = Math.max(ne, _e + Ie / 2), ee = Math.min(ee, Fe - Ae / 2), Z = Math.max(Z, Fe + Ae / 2);
}
e.forEach(te.nodes(), function(De) {
Ne(te.node(De));
}), e.forEach(te.edges(), function(De) {
var _e = te.edge(De);
e.has(_e, "x") && Ne(_e);
}), oe -= pe, ee -= ke, e.forEach(te.nodes(), function(De) {
var _e = te.node(De);
_e.x -= oe, _e.y -= ee;
}), e.forEach(te.edges(), function(De) {
var _e = te.edge(De);
e.forEach(_e.points, function(Fe) {
Fe.x -= oe, Fe.y -= ee;
}), e.has(_e, "x") && (_e.x -= oe), e.has(_e, "y") && (_e.y -= ee);
}), le.width = ne - oe + pe, le.height = Z - ee + ke;
}
function j(te) {
e.forEach(te.edges(), function(oe) {
var ne = te.edge(oe), ee = te.node(oe.v), Z = te.node(oe.w), le, pe;
ne.points ? (le = ne.points[0], pe = ne.points[ne.points.length - 1]) : (ne.points = [], le = Z, pe = ee), ne.points.unshift(p.intersectRect(ee, le)), ne.points.push(p.intersectRect(Z, pe));
});
}
function P(te) {
e.forEach(te.edges(), function(oe) {
var ne = te.edge(oe);
if (e.has(ne, "x"))
switch ((ne.labelpos === "l" || ne.labelpos === "r") && (ne.width -= ne.labeloffset), ne.labelpos) {
case "l":
ne.x -= ne.width / 2 + ne.labeloffset;
break;
case "r":
ne.x += ne.width / 2 + ne.labeloffset;
break;
}
});
}
function V(te) {
e.forEach(te.edges(), function(oe) {
var ne = te.edge(oe);
ne.reversed && ne.points.reverse();
});
}
function U(te) {
e.forEach(te.nodes(), function(oe) {
if (te.children(oe).length) {
var ne = te.node(oe), ee = te.node(ne.borderTop), Z = te.node(ne.borderBottom), le = te.node(e.last(ne.borderLeft)), pe = te.node(e.last(ne.borderRight));
ne.width = Math.abs(pe.x - le.x), ne.height = Math.abs(Z.y - ee.y), ne.x = le.x + ne.width / 2, ne.y = ee.y + ne.height / 2;
}
}), e.forEach(te.nodes(), function(oe) {
te.node(oe).dummy === "border" && te.removeNode(oe);
});
}
function G(te) {
e.forEach(te.edges(), function(oe) {
if (oe.v === oe.w) {
var ne = te.node(oe.v);
ne.selfEdges || (ne.selfEdges = []), ne.selfEdges.push({ e: oe, label: te.edge(oe) }), te.removeEdge(oe);
}
});
}
function se(te) {
var oe = p.buildLayerMatrix(te);
e.forEach(oe, function(ne) {
var ee = 0;
e.forEach(ne, function(Z, le) {
var pe = te.node(Z);
pe.order = le + ee, e.forEach(pe.selfEdges, function(ke) {
p.addDummyNode(te, "selfedge", {
width: ke.label.width,
height: ke.label.height,
rank: pe.rank,
order: le + ++ee,
e: ke.e,
label: ke.label
}, "_se");
}), delete pe.selfEdges;
});
});
}
function ae(te) {
e.forEach(te.nodes(), function(oe) {
var ne = te.node(oe);
if (ne.dummy === "selfedge") {
var ee = te.node(ne.e.v), Z = ee.x + ee.width / 2, le = ee.y, pe = ne.x - Z, ke = ee.height / 2;
te.setEdge(ne.e, ne.label), te.removeNode(oe), ne.label.points = [
{ x: Z + 2 * pe / 3, y: le - ke },
{ x: Z + 5 * pe / 6, y: le - ke },
{ x: Z + pe, y: le },
{ x: Z + 5 * pe / 6, y: le + ke },
{ x: Z + 2 * pe / 3, y: le + ke }
], ne.label.x = ne.x, ne.label.y = ne.y;
}
});
}
function de(te, oe) {
return e.mapValues(e.pick(te, oe), Number);
}
function me(te) {
var oe = {};
return e.forEach(te, function(ne, ee) {
oe[ee.toLowerCase()] = ne;
}), oe;
}
return Ik;
}
var Pk, aP;
function j_e() {
if (aP) return Pk;
aP = 1;
var e = In(), t = wo(), n = Va().Graph;
Pk = {
debugOrdering: r
};
function r(o) {
var a = t.buildLayerMatrix(o), i = new n({ compound: !0, multigraph: !0 }).setGraph({});
return e.forEach(o.nodes(), function(s) {
i.setNode(s, { label: s }), i.setParent(s, "layer" + o.node(s).rank);
}), e.forEach(o.edges(), function(s) {
i.setEdge(s.v, s.w, {}, s.name);
}), e.forEach(a, function(s, l) {
var u = "layer" + l;
i.setNode(u, { rank: "same" }), e.reduce(s, function(c, d) {
return i.setEdge(c, d, { style: "invis" }), d;
});
}), i;
}
return Pk;
}
var iP, sP;
function V_e() {
return sP || (sP = 1, iP = "0.8.5"), iP;
}
var lP, uP;
function H_e() {
return uP || (uP = 1, lP = {
graphlib: Va(),
layout: z_e(),
debug: j_e(),
util: {
time: wo().time,
notime: wo().notime
},
version: V_e()
}), lP;
}
(function(e, t) {
(function(n, r) {
e.exports = r(H_e());
})(vp, function(n) {
return (
/******/
function(r) {
var o = {};
function a(i) {
if (o[i])
return o[i].exports;
var s = o[i] = {
/******/
i,
/******/
l: !1,
/******/
exports: {}
/******/
};
return r[i].call(s.exports, s, s.exports, a), s.l = !0, s.exports;
}
return a.m = r, a.c = o, a.d = function(i, s, l) {
a.o(i, s) || Object.defineProperty(i, s, { enumerable: !0, get: l });
}, a.r = function(i) {
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(i, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(i, "__esModule", { value: !0 });
}, a.t = function(i, s) {
if (s & 1 && (i = a(i)), s & 8 || s & 4 && typeof i == "object" && i && i.__esModule) return i;
var l = /* @__PURE__ */ Object.create(null);
if (a.r(l), Object.defineProperty(l, "default", { enumerable: !0, value: i }), s & 2 && typeof i != "string") for (var u in i) a.d(l, u, (function(c) {
return i[c];
}).bind(null, u));
return l;
}, a.n = function(i) {
var s = i && i.__esModule ? (
/******/
function() {
return i.default;
}
) : (
/******/
function() {
return i;
}
);
return a.d(s, "a", s), s;
}, a.o = function(i, s) {
return Object.prototype.hasOwnProperty.call(i, s);
}, a.p = "", a(a.s = 0);
}([
/* 0 */
/***/
function(r, o, a) {
var i = a(1), s = function(l) {
l && l("layout", "dagre", i);
};
typeof cytoscape < "u" && s(cytoscape), r.exports = s;
},
/* 1 */
/***/
function(r, o, a) {
function i(p) {
"@babel/helpers - typeof";
return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? i = function(h) {
return typeof h;
} : i = function(h) {
return h && typeof Symbol == "function" && h.constructor === Symbol && h !== Symbol.prototype ? "symbol" : typeof h;
}, i(p);
}
var s = function(p) {
return typeof p == "function";
}, l = a(2), u = a(3), c = a(4);
function d(p) {
this.options = u({}, l, p);
}
d.prototype.run = function() {
var p = this.options, h = this, f = p.cy, v = p.eles, m = function(se, ae) {
return s(ae) ? ae.apply(se, [se]) : ae;
}, g = p.boundingBox || {
x1: 0,
y1: 0,
w: f.width(),
h: f.height()
};
g.x2 === void 0 && (g.x2 = g.x1 + g.w), g.w === void 0 && (g.w = g.x2 - g.x1), g.y2 === void 0 && (g.y2 = g.y1 + g.h), g.h === void 0 && (g.h = g.y2 - g.y1);
var b = new c.graphlib.Graph({
multigraph: !0,
compound: !0
}), x = {}, w = function(se, ae) {
ae != null && (x[se] = ae);
};
w("nodesep", p.nodeSep), w("edgesep", p.edgeSep), w("ranksep", p.rankSep), w("rankdir", p.rankDir), w("align", p.align), w("ranker", p.ranker), w("acyclicer", p.acyclicer), b.setGraph(x), b.setDefaultEdgeLabel(function() {
return {};
}), b.setDefaultNodeLabel(function() {
return {};
});
var k = v.nodes();
s(p.sort) && (k = k.sort(p.sort));
for (var C = 0; C < k.length; C++) {
var _ = k[C], $ = _.layoutDimensions(p);
b.setNode(_.id(), {
width: $.w,
height: $.h,
name: _.id()
});
}
for (var O = 0; O < k.length; O++) {
var F = k[O];
F.isChild() && b.setParent(F.id(), F.parent().id());
}
var A = v.edges().stdFilter(function(se) {
return !se.source().isParent() && !se.target().isParent();
});
s(p.sort) && (A = A.sort(p.sort));
for (var T = 0; T < A.length; T++) {
var R = A[T];
b.setEdge(R.source().id(), R.target().id(), {
minlen: m(R, p.minLen),
weight: m(R, p.edgeWeight),
name: R.id()
}, R.id());
}
c.layout(b);
for (var M = b.nodes(), j = 0; j < M.length; j++) {
var P = M[j], V = b.node(P);
f.getElementById(P).scratch().dagre = V;
}
var U;
p.boundingBox ? (U = {
x1: 1 / 0,
x2: -1 / 0,
y1: 1 / 0,
y2: -1 / 0
}, k.forEach(function(se) {
var ae = se.scratch().dagre;
U.x1 = Math.min(U.x1, ae.x), U.x2 = Math.max(U.x2, ae.x), U.y1 = Math.min(U.y1, ae.y), U.y2 = Math.max(U.y2, ae.y);
}), U.w = U.x2 - U.x1, U.h = U.y2 - U.y1) : U = g;
var G = function(se) {
if (p.boundingBox) {
var ae = U.w === 0 ? 0 : (se.x - U.x1) / U.w, de = U.h === 0 ? 0 : (se.y - U.y1) / U.h;
return {
x: g.x1 + ae * g.w,
y: g.y1 + de * g.h
};
} else
return se;
};
return k.layoutPositions(h, p, function(se) {
se = i(se) === "object" ? se : this;
var ae = se.scratch().dagre;
return G({
x: ae.x,
y: ae.y
});
}), this;
}, r.exports = d;
},
/* 2 */
/***/
function(r, o) {
var a = {
// dagre algo options, uses default value on undefined
nodeSep: void 0,
// the separation between adjacent nodes in the same rank
edgeSep: void 0,
// the separation between adjacent edges in the same rank
rankSep: void 0,
// the separation between adjacent nodes in the same rank
rankDir: void 0,
// 'TB' for top to bottom flow, 'LR' for left to right,
align: void 0,
// alignment for rank nodes. Can be 'UL', 'UR', 'DL', or 'DR', where U = up, D = down, L = left, and R = right
acyclicer: void 0,
// If set to 'greedy', uses a greedy heuristic for finding a feedback arc set for a graph.
// A feedback arc set is a set of edges that can be removed to make a graph acyclic.
ranker: void 0,
// Type of algorithm to assigns a rank to each node in the input graph.
// Possible values: network-simplex, tight-tree or longest-path
minLen: function(i) {
return 1;
},
// number of ranks to keep between the source and target of the edge
edgeWeight: function(i) {
return 1;
},
// higher weight edges are generally made shorter and straighter than lower weight edges
// general layout options
fit: !0,
// whether to fit to viewport
padding: 30,
// fit padding
spacingFactor: void 0,
// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up
nodeDimensionsIncludeLabels: !1,
// whether labels should be included in determining the space used by a node
animate: !1,
// whether to transition the node positions
animateFilter: function(i, s) {
return !0;
},
// whether to animate specific nodes when animation is on; non-animated nodes immediately go to their final positions
animationDuration: 500,
// duration of animation in ms if enabled
animationEasing: void 0,
// easing of animation if enabled
boundingBox: void 0,
// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
transform: function(i, s) {
return s;
},
// a function that applies a transform to the final node position
ready: function() {
},
// on layoutready
sort: void 0,
// a sorting function to order the nodes and edges; e.g. function(a, b){ return a.data('weight') - b.data('weight') }
// because cytoscape dagre creates a directed graph, and directed graphs use the node order as a tie breaker when
// defining the topology of a graph, this sort function can help ensure the correct order of the nodes/edges.
// this feature is most useful when adding and removing the same nodes and edges multiple times in a graph.
stop: function() {
}
// on layoutstop
};
r.exports = a;
},
/* 3 */
/***/
function(r, o) {
r.exports = Object.assign != null ? Object.assign.bind(Object) : function(a) {
for (var i = arguments.length, s = new Array(i > 1 ? i - 1 : 0), l = 1; l < i; l++)
s[l - 1] = arguments[l];
return s.forEach(function(u) {
Object.keys(u).forEach(function(c) {
return a[c] = u[c];
});
}), a;
};
},
/* 4 */
/***/
function(r, o) {
r.exports = n;
}
/******/
])
);
});
})(t7);
var U_e = t7.exports;
const q_e = /* @__PURE__ */ ohe(U_e);
ul.use(q_e);
const cP = function(e, t) {
if (!e || !t) return !1;
let n = JSON.stringify(e), r = JSON.stringify(t);
return n.indexOf(r) !== -1;
}, K_e = function(e) {
return e ? [...new Set(e.map((t) => JSON.stringify(t)))].map(
(t) => JSON.parse(t)
) : [];
}, G_e = function(e, t, n) {
let r = e.connectivity.flat(), o = K_e(r), a = [], i = !1;
return o.forEach((s) => {
i = !1, cP(t, s) && (i = !0), cP(n, s) && (i = !0), i || a.push(s);
}), a;
};
let W_e = class extends EventTarget {
constructor(e, t) {
super(), Fa(this, "cyg", null), Fa(this, "nodes", []), Fa(this, "edges", []), Fa(this, "axons", []), Fa(this, "dendrites", []), Fa(this, "somas", []), Fa(this, "labelCache", /* @__PURE__ */ new Map()), Fa(this, "graphCanvas", null), Fa(this, "hasPhenotypes", !1), this.labelCache = e, this.graphCanvas = t;
}
async addConnectivity(e) {
var t;
if (e && e["node-phenotypes"]) {
const n = ["ilxtr:hasSomaLocatedIn"], r = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"], o = [], a = [];
n.forEach((s) => {
o.push(...e["node-phenotypes"][s]);
}), r.forEach((s) => {
a.push(...e["node-phenotypes"][s]);
});
const i = G_e(e, o, a);
this.dendrites = o.map((s) => JSON.stringify(s)), this.axons = a.map((s) => JSON.stringify(s)), i != null && i.length && (this.somas = i.map((s) => JSON.stringify(s))), this.hasPhenotypes = !0;
} else
this.axons = e.axons.map((n) => JSON.stringify(n)), this.dendrites = e.dendrites.map((n) => JSON.stringify(n)), (t = e.somas) != null && t.length && (this.somas = e.somas.map((n) => JSON.stringify(n))), this.hasPhenotypes = !1;
if (e.connectivity.length)
for (const n of e.connectivity) {
const r = await this.graphNode(n[0]), o = await this.graphNode(n[1]);
this.nodes.push(r), this.nodes.push(o), this.edges.push({
id: `${r.id}_${o.id}`,
source: r.id,
target: o.id
});
}
else
this.nodes.push({
id: "MISSING",
label: "NO PATHS"
});
}
showConnectivity(e) {
this.cyg = new eSe(this, e), this.cyg.on("tap-node", (t) => {
const n = new CustomEvent("tap-node", {
detail: t.detail
});
this.dispatchEvent(n);
});
}
selectConnectivity(e) {
var t;
if ((t = this.cyg) != null && t.cy) {
let n = "";
this.cyg.cy.elements().forEach((r) => {
const o = r.data("label"), a = r_(o);
Q_e(e, a) && (n = r.id());
}), n && this.cyg.cy.$id(n).select();
}
}
clearConnectivity() {
var e;
(e = this.cyg) != null && e.cy && (this.cyg.cy.remove(), this.cyg.cy = null);
}
reset() {
var e;
(e = this.cyg) != null && e.cy && this.cyg.cy.reset();
}
zoom(e) {
var t;
if ((t = this.cyg) != null && t.cy) {
const n = this.cyg.cy.zoom(), r = this.cyg.cy.width(), o = this.cyg.cy.height(), a = {
x: r / 2,
y: o / 2
};
this.cyg.cy.zoom({
level: n + e,
renderedPosition: a
});
}
}
enableZoom(e) {
var t;
(t = this.cyg) != null && t.cy && this.cyg.cy.userZoomingEnabled(e);
}
get elements() {
return [
...this.nodes.map((e) => ({ data: e })),
...this.edges.map((e) => ({ data: e }))
];
}
get roots() {
return this.hasPhenotypes ? [
...this.dendrites
] : [
...this.dendrites,
...this.somas
];
}
async graphNode(e) {
const t = JSON.stringify(e), n = [e[0], ...e[1]], r = [];
for (const a of n) {
const i = this.labelCache.has(a) ? this.labelCache.get(a) : "";
r.push(i);
}
n.push(...r);
const o = {
id: t,
label: n.join(`
`)
};
return this.hasPhenotypes ? this.axons.includes(t) ? o.axon = !0 : this.dendrites.includes(t) ? o.dendrite = !0 : o.somas = !0 : this.axons.includes(t) ? this.dendrites.includes(t) || this.somas.includes(t) ? o.somas = !0 : o.axon = !0 : (this.dendrites.includes(t) || this.somas.includes(t)) && (o.dendrite = !0), o;
}
on(e, t) {
this.addEventListener(e, t);
}
};
const Y_e = "#8300bf", X_e = "#f3ecf6", Z_e = [
{
selector: "node",
style: {
label: function(e) {
return J_e(e.data("label"));
},
// 'background-color': '#80F0F0',
"background-color": "transparent",
"background-opacity": "0",
"text-valign": "center",
"text-wrap": "wrap",
width: "80px",
height: "80px",
"text-max-width": "80px",
"font-size": "6px",
shape: "round-rectangle",
"border-width": 1,
"border-style": "solid",
"border-color": "gray"
}
},
{
selector: "node[axon]",
style: {
// 'background-color': 'green',
shape: "round-diamond",
width: "100px",
height: "100px"
}
},
{
selector: "node[dendrite]",
style: {
// 'background-color': 'red',
shape: "ellipse"
}
},
{
selector: "node[somas]",
style: {
// 'background-color': 'gray',
shape: "round-rectangle"
}
},
{
selector: "edge",
style: {
width: 1,
"line-color": "dimgray",
"curve-style": "bezier"
}
},
{
selector: "node.active",
style: {
"border-color": Y_e,
"background-color": X_e,
"background-opacity": 0.75
}
}
];
function J_e(e) {
const t = e.split(`
`), n = t.length / 2, r = t.slice(n);
return tj(r.join(`
`));
}
function tj(e) {
return e.split(`
`).map((t) => t && t[0] >= "a" && t[0] <= "z" ? t.charAt(0).toUpperCase() + t.slice(1) : t).join(`
`);
}
function r_(e) {
const t = e ? e.split(`
`) : [], n = [];
for (let r = 0; r < t.length / 2; r++)
n.push({
id: t[r],
label: t[r + t.length / 2]
});
return n;
}
function Q_e(e, t) {
e.sort((n, r) => n.id < r.id ? -1 : n.id > r.id ? 1 : 0), t.sort((n, r) => n.id < r.id ? -1 : n.id > r.id ? 1 : 0);
for (let n = 0; n < e.length; n++)
if (JSON.stringify(e[n]) !== JSON.stringify(t[n]))
return !1;
return !0;
}
class eSe extends EventTarget {
constructor(t, n) {
var r;
super(), Fa(this, "cy"), Fa(this, "tooltip"), this.cy = ul({
container: n,
elements: t.elements,
layout: {
name: "dagre",
nodeSep: 150,
edgeSep: 50,
rankSep: 100,
rankDir: "TB",
roots: t.roots.length ? t.roots : void 0
},
style: Z_e,
minZoom: 0.1,
maxZoom: 10,
wheelSensitivity: 0.4
}).on("mouseover", "node", this.overNode.bind(this)).on("mouseout", "node", this.exitNode.bind(this)).on("position", "node", this.moveNode.bind(this)), this.tooltip = document.createElement("div"), this.tooltip.className = "cy-graph-tooltip", this.tooltip.hidden = !0, (r = n == null ? void 0 : n.lastChild) == null || r.appendChild(this.tooltip);
}
remove() {
this.cy && this.cy.destroy();
}
checkRightBoundary(t) {
var n;
t + this.tooltip.offsetWidth >= ((n = this.tooltip.parentElement) == null ? void 0 : n.offsetWidth) && (this.tooltip.style.left = `${t - this.tooltip.offsetWidth}px`);
}
overNode(t) {
const n = t.target.data(), { label: r } = n, o = r_(r).map((a) => a.label + " (" + a.id + ")");
this.tooltip.innerText = tj(o.join(`
`)), this.tooltip.style.left = `${t.renderedPosition.x}px`, this.tooltip.style.top = `${t.renderedPosition.y}px`, this.tooltip.style.maxWidth = "240px", this.tooltip.style.zIndex = 2, this.tooltip.hidden = !1, this.checkRightBoundary(t.renderedPosition.x), this.tapNode(t, !0);
}
moveNode(t) {
const n = t.target;
this.tooltip.style.left = `${n.renderedPosition().x}px`, this.tooltip.style.top = `${n.renderedPosition().y}px`, this.checkRightBoundary(n.renderedPosition().x);
}
exitNode(t) {
this.tooltip.hidden = !0, this.tapNode(t, !1);
}
tapNode(t, n) {
const r = t.target, o = r.data();
let { label: a } = o;
n ? r.addClass("active") : (r.removeClass("active"), a = "", setTimeout(() => {
r.unselect();
}));
const i = r_(a), s = new CustomEvent("tap-node", {
detail: i
});
this.dispatchEvent(s);
}
on(t, n) {
this.addEventListener(t, n);
}
}
const tSe = 1.3, nSe = 24 * 60 * 60 * 1e3, rSe = "Reset position", dP = "Lock zoom", oSe = "Unlock zoom", aSe = "Zoom in", iSe = "Zoom out", pP = 0.25, sSe = "#8300bf", lSe = {
name: "ConnectivityGraph",
props: {
/**
* Entity to load its connectivity graph.
*/
entry: {
type: String,
default: ""
},
mapServer: {
type: String,
default: ""
},
sckanVersion: {
type: String,
default: ""
},
selectedConnectivityData: {
type: Array,
default: []
},
connectivityFromMap: {
type: Object,
default: () => null
},
connectivityError: {
type: Object,
default: () => {
}
}
},
data: function() {
return {
loading: !0,
loadingError: "",
connectivityGraph: null,
selectedSource: "",
availableSources: [],
pathList: [],
schemaVersion: "",
knowledgeByPath: /* @__PURE__ */ new Map(),
labelledTerms: /* @__PURE__ */ new Set(),
labelCache: /* @__PURE__ */ new Map(),
resetLabel: rSe,
zoomLockLabel: dP,
zoomInLabel: aSe,
zoomOutLabel: iSe,
iconColor: sSe,
zoomEnabled: !1,
connectivityGraphContainer: null
};
},
watch: {
connectivityFromMap: function(e, t) {
e != t && (this.showSpinner(), this.start());
}
},
mounted() {
this.showSpinner(), this.updateTooltipContainer(), this.refreshCache(), this.loadCacheData(), this.start();
},
methods: {
updateTooltipContainer: function() {
this.connectivityGraphContainer = this.$refs.connectivityGraphRef;
},
loadCacheData: function() {
const e = sessionStorage.getItem("connectivity-graph-sources"), t = sessionStorage.getItem("connectivity-graph-labels"), n = sessionStorage.getItem("connectivity-graph-pathlist"), r = sessionStorage.getItem("connectivity-graph-schema-version");
if (this.sckanVersion && (this.selectedSource = this.sckanVersion), sessionStorage.setItem("connectivity-graph-selected-source", this.selectedSource), this.updateCacheExpiry(), e && (this.availableSources = JSON.parse(e)), n && (this.pathList = JSON.parse(n)), t) {
const o = JSON.parse(t);
this.labelCache = new Map(Object.entries(o));
}
r && (this.schemaVersion = r);
},
isValidKnowledgeSource: function() {
const e = sessionStorage.getItem("connectivity-graph-selected-source");
return !(this.sckanVersion && this.sckanVersion !== e);
},
removeAllCacheData: function() {
[
"connectivity-graph-expiry",
"connectivity-graph-selected-source",
"connectivity-graph-source",
// to clear old data
"connectivity-graph-sources",
"connectivity-graph-labels",
"connectivity-graph-pathlist",
"connectivity-graph-schema-version"
].forEach((e) => {
sessionStorage.removeItem(e);
});
},
refreshCache: function() {
const e = sessionStorage.getItem("connectivity-graph-expiry"), t = /* @__PURE__ */ new Date(), n = this.isValidKnowledgeSource();
(t.getTime() > e || !n) && this.removeAllCacheData();
},
updateCacheExpiry: function() {
const e = (/* @__PURE__ */ new Date()).getTime() + nSe;
sessionStorage.setItem("connectivity-graph-expiry", e);
},
start: function() {
this.run().then((e) => {
e != null && e.success ? this.showGraph(this.entry) : e != null && e.error ? this.loadingError = e.error : this.loadingError = "Loading error!";
}).catch((e) => {
this.loadingError = "Loading error!", this.hideSpinner();
});
},
run: async function() {
return this.schemaVersion || (this.schemaVersion = await this.getSchemaVersion(), sessionStorage.setItem("connectivity-graph-schema-version", this.schemaVersion), this.updateCacheExpiry()), this.schemaVersion < tSe ? {
error: `No server available for schema-version ${this.schemaVersion}.`
} : (this.availableSources.length || (this.availableSources = await this.loadAvailableSources()), this.isSCKANVersionAvailable() ? (await this.setPathList(this.selectedSource), {
success: !0
}) : {
error: `No data available for SCKAN version ${this.selectedSource}.`
});
},
showGraph: async function(e) {
const t = this.$refs.graphCanvas;
this.connectivityFromMap && (this.cacheLabels(this.connectivityFromMap), await this.getCachedTermLabels()), this.connectivityGraph = new W_e(this.labelCache, t);
const n = this.knowledgeByPath.get(e);
this.connectivityFromMap && (n.axons = this.connectivityFromMap.axons, n.connectivity = this.connectivityFromMap.connectivity, n.dendrites = this.connectivityFromMap.dendrites, n.somas = this.connectivityFromMap.somas), await this.connectivityGraph.addConnectivity(n), this.connectivityGraph.showConnectivity(t), this.selectedConnectivityData.length && this.connectivityGraph.selectConnectivity(this.selectedConnectivityData), this.connectivityGraph.on("tap-node", (r) => {
const o = r.detail;
this.$emit("tap-node", o);
}), this.hideSpinner();
},
query: async function(e, t) {
const n = `${this.mapServer}knowledge/query/`, r = { sql: e, params: t };
try {
const o = await fetch(n, {
method: "POST",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store",
"Content-Type": "application/json"
},
body: JSON.stringify(r)
});
if (!o.ok)
throw new Error(`Cannot access ${n}`);
return await o.json();
} catch {
return {
values: []
};
}
},
isSCKANVersionAvailable: function() {
return this.availableSources.includes(this.selectedSource);
},
loadAvailableSources: async function() {
const e = await this.getJsonData(`${this.mapServer}knowledge/sources`), t = (e ? e.sources || [] : []).filter((n) => n);
return sessionStorage.setItem("connectivity-graph-sources", JSON.stringify(t)), this.updateCacheExpiry(), t;
},
loadPathData: async function(e) {
const t = await this.query(
`select entity, knowledge from knowledge
where entity like 'ilxtr:%' and source=?
order by entity`,
[e]
);
return t ? t.values : [];
},
setPathList: async function(e) {
this.pathList.length || (this.pathList = await this.loadPathData(e), sessionStorage.setItem("connectivity-graph-pathlist", JSON.stringify(this.pathList)), this.updateCacheExpiry()), this.knowledgeByPath.clear(), this.labelledTerms = /* @__PURE__ */ new Set();
for (const [t, n] of this.pathList) {
const r = JSON.parse(n);
"connectivity" in r && (this.knowledgeByPath.set(t, r), this.cacheLabels(r));
}
return this.labelCache.size || await this.getCachedTermLabels(), "";
},
getSchemaVersion: async function() {
const e = await this.getJsonData(`${this.mapServer}knowledge/schema-version`);
return e && +e.version || 0;
},
getJsonData: async function(e) {
try {
const t = await fetch(e, {
method: "GET",
headers: {
Accept: "application/json; charset=utf-8",
"Cache-Control": "no-store",
"Content-Type": "application/json"
}
});
return t.ok || console.error(`Cannot access ${e}`), await t.json();
} catch {
return null;
}
},
getCachedTermLabels: async function() {
if (this.labelledTerms.size) {
const e = await this.query(
`select entity, knowledge from knowledge
where entity in (?${", ?".repeat(this.labelledTerms.size - 1)})
order by source desc`,
[...this.labelledTerms.values()]
);
let t = null;
for (const [r, o] of e.values)
if (r !== t) {
const a = JSON.parse(o);
this.labelCache.set(r, a.label || r), t = r;
}
const n = Object.fromEntries(this.labelCache);
sessionStorage.setItem("connectivity-graph-labels", JSON.stringify(n)), this.updateCacheExpiry();
}
},
cacheNodeLabels: function(e) {
for (const t of [e[0], ...e[1]])
this.labelledTerms.add(t);
},
cacheLabels: async function(e) {
for (const t of e.connectivity)
this.cacheNodeLabels(t[0]), this.cacheNodeLabels(t[1]);
},
showSpinner: function() {
this.loading = !0;
},
hideSpinner: function() {
this.loading = !1;
},
reset: function() {
this.connectivityGraph.reset();
},
zoomIn: function() {
this.connectivityGraph.zoom(pP);
},
zoomOut: function() {
this.connectivityGraph.zoom(-pP);
},
/**
* Enable/disable user zoom for scrolling
*/
toggleZoom: function() {
this.zoomEnabled = !this.zoomEnabled, this.zoomLockLabel = this.zoomEnabled ? oSe : dP, this.connectivityGraph.enableZoom(!this.zoomEnabled);
}
}
}, uSe = {
class: "connectivity-graph",
ref: "connectivityGraphRef"
}, cSe = {
ref: "graphCanvas",
class: "graph-canvas"
}, dSe = { class: "control-panel control-panel-tools" }, pSe = { class: "visually-hidden" }, fSe = { class: "visually-hidden" }, hSe = { class: "visually-hidden" }, vSe = { class: "visually-hidden" }, gSe = /* @__PURE__ */ yW('