diff --git a/src/assets/package/graphvis.esm.min3.js b/src/assets/package/graphvis.esm.min3.js new file mode 100644 index 0000000..36fb77e --- /dev/null +++ b/src/assets/package/graphvis.esm.min3.js @@ -0,0 +1,25188 @@ +function t(e, t) { + var n, + i = Object.keys(e); + return ( + Object.getOwnPropertySymbols && + ((n = Object.getOwnPropertySymbols(e)), + t && + (n = n.filter(function (t) { + return Object.getOwnPropertyDescriptor(e, t).enumerable; + })), + i.push.apply(i, n)), + i + ); +} +function e(e) { + for (var n = 1; n < arguments.length; n++) { + var i = null != arguments[n] ? arguments[n] : {}; + n % 2 + ? t(Object(i), !0).forEach(function (t) { + s(e, t, i[t]); + }) + : Object.getOwnPropertyDescriptors + ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(i)) + : t(Object(i)).forEach(function (t) { + Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t)); + }); + } + return e; +} +function n(t) { + return (n = + 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator + ? function (t) { + return typeof t; + } + : function (t) { + return t && 'function' == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype + ? 'symbol' + : typeof t; + })(t); +} +function i(t, e) { + if (!(t instanceof e)) throw new TypeError('Cannot call a class as a function'); +} +function o(t, e) { + for (var n = 0; n < e.length; n++) { + var i = e[n]; + (i.enumerable = i.enumerable || !1), + (i.configurable = !0), + 'value' in i && (i.writable = !0), + Object.defineProperty(t, i.key, i); + } +} +function a(t, e, n) { + return e && o(t.prototype, e), n && o(t, n), Object.defineProperty(t, 'prototype', { writable: !1 }), t; +} +function s(t, e, n) { + return ( + e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : (t[e] = n), t + ); +} +function h(t, e) { + if ('function' != typeof e && null !== e) throw new TypeError('Super expression must either be null or a function'); + (t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } })), + Object.defineProperty(t, 'prototype', { writable: !1 }), + e && u(t, e); +} +function c(t) { + return (c = Object.setPrototypeOf + ? Object.getPrototypeOf.bind() + : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + })(t); +} +function u(t, e) { + return (u = Object.setPrototypeOf + ? Object.setPrototypeOf.bind() + : function (t, e) { + return (t.__proto__ = e), t; + })(t, e); +} +function l(t, e) { + if (e && ('object' == typeof e || 'function' == typeof e)) return e; + if (void 0 !== e) throw new TypeError('Derived constructors may only return object or undefined'); + e = t; + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} +function d(n) { + var i = (function () { + if ('undefined' == typeof Reflect || !Reflect.construct) return !1; + if (Reflect.construct.sham) return !1; + if ('function' == typeof Proxy) return !0; + try { + return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})), !0; + } catch (t) { + return !1; + } + })(); + return function () { + var t, + e = c(n); + return l(this, i ? ((t = c(this).constructor), Reflect.construct(e, arguments, t)) : e.apply(this, arguments)); + }; +} +function f(t, e) { + return ( + (function (t) { + if (Array.isArray(t)) return t; + })(t) || + (function (t, e) { + var n = null == t ? null : ('undefined' != typeof Symbol && t[Symbol.iterator]) || t['@@iterator']; + if (null != n) { + var i, + r, + o = [], + a = !0, + s = !1; + try { + for (n = n.call(t); !(a = (i = n.next()).done) && (o.push(i.value), !e || o.length !== e); a = !0); + } catch (t) { + (s = !0), (r = t); + } finally { + try { + a || null == n.return || n.return(); + } finally { + if (s) throw r; + } + } + return o; + } + })(t, e) || + v(t, e) || + (function () { + throw new TypeError( + 'Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.', + ); + })() + ); +} +function p(t) { + return ( + (function (t) { + if (Array.isArray(t)) return y(t); + })(t) || + (function () { + if (('undefined' != typeof Symbol && null != t[Symbol.iterator]) || null != t['@@iterator']) return Array.from(t); + })() || + v(t) || + (function () { + throw new TypeError( + 'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.', + ); + })() + ); +} +function v(t, e) { + var n; + if (t) + return 'string' == typeof t + ? y(t, e) + : 'Map' === + (n = + 'Object' === (n = Object.prototype.toString.call(t).slice(8, -1)) && t.constructor + ? t.constructor.name + : n) || 'Set' === n + ? Array.from(t) + : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) + ? y(t, e) + : void 0; +} +function y(t, e) { + (null == e || e > t.length) && (e = t.length); + for (var n = 0, i = new Array(e); n < e; n++) i[n] = t[n]; + return i; +} +function m(t, e) { + var n, + i, + r, + o, + a = ('undefined' != typeof Symbol && t[Symbol.iterator]) || t['@@iterator']; + if (a) + return ( + (r = !(i = !0)), + { + s: function () { + a = a.call(t); + }, + n: function () { + var t = a.next(); + return (i = t.done), t; + }, + e: function (t) { + (r = !0), (n = t); + }, + f: function () { + try { + i || null == a.return || a.return(); + } finally { + if (r) throw n; + } + }, + } + ); + if (Array.isArray(t) || (a = v(t)) || (e && t && 'number' == typeof t.length)) + return ( + a && (t = a), + (o = 0), + { + s: (e = function () {}), + n: function () { + return o >= t.length ? { done: !0 } : { done: !1, value: t[o++] }; + }, + e: function (t) { + throw t; + }, + f: e, + } + ); + throw new TypeError( + 'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.', + ); +} +null != Object.assign && Object.assign.bind(Object); +var x = function t(e, n, i, r) { + for (var o in n) + if (n.hasOwnProperty(o) || !0 === i) + if (n[o] && n[o].constructor === Object) + void 0 === e[o] && (e[o] = {}), + e[o].constructor === Object + ? t(e[o], n[o], i) + : null === n[o] && void 0 !== e[o] && !0 === r + ? delete e[o] + : (e[o] = n[o]); + else if (Array.isArray(n[o])) { + e[o] = []; + for (var a = 0; a < n[o].length; a++) e[o].push(n[o][a]); + } else null === n[o] && void 0 !== e[o] && !0 === r ? delete e[o] : (e[o] = n[o]); + return e; + }, + w = function (t) { + return Number(Math.random().toString().substring(2, t) + Date.now()).toString(36); + }, + k = function () { + var t; + return { + node: + (s( + (t = { + label: { + show: !0, + color: '50,50,50', + font: 'normal 14px Arial', + wrapText: !1, + textPosition: 'Bottom_Center', + textOffsetX: 0, + textOffsetY: 0, + background: null, + borderWidth: 0, + borderColor: null, + }, + shape: 'circle', + color: '30,160,250', + borderColor: '30,100,250', + borderWidth: 0, + tagColor: '230,30,30', + size: 60, + imageScale: 1, + alpha: 1, + borderRadius: 0, + }), + 'imageScale', + 1, + ), + s(t, 'selected', { + borderColor: '50,50,230', + borderAlpha: 1, + borderWidth: 5, + showShadow: !1, + shadowColor: '80,160,240', + shadowBlur: 10, + }), + t), + link: { + label: { show: !0, color: '20,20,20', font: 'normal 13px Arial' }, + lineType: 'straight', + colorType: 'defined', + color: '120,110,110', + alpha: 1, + lineWidth: 2, + lineDash: null, + showArrow: !0, + arrowType: 'triangle', + selected: { color: '50,50,230' }, + }, + scene: {}, + group: {}, + highLightNeiber: !1, + wheelZoom: 0.9, + selectBox: { color: '10,10,225', alpha: 0.1 }, + }; + }, + M = [ + 'YWxlcnQoJyVFNiU4MiVBOCVFNiVBRC', + 'VBMyVFNSU5QyVBOCVFNCVCRCVCRiVF', + 'NyU5NCVBOCVFNiU5QyVBQSVFNiU4RS', + 'U4OCVFNiU5RCU4MyVFNyU5QSU4NCVFN', + 'yU4OSU4OCVFNiU5QyVBQyUyQyVFOCVBR', + ], + E = [ + 'iVCNyVFOCU4MSU5NCVFNyVCMyVCQkdy', + 'YXBoVmlzKHd3dy5ncmFwaHZpcy5jbik', + 'lRTYlOEUlODglRTYlOUQlODMlRTUlOT', + 'AlOEUlRTUlODYlOEQlRTQlQkQlQkYlR', + 'TclOTQlQTglMkMlRTglQjAlQTIlRTgl', + ], + C = [ + 'QjAlQTIlRTUlOTAlODglRTQlQkQlOUM', + 'hJUU4JUFGJTk1JUU3JTk0JUE4JUU1JT', + 'lDJUE4JUU2JTlDJUFDJUU1JTlDJUIwJ', + 'UU2JTlDJThEJUU1JThBJUExMTI3LjAu', + 'MC4xJUU2JTg4JTk2bG9jYWxob3N0JUU', + '0JUI4JThCJUU2JTk3JUEwJUU5JTk5JT', + 'kwJUU1JTg4JUI2JUUzJTgwJTgyJyk=', + ], + N = function (t) { + for ( + var e, + n, + i, + r, + o, + a = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', + s = a.length, + h = 0, + c = (r = new Array(Math.floor(t.length / 3))).length, + u = 0; + u < c; + u++ + ) + (e = a.indexOf(t.charAt(h))), + (n = a.indexOf(t.charAt(++h))), + (i = a.indexOf(t.charAt(++h))), + h++, + (r[u] = e * s * s + n * s + i); + return (o = 'String.fromCharCode(' + r.join(',') + ')'), new Function('return ' + o)(); + }, + _ = function (t, e) { + t = N(t); + if (t) { + var n, + i, + r = t.indexOf('#'); + if (0 < r) + return ( + (n = document.domain), + (i = t.substr(0, r)), + (t = t.substr(r + 1)), + (r = atob(e.split('_')[1])), + i == n && r == t + ); + } + return !1; + }, + L = function (t, e, n, i, r) { + return -1; + if ( + !document.domain || + 0 < + atob('bG9jYWxob3N0LWdyYXBodmlzLTEyNy4wLjAuMQ==') + .split('-') + .filter(function (t) { + return document.domain.includes(t); + }).length + ) + return !1; + _(r, t) || + setTimeout( + decodeURIComponent( + atob( + (524 != (r = M.concat(E).concat(C).join('')).length && + setTimeout( + decodeURIComponent( + atob( + [ + 'YWxlcnQoJyVFNCVCRCVBMCVFNiVBRCVBMyVF', + 'NSU5QyVBOCVFNCVCRCVCRiVFNyU5NCV', + 'BOCVFNyU5QiU5NyVFNyU4OSU4OCVFNyVCQiU4N', + 'CVFNCVCQiVCNiVFNSVCQSU5MyVFRiVCQyU4QyVFNSVBNiU4MiVFOCU4QiVBNSVFNSU4RiU5MSVFNyU4RSVCMCVFNSVCMCU4NiVFOCVCNSVCMCVFNiVCMyU5NSVFNSVCRSU4QiVFOSU4MCU5NCVFNSVCRSU4NCVFNyVCQiVCNCVFNiU4QSVBNCVFNCVCRCU5QyVFOCU4MCU4NSVFNiU5RCU4MyVFNyU5QiU4QSVFRiVCQyU4MScp', + ].join(''), + ), + ), + 20, + ), + r), + ), + ), + 20, + ); + }; +function S(t) { + var e, + n = {}; + for (e in t) 'returnValue' != e && 'keyLocation' != e && (n[e] = t[e]); + return n; +} +function T(t, e, n, i) { + var r, + n = null == n && null == i ? ((r = e.x - t.x), e.y - t.y) : ((r = n - t), i - e); + return Math.sqrt(r * r + n * n); +} +function P(t, e, n, i) { + var r = (i - e) / (n - t), + o = e - t * r; + function a(t) { + return t * r + o; + } + return (a.k = r), (a.b = o), (a.x1 = t), (a.x2 = n), (a.y1 = e), (a.y2 = i), a; +} +function A(t, e, n) { + var i = Math.abs(e - n), + e = Math.abs(e - t), + n = Math.abs(n - t); + return Math.abs(i - (e + n)) < 1e-6; +} +function O(t, e, n) { + return A(t, n.x1, n.x2) && A(e, n.y1, n.y2); +} +function I(t, e) { + return t.k == e.k || + ((i = + 1 / 0 == t.k || t.k == -1 / 0 + ? ((n = t.x1), e(t.x1)) + : 1 / 0 == e.k || e.k == -1 / 0 + ? ((n = e.x1), t(e.x1)) + : t((n = (e.b - t.b) / (t.k - e.k)))), + 0 == O(n, i, t)) || + 0 == O(n, i, e) + ? null + : { x: n, y: i }; + var n, i; +} +function D(t, e) { + return (t[0] - e[0]) * (t[0] - e[0]) + (t[1] - e[1]) * (t[1] - e[1]); +} +function B(t, e, n, i, r) { + var o = 1 - r; + return o * o * (o * t + 3 * r * e) + r * r * (r * i + 3 * o * n); +} +function R(t, e, n, i) { + var r = 1 - i; + return r * (r * t + 2 * i * e) + i * i * n; +} +function z(t, e) { + return Math.random() * (e - t + 1) + t; +} +var V = { + getDistance: T, + isFirefox: 0 < navigator.userAgent.indexOf('Firefox'), + isIE: !(!window.attachEvent || -1 !== navigator.userAgent.indexOf('Opera')), + isChrome: null != navigator.userAgent.toLowerCase().match(/chrome/), + clone: function (t) { + var e, + n = {}; + for (e in t) n[e] = t[e]; + return n; + }, + isPointInLine: function (t, e, n) { + var i = T(e, n), + e = T(e, t), + n = T(n, t); + return Math.abs(e + n - i) <= 0.5; + }, + removeFromArray: function (t, e) { + for (var n = 0; n < t.length; n++) { + var i = t[n]; + if (i === e || i.id == e.id) { + t.splice(n, 1); + break; + } + } + return t; + }, + getEventPosition: function (t) { + var e = null; + return ( + t.pageX + ? (e = S(t)) + : (((e = S(t)).pageX = t.clientX + document.body.scrollLeft - document.body.clientLeft), + (e.pageY = t.clientY + document.body.scrollTop - document.body.clientTop)), + e + ); + }, + cloneEvent: S, + getOffsetPosition: function (t) { + var e, n, i, r, o, a, s; + return t + ? ((s = a = 0), + 'getBoundingClientRect' in document.documentElement + ? ((e = t.getBoundingClientRect()), + (n = (i = t.ownerDocument).body), + (r = (i = i.documentElement).clientTop || n.clientTop || 0), + (o = i.clientLeft || n.clientLeft || 0), + (a = e.top + (self.pageYOffset || (i && i.scrollTop) || n.scrollTop) - r), + (s = e.left + (self.pageXOffset || (i && i.scrollLeft) || n.scrollLeft) - o)) + : ((a += t.offsetTop || 0), (s += t.offsetLeft || 0), (t = t.offsetParent)), + { left: s, top: a }) + : { left: 0, top: 0 }; + }, + lineVir: P, + intersection: I, + intersectionLineBound: function (t, e) { + var n = I(t, P(e.left, e.top, e.left, e.bottom)); + return (n = + null == n && + null == (n = I(t, P(e.left, e.top, e.right, e.top))) && + null == (n = I(t, P(e.right, e.top, e.right, e.bottom))) + ? I(t, P(e.left, e.bottom, e.right, e.bottom)) + : n); + }, + pointOnCircle: function (t, e, n, i) { + return { x: t + n * Math.cos(i), y: e + n * Math.sin(i) }; + }, + pointInCircle: function (t, e, n, i, r) { + return (t - n) * (t - n) + (e - i) * (e - i) < r * r; + }, + calPointOnCircle: function (t, e, n, i) { + i = 2 * i * Math.PI; + return { x: t + n * Math.cos(i), y: e - n * Math.sin(i) }; + }, + findAngle: function (t, e, n, i) { + i = Math.atan((i - e) / (n - t)); + return 0 <= n - t ? i : i + Math.PI; + }, + isPointOnLineSegment: function (t, e, n, i) { + var r = Math.sqrt(Math.pow(n.x - e.x, 2) + Math.pow(n.y - e.y, 2)), + o = (n.x - e.x) / r, + n = (n.y - e.y) / r, + a = t.x - e.x, + t = t.y - e.y, + e = a * o + t * n; + return !(e < 0 || r < e) && Math.abs(a * -n + t * o) <= i / 2; + }, + containStroke: function (t, e, n, i, r, o, a) { + var s; + return ( + 0 !== r && + ((s = 0), + !( + (e + (r = r) < a && i + r < a) || + (a < e - r && a < i - r) || + (t + r < o && n + r < o) || + (o < t - r && o < n - r) + )) && + (t === n + ? Math.abs(o - t) <= r / 2 + : ((o = (s = (e - i) / (t - n)) * o - a + (t * i - n * e) / (t - n)) * o) / (s * s + 1) <= ((r / 2) * r) / 2) + ); + }, + containBerzierStroke: function (t, e, n, i, r, o, a, s, h, w, c) { + return ( + 0 !== h && + !( + (e + (h = h) < c && i + h < c && o + h < c && s + h < c) || + (c < e - h && c < i - h && c < o - h && c < s - h) || + (t + h < w && n + h < w && r + h < w && a + h < w) || + (w < t - h && w < n - h && w < r - h && w < a - h) + ) && + (function (t, e, n, i, r, o, a, s, h) { + var c, + u, + l, + d, + f = 0.005, + g = 1 / 0, + p = [], + y = [], + v = []; + (p[0] = w), (p[1] = h); + for (var m = 0; m < 1; m += 0.05) + (y[0] = B(t, n, r, a, m)), (y[1] = B(e, i, o, s, m)), (l = D(p, y)) < g && ((c = m), (g = l)); + for (var g = 1 / 0, x = 0; x < 32 && !(f < 1e-4); x++) + (u = c + f), + (y[0] = B(t, n, r, a, (d = c - f))), + (y[1] = B(e, i, o, s, d)), + (l = D(y, p)), + 0 <= d && l < g + ? ((c = d), (g = l)) + : ((v[0] = B(t, n, r, a, u)), + (v[1] = B(e, i, o, s, u)), + (d = D(v, p)), + u <= 1 && d < g ? ((c = u), (g = d)) : (f *= 0.5)); + return Math.sqrt(g); + })(t, e, n, i, r, o, a, s, c) <= + h / 2 + ); + }, + containQuadraticStroke: function (t, e, n, i, r, o, a, m, s) { + return ( + 0 !== a && + !( + (e + (a = a) < s && i + a < s && o + a < s) || + (s < e - a && s < i - a && s < o - a) || + (t + a < m && n + a < m && r + a < m) || + (m < t - a && m < n - a && m < r - a) + ) && + (function (t, e, n, i, r, o, a) { + var s, + h = 0.005, + c = 1 / 0, + u = 0, + l = [], + d = [], + f = []; + (l[0] = m), (l[1] = a); + for (var g = 0; g < 1; g += 0.05) + (d[0] = R(t, n, r, g)), (d[1] = R(e, i, o, g)), (u = D(l, d)) < c && ((s = g), (c = u)); + for (var c = 1 / 0, p = 0; p < 32 && !(h < 1e-4); p++) { + var y = s - h, + v = s + h; + (d[0] = R(t, n, r, y)), + (d[1] = R(e, i, o, y)), + (u = D(d, l)), + 0 <= y && u < c + ? ((s = y), (c = u)) + : ((f[0] = R(t, n, r, v)), + (f[1] = R(e, i, o, v)), + (y = D(f, l)), + v <= 1 && y < c ? ((s = v), (c = y)) : (h *= 0.5)); + } + return Math.sqrt(c); + })(t, e, n, i, r, o, s) <= + a / 2 + ); + }, + near: function (t, e, n, i, r) { + return Math.sqrt(Math.pow(n - t, 2) + Math.pow(i - e, 2)) <= r; + }, + isInPolygon: function (t, e) { + for (var n, i, r = 0, o = e.length, a = e[0], s = 1; s <= o; s++) + (i = e[s % o]), + t[0] > Math.min(a[0], i[0]) && + t[0] <= Math.max(a[0], i[0]) && + t[1] <= Math.max(a[1], i[1]) && + a[0] != i[0] && + ((n = ((t[0] - a[0]) * (i[1] - a[1])) / (i[0] - a[0]) + a[1]), a[1] == i[1] || t[1] <= n) && + r++, + (a = i); + return r % 2 != 0; + }, + findDotsAtSegment: function (t, e, n, i, r, o, a, s, h) { + var c = 1 - h, + u = Math.pow(c, 3), + l = Math.pow(c, 2), + d = h * h, + f = d * h, + g = u * t + 3 * l * h * n + 3 * c * h * h * r + f * a, + u = u * e + 3 * l * h * i + 3 * c * h * h * o + f * s, + l = t + 2 * h * (n - t) + d * (r - 2 * n + t), + f = e + 2 * h * (i - e) + d * (o - 2 * i + e), + p = n + 2 * h * (r - n) + d * (a - 2 * r + n), + d = i + 2 * h * (o - i) + d * (s - 2 * o + i), + t = c * t + h * n, + n = c * e + h * i, + e = c * r + h * a, + i = c * o + h * s, + r = 90 - (180 * Math.atan2(l - p, f - d)) / Math.PI; + return ( + (p < l || f < d) && (r += 180), + { x: g, y: u, m: { x: l, y: f }, n: { x: p, y: d }, start: { x: t, y: n }, end: { x: e, y: i }, alpha: r } + ); + }, + getSelfLoopControlPoints: function (t, e, n) { + return { x1: t + 7 * n, y1: e, x2: t, y2: e - 7 * n }; + }, + getPointOnBezierCurve: function (t, e, n, i, r, o, a, s, h) { + var c = Math.pow(1 - t, 3), + u = 3 * t * Math.pow(1 - t, 2), + l = 3 * Math.pow(t, 2) * (1 - t), + t = Math.pow(t, 3); + return { x: c * e + u * o + l * s + t * i, y: c * n + u * a + l * h + t * r }; + }, + getQuadraticControlPoint: function (t, e, n, i, r, o) { + return { x: (t + n) * (o = o || 0.5) + (i - e) / (r || 4), y: (e + i) * o + (t - n) / (r || 4) }; + }, + getPointOnQuadraticCurve: function (t, e, n, i, r, o, a) { + return { + x: Math.pow(1 - t, 2) * e + 2 * (1 - t) * t * o + Math.pow(t, 2) * i, + y: Math.pow(1 - t, 2) * n + 2 * (1 - t) * t * a + Math.pow(t, 2) * r, + }; + }, + calculateAngle: function (t, e, n, i) { + var r = Math.abs(t - n), + o = Math.abs(e - i), + r = Math.sqrt(Math.pow(r, 2) + Math.pow(o, 2)), + o = Math.acos(o / r), + r = Math.floor(180 / (Math.PI / o)); + return ( + t < n && e < i && (r = 180 - r), + n == t && e < i && (r = 180), + t < n && i == e && (r = 90), + n < t && e < i && (r = 180 + r), + n < t && i == e && (r = 270), + (r = n < t && i < e ? 360 - r : r) + ); + }, + getPointsCenter: function (t) { + var e = 0, + n = 0; + if (0 < t.length) { + var i, + r = m(t); + try { + for (r.s(); !(i = r.n()).done; ) { + var o = i.value; + (e += o.x), (n += o.y); + } + } catch (t) { + r.e(t); + } finally { + r.f(); + } + (e /= t.length), (n /= t.length); + } + return { x: e, y: n }; + }, + createWebWorker: function (t) { + (t = new Blob([t], { type: 'application/javascript' })), (t = URL.createObjectURL(t)); + return new Worker(t); + }, + getRandomRange: z, + getRandomRangeRGBColor: function (t, e) { + return (r = 0 | z(t, e)), (g = 0 | z(t, e)), (b = 0 | z(t, e)), r + ',' + g + ',' + b; + }, + genrateTextSvg: function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 60, + n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 60, + i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {}, + r = i.isVertical, + o = i.fontColor, + a = i.fontFamily, + s = i.fontWeight, + i = i.fontSize, + h = document.createElement('div'); + (h.innerText = t), + (h.style = '\n word-wrap: break-word;\n word-break: break-all;\n font-family : ' + .concat(a || 'Arial', ';\n font-weight : ') + .concat(s || 'normal', ';\n font-size: ') + .concat(i || 13, 'px;\n text-align: ') + .concat(r ? 'left' : 'center', ';\n color: ') + .concat(o || '#333', ';\n ') + .concat(r ? 'height' : 'width', ': 100%;\n position: relative;\n ') + .concat(r ? 'right: 50%; transform: translateX(50%);' : 'top: 50%; transform: translateY(-50%);', '\n ') + .concat(r ? 'writing-mode: vertical-rl;' : '', '\n ') + .concat(r ? 'float: right;' : '', '\n ')); + return 'data:image/svg+xml;charset=utf-8,\n \n \n \n ') + .concat(h.outerHTML, '\n \n \n '); + }, + buildMutilTextSvg: function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 100, + n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 30, + i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : {}, + r = document.createElement('div'), + o = '', + a = + (t.forEach(function (t) { + o += '
' + t + '
'; + }), + (r.innerHTML = o), + i.fontColor), + s = i.font, + h = i.backgroundColor, + c = i.borderColor, + i = i.borderRadius, + s = + ((r.style = + '\n width : calc(100% - 2px);\n position: relative;\n top: 50%; \n transform: translateY(-50%);\n text-align: center;\n font : ' + .concat(s || 'normal 13px Arial', ';\n color: ') + .concat(a || '#333', ';\n background-color:') + .concat(h || 'none', ';\n border: ') + .concat(c ? '1px solid ' + c : 'none', ';\n border-radius:') + .concat(i || 2, 'px;\n ')), + '\n \n \n ', + ) + .concat(r.outerHTML, '\n \n \n ')); + return 'data:image/svg+xml;charset=utf-8,'.concat(s); + }, + calcWrappedTextLines: function (h, t, c) { + var t = t.split('\n'), + u = []; + return ( + t.forEach(function (t, e) { + for (var n = t.split(''), i = '', r = [], o = 0; o < n.length; o++) + var a = i + n[o], + s = h.measureText(a).width, + i = c < s && 0 < o ? (r.push({ text: i, width: s }), n[o]) : a; + r.push({ text: i, width: c }), (u = u.concat(r)); + }), + u + ); + }, + }, + j = { + version: 'v2.4.0', + buildTime: '2024-08-02 15:31:04', + Group_zIndex: 1, + Link_zIndex: 2, + Node_zIndex: 3, + imgStore: {}, + }; +function F(t) { + (this.name = t), + (this.messageMap = {}), + (this.messageCount = 0), + (this.subscribe = function (t, e) { + null == this.messageMap[t] && (this.messageMap[t] = []), this.messageMap[t].push(e), this.messageCount++; + }), + (this.unsubscribe = function (t) { + null != this.messageMap[t] && ((this.messageMap[t] = null), delete this.messageMap[t], this.messageCount--); + }), + (this.publish = function (t, e, n) { + var i = this.messageMap[t]; + if (null != i) + for (var r = 0; r < i.length; r++) + n + ? (function (t, e) { + setTimeout(function () { + t(e); + }, 10); + })(i[r], e) + : i[r](e); + }); +} +function X(a, i) { + (this.padding = 0), + (this.visible = !1), + (this.container = null), + (this.canvas = null), + (this.viewBox = null), + (this.thumbnailCtx = null), + (this.width = i.width), + (this.height = i.height), + (this.timer = null), + (this.sceneChilds = 0), + (this.initialize = function () { + var t = document.createElement('div'), + e = + ((t.className = 'thumbnail'), + (t.style.cssText = '\n position: absolute;\n width : ' + .concat(this.width, 'px;\n height: ') + .concat( + this.height, + 'px;\n border: 1px solid #e1d2d2;\n background-color: transparent;\n overflow:hidden;\n user-select: none;\n -webkit-user-drag: none;\n -webkit-tap-highlight-color: rgba(0,0,0 0);', + )), + document.createElement('canvas')), + n = + ((e.style.cssText = + 'width:100%;height:100%;background-color:transparent;cursor:not-allowed;pointer-events:none;'), + (e.width = this.width * a.pixelRatio), + (e.height = this.height * a.pixelRatio), + i.container), + n = document.getElementById(n), + n = + (n + ? (n.appendChild(t), (t.style.left = 0), (t.style.top = 0)) + : ((a.canvas.parentNode.style.position = 'relative'), + a.canvas.parentNode.appendChild(t), + (t.style.right = 0), + (t.style.bottom = 0)), + t.appendChild(e), + document.createElement('div')); + (n.style.cssText = 'position:absolute;top:0px;left:0px;width:' + .concat(this.width * a.pixelRatio, 'px;height:') + .concat(this.height * a.pixelRatio, 'px;border:1px solid ') + .concat(i.viewColor, ';background:rgba(110,110,250,0.3);cursor:not-allowed;pointer-events:none;')), + t.appendChild(n), + (this.container = t), + (this.canvas = e), + (this.thumbnailCtx = e.getContext('2d')), + (this.viewBox = n), + this.addThumbEvents(); + }), + (this.addThumbEvents = function () { + var o = this; + this.container.addEventListener('click', function (t) { + var e = t.offsetX, + t = t.offsetY, + n = a.boundCache, + i = a.childs[0], + e = n.left * (o.width / n.width) + e, + t = n.top * (o.height / n.height) + t, + r = a.width / (i.scale * n.width), + n = ((t /= a.height / (i.scale * n.height)), (e /= r) / ((o.width / a.width) * i.scale)), + r = t / ((o.height / a.height) * i.scale); + i.setCenter(n, r), a.repaint(); + }); + }), + (this.destory = function () { + (this.visible = !1), + (this.sceneChilds = 0), + clearInterval(this.timer), + this.container && + (this.container.removeEventListener('click', function () {}, !1), + this.container.parentNode.removeChild(this.container), + (this.container = null), + (this.canvas = null), + (this.thumbnailCtx = null)); + }), + (this.show = function () { + var e = this; + this.visible || + null != this.container || + (this.initialize(), + (this.visible = !0), + (e.timer = setInterval(function () { + var t = a.childs[0].childs.length; + (0 != t && e.sceneChilds == t) || (e.update(), e.paint()), (e.sceneChilds = t); + }, 1e3))); + }), + (this.update = function () { + var t = a.getBound(); + if (null == t || t.width < 0) return null; + var e = a.childs[0], + n = this.width * a.pixelRatio, + i = this.height * a.pixelRatio, + t = Math.min(n / t.width, i / t.height), + r = this.thumbnailCtx; + r.save(), r.clearRect(0, 0, n, i), e.save(), e.centerAndZoom(t, r), e.paintNodes(r), e.restore(), r.restore(); + }), + (this.paint = function () { + var t, e, n, i, r; + this.visible && + null != (e = a.boundCache) && + ((i = (r = (t = a.childs[0]).getOffsetTranslate()).translateX * (this.width / a.width) * t.scale), + (r = r.translateY * (this.height / a.height) * t.scale), + (n = a.width / (t.scale * e.width)), + (t = a.height / (t.scale * e.height)), + (i = i * n + e.left * (this.width / e.width)), + (r = r * t + e.top * (this.height / e.height)), + (e = Math.round(this.width * n)), + (n = Math.round(this.height * t)), + (i = Math.round(i)), + (r = Math.round(r)), + (this.viewBox.style.width = ''.concat(e, 'px')), + (this.viewBox.style.height = ''.concat(n, 'px')), + (this.viewBox.style.left = ''.concat(-i, 'px')), + (this.viewBox.style.top = ''.concat(-r, 'px'))); + }); +} +function U(t, n, i) { + var a = this, + r = + ((a.canvasElements = new Map()), + (a.canvasContexts = new Map()), + (a.container = t), + (a.container.style.position = 'relative'), + atob(['d3d3', 'LmdyY', 'XBodm', 'lzLmNu'].join(''))), + t = h('background'), + o = h('elements'), + e = h('mouse'); + function s(t) { + var t = j.util.getEventPosition(t), + e = j.util.getOffsetPosition(a.canvas); + return ( + (t.offsetLeft = t.pageX - e.left), + (t.offsetTop = t.pageY - e.top), + (t.x = t.offsetLeft * a.pixelRatio), + (t.y = t.offsetTop * a.pixelRatio), + (t.target = null), + t + ); + } + function h(t) { + var e = document.createElement('canvas'); + return ( + e.setAttribute('class', 'graphvis-'.concat(t)), + (e.style.position = 'absolute'), + (e.style.left = '0'), + (e.style.top = '0'), + a.canvasElements.set(t, e), + a.canvasContexts.set(t, e.getContext('2d')), + a.container.appendChild(e), + e + ); + } + function c() { + var n = a.container.offsetWidth || 200, + i = a.container.offsetHeight || 100, + r = Math.round(n * a.pixelRatio), + o = Math.round(i * a.pixelRatio); + a.canvasElements.forEach(function (t, e) { + (t.style.width = n + 'px'), (t.style.height = i + 'px'), (t.width = r), (t.height = o); + }), + (a.offCanvas.width = r), + (a.offCanvas.height = o); + } + function u(t) { + document.onselectstart = function () { + return !1; + }; + t = s(t); + a.dispatchEventToScenes('mouseover', t), a.dispatchEvent('mouseover', t); + } + function l(t) { + (a.needRepaint = !1), + a.mouseDown && f(t), + (document.onselectstart = function () { + return !0; + }); + t = s(t); + a.dispatchEventToScenes('mouseout', t), a.dispatchEvent('mouseout', t); + } + function d(t) { + a.mouseDown = !0; + t = s(t); + (a.mouseDownX = t.x), + (a.mouseDownY = t.y), + a.dispatchEventToScenes('mousedown', t), + a.dispatchEvent('mousedown', t); + } + function f(t) { + (a.mouseDown = !1), + a.dragging && + ((a.dragEndMouseUp = !0), + setTimeout(function () { + (a.dragEndMouseUp = !1), (a.dragging = !1), (a.needRepaint = !0); + }, 200)); + t = s(t); + a.dispatchEventToScenes('mouseup', t), + a.dispatchEvent('mouseup', t), + (a.needRepaint = !1), + a.clearSelectArea(), + a.thumbnail.visible && a.thumbnail.update(); + } + function g(t) { + var e = s(t); + !a.mouseDown || (1 != t.buttons && 0 != t.buttons) + ? (a.staticMode || (a.dispatchEventToScenes('mousemove', e), a.dispatchEvent('mousemove', e)), + null != a.addLineStartPoint && a.paintCustomeLine(a.addLineStartPoint, e, a.addLineStartPoint.color)) + : ((e.dx = e.x - a.mouseDownX), + (e.dy = e.y - a.mouseDownY), + 2 < Math.sqrt(e.dx * e.dx + e.dy * e.dy) && + ((a.dragging = !0), a.dispatchEventToScenes('mousedrag', e), a.dispatchEvent('mousedrag', e))); + } + function p(e) { + if ((e.preventDefault(), a.dragEndMouseUp)) return !1; + clearTimeout(a.clickTimer), + (a.clickTimer = setTimeout(function () { + var t = s(e); + a.dispatchEventToScenes('click', t), a.dispatchEvent('click', t); + }, 200)), + (a.addLineStartPoint = null); + } + function y(t) { + t.preventDefault(), clearTimeout(a.clickTimer); + t = s(t); + a.dispatchEventToScenes('dbclick', t), a.dispatchEvent('dbclick', t); + } + function v(t) { + a.wheelZoom && + ((a.needRepaint = !0), + (a.wheeling = a.smoothWheelMode), + 0 < (null == t.wheelDelta ? t.detail : t.wheelDelta) ? a.zoomOut(a.wheelZoom) : a.zoomIn(a.wheelZoom), + t.preventDefault ? t.preventDefault() : (t.returnValue = !1), + (t = s(t)), + a.dispatchEventToScenes('mousewheel', t), + clearTimeout(a.wheelTimer), + (a.wheelTimer = setTimeout(function () { + (a.wheeling = !1), (a.needRepaint = !0); + }, 200))); + } + function m(t) { + var e; + function n(t, e) { + var n = e.pageX - t.pageX, + e = e.pageY - t.pageY; + return Math.sqrt(n * n + e * e); + } + t.preventDefault(), + !a.istouch || (t.touches && t.touches.length < 2) + ? g(b(t, 'mousemove')) + : (t.preventDefault(), + (t = t.touches), + (e = a.touchStart), + n(t[0], t[1]) < n(e[0], e[1]) ? a.zoomIn(0.85) : n(t[0], t[1]) > n(e[0], e[1]) && a.zoomOut(0.85), + (a.touchStart = t), + (a.needRepaint = !0)); + } + function x(t) { + (a.istouch = !0), + t.touches && t.touches.length < 2 ? d(b(t, 'mousedown')) : 2 <= (t = t.touches).length && (a.touchStart = t); + } + function w(t) { + a.istouch && ((a.istouch = !1), (a.touchStart = null), f(b(t, 'mousedown'))); + } + function b(t, e) { + var n, i, r; + return ( + !(!t.changedTouches || 1 != t.changedTouches.length) && + ((n = (t = t.changedTouches[0]).clientX), + (i = t.clientY), + (r = t.screenX), + (t = t.screenY), + new MouseEvent(e, { clientX: n, clientY: i, screenX: r, screenY: t, button: 0, buttons: 0 })) + ); + } + function k(t) { + a.resize(); + } + 'undefined' != typeof OffscreenCanvas + ? (a.offCanvas = new OffscreenCanvas(300, 200)) + : (a.offCanvas = document.createElement('canvas')), + (a.canvas = e), + (a.backgrounGraphics = t.getContext('2d')), + (a.viewGraphics = o.getContext('2d', { willReadFrequently: !1 })), + (a.graphics = a.offCanvas.getContext('2d', { willReadFrequently: !0 })), + (a.mouseGraphics = e.getContext('2d')), + (a.pixelRatio = (function () { + var t, + e = o.getContext('2d'); + if (void 0 !== e) + return ( + (t = 1), + (t = 'undefined' != typeof window ? window.devicePixelRatio || 1 : t) / + (e.webkitBackingStorePixelRatio || + e.mozBackingStorePixelRatio || + e.msBackingStorePixelRatio || + e.oBackingStorePixelRatio || + e.backingStorePixelRatio || + 1) + ); + })()), + c(), + _(a.backgrounGraphics, a.canvas.width, a.canvas.height), + i; + var M = !(e.oncontextmenu = function (t) { + if (2 == t.button) return t.preventDefault(), !1; + }); + function E(t) { + M || ((M = !0), a.dispatchEventToScenes('keydown', j.util.cloneEvent(t), !1)); + } + function C(t) { + a.dispatchEventToScenes('keyup', j.util.cloneEvent(t), !1), (M = !1); + } + function T(t) { + t.removeEventListener('mouseout', l), + t.removeEventListener('mouseover', u), + t.removeEventListener('mousedown', d), + t.removeEventListener('mouseup', f), + t.removeEventListener('mousemove', g), + t.removeEventListener('click', p), + t.removeEventListener('dblclick', y), + t.removeEventListener('touchstart', x), + t.removeEventListener('touchmove', m), + t.removeEventListener('touchend', w), + window.removeEventListener('resize', k), + window.removeEventListener('keydown', E), + window.removeEventListener('keyup', C); + } + function N(t, e, n, i, r) { + t.clearRect(0, 0, i, r); + var o = t.globalAlpha; + t.save(), + (t.globalAlpha = Number(n) || 1), + e.width < i || e.height < r + ? ((n = t.createPattern(e, 'repeat')), (t.fillStyle = n), t.fillRect(0, 0, i, r)) + : t.drawImage(e, 0, 0, i, r), + (t.globalAlpha = o), + t.restore(), + _(t, i, r); + } + function _(t, e, n) { + i || + (t.save(), + (t.textAlign = 'center'), + (t.textBaseline = 'middle'), + (t.font = 'italic 20px Arial'), + (t.fillStyle = 'rgba(80,80,80,0.5)'), + t.fillText('', e - 100, n - 24), + t.restore()), + a.copyRightConf && + (t.save(), + (t.textAlign = 'center'), + (t.textBaseline = 'middle'), + (t.font = a.copyRightConf.font || 'italic 20px Arial'), + (t.fillStyle = a.copyRightConf.color || 'rgba(80,80,80,0.5)'), + t.fillText(a.copyRightConf.text, e - (a.copyRightConf.right || 100), n - (a.copyRightConf.bottom || 24)), + t.restore()); + } + (this.initialize = function (t) { + var e; + (this.childs = []), + (this.fps = -50), + (this.eventBus = new F()), + (this.wheelZoom = 0.9), + (this.mouseDownX = 0), + (this.mouseDownY = 0), + (this.mouseDown = !1), + (this.needRepaint = !1), + (this.istouch = !1), + (this.touchStart = null), + (this.wheeling = !1), + (this.dragging = !1), + (this.dragEndMouseUp = !1), + (this.clickTimer = null), + (this.wheelTimer = null), + (this.openDragHideEffect = !1), + (this.smoothWheelMode = !0), + (this.staticMode = !1), + (this.requestAnimateId = null), + (this.loadingAnimateId = null), + (this.boundCache = null), + (this.showDetailScale = 0.1), + (this.selectBoxColor = '10,10,225'), + (this.selectBoxAlpha = 0.1), + (this.addLineStartPoint = null), + (this.thumbnail = new X(this, n || {})), + (this.mutalScale = 1), + T((e = t)), + j.util.isIE || !window.addEventListener + ? ((e.onmouseout = l), + (e.onmouseover = u), + (e.onmousedown = d), + (e.onmouseup = f), + (e.onmousemove = g), + (e.onclick = p), + (e.ondblclick = y), + (e.onmousewheel = v), + (e.touchstart = x), + (e.touchmove = m), + (e.touchend = w)) + : (e.addEventListener('mouseout', l), + e.addEventListener('mouseover', u), + e.addEventListener('mousedown', d), + e.addEventListener('mouseup', f), + e.addEventListener('mousemove', g), + e.addEventListener('click', p), + e.addEventListener('dblclick', y), + e.addEventListener('touchstart', x), + e.addEventListener('touchmove', m), + e.addEventListener('touchend', w), + j.util.isFirefox ? e.addEventListener('DOMMouseScroll', v) : e.addEventListener('mousewheel', v), + window.addEventListener('resize', k), + window.addEventListener('keydown', E), + window.addEventListener('keyup', C)), + (this.resize = function () { + var t = this.container.offsetWidth, + e = this.container.offsetHeight; + if (0 == t || 0 == e) return !1; + c(), this.paint(), this.repaintBackGround(this.backgrounGraphics, this.width, this.height); + }), + (this.dispatchEventToScenes = function (n, i) { + (this.needRepaint = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2]), + this.childs.forEach(function (t) { + if (1 == t.visible) { + var e = t[n + 'Handler']; + if (null == e) return null; + e.call(t, i); + } + }); + }), + (this.add = function (t) { + for (var e = 0; e < this.childs.length; e++) if (this.childs[e] === t) return; + t.addTo(this), this.childs.push(t); + }), + (this.remove = function (t) { + if (null == t) return null; + for (var e = 0; e < this.childs.length; e++) + if (this.childs[e] === t) { + (t.stage = null), this.childs.splice(e, 1); + break; + } + return this; + }), + (this.clear = function () { + this.childs = []; + }), + (this.addEventListener = function (t, e) { + var n = this; + return ( + this.eventBus.subscribe(t, function (t) { + e.call(n, t); + }), + this + ); + }), + (this.removeEventListener = function (t) { + this.eventBus.unsubscribe(t); + }), + (this.removeAllEventListener = function () { + (this.eventBus = new F()), T(t); + }), + (this.dispatchEvent = function (t, e) { + return this.eventBus.publish(t, e), this; + }), + (this.paint = function () { + 0 < this.childs.length && + !this.painting && + ((this.painting = !0), + this.graphics.save(), + this.graphics.clearRect(0, 0, this.width, this.height), + this.childs.forEach(function (t) { + t.visible && t.repaint(a.graphics); + }), + this.graphics.restore(), + a.viewGraphics.clearRect(0, 0, this.width, this.height), + 'undefined' != typeof OffscreenCanvas + ? a.viewGraphics.drawImage(a.offCanvas.transferToImageBitmap(), 0, 0) + : a.viewGraphics.drawImage(a.offCanvas, 0, 0), + a.thumbnail.visible && a.thumbnail.paint(), + (this.painting = !1)); + }), + (this.repaint = function () { + 0 < this.fps + ? this.paint() + : this.fps < 0 + ? this.needRepaint && (this.paint(), (this.needRepaint = !1)) + : (this.needRepaint = !1); + }), + (this.updateView = function () { + this.needRepaint = !0; + }), + (this.repaintBackGround = function (t, e, n) { + t.clearRect(0, 0, e, n), + t.save(), + this.backGroundColor && ((t.fillStyle = this.backGroundColor), t.fillRect(0, 0, e, n)), + null != this.backGroundImage && N(t, this.backGroundImage, this.backGroundOpaticy, e, n), + _(t, e, n), + t.restore(); + }), + (this.getPagePosition = function (t, e) { + var n, i, r; + return this.childs && 0 != this.childs.length + ? ((i = (n = this.childs && this.childs[0]).getOffsetTranslate()), + (r = j.util.getOffsetPosition(this.canvas)), + (t = ((t + i.translateX) * n.scale) / this.pixelRatio), + (e = ((e + i.translateY) * n.scale) / this.pixelRatio), + { pageX: t + r.left, pageY: e + r.top, offsetX: r.left, offsetY: r.top }) + : { pageX: 0, pageY: 0 }; + }), + (this.getImageUrlData = function (t) { + var e = this.getBound(); + if (null == e || e.width < 0) return null; + var n = t.width || 1e4, + i = t.height || 1e4, + r = e.width, + o = e.height, + a = 0, + s = 0, + h = 0, + c = 0, + h = + ((r += + (h = e.leftNode + ? 'node' == e.leftNode.elementType && 1 < e.leftNode.scale + ? 'rect' == e.leftNode.shape + ? Math.round((e.leftNode.width / 2) * e.leftNode.scale) + : Math.round(e.leftNode.radius * e.leftNode.scale) + : 50 + : h) + + (c = e.rightNode + ? 'node' == e.rightNode.elementType && 1 < e.rightNode.scale + ? 'rect' == e.rightNode.shape + ? Math.round((e.rightNode.width / 2) * e.rightNode.scale) + : Math.round(e.rightNode.radius * e.rightNode.scale) + : 50 + : c) + + 200), + (o += + (a = e.topNode + ? 'node' == e.topNode.elementType && 1 < e.topNode.scale + ? 'rect' == e.topNode.shape + ? Math.round((e.topNode.height / 2) * e.topNode.scale) + : Math.round(e.topNode.radius * e.topNode.scale) + : 50 + : a) + + (s = e.bottomNode + ? 'node' == e.bottomNode.elementType && 1 < e.bottomNode.scale + ? 'rect' == e.bottomNode.shape + ? Math.round((e.bottomNode.height / 2) * e.bottomNode.scale) + : Math.round(e.bottomNode.radius * e.bottomNode.scale) + : 50 + : s) + + 200), + document.createElement('canvas')), + c = Math.min(n, r) * this.mutalScale, + a = Math.min(i, o) * this.mutalScale, + e = ((h.width = c), (h.height = a), Math.min(c / r, a / o)), + s = + (Math.max(r, o) < 500 && + ((h.width = Math.max(Math.max(r, o), 500)), (h.height = Math.max(Math.max(r, o), 500))), + h.getContext('2d')), + n = + ((s.mozImageSmoothingEnabled = !1), + (s.webkitImageSmoothingEnabled = !1), + (s.msImageSmoothingEnabled = !1), + (s.imageSmoothingEnabled = !1), + this.repaintBackGround(s, h.width, h.height), + t.background && + (s.save(), (s.fillStyle = t.background || '#fff'), s.fillRect(0, 0, h.width, h.height), s.restore()), + t.textWatermark && + (s.save(), + this.paintTextWatermark(s, h.width, h.height, { + content: t.textWatermark.content || 'GraphVis可视化', + angle: t.textWatermark.angle || -30, + alpha: t.textWatermark.alpha || 0.1, + fontStyle: t.textWatermark.fontStyle || 'normal', + fontSize: t.textWatermark.fontSize || 40, + fontFamliy: t.textWatermark.fontFamliy || 'Arial', + fontColor: t.textWatermark.fontColor || '#666', + }), + s.restore()), + this.childs[0]), + i = (n.save(), n.centerAndZoom(e, s), n.repaint(s, !0), n.restore(), null); + try { + i = h.toDataURL('image/' + (t.type || 'png'), 1); + } catch (t) {} + return i; + }), + (this.paintTextWatermark = function (t, e, n, i) { + var r = i.content, + o = i.alpha, + a = i.angle, + s = i.fontSize, + h = i.fontStyle, + c = i.fontFamliy, + i = i.fontColor, + h = ((t.font = ''.concat(h, ' ').concat(s, 'px ').concat(c)), Math.ceil(t.measureText(r).width)); + (t.fillStyle = i || '#666'), (t.textBaseline = 'middle'), (t.textAlign = 'center'), (t.globalAlpha = o || 0.1); + for ( + var u = Math.round(0.6 * h), + l = h + Math.round(e / 50), + d = Math.ceil(n / u) + 5, + f = Math.ceil(e / l) + 5, + g = 0; + g < d; + g++ + ) + for (var p = 0; p < f; p++) + t.save(), t.translate(p * l, g * u), t.rotate((a * Math.PI) / 180), t.fillText(r, 0, 0), t.restore(); + t.globalAlpha = 1; + }), + (this.saveAsLocalImage = function () { + var t, + e, + n = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + i = n.type || 'png', + r = this.getImageUrlData(n); + null != r && + ((r = r.replace( + (function (t) { + t = (t = t.toLowerCase().replace(/jpg/i, 'jpeg')).match(/png|jpeg|bmp|gif/); + return 'image' + (t = t && t[0]); + })(i), + 'image/octet-stream', + )), + (t = document.createElement('a')), + (e = new MouseEvent('click')), + (t.download = (n.fileName || 'Graph_' + new Date().getTime()) + '.' + i), + (t.href = r), + t.dispatchEvent(e)); + }), + (this.getSnapshotImage = function () { + var t = null; + try { + t = this.canvasElements.get('elements').toDataURL('image/png', 1); + } catch (t) {} + return t; + }), + (this.paintSelectRect = function (t, e, n, i) { + this.clearSelectArea(); + var r = this.mouseGraphics; + r.save(), + r.beginPath(), + r.rect(t * this.pixelRatio, e * this.pixelRatio, n, i), + (r.strokeStyle = 'rgba('.concat(this.selectBoxColor, ',0.8)')), + (r.fillStyle = 'rgba('.concat(this.selectBoxColor, ',').concat(this.selectBoxAlpha, ')')), + r.fill(), + r.stroke(), + r.restore(); + }), + (this.paintSelectCircle = function (t, e, n, i) { + this.clearSelectArea(); + var r = this.mouseGraphics, + n = Math.round(Math.sqrt(n * n + i * i, 2)); + r.save(), + r.beginPath(), + r.arc(t * this.pixelRatio, e * this.pixelRatio, n, 0, 2 * Math.PI), + (r.strokeStyle = 'rgba('.concat(this.selectBoxColor, ',0.8)')), + (r.fillStyle = 'rgba('.concat(this.selectBoxColor, ',').concat(this.selectBoxAlpha, ')')), + r.fill(), + r.stroke(), + r.restore(); + }), + (this.paintSelectPolygon = function (t, e, n) { + this.clearSelectArea(); + var i = this.mouseGraphics; + i.save(), i.beginPath(), i.moveTo(t * this.pixelRatio, e * this.pixelRatio); + for (var r = 1; r < n.length; r++) i.lineTo(n[r][0] * this.pixelRatio, n[r][1] * this.pixelRatio); + i.closePath(), + (i.strokeStyle = 'rgba('.concat(this.selectBoxColor, ',0.8)')), + (i.fillStyle = 'rgba('.concat(this.selectBoxColor, ',').concat(this.selectBoxAlpha, ')')), + i.fill(), + i.stroke(), + i.restore(); + }), + (this.paintCustomeLine = function (t, e) { + var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : '255,0,0', + i = (this.clearSelectArea(), this.childs[0]), + r = i.toSceneEvent(e), + o = i.getOffsetTranslate(), + a = this.mouseGraphics; + a.save(), + a.scale(i.scale, i.scale), + a.translate(o.translateX, o.translateY), + a.beginPath(), + a.moveTo(t.x, t.y), + a.lineTo(r.x, r.y), + (a.strokeStyle = 'rgba('.concat(n, ',0.8)')), + (a.lineWidth = 2), + a.setLineDash([5, 8, 5]), + a.stroke(), + (a.fillStyle = 'rgba('.concat(n, ',0.9)')), + a.beginPath(), + a.arc(t.x, t.y, 3, 0, 2 * Math.PI), + a.fill(), + a.beginPath(), + a.arc(r.x, r.y, 3, 0, 2 * Math.PI), + a.fill(), + a.restore(); + }), + (this.clearSelectArea = function () { + this.mouseGraphics.clearRect(0, 0, this.width, this.height); + }), + (this.showLoading = function () { + var t, + e, + n = Math.floor(100 * (1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0.01)); + function i(t, e) { + t.clearRect(0, 0, 100, 30), + (t.fillStyle = 'rgba(33,150,243,0.3)'), + t.DGraphRoundRect(0, 0, 100, 10, 5), + t.fill(), + (t.fillStyle = '#2196f3'), + t.DGraphRoundRect(0, 0, e, 10, 5), + t.fill(), + (t.fillStyle = '#20838f'), + (t.textAlign = 'center'), + (t.font = 'normal 12px Arial'), + t.fillText('布局进度'.concat(e, '%'), 50, 25); + } + this.loadProcessFlag || + ((this.loadProcessFlag = !0), + (this.process = n), + (t = Math.round(1e5 * Math.random())), + (e = '\n data:image/svg+xml;base64,'.concat( + btoa( + ' ', + ), + '\n ', + )), + this.container.insertAdjacentHTML( + 'beforeEnd', + '\n
\n \n
\n \n
\n
\n ', + ), + ), + (this.loadingEle = document.getElementById('graph-loading-'.concat(t))), + (this.processEle = document.getElementById('graph-process-'.concat(t))), + (this.processCtx = this.processEle.getContext('2d')), + i(this.processCtx, n)), + null != this.processCtx && this.process != n && ((this.process = n), i(this.processCtx, n)); + }), + (this.showLoading1 = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 'loading', + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0.2, + n = (this.clearSelectArea(), this.mouseGraphics), + i = Math.PI, + r = i / 2, + i = 2 * i; + n.save(), + n.translate(this.width / 2, this.height / 2), + (n.fillStyle = 'rgba(240,240,240,1)'), + (n.strokeStyle = 'rgba(200,200,200,0.8)'), + (n.lineWidth = 10), + n.beginPath(), + n.arc(0, 0, 80, 0, 2 * Math.PI, !1), + n.fill(), + n.stroke(), + n.closePath(), + (n.strokeStyle = 'rgba(120,120,240,0.9)'), + (n.lineWidth = 10), + (n.lineCap = 'round'), + n.beginPath(), + n.arc(0, 0, 80, -r, i * e - r, !1), + n.stroke(), + n.closePath(), + (n.font = 'normal 16px KaiTi'), + (n.textAlign = 'center'), + (n.textBaseline = 'middle'), + (n.fillStyle = 'rgba(50,50,50,1)'), + n.fillText(t, 0, 0), + n.restore(); + }), + (this.hideLoading = function () { + var t; + this.clearSelectArea(), + this.loadProcessFlag && + ((t = this), + setTimeout(function () { + (t.processEle = null), + (t.processCtx = null) != t.loadingEle && t.loadingEle.remove(), + (t.loadProcessFlag = !1); + }, 200)); + }), + (this.zoom = function (e) { + this.childs.forEach(function (t) { + t.visible && t.zoom(e); + }); + }), + (this.zoomOut = function (e, t) { + this.childs.forEach(function (t) { + t.visible && t.zoomOut(e); + }); + }), + (this.zoomIn = function (e, t) { + this.childs.forEach(function (t) { + t.visible && t.zoomIn(e); + }); + }), + (this.centerAndZoom = function () { + this.childs.forEach(function (t) { + t.visible && t.centerAndZoom(); + }); + }), + (this.setCenter = function (i, r) { + var o = this.canvas; + this.childs.forEach(function (t) { + var e = i - o.width / 2, + n = r - o.height / 2; + (t.translateX = -e), (t.translateY = -n); + }); + }), + (this.getBound = function () { + var e = { left: 1 / 0, right: -1 / 0, top: 1 / 0, bottom: -1 / 0 }; + return 0 == this.childs.length || 0 == this.childs[0].childs + ? null + : (this.childs.forEach(function (t) { + t = t.getElementsBound(); + t.left < e.left && ((e.left = t.left), (e.leftNode = t.leftNode)), + t.top < e.top && ((e.top = t.top), (e.topNode = t.topNode)), + t.right > e.right && ((e.right = t.right), (e.rightNode = t.rightNode)), + t.bottom > e.bottom && ((e.bottom = t.bottom), (e.bottomNode = t.bottomNode)); + }), + (e.width = e.right - e.left), + (e.height = e.bottom - e.top), + (this.boundCache = e)); + }), + (this.setBackGroundColor = function (t) { + this.backgrounGraphics.clearRect(0, 0, this.width, this.height), + (this.backgrounGraphics.fillStyle = t || '#fff'), + this.backgrounGraphics.fillRect(0, 0, this.width, this.height), + (this.backGroundColor = t), + _(this.backgrounGraphics, this.width, this.height); + }), + (this.setBackGroundImage = function (t) { + var e, + n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, + i = this.backgrounGraphics, + r = ((this.backGroundOpaticy = n), this); + 'string' == typeof t + ? ((e = new Image()).setAttribute('crossOrigin', 'Anonymous'), + (e.src = t), + (e.onload = function () { + (r.backGroundImage = e), N(i, e, n, r.width, r.height); + })) + : ((r.backGroundImage = t), N(i, t, n, this.width, this.height)); + }); + }), + this.initialize(a.canvas), + [ + 'click', + 'dbclick', + 'mousedown', + 'mouseup', + 'mouseover', + 'mouseout', + 'mousemove', + 'mousedrag', + 'mousewheel', + 'keydown', + 'keyup', + ].forEach(function (e) { + a[e] = function (t) { + null != t ? this.addEventListener(e, t) : this.dispatchEvent(e); + }; + }); + L = 0; + var L, + S = + 'undefined' != typeof requestAnimationFrame + ? requestAnimationFrame + : function (t) { + var e = Date.now(), + n = Math.min(16, Math.max(0, 16 - (e - L))), + i = (L = e + n); + return setTimeout(function () { + return t(i); + }, n); + }, + P = + 'undefined' != typeof cancelAnimationFrame + ? cancelAnimationFrame + : function (t) { + return clearTimeout(t); + }; + !(function t() { + var e, n; + (e = a.requestAnimateId) && P(e), + a.repaint(), + (a.requestAnimateId = + ((n = t), + S(function (t) { + n.call(void 0, t); + }))); + })(); +} +function W() { + (this.initialize = function () { + (this.elementType = 'element'), (this.serializedProperties = ['elementType']), (this.propertiesStack = []); + }), + (this.removeHandler = function () {}), + (this.save = function () { + var e = this, + n = {}; + this.serializedProperties.forEach(function (t) { + n[t] = e[t]; + }), + this.propertiesStack.push(n); + }), + (this.restore = function () { + var e, + n = this; + null != this.propertiesStack && + 0 != this.propertiesStack.length && + ((e = this.propertiesStack.pop()), + this.serializedProperties.forEach(function (t) { + n[t] = e[t]; + })); + }); +} +(j.util = V), + (U.prototype = { + get width() { + return this.canvas.width; + }, + get height() { + return this.canvas.height; + }, + set mode(e) { + this.childs.forEach(function (t) { + t.mode = e; + }); + }, + }); +var Y = + 'undefined' != typeof globalThis + ? globalThis + : 'undefined' != typeof window + ? window + : 'undefined' != typeof global + ? global + : 'undefined' != typeof self + ? self + : {}; +function G(t, e) { + return t((e = { exports: {} }), e.exports), e.exports; +} +var q = function () { + (this.__data__ = []), (this.size = 0); + }, + H = function (t, e) { + return t === e || (t != t && e != e); + }, + Q = function (t, e) { + for (var n = t.length; n--; ) if (H(t[n][0], e)) return n; + return -1; + }, + J = Array.prototype.splice, + K = function (t) { + var e = this.__data__, + t = Q(e, t); + return !(t < 0 || (t == e.length - 1 ? e.pop() : J.call(e, t, 1), --this.size, 0)); + }, + Z = function (t) { + var e = this.__data__, + t = Q(e, t); + return t < 0 ? void 0 : e[t][1]; + }, + $ = function (t) { + return -1 < Q(this.__data__, t); + }, + tt = function (t, e) { + var n = this.__data__, + i = Q(n, t); + return i < 0 ? (++this.size, n.push([t, e])) : (n[i][1] = e), this; + }; +function et(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var i = t[e]; + this.set(i[0], i[1]); + } +} +(et.prototype.clear = q), + (et.prototype.delete = K), + (et.prototype.get = Z), + (et.prototype.has = $), + (et.prototype.set = tt); +var bt, + nt = et, + it = function () { + (this.__data__ = new nt()), (this.size = 0); + }, + rt = function (t) { + var e = this.__data__, + t = e.delete(t); + return (this.size = e.size), t; + }, + ot = function (t) { + return this.__data__.get(t); + }, + at = function (t) { + return this.__data__.has(t); + }, + st = 'object' == typeof Y && Y && Y.Object === Object && Y, + ht = 'object' == typeof self && self && self.Object === Object && self, + ct = st || ht || Function('return this')(), + ut = ct.Symbol, + lt = Object.prototype, + dt = lt.hasOwnProperty, + ft = lt.toString, + gt = ut ? ut.toStringTag : void 0, + pt = function (t) { + var e = dt.call(t, gt), + n = t[gt]; + try { + var i = !(t[gt] = void 0); + } catch (t) {} + var r = ft.call(t); + return i && (e ? (t[gt] = n) : delete t[gt]), r; + }, + vt = Object.prototype.toString, + yt = function (t) { + return vt.call(t); + }, + mt = ut ? ut.toStringTag : void 0, + xt = function (t) { + return null == t ? (void 0 === t ? '[object Undefined]' : '[object Null]') : (mt && mt in Object(t) ? pt : yt)(t); + }, + wt = function (t) { + var e = typeof t; + return null != t && ('object' == e || 'function' == e); + }, + kt = function (t) { + return ( + !!wt(t) && + ('[object Function]' == (t = xt(t)) || + '[object GeneratorFunction]' == t || + '[object AsyncFunction]' == t || + '[object Proxy]' == t) + ); + }, + Mt = ct['__core-js_shared__'], + Et = (bt = /[^.]+$/.exec((Mt && Mt.keys && Mt.keys.IE_PROTO) || '')) ? 'Symbol(src)_1.' + bt : '', + Ct = function (t) { + return !!Et && Et in t; + }, + Nt = Function.prototype.toString, + _t = function (t) { + if (null != t) { + try { + return Nt.call(t); + } catch (t) {} + try { + return t + ''; + } catch (t) {} + } + return ''; + }, + Lt = /^\[object .+?Constructor\]$/, + St = Function.prototype, + Tt = Object.prototype, + Pt = St.toString, + At = Tt.hasOwnProperty, + Ot = RegExp( + '^' + + Pt.call(At) + .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + + '$', + ), + It = function (t) { + return !(!wt(t) || Ct(t)) && (kt(t) ? Ot : Lt).test(_t(t)); + }, + Dt = function (t, e) { + return null == t ? void 0 : t[e]; + }, + Bt = function (t, e) { + t = Dt(t, e); + return It(t) ? t : void 0; + }, + Rt = Bt(ct, 'Map'), + zt = Bt(Object, 'create'), + Vt = function () { + (this.__data__ = zt ? zt(null) : {}), (this.size = 0); + }, + jt = function (t) { + t = this.has(t) && delete this.__data__[t]; + return (this.size -= t ? 1 : 0), t; + }, + Ft = Object.prototype.hasOwnProperty, + Xt = function (t) { + var e, + n = this.__data__; + return zt ? ('__lodash_hash_undefined__' === (e = n[t]) ? void 0 : e) : Ft.call(n, t) ? n[t] : void 0; + }, + Ut = Object.prototype.hasOwnProperty, + Wt = function (t) { + var e = this.__data__; + return zt ? void 0 !== e[t] : Ut.call(e, t); + }, + Yt = function (t, e) { + var n = this.__data__; + return (this.size += this.has(t) ? 0 : 1), (n[t] = zt && void 0 === e ? '__lodash_hash_undefined__' : e), this; + }; +function Gt(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var i = t[e]; + this.set(i[0], i[1]); + } +} +(Gt.prototype.clear = Vt), + (Gt.prototype.delete = jt), + (Gt.prototype.get = Xt), + (Gt.prototype.has = Wt), + (Gt.prototype.set = Yt); +var qt = Gt, + Ht = function () { + (this.size = 0), (this.__data__ = { hash: new qt(), map: new (Rt || nt)(), string: new qt() }); + }, + Qt = function (t) { + var e = typeof t; + return 'string' == e || 'number' == e || 'symbol' == e || 'boolean' == e ? '__proto__' !== t : null === t; + }, + Jt = function (t, e) { + t = t.__data__; + return Qt(e) ? t['string' == typeof e ? 'string' : 'hash'] : t.map; + }, + Kt = function (t) { + t = Jt(this, t).delete(t); + return (this.size -= t ? 1 : 0), t; + }, + Zt = function (t) { + return Jt(this, t).get(t); + }, + $t = function (t) { + return Jt(this, t).has(t); + }, + te = function (t, e) { + var n = Jt(this, t), + i = n.size; + return n.set(t, e), (this.size += n.size == i ? 0 : 1), this; + }; +function ee(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.clear(); ++e < n; ) { + var i = t[e]; + this.set(i[0], i[1]); + } +} +(ee.prototype.clear = Ht), + (ee.prototype.delete = Kt), + (ee.prototype.get = Zt), + (ee.prototype.has = $t), + (ee.prototype.set = te); +var ne = ee, + ie = function (t, e) { + var n = this.__data__; + if (n instanceof nt) { + var i = n.__data__; + if (!Rt || i.length < 199) return i.push([t, e]), (this.size = ++n.size), this; + n = this.__data__ = new ne(i); + } + return n.set(t, e), (this.size = n.size), this; + }; +function re(t) { + t = this.__data__ = new nt(t); + this.size = t.size; +} +(re.prototype.clear = it), + (re.prototype.delete = rt), + (re.prototype.get = ot), + (re.prototype.has = at), + (re.prototype.set = ie); +var oe = re, + ae = function (t, e) { + for (var n = -1, i = null == t ? 0 : t.length; ++n < i && !1 !== e(t[n], n, t); ); + return t; + }, + se = (function () { + try { + var t = Bt(Object, 'defineProperty'); + return t({}, '', {}), t; + } catch (t) {} + })(), + he = function (t, e, n) { + '__proto__' == e && se ? se(t, e, { configurable: !0, enumerable: !0, value: n, writable: !0 }) : (t[e] = n); + }, + ce = Object.prototype.hasOwnProperty, + ue = function (t, e, n) { + var i = t[e]; + (ce.call(t, e) && H(i, n) && (void 0 !== n || e in t)) || he(t, e, n); + }, + le = function (t, e, n, i) { + var r = !n; + n = n || {}; + for (var o = -1, a = e.length; ++o < a; ) { + var s = e[o], + h = i ? i(n[s], t[s], s, n, t) : void 0; + void 0 === h && (h = t[s]), (r ? he : ue)(n, s, h); + } + return n; + }, + de = function (t, e) { + for (var n = -1, i = Array(t); ++n < t; ) i[n] = e(n); + return i; + }, + fe = function (t) { + return null != t && 'object' == typeof t; + }, + ge = function (t) { + return fe(t) && '[object Arguments]' == xt(t); + }, + pe = Object.prototype, + ve = pe.hasOwnProperty, + ye = pe.propertyIsEnumerable, + me = ge( + (function () { + return arguments; + })(), + ) + ? ge + : function (t) { + return fe(t) && ve.call(t, 'callee') && !ye.call(t, 'callee'); + }, + xe = Array.isArray, + we = function () { + return !1; + }, + be = G(function (t, e) { + var e = e && !e.nodeType && e, + n = e && t && !t.nodeType && t, + n = n && n.exports === e ? ct.Buffer : void 0, + e = (n ? n.isBuffer : void 0) || we; + t.exports = e; + }), + ke = /^(?:0|[1-9]\d*)$/, + Me = function (t, e) { + var n = typeof t; + return ( + !!(e = null == e ? 9007199254740991 : e) && + ('number' == n || ('symbol' != n && ke.test(t))) && + -1 < t && + t % 1 == 0 && + t < e + ); + }, + Ee = function (t) { + return 'number' == typeof t && -1 < t && t % 1 == 0 && t <= 9007199254740991; + }, + Ce = {}, + Ne = + ((Ce['[object Float32Array]'] = + Ce['[object Float64Array]'] = + Ce['[object Int8Array]'] = + Ce['[object Int16Array]'] = + Ce['[object Int32Array]'] = + Ce['[object Uint8Array]'] = + Ce['[object Uint8ClampedArray]'] = + Ce['[object Uint16Array]'] = + Ce['[object Uint32Array]'] = + !0), + (Ce['[object Arguments]'] = + Ce['[object Array]'] = + Ce['[object ArrayBuffer]'] = + Ce['[object Boolean]'] = + Ce['[object DataView]'] = + Ce['[object Date]'] = + Ce['[object Error]'] = + Ce['[object Function]'] = + Ce['[object Map]'] = + Ce['[object Number]'] = + Ce['[object Object]'] = + Ce['[object RegExp]'] = + Ce['[object Set]'] = + Ce['[object String]'] = + Ce['[object WeakMap]'] = + !1), + function (t) { + return fe(t) && Ee(t.length) && !!Ce[xt(t)]; + }), + _e = function (e) { + return function (t) { + return e(t); + }; + }, + Le = G(function (t, e) { + var e = e && !e.nodeType && e, + n = e && t && !t.nodeType && t, + i = n && n.exports === e && st.process, + e = (function () { + try { + return (n && n.require && n.require('util').types) || (i && i.binding && i.binding('util')); + } catch (t) {} + })(); + t.exports = e; + }), + Se = Le && Le.isTypedArray, + Te = Se ? _e(Se) : Ne, + Pe = Object.prototype.hasOwnProperty, + Ae = function (t, e) { + var n, + i = xe(t), + r = !i && me(t), + o = !i && !r && be(t), + a = !i && !r && !o && Te(t), + s = i || r || o || a, + h = s ? de(t.length, String) : [], + c = h.length; + for (n in t) + (!e && !Pe.call(t, n)) || + (s && + ('length' == n || + (o && ('offset' == n || 'parent' == n)) || + (a && ('buffer' == n || 'byteLength' == n || 'byteOffset' == n)) || + Me(n, c))) || + h.push(n); + return h; + }, + Oe = Object.prototype, + Ie = function (t) { + var e = t && t.constructor; + return t === (('function' == typeof e && e.prototype) || Oe); + }, + De = function (e, n) { + return function (t) { + return e(n(t)); + }; + }, + Be = De(Object.keys, Object), + Re = Object.prototype.hasOwnProperty, + ze = function (t) { + if (!Ie(t)) return Be(t); + var e, + n = []; + for (e in Object(t)) Re.call(t, e) && 'constructor' != e && n.push(e); + return n; + }, + Ve = function (t) { + return null != t && Ee(t.length) && !kt(t); + }, + je = function (t) { + return (Ve(t) ? Ae : ze)(t); + }, + Fe = function (t, e) { + return t && le(e, je(e), t); + }, + Xe = function (t) { + var e = []; + if (null != t) for (var n in Object(t)) e.push(n); + return e; + }, + Ue = Object.prototype.hasOwnProperty, + We = function (t) { + if (!wt(t)) return Xe(t); + var e, + n = Ie(t), + i = []; + for (e in t) ('constructor' != e || (!n && Ue.call(t, e))) && i.push(e); + return i; + }, + Ye = function (t) { + return Ve(t) ? Ae(t, !0) : We(t); + }, + Ge = function (t, e) { + return t && le(e, Ye(e), t); + }, + qe = G(function (t, e) { + var e = e && !e.nodeType && e, + n = e && t && !t.nodeType && t, + n = n && n.exports === e ? ct.Buffer : void 0, + i = n ? n.allocUnsafe : void 0; + t.exports = function (t, e) { + return e ? t.slice() : ((e = t.length), (e = i ? i(e) : new t.constructor(e)), t.copy(e), e); + }; + }), + He = function (t, e) { + var n = -1, + i = t.length; + for (e = e || Array(i); ++n < i; ) e[n] = t[n]; + return e; + }, + Qe = function (t, e) { + for (var n = -1, i = null == t ? 0 : t.length, r = 0, o = []; ++n < i; ) { + var a = t[n]; + e(a, n, t) && (o[r++] = a); + } + return o; + }, + Je = function () { + return []; + }, + Ke = Object.prototype.propertyIsEnumerable, + Ze = Object.getOwnPropertySymbols, + $e = Ze + ? function (e) { + return null == e + ? [] + : ((e = Object(e)), + Qe(Ze(e), function (t) { + return Ke.call(e, t); + })); + } + : Je, + tn = function (t, e) { + return le(t, $e(t), e); + }, + en = function (t, e) { + for (var n = -1, i = e.length, r = t.length; ++n < i; ) t[r + n] = e[n]; + return t; + }, + nn = De(Object.getPrototypeOf, Object), + rn = Object.getOwnPropertySymbols + ? function (t) { + for (var e = []; t; ) en(e, $e(t)), (t = nn(t)); + return e; + } + : Je, + on = function (t, e) { + return le(t, rn(t), e); + }, + an = function (t, e, n) { + e = e(t); + return xe(t) ? e : en(e, n(t)); + }, + sn = function (t) { + return an(t, je, $e); + }, + hn = function (t) { + return an(t, Ye, rn); + }, + cn = Bt(ct, 'DataView'), + un = Bt(ct, 'Promise'), + ln = Bt(ct, 'Set'), + dn = Bt(ct, 'WeakMap'), + fn = _t(cn), + gn = _t(Rt), + pn = _t(un), + vn = _t(ln), + yn = _t(dn), + mn = xt, + xn = (mn = + (cn && '[object DataView]' != mn(new cn(new ArrayBuffer(1)))) || + (Rt && '[object Map]' != mn(new Rt())) || + (un && '[object Promise]' != mn(un.resolve())) || + (ln && '[object Set]' != mn(new ln())) || + (dn && '[object WeakMap]' != mn(new dn())) + ? function (t) { + var e = xt(t), + t = '[object Object]' == e ? t.constructor : void 0, + t = t ? _t(t) : ''; + if (t) + switch (t) { + case fn: + return '[object DataView]'; + case gn: + return '[object Map]'; + case pn: + return '[object Promise]'; + case vn: + return '[object Set]'; + case yn: + return '[object WeakMap]'; + } + return e; + } + : mn), + wn = Object.prototype.hasOwnProperty, + bn = function (t) { + var e = t.length, + n = new t.constructor(e); + return e && 'string' == typeof t[0] && wn.call(t, 'index') && ((n.index = t.index), (n.input = t.input)), n; + }, + kn = ct.Uint8Array, + Mn = function (t) { + var e = new t.constructor(t.byteLength); + return new kn(e).set(new kn(t)), e; + }, + En = function (t, e) { + e = e ? Mn(t.buffer) : t.buffer; + return new t.constructor(e, t.byteOffset, t.byteLength); + }, + Cn = /\w*$/, + Nn = function (t) { + var e = new t.constructor(t.source, Cn.exec(t)); + return (e.lastIndex = t.lastIndex), e; + }, + _n = ut ? ut.prototype : void 0, + Ln = _n ? _n.valueOf : void 0, + Sn = function (t) { + return Ln ? Object(Ln.call(t)) : {}; + }, + Tn = function (t, e) { + e = e ? Mn(t.buffer) : t.buffer; + return new t.constructor(e, t.byteOffset, t.length); + }, + Pn = function (t, e, n) { + var i = t.constructor; + switch (e) { + case '[object ArrayBuffer]': + return Mn(t); + case '[object Boolean]': + case '[object Date]': + return new i(+t); + case '[object DataView]': + return En(t, n); + case '[object Float32Array]': + case '[object Float64Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object Int32Array]': + case '[object Uint8Array]': + case '[object Uint8ClampedArray]': + case '[object Uint16Array]': + case '[object Uint32Array]': + return Tn(t, n); + case '[object Map]': + return new i(); + case '[object Number]': + case '[object String]': + return new i(t); + case '[object RegExp]': + return Nn(t); + case '[object Set]': + return new i(); + case '[object Symbol]': + return Sn(t); + } + }, + An = Object.create, + On = (function () { + function e() {} + return function (t) { + if (!wt(t)) return {}; + if (An) return An(t); + e.prototype = t; + t = new e(); + return (e.prototype = void 0), t; + }; + })(), + In = function (t) { + return 'function' != typeof t.constructor || Ie(t) ? {} : On(nn(t)); + }, + Dn = function (t) { + return fe(t) && '[object Map]' == xn(t); + }, + Bn = Le && Le.isMap, + Rn = Bn ? _e(Bn) : Dn, + zn = function (t) { + return fe(t) && '[object Set]' == xn(t); + }, + Vn = Le && Le.isSet, + jn = Vn ? _e(Vn) : zn, + Fn = {}, + Xn = + ((Fn['[object Arguments]'] = + Fn['[object Array]'] = + Fn['[object ArrayBuffer]'] = + Fn['[object DataView]'] = + Fn['[object Boolean]'] = + Fn['[object Date]'] = + Fn['[object Float32Array]'] = + Fn['[object Float64Array]'] = + Fn['[object Int8Array]'] = + Fn['[object Int16Array]'] = + Fn['[object Int32Array]'] = + Fn['[object Map]'] = + Fn['[object Number]'] = + Fn['[object Object]'] = + Fn['[object RegExp]'] = + Fn['[object Set]'] = + Fn['[object String]'] = + Fn['[object Symbol]'] = + Fn['[object Uint8Array]'] = + Fn['[object Uint8ClampedArray]'] = + Fn['[object Uint16Array]'] = + Fn['[object Uint32Array]'] = + !0), + (Fn['[object Error]'] = Fn['[object Function]'] = Fn['[object WeakMap]'] = !1), + function n(i, r, o, t, e, a) { + var s, + h = 1 & r, + c = 2 & r, + u = 4 & r; + if (void 0 === (s = o ? (e ? o(i, t, e, a) : o(i)) : s)) { + if (!wt(i)) return i; + t = xe(i); + if (t) { + if (((s = bn(i)), !h)) return He(i, s); + } else { + var l = xn(i), + d = '[object Function]' == l || '[object GeneratorFunction]' == l; + if (be(i)) return qe(i, h); + if ('[object Object]' == l || '[object Arguments]' == l || (d && !e)) { + if (((s = c || d ? {} : In(i)), !h)) return c ? on(i, Ge(s, i)) : tn(i, Fe(s, i)); + } else { + if (!Fn[l]) return e ? i : {}; + s = Pn(i, l, h); + } + } + d = (a = a || new oe()).get(i); + if (d) return d; + a.set(i, s), + jn(i) + ? i.forEach(function (t) { + s.add(n(t, r, o, t, i, a)); + }) + : Rn(i) && + i.forEach(function (t, e) { + s.set(e, n(t, r, o, e, i, a)); + }); + var f = t ? void 0 : (u ? (c ? hn : sn) : c ? Ye : je)(i); + ae(f || i, function (t, e) { + f && (t = i[(e = t)]), ue(s, e, n(t, r, o, e, i, a)); + }); + } + return s; + }), + Un = function (t) { + return Xn(t, 4); + }, + Wn = function (t) { + return function () { + return t; + }; + }, + Yn = function (t, e, n) { + for (var i = -1, r = Object(t), o = n(t), a = o.length; a--; ) { + var s = o[++i]; + if (!1 === e(r[s], s, r)) break; + } + return t; + }, + Gn = function (t, e) { + return t && Yn(t, e, je); + }, + qn = (function (o) { + return function (t, e) { + if (null != t) { + if (!Ve(t)) return o(t, e); + for (var n = t.length, i = -1, r = Object(t); ++i < n && !1 !== e(r[i], i, r); ); + } + return t; + }; + })(Gn), + Hn = function (t) { + return t; + }, + Qn = function (t) { + return 'function' == typeof t ? t : Hn; + }, + Jn = function (t, e) { + return (xe(t) ? ae : qn)(t, Qn(e)); + }, + Kn = Jn, + Zn = function (t, i) { + var r = []; + return ( + qn(t, function (t, e, n) { + i(t, e, n) && r.push(t); + }), + r + ); + }, + $n = function (t) { + return this.__data__.set(t, '__lodash_hash_undefined__'), this; + }, + ti = function (t) { + return this.__data__.has(t); + }; +function ei(t) { + var e = -1, + n = null == t ? 0 : t.length; + for (this.__data__ = new ne(); ++e < n; ) this.add(t[e]); +} +(ei.prototype.add = ei.prototype.push = $n), (ei.prototype.has = ti); +var ni = ei, + ii = function (t, e) { + for (var n = -1, i = null == t ? 0 : t.length; ++n < i; ) if (e(t[n], n, t)) return !0; + return !1; + }, + ri = function (t, e) { + return t.has(e); + }, + oi = function (t, e, n, i, r, o) { + var a = 1 & n, + s = t.length, + h = e.length; + if (s != h && !(a && s < h)) return !1; + var h = o.get(t), + c = o.get(e); + if (h && c) return h == e && c == t; + var u = -1, + l = !0, + d = 2 & n ? new ni() : void 0; + for (o.set(t, e), o.set(e, t); ++u < s; ) { + var f, + g = t[u], + p = e[u]; + if (void 0 !== (f = i ? (a ? i(p, g, u, e, t, o) : i(g, p, u, t, e, o)) : f)) { + if (f) continue; + l = !1; + break; + } + if (d) { + if ( + !ii(e, function (t, e) { + if (!ri(d, e) && (g === t || r(g, t, n, i, o))) return d.push(e); + }) + ) { + l = !1; + break; + } + } else if (g !== p && !r(g, p, n, i, o)) { + l = !1; + break; + } + } + return o.delete(t), o.delete(e), l; + }, + ai = function (t) { + var n = -1, + i = Array(t.size); + return ( + t.forEach(function (t, e) { + i[++n] = [e, t]; + }), + i + ); + }, + si = function (t) { + var e = -1, + n = Array(t.size); + return ( + t.forEach(function (t) { + n[++e] = t; + }), + n + ); + }, + hi = ut ? ut.prototype : void 0, + ci = hi ? hi.valueOf : void 0, + ui = function (t, e, n, i, r, o, a) { + switch (n) { + case '[object DataView]': + if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset) return !1; + (t = t.buffer), (e = e.buffer); + case '[object ArrayBuffer]': + return !(t.byteLength != e.byteLength || !o(new kn(t), new kn(e))); + case '[object Boolean]': + case '[object Date]': + case '[object Number]': + return H(+t, +e); + case '[object Error]': + return t.name == e.name && t.message == e.message; + case '[object RegExp]': + case '[object String]': + return t == e + ''; + case '[object Map]': + var s = ai; + case '[object Set]': + s = s || si; + if (t.size != e.size && !(1 & i)) return !1; + var h = a.get(t); + if (h) return h == e; + (i |= 2), a.set(t, e); + h = oi(s(t), s(e), i, r, o, a); + return a.delete(t), h; + case '[object Symbol]': + if (ci) return ci.call(t) == ci.call(e); + } + return !1; + }, + li = Object.prototype.hasOwnProperty, + di = function (t, e, n, i, r, o) { + var a = 1 & n, + s = sn(t), + h = s.length; + if (h != sn(e).length && !a) return !1; + for (var c = h; c--; ) { + var u = s[c]; + if (!(a ? u in e : li.call(e, u))) return !1; + } + var l = o.get(t), + d = o.get(e); + if (l && d) return l == e && d == t; + var f = !0; + o.set(t, e), o.set(e, t); + for (var g = a; ++c < h; ) { + var p, + y = t[(u = s[c])], + v = e[u]; + if ( + !(void 0 === (p = i ? (a ? i(v, y, u, e, t, o) : i(y, v, u, t, e, o)) : p) ? y === v || r(y, v, n, i, o) : p) + ) { + f = !1; + break; + } + g = g || 'constructor' == u; + } + return ( + f && + !g && + (l = t.constructor) != (d = e.constructor) && + 'constructor' in t && + 'constructor' in e && + !('function' == typeof l && l instanceof l && 'function' == typeof d && d instanceof d) && + (f = !1), + o.delete(t), + o.delete(e), + f + ); + }, + fi = Object.prototype.hasOwnProperty, + gi = function (t, e, n, i, r, o) { + var a = xe(t), + s = xe(e), + h = a ? '[object Array]' : xn(t), + s = s ? '[object Array]' : xn(e), + c = '[object Object]' == (h = '[object Arguments]' == h ? '[object Object]' : h), + u = '[object Object]' == (s = '[object Arguments]' == s ? '[object Object]' : s), + s = h == s; + if (s && be(t)) { + if (!be(e)) return !1; + c = !(a = !0); + } + if (s && !c) return (o = o || new oe()), a || Te(t) ? oi(t, e, n, i, r, o) : ui(t, e, h, n, i, r, o); + if (!(1 & n)) { + (a = c && fi.call(t, '__wrapped__')), (h = u && fi.call(e, '__wrapped__')); + if (a || h) return r(a ? t.value() : t, h ? e.value() : e, n, i, (o = o || new oe())); + } + return !!s && ((o = o || new oe()), di(t, e, n, i, r, o)); + }, + pi = function t(e, n, i, r, o) { + return e === n || (null == e || null == n || (!fe(e) && !fe(n)) ? e != e && n != n : gi(e, n, i, r, t, o)); + }, + vi = function (t, e, n, i) { + var r = n.length, + o = r, + a = !i; + if (null == t) return !o; + for (t = Object(t); r--; ) { + var s = n[r]; + if (a && s[2] ? s[1] !== t[s[0]] : !(s[0] in t)) return !1; + } + for (; ++r < o; ) { + var h = (s = n[r])[0], + c = t[h], + u = s[1]; + if (a && s[2]) { + if (void 0 === c && !(h in t)) return !1; + } else { + var l, + d = new oe(); + if (!(void 0 === (l = i ? i(c, u, h, t, e, d) : l) ? pi(u, c, 3, i, d) : l)) return !1; + } + } + return !0; + }, + yi = function (t) { + return t == t && !wt(t); + }, + mi = function (t) { + for (var e = je(t), n = e.length; n--; ) { + var i = e[n], + r = t[i]; + e[n] = [i, r, yi(r)]; + } + return e; + }, + xi = function (e, n) { + return function (t) { + return null != t && t[e] === n && (void 0 !== n || e in Object(t)); + }; + }, + wi = function (e) { + var n = mi(e); + return 1 == n.length && n[0][2] + ? xi(n[0][0], n[0][1]) + : function (t) { + return t === e || vi(t, e, n); + }; + }, + bi = function (t) { + return 'symbol' == typeof t || (fe(t) && '[object Symbol]' == xt(t)); + }, + ki = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + Mi = /^\w*$/, + Ei = function (t, e) { + var n; + return ( + !xe(t) && + (!('number' != (n = typeof t) && 'symbol' != n && 'boolean' != n && null != t && !bi(t)) || + Mi.test(t) || + !ki.test(t) || + (null != e && t in Object(e))) + ); + }; +function Ci(i, r) { + if ('function' != typeof i || (null != r && 'function' != typeof r)) throw new TypeError('Expected a function'); + function o() { + var t = arguments, + e = r ? r.apply(this, t) : t[0], + n = o.cache; + return n.has(e) ? n.get(e) : ((t = i.apply(this, t)), (o.cache = n.set(e, t) || n), t); + } + return (o.cache = new (Ci.Cache || ne)()), o; +} +Ci.Cache = ne; +var Ni = Ci, + _i = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, + Li = /\\(\\)?/g, + Si = (function () { + var t = Ni( + function (t) { + var r = []; + return ( + 46 === t.charCodeAt(0) && r.push(''), + t.replace(_i, function (t, e, n, i) { + r.push(n ? i.replace(Li, '$1') : e || t); + }), + r + ); + }, + function (t) { + return 500 === e.size && e.clear(), t; + }, + ), + e = t.cache; + return t; + })(), + Ti = function (t, e) { + for (var n = -1, i = null == t ? 0 : t.length, r = Array(i); ++n < i; ) r[n] = e(t[n], n, t); + return r; + }, + Pi = ut ? ut.prototype : void 0, + Ai = Pi ? Pi.toString : void 0, + Oi = function t(e) { + var n; + return 'string' == typeof e + ? e + : xe(e) + ? Ti(e, t) + '' + : bi(e) + ? Ai + ? Ai.call(e) + : '' + : '0' == (n = e + '') && 1 / e == -1 / 0 + ? '-0' + : n; + }, + Ii = function (t) { + return null == t ? '' : Oi(t); + }, + Di = function (t, e) { + return xe(t) ? t : Ei(t, e) ? [t] : Si(Ii(t)); + }, + Bi = function (t) { + var e; + return 'string' == typeof t || bi(t) ? t : '0' == (e = t + '') && 1 / t == -1 / 0 ? '-0' : e; + }, + Ri = function (t, e) { + for (var n = 0, i = (e = Di(e, t)).length; null != t && n < i; ) t = t[Bi(e[n++])]; + return n && n == i ? t : void 0; + }, + zi = function (t, e, n) { + t = null == t ? void 0 : Ri(t, e); + return void 0 === t ? n : t; + }, + Vi = function (t, e) { + return null != t && e in Object(t); + }, + ji = function (t, e, n) { + for (var i = -1, r = (e = Di(e, t)).length, o = !1; ++i < r; ) { + var a = Bi(e[i]); + if (!(o = null != t && n(t, a))) break; + t = t[a]; + } + return o || ++i != r ? o : !!(r = null == t ? 0 : t.length) && Ee(r) && Me(a, r) && (xe(t) || me(t)); + }, + Fi = function (t, e) { + return null != t && ji(t, e, Vi); + }, + Xi = function (n, i) { + return Ei(n) && yi(i) + ? xi(Bi(n), i) + : function (t) { + var e = zi(t, n); + return void 0 === e && e === i ? Fi(t, n) : pi(i, e, 3); + }; + }, + Ui = function (e) { + return function (t) { + return null == t ? void 0 : t[e]; + }; + }, + Wi = function (e) { + return function (t) { + return Ri(t, e); + }; + }, + Yi = function (t) { + return Ei(t) ? Ui(Bi(t)) : Wi(t); + }, + Gi = function (t) { + return 'function' == typeof t + ? t + : null == t + ? Hn + : 'object' == typeof t + ? xe(t) + ? Xi(t[0], t[1]) + : wi(t) + : Yi(t); + }, + qi = function (t, e) { + return (xe(t) ? Qe : Zn)(t, Gi(e)); + }, + Hi = Object.prototype.hasOwnProperty, + Qi = function (t, e) { + return null != t && Hi.call(t, e); + }, + Ji = function (t, e) { + return null != t && ji(t, e, Qi); + }, + Ki = Object.prototype.hasOwnProperty, + Zi = function (t) { + if (null != t) { + if (Ve(t) && (xe(t) || 'string' == typeof t || 'function' == typeof t.splice || be(t) || Te(t) || me(t))) + return !t.length; + var e, + n = xn(t); + if ('[object Map]' == n || '[object Set]' == n) return !t.size; + if (Ie(t)) return !ze(t).length; + for (e in t) if (Ki.call(t, e)) return !1; + } + return !0; + }, + $i = function (t) { + return void 0 === t; + }, + tr = function (t, i) { + var r = -1, + o = Ve(t) ? Array(t.length) : []; + return ( + qn(t, function (t, e, n) { + o[++r] = i(t, e, n); + }), + o + ); + }, + er = function (t, e) { + return (xe(t) ? Ti : tr)(t, Gi(e)); + }, + nr = function (t, e, n, i) { + var r = -1, + o = null == t ? 0 : t.length; + for (i && o && (n = t[++r]); ++r < o; ) n = e(n, t[r], r, t); + return n; + }, + ir = function (t, i, r, o, e) { + return ( + e(t, function (t, e, n) { + r = o ? ((o = !1), t) : i(r, t, e, n); + }), + r + ); + }, + rr = function (t, e, n) { + var i = xe(t) ? nr : ir, + r = arguments.length < 3; + return i(t, Gi(e), n, r, qn); + }, + or = function (t) { + return 'string' == typeof t || (!xe(t) && fe(t) && '[object String]' == xt(t)); + }, + ar = Ui('length'), + sr = RegExp('[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]'), + hr = function (t) { + return sr.test(t); + }, + cr = '[\\ud800-\\udfff]', + ur = '[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]', + lr = '\\ud83c[\\udffb-\\udfff]', + dr = '[^\\ud800-\\udfff]', + fr = '(?:\\ud83c[\\udde6-\\uddff]){2}', + gr = '[\\ud800-\\udbff][\\udc00-\\udfff]', + pr = '(?:' + ur + '|' + lr + ')?', + vr = '[\\ufe0e\\ufe0f]?' + pr + '(?:\\u200d(?:' + [dr, fr, gr].join('|') + ')[\\ufe0e\\ufe0f]?' + pr + ')*', + yr = '(?:' + [dr + ur + '?', ur, fr, gr, cr].join('|') + ')', + mr = RegExp(lr + '(?=' + lr + ')|' + yr + vr, 'g'), + xr = function (t) { + for (var e = (mr.lastIndex = 0); mr.test(t); ) ++e; + return e; + }, + wr = function (t) { + return (hr(t) ? xr : ar)(t); + }, + br = function (t) { + var e; + return null == t + ? 0 + : Ve(t) + ? or(t) + ? wr(t) + : t.length + : '[object Map]' == (e = xn(t)) || '[object Set]' == e + ? t.size + : ze(t).length; + }, + kr = function (t, i, r) { + var e, + n = xe(t), + o = n || be(t) || Te(t); + return ( + (i = Gi(i)), + null == r && ((e = t && t.constructor), (r = o ? (n ? new e() : []) : wt(t) && kt(e) ? On(nn(t)) : {})), + (o ? ae : Gn)(t, function (t, e, n) { + return i(r, t, e, n); + }), + r + ); + }, + Mr = ut ? ut.isConcatSpreadable : void 0, + Er = function (t) { + return xe(t) || me(t) || !!(Mr && t && t[Mr]); + }, + Cr = function t(e, n, i, r, o) { + var a = -1, + s = e.length; + for (i = i || Er, o = o || []; ++a < s; ) { + var h = e[a]; + 0 < n && i(h) ? (1 < n ? t(h, n - 1, i, r, o) : en(o, h)) : r || (o[o.length] = h); + } + return o; + }, + Nr = function (t, e, n) { + switch (n.length) { + case 0: + return t.call(e); + case 1: + return t.call(e, n[0]); + case 2: + return t.call(e, n[0], n[1]); + case 3: + return t.call(e, n[0], n[1], n[2]); + } + return t.apply(e, n); + }, + _r = Math.max, + Lr = function (o, a, s) { + return ( + (a = _r(void 0 === a ? o.length - 1 : a, 0)), + function () { + for (var t = arguments, e = -1, n = _r(t.length - a, 0), i = Array(n); ++e < n; ) i[e] = t[a + e]; + for (var e = -1, r = Array(a + 1); ++e < a; ) r[e] = t[e]; + return (r[a] = s(i)), Nr(o, this, r); + } + ); + }, + Sr = se + ? function (t, e) { + return se(t, 'toString', { configurable: !0, enumerable: !1, value: Wn(e), writable: !0 }); + } + : Hn, + Tr = Date.now, + Pr = (function (n) { + var i = 0, + r = 0; + return function () { + var t = Tr(), + e = 16 - (t - r); + if (((r = t), 0 < e)) { + if (800 <= ++i) return arguments[0]; + } else i = 0; + return n.apply(void 0, arguments); + }; + })(Sr), + Ar = function (t, e) { + return Pr(Lr(t, e, Hn), t + ''); + }, + Or = function (t, e, n, i) { + for (var r = t.length, o = n + (i ? 1 : -1); i ? o-- : ++o < r; ) if (e(t[o], o, t)) return o; + return -1; + }, + Ir = function (t) { + return t != t; + }, + Dr = function (t, e, n) { + for (var i = n - 1, r = t.length; ++i < r; ) if (t[i] === e) return i; + return -1; + }, + Br = function (t, e, n) { + return e == e ? Dr(t, e, n) : Or(t, Ir, n); + }, + Rr = function (t, e) { + return !(null == t || !t.length) && -1 < Br(t, e, 0); + }, + zr = function (t, e, n) { + for (var i = -1, r = null == t ? 0 : t.length; ++i < r; ) if (n(e, t[i])) return !0; + return !1; + }, + Vr = function () {}, + jr = + ln && 1 / si(new ln([, -0]))[1] == 1 / 0 + ? function (t) { + return new ln(t); + } + : Vr, + Fr = function (t, e, n) { + var i = -1, + r = Rr, + o = t.length, + a = !0, + s = [], + h = s; + if (n) (a = !1), (r = zr); + else if (200 <= o) { + var c = e ? null : jr(t); + if (c) return si(c); + (a = !1), (r = ri), (h = new ni()); + } else h = e ? [] : s; + t: for (; ++i < o; ) { + var u = t[i], + l = e ? e(u) : u, + u = n || 0 !== u ? u : 0; + if (a && l == l) { + for (var d = h.length; d--; ) if (h[d] === l) continue t; + e && h.push(l), s.push(u); + } else r(h, l, n) || (h !== s && h.push(l), s.push(u)); + } + return s; + }, + Xr = function (t) { + return fe(t) && Ve(t); + }, + Ur = Ar(function (t) { + return Fr(Cr(t, 1, Xr, !0)); + }), + Wr = function (e, t) { + return Ti(t, function (t) { + return e[t]; + }); + }, + Gr = function (t) { + return null == t ? [] : Wr(t, je(t)); + }; +try { + Yr = { + clone: Un, + constant: Wn, + each: Kn, + filter: qi, + has: Ji, + isArray: xe, + isEmpty: Zi, + isFunction: kt, + isUndefined: $i, + keys: je, + map: er, + reduce: rr, + size: br, + transform: kr, + union: Ur, + values: Gr, + }; +} catch (t) {} +var Yr, + qr = (Yr = Yr || window._), + Hr = Qr; +function Qr(t) { + (this._isDirected = !qr.has(t, 'directed') || t.directed), + (this._isMultigraph = !!qr.has(t, 'multigraph') && t.multigraph), + (this._isCompound = !!qr.has(t, 'compound') && t.compound), + (this._label = void 0), + (this._defaultNodeLabelFn = qr.constant(void 0)), + (this._defaultEdgeLabelFn = qr.constant(void 0)), + (this._nodes = {}), + this._isCompound && ((this._parent = {}), (this._children = {}), (this._children['\0'] = {})), + (this._in = {}), + (this._preds = {}), + (this._out = {}), + (this._sucs = {}), + (this._edgeObjs = {}), + (this._edgeLabels = {}); +} +function Jr(t, e) { + t[e] ? t[e]++ : (t[e] = 1); +} +function Kr(t, e) { + --t[e] || delete t[e]; +} +function Zr(t, e, n, i) { + (e = '' + e), (n = '' + n); + return !t && n < e && ((t = e), (e = n), (n = t)), e + '' + n + '' + (qr.isUndefined(i) ? '\0' : i); +} +function $r(t, e, n, i) { + (e = '' + e), (n = '' + n), !t && n < e && ((t = e), (e = n), (n = t)), (t = { v: e, w: n }); + return i && (t.name = i), t; +} +function to(t, e) { + return Zr(t, e.v, e.w, e.name); +} +(Qr.prototype._nodeCount = 0), + (Qr.prototype._edgeCount = 0), + (Qr.prototype.isDirected = function () { + return this._isDirected; + }), + (Qr.prototype.isMultigraph = function () { + return this._isMultigraph; + }), + (Qr.prototype.isCompound = function () { + return this._isCompound; + }), + (Qr.prototype.setGraph = function (t) { + return (this._label = t), this; + }), + (Qr.prototype.graph = function () { + return this._label; + }), + (Qr.prototype.setDefaultNodeLabel = function (t) { + return qr.isFunction(t) || (t = qr.constant(t)), (this._defaultNodeLabelFn = t), this; + }), + (Qr.prototype.nodeCount = function () { + return this._nodeCount; + }), + (Qr.prototype.nodes = function () { + return qr.keys(this._nodes); + }), + (Qr.prototype.sources = function () { + var e = this; + return qr.filter(this.nodes(), function (t) { + return qr.isEmpty(e._in[t]); + }); + }), + (Qr.prototype.sinks = function () { + var e = this; + return qr.filter(this.nodes(), function (t) { + return qr.isEmpty(e._out[t]); + }); + }), + (Qr.prototype.setNodes = function (t, e) { + var n = arguments, + i = this; + return ( + qr.each(t, function (t) { + 1 < n.length ? i.setNode(t, e) : i.setNode(t); + }), + this + ); + }), + (Qr.prototype.setNode = function (t, e) { + return ( + qr.has(this._nodes, t) + ? 1 < arguments.length && (this._nodes[t] = e) + : ((this._nodes[t] = 1 < arguments.length ? e : this._defaultNodeLabelFn(t)), + this._isCompound && ((this._parent[t] = '\0'), (this._children[t] = {}), (this._children['\0'][t] = !0)), + (this._in[t] = {}), + (this._preds[t] = {}), + (this._out[t] = {}), + (this._sucs[t] = {}), + ++this._nodeCount), + this + ); + }), + (Qr.prototype.node = function (t) { + return this._nodes[t]; + }), + (Qr.prototype.hasNode = function (t) { + return qr.has(this._nodes, t); + }), + (Qr.prototype.removeNode = function (t) { + var e, + n = this; + return ( + qr.has(this._nodes, t) && + ((e = function (t) { + n.removeEdge(n._edgeObjs[t]); + }), + delete this._nodes[t], + this._isCompound && + (this._removeFromParentsChildList(t), + delete this._parent[t], + qr.each(this.children(t), function (t) { + n.setParent(t); + }), + delete this._children[t]), + qr.each(qr.keys(this._in[t]), e), + delete this._in[t], + delete this._preds[t], + qr.each(qr.keys(this._out[t]), e), + delete this._out[t], + delete this._sucs[t], + --this._nodeCount), + this + ); + }), + (Qr.prototype.setParent = function (t, e) { + if (!this._isCompound) throw new Error('Cannot set parent in a non-compound graph'); + if (qr.isUndefined(e)) e = '\0'; + else { + for (var n = (e += ''); !qr.isUndefined(n); n = this.parent(n)) + if (n === t) throw new Error('Setting ' + e + ' as parent of ' + t + ' would create a cycle'); + this.setNode(e); + } + return ( + this.setNode(t), this._removeFromParentsChildList(t), (this._parent[t] = e), (this._children[e][t] = !0), this + ); + }), + (Qr.prototype._removeFromParentsChildList = function (t) { + delete this._children[this._parent[t]][t]; + }), + (Qr.prototype.parent = function (t) { + if (this._isCompound) { + t = this._parent[t]; + if ('\0' !== t) return t; + } + }), + (Qr.prototype.children = function (t) { + var e; + return ( + qr.isUndefined(t) && (t = '\0'), + this._isCompound + ? (e = this._children[t]) + ? qr.keys(e) + : void 0 + : '\0' === t + ? this.nodes() + : this.hasNode(t) + ? [] + : void 0 + ); + }), + (Qr.prototype.predecessors = function (t) { + t = this._preds[t]; + if (t) return qr.keys(t); + }), + (Qr.prototype.successors = function (t) { + t = this._sucs[t]; + if (t) return qr.keys(t); + }), + (Qr.prototype.neighbors = function (t) { + var e = this.predecessors(t); + if (e) return qr.union(e, this.successors(t)); + }), + (Qr.prototype.isLeaf = function (t) { + return 0 === (this.isDirected() ? this.successors(t) : this.neighbors(t)).length; + }), + (Qr.prototype.filterNodes = function (n) { + var i = new this.constructor({ + directed: this._isDirected, + multigraph: this._isMultigraph, + compound: this._isCompound, + }), + r = (i.setGraph(this.graph()), this), + o = + (qr.each(this._nodes, function (t, e) { + n(e) && i.setNode(e, t); + }), + qr.each(this._edgeObjs, function (t) { + i.hasNode(t.v) && i.hasNode(t.w) && i.setEdge(t, r.edge(t)); + }), + {}); + return ( + this._isCompound && + qr.each(i.nodes(), function (t) { + i.setParent( + t, + (function t(e) { + var n = r.parent(e); + return void 0 === n || i.hasNode(n) ? (o[e] = n) : n in o ? o[n] : t(n); + })(t), + ); + }), + i + ); + }), + (Qr.prototype.setDefaultEdgeLabel = function (t) { + return qr.isFunction(t) || (t = qr.constant(t)), (this._defaultEdgeLabelFn = t), this; + }), + (Qr.prototype.edgeCount = function () { + return this._edgeCount; + }), + (Qr.prototype.edges = function () { + return qr.values(this._edgeObjs); + }), + (Qr.prototype.setPath = function (t, n) { + var i = this, + r = arguments; + return ( + qr.reduce(t, function (t, e) { + return 1 < r.length ? i.setEdge(t, e, n) : i.setEdge(t, e), e; + }), + this + ); + }), + (Qr.prototype.setEdge = function () { + var t, + e, + n = !1, + i = arguments[0], + i = + ('object' == typeof i && null !== i && 'v' in i + ? ((r = i.v), (o = i.w), (t = i.name), 2 === arguments.length && ((e = arguments[1]), (n = !0))) + : ((r = i), (o = arguments[1]), (t = arguments[3]), 2 < arguments.length && ((e = arguments[2]), (n = !0))), + (r = '' + r), + (o = '' + o), + qr.isUndefined(t) || (t = '' + t), + Zr(this._isDirected, r, o, t)); + if (qr.has(this._edgeLabels, i)) n && (this._edgeLabels[i] = e); + else { + if (!qr.isUndefined(t) && !this._isMultigraph) + throw new Error('Cannot set a named edge when isMultigraph = false'); + this.setNode(r), this.setNode(o), (this._edgeLabels[i] = n ? e : this._defaultEdgeLabelFn(r, o, t)); + var n = $r(this._isDirected, r, o, t), + r = n.v, + o = n.w; + Object.freeze(n), + (this._edgeObjs[i] = n), + Jr(this._preds[o], r), + Jr(this._sucs[r], o), + (this._in[o][i] = n), + (this._out[r][i] = n), + this._edgeCount++; + } + return this; + }), + (Qr.prototype.edge = function (t, e, n) { + var i = 1 === arguments.length ? to(this._isDirected, t) : Zr(this._isDirected, t, e, n); + return this._edgeLabels[i]; + }), + (Qr.prototype.hasEdge = function (t, e, n) { + var i = 1 === arguments.length ? to(this._isDirected, t) : Zr(this._isDirected, t, e, n); + return qr.has(this._edgeLabels, i); + }), + (Qr.prototype.removeEdge = function (t, e, n) { + var i = 1 === arguments.length ? to(this._isDirected, arguments[0]) : Zr(this._isDirected, t, e, n), + r = this._edgeObjs[i]; + return ( + r && + ((t = r.v), + (e = r.w), + delete this._edgeLabels[i], + delete this._edgeObjs[i], + Kr(this._preds[e], t), + Kr(this._sucs[t], e), + delete this._in[e][i], + delete this._out[t][i], + this._edgeCount--), + this + ); + }), + (Qr.prototype.inEdges = function (t, e) { + var t = this._in[t]; + if (t) + return ( + (t = qr.values(t)), + e + ? qr.filter(t, function (t) { + return t.v === e; + }) + : t + ); + }), + (Qr.prototype.outEdges = function (t, e) { + var t = this._out[t]; + if (t) + return ( + (t = qr.values(t)), + e + ? qr.filter(t, function (t) { + return t.w === e; + }) + : t + ); + }), + (Qr.prototype.nodeEdges = function (t, e) { + var n = this.inEdges(t, e); + if (n) return n.concat(this.outEdges(t, e)); + }); +var eo = { Graph: Hr, version: '2.1.8' }, + no = { + write: function (t) { + var e = { + options: { directed: t.isDirected(), multigraph: t.isMultigraph(), compound: t.isCompound() }, + nodes: io(t), + edges: ro(t), + }; + return qr.isUndefined(t.graph()) || (e.value = qr.clone(t.graph())), e; + }, + read: function (t) { + var e = new Hr(t.options).setGraph(t.value); + return ( + qr.each(t.nodes, function (t) { + e.setNode(t.v, t.value), t.parent && e.setParent(t.v, t.parent); + }), + qr.each(t.edges, function (t) { + e.setEdge({ v: t.v, w: t.w, name: t.name }, t.value); + }), + e + ); + }, + }; +function io(i) { + return qr.map(i.nodes(), function (t) { + var e = i.node(t), + n = i.parent(t), + t = { v: t }; + return qr.isUndefined(e) || (t.value = e), qr.isUndefined(n) || (t.parent = n), t; + }); +} +function ro(i) { + return qr.map(i.edges(), function (t) { + var e = i.edge(t), + n = { v: t.v, w: t.w }; + return qr.isUndefined(t.name) || (n.name = t.name), qr.isUndefined(e) || (n.value = e), n; + }); +} +var oo = function (e) { + var n, + i = {}, + r = []; + function o(t) { + qr.has(i, t) || ((i[t] = !0), n.push(t), qr.each(e.successors(t), o), qr.each(e.predecessors(t), o)); + } + return ( + qr.each(e.nodes(), function (t) { + (n = []), o(t), n.length && r.push(n); + }), + r + ); + }, + ao = so; +function so() { + (this._arr = []), (this._keyIndices = {}); +} +(so.prototype.size = function () { + return this._arr.length; +}), + (so.prototype.keys = function () { + return this._arr.map(function (t) { + return t.key; + }); + }), + (so.prototype.has = function (t) { + return qr.has(this._keyIndices, t); + }), + (so.prototype.priority = function (t) { + t = this._keyIndices[t]; + if (void 0 !== t) return this._arr[t].priority; + }), + (so.prototype.min = function () { + if (0 === this.size()) throw new Error('Queue underflow'); + return this._arr[0].key; + }), + (so.prototype.add = function (t, e) { + var n, + i, + r = this._keyIndices; + return ( + (t = String(t)), + !qr.has(r, t) && + ((i = (n = this._arr).length), (r[t] = i), n.push({ key: t, priority: e }), this._decrease(i), !0) + ); + }), + (so.prototype.removeMin = function () { + this._swap(0, this._arr.length - 1); + var t = this._arr.pop(); + return delete this._keyIndices[t.key], this._heapify(0), t.key; + }), + (so.prototype.decrease = function (t, e) { + var n = this._keyIndices[t]; + if (e > this._arr[n].priority) + throw new Error( + 'New priority is greater than current priority. Key: ' + t + ' Old: ' + this._arr[n].priority + ' New: ' + e, + ); + (this._arr[n].priority = e), this._decrease(n); + }), + (so.prototype._heapify = function (t) { + var e = this._arr, + n = 2 * t, + i = 1 + n, + r = t; + n < e.length && + ((r = e[n].priority < e[r].priority ? n : r), + (r = i < e.length ? (e[i].priority < e[r].priority ? i : r) : r) !== t) && + (this._swap(t, r), this._heapify(r)); + }), + (so.prototype._decrease = function (t) { + for (var e, n = this._arr, i = n[t].priority; 0 !== t && !(n[(e = t >> 1)].priority < i); ) + this._swap(t, e), (t = e); + }), + (so.prototype._swap = function (t, e) { + var n = this._arr, + i = this._keyIndices, + r = n[t], + o = n[e]; + (n[t] = o), (n[e] = r), (i[o.key] = t), (i[r.key] = e); + }); +var ho = function (e, t, n, i) { + var r = e, + o = String(t), + a = n || co, + s = + i || + function (t) { + return e.outEdges(t); + }; + function h(t) { + var e = t.v !== c ? t.v : t.w, + n = l[e], + i = a(t), + r = u.distance + i; + if (i < 0) throw new Error('dijkstra does not allow negative edge weights. Bad edge: ' + t + ' Weight: ' + i); + r < n.distance && ((n.distance = r), (n.predecessor = c), d.decrease(e, r)); + } + var c, + u, + l = {}, + d = new ao(); + for ( + r.nodes().forEach(function (t) { + var e = t === o ? 0 : Number.POSITIVE_INFINITY; + (l[t] = { distance: e }), d.add(t, e); + }); + 0 < d.size() && ((c = d.removeMin()), (u = l[c]).distance !== Number.POSITIVE_INFINITY); + + ) + s(c).forEach(h); + return l; + }, + co = qr.constant(1), + uo = function (n, i, r) { + return qr.transform( + n.nodes(), + function (t, e) { + t[e] = ho(n, e, i, r); + }, + {}, + ); + }, + lo = function (o) { + var a = 0, + s = [], + h = {}, + c = []; + return ( + o.nodes().forEach(function (t) { + qr.has(h, t) || + (function e(t) { + var n = (h[t] = { onStack: !0, lowlink: a, index: a++ }); + if ( + (s.push(t), + o.successors(t).forEach(function (t) { + qr.has(h, t) + ? h[t].onStack && (n.lowlink = Math.min(n.lowlink, h[t].index)) + : (e(t), (n.lowlink = Math.min(n.lowlink, h[t].lowlink))); + }), + n.lowlink === n.index) + ) { + for (var i, r = []; (i = s.pop()), (h[i].onStack = !1), r.push(i), t !== i; ); + c.push(r); + } + })(t); + }), + c + ); + }, + fo = function (e) { + return qr.filter(lo(e), function (t) { + return 1 < t.length || (1 === t.length && e.hasEdge(t[0], t[0])); + }); + }, + go = function (e, t, n) { + return ( + (i = t || po), + (r = + n || + function (t) { + return e.outEdges(t); + }), + (a = {}), + (s = e.nodes()).forEach(function (n) { + (a[n] = {}), + (a[n][n] = { distance: 0 }), + s.forEach(function (t) { + n !== t && (a[n][t] = { distance: Number.POSITIVE_INFINITY }); + }), + r(n).forEach(function (t) { + var e = t.v === n ? t.w : t.v, + t = i(t); + a[n][e] = { distance: t, predecessor: n }; + }); + }), + s.forEach(function (r) { + var o = a[r]; + s.forEach(function (t) { + var i = a[t]; + s.forEach(function (t) { + var e = i[r], + n = o[t], + t = i[t], + e = e.distance + n.distance; + e < t.distance && ((t.distance = e), (t.predecessor = n.predecessor)); + }); + }); + }), + a + ); + var i, r, a, s; + }, + po = qr.constant(1), + vo = yo; +function yo(n) { + var i = {}, + r = {}, + o = []; + if ( + (qr.each(n.sinks(), function t(e) { + if (qr.has(r, e)) throw new mo(); + qr.has(i, e) || ((r[e] = !0), (i[e] = !0), qr.each(n.predecessors(e), t), delete r[e], o.push(e)); + }), + qr.size(i) !== n.nodeCount()) + ) + throw new mo(); + return o; +} +function mo() {} +(yo.CycleException = mo).prototype = new Error(); +var xo = function (e, t, n) { + qr.isArray(t) || (t = [t]); + var i = (e.isDirected() ? e.successors : e.neighbors).bind(e), + r = [], + o = {}; + return ( + qr.each(t, function (t) { + if (!e.hasNode(t)) throw new Error('Graph does not have node: ' + t); + !(function e(n, t, i, r, o, a) { + qr.has(r, t) || + ((r[t] = !0), + i || a.push(t), + qr.each(o(t), function (t) { + e(n, t, i, r, o, a); + }), + i && a.push(t)); + })(e, t, 'post' === n, o, i, r); + }), + r + ); + }, + bo = { + components: oo, + dijkstra: ho, + dijkstraAll: uo, + findCycles: fo, + floydWarshall: go, + isAcyclic: function (t) { + try { + vo(t); + } catch (t) { + if (t instanceof vo.CycleException) return !1; + throw t; + } + return !0; + }, + postorder: function (t, e) { + return xo(t, e, 'post'); + }, + preorder: function (t, e) { + return xo(t, e, 'pre'); + }, + prim: function (t, i) { + var r, + e = new Hr(), + o = {}, + a = new ao(); + function n(t) { + var e = t.v === r ? t.w : t.v, + n = a.priority(e); + void 0 !== n && (t = i(t)) < n && ((o[e] = r), a.decrease(e, t)); + } + if (0 !== t.nodeCount()) { + qr.each(t.nodes(), function (t) { + a.add(t, Number.POSITIVE_INFINITY), e.setNode(t); + }), + a.decrease(t.nodes()[0], 0); + for (var s = !1; 0 < a.size(); ) { + if (((r = a.removeMin()), qr.has(o, r))) e.setEdge(r, o[r]); + else { + if (s) throw new Error('Input graph is not connected: ' + t); + s = !0; + } + t.nodeEdges(r).forEach(n); + } + } + return e; + }, + tarjan: lo, + topsort: vo, + }, + ko = { Graph: eo.Graph, json: no, alg: bo, version: eo.version }; +try { + wo = ko; +} catch (t) {} +var wo, + Mo = (wo = wo || window.graphlib), + Eo = function (t) { + return Xn(t, 5); + }, + Co = function (t, e, n) { + var i; + return !!wt(n) && !!('number' == (i = typeof e) ? Ve(n) && Me(e, n.length) : 'string' == i && e in n) && H(n[e], t); + }, + No = Object.prototype, + _o = No.hasOwnProperty, + Lo = Ar(function (t, e) { + t = Object(t); + var n = -1, + i = e.length, + r = 2 < i ? e[2] : void 0; + for (r && Co(e[0], e[1], r) && (i = 1); ++n < i; ) + for (var o = e[n], a = Ye(o), s = -1, h = a.length; ++s < h; ) { + var c = a[s], + u = t[c]; + (void 0 === u || (H(u, No[c]) && !_o.call(t, c))) && (t[c] = o[c]); + } + return t; + }), + So = function (o) { + return function (t, e, n) { + var i, + r = Object(t), + e = + (Ve(t) || + ((i = Gi(e)), + (t = je(t)), + (e = function (t) { + return i(r[t], t, r); + })), + o(t, e, n)); + return -1 < e ? r[i ? t[e] : e] : void 0; + }; + }, + To = /\s/, + Po = function (t) { + for (var e = t.length; e-- && To.test(t.charAt(e)); ); + return e; + }, + Ao = /^\s+/, + Oo = function (t) { + return t && t.slice(0, Po(t) + 1).replace(Ao, ''); + }, + Io = /^[-+]0x[0-9a-f]+$/i, + Do = /^0b[01]+$/i, + Bo = /^0o[0-7]+$/i, + Ro = parseInt, + zo = function (t) { + if ('number' == typeof t) return t; + if (bi(t)) return NaN; + if ( + (wt(t) && ((e = 'function' == typeof t.valueOf ? t.valueOf() : t), (t = wt(e) ? e + '' : e)), + 'string' != typeof t) + ) + return 0 === t ? t : +t; + t = Oo(t); + var e = Do.test(t); + return e || Bo.test(t) ? Ro(t.slice(2), e ? 2 : 8) : Io.test(t) ? NaN : +t; + }, + Vo = function (t) { + return t + ? (t = zo(t)) === 1 / 0 || t === -1 / 0 + ? 17976931348623157e292 * (t < 0 ? -1 : 1) + : t == t + ? t + : 0 + : 0 === t + ? t + : 0; + }, + jo = function (t) { + var t = Vo(t), + e = t % 1; + return t == t ? (e ? t - e : t) : 0; + }, + Fo = Math.max, + Xo = So(function (t, e, n) { + var i = null == t ? 0 : t.length; + return i ? ((n = null == n ? 0 : jo(n)) < 0 && (n = Fo(i + n, 0)), Or(t, Gi(e), n)) : -1; + }), + Uo = function (t) { + return null != t && t.length ? Cr(t, 1) : []; + }, + Wo = function (t, e) { + return null == t ? t : Yn(t, Qn(e), Ye); + }, + Yo = function (t) { + var e = null == t ? 0 : t.length; + return e ? t[e - 1] : void 0; + }, + Go = function (t, i) { + var r = {}; + return ( + (i = Gi(i)), + Gn(t, function (t, e, n) { + he(r, e, i(t, e, n)); + }), + r + ); + }, + qo = function (t, e, n) { + for (var i = -1, r = t.length; ++i < r; ) { + var o, + a, + s = t[i], + h = e(s); + null != h && (void 0 === o ? h == h && !bi(h) : n(h, o)) && ((o = h), (a = s)); + } + return a; + }, + Ho = function (t, e) { + return e < t; + }, + Qo = function (t) { + return t && t.length ? qo(t, Hn, Ho) : void 0; + }, + Jo = function (t, e, n) { + ((void 0 === n || H(t[e], n)) && (void 0 !== n || e in t)) || he(t, e, n); + }, + Ko = Function.prototype, + Zo = Object.prototype, + $o = Ko.toString, + ta = Zo.hasOwnProperty, + ea = $o.call(Object), + na = function (t) { + return ( + !(!fe(t) || '[object Object]' != xt(t)) && + (null === (t = nn(t)) || + ('function' == typeof (t = ta.call(t, 'constructor') && t.constructor) && t instanceof t && $o.call(t) == ea)) + ); + }, + ia = function (t, e) { + if (('constructor' !== e || 'function' != typeof t[e]) && '__proto__' != e) return t[e]; + }, + ra = function (t) { + return le(t, Ye(t)); + }, + oa = function (t, e, n, i, r, o, a) { + var s, + h, + c, + u = ia(t, n), + l = ia(e, n), + d = a.get(l); + d + ? Jo(t, n, d) + : ((e = void 0 === (d = o ? o(u, l, n + '', t, e, a) : void 0)) && + ((h = !(s = xe(l)) && be(l)), + (c = !s && !h && Te(l)), + (d = l), + s || h || c + ? (d = xe(u) ? u : Xr(u) ? He(u) : h ? qe(l, !(e = !1)) : c ? Tn(l, !(e = !1)) : []) + : na(l) || me(l) + ? me((d = u)) + ? (d = ra(u)) + : (wt(u) && !kt(u)) || (d = In(l)) + : (e = !1)), + e && (a.set(l, d), r(d, l, i, o, a), a.delete(l)), + Jo(t, n, d)); + }, + aa = function i(r, o, a, s, h) { + r !== o && + Yn( + o, + function (t, e) { + var n; + (h = h || new oe()), + wt(t) + ? oa(r, o, e, a, i, s, h) + : ((n = s ? s(ia(r, e), t, e + '', r, o, h) : void 0), Jo(r, e, (n = void 0 === n ? t : n))); + }, + Ye, + ); + }, + sa = (function (s) { + return Ar(function (t, e) { + var n = -1, + i = e.length, + r = 1 < i ? e[i - 1] : void 0, + o = 2 < i ? e[2] : void 0, + r = 3 < s.length && 'function' == typeof r ? (i--, r) : void 0; + for (o && Co(e[0], e[1], o) && ((r = i < 3 ? void 0 : r), (i = 1)), t = Object(t); ++n < i; ) { + var a = e[n]; + a && s(t, a, n); + } + return t; + }); + })(function (t, e, n) { + aa(t, e, n); + }), + ha = function (t, e) { + return t < e; + }, + ca = function (t) { + return t && t.length ? qo(t, Hn, ha) : void 0; + }, + ua = function (t, e) { + return t && t.length ? qo(t, Gi(e), ha) : void 0; + }, + la = function () { + return ct.Date.now(); + }, + da = function (t, e, n, i) { + if (wt(t)) + for (var r = -1, o = (e = Di(e, t)).length, a = o - 1, s = t; null != s && ++r < o; ) { + var h, + c = Bi(e[r]), + u = n; + if ('__proto__' === c || 'constructor' === c || 'prototype' === c) return t; + r != a && ((h = s[c]), void 0 === (u = i ? i(h, c, s) : void 0)) && (u = wt(h) ? h : Me(e[r + 1]) ? [] : {}), + ue(s, c, u), + (s = s[c]); + } + return t; + }, + fa = function (t, e, n) { + for (var i = -1, r = e.length, o = {}; ++i < r; ) { + var a = e[i], + s = Ri(t, a); + n(s, a) && da(o, Di(a, t), s); + } + return o; + }, + ga = function (n, t) { + return fa(n, t, function (t, e) { + return Fi(n, e); + }); + }, + pa = (function (t) { + return Pr(Lr(t, void 0, Uo), t + ''); + })(function (t, e) { + return null == t ? {} : ga(t, e); + }), + va = Math.ceil, + ya = Math.max, + ma = function (t, e, n, i) { + for (var r = -1, o = ya(va((e - t) / (n || 1)), 0), a = Array(o); o--; ) (a[i ? o : ++r] = t), (t += n); + return a; + }, + xa = function (t, e, n) { + return ( + n && 'number' != typeof n && Co(t, e, n) && (e = n = void 0), + (t = Vo(t)), + void 0 === e ? ((e = t), (t = 0)) : (e = Vo(e)), + (n = void 0 === n ? (t < e ? 1 : -1) : Vo(n)), + ma(t, e, n, void 0) + ); + }, + wa = function (t, e) { + var n = t.length; + for (t.sort(e); n--; ) t[n] = t[n].value; + return t; + }, + ba = function (t, e) { + if (t !== e) { + var n = void 0 !== t, + i = null === t, + r = t == t, + o = bi(t), + a = void 0 !== e, + s = null === e, + h = e == e, + c = bi(e); + if ((!s && !c && !o && e < t) || (o && a && h && !s && !c) || (i && a && h) || (!n && h) || !r) return 1; + if ((!i && !o && !c && t < e) || (c && n && r && !i && !o) || (s && n && r) || (!a && r) || !h) return -1; + } + return 0; + }, + ka = function (t, e, n) { + for (var i = -1, r = t.criteria, o = e.criteria, a = r.length, s = n.length; ++i < a; ) { + var h = ba(r[i], o[i]); + if (h) return s <= i ? h : h * ('desc' == n[i] ? -1 : 1); + } + return t.index - e.index; + }, + Ma = function (t, i, n) { + i = i.length + ? Ti(i, function (e) { + return xe(e) + ? function (t) { + return Ri(t, 1 === e.length ? e[0] : e); + } + : e; + }) + : [Hn]; + var r = -1, + t = + ((i = Ti(i, _e(Gi))), + tr(t, function (e, t, n) { + return { + criteria: Ti(i, function (t) { + return t(e); + }), + index: ++r, + value: e, + }; + })); + return wa(t, function (t, e) { + return ka(t, e, n); + }); + }, + Ea = Ar(function (t, e) { + var n; + return null == t + ? [] + : (1 < (n = e.length) && Co(t, e[0], e[1]) ? (e = []) : 2 < n && Co(e[0], e[1], e[2]) && (e = [e[0]]), + Ma(t, Cr(e, 1), [])); + }), + Ca = 0, + Na = function (t) { + var e = ++Ca; + return Ii(t) + e; + }, + _a = function (t, e, n) { + for (var i = -1, r = t.length, o = e.length, a = {}; ++i < r; ) { + var s = i < o ? e[i] : void 0; + n(a, t[i], s); + } + return a; + }, + Sa = function (t, e) { + return _a(t || [], e || [], ue); + }; +try { + La = { + cloneDeep: Eo, + constant: Wn, + defaults: Lo, + each: Kn, + filter: qi, + find: Xo, + flatten: Uo, + forEach: Jn, + forIn: Wo, + has: Ji, + isUndefined: $i, + last: Yo, + map: er, + mapValues: Go, + max: Qo, + merge: sa, + min: ca, + minBy: ua, + now: la, + pick: pa, + range: xa, + reduce: rr, + sortBy: Ea, + uniqueId: Na, + values: Gr, + zipObject: Sa, + }; +} catch (t) {} +var La, + Ta = (La = La || window._), + Pa = Aa; +function Aa() { + var t = {}; + (t._next = t._prev = t), (this._sentinel = t); +} +function Oa(t) { + (t._prev._next = t._next), (t._next._prev = t._prev), delete t._next, delete t._prev; +} +function Ia(t, e) { + if ('_next' !== t && '_prev' !== t) return e; +} +(Aa.prototype.dequeue = function () { + var t = this._sentinel, + e = t._prev; + if (e !== t) return Oa(e), e; +}), + (Aa.prototype.enqueue = function (t) { + var e = this._sentinel; + t._prev && t._next && Oa(t), (t._next = e._next), (e._next._prev = t), ((e._next = t)._prev = e); + }), + (Aa.prototype.toString = function () { + for (var t = [], e = this._sentinel, n = e._prev; n !== e; ) t.push(JSON.stringify(n, Ia)), (n = n._prev); + return '[' + t.join(', ') + ']'; + }); +var Da = Mo.Graph, + Ba = function (e, t) { + var n, i, r, o, a, s, h; + return e.nodeCount() <= 1 + ? [] + : ((n = e), + (i = t || Ra), + (r = new Da()), + (a = o = 0), + Ta.forEach(n.nodes(), function (t) { + r.setNode(t, { v: t, in: 0, out: 0 }); + }), + Ta.forEach(n.edges(), function (t) { + var e = r.edge(t.v, t.w) || 0, + n = i(t); + r.setEdge(t.v, t.w, e + n), + (a = Math.max(a, (r.node(t.v).out += n))), + (o = Math.max(o, (r.node(t.w).in += n))); + }), + (s = Ta.range(a + o + 3).map(function () { + return new Pa(); + })), + (h = o + 1), + Ta.forEach(r.nodes(), function (t) { + Va(s, h, r.node(t)); + }), + (n = (function (t, e, n) { + for (var i, r = [], o = e[e.length - 1], a = e[0]; t.nodeCount(); ) { + for (; (i = a.dequeue()); ) za(t, e, n, i); + for (; (i = o.dequeue()); ) za(t, e, n, i); + if (t.nodeCount()) + for (var s = e.length - 2; 0 < s; --s) + if ((i = e[s].dequeue())) { + r = r.concat(za(t, e, n, i, !0)); + break; + } + } + return r; + })((t = { graph: r, buckets: s, zeroIdx: h }).graph, t.buckets, t.zeroIdx)), + Ta.flatten( + Ta.map(n, function (t) { + return e.outEdges(t.v, t.w); + }), + !0, + )); + }, + Ra = Ta.constant(1); +function za(i, r, o, t, a) { + var s = a ? [] : void 0; + return ( + Ta.forEach(i.inEdges(t.v), function (t) { + var e = i.edge(t), + n = i.node(t.v); + a && s.push({ v: t.v, w: t.w }), (n.out -= e), Va(r, o, n); + }), + Ta.forEach(i.outEdges(t.v), function (t) { + var e = i.edge(t), + t = t.w, + t = i.node(t); + (t.in -= e), Va(r, o, t); + }), + i.removeNode(t.v), + s + ); +} +function Va(t, e, n) { + (n.out ? (n.in ? t[n.out - n.in + e] : t[t.length - 1]) : t[0]).enqueue(n); +} +var ja = { + run: function (n) { + var i, + r, + o, + a, + e, + t = + 'greedy' === n.graph().acyclicer + ? Ba( + n, + ((e = n), + function (t) { + return e.edge(t).weight; + }), + ) + : ((i = n), + (r = []), + (o = {}), + (a = {}), + Ta.forEach(i.nodes(), function e(t) { + Ta.has(a, t) || + ((a[t] = !0), + (o[t] = !0), + Ta.forEach(i.outEdges(t), function (t) { + Ta.has(o, t.w) ? r.push(t) : e(t.w); + }), + delete o[t]); + }), + r); + Ta.forEach(t, function (t) { + var e = n.edge(t); + n.removeEdge(t), (e.forwardName = t.name), (e.reversed = !0), n.setEdge(t.w, t.v, e, Ta.uniqueId('rev')); + }); + }, + undo: function (i) { + Ta.forEach(i.edges(), function (t) { + var e, + n = i.edge(t); + n.reversed && + (i.removeEdge(t), (e = n.forwardName), delete n.reversed, delete n.forwardName, i.setEdge(t.w, t.v, n, e)); + }); + }, + }, + Fa = Mo.Graph, + Xa = { + addDummyNode: Ua, + simplify: function (i) { + var r = new Fa().setGraph(i.graph()); + return ( + Ta.forEach(i.nodes(), function (t) { + r.setNode(t, i.node(t)); + }), + Ta.forEach(i.edges(), function (t) { + var e = r.edge(t.v, t.w) || { weight: 0, minlen: 1 }, + n = i.edge(t); + r.setEdge(t.v, t.w, { weight: e.weight + n.weight, minlen: Math.max(e.minlen, n.minlen) }); + }), + r + ); + }, + asNonCompoundGraph: function (e) { + var n = new Fa({ multigraph: e.isMultigraph() }).setGraph(e.graph()); + return ( + Ta.forEach(e.nodes(), function (t) { + e.children(t).length || n.setNode(t, e.node(t)); + }), + Ta.forEach(e.edges(), function (t) { + n.setEdge(t, e.edge(t)); + }), + n + ); + }, + successorWeights: function (n) { + var t = Ta.map(n.nodes(), function (t) { + var e = {}; + return ( + Ta.forEach(n.outEdges(t), function (t) { + e[t.w] = (e[t.w] || 0) + n.edge(t).weight; + }), + e + ); + }); + return Ta.zipObject(n.nodes(), t); + }, + predecessorWeights: function (n) { + var t = Ta.map(n.nodes(), function (t) { + var e = {}; + return ( + Ta.forEach(n.inEdges(t), function (t) { + e[t.v] = (e[t.v] || 0) + n.edge(t).weight; + }), + e + ); + }); + return Ta.zipObject(n.nodes(), t); + }, + intersectRect: function (t, e) { + var n, + i = t.x, + r = t.y, + o = e.x - i, + e = e.y - r, + a = t.width / 2, + t = t.height / 2; + if (o || e) + return ( + (t = + Math.abs(e) * a > Math.abs(o) * t + ? ((n = ((t = e < 0 ? -t : t) * o) / e), t) + : ((n = a = o < 0 ? -a : a) * e) / o), + { x: i + n, y: r + t } + ); + throw new Error('Not possible to find intersection inside of the rectangle'); + }, + buildLayerMatrix: function (i) { + var r = Ta.map(Ta.range(Wa(i) + 1), function () { + return []; + }); + return ( + Ta.forEach(i.nodes(), function (t) { + var e = i.node(t), + n = e.rank; + Ta.isUndefined(n) || (r[n][e.order] = t); + }), + r + ); + }, + normalizeRanks: function (e) { + var n = Ta.min( + Ta.map(e.nodes(), function (t) { + return e.node(t).rank; + }), + ); + Ta.forEach(e.nodes(), function (t) { + t = e.node(t); + Ta.has(t, 'rank') && (t.rank -= n); + }); + }, + removeEmptyRanks: function (n) { + var i = Ta.min( + Ta.map(n.nodes(), function (t) { + return n.node(t).rank; + }), + ), + r = [], + o = + (Ta.forEach(n.nodes(), function (t) { + var e = n.node(t).rank - i; + r[e] || (r[e] = []), r[e].push(t); + }), + 0), + a = n.graph().nodeRankFactor; + Ta.forEach(r, function (t, e) { + Ta.isUndefined(t) && e % a != 0 + ? --o + : o && + Ta.forEach(t, function (t) { + n.node(t).rank += o; + }); + }); + }, + addBorderNode: function (t, e, n, i) { + var r = { width: 0, height: 0 }; + return 4 <= arguments.length && ((r.rank = n), (r.order = i)), Ua(t, 'border', r, e); + }, + maxRank: Wa, + partition: function (t, e) { + var n = { lhs: [], rhs: [] }; + return ( + Ta.forEach(t, function (t) { + (e(t) ? n.lhs : n.rhs).push(t); + }), + n + ); + }, + time: function (t, e) { + var n = Ta.now(); + try { + return e(); + } finally { + console.log(t + ' time: ' + (Ta.now() - n) + 'ms'); + } + }, + notime: function (t, e) { + return e(); + }, + }; +function Ua(t, e, n, i) { + for (var r; (r = Ta.uniqueId(i)), t.hasNode(r); ); + return (n.dummy = e), t.setNode(r, n), r; +} +function Wa(e) { + return Ta.max( + Ta.map(e.nodes(), function (t) { + t = e.node(t).rank; + if (!Ta.isUndefined(t)) return t; + }), + ); +} +var Ya = { + run: function (d) { + (d.graph().dummyChains = []), + Ta.forEach(d.edges(), function (t) { + var e, + n, + i, + r = d, + o = t, + a = o.v, + s = r.node(a).rank, + t = o.w, + h = r.node(t).rank, + c = o.name, + u = r.edge(o), + l = u.labelRank; + if (h !== s + 1) { + for (r.removeEdge(o), i = 0, ++s; s < h; ++i, ++s) + (u.points = []), + (e = Xa.addDummyNode( + r, + 'edge', + (n = { width: 0, height: 0, edgeLabel: u, edgeObj: o, rank: s }), + '_d', + )), + s === l && + ((n.width = u.width), (n.height = u.height), (n.dummy = 'edge-label'), (n.labelpos = u.labelpos)), + r.setEdge(a, e, { weight: u.weight }, c), + 0 === i && r.graph().dummyChains.push(e), + (a = e); + r.setEdge(a, t, { weight: u.weight }, c); + } + }); + }, + undo: function (r) { + Ta.forEach(r.graph().dummyChains, function (t) { + var e, + n = r.node(t), + i = n.edgeLabel; + for (r.setEdge(n.edgeObj, i); n.dummy; ) + (e = r.successors(t)[0]), + r.removeNode(t), + i.points.push({ x: n.x, y: n.y }), + 'edge-label' === n.dummy && ((i.x = n.x), (i.y = n.y), (i.width = n.width), (i.height = n.height)), + (n = r.node((t = e))); + }); + }, + }, + Ga = function (i) { + var r = {}; + Ta.forEach(i.sources(), function e(t) { + var n = i.node(t); + if (Ta.has(r, t)) return n.rank; + r[t] = !0; + t = Ta.min( + Ta.map(i.outEdges(t), function (t) { + return e(t.w) - i.edge(t).minlen; + }), + ); + return (t !== Number.POSITIVE_INFINITY && null != t) || (t = 0), (n.rank = t); + }); + }, + qa = function (t, e) { + return t.node(e.w).rank - t.node(e.v).rank - t.edge(e).minlen; + }, + Ha = Mo.Graph, + Qa = qa, + Ja = function (t) { + var e, + n = new Ha({ directed: !1 }), + i = t.nodes()[0], + r = t.nodeCount(); + for (n.setNode(i, {}); Ka(n, t) < r; ) (e = Za(n, t)), (e = n.hasNode(e.v) ? Qa(t, e) : -Qa(t, e)), $a(n, t, e); + return n; + }; +function Ka(r, o) { + return ( + Ta.forEach(r.nodes(), function n(i) { + Ta.forEach(o.nodeEdges(i), function (t) { + var e = t.v, + e = i === e ? t.w : e; + r.hasNode(e) || Qa(o, t) || (r.setNode(e, {}), r.setEdge(i, e, {}), n(e)); + }); + }), + r.nodeCount() + ); +} +function Za(e, n) { + return Ta.minBy(n.edges(), function (t) { + if (e.hasNode(t.v) !== e.hasNode(t.w)) return Qa(n, t); + }); +} +function $a(t, e, n) { + Ta.forEach(t.nodes(), function (t) { + e.node(t).rank += n; + }); +} +var ts = qa, + es = Ga, + ns = Mo.alg.preorder, + is = Mo.alg.postorder, + rs = Xa.simplify, + os = as; +function as(t) { + (t = rs(t)), es(t); + var e, + n = Ja(t); + for (cs(n), ss(n, t); (e = ls(n)); ) fs(n, t, e, ds(n, t, e)); +} +function ss(r, o) { + var t = (t = is(r, r.nodes())).slice(0, t.length - 1); + Ta.forEach(t, function (t) { + var e, n, i; + (n = o), (t = t), (i = (e = r).node(t).parent), (e.edge(t, i).cutvalue = hs(e, n, t)); + }); +} +function hs(i, r, o) { + var a = i.node(o).parent, + s = !0, + t = r.edge(o, a), + h = 0; + return ( + t || ((s = !1), (t = r.edge(a, o))), + (h = t.weight), + Ta.forEach(r.nodeEdges(o), function (t) { + var e = t.v === o, + n = e ? t.w : t.v; + n !== a && + ((e = e === s), (t = r.edge(t).weight), (h += e ? t : -t), i.hasEdge(o, n)) && + ((t = i.edge(o, n).cutvalue), (h += e ? -t : t)); + }), + h + ); +} +function cs(t, e) { + arguments.length < 2 && (e = t.nodes()[0]), us(t, {}, 1, e); +} +function us(e, n, i, r, t) { + var o = i, + a = e.node(r); + return ( + (n[r] = !0), + Ta.forEach(e.neighbors(r), function (t) { + Ta.has(n, t) || (i = us(e, n, i, t, r)); + }), + (a.low = o), + (a.lim = i++), + t ? (a.parent = t) : delete a.parent, + i + ); +} +function ls(e) { + return Ta.find(e.edges(), function (t) { + return e.edge(t).cutvalue < 0; + }); +} +function ds(e, n, t) { + var i = t.v, + r = t.w, + t = (n.hasEdge(i, r) || ((i = t.w), (r = t.v)), e.node(i)), + i = e.node(r), + o = t, + a = !1, + r = + (t.lim > i.lim && ((o = i), (a = !0)), + Ta.filter(n.edges(), function (t) { + return a === gs(e, e.node(t.v), o) && a !== gs(e, e.node(t.w), o); + })); + return Ta.minBy(r, function (t) { + return ts(n, t); + }); +} +function fs(t, e, n, i) { + var r, + o, + a = n.v, + n = n.w; + t.removeEdge(a, n), + t.setEdge(i.v, i.w, {}), + cs(t), + ss(t, e), + (r = t), + (o = e), + (a = Ta.find(r.nodes(), function (t) { + return !o.node(t).parent; + })), + (a = (a = ns(r, a)).slice(1)), + Ta.forEach(a, function (t) { + var e = r.node(t).parent, + n = o.edge(t, e), + i = !1; + n || ((n = o.edge(e, t)), (i = !0)), (o.node(t).rank = o.node(e).rank + (i ? n.minlen : -n.minlen)); + }); +} +function gs(t, e, n) { + return n.low <= e.lim && e.lim <= n.lim; +} +(as.initLowLimValues = cs), + (as.initCutValues = ss), + (as.calcCutValue = hs), + (as.leaveEdge = ls), + (as.enterEdge = ds), + (as.exchangeEdges = fs); +var ps = Ga, + vs = function (t) { + switch (t.graph().ranker) { + case 'network-simplex': + ms(t); + break; + case 'tight-tree': + ps((e = t)), Ja(e); + break; + case 'longest-path': + ys(t); + break; + default: + ms(t); + } + var e; + }, + ys = ps; +function ms(t) { + os(t); +} +var xs = function (c) { + (i = c), + (r = {}), + (o = 0), + Ta.forEach(i.children(), function t(e) { + var n = o; + Ta.forEach(i.children(e), t), (r[e] = { low: n, lim: o++ }); + }); + var i, + r, + o, + u = r; + Ta.forEach(c.graph().dummyChains, function (t) { + for ( + var e, + n = c.node(t).edgeObj, + i = (function (t, e, n, i) { + for ( + var r, o = [], a = [], s = Math.min(e[n].low, e[i].low), h = Math.max(e[n].lim, e[i].lim), c = n; + (c = t.parent(c)), o.push(c), c && (e[c].low > s || h > e[c].lim); + + ); + for (r = c, c = i; (c = t.parent(c)) !== r; ) a.push(c); + return { path: o.concat(a.reverse()), lca: r }; + })(c, u, n.v, n.w), + r = i.path, + o = i.lca, + a = 0, + s = r[a], + h = !0; + t !== n.w; + + ) { + if (((e = c.node(t)), h)) { + for (; (s = r[a]) !== o && c.node(s).maxRank < e.rank; ) a++; + s === o && (h = !1); + } + if (!h) { + for (; a < r.length - 1 && c.node((s = r[a + 1])).minRank <= e.rank; ) a++; + s = r[a]; + } + c.setParent(t, s), (t = c.successors(t)[0]); + } + }); + }, + ws = { + run: function (e) { + var r, + o, + n, + i = Xa.addDummyNode(e, 'root', {}, '_root'), + a = + ((r = e), + (o = {}), + Ta.forEach(r.children(), function (t) { + !(function e(t, n) { + var i = r.children(t); + i && + i.length && + Ta.forEach(i, function (t) { + e(t, n + 1); + }), + (o[t] = n); + })(t, 1); + }), + o), + s = Ta.max(Ta.values(a)) - 1, + h = 2 * s + 1, + c = + ((e.graph().nestingRoot = i), + Ta.forEach(e.edges(), function (t) { + e.edge(t).minlen *= h; + }), + (n = e), + Ta.reduce( + n.edges(), + function (t, e) { + return t + n.edge(e).weight; + }, + 0, + ) + 1); + Ta.forEach(e.children(), function (t) { + !(function r(o, a, s, h, c, u, l) { + var d, + f, + t, + e = o.children(l); + return e.length + ? ((d = Xa.addBorderNode(o, '_bt')), + (f = Xa.addBorderNode(o, '_bb')), + (t = o.node(l)), + o.setParent(d, l), + (t.borderTop = d), + o.setParent(f, l), + (t.borderBottom = f), + Ta.forEach(e, function (t) { + r(o, a, s, h, c, u, t); + var e = o.node(t), + n = e.borderTop || t, + t = e.borderBottom || t, + e = e.borderTop ? h : 2 * h, + i = n !== t ? 1 : c - u[l] + 1; + o.setEdge(d, n, { weight: e, minlen: i, nestingEdge: !0 }), + o.setEdge(t, f, { weight: e, minlen: i, nestingEdge: !0 }); + }), + void (o.parent(l) || o.setEdge(a, d, { weight: 0, minlen: c + u[l] }))) + : (l !== a && o.setEdge(a, l, { weight: 0, minlen: s }), 0); + })(e, i, h, c, s, a, t); + }), + (e.graph().nodeRankFactor = h); + }, + cleanup: function (e) { + var t = e.graph(); + e.removeNode(t.nestingRoot), + delete t.nestingRoot, + Ta.forEach(e.edges(), function (t) { + e.edge(t).nestingEdge && e.removeEdge(t); + }); + }, + }, + bs = function (a) { + Ta.forEach(a.children(), function t(e) { + var n = a.children(e), + i = a.node(e); + if ((n.length && Ta.forEach(n, t), Ta.has(i, 'minRank'))) { + (i.borderLeft = []), (i.borderRight = []); + for (var r = i.minRank, o = i.maxRank + 1; r < o; ++r) + ks(a, 'borderLeft', '_bl', e, i, r), ks(a, 'borderRight', '_br', e, i, r); + } + }); + }; +function ks(t, e, n, i, r, o) { + var a = r[e][o - 1], + n = Xa.addDummyNode(t, 'border', { width: 0, height: 0, rank: o, borderType: e }, n); + (r[e][o] = n), t.setParent(n, i), a && t.setEdge(a, n, { weight: 1 }); +} +var Ms = { + adjust: function (t) { + var e = t.graph().rankdir.toLowerCase(); + ('lr' !== e && 'rl' !== e) || Es(t); + }, + undo: function (t) { + var e, + n, + i = t.graph().rankdir.toLowerCase(); + ('bt' !== i && 'rl' !== i) || + ((e = t), + Ta.forEach(e.nodes(), function (t) { + Ns(e.node(t)); + }), + Ta.forEach(e.edges(), function (t) { + t = e.edge(t); + Ta.forEach(t.points, Ns), Ta.has(t, 'y') && Ns(t); + })), + ('lr' !== i && 'rl' !== i) || + ((n = t), + Ta.forEach(n.nodes(), function (t) { + _s(n.node(t)); + }), + Ta.forEach(n.edges(), function (t) { + t = n.edge(t); + Ta.forEach(t.points, _s), Ta.has(t, 'x') && _s(t); + }), + Es(t)); + }, +}; +function Es(e) { + Ta.forEach(e.nodes(), function (t) { + Cs(e.node(t)); + }), + Ta.forEach(e.edges(), function (t) { + Cs(e.edge(t)); + }); +} +function Cs(t) { + var e = t.width; + (t.width = t.height), (t.height = e); +} +function Ns(t) { + t.y = -t.y; +} +function _s(t) { + var e = t.x; + (t.x = t.y), (t.y = e); +} +var Ls = function (i) { + var r = {}, + t = Ta.filter(i.nodes(), function (t) { + return !i.children(t).length; + }), + e = Ta.max( + Ta.map(t, function (t) { + return i.node(t).rank; + }), + ), + o = Ta.map(Ta.range(e + 1), function () { + return []; + }); + e = Ta.sortBy(t, function (t) { + return i.node(t).rank; + }); + return ( + Ta.forEach(e, function t(e) { + var n; + Ta.has(r, e) || ((r[e] = !0), (n = i.node(e)), o[n.rank].push(e), Ta.forEach(i.successors(e), t)); + }), + o + ); + }, + Ss = function (t, e) { + for (var n = 0, i = 1; i < e.length; ++i) n += Ts(t, e[i - 1], e[i]); + return n; + }; +function Ts(e, t, n) { + for ( + var i = Ta.zipObject( + n, + Ta.map(n, function (t, e) { + return e; + }), + ), + t = Ta.flatten( + Ta.map(t, function (t) { + return Ta.sortBy( + Ta.map(e.outEdges(t), function (t) { + return { pos: i[t.w], weight: e.edge(t).weight }; + }), + 'pos', + ); + }), + !0, + ), + r = 1; + r < n.length; + + ) + r <<= 1; + var o = 2 * r - 1, + a = + (--r, + Ta.map(new Array(o), function () { + return 0; + })), + s = 0; + return ( + Ta.forEach( + t.forEach(function (t) { + var e = t.pos + r; + a[e] += t.weight; + for (var n = 0; 0 < e; ) e % 2 && (n += a[e + 1]), (a[(e = (e - 1) >> 1)] += t.weight); + s += t.weight * n; + }), + ), + s + ); +} +var Ps = function (i, t) { + return Ta.map(t, function (t) { + var e = i.inEdges(t); + return e.length + ? { + v: t, + barycenter: + (e = Ta.reduce( + e, + function (t, e) { + var n = i.edge(e), + e = i.node(e.v); + return { sum: t.sum + n.weight * e.order, weight: t.weight + n.weight }; + }, + { sum: 0, weight: 0 }, + )).sum / e.weight, + weight: e.weight, + } + : { v: t }; + }); + }, + As = function (t, e) { + var i = {}, + n = + (Ta.forEach(t, function (t, e) { + e = i[t.v] = { indegree: 0, in: [], out: [], vs: [t.v], i: e }; + Ta.isUndefined(t.barycenter) || ((e.barycenter = t.barycenter), (e.weight = t.weight)); + }), + Ta.forEach(e.edges(), function (t) { + var e = i[t.v], + n = i[t.w]; + Ta.isUndefined(e) || Ta.isUndefined(n) || (n.indegree++, e.out.push(i[t.w])); + }), + Ta.filter(i, function (t) { + return !t.indegree; + })), + r = []; + function o(r) { + return function (t) { + var e, n, i; + t.merged || + ((Ta.isUndefined(t.barycenter) || Ta.isUndefined(r.barycenter) || t.barycenter >= r.barycenter) && + ((t = t), + (i = n = 0), + (e = r).weight && ((n += e.barycenter * e.weight), (i += e.weight)), + t.weight && ((n += t.barycenter * t.weight), (i += t.weight)), + (e.vs = t.vs.concat(e.vs)), + (e.barycenter = n / i), + (e.weight = i), + (e.i = Math.min(t.i, e.i)), + (t.merged = !0))); + }; + } + for (; n.length; ) { + var a = n.pop(); + r.push(a), + Ta.forEach(a.in.reverse(), o(a)), + Ta.forEach( + a.out, + (function (e) { + return function (t) { + t.in.push(e), 0 == --t.indegree && n.push(t); + }; + })(a), + ); + } + return Ta.map( + Ta.filter(r, function (t) { + return !t.merged; + }), + function (t) { + return Ta.pick(t, ['vs', 'i', 'barycenter', 'weight']); + }, + ); + }, + Os = function (t, e) { + var n, + t = Xa.partition(t, function (t) { + return Ta.has(t, 'barycenter'); + }), + i = t.lhs, + r = Ta.sortBy(t.rhs, function (t) { + return -t.i; + }), + o = [], + a = 0, + s = 0, + h = 0, + t = + (i.sort( + ((n = !!e), + function (t, e) { + return t.barycenter < e.barycenter ? -1 : t.barycenter > e.barycenter ? 1 : n ? e.i - t.i : t.i - e.i; + }), + ), + (h = Is(o, r, h)), + Ta.forEach(i, function (t) { + (h += t.vs.length), o.push(t.vs), (a += t.barycenter * t.weight), (s += t.weight), (h = Is(o, r, h)); + }), + { vs: Ta.flatten(o, !0) }); + return s && ((t.barycenter = a / s), (t.weight = s)), t; + }; +function Is(t, e, n) { + for (var i; e.length && (i = Ta.last(e)).i <= n; ) e.pop(), t.push(i.vs), n++; + return n; +} +var Ds = function n(i, t, r, o) { + var e, + a, + s = i.children(t), + t = i.node(t), + h = t ? t.borderLeft : void 0, + c = t ? t.borderRight : void 0, + u = {}, + t = + (h && + (s = Ta.filter(s, function (t) { + return t !== h && t !== c; + })), + Ps(i, s)), + s = + (Ta.forEach(t, function (t) { + var e; + i.children(t.v).length && + ((e = n(i, t.v, r, o)), (u[t.v] = e), Ta.has(e, 'barycenter')) && + ((e = e), + Ta.isUndefined((t = t).barycenter) + ? ((t.barycenter = e.barycenter), (t.weight = e.weight)) + : ((t.barycenter = (t.barycenter * t.weight + e.barycenter * e.weight) / (t.weight + e.weight)), + (t.weight += e.weight))); + }), + As(t, r)), + t = + ((e = u), + Ta.forEach(s, function (t) { + t.vs = Ta.flatten( + t.vs.map(function (t) { + return e[t] ? e[t].vs : t; + }), + !0, + ); + }), + Os(s, o)); + return ( + h && + ((t.vs = Ta.flatten([h, t.vs, c], !0)), i.predecessors(h).length) && + ((s = i.node(i.predecessors(h)[0])), + (a = i.node(i.predecessors(c)[0])), + Ta.has(t, 'barycenter') || ((t.barycenter = 0), (t.weight = 0)), + (t.barycenter = (t.barycenter * t.weight + s.order + a.order) / (t.weight + 2)), + (t.weight += 2)), + t + ); + }, + Bs = Mo.Graph, + Rs = function (r, n, o) { + var a = (function (t) { + for (var e; t.hasNode((e = Ta.uniqueId('_root'))); ); + return e; + })(r), + s = new Bs({ compound: !0 }).setGraph({ root: a }).setDefaultNodeLabel(function (t) { + return r.node(t); + }); + return ( + Ta.forEach(r.nodes(), function (i) { + var t = r.node(i), + e = r.parent(i); + (t.rank === n || (t.minRank <= n && n <= t.maxRank)) && + (s.setNode(i), + s.setParent(i, e || a), + Ta.forEach(r[o](i), function (t) { + var e = t.v === i ? t.w : t.v, + n = s.edge(e, i), + n = Ta.isUndefined(n) ? 0 : n.weight; + s.setEdge(e, i, { weight: r.edge(t).weight + n }); + }), + Ta.has(t, 'minRank')) && + s.setNode(i, { borderLeft: t.borderLeft[n], borderRight: t.borderRight[n] }); + }), + s + ); + }, + zs = function (r, o, t) { + var a, + s = {}; + Ta.forEach(t, function (t) { + for (var e, n, i = r.parent(t); i; ) { + if (((e = r.parent(i)) ? ((n = s[e]), (s[e] = i)) : ((n = a), (a = i)), n && n !== i)) + return void o.setEdge(n, i); + i = e; + } + }); + }, + Vs = Mo.Graph, + js = function (t) { + var e = Xa.maxRank(t), + n = Fs(t, Ta.range(1, e + 1), 'inEdges'), + i = Fs(t, Ta.range(e - 1, -1, -1), 'outEdges'); + Us(t, Ls(t)); + for (var r, o = Number.POSITIVE_INFINITY, a = 0, s = 0; s < 4; ++a, ++s) { + Xs(a % 2 ? n : i, 2 <= a % 4); + var h = Xa.buildLayerMatrix(t), + c = Ss(t, h); + c < o && ((s = 0), (r = Ta.cloneDeep(h)), (o = c)); + } + Us(t, r); + }; +function Fs(e, t, n) { + return Ta.map(t, function (t) { + return Rs(e, t, n); + }); +} +function Xs(t, e) { + var i = new Vs(); + Ta.forEach(t, function (n) { + var t = n.graph().root, + t = Ds(n, t, i, e); + Ta.forEach(t.vs, function (t, e) { + n.node(t).order = e; + }), + zs(n, i, t.vs); + }); +} +function Us(n, t) { + Ta.forEach(t, function (t) { + Ta.forEach(t, function (t, e) { + n.node(t).order = e; + }); + }); +} +var Ws = Mo.Graph, + Ys = function (i) { + var r, + t = Xa.buildLayerMatrix(i), + o = Ta.merge(Gs(i, t), qs(i, t)), + a = {}, + e = + (Ta.forEach(['u', 'd'], function (n) { + (r = 'u' === n ? t : Ta.values(t).reverse()), + Ta.forEach(['l', 'r'], function (t) { + 'r' === t && + (r = Ta.map(r, function (t) { + return Ta.values(t).reverse(); + })); + var e = ('u' === n ? i.predecessors : i.successors).bind(i), + e = Js(i, r, o, e), + e = Ks(i, r, e.root, e.align, 'r' === t); + 'r' === t && + (e = Ta.mapValues(e, function (t) { + return -t; + })), + (a[n + t] = e); + }); + }), + Zs(i, a)); + return $s(a, e), th(a, i.graph().align); + }; +function Gs(c, t) { + var u = {}; + return ( + Ta.reduce(t, function (t, i) { + var o = 0, + a = 0, + s = t.length, + h = Ta.last(i); + return ( + Ta.forEach(i, function (t, e) { + var n = (function (e, t) { + if (e.node(t).dummy) + return Ta.find(e.predecessors(t), function (t) { + return e.node(t).dummy; + }); + })(c, t), + r = n ? c.node(n).order : s; + (!n && t !== h) || + (Ta.forEach(i.slice(a, e + 1), function (i) { + Ta.forEach(c.predecessors(i), function (t) { + var e = c.node(t), + n = e.order; + !(n < o || r < n) || (e.dummy && c.node(i).dummy) || Hs(u, t, i); + }); + }), + (a = e + 1), + (o = r)); + }), + i + ); + }), + u + ); +} +function qs(s, t) { + var a = {}; + function h(e, t, n, i, r) { + var o; + Ta.forEach(Ta.range(t, n), function (t) { + (o = e[t]), + s.node(o).dummy && + Ta.forEach(s.predecessors(o), function (t) { + var e = s.node(t); + e.dummy && (e.order < i || e.order > r) && Hs(a, t, o); + }); + }); + } + return ( + Ta.reduce(t, function (n, i) { + var r, + o = -1, + a = 0; + return ( + Ta.forEach(i, function (t, e) { + 'border' === s.node(t).dummy && + (t = s.predecessors(t)).length && + ((r = s.node(t[0]).order), h(i, a, e, o, r), (a = e), (o = r)), + h(i, a, i.length, r, n.length); + }), + i + ); + }), + a + ); +} +function Hs(t, e, n) { + n < e && ((i = e), (e = n), (n = i)); + var i = t[e]; + i || (t[e] = i = {}), (i[n] = !0); +} +function Qs(t, e, n) { + var i; + return n < e && ((i = e), (e = n), (n = i)), Ta.has(t[e], n); +} +function Js(t, e, s, h) { + var c = {}, + u = {}, + l = {}; + return ( + Ta.forEach(e, function (t) { + Ta.forEach(t, function (t, e) { + l[(u[(c[t] = t)] = t)] = e; + }); + }), + Ta.forEach(e, function (t) { + var a = -1; + Ta.forEach(t, function (t) { + var e = h(t); + if (e.length) + for ( + var n = + ((e = Ta.sortBy(e, function (t) { + return l[t]; + })).length - + 1) / + 2, + i = Math.floor(n), + r = Math.ceil(n); + i <= r; + ++i + ) { + var o = e[i]; + u[t] === t && a < l[o] && !Qs(s, t, o) && ((u[o] = t), (u[t] = c[t] = c[o]), (a = l[o])); + } + }); + }), + { root: c, align: u } + ); +} +function Ks(i, t, e, n, r) { + var o, + a, + s, + h, + c, + u, + l, + d, + f, + g = {}, + p = + ((o = i), + (t = t), + (a = e), + (s = r), + (l = new Ws()), + (d = o.graph()), + (h = d.nodesep), + (c = d.edgesep), + (u = s), + (f = function (t, e, n) { + var i, + r = t.node(e), + o = t.node(n), + e = 0; + if (((e += r.width / 2), Ta.has(r, 'labelpos'))) + switch (r.labelpos.toLowerCase()) { + case 'l': + i = -r.width / 2; + break; + case 'r': + i = r.width / 2; + } + if ( + (i && (e += u ? i : -i), + (i = 0), + (e = (e = (e += (r.dummy ? c : h) / 2) + (o.dummy ? c : h) / 2) + o.width / 2), + Ta.has(o, 'labelpos')) + ) + switch (o.labelpos.toLowerCase()) { + case 'l': + i = o.width / 2; + break; + case 'r': + i = -o.width / 2; + } + return i && (e += u ? i : -i), (i = 0), e; + }), + Ta.forEach(t, function (t) { + var r; + Ta.forEach(t, function (t) { + var e, + n, + i = a[t]; + l.setNode(i), r && ((e = a[r]), (n = l.edge(e, i)), l.setEdge(e, i, Math.max(f(o, t, r), n || 0))), (r = t); + }); + }), + l), + y = r ? 'borderLeft' : 'borderRight'; + function v(t, e) { + for (var n = p.nodes(), i = n.pop(), r = {}; i; ) + r[i] ? t(i) : ((r[i] = !0), n.push(i), (n = n.concat(e(i)))), (i = n.pop()); + } + return ( + v(function (t) { + g[t] = p.inEdges(t).reduce(function (t, e) { + return Math.max(t, g[e.v] + p.edge(e)); + }, 0); + }, p.predecessors.bind(p)), + v(function (t) { + var e = p.outEdges(t).reduce(function (t, e) { + return Math.min(t, g[e.w] - p.edge(e)); + }, Number.POSITIVE_INFINITY), + n = i.node(t); + e !== Number.POSITIVE_INFINITY && n.borderType !== y && (g[t] = Math.max(g[t], e)); + }, p.successors.bind(p)), + Ta.forEach(n, function (t) { + g[t] = g[e[t]]; + }), + g + ); +} +function Zs(r, t) { + return Ta.minBy(Ta.values(t), function (t) { + var n = Number.NEGATIVE_INFINITY, + i = Number.POSITIVE_INFINITY; + return ( + Ta.forIn(t, function (t, e) { + e = r.node(e).width / 2; + (n = Math.max(t + e, n)), (i = Math.min(t - e, i)); + }), + n - i + ); + }); +} +function $s(a, s) { + var t = Ta.values(s), + h = Ta.min(t), + c = Ta.max(t); + Ta.forEach(['u', 'd'], function (o) { + Ta.forEach(['l', 'r'], function (t) { + var e, + n, + i = o + t, + r = a[i]; + r !== s && + ((n = Ta.values(r)), (e = 'l' === t ? h - Ta.min(n) : c - Ta.max(n))) && + (a[i] = Ta.mapValues(r, function (t) { + return t + e; + })); + }); + }); +} +function th(n, i) { + return Ta.mapValues(n.ul, function (t, e) { + return i ? n[i.toLowerCase()][e] : ((e = Ta.sortBy(Ta.map(n, e)))[1] + e[2]) / 2; + }); +} +var eh = Ys, + nh = function (n) { + var i, t, r, o; + (i = n = Xa.asNonCompoundGraph(n)), + (t = Xa.buildLayerMatrix(i)), + (r = i.graph().ranksep), + (o = 0), + Ta.forEach(t, function (t) { + var e = Ta.max( + Ta.map(t, function (t) { + return i.node(t).height; + }), + ); + Ta.forEach(t, function (t) { + i.node(t).y = o + e / 2; + }), + (o += e + r); + }), + Ta.forEach(eh(n), function (t, e) { + n.node(e).x = t; + }); + }, + ih = Xa.normalizeRanks, + rh = Xa.removeEmptyRanks, + oh = Xa, + ah = Mo.Graph, + sh = function (o, t) { + var n = t && t.debugTiming ? oh.time : oh.notime; + n('layout', function () { + var e = n(' buildLayoutGraph', function () { + return ( + (n = o), + (i = new ah({ multigraph: !0, compound: !0 })), + (t = yh(n.graph())), + i.setGraph(Ta.merge({}, ch, vh(t, hh), Ta.pick(t, uh))), + Ta.forEach(n.nodes(), function (t) { + var e = yh(n.node(t)); + i.setNode(t, Ta.defaults(vh(e, lh), dh)), i.setParent(t, n.parent(t)); + }), + Ta.forEach(n.edges(), function (t) { + var e = yh(n.edge(t)); + i.setEdge(t, Ta.merge({}, gh, vh(e, fh), Ta.pick(e, ph))); + }), + i + ); + var n, i, t; + }); + n(' runLayout', function () { + var c, t; + (c = e), + (t = n)(' makeSpaceForEdgeLabels', function () { + var e, n; + ((n = (e = c).graph()).ranksep /= 2), + Ta.forEach(e.edges(), function (t) { + t = e.edge(t); + (t.minlen *= 2), + 'c' !== t.labelpos.toLowerCase() && + ('TB' === n.rankdir || 'BT' === n.rankdir + ? (t.width += t.labeloffset) + : (t.height += t.labeloffset)); + }); + }), + t(' removeSelfEdges', function () { + var n; + (n = c), + Ta.forEach(n.edges(), function (t) { + var e; + t.v === t.w && + ((e = n.node(t.v)).selfEdges || (e.selfEdges = []), + e.selfEdges.push({ e: t, label: n.edge(t) }), + n.removeEdge(t)); + }); + }), + t(' acyclic', function () { + ja.run(c); + }), + t(' nestingGraph.run', function () { + ws.run(c); + }), + t(' rank', function () { + vs(oh.asNonCompoundGraph(c)); + }), + t(' injectEdgeLabelProxies', function () { + var n; + (n = c), + Ta.forEach(n.edges(), function (t) { + var e = n.edge(t); + e.width && + e.height && + ((e = n.node(t.v)), + (e = { rank: (n.node(t.w).rank - e.rank) / 2 + e.rank, e: t }), + oh.addDummyNode(n, 'edge-proxy', e, '_ep')); + }); + }), + t(' removeEmptyRanks', function () { + rh(c); + }), + t(' nestingGraph.cleanup', function () { + ws.cleanup(c); + }), + t(' normalizeRanks', function () { + ih(c); + }), + t(' assignRankMinMax', function () { + var e, n; + (e = c), + (n = 0), + Ta.forEach(e.nodes(), function (t) { + t = e.node(t); + t.borderTop && + ((t.minRank = e.node(t.borderTop).rank), + (t.maxRank = e.node(t.borderBottom).rank), + (n = Ta.max(n, t.maxRank))); + }), + (e.graph().maxRank = n); + }), + t(' removeEdgeLabelProxies', function () { + var n; + (n = c), + Ta.forEach(n.nodes(), function (t) { + var e = n.node(t); + 'edge-proxy' === e.dummy && ((n.edge(e.e).labelRank = e.rank), n.removeNode(t)); + }); + }), + t(' normalize.run', function () { + Ya.run(c); + }), + t(' parentDummyChains', function () { + xs(c); + }), + t(' addBorderSegments', function () { + bs(c); + }), + t(' order', function () { + js(c); + }), + t(' insertSelfEdges', function () { + var r, t; + (r = c), + (t = oh.buildLayerMatrix(r)), + Ta.forEach(t, function (t) { + var i = 0; + Ta.forEach(t, function (t, e) { + var n = r.node(t); + (n.order = e + i), + Ta.forEach(n.selfEdges, function (t) { + oh.addDummyNode( + r, + 'selfedge', + { + width: t.label.width, + height: t.label.height, + rank: n.rank, + order: e + ++i, + e: t.e, + label: t.label, + }, + '_se', + ); + }), + delete n.selfEdges; + }); + }); + }), + t(' adjustCoordinateSystem', function () { + Ms.adjust(c); + }), + t(' position', function () { + nh(c); + }), + t(' positionSelfEdges', function () { + var a; + (a = c), + Ta.forEach(a.nodes(), function (t) { + var e, + n, + i, + r, + o = a.node(t); + 'selfedge' === o.dummy && + ((e = (r = a.node(o.e.v)).x + r.width / 2), + (n = r.y), + (i = o.x - e), + (r = r.height / 2), + a.setEdge(o.e, o.label), + a.removeNode(t), + (o.label.points = [ + { x: e + (2 * i) / 3, y: n - r }, + { x: e + (5 * i) / 6, y: n - r }, + { x: e + i, y: n }, + { x: e + (5 * i) / 6, y: n + r }, + { x: e + (2 * i) / 3, y: n + r }, + ]), + (o.label.x = o.x), + (o.label.y = o.y)); + }); + }), + t(' removeBorderNodes', function () { + var o; + (o = c), + Ta.forEach(o.nodes(), function (t) { + var e, n, i, r; + o.children(t).length && + ((t = o.node(t)), + (e = o.node(t.borderTop)), + (n = o.node(t.borderBottom)), + (i = o.node(Ta.last(t.borderLeft))), + (r = o.node(Ta.last(t.borderRight))), + (t.width = Math.abs(r.x - i.x)), + (t.height = Math.abs(n.y - e.y)), + (t.x = i.x + t.width / 2), + (t.y = e.y + t.height / 2)); + }), + Ta.forEach(o.nodes(), function (t) { + 'border' === o.node(t).dummy && o.removeNode(t); + }); + }), + t(' normalize.undo', function () { + Ya.undo(c); + }), + t(' fixupEdgeLabelCoords', function () { + var n; + (n = c), + Ta.forEach(n.edges(), function (t) { + var e = n.edge(t); + if (Ta.has(e, 'x')) + switch ((('l' !== e.labelpos && 'r' !== e.labelpos) || (e.width -= e.labeloffset), e.labelpos)) { + case 'l': + e.x -= e.width / 2 + e.labeloffset; + break; + case 'r': + e.x += e.width / 2 + e.labeloffset; + } + }); + }), + t(' undoCoordinateSystem', function () { + Ms.undo(c); + }), + t(' translateGraph', function () { + function e(t) { + var e = t.x, + n = t.y, + i = t.width, + t = t.height; + (r = Math.min(r, e - i / 2)), + (o = Math.max(o, e + i / 2)), + (a = Math.min(a, n - t / 2)), + (s = Math.max(s, n + t / 2)); + } + var n, r, o, a, s, t, i, h; + (n = c), + (r = Number.POSITIVE_INFINITY), + (o = 0), + (a = Number.POSITIVE_INFINITY), + (s = 0), + (t = n.graph()), + (i = t.marginx || 0), + (h = t.marginy || 0), + Ta.forEach(n.nodes(), function (t) { + e(n.node(t)); + }), + Ta.forEach(n.edges(), function (t) { + t = n.edge(t); + Ta.has(t, 'x') && e(t); + }), + (r -= i), + (a -= h), + Ta.forEach(n.nodes(), function (t) { + t = n.node(t); + (t.x -= r), (t.y -= a); + }), + Ta.forEach(n.edges(), function (t) { + t = n.edge(t); + Ta.forEach(t.points, function (t) { + (t.x -= r), (t.y -= a); + }), + Ta.has(t, 'x') && (t.x -= r), + Ta.has(t, 'y') && (t.y -= a); + }), + (t.width = o - r + i), + (t.height = s - a + h); + }), + t(' assignNodeIntersects', function () { + var o; + (o = c), + Ta.forEach(o.edges(), function (t) { + var e, + n = o.edge(t), + i = o.node(t.v), + t = o.node(t.w), + r = n.points ? ((e = n.points[0]), n.points[n.points.length - 1]) : ((n.points = []), (e = t), i); + n.points.unshift(oh.intersectRect(i, e)), n.points.push(oh.intersectRect(t, r)); + }); + }), + t(' reversePoints', function () { + var e; + (e = c), + Ta.forEach(e.edges(), function (t) { + t = e.edge(t); + t.reversed && t.points.reverse(); + }); + }), + t(' acyclic.undo', function () { + ja.undo(c); + }); + }), + n(' updateInputGraph', function () { + var i, r; + (i = o), + (r = e), + Ta.forEach(i.nodes(), function (t) { + var e = i.node(t), + n = r.node(t); + e && ((e.x = n.x), (e.y = n.y), r.children(t).length) && ((e.width = n.width), (e.height = n.height)); + }), + Ta.forEach(i.edges(), function (t) { + var e = i.edge(t), + t = r.edge(t); + (e.points = t.points), Ta.has(t, 'x') && ((e.x = t.x), (e.y = t.y)); + }), + (i.graph().width = r.graph().width), + (i.graph().height = r.graph().height); + }); + }); + }, + hh = ['nodesep', 'edgesep', 'ranksep', 'marginx', 'marginy'], + ch = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: 'tb' }, + uh = ['acyclicer', 'ranker', 'rankdir', 'align'], + lh = ['width', 'height'], + dh = { width: 0, height: 0 }, + fh = ['minlen', 'weight', 'width', 'height', 'labeloffset'], + gh = { minlen: 1, weight: 1, width: 0, height: 0, labeloffset: 10, labelpos: 'r' }, + ph = ['labelpos']; +function vh(t, e) { + return Ta.mapValues(Ta.pick(t, e), Number); +} +function yh(t) { + var n = {}; + return ( + Ta.forEach(t, function (t, e) { + n[e.toLowerCase()] = t; + }), + n + ); +} +var mh = Mo.Graph, + xh = { + debugOrdering: function (e) { + var t = Xa.buildLayerMatrix(e), + n = new mh({ compound: !0, multigraph: !0 }).setGraph({}); + return ( + Ta.forEach(e.nodes(), function (t) { + n.setNode(t, { label: t }), n.setParent(t, 'layer' + e.node(t).rank); + }), + Ta.forEach(e.edges(), function (t) { + n.setEdge(t.v, t.w, {}, t.name); + }), + Ta.forEach(t, function (t, e) { + n.setNode('layer' + e, { rank: 'same' }), + Ta.reduce(t, function (t, e) { + return n.setEdge(t, e, { style: 'invis' }), e; + }); + }), + n + ); + }, + }, + wh = { graphlib: Mo, layout: sh, debug: xh, util: { time: Xa.time, notime: Xa.notime }, version: '0.8.5' }; +function bh(o) { + var n = this, + t = + ((this.initialize = function () { + bh.prototype.initialize.apply(this, arguments), + (this.sceneMode = { normal: 'normal', drag: 'drag', select: 'select' }), + (this.eventBus = new F()), + (this.elementType = 'scene'), + (this.childs = []), + (this.zIndexMap = {}), + (this.zIndexArray = []), + (this.visible = !0), + (this.scale = 1), + (this.scaleRange = [0, 10]), + (this.pickMode = 'node-first'), + (this.mode = this.sceneMode.normal), + (this.translate = !0), + (this.translateX = 0), + (this.translateY = 0), + (this.lastTranslateX = 0), + (this.lastTranslateY = 0), + (this.mouseDown = !1), + (this.mouseDownX = null), + (this.mouseDownY = null), + (this.mouseDownEvent = null), + (this.dragable = !0), + (this.dragging = !1), + (this.areaSelect = !1), + (this.selectBoxType = 'rect'), + (this.operations = []), + (this.selectedElements = []), + (this.polygonPoints = null), + (this.polygonCoords = null), + (this.dragMouseIndex = 0), + (this.displayElements = { nodes: [], links: [], groups: [] }), + (this.serializedProperties = ['translateX', 'translateY', 'lastTranslatedX', 'lastTranslatedY', 'scale']), + (this.setBackground = function (t) { + this.background = t; + }), + (this.addTo = function (t) { + this.stage !== t && null != t && (this.stage = t); + }); + }), + this.initialize(), + null != o && (o.add(this), this.addTo(o)), + (this.show = function () { + this.visible = !0; + }), + (this.hide = function () { + this.visible = !1; + }), + (this.paint = function (t, e) { + var n; + t.save(), + 1 != this.scale && t.scale(this.scale, this.scale), + this.translate && ((n = this.getOffsetTranslate(t)), t.translate(n.translateX, n.translateY)), + e ? this.paintAllChilds(t) : this.paintChilds(t), + t.restore(), + t.save(), + this.paintOperations(t, this.operations), + t.restore(); + }), + (this.repaint = function (t, e) { + this.painting || ((this.painting = !0), this.visible && this.paint(t, e), (this.painting = !1)); + }), + (this.getDisplayedElements = function () { + var e, + n, + i = this, + t = + ((i.displayElements = { nodes: [], edges: [], groups: [] }), o.wheeling || this.scale < o.showDetailScale), + r = + (o.openDragHideEffect && (t = t || o.dragging), + (i.displayElements.groups = this.zIndexMap[j.Group_zIndex]), + this.getOffsetTranslate()); + return ( + (i.displayElements.nodes = (this.zIndexMap[j.Node_zIndex] || []).filter(function (t) { + return i.nodeInView(t, r); + })), + i.displayElements.nodes.length == (this.zIndexMap[j.Node_zIndex] || []).length + ? t || + (i.displayElements.edges = (this.zIndexMap[j.Link_zIndex] || []).filter(function (t) { + return t.visible; + })) + : t || + ((e = {}), + (n = []), + i.displayElements.nodes.forEach(function (t) { + (t.outLinks || []).forEach(function (t) { + e[t.id] || (t.visible && t.source.visible && t.target.visible && (n.push(t), (e[t.id] = !0))); + }), + (t.inLinks || []).forEach(function (t) { + e[t.id] || (t.visible && t.source.visible && t.target.visible && (n.push(t), (e[t.id] = !0))); + }); + }), + (e = null), + (i.displayElements.edges = n)), + i.displayElements + ); + }), + (this.paintChilds = function (e) { + var n = this, + t = n.getDisplayedElements(), + i = this.scale < this.stage.showDetailScale, + r = this.stage.dragging, + o = this.stage.wheeling, + a = i, + s = (this.stage.openDragHideEffect && (a = r || o || a), []), + h = []; + (t.groups || []).forEach(function (t) { + n.paintElement(e, t); + }), + (e.textAlign = 'center'), + (e.textBaseline = 'middle'), + (t.edges || []).forEach(function (t) { + t.isMouseOver || t.showSelected || t.selected + ? ((t.hideText = !1), h.push(t)) + : ((t.hideText = a), n.paintElement(e, t, i)); + }), + h.forEach(function (t) { + n.paintElement(e, t, i); + }), + (e.textAlign = 'left'), + (e.textBaseline = 'alphabetic'), + (t.nodes || []).forEach(function (t) { + t.isMouseOver || t.showSelected || t.selected + ? ((t.hideText = !1), s.push(t)) + : ((t.hideText = a), n.paintElement(e, t, i)); + }), + s.forEach(function (t) { + n.paintElement(e, t, i); + }); + }), + (this.paintElement = function (t, e, n) { + var i; + e.visible && + 0 < e.alpha && + (t.save(), + e.transformAble && + ((i = e.getCenterLocation()), t.transform(e.scale, 0, 0, e.scale, i.x, i.y), 0 != e.rotate) && + t.rotate((e.rotate * Math.PI) / 180), + e.isMouseOver && e.paintMouseover(t), + e.paint(t, n), + t.restore()); + }), + (this.paintAllChilds = function (t) { + for (var e = Math.PI / 180, n = 0; n < this.zIndexArray.length; n++) { + var i = this.zIndexArray[n], + r = this.zIndexMap[i], + o = r.length; + i == j.Link_zIndex + ? ((t.textAlign = 'center'), (t.textBaseline = 'middle')) + : i == j.Node_zIndex && ((t.textAlign = 'left'), (t.textBaseline = 'alphabetic')); + for (var a = 0; a < o; a++) { + var s, + h = r[a]; + null != h && + h.visible && + (t.save(), + h.transformAble && + ((s = h.getCenterLocation()), t.transform(h.scale, 0, 0, h.scale, s.x, s.y), 0 != h.rotate) && + t.rotate(h.rotate * e), + h.isMouseOver && h.paintMouseover(t), + (h.hideText = !1), + h.paint(t, !1), + t.restore()); + } + } + }), + (this.paintNodes = function (e) { + var t, + n = this.zIndexMap[j.Node_zIndex] || []; + if (0 == n.length) return !1; + e.save(), + this.translate + ? ((t = this.getOffsetTranslate(e)), e.transform(this.scale, 0, 0, this.scale, t.translateX, t.translateY)) + : 1 != this.scale && e.scale(this.scale, this.scale); + var i, + r = Math.PI / 180; + n.forEach(function (t) { + (i = t.getCenterLocation()), + e.save(), + e.transform(t.scale, 0, 0, t.scale, i.x, i.y), + 0 != t.rotate && e.rotate(t.rotate * r), + t.paint(e, !0), + e.restore(); + }), + e.restore(); + }), + (this.getOffsetTranslate = function (t) { + var e = this.stage.width, + n = this.stage.height, + t = (null != t && ((e = t.canvas.width), (n = t.canvas.height)), e / this.scale / 2), + e = n / this.scale / 2; + return { + translateX: this.translateX + (t - t * this.scale), + translateY: this.translateY + (e - e * this.scale), + }; + }), + (this.nodeInView = function (t, e) { + var n; + return ( + !!t.visible && + !( + (n = (t.x + e.translateX) * this.scale) > this.stage.width || + (e = (t.y + e.translateY) * this.scale) > this.stage.height || + n + t.width * this.scale < 0 || + e + t.height * this.scale < 0 + ) + ); + }), + (this.isVisiable = function (t, e) { + return ( + !(null == t || !t.visible) && + ('link' == t.elementType ? !(!t.source.visible || !t.target.visible) : this.nodeInView(t, e)) + ); + }), + (this.paintOperations = function (t, e) { + for (var n = 0; n < e.length; n++) e[n](t); + }), + (this.addOperation = function (t) { + return this.operations.push(t), this; + }), + (this.clearOperations = function () { + return (this.operations = []), this; + }), + (this.getElementByXY = function (t, e) { + var n, + i = null, + r = ['nodes', 'edges', 'groups']; + 'node-first' != this.pickMode && (r = ['edges', 'nodes', 'groups']); + for (var o = 0; o < r.length; o++) + for (var a = (n = this.displayElements[r[o]] || []).length - 1; 0 <= a; a--) { + if ((i = n[a]).visible && i.mouseInteractive && i.isInBound(t, e)) return i; + i = null; + } + return i; + }), + (this.add = function (t) { + this.childs.push(t), + null == this.zIndexMap[t.zIndex] && + ((this.zIndexMap[t.zIndex] = []), + this.zIndexArray.push(t.zIndex), + this.zIndexArray.sort(function (t, e) { + return t - e; + })), + this.zIndexMap['' + t.zIndex].push(t); + }), + (this.remove = function (t) { + this.childs = j.util.removeFromArray(this.childs, t); + var e = this.zIndexMap[t.zIndex]; + e && ((this.zIndexMap[t.zIndex] = j.util.removeFromArray(e, t)), t.removeHandler(this)); + }), + (this.clear = function () { + (this.childs = []), (this.operations = []), (this.zIndexArray = []), (this.zIndexMap = {}); + }), + (this.addToSelected = function (t) { + -1 == this.selectedElements.indexOf(t) && this.selectedElements.push(t); + }), + (this.cancleAllSelected = function () { + for (var t = 0; t < this.selectedElements.length; t++) this.selectedElements[t].unselectedHandler(); + this.selectedElements = []; + }), + (this.notInSelectedNodes = function (t) { + for (var e = 0; e < this.selectedElements.length; e++) if (t === this.selectedElements[e]) return !1; + return !0; + }), + (this.removeFromSelected = function (t) { + for (var e = 0; e < this.selectedElements.length; e++) + if (t === this.selectedElements[e]) { + this.selectedElements.splice(e, 1); + break; + } + }), + (this.toSceneEvent = function (t) { + var e, + t = j.util.clone(t); + return ( + (t.x /= this.scale), + (t.y /= this.scale), + this.translate && ((e = this.getOffsetTranslate()), (t.x -= e.translateX), (t.y -= e.translateY)), + null != t.dx && ((t.dx /= this.scale), (t.dy /= this.scale)), + null != this.currentElement && (t.target = this.currentElement), + (t.scene = this), + t + ); + }), + (this.selectElement = function (t) { + var e = this.getElementByXY(t.x, t.y); + if (null != e) + if (((t.target = e).mousedownHander(t), e.selectedHandler(t), this.notInSelectedNodes(e))) + t.ctrlKey || this.cancleAllSelected(), this.addToSelected(e); + else { + t.ctrlKey && (e.unselectedHandler(), this.removeFromSelected(e)); + for (var n = 0; n < this.selectedElements.length; n++) this.selectedElements[n].selectedHandler(t); + } + else t.ctrlKey || this.cancleAllSelected(); + this.currentElement = e; + }), + (this.mousedownHandler = function (t) { + t = this.toSceneEvent(t); + if ( + ((this.mouseDownX = t.x), + (this.mouseDownY = t.y), + (this.mouseDownEvent = t), + (this.mouseDown = this.mode == this.sceneMode.normal)) + ) + this.selectElement(t), + (null != this.currentElement && 'link' != this.currentElement.elementType) || + !this.translate || + ((this.lastTranslateX = this.translateX), (this.lastTranslateY = this.translateY)); + else { + if (this.mode == this.sceneMode.drag && this.translate) + return (this.lastTranslateX = this.translateX), (this.lastTranslateY = this.translateY); + this.mode == this.sceneMode.select && this.selectElement(t); + } + n.dispatchEvent('mousedown', t); + }), + (this.mouseupHandler = function (t) { + n.clearOperations(); + var e = this.toSceneEvent(t); + null != this.currentElement && ((e.target = n.currentElement), this.currentElement.mouseupHandler(e)), + this.dispatchEvent('mouseup', e), + (this.mouseDown = !1), + this.dragging && (this.dragging = !1), + this.areaSelect && ((this.areaSelect = !1), this.boxSelectEndHandle(t)); + }), + (this.dragElements = function (t) { + if (null != this.currentElement && this.currentElement.dragable) + for (var e = j.util.clone(t), n = 0; n < this.selectedElements.length; n++) { + var i = this.selectedElements[n]; + i.dragable && (e.target = i).mousedragHandler(e); + } + }), + (this.mousedragHandler = function (t) { + t = this.toSceneEvent(t); + this.mode == this.sceneMode.normal + ? null == this.currentElement || 'link' == this.currentElement.elementType + ? this.dragable && + this.translate && + ((this.translateX = this.lastTranslateX + t.dx), (this.translateY = this.lastTranslateY + t.dy)) + : this.dragable && this.dragElements(t) + : this.mode == this.sceneMode.drag + ? this.dragable && + this.translate && + ((this.translateX = this.lastTranslateX + t.dx), (this.translateY = this.lastTranslateY + t.dy)) + : this.mode == this.sceneMode.select && + (null != this.currentElement + ? this.currentElement.dragable && this.dragElements(t) + : ((this.stage.needRepaint = !1), + (this.areaSelect = !0), + 'lasso' == this.selectBoxType + ? this.selectPolygonHandle(t) + : 'circle' == this.selectBoxType + ? this.selectCircleHandle(t) + : this.selectRectHandle(t))), + (this.dragging = !0), + this.dispatchEvent('mousedrag', t); + }), + (this.boxSelectEndHandle = function (t) { + for (var e, n, i, r, o = null, a = ['nodes'], s = [], h = 0; h < a.length; h++) + for (var c = this.displayElements[a[h]] || [], u = c.length, l = 0; l < u; l++) + (o = c[l]), + 2 < this.polygonCoords.length + ? j.util.isInPolygon([o.cx, o.cy], this.polygonCoords) && + (o.selectedHandler(t), this.addToSelected(o), s.push(o)) + : ((r = this.polygonCoords[1][0]), + (e = this.polygonCoords[1][1]), + (n = this.polygonCoords[0][0]), + (i = this.polygonCoords[0][1]), + (r = Math.round(Math.sqrt(r * r + e * e, 2))), + j.util.pointInCircle(o.cx, o.cy, n, i, r) && + (o.selectedHandler(t), this.addToSelected(o), s.push(o))); + (this.boxSelectedNodes = s), + (this.polygonPoints = null), + (this.polygonCoords = null), + (this.dragMouseIndex = 0), + this.stage.repaint(); + }), + (this.selectPolygonHandle = function (t) { + var e = t.offsetLeft, + n = t.offsetTop; + this.dragMouseIndex++, + null == this.polygonPoints + ? ((this.polygonPoints = [[e, n]]), (this.polygonCoords = [[t.x, t.y]])) + : this.dragMouseIndex % 5 == 0 && (this.polygonPoints.push([e, n]), this.polygonCoords.push([t.x, t.y])), + this.stage.paintSelectPolygon(e, n, this.polygonPoints); + }), + (this.selectRectHandle = function (t) { + var e = t.offsetLeft, + n = t.offsetTop, + i = this.mouseDownEvent.offsetLeft, + r = this.mouseDownEvent.offsetTop, + i = i <= e ? i : e, + e = r <= n ? r : n, + r = Math.abs(t.dx) * this.scale, + n = Math.abs(t.dy) * this.scale, + r = + (this.stage.paintSelectRect(i, e, r, n), + (i = (t.x >= this.mouseDownEvent.x ? this.mouseDownEvent : t).x), + (e = (t.y >= this.mouseDownEvent.y ? this.mouseDownEvent : t).y), + i + Math.abs(t.dx)), + n = e + Math.abs(t.dy); + this.polygonCoords = [ + [i, e], + [r, e], + [r, n], + [i, n], + ]; + }), + (this.selectCircleHandle = function (t) { + var e = t.offsetLeft, + n = t.offsetTop, + i = this.mouseDownEvent.offsetLeft, + r = this.mouseDownEvent.offsetTop, + i = i <= e ? i : e, + e = r <= n ? r : n, + r = Math.abs(t.dx) * this.scale, + n = Math.abs(t.dy) * this.scale; + this.stage.paintSelectCircle(i, e, r, n), + (i = (t.x >= this.mouseDownEvent.x ? this.mouseDownEvent : t).x), + (e = (t.y >= this.mouseDownEvent.y ? this.mouseDownEvent : t).y), + (this.polygonCoords = [ + [i, e], + [r, n], + ]); + }), + (this.mousemoveHandler = function (t) { + var t = n.toSceneEvent(t), + e = n.getElementByXY(t.x, t.y); + null != e + ? (n.mouseOverelement && n.mouseOverelement !== e && ((t.target = e), n.mouseOverelement.mouseoutHandler(t)), + (n.mouseOverelement = e).isMouseOver + ? (t.target = e) + : ((t.target = e).mouseoverHandler(t), n.dispatchEvent('mouseover', t))) + : n.mouseOverelement + ? ((t.target = e), + n.mouseOverelement.mouseoutHandler(t), + (n.mouseOverelement = null), + n.dispatchEvent('mouseout', t)) + : ((t.target = null), n.dispatchEvent('mousemove', t)); + }), + (this.mouseoverHandler = function (t) { + t = this.toSceneEvent(t); + this.dispatchEvent('mouseover', t); + }), + (this.mouseoutHandler = function (t) { + t = this.toSceneEvent(t); + this.dispatchEvent('mouseout', t); + }), + (this.mousewheelHandler = function (t) { + this.dispatchEvent('mousewheel'); + }), + (this.clickHandler = function (t) { + t = this.toSceneEvent(t); + this.currentElement && ((t.target = this.currentElement), this.currentElement.clickHandler(t)), + this.dispatchEvent('click', t); + }), + (this.dbclickHandler = function (t) { + t = this.toSceneEvent(t); + this.currentElement + ? ((t.target = this.currentElement), this.currentElement.dbclickHandler(t)) + : this.cancleAllSelected(), + this.dispatchEvent('dbclick', t); + }), + (this.keydownHandler = function (t) { + this.dispatchEvent('keydown', t); + }), + (this.keyupHandler = function (t) { + this.dispatchEvent('keyup', t); + }), + (this.addEventListener = function (t, e) { + var n = this; + return ( + this.eventBus.subscribe(t, function (t) { + e.call(n, t); + }), + this + ); + }), + (this.removeEventListener = function (t) { + this.eventBus.unsubscribe(t); + }), + (this.removeAllEventListener = function () { + this.eventBus = new F(); + }), + (this.dispatchEvent = function (t, e) { + return this.eventBus.publish(t, e), this; + }), + 'click,dbclick,mousedown,mouseup,mouseover,mouseout,mousemove,mousedrag,mousewheel,keydown,keyup'.split(',')), + n = this; + return ( + t.forEach(function (e) { + n[e] = function (t) { + null != t ? this.addEventListener(e, t) : this.dispatchEvent(e); + }; + }), + (this.zoom = function (t) { + null != t && + 0 != t && + (t >= this.scaleRange[1] + ? (this.scale = this.scaleRange[1]) + : t <= this.scaleRange[0] + ? (this.scale = this.scaleRange[0]) + : (this.scale = t)); + }), + (this.zoomOut = function (t) { + this.scale <= this.scaleRange[1] && + 0 != t && + (t = this.scale / (t = null == t ? 0.8 : t)) < this.scaleRange[1] && + (this.scale = t); + }), + (this.zoomIn = function (t) { + this.scale >= this.scaleRange[0] && + 0 != t && + (t = this.scale * (t = null == t ? 0.8 : t)) >= this.scaleRange[0] && + (this.scale = t); + }), + (this.getBound = function () { + return { + left: 0, + top: 0, + right: this.stage.width, + bottom: this.stage.height, + width: this.stage.width, + height: this.stage.height, + }; + }), + (this.getElementsBound = function () { + return 0 == this.childs.length ? null : this.getBoundWithElemets(); + }), + (this.getBoundWithElemets = function () { + for ( + var t, + e, + n = { + left: Number.MAX_VALUE, + right: -Number.MAX_VALUE, + top: Number.MAX_VALUE, + bottom: -Number.MAX_VALUE, + width: 0, + height: 0, + }, + i = this.zIndexMap[j.Node_zIndex] || [], + r = i.length, + o = 0; + o < r; + o++ + ) + (t = i[o]), + n.left > t.x && ((n.left = t.x), (n.leftNode = t)), + (e = t.x + t.width), + n.right < e && ((n.right = e), (n.rightNode = t)), + n.top > t.y && ((n.top = t.y), (n.topNode = t)), + (e = t.y + t.height), + n.bottom < e && ((n.bottom = e), (n.bottomNode = t)); + n.leftNode && n.leftNode.parentContainer && (n.left = n.left - n.leftNode.parentContainer.padding), + n.rightNode && n.rightNode.parentContainer && (n.right = n.right + n.rightNode.parentContainer.padding), + n.bottomNode && n.bottomNode.parentContainer && (n.bottom = n.bottom + n.bottomNode.parentContainer.padding), + n.topNode && + n.topNode.parentContainer && + (n.top = n.top - n.topNode.parentContainer.padding - n.topNode.parentContainer.headerHeight), + (n.width = Math.round(n.right - n.left)), + (n.height = Math.round(n.bottom - n.top)); + var a = this.zIndexMap[j.Group_zIndex]; + return ( + a && + (a + .filter(function (t) { + return 'rect' == t.shape; + }) + .forEach(function (t) { + n.left > t.x && ((n.left = t.x), (n.leftNode = t)), + n.right < t.x + t.width && ((n.right = t.x + t.width), (n.rightNode = t)), + n.top > t.y && ((n.top = t.y), (n.topNode = t)), + n.bottom < t.y + t.height && ((n.bottom = t.y + t.height), (n.bottomNode = t)); + }), + (n.width = Math.round(n.right - n.left)), + (n.height = Math.round(n.bottom - n.top))), + n + ); + }), + (this.translateToCenter = function (t) { + var e, + n, + i = this.getElementsBound(); + null != i && + ((n = e = 0), + (n = t + ? ((e = t.canvas.width / 2 - (i.left + i.right) / 2), t.canvas.height / 2 - (i.top + i.bottom) / 2) + : ((e = this.stage.width / 2 - (i.left + i.right) / 2), this.stage.height / 2 - (i.top + i.bottom) / 2)), + (this.translateX = e), + (this.translateY = n)); + }), + (this.setCenter = function (t, e) { + (t -= this.stage.width / 2), (e -= this.stage.height / 2); + (this.translateX = -t), (this.translateY = -e); + }), + (this.centerAndZoom = function (t, e) { + var n, i, r, o; + this.translateToCenter(e), + null == t + ? null != (i = this.getElementsBound()) && + ((n = i.width + 60), + (i = i.height + 60), + (o = r = 1), + (o = e + ? ((r = e.canvas.width / n), e.canvas.height / i) + : ((r = this.stage.width / n), this.stage.height / i)), + (e = Math.min(r, o)), + this.zoom((e = 1 < e ? 1 : e))) + : this.zoom(t); + }), + (this.getCenterLocation = function () { + return { x: this.stage.width / 2, y: this.stage.height / 2 }; + }), + n + ); +} +function kh(t, e) { + return t[0] - e[0] || t[1] - e[1]; +} +function Mh(t, e, n) { + return (e[0] - t[0]) * (n[1] - t[1]) - (e[1] - t[1]) * (n[0] - t[0]); +} +function Eh(t) { + for (var e = t.length, n = [0, 1], i = 2, r = 2; r < e; ++r) { + for (; 1 < i && Mh(t[n[i - 2]], t[n[i - 1]], t[r]) <= 0; ) --i; + n[i++] = r; + } + return n.slice(0, i); +} +wh.graphlib, wh.layout, wh.debug, wh.util, wh.version, (bh.prototype = new W()); +var Ch = function (t) { + if ((e = t.length) < 3) return null; + for (var e, n = new Array(e), i = new Array(e), r = 0; r < e; ++r) n[r] = [+t[r][0], +t[r][1], r]; + for (n.sort(kh), r = 0; r < e; ++r) i[r] = [n[r][0], -n[r][1]]; + var o = Eh(n), + a = Eh(i), + s = a[0] === o[0], + h = a[a.length - 1] === o[o.length - 1], + c = []; + for (r = o.length - 1; 0 <= r; --r) c.push(t[n[o[r]][2]]); + for (r = +s; r < a.length - h; ++r) c.push(t[n[a[r]][2]]); + return c; + }, + Nh = function (t) { + if (2 == t.length) return [(t[0][0] + t[1][0]) / 2, (t[0][1] + t[1][1]) / 2]; + if (3 == t.length) return [(t[0][0] + t[1][0] + t[2][0]) / 3, (t[0][1] + t[1][1] + t[2][1]) / 3]; + for (var e, n, i = -1, r = t.length, o = 0, a = 0, s = t[r - 1], h = 0; ++i < r; ) + (e = s), (s = t[i]), (h += n = e[0] * s[1] - s[0] * e[1]), (o += (e[0] + s[0]) * n), (a += (e[1] + s[1]) * n); + return [o / (h *= 3), a / h]; + }, + _h = function (t, e) { + for (var n, i, r = t.length, o = t[r - 1], a = e[0], s = e[1], h = o[0], c = o[1], u = !1, l = 0; l < r; ++l) + (n = (o = t[l])[0]), + (i = o[1]) > s != s < c && a < ((h - n) * (s - i)) / (c - i) + n && (u = !u), + (h = n), + (c = i); + return u; + }, + Lh = function (t, e) { + var n = e[0] - t[0], + e = e[1] - t[1]; + return Math.sqrt(n * n + e * e); + }, + Sh = function h() { + function E(t) { + var h = this, + r = 0, + o = 0, + a = 0, + s = 0, + e = 0; + (this.rect = function (t) { + if (!arguments.length) return { x: r, y: o, width: a, height: s }; + (r = +t.x), (o = +t.y), (a = +t.width), (s = +t.height); + }), + (this.minX = function () { + return r; + }), + (this.minY = function () { + return o; + }), + (this.maxX = function () { + return r + a; + }), + (this.maxY = function () { + return o + s; + }), + (this.centerX = function () { + return r + 0.5 * a; + }), + (this.centerY = function () { + return o + 0.5 * s; + }), + (this.width = function () { + return a; + }), + (this.height = function () { + return s; + }), + (this.centroidDistance = function (t) { + if (!arguments.length) return e; + e = t; + }), + (this.cmp = function (t) { + return e < t.centroidDistance() ? -1 : (t.centroidDistance(), 0); + }), + (this.add = function (t) { + var e = Math.min(h.minX(), t.minX()), + n = Math.min(h.minY(), t.minY()), + i = Math.max(h.maxX(), t.maxX()), + t = Math.max(h.maxY(), t.maxY()); + (a = i - (r = e)), (s = t - (o = n)); + }), + (this.contains = function (t) { + var e = t.x(), + t = t.y(); + return h.containsPt(e, t); + }), + (this.containsPt = function (t, e) { + return !(t < r || r + a <= t || e < o || o + s <= e); + }), + (this.intersects = function (t) { + return ( + !(h.width() <= 0 || h.height() <= 0 || t.width() <= 0 || t.height() <= 0) && + t.maxX() > h.minX() && + t.maxY() > h.minY() && + t.minX() < h.maxX() && + t.minY() < h.maxY() + ); + }), + (this.intersectsLine = function (t) { + var e, + n, + i, + r = t.x1(), + o = t.y1(), + a = t.x2(), + s = t.y2(); + if (0 !== (n = h.outcode(a, s))) + for (; 0 !== (e = h.outcode(r, o)); ) { + if (0 != (e & n)) return !1; + 0 != (e & (E.OUT_LEFT | E.OUT_RIGHT)) + ? ((i = h.minX()), + 0 != (e & E.OUT_RIGHT) && (i += h.width()), + (o += ((i - r) * (s - o)) / (a - r)), + (r = i)) + : ((i = h.minY()), + 0 != (e & E.OUT_BOTTOM) && (i += h.height()), + (r += ((i - o) * (a - r)) / (s - o)), + (o = i)); + } + return !0; + }), + (this.outcode = function (t, e) { + var n = 0; + return ( + a <= 0 ? (n |= E.OUT_LEFT | E.OUT_RIGHT) : t < r ? (n |= E.OUT_LEFT) : r + a < t && (n |= E.OUT_RIGHT), + s <= 0 ? (n |= E.OUT_TOP | E.OUT_BOTTOM) : e < o ? (n |= E.OUT_TOP) : o + s < e && (n |= E.OUT_BOTTOM), + n + ); + }), + arguments.length && t && this.rect(t); + } + function C(t, e) { + var n = +t, + i = +e; + (this.x = function (t) { + if (!arguments.length) return n; + n = t; + }), + (this.y = function (t) { + if (!arguments.length) return i; + i = t; + }), + (this.distanceSq = function (t) { + return C.ptsDistanceSq(n, i, t.x(), t.y()); + }), + (this.get = function () { + return [n, i]; + }); + } + function T(t) { + var n = 0, + i = [], + r = ((i.length = t), {}); + function o(t) { + return t.x() + 'x' + t.y(); + } + (this.add = function (t) { + (r[o(t)] = t), (i[n] = t), (n += 1); + }), + (this.contains = function (t) { + var e = r[o(t)]; + return !!e && e.x() === t.x() && e.y() === t.y(); + }), + (this.isFirst = function (t) { + var e; + return !!n && (e = i[0]).x() === t.x() && e.y() === t.y(); + }), + (this.list = function () { + return i + .filter(function (t) { + return t; + }) + .map(function (t) { + return t.get(); + }); + }), + (this.clear = function () { + for (var t = 0; t < i.length; t += 1) i[t] = null; + (r = {}), (n = 0); + }), + (this.get = function (t) { + return i[t]; + }), + (this.size = function () { + return n; + }); + } + function N(t, e, n, i) { + var r = +t, + o = +e, + a = +n, + s = +i; + (this.rect = function () { + var t = Math.min(r, a), + e = Math.min(o, s); + return new E({ x: t, y: e, width: Math.max(r, a) - t, height: Math.max(o, s) - e }); + }), + (this.x1 = function (t) { + if (!arguments.length) return r; + r = t; + }), + (this.x2 = function (t) { + if (!arguments.length) return a; + a = t; + }), + (this.y1 = function (t) { + if (!arguments.length) return o; + o = t; + }), + (this.y2 = function (t) { + if (!arguments.length) return s; + s = t; + }), + (this.cuts = function (t) { + var e; + return ( + o !== s && + !( + ((e = t.y()) < o && e <= s) || + (o < e && s <= e) || + ((t = t.x()), r < t && a <= t) || + !((t < r && t <= a) || t <= r + ((e - o) * (a - r)) / (s - o)) + ) + ); + }), + (this.ptSegDistSq = function (t, e) { + return h.linePtSegDistSq(r, o, a, s, t, e); + }), + (this.ptClose = function (t, e, n) { + if (r < a) { + if (t < r - n || a + n < t) return !1; + } else if (t < a - n || r + n < t) return !1; + if (o < s) { + if (e < o - n || s + n < e) return !1; + } else if (e < s - n || o + n < e) return !1; + return !0; + }); + } + function _(i, r) { + var o = new Float32Array(i * r); + (this.bound = function (t, e) { + return t < 0 ? 0 : Math.min(t, (e ? i : r) - 1); + }), + (this.get = function (t, e) { + return t < 0 || i <= t || e < 0 || r <= e ? Number.NaN : o[t + e * i]; + }), + (this.set = function (t, e, n) { + t < 0 || i <= t || e < 0 || r <= e || (o[t + e * i] = n); + }), + (this.width = function () { + return i; + }), + (this.height = function () { + return r; + }); + } + function L(t, e) { + var n = t, + i = e; + (this.getState = function () { + return i; + }), + (this.getPoint = function () { + return n; + }); + } + (E.prototype.toString = function () { + return 'Rectangle[x=' + this.minX() + ', y=' + this.minY() + ', w=' + this.width() + ', h=' + this.height() + ']'; + }), + (E.OUT_LEFT = 1), + (E.OUT_TOP = 2), + (E.OUT_RIGHT = 4), + (E.OUT_BOTTOM = 8), + (C.ptsDistanceSq = function (t, e, n, i) { + return (t - n) * (t - n) + (e - i) * (e - i); + }), + (C.doublePointsEqual = function (t, e, n, i, r) { + return C.ptsDistanceSq(t, e, n, i) < r * r; + }), + (L.POINT = 1), + (L.PARALLEL = 2), + (L.COINCIDENT = 3), + (L.NONE = 4), + (L.intersectLineLine = function (t, e) { + var n, + i = (e.x2() - e.x1()) * (t.y1() - e.y1()) - (e.y2() - e.y1()) * (t.x1() - e.x1()), + r = (t.x2() - t.x1()) * (t.y1() - e.y1()) - (t.y2() - t.y1()) * (t.x1() - e.x1()), + e = (e.y2() - e.y1()) * (t.x2() - t.x1()) - (e.x2() - e.x1()) * (t.y2() - t.y1()); + return e + ? ((n = r / e), + 0 <= (e = i / e) && e <= 1 && 0 <= n && n <= 1 + ? new L(new C(t.x1() + e * (t.x2() - t.x1()), t.y1() + e * (t.y2() - t.y1())), L.POINT) + : new L(null, L.NONE)) + : new L(null, 0 == i || 0 == r ? L.COINCIDENT : L.PARALLEL); + }), + (L.fractionAlongLineA = function (t, e) { + var n = (e.x2() - e.x1()) * (t.y1() - e.y1()) - (e.y2() - e.y1()) * (t.x1() - e.x1()), + i = (t.x2() - t.x1()) * (t.y1() - e.y1()) - (t.y2() - t.y1()) * (t.x1() - e.x1()), + e = (e.y2() - e.y1()) * (t.x2() - t.x1()) - (e.x2() - e.x1()) * (t.y2() - t.y1()); + if (e) { + (t = n / e), (n = i / e); + if (0 <= t && t <= 1 && 0 <= n && n <= 1) return t; + } + return Number.POSITIVE_INFINITY; + }); + var s = new N(0, 0, 0, 0); + function S(o, r, a, t) { + var s = S.S, + h = t, + n = !1; + function i(t, e, n, i) { + t = r.get(t, e); + return isNaN(t) ? t : h < t ? n + i : n; + } + function c(t, e) { + var n = i(t, e, 0, 1); + return ( + (n = i(t + 1, e, n, 2)), + (n = i(t, e + 1, n, 4)), + (n = i(t + 1, e + 1, n, 8)), + isNaN(n) + ? (console.warn('marched out of bounds: ' + t + ' ' + e + ' bounds: ' + r.width() + ' ' + r.height()), -1) + : n + ); + } + this.march = function () { + for (var t = 0; t < r.width() && !n; t += 1) + for (var e = 0; e < r.height() && !n; e += 1) + r.get(t, e) > h && + 15 != c(t, e) && + (n = (function (t, e) { + for (var n = t, i = e; ; ) { + var r = new C(n * a, i * a); + if (o.contains(r)) { + if (o.isFirst(r)) return !0; + } else o.add(r); + switch (c(n, i)) { + case -1: + return !0; + case 0: + case 3: + case 2: + case 7: + s = S.E; + break; + case 12: + case 14: + case 4: + s = S.W; + break; + case 6: + s = s === S.N ? S.W : S.E; + break; + case 1: + case 13: + case 5: + s = S.N; + break; + case 9: + s = s === S.E ? S.N : S.S; + break; + case 10: + case 8: + case 11: + s = S.S; + } + switch (s) { + case S.N: + --i; + break; + case S.S: + i += 1; + break; + case S.W: + --n; + break; + case S.E: + n += 1; + } + } + })(t, e)); + return n; + }; + } + (L.fractionToLineCenter = function (t, r) { + var o = Number.POSITIVE_INFINITY, + a = 0; + function e(t, e, n, i) { + s.x1(t), s.y1(e), s.x2(n), s.y2(i); + t = L.fractionAlongLineA(r, s); + 0 <= (t = Math.abs(t - 0.5)) && t <= 1 && ((a += 1), t < o) && (o = t); + } + return ( + e(t.minX(), t.minY(), t.maxX(), t.minY()), + e(t.minX(), t.minY(), t.minX(), t.maxY()), + !( + 1 < a || + (e(t.minX(), t.maxY(), t.maxX(), t.maxY()), 1 < a) || + (e(t.maxX(), t.minY(), t.maxX(), t.maxY()), 0 !== a) + ) + ? -1 + : o + ); + }), + (L.fractionToLineEnd = function (t, r) { + var o = Number.POSITIVE_INFINITY, + a = 0; + function e(t, e, n, i) { + t = L.fractionAlongLineA(r, new N(t, e, n, i)); + 0 <= t && t <= 1 && ((a += 1), t < o) && (o = t); + } + return ( + e(t.minX(), t.minY(), t.maxX(), t.minY()), + e(t.minX(), t.minY(), t.minX(), t.maxY()), + !( + 1 < a || + (e(t.minX(), t.maxY(), t.maxX(), t.maxY()), 1 < a) || + (e(t.maxX(), t.minY(), t.maxX(), t.maxY()), 0 !== a) + ) + ? -1 + : o + ); + }), + (L.testIntersection = function (o, t, a) { + var s = 0; + function e(t, e, n, i, r) { + (a[t] = L.intersectLineLine(o, new N(e, n, i, r))), a[t].getState() === L.POINT && (s += 1); + } + return ( + e(0, t.minX(), t.minY(), t.maxX(), t.minY()), + e(1, t.minX(), t.minY(), t.minX(), t.maxY()), + e(2, t.minX(), t.maxY(), t.maxX(), t.maxY()), + e(3, t.maxX(), t.minY(), t.maxX(), t.maxY()), + s + ); + }), + (S.N = 0), + (S.S = 1), + (S.E = 2), + (S.W = 3); + var P = h.DEFAULT_MAX_ROUTING_ITERATIONS, + A = h.DEFAULT_MAX_MARCHING_ITERATIONS, + O = h.DEFAULT_PIXEL_GROUP, + n = h.DEFAULT_EDGE_R0, + I = h.DEFAULT_EDGE_R1, + v = h.DEFAULT_NODE_R0, + D = h.DEFAULT_NODE_R1, + B = h.DEFAULT_MORPH_BUFFER, + V = h.DEFAULT_SKIP, + z = + ((this.maxRoutingIterations = function (t) { + if (!arguments.length) return P; + P = t; + }), + (this.maxMarchingIterations = function (t) { + if (!arguments.length) return A; + A = t; + }), + (this.pixelGroup = function (t) { + if (!arguments.length) return O; + O = t; + }), + (this.edgeR0 = function (t) { + if (!arguments.length) return n; + n = t; + }), + (this.edgeR1 = function (t) { + if (!arguments.length) return I; + I = t; + }), + (this.nodeR0 = function (t) { + if (!arguments.length) return v; + v = t; + }), + (this.nodeR1 = function (t) { + if (!arguments.length) return D; + D = t; + }), + (this.morphBuffer = function (t) { + if (!arguments.length) return B; + B = t; + }), + (this.skip = function (t) { + if (!arguments.length) return V; + V = t; + }), + 1), + R = 1, + j = 1, + F = -0.8, + X = null, + U = [], + q = null, + Y = Number.NaN, + W = !(this.createOutline = function (t, e, n) { + if (!t.length) return []; + var i, + r, + o, + a, + s, + h, + c, + u, + l, + d = t.map(function (t) { + return new E(t); + }), + f = e.map(function (t) { + return new E(t); + }), + g = + ((i = f), + (s = []), + (U = []), + (a = o = r = 0), + (e = t = d).forEach(function (t) { + (r += t.centerX()), (o += t.centerY()), (a += 1); + }), + (r /= a), + (o /= a), + e.forEach(function (t) { + var e = r - t.centerX(), + n = o - t.centerY(); + t.centroidDistance(Math.sqrt(e * e + n * n)); + }), + t.sort(function (t, e) { + return t.cmp(e); + }), + t.forEach(function (t) { + (function (r, t, e) { + var n = [], + i = [], + o = new C(t.centerX(), t.centerY()), + a = null, + s = Number.POSITIVE_INFINITY; + if ( + (e.forEach(function (t) { + var n, + e = new C(t.centerX(), t.centerY()), + i = o.distanceSq(e), + e = new N(o.x(), o.y(), e.x(), e.y()), + e = + ((n = e), + r.reduce(function (t, e) { + return e.intersectsLine(n) && 0 <= L.fractionToLineCenter(e, n) ? t + 1 : t; + }, 0)); + i * (e + 1) * (e + 1) < s && ((a = t), (s = i * (e + 1) * (e + 1))); + }), + a) + ) { + var t = new N(o.x(), o.y(), a.centerX(), a.centerY()), + h = (i.push(t), !0), + c = 0, + u = []; + for (u.length = 4; h && c < P; ) + for (h = !1; !h && i.length; ) { + var l = i.pop(); + if ((v = J(r, l)) && 2 === L.testIntersection(l, v, u)) { + for (var d = B, f = K(v, d, u, !0), g = Q(f, i) || Q(f, n), p = H(f, r); !g && p && 1 <= d; ) + (g = Q((f = K(v, (d /= 1.5), u, !0)), i) || Q(f, n)), (p = H(f, r)); + if ( + (!f || + g || + p || + (i.push(new N(l.x1(), l.y1(), f.x(), f.y())), + i.push(new N(f.x(), f.y(), l.x2(), l.y2())), + (h = !0)), + !h) + ) { + for (var y = Q((f = K(v, (d = B), u, !1)), i) || Q(f, n), p = H(f, r); !y && p && 1 <= d; ) + (y = Q((f = K(v, (d /= 1.5), u, !1)), i) || Q(f, n)), (p = H(f, r)); + f && + !y && + (i.push(new N(l.x1(), l.y1(), f.x(), f.y())), + i.push(new N(f.x(), f.y(), l.x2(), l.y2())), + (h = !0)); + } + } + h || n.push(l), (c += 1); + } + for (; i.length; ) n.push(i.pop()); + for (; n.length; ) { + var v, + m, + x, + w = n.pop(); + n.length + ? ((m = n.pop()), + (x = new N(w.x1(), w.y1(), m.x2(), m.y2())), + (v = J(r, x)) ? (i.push(w), n.push(m)) : n.push(x)) + : i.push(w); + } + n = i; + } + return n; + })(i, t, s).forEach(function (t) { + U.push(t); + }), + s.push(t); + }), + n && + n.forEach(function (t) { + U.push(new N(t.x1, t.y1, t.x2, t.y2)); + }), + (X = null), + d.forEach(function (t) { + X ? X.add(t) : (X = new E(t.rect())); + }), + U.forEach(function (t) { + X.add(t.rect()); + }), + X.rect({ + x: X.minX() - Math.max(I, D) - B, + y: X.minY() - Math.max(I, D) - B, + width: X.width() + 2 * Math.max(I, D) + 2 * B, + height: X.height() + 2 * Math.max(I, D) + 2 * B, + }), + (q = new _(Math.ceil(X.width() / O), Math.ceil(X.height() / O))), + new T(2 * (Math.floor(X.width()) + Math.floor(X.height())))), + e = z, + t = F, + n = R, + p = j, + y = 0; + for ( + G(X, d, f, q); + (c = X), + (u = d), + (l = f), + (!new S((h = g), q, O, z).march() || + !(function (t, e, n, i) { + var r = [], + o = null; + function a(t, e) { + var n = null, + i = null, + r = 0; + return ( + t.forEach(function (t) { + n + ? (n.x1(n.x2()), n.y1(n.y2()), n.x2(t.x()), n.y2(t.y()), n.cuts(e) && (r += 1)) + : ((n = new N(t.x(), t.y(), t.x(), t.y())), (i = t)); + }), + i && (n.x1(n.x2()), n.y1(n.y2()), n.x2(i.x()), n.y2(i.y()), n.cuts(e)) && (r += 1), + r % 2 == 1 + ); + } + var s = V, + h = t.size(); + if (1 < s) for (h = t.size() / s; h < 3 && 1 < s; ) s--, (h = t.size() / s); + for (var c = e.minX(), u = e.minY(), l = 0; l < h - 1; l += 1) { + var d = t.get(l * s).x() + c, + f = t.get(l * s).y() + u, + g = { x: d, y: f, width: 0, height: 0 }; + o ? o.add(new E(g)) : (o = new E(g)), r.push(new C(d, f)); + } + var p = !0, + y = !1; + return ( + o && + (n.forEach(function (t) { + t = new C(t.centerX(), t.centerY()); + p = (p = p && o.contains(t)) && a(r, t); + }), + i.forEach(function (t) { + t = new C(t.centerX(), t.centerY()); + o.contains(t) && a(r, t) && (y = !0); + })), + [p, y] + ); + })(h, c, u, l)[0]) && + y < A; + + ) + g.clear(), + (y += 1) <= 0.5 * A && 0 != F && ((z *= 0.95), (F *= 0.8), G(X, d, f, q)), + 0.5 * A < y && ((z *= 0.95), (R *= 1.2), (j *= 1.2), G(X, d, f, q)); + (Y = z), (z = e), (F = t), (R = n), (j = p); + var v = V, + m = g.size(); + if (1 < v) for (m = Math.floor(g.size() / v); m < 3 && 1 < v; ) --v, (m = Math.floor(g.size() / v)); + for (var x = X.minX(), w = X.minY(), b = new T(m), k = 0, M = 0; M < m; M += 1, k += v) + b.add(new C(g.get(k).x() + x, g.get(k).y() + w)); + return W || (q = X = null), b.list(); + }); + function G(d, t, e, f) { + var u, + l, + g, + p, + y = 0; + R && + t.forEach(function (t) { + var e = v - D, + n = f, + i = (y = R) / (e * e), + r = D, + o = t; + i < 0 && console.warn('expected positive influence', i); + for ( + var a = n.bound(Math.floor((o.minX() - r - X.minX()) / O), !0), + e = n.bound(Math.floor((o.minY() - r - X.minY()) / O), !1), + s = n.bound(Math.ceil((o.maxX() + r - X.minX()) / O), !0), + h = n.bound(Math.ceil((o.maxY() + r - X.minY()) / O), !1), + c = e; + c < h; + c += 1 + ) + for (var u = a; u < s; u += 1) { + var l = m(o, u * O + X.minX(), c * O + X.minY()); + l < r * r && ((l = Math.sqrt(l) - r), n.set(u, c, n.get(u, c) + i * l * l)); + } + }), + j && + ((y = j), (t = (n - I) * (n - I)), 0 < U.length) && + ((u = f), + (l = y / t), + (g = I), + (p = d), + U.forEach(function (t) { + for ( + var e, + n, + i = t.rect(), + r = u.bound(Math.floor((i.minX() - g - p.minX()) / O), !0), + o = u.bound(Math.floor((i.minY() - g - p.minY()) / O), !1), + a = u.bound(Math.ceil((i.maxX() + g - p.minX()) / O), !0), + s = u.bound(Math.ceil((i.maxY() + g - p.minY()) / O), !1), + h = o; + h < s; + h += 1 + ) + for (var c = r; c < a; c += 1) + (l < 0 && u.get(c, h) <= 0) || + ((e = c * O + p.minX()), + (n = h * O + p.minY()), + (e = t.ptSegDistSq(e, n)) < g * g && ((n = Math.sqrt(e) - g), u.set(c, h, u.get(c, h) + l * n * n))); + })), + F && + e.forEach(function (t) { + if (d.intersects(t)) { + var e = v - D, + n = f, + i = (y = F) / (e * e), + r = D, + o = t; + 0 < i && console.warn('expected negative influence', i); + for ( + var a, + s = n.bound(Math.floor((o.minX() - r - X.minX()) / O), !0), + e = n.bound(Math.floor((o.minY() - r - X.minY()) / O), !1), + h = n.bound(Math.ceil((o.maxX() + r - X.minX()) / O), !0), + c = n.bound(Math.ceil((o.maxY() + r - X.minY()) / O), !1), + u = e; + u < c; + u += 1 + ) + for (var l = s; l < h; l += 1) + n.get(l, u) <= 0 || + ((a = m(o, l * O + X.minX(), u * O + X.minY())) < r * r && + ((a = Math.sqrt(a) - r), n.set(l, u, n.get(l, u) + i * a * a))); + } + }); + } + function H(e, t) { + return t.some(function (t) { + return t.contains(e); + }); + } + function Q(e, t) { + var n = !1; + return ( + t.forEach(function (t) { + n || + (C.doublePointsEqual(t.x1(), t.y1(), e.x(), e.y(), 0.001) && (n = !0), + C.doublePointsEqual(t.x2(), t.y2(), e.x(), e.y(), 0.001) && (n = !0)); + }), + n + ); + } + function J(t, n) { + var i = Number.POSITIVE_INFINITY, + r = null; + return ( + t.forEach(function (t) { + var e; + t.intersectsLine(n) && 0 <= (e = L.fractionToLineCenter(t, n)) && e < i && ((r = t), (i = e)); + }), + r + ); + } + function m(t, e, n) { + if (!t.containsPt(e, n)) { + var i = t.outcode(e, n); + if ((i & E.OUT_TOP) === E.OUT_TOP) + return (i & E.OUT_LEFT) === E.OUT_LEFT + ? C.ptsDistanceSq(e, n, t.minX(), t.minY()) + : (i & E.OUT_RIGHT) === E.OUT_RIGHT + ? C.ptsDistanceSq(e, n, t.maxX(), t.minY()) + : (t.minY() - n) * (t.minY() - n); + if ((i & E.OUT_BOTTOM) === E.OUT_BOTTOM) + return (i & E.OUT_LEFT) === E.OUT_LEFT + ? C.ptsDistanceSq(e, n, t.minX(), t.maxY()) + : (i & E.OUT_RIGHT) === E.OUT_RIGHT + ? C.ptsDistanceSq(e, n, t.maxX(), t.maxY()) + : (n - t.maxY()) * (n - t.maxY()); + if ((i & E.OUT_LEFT) === E.OUT_LEFT) return (t.minX() - e) * (t.minX() - e); + if ((i & E.OUT_RIGHT) === E.OUT_RIGHT) return (e - t.maxX()) * (e - t.maxX()); + } + return 0; + } + function K(t, e, n, i) { + var r, + o = n[0], + a = n[1], + s = n[2], + n = n[3]; + if (i) { + if (a.getState() === L.POINT) + return o.getState() === L.POINT + ? new C(t.minX() - e, t.minY() - e) + : s.getState() === L.POINT + ? new C(t.minX() - e, t.maxY() + e) + : ((r = t.height() * t.width()), + t.width() * (0.5 * (a.getPoint().y() - t.minY() + (n.getPoint().y() - t.minY()))) < 0.5 * r + ? a.getPoint().y() > n.getPoint().y() + ? new C(t.minX() - e, t.minY() - e) + : new C(t.maxX() + e, t.minY() - e) + : a.getPoint().y() < n.getPoint().y() + ? new C(t.minX() - e, t.maxY() + e) + : new C(t.maxX() + e, t.maxY() + e)); + if (n.getState() === L.POINT) { + if (o.getState() === L.POINT) return new C(t.maxX() + e, t.minY() - e); + if (s.getState() === L.POINT) return new C(t.maxX() + e, t.maxY() + e); + } + return ( + (r = t.height() * t.width()), + t.height() * (0.5 * (o.getPoint().x() - t.minX() + (s.getPoint().x() - t.minX()))) < 0.5 * r + ? o.getPoint().x() > s.getPoint().x() + ? new C(t.minX() - e, t.minY() - e) + : new C(t.minX() - e, t.maxY() + e) + : o.getPoint().x() < s.getPoint().x() + ? new C(t.maxX() + e, t.minY() - e) + : new C(t.maxX() + e, t.maxY() + e) + ); + } + if (a.getState() === L.POINT) + return o.getState() === L.POINT + ? new C(t.maxX() + e, t.maxY() + e) + : s.getState() === L.POINT + ? new C(t.maxX() + e, t.minY() - e) + : ((r = t.height() * t.width()), + t.width() * (0.5 * (a.getPoint().y() - t.minY() + (n.getPoint().y() - t.minY()))) < 0.5 * r + ? a.getPoint().y() > n.getPoint().y() + ? new C(t.maxX() + e, t.maxY() + e) + : new C(t.minX() - e, t.maxY() + e) + : a.getPoint().y() < n.getPoint().y() + ? new C(t.maxX() + e, t.minY() - e) + : new C(t.minX() - e, t.minY() - e)); + if (n.getState() === L.POINT) { + if (o.getState() === L.POINT) return new C(t.minX() - e, t.maxY() + e); + if (s.getState() === L.POINT) return new C(t.minX() - e, t.minY() - e); + } + return ( + (r = t.height() * t.width()), + t.height() * (0.5 * (o.getPoint().x() - t.minX() + (s.getPoint().x() - t.minX()))) < 0.5 * r + ? o.getPoint().x() > s.getPoint().x() + ? new C(t.maxX() + e, t.maxY() + e) + : new C(t.maxX() + e, t.minY() - e) + : o.getPoint().x() < s.getPoint().x() + ? new C(t.minX() - e, t.maxY() + e) + : new C(t.minX() - e, t.minY() - e) + ); + } + (this.debug = function (t) { + if (!arguments.length) return W; + W = !!t; + }), + (this.debugPotentialArea = function () { + W || console.warn('debug mode should be activated'); + for (var t = [], e = 0; e < q.width(); e += 1) + for (var n = 0; n < q.height(); n += 1) + t.push({ + x: e * O + Math.floor(X.minX()), + y: n * O + Math.floor(X.minY()), + width: O, + height: O, + value: q.get(e, n), + threshold: Y, + }); + return t; + }); + }, + Th = + ((Sh.DEFAULT_MAX_ROUTING_ITERATIONS = 100), + (Sh.DEFAULT_MAX_MARCHING_ITERATIONS = 20), + (Sh.DEFAULT_PIXEL_GROUP = 4), + (Sh.DEFAULT_EDGE_R0 = 10), + (Sh.DEFAULT_EDGE_R1 = 20), + (Sh.DEFAULT_NODE_R0 = 15), + (Sh.DEFAULT_NODE_R1 = 50), + (Sh.DEFAULT_MORPH_BUFFER = Sh.DEFAULT_NODE_R0), + (Sh.DEFAULT_SKIP = 8), + (Sh.linePtSegDistSq = function (t, e, n, i, r, o) { + (n -= t), + (i -= e), + (r -= t), + (t = o - e), + (o = r * n + t * i), + (e = o <= 0 || (o = (r = n - r) * n + (t = i - t) * i) <= 0 ? 0 : (o * o) / (n * n + i * i)), + (o = r * r + t * t - e); + return (o = o < 0 ? 0 : o); + }), + (Sh.addPadding = function (t, e) { + return t.map(function (t) { + return { x: t.x - e, y: t.y - e, width: t.width + 2 * e, height: t.height + 2 * e }; + }); + }), + function (t) { + var i = this, + r = [], + e = !0; + (this.closed = function (t) { + if (!arguments.length) return e; + e = t; + }), + (this.addAll = function (t) { + t.forEach(function (t) { + i.add(t); + }); + }), + (this.add = function (t) { + var e = t[0], + t = t[1]; + (Number.isNaN(e) || Number.isNaN(t)) && console.warn('Point with NaN', e, t), r.push([e, t]); + }), + (this.size = function () { + return r.length; + }), + (this.get = function (t) { + var e = i.size(), + n = i.closed(); + return t < 0 ? (n ? i.get(t + e) : i.get(0)) : e <= t ? (n ? i.get(t - e) : i.get(e - 1)) : r[t]; + }), + (this.forEach = function (n) { + r.forEach(function (t, e) { + n(t, e, i); + }); + }), + (this.isEmpty = function () { + return !i.size(); + }), + (this.transform = function (t) { + var e = i; + return ( + t.forEach(function (t) { + e = t.apply(e); + }), + e + ); + }), + (this.toString = function () { + var e = ''; + return ( + this.forEach(function (t) { + e.length ? (e += ' L' + t[0] + ' ' + t[1]) : (e += 'M' + t[0] + ' ' + t[1]); + }), + e.length ? (this.closed() && (e += ' Z'), e) : 'M0 0' + ); + }), + arguments.length && t && i.addAll(t); + }), + Ph = function (t) { + var r = this, + e = 0, + a = 0; + function o(i, t) { + var r = this, + n = t, + o = t + 1; + (this.advanceEnd = function () { + o += 1; + }), + (this.decreaseEnd = function () { + --o; + }), + (this.end = function () { + return o; + }), + (this.validEnd = function () { + return i.closed() ? o < i.size() : o < i.size() - 1; + }), + (this.endPoint = function () { + return i.get(o); + }), + (this.startPoint = function () { + return i.get(n); + }), + (this.lineDstSqr = function (t) { + var t = i.get(t), + e = r.startPoint(), + n = r.endPoint(); + return Sh.linePtSegDistSq(e[0], e[1], n[0], n[1], t[0], t[1]); + }), + (this.canTakeNext = function () { + if (!r.validEnd()) return !1; + var t = !0; + r.advanceEnd(); + for (var e = n + 1; e < o; e += 1) + if (r.lineDstSqr(e) > a) { + t = !1; + break; + } + return r.decreaseEnd(), t; + }); + } + (this.tolerance = function (t) { + if (!arguments.length) return e; + a = (e = t) * e; + }), + (this.isDisabled = function () { + return e < 0; + }), + (this.apply = function (t) { + if (r.isDisabled() || t.size() < 3) return t; + for (var e = [], n = 0; n < t.size(); ) { + for (var i = new o(t, n); i.canTakeNext(); ) i.advanceEnd(); + (n = i.end()), e.push(i); + } + return new Th( + e.map(function (t) { + return t.startPoint(); + }), + ); + }), + arguments.length && r.tolerance(t); + }, + Ah = function () { + var s = this, + e = 6; + function h(t, e, n) { + for (var i = 0, r = 0, o = -2; o <= 1; o += 1) { + var a = t.get(e + o), + s = (function (t, e) { + switch (t) { + case -2: + return (((3 - e) * e - 3) * e + 1) / 6; + case -1: + return ((3 * e - 6) * e * e + 4) / 6; + case 0: + return (((-3 * e + 3) * e + 3) * e + 1) / 6; + case 1: + return (e * e * e) / 6; + default: + console.warn('internal error!'); + } + })(o, n); + (i += s * a[0]), (r += s * a[1]); + } + return [i, r]; + } + (this.granularity = function (t) { + if (!arguments.length) return e; + e = t; + }), + (this.apply = function (t) { + if (t.size() < 3) return t; + var e = new Th(), + n = t.size() + 3 - 1, + i = s.granularity(), + r = t.closed(); + e.add(h(t, 2 - (r ? 0 : 2), 0)); + for (var o = 2 - (r ? 0 : 2); o < n + (r ? 0 : 2); o += 1) + for (var a = 1; a <= i; a += 1) e.add(h(t, o, a / i)); + return e; + }); + }; +function Oh() { + (this.initialize = function () { + Oh.prototype.initialize.apply(this, arguments), + (this.elementType = 'displayElement'), + (this.id = null), + (this.x = 0), + (this.y = 0), + (this.width = 40), + (this.height = 40), + (this.radius = 20), + (this.size = 40), + (this.visible = !0), + (this.alpha = 1), + (this.rotate = 0), + (this.scale = 1), + (this.color = null), + (this.strokeColor = '22,255,22'), + (this.borderColor = '22,255,22'), + (this.fillColor = '22,255,22'), + (this.showShadow = !1), + (this.shadowBlur = 20), + (this.shadowColor = 'rgba(20,200,20,0.5)'), + (this.shadowOffsetX = 0), + (this.shadowOffsetY = 0), + (this.transformAble = !1), + (this.animate = !1), + (this.zIndex = 0), + (this.properties = {}), + (this.imageScale = 1); + }), + this.initialize(), + (this.paint = function (t) { + t.beginPath(), + t.rect(-this.width / 2, -this.height / 2, this.width, this.height), + this.fillColor && ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()), + (t.strokeStyle = 'rgba('.concat(this.strokeColor, ',').concat(this.alpha, ')')), + t.stroke(), + t.closePath(); + }), + (this.getLocation = function () { + return { x: this.x, y: this.y }; + }), + (this.setLocation = function (t, e) { + return (this.x = t), (this.y = e), this; + }), + (this.getCenterLocation = function () { + return { x: this.x + this.width / 2, y: this.y + this.height / 2 }; + }), + (this.setCenterLocation = function (t, e) { + return (this.x = t - this.width / 2), (this.y = e - this.height / 2), this; + }), + (this.getSize = function () { + return { width: this.width, height: this.heith }; + }), + (this.setSize = function (t, e) { + return ( + (this.width = Number(t) || 40), + (this.height = Number(e) || 40), + (this.raduis = Math.round(this.width / 2)), + this + ); + }), + (this.getBound = function () { + return { + left: this.x - this.borderWidth, + top: this.y - this.borderWidth, + right: this.x + this.width + this.borderWidth, + bottom: this.y + this.height + this.borderWidth, + width: this.width, + height: this.height, + }; + }), + (this.setBound = function (t, e, n, i) { + return this.setLocation(t, e), this.setSize(n, i), this; + }), + (this.getPosition = function (t) { + var e, + n = this.getBound(); + switch (t) { + case 'Top_Left': + e = { x: n.left, y: n.top }; + break; + case 'Top_Center': + e = { x: this.cx, y: n.top }; + break; + case 'Top_Right': + e = { x: n.right, y: n.top }; + break; + case 'Middle_Left': + e = { x: n.left, y: this.cy }; + break; + case 'Middle_Center': + e = { x: this.cx, y: this.cy }; + break; + case 'Middle_Right': + e = { x: n.right, y: this.cy }; + break; + case 'Bottom_Left': + e = { x: n.left, y: n.bottom }; + break; + case 'Bottom_Center': + e = { x: this.cx, y: n.bottom }; + break; + case 'Bottom_Right': + e = { x: n.right, y: n.bottom }; + break; + default: + e = { x: this.cx, y: this.cy }; + } + return e; + }); +} +function Ih() { + (this.initialize = function () { + Ih.prototype.initialize.apply(this, arguments), + (this.elementType = 'interactiveElement'), + (this.dragable = !1), + (this.selected = !1), + (this.showSelected = !1), + (this.isMouseOver = !1), + (this.selectedLocation = null), + (this.showBackGround = !1), + (this.animate = !1), + (this.visible = !0), + (this.mouseInteractive = !0); + }), + this.initialize(), + (this.paintMouseover = function (t) { + this.showSelected = !0; + }), + (this.isInBound = function (t, e) { + var n, i, r, o, a, s; + return 'rect' == this.shape + ? 1 == this.scale && 0 == this.rotate + ? t > this.x && t < this.x + this.width && e > this.y && e < this.y + this.height + : ((n = this.width * this.scale), + (i = this.height * this.scale), + 0 == this.rotate + ? t > this.cx - n / 2 && t < this.cx + n / 2 && e > this.cy - i / 2 && e < this.cy + i / 2 + : ((s = this.cx), + (r = this.cy), + (o = (-this.rotate * Math.PI) / 180), + (a = (t - s) * Math.cos(o) - (e - r) * Math.sin(o) + s), + (s = (t - s) * Math.sin(o) + (e - r) * Math.cos(o) + r), + a > this.cx - n / 2 && a < this.cx + n / 2 && s > this.cy - i / 2 && s < this.cy + i / 2)) + : Math.pow(t - this.cx, 2) + Math.pow(e - this.cy, 2) < Math.pow(this.radius * this.scale, 2); + }), + (this.setImage = function (t, e) { + var n, i, r; + t && + ((n = this), + null == (i = j.imgStore[t]) + ? 'string' == typeof t + ? ((r = new Image()).setAttribute('crossOrigin', 'Anonymous'), + (r.src = t), + (r.onload = function () { + (n.image = r), 'function' == typeof e && e(); + }), + (j.imgStore[t] = r)) + : ((this.image = t), this.setSize(t.width, t.height)) + : (n.image = i)); + }), + (this.selectedHandler = function () { + (this.selected = !0), (this.selectedLocation = { x: this.x, y: this.y }); + }), + (this.unselectedHandler = function () { + (this.selected = !1), (this.selectedLocation = null); + }), + (this.dbclickHandler = function (t) { + this.dispatchEvent('dbclick', t); + }), + (this.clickHandler = function (t) { + this.dispatchEvent('click', t); + }), + (this.mousedownHander = function (t) { + this.dispatchEvent('mousedown', t); + }), + (this.mouseupHandler = function (t) { + this.dispatchEvent('mouseup', t); + }), + (this.mouseoverHandler = function (t) { + (this.isMouseOver = !0), this.dispatchEvent('mouseover', t); + }), + (this.mousemoveHandler = function (t) { + this.dispatchEvent('mousemove', t); + }), + (this.mouseoutHandler = function (t) { + (this.isMouseOver = !1), (this.showSelected = !1), this.dispatchEvent('mouseout', t); + }), + (this.mousedragHandler = function (t) { + var e = this.selectedLocation.x + t.dx, + n = this.selectedLocation.y + t.dy; + this.setLocation(e, n), this.dispatchEvent('mousedrag', t); + }), + (this.addEventListener = function (t, e) { + var n = this; + return ( + this.eventBus || (this.eventBus = new F()), + this.eventBus.subscribe(t, function (t) { + e.call(n, t); + }), + this + ); + }), + (this.dispatchEvent = function (t, e) { + return this.eventBus ? (this.eventBus.publish(t, e), this) : null; + }), + (this.removeEventListener = function (t) { + this.eventBus.unsubscribe(t); + }), + (this.removeAllEventListener = function () { + this.eventBus = new F(); + }); + var t = this; + ['click', 'dbclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout', 'mousemove', 'mousedrag'].forEach(function (e) { + t[e] = function (t) { + null != t ? this.addEventListener(e, t) : this.dispatchEvent(e); + }; + }); +} +function Dh(t) { + var e = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]; + (this.initialize = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] && arguments[1]; + Dh.prototype.initialize.apply(this, arguments), + (this.elementType = 'group'), + (this.zIndex = j.Group_zIndex), + (this.fixed = e), + (this.width = 100), + (this.height = 100), + (this.childs = []), + (this.alpha = 0.1), + (this.dragable = !0), + (this.childDragable = !0), + (this.visible = !0), + (this.fillColor = '250,250,250'), + (this.borderWidth = 1), + (this.borderColor = '100,100,220'), + (this.selectedBorderWidth = 2), + (this.selectedBorderColor = '30,30,250'), + (this.showHeader = !1), + (this.label = t), + (this.textAlign = 'center'), + (this.textOffsetX = 10), + (this.font = 'normal 14px Arial'), + (this.fontColor = '255,255,255'), + (this.headerColor = '60,60,200'), + (this.headerAlpha = 0.8), + (this.headerHeight = 40), + (this.padding = 20), + (this.scale = 1), + (this.borderWidth = 0), + (this.polygonPoints = []), + (this.outerCircleCenter = { x: 0, y: 0 }), + (this.outerCircleRadius = 0), + (this.shape = 'rect'), + (this.needUpdate = !0), + (this.pathCache = null), + (this.smoothTolerance = 1), + (this.considerEdges = !0); + }), + (this.add = function (t) { + var e = this; + t instanceof Array + ? t.forEach(function (t) { + e.childs.push(t), (t.parentContainer = e); + }) + : (e.childs.push(t), (t.parentContainer = e)), + (this.needUpdate = !0); + }), + (this.remove = function (t) { + for (var e = 0; e < this.childs.length; e++) + if (this.childs[e] === t) { + (t.dragable = !0), (t.parentContainer = null), this.childs.splice(e, 1); + break; + } + this.needUpdate = !0; + }), + (this.removeAll = function () { + this.childs.forEach(function (t) { + (t.dragable = !0), (t.parentContainer = null); + }), + (this.childs = []), + (this.needUpdate = !0); + }), + (this.setLocation = function (t, e) { + var n = t - this.x, + i = e - this.y; + (this.x = t), + (this.y = e), + this.childs.forEach(function (t) { + t.setLocation(t.x + n, t.y + i); + }), + (this.needUpdate = !0); + }), + (this.computeHullPolygon = function () { + var e = this.padding, + n = []; + return ( + this.childs.forEach(function (t) { + t.visible && + (n.push([t.x - e, t.y - e]), + n.push([t.x - e, t.cy + t.radius + e]), + n.push([t.cx + t.radius + e, t.y - e]), + n.push([t.cx + t.radius + e, t.cy + t.radius + e])); + }), + (n = Ch(n)) + ); + }), + (this.computeHullPolygon1 = function () { + var e = [], + n = + (this.childs.forEach(function (t) { + t.visible && e.push([t.cx, t.cy]); + }), + (e = Ch(e)), + Nh(e)); + return ( + e.forEach(function (t) { + (t[0] = n[0] + 1.4 * (t[0] - n[0])), (t[1] = n[1] + 1.4 * (t[1] - n[1])); + }), + (this.polygonPoints = e) + ); + }), + (this.computeOuterCircle = function () { + var t = this.computeHullPolygon(), + e = Nh(t), + n = 0; + return ( + t.forEach(function (t) { + n = Math.max(Lh(t, e), n); + }), + (this.outerCircleCenter = { x: Math.round(e[0]), y: Math.round(e[1]) }), + (this.outerCircleRadius = Math.max(Math.round(n), 120)), + { radius: this.outerCircleRadius, center: this.outerCircleCenter } + ); + }), + (this.paintStorkeStyle = function (t, e) { + null != this.lineDash && t.setLineDash(this.lineDash), + 0 < this.borderWidth && + !this.showSelected && + !this.selected && + ((t.lineWidth = this.borderWidth), + (t.lineJoin = 'round'), + (t.strokeStyle = 'rgba('.concat(this.borderColor, ',1)')), + null == e ? t.stroke() : t.stroke(e)), + 0 < this.selectedBorderWidth && + (this.showSelected || this.selected) && + ((t.lineWidth = this.selectedBorderWidth), + (t.strokeStyle = 'rgba('.concat(this.selectedBorderColor, ',1)')), + null == e ? t.stroke() : t.stroke(e)); + }), + (this.paintPolygonArea = function (t) { + if (this.needUpdate) { + var e = [], + n = null; + if (this.smoothPath) + this.computeBubbletPoints(10).forEach(function (t) { + e.push([t[0], t[1]]); + }), + (n = this.generateSmoothPath(e)); + else { + for ( + var e = this.computeHullPolygon(), i = ['M'.concat(e[0][0], ' ').concat(e[0][1])], r = 1; + r < e.length; + r++ + ) + i.push(' L'.concat(e[r][0], ' ').concat(e[r][1])); + i.push(' Z'), (n = i.join('')); + } + (this.polygonPoints = e), (this.pathCache = n); + } + n = new Path2D(this.pathCache); + t.save(), + this.fillColor && ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill(n)), + this.paintStorkeStyle(t, n), + t.restore(); + }), + (this.paintBubbleSet = function (t) { + this.needUpdate && + ((e = []), + (n = this.computeBubbletPoints()).forEach(function (t) { + e.push([t[0], t[1]]); + }), + (this.pathCache = this.generateRoundPath(n)), + (this.polygonPoints = e)); + var e, + n = new Path2D(this.pathCache); + t.save(), + this.fillColor && ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill(n)), + this.paintStorkeStyle(t, n), + t.restore(); + }), + (this.computeBubbletPoints = function (t) { + var e, + n = [], + i = [], + r = [], + o = this.padding, + a = + (this.childs.forEach(function (t) { + t.visible && + (i.push({ x: t.x - o, y: t.y - o, width: t.width + 2 * o, height: t.height + 2 * o }), + n.push(t.id), + (t.outLinks || []).forEach(function (t) { + r.push(t); + })); + }), + new Sh()), + s = []; + return ( + (s = this.considerEdges + ? ((e = r + .filter(function (t) { + return -1 != n.indexOf(t.target.id); + }) + .map(function (t) { + return { x1: t.source.cx, y1: t.source.cy, x2: t.target.cx, y2: t.target.cy }; + })), + a.createOutline(i, [], e)) + : a.createOutline(i, [])), + null == t && (t = this.smoothTolerance), + new Th(s).transform([new Ph(t), new Ah(), new Ph(t)]) + ); + }), + (this.computeBubblePath = function () { + return this.generateRoundPath(this.computeBubbletPoints()); + }), + (this.generateRoundPath = function (t) { + return t.toString(); + }), + (this.generateSmoothPath = function (t, e) { + var n = 'M'.concat(t[0][0], ' ').concat(t[0][1]); + t.push(t[0]); + for (var i = null != e ? 0.5 : 1, r = 0; r < t.length - 1; r++) { + var o = 0 < r ? t[r - 1] : t[0], + a = t[r], + s = t[r + 1], + h = r != t.length - 2 ? t[r + 2] : s, + c = a[0] + ((s[0] - o[0]) / 6) * i, + o = a[1] + ((s[1] - o[1]) / 6) * i, + u = s[0] - ((h[0] - a[0]) / 6) * i, + h = s[1] - ((h[1] - a[1]) / 6) * i; + n += ' C'.concat(c, ' ').concat(o, ' ').concat(u, ' ').concat(h, ' ').concat(s[0], ' ').concat(s[1]); + } + return n + ' Z'; + }), + (this.paintRectArea = function (t) { + this.fixed || this.ajustAreaRange(), + t.save(), + t.beginPath(), + t.rect(this.x, this.y, this.width, this.height), + this.fillColor && ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()), + null != this.image && t.drawImage(this.image, this.x, this.y, this.width, this.height), + this.paintStorkeStyle(t), + t.restore(), + this.showHeader && this.paintHeader(t); + }), + (this.paintRectArea2 = function (t) { + this.fixed || this.ajustAreaRange(), + t.save(), + t.translate(this.x + this.width / 2, this.y + this.height / 2), + t.scale(this.scale, this.scale), + t.beginPath(), + t.rect(-this.width / 2, -this.height / 2, this.width, this.height), + this.fillColor && ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()), + null != this.image && t.drawImage(this.image, -this.width / 2, -this.height / 2, this.width, this.height), + this.paintStorkeStyle(t), + t.restore(), + this.showHeader && this.paintHeader(t); + }), + (this.paintOuterCircle = function (t) { + this.ajustAreaRange(), + t.save(), + t.beginPath(), + t.arc(this.outerCircleCenter.x, this.outerCircleCenter.y, this.outerCircleRadius, 0, 2 * Math.PI), + this.fillColor && ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()), + this.paintStorkeStyle(t), + t.restore(); + }), + (this.paint = function (t) { + switch (this.shape) { + case 'polygon': + this.paintPolygonArea(t); + break; + case 'circle': + this.paintOuterCircle(t); + break; + case 'bubbleset': + this.paintBubbleSet(t); + break; + default: + this.paintRectArea(t); + } + }), + (this.paintHeader = function (t) { + var e = this.borderWidth, + n = (e = this.showSelected || this.selected ? this.selectedBorderWidth : e) / 2; + t.save(), + t.beginPath(), + t.rect(this.x + n, this.y + n, this.width - e, this.headerHeight - e), + (t.fillStyle = 'rgba('.concat(this.headerColor, ',').concat(this.headerAlpha, ')')), + t.fill(), + this.label && + ((n = { x: 0, y: 0 }), + (n = + 'center' == this.textAlign + ? ((t.textAlign = 'center'), { x: this.x + this.width / 2, y: this.y + this.headerHeight / 2 }) + : 'right' == this.textAlign + ? ((t.textAlign = 'right'), + { x: this.x + this.width - this.textOffsetX, y: this.y + this.headerHeight / 2 }) + : ((t.textAlign = 'left'), { x: this.x + this.textOffsetX, y: this.y + this.headerHeight / 2 })), + (t.textBaseline = 'middle'), + t.translate(n.x, n.y), + t.scale(this.scale, this.scale), + (t.font = this.font), + (t.fillStyle = 'rgba('.concat(this.fontColor, ',').concat(this.headerAlpha, ')')), + t.fillText(this.label, 0, 0)), + t.restore(); + }), + (this.getTextPostion = function (t) { + var e = null; + switch (this.textAlign) { + case 'center': + e = { x: this.x + this.width / 2 - t / 2, y: this.y + this.headerHeight / 2 }; + break; + case 'right': + e = { x: this.x + this.width - (t + 2 * this.textOffsetX), y: this.y + this.headerHeight / 2 }; + break; + default: + e = { x: this.x + this.textOffsetX, y: this.y + this.headerHeight / 2 }; + } + return e; + }), + (this.paintMouseover = function (t) { + this.showSelected = !0; + }), + (this.isInBound = function (t, e) { + var n = !1; + switch (this.shape) { + case 'rect': + n = t > this.x && t < this.x + this.width && e > this.y && e < this.y + this.height; + break; + case 'circle': + n = Lh([this.outerCircleCenter.x, this.outerCircleCenter.y], [t, e]) < this.outerCircleRadius; + break; + case 'polygon': + case 'bubbleset': + n = _h(this.polygonPoints, [t, e]); + break; + default: + n = !1; + } + return n; + }), + (this.ajustAreaRange = function () { + var i = this, + r = 1 / 0, + o = -1 / 0, + a = 1 / 0, + s = -1 / 0, + h = this.padding; + i.childs.forEach(function (t) { + t.dragable = i.childDragable; + var e = (t.width / 2) * t.scale + h, + n = (t.height / 2) * t.scale + h; + (r = Math.min(t.cx - e, r)), + (o = Math.max(t.cx + e, o)), + (a = Math.min(t.cy - n, a)), + (s = Math.max(t.cy + n, s)); + }), + (i.outerCircleCenter = { x: Math.round((o + r) / 2), y: Math.round((s + a) / 2) }), + (i.outerCircleRadius = Math.round(Math.sqrt(Math.pow(o - r, 2) + Math.pow(s - a, 2), 2) / 2)), + (i.x = r), + (i.y = a - (this.showHeader ? i.headerHeight : 0)), + (i.width = Math.round(o - r)), + (i.height = Math.round(s - a) + (this.showHeader ? i.headerHeight : 0)); + }), + (this.setImage = function (t, e) { + var n, i, r; + t && + ((n = this), + null == (i = j.imgStore[t]) + ? 'string' == typeof t + ? ((r = new Image()).setAttribute('crossOrigin', 'Anonymous'), + (r.src = t), + (r.onload = function () { + (n.image = r), 'function' == typeof e && e(); + }), + (j.imgStore[t] = r)) + : (this.image = t) + : (n.image = i)); + }), + this.initialize(t, e); +} +(Oh.prototype = new W()), + Object.defineProperties(Oh.prototype, { + cx: { + get: function () { + return parseInt(this.x + this.width / 2); + }, + set: function (t) { + this.x = parseInt(t - this.width / 2); + }, + }, + cy: { + get: function () { + return parseInt(this.y + this.height / 2); + }, + set: function (t) { + this.y = parseInt(t - this.height / 2); + }, + }, + radius: { + get: function () { + return parseInt(this.width / 2); + }, + set: function (t) { + this.width = this.height = 2 * t; + }, + }, + size: { + get: function () { + return parseInt(2 * this.radius); + }, + set: function (t) { + this.radius = parseInt(t / 2); + }, + }, + }), + (Ih.prototype = new Oh()), + (Dh.prototype = new Ih()); +var Bh = function (e, n, t) { + var i = { + inLinks: (e.outLinks || []).filter(function (t) { + return t.target.id == n.id; + }), + outLinks: [], + }; + return ( + t && + (i.outLinks = (n.outLinks || []).filter(function (t) { + return t.target.id == e.id; + })), + i + ); + }, + Rh = function (t, e, n) { + e = Math.atan2(t.y - e.y, t.x - e.x); + return { bearing: e, x: t.x - n * Math.cos(e), y: t.y - n * Math.sin(e) }; + }, + zh = function (t, e, n, i, r, o, a, s) { + var h = Math.PI / 2, + c = Math.min( + Math.sqrt(Math.pow(n - t, 2) + Math.pow(i - e, 2)), + Math.sqrt(Math.pow(n - r, 2) + Math.pow(i - o, 2)), + ), + u = s, + a = + (('TB' == a) | ('BT' == a) + ? Math.abs(r - t) < s && (u = Math.abs(r - t)) + : Math.abs(o - e) < s && (u = Math.abs(o - e)), + Math.min(u / 2, c * Math.tan(h / 2))), + s = Math.abs(a / Math.tan(h / 2)), + u = (n - t) * (i - o) - (n - r) * (i - e) < 0 ? 1 : 0, + c = Rh({ x: n, y: i }, { x: t, y: e }, s), + h = Rh({ x: n, y: i }, { x: r, y: o }, s); + return 'L' + .concat(c.x, ' ') + .concat(c.y, ' A') + .concat(a, ' ') + .concat(a, ' 0 0 ') + .concat(u, ' ') + .concat(h.x, ' ') + .concat(h.y); + }, + Vh = Math.PI / 2, + jh = Math.PI, + Fh = 2 * Math.PI, + Xh = 3 * Math.PI, + Uh = { + font: 'normal 13px Arial', + fontColor: '120,120,120', + lineWidth: 2, + lineJoin: 'miter', + lineCap: 'butt', + strokeColor: '120,120,120', + selectedColor: '10,10,230', + selectedAlpha: 1, + background: null, + bundleOffset: 20, + bundleGap: 20, + groupNum: 1, + curveness: 0.5, + arrowsRadius: 5, + lineType: 'straight', + alpha: 1, + fontAlpha: 1, + showlabel: !0, + showArrow: !0, + arrowType: 'triangle', + labelBackGround: null, + labelBorderWidth: 0, + labelBorderColor: '255,255,255', + labelBorderRadius: 0, + lineDash: null, + path: [], + pathDefine: null, + animate: !1, + animateSpeed: 1, + animateBallIndex: 1, + animateBall: null, + animateBallColor: '255,0,0', + animateBallSize: 5, + lineDashOffset: 0, + multiControlPercent: 0.2, + parallelType: 'curve', + textWithLineAngle: !0, + }; +function Wh(h, t, e) { + (this.initialize = function (t, e, n) { + Wh.prototype.initialize.apply(this, arguments), + (this.elementType = 'link'), + (this.zIndex = j.Link_zIndex), + (this.label = n), + (this.source = t), + (this.target = e), + this.source && null == this.source.outLinks && (this.source.outLinks = []), + this.source && null == this.source.inLinks && (this.source.inLinks = []), + this.target && null == this.target.inLinks && (this.target.inLinks = []), + this.target && null == this.target.outLinks && (this.target.outLinks = []), + null != this.source && this.source.outLinks.push(this), + null != this.target && this.target.inLinks.push(this), + (this.nodeLineIndex = 0), + (this.colorType = 'defined'), + (this.scale = 1), + (this.linePointCache = null), + (this.pathDefine = null), + (this.arrowCache = null), + (this.textCache = { text: null, width: 0, height: 0 }), + (this.groupNum = 1), + (this.textWithLineAngle = !0), + Object.assign(this, Uh), + this.caculateIndex(); + }), + (this.findInsertPoint = function (t, e) { + (e = j.util.lineVir(t.cx, t.cy, e.cx, e.cy)), (t = t.getBound()); + return j.util.intersectionLineBound(e, t); + }), + (this.caculateIndex = function () { + var t = Bh(this.source, this.target, !0), + e = t.inLinks.length, + n = (0 < e && (this.nodeLineIndex = e - 1), e + t.outLinks.length); + t.inLinks.forEach(function (t) { + return (t.groupNum = n); + }), + t.outLinks.forEach(function (t) { + return (t.groupNum = n); + }); + }), + (this.removeHandler = function () { + var e = this.id, + t = + ((this.source.outLinks = (this.source.outLinks || []).filter(function (t) { + return t.id !== e; + })), + (this.target.inLinks = (this.target.inLinks || []).filter(function (t) { + return t.id !== e; + })), + Bh(this.source, this.target, !0)), + n = + (t.inLinks.forEach(function (t, e) { + t.nodeLineIndex = e; + }), + t.inLinks.length + t.outLinks.length); + t.inLinks.forEach(function (t) { + return (t.groupNum = n); + }), + t.outLinks.forEach(function (t) { + return (t.groupNum = n); + }); + }), + (this.getStartPosition = function (t, e) { + t = this.findInsertPoint(t, e); + return (t = null == t ? { x: this.source.cx, y: this.source.cy } : t); + }), + (this.getEndPosition = function (t, e) { + t = this.findInsertPoint(e, t); + return (t = null == t ? { x: e.cx, y: e.cy } : t); + }), + (this.isInBound = function (t, e) { + var n, + i = this.lineWidth; + if ((this.labelBackHeight && (i = Math.round(this.labelBackHeight / 2)), 0 < this.path.length)) { + for (var r = !1, o = 1; o < this.path.length; o++) { + var a = this.path[o - 1], + s = this.path[o]; + if (j.util.containStroke(a.x, a.y, s.x, s.y, i + 2, t, e)) { + r = !0; + break; + } + } + return r; + } + return this.bezierPoints + ? ((n = this.bezierPoints), + j.util.containBerzierStroke(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], i, t, e)) + : !!this.quadraticPoints && + ((n = this.quadraticPoints), + j.util.containQuadraticStroke(n[0], n[1], n[2], n[3], n[4], n[5], i + 2, t, e)); + }), + (this.paint = function (t, e) { + t.save(), + 'function' == typeof this.definedPaintFunc ? this.definedPaintFunc(t, e) : this.drawOriginalLine(t, e), + t.restore(); + }), + (this.drawOriginalLine = function (t) { + if (this.source && this.source.visible && this.target && this.target.visible) { + if (this.source.id === this.target.id) this.lineType = 'curver'; + else if (1 < this.groupNum) + return void ('curve' == this.parallelType ? this.paintMutilCurve(t) : this.paintMutilLine(t)); + this.paintLine(t, e); + } + }), + (this.paintLine = function (t, e) { + switch (this.lineType) { + case 'direct': + case 'straight': + this.paintDirectLine(t, e); + break; + case 'vlink': + this.paintVerticalLink(t, e); + break; + case 'hlink': + this.paintHorizolLink(t, e); + break; + case 'vcurve': + this.paintVCurve(t, e); + break; + case 'hcurve': + this.paintHCurve(t, e); + break; + case 'hvfold': + this.paintHVFoldLink(t, e); + break; + case 'vhfold': + this.paintVHFoldLink(t, e); + break; + case 'bezier': + this.paintBezier(t, e); + break; + case 'vbezier': + this.paintVBezierLink(t, e); + break; + case 'hbezier': + this.paintHBezierLink(t, e); + break; + case 'arrowline': + this.paintArrowLine(t, e); + break; + case 'curver': + this.paintCurverLink(t, e); + break; + default: + (this.lineType = 'straight'), this.paintDirectLine(t, e); + } + }), + (this.paintAnimateBall = function (t) { + var e, + n, + i, + r, + o, + a, + s = this.path; + 2 == s.length && (this.animateBallIndex = 1), + 0 < this.animateBallIndex && this.animateBallIndex < s.length + ? ((e = s[this.animateBallIndex - 1].x), + (n = s[this.animateBallIndex - 1].y), + (i = s[this.animateBallIndex].x), + (s = s[this.animateBallIndex].y), + (r = Math.atan2(s - n, i - e)), + (null != (a = this.animateBall) && a.sx == e && a.sy == n && a.tx == i && a.ty == s) || + ((a = i - e), + (o = s - n), + (a = Math.sqrt(a * a + o * o) / this.animateSpeed), + (this.animateBall = { x: e, y: n, sx: e, sy: n, tx: i, ty: s, angle: r, moves: a }))) + : ((this.animateBallIndex = 0), (this.animateBall = null)), + this.animateBall && 0 < this.animateBall.moves + ? (this.animateBall.moves--, + (this.animateBall.x += this.animateSpeed * Math.cos(this.animateBall.angle)), + (this.animateBall.y += this.animateSpeed * Math.sin(this.animateBall.angle)), + t.save(), + t.beginPath(), + (t.fillStyle = 'rgba('.concat(this.animateBallColor, ',').concat(this.alpha, ')')), + t.arc(this.animateBall.x, this.animateBall.y, this.animateBallSize, 0, Fh), + t.fill(), + t.restore(), + this.animateBall.moves <= 0 && ((this.animateBall = null), this.animateBallIndex++)) + : this.animateBallIndex++; + }), + (this.setLineStyle = function (t) { + if ( + (null != this.lineJoin && (t.lineJoin = this.lineJoin), + null != this.lineCap && (t.lineCap = this.lineCap), + this.selected || this.showSelected) + ) + (t.strokeStyle = 'rgba('.concat(this.selectedColor, ',').concat(this.selectedAlpha, ')')), + (t.lineWidth = this.lineWidth + 2); + else { + switch (this.colorType) { + case 'defined': + t.strokeStyle = 'rgba('.concat(this.strokeColor, ',').concat(this.alpha, ')'); + break; + case 'source': + t.strokeStyle = 'rgba('.concat(this.source.fillColor, ',').concat(this.alpha, ')'); + break; + case 'target': + t.strokeStyle = 'rgba('.concat(this.target.fillColor, ',').concat(this.alpha, ')'); + break; + case 'both': + var e = t.createLinearGradient(this.source.cx, this.source.cy, this.target.cx, this.target.cy); + e.addColorStop(0, 'rgba('.concat(this.source.fillColor, ',').concat(this.alpha, ')')), + e.addColorStop(1, 'rgba('.concat(this.target.fillColor, ',').concat(this.alpha, ')')), + (t.strokeStyle = e); + break; + default: + t.strokeStyle = 'rgba('.concat(this.strokeColor, ',').concat(this.alpha, ')'); + } + t.lineWidth = this.lineWidth; + } + null != this.lineDash && + (t.setLineDash(this.lineDash), this.animate) && + ((t.lineDashOffset = this.lineDashOffset), (this.lineDashOffset = (this.lineDashOffset - 1) % 100)); + }), + (this.paintMutilCurve = function (t) { + this.bundleGap = 40; + var e = this.getStartPosition(this.source, this.target), + n = this.getEndPosition(this.source, this.target), + i = this.computeControlPoint(e, n, 0.5), + r = i.startPoint, + i = i.endPoint, + o = n, + a = + (this.showArrow && + ((e = this.calculateEndPoint({ cx: r.x, cy: r.y }, this.source)), + (o = this.calculateEndPoint({ cx: i.x, cy: i.y }, this.target)), + (a = this.getArrowRadius()), + (n.x = o.x - a * Math.cos(o.angle)), + (n.y = o.y - a * Math.sin(o.angle))), + [r.x, r.y, i.x, i.y]), + r = ((this.path = []), (this.bezierPoints = [e.x, e.y, a[0], a[1], a[2], a[3], n.x, n.y]), 0); + (this.arrowCache = { start: { x: i.x, y: i.y }, end: o, textMid: { x: 0, y: 0 }, angle: 0 }), + this.showlabel && + this.label && + ((i = j.util.getPointOnBezierCurve(0.5, e.x, e.y, n.x, n.y, a[0], a[1], a[2], a[3])), + (r = + this.target.cx < this.source.cx + ? Math.atan2(this.source.cy - this.target.cy, this.source.cx - this.target.cx) + : Math.atan2(this.target.cy - this.source.cy, this.target.cx - this.source.cx)), + (this.arrowCache.textMid = { x: i.x, y: i.y }), + (this.arrowCache.angle = r)), + null != this.background && + this.paintLineBackGround( + t, + 'M' + .concat(e.x, ' ') + .concat(e.y, ' C') + .concat(a[0], ' ') + .concat(a[1], ' ') + .concat(a[2], ' ') + .concat(a[3], ' ') + .concat(o.x, ' ') + .concat(o.y), + ), + t.beginPath(), + t.moveTo(e.x, e.y), + t.bezierCurveTo(a[0], a[1], a[2], a[3], n.x, n.y), + this.setLineStyle(t), + t.stroke(), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.animate && + null == this.lineDash && + ((i = this.bezierPoints), this.paintBezierAnimate(t, i[0], i[1], i[6], i[7], i[2], i[3], i[4], i[5])), + this.paintLineText(t, this.arrowCache.textMid.x, this.arrowCache.textMid.y, this.arrowCache.angle), + this.paintLineTips(t, this.arrowCache.textMid); + }), + (this.paintMutilLine = function (n) { + this.bundleGap = 25; + var t, + e = this.getStartPosition(this.source, this.target), + i = this.getEndPosition(this.source, this.target), + r = this.computeControlPoint(e, i, this.multiControlPercent), + o = r.startPoint, + r = r.endPoint, + a = i; + if ( + (this.showArrow && + ((e = this.calculateEndPoint({ cx: o.x, cy: o.y }, this.source)), + (a = this.calculateEndPoint({ cx: r.x, cy: r.y }, this.target)), + (t = this.getArrowRadius()), + (i.x = a.x - t * Math.cos(a.angle)), + (i.y = a.y - t * Math.sin(a.angle))), + (this.path = [ + { x: e.x, y: e.y }, + { x: o.x, y: o.y }, + { x: r.x, y: r.y }, + { x: i.x, y: i.y }, + ]), + (this.arrowCache = { + start: { x: r.x, y: r.y }, + end: a, + textStart: { cx: o.x, cy: o.y }, + textEnd: { cx: r.x, cy: r.y }, + }), + null != this.background) + ) { + for (var s = ['M'.concat(e.x, ' ').concat(e.y, ' ')], h = 1; h < this.path.length - 1; h++) + s.push('L'.concat(this.path[h].x, ' ').concat(this.path[h].y, ' ')); + s.push('L'.concat(a.x, ' ').concat(a.y)), this.paintLineBackGround(n, s.join()); + } + n.beginPath(), + this.path.forEach(function (t, e) { + 0 == e ? n.moveTo(t.x, t.y) : n.lineTo(t.x, t.y); + }), + this.setLineStyle(n), + n.stroke(), + this.showArrow && this.paintSpecialArrow(n, this.arrowCache.start, this.arrowCache.end), + this.animate && null == this.lineDash && this.paintAnimateBall(n), + this.showlabel && this.paintTextOnLineWithAngle(n, this.arrowCache.textStart, this.arrowCache.textEnd); + }), + (this.computeControlPoint = function (t, e, n) { + this.bundleOffset = j.util.getDistance(t, e) * n; + var n = this.groupNum, + i = Math.atan2(e.y - t.y, e.x - t.x), + r = t.x + this.bundleOffset * Math.cos(i), + t = t.y + this.bundleOffset * Math.sin(i), + o = e.x + this.bundleOffset * Math.cos(i - jh), + e = e.y + this.bundleOffset * Math.sin(i - jh), + n = (n * this.bundleGap) / 2 - this.bundleGap / 2, + a = this.bundleGap * this.nodeLineIndex, + s = ((i -= Vh), a * Math.cos(i)), + a = a * Math.sin(i), + h = Math.cos(i - jh), + i = Math.sin(i - jh); + return { startPoint: { x: r + s + n * h, y: t + a + n * i }, endPoint: { x: o + s + n * h, y: e + a + n * i } }; + }), + (this.paintCurverLink = function (t) { + var e, + n = this.source.cx, + i = this.source.cy, + r = this.target.cx, + o = this.target.cy, + a = r - n, + s = o - i, + h = n < r ? 1 : -1, + c = {}, + u = {}, + l = 0, + d = ((this.path = []), null), + d = ( + this.source.id == this.target.id + ? ((e = (this.source.radius / 2) * this.source.scale || 20), + (this.showArrow = !1), + (c = j.util.getSelfLoopControlPoints(n, i, e + 7 * this.nodeLineIndex)), + (u = j.util.getPointOnBezierCurve(0.5, n, i, r, o, c.x1, c.y1, c.x2, c.y2)), + (l = Math.atan2(1, 1)), + (this.animate = !1), + (this.bezierPoints = [n, i, c.x1, c.y1, c.x2, c.y2, r, o]), + 'M' + .concat(n, ' ') + .concat(i, ' C') + .concat(c.x1, ' ') + .concat(c.y1, ' ') + .concat(c.x2, ' ') + .concat(c.y2, ' ')) + : ((c = j.util.getQuadraticControlPoint(n, i, r, o, 4, this.curveness)), + (u = j.util.getPointOnQuadraticCurve(0.5, n, i, r, o, c.x, c.y)), + (l = Math.atan2(s * h, a * h)), + (this.quadraticPoints = [n, i, c.x, c.y, r, o]), + 'M'.concat(n, ' ').concat(i, ' Q').concat(c.x, ' ').concat(c.y, ' ')) + ) + .concat(r, ' ') + .concat(o); + (this.pathDefine = d), + this.showArrow && + ((e = j.util.getPointOnQuadraticCurve(0.5, n, i, r, o, c.x, c.y)), + (s = j.util.getPointOnQuadraticCurve(0.52, n, i, r, o, c.x, c.y)), + (this.arrowCache = { start: { x: e.x, y: e.y }, end: { x: s.x, y: s.y } })), + (this.control = { x: u.x, y: u.y, angle: l }), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.animate && + null == this.lineDash && + ((a = this.quadraticPoints), this.paintCurverAnimate(t, a[0], a[1], a[4], a[5], a[2], a[3])), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.paintLineText(t, this.control.x, this.control.y, this.control.angle), + this.paintLineTips(t, { x: this.control.x, y: this.control.y }); + }), + (this.paintCurverAnimate = function (t, e, n, i, r, o, a) { + this.animateBall && this.animateBall.moves < 100 + ? ((this.animateBall.moves = (this.animateBall.moves + this.animateSpeed) % 100), + (e = j.util.getPointOnQuadraticCurve(this.animateBall.moves / 100, e, n, i, r, o, a)), + t.save(), + t.beginPath(), + (t.fillStyle = 'rgba('.concat(this.animateBallColor, ',').concat(this.alpha, ')')), + t.arc(e.x, e.y, this.animateBallSize, 0, Fh), + t.fill(), + t.restore()) + : (this.animateBall = { moves: 0 }); + }), + (this.paintArrowLine = function (t) { + var e = (e = this.lineWidth) < 4 ? 4 : e, + n = { x: this.target.cx, y: this.target.cy }, + i = (this.showArrow && (n = this.calculateEndPoint(this.source, this.target)), this.source.cx), + r = this.source.cy, + o = n.x, + a = n.y; + this.reverse && ((i = n.x), (r = n.y), (o = this.source.cx), (a = this.source.cy)), + (this.path = [ + { x: i, y: r }, + { x: o, y: a }, + ]), + t.save(), + t.beginPath(), + this.showArrow + ? t.paintCustomArrow(i, r, o, a, [-3 * e, e, -4 * e, 3 * e + 1]) + : t.paintCustomArrow(i, r, o, a, [0, e]), + (t.lineJoin = 'round'), + this.selected || this.showSelected + ? (t.fillStyle = 'rgba('.concat(this.selectedColor, ',').concat(this.selectedAlpha, ')')) + : 'both' == this.colorType + ? ((n = t.createLinearGradient( + this.source.cx, + this.source.cy, + this.target.cx, + this.target.cy, + )).addColorStop(0, 'rgba('.concat(this.source.fillColor, ',').concat(this.alpha, ')')), + n.addColorStop(1, 'rgba('.concat(this.target.fillColor, ',').concat(this.alpha, ')')), + (t.fillStyle = n)) + : (t.fillStyle = 'rgba('.concat(this.strokeColor, ',').concat(this.alpha, ')')), + t.fill(), + t.restore(), + this.paintTextOnLineWithAngle(t, this.source, this.target); + }), + (this.checkNeedUpdate = function () { + return ( + (null == this.linePointCache || + this.linePointCache.source.x != this.source.x || + this.linePointCache.source.y != this.source.y || + this.linePointCache.target.x != this.target.x || + this.linePointCache.target.y != this.target.y || + this.lineType != this.linePointCache.lineType) && + ((this.linePointCache = { + source: { x: this.source.x, y: this.source.y }, + target: { x: this.target.x, y: this.target.y }, + lineType: this.lineType, + }), + !0) + ); + }), + (this.paintDirectLine = function (t) { + this.arrowCache = null; + var e, + n = this.calculateEndPoint(this.target, this.source), + i = this.calculateEndPoint(this.source, this.target), + r = n.x, + n = n.y, + o = i.x, + a = i.y, + s = o, + h = a; + this.showArrow && + ((s = o - (e = this.getArrowRadius()) * Math.cos(i.angle)), + (h = a - e * Math.sin(i.angle)), + (this.arrowCache = { start: { x: r, y: n }, end: { x: o, y: a } })), + (this.path = [ + { x: r, y: n }, + { x: s, y: h }, + ]), + this.paintLineBackGround(t, 'M'.concat(r, ' ').concat(n, ' L').concat(o, ' ').concat(a)), + t.beginPath(), + t.moveTo(r, n), + t.lineTo(s, h), + this.setLineStyle(t), + t.stroke(), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.animate && null == this.lineDash && this.paintAnimateBall(t), + this.paintTextOnLineWithAngle(t, { cx: r, cy: n }, { cx: o, cy: a }); + }), + (this.paintTextOnLineWithAngle = function (t, e, n) { + var i = { x: (n.cx + e.cx) / 2, y: (n.cy + e.cy) / 2 }; + this.showlabel && + null != this.label && + ((n = Math.atan2(n.cy - e.cy, n.cx - e.cx)), + Vh < n ? (n -= jh) : n < -Vh && (n += jh), + this.paintLineText(t, i.x, i.y, n)), + this.paintLineTips(t, { x: i.x, y: i.y }); + }), + (this.paintLineTips = function (t, e) { + var n, i, r; + !this.hideText && + this.tipText && + ((r = this.tipRadius || 0), + t.save(), + (t.font = this.tipFont || 'normal 13px Arial'), + (n = t.measureText(this.tipText).width + 12), + (r = (i = t.measureText('田').width + 12 - 2) / 2 < r ? i / 2 : r), + t.translate(e.x - n / 2, e.y - i - 6), + t.beginPath(), + t.arc(n - r, i - r, r, 0, Vh), + t.lineTo(n / 2 + 4, i), + t.lineTo(n / 2, 6 + i), + t.lineTo(n / 2 - 4, i), + t.lineTo(r, i), + t.arc(r, i - r, r, Vh, jh), + t.lineTo(0, r), + t.arc(r, r, r, jh, Xh / 2), + t.lineTo(n - r, 0), + t.arc(n - r, r, r, Xh / 2, Fh), + t.lineTo(n, i - r), + t.closePath(), + (t.fillStyle = 'rgba('.concat(this.tipColor || '250,50,50', ',').concat(this.alpha, ')')), + t.fill(), + t.translate(n / 2, i / 2), + (t.fillStyle = 'rgba('.concat(this.tipFontColor || '250,250,250', ',').concat(this.alpha, ')')), + t.fillText(this.tipText, 0, 0), + t.restore()); + }), + (this.calculateEndPoint = function (t, e) { + var n, + i = 0, + r = e.cx, + o = e.cy; + return ( + 'rect' == e.shape + ? ((r = (n = this.getEndPosition(t, e)).x), (o = n.y), (i = Math.atan2(o - t.cy, r - t.cx))) + : ((n = -(e.radius + e.borderWidth / 2) * e.scale), + (i = Math.atan2(e.cy - t.cy, e.cx - t.cx)), + (r = e.cx + n * Math.cos(i)), + (o = e.cy + n * Math.sin(i))), + { x: Math.round(r), y: Math.round(o), angle: i } + ); + }), + (this.getArrowRadius = function () { + var t = 0; + switch (this.arrowType) { + case 'dot': + case 'box': + t = Math.min(Math.max(1.5 * this.lineWidth, 4), 40); + break; + default: + (t = this.selected || this.showSelected ? 3 * (this.lineWidth + 1) : 3 * this.lineWidth), + (t = Math.min(Math.max(t, 8), 60)); + } + return Math.round(t); + }), + (this.getTargetBorderPoint = function () { + var t, + e = 0; + return ( + this.showArrow && + ((e = (t = this.target).radius), + (e = + 'rect' == t.shape + ? -1 != ['vbezier', 'vlink'].indexOf(this.lineType) + ? (t.height / 2 + t.borderWidth / 2) * t.scale + : (t.width / 2 + t.borderWidth / 2) * t.scale + : (t.radius + t.borderWidth / 2) * t.scale)), + e + ); + }), + (this.paintSpecialArrow = function (t, e, n) { + var i = this.getArrowRadius(), + r = Math.atan((n.x - e.x) / (n.y - e.y)); + switch ( + (t.save(), t.translate(n.x, n.y), n.y >= e.y ? t.rotate(-r) : t.rotate(jh - r), t.beginPath(), this.arrowType) + ) { + case 'arrow': + t.moveTo(0, 0), t.lineTo(0.6 * -i, 1.5 * -i), t.lineTo(0, -i), t.lineTo(0.6 * i, 1.5 * -i), t.closePath(); + break; + case 'dot': + t.arc(0, -i, i, 0, 2 * jh); + break; + case 'box': + t.rect(-i, -2 * i, 2 * i, 2 * i); + break; + default: + t.moveTo(0, 0), t.lineTo(-i / 2, 1.2 * -i), t.lineTo(i / 2, 1.2 * -i), t.closePath(); + } + this.selected || this.showSelected + ? (t.fillStyle = 'rgba('.concat(this.selectedColor, ',').concat(this.selectedAlpha, ')')) + : (t.fillStyle = 'rgba('.concat(this.strokeColor, ',').concat(this.alpha, ')')), + t.fill(), + t.restore(); + }), + (this.paintVerticalLink = function (t) { + if (this.checkNeedUpdate()) { + var e = this.source.y + this.source.height, + n = this.target.y, + i = this.showArrow ? this.getArrowRadius() : 0; + e > n + this.target.height && ((e = this.source.y), (n = this.target.y + this.target.height), (i = -i)), + (this.path = [ + { x: this.source.cx, y: e }, + { x: this.source.cx, y: (e + n) / 2 }, + { x: this.target.cx, y: (e + n) / 2 }, + { x: this.target.cx, y: n - i }, + ]); + for (var r = ['M'.concat(this.path[0].x, ' ').concat(this.path[0].y, ' ')], o = 1; o < this.path.length; o++) + r.push('L'.concat(this.path[o].x, ' ').concat(this.path[o].y, ' ')); + (this.pathDefine = r.join()), + (this.arrowCache = { + start: { x: this.target.cx, y: (e + n) / 2 }, + end: { x: this.target.cx, y: n }, + midPos: { x: this.target.cx, y: ((e + n) / 2 + n) / 2 }, + }); + } + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.animate && null == this.lineDash && this.paintAnimateBall(t), + this.paintLineText(t, this.arrowCache.midPos.x, this.arrowCache.midPos.y), + this.paintLineTips(t, this.arrowCache.midPos); + }), + (this.paintVCurve = function (t) { + var e, n, i, r, o, a, s, h, c; + this.checkNeedUpdate() && + ((e = this.source.y + this.source.height), + (n = this.target.y), + (i = this.showArrow ? this.getArrowRadius() : 0), + e > n + this.target.height && ((e = this.source.y), (n = this.target.y + this.target.height), (i = -i)), + (r = this.target.cx - this.source.cx < 0 ? -1 : 1), + (o = (i = n - i) - e < 0 ? -1 : 1), + (a = Math.abs(this.target.cx - this.source.cx) / 2 < 30 ? Math.abs(this.target.cx - this.source.cx) / 2 : 30), + (a = Math.abs(i - e) / 2 < a ? Math.abs(i - e) / 2 : a), + (s = Math.abs(i - e) / 2 - a), + (h = Math.abs(this.target.cx - this.source.cx) - 2 * a), + (c = e + s * o + a * o), + (this.pathDefine = ' M ' + .concat(this.source.cx, ' ') + .concat(e, '\n L ') + .concat(this.source.cx, ' ') + .concat(e + s * o, '\n C ') + .concat(this.source.cx, ' ') + .concat(c, ' ') + .concat(this.source.cx, ' ') + .concat(c, ' ') + .concat(this.source.cx + a * r, ' ') + .concat(c, '\n L ') + .concat(this.source.cx + h * r + a * r, ' ') + .concat(c, '\n C ') + .concat(this.target.cx, ' ') + .concat(c, ' ') + .concat(this.target.cx, ' ') + .concat(c, ' ') + .concat(this.target.cx, ' ') + .concat(i - s * o, '\n L ') + .concat(this.target.cx, ' ') + .concat(i)), + (this.path = [ + { x: this.source.cx, y: e }, + { x: this.source.cx, y: c }, + { x: this.target.cx, y: c }, + { x: this.target.cx, y: i }, + ]), + (this.arrowCache = { + start: { x: this.target.cx, y: (e + n) / 2 }, + end: { x: this.target.cx, y: n }, + midPos: { x: this.target.cx, y: ((e + n) / 2 + n) / 2 }, + })), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.paintLineText(t, this.arrowCache.midPos.x, this.arrowCache.midPos.y); + }), + (this.paintHCurve = function (t) { + var e, n, i, r, o, a, s, h; + this.checkNeedUpdate() && + ((e = this.source.x + this.source.width), + (n = this.target.x), + (i = this.showArrow ? this.getArrowRadius() : 0), + e > n + this.target.width && ((e = this.source.x), (n = this.target.x + this.target.width), (i = -i)), + (r = (i = n - i) - e < 0 ? -1 : 1), + (o = this.target.cy - this.source.cy < 0 ? -1 : 1), + (a = Math.abs(i - e) / 2 < 30 ? Math.abs(i - e) / 2 : 30), + (a = Math.abs(this.target.cy - this.source.cy) / 2 < a ? Math.abs(this.target.cy - this.source.cy) / 2 : a), + (h = e + (s = Math.abs(i - e) / 2 - a) * r + a * r), + (this.pathDefine = 'M ' + .concat(e, ' ') + .concat(this.source.cy, '\n L ') + .concat(e + s * r, ' ') + .concat(this.source.cy, '\n C ') + .concat(h, ' ') + .concat(this.source.cy, ' \n ') + .concat(h, ' ') + .concat(this.source.cy, ' \n ') + .concat(h, ' ') + .concat(this.source.cy + a * o, '\n L ') + .concat(h, ' ') + .concat(this.target.cy - a * o, ' \n C ') + .concat(h, ' ') + .concat(this.target.cy, ' \n ') + .concat(h, ' ') + .concat(this.target.cy, ' \n ') + .concat(i - s * r, ' ') + .concat(this.target.cy, '\n L ') + .concat(i, ' ') + .concat(this.target.cy)), + (this.path = [ + { x: e, y: this.source.cy }, + { x: h, y: this.source.cy }, + { x: h, y: this.target.cy }, + { x: i, y: this.target.cy }, + ]), + (this.arrowCache = { + start: { x: (e + n) / 2, y: this.target.cy }, + end: { x: n, y: this.target.cy }, + midPos: { x: ((e + n) / 2 + n) / 2, y: this.target.cy }, + })), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.paintLineText(t, this.arrowCache.midPos.x, this.arrowCache.midPos.y); + }), + (this.paintHorizolLink = function (t) { + if (this.checkNeedUpdate()) { + var e = this.source.x + this.source.width, + n = this.target.x, + i = this.showArrow ? this.getArrowRadius() : 0; + e > n + this.target.width && ((e = this.source.x), (n = this.target.x + this.target.width), (i = -i)), + (this.path = [ + { x: e, y: this.source.cy }, + { x: (e + n) / 2, y: this.source.cy }, + { x: (e + n) / 2, y: this.target.cy }, + { x: n - i, y: this.target.cy }, + ]); + for (var r = ['M'.concat(this.path[0].x, ' ').concat(this.path[0].y, ' ')], o = 1; o < this.path.length; o++) + r.push('L'.concat(this.path[o].x, ' ').concat(this.path[o].y, ' ')); + (this.pathDefine = r.join()), + (this.arrowCache = { + start: { x: (e + n) / 2, y: this.target.cy }, + end: { x: n, y: this.target.cy }, + midPos: { x: ((e + n) / 2 + n) / 2, y: this.target.cy }, + }); + } + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.animate && null == this.lineDash && this.paintAnimateBall(t), + this.paintLineText(t, this.arrowCache.midPos.x, this.arrowCache.midPos.y), + this.paintLineTips(t, this.arrowCache.midPos); + }), + (this.paintHVFoldLink = function (t) { + var e, n, i, r, o, a; + this.checkNeedUpdate() && + ((e = this.source), + (n = this.target), + (r = o = e.cx) < (i = n.cx) ? (r = e.x + e.width) : i < o && (r = e.x), + (o = n.cy), + (a = 0), + e.cy < n.cy + ? ((o = n.y), this.showArrow && (a = 3 * -this.lineWidth)) + : e.cy > n.cy && ((o = n.y + n.height), this.showArrow) && (a = 3 * this.lineWidth), + (this.path = [ + { x: r, y: e.cy }, + { x: i, y: e.cy }, + { x: i, y: o }, + ]), + (this.pathDefine = 'M' + .concat(r, ' ') + .concat(e.cy, ' L') + .concat(i, ' ') + .concat(e.cy, ' L') + .concat(i, ' ') + .concat(o + a)), + (this.arrowCache = { start: { x: i, y: e.cy }, end: { x: i, y: o }, textPos: { x: i, y: (e.cy + o) / 2 } })), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.paintLineText(t, this.arrowCache.textPos.x, this.arrowCache.textPos.y, 0); + }), + (this.paintVHFoldLink = function (t) { + var e, n, i, r, o; + this.checkNeedUpdate() && + ((e = this.source), + (n = this.target), + (o = e.cy), + (r = n.cy), + (i = e.cy), + o < r ? (i = e.y + e.height) : r < o && (i = e.y), + (r = n.cx), + (o = 0), + e.cx < n.cx + ? ((r = n.x), this.showArrow && (o = 3 * -this.lineWidth)) + : e.cx > n.cx && ((r = n.x + n.width), this.showArrow) && (o = 3 * this.lineWidth), + (this.path = [ + { x: e.cx, y: i }, + { x: e.cx, y: n.cy }, + { x: r, y: n.cy }, + ]), + (this.pathDefine = 'M' + .concat(e.cx, ' ') + .concat(i, ' L') + .concat(e.cx, ' ') + .concat(n.cy, ' L') + .concat(r + o, ' ') + .concat(n.cy)), + (this.arrowCache = { + start: { x: e.cx, y: n.cy }, + end: { x: r, y: n.cy }, + textPos: { x: (e.cx + r) / 2, y: n.cy }, + })), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.paintLineText(t, this.arrowCache.textPos.x, this.arrowCache.textPos.y, 0); + }), + (this.paintLineBackGround = function (t, e) { + this.background && + (t.save(), + (t.lineCap = 'round'), + (t.lineJoin = 'round'), + (t.strokeStyle = 'rgba('.concat(this.background, ',').concat(0.9 * this.alpha, ')')), + (t.lineWidth = 3 * (this.lineWidth + 2)), + t.stroke(new Path2D(e)), + t.restore()); + }), + (this.paintBezier = function (t) { + var e = j.util.calculateAngle(this.source.cx, this.source.cy, this.target.cx, this.target.cy); + (0 <= e && e <= 45) || (135 <= e && e <= 225) || (315 <= e && e <= 360) + ? this.paintVBezierLink(t) + : this.paintHBezierLink(t); + }), + (this.paintHBezierLink = function (t) { + var e, n, i, r, o, a, s; + this.checkNeedUpdate() && + ((e = this.showArrow ? this.getArrowRadius() : 0), + (n = this.source.x + this.source.width) > (i = this.target.x) + this.target.width && + ((n = this.source.x), (i = this.target.x + this.target.width), (e = -e)), + (r = (n + i) * this.curveness), + (o = this.source.cy), + (a = (n + i) * this.curveness), + (s = this.target.cy), + (this.path = []), + (this.bezierPoints = [n, this.source.cy, r, o, a, s, i, this.target.cy]), + (this.pathDefine = 'M' + .concat(n, ' ') + .concat(this.source.cy, ' C') + .concat(r, ' ') + .concat(o, ' ') + .concat(a, ' ') + .concat(s, ' ') + .concat(i - e, ' ') + .concat(this.target.cy)), + (this.arrowCache = { start: { x: i - e, y: this.target.cy }, end: { x: i, y: this.target.cy } })), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.animate && + null == this.lineDash && + this.paintBezierAnimate( + t, + this.bezierPoints[0], + this.bezierPoints[1], + this.bezierPoints[6], + this.bezierPoints[7], + this.bezierPoints[2], + this.bezierPoints[3], + this.bezierPoints[4], + this.bezierPoints[5], + ), + this.paintBezierText( + t, + this.bezierPoints[0], + this.bezierPoints[1], + this.bezierPoints[6], + this.bezierPoints[7], + this.bezierPoints[2], + this.bezierPoints[3], + this.bezierPoints[4], + this.bezierPoints[5], + ); + }), + (this.paintVBezierLink = function (t) { + var e, n, i, r, o, a, s; + this.checkNeedUpdate() && + ((e = this.showArrow ? this.getArrowRadius() : 0), + (n = this.source.y + h.height) > (i = this.target.y) + this.target.height && + ((n = this.source.y), (i = this.target.y + this.target.height), (e = -e)), + (r = this.source.cx), + (o = (n + i) * this.curveness), + (a = this.target.cx), + (s = (n + i) * this.curveness), + (this.path = []), + (this.bezierPoints = [this.source.cx, n, r, o, a, s, this.target.cx, i]), + (this.pathDefine = 'M' + .concat(this.source.cx, ' ') + .concat(n, ' C') + .concat(r, ' ') + .concat(o, ' ') + .concat(a, ' ') + .concat(s, ' ') + .concat(this.target.cx, ' ') + .concat(i - e)), + (this.arrowCache = { start: { x: this.target.cx, y: i - e }, end: { x: this.target.cx, y: i } })), + this.paintLineBackGround(t, this.pathDefine), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)), + this.showArrow && this.paintSpecialArrow(t, this.arrowCache.start, this.arrowCache.end), + this.paintBezierText( + t, + this.bezierPoints[0], + this.bezierPoints[1], + this.bezierPoints[6], + this.bezierPoints[7], + this.bezierPoints[2], + this.bezierPoints[3], + this.bezierPoints[4], + this.bezierPoints[5], + ), + this.animate && + null == this.lineDash && + this.paintBezierAnimate( + t, + this.bezierPoints[0], + this.bezierPoints[1], + this.bezierPoints[6], + this.bezierPoints[7], + this.bezierPoints[2], + this.bezierPoints[3], + this.bezierPoints[4], + this.bezierPoints[5], + ); + }), + (this.paintBezierAnimate = function (t, e, n, i, r, o, a, s, h) { + this.animateBall && this.animateBall.moves < 100 + ? ((this.animateBall.moves = (this.animateBall.moves + this.animateSpeed) % 100), + (e = j.util.getPointOnBezierCurve(this.animateBall.moves / 100, e, n, i, r, o, a, s, h)), + t.save(), + t.beginPath(), + t.arc(e.x, e.y, this.animateBallSize, 0, 2 * jh), + (t.fillStyle = 'rgba('.concat(this.animateBallColor, ',').concat(this.alpha, ')')), + t.fill(), + t.restore()) + : (this.animateBall = { moves: 0 }); + }), + (this.paintBezierText = function (t, e, n, i, r, o, a, s, h) { + var c, + u = null; + this.showlabel && + this.label && + ((u = j.util.getPointOnBezierCurve(0.5, e, n, i, r, o, a, s, h)), + 'curver' == this.lineType + ? ((c = 0 < s - o ? -1 : 1), + (c = Math.atan2((s - o) * c, (h - a) * -c) + Vh), + this.paintLineText(t, u.x, u.y, c)) + : this.paintLineText(t, u.x, u.y)), + this.tipText && + (null == u && j.util.getPointOnBezierCurve(0.5, e, n, i, r, o, a, s, h), + this.paintLineTips(t, { x: u.x, y: u.y })); + }), + (this.paintLineText = function (t, e, n) { + var i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 0; + if (!this.showlabel || !this.label || this.hideText) return !1; + var r, + i = this.textWithLineAngle ? i : 0, + o = null == this.tipText ? 'bottom' : 'top'; + t.save(), + t.translate(e, n), + 0 != i && t.rotate(i), + 1 < this.scale && t.scale(this.scale, this.scale), + (t.font = this.font), + this.labelBackGround + ? (this.computeTextWidth(t), + (i = this.textCache.width), + (r = this.textCache.height), + t.DGraphRoundRect(-i / 2, -r / 2, i, r, this.labelBorderRadius), + (t.fillStyle = 'rgba('.concat(this.labelBackGround, ',').concat(this.fontAlpha, ')')), + t.fill()) + : (t.textBaseline = o), + (t.fillStyle = 'rgba('.concat(this.fontColor, ',').concat(this.fontAlpha, ')')), + t.fillText(this.label, 0, 1), + t.restore(); + }), + (this.computeTextWidth = function (t) { + var e; + this.textCache.text != this.label && + ((e = t.measureText(this.label).width + 6), + (t = t.measureText('国').width + 3), + (this.labelBackHeight = t), + (this.textCache.text = this.label), + (this.textCache.width = e), + (this.textCache.height = t)); + }), + this.initialize(h, t, e); +} +Wh.prototype = new Ih(); +var Yh = { + label: null, + type: 'default', + shape: 'circle', + font: 'normal 13px Arial', + fontColor: '20,20,20', + borderWidth: 0, + borderColor: '120,120,230', + borderAlpha: 1, + selectedBorderColor: '120,120,230', + selectedBorderWidth: 6, + borderRadius: 0, + shadowColor: '110,110,230', + shadowBlur: 10, + dragable: !0, + textPosition: 'Middle_Center', + textOffsetX: 0, + textOffsetY: 0, + transformAble: !0, + inLinks: null, + outLinks: null, + labelBackGround: null, + labelBorderWidth: 0, + labelBorderColor: '255,255,255', + fillStyle: null, + strokeStyle: null, + textLines: [], + showlabel: !0, + nodeWrapText: !1, + headTipText: null, + headTipFont: 'normal 13px YaHei', + headTipFontColor: '250,250,250', + headTipRadius: 0, + padding: 0, + tags: null, + tagSize: 8, + tagColor: '230,50,50', + tagFont: 'normal 8px Arial', + tagFontColor: '255,255,255', + tagBorderColor: '255,255,255', + imageScale: 1, +}; +function Gh() { + (this.initialize = function () { + Gh.prototype.initialize.apply(this, arguments), + (this.elementType = 'node'), + (this.nodeType = 'inner'), + (this.zIndex = j.Node_zIndex), + Object.assign(this, Yh), + (this.icon = null), + (this.imageOffsetX = 0), + (this.imageOffsetY = 0), + (this.textCache = { sigleWidth: 0, maxWidth: 0, lineCount: 0, font: null, text: '' }), + (this.nodeWrapText = !1), + (this.textSvgImage = null), + (this.needUpdate = !1), + (this.wrapTextConfig = { isVertical: !1, fontSize: 13, fontWeight: 'normal', fontFamily: 'Arial', padding: 10 }), + (this.textPadding = 10), + (this.labelBorderWidth = 0); + }), + this.initialize(), + (this.drawNodeImg = function (t, e, n, i, r) { + e && + e.width && + (t.save(), + this.alpha < 1 && (t.globalAlpha = this.alpha), + this.imageScale < 1 && t.scale(this.imageScale, this.imageScale), + 'rect' == this.shape || 'square' == this.shape + ? t.drawImage(e, n + this.imageOffsetX, i + this.imageOffsetY, this.width, this.height) + : r < e.width / 2 + ? (this.paintShape(t), + t.clip(), + t.drawImage(e, n + this.imageOffsetX, i + this.imageOffsetY, this.width, this.height)) + : t.drawImage(e, -e.width / 2, -e.height / 2, e.width, e.height), + t.restore()); + }), + (this.paint = function (t, e) { + 'function' == typeof this.definedPaintFunc ? this.definedPaintFunc(t, e) : this.drawOriginalNode(t, e); + }), + (this.drawOriginalNode = function (t, e) { + this.drawShape(t, e), + this.image && !e && this.drawNodeImg(t, this.image, -this.width / 2, -this.height / 2, this.width / 2), + e || this.hideText || (this.paintHeadTip(t), this.paintNodeTags(t), this.paintText(t)); + }), + (this.drawShape = function (t, e) { + t.save(), + this.paintShape(t), + e + ? this.fillStyle + ? ((t.fillStyle = this.fillStyle), t.fill()) + : this.fillColor + ? ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()) + : ((t.lineWidth = this.borderWidth), + (t.strokeStyle = 'rgba('.concat(this.borderColor, ',').concat(this.alpha, ')')), + t.stroke()) + : ((this.fillColor || e) && + (this.paintShadow(t), + (t.fillStyle = this.fillStyle || 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), + t.fill()), + this.lineDash && 1 < this.lineDash.length && t.setLineDash(this.lineDash), + this.showSelected || this.selected + ? 0 < this.selectedBorderWidth && + ((t.lineWidth = this.selectedBorderWidth), + (t.strokeStyle = 'rgba('.concat(this.selectedBorderColor, ',').concat(this.alpha, ')')), + t.stroke()) + : 0 < this.borderWidth && + ((t.lineWidth = this.borderWidth), + (t.strokeStyle = this.strokeStyle || 'rgba('.concat(this.borderColor, ',').concat(this.alpha, ')')), + t.stroke())), + t.restore(); + }), + (this.paintShape = function (t) { + switch (this.shape) { + case 'square': + case 'rect': + t.DGraphRoundRect(-this.width / 2, -this.height / 2, this.width, this.height, this.borderRadius); + break; + case 'star': + t.beginPath(), t.moveTo(0, -this.radius); + for (var e = 0; e < 5; e++) + t.rotate(Math.PI / 5), t.lineTo(0, -0.4 * this.radius), t.rotate(Math.PI / 5), t.lineTo(0, -this.radius); + t.closePath(); + break; + case 'polygon': + t.beginPath(); + for (var n = (2 * Math.PI) / 6, e = 0; e < 6; e++) { + var i = Math.cos(e * n), + r = Math.sin(e * n); + t.lineTo(i * this.radius, r * this.radius); + } + t.closePath(); + break; + default: + t.beginPath(), t.arc(0, 0, this.radius, 0, 2 * Math.PI, !0); + } + }), + (this.paintWrapText = function (t) { + var e; + (null != this.textSvgImage && !this.needUpdate) || + ((this.wrapTextConfig.fontColor = 'rgba('.concat(this.fontColor, ',').concat(this.alpha, ')')), + ((e = new Image()).src = j.util.genrateTextSvg( + this.label, + this.width - this.wrapTextConfig.padding, + this.height - this.wrapTextConfig.padding, + this.wrapTextConfig, + )), + (this.textSvgImage = e), + (this.needUpdate = !1)), + 1 <= this.alpha && + t.drawImage( + this.textSvgImage, + -(this.width - this.wrapTextConfig.padding) / 2, + -(this.height - this.wrapTextConfig.padding) / 2, + ); + }), + (this.paintTextMutilLine = function (t) { + var e, n, i, r; + this.showlabel && + this.label && + ((t.font = this.font), + this.processLabel(t), + this.nodeWrapText + ? this.paintWrapText(t) + : ((n = 0), + (e = this.textPadding), + null == this.textSvgImage || this.needUpdate + ? ((r = this.textLines.length * this.textCache.sigleWidth + e), + (n = this.textCache.maxWidth + e), + ((i = new Image()).src = j.util.buildMutilTextSvg(this.textLines, n, r, { + font: this.font, + fontColor: 'rgb('.concat(this.fontColor, ')'), + backgroundColor: 'rgb('.concat(this.labelBackGround, ')'), + borderColor: 'rgb('.concat(this.labelBorderColor, ')'), + borderRadius: 2, + })), + (this.textSvgImage = i), + (this.needUpdate = !1)) + : (n = this.textCache.maxWidth + e), + (r = this.getTextPostion(n, this.textCache.sigleWidth)), + t.drawImage(this.textSvgImage, r.x, r.y - (this.textCache.sigleWidth + e / 2)))); + }), + (this.paintText = function (t) { + if (this.showlabel && this.label && 1 <= this.alpha) + if (this.nodeWrapText) this.paintWrapText(t); + else { + t.save(), (t.font = this.font), this.processLabel(t); + var e = this.textCache.sigleWidth, + n = this.textLines.length, + i = n * e, + r = { x: 0, y: 0 }; + this.labelBackGround && + ((r = this.getTextPostion(this.textCache.maxWidth, e)), + t.DGraphRoundRect(r.x - 4, r.y - e, this.textCache.maxWidth + 8, i + 2 * n, 0), + (t.fillStyle = 'rgba('.concat(this.labelBackGround, ',').concat(this.alpha, ')')), + t.fill()), + 0 < this.labelBorderWidth && + ((t.lineWidth = this.labelBorderWidth), + (t.strokeStyle = 'rgba('.concat(this.labelBorderColor, ',').concat(this.alpha, ')'))), + (t.fillStyle = 'rgba('.concat(this.fontColor, ',').concat(this.alpha, ')')); + for (var o = 0; o < n; o++) + (r = this.getTextPostion(t.measureText(this.textLines[o]).width, e)), + 0 < this.labelBorderWidth && t.strokeText(this.textLines[o], r.x, r.y + o * e + (0 == o ? 0 : 2 * o)), + t.fillText(this.textLines[o], r.x, r.y - 1 + o * e + (0 == o ? 0 : 2 * o)); + t.restore(); + } + }), + (this.paintNodeTags = function (n) { + var i, r, o, a, s, h, c; + Array.isArray(this.tags) && + ((i = this), + (o = r = 0), + (a = -Math.PI / 5), + (s = i.radius + (this.tagSize || 8) / 2), + (h = 7 < this.tags.length ? 0 : 1), + (c = Math.PI), + this.tags.forEach(function (t, e) { + (r = s * Math.sin(a * (e + h) + c)), + (o = s * Math.cos(a * (e + h) + c)), + i.paintTagText(n, t, { x: r, y: o }); + })); + }), + (this.paintTagText = function (t, e, n) { + t.save(), + t.beginPath(), + t.arc(n.x, n.y, this.tagSize || 8, 0, 2 * Math.PI), + this.tagColor && ((t.fillStyle = 'rgba('.concat(this.tagColor, ',').concat(this.alpha, ')')), t.fill()), + this.tagBorderColor && + ((t.lineWidth = 1), + (t.strokeStyle = 'rgba('.concat(this.tagBorderColor, ',').concat(this.alpha, ')')), + t.stroke()), + (t.font = this.tagFont || 'normal 8px Arial'), + (t.fillStyle = 'rgba('.concat(this.tagFontColor, ',').concat(this.alpha, ')')), + (t.textAlign = 'center'), + (t.textBaseline = 'middle'), + t.fillText(e.substr(0, 1), n.x, n.y + 1), + t.restore(); + }), + (this.processLabel = function (t) { + if (this.textCache.text != this.label || this.textCache.font != this.font) { + if ( + ((this.textLines = String(this.label).split('\n')), + (this.textCache.sigleWidth = t.measureText('国').width), + (this.textCache.font = this.font), + (this.textCache.lineCount = this.textLines.length), + (this.textCache.text = this.label), + 1 == this.textLines.length) + ) + this.textCache.maxWidth = t.measureText(this.textLines[0]).width; + else + for (var e = 0; e < this.textLines.length; e++) + this.textCache.maxWidth = Math.max(t.measureText(this.textLines[e]).width, this.textCache.maxWidth); + this.needUpdate = !0; + } + }), + (this.paintShadow = function (t) { + this.showShadow && + this.selected && + ((t.shadowBlur = this.shadowBlur), + (t.shadowColor = 'rgba('.concat(this.shadowColor, ',').concat(0.9 * this.alpha, ')')), + (t.shadowOffsetX = this.shadowOffsetX), + (t.shadowOffsetY = this.shadowOffsetY)); + }), + (this.paintHeadTip = function (t) { + var e, n, i; + this.headTipText && + ((i = this.headTipRadius || 0), + t.save(), + (t.font = this.headTipFont || 'normal 13px Arial'), + (e = t.measureText(this.headTipText).width + 16), + (i = (n = t.measureText('田').width + 16 - 2) / 2 < i ? n / 2 : i), + t.translate(-e / 2, -n - this.height / 2 - 6), + t.beginPath(), + t.arc(e - i, n - i, i, 0, Math.PI / 2), + t.lineTo(e / 2 + 4, n), + t.lineTo(e / 2, 6 + n), + t.lineTo(e / 2 - 4, n), + t.lineTo(i, n), + t.arc(i, n - i, i, Math.PI / 2, Math.PI), + t.lineTo(0, i), + t.arc(i, i, i, Math.PI, (3 * Math.PI) / 2), + t.lineTo(e - i, 0), + t.arc(e - i, i, i, (3 * Math.PI) / 2, 2 * Math.PI), + t.lineTo(e, n - i), + t.closePath(), + (t.fillStyle = 'rgba('.concat(this.headTipColor || '250,50,50', ',').concat(this.alpha, ')')), + t.fill(), + t.translate(e / 2, n / 2), + (t.textBaseline = 'middle'), + (t.textAlign = 'center'), + (t.fillStyle = 'rgba('.concat(this.headTipFontColor || '250,250,250', ',').concat(this.alpha, ')')), + t.fillText(this.headTipText, 0, 0), + t.restore()); + }), + (this.getTextPostion = function (t, e) { + var n = null; + switch (this.textPosition) { + case 'Bottom_Center': + n = { x: -this.width / 2 + (this.width - t) / 2, y: this.height / 2 + e }; + break; + case 'Middle_Center': + n = { x: -this.width / 2 + (this.width - t) / 2, y: e / 2 }; + break; + case 'Top_Center': + n = { x: -this.width / 2 + (this.width - t) / 2, y: -this.height / 2 - e / 2 }; + break; + case 'Top_Right': + n = { x: this.width / 2, y: -this.height / 2 - e / 2 }; + break; + case 'Top_Left': + n = { x: -this.width / 2 - t, y: -this.height / 2 - e / 2 }; + break; + case 'Bottom_Right': + n = { x: this.width / 2, y: this.height / 2 + e }; + break; + case 'Bottom_Left': + n = { x: -this.width / 2 - t, y: this.height / 2 + e }; + break; + case 'Middle_Right': + n = { x: this.width / 2, y: e / 2 }; + break; + case 'Middle_Left': + n = { x: -this.width / 2 - t, y: e / 2 }; + break; + default: + n = { x: -this.width / 2 + (this.width - t) / 2, y: this.height / 2 + e }; + } + return 0 != this.textOffsetX && (n.x += this.textOffsetX), 0 != this.textOffsetY && (n.y += this.textOffsetY), n; + }), + (this.setImage = function (t, e) { + var n, i, r; + t && + ((n = this), + null == (i = j.imgStore[t]) + ? 'string' == typeof t + ? ((r = new Image()).setAttribute('crossOrigin', 'Anonymous'), + (r.src = t), + (r.onload = function () { + (n.image = r), 'function' == typeof e && e(); + }), + (j.imgStore[t] = r)) + : ((this.image = t), this.setSize(t.width, t.height)) + : (n.image = i)); + }), + (this.removeHandler = function (e) { + var n = this; + this.outLinks && + (this.outLinks.forEach(function (t) { + t.source === n && e.remove(t); + }), + (this.outLinks = null)), + this.inLinks && + (this.inLinks.forEach(function (t) { + t.target === n && e.remove(t); + }), + (this.inLinks = null)); + }); +} +function qh(t) { + (this.initialize = function (t) { + var e; + qh.prototype.initialize.apply(this, arguments), + (this.elementType = 'node'), + (this.nodeType = 'custome'), + (this.zIndex = j.Node_zIndex), + Object.assign(this, Yh), + (this.icon = null), + (this.imageOffsetX = 0), + (this.imageOffsetY = 0), + (this.padding = 0), + (this.customeTemplate = t || []), + (this.needCheckElements = ((null == (e = this.customeTemplate) ? void 0 : e.elements) || []).filter(function (t) { + return !!t.isInBound; + })); + }), + this.initialize(t), + (this.paint = function (n, t) { + var i; + this.drawOriginalNode(n, t), + t || + ((t = (null == (t = this.customeTemplate) ? void 0 : t.elements) || []), + (i = this), + t.forEach(function (t) { + var e = t.type, + t = t.attrs; + n.save(), i.drawNodeElement(n, e, t, i), n.restore(); + })); + }), + (this.drawNodeElement = function (t, e, n, i) { + switch (e) { + case 'circle': + case 'rect': + t.beginPath(), + 'circle' == e ? t.arc(n.x, n.y, n.radius, 0, 2 * Math.PI, !1) : t.rect(n.x, n.y, n.width, n.height), + n.fillColor && + ('function' == typeof n.fillColor + ? (t.fillStyle = n.fillColor(i) || '#fff') + : (t.fillStyle = n.fillColor), + t.fill()), + n.borderWidth && ((t.lineWidth = n.borderWidth), (t.strokeStyle = n.borderColor || '#fff'), t.stroke()); + break; + case 'line': + t.beginPath(), + t.moveTo(n.x1, n.y1), + t.lineTo(n.x2, n.y2), + (t.lineWidth = n.lineWidth || 1), + (t.strokeStyle = n.color || '#fff'), + t.stroke(); + break; + case 'text': + (t.font = n.font || '13px Arial'), + (t.fillStyle = n.color || '#444'), + (t.textAlign = n.textAlign || 'center'), + (t.textBaseline = n.textBaseline || 'middle'), + 'function' == typeof n.content + ? t.fillText(n.content(i) || ' ', n.x, n.y) + : t.fillText(n.content || ' ', n.x, n.y); + break; + case 'image': + (r = 'function' == typeof n.imageUrl ? n.imageUrl(i) : n.imageUrl) && + (r = i.getElementImage(r)) && + t.drawImage(r, n.x, n.y, n.width, n.height); + break; + case 'defined': + var r = n.drawFunction; + 'function' == typeof r && r(t, i); + } + }), + (this.drawNodeImg = function (t, e, n, i, r) { + null != e && + 2 < e.width && + (t.save(), + this.alpha < 1 && (t.globalAlpha = this.alpha), + this.imageScale < 1 && t.scale(this.imageScale, this.imageScale), + 'rect' == this.shape + ? t.drawImage(e, n + this.imageOffsetX, i + this.imageOffsetY, this.width, this.height) + : r < e.width / 2 + ? (this.paintShape(t), + t.clip(), + t.drawImage(e, n + this.imageOffsetX, i + this.imageOffsetY, this.width, this.height)) + : t.drawImage(e, -e.width / 2, -e.height / 2, e.width, e.height), + t.restore()); + }), + (this.drawOriginalNode = function (t, e) { + this.drawShape(t, e), + this.image && !e && this.drawNodeImg(t, this.image, -this.width / 2, -this.height / 2, this.width / 2); + }), + (this.drawShape = function (t, e) { + t.save(), + this.paintShape(t), + e + ? this.fillStyle + ? ((t.fillStyle = this.fillStyle), t.fill()) + : this.fillColor + ? ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()) + : ((t.lineWidth = this.borderWidth), + (t.strokeStyle = 'rgba('.concat(this.borderColor, ',').concat(this.alpha, ')')), + t.stroke()) + : ((this.fillColor || e) && + (this.paintShadow(t), + (t.fillStyle = this.fillStyle || 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), + t.fill()), + this.lineDash && 1 < this.lineDash.length && t.setLineDash(this.lineDash), + this.showSelected || this.selected + ? 0 < this.selectedBorderWidth && + ((t.lineWidth = this.selectedBorderWidth), + (t.strokeStyle = 'rgba('.concat(this.selectedBorderColor, ',').concat(this.alpha, ')')), + t.stroke()) + : 0 < this.borderWidth && + ((t.lineWidth = this.borderWidth), + (t.strokeStyle = this.strokeStyle || 'rgba('.concat(this.borderColor, ',').concat(this.alpha, ')')), + t.stroke())), + t.restore(); + }), + (this.paintShape = function (t) { + switch (this.shape) { + case 'rect': + t.DGraphRoundRect(-this.width / 2, -this.height / 2, this.width, this.height, this.borderRadius); + break; + case 'circle': + (this.radius = this.radius < 2 ? 2 : this.radius), + t.beginPath(), + t.arc(0, 0, this.radius, 0, 2 * Math.PI, !1); + break; + default: + (this.radius = this.radius < 2 ? 2 : this.radius), + t.beginPath(), + t.rect(-this.radius, -this.radius, 2 * this.radius, 2 * this.radius); + } + }), + (this.paintShadow = function (t) { + this.showShadow && + this.selected && + ((t.shadowBlur = this.shadowBlur), + (t.shadowColor = 'rgba('.concat(this.shadowColor, ',').concat(0.9 * this.alpha, ')')), + (t.shadowOffsetX = this.shadowOffsetX), + (t.shadowOffsetY = this.shadowOffsetY)); + }), + (this.getElementImage = function (t) { + var e, n, i; + if (t) + return null != (e = j.imgStore[t]) + ? e + : ((n = this), + 'string' == typeof t && + ((i = new Image()).setAttribute('crossOrigin', 'Anonymous'), + (i.src = t), + (i.onload = function () { + (j.imgStore[t] = i), n.drawFinished(); + })), + null); + }), + (this.drawFinished = function () {}), + (this.isInBound = function (t, e) { + for (var n, i, r, o, a, s, h = 0; h < this.needCheckElements.length; h++) + if (this.needCheckElements[h].isInBound(this, t, e)) return !0; + return 'rect' == this.shape + ? ((n = this.width * this.scale), + (i = this.height * this.scale), + 0 == this.rotate + ? t > this.cx - n / 2 && t < this.cx + n / 2 && e > this.cy - i / 2 && e < this.cy + i / 2 + : ((s = this.cx), + (r = this.cy), + (o = (-this.rotate * Math.PI) / 180), + (a = (t - s) * Math.cos(o) - (e - r) * Math.sin(o) + s), + (s = (t - s) * Math.sin(o) + (e - r) * Math.cos(o) + r), + a > this.cx - n / 2 && a < this.cx + n / 2 && s > this.cy - i / 2 && s < this.cy + i / 2)) + : Math.pow(t - this.cx, 2) + Math.pow(e - this.cy, 2) < Math.pow(this.radius * this.scale, 2); + }), + (this.removeHandler = function (e) { + var n = this; + this.outLinks && + (this.outLinks.forEach(function (t) { + t.source === n && e.remove(t); + }), + (this.outLinks = null)), + this.inLinks && + (this.inLinks.forEach(function (t) { + t.target === n && e.remove(t); + }), + (this.inLinks = null)); + }); +} +function Hh() { + (this.initialize = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 20; + Hh.prototype.initialize.apply(this, arguments), + (this.elementType = 'node'), + (this.nodeType = 'textNode'), + (this.shape = 'rect'), + (this.zIndex = j.Node_zIndex), + Object.assign(this, Yh), + (this.lineHeight = e || 20), + (this.label = t), + (this.textAlign = 'left'), + (this.fontStrokeWidth = 1), + (this.wrapTextCache = null); + }), + this.initialize(), + (this.paint = function (t, e) { + (this.padding = this.padding || 10), this.autoCalHeight(t), this.drawOriginalNode(t, e); + }), + (this.autoCalHeight = function (t) { + var e; + (null != this.wrapTextCache && this.label == this.wrapTextCache.text) || + ((e = this.width - 2 * this.padding), + (t.font = this.font), + (t = j.util.calcWrappedTextLines(t, this.label, e)), + (this.wrapTextCache = { text: this.label, lines: t }), + (e = t.length * this.lineHeight + (this.lineHeight / 2 + this.padding)) > this.height && (this.height = e)); + }), + (this.drawNodeImg = function (t, e, n, i, r) { + null != e && + 2 < e.width && + (t.save(), + this.alpha < 1 && (t.globalAlpha = this.alpha), + t.drawImage(e, n, i, this.width, this.height), + t.restore()); + }), + (this.drawOriginalNode = function (t, e) { + this.drawShape(t, e), + this.drawNodeImg(t, this.image, -this.width / 2, -this.height / 2, this.width / 2), + this.drawMultiLineWrappedText(t, -this.width / 2, -this.height / 2, this.lineHeight, this.padding); + }), + (this.drawMultiLineWrappedText = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, + n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0, + i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 20, + r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 10, + o = 0, + a = ('left' == this.textAlign && (o = e + r), n + i / 2 + r), + s = (t.save(), (t.textAlign = this.textAlign), (t.textBaseline = 'middle'), (t.font = this.font), !1), + h = + (this.fontColor && ((t.fillStyle = 'rgba('.concat(this.fontColor, ',').concat(this.alpha, ')')), (s = !0)), + !1); + this.fontStrokeColor && + ((t.lineWidth = this.fontStrokeWidth), + (t.strokeStyle = 'rgba('.concat(this.fontStrokeColor, ',').concat(this.alpha, ')')), + (h = !0)); + for (var c = this.wrapTextCache.lines, u = 0; u < c.length; u++) + h && t.strokeText(c[u].text, o, a + u * i), s && t.fillText(c[u].text, o, a + u * i); + t.restore(); + }), + (this.drawShape = function (t, e) { + t.save(), + t.DGraphRoundRect(-this.width / 2, -this.height / 2, this.width, this.height, this.borderRadius), + e + ? this.fillStyle + ? ((t.fillStyle = this.fillStyle), t.fill()) + : this.fillColor + ? ((t.fillStyle = 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), t.fill()) + : ((t.lineWidth = this.borderWidth), + (t.strokeStyle = 'rgba('.concat(this.borderColor, ',').concat(this.alpha, ')')), + t.stroke()) + : ((this.fillColor || e) && + (this.paintShadow(t), + (t.fillStyle = this.fillStyle || 'rgba('.concat(this.fillColor, ',').concat(this.alpha, ')')), + t.fill()), + this.lineDash && 1 < this.lineDash.length && t.setLineDash(this.lineDash), + this.showSelected || this.selected + ? 0 < this.selectedBorderWidth && + ((t.lineWidth = this.selectedBorderWidth), + (t.strokeStyle = 'rgba('.concat(this.selectedBorderColor, ',').concat(this.alpha, ')')), + t.stroke()) + : 0 < this.borderWidth && + ((t.lineWidth = this.borderWidth), + (t.strokeStyle = this.strokeStyle || 'rgba('.concat(this.borderColor, ',').concat(this.alpha, ')')), + t.stroke())), + t.restore(); + }), + (this.paintShadow = function (t) { + this.showShadow && + this.selected && + ((t.shadowBlur = this.shadowBlur), + (t.shadowColor = 'rgba('.concat(this.shadowColor, ',').concat(0.9 * this.alpha, ')')), + (t.shadowOffsetX = this.shadowOffsetX), + (t.shadowOffsetY = this.shadowOffsetY)); + }), + (this.removeHandler = function (e) { + var n = this; + this.outLinks && + (this.outLinks.forEach(function (t) { + t.source === n && e.remove(t); + }), + (this.outLinks = null)), + this.inLinks && + (this.inLinks.forEach(function (t) { + t.target === n && e.remove(t); + }), + (this.inLinks = null)); + }); +} +function Qh() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.center = [1e3, 600]), + (this.alpha = 0.99), + (this.friction = 0.8), + (this.linkDistance = 120), + (this.linkStrength = 0.03), + (this.charge = -300), + (this.gravity = 0.01), + (this.theta = 0.9), + (this.distances = []), + (this.strengths = []), + (this.charges = []), + (this.noverlap = !1), + (this.inited = !1), + (this.finished = !1), + (this.getConfig = function () { + return [ + { label: '斥力', friction: 0.85 }, + { label: '边长度', linkDistance: 150 }, + { label: '边强度', linkStrength: 0.1 }, + { label: '引力', charge: -450 }, + { label: '重力', gravity: 0.05 }, + { + label: '避免重叠', + noverlap: [ + { label: '否', value: 'false' }, + { label: '是', value: 'true' }, + ], + }, + ]; + }), + (this.addData = function (t, e) { + (this.nodes = t), (this.links = e); + }), + (this.resetConfig = function (t) { + t && + ((this.friction = Number(t.friction) || 0.8), + (this.linkDistance = Number(t.linkDistance) || 120), + (this.linkStrength = Number(t.linkStrength) || 0.03), + (this.charge = Number(t.charge) || -300), + (this.gravity = Number(t.gravity) || 0.01), + (this.noverlap = Boolean(t.noverlap) || !1), + (this.center = t.center || [1e3, 600])), + this.init(); + }), + (this.excute = function () { + if (this.inited) for (var t = 0; t++ < 3; ) this.tick(); + }), + (this.init = function () { + var t, + e, + n = this.nodes.length, + i = this.links.length; + for (this.charges = [], t = 0; t < n; ++t) + ((e = this.nodes[t]).index = t), (e.weight = 0), (e.px = e.x), (e.py = e.y), (this.charges[t] = this.charge); + for (t = 0; t < i; ++t) { + var r = (e = this.links[t]).source, + o = e.target; + (this.distances[t] = this.linkDistance), (this.strengths[t] = this.linkStrength), ++r.weight, ++o.weight; + } + this.inited = !0; + }), + (this.alpha1 = function (t) { + return arguments.length ? (this.alpha ? (this.alpha = 0 < t ? t : 0) : 0 < t && this.tick(), this) : this.alpha; + }), + (this.resume = function () { + return this.alpha1(0.8); + }), + (this.stop = function () { + return this.alpha1(0); + }), + (this.tick = function () { + var u = this; + if ((u.alpha *= 0.99) < 1e-4) (u.alpha = 1e-4), (u.finished = !0); + else { + for (var t, e, n, i, r, o, a, s, h = u.nodes.length, c = u.links.length, l = 0; l < c; ++l) + (n = (e = u.links[l]).source), + (r = (a = (i = e.target).x - n.x) * a + (s = i.y - n.y) * s) && + ((a *= r = (u.alpha * u.strengths[l] * ((r = Math.sqrt(r)) - u.distances[l])) / r), + (s *= r), + (i.x -= a * (o = n.weight / (i.weight + n.weight))), + (i.y -= s * o), + (n.x += a * (o = 1 - o)), + (n.y += s * o)); + if ((o = u.alpha * u.gravity) && ((a = u.center[0]), (s = u.center[1]), (l = -1), o)) + for (; ++l < h; ) ((e = u.nodes[l]).x += (a - e.x) * o), (e.y += (s - e.y) * o); + if (u.charge) + for (u.forceAccumulate((t = u.quadtree(u.nodes)), u.alpha, u.charges), l = -1; ++l < h; ) + (e = u.nodes[l]).fixed || + t.visit( + (function (c) { + return function (t, e, n, i, r) { + if (t.point !== c) { + var o, + a = t.cx - c.x, + s = t.cy - c.y, + h = 1 / Math.sqrt(a * a + s * s); + if ((i - e) * h < u.theta) return (o = t.charge * h * h), (c.px -= a * o), (c.py -= s * o), !0; + t.point && isFinite(h) && ((o = t.pointCharge * h * h), (c.px -= a * o), (c.py -= s * o)); + } + return !t.charge; + }; + })(e), + ); + for (l = -1; ++l < h; ) + (e = u.nodes[l]).fixed + ? ((e.x = e.px), (e.y = e.py)) + : ((e.x -= (e.px - (e.px = e.x)) * u.friction), + (e.y -= (e.py - (e.py = e.y)) * u.friction), + u.noverlap && + t.visit( + (function (c) { + var u = c.radius + 20, + l = c.x - u, + d = c.x + u, + f = c.y - u, + g = c.y + u; + return function (t, e, n, i, r) { + var o, a, s, h; + return ( + t.point && + t.point !== c && + ((o = c.x - t.point.x), + (a = c.y - t.point.y), + 0 == o && + 0 == a && + ((c.x = c.x + Math.round(10 * Math.random())), + (c.y = c.y + Math.round(10 * Math.random())), + (o = c.x - t.point.x), + (a = c.y - t.point.y)), + (s = Math.sqrt(o * o + a * a)) < (h = u + t.point.radius)) && + ((c.x -= o *= s = ((s - h) / s) * 0.5), (c.y -= a *= s), (t.point.x += o), (t.point.y += a)), + d < e || i < l || g < n || r < f + ); + }; + })(e), + )); + } + }), + (this.forceAccumulate = function (t, e, n) { + var i, + r = 0, + o = 0; + if (((t.charge = 0), !t.leaf)) + for (var a, s = t.nodes, h = s.length, c = -1; ++c < h; ) + null != (a = s[c]) && + (this.forceAccumulate(a, e, n), (t.charge += a.charge), (r += a.charge * a.cx), (o += a.charge * a.cy)); + t.point && + (t.leaf || ((t.point.x += Math.random()), (t.point.y += Math.random())), + (i = this.alpha * this.charges[t.point.index]), + (t.charge += t.pointCharge = i), + (r += i * t.point.x), + (o += i * t.point.y)), + (t.cx = r / t.charge), + (t.cy = o / t.charge); + }), + (this.quadtree = function (t) { + var e, + n = -1, + i = t.length; + i && + isNaN(t[0].x) && + (t = t.map(function (t) { + return { x: t[0], y: t[1] }; + })); + for (var r = 1 / 0, o = 1 / 0, a = -1 / 0, s = -1 / 0; ++n < i; ) + (e = t[n]).x < r && (r = e.x), e.y < o && (o = e.y), e.x > a && (a = e.x), e.y > s && (s = e.y); + var h = a - r, + c = s - o; + function l(t, e, n, i, r, o) { + var a; + isNaN(e.x) || + isNaN(e.y) || + (t.leaf + ? (a = t.point) + ? (Math.abs(a.x - e.x) + Math.abs(a.y - e.y) < 0.1 || ((t.point = null), u(t, a, n, i, r, o)), + u(t, e, n, i, r, o)) + : (t.point = e) + : u(t, e, n, i, r, o)); + } + function u(t, e, n, i, r, o) { + var a = 0.5 * (n + r), + s = 0.5 * (i + o), + h = e.x >= a, + c = e.y >= s, + u = (c << 1) + h; + (t.leaf = !1), + h ? (n = a) : (r = a), + c ? (i = s) : (o = s), + l((t = t.nodes[u] || (t.nodes[u] = { leaf: !0, nodes: [], point: null })), e, n, i, r, o); + } + c < h ? (s = o + h) : (a = r + c); + var d = { + leaf: !0, + nodes: [], + point: null, + add: function (t) { + l(d, t, r, o, a, s); + }, + visit: function (t) { + !(function t(e, n, i, r, o, a) { + var s, h; + e(n, i, r, o, a) || + ((s = 0.5 * (i + o)), + (h = 0.5 * (r + a)), + (n = n.nodes)[0] && t(e, n[0], i, r, s, h), + n[1] && t(e, n[1], s, r, o, h), + n[2] && t(e, n[2], i, h, s, a), + n[3] && t(e, n[3], s, h, o, a)); + })(t, d, r, o, a, s); + }, + }; + return t.forEach(d.add), d; + }); +} +function Jh() { + (this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []), + (this.maxPadding = 10), + (this.inited = !1), + (this.maxIterations = 0), + (this.finished = !1), + (this.excute = function () { + this.inited && this.run(); + }), + (this.getConfig = function () { + return [{ label: '间距', maxPadding: this.maxPadding }]; + }), + (this.resetConfig = function (t) { + t && ((this.maxPadding = Number(t.maxPadding) || 5), this.maxPadding < 0) && (this.maxPadding = 0), this.init(); + }), + (this.addData = function () { + this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; + }), + (this.init = function () { + (this.inited = !0), (this.maxIterations = 0); + }), + (this.run = function () { + var t, + e, + n = this; + n.inited && + ((t = n.nodes.length / 2), + n.maxIterations++ < t + ? ((e = n.quadtree(n.nodes)), + n.nodes.forEach(function (t) { + var c, u, l, d, f, g; + e.visit( + ((u = (c = t).radius * c.scale * 2 + n.maxPadding), + (l = c.x - u), + (d = c.x + u), + (f = c.y - u), + (g = c.y + u), + function (t, e, n, i, r) { + var o, a, s, h; + return ( + t.point && + t.point !== c && + ((o = c.x - t.point.x), + (a = c.y - t.point.y), + 0 == o && + 0 == a && + ((c.x = c.x + Math.round(10 * Math.random())), + (c.y = c.y + Math.round(10 * Math.random())), + (o = c.x - t.point.x), + (a = c.y - t.point.y)), + (s = Math.sqrt(o * o + a * a)) < (h = u + t.point.radius)) && + ((c.x -= o *= s = ((s - h) / s) * 0.5), (c.y -= a *= s), (t.point.x += o), (t.point.y += a)), + d < e || i < l || g < n || r < f + ); + }), + ); + })) + : (n.finished = !0)); + }), + (this.quadtree = function (t) { + var e, + n = -1, + i = t.length; + i && + isNaN(t[0].x) && + (t = t.map(function (t) { + return { x: t[0], y: t[1] }; + })); + for (var r = 1 / 0, o = 1 / 0, a = -1 / 0, s = -1 / 0; ++n < i; ) + (e = t[n]).x < r && (r = e.x), e.y < o && (o = e.y), e.x > a && (a = e.x), e.y > s && (s = e.y); + var h = a - r, + c = s - o; + function l(t, e, n, i, r, o) { + var a; + isNaN(e.x) || + isNaN(e.y) || + (t.leaf + ? (a = t.point) + ? (Math.abs(a.x - e.x) + Math.abs(a.y - e.y) < 0.01 || ((t.point = null), u(t, a, n, i, r, o)), + u(t, e, n, i, r, o)) + : (t.point = e) + : u(t, e, n, i, r, o)); + } + function u(t, e, n, i, r, o) { + var a = 0.5 * (n + r), + s = 0.5 * (i + o), + h = e.x >= a, + c = e.y >= s, + u = (c << 1) + h; + (t.leaf = !1), + h ? (n = a) : (r = a), + c ? (i = s) : (o = s), + l((t = t.nodes[u] || (t.nodes[u] = { leaf: !0, nodes: [], point: null })), e, n, i, r, o); + } + c < h ? (s = o + h) : (a = r + c); + var d = { + leaf: !0, + nodes: [], + point: null, + add: function (t) { + l(d, t, r, o, a, s); + }, + visit: function (t) { + !(function t(e, n, i, r, o, a) { + var s, h; + e(n, i, r, o, a) || + ((s = 0.5 * (i + o)), + (h = 0.5 * (r + a)), + (n = n.nodes)[0] && t(e, n[0], i, r, s, h), + n[1] && t(e, n[1], s, r, o, h), + n[2] && t(e, n[2], i, h, s, a), + n[3] && t(e, n[3], s, h, o, a)); + })(t, d, r, o, a, s); + }, + }; + return t.forEach(d.add), d; + }); +} +function Kh() { + (this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []), + (this.defaults = { + center: [0, 0], + startAngle: Math.PI, + clockwise: !0, + equidistant: !1, + avoidOverlap: !0, + minNodeSpacing: 10, + maxNodeSize: 70, + levelWidth: 1, + }), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.getConfig = function () { + return [ + { label: '节点大小', maxNodeSize: 70 }, + { label: '分层系数', levelWidth: 1 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.defaults.maxNodeSize = Number(t.maxNodeSize) || 70), + (this.defaults.levelWidth = Number(t.levelWidth) || 1), + (this.defaults.center = t.center || [0, 0])), + this.init(); + }), + (this.addData = function () { + this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.init = function () { + for ( + var t = this.defaults, + e = this.nodes, + n = { x1: this.defaults.center[0], y1: this.defaults.center[1], w: 5 * t.maxNodeSize, h: 5 * t.maxNodeSize }, + i = n.x1, + r = n.y1, + o = [], + a = 0; + a < e.length; + a++ + ) { + var s = e[a], + h = (s.inLinks || []).length + (s.outLinks || []).length; + o.push({ value: h, node: s }); + } + o.sort(function (t, e) { + return e.value - t.value; + }); + for (var c = t.levelWidth, u = [[]], l = u[0], d = 0; d < o.length; d++) { + var f = o[d]; + 0 < l.length && Math.abs(l[0].value - f.value) >= c && u.push((l = [])), l.push(f); + } + var g, + p = t.maxNodeSize + t.minNodeSpacing; + t.avoidOverlap && + ((g = 0 < u.length && 1 < u[0].length), + (n = (Math.min(n.w, n.h) / 2 - p) / (u.length + g ? 1 : 0)), + (p = Math.min(p, n))); + for (var y = 0, v = 0; v < u.length; v++) { + var m, + x = u[v], + w = 2 * Math.PI - (2 * Math.PI) / x.length, + w = (x.dTheta = w / Math.max(1, x.length - 1)); + 1 < x.length && + t.avoidOverlap && + ((m = Math.cos(w) - Math.cos(0)), + (w = Math.sin(w) - Math.sin(0)), + (m = Math.sqrt((p * p) / (m * m + w * w))), + (y = Math.max(m, y))), + (x.r = y), + (y += p); + } + if (t.equidistant) { + for (var b = 0, k = 0, M = 0; M < u.length; M++) var E = u[M].r - k, b = Math.max(b, E); + for (var k = 0, C = 0; C < u.length; C++) { + var T = u[C]; + 0 === C && (k = T.r), (T.r = k), (k += b); + } + } + for (var N = 0; N < u.length; N++) + for (var _ = u[N], L = _.dTheta, S = _.r, P = 0; P < _.length; P++) { + var A = _[P], + O = t.startAngle + (this.clockwise ? 1 : -1) * L * P, + I = i + S * Math.cos(O), + O = r + S * Math.sin(O), + D = this.newLayoutData(); + (D.finishx = I), + (D.finishy = O), + (D.xdistance = (1 / this.intSteps) * (I - A.node.x)), + (D.ydistance = (1 / this.intSteps) * (O - A.node.y)), + (A.node.layoutData = D); + } + (this.inited = !0), (this.finishedCount = 0); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }); +} +function Zh() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.center = [0, 0]), + (this.layerSpace = 160), + (this.nodeSpace = 80), + (this.treeSpacing = 60), + (this.direction = 'UD'), + (this.sortType = 'selected'), + (this.treeIndex = -1), + (this.continueOrBreak = 0), + (this.boolTransition = !0), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.noverlap = !1), + (this.avoidFinished = !1), + (this.minNodeMargin = 10), + (this.getConfig = function () { + return [ + { label: '层间距', layerSpace: 160 }, + { label: '点间距', nodeSpace: 80 }, + { + label: '排列方式', + sortType: [ + { label: '连线方向', value: 'directed' }, + { label: '度大小', value: 'hubsize' }, + { label: '指定点', value: 'selected' }, + ], + }, + { + label: '排列方向', + direction: [ + { label: '上下', value: 'UD' }, + { label: '下上', value: 'DU' }, + { label: '左右', value: 'LR' }, + { label: '右左', value: 'RL' }, + ], + }, + { + label: '避免重叠', + noverlap: [ + { label: '否', value: 'false' }, + { label: '是', value: 'true' }, + ], + }, + { label: '最小点间距', minNodeMargin: 10 }, + ]; + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.resetConfig = function (t) { + t && + ((this.layerSpace = Number(t.layerSpace) || 160), + (this.nodeSpace = Number(t.nodeSpace) || 80), + (this.sortType = t.sortType || 'directed'), + (this.direction = t.direction || 'UD'), + (this.noverlap = Boolean(t.noverlap) || !1), + (this.minNodeMargin = Number(t.minNodeMargin) || 10), + (this.center = t.center || [0, 0])), + this.init(); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.init = function () { + var r = this, + o = + ((r.treeIndex = -1), + (r.continueOrBreak = 0), + (r.nodeIdList = []), + (r.selectedNodeIds = null), + (r.positionedNodes = {}), + (r.hierarchicalLevels = {}), + (r.hierarchicalTrees = {}), + (r.lastNodeOnLevel = {}), + (r.hierarchicalChildrenReference = {}), + (r.distributionIndex = {}), + (r.distributionOrdering = {}), + (r.distributionOrderingPresence = {}), + (r.nodesIdMap = {}), + (r.edges = {}), + (r.definedLevels = {}), + r.setData(), + r.setupHierarchicalLayout(), + r.computeCenter()); + r.nodes.forEach(function (t) { + var e = String(t.id), + n = r.nodesIdMap[e], + e = ((t.treeLevel = r.hierarchicalLevels[e]), 0), + i = 0, + i = 'DU' == r.direction ? ((e = n.x), -n.y) : ((e = 'RL' == r.direction ? -n.x : n.x), n.y), + n = ((e += o.x), (i += o.y), r.newLayoutData()); + (n.finishx = e), + (n.finishy = i), + (n.xdistance = 0.02 * (e - t.x)), + (n.ydistance = 0.02 * (i - t.y)), + (t.layoutData = n); + }), + (r.inited = !0), + (this.finishedCount = 0), + (this.finished = !1); + }), + (this.computeCenter = function () { + var e = this, + n = 1 / 0, + i = -1 / 0, + r = 1 / 0, + o = -1 / 0; + return ( + e.nodeIdList.forEach(function (t) { + t = e.nodesIdMap[t]; + (r = Math.min(r, t.x)), (o = Math.max(o, t.x)), (n = Math.min(n, t.y)), (i = Math.max(i, t.y)); + }), + { x: e.center[0] - (o - r) / 2, y: e.center[1] - (i - n) / 2 } + ); + }), + (this.setData = function () { + var i = this, + r = []; + i.nodes.forEach(function (t) { + var e = String(t.id), + n = i.NodeLocal(e); + (i.nodesIdMap[e] = n), + i.nodeIdList.push(e), + t.definedLevel && (i.definedLevels[e] = t.definedLevel), + 1 == t.selected && r.push(e); + }), + i.links.forEach(function (t, e) { + var e = String(e + 1), + t = i.Edge(t.source.id, t.target.id, e), + n = (i.edges[e] = t).fromId, + t = t.toId, + n = i.nodesIdMap[n], + n = (-1 == n.edgesIds.indexOf(e) && n.edgesIds.push(e), i.nodesIdMap[t]); + -1 == n.edgesIds.indexOf(e) && n.edgesIds.push(e); + }), + 'selected' == i.sortType && (i.selectedNodeIds = r); + }), + (this.setupHierarchicalLayout = function () { + var e = this, + t = + ('hubsize' == e.sortType + ? e.determineLevelsByHubsize() + : 'selected' == e.sortType + ? e.determineLevelsBySelected() + : ((e.sortType = 'directed'), e.determineLevelsByDirected()), + e.nodeIdList.forEach(function (t) { + null == e.hierarchicalLevels[t] && (e.hierarchicalLevels[t] = 0), + null != e.definedLevels[t] && (e.hierarchicalLevels[t] = Math.max(e.definedLevels[t] - 1, 0)); + }), + e.getDistribution()); + e.crawlNetwork('generateMap', -1), e.placeNodesByHierarchy(t), e.condenseHierarchy(); + }), + (this.determineLevelsByDirected = function () { + var e = this, + n = (e.crawlNetwork('determineLevelsByDirected', -1), 1 / 0); + e.nodeIdList.forEach(function (t) { + null != e.hierarchicalLevels[t] && (n = Math.min(e.hierarchicalLevels[t], n)); + }), + e.nodeIdList.forEach(function (t) { + null != e.hierarchicalLevels[t] && (e.hierarchicalLevels[t] = e.hierarchicalLevels[t] - n); + }); + }), + (this.determineLevelsBySelected = function () { + var e = this; + null != e.selectedNodeIds && + (e.selectedNodeIds.forEach(function (t) { + e.hierarchicalLevels[t] = 0; + }), + e.selectedNodeIds.forEach(function (t) { + null != e.nodesIdMap[t] && e.crawlNetwork('determineLevelsByHubsize', t); + })), + e.determineLevelsByHubsize(); + }), + (this.NodeLocal = function (t) { + return { id: t, edgesIds: [], x: 0.5, y: 0.5 }; + }), + (this.Edge = function (t, e, n) { + return { id: n, fromId: t, toId: e }; + }), + (this.determineLevelsByHubsize = function () { + for (var e = this, n = 1; 0 < n; ) { + var i = 0; + if ( + (e.nodeIdList.forEach(function (t) { + t = e.nodesIdMap[t]; + null == e.hierarchicalLevels[t.id] && (i = t.edgesIds.length <= i ? i : t.edgesIds.length); + }), + 0 == (n = i)) + ) + return; + e.nodeIdList.forEach(function (t) { + t = e.nodesIdMap[t]; + t.edgesIds.length == n && e.crawlNetwork('determineLevelsByHubsize', t.id); + }); + } + }), + (this.condenseHierarchy = function () { + for (var t, e, n = 1 / 0, i = -1 / 0, r = 0; r < this.treeIndex; r++) { + for (var o in this.hierarchicalTrees) + 0 == r && this.hierarchicalTrees[o] == r && (e = this.getPositionForHierarchy(this.nodesIdMap[o])), + this.hierarchicalTrees[o] == r + 1 && + ((e = this.getPositionForHierarchy(this.nodesIdMap[o])), (n = Math.min(e, n)), (i = Math.max(e, i))); + for (var o in this.hierarchicalTrees) + this.hierarchicalTrees[o] == r + 1 && + ((t = this.nodesIdMap[o]), + (e = this.getPositionForHierarchy(t)), + this.setPositionForHierarchy(t, e + 0 + this.treeSpacing, -1)); + this.treeSpacing, this.treeSpacing; + } + }), + (this.shiftToCenter = function () { + var n = this, + i = 1 / 0, + e = -1 / 0, + r = 1 / 0, + o = -1 / 0, + t = + (n.nodeIdList.forEach(function (t) { + t = n.nodesIdMap[t]; + (r = Math.min(r, t.x)), (o = Math.max(o, t.x)), (i = Math.min(i, t.y)), (e = Math.max(e, t.y)); + }), + o - r), + a = e - i, + s = 1, + h = 1; + 5e3 < t && (s = 5e3 / t), + 3e3 < a && (h = 3e3 / a), + n.nodeIdList.forEach(function (t) { + var t = n.nodesIdMap[t], + e = t.x, + e = ((t.x = Math.round((e - r) * s)), t.y); + t.y = Math.round((e - i) * h); + }); + }), + (this.getDistribution = function () { + var i = this, + r = {}; + return ( + i.nodeIdList.forEach(function (t) { + var e = i.nodesIdMap[t], + t = null == i.hierarchicalLevels[t] ? 1 : i.hierarchicalLevels[t], + n = + ('UD' == i.direction || 'DU' == i.direction ? (e.y = i.layerSpace * t) : (e.x = i.layerSpace * t), r[t]); + (n = null == n ? [] : n).push(e), (r[t] = n); + }), + r + ); + }), + (this.crawlNetwork = function (n, t) { + var i, + r = this, + o = {}; + -1 == t + ? ((i = 0), + r.nodeIdList.forEach(function (t) { + var e = r.nodesIdMap[t]; + null == o[t] && (o = r.crawler(o, e, n, i)), i++; + })) + : ((t = r.nodesIdMap[t]), (o = r.crawler(o, t, n, -111))); + }), + (this.crawler = function (t, e, n, i) { + if (null == t[e.id]) { + -111 != i && + null == this.hierarchicalTrees[e.id] && + ((this.hierarchicalTrees[e.id] = i), (this.treeIndex = Math.max(i, this.treeIndex))), + (t[e.id] = !0); + for (var r = e.edgesIds.length, o = 0; o < r; o++) { + var a = e.edgesIds[o], + a = this.edges[a]; + null != (a = a.toId == e.id ? this.nodesIdMap[a.fromId] : this.nodesIdMap[a.toId]) && + e.id != a.id && + ('determineLevelsByHubsize' == n + ? this.levelDownstream(e, a) + : 'determineLevelsByDirected' == n + ? this.levelByDirection(e, a) + : 'generateMap' == n && this.fillInRelations(e, a), + this.crawler(t, a, n, i)); + } + } + return t; + }), + (this.levelDownstream = function (t, e) { + null == this.hierarchicalLevels[e.id] && + (null == this.hierarchicalLevels[t.id] && (this.hierarchicalLevels[t.id] = 0), + (this.hierarchicalLevels[e.id] = this.hierarchicalLevels[t.id] + 1)); + }), + (this.levelByDirection = function (t, e) { + null == this.hierarchicalLevels[t.id] && (this.hierarchicalLevels[t.id] = 1), + null == this.hierarchicalLevels[e.id] && (this.hierarchicalLevels[e.id] = this.hierarchicalLevels[t.id] + 1); + }), + (this.fillInRelations = function (t, e) { + this.hierarchicalLevels[e.id] > this.hierarchicalLevels[t.id] && + (null == this.hierarchicalChildrenReference[t.id] && (this.hierarchicalChildrenReference[t.id] = []), + this.hierarchicalChildrenReference[t.id].push(e.id)); + }), + (this.placeNodesByHierarchy = function (t) { + for (var e in t) + for (var n = t[e], i = 0, r = n.length, o = 0; o < r; o++) { + var a, + s = n[o]; + null == this.positionedNodes[s.id] && + ((a = this.nodeSpace * i), + 0 < i && (a = this.getPositionForHierarchy(n[o - 1]) + this.nodeSpace), + this.setPositionForHierarchy(s, a, e), + this.validataPositionAndContinue(s, e, a), + i++); + } + }), + (this.getPositionForHierarchy = function (t) { + return 'UD' == this.direction || 'DU' == this.direction ? t.x : t.y; + }), + (this.setPositionForHierarchy = function (t, e, n) { + -1 != n && + (null == this.distributionOrdering[n] && + ((this.distributionOrdering[n] = []), (this.distributionOrderingPresence[n] = {})), + null == this.distributionOrderingPresence[n][t.id] && + (this.distributionOrdering[n].push(t), + (this.distributionIndex[t.id] = this.distributionOrdering[n].length - 1)), + (this.distributionOrderingPresence[n][t.id] = !0)), + 'UD' == this.direction || 'DU' == this.direction ? (t.x = e) : (t.y = e); + }), + (this.shiftBlock = function (t, e) { + 'UD' == this.direction || 'DU' == this.direction ? (this.nodesIdMap[t].x += e) : (this.nodesIdMap[t].y += e); + }), + (this.placeBranchNodes = function (t, e) { + if (null != this.hierarchicalChildrenReference[t.id]) { + for (var n = [], i = this.hierarchicalChildrenReference[t.id].length, r = 0; r < i; r++) + n.push(this.nodesIdMap[this.hierarchicalChildrenReference[t.id][r]]); + for (var o = n.length, r = 0; r < o; r++) { + var a, + s = n[r], + h = this.hierarchicalLevels[s.id]; + e < h && + null == this.positionedNodes[s.id] && + ((a = + (a = 0) == r + ? this.getPositionForHierarchy(this.nodesIdMap[t.id]) + : this.getPositionForHierarchy(n[r - 1]) + this.nodeSpace), + this.setPositionForHierarchy(s, a, h), + this.validataPositionAndContinue(s, h, a)); + } + var c = 1 / 0, + u = -1 / 0; + for (r = 0; r < o; r++) + (s = n[r]), + (c = Math.min(c, this.getPositionForHierarchy(s))), + (u = Math.max(u, this.getPositionForHierarchy(s))); + this.setPositionForHierarchy(t, (c + u) / 2, e); + } + }), + (this.validataPositionAndContinue = function (t, e, n) { + var i; + null != this.lastNodeOnLevel[e] && + n - (i = this.getPositionForHierarchy(this.nodesIdMap[this.lastNodeOnLevel[e]])) < this.nodeSpace && + ((i = i + this.nodeSpace - n), this.shiftBlock(t.id, i)), + (this.lastNodeOnLevel[e] = t.id), + (this.positionedNodes[t.id] = !0), + this.placeBranchNodes(t, e); + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + (this.finished = this.finishedCount >= n), + this.noverlap && this.finished && !this.avoidFinished && (this.avoidOverLap(), (this.avoidFinished = !0)); + }), + (this.avoidOverLap = function () { + var t, + i = {}, + e = + (this.nodes.forEach(function (t) { + var e = t.treeLevel, + n = i[e]; + null != n ? n.push(t) : (i[e] = [t]); + }), + this.nodes.length), + n = this.minNodeMargin, + r = -1 != ['LR', 'RL'].indexOf(this.direction) ? 'y' : 'x'; + for (t in i) { + var o = i[t]; + 1 < o.length && + (e <= 100 + ? function t(e, n) { + var i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 10; + e.sort(function (t, e) { + return t[n] >= e[n] ? 1 : -1; + }); + for (var r = 0; r < e.length - 1; r++) + for (var o = e[r], a = r + 1; a < e.length; a++) { + var s = e[a], + h = Math.abs(s[n] - o[n]); + h <= o.radius + s.radius + i && ((e[r][n] -= i), (e[a][n] += i), t(e, n, i)); + } + } + : function (t, n) { + var e = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 10; + t.sort(function (t, e) { + return t[n] >= e[n] ? 1 : -1; + }); + for (var i = 0; i < t.length - 1; i++) { + var r = t[i], + o = t[i + 1], + a = Math.abs(o[n] - r[n]), + s = r.radius; + if (a < s + o.radius + e) + for (var h = i + 1; h < t.length; h++) + Math.abs(t[h][n] - t[h - 1][n]) <= t[h - 1].radius + t[h].radius + e && + (t[h][n] += t[h].radius + s + e); + } + })(o, r, n); + } + }); +} +function $h() { + (this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []), + (this.nodeSpace = 120), + (this.layerSpace = 120), + (this.center = [100, 100]), + (this.splitType = 2), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.getConfig = function () { + return [ + { label: '水平间距', nodeSpace: 120 }, + { label: '垂直间距', layerSpace: 120 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.nodeSpace = Number(t.nodeSpace) || 120), + (this.layerSpace = Number(t.layerSpace) || 120), + (this.center = t.center || [100, 100]), + (this.splitType = Number(t.splitType) || 2), + this.init()); + }), + (this.addData = function () { + this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.init = function () { + var t = [].concat(this.nodes), + e = + (t.sort(function (t, e) { + return ( + (e.inLinks || []).length + + (e.outLinks || []).length - + ((t.inLinks || []).length + (t.outLinks || []).length) + ); + }), + this.nodes.length), + n = Math.round(Math.sqrt(e)) + 1, + i = Math.round(Math.sqrt(e)) + 1, + r = 0, + o = 0, + a = 0, + s = 0; + s = + 1 == this.splitType + ? ((a = this.center[0] - ((r = n) / 2) * this.nodeSpace + this.nodeSpace), + this.center[1] - ((o = i) / 2) * this.layerSpace + this.layerSpace) + : ((n = (r = Math.round(Math.sqrt(e / 2)) + 1) - n), + (i = (o = Math.round(2 * r) + 1) - i), + (a = this.center[0] - (r / 2) * this.nodeSpace + n * this.nodeSpace), + this.center[1] - (o / 2) * this.layerSpace + i * this.layerSpace); + for (var h, c, u, l, d = 0, f = 0; f < r; f++) + for (var g = 0; g < o; g++) + e <= d || + ((h = f * this.nodeSpace), + (c = g * this.layerSpace), + (c += a), + (h += s), + (u = t[d++]), + ((l = this.newLayoutData()).finishx = c), + (l.finishy = h), + (l.xdistance = (1 / this.intSteps) * (c - u.x)), + (l.ydistance = (1 / this.intSteps) * (h - u.y)), + (u.layoutData = l)); + (this.inited = !0), (this.finishedCount = 0); + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }); +} +function tc() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.VECTOR_D1 = []), + (this.VECTOR_D2 = []), + (this.lij = []), + (this.kij = []), + (this.tempNodes = []), + (this.center = [0, 0]), + (this.realSize = 2e3), + (this.tempSize = 1), + (this.sizeScale = 1.3), + (this.inited = !1), + (this.finished = !1), + (this.getConfig = function () { + return [{ label: '缩放比例', sizeScale: sizeScale }]; + }), + (this.resetConfig = function (t) { + t && ((this.sizeScale = Number(t.sizeScale) || 1.3), (this.center = t.center || [0, 0]), this.init()); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.excute = function () { + for (var t = 0; t++ < 100 && this.inited; ) this.run(); + }), + (this.init = function () { + var n = this, + t = n.nodes, + e = t.length, + i = n.tempSize, + h = + ((n.nodeIdMapNode = {}), + (n.nodeIdIndex = {}), + (n.tempNodes = []), + (n.VECTOR_D1 = []), + (n.VECTOR_D2 = []), + (n.lij = []), + (n.kij = []), + (this.realSize = this.setRegionSize(e)), + t.forEach(function (t, e) { + (n.nodeIdMapNode[t.id] = t), + (n.nodeIdIndex[t.id] = e), + n.tempNodes.push({ id: t.id, x: t.x / (n.realSize / n.tempSize), y: t.y / (n.realSize / n.tempSize) }); + }), + []), + c = [], + t = n.floydWarshall(e), + e = n.getMaxDij(e, t), + u = (n.getKijLij(i, e, t, c, h), []), + l = []; + n.tempNodes.forEach(function (r, o) { + var a = 0, + s = 0; + n.tempNodes.forEach(function (t, e) { + var n, i; + o != e && + ((n = r.x - t.x), + (t = r.y - t.y), + (i = Math.sqrt(n * n + t * t)), + (a += c[o][e] * (n - (h[o][e] * n) / i)), + (s += c[o][e] * (t - (h[o][e] * t) / i))); + }), + (u[o] = a), + (l[o] = s); + }), + (n.VECTOR_D1 = u), + (n.VECTOR_D2 = l), + (n.lij = h), + (n.kij = c), + (n.inited = !0); + }), + (this.run = function () { + for (var t, e, n = this.tempNodes.length, i = 0, r = 0, o = 0, a = 0, s = -1, h = 0; h < n; h++) { + var c = this.VECTOR_D1[h] * this.VECTOR_D1[h] + this.VECTOR_D2[h] * this.VECTOR_D2[h]; + s < c && ((a = h), (s = c)); + } + if (s <= 1e-8) this.finished = !0; + else { + for (var u, l, d, f, g, p, y, v, m, x, w = this.tempNodes[a], b = w.x, k = w.y, h = 0; h < n; h++) + h != a && + ((d = (u = b - (f = this.tempNodes[h]).x) * u + (l = k - f.y) * l), + (d = Math.sqrt(d) * d), + (i += this.kij[a][h] * (1 - (this.lij[a][h] * l * l) / d)), + (r += this.kij[a][h] * ((this.lij[a][h] * u * l) / d)), + (o += this.kij[a][h] * (1 - (this.lij[a][h] * u * u) / d))); + for ( + t = b + -((M = this.VECTOR_D1[a]) + r * (M = (r * M - this.VECTOR_D2[a] * i) / (o * i - r * r))) / i, + e = k + M, + h = this.VECTOR_D1[a] = this.VECTOR_D2[a] = 0; + h < n; + h++ + ) + h != a && + ((g = b - (f = this.tempNodes[h]).x), + (p = k - f.y), + (y = Math.sqrt(g * g + p * p)), + (v = t - f.x), + (m = e - f.y), + (x = Math.sqrt(v * v + m * m)), + (this.VECTOR_D1[h] -= this.kij[a][h] * (-g + (this.lij[a][h] * g) / y)), + (this.VECTOR_D2[h] -= this.kij[a][h] * (-p + (this.lij[a][h] * p) / y)), + (this.VECTOR_D1[h] += this.kij[a][h] * (-v + (this.lij[a][h] * v) / x)), + (this.VECTOR_D2[h] += this.kij[a][h] * (-m + (this.lij[a][h] * m) / x)), + (this.VECTOR_D1[a] += this.kij[a][h] * (v - (this.lij[a][h] * v) / x)), + (this.VECTOR_D2[a] += this.kij[a][h] * (m - (this.lij[a][h] * m) / x))); + (w.x = t), (w.y = e); + var M = this.nodeIdMapNode[w.id]; + (M.x = t * (this.realSize / this.tempSize)), (M.y = e * (this.realSize / this.tempSize)); + } + }), + (this.getMaxDij = function (t, e) { + for (var n = 0, i = 0; i < t; i++) + for (var r = i + 1; r < t; r++) e[i][r] != 1 / 0 && e[i][r] > n && (n = e[i][r]); + for (i = 0; i < t; i++) for (r = 0; r < t; r++) e[i][r] == 1 / 0 && (e[i][r] = n); + return n; + }), + (this.getKijLij = function (t, e, n, i, r) { + for (var o = t / e, a = this.tempNodes.length, s = 0; s < a; s++) { + (i[s] = []), (r[s] = []); + for (var h = 0; h < a; h++) { + var c = n[s][h] * n[s][h]; + s != h && ((i[s][h] = Math.pow(a, 2) / c), (r[s][h] = o * n[s][h])); + } + } + }), + (this.floydWarshall = function (t) { + for (var n = this, i = [], e = 0; e < t; e++) { + i[e] = []; + for (var r = 0; r < t; r++) i[e][r] = e != r ? 1 / 0 : 0; + } + n.links.forEach(function (t) { + var e = n.nodeIdIndex[t.source.id], + t = n.nodeIdIndex[t.target.id]; + (i[e][t] = 1), (i[t][e] = 1); + }); + for (var o = 0; o < t; o++) + for (e = 0; e < t; e++) + for (r = e + 1; r < t; r++) { + var a = i[e][o] + i[o][r]; + a < i[e][r] && ((i[e][r] = a), (i[r][e] = a)); + } + return i; + }), + (this.setRegionSize = function (t) { + var e = Math.log(300), + n = Math.log(600) - e; + return Math.round((9700 * (Math.log(Math.min(t, 1e4) / 10 + 300) - e)) / n + 300) * this.sizeScale; + }); +} +function ec() { + var u = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = u), + (this.links = t), + (this.boolTransition = !0), + (this.scale = 1.1), + (this.center = [0, 0]), + (this.ordering = 'degree'), + (this.intSteps = 50), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.getConfig = function () { + return [ + { label: '中心位置', center: [0, 0] }, + { label: '间隔比例', scale: 1.1 }, + { label: '排序方式', ordering: 'degree' }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.center = t.center || [0, 0]), + (this.ordering = t.ordering || 'degree'), + (this.scale = Number(t.scale) || 1.1)), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.init = function () { + var n, + i, + r, + o = this, + t = [], + e = + ('degree' == o.ordering + ? (t = t.concat(o.nodes)).sort(function (t, e) { + return ( + (e.inLinks || []).length + + (e.outLinks || []).length - + ((t.inLinks || []).length + (t.outLinks || []).length) + ); + }) + : (t = 'topology' == o.ordering ? o.topologyOrdering() : u), + t.length < 5 && (o.scale = 2.5), + t.length < 10 ? (o.scale = 2) : t.length < 20 && (o.scale = 1.5), + 0), + a = + (t.forEach(function (t) { + e += t.scale * t.radius * 2 * o.scale; + }), + (e *= o.scale) / Math.PI), + s = (2 * Math.PI) / e, + h = 0, + c = a / 2; + t.forEach(function (t) { + (n = t.scale * t.radius * 2), + (r = s * n * o.scale), + (i = o.center[0] + c * Math.cos(h + r)), + (r = o.center[1] + c * Math.sin(h + r)), + (h += n * o.scale * s * o.scale); + var e = o.newLayoutData(); + (e.finishx = i), + (e.finishy = r), + (e.xdistance = (1 / o.intSteps) * (i - t.x)), + (e.ydistance = (1 / o.intSteps) * (r - t.y)), + (t.layoutData = e); + }), + (this.inited = !0), + (this.finishedCount = 0); + }), + (this.topologyOrdering = function () { + var s = this, + h = s.links, + c = s.nodes, + u = {}, + l = + (c.forEach(function (t, e) { + u[t.id] = e; + }), + s.getDegree(c.length, u, h)), + d = ((s.degrees = l), [c[0]]), + f = c.length, + g = [], + p = (s.initHierarchy(c, h, u, !(g[0] = !0)), 0); + return ( + c.forEach(function (t, e) { + if (0 !== e) + if ((e !== f - 1 && l[e] === l[e + 1] && !s.connect(d[p], t, h)) || !0 === g[e]) { + for (var n = d[p].children, i = !1, r = 0; r < n.length; ++r) { + var o = u[n[r].id]; + if (l[o] === l[e] && !0 !== g[o]) { + d.push(c[o]), (i = g[o] = !0); + break; + } + } + for (var a = 0; !i && (g[a] || (d.push(c[a]), (i = g[a] = !0)), ++a !== f); ); + } else d.push(t), (g[e] = !0), p++; + }), + d + ); + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.initHierarchy = function (n, t, i, e) { + n.forEach(function (t, e) { + (t.children = []), (t.parent = []); + }), + e + ? t.forEach(function (t) { + var e = i[t.source.id], + t = i[t.target.id]; + n[e].children.push(n[t]), n[t].parent.push(n[e]); + }) + : t.forEach(function (t) { + var e = i[t.source.id], + t = i[t.target.id]; + n[e].children.push(n[t]), n[t].children.push(n[e]); + }); + }), + (this.connect = function (t, e, n) { + for (var i = n.length, r = 0; r < i; r++) + if ( + (t.id === n[r].source.id && e.id === n[r].target.id) || + (e.id === n[r].source.id && t.id === n[r].target.id) + ) + return !0; + return !1; + }), + (this.getDegree = function (t, e, n) { + for (var i = [], r = 0; r < t; r++) i[r] = 0; + return ( + n.forEach(function (t) { + (i[e[t.source.id]] += 1), (i[e[t.target.id]] += 1); + }), + i + ); + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }); +} +function nc() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.MAX_DISPLACEMENT_SQUARED = 50), + (this.CONVERGENT_MAX_TIMES = 2), + (this.CONVERGENT_MOVEMENT = 5), + (this.L = 130), + (this.K_r = 1e6), + (this.K_s = 0.5), + (this.delta_t = 0.015625), + (this.center = [0, 0]), + (this.inited = !1), + (this.finished = !1), + (this.excute = function () { + this.inited && this.run(); + }), + (this.getConfig = function () { + return [{ label: '收敛系数', movement: this.CONVERGENT_MOVEMENT }]; + }), + (this.resetConfig = function (t) { + t && (this.center = t.center || [0, 0]), this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.init = function () { + (this.inited = !0), (this.finished = !1); + }), + (this.run = function () { + var n = this, + i = !1; + n.CONVERGENT_MAX_TIMES = 200; + for (var e, r, o, a, s, h, c, u, t = n.nodes, l = t.length, d = 0; d < n.CONVERGENT_MAX_TIMES; d++) { + n.nodes.forEach(function (t) { + (t.force_x = 0), (t.force_y = 0); + }); + for (var i = !0, f = 0; f < l - 1; f++) + for (var g = t[f], p = f + 1; p < l; p++) + (e = t[p]), + (r = e.x - g.x), + (o = e.y - g.y), + (0 === r && 0 === o) || + ((h = r * r + o * o), + (c = Math.sqrt(h)), + (u = n.K_r / h), + (a = (u * r) / c), + (s = (u * o) / c), + (g.force_x = g.force_x - a), + (g.force_y = g.force_y - s), + (e.force_x = e.force_x + a), + (e.force_y = e.force_y + s)); + this.links.forEach(function (t) { + (g = t.source), + (e = t.target), + g.id != e.id && + ((r = e.x - g.x), + (o = e.y - g.y), + (0 === r && 0 === o) || + ((h = r * r + o * o), + (c = Math.sqrt(h)), + (u = n.K_s * (c - n.L)), + (a = (u * r) / c), + (s = (u * o) / c), + (g.force_x = g.force_x + a), + (g.force_y = g.force_y + s), + (e.force_x = e.force_x - a), + (e.force_y = e.force_y - s))); + }), + this.nodes.forEach(function (t) { + var e; + (r = n.delta_t * t.force_x), + (o = n.delta_t * t.force_y), + (h = r * r + o * o) > n.MAX_DISPLACEMENT_SQUARED && + ((e = Math.sqrt(n.MAX_DISPLACEMENT_SQUARED / h)), (r *= e), (o *= e)), + (t.x += r), + (t.y += o), + (r = 0 < r ? r : -r) + (o = 0 < o ? o : -o) > n.CONVERGENT_MOVEMENT && (i = !1); + }); + } + n.finished = i; + }); +} +function ic() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.nodeIds = []), + (this.nodeNeighbers = []), + (this.nodeSpace = 60), + (this.layerSpace = 60), + (this.currentX = 0), + (this.currentY = 0), + (this.center = [0, 0]), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.getConfig = function () { + return [ + { label: '节点间距', nodeSpace: 80 }, + { label: '层间距', layerSpace: 80 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.nodeSpace = Number(t.nodeSpace) || 50), + (this.layerSpace = Number(t.layerSpace) || 50), + (this.center = t.center || [0, 0])), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.init = function () { + var e = this; + (e.nodeIds = []), + (e.nodeNeighbers = []), + e.nodes.forEach(function (t) { + e.nodeIds.push(t.id); + t = e.initNodeNeighbers(t); + e.nodeNeighbers.push(t); + }), + e.buildTree(), + e.setRadialLocations(), + (this.inited = !0), + (this.finishedCount = 0); + }), + (this.initNodeNeighbers = function (e) { + return this.links + .filter(function (t) { + return e.id == t.source.id; + }) + .map(function (t) { + return t.target; + }); + }), + (this.buildTree = function () { + var e = this, + t = e.getRoots(); + 0 < t.length && + (e.calculateRootsX(t), + t.forEach(function (t) { + e.calculateNodeX(t), (e.currentX += t.sizeT / 2 + e.nodeSpace), e.buildNodeTree(t, e.currentX); + })); + }), + (this.getRoots = function () { + var e = []; + return ( + this.nodes.forEach(function (t) { + 0 == (t.inLinks || []).length && e.push(t); + }), + e + ); + }), + (this.calculateRootsX = function (t) { + var n = this, + i = 0; + return ( + t.forEach(function (t) { + var e = n.getSuccessors(t); + 0 != e.length && + e.forEach(function (t) { + i += n.calculateNodeX(t) + n.nodeSpace; + }), + (i = Math.max(0, i - n.nodeSpace)), + (t.sizeT = i); + }), + i + ); + }), + (this.calculateNodeX = function (t) { + var e = this, + n = 0, + i = e.getSuccessors(t); + return ( + 0 != i.length && + i.forEach(function (t) { + n += e.calculateNodeX(t) + e.nodeSpace; + }), + (n = Math.max(0, n - e.nodeSpace)), + (t.sizeT = n) + ); + }), + (this.buildNodeTree = function (t, e) { + var n = this; + (n.currentY += n.layerSpace), (n.currentX = e), n.setCurrentPositionFor(t); + var i, + r, + o = e - t.sizeT / 2; + n.getSuccessors(t).forEach(function (t) { + (i = t.sizeT), (r = o + i / 2), n.buildNodeTree(t, r), (o = o + i + n.nodeSpace); + }), + (n.currentY -= n.layerSpace); + }), + (this.setCurrentPositionFor = function (t) { + (t.tempx = this.currentX), (t.tempy = this.currentY); + }), + (this.getSuccessors = function (t) { + t = this.nodeIds.indexOf(t.id); + return this.nodeNeighbers[t] || []; + }), + (this.setRadialLocations = function () { + var r = this, + t = r.getMaxXY(), + e = t.x, + t = t.y, + o = (2 * Math.PI) / e, + a = e / 2 / t; + r.nodes.forEach(function (t) { + var e = t.tempx * o, + n = (t.tempy - r.layerSpace) * a, + i = n * Math.cos(e) + r.center[0], + n = n * Math.sin(e) + r.center[1], + e = r.newLayoutData(); + (e.finishx = i), + (e.finishy = n), + (e.xdistance = (1 / r.intSteps) * (i - t.x)), + (e.ydistance = (1 / r.intSteps) * (n - t.y)), + (t.layoutData = e); + }); + }), + (this.getMaxXY = function () { + var e = this, + n = 0, + i = 0; + return ( + e.nodes.forEach(function (t) { + t.tempx || (t.tempx = e.currentX), + t.tempy || (t.tempy = e.currentY), + (n = Math.max(n, t.tempx)), + (i = Math.max(i, t.tempy)); + }), + { x: n, y: i } + ); + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }); +} +function rc() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.center = [0, 0]), + (this.strength = -800), + (this.linkDistance = 150), + (this.simulation = null), + (this.progress = 0), + (this.iterations = 0), + (this.maxIterations = 200), + (this.ajustCluster = !1), + (this.inited = !1), + (this.finished = !1), + (this.excute = function () { + this.inited && this.run(); + }), + (this.getConfig = function () { + return [ + { label: '斥力', strength: this.strength }, + { label: '是否分组', ajustCluster: this.ajustCluster }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.center = t.center || [0, 0]), + (this.strength = Number(t.strength) || -800), + (this.linkDistance = Number(t.linkDistance) || 150), + (this.ajustCluster = Boolean(t.ajustCluster))), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.init = function () { + (this.inited = !0), (this.finished = !1), (this.iterations = 0), (this.progress = 0); + var t, + e = this.forceSimulation(this.nodes); + (this.ajustCluster + ? e + .force('x', this.forceX().strength(0.05)) + .force('y', this.forceY().strength(0.1)) + .force('cluster', this.forceCluster()) + .force('charge', this.manyBodyReuse().strength(this.strength)) + .force( + 'collide', + this.forceCollide(function (t) { + return t.radius + 20; + }).strength(1), + ) + : ((t = this.links.map(function (t, e) { + return { id: e, source: t.source.id, target: t.target.id }; + })), + e + .force( + 'link', + this.forceLink(t) + .id(function (t) { + return t.id; + }) + .strength(0.15) + .distance(this.linkDistance), + ) + .force('x', this.forceX()) + .force('y', this.forceY()) + .force('charge', this.forceManyBody().strength(this.strength)) + .force( + 'collide', + this.forceCollide(function (t) { + return t.radius + 10; + }), + )) + ).force('center', this.forceCenter(this.center[0], this.center[1])), + (this.simulation = e); + }), + (this.run = function () { + (this.progress += + 1 / Math.ceil(Math.log(this.simulation.alphaMin()) / Math.log(1 - this.simulation.alphaDecay()))), + this.iterations++; + var t = this.iterations / this.maxIterations, + t = Math.max(t, this.progress); + 1 <= (t = 1 < t ? 1 : t) + ? ((this.finished = !0), this.simulation.alpha(0), this.simulation.stop()) + : this.simulation.tick(t); + }), + (this.lcg = function () { + var t = 1; + return function () { + return (t = (1664525 * t + 1013904223) % 4294967296) / 4294967296; + }; + }), + (this.forceSimulation = function (h) { + var a, + s = 1, + e = 0.001, + c = 1 - Math.pow(e, 1 / 300), + u = 0, + l = 0.6, + d = {}, + t = this.timer(r), + n = this.dispatch('tick', 'end'), + i = this.lcg(); + function r() { + f(), n.call('tick', a), s < e && (t.stop(), n.call('end', a)); + } + function o(t) { + for (var e in d) t(d[e]); + } + function f(t) { + var e, + n, + i = h.length; + void 0 === t && (t = 1); + for (var r = 0; r < t; ++r) { + for (var o in ((s += (u - s) * c), d)) d[o](s); + for (e = 0; e < i; ++e) + null == (n = h[e]).fx ? (n.x += n.vx *= l) : ((n.x = n.fx), (n.vx = 0)), + null == n.fy ? (n.y += n.vy *= l) : ((n.y = n.fy), (n.vy = 0)); + } + return a; + } + function g() { + for (var t, e, n, i = 0, r = h.length; i < r; ++i) + ((t = h[i]).index = i), + null != t.fx && (t.x = t.fx), + null != t.fy && (t.y = t.fy), + (isNaN(t.x) || isNaN(t.y)) && + ((e = initialRadius * Math.sqrt(0.5 + i)), + (n = i * initialAngle), + (t.x = e * Math.cos(n)), + (t.y = e * Math.sin(n))), + (isNaN(t.vx) || isNaN(t.vy)) && (t.vx = t.vy = 0); + } + function p(t) { + return t.initialize && t.initialize(h, i), t; + } + return ( + null == h && (h = []), + g(), + (a = { + tick: f, + restart: function () { + return t.restart(r), a; + }, + stop: function () { + return t.stop(), a; + }, + nodes: function (t) { + return arguments.length ? ((h = t), g(), o(p), a) : h; + }, + alpha: function (t) { + return arguments.length ? ((s = +t), a) : s; + }, + alphaMin: function (t) { + return arguments.length ? ((e = +t), a) : e; + }, + alphaDecay: function (t) { + return arguments.length ? ((c = +t), a) : +c; + }, + alphaTarget: function (t) { + return arguments.length ? ((u = +t), a) : u; + }, + velocityDecay: function (t) { + return arguments.length ? ((l = 1 - t), a) : 1 - l; + }, + randomSource: function (t) { + return arguments.length ? ((i = t), o(p), a) : i; + }, + force: function (t, e) { + return 1 < arguments.length ? (null == e ? d.delete[t] : (d[t] = p(e)), a) : d[t]; + }, + find: function (t, e, n) { + var i, + r, + o, + a = 0, + s = h.length; + for (null == n ? (n = 1 / 0) : (n *= n), a = 0; a < s; ++a) + (i = (i = t - (r = h[a]).x) * i + (i = e - r.y) * i) < n && ((o = r), (n = i)); + return o; + }, + on: function (t, e) { + return 1 < arguments.length ? (n.on(t, e), a) : n.on(t); + }, + }) + ); + }), + (this.jiggle = function () { + return 1e-6 * (Math.random() - 0.5); + }), + (this.constant = function (t) { + return function () { + return t; + }; + }), + (this.forceManyBody = function () { + var r, + h, + c, + u, + l, + d = this, + i = d.constant(-30), + f = 1, + g = 1 / 0, + p = 0.81; + function o(t) { + return t.x; + } + function a(t) { + return t.y; + } + function e(t) { + var e, + n = r.length, + i = d.quadtree(r, o, a).visitAfter(s); + for (u = t, e = 0; e < n; ++e) (h = r[e]), i.visit(y); + } + function n() { + if (r) { + var t, + e, + n = r.length; + for (l = new Array(n), t = 0; t < n; ++t) (e = r[t]), (l[e.index] = +i(e, t, r)); + } + } + function s(t) { + var e, + n, + i, + r, + o, + a = 0, + s = 0; + if (t.length) { + for (i = r = o = 0; o < 4; ++o) + (e = t[o]) && (n = Math.abs(e.value)) && ((a += e.value), (s += n), (i += n * e.x), (r += n * e.y)); + (t.x = i / s), (t.y = r / s); + } else for ((e = t).x = e.data.x, e.y = e.data.y; (a += l[e.data.index]), (e = e.next); ); + t.value = a; + } + function y(t, e, n, i) { + if (!t.value) return !0; + var r = t.x - h.x, + o = t.y - h.y, + a = i - e, + s = r * r + o * o; + if ((a * a) / p < s) + return ( + s < g && + (0 === r && (s += (r = d.jiggle(c)) * r), + 0 === o && (s += (o = d.jiggle(c)) * o), + s < f && (s = Math.sqrt(f * s)), + (h.vx += (r * t.value * u) / s), + (h.vy += (o * t.value * u) / s)), + !0 + ); + if (!(t.length || g <= s)) + for ( + (t.data !== h || t.next) && + (0 === r && (s += (r = d.jiggle(c)) * r), 0 === o && (s += (o = d.jiggle(c)) * o), s < f) && + (s = Math.sqrt(f * s)); + t.data !== h && ((a = (l[t.data.index] * u) / s), (h.vx += r * a), (h.vy += o * a)), (t = t.next); + + ); + } + return ( + (e.initialize = function (t, e) { + (r = t), (c = e), n(); + }), + (e.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : d.constant(+t)), n(), e) : i; + }), + (e.distanceMin = function (t) { + return arguments.length ? ((f = t * t), e) : Math.sqrt(f); + }), + (e.distanceMax = function (t) { + return arguments.length ? ((g = t * t), e) : Math.sqrt(g); + }), + (e.theta = function (t) { + return arguments.length ? ((p = t * t), e) : Math.sqrt(p); + }), + e + ); + }), + (this.manyBodyReuse = function () { + var i, + h, + c, + r, + o, + a, + u, + l = this, + s = 0, + d = l.constant(-30), + f = 1, + g = 1 / 0, + p = 0.81; + function y(t) { + return t.x; + } + function v(t) { + return t.y; + } + function o() { + return function (t) { + return t % 13 == 0; + }; + } + function e(t) { + var e, + n = i.length; + for ((r && !a(s, i)) || ((r = l.quadtree(i, y, v).visitAfter(m)), i.update.push(s)), c = t, e = 0; e < n; ++e) + (h = i[e]), r.visit(x); + ++s; + } + function n() { + if (i) { + (s = 0), (i.update = []), (a = o()), (r = null); + var t, + e, + n = i.length; + for (u = new Array(n), t = 0; t < n; ++t) (e = i[t]), (u[e.index] = +d(e, t, i)); + } + } + function m(t) { + var e, + n, + i, + r, + o, + a = 0, + s = 0; + if (t.length) { + for (i = r = o = 0; o < 4; ++o) + (e = t[o]) && (n = Math.abs(e.value)) && ((a += e.value), (s += n), (i += n * e.x), (r += n * e.y)); + (t.x = i / s), (t.y = r / s); + } else for ((e = t).x = e.data.x, e.y = e.data.y; (a += u[e.data.index]), (e = e.next); ); + t.value = a; + } + function x(t, e, n, i) { + if (!t.value) return !0; + var r = t.x - h.x, + o = t.y - h.y, + a = i - e, + s = r * r + o * o; + if ((a * a) / p < s) + return ( + s < g && + (0 === r && (s += (r = l.jiggle()) * r), + 0 === o && (s += (o = l.jiggle()) * o), + s < f && (s = Math.sqrt(f * s)), + (h.vx += (r * t.value * c) / s), + (h.vy += (o * t.value * c) / s)), + !0 + ); + if (!(t.length || g <= s)) + for ( + (t.data !== h || t.next) && + (0 === r && (s += (r = l.jiggle()) * r), 0 === o && (s += (o = l.jiggle()) * o), s < f) && + (s = Math.sqrt(f * s)); + t.data !== h && + ((s = (r = t.data.x - h.x) * r + (o = t.data.y - h.y) * o), + 0 === r && (s += (r = l.jiggle()) * r), + 0 === o && (s += (o = l.jiggle()) * o), + s < f && (s = Math.sqrt(f * s)), + (a = (u[t.data.index] * c) / s), + (h.vx += r * a), + (h.vy += o * a)), + (t = t.next); + + ); + } + return ( + (e.initialize = function (t) { + (i = t), n(); + }), + (e.strength = function (t) { + return arguments.length ? ((d = 'function' == typeof t ? t : l.constant(+t)), n(), e) : d; + }), + (e.distanceMin = function (t) { + return arguments.length ? ((f = t * t), e) : Math.sqrt(f); + }), + (e.distanceMax = function (t) { + return arguments.length ? ((g = t * t), e) : Math.sqrt(g); + }), + (e.theta = function (t) { + return arguments.length ? ((p = t * t), e) : Math.sqrt(p); + }), + (e.update = function (t) { + return arguments.length ? ((a = (o = t)()), e) : o; + }), + e + ); + }), + (this.manyBodySampled = function () { + var v, + m, + x, + w, + b, + k, + M, + E, + e = this, + i = e.constant(-30), + C = 0, + T = 1, + N = 1 / 0, + r = function () { + return 15; + }, + o = function (t) { + return Math.pow(t.length, 0.75); + }, + a = function (t) { + return Math.pow(t.length, 0.25); + }, + s = function (t) { + return t.length < 100 ? 1 : t.length < 200 ? 3 : Math.sqrt(t.length); + }, + _ = Math.random; + function L(t) { + var e, + n, + i = Math.floor(_() * v.length), + r = v[i], + r = (t.x - r.x) * (t.x - r.x) + (t.y - r.y) * (t.y - r.y), + o = -1 / 0, + a = -1; + if (!(0 <= t.nearest.indexOf(i))) + if (t.nearest.length < b) t.nearest.push(i); + else { + for (; ++a < t.nearest.length; ) + (e = t.nearest[a]), + (e = v[e]), + (e = (t.x - e.x) * (t.x - e.x) - (t.y - e.y) * (t.y - e.y)) > o && ((n = a), (o = e)); + r < o && (t.nearest[n] = i); + } + } + function n(t) { + var e, + n, + i, + r, + o, + a = 0, + s = C, + h = v.length, + c = C + k; + for (m = t; a < h || s < c; ++a, ++s) { + if (s < c) { + u = void 0; + p = void 0; + g = void 0; + d = void 0; + l = void 0; + f = void 0; + var u = v[s % h]; + for ( + var l, + d, + f, + g = (function (t, e) { + e = Math.floor(e); + for (var n, i, r = v.length, o = r - e, a = r - 1; o <= a; --a) + (i = t[(n = Math.floor(_() * a))]), (t[n] = t[a]), (t[a] = i); + return t.slice(o); + })(w, M), + p = g.length - 1; + 0 <= p; + --p + ) + (d = v[g[p]]) === u || + (f = (l = d.x - u.x) * l + (d = d.y - u.y) * d) >= N || + (0 === l && (f += (l = 1e-6 * (_() - 0.5)) * l), + 0 === d && (f += (d = 1e-6 * (_() - 0.5)) * d), + f < T && (f = Math.sqrt(T * f)), + (f = (x[u.index] * m * E) / f), + (u.vx += l * f), + (u.vy += d * f)); + } + if (b && a < h) { + y = void 0; + e = void 0; + n = void 0; + r = void 0; + i = void 0; + o = void 0; + var y = v[a]; + if ((b && L(y), (n = y.nearest), b)) + for (e = n.length - 1; 0 <= e; --e) + (r = v[n[e]]) === y || + (o = (i = r.x - y.x) * i + (r = r.y - y.y) * r) >= N || + (0 === i && (o += (i = 1e-6 * (_() - 0.5)) * i), + 0 === r && (o += (r = 1e-6 * (_() - 0.5)) * r), + o < T && (o = Math.sqrt(T * o)), + (o = (x[y.index] * m * E) / o), + (y.vx += i * o), + (y.vy += r * o)); + } + } + C = c % h; + } + function h() { + if (v) { + var t, + e, + n = v.length; + for (w = new Array(n), t = 0; t < n; ++t) w[t] = t; + for ( + x = new Array(n), + b = (b = Math.min(Math.ceil(r()), n)) < 0 ? 0 : Math.min(b, v.length), + k = (k = Math.ceil(o(v))) < 0 ? 0 : Math.min(k, n), + M = (M = Math.ceil(a(v))) < 0 ? 0 : Math.min(M, n), + E = s(v), + m = 1, + t = 0; + t < n; + ++t + ) + for (e = v[t], x[e.index] = +i(e, t, v), e.nearest = []; e.nearest.length < b; ) L(e); + } + } + return ( + (n.initialize = function (t) { + (v = t), h(); + }), + (n.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), h(), n) : i; + }), + (n.distanceMin = function (t) { + return arguments.length ? ((T = t * t), n) : Math.sqrt(T); + }), + (n.distanceMax = function (t) { + return arguments.length ? ((N = t * t), n) : Math.sqrt(N); + }), + (n.neighborSize = function (t) { + return arguments.length ? ((r = 'function' == typeof t ? t : e.constant(+t)), h(), n) : r; + }), + (n.updateSize = function (t) { + return arguments.length ? ((o = 'function' == typeof t ? t : e.constant(+t)), h(), n) : o; + }), + (n.sampleSize = function (t) { + return arguments.length ? ((a = 'function' == typeof t ? t : e.constant(+t)), h(), n) : a; + }), + (n.chargeMultiplier = function (t) { + return arguments.length ? ((s = 'function' == typeof t ? t : e.constant(+t)), h(), n) : s; + }), + (n.source = function (t) { + return arguments.length ? ((_ = t), n) : _; + }), + n + ); + }), + (this.forceCollide = function (i) { + var o, + a, + d, + f = this, + g = 1, + p = 1; + function e() { + for (var t, e, s, h, c, u, l, n = o.length, i = 0; i < p; ++i) + for (e = f.quadtree(o, y, v).visitAfter(m), t = 0; t < n; ++t) + (s = o[t]), (u = a[s.index]), (l = u * u), (h = s.x + s.vx), (c = s.y + s.vy), e.visit(r); + function r(t, e, n, i, r) { + var o = t.data, + t = t.r, + a = u + t; + if (!o) return h + a < e || i < h - a || c + a < n || r < c - a; + o.index > s.index && + (n = (e = h - o.x - o.vx) * e + (i = c - o.y - o.vy) * i) < a * a && + (0 === e && (n += (e = f.jiggle(d)) * e), + 0 === i && (n += (i = f.jiggle(d)) * i), + (n = ((a - (n = Math.sqrt(n))) / n) * g), + (s.vx += (e *= n) * (a = (t *= t) / (l + t))), + (s.vy += (i *= n) * a), + (o.vx -= e * (a = 1 - a)), + (o.vy -= i * a)); + } + } + function y(t) { + return t.x + t.vx; + } + function v(t) { + return t.y + t.vy; + } + function m(t) { + if (t.data) return (t.r = a[t.data.index]); + for (var e = (t.r = 0); e < 4; ++e) t[e] && t[e].r > t.r && (t.r = t[e].r); + } + function n() { + if (o) { + var t, + e, + n = o.length; + for (a = new Array(n), t = 0; t < n; ++t) (e = o[t]), (a[e.index] = +i(e, t, o)); + } + } + return ( + 'function' != typeof i && (i = f.constant(null == i ? 1 : +i)), + (e.initialize = function (t, e) { + (o = t), (d = e), n(); + }), + (e.iterations = function (t) { + return arguments.length ? ((p = +t), e) : p; + }), + (e.strength = function (t) { + return arguments.length ? ((g = +t), e) : g; + }), + (e.radius = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : f.constant(+t)), n(), e) : i; + }), + e + ); + }), + (this.forceCluster = function () { + var n = [], + a = 0.4; + function e(t) { + var i = {}; + n.forEach(function (t) { + isNaN(t.x) && (t.x = 100 * Math.random()), isNaN(t.y) && (t.y = 100 * Math.random()); + var e = t.type || 'default', + n = i[e]; + null == n ? (i[e] = []) : (n.push(t), (i[e] = n)); + }); + var e, + r = {}; + for (e in i) + r[e] = (function (t) { + var e = 0, + n = 0, + i = 0, + r = Math.pow(5, 2); + return ( + t.forEach(function (t) { + (e += t.x * r), (n += t.y * r), (i += r); + }), + (e /= i), + (n /= i), + isNaN(e) && (e = 20 * Math.random()), + isNaN(n) && (n = 20 * Math.random()), + { x: e, y: n } + ); + })(i[e]); + var o = t * a; + n.forEach(function (t) { + var e = r[t.type || 'default'], + n = e.x, + e = e.y; + (t.vx -= (t.x - n) * o), (t.vy -= (t.y - e) * o); + }); + } + return ( + (e.initialize = function (t) { + return (n = t); + }), + (e.strength = function (t) { + return arguments.length ? ((a = +t), e) : a; + }), + e + ); + }), + (this.forceCenter = function (o, a) { + var s, + h = 1; + function e() { + for (var t, e = s.length, n = 0, i = 0, r = 0; r < e; ++r) (n += (t = s[r]).x), (i += t.y); + for (n = (n / e - o) * h, i = (i / e - a) * h, r = 0; r < e; ++r) ((t = s[r]).x -= n), (t.y -= i); + } + return ( + null == o && (o = 0), + null == a && (a = 0), + (e.initialize = function (t) { + s = t; + }), + (e.x = function (t) { + return arguments.length ? ((o = +t), e) : o; + }), + (e.y = function (t) { + return arguments.length ? ((a = +t), e) : a; + }), + (e.strength = function (t) { + return arguments.length ? ((h = +t), e) : h; + }), + e + ); + }), + (this.forceLink = function (c) { + var u, + l, + o, + a, + d, + f, + g = this, + s = function (t) { + return t.id; + }, + n = function (t) { + return 1 / Math.min(a[t.source.index], a[t.target.index]); + }, + i = g.constant(30), + p = 1; + function e(t) { + for (var e = 0, n = c.length; e < p; ++e) + for (var i, r, o, a, s, h = 0; h < n; ++h) + (i = (r = c[h]).source), + (o = (r = r.target).x + r.vx - i.x - i.vx || g.jiggle(f)), + (a = r.y + r.vy - i.y - i.vy || g.jiggle(f)), + (o *= s = (((s = Math.sqrt(o * o + a * a)) - l[h]) / s) * t * u[h]), + (a *= s), + (r.vx -= o * (s = d[h])), + (r.vy -= a * s), + (i.vx += o * (s = 1 - s)), + (i.vy += a * s); + } + function h() { + if (o) for (var t = 0, e = c.length; t < e; ++t) u[t] = +n(c[t], t, c); + } + function y() { + if (o) for (var t = 0, e = c.length; t < e; ++t) l[t] = +i(c[t], t, c); + } + function r() { + if (o) { + var t, + e, + n = o.length, + i = c.length, + r = {}; + for ( + o.forEach(function (t, e) { + return (r[s(t, e, o)] = t); + }), + t = 0, + a = new Array(n); + t < i; + ++t + ) + ((e = c[t]).index = t), + (e.source = r[e.source]), + (e.target = r[e.target]), + (a[e.source.index] = (a[e.source.index] || 0) + 1), + (a[e.target.index] = (a[e.target.index] || 0) + 1); + for (t = 0, d = new Array(i); t < i; ++t) + (e = c[t]), (d[t] = a[e.source.index] / (a[e.source.index] + a[e.target.index])); + (u = new Array(i)), h(), (l = new Array(i)), y(); + } + } + return ( + null == c && (c = []), + (e.initialize = function (t, e) { + (o = t), (f = e), r(); + }), + (e.links = function (t) { + return arguments.length ? ((c = t), r(), e) : c; + }), + (e.id = function (t) { + return arguments.length ? ((s = t), e) : s; + }), + (e.iterations = function (t) { + return arguments.length ? ((p = +t), e) : p; + }), + (e.strength = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : g.constant(+t)), h(), e) : n; + }), + (e.distance = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : g.constant(+t)), y(), e) : i; + }), + e + ); + }), + (this.forceRadial = function (n, s, h) { + var c, + u, + l, + e = this, + i = e.constant(0.1); + function r(t) { + for (var e = 0, n = c.length; e < n; ++e) { + var i = c[e], + r = i.x - s || 1e-6, + o = i.y - h || 1e-6, + a = Math.sqrt(r * r + o * o), + a = ((l[e] - a) * u[e] * t) / a; + (i.vx += r * a), (i.vy += o * a); + } + } + function o() { + if (c) { + var t, + e = c.length; + for (u = new Array(e), l = new Array(e), t = 0; t < e; ++t) + (l[t] = +n(c[t], t, c)), (u[t] = isNaN(l[t]) ? 0 : +i(c[t], t, c)); + } + } + return ( + 'function' != typeof n && (n = e.constant(+n)), + null == s && (s = 0), + null == h && (h = 0), + (r.initialize = function (t) { + (c = t), o(); + }), + (r.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), o(), r) : i; + }), + (r.radius = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : e.constant(+t)), o(), r) : n; + }), + (r.x = function (t) { + return arguments.length ? ((s = +t), r) : s; + }), + (r.y = function (t) { + return arguments.length ? ((h = +t), r) : h; + }), + r + ); + }), + (this.forceX = function (n) { + var r, + o, + a, + e = this, + i = e.constant(0.1); + function s(t) { + for (var e, n = 0, i = r.length; n < i; ++n) (e = r[n]).vx += (a[n] - e.x) * o[n] * t; + } + function h() { + if (r) { + var t, + e = r.length; + for (o = new Array(e), a = new Array(e), t = 0; t < e; ++t) + o[t] = isNaN((a[t] = +n(r[t], t, r))) ? 0 : +i(r[t], t, r); + } + } + return ( + 'function' != typeof n && (n = e.constant(null == n ? 0 : +n)), + (s.initialize = function (t) { + (r = t), h(); + }), + (s.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), h(), s) : i; + }), + (s.x = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : e.constant(+t)), h(), s) : n; + }), + s + ); + }), + (this.forceY = function (n) { + var r, + o, + a, + e = this, + i = e.constant(0.1); + function s(t) { + for (var e, n = 0, i = r.length; n < i; ++n) (e = r[n]).vy += (a[n] - e.y) * o[n] * t; + } + function h() { + if (r) { + var t, + e = r.length; + for (o = new Array(e), a = new Array(e), t = 0; t < e; ++t) + o[t] = isNaN((a[t] = +n(r[t], t, r))) ? 0 : +i(r[t], t, r); + } + } + return ( + 'function' != typeof n && (n = e.constant(null == n ? 0 : +n)), + (s.initialize = function (t) { + (r = t), h(); + }), + (s.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), h(), s) : i; + }), + (s.y = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : e.constant(+t)), h(), s) : n; + }), + s + ); + }), + (this.timer = function (t, e, i) { + var a, + s, + h = 0, + c = 0, + r = 0, + u = 0, + l = 0, + d = 0, + f = Date, + o = + 'object' === ('undefined' == typeof window ? 'undefined' : n(window)) && window.requestAnimationFrame + ? window.requestAnimationFrame.bind(window) + : function (t) { + setTimeout(t, 17); + }; + function g() { + return l || (o(p), (l = f.now() + d)); + } + function p() { + l = 0; + } + function y() { + (l = (u = f.now()) + d), (h = c = 0); + try { + g(), ++h; + for (var t, e = a; e; ) 0 <= (t = l - e._time) && e._call.call(void 0, t), (e = e._next); + --h; + } finally { + for (var n, i, r = a, o = 1 / (h = 0); r; ) + r = r._call + ? (o > r._time && (o = r._time), (n = r)._next) + : ((i = r._next), (r._next = null), n ? (n._next = i) : (a = i)); + (s = n), m(o), (l = 0); + } + } + function v() { + var t = f.now(), + e = t - u; + 1e3 < e && ((d -= e), (u = t)); + } + function m(t) { + h || + ((c = c && clearTimeout(c)), + 24 < t - l + ? (t < 1 / 0 && (c = setTimeout(y, t - f.now() - d)), (r = r && clearInterval(r))) + : (r || ((u = f.now()), (r = setInterval(v, 1e3))), (h = 1), o(y))); + } + var x = new (function () { + (this._call = this._time = this._next = null), + (this.restart = function (t, e, n) { + if ('function' != typeof t) throw new TypeError('callback is not a function'); + (n = (null == n ? g() : +n) + (null == e ? 0 : +e)), + this._next || s === this || (s ? (s._next = this) : (a = this), (s = this)), + (this._call = t), + (this._time = n), + m(); + }), + (this.stop = function () { + this._call && ((this._call = null), (this._time = 1 / 0), m()); + }); + })(); + return x.restart(t, e, i), x; + }), + (this.dispatch = function () { + var o = { value: function () {} }; + function i(t) { + this._ = t; + } + function h(t, e, n) { + for (var i = 0, r = t.length; i < r; ++i) + if (t[i].name === e) { + (t[i] = o), (t = t.slice(0, i).concat(t.slice(i + 1))); + break; + } + return null != n && t.push({ name: e, value: n }), t; + } + i.prototype = { + constructor: i, + on: function (t, e) { + var n, + i, + r = this._, + o = + ((i = r), + (t + '') + .trim() + .split(/^|\s+/) + .map(function (t) { + var e = '', + n = t.indexOf('.'); + if ((0 <= n && ((e = t.slice(n + 1)), (t = t.slice(0, n))), t && !i.hasOwnProperty(t))) + throw new Error('unknown type: ' + t); + return { type: t, name: e }; + })), + a = -1, + s = o.length; + if (!(arguments.length < 2)) { + if (null != e && 'function' != typeof e) throw new Error('invalid callback: ' + e); + for (; ++a < s; ) + if ((n = (t = o[a]).type)) r[n] = h(r[n], t.name, e); + else if (null == e) for (n in r) r[n] = h(r[n], t.name, null); + return this; + } + for (; ++a < s; ) + if ( + (n = + (n = (t = o[a]).type) && + (function (t, e) { + for (var n, i = 0, r = t.length; i < r; ++i) if ((n = t[i]).name === e) return n.value; + })(r[n], t.name)) + ) + return n; + }, + copy: function () { + var t, + e = {}, + n = this._; + for (t in n) e[t] = n[t].slice(); + return new i(e); + }, + call: function (t, e) { + if (0 < (n = arguments.length - 2)) + for (var n, i, r = new Array(n), o = 0; o < n; ++o) r[o] = arguments[o + 2]; + if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); + for (o = 0, n = (i = this._[t]).length; o < n; ++o) i[o].value.apply(e, r); + }, + apply: function (t, e, n) { + if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); + for (var i = this._[t], r = 0, o = i.length; r < o; ++r) i[r].value.apply(e, n); + }, + }; + for (var t, e = 0, n = arguments.length, r = {}; e < n; ++e) { + if (!(t = arguments[e] + '') || t in r || /[\s.]/.test(t)) throw new Error('illegal type: ' + t); + r[t] = []; + } + return new i(r); + }), + (this.quadtree = function (t, e, n) { + function l(t, e, n, i) { + if (!isNaN(e) && !isNaN(n)) { + var r, + o, + a, + s, + h, + c, + u, + l, + d, + f = t._root, + g = { data: i }, + p = t._x0, + y = t._y0, + v = t._x1, + m = t._y1; + if (f) { + for (; f.length; ) + if ( + ((c = e >= (o = (p + v) / 2)) ? (p = o) : (v = o), + (u = n >= (a = (y + m) / 2)) ? (y = a) : (m = a), + !(f = (r = f)[(l = (u << 1) | c)])) + ) + return (r[l] = g), t; + if (((s = +t._x.call(null, f.data)), (h = +t._y.call(null, f.data)), e === s && n === h)) + (g.next = f), r ? (r[l] = g) : (t._root = g); + else { + for ( + ; + (r = r ? (r[l] = new Array(4)) : (t._root = new Array(4))), + (c = e >= (o = (p + v) / 2)) ? (p = o) : (v = o), + (u = n >= (a = (y + m) / 2)) ? (y = a) : (m = a), + (l = (u << 1) | c) == (d = ((a <= h) << 1) | (o <= s)); + + ); + (r[d] = f), (r[l] = g); + } + } else t._root = g; + } + return t; + } + function v(t, e, n, i, r) { + (this.node = t), (this.x0 = e), (this.y0 = n), (this.x1 = i), (this.y1 = r); + } + function o(t, e, n, i, r, o) { + (this._x = t), + (this._y = e), + (this._x0 = n), + (this._y0 = i), + (this._x1 = r), + (this._y1 = o), + (this._root = void 0); + } + function a(t) { + for (var e = { data: t.data }, n = e; (t = t.next); ) n = n.next = { data: t.data }; + return e; + } + var i = o.prototype, + i = + ((i.copy = function () { + var t, + e, + n = new o(this._x, this._y, this._x0, this._y0, this._x1, this._y1), + i = this._root; + if (i) + if (i.length) + for (t = [{ source: i, target: (n._root = new Array(4)) }]; (i = t.pop()); ) + for (var r = 0; r < 4; ++r) + (e = i.source[r]) && + (e.length ? t.push({ source: e, target: (i.target[r] = new Array(4)) }) : (i.target[r] = a(e))); + else n._root = a(i); + return n; + }), + (i.add = function (t) { + var e = +this._x.call(null, t), + n = +this._y.call(null, t); + return l(this.cover(e, n), e, n, t); + }), + (i.addAll = function (t) { + for ( + var e, + n, + i = t.length, + r = new Array(i), + o = new Array(i), + a = 1 / 0, + s = 1 / 0, + h = -1 / 0, + c = -1 / 0, + u = 0; + u < i; + ++u + ) + isNaN((e = +this._x.call(null, (n = t[u])))) || + isNaN((n = +this._y.call(null, n))) || + ((r[u] = e) < a && (a = e), h < e && (h = e), (o[u] = n) < s && (s = n), c < n && (c = n)); + if (!(h < a || c < s)) for (this.cover(a, s).cover(h, c), u = 0; u < i; ++u) l(this, r[u], o[u], t[u]); + return this; + }), + (i.cover = function (t, e) { + if (!isNaN((t = +t)) && !isNaN((e = +e))) { + var n = this._x0, + i = this._y0, + r = this._x1, + o = this._y1; + if (isNaN(n)) (r = (n = Math.floor(t)) + 1), (o = (i = Math.floor(e)) + 1); + else { + for (var a, s, h = r - n || 1, c = this._root; t < n || r <= t || e < i || o <= e; ) + switch (((s = ((e < i) << 1) | (t < n)), ((a = new Array(4))[s] = c), (c = a), (h *= 2), s)) { + case 0: + (r = n + h), (o = i + h); + break; + case 1: + (n = r - h), (o = i + h); + break; + case 2: + (r = n + h), (i = o - h); + break; + case 3: + (n = r - h), (i = o - h); + } + this._root && this._root.length && (this._root = c); + } + (this._x0 = n), (this._y0 = i), (this._x1 = r), (this._y1 = o); + } + return this; + }), + (i.data = function () { + var e = []; + return ( + this.visit(function (t) { + if (!t.length) for (; e.push(t.data), (t = t.next); ); + }), + e + ); + }), + (i.extent = function (t) { + return arguments.length + ? this.cover(+t[0][0], +t[0][1]).cover(+t[1][0], +t[1][1]) + : isNaN(this._x0) + ? void 0 + : [ + [this._x0, this._y0], + [this._x1, this._y1], + ]; + }), + (i.find = function (t, e, n) { + var i, + r, + o, + a, + s, + h, + c, + u, + l = this._x0, + d = this._y0, + f = this._x1, + g = this._y1, + p = [], + y = this._root; + for ( + y && p.push(new v(y, l, d, f, g)), + null == n ? (n = 1 / 0) : ((l = t - n), (d = e - n), (f = t + n), (g = e + n), (n *= n)); + (i = p.pop()); + + ) + !(y = i.node) || + (s = i.x0) > f || + (h = i.y0) > g || + (a = i.x1) < l || + (r = i.y1) < d || + (y.length + ? (p.push( + new v(y[3], (o = (s + a) / 2), (c = (h + r) / 2), a, r), + new v(y[2], s, c, o, r), + new v(y[1], o, h, a, c), + new v(y[0], s, h, o, c), + ), + (r = ((c <= e) << 1) | (o <= t)) && + ((i = p[p.length - 1]), (p[p.length - 1] = p[p.length - 1 - r]), (p[p.length - 1 - r] = i))) + : (h = (a = t - +this._x.call(null, y.data)) * a + (s = e - +this._y.call(null, y.data)) * s) < n && + ((l = t - (c = Math.sqrt((n = h)))), (d = e - c), (f = t + c), (g = e + c), (u = y.data))); + return u; + }), + (i.remove = function (t) { + if (!isNaN((o = +this._x.call(null, t))) && !isNaN((a = +this._y.call(null, t)))) { + var e, + n, + i, + r, + o, + a, + s, + h, + c, + u, + l, + d = this._root, + f = this._x0, + g = this._y0, + p = this._x1, + y = this._y1; + if (d) { + if (d.length) + for (;;) { + if ( + ((h = o >= (s = (f + p) / 2)) ? (f = s) : (p = s), + (c = a >= (s = (g + y) / 2)) ? (g = s) : (y = s), + !(d = (e = d)[(u = (c << 1) | h)])) + ) + return this; + if (!d.length) break; + (e[(u + 1) & 3] || e[(u + 2) & 3] || e[(u + 3) & 3]) && ((n = e), (l = u)); + } + for (; d.data !== t; ) if (!(d = (i = d).next)) return this; + (r = d.next) && delete d.next, + i + ? r + ? (i.next = r) + : delete i.next + : e + ? (r ? (e[u] = r) : delete e[u], + (d = e[0] || e[1] || e[2] || e[3]) && + d === (e[3] || e[2] || e[1] || e[0]) && + !d.length && + (n ? (n[l] = d) : (this._root = d))) + : (this._root = r); + } + } + return this; + }), + (i.removeAll = function (t) { + for (var e = 0, n = t.length; e < n; ++e) this.remove(t[e]); + return this; + }), + (i.root = function () { + return this._root; + }), + (i.size = function () { + var e = 0; + return ( + this.visit(function (t) { + if (!t.length) for (; ++e, (t = t.next); ); + }), + e + ); + }), + (i.visit = function (t) { + var e, + n, + i, + r, + o, + a, + s, + h = [], + c = this._root; + for (c && h.push(new v(c, this._x0, this._y0, this._x1, this._y1)); (o = h.pop()); ) + !t((c = o.node), (n = o.x0), (i = o.y0), (r = o.x1), (o = o.y1)) && + c.length && + ((a = (n + r) / 2), + (s = (i + o) / 2), + (e = c[3]) && h.push(new v(e, a, s, r, o)), + (e = c[2]) && h.push(new v(e, n, s, a, o)), + (e = c[1]) && h.push(new v(e, a, i, r, s)), + (e = c[0])) && + h.push(new v(e, n, i, a, s)); + return this; + }), + (i.visitAfter = function (t) { + var e, + n = [], + i = []; + for (this._root && n.push(new v(this._root, this._x0, this._y0, this._x1, this._y1)); (e = n.pop()); ) { + var r, + o, + a, + s, + h, + c, + u, + l = e.node; + l.length && + ((o = e.x0), + (a = e.y0), + (c = (o + (s = e.x1)) / 2), + (u = (a + (h = e.y1)) / 2), + (r = l[0]) && n.push(new v(r, o, a, c, u)), + (r = l[1]) && n.push(new v(r, c, a, s, u)), + (r = l[2]) && n.push(new v(r, o, u, c, h)), + (r = l[3])) && + n.push(new v(r, c, u, s, h)), + i.push(e); + } + for (; (e = i.pop()); ) t(e.node, e.x0, e.y0, e.x1, e.y1); + return this; + }), + (i.x = function (t) { + return arguments.length ? ((this._x = t), this) : this._x; + }), + (i.y = function (t) { + return arguments.length ? ((this._y = t), this) : this._y; + }), + new o( + null == e + ? function (t) { + return t[0]; + } + : e, + null == n + ? function (t) { + return t[1]; + } + : n, + NaN, + NaN, + NaN, + NaN, + )); + return null == t ? i : i.addAll(t); + }); +} +function oc() { + (this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []), + (this.links = []), + (this.center = [0, 0]), + (this.neighberForce = 5), + (this.attraction = 0.05), + (this.forceScale = 6), + (this.deltaT = 6), + (this.forceCutoff = 10), + (this.inited = !1), + (this.finished = !1), + (this.totalIterates = 100), + (this.getConfig = function () { + return [ + { label: '邻边引力', neighberForce: 5 }, + { label: '向心力', attraction: 0.05 }, + { label: '斥力', forceScale: 6 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.center = t.center || [0, 0]), + (this.neighberForce = Number(t.neighberForce) || 5), + (this.attraction = Number(t.attraction) || 0.05), + (this.forceScale = Number(t.forceScale) || 6)), + this.init(); + }), + (this.addData = function () { + (this.nodes = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []), (this.links = []); + }), + (this.init = function () { + this.nodes.forEach(function (t) { + t.degree = (t.inLinks || []).length + (t.outLinks || []).length; + }), + (this.totalIterates = Math.max(150, 15 * Math.sqrt(this.nodes.length, 2))), + (this.inited = !0); + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.run = function () { + var i = this; + i.nodes.forEach(function (t) { + var e = t.degree <= 1 ? i.deltaT : i.deltaT / Math.pow(t.degree, 0.4), + n = { x: (n = i.getForceforNode(t)).x * e, y: n.y * e }; + (t.x += n.x), (t.y += n.y); + }), + i.totalIterates--, + i.totalIterates <= 0 && (i.finished = !0); + }), + (this.getForceforNode = function (r) { + var t, + o = this, + a = o.nodes.length, + s = { x: 0, y: 0 }; + return ( + (0 == r.x && 0 == r.y) || + (o.nodes.forEach(function (t) { + var e, n, i; + r.id != t.id && + ((e = t.x - r.x), + (n = t.y - r.y), + 0 == e && 0 == n && ((e = 20), (n = 25)), + (i = 1), + o.isAdjacent(r, t) && (i = o.neighberForce), + (i *= o.attraction / Math.sqrt(a)), + (s = { x: s.x + e * i, y: s.y + n * i }), + (i = 1 / Math.sqrt(e * e + n * n)), + (s = { x: s.x - e * i * o.forceScale, y: s.y - n * i * o.forceScale })); + }), + (t = o.distance(0, 0, s.x, s.y)) > o.forceCutoff && + ((t = o.forceCutoff / t), (s = { x: s.x * t, y: s.y * t }))), + s + ); + }), + (this.isAdjacent = function (t, e) { + return ( + t.id != e.id && + (-1 != + (t.inLinks || []) + .map(function (t) { + return t.source.id; + }) + .indexOf(e.id) || + -1 != + (t.outLinks || []) + .map(function (t) { + return t.target.id; + }) + .indexOf(e.id)) + ); + }), + (this.distance = function (t, e, n, i) { + return (t -= n), (e -= i), Math.sqrt(t * t + e * e); + }); +} +function ac(t, e) { + (this.nodes = t), + (this.links = e), + (this.nodeIds = []), + (this.nodeNeighbers = []), + (this.center = [0, 0]), + (this.nodeSpace = 80), + (this.layerSpace = 80), + (this.currentX = 0), + (this.currentY = 0), + (this.direction = 'UD'), + (this.centerDist = { x: 0, y: 0 }), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.hasCycle = !1), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.getConfig = function () { + return [ + { label: '点间距', nodeSpace: 80 }, + { label: '层间距', layerSpace: 120 }, + { + label: '排列方向', + direction: [ + { label: '上下', value: 'UD' }, + { label: '下上', value: 'DU' }, + { label: '左右', value: 'LR' }, + { label: '右左', value: 'RL' }, + ], + }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.nodeSpace = Number(t.nodeSpace) || 100), + (this.layerSpace = Number(t.layerSpace) || 120), + (this.direction = t.direction || 'UD'), + (this.center = t.center || [0, 0])), + (this.nodeIds = []), + (this.nodeNeighbers = []), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.init = function () { + var e = this; + e.nodes.forEach(function (t) { + e.checkHasCycle(t, []), e.nodeIds.push(t.id); + t = e.initNodeNeighbers(t); + e.nodeNeighbers.push(t); + }), + (e.centerDist = this.computeCenter()), + e.buildTree(), + (this.inited = !0), + (this.finishedCount = 0); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.initNodeNeighbers = function (i) { + var r = this, + o = []; + return ( + (i.outLinks || []).forEach(function (t) { + var e, + n = t.target; + t.source.id != n.id && + ((t = r.nodeIds.indexOf(n.id)), + (t = r.nodeNeighbers[t] || []), + (e = []), + t.forEach(function (t) { + e.push(t.id); + }), + -1 == e.indexOf(i.id)) && + o.push(n); + }), + o + ); + }), + (this.excute = function () { + !this.hasCycle && this.inited && this.run(); + }), + (this.buildTree = function () { + var e = this, + t = e.getRoots(); + 0 < t.length && + (e.calculateRootsX(t), + t.forEach(function (t) { + e.calculateNodeX(t), (e.currentX += t.sizeT / 2 + e.nodeSpace), e.buildNodeTree(t, e.currentX); + })); + }), + (this.getRoots = function () { + var e = []; + return ( + this.nodes.forEach(function (t) { + 0 == (t.inLinks || []).length && e.push(t); + }), + e + ); + }), + (this.calculateRootsX = function (t) { + var n = this, + i = 0; + return ( + t.forEach(function (t) { + var e = n.getSuccessors(t); + 0 != e.length && + e.forEach(function (t) { + i += n.calculateNodeX(t) + n.nodeSpace; + }), + (i = Math.max(0, i - n.nodeSpace)), + (t.sizeT = i); + }), + i + ); + }), + (this.calculateNodeX = function (t) { + var e = this, + n = 0, + i = e.getSuccessors(t); + return ( + 0 != i.length && + i.forEach(function (t) { + n += e.calculateNodeX(t) + e.nodeSpace; + }), + (n = Math.max(0, n - e.nodeSpace)), + (t.sizeT = n) + ); + }), + (this.buildNodeTree = function (t, e) { + var n = this; + (n.currentY += n.layerSpace), (n.currentX = e), n.setCurrentPositionFor(t); + var i, + r, + o = e - t.sizeT / 2; + n.getSuccessors(t).forEach(function (t) { + (i = t.sizeT), (r = o + i / 2), n.buildNodeTree(t, r), (o = o + i + n.nodeSpace); + }), + (n.currentY -= n.layerSpace); + }), + (this.setCurrentPositionFor = function (t) { + var e = this.currentX, + n = this.currentY, + i = e, + i = + ('DU' == this.direction + ? (n = -n) + : 'LR' == this.direction + ? ((e = n), (n = i)) + : 'RL' == this.direction && ((e = -n), (n = i)), + (e += this.centerDist.x), + (n += this.centerDist.y), + this.newLayoutData()); + (i.finishx = e), + (i.finishy = n), + (i.xdistance = (1 / this.intSteps) * (e - t.x)), + (i.ydistance = (1 / this.intSteps) * (n - t.y)), + (t.layoutData = i); + }), + (this.computeCenter = function () { + var e = 1 / 0, + n = -1 / 0, + i = 1 / 0, + r = -1 / 0; + return ( + this.nodes.forEach(function (t) { + (i = Math.min(i, t.x)), (r = Math.max(r, t.x)), (e = Math.min(e, t.y)), (n = Math.max(n, t.y)); + }), + { x: this.center[0] - (r - i) / 2, y: this.center[1] - (n - e) / 2 } + ); + }), + (this.getSuccessors = function (t) { + t = this.nodeIds.indexOf(t.id); + return this.nodeNeighbers[t] || []; + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }), + (this.checkHasCycle = function (e, n) { + var i = this; + (e.outLinks || []).forEach(function (t) { + t = t.target; + e.id != t.id && -1 == n.indexOf(t.id) ? (n.push(t.id), i.checkHasCycle(t, n)) : (i.hasCycle = !0); + }); + }); +} +function sc(t, e) { + (this.nodes = t), + (this.links = e), + (this.center = [0, 0]), + (this.SPEED_DIVISOR = 800), + (this.AREA_MULTIPLICATOR = 1e5), + (this.area = 5), + (this.speed = 10), + (this.inited = !1), + (this.finished = !1), + (this.getConfig = function () { + return [ + { label: '缩放比例', area: this.area }, + { label: '收敛速度', speed: this.speed }, + ]; + }), + (this.resetConfig = function (t) { + this.init(), + t && + ((this.area = Number(t.area) || 5), (this.speed = Number(t.speed) || 10), (this.center = t.center || [0, 0])); + }), + (this.init = function () { + var e = this; + (this.area = 200), + (this.speed = 5), + this.nodes.forEach(function (t) { + t.layoutData = e.newLayoutData(); + }), + (this.maxDisplace = Math.sqrt(e.AREA_MULTIPLICATOR * e.area) / 10), + (this.k = Math.sqrt((e.AREA_MULTIPLICATOR * e.area) / (1 + e.nodes.length))), + (this.totalIterates = Math.max(150, 15 * Math.sqrt(this.nodes.length, 2))), + (this.inited = !0); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.run = function () { + this.repulsiveForce(), + this.attractiveForce(), + this.sameTypeAttractive(), + this.resetNodePosition(), + this.totalIterates--, + this.totalIterates <= 0 && (this.finished = !0); + }), + (this.repulsiveForce = function () { + var s = this; + s.nodes.forEach(function (o, a) { + s.nodes.forEach(function (t, e) { + var n, i, r; + a != e && + ((e = o.x - t.x), (t = o.y - t.y), 5 < (n = Math.sqrt(e * e + t * t))) && + ((i = (s.k * s.k) / n), ((r = o.layoutData).dx += (e / n) * i * 0.01), (r.dy += (t / n) * i * 0.01)); + }); + }); + }), + (this.attractiveForce = function () { + var a = this; + a.links.forEach(function (t) { + var e = t.source, + t = t.target, + n = e.x - t.x, + i = e.y - t.y, + r = Math.sqrt(n * n + i * i), + o = (r * r) / a.k; + 5 < r && + ((e = e.layoutData), + (t = t.layoutData), + (e.dx -= (n / r) * o), + (e.dy -= (i / r) * o), + (t.dx += (n / r) * o), + (t.dy += (i / r) * o)); + }); + }), + (this.sameTypeAttractive = function () { + var h = this; + h.nodes.forEach(function (a, s) { + h.nodes.forEach(function (t, e) { + var n, i, r, o; + s != e && + a.cluster == t.cluster && + ((e = a.x - t.x), (n = a.y - t.y), 0 < (i = Math.sqrt(e * e + n * n))) && + ((r = (i * i) / h.k), + (o = a.layoutData), + (t = t.layoutData), + (o.dx -= (e / i) * r), + (o.dy -= (n / i) * r), + (t.dx += (e / i) * r), + (t.dy += (n / i) * r)); + }); + }); + }), + (this.resetNodePosition = function () { + var o = this; + o.nodes.forEach(function (t) { + (t.layoutData.dx *= o.speed / o.SPEED_DIVISOR), (t.layoutData.dy *= o.speed / o.SPEED_DIVISOR); + var e, + n = t.layoutData, + i = n.dx, + r = n.dy, + n = Math.sqrt(n.dx * n.dx + n.dy * n.dy); + 10 < n && + ((e = Math.min(o.maxDisplace * (o.speed / o.SPEED_DIVISOR), n)), + (t.x = t.x + (i / n) * e), + (t.y = t.y + (r / n) * e)); + }); + }), + (this.newLayoutData = function () { + return { dx: 0, dy: 0 }; + }); +} +function hc() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.center = [0, 0]), + (this.nodeSize = 50), + (this.nodesep = 10), + (this.ranksep = 100), + (this.rankdir = 'TB'), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.excute = function () { + this.inited && this.run(); + }), + (this.getConfig = function () { + return [ + { label: '节点大小', nodeSize: 50 }, + { label: '节点间距', nodesep: 10 }, + { label: '层间距', ranksep: 120 }, + { label: '排列方向', rankdir: 'TB' }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.center = t.center || [0, 0]), + (this.nodeSize = t.nodeSize || 50), + (this.nodesep = t.nodesep || 10), + (this.ranksep = t.ranksep || 120), + (this.rankdir = t.rankdir || 'TB')), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.init = function () { + (this.inited = !0), (this.finished = !1); + var e, + n, + i, + r = this, + o = new wh.graphlib.Graph(), + a = + (o.setDefaultEdgeLabel(function () { + return {}; + }), + o.setGraph({ rankdir: r.rankdir || 'TB', nodesep: r.nodesep || 10, ranksep: r.ranksep || 50 }), + new Map()), + s = + (r.nodes.forEach(function (t) { + var e = t.width + r.nodesep, + n = t.height + r.ranksep; + o.setNode(t.id, { width: e, height: n }), a.set(String(t.id), t); + }), + r.links.forEach(function (t) { + o.setEdge(t.source.id, t.target.id, { weight: 1 }); + }), + wh.layout(o), + []), + t = + (o.nodes().forEach(function (t) { + (e = o.node(t)), s.push({ x: e.x, y: e.y }); + }), + r.getNodesCenter(s)), + h = t.x - r.center[0], + c = t.y - r.center[1], + u = null; + o.nodes().forEach(function (t) { + var e = o.node(t), + t = ((u = a.get(t)), (n = e.x - h), (i = e.y - c), r.newLayoutData()); + (t.finishx = n), + (t.finishy = i), + (t.xdistance = (1 / r.intSteps) * (n - u.x)), + (t.ydistance = (1 / r.intSteps) * (i - u.y)), + (u.layoutData = t); + }); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.getNodesCenter = function (t) { + var e = 0, + n = 0; + return ( + t.forEach(function (t) { + (e += t.x), (n += t.y); + }), + (e /= t.length), + (n /= t.length), + { x: e, y: n } + ); + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }); +} +function cc(t, e) { + return t.parent === e.parent ? 1 : 2; +} +function uc(t, e) { + return t + e.x; +} +function lc(t, e) { + return Math.max(t, e.y); +} +function dc(t) { + var e = 0, + n = t.children, + i = n && n.length; + if (i) for (; 0 <= --i; ) e += n[i].value; + else e = 1; + t.value = e; +} +function fc(t, e) { + t instanceof Map ? ((t = [void 0, t]), void 0 === e && (e = pc)) : void 0 === e && (e = gc); + for (var n, i, r, o, a, t = new mc(t), s = [t]; (n = s.pop()); ) + if ((r = e(n.data)) && (a = (r = Array.from(r)).length)) + for (n.children = r, o = a - 1; 0 <= o; --o) + s.push((i = r[o] = new mc(r[o]))), (i.parent = n), (i.depth = n.depth + 1); + return t.eachBefore(yc); +} +function gc(t) { + return t.children; +} +function pc(t) { + return Array.isArray(t) ? t[1] : null; +} +function vc(t) { + void 0 !== t.data.value && (t.value = t.data.value), (t.data = t.data.data); +} +function yc(t) { + for (var e = 0; (t.height = e), (t = t.parent) && t.height < ++e; ); +} +function mc(t) { + (this.data = t), (this.depth = this.height = 0), (this.parent = null); +} +function xc(t) { + for ( + var e, + n, + i = 0, + r = (t = (function (t) { + for (var e, n, i = t.length; i; ) (n = (Math.random() * i--) | 0), (e = t[i]), (t[i] = t[n]), (t[n] = e); + return t; + })(Array.from(t))).length, + o = []; + i < r; + + ) + (e = t[i]), n && kc(n, e) ? ++i : ((n = Ec((o = wc(o, e)))), (i = 0)); + return n; +} +function wc(t, e) { + var n, i; + if (Mc(e, t)) return [e]; + for (n = 0; n < t.length; ++n) if (bc(e, t[n]) && Mc(Cc(t[n], e), t)) return [t[n], e]; + for (n = 0; n < t.length - 1; ++n) + for (i = n + 1; i < t.length; ++i) + if (bc(Cc(t[n], t[i]), e) && bc(Cc(t[n], e), t[i]) && bc(Cc(t[i], e), t[n]) && Mc(Nc(t[n], t[i], e), t)) + return [t[n], t[i], e]; + throw new Error(); +} +function bc(t, e) { + var n = t.r - e.r, + i = e.x - t.x, + e = e.y - t.y; + return n < 0 || n * n < i * i + e * e; +} +function kc(t, e) { + var n = t.r - e.r + 1e-9 * Math.max(t.r, e.r, 1), + i = e.x - t.x, + e = e.y - t.y; + return 0 < n && i * i + e * e < n * n; +} +function Mc(t, e) { + for (var n = 0; n < e.length; ++n) if (!kc(t, e[n])) return !1; + return !0; +} +function Ec(t) { + switch (t.length) { + case 1: + return { x: (e = t[0]).x, y: e.y, r: e.r }; + case 2: + return Cc(t[0], t[1]); + case 3: + return Nc(t[0], t[1], t[2]); + } + var e; +} +function Cc(t, e) { + var n = t.x, + i = t.y, + t = t.r, + r = e.x, + o = e.y, + e = e.r, + a = r - n, + s = o - i, + h = e - t, + c = Math.sqrt(a * a + s * s); + return { x: (n + r + (a / c) * h) / 2, y: (i + o + (s / c) * h) / 2, r: (c + t + e) / 2 }; +} +function Nc(t, e, n) { + var i = t.x, + r = t.y, + t = t.r, + o = e.x, + a = e.y, + e = e.r, + s = n.x, + h = n.y, + n = n.r, + c = i - o, + u = i - s, + l = r - a, + d = r - h, + f = e - t, + g = n - t, + p = i * i + r * r - t * t, + o = p - o * o - a * a + e * e, + a = p - s * s - h * h + n * n, + e = u * l - c * d, + p = (l * a - d * o) / (2 * e) - i, + s = (d * f - l * g) / e, + h = (u * o - c * a) / (2 * e) - r, + n = (c * g - u * f) / e, + d = s * s + n * n - 1, + l = 2 * (t + p * s + h * n), + o = p * p + h * h - t * t, + a = -(d ? (l + Math.sqrt(l * l - 4 * d * o)) / (2 * d) : o / l); + return { x: i + p + s * a, y: r + h + n * a, r: a }; +} +function _c(t, e, n) { + var i, + r, + o, + a, + s = t.x - e.x, + h = t.y - e.y, + c = s * s + h * h; + c + ? ((r = e.r + n.r), + (a = t.r + n.r), + (r *= r) > (a *= a) + ? ((i = (c + a - r) / (2 * c)), + (o = Math.sqrt(Math.max(0, a / c - i * i))), + (n.x = t.x - i * s - o * h), + (n.y = t.y - i * h + o * s)) + : ((i = (c + r - a) / (2 * c)), + (o = Math.sqrt(Math.max(0, r / c - i * i))), + (n.x = e.x + i * s - o * h), + (n.y = e.y + i * h + o * s))) + : ((n.x = e.x + n.r), (n.y = e.y)); +} +function Lc(t, e) { + var n = t.r + e.r - 1e-6, + i = e.x - t.x, + e = e.y - t.y; + return 0 < n && i * i + e * e < n * n; +} +function Sc(t) { + var e = t._, + t = t.next._, + n = e.r + t.r, + i = (e.x * t.r + t.x * e.r) / n, + t = (e.y * t.r + t.y * e.r) / n; + return i * i + t * t; +} +function Tc(t) { + (this._ = t), (this.next = null), (this.previous = null); +} +function Pc(t) { + if (!(o = (t = 'object' == typeof (e = t) && 'length' in e ? e : Array.from(e)).length)) return 0; + var e, n, i, r, o, a, s, h, c, u, l, d; + if ((((n = t[0]).x = 0), (n.y = 0), !(1 < o))) return n.r; + if (((i = t[1]), (n.x = -i.r), (i.x = n.r), (i.y = 0), !(2 < o))) return n.r + i.r; + _c(i, n, (r = t[2])), + (n = new Tc(n)), + (i = new Tc(i)), + (r = new Tc(r)), + (((n.next = r.previous = i).next = n.previous = r).next = i.previous = n); + t: for (h = 3; h < o; ++h) { + _c(n._, i._, (r = t[h])), (r = new Tc(r)), (c = i.next), (u = n.previous), (l = i._.r), (d = n._.r); + do { + if (l <= d) { + if (Lc(c._, r._)) { + (i = c), ((n.next = i).previous = n), --h; + continue t; + } + (l += c._.r), (c = c.next); + } else { + if (Lc(u._, r._)) { + (((n = u).next = i).previous = n), --h; + continue t; + } + (d += u._.r), (u = u.previous); + } + } while (c !== u.next); + for (r.previous = n, r.next = i, n.next = i.previous = i = r, a = Sc(n); (r = r.next) !== i; ) + (s = Sc(r)) < a && ((n = r), (a = s)); + i = n.next; + } + for (n = [i._], r = i; (r = r.next) !== i; ) n.push(r._); + for (r = xc(n), h = 0; h < o; ++h) ((n = t[h]).x -= r.x), (n.y -= r.y); + return r.r; +} +function Ac(t) { + return null == t ? null : Oc(t); +} +function Oc(t) { + if ('function' != typeof t) throw new Error(); + return t; +} +function Ic() { + return 0; +} +function Dc(t) { + return function () { + return t; + }; +} +function Bc(t) { + return Math.sqrt(t.value); +} +function Rc(e) { + return function (t) { + t.children || (t.r = Math.max(0, +e(t) || 0)); + }; +} +function zc(a, s) { + return function (t) { + if ((e = t.children)) { + var e, + n, + i, + r = e.length, + o = a(t) * s || 0; + if (o) for (n = 0; n < r; ++n) e[n].r += o; + if (((i = Pc(e)), o)) for (n = 0; n < r; ++n) e[n].r -= o; + t.r = i + o; + } + }; +} +function Vc(n) { + return function (t) { + var e = t.parent; + (t.r *= n), e && ((t.x = e.x + n * t.x), (t.y = e.y + n * t.y)); + }; +} +function jc(t) { + (t.x0 = Math.round(t.x0)), (t.y0 = Math.round(t.y0)), (t.x1 = Math.round(t.x1)), (t.y1 = Math.round(t.y1)); +} +function Fc(t, e, n, i, r) { + for (var o, a = t.children, s = -1, h = a.length, c = t.value && (i - e) / t.value; ++s < h; ) + ((o = a[s]).y0 = n), (o.y1 = r), (o.x0 = e), (o.x1 = e += o.value * c); +} +(Gh.prototype = new Ih()), + (qh.prototype = new Ih()), + (Hh.prototype = new Ih()), + (mc.prototype = fc.prototype = + { + constructor: mc, + count: function () { + return this.eachAfter(dc); + }, + each: function (t, e) { + let n = -1; + for (const i of this) t.call(e, i, ++n, this); + return this; + }, + eachAfter: function (t, e) { + for (var n, i, r, o = this, a = [o], s = [], h = -1; (o = a.pop()); ) + if ((s.push(o), (n = o.children))) for (i = 0, r = n.length; i < r; ++i) a.push(n[i]); + for (; (o = s.pop()); ) t.call(e, o, ++h, this); + return this; + }, + eachBefore: function (t, e) { + for (var n, i, r, o = [this], a = -1; (r = o.pop()); ) + if ((t.call(e, r, ++a, this), (n = r.children))) for (i = n.length - 1; 0 <= i; --i) o.push(n[i]); + return this; + }, + find: function (t, e) { + let n = -1; + for (const i of this) if (t.call(e, i, ++n, this)) return i; + }, + sum: function (r) { + return this.eachAfter(function (t) { + for (var e = +r(t.data) || 0, n = t.children, i = n && n.length; 0 <= --i; ) e += n[i].value; + t.value = e; + }); + }, + sort: function (e) { + return this.eachBefore(function (t) { + t.children && t.children.sort(e); + }); + }, + path: function (t) { + for ( + var e = this, + n = (function (t, e) { + if (t === e) return t; + var n = t.ancestors(), + i = e.ancestors(), + r = null; + for (t = n.pop(), e = i.pop(); t === e; ) (r = t), (t = n.pop()), (e = i.pop()); + return r; + })(e, t), + i = [e]; + e !== n; + + ) + (e = e.parent), i.push(e); + for (var r = i.length; t !== n; ) i.splice(r, 0, t), (t = t.parent); + return i; + }, + ancestors: function () { + for (var t = this, e = [t]; (t = t.parent); ) e.push(t); + return e; + }, + descendants: function () { + return Array.from(this); + }, + leaves: function () { + var e = []; + return ( + this.eachBefore(function (t) { + t.children || e.push(t); + }), + e + ); + }, + links: function () { + var e = this, + n = []; + return ( + e.each(function (t) { + t !== e && n.push({ source: t.parent, target: t }); + }), + n + ); + }, + copy: function () { + return fc(this).eachBefore(vc); + }, + [Symbol.iterator]: function* () { + var t, + e, + n, + i, + r, + o = [this]; + do { + for (t = o.reverse(), o = []; (r = t.pop()); ) + if ((yield r, (e = r.children))) for (n = 0, i = e.length; n < i; ++n) o.push(e[n]); + } while (o.length); + }, + }); +var Xc = { depth: -1 }, + Uc = {}; +function Wc(t) { + return t.id; +} +function Yc(t) { + return t.parentId; +} +function Gc(t, e) { + return t.parent === e.parent ? 1 : 2; +} +function qc(t) { + var e = t.children; + return e ? e[0] : t.t; +} +function Hc(t) { + var e = t.children; + return e ? e[e.length - 1] : t.t; +} +function Qc(t, e, n) { + var i = n / (e.i - t.i); + (e.c -= i), (e.s += n), (t.c += i), (e.z += n), (e.m += n); +} +function Jc(t, e, n) { + return t.a.parent === e.parent ? t.a : n; +} +function Kc(t, e) { + (this._ = t), + (this.parent = null), + (this.children = null), + (this.A = null), + ((this.a = this).z = 0), + (this.m = 0), + (this.c = 0), + (this.s = 0), + (this.t = null), + (this.i = e); +} +function Zc(t, e, n, i, r) { + for (var o, a = t.children, s = -1, h = a.length, c = t.value && (r - n) / t.value; ++s < h; ) + ((o = a[s]).x0 = e), (o.x1 = i), (o.y0 = n), (o.y1 = n += o.value * c); +} +Kc.prototype = Object.create(mc.prototype); +var $c = (1 + Math.sqrt(5)) / 2; +function tu(t, e, n, i, r, o) { + for (var a, s, h, c, u, l, d, f, g, p, y, v = [], m = e.children, x = 0, w = 0, b = m.length, k = e.value; x < b; ) { + for (h = r - n, c = o - i; !(u = m[w++].value) && w < b; ); + for (y = (l = d = u) * u * (p = Math.max(c / h, h / c) / (k * t)), g = Math.max(d / y, y / l); w < b; ++w) { + if ( + ((u += s = m[w].value), s < l && (l = s), d < s && (d = s), (y = u * u * p), (f = Math.max(d / y, y / l)) > g) + ) { + u -= s; + break; + } + g = f; + } + v.push((a = { value: u, dice: h < c, children: m.slice(x, w) })), + a.dice ? Fc(a, n, i, r, k ? (i += (c * u) / k) : o) : Zc(a, n, i, k ? (n += (h * u) / k) : r, o), + (k -= u), + (x = w); + } + return v; +} +var eu = (function e(o) { + function t(t, e, n, i, r) { + tu(o, t, e, n, i, r); + } + return ( + (t.ratio = function (t) { + return e(1 < (t = +t) ? t : 1); + }), + t + ); + })($c), + nu = (function e(f) { + function t(t, e, n, i, r) { + if ((o = t._squarify) && o.ratio === f) + for (var o, a, s, h, c, u = -1, l = o.length, d = t.value; ++u < l; ) { + for (s = (a = o[u]).children, h = a.value = 0, c = s.length; h < c; ++h) a.value += s[h].value; + a.dice + ? Fc(a, e, n, i, d ? (n += ((r - n) * a.value) / d) : r) + : Zc(a, e, n, d ? (e += ((i - e) * a.value) / d) : i, r), + (d -= a.value); + } + else (t._squarify = o = tu(f, t, e, n, i, r)), (o.ratio = f); + } + return ( + (t.ratio = function (t) { + return e(1 < (t = +t) ? t : 1); + }), + t + ); + })($c), + iu = e( + {}, + Object.freeze({ + __proto__: null, + cluster: function () { + var s = cc, + h = 1, + c = 1, + u = !1; + function e(e) { + var i, + r = 0, + t = + (e.eachAfter(function (t) { + var e, + n = t.children; + n + ? ((t.x = (e = n).reduce(uc, 0) / e.length), (t.y = 1 + n.reduce(lc, 0))) + : ((t.x = i ? (r += s(t, i)) : 0), (t.y = 0), (i = t)); + }), + (function (t) { + for (var e; (e = t.children); ) t = e[0]; + return t; + })(e)), + n = (function (t) { + for (var e; (e = t.children); ) t = e[e.length - 1]; + return t; + })(e), + o = t.x - s(t, n) / 2, + a = n.x + s(n, t) / 2; + return e.eachAfter( + u + ? function (t) { + (t.x = (t.x - e.x) * h), (t.y = (e.y - t.y) * c); + } + : function (t) { + (t.x = ((t.x - o) / (a - o)) * h), (t.y = (1 - (e.y ? t.y / e.y : 1)) * c); + }, + ); + } + return ( + (e.separation = function (t) { + return arguments.length ? ((s = t), e) : s; + }), + (e.size = function (t) { + return arguments.length ? ((u = !1), (h = +t[0]), (c = +t[1]), e) : u ? null : [h, c]; + }), + (e.nodeSize = function (t) { + return arguments.length ? ((u = !0), (h = +t[0]), (c = +t[1]), e) : u ? [h, c] : null; + }), + e + ); + }, + hierarchy: fc, + pack: function () { + var e = null, + n = 1, + i = 1, + r = Ic; + function o(t) { + return ( + (t.x = n / 2), + (t.y = i / 2), + e + ? t.eachBefore(Rc(e)).eachAfter(zc(r, 0.5)).eachBefore(Vc(1)) + : t + .eachBefore(Rc(Bc)) + .eachAfter(zc(Ic, 1)) + .eachAfter(zc(r, t.r / Math.min(n, i))) + .eachBefore(Vc(Math.min(n, i) / (2 * t.r))), + t + ); + } + return ( + (o.radius = function (t) { + return arguments.length ? ((e = Ac(t)), o) : e; + }), + (o.size = function (t) { + return arguments.length ? ((n = +t[0]), (i = +t[1]), o) : [n, i]; + }), + (o.padding = function (t) { + return arguments.length ? ((r = 'function' == typeof t ? t : Dc(+t)), o) : r; + }), + o + ); + }, + packSiblings: function (t) { + return Pc(t), t; + }, + packEnclose: xc, + partition: function () { + var n = 1, + i = 1, + s = 0, + r = !1; + function e(t) { + var o, + a, + e = t.height + 1; + return ( + (t.x0 = t.y0 = s), + (t.x1 = n), + (t.y1 = i / e), + t.eachBefore( + ((o = i), + (a = e), + function (t) { + t.children && Fc(t, t.x0, (o * (t.depth + 1)) / a, t.x1, (o * (t.depth + 2)) / a); + var e = t.x0, + n = t.y0, + i = t.x1 - s, + r = t.y1 - s; + i < e && (e = i = (e + i) / 2), + r < n && (n = r = (n + r) / 2), + (t.x0 = e), + (t.y0 = n), + (t.x1 = i), + (t.y1 = r); + }), + ), + r && t.eachBefore(jc), + t + ); + } + return ( + (e.round = function (t) { + return arguments.length ? ((r = !!t), e) : r; + }), + (e.size = function (t) { + return arguments.length ? ((n = +t[0]), (i = +t[1]), e) : [n, i]; + }), + (e.padding = function (t) { + return arguments.length ? ((s = +t), e) : s; + }), + e + ); + }, + stratify: function () { + var l = Wc, + d = Yc; + function e(t) { + for (var e, n, i, r, o, a, s = Array.from(t), h = s.length, c = new Map(), u = 0; u < h; ++u) + (e = s[u]), + (r = s[u] = new mc(e)), + null != (o = l(e, u, t)) && (o += '') && ((a = r.id = o), c.set(a, c.has(a) ? Uc : r)), + null != (o = d(e, u, t)) && (o += '') && (r.parent = o); + for (u = 0; u < h; ++u) + if ((o = (r = s[u]).parent)) { + if (!(i = c.get(o))) throw new Error('missing: ' + o); + if (i === Uc) throw new Error('ambiguous: ' + o); + i.children ? i.children.push(r) : (i.children = [r]), (r.parent = i); + } else { + if (n) throw new Error('multiple roots'); + n = r; + } + if (!n) throw new Error('no root'); + if ( + ((n.parent = Xc), + n + .eachBefore(function (t) { + (t.depth = t.parent.depth + 1), --h; + }) + .eachBefore(yc), + (n.parent = null), + 0 < h) + ) + throw new Error('cycle'); + return n; + } + return ( + (e.id = function (t) { + return arguments.length ? ((l = Oc(t)), e) : l; + }), + (e.parentId = function (t) { + return arguments.length ? ((d = Oc(t)), e) : d; + }), + e + ); + }, + tree: function () { + var d = Gc, + h = 1, + c = 1, + u = null; + function e(s) { + var e, + n, + i, + r, + o, + a, + t = (function () { + for (var t, e, n, i, r, o = new Kc(s, 0), a = [o]; (t = a.pop()); ) + if ((n = t._.children)) + for (t.children = new Array((r = n.length)), i = r - 1; 0 <= i; --i) + a.push((e = t.children[i] = new Kc(n[i], i))), (e.parent = t); + return ((o.parent = new Kc(null, 0)).children = [o]), o; + })(); + return ( + t.eachAfter(l), + (t.parent.m = -t.z), + t.eachBefore(f), + u + ? s.eachBefore(g) + : ((i = n = e = s).eachBefore(function (t) { + t.x < e.x && (e = t), t.x > n.x && (n = t), t.depth > i.depth && (i = t); + }), + (t = e === n ? 1 : d(e, n) / 2), + (r = t - e.x), + (o = h / (n.x + t + r)), + (a = c / (i.depth || 1)), + s.eachBefore(function (t) { + (t.x = (t.x + r) * o), (t.y = t.depth * a); + })), + s + ); + } + function l(t) { + var e = t.children, + n = t.parent.children, + l = t.i ? n[t.i - 1] : null; + if (e) { + for (var i, r = 0, o = 0, a = t.children, s = a.length; 0 <= --s; ) + ((i = a[s]).z += r), (i.m += r), (r += i.s + (o += i.c)); + e = (e[0].z + e[e.length - 1].z) / 2; + l ? ((t.z = l.z + d(t._, l._)), (t.m = t.z - e)) : (t.z = e); + } else l && (t.z = l.z + d(t._, l._)); + t.parent.A = (function (t, e) { + if (l) { + for ( + var n, i = t, r = t, o = l, a = i.parent.children[0], s = i.m, h = r.m, c = o.m, u = a.m; + (o = Hc(o)), (i = qc(i)), o && i; + + ) + (a = qc(a)), + ((r = Hc(r)).a = t), + 0 < (n = o.z + c - i.z - s + d(o._, i._)) && (Qc(Jc(o, t, e), t, n), (s += n), (h += n)), + (c += o.m), + (s += i.m), + (u += a.m), + (h += r.m); + o && !Hc(r) && ((r.t = o), (r.m += c - h)), i && !qc(a) && ((a.t = i), (a.m += s - u), (e = t)); + } + return e; + })(t, t.parent.A || n[0]); + } + function f(t) { + (t._.x = t.z + t.parent.m), (t.m += t.parent.m); + } + function g(t) { + (t.x *= h), (t.y = t.depth * c); + } + return ( + (e.separation = function (t) { + return arguments.length ? ((d = t), e) : d; + }), + (e.size = function (t) { + return arguments.length ? ((u = !1), (h = +t[0]), (c = +t[1]), e) : u ? null : [h, c]; + }), + (e.nodeSize = function (t) { + return arguments.length ? ((u = !0), (h = +t[0]), (c = +t[1]), e) : u ? [h, c] : null; + }), + e + ); + }, + treemap: function () { + var a = eu, + e = !1, + n = 1, + i = 1, + s = [0], + h = Ic, + c = Ic, + u = Ic, + l = Ic, + d = Ic; + function r(t) { + return (t.x0 = t.y0 = 0), (t.x1 = n), (t.y1 = i), t.eachBefore(o), (s = [0]), e && t.eachBefore(jc), t; + } + function o(t) { + var e = s[t.depth], + n = t.x0 + e, + i = t.y0 + e, + r = t.x1 - e, + o = t.y1 - e; + r < n && (n = r = (n + r) / 2), + o < i && (i = o = (i + o) / 2), + (t.x0 = n), + (t.y0 = i), + (t.x1 = r), + (t.y1 = o), + t.children && + ((e = s[t.depth + 1] = h(t) / 2), + (n += d(t) - e), + (i += c(t) - e), + (r -= u(t) - e) < n && (n = r = (n + r) / 2), + (o -= l(t) - e) < i && (i = o = (i + o) / 2), + a(t, n, i, r, o)); + } + return ( + (r.round = function (t) { + return arguments.length ? ((e = !!t), r) : e; + }), + (r.size = function (t) { + return arguments.length ? ((n = +t[0]), (i = +t[1]), r) : [n, i]; + }), + (r.tile = function (t) { + return arguments.length ? ((a = Oc(t)), r) : a; + }), + (r.padding = function (t) { + return arguments.length ? r.paddingInner(t).paddingOuter(t) : r.paddingInner(); + }), + (r.paddingInner = function (t) { + return arguments.length ? ((h = 'function' == typeof t ? t : Dc(+t)), r) : h; + }), + (r.paddingOuter = function (t) { + return arguments.length ? r.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t) : r.paddingTop(); + }), + (r.paddingTop = function (t) { + return arguments.length ? ((c = 'function' == typeof t ? t : Dc(+t)), r) : c; + }), + (r.paddingRight = function (t) { + return arguments.length ? ((u = 'function' == typeof t ? t : Dc(+t)), r) : u; + }), + (r.paddingBottom = function (t) { + return arguments.length ? ((l = 'function' == typeof t ? t : Dc(+t)), r) : l; + }), + (r.paddingLeft = function (t) { + return arguments.length ? ((d = 'function' == typeof t ? t : Dc(+t)), r) : d; + }), + r + ); + }, + treemapBinary: function (t, e, n, i, r) { + var o, + a, + p = t.children, + s = p.length, + y = new Array(s + 1); + for (y[0] = a = o = 0; o < s; ++o) y[o + 1] = a += p[o].value; + !(function t(e, n, i, r, o, a, s) { + if (n - 1 <= e) return ((h = p[e]).x0 = r), (h.y0 = o), (h.x1 = a), (h.y1 = s), 0; + for (var h = y[e], c = i / 2 + h, u = e + 1, l = n - 1; u < l; ) { + var d = (u + l) >>> 1; + y[d] < c ? (u = 1 + d) : (l = d); + } + c - y[u - 1] < y[u] - c && e + 1 < u && --u; + var f, + h = y[u] - h, + g = i - h; + s - o < a - r + ? (t(e, u, h, r, o, (f = i ? (r * g + a * h) / i : a), s), t(u, n, g, f, o, a, s)) + : (t(e, u, h, r, o, a, (f = i ? (o * g + s * h) / i : s)), t(u, n, g, r, f, a, s)); + })(0, s, t.value, e, n, i, r); + }, + treemapDice: Fc, + treemapSlice: Zc, + treemapSliceDice: function (t, e, n, i, r) { + (1 & t.depth ? Zc : Fc)(t, e, n, i, r); + }, + treemapSquarify: eu, + treemapResquarify: nu, + }), + ), + ru = function (t, e) { + return (function t(e, n, i) { + i.add(n); + var r, + o = [], + a = m(e[n]); + try { + for (a.s(); !(r = a.n()).done; ) { + var s = r.value; + i.has(s) || o.push(t(e, s, i)); + } + } catch (t) { + a.e(t); + } finally { + a.f(); + } + return { id: n, children: o }; + })(t, e, new Set()); + }, + ou = function (t) { + return (function t(e, n) { + if (void 0 !== (n[e.data.id] = e).children) { + var i, + r = m(e.children); + try { + for (r.s(); !(i = r.n()).done; ) t(i.value, n); + } catch (t) { + r.e(t); + } finally { + r.f(); + } + } + return n; + })(t, {}); + }, + au = function t(e, n) { + var i, + r = m(e); + try { + for (r.s(); !(i = r.n()).done; ) { + var o = i.value; + if (o.id === n) return !0; + if (void 0 !== o.subgraph && t(o.subgraph.nodes, n)) return !0; + } + } catch (t) { + r.e(t); + } finally { + r.f(); + } + return !1; + }, + su = function () { + return function (t, n) { + var i, + r, + o, + a, + s = n.links.reduce(function (t, e) { + return ( + void 0 === t[e.source] && (t[e.source] = []), + t[e.source].push(e.target), + void 0 === t[e.target] && (t[e.target] = []), + t[e.target].push(e.source), + t + ); + }, {}), + h = + void 0 === s[(t = t || n.nodes[0].id)] && + null != + (r = (function (t, e) { + var n, + i = m(t); + try { + for (i.s(); !(n = i.n()).done; ) { + var r = n.value; + if (r.id === e) return r.id; + if (void 0 !== r.subgraph && au(r.subgraph.nodes, e)) return r.id; + } + } catch (t) { + i.e(t); + } finally { + i.f(); + } + })(n.nodes, t)) + ? r + : t; + return void 0 === s[h] + ? { nodes: n.nodes, links: n.links } + : ((t = + void 0 !== (null == (r = n.options) ? void 0 : r.size) + ? iu.tree().size(n.options.size) + : iu.tree().nodeSize(null != (r = null == (t = n.options) ? void 0 : t.nodeSize) ? r : [30, 100])), + void 0 !== (null == (r = n.options) ? void 0 : r.separation) && t.separation(n.options.separation), + (i = ou( + t( + iu.hierarchy( + (!1 !== (null == (r = n.options) ? void 0 : r.bfs) + ? function (t, e) { + for (var n = [], i = [[e, n]], r = new Set([e]); 0 < i.length; ) { + var o, + a = f(i.shift(), 2), + s = a[0], + h = a[1], + c = m(t[s]); + try { + for (c.s(); !(o = c.n()).done; ) { + var u, + l = o.value; + r.has(l) || (r.add(l), (u = []), h.push({ id: l, children: u }), i.push([l, u])); + } + } catch (t) { + c.e(t); + } finally { + c.f(); + } + } + return { id: e, children: n }; + } + : ru)(s, h), + ), + ), + )), + (s = (r = + null != + (t = n.nodes.find(function (t) { + return t.id === h; + })) + ? t + : { x: void 0, y: void 0 }).x), + (t = r.y), + (o = (null != (r = null == (r = n.options) ? void 0 : r.x) ? r : 0) + (null != s ? s : 0)), + (a = (null != (s = null == (r = n.options) ? void 0 : r.y) ? s : 0) - (null != t ? t : 0)), + { + links: n.links, + nodes: n.nodes.map(function (t) { + var n = i[t.id]; + return void 0 === n ? t : e(e({}, t), {}, { x: n.x + o, y: n.y - a }); + }), + }); + }; + }, + hu = function (t, e) { + return (t -= Math.PI / 2), { x: e * Math.cos(t), y: e * Math.sin(t) }; + }; +function cu() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), + (this.links = e), + (this.center = [0, 0]), + (this.rootNodeId = null), + (this.type = 'radial'), + (this.bfs = !0), + (this.nodeSize = 30), + (this.layerDist = 100), + (this.areaRadius = 400), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.excute = function () { + this.inited && this.run(); + }), + (this.getConfig = function () { + return [ + { label: '根节点ID', rootNodeId: '' }, + { label: '布局类型', type: 'radial' }, + { label: '广度优先遍历', bfs: !0 }, + { label: '节点大小', nodeSize: 30 }, + { label: '层间距', layerDist: 100 }, + { label: '分布面半径', areaRadius: 400 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.center = t.center || [0, 0]), + (this.rootNodeId = t.rootNodeId || ''), + (this.type = t.type || 'radial'), + (this.bfs = Boolean('false' != t.bfs)), + (this.nodeSize = Number(t.nodeSize) || 30), + (this.layerDist = Number(t.layerDist) || 100), + (this.areaRadius = Number(t.areaRadius) || 400)), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.init = function () { + (this.inited = !0), (this.finished = !1), this.rootNodeId || (this.rootNodeId = this.nodes[0].id); + var r = 'radial' == this.type, + t = { bfs: this.bfs, x: 0, y: 0, nodeSize: [this.nodeSize, this.layerDist] }, + e = + (r && + ((t.size = [2 * Math.PI, this.areaRadius]), + (t.separation = function (t, e) { + return (t.parent == e.parent ? 1 : 2) / t.depth; + })), + []), + o = {}, + n = + (this.nodes.forEach(function (t) { + (o[t.id] = t), e.push({ id: t.id }); + }), + this.links.map(function (t) { + return { id: t.id, source: t.source.id, target: t.target.id }; + })), + n = + (o[this.rootNodeId] || (this.rootNodeId = this.nodes[0].id), + su()(this.rootNodeId, { nodes: e, links: n, options: t })), + a = this.center, + s = this; + n.nodes.forEach(function (t) { + var e = t.x + a[0], + n = t.y + a[1], + i = (r && ((e = (i = hu(t.x, t.y)).x + a[0]), (n = i.y + a[1])), o[t.id]), + t = s.newLayoutData(); + (t.finishx = e), + (t.finishy = n), + (t.xdistance = (1 / s.intSteps) * (e - i.x)), + (t.ydistance = (1 / s.intSteps) * (n - i.y)), + (i.layoutData = t); + }); + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++)); + } + this.finished = this.finishedCount >= n; + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }); +} +function uu(t, e) { + (this.nodes = t), + (this.links = e), + (this.stretch = 0.03), + (this.repulsion_range_sq = 1e5), + (this.force_multiplier = 5), + (this.center = [0, 0]), + (this.inited = !1), + (this.finished = !1), + (this.totalIterates = 0), + (this.getConfig = function () { + return [ + { label: '排斥力', repulsion: 1e5 }, + { label: '吸引力', force: 5 }, + { label: '边长度系数', stretch: 0.03 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.stretch = Number(t.stretch) || 0.03), + (this.repulsion_range_sq = Number(t.repulsion) || 1e5), + (this.force_multiplier = Number(t.force) || 5), + (this.center = t.center || [0, 0]), + (this.totalIterates = Math.max(3e3, 100 * Math.sqrt(this.nodes.length, 2))), + this.init()); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.excute = function () { + for (var t = 0; this.inited && t++ < 10; ) this.run(); + }), + (this.init = function () { + this.nodes.forEach(function (t) { + t.layoutData = { edgedx: 0, edgedy: 0, repulsiondx: 0, repulsiondy: 0, dx: 0, dy: 0 }; + }), + (this.inited = !0), + (this.finished = !1); + }), + (this.run = function () { + this.nodes.forEach(function (t) { + t = t.layoutData; + (t.dx /= 4), (t.dy /= 4), (t.edgedx = t.edgedy = 0), (t.repulsiondx = t.repulsiondy = 0); + }), + this.relaxEdges(), + this.calculateRepulsion(), + this.moveNodes(), + this.totalIterates--, + this.totalIterates <= 0 && (this.finished = !0); + }), + (this.relaxEdges = function () { + var o = this; + o.links.forEach(function (t) { + var e = t.source, + t = t.target, + n = e.x - t.x, + i = e.y - t.y, + r = Math.sqrt(n * n + i * i), + r = (o.force_multiplier * (1 - (r = 0 == r ? 1e-4 : r))) / r, + n = (r *= Math.pow(o.stretch, 2)) * n, + r = r * i, + i = e.layoutData, + e = t.layoutData; + (i.edgedx += n), (i.edgedy += r), (e.edgedx -= n), (e.edgedy -= r); + }); + }), + (this.calculateRepulsion = function () { + var a = this; + a.nodes.forEach(function (i) { + var r = 0, + o = 0, + t = + (a.nodes.forEach(function (t) { + var e, n; + i.id != t.id && + (0 == (n = (e = i.x - t.x) * e + (t = i.y - t.y) * t) + ? ((r += Math.random()), (o += Math.random())) + : n < a.repulsion_range_sq && ((r += e / n), (o += t / n))); + }), + r * r + o * o); + 0 < t && ((t = Math.sqrt(t) / 2), (i.layoutData.repulsiondx += r / t), (i.layoutData.repulsiondy += o / t)); + }); + }), + (this.moveNodes = function () { + var n = 0, + i = 0, + t = + (this.nodes.forEach(function (t) { + var e = t.layoutData; + (e.dx += e.repulsiondx + e.edgedx), + (e.dy += e.repulsiondy + e.edgedy), + (t.x += Math.max(-10, Math.min(10, e.dx))), + (t.y += Math.max(-10, Math.min(10, e.dy))), + (n += t.x), + (i += t.y); + }), + Math.round(n / this.nodes.length)), + e = Math.round(i / this.nodes.length), + r = this.center[0] - t, + o = this.center[1] - e; + this.nodes.forEach(function (t) { + (t.x += r), (t.y += o); + }); + }); +} +function lu(t, e) { + (this.nodes = t), + (this.links = e), + (this.config = { autoArea: !0, area: 1e6, gravity: 0.05, speed: 0.1, iterations: 1e3 }), + (this.maxDisplace = 10), + (this.k = 250), + (this.currentIter = 0), + (this.center = [0, 0]), + (this.inited = !1), + (this.finished = !1), + (this.totalIterates = 0), + (this.getConfig = function () { + return [ + { label: '重力', gravity: 0.05 }, + { label: '边长度', k: this.k }, + { label: '收敛速度', speed: 0.8 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.config.gravity = Number(t.gravity) || 0.05), + (this.config.speed = Number(t.speed) || 0.1), + (this.config.area = Number(t.area) || 1e6), + (this.k = Number(t.k) || 120), + (this.center = t.center || [0, 0]), + (this.config.iterations = Math.max(1e3, 10 * Math.sqrt(this.nodes.length, 2))), + (this.currentIter = 0)), + this.init(); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.init = function () { + this.nodes.forEach(function (t) { + (t.fr_x = t.x), (t.fr_y = t.y), (t.fr = { dx: 0, dy: 0 }); + }), + (this.maxDisplace = Math.sqrt(this.config.area / 2)), + this.maxDisplace < 200 && (this.maxDisplace = 200), + this.k < 250 && (this.k = 250), + (this.currentIter = 0), + (this.inited = !0), + (this.finished = !1); + }), + (this.excute = function () { + if (this.currentIter > this.config.iterations) this.finished = !0; + else for (var t = 0; this.inited && t++ < 10; ) this.run(), this.currentIter++; + }), + (this.run = function () { + for (var t = this.nodes, e = this.links, n = this.nodes.length, i = 0; i < n; i++) + for (var r = t[i], o = 0; o < n; o++) { + var a, + s, + h = t[o]; + r.id != h.id && + ((a = r.fr_x - h.fr_x), (s = r.fr_y - h.fr_y), 10 < (u = Math.sqrt(a * a + s * s) + 5)) && + ((h = (this.k * this.k) / u), (r.fr.dx += (a / u) * h), (r.fr.dy += (s / u) * h)); + } + for (var c = e.length, i = 0; i < c; i++) { + var u, + l = e[i], + d = l.source, + l = l.target, + f = ((a = d.fr_x - l.fr_x), (s = d.fr_y - l.fr_y), ((u = Math.sqrt(a * a + s * s) + 5) * u) / this.k); + 10 < u && + ((d.fr.dx -= (a / u) * f), (d.fr.dy -= (s / u) * f), (l.fr.dx += (a / u) * f), (l.fr.dy += (s / u) * f)); + } + for (i = 0; i < n; i++) { + var r = t[i], + g = Math.sqrt(r.fr_x * r.fr_x + r.fr_y * r.fr_y), + p = 0.01 * this.k * this.config.gravity * g; + (r.fr.dx -= (p * r.fr_x) / g), + (r.fr.dy -= (p * r.fr_y) / g), + (r.fr.dx *= this.config.speed), + (r.fr.dy *= this.config.speed), + (a = r.fr.dx), + (s = r.fr.dy), + 10 < (u = Math.sqrt(a * a + s * s)) && + ((p = Math.min(this.maxDisplace * this.config.speed, u)), (r.fr_x += (a / u) * p), (r.fr_y += (s / u) * p)); + } + var y = 0, + v = 0; + for (i = 0; i < n; i++) (t[i].x = t[i].fr_x), (t[i].y = t[i].fr_y), (y += t[i].x), (v += t[i].y); + var m = Math.round(y / n), + x = Math.round(v / n), + w = this.center[0] - m, + b = this.center[1] - x; + for (i = 0; i < n; i++) (t[i].x += w), (t[i].y += b); + }); +} +function du(t, e) { + (this.nodes = t), + (this.links = e), + (this.outCircleNodes = 11), + (this.layerDistance = 30), + (this.boolTransition = !0), + (this.intSteps = 50), + (this.center = [0, 0]), + (this.inited = !1), + (this.finished = !1), + (this.finishedCount = 0), + (this.getConfig = function () { + return [ + { label: '外层点数', outCircleNodes: 11 }, + { label: '层间距', layerDistance: 30 }, + ]; + }), + (this.resetConfig = function (t) { + t && + ((this.outCircleNodes = Number(t.outCircleNodes) || 11), + (this.layerDistance = Number(t.layerDistance) || 30), + this.init()); + }), + (this.addData = function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + (this.nodes = t), (this.links = e); + }), + (this.excute = function () { + this.inited && this.run(); + }), + (this.init = function () { + var t = (h = this.nodes).length, + e = 0, + n = 0, + i = 0, + r = 0, + o = 0, + a = 0, + s = 0, + h = h.sort(function (t, e) { + (t = (t.inLinks || []).length + (t.outLinks || []).length), + (e = (e.inLinks || []).length + (e.outLinks || []).length); + return t < e ? -1 : e < t ? 1 : 0; + }); + this.outCircleNodes > t && (this.outCircleNodes = 0); + for (var c = 0; c < t; c++) { + var u = h[c], + l = + ((i += u.radius * u.scale) > n && + ((a = u.radius * u.scale), + (s = e + this.layerDistance + a), + (n = 2 * Math.PI * s), + (e = e + this.layerDistance + u.radius * u.scale), + (o = 1 / s), + (r = 0), + (i = u.radius * u.scale)), + (r += + c < t - this.outCircleNodes + ? o * u.radius * u.scale + : ((s = e + this.layerDistance + a), (2 * Math.PI) / this.outCircleNodes)), + this.newLayoutData()); + (l.finishx = 2.4 * s * Math.cos(r + Math.PI)), + (l.finishy = 2.4 * s * Math.sin(r + Math.PI)), + (l.xdistance = (1 / this.intSteps) * (l.finishx - u.x)), + (l.ydistance = (1 / this.intSteps) * (l.finishy - u.y)), + (u.layoutData = l); + } + (this.inited = !0), (this.finishedCount = 0), (this.finished = !1); + }), + (this.newLayoutData = function () { + return { finishx: 0, finishy: 0, xdistance: 0, ydistance: 0 }; + }), + (this.run = function () { + for (var t, e = this.nodes, n = e.length, i = 0; i < n; i++) { + var r, + o = e[i]; + null != (t = o.layoutData) && + (this.boolTransition + ? ((r = Math.abs(o.x - t.finishx)), + Math.abs(o.x + t.xdistance - t.finishx) < r ? (o.x += t.xdistance) : (o.x = t.finishx), + (r = Math.abs(o.y - t.finishy)), + Math.abs(o.y + t.ydistance - t.finishy) < r ? (o.y += t.ydistance) : (o.y = t.finishy), + o.x == t.finishx && o.y == t.finishy && ((o.layoutData = null), this.finishedCount++)) + : ((o.x = t.finishx), (o.y = t.finishy), (o.layoutData = null), this.finishedCount++), + (this.finished = this.finishedCount >= n)); + } + }); +} +function fu() { + var t = null; + switch (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 'fastLayout') { + case 'fastForce': + t = new Qh([], []); + break; + case 'concentric': + t = new Kh([]); + break; + case 'hierarchical': + t = new Zh([], []); + break; + case 'grid': + t = new $h([]); + break; + case 'circle': + t = new ec([], []); + break; + case 'kawakai': + t = new tc([], []); + break; + case 'avoidlap': + t = new Jh([]); + break; + case 'forceDirected': + t = new nc([], []); + break; + case 'radialTree': + t = new ic([], []); + break; + case 'simulation': + t = new rc([], []); + break; + case 'arf': + t = new oc([], []); + break; + case 'tree': + t = new ac([], []); + break; + case 'cluster': + t = new sc([], []); + break; + case 'dagre': + t = new hc([], []); + break; + case 'radial': + t = new cu([], []); + break; + case 'spring': + t = new uu([], []); + break; + case 'fruchterman': + t = new lu([], []); + break; + case 'layeres': + t = new du([], []); + break; + default: + t = new Jh([]); + } + return t; +} +function gu(t) { + var e = '', + n = ''; + switch (t) { + case 'fastForce': + (e = Qh.toString()), (n = Jh.toString()); + break; + case 'kawakai': + (e = tc.toString()), (n = Jh.toString()); + break; + case 'hierarchical': + e = Zh.toString(); + break; + case 'concentric': + e = Kh.toString(); + break; + case 'circle': + e = ec.toString(); + break; + case 'grid': + e = $h.toString(); + break; + case 'forceDirected': + e = nc.toString(); + break; + case 'radialTree': + e = ic.toString(); + break; + case 'avoidlap': + e = Jh.toString(); + break; + case 'simulation': + e = rc.toString(); + break; + case 'arf': + e = oc.toString(); + break; + case 'tree': + e = ac.toString(); + break; + case 'cluster': + e = sc.toString(); + break; + case 'spring': + e = uu.toString(); + break; + case 'fruchterman': + e = lu.toString(); + break; + case 'layeres': + e = du.toString(); + break; + default: + (e = Qh.toString()), (n = Jh.toString()); + } + (t = e.indexOf('(')), (e = 'function Layout' + e.substring(t)); + return ( + 0 < n.length && ((t = n.indexOf('(')), (n = 'function AvoidOverlap' + n.substring(t))), + ' ' + .concat(e, ' ') + .concat(n, ' ') + .concat( + "\n\nonmessage = function(event) {\n\t//获取主线程传输的数据\n\tvar array_buffer = new Uint8Array(event.data).buffer;\n\tvar decoder = new TextDecoder(\"utf-8\");\n\tvar view = new DataView(array_buffer, 0, array_buffer.byteLength);\n\tvar eventData = JSON.parse(decoder.decode(view));\n\t\n\tvar layoutType = eventData.layoutType || 'fastForce', //布局类型\n\t\tlayoutConfig = eventData.layoutConfig, //布局参数配置\n\t\tcenter=eventData.center||[0,0], // 中心位置\n\t\ttotalTimes=eventData.totalTimes || 50; //计算次数\n\t\n\t//构建布局数据格式\n\tlet {nodes,links} = buildLayoutData(eventData.nodes,eventData.links);\n\t\n\t//如果节点数过多,需要布局类型进度调整\n\tif(nodes.length >= 1000 && layoutType=='kawakai'){\n\t\tlayoutType = 'fastForce';\n\t}\n\t\n\t//创建布局对象\n\tlet layout = new Layout(nodes,links);\n\t\n\tif(layoutType == 'fastForce'){\n\t\tif(layoutConfig){\n\t\t\tlayoutConfig['noverlap'] = true;\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({\n\t\t\t\tfriction:0.8,\n\t\t\t\tlinkDistance:100,\n\t\t\t\tlinkStrength:0.03,\n\t\t\t\tcharge:-200,\n\t\t\t\tgravity:0.01,\n\t\t\t\tnoverlap:true,\n\t\t\t\tcenter:center\n\t\t\t});\n\t\t}\n\t}\n\telse if(layoutType == 'simulation'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({\n\t\t\t\tstrength:-1500,\n\t\t\t\tajustCluster:false,\n\t\t\t\tcenter:center\n\t\t\t});\n\t\t}\n\t}\n\telse if(layoutType == 'kawakai'){\n\t\t if(layoutConfig){\n\t\t \tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({sizeScale:1.5,center:center});\n\t\t}\n\t}\n\telse if(layoutType == 'grid'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({nodeSpace:120,layerSpace:120,splitType:2,center:center});\n\t\t}\n\t\tlayout.boolTransition = false;\n\t\ttotalTimes = 1;\n\t}\n\telse if(layoutType == 'concentric'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({maxNodeSize:80,levelWidth:1,center:center});\n\t\t}\n\t\tlayout.boolTransition = false;\n\t\ttotalTimes = 1;\n\t}\n\telse if(layoutType == 'circle'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({scale:1.2,ordering:'degree',center:center});\n\t\t}\n\t\tlayout.boolTransition = false;\n\t\ttotalTimes = 1;\n\t}\n\telse if(layoutType == 'radialTree'){\n\t\tlayout.resetConfig({center:center});\n\t\tlayout.boolTransition = false;\n\t\ttotalTimes = 1;\n\t}\n\telse if(layoutType == 'forceDirected'){\n\t\tlayout.resetConfig({center:center});\n\t}\n\telse if(layoutType == 'hierarchical'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({nodeSpace:100,layerSpace:160,sortType:'hubsize',direction: 'UD',center:center});\n\t\t}\n\t\tlayout.boolTransition = false;\n\t\ttotalTimes = 1;\n\t}else if(layoutType == 'arf'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({neighberForce:8.0,attraction:0.05,forceScale:8.0,center:center});\n\t\t}\n\t\ttotalTimes += 50;\n\t}else if(layoutType == 'tree'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({nodeSpace:100,layerSpace:160,direction: 'UD',center:center});\n\t\t}\n\t\tlayout.boolTransition = false;\n\t\ttotalTimes = 1;\n\t}else if(layoutType == 'cluster'){\n\t\tif(layoutConfig){\n\t\t\tlayout.resetConfig(layoutConfig);\n\t\t}else{\n\t\t\tlayout.resetConfig({area:5,speed:10,center:center});\n\t\t}\n\t}else{\n\t\tlayout.init();\n\t}\n\t\n\t//布局次数计数器\n\tlet layoutTimes=0;\n\n\t//执行n次布局\n\twhile(layoutTimes++ < totalTimes){\n\t\tvar index = 0;\n\t\twhile(index++ < 10){\n\t\t\tlayout.excute(); //执行布局算法\n\t\t}\n\t\tpostMessage({type: \"ticked\", counter:layoutTimes});\n\t}\n\n\t//对数据进行缩放\n\t// if(['kawakai'].indexOf(layoutType) != -1){\n\t// \tnodes = coordsScale(nodes,1.6);\n\t// }\n\n\t//当节点大于100并且为网络布局时,调整节点尽量避免重叠\n\t// if(nodes.length > 100 && ['fastForce','kawakai'].indexOf(layoutType) != -1){\n\t// \tpostMessage({type: \"ticked\", counter:layoutTimes-1});\n\t// \toverlapLayout(nodes);\n\t// }\n\t\n\tvar finishedNodes = nodes.map(function(node){\n\t\treturn {\n\t\t\tid:node.id,\n\t\t\tx: Math.round(node.x),\n\t\t\ty: Math.round(node.y)\n\t\t};\n\t});\n\t\n\tpostMessage({type: \"completed\", nodes:finishedNodes});\n\tself.close();\n\n\t//避免重叠的调整布局\n\tfunction overlapLayout(nodes){\n\t\tvar overlap= new AvoidOverlap({nodes:nodes});\n\t\toverlap.resetConfig({maxPadding:10});\n\n\t\tvar overlapTime = Math.min(Math.round(Math.sqrt(nodes.length)),200);\n\t\tvar index = 0;\n\t\twhile(index++ < overlapTime){\n\t\t\toverlap.excute();\n\t\t}\n\t};\n\n\t//图缩放比例\n\tfunction coordsScale(_nodes,scale){\n\t\tvar nodeCount = nodes.length;\n var xMean = 0,yMean = 0;\n\t\t_nodes.forEach(function(n) {\n xMean += n.x;\n yMean += n.y\n });\n xMean /= nodeCount;\n yMean /= nodeCount;\n _nodes.forEach(function(node) {\n node.x = xMean + ((node.x - xMean) * scale);\n node.y = yMean + ((node.y - yMean) * scale);\n });\n\t\treturn _nodes;\n\t};\n\t\n\t//构建可视化布局数据\n\tfunction buildLayoutData(_nodes=[],_links=[]){\n\t\tvar nodeIdMapNode= new Map();\n\t\t_nodes.forEach(function(n){\n\t\t\tn.scale = 1;\n\t\t\tn.radius=Math.ceil(n.radius*(n.scale?n.scale:1));\n\t\t\tn.x = n.x || Math.round(Math.random()*1000);\n\t\t\tn.y = n.y || Math.round(Math.random()*1000);\n\t\t\tn.selected = n.selected || false;\n\t\t\tn.cluster = n.cluster;\n\t\t\t\n\t\t\tnodeIdMapNode.set(n.id,n);\n\t\t});\n\t\t\n\t\tvar links=[];\n\t\t_links.forEach(function(l){\n\t\t\tvar sourceNode = nodeIdMapNode.get(l.source),\n\t\t\t\ttargetNode = nodeIdMapNode.get(l.target);\n\t\t\n\t\t\tif(sourceNode){\n\t\t\t\tsourceNode.outLinks=sourceNode.outLinks||[];\n\t\t\t\tsourceNode.outLinks.push({\n\t\t\t\t\tsource:sourceNode,\n\t\t\t\t\ttarget:targetNode\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\tif(targetNode){\n\t\t\t\ttargetNode.inLinks=targetNode.inLinks||[];\n\t\t\t\ttargetNode.inLinks.push({\n\t\t\t\t\tsource:sourceNode,\n\t\t\t\t\ttarget:targetNode\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\tlinks.push({\n\t\t\t\tsource:sourceNode,\n\t\t\t\ttarget:targetNode\n\t\t\t});\n\t\t});\n\t\t\n\t\tvar newNodes = [];\n\t\tnodeIdMapNode.forEach(function(value, key) {\n\t\t\tnewNodes.push(value);\n\t\t});\n\t\t\n\t\treturn {nodes:newNodes,links:links};\n\t}\n};\n\n", + ) + ); +} +function pu(t) { + var e = window.URL || window.webkitURL, + t = new Blob([t], { type: 'text/javascript' }), + e = e.createObjectURL(t); + return new Worker(e); +} +var vu = function (h, t) { + var e = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : { x: 0, y: 0 }, + n = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 'fastForce', + i = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : null, + c = 5 < arguments.length ? arguments[5] : void 0, + r = e.x, + e = e.y, + o = t.nodes || [], + a = t.links || [], + u = new Map(), + s = new Map(), + l = [], + d = 0, + f = []; + if ( + (null != i && i.autoRun + ? o.forEach(function (t, e) { + (d = e + 1), + s.set(t.id, d), + u.set(d, t), + f.push({ + id: d, + scale: 1, + radius: Math.ceil(t.radius * (t.scale || 1)), + x: t.cx, + y: t.cy, + type: t.type || 'default', + selected: t.selected || !1, + definedLevel: t.definedLevel, + }); + }) + : o.forEach(function (t, e) { + (d = e + 1), + s.set(t.id, d), + u.set(d, t), + 0 < (t.outLinks || []).length || 0 < (t.inLinks || []).length + ? f.push({ + id: d, + scale: 1, + radius: Math.ceil(t.radius * (t.scale || 1)), + x: t.cx, + y: t.cy, + type: t.type || 'default', + selected: t.selected || !1, + definedLevel: t.definedLevel, + }) + : l.push(t); + }), + 0 == f.length) + ) + return w({ nodes: [] }); + var g, + p, + y = {}, + v = []; + a.forEach(function (t) { + t.source.id != t.target.id && + ((g = ''.concat(t.source.id, '-').concat(t.target.id)), + (p = ''.concat(t.target.id, '-').concat(t.source.id)), + (y[g] && y[p]) || + (v.push({ source: s.get(t.source.id), target: s.get(t.target.id), weight: t.weight }), + (y[g] = !0), + (y[p] = !0))); + }); + var m = Math.max(Math.round(f.length + 10 * Math.sqrt(f.length + v.length)), 200), + x = pu(gu(n)), + o = new TextEncoder('utf-8').encode( + JSON.stringify({ totalTimes: m, nodes: f, links: v, center: [r, e], layoutType: n, layoutConfig: i }), + ); + function w(t) { + var n, + i, + r, + o, + a, + e, + s = t.nodes; + 0 != l.length && + ((s = (function (t) { + var e; + return 0 == t.length + ? { left: 10, right: 2e3, top: 10, bottom: 400 } + : ((e = { + left: Number.MAX_VALUE, + right: -Number.MAX_VALUE, + top: Number.MAX_VALUE, + bottom: -Number.MAX_VALUE, + }), + t.forEach(function (t) { + e.left > t.x && (e.left = t.x), + e.right < t.x && (e.right = t.x), + e.top > t.y && (e.top = t.y), + e.bottom < t.y && (e.bottom = t.y); + }), + e); + })(s)), + (n = s.left), + (i = s.right), + (r = s.bottom), + (a = o = 0), + l.forEach(function (t, e) { + (t.x = Math.round(n + a * t.radius * 4) + 60), + (t.y = Math.round(r + o * t.radius * 4) + 80), + a++, + i <= t.x && (o++, (a = 0)); + })), + t.nodes.forEach(function (t) { + ((e = u.get(t.id)).cx = t.x), (e.cy = t.y); + }), + x && x.terminate(), + h.hideLoadProcess(), + 'function' == typeof c && c(); + } + x.postMessage(o.buffer, [o.buffer]), + (x.onmessage = function (t) { + switch (t.data.type) { + case 'ticked': + return ( + (e = 1 < (e = (e = (e = t.data).counter / m) < 0.01 ? 0.01 : e) ? 0.999 : e), + (n = Math.floor(100 * e) + '%'), + void h.showLoadProcess('布局进度:('.concat(n, ')'), e.toFixed(2)) + ); + case 'completed': + return w(t.data); + } + var e, n; + }); +}; +function yu(t, e) { + (this.defaultOption = { nodeRadius: 30, minCircleRadius: 150, graphMargin: 100, animate: !0 }), + (this.option = this.deepExtend(this.defaultOption, e, !0, !0)), + (this.graphVis = t), + (this.sourceData = { nodes: [], links: [] }); +} +(yu.prototype.activeAddData = function (v, t, n, i) { + var m = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 0, + r = 5 < arguments.length ? arguments[5] : void 0, + x = this, + o = { + nodes: t.nodes.map(function (t) { + return { id: t.id }; + }), + links: t.links.map(function (t) { + return { id: t.id, source: t.source, target: t.target }; + }), + }, + o = ((this.sourceData = t), x.validateData(v, o)), + w = o.nodes.filter(function (t) { + return 1 == t.increamFlag; + }); + if (w.length <= 1) return b([], x.addLinks(t.links)), !1; + var h = x.graphVis.buildVisualGraphData(o.nodes, o.links); + function a(t) { + var n, + i, + r, + o = t.nodes.filter(function (t) { + return 1 == t.increamFlag; + }), + a = 0 < (v.inLinks || []).length || 0 < (v.outLinks || []).length, + s = 0 === (v.inLinks || []).length && 0 === (v.outLinks || []).length && 1 < m, + a = + ((a || s) && + ((a = x.getBounds(o)), + (s = x.option.minCircleRadius), + 3 < o.length && ((s = a.radius + x.option.graphMargin), (s = Math.max(x.option.minCircleRadius, s))), + (r = a.centerX), + (a = a.centerY), + (n = v.cx - r), + (i = v.cy - a), + o.forEach(function (t) { + (t.cx -= n), (t.cy -= i), (t.x -= n), (t.y -= i); + }), + 3 < o.length) && + 1 < x.graphVis.nodes.length && + ((r = x.findAngleParent(v).node), x.autoMoveChildNode(v, r, s, !0)), + t.nodes.filter(function (t) { + return t.id == v.id; + })[0]), + h = a.cx - v.cx, + c = a.cy - v.cy, + u = new Map(), + l = + (x.sourceData.nodes.forEach(function (t) { + u.set(t.id, t); + }), + 1), + d = (x.option.animate && (l = 0.1), []), + d = + (w.forEach(function (t) { + var n; + v.id != t.id && + (((n = u.get(t.id)).style = e(e({}, n.style), {}, { cx: t.cx - h, cy: t.cy - c, alpha: l, scale: l })), + d.push(n)); + }), + x.graphVis.addNodes(d)), + f = (f = w.map(function (t) { + return t.id; + })).filter(function (t) { + return t != v.id; + }), + g = x.graphVis.nodes.filter(function (t) { + return -1 != f.indexOf(t.id); + }); + if (0 == g.length) return b([], []); + var p = v.cx, + y = v.cy; + x.option.animate + ? x.graphVis + .createBaseAnimate({ + targets: d, + duration: 800, + easing: 'easeOutQuad', + scale: 1, + alpha: 1, + begin: function (t) { + x.graphVis.switchAnimate(!0), x.graphVis.moveNodeToCenter({ x: p, y: y }, 700); + }, + }) + .finished.then(function () { + x.graphVis.switchAnimate(!1); + var t = x.addLinks(x.sourceData.links); + b(g, t); + }) + : (x.graphVis.moveNodeToCenter({ x: p, y: y }), (o = x.addLinks(x.sourceData.links)), b(g, o)); + } + function b(t, e) { + r && 'function' == typeof r && r(t, e); + } + null != v + ? ((v.oldX = Math.round(v.cx)), + (v.oldY = Math.round(v.cy)), + !(w.length <= 10) && n + ? (i + ? ((i.center = [v.cx, v.cy]), (i.noverlap = !0)) + : (i = { + center: [v.cx, v.cy], + friction: 0.9, + linkDistance: 100, + linkStrength: 0.1, + charge: -300, + gravity: 0.01, + noverlap: !0, + }), + x.graphVis.excuteWorkerLayout({ nodes: h.nodes, links: h.links }, n, i, !1, function () { + a(h); + })) + : (x.runStarLayout(v, h.nodes), a(h))) + : ((n = n || 'fastForce'), + (o = x.graphVis.getViewCenter()), + ((i = i || { + center: [o.x, o.y], + friction: 0.9, + linkDistance: 100, + linkStrength: 0.1, + charge: -300, + gravity: 0.01, + noverlap: !0, + }).center = [o.x, o.y]), + (i.noverlap = !0), + x.graphVis.excuteWorkerLayout({ nodes: h.nodes, links: h.links }, n, i, !1, function () { + var t = (t = h).nodes.filter(function (t) { + return (t.x = t.cx), (t.y = t.cy), 1 == t.increamFlag; + }), + e = { + centerX: (e = x.graphVis.getViewCenter()).x, + centerY: e.y, + width: 10, + height: 10, + left: e.x, + right: e.y + 10, + top: e.y, + bottom: e.y + 10, + }, + t = (0 < x.graphVis.nodes.length && (e = x.getBounds(x.graphVis.nodes)), x.getBounds(t)), + n = e.centerY, + e = { x: e.right + t.width / 2 + x.option.graphMargin, y: n }, + i = t.centerX - e.x, + r = t.centerY - e.y, + o = new Map(), + a = + (x.sourceData.nodes.forEach(function (t) { + o.set(t.id, t); + }), + []), + s = + (w.forEach(function (t) { + var e = o.get(t.id); + (e.x = t.cx - i), (e.y = t.cy - r), a.push(e); + }), + (a = x.graphVis.addNodes(a)), + w.map(function (t) { + return t.id; + })); + 0 == + (n = x.graphVis.nodes.filter(function (t) { + return -1 != s.indexOf(t.id); + })).length + ? b([], []) + : (x.option.animate + ? x.graphVis.moveNodeToCenter({ x: e.x, y: e.y }, 600) + : x.graphVis.moveNodeToCenter({ x: e.x, y: e.y }), + b(n, x.addLinks(x.sourceData.links))); + })); +}), + (yu.prototype.addLinks = function (t) { + var e, + n = this.graphVis.links.map(function (t) { + return t.id || t.source.id + '@' + t.target.id; + }), + i = []; + return ( + t.forEach(function (t) { + (e = t.id || t.source + '@' + t.target), -1 == n.indexOf(e) && i.push(t); + }), + this.graphVis.addEdges(i) + ); + }), + (yu.prototype.findAngleParent = function (t) { + var n = { relations: 0, node: null }, + i = t.id; + return ( + 0 < (t.inLinks || []).length + ? t.inLinks.forEach(function (t) { + var e, + t = t.source; + t.id != i && + ((e = (t.inLinks || []).length + (t.outLinks || []).length), n.relations < e) && + ((n.relations = e), (n.node = t)); + }) + : (t.outLinks || []).forEach(function (t) { + var e, + t = t.target; + t.id != i && + ((e = (t.inLinks || []).length + (t.outLinks || []).length), n.relations < e) && + ((n.relations = e), (n.node = t)); + }), + n + ); + }), + (yu.prototype.validateData = function (t, e) { + var n, + i = { nodes: [], links: [] }, + r = []; + return ( + null != t && (i.nodes.push({ id: t.id, increamFlag: !0 }), r.push(t.id)), + null != e && + ((n = this.graphVis.nodes.map(function (t) { + return t.id; + })), + e.nodes.forEach(function (t) { + -1 == n.indexOf(t.id) && ((t.increamFlag = !0), i.nodes.push(t), r.push(t.id)); + }), + e.links.forEach(function (t) { + -1 != r.indexOf(t.source) && -1 != r.indexOf(t.target) && i.links.push(t); + })), + i + ); + }), + (yu.prototype.autoMoveChildNode = function (t, e) { + var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 150, + i = 3 < arguments.length ? arguments[3] : void 0, + r = t.cx, + o = t.cy, + a = Math.PI, + s = (e && (a = Math.atan2(o - e.cy, r - e.cx)), this.graphVis.nodes), + h = s.length, + c = r, + u = o, + l = null; + if (i) + for (var d = !0, f = 0; d; ) + for (var g = 0; g < h; g++) + if ((l = s[g]).id != t.id && (d = this.checkNodeInCircle(l, c, u, n))) { + for ( + var c = Math.round(r + 50 * f * Math.cos(a)), + u = Math.round(o + 50 * f * Math.sin(a)), + p = a, + y = a, + v = 1; + v++ <= 12; + + ) + for (var m = 0; m < h; m++) + if ((l = s[m]).id != t.id && this.checkNodeInCircle(l, c, u, n)) { + if ( + ((p += Math.PI / 18), + (c = Math.round(r + 50 * f * Math.cos(p))), + (u = Math.round(o + 50 * f * Math.sin(p))), + this.checkNodeInCircle(l, c, u, n)) + ) { + (y -= Math.PI / 18), + (c = Math.round(r + 50 * f * Math.cos(y))), + (u = Math.round(o + 50 * f * Math.sin(y))); + break; + } + break; + } + f += 0.1; + break; + } + (t.cx = c), (t.cy = u); + }), + (yu.prototype.checkNodeInCircle = function (t, e, n, i) { + return Math.pow(e - t.cx, 2) + Math.pow(n - t.cy, 2) < i * i; + }), + (yu.prototype.getBounds = function (t) { + var e = { left: Number.MAX_VALUE, right: -Number.MIN_VALUE, top: Number.MAX_VALUE, bottom: -Number.MIN_VALUE }, + n = 0, + i = 0, + r = + (t.forEach(function (t) { + (e.left = Math.ceil(Math.min(t.x, e.left))), + (e.right = Math.ceil(Math.max(t.x, e.right))), + (e.top = Math.ceil(Math.min(t.y, e.top))), + (e.bottom = Math.ceil(Math.max(t.y, e.bottom))), + (n += t.cx), + (i += t.cy); + }), + Math.round(n / t.length)), + o = Math.round(i / t.length), + a = 0; + return ( + t.forEach(function (t) { + t = Math.sqrt(Math.pow(t.cx - r, 2) + Math.pow(t.cy - o, 2)); + a = Math.max(t, a); + }), + (e.width = Math.round(e.right - e.left)), + (e.height = Math.round(e.bottom - e.top)), + (e.centerX = r), + (e.centerY = o), + (e.radius = Math.round(a + 50)), + e + ); + }), + (yu.prototype.computeRadius = function (t) { + for (var e = this.option.minCircleRadius || 150, n = t.length, i = 0, r = 0; r < n; r++) i += 2 * t[r].radius * 2; + var o = Math.round(i / (2 * Math.PI)); + return o < e ? e : o; + }), + (yu.prototype.findAngle = function (t, e, n, i) { + i = Math.atan((i - e) / (n - t)); + return 0 <= n - t ? i + Math.PI : i; + }), + (yu.prototype.runStarLayout = function (e, t) { + var n, + i = e.cx, + r = e.cy, + o = this.computeRadius(t), + a = 0; + (0 < (e.inLinks || []).length || 0 < (e.outLinks || []).length) && + ((n = this.findAngleParent(e).node), (a = this.findAngle(i, r, n.cx, n.cy))); + for ( + var s = t.filter(function (t) { + return e.id == t.id && ((t.cx = 0), (t.cy = 0)), 1 == t.increamFlag && e.id != t.id; + }), + h = s.length, + c = a, + u = 0; + u < h; + u++ + ) { + var l, + d, + f = s[u]; + null != f && + ((d = l = 0), + (d = + 2 == h + ? ((c = 0 == u ? a - Math.PI / 8 : a + Math.PI / 8), + (l = o * Math.cos(2 * Math.PI + c)), + o * Math.sin(2 * Math.PI + c)) + : ((l = o * Math.cos(((2 * Math.PI) / h) * u + c)), o * Math.sin(((2 * Math.PI) / h) * u + c))), + (f.cx = l), + (f.cy = d)); + } + }), + (yu.prototype.deepExtend = function (t, e, n, i) { + for (var r in e) + if (e.hasOwnProperty(r) || !0 === n) + if (e[r] && e[r].constructor === Object) + void 0 === t[r] && (t[r] = {}), + t[r].constructor === Object + ? this.deepExtend(t[r], e[r], n) + : null === e[r] && void 0 !== t[r] && !0 === i + ? delete t[r] + : (t[r] = e[r]); + else if (Array.isArray(e[r])) { + t[r] = []; + for (var o = 0; o < e[r].length; o++) t[r].push(e[r][o]); + } else null === e[r] && void 0 !== t[r] && !0 === i ? delete t[r] : (t[r] = e[r]); + return t; + }); +var mu = function (t, n) { + var e = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2], + i = 3 < arguments.length ? arguments[3] : void 0, + r = t.nodes, + o = {}, + a = {}, + s = {}; + r.forEach(function (t, e) { + t = t.id; + (a[t] = 1 / 0), t === n && (a[t] = 0); + }); + for (var h, c = r.length, u = 0; u < c; u++) + !(function () { + var n = xu(a, r, o), + t = n.id; + if (((o[t] = !0), a[t] === 1 / 0)) return; + t = n.outLinks || []; + e || + ((h = (n.inLinks || []).map(function (t) { + return { source: t.target, target: t.source }; + })), + (t = t.concat(h))), + t.forEach(function (t) { + var e = t.target.id, + t = t['' + i] || 1; + a[e] > a[n.id] + t && ((a[e] = a[n.id] + t), (s[e] = n.id)); + }); + })(); + var l, + d = {}; + for (l in a) { + d[l] = [l]; + for (var f = s[l]; void 0 !== f; ) d[l].unshift(f), (f = s[f]); + } + return { length: a, path: d }; +}; +function xu() { + for ( + var t, + e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}, + r = 1 / 0, + o = 0; + o < n.length; + o++ + ) { + var a = n[o].id; + !i[a] && e[a] <= r && ((r = e[a]), (t = n[o])); + } + return t; +} +var wu = function (t, e, n) { + var i = 3 < arguments.length && void 0 !== arguments[3] && arguments[3], + r = 4 < arguments.length ? arguments[4] : void 0, + i = ('string' == typeof e && (e = Mu(t, e)), 'string' == typeof n && (n = Mu(t, n)), mu(t, e.id, i, r)), + r = i.length, + i = i.path; + return { length: r[n.id], path: i[n.id] }; + }, + bu = function (t, e, n) { + var i = 3 < arguments.length && void 0 !== arguments[3] && arguments[3]; + if ((e = 'string' == typeof e ? Mu(t, e) : e) === (n = 'string' == typeof n ? Mu(t, n) : n)) return [[e.id]]; + var r = [e], + o = s({}, e.id, !0), + a = [], + h = [], + c = i ? ku(e, 'target') : ku(e); + for (a.push(c); 0 < r.length && 0 < a.length; ) { + var u = a[a.length - 1]; + u.length + ? ((u = u.shift()) && + (r.push(u), + (o[u.id] = !0), + (c = i ? ku(u, 'target') : ku(u)), + a.push( + c.filter(function (t) { + return !o[t.id]; + }), + )), + r[r.length - 1] === n && + ((u = r.map(function (t) { + return t.id; + })), + h.push(u), + (u = r.pop()), + (o[u.id] = !1), + a.pop())) + : ((u = r.pop()), (o[u.id] = !1), a.pop()); + } + return h; + }, + ku = function (e, t) { + var n = []; + return (n = + 'target' == t + ? (e.outLinks || []) + .map(function (t) { + return t.target; + }) + .filter(function (t) { + return t.id != e.id; + }) + : ((n = (e.outLinks || []) + .map(function (t) { + return t.target; + }) + .filter(function (t) { + return t.id != e.id; + })), + (t = (e.inLinks || []) + .map(function (t) { + return t.source; + }) + .filter(function (t) { + return t.id != e.id; + })), + n.concat(t))); + }, + Mu = function (t, e) { + return t.nodes.filter(function (t) { + return t.id == e; + }); + }, + Eu = function (t, e) { + var n = []; + return (n = + 'target' == e + ? (t.outLinks || []).map(function (t) { + return t.target; + }) + : ((n = (t.outLinks || []).map(function (t) { + return t.target; + })), + (e = (t.inLinks || []).map(function (t) { + return t.source; + })), + n.concat(e))); + }, + Cu = function (t, e) { + return ( + e + ? function (a) { + function s(t) { + (u[t.id] = f), (l[t.id] = f), (f += 1), h.push(t), (c[t.id] = !0); + for ( + var e = Eu(t, 'target').filter(function (t) { + return -1 < a.indexOf(t); + }), + n = 0; + n < e.length; + n++ + ) { + var i = e[n]; + u[i.id] || 0 === u[i.id] + ? c[i.id] && (l[t.id] = Math.min(l[t.id], u[i.id])) + : (s(i), (l[t.id] = Math.min(l[t.id], l[i.id]))); + } + if (l[t.id] === u[t.id]) { + for (var r = []; 0 < h.length; ) { + var o = h.pop(); + if (((c[o.id] = !1), r.push(o), o === t)) break; + } + 0 < r.length && d.push(r); + } + } + var t, + h = [], + c = {}, + u = {}, + l = {}, + d = [], + f = 0, + e = m(a); + try { + for (e.s(); !(t = e.n()).done; ) { + var n = t.value; + u[n.id] || 0 === u[n.id] || s(n); + } + } catch (a) { + e.e(a); + } finally { + e.f(); + } + return d; + } + : function (t) { + function r(t) { + a.push(t), (o[t.id] = !0); + for (var e = Eu(t), n = 0; n < e.length; ++n) { + var i = e[n]; + o[i.id] || r(i); + } + } + for (var e = [], o = {}, a = [], n = 0; n < t.length; n++) { + var i = t[n]; + if (!o[i.id]) { + r(i); + for (var s = []; 0 < a.length; ) s.push(a.pop()); + e.push(s); + } + } + return e; + } + )(t); + }; +function Nu(t, e, n, i, r) { + for (var o = new Array(t.length), a = 0; a < e.length; a++) { + var s = i[e[a]], + h = i[n[a]]; + (o[s] = o[s] || []), o[s].push(h), r && ((o[h] = o[h] || []), o[h].push(s)); + } + return o; +} +function _u(t, e) { + return -1 === t[e] ? e : _u(t, t[e]); +} +function Lu(t, e, n) { + (e = _u(t, e)), (n = _u(t, n)); + t[e] = n; +} +function Su(t, e, n, i, r, o, a, s) { + if (((i[t] = r), n[t])) return !0; + if (!e[t]) { + (e[t] = 1), (n[t] = 1); + r = o[t]; + if (r) { + var h, + c = m(r); + try { + for (c.s(); !(h = c.n()).done; ) { + var u = h.value; + if (Su(u, e, n, i, t, o, a, s)) return a.push(s[u]), !0; + } + } catch (t) { + c.e(t); + } finally { + c.f(); + } + } + n[t] = 0; + } + return !1; +} +var Tu = function (t, e, n) { + for ( + var i = 3 < arguments.length && void 0 !== arguments[3] && arguments[3], + r = new Int32Array(t.length), + o = {}, + a = 0; + a < t.length; + a++ + ) + (r[a] = -1), (o[t[a]] = a); + for (var s = 0; s < e.length; s++) { + var h = o[e[s]], + c = o[n[s]]; + if (i && h === c) return !0; + (h = _u(r, h)), (c = _u(r, c)); + if (h === c) return !0; + Lu(r, h, c); + } + return !1; + }, + Pu = function (t, e, n) { + for ( + var i = t.length, r = new Uint8Array(i), o = new Uint8Array(i), a = new Int32Array(i), s = {}, h = 0; + h < i; + h++ + ) + s[t[h]] = h; + for (var c = Nu(t, e, n, s, !1), u = 0; u < i; u++) { + var l = []; + if (Su(u, r, o, a, -1, c, l, t) && 1 < l.length) { + for (var d = l[0], f = 1; f < l.length; f++) + if (l[f] === d) { + l.length = f; + break; + } + return l.push(d), !0; + } + } + return !1; + }, + Au = (function () { + function o(t, e, n) { + i(this, o), + (this.cycles = []), + (this.visitedLength = 0), + (this.visitedStack = []), + (this.stack = []), + (this.idToIndex = {}), + (this.removed = {}), + (this.nodes = t), + (this.visited = new Uint8Array(this.nodes.length)); + for (var r = 0; r < t.length; r++) this.idToIndex[t[r]] = r; + this.adjacency = Nu(t, e, n, this.idToIndex); + } + return ( + a(o, [ + { + key: 'getCycles', + value: function () { + (this.visited = new Uint8Array(this.nodes.length)), (this.visitedStack = []); + for (var t = 0; t < this.nodes.length; t++) + for (this.backtrack(t, t); 0 !== this.visitedLength; ) { + var e = this.visitedStack.pop(); + void 0 !== e && this.visited[e] && ((this.visited[e] = 0), this.visitedLength--); + } + return this.cycles; + }, + }, + { + key: 'backtrack', + value: function (t, e) { + var n = !1; + this.stack.push(e), + this.visited[e] || ((this.visited[e] = 1), this.visitedLength++), + this.visitedStack.push(e); + var i, + r, + o = m(this.adjacency[e] || []); + try { + for (o.s(); !(i = o.n()).done; ) { + var a, + s = i.value; + if (((this.removed[e] = this.removed[e] || {}), !this.removed[e][s])) + if (s < t) this.removed[e][s] = !0; + else if (s === t) { + for (var n = !0, h = [], c = 0, u = !1; c < this.stack.length; c++) { + var l = this.stack[c]; + (u = t === l ? !0 : u) && h.push(this.nodes[l]); + } + this.cycles.push(h); + } else this.visited[s] || ((a = this.backtrack(t, s)), (n = n || a)); + } + } catch (t) { + o.e(t); + } finally { + o.f(); + } + if (n) + for ( + ; + (r = this.visitedStack.pop()), + this.visited[r] && ((this.visited[r] = 0), this.visitedLength--), + r !== e; + + ); + return this.stack.pop(), n; + }, + }, + ]), + o + ); + })(); +function Ou(t) { + if ( + ('uniqueLinkId' in (t = t || {}) && (t.multigraph = t.uniqueLinkId), + void 0 === t.multigraph && (t.multigraph = !1), + 'function' != typeof Map) + ) + throw new Error('graph requires `Map` to be defined'); + var s = new Map(), + o = new Map(), + a = {}, + h = t.multigraph + ? function (t, e, n) { + var i = Ru(t, e), + r = a.hasOwnProperty(i); + return (r || l(t, e)) && (r || (a[i] = 0), (i = Ru(t + (r = '@' + ++a[i]), e + r))), new Bu(t, e, n, i); + } + : function (t, e, n) { + var i = Ru(t, e), + r = o.get(i); + return r ? ((r.data = n), r) : new Bu(t, e, n, i); + }; + return { + addNode: c, + addLink: function (t, e, n) { + var i = u(t) || c(t), + r = u(e) || c(e), + n = h(t, e, n); + return o.set(n.id, n), Du(i, n), t !== e && Du(r, n), n; + }, + removeLink: function (t, e) { + return r((t = void 0 !== e ? l(t, e) : t)); + }, + removeNode: e, + getNode: u, + getNodeCount: n, + getLinkCount: i, + getEdgeCount: i, + getLinksCount: i, + getNodesCount: n, + getLinks: function (t) { + t = u(t); + return t ? t.links : null; + }, + forEachNode: d, + forEachLinkedNode: function (t, e, n) { + var i = u(t); + if (i && i.links && 'function' == typeof e) + return ( + n + ? function (t, e, n) { + for (var i = t.values(), r = i.next(); !r.done; ) { + var o = r.value; + if (o.fromId === e && n(s.get(o.toId), o)) return !0; + r = i.next(); + } + } + : function (t, e, n) { + for (var i = t.values(), r = i.next(); !r.done; ) { + var o = r.value, + a = o.fromId === e ? o.toId : o.fromId; + if (n(s.get(a), o)) return !0; + r = i.next(); + } + } + )(i.links, t, e); + }, + forEachLink: function (t) { + if ('function' == typeof t) + for (var e = o.values(), n = e.next(); !n.done; ) { + if (t(n.value)) return !0; + n = e.next(); + } + }, + clear: function () { + d(function (t) { + e(t.id); + }); + }, + hasLink: l, + hasNode: u, + getLink: l, + }; + function c(t, e) { + if (void 0 === t) throw new Error('Invalid node identifier'); + var n = u(t); + return n ? (n.data = e) : (n = new Iu(t, e)), s.set(t, n), n; + } + function u(t) { + return s.get(t); + } + function e(t) { + var e, + n = u(t); + return !!n && ((e = n.links) && (e.forEach(r), (n.links = null)), s.delete(t), !0); + } + function n() { + return s.size; + } + function i() { + return o.size; + } + function r(t) { + if (!t) return !1; + if (!o.get(t.id)) return !1; + o.delete(t.id); + var e = u(t.fromId), + n = u(t.toId); + return e && e.links.delete(t), n && n.links.delete(t), !0; + } + function l(t, e) { + if (void 0 !== t && void 0 !== e) return o.get(Ru(t, e)); + } + function d(t) { + if ('function' != typeof t) throw new Error('Function is expected to iterate over graph nodes. You passed ' + t); + for (var e = s.values(), n = e.next(); !n.done; ) { + if (t(n.value)) return !0; + n = e.next(); + } + } +} +function Iu(t, e) { + (this.id = t), (this.links = null), (this.data = e); +} +function Du(t, e) { + t.links ? t.links.add(e) : (t.links = new Set([e])); +} +function Bu(t, e, n, i) { + (this.fromId = t), (this.toId = e), (this.data = n), (this.id = i); +} +function Ru(t, e) { + return t.toString() + '-' + e.toString(); +} +function zu(t, e) { + 'number' != typeof e && (e = 0.005), + (this.internalJumpProbability = t = 'number' != typeof t ? 0.85 : t), + (this.epsilon = e), + (this.elementsPerNode = 5); +} +function Vu(t, e) { + var n = Ou(); + t.forEach(function (t) { + n.addNode(t.id); + }), + e.forEach(function (t) { + n.addLink(t.source.id, t.target.id); + }), + (this.graph = n); +} +(zu.prototype.compute = function (t) { + var e = t.getNodesCount(), + t = this.initializeAsmGraph(t), + n = t.nodes, + i = t.edges; + return ( + this.computePageRank(n, i, e, this.internalJumpProbability, this.epsilon), this.finalResultsFromAsm(n, t.numberToId) + ); +}), + (zu.prototype.computePageRank = function (t, e, n, i, r) { + var o, + a = 0, + s = 0; + do { + for (var s = 0, h = 0; h < n; ++h) { + var c = 0, + u = t[3 + (o = h * this.elementsPerNode)]; + if (0 === u) t[o] = 0; + else { + for (var l = t[o + 4], d = l; d < l + u; ++d) { + var f = e[d]; + c += t[f + 1] / t[f + 2]; + } + (t[o] = i * c), (s += t[o]); + } + } + for (s = (1 - s) / n, h = a = 0; h < n; ++h) + (c = t[(o = h * this.elementsPerNode)] + s), (a += Math.abs(c - t[o + 1])), (t[o + 1] = c); + } while (!(a < r)); + }), + (zu.prototype.finalResultsFromAsm = function (t, e) { + for (var n = Object.create(null), i = t.length / this.elementsPerNode, r = 0; r < i; ++r) { + var o = r * this.elementsPerNode; + n[e[r]] = t[1 + o]; + } + return n; + }), + (zu.prototype.initializeAsmGraph = function (o) { + var a = this, + n = 0, + s = 0, + t = o.getNodesCount(), + e = o.getLinksCount(), + i = 1 / t, + h = new Float64Array(t * a.elementsPerNode), + c = new Float64Array(e), + r = new Array(t), + u = Object.create(null); + return ( + o.forEachNode(function (t) { + var e = n * a.elementsPerNode; + (h[e] = i), + (h[1 + e] = i), + (h[2 + e] = 0), + (h[3 + e] = 0), + (h[4 + e] = -1), + (u[t.id] = n), + (r[n] = t.id), + (n += 1); + }), + o.forEachNode(function (n) { + var t = u[n.id] * a.elementsPerNode, + i = 0, + r = 0, + e = s; + o.forEachLinkedNode(n.id, function (t, e) { + e.fromId === n.id && (r += 1), e.toId === n.id && ((i += 1), (c[s++] = u[t.id] * a.elementsPerNode)); + }), + (h[2 + t] = r), + (h[3 + t] = i), + e !== s && (h[4 + t] = e); + }), + { nodes: h, edges: c, numberToId: r } + ); + }), + (Vu.prototype.betweennes = function (h) { + var c, + u = this.graph, + l = [], + d = [], + f = Object.create(null), + g = Object.create(null), + p = Object.create(null), + y = Object.create(null), + v = Object.create(null); + return ( + u.forEachNode(function (t) { + v[t.id] = 0; + }), + u.forEachNode(function (t) { + t = c = t.id; + for ( + u.forEachNode(function (t) { + t = t.id; + (f[t] = []), (g[t] = -1), (p[t] = 0); + }), + g[t] = 0, + p[t] = 1, + l.push(t); + l.length; + + ) { + var e = l.shift(); + d.push(e), u.forEachLinkedNode(e, n, h); + } + function n(t) { + (t = t.id), + -1 === g[t] && ((g[t] = g[e] + 1), l.push(t)), + g[t] === g[e] + 1 && ((p[t] += p[e]), f[t].push(e)); + } + for ( + u.forEachNode(function (t) { + y[t.id] = 0; + }); + d.length; + + ) { + for (var i = d.pop(), r = (1 + y[i]) / p[i], o = f[i], a = 0; a < o.length; ++a) { + var s = o[a]; + y[s] += p[s] * r; + } + i !== c && (v[i] += y[i]); + } + }), + h || + Object.keys(v).forEach(function (t) { + v[t] /= 2; + }), + v + ); + }), + (Vu.prototype.closeness = function (r) { + var o, + a = this.graph, + s = [], + h = Object.create(null), + c = Object.create(null); + return ( + a.forEachNode(function (t) { + c[t.id] = 0; + }), + a.forEachNode(function (t) { + var e, + t = (o = t.id); + for ( + a.forEachNode(function (t) { + t = t.id; + h[t] = -1; + }), + h[t] = 0, + s.push(t); + s.length; + + ) { + var n = s.shift(); + a.forEachLinkedNode(n, i, r); + } + function i(t) { + t = t.id; + -1 === h[t] && ((h[t] = h[n] + 1), s.push(t)); + } + (e = (t = Object.keys(h) + .map(function (t) { + return h[t]; + }) + .filter(function (t) { + return -1 !== t; + })).length), + (t = t.reduce(function (t, e) { + return t + e; + }, 0)), + (c[o] = 0 < t ? (e - 1) / t : 0); + }), + c + ); + }), + (Vu.prototype.eccentricity = function (r) { + var o, + a = this.graph, + s = [], + h = Object.create(null), + c = Object.create(null); + return ( + a.forEachNode(function (t) { + c[t.id] = 0; + }), + a.forEachNode(function (t) { + var e, + t = (o = t.id); + for ( + a.forEachNode(function (t) { + t = t.id; + h[t] = -1; + }), + h[t] = 0, + s.push(t); + s.length; + + ) { + var n = s.shift(); + a.forEachLinkedNode(n, i, r); + } + function i(t) { + t = t.id; + -1 === h[t] && ((h[t] = h[n] + 1), s.push(t)); + } + (e = 0), + Object.keys(h).forEach(function (t) { + t = h[t]; + e < t && (e = t); + }), + (c[o] = e); + }), + c + ); + }), + (Vu.prototype.degree = function (t) { + var n, + i = this.graph, + r = Object.create(null); + return ( + (t = (t || 'both').toLowerCase()), + (n = + 'in' === t + ? function (t, e) { + var n = 0; + return ( + t && + t.forEach(function (t) { + n += t.toId === e ? 1 : 0; + }), + n + ); + } + : 'out' === t + ? function (t, e) { + var n = 0; + return ( + t && + t.forEach(function (t) { + n += t.fromId === e ? 1 : 0; + }), + n + ); + } + : function (t) { + return t ? t.size || t.length : 0; + }), + i.forEachNode(function (t) { + var e = i.getLinks(t.id); + r[t.id] = n(e, t.id); + }), + r + ); + }), + (Vu.prototype.pageRank = function (t, e) { + return new zu(t, e).compute(this.graph); + }); +var ju = function (t) { + return new Fu('number' == typeof t ? t : +new Date()); +}; +function Fu(t) { + this.seed = t; +} +function Xu(t) { + return Math.sqrt((2 * Math.PI) / t) * Math.pow((1 / Math.E) * (t + 1 / (12 * t - 1 / (10 * t))), t); +} +function Uu() { + var t = + 4294967295 & + (3042594569 ^ + (t = + (4251993797 + + (t = + 4294967295 & + ((3550635116 + + (t = + (374761393 + + (t = + 4294967295 & + (3345072700 ^ (t = ((t = this.seed) + 2127912214 + (t << 12)) & 4294967295) ^ (t >>> 19))) + + (t << 5)) & + 4294967295)) ^ + (t << 9))) + + (t << 3)) & + 4294967295) ^ + (t >>> 16)); + return (268435455 & (this.seed = t)) / 268435456; +} +(Fu.prototype.next = function (t) { + return Math.floor(this.nextDouble() * t); +}), + (Fu.prototype.nextDouble = Uu), + (Fu.prototype.uniform = Uu), + (Fu.prototype.gaussian = function () { + for ( + var t, e, n; + 1 <= (t = (e = 2 * this.nextDouble() - 1) * e + (n = 2 * this.nextDouble() - 1) * n) || 0 === t; + + ); + return e * Math.sqrt((-2 * Math.log(t)) / t); + }), + (Fu.prototype.levy = function () { + var t = Math.pow((Xu(2.5) * Math.sin((1.5 * Math.PI) / 2)) / (1.5 * Xu(1.25) * Math.pow(2, 0.25)), 1 / 1.5); + return (this.gaussian() * t) / Math.pow(Math.abs(this.gaussian()), 1 / 1.5); + }); +var Wu = function (r, t) { + var o = t || random(); + if ('function' != typeof o.next) + throw new Error('customRandom does not match expected API: next() function is missing'); + return { + forEach: function (t) { + for (var e, n, i = r.length - 1; 0 < i; --i) (e = o.next(i + 1)), (n = r[e]), (r[e] = r[i]), t((r[i] = n)); + r.length && t(r[0]); + }, + shuffle: function () { + for (var t, e, n = r.length - 1; 0 < n; --n) (t = o.next(n + 1)), (e = r[t]), (r[t] = r[n]), (r[n] = e); + return r; + }, + }; +}; +function Yu() { + var t, + e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + a = 2 < arguments.length ? arguments[2] : void 0, + i = { + step: function () { + (s = 0), t.forEach(d), (r = s / c.length); + }, + getClass: l, + getChangeRate: function () { + return r; + }, + forEachCluster: function (n) { + f().forEach(function (t, e) { + n({ class: e, nodes: t }); + }); + }, + createClusterMap: f, + }, + r = 1, + s = 0, + o = ju(42), + h = new Map(), + c = [], + u = Ou(); + return ( + e.forEach(function (t) { + u.addNode(t.id); + }), + n.forEach(function (t) { + u.addLink(t.source.id, t.target.id); + }), + u.forEachNode(function (t) { + h.set(t.id, c.length), c.push(t.id); + }), + (t = Wu(c, o)), + i + ); + function l(t) { + return h.get(t); + } + function d(t) { + (n = t), + (i = new Map()), + (r = 0), + (o = -1), + u.forEachLinkedNode(n, function (t, e) { + (e = e.toId === n), + ('in' === a ? e : 'out' !== a || !e) && + ((e = h.get(t.id)), (t = i.get(e) || 0), (t += 1) > r && ((r = t), (o = e)), i.set(e, t)); + }); + var n, + i, + r, + o, + e = -1 === o ? h.get(n) : o; + e !== h.get(t) && (h.set(t, e), (s += 1)); + } + function f() { + for (var t = new Map(), e = 0; e < c.length; ++e) { + var n = c[e], + i = l(n), + r = t.get(i); + r ? r.push(n) : t.set(i, [n]); + } + return t; + } +} +function Gu() { + var C = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + t = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []; + function T(t, e) { + var n = null; + return ( + (t.outLinks || []).forEach(function (t) { + if (t.target.id == e.id) return (n = e); + }), + n + ); + } + (this.nodes = C), + (this.links = t), + (this.applay = function () { + if (0 != this.nodes.length) { + for ( + var t = this.nodes.length, + e = this.links.length, + n = new Array(t), + i = new Array(t * t), + r = new Array(t), + o = new Array(t), + a = new Map(), + s = 0; + s < t; + ++s + ) { + var h = this.nodes[s]; + (n[(o[s] = s)] = (h.inLinks || []).length + (h.outLinks || []).length), (r[s] = !1); + for (var c = 0; c < t; ++c) { + var u = this.nodes[c]; + i[s * t + c] = T(u, h) || T(h, u) ? 1 : 0; + } + } + for (var l = -1 / 0, d = 0, f = t; 1 < f; --f) { + for (var g, p = -1 / 0, y = void 0, v = void 0, m = 0; m < t; ++m) + if (!r[m]) + for (var x = m + 1; x < t; ++x) + r[x] || (p < (g = (i[m * t + x] - (n[m] * n[x]) / 2 / e) / e) && ((p = g), (v = m), (y = x))); + n[v] += n[y] + i[v * t + y]; + for (var w = 0; w < t; ++w) + (i[v * t + w] += i[y * t + w]), (i[w * t + v] += i[w * t + y]), o[w] === y && (o[w] = v); + if (((r[y] = !0), (d += p) > l)) + for (var l = d, b = 0; b < t; ++b) { + var k = C[b], + M = ((k.cluster = o[b]), o[b]), + E = a.get(M); + null != E && -1 == E.indexOf(k) ? (E.push(k), a.set(M, E)) : a.set(M, [k]); + } + } + return a; + } + }); +} +function qu(t, e) { + (this.nodes = t), + (this.links = e), + (this.nodeIds = []), + (this.nodeNeighbers = []), + (this.applay = function () { + var e = this, + n = []; + e.nodes.forEach(function (t) { + n.push(t), e.nodeIds.push(t.id); + t = e.initNodeNeighbers(t); + e.nodeNeighbers.push(t); + }); + for (var t = []; 0 < n.length; ) { + var i = [], + r = n[0], + o = (n.splice(0, 1), i.push(r), []); + for (o.push(r); 0 < o.length; ) { + var a = o.splice(0, 1)[0]; + e.initNodeNeighbers(a).forEach(function (t) { + var e = n.indexOf(t); + -1 != e && (o.push(t), n.splice(e, 1), i.push(t)); + }); + } + t.push(i); + } + var s = new Map(); + return ( + t.forEach(function (t, e) { + s.set(e + 1, t); + }), + s + ); + }), + (this.initNodeNeighbers = function (i) { + var r = this, + o = []; + return ( + (i.outLinks || []).forEach(function (t) { + var e, + n = t.target; + t.source.id != n.id && + ((t = r.nodeIds.indexOf(n.id)), + (t = r.nodeNeighbers[t] || []), + (e = []), + t.forEach(function (t) { + e.push(t.id); + }), + -1 == e.indexOf(i.id)) && + o.push(n); + }), + o + ); + }); +} +function Hu(t, e) { + (this.nodes = t), + (this.links = e), + (this.nodeIds = []), + (this.nodeNeighbers = []), + (this.dfs_num = {}), + (this.high = {}), + (this.parents = {}), + (this.stack = []), + (this.converse_depth = 0), + (this.applay = function () { + var e, + n, + i = this; + if (0 != i.nodes.length) + return ( + (e = []), + i.nodes.forEach(function (t) { + i.dfs_num[t.id] = 0; + }), + (i.converse_depth = this.nodes.length), + i.nodes.forEach(function (t) { + 0 == i.dfs_num[t.id] && + ((i.converse_depth = i.nodes.length), + i.findBiconnectedComponents(t, e), + i.nodes.length - i.converse_depth == 1) && + e.push([t]); + }), + (n = new Map()), + e.forEach(function (t, e) { + n.set(e + 1, t); + }), + n + ); + }), + (this.findBiconnectedComponents = function (h, c) { + var u = this, + l = u.converse_depth; + (u.dfs_num[h.id] = l), + u.converse_depth--, + (u.high[h.id] = l), + (u.getNeighbors(h) || []).forEach(function (t) { + var e, + n, + i = u.dfs_num[t.id], + r = + ((e = t), + (h.outLinks || []).forEach(function (t) { + if (t.target.id == e.id) return (n = t); + }), + n); + if (0 == i) { + (u.parents[t.id] = h.id), u.stack.push(r), u.findBiconnectedComponents(t, c); + var o = u.high[t.id] || 0; + if (o <= l) { + for (var a, s = []; (a = u.stack.pop()), s.push(a.source), s.push(a.target), a != r; ); + c.push(s); + } + u.high[h.id] = Math.max(o, u.high[h.id] || 0); + } else t.id != u.parents[h.id] && (u.high[h.id] = Math.max(i, u.high[h.id] || 0)); + }); + }), + (this.getNeighbors = function (i) { + var r = this, + o = []; + return ( + (i.outLinks || []).forEach(function (t) { + var e, + n = t.target; + t.source.id != n.id && + ((t = r.nodeIds.indexOf(n.id)), + (t = r.nodeNeighbers[t] || []), + (e = []), + t.forEach(function (t) { + e.push(t.id); + }), + -1 == e.indexOf(i.id)) && + o.push(n); + }), + o + ); + }); +} +function Qu(t) { + function a(t, e) { + var n = e.x - t.x, + e = e.y - t.y; + return n * n + e * e; + } + (this.nodes = t), + (this.centroids = []), + (this.numClusters = 5), + (this.colors = []), + (this.applay = function (t) { + t && (this.numClusters = Number(t.clusterNum || 10)), + this.init(), + this.clustering(), + (this.centroids = this.updateCentroids()), + this.clustering(); + var i = new Map(); + return ( + this.nodes.forEach(function (t) { + var e, + n = t.clusterId; + 0 <= n && ((e = i.get(n)) ? e.push(t) : (e = [t]), i.set(n, e)); + }), + i + ); + }), + (this.init = function () { + (this.centroids = []), (this.colors = []); + for ( + var t = Number.MAX_VALUE, e = Number.MIN_VALUE, n = Number.MAX_VALUE, i = Number.MIN_VALUE, r = 0; + r < this.nodes.length; + r++ + ) { + var o = this.nodes[r]; + (o.clusterId = null), + (t = Math.min(t, o.x)), + (e = Math.max(t, o.x)), + (n = Math.min(n, o.y)), + (i = Math.max(i, o.y)); + } + var a, + s, + r, + h = Math.abs(e - t), + c = Math.abs(i - n); + for (r = 0; r < this.numClusters; r++) + (a = Math.floor(Math.random() * h)), + (s = Math.floor(Math.random() * c)), + this.centroids.push({ x: a, y: s, clusterId: r }); + }), + (this.clustering = function () { + var t; + for (r = 0; r < this.centroids.length; r++) this.centroids[r].bestMatches = []; + for (t = 0; t < this.nodes.length; t++) { + for (var e = this.nodes[t], n = 0, i = a(e, this.centroids[n]), r = 1; r < this.centroids.length; r++) { + var o = a(e, this.centroids[r]); + o < i && ((n = r), (i = o)); + } + this.centroids[n].bestMatches.push(t), (this.nodes[t].clusterId = n); + } + }), + (this.updateCentroids = function () { + for (var t = [], e = 0; e < this.centroids.length; e++) + if (0 < this.centroids[e].bestMatches.length) { + for (var n = 0, i = 0, r = this.centroids[e].bestMatches, o = 0; o < r.length; o++) { + var a = this.nodes[r[o]]; + (n += a.x), (i += a.y); + } + (n /= r.length), (i /= r.length), t.push({ x: n, y: i, clusterId: e }); + } else t.push(this.centroids[e]); + return t; + }); +} +var Ju = function () { + var e, + i, + r, + c = {}, + u = {}, + l = []; + function d(t) { + var n = {}; + return ( + t.forEach(function (t, e) { + n[t] = !0; + }), + Object.keys(n) + ); + } + function f(t) { + var e, + n = []; + for (e in t) t.hasOwnProperty(e) && n.push(t[e]); + return n; + } + function g(i, r) { + var t = i._assoc_mat[r] ? Object.keys(i._assoc_mat[r]) : [], + o = 0; + return ( + t.forEach(function (t, e) { + var n = i._assoc_mat[r][t] || 1; + r === t && (n *= 2), (o += n); + }), + o + ); + } + function m(t, e) { + return void 0 === t._assoc_mat[e] ? [] : Object.keys(t._assoc_mat[e]); + } + function p(t, e, n) { + return t._assoc_mat[e] ? t._assoc_mat[e][n] : void 0; + } + function y(t) { + if (null === t || 'object' !== n(t)) return t; + var e, + i = t.constructor(); + for (e in t) i[e] = y(t[e]); + return i; + } + function v(a, s, h) { + var e; + (s.nodes_to_com = {}), + (s.total_weight = 0), + (s.internals = {}), + (s.degrees = {}), + (s.gdegrees = {}), + (s.loops = {}), + (s.total_weight = + ((e = 0), + a.edges.forEach(function (t) { + e += t.weight; + }), + e)), + void 0 === h + ? a.nodes.forEach(function (t, e) { + s.nodes_to_com[t] = e; + var n = g(a, t); + if (n < 0) throw 'Bad graph type, use positive weights!'; + (s.degrees[e] = n), (s.gdegrees[t] = n), (s.loops[t] = p(a, t, t) || 0), (s.internals[e] = s.loops[t]); + }) + : a.nodes.forEach(function (i, t) { + var r = h[i], + e = ((s.nodes_to_com[i] = r), g(a, i)), + o = ((s.degrees[r] = (s.degrees[r] || 0) + e), (s.gdegrees[i] = e), 0); + m(a, i).forEach(function (t, e) { + var n = a._assoc_mat[i][t]; + if (n <= 0) throw 'Bad graph type, use positive weights'; + h[t] === r && (o += t === i ? n : n / 2); + }), + (s.internals[r] = (s.internals[r] || 0) + o); + }); + } + function x(i) { + var r = i.total_weight, + o = 0; + return ( + d(f(i.nodes_to_com)).forEach(function (t, e) { + var n = i.internals[t] || 0, + t = i.degrees[t] || 0; + 0 < r && (o = o + n / r - Math.pow(t / (2 * r), 2)); + }), + o + ); + } + function w(i) { + var r = 0, + o = y(i), + a = {}; + return ( + Object.keys(i).forEach(function (t) { + var e = i[t], + n = void 0 === a[e] ? -1 : a[e]; + -1 === n && ((n = a[e] = r), (r += 1)), (o[t] = n), l.push([y(o)]); + }), + o + ); + } + function b(p, y) { + for ( + var t, v = !0, e = 0, n = x(y); + v && + -1 !== e && + ((t = n), + (v = !1), + (e += 1), + p.nodes.forEach(function (t, e) { + var i, + r, + o, + a, + n, + s, + h, + c, + u = y.nodes_to_com[t], + l = (y.gdegrees[t] || 0) / (2 * y.total_weight), + d = + ((o = y), + (a = {}), + m((r = p), (i = t)).forEach(function (t, e) { + var n; + t !== i && ((n = r._assoc_mat[i][t] || 1), (t = o.nodes_to_com[t]), (a[t] = (a[t] || 0) + n)); + }), + a), + f = + ((c = t), + (s = d[(n = u)] || 0), + ((h = y).degrees[n] = (h.degrees[n] || 0) - (h.gdegrees[c] || 0)), + (h.internals[n] = (h.internals[n] || 0) - s - (h.loops[c] || 0)), + (h.nodes_to_com[c] = -1), + u), + g = 0; + Object.keys(d).forEach(function (t, e) { + var n = d[t] - (y.degrees[t] || 0) * l; + g < n && ((g = n), (f = t)); + }), + (n = t), + (h = d[(s = f)] || 0), + ((c = y).nodes_to_com[n] = +s), + (c.degrees[s] = (c.degrees[s] || 0) + (c.gdegrees[n] || 0)), + (c.internals[s] = (c.internals[s] || 0) + h + (c.loops[n] || 0)), + f !== u && (v = !0); + }), + !((n = x(y)) - t < 1e-7)); + + ); + } + function k(o, t) { + var a, + s, + h = { nodes: [], edges: [], _assoc_mat: {} }, + e = f(o); + return ( + (h.nodes = h.nodes.concat(d(e))), + t.edges.forEach(function (t, e) { + s = t.weight || 1; + var n, + i, + r = o[t.source], + t = o[t.target]; + (a = p(h, r, t) || 0), + (t = r = { source: r, target: t, weight: a + s }), + ((i = n = h)._assoc_mat[t.source] = i._assoc_mat[t.source] || {}), + (i._assoc_mat[t.source][t.target] = t.weight), + (i._assoc_mat[t.target] = i._assoc_mat[t.target] || {}), + (i._assoc_mat[t.target][t.source] = t.weight), + u[r.source + '_' + r.target] + ? (n.edges[u[r.source + '_' + r.target]].weight = r.weight) + : (n.edges.push(r), (u[r.source + '_' + r.target] = n.edges.length - 1)); + }), + (u = {}), + h + ); + } + function o(i, t) { + for (var r = y(i[0]), o = 1; o < t + 1; o++) + Object.keys(r).forEach(function (t, e) { + var n = r[t]; + r[t] = i[o][n]; + }); + return r; + } + function a(t, e) { + var n; + if (0 === t.edges.length) + return ( + (n = {}), + t.nodes.forEach(function (t, e) { + n[t] = t; + }), + n + ); + var i = {}, + r = (v(c, i, e), x(i)), + o = [], + a = (b(c, i), x(i)), + s = w(i.nodes_to_com), + h = (o.push(s), (r = a), k(s, c)); + for (v(h, i); b(h, i), (a = x(i)), l.push(y(o)), !(a - r < 1e-7); ) + (s = w(i.nodes_to_com)), o.push(s), (r = a), v((h = k(s, h)), i); + return o; + } + function s() { + var t = a(c, r); + return o(t, t.length - 1); + } + var t = -1; + return ( + (s.resetAll = function () { + (t = -1), (l = []); + }), + (s.nextStep = function () { + return ( + -1 == t && y(a(c, r)), + t < l.length ? (null == l[(t += 1)] ? o(l[t - 1], l[t - 1].length - 1) : o(l[t], l[t].length - 1)) : void 0 + ); + }), + (s.nodes = function (t) { + return 0 < arguments.length && (e = t), s; + }), + (s.edges = function (t) { + if (void 0 === e) throw 'Please provide the graph nodes first!'; + var n; + return ( + 0 < arguments.length && + ((n = {}), + (i = t).forEach(function (t, e) { + (n[t.source] = n[t.source] || {}), + (n[t.source][t.target] = t.weight), + (n[t.target] = n[t.target] || {}), + (n[t.target][t.source] = t.weight); + }), + (c = { nodes: e, edges: i, _assoc_mat: n })), + s + ); + }), + (s.partition_init = function (t) { + return 0 < arguments.length && (r = t), s; + }), + s + ); +}; +function Ku(t, e) { + (this.nodes = t), + (this.links = e), + (this.applay = function () { + var e = {}, + n = [], + i = []; + this.nodes.forEach(function (t) { + n.push(t.id), (e[t.id] = t); + }), + this.links.forEach(function (t) { + i.push({ source: t.source.id, target: t.target.id, weight: t.weight }); + }); + for (var r, t, o = Ju().nodes(n).edges(i), a = !0; a; ) null == (t = o.nextStep()) ? (a = !1) : (r = t); + var s, + h = {}, + c = + (Object.keys(r).forEach(function (t) { + r[t] in h ? h[r[t]].push(t) : (h[r[t]] = [t]); + }), + 1), + u = new Map(); + for (s in h) { + var l = []; + (h[s] || []).forEach(function (t) { + l.push(e[t]); + }), + u.set(c++, l); + } + return u; + }); +} +var Zu = function () { + for ( + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + o = Yu(t, 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : []); + 0 < o.getChangeRate(); + + ) + o.step(); + var a = new Map(), + s = + (t.forEach(function (t) { + a.set(String(t.id), t); + }), + new Map()); + return ( + o.forEachCluster(function (t) { + for (var e = 0; e < t.nodes.length; ++e) { + var n = t.nodes[e], + i = o.getClass(n), + r = s.get(i); + null == r ? ((r = [a.get(String(n))]), s.set(i, r)) : r.push(a.get(String(n))); + } + }), + s + ); + }, + $u = { + update: null, + begin: null, + loopBegin: null, + changeBegin: null, + change: null, + changeComplete: null, + loopComplete: null, + complete: null, + loop: 1, + direction: 'normal', + autoplay: !0, + timelineOffset: 0, + }, + tl = { duration: 1e3, delay: 0, endDelay: 0, easing: 'easeOutElastic(1, .5)', round: 0 }, + el = { springs: {} }; +function nl(t, e, n) { + return Math.min(Math.max(t, e), n); +} +function il(t, e) { + return t.apply(null, e); +} +var rl = { + arr: function (t) { + return Array.isArray(t); + }, + obj: function (t) { + return -1 < Object.prototype.toString.call(t).indexOf('Object'); + }, + str: function (t) { + return 'string' == typeof t; + }, + fnc: function (t) { + return 'function' == typeof t; + }, + und: function (t) { + return void 0 === t; + }, + nil: function (t) { + return rl.und(t) || null === t; + }, + key: function (t) { + return !$u.hasOwnProperty(t) && !tl.hasOwnProperty(t) && 'targets' !== t && 'keyframes' !== t; + }, +}; +function ol(t) { + t = /\(([^)]+)\)/.exec(t); + return t + ? t[1].split(',').map(function (t) { + return parseFloat(t); + }) + : []; +} +function al(i, n) { + var t = ol(i), + e = nl(rl.und(t[0]) ? 1 : t[0], 0.1, 100), + r = nl(rl.und(t[1]) ? 100 : t[1], 0.1, 100), + o = nl(rl.und(t[2]) ? 10 : t[2], 0.1, 100), + t = nl(rl.und(t[3]) ? 0 : t[3], 0.1, 100), + a = Math.sqrt(r / e), + s = o / (2 * Math.sqrt(r * e)), + h = s < 1 ? a * Math.sqrt(1 - s * s) : 0, + c = s < 1 ? (s * a - t) / h : -t + a; + function u(t) { + var e = n ? (n * t) / 1e3 : t, + e = s < 1 ? Math.exp(-e * s * a) * (+Math.cos(h * e) + c * Math.sin(h * e)) : (1 + c * e) * Math.exp(-e * a); + return 0 === t || 1 === t ? t : 1 - e; + } + return n + ? u + : function () { + var t = el.springs[i]; + if (t) return t; + for (var e = 0, n = 0; ; ) + if (1 === u((e += 1 / 6))) { + if (16 <= ++n) break; + } else n = 0; + t = e * (1 / 6) * 1e3; + return (el.springs[i] = t); + }; +} +function sl() { + var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 10; + return function (t) { + return Math.ceil(nl(t, 1e-6, 1) * e) * (1 / e); + }; +} +var hl, + cl, + ul = (function () { + function i(t, e) { + return 1 - 3 * e + 3 * t; + } + function k(t, e, n) { + return ((i(e, n) * t + (3 * n - 6 * e)) * t + 3 * e) * t; + } + function M(t, e, n) { + return 3 * i(e, n) * t * t + 2 * (3 * n - 6 * e) * t + 3 * e; + } + return function (x, e, w, n) { + if (0 <= x && x <= 1 && 0 <= w && w <= 1) { + var b = new Float32Array(11); + if (x !== e || w !== n) for (var t = 0; t < 11; ++t) b[t] = k(0.1 * t, x, w); + return function (t) { + return (x === e && w === n) || 0 === t || 1 === t + ? t + : k( + (function (t) { + for (var e = 0, n = 1; 10 !== n && b[n] <= t; ++n) e += 0.1; + var i = e + ((t - b[--n]) / (b[n + 1] - b[n])) * 0.1, + r = M(i, x, w); + if (0.001 <= r) { + for (var o = t, a = i, s = x, h = w, c = 0; c < 4; ++c) { + var u = M(a, s, h); + if (0 === u) return a; + a -= (k(a, s, h) - o) / u; + } + return a; + } + if (0 === r) return i; + for ( + var l, d, f = t, g = e, p = e + 0.1, y = x, v = w, m = 0; + 0 < (l = k((d = g + (p - g) / 2), y, v) - f) ? (p = d) : (g = d), 1e-7 < Math.abs(l) && ++m < 10; + + ); + return d; + })(t), + e, + n, + ); + }; + } + }; + })(), + ll = + ((hl = { + linear: function () { + return function (t) { + return t; + }; + }, + }), + (cl = { + Sine: function () { + return function (t) { + return 1 - Math.cos((t * Math.PI) / 2); + }; + }, + Circ: function () { + return function (t) { + return 1 - Math.sqrt(1 - t * t); + }; + }, + Back: function () { + return function (t) { + return t * t * (3 * t - 2); + }; + }, + Bounce: function () { + return function (t) { + for (var e, n = 4; t < ((e = Math.pow(2, --n)) - 1) / 11; ); + return 1 / Math.pow(4, 3 - n) - 7.5625 * Math.pow((3 * e - 2) / 22 - t, 2); + }; + }, + Elastic: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 1, + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0.5, + n = nl(t, 1, 10), + i = nl(e, 0.1, 2); + return function (t) { + return 0 === t || 1 === t + ? t + : -n * + Math.pow(2, 10 * (t - 1)) * + Math.sin(((t - 1 - (i / (2 * Math.PI)) * Math.asin(1 / n)) * (2 * Math.PI)) / i); + }; + }, + }), + ['Quad', 'Cubic', 'Quart', 'Quint', 'Expo'].forEach(function (t, e) { + cl[t] = function () { + return function (t) { + return Math.pow(t, e + 2); + }; + }; + }), + Object.keys(cl).forEach(function (t) { + var i = cl[t]; + (hl['easeIn' + t] = i), + (hl['easeOut' + t] = function (e, n) { + return function (t) { + return 1 - i(e, n)(1 - t); + }; + }), + (hl['easeInOut' + t] = function (e, n) { + return function (t) { + return t < 0.5 ? i(e, n)(2 * t) / 2 : 1 - i(e, n)(-2 * t + 2) / 2; + }; + }), + (hl['easeOutIn' + t] = function (e, n) { + return function (t) { + return t < 0.5 ? (1 - i(e, n)(1 - 2 * t)) / 2 : (i(e, n)(2 * t - 1) + 1) / 2; + }; + }); + }), + hl); +function dl(t, e) { + if (rl.fnc(t)) return t; + var n = t.split('(')[0], + i = ll[n], + r = ol(t); + switch (n) { + case 'spring': + return al(t, e); + case 'cubicBezier': + return il(ul, r); + case 'steps': + return il(sl, r); + default: + return il(i, r); + } +} +function fl(t, e) { + for (var n, i = t.length, r = 2 <= arguments.length ? e : void 0, o = [], a = 0; a < i; a++) + a in t && ((n = t[a]), e.call(r, n, a, t)) && o.push(n); + return o; +} +function gl(t) { + return t.reduce(function (t, e) { + return t.concat(rl.arr(e) ? gl(e) : e); + }, []); +} +function pl(t) { + return rl.arr(t) ? t : t instanceof NodeList || t instanceof HTMLCollection ? [].slice.call(t) : [t]; +} +function vl(t, e) { + return t.some(function (t) { + return t === e; + }); +} +function yl(t) { + var e, + n = {}; + for (e in t) n[e] = t[e]; + return n; +} +function ml(t, e) { + var n, + i = yl(t); + for (n in t) i[n] = (e.hasOwnProperty(n) ? e : t)[n]; + return i; +} +function xl(t, e) { + var n, + i = yl(t); + for (n in e) i[n] = (rl.und(t[n]) ? e : t)[n]; + return i; +} +function wl(t) { + t = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec( + t, + ); + if (t) return t[1]; +} +function bl(t, e) { + return rl.fnc(t) ? t(e.target, e.id, e.total) : t; +} +function kl(t, e) { + if (null != t[e]) return 'object'; +} +function Ml(t, e, n, i) { + return 'attribute' !== kl(t, e) ? t[e] || 0 : t.getAttribute(e); +} +function El(t, e) { + var n = /^(\*=|\+=|-=)/.exec(t); + if (!n) return t; + var i = wl(t) || 0, + r = parseFloat(e), + o = parseFloat(t.replace(n[0], '')); + switch (n[0][0]) { + case '+': + return r + o + i; + case '-': + return r - o + i; + case '*': + return r * o + i; + } +} +function Cl(t, e) { + var n; + return /\s/g.test(t) ? t : ((n = (n = wl(t)) ? t.substr(0, t.length - n.length) : t), e ? n + e : n); +} +function Nl(t, e) { + var n = /[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g, + i = Cl(t, e) + ''; + return { original: i, numbers: i.match(n) ? i.match(n).map(Number) : [0], strings: rl.str(t) || e ? i.split(n) : [] }; +} +function _l(t) { + return fl(t ? gl(rl.arr(t) ? t.map(pl) : pl(t)) : [], function (t, e, n) { + return n.indexOf(t) === e; + }); +} +function Ll(t) { + var n = _l(t); + return n.map(function (t, e) { + return { target: t, id: e, total: n.length, transforms: { list: [] } }; + }); +} +function Sl(t, n) { + var e, + i = yl(n), + r = + (/^spring/.test(i.easing) && (i.duration = al(i.easing)), + rl.arr(t) && + (2 !== (e = t.length) || rl.obj(t[0]) + ? rl.fnc(n.duration) || (i.duration = n.duration / e) + : (t = { value: t })), + rl.arr(t) ? t : [t]); + return r + .map(function (t, e) { + t = rl.obj(t) ? t : { value: t }; + return ( + rl.und(t.delay) && (t.delay = e ? 0 : n.delay), + rl.und(t.endDelay) && (t.endDelay = e === r.length - 1 ? n.endDelay : 0), + t + ); + }) + .map(function (t) { + return xl(t, i); + }); +} +function Tl(t, e) { + var n, + i = [], + r = e.keyframes; + for (n in (e = r + ? xl( + (function (e) { + for ( + var n = fl( + gl( + e.map(function (t) { + return Object.keys(t); + }), + ), + function (t) { + return rl.key(t); + }, + ).reduce(function (t, e) { + return t.indexOf(e) < 0 && t.push(e), t; + }, []), + r = {}, + t = 0; + t < n.length; + t++ + ) + !(function (t) { + var i = n[t]; + r[i] = e.map(function (t) { + var e, + n = {}; + for (e in t) rl.key(e) ? e == i && (n.value = t[e]) : (n[e] = t[e]); + return n; + }); + })(t); + return r; + })(r), + e, + ) + : e)) + rl.key(n) && i.push({ name: n, tweens: Sl(e[n], t) }); + return i; +} +function Pl(a, s) { + var h; + return a.tweens.map(function (t) { + var t = (function (t, e) { + var n, + i = {}; + for (n in t) { + var r = bl(t[n], e); + rl.arr(r) && + 1 === + (r = r.map(function (t) { + return bl(t, e); + })).length && + (r = r[0]), + (i[n] = r); + } + return (i.duration = parseFloat(i.duration)), (i.delay = parseFloat(i.delay)), i; + })(t, s), + e = t.value, + n = rl.arr(e) ? e[1] : e, + i = wl(n), + r = Ml(s.target, a.name), + o = h ? h.to.original : r, + e = rl.arr(e) ? e[0] : o, + r = wl(e) || wl(r), + i = i || r; + return ( + rl.und(n) && (n = o), + (t.from = Nl(e, i)), + (t.to = Nl(El(n, e), i)), + (t.start = h ? h.end : 0), + (t.end = t.start + t.delay + t.duration + t.endDelay), + (t.easing = dl(t.easing, t.duration)), + (t.isColor = !1), + t.isColor && (t.round = 1), + (h = t) + ); + }); +} +var Al = { + css: function (t, e, n) { + return (t.style[e] = n); + }, + attribute: function (t, e, n) { + return t.setAttribute(e, n); + }, + object: function (t, e, n) { + return (t[e] = n); + }, + transform: function (t, e, n, i, r) { + var o; + i.list.set(e, n), + (e !== i.last && !r) || + ((o = ''), + i.list.forEach(function (t, e) { + o += ''.concat(e, '(').concat(t, ') '); + }), + (t.style.transform = o)); + }, +}; +function Ol(t, a) { + Ll(t).forEach(function (t) { + for (var e in a) { + var n = bl(a[e], t), + i = t.target, + r = wl(n), + o = Ml(i, e), + n = El(Cl(n, r || wl(o)), o), + r = kl(i, e); + Al[r](i, e, n, t.transforms, !0); + } + }); +} +function Il(t, e) { + return fl( + gl( + t.map(function (o) { + return e.map(function (t) { + var e, + n, + i = o, + r = kl(i.target, t.name); + if (r) + return ( + (n = (e = Pl(t, i))[e.length - 1]), + { + type: r, + property: t.name, + animatable: i, + tweens: e, + duration: n.end, + delay: e[0].delay, + endDelay: n.endDelay, + } + ); + }); + }), + ), + function (t) { + return !rl.und(t); + }, + ); +} +function Dl(t, e) { + function n(t) { + return t.timelineOffset || 0; + } + var i = t.length, + r = {}; + return ( + (r.duration = i + ? Math.max.apply( + Math, + t.map(function (t) { + return n(t) + t.duration; + }), + ) + : e.duration), + (r.delay = i + ? Math.min.apply( + Math, + t.map(function (t) { + return n(t) + t.delay; + }), + ) + : e.delay), + (r.endDelay = i + ? r.duration - + Math.max.apply( + Math, + t.map(function (t) { + return n(t) + t.duration - t.endDelay; + }), + ) + : e.endDelay), + r + ); +} +var Bl = 0; +function Rl(t) { + var e = ml($u, t), + n = ml(tl, t), + i = Tl(n, t), + t = Ll(t.targets), + i = Il(t, i), + n = Dl(i, n), + r = Bl; + return ( + Bl++, + xl(e, { + id: r, + children: [], + animatables: t, + animations: i, + duration: n.duration, + delay: n.delay, + endDelay: n.endDelay, + }) + ); +} +var zl = [], + Vl = (function () { + var r; + function o(t) { + for (var e = zl.length, n = 0; n < e; ) { + var i = zl[n]; + i.paused ? (zl.splice(n, 1), e--) : (i.tick(t), n++); + } + r = 0 < n ? requestAnimationFrame(o) : void 0; + } + return ( + 'undefined' != typeof document && + document.addEventListener('visibilitychange', function () { + Fl.suspendWhenDocumentHidden && + (jl() + ? (r = cancelAnimationFrame(r)) + : (zl.forEach(function (t) { + return t._onDocumentVisibility(); + }), + Vl())); + }), + function () { + !(r || (jl() && Fl.suspendWhenDocumentHidden)) && 0 < zl.length && (r = requestAnimationFrame(o)); + } + ); + })(); +function jl() { + return !!document && document.hidden; +} +function Fl() { + var h, + c = 0, + u = 0, + l = 0, + d = 0, + f = null; + function g(t) { + var e = + window.Promise && + new Promise(function (t) { + return (f = t); + }); + t.finished = e; + } + var M = Rl(0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}); + function p() { + var t = M.direction; + 'alternate' !== t && (M.direction = 'normal' !== t ? 'normal' : 'reverse'), + (M.reversed = !M.reversed), + h.forEach(function (t) { + return (t.reversed = M.reversed); + }); + } + function y(t) { + return M.reversed ? M.duration - t : t; + } + function t() { + (c = 0), (u = y(M.currentTime) * (1 / Fl.speed)); + } + function v(t, e) { + e && e.seek(t - e.timelineOffset); + } + function m(e) { + for (var t = 0, n = M.animations, i = n.length; t < i; ) { + var r = n[t], + o = r.animatable, + a = r.tweens, + s = a.length - 1, + h = a[s]; + s && + (h = + fl(a, function (t) { + return e < t.end; + })[0] || h); + for ( + var s = nl(e - h.start - h.delay, 0, h.duration) / h.duration, + c = isNaN(s) ? 1 : h.easing(s), + u = h.to.strings, + l = h.round, + d = [], + f = h.to.numbers.length, + g = void 0, + p = 0; + p < f; + p++ + ) { + var y = void 0, + v = h.to.numbers[p], + m = h.from.numbers[p] || 0; + h.isPath || (y = m + c * (v - m)), !l || (h.isColor && 2 < p) || (y = Math.round(y * l) / l), d.push(y); + } + var x = u.length; + if (x) + for (var g = u[0], w = 0; w < x; w++) { + u[w]; + var b = u[w + 1], + k = d[w]; + isNaN(k) || (g += b ? k + b : k + ' '); + } + else g = d[0]; + Al[r.type](o.target, r.property, g, o.transforms), (r.currentValue = g), t++; + } + } + function x(t) { + M[t] && !M.passThrough && M[t](M); + } + function e(t) { + var e = M.duration, + n = M.delay, + i = e - M.endDelay, + r = y(t); + if (((M.progress = nl((r / e) * 100, 0, 100)), (M.reversePlayback = r < M.currentTime), h)) { + var o = r; + if (M.reversePlayback) for (var a = d; a--; ) v(o, h[a]); + else for (var s = 0; s < d; s++) v(o, h[s]); + } + !M.began && 0 < M.currentTime && ((M.began = !0), x('begin')), + !M.loopBegan && 0 < M.currentTime && ((M.loopBegan = !0), x('loopBegin')), + r <= n && 0 !== M.currentTime && m(0), + ((i <= r && M.currentTime !== e) || !e) && m(e), + n < r && r < i + ? (M.changeBegan || ((M.changeBegan = !0), (M.changeCompleted = !1), x('changeBegin')), x('change'), m(r)) + : M.changeBegan && ((M.changeCompleted = !0), (M.changeBegan = !1), x('changeComplete')), + (M.currentTime = nl(r, 0, e)), + M.began && x('update'), + e <= t && + ((u = 0), + M.remaining && !0 !== M.remaining && M.remaining--, + M.remaining + ? ((c = l), x('loopComplete'), (M.loopBegan = !1), 'alternate' === M.direction && p()) + : ((M.paused = !0), + M.completed || + ((M.completed = !0), + x('loopComplete'), + x('complete'), + !M.passThrough && 'Promise' in window && (f(), g(M))))); + } + return ( + g(M), + (M.reset = function () { + var t = M.direction; + (M.passThrough = !1), + (M.currentTime = 0), + (M.progress = 0), + (M.paused = !0), + (M.began = !1), + (M.loopBegan = !1), + (M.changeBegan = !1), + (M.completed = !1), + (M.changeCompleted = !1), + (M.reversePlayback = !1), + (M.reversed = 'reverse' === t), + (M.remaining = M.loop), + (h = M.children); + for (var e = (d = h.length); e--; ) M.children[e].reset(); + ((M.reversed && !0 !== M.loop) || ('alternate' === t && 1 === M.loop)) && M.remaining++, + m(M.reversed ? M.duration : 0); + }), + (M._onDocumentVisibility = t), + (M.set = function (t, e) { + return Ol(t, e), M; + }), + (M.tick = function (t) { + e(((l = t) + (u - (c = c || l))) * Fl.speed); + }), + (M.seek = function (t) { + e(y(t)); + }), + (M.pause = function () { + (M.paused = !0), t(); + }), + (M.play = function () { + M.paused && (M.completed && M.reset(), (M.paused = !1), zl.push(M), t(), Vl()); + }), + (M.reverse = function () { + p(), (M.completed = !M.reversed), t(); + }), + (M.restart = function () { + M.reset(), M.play(); + }), + (M.remove = function (t) { + Ul(_l(t), M); + }), + M.reset(), + M.autoplay && M.play(), + M + ); +} +function Xl(t, e) { + for (var n = e.length; n--; ) vl(t, e[n].animatable.target) && e.splice(n, 1); +} +function Ul(t, e) { + var n = e.animations, + i = e.children; + Xl(t, n); + for (var r = i.length; r--; ) { + var o = i[r], + a = o.animations; + Xl(t, a), a.length || o.children.length || i.splice(r, 1); + } + n.length || i.length || e.pause(); +} +(Fl.version = '3.2.1'), + (Fl.speed = 1), + (Fl.suspendWhenDocumentHidden = !0), + (Fl.running = zl), + (Fl.remove = function (t) { + for (var e = _l(t), n = zl.length; n--; ) Ul(e, zl[n]); + }), + (Fl.get = Ml), + (Fl.set = Ol), + (Fl.timeline = function () { + var a = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + s = Fl(a); + return ( + (s.duration = 0), + (s.add = function (t, e) { + var n = zl.indexOf(s), + i = s.children; + function r(t) { + t.passThrough = !0; + } + -1 < n && zl.splice(n, 1); + for (var o = 0; o < i.length; o++) r(i[o]); + (n = xl(t, ml(tl, a))), + (n.targets = n.targets || a.targets), + (t = s.duration), + (n.autoplay = !1), + (n.direction = s.direction), + (n.timelineOffset = rl.und(e) ? t : El(e, t)), + r(s), + s.seek(n.timelineOffset), + (e = Fl(n)), + r(e), + i.push(e), + (t = Dl(i, a)); + return ( + (s.delay = t.delay), + (s.endDelay = t.endDelay), + (s.duration = t.duration), + s.seek(0), + s.reset(), + s.autoplay && s.play(), + s + ); + }), + s + ); + }), + (Fl.easing = dl), + (Fl.penner = ll), + (Fl.random = function (t, e) { + return Math.floor(Math.random() * (e - t + 1)) + t; + }); +var Wl = { + node: { + click: 'onClick', + dblClick: 'ondblClick', + mouseUp: 'onMouseUp', + mouseDown: 'onMouseDown', + mouseOver: 'onMouseOver', + mouseOut: 'onMouseOut', + mousedrag: 'onMousedrag', + mouseDragEnd: 'onMouseDragEnd', + }, + link: { + click: 'onClick', + dblClick: 'ondblClick', + mouseUp: 'onMouseUp', + mouseDown: 'onMouseDown', + mouseOver: 'onMouseOver', + mouseOut: 'onMouseOut', + }, + group: { click: 'onClick', dblClick: 'ondblClick' }, + scene: { + whiteSpaceClick: 'noElementClick', + keyUp: 'keyUp', + keyDown: 'keyDown', + mouseWheel: 'mouseWheel', + mouseDraging: 'mouseDraging', + mouseDragEnd: 'mouseDragEnd', + boxSelectEnd: 'onBoxSelectEndEvent', + }, + }, + Yl = function () { + (this.actionStack = []), + (this.todo = function (t, e) { + 10 < this.actionStack.length && this.actionStack.shift(), this.actionStack.push({ action: t, elements: e }); + }), + (this.clearAll = function () { + (this.actionStack = null), (this.actionStack = []); + }), + (this.undo = function (t) { + var e, n; + 0 != this.actionStack.length && ((e = (n = this.actionStack.pop()).action), (n = n.elements), this.do(e, n, t)); + }), + (this.do = function (t, e, i) { + var r, n; + 'node:add' != t && + ('node:remove' == t + ? ((r = new Map()), + (n = []), + e.forEach(function (t) { + 'node' == t.elementType + ? (i.scene.add(t), i.nodes.push(t), r.set(t.id, t)) + : 'link' == t.elementType && n.push(t); + }), + n.forEach(function (t) { + var e = t.source.id, + n = t.target.id, + e = r.get(e), + e = (e && e.outLinks.push(t), r.get(n)); + e && e.inLinks.push(t), i.scene.add(t), i.links.push(t); + })) + : 'link:remove' == t && + ((r = new Map()), + i.nodes.forEach(function (t) { + r.set(t.id, t); + }), + e.forEach(function (t) { + var e = t.source.id, + n = t.target.id, + e = r.get(e), + e = (e && e.outLinks.push(t), r.get(n)); + e && e.inLinks.push(t), i.scene.add(t), i.links.push(t); + }))), + i.refreshView(); + }); + }; +function Gl(t) { + (this.payload = t), + ((this.parent = this).rank = 0), + (this.find = function () { + var t = this.parent; + return t !== this && (this.parent = t.find()), this.parent; + }), + (this.union = function (t) { + var e = this.find(), + t = t.find(); + t !== e && (e.rank < t.rank ? (e.parent = t) : e.rank > t.rank ? (t.parent = e) : ((t.parent = e).rank += 1)); + }); +} +function ql(t, e) { + (this._rows = t), + (this._columns = e), + (this._matrix = new Float64Array(t * e)), + (this._n = t * e), + (this.set = function (t, e, n) { + var i = t * this._columns + e; + if (i >= this._n) throw new Error('Index out of range ' + t + ',' + e); + this._matrix[i] = n; + }), + (this.get = function (t, e) { + var n = t * this._columns + e; + if (n >= this._n) throw new Error('Index out of range ' + t + ',' + e); + return this._matrix[n]; + }), + (this.centerMatrix = function () { + if (!this.isCentered) { + for (var t = 0; t < this._rows; ++t) { + var e = this.getMean(t); + this.translateRow(t, -e); + } + this.isCentered = !0; + } + return this; + }), + (this.translateRow = function (t, e) { + if (t < 0 || t > this._rows) throw new Error('Row is out of range ' + t); + for (var n = t * this._columns, i = 0; i < this._columns; ++i) this._matrix[i + n] += e; + }), + (this.getMean = function (t) { + var e = 0; + if (t < 0 || t > this._rows) throw new Error('Row is out of range ' + t); + for (var n = t * this._columns, i = 0; i < this._columns; ++i) e += this._matrix[i + n]; + return e / this._columns; + }), + (this.applyVectorToColumn = function (t, e) { + var n = 0; + if (e.length !== this._rows) throw new Error('Invalid vector dimensions'); + for (var i = 0; i < this._rows; ++i) n += this._matrix[i * this._columns + t] * e[i]; + return n; + }), + (this.print = function () { + for (var t = [], e = 0; e < this._rows; ++e) { + for (var n = [], i = e * this._columns, r = 0; r < this._columns; ++r) n.push(this._matrix[i + r].toFixed(2)); + t.push(n.join(' ')); + } + console.log(t.join('\n')); + }), + (this.toArray = function () { + for (var t = [], e = 0; e < this._rows; ++e) { + for (var n = [], i = e * this._columns, r = 0; r < this._columns; ++r) n.push(this._matrix[i + r]); + t.push(n); + } + return t; + }), + (this.columnDistance = function (t, e) { + for (var n = 0, i = 0; i < this._rows; ++i) { + var r = this.get(i, t) - this.get(i, e); + n += r * r; + } + return Math.sqrt(n); + }), + (this.getCovariant = function () { + for (var t = new ql(this._rows, this._rows), e = 0; e < this._rows; ++e) + for (var n = 0; n < this._rows; ++n) { + for (var i = 0, r = e * this._columns, o = n * this._columns, a = 0; a < this._columns; ++a) + i += this._matrix[r + a] * this._matrix[o + a]; + t.set(n, e, i); + } + return t; + }); +} +function Hl(t, e) { + var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 1e-40, + i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 1e4, + r = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 42; + if (e > t.length) throw new Error("Matrix ain't that big"); + for (var o, a = ju(r), s = [], h = (1 - n) * (1 - n), c = 0; c < e; ++c) { + o = t.length; + for ( + var u = Array(o) + .fill(1) + .map(function () { + return a.nextDouble(); + }), + l = ((f = d = l = void 0), u), + d = Math.sqrt(E(l, l)), + f = 0; + f < l.length; + ++f + ) + l[f] /= d; + for (var g = 0, p = void 0; g < h; ) { + for (var p = u, y = 0; y < c; ++y) + for (var v = s[y], m = E(p, v), x = 0; x < p.length; ++x) p[x] = p[x] - m * v[x]; + for ( + var w = E( + (u = (function (t, e) { + if (t.length !== e.length) throw new Error('Matrix * Vector dimension mismatch'); + for (var n = [], i = 0; i < t.length; ++i) { + for (var r = 0, o = 0; o < t.length; ++o) r += t[i][o] * e[o]; + n[i] = r; + } + return n; + })(t, p)), + u, + ), + b = (0 === w && (w = E((u = p), u)), (M = k = b = void 0), u), + k = Math.sqrt(w), + M = 0; + M < b.length; + ++M + ) + b[M] /= k; + if (((g = E(u, p)), (g *= g), --i < 0)) break; + } + s.push(u); + } + return s; + function E(t, e) { + var n = 0; + if (t.length !== e.length) throw new Error('Vector length mismatch'); + for (var i = 0; i < t.length; ++i) n += t[i] * e[i]; + return n; + } +} +function Ql() { + var o, + t, + e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + s = Ou(), + h = + (e.forEach(function (t) { + s.addNode(t.id); + }), + n.forEach(function (t) { + s.addLink(t.source.id, t.target.id); + }), + new Map()), + c = [], + e = + (s.forEachNode(function (t) { + h.set(t.id, c.length), c.push(t.id); + }), + (o = Math.min(100, c.length)), + (t = Math.min(2, o)), + (function (t) { + for (var a = Array(c.length).fill(1 / 0), e = new ql(o, c.length), n = [], i = 0; i < o; ++i) { + n.push(t), + (function (n, i, t) { + for (var r = [{ node: t, d: 0 }], o = new Set([t]); r.length; ) + !(function () { + var e = r.shift(), + t = h.get(e.node); + n.set(i, t, e.d), + (a[t] = Math.min(a[t], e.d)), + s.forEachLinkedNode(e.node, function (t) { + o.has(t.id) || (r.push({ node: t.id, d: e.d + 1 }), o.add(t.id)); + }); + })(); + })(e, i, t); + var r = a.reduce(function (t, e, n, i) { + return e > i[t] ? n : t; + }, 0); + t = c[r]; + } + return { matrix: e, pivotNodes: n }; + })(c[0])), + i = e.matrix, + r = e.pivotNodes, + a = ((n = t), Hl(i.centerMatrix().getCovariant().toArray(), n)); + return { + getNodePosition: function (t) { + var e = h.get(t); + return a.map(function (t) { + return i.applyVectorToColumn(e, t); + }); + }, + getPivotNodes: function () { + return r; + }, + getLayoutDimensionsCount: function () { + return t; + }, + }; +} +function Jl(t, e, n) { + (this.defaultOption = { nodeHeight: 40, nodeWidth: 140, nodeSpace: 20, levelSpace: 120, animate: !1, type: 'umd' }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.treeData = e), + (this.visNodes = []), + (this.idMapChildNode = {}), + (this.idMapNode = {}), + (this.rootVisNode = null), + (this.currentNode = null), + (this.newChildren = []), + (this.graphVis = t), + (this.rootVisNode = this.buildXmindNode(this.treeData)), + this.graphVis.setZoom(); +} +function Kl(t, e, n) { + (this.defaultOption = { nodePadding: 20, levelSpace: 120, nodeSpace: 10, maxWidth: 100, animate: !1, type: 'lcr' }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.treeData = e), + (this.visNodes = []), + (this.idMapChildNode = {}), + (this.idMapNode = {}), + (this.graphVis = t), + (this.rootVisNode = null), + (this.currentNode = null), + (this.newChildren = []), + (this.rootVisNode = this.buildXmindNode(this.treeData)), + this.graphVis.zoomFit(); +} +function Zl() { + var yt, + vt, + mt = 0, + xt = 0, + wt = 1, + bt = 1, + kt = 24, + Mt = 8, + Et = 0, + Ct = function (t) { + return t.index; + }, + Tt = h, + Nt = function (t) { + return t.nodes; + }, + _t = function (t) { + return t.links; + }, + Lt = 6; + function e() { + var z, + t = { nodes: Nt.apply(null, arguments), links: _t.apply(null, arguments) }, + e = t, + i = e.nodes, + r = e.links, + o = m(i.entries()); + try { + for (o.s(); !(z = o.n()).done; ) { + var R = f(z.value, 2), + j = R[0], + a = R[1]; + (a.index = j), (a.sourceLinks = []), (a.targetLinks = []); + } + } catch (e) { + o.e(e); + } finally { + o.f(); + } + var F, + X = new Map( + i.map(function (t, e) { + return [Ct(t, e, i), t]; + }), + ), + s = m(r.entries()); + try { + for (s.s(); !(F = s.n()).done; ) { + var U = f(F.value, 2), + q = U[0], + h = U[1], + c = ((h.index = q), h.source), + u = h.target; + ('object' !== n(c) && null == (c = h.source = Rt(X, c))) || + ('object' !== n(u) && null == (u = h.target = Rt(X, u))) || + (c.sourceLinks.push(h), u.targetLinks.push(h)); + } + } catch (e) { + s.e(e); + } finally { + s.f(); + } + if (null != vt) { + var Y, + l = m(i); + try { + for (l.s(); !(Y = l.n()).done; ) { + var W = Y.value, + G = W.sourceLinks, + H = W.targetLinks; + G.sort(vt), H.sort(vt); + } + } catch (e) { + l.e(e); + } finally { + l.f(); + } + } + var Q, + d = t, + g = m(d.nodes); + try { + for (g.s(); !(Q = g.n()).done; ) { + var p = Q.value; + p.value = void 0 === p.fixedValue ? Math.max(At(p.sourceLinks, zt), At(p.targetLinks, zt)) : p.fixedValue; + } + } catch (d) { + g.e(d); + } finally { + g.f(); + } + for (var y = t, r = y.nodes, J = r.length, v = new Set(r), x = new Set(), K = 0; v.size; ) { + var Z, + w = m(v); + try { + for (w.s(); !(Z = w.n()).done; ) { + var $ = Z.value; + $.depth = K; + var tt, + b = m($.sourceLinks); + try { + for (b.s(); !(tt = b.n()).done; ) { + var et = tt.value.target; + x.add(et); + } + } catch (y) { + b.e(y); + } finally { + b.f(); + } + } + } catch (y) { + w.e(y); + } finally { + w.f(); + } + if (++K > J) throw new Error('circular link'); + (v = x), (x = new Set()); + } + for (var k = t, r = k.nodes, nt = r.length, M = new Set(r), E = new Set(), it = 0; M.size; ) { + var rt, + C = m(M); + try { + for (C.s(); !(rt = C.n()).done; ) { + var ot = rt.value; + ot.height = it; + var at, + T = m(ot.targetLinks); + try { + for (T.s(); !(at = T.n()).done; ) { + var st = at.value.source; + E.add(st); + } + } catch (k) { + T.e(k); + } finally { + T.f(); + } + } + } catch (k) { + C.e(k); + } finally { + C.f(); + } + if (++it > nt) throw new Error('circular link'); + (M = E), (E = new Set()); + } + var ht, + ct = t, + N = (function () { + var t, + e = ct.nodes, + n = + It(e, function (t) { + return t.depth; + }) + 1, + i = (wt - mt - kt) / (n - 1), + r = new Array(n), + o = m(e); + try { + for (o.s(); !(t = o.n()).done; ) { + var a = t.value, + s = Math.max(0, Math.min(n - 1, Math.floor(Tt.call(null, a, n)))); + (a.layer = s), (a.x0 = mt + s * i), (a.x1 = a.x0 + kt), r[s] ? r[s].push(a) : (r[s] = [a]); + } + } catch (t) { + o.e(t); + } finally { + o.f(); + } + if (yt) { + var h, + c = m(r); + try { + for (c.s(); !(h = c.n()).done; ) h.value.sort(yt); + } catch (t) { + c.e(t); + } finally { + c.f(); + } + } + return r; + })(), + _ = + ((Et = Math.min( + Mt, + (bt - xt) / + (It(N, function (t) { + return t.length; + }) - + 1), + )), + N), + ut = Ot(_, function (t) { + return (bt - xt - (t.length - 1) * Et) / At(t, zt); + }), + L = m(_); + try { + for (L.s(); !(ht = L.n()).done; ) { + var lt, + S = ht.value, + P = xt, + A = m(S); + try { + for (A.s(); !(lt = A.n()).done; ) { + var O = lt.value; + (O.y0 = P), (O.y1 = P + O.value * ut), (P = O.y1 + Et); + var dt, + I = m(O.sourceLinks); + try { + for (I.s(); !(dt = I.n()).done; ) { + var ft = dt.value; + ft.width = ft.value * ut; + } + } catch (_) { + I.e(_); + } finally { + I.f(); + } + } + } catch (_) { + A.e(_); + } finally { + A.f(); + } + P = (bt - P + Et) / (S.length + 1); + for (var D = 0; D < S.length; ++D) { + var gt = S[D]; + (gt.y0 += P * (D + 1)), (gt.y1 += P * (D + 1)); + } + !(function (t) { + if (void 0 === vt) { + var e, + n = m(t); + try { + for (n.s(); !(e = n.n()).done; ) { + var i = e.value, + r = i.sourceLinks, + o = i.targetLinks; + r.sort(Bt), o.sort(Dt); + } + } catch (t) { + n.e(t); + } finally { + n.f(); + } + } + })(S); + } + } catch (_) { + L.e(_); + } finally { + L.f(); + } + for (var B = 0; B < Lt; ++B) { + var V = Math.pow(0.99, B), + pt = Math.max(1 - V, (B + 1) / Lt); + (function (t, e, n) { + for (var i = t.length - 2; 0 <= i; --i) { + var r, + o = t[i], + a = m(o); + try { + for (a.s(); !(r = a.n()).done; ) { + var s, + h, + c = r.value, + u = 0, + l = 0, + d = m(c.sourceLinks); + try { + for (d.s(); !(s = d.n()).done; ) { + var f = s.value, + g = f.target, + p = f.value * (g.layer - c.layer); + (u += + (function (t, e) { + var n, + i = e.y0 - ((e.targetLinks.length - 1) * Et) / 2, + r = m(e.targetLinks); + try { + for (r.s(); !(n = r.n()).done; ) { + var o = n.value, + a = o.source, + s = o.width; + if (a === t) break; + i += s + Et; + } + } catch (t) { + r.e(t); + } finally { + r.f(); + } + var h, + c = m(t.sourceLinks); + try { + for (c.s(); !(h = c.n()).done; ) { + var u = h.value, + l = u.target, + d = u.width; + if (l === e) break; + i -= d; + } + } catch (t) { + c.e(t); + } finally { + c.f(); + } + return i; + })(c, g) * p), + (l += p); + } + } catch (t) { + d.e(t); + } finally { + d.f(); + } + 0 < l && ((h = (u / l - c.y0) * e), (c.y0 += h), (c.y1 += h), Pt(c)); + } + } catch (t) { + a.e(t); + } finally { + a.f(); + } + void 0 === yt && o.sort(Vt), St(o, n); + } + })(N, V, pt), + (function (t, e, n) { + for (var i = 1, r = t.length; i < r; ++i) { + var o, + a = t[i], + s = m(a); + try { + for (s.s(); !(o = s.n()).done; ) { + var h, + c, + u = o.value, + l = 0, + d = 0, + f = m(u.targetLinks); + try { + for (f.s(); !(h = f.n()).done; ) { + var g = h.value, + p = g.source, + y = g.value * (u.layer - p.layer); + (l += + (function (t, e) { + var n, + i = t.y0 - ((t.sourceLinks.length - 1) * Et) / 2, + r = m(t.sourceLinks); + try { + for (r.s(); !(n = r.n()).done; ) { + var o = n.value, + a = o.target, + s = o.width; + if (a === e) break; + i += s + Et; + } + } catch (t) { + r.e(t); + } finally { + r.f(); + } + var h, + c = m(e.targetLinks); + try { + for (c.s(); !(h = c.n()).done; ) { + var u = h.value, + l = u.source, + d = u.width; + if (l === t) break; + i -= d; + } + } catch (t) { + c.e(t); + } finally { + c.f(); + } + return i; + })(p, u) * y), + (d += y); + } + } catch (t) { + f.e(t); + } finally { + f.f(); + } + 0 < d && ((c = (l / d - u.y0) * e), (u.y0 += c), (u.y1 += c), Pt(u)); + } + } catch (t) { + s.e(t); + } finally { + s.f(); + } + void 0 === yt && a.sort(Vt), St(a, n); + } + })(N, V, pt); + } + return jt(t), Ft(t), Xt(t), t; + } + function St(t, e) { + var n = t.length >> 1, + i = t[n]; + o(t, i.y0 - Et, n - 1, e), r(t, i.y1 + Et, 1 + n, e), o(t, bt, t.length - 1, e), r(t, xt, 0, e); + } + function r(t, e, n, i) { + for (; n < t.length; ++n) { + var r = t[n], + o = (e - r.y0) * i; + 1e-6 < o && ((r.y0 += o), (r.y1 += o)), (e = r.y1 + Et); + } + } + function o(t, e, n, i) { + for (; 0 <= n; --n) { + var r = t[n], + o = (r.y1 - e) * i; + 1e-6 < o && ((r.y0 -= o), (r.y1 -= o)), (e = r.y0 - Et); + } + } + function Pt(t) { + var e = t.sourceLinks, + n = t.targetLinks; + if (void 0 === vt) { + var i, + r = m(n); + try { + for (r.s(); !(i = r.n()).done; ) i.value.source.sourceLinks.sort(Bt); + } catch (t) { + r.e(t); + } finally { + r.f(); + } + var o, + a = m(e); + try { + for (a.s(); !(o = a.n()).done; ) o.value.target.targetLinks.sort(Dt); + } catch (t) { + a.e(t); + } finally { + a.f(); + } + } + } + function At(t, e) { + var n, + i = 0, + r = t.length, + o = -1; + if (1 === arguments.length) for (; ++o < r; ) isNaN((n = +t[o])) || (i += n); + else for (; ++o < r; ) isNaN((n = +e.call(t, t[o], o))) || (i += n); + return i; + } + function Ot(t, e) { + var n, + i, + r = -1, + o = t.length; + if (1 === arguments.length) { + for (; ++r < o; ) + if (null != (i = t[r]) && i <= i) { + n = i; + break; + } + for (; ++r < o; ) null != (i = t[r]) && i < n && (n = i); + } else { + for (; ++r < o; ) + if (null != (i = e.call(t, t[r], r)) && i <= i) { + n = i; + break; + } + for (; ++r < o; ) null != (i = e.call(t, t[r], r)) && i < n && (n = i); + } + return n; + } + function It(t, e) { + var n, + i, + r = -1, + o = t.length; + if (1 === arguments.length) { + for (; ++r < o; ) + if (null != (i = t[r]) && i <= i) { + n = i; + break; + } + for (; ++r < o; ) null != (i = t[r]) && n < i && (n = i); + } else { + for (; ++r < o; ) + if (null != (i = e.call(t, t[r], r)) && i <= i) { + n = i; + break; + } + for (; ++r < o; ) null != (i = e.call(t, t[r], r)) && n < i && (n = i); + } + return n; + } + function i(t) { + return t.target.depth; + } + function a(t) { + return t.depth; + } + function s(t, e) { + return e - 1 - t.height; + } + function h(t, e) { + return t.sourceLinks.length ? t.depth : e - 1; + } + function l(t) { + return t.targetLinks.length ? t.depth : t.sourceLinks.length ? Ot(t.sourceLinks, i) - 1 : 0; + } + function c(t) { + return function () { + return t; + }; + } + function Dt(t, e) { + return Vt(t.source, e.source) || t.index - e.index; + } + function Bt(t, e) { + return Vt(t.target, e.target) || t.index - e.index; + } + function Vt(t, e) { + return t.y0 - e.y0; + } + function zt(t) { + return t.value || 2; + } + function Rt(t, e) { + return t.get(e) || null; + } + function jt(t) { + var e, + n = m(t.nodes); + try { + for (n.s(); !(e = n.n()).done; ) { + var i, + r = e.value, + o = r.y0, + a = o, + s = m(r.sourceLinks); + try { + for (s.s(); !(i = s.n()).done; ) { + var h = i.value; + (h.y0 = o + h.width / 2), (o += h.width); + } + } catch (t) { + s.e(t); + } finally { + s.f(); + } + var c, + u = m(r.targetLinks); + try { + for (u.s(); !(c = u.n()).done; ) { + var l = c.value; + (l.y1 = a + l.width / 2), (a += l.width); + } + } catch (t) { + u.e(t); + } finally { + u.f(); + } + } + } catch (t) { + n.e(t); + } finally { + n.f(); + } + } + function u(t) { + return Math.round(10 * t) / 10; + } + function Ft(t) { + var e, + n = m(t.nodes); + try { + for (n.s(); !(e = n.n()).done; ) { + var i = e.value; + (i.x = u(i.x0)), (i.dx = u(i.x1 - i.x0)), (i.y = u(i.y0)), (i.dy = u(i.y1 - i.y0)); + } + } catch (t) { + n.e(t); + } finally { + n.f(); + } + } + function Xt(t) { + var e, + n = m(t.links); + try { + for (n.s(); !(e = n.n()).done; ) { + var i = e.value; + i.source && + i.target && + ((i.dy = u(i.width)), + (i.sy = u(i.y0 - i.source.y0 - i.width / 2)), + (i.ty = u(i.y1 - i.target.y0 - i.width / 2))); + } + } catch (t) { + n.e(t); + } finally { + n.f(); + } + } + return ( + (e.update = function (t) { + return jt(t), Ft(t), Xt(t), t; + }), + (e.nodeId = function (t) { + return arguments.length ? ((Ct = 'function' == typeof t ? t : c(t)), e) : Ct; + }), + (e.nodeAlign = function (t) { + return arguments.length ? ((Tt = 'left' === t ? a : 'right' === t ? s : 'center' === t ? l : h), e) : Tt; + }), + (e.nodeSort = function (t) { + return arguments.length ? ((yt = t), e) : yt; + }), + (e.nodeWidth = function (t) { + return arguments.length ? ((kt = +t), e) : kt; + }), + (e.nodePadding = function (t) { + return arguments.length ? ((Mt = Et = +t), e) : Mt; + }), + (e.nodes = function (t) { + return arguments.length ? ((Nt = 'function' == typeof t ? t : c(t)), e) : Nt; + }), + (e.links = function (t) { + return arguments.length ? ((_t = 'function' == typeof t ? t : c(t)), e) : _t; + }), + (e.linkSort = function (t) { + return arguments.length ? ((vt = t), e) : vt; + }), + (e.size = function (t) { + return arguments.length ? ((mt = xt = 0), (wt = +t[0]), (bt = +t[1]), e) : [wt - mt, bt - xt]; + }), + (e.extent = function (t) { + return arguments.length + ? ((mt = +t[0][0]), (wt = +t[1][0]), (xt = +t[0][1]), (bt = +t[1][1]), e) + : [ + [mt, xt], + [wt, bt], + ]; + }), + (e.iterations = function (t) { + return arguments.length ? ((Lt = +t), e) : Lt; + }), + (e.link = function () { + var h = 0.5; + function e(t) { + var e, + n, + i = t.source.x + t.source.dx, + r = t.target.x, + o = + ((e = +i), + (n = +r), + function (t) { + return e * (1 - t) + n * t; + }), + a = o(h), + o = o(1 - h), + s = t.source.y + t.sy + t.dy / 2, + t = t.target.y + t.ty + t.dy / 2; + return 'M' + i + ',' + s + 'C' + a + ',' + s + ' ' + o + ',' + t + ' ' + r + ',' + t; + } + return ( + (e.curvature = function (t) { + return arguments.length ? ((h = +t), e) : h; + }), + e + ); + }), + e + ); +} +function $l(t, e, n) { + (this.defaultOption = { + nodeWidth: 50, + nodePadding: 10, + nodeColor: 'default', + lineColor: 'both', + lineAlpha: 0.4, + alignType: 'justify', + dragable: !0, + }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.graphVis = t), + (this.snakeyData = e), + this.update(); +} +function td(t, e, n) { + (this.defaultOption = { + arrangeType: 'cluster', + areaRadius: 300, + lineCurvature: 0.5, + lineColor: 'defined', + lineType: 'radial', + center: [0, 0], + animate: !1, + levelBack: { show: !1, alpha: 0.1, color: '120,180,120', lineDash: [0] }, + }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.levels = []), + (this.levelBackNodes = []), + (this.graphVis = t), + (this.treeData = e), + this.init(); +} +function ed(t, e, n) { + (this.defaultOption = { nodeSize: 10, levelDistance: 150, lineColor: 'defined', lineType: 'curve', direction: 'LR' }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.graphVis = t), + (this.treeData = e), + this.update(); +} +function nd(t, e, n) { + (this.defaultOption = { + nodeSize: 0, + nodePadding: 5, + packAlpha: 0.1, + packThemeColor: '120,120,230', + borderDash: [0], + }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.graphVis = t), + (this.treeData = e), + this.init(); +} +function id(t, e, n) { + (this.defaultOption = { layerSpace: 45, nodePadding: 12, alignType: 'center' }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.graphVis = t), + (this.treeData = e), + this.init(); +} +function rd() { + for (var t = 0, e = 0, n = arguments.length; e < n; e++) t += arguments[e].length; + for (var i = Array(t), r = 0, e = 0; e < n; e++) + for (var o = arguments[e], a = 0, s = o.length; a < s; a++, r++) i[r] = o[a]; + return i; +} +function od(t) { + return t.reduce(function (t, e) { + return t + e; + }, 0); +} +function ad(t) { + return t.reduce(function (t, e) { + return rd(t, e); + }, []); +} +function sd(a, s, h, c) { + var u = new Map([]); + return function (t) { + var e, n, i, r, o; + return u.has(t) + ? u.get(t) + : ((e = 1 - t), + (o = Math.pow(e, 3)), + (n = Math.pow(e, 2)), + (i = Math.pow(t, 3)), + (r = Math.pow(t, 2)), + (o = [ + a[0] * o + 3 * s[0] * t * n + 3 * h[0] * r * e + c[0] * i, + a[1] * o + 3 * s[1] * t * n + 3 * h[1] * r * e + c[1] * i, + ]), + u.set(t, o), + o); + }; +} +function hd(t) { + var n = t.slice(1), + i = t[0]; + return n.map(function (t, e) { + e = 0 === e ? i : n[e - 1][2]; + return sd.apply(void 0, rd([e], t)); + }); +} +function cd(t, e) { + return t.map(function (n, t) { + var i = 1 / (e[t] - 1); + return new Array(e[t]).fill(0).map(function (t, e) { + return n(e * i); + }); + }); +} +function ud(o) { + return new Array(o.length - 1).fill(0).map(function (t, e) { + return ( + (i = o[e]), + (e = o[e + 1]), + (n = i[0]), + (i = i[1]), + (r = e[0]), + (e = e[1]), + Math.sqrt(Math.pow(n - r, 2) + Math.pow(i - e, 2)) + ); + var n, i, r; + }); +} +function ld(t) { + var e, + t = t.map(ud), + n = od( + t.map(function (t) { + return t.length; + }), + ), + i = t.map(od), + r = od(i), + n = r / n; + return { + totalLength: r, + segmentLength: i, + avgDistance: n, + deviation: + ((e = n), + od( + t + .map(function (t) { + return t.map(function (t) { + return Math.abs(t - e); + }); + }) + .map(od), + )), + }; +} +function dd(t) { + return ad(t).length; +} +function fd(t, e, n, i) { + console.warn('-------------start-------------'); + var c, + u, + l, + d, + r, + o, + a, + s, + h, + f, + g = ld(t); + return g.deviation <= n + ? ad(t) + : ((r = t), + (o = e), + (n = n), + (a = g.avgDistance), + (s = g.totalLength), + (h = g.segmentLength), + (f = dd(r)), + (f = Math.ceil((a / n) * f * 1.1)), + (t = cd( + o, + h + .map(function (t) { + return Math.ceil((t / s) * f); + }) + .map(function (t) { + return 1 < t ? t : 2; + }), + )), + ad( + i <= 0 + ? t + : ((r = e), + (g = ld((c = t))), + (u = i), + (l = g.avgDistance), + (d = 1 / dd(c) / 10), + r.forEach(function (t, e) { + for ( + var n = c[e].length, + i = 1 / (n - 1), + r = new Array(n).fill(0).map(function (t, e) { + return e * i; + }), + o = 0; + o < u; + o++ + ) + for ( + var a = ud(c[e]).map(function (t) { + return t - l; + }), + s = 0, + h = 0; + h < n; + h++ + ) + 0 !== h && + ((s += a[h - 1]), + (r[h] -= d * s), + 1 < r[h] && (r[h] = 1), + r[h] < 0 && (r[h] = 0), + (c[e][h] = t(r[h]))); + }), + (t = c)), + )); +} +function gd(t, e, n) { + void 0 === e && (e = 5), void 0 === n && (n = 0); + var i = hd(t), + r = fd(((r = i.length), cd(i, new Array(r).fill(50))), i, e, n), + i = t.slice(-1)[0][2]; + return r.push(i), r; +} +function pd(t, e, n) { + if ((void 0 === e && (e = 5), void 0 === n && (n = 0), !(t instanceof Array))) + throw new Error('bezierCurveToPolyline: Invalid input of ' + t); + if (t.length <= 1) throw new Error('bezierCurveToPolyline: The length of the bezierCurve should be greater than 1'); + if ('number' != typeof e) throw new Error('bezierCurveToPolyline: Type of precision must be number'); + return gd(t, e, n); +} +function vd(t, e) { + var n = t[0], + t = t[1], + i = e[0], + e = e[1]; + return [i + (i - n), e + (e - t)]; +} +(Jl.prototype.reloadData = function (t) { + (this.treeData = t), + this.graphVis.clearAll(), + (this.visNodes = []), + (this.idMapChildNode = {}), + (this.idMapNode = {}), + (this.rootVisNode = null), + (this.currentNode = null), + (this.rootVisNode = this.buildXmindNode(this.treeData)), + this.graphVis.setZoom(); +}), + (Jl.prototype.resetOption = function (t) { + (this.option = x(this.defaultOption, t, !0, !0)), this.reloadData(this.treeData); + }), + (Jl.prototype.buildXmindNode = function (t) { + var e = this, + n = e.createVisNode(t, null, 'down'), + i = this.graphVis.getViewCenter(), + i = + ((n.cx = i.x), + (n.cy = i.y), + (n.finishX = n.x), + (n.finishY = n.y), + (n.isRootNode = !0), + (this.rootVisNode = n), + this.visNodes.push(n), + e.splitSubTree(t.children || [])), + t = + (this.buildVisTreeNode({ children: i.rightNodes }, n, 'down'), + this.layout(n, this.option.nodeSpace, this.option.levelSpace, 'down'), + n.finishX), + i = + (this.buildVisTreeNode({ children: i.leftNodes }, n, 'up'), + this.layout(n, this.option.nodeSpace, this.option.levelSpace, 'up'), + n.finishX - t); + return ( + this.shiftLeftTreeNode(n.leftSubNodes, i), + (n.finishX = t), + e.option.animate + ? (e.visNodes.forEach(function (t) { + (t.x = n.finishX), (t.y = n.finishY); + }), + e.graphVis + .createBaseAnimate({ + targets: e.visNodes, + duration: 800, + easing: 'easeInQuad', + x: function (t) { + return t.finishX; + }, + y: function (t) { + return t.finishY; + }, + begin: function (t) { + e.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + e.graphVis.switchAnimate(!1); + })) + : e.visNodes.forEach(function (t) { + (t.x = t.finishX), (t.y = t.finishY); + }), + this.drawLine(n), + n + ); + }), + (Jl.prototype.switchNodeExpand = function (t) { + var e; + (this.currentNode = t).hasChild && + (0 == (t.outLinks || []).length + ? this.option.hasOwnProperty('appendChildNode') + ? 'function' == typeof (e = this.option.appendChildNode) && e(t) + : this.expendChild(t, this.idMapChildNode[t.id]) + : this.contractChild(t)); + }), + (Jl.prototype.highLightParent = function (t) { + var e = this, + n = [t]; + e.findAllPreLevelNodes(t, n), + n.forEach(function (t) { + e.selectedElement(t), + (t.outLinks || []).forEach(function (t) { + -1 != n.indexOf(t.target) && e.selectedElement(t); + }); + }); + }), + (Jl.prototype.findAllPreLevelNodes = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + n = this; + (t.inLinks || []).forEach(function (t) { + e.push(t.source), n.findAllPreLevelNodes(t.source, e); + }); + }), + (Jl.prototype.selectedElement = function (t) { + this.graphVis.addToSelectedElements([t]); + }), + (Jl.prototype.buildVisTreeNode = function (t, i) { + var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 'down', + o = this; + (t.children || []).forEach(function (t, e) { + var n = o.createVisNode(t, i, r); + o.buildVisTreeNode(t, n, r); + }); + }), + (Jl.prototype.createVisNode = function (t, e, n) { + var i = { id: t.id, label: t.label || t.name, type: t.type, style: t.style }, + i = this.graphVis.addNode(i); + return ( + (i.leftSubNodes = []), + (i.rightSubNodes = []), + (i.directType = n), + (i.hasChild = !!t.children), + (i.width = this.option.nodeWidth), + (i.height = this.option.nodeHeight), + e && ('down' == n ? e.rightSubNodes : e.leftSubNodes).push(i), + this.visNodes.push(i), + i + ); + }), + (Jl.prototype.reloadLayout = function (t, e) { + var n = this; + (this.treeData = t), + (this.idMapNode = {}), + this.buildVirtualXmind(this.treeData), + e && + (this.currentNode.isRootNode + ? ((t = this.splitSubTree(this.newChildren)), + this.buildVisTreeNode({ children: t.rightNodes }, this.currentNode, 'down'), + this.buildVisTreeNode({ children: t.leftNodes }, this.currentNode, 'up')) + : this.buildVisTreeNode({ children: this.newChildren }, this.currentNode, this.currentNode.directType), + this.drawLine(this.currentNode)), + this.visNodes.forEach(function (t) { + var e = n.idMapNode[t.id]; + e && ((t.x = e.finishX), (t.y = e.finishY)); + }), + this.graphVis.setZoom(); + }), + (Jl.prototype.buildVirtualXmind = function (t) { + var e = this.splitSubTree(t.children || []), + n = { id: t.id, label: t.name, leftSubNodes: [], rightSubNodes: [], width: 0, cwidth: 0 }, + i = this.graphVis.getViewCenter(), + i = + ((n.finishX = i.x), + (n.finishY = i.y), + this.buildVirtualSubNode({ children: e.rightNodes }, n, 'down'), + this.layout(n, this.option.nodeSpace, this.option.levelSpace, 'down'), + n.finishX), + e = + (this.buildVirtualSubNode({ children: e.leftNodes }, n, 'up'), + this.layout(n, this.option.nodeSpace, this.option.levelSpace, 'up'), + n.finishX - i); + return this.shiftLeftTreeNode(n.leftSubNodes, e), (n.finishX = i), (this.idMapNode[t.id] = n); + }), + (Jl.prototype.splitSubTree = function (t) { + var n = Math.ceil(t.length / 2), + i = [], + r = []; + return ( + 'umd' == this.option.type + ? t.forEach(function (t, e) { + (e < n ? i : r).push(t); + }) + : 'ud' == this.option.type + ? t.forEach(function (t, e) { + i.push(t); + }) + : 'du' == this.option.type && + t.forEach(function (t, e) { + r.push(t); + }), + { leftNodes: r, rightNodes: i } + ); + }), + (Jl.prototype.buildVirtualSubNode = function (t, i) { + var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 'down', + o = this; + (t.children || []).forEach(function (t, e) { + var n = { id: t.id, label: t.name, leftSubNodes: [], rightSubNodes: [] }; + (n.directType = r), + (n.height = o.option.nodeHeight), + (n.width = o.option.nodeWidth), + ('down' == r ? i.rightSubNodes : i.leftSubNodes).push(n), + (o.idMapNode[n.id] = n), + o.buildVirtualSubNode(t, n, r); + }); + }), + (Jl.prototype.drawLine = function (n) { + var i = this; + n.leftSubNodes.concat(n.rightSubNodes).forEach(function (e, t) { + i.graphVis.links.filter(function (t) { + return t.source.id == n.id && t.target.id == e.id; + })[0] || i.graphVis.addEdge({ source: n.id, target: e.id }), + i.drawLine(e); + }); + }), + (Jl.prototype.shiftLeftTreeNode = function (t, e) { + var n = this; + t.forEach(function (t) { + (t.finishX -= e), n.shiftLeftTreeNode(t.leftSubNodes || [], e); + }); + }), + (Jl.prototype.layout = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 20, + n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 50, + i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 'down', + r = 1 / 0, + o = -1 / 0, + a = 'down' == i ? t.rightSubNodes : t.leftSubNodes; + t.cwidth = t.width; + for (var s = 0, h = a.length, c = 0; c < h; c++) { + var u = a[c]; + (u.finishY = 'down' == i ? t.finishY + n : t.finishY - n), + (u.finishX = t.finishX + s), + this.layout(u, e, n, i), + (t.cwidth += u.cwidth + e), + 0 == c && (t.cwidth -= this.option.nodeWidth + e), + (s += u.cwidth + e), + (r = Math.min(r, u.finishX)), + (o = Math.max(o, u.finishX)); + } + 0 < a.length && (t.finishX = r + Math.abs(o - r) / 2); + }), + (Jl.prototype.deepFindChildNode = function (t, e) { + var n = this, + t = (t.outLinks || []).map(function (t) { + return t.target; + }); + t.forEach(function (t) { + e.push(t); + }), + t.forEach(function (t) { + t.contract || n.deepFindChildNode(t, e); + }); + }), + (Jl.prototype.contractChild = function (t) { + var e = this, + n = []; + e.deepFindChildNode(t, n), + e.option.animate + ? (n.forEach(function (t) { + (t.inLinks || []).forEach(function (t) { + t.visible = !1; + }); + }), + e.graphVis + .createBaseAnimate({ + targets: n, + x: t.x, + y: t.y, + alpha: 0, + duration: 600, + easing: 'easeInQuad', + begin: function (t) { + e.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + e.graphVis.deleteNodes(n), + e.removeChild(e.treeData, t.id), + e.reloadLayout(e.treeData, !1), + e.graphVis.switchAnimate(!1); + })) + : (e.graphVis.deleteNodes(n), e.removeChild(e.treeData, t.id), e.reloadLayout(e.treeData, !1)); + }), + (Jl.prototype.expendChild = function (e, t) { + var n, + i = this; + i.appendChild(i.treeData, e.id, t), + i.reloadLayout(i.treeData, !0), + i.option.animate && + ((n = []), + i.deepFindChildNode(e, n), + n.forEach(function (t) { + (t.x = e.x), + (t.y = e.y), + (t.alpha = 0), + (t.inLinks || []).forEach(function (t) { + t.visible = !1; + }); + }), + i.graphVis + .createBaseAnimate({ + targets: n, + x: function (t) { + return i.idMapNode[t.id].finishX; + }, + y: function (t) { + return i.idMapNode[t.id].finishY; + }, + alpha: 1, + duration: 600, + easing: 'easeOutQuad', + begin: function (t) { + i.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + n.forEach(function (t) { + (t.inLinks || []).forEach(function (t) { + t.visible = !0; + }); + }), + i.graphVis.switchAnimate(!1); + })); + }), + (Jl.prototype.removeChild = function (t, n) { + var i = this; + t.id === n + ? ((i.idMapChildNode[t.id] = t.children), (t.children = null)) + : (t.children || []).forEach(function (t, e) { + i.removeChild(t, n); + }); + }), + (Jl.prototype.appendChild = function (t, n, i) { + var r = this; + t.id === n + ? ((t.children = i || []), (r.newChildren = t.children)) + : (t.children || []).forEach(function (t, e) { + r.appendChild(t, n, i); + }); + }), + (Kl.prototype.reloadData = function (t) { + (this.treeData = t), + this.graphVis.clearAll(), + (this.visNodes = []), + (this.idMapChildNode = {}), + (this.idMapNode = {}), + (this.rootVisNode = null), + (this.currentNode = null), + (this.rootVisNode = this.buildXmindNode(this.treeData)), + this.graphVis.zoomFit(); + }), + (Kl.prototype.resetOption = function (t) { + (this.option = x(this.defaultOption, t, !0, !0)), this.reloadData(this.treeData); + }), + (Kl.prototype.buildXmindNode = function (t) { + var e = this, + n = e.createVisNode(t, null, 'right'), + i = this.graphVis.getViewCenter(), + i = + ((n.cx = i.x), + (n.cy = i.y), + (n.finishX = n.cx), + (n.finishY = n.cy), + (n.maxChildW = 0), + (n.isRootNode = !0), + (this.rootVisNode = n), + this.visNodes.push(n), + e.splitSubTree(t.children || [])), + t = + (this.buildVisTreeNode({ children: i.rightNodes }, n, 'right'), + this.layout(n, this.option.levelSpace, this.option.nodeSpace, 'right'), + n.finishY), + i = + (this.buildVisTreeNode({ children: i.leftNodes }, n, 'left'), + this.layout(n, this.option.levelSpace, this.option.nodeSpace, 'left'), + n.finishY - t); + return ( + this.shiftLeftTreeNode(n.leftSubNodes, i), + (n.finishY = t), + e.option.animate + ? (e.visNodes.forEach(function (t) { + (t.x = n.finishX), (t.y = n.finishY); + }), + e.graphVis + .createBaseAnimate({ + targets: e.visNodes, + duration: 800, + easing: 'easeInQuad', + x: function (t) { + return t.finishX; + }, + cy: function (t) { + return t.finishY; + }, + begin: function (t) { + e.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + e.graphVis.switchAnimate(!1); + })) + : e.visNodes.forEach(function (t) { + (t.x = t.finishX), (t.cy = t.finishY); + }), + this.drawLine(n), + n + ); + }), + (Kl.prototype.highLightParent = function (t) { + var e = this, + n = [t]; + e.findAllPreLevelNodes(t, n), + n.forEach(function (t) { + e.selectedElement(t), + (t.outLinks || []).forEach(function (t) { + -1 != n.indexOf(t.target) && e.selectedElement(t); + }); + }); + }), + (Kl.prototype.findAllPreLevelNodes = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + n = this; + (t.inLinks || []).forEach(function (t) { + e.push(t.source), n.findAllPreLevelNodes(t.source, e); + }); + }), + (Kl.prototype.selectedElement = function (t) { + this.graphVis.addToSelectedElements([t]); + }), + (Kl.prototype.buildVisTreeNode = function (t, i) { + var r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 'right', + o = this; + (t.children || []).forEach(function (t, e) { + var n = o.createVisNode(t, i, r); + o.buildVisTreeNode(t, n, r); + }); + }), + (Kl.prototype.createVisNode = function (t, e, n) { + t = this.graphVis.addNode({ id: t.id, label: t.label || t.name }); + return ( + (t.leftSubNodes = []), + (t.rightSubNodes = []), + (t.directType = n), + (t.nodePadding = this.option.nodePadding / 2), + (t.hasChild = !!t.children), + (t.width = this.getTextWidth(t)), + e && ('right' == n ? e.rightSubNodes : e.leftSubNodes).push(t), + this.visNodes.push(t), + t + ); + }), + (Kl.prototype.reloadLayout = function (t, e) { + var n = this; + (this.treeData = t), + (this.idMapNode = {}), + this.buildVirtualXmind(this.treeData), + e && + (this.currentNode.isRootNode + ? ((t = this.splitSubTree(this.newChildren)), + this.buildVisTreeNode({ children: t.rightNodes }, this.currentNode, 'right'), + this.buildVisTreeNode({ children: t.leftNodes }, this.currentNode, 'left')) + : this.buildVisTreeNode({ children: this.newChildren }, this.currentNode, this.currentNode.directType), + this.drawLine(this.currentNode)), + this.visNodes.forEach(function (t) { + var e = n.idMapNode[t.id]; + e && ((t.x = e.finishX), (t.cy = e.finishY)); + }), + this.graphVis.zoomFit(); + }), + (Kl.prototype.buildVirtualXmind = function (t) { + var e = this.splitSubTree(t.children || []), + n = { id: t.id, label: t.name, leftSubNodes: [], rightSubNodes: [], maxChildW: 0, height: 0 }, + i = ((n.cheight = n.height), (n.width = this.getTextWidth(n)), this.graphVis.getViewCenter()), + i = + ((n.finishX = i.x), + (n.finishY = i.y), + this.buildVirtualSubNode({ children: e.rightNodes }, n, 'right'), + this.layout(n, this.option.levelSpace, this.option.nodeSpace, 'right'), + n.finishY), + e = + (this.buildVirtualSubNode({ children: e.leftNodes }, n, 'left'), + this.layout(n, this.option.levelSpace, this.option.nodeSpace, 'left'), + n.finishY - i); + return this.shiftLeftTreeNode(n.leftSubNodes, e), (n.finishY = i), (this.idMapNode[t.id] = n); + }), + (Kl.prototype.splitSubTree = function (t) { + var n = Math.ceil(t.length / 2), + i = [], + r = []; + return ( + 'lcr' == this.option.type + ? t.forEach(function (t, e) { + (e < n ? i : r).push(t); + }) + : 'lr' == this.option.type + ? t.forEach(function (t, e) { + i.push(t); + }) + : 'rl' == this.option.type && + t.forEach(function (t, e) { + r.push(t); + }), + { leftNodes: r, rightNodes: i } + ); + }), + (Kl.prototype.buildVirtualSubNode = function (t, i) { + var r = this, + o = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 'right', + a = this; + (t.children || []).forEach(function (t, e) { + var n = { id: t.id, label: t.name, leftSubNodes: [], rightSubNodes: [], maxChildW: 0 }; + (n.directType = o), + (n.width = r.getTextWidth(n)), + ('right' == o ? i.rightSubNodes : i.leftSubNodes).push(n), + (a.idMapNode[n.id] = n), + a.buildVirtualSubNode(t, n, o); + }); + }), + (Kl.prototype.drawLine = function (n) { + var i = this; + n.leftSubNodes.concat(n.rightSubNodes).forEach(function (e, t) { + i.graphVis.links.filter(function (t) { + return t.source.id == n.id && t.target.id == e.id; + })[0] || i.graphVis.addEdge({ source: n.id, target: e.id }), + i.drawLine(e); + }); + }), + (Kl.prototype.shiftLeftTreeNode = function (t, e) { + var n = this; + t.forEach(function (t) { + (t.finishY = t.finishY - e), n.shiftLeftTreeNode(t.leftSubNodes || [], e); + }); + }), + (Kl.prototype.getTextWidth = function (n) { + var t = this.graphVis.customStyle(function (t) { + t.save(), (t.font = n.font); + var e = t.measureText(n.label).width; + return t.restore(), e; + }), + t = Math.ceil(t) + this.option.nodePadding; + return Math.max(t, this.option.maxWidth); + }), + (Kl.prototype.layout = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 140, + n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 10, + i = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 'right', + r = 0, + o = 1 / 0, + a = -1 / 0, + s = 'right' == i ? t.rightSubNodes : t.leftSubNodes; + t.cheight = t.height; + for (var h = s.length, c = 0; c < h; c++) { + var u = s[c]; + (u.finishX = 'right' == i ? t.finishX + t.width + e : t.finishX - e - u.width), + (u.finishY = t.finishY + r), + this.layout(u, e, n, i), + u.width > t.maxChildW && (t.maxChildW = u.width), + (t.cheight += u.cheight + n), + (r += u.cheight + n), + (o = Math.min(o, u.finishY)), + (a = Math.max(a, u.finishY)); + } + 0 < s.length && (t.finishY = o + Math.abs(a - o) / 2); + }), + (Kl.prototype.deepFindChildNode = function (t, e) { + var n = this, + t = (t.outLinks || []).map(function (t) { + return t.target; + }); + t.forEach(function (t) { + e.push(t); + }), + t.forEach(function (t) { + t.contract || n.deepFindChildNode(t, e); + }); + }), + (Kl.prototype.contractChild = function (t) { + var e = this, + n = []; + e.deepFindChildNode(t, n), + e.option.animate + ? (n.forEach(function (t) { + (t.inLinks || []).forEach(function (t) { + t.visible = !1; + }); + }), + e.graphVis + .createBaseAnimate({ + targets: n, + x: t.x, + y: t.y, + alpha: 0, + duration: 600, + easing: 'easeInQuad', + begin: function (t) { + e.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + e.graphVis.deleteNodes(n), + e.removeChild(e.treeData, t.id), + e.reloadLayout(e.treeData, !1), + e.graphVis.switchAnimate(!1); + })) + : (e.graphVis.deleteNodes(n), e.removeChild(e.treeData, t.id), e.reloadLayout(e.treeData, !1)); + }), + (Kl.prototype.expendChild = function (e, t) { + var n, + i = this; + i.appendChild(i.treeData, e.id, t), + i.reloadLayout(i.treeData, !0), + i.option.animate && + ((n = []), + i.deepFindChildNode(e, n), + n.forEach(function (t) { + (t.x = e.x), + (t.y = e.y), + (t.alpha = 0), + (t.inLinks || []).forEach(function (t) { + t.visible = !1; + }); + }), + i.graphVis + .createBaseAnimate({ + targets: n, + x: function (t) { + return i.idMapNode[t.id].finishX; + }, + cy: function (t) { + return i.idMapNode[t.id].finishY; + }, + alpha: 1, + duration: 600, + easing: 'easeOutQuad', + begin: function (t) { + i.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + n.forEach(function (t) { + (t.inLinks || []).forEach(function (t) { + t.visible = !0; + }); + }), + i.graphVis.switchAnimate(!1); + })); + }), + (Kl.prototype.removeChild = function (t, n) { + var i = this; + t.id === n + ? ((i.idMapChildNode[t.id] = t.children), (t.children = null)) + : (t.children || []).forEach(function (t, e) { + i.removeChild(t, n); + }); + }), + (Kl.prototype.appendChild = function (t, n, i) { + var r = this; + t.id === n + ? ((t.children = i || []), (r.newChildren = t.children)) + : (t.children || []).forEach(function (t, e) { + r.appendChild(t, n, i); + }); + }), + ($l.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.update(); + }), + ($l.prototype.update = function () { + this.graphVis.clearAll(), this.drawSankey(this.snakeyData), this.graphVis.zoomFit(); + }), + ($l.prototype.regiestLineShape = function () { + this.graphVis.definedLinkPaintFunc(function (t, e) { + var n, + i, + r = this.source.x + this.source.dx, + o = this.target.x, + a = + ((n = +r), + (i = +o), + function (t) { + return n * (1 - t) + i * t; + }), + s = a(0.5), + a = a(0.5), + h = this.source.y + this.sy + this.dy / 2, + c = this.target.y + this.ty + this.dy / 2; + (this.lineType = 'hbezier'), + (this.pathDefine = 'M ' + .concat(r, ' ') + .concat(h, ' C ') + .concat(s, ' ') + .concat(h, ' ') + .concat(a, ' ') + .concat(c, ' ') + .concat(o, ' ') + .concat(c)), + (this.path = []), + (this.bezierPoints = [r, h, s, h, a, c, o, c]), + this.setLineStyle(t), + (t.lineCap = 'butt'), + t.stroke(new Path2D(this.pathDefine)); + }); + }), + ($l.prototype.drawSankey = function (t) { + var e = Math.round(0.9 * this.graphVis.stage.width), + n = Math.round(0.9 * this.graphVis.stage.height), + e = new Zl() + .nodeId(function (t) { + return t.id; + }) + .nodeAlign(this.option.alignType) + .nodeWidth(this.option.nodeWidth) + .nodePadding(this.option.nodePadding) + .size([e, n])(t), + i = this.option.dragable, + r = [], + o = 1 / 0, + a = -1 / 0, + s = + (e.nodes.forEach(function (t, e) { + (o = Math.min(t.x, o)), (a = Math.max(t.x, a)); + }), + Math.round((o + a) / 2)), + h = this.option.nodeColor, + c = this, + u = + (e.nodes.forEach(function (t, e) { + var n = { + x: t.x, + y: t.y, + height: t.dy, + width: t.dx, + shape: 'rect', + dx: t.dx, + dragable: i, + textOffsetX: t.x < s ? 5 : -5, + textPosition: t.x < s ? 'Middle_Right' : 'Middle_Left', + }; + 'random' == h + ? (n.fillColor = c.graphVis.randomColor()) + : t.style && t.style.fillColor && (n.fillColor = t.style.fillColor), + r.push({ + id: t.id || '10000' + e, + label: t.label || t.id, + type: t.type || 'default', + style: n, + properties: t.properties, + }); + }), + this.option.lineColor), + l = this.option.lineAlpha, + d = ['both', 'source', 'target'].includes(u), + f = []; + e.links.forEach(function (t, e) { + var n = { sy: t.sy, ty: t.ty, dy: t.dy, lineWidth: Math.max(t.width, 1), alpha: l }; + d ? (n.colorType = u) : t.style && t.style.strokeColor && (n.strokeColor = t.style.strokeColor), + t.source && + t.target && + f.push({ + id: t.id || 'link-'.concat(e), + source: t.source.id, + target: t.target.id, + label: t.value, + type: t.type || 'default', + style: n, + properties: t.properties, + }); + }), + this.regiestLineShape(), + this.graphVis.addGraph({ nodes: r, links: f }), + this.graphVis.zoomFit(); + }), + ($l.prototype.deepExtend = function (t, e, n, i) { + for (var r in e) + if (e.hasOwnProperty(r) || !0 === n) + if (e[r] && e[r].constructor === Object) + void 0 === t[r] && (t[r] = {}), + t[r].constructor === Object + ? this.deepExtend(t[r], e[r], n) + : null === e[r] && void 0 !== t[r] && !0 === i + ? delete t[r] + : (t[r] = e[r]); + else if (Array.isArray(e[r])) { + t[r] = []; + for (var o = 0; o < e[r].length; o++) t[r].push(e[r][o]); + } else null === e[r] && void 0 !== t[r] && !0 === i ? delete t[r] : (t[r] = e[r]); + return t; + }), + (td.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.update(); + var e = this.option.lineCurvature, + n = this.option.lineType; + this.graphVis.links.forEach(function (t) { + (t.curvature = e), (t.customLineType = n); + }), + this.graphVis.refreshView(); + }), + (td.prototype.update = function () { + var e, + t = this.raidalLayout(this.treeData), + n = this.graphVis.nodes, + i = new Map(), + r = + (n.forEach(function (t) { + i.set(t.id, t); + }), + this.option.animate); + t.forEach(function (t) { + var e = t.data.id, + e = i.get(e); + e && + ((t = t.data.style), + (e.rotate = t.rotate), + (e.textPosition = t.textPosition), + (e.textOffsetX = t.textOffsetX), + (e.rawX = t.rawX), + (e.rawY = t.rawY), + (e.nodeDepth = t.nodeDepth), + r ? ((e.targetX = t.cx), (e.targetY = t.cy)) : ((e.cx = t.cx), (e.cy = t.cy))); + }), + r && + (e = this).graphVis + .createBaseAnimate({ + targets: n, + duration: 1500, + easing: 'easeInOutExpo', + cx: function (t) { + return t.targetX; + }, + cy: function (t) { + return t.targetY; + }, + begin: function (t) { + e.graphVis.switchAnimate(!0); + }, + }) + .finished.then(function () { + e.graphVis.switchAnimate(!1); + }); + }), + (td.prototype.init = function () { + this.graphVis.clearAll(), this.drawRadialTree(this.treeData); + }), + (td.prototype.regiestLineShape = function () { + var s = this; + this.graphVis.definedLinkPaintFunc(function (t) { + var e = this.source.rawX, + n = this.source.rawY, + i = this.target.rawX, + r = this.target.rawY, + o = s.radialCoordinate(e, n + (r - n) * this.curvature), + a = s.radialCoordinate(i, r + (n - r) * this.curvature); + switch (this.customLineType) { + case 'polygonal': + (this.lineType = 'straight'), + (this.path = [ + { x: this.source.cx, y: this.source.cy }, + { x: a.x, y: a.y }, + { x: this.target.cx, y: this.target.cy }, + ]), + (this.pathDefine = 'M' + .concat(this.source.cx, ' ') + .concat(this.source.cy, ' L') + .concat(a.x, ' ') + .concat(a.y, ' ') + .concat(this.target.cx, ' ') + .concat(this.target.cy)); + break; + case 'fold': + (this.lineType = 'straight'), + (this.path = [ + { x: this.source.cx, y: this.source.cy }, + { x: o.x, y: o.y }, + { x: this.target.cx, y: this.target.cy }, + ]), + (this.pathDefine = 'M' + .concat(this.source.cx, ' ') + .concat(this.source.cy, ' L') + .concat(o.x, ' ') + .concat(o.y, ' ') + .concat(this.target.cx, ' ') + .concat(this.target.cy)); + break; + case 'radial': + (this.lineType = 'bezier'), + (this.pathDefine = 'M ' + .concat(this.source.cx, ' ') + .concat(this.source.cy, ' C ') + .concat(o.x, ' ') + .concat(o.y, ' ') + .concat(a.x, ' ') + .concat(a.y, ' ') + .concat(this.target.cx, ' ') + .concat(this.target.cy)), + (this.path = []), + (this.bezierPoints = [this.source.cx, this.source.cy, o.x, o.y, a.x, a.y, this.target.cx, this.target.cy]); + break; + default: + (this.lineType = 'straight'), + (this.path = [ + { x: this.source.cx, y: this.source.cy }, + { x: this.target.cx, y: this.target.cy }, + ]), + (this.pathDefine = 'M' + .concat(this.source.cx, ' ') + .concat(this.source.cy, ' L') + .concat(this.target.cx, ' ') + .concat(this.target.cy)); + } + this.setLineStyle(t), t.stroke(new Path2D(this.pathDefine)); + }); + }), + (td.prototype.raidalLayout = function (t) { + var t = iu.hierarchy(t), + t = + (this.option.areaRadius || + (this.option.areaRadius = Math.max(Math.round(this.graphVis.getViewSize().width / 2), 150)), + ('tree' == this.option.arrangeType ? iu.tree() : iu.cluster()) + .size([2 * Math.PI, this.option.areaRadius]) + .separation(function (t, e) { + return (t.parent == e.parent ? 1 : 2) / t.depth; + })(t) + .descendants()), + s = this, + h = this.option.center[0], + c = new Set(); + return ( + t.forEach(function (t) { + var n = s.radialCoordinate(t.x, t.y), + i = 0, + r = 'Bottom_Center', + o = 0, + a = 0 < (t.children || []).length; + 0 < t.depth && + (o = + n.x >= h + ? ((i = (180 * t.x) / Math.PI - 90), (r = a ? 'Middle_Left' : 'Middle_Right'), a ? -2 : 2) + : ((i = (180 * t.x) / Math.PI + 90), (r = a ? 'Middle_Right' : 'Middle_Left'), a ? 2 : -2)), + c.add(t.depth), + (t.data.style = e( + e({}, t.data.style), + {}, + { cx: n.x, cy: n.y, textPosition: r, textOffsetX: o, rotate: i, rawX: t.x, rawY: t.y, nodeDepth: t.depth }, + )); + }), + (this.levels = Array.from(c)), + this.option.levelBack.show && this.drawBackGroundNodes(), + t + ); + }), + (td.prototype.drawBackGroundNodes = function () { + var t = this.levels.sort(function (t, e) { + return e - t; + }), + e = this.graphVis.randomColor(), + n = this.option.center, + i = this.option.areaRadius / 2, + r = this.option.levelBack.color, + o = this.option.levelBack.lineDash, + a = this.option.levelBack.alpha, + s = (this.graphVis.deleteNodes(this.levelBackNodes), []); + t.forEach(function (t) { + s.push({ + id: 'depyh-' + t, + style: { + mouseInteractive: !1, + showlabel: !1, + shape: 'circle', + size: t * i + i / 2, + cx: n[0], + cy: n[1], + alpha: a, + fillColor: r, + borderColor: r || e, + borderWidth: 2, + lineDash: o, + }, + }); + }), + (this.levelBackNodes = this.graphVis.addNodes(s)); + }), + (td.prototype.drawRadialTree = function (t) { + var s = this, + t = this.raidalLayout(t), + h = { nodes: [], links: [] }; + t.forEach(function (t, n) { + var i = t.data.id, + r = + (h.nodes.push({ + id: i, + label: t.data.name || ''.concat(i), + type: t.data.type || 'default', + style: e({}, t.data.style), + properties: e({}, t.data.properties), + }), + s.option.lineColor), + o = s.option.lineCurvature, + a = s.option.lineType; + (t.children || []).forEach(function (t) { + h.links.push({ + id: 'e-'.concat(i, '-').concat(t.data.id), + source: i, + target: t.data.id, + style: { colorType: r, customLineType: a, curvature: o }, + }); + }); + }), + -1 != ['radial', 'polygonal', 'fold'].indexOf(this.option.lineType) && this.regiestLineShape(), + this.graphVis.addGraph(h); + }), + (td.prototype.highLightParent = function (t) { + var e = this, + n = [t]; + e.findAllPreLevelNodes(t, n), + n.forEach(function (t) { + e.selectedElement(t), + (t.outLinks || []).forEach(function (t) { + -1 != n.indexOf(t.target) && e.selectedElement(t); + }); + }); + }), + (td.prototype.findAllPreLevelNodes = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + n = this; + (t.inLinks || []).forEach(function (t) { + e.push(t.source), n.findAllPreLevelNodes(t.source, e); + }); + }), + (td.prototype.selectedElement = function (t) { + this.graphVis.addToSelectedElements([t]); + }), + (td.prototype.radialCoordinate = function (t, e) { + return ( + (t -= Math.PI / 2), { x: e * Math.cos(t) + this.option.center[0], y: e * Math.sin(t) + this.option.center[1] } + ); + }), + (ed.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.update(); + }), + (ed.prototype.update = function () { + this.graphVis.clearAll(), this.drawComparctTree(this.treeData), this.graphVis.zoomFit(); + }), + (ed.prototype.regiestLineShape = function () { + var i = this.option.direction; + this.graphVis.definedLinkPaintFunc(function (t) { + var e = this.source, + n = this.target; + (this.path = []), + 'LR' == i || 'RL' == i + ? ((this.pathDefine = 'M' + .concat(n.cx, ' ') + .concat(n.cy, ' C') + .concat(e.cx, ' ') + .concat(n.cy, ' ') + .concat(e.cx, ' ') + .concat(e.cy, ' ') + .concat(e.cx, ' ') + .concat(e.cy)), + (this.bezierPoints = [n.cx, n.cy, e.cx, n.cy, e.cx, e.cy, e.cx, e.cy])) + : ((this.pathDefine = 'M' + .concat(e.cx, ' ') + .concat(e.cy, ' C') + .concat(n.cx, ' ') + .concat(e.cy, ' ') + .concat(n.cx, ' ') + .concat(n.cy, ' ') + .concat(n.cx, ' ') + .concat(n.cy)), + (this.bezierPoints = [e.cx, e.cy, n.cx, e.cy, n.cx, n.cy, n.cx, n.cy])), + (this.lineType = 'bezier'), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)); + }); + }), + (ed.prototype.drawComparctTree = function (t) { + var c = this, + u = this, + t = iu.hierarchy(t), + t = iu + .tree() + .nodeSize([u.option.nodeSize || 10, u.option.levelDistance || 150])(t) + .descendants(), + l = { nodes: [], links: [] }; + t.forEach(function (t) { + var n = u.adapterCoodi(t), + i = n.x, + r = n.y, + o = n.rotate, + a = n.textPosition, + n = n.textOffsetX, + s = (0 == t.depth && ((a = 'Bottom_Center'), (o = n = 0)), t.data.id), + h = + (l.nodes.push({ + id: s, + label: t.data.id || ''.concat(s), + style: e({ cx: i, cy: r, textPosition: a, textOffsetX: n, rotate: o }, t.data.style), + properties: e({}, t.data.properties), + }), + c.option.lineColor); + (t.children || []).forEach(function (t) { + l.links.push({ source: s, target: t.data.id, style: { colorType: h } }); + }); + }), + 'curve' == this.option.lineType && this.regiestLineShape(), + this.graphVis.addGraph(l); + }), + (ed.prototype.adapterCoodi = function (t) { + var e = 0, + n = 0, + i = 0, + r = 'Middle_Right', + o = 0, + a = 0 < (t.children || []).length; + switch (this.option.direction) { + case 'LR': + (e = t.y), (n = t.x), (i = 0), (r = a ? 'Middle_Left' : 'Middle_Right'), (o = a ? -2 : 2); + break; + case 'RL': + (e = -t.y), (n = t.x), (i = 0), (r = a ? 'Middle_Right' : 'Middle_Left'), (o = a ? 2 : -2); + break; + case 'TB': + (e = t.x), (n = t.y), (i = 90), (r = a ? 'Middle_Left' : 'Middle_Right'), (o = a ? -2 : 2); + break; + case 'BT': + (e = t.x), (n = -t.y), (i = -90), (r = a ? 'Middle_Left' : 'Middle_Right'), (o = a ? -2 : 2); + } + return { x: e, y: n, rotate: i, textPosition: r, textOffsetX: o }; + }), + (ed.prototype.highLightParent = function (t) { + var e = this, + n = [t]; + e.findAllPreLevelNodes(t, n), + n.forEach(function (t) { + e.selectedElement(t), + (t.outLinks || []).forEach(function (t) { + -1 != n.indexOf(t.target) && e.selectedElement(t); + }); + }); + }), + (ed.prototype.findAllPreLevelNodes = function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + n = this; + (t.inLinks || []).forEach(function (t) { + e.push(t.source), n.findAllPreLevelNodes(t.source, e); + }); + }), + (ed.prototype.selectedElement = function (t) { + this.graphVis.addToSelectedElements([t]); + }), + (nd.prototype.init = function () { + this.graphVis.clearAll(); + var t = this.packLayout(this.treeData); + this.graphVis.addNodes(t), this.graphVis.zoomFit(); + }), + (nd.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.init(); + }), + (nd.prototype.packLayout = function (t) { + var g = this, + n = this.graphVis.getViewSize(), + i = this.option.nodeSize, + t = iu + .hierarchy(t) + .sum(function (t) { + return t.children ? 0 : isNaN(t.value) ? 1 : t.value; + }) + .sort(function (t, e) { + return (isNaN(e.value) ? 1 : e.value) - (isNaN(t.value) ? 1 : t.value); + }), + n = iu + .pack() + .size([n.width - 10, n.height - 10]) + .padding(this.option.nodePadding), + n = + (i && + n.radius(function (t) { + return i; + }), + n(t)), + p = this.option.packThemeColor, + y = this.option.packAlpha, + v = this.option.borderDash, + t = []; + return ( + (function t(n, i, r) { + var o = n.children, + a = n.x, + s = n.y, + h = n.r, + c = n.data.id, + u = n.data.name, + l = n.data.type || 'default'; + if (o) { + var d = g.graphVis.randomColor(); + 0 < o.length && + r.push({ + id: c, + label: u, + type: l, + style: { + shape: 'circle', + x: a - h, + y: s - h, + radius: h, + dragable: !1, + fillColor: p, + alpha: y, + borderWidth: 1, + borderColor: d, + textPosition: 'Bottom_Center', + textOffsetY: -Math.round(h / 4), + font: 'normal '.concat(Math.max(Math.round(h / 5), 6), 'px YaHei'), + lineDash: v, + }, + properties: e({}, n.data.properties), + }); + for (var f = 0; f < o.length; f++) t(o[f], d, r); + } else + r.push({ + id: c, + label: u, + type: l, + style: e(e({ fillColor: i }, n.data.style), {}, { x: a - h, y: s - h, radius: h, dragable: !1 }), + properties: e({}, n.data.properties), + }); + })(n, this.graphVis.randomColor(), t), + t + ); + }), + (id.prototype.init = function () { + this.graphVis.clearAll(), this.regiestLineShape(); + var n, + i, + r, + t, + o, + a = this.treeData; + 'center' == this.option.alignType + ? ((t = a.children || []), + (n = Math.ceil(t.length / 2)), + (i = []), + (r = []), + t.forEach(function (t, e) { + (e < n ? r : i).push(t); + }), + (t = { id: a.id, name: a.name, style: e({}, a.style), children: r }), + (o = { id: a.id, children: i }), + this.layout(t, 'left'), + this.layout(o, 'right')) + : 'left' == this.option.alignType + ? this.layout(a, 'left') + : this.layout(a, 'right'), + this.graphVis.zoomFit(); + }), + (id.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.init(); + }), + (id.prototype.layout = function (t) { + var n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 'left', + i = 0, + r = iu + .hierarchy(t) + .eachBefore(function (t) { + return (t.index = i++); + }) + .descendants(), + o = 'right' == n ? -this.option.layerSpace : this.option.layerSpace, + a = this.option.nodePadding, + s = { nodes: [], links: [] }; + r.forEach(function (t) { + var n = t.data.id; + s.nodes.push({ + id: n, + label: t.data.name || n, + style: e( + e({}, t.data.style), + {}, + { + cx: t.depth * o, + cy: t.index * a, + textOffsetX: 0 == t.depth ? 0 : o < 0 ? -3 : 3, + textPosition: 0 == t.depth ? 'Top_Center' : o < 0 ? 'Middle_Left' : 'Middle_Right', + }, + ), + properties: e({}, t.data.properties), + }), + (t.children || []).forEach(function (t) { + s.links.push({ id: 'e-'.concat(n, '-').concat(t.data.id), source: n, target: t.data.id }); + }); + }), + this.graphVis.addGraph(s); + }), + (id.prototype.regiestLineShape = function () { + this.graphVis.definedLinkPaintFunc(function (t) { + var e = this.source, + n = this.target, + e = + ((this.lineType = 'straight'), + (this.path = [ + { x: e.cx, y: e.cy }, + { x: e.cx, y: n.cy }, + { x: n.cx, y: n.cy }, + ]), + 'M'.concat(e.cx, ' ').concat(e.cy, ' L').concat(e.cx, ' ').concat(n.cy, ' L').concat(n.cx, ' ').concat(n.cy)); + this.setLineStyle(t), t.stroke(new Path2D(e)); + }); + }); +var yd = { + bezierCurveToPolyline: pd, + getBezierCurveLength: function (t, e, n) { + return od(ud(pd(t, (e = void 0 === e ? 5 : e), (n = void 0 === n ? 0 : n)))); + }, + polylineToBezierCurve: function (u, l, d, f) { + if ((void 0 === l && (l = !1), void 0 === d && (d = 0.25), void 0 === f && (f = 0.25), !(u instanceof Array))) + throw new Error('polylineToBezierCurve: Invalid input of ' + u); + if (u.length <= 2) throw new Error('polylineToBezierCurve: The length of the polyline should be greater than 2'); + var t, + e, + n, + i = u[0], + r = u.length - 1, + r = new Array(r).fill(0).map(function (t, e) { + return rd( + ((i = d), + (r = f), + void 0 === (n = l) && (n = !1), + (c = u.length) < 3 || c <= e + ? null + : ((a = u[(a = (a = e - 1) < 0 ? (n ? c + a : 0) : a)]), + (s = u[e]), + (h = u[(h = c <= (h = e + 1) ? (n ? h - c : c - 1) : h)]), + (n = u[(o = c <= (o = e + 2) ? (n ? o - c : c - 1) : o)]), + [ + [s[0] + (i = void 0 === i ? 0.25 : i) * (h[0] - a[0]), s[1] + i * (h[1] - a[1])], + [h[0] - (r = void 0 === r ? 0.25 : r) * (n[0] - s[0]), h[1] - r * (n[1] - s[1])], + ])), + [u[e + 1]], + ); + var n, i, r, o, a, s, h, c; + }); + return ( + l && ((i = i), (e = (t = r)[0]), (n = t.slice(-1)[0]), t.push([vd(n[1], n[2]), vd(e[0], i), i])), + r.unshift(u[0]), + r + ); + }, + arcToBezier: function (t, e, n, i, r) { + var o = e + Math.cos(i) * t, + a = n + Math.sin(i) * t, + s = e + Math.cos(r) * t, + t = n + Math.sin(r) * t, + r = (4 * Math.tan((r - i) / 4)) / 3; + return { + x0: o, + y0: a, + x1: o - r * (a - n), + y1: a + r * (o - e), + x2: s + r * (t - n), + y2: t - r * (s - e), + x3: s, + y3: t, + }; + }, +}; +function md(t, e, n) { + (this.defaultOption = { type: 'cicular', radius: 300, nodePadding: 50, textAngle: 45 }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.graphVis = t), + (this.graphData = e), + this.init(); +} +function xd(t, e, n) { + (this.defaultOption = { + multigraph: !1, + rankdir: 'TB', + align: void 0, + nodesep: 50, + ranksep: 50, + edgesep: 10, + ranker: 'longest-path', + pathType: 'flod', + pathRoundRadius: 20, + }), + (this.option = x(this.defaultOption, n, !0, !0)), + (this.graphVis = t), + (this.graphData = e), + this.init(); +} +(md.prototype.init = function () { + this.graphVis.clearAll(), this.layout(), this.graphVis.zoomFit(); +}), + (md.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.init(); + }), + (md.prototype.layout = function () { + var t = { nodes: [], links: [] }; + 'linear' == this.option.type + ? ((t = this.genrateLinear(this.graphData)), this.regiestLinearLine()) + : ((t = this.genrateCicular(this.graphData)), this.regiestCicularLine()), + this.graphVis.addGraph(t); + }), + (md.prototype.genrateCicular = function (t) { + var h = this.graphVis.getViewCenter(), + c = this.option.radius, + n = (t.nodes || []).length, + u = (2 * Math.PI) / n, + l = []; + return ( + (t.nodes || []).forEach(function (t, n) { + var n = n * u, + i = 0, + r = 'Middle_Right', + o = 0, + a = c * Math.cos(n) + h.x, + s = c * Math.sin(n) + h.y, + o = + a >= h.x + ? ((i = (180 * n) / Math.PI), (r = 'Middle_Right'), 5) + : ((i = (180 * n) / Math.PI - 180), (r = 'Middle_Left'), -5); + l.push(e(e({}, t), {}, { style: { cx: a, cy: s, rotate: i, textPosition: r, textOffsetX: o, dragable: !1 } })); + }), + { nodes: l, links: t.links } + ); + }), + (md.prototype.genrateLinear = function (t) { + var i = this.graphVis.getViewSize().height - 20, + r = this.option.nodePadding, + o = this.option.textAngle, + a = []; + return ( + (t.nodes || []).forEach(function (t, n) { + n *= r; + a.push( + e( + e({}, t), + {}, + { style: { cx: n, cy: i, rotate: o, textPosition: 'Middle_Right', textOffsetX: 5, dragable: !1 } }, + ), + ); + }), + { nodes: a, links: t.links } + ); + }), + (md.prototype.regiestCicularLine = function () { + var a = this.graphVis.getViewCenter(); + this.graphVis.definedLinkPaintFunc(function (t) { + var e = this.source.cx, + n = this.source.cy, + i = this.target.cx, + r = this.target.cy, + o = { x: a.x, y: a.y }; + (this.path = []), + (this.quadraticPoints = [e, n, o.x, o.y, i, r]), + (this.pathDefine = 'M' + .concat(e, ' ') + .concat(n, ' Q') + .concat(o.x, ' ') + .concat(o.y, ' ') + .concat(i, ' ') + .concat(r)), + this.setLineStyle(t), + t.stroke(new Path2D(this.pathDefine)); + }); + }), + (md.prototype.regiestLinearLine = function () { + this.graphVis.definedLinkPaintFunc(function (t) { + var e = this.source.cx, + n = this.source.cy, + i = this.target.cx, + r = (this.target.cy, Math.abs(i - e) / 2), + e = yd.arcToBezier(r, { x: (e + i) / 2, y: -r }.x, n, Math.PI, 2 * Math.PI); + (this.path = []), + (this.bezierPoints = [e.x0, e.y0, e.x1, e.y1, e.x2, e.y2, e.x3, e.y3]), + t.beginPath(), + t.moveTo(e.x0, e.y0), + t.bezierCurveTo(e.x1, e.y1, e.x2, e.y2, e.x3, e.y3), + this.setLineStyle(t), + t.stroke(); + }); + }), + (xd.prototype.init = function () { + this.graphVis.clearAll(), this.layout(), this.graphVis.zoomFit(); + }), + (xd.prototype.resetOption = function (t) { + (this.option = x(this.option, t, !0, !0)), this.init(); + }), + (xd.prototype.layout = function () { + var i = new wh.graphlib.Graph().setGraph(this.option).setDefaultEdgeLabel(function () { + return {}; + }), + t = + ('flod' == this.option.pathType ? this.regiestFoldLine() : this.regiestRoundedPath(), + this.graphVis.addNodes(this.graphData.nodes), + this.graphVis.nodes || []), + n = new Map(), + r = + (t.forEach(function (t) { + n.set(''.concat(t.id), t), i.setNode(''.concat(t.id), { shape: t.shape, width: t.width, height: t.height }); + }), + new Map()), + t = + (this.graphData.links.forEach(function (t) { + r.set(''.concat(t.source, '-').concat(t.target), t), + i.setEdge(''.concat(t.source), ''.concat(t.target), { + label: t.label, + weight: isNaN(t.weight) ? 1 : t.weight, + }); + }), + wh.layout(i), + i.nodes().forEach(function (t) { + var e = i.node(t), + t = n.get(t); + t && ((t.cx = e.x), (t.cy = e.y)); + }), + i.edges().map(function (t) { + var n = i.edge(t), + t = r.get(''.concat(t.v, '-').concat(t.w)); + return (t.style = e(e({}, t.style), {}, { edgePoints: n.points })), t; + })); + this.graphVis.addEdges(t); + }), + (xd.prototype.regiestRoundedPath = function () { + var u = this.option.rankdir, + l = isNaN(this.option.pathRoundRadius) ? 10 : this.option.pathRoundRadius; + this.graphVis.definedLinkPaintFunc(function (t) { + (h = this.source.cx), + (c = this.source.cy), + (e = this.target.cx), + (n = this.target.cy), + (i = u), + (r = l), + (o = 'M'.concat(h, ' ').concat(c)), + (a = { x: h + (e - h) / 2, y: c }), + (s = { x: h + (e - h) / 2, y: n }), + c !== n && + (('TB' == i) | ('BT' == i) && ((a = { x: h, y: c + (n - c) / 2 }), (s = { x: e, y: c + (n - c) / 2 })), + (o = (o = o.concat('', zh(h, c, a.x, a.y, s.x, s.y, i, r))).concat('', zh(a.x, a.y, s.x, s.y, e, n, i, r)))); + var e, + n, + i, + r, + o, + a, + s, + h = { middlePoint1: a, middlePoint2: s, path: o.concat('', 'L'.concat(e, ' ').concat(n)) }, + c = h.path; + (this.path = [ + { x: this.source.cx, y: this.source.cy }, + h.middlePoint1, + h.middlePoint2, + { x: this.target.cx, y: this.target.cy }, + ]), + this.setLineStyle(t), + t.stroke(new Path2D(c)); + }); + }), + (xd.prototype.regiestFoldLine = function () { + this.graphVis.definedLinkPaintFunc(function (t) { + this.path = this.edgePoints || [ + { x: this.source.cx, y: this.source.cy }, + { x: this.target.cx, y: this.target.cy }, + ]; + var e, + n, + i, + r, + o = this.path.length, + o = { x: this.path[o - 2].x, y: this.path[o - 2].y }, + a = { x: this.target.cx, y: this.target.cy }, + s = a, + h = a; + this.showArrow && + ((e = Math.atan2(o.y - a.y, o.x - a.x)), + null == + (s = + 'rect' == this.target.shape + ? this.findInsertPoint(this.target, { cx: o.x, cy: o.y }) + : ((i = (this.target.radius + this.target.borderWidth / 2) * this.target.scale), + (n = a.y), + (r = e), + { x: a.x + (i = i) * Math.cos(r), y: n + i * Math.sin(r) })) && (s = a), + (n = this.getArrowRadius()), + (h.x = s.x + n * Math.cos(e)), + (h.y = s.y + n * Math.sin(e))), + t.beginPath(), + t.moveTo(this.source.cx, this.source.cy); + for (var c = 1; c < this.path.length - 1; c++) t.lineTo(this.path[c].x, this.path[c].y); + t.lineTo(h.x, h.y), + this.setLineStyle(t), + t.stroke(), + this.showArrow && this.paintSpecialArrow(t, { x: o.x, y: o.y }, s); + }); + }); +var wd = function (t) { + return t.id || t.name; + }, + bd = function (t) { + return t.hgap || 18; + }, + kd = function (t) { + return t.vgap || 18; + }, + Md = function (t) { + return t.children; + }, + Ed = function (t) { + return t.height || 36; + }, + Cd = function (t) { + var e = t.name || ' '; + return t.width || 18 * e.split('').length; + }; +function Nd(t, e, n) { + return (t || e)(n); +} +var _d = (function () { + function f(t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, + n = 2 < arguments.length ? arguments[2] : void 0, + r = (i(this, f), this); + if (((r.vgap = r.hgap = 0), t instanceof f)) return t; + var o = Nd(e.getHGap, bd, t), + a = Nd(e.getVGap, kd, t); + if ( + ((r.data = t), + (r.width = Nd(e.getWidth, Cd, t)), + (r.height = Nd(e.getHeight, Ed, t)), + (r.id = Nd(e.getId, wd, t)), + (r.x = r.y = 0), + (r.depth = 0), + !n && !t.isCollapsed) + ) + for (var s, h = [r]; (s = h.pop()); ) + if (!s.data.isCollapsed) { + var c = Nd(e.getChildren, Md, s.data), + u = c ? c.length : 0; + if (((s.children = []), c && u)) + for (var l = 0; l < u; l++) { + var d = new f(c[l], e); + s.children.push(d), h.push(d), (d.parent = s), (d.depth = s.depth + 1); + } + } + r.children || (r.children = []), r.addGap(o, a); + } + return ( + a(f, [ + { + key: 'isRoot', + value: function () { + return 0 === this.depth; + }, + }, + { + key: 'addGap', + value: function (t, e) { + (this.hgap += t), (this.vgap += e), (this.width += 2 * t), (this.height += 2 * e); + }, + }, + { + key: 'eachNode', + value: function (t) { + for (var e, n = [this]; (e = n.pop()); ) t(e), (n = n.concat(e.children)); + }, + }, + { + key: 'getBoundingBox', + value: function () { + var e = { left: Number.MAX_VALUE, top: Number.MAX_VALUE, width: 0, height: 0 }; + return ( + this.eachNode(function (t) { + (e.left = Math.min(e.left, t.x)), + (e.top = Math.min(e.top, t.y)), + (e.width = Math.max(e.width, t.x + t.width)), + (e.height = Math.max(e.height, t.y + t.height)); + }), + e + ); + }, + }, + { + key: 'translate', + value: function () { + var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0, + n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0; + this.eachNode(function (t) { + (t.x += e), (t.y += n); + }); + }, + }, + { + key: 'right2left', + value: function () { + var e = this.getBoundingBox(); + this.eachNode(function (t) { + t.x = t.x - 2 * (t.x - e.left) - t.width; + }), + this.translate(e.width, 0); + }, + }, + { + key: 'down2up', + value: function () { + var e = this.getBoundingBox(); + this.eachNode(function (t) { + t.y = t.y - 2 * (t.y - e.top) - t.height; + }), + this.translate(0, e.height); + }, + }, + ]), + f + ); + })(), + Ld = (function () { + function r(t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, + n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : []; + i(this, r); + (this.root = new _d(t, e)), (this.options = e), (this.extraEdges = n); + } + return ( + a(r, [ + { + key: 'doLayout', + value: function () { + throw new Error('please override this method'); + }, + }, + { + key: 'getNodes', + value: function () { + var t = this.root, + e = [], + n = {}; + return ( + t.eachNode(function (t) { + (n[t.depth] = n[t.depth] || 0), + n[t.depth]++, + e.push({ + data: t.data, + id: t.id, + x: t.x, + y: t.y, + centX: t.x + t.width / 2, + centY: t.y + t.height / 2, + hgap: t.hgap, + vgap: t.vgap, + height: t.height, + width: t.width, + actualHeight: t.height - 2 * t.vgap, + actualWidth: t.width - 2 * t.hgap, + depth: t.depth, + }); + }), + e + ); + }, + }, + { + key: 'getEdges', + value: function () { + var t = this.extraEdges, + e = this.root, + n = []; + return ( + e.eachNode(function (e) { + e.children.forEach(function (t) { + n.push({ source: e.id, target: t.id }); + }); + }), + n.concat(t), + n + ); + }, + }, + ]), + r + ); + })(), + Sd = a(function t(e, n, r) { + var o = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : []; + i(this, t), + s(this, 'w', 0), + s(this, 'h', 0), + s(this, 'x', 0), + s(this, 'y', 0), + s(this, 'prelim', 0), + s(this, 'mod', 0), + s(this, 'shift', 0), + s(this, 'change', 0), + s(this, 'tl', null), + s(this, 'tr', null), + s(this, 'el', null), + s(this, 'er', null), + s(this, 'msel', 0), + s(this, 'mser', 0), + s(this, 'c', []), + s(this, 'cs', 0), + (this.w = e), + (this.h = n), + (this.y = r), + (this.c = o), + (this.cs = o.length); + }); +function Td(t, e) { + !(function e(t, n, i) { + i ? (t.y += n) : (t.x += n), + t.children.forEach(function (t) { + e(t, n, i); + }); + })( + t, + -(function e(t, n) { + var i = n ? t.y : t.x; + return ( + t.children.forEach(function (t) { + i = Math.min(e(t, n), i); + }), + i + ); + })(t, e), + e, + ); +} +Sd.fromNode = function (t, e) { + var n; + return t + ? ((n = []), + t.children.forEach(function (t) { + n.push(Sd.fromNode(t, e)); + }), + e ? new Sd(t.height, t.width, t.x, n) : new Sd(t.width, t.height, t.y, n)) + : null; +}; +var Pd = function (t, e) { + function M(t) { + 0 === t.cs + ? (((t.el = t).er = t).msel = t.mser = 0) + : ((t.el = t.c[0].el), (t.msel = t.c[0].msel), (t.er = t.c[t.cs - 1].er), (t.mser = t.c[t.cs - 1].mser)); + } + function E(t) { + return t.y + t.h; + } + function C(t, e, n) { + for (; null !== n && t >= n.low; ) n = n.nxt; + return { low: t, index: e, nxt: n }; + } + !(function e(t, n) { + var i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0; + n ? ((t.x = i), (i += t.width)) : ((t.y = i), (i += t.height)), + t.children.forEach(function (t) { + e(t, n, i); + }); + })(t, e); + var n = Sd.fromNode(t, e); + return ( + (function t(e) { + if (0 !== e.cs) { + t(e.c[0]); + for (var n = C(E(e.c[0].el), 0, null), i = 1; i < e.cs; ++i) { + t(e.c[i]); + for ( + var r, + o, + a, + s, + h, + c = E(e.c[i].er), + u = ((h = r = o = a = s = v = k = b = w = x = m = y = p = g = f = d = l = u = void 0), e), + l = i, + d = n, + f = u.c[l - 1], + g = f.mod, + p = u.c[l], + y = p.mod; + null != f && null != p; + + ) { + E(f) > d.low && (d = d.nxt); + var v, + m = g + f.prelim + f.w - (y + p.prelim); + if (0 < m) { + y += m; + { + x = void 0; + w = void 0; + b = void 0; + k = void 0; + v = void 0; + var x = u; + var w = l; + var b = d.index; + var k = m; + (x.c[w].mod += k), (x.c[w].msel += k), (x.c[w].mser += k); + b !== w - 1 && + ((v = w - b), (x.c[b + 1].shift += k / v), (x.c[w].shift -= k / v), (x.c[w].change -= k - k / v)); + } + } + (m = E(f)), (b = E(p)); + m <= b && null != (f = 0 === (x = f).cs ? x.tr : x.c[x.cs - 1]) && (g += f.mod), + b <= m && null != (p = 0 === (w = p).cs ? w.tl : w.c[0]) && (y += p.mod); + } + !f && p + ? ((o = l), + (a = p), + (s = y), + (h = (r = u).c[0].el), + (s = s - (h.tl = a).mod - r.c[0].msel), + (h.mod += s), + (h.prelim -= s), + (r.c[0].el = r.c[o].el), + (r.c[0].msel = r.c[o].msel)) + : f && + !p && + ((a = l), + (h = f), + (s = g), + (o = (r = u).c[a].er), + (s = s - (o.tr = h).mod - r.c[a].mser), + (o.mod += s), + (o.prelim -= s), + (r.c[a].er = r.c[a - 1].er), + (r.c[a].mser = r.c[a - 1].mser)), + (n = C(c, i, n)); + } + e.prelim = + (e.c[0].prelim + e.c[0].mod + e.c[e.cs - 1].mod + e.c[e.cs - 1].prelim + e.c[e.cs - 1].w) / 2 - e.w / 2; + } + M(e); + })(n), + (function t(e, n) { + (n += e.mod), (e.x = e.prelim + n); + for (var i = e, r = 0, o = 0, a = 0; a < i.cs; a++) + (o += (r += i.c[a].shift) + i.c[a].change), (i.c[a].mod += o); + for (var s = 0; s < e.cs; s++) t(e.c[s], n); + })(n, 0), + (function n(t, i, r) { + r ? (i.y = t.x) : (i.x = t.x), + t.c.forEach(function (t, e) { + n(t, i.children[e], r); + }); + })(n, t, e), + Td(t, e), + t + ); + }, + Ad = (function () { + h(e, Ld); + var t = d(e); + function e() { + return i(this, e), t.apply(this, arguments); + } + return ( + a(e, [ + { + key: 'doLayout', + value: function () { + var t = this.root; + return Pd(t, !0); + }, + }, + ]), + e + ); + })(), + Od = (function () { + h(e, Ld); + var t = d(e); + function e() { + return i(this, e), t.apply(this, arguments); + } + return ( + a(e, [ + { + key: 'doLayout', + value: function () { + var t = this.root; + return Pd(t, !1); + }, + }, + ]), + e + ); + })(), + Id = (function () { + h(e, Ld); + var t = d(e); + function e() { + return i(this, e), t.apply(this, arguments); + } + return ( + a(e, [ + { + key: 'doLayout', + value: function () { + var t = this.root; + return Pd(t, !1), t.down2up(), t; + }, + }, + ]), + e + ); + })(), + Dd = (function () { + h(e, Ld); + var t = d(e); + function e() { + return i(this, e), t.apply(this, arguments); + } + return ( + a(e, [ + { + key: 'doLayout', + value: function () { + var t = this.root; + return Pd(t, !0), t.right2left(), t; + }, + }, + ]), + e + ); + })(), + Bd = (function () { + h(e, Ld); + var t = d(e); + function e() { + return i(this, e), t.apply(this, arguments); + } + return ( + a(e, [ + { + key: 'doLayout', + value: function () { + for ( + var t = this.root, + e = this.options, + n = new _d(t.data, e, !0), + i = new _d(t.data, e, !0), + r = t.children.length, + o = Math.round(r / 2), + a = 0; + a < r; + a++ + ) { + var s = t.children[a]; + (a < o ? i : n).children.push(s); + } + Pd(i, !0), Pd(n, !0), n.right2left(), i.translate(n.x - i.x, n.y - i.y), (t.x = n.x), (t.y = i.y); + e = t.getBoundingBox(); + return e.top < 0 && t.translate(0, -e.top), t; + }, + }, + ]), + e + ); + })(), + Rd = (function () { + function n(t, e) { + i(this, n), s(this, 'type', 'standard'), s(this, 'options', {}), (this.type = t), (this.options = e); + } + return ( + a(n, [ + { + key: 'layout', + value: function (t) { + var e = null; + switch (this.type) { + case 'down': + e = new Od(t, this.options); + break; + case 'up': + e = new Id(t, this.options); + break; + case 'right': + e = new Ad(t, this.options); + break; + case 'left': + e = new Dd(t, this.options); + break; + default: + e = new Bd(t, this.options); + } + return e.doLayout(); + }, + }, + ]), + n + ); + })(), + zd = (function () { + function t() { + i(this, t); + } + return ( + a(t, [ + { + key: 'forceSimulation', + value: function (h) { + var a, + s = 1, + e = 0.001, + c = 1 - Math.pow(e, 1 / 300), + u = 0, + l = 0.6, + d = {}, + t = this.timer(o), + n = this.dispatch('tick', 'end'), + i = this.lcg(), + r = 0; + function o() { + g(), n.call('tick', a), s < e && (t.stop(), n.call('end', a)); + } + function f(t) { + for (var e in d) t(d[e]); + } + function g(t) { + var e, + n, + i = h.length; + void 0 === t && (t = 1); + for (var r = 0; r < t; ++r) { + for (var o in ((s += (u - s) * c), d)) d[o](s); + for (e = 0; e < i; ++e) + null == (n = h[e]).fx ? (n.x += n.vx *= l) : ((n.x = n.fx), (n.vx = 0)), + null == n.fy ? (n.y += n.vy *= l) : ((n.y = n.fy), (n.vy = 0)); + } + return a; + } + function p() { + for (var t, e, n, i = 0, r = h.length; i < r; ++i) + ((t = h[i]).index = i), + null != t.fx && (t.x = t.fx), + null != t.fy && (t.y = t.fy), + (isNaN(t.x) || isNaN(t.y)) && + ((e = initialRadius * Math.sqrt(0.5 + i)), + (n = i * initialAngle), + (t.x = e * Math.cos(n)), + (t.y = e * Math.sin(n))), + (isNaN(t.vx) || isNaN(t.vy)) && (t.vx = t.vy = 0); + } + function y(t) { + return t.initialize && t.initialize(h, i), t; + } + return ( + null == h && (h = []), + p(), + (a = { + tick: g, + restart: function () { + return t.restart(o), a; + }, + stop: function () { + return t.stop(), a; + }, + nodes: function (t) { + return arguments.length ? ((h = t), p(), f(y), a) : h; + }, + alpha: function (t) { + return arguments.length ? ((s = +t), a) : s; + }, + alphaMin: function (t) { + return arguments.length ? ((e = +t), a) : e; + }, + alphaDecay: function (t) { + return arguments.length ? ((c = +t), a) : +c; + }, + alphaTarget: function (t) { + return arguments.length ? ((u = +t), a) : u; + }, + velocityDecay: function (t) { + return arguments.length ? ((l = 1 - t), a) : 1 - l; + }, + randomSource: function (t) { + return arguments.length ? ((i = t), f(y), a) : i; + }, + force: function (t, e) { + return 1 < arguments.length ? (null == e ? d.delete[t] : (d[t] = y(e)), a) : d[t]; + }, + find: function (t, e, n) { + var i, + r, + o, + a = 0, + s = h.length; + for (null == n ? (n = 1 / 0) : (n *= n), a = 0; a < s; ++a) + (i = (i = t - (r = h[a]).x) * i + (i = e - r.y) * i) < n && ((o = r), (n = i)); + return o; + }, + progress: function () { + return (r += 1 / Math.ceil(Math.log(this.alphaMin()) / Math.log(1 - this.alphaDecay()))); + }, + on: function (t, e) { + return 1 < arguments.length ? (n.on(t, e), a) : n.on(t); + }, + }) + ); + }, + }, + { + key: 'lcg', + value: function () { + var t = 1; + return function () { + return (t = (1664525 * t + 1013904223) % 4294967296) / 4294967296; + }; + }, + }, + { + key: 'jiggle', + value: function () { + return 1e-6 * (Math.random() - 0.5); + }, + }, + { + key: 'constant', + value: function (t) { + return function () { + return t; + }; + }, + }, + { + key: 'forceManyBody', + value: function () { + var r, + h, + c, + u, + l, + d = this, + i = d.constant(-30), + f = 1, + g = 1 / 0, + p = 0.81; + function o(t) { + return t.x; + } + function a(t) { + return t.y; + } + function e(t) { + var e, + n = r.length, + i = d.quadtree(r, o, a).visitAfter(s); + for (u = t, e = 0; e < n; ++e) (h = r[e]), i.visit(y); + } + function n() { + if (r) { + var t, + e, + n = r.length; + for (l = new Array(n), t = 0; t < n; ++t) (e = r[t]), (l[e.index] = +i(e, t, r)); + } + } + function s(t) { + var e, + n, + i, + r, + o, + a = 0, + s = 0; + if (t.length) { + for (i = r = o = 0; o < 4; ++o) + (e = t[o]) && (n = Math.abs(e.value)) && ((a += e.value), (s += n), (i += n * e.x), (r += n * e.y)); + (t.x = i / s), (t.y = r / s); + } else for ((e = t).x = e.data.x, e.y = e.data.y; (a += l[e.data.index]), (e = e.next); ); + t.value = a; + } + function y(t, e, n, i) { + if (!t.value) return !0; + var r = t.x - h.x, + o = t.y - h.y, + a = i - e, + s = r * r + o * o; + if ((a * a) / p < s) + return ( + s < g && + (0 === r && (s += (r = d.jiggle(c)) * r), + 0 === o && (s += (o = d.jiggle(c)) * o), + s < f && (s = Math.sqrt(f * s)), + (h.vx += (r * t.value * u) / s), + (h.vy += (o * t.value * u) / s)), + !0 + ); + if (!(t.length || g <= s)) + for ( + (t.data !== h || t.next) && + (0 === r && (s += (r = d.jiggle(c)) * r), 0 === o && (s += (o = d.jiggle(c)) * o), s < f) && + (s = Math.sqrt(f * s)); + t.data !== h && ((a = (l[t.data.index] * u) / s), (h.vx += r * a), (h.vy += o * a)), (t = t.next); + + ); + } + return ( + (e.initialize = function (t, e) { + (r = t), (c = e), n(); + }), + (e.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : d.constant(+t)), n(), e) : i; + }), + (e.distanceMin = function (t) { + return arguments.length ? ((f = t * t), e) : Math.sqrt(f); + }), + (e.distanceMax = function (t) { + return arguments.length ? ((g = t * t), e) : Math.sqrt(g); + }), + (e.theta = function (t) { + return arguments.length ? ((p = t * t), e) : Math.sqrt(p); + }), + e + ); + }, + }, + { + key: 'manyBodyReuse', + value: function () { + var i, + h, + c, + r, + o, + a, + u, + l = this, + s = 0, + d = l.constant(-30), + f = 1, + g = 1 / 0, + p = 0.81; + function y(t) { + return t.x; + } + function v(t) { + return t.y; + } + function o() { + return function (t) { + return t % 13 == 0; + }; + } + function e(t) { + var e, + n = i.length; + for ( + (r && !a(s, i)) || ((r = l.quadtree(i, y, v).visitAfter(m)), i.update.push(s)), c = t, e = 0; + e < n; + ++e + ) + (h = i[e]), r.visit(x); + ++s; + } + function n() { + if (i) { + (s = 0), (i.update = []), (a = o()), (r = null); + var t, + e, + n = i.length; + for (u = new Array(n), t = 0; t < n; ++t) (e = i[t]), (u[e.index] = +d(e, t, i)); + } + } + function m(t) { + var e, + n, + i, + r, + o, + a = 0, + s = 0; + if (t.length) { + for (i = r = o = 0; o < 4; ++o) + (e = t[o]) && (n = Math.abs(e.value)) && ((a += e.value), (s += n), (i += n * e.x), (r += n * e.y)); + (t.x = i / s), (t.y = r / s); + } else for ((e = t).x = e.data.x, e.y = e.data.y; (a += u[e.data.index]), (e = e.next); ); + t.value = a; + } + function x(t, e, n, i) { + if (!t.value) return !0; + var r = t.x - h.x, + o = t.y - h.y, + a = i - e, + s = r * r + o * o; + if ((a * a) / p < s) + return ( + s < g && + (0 === r && (s += (r = l.jiggle()) * r), + 0 === o && (s += (o = l.jiggle()) * o), + s < f && (s = Math.sqrt(f * s)), + (h.vx += (r * t.value * c) / s), + (h.vy += (o * t.value * c) / s)), + !0 + ); + if (!(t.length || g <= s)) + for ( + (t.data !== h || t.next) && + (0 === r && (s += (r = l.jiggle()) * r), 0 === o && (s += (o = l.jiggle()) * o), s < f) && + (s = Math.sqrt(f * s)); + t.data !== h && + ((s = (r = t.data.x - h.x) * r + (o = t.data.y - h.y) * o), + 0 === r && (s += (r = l.jiggle()) * r), + 0 === o && (s += (o = l.jiggle()) * o), + s < f && (s = Math.sqrt(f * s)), + (a = (u[t.data.index] * c) / s), + (h.vx += r * a), + (h.vy += o * a)), + (t = t.next); + + ); + } + return ( + (e.initialize = function (t) { + (i = t), n(); + }), + (e.strength = function (t) { + return arguments.length ? ((d = 'function' == typeof t ? t : l.constant(+t)), n(), e) : d; + }), + (e.distanceMin = function (t) { + return arguments.length ? ((f = t * t), e) : Math.sqrt(f); + }), + (e.distanceMax = function (t) { + return arguments.length ? ((g = t * t), e) : Math.sqrt(g); + }), + (e.theta = function (t) { + return arguments.length ? ((p = t * t), e) : Math.sqrt(p); + }), + (e.update = function (t) { + return arguments.length ? ((a = (o = t)()), e) : o; + }), + e + ); + }, + }, + { + key: 'manyBodySampled', + value: function () { + var v, + m, + x, + w, + b, + k, + M, + E, + e = this, + i = e.constant(-30), + C = 0, + T = 1, + N = 1 / 0, + r = function () { + return 15; + }, + o = function (t) { + return Math.pow(t.length, 0.75); + }, + a = function (t) { + return Math.pow(t.length, 0.25); + }, + s = function (t) { + return t.length < 100 ? 1 : t.length < 200 ? 3 : Math.sqrt(t.length); + }, + _ = Math.random; + function L(t) { + var e, + n, + i = Math.floor(_() * v.length), + r = v[i], + r = (t.x - r.x) * (t.x - r.x) + (t.y - r.y) * (t.y - r.y), + o = -1 / 0, + a = -1; + if (!(0 <= t.nearest.indexOf(i))) + if (t.nearest.length < b) t.nearest.push(i); + else { + for (; ++a < t.nearest.length; ) + (e = t.nearest[a]), + (e = v[e]), + (e = (t.x - e.x) * (t.x - e.x) - (t.y - e.y) * (t.y - e.y)) > o && ((n = a), (o = e)); + r < o && (t.nearest[n] = i); + } + } + function n(t) { + var e, + n, + i, + r, + o, + a = 0, + s = C, + h = v.length, + c = C + k; + for (m = t; a < h || s < c; ++a, ++s) { + if (s < c) { + u = void 0; + p = void 0; + g = void 0; + d = void 0; + l = void 0; + f = void 0; + var u = v[s % h]; + for ( + var l, + d, + f, + g = (function (t, e) { + e = Math.floor(e); + for (var n, i, r = v.length, o = r - e, a = r - 1; o <= a; --a) + (i = t[(n = Math.floor(_() * a))]), (t[n] = t[a]), (t[a] = i); + return t.slice(o); + })(w, M), + p = g.length - 1; + 0 <= p; + --p + ) + (d = v[g[p]]) === u || + (f = (l = d.x - u.x) * l + (d = d.y - u.y) * d) >= N || + (0 === l && (f += (l = 1e-6 * (_() - 0.5)) * l), + 0 === d && (f += (d = 1e-6 * (_() - 0.5)) * d), + f < T && (f = Math.sqrt(T * f)), + (f = (x[u.index] * m * E) / f), + (u.vx += l * f), + (u.vy += d * f)); + } + if (b && a < h) { + y = void 0; + e = void 0; + n = void 0; + r = void 0; + i = void 0; + o = void 0; + var y = v[a]; + if ((b && L(y), (n = y.nearest), b)) + for (e = n.length - 1; 0 <= e; --e) + (r = v[n[e]]) === y || + (o = (i = r.x - y.x) * i + (r = r.y - y.y) * r) >= N || + (0 === i && (o += (i = 1e-6 * (_() - 0.5)) * i), + 0 === r && (o += (r = 1e-6 * (_() - 0.5)) * r), + o < T && (o = Math.sqrt(T * o)), + (o = (x[y.index] * m * E) / o), + (y.vx += i * o), + (y.vy += r * o)); + } + } + C = c % h; + } + function h() { + if (v) { + var t, + e, + n = v.length; + for (w = new Array(n), t = 0; t < n; ++t) w[t] = t; + for ( + x = new Array(n), + b = (b = Math.min(Math.ceil(r()), n)) < 0 ? 0 : Math.min(b, v.length), + k = (k = Math.ceil(o(v))) < 0 ? 0 : Math.min(k, n), + M = (M = Math.ceil(a(v))) < 0 ? 0 : Math.min(M, n), + E = s(v), + m = 1, + t = 0; + t < n; + ++t + ) + for (e = v[t], x[e.index] = +i(e, t, v), e.nearest = []; e.nearest.length < b; ) L(e); + } + } + return ( + (n.initialize = function (t) { + (v = t), h(); + }), + (n.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), h(), n) : i; + }), + (n.distanceMin = function (t) { + return arguments.length ? ((T = t * t), n) : Math.sqrt(T); + }), + (n.distanceMax = function (t) { + return arguments.length ? ((N = t * t), n) : Math.sqrt(N); + }), + (n.neighborSize = function (t) { + return arguments.length ? ((r = 'function' == typeof t ? t : e.constant(+t)), h(), n) : r; + }), + (n.updateSize = function (t) { + return arguments.length ? ((o = 'function' == typeof t ? t : e.constant(+t)), h(), n) : o; + }), + (n.sampleSize = function (t) { + return arguments.length ? ((a = 'function' == typeof t ? t : e.constant(+t)), h(), n) : a; + }), + (n.chargeMultiplier = function (t) { + return arguments.length ? ((s = 'function' == typeof t ? t : e.constant(+t)), h(), n) : s; + }), + (n.source = function (t) { + return arguments.length ? ((_ = t), n) : _; + }), + n + ); + }, + }, + { + key: 'forceCollide', + value: function (i) { + var o, + a, + d, + f = this, + g = 1, + p = 1; + function e() { + for (var t, e, s, h, c, u, l, n = o.length, i = 0; i < p; ++i) + for (e = f.quadtree(o, y, v).visitAfter(m), t = 0; t < n; ++t) + (s = o[t]), (u = a[s.index]), (l = u * u), (h = s.x + s.vx), (c = s.y + s.vy), e.visit(r); + function r(t, e, n, i, r) { + var o = t.data, + t = t.r, + a = u + t; + if (!o) return h + a < e || i < h - a || c + a < n || r < c - a; + o.index > s.index && + (n = (e = h - o.x - o.vx) * e + (i = c - o.y - o.vy) * i) < a * a && + (0 === e && (n += (e = f.jiggle(d)) * e), + 0 === i && (n += (i = f.jiggle(d)) * i), + (n = ((a - (n = Math.sqrt(n))) / n) * g), + (s.vx += (e *= n) * (a = (t *= t) / (l + t))), + (s.vy += (i *= n) * a), + (o.vx -= e * (a = 1 - a)), + (o.vy -= i * a)); + } + } + function y(t) { + return t.x + t.vx; + } + function v(t) { + return t.y + t.vy; + } + function m(t) { + if (t.data) return (t.r = a[t.data.index]); + for (var e = (t.r = 0); e < 4; ++e) t[e] && t[e].r > t.r && (t.r = t[e].r); + } + function n() { + if (o) { + var t, + e, + n = o.length; + for (a = new Array(n), t = 0; t < n; ++t) (e = o[t]), (a[e.index] = +i(e, t, o)); + } + } + return ( + 'function' != typeof i && (i = f.constant(null == i ? 1 : +i)), + (e.initialize = function (t, e) { + (o = t), (d = e), n(); + }), + (e.iterations = function (t) { + return arguments.length ? ((p = +t), e) : p; + }), + (e.strength = function (t) { + return arguments.length ? ((g = +t), e) : g; + }), + (e.radius = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : f.constant(+t)), n(), e) : i; + }), + e + ); + }, + }, + { + key: 'forceCluster', + value: function () { + var n = [], + a = 0.4; + function e(t) { + var i = {}; + n.forEach(function (t) { + isNaN(t.x) && (t.x = 100 * Math.random()), isNaN(t.y) && (t.y = 100 * Math.random()); + var e = t.type || 'default', + n = i[e]; + null == n ? (i[e] = []) : (n.push(t), (i[e] = n)); + }); + var e, + r = {}; + for (e in i) + r[e] = (function (t) { + var e = 0, + n = 0, + i = 0, + r = Math.pow(5, 2); + return ( + t.forEach(function (t) { + (e += t.x * r), (n += t.y * r), (i += r); + }), + (e /= i), + (n /= i), + isNaN(e) && (e = 20 * Math.random()), + isNaN(n) && (n = 20 * Math.random()), + { x: e, y: n } + ); + })(i[e]); + var o = t * a; + n.forEach(function (t) { + var e = r[t.type || 'default'], + n = e.x, + e = e.y; + (t.vx -= (t.x - n) * o), (t.vy -= (t.y - e) * o); + }); + } + return ( + (e.initialize = function (t) { + return (n = t); + }), + (e.strength = function (t) { + return arguments.length ? ((a = +t), e) : a; + }), + e + ); + }, + }, + { + key: 'forceCenter', + value: function (o, a) { + var s, + h = 1; + function e() { + for (var t, e = s.length, n = 0, i = 0, r = 0; r < e; ++r) (n += (t = s[r]).x), (i += t.y); + for (n = (n / e - o) * h, i = (i / e - a) * h, r = 0; r < e; ++r) ((t = s[r]).x -= n), (t.y -= i); + } + return ( + null == o && (o = 0), + null == a && (a = 0), + (e.initialize = function (t) { + s = t; + }), + (e.x = function (t) { + return arguments.length ? ((o = +t), e) : o; + }), + (e.y = function (t) { + return arguments.length ? ((a = +t), e) : a; + }), + (e.strength = function (t) { + return arguments.length ? ((h = +t), e) : h; + }), + e + ); + }, + }, + { + key: 'forceLink', + value: function (c) { + var u, + l, + a, + s, + d, + f, + g = this, + h = function (t) { + return t.id; + }, + i = function (t) { + return 1 / Math.min(s[t.source.index], s[t.target.index]); + }, + r = g.constant(30), + p = 1; + function e(t) { + for (var e = 0, n = c.length; e < p; ++e) + for (var i, r, o, a, s, h = 0; h < n; ++h) + (i = (r = c[h]).source), + (o = (r = r.target).x + r.vx - i.x - i.vx || g.jiggle(f)), + (a = r.y + r.vy - i.y - i.vy || g.jiggle(f)), + (o *= s = (((s = Math.sqrt(o * o + a * a)) - l[h]) / s) * t * u[h]), + (a *= s), + (r.vx -= o * (s = d[h])), + (r.vy -= a * s), + (i.vx += o * (s = 1 - s)), + (i.vy += a * s); + } + function y() { + if (a) for (var t = 0, e = c.length; t < e; ++t) u[t] = +i(c[t], t, c); + } + function v() { + if (a) for (var t = 0, e = c.length; t < e; ++t) l[t] = +r(c[t], t, c); + } + function o() { + if (a) { + var t, + e, + i = a.length, + r = c.length, + o = {}; + for ( + a.forEach(function (t, e) { + return (o[h(t, e, a)] = t); + }), + t = 0, + s = new Array(i); + t < r; + ++t + ) + ((e = c[t]).index = t), + 'object' == n(e.source) + ? ((e.source = o[h(e.source)]), (e.target = o[h(e.target)])) + : ((e.source = o[e.source]), (e.target = o[e.target])), + (s[e.source.index] = (s[e.source.index] || 0) + 1), + (s[e.target.index] = (s[e.target.index] || 0) + 1); + for (t = 0, d = new Array(r); t < r; ++t) + (e = c[t]), (d[t] = s[e.source.index] / (s[e.source.index] + s[e.target.index])); + (u = new Array(r)), y(), (l = new Array(r)), v(); + } + } + return ( + null == c && (c = []), + (e.initialize = function (t, e) { + (a = t), (f = e), o(); + }), + (e.links = function (t) { + return arguments.length ? ((c = t), o(), e) : c; + }), + (e.id = function (t) { + return arguments.length ? ((h = t), e) : h; + }), + (e.iterations = function (t) { + return arguments.length ? ((p = +t), e) : p; + }), + (e.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : g.constant(+t)), y(), e) : i; + }), + (e.distance = function (t) { + return arguments.length ? ((r = 'function' == typeof t ? t : g.constant(+t)), v(), e) : r; + }), + e + ); + }, + }, + { + key: 'forceRadial', + value: function (n, s, h) { + var c, + u, + l, + e = this, + i = e.constant(0.1); + function r(t) { + for (var e = 0, n = c.length; e < n; ++e) { + var i = c[e], + r = i.x - s || 1e-6, + o = i.y - h || 1e-6, + a = Math.sqrt(r * r + o * o), + a = ((l[e] - a) * u[e] * t) / a; + (i.vx += r * a), (i.vy += o * a); + } + } + function o() { + if (c) { + var t, + e = c.length; + for (u = new Array(e), l = new Array(e), t = 0; t < e; ++t) + (l[t] = +n(c[t], t, c)), (u[t] = isNaN(l[t]) ? 0 : +i(c[t], t, c)); + } + } + return ( + 'function' != typeof n && (n = e.constant(+n)), + null == s && (s = 0), + null == h && (h = 0), + (r.initialize = function (t) { + (c = t), o(); + }), + (r.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), o(), r) : i; + }), + (r.radius = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : e.constant(+t)), o(), r) : n; + }), + (r.x = function (t) { + return arguments.length ? ((s = +t), r) : s; + }), + (r.y = function (t) { + return arguments.length ? ((h = +t), r) : h; + }), + r + ); + }, + }, + { + key: 'forceX', + value: function (n) { + var r, + o, + a, + e = this, + i = e.constant(0.1); + function s(t) { + for (var e, n = 0, i = r.length; n < i; ++n) (e = r[n]).vx += (a[n] - e.x) * o[n] * t; + } + function h() { + if (r) { + var t, + e = r.length; + for (o = new Array(e), a = new Array(e), t = 0; t < e; ++t) + o[t] = isNaN((a[t] = +n(r[t], t, r))) ? 0 : +i(r[t], t, r); + } + } + return ( + 'function' != typeof n && (n = e.constant(null == n ? 0 : +n)), + (s.initialize = function (t) { + (r = t), h(); + }), + (s.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), h(), s) : i; + }), + (s.x = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : e.constant(+t)), h(), s) : n; + }), + s + ); + }, + }, + { + key: 'forceY', + value: function (n) { + var r, + o, + a, + e = this, + i = e.constant(0.1); + function s(t) { + for (var e, n = 0, i = r.length; n < i; ++n) (e = r[n]).vy += (a[n] - e.y) * o[n] * t; + } + function h() { + if (r) { + var t, + e = r.length; + for (o = new Array(e), a = new Array(e), t = 0; t < e; ++t) + o[t] = isNaN((a[t] = +n(r[t], t, r))) ? 0 : +i(r[t], t, r); + } + } + return ( + 'function' != typeof n && (n = e.constant(null == n ? 0 : +n)), + (s.initialize = function (t) { + (r = t), h(); + }), + (s.strength = function (t) { + return arguments.length ? ((i = 'function' == typeof t ? t : e.constant(+t)), h(), s) : i; + }), + (s.y = function (t) { + return arguments.length ? ((n = 'function' == typeof t ? t : e.constant(+t)), h(), s) : n; + }), + s + ); + }, + }, + { + key: 'timer', + value: function (t, e, i) { + var a, + s, + h = 0, + c = 0, + r = 0, + u = 0, + l = 0, + d = 0, + f = Date, + o = + 'object' === ('undefined' == typeof window ? 'undefined' : n(window)) && window.requestAnimationFrame + ? window.requestAnimationFrame.bind(window) + : function (t) { + setTimeout(t, 17); + }; + function g() { + return l || (o(p), (l = f.now() + d)); + } + function p() { + l = 0; + } + function y() { + (l = (u = f.now()) + d), (h = c = 0); + try { + g(), ++h; + for (var t, e = a; e; ) 0 <= (t = l - e._time) && e._call.call(void 0, t), (e = e._next); + --h; + } finally { + for (var n, i, r = a, o = 1 / (h = 0); r; ) + r = r._call + ? (o > r._time && (o = r._time), (n = r)._next) + : ((i = r._next), (r._next = null), n ? (n._next = i) : (a = i)); + (s = n), m(o), (l = 0); + } + } + function v() { + var t = f.now(), + e = t - u; + 1e3 < e && ((d -= e), (u = t)); + } + function m(t) { + h || + ((c = c && clearTimeout(c)), + 24 < t - l + ? (t < 1 / 0 && (c = setTimeout(y, t - f.now() - d)), (r = r && clearInterval(r))) + : (r || ((u = f.now()), (r = setInterval(v, 1e3))), (h = 1), o(y))); + } + var x = new (function () { + (this._call = this._time = this._next = null), + (this.restart = function (t, e, n) { + if ('function' != typeof t) throw new TypeError('callback is not a function'); + (n = (null == n ? g() : +n) + (null == e ? 0 : +e)), + this._next || s === this || (s ? (s._next = this) : (a = this), (s = this)), + (this._call = t), + (this._time = n), + m(); + }), + (this.stop = function () { + this._call && ((this._call = null), (this._time = 1 / 0), m()); + }); + })(); + return x.restart(t, e, i), x; + }, + }, + { + key: 'dispatch', + value: function () { + var o = { value: function () {} }; + function i(t) { + this._ = t; + } + function h(t, e, n) { + for (var i = 0, r = t.length; i < r; ++i) + if (t[i].name === e) { + (t[i] = o), (t = t.slice(0, i).concat(t.slice(i + 1))); + break; + } + return null != n && t.push({ name: e, value: n }), t; + } + i.prototype = { + constructor: i, + on: function (t, e) { + var n, + i, + r = this._, + o = + ((i = r), + (t + '') + .trim() + .split(/^|\s+/) + .map(function (t) { + var e = '', + n = t.indexOf('.'); + if ((0 <= n && ((e = t.slice(n + 1)), (t = t.slice(0, n))), t && !i.hasOwnProperty(t))) + throw new Error('unknown type: ' + t); + return { type: t, name: e }; + })), + a = -1, + s = o.length; + if (!(arguments.length < 2)) { + if (null != e && 'function' != typeof e) throw new Error('invalid callback: ' + e); + for (; ++a < s; ) + if ((n = (t = o[a]).type)) r[n] = h(r[n], t.name, e); + else if (null == e) for (n in r) r[n] = h(r[n], t.name, null); + return this; + } + for (; ++a < s; ) + if ( + (n = + (n = (t = o[a]).type) && + (function (t, e) { + for (var n, i = 0, r = t.length; i < r; ++i) if ((n = t[i]).name === e) return n.value; + })(r[n], t.name)) + ) + return n; + }, + copy: function () { + var t, + e = {}, + n = this._; + for (t in n) e[t] = n[t].slice(); + return new i(e); + }, + call: function (t, e) { + if (0 < (n = arguments.length - 2)) + for (var n, i, r = new Array(n), o = 0; o < n; ++o) r[o] = arguments[o + 2]; + if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); + for (o = 0, n = (i = this._[t]).length; o < n; ++o) i[o].value.apply(e, r); + }, + apply: function (t, e, n) { + if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t); + for (var i = this._[t], r = 0, o = i.length; r < o; ++r) i[r].value.apply(e, n); + }, + }; + for (var t, e = 0, n = arguments.length, r = {}; e < n; ++e) { + if (!(t = arguments[e] + '') || t in r || /[\s.]/.test(t)) throw new Error('illegal type: ' + t); + r[t] = []; + } + return new i(r); + }, + }, + { + key: 'quadtree', + value: function (t, e, n) { + function l(t, e, n, i) { + if (!isNaN(e) && !isNaN(n)) { + var r, + o, + a, + s, + h, + c, + u, + l, + d, + f = t._root, + g = { data: i }, + p = t._x0, + y = t._y0, + v = t._x1, + m = t._y1; + if (f) { + for (; f.length; ) + if ( + ((c = e >= (o = (p + v) / 2)) ? (p = o) : (v = o), + (u = n >= (a = (y + m) / 2)) ? (y = a) : (m = a), + !(f = (r = f)[(l = (u << 1) | c)])) + ) + return (r[l] = g), t; + if (((s = +t._x.call(null, f.data)), (h = +t._y.call(null, f.data)), e === s && n === h)) + (g.next = f), r ? (r[l] = g) : (t._root = g); + else { + for ( + ; + (r = r ? (r[l] = new Array(4)) : (t._root = new Array(4))), + (c = e >= (o = (p + v) / 2)) ? (p = o) : (v = o), + (u = n >= (a = (y + m) / 2)) ? (y = a) : (m = a), + (l = (u << 1) | c) == (d = ((a <= h) << 1) | (o <= s)); + + ); + (r[d] = f), (r[l] = g); + } + } else t._root = g; + } + return t; + } + function v(t, e, n, i, r) { + (this.node = t), (this.x0 = e), (this.y0 = n), (this.x1 = i), (this.y1 = r); + } + function o(t, e, n, i, r, o) { + (this._x = t), + (this._y = e), + (this._x0 = n), + (this._y0 = i), + (this._x1 = r), + (this._y1 = o), + (this._root = void 0); + } + function a(t) { + for (var e = { data: t.data }, n = e; (t = t.next); ) n = n.next = { data: t.data }; + return e; + } + var i = o.prototype, + i = + ((i.copy = function () { + var t, + e, + n = new o(this._x, this._y, this._x0, this._y0, this._x1, this._y1), + i = this._root; + if (i) + if (i.length) + for (t = [{ source: i, target: (n._root = new Array(4)) }]; (i = t.pop()); ) + for (var r = 0; r < 4; ++r) + (e = i.source[r]) && + (e.length + ? t.push({ source: e, target: (i.target[r] = new Array(4)) }) + : (i.target[r] = a(e))); + else n._root = a(i); + return n; + }), + (i.add = function (t) { + var e = +this._x.call(null, t), + n = +this._y.call(null, t); + return l(this.cover(e, n), e, n, t); + }), + (i.addAll = function (t) { + for ( + var e, + n, + i = t.length, + r = new Array(i), + o = new Array(i), + a = 1 / 0, + s = 1 / 0, + h = -1 / 0, + c = -1 / 0, + u = 0; + u < i; + ++u + ) + isNaN((e = +this._x.call(null, (n = t[u])))) || + isNaN((n = +this._y.call(null, n))) || + ((r[u] = e) < a && (a = e), h < e && (h = e), (o[u] = n) < s && (s = n), c < n && (c = n)); + if (!(h < a || c < s)) + for (this.cover(a, s).cover(h, c), u = 0; u < i; ++u) l(this, r[u], o[u], t[u]); + return this; + }), + (i.cover = function (t, e) { + if (!isNaN((t = +t)) && !isNaN((e = +e))) { + var n = this._x0, + i = this._y0, + r = this._x1, + o = this._y1; + if (isNaN(n)) (r = (n = Math.floor(t)) + 1), (o = (i = Math.floor(e)) + 1); + else { + for (var a, s, h = r - n || 1, c = this._root; t < n || r <= t || e < i || o <= e; ) + switch (((s = ((e < i) << 1) | (t < n)), ((a = new Array(4))[s] = c), (c = a), (h *= 2), s)) { + case 0: + (r = n + h), (o = i + h); + break; + case 1: + (n = r - h), (o = i + h); + break; + case 2: + (r = n + h), (i = o - h); + break; + case 3: + (n = r - h), (i = o - h); + } + this._root && this._root.length && (this._root = c); + } + (this._x0 = n), (this._y0 = i), (this._x1 = r), (this._y1 = o); + } + return this; + }), + (i.data = function () { + var e = []; + return ( + this.visit(function (t) { + if (!t.length) for (; e.push(t.data), (t = t.next); ); + }), + e + ); + }), + (i.extent = function (t) { + return arguments.length + ? this.cover(+t[0][0], +t[0][1]).cover(+t[1][0], +t[1][1]) + : isNaN(this._x0) + ? void 0 + : [ + [this._x0, this._y0], + [this._x1, this._y1], + ]; + }), + (i.find = function (t, e, n) { + var i, + r, + o, + a, + s, + h, + c, + u, + l = this._x0, + d = this._y0, + f = this._x1, + g = this._y1, + p = [], + y = this._root; + for ( + y && p.push(new v(y, l, d, f, g)), + null == n ? (n = 1 / 0) : ((l = t - n), (d = e - n), (f = t + n), (g = e + n), (n *= n)); + (i = p.pop()); + + ) + !(y = i.node) || + (s = i.x0) > f || + (h = i.y0) > g || + (a = i.x1) < l || + (r = i.y1) < d || + (y.length + ? (p.push( + new v(y[3], (o = (s + a) / 2), (c = (h + r) / 2), a, r), + new v(y[2], s, c, o, r), + new v(y[1], o, h, a, c), + new v(y[0], s, h, o, c), + ), + (r = ((c <= e) << 1) | (o <= t)) && + ((i = p[p.length - 1]), (p[p.length - 1] = p[p.length - 1 - r]), (p[p.length - 1 - r] = i))) + : (h = (a = t - +this._x.call(null, y.data)) * a + (s = e - +this._y.call(null, y.data)) * s) < + n && + ((l = t - (c = Math.sqrt((n = h)))), (d = e - c), (f = t + c), (g = e + c), (u = y.data))); + return u; + }), + (i.remove = function (t) { + if (!isNaN((o = +this._x.call(null, t))) && !isNaN((a = +this._y.call(null, t)))) { + var e, + n, + i, + r, + o, + a, + s, + h, + c, + u, + l, + d = this._root, + f = this._x0, + g = this._y0, + p = this._x1, + y = this._y1; + if (d) { + if (d.length) + for (;;) { + if ( + ((h = o >= (s = (f + p) / 2)) ? (f = s) : (p = s), + (c = a >= (s = (g + y) / 2)) ? (g = s) : (y = s), + !(d = (e = d)[(u = (c << 1) | h)])) + ) + return this; + if (!d.length) break; + (e[(u + 1) & 3] || e[(u + 2) & 3] || e[(u + 3) & 3]) && ((n = e), (l = u)); + } + for (; d.data !== t; ) if (!(d = (i = d).next)) return this; + (r = d.next) && delete d.next, + i + ? r + ? (i.next = r) + : delete i.next + : e + ? (r ? (e[u] = r) : delete e[u], + (d = e[0] || e[1] || e[2] || e[3]) && + d === (e[3] || e[2] || e[1] || e[0]) && + !d.length && + (n ? (n[l] = d) : (this._root = d))) + : (this._root = r); + } + } + return this; + }), + (i.removeAll = function (t) { + for (var e = 0, n = t.length; e < n; ++e) this.remove(t[e]); + return this; + }), + (i.root = function () { + return this._root; + }), + (i.size = function () { + var e = 0; + return ( + this.visit(function (t) { + if (!t.length) for (; ++e, (t = t.next); ); + }), + e + ); + }), + (i.visit = function (t) { + var e, + n, + i, + r, + o, + a, + s, + h = [], + c = this._root; + for (c && h.push(new v(c, this._x0, this._y0, this._x1, this._y1)); (o = h.pop()); ) + !t((c = o.node), (n = o.x0), (i = o.y0), (r = o.x1), (o = o.y1)) && + c.length && + ((a = (n + r) / 2), + (s = (i + o) / 2), + (e = c[3]) && h.push(new v(e, a, s, r, o)), + (e = c[2]) && h.push(new v(e, n, s, a, o)), + (e = c[1]) && h.push(new v(e, a, i, r, s)), + (e = c[0])) && + h.push(new v(e, n, i, a, s)); + return this; + }), + (i.visitAfter = function (t) { + var e, + n = [], + i = []; + for ( + this._root && n.push(new v(this._root, this._x0, this._y0, this._x1, this._y1)); + (e = n.pop()); + + ) { + var r, + o, + a, + s, + h, + c, + u, + l = e.node; + l.length && + ((o = e.x0), + (a = e.y0), + (c = (o + (s = e.x1)) / 2), + (u = (a + (h = e.y1)) / 2), + (r = l[0]) && n.push(new v(r, o, a, c, u)), + (r = l[1]) && n.push(new v(r, c, a, s, u)), + (r = l[2]) && n.push(new v(r, o, u, c, h)), + (r = l[3])) && + n.push(new v(r, c, u, s, h)), + i.push(e); + } + for (; (e = i.pop()); ) t(e.node, e.x0, e.y0, e.x1, e.y1); + return this; + }), + (i.x = function (t) { + return arguments.length ? ((this._x = t), this) : this._x; + }), + (i.y = function (t) { + return arguments.length ? ((this._y = t), this) : this._y; + }), + new o( + null == e + ? function (t) { + return t[0]; + } + : e, + null == n + ? function (t) { + return t[1]; + } + : n, + NaN, + NaN, + NaN, + NaN, + )); + return null == t ? i : i.addAll(t); + }, + }, + ]), + t + ); + })(), + Vd = '1_bHVvcGFuX3NjaWNvbXBhc3M=_1722583864737', + jd = (function () { + function r() { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + e = (i(this, r), t.container); + if (!(e && e instanceof HTMLElement)) throw new Error('not find html container,can not init'); + var n = t.licenseKey; + if (!n) throw new Error('please config license key!'); + (t = t.config), + (this._defaultConfig = k()), + (t = t || this._defaultConfig), + (this.config = null), + this.resetConfig(t), + (t = x( + { container: 'default', width: 200, height: 160, viewColor: '#3ca9f1' }, + this.config.miniMap || {}, + !0, + !0, + )); + (this.stage = new U(e, t, _(n, Vd))), + (this.canvas = this.stage.canvas), + (this.scene = null), + (this.nodes = []), + (this.links = []), + (this.currentNode = null), + (this.currentLink = null), + (this.currentGroup = null), + (this.showLinkFlag = !0), + (this.clusterGroups = []), + (this._currentLayout = null), + (this._undoManager = null), + (this._licenseKey = n), + (this._drawLinkFlag = !1), + (this._isAutoAddLine = !0), + (this._keydownCtrl = !1), + (this._dragMoveRelateNode = !1), + (this._drawLineCallback = function (t) { + return t; + }), + (this._sceneEvent = null), + (this._defindPaintFuncCache = { + nodePaintFunc: null, + linePaintFunc: null, + nodeInBoundFunc: null, + linkInBoundFunc: null, + }), + (this._iconImageCache = {}), + (this._nodeTemplates = {}), + this.init(); + } + return ( + a(r, [ + { + key: 'init', + value: function () { + if (null == this.stage) throw new Error('graph can not init'); + (this.stage.wheelZoom = this.config.wheelZoom), + (this.stage.selectBoxColor = this.config.selectBox.color), + (this.stage.selectBoxAlpha = this.config.selectBox.alpha), + null != this.scene && ((this.scene.childs = null), this.stage.remove(this.scene)), + (this.scene = new bh(this.stage)), + (this.nodes = []), + (this.links = []), + this.initDrawLinkBase(), + (this._undoManager = new Yl()); + }, + }, + { + key: 'resetConfig', + value: function (t) { + (this.config = x(this._defaultConfig, t || {}, !0, !0)), + (this.defaultNodeColor = this.config.node.color), + (this.highLightNeiber = this.config.highLightNeiber); + }, + }, + { + key: 'switchHighLightNeiber', + value: function () { + var t = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0]; + (this.highLightNeiber = t), (this.config.highLightNeiber = t); + }, + }, + { + key: '_recordDrawLineStatus', + value: function () { + this.currentNode + ? ((this.addLineNode = this.currentNode), + (this.stage.addLineStartPoint = { + x: this.addLineNode.cx, + y: this.addLineNode.cy, + color: this.config.link.color, + })) + : ((this.addLineNode = null), (this.stage.addLineStartPoint = null)); + }, + }, + { + key: '_restoreDrawLineStatus', + value: function () { + (this.drawLinkFlag = !1), (this.addLineNode = null), (this.stage.addLineStartPoint = null); + }, + }, + { + key: 'initDrawLinkBase', + value: function () { + var r = this; + r.scene.dbclick(function (t) { + r._restoreDrawLineStatus(); + }), + r.scene.click(function (t) { + var e; + r._restoreDrawLineStatus(), + r.hideAllRightMenu(), + null == t.target && + (r.highLightNeiber && r.restoreHightLight(), (e = r.config.scene.noElementClick)) && + 'function' == typeof e && + e(t, r); + }), + r.scene.mousewheel(function (t) { + var e = r.config.scene.mouseWheel; + e && 'function' == typeof e && e(t, r); + }), + r.scene.keyup(function (t) { + r.setMouseModel('normal'), (r._keydownCtrl = !1); + var e = r.config.scene.keyUp; + e && 'function' == typeof e && e(t, r); + }), + r.scene.keydown(function (t) { + 'Control' === t.key && (r.setMouseModel('select'), (r._keydownCtrl = !0)); + var e = r.config.scene.keyDown; + e && 'function' == typeof e && e(t, r); + }), + r.scene.mousedrag(function (t) { + var e = r.config.scene.mouseDraging; + e && 'function' == typeof e && e(t, r); + }), + r.scene.mouseup(function (t) { + var e, n, i; + null == t.target + ? (r.hideAllRightMenu(), + (r.currentNode = null), + (r.currentLink = null), + (r.currentGroup = null), + r.highLightNeiber && r.restoreHightLight()) + : 'node' == t.target.elementType + ? ((r.currentLink = null), (r.currentGroup = null)) + : 'group' == t.target.elementType + ? ((r.currentNode = null), (r.currentLink = null)) + : ((r.currentNode = null), (r.currentGroup = null)), + 2 == t.button && + null == t.target && + setTimeout(function () { + r.showSceneRightMenu(t); + }, 200), + this.areaSelect && + ((e = r.config.scene.onBoxSelectEndEvent) && 'function' == typeof e + ? ((n = this), + setTimeout(function () { + e(t, r, n.boxSelectedNodes), (n.boxSelectedNodes = null); + }, 350)) + : (this.boxSelectedNodes = null)), + this.dragging && + ((this.dragging = !1), (i = r.config.scene.mouseDragEnd)) && + 'function' == typeof i && + i(t, r); + }); + }, + }, + { + key: 'hideAllRightMenu', + value: function () { + this.config.hasOwnProperty('rightMenu') && + (this.config.rightMenu.hasOwnProperty('nodeMenu') && + 'function' == typeof this.config.rightMenu.nodeMenu.hide && + this.config.rightMenu.nodeMenu.hide(), + this.config.rightMenu.hasOwnProperty('linkMenu') && + 'function' == typeof this.config.rightMenu.linkMenu.hide && + this.config.rightMenu.linkMenu.hide(), + this.config.rightMenu.hasOwnProperty('groupMenu') && + 'function' == typeof this.config.rightMenu.groupMenu.hide && + this.config.rightMenu.groupMenu.hide(), + this.config.rightMenu.hasOwnProperty('sceneMenu')) && + 'function' == typeof this.config.rightMenu.sceneMenu.hide && + this.config.rightMenu.sceneMenu.hide(); + }, + }, + { + key: 'addGraph', + value: function (t) { + var n, i; + L(Vd, 0, 0, 0, this._licenseKey), + null != t && + (null == this.scene && this.init(), + this.addNodes(t.nodes || []), + this.addEdges(t.links || []), + null != t.groups) && + ((n = new Map()), + this.nodes.forEach(function (t) { + n.set(t.id, t); + }), + (i = this), + t.groups.forEach(function (t) { + var e = []; + t.childs.forEach(function (t) { + e.push(n.get(t)); + }), + (i.addNodesInGroup(e, { + shape: t.shape, + padding: t.padding, + color: t.fillColor, + alpha: t.alpha, + smoothPath: t.smoothPath, + label: t.label, + headerColor: t.headerColor, + fontColor: t.fontColor, + showHeader: t.showHeader, + textAlign: t.textAlign || 'center', + borderWidth: t.borderWidth || 2, + borderColor: t.borderColor, + lineDash: t.lineDash || [0], + }).id = t.id); + })); + }, + }, + { + key: 'customStyle', + value: function (t) { + return t && 'function' == typeof t ? t(this.stage.graphics) : null; + }, + }, + { + key: 'addNodesInGroup', + value: function (t, e) { + var n = this.createGroup(e); + return ( + Array.isArray(t) + ? t.forEach(function (t) { + 'node' == t.elementType && n.add(t); + }) + : 'node' == t.elementType && n.add(t), + this.refreshView(), + n + ); + }, + }, + { + key: 'createGroup', + value: function (t) { + var n = this, + t = t || {}, + e = new Dh(t.label, t.fixed || !1); + return ( + (e.id = w(12)), + (e.shape = t.shape || 'rect'), + (e.x = t.x || 10), + (e.y = t.y || 10), + (e.width = t.width || 100), + (e.height = t.height || 100), + (e.padding = Number(t.padding) || 40), + (e.fillColor = t.color), + (e.alpha = t.alpha || 0.1), + (e.showHeader = Boolean(t.showHeader)), + (e.headerHeight = t.headerHeight || 40), + (e.textAlign = t.textAlign || 'center'), + (e.headerColor = t.headerColor || '10,10,225'), + (e.headerAlpha = t.headerAlpha || 0.8), + (e.borderColor = t.borderColor || '10,10,225'), + (e.borderWidth = Number(t.borderWidth || 0)), + (e.font = t.font || 'normal 14px Arial'), + (e.fontColor = t.fontColor || '255,255,255'), + (e.lineDash = t.lineDash), + (e.smoothPath = Boolean(t.smoothPath)), + (e.selectedBorderWidth = Number(t.selectedBorderWidth) || 2), + (e.selectedBorderColor = t.selectedBorderColor || '10,10,225'), + e.mouseup(function (t) { + (n.currentGroup = this), 2 == t.button && (n.hideAllRightMenu(), n.showGroupRightMenu(t, this)); + }), + e.click(function (t) { + var e; + (n.currentGroup = this), + n.config.group.hasOwnProperty('onClick') && + 'function' == typeof (e = n.config.group.onClick) && + e(t, this); + }), + e.dbclick(function (t) { + var e; + (n.currentGroup = this), + n.config.group.hasOwnProperty('ondblClick') && + 'function' == typeof (e = n.config.group.ondblClick) && + e(t, this); + }), + this.scene.add(e), + this.clusterGroups.push(e), + this.refreshView(), + e + ); + }, + }, + { + key: 'removeGroup', + value: function (e) { + var t, n; + 'string' == typeof e + ? 0 < + (t = this.clusterGroups.filter(function (t) { + return t.id == e; + })).length && + ((e = t[0]), -1 < (n = this.clusterGroups.indexOf(e))) && + (this.clusterGroups.splice(n, 1), this.scene.remove(e)) + : -1 < (n = this.clusterGroups.indexOf(e)) && (this.clusterGroups.splice(n, 1), this.scene.remove(e)), + (e = null), + this.refreshView(); + }, + }, + { + key: 'removeAllGroup', + value: function () { + var e = this; + e.clusterGroups.forEach(function (t) { + e.scene.remove(t); + }), + (e.clusterGroups = []), + e.refreshView(); + }, + }, + { + key: 'configNodeAttributes', + value: function (t, e) { + var n, + i, + r, + o, + a = this; + (n = t), + (r = e), + (i = a.config.node), + (n.id = r.id || n.id), + (n.type = r.type || 'default'), + (n.scale = Number(r.scale) || 1), + (n.imageScale = Number(i.imageScale) || 1), + (n.label = r.label || r.id), + (n.alpha = r.alpha || i.alpha), + (n.fontColor = r.fontColor || i.label.color), + (n.textPosition = r.textPosition || i.label.textPosition), + (n.font = r.font || i.label.font), + (n.borderColor = r.borderColor || i.borderColor), + (n.borderWidth = r.borderWidth || i.borderWidth), + (n.borderRadius = r.borderRadius || i.borderRadius), + (n.showlabel = r.showlabel || i.label.show), + (n.nodeWrapText = i.label.nodeWrapText), + (n.showShadow = r.showShadow || i.selected.showShadow), + (n.shadowColor = r.shadowColor || i.selected.shadowColor), + (n.shadowBlur = r.shadowBlur || i.selected.shadowBlur), + (n.selectedBorderColor = r.selectedBorderColor || i.selected.borderColor), + (n.selectedBorderWidth = r.selectedBorderWidth || i.selected.borderWidth), + (n.lineDash = r.lineDash || i.lineDash), + (n.labelBackGround = r.labelBackGround || i.label.background), + (n.labelBorderWidth = r.labelBorderWidth || i.label.borderWidth), + (n.labelBorderColor = r.labelBorderColor || i.label.borderColor), + (n.textOffsetX = r.textOffsetX || i.label.textOffsetX), + (n.textOffsetY = r.textOffsetY || i.label.textOffsetY), + (n.padding = r.padding || i.padding), + (n.tagColor = r.tagColor || i.tagColor), + (n.tags = r.tags), + (n.properties = r.properties || {}), + r.x && (n.x = parseInt(r.x) || 100), + r.y && (n.y = parseInt(r.y) || 100), + (t.weight = 1), + (t.px = t.x), + (t.py = t.y), + a.config.nodeClusters && a.config.nodeClusters[t.type] + ? ((i = a.config.nodeClusters[t.type]), + (t.fillColor = i.color || a.config.node.color), + (t.shape = i.shape || a.config.node.shape), + (t.size = i.size || a.config.node.size), + 'rect' == t.shape && + (null != i.width && (t.width = i.width), null != i.height) && + (t.height = i.height), + (t.font = i.font || a.config.node.label.font), + (t.fontColor = i.fontColor || a.config.node.label.color), + (t.borderWidth = i.borderWidth || a.config.node.borderWidth), + (t.borderColor = i.borderColor || a.config.node.borderColor), + (t.selectedBorderWidth = i.selectedBorderWidth || a.config.node.selected.borderWidth), + (t.selectedBorderColor = i.selectedBorderColor || a.config.node.selected.borderColor), + (t.shadowColor = i.shadowColor || a.config.node.selected.shadowColor), + (t.textPosition = i.textPosition || a.config.node.label.textPosition), + (t.tagColor = i.tagColor || a.config.node.tagColor), + (t.imageScale = i.imageScale || a.config.node.imageScale), + i.icon && + ((o = i.icon), + (t.icon = o), + t.setImage(null == (n = a._iconImageCache[o]) ? void 0 : n.image), + (t.imageOffsetX = 0 | i.imageOffsetX), + (t.imageOffsetY = 0 | i.imageOffsetY)), + i.image && + ((t.imageUrl = i.image), + t.setImage(i.image, function () { + a.refreshView(); + }))) + : ((t.fillColor = e.color || e.fillColor || this.defaultNodeColor), + (t.shape = e.shape || a.config.node.shape || 'circle'), + (t.size = e.size || a.config.node.size || 40)), + 'rect' == t.shape && + ((t.width = e.width || a.config.node.width || t.size || 40), + (t.height = e.height || a.config.node.height || t.size || 40)), + (t.imageUrl = e.image), + t.setImage(e.image, function () { + a.refreshView(); + }), + e.style && + (e.style.icon && + ((o = e.style.icon), + (t.icon = o), + t.setImage(null == (r = a._iconImageCache[o]) ? void 0 : r.image), + (t.imageOffsetX = 0 | e.style.imageOffsetX), + (t.imageOffsetY = 0 | e.style.imageOffsetY)), + e.style.image && + ((t.imageUrl = e.style.image), + t.setImage(t.imageUrl, function () { + a.refreshView(); + }), + delete e.style.image), + (t = Object.assign(t, e.style))), + null != a._defindPaintFuncCache.nodePaintFunc && + (t.definedPaintFunc = a._defindPaintFuncCache.nodePaintFunc), + null != a._defindPaintFuncCache.nodeInBoundFunc && + (t.isInBound = a._defindPaintFuncCache.nodeInBoundFunc), + a.refreshView(); + }, + }, + { + key: 'resetNodeAttributes', + value: function (t, e) { + var n; + null != t && + null != e && + ((n = this), + Object.assign(t, e), + t.setImage(e.image, function () { + n.refreshView(); + }), + n.refreshView()); + }, + }, + { + key: 'registNodeTemplates', + value: function () { + var e, + t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []; + L(Vd, 0, 0, 0, this._licenseKey), + t instanceof Array && + ((e = this), + t.forEach(function (t) { + e._nodeTemplates[t.name] = t; + })), + L(Vd, 0, 0, 0, this._licenseKey); + }, + }, + { + key: 'newNode', + value: function (t) { + var n, + i = this, + r = null; + return ( + 'custome' == t.nodeType + ? (n = i._nodeTemplates[t.shape]) + ? ((r = new qh(n)), + (n = e(e({}, t.style), n.mainShape)), + (r.customeShape = t.shape), + (r.drawFinished = function () { + i.refreshView(); + }), + (t.style = n)) + : (r = new Gh()) + : (r = 'textNode' == t.nodeType ? new Hh(t.label) : new Gh()), + (r.x = null == t.x ? Math.round(Math.random() * this.stage.width) : t.x), + (r.y = null == t.y ? Math.round(Math.random() * this.stage.height) : t.y), + null == t.id && (t.id = w(12)), + i.configNodeAttributes(r, t), + r.click(function (t) { + var e; + (i.currentNode = this), + i._drawLinkFlag && + (null == i.addLineNode + ? i._recordDrawLineStatus() + : ((e = null), + i._isAutoAddLine && + (e = i.addEdge({ + id: w(10), + source: i.addLineNode.id, + target: this.id, + style: { strokeColor: i.config.link.color }, + })), + i._drawLineCallback && + 'function' == typeof i._drawLineCallback && + i._drawLineCallback(e, i.addLineNode, this), + i._restoreDrawLineStatus())), + i.highLightNeiber && !t.ctrlKey && (i.restoreHightLight(), i.highLightNeiberNodes(this, 0.1)), + i.config.node.hasOwnProperty('onClick') && + 'function' == typeof (e = i.config.node.onClick) && + e(t, this); + }), + r.dbclick(function (t) { + var e; + (this.fixed = !this.fixed), + i.config.node.hasOwnProperty('ondblClick') && + 'function' == typeof (e = i.config.node.ondblClick) && + e(t, this); + }), + r.mousedrag(function (t) { + if ( + ((this.fixed = !0), + (this.px = this.x), + (this.py = this.y), + this._isDragging || 1 < i.scene.selectedElements.length) + ) + return !1; + var e; + (this._isDragging = !0), + (this._dragStartPosition = { x: this.x, y: this.y }), + i.config.node.hasOwnProperty('onMousedrag') && + 'function' == typeof (e = i.config.node.onMousedrag) && + e(t, this); + }), + r.mouseup(function (t) { + var e; + ((i.currentNode = this).fixed = !0), + (this.px = this.x), + (this.py = this.y), + this._isDragging && + (i._dragMoveRelateNode && i._dragNodeEnd(this), i.config.node.hasOwnProperty('onMouseDragEnd')) && + 'function' == typeof (e = i.config.node.onMouseDragEnd) && + e(t, this), + (this._isDragging = !1), + 2 == t.button && (i.hideAllRightMenu(), i.showNodeRightMenu(t, this)), + i.config.node.hasOwnProperty('onMouseUp') && + 'function' == typeof (e = i.config.node.onMouseUp) && + e(t, this); + }), + r.mousedown(function (t) { + var e; + ((i.currentNode = this).fixed = !0), + (this.px = this.x), + (this.py = this.y), + i.config.node.hasOwnProperty('onMouseDown') && + 'function' == typeof (e = i.config.node.onMouseDown) && + e(t, this); + }), + r.mouseover(function (t) { + var e; + i.config.node.hasOwnProperty('onMouseOver') && + 'function' == typeof (e = i.config.node.onMouseOver) && + e(t, this); + }), + r.mouseout(function (t) { + var e; + i.config.node.hasOwnProperty('onMouseOut') && + 'function' == typeof (e = i.config.node.onMouseOut) && + e(t, this); + }), + i.scene.add(r), + i.nodes.push(r), + r + ); + }, + }, + { + key: '_dragNodeEnd', + value: function (t) { + var e, n, i, r; + null != t._dragStartPosition && + 0 != (e = this.findOneLevelNodes(t)).length && + ((n = t.x - t._dragStartPosition.x), + (i = t.y - t._dragStartPosition.y), + Math.sqrt(Math.pow(n, 2) + Math.pow(i, 2), 2) < 10 || + (e.forEach(function (t) { + (t.targetX = t.x + n), (t.targetY = t.y + i); + }), + (t._dragStartPosition = null), + (r = this) + .createBaseAnimate({ + targets: e, + duration: 800, + easing: 'easeOutExpo', + x: function (t) { + return t.targetX; + }, + y: function (t) { + return t.targetY; + }, + begin: function (t) { + r.switchAnimate(!0); + }, + }) + .finished.then(function () { + r.switchAnimate(!1); + }))); + }, + }, + { + key: 'findOneLevelNodes', + value: function () { + var i = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + r = new Set(); + return ( + (i.outLinks || []).forEach(function (t) { + var t = t.target, + e = (t.outLinks || []).map(function (t) { + return t.target.id; + }), + n = (t.inLinks || []).map(function (t) { + return t.source.id; + }); + 0 == + e.concat(n).filter(function (t) { + return t != i.id; + }).length && r.add(t); + }), + (i.inLinks || []).forEach(function (t) { + var t = t.source, + e = (t.outLinks || []).map(function (t) { + return t.target.id; + }), + n = (t.inLinks || []).map(function (t) { + return t.source.id; + }); + 0 == + e.concat(n).filter(function (t) { + return t != i.id; + }).length && r.add(t); + }), + (r = Array.from(r)) + ); + }, + }, + { + key: 'refreshView', + value: function () { + var t = this; + null != this.stage && + (0 < arguments.length && void 0 !== arguments[0] && arguments[0] + ? setTimeout(function () { + t.stage.updateView(); + }, 5) + : this.stage.updateView()); + }, + }, + { + key: 'highLightNeiberNodes', + value: function (t, e) { + this.nodes.forEach(function (t) { + (t.t_alpha = t.alpha), (t.alpha = e || 0.1); + }), + (t.alpha = t.t_alpha), + (t.inLinks || []).forEach(function (t) { + t.source.visible && (t.source.alpha = t.source.t_alpha); + }), + (t.outLinks || []).forEach(function (t) { + t.target.visible && (t.target.alpha = t.target.t_alpha); + }), + this.showLinkFlag && + (this.links.forEach(function (t) { + t.visible = !1; + }), + (t.inLinks || []).forEach(function (t) { + t.source.visible && (t.visible = !0); + }), + (t.outLinks || []).forEach(function (t) { + t.target.visible && (t.visible = !0); + })); + }, + }, + { + key: 'restoreHightLight', + value: function () { + this.nodes.forEach(function (t) { + t.alpha = t.t_alpha || t.alpha; + }), + this.showLinkFlag && + this.links.forEach(function (t) { + t.source.visible && t.target.visible && (t.visible = !0); + }); + }, + }, + { + key: 'lockNode', + value: function (t) { + t && null != t && ((t.fixed = !0), (t.dragable = !1)); + }, + }, + { + key: 'unLockNode', + value: function (t) { + t && null != t && ((t.fixed = !1), (t.dragable = !0)); + }, + }, + { + key: 'showNodeRightMenu', + value: function (t, e) { + this.config.hasOwnProperty('rightMenu') && + this.config.rightMenu.hasOwnProperty('nodeMenu') && + 'function' == typeof this.config.rightMenu.nodeMenu.show && + this.config.rightMenu.nodeMenu.show(t, this, e); + }, + }, + { + key: 'showLinkRightMenu', + value: function (t, e) { + this.config.hasOwnProperty('rightMenu') && + this.config.rightMenu.hasOwnProperty('linkMenu') && + 'function' == typeof this.config.rightMenu.linkMenu.show && + this.config.rightMenu.linkMenu.show(t, this, e); + }, + }, + { + key: 'showGroupRightMenu', + value: function (t, e) { + this.config.hasOwnProperty('rightMenu') && + this.config.rightMenu.hasOwnProperty('groupMenu') && + 'function' == typeof this.config.rightMenu.groupMenu.show && + this.config.rightMenu.groupMenu.show(t, this, e); + }, + }, + { + key: 'showSceneRightMenu', + value: function (t) { + this.config.hasOwnProperty('rightMenu') && + this.config.rightMenu.hasOwnProperty('sceneMenu') && + 'function' == typeof this.config.rightMenu.sceneMenu.show && + this.config.rightMenu.sceneMenu.show(t, this); + }, + }, + { + key: 'configEdgeAttributes', + value: function (t, e) { + var n, i, r; + null != t && + null != e && + ((n = t), + (i = e), + (r = this.config.link), + (n.id = i.id || n.id), + (n.type = i.type || 'default'), + (n.label = i.label), + (n.showlabel = i.showlabel || r.label.show), + (n.lineWidth = Number(i.lineWidth) || r.lineWidth), + (n.strokeColor = i.color || i.strokeColor || r.color), + (n.lineType = i.lineType || r.lineType), + (n.lineDash = i.lineDash || r.lineDash), + (n.font = i.font || r.label.font), + (n.fontColor = i.fontColor || r.label.color), + (n.arrowType = i.arrowType || r.arrowType), + (n.alpha = i.alpha || r.alpha), + (n.fontAlpha = i.fontAlpha || 1), + (n.selectedColor = i.selectedColor || r.selected.color), + (n.colorType = i.colorType || r.colorType), + (n.labelBackGround = i.labelBackGround || r.label.background), + (n.labelBorderWidth = i.labelBorderWidth || r.label.borderWidth), + (n.labelBorderColor = i.labelBorderColor || r.label.borderColor), + (n.labelBorderRadius = i.labelBorderRadius || r.label.borderRadius), + (n.showArrow = i.showArrow || r.showArrow), + (n.multiControlPercent = i.multiControlPercent || 0.2), + (n.parallelType = i.parallelType || 'curve'), + (n.background = i.background), + (n.weight = i.weight ? Number(i.weight) : 1), + (n.visible = i.visible || !0), + (n.textWithLineAngle = i.textWithLineAngle || !0), + (n.properties = i.properties || {}), + this.config.linkClusters && + this.config.linkClusters[t.type] && + ((r = this.config.linkClusters[t.type]), + (t.strokeColor = r.color || this.config.link.color), + (t.lineWidth = r.lineWidth || this.config.link.lineWidth), + (t.lineType = r.lineType || this.config.link.lineType), + (t.lineDash = r.lineDash || this.config.link.lineDash), + (t.selectedColor = r.selectedColor || this.config.link.selected.color), + (t.font = r.font || this.config.link.label.font), + (t.fontColor = r.fontColor || this.config.link.label.color), + (t.showArrow = r.showArrow || this.config.link.showArrow), + (t.alpha = Number(r.alpha) || this.config.link.alpha), + (t.labelBackGround = r.labelBackGround || this.config.link.label.background)), + e.style && Object.assign(t, e.style), + null != this._defindPaintFuncCache.linePaintFunc && + (t.definedPaintFunc = this._defindPaintFuncCache.linePaintFunc), + null != this._defindPaintFuncCache.linkInBoundFunc && + (t.isInBound = this._defindPaintFuncCache.linkInBoundFunc), + this.refreshView()); + }, + }, + { + key: 'resetEdgeAttributes', + value: function (t, e) { + null != t && null != e && (Object.assign(t, e), this.refreshView()); + }, + }, + { + key: 'newEdge', + value: function (t, e, n) { + var i; + if (null != t && null != e && null != n) + return ( + (i = this), + null == n.id && (n.id = w(15)), + (t = new Wh(t, e, n.label)), + i.configEdgeAttributes(t, n), + t.click(function (t) { + var e; + i.config.link.hasOwnProperty('onClick') && + 'function' == typeof (e = i.config.link.onClick) && + e(t, this); + }), + t.dbclick(function (t) { + var e; + i.config.link.hasOwnProperty('ondblClick') && + 'function' == typeof (e = i.config.link.ondblClick) && + e(t, this); + }), + t.mousedown(function (t) { + var e; + i.config.link.hasOwnProperty('onMouseDown') && + 'function' == typeof (e = i.config.link.onMouseDown) && + e(t, this); + }), + t.mouseup(function (t) { + var e; + (i.currentLink = this), + 2 == t.button && (i.hideAllRightMenu(), i.showLinkRightMenu(t, this)), + i.config.link.hasOwnProperty('onMouseUp') && + 'function' == typeof (e = i.config.link.onMouseUp) && + e(t, this); + }), + t.mouseover(function (t) { + var e; + i.config.link.hasOwnProperty('onMouseOver') && + 'function' == typeof (e = i.config.link.onMouseOver) && + e(t, this); + }), + t.mouseout(function (t) { + var e; + i.config.link.hasOwnProperty('onMouseOut') && + 'function' == typeof (e = i.config.link.onMouseOut) && + e(t, this); + }), + i.scene.add(t), + i.links.push(t), + t + ); + }, + }, + { + key: 'addNodes', + value: function (t) { + var e, n, i, r; + return t instanceof Array && 0 != t.length + ? ((e = this), + (n = new Map()), + e.nodes.forEach(function (t) { + n.set(t.id, t); + }), + (i = []), + (r = null), + t.forEach(function (t) { + null == n.get(t.id) && ((r = e.newNode(t)), i.push(r), n.set(t.id, r)); + }), + e.refreshView(), + i) + : []; + }, + }, + { + key: 'addNode', + value: function (t) { + t = this.addNodes([t]); + return 0 < t.length ? t[0] : null; + }, + }, + { + key: 'addEdges', + value: function (t) { + var e, n, i, r, o, a, s; + return t instanceof Array && 0 != t.length + ? ((e = this), + (n = new Map()), + e.links.forEach(function (t) { + t.id || (t.id = w(10)), n.set(t.id, t); + }), + (i = new Map()), + e.nodes.forEach(function (t) { + i.set(t.id, t); + }), + (r = []), + (s = a = o = null), + t.forEach(function (t) { + t.id || (t.id = w(10)), + null == n.get(t.id) && + ((o = i.get(t.source)), (a = i.get(t.target)), null != o) && + null != a && + ((s = e.newEdge(o, a, t)), r.push(s), n.set(t.id, s)); + }), + e.refreshView(), + r) + : []; + }, + }, + { + key: 'addEdge', + value: function (t) { + t = this.addEdges([t]); + return 0 < t.length ? t[0] : null; + }, + }, + { + key: 'getGraphData', + value: function () { + return { nodes: this.nodes, links: this.links }; + }, + }, + { + key: 'getVisibleData', + value: function () { + return { + nodes: this.nodes.filter(function (t) { + return 1 == t.visible; + }), + links: this.links.filter(function (t) { + return 1 == t.source.visible && 1 == t.target.visible; + }), + }; + }, + }, + { + key: 'setZoomRange', + value: function () { + var t, + e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [0.1, 10]; + e instanceof Array && + 2 == e.length && + ((t = Number(e[0])), isNaN(t) && (t = 0), (e = Number(e[1])), t < (e = isNaN(e) ? 10 : e)) && + (this.scene.scaleRange = [t, e]); + }, + }, + { + key: 'getBounds', + value: function () { + return this.scene.getElementsBound(); + }, + }, + { + key: 'moveCenter', + value: function (t) { + t && (this.scene.scale = t <= 0 ? 0.1 : t), this.scene.translateToCenter(), this.refreshView(); + }, + }, + { + key: 'moveNodeToCenter', + value: function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, + n = this; + null != e && 0 < Number(e) + ? n + .createBaseAnimate({ + targets: n.scene, + duration: e, + easing: 'linear', + translateX: -t.x + n.stage.width / 2, + translateY: -t.y + n.stage.height / 2, + begin: function (t) { + n.switchAnimate(!0); + }, + }) + .finished.then(function () { + n.switchAnimate(!1); + }) + : (n.scene.setCenter(t.x, t.y), n.refreshView()); + }, + }, + { + key: 'resize', + value: function () { + L(Vd, 0, 0, 0, this._licenseKey), this.stage.resize(); + }, + }, + { + key: 'setMouseModel', + value: function (t, e) { + 'drag' == t + ? (this.stage.mode = 'drag') + : 'select' == t + ? ((this.stage.mode = 'select'), + e && -1 != ['rect', 'lasso', 'circle'].indexOf(e) && (this.scene.selectBoxType = e)) + : (this.stage.mode = 'normal'); + }, + }, + { + key: 'saveImageBak', + value: function (t) { + var e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; + 0 < + this.clusterGroups.filter(function (t) { + return t.fixed; + }).length + ? this.saveOriginImage(t, e) + : (this.scaleGraph(2, !1), + this.nodes.forEach(function (t) { + 'rect' == t.shape + ? ((t.oldWidth = t.width), + (t.oldHeight = t.height), + (t.fontScale = 2), + (t.width = 2 * t.width), + (t.height = 2 * t.height)) + : ((t.oldScale = t.scale), (t.scale = 2 * t.scale)); + }), + this.links.forEach(function (t) { + (t.scale = 1.4), (t.oldLineWidth = t.lineWidth), (t.lineWidth = 1.5 * t.lineWidth); + }), + this.clusterGroups.forEach(function (t) { + (t.padding = 2 * t.padding), (t.headerHeight = 2 * t.headerHeight), (t.scale = 2); + }), + this.saveOriginImage(t, e), + this.nodes.forEach(function (t) { + 'rect' == t.shape + ? ((t.fontScale = null), (t.width = t.oldWidth), (t.height = t.oldHeight)) + : (t.scale = t.oldScale); + }), + this.links.forEach(function (t) { + (t.scale = 1), (t.lineWidth = t.oldLineWidth); + }), + this.clusterGroups.forEach(function (t) { + (t.padding = t.padding / 2), (t.headerHeight = t.headerHeight / 2), (t.scale = 1); + }), + this.scaleGraph(0.5, !1)); + }, + }, + { + key: 'saveImage', + value: function (t) { + var e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; + (this.stage.mutalScale = Number(2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 2) || 2), + this.saveOriginImage(t, e), + (this.stage.mutalScale = 1); + }, + }, + { + key: 'saveOriginImage', + value: function (t) { + var e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; + L(Vd, 0, 0, 0, this._licenseKey), + (t = x( + { + width: 1e4, + height: 1e4, + type: 'png', + fileName: 'GraphVis图谱图片', + background: '#fff', + textWatermark: { + content: 'GraphVis图谱可视化', + angle: -30, + alpha: 0.1, + fontStyle: 'normal', + fontSize: 60, + fontFamliy: 'Arial', + fontColor: '#666', + }, + }, + (t = null == t ? {} : t), + )), + e || (t.textWatermark = null), + this.stage.saveAsLocalImage(t); + }, + }, + { + key: 'getImageBase64Data', + value: function (t, e) { + return ( + (t = x( + { + width: 6e3, + height: 6e3, + type: 'png', + fileName: 'GraphVis图谱图片', + background: '#fff', + textWatermark: { + content: 'GraphVis图谱可视化', + angle: -30, + alpha: 0.1, + fontStyle: 'normal', + fontSize: 60, + fontFamliy: 'Arial', + fontColor: '#666', + }, + }, + (t = null == t ? {} : t), + )), + e || (t.textWatermark = null), + L(Vd, 0, 0, 0, this._licenseKey), + this.stage.getImageUrlData(t) + ); + }, + }, + { + key: 'getSnapshotImage', + value: function () { + return L(Vd, 0, 0, 0, this._licenseKey), this.stage.getSnapshotImage(); + }, + }, + { + key: 'serialized', + value: function () { + var t = [ + 'shape', + 'size', + 'font', + 'fillColor', + 'fontColor', + 'borderWidth', + 'borderColor', + 'selectedBorderColor', + 'selectedBorderWidth', + 'shadowColor', + 'shadowBlur', + 'height', + 'width', + 'textPosition', + 'textOffsetX', + 'textOffsetY', + 'labelBackGround', + 'labelBorderWidth', + 'labelBorderColor', + 'tags', + 'tagColor', + 'x', + 'y', + 'scale', + 'imageScale', + ], + i = [], + r = null, + o = + (this.nodes.forEach(function (e) { + r = { + id: e.id, + label: e.label, + type: e.type, + nodeType: e.nodeType, + shape: e.customeShape, + properties: e.properties, + style: {}, + }; + var n; + t.forEach(function (t) { + (n = e[t]) && (r.style[t] = n); + }), + e.imageUrl && (r.style.image = e.imageUrl), + 'textNode' == e.nodeType && + ((r.style.lineHeight = e.lineHeight), + (r.style.padding = e.padding), + e.textAlign && 'left' == e.textAlign && (r.style.textAlign = e.textAlign), + e.fontStrokeColor) && + ((r.style.fontStrokeColor = e.fontStrokeColor), (r.style.fontStrokeWidth = e.fontStrokeWidth)), + i.push(r); + }), + [ + 'lineType', + 'lineWidth', + 'font', + 'fontColor', + 'strokeColor', + 'selectedColor', + 'background', + 'labelBackGround', + 'lineDash', + 'parallelType', + 'showArrow', + ]), + a = [], + s = null, + e = + (this.links.forEach(function (e) { + s = { + id: e.id, + label: e.label, + type: e.type, + source: e.source.id, + target: e.target.id, + weight: e.weight, + properties: e.properties, + style: {}, + }; + var n; + o.forEach(function (t) { + (n = e[t]) && (s.style[t] = n); + }), + a.push(s); + }), + this.clusterGroups.map(function (t) { + return { + id: t.id, + label: t.label, + shape: t.shape, + fillColor: t.fillColor, + padding: t.padding, + alpha: t.alpha, + smoothPath: t.smoothPath, + headerColor: t.headerColor, + fontColor: t.fontColor, + showHeader: t.showHeader, + borderWidth: t.borderWidth, + borderColor: t.borderColor, + textAlign: t.textAlign, + lineDash: t.lineDash, + childs: t.childs.map(function (t) { + return t.id; + }), + }; + })); + return L(Vd, 0, 0, 0, this._licenseKey), { nodes: i, links: a, groups: e }; + }, + }, + { + key: 'exportJsonFile', + value: function (t) { + var e = JSON.stringify(this.serialized()), + t = (t || 'graphdata') + '.json', + e = new Blob([e], { type: 'text/json' }), + n = document.createElement('a'), + i = new MouseEvent('click'); + (n.download = t), + (n.href = window.URL.createObjectURL(e)), + (n.dataset.downloadurl = ['text/json', n.download, n.href].join(':')), + n.dispatchEvent(i); + }, + }, + { + key: 'hideAllLink', + value: function () { + (this.showLinkFlag = !1), + this.links.forEach(function (t) { + t.visible = !1; + }), + this.refreshView(); + }, + }, + { + key: 'showAllLink', + value: function () { + (this.showLinkFlag = !0), + this.links.forEach(function (t) { + t.source.visible && t.target.visible && (t.visible = !0); + }), + this.refreshView(); + }, + }, + { + key: 'onlyShowSelectLink', + value: function () { + this.links.forEach(function (t) { + t.selected ? (t.visible = !0) : (t.visible = !1); + }), + this.refreshView(); + }, + }, + { + key: 'showAllNode', + value: function () { + this.nodes.forEach(function (t) { + (t.alpha = 1), (t.visible = !0); + }), + this.refreshView(); + }, + }, + { + key: 'applyNodeSize', + value: function (e) { + var n = this, + i = new Set(), + t = + (n.nodes.forEach(function (t) { + (t.degree = (t.outLinks || []).length + (t.inLinks || []).length), i.add(t.degree); + }), + Array.from(i).sort()), + r = [t[0], t[t.length - 1]]; + n.nodes.forEach(function (t) { + t.scale = n.numScale(e, r, t.degree); + }), + this.refreshView(); + }, + }, + { + key: 'applyLinkWeight', + value: function (e) { + var n = this, + i = new Set(), + t = + (n.links.forEach(function (t) { + i.add(t.weight); + }), + Array.from(i).sort()), + r = [t[0], t[t.length - 1]]; + n.links.forEach(function (t) { + t.lineWidth = Math.round(n.numScale(e, r, t.weight)); + }), + this.refreshView(); + }, + }, + { + key: 'numScale', + value: function (t, e, n) { + n = (((n - e[0]) * (t[1] - t[0])) / (e[1] - e[0]) + t[0]).toFixed(1); + return isNaN(n) ? 1 : n; + }, + }, + { + key: 'selectedAllNodes', + value: function () { + var e = this; + this.nodes.forEach(function (t) { + (t.selected = !0), e.scene.addToSelected(t); + }), + this.refreshView(); + }, + }, + { + key: 'cancelAllSelected', + value: function () { + this.scene.cancleAllSelected(), this.refreshView(); + }, + }, + { + key: 'removeFromSelected', + value: function (t) { + t && (this.scene.removeFromSelected(t), this.refreshView()); + }, + }, + { + key: 'reverseSelectNodes', + value: function () { + var e = this; + this.nodes.forEach(function (t) { + t.selected + ? ((t.selected = !1), e.scene.removeFromSelected(t)) + : ((t.selected = !0), e.scene.addToSelected(t)); + }), + this.refreshView(); + }, + }, + { + key: 'selectedNeighbers', + value: function (t) { + t = t || this.currentNode; + if (null == t) return !1; + var e = t.inLinks || [], + t = t.outLinks || [], + n = []; + e.forEach(function (t) { + n.push(t.source); + }), + t.forEach(function (t) { + n.push(t.target); + }), + this.addToSelectedElements(n); + }, + }, + { + key: 'onlyShowSelectedNode', + value: function () { + this.nodes.forEach(function (t) { + t.selected || (t.visible = !1); + }), + this.refreshView(); + }, + }, + { + key: 'hideSelectedNode', + value: function () { + this.nodes.forEach(function (t) { + t.selected && (t.visible = !1); + }), + this.refreshView(); + }, + }, + { + key: 'hideIsolatedNodes', + value: function () { + this.nodes.forEach(function (t) { + 0 == (t.inLinks || []).length && 0 == (t.outLinks || []).length && (t.visible = !1); + }), + this.refreshView(); + }, + }, + { + key: 'deleteNodes', + value: function (t) { + var e, n, i; + L(Vd, 0, 0, 0, this._licenseKey), + t instanceof Array && + 0 != t.length && + ((t = t.map(function (t) { + return t; + })), + (e = this), + (n = []), + (i = -1), + t.forEach(function (t) { + (t.inLinks || []).forEach(function (t) { + n.push(t); + }), + (t.outLinks || []).forEach(function (t) { + n.push(t); + }), + -1 < (i = e.nodes.indexOf(t)) && (e.nodes.splice(i, 1), e.scene.remove(t)); + }), + n.forEach(function (t) { + -1 < (i = e.links.indexOf(t)) && (e.links.splice(i, 1), e.scene.remove(t)); + }), + this._undoManager.todo('node:remove', t.concat(n)), + this.refreshView()); + }, + }, + { + key: 'deleteNode', + value: function (t) { + t && this.deleteNodes([t]); + }, + }, + { + key: 'deleteLinks', + value: function (t) { + var n; + L(Vd, 0, 0, 0, this._licenseKey), + t instanceof Array && + 0 != t.length && + ((t = t.map(function (t) { + return t; + })), + (n = this), + t.forEach(function (t) { + var e = n.links.indexOf(t); + -1 < e && (n.links.splice(e, 1), n.scene.remove(t)); + }), + this._undoManager.todo('link:remove', t), + this.refreshView()); + }, + }, + { + key: 'deleteLink', + value: function (t) { + t && this.deleteLinks([t]); + }, + }, + { + key: 'removeCurrentLink', + value: function () { + this.deleteLink(this.currentLink), (this.currentLink = null); + }, + }, + { + key: 'scaleGraph', + value: function (e) { + var t = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], + n = 0, + i = 0, + r = + (this.nodes.forEach(function (t) { + (n += t.x), (i += t.y); + }), + this.nodes.length), + n = Math.round(n / r), + i = Math.round(i / r); + this.nodes.forEach(function (t) { + (t.x = n + (t.x - n) * e), (t.y = i + (t.y - i) * e); + }), + t && this.refreshView(); + }, + }, + { + key: 'rotateGraph', + value: function (t) { + var i = Math.sin((-t * Math.PI) / 180), + r = Math.cos((-t * Math.PI) / 180), + o = 0, + a = 0; + this.nodes.forEach(function (t) { + (o += t.cx), (a += t.cy); + }), + (o = Math.round(o / this.nodes.length)), + (a = Math.round(a / this.nodes.length)), + this.nodes.forEach(function (t) { + var e = t.cx - o, + n = t.cy - a; + (t.cx = o + e * r - n * i), (t.cy = a + n * r + e * i); + }), + this.refreshView(); + }, + }, + { + key: 'selectedEdge', + value: function (t) { + t && + ((t.selected = !0), + this.scene.addToSelected(t), + (t.target.selected = !0), + this.scene.addToSelected(t.target), + (t.source.selected = !0), + this.scene.addToSelected(t.source)); + }, + }, + { + key: 'getMouseDownPosition', + value: function () { + return { x: this.scene.mouseDownX, y: this.scene.mouseDownY }; + }, + }, + { + key: 'covertPagePosition', + value: function (t, e) { + return 2 != arguments.length + ? { pageX: 0, pageY: 0, offsetX: 0, offsetY: 0 } + : this.stage.getPagePosition(t, e); + }, + }, + { + key: 'convertScenePosition', + value: function (t) { + var e = null; + return ( + t.pageX + ? (e = n(t)) + : (((e = n(t)).pageX = t.clientX + document.body.scrollLeft - document.body.clientLeft), + (e.pageY = t.clientY + document.body.scrollTop - document.body.clientTop)), + { x: e.x, y: e.y } + ); + function n(t) { + var e, + n = {}; + for (e in t) 'returnValue' != e && 'keyLocation' != e && (n[e] = t[e]); + return n; + } + }, + }, + { + key: 'addNodeForDrag', + value: function (e, n) { + var i = this; + i.stage.removeEventListener('mousemove'), + i.stage.mousemove(function (t) { + (t = i.scene.toSceneEvent(t)), + i.stage.removeEventListener('mousemove'), + (e.id = null == e.id ? w(12) : e.id), + (e.x = t.x), + (e.y = t.y), + (t = i.newNode(e)); + (t.fixed = !0), i.refreshView(), n && 'function' == typeof n && n(t); + }); + }, + }, + { + key: 'removeSelectNodes', + value: function () { + var t = this.nodes.filter(function (t) { + return t.selected; + }); + this.deleteNodes(t); + }, + }, + { + key: 'clearAll', + value: function () { + this.scene && this.scene.clear(), + (this.nodes = []), + (this.links = []), + (this.currentNode = null), + (this.currentLink = null), + (this.currentGroup = null), + (this._currentLayout = null), + (this.clusterGroups = []), + (this._drawLinkFlag = !1), + (this._isAutoAddLine = !0), + (this.virLink = null), + this._undoManager.clearAll(), + this.zoomOriginal(), + this.refreshView(); + }, + }, + { + key: 'setZoom', + value: function (t) { + switch (t) { + case 'zoomOut': + this.zoomOut(); + break; + case 'zoomIn': + this.zoomIn(); + break; + case 'zoom1': + this.zoomOriginal(); + break; + default: + this.zoomFit(); + } + }, + }, + { + key: 'zoomOut', + value: function () { + L(Vd, 0, 0, 0, this._licenseKey), this.stage.zoomOut(), this.refreshView(); + }, + }, + { + key: 'zoomIn', + value: function () { + L(Vd, 0, 0, 0, this._licenseKey), this.stage.zoomIn(), this.refreshView(); + }, + }, + { + key: 'zoomFit', + value: function () { + L(Vd, 0, 0, 0, this._licenseKey), this.stage.centerAndZoom(), this.refreshView(); + }, + }, + { + key: 'zoomOriginal', + value: function () { + this.stage.centerAndZoom(), (this.scene.scale = 1), this.refreshView(); + }, + }, + { + key: 'getZoomRatio', + value: function () { + return this.scene.scale; + }, + }, + { + key: 'destroy', + value: function () { + this.clearAll(), this.scene.removeAllEventListener(), this.stage.removeAllEventListener(); + }, + }, + { + key: 'beginAddLine', + value: function (t) { + var e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1]; + (this._drawLinkFlag = !0), + (this._isAutoAddLine = e), + this._recordDrawLineStatus(), + t && 'function' == typeof t && (this._drawLineCallback = t); + }, + }, + { + key: 'startNodeAddLine', + value: function (t) { + var e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], + n = 2 < arguments.length ? arguments[2] : void 0; + (this.currentNode = t), this.beginAddLine(n, e); + }, + }, + { + key: 'getSelectedNodes', + value: function () { + return this.nodes.filter(function (t) { + return 1 == t.selected; + }); + }, + }, + { + key: 'findNodesByAttr', + value: function (e, n) { + return this.nodes.filter(function (t) { + return t[e] == n; + }); + }, + }, + { + key: 'findNodeById', + value: function (e) { + var t = this.nodes.filter(function (t) { + return t.id == e; + }); + return 0 < t.length ? (((t = t[0]).visible = !0), t) : null; + }, + }, + { + key: 'getNodes', + value: function () { + return ( + L(Vd, 0, 0, 0, this._licenseKey), + (this.nodes || []).map(function (t) { + return t; + }) + ); + }, + }, + { + key: 'getEdges', + value: function () { + return ( + L(Vd, 0, 0, 0, this._licenseKey), + (this.links || []).map(function (t) { + return t; + }) + ); + }, + }, + { + key: 'getNodeById', + value: function (e) { + return ( + L(Vd, 0, 0, 0, this._licenseKey), + this.nodes.filter(function (t) { + return t.id == e; + })[0] + ); + }, + }, + { + key: 'getEdgeById', + value: function (e) { + return ( + L(Vd, 0, 0, 0, this._licenseKey), + this.links.filter(function (t) { + return t.id == e; + })[0] + ); + }, + }, + { + key: 'switchAnimate', + value: function (t) { + this.stage.fps = t ? 50 : -50; + }, + }, + { + key: 'setStaticMode', + value: function (t) { + L(Vd, 0, 0, 0, this._licenseKey), (this.stage.staticMode = t); + }, + }, + { + key: 'setSmoothWheelMode', + value: function (t) { + L(Vd, 0, 0, 0, this._licenseKey), (this.stage.smoothWheelMode = Boolean(t)); + }, + }, + { + key: 'setShowDetailScale', + value: function () { + (this.stage.showDetailScale = + Number(0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0.1) || 0.1), + L(Vd, 0, 0, 0, this._licenseKey); + }, + }, + { + key: 'setDragHideLine', + value: function (t) { + (this.stage.openDragHideEffect = Boolean(t)), L(Vd, 0, 0, 0, this._licenseKey); + }, + }, + { + key: 'openDragNodeRelateMove', + value: function (t) { + (this._dragMoveRelateNode = Boolean(t)), L(Vd, 0, 0, 0, this._licenseKey); + }, + }, + { + key: '_updateThumbnail', + value: function () { + this.stage.thumbnail.visible && this.stage.thumbnail.update(); + }, + }, + { + key: '_showThumbnail', + value: function (t) { + t ? this.stage.thumbnail.show() : this.stage.thumbnail.destroy(); + }, + }, + { + key: 'randomColor', + value: function () { + return ( + Math.floor(255 * Math.random()) + + ',' + + Math.floor(200 * Math.random()) + + ',' + + Math.floor(255 * Math.random()) + ); + }, + }, + { + key: 'buildVisualGraphData', + value: function (t, e) { + var n = 2 < arguments.length && void 0 !== arguments[2] && arguments[2], + i = new Map(), + r = + (t.forEach(function (t) { + (t.scale = 1), + (t.radius = t.radius || 30), + (t.x = t.x || Math.round(1e3 * Math.random())), + (t.y = t.y || Math.round(1e3 * Math.random())), + (t.cx = t.x), + (t.cy = t.y), + (t.selected = t.selected || !1), + i.set(t.id, t); + }), + []), + o = + (e.forEach(function (t) { + var e = i.get(t.source), + n = i.get(t.target); + e && ((e.outLinks = e.outLinks || []), e.outLinks.push({ source: e, target: n })), + n && ((n.inLinks = n.inLinks || []), n.inLinks.push({ source: e, target: n })), + null != n && + null != e && + r.push({ id: t.id || ''.concat(t.source, '-').concat(t.target), source: e, target: n }); + }), + []); + return ( + i.forEach(function (t, e) { + o.push(t); + }), + n && ((n = this.getViewCenter()), this.preGroupLayout(o, n)), + { nodes: o, links: r } + ); + }, + }, + { + key: 'preResetNodeCoords', + value: function (t) { + var n, + i, + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [100, 100], + r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 80, + o = !(3 < arguments.length && void 0 !== arguments[3]) || arguments[3], + a = [].concat(t), + s = + (a.sort(function (t, e) { + return ( + (e.inLinks || []).length + + (e.outLinks || []).length - + ((t.inLinks || []).length + (t.outLinks || []).length) + ); + }), + Math.PI * (3 - Math.sqrt(5))), + h = e[0], + c = e[1]; + a.forEach(function (t, e) { + (n = r * Math.sqrt((e += 0.5))), + (i = s * e), + 0 == e ? ((t = h), ((t = c).fixed = !0)) : ((t.x = h + n * Math.cos(i)), (t.y = c + n * Math.sin(i))); + }), + o && this.moveCenter(0 == this.scene.scaleRange[0] ? 0.1 : this.scene.scaleRange[0]); + }, + }, + { + key: 'showLoadProcess', + value: function () { + this.stage.showLoading( + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 'Loading', + 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0.1, + ), + L(Vd, 0, 0, 0, this._licenseKey); + }, + }, + { + key: 'hideLoadProcess', + value: function () { + this.stage.hideLoading(); + }, + }, + { + key: 'getViewCenter', + value: function () { + return { + x: this.stage.width / 2 - this.scene.translateX, + y: this.stage.height / 2 - this.scene.translateY, + }; + }, + }, + { + key: 'setSceneDragAble', + value: function () { + (this.scene.dragable = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0]), + L(Vd, 0, 0, 0, this._licenseKey); + }, + }, + { + key: 'excuteLocalLayout', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 'fastForce', + e = 1 < arguments.length ? arguments[1] : void 0, + n = 2 < arguments.length ? arguments[2] : void 0, + i = 3 < arguments.length && void 0 !== arguments[3] && arguments[3], + r = this, + o = (L(Vd, 0, 0, 0, this._licenseKey), new fu(t)), + a = { nodes: this.nodes, links: this.links }, + t = + (i && (a = r.getVisibleData()), + -1 == ['fastForce', 'kawakai', 'hierarchical', 'simulation'].indexOf(t) && 'radialTree' == t + ? ((i = r.miniSpanningTree()), o.addData(a.nodes, i)) + : o.addData(a.nodes, a.links), + r.getViewCenter()); + ((e = e || {}).center = [t.x, t.y]), + o.resetConfig(e), + (function t() { + cancelAnimationFrame(r.layoutLoopName), + o.finished + ? 'function' == typeof n && n() + : (o.excute(), r.refreshView(), (r.layoutLoopName = requestAnimationFrame(t))); + })(); + }, + }, + { + key: 'stopLayout', + value: function () { + cancelAnimationFrame(this.layoutLoopName); + }, + }, + { + key: 'edgeCut', + value: function (t) { + var e, + n, + i = {}, + r = []; + return ( + t.forEach(function (t) { + t.source.id != t.target.id && + ((e = ''.concat(t.source.id, '-').concat(t.target.id)), + (n = ''.concat(t.target.id, '-').concat(t.source.id)), + (i[e] && i[n]) || (r.push(t), (i[e] = !0), (i[n] = !0))); + }), + r + ); + }, + }, + { + key: 'excuteWorkerLayout', + value: function (t) { + var e, + n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 'fastForce', + i = 2 < arguments.length ? arguments[2] : void 0, + r = !(3 < arguments.length && void 0 !== arguments[3]) || arguments[3], + o = 4 < arguments.length ? arguments[4] : void 0; + L(Vd, 0, 0, 0, this._licenseKey), + cancelAnimationFrame(this.layoutLoopName), + 'dagre' != n && 'radial' != n + ? ((e = [0, 0]), + (e = (null != i && i.center) || this.getViewCenter()), + r && this.preGroupLayout(t.nodes, { x: e.x, y: e.y }), + vu(this, t, e, n, i, o)) + : this.excuteLocalLayout(n, i, o); + }, + }, + { + key: 'preGroupLayout', + value: function (t, o) { + var a, + e = [], + n = [], + s = + (t.forEach(function (t) { + (t.readFlag = !1), + (t.degree = (t.inLinks || []).length + (t.outLinks || []).length), + 1 < t.degree ? n.push(t) : 0 == t.degree && e.push(t); + }), + n.sort(function (t, e) { + return t.degree - e.degree; + }), + 2 * Math.PI * (3 - Math.sqrt(6))); + n.forEach(function (i, t) { + var e = [], + n = + ((i.outLinks || []).forEach(function (t) { + t.target.readFlag || e.push(t.target); + }), + (i.inLinks || []).forEach(function (t) { + t.source.readFlag || e.push(t.source); + }), + t * s), + r = 0 == e.length ? 50 : 100; + t % 2 == 0 && (r = -r), + (r = (50 * Math.random() + r) * Math.sqrt(0.2 + t)), + (i.x = o.x + Math.round(Math.random() * r) * Math.cos(n)), + (i.y = o.y + Math.round(Math.random() * r) * Math.sin(n)), + (i.readFlag = !0), + (a = 2 * i.radius), + e.forEach(function (t, e) { + var e = e + 12, + n = a * Math.sqrt(0.5 + e), + e = e * s; + (t.readFlag = !0), (t.x = i.x + n * Math.cos(e)), (t.y = i.y + n * Math.sin(e)); + }); + }), + e.forEach(function (t, e) { + var n = e * s, + e = e % 2 == 0 ? -500 : 500; + (t.x = o.x + Math.round(Math.random() * e) * Math.cos(n)), + (t.y = o.y + Math.round(Math.random() * e) * Math.sin(n)); + }); + }, + }, + { + key: 'clusterGroupLayout', + value: function () { + var a = this, + s = 0, + h = a.clusterGroups, + c = new Map(), + u = + (h.forEach(function (e) { + var t = e.childs, + n = { nodes: t, links: a.getConnectLinkOfNodes(t) }; + a.excuteWorkerLayout(n, 'fastForce', null, !1, function () { + s++; + }), + t.forEach(function (t) { + c.set(t.id, e.id); + }); + }), + setInterval(function () { + var e, n, i, t, r, o; + h.length == s && + (clearInterval(u), + a.zoomFit(), + (i = new Map()), + (t = a.clusterGroups.map(function (t, e) { + return ( + i.set(t.id, t), + { + id: t.id, + x: t.outerCircleCenter.x, + y: t.outerCircleCenter.y, + cx: t.outerCircleCenter.x, + cy: t.outerCircleCenter.y, + scale: 1, + radius: t.outerCircleRadius, + } + ); + })), + (r = new Set()), + a.links.forEach(function (t) { + (e = c.get(t.source.id)), + (n = c.get(t.target.id)), + e != n && null != e && null != n && r.add({ source: { id: e }, target: { id: n }, weight: 1 }); + }), + (o = { nodes: t, links: Array.from(r) }), + a.excuteWorkerLayout(o, 'fastForce', { noverlap: !0, charge: 50, autoRun: !0 }, !1, function () { + o.nodes.forEach(function (t) { + i.get(t.id).setLocation(t.cx, t.cy); + }), + a.zoomFit(); + })); + }, 1e3)); + }, + }, + { + key: 'activeAddData', + value: function (t, e) { + var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 'fastForce', + i = 3 < arguments.length ? arguments[3] : void 0, + r = 4 < arguments.length ? arguments[4] : void 0; + L(Vd, 0, 0, 0, this._licenseKey), new yu(this, i).activeAddData(t, e, n, i, this.nodes.length, r); + }, + }, + { + key: 'nodeCenterLayout', + value: function (e) { + var n, + t, + i, + r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 100, + o = this.findOneLevelNodes(e); + 0 != o.length && + (o.push(e), + (n = []), + (e.outLinks || []).forEach(function (t) { + -1 != o.indexOf(t.target) && n.push({ source: e, target: t.target, weight: 1 }); + }), + (e.inLinks || []).forEach(function (t) { + -1 != o.indexOf(t.source) && n.push({ source: e, target: t.source, weight: 1 }); + }), + (r = { + linkDistance: r, + charge: -450, + friction: 0.8, + linkStrength: 0.1, + gravity: 0.05, + center: [e.cx, e.cy], + }), + (t = [e.cx, e.cy]), + vu((i = this), { nodes: o, links: n }, t, 'fastForce', r, function () { + i.refreshView(); + })); + }, + }, + { + key: 'findShortestPath', + value: function (t, e) { + var n = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2], + i = wu(this, t, e, n, 'weight'), + r = []; + return 0 < i.length && ((i = i.path), (r = this.parsePathFromNodes(i, n))), r; + }, + }, + { + key: 'findAllPath', + value: function (t, e) { + var n, + i, + r = !(2 < arguments.length && void 0 !== arguments[2]) || arguments[2], + o = bu(this, t, e, r); + return 0 == o.length + ? new Array(0) + : ((n = this), + (i = []), + o.forEach(function (t) { + i.push(n.parsePathFromNodes(t, r)); + }), + i); + }, + }, + { + key: 'findCommonNeighbors', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + i = []; + return ( + t.forEach(function (e) { + var n = + (e.outLinks || []).map(function (t) { + return t.target; + }) || []; + (e.inLinks || []).forEach(function (t) { + n.push(t.source); + }), + t.forEach(function (t) { + e != t && + ((t.outLinks || []).forEach(function (t) { + -1 != n.indexOf(t.target) && i.push(t.target); + }), + (t.inLinks || []).forEach(function (t) { + -1 != n.indexOf(t.source) && i.push(t.source); + })); + }); + }), + p(new Set(i)) + ); + }, + }, + { + key: 'parsePathFromNodes', + value: function () { + for ( + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = !(1 < arguments.length && void 0 !== arguments[1]) || arguments[1], + n = [], + i = t.length - 1, + r = 0; + r < i; + r++ + ) + n.push(t[r] + '-' + t[r + 1]); + return e + ? this.links.filter(function (t) { + return -1 != n.indexOf(t.source.id + '-' + t.target.id); + }) + : this.links.filter(function (t) { + return ( + -1 != n.indexOf(t.source.id + '-' + t.target.id) || -1 != n.indexOf(t.target.id + '-' + t.source.id) + ); + }); + }, + }, + { + key: 'getConnectedComponents', + value: function () { + return Cu(this.nodes, 0 < arguments.length && void 0 !== arguments[0] && arguments[0]); + }, + }, + { + key: 'detecyCycles', + value: function () { + var t = !(0 < arguments.length && void 0 !== arguments[0]) || arguments[0], + e = new Set(), + n = [], + i = [], + r = + (this.links.forEach(function (t) { + t.source.id != t.target.id && + (n.push(t.source.id), i.push(t.target.id), e.add(t.source.id), e.add(t.target.id)); + }), + Array.from(e)); + return (t ? Pu : Tu)(r, n, i); + }, + }, + { + key: 'findCycles', + value: function (e) { + var n = new Set(), + i = [], + r = [], + t = + (this.links.forEach(function (t) { + t.source.id != t.target.id && + (i.push(t.source.id), r.push(t.target.id), n.add(t.source.id), n.add(t.target.id)); + }), + Array.from(n)), + t = new Au(t, i, r).getCycles(), + o = + (t.forEach(function (t) { + t.push(t[0]); + }), + 0 < t.length && + null != e && + (t = t.filter(function (t) { + return t.includes(e.id); + })), + this); + return t.map(function (t) { + return o.parsePathFromNodes(t); + }); + }, + }, + { + key: 'miniSpanningTree', + value: function () { + var t = this.nodes, + e = this.links, + n = + (e.sort(function (t, e) { + return t.weight - e.weight; + }), + []), + i = { index: {}, parent: [], count: 0 }; + t.forEach(function (t) { + var e; + (e = i), (t = t.id), void 0 === e.index[t] && ((e.count += 1), (e.index[t] = e.parent.push(-e.count))); + }); + for (var r, o = 0; o < e.length && !(i.count <= 1); o++) { + var a = h(i, e[o].source.id), + s = h(i, e[o].target.id); + a !== s && 0 < a && 0 < s && (((r = i).parent[s] = a), --r.count, n.push(e[o])); + } + return n; + function h(t, e) { + var n = t.index[e]; + if (void 0 === n) return -1; + for (; 0 <= n; ) (e = n), (n = t.parent[n]); + return e; + } + }, + }, + { + key: 'kruskal', + value: function () { + return (function (t, e) { + var n = 0 < arguments.length && void 0 !== t ? t : [], + i = 1 < arguments.length && void 0 !== e ? e : [], + r = [], + o = new Map(), + a = []; + return ( + n.forEach(function (t) { + o.set(t.id, new Gl(t.id)); + }), + (a = [].concat(i)).sort(function (t, e) { + return t.weight - e.weight; + }), + a.forEach(function (t) { + var e = t.source.id, + n = t.target.id, + e = o.get(e), + n = o.get(n); + e.find() !== n.find() && (r.push(t), e.union(n)); + }), + r + ); + })(this.nodes, this.links); + }, + }, + { + key: 'hdeLayout', + value: function () { + var n, + t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [], + i = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 100; + (n = new Ql( + (t = (t = t).filter(function (t) { + return (t.degree = (t.inLinks || []).length + (t.outLinks || []).length), 1 <= t.degree; + })), + e, + )), + t.forEach(function (t) { + var e = n.getNodePosition(t.id); + (t.x = e[0] * i), (t.y = e[1] * i); + }); + }, + }, + { + key: 'community', + value: function (t) { + return (function (t, e, n) { + var i = 1 < arguments.length && void 0 !== e ? e : [], + r = 2 < arguments.length && void 0 !== n ? n : [], + o = null; + if ('chineseWhisper' == t) return Zu(i, r); + 'louvain' == t + ? (o = new Ku(i, r)) + : 'newman' == t + ? (o = new Gu(i, r)) + : 'weakCommpent' == t + ? (o = new qu(i, r)) + : 'biCommpent' == t + ? (o = new Hu(i, r)) + : 'kmeans' == t && (o = new Qu(i)); + r = new Map(); + return (r = o ? o.applay() : r); + })(t, this.nodes, this.links); + }, + }, + { + key: 'centrality', + value: function () { + return new Vu(this.nodes, this.links); + }, + }, + { + key: 'findNodeNLevelAllNodes', + value: function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1, + n = []; + if (t && !(e < 1)) { + for (var i, r = { 0: [t] }, o = 1; o <= e; ) + !(function () { + var t = r[o - 1], + n = []; + t.forEach(function (t) { + var e = (t.inLinks || []).map(function (t) { + return t.source; + }), + t = (t.outLinks || []).map(function (t) { + return t.target; + }); + e.concat(t).forEach(function (t) { + -1 == n.indexOf(t) && n.push(t); + }); + }), + (r[o] = n), + o++; + })(); + for (i in r) n = n.concat(r[i]); + } + return n; + }, + }, + { + key: 'findNLevelNodes', + value: function (t) { + var r, + o, + a, + s = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1; + return null == t || s < 1 + ? [t] + : ((r = []), + (o = {}), + (a = []), + null != t && + (a.push(t), + (function e(t, n) { + var i; + 1 < n + ? (s == n && -1 == r.indexOf(t) && r.push(t), + (i = s - n), + (t.inLinks || []).forEach(function (t) { + -1 == r.indexOf(t.source) && + (r.push(t.source), null == o[i] && (o[i] = []), o[i].push(t.source)); + }), + (t.outLinks || []).forEach(function (t) { + -1 == r.indexOf(t.target) && + (r.push(t.target), null == o[i] && (o[i] = []), o[i].push(t.target)); + }), + null != o[i] && + o[i].forEach(function (t) { + e(t, n - 1); + })) + : 1 == n && + ((t.inLinks || []).forEach(function (t) { + -1 == r.indexOf(t.source) && a.push(t.source); + }), + (t.outLinks || []).forEach(function (t) { + -1 == r.indexOf(t.target) && a.push(t.target); + })); + })(t, s)), + a); + }, + }, + { + key: 'addToSelectedElements', + value: function () { + var e = this; + (0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : []).forEach(function (t) { + (t.selected = !0), e.scene.addToSelected(t); + }), + e.refreshView(); + }, + }, + { + key: 'createBaseAnimate', + value: function () { + return Fl(0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}); + }, + }, + { + key: 'createTimelineAnimate', + value: function () { + return Fl.timeline(0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}); + }, + }, + { + key: 'registEventListener', + value: function (t, e, n) { + null != t && + null != e && + null != n && + (L(Vd, 0, 0, 0, this._licenseKey), (e = Wl[t][e])) && + 'function' == typeof n && + (this.config[t][e] = n); + }, + }, + { + key: 'removeEventListener', + value: function (t, e) { + null != t && null != e && (e = Wl[t][e]) && delete this.config[t][e]; + }, + }, + { + key: 'removeAllEventListener', + value: function (t) { + if (null != t) { + var e = this.config[t]; + if (e) for (var n in e) delete e[n]; + } + }, + }, + { + key: 'registRightMenu', + value: function (t, e) { + -1 != ['scene', 'node', 'link', 'group'].indexOf(t) && + (L(Vd, 0, 0, 0, this._licenseKey), (e = e || {}).hasOwnProperty('show')) && + 'function' == typeof e.show && + e.hasOwnProperty('hide') && + 'function' == typeof e.hide && + (this.config.hasOwnProperty('rightMenu') || (this.config.rightMenu = {}), + (this.config.rightMenu[''.concat(t, 'Menu')] = e)); + }, + }, + { + key: 'reConfigNodeCluster', + value: function (e) { + var i, r; + e && + 'object' == n(e) && + (L(Vd, 0, 0, 0, this._licenseKey), + ((i = this).config.nodeClusters = e), + (r = null), + i.nodes.forEach(function (t) { + (r = e[t.type]) && + ((t.fillColor = r.color || i.config.node.color), + (t.shape = r.shape || i.config.node.shape), + (t.size = r.size || i.config.node.size), + 'rect' == t.shape && + (null != r.width && (t.width = r.width), null != r.height) && + (t.height = r.height), + (t.font = r.font || i.config.node.label.font), + (t.fontColorfontColor = r.fontColor || i.config.node.label.color), + (t.borderWidth = r.borderWidth || i.config.node.borderWidth), + (t.borderColor = r.borderColor || i.config.node.borderColor), + (t.selectedBorderWidth = r.selectedBorderWidth || i.config.node.selected.borderWidth), + (t.selectedBorderColor = r.selectedBorderColor || i.config.node.selected.borderColor), + (t.shadowColor = r.shadowColor || i.config.node.selected.shadowColor), + (t.textPosition = r.textPosition || i.config.node.label.textPosition), + (t.tagColor = r.tagColor || i.config.node.tagColor), + r.image) && + t.setImage(r.image, function () { + i.refreshView(); + }); + }), + i.refreshView()); + }, + }, + { + key: 'reConfigLinkCluster', + value: function (e) { + var i, r; + e && + 'object' == n(e) && + (L(Vd, 0, 0, 0, this._licenseKey), + ((i = this).config.linkClusters = e), + (r = null), + i.links.forEach(function (t) { + (r = e[t.type]) && + ((t.strokeColor = r.color || i.config.link.color), + (t.lineWidth = r.lineWidth || i.config.link.lineWidth), + (t.lineType = r.lineType || i.config.link.lineType), + (t.lineDash = r.lineDash || i.config.link.lineDash), + (t.selectedColor = r.selectedColor || i.config.link.selected.color), + (t.font = r.font || i.config.link.label.font), + (t.fontColor = r.fontColor || i.config.link.label.color), + (t.showArrow = r.showArrow || i.config.link.showArrow), + (t.labelBackGround = r.labelBackGround || i.config.link.label.background)); + }), + i.refreshView()); + }, + }, + { + key: 'definedNodePaintFunc', + value: function (t) { + 'function' == typeof t && + (L(Vd, 0, 0, 0, this._licenseKey), (this._defindPaintFuncCache.nodePaintFunc = t)); + }, + }, + { + key: 'definedNodeInBoundFunc', + value: function (t) { + 'function' == typeof t && (this._defindPaintFuncCache.nodeInBoundFunc = t); + }, + }, + { + key: 'definedLinkPaintFunc', + value: function (t) { + 'function' == typeof t && + (L(Vd, 0, 0, 0, this._licenseKey), (this._defindPaintFuncCache.linePaintFunc = t)); + }, + }, + { + key: 'definedLinkInBoundFunc', + value: function (t) { + 'function' == typeof t && (this._defindPaintFuncCache.linkInBoundFunc = t); + }, + }, + { + key: 'registIconFonts', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + r = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 200, + o = 2 < arguments.length ? arguments[2] : void 0, + a = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : '#fff', + s = this, + h = Math.round(r / 2); + t.forEach(function (t) { + var n = document.createElement('canvas'), + i = n.getContext('2d'); + (n.width = n.height = r), + (i.textBaseline = 'middle'), + (i.textAlign = 'center'), + (i.font = 'normal '.concat(r, 'px ').concat(o)), + (i.fillStyle = t.color || a), + i.fillText(t.content, h, h), + (s._iconImageCache[t.name] = e(e({}, t), {}, { size: r, image: n })); + }); + }, + }, + { + key: 'mergeNodes', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 1 < arguments.length ? arguments[1] : void 0; + if (Array.isArray(t) && t.length < 2) return null; + var n = this, + i = w(10), + r = new Map(), + o = new Set(); + t.forEach(function (t) { + r.set(t.id, t), + (t.outLinks || []).forEach(function (t) { + return o.add(t); + }), + (t.inLinks || []).forEach(function (t) { + return o.add(t); + }), + (t.visible = !1); + }); + for (var a, s, h, c, u = [], l = Array.from(o), d = null, f = {}, g = 0; g < l.length; g++) + (a = (d = l[g]).source.id), + (s = d.target.id), + (d.visible = !1), + (h = ''.concat(a, '-').concat(i)), + (c = ''.concat(i, '-').concat(s)), + f[h] || + f[c] || + (null != r.get(a) + ? null == r.get(s) && + ((f[c] = !0), + (f[''.concat(s, '-').concat(i)] = !0), + u.push({ + id: 'virtul-s-' + w(12), + source: i, + target: s, + lineWidth: 4, + lineDash: [5, 8, 5], + showArrow: !1, + })) + : ((f[h] = !0), + (f[''.concat(i, '-').concat(a)] = !0), + u.push({ + id: 'virtul-t-' + w(12), + source: a, + target: i, + lineWidth: 4, + lineDash: [5, 8, 5], + showArrow: !1, + }))); + var p = this.getNodesCoodinateCenter(t), + e = this.addNode({ + id: i, + label: e, + image: 'data:image/svg+xml;base64,'.concat( + btoa( + '', + ), + ), + shape: 'circle', + scale: 2, + color: '250,250,250', + borderWidth: 2, + font: 'normal 12px YaHei', + textPosition: 'Bottom_Center', + type: 'mergeNode', + }), + y = + ((e.cx = p[0]), (e.cy = p[1]), (e.orginCoodinate = p), (e.containNodes = t), (e.containLinks = l), -1); + return ( + t.forEach(function (t) { + -1 != (y = n.nodes.indexOf(t)) && n.nodes.splice(y, 1); + }), + l.forEach(function (t) { + -1 != (y = n.links.indexOf(t)) && n.links.splice(y, 1); + }), + this.addEdges(u), + e + ); + }, + }, + { + key: 'expandNode', + value: function (t) { + var e, n, i; + 'mergeNode' == t.type && + ((e = t.orginCoodinate), + (n = [t.cx - e[0], t.cy - e[1]]), + (i = this), + t.containNodes.forEach(function (t) { + (t.cx = t.cx + n[0]), (t.cy = t.cy + n[1]), (t.visible = !0), i.nodes.push(t); + }), + t.containLinks.forEach(function (t) { + (t.visible = !0), i.links.push(t); + }), + this.deleteNode(t)); + }, + }, + { + key: 'getNodesCoodinateCenter', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = 0, + n = 0; + return ( + t.forEach(function (t) { + (e += t.cx), (n += t.cy); + }), + (e /= t.length), + (n /= t.length), + [Math.round(e), Math.round(n)] + ); + }, + }, + { + key: 'getConnectLinkOfNodes', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : [], + e = new Map(), + n = new Set(); + t.forEach(function (t) { + e.set(t.id, t), + (t.outLinks || []).forEach(function (t) { + return n.add(t); + }), + (t.inLinks || []).forEach(function (t) { + return n.add(t); + }); + }); + var i, + r, + o = []; + return ( + Array.from(n).forEach(function (t) { + (i = t.source.id), (r = t.target.id), null != e.get(i) && null != e.get(r) && o.push(t); + }), + o + ); + }, + }, + { + key: 'undoAction', + value: function () { + this._undoManager.undo(this); + }, + }, + { + key: 'getViewSize', + value: function () { + return { width: this.stage.width, height: this.stage.height }; + }, + }, + { + key: 'setBackGroundColor', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : '#fff'; + t && (L(Vd, 0, 0, 0, this._licenseKey), this.stage.setBackGroundColor(t)); + }, + }, + { + key: 'setBackGroundImage', + value: function (t) { + var e = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 1; + t && (L(Vd, 0, 0, 0, this._licenseKey), this.stage.setBackGroundImage(t, e)); + }, + }, + { + key: 'newOrgChart', + value: function () { + return new Jl( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newXmindChart', + value: function () { + return new Kl( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newSankeyChart', + value: function () { + return new $l( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newRadialTree', + value: function () { + return new td( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newCompactTree', + value: function () { + return new ed( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newIndentTree', + value: function () { + return new id( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newPackChart', + value: function () { + return new nd( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newArcLineChart', + value: function () { + return new md( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'newFlowChart', + value: function () { + return new xd( + this, + 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, + 1 < arguments.length ? arguments[1] : void 0, + ); + }, + }, + { + key: 'd3CustomTools', + value: function () { + return iu; + }, + }, + { + key: 'getDarge', + value: function () { + return wh; + }, + }, + { + key: 'getHierachyLayout', + value: function () { + return su(); + }, + }, + { + key: 'getXmindLayout', + value: function () { + return Rd; + }, + }, + { + key: 'getSimulationLayout', + value: function () { + return L(Vd, 0, 0, 0, this._licenseKey), new zd(); + }, + }, + { + key: 'checkLicense', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : ''; + return null != t && 'string' == typeof t && _(t, Vd); + }, + }, + { + key: 'setCopyRightInfo', + value: function () { + var t = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}; + (this.stage.copyRightConf = { + text: t.text || '', + color: t.color || 'rgba(80,80,80,0.5)', + font: t.font || 'italic 20px Arial', + bottom: t.bottom || 24, + right: t.right || 100, + }), + this.stage.resize(); + }, + }, + { + key: 'autoGroupLayout', + value: function (t) { + var e = [], + n = + ((e = t.filter(function (t) { + var e = (t.outLinks || []).map(function (t) { + return t.target.id; + }), + n = (t.inLinks || []).map(function (t) { + return t.source.id; + }), + e = new Set(e.concat(n)); + return (t.degree = e.size), 1 < e.size; + })).sort(function (t, e) { + return t.degree - e.degree; + }), + e.forEach(function (t) { + var e = []; + (t.readFlag = !0), + (t.outLinks || []).forEach(function (t) { + t.target.readFlag || e.push(t.target); + }), + (t.inLinks || []).forEach(function (t) { + t.source.readFlag || e.push(t.source); + }), + (t.children = e); + }), + e.forEach(function (e) { + !(function (t, e, n) { + for ( + var i = 1 < arguments.length && void 0 !== e ? e : [], + r = 2 < arguments.length && void 0 !== n ? n : { firstLayerNum: 8, layerDistance: 100 }, + o = i.length, + a = r.firstLayerNum || 8, + s = 1, + h = t.x, + c = t.y, + u = r.layerDistance || 100, + l = {}; + 0 < o; + + ) { + var d = s * a, + f = o - d; + (l[s] = f <= 0 ? o : d), (o = f), s++; + } + for (var g = 0, p = 1; p < s; p++) { + var y = l[p], + v = u * p; + t.childRadius = v; + for (var m = (Math.PI / 2) * p * 0.6, x = 0; x < y; x++) { + var w, + b = i[g]; + b && + ((w = (2 * x * Math.PI) / y - m), (b.x = h + v * Math.cos(w)), (b.y = c + v * Math.sin(w))), + g++; + } + } + })(e, e.children), + e.children.forEach(function (t) { + (t.distanceX = t.x - e.x), (t.distanceY = t.y - e.y); + }); + }), + new Map()), + i = + (e.forEach(function (t) { + n.set(t.id, t); + }), + []), + r = 1, + o = + (e.forEach(function (t) { + var e = t.id; + (t.outLinks || []).forEach(function (t) { + null != n.get(t.target.id) && + i.push({ id: 'link-' + r++, source: e, target: t.target.id, weight: 1 }); + }), + (t.inLinks || []).forEach(function (t) { + null != n.get(t.source.id) && + i.push({ id: 'link-' + r++, source: t.source.id, target: e, weight: 1 }); + }); + }), + e.map(function (t) { + return { id: t.id, radius: t.childRadius || t.radius, scale: 1, x: t.cx, y: t.cy }; + })), + a = this, + t = this.buildVisualGraphData(o, i); + this.excuteWorkerLayout(t, 'fastForce', { autoRun: !0 }, !1, function () { + o.forEach(function (e) { + var t = n.get(e.id); + t && + ((t.x = e.cx), + (t.y = e.cy), + t.children.forEach(function (t) { + (t.x = e.cx + t.distanceX), (t.y = e.cy + t.distanceY); + })); + }), + a.zoomFit(); + }); + }, + }, + ]), + r + ); + })(); +!(function () { + function t(t, e, n, i, r) { + this.roundRect + ? (this.beginPath(), this.roundRect(t, e, n, i, r < 0 ? 0 : r)) + : r + ? (i < 2 * (r = n < 2 * r ? n / 2 : r) && (r = i / 2), + this.beginPath(), + this.moveTo(t + r, e), + this.arcTo(t + n, e, t + n, e + i, r), + this.arcTo(t + n, e + i, t, e + i, r), + this.arcTo(t, e + i, t, e, r), + this.arcTo(t, e, t + n, e, r), + this.closePath()) + : (this.beginPath(), this.rect(t, e, n, i)); + } + function e(t, e, n, i, r) { + (r = void 0 === r ? 3 : r) < 3 && (r = 3); + function o(t, e, n, i) { + var r = n * Math.cos(i), + n = n * Math.sin(i); + return { x: (r += t), y: (n += e) }; + } + var a = Math.sqrt((i - e) * (i - e) + (n - t) * (n - t)), + s = Math.asin(Math.abs(i - e) / a), + a = + (n < t && e < i ? (s = Math.PI - s) : n < t && i < e ? (s += Math.PI) : t < n && i < e && (s = 2 * Math.PI - s), + o(t, e, a - 2 * r, s)), + h = a.x, + a = a.y, + c = o(h, a, r, s - 0.5 * Math.PI), + u = o(h, a, 2 * r, s - 0.5 * Math.PI), + l = o(h, a, r, s + 0.5 * Math.PI), + h = o(h, a, 2 * r, s + 0.5 * Math.PI); + this.moveTo(t, e), + this.lineTo(c.x, c.y), + this.lineTo(u.x, u.y), + this.lineTo(n, i), + this.lineTo(h.x, h.y), + this.lineTo(l.x, l.y), + this.closePath(); + } + function n(t, e, n, i, r) { + var n = n - t, + i = i - e, + o = Math.sqrt(n * n + i * i), + a = i / o, + s = n / o, + h = []; + h.push(0, 0); + for (var c = 0; c < r.length; c += 2) { + var u = r[c], + l = r[c + 1]; + h.push(u < 0 ? o + u : u, l); + } + for (h.push(o, 0), c = r.length; 0 < c; c -= 2) (u = r[c - 2]), (l = r[c - 1]), h.push(u < 0 ? o + u : u, -l); + for (h.push(0, 0), c = 0; c < h.length; c += 2) + (u = h[c] * s - h[c + 1] * a + t), + (l = h[c] * a + h[c + 1] * s + e), + 0 === c ? this.moveTo(u, l) : this.lineTo(u, l); + } + function i(t, e, n, i, r) { + var o = e - r * Math.cos(i), + a = n - r * Math.sin(i), + s = e + 0.8 * r * Math.cos(i), + h = n + 0.8 * r * Math.sin(i), + c = o + (r / 1.2) * Math.cos(i + 0.3 * Math.PI), + u = a + (r / 1.2) * Math.sin(i + 0.3 * Math.PI), + o = o + (r / 1.2) * Math.cos(i - 0.3 * Math.PI), + a = a + (r / 1.2) * Math.sin(i - 0.3 * Math.PI); + t.beginPath(), t.moveTo(e, n), t.lineTo(c, u), t.lineTo(s, h), t.lineTo(o, a), t.closePath(); + } + OffscreenCanvasRenderingContext2D && (OffscreenCanvasRenderingContext2D.prototype.DGraphRoundRect = t), + (CanvasRenderingContext2D.prototype.DGraphRoundRect = t), + OffscreenCanvasRenderingContext2D && (OffscreenCanvasRenderingContext2D.prototype.drawArrowLine = e), + (CanvasRenderingContext2D.prototype.drawArrowLine = e), + OffscreenCanvasRenderingContext2D && (OffscreenCanvasRenderingContext2D.prototype.paintCustomArrow = n), + (CanvasRenderingContext2D.prototype.paintCustomArrow = n), + OffscreenCanvasRenderingContext2D && (OffscreenCanvasRenderingContext2D.prototype.drawArrowTail = i), + (CanvasRenderingContext2D.prototype.drawArrowTail = i), + (requestAnimationFrame = + window.requestAnimationFrame || + window.mozRequestAnimationFrame || + window.webkitRequestAnimationFrame || + window.msRequestAnimationFrame || + window.oRequestAnimationFrame || + function (t) { + setTimeout(t, 1e3 / 60); + }), + (cancelAnimationFrame = + window.cancelAnimationFrame || + window.webkitCancelAnimationFrame || + window.mozCancelAnimationFrame || + window.cancelRequestAnimationFrame || + window.webkitCancelRequestAnimationFrame || + window.mozCancelRequestAnimationFrame || + function (t) { + clearTimeout(t); + }); +})(); +export { jd as default }; diff --git a/src/components/timeAxis.vue b/src/components/timeAxis.vue index b4c3e73..f8a9dda 100644 --- a/src/components/timeAxis.vue +++ b/src/components/timeAxis.vue @@ -125,6 +125,7 @@ watch( ) + // 让 active-needle 标定在 timeList 最后一个时间点 const showHidden = computed(() => { if (!timeList.value || timeList.value.length === 0) return {} @@ -198,26 +199,22 @@ const handlePointPointerDown = (e) => { // 拖动结束时输出当前时间 pause() // 拖动或点击时暂停自动播放 const currentTimes = TansTimestamp(currentTime.value, "YYYY-MM-DD HH:mm:ss") - emit("slide:pointerUp", currentTimes) - document.removeEventListener("pointermove", handlePointerMove) document.removeEventListener("pointerup", handlePointerUp) } - document.addEventListener("pointermove", handlePointerMove, { passive: true }) document.addEventListener("pointerup", handlePointerUp) } -// 点击时间段时的处理函数 const timeSectionWidth = 4 // 与样式保持一致 const handleSectionPointerDown = (time) => { pause() // 计算该时间点的中心位置 const left = getTimeSectionLeft.value(time) + timeSectionWidth / 2 currentPosition.value = left - currentTime.value = TansTimestamp(new Date(time), "YYYY-MM-DD HH:mm:ss") - emit("click:pointerDown", currentTime.value) + currentTime.value = time // 保持与 timeList 精确一致 + emit("click:pointerDown", time) // 直接发送原始时间 } //重置时间轴 @@ -232,9 +229,11 @@ const reset = () => { play() } } + onMounted(() => { play() }) + // 组件卸载时清理事件监听器 onUnmounted(() => { document.removeEventListener("pointermove", () => {}) diff --git a/src/service/api/groupEvolution.js b/src/service/api/groupEvolution.js index 810cb5f..a439e23 100644 --- a/src/service/api/groupEvolution.js +++ b/src/service/api/groupEvolution.js @@ -20,8 +20,13 @@ export function getPostByUtcTime(utcTime) { return http.get(`/groupEvolution/identify/posts?date=${utcTime}`) } +//群体识别发现页面关系图 +export function getRelationGraphByUtcTime(utcTime) { + return http.get(`/groupEvolution/identify/relation?date=${utcTime}`) +} // 3.群体成员演化分析 +<<<<<<< HEAD // 3.1 获取时间线数据 export function getGroupMemberTimeLine() { return http.get(`/groupEvolution/groupMember/timeline`) @@ -40,4 +45,9 @@ export function getGroupMemberChart() { // 3.4 群体演化信息 export function getGroupMemberEvolutionInfoByTime(date) { return http.get(`/groupEvolution/groupMember/changeList?date=${date}`) +======= +// 3.1 群体成员演化信息列表信息 +export function getGroupMemberInfoList() { + return http.get(`/groupEvolution/groupMember/infoList`) +>>>>>>> 90124585f151f0a2286527a4c2e9232b86951cfb } diff --git a/src/store/groupEvolution/index.js b/src/store/groupEvolution/index.js index 9719fb8..4b40c7b 100644 --- a/src/store/groupEvolution/index.js +++ b/src/store/groupEvolution/index.js @@ -24,6 +24,7 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { groupList: [], chartData: {}, timeList: [], + graph: {}, chartsData: { topSelfMedia: { xAxis: [ @@ -36,7 +37,7 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { "21:57:47", "22:58:12" ], - yAxis: [0, 0.5, 1.0, 1.5, 2.0, 2.5], + yAxis: [0.5, 1.0, 1.5, 2.0, 2.5], data: [1.0, 0.99, 1.0, 1.0, 1.01, 2.03, 1.2, 0.99] }, officialMedia: { @@ -50,7 +51,7 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { "21:57:47", "22:58:12" ], - yAxis: [0, 0.5, 1.0, 1.5], + yAxis: [0.8, 1.0, 1.2], data: [1.0, 0.99, 1.0, 1.0, 1.01, 1.01, 1.2, 0.99] }, ordinaryMedia: { @@ -70,45 +71,52 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { }, wordCloudData: [ { - text: "佩洛西", + text: "主权权益", top: 115.5, left: 215.5, - width: 109, - height: 40, - fontSize: 28, + width: 80, + height: 22, + fontSize: 13, opacity: 1 }, - { text: "中国", top: 183.5, left: 69.5, width: 73, height: 35, fontSize: 22, opacity: 1 }, { - text: "中国人民解放军", + text: "局座预言", + top: 80, + left: 69.5, + width: 73, + height: 22, + fontSize: 12, + opacity: 0.7 + }, + { + text: "吃瓜", top: 72.5, left: 132.5, - width: 123, + width: 50, height: 22, fontSize: 12, opacity: 1 }, { - text: "中美关系", - top: 171.5, + text: "中国海警", + top: 140, left: 212.5, - width: 81, - height: 22, - fontSize: 14, + width: 130, + height: 40, + fontSize: 22, opacity: 0.8 }, - { text: "台独", top: 135.5, left: 42.5, width: 57, height: 24, fontSize: 16, opacity: 1 }, { - text: "台海和平", - top: 228.5, - left: 230.5, + text: "菲律宾", + top: 150, + left: 50, width: 81, height: 22, fontSize: 14, opacity: 0.8 }, { - text: "坚决反对", + text: "手指", top: 200.5, left: 38.5, width: 73, @@ -117,34 +125,44 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { opacity: 0.7 }, { - text: "联合公报", - top: 241.5, - left: 130.5, + text: "装甲船", + top: 50, + left: 160.5, width: 73, height: 19, fontSize: 12, opacity: 0.7 }, { - text: "有力反制", + text: "登检", top: 211.5, left: 143.5, - width: 73, + width: 50, height: 19, fontSize: 12, opacity: 1 }, - { text: "白宫", top: 176.5, left: 15.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }, - { text: "内政", top: 87.5, left: 36.5, width: 53, height: 22, fontSize: 14, opacity: 1 }, - { text: "访台", top: 103.5, left: 95.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }, - { text: "领土", top: 57.5, left: 72.5, width: 49, height: 19, fontSize: 12, opacity: 0.6 }, - { text: "原则", top: 77.5, left: 264.5, width: 49, height: 19, fontSize: 12, opacity: 0.7 }, - { text: "台湾", top: 195.5, left: 287.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 } + { text: "执法", top: 176.5, left: 15.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }, + { text: "现场画面", top: 110, left: 26, width: 90, height: 22, fontSize: 14, opacity: 1 }, + { text: "渔民", top: 103.5, left: 95.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }, + { text: "包夹", top: 57.5, left: 72.5, width: 49, height: 19, fontSize: 12, opacity: 0.6 }, + { text: "枪支", top: 77.5, left: 264.5, width: 49, height: 19, fontSize: 12, opacity: 0.7 }, + { text: "解决", top: 195.5, left: 287.5, width: 49, height: 19, fontSize: 12, opacity: 0.8 }, + { + text: "大刀长矛", + top: 186, + left: 200.5, + width: 70, + height: 19, + fontSize: 12, + opacity: 0.8 + } ], posts: [] }), actions: { - async initializeGroupList(time = "2024-05-16 16:56:04") { + //获取群体列表数据 + async initializeGroupList(time = "") { const res = await getGroupEvolutionGroupList(time) if (res.code != 200) return const iconMap = { @@ -159,6 +177,8 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { })) }) }, + + //获取群体规模演化图数据 async initializeGroupScaleChart() { const res = await getGroupEvolutionGroupScaleChart() if (res.code != 200) return @@ -178,15 +198,36 @@ export const useGroupDiscoveryStore = defineStore("groupDiscovery", { this.chartData = resultObj }, + //获取时间轴参数 async initialGraphTimestamp() { const res = await getGroupEvolutionTimeLine() if (res.code != 200) return this.timeList = res.data }, - async initialGraphByUtcTime() {}, + //根据时间参数获取节点数据 + async initialGraphByUtcTime(utcTime = "") { + const res = await getRelationGraphByUtcTime(utcTime) + if (res.code != 200) return + const newSet = new Set() + this.graph["links"] = res.data.links + this.graph["nodes"] = res.data.nodes + .filter((node) => { + if (!newSet.has(node.name)) { + newSet.add(node.name) + return true + } + return false + }) + .map((node) => ({ + id: node.name, + name: node.name, + groupId: node.groupId + })) + }, // 通过时间来获取帖文列表 + //根据时间参数获取贴文数据 async initialPostByUtcTime(utcTime) { } @@ -533,13 +574,13 @@ export const useGroupMemberStore = defineStore("groupMember", { id: 1, type: "群体一", focusedTopic: "#中国海警首次登检菲律宾#", - value: [10, 5, 15, 5], + value: [10, 5, 15, 5] }, { id: 2, type: "群体二", focusedTopic: "#中国海警首次登检菲律宾#", - value: [10, 20, 15, 5], + value: [10, 20, 15, 5] } */ groupList: [], @@ -567,31 +608,31 @@ export const useGroupMemberStore = defineStore("groupMember", { } ], chartData: { - xAxisData: ["07:57:46", "09:30:14", "09:57:32", "10:04:47", "10:12:57"], - yAxisRange: { min: 0, max: 25, interval: 5}, - seriesList: [ - { - data: [0.9237, 0.14507, 0, 0, 0], - name: "分裂指数", - themeColor: "#2AB8FD" - }, - { - data: [9.8011, 21.3123, 10.4338, 14.1912, 10.1523], - name: "合并指数", - themeColor: "#02D7DA" - }, - { - data: [1.9057, 1.5123, 1.0338, 0.5912, 0.1523], - name: "收缩指数", - themeColor: "#FFDA09" - }, - { - data: [15.1119, 6.5123, 10.6338, 9.5912, 4.1523], - name: "扩展指数", - themeColor: "#EB57B0" - } - ] - }, + xAxisData: ["07:57:46", "09:30:14", "09:57:32", "10:04:47", "10:12:57"], + yAxisRange: { min: 0, max: 25, interval: 5 }, + seriesList: [ + { + data: [0.9237, 0.14507, 0, 0, 0], + name: "分裂指数", + themeColor: "#2AB8FD" + }, + { + data: [9.8011, 21.3123, 10.4338, 14.1912, 10.1523], + name: "合并指数", + themeColor: "#02D7DA" + }, + { + data: [1.9057, 1.5123, 1.0338, 0.5912, 0.1523], + name: "收缩指数", + themeColor: "#FFDA09" + }, + { + data: [15.1119, 6.5123, 10.6338, 9.5912, 4.1523], + name: "扩展指数", + themeColor: "#EB57B0" + } + ] + }, chartsData: { topSelfMedia: [ { @@ -963,7 +1004,7 @@ export const useAnomalousGroup = defineStore("anomalousGroup", { state: () => ({ groupList: [ { - id:1, + id: 1, type: "异常社团组一", abnormalGroup: [ { @@ -979,7 +1020,7 @@ export const useAnomalousGroup = defineStore("anomalousGroup", { ] }, { - id:2, + id: 2, type: "异常社团组二", abnormalGroup: [ { diff --git a/src/store/keyNodeRecognition/index.js b/src/store/keyNodeRecognition/index.js index cba3207..dbc616e 100644 --- a/src/store/keyNodeRecognition/index.js +++ b/src/store/keyNodeRecognition/index.js @@ -76,7 +76,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: huanqiuImg, number: "3126.1w", fancyNumber: 31260000.1, - transmit: "8h/1次", + transmit: "8h/次", time: "2024.3.12", posts: "1.8w", atten: "76", @@ -89,7 +89,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: xinlangImg, number: "5005.8w", fancyNumber: 50050000.8, - transmit: "10h/1次", + transmit: "10h/次", time: "2024.1.5", posts: "2.1w", atten: "98", @@ -102,7 +102,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: laoImg, number: "667.5w", fancyNumber: 6675000, - transmit: "10h/1次", + transmit: "10h/次", time: "2024.3.8", posts: "4.7w", atten: "210", @@ -115,7 +115,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: cgtnImg, number: "322.1w", fancyNumber: 3221000, - transmit: "15h/1次", + transmit: "15h/次", time: "2024.2.18", posts: "2.5w", atten: "105", @@ -128,7 +128,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: img567, number: "266", fancyNumber: 266, - transmit: "18h/1次", + transmit: "18h/次", time: "2024.1.30", posts: "209", atten: "3", @@ -141,7 +141,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: kongtianImg, number: "516.5w", fancyNumber: 5160000.5, - transmit: "18h/1次", + transmit: "18h/次", time: "2024.1.28", posts: "3.2w", atten: "156", @@ -154,7 +154,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: luxianImg, number: "3.9w", fancyNumber: 30000.9, - transmit: "18h/1次", + transmit: "18h/次", time: "2024.4.15", posts: "4321", atten: "18", @@ -167,7 +167,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: ggImg, number: "245", fancyNumber: 245, - transmit: "19h/1次", + transmit: "19h/次", time: "2024.1.22", posts: "317", atten: "6", @@ -180,7 +180,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: daxiaImg, number: "288", fancyNumber: 288, - transmit: "20h/1次", + transmit: "20h/次", time: "2024.2.20", posts: "896", atten: "12", @@ -193,7 +193,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: shenhaiImg, number: "126w", fancyNumber: 1260000, - transmit: "21h/1次", + transmit: "21h/次", time: "2024.3.5", posts: "8906", atten: "42", @@ -206,7 +206,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: bbsImg, number: "1.3w", fancyNumber: 10000.3, - transmit: "21h/1次", + transmit: "21h/次", time: "2024.4.5", posts: "562", atten: "8", @@ -219,7 +219,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: tangImg, number: "25", fancyNumber: 25, - transmit: "22h/1次", + transmit: "22h/次", time: "2024.2.5", posts: "128", atten: "2", @@ -232,7 +232,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: bossImg, number: "1184", fancyNumber: 1184, - transmit: "22h/1次", + transmit: "22h/次", time: "2024.4.12", posts: "512", atten: "7", @@ -245,7 +245,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: jiangImg, number: "1629", fancyNumber: 1629, - transmit: "23h/1次", + transmit: "23h/次", time: "2024.3.25", posts: "321", atten: "4", @@ -258,7 +258,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: img79, number: "516.6w", fancyNumber: 5160000.6, - transmit: "24h/1次", + transmit: "24h/次", time: "2024.2.10", posts: "2.9w", atten: "142", @@ -271,7 +271,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: qianImg, number: "40w", fancyNumber: 400000, - transmit: "24h/1次", + transmit: "24h/次", time: "2024.4.20", posts: "1.3w", atten: "58", @@ -284,7 +284,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: aiImg, number: "223", fancyNumber: 223, - transmit: "25h/1次", + transmit: "25h/次", time: "2024.3.18", posts: "432", atten: "5", @@ -297,7 +297,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: gaishiImg, number: "42w", fancyNumber: 420000, - transmit: "26h/1次", + transmit: "26h/次", time: "2024.4.1", posts: "1.2w", atten: "67", @@ -310,7 +310,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: haijingImg, number: "80.9w", fancyNumber: 800000.9, - transmit: "26h/1次", + transmit: "26h/次", time: "2024.2.8", posts: "1.1w", atten: "35", @@ -323,7 +323,7 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { avatar: img91221, number: "1947", fancyNumber: 1947, - transmit: "30h/1次", + transmit: "30h/次", time: "2024.1.15", posts: "654", atten: "9", @@ -402,10 +402,9 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { statisticsList: [ { id: 1, name: "节点数", icon: nodeNumber, number: 0 }, { id: 2, name: "社团数", icon: teamNumber, number: Object.keys(communityList).length }, - { id: 3, name: "锚点数", icon: position, number: Object.keys(anchorList).length }, - { id: 4, name: "已监控锚点", icon: monitor, number: 20 }, - { id: 5, name: "活跃预警事件", icon: warning, number: 0 }, - { id: 6, name: "高风险事件", icon: danger, number: 0 } + { id: 3, name: "推荐锚点账号", icon: monitor, number: 20 }, + { id: 4, name: "锚点实时关注话题", icon: warning, number: 0 }, + { id: 5, name: "高风险事件", icon: danger, number: 0 } ], //贴文列表 posts: [ @@ -541,8 +540,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [12000, 12690, 12108, 10790, 9004, 5000, 4890, 3300], - realityData: [8959, 7460, 8334, 7902, 5753, 3070, "-", "-"] + predictedData: [5678, 6643, 8123, 8356, 8523, 7653, 7533, 6533], + realityData: [5745, 6768, 7975, 8045, 8467, 7564, "-", "-"] } } ], @@ -560,8 +559,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [11000, 11690, 10108, 10690, 11004, 10006, 11890, 10878], - realityData: [9959, 8860, 8334, 9902, 8753, 7070, "-", "-"] + predictedData: [5678, 6643, 8123, 8356, 8523, 7653, 7533, 6533], + realityData: [5745, 6768, 7975, 8045, 8467, 7564, "-", "-"] } }, { @@ -577,8 +576,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [11500, 10690, 9108, 12690, 13004, 13006, 12890, 9878], - realityData: [10959, 9860, 8334, 11902, 12753, 11070, "-", "-"] + predictedData: [6522, 7023, 7112, 7233, 7590, 5421, 5211, 3086], + realityData: [6543, 6885, 7044, 7362, 7422, 5223, "-", "-"] } } ], @@ -596,8 +595,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [10000, 10390, 9808, 10690, 11004, 12006, 10890, 8878], - realityData: [9090, 9860, 8434, 10902, 11753, 10070, "-", "-"] + predictedData: [5678, 6643, 8123, 8356, 8523, 7653, 7533, 6533], + realityData: [5745, 6768, 7975, 8045, 8467, 7564, "-", "-"] } }, { @@ -613,8 +612,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [10000, 10390, 9808, 10690, 11004, 12006, 10890, 9878], - realityData: [9090, 9860, 8434, 10902, 11753, 10070, "-", "-"] + predictedData: [6522, 7023, 7112, 7233, 7590, 5421, 5211, 3086], + realityData: [6543, 6885, 7044, 7362, 7422, 5223, "-", "-"] } }, { @@ -630,8 +629,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [8001, 8500, 9500, 9756, 9655, 8545, 10556, 10545], - realityData: [9090, 9860, 8434, 10902, 11753, 10070, "-", "-"] + predictedData: [3256, 3489, 3907, 4579, 4378, 4269, 4123, 3789], + realityData: [3463, 3790, 4378, 4678, 4567, 4324, "-", "-"] } } ], @@ -649,8 +648,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high2Img, riskType: "中风险", chart: { - predictedData: [9001, 8500, 9500, 9756, 9655, 8545, 10556, 12545], - realityData: [9090, 9860, 8434, 9902, 9753, 10070, "-", "-"] + predictedData: [5678, 6643, 8123, 8356, 8523, 7653, 7533, 6533], + realityData: [5745, 6768, 7975, 8045, 8467, 7564, "-", "-"] } }, { @@ -666,8 +665,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [8001, 8500, 9500, 9756, 9655, 8545, 10556, 10956], - realityData: [9090, 9860, 8434, 10902, 11753, 10070, "-", "-"] + predictedData: [6522, 7023, 7112, 7233, 7590, 5421, 5211, 3086], + realityData: [6543, 6885, 7044, 7362, 7422, 5223, "-", "-"] } }, { @@ -683,8 +682,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [8646, 8895, 9570, 9656, 8655, 8545, 10556, 10487], - realityData: [8090, 8840, 8434, 9002, 7053, 8070, "-", "-"] + predictedData: [3256, 3489, 3907, 4579, 4378, 4269, 4123, 3789], + realityData: [3463, 3790, 4378, 4678, 4567, 4324, "-", "-"] } }, { @@ -701,8 +700,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [8646, 8895, 9570, 9656, 8655, 8545, 10556, 11314], - realityData: [8090, 8840, 8434, 9002, 7053, 8070, "-", "-"] + predictedData: [3290, 3546, 3997, 4602, 4422, 4337, 4168, 3812], + realityData: [3522, 3835, 4401, 4712, 4635, 4413, "-", "-"] } } ], @@ -720,8 +719,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high1Img, riskType: "高风险", chart: { - predictedData: [8646, 8895, 9570, 9656, 8655, 8545, 10556, 16597], - realityData: [8090, 8840, 8434, 9002, 7053, 8070, "-", "-"] + predictedData: [5678, 6643, 8123, 8356, 8523, 7653, 7533, 6533], + realityData: [5745, 6768, 7975, 8045, 8467, 7564, "-", "-"] } }, { @@ -737,8 +736,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high2Img, riskType: "中风险", chart: { - predictedData: [8646, 8895, 9570, 9656, 8655, 8545, 10556, 12545], - realityData: [8090, 8840, 8434, 9002, 7053, 8070, "-", "-"] + predictedData: [6522, 7023, 7112, 7233, 7590, 5421, 5211, 3086], + realityData: [6543, 6885, 7044, 7362, 7422, 5223, "-", "-"] } }, { @@ -754,8 +753,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [9646, 9895, 10570, 11000, 10546, 10664, 12056, 10557], - realityData: [8698, 7865, 6545, 8084, 9000, 9854, "-", "-"] + predictedData: [3256, 3489, 3907, 4579, 4378, 4269, 4123, 3789], + realityData: [3463, 3790, 4378, 4678, 4567, 4324, "-", "-"] } }, { @@ -772,8 +771,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [8646, 8895, 9570, 9656, 8655, 8545, 10556, 8556], - realityData: [8090, 8840, 8434, 9002, 7053, 8070, "-", "-"] + predictedData: [3290, 3546, 3997, 4602, 4422, 4337, 4168, 3812], + realityData: [3522, 3835, 4401, 4712, 4635, 4413, "-", "-"] } }, { @@ -789,8 +788,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [9855, 12531, 13556, 12011, 10145, 95545, 13524, 10697], - realityData: [9045, 11004, 12554, 10055, 9542, 10001, "-", "-"] + predictedData: [3349, 3591, 4020, 4636, 4490, 4426, 4212, 3880], + realityData: [3556, 3892, 4491, 4735, 4679, 4481, "-", "-"] } } ], @@ -808,8 +807,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high2Img, riskType: "中风险", chart: { - predictedData: [10565, 11554, 12565, 13265, 11012, 15631, 13556, 13005], - realityData: [10000, 10456, 9000, 9500, 10500, 11500, "-", "-"] + predictedData: [5678, 6643, 8123, 8356, 8523, 7653, 7533, 6533], + realityData: [5745, 6768, 7975, 8045, 8467, 7564, "-", "-"] } }, { @@ -825,8 +824,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [8646, 8895, 9570, 9656, 8655, 8545, 10556, 11545], - realityData: [8090, 8840, 8434, 9002, 7053, 8070, "-", "-"] + predictedData: [6522, 7023, 7112, 7233, 7590, 5421, 5211, 3086], + realityData: [6543, 6885, 7044, 7362, 7422, 5223, "-", "-"] } }, { @@ -842,8 +841,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [9646, 10000, 12000, 11000, 12001, 10000, 13001, 9000], - realityData: [8090, 8840, 9002, 10365, 11001, 9000, "-", "-"] + predictedData: [3256, 3489, 3907, 4579, 4378, 4269, 4123, 3789], + realityData: [3463, 3790, 4378, 4678, 4567, 4324, "-", "-"] } }, { @@ -860,8 +859,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [12000, 10895, 12570, 12656, 11655, 12545, 13556, 8745], - realityData: [10090, 9840, 9434, 10002, 9053, 9070, "-", "-"] + predictedData: [3290, 3546, 3997, 4602, 4422, 4337, 4168, 3812], + realityData: [3522, 3835, 4401, 4712, 4635, 4413, "-", "-"] } }, { @@ -877,8 +876,8 @@ export const useKeyNodeRecognitionStore = defineStore("keyNodeRecognition", { backimg: high3Img, riskType: "低风险", chart: { - predictedData: [10646, 12895, 12570, 10656, 9655, 8545, 10556, 9048], - realityData: [9090, 10040, 10434, 9012, 9053, 7070, "-", "-"] + predictedData: [3349, 3591, 4020, 4636, 4490, 4426, 4212, 3880], + realityData: [3556, 3892, 4491, 4735, 4679, 4481, "-", "-"] } } ] diff --git a/src/views/GroupEvolution/component/groupGraph.vue b/src/views/GroupEvolution/component/groupGraph.vue index 3937d0c..8e8a263 100644 --- a/src/views/GroupEvolution/component/groupGraph.vue +++ b/src/views/GroupEvolution/component/groupGraph.vue @@ -17,18 +17,21 @@