\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace"
+ , s = n.console && (n.console.warn || n.console.log);
+ return s && s.call(n.console, o, i),
+ e.apply(this, arguments)
+ }
+ }
+ function u(e, t, i) {
+ var o, n = t.prototype;
+ o = e.prototype = Object.create(n),
+ o.constructor = e,
+ o._super = n,
+ i && ce(o, i)
+ }
+ function f(e, t) {
+ return function() {
+ return e.apply(t, arguments)
+ }
+ }
+ function p(e, t) {
+ return typeof e == pe ? e.apply(t ? t[0] || a : a, t) : e
+ }
+ function v(e, t) {
+ return e === a ? t : e
+ }
+ function y(e, t, i) {
+ l(_(t), function(t) {
+ e.addEventListener(t, i, !1)
+ })
+ }
+ function g(e, t, i) {
+ l(_(t), function(t) {
+ e.removeEventListener(t, i, !1)
+ })
+ }
+ function b(e, t) {
+ for (; e; ) {
+ if (e == t)
+ return !0;
+ e = e.parentNode
+ }
+ return !1
+ }
+ function m(e, t) {
+ return e.indexOf(t) > -1
+ }
+ function _(e) {
+ return e.trim().split(/\s+/g)
+ }
+ function w(e, t, i) {
+ if (e.indexOf && !i)
+ return e.indexOf(t);
+ for (var o = 0; o < e.length; ) {
+ if (i && e[o][i] == t || !i && e[o] === t)
+ return o;
+ o++
+ }
+ return -1
+ }
+ function k(e) {
+ return Array.prototype.slice.call(e, 0)
+ }
+ function x(e, t, i) {
+ for (var o = [], n = [], s = 0; s < e.length; ) {
+ var r = t ? e[s][t] : e[s];
+ w(n, r) < 0 && o.push(e[s]),
+ n[s] = r,
+ s++
+ }
+ return i && (o = t ? o.sort(function(e, i) {
+ return e[t] > i[t]
+ }) : o.sort()),
+ o
+ }
+ function O(e, t) {
+ for (var i, o, n = t[0].toUpperCase() + t.slice(1), s = 0; s < ue.length; ) {
+ if (i = ue[s],
+ o = i ? i + n : t,
+ o in e)
+ return o;
+ s++
+ }
+ return a
+ }
+ function E() {
+ return _e++
+ }
+ function M(e) {
+ var t = e.ownerDocument || e;
+ return t.defaultView || t.parentWindow || n
+ }
+ function D(e, t) {
+ var i = this;
+ this.manager = e,
+ this.callback = t,
+ this.element = e.element,
+ this.target = e.options.inputTarget,
+ this.domHandler = function(t) {
+ p(e.options.enable, [e]) && i.handler(t)
+ }
+ ,
+ this.init()
+ }
+ function S(e) {
+ var t, i = e.options.inputClass;
+ return new (t = i ? i : xe ? W : Oe ? V : ke ? G : H)(e,C)
+ }
+ function C(e, t, i) {
+ var o = i.pointers.length
+ , n = i.changedPointers.length
+ , s = t & Te && o - n === 0
+ , r = t & (Be | Fe) && o - n === 0;
+ i.isFirst = !!s,
+ i.isFinal = !!r,
+ s && (e.session = {}),
+ i.eventType = t,
+ T(e, i),
+ e.emit("hammer.input", i),
+ e.recognize(i),
+ e.session.prevInput = i
+ }
+ function T(e, t) {
+ var i = e.session
+ , o = t.pointers
+ , n = o.length;
+ i.firstInput || (i.firstInput = F(t)),
+ n > 1 && !i.firstMultiple ? i.firstMultiple = F(t) : 1 === n && (i.firstMultiple = !1);
+ var s = i.firstInput
+ , r = i.firstMultiple
+ , a = r ? r.center : s.center
+ , h = t.center = I(o);
+ t.timeStamp = ge(),
+ t.deltaTime = t.timeStamp - s.timeStamp,
+ t.angle = R(a, h),
+ t.distance = z(a, h),
+ P(i, t),
+ t.offsetDirection = N(t.deltaX, t.deltaY);
+ var d = j(t.deltaTime, t.deltaX, t.deltaY);
+ t.overallVelocityX = d.x,
+ t.overallVelocityY = d.y,
+ t.overallVelocity = ye(d.x) > ye(d.y) ? d.x : d.y,
+ t.scale = r ? L(r.pointers, o) : 1,
+ t.rotation = r ? A(r.pointers, o) : 0,
+ t.maxPointers = i.prevInput ? t.pointers.length > i.prevInput.maxPointers ? t.pointers.length : i.prevInput.maxPointers : t.pointers.length,
+ B(i, t);
+ var l = e.element;
+ b(t.srcEvent.target, l) && (l = t.srcEvent.target),
+ t.target = l
+ }
+ function P(e, t) {
+ var i = t.center
+ , o = e.offsetDelta || {}
+ , n = e.prevDelta || {}
+ , s = e.prevInput || {};
+ t.eventType !== Te && s.eventType !== Be || (n = e.prevDelta = {
+ x: s.deltaX || 0,
+ y: s.deltaY || 0
+ },
+ o = e.offsetDelta = {
+ x: i.x,
+ y: i.y
+ }),
+ t.deltaX = n.x + (i.x - o.x),
+ t.deltaY = n.y + (i.y - o.y)
+ }
+ function B(e, t) {
+ var i, o, n, s, r = e.lastInterval || t, h = t.timeStamp - r.timeStamp;
+ if (t.eventType != Fe && (h > Ce || r.velocity === a)) {
+ var d = t.deltaX - r.deltaX
+ , l = t.deltaY - r.deltaY
+ , c = j(h, d, l);
+ o = c.x,
+ n = c.y,
+ i = ye(c.x) > ye(c.y) ? c.x : c.y,
+ s = N(d, l),
+ e.lastInterval = t
+ } else
+ i = r.velocity,
+ o = r.velocityX,
+ n = r.velocityY,
+ s = r.direction;
+ t.velocity = i,
+ t.velocityX = o,
+ t.velocityY = n,
+ t.direction = s
+ }
+ function F(e) {
+ for (var t = [], i = 0; i < e.pointers.length; )
+ t[i] = {
+ clientX: ve(e.pointers[i].clientX),
+ clientY: ve(e.pointers[i].clientY)
+ },
+ i++;
+ return {
+ timeStamp: ge(),
+ pointers: t,
+ center: I(t),
+ deltaX: e.deltaX,
+ deltaY: e.deltaY
+ }
+ }
+ function I(e) {
+ var t = e.length;
+ if (1 === t)
+ return {
+ x: ve(e[0].clientX),
+ y: ve(e[0].clientY)
+ };
+ for (var i = 0, o = 0, n = 0; t > n; )
+ i += e[n].clientX,
+ o += e[n].clientY,
+ n++;
+ return {
+ x: ve(i / t),
+ y: ve(o / t)
+ }
+ }
+ function j(e, t, i) {
+ return {
+ x: t / e || 0,
+ y: i / e || 0
+ }
+ }
+ function N(e, t) {
+ return e === t ? Ie : ye(e) >= ye(t) ? 0 > e ? je : Ne : 0 > t ? ze : Re
+ }
+ function z(e, t, i) {
+ i || (i = We);
+ var o = t[i[0]] - e[i[0]]
+ , n = t[i[1]] - e[i[1]];
+ return Math.sqrt(o * o + n * n)
+ }
+ function R(e, t, i) {
+ i || (i = We);
+ var o = t[i[0]] - e[i[0]]
+ , n = t[i[1]] - e[i[1]];
+ return 180 * Math.atan2(n, o) / Math.PI
+ }
+ function A(e, t) {
+ return R(t[1], t[0], Ye) + R(e[1], e[0], Ye)
+ }
+ function L(e, t) {
+ return z(t[0], t[1], Ye) / z(e[0], e[1], Ye)
+ }
+ function H() {
+ this.evEl = Ve,
+ this.evWin = qe,
+ this.allow = !0,
+ this.pressed = !1,
+ D.apply(this, arguments)
+ }
+ function W() {
+ this.evEl = Ke,
+ this.evWin = Ze,
+ D.apply(this, arguments),
+ this.store = this.manager.session.pointerEvents = []
+ }
+ function Y() {
+ this.evTarget = Je,
+ this.evWin = $e,
+ this.started = !1,
+ D.apply(this, arguments)
+ }
+ function U(e, t) {
+ var i = k(e.touches)
+ , o = k(e.changedTouches);
+ return t & (Be | Fe) && (i = x(i.concat(o), "identifier", !0)),
+ [i, o]
+ }
+ function V() {
+ this.evTarget = tt,
+ this.targetIds = {},
+ D.apply(this, arguments)
+ }
+ function q(e, t) {
+ var i = k(e.touches)
+ , o = this.targetIds;
+ if (t & (Te | Pe) && 1 === i.length)
+ return o[i[0].identifier] = !0,
+ [i, i];
+ var n, s, r = k(e.changedTouches), a = [], h = this.target;
+ if (s = i.filter(function(e) {
+ return b(e.target, h)
+ }),
+ t === Te)
+ for (n = 0; n < s.length; )
+ o[s[n].identifier] = !0,
+ n++;
+ for (n = 0; n < r.length; )
+ o[r[n].identifier] && a.push(r[n]),
+ t & (Be | Fe) && delete o[r[n].identifier],
+ n++;
+ return a.length ? [x(s.concat(a), "identifier", !0), a] : void 0
+ }
+ function G() {
+ D.apply(this, arguments);
+ var e = f(this.handler, this);
+ this.touch = new V(this.manager,e),
+ this.mouse = new H(this.manager,e)
+ }
+ function X(e, t) {
+ this.manager = e,
+ this.set(t)
+ }
+ function K(e) {
+ if (m(e, at))
+ return at;
+ var t = m(e, ht)
+ , i = m(e, dt);
+ return t && i ? at : t || i ? t ? ht : dt : m(e, rt) ? rt : st
+ }
+ function Z(e) {
+ this.options = ce({}, this.defaults, e || {}),
+ this.id = E(),
+ this.manager = null,
+ this.options.enable = v(this.options.enable, !0),
+ this.state = lt,
+ this.simultaneous = {},
+ this.requireFail = []
+ }
+ function Q(e) {
+ return e & vt ? "cancel" : e & ft ? "end" : e & ut ? "move" : e & ct ? "start" : ""
+ }
+ function J(e) {
+ return e == Re ? "down" : e == ze ? "up" : e == je ? "left" : e == Ne ? "right" : ""
+ }
+ function $(e, t) {
+ var i = t.manager;
+ return i ? i.get(e) : e
+ }
+ function ee() {
+ Z.apply(this, arguments)
+ }
+ function te() {
+ ee.apply(this, arguments),
+ this.pX = null,
+ this.pY = null
+ }
+ function ie() {
+ ee.apply(this, arguments)
+ }
+ function oe() {
+ Z.apply(this, arguments),
+ this._timer = null,
+ this._input = null
+ }
+ function ne() {
+ ee.apply(this, arguments)
+ }
+ function se() {
+ ee.apply(this, arguments)
+ }
+ function re() {
+ Z.apply(this, arguments),
+ this.pTime = !1,
+ this.pCenter = !1,
+ this._timer = null,
+ this._input = null,
+ this.count = 0
+ }
+ function ae(e, t) {
+ return t = t || {},
+ t.recognizers = v(t.recognizers, ae.defaults.preset),
+ new he(e,t)
+ }
+ function he(e, t) {
+ this.options = ce({}, ae.defaults, t || {}),
+ this.options.inputTarget = this.options.inputTarget || e,
+ this.handlers = {},
+ this.session = {},
+ this.recognizers = [],
+ this.element = e,
+ this.input = S(this),
+ this.touchAction = new X(this,this.options.touchAction),
+ de(this, !0),
+ l(this.options.recognizers, function(e) {
+ var t = this.add(new e[0](e[1]));
+ e[2] && t.recognizeWith(e[2]),
+ e[3] && t.requireFailure(e[3])
+ }, this)
+ }
+ function de(e, t) {
+ var i = e.element;
+ i.style && l(e.options.cssProps, function(e, o) {
+ i.style[O(i.style, o)] = t ? e : ""
+ })
+ }
+ function le(e, t) {
+ var i = s.createEvent("Event");
+ i.initEvent(e, !0, !0),
+ i.gesture = t,
+ t.target.dispatchEvent(i)
+ }
+ var ce, ue = ["", "webkit", "Moz", "MS", "ms", "o"], fe = s.createElement("div"), pe = "function", ve = Math.round, ye = Math.abs, ge = Date.now;
+ ce = "function" != typeof Object.assign ? function(e) {
+ if (e === a || null === e)
+ throw new TypeError("Cannot convert undefined or null to object");
+ for (var t = Object(e), i = 1; i < arguments.length; i++) {
+ var o = arguments[i];
+ if (o !== a && null !== o)
+ for (var n in o)
+ o.hasOwnProperty(n) && (t[n] = o[n])
+ }
+ return t
+ }
+ : Object.assign;
+ var be = c(function(e, t, i) {
+ for (var o = Object.keys(t), n = 0; n < o.length; )
+ (!i || i && e[o[n]] === a) && (e[o[n]] = t[o[n]]),
+ n++;
+ return e
+ }, "extend", "Use `assign`.")
+ , me = c(function(e, t) {
+ return be(e, t, !0)
+ }, "merge", "Use `assign`.")
+ , _e = 1
+ , we = /mobile|tablet|ip(ad|hone|od)|android/i
+ , ke = "ontouchstart"in n
+ , xe = O(n, "PointerEvent") !== a
+ , Oe = ke && we.test(navigator.userAgent)
+ , Ee = "touch"
+ , Me = "pen"
+ , De = "mouse"
+ , Se = "kinect"
+ , Ce = 25
+ , Te = 1
+ , Pe = 2
+ , Be = 4
+ , Fe = 8
+ , Ie = 1
+ , je = 2
+ , Ne = 4
+ , ze = 8
+ , Re = 16
+ , Ae = je | Ne
+ , Le = ze | Re
+ , He = Ae | Le
+ , We = ["x", "y"]
+ , Ye = ["clientX", "clientY"];
+ D.prototype = {
+ handler: function() {},
+ init: function() {
+ this.evEl && y(this.element, this.evEl, this.domHandler),
+ this.evTarget && y(this.target, this.evTarget, this.domHandler),
+ this.evWin && y(M(this.element), this.evWin, this.domHandler)
+ },
+ destroy: function() {
+ this.evEl && g(this.element, this.evEl, this.domHandler),
+ this.evTarget && g(this.target, this.evTarget, this.domHandler),
+ this.evWin && g(M(this.element), this.evWin, this.domHandler)
+ }
+ };
+ var Ue = {
+ mousedown: Te,
+ mousemove: Pe,
+ mouseup: Be
+ }
+ , Ve = "mousedown"
+ , qe = "mousemove mouseup";
+ u(H, D, {
+ handler: function(e) {
+ var t = Ue[e.type];
+ t & Te && 0 === e.button && (this.pressed = !0),
+ t & Pe && 1 !== e.which && (t = Be),
+ this.pressed && this.allow && (t & Be && (this.pressed = !1),
+ this.callback(this.manager, t, {
+ pointers: [e],
+ changedPointers: [e],
+ pointerType: De,
+ srcEvent: e
+ }))
+ }
+ });
+ var Ge = {
+ pointerdown: Te,
+ pointermove: Pe,
+ pointerup: Be,
+ pointercancel: Fe,
+ pointerout: Fe
+ }
+ , Xe = {
+ 2: Ee,
+ 3: Me,
+ 4: De,
+ 5: Se
+ }
+ , Ke = "pointerdown"
+ , Ze = "pointermove pointerup pointercancel";
+ n.MSPointerEvent && !n.PointerEvent && (Ke = "MSPointerDown",
+ Ze = "MSPointerMove MSPointerUp MSPointerCancel"),
+ u(W, D, {
+ handler: function(e) {
+ var t = this.store
+ , i = !1
+ , o = e.type.toLowerCase().replace("ms", "")
+ , n = Ge[o]
+ , s = Xe[e.pointerType] || e.pointerType
+ , r = s == Ee
+ , a = w(t, e.pointerId, "pointerId");
+ n & Te && (0 === e.button || r) ? 0 > a && (t.push(e),
+ a = t.length - 1) : n & (Be | Fe) && (i = !0),
+ 0 > a || (t[a] = e,
+ this.callback(this.manager, n, {
+ pointers: t,
+ changedPointers: [e],
+ pointerType: s,
+ srcEvent: e
+ }),
+ i && t.splice(a, 1))
+ }
+ });
+ var Qe = {
+ touchstart: Te,
+ touchmove: Pe,
+ touchend: Be,
+ touchcancel: Fe
+ }
+ , Je = "touchstart"
+ , $e = "touchstart touchmove touchend touchcancel";
+ u(Y, D, {
+ handler: function(e) {
+ var t = Qe[e.type];
+ if (t === Te && (this.started = !0),
+ this.started) {
+ var i = U.call(this, e, t);
+ t & (Be | Fe) && i[0].length - i[1].length === 0 && (this.started = !1),
+ this.callback(this.manager, t, {
+ pointers: i[0],
+ changedPointers: i[1],
+ pointerType: Ee,
+ srcEvent: e
+ })
+ }
+ }
+ });
+ var et = {
+ touchstart: Te,
+ touchmove: Pe,
+ touchend: Be,
+ touchcancel: Fe
+ }
+ , tt = "touchstart touchmove touchend touchcancel";
+ u(V, D, {
+ handler: function(e) {
+ var t = et[e.type]
+ , i = q.call(this, e, t);
+ i && this.callback(this.manager, t, {
+ pointers: i[0],
+ changedPointers: i[1],
+ pointerType: Ee,
+ srcEvent: e
+ })
+ }
+ }),
+ u(G, D, {
+ handler: function(e, t, i) {
+ var o = i.pointerType == Ee
+ , n = i.pointerType == De;
+ if (o)
+ this.mouse.allow = !1;
+ else if (n && !this.mouse.allow)
+ return;
+ t & (Be | Fe) && (this.mouse.allow = !0),
+ this.callback(e, t, i)
+ },
+ destroy: function() {
+ this.touch.destroy(),
+ this.mouse.destroy()
+ }
+ });
+ var it = O(fe.style, "touchAction")
+ , ot = it !== a
+ , nt = "compute"
+ , st = "auto"
+ , rt = "manipulation"
+ , at = "none"
+ , ht = "pan-x"
+ , dt = "pan-y";
+ X.prototype = {
+ set: function(e) {
+ e == nt && (e = this.compute()),
+ ot && this.manager.element.style && (this.manager.element.style[it] = e),
+ this.actions = e.toLowerCase().trim()
+ },
+ update: function() {
+ this.set(this.manager.options.touchAction)
+ },
+ compute: function() {
+ var e = [];
+ return l(this.manager.recognizers, function(t) {
+ p(t.options.enable, [t]) && (e = e.concat(t.getTouchAction()))
+ }),
+ K(e.join(" "))
+ },
+ preventDefaults: function(e) {
+ if (!ot) {
+ var t = e.srcEvent
+ , i = e.offsetDirection;
+ if (this.manager.session.prevented)
+ return void t.preventDefault();
+ var o = this.actions
+ , n = m(o, at)
+ , s = m(o, dt)
+ , r = m(o, ht);
+ if (n) {
+ var a = 1 === e.pointers.length
+ , h = e.distance < 2
+ , d = e.deltaTime < 250;
+ if (a && h && d)
+ return
+ }
+ if (!r || !s)
+ return n || s && i & Ae || r && i & Le ? this.preventSrc(t) : void 0
+ }
+ },
+ preventSrc: function(e) {
+ this.manager.session.prevented = !0,
+ e.preventDefault()
+ }
+ };
+ var lt = 1
+ , ct = 2
+ , ut = 4
+ , ft = 8
+ , pt = ft
+ , vt = 16
+ , yt = 32;
+ Z.prototype = {
+ defaults: {},
+ set: function(e) {
+ return ce(this.options, e),
+ this.manager && this.manager.touchAction.update(),
+ this
+ },
+ recognizeWith: function(e) {
+ if (d(e, "recognizeWith", this))
+ return this;
+ var t = this.simultaneous;
+ return e = $(e, this),
+ t[e.id] || (t[e.id] = e,
+ e.recognizeWith(this)),
+ this
+ },
+ dropRecognizeWith: function(e) {
+ return d(e, "dropRecognizeWith", this) ? this : (e = $(e, this),
+ delete this.simultaneous[e.id],
+ this)
+ },
+ requireFailure: function(e) {
+ if (d(e, "requireFailure", this))
+ return this;
+ var t = this.requireFail;
+ return e = $(e, this),
+ -1 === w(t, e) && (t.push(e),
+ e.requireFailure(this)),
+ this
+ },
+ dropRequireFailure: function(e) {
+ if (d(e, "dropRequireFailure", this))
+ return this;
+ e = $(e, this);
+ var t = w(this.requireFail, e);
+ return t > -1 && this.requireFail.splice(t, 1),
+ this
+ },
+ hasRequireFailures: function() {
+ return this.requireFail.length > 0
+ },
+ canRecognizeWith: function(e) {
+ return !!this.simultaneous[e.id]
+ },
+ emit: function(e) {
+ function t(t) {
+ i.manager.emit(t, e)
+ }
+ var i = this
+ , o = this.state;
+ ft > o && t(i.options.event + Q(o)),
+ t(i.options.event),
+ e.additionalEvent && t(e.additionalEvent),
+ o >= ft && t(i.options.event + Q(o))
+ },
+ tryEmit: function(e) {
+ return this.canEmit() ? this.emit(e) : void (this.state = yt)
+ },
+ canEmit: function() {
+ for (var e = 0; e < this.requireFail.length; ) {
+ if (!(this.requireFail[e].state & (yt | lt)))
+ return !1;
+ e++
+ }
+ return !0
+ },
+ recognize: function(e) {
+ var t = ce({}, e);
+ return p(this.options.enable, [this, t]) ? (this.state & (pt | vt | yt) && (this.state = lt),
+ this.state = this.process(t),
+ void (this.state & (ct | ut | ft | vt) && this.tryEmit(t))) : (this.reset(),
+ void (this.state = yt))
+ },
+ process: function(e) {},
+ getTouchAction: function() {},
+ reset: function() {}
+ },
+ u(ee, Z, {
+ defaults: {
+ pointers: 1
+ },
+ attrTest: function(e) {
+ var t = this.options.pointers;
+ return 0 === t || e.pointers.length === t
+ },
+ process: function(e) {
+ var t = this.state
+ , i = e.eventType
+ , o = t & (ct | ut)
+ , n = this.attrTest(e);
+ return o && (i & Fe || !n) ? t | vt : o || n ? i & Be ? t | ft : t & ct ? t | ut : ct : yt
+ }
+ }),
+ u(te, ee, {
+ defaults: {
+ event: "pan",
+ threshold: 10,
+ pointers: 1,
+ direction: He
+ },
+ getTouchAction: function() {
+ var e = this.options.direction
+ , t = [];
+ return e & Ae && t.push(dt),
+ e & Le && t.push(ht),
+ t
+ },
+ directionTest: function(e) {
+ var t = this.options
+ , i = !0
+ , o = e.distance
+ , n = e.direction
+ , s = e.deltaX
+ , r = e.deltaY;
+ return n & t.direction || (t.direction & Ae ? (n = 0 === s ? Ie : 0 > s ? je : Ne,
+ i = s != this.pX,
+ o = Math.abs(e.deltaX)) : (n = 0 === r ? Ie : 0 > r ? ze : Re,
+ i = r != this.pY,
+ o = Math.abs(e.deltaY))),
+ e.direction = n,
+ i && o > t.threshold && n & t.direction
+ },
+ attrTest: function(e) {
+ return ee.prototype.attrTest.call(this, e) && (this.state & ct || !(this.state & ct) && this.directionTest(e))
+ },
+ emit: function(e) {
+ this.pX = e.deltaX,
+ this.pY = e.deltaY;
+ var t = J(e.direction);
+ t && (e.additionalEvent = this.options.event + t),
+ this._super.emit.call(this, e)
+ }
+ }),
+ u(ie, ee, {
+ defaults: {
+ event: "pinch",
+ threshold: 0,
+ pointers: 2
+ },
+ getTouchAction: function() {
+ return [at]
+ },
+ attrTest: function(e) {
+ return this._super.attrTest.call(this, e) && (Math.abs(e.scale - 1) > this.options.threshold || this.state & ct)
+ },
+ emit: function(e) {
+ if (1 !== e.scale) {
+ var t = e.scale < 1 ? "in" : "out";
+ e.additionalEvent = this.options.event + t
+ }
+ this._super.emit.call(this, e)
+ }
+ }),
+ u(oe, Z, {
+ defaults: {
+ event: "press",
+ pointers: 1,
+ time: 251,
+ threshold: 9
+ },
+ getTouchAction: function() {
+ return [st]
+ },
+ process: function(e) {
+ var t = this.options
+ , i = e.pointers.length === t.pointers
+ , o = e.distance < t.threshold
+ , n = e.deltaTime > t.time;
+ if (this._input = e,
+ !o || !i || e.eventType & (Be | Fe) && !n)
+ this.reset();
+ else if (e.eventType & Te)
+ this.reset(),
+ this._timer = h(function() {
+ this.state = pt,
+ this.tryEmit()
+ }, t.time, this);
+ else if (e.eventType & Be)
+ return pt;
+ return yt
+ },
+ reset: function() {
+ clearTimeout(this._timer)
+ },
+ emit: function(e) {
+ this.state === pt && (e && e.eventType & Be ? this.manager.emit(this.options.event + "up", e) : (this._input.timeStamp = ge(),
+ this.manager.emit(this.options.event, this._input)))
+ }
+ }),
+ u(ne, ee, {
+ defaults: {
+ event: "rotate",
+ threshold: 0,
+ pointers: 2
+ },
+ getTouchAction: function() {
+ return [at]
+ },
+ attrTest: function(e) {
+ return this._super.attrTest.call(this, e) && (Math.abs(e.rotation) > this.options.threshold || this.state & ct)
+ }
+ }),
+ u(se, ee, {
+ defaults: {
+ event: "swipe",
+ threshold: 10,
+ velocity: .3,
+ direction: Ae | Le,
+ pointers: 1
+ },
+ getTouchAction: function() {
+ return te.prototype.getTouchAction.call(this)
+ },
+ attrTest: function(e) {
+ var t, i = this.options.direction;
+ return i & (Ae | Le) ? t = e.overallVelocity : i & Ae ? t = e.overallVelocityX : i & Le && (t = e.overallVelocityY),
+ this._super.attrTest.call(this, e) && i & e.offsetDirection && e.distance > this.options.threshold && e.maxPointers == this.options.pointers && ye(t) > this.options.velocity && e.eventType & Be
+ },
+ emit: function(e) {
+ var t = J(e.offsetDirection);
+ t && this.manager.emit(this.options.event + t, e),
+ this.manager.emit(this.options.event, e)
+ }
+ }),
+ u(re, Z, {
+ defaults: {
+ event: "tap",
+ pointers: 1,
+ taps: 1,
+ interval: 300,
+ time: 250,
+ threshold: 9,
+ posThreshold: 10
+ },
+ getTouchAction: function() {
+ return [rt]
+ },
+ process: function(e) {
+ var t = this.options
+ , i = e.pointers.length === t.pointers
+ , o = e.distance < t.threshold
+ , n = e.deltaTime < t.time;
+ if (this.reset(),
+ e.eventType & Te && 0 === this.count)
+ return this.failTimeout();
+ if (o && n && i) {
+ if (e.eventType != Be)
+ return this.failTimeout();
+ var s = this.pTime ? e.timeStamp - this.pTime < t.interval : !0
+ , r = !this.pCenter || z(this.pCenter, e.center) < t.posThreshold;
+ this.pTime = e.timeStamp,
+ this.pCenter = e.center,
+ r && s ? this.count += 1 : this.count = 1,
+ this._input = e;
+ var a = this.count % t.taps;
+ if (0 === a)
+ return this.hasRequireFailures() ? (this._timer = h(function() {
+ this.state = pt,
+ this.tryEmit()
+ }, t.interval, this),
+ ct) : pt
+ }
+ return yt
+ },
+ failTimeout: function() {
+ return this._timer = h(function() {
+ this.state = yt
+ }, this.options.interval, this),
+ yt
+ },
+ reset: function() {
+ clearTimeout(this._timer)
+ },
+ emit: function() {
+ this.state == pt && (this._input.tapCount = this.count,
+ this.manager.emit(this.options.event, this._input))
+ }
+ }),
+ ae.VERSION = "2.0.6",
+ ae.defaults = {
+ domEvents: !1,
+ touchAction: nt,
+ enable: !0,
+ inputTarget: null,
+ inputClass: null,
+ preset: [[ne, {
+ enable: !1
+ }], [ie, {
+ enable: !1
+ }, ["rotate"]], [se, {
+ direction: Ae
+ }], [te, {
+ direction: Ae
+ }, ["swipe"]], [re], [re, {
+ event: "doubletap",
+ taps: 2
+ }, ["tap"]], [oe]],
+ cssProps: {
+ userSelect: "none",
+ touchSelect: "none",
+ touchCallout: "none",
+ contentZooming: "none",
+ userDrag: "none",
+ tapHighlightColor: "rgba(0,0,0,0)"
+ }
+ };
+ var gt = 1
+ , bt = 2;
+ he.prototype = {
+ set: function(e) {
+ return ce(this.options, e),
+ e.touchAction && this.touchAction.update(),
+ e.inputTarget && (this.input.destroy(),
+ this.input.target = e.inputTarget,
+ this.input.init()),
+ this
+ },
+ stop: function(e) {
+ this.session.stopped = e ? bt : gt
+ },
+ recognize: function(e) {
+ var t = this.session;
+ if (!t.stopped) {
+ this.touchAction.preventDefaults(e);
+ var i, o = this.recognizers, n = t.curRecognizer;
+ (!n || n && n.state & pt) && (n = t.curRecognizer = null);
+ for (var s = 0; s < o.length; )
+ i = o[s],
+ t.stopped === bt || n && i != n && !i.canRecognizeWith(n) ? i.reset() : i.recognize(e),
+ !n && i.state & (ct | ut | ft) && (n = t.curRecognizer = i),
+ s++
+ }
+ },
+ get: function(e) {
+ if (e instanceof Z)
+ return e;
+ for (var t = this.recognizers, i = 0; i < t.length; i++)
+ if (t[i].options.event == e)
+ return t[i];
+ return null
+ },
+ add: function(e) {
+ if (d(e, "add", this))
+ return this;
+ var t = this.get(e.options.event);
+ return t && this.remove(t),
+ this.recognizers.push(e),
+ e.manager = this,
+ this.touchAction.update(),
+ e
+ },
+ remove: function(e) {
+ if (d(e, "remove", this))
+ return this;
+ if (e = this.get(e)) {
+ var t = this.recognizers
+ , i = w(t, e);
+ -1 !== i && (t.splice(i, 1),
+ this.touchAction.update())
+ }
+ return this
+ },
+ on: function(e, t) {
+ var i = this.handlers;
+ return l(_(e), function(e) {
+ i[e] = i[e] || [],
+ i[e].push(t)
+ }),
+ this
+ },
+ off: function(e, t) {
+ var i = this.handlers;
+ return l(_(e), function(e) {
+ t ? i[e] && i[e].splice(w(i[e], t), 1) : delete i[e]
+ }),
+ this
+ },
+ emit: function(e, t) {
+ this.options.domEvents && le(e, t);
+ var i = this.handlers[e] && this.handlers[e].slice();
+ if (i && i.length) {
+ t.type = e,
+ t.preventDefault = function() {
+ t.srcEvent.preventDefault()
+ }
+ ;
+ for (var o = 0; o < i.length; )
+ i[o](t),
+ o++
+ }
+ },
+ destroy: function() {
+ this.element && de(this, !1),
+ this.handlers = {},
+ this.session = {},
+ this.input.destroy(),
+ this.element = null
+ }
+ },
+ ce(ae, {
+ INPUT_START: Te,
+ INPUT_MOVE: Pe,
+ INPUT_END: Be,
+ INPUT_CANCEL: Fe,
+ STATE_POSSIBLE: lt,
+ STATE_BEGAN: ct,
+ STATE_CHANGED: ut,
+ STATE_ENDED: ft,
+ STATE_RECOGNIZED: pt,
+ STATE_CANCELLED: vt,
+ STATE_FAILED: yt,
+ DIRECTION_NONE: Ie,
+ DIRECTION_LEFT: je,
+ DIRECTION_RIGHT: Ne,
+ DIRECTION_UP: ze,
+ DIRECTION_DOWN: Re,
+ DIRECTION_HORIZONTAL: Ae,
+ DIRECTION_VERTICAL: Le,
+ DIRECTION_ALL: He,
+ Manager: he,
+ Input: D,
+ TouchAction: X,
+ TouchInput: V,
+ MouseInput: H,
+ PointerEventInput: W,
+ TouchMouseInput: G,
+ SingleTouchInput: Y,
+ Recognizer: Z,
+ AttrRecognizer: ee,
+ Tap: re,
+ Pan: te,
+ Swipe: se,
+ Pinch: ie,
+ Rotate: ne,
+ Press: oe,
+ on: y,
+ off: g,
+ each: l,
+ merge: me,
+ extend: be,
+ assign: ce,
+ inherit: u,
+ bindFn: f,
+ prefixed: O
+ });
+ var mt = "undefined" != typeof n ? n : "undefined" != typeof self ? self : {};
+ mt.Hammer = ae,
+ o = function() {
+ return ae
+ }
+ .call(t, i, t, e),
+ !(o !== a && (e.exports = o))
+ }(window, document, "Hammer")
+ }
+ , function(e, t, i) {
+ i(58);
+ t.onTouch = function(e, t) {
+ t.inputHandler = function(e) {
+ e.isFirst && t(e)
+ }
+ ,
+ e.on("hammer.input", t.inputHandler)
+ }
+ ,
+ t.onRelease = function(e, t) {
+ return t.inputHandler = function(e) {
+ e.isFinal && t(e)
+ }
+ ,
+ e.on("hammer.input", t.inputHandler)
+ }
+ ,
+ t.offTouch = function(e, t) {
+ e.off("hammer.input", t.inputHandler)
+ }
+ ,
+ t.offRelease = t.offTouch,
+ t.disablePreventDefaultVertically = function(e) {
+ var t = "pan-y";
+ return e.getTouchAction = function() {
+ return [t]
+ }
+ ,
+ e
+ }
+ }
+ , function(e, t, i) {
+ function o(e) {
+ return e && e.__esModule ? e : {
+ "default": e
+ }
+ }
+ function n(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var s = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , r = i(54)
+ , a = o(r)
+ , h = i(1)
+ , d = function() {
+ function e(t, i) {
+ var o = this;
+ n(this, e),
+ this.body = t,
+ this.canvas = i,
+ this.animationSpeed = 1 / this.renderRefreshRate,
+ this.animationEasingFunction = "easeInOutQuint",
+ this.easingTime = 0,
+ this.sourceScale = 0,
+ this.targetScale = 0,
+ this.sourceTranslation = 0,
+ this.targetTranslation = 0,
+ this.lockedOnNodeId = void 0,
+ this.lockedOnNodeOffset = void 0,
+ this.touchTime = 0,
+ this.viewFunction = void 0,
+ this.body.emitter.on("fit", this.fit.bind(this)),
+ this.body.emitter.on("animationFinished", function() {
+ o.body.emitter.emit("_stopRendering")
+ }),
+ this.body.emitter.on("unlockNode", this.releaseNode.bind(this))
+ }
+ return s(e, [{
+ key: "setOptions",
+ value: function() {
+ var e = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0];
+ this.options = e
+ }
+ }, {
+ key: "fit",
+ value: function() {
+ var e = arguments.length <= 0 || void 0 === arguments[0] ? {
+ nodes: []
+ } : arguments[0]
+ , t = arguments.length <= 1 || void 0 === arguments[1] ? !1 : arguments[1]
+ , i = void 0
+ , o = void 0;
+ if (void 0 !== e.nodes && 0 !== e.nodes.length || (e.nodes = this.body.nodeIndices),
+ t === !0) {
+ var n = 0;
+ for (var s in this.body.nodes)
+ if (this.body.nodes.hasOwnProperty(s)) {
+ var r = this.body.nodes[s];
+ r.predefinedPosition === !0 && (n += 1)
+ }
+ if (n > .5 * this.body.nodeIndices.length)
+ return void this.fit(e, !1);
+ i = a["default"].getRange(this.body.nodes, e.nodes);
+ var h = this.body.nodeIndices.length;
+ o = 12.662 / (h + 7.4147) + .0964822;
+ var d = Math.min(this.canvas.frame.canvas.clientWidth / 600, this.canvas.frame.canvas.clientHeight / 600);
+ o *= d
+ } else {
+ this.body.emitter.emit("_resizeNodes"),
+ i = a["default"].getRange(this.body.nodes, e.nodes);
+ var l = 1.1 * Math.abs(i.maxX - i.minX)
+ , c = 1.1 * Math.abs(i.maxY - i.minY)
+ , u = this.canvas.frame.canvas.clientWidth / l
+ , f = this.canvas.frame.canvas.clientHeight / c;
+ o = f >= u ? u : f
+ }
+ o > 1 ? o = 1 : 0 === o && (o = 1);
+ var p = a["default"].findCenter(i)
+ , v = {
+ position: p,
+ scale: o,
+ animation: e.animation
+ };
+ this.moveTo(v)
+ }
+ }, {
+ key: "focus",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1];
+ if (void 0 !== this.body.nodes[e]) {
+ var i = {
+ x: this.body.nodes[e].x,
+ y: this.body.nodes[e].y
+ };
+ t.position = i,
+ t.lockedOnNode = e,
+ this.moveTo(t)
+ } else
+ console.log("Node: " + e + " cannot be found.")
+ }
+ }, {
+ key: "moveTo",
+ value: function(e) {
+ return void 0 === e ? void (e = {}) : (void 0 === e.offset && (e.offset = {
+ x: 0,
+ y: 0
+ }),
+ void 0 === e.offset.x && (e.offset.x = 0),
+ void 0 === e.offset.y && (e.offset.y = 0),
+ void 0 === e.scale && (e.scale = this.body.view.scale),
+ void 0 === e.position && (e.position = this.getViewPosition()),
+ void 0 === e.animation && (e.animation = {
+ duration: 0
+ }),
+ e.animation === !1 && (e.animation = {
+ duration: 0
+ }),
+ e.animation === !0 && (e.animation = {}),
+ void 0 === e.animation.duration && (e.animation.duration = 1e3),
+ void 0 === e.animation.easingFunction && (e.animation.easingFunction = "easeInOutQuad"),
+ void this.animateView(e))
+ }
+ }, {
+ key: "animateView",
+ value: function(e) {
+ if (void 0 !== e) {
+ this.animationEasingFunction = e.animation.easingFunction,
+ this.releaseNode(),
+ e.locked === !0 && (this.lockedOnNodeId = e.lockedOnNode,
+ this.lockedOnNodeOffset = e.offset),
+ 0 != this.easingTime && this._transitionRedraw(!0),
+ this.sourceScale = this.body.view.scale,
+ this.sourceTranslation = this.body.view.translation,
+ this.targetScale = e.scale,
+ this.body.view.scale = this.targetScale;
+ var t = this.canvas.DOMtoCanvas({
+ x: .5 * this.canvas.frame.canvas.clientWidth,
+ y: .5 * this.canvas.frame.canvas.clientHeight
+ })
+ , i = {
+ x: t.x - e.position.x,
+ y: t.y - e.position.y
+ };
+ this.targetTranslation = {
+ x: this.sourceTranslation.x + i.x * this.targetScale + e.offset.x,
+ y: this.sourceTranslation.y + i.y * this.targetScale + e.offset.y
+ },
+ 0 === e.animation.duration ? void 0 != this.lockedOnNodeId ? (this.viewFunction = this._lockedRedraw.bind(this),
+ this.body.emitter.on("initRedraw", this.viewFunction)) : (this.body.view.scale = this.targetScale,
+ this.body.view.translation = this.targetTranslation,
+ this.body.emitter.emit("_requestRedraw")) : (this.animationSpeed = 1 / (60 * e.animation.duration * .001) || 1 / 60,
+ this.animationEasingFunction = e.animation.easingFunction,
+ this.viewFunction = this._transitionRedraw.bind(this),
+ this.body.emitter.on("initRedraw", this.viewFunction),
+ this.body.emitter.emit("_startRendering"))
+ }
+ }
+ }, {
+ key: "_lockedRedraw",
+ value: function() {
+ var e = {
+ x: this.body.nodes[this.lockedOnNodeId].x,
+ y: this.body.nodes[this.lockedOnNodeId].y
+ }
+ , t = this.canvas.DOMtoCanvas({
+ x: .5 * this.canvas.frame.canvas.clientWidth,
+ y: .5 * this.canvas.frame.canvas.clientHeight
+ })
+ , i = {
+ x: t.x - e.x,
+ y: t.y - e.y
+ }
+ , o = this.body.view.translation
+ , n = {
+ x: o.x + i.x * this.body.view.scale + this.lockedOnNodeOffset.x,
+ y: o.y + i.y * this.body.view.scale + this.lockedOnNodeOffset.y
+ };
+ this.body.view.translation = n
+ }
+ }, {
+ key: "releaseNode",
+ value: function() {
+ void 0 !== this.lockedOnNodeId && void 0 !== this.viewFunction && (this.body.emitter.off("initRedraw", this.viewFunction),
+ this.lockedOnNodeId = void 0,
+ this.lockedOnNodeOffset = void 0)
+ }
+ }, {
+ key: "_transitionRedraw",
+ value: function() {
+ var e = arguments.length <= 0 || void 0 === arguments[0] ? !1 : arguments[0];
+ this.easingTime += this.animationSpeed,
+ this.easingTime = e === !0 ? 1 : this.easingTime;
+ var t = h.easingFunctions[this.animationEasingFunction](this.easingTime);
+ this.body.view.scale = this.sourceScale + (this.targetScale - this.sourceScale) * t,
+ this.body.view.translation = {
+ x: this.sourceTranslation.x + (this.targetTranslation.x - this.sourceTranslation.x) * t,
+ y: this.sourceTranslation.y + (this.targetTranslation.y - this.sourceTranslation.y) * t
+ },
+ this.easingTime >= 1 && (this.body.emitter.off("initRedraw", this.viewFunction),
+ this.easingTime = 0,
+ void 0 != this.lockedOnNodeId && (this.viewFunction = this._lockedRedraw.bind(this),
+ this.body.emitter.on("initRedraw", this.viewFunction)),
+ this.body.emitter.emit("animationFinished"))
+ }
+ }, {
+ key: "getScale",
+ value: function() {
+ return this.body.view.scale
+ }
+ }, {
+ key: "getViewPosition",
+ value: function() {
+ return this.canvas.DOMtoCanvas({
+ x: .5 * this.canvas.frame.canvas.clientWidth,
+ y: .5 * this.canvas.frame.canvas.clientHeight
+ })
+ }
+ }]),
+ e
+ }();
+ t["default"] = d
+ }
+ , function(e, t, i) {
+ function o(e) {
+ return e && e.__esModule ? e : {
+ "default": e
+ }
+ }
+ function n(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var s = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , r = i(64)
+ , a = o(r)
+ , h = i(66)
+ , d = o(h)
+ , l = i(1)
+ , c = function() {
+ function e(t, i, o) {
+ n(this, e),
+ this.body = t,
+ this.canvas = i,
+ this.selectionHandler = o,
+ this.navigationHandler = new a["default"](t,i),
+ this.body.eventListeners.onTap = this.onTap.bind(this),
+ this.body.eventListeners.onTouch = this.onTouch.bind(this),
+ this.body.eventListeners.onDoubleTap = this.onDoubleTap.bind(this),
+ this.body.eventListeners.onHold = this.onHold.bind(this),
+ this.body.eventListeners.onDragStart = this.onDragStart.bind(this),
+ this.body.eventListeners.onDrag = this.onDrag.bind(this),
+ this.body.eventListeners.onDragEnd = this.onDragEnd.bind(this),
+ this.body.eventListeners.onMouseWheel = this.onMouseWheel.bind(this),
+ this.body.eventListeners.onPinch = this.onPinch.bind(this),
+ this.body.eventListeners.onMouseMove = this.onMouseMove.bind(this),
+ this.body.eventListeners.onRelease = this.onRelease.bind(this),
+ this.body.eventListeners.onContext = this.onContext.bind(this),
+ this.touchTime = 0,
+ this.drag = {},
+ this.pinch = {},
+ this.popup = void 0,
+ this.popupObj = void 0,
+ this.popupTimer = void 0,
+ this.body.functions.getPointer = this.getPointer.bind(this),
+ this.options = {},
+ this.defaultOptions = {
+ dragNodes: !0,
+ dragView: !0,
+ hover: !1,
+ keyboard: {
+ enabled: !1,
+ speed: {
+ x: 10,
+ y: 10,
+ zoom: .02
+ },
+ bindToWindow: !0
+ },
+ navigationButtons: !1,
+ tooltipDelay: 300,
+ zoomView: !0
+ },
+ l.extend(this.options, this.defaultOptions),
+ this.bindEventListeners()
+ }
+ return s(e, [{
+ key: "bindEventListeners",
+ value: function() {
+ var e = this;
+ this.body.emitter.on("destroy", function() {
+ clearTimeout(e.popupTimer),
+ delete e.body.functions.getPointer
+ })
+ }
+ }, {
+ key: "setOptions",
+ value: function(e) {
+ if (void 0 !== e) {
+ var t = ["hideEdgesOnDrag", "hideNodesOnDrag", "keyboard", "multiselect", "selectable", "selectConnectedEdges"];
+ l.selectiveNotDeepExtend(t, this.options, e),
+ l.mergeOptions(this.options, e, "keyboard"),
+ e.tooltip && (l.extend(this.options.tooltip, e.tooltip),
+ e.tooltip.color && (this.options.tooltip.color = l.parseColor(e.tooltip.color)))
+ }
+ this.navigationHandler.setOptions(this.options)
+ }
+ }, {
+ key: "getPointer",
+ value: function(e) {
+ return {
+ x: e.x - l.getAbsoluteLeft(this.canvas.frame.canvas),
+ y: e.y - l.getAbsoluteTop(this.canvas.frame.canvas)
+ }
+ }
+ }, {
+ key: "onTouch",
+ value: function(e) {
+ (new Date).valueOf() - this.touchTime > 50 && (this.drag.pointer = this.getPointer(e.center),
+ this.drag.pinched = !1,
+ this.pinch.scale = this.body.view.scale,
+ this.touchTime = (new Date).valueOf())
+ }
+ }, {
+ key: "onTap",
+ value: function(e) {
+ var t = this.getPointer(e.center)
+ , i = this.selectionHandler.options.multiselect && (e.changedPointers[0].ctrlKey || e.changedPointers[0].metaKey);
+ this.checkSelectionChanges(t, e, i),
+ this.selectionHandler._generateClickEvent("click", e, t)
+ }
+ }, {
+ key: "onDoubleTap",
+ value: function(e) {
+ var t = this.getPointer(e.center);
+ this.selectionHandler._generateClickEvent("doubleClick", e, t)
+ }
+ }, {
+ key: "onHold",
+ value: function(e) {
+ var t = this.getPointer(e.center)
+ , i = this.selectionHandler.options.multiselect;
+ this.checkSelectionChanges(t, e, i),
+ this.selectionHandler._generateClickEvent("click", e, t),
+ this.selectionHandler._generateClickEvent("hold", e, t)
+ }
+ }, {
+ key: "onRelease",
+ value: function(e) {
+ if ((new Date).valueOf() - this.touchTime > 10) {
+ var t = this.getPointer(e.center);
+ this.selectionHandler._generateClickEvent("release", e, t),
+ this.touchTime = (new Date).valueOf()
+ }
+ }
+ }, {
+ key: "onContext",
+ value: function(e) {
+ var t = this.getPointer({
+ x: e.clientX,
+ y: e.clientY
+ });
+ this.selectionHandler._generateClickEvent("oncontext", e, t)
+ }
+ }, {
+ key: "checkSelectionChanges",
+ value: function(e, t) {
+ var i = arguments.length <= 2 || void 0 === arguments[2] ? !1 : arguments[2]
+ , o = this.selectionHandler._getSelectedEdgeCount()
+ , n = this.selectionHandler._getSelectedNodeCount()
+ , s = this.selectionHandler.getSelection()
+ , r = void 0;
+ r = i === !0 ? this.selectionHandler.selectAdditionalOnPoint(e) : this.selectionHandler.selectOnPoint(e);
+ var a = this.selectionHandler._getSelectedEdgeCount()
+ , h = this.selectionHandler._getSelectedNodeCount()
+ , d = this.selectionHandler.getSelection()
+ , l = this._determineIfDifferent(s, d)
+ , c = l.nodesChanged
+ , u = l.edgesChanged
+ , f = !1;
+ h - n > 0 ? (this.selectionHandler._generateClickEvent("selectNode", t, e),
+ r = !0,
+ f = !0) : c === !0 && h > 0 ? (this.selectionHandler._generateClickEvent("deselectNode", t, e, s),
+ this.selectionHandler._generateClickEvent("selectNode", t, e),
+ f = !0,
+ r = !0) : 0 > h - n && (this.selectionHandler._generateClickEvent("deselectNode", t, e, s),
+ r = !0),
+ a - o > 0 && f === !1 ? (this.selectionHandler._generateClickEvent("selectEdge", t, e),
+ r = !0) : a > 0 && u === !0 ? (this.selectionHandler._generateClickEvent("deselectEdge", t, e, s),
+ this.selectionHandler._generateClickEvent("selectEdge", t, e),
+ r = !0) : 0 > a - o && (this.selectionHandler._generateClickEvent("deselectEdge", t, e, s),
+ r = !0),
+ r === !0 && this.selectionHandler._generateClickEvent("select", t, e)
+ }
+ }, {
+ key: "_determineIfDifferent",
+ value: function(e, t) {
+ for (var i = !1, o = !1, n = 0; n < e.nodes.length; n++)
+ -1 === t.nodes.indexOf(e.nodes[n]) && (i = !0);
+ for (var s = 0; s < t.nodes.length; s++)
+ -1 === e.nodes.indexOf(e.nodes[s]) && (i = !0);
+ for (var r = 0; r < e.edges.length; r++)
+ -1 === t.edges.indexOf(e.edges[r]) && (o = !0);
+ for (var a = 0; a < t.edges.length; a++)
+ -1 === e.edges.indexOf(e.edges[a]) && (o = !0);
+ return {
+ nodesChanged: i,
+ edgesChanged: o
+ }
+ }
+ }, {
+ key: "onDragStart",
+ value: function(e) {
+ void 0 === this.drag.pointer && this.onTouch(e);
+ var t = this.selectionHandler.getNodeAt(this.drag.pointer);
+ if (this.drag.dragging = !0,
+ this.drag.selection = [],
+ this.drag.translation = l.extend({}, this.body.view.translation),
+ this.drag.nodeId = void 0,
+ void 0 !== t && this.options.dragNodes === !0) {
+ this.drag.nodeId = t.id,
+ t.isSelected() === !1 && (this.selectionHandler.unselectAll(),
+ this.selectionHandler.selectObject(t)),
+ this.selectionHandler._generateClickEvent("dragStart", e, this.drag.pointer);
+ var i = this.selectionHandler.selectionObj.nodes;
+ for (var o in i)
+ if (i.hasOwnProperty(o)) {
+ var n = i[o]
+ , s = {
+ id: n.id,
+ node: n,
+ x: n.x,
+ y: n.y,
+ xFixed: n.options.fixed.x,
+ yFixed: n.options.fixed.y
+ };
+ n.options.fixed.x = !0,
+ n.options.fixed.y = !0,
+ this.drag.selection.push(s)
+ }
+ } else
+ this.selectionHandler._generateClickEvent("dragStart", e, this.drag.pointer, void 0, !0)
+ }
+ }, {
+ key: "onDrag",
+ value: function(e) {
+ var t = this;
+ if (this.drag.pinched !== !0) {
+ this.body.emitter.emit("unlockNode");
+ var i = this.getPointer(e.center)
+ , o = this.drag.selection;
+ if (o && o.length && this.options.dragNodes === !0)
+ !function() {
+ t.selectionHandler._generateClickEvent("dragging", e, i);
+ var n = i.x - t.drag.pointer.x
+ , s = i.y - t.drag.pointer.y;
+ o.forEach(function(e) {
+ var i = e.node;
+ e.xFixed === !1 && (i.x = t.canvas._XconvertDOMtoCanvas(t.canvas._XconvertCanvasToDOM(e.x) + n)),
+ e.yFixed === !1 && (i.y = t.canvas._YconvertDOMtoCanvas(t.canvas._YconvertCanvasToDOM(e.y) + s))
+ }),
+ t.body.emitter.emit("startSimulation")
+ }();
+ else if (this.options.dragView === !0) {
+ if (this.selectionHandler._generateClickEvent("dragging", e, i, void 0, !0),
+ void 0 === this.drag.pointer)
+ return void this.onDragStart(e);
+ var n = i.x - this.drag.pointer.x
+ , s = i.y - this.drag.pointer.y;
+ this.body.view.translation = {
+ x: this.drag.translation.x + n,
+ y: this.drag.translation.y + s
+ },
+ this.body.emitter.emit("_redraw")
+ }
+ }
+ }
+ }, {
+ key: "onDragEnd",
+ value: function(e) {
+ this.drag.dragging = !1;
+ var t = this.drag.selection;
+ t && t.length ? (t.forEach(function(e) {
+ e.node.options.fixed.x = e.xFixed,
+ e.node.options.fixed.y = e.yFixed
+ }),
+ this.selectionHandler._generateClickEvent("dragEnd", e, this.getPointer(e.center)),
+ this.body.emitter.emit("startSimulation")) : (this.selectionHandler._generateClickEvent("dragEnd", e, this.getPointer(e.center), void 0, !0),
+ this.body.emitter.emit("_requestRedraw"))
+ }
+ }, {
+ key: "onPinch",
+ value: function(e) {
+ var t = this.getPointer(e.center);
+ this.drag.pinched = !0,
+ void 0 === this.pinch.scale && (this.pinch.scale = 1);
+ var i = this.pinch.scale * e.scale;
+ this.zoom(i, t)
+ }
+ }, {
+ key: "zoom",
+ value: function(e, t) {
+ if (this.options.zoomView === !0) {
+ var i = this.body.view.scale;
+ 1e-5 > e && (e = 1e-5),
+ e > 10 && (e = 10);
+ var o = void 0;
+ void 0 !== this.drag && this.drag.dragging === !0 && (o = this.canvas.DOMtoCanvas(this.drag.pointer));
+ var n = this.body.view.translation
+ , s = e / i
+ , r = (1 - s) * t.x + n.x * s
+ , a = (1 - s) * t.y + n.y * s;
+ if (this.body.view.scale = e,
+ this.body.view.translation = {
+ x: r,
+ y: a
+ },
+ void 0 != o) {
+ var h = this.canvas.canvasToDOM(o);
+ this.drag.pointer.x = h.x,
+ this.drag.pointer.y = h.y
+ }
+ this.body.emitter.emit("_requestRedraw"),
+ e > i ? this.body.emitter.emit("zoom", {
+ direction: "+",
+ scale: this.body.view.scale
+ }) : this.body.emitter.emit("zoom", {
+ direction: "-",
+ scale: this.body.view.scale
+ })
+ }
+ }
+ }, {
+ key: "onMouseWheel",
+ value: function(e) {
+ if (this.options.zoomView === !0) {
+ var t = 0;
+ if (e.wheelDelta ? t = e.wheelDelta / 120 : e.detail && (t = -e.detail / 3),
+ 0 !== t) {
+ var i = this.body.view.scale
+ , o = t / 10;
+ 0 > t && (o /= 1 - o),
+ i *= 1 + o;
+ var n = this.getPointer({
+ x: e.clientX,
+ y: e.clientY
+ });
+ this.zoom(i, n)
+ }
+ e.preventDefault()
+ }
+ }
+ }, {
+ key: "onMouseMove",
+ value: function(e) {
+ var t = this
+ , i = this.getPointer({
+ x: e.clientX,
+ y: e.clientY
+ })
+ , o = !1;
+ if (void 0 !== this.popup && (this.popup.hidden === !1 && this._checkHidePopup(i),
+ this.popup.hidden === !1 && (o = !0,
+ this.popup.setPosition(i.x + 3, i.y - 5),
+ this.popup.show())),
+ this.options.keyboard.bindToWindow === !1 && this.options.keyboard.enabled === !0 && this.canvas.frame.focus(),
+ o === !1 && (void 0 !== this.popupTimer && (clearInterval(this.popupTimer),
+ this.popupTimer = void 0),
+ this.drag.dragging || (this.popupTimer = setTimeout(function() {
+ return t._checkShowPopup(i)
+ }, this.options.tooltipDelay))),
+ this.options.hover === !0) {
+ var n = this.selectionHandler.getNodeAt(i);
+ void 0 === n && (n = this.selectionHandler.getEdgeAt(i)),
+ this.selectionHandler.hoverObject(n)
+ }
+ }
+ }, {
+ key: "_checkShowPopup",
+ value: function(e) {
+ var t = this.canvas._XconvertDOMtoCanvas(e.x)
+ , i = this.canvas._YconvertDOMtoCanvas(e.y)
+ , o = {
+ left: t,
+ top: i,
+ right: t,
+ bottom: i
+ }
+ , n = void 0 === this.popupObj ? void 0 : this.popupObj.id
+ , s = !1
+ , r = "node";
+ if (void 0 === this.popupObj) {
+ for (var a = this.body.nodeIndices, h = this.body.nodes, l = void 0, c = [], u = 0; u < a.length; u++)
+ l = h[a[u]],
+ l.isOverlappingWith(o) === !0 && void 0 !== l.getTitle() && c.push(a[u]);
+ c.length > 0 && (this.popupObj = h[c[c.length - 1]],
+ s = !0)
+ }
+ if (void 0 === this.popupObj && s === !1) {
+ for (var f = this.body.edgeIndices, p = this.body.edges, v = void 0, y = [], g = 0; g < f.length; g++)
+ v = p[f[g]],
+ v.isOverlappingWith(o) === !0 && v.connected === !0 && void 0 !== v.getTitle() && y.push(f[g]);
+ y.length > 0 && (this.popupObj = p[y[y.length - 1]],
+ r = "edge")
+ }
+ void 0 !== this.popupObj ? this.popupObj.id !== n && (void 0 === this.popup && (this.popup = new d["default"](this.canvas.frame)),
+ this.popup.popupTargetType = r,
+ this.popup.popupTargetId = this.popupObj.id,
+ this.popup.setPosition(e.x + 3, e.y - 5),
+ this.popup.setText(this.popupObj.getTitle()),
+ this.popup.show(),
+ this.body.emitter.emit("showPopup", this.popupObj.id)) : void 0 !== this.popup && (this.popup.hide(),
+ this.body.emitter.emit("hidePopup"))
+ }
+ }, {
+ key: "_checkHidePopup",
+ value: function(e) {
+ var t = this.selectionHandler._pointerToPositionObject(e)
+ , i = !1;
+ if ("node" === this.popup.popupTargetType) {
+ if (void 0 !== this.body.nodes[this.popup.popupTargetId] && (i = this.body.nodes[this.popup.popupTargetId].isOverlappingWith(t),
+ i === !0)) {
+ var o = this.selectionHandler.getNodeAt(e);
+ i = o.id === this.popup.popupTargetId
+ }
+ } else
+ void 0 === this.selectionHandler.getNodeAt(e) && void 0 !== this.body.edges[this.popup.popupTargetId] && (i = this.body.edges[this.popup.popupTargetId].isOverlappingWith(t));
+ i === !1 && (this.popupObj = void 0,
+ this.popup.hide(),
+ this.body.emitter.emit("hidePopup"))
+ }
+ }]),
+ e
+ }();
+ t["default"] = c
+ }
+ , function(e, t, i) {
+ function o(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var n = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , s = (i(1),
+ i(58))
+ , r = i(61)
+ , a = i(65)
+ , h = function() {
+ function e(t, i) {
+ var n = this;
+ o(this, e),
+ this.body = t,
+ this.canvas = i,
+ this.iconsCreated = !1,
+ this.navigationHammers = [],
+ this.boundFunctions = {},
+ this.touchTime = 0,
+ this.activated = !1,
+ this.body.emitter.on("activate", function() {
+ n.activated = !0,
+ n.configureKeyboardBindings()
+ }),
+ this.body.emitter.on("deactivate", function() {
+ n.activated = !1,
+ n.configureKeyboardBindings()
+ }),
+ this.body.emitter.on("destroy", function() {
+ void 0 !== n.keycharm && n.keycharm.destroy()
+ }),
+ this.options = {}
+ }
+ return n(e, [{
+ key: "setOptions",
+ value: function(e) {
+ void 0 !== e && (this.options = e,
+ this.create())
+ }
+ }, {
+ key: "create",
+ value: function() {
+ this.options.navigationButtons === !0 ? this.iconsCreated === !1 && this.loadNavigationElements() : this.iconsCreated === !0 && this.cleanNavigation(),
+ this.configureKeyboardBindings()
+ }
+ }, {
+ key: "cleanNavigation",
+ value: function() {
+ if (0 != this.navigationHammers.length) {
+ for (var e = 0; e < this.navigationHammers.length; e++)
+ this.navigationHammers[e].destroy();
+ this.navigationHammers = []
+ }
+ this.navigationDOM && this.navigationDOM.wrapper && this.navigationDOM.wrapper.parentNode && this.navigationDOM.wrapper.parentNode.removeChild(this.navigationDOM.wrapper),
+ this.iconsCreated = !1
+ }
+ }, {
+ key: "loadNavigationElements",
+ value: function() {
+ var e = this;
+ this.cleanNavigation(),
+ this.navigationDOM = {};
+ var t = ["up", "down", "left", "right", "zoomIn", "zoomOut", "zoomExtends"]
+ , i = ["_moveUp", "_moveDown", "_moveLeft", "_moveRight", "_zoomIn", "_zoomOut", "_fit"];
+ this.navigationDOM.wrapper = document.createElement("div"),
+ this.navigationDOM.wrapper.className = "vis-navigation",
+ this.canvas.frame.appendChild(this.navigationDOM.wrapper);
+ for (var o = 0; o < t.length; o++) {
+ this.navigationDOM[t[o]] = document.createElement("div"),
+ this.navigationDOM[t[o]].className = "vis-button vis-" + t[o],
+ this.navigationDOM.wrapper.appendChild(this.navigationDOM[t[o]]);
+ var n = new s(this.navigationDOM[t[o]]);
+ "_fit" === i[o] ? r.onTouch(n, this._fit.bind(this)) : r.onTouch(n, this.bindToRedraw.bind(this, i[o])),
+ this.navigationHammers.push(n)
+ }
+ var a = new s(this.canvas.frame);
+ r.onRelease(a, function() {
+ e._stopMovement()
+ }),
+ this.navigationHammers.push(a),
+ this.iconsCreated = !0
+ }
+ }, {
+ key: "bindToRedraw",
+ value: function(e) {
+ void 0 === this.boundFunctions[e] && (this.boundFunctions[e] = this[e].bind(this),
+ this.body.emitter.on("initRedraw", this.boundFunctions[e]),
+ this.body.emitter.emit("_startRendering"))
+ }
+ }, {
+ key: "unbindFromRedraw",
+ value: function(e) {
+ void 0 !== this.boundFunctions[e] && (this.body.emitter.off("initRedraw", this.boundFunctions[e]),
+ this.body.emitter.emit("_stopRendering"),
+ delete this.boundFunctions[e])
+ }
+ }, {
+ key: "_fit",
+ value: function() {
+ (new Date).valueOf() - this.touchTime > 700 && (this.body.emitter.emit("fit", {
+ duration: 700
+ }),
+ this.touchTime = (new Date).valueOf())
+ }
+ }, {
+ key: "_stopMovement",
+ value: function() {
+ for (var e in this.boundFunctions)
+ this.boundFunctions.hasOwnProperty(e) && (this.body.emitter.off("initRedraw", this.boundFunctions[e]),
+ this.body.emitter.emit("_stopRendering"));
+ this.boundFunctions = {}
+ }
+ }, {
+ key: "_moveUp",
+ value: function() {
+ this.body.view.translation.y += this.options.keyboard.speed.y
+ }
+ }, {
+ key: "_moveDown",
+ value: function() {
+ this.body.view.translation.y -= this.options.keyboard.speed.y
+ }
+ }, {
+ key: "_moveLeft",
+ value: function() {
+ this.body.view.translation.x += this.options.keyboard.speed.x
+ }
+ }, {
+ key: "_moveRight",
+ value: function() {
+ this.body.view.translation.x -= this.options.keyboard.speed.x
+ }
+ }, {
+ key: "_zoomIn",
+ value: function() {
+ this.body.view.scale *= 1 + this.options.keyboard.speed.zoom,
+ this.body.emitter.emit("zoom", {
+ direction: "+",
+ scale: this.body.view.scale
+ })
+ }
+ }, {
+ key: "_zoomOut",
+ value: function() {
+ this.body.view.scale /= 1 + this.options.keyboard.speed.zoom,
+ this.body.emitter.emit("zoom", {
+ direction: "-",
+ scale: this.body.view.scale
+ })
+ }
+ }, {
+ key: "configureKeyboardBindings",
+ value: function() {
+ var e = this;
+ void 0 !== this.keycharm && this.keycharm.destroy(),
+ this.options.keyboard.enabled === !0 && (this.options.keyboard.bindToWindow === !0 ? this.keycharm = a({
+ container: window,
+ preventDefault: !0
+ }) : this.keycharm = a({
+ container: this.canvas.frame,
+ preventDefault: !0
+ }),
+ this.keycharm.reset(),
+ this.activated === !0 && (this.keycharm.bind("up", function() {
+ e.bindToRedraw("_moveUp")
+ }, "keydown"),
+ this.keycharm.bind("down", function() {
+ e.bindToRedraw("_moveDown")
+ }, "keydown"),
+ this.keycharm.bind("left", function() {
+ e.bindToRedraw("_moveLeft")
+ }, "keydown"),
+ this.keycharm.bind("right", function() {
+ e.bindToRedraw("_moveRight")
+ }, "keydown"),
+ this.keycharm.bind("=", function() {
+ e.bindToRedraw("_zoomIn")
+ }, "keydown"),
+ this.keycharm.bind("num+", function() {
+ e.bindToRedraw("_zoomIn")
+ }, "keydown"),
+ this.keycharm.bind("num-", function() {
+ e.bindToRedraw("_zoomOut")
+ }, "keydown"),
+ this.keycharm.bind("-", function() {
+ e.bindToRedraw("_zoomOut")
+ }, "keydown"),
+ this.keycharm.bind("[", function() {
+ e.bindToRedraw("_zoomOut")
+ }, "keydown"),
+ this.keycharm.bind("]", function() {
+ e.bindToRedraw("_zoomIn")
+ }, "keydown"),
+ this.keycharm.bind("pageup", function() {
+ e.bindToRedraw("_zoomIn")
+ }, "keydown"),
+ this.keycharm.bind("pagedown", function() {
+ e.bindToRedraw("_zoomOut")
+ }, "keydown"),
+ this.keycharm.bind("up", function() {
+ e.unbindFromRedraw("_moveUp")
+ }, "keyup"),
+ this.keycharm.bind("down", function() {
+ e.unbindFromRedraw("_moveDown")
+ }, "keyup"),
+ this.keycharm.bind("left", function() {
+ e.unbindFromRedraw("_moveLeft")
+ }, "keyup"),
+ this.keycharm.bind("right", function() {
+ e.unbindFromRedraw("_moveRight")
+ }, "keyup"),
+ this.keycharm.bind("=", function() {
+ e.unbindFromRedraw("_zoomIn")
+ }, "keyup"),
+ this.keycharm.bind("num+", function() {
+ e.unbindFromRedraw("_zoomIn")
+ }, "keyup"),
+ this.keycharm.bind("num-", function() {
+ e.unbindFromRedraw("_zoomOut")
+ }, "keyup"),
+ this.keycharm.bind("-", function() {
+ e.unbindFromRedraw("_zoomOut")
+ }, "keyup"),
+ this.keycharm.bind("[", function() {
+ e.unbindFromRedraw("_zoomOut")
+ }, "keyup"),
+ this.keycharm.bind("]", function() {
+ e.unbindFromRedraw("_zoomIn")
+ }, "keyup"),
+ this.keycharm.bind("pageup", function() {
+ e.unbindFromRedraw("_zoomIn")
+ }, "keyup"),
+ this.keycharm.bind("pagedown", function() {
+ e.unbindFromRedraw("_zoomOut")
+ }, "keyup")))
+ }
+ }]),
+ e
+ }();
+ t["default"] = h
+ }
+ , function(e, t, i) {
+ var o, n, s;
+ !function(i, r) {
+ n = [],
+ o = r,
+ s = "function" == typeof o ? o.apply(t, n) : o,
+ !(void 0 !== s && (e.exports = s))
+ }(this, function() {
+ function e(e) {
+ var t, i = e && e.preventDefault || !1, o = e && e.container || window, n = {}, s = {
+ keydown: {},
+ keyup: {}
+ }, r = {};
+ for (t = 97; 122 >= t; t++)
+ r[String.fromCharCode(t)] = {
+ code: 65 + (t - 97),
+ shift: !1
+ };
+ for (t = 65; 90 >= t; t++)
+ r[String.fromCharCode(t)] = {
+ code: t,
+ shift: !0
+ };
+ for (t = 0; 9 >= t; t++)
+ r["" + t] = {
+ code: 48 + t,
+ shift: !1
+ };
+ for (t = 1; 12 >= t; t++)
+ r["F" + t] = {
+ code: 111 + t,
+ shift: !1
+ };
+ for (t = 0; 9 >= t; t++)
+ r["num" + t] = {
+ code: 96 + t,
+ shift: !1
+ };
+ r["num*"] = {
+ code: 106,
+ shift: !1
+ },
+ r["num+"] = {
+ code: 107,
+ shift: !1
+ },
+ r["num-"] = {
+ code: 109,
+ shift: !1
+ },
+ r["num/"] = {
+ code: 111,
+ shift: !1
+ },
+ r["num."] = {
+ code: 110,
+ shift: !1
+ },
+ r.left = {
+ code: 37,
+ shift: !1
+ },
+ r.up = {
+ code: 38,
+ shift: !1
+ },
+ r.right = {
+ code: 39,
+ shift: !1
+ },
+ r.down = {
+ code: 40,
+ shift: !1
+ },
+ r.space = {
+ code: 32,
+ shift: !1
+ },
+ r.enter = {
+ code: 13,
+ shift: !1
+ },
+ r.shift = {
+ code: 16,
+ shift: void 0
+ },
+ r.esc = {
+ code: 27,
+ shift: !1
+ },
+ r.backspace = {
+ code: 8,
+ shift: !1
+ },
+ r.tab = {
+ code: 9,
+ shift: !1
+ },
+ r.ctrl = {
+ code: 17,
+ shift: !1
+ },
+ r.alt = {
+ code: 18,
+ shift: !1
+ },
+ r["delete"] = {
+ code: 46,
+ shift: !1
+ },
+ r.pageup = {
+ code: 33,
+ shift: !1
+ },
+ r.pagedown = {
+ code: 34,
+ shift: !1
+ },
+ r["="] = {
+ code: 187,
+ shift: !1
+ },
+ r["-"] = {
+ code: 189,
+ shift: !1
+ },
+ r["]"] = {
+ code: 221,
+ shift: !1
+ },
+ r["["] = {
+ code: 219,
+ shift: !1
+ };
+ var a = function(e) {
+ d(e, "keydown")
+ }
+ , h = function(e) {
+ d(e, "keyup")
+ }
+ , d = function(e, t) {
+ if (void 0 !== s[t][e.keyCode]) {
+ for (var o = s[t][e.keyCode], n = 0; n < o.length; n++)
+ void 0 === o[n].shift ? o[n].fn(e) : 1 == o[n].shift && 1 == e.shiftKey ? o[n].fn(e) : 0 == o[n].shift && 0 == e.shiftKey && o[n].fn(e);
+ 1 == i && e.preventDefault()
+ }
+ };
+ return n.bind = function(e, t, i) {
+ if (void 0 === i && (i = "keydown"),
+ void 0 === r[e])
+ throw new Error("unsupported key: " + e);
+ void 0 === s[i][r[e].code] && (s[i][r[e].code] = []),
+ s[i][r[e].code].push({
+ fn: t,
+ shift: r[e].shift
+ })
+ }
+ ,
+ n.bindAll = function(e, t) {
+ void 0 === t && (t = "keydown");
+ for (var i in r)
+ r.hasOwnProperty(i) && n.bind(i, e, t)
+ }
+ ,
+ n.getKey = function(e) {
+ for (var t in r)
+ if (r.hasOwnProperty(t)) {
+ if (1 == e.shiftKey && 1 == r[t].shift && e.keyCode == r[t].code)
+ return t;
+ if (0 == e.shiftKey && 0 == r[t].shift && e.keyCode == r[t].code)
+ return t;
+ if (e.keyCode == r[t].code && "shift" == t)
+ return t
+ }
+ return "unknown key, currently not supported"
+ }
+ ,
+ n.unbind = function(e, t, i) {
+ if (void 0 === i && (i = "keydown"),
+ void 0 === r[e])
+ throw new Error("unsupported key: " + e);
+ if (void 0 !== t) {
+ var o = []
+ , n = s[i][r[e].code];
+ if (void 0 !== n)
+ for (var a = 0; a < n.length; a++)
+ n[a].fn == t && n[a].shift == r[e].shift || o.push(s[i][r[e].code][a]);
+ s[i][r[e].code] = o
+ } else
+ s[i][r[e].code] = []
+ }
+ ,
+ n.reset = function() {
+ s = {
+ keydown: {},
+ keyup: {}
+ }
+ }
+ ,
+ n.destroy = function() {
+ s = {
+ keydown: {},
+ keyup: {}
+ },
+ o.removeEventListener("keydown", a, !0),
+ o.removeEventListener("keyup", h, !0)
+ }
+ ,
+ o.addEventListener("keydown", a, !0),
+ o.addEventListener("keyup", h, !0),
+ n
+ }
+ return e
+ })
+ }
+ , function(e, t) {
+ function i(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var o = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , n = function() {
+ function e(t) {
+ i(this, e),
+ this.container = t,
+ this.x = 0,
+ this.y = 0,
+ this.padding = 5,
+ this.hidden = !1,
+ this.frame = document.createElement("div"),
+ this.frame.className = "vis-network-tooltip",
+ this.container.appendChild(this.frame)
+ }
+ return o(e, [{
+ key: "setPosition",
+ value: function(e, t) {
+ this.x = parseInt(e),
+ this.y = parseInt(t)
+ }
+ }, {
+ key: "setText",
+ value: function(e) {
+ e instanceof Element ? (this.frame.innerHTML = "",
+ this.frame.appendChild(e)) : this.frame.innerHTML = e
+ }
+ }, {
+ key: "show",
+ value: function(e) {
+ if (void 0 === e && (e = !0),
+ e === !0) {
+ var t = this.frame.clientHeight
+ , i = this.frame.clientWidth
+ , o = this.frame.parentNode.clientHeight
+ , n = this.frame.parentNode.clientWidth
+ , s = this.y - t;
+ s + t + this.padding > o && (s = o - t - this.padding),
+ s < this.padding && (s = this.padding);
+ var r = this.x;
+ r + i + this.padding > n && (r = n - i - this.padding),
+ r < this.padding && (r = this.padding),
+ this.frame.style.left = r + "px",
+ this.frame.style.top = s + "px",
+ this.frame.style.visibility = "visible",
+ this.hidden = !1
+ } else
+ this.hide()
+ }
+ }, {
+ key: "hide",
+ value: function() {
+ this.hidden = !0,
+ this.frame.style.visibility = "hidden"
+ }
+ }]),
+ e
+ }();
+ t["default"] = n
+ }
+ , function(e, t, i) {
+ function o(e) {
+ return e && e.__esModule ? e : {
+ "default": e
+ }
+ }
+ function n(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var s = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , r = i(15)
+ , a = o(r)
+ , h = i(36)
+ , d = o(h)
+ , l = i(1)
+ , c = function() {
+ function e(t, i) {
+ var o = this;
+ n(this, e),
+ this.body = t,
+ this.canvas = i,
+ this.selectionObj = {
+ nodes: [],
+ edges: []
+ },
+ this.hoverObj = {
+ nodes: {},
+ edges: {}
+ },
+ this.options = {},
+ this.defaultOptions = {
+ multiselect: !1,
+ selectable: !0,
+ selectConnectedEdges: !0,
+ hoverConnectedEdges: !0
+ },
+ l.extend(this.options, this.defaultOptions),
+ this.body.emitter.on("_dataChanged", function() {
+ o.updateSelection()
+ })
+ }
+ return s(e, [{
+ key: "setOptions",
+ value: function(e) {
+ if (void 0 !== e) {
+ var t = ["multiselect", "hoverConnectedEdges", "selectable", "selectConnectedEdges"];
+ l.selectiveDeepExtend(t, this.options, e)
+ }
+ }
+ }, {
+ key: "selectOnPoint",
+ value: function(e) {
+ var t = !1;
+ if (this.options.selectable === !0) {
+ var i = this.getNodeAt(e) || this.getEdgeAt(e);
+ this.unselectAll(),
+ void 0 !== i && (t = this.selectObject(i)),
+ this.body.emitter.emit("_requestRedraw")
+ }
+ return t
+ }
+ }, {
+ key: "selectAdditionalOnPoint",
+ value: function(e) {
+ var t = !1;
+ if (this.options.selectable === !0) {
+ var i = this.getNodeAt(e) || this.getEdgeAt(e);
+ void 0 !== i && (t = !0,
+ i.isSelected() === !0 ? this.deselectObject(i) : this.selectObject(i),
+ this.body.emitter.emit("_requestRedraw"))
+ }
+ return t
+ }
+ }, {
+ key: "_generateClickEvent",
+ value: function(e, t, i, o) {
+ var n = arguments.length <= 4 || void 0 === arguments[4] ? !1 : arguments[4]
+ , s = void 0;
+ s = n === !0 ? {
+ nodes: [],
+ edges: []
+ } : this.getSelection(),
+ s.pointer = {
+ DOM: {
+ x: i.x,
+ y: i.y
+ },
+ canvas: this.canvas.DOMtoCanvas(i)
+ },
+ s.event = t,
+ void 0 !== o && (s.previousSelection = o),
+ this.body.emitter.emit(e, s)
+ }
+ }, {
+ key: "selectObject",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? this.options.selectConnectedEdges : arguments[1];
+ return void 0 !== e ? (e instanceof a["default"] && t === !0 && this._selectConnectedEdges(e),
+ e.select(),
+ this._addToSelection(e),
+ !0) : !1
+ }
+ }, {
+ key: "deselectObject",
+ value: function(e) {
+ e.isSelected() === !0 && (e.selected = !1,
+ this._removeFromSelection(e))
+ }
+ }, {
+ key: "_getAllNodesOverlappingWith",
+ value: function(e) {
+ for (var t = [], i = this.body.nodes, o = 0; o < this.body.nodeIndices.length; o++) {
+ var n = this.body.nodeIndices[o];
+ i[n].isOverlappingWith(e) && t.push(n)
+ }
+ return t
+ }
+ }, {
+ key: "_pointerToPositionObject",
+ value: function(e) {
+ var t = this.canvas.DOMtoCanvas(e);
+ return {
+ left: t.x - 1,
+ top: t.y + 1,
+ right: t.x + 1,
+ bottom: t.y - 1
+ }
+ }
+ }, {
+ key: "getNodeAt",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? !0 : arguments[1]
+ , i = this._pointerToPositionObject(e)
+ , o = this._getAllNodesOverlappingWith(i);
+ return o.length > 0 ? t === !0 ? this.body.nodes[o[o.length - 1]] : o[o.length - 1] : void 0
+ }
+ }, {
+ key: "_getEdgesOverlappingWith",
+ value: function(e, t) {
+ for (var i = this.body.edges, o = 0; o < this.body.edgeIndices.length; o++) {
+ var n = this.body.edgeIndices[o];
+ i[n].isOverlappingWith(e) && t.push(n)
+ }
+ }
+ }, {
+ key: "_getAllEdgesOverlappingWith",
+ value: function(e) {
+ var t = [];
+ return this._getEdgesOverlappingWith(e, t),
+ t
+ }
+ }, {
+ key: "getEdgeAt",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? !0 : arguments[1]
+ , i = this._pointerToPositionObject(e)
+ , o = this._getAllEdgesOverlappingWith(i);
+ return o.length > 0 ? t === !0 ? this.body.edges[o[o.length - 1]] : o[o.length - 1] : void 0
+ }
+ }, {
+ key: "_addToSelection",
+ value: function(e) {
+ e instanceof a["default"] ? this.selectionObj.nodes[e.id] = e : this.selectionObj.edges[e.id] = e
+ }
+ }, {
+ key: "_addToHover",
+ value: function(e) {
+ e instanceof a["default"] ? this.hoverObj.nodes[e.id] = e : this.hoverObj.edges[e.id] = e
+ }
+ }, {
+ key: "_removeFromSelection",
+ value: function(e) {
+ e instanceof a["default"] ? (delete this.selectionObj.nodes[e.id],
+ this._unselectConnectedEdges(e)) : delete this.selectionObj.edges[e.id]
+ }
+ }, {
+ key: "unselectAll",
+ value: function() {
+ for (var e in this.selectionObj.nodes)
+ this.selectionObj.nodes.hasOwnProperty(e) && this.selectionObj.nodes[e].unselect();
+ for (var t in this.selectionObj.edges)
+ this.selectionObj.edges.hasOwnProperty(t) && this.selectionObj.edges[t].unselect();
+ this.selectionObj = {
+ nodes: {},
+ edges: {}
+ }
+ }
+ }, {
+ key: "_getSelectedNodeCount",
+ value: function() {
+ var e = 0;
+ for (var t in this.selectionObj.nodes)
+ this.selectionObj.nodes.hasOwnProperty(t) && (e += 1);
+ return e
+ }
+ }, {
+ key: "_getSelectedNode",
+ value: function() {
+ for (var e in this.selectionObj.nodes)
+ if (this.selectionObj.nodes.hasOwnProperty(e))
+ return this.selectionObj.nodes[e]
+ }
+ }, {
+ key: "_getSelectedEdge",
+ value: function() {
+ for (var e in this.selectionObj.edges)
+ if (this.selectionObj.edges.hasOwnProperty(e))
+ return this.selectionObj.edges[e]
+ }
+ }, {
+ key: "_getSelectedEdgeCount",
+ value: function() {
+ var e = 0;
+ for (var t in this.selectionObj.edges)
+ this.selectionObj.edges.hasOwnProperty(t) && (e += 1);
+ return e
+ }
+ }, {
+ key: "_getSelectedObjectCount",
+ value: function() {
+ var e = 0;
+ for (var t in this.selectionObj.nodes)
+ this.selectionObj.nodes.hasOwnProperty(t) && (e += 1);
+ for (var i in this.selectionObj.edges)
+ this.selectionObj.edges.hasOwnProperty(i) && (e += 1);
+ return e
+ }
+ }, {
+ key: "_selectionIsEmpty",
+ value: function() {
+ for (var e in this.selectionObj.nodes)
+ if (this.selectionObj.nodes.hasOwnProperty(e))
+ return !1;
+ for (var t in this.selectionObj.edges)
+ if (this.selectionObj.edges.hasOwnProperty(t))
+ return !1;
+ return !0
+ }
+ }, {
+ key: "_clusterInSelection",
+ value: function() {
+ for (var e in this.selectionObj.nodes)
+ if (this.selectionObj.nodes.hasOwnProperty(e) && this.selectionObj.nodes[e].clusterSize > 1)
+ return !0;
+ return !1
+ }
+ }, {
+ key: "_selectConnectedEdges",
+ value: function(e) {
+ for (var t = 0; t < e.edges.length; t++) {
+ var i = e.edges[t];
+ i.select(),
+ this._addToSelection(i)
+ }
+ }
+ }, {
+ key: "_hoverConnectedEdges",
+ value: function(e) {
+ for (var t = 0; t < e.edges.length; t++) {
+ var i = e.edges[t];
+ i.hover = !0,
+ this._addToHover(i)
+ }
+ }
+ }, {
+ key: "_unselectConnectedEdges",
+ value: function(e) {
+ for (var t = 0; t < e.edges.length; t++) {
+ var i = e.edges[t];
+ i.unselect(),
+ this._removeFromSelection(i)
+ }
+ }
+ }, {
+ key: "blurObject",
+ value: function(e) {
+ e.hover === !0 && (e.hover = !1,
+ e instanceof a["default"] ? this.body.emitter.emit("blurNode", {
+ node: e.id
+ }) : this.body.emitter.emit("blurEdge", {
+ edge: e.id
+ }))
+ }
+ }, {
+ key: "hoverObject",
+ value: function(e) {
+ var t = !1;
+ for (var i in this.hoverObj.nodes)
+ this.hoverObj.nodes.hasOwnProperty(i) && (void 0 === e || e instanceof a["default"] && e.id != i || e instanceof d["default"]) && (this.blurObject(this.hoverObj.nodes[i]),
+ delete this.hoverObj.nodes[i],
+ t = !0);
+ for (var o in this.hoverObj.edges)
+ this.hoverObj.edges.hasOwnProperty(o) && (t === !0 ? (this.hoverObj.edges[o].hover = !1,
+ delete this.hoverObj.edges[o]) : void 0 === e && (this.blurObject(this.hoverObj.edges[o]),
+ delete this.hoverObj.edges[o],
+ t = !0));
+ void 0 !== e && (e.hover === !1 && (e.hover = !0,
+ this._addToHover(e),
+ t = !0,
+ e instanceof a["default"] ? this.body.emitter.emit("hoverNode", {
+ node: e.id
+ }) : this.body.emitter.emit("hoverEdge", {
+ edge: e.id
+ })),
+ e instanceof a["default"] && this.options.hoverConnectedEdges === !0 && this._hoverConnectedEdges(e)),
+ t === !0 && this.body.emitter.emit("_requestRedraw")
+ }
+ }, {
+ key: "getSelection",
+ value: function() {
+ var e = this.getSelectedNodes()
+ , t = this.getSelectedEdges();
+ return {
+ nodes: e,
+ edges: t
+ }
+ }
+ }, {
+ key: "getSelectedNodes",
+ value: function() {
+ var e = [];
+ if (this.options.selectable === !0)
+ for (var t in this.selectionObj.nodes)
+ this.selectionObj.nodes.hasOwnProperty(t) && e.push(this.selectionObj.nodes[t].id);
+ return e
+ }
+ }, {
+ key: "getSelectedEdges",
+ value: function() {
+ var e = [];
+ if (this.options.selectable === !0)
+ for (var t in this.selectionObj.edges)
+ this.selectionObj.edges.hasOwnProperty(t) && e.push(this.selectionObj.edges[t].id);
+ return e
+ }
+ }, {
+ key: "setSelection",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1]
+ , i = void 0
+ , o = void 0;
+ if (!e || !e.nodes && !e.edges)
+ throw "Selection must be an object with nodes and/or edges properties";
+ if ((t.unselectAll || void 0 === t.unselectAll) && this.unselectAll(),
+ e.nodes)
+ for (i = 0; i < e.nodes.length; i++) {
+ o = e.nodes[i];
+ var n = this.body.nodes[o];
+ if (!n)
+ throw new RangeError('Node with id "' + o + '" not found');
+ this.selectObject(n, t.highlightEdges)
+ }
+ if (e.edges)
+ for (i = 0; i < e.edges.length; i++) {
+ o = e.edges[i];
+ var s = this.body.edges[o];
+ if (!s)
+ throw new RangeError('Edge with id "' + o + '" not found');
+ this.selectObject(s)
+ }
+ this.body.emitter.emit("_requestRedraw")
+ }
+ }, {
+ key: "selectNodes",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? !0 : arguments[1];
+ if (!e || void 0 === e.length)
+ throw "Selection must be an array with ids";
+ this.setSelection({
+ nodes: e
+ }, {
+ highlightEdges: t
+ })
+ }
+ }, {
+ key: "selectEdges",
+ value: function(e) {
+ if (!e || void 0 === e.length)
+ throw "Selection must be an array with ids";
+ this.setSelection({
+ edges: e
+ })
+ }
+ }, {
+ key: "updateSelection",
+ value: function() {
+ for (var e in this.selectionObj.nodes)
+ this.selectionObj.nodes.hasOwnProperty(e) && (this.body.nodes.hasOwnProperty(e) || delete this.selectionObj.nodes[e]);
+ for (var t in this.selectionObj.edges)
+ this.selectionObj.edges.hasOwnProperty(t) && (this.body.edges.hasOwnProperty(t) || delete this.selectionObj.edges[t])
+ }
+ }]),
+ e
+ }();
+ t["default"] = c
+ }
+ , function(e, t, i) {
+ function o(e) {
+ return e && e.__esModule ? e : {
+ "default": e
+ }
+ }
+ function n(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var s = function() {
+ function e(e, t) {
+ var i = []
+ , o = !0
+ , n = !1
+ , s = void 0;
+ try {
+ for (var r, a = e[Symbol.iterator](); !(o = (r = a.next()).done) && (i.push(r.value),
+ !t || i.length !== t); o = !0)
+ ;
+ } catch (h) {
+ n = !0,
+ s = h
+ } finally {
+ try {
+ !o && a["return"] && a["return"]()
+ } finally {
+ if (n)
+ throw s
+ }
+ }
+ return i
+ }
+ return function(t, i) {
+ if (Array.isArray(t))
+ return t;
+ if (Symbol.iterator in Object(t))
+ return e(t, i);
+ throw new TypeError("Invalid attempt to destructure non-iterable instance")
+ }
+ }()
+ , r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
+ return typeof e
+ }
+ : function(e) {
+ return e && "function" == typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e
+ }
+ , a = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , h = i(54)
+ , d = o(h)
+ , l = i(1)
+ , c = function() {
+ function e(t) {
+ n(this, e),
+ this.body = t,
+ this.initialRandomSeed = Math.round(1e6 * Math.random()),
+ this.randomSeed = this.initialRandomSeed,
+ this.setPhysics = !1,
+ this.options = {},
+ this.optionsBackup = {
+ physics: {}
+ },
+ this.defaultOptions = {
+ randomSeed: void 0,
+ improvedLayout: !0,
+ hierarchical: {
+ enabled: !1,
+ levelSeparation: 150,
+ nodeSpacing: 100,
+ treeSpacing: 200,
+ blockShifting: !0,
+ edgeMinimization: !0,
+ parentCentralization: !0,
+ direction: "UD",
+ sortMethod: "hubsize"
+ }
+ },
+ l.extend(this.options, this.defaultOptions),
+ this.bindEventListeners()
+ }
+ return a(e, [{
+ key: "bindEventListeners",
+ value: function() {
+ var e = this;
+ this.body.emitter.on("_dataChanged", function() {
+ e.setupHierarchicalLayout()
+ }),
+ this.body.emitter.on("_dataLoaded", function() {
+ e.layoutNetwork()
+ }),
+ this.body.emitter.on("_resetHierarchicalLayout", function() {
+ e.setupHierarchicalLayout()
+ })
+ }
+ }, {
+ key: "setOptions",
+ value: function(e, t) {
+ if (void 0 !== e) {
+ var i = this.options.hierarchical.enabled;
+ if (l.selectiveDeepExtend(["randomSeed", "improvedLayout"], this.options, e),
+ l.mergeOptions(this.options, e, "hierarchical"),
+ void 0 !== e.randomSeed && (this.initialRandomSeed = e.randomSeed),
+ this.options.hierarchical.enabled === !0)
+ return i === !0 && this.body.emitter.emit("refresh", !0),
+ "RL" === this.options.hierarchical.direction || "DU" === this.options.hierarchical.direction ? this.options.hierarchical.levelSeparation > 0 && (this.options.hierarchical.levelSeparation *= -1) : this.options.hierarchical.levelSeparation < 0 && (this.options.hierarchical.levelSeparation *= -1),
+ this.body.emitter.emit("_resetHierarchicalLayout"),
+ this.adaptAllOptionsForHierarchicalLayout(t);
+ if (i === !0)
+ return this.body.emitter.emit("refresh"),
+ l.deepExtend(t, this.optionsBackup)
+ }
+ return t
+ }
+ }, {
+ key: "adaptAllOptionsForHierarchicalLayout",
+ value: function(e) {
+ if (this.options.hierarchical.enabled === !0) {
+ void 0 === e.physics || e.physics === !0 ? (e.physics = {
+ enabled: void 0 === this.optionsBackup.physics.enabled ? !0 : this.optionsBackup.physics.enabled,
+ solver: "hierarchicalRepulsion"
+ },
+ this.optionsBackup.physics.enabled = void 0 === this.optionsBackup.physics.enabled ? !0 : this.optionsBackup.physics.enabled,
+ this.optionsBackup.physics.solver = this.optionsBackup.physics.solver || "barnesHut") : "object" === r(e.physics) ? (this.optionsBackup.physics.enabled = void 0 === e.physics.enabled ? !0 : e.physics.enabled,
+ this.optionsBackup.physics.solver = e.physics.solver || "barnesHut",
+ e.physics.solver = "hierarchicalRepulsion") : e.physics !== !1 && (this.optionsBackup.physics.solver = "barnesHut",
+ e.physics = {
+ solver: "hierarchicalRepulsion"
+ });
+ var t = "horizontal";
+ "RL" !== this.options.hierarchical.direction && "LR" !== this.options.hierarchical.direction || (t = "vertical"),
+ void 0 === e.edges ? (this.optionsBackup.edges = {
+ smooth: {
+ enabled: !0,
+ type: "dynamic"
+ }
+ },
+ e.edges = {
+ smooth: !1
+ }) : void 0 === e.edges.smooth ? (this.optionsBackup.edges = {
+ smooth: {
+ enabled: !0,
+ type: "dynamic"
+ }
+ },
+ e.edges.smooth = !1) : "boolean" == typeof e.edges.smooth ? (this.optionsBackup.edges = {
+ smooth: e.edges.smooth
+ },
+ e.edges.smooth = {
+ enabled: e.edges.smooth,
+ type: t
+ }) : (void 0 !== e.edges.smooth.type && "dynamic" !== e.edges.smooth.type && (t = e.edges.smooth.type),
+ this.optionsBackup.edges = {
+ smooth: void 0 === e.edges.smooth.enabled ? !0 : e.edges.smooth.enabled,
+ type: void 0 === e.edges.smooth.type ? "dynamic" : e.edges.smooth.type,
+ roundness: void 0 === e.edges.smooth.roundness ? .5 : e.edges.smooth.roundness,
+ forceDirection: void 0 === e.edges.smooth.forceDirection ? !1 : e.edges.smooth.forceDirection
+ },
+ e.edges.smooth = {
+ enabled: void 0 === e.edges.smooth.enabled ? !0 : e.edges.smooth.enabled,
+ type: t,
+ roundness: void 0 === e.edges.smooth.roundness ? .5 : e.edges.smooth.roundness,
+ forceDirection: void 0 === e.edges.smooth.forceDirection ? !1 : e.edges.smooth.forceDirection
+ }),
+ this.body.emitter.emit("_forceDisableDynamicCurves", t)
+ }
+ return e
+ }
+ }, {
+ key: "seededRandom",
+ value: function() {
+ var e = 1e4 * Math.sin(this.randomSeed++);
+ return e - Math.floor(e)
+ }
+ }, {
+ key: "positionInitially",
+ value: function(e) {
+ if (this.options.hierarchical.enabled !== !0) {
+ this.randomSeed = this.initialRandomSeed;
+ for (var t = 0; t < e.length; t++) {
+ var i = e[t]
+ , o = 1 * e.length + 10
+ , n = 2 * Math.PI * this.seededRandom();
+ void 0 === i.x && (i.x = o * Math.cos(n)),
+ void 0 === i.y && (i.y = o * Math.sin(n))
+ }
+ }
+ }
+ }, {
+ key: "layoutNetwork",
+ value: function() {
+ if (this.options.hierarchical.enabled !== !0 && this.options.improvedLayout === !0) {
+ for (var e = 0, t = 0; t < this.body.nodeIndices.length; t++) {
+ var i = this.body.nodes[this.body.nodeIndices[t]];
+ i.predefinedPosition === !0 && (e += 1)
+ }
+ if (e < .5 * this.body.nodeIndices.length) {
+ var o = 10
+ , n = 0
+ , s = 100;
+ if (this.body.nodeIndices.length > s) {
+ for (var r = this.body.nodeIndices.length; this.body.nodeIndices.length > s; ) {
+ n += 1;
+ var a = this.body.nodeIndices.length;
+ n % 3 === 0 ? this.body.modules.clustering.clusterBridges() : this.body.modules.clustering.clusterOutliers();
+ var h = this.body.nodeIndices.length;
+ if (a == h && n % 3 !== 0 || n > o)
+ return this._declusterAll(),
+ this.body.emitter.emit("_layoutFailed"),
+ void console.info("This network could not be positioned by this version of the improved layout algorithm. Please disable improvedLayout for better performance.")
+ }
+ this.body.modules.kamadaKawai.setOptions({
+ springLength: Math.max(150, 2 * r)
+ })
+ }
+ this.body.modules.kamadaKawai.solve(this.body.nodeIndices, this.body.edgeIndices, !0),
+ this._shiftToCenter();
+ for (var d = 70, l = 0; l < this.body.nodeIndices.length; l++)
+ this.body.nodes[this.body.nodeIndices[l]].x += (.5 - this.seededRandom()) * d,
+ this.body.nodes[this.body.nodeIndices[l]].y += (.5 - this.seededRandom()) * d;
+ this._declusterAll(),
+ this.body.emitter.emit("_repositionBezierNodes")
+ }
+ }
+ }
+ }, {
+ key: "_shiftToCenter",
+ value: function() {
+ for (var e = d["default"].getRangeCore(this.body.nodes, this.body.nodeIndices), t = d["default"].findCenter(e), i = 0; i < this.body.nodeIndices.length; i++)
+ this.body.nodes[this.body.nodeIndices[i]].x -= t.x,
+ this.body.nodes[this.body.nodeIndices[i]].y -= t.y
+ }
+ }, {
+ key: "_declusterAll",
+ value: function() {
+ for (var e = !0; e === !0; ) {
+ e = !1;
+ for (var t = 0; t < this.body.nodeIndices.length; t++)
+ this.body.nodes[this.body.nodeIndices[t]].isCluster === !0 && (e = !0,
+ this.body.modules.clustering.openCluster(this.body.nodeIndices[t], {}, !1));
+ e === !0 && this.body.emitter.emit("_dataChanged")
+ }
+ }
+ }, {
+ key: "getSeed",
+ value: function() {
+ return this.initialRandomSeed
+ }
+ }, {
+ key: "setupHierarchicalLayout",
+ value: function() {
+ if (this.options.hierarchical.enabled === !0 && this.body.nodeIndices.length > 0) {
+ var e = void 0
+ , t = void 0
+ , i = !1
+ , o = !0
+ , n = !1;
+ this.hierarchicalLevels = {},
+ this.lastNodeOnLevel = {},
+ this.hierarchicalChildrenReference = {},
+ this.hierarchicalParentReference = {},
+ this.hierarchicalTrees = {},
+ this.treeIndex = -1,
+ this.distributionOrdering = {},
+ this.distributionIndex = {},
+ this.distributionOrderingPresence = {};
+ for (t in this.body.nodes)
+ this.body.nodes.hasOwnProperty(t) && (e = this.body.nodes[t],
+ void 0 === e.options.x && void 0 === e.options.y && (o = !1),
+ void 0 !== e.options.level ? (i = !0,
+ this.hierarchicalLevels[t] = e.options.level) : n = !0);
+ if (n === !0 && i === !0)
+ throw new Error("To use the hierarchical layout, nodes require either no predefined levels or levels have to be defined for all nodes.");
+ n === !0 && ("hubsize" === this.options.hierarchical.sortMethod ? this._determineLevelsByHubsize() : "directed" === this.options.hierarchical.sortMethod ? this._determineLevelsDirected() : "custom" === this.options.hierarchical.sortMethod && this._determineLevelsCustomCallback());
+ for (var s in this.body.nodes)
+ this.body.nodes.hasOwnProperty(s) && void 0 === this.hierarchicalLevels[s] && (this.hierarchicalLevels[s] = 0);
+ var r = this._getDistribution();
+ this._generateMap(),
+ this._placeNodesByHierarchy(r),
+ this._condenseHierarchy(),
+ this._shiftToCenter()
+ }
+ }
+ }, {
+ key: "_condenseHierarchy",
+ value: function() {
+ var e = this
+ , t = !1
+ , i = {}
+ , o = function() {
+ for (var t = a(), i = 0; i < t.length - 1; i++) {
+ var o = t[i].max - t[i + 1].min;
+ n(i + 1, o + e.options.hierarchical.treeSpacing)
+ }
+ }
+ , n = function(t, i) {
+ for (var o in e.hierarchicalTrees)
+ if (e.hierarchicalTrees.hasOwnProperty(o) && e.hierarchicalTrees[o] === t) {
+ var n = e.body.nodes[o]
+ , s = e._getPositionForHierarchy(n);
+ e._setPositionForHierarchy(n, s + i, void 0, !0)
+ }
+ }
+ , r = function(t) {
+ var i = 1e9
+ , o = -1e9;
+ for (var n in e.hierarchicalTrees)
+ if (e.hierarchicalTrees.hasOwnProperty(n) && e.hierarchicalTrees[n] === t) {
+ var s = e._getPositionForHierarchy(e.body.nodes[n]);
+ i = Math.min(s, i),
+ o = Math.max(s, o)
+ }
+ return {
+ min: i,
+ max: o
+ }
+ }
+ , a = function() {
+ for (var t = [], i = 0; i <= e.treeIndex; i++)
+ t.push(r(i));
+ return t
+ }
+ , h = function _(t, i) {
+ if (i[t.id] = !0,
+ e.hierarchicalChildrenReference[t.id]) {
+ var o = e.hierarchicalChildrenReference[t.id];
+ if (o.length > 0)
+ for (var n = 0; n < o.length; n++)
+ _(e.body.nodes[o[n]], i)
+ }
+ }
+ , d = function(t) {
+ var i = arguments.length <= 1 || void 0 === arguments[1] ? 1e9 : arguments[1]
+ , o = 1e9
+ , n = 1e9
+ , r = 1e9
+ , a = -1e9;
+ for (var h in t)
+ if (t.hasOwnProperty(h)) {
+ var d = e.body.nodes[h]
+ , l = e.hierarchicalLevels[d.id]
+ , c = e._getPositionForHierarchy(d)
+ , u = e._getSpaceAroundNode(d, t)
+ , f = s(u, 2)
+ , p = f[0]
+ , v = f[1];
+ o = Math.min(p, o),
+ n = Math.min(v, n),
+ i >= l && (r = Math.min(c, r),
+ a = Math.max(c, a))
+ }
+ return [r, a, o, n]
+ }
+ , l = function w(t) {
+ var i = e.hierarchicalLevels[t];
+ if (e.hierarchicalChildrenReference[t]) {
+ var o = e.hierarchicalChildrenReference[t];
+ if (o.length > 0)
+ for (var n = 0; n < o.length; n++)
+ i = Math.max(i, w(o[n]))
+ }
+ return i
+ }
+ , c = function(e, t) {
+ var i = l(e.id)
+ , o = l(t.id);
+ return Math.min(i, o)
+ }
+ , u = function(t, i) {
+ var o = e.hierarchicalParentReference[t.id]
+ , n = e.hierarchicalParentReference[i.id];
+ if (void 0 === o || void 0 === n)
+ return !1;
+ for (var s = 0; s < o.length; s++)
+ for (var r = 0; r < n.length; r++)
+ if (o[s] == n[r])
+ return !0;
+ return !1
+ }
+ , f = function(t, i, o) {
+ for (var n = 0; n < i.length; n++) {
+ var s = i[n]
+ , r = e.distributionOrdering[s];
+ if (r.length > 1)
+ for (var a = 0; a < r.length - 1; a++)
+ u(r[a], r[a + 1]) === !0 && e.hierarchicalTrees[r[a].id] === e.hierarchicalTrees[r[a + 1].id] && t(r[a], r[a + 1], o)
+ }
+ }
+ , p = function(i, o) {
+ var n = arguments.length <= 2 || void 0 === arguments[2] ? !1 : arguments[2]
+ , r = e._getPositionForHierarchy(i)
+ , a = e._getPositionForHierarchy(o)
+ , l = Math.abs(a - r);
+ if (l > e.options.hierarchical.nodeSpacing) {
+ var u = {};
+ u[i.id] = !0;
+ var f = {};
+ f[o.id] = !0,
+ h(i, u),
+ h(o, f);
+ var p = c(i, o)
+ , v = d(u, p)
+ , y = s(v, 4)
+ , g = (y[0],
+ y[1])
+ , b = (y[2],
+ y[3],
+ d(f, p))
+ , m = s(b, 4)
+ , _ = m[0]
+ , w = (m[1],
+ m[2])
+ , k = (m[3],
+ Math.abs(g - _));
+ if (k > e.options.hierarchical.nodeSpacing) {
+ var x = g - _ + e.options.hierarchical.nodeSpacing;
+ x < -w + e.options.hierarchical.nodeSpacing && (x = -w + e.options.hierarchical.nodeSpacing),
+ 0 > x && (e._shiftBlock(o.id, x),
+ t = !0,
+ n === !0 && e._centerParent(o))
+ }
+ }
+ }
+ , v = function(o, n) {
+ for (var r = n.id, a = n.edges, l = e.hierarchicalLevels[n.id], c = e.options.hierarchical.levelSeparation * e.options.hierarchical.levelSeparation, u = {}, f = [], p = 0; p < a.length; p++) {
+ var v = a[p];
+ if (v.toId != v.fromId) {
+ var y = v.toId == r ? v.from : v.to;
+ u[a[p].id] = y,
+ e.hierarchicalLevels[y.id] < l && f.push(v)
+ }
+ }
+ var g = function(t, i) {
+ for (var o = 0, n = 0; n < i.length; n++)
+ if (void 0 !== u[i[n].id]) {
+ var s = e._getPositionForHierarchy(u[i[n].id]) - t;
+ o += s / Math.sqrt(s * s + c)
+ }
+ return o
+ }
+ , b = function(t, i) {
+ for (var o = 0, n = 0; n < i.length; n++)
+ if (void 0 !== u[i[n].id]) {
+ var s = e._getPositionForHierarchy(u[i[n].id]) - t;
+ o -= c * Math.pow(s * s + c, -1.5)
+ }
+ return o
+ }
+ , m = function(t, i) {
+ for (var o = e._getPositionForHierarchy(n), s = {}, r = 0; t > r; r++) {
+ var a = g(o, i)
+ , h = b(o, i)
+ , d = 40
+ , l = Math.max(-d, Math.min(d, Math.round(a / h)));
+ if (o -= l,
+ void 0 !== s[o])
+ break;
+ s[o] = r
+ }
+ return o
+ }
+ , _ = function(o) {
+ var r = e._getPositionForHierarchy(n);
+ if (void 0 === i[n.id]) {
+ var a = {};
+ a[n.id] = !0,
+ h(n, a),
+ i[n.id] = a
+ }
+ var l = d(i[n.id])
+ , c = s(l, 4)
+ , u = (c[0],
+ c[1],
+ c[2])
+ , f = c[3]
+ , p = o - r
+ , v = 0;
+ p > 0 ? v = Math.min(p, f - e.options.hierarchical.nodeSpacing) : 0 > p && (v = -Math.min(-p, u - e.options.hierarchical.nodeSpacing)),
+ 0 != v && (e._shiftBlock(n.id, v),
+ t = !0)
+ }
+ , w = function(i) {
+ var o = e._getPositionForHierarchy(n)
+ , r = e._getSpaceAroundNode(n)
+ , a = s(r, 2)
+ , h = a[0]
+ , d = a[1]
+ , l = i - o
+ , c = o;
+ l > 0 ? c = Math.min(o + (d - e.options.hierarchical.nodeSpacing), i) : 0 > l && (c = Math.max(o - (h - e.options.hierarchical.nodeSpacing), i)),
+ c !== o && (e._setPositionForHierarchy(n, c, void 0, !0),
+ t = !0)
+ }
+ , k = m(o, f);
+ _(k),
+ k = m(o, a),
+ w(k)
+ }
+ , y = function(i) {
+ var o = Object.keys(e.distributionOrdering);
+ o = o.reverse();
+ for (var n = 0; i > n; n++) {
+ t = !1;
+ for (var s = 0; s < o.length; s++)
+ for (var r = o[s], a = e.distributionOrdering[r], h = 0; h < a.length; h++)
+ v(1e3, a[h]);
+ if (t !== !0)
+ break
+ }
+ }
+ , g = function(i) {
+ var o = Object.keys(e.distributionOrdering);
+ o = o.reverse();
+ for (var n = 0; i > n && (t = !1,
+ f(p, o, !0),
+ t === !0); n++)
+ ;
+ }
+ , b = function() {
+ for (var t in e.body.nodes)
+ e.body.nodes.hasOwnProperty(t) && e._centerParent(e.body.nodes[t])
+ }
+ , m = function() {
+ var t = Object.keys(e.distributionOrdering);
+ t = t.reverse();
+ for (var i = 0; i < t.length; i++)
+ for (var o = t[i], n = e.distributionOrdering[o], s = 0; s < n.length; s++)
+ e._centerParent(n[s])
+ };
+ this.options.hierarchical.blockShifting === !0 && (g(5),
+ b()),
+ this.options.hierarchical.edgeMinimization === !0 && y(20),
+ this.options.hierarchical.parentCentralization === !0 && m(),
+ o()
+ }
+ }, {
+ key: "_getSpaceAroundNode",
+ value: function(e, t) {
+ var i = !0;
+ void 0 === t && (i = !1);
+ var o = this.hierarchicalLevels[e.id];
+ if (void 0 !== o) {
+ var n = this.distributionIndex[e.id]
+ , s = this._getPositionForHierarchy(e)
+ , r = 1e9
+ , a = 1e9;
+ if (0 !== n) {
+ var h = this.distributionOrdering[o][n - 1];
+ if (i === !0 && void 0 === t[h.id] || i === !1) {
+ var d = this._getPositionForHierarchy(h);
+ r = s - d
+ }
+ }
+ if (n != this.distributionOrdering[o].length - 1) {
+ var l = this.distributionOrdering[o][n + 1];
+ if (i === !0 && void 0 === t[l.id] || i === !1) {
+ var c = this._getPositionForHierarchy(l);
+ a = Math.min(a, c - s)
+ }
+ }
+ return [r, a]
+ }
+ return [0, 0]
+ }
+ }, {
+ key: "_centerParent",
+ value: function(e) {
+ if (this.hierarchicalParentReference[e.id])
+ for (var t = this.hierarchicalParentReference[e.id], i = 0; i < t.length; i++) {
+ var o = t[i]
+ , n = this.body.nodes[o];
+ if (this.hierarchicalChildrenReference[o]) {
+ var r = 1e9
+ , a = -1e9
+ , h = this.hierarchicalChildrenReference[o];
+ if (h.length > 0)
+ for (var d = 0; d < h.length; d++) {
+ var l = this.body.nodes[h[d]];
+ r = Math.min(r, this._getPositionForHierarchy(l)),
+ a = Math.max(a, this._getPositionForHierarchy(l))
+ }
+ var c = this._getPositionForHierarchy(n)
+ , u = this._getSpaceAroundNode(n)
+ , f = s(u, 2)
+ , p = f[0]
+ , v = f[1]
+ , y = .5 * (r + a)
+ , g = c - y;
+ (0 > g && Math.abs(g) < v - this.options.hierarchical.nodeSpacing || g > 0 && Math.abs(g) < p - this.options.hierarchical.nodeSpacing) && this._setPositionForHierarchy(n, y, void 0, !0)
+ }
+ }
+ }
+ }, {
+ key: "_placeNodesByHierarchy",
+ value: function(e) {
+ this.positionedNodes = {};
+ for (var t in e)
+ if (e.hasOwnProperty(t)) {
+ var i = Object.keys(e[t]);
+ i = this._indexArrayToNodes(i),
+ this._sortNodeArray(i);
+ for (var o = 0, n = 0; n < i.length; n++) {
+ var s = i[n];
+ if (void 0 === this.positionedNodes[s.id]) {
+ var r = this.options.hierarchical.nodeSpacing * o;
+ o > 0 && (r = this._getPositionForHierarchy(i[n - 1]) + this.options.hierarchical.nodeSpacing),
+ this._setPositionForHierarchy(s, r, t),
+ this._validataPositionAndContinue(s, t, r),
+ o++
+ }
+ }
+ }
+ }
+ }, {
+ key: "_placeBranchNodes",
+ value: function(e, t) {
+ if (void 0 !== this.hierarchicalChildrenReference[e]) {
+ for (var i = [], o = 0; o < this.hierarchicalChildrenReference[e].length; o++)
+ i.push(this.body.nodes[this.hierarchicalChildrenReference[e][o]]);
+ this._sortNodeArray(i);
+ for (var n = 0; n < i.length; n++) {
+ var s = i[n]
+ , r = this.hierarchicalLevels[s.id];
+ if (!(r > t && void 0 === this.positionedNodes[s.id]))
+ return;
+ var a = void 0;
+ a = 0 === n ? this._getPositionForHierarchy(this.body.nodes[e]) : this._getPositionForHierarchy(i[n - 1]) + this.options.hierarchical.nodeSpacing,
+ this._setPositionForHierarchy(s, a, r),
+ this._validataPositionAndContinue(s, r, a)
+ }
+ for (var h = 1e9, d = -1e9, l = 0; l < i.length; l++) {
+ var c = i[l].id;
+ h = Math.min(h, this._getPositionForHierarchy(this.body.nodes[c])),
+ d = Math.max(d, this._getPositionForHierarchy(this.body.nodes[c]))
+ }
+ this._setPositionForHierarchy(this.body.nodes[e], .5 * (h + d), t)
+ }
+ }
+ }, {
+ key: "_validataPositionAndContinue",
+ value: function(e, t, i) {
+ if (void 0 !== this.lastNodeOnLevel[t]) {
+ var o = this._getPositionForHierarchy(this.body.nodes[this.lastNodeOnLevel[t]]);
+ if (i - o < this.options.hierarchical.nodeSpacing) {
+ var n = o + this.options.hierarchical.nodeSpacing - i
+ , s = this._findCommonParent(this.lastNodeOnLevel[t], e.id);
+ this._shiftBlock(s.withChild, n)
+ }
+ }
+ this.lastNodeOnLevel[t] = e.id,
+ this.positionedNodes[e.id] = !0,
+ this._placeBranchNodes(e.id, t)
+ }
+ }, {
+ key: "_indexArrayToNodes",
+ value: function(e) {
+ for (var t = [], i = 0; i < e.length; i++)
+ t.push(this.body.nodes[e[i]]);
+ return t
+ }
+ }, {
+ key: "_getDistribution",
+ value: function() {
+ var e = {}
+ , t = void 0
+ , i = void 0;
+ for (t in this.body.nodes)
+ if (this.body.nodes.hasOwnProperty(t)) {
+ i = this.body.nodes[t];
+ var o = void 0 === this.hierarchicalLevels[t] ? 0 : this.hierarchicalLevels[t];
+ "UD" === this.options.hierarchical.direction || "DU" === this.options.hierarchical.direction ? (i.y = this.options.hierarchical.levelSeparation * o,
+ i.options.fixed.y = !0) : (i.x = this.options.hierarchical.levelSeparation * o,
+ i.options.fixed.x = !0),
+ void 0 === e[o] && (e[o] = {}),
+ e[o][t] = i
+ }
+ return e
+ }
+ }, {
+ key: "_getHubSize",
+ value: function() {
+ var e = 0;
+ for (var t in this.body.nodes)
+ if (this.body.nodes.hasOwnProperty(t)) {
+ var i = this.body.nodes[t];
+ void 0 === this.hierarchicalLevels[t] && (e = i.edges.length < e ? e : i.edges.length)
+ }
+ return e
+ }
+ }, {
+ key: "_determineLevelsByHubsize",
+ value: function() {
+ for (var e = this, t = 1, i = function(t, i) {
+ void 0 === e.hierarchicalLevels[i.id] && (void 0 === e.hierarchicalLevels[t.id] && (e.hierarchicalLevels[t.id] = 0),
+ e.hierarchicalLevels[i.id] = e.hierarchicalLevels[t.id] + 1)
+ }; t > 0 && (t = this._getHubSize(),
+ 0 !== t); )
+ for (var o in this.body.nodes)
+ if (this.body.nodes.hasOwnProperty(o)) {
+ var n = this.body.nodes[o];
+ n.edges.length === t && this._crawlNetwork(i, o)
+ }
+ }
+ }, {
+ key: "_determineLevelsCustomCallback",
+ value: function() {
+ var e = this
+ , t = 1e5
+ , i = function(e, t, i) {}
+ , o = function(o, n, s) {
+ var r = e.hierarchicalLevels[o.id];
+ void 0 === r && (e.hierarchicalLevels[o.id] = t);
+ var a = i(d["default"].cloneOptions(o, "node"), d["default"].cloneOptions(n, "node"), d["default"].cloneOptions(s, "edge"));
+ e.hierarchicalLevels[n.id] = e.hierarchicalLevels[o.id] + a
+ };
+ this._crawlNetwork(o),
+ this._setMinLevelToZero()
+ }
+ }, {
+ key: "_determineLevelsDirected",
+ value: function() {
+ var e = this
+ , t = 1e4
+ , i = function(i, o, n) {
+ var s = e.hierarchicalLevels[i.id];
+ void 0 === s && (e.hierarchicalLevels[i.id] = t),
+ n.toId == o.id ? e.hierarchicalLevels[o.id] = e.hierarchicalLevels[i.id] + 1 : e.hierarchicalLevels[o.id] = e.hierarchicalLevels[i.id] - 1
+ };
+ this._crawlNetwork(i),
+ this._setMinLevelToZero()
+ }
+ }, {
+ key: "_setMinLevelToZero",
+ value: function() {
+ var e = 1e9;
+ for (var t in this.body.nodes)
+ this.body.nodes.hasOwnProperty(t) && void 0 !== this.hierarchicalLevels[t] && (e = Math.min(this.hierarchicalLevels[t], e));
+ for (var i in this.body.nodes)
+ this.body.nodes.hasOwnProperty(i) && void 0 !== this.hierarchicalLevels[i] && (this.hierarchicalLevels[i] -= e)
+ }
+ }, {
+ key: "_generateMap",
+ value: function() {
+ var e = this
+ , t = function(t, i) {
+ if (e.hierarchicalLevels[i.id] > e.hierarchicalLevels[t.id]) {
+ var o = t.id
+ , n = i.id;
+ void 0 === e.hierarchicalChildrenReference[o] && (e.hierarchicalChildrenReference[o] = []),
+ e.hierarchicalChildrenReference[o].push(n),
+ void 0 === e.hierarchicalParentReference[n] && (e.hierarchicalParentReference[n] = []),
+ e.hierarchicalParentReference[n].push(o)
+ }
+ };
+ this._crawlNetwork(t)
+ }
+ }, {
+ key: "_crawlNetwork",
+ value: function() {
+ var e = this
+ , t = arguments.length <= 0 || void 0 === arguments[0] ? function() {}
+ : arguments[0]
+ , i = arguments[1]
+ , o = {}
+ , n = 0
+ , s = function d(i, n) {
+ if (void 0 === o[i.id]) {
+ void 0 === e.hierarchicalTrees[i.id] && (e.hierarchicalTrees[i.id] = n,
+ e.treeIndex = Math.max(n, e.treeIndex)),
+ o[i.id] = !0;
+ for (var s = void 0, r = 0; r < i.edges.length; r++)
+ i.edges[r].connected === !0 && (s = i.edges[r].toId === i.id ? i.edges[r].from : i.edges[r].to,
+ i.id !== s.id && (t(i, s, i.edges[r]),
+ d(s, n)))
+ }
+ };
+ if (void 0 === i)
+ for (var r = 0; r < this.body.nodeIndices.length; r++) {
+ var a = this.body.nodes[this.body.nodeIndices[r]];
+ void 0 === o[a.id] && (s(a, n),
+ n += 1)
+ }
+ else {
+ var h = this.body.nodes[i];
+ if (void 0 === h)
+ return void console.error("Node not found:", i);
+ s(h)
+ }
+ }
+ }, {
+ key: "_shiftBlock",
+ value: function(e, t) {
+ if ("UD" === this.options.hierarchical.direction || "DU" === this.options.hierarchical.direction ? this.body.nodes[e].x += t : this.body.nodes[e].y += t,
+ void 0 !== this.hierarchicalChildrenReference[e])
+ for (var i = 0; i < this.hierarchicalChildrenReference[e].length; i++)
+ this._shiftBlock(this.hierarchicalChildrenReference[e][i], t)
+ }
+ }, {
+ key: "_findCommonParent",
+ value: function(e, t) {
+ var i = this
+ , o = {}
+ , n = function r(e, t) {
+ if (void 0 !== i.hierarchicalParentReference[t])
+ for (var o = 0; o < i.hierarchicalParentReference[t].length; o++) {
+ var n = i.hierarchicalParentReference[t][o];
+ e[n] = !0,
+ r(e, n)
+ }
+ }
+ , s = function a(e, t) {
+ if (void 0 !== i.hierarchicalParentReference[t])
+ for (var o = 0; o < i.hierarchicalParentReference[t].length; o++) {
+ var n = i.hierarchicalParentReference[t][o];
+ if (void 0 !== e[n])
+ return {
+ foundParent: n,
+ withChild: t
+ };
+ var s = a(e, n);
+ if (null !== s.foundParent)
+ return s
+ }
+ return {
+ foundParent: null,
+ withChild: t
+ }
+ };
+ return n(o, e),
+ s(o, t)
+ }
+ }, {
+ key: "_setPositionForHierarchy",
+ value: function(e, t, i) {
+ var o = arguments.length <= 3 || void 0 === arguments[3] ? !1 : arguments[3];
+ o !== !0 && (void 0 === this.distributionOrdering[i] && (this.distributionOrdering[i] = [],
+ this.distributionOrderingPresence[i] = {}),
+ void 0 === this.distributionOrderingPresence[i][e.id] && (this.distributionOrdering[i].push(e),
+ this.distributionIndex[e.id] = this.distributionOrdering[i].length - 1),
+ this.distributionOrderingPresence[i][e.id] = !0),
+ "UD" === this.options.hierarchical.direction || "DU" === this.options.hierarchical.direction ? e.x = t : e.y = t
+ }
+ }, {
+ key: "_getPositionForHierarchy",
+ value: function(e) {
+ return "UD" === this.options.hierarchical.direction || "DU" === this.options.hierarchical.direction ? e.x : e.y
+ }
+ }, {
+ key: "_sortNodeArray",
+ value: function(e) {
+ e.length > 1 && ("UD" === this.options.hierarchical.direction || "DU" === this.options.hierarchical.direction ? e.sort(function(e, t) {
+ return e.x - t.x
+ }) : e.sort(function(e, t) {
+ return e.y - t.y
+ }))
+ }
+ }]),
+ e
+ }();
+ t["default"] = c
+ }
+ , function(e, t, i) {
+ function o(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var n = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , s = i(1)
+ , r = i(58)
+ , a = i(61)
+ , h = function() {
+ function e(t, i, n) {
+ var r = this;
+ o(this, e),
+ this.body = t,
+ this.canvas = i,
+ this.selectionHandler = n,
+ this.editMode = !1,
+ this.manipulationDiv = void 0,
+ this.editModeDiv = void 0,
+ this.closeDiv = void 0,
+ this.manipulationHammers = [],
+ this.temporaryUIFunctions = {},
+ this.temporaryEventFunctions = [],
+ this.touchTime = 0,
+ this.temporaryIds = {
+ nodes: [],
+ edges: []
+ },
+ this.guiEnabled = !1,
+ this.inMode = !1,
+ this.selectedControlNode = void 0,
+ this.options = {},
+ this.defaultOptions = {
+ enabled: !1,
+ initiallyActive: !1,
+ addNode: !0,
+ addEdge: !0,
+ editNode: void 0,
+ editEdge: !0,
+ deleteNode: !0,
+ deleteEdge: !0,
+ controlNodeStyle: {
+ shape: "dot",
+ size: 6,
+ color: {
+ background: "#ff0000",
+ border: "#3c3c3c",
+ highlight: {
+ background: "#07f968",
+ border: "#3c3c3c"
+ }
+ },
+ borderWidth: 2,
+ borderWidthSelected: 2
+ }
+ },
+ s.extend(this.options, this.defaultOptions),
+ this.body.emitter.on("destroy", function() {
+ r._clean()
+ }),
+ this.body.emitter.on("_dataChanged", this._restore.bind(this)),
+ this.body.emitter.on("_resetData", this._restore.bind(this))
+ }
+ return n(e, [{
+ key: "_restore",
+ value: function() {
+ this.inMode !== !1 && (this.options.initiallyActive === !0 ? this.enableEditMode() : this.disableEditMode())
+ }
+ }, {
+ key: "setOptions",
+ value: function(e, t, i) {
+ void 0 !== t && (void 0 !== t.locale ? this.options.locale = t.locale : this.options.locale = i.locale,
+ void 0 !== t.locales ? this.options.locales = t.locales : this.options.locales = i.locales),
+ void 0 !== e && ("boolean" == typeof e ? this.options.enabled = e : (this.options.enabled = !0,
+ s.deepExtend(this.options, e)),
+ this.options.initiallyActive === !0 && (this.editMode = !0),
+ this._setup())
+ }
+ }, {
+ key: "toggleEditMode",
+ value: function() {
+ this.editMode === !0 ? this.disableEditMode() : this.enableEditMode()
+ }
+ }, {
+ key: "enableEditMode",
+ value: function() {
+ this.editMode = !0,
+ this._clean(),
+ this.guiEnabled === !0 && (this.manipulationDiv.style.display = "block",
+ this.closeDiv.style.display = "block",
+ this.editModeDiv.style.display = "none",
+ this.showManipulatorToolbar())
+ }
+ }, {
+ key: "disableEditMode",
+ value: function() {
+ this.editMode = !1,
+ this._clean(),
+ this.guiEnabled === !0 && (this.manipulationDiv.style.display = "none",
+ this.closeDiv.style.display = "none",
+ this.editModeDiv.style.display = "block",
+ this._createEditButton())
+ }
+ }, {
+ key: "showManipulatorToolbar",
+ value: function() {
+ if (this._clean(),
+ this.manipulationDOM = {},
+ this.guiEnabled === !0) {
+ this.editMode = !0,
+ this.manipulationDiv.style.display = "block",
+ this.closeDiv.style.display = "block";
+ var e = this.selectionHandler._getSelectedNodeCount()
+ , t = this.selectionHandler._getSelectedEdgeCount()
+ , i = e + t
+ , o = this.options.locales[this.options.locale]
+ , n = !1;
+ this.options.addNode !== !1 && (this._createAddNodeButton(o),
+ n = !0),
+ this.options.addEdge !== !1 && (n === !0 ? this._createSeperator(1) : n = !0,
+ this._createAddEdgeButton(o)),
+ 1 === e && "function" == typeof this.options.editNode ? (n === !0 ? this._createSeperator(2) : n = !0,
+ this._createEditNodeButton(o)) : 1 === t && 0 === e && this.options.editEdge !== !1 && (n === !0 ? this._createSeperator(3) : n = !0,
+ this._createEditEdgeButton(o)),
+ 0 !== i && (e > 0 && this.options.deleteNode !== !1 ? (n === !0 && this._createSeperator(4),
+ this._createDeleteButton(o)) : 0 === e && this.options.deleteEdge !== !1 && (n === !0 && this._createSeperator(4),
+ this._createDeleteButton(o))),
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this)),
+ this._temporaryBindEvent("select", this.showManipulatorToolbar.bind(this))
+ }
+ this.body.emitter.emit("_redraw")
+ }
+ }, {
+ key: "addNodeMode",
+ value: function() {
+ if (this.editMode !== !0 && this.enableEditMode(),
+ this._clean(),
+ this.inMode = "addNode",
+ this.guiEnabled === !0) {
+ var e = this.options.locales[this.options.locale];
+ this.manipulationDOM = {},
+ this._createBackButton(e),
+ this._createSeperator(),
+ this._createDescription(e.addDescription || this.options.locales.en.addDescription),
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this))
+ }
+ this._temporaryBindEvent("click", this._performAddNode.bind(this))
+ }
+ }, {
+ key: "editNode",
+ value: function() {
+ var e = this;
+ this.editMode !== !0 && this.enableEditMode(),
+ this._clean();
+ var t = this.selectionHandler._getSelectedNode();
+ if (void 0 !== t) {
+ if (this.inMode = "editNode",
+ "function" != typeof this.options.editNode)
+ throw new Error("No function has been configured to handle the editing of nodes.");
+ if (t.isCluster !== !0) {
+ var i = s.deepExtend({}, t.options, !1);
+ if (i.x = t.x,
+ i.y = t.y,
+ 2 !== this.options.editNode.length)
+ throw new Error("The function for edit does not support two arguments (data, callback)");
+ this.options.editNode(i, function(t) {
+ null !== t && void 0 !== t && "editNode" === e.inMode && e.body.data.nodes.getDataSet().update(t),
+ e.showManipulatorToolbar()
+ })
+ } else
+ alert(this.options.locales[this.options.locale].editClusterError || this.options.locales.en.editClusterError)
+ } else
+ this.showManipulatorToolbar()
+ }
+ }, {
+ key: "addEdgeMode",
+ value: function() {
+ if (this.editMode !== !0 && this.enableEditMode(),
+ this._clean(),
+ this.inMode = "addEdge",
+ this.guiEnabled === !0) {
+ var e = this.options.locales[this.options.locale];
+ this.manipulationDOM = {},
+ this._createBackButton(e),
+ this._createSeperator(),
+ this._createDescription(e.edgeDescription || this.options.locales.en.edgeDescription),
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this))
+ }
+ this._temporaryBindUI("onTouch", this._handleConnect.bind(this)),
+ this._temporaryBindUI("onDragEnd", this._finishConnect.bind(this)),
+ this._temporaryBindUI("onDrag", this._dragControlNode.bind(this)),
+ this._temporaryBindUI("onRelease", this._finishConnect.bind(this)),
+ this._temporaryBindUI("onDragStart", function() {}),
+ this._temporaryBindUI("onHold", function() {})
+ }
+ }, {
+ key: "editEdgeMode",
+ value: function() {
+ var e = this;
+ if (this.editMode !== !0 && this.enableEditMode(),
+ this._clean(),
+ this.inMode = "editEdge",
+ this.guiEnabled === !0) {
+ var t = this.options.locales[this.options.locale];
+ this.manipulationDOM = {},
+ this._createBackButton(t),
+ this._createSeperator(),
+ this._createDescription(t.editEdgeDescription || this.options.locales.en.editEdgeDescription),
+ this._bindHammerToDiv(this.closeDiv, this.toggleEditMode.bind(this))
+ }
+ this.edgeBeingEditedId = this.selectionHandler.getSelectedEdges()[0],
+ void 0 !== this.edgeBeingEditedId ? !function() {
+ var t = e.body.edges[e.edgeBeingEditedId]
+ , i = e._getNewTargetNode(t.from.x, t.from.y)
+ , o = e._getNewTargetNode(t.to.x, t.to.y);
+ e.temporaryIds.nodes.push(i.id),
+ e.temporaryIds.nodes.push(o.id),
+ e.body.nodes[i.id] = i,
+ e.body.nodeIndices.push(i.id),
+ e.body.nodes[o.id] = o,
+ e.body.nodeIndices.push(o.id),
+ e._temporaryBindUI("onTouch", e._controlNodeTouch.bind(e)),
+ e._temporaryBindUI("onTap", function() {}),
+ e._temporaryBindUI("onHold", function() {}),
+ e._temporaryBindUI("onDragStart", e._controlNodeDragStart.bind(e)),
+ e._temporaryBindUI("onDrag", e._controlNodeDrag.bind(e)),
+ e._temporaryBindUI("onDragEnd", e._controlNodeDragEnd.bind(e)),
+ e._temporaryBindUI("onMouseMove", function() {}),
+ e._temporaryBindEvent("beforeDrawing", function(e) {
+ var n = t.edgeType.findBorderPositions(e);
+ i.selected === !1 && (i.x = n.from.x,
+ i.y = n.from.y),
+ o.selected === !1 && (o.x = n.to.x,
+ o.y = n.to.y)
+ }),
+ e.body.emitter.emit("_redraw")
+ }() : this.showManipulatorToolbar()
+ }
+ }, {
+ key: "deleteSelected",
+ value: function() {
+ var e = this;
+ this.editMode !== !0 && this.enableEditMode(),
+ this._clean(),
+ this.inMode = "delete";
+ var t = this.selectionHandler.getSelectedNodes()
+ , i = this.selectionHandler.getSelectedEdges()
+ , o = void 0;
+ if (t.length > 0) {
+ for (var n = 0; n < t.length; n++)
+ if (this.body.nodes[t[n]].isCluster === !0)
+ return void alert(this.options.locales[this.options.locale].deleteClusterError || this.options.locales.en.deleteClusterError);
+ "function" == typeof this.options.deleteNode && (o = this.options.deleteNode)
+ } else
+ i.length > 0 && "function" == typeof this.options.deleteEdge && (o = this.options.deleteEdge);
+ if ("function" == typeof o) {
+ var s = {
+ nodes: t,
+ edges: i
+ };
+ if (2 !== o.length)
+ throw new Error("The function for delete does not support two arguments (data, callback)");
+ o(s, function(t) {
+ null !== t && void 0 !== t && "delete" === e.inMode ? (e.body.data.edges.getDataSet().remove(t.edges),
+ e.body.data.nodes.getDataSet().remove(t.nodes),
+ e.body.emitter.emit("startSimulation"),
+ e.showManipulatorToolbar()) : (e.body.emitter.emit("startSimulation"),
+ e.showManipulatorToolbar())
+ })
+ } else
+ this.body.data.edges.getDataSet().remove(i),
+ this.body.data.nodes.getDataSet().remove(t),
+ this.body.emitter.emit("startSimulation"),
+ this.showManipulatorToolbar()
+ }
+ }, {
+ key: "_setup",
+ value: function() {
+ this.options.enabled === !0 ? (this.guiEnabled = !0,
+ this._createWrappers(),
+ this.editMode === !1 ? this._createEditButton() : this.showManipulatorToolbar()) : (this._removeManipulationDOM(),
+ this.guiEnabled = !1)
+ }
+ }, {
+ key: "_createWrappers",
+ value: function() {
+ void 0 === this.manipulationDiv && (this.manipulationDiv = document.createElement("div"),
+ this.manipulationDiv.className = "vis-manipulation",
+ this.editMode === !0 ? this.manipulationDiv.style.display = "block" : this.manipulationDiv.style.display = "none",
+ this.canvas.frame.appendChild(this.manipulationDiv)),
+ void 0 === this.editModeDiv && (this.editModeDiv = document.createElement("div"),
+ this.editModeDiv.className = "vis-edit-mode",
+ this.editMode === !0 ? this.editModeDiv.style.display = "none" : this.editModeDiv.style.display = "block",
+ this.canvas.frame.appendChild(this.editModeDiv)),
+ void 0 === this.closeDiv && (this.closeDiv = document.createElement("div"),
+ this.closeDiv.className = "vis-close",
+ this.closeDiv.style.display = this.manipulationDiv.style.display,
+ this.canvas.frame.appendChild(this.closeDiv))
+ }
+ }, {
+ key: "_getNewTargetNode",
+ value: function(e, t) {
+ var i = s.deepExtend({}, this.options.controlNodeStyle);
+ i.id = "targetNode" + s.randomUUID(),
+ i.hidden = !1,
+ i.physics = !1,
+ i.x = e,
+ i.y = t;
+ var o = this.body.functions.createNode(i);
+ return o.shape.boundingBox = {
+ left: e,
+ right: e,
+ top: t,
+ bottom: t
+ },
+ o
+ }
+ }, {
+ key: "_createEditButton",
+ value: function() {
+ this._clean(),
+ this.manipulationDOM = {},
+ s.recursiveDOMDelete(this.editModeDiv);
+ var e = this.options.locales[this.options.locale]
+ , t = this._createButton("editMode", "vis-button vis-edit vis-edit-mode", e.edit || this.options.locales.en.edit);
+ this.editModeDiv.appendChild(t),
+ this._bindHammerToDiv(t, this.toggleEditMode.bind(this))
+ }
+ }, {
+ key: "_clean",
+ value: function() {
+ this.inMode = !1,
+ this.guiEnabled === !0 && (s.recursiveDOMDelete(this.editModeDiv),
+ s.recursiveDOMDelete(this.manipulationDiv),
+ this._cleanManipulatorHammers()),
+ this._cleanupTemporaryNodesAndEdges(),
+ this._unbindTemporaryUIs(),
+ this._unbindTemporaryEvents(),
+ this.body.emitter.emit("restorePhysics")
+ }
+ }, {
+ key: "_cleanManipulatorHammers",
+ value: function() {
+ if (0 != this.manipulationHammers.length) {
+ for (var e = 0; e < this.manipulationHammers.length; e++)
+ this.manipulationHammers[e].destroy();
+ this.manipulationHammers = []
+ }
+ }
+ }, {
+ key: "_removeManipulationDOM",
+ value: function() {
+ this._clean(),
+ s.recursiveDOMDelete(this.manipulationDiv),
+ s.recursiveDOMDelete(this.editModeDiv),
+ s.recursiveDOMDelete(this.closeDiv),
+ this.manipulationDiv && this.canvas.frame.removeChild(this.manipulationDiv),
+ this.editModeDiv && this.canvas.frame.removeChild(this.editModeDiv),
+ this.closeDiv && this.canvas.frame.removeChild(this.closeDiv),
+ this.manipulationDiv = void 0,
+ this.editModeDiv = void 0,
+ this.closeDiv = void 0
+ }
+ }, {
+ key: "_createSeperator",
+ value: function() {
+ var e = arguments.length <= 0 || void 0 === arguments[0] ? 1 : arguments[0];
+ this.manipulationDOM["seperatorLineDiv" + e] = document.createElement("div"),
+ this.manipulationDOM["seperatorLineDiv" + e].className = "vis-separator-line",
+ this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv" + e])
+ }
+ }, {
+ key: "_createAddNodeButton",
+ value: function(e) {
+ var t = this._createButton("addNode", "vis-button vis-add", e.addNode || this.options.locales.en.addNode);
+ this.manipulationDiv.appendChild(t),
+ this._bindHammerToDiv(t, this.addNodeMode.bind(this))
+ }
+ }, {
+ key: "_createAddEdgeButton",
+ value: function(e) {
+ var t = this._createButton("addEdge", "vis-button vis-connect", e.addEdge || this.options.locales.en.addEdge);
+ this.manipulationDiv.appendChild(t),
+ this._bindHammerToDiv(t, this.addEdgeMode.bind(this))
+ }
+ }, {
+ key: "_createEditNodeButton",
+ value: function(e) {
+ var t = this._createButton("editNode", "vis-button vis-edit", e.editNode || this.options.locales.en.editNode);
+ this.manipulationDiv.appendChild(t),
+ this._bindHammerToDiv(t, this.editNode.bind(this))
+ }
+ }, {
+ key: "_createEditEdgeButton",
+ value: function(e) {
+ var t = this._createButton("editEdge", "vis-button vis-edit", e.editEdge || this.options.locales.en.editEdge);
+ this.manipulationDiv.appendChild(t),
+ this._bindHammerToDiv(t, this.editEdgeMode.bind(this))
+ }
+ }, {
+ key: "_createDeleteButton",
+ value: function(e) {
+ if (this.options.rtl)
+ var t = "vis-button vis-delete-rtl";
+ else
+ var t = "vis-button vis-delete";
+ var i = this._createButton("delete", t, e.del || this.options.locales.en.del);
+ this.manipulationDiv.appendChild(i),
+ this._bindHammerToDiv(i, this.deleteSelected.bind(this))
+ }
+ }, {
+ key: "_createBackButton",
+ value: function(e) {
+ var t = this._createButton("back", "vis-button vis-back", e.back || this.options.locales.en.back);
+ this.manipulationDiv.appendChild(t),
+ this._bindHammerToDiv(t, this.showManipulatorToolbar.bind(this))
+ }
+ }, {
+ key: "_createButton",
+ value: function(e, t, i) {
+ var o = arguments.length <= 3 || void 0 === arguments[3] ? "vis-label" : arguments[3];
+ return this.manipulationDOM[e + "Div"] = document.createElement("div"),
+ this.manipulationDOM[e + "Div"].className = t,
+ this.manipulationDOM[e + "Label"] = document.createElement("div"),
+ this.manipulationDOM[e + "Label"].className = o,
+ this.manipulationDOM[e + "Label"].innerHTML = i,
+ this.manipulationDOM[e + "Div"].appendChild(this.manipulationDOM[e + "Label"]),
+ this.manipulationDOM[e + "Div"]
+ }
+ }, {
+ key: "_createDescription",
+ value: function(e) {
+ this.manipulationDiv.appendChild(this._createButton("description", "vis-button vis-none", e))
+ }
+ }, {
+ key: "_temporaryBindEvent",
+ value: function(e, t) {
+ this.temporaryEventFunctions.push({
+ event: e,
+ boundFunction: t
+ }),
+ this.body.emitter.on(e, t)
+ }
+ }, {
+ key: "_temporaryBindUI",
+ value: function(e, t) {
+ if (void 0 === this.body.eventListeners[e])
+ throw new Error("This UI function does not exist. Typo? You tried: " + e + " possible are: " + JSON.stringify(Object.keys(this.body.eventListeners)));
+ this.temporaryUIFunctions[e] = this.body.eventListeners[e],
+ this.body.eventListeners[e] = t
+ }
+ }, {
+ key: "_unbindTemporaryUIs",
+ value: function() {
+ for (var e in this.temporaryUIFunctions)
+ this.temporaryUIFunctions.hasOwnProperty(e) && (this.body.eventListeners[e] = this.temporaryUIFunctions[e],
+ delete this.temporaryUIFunctions[e]);
+ this.temporaryUIFunctions = {}
+ }
+ }, {
+ key: "_unbindTemporaryEvents",
+ value: function() {
+ for (var e = 0; e < this.temporaryEventFunctions.length; e++) {
+ var t = this.temporaryEventFunctions[e].event
+ , i = this.temporaryEventFunctions[e].boundFunction;
+ this.body.emitter.off(t, i)
+ }
+ this.temporaryEventFunctions = []
+ }
+ }, {
+ key: "_bindHammerToDiv",
+ value: function(e, t) {
+ var i = new r(e,{});
+ a.onTouch(i, t),
+ this.manipulationHammers.push(i)
+ }
+ }, {
+ key: "_cleanupTemporaryNodesAndEdges",
+ value: function() {
+ for (var e = 0; e < this.temporaryIds.edges.length; e++) {
+ this.body.edges[this.temporaryIds.edges[e]].disconnect(),
+ delete this.body.edges[this.temporaryIds.edges[e]];
+ var t = this.body.edgeIndices.indexOf(this.temporaryIds.edges[e]);
+ -1 !== t && this.body.edgeIndices.splice(t, 1)
+ }
+ for (var i = 0; i < this.temporaryIds.nodes.length; i++) {
+ delete this.body.nodes[this.temporaryIds.nodes[i]];
+ var o = this.body.nodeIndices.indexOf(this.temporaryIds.nodes[i]);
+ -1 !== o && this.body.nodeIndices.splice(o, 1)
+ }
+ this.temporaryIds = {
+ nodes: [],
+ edges: []
+ }
+ }
+ }, {
+ key: "_controlNodeTouch",
+ value: function(e) {
+ this.selectionHandler.unselectAll(),
+ this.lastTouch = this.body.functions.getPointer(e.center),
+ this.lastTouch.translation = s.extend({}, this.body.view.translation)
+ }
+ }, {
+ key: "_controlNodeDragStart",
+ value: function(e) {
+ var t = this.lastTouch
+ , i = this.selectionHandler._pointerToPositionObject(t)
+ , o = this.body.nodes[this.temporaryIds.nodes[0]]
+ , n = this.body.nodes[this.temporaryIds.nodes[1]]
+ , s = this.body.edges[this.edgeBeingEditedId];
+ this.selectedControlNode = void 0;
+ var r = o.isOverlappingWith(i)
+ , a = n.isOverlappingWith(i);
+ r === !0 ? (this.selectedControlNode = o,
+ s.edgeType.from = o) : a === !0 && (this.selectedControlNode = n,
+ s.edgeType.to = n),
+ void 0 !== this.selectedControlNode && this.selectionHandler.selectObject(this.selectedControlNode),
+ this.body.emitter.emit("_redraw")
+ }
+ }, {
+ key: "_controlNodeDrag",
+ value: function(e) {
+ this.body.emitter.emit("disablePhysics");
+ var t = this.body.functions.getPointer(e.center)
+ , i = this.canvas.DOMtoCanvas(t);
+ if (void 0 !== this.selectedControlNode)
+ this.selectedControlNode.x = i.x,
+ this.selectedControlNode.y = i.y;
+ else {
+ var o = t.x - this.lastTouch.x
+ , n = t.y - this.lastTouch.y;
+ this.body.view.translation = {
+ x: this.lastTouch.translation.x + o,
+ y: this.lastTouch.translation.y + n
+ }
+ }
+ this.body.emitter.emit("_redraw")
+ }
+ }, {
+ key: "_controlNodeDragEnd",
+ value: function(e) {
+ var t = this.body.functions.getPointer(e.center)
+ , i = this.selectionHandler._pointerToPositionObject(t)
+ , o = this.body.edges[this.edgeBeingEditedId];
+ if (void 0 !== this.selectedControlNode) {
+ this.selectionHandler.unselectAll();
+ for (var n = this.selectionHandler._getAllNodesOverlappingWith(i), s = void 0, r = n.length - 1; r >= 0; r--)
+ if (n[r] !== this.selectedControlNode.id) {
+ s = this.body.nodes[n[r]];
+ break
+ }
+ if (void 0 !== s && void 0 !== this.selectedControlNode)
+ if (s.isCluster === !0)
+ alert(this.options.locales[this.options.locale].createEdgeError || this.options.locales.en.createEdgeError);
+ else {
+ var a = this.body.nodes[this.temporaryIds.nodes[0]];
+ this.selectedControlNode.id === a.id ? this._performEditEdge(s.id, o.to.id) : this._performEditEdge(o.from.id, s.id)
+ }
+ else
+ o.updateEdgeType(),
+ this.body.emitter.emit("restorePhysics");
+ this.body.emitter.emit("_redraw")
+ }
+ }
+ }, {
+ key: "_handleConnect",
+ value: function(e) {
+ if ((new Date).valueOf() - this.touchTime > 100) {
+ this.lastTouch = this.body.functions.getPointer(e.center),
+ this.lastTouch.translation = s.extend({}, this.body.view.translation);
+ var t = this.lastTouch
+ , i = this.selectionHandler.getNodeAt(t);
+ if (void 0 !== i)
+ if (i.isCluster === !0)
+ alert(this.options.locales[this.options.locale].createEdgeError || this.options.locales.en.createEdgeError);
+ else {
+ var o = this._getNewTargetNode(i.x, i.y);
+ this.body.nodes[o.id] = o,
+ this.body.nodeIndices.push(o.id);
+ var n = this.body.functions.createEdge({
+ id: "connectionEdge" + s.randomUUID(),
+ from: i.id,
+ to: o.id,
+ physics: !1,
+ smooth: {
+ enabled: !0,
+ type: "continuous",
+ roundness: .5
+ }
+ });
+ this.body.edges[n.id] = n,
+ this.body.edgeIndices.push(n.id),
+ this.temporaryIds.nodes.push(o.id),
+ this.temporaryIds.edges.push(n.id)
+ }
+ this.touchTime = (new Date).valueOf()
+ }
+ }
+ }, {
+ key: "_dragControlNode",
+ value: function(e) {
+ var t = this.body.functions.getPointer(e.center);
+ if (void 0 !== this.temporaryIds.nodes[0]) {
+ var i = this.body.nodes[this.temporaryIds.nodes[0]];
+ i.x = this.canvas._XconvertDOMtoCanvas(t.x),
+ i.y = this.canvas._YconvertDOMtoCanvas(t.y),
+ this.body.emitter.emit("_redraw")
+ } else {
+ var o = t.x - this.lastTouch.x
+ , n = t.y - this.lastTouch.y;
+ this.body.view.translation = {
+ x: this.lastTouch.translation.x + o,
+ y: this.lastTouch.translation.y + n
+ }
+ }
+ }
+ }, {
+ key: "_finishConnect",
+ value: function(e) {
+ var t = this.body.functions.getPointer(e.center)
+ , i = this.selectionHandler._pointerToPositionObject(t)
+ , o = void 0;
+ void 0 !== this.temporaryIds.edges[0] && (o = this.body.edges[this.temporaryIds.edges[0]].fromId);
+ for (var n = this.selectionHandler._getAllNodesOverlappingWith(i), s = void 0, r = n.length - 1; r >= 0; r--)
+ if (-1 === this.temporaryIds.nodes.indexOf(n[r])) {
+ s = this.body.nodes[n[r]];
+ break
+ }
+ this._cleanupTemporaryNodesAndEdges(),
+ void 0 !== s && (s.isCluster === !0 ? alert(this.options.locales[this.options.locale].createEdgeError || this.options.locales.en.createEdgeError) : void 0 !== this.body.nodes[o] && void 0 !== this.body.nodes[s.id] && this._performAddEdge(o, s.id)),
+ this.body.emitter.emit("_redraw")
+ }
+ }, {
+ key: "_performAddNode",
+ value: function(e) {
+ var t = this
+ , i = {
+ id: s.randomUUID(),
+ x: e.pointer.canvas.x,
+ y: e.pointer.canvas.y,
+ label: "new"
+ };
+ if ("function" == typeof this.options.addNode) {
+ if (2 !== this.options.addNode.length)
+ throw new Error("The function for add does not support two arguments (data,callback)");
+ this.options.addNode(i, function(e) {
+ null !== e && void 0 !== e && "addNode" === t.inMode && (t.body.data.nodes.getDataSet().add(e),
+ t.showManipulatorToolbar())
+ })
+ } else
+ this.body.data.nodes.getDataSet().add(i),
+ this.showManipulatorToolbar()
+ }
+ }, {
+ key: "_performAddEdge",
+ value: function(e, t) {
+ var i = this
+ , o = {
+ from: e,
+ to: t
+ };
+ if ("function" == typeof this.options.addEdge) {
+ if (2 !== this.options.addEdge.length)
+ throw new Error("The function for connect does not support two arguments (data,callback)");
+ this.options.addEdge(o, function(e) {
+ null !== e && void 0 !== e && "addEdge" === i.inMode && (i.body.data.edges.getDataSet().add(e),
+ i.selectionHandler.unselectAll(),
+ i.showManipulatorToolbar())
+ })
+ } else
+ this.body.data.edges.getDataSet().add(o),
+ this.selectionHandler.unselectAll(),
+ this.showManipulatorToolbar()
+ }
+ }, {
+ key: "_performEditEdge",
+ value: function(e, t) {
+ var i = this
+ , o = {
+ id: this.edgeBeingEditedId,
+ from: e,
+ to: t
+ };
+ if ("function" == typeof this.options.editEdge) {
+ if (2 !== this.options.editEdge.length)
+ throw new Error("The function for edit does not support two arguments (data, callback)");
+ this.options.editEdge(o, function(e) {
+ null === e || void 0 === e || "editEdge" !== i.inMode ? (i.body.edges[o.id].updateEdgeType(),
+ i.body.emitter.emit("_redraw")) : (i.body.data.edges.getDataSet().update(e),
+ i.selectionHandler.unselectAll(),
+ i.showManipulatorToolbar())
+ })
+ } else
+ this.body.data.edges.getDataSet().update(o),
+ this.selectionHandler.unselectAll(),
+ this.showManipulatorToolbar()
+ }
+ }]),
+ e
+ }();
+ t["default"] = h
+ }
+ , function(e, t, i) {
+ function o(e) {
+ return e && e.__esModule ? e : {
+ "default": e
+ }
+ }
+ function n(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var s = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
+ return typeof e
+ }
+ : function(e) {
+ return e && "function" == typeof Symbol && e.constructor === Symbol ? "symbol" : typeof e
+ }
+ , r = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , a = i(71)
+ , h = o(a)
+ , d = i(1)
+ , l = function() {
+ function e(t, i, o) {
+ var s = arguments.length <= 3 || void 0 === arguments[3] ? 1 : arguments[3];
+ n(this, e),
+ this.parent = t,
+ this.changedOptions = [],
+ this.container = i,
+ this.allowCreation = !1,
+ this.options = {},
+ this.initialized = !1,
+ this.popupCounter = 0,
+ this.defaultOptions = {
+ enabled: !1,
+ filter: !0,
+ container: void 0,
+ showButton: !0
+ },
+ d.extend(this.options, this.defaultOptions),
+ this.configureOptions = o,
+ this.moduleOptions = {},
+ this.domElements = [],
+ this.popupDiv = {},
+ this.popupLimit = 5,
+ this.popupHistory = {},
+ this.colorPicker = new h["default"](s),
+ this.wrapper = void 0
+ }
+ return r(e, [{
+ key: "setOptions",
+ value: function(e) {
+ if (void 0 !== e) {
+ this.popupHistory = {},
+ this._removePopup();
+ var t = !0;
+ "string" == typeof e ? this.options.filter = e : e instanceof Array ? this.options.filter = e.join() : "object" === ("undefined" == typeof e ? "undefined" : s(e)) ? (void 0 !== e.container && (this.options.container = e.container),
+ void 0 !== e.filter && (this.options.filter = e.filter),
+ void 0 !== e.showButton && (this.options.showButton = e.showButton),
+ void 0 !== e.enabled && (t = e.enabled)) : "boolean" == typeof e ? (this.options.filter = !0,
+ t = e) : "function" == typeof e && (this.options.filter = e,
+ t = !0),
+ this.options.filter === !1 && (t = !1),
+ this.options.enabled = t
+ }
+ this._clean()
+ }
+ }, {
+ key: "setModuleOptions",
+ value: function(e) {
+ this.moduleOptions = e,
+ this.options.enabled === !0 && (this._clean(),
+ void 0 !== this.options.container && (this.container = this.options.container),
+ this._create())
+ }
+ }, {
+ key: "_create",
+ value: function() {
+ var e = this;
+ this._clean(),
+ this.changedOptions = [];
+ var t = this.options.filter
+ , i = 0
+ , o = !1;
+ for (var n in this.configureOptions)
+ this.configureOptions.hasOwnProperty(n) && (this.allowCreation = !1,
+ o = !1,
+ "function" == typeof t ? (o = t(n, []),
+ o = o || this._handleObject(this.configureOptions[n], [n], !0)) : t !== !0 && -1 === t.indexOf(n) || (o = !0),
+ o !== !1 && (this.allowCreation = !0,
+ i > 0 && this._makeItem([]),
+ this._makeHeader(n),
+ this._handleObject(this.configureOptions[n], [n])),
+ i++);
+ this.options.showButton === !0 && !function() {
+ var t = document.createElement("div");
+ t.className = "vis-configuration vis-config-button",
+ t.innerHTML = "generate options",
+ t.onclick = function() {
+ e._printOptions()
+ }
+ ,
+ t.onmouseover = function() {
+ t.className = "vis-configuration vis-config-button hover"
+ }
+ ,
+ t.onmouseout = function() {
+ t.className = "vis-configuration vis-config-button"
+ }
+ ,
+ e.optionsContainer = document.createElement("div"),
+ e.optionsContainer.className = "vis-configuration vis-config-option-container",
+ e.domElements.push(e.optionsContainer),
+ e.domElements.push(t)
+ }(),
+ this._push()
+ }
+ }, {
+ key: "_push",
+ value: function() {
+ this.wrapper = document.createElement("div"),
+ this.wrapper.className = "vis-configuration-wrapper",
+ this.container.appendChild(this.wrapper);
+ for (var e = 0; e < this.domElements.length; e++)
+ this.wrapper.appendChild(this.domElements[e]);
+ this._showPopupIfNeeded()
+ }
+ }, {
+ key: "_clean",
+ value: function() {
+ for (var e = 0; e < this.domElements.length; e++)
+ this.wrapper.removeChild(this.domElements[e]);
+ void 0 !== this.wrapper && (this.container.removeChild(this.wrapper),
+ this.wrapper = void 0),
+ this.domElements = [],
+ this._removePopup()
+ }
+ }, {
+ key: "_getValue",
+ value: function(e) {
+ for (var t = this.moduleOptions, i = 0; i < e.length; i++) {
+ if (void 0 === t[e[i]]) {
+ t = void 0;
+ break
+ }
+ t = t[e[i]]
+ }
+ return t
+ }
+ }, {
+ key: "_makeItem",
+ value: function(e) {
+ var t = arguments
+ , i = this;
+ if (this.allowCreation === !0) {
+ var o, n, r, a = function() {
+ var s = document.createElement("div");
+ for (s.className = "vis-configuration vis-config-item vis-config-s" + e.length,
+ o = t.length,
+ n = Array(o > 1 ? o - 1 : 0),
+ r = 1; o > r; r++)
+ n[r - 1] = t[r];
+ return n.forEach(function(e) {
+ s.appendChild(e)
+ }),
+ i.domElements.push(s),
+ {
+ v: i.domElements.length
+ }
+ }();
+ if ("object" === ("undefined" == typeof a ? "undefined" : s(a)))
+ return a.v
+ }
+ return 0
+ }
+ }, {
+ key: "_makeHeader",
+ value: function(e) {
+ var t = document.createElement("div");
+ t.className = "vis-configuration vis-config-header",
+ t.innerHTML = e,
+ this._makeItem([], t)
+ }
+ }, {
+ key: "_makeLabel",
+ value: function(e, t) {
+ var i = arguments.length <= 2 || void 0 === arguments[2] ? !1 : arguments[2]
+ , o = document.createElement("div");
+ return o.className = "vis-configuration vis-config-label vis-config-s" + t.length,
+ i === !0 ? o.innerHTML = "" + e + ":" : o.innerHTML = e + ":",
+ o
+ }
+ }, {
+ key: "_makeDropdown",
+ value: function(e, t, i) {
+ var o = document.createElement("select");
+ o.className = "vis-configuration vis-config-select";
+ var n = 0;
+ void 0 !== t && -1 !== e.indexOf(t) && (n = e.indexOf(t));
+ for (var s = 0; s < e.length; s++) {
+ var r = document.createElement("option");
+ r.value = e[s],
+ s === n && (r.selected = "selected"),
+ r.innerHTML = e[s],
+ o.appendChild(r)
+ }
+ var a = this;
+ o.onchange = function() {
+ a._update(this.value, i)
+ }
+ ;
+ var h = this._makeLabel(i[i.length - 1], i);
+ this._makeItem(i, h, o)
+ }
+ }, {
+ key: "_makeRange",
+ value: function(e, t, i) {
+ var o = e[0]
+ , n = e[1]
+ , s = e[2]
+ , r = e[3]
+ , a = document.createElement("input");
+ a.className = "vis-configuration vis-config-range";
+ try {
+ a.type = "range",
+ a.min = n,
+ a.max = s
+ } catch (h) {}
+ a.step = r;
+ var d = ""
+ , l = 0;
+ if (void 0 !== t) {
+ var c = 1.2;
+ 0 > t && n > t * c ? (a.min = Math.ceil(t * c),
+ l = a.min,
+ d = "range increased") : n > t / c && (a.min = Math.ceil(t / c),
+ l = a.min,
+ d = "range increased"),
+ t * c > s && 1 !== s && (a.max = Math.ceil(t * c),
+ l = a.max,
+ d = "range increased"),
+ a.value = t
+ } else
+ a.value = o;
+ var u = document.createElement("input");
+ u.className = "vis-configuration vis-config-rangeinput",
+ u.value = a.value;
+ var f = this;
+ a.onchange = function() {
+ u.value = this.value,
+ f._update(Number(this.value), i)
+ }
+ ,
+ a.oninput = function() {
+ u.value = this.value
+ }
+ ;
+ var p = this._makeLabel(i[i.length - 1], i)
+ , v = this._makeItem(i, p, a, u);
+ "" !== d && this.popupHistory[v] !== l && (this.popupHistory[v] = l,
+ this._setupPopup(d, v))
+ }
+ }, {
+ key: "_setupPopup",
+ value: function(e, t) {
+ var i = this;
+ if (this.initialized === !0 && this.allowCreation === !0 && this.popupCounter < this.popupLimit) {
+ var o = document.createElement("div");
+ o.id = "vis-configuration-popup",
+ o.className = "vis-configuration-popup",
+ o.innerHTML = e,
+ o.onclick = function() {
+ i._removePopup()
+ }
+ ,
+ this.popupCounter += 1,
+ this.popupDiv = {
+ html: o,
+ index: t
+ }
+ }
+ }
+ }, {
+ key: "_removePopup",
+ value: function() {
+ void 0 !== this.popupDiv.html && (this.popupDiv.html.parentNode.removeChild(this.popupDiv.html),
+ clearTimeout(this.popupDiv.hideTimeout),
+ clearTimeout(this.popupDiv.deleteTimeout),
+ this.popupDiv = {})
+ }
+ }, {
+ key: "_showPopupIfNeeded",
+ value: function() {
+ var e = this;
+ if (void 0 !== this.popupDiv.html) {
+ var t = this.domElements[this.popupDiv.index]
+ , i = t.getBoundingClientRect();
+ this.popupDiv.html.style.left = i.left + "px",
+ this.popupDiv.html.style.top = i.top - 30 + "px",
+ document.body.appendChild(this.popupDiv.html),
+ this.popupDiv.hideTimeout = setTimeout(function() {
+ e.popupDiv.html.style.opacity = 0
+ }, 1500),
+ this.popupDiv.deleteTimeout = setTimeout(function() {
+ e._removePopup()
+ }, 1800)
+ }
+ }
+ }, {
+ key: "_makeCheckbox",
+ value: function(e, t, i) {
+ var o = document.createElement("input");
+ o.type = "checkbox",
+ o.className = "vis-configuration vis-config-checkbox",
+ o.checked = e,
+ void 0 !== t && (o.checked = t,
+ t !== e && ("object" === ("undefined" == typeof e ? "undefined" : s(e)) ? t !== e.enabled && this.changedOptions.push({
+ path: i,
+ value: t
+ }) : this.changedOptions.push({
+ path: i,
+ value: t
+ })));
+ var n = this;
+ o.onchange = function() {
+ n._update(this.checked, i)
+ }
+ ;
+ var r = this._makeLabel(i[i.length - 1], i);
+ this._makeItem(i, r, o)
+ }
+ }, {
+ key: "_makeTextInput",
+ value: function(e, t, i) {
+ var o = document.createElement("input");
+ o.type = "text",
+ o.className = "vis-configuration vis-config-text",
+ o.value = t,
+ t !== e && this.changedOptions.push({
+ path: i,
+ value: t
+ });
+ var n = this;
+ o.onchange = function() {
+ n._update(this.value, i)
+ }
+ ;
+ var s = this._makeLabel(i[i.length - 1], i);
+ this._makeItem(i, s, o)
+ }
+ }, {
+ key: "_makeColorField",
+ value: function(e, t, i) {
+ var o = this
+ , n = e[1]
+ , s = document.createElement("div");
+ t = void 0 === t ? n : t,
+ "none" !== t ? (s.className = "vis-configuration vis-config-colorBlock",
+ s.style.backgroundColor = t) : s.className = "vis-configuration vis-config-colorBlock none",
+ t = void 0 === t ? n : t,
+ s.onclick = function() {
+ o._showColorPicker(t, s, i)
+ }
+ ;
+ var r = this._makeLabel(i[i.length - 1], i);
+ this._makeItem(i, r, s)
+ }
+ }, {
+ key: "_showColorPicker",
+ value: function(e, t, i) {
+ var o = this;
+ t.onclick = function() {}
+ ,
+ this.colorPicker.insertTo(t),
+ this.colorPicker.show(),
+ this.colorPicker.setColor(e),
+ this.colorPicker.setUpdateCallback(function(e) {
+ var n = "rgba(" + e.r + "," + e.g + "," + e.b + "," + e.a + ")";
+ t.style.backgroundColor = n,
+ o._update(n, i)
+ }),
+ this.colorPicker.setCloseCallback(function() {
+ t.onclick = function() {
+ o._showColorPicker(e, t, i)
+ }
+ })
+ }
+ }, {
+ key: "_handleObject",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? [] : arguments[1]
+ , i = arguments.length <= 2 || void 0 === arguments[2] ? !1 : arguments[2]
+ , o = !1
+ , n = this.options.filter
+ , s = !1;
+ for (var r in e)
+ if (e.hasOwnProperty(r)) {
+ o = !0;
+ var a = e[r]
+ , h = d.copyAndExtendArray(t, r);
+ if ("function" == typeof n && (o = n(r, t),
+ o === !1 && !(a instanceof Array) && "string" != typeof a && "boolean" != typeof a && a instanceof Object && (this.allowCreation = !1,
+ o = this._handleObject(a, h, !0),
+ this.allowCreation = i === !1)),
+ o !== !1) {
+ s = !0;
+ var l = this._getValue(h);
+ if (a instanceof Array)
+ this._handleArray(a, l, h);
+ else if ("string" == typeof a)
+ this._makeTextInput(a, l, h);
+ else if ("boolean" == typeof a)
+ this._makeCheckbox(a, l, h);
+ else if (a instanceof Object) {
+ var c = !0;
+ if (-1 !== t.indexOf("physics") && this.moduleOptions.physics.solver !== r && (c = !1),
+ c === !0)
+ if (void 0 !== a.enabled) {
+ var u = d.copyAndExtendArray(h, "enabled")
+ , f = this._getValue(u);
+ if (f === !0) {
+ var p = this._makeLabel(r, h, !0);
+ this._makeItem(h, p),
+ s = this._handleObject(a, h) || s
+ } else
+ this._makeCheckbox(a, f, h)
+ } else {
+ var v = this._makeLabel(r, h, !0);
+ this._makeItem(h, v),
+ s = this._handleObject(a, h) || s
+ }
+ } else
+ console.error("dont know how to handle", a, r, h)
+ }
+ }
+ return s
+ }
+ }, {
+ key: "_handleArray",
+ value: function(e, t, i) {
+ "string" == typeof e[0] && "color" === e[0] ? (this._makeColorField(e, t, i),
+ e[1] !== t && this.changedOptions.push({
+ path: i,
+ value: t
+ })) : "string" == typeof e[0] ? (this._makeDropdown(e, t, i),
+ e[0] !== t && this.changedOptions.push({
+ path: i,
+ value: t
+ })) : "number" == typeof e[0] && (this._makeRange(e, t, i),
+ e[0] !== t && this.changedOptions.push({
+ path: i,
+ value: Number(t)
+ }))
+ }
+ }, {
+ key: "_update",
+ value: function(e, t) {
+ var i = this._constructOptions(e, t);
+ this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit && this.parent.body.emitter.emit("configChange", i),
+ this.initialized = !0,
+ this.parent.setOptions(i)
+ }
+ }, {
+ key: "_constructOptions",
+ value: function(e, t) {
+ var i = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2]
+ , o = i;
+ e = "true" === e ? !0 : e,
+ e = "false" === e ? !1 : e;
+ for (var n = 0; n < t.length; n++)
+ "global" !== t[n] && (void 0 === o[t[n]] && (o[t[n]] = {}),
+ n !== t.length - 1 ? o = o[t[n]] : o[t[n]] = e);
+ return i
+ }
+ }, {
+ key: "_printOptions",
+ value: function() {
+ var e = this.getOptions();
+ this.optionsContainer.innerHTML = "var options = " + JSON.stringify(e, null, 2) + "
"
+ }
+ }, {
+ key: "getOptions",
+ value: function() {
+ for (var e = {}, t = 0; t < this.changedOptions.length; t++)
+ this._constructOptions(this.changedOptions[t].value, this.changedOptions[t].path, e);
+ return e
+ }
+ }]),
+ e
+ }();
+ t["default"] = l
+ }
+ , function(e, t, i) {
+ function o(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var n = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , s = i(58)
+ , r = i(61)
+ , a = i(1)
+ , h = function() {
+ function e() {
+ var t = arguments.length <= 0 || void 0 === arguments[0] ? 1 : arguments[0];
+ o(this, e),
+ this.pixelRatio = t,
+ this.generated = !1,
+ this.centerCoordinates = {
+ x: 144.5,
+ y: 144.5
+ },
+ this.r = 289 * .49,
+ this.color = {
+ r: 255,
+ g: 255,
+ b: 255,
+ a: 1
+ },
+ this.hueCircle = void 0,
+ this.initialColor = {
+ r: 255,
+ g: 255,
+ b: 255,
+ a: 1
+ },
+ this.previousColor = void 0,
+ this.applied = !1,
+ this.updateCallback = function() {}
+ ,
+ this.closeCallback = function() {}
+ ,
+ this._create()
+ }
+ return n(e, [{
+ key: "insertTo",
+ value: function(e) {
+ void 0 !== this.hammer && (this.hammer.destroy(),
+ this.hammer = void 0),
+ this.container = e,
+ this.container.appendChild(this.frame),
+ this._bindHammer(),
+ this._setSize()
+ }
+ }, {
+ key: "setUpdateCallback",
+ value: function(e) {
+ if ("function" != typeof e)
+ throw new Error("Function attempted to set as colorPicker update callback is not a function.");
+ this.updateCallback = e
+ }
+ }, {
+ key: "setCloseCallback",
+ value: function(e) {
+ if ("function" != typeof e)
+ throw new Error("Function attempted to set as colorPicker closing callback is not a function.");
+ this.closeCallback = e
+ }
+ }, {
+ key: "_isColorString",
+ value: function(e) {
+ var t = {
+ black: "#000000",
+ navy: "#000080",
+ darkblue: "#00008B",
+ mediumblue: "#0000CD",
+ blue: "#0000FF",
+ darkgreen: "#006400",
+ green: "#008000",
+ teal: "#008080",
+ darkcyan: "#008B8B",
+ deepskyblue: "#00BFFF",
+ darkturquoise: "#00CED1",
+ mediumspringgreen: "#00FA9A",
+ lime: "#00FF00",
+ springgreen: "#00FF7F",
+ aqua: "#00FFFF",
+ cyan: "#00FFFF",
+ midnightblue: "#191970",
+ dodgerblue: "#1E90FF",
+ lightseagreen: "#20B2AA",
+ forestgreen: "#228B22",
+ seagreen: "#2E8B57",
+ darkslategray: "#2F4F4F",
+ limegreen: "#32CD32",
+ mediumseagreen: "#3CB371",
+ turquoise: "#40E0D0",
+ royalblue: "#4169E1",
+ steelblue: "#4682B4",
+ darkslateblue: "#483D8B",
+ mediumturquoise: "#48D1CC",
+ indigo: "#4B0082",
+ darkolivegreen: "#556B2F",
+ cadetblue: "#5F9EA0",
+ cornflowerblue: "#6495ED",
+ mediumaquamarine: "#66CDAA",
+ dimgray: "#696969",
+ slateblue: "#6A5ACD",
+ olivedrab: "#6B8E23",
+ slategray: "#708090",
+ lightslategray: "#778899",
+ mediumslateblue: "#7B68EE",
+ lawngreen: "#7CFC00",
+ chartreuse: "#7FFF00",
+ aquamarine: "#7FFFD4",
+ maroon: "#800000",
+ purple: "#800080",
+ olive: "#808000",
+ gray: "#808080",
+ skyblue: "#87CEEB",
+ lightskyblue: "#87CEFA",
+ blueviolet: "#8A2BE2",
+ darkred: "#8B0000",
+ darkmagenta: "#8B008B",
+ saddlebrown: "#8B4513",
+ darkseagreen: "#8FBC8F",
+ lightgreen: "#90EE90",
+ mediumpurple: "#9370D8",
+ darkviolet: "#9400D3",
+ palegreen: "#98FB98",
+ darkorchid: "#9932CC",
+ yellowgreen: "#9ACD32",
+ sienna: "#A0522D",
+ brown: "#A52A2A",
+ darkgray: "#A9A9A9",
+ lightblue: "#ADD8E6",
+ greenyellow: "#ADFF2F",
+ paleturquoise: "#AFEEEE",
+ lightsteelblue: "#B0C4DE",
+ powderblue: "#B0E0E6",
+ firebrick: "#B22222",
+ darkgoldenrod: "#B8860B",
+ mediumorchid: "#BA55D3",
+ rosybrown: "#BC8F8F",
+ darkkhaki: "#BDB76B",
+ silver: "#C0C0C0",
+ mediumvioletred: "#C71585",
+ indianred: "#CD5C5C",
+ peru: "#CD853F",
+ chocolate: "#D2691E",
+ tan: "#D2B48C",
+ lightgrey: "#D3D3D3",
+ palevioletred: "#D87093",
+ thistle: "#D8BFD8",
+ orchid: "#DA70D6",
+ goldenrod: "#DAA520",
+ crimson: "#DC143C",
+ gainsboro: "#DCDCDC",
+ plum: "#DDA0DD",
+ burlywood: "#DEB887",
+ lightcyan: "#E0FFFF",
+ lavender: "#E6E6FA",
+ darksalmon: "#E9967A",
+ violet: "#EE82EE",
+ palegoldenrod: "#EEE8AA",
+ lightcoral: "#F08080",
+ khaki: "#F0E68C",
+ aliceblue: "#F0F8FF",
+ honeydew: "#F0FFF0",
+ azure: "#F0FFFF",
+ sandybrown: "#F4A460",
+ wheat: "#F5DEB3",
+ beige: "#F5F5DC",
+ whitesmoke: "#F5F5F5",
+ mintcream: "#F5FFFA",
+ ghostwhite: "#F8F8FF",
+ salmon: "#FA8072",
+ antiquewhite: "#FAEBD7",
+ linen: "#FAF0E6",
+ lightgoldenrodyellow: "#FAFAD2",
+ oldlace: "#FDF5E6",
+ red: "#FF0000",
+ fuchsia: "#FF00FF",
+ magenta: "#FF00FF",
+ deeppink: "#FF1493",
+ orangered: "#FF4500",
+ tomato: "#FF6347",
+ hotpink: "#FF69B4",
+ coral: "#FF7F50",
+ darkorange: "#FF8C00",
+ lightsalmon: "#FFA07A",
+ orange: "#FFA500",
+ lightpink: "#FFB6C1",
+ pink: "#FFC0CB",
+ gold: "#FFD700",
+ peachpuff: "#FFDAB9",
+ navajowhite: "#FFDEAD",
+ moccasin: "#FFE4B5",
+ bisque: "#FFE4C4",
+ mistyrose: "#FFE4E1",
+ blanchedalmond: "#FFEBCD",
+ papayawhip: "#FFEFD5",
+ lavenderblush: "#FFF0F5",
+ seashell: "#FFF5EE",
+ cornsilk: "#FFF8DC",
+ lemonchiffon: "#FFFACD",
+ floralwhite: "#FFFAF0",
+ snow: "#FFFAFA",
+ yellow: "#FFFF00",
+ lightyellow: "#FFFFE0",
+ ivory: "#FFFFF0",
+ white: "#FFFFFF"
+ };
+ return "string" == typeof e ? t[e] : void 0
+ }
+ }, {
+ key: "setColor",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? !0 : arguments[1];
+ if ("none" !== e) {
+ var i = void 0
+ , o = this._isColorString(e);
+ if (void 0 !== o && (e = o),
+ a.isString(e) === !0) {
+ if (a.isValidRGB(e) === !0) {
+ var n = e.substr(4).substr(0, e.length - 5).split(",");
+ i = {
+ r: n[0],
+ g: n[1],
+ b: n[2],
+ a: 1
+ }
+ } else if (a.isValidRGBA(e) === !0) {
+ var s = e.substr(5).substr(0, e.length - 6).split(",");
+ i = {
+ r: s[0],
+ g: s[1],
+ b: s[2],
+ a: s[3]
+ }
+ } else if (a.isValidHex(e) === !0) {
+ var r = a.hexToRGB(e);
+ i = {
+ r: r.r,
+ g: r.g,
+ b: r.b,
+ a: 1
+ }
+ }
+ } else if (e instanceof Object && void 0 !== e.r && void 0 !== e.g && void 0 !== e.b) {
+ var h = void 0 !== e.a ? e.a : "1.0";
+ i = {
+ r: e.r,
+ g: e.g,
+ b: e.b,
+ a: h
+ }
+ }
+ if (void 0 === i)
+ throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + JSON.stringify(e));
+ this._setColor(i, t)
+ }
+ }
+ }, {
+ key: "show",
+ value: function() {
+ void 0 !== this.closeCallback && (this.closeCallback(),
+ this.closeCallback = void 0),
+ this.applied = !1,
+ this.frame.style.display = "block",
+ this._generateHueCircle()
+ }
+ }, {
+ key: "_hide",
+ value: function() {
+ var e = this
+ , t = arguments.length <= 0 || void 0 === arguments[0] ? !0 : arguments[0];
+ t === !0 && (this.previousColor = a.extend({}, this.color)),
+ this.applied === !0 && this.updateCallback(this.initialColor),
+ this.frame.style.display = "none",
+ setTimeout(function() {
+ void 0 !== e.closeCallback && (e.closeCallback(),
+ e.closeCallback = void 0)
+ }, 0)
+ }
+ }, {
+ key: "_save",
+ value: function() {
+ this.updateCallback(this.color),
+ this.applied = !1,
+ this._hide()
+ }
+ }, {
+ key: "_apply",
+ value: function() {
+ this.applied = !0,
+ this.updateCallback(this.color),
+ this._updatePicker(this.color)
+ }
+ }, {
+ key: "_loadLast",
+ value: function() {
+ void 0 !== this.previousColor ? this.setColor(this.previousColor, !1) : alert("There is no last color to load...")
+ }
+ }, {
+ key: "_setColor",
+ value: function(e) {
+ var t = arguments.length <= 1 || void 0 === arguments[1] ? !0 : arguments[1];
+ t === !0 && (this.initialColor = a.extend({}, e)),
+ this.color = e;
+ var i = a.RGBToHSV(e.r, e.g, e.b)
+ , o = 2 * Math.PI
+ , n = this.r * i.s
+ , s = this.centerCoordinates.x + n * Math.sin(o * i.h)
+ , r = this.centerCoordinates.y + n * Math.cos(o * i.h);
+ this.colorPickerSelector.style.left = s - .5 * this.colorPickerSelector.clientWidth + "px",
+ this.colorPickerSelector.style.top = r - .5 * this.colorPickerSelector.clientHeight + "px",
+ this._updatePicker(e)
+ }
+ }, {
+ key: "_setOpacity",
+ value: function(e) {
+ this.color.a = e / 100,
+ this._updatePicker(this.color)
+ }
+ }, {
+ key: "_setBrightness",
+ value: function(e) {
+ var t = a.RGBToHSV(this.color.r, this.color.g, this.color.b);
+ t.v = e / 100;
+ var i = a.HSVToRGB(t.h, t.s, t.v);
+ i.a = this.color.a,
+ this.color = i,
+ this._updatePicker()
+ }
+ }, {
+ key: "_updatePicker",
+ value: function() {
+ var e = arguments.length <= 0 || void 0 === arguments[0] ? this.color : arguments[0]
+ , t = a.RGBToHSV(e.r, e.g, e.b)
+ , i = this.colorPickerCanvas.getContext("2d");
+ void 0 === this.pixelRation && (this.pixelRatio = (window.devicePixelRatio || 1) / (i.webkitBackingStorePixelRatio || i.mozBackingStorePixelRatio || i.msBackingStorePixelRatio || i.oBackingStorePixelRatio || i.backingStorePixelRatio || 1)),
+ i.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+ var o = this.colorPickerCanvas.clientWidth
+ , n = this.colorPickerCanvas.clientHeight;
+ i.clearRect(0, 0, o, n),
+ i.putImageData(this.hueCircle, 0, 0),
+ i.fillStyle = "rgba(0,0,0," + (1 - t.v) + ")",
+ i.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r),
+ i.fill(),
+ this.brightnessRange.value = 100 * t.v,
+ this.opacityRange.value = 100 * e.a,
+ this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")",
+ this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")"
+ }
+ }, {
+ key: "_setSize",
+ value: function() {
+ this.colorPickerCanvas.style.width = "100%",
+ this.colorPickerCanvas.style.height = "100%",
+ this.colorPickerCanvas.width = 289 * this.pixelRatio,
+ this.colorPickerCanvas.height = 289 * this.pixelRatio
+ }
+ }, {
+ key: "_create",
+ value: function() {
+ if (this.frame = document.createElement("div"),
+ this.frame.className = "vis-color-picker",
+ this.colorPickerDiv = document.createElement("div"),
+ this.colorPickerSelector = document.createElement("div"),
+ this.colorPickerSelector.className = "vis-selector",
+ this.colorPickerDiv.appendChild(this.colorPickerSelector),
+ this.colorPickerCanvas = document.createElement("canvas"),
+ this.colorPickerDiv.appendChild(this.colorPickerCanvas),
+ this.colorPickerCanvas.getContext) {
+ var e = this.colorPickerCanvas.getContext("2d");
+ this.pixelRatio = (window.devicePixelRatio || 1) / (e.webkitBackingStorePixelRatio || e.mozBackingStorePixelRatio || e.msBackingStorePixelRatio || e.oBackingStorePixelRatio || e.backingStorePixelRatio || 1),
+ this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0)
+ } else {
+ var t = document.createElement("DIV");
+ t.style.color = "red",
+ t.style.fontWeight = "bold",
+ t.style.padding = "10px",
+ t.innerHTML = "Error: your browser does not support HTML canvas",
+ this.colorPickerCanvas.appendChild(t)
+ }
+ this.colorPickerDiv.className = "vis-color",
+ this.opacityDiv = document.createElement("div"),
+ this.opacityDiv.className = "vis-opacity",
+ this.brightnessDiv = document.createElement("div"),
+ this.brightnessDiv.className = "vis-brightness",
+ this.arrowDiv = document.createElement("div"),
+ this.arrowDiv.className = "vis-arrow",
+ this.opacityRange = document.createElement("input");
+ try {
+ this.opacityRange.type = "range",
+ this.opacityRange.min = "0",
+ this.opacityRange.max = "100"
+ } catch (i) {}
+ this.opacityRange.value = "100",
+ this.opacityRange.className = "vis-range",
+ this.brightnessRange = document.createElement("input");
+ try {
+ this.brightnessRange.type = "range",
+ this.brightnessRange.min = "0",
+ this.brightnessRange.max = "100"
+ } catch (i) {}
+ this.brightnessRange.value = "100",
+ this.brightnessRange.className = "vis-range",
+ this.opacityDiv.appendChild(this.opacityRange),
+ this.brightnessDiv.appendChild(this.brightnessRange);
+ var o = this;
+ this.opacityRange.onchange = function() {
+ o._setOpacity(this.value)
+ }
+ ,
+ this.opacityRange.oninput = function() {
+ o._setOpacity(this.value)
+ }
+ ,
+ this.brightnessRange.onchange = function() {
+ o._setBrightness(this.value)
+ }
+ ,
+ this.brightnessRange.oninput = function() {
+ o._setBrightness(this.value)
+ }
+ ,
+ this.brightnessLabel = document.createElement("div"),
+ this.brightnessLabel.className = "vis-label vis-brightness",
+ this.brightnessLabel.innerHTML = "brightness:",
+ this.opacityLabel = document.createElement("div"),
+ this.opacityLabel.className = "vis-label vis-opacity",
+ this.opacityLabel.innerHTML = "opacity:",
+ this.newColorDiv = document.createElement("div"),
+ this.newColorDiv.className = "vis-new-color",
+ this.newColorDiv.innerHTML = "new",
+ this.initialColorDiv = document.createElement("div"),
+ this.initialColorDiv.className = "vis-initial-color",
+ this.initialColorDiv.innerHTML = "initial",
+ this.cancelButton = document.createElement("div"),
+ this.cancelButton.className = "vis-button vis-cancel",
+ this.cancelButton.innerHTML = "cancel",
+ this.cancelButton.onclick = this._hide.bind(this, !1),
+ this.applyButton = document.createElement("div"),
+ this.applyButton.className = "vis-button vis-apply",
+ this.applyButton.innerHTML = "apply",
+ this.applyButton.onclick = this._apply.bind(this),
+ this.saveButton = document.createElement("div"),
+ this.saveButton.className = "vis-button vis-save",
+ this.saveButton.innerHTML = "save",
+ this.saveButton.onclick = this._save.bind(this),
+ this.loadButton = document.createElement("div"),
+ this.loadButton.className = "vis-button vis-load",
+ this.loadButton.innerHTML = "load last",
+ this.loadButton.onclick = this._loadLast.bind(this),
+ this.frame.appendChild(this.colorPickerDiv),
+ this.frame.appendChild(this.arrowDiv),
+ this.frame.appendChild(this.brightnessLabel),
+ this.frame.appendChild(this.brightnessDiv),
+ this.frame.appendChild(this.opacityLabel),
+ this.frame.appendChild(this.opacityDiv),
+ this.frame.appendChild(this.newColorDiv),
+ this.frame.appendChild(this.initialColorDiv),
+ this.frame.appendChild(this.cancelButton),
+ this.frame.appendChild(this.applyButton),
+ this.frame.appendChild(this.saveButton),
+ this.frame.appendChild(this.loadButton)
+ }
+ }, {
+ key: "_bindHammer",
+ value: function() {
+ var e = this;
+ this.drag = {},
+ this.pinch = {},
+ this.hammer = new s(this.colorPickerCanvas),
+ this.hammer.get("pinch").set({
+ enable: !0
+ }),
+ r.onTouch(this.hammer, function(t) {
+ e._moveSelector(t)
+ }),
+ this.hammer.on("tap", function(t) {
+ e._moveSelector(t)
+ }),
+ this.hammer.on("panstart", function(t) {
+ e._moveSelector(t)
+ }),
+ this.hammer.on("panmove", function(t) {
+ e._moveSelector(t)
+ }),
+ this.hammer.on("panend", function(t) {
+ e._moveSelector(t)
+ })
+ }
+ }, {
+ key: "_generateHueCircle",
+ value: function() {
+ if (this.generated === !1) {
+ var e = this.colorPickerCanvas.getContext("2d");
+ void 0 === this.pixelRation && (this.pixelRatio = (window.devicePixelRatio || 1) / (e.webkitBackingStorePixelRatio || e.mozBackingStorePixelRatio || e.msBackingStorePixelRatio || e.oBackingStorePixelRatio || e.backingStorePixelRatio || 1)),
+ e.setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0);
+ var t = this.colorPickerCanvas.clientWidth
+ , i = this.colorPickerCanvas.clientHeight;
+ e.clearRect(0, 0, t, i);
+ var o = void 0
+ , n = void 0
+ , s = void 0
+ , r = void 0;
+ this.centerCoordinates = {
+ x: .5 * t,
+ y: .5 * i
+ },
+ this.r = .49 * t;
+ var h = 2 * Math.PI / 360
+ , d = 1 / 360
+ , l = 1 / this.r
+ , c = void 0;
+ for (s = 0; 360 > s; s++)
+ for (r = 0; r < this.r; r++)
+ o = this.centerCoordinates.x + r * Math.sin(h * s),
+ n = this.centerCoordinates.y + r * Math.cos(h * s),
+ c = a.HSVToRGB(s * d, r * l, 1),
+ e.fillStyle = "rgb(" + c.r + "," + c.g + "," + c.b + ")",
+ e.fillRect(o - .5, n - .5, 2, 2);
+ e.strokeStyle = "rgba(0,0,0,1)",
+ e.circle(this.centerCoordinates.x, this.centerCoordinates.y, this.r),
+ e.stroke(),
+ this.hueCircle = e.getImageData(0, 0, t, i)
+ }
+ this.generated = !0
+ }
+ }, {
+ key: "_moveSelector",
+ value: function(e) {
+ var t = this.colorPickerDiv.getBoundingClientRect()
+ , i = e.center.x - t.left
+ , o = e.center.y - t.top
+ , n = .5 * this.colorPickerDiv.clientHeight
+ , s = .5 * this.colorPickerDiv.clientWidth
+ , r = i - s
+ , h = o - n
+ , d = Math.atan2(r, h)
+ , l = .98 * Math.min(Math.sqrt(r * r + h * h), s)
+ , c = Math.cos(d) * l + n
+ , u = Math.sin(d) * l + s;
+ this.colorPickerSelector.style.top = c - .5 * this.colorPickerSelector.clientHeight + "px",
+ this.colorPickerSelector.style.left = u - .5 * this.colorPickerSelector.clientWidth + "px";
+ var f = d / (2 * Math.PI);
+ f = 0 > f ? f + 1 : f;
+ var p = l / this.r
+ , v = a.RGBToHSV(this.color.r, this.color.g, this.color.b);
+ v.h = f,
+ v.s = p;
+ var y = a.HSVToRGB(v.h, v.s, v.v);
+ y.a = this.color.a,
+ this.color = y,
+ this.initialColorDiv.style.backgroundColor = "rgba(" + this.initialColor.r + "," + this.initialColor.g + "," + this.initialColor.b + "," + this.initialColor.a + ")",
+ this.newColorDiv.style.backgroundColor = "rgba(" + this.color.r + "," + this.color.g + "," + this.color.b + "," + this.color.a + ")"
+ }
+ }]),
+ e
+ }();
+ t["default"] = h
+ }
+ , function(e, t) {
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var i = "string"
+ , o = "boolean"
+ , n = "number"
+ , s = "array"
+ , r = "object"
+ , a = "dom"
+ , h = "any"
+ , d = {
+ configure: {
+ enabled: {
+ "boolean": o
+ },
+ filter: {
+ "boolean": o,
+ string: i,
+ array: s,
+ "function": "function"
+ },
+ container: {
+ dom: a
+ },
+ showButton: {
+ "boolean": o
+ },
+ __type__: {
+ object: r,
+ "boolean": o,
+ string: i,
+ array: s,
+ "function": "function"
+ }
+ },
+ edges: {
+ arrows: {
+ to: {
+ enabled: {
+ "boolean": o
+ },
+ scaleFactor: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ middle: {
+ enabled: {
+ "boolean": o
+ },
+ scaleFactor: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ from: {
+ enabled: {
+ "boolean": o
+ },
+ scaleFactor: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ __type__: {
+ string: ["from", "to", "middle"],
+ object: r
+ }
+ },
+ arrowStrikethrough: {
+ "boolean": o
+ },
+ color: {
+ color: {
+ string: i
+ },
+ highlight: {
+ string: i
+ },
+ hover: {
+ string: i
+ },
+ inherit: {
+ string: ["from", "to", "both"],
+ "boolean": o
+ },
+ opacity: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ string: i
+ }
+ },
+ dashes: {
+ "boolean": o,
+ array: s
+ },
+ font: {
+ color: {
+ string: i
+ },
+ size: {
+ number: n
+ },
+ face: {
+ string: i
+ },
+ background: {
+ string: i
+ },
+ strokeWidth: {
+ number: n
+ },
+ strokeColor: {
+ string: i
+ },
+ align: {
+ string: ["horizontal", "top", "middle", "bottom"]
+ },
+ __type__: {
+ object: r,
+ string: i
+ }
+ },
+ hidden: {
+ "boolean": o
+ },
+ hoverWidth: {
+ "function": "function",
+ number: n
+ },
+ label: {
+ string: i,
+ undefined: "undefined"
+ },
+ labelHighlightBold: {
+ "boolean": o
+ },
+ length: {
+ number: n,
+ undefined: "undefined"
+ },
+ physics: {
+ "boolean": o
+ },
+ scaling: {
+ min: {
+ number: n
+ },
+ max: {
+ number: n
+ },
+ label: {
+ enabled: {
+ "boolean": o
+ },
+ min: {
+ number: n
+ },
+ max: {
+ number: n
+ },
+ maxVisible: {
+ number: n
+ },
+ drawThreshold: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ customScalingFunction: {
+ "function": "function"
+ },
+ __type__: {
+ object: r
+ }
+ },
+ selectionWidth: {
+ "function": "function",
+ number: n
+ },
+ selfReferenceSize: {
+ number: n
+ },
+ shadow: {
+ enabled: {
+ "boolean": o
+ },
+ color: {
+ string: i
+ },
+ size: {
+ number: n
+ },
+ x: {
+ number: n
+ },
+ y: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ smooth: {
+ enabled: {
+ "boolean": o
+ },
+ type: {
+ string: ["dynamic", "continuous", "discrete", "diagonalCross", "straightCross", "horizontal", "vertical", "curvedCW", "curvedCCW", "cubicBezier"]
+ },
+ roundness: {
+ number: n
+ },
+ forceDirection: {
+ string: ["horizontal", "vertical", "none"],
+ "boolean": o
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ title: {
+ string: i,
+ undefined: "undefined"
+ },
+ width: {
+ number: n
+ },
+ value: {
+ number: n,
+ undefined: "undefined"
+ },
+ __type__: {
+ object: r
+ }
+ },
+ groups: {
+ useDefaultGroups: {
+ "boolean": o
+ },
+ __any__: "get from nodes, will be overwritten below",
+ __type__: {
+ object: r
+ }
+ },
+ interaction: {
+ dragNodes: {
+ "boolean": o
+ },
+ dragView: {
+ "boolean": o
+ },
+ hideEdgesOnDrag: {
+ "boolean": o
+ },
+ hideNodesOnDrag: {
+ "boolean": o
+ },
+ hover: {
+ "boolean": o
+ },
+ keyboard: {
+ enabled: {
+ "boolean": o
+ },
+ speed: {
+ x: {
+ number: n
+ },
+ y: {
+ number: n
+ },
+ zoom: {
+ number: n
+ },
+ __type__: {
+ object: r
+ }
+ },
+ bindToWindow: {
+ "boolean": o
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ multiselect: {
+ "boolean": o
+ },
+ navigationButtons: {
+ "boolean": o
+ },
+ selectable: {
+ "boolean": o
+ },
+ selectConnectedEdges: {
+ "boolean": o
+ },
+ hoverConnectedEdges: {
+ "boolean": o
+ },
+ tooltipDelay: {
+ number: n
+ },
+ zoomView: {
+ "boolean": o
+ },
+ __type__: {
+ object: r
+ }
+ },
+ layout: {
+ randomSeed: {
+ undefined: "undefined",
+ number: n
+ },
+ improvedLayout: {
+ "boolean": o
+ },
+ hierarchical: {
+ enabled: {
+ "boolean": o
+ },
+ levelSeparation: {
+ number: n
+ },
+ nodeSpacing: {
+ number: n
+ },
+ treeSpacing: {
+ number: n
+ },
+ blockShifting: {
+ "boolean": o
+ },
+ edgeMinimization: {
+ "boolean": o
+ },
+ parentCentralization: {
+ "boolean": o
+ },
+ direction: {
+ string: ["UD", "DU", "LR", "RL"]
+ },
+ sortMethod: {
+ string: ["hubsize", "directed"]
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ __type__: {
+ object: r
+ }
+ },
+ manipulation: {
+ enabled: {
+ "boolean": o
+ },
+ initiallyActive: {
+ "boolean": o
+ },
+ addNode: {
+ "boolean": o,
+ "function": "function"
+ },
+ addEdge: {
+ "boolean": o,
+ "function": "function"
+ },
+ editNode: {
+ "function": "function"
+ },
+ editEdge: {
+ "boolean": o,
+ "function": "function"
+ },
+ deleteNode: {
+ "boolean": o,
+ "function": "function"
+ },
+ deleteEdge: {
+ "boolean": o,
+ "function": "function"
+ },
+ controlNodeStyle: "get from nodes, will be overwritten below",
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ nodes: {
+ borderWidth: {
+ number: n
+ },
+ borderWidthSelected: {
+ number: n,
+ undefined: "undefined"
+ },
+ brokenImage: {
+ string: i,
+ undefined: "undefined"
+ },
+ color: {
+ border: {
+ string: i
+ },
+ background: {
+ string: i
+ },
+ highlight: {
+ border: {
+ string: i
+ },
+ background: {
+ string: i
+ },
+ __type__: {
+ object: r,
+ string: i
+ }
+ },
+ hover: {
+ border: {
+ string: i
+ },
+ background: {
+ string: i
+ },
+ __type__: {
+ object: r,
+ string: i
+ }
+ },
+ __type__: {
+ object: r,
+ string: i
+ }
+ },
+ fixed: {
+ x: {
+ "boolean": o
+ },
+ y: {
+ "boolean": o
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ font: {
+ align: {
+ string: i
+ },
+ color: {
+ string: i
+ },
+ size: {
+ number: n
+ },
+ face: {
+ string: i
+ },
+ background: {
+ string: i
+ },
+ strokeWidth: {
+ number: n
+ },
+ strokeColor: {
+ string: i
+ },
+ __type__: {
+ object: r,
+ string: i
+ }
+ },
+ group: {
+ string: i,
+ number: n,
+ undefined: "undefined"
+ },
+ hidden: {
+ "boolean": o
+ },
+ icon: {
+ face: {
+ string: i
+ },
+ code: {
+ string: i
+ },
+ size: {
+ number: n
+ },
+ color: {
+ string: i
+ },
+ __type__: {
+ object: r
+ }
+ },
+ id: {
+ string: i,
+ number: n
+ },
+ image: {
+ string: i,
+ undefined: "undefined"
+ },
+ label: {
+ string: i,
+ undefined: "undefined"
+ },
+ labelHighlightBold: {
+ "boolean": o
+ },
+ level: {
+ number: n,
+ undefined: "undefined"
+ },
+ mass: {
+ number: n
+ },
+ physics: {
+ "boolean": o
+ },
+ scaling: {
+ min: {
+ number: n
+ },
+ max: {
+ number: n
+ },
+ label: {
+ enabled: {
+ "boolean": o
+ },
+ min: {
+ number: n
+ },
+ max: {
+ number: n
+ },
+ maxVisible: {
+ number: n
+ },
+ drawThreshold: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ customScalingFunction: {
+ "function": "function"
+ },
+ __type__: {
+ object: r
+ }
+ },
+ shadow: {
+ enabled: {
+ "boolean": o
+ },
+ color: {
+ string: i
+ },
+ size: {
+ number: n
+ },
+ x: {
+ number: n
+ },
+ y: {
+ number: n
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ shape: {
+ string: ["ellipse", "circle", "database", "box", "text", "image", "circularImage", "diamond", "dot", "star", "triangle", "triangleDown", "square", "icon"]
+ },
+ shapeProperties: {
+ borderDashes: {
+ "boolean": o,
+ array: s
+ },
+ borderRadius: {
+ number: n
+ },
+ interpolation: {
+ "boolean": o
+ },
+ useImageSize: {
+ "boolean": o
+ },
+ useBorderWithImage: {
+ "boolean": o
+ },
+ __type__: {
+ object: r
+ }
+ },
+ size: {
+ number: n
+ },
+ title: {
+ string: i,
+ undefined: "undefined"
+ },
+ value: {
+ number: n,
+ undefined: "undefined"
+ },
+ x: {
+ number: n
+ },
+ y: {
+ number: n
+ },
+ __type__: {
+ object: r
+ }
+ },
+ physics: {
+ enabled: {
+ "boolean": o
+ },
+ barnesHut: {
+ gravitationalConstant: {
+ number: n
+ },
+ centralGravity: {
+ number: n
+ },
+ springLength: {
+ number: n
+ },
+ springConstant: {
+ number: n
+ },
+ damping: {
+ number: n
+ },
+ avoidOverlap: {
+ number: n
+ },
+ __type__: {
+ object: r
+ }
+ },
+ forceAtlas2Based: {
+ gravitationalConstant: {
+ number: n
+ },
+ centralGravity: {
+ number: n
+ },
+ springLength: {
+ number: n
+ },
+ springConstant: {
+ number: n
+ },
+ damping: {
+ number: n
+ },
+ avoidOverlap: {
+ number: n
+ },
+ __type__: {
+ object: r
+ }
+ },
+ repulsion: {
+ centralGravity: {
+ number: n
+ },
+ springLength: {
+ number: n
+ },
+ springConstant: {
+ number: n
+ },
+ nodeDistance: {
+ number: n
+ },
+ damping: {
+ number: n
+ },
+ __type__: {
+ object: r
+ }
+ },
+ hierarchicalRepulsion: {
+ centralGravity: {
+ number: n
+ },
+ springLength: {
+ number: n
+ },
+ springConstant: {
+ number: n
+ },
+ nodeDistance: {
+ number: n
+ },
+ damping: {
+ number: n
+ },
+ __type__: {
+ object: r
+ }
+ },
+ maxVelocity: {
+ number: n
+ },
+ minVelocity: {
+ number: n
+ },
+ solver: {
+ string: ["barnesHut", "repulsion", "hierarchicalRepulsion", "forceAtlas2Based"]
+ },
+ stabilization: {
+ enabled: {
+ "boolean": o
+ },
+ iterations: {
+ number: n
+ },
+ updateInterval: {
+ number: n
+ },
+ onlyDynamicEdges: {
+ "boolean": o
+ },
+ fit: {
+ "boolean": o
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ timestep: {
+ number: n
+ },
+ adaptiveTimestep: {
+ "boolean": o
+ },
+ __type__: {
+ object: r,
+ "boolean": o
+ }
+ },
+ autoResize: {
+ "boolean": o
+ },
+ clickToUse: {
+ "boolean": o
+ },
+ locale: {
+ string: i
+ },
+ locales: {
+ __any__: {
+ any: h
+ },
+ __type__: {
+ object: r
+ }
+ },
+ height: {
+ string: i
+ },
+ width: {
+ string: i
+ },
+ __type__: {
+ object: r
+ }
+ };
+ d.groups.__any__ = d.nodes,
+ d.manipulation.controlNodeStyle = d.nodes;
+ var l = {
+ nodes: {
+ borderWidth: [1, 0, 10, 1],
+ borderWidthSelected: [2, 0, 10, 1],
+ color: {
+ border: ["color", "#2B7CE9"],
+ background: ["color", "#97C2FC"],
+ highlight: {
+ border: ["color", "#2B7CE9"],
+ background: ["color", "#D2E5FF"]
+ },
+ hover: {
+ border: ["color", "#2B7CE9"],
+ background: ["color", "#D2E5FF"]
+ }
+ },
+ fixed: {
+ x: !1,
+ y: !1
+ },
+ font: {
+ color: ["color", "#343434"],
+ size: [14, 0, 100, 1],
+ face: ["arial", "verdana", "tahoma"],
+ background: ["color", "none"],
+ strokeWidth: [0, 0, 50, 1],
+ strokeColor: ["color", "#ffffff"]
+ },
+ hidden: !1,
+ labelHighlightBold: !0,
+ physics: !0,
+ scaling: {
+ min: [10, 0, 200, 1],
+ max: [30, 0, 200, 1],
+ label: {
+ enabled: !1,
+ min: [14, 0, 200, 1],
+ max: [30, 0, 200, 1],
+ maxVisible: [30, 0, 200, 1],
+ drawThreshold: [5, 0, 20, 1]
+ }
+ },
+ shadow: {
+ enabled: !1,
+ color: "rgba(0,0,0,0.5)",
+ size: [10, 0, 20, 1],
+ x: [5, -30, 30, 1],
+ y: [5, -30, 30, 1]
+ },
+ shape: ["ellipse", "box", "circle", "database", "diamond", "dot", "square", "star", "text", "triangle", "triangleDown"],
+ shapeProperties: {
+ borderDashes: !1,
+ borderRadius: [6, 0, 20, 1],
+ interpolation: !0,
+ useImageSize: !1
+ },
+ size: [25, 0, 200, 1]
+ },
+ edges: {
+ arrows: {
+ to: {
+ enabled: !1,
+ scaleFactor: [1, 0, 3, .05]
+ },
+ middle: {
+ enabled: !1,
+ scaleFactor: [1, 0, 3, .05]
+ },
+ from: {
+ enabled: !1,
+ scaleFactor: [1, 0, 3, .05]
+ }
+ },
+ arrowStrikethrough: !0,
+ color: {
+ color: ["color", "#848484"],
+ highlight: ["color", "#848484"],
+ hover: ["color", "#848484"],
+ inherit: ["from", "to", "both", !0, !1],
+ opacity: [1, 0, 1, .05]
+ },
+ dashes: !1,
+ font: {
+ color: ["color", "#343434"],
+ size: [14, 0, 100, 1],
+ face: ["arial", "verdana", "tahoma"],
+ background: ["color", "none"],
+ strokeWidth: [2, 0, 50, 1],
+ strokeColor: ["color", "#ffffff"],
+ align: ["horizontal", "top", "middle", "bottom"]
+ },
+ hidden: !1,
+ hoverWidth: [1.5, 0, 5, .1],
+ labelHighlightBold: !0,
+ physics: !0,
+ scaling: {
+ min: [1, 0, 100, 1],
+ max: [15, 0, 100, 1],
+ label: {
+ enabled: !0,
+ min: [14, 0, 200, 1],
+ max: [30, 0, 200, 1],
+ maxVisible: [30, 0, 200, 1],
+ drawThreshold: [5, 0, 20, 1]
+ }
+ },
+ selectionWidth: [1.5, 0, 5, .1],
+ selfReferenceSize: [20, 0, 200, 1],
+ shadow: {
+ enabled: !1,
+ color: "rgba(0,0,0,0.5)",
+ size: [10, 0, 20, 1],
+ x: [5, -30, 30, 1],
+ y: [5, -30, 30, 1]
+ },
+ smooth: {
+ enabled: !0,
+ type: ["dynamic", "continuous", "discrete", "diagonalCross", "straightCross", "horizontal", "vertical", "curvedCW", "curvedCCW", "cubicBezier"],
+ forceDirection: ["horizontal", "vertical", "none"],
+ roundness: [.5, 0, 1, .05]
+ },
+ width: [1, 0, 30, 1]
+ },
+ layout: {
+ hierarchical: {
+ enabled: !1,
+ levelSeparation: [150, 20, 500, 5],
+ nodeSpacing: [100, 20, 500, 5],
+ treeSpacing: [200, 20, 500, 5],
+ blockShifting: !0,
+ edgeMinimization: !0,
+ parentCentralization: !0,
+ direction: ["UD", "DU", "LR", "RL"],
+ sortMethod: ["hubsize", "directed"]
+ }
+ },
+ interaction: {
+ dragNodes: !0,
+ dragView: !0,
+ hideEdgesOnDrag: !1,
+ hideNodesOnDrag: !1,
+ hover: !1,
+ keyboard: {
+ enabled: !1,
+ speed: {
+ x: [10, 0, 40, 1],
+ y: [10, 0, 40, 1],
+ zoom: [.02, 0, .1, .005]
+ },
+ bindToWindow: !0
+ },
+ multiselect: !1,
+ navigationButtons: !1,
+ selectable: !0,
+ selectConnectedEdges: !0,
+ hoverConnectedEdges: !0,
+ tooltipDelay: [300, 0, 1e3, 25],
+ zoomView: !0
+ },
+ manipulation: {
+ enabled: !1,
+ initiallyActive: !1
+ },
+ physics: {
+ enabled: !0,
+ barnesHut: {
+ gravitationalConstant: [-2e3, -3e4, 0, 50],
+ centralGravity: [.3, 0, 10, .05],
+ springLength: [95, 0, 500, 5],
+ springConstant: [.04, 0, 1.2, .005],
+ damping: [.09, 0, 1, .01],
+ avoidOverlap: [0, 0, 1, .01]
+ },
+ forceAtlas2Based: {
+ gravitationalConstant: [-50, -500, 0, 1],
+ centralGravity: [.01, 0, 1, .005],
+ springLength: [95, 0, 500, 5],
+ springConstant: [.08, 0, 1.2, .005],
+ damping: [.4, 0, 1, .01],
+ avoidOverlap: [0, 0, 1, .01]
+ },
+ repulsion: {
+ centralGravity: [.2, 0, 10, .05],
+ springLength: [200, 0, 500, 5],
+ springConstant: [.05, 0, 1.2, .005],
+ nodeDistance: [100, 0, 500, 5],
+ damping: [.09, 0, 1, .01]
+ },
+ hierarchicalRepulsion: {
+ centralGravity: [.2, 0, 10, .05],
+ springLength: [100, 0, 500, 5],
+ springConstant: [.01, 0, 1.2, .005],
+ nodeDistance: [120, 0, 500, 5],
+ damping: [.09, 0, 1, .01]
+ },
+ maxVelocity: [50, 0, 150, 1],
+ minVelocity: [.1, .01, .5, .01],
+ solver: ["barnesHut", "forceAtlas2Based", "repulsion", "hierarchicalRepulsion"],
+ timestep: [.5, .01, 1, .01]
+ },
+ global: {
+ locale: ["en", "nl"]
+ }
+ };
+ t.allOptions = d,
+ t.configureOptions = l
+ }
+ , function(e, t, i) {
+ function o(e) {
+ return e && e.__esModule ? e : {
+ "default": e
+ }
+ }
+ function n(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var s = function() {
+ function e(e, t) {
+ var i = []
+ , o = !0
+ , n = !1
+ , s = void 0;
+ try {
+ for (var r, a = e[Symbol.iterator](); !(o = (r = a.next()).done) && (i.push(r.value),
+ !t || i.length !== t); o = !0)
+ ;
+ } catch (h) {
+ n = !0,
+ s = h
+ } finally {
+ try {
+ !o && a["return"] && a["return"]()
+ } finally {
+ if (n)
+ throw s
+ }
+ }
+ return i
+ }
+ return function(t, i) {
+ if (Array.isArray(t))
+ return t;
+ if (Symbol.iterator in Object(t))
+ return e(t, i);
+ throw new TypeError("Invalid attempt to destructure non-iterable instance")
+ }
+ }()
+ , r = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , a = i(74)
+ , h = o(a)
+ , d = function() {
+ function e(t, i, o) {
+ n(this, e),
+ this.body = t,
+ this.springLength = i,
+ this.springConstant = o,
+ this.distanceSolver = new h["default"]
+ }
+ return r(e, [{
+ key: "setOptions",
+ value: function(e) {
+ e && (e.springLength && (this.springLength = e.springLength),
+ e.springConstant && (this.springConstant = e.springConstant))
+ }
+ }, {
+ key: "solve",
+ value: function(e, t) {
+ var i = arguments.length <= 2 || void 0 === arguments[2] ? !1 : arguments[2]
+ , o = this.distanceSolver.getDistances(this.body, e, t);
+ this._createL_matrix(o),
+ this._createK_matrix(o);
+ for (var n = .01, r = 1, a = 0, h = Math.max(1e3, Math.min(10 * this.body.nodeIndices.length, 6e3)), d = 5, l = 1e9, c = 0, u = 0, f = 0, p = 0, v = 0; l > n && h > a; ) {
+ a += 1;
+ var y = this._getHighestEnergyNode(i)
+ , g = s(y, 4);
+ for (c = g[0],
+ l = g[1],
+ u = g[2],
+ f = g[3],
+ p = l,
+ v = 0; p > r && d > v; ) {
+ v += 1,
+ this._moveNode(c, u, f);
+ var b = this._getEnergy(c)
+ , m = s(b, 3);
+ p = m[0],
+ u = m[1],
+ f = m[2]
+ }
+ }
+ }
+ }, {
+ key: "_getHighestEnergyNode",
+ value: function(e) {
+ for (var t = this.body.nodeIndices, i = this.body.nodes, o = 0, n = t[0], r = 0, a = 0, h = 0; h < t.length; h++) {
+ var d = t[h];
+ if (i[d].predefinedPosition === !1 || i[d].isCluster === !0 && e === !0 || i[d].options.fixed.x === !0 || i[d].options.fixed.y === !0) {
+ var l = this._getEnergy(d)
+ , c = s(l, 3)
+ , u = c[0]
+ , f = c[1]
+ , p = c[2];
+ u > o && (o = u,
+ n = d,
+ r = f,
+ a = p)
+ }
+ }
+ return [n, o, r, a]
+ }
+ }, {
+ key: "_getEnergy",
+ value: function(e) {
+ for (var t = this.body.nodeIndices, i = this.body.nodes, o = i[e].x, n = i[e].y, s = 0, r = 0, a = 0; a < t.length; a++) {
+ var h = t[a];
+ if (h !== e) {
+ var d = i[h].x
+ , l = i[h].y
+ , c = 1 / Math.sqrt(Math.pow(o - d, 2) + Math.pow(n - l, 2));
+ s += this.K_matrix[e][h] * (o - d - this.L_matrix[e][h] * (o - d) * c),
+ r += this.K_matrix[e][h] * (n - l - this.L_matrix[e][h] * (n - l) * c)
+ }
+ }
+ var u = Math.sqrt(Math.pow(s, 2) + Math.pow(r, 2));
+ return [u, s, r]
+ }
+ }, {
+ key: "_moveNode",
+ value: function(e, t, i) {
+ for (var o = this.body.nodeIndices, n = this.body.nodes, s = 0, r = 0, a = 0, h = n[e].x, d = n[e].y, l = 0; l < o.length; l++) {
+ var c = o[l];
+ if (c !== e) {
+ var u = n[c].x
+ , f = n[c].y
+ , p = 1 / Math.pow(Math.pow(h - u, 2) + Math.pow(d - f, 2), 1.5);
+ s += this.K_matrix[e][c] * (1 - this.L_matrix[e][c] * Math.pow(d - f, 2) * p),
+ r += this.K_matrix[e][c] * (this.L_matrix[e][c] * (h - u) * (d - f) * p),
+ a += this.K_matrix[e][c] * (1 - this.L_matrix[e][c] * Math.pow(h - u, 2) * p)
+ }
+ }
+ var v = s
+ , y = r
+ , g = t
+ , b = a
+ , m = i
+ , _ = (g / v + m / y) / (y / v - b / y)
+ , w = -(y * _ + g) / v;
+ n[e].x += w,
+ n[e].y += _
+ }
+ }, {
+ key: "_createL_matrix",
+ value: function(e) {
+ var t = this.body.nodeIndices
+ , i = this.springLength;
+ this.L_matrix = [];
+ for (var o = 0; o < t.length; o++) {
+ this.L_matrix[t[o]] = {};
+ for (var n = 0; n < t.length; n++)
+ this.L_matrix[t[o]][t[n]] = i * e[t[o]][t[n]]
+ }
+ }
+ }, {
+ key: "_createK_matrix",
+ value: function(e) {
+ var t = this.body.nodeIndices
+ , i = this.springConstant;
+ this.K_matrix = [];
+ for (var o = 0; o < t.length; o++) {
+ this.K_matrix[t[o]] = {};
+ for (var n = 0; n < t.length; n++)
+ this.K_matrix[t[o]][t[n]] = i * Math.pow(e[t[o]][t[n]], -2)
+ }
+ }
+ }]),
+ e
+ }();
+ t["default"] = d
+ }
+ , function(e, t) {
+ function i(e, t) {
+ if (!(e instanceof t))
+ throw new TypeError("Cannot call a class as a function")
+ }
+ Object.defineProperty(t, "__esModule", {
+ value: !0
+ });
+ var o = function() {
+ function e(e, t) {
+ for (var i = 0; i < t.length; i++) {
+ var o = t[i];
+ o.enumerable = o.enumerable || !1,
+ o.configurable = !0,
+ "value"in o && (o.writable = !0),
+ Object.defineProperty(e, o.key, o)
+ }
+ }
+ return function(t, i, o) {
+ return i && e(t.prototype, i),
+ o && e(t, o),
+ t
+ }
+ }()
+ , n = function() {
+ function e() {
+ i(this, e)
+ }
+ return o(e, [{
+ key: "getDistances",
+ value: function(e, t, i) {
+ for (var o = {}, n = e.edges, s = 0; s < t.length; s++) {
+ o[t[s]] = {},
+ o[t[s]] = {};
+ for (var r = 0; r < t.length; r++)
+ o[t[s]][t[r]] = s == r ? 0 : 1e9,
+ o[t[s]][t[r]] = s == r ? 0 : 1e9
+ }
+ for (var a = 0; a < i.length; a++) {
+ var h = n[i[a]];
+ h.connected === !0 && void 0 !== o[h.fromId] && void 0 !== o[h.toId] && (o[h.fromId][h.toId] = 1,
+ o[h.toId][h.fromId] = 1)
+ }
+ for (var d = t.length, l = 0; d > l; l++)
+ for (var c = 0; d - 1 > c; c++)
+ for (var u = c + 1; d > u; u++)
+ o[t[c]][t[u]] = Math.min(o[t[c]][t[u]], o[t[c]][t[l]] + o[t[l]][t[u]]),
+ o[t[u]][t[c]] = o[t[c]][t[u]];
+ return o
+ }
+ }]),
+ e
+ }();
+ t["default"] = n
+ }
+ , function(e, t) {
+ "undefined" != typeof CanvasRenderingContext2D && (CanvasRenderingContext2D.prototype.circle = function(e, t, i) {
+ this.beginPath(),
+ this.arc(e, t, i, 0, 2 * Math.PI, !1),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.square = function(e, t, i) {
+ this.beginPath(),
+ this.rect(e - i, t - i, 2 * i, 2 * i),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.triangle = function(e, t, i) {
+ this.beginPath(),
+ i *= 1.15,
+ t += .275 * i;
+ var o = 2 * i
+ , n = o / 2
+ , s = Math.sqrt(3) / 6 * o
+ , r = Math.sqrt(o * o - n * n);
+ this.moveTo(e, t - (r - s)),
+ this.lineTo(e + n, t + s),
+ this.lineTo(e - n, t + s),
+ this.lineTo(e, t - (r - s)),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.triangleDown = function(e, t, i) {
+ this.beginPath(),
+ i *= 1.15,
+ t -= .275 * i;
+ var o = 2 * i
+ , n = o / 2
+ , s = Math.sqrt(3) / 6 * o
+ , r = Math.sqrt(o * o - n * n);
+ this.moveTo(e, t + (r - s)),
+ this.lineTo(e + n, t - s),
+ this.lineTo(e - n, t - s),
+ this.lineTo(e, t + (r - s)),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.star = function(e, t, i) {
+ this.beginPath(),
+ i *= .82,
+ t += .1 * i;
+ for (var o = 0; 10 > o; o++) {
+ var n = o % 2 === 0 ? 1.3 * i : .5 * i;
+ this.lineTo(e + n * Math.sin(2 * o * Math.PI / 10), t - n * Math.cos(2 * o * Math.PI / 10))
+ }
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.diamond = function(e, t, i) {
+ this.beginPath(),
+ this.lineTo(e, t + i),
+ this.lineTo(e + i, t),
+ this.lineTo(e, t - i),
+ this.lineTo(e - i, t),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.roundRect = function(e, t, i, o, n) {
+ var s = Math.PI / 180;
+ 0 > i - 2 * n && (n = i / 2),
+ 0 > o - 2 * n && (n = o / 2),
+ this.beginPath(),
+ this.moveTo(e + n, t),
+ this.lineTo(e + i - n, t),
+ this.arc(e + i - n, t + n, n, 270 * s, 360 * s, !1),
+ this.lineTo(e + i, t + o - n),
+ this.arc(e + i - n, t + o - n, n, 0, 90 * s, !1),
+ this.lineTo(e + n, t + o),
+ this.arc(e + n, t + o - n, n, 90 * s, 180 * s, !1),
+ this.lineTo(e, t + n),
+ this.arc(e + n, t + n, n, 180 * s, 270 * s, !1),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.ellipse = function(e, t, i, o) {
+ var n = .5522848
+ , s = i / 2 * n
+ , r = o / 2 * n
+ , a = e + i
+ , h = t + o
+ , d = e + i / 2
+ , l = t + o / 2;
+ this.beginPath(),
+ this.moveTo(e, l),
+ this.bezierCurveTo(e, l - r, d - s, t, d, t),
+ this.bezierCurveTo(d + s, t, a, l - r, a, l),
+ this.bezierCurveTo(a, l + r, d + s, h, d, h),
+ this.bezierCurveTo(d - s, h, e, l + r, e, l),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.database = function(e, t, i, o) {
+ var n = 1 / 3
+ , s = i
+ , r = o * n
+ , a = .5522848
+ , h = s / 2 * a
+ , d = r / 2 * a
+ , l = e + s
+ , c = t + r
+ , u = e + s / 2
+ , f = t + r / 2
+ , p = t + (o - r / 2)
+ , v = t + o;
+ this.beginPath(),
+ this.moveTo(l, f),
+ this.bezierCurveTo(l, f + d, u + h, c, u, c),
+ this.bezierCurveTo(u - h, c, e, f + d, e, f),
+ this.bezierCurveTo(e, f - d, u - h, t, u, t),
+ this.bezierCurveTo(u + h, t, l, f - d, l, f),
+ this.lineTo(l, p),
+ this.bezierCurveTo(l, p + d, u + h, v, u, v),
+ this.bezierCurveTo(u - h, v, e, p + d, e, p),
+ this.lineTo(e, f)
+ }
+ ,
+ CanvasRenderingContext2D.prototype.arrow = function(e, t, i, o) {
+ var n = e - o * Math.cos(i)
+ , s = t - o * Math.sin(i)
+ , r = e - .9 * o * Math.cos(i)
+ , a = t - .9 * o * Math.sin(i)
+ , h = n + o / 3 * Math.cos(i + .5 * Math.PI)
+ , d = s + o / 3 * Math.sin(i + .5 * Math.PI)
+ , l = n + o / 3 * Math.cos(i - .5 * Math.PI)
+ , c = s + o / 3 * Math.sin(i - .5 * Math.PI);
+ this.beginPath(),
+ this.moveTo(e, t),
+ this.lineTo(h, d),
+ this.lineTo(r, a),
+ this.lineTo(l, c),
+ this.closePath()
+ }
+ ,
+ CanvasRenderingContext2D.prototype.dashedLine = function(e, t, i, o, n) {
+ this.beginPath(),
+ this.moveTo(e, t);
+ for (var s = n.length, r = i - e, a = o - t, h = a / r, d = Math.sqrt(r * r + a * a), l = 0, c = !0, u = 0, f = n[0]; d >= .1; )
+ f = n[l++ % s],
+ f > d && (f = d),
+ u = Math.sqrt(f * f / (1 + h * h)),
+ u = 0 > r ? -u : u,
+ e += u,
+ t += h * u,
+ c === !0 ? this.lineTo(e, t) : this.moveTo(e, t),
+ d -= f,
+ c = !c
+ }
+ )
+ }
+ , function(e, t) {
+ function i(e) {
+ return e ? o(e) : void 0
+ }
+ function o(e) {
+ for (var t in i.prototype)
+ e[t] = i.prototype[t];
+ return e
+ }
+ e.exports = i,
+ i.prototype.on = i.prototype.addEventListener = function(e, t) {
+ return this._callbacks = this._callbacks || {},
+ (this._callbacks[e] = this._callbacks[e] || []).push(t),
+ this
+ }
+ ,
+ i.prototype.once = function(e, t) {
+ function i() {
+ o.off(e, i),
+ t.apply(this, arguments)
+ }
+ var o = this;
+ return this._callbacks = this._callbacks || {},
+ i.fn = t,
+ this.on(e, i),
+ this
+ }
+ ,
+ i.prototype.off = i.prototype.removeListener = i.prototype.removeAllListeners = i.prototype.removeEventListener = function(e, t) {
+ if (this._callbacks = this._callbacks || {},
+ 0 == arguments.length)
+ return this._callbacks = {},
+ this;
+ var i = this._callbacks[e];
+ if (!i)
+ return this;
+ if (1 == arguments.length)
+ return delete this._callbacks[e],
+ this;
+ for (var o, n = 0; n < i.length; n++)
+ if (o = i[n],
+ o === t || o.fn === t) {
+ i.splice(n, 1);
+ break
+ }
+ return this
+ }
+ ,
+ i.prototype.emit = function(e) {
+ this._callbacks = this._callbacks || {};
+ var t = [].slice.call(arguments, 1)
+ , i = this._callbacks[e];
+ if (i) {
+ i = i.slice(0);
+ for (var o = 0, n = i.length; n > o; ++o)
+ i[o].apply(this, t)
+ }
+ return this
+ }
+ ,
+ i.prototype.listeners = function(e) {
+ return this._callbacks = this._callbacks || {},
+ this._callbacks[e] || []
+ }
+ ,
+ i.prototype.hasListeners = function(e) {
+ return !!this.listeners(e).length
+ }
+ }
+ , function(e, t) {
+ function i(e) {
+ return P = e,
+ f()
+ }
+ function o() {
+ B = 0,
+ F = P.charAt(0)
+ }
+ function n() {
+ B++,
+ F = P.charAt(B)
+ }
+ function s() {
+ return P.charAt(B + 1)
+ }
+ function r(e) {
+ return N.test(e)
+ }
+ function a(e, t) {
+ if (e || (e = {}),
+ t)
+ for (var i in t)
+ t.hasOwnProperty(i) && (e[i] = t[i]);
+ return e
+ }
+ function h(e, t, i) {
+ for (var o = t.split("."), n = e; o.length; ) {
+ var s = o.shift();
+ o.length ? (n[s] || (n[s] = {}),
+ n = n[s]) : n[s] = i
+ }
+ }
+ function d(e, t) {
+ for (var i, o, n = null, s = [e], r = e; r.parent; )
+ s.push(r.parent),
+ r = r.parent;
+ if (r.nodes)
+ for (i = 0,
+ o = r.nodes.length; o > i; i++)
+ if (t.id === r.nodes[i].id) {
+ n = r.nodes[i];
+ break
+ }
+ for (n || (n = {
+ id: t.id
+ },
+ e.node && (n.attr = a(n.attr, e.node))),
+ i = s.length - 1; i >= 0; i--) {
+ var h = s[i];
+ h.nodes || (h.nodes = []),
+ -1 === h.nodes.indexOf(n) && h.nodes.push(n)
+ }
+ t.attr && (n.attr = a(n.attr, t.attr))
+ }
+ function l(e, t) {
+ if (e.edges || (e.edges = []),
+ e.edges.push(t),
+ e.edge) {
+ var i = a({}, e.edge);
+ t.attr = a(i, t.attr)
+ }
+ }
+ function c(e, t, i, o, n) {
+ var s = {
+ from: t,
+ to: i,
+ type: o
+ };
+ return e.edge && (s.attr = a({}, e.edge)),
+ s.attr = a(s.attr || {}, n),
+ s
+ }
+ function u() {
+ for (j = C.NULL,
+ I = ""; " " === F || " " === F || "\n" === F || "\r" === F; )
+ n();
+ do {
+ var e = !1;
+ if ("#" === F) {
+ for (var t = B - 1; " " === P.charAt(t) || " " === P.charAt(t); )
+ t--;
+ if ("\n" === P.charAt(t) || "" === P.charAt(t)) {
+ for (; "" != F && "\n" != F; )
+ n();
+ e = !0
+ }
+ }
+ if ("/" === F && "/" === s()) {
+ for (; "" != F && "\n" != F; )
+ n();
+ e = !0
+ }
+ if ("/" === F && "*" === s()) {
+ for (; "" != F; ) {
+ if ("*" === F && "/" === s()) {
+ n(),
+ n();
+ break
+ }
+ n()
+ }
+ e = !0
+ }
+ for (; " " === F || " " === F || "\n" === F || "\r" === F; )
+ n()
+ } while (e);
+ if ("" === F)
+ return void (j = C.DELIMITER);
+ var i = F + s();
+ if (T[i])
+ return j = C.DELIMITER,
+ I = i,
+ n(),
+ void n();
+ if (T[F])
+ return j = C.DELIMITER,
+ I = F,
+ void n();
+ if (r(F) || "-" === F) {
+ for (I += F,
+ n(); r(F); )
+ I += F,
+ n();
+ return "false" === I ? I = !1 : "true" === I ? I = !0 : isNaN(Number(I)) || (I = Number(I)),
+ void (j = C.IDENTIFIER)
+ }
+ if ('"' === F) {
+ for (n(); "" != F && ('"' != F || '"' === F && '"' === s()); )
+ I += F,
+ '"' === F && n(),
+ n();
+ if ('"' != F)
+ throw w('End of string " expected');
+ return n(),
+ void (j = C.IDENTIFIER)
+ }
+ for (j = C.UNKNOWN; "" != F; )
+ I += F,
+ n();
+ throw new SyntaxError('Syntax error in part "' + k(I, 30) + '"')
+ }
+ function f() {
+ var e = {};
+ if (o(),
+ u(),
+ "strict" === I && (e.strict = !0,
+ u()),
+ "graph" !== I && "digraph" !== I || (e.type = I,
+ u()),
+ j === C.IDENTIFIER && (e.id = I,
+ u()),
+ "{" != I)
+ throw w("Angle bracket { expected");
+ if (u(),
+ p(e),
+ "}" != I)
+ throw w("Angle bracket } expected");
+ if (u(),
+ "" !== I)
+ throw w("End of file expected");
+ return u(),
+ delete e.node,
+ delete e.edge,
+ delete e.graph,
+ e
+ }
+ function p(e) {
+ for (; "" !== I && "}" != I; )
+ v(e),
+ ";" === I && u()
+ }
+ function v(e) {
+ var t = y(e);
+ if (t)
+ return void m(e, t);
+ var i = g(e);
+ if (!i) {
+ if (j != C.IDENTIFIER)
+ throw w("Identifier expected");
+ var o = I;
+ if (u(),
+ "=" === I) {
+ if (u(),
+ j != C.IDENTIFIER)
+ throw w("Identifier expected");
+ e[o] = I,
+ u()
+ } else
+ b(e, o)
+ }
+ }
+ function y(e) {
+ var t = null;
+ if ("subgraph" === I && (t = {},
+ t.type = "subgraph",
+ u(),
+ j === C.IDENTIFIER && (t.id = I,
+ u())),
+ "{" === I) {
+ if (u(),
+ t || (t = {}),
+ t.parent = e,
+ t.node = e.node,
+ t.edge = e.edge,
+ t.graph = e.graph,
+ p(t),
+ "}" != I)
+ throw w("Angle bracket } expected");
+ u(),
+ delete t.node,
+ delete t.edge,
+ delete t.graph,
+ delete t.parent,
+ e.subgraphs || (e.subgraphs = []),
+ e.subgraphs.push(t)
+ }
+ return t
+ }
+ function g(e) {
+ return "node" === I ? (u(),
+ e.node = _(),
+ "node") : "edge" === I ? (u(),
+ e.edge = _(),
+ "edge") : "graph" === I ? (u(),
+ e.graph = _(),
+ "graph") : null
+ }
+ function b(e, t) {
+ var i = {
+ id: t
+ }
+ , o = _();
+ o && (i.attr = o),
+ d(e, i),
+ m(e, t)
+ }
+ function m(e, t) {
+ for (; "->" === I || "--" === I; ) {
+ var i, o = I;
+ u();
+ var n = y(e);
+ if (n)
+ i = n;
+ else {
+ if (j != C.IDENTIFIER)
+ throw w("Identifier or subgraph expected");
+ i = I,
+ d(e, {
+ id: i
+ }),
+ u()
+ }
+ var s = _()
+ , r = c(e, t, i, o, s);
+ l(e, r),
+ t = i
+ }
+ }
+ function _() {
+ for (var e = null; "[" === I; ) {
+ for (u(),
+ e = {}; "" !== I && "]" != I; ) {
+ if (j != C.IDENTIFIER)
+ throw w("Attribute name expected");
+ var t = I;
+ if (u(),
+ "=" != I)
+ throw w("Equal sign = expected");
+ if (u(),
+ j != C.IDENTIFIER)
+ throw w("Attribute value expected");
+ var i = I;
+ h(e, t, i),
+ u(),
+ "," == I && u()
+ }
+ if ("]" != I)
+ throw w("Bracket ] expected");
+ u()
+ }
+ return e
+ }
+ function w(e) {
+ return new SyntaxError(e + ', got "' + k(I, 30) + '" (char ' + B + ")")
+ }
+ function k(e, t) {
+ return e.length <= t ? e : e.substr(0, 27) + "..."
+ }
+ function x(e, t, i) {
+ Array.isArray(e) ? e.forEach(function(e) {
+ Array.isArray(t) ? t.forEach(function(t) {
+ i(e, t)
+ }) : i(e, t)
+ }) : Array.isArray(t) ? t.forEach(function(t) {
+ i(e, t)
+ }) : i(e, t)
+ }
+ function O(e, t, i) {
+ for (var o = t.split("."), n = o.pop(), s = e, r = 0; r < o.length; r++) {
+ var a = o[r];
+ a in s || (s[a] = {}),
+ s = s[a]
+ }
+ return s[n] = i,
+ e
+ }
+ function E(e, t) {
+ var i = {};
+ for (var o in e)
+ if (e.hasOwnProperty(o)) {
+ var n = t[o];
+ Array.isArray(n) ? n.forEach(function(t) {
+ O(i, t, e[o])
+ }) : "string" == typeof n ? O(i, n, e[o]) : O(i, o, e[o])
+ }
+ return i
+ }
+ function M(e) {
+ var t = i(e)
+ , o = {
+ nodes: [],
+ edges: [],
+ options: {}
+ };
+ if (t.nodes && t.nodes.forEach(function(e) {
+ var t = {
+ id: e.id,
+ label: String(e.label || e.id)
+ };
+ a(t, E(e.attr, D)),
+ t.image && (t.shape = "image"),
+ o.nodes.push(t)
+ }),
+ t.edges) {
+ var n = function(e) {
+ var t = {
+ from: e.from,
+ to: e.to
+ };
+ return a(t, E(e.attr, S)),
+ t.arrows = "->" === e.type ? "to" : void 0,
+ t
+ };
+ t.edges.forEach(function(e) {
+ var t, i;
+ t = e.from instanceof Object ? e.from.nodes : {
+ id: e.from
+ },
+ i = e.to instanceof Object ? e.to.nodes : {
+ id: e.to
+ },
+ e.from instanceof Object && e.from.edges && e.from.edges.forEach(function(e) {
+ var t = n(e);
+ o.edges.push(t)
+ }),
+ x(t, i, function(t, i) {
+ var s = c(o, t.id, i.id, e.type, e.attr)
+ , r = n(s);
+ o.edges.push(r)
+ }),
+ e.to instanceof Object && e.to.edges && e.to.edges.forEach(function(e) {
+ var t = n(e);
+ o.edges.push(t)
+ })
+ })
+ }
+ return t.attr && (o.options = t.attr),
+ o
+ }
+ var D = {
+ fontsize: "font.size",
+ fontcolor: "font.color",
+ labelfontcolor: "font.color",
+ fontname: "font.face",
+ color: ["color.border", "color.background"],
+ fillcolor: "color.background",
+ tooltip: "title",
+ labeltooltip: "title"
+ }
+ , S = Object.create(D);
+ S.color = "color.color";
+ var C = {
+ NULL: 0,
+ DELIMITER: 1,
+ IDENTIFIER: 2,
+ UNKNOWN: 3
+ }
+ , T = {
+ "{": !0,
+ "}": !0,
+ "[": !0,
+ "]": !0,
+ ";": !0,
+ "=": !0,
+ ",": !0,
+ "->": !0,
+ "--": !0
+ }
+ , P = ""
+ , B = 0
+ , F = ""
+ , I = ""
+ , j = C.NULL
+ , N = /[a-zA-Z_0-9.:#]/;
+ t.parseDOT = i,
+ t.DOTToGraph = M
+ }
+ , function(e, t) {
+ function i(e, t) {
+ var i = []
+ , o = []
+ , n = {
+ edges: {
+ inheritColor: !1
+ },
+ nodes: {
+ fixed: !1,
+ parseColor: !1
+ }
+ };
+ void 0 !== t && (void 0 !== t.fixed && (n.nodes.fixed = t.fixed),
+ void 0 !== t.parseColor && (n.nodes.parseColor = t.parseColor),
+ void 0 !== t.inheritColor && (n.edges.inheritColor = t.inheritColor));
+ for (var s = e.edges, r = e.nodes, a = 0; a < s.length; a++) {
+ var h = {}
+ , d = s[a];
+ h.id = d.id,
+ h.from = d.source,
+ h.to = d.target,
+ h.attributes = d.attributes,
+ h.label = d.label,
+ h.title = void 0 !== d.attributes ? d.attributes.title : void 0,
+ "Directed" === d.type && (h.arrows = "to"),
+ d.color && n.inheritColor === !1 && (h.color = d.color),
+ i.push(h)
+ }
+ for (var a = 0; a < r.length; a++) {
+ var l = {}
+ , c = r[a];
+ l.id = c.id,
+ l.attributes = c.attributes,
+ l.title = c.title,
+ l.x = c.x,
+ l.y = c.y,
+ l.label = c.label,
+ l.title = void 0 !== c.attributes ? c.attributes.title : void 0,
+ n.nodes.parseColor === !0 ? l.color = c.color : l.color = void 0 !== c.color ? {
+ background: c.color,
+ border: c.color,
+ highlight: {
+ background: c.color,
+ border: c.color
+ },
+ hover: {
+ background: c.color,
+ border: c.color
+ }
+ } : void 0,
+ l.size = c.size,
+ l.fixed = n.nodes.fixed && void 0 !== c.x && void 0 !== c.y,
+ o.push(l)
+ }
+ return {
+ nodes: o,
+ edges: i
+ }
+ }
+ t.parseGephi = i
+ }
+ , function(e, t, i) {
+ function o(e) {
+ this.active = !1,
+ this.dom = {
+ container: e
+ },
+ this.dom.overlay = document.createElement("div"),
+ this.dom.overlay.className = "vis-overlay",
+ this.dom.container.appendChild(this.dom.overlay),
+ this.hammer = a(this.dom.overlay),
+ this.hammer.on("tap", this._onTapOverlay.bind(this));
+ var t = this
+ , i = ["tap", "doubletap", "press", "pinch", "pan", "panstart", "panmove", "panend"];
+ i.forEach(function(e) {
+ t.hammer.on(e, function(e) {
+ e.stopPropagation()
+ })
+ }),
+ document && document.body && (this.onClick = function(i) {
+ n(i.target, e) || t.deactivate()
+ }
+ ,
+ document.body.addEventListener("click", this.onClick)),
+ void 0 !== this.keycharm && this.keycharm.destroy(),
+ this.keycharm = s(),
+ this.escListener = this.deactivate.bind(this)
+ }
+ function n(e, t) {
+ for (; e; ) {
+ if (e === t)
+ return !0;
+ e = e.parentNode
+ }
+ return !1
+ }
+ var s = i(65)
+ , r = i(76)
+ , a = i(58)
+ , h = i(1);
+ r(o.prototype),
+ o.current = null,
+ o.prototype.destroy = function() {
+ this.deactivate(),
+ this.dom.overlay.parentNode.removeChild(this.dom.overlay),
+ this.onClick && document.body.removeEventListener("click", this.onClick),
+ this.hammer.destroy(),
+ this.hammer = null
+ }
+ ,
+ o.prototype.activate = function() {
+ o.current && o.current.deactivate(),
+ o.current = this,
+ this.active = !0,
+ this.dom.overlay.style.display = "none",
+ h.addClassName(this.dom.container, "vis-active"),
+ this.emit("change"),
+ this.emit("activate"),
+ this.keycharm.bind("esc", this.escListener)
+ }
+ ,
+ o.prototype.deactivate = function() {
+ this.active = !1,
+ this.dom.overlay.style.display = "",
+ h.removeClassName(this.dom.container, "vis-active"),
+ this.keycharm.unbind("esc", this.escListener),
+ this.emit("change"),
+ this.emit("deactivate")
+ }
+ ,
+ o.prototype._onTapOverlay = function(e) {
+ this.activate(),
+ e.stopPropagation()
+ }
+ ,
+ e.exports = o
+ }
+ , function(e, t) {
+ t.en = {
+ edit: "Edit",
+ del: "Delete selected",
+ back: "Back",
+ addNode: "Add Node",
+ addEdge: "Add Edge",
+ editNode: "Edit Node",
+ editEdge: "Edit Edge",
+ addDescription: "Click in an empty space to place a new node.",
+ edgeDescription: "Click on a node and drag the edge to another node to connect them.",
+ editEdgeDescription: "Click on the control points and drag them to a node to connect to it.",
+ createEdgeError: "Cannot link edges to a cluster.",
+ deleteClusterError: "Clusters cannot be deleted.",
+ editClusterError: "Clusters cannot be edited."
+ },
+ t.en_EN = t.en,
+ t.en_US = t.en,
+ t.de = {
+ edit: "Editieren",
+ del: "Lösche Auswahl",
+ back: "Zurück",
+ addNode: "Knoten hinzufügen",
+ addEdge: "Kante hinzufügen",
+ editNode: "Knoten editieren",
+ editEdge: "Kante editieren",
+ addDescription: "Klicke auf eine freie Stelle, um einen neuen Knoten zu plazieren.",
+ edgeDescription: "Klicke auf einen Knoten und ziehe die Kante zu einem anderen Knoten, um diese zu verbinden.",
+ editEdgeDescription: "Klicke auf die Verbindungspunkte und ziehe diese auf einen Knoten, um sie zu verbinden.",
+ createEdgeError: "Es ist nicht möglich, Kanten mit Clustern zu verbinden.",
+ deleteClusterError: "Cluster können nicht gelöscht werden.",
+ editClusterError: "Cluster können nicht editiert werden."
+ },
+ t.de_DE = t.de,
+ t.es = {
+ edit: "Editar",
+ del: "Eliminar selección",
+ back: "Átras",
+ addNode: "Añadir nodo",
+ addEdge: "Añadir arista",
+ editNode: "Editar nodo",
+ editEdge: "Editar arista",
+ addDescription: "Haga clic en un lugar vacío para colocar un nuevo nodo.",
+ edgeDescription: "Haga clic en un nodo y arrastre la arista hacia otro nodo para conectarlos.",
+ editEdgeDescription: "Haga clic en un punto de control y arrastrelo a un nodo para conectarlo.",
+ createEdgeError: "No se puede conectar una arista a un grupo.",
+ deleteClusterError: "No es posible eliminar grupos.",
+ editClusterError: "No es posible editar grupos."
+ },
+ t.es_ES = t.es,
+ t.nl = {
+ edit: "Wijzigen",
+ del: "Selectie verwijderen",
+ back: "Terug",
+ addNode: "Node toevoegen",
+ addEdge: "Link toevoegen",
+ editNode: "Node wijzigen",
+ editEdge: "Link wijzigen",
+ addDescription: "Klik op een leeg gebied om een nieuwe node te maken.",
+ edgeDescription: "Klik op een node en sleep de link naar een andere node om ze te verbinden.",
+ editEdgeDescription: "Klik op de verbindingspunten en sleep ze naar een node om daarmee te verbinden.",
+ createEdgeError: "Kan geen link maken naar een cluster.",
+ deleteClusterError: "Clusters kunnen niet worden verwijderd.",
+ editClusterError: "Clusters kunnen niet worden aangepast."
+ },
+ t.nl_NL = t.nl,
+ t.nl_BE = t.nl
+ }
+ ])
+});