/*
* GoJS v2.0.17 JavaScript Library for HTML Diagrams
* Northwoods Software, https://www.nwoods.com/
* GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
* Copyright (C) 1998-2019 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.0.17/license.html.
*/
(function () {
var t;
function aa(a) {
var b = 0;
return function () {
return b < a.length ? {done: !1, value: a[b++]} : {done: !0}
}
}
function ba(a) {
var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
return b ? b.call(a) : {next: aa(a)}
}
function ca(a) {
for (var b, c = []; !(b = a.next()).done;) c.push(b.value);
return c
}
var da = "function" == typeof Object.create ? Object.create : function (a) {
function b() {
}
b.prototype = a;
return new b
}, fa;
if ("function" == typeof Object.setPrototypeOf) fa = Object.setPrototypeOf; else {
var ha;
a:{
var ia = {a: !0}, ja = {};
try {
ja.__proto__ = ia;
ha = ja.a;
break a
} catch (a) {
}
ha = !1
}
fa = ha ? function (a, b) {
a.__proto__ = b;
if (a.__proto__ !== b) throw new TypeError(a + " is not extensible");
return a
} : null
}
var ka = fa;
function la(a, b) {
a.prototype = da(b.prototype);
a.prototype.constructor = a;
if (ka) ka(a, b); else for (var c in b) if ("prototype" != c) if (Object.defineProperties) {
var d = Object.getOwnPropertyDescriptor(b, c);
d && Object.defineProperty(a, c, d)
} else a[c] = b[c];
a.jA = b.prototype
}
var ma = "undefined" != typeof window && window === self ? self : "undefined" != typeof global && null != global ? global : self,
na = "function" == typeof Object.defineProperties ? Object.defineProperty : function (a, b, c) {
a != Array.prototype && a != Object.prototype && (a[b] = c.value)
};
function oa(a) {
if (a) {
for (var b = ma, c = ["Array", "prototype", "fill"], d = 0; d < c.length - 1; d++) {
var e = c[d];
e in b || (b[e] = {});
b = b[e]
}
c = c[c.length - 1];
d = b[c];
a = a(d);
a != d && null != a && na(b, c, {writable: !0, value: a})
}
}
oa(function (a) {
return a ? a : function (a, c, d) {
var b = this.length || 0;
0 > c && (c = Math.max(0, b + c));
if (null == d || d > b) d = b;
d = Number(d);
0 > d && (d = Math.max(0, b + d));
for (c = Number(c || 0); c < d; c++) this[c] = a;
return this
}
});
var x = "object" === typeof self && self.self === self && self || "object" === typeof global && global.global === global && global || "object" === typeof window && window.window === window && window || {};
void 0 === x.requestAnimationFrame && (x.requestAnimationFrame = x.setImmediate);
function qa() {
}
function ra(a, b) {
var c = -1;
return function () {
var d = this, e = arguments;
-1 !== c && x.clearTimeout(c);
c = sa(function () {
c = -1;
a.apply(d, e)
}, b)
}
}
function sa(a, b) {
return x.setTimeout(a, b)
}
function ta(a) {
return x.document.createElement(a)
}
function B(a) {
throw Error(a);
}
function ua(a, b) {
a = "The object is frozen, so its properties cannot be set: " + a.toString();
void 0 !== b && (a += " to value: " + b);
B(a)
}
function va(a, b, c, d) {
c = null === c ? "*" : "string" === typeof c ? c : "function" === typeof c && "string" === typeof c.className ? c.className : "";
void 0 !== d && (c += "." + d);
B(c + " is not in the range " + b + ": " + a)
}
function wa(a) {
x.console && x.console.log(a)
}
function xa() {
x.console && x.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")
}
function ya(a) {
return "object" === typeof a && null !== a
}
function za(a) {
return Array.isArray(a) || x.NodeList && a instanceof x.NodeList || x.HTMLCollection && a instanceof x.HTMLCollection
}
function Aa(a) {
return Array.prototype.slice.call(a)
}
function Ba(a, b, c) {
Array.isArray(a) ? b >= a.length ? a.push(c) : a.splice(b, 0, c) : B("Cannot insert an object into an HTMLCollection or NodeList: " + c + " at " + b)
}
function Ca(a, b) {
Array.isArray(a) ? b >= a.length ? a.pop() : a.splice(b, 1) : B("Cannot remove an object from an HTMLCollection or NodeList at " + b)
}
function Da() {
var a = Ea.pop();
return void 0 === a ? [] : a
}
function Ga(a) {
a.length = 0;
Ea.push(a)
}
function Ha(a) {
if ("function" === typeof a) {
if (a.className) return a.className;
if (a.name) return a.name;
var b = a.toString();
b = b.substring(9, b.indexOf("(")).trim();
if ("" !== b) return a._className = b
} else if (ya(a) && a.constructor) return Ha(a.constructor);
return typeof a
}
function Ja(a) {
var b = a;
ya(a) && (a.text ? b = a.text : a.name ? b = a.name : void 0 !== a.key ? b = a.key : void 0 !== a.id ? b = a.id : a.constructor === Object && (a.Text ? b = a.Text : a.Name ? b = a.Name : void 0 !== a.Key ? b = a.Key : void 0 !== a.Id ? b = a.Id : void 0 !== a.ID && (b = a.ID)));
return void 0 === b ? "undefined" : null === b ? "null" : b.toString()
}
function Ka(a, b) {
if (a.hasOwnProperty(b)) return !0;
for (a = Object.getPrototypeOf(a); a && a !== Function;) {
if (a.hasOwnProperty(b)) return !0;
var c = a.aA;
if (c && c[b]) return !0;
a = Object.getPrototypeOf(a)
}
return !1
}
function Ma(a, b, c) {
Object.defineProperty(Na.prototype, a, {get: b, set: c})
}
function Oa() {
var a = Qa;
if (0 === a.length) for (var b = x.document.getElementsByTagName("canvas"), c = b.length, d = 0; d < c; d++) {
var e = b[d];
e.parentElement && e.parentElement.C && a.push(e.parentElement.C)
}
return a
}
function Ra(a) {
for (var b = [], c = 0; 256 > c; c++) b["0123456789abcdef".charAt(c >> 4) + "0123456789abcdef".charAt(c & 15)] = String.fromCharCode(c);
a.length % 2 && (a = "0" + a);
c = [];
for (var d = 0, e = 0; e < a.length; e += 2) c[d++] = b[a.substr(e, 2)];
a = c.join("");
a = "" === a ? "0" : a;
b = [];
for (c = 0; 256 > c; c++) b[c] = c;
for (c = d = 0; 256 > c; c++) d = (d + b[c] + 119) % 256, e = b[c], b[c] = b[d], b[d] = e;
d = c = 0;
for (var f = "", g = 0; g < a.length; g++) c = (c + 1) % 256, d = (d + b[c]) % 256, e = b[c], b[c] = b[d], b[d] = e, f += String.fromCharCode(a.charCodeAt(g) ^ b[(b[c] + b[d]) % 256]);
return f
}
var Sa = void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf("MSIE 9.0"),
Ta = void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf("MSIE 10.0"),
Ua = void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf("Trident/7"),
Va = void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf("Edge/"),
Wa = void 0 !== x.navigator && void 0 !== x.navigator.platform && 0 <= x.navigator.platform.toUpperCase().indexOf("MAC"),
Xa = void 0 !== x.navigator && void 0 !== x.navigator.platform && null !== x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
Ea = [];
Object.freeze([]);
var Qa = [];
qa.className = "Util";
qa.Dx = "32ab5ff3b26f42dc0ed90f224d2913b5";
qa.adym = "gojs.net";
qa.vfo = "28e646fdb261";
qa.className = "Util";
function D(a, b, c) {
ab(this);
this.l = a;
this.Ua = b;
this.u = c
}
D.prototype.toString = function () {
return "EnumValue." + this.Ua
};
function bb(a, b) {
return void 0 === b || null === b || "" === b ? null : a[b]
}
ma.Object.defineProperties(D.prototype, {
classType: {
get: function () {
return this.l
}
}, name: {
get: function () {
return this.Ua
}
}, value: {
get: function () {
return this.u
}
}
});
D.className = "EnumValue";
function cb() {
this.lw = []
}
cb.prototype.toString = function () {
return this.lw.join("")
};
cb.prototype.add = function (a) {
"" !== a && this.lw.push(a)
};
cb.className = "StringBuilder";
function db() {
}
db.className = "PropertyCollection";
function fb() {
}
fb.prototype.reset = function () {
};
fb.prototype.next = function () {
return !1
};
fb.prototype.dd = function () {
return !1
};
fb.prototype.first = function () {
return null
};
fb.prototype.any = function () {
return !1
};
fb.prototype.all = function () {
return !0
};
fb.prototype.each = function () {
return this
};
fb.prototype.map = function () {
return this
};
fb.prototype.filter = function () {
return this
};
fb.prototype.xd = function () {
};
fb.prototype.toString = function () {
return "EmptyIterator"
};
ma.Object.defineProperties(fb.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return 0
}
}
});
fb.prototype.first = fb.prototype.first;
fb.prototype.hasNext = fb.prototype.dd;
fb.prototype.next = fb.prototype.next;
fb.prototype.reset = fb.prototype.reset;
var gb = null;
fb.className = "EmptyIterator";
gb = new fb;
function hb(a) {
this.key = -1;
this.value = a
}
hb.prototype.reset = function () {
this.key = -1
};
hb.prototype.next = function () {
return -1 === this.key ? (this.key = 0, !0) : !1
};
hb.prototype.dd = function () {
return this.next()
};
hb.prototype.first = function () {
this.key = 0;
return this.value
};
hb.prototype.any = function (a) {
this.key = -1;
return a(this.value)
};
hb.prototype.all = function (a) {
this.key = -1;
return a(this.value)
};
hb.prototype.each = function (a) {
this.key = -1;
a(this.value);
return this
};
hb.prototype.map = function (a) {
return new hb(a(this.value))
};
hb.prototype.filter = function (a) {
return a(this.value) ? new hb(this.value) : gb
};
hb.prototype.xd = function () {
this.value = null
};
hb.prototype.toString = function () {
return "SingletonIterator(" + this.value + ")"
};
ma.Object.defineProperties(hb.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return 1
}
}
});
hb.prototype.first = hb.prototype.first;
hb.prototype.hasNext = hb.prototype.dd;
hb.prototype.next = hb.prototype.next;
hb.prototype.reset = hb.prototype.reset;
hb.className = "SingletonIterator";
function ib(a) {
this.pb = a;
this.Ye = null;
a.Ja = null;
this.la = a.Ba;
this.Sa = -1
}
ib.prototype.reset = function () {
var a = this.pb;
a.Ja = null;
this.la = a.Ba;
this.Sa = -1
};
ib.prototype.next = function () {
var a = this.pb;
if (a.Ba !== this.la && 0 > this.key) return !1;
a = a.j;
var b = a.length, c = ++this.Sa, d = this.Ye;
if (null !== d) for (; c < b;) {
var e = a[c];
if (d(e)) return this.key = this.Sa = c, this.value = e, !0;
c++
} else {
if (c < b) return this.key = c, this.value = a[c], !0;
this.xd()
}
return !1
};
ib.prototype.dd = function () {
return this.next()
};
ib.prototype.first = function () {
var a = this.pb;
this.la = a.Ba;
this.Sa = 0;
a = a.j;
var b = a.length, c = this.Ye;
if (null !== c) {
for (var d = 0; d < b;) {
var e = a[d];
if (c(e)) return this.key = this.Sa = d, this.value = e;
d++
}
return null
}
return 0 < b ? (a = a[0], this.key = 0, this.value = a) : null
};
ib.prototype.any = function (a) {
var b = this.pb;
b.Ja = null;
this.Sa = -1;
b = b.j;
for (var c = b.length, d = this.Ye, e = 0; e < c; e++) {
var f = b[e];
if ((null === d || d(f)) && a(f)) return !0
}
return !1
};
ib.prototype.all = function (a) {
var b = this.pb;
b.Ja = null;
this.Sa = -1;
b = b.j;
for (var c = b.length, d = this.Ye, e = 0; e < c; e++) {
var f = b[e];
if ((null === d || d(f)) && !a(f)) return !1
}
return !0
};
ib.prototype.each = function (a) {
var b = this.pb;
b.Ja = null;
this.Sa = -1;
b = b.j;
for (var c = b.length, d = this.Ye, e = 0; e < c; e++) {
var f = b[e];
(null === d || d(f)) && a(f)
}
return this
};
ib.prototype.map = function (a) {
var b = this.pb;
b.Ja = null;
this.Sa = -1;
var c = [];
b = b.j;
for (var d = b.length, e = this.Ye, f = 0; f < d; f++) {
var g = b[f];
(null === e || e(g)) && c.push(a(g))
}
a = new E;
a.j = c;
a.kb();
return a.iterator
};
ib.prototype.filter = function (a) {
var b = this.pb;
b.Ja = null;
this.Sa = -1;
var c = [];
b = b.j;
for (var d = b.length, e = this.Ye, f = 0; f < d; f++) {
var g = b[f];
(null === e || e(g)) && a(g) && c.push(g)
}
a = new E;
a.j = c;
a.kb();
return a.iterator
};
ib.prototype.xd = function () {
this.key = -1;
this.value = null;
this.la = -1;
this.Ye = null;
this.pb.Ja = this
};
ib.prototype.toString = function () {
return "ListIterator@" + this.Sa + "/" + this.pb.count
};
ma.Object.defineProperties(ib.prototype, {
iterator: {
get: function () {
return this
}
}, predicate: {
get: function () {
return this.Ye
}, set: function (a) {
this.Ye = a
}
}, count: {
get: function () {
var a = this.Ye;
if (null !== a) {
for (var b = 0, c = this.pb.j, d = c.length, e = 0; e < d; e++) a(c[e]) && b++;
return b
}
return this.pb.j.length
}
}
});
ib.prototype.first = ib.prototype.first;
ib.prototype.hasNext = ib.prototype.dd;
ib.prototype.next = ib.prototype.next;
ib.prototype.reset = ib.prototype.reset;
ib.className = "ListIterator";
function jb(a) {
this.pb = a;
a.Tg = null;
this.la = a.Ba;
this.Sa = a.j.length
}
jb.prototype.reset = function () {
var a = this.pb;
a.Tg = null;
this.la = a.Ba;
this.Sa = a.j.length
};
jb.prototype.next = function () {
var a = this.pb;
if (a.Ba !== this.la && 0 > this.key) return !1;
var b = --this.Sa;
if (0 <= b) return this.key = b, this.value = a.j[b], !0;
this.xd();
return !1
};
jb.prototype.dd = function () {
return this.next()
};
jb.prototype.first = function () {
var a = this.pb;
this.la = a.Ba;
var b = a.j;
this.Sa = a = b.length - 1;
return 0 <= a ? (b = b[a], this.key = a, this.value = b) : null
};
jb.prototype.any = function (a) {
var b = this.pb;
b.Tg = null;
b = b.j;
var c = b.length;
this.Sa = c;
for (--c; 0 <= c; c--) if (a(b[c])) return !0;
return !1
};
jb.prototype.all = function (a) {
var b = this.pb;
b.Tg = null;
b = b.j;
var c = b.length;
this.Sa = c;
for (--c; 0 <= c; c--) if (!a(b[c])) return !1;
return !0
};
jb.prototype.each = function (a) {
var b = this.pb;
b.Tg = null;
b = b.j;
var c = b.length;
this.Sa = c;
for (--c; 0 <= c; c--) a(b[c]);
return this
};
jb.prototype.map = function (a) {
var b = this.pb;
b.Tg = null;
var c = [];
b = b.j;
var d = b.length;
this.Sa = d;
for (--d; 0 <= d; d--) c.push(a(b[d]));
a = new E;
a.j = c;
a.kb();
return a.iterator
};
jb.prototype.filter = function (a) {
var b = this.pb;
b.Tg = null;
var c = [];
b = b.j;
var d = b.length;
this.Sa = d;
for (--d; 0 <= d; d--) {
var e = b[d];
a(e) && c.push(e)
}
a = new E;
a.j = c;
a.kb();
return a.iterator
};
jb.prototype.xd = function () {
this.key = -1;
this.value = null;
this.la = -1;
this.pb.Tg = this
};
jb.prototype.toString = function () {
return "ListIteratorBackwards(" + this.Sa + "/" + this.pb.count + ")"
};
ma.Object.defineProperties(jb.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return this.pb.j.length
}
}
});
jb.prototype.first = jb.prototype.first;
jb.prototype.hasNext = jb.prototype.dd;
jb.prototype.next = jb.prototype.next;
jb.prototype.reset = jb.prototype.reset;
jb.className = "ListIteratorBackwards";
function E(a) {
ab(this);
this.v = !1;
this.j = [];
this.Ba = 0;
this.Tg = this.Ja = null;
void 0 !== a && ("function" === typeof a || "string" === typeof a ? xa() : this.addAll(a))
}
t = E.prototype;
t.kb = function () {
var a = this.Ba;
a++;
999999999 < a && (a = 0);
this.Ba = a
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
this.v = !1;
return this
};
t.toString = function () {
return "List()#" + lb(this)
};
t.add = function (a) {
if (null === a) return this;
this.v && ua(this, a);
this.j.push(a);
this.kb();
return this
};
t.push = function (a) {
this.add(a)
};
t.addAll = function (a) {
if (null === a) return this;
this.v && ua(this);
var b = this.j;
if (za(a)) for (var c = a.length, d = 0; d < c; d++) b.push(a[d]); else for (a = a.iterator; a.next();) b.push(a.value);
this.kb();
return this
};
t.clear = function () {
this.v && ua(this);
this.j.length = 0;
this.kb()
};
t.contains = function (a) {
return null === a ? !1 : -1 !== this.j.indexOf(a)
};
t.has = function (a) {
return this.contains(a)
};
t.indexOf = function (a) {
return null === a ? -1 : this.j.indexOf(a)
};
t.N = function (a) {
var b = this.j;
(0 > a || a >= b.length) && va(a, "0 <= i < length", E, "elt:i");
return b[a]
};
t.get = function (a) {
return this.N(a)
};
t.gd = function (a, b) {
var c = this.j;
(0 > a || a >= c.length) && va(a, "0 <= i < length", E, "setElt:i");
this.v && ua(this, a);
c[a] = b
};
t.set = function (a, b) {
this.gd(a, b)
};
t.first = function () {
var a = this.j;
return 0 === a.length ? null : a[0]
};
t.Sb = function () {
var a = this.j, b = a.length;
return 0 < b ? a[b - 1] : null
};
t.pop = function () {
this.v && ua(this);
var a = this.j;
return 0 < a.length ? a.pop() : null
};
E.prototype.any = function (a) {
for (var b = this.j, c = b.length, d = 0; d < c; d++) if (a(b[d])) return !0;
return !1
};
E.prototype.all = function (a) {
for (var b = this.j, c = b.length, d = 0; d < c; d++) if (!a(b[d])) return !1;
return !0
};
E.prototype.each = function (a) {
for (var b = this.j, c = b.length, d = 0; d < c; d++) a(b[d]);
return this
};
E.prototype.map = function (a) {
for (var b = new E, c = [], d = this.j, e = d.length, f = 0; f < e; f++) c.push(a(d[f]));
b.j = c;
b.kb();
return b
};
E.prototype.filter = function (a) {
for (var b = new E, c = [], d = this.j, e = d.length, f = 0; f < e; f++) {
var g = d[f];
a(g) && c.push(g)
}
b.j = c;
b.kb();
return b
};
t = E.prototype;
t.Ib = function (a, b) {
0 > a && va(a, ">= 0", E, "insertAt:i");
this.v && ua(this, a);
var c = this.j;
a >= c.length ? c.push(b) : c.splice(a, 0, b);
this.kb()
};
t.remove = function (a) {
if (null === a) return !1;
this.v && ua(this, a);
var b = this.j;
a = b.indexOf(a);
if (-1 === a) return !1;
a === b.length - 1 ? b.pop() : b.splice(a, 1);
this.kb();
return !0
};
t.delete = function (a) {
return this.remove(a)
};
t.mb = function (a) {
var b = this.j;
(0 > a || a >= b.length) && va(a, "0 <= i < length", E, "removeAt:i");
this.v && ua(this, a);
a === b.length - 1 ? b.pop() : b.splice(a, 1);
this.kb()
};
t.removeRange = function (a, b) {
var c = this.j, d = c.length;
if (0 > a) a = 0; else if (a >= d) return this;
if (0 > b) return this;
b >= d && (b = d - 1);
if (a > b) return this;
this.v && ua(this);
for (var e = a, f = b + 1; f < d;) c[e++] = c[f++];
c.length = d - (b - a + 1);
this.kb();
return this
};
E.prototype.copy = function () {
var a = new E, b = this.j;
0 < b.length && (a.j = Array.prototype.slice.call(b));
return a
};
t = E.prototype;
t.Na = function () {
for (var a = this.j, b = this.count, c = Array(b), d = 0; d < b; d++) c[d] = a[d];
return c
};
t.Sv = function () {
for (var a = new F, b = this.j, c = this.count, d = 0; d < c; d++) a.add(b[d]);
return a
};
t.sort = function (a) {
this.v && ua(this);
this.j.sort(a);
this.kb();
return this
};
t.Xi = function (a, b, c) {
var d = this.j, e = d.length;
void 0 === b && (b = 0);
void 0 === c && (c = e);
this.v && ua(this);
var f = c - b;
if (1 >= f) return this;
(0 > b || b >= e - 1) && va(b, "0 <= from < length", E, "sortRange:from");
if (2 === f) return c = d[b], e = d[b + 1], 0 < a(c, e) && (d[b] = e, d[b + 1] = c, this.kb()), this;
if (0 === b) if (c >= e) d.sort(a); else for (b = d.slice(0, c), b.sort(a), a = 0; a < c; a++) d[a] = b[a]; else if (c >= e) for (c = d.slice(b), c.sort(a), a = b; a < e; a++) d[a] = c[a - b]; else for (e = d.slice(b, c), e.sort(a), a = b; a < c; a++) d[a] = e[a - b];
this.kb();
return this
};
t.reverse = function () {
this.v && ua(this);
this.j.reverse();
this.kb();
return this
};
ma.Object.defineProperties(E.prototype, {
_dataArray: {
get: function () {
return this.j
}
}, count: {
get: function () {
return this.j.length
}
}, size: {
get: function () {
return this.j.length
}
}, length: {
get: function () {
return this.j.length
}
}, iterator: {
get: function () {
if (0 >= this.j.length) return gb;
var a = this.Ja;
return null !== a ? (a.reset(), a) : new ib(this)
}
}, iteratorBackwards: {
get: function () {
if (0 >= this.j.length) return gb;
var a = this.Tg;
return null !== a ? (a.reset(), a) : new jb(this)
}
}
});
E.prototype.reverse = E.prototype.reverse;
E.prototype.sortRange = E.prototype.Xi;
E.prototype.sort = E.prototype.sort;
E.prototype.toSet = E.prototype.Sv;
E.prototype.toArray = E.prototype.Na;
E.prototype.removeRange = E.prototype.removeRange;
E.prototype.removeAt = E.prototype.mb;
E.prototype["delete"] = E.prototype.delete;
E.prototype.remove = E.prototype.remove;
E.prototype.insertAt = E.prototype.Ib;
E.prototype.pop = E.prototype.pop;
E.prototype.last = E.prototype.Sb;
E.prototype.first = E.prototype.first;
E.prototype.set = E.prototype.set;
E.prototype.setElt = E.prototype.gd;
E.prototype.get = E.prototype.get;
E.prototype.elt = E.prototype.N;
E.prototype.indexOf = E.prototype.indexOf;
E.prototype.has = E.prototype.has;
E.prototype.contains = E.prototype.contains;
E.prototype.clear = E.prototype.clear;
E.prototype.addAll = E.prototype.addAll;
E.prototype.push = E.prototype.push;
E.prototype.add = E.prototype.add;
E.prototype.thaw = E.prototype.ha;
E.prototype.freeze = E.prototype.freeze;
E.className = "List";
function mb(a) {
this.ig = a;
a.Ja = null;
this.la = a.Ba;
this.na = null
}
mb.prototype.reset = function () {
var a = this.ig;
a.Ja = null;
this.la = a.Ba;
this.na = null
};
mb.prototype.next = function () {
var a = this.ig;
if (a.Ba !== this.la && null === this.key) return !1;
var b = this.na;
b = null === b ? a.fa : b.oa;
if (null !== b) return this.na = b, this.value = b.value, this.key = b.key, !0;
this.xd();
return !1
};
mb.prototype.dd = function () {
return this.next()
};
mb.prototype.first = function () {
var a = this.ig;
this.la = a.Ba;
a = a.fa;
if (null !== a) {
this.na = a;
var b = a.value;
this.key = a.key;
return this.value = b
}
return null
};
mb.prototype.any = function (a) {
var b = this.ig;
this.na = b.Ja = null;
for (b = b.fa; null !== b;) {
if (a(b.value)) return !0;
b = b.oa
}
return !1
};
mb.prototype.all = function (a) {
var b = this.ig;
this.na = b.Ja = null;
for (b = b.fa; null !== b;) {
if (!a(b.value)) return !1;
b = b.oa
}
return !0
};
mb.prototype.each = function (a) {
var b = this.ig;
this.na = b.Ja = null;
for (b = b.fa; null !== b;) a(b.value), b = b.oa;
return this
};
mb.prototype.map = function (a) {
var b = this.ig;
b.Ja = null;
var c = new E;
for (b = b.fa; null !== b;) c.add(a(b.value)), b = b.oa;
return c.iterator
};
mb.prototype.filter = function (a) {
var b = this.ig;
b.Ja = null;
var c = new E;
for (b = b.fa; null !== b;) {
var d = b.value;
a(d) && c.add(d);
b = b.oa
}
return c.iterator
};
mb.prototype.xd = function () {
this.value = this.key = null;
this.la = -1;
this.ig.Ja = this
};
mb.prototype.toString = function () {
return null !== this.na ? "SetIterator@" + this.na.value : "SetIterator"
};
ma.Object.defineProperties(mb.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return this.ig.Cb
}
}
});
mb.prototype.first = mb.prototype.first;
mb.prototype.hasNext = mb.prototype.dd;
mb.prototype.next = mb.prototype.next;
mb.prototype.reset = mb.prototype.reset;
mb.className = "SetIterator";
function F(a) {
ab(this);
this.v = !1;
this.Db = {};
this.Cb = 0;
this.Ja = null;
this.Ba = 0;
this.Ue = this.fa = null;
void 0 !== a && ("function" === typeof a || "string" === typeof a ? xa() : this.addAll(a))
}
t = F.prototype;
t.kb = function () {
var a = this.Ba;
a++;
999999999 < a && (a = 0);
this.Ba = a
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
this.v = !1;
return this
};
t.toString = function () {
return "Set()#" + lb(this)
};
t.add = function (a) {
if (null === a) return this;
this.v && ua(this, a);
var b = a;
ya(a) && (b = ob(a));
void 0 === this.Db[b] && (this.Cb++, a = new pb(a, a), this.Db[b] = a, b = this.Ue, null === b ? this.fa = a : (a.xl = b, b.oa = a), this.Ue = a, this.kb());
return this
};
t.addAll = function (a) {
if (null === a) return this;
this.v && ua(this);
if (za(a)) for (var b = a.length, c = 0; c < b; c++) this.add(a[c]); else for (a = a.iterator; a.next();) this.add(a.value);
return this
};
t.contains = function (a) {
if (null === a) return !1;
var b = a;
return ya(a) && (b = lb(a), void 0 === b) ? !1 : void 0 !== this.Db[b]
};
t.has = function (a) {
return this.contains(a)
};
t.sy = function (a) {
if (null === a) return !0;
for (a = a.iterator; a.next();) if (!this.contains(a.value)) return !1;
return !0
};
t.ty = function (a) {
if (null === a) return !0;
for (a = a.iterator; a.next();) if (this.contains(a.value)) return !0;
return !1
};
t.first = function () {
var a = this.fa;
return null === a ? null : a.value
};
F.prototype.any = function (a) {
for (var b = this.fa; null !== b;) {
if (a(b.value)) return !0;
b = b.oa
}
return !1
};
F.prototype.all = function (a) {
for (var b = this.fa; null !== b;) {
if (!a(b.value)) return !1;
b = b.oa
}
return !0
};
F.prototype.each = function (a) {
for (var b = this.fa; null !== b;) a(b.value), b = b.oa;
return this
};
F.prototype.map = function (a) {
for (var b = new F, c = this.fa; null !== c;) b.add(a(c.value)), c = c.oa;
return b
};
F.prototype.filter = function (a) {
for (var b = new F, c = this.fa; null !== c;) {
var d = c.value;
a(d) && b.add(d);
c = c.oa
}
return b
};
t = F.prototype;
t.remove = function (a) {
if (null === a) return !1;
this.v && ua(this, a);
var b = a;
if (ya(a) && (b = lb(a), void 0 === b)) return !1;
a = this.Db[b];
if (void 0 === a) return !1;
var c = a.oa, d = a.xl;
null !== c && (c.xl = d);
null !== d && (d.oa = c);
this.fa === a && (this.fa = c);
this.Ue === a && (this.Ue = d);
delete this.Db[b];
this.Cb--;
this.kb();
return !0
};
t.delete = function (a) {
return this.remove(a)
};
t.pq = function (a) {
if (null === a) return this;
this.v && ua(this);
if (za(a)) for (var b = a.length, c = 0; c < b; c++) this.remove(a[c]); else for (a = a.iterator; a.next();) this.remove(a.value);
return this
};
t.Oz = function (a) {
if (null === a || 0 === this.count) return this;
this.v && ua(this);
var b = new F;
b.addAll(a);
a = [];
for (var c = this.iterator; c.next();) {
var d = c.value;
b.contains(d) || a.push(d)
}
this.pq(a);
return this
};
t.clear = function () {
this.v && ua(this);
this.Db = {};
this.Cb = 0;
null !== this.Ja && this.Ja.reset();
this.Ue = this.fa = null;
this.kb()
};
F.prototype.copy = function () {
var a = new F, b = this.Db, c;
for (c in b) a.add(b[c].value);
return a
};
F.prototype.Na = function () {
var a = Array(this.Cb), b = this.Db, c = 0, d;
for (d in b) a[c] = b[d].value, c++;
return a
};
F.prototype.Rv = function () {
var a = new E, b = this.Db, c;
for (c in b) a.add(b[c].value);
return a
};
function ab(a) {
a.__gohashid = qb++
}
function ob(a) {
var b = a.__gohashid;
void 0 === b && (b = qb++, a.__gohashid = b);
return b
}
function lb(a) {
return a.__gohashid
}
ma.Object.defineProperties(F.prototype, {
count: {
get: function () {
return this.Cb
}
}, size: {
get: function () {
return this.Cb
}
}, iterator: {
get: function () {
if (0 >= this.Cb) return gb;
var a = this.Ja;
return null !== a ? (a.reset(), a) : new mb(this)
}
}
});
F.prototype.toList = F.prototype.Rv;
F.prototype.toArray = F.prototype.Na;
F.prototype.clear = F.prototype.clear;
F.prototype.retainAll = F.prototype.Oz;
F.prototype.removeAll = F.prototype.pq;
F.prototype["delete"] = F.prototype.delete;
F.prototype.remove = F.prototype.remove;
F.prototype.first = F.prototype.first;
F.prototype.containsAny = F.prototype.ty;
F.prototype.containsAll = F.prototype.sy;
F.prototype.has = F.prototype.has;
F.prototype.contains = F.prototype.contains;
F.prototype.addAll = F.prototype.addAll;
F.prototype.add = F.prototype.add;
F.prototype.thaw = F.prototype.ha;
F.prototype.freeze = F.prototype.freeze;
var qb = 1;
F.className = "Set";
F.uniqueHash = ab;
F.hashIdUnique = ob;
F.hashId = lb;
function rb(a) {
this.ja = a;
this.la = a.Ba;
this.na = null
}
rb.prototype.reset = function () {
this.la = this.ja.Ba;
this.na = null
};
rb.prototype.next = function () {
var a = this.ja;
if (a.Ba !== this.la && null === this.key) return !1;
var b = this.na;
b = null === b ? a.fa : b.oa;
if (null !== b) return this.na = b, this.value = this.key = a = b.key, !0;
this.xd();
return !1
};
rb.prototype.dd = function () {
return this.next()
};
rb.prototype.first = function () {
var a = this.ja;
this.la = a.Ba;
a = a.fa;
return null !== a ? (this.na = a, this.value = this.key = a = a.key) : null
};
rb.prototype.any = function (a) {
var b = this.ja;
this.na = null;
for (b = b.fa; null !== b;) {
if (a(b.key)) return !0;
b = b.oa
}
return !1
};
rb.prototype.all = function (a) {
var b = this.ja;
this.na = null;
for (b = b.fa; null !== b;) {
if (!a(b.key)) return !1;
b = b.oa
}
return !0
};
rb.prototype.each = function (a) {
var b = this.ja;
this.na = null;
for (b = b.fa; null !== b;) a(b.key), b = b.oa;
return this
};
rb.prototype.map = function (a) {
var b = this.ja;
this.na = null;
var c = new E;
for (b = b.fa; null !== b;) c.add(a(b.key)), b = b.oa;
return c.iterator
};
rb.prototype.filter = function (a) {
var b = this.ja;
this.na = null;
var c = new E;
for (b = b.fa; null !== b;) {
var d = b.key;
a(d) && c.add(d);
b = b.oa
}
return c.iterator
};
rb.prototype.xd = function () {
this.value = this.key = null;
this.la = -1
};
rb.prototype.toString = function () {
return null !== this.na ? "MapKeySetIterator@" + this.na.value : "MapKeySetIterator"
};
ma.Object.defineProperties(rb.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return this.ja.Cb
}
}
});
rb.prototype.first = rb.prototype.first;
rb.prototype.hasNext = rb.prototype.dd;
rb.prototype.next = rb.prototype.next;
rb.prototype.reset = rb.prototype.reset;
rb.className = "MapKeySetIterator";
function sb(a) {
F.call(this);
ab(this);
this.v = !0;
this.ja = a
}
la(sb, F);
t = sb.prototype;
t.freeze = function () {
return this
};
t.ha = function () {
return this
};
t.toString = function () {
return "MapKeySet(" + this.ja.toString() + ")"
};
t.add = function () {
B("This Set is read-only: " + this.toString());
return this
};
t.contains = function (a) {
return this.ja.contains(a)
};
t.has = function (a) {
return this.contains(a)
};
t.remove = function () {
B("This Set is read-only: " + this.toString());
return !1
};
t.delete = function (a) {
return this.remove(a)
};
t.clear = function () {
B("This Set is read-only: " + this.toString())
};
t.first = function () {
var a = this.ja.fa;
return null !== a ? a.key : null
};
sb.prototype.any = function (a) {
for (var b = this.ja.fa; null !== b;) {
if (a(b.key)) return !0;
b = b.oa
}
return !1
};
sb.prototype.all = function (a) {
for (var b = this.ja.fa; null !== b;) {
if (!a(b.key)) return !1;
b = b.oa
}
return !0
};
sb.prototype.each = function (a) {
for (var b = this.ja.fa; null !== b;) a(b.key), b = b.oa;
return this
};
sb.prototype.map = function (a) {
for (var b = new F, c = this.ja.fa; null !== c;) b.add(a(c.key)), c = c.oa;
return b
};
sb.prototype.filter = function (a) {
for (var b = new F, c = this.ja.fa; null !== c;) {
var d = c.key;
a(d) && b.add(d);
c = c.oa
}
return b
};
sb.prototype.copy = function () {
return new sb(this.ja)
};
sb.prototype.Sv = function () {
var a = new F, b = this.ja.Db, c;
for (c in b) a.add(b[c].key);
return a
};
sb.prototype.Na = function () {
var a = this.ja.Db, b = Array(this.ja.Cb), c = 0, d;
for (d in a) b[c] = a[d].key, c++;
return b
};
sb.prototype.Rv = function () {
var a = new E, b = this.ja.Db, c;
for (c in b) a.add(b[c].key);
return a
};
ma.Object.defineProperties(sb.prototype, {
count: {
get: function () {
return this.ja.Cb
}
}, size: {
get: function () {
return this.ja.Cb
}
}, iterator: {
get: function () {
return 0 >= this.ja.Cb ? gb : new rb(this.ja)
}
}
});
sb.prototype.toList = sb.prototype.Rv;
sb.prototype.toArray = sb.prototype.Na;
sb.prototype.toSet = sb.prototype.Sv;
sb.prototype.first = sb.prototype.first;
sb.prototype.clear = sb.prototype.clear;
sb.prototype["delete"] = sb.prototype.delete;
sb.prototype.remove = sb.prototype.remove;
sb.prototype.has = sb.prototype.has;
sb.prototype.contains = sb.prototype.contains;
sb.prototype.add = sb.prototype.add;
sb.prototype.thaw = sb.prototype.ha;
sb.prototype.freeze = sb.prototype.freeze;
sb.className = "MapKeySet";
function tb(a) {
this.ja = a;
a.Te = null;
this.la = a.Ba;
this.na = null
}
tb.prototype.reset = function () {
var a = this.ja;
a.Te = null;
this.la = a.Ba;
this.na = null
};
tb.prototype.next = function () {
var a = this.ja;
if (a.Ba !== this.la && null === this.key) return !1;
var b = this.na;
b = null === b ? a.fa : b.oa;
if (null !== b) return this.na = b, this.value = b.value, this.key = b.key, !0;
this.xd();
return !1
};
tb.prototype.dd = function () {
return this.next()
};
tb.prototype.first = function () {
var a = this.ja;
this.la = a.Ba;
a = a.fa;
if (null !== a) {
this.na = a;
var b = a.value;
this.key = a.key;
return this.value = b
}
return null
};
tb.prototype.any = function (a) {
var b = this.ja;
this.na = b.Te = null;
for (b = b.fa; null !== b;) {
if (a(b.value)) return !0;
b = b.oa
}
return !1
};
tb.prototype.all = function (a) {
var b = this.ja;
this.na = b.Te = null;
for (b = b.fa; null !== b;) {
if (!a(b.value)) return !1;
b = b.oa
}
return !0
};
tb.prototype.each = function (a) {
var b = this.ja;
this.na = b.Te = null;
for (b = b.fa; null !== b;) a(b.value), b = b.oa;
return this
};
tb.prototype.map = function (a) {
var b = this.ja;
this.na = b.Te = null;
var c = new E;
for (b = b.fa; null !== b;) c.add(a(b.value)), b = b.oa;
return c.iterator
};
tb.prototype.filter = function (a) {
var b = this.ja;
this.na = b.Te = null;
var c = new E;
for (b = b.fa; null !== b;) {
var d = b.value;
a(d) && c.add(d);
b = b.oa
}
return c.iterator
};
tb.prototype.xd = function () {
this.value = this.key = null;
this.la = -1;
this.ja.Te = this
};
tb.prototype.toString = function () {
return null !== this.na ? "MapValueSetIterator@" + this.na.value : "MapValueSetIterator"
};
ma.Object.defineProperties(tb.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return this.ja.Cb
}
}
});
tb.prototype.first = tb.prototype.first;
tb.prototype.hasNext = tb.prototype.dd;
tb.prototype.next = tb.prototype.next;
tb.prototype.reset = tb.prototype.reset;
tb.className = "MapValueSetIterator";
function pb(a, b) {
this.key = a;
this.value = b;
this.xl = this.oa = null
}
pb.prototype.toString = function () {
return "{" + this.key + ":" + this.value + "}"
};
pb.className = "KeyValuePair";
function ub(a) {
this.ja = a;
a.Ja = null;
this.la = a.Ba;
this.na = null
}
ub.prototype.reset = function () {
var a = this.ja;
a.Ja = null;
this.la = a.Ba;
this.na = null
};
ub.prototype.next = function () {
var a = this.ja;
if (a.Ba !== this.la && null === this.key) return !1;
var b = this.na;
b = null === b ? a.fa : b.oa;
if (null !== b) return this.na = b, this.key = b.key, this.value = b.value, !0;
this.xd();
return !1
};
ub.prototype.dd = function () {
return this.next()
};
ub.prototype.first = function () {
var a = this.ja;
this.la = a.Ba;
a = a.fa;
return null !== a ? (this.na = a, this.key = a.key, this.value = a.value, a) : null
};
ub.prototype.any = function (a) {
var b = this.ja;
this.na = b.Ja = null;
for (b = b.fa; null !== b;) {
if (a(b)) return !0;
b = b.oa
}
return !1
};
ub.prototype.all = function (a) {
var b = this.ja;
this.na = b.Ja = null;
for (b = b.fa; null !== b;) {
if (!a(b)) return !1;
b = b.oa
}
return !0
};
ub.prototype.each = function (a) {
var b = this.ja;
this.na = b.Ja = null;
for (b = b.fa; null !== b;) a(b), b = b.oa;
return this
};
ub.prototype.map = function (a) {
var b = this.ja;
this.na = b.Ja = null;
var c = new E;
for (b = b.fa; null !== b;) c.add(a(b)), b = b.oa;
return c.iterator
};
ub.prototype.filter = function (a) {
var b = this.ja;
this.na = b.Ja = null;
var c = new E;
for (b = b.fa; null !== b;) a(b) && c.add(b), b = b.oa;
return c.iterator
};
ub.prototype.xd = function () {
this.value = this.key = null;
this.la = -1;
this.ja.Ja = this
};
ub.prototype.toString = function () {
return null !== this.na ? "MapIterator@" + this.na : "MapIterator"
};
ma.Object.defineProperties(ub.prototype, {
iterator: {
get: function () {
return this
}
}, count: {
get: function () {
return this.ja.Cb
}
}
});
ub.prototype.first = ub.prototype.first;
ub.prototype.hasNext = ub.prototype.dd;
ub.prototype.next = ub.prototype.next;
ub.prototype.reset = ub.prototype.reset;
ub.className = "MapIterator";
function vb(a) {
ab(this);
this.v = !1;
this.Db = {};
this.Cb = 0;
this.Te = this.Ja = null;
this.Ba = 0;
this.Ue = this.fa = null;
void 0 !== a && ("function" === typeof a || "string" === typeof a ? xa() : this.addAll(a))
}
t = vb.prototype;
t.kb = function () {
var a = this.Ba;
a++;
999999999 < a && (a = 0);
this.Ba = a
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
this.v = !1;
return this
};
t.toString = function () {
return "Map()#" + lb(this)
};
t.add = function (a, b) {
this.v && ua(this, a);
var c = a;
ya(a) && (c = ob(a));
var d = this.Db[c];
void 0 === d ? (this.Cb++, a = new pb(a, b), this.Db[c] = a, c = this.Ue, null === c ? this.fa = a : (a.xl = c, c.oa = a), this.Ue = a, this.kb()) : d.value = b;
return this
};
t.set = function (a, b) {
return this.add(a, b)
};
t.addAll = function (a) {
if (null === a) return this;
if (za(a)) for (var b = a.length, c = 0; c < b; c++) {
var d = a[c];
this.add(d.key, d.value)
} else for (a = a.iterator; a.next();) b = a.value, this.add(b.key, b.value);
return this
};
t.first = function () {
return this.fa
};
vb.prototype.any = function (a) {
for (var b = this.fa; null !== b;) {
if (a(b)) return !0;
b = b.oa
}
return !1
};
vb.prototype.all = function (a) {
for (var b = this.fa; null !== b;) {
if (!a(b)) return !1;
b = b.oa
}
return !0
};
vb.prototype.each = function (a) {
for (var b = this.fa; null !== b;) a(b), b = b.oa;
return this
};
vb.prototype.map = function (a) {
for (var b = new vb, c = this.fa; null !== c;) b.add(c.key, a(c)), c = c.oa;
return b
};
vb.prototype.filter = function (a) {
for (var b = new vb, c = this.fa; null !== c;) a(c) && b.add(c.key, c.value), c = c.oa;
return b
};
t = vb.prototype;
t.contains = function (a) {
var b = a;
return ya(a) && (b = lb(a), void 0 === b) ? !1 : void 0 !== this.Db[b]
};
t.has = function (a) {
return this.contains(a)
};
t.J = function (a) {
var b = a;
if (ya(a) && (b = lb(a), void 0 === b)) return null;
a = this.Db[b];
return void 0 === a ? null : a.value
};
t.get = function (a) {
return this.J(a)
};
t.remove = function (a) {
if (null === a) return !1;
this.v && ua(this, a);
var b = a;
if (ya(a) && (b = lb(a), void 0 === b)) return !1;
a = this.Db[b];
if (void 0 === a) return !1;
var c = a.oa, d = a.xl;
null !== c && (c.xl = d);
null !== d && (d.oa = c);
this.fa === a && (this.fa = c);
this.Ue === a && (this.Ue = d);
delete this.Db[b];
this.Cb--;
this.kb();
return !0
};
t.delete = function (a) {
return this.remove(a)
};
t.clear = function () {
this.v && ua(this);
this.Db = {};
this.Cb = 0;
null !== this.Ja && this.Ja.reset();
null !== this.Te && this.Te.reset();
this.Ue = this.fa = null;
this.kb()
};
vb.prototype.copy = function () {
var a = new vb, b = this.Db, c;
for (c in b) {
var d = b[c];
a.add(d.key, d.value)
}
return a
};
vb.prototype.Na = function () {
var a = this.Db, b = Array(this.Cb), c = 0, d;
for (d in a) {
var e = a[d];
b[c] = new pb(e.key, e.value);
c++
}
return b
};
vb.prototype.Yd = function () {
return new sb(this)
};
ma.Object.defineProperties(vb.prototype, {
count: {
get: function () {
return this.Cb
}
}, size: {
get: function () {
return this.Cb
}
}, iterator: {
get: function () {
if (0 >= this.count) return gb;
var a = this.Ja;
return null !== a ? (a.reset(), a) : new ub(this)
}
}, iteratorKeys: {
get: function () {
return 0 >= this.count ? gb : new rb(this)
}
}, iteratorValues: {
get: function () {
if (0 >= this.count) return gb;
var a = this.Te;
return null !== a ? (a.reset(), a) : new tb(this)
}
}
});
vb.prototype.toKeySet = vb.prototype.Yd;
vb.prototype.toArray = vb.prototype.Na;
vb.prototype.clear = vb.prototype.clear;
vb.prototype["delete"] = vb.prototype.delete;
vb.prototype.remove = vb.prototype.remove;
vb.prototype.get = vb.prototype.get;
vb.prototype.getValue = vb.prototype.J;
vb.prototype.has = vb.prototype.has;
vb.prototype.contains = vb.prototype.contains;
vb.prototype.first = vb.prototype.first;
vb.prototype.addAll = vb.prototype.addAll;
vb.prototype.set = vb.prototype.set;
vb.prototype.add = vb.prototype.add;
vb.prototype.thaw = vb.prototype.ha;
vb.prototype.freeze = vb.prototype.freeze;
vb.className = "Map";
function G(a, b) {
void 0 === a ? this.G = this.F = 0 : "number" === typeof a && "number" === typeof b ? (this.F = a, this.G = b) : B("Invalid arguments to Point constructor: " + a + ", " + b);
this.v = !1
}
G.prototype.assign = function (a) {
this.F = a.F;
this.G = a.G;
return this
};
G.prototype.h = function (a, b) {
this.F = a;
this.G = b;
return this
};
G.prototype.xg = function (a, b) {
this.F = a;
this.G = b;
return this
};
G.prototype.set = function (a) {
this.F = a.F;
this.G = a.G;
return this
};
G.prototype.copy = function () {
var a = new G;
a.F = this.F;
a.G = this.G;
return a
};
t = G.prototype;
t.ga = function () {
this.v = !0;
Object.freeze(this);
return this
};
t.I = function () {
return Object.isFrozen(this) ? this : this.copy().freeze()
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
return this
};
function wb(a) {
if ("string" === typeof a) {
a = a.split(" ");
for (var b = 0, c = 0; "" === a[b];) b++;
var d = a[b++];
d && (c = parseFloat(d));
for (var e = 0; "" === a[b];) b++;
(d = a[b++]) && (e = parseFloat(d));
return new G(c, e)
}
return new G
}
function xb(a) {
return a.x.toString() + " " + a.y.toString()
}
t.toString = function () {
return "Point(" + this.x + "," + this.y + ")"
};
t.A = function (a) {
return a instanceof G ? this.F === a.x && this.G === a.y : !1
};
t.Gi = function (a, b) {
return this.F === a && this.G === b
};
t.Qa = function (a) {
return H.w(this.F, a.x) && H.w(this.G, a.y)
};
t.add = function (a) {
this.F += a.x;
this.G += a.y;
return this
};
t.Xd = function (a) {
this.F -= a.x;
this.G -= a.y;
return this
};
t.offset = function (a, b) {
this.F += a;
this.G += b;
return this
};
G.prototype.rotate = function (a) {
if (0 === a) return this;
var b = this.F, c = this.G;
if (0 === b && 0 === c) return this;
360 <= a ? a -= 360 : 0 > a && (a += 360);
if (90 === a) {
a = 0;
var d = 1
} else 180 === a ? (a = -1, d = 0) : 270 === a ? (a = 0, d = -1) : (d = a * Math.PI / 180, a = Math.cos(d), d = Math.sin(d));
this.F = a * b - d * c;
this.G = d * b + a * c;
return this
};
t = G.prototype;
t.scale = function (a, b) {
this.F *= a;
this.G *= b;
return this
};
t.Ce = function (a) {
var b = a.x - this.F;
a = a.y - this.G;
return b * b + a * a
};
t.cd = function (a, b) {
a -= this.F;
b -= this.G;
return a * a + b * b
};
t.normalize = function () {
var a = this.F, b = this.G, c = Math.sqrt(a * a + b * b);
0 < c && (this.F = a / c, this.G = b / c);
return this
};
t.Wa = function (a) {
return yb(a.x - this.F, a.y - this.G)
};
t.direction = function (a, b) {
return yb(a - this.F, b - this.G)
};
function yb(a, b) {
if (0 === a) return 0 < b ? 90 : 0 > b ? 270 : 0;
if (0 === b) return 0 < a ? 0 : 180;
if (isNaN(a) || isNaN(b)) return 0;
var c = 180 * Math.atan(Math.abs(b / a)) / Math.PI;
0 > a ? c = 0 > b ? c + 180 : 180 - c : 0 > b && (c = 360 - c);
return c
}
t.Hz = function (a, b, c, d) {
H.Ti(a, b, c, d, this.F, this.G, this);
return this
};
t.Iz = function (a, b) {
H.Ti(a.x, a.y, b.x, b.y, this.F, this.G, this);
return this
};
t.Tz = function (a, b, c, d) {
H.Xp(this.F, this.G, a, b, c, d, this);
return this
};
t.Uz = function (a, b) {
H.Xp(this.F, this.G, a.x, a.y, b.width, b.height, this);
return this
};
t.Wi = function (a, b) {
this.F = a.x + b.x * a.width + b.offsetX;
this.G = a.y + b.y * a.height + b.offsetY;
return this
};
t.sk = function (a, b, c, d, e) {
this.F = a + e.x * c + e.offsetX;
this.G = b + e.y * d + e.offsetY;
return this
};
t.transform = function (a) {
a.ta(this);
return this
};
function zb(a, b) {
b.Ud(a);
return a
}
function Ab(a, b, c, d, e, f) {
var g = e - c, h = f - d, k = g * g + h * h;
c -= a;
d -= b;
var l = -c * g - d * h;
if (0 >= l || l >= k) return g = e - a, h = f - b, Math.min(c * c + d * d, g * g + h * h);
a = g * d - h * c;
return a * a / k
}
function Bb(a, b, c, d) {
a = c - a;
b = d - b;
return a * a + b * b
}
function Db(a, b, c, d) {
a = c - a;
b = d - b;
if (0 === a) return 0 < b ? 90 : 0 > b ? 270 : 0;
if (0 === b) return 0 < a ? 0 : 180;
if (isNaN(a) || isNaN(b)) return 0;
d = 180 * Math.atan(Math.abs(b / a)) / Math.PI;
0 > a ? d = 0 > b ? d + 180 : 180 - d : 0 > b && (d = 360 - d);
return d
}
t.o = function () {
return isFinite(this.x) && isFinite(this.y)
};
G.alloc = function () {
var a = Eb.pop();
return void 0 === a ? new G : a
};
G.allocAt = function (a, b) {
var c = Eb.pop();
if (void 0 === c) return new G(a, b);
c.x = a;
c.y = b;
return c
};
G.free = function (a) {
Eb.push(a)
};
ma.Object.defineProperties(G.prototype, {
x: {
get: function () {
return this.F
}, set: function (a) {
this.F = a
}
}, y: {
get: function () {
return this.G
}, set: function (a) {
this.G = a
}
}
});
G.prototype.isReal = G.prototype.o;
G.prototype.setSpot = G.prototype.sk;
G.prototype.setRectSpot = G.prototype.Wi;
G.prototype.snapToGridPoint = G.prototype.Uz;
G.prototype.snapToGrid = G.prototype.Tz;
G.prototype.projectOntoLineSegmentPoint = G.prototype.Iz;
G.prototype.projectOntoLineSegment = G.prototype.Hz;
G.prototype.direction = G.prototype.direction;
G.prototype.directionPoint = G.prototype.Wa;
G.prototype.normalize = G.prototype.normalize;
G.prototype.distanceSquared = G.prototype.cd;
G.prototype.distanceSquaredPoint = G.prototype.Ce;
G.prototype.scale = G.prototype.scale;
G.prototype.rotate = G.prototype.rotate;
G.prototype.offset = G.prototype.offset;
G.prototype.subtract = G.prototype.Xd;
G.prototype.add = G.prototype.add;
G.prototype.equalsApprox = G.prototype.Qa;
G.prototype.equalTo = G.prototype.Gi;
G.prototype.equals = G.prototype.A;
G.prototype.set = G.prototype.set;
G.prototype.setTo = G.prototype.xg;
var Fb = null, Gb = null, Hb = null, Ib = null, Jb = null, Eb = [];
G.className = "Point";
G.parse = wb;
G.stringify = xb;
G.distanceLineSegmentSquared = Ab;
G.distanceSquared = Bb;
G.direction = Db;
G.Origin = Fb = (new G(0, 0)).ga();
G.InfiniteTopLeft = Gb = (new G(-Infinity, -Infinity)).ga();
G.InfiniteBottomRight = Hb = (new G(Infinity, Infinity)).ga();
G.SixPoint = Ib = (new G(6, 6)).ga();
G.NoPoint = Jb = (new G(NaN, NaN)).ga();
G.parse = wb;
G.stringify = xb;
G.distanceLineSegmentSquared = Ab;
G.distanceSquared = Bb;
G.direction = Db;
function M(a, b) {
void 0 === a ? this.Z = this.$ = 0 : "number" === typeof a && (0 <= a || isNaN(a)) && "number" === typeof b && (0 <= b || isNaN(b)) ? (this.$ = a, this.Z = b) : B("Invalid arguments to Size constructor: " + a + ", " + b);
this.v = !1
}
var Kb, Lb, Mb, Ob, Pb, Qb, Rb;
M.prototype.assign = function (a) {
this.$ = a.$;
this.Z = a.Z;
return this
};
M.prototype.h = function (a, b) {
this.$ = a;
this.Z = b;
return this
};
M.prototype.xg = function (a, b) {
this.$ = a;
this.Z = b;
return this
};
M.prototype.set = function (a) {
this.$ = a.$;
this.Z = a.Z;
return this
};
M.prototype.copy = function () {
var a = new M;
a.$ = this.$;
a.Z = this.Z;
return a
};
t = M.prototype;
t.ga = function () {
this.v = !0;
Object.freeze(this);
return this
};
t.I = function () {
return Object.isFrozen(this) ? this : this.copy().freeze()
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
return this
};
function Sb(a) {
if ("string" === typeof a) {
a = a.split(" ");
for (var b = 0, c = 0; "" === a[b];) b++;
var d = a[b++];
d && (c = parseFloat(d));
for (var e = 0; "" === a[b];) b++;
(d = a[b++]) && (e = parseFloat(d));
return new M(c, e)
}
return new M
}
function Tb(a) {
return a.width.toString() + " " + a.height.toString()
}
t.toString = function () {
return "Size(" + this.width + "," + this.height + ")"
};
t.A = function (a) {
return a instanceof M ? this.$ === a.width && this.Z === a.height : !1
};
t.Gi = function (a, b) {
return this.$ === a && this.Z === b
};
t.Qa = function (a) {
return H.w(this.$, a.width) && H.w(this.Z, a.height)
};
t.o = function () {
return isFinite(this.width) && isFinite(this.height)
};
M.alloc = function () {
var a = Vb.pop();
return void 0 === a ? new M : a
};
M.free = function (a) {
Vb.push(a)
};
ma.Object.defineProperties(M.prototype, {
width: {
get: function () {
return this.$
}, set: function (a) {
0 > a && va(a, ">= 0", M, "width");
this.$ = a
}
}, height: {
get: function () {
return this.Z
}, set: function (a) {
0 > a && va(a, ">= 0", M, "height");
this.Z = a
}
}
});
M.prototype.isReal = M.prototype.o;
M.prototype.equalsApprox = M.prototype.Qa;
M.prototype.equalTo = M.prototype.Gi;
M.prototype.equals = M.prototype.A;
M.prototype.set = M.prototype.set;
M.prototype.setTo = M.prototype.xg;
var Vb = [];
M.className = "Size";
M.parse = Sb;
M.stringify = Tb;
M.ZeroSize = Kb = (new M(0, 0)).ga();
M.OneSize = Lb = (new M(1, 1)).ga();
M.SixSize = Mb = (new M(6, 6)).ga();
M.EightSize = Ob = (new M(8, 8)).ga();
M.TenSize = Pb = (new M(10, 10)).ga();
M.InfiniteSize = Qb = (new M(Infinity, Infinity)).ga();
M.NoSize = Rb = (new M(NaN, NaN)).ga();
M.parse = Sb;
M.stringify = Tb;
function N(a, b, c, d) {
void 0 === a ? this.Z = this.$ = this.G = this.F = 0 : a instanceof G ? (c = a.x, a = a.y, b instanceof G ? (d = b.x, b = b.y, this.F = Math.min(c, d), this.G = Math.min(a, b), this.$ = Math.abs(c - d), this.Z = Math.abs(a - b)) : b instanceof M ? (this.F = c, this.G = a, this.$ = b.$, this.Z = b.Z) : B("Incorrect arguments supplied to Rect constructor")) : "number" === typeof a && "number" === typeof b && "number" === typeof c && (0 <= c || isNaN(c)) && "number" === typeof d && (0 <= d || isNaN(d)) ? (this.F = a, this.G = b, this.$ = c, this.Z = d) : B("Invalid arguments to Rect constructor: " +
a + ", " + b + ", " + c + ", " + d);
this.v = !1
}
t = N.prototype;
t.assign = function (a) {
this.F = a.F;
this.G = a.G;
this.$ = a.$;
this.Z = a.Z;
return this
};
t.h = function (a, b, c, d) {
this.F = a;
this.G = b;
this.$ = c;
this.Z = d;
return this
};
function Wb(a, b, c) {
a.$ = b;
a.Z = c
}
t.xg = function (a, b, c, d) {
this.F = a;
this.G = b;
this.$ = c;
this.Z = d;
return this
};
t.set = function (a) {
this.F = a.F;
this.G = a.G;
this.$ = a.$;
this.Z = a.Z;
return this
};
t.jd = function (a) {
this.F = a.x;
this.G = a.y;
return this
};
t.Rz = function (a) {
this.$ = a.$;
this.Z = a.Z;
return this
};
N.prototype.copy = function () {
var a = new N;
a.F = this.F;
a.G = this.G;
a.$ = this.$;
a.Z = this.Z;
return a
};
t = N.prototype;
t.ga = function () {
this.v = !0;
Object.freeze(this);
return this
};
t.I = function () {
return Object.isFrozen(this) ? this : this.copy().freeze()
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
return this
};
function Xb(a) {
if ("string" === typeof a) {
a = a.split(" ");
for (var b = 0, c = 0; "" === a[b];) b++;
var d = a[b++];
d && (c = parseFloat(d));
for (var e = 0; "" === a[b];) b++;
(d = a[b++]) && (e = parseFloat(d));
for (var f = 0; "" === a[b];) b++;
(d = a[b++]) && (f = parseFloat(d));
for (var g = 0; "" === a[b];) b++;
(d = a[b++]) && (g = parseFloat(d));
return new N(c, e, f, g)
}
return new N
}
function $b(a) {
return a.x.toString() + " " + a.y.toString() + " " + a.width.toString() + " " + a.height.toString()
}
t.toString = function () {
return "Rect(" + this.x + "," + this.y + "," + this.width + "," + this.height + ")"
};
t.A = function (a) {
return a instanceof N ? this.F === a.x && this.G === a.y && this.$ === a.width && this.Z === a.height : !1
};
t.Gi = function (a, b, c, d) {
return this.F === a && this.G === b && this.$ === c && this.Z === d
};
t.Qa = function (a) {
return H.w(this.F, a.x) && H.w(this.G, a.y) && H.w(this.$, a.width) && H.w(this.Z, a.height)
};
function ac(a, b) {
return H.ca(a.F, b.x) && H.ca(a.G, b.y) && H.ca(a.$, b.width) && H.ca(a.Z, b.height)
}
t.da = function (a) {
return this.F <= a.x && this.F + this.$ >= a.x && this.G <= a.y && this.G + this.Z >= a.y
};
t.nf = function (a) {
return this.F <= a.x && a.x + a.width <= this.F + this.$ && this.G <= a.y && a.y + a.height <= this.G + this.Z
};
t.contains = function (a, b, c, d) {
void 0 === c && (c = 0);
void 0 === d && (d = 0);
return this.F <= a && a + c <= this.F + this.$ && this.G <= b && b + d <= this.G + this.Z
};
t.reset = function () {
this.Z = this.$ = this.G = this.F = 0
};
t.offset = function (a, b) {
this.F += a;
this.G += b;
return this
};
t.Uc = function (a, b) {
return bc(this, b, a, b, a)
};
t.Op = function (a) {
return bc(this, a.top, a.right, a.bottom, a.left)
};
t.Qv = function (a) {
return bc(this, -a.top, -a.right, -a.bottom, -a.left)
};
t.jz = function (a, b, c, d) {
return bc(this, a, b, c, d)
};
function bc(a, b, c, d, e) {
var f = a.$;
c + e <= -f ? (a.F += f / 2, a.$ = 0) : (a.F -= e, a.$ += c + e);
c = a.Z;
b + d <= -c ? (a.G += c / 2, a.Z = 0) : (a.G -= b, a.Z += b + d);
return a
}
t.nz = function (a) {
return cc(this, a.x, a.y, a.width, a.height)
};
t.iv = function (a, b, c, d) {
return cc(this, a, b, c, d)
};
function cc(a, b, c, d, e) {
var f = Math.max(a.F, b), g = Math.max(a.G, c);
b = Math.min(a.F + a.$, b + d);
c = Math.min(a.G + a.Z, c + e);
a.F = f;
a.G = g;
a.$ = Math.max(0, b - f);
a.Z = Math.max(0, c - g);
return a
}
t.Ic = function (a) {
return this.jv(a.x, a.y, a.width, a.height)
};
t.jv = function (a, b, c, d) {
var e = this.$, f = this.F;
if (Infinity !== e && Infinity !== c && (e += f, c += a, isNaN(c) || isNaN(e) || f > c || a > e)) return !1;
a = this.Z;
c = this.G;
return Infinity !== a && Infinity !== d && (a += c, d += b, isNaN(d) || isNaN(a) || c > d || b > a) ? !1 : !0
};
function dc(a, b, c) {
var d = a.$, e = a.F, f = b.x - c;
if (e > b.width + c + c + f || f > d + e) return !1;
d = a.Z;
a = a.G;
e = b.y - c;
return a > b.height + c + c + e || e > d + a ? !1 : !0
}
t.Je = function (a) {
return ec(this, a.x, a.y, 0, 0)
};
t.Jc = function (a) {
return ec(this, a.F, a.G, a.$, a.Z)
};
t.Xv = function (a, b, c, d) {
void 0 === c && (c = 0);
void 0 === d && (d = 0);
return ec(this, a, b, c, d)
};
function ec(a, b, c, d, e) {
var f = Math.min(a.F, b), g = Math.min(a.G, c);
b = Math.max(a.F + a.$, b + d);
c = Math.max(a.G + a.Z, c + e);
a.F = f;
a.G = g;
a.$ = b - f;
a.Z = c - g;
return a
}
t.sk = function (a, b, c) {
this.F = a - c.offsetX - c.x * this.$;
this.G = b - c.offsetY - c.y * this.Z;
return this
};
function fc(a, b, c, d, e, f, g, h) {
void 0 === g && (g = 0);
void 0 === h && (h = 0);
return a <= e && e + g <= a + c && b <= f && f + h <= b + d
}
function lc(a, b, c, d, e, f, g, h) {
return a > g + e || e > c + a ? !1 : b > h + f || f > d + b ? !1 : !0
}
t.o = function () {
return isFinite(this.x) && isFinite(this.y) && isFinite(this.width) && isFinite(this.height)
};
t.pz = function () {
return 0 === this.width && 0 === this.height
};
N.alloc = function () {
var a = mc.pop();
return void 0 === a ? new N : a
};
N.allocAt = function (a, b, c, d) {
var e = mc.pop();
return void 0 === e ? new N(a, b, c, d) : e.h(a, b, c, d)
};
N.free = function (a) {
mc.push(a)
};
ma.Object.defineProperties(N.prototype, {
x: {
get: function () {
return this.F
}, set: function (a) {
this.F = a
}
}, y: {
get: function () {
return this.G
}, set: function (a) {
this.G = a
}
}, width: {
get: function () {
return this.$
}, set: function (a) {
0 > a && va(a, ">= 0", N, "width");
this.$ = a
}
}, height: {
get: function () {
return this.Z
}, set: function (a) {
0 > a && va(a, ">= 0", N, "height");
this.Z = a
}
}, left: {
get: function () {
return this.F
}, set: function (a) {
this.F = a
}
}, top: {
get: function () {
return this.G
}, set: function (a) {
this.G = a
}
}, right: {
get: function () {
return this.F + this.$
}, set: function (a) {
this.F += a - (this.F + this.$)
}
}, bottom: {
get: function () {
return this.G + this.Z
}, set: function (a) {
this.G += a - (this.G + this.Z)
}
}, position: {
get: function () {
return new G(this.F, this.G)
}, set: function (a) {
this.F = a.x;
this.G =
a.y
}
}, size: {
get: function () {
return new M(this.$, this.Z)
}, set: function (a) {
this.$ = a.width;
this.Z = a.height
}
}, center: {
get: function () {
return new G(this.F + this.$ / 2, this.G + this.Z / 2)
}, set: function (a) {
this.F = a.x - this.$ / 2;
this.G = a.y - this.Z / 2
}
}, centerX: {
get: function () {
return this.F + this.$ / 2
}, set: function (a) {
this.F = a - this.$ / 2
}
}, centerY: {
get: function () {
return this.G + this.Z / 2
}, set: function (a) {
this.G =
a - this.Z / 2
}
}
});
N.prototype.isEmpty = N.prototype.pz;
N.prototype.isReal = N.prototype.o;
N.prototype.setSpot = N.prototype.sk;
N.prototype.union = N.prototype.Xv;
N.prototype.unionRect = N.prototype.Jc;
N.prototype.unionPoint = N.prototype.Je;
N.prototype.intersects = N.prototype.jv;
N.prototype.intersectsRect = N.prototype.Ic;
N.prototype.intersect = N.prototype.iv;
N.prototype.intersectRect = N.prototype.nz;
N.prototype.grow = N.prototype.jz;
N.prototype.subtractMargin = N.prototype.Qv;
N.prototype.addMargin = N.prototype.Op;
N.prototype.inflate = N.prototype.Uc;
N.prototype.offset = N.prototype.offset;
N.prototype.contains = N.prototype.contains;
N.prototype.containsRect = N.prototype.nf;
N.prototype.containsPoint = N.prototype.da;
N.prototype.equalsApprox = N.prototype.Qa;
N.prototype.equalTo = N.prototype.Gi;
N.prototype.equals = N.prototype.A;
N.prototype.setSize = N.prototype.Rz;
N.prototype.setPoint = N.prototype.jd;
N.prototype.set = N.prototype.set;
N.prototype.setTo = N.prototype.xg;
var nc = null, oc = null, mc = [];
N.className = "Rect";
N.parse = Xb;
N.stringify = $b;
N.contains = fc;
N.intersects = lc;
N.ZeroRect = nc = (new N(0, 0, 0, 0)).ga();
N.NoRect = oc = (new N(NaN, NaN, NaN, NaN)).ga();
N.parse = Xb;
N.stringify = $b;
N.contains = fc;
N.intersects = lc;
function pc(a, b, c, d) {
void 0 === a ? this.le = this.be = this.ve = this.xe = 0 : void 0 === b ? this.left = this.bottom = this.right = this.top = a : void 0 === c ? (this.top = a, this.right = b, this.bottom = a, this.left = b) : void 0 !== d ? (this.top = a, this.right = b, this.bottom = c, this.left = d) : B("Invalid arguments to Margin constructor: " + a + ", " + b + ", " + c + ", " + d);
this.v = !1
}
pc.prototype.assign = function (a) {
this.xe = a.xe;
this.ve = a.ve;
this.be = a.be;
this.le = a.le;
return this
};
pc.prototype.xg = function (a, b, c, d) {
this.xe = a;
this.ve = b;
this.be = c;
this.le = d;
return this
};
pc.prototype.set = function (a) {
this.xe = a.xe;
this.ve = a.ve;
this.be = a.be;
this.le = a.le;
return this
};
pc.prototype.copy = function () {
var a = new pc;
a.xe = this.xe;
a.ve = this.ve;
a.be = this.be;
a.le = this.le;
return a
};
t = pc.prototype;
t.ga = function () {
this.v = !0;
Object.freeze(this);
return this
};
t.I = function () {
return Object.isFrozen(this) ? this : this.copy().freeze()
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
return this
};
function qc(a) {
if ("string" === typeof a) {
a = a.split(" ");
for (var b = 0, c = NaN; "" === a[b];) b++;
var d = a[b++];
d && (c = parseFloat(d));
if (isNaN(c)) return new pc;
for (var e = NaN; "" === a[b];) b++;
(d = a[b++]) && (e = parseFloat(d));
if (isNaN(e)) return new pc(c);
for (var f = NaN; "" === a[b];) b++;
(d = a[b++]) && (f = parseFloat(d));
if (isNaN(f)) return new pc(c, e);
for (var g = NaN; "" === a[b];) b++;
(d = a[b++]) && (g = parseFloat(d));
return isNaN(g) ? new pc(c, e) : new pc(c, e, f, g)
}
return new pc
}
function rc(a) {
return a.top.toString() + " " + a.right.toString() + " " + a.bottom.toString() + " " + a.left.toString()
}
t.toString = function () {
return "Margin(" + this.top + "," + this.right + "," + this.bottom + "," + this.left + ")"
};
t.A = function (a) {
return a instanceof pc ? this.xe === a.top && this.ve === a.right && this.be === a.bottom && this.le === a.left : !1
};
t.Gi = function (a, b, c, d) {
return this.xe === a && this.ve === b && this.be === c && this.le === d
};
t.Qa = function (a) {
return H.w(this.xe, a.top) && H.w(this.ve, a.right) && H.w(this.be, a.bottom) && H.w(this.le, a.left)
};
t.o = function () {
return isFinite(this.top) && isFinite(this.right) && isFinite(this.bottom) && isFinite(this.left)
};
pc.alloc = function () {
var a = tc.pop();
return void 0 === a ? new pc : a
};
pc.free = function (a) {
tc.push(a)
};
ma.Object.defineProperties(pc.prototype, {
top: {
get: function () {
return this.xe
}, set: function (a) {
this.xe = a
}
}, right: {
get: function () {
return this.ve
}, set: function (a) {
this.ve = a
}
}, bottom: {
get: function () {
return this.be
}, set: function (a) {
this.be = a
}
}, left: {
get: function () {
return this.le
}, set: function (a) {
this.le = a
}
}
});
pc.prototype.isReal = pc.prototype.o;
pc.prototype.equalsApprox = pc.prototype.Qa;
pc.prototype.equalTo = pc.prototype.Gi;
pc.prototype.equals = pc.prototype.A;
pc.prototype.set = pc.prototype.set;
pc.prototype.setTo = pc.prototype.xg;
var uc = null, vc = null, tc = [];
pc.className = "Margin";
pc.parse = qc;
pc.stringify = rc;
pc.ZeroMargin = uc = (new pc(0, 0, 0, 0)).ga();
pc.TwoMargin = vc = (new pc(2, 2, 2, 2)).ga();
pc.parse = qc;
pc.stringify = rc;
function wc() {
this.m11 = 1;
this.m21 = this.m12 = 0;
this.m22 = 1;
this.dy = this.dx = 0
}
wc.prototype.set = function (a) {
this.m11 = a.m11;
this.m12 = a.m12;
this.m21 = a.m21;
this.m22 = a.m22;
this.dx = a.dx;
this.dy = a.dy;
return this
};
wc.prototype.copy = function () {
var a = new wc;
a.m11 = this.m11;
a.m12 = this.m12;
a.m21 = this.m21;
a.m22 = this.m22;
a.dx = this.dx;
a.dy = this.dy;
return a
};
t = wc.prototype;
t.toString = function () {
return "Transform(" + this.m11 + "," + this.m12 + "," + this.m21 + "," + this.m22 + "," + this.dx + "," + this.dy + ")"
};
t.A = function (a) {
return a instanceof wc ? this.m11 === a.m11 && this.m12 === a.m12 && this.m21 === a.m21 && this.m22 === a.m22 && this.dx === a.dx && this.dy === a.dy : !1
};
t.ct = function () {
return 0 === this.dx && 0 === this.dy && 1 === this.m11 && 0 === this.m12 && 0 === this.m21 && 1 === this.m22
};
t.reset = function () {
this.m11 = 1;
this.m21 = this.m12 = 0;
this.m22 = 1;
this.dy = this.dx = 0;
return this
};
t.multiply = function (a) {
var b = this.m12 * a.m11 + this.m22 * a.m12, c = this.m11 * a.m21 + this.m21 * a.m22,
d = this.m12 * a.m21 + this.m22 * a.m22, e = this.m11 * a.dx + this.m21 * a.dy + this.dx,
f = this.m12 * a.dx + this.m22 * a.dy + this.dy;
this.m11 = this.m11 * a.m11 + this.m21 * a.m12;
this.m12 = b;
this.m21 = c;
this.m22 = d;
this.dx = e;
this.dy = f;
return this
};
t.pv = function (a) {
var b = 1 / (a.m11 * a.m22 - a.m12 * a.m21), c = a.m22 * b, d = -a.m12 * b, e = -a.m21 * b, f = a.m11 * b,
g = b * (a.m21 * a.dy - a.m22 * a.dx);
a = b * (a.m12 * a.dx - a.m11 * a.dy);
b = this.m11 * c + this.m21 * d;
c = this.m12 * c + this.m22 * d;
d = this.m11 * e + this.m21 * f;
e = this.m12 * e + this.m22 * f;
this.dx = this.m11 * g + this.m21 * a + this.dx;
this.dy = this.m12 * g + this.m22 * a + this.dy;
this.m11 = b;
this.m12 = c;
this.m21 = d;
this.m22 = e;
return this
};
t.bt = function () {
var a = 1 / (this.m11 * this.m22 - this.m12 * this.m21), b = -this.m12 * a, c = -this.m21 * a, d = this.m11 * a,
e = a * (this.m21 * this.dy - this.m22 * this.dx), f = a * (this.m12 * this.dx - this.m11 * this.dy);
this.m11 = this.m22 * a;
this.m12 = b;
this.m21 = c;
this.m22 = d;
this.dx = e;
this.dy = f;
return this
};
wc.prototype.rotate = function (a, b, c) {
360 <= a ? a -= 360 : 0 > a && (a += 360);
if (0 === a) return this;
this.translate(b, c);
if (90 === a) {
a = 0;
var d = 1
} else 180 === a ? (a = -1, d = 0) : 270 === a ? (a = 0, d = -1) : (d = a * Math.PI / 180, a = Math.cos(d), d = Math.sin(d));
var e = this.m12 * a + this.m22 * d, f = this.m11 * -d + this.m21 * a, g = this.m12 * -d + this.m22 * a;
this.m11 = this.m11 * a + this.m21 * d;
this.m12 = e;
this.m21 = f;
this.m22 = g;
this.translate(-b, -c);
return this
};
t = wc.prototype;
t.translate = function (a, b) {
this.dx += this.m11 * a + this.m21 * b;
this.dy += this.m12 * a + this.m22 * b;
return this
};
t.scale = function (a, b) {
void 0 === b && (b = a);
this.m11 *= a;
this.m12 *= a;
this.m21 *= b;
this.m22 *= b;
return this
};
t.ta = function (a) {
var b = a.x, c = a.y;
return a.h(b * this.m11 + c * this.m21 + this.dx, b * this.m12 + c * this.m22 + this.dy)
};
t.Ud = function (a) {
var b = 1 / (this.m11 * this.m22 - this.m12 * this.m21), c = a.x, d = a.y;
return a.h(c * this.m22 * b + d * -this.m21 * b + b * (this.m21 * this.dy - this.m22 * this.dx), c * -this.m12 * b + d * this.m11 * b + b * (this.m12 * this.dx - this.m11 * this.dy))
};
t.Wv = function (a) {
var b = a.F, c = a.G, d = b + a.$, e = c + a.Z, f = this.m11, g = this.m12, h = this.m21, k = this.m22,
l = this.dx, m = this.dy, n = b * f + c * h + l, p = b * g + c * k + m, r = d * f + c * h + l,
q = d * g + c * k + m;
c = b * f + e * h + l;
b = b * g + e * k + m;
f = d * f + e * h + l;
d = d * g + e * k + m;
e = Math.min(n, r);
n = Math.max(n, r);
r = Math.min(p, q);
p = Math.max(p, q);
e = Math.min(e, c);
n = Math.max(n, c);
r = Math.min(r, b);
p = Math.max(p, b);
e = Math.min(e, f);
n = Math.max(n, f);
r = Math.min(r, d);
p = Math.max(p, d);
a.F = e;
a.G = r;
a.$ = n - e;
a.Z = p - r;
return a
};
wc.alloc = function () {
var a = xc.pop();
return void 0 === a ? new wc : a
};
wc.free = function (a) {
xc.push(a)
};
wc.prototype.transformRect = wc.prototype.Wv;
wc.prototype.invertedTransformPoint = wc.prototype.Ud;
wc.prototype.transformPoint = wc.prototype.ta;
wc.prototype.scale = wc.prototype.scale;
wc.prototype.translate = wc.prototype.translate;
wc.prototype.rotate = wc.prototype.rotate;
wc.prototype.invert = wc.prototype.bt;
wc.prototype.multiplyInverted = wc.prototype.pv;
wc.prototype.multiply = wc.prototype.multiply;
wc.prototype.reset = wc.prototype.reset;
wc.prototype.isIdentity = wc.prototype.ct;
wc.prototype.equals = wc.prototype.A;
wc.prototype.set = wc.prototype.set;
var xc = [];
wc.className = "Transform";
wc.xF = "54a702f3e53909c447824c6706603faf4c";
function O(a, b, c, d) {
void 0 === a ? this.Nd = this.Md = this.G = this.F = 0 : (void 0 === b && (b = 0), void 0 === c && (c = 0), void 0 === d && (d = 0), this.x = a, this.y = b, this.offsetX = c, this.offsetY = d);
this.v = !1
}
var yc, zc, Ac, Dc, Ec, Fc, Gc, Hc, Ic, Jc, Kc, Mc, Nc, Oc, Pc, Qc, Rc, Sc, Tc, Vc, Wc, Xc, Yc, Zc, $c, ad, bd, cd,
dd, ed, fd, ld, md, nd, od, pd;
O.prototype.assign = function (a) {
this.F = a.F;
this.G = a.G;
this.Md = a.Md;
this.Nd = a.Nd;
return this
};
O.prototype.xg = function (a, b, c, d) {
this.F = a;
this.G = b;
this.Md = c;
this.Nd = d;
return this
};
O.prototype.set = function (a) {
this.F = a.F;
this.G = a.G;
this.Md = a.Md;
this.Nd = a.Nd;
return this
};
O.prototype.copy = function () {
var a = new O;
a.F = this.F;
a.G = this.G;
a.Md = this.Md;
a.Nd = this.Nd;
return a
};
t = O.prototype;
t.ga = function () {
this.v = !0;
Object.freeze(this);
return this
};
t.I = function () {
return Object.isFrozen(this) ? this : this.copy().freeze()
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
return this
};
function qd(a, b) {
a.F = NaN;
a.G = NaN;
a.Md = b;
return a
}
function rd(a) {
if ("string" === typeof a) {
a = a.trim();
if ("None" === a) return yc;
if ("TopLeft" === a) return zc;
if ("Top" === a || "TopCenter" === a || "MiddleTop" === a) return Ac;
if ("TopRight" === a) return Dc;
if ("Left" === a || "LeftCenter" === a || "MiddleLeft" === a) return Ec;
if ("Center" === a) return Fc;
if ("Right" === a || "RightCenter" === a || "MiddleRight" === a) return Gc;
if ("BottomLeft" === a) return Hc;
if ("Bottom" === a || "BottomCenter" === a || "MiddleBottom" === a) return Ic;
if ("BottomRight" === a) return Jc;
if ("TopSide" === a) return Kc;
if ("LeftSide" ===
a) return Mc;
if ("RightSide" === a) return Nc;
if ("BottomSide" === a) return Oc;
if ("TopBottomSides" === a) return Pc;
if ("LeftRightSides" === a) return Qc;
if ("TopLeftSides" === a) return Rc;
if ("TopRightSides" === a) return Sc;
if ("BottomLeftSides" === a) return Tc;
if ("BottomRightSides" === a) return Vc;
if ("NotTopSide" === a) return Wc;
if ("NotLeftSide" === a) return Xc;
if ("NotRightSide" === a) return Yc;
if ("NotBottomSide" === a) return Zc;
if ("AllSides" === a) return $c;
if ("Default" === a) return ad;
a = a.split(" ");
for (var b = 0, c = 0; "" === a[b];) b++;
var d = a[b++];
void 0 !== d && 0 < d.length && (c = parseFloat(d));
for (var e = 0; "" === a[b];) b++;
d = a[b++];
void 0 !== d && 0 < d.length && (e = parseFloat(d));
for (var f = 0; "" === a[b];) b++;
d = a[b++];
void 0 !== d && 0 < d.length && (f = parseFloat(d));
for (var g = 0; "" === a[b];) b++;
d = a[b++];
void 0 !== d && 0 < d.length && (g = parseFloat(d));
return new O(c, e, f, g)
}
return new O
}
function sd(a) {
return a.gb() ? a.x.toString() + " " + a.y.toString() + " " + a.offsetX.toString() + " " + a.offsetY.toString() : a.toString()
}
t.toString = function () {
return this.gb() ? 0 === this.Md && 0 === this.Nd ? "Spot(" + this.x + "," + this.y + ")" : "Spot(" + this.x + "," + this.y + "," + this.offsetX + "," + this.offsetY + ")" : this.A(yc) ? "None" : this.A(zc) ? "TopLeft" : this.A(Ac) ? "Top" : this.A(Dc) ? "TopRight" : this.A(Ec) ? "Left" : this.A(Fc) ? "Center" : this.A(Gc) ? "Right" : this.A(Hc) ? "BottomLeft" : this.A(Ic) ? "Bottom" : this.A(Jc) ? "BottomRight" : this.A(Kc) ? "TopSide" : this.A(Mc) ? "LeftSide" : this.A(Nc) ? "RightSide" : this.A(Oc) ? "BottomSide" : this.A(Pc) ? "TopBottomSides" : this.A(Qc) ? "LeftRightSides" :
this.A(Rc) ? "TopLeftSides" : this.A(Sc) ? "TopRightSides" : this.A(Tc) ? "BottomLeftSides" : this.A(Vc) ? "BottomRightSides" : this.A(Wc) ? "NotTopSide" : this.A(Xc) ? "NotLeftSide" : this.A(Yc) ? "NotRightSide" : this.A(Zc) ? "NotBottomSide" : this.A($c) ? "AllSides" : this.A(ad) ? "Default" : "None"
};
t.A = function (a) {
return a instanceof O ? (this.F === a.x || isNaN(this.F) && isNaN(a.x)) && (this.G === a.y || isNaN(this.G) && isNaN(a.y)) && this.Md === a.offsetX && this.Nd === a.offsetY : !1
};
t.tv = function () {
return new O(.5 - (this.F - .5), .5 - (this.G - .5), -this.Md, -this.Nd)
};
t.rf = function (a) {
if (!this.sf()) return !1;
if (!a.sf()) if (a.A(bd)) a = Mc; else if (a.A(cd)) a = Nc; else if (a.A(dd)) a = Kc; else if (a.A(ed)) a = Oc; else return !1;
a = a.offsetY;
return (this.Nd & a) === a
};
t.gb = function () {
return !isNaN(this.x) && !isNaN(this.y)
};
t.jc = function () {
return isNaN(this.x) || isNaN(this.y)
};
t.sf = function () {
return isNaN(this.x) && isNaN(this.y) && 1 === this.offsetX && 0 !== this.offsetY
};
t.et = function () {
return isNaN(this.x) && isNaN(this.y) && 0 === this.offsetX && 0 === this.offsetY
};
t.Kb = function () {
return isNaN(this.x) && isNaN(this.y) && -1 === this.offsetX && 0 === this.offsetY
};
O.alloc = function () {
var a = td.pop();
return void 0 === a ? new O : a
};
O.free = function (a) {
td.push(a)
};
ma.Object.defineProperties(O.prototype, {
x: {
get: function () {
return this.F
}, set: function (a) {
this.F = a
}
}, y: {
get: function () {
return this.G
}, set: function (a) {
this.G = a
}
}, offsetX: {
get: function () {
return this.Md
}, set: function (a) {
this.Md = a
}
}, offsetY: {
get: function () {
return this.Nd
}, set: function (a) {
this.Nd = a
}
}
});
O.prototype.isDefault = O.prototype.Kb;
O.prototype.isNone = O.prototype.et;
O.prototype.isSide = O.prototype.sf;
O.prototype.isNoSpot = O.prototype.jc;
O.prototype.isSpot = O.prototype.gb;
O.prototype.includesSide = O.prototype.rf;
O.prototype.opposite = O.prototype.tv;
O.prototype.equals = O.prototype.A;
O.prototype.set = O.prototype.set;
O.prototype.setTo = O.prototype.xg;
var td = [];
O.className = "Spot";
O.parse = rd;
O.stringify = sd;
O.None = yc = qd(new O(0, 0, 0, 0), 0).ga();
O.Default = ad = qd(new O(0, 0, -1, 0), -1).ga();
O.TopLeft = zc = (new O(0, 0, 0, 0)).ga();
O.TopCenter = Ac = (new O(.5, 0, 0, 0)).ga();
O.TopRight = Dc = (new O(1, 0, 0, 0)).ga();
O.LeftCenter = Ec = (new O(0, .5, 0, 0)).ga();
O.Center = Fc = (new O(.5, .5, 0, 0)).ga();
O.RightCenter = Gc = (new O(1, .5, 0, 0)).ga();
O.BottomLeft = Hc = (new O(0, 1, 0, 0)).ga();
O.BottomCenter = Ic = (new O(.5, 1, 0, 0)).ga();
O.BottomRight = Jc = (new O(1, 1, 0, 0)).ga();
O.MiddleTop = fd = Ac;
O.MiddleLeft = ld = Ec;
O.MiddleRight = md = Gc;
O.MiddleBottom = nd = Ic;
O.Top = dd = Ac;
O.Left = bd = Ec;
O.Right = cd = Gc;
O.Bottom = ed = Ic;
O.TopSide = Kc = qd(new O(0, 0, 1, 1), 1).ga();
O.LeftSide = Mc = qd(new O(0, 0, 1, 2), 1).ga();
O.RightSide = Nc = qd(new O(0, 0, 1, 4), 1).ga();
O.BottomSide = Oc = qd(new O(0, 0, 1, 8), 1).ga();
O.TopBottomSides = Pc = qd(new O(0, 0, 1, 9), 1).ga();
O.LeftRightSides = Qc = qd(new O(0, 0, 1, 6), 1).ga();
O.TopLeftSides = Rc = qd(new O(0, 0, 1, 3), 1).ga();
O.TopRightSides = Sc = qd(new O(0, 0, 1, 5), 1).ga();
O.BottomLeftSides = Tc = qd(new O(0, 0, 1, 10), 1).ga();
O.BottomRightSides = Vc = qd(new O(0, 0, 1, 12), 1).ga();
O.NotTopSide = Wc = qd(new O(0, 0, 1, 14), 1).ga();
O.NotLeftSide = Xc = qd(new O(0, 0, 1, 13), 1).ga();
O.NotRightSide = Yc = qd(new O(0, 0, 1, 11), 1).ga();
O.NotBottomSide = Zc = qd(new O(0, 0, 1, 7), 1).ga();
O.AllSides = $c = qd(new O(0, 0, 1, 15), 1).ga();
od = (new O(.156, .156)).ga();
pd = (new O(.844, .844)).ga();
O.parse = rd;
O.stringify = sd;
var H = {
Zz: "7da71ca0ad381e90", Bg: (Math.sqrt(2) - 1) / 3 * 4, ew: null, sqrt: function (a) {
if (0 >= a) return 0;
var b = H.ew;
if (null === b) {
b = [];
for (var c = 0; 2E3 >= c; c++) b[c] = Math.sqrt(c);
H.ew = b
}
return 1 > a ? (c = 1 / a, 2E3 >= c ? 1 / b[c | 0] : Math.sqrt(a)) : 2E3 >= a ? b[a | 0] : Math.sqrt(a)
}, w: function (a, b) {
a -= b;
return .5 > a && -.5 < a
}, ca: function (a, b) {
a -= b;
return 5E-8 > a && -5E-8 < a
}, Tb: function (a, b, c, d, e, f, g) {
0 >= e && (e = 1E-6);
if (a < c) {
var h = a;
var k = c
} else h = c, k = a;
if (b < d) {
var l = b;
var m = d
} else l = d, m = b;
if (a === c) return l <= g && g <= m && a - e <= f && f <= a + e;
if (b === d) return h <=
f && f <= k && b - e <= g && g <= b + e;
k += e;
h -= e;
if (h <= f && f <= k && (m += e, l -= e, l <= g && g <= m)) if (k - h > m - l) if (a - c > e || c - a > e) {
if (f = (d - b) / (c - a) * (f - a) + b, f - e <= g && g <= f + e) return !0
} else return !0; else if (b - d > e || d - b > e) {
if (g = (c - a) / (d - b) * (g - b) + a, g - e <= f && f <= g + e) return !0
} else return !0;
return !1
}, Ks: function (a, b, c, d, e, f, g, h, k, l, m, n) {
if (H.Tb(a, b, g, h, n, c, d) && H.Tb(a, b, g, h, n, e, f)) return H.Tb(a, b, g, h, n, l, m);
var p = (a + c) / 2, r = (b + d) / 2, q = (c + e) / 2, u = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
d = (p + q) / 2;
c = (r + u) / 2;
q = (q + e) / 2;
u = (u + f) / 2;
var v = (d + q) / 2, w = (c + u) / 2;
return H.Ks(a,
b, p, r, d, c, v, w, k, l, m, n) || H.Ks(v, w, q, u, e, f, g, h, k, l, m, n)
}, ny: function (a, b, c, d, e, f, g, h, k) {
var l = (c + e) / 2, m = (d + f) / 2;
k.h((((a + c) / 2 + l) / 2 + (l + (e + g) / 2) / 2) / 2, (((b + d) / 2 + m) / 2 + (m + (f + h) / 2) / 2) / 2);
return k
}, my: function (a, b, c, d, e, f, g, h) {
var k = (c + e) / 2, l = (d + f) / 2;
return Db(((a + c) / 2 + k) / 2, ((b + d) / 2 + l) / 2, (k + (e + g) / 2) / 2, (l + (f + h) / 2) / 2)
}, Tl: function (a, b, c, d, e, f, g, h, k, l) {
if (H.Tb(a, b, g, h, k, c, d) && H.Tb(a, b, g, h, k, e, f)) ec(l, a, b, 0, 0), ec(l, g, h, 0, 0); else {
var m = (a + c) / 2, n = (b + d) / 2, p = (c + e) / 2, r = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
d = (m + p) / 2;
c = (n + r) /
2;
p = (p + e) / 2;
r = (r + f) / 2;
var q = (d + p) / 2, u = (c + r) / 2;
H.Tl(a, b, m, n, d, c, q, u, k, l);
H.Tl(q, u, p, r, e, f, g, h, k, l)
}
return l
}, Ae: function (a, b, c, d, e, f, g, h, k, l) {
if (H.Tb(a, b, g, h, k, c, d) && H.Tb(a, b, g, h, k, e, f)) 0 === l.length && (l.push(a), l.push(b)), l.push(g), l.push(h); else {
var m = (a + c) / 2, n = (b + d) / 2, p = (c + e) / 2, r = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
d = (m + p) / 2;
c = (n + r) / 2;
p = (p + e) / 2;
r = (r + f) / 2;
var q = (d + p) / 2, u = (c + r) / 2;
H.Ae(a, b, m, n, d, c, q, u, k, l);
H.Ae(q, u, p, r, e, f, g, h, k, l)
}
return l
}, wv: function (a, b, c, d, e, f, g, h, k, l) {
if (H.Tb(a, b, e, f, l, c, d)) return H.Tb(a,
b, e, f, l, h, k);
var m = (a + c) / 2, n = (b + d) / 2;
c = (c + e) / 2;
d = (d + f) / 2;
var p = (m + c) / 2, r = (n + d) / 2;
return H.wv(a, b, m, n, p, r, g, h, k, l) || H.wv(p, r, c, d, e, f, g, h, k, l)
}, hA: function (a, b, c, d, e, f, g) {
g.h(((a + c) / 2 + (c + e) / 2) / 2, ((b + d) / 2 + (d + f) / 2) / 2);
return g
}, vv: function (a, b, c, d, e, f, g, h) {
if (H.Tb(a, b, e, f, g, c, d)) ec(h, a, b, 0, 0), ec(h, e, f, 0, 0); else {
var k = (a + c) / 2, l = (b + d) / 2;
c = (c + e) / 2;
d = (d + f) / 2;
var m = (k + c) / 2, n = (l + d) / 2;
H.vv(a, b, k, l, m, n, g, h);
H.vv(m, n, c, d, e, f, g, h)
}
return h
}, nq: function (a, b, c, d, e, f, g, h) {
if (H.Tb(a, b, e, f, g, c, d)) 0 === h.length && (h.push(a),
h.push(b)), h.push(e), h.push(f); else {
var k = (a + c) / 2, l = (b + d) / 2;
c = (c + e) / 2;
d = (d + f) / 2;
var m = (k + c) / 2, n = (l + d) / 2;
H.nq(a, b, k, l, m, n, g, h);
H.nq(m, n, c, d, e, f, g, h)
}
return h
}, Pp: function (a, b, c, d, e, f, g, h, k, l, m, n, p, r) {
if (H.Tb(a, b, g, h, p, c, d) && H.Tb(a, b, g, h, p, e, f)) {
var q = (a - g) * (l - n) - (b - h) * (k - m);
if (0 === q) return !1;
p = ((a * h - b * g) * (k - m) - (a - g) * (k * n - l * m)) / q;
q = ((a * h - b * g) * (l - n) - (b - h) * (k * n - l * m)) / q;
if ((k > m ? k - m : m - k) < (l > n ? l - n : n - l)) {
if (b < h ? g = b : (g = h, h = b), q < g || q > h) return !1
} else if (a < g ? h = a : (h = g, g = a), p < h || p > g) return !1;
r.h(p, q);
return !0
}
q =
(a + c) / 2;
var u = (b + d) / 2;
c = (c + e) / 2;
d = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
var v = (q + c) / 2, w = (u + d) / 2;
c = (c + e) / 2;
d = (d + f) / 2;
var z = (v + c) / 2, y = (w + d) / 2, A = (m - k) * (m - k) + (n - l) * (n - l), C = !1;
H.Pp(a, b, q, u, v, w, z, y, k, l, m, n, p, r) && (a = (r.x - k) * (r.x - k) + (r.y - l) * (r.y - l), a < A && (A = a, C = !0));
a = r.x;
b = r.y;
H.Pp(z, y, c, d, e, f, g, h, k, l, m, n, p, r) && ((r.x - k) * (r.x - k) + (r.y - l) * (r.y - l) < A ? C = !0 : r.h(a, b));
return C
}, Qp: function (a, b, c, d, e, f, g, h, k, l, m, n, p) {
var r = 0;
if (H.Tb(a, b, g, h, p, c, d) && H.Tb(a, b, g, h, p, e, f)) {
p = (a - g) * (l - n) - (b - h) * (k - m);
if (0 === p) return r;
var q = ((a *
h - b * g) * (k - m) - (a - g) * (k * n - l * m)) / p,
u = ((a * h - b * g) * (l - n) - (b - h) * (k * n - l * m)) / p;
if (q >= m) return r;
if ((k > m ? k - m : m - k) < (l > n ? l - n : n - l)) {
if (b < h ? (a = b, b = h) : a = h, u < a || u > b) return r
} else if (a < g ? (b = a, a = g) : b = g, q < b || q > a) return r;
0 < p ? r++ : 0 > p && r--
} else {
q = (a + c) / 2;
u = (b + d) / 2;
var v = (c + e) / 2, w = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
d = (q + v) / 2;
c = (u + w) / 2;
v = (v + e) / 2;
w = (w + f) / 2;
var z = (d + v) / 2, y = (c + w) / 2;
r += H.Qp(a, b, q, u, d, c, z, y, k, l, m, n, p);
r += H.Qp(z, y, v, w, e, f, g, h, k, l, m, n, p)
}
return r
}, Ti: function (a, b, c, d, e, f, g) {
if (H.ca(a, c)) {
b < d ? (c = b, b = d) : c = d;
if (f < c) return g.h(a,
c), !1;
if (f > b) return g.h(a, b), !1;
g.h(a, f);
return !0
}
if (H.ca(b, d)) {
a < c ? (d = a, a = c) : d = c;
if (e < d) return g.h(d, b), !1;
if (e > a) return g.h(a, b), !1;
g.h(e, b);
return !0
}
e = ((a - e) * (a - c) + (b - f) * (b - d)) / ((c - a) * (c - a) + (d - b) * (d - b));
if (-5E-6 > e) return g.h(a, b), !1;
if (1.000005 < e) return g.h(c, d), !1;
g.h(a + e * (c - a), b + e * (d - b));
return !0
}, Ge: function (a, b, c, d, e, f, g, h, k) {
if (H.w(a, c) && H.w(b, d)) return k.h(a, b), !1;
if (H.ca(e, g)) return H.ca(a, c) ? (H.Ti(a, b, c, d, e, f, k), !1) : H.Ti(a, b, c, d, e, (d - b) / (c - a) * (e - a) + b, k);
h = (h - f) / (g - e);
if (H.ca(a, c)) {
c = h *
(a - e) + f;
b < d ? (e = b, b = d) : e = d;
if (c < e) return k.h(a, e), !1;
if (c > b) return k.h(a, b), !1;
k.h(a, c);
return !0
}
g = (d - b) / (c - a);
if (H.ca(h, g)) return H.Ti(a, b, c, d, e, f, k), !1;
e = (g * a - h * e + f - b) / (g - h);
if (H.ca(g, 0)) {
a < c ? (d = a, a = c) : d = c;
if (e < d) return k.h(d, b), !1;
if (e > a) return k.h(a, b), !1;
k.h(e, b);
return !0
}
return H.Ti(a, b, c, d, e, g * (e - a) + b, k)
}, eA: function (a, b, c, d, e) {
return H.Ge(c.x, c.y, d.x, d.y, a.x, a.y, b.x, b.y, e)
}, dA: function (a, b, c, d, e, f, g, h, k, l) {
function m(c, d) {
var e = (c - a) * (c - a) + (d - b) * (d - b);
e < n && (n = e, k.h(c, d))
}
var n = Infinity;
m(k.x,
k.y);
var p = 0, r = 0, q = 0, u = 0;
e < g ? (p = e, r = g) : (p = g, r = e);
f < h ? (q = e, u = g) : (q = g, u = e);
p = (r - p) / 2 + l;
l = (u - q) / 2 + l;
e = (e + g) / 2;
f = (f + h) / 2;
if (0 === p || 0 === l) return k;
if (.5 > (c > a ? c - a : a - c)) {
p = 1 - (c - e) * (c - e) / (p * p);
if (0 > p) return k;
p = Math.sqrt(p);
d = -l * p + f;
m(c, l * p + f);
m(c, d)
} else {
c = (d - b) / (c - a);
d = 1 / (p * p) + c * c / (l * l);
h = 2 * c * (b - c * a) / (l * l) - 2 * c * f / (l * l) - 2 * e / (p * p);
p = h * h - 4 * d * (2 * c * a * f / (l * l) - 2 * b * f / (l * l) + f * f / (l * l) + e * e / (p * p) - 1 + (b - c * a) * (b - c * a) / (l * l));
if (0 > p) return k;
p = Math.sqrt(p);
l = (-h + p) / (2 * d);
m(l, c * l - c * a + b);
p = (-h - p) / (2 * d);
m(p, c * p - c * a + b)
}
return k
},
Tc: function (a, b, c, d, e, f, g, h, k) {
var l = 1E21, m = a, n = b;
if (H.Ge(a, b, a, d, e, f, g, h, k)) {
var p = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f);
p < l && (l = p, m = k.x, n = k.y)
}
H.Ge(c, b, c, d, e, f, g, h, k) && (p = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f), p < l && (l = p, m = k.x, n = k.y));
H.Ge(a, b, c, b, e, f, g, h, k) && (b = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f), b < l && (l = b, m = k.x, n = k.y));
H.Ge(a, d, c, d, e, f, g, h, k) && (a = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f), a < l && (l = a, m = k.x, n = k.y));
k.h(m, n);
return 1E21 > l
}, cA: function (a, b, c, d, e, f, g, h, k) {
c = a - c;
g = e - g;
0 === c || 0 === g ? 0 === c ? (b = (f - h) / g, h = a, e = b * h + (f -
b * e)) : (f = (b - d) / c, h = e, e = f * h + (b - f * a)) : (d = (b - d) / c, h = (f - h) / g, a = b - d * a, h = (f - h * e - a) / (d - h), e = d * h + a);
k.h(h, e);
return k
}, $s: function (a, b, c) {
var d = b.x, e = b.y, f = c.x, g = c.y, h = a.left, k = a.right, l = a.top, m = a.bottom;
return d === f ? (e < g ? (f = e, e = g) : f = g, h <= d && d <= k && f <= m && e >= l) : e === g ? (d < f ? (g = d, d = f) : g = f, l <= e && e <= m && g <= k && d >= h) : a.da(b) || a.da(c) || H.Zs(h, l, k, l, d, e, f, g) || H.Zs(k, l, k, m, d, e, f, g) || H.Zs(k, m, h, m, d, e, f, g) || H.Zs(h, m, h, l, d, e, f, g) ? !0 : !1
}, Zs: function (a, b, c, d, e, f, g, h) {
return 0 >= H.Ms(a, b, c, d, e, f) * H.Ms(a, b, c, d, g, h) && 0 >= H.Ms(e,
f, g, h, a, b) * H.Ms(e, f, g, h, c, d)
}, Ms: function (a, b, c, d, e, f) {
c -= a;
d -= b;
a = e - a;
b = f - b;
f = a * d - b * c;
0 === f && (f = a * c + b * d, 0 < f && (f = (a - c) * c + (b - d) * d, 0 > f && (f = 0)));
return 0 > f ? -1 : 0 < f ? 1 : 0
}, kq: function (a) {
0 > a && (a += 360);
360 <= a && (a -= 360);
return a
}, Zw: function (a, b, c, d, e, f) {
var g = Math.PI;
f || (d *= g / 180, e *= g / 180);
var h = d > e ? -1 : 1;
f = [];
var k = g / 2, l = d;
d = Math.min(2 * g, Math.abs(e - d));
if (1E-5 > d) return k = l + h * Math.min(d, k), h = a + c * Math.cos(l), l = b + c * Math.sin(l), a += c * Math.cos(k), b += c * Math.sin(k), c = (h + a) / 2, k = (l + b) / 2, f.push([h, l, c, k, c, k, a, b]), f;
for (; 1E-5 < d;) e = l + h * Math.min(d, k), f.push(H.vy(c, l, e, a, b)), d -= Math.abs(e - l), l = e;
return f
}, vy: function (a, b, c, d, e) {
var f = (c - b) / 2, g = a * Math.cos(f), h = a * Math.sin(f), k = -h, l = g * g + k * k,
m = l + g * g + k * h;
l = 4 / 3 * (Math.sqrt(2 * l * m) - m) / (g * h - k * g);
h = g - l * k;
g = k + l * g;
k = -g;
l = f + b;
f = Math.cos(l);
l = Math.sin(l);
return [d + a * Math.cos(b), e + a * Math.sin(b), d + h * f - g * l, e + h * l + g * f, d + h * f - k * l, e + h * l + k * f, d + a * Math.cos(c), e + a * Math.sin(c)]
}, Xp: function (a, b, c, d, e, f, g) {
c = Math.floor((a - c) / e) * e + c;
d = Math.floor((b - d) / f) * f + d;
var h = c;
c + e - a < e / 2 && (h = c + e);
a = d;
d +
f - b < f / 2 && (a = d + f);
g.h(h, a);
return g
}, jx: function (a, b) {
var c = Math.max(a, b);
a = Math.min(a, b);
var d;
do b = c % a, c = d = a, a = b; while (0 < b);
return d
}, Ay: function (a, b, c, d) {
var e = 0 > c, f = 0 > d;
if (a < b) {
var g = 1;
var h = 0
} else g = 0, h = 1;
var k = 0 === g ? a : b;
var l = 0 === g ? c : d;
if (0 === g ? e : f) l = -l;
g = h;
c = 0 === g ? c : d;
if (0 === g ? e : f) c = -c;
return H.By(k, 0 === g ? a : b, l, c, 0, 0)
}, By: function (a, b, c, d, e, f) {
if (0 < d) if (0 < c) {
e = a * a;
f = b * b;
a *= c;
var g = b * d, h = -f + g, k = -f + Math.sqrt(a * a + g * g);
b = h;
for (var l = 0; 9999999999 > l; ++l) {
b = .5 * (h + k);
if (b === h || b === k) break;
var m = a / (b +
e), n = g / (b + f);
m = m * m + n * n - 1;
if (0 < m) h = b; else if (0 > m) k = b; else break
}
c = e * c / (b + e) - c;
d = f * d / (b + f) - d;
c = Math.sqrt(c * c + d * d)
} else c = Math.abs(d - b); else d = a * a - b * b, f = a * c, f < d ? (d = f / d, f = b * Math.sqrt(Math.abs(1 - d * d)), c = a * d - c, c = Math.sqrt(c * c + f * f)) : c = Math.abs(c - a);
return c
}, Ke: new db, Cm: new db
};
H.za = H.Zz;
function ud(a) {
ab(this);
this.v = !1;
void 0 === a && (a = vd);
this.va = a;
this.Bc = this.mc = this.bd = this.ad = 0;
this.ij = new E;
this.nr = this.ij.Ba;
this.Wq = (new N).freeze();
this.ra = !0;
this.Om = this.Ak = null;
this.Pm = NaN;
this.df = zc;
this.ef = Jc;
this.dl = this.fl = NaN;
this.Gf = wd
}
ud.prototype.copy = function () {
var a = new ud;
a.va = this.va;
a.ad = this.ad;
a.bd = this.bd;
a.mc = this.mc;
a.Bc = this.Bc;
for (var b = this.ij.j, c = b.length, d = a.ij, e = 0; e < c; e++) {
var f = b[e].copy();
d.add(f)
}
a.nr = this.nr;
a.Wq.assign(this.Wq);
a.ra = this.ra;
a.Ak = this.Ak;
a.Om = this.Om;
a.Pm = this.Pm;
a.df = this.df.I();
a.ef = this.ef.I();
a.fl = this.fl;
a.dl = this.dl;
a.Gf = this.Gf;
return a
};
t = ud.prototype;
t.ga = function () {
this.freeze();
Object.freeze(this);
return this
};
t.freeze = function () {
this.v = !0;
var a = this.figures;
a.freeze();
a = a.j;
for (var b = a.length, c = 0; c < b; c++) a[c].freeze();
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
var a = this.figures;
a.ha();
a = a.j;
for (var b = a.length, c = 0; c < b; c++) a[c].ha();
return this
};
t.Qa = function (a) {
if (!(a instanceof ud)) return !1;
if (this.type !== a.type) return this.type === xd && a.type === vd ? Ed(this, a) : a.type === xd && this.type === vd ? Ed(a, this) : !1;
if (this.type === vd) {
var b = this.figures.j;
a = a.figures.j;
var c = b.length;
if (c !== a.length) return !1;
for (var d = 0; d < c; d++) if (!b[d].Qa(a[d])) return !1;
return !0
}
return H.w(this.startX, a.startX) && H.w(this.startY, a.startY) && H.w(this.endX, a.endX) && H.w(this.endY, a.endY)
};
function Ed(a, b) {
return a.type !== xd || b.type !== vd ? !1 : 1 === b.figures.count && (b = b.figures.N(0), 1 === b.segments.count && H.w(a.startX, b.startX) && H.w(a.startY, b.startY) && (b = b.segments.N(0), b.type === Fd && H.w(a.endX, b.endX) && H.w(a.endY, b.endY))) ? !0 : !1
}
function Gd(a) {
return a.toString()
}
t.fb = function (a) {
a.classType === ud && (this.type = a)
};
t.toString = function (a) {
void 0 === a && (a = -1);
switch (this.type) {
case xd:
return 0 > a ? "M" + this.startX.toString() + " " + this.startY.toString() + "L" + this.endX.toString() + " " + this.endY.toString() : "M" + this.startX.toFixed(a) + " " + this.startY.toFixed(a) + "L" + this.endX.toFixed(a) + " " + this.endY.toFixed(a);
case Hd:
var b = new N(this.startX, this.startY, 0, 0);
b.Xv(this.endX, this.endY, 0, 0);
return 0 > a ? "M" + b.x.toString() + " " + b.y.toString() + "H" + b.right.toString() + "V" + b.bottom.toString() + "H" + b.left.toString() + "z" : "M" + b.x.toFixed(a) +
" " + b.y.toFixed(a) + "H" + b.right.toFixed(a) + "V" + b.bottom.toFixed(a) + "H" + b.left.toFixed(a) + "z";
case Id:
b = new N(this.startX, this.startY, 0, 0);
b.Xv(this.endX, this.endY, 0, 0);
if (0 > a) return a = b.left.toString() + " " + (b.y + b.height / 2).toString(), "M" + a + "A" + (b.width / 2).toString() + " " + (b.height / 2).toString() + " 0 0 1 " + (b.right.toString() + " " + (b.y + b.height / 2).toString()) + "A" + (b.width / 2).toString() + " " + (b.height / 2).toString() + " 0 0 1 " + a;
var c = b.left.toFixed(a) + " " + (b.y + b.height / 2).toFixed(a);
return "M" + c + "A" + (b.width /
2).toFixed(a) + " " + (b.height / 2).toFixed(a) + " 0 0 1 " + (b.right.toFixed(a) + " " + (b.y + b.height / 2).toFixed(a)) + "A" + (b.width / 2).toFixed(a) + " " + (b.height / 2).toFixed(a) + " 0 0 1 " + c;
case vd:
b = "";
c = this.figures.j;
for (var d = c.length, e = 0; e < d; e++) {
var f = c[e];
0 < e && (b += " x ");
f.isFilled && (b += "F ");
b += f.toString(a)
}
return b;
default:
return this.type.toString()
}
};
function Jd(a, b) {
function c() {
return u >= A - 1 ? !0 : null !== k[u + 1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)
}
function d() {
u++;
return k[u]
}
function e() {
var a = new G(parseFloat(d()), parseFloat(d()));
v === v.toLowerCase() && (a.x = y.x + a.x, a.y = y.y + a.y);
return a
}
function f() {
return y = e()
}
function g() {
return z = e()
}
function h() {
var a = w.toLowerCase();
return "c" !== a && "s" !== a && "q" !== a && "t" !== a ? y : new G(2 * y.x - z.x, 2 * y.y - z.y)
}
void 0 === b && (b = !1);
a = a.replace(/,/gm, " ");
a = a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");
a = a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm, "$1 $2");
a = a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm, "$1 $2");
a = a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm, "$1 $2");
a = a.replace(/([0-9])([+\-])/gm, "$1 $2");
a = a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm, "$1 $3 $4 ");
a = a.replace(/[\s\r\t\n]+/gm, " ");
a = a.replace(/^\s+|\s+$/g, "");
var k = a.split(" ");
for (a = 0; a < k.length; a++) {
var l = k[a];
if (null !== l.match(/(\.[0-9]*)(\.)/gm)) {
for (var m =
Da(), n = "", p = !1, r = 0; r < l.length; r++) {
var q = l[r];
"." !== q || p ? "." === q ? (m.push(n), n = ".") : n += q : (p = !0, n += q)
}
m.push(n);
k.splice(a, 1);
for (l = 0; l < m.length; l++) k.splice(a + l, 0, m[l]);
a += m.length - 1;
Ga(m)
}
}
var u = -1, v = "", w = "";
m = new G(0, 0);
var z = new G(0, 0), y = new G(0, 0), A = k.length;
a = Kd(null);
n = l = !1;
p = !0;
for (r = null; !(u >= A - 1);) if (w = v, v = d(), "" !== v) switch (v.toUpperCase()) {
case "X":
p = !0;
n = l = !1;
break;
case "M":
r = f();
null === a.ec || !0 === p ? (Ld(a, r.x, r.y, l, !n), p = !1) : a.moveTo(r.x, r.y);
for (m = y; !c();) r = f(), a.lineTo(r.x, r.y);
break;
case "L":
for (; !c();) r = f(), a.lineTo(r.x, r.y);
break;
case "H":
for (; !c();) y = new G((v === v.toLowerCase() ? y.x : 0) + parseFloat(d()), y.y), a.lineTo(y.x, y.y);
break;
case "V":
for (; !c();) y = new G(y.x, (v === v.toLowerCase() ? y.y : 0) + parseFloat(d())), a.lineTo(y.x, y.y);
break;
case "C":
for (; !c();) {
r = e();
q = g();
var C = f();
Qd(a, r.x, r.y, q.x, q.y, C.x, C.y)
}
break;
case "S":
for (; !c();) r = h(), q = g(), C = f(), Qd(a, r.x, r.y, q.x, q.y, C.x, C.y);
break;
case "Q":
for (; !c();) r = g(), q = f(), Rd(a, r.x, r.y, q.x, q.y);
break;
case "T":
for (; !c();) z = r = h(), q = f(), Rd(a,
r.x, r.y, q.x, q.y);
break;
case "B":
for (; !c();) {
r = parseFloat(d());
q = parseFloat(d());
C = parseFloat(d());
var I = parseFloat(d()), K = parseFloat(d()), J = K, T = !1;
c() || (J = parseFloat(d()), c() || (T = 0 !== parseFloat(d())));
v === v.toLowerCase() && (C += y.x, I += y.y);
a.arcTo(r, q, C, I, K, J, T)
}
break;
case "A":
for (; !c();) r = Math.abs(parseFloat(d())), q = Math.abs(parseFloat(d())), C = parseFloat(d()), I = !!parseFloat(d()), K = !!parseFloat(d()), J = f(), Sd(a, r, q, C, I, K, J.x, J.y);
break;
case "Z":
Td(a);
y = m;
break;
case "F":
r = "";
for (q = 1; k[u + q];) if (null !==
k[u + q].match(/[Uu]/)) q++; else if (null === k[u + q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)) q++; else {
r = k[u + q];
break
}
r.match(/[Mm]/) ? l = !0 : 0 < a.ec.segments.length && (a.ec.isFilled = !0);
break;
case "U":
r = "";
for (q = 1; k[u + q];) if (null !== k[u + q].match(/[Ff]/)) q++; else if (null === k[u + q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)) q++; else {
r = k[u + q];
break
}
r.match(/[Mm]/) ? n = !0 : a.uq(!1)
}
m = a.Us;
Ud = a;
if (b) for (b = m.figures.iterator; b.next();) b.value.isFilled = !0;
return m
}
function Vd(a, b) {
for (var c = a.length, d = G.alloc(), e = 0; e < c; e++) {
var f = a[e];
d.x = f[0];
d.y = f[1];
b.ta(d);
f[0] = d.x;
f[1] = d.y;
d.x = f[2];
d.y = f[3];
b.ta(d);
f[2] = d.x;
f[3] = d.y;
d.x = f[4];
d.y = f[5];
b.ta(d);
f[4] = d.x;
f[5] = d.y;
d.x = f[6];
d.y = f[7];
b.ta(d);
f[6] = d.x;
f[7] = d.y
}
G.free(d)
}
t.nv = function () {
if (this.ra || this.nr !== this.figures.Ba) return !0;
for (var a = this.figures.j, b = a.length, c = 0; c < b; c++) if (a[c].nv()) return !0;
return !1
};
ud.prototype.computeBounds = function () {
this.ra = !1;
this.Om = this.Ak = null;
this.Pm = NaN;
this.nr = this.figures.Ba;
for (var a = this.figures.j, b = a.length, c = 0; c < b; c++) {
var d = a[c];
d.ra = !1;
var e = d.segments;
d.us = e.Ba;
d = e.j;
e = d.length;
for (var f = 0; f < e; f++) {
var g = d[f];
g.ra = !1;
g.Le = null
}
}
a = this.Wq;
a.ha();
isNaN(this.fl) || isNaN(this.dl) ? a.h(0, 0, 0, 0) : a.h(0, 0, this.fl, this.dl);
Wd(this, a, !1);
ec(a, 0, 0, 0, 0);
a.freeze()
};
ud.prototype.Yw = function () {
var a = new N;
Wd(this, a, !0);
return a
};
function Wd(a, b, c) {
switch (a.type) {
case xd:
case Hd:
case Id:
c ? b.h(a.ad, a.bd, 0, 0) : ec(b, a.ad, a.bd, 0, 0);
ec(b, a.mc, a.Bc, 0, 0);
break;
case vd:
var d = a.figures;
a = d.j;
d = d.length;
for (var e = 0; e < d; e++) {
var f = a[e];
c && 0 === e ? b.h(f.startX, f.startY, 0, 0) : ec(b, f.startX, f.startY, 0, 0);
for (var g = f.segments.j, h = g.length, k = f.startX, l = f.startY, m = 0; m < h; m++) {
var n = g[m];
switch (n.type) {
case Fd:
case Xd:
k = n.endX;
l = n.endY;
ec(b, k, l, 0, 0);
break;
case Yd:
H.Tl(k, l, n.point1X, n.point1Y, n.point2X, n.point2Y, n.endX, n.endY, .5, b);
k = n.endX;
l = n.endY;
break;
case Zd:
H.vv(k, l, n.point1X, n.point1Y, n.endX, n.endY, .5, b);
k = n.endX;
l = n.endY;
break;
case $d:
case ae:
var p = n.type === $d ? be(n, f) : ce(n, f, k, l), r = p.length;
if (0 === r) {
k = n.centerX;
l = n.centerY;
ec(b, k, l, 0, 0);
break
}
n = null;
for (var q = 0; q < r; q++) n = p[q], H.Tl(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], .5, b);
null !== n && (k = n[6], l = n[7]);
break;
default:
B("Unknown Segment type: " + n.type)
}
}
}
break;
default:
B("Unknown Geometry type: " + a.type)
}
}
ud.prototype.normalize = function () {
this.v && ua(this);
var a = this.Yw();
this.offset(-a.x, -a.y);
return new G(-a.x, -a.y)
};
ud.prototype.offset = function (a, b) {
this.v && ua(this);
this.transform(1, 0, 0, 1, a, b);
return this
};
ud.prototype.scale = function (a, b) {
this.v && ua(this);
this.transform(a, 0, 0, b, 0, 0);
return this
};
ud.prototype.rotate = function (a, b, c) {
this.v && ua(this);
void 0 === b && (b = 0);
void 0 === c && (c = 0);
var d = wc.alloc();
d.reset();
d.rotate(a, b, c);
this.transform(d.m11, d.m12, d.m21, d.m22, d.dx, d.dy);
wc.free(d);
return this
};
t = ud.prototype;
t.transform = function (a, b, c, d, e, f) {
switch (this.type) {
case xd:
case Hd:
case Id:
var g = this.ad;
var h = this.bd;
this.ad = g * a + h * c + e;
this.bd = g * b + h * d + f;
g = this.mc;
h = this.Bc;
this.mc = g * a + h * c + e;
this.Bc = g * b + h * d + f;
break;
case vd:
for (var k = this.figures.j, l = k.length, m = 0; m < l; m++) {
var n = k[m];
g = n.startX;
h = n.startY;
n.startX = g * a + h * c + e;
n.startY = g * b + h * d + f;
n = n.segments.j;
for (var p = n.length, r = 0; r < p; r++) {
var q = n[r];
switch (q.type) {
case Fd:
case Xd:
g = q.endX;
h = q.endY;
q.endX = g * a + h * c + e;
q.endY = g * b + h * d + f;
break;
case Yd:
g = q.point1X;
h = q.point1Y;
q.point1X = g * a + h * c + e;
q.point1Y = g * b + h * d + f;
g = q.point2X;
h = q.point2Y;
q.point2X = g * a + h * c + e;
q.point2Y = g * b + h * d + f;
g = q.endX;
h = q.endY;
q.endX = g * a + h * c + e;
q.endY = g * b + h * d + f;
break;
case Zd:
g = q.point1X;
h = q.point1Y;
q.point1X = g * a + h * c + e;
q.point1Y = g * b + h * d + f;
g = q.endX;
h = q.endY;
q.endX = g * a + h * c + e;
q.endY = g * b + h * d + f;
break;
case $d:
g = q.centerX;
h = q.centerY;
q.centerX = g * a + h * c + e;
q.centerY = g * b + h * d + f;
0 !== b && (g = 180 * Math.atan2(b, a) / Math.PI, 0 > g && (g += 360), q.startAngle += g);
0 > a && (q.startAngle = 180 - q.startAngle, q.sweepAngle = -q.sweepAngle);
0 > d &&
(q.startAngle = -q.startAngle, q.sweepAngle = -q.sweepAngle);
q.radiusX *= Math.sqrt(a * a + c * c);
void 0 !== q.radiusY && (q.radiusY *= Math.sqrt(b * b + d * d));
break;
case ae:
g = q.endX;
h = q.endY;
q.endX = g * a + h * c + e;
q.endY = g * b + h * d + f;
0 !== b && (g = 180 * Math.atan2(b, a) / Math.PI, 0 > g && (g += 360), q.xAxisRotation += g);
0 > a && (q.xAxisRotation = 180 - q.xAxisRotation, q.isClockwiseArc = !q.isClockwiseArc);
0 > d && (q.xAxisRotation = -q.xAxisRotation, q.isClockwiseArc = !q.isClockwiseArc);
q.radiusX *= Math.sqrt(a * a + c * c);
q.radiusY *= Math.sqrt(b * b + d * d);
break;
default:
B("Unknown Segment type: " +
q.type)
}
}
}
}
this.ra = !0;
return this
};
t.da = function (a, b, c, d) {
var e = a.x;
a = a.y;
for (var f = this.bounds.x - 20, g = 0, h, k, l, m, n, p = this.figures.j, r = p.length, q = 0; q < r; q++) {
var u = p[q];
if (u.isFilled) {
if (c && u.da(e, a, b)) return !0;
var v = u.segments;
h = u.startX;
k = u.startY;
for (var w = h, z = k, y = v.j, A = 0; A <= v.length; A++) {
var C = void 0;
if (A !== v.length) {
C = y[A];
var I = C.type;
m = C.endX;
n = C.endY
} else I = Fd, m = w, n = z;
switch (I) {
case Xd:
w = de(e, a, f, a, h, k, w, z);
if (isNaN(w)) return !0;
g += w;
w = m;
z = n;
break;
case Fd:
h = de(e, a, f, a, h, k, m, n);
if (isNaN(h)) return !0;
g += h;
break;
case Yd:
l = H.Qp(h,
k, C.point1X, C.point1Y, C.point2X, C.point2Y, m, n, f, a, e, a, .5);
g += l;
break;
case Zd:
l = H.Qp(h, k, (h + 2 * C.point1X) / 3, (k + 2 * C.point1Y) / 3, (2 * C.point1X + m) / 3, (2 * C.point1Y + n) / 3, m, n, f, a, e, a, .5);
g += l;
break;
case $d:
case ae:
I = C.type === $d ? be(C, u) : ce(C, u, h, k);
var K = I.length;
if (0 === K) {
h = de(e, a, f, a, h, k, C.centerX, C.centerY);
if (isNaN(h)) return !0;
g += h;
break
}
C = null;
for (var J = 0; J < K; J++) {
C = I[J];
if (0 === J) {
l = de(e, a, f, a, h, k, C[0], C[1]);
if (isNaN(l)) return !0;
g += l
}
l = H.Qp(C[0], C[1], C[2], C[3], C[4], C[5], C[6], C[7], f, a, e, a, .5);
g += l
}
null !==
C && (m = C[6], n = C[7]);
break;
default:
B("Unknown Segment type: " + C.type)
}
h = m;
k = n
}
if (0 !== g) return !0;
g = 0
} else if (u.da(e, a, d ? b : b + 2)) return !0
}
return 0 !== g
};
function de(a, b, c, d, e, f, g, h) {
if (H.Tb(e, f, g, h, .05, a, b)) return NaN;
var k = (a - c) * (f - h);
if (0 === k) return 0;
var l = ((a * d - b * c) * (e - g) - (a - c) * (e * h - f * g)) / k;
b = (a * d - b * c) * (f - h) / k;
if (l >= a) return 0;
if ((e > g ? e - g : g - e) < (f > h ? f - h : h - f)) if (f < h) {
if (b < f || b > h) return 0
} else {
if (b < h || b > f) return 0
} else if (e < g) {
if (l < e || l > g) return 0
} else if (l < g || l > e) return 0;
return 0 < k ? 1 : -1
}
function ie(a, b, c, d) {
a = a.figures.j;
for (var e = a.length, f = 0; f < e; f++) if (a[f].da(b, c, d)) return !0;
return !1
}
t.ev = function (a, b) {
0 > a ? a = 0 : 1 < a && (a = 1);
void 0 === b && (b = new G);
if (this.type === xd) return b.h(this.startX + a * (this.endX - this.startX), this.startY + a * (this.endY - this.startY)), b;
for (var c = this.flattenedSegments, d = this.flattenedLengths, e = c.length, f = this.flattenedTotalLength * a, g = 0, h = 0; h < e; h++) {
var k = d[h], l = k.length;
for (a = 0; a < l; a++) {
var m = k[a];
if (g + m >= f) return d = (f - g) / m, c = c[h], e = c[2 * a], h = c[2 * a + 1], b.h(e + (c[2 * a + 2] - e) * d, h + (c[2 * a + 3] - h) * d), b;
g += m
}
}
b.h(NaN, NaN);
return b
};
t.kx = function (a) {
if (this.type === xd) {
var b = this.startX, c = this.startY, d = this.endX, e = this.endY;
if (b !== d || c !== e) {
var f = a.x;
a = a.y;
if (b === d) {
if (c < e) {
var g = c;
d = e
} else g = e, d = c;
return a <= g ? g === c ? 0 : 1 : a >= d ? d === c ? 0 : 1 : Math.abs(a - c) / (d - g)
}
return c === e ? (b < d ? g = b : (g = d, d = b), f <= g ? g === b ? 0 : 1 : f >= d ? d === b ? 0 : 1 : Math.abs(f - b) / (d - g)) : ((f - b) * (f - b) + (a - c) * (a - c)) / ((d - b) * (d - b) + (e - c) * (e - c))
}
} else if (this.type === Hd) {
g = this.startX;
var h = this.startY, k = this.endX;
e = this.endY;
if (g !== k || h !== e) {
b = k - g;
c = e - h;
f = 2 * b + 2 * c;
d = a.x;
a = a.y;
d = Math.min(Math.max(d,
g), k);
a = Math.min(Math.max(a, h), e);
g = Math.abs(d - g);
k = Math.abs(d - k);
h = Math.abs(a - h);
e = Math.abs(a - e);
var l = Math.min(g, k, h, e);
if (l === h) return d / f;
if (l === k) return (b + a) / f;
if (l === e) return (2 * b + c - d) / f;
if (l === g) return (2 * b + 2 * c - a) / f
}
} else {
b = this.flattenedSegments;
c = this.flattenedLengths;
f = this.flattenedTotalLength;
d = G.alloc();
e = Infinity;
h = g = 0;
k = b.length;
for (var m = l = 0, n = 0; n < k; n++) for (var p = b[n], r = c[n], q = p.length, u = 0; u < q; u += 2) {
var v = p[u], w = p[u + 1];
if (0 !== u) {
H.Ti(l, m, v, w, a.x, a.y, d);
var z = (d.x - a.x) * (d.x - a.x) + (d.y -
a.y) * (d.y - a.y);
z < e && (e = z, g = h, g += Math.sqrt((d.x - l) * (d.x - l) + (d.y - m) * (d.y - m)));
h += r[(u - 2) / 2]
}
l = v;
m = w
}
G.free(d);
a = g / f;
return 0 > a ? 0 : 1 < a ? 1 : a
}
return 0
};
function je(a) {
if (null === a.Ak) {
var b = a.Ak = [], c = a.Om = [], d = [], e = [];
if (a.type === xd) d.push(a.startX), d.push(a.startY), d.push(a.endX), d.push(a.endY), b.push(d), e.push(Math.sqrt((a.startX - a.endX) * (a.startX - a.endX) + (a.startY - a.endY) * (a.startY - a.endY))), c.push(e); else if (a.type === Hd) d.push(a.startX), d.push(a.startY), d.push(a.endX), d.push(a.startY), d.push(a.endX), d.push(a.endY), d.push(a.startX), d.push(a.endY), d.push(a.startX), d.push(a.startY), b.push(d), e.push(Math.abs(a.startX - a.endX)), e.push(Math.abs(a.startY -
a.endY)), e.push(Math.abs(a.startX - a.endX)), e.push(Math.abs(a.startY - a.endY)), c.push(e); else if (a.type === Id) {
var f = new ke;
f.startX = a.endX;
f.startY = (a.startY + a.endY) / 2;
var g = new le($d);
g.startAngle = 0;
g.sweepAngle = 360;
g.centerX = (a.startX + a.endX) / 2;
g.centerY = (a.startY + a.endY) / 2;
g.radiusX = Math.abs(a.startX - a.endX) / 2;
g.radiusY = Math.abs(a.startY - a.endY) / 2;
f.add(g);
a = be(g, f);
e = a.length;
if (0 === e) d.push(g.centerX), d.push(g.centerY); else {
g = f.startX;
f = f.startY;
for (var h = 0; h < e; h++) {
var k = a[h];
H.Ae(g, f, k[2], k[3],
k[4], k[5], k[6], k[7], .5, d);
g = k[6];
f = k[7]
}
}
b.push(d);
c.push(me(d))
} else for (a = a.figures.iterator; a.next();) {
e = a.value;
d = [];
d.push(e.startX);
d.push(e.startY);
g = e.startX;
f = e.startY;
h = g;
k = f;
for (var l = e.segments.j, m = l.length, n = 0; n < m; n++) {
var p = l[n];
switch (p.type) {
case Xd:
4 <= d.length && (b.push(d), c.push(me(d)));
d = [];
d.push(p.endX);
d.push(p.endY);
g = p.endX;
f = p.endY;
h = g;
k = f;
break;
case Fd:
d.push(p.endX);
d.push(p.endY);
g = p.endX;
f = p.endY;
break;
case Yd:
H.Ae(g, f, p.point1X, p.point1Y, p.point2X, p.point2Y, p.endX, p.endY,
.5, d);
g = p.endX;
f = p.endY;
break;
case Zd:
H.nq(g, f, p.point1X, p.point1Y, p.endX, p.endY, .5, d);
g = p.endX;
f = p.endY;
break;
case $d:
var r = be(p, e), q = r.length;
if (0 === q) {
d.push(p.centerX);
d.push(p.centerY);
g = p.centerX;
f = p.centerY;
break
}
for (var u = 0; u < q; u++) {
var v = r[u];
H.Ae(g, f, v[2], v[3], v[4], v[5], v[6], v[7], .5, d);
g = v[6];
f = v[7]
}
break;
case ae:
r = ce(p, e, g, f);
q = r.length;
if (0 === q) {
d.push(p.centerX);
d.push(p.centerY);
g = p.centerX;
f = p.centerY;
break
}
for (u = 0; u < q; u++) v = r[u], H.Ae(g, f, v[2], v[3], v[4], v[5], v[6], v[7], .5, d), g = v[6],
f = v[7];
break;
default:
B("Segment not of valid type: " + p.type)
}
p.isClosed && (d.push(h), d.push(k))
}
4 <= d.length && (b.push(d), c.push(me(d)))
}
}
}
function me(a) {
for (var b = [], c = 0, d = 0, e = a.length, f = 0; f < e; f += 2) {
var g = a[f], h = a[f + 1];
0 !== f && b.push(Math.sqrt(Bb(c, d, g, h)));
c = g;
d = h
}
return b
}
t.add = function (a) {
this.ij.add(a);
return this
};
t.ym = function (a, b, c, d, e, f, g, h) {
this.v && ua(this);
this.df = (new O(a, b, e, f)).freeze();
this.ef = (new O(c, d, g, h)).freeze();
return this
};
ma.Object.defineProperties(ud.prototype, {
flattenedSegments: {
get: function () {
je(this);
return this.Ak
}
}, flattenedLengths: {
get: function () {
je(this);
return this.Om
}
}, flattenedTotalLength: {
get: function () {
var a = this.Pm;
if (isNaN(a)) {
if (this.type === xd) {
a = Math.abs(this.endX - this.startX);
var b = Math.abs(this.endY - this.startY);
a = Math.sqrt(a * a + b * b)
} else if (this.type === Hd) a = 2 * Math.abs(this.endX - this.startX) + 2 * Math.abs(this.endY -
this.startY); else {
b = this.flattenedLengths;
for (var c = b.length, d = a = 0; d < c; d++) for (var e = b[d], f = e.length, g = 0; g < f; g++) a += e[g]
}
this.Pm = a
}
return a
}
}, type: {
get: function () {
return this.va
}, set: function (a) {
this.va !== a && (this.v && ua(this, a), this.va = a, this.ra = !0)
}
}, startX: {
get: function () {
return this.ad
}, set: function (a) {
this.ad !== a && (this.v && ua(this, a), this.ad = a, this.ra = !0)
}
}, startY: {
get: function () {
return this.bd
}, set: function (a) {
this.bd !==
a && (this.v && ua(this, a), this.bd = a, this.ra = !0)
}
}, endX: {
get: function () {
return this.mc
}, set: function (a) {
this.mc !== a && (this.v && ua(this, a), this.mc = a, this.ra = !0)
}
}, endY: {
get: function () {
return this.Bc
}, set: function (a) {
this.Bc !== a && (this.v && ua(this, a), this.Bc = a, this.ra = !0)
}
}, figures: {
get: function () {
return this.ij
}, set: function (a) {
this.ij !== a && (this.v && ua(this, a), this.ij = a, this.ra = !0)
}
}, spot1: {
get: function () {
return this.df
}, set: function (a) {
this.v && ua(this, a);
this.df = a.I()
}
}, spot2: {
get: function () {
return this.ef
}, set: function (a) {
this.v && ua(this, a);
this.ef = a.I()
}
}, defaultStretch: {
get: function () {
return this.Gf
}, set: function (a) {
this.v && ua(this, a);
this.Gf = a
}
}, bounds: {
get: function () {
this.nv() && this.computeBounds();
return this.Wq
}
}
});
ud.prototype.setSpots = ud.prototype.ym;
ud.prototype.add = ud.prototype.add;
ud.prototype.getFractionForPoint = ud.prototype.kx;
ud.prototype.getPointAlongPath = ud.prototype.ev;
ud.prototype.transform = ud.prototype.transform;
ud.prototype.rotate = ud.prototype.rotate;
ud.prototype.scale = ud.prototype.scale;
ud.prototype.offset = ud.prototype.offset;
ud.prototype.normalize = ud.prototype.normalize;
ud.prototype.computeBoundsWithoutOrigin = ud.prototype.Yw;
ud.prototype.equalsApprox = ud.prototype.Qa;
var xd = new D(ud, "Line", 0), Hd = new D(ud, "Rectangle", 1), Id = new D(ud, "Ellipse", 2),
vd = new D(ud, "Path", 3);
ud.className = "Geometry";
ud.stringify = Gd;
ud.fillPath = function (a) {
a = a.split(/[Xx]/);
for (var b = a.length, c = "", d = 0; d < b; d++) {
var e = a[d];
c = null !== e.match(/[Ff]/) ? 0 === d ? c + e : c + ("X" + (" " === e[0] ? "" : " ") + e) : c + ((0 === d ? "" : "X ") + "F" + (" " === e[0] ? "" : " ") + e)
}
return c
};
ud.parse = Jd;
ud.Line = xd;
ud.Rectangle = Hd;
ud.Ellipse = Id;
ud.Path = vd;
function ke(a, b, c, d) {
ab(this);
this.v = !1;
void 0 === c && (c = !0);
this.Dr = c;
void 0 === d && (d = !0);
this.Hr = d;
void 0 !== a ? this.ad = a : this.ad = 0;
void 0 !== b ? this.bd = b : this.bd = 0;
this.Cl = new E;
this.us = this.Cl.Ba;
this.ra = !0
}
ke.prototype.copy = function () {
var a = new ke;
a.Dr = this.Dr;
a.Hr = this.Hr;
a.ad = this.ad;
a.bd = this.bd;
for (var b = this.Cl.j, c = b.length, d = a.Cl, e = 0; e < c; e++) {
var f = b[e].copy();
d.add(f)
}
a.us = this.us;
a.ra = this.ra;
return a
};
t = ke.prototype;
t.Qa = function (a) {
if (!(a instanceof ke && H.w(this.startX, a.startX) && H.w(this.startY, a.startY))) return !1;
var b = this.segments.j;
a = a.segments.j;
var c = b.length;
if (c !== a.length) return !1;
for (var d = 0; d < c; d++) if (!b[d].Qa(a[d])) return !1;
return !0
};
t.toString = function (a) {
void 0 === a && (a = -1);
var b = 0 > a ? "M" + this.startX.toString() + " " + this.startY.toString() : "M" + this.startX.toFixed(a) + " " + this.startY.toFixed(a);
for (var c = this.segments.j, d = c.length, e = 0; e < d; e++) b += " " + c[e].toString(a);
return b
};
t.freeze = function () {
this.v = !0;
var a = this.segments;
a.freeze();
var b = a.j;
a = a.length;
for (var c = 0; c < a; c++) b[c].freeze();
return this
};
t.ha = function () {
this.v = !1;
var a = this.segments;
a.ha();
a = a.j;
for (var b = a.length, c = 0; c < b; c++) a[c].ha();
return this
};
t.nv = function () {
if (this.ra) return !0;
var a = this.segments;
if (this.us !== a.Ba) return !0;
a = a.j;
for (var b = a.length, c = 0; c < b; c++) if (a[c].ra) return !0;
return !1
};
t.add = function (a) {
this.Cl.add(a);
return this
};
t.da = function (a, b, c) {
for (var d = this.startX, e = this.startY, f = d, g = e, h = this.segments.j, k = h.length, l = 0; l < k; l++) {
var m = h[l];
switch (m.type) {
case Xd:
f = m.endX;
g = m.endY;
d = m.endX;
e = m.endY;
break;
case Fd:
if (H.Tb(d, e, m.endX, m.endY, c, a, b)) return !0;
d = m.endX;
e = m.endY;
break;
case Yd:
if (H.Ks(d, e, m.point1X, m.point1Y, m.point2X, m.point2Y, m.endX, m.endY, .5, a, b, c)) return !0;
d = m.endX;
e = m.endY;
break;
case Zd:
if (H.wv(d, e, m.point1X, m.point1Y, m.endX, m.endY, .5, a, b, c)) return !0;
d = m.endX;
e = m.endY;
break;
case $d:
case ae:
var n = m.type ===
$d ? be(m, this) : ce(m, this, d, e), p = n.length;
if (0 === p) {
if (H.Tb(d, e, m.centerX, m.centerY, c, a, b)) return !0;
d = m.centerX;
e = m.centerY;
break
}
for (var r = null, q = 0; q < p; q++) if (r = n[q], 0 === q && H.Tb(d, e, r[0], r[1], c, a, b) || H.Ks(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], .5, a, b, c)) return !0;
null !== r && (d = r[6], e = r[7]);
break;
default:
B("Unknown Segment type: " + m.type)
}
if (m.isClosed && (d !== f || e !== g) && H.Tb(d, e, f, g, c, a, b)) return !0
}
return !1
};
ma.Object.defineProperties(ke.prototype, {
isFilled: {
get: function () {
return this.Dr
}, set: function (a) {
this.v && ua(this, a);
this.Dr = a
}
}, isShadowed: {
get: function () {
return this.Hr
}, set: function (a) {
this.v && ua(this, a);
this.Hr = a
}
}, startX: {
get: function () {
return this.ad
}, set: function (a) {
this.v && ua(this, a);
this.ad = a;
this.ra = !0
}
}, startY: {
get: function () {
return this.bd
}, set: function (a) {
this.v && ua(this,
a);
this.bd = a;
this.ra = !0
}
}, segments: {
get: function () {
return this.Cl
}, set: function (a) {
this.v && ua(this, a);
this.Cl = a;
this.ra = !0
}
}
});
ke.prototype.add = ke.prototype.add;
ke.prototype.equalsApprox = ke.prototype.Qa;
ke.className = "PathFigure";
function le(a, b, c, d, e, f, g, h) {
ab(this);
this.v = !1;
void 0 === a && (a = Fd);
this.va = a;
void 0 !== b ? this.mc = b : this.mc = 0;
void 0 !== c ? this.Bc = c : this.Bc = 0;
void 0 === d && (d = 0);
void 0 === e && (e = 0);
void 0 === f && (f = 0);
void 0 === g && (g = 0);
a === ae ? (a = f % 360, 0 > a && (a += 360), this.ue = a, this.pi = 0, this.ri = Math.max(d, 0), this.ah = Math.max(e, 0), this.jl = "boolean" === typeof g ? !!g : !1, this.Gk = !!h) : (this.ue = d, this.pi = e, a === $d && (f = Math.max(f, 0)), this.ri = f, "number" === typeof g ? (a === $d && (g = Math.max(g, 0)), this.ah = g) : this.ah = 0, this.Gk = this.jl = !1);
this.nj =
!1;
this.ra = !0;
this.Le = null
}
le.prototype.copy = function () {
var a = new le;
a.va = this.va;
a.mc = this.mc;
a.Bc = this.Bc;
a.ue = this.ue;
a.pi = this.pi;
a.ri = this.ri;
a.ah = this.ah;
a.jl = this.jl;
a.Gk = this.Gk;
a.nj = this.nj;
a.ra = this.ra;
return a
};
t = le.prototype;
t.Qa = function (a) {
if (!(a instanceof le) || this.type !== a.type || this.isClosed !== a.isClosed) return !1;
switch (this.type) {
case Xd:
case Fd:
return H.w(this.endX, a.endX) && H.w(this.endY, a.endY);
case Yd:
return H.w(this.endX, a.endX) && H.w(this.endY, a.endY) && H.w(this.point1X, a.point1X) && H.w(this.point1Y, a.point1Y) && H.w(this.point2X, a.point2X) && H.w(this.point2Y, a.point2Y);
case Zd:
return H.w(this.endX, a.endX) && H.w(this.endY, a.endY) && H.w(this.point1X, a.point1X) && H.w(this.point1Y, a.point1Y);
case $d:
return H.w(this.startAngle,
a.startAngle) && H.w(this.sweepAngle, a.sweepAngle) && H.w(this.centerX, a.centerX) && H.w(this.centerY, a.centerY) && H.w(this.radiusX, a.radiusX) && H.w(this.radiusY, a.radiusY);
case ae:
return this.isClockwiseArc === a.isClockwiseArc && this.isLargeArc === a.isLargeArc && H.w(this.xAxisRotation, a.xAxisRotation) && H.w(this.endX, a.endX) && H.w(this.endY, a.endY) && H.w(this.radiusX, a.radiusX) && H.w(this.radiusY, a.radiusY);
default:
return !1
}
};
t.fb = function (a) {
a.classType === le && (this.type = a)
};
t.toString = function (a) {
void 0 === a && (a = -1);
switch (this.type) {
case Xd:
a = 0 > a ? "M" + this.endX.toString() + " " + this.endY.toString() : "M" + this.endX.toFixed(a) + " " + this.endY.toFixed(a);
break;
case Fd:
a = 0 > a ? "L" + this.endX.toString() + " " + this.endY.toString() : "L" + this.endX.toFixed(a) + " " + this.endY.toFixed(a);
break;
case Yd:
a = 0 > a ? "C" + this.point1X.toString() + " " + this.point1Y.toString() + " " + this.point2X.toString() + " " + this.point2Y.toString() + " " + this.endX.toString() + " " + this.endY.toString() : "C" + this.point1X.toFixed(a) +
" " + this.point1Y.toFixed(a) + " " + this.point2X.toFixed(a) + " " + this.point2Y.toFixed(a) + " " + this.endX.toFixed(a) + " " + this.endY.toFixed(a);
break;
case Zd:
a = 0 > a ? "Q" + this.point1X.toString() + " " + this.point1Y.toString() + " " + this.endX.toString() + " " + this.endY.toString() : "Q" + this.point1X.toFixed(a) + " " + this.point1Y.toFixed(a) + " " + this.endX.toFixed(a) + " " + this.endY.toFixed(a);
break;
case $d:
a = 0 > a ? "B" + this.startAngle.toString() + " " + this.sweepAngle.toString() + " " + this.centerX.toString() + " " + this.centerY.toString() +
" " + this.radiusX.toString() + " " + this.radiusY.toString() : "B" + this.startAngle.toFixed(a) + " " + this.sweepAngle.toFixed(a) + " " + this.centerX.toFixed(a) + " " + this.centerY.toFixed(a) + " " + this.radiusX.toFixed(a) + " " + this.radiusY.toFixed(a);
break;
case ae:
a = 0 > a ? "A" + this.radiusX.toString() + " " + this.radiusY.toString() + " " + this.xAxisRotation.toString() + " " + (this.isLargeArc ? 1 : 0) + " " + (this.isClockwiseArc ? 1 : 0) + " " + this.endX.toString() + " " + this.endY.toString() : "A" + this.radiusX.toFixed(a) + " " + this.radiusY.toFixed(a) +
" " + this.xAxisRotation.toFixed(a) + " " + (this.isLargeArc ? 1 : 0) + " " + (this.isClockwiseArc ? 1 : 0) + " " + this.endX.toFixed(a) + " " + this.endY.toFixed(a);
break;
default:
a = this.type.toString()
}
return a + (this.nj ? "z" : "")
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
this.v = !1;
return this
};
t.close = function () {
this.nj = !0;
return this
};
function be(a, b) {
if (null !== a.Le && !1 === b.ra) return a.Le;
var c = a.radiusX, d = a.radiusY;
void 0 === d && (d = c);
if (0 === c || 0 === d) return a.Le = [], a.Le;
b = a.ue;
var e = a.pi, f = H.Zw(0, 0, c < d ? c : d, a.startAngle, a.startAngle + a.sweepAngle, !1);
if (c !== d) {
var g = wc.alloc();
g.reset();
c < d ? g.scale(1, d / c) : g.scale(c / d, 1);
Vd(f, g);
wc.free(g)
}
c = f.length;
for (d = 0; d < c; d++) g = f[d], g[0] += b, g[1] += e, g[2] += b, g[3] += e, g[4] += b, g[5] += e, g[6] += b, g[7] += e;
a.Le = f;
return a.Le
}
function ce(a, b, c, d) {
function e(a, b, c, d) {
return (a * d < b * c ? -1 : 1) * Math.acos((a * c + b * d) / (Math.sqrt(a * a + b * b) * Math.sqrt(c * c + d * d)))
}
if (null !== a.Le && !1 === b.ra) return a.Le;
b = a.ri;
var f = a.ah;
0 === b && (b = 1E-4);
0 === f && (f = 1E-4);
var g = Math.PI / 180 * a.ue, h = a.jl, k = a.Gk, l = a.mc, m = a.Bc, n = Math.cos(g), p = Math.sin(g),
r = n * (c - l) / 2 + p * (d - m) / 2;
g = -p * (c - l) / 2 + n * (d - m) / 2;
var q = r * r / (b * b) + g * g / (f * f);
1 < q && (b *= Math.sqrt(q), f *= Math.sqrt(q));
q = (h === k ? -1 : 1) * Math.sqrt((b * b * f * f - b * b * g * g - f * f * r * r) / (b * b * g * g + f * f * r * r));
isNaN(q) && (q = 0);
h = q * b * g / f;
q = q * -f *
r / b;
isNaN(h) && (h = 0);
isNaN(q) && (q = 0);
c = (c + l) / 2 + n * h - p * q;
d = (d + m) / 2 + p * h + n * q;
m = e(1, 0, (r - h) / b, (g - q) / f);
n = (r - h) / b;
l = (g - q) / f;
r = (-r - h) / b;
h = (-g - q) / f;
g = e(n, l, r, h);
r = (n * r + l * h) / (Math.sqrt(n * n + l * l) * Math.sqrt(r * r + h * h));
-1 >= r ? g = Math.PI : 1 <= r && (g = 0);
!k && 0 < g && (g -= 2 * Math.PI);
k && 0 > g && (g += 2 * Math.PI);
k = b > f ? 1 : b / f;
r = b > f ? f / b : 1;
b = H.Zw(0, 0, b > f ? b : f, m, m + g, !0);
f = wc.alloc();
f.reset();
f.translate(c, d);
f.rotate(a.ue, 0, 0);
f.scale(k, r);
Vd(b, f);
wc.free(f);
a.Le = b;
return a.Le
}
ma.Object.defineProperties(le.prototype, {
isClosed: {
get: function () {
return this.nj
}, set: function (a) {
this.nj !== a && (this.nj = a, this.ra = !0)
}
}, type: {
get: function () {
return this.va
}, set: function (a) {
this.v && ua(this, a);
this.va = a;
this.ra = !0
}
}, endX: {
get: function () {
return this.mc
}, set: function (a) {
this.v && ua(this, a);
this.mc = a;
this.ra = !0
}
}, endY: {
get: function () {
return this.Bc
}, set: function (a) {
this.v &&
ua(this, a);
this.Bc = a;
this.ra = !0
}
}, point1X: {
get: function () {
return this.ue
}, set: function (a) {
this.v && ua(this, a);
this.ue = a;
this.ra = !0
}
}, point1Y: {
get: function () {
return this.pi
}, set: function (a) {
this.v && ua(this, a);
this.pi = a;
this.ra = !0
}
}, point2X: {
get: function () {
return this.ri
}, set: function (a) {
this.v && ua(this, a);
this.ri = a;
this.ra = !0
}
}, point2Y: {
get: function () {
return this.ah
}, set: function (a) {
this.v &&
ua(this, a);
this.ah = a;
this.ra = !0
}
}, centerX: {
get: function () {
return this.ue
}, set: function (a) {
this.v && ua(this, a);
this.ue = a;
this.ra = !0
}
}, centerY: {
get: function () {
return this.pi
}, set: function (a) {
this.v && ua(this, a);
this.pi = a;
this.ra = !0
}
}, radiusX: {
get: function () {
return this.ri
}, set: function (a) {
0 > a && va(a, ">= zero", le, "radiusX");
this.v && ua(this, a);
this.ri = a;
this.ra = !0
}
}, radiusY: {
get: function () {
return this.ah
},
set: function (a) {
0 > a && va(a, ">= zero", le, "radiusY");
this.v && ua(this, a);
this.ah = a;
this.ra = !0
}
}, startAngle: {
get: function () {
return this.mc
}, set: function (a) {
this.mc !== a && (this.v && ua(this, a), a %= 360, 0 > a && (a += 360), this.mc = a, this.ra = !0)
}
}, sweepAngle: {
get: function () {
return this.Bc
}, set: function (a) {
this.v && ua(this, a);
360 < a && (a = 360);
-360 > a && (a = -360);
this.Bc = a;
this.ra = !0
}
}, isClockwiseArc: {
get: function () {
return this.Gk
}, set: function (a) {
this.v &&
ua(this, a);
this.Gk = a;
this.ra = !0
}
}, isLargeArc: {
get: function () {
return this.jl
}, set: function (a) {
this.v && ua(this, a);
this.jl = a;
this.ra = !0
}
}, xAxisRotation: {
get: function () {
return this.ue
}, set: function (a) {
a %= 360;
0 > a && (a += 360);
this.v && ua(this, a);
this.ue = a;
this.ra = !0
}
}
});
le.prototype.equalsApprox = le.prototype.Qa;
var Xd = new D(le, "Move", 0), Fd = new D(le, "Line", 1), Yd = new D(le, "Bezier", 2),
Zd = new D(le, "QuadraticBezier", 3), $d = new D(le, "Arc", 4), ae = new D(le, "SvgArc", 4);
le.className = "PathSegment";
le.Move = Xd;
le.Line = Fd;
le.Bezier = Yd;
le.QuadraticBezier = Zd;
le.Arc = $d;
le.SvgArc = ae;
function ne() {
this.C = null;
this.Du = (new G(0, 0)).freeze();
this.Tt = (new G(0, 0)).freeze();
this.Pq = this.Wr = 0;
this.Qq = 1;
this.Lr = "";
this.Fs = this.gr = !1;
this.fr = this.Sq = 0;
this.Eg = this.ur = this.Fr = !1;
this.mr = null;
this.Ds = 0;
this.Qd = this.Cs = null
}
ne.prototype.copy = function () {
var a = new ne;
return this.clone(a)
};
ne.prototype.clone = function (a) {
a.C = this.C;
a.Du.assign(this.viewPoint);
a.Tt.assign(this.documentPoint);
a.Wr = this.Wr;
a.Pq = this.Pq;
a.Qq = this.Qq;
a.Lr = this.Lr;
a.gr = this.gr;
a.Fs = this.Fs;
a.Sq = this.Sq;
a.fr = this.fr;
a.Fr = this.Fr;
a.ur = this.ur;
a.Eg = this.Eg;
a.mr = this.mr;
a.Ds = this.Ds;
a.Cs = this.Cs;
a.Qd = this.Qd;
return a
};
ne.prototype.toString = function () {
var a = "^";
0 !== this.modifiers && (a += "M:" + this.modifiers);
0 !== this.button && (a += "B:" + this.button);
"" !== this.key && (a += "K:" + this.key);
0 !== this.clickCount && (a += "C:" + this.clickCount);
0 !== this.delta && (a += "D:" + this.delta);
this.handled && (a += "h");
this.bubbles && (a += "b");
null !== this.documentPoint && (a += "@" + this.documentPoint.toString());
return a
};
ne.prototype.$p = function (a, b) {
var c = this.diagram;
if (null === c) return b;
oe(c, this.event, a, b);
return b
};
ne.prototype.az = function (a, b) {
var c = this.diagram;
if (null === c) return b;
oe(c, this.event, a, b);
b.assign(c.yt(b));
return b
};
ma.Object.defineProperties(ne.prototype, {
diagram: {
get: function () {
return this.C
}, set: function (a) {
this.C = a
}
}, viewPoint: {
get: function () {
return this.Du
}, set: function (a) {
this.Du.assign(a)
}
}, documentPoint: {
get: function () {
return this.Tt
}, set: function (a) {
this.Tt.assign(a)
}
}, modifiers: {
get: function () {
return this.Wr
}, set: function (a) {
this.Wr = a
}
}, button: {
get: function () {
return this.Pq
},
set: function (a) {
this.Pq = a;
if (null === this.event) switch (a) {
case 0:
this.buttons = 1;
break;
case 1:
this.buttons = 4;
break;
case 2:
this.buttons = 2
}
}
}, buttons: {
get: function () {
return this.Qq
}, set: function (a) {
this.Qq = a
}
}, key: {
get: function () {
return this.Lr
}, set: function (a) {
this.Lr = a
}
}, down: {
get: function () {
return this.gr
}, set: function (a) {
this.gr = a
}
}, up: {
get: function () {
return this.Fs
}, set: function (a) {
this.Fs =
a
}
}, clickCount: {
get: function () {
return this.Sq
}, set: function (a) {
this.Sq = a
}
}, delta: {
get: function () {
return this.fr
}, set: function (a) {
this.fr = a
}
}, isMultiTouch: {
get: function () {
return this.Fr
}, set: function (a) {
this.Fr = a
}
}, handled: {
get: function () {
return this.ur
}, set: function (a) {
this.ur = a
}
}, bubbles: {
get: function () {
return this.Eg
}, set: function (a) {
this.Eg = a
}
}, event: {
get: function () {
return this.mr
}, set: function (a) {
this.mr = a
}
}, isTouchEvent: {
get: function () {
var a = x.TouchEvent, b = this.event;
return a && b instanceof a ? !0 : (a = x.PointerEvent) && b instanceof a && ("touch" === b.pointerType || "pen" === b.pointerType)
}
}, timestamp: {
get: function () {
return this.Ds
}, set: function (a) {
this.Ds = a
}
}, targetDiagram: {
get: function () {
return this.Cs
}, set: function (a) {
this.Cs = a
}
}, targetObject: {
get: function () {
return this.Qd
}, set: function (a) {
this.Qd = a
}
}, control: {
get: function () {
return 0 !== (this.modifiers & 1)
}, set: function (a) {
this.modifiers = a ? this.modifiers | 1 : this.modifiers & -2
}
}, shift: {
get: function () {
return 0 !== (this.modifiers & 4)
}, set: function (a) {
this.modifiers = a ? this.modifiers | 4 : this.modifiers & -5
}
}, alt: {
get: function () {
return 0 !== (this.modifiers & 2)
}, set: function (a) {
this.modifiers = a ? this.modifiers |
2 : this.modifiers & -3
}
}, meta: {
get: function () {
return 0 !== (this.modifiers & 8)
}, set: function (a) {
this.modifiers = a ? this.modifiers | 8 : this.modifiers & -9
}
}, left: {
get: function () {
var a = this.event;
return null === a || "mousedown" !== a.type && "mouseup" !== a.type && "pointerdown" !== a.type && "pointerup" !== a.type ? 0 !== (this.buttons & 1) : 0 === this.button
}, set: function (a) {
this.buttons = a ? this.buttons | 1 : this.buttons & -2
}
}, right: {
get: function () {
var a =
this.event;
return null === a || "mousedown" !== a.type && "mouseup" !== a.type && "pointerdown" !== a.type && "pointerup" !== a.type ? 0 !== (this.buttons & 2) : 2 === this.button
}, set: function (a) {
this.buttons = a ? this.buttons | 2 : this.buttons & -3
}
}, middle: {
get: function () {
var a = this.event;
return null === a || "mousedown" !== a.type && "mouseup" !== a.type && "pointerdown" !== a.type && "pointerup" !== a.type ? 0 !== (this.buttons & 4) : 1 === this.button
}, set: function (a) {
this.buttons = a ? this.buttons | 4 : this.buttons & -5
}
}
});
ne.prototype.getMultiTouchDocumentPoint = ne.prototype.az;
ne.prototype.getMultiTouchViewPoint = ne.prototype.$p;
ne.className = "InputEvent";
function pe() {
this.C = null;
this.Ua = "";
this.gs = this.As = null
}
pe.prototype.copy = function () {
var a = new pe;
a.C = this.C;
a.Ua = this.Ua;
a.As = this.As;
a.gs = this.gs;
return a
};
pe.prototype.toString = function () {
var a = "*" + this.name;
null !== this.subject && (a += ":" + this.subject.toString());
null !== this.parameter && (a += "(" + this.parameter.toString() + ")");
return a
};
ma.Object.defineProperties(pe.prototype, {
diagram: {
get: function () {
return this.C
}, set: function (a) {
this.C = a
}
}, name: {
get: function () {
return this.Ua
}, set: function (a) {
this.Ua = a
}
}, subject: {
get: function () {
return this.As
}, set: function (a) {
this.As = a
}
}, parameter: {
get: function () {
return this.gs
}, set: function (a) {
this.gs = a
}
}
});
pe.className = "DiagramEvent";
function qe() {
this.Wm = re;
this.Fj = this.Vr = "";
this.Co = this.Do = this.Io = this.Jo = this.Ho = this.C = this.Zb = null
}
qe.prototype.clear = function () {
this.Co = this.Do = this.Io = this.Jo = this.Ho = this.C = this.Zb = null
};
qe.prototype.copy = function () {
var a = new qe;
a.Wm = this.Wm;
a.Vr = this.Vr;
a.Fj = this.Fj;
a.Zb = this.Zb;
a.C = this.C;
a.Ho = this.Ho;
var b = this.Jo;
a.Jo = ya(b) && "function" === typeof b.I ? b.I() : b;
b = this.Io;
a.Io = ya(b) && "function" === typeof b.I ? b.I() : b;
b = this.Do;
a.Do = ya(b) && "function" === typeof b.I ? b.I() : b;
b = this.Co;
a.Co = ya(b) && "function" === typeof b.I ? b.I() : b;
return a
};
qe.prototype.fb = function (a) {
a.classType === qe && (this.change = a)
};
qe.prototype.toString = function () {
var a = "";
a = this.change === se ? a + "* " : this.change === re ? a + (null !== this.model ? "!m" : "!d") : a + ((null !== this.model ? "!m" : "!d") + this.change);
this.propertyName && "string" === typeof this.propertyName && (a += " " + this.propertyName);
this.modelChange && this.modelChange !== this.propertyName && (a += " " + this.modelChange);
a += ": ";
this.change === se ? null !== this.oldValue && (a += " " + this.oldValue) : (null !== this.object && (a += Ja(this.object)), null !== this.oldValue && (a += " old: " + Ja(this.oldValue)), null !==
this.oldParam && (a += " " + this.oldParam), null !== this.newValue && (a += " new: " + Ja(this.newValue)), null !== this.newParam && (a += " " + this.newParam));
return a
};
qe.prototype.J = function (a) {
return a ? this.oldValue : this.newValue
};
qe.prototype.cz = function (a) {
return a ? this.oldParam : this.newParam
};
qe.prototype.canUndo = function () {
return null !== this.model || null !== this.diagram ? !0 : !1
};
qe.prototype.undo = function () {
this.canUndo() && (null !== this.model ? this.model.Tj(this, !0) : null !== this.diagram && this.diagram.Tj(this, !0))
};
qe.prototype.canRedo = function () {
return null !== this.model || null !== this.diagram ? !0 : !1
};
qe.prototype.redo = function () {
this.canRedo() && (null !== this.model ? this.model.Tj(this, !1) : null !== this.diagram && this.diagram.Tj(this, !1))
};
ma.Object.defineProperties(qe.prototype, {
model: {
get: function () {
return this.Zb
}, set: function (a) {
this.Zb = a
}
}, diagram: {
get: function () {
return this.C
}, set: function (a) {
this.C = a
}
}, change: {
get: function () {
return this.Wm
}, set: function (a) {
this.Wm = a
}
}, modelChange: {
get: function () {
return this.Vr
}, set: function (a) {
this.Vr = a
}
}, propertyName: {
get: function () {
return this.Fj
},
set: function (a) {
this.Fj = a
}
}, isTransactionFinished: {
get: function () {
return this.Wm === se && ("CommittedTransaction" === this.Fj || "FinishedUndo" === this.Fj || "FinishedRedo" === this.Fj)
}
}, object: {
get: function () {
return this.Ho
}, set: function (a) {
this.Ho = a
}
}, oldValue: {
get: function () {
return this.Jo
}, set: function (a) {
this.Jo = a
}
}, oldParam: {
get: function () {
return this.Io
}, set: function (a) {
this.Io = a
}
},
newValue: {
get: function () {
return this.Do
}, set: function (a) {
this.Do = a
}
}, newParam: {
get: function () {
return this.Co
}, set: function (a) {
this.Co = a
}
}
});
qe.prototype.redo = qe.prototype.redo;
qe.prototype.canRedo = qe.prototype.canRedo;
qe.prototype.undo = qe.prototype.undo;
qe.prototype.canUndo = qe.prototype.canUndo;
qe.prototype.getParam = qe.prototype.cz;
qe.prototype.getValue = qe.prototype.J;
qe.prototype.clear = qe.prototype.clear;
var se = new D(qe, "Transaction", -1), re = new D(qe, "Property", 0), te = new D(qe, "Insert", 1),
ue = new D(qe, "Remove", 2);
qe.className = "ChangedEvent";
qe.Transaction = se;
qe.Property = re;
qe.Insert = te;
qe.Remove = ue;
function ve() {
this.u = (new E).freeze();
this.Ua = "";
this.l = !1
}
ve.prototype.toString = function (a) {
var b = "Transaction: " + this.name + " " + this.changes.count.toString() + (this.isComplete ? "" : ", incomplete");
if (void 0 !== a && 0 < a) {
a = this.changes.count;
for (var c = 0; c < a; c++) {
var d = this.changes.N(c);
null !== d && (b += "\n " + d.toString())
}
}
return b
};
ve.prototype.clear = function () {
var a = this.changes;
a.ha();
for (var b = a.count - 1; 0 <= b; b--) {
var c = a.N(b);
null !== c && c.clear()
}
a.clear();
a.freeze()
};
ve.prototype.canUndo = function () {
return this.isComplete
};
ve.prototype.undo = function () {
if (this.canUndo()) for (var a = this.changes.count - 1; 0 <= a; a--) {
var b = this.changes.N(a);
null !== b && b.undo()
}
};
ve.prototype.canRedo = function () {
return this.isComplete
};
ve.prototype.redo = function () {
if (this.canRedo()) for (var a = this.changes.count, b = 0; b < a; b++) {
var c = this.changes.N(b);
null !== c && c.redo()
}
};
ma.Object.defineProperties(ve.prototype, {
changes: {
get: function () {
return this.u
}
}, name: {
get: function () {
return this.Ua
}, set: function (a) {
this.Ua = a
}
}, isComplete: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}
});
ve.prototype.redo = ve.prototype.redo;
ve.prototype.canRedo = ve.prototype.canRedo;
ve.prototype.undo = ve.prototype.undo;
ve.prototype.canUndo = ve.prototype.canUndo;
ve.prototype.clear = ve.prototype.clear;
ve.className = "Transaction";
function Ce() {
this.ku = new F;
this.Dc = !1;
this.K = (new E).freeze();
this.ge = -1;
this.u = 999;
this.ie = !1;
this.dr = null;
this.Bi = 0;
this.l = !1;
this.re = (new E).freeze();
this.tl = new E;
this.$t = !0;
this.eu = !1
}
Ce.prototype.toString = function (a) {
var b = "UndoManager " + this.historyIndex + "<" + this.history.count + "<=" + this.maxHistoryLength;
b += "[";
for (var c = this.nestedTransactionNames.count, d = 0; d < c; d++) 0 < d && (b += " "), b += this.nestedTransactionNames.N(d);
b += "]";
if (void 0 !== a && 0 < a) for (c = this.history.count, d = 0; d < c; d++) b += "\n " + this.history.N(d).toString(a - 1);
return b
};
Ce.prototype.clear = function () {
var a = this.history;
a.ha();
for (var b = a.count - 1; 0 <= b; b--) {
var c = a.N(b);
null !== c && c.clear()
}
a.clear();
this.ge = -1;
a.freeze();
this.ie = !1;
this.dr = null;
this.Bi = 0;
this.re.ha();
this.re.clear();
this.re.freeze();
this.tl.clear()
};
Ce.prototype.copyProperties = function (a) {
this.isEnabled = a.isEnabled;
this.maxHistoryLength = a.maxHistoryLength;
this.checksTransactionLevel = a.checksTransactionLevel
};
t = Ce.prototype;
t.Rw = function (a) {
this.ku.add(a)
};
t.yx = function (a) {
this.ku.remove(a)
};
t.Aa = function (a) {
void 0 === a && (a = "");
null === a && (a = "");
if (this.isUndoingRedoing) return !1;
!0 === this.$t && (this.$t = !1, this.Bi++, this.yb("StartingFirstTransaction", a, this.currentTransaction), 0 < this.Bi && this.Bi--);
this.isEnabled && (this.re.ha(), this.re.add(a), this.re.freeze(), null === this.currentTransaction ? this.tl.add(0) : this.tl.add(this.currentTransaction.changes.count));
this.Bi++;
var b = 1 === this.transactionLevel;
b && this.yb("StartedTransaction", a, this.currentTransaction);
return b
};
t.Za = function (a) {
void 0 === a && (a = "");
return De(this, !0, a)
};
t.wf = function () {
return De(this, !1, "")
};
function De(a, b, c) {
if (a.isUndoingRedoing) return !1;
a.checksTransactionLevel && 1 > a.transactionLevel && wa("Ending transaction without having started a transaction: " + c);
var d = 1 === a.transactionLevel;
d && b && a.yb("CommittingTransaction", c, a.currentTransaction);
var e = 0;
if (0 < a.transactionLevel && (a.Bi--, a.isEnabled)) {
var f = a.re.count;
0 < f && ("" === c && (c = a.re.N(0)), a.re.ha(), a.re.mb(f - 1), a.re.freeze());
f = a.tl.count;
0 < f && (e = a.tl.N(f - 1), a.tl.mb(f - 1))
}
f = a.currentTransaction;
if (d) {
if (b) {
a.eu = !1;
if (a.isEnabled && null !==
f) {
b = f;
b.isComplete = !0;
b.name = c;
d = a.history;
d.ha();
for (e = d.count - 1; e > a.historyIndex; e--) f = d.N(e), null !== f && f.clear(), d.mb(e), a.eu = !0;
e = a.maxHistoryLength;
0 <= e && (0 === e ? d.clear() : d.count >= e && (f = d.N(0), null !== f && f.clear(), d.mb(0), a.ge--));
0 !== e && (d.add(b), a.ge++);
d.freeze();
f = b
}
a.yb("CommittedTransaction", c, f)
} else {
a.ie = !0;
try {
a.isEnabled && null !== f && (f.isComplete = !0, f.undo())
} finally {
a.yb("RolledBackTransaction", c, f), a.ie = !1
}
null !== f && f.clear()
}
a.dr = null;
return !0
}
if (a.isEnabled && !b && null !== f) {
a = e;
c =
f.changes;
for (b = c.count - 1; b >= a; b--) d = c.N(b), null !== d && d.undo(), c.ha(), c.mb(b);
c.freeze()
}
return !1
}
Ce.prototype.canUndo = function () {
if (!this.isEnabled || 0 < this.transactionLevel) return !1;
var a = this.transactionToUndo;
return null !== a && a.canUndo() ? !0 : !1
};
Ce.prototype.undo = function () {
if (this.canUndo()) {
var a = this.transactionToUndo;
try {
this.ie = !0, this.yb("StartingUndo", "Undo", a), this.ge--, a.undo()
} catch (b) {
wa("undo error: " + b.toString())
} finally {
this.yb("FinishedUndo", "Undo", a), this.ie = !1
}
}
};
Ce.prototype.canRedo = function () {
if (!this.isEnabled || 0 < this.transactionLevel) return !1;
var a = this.transactionToRedo;
return null !== a && a.canRedo() ? !0 : !1
};
Ce.prototype.redo = function () {
if (this.canRedo()) {
var a = this.transactionToRedo;
try {
this.ie = !0, this.yb("StartingRedo", "Redo", a), this.ge++, a.redo()
} catch (b) {
wa("redo error: " + b.toString())
} finally {
this.yb("FinishedRedo", "Redo", a), this.ie = !1
}
}
};
Ce.prototype.yb = function (a, b, c) {
void 0 === c && (c = null);
var d = new qe;
d.change = se;
d.propertyName = a;
d.object = c;
d.oldValue = b;
for (a = this.models; a.next();) b = a.value, d.model = b, b.Ls(d)
};
Ce.prototype.hv = function (a) {
if (this.isEnabled && !this.isUndoingRedoing && !this.skipsEvent(a)) {
var b = this.currentTransaction;
null === b && (this.dr = b = new ve);
var c = a.copy();
b = b.changes;
b.ha();
b.add(c);
b.freeze();
this.checksTransactionLevel && 0 >= this.transactionLevel && !this.$t && (a = a.diagram, null !== a && !1 === a.Ri || wa("Change not within a transaction: " + c.toString()))
}
};
Ce.prototype.skipsEvent = function (a) {
if (null === a || 0 > a.change.value) return !0;
a = a.object;
if (void 0 !== a.layer) {
if (a = a.layer, null !== a && a.isTemporary) return !0
} else if (a.isTemporary) return !0;
return !1
};
ma.Object.defineProperties(Ce.prototype, {
models: {
get: function () {
return this.ku.iterator
}
}, isEnabled: {
get: function () {
return this.Dc
}, set: function (a) {
this.Dc = a
}
}, transactionToUndo: {
get: function () {
return 0 <= this.historyIndex && this.historyIndex <= this.history.count - 1 ? this.history.N(this.historyIndex) : null
}
}, transactionToRedo: {
get: function () {
return this.historyIndex < this.history.count -
1 ? this.history.N(this.historyIndex + 1) : null
}
}, isUndoingRedoing: {
get: function () {
return this.ie
}
}, history: {
get: function () {
return this.K
}
}, maxHistoryLength: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, historyIndex: {
get: function () {
return this.ge
}
}, currentTransaction: {
get: function () {
return this.dr
}
}, transactionLevel: {
get: function () {
return this.Bi
}
}, isInTransaction: {
get: function () {
return 0 < this.Bi
}
}, checksTransactionLevel: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}, nestedTransactionNames: {
get: function () {
return this.re
}
}
});
Ce.prototype.handleChanged = Ce.prototype.hv;
Ce.prototype.redo = Ce.prototype.redo;
Ce.prototype.undo = Ce.prototype.undo;
Ce.prototype.canUndo = Ce.prototype.canUndo;
Ce.prototype.rollbackTransaction = Ce.prototype.wf;
Ce.prototype.commitTransaction = Ce.prototype.Za;
Ce.prototype.startTransaction = Ce.prototype.Aa;
Ce.prototype.removeModel = Ce.prototype.yx;
Ce.prototype.addModel = Ce.prototype.Rw;
Ce.prototype.clear = Ce.prototype.clear;
Ce.className = "UndoManager";
function Ee() {
ab(this);
this.C = Fe;
this.Ua = "";
this.Dc = !0;
this.Ub = !1;
this.Cq = null;
this.$x = new ne;
this.Is = -1
}
Ee.prototype.hb = function (a) {
this.C = a
};
Ee.prototype.toString = function () {
return "" !== this.name ? this.name + " Tool" : Ha(this.constructor)
};
Ee.prototype.updateAdornments = function () {
};
Ee.prototype.canStart = function () {
return this.isEnabled
};
Ee.prototype.doStart = function () {
};
Ee.prototype.doActivate = function () {
this.isActive = !0
};
Ee.prototype.doDeactivate = function () {
this.isActive = !1
};
Ee.prototype.doStop = function () {
};
Ee.prototype.doCancel = function () {
this.transactionResult = null;
this.stopTool()
};
Ee.prototype.stopTool = function () {
var a = this.diagram;
a.currentTool === this && (a.currentTool = null, a.currentCursor = "")
};
Ee.prototype.doMouseDown = function () {
!this.isActive && this.canStart() && this.doActivate()
};
Ee.prototype.doMouseMove = function () {
};
Ee.prototype.doMouseUp = function () {
this.stopTool()
};
Ee.prototype.doMouseWheel = function () {
};
Ee.prototype.canStartMultiTouch = function () {
return !0
};
Ee.prototype.standardPinchZoomStart = function () {
var a = this.diagram, b = a.lastInput, c = b.$p(0, G.allocAt(NaN, NaN)), d = b.$p(1, G.allocAt(NaN, NaN));
if (c.o() && d.o() && (this.doCancel(), a.cm("hasGestureZoom"))) {
a.Ko = a.scale;
var e = d.x - c.x, f = d.y - c.y;
a.Hw = Math.sqrt(e * e + f * f);
b.bubbles = !1
}
G.free(c);
G.free(d)
};
Ee.prototype.standardPinchZoomMove = function () {
var a = this.diagram, b = a.lastInput, c = b.$p(0, G.allocAt(NaN, NaN)), d = b.$p(1, G.allocAt(NaN, NaN));
if (c.o() && d.o() && (this.doCancel(), a.cm("hasGestureZoom"))) {
var e = d.x - c.x, f = d.y - c.y;
f = Math.sqrt(e * e + f * f) / a.Hw;
e = new G((Math.min(d.x, c.x) + Math.max(d.x, c.x)) / 2, (Math.min(d.y, c.y) + Math.max(d.y, c.y)) / 2);
f *= a.Ko;
var g = a.commandHandler;
if (f !== a.scale && g.canResetZoom(f)) {
var h = a.zoomPoint;
a.zoomPoint = e;
g.resetZoom(f);
a.zoomPoint = h
}
b.bubbles = !1
}
G.free(c);
G.free(d)
};
Ee.prototype.doKeyDown = function () {
"Esc" === this.diagram.lastInput.key && this.doCancel()
};
Ee.prototype.doKeyUp = function () {
};
Ee.prototype.Aa = function (a) {
void 0 === a && (a = this.name);
this.transactionResult = null;
return this.diagram.Aa(a)
};
Ee.prototype.zg = function () {
var a = this.diagram;
return null === this.transactionResult ? a.wf() : a.Za(this.transactionResult)
};
Ee.prototype.standardMouseSelect = function () {
var a = this.diagram;
if (a.allowSelect) {
var b = a.lastInput, c = a.am(b.documentPoint, !1);
if (null !== c) if (Wa ? b.meta : b.control) {
a.aa("ChangingSelection", a.selection);
for (b = c; null !== b && !b.canSelect();) b = b.containingGroup;
null !== b && (b.isSelected = !b.isSelected);
a.aa("ChangedSelection", a.selection)
} else if (b.shift) {
if (!c.isSelected) {
a.aa("ChangingSelection", a.selection);
for (b = c; null !== b && !b.canSelect();) b = b.containingGroup;
null !== b && (b.isSelected = !0);
a.aa("ChangedSelection",
a.selection)
}
} else {
if (!c.isSelected) {
for (b = c; null !== b && !b.canSelect();) b = b.containingGroup;
null !== b && a.select(b)
}
} else !b.left || (Wa ? b.meta : b.control) || b.shift || a.Rp()
}
};
Ee.prototype.standardMouseClick = function (a, b) {
void 0 === a && (a = null);
void 0 === b && (b = function (a) {
return !a.layer.isTemporary
});
var c = this.diagram, d = c.lastInput;
a = c.Rb(d.documentPoint, a, b);
d.targetObject = a;
Ge(a, d, c);
return d.handled
};
function Ge(a, b, c) {
b.handled = !1;
if (null === a || a.vg()) {
var d = 0;
b.left ? d = 1 === b.clickCount ? 1 : 2 === b.clickCount ? 2 : 1 : b.right && 1 === b.clickCount && (d = 3);
var e = "ObjectSingleClicked";
if (null !== a) {
switch (d) {
case 1:
e = "ObjectSingleClicked";
break;
case 2:
e = "ObjectDoubleClicked";
break;
case 3:
e = "ObjectContextClicked"
}
0 !== d && c.aa(e, a)
} else {
switch (d) {
case 1:
e = "BackgroundSingleClicked";
break;
case 2:
e = "BackgroundDoubleClicked";
break;
case 3:
e = "BackgroundContextClicked"
}
0 !== d && c.aa(e)
}
if (null !== a) for (; null !== a;) {
c = null;
switch (d) {
case 1:
c =
a.click;
break;
case 2:
c = a.doubleClick ? a.doubleClick : a.click;
break;
case 3:
c = a.contextClick
}
if (null !== c && (c(b, a), b.handled)) break;
a = a.panel
} else {
a = null;
switch (d) {
case 1:
a = c.click;
break;
case 2:
a = c.doubleClick ? c.doubleClick : c.click;
break;
case 3:
a = c.contextClick
}
null !== a && a(b)
}
}
}
Ee.prototype.standardMouseOver = function () {
var a = this.diagram, b = a.lastInput;
if (!0 !== a.animationManager.rb) {
var c = a.skipsUndoManager;
a.skipsUndoManager = !0;
var d = a.viewportBounds.da(b.documentPoint) ? a.Rb(b.documentPoint, null, null) : null;
b.targetObject = d;
var e = !1;
if (d !== a.Lk) {
var f = a.Lk, g = f;
a.Lk = d;
this.doCurrentObjectChanged(f, d);
for (b.handled = !1; null !== f;) {
var h = f.mouseLeave;
if (null !== h) {
if (d === f) break;
if (null !== d && d.ug(f)) break;
h(b, f, d);
e = !0;
if (b.handled) break
}
f = f.panel
}
f = g;
for (b.handled = !1; null !== d;) {
g =
d.mouseEnter;
if (null !== g) {
if (f === d) break;
if (null !== f && f.ug(d)) break;
g(b, d, f);
e = !0;
if (b.handled) break
}
d = d.panel
}
d = a.Lk
}
if (null !== d) {
f = d;
for (g = ""; null !== f;) {
g = f.cursor;
if ("" !== g) break;
f = f.panel
}
a.currentCursor = g;
b.handled = !1;
for (f = d; null !== f;) {
d = f.mouseOver;
if (null !== d && (d(b, f), e = !0, b.handled)) break;
f = f.panel
}
} else a.currentCursor = "", d = a.mouseOver, null !== d && (d(b), e = !0);
e && a.cc();
a.skipsUndoManager = c
}
};
Ee.prototype.doCurrentObjectChanged = function () {
};
Ee.prototype.standardMouseWheel = function () {
var a = this.diagram, b = a.lastInput, c = b.delta;
if (0 !== c && a.documentBounds.o()) {
var d = a.commandHandler, e = a.toolManager.mouseWheelBehavior;
if (null !== d && (e === He && !b.shift || e === Ie && b.control) && (0 < c ? d.canIncreaseZoom() : d.canDecreaseZoom())) e = a.zoomPoint, a.zoomPoint = b.viewPoint, 0 < c ? d.increaseZoom() : d.decreaseZoom(), a.zoomPoint = e, b.bubbles = !1; else if (e === He && b.shift || e === Ie && !b.control) {
d = a.position.copy();
var f = 0 < c ? c : -c, g = b.event, h = g.deltaMode;
e = g.deltaX;
g = g.deltaY;
if (Ta || Ua || Va) h = 1, 0 < e && (e = 3), 0 > e && (e = -3), 0 < g && (g = 3), 0 > g && (g = -3);
if (void 0 === h || void 0 === e || void 0 === g || 0 === e && 0 === g || b.shift) !b.shift && a.allowVerticalScroll ? (f = 3 * f * a.scrollVerticalLineChange, 0 < c ? a.scroll("pixel", "up", f) : a.scroll("pixel", "down", f)) : b.shift && a.allowHorizontalScroll && (f = 3 * f * a.scrollHorizontalLineChange, 0 < c ? a.scroll("pixel", "left", f) : a.scroll("pixel", "right", f)); else {
switch (h) {
case 0:
c = "pixel";
break;
case 1:
c = "line";
break;
case 2:
c = "page";
break;
default:
c = "pixel"
}
0 !== e && a.allowHorizontalScroll &&
(0 < e ? a.scroll(c, "left", -e) : a.scroll(c, "right", e));
0 !== g && a.allowVerticalScroll && (0 < g ? a.scroll(c, "up", -g) : a.scroll(c, "down", g))
}
a.position.A(d) || (b.bubbles = !1)
}
}
};
Ee.prototype.standardWaitAfter = function (a, b) {
void 0 === b && (b = this.diagram.lastInput);
this.cancelWaitAfter();
var c = this, d = b.clone(this.$x);
this.Is = sa(function () {
c.doWaitAfter(d)
}, a)
};
Ee.prototype.cancelWaitAfter = function () {
-1 !== this.Is && x.clearTimeout(this.Is);
this.Is = -1
};
Ee.prototype.doWaitAfter = function () {
};
Ee.prototype.findToolHandleAt = function (a, b) {
a = this.diagram.Rb(a, function (a) {
for (; null !== a && !(a.panel instanceof Je);) a = a.panel;
return a
});
return null === a ? null : a.part.category === b ? a : null
};
Ee.prototype.isBeyondDragSize = function (a, b) {
var c = this.diagram;
void 0 === a && (a = c.firstInput.viewPoint);
void 0 === b && (b = c.lastInput.viewPoint);
var d = c.toolManager.dragSize, e = d.width;
d = d.height;
c.firstInput.isTouchEvent && (e += 6, d += 6);
return Math.abs(b.x - a.x) > e || Math.abs(b.y - a.y) > d
};
ma.Object.defineProperties(Ee.prototype, {
diagram: {
get: function () {
return this.C
}, set: function (a) {
a instanceof P && (this.C = a)
}
}, name: {
get: function () {
return this.Ua
}, set: function (a) {
this.Ua = a
}
}, isEnabled: {
get: function () {
return this.Dc
}, set: function (a) {
this.Dc = a
}
}, isActive: {
get: function () {
return this.Ub
}, set: function (a) {
this.Ub = a
}
}, transactionResult: {
get: function () {
return this.Cq
},
set: function (a) {
this.Cq = a
}
}
});
Ee.prototype.stopTransaction = Ee.prototype.zg;
Ee.prototype.startTransaction = Ee.prototype.Aa;
Ee.className = "Tool";
function Na() {
Ee.call(this);
this.name = "ToolManager";
this.Kc = new E;
this.Vc = new E;
this.Ag = new E;
this.ba = this.La = 850;
this.u = (new M(2, 2)).ga();
this.Vb = 5E3;
this.Ma = Ie;
this.K = Ke;
this.cr = this.l = null;
this.Mj = -1
}
la(Na, Ee);
Na.prototype.initializeStandardTools = function () {
};
Na.prototype.updateAdornments = function (a) {
var b = this.currentToolTip;
if (b instanceof Je && this.cr === a) {
var c = b.adornedObject;
(null !== a ? c.part === a : null === c) ? this.showToolTip(b, c) : this.hideToolTip()
}
};
Na.prototype.doMouseDown = function () {
var a = this.diagram, b = a.lastInput;
b.isTouchEvent && this.gestureBehavior === Le && (b.bubbles = !1);
if (b.isMultiTouch) {
this.cancelWaitAfter();
if (this.gestureBehavior === Me) {
b.bubbles = !0;
return
}
if (this.gestureBehavior === Le) return;
if (a.currentTool.canStartMultiTouch()) {
a.currentTool.standardPinchZoomStart();
return
}
}
for (var c = this.mouseDownTools.length, d = 0; d < c; d++) {
var e = this.mouseDownTools.N(d);
e.hb(this.diagram);
if (e.canStart()) {
a.doFocus();
a.currentTool = e;
a.currentTool ===
e && (e.isActive || e.doActivate(), e.doMouseDown());
return
}
}
1 === a.lastInput.button && (this.mouseWheelBehavior === Ie ? this.mouseWheelBehavior = He : this.mouseWheelBehavior === He && (this.mouseWheelBehavior = Ie));
this.doActivate();
this.standardWaitAfter(this.holdDelay, b)
};
Na.prototype.doMouseMove = function () {
var a = this.diagram, b = a.lastInput;
if (b.isMultiTouch) {
if (this.gestureBehavior === Me) {
b.bubbles = !0;
return
}
if (this.gestureBehavior === Le) return;
if (a.currentTool.canStartMultiTouch()) {
a.currentTool.standardPinchZoomMove();
return
}
}
if (this.isActive) for (var c = this.mouseMoveTools.length, d = 0; d < c; d++) {
var e = this.mouseMoveTools.N(d);
e.hb(this.diagram);
if (e.canStart()) {
a.doFocus();
a.currentTool = e;
a.currentTool === e && (e.isActive || e.doActivate(), e.doMouseMove());
return
}
}
Ne(this,
a);
a = b.event;
null === a || "mousemove" !== a.type && "pointermove" !== a.type && a.cancelable || (b.bubbles = !0)
};
function Ne(a, b) {
a.standardMouseOver();
a.isBeyondDragSize() && a.standardWaitAfter(a.isActive ? a.holdDelay : a.hoverDelay, b.lastInput)
}
Na.prototype.doCurrentObjectChanged = function (a, b) {
a = this.currentToolTip;
null === a || null !== b && a instanceof Je && (b === a || b.ug(a)) || this.hideToolTip()
};
Na.prototype.doWaitAfter = function (a) {
var b = this.diagram;
b.Da && (this.doMouseHover(), this.isActive || this.doToolTip(), a.isTouchEvent && !b.lastInput.handled && (a = a.copy(), a.button = 2, a.buttons = 2, b.lastInput = a, b.Nl = !0, b.doMouseUp()))
};
Na.prototype.doMouseHover = function () {
var a = this.diagram, b = a.lastInput;
null === b.targetObject && (b.targetObject = a.Rb(b.documentPoint, null, null));
var c = b.targetObject;
if (null !== c) for (b.handled = !1; null !== c;) {
a = this.isActive ? c.mouseHold : c.mouseHover;
if (null !== a && (a(b, c), b.handled)) break;
c = c.panel
} else c = this.isActive ? a.mouseHold : a.mouseHover, null !== c && c(b)
};
Na.prototype.doToolTip = function () {
var a = this.diagram, b = a.lastInput;
null === b.targetObject && (b.targetObject = a.Rb(b.documentPoint, null, null));
b = b.targetObject;
if (null !== b) {
if (a = this.currentToolTip, !(a instanceof Je) || b !== a && !b.ug(a)) {
for (; null !== b;) {
a = b.toolTip;
if (null !== a) {
this.showToolTip(a, b);
return
}
b = b.panel
}
this.hideToolTip()
}
} else b = a.toolTip, null !== b ? this.showToolTip(b, null) : this.hideToolTip()
};
Na.prototype.showToolTip = function (a, b) {
var c = this.diagram;
a !== this.currentToolTip && this.hideToolTip();
if (a instanceof Je) {
a.layerName = "Tool";
a.selectable = !1;
a.scale = 1 / c.scale;
a.category = "ToolTip";
null !== a.placeholder && (a.placeholder.scale = c.scale);
var d = a.diagram;
null !== d && d !== c && d.remove(a);
c.add(a);
null !== b ? a.adornedObject = b : a.data = c.model;
a.$b();
this.positionToolTip(a, b)
} else a instanceof Oe && a !== this.currentToolTip && a.show(b, c, this);
this.currentToolTip = a;
-1 !== this.Mj && (x.clearTimeout(this.Mj),
this.Mj = -1);
a = this.toolTipDuration;
if (0 < a && Infinity !== a) {
var e = this;
this.Mj = sa(function () {
e.hideToolTip()
}, a)
}
};
Na.prototype.positionToolTip = function (a) {
if (null === a.placeholder) {
var b = this.diagram, c = b.lastInput.documentPoint.copy(), d = a.measuredBounds, e = b.viewportBounds;
b.lastInput.isTouchEvent && (c.x -= d.width);
c.x + d.width > e.right && (c.x -= d.width + 5 / b.scale);
c.x < e.x && (c.x = e.x);
c.y = c.y + 20 / b.scale + d.height > e.bottom ? c.y - (d.height + 5 / b.scale) : c.y + 20 / b.scale;
c.y < e.y && (c.y = e.y);
a.position = c
}
};
Na.prototype.hideToolTip = function () {
-1 !== this.Mj && (x.clearTimeout(this.Mj), this.Mj = -1);
var a = this.diagram, b = this.currentToolTip;
null !== b && (b instanceof Je ? (a.remove(b), null !== this.cr && this.cr.vf(b.category), b.data = null, b.adornedObject = null) : b instanceof Oe && null !== b.hide && b.hide(a, this), this.currentToolTip = null)
};
Na.prototype.doMouseUp = function () {
this.cancelWaitAfter();
var a = this.diagram;
if (this.isActive) for (var b = this.mouseUpTools.length, c = 0; c < b; c++) {
var d = this.mouseUpTools.N(c);
d.hb(this.diagram);
if (d.canStart()) {
a.doFocus();
a.currentTool = d;
a.currentTool === d && (d.isActive || d.doActivate(), d.doMouseUp());
return
}
}
a.doFocus();
this.doDeactivate()
};
Na.prototype.doMouseWheel = function () {
this.standardMouseWheel()
};
Na.prototype.doKeyDown = function () {
var a = this.diagram;
null !== a.commandHandler && a.commandHandler.doKeyDown()
};
Na.prototype.doKeyUp = function () {
var a = this.diagram;
null !== a.commandHandler && a.commandHandler.doKeyUp()
};
Na.prototype.findTool = function (a) {
for (var b = this.mouseDownTools.length, c = 0; c < b; c++) {
var d = this.mouseDownTools.N(c);
if (d.name === a) return d
}
b = this.mouseMoveTools.length;
for (c = 0; c < b; c++) if (d = this.mouseMoveTools.N(c), d.name === a) return d;
b = this.mouseUpTools.length;
for (c = 0; c < b; c++) if (d = this.mouseUpTools.N(c), d.name === a) return d;
return null
};
Na.prototype.replaceTool = function (a, b) {
null !== b && b.hb(this.diagram);
for (var c = this.mouseDownTools.length, d = 0; d < c; d++) {
var e = this.mouseDownTools.N(d);
if (e.name === a) return null !== b ? this.mouseDownTools.gd(d, b) : this.mouseDownTools.mb(d), e
}
c = this.mouseMoveTools.length;
for (d = 0; d < c; d++) if (e = this.mouseMoveTools.N(d), e.name === a) return null !== b ? this.mouseMoveTools.gd(d, b) : this.mouseMoveTools.mb(d), e;
c = this.mouseUpTools.length;
for (d = 0; d < c; d++) if (e = this.mouseUpTools.N(d), e.name === a) return null !== b ? this.mouseUpTools.gd(d,
b) : this.mouseUpTools.mb(d), e;
return null
};
function Pe(a, b, c, d) {
null !== c && (c.name = b, c.hb(a.diagram));
a.findTool(b) ? a.replaceTool(b, c) : null !== c && d.add(c)
}
ma.Object.defineProperties(Na.prototype, {
mouseWheelBehavior: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma = a
}
}, gestureBehavior: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, currentToolTip: {
get: function () {
return this.l
}, set: function (a) {
this.l = a;
this.cr = null !== a && a instanceof Je ? a.adornedPart : null
}
}, mouseDownTools: {
get: function () {
return this.Kc
}
}, mouseMoveTools: {
get: function () {
return this.Vc
}
}, mouseUpTools: {
get: function () {
return this.Ag
}
}, hoverDelay: {
get: function () {
return this.La
}, set: function (a) {
this.La = a
}
}, holdDelay: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}, dragSize: {
get: function () {
return this.u
}, set: function (a) {
this.u = a.I()
}
}, toolTipDuration: {
get: function () {
return this.Vb
},
set: function (a) {
this.Vb = a
}
}
});
var Ie = new D(Na, "WheelScroll", 0), He = new D(Na, "WheelZoom", 1), Qe = new D(Na, "WheelNone", 2),
Ke = new D(Na, "GestureZoom", 3), Le = new D(Na, "GestureCancel", 4), Me = new D(Na, "GestureNone", 5);
Na.className = "ToolManager";
Na.WheelScroll = Ie;
Na.WheelZoom = He;
Na.WheelNone = Qe;
Na.GestureZoom = Ke;
Na.GestureCancel = Le;
Na.GestureNone = Me;
function Re() {
Ee.call(this);
this.name = "Dragging";
this.K = this.Kc = !0;
this.u = this.Ma = this.ba = this.eg = null;
this.yn = this.Vc = !1;
this.Il = new G(NaN, NaN);
this.ys = new G;
this.Vb = !0;
this.Sk = 100;
this.Lg = [];
this.Ag = (new F).freeze();
this.La = new Ye
}
la(Re, Ee);
Re.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (a.isReadOnly && !a.allowDragOut || !a.allowMove && !a.allowCopy && !a.allowDragOut || !a.allowSelect) return !1;
var b = a.lastInput;
return !b.left || a.currentTool !== this && (!this.isBeyondDragSize() || b.isTouchEvent && b.timestamp - a.firstInput.timestamp < this.Sk) ? !1 : null !== this.findDraggablePart()
};
Re.prototype.findDraggablePart = function () {
var a = this.diagram;
a = a.am(a.firstInput.documentPoint, !1);
if (null === a) return null;
for (; null !== a && !a.canSelect();) a = a.containingGroup;
return null !== a && (a.canMove() || a.canCopy()) ? a : null
};
Re.prototype.standardMouseSelect = function () {
var a = this.diagram;
if (a.allowSelect) {
var b = a.am(a.firstInput.documentPoint, !1);
if (null !== b) {
for (; null !== b && !b.canSelect();) b = b.containingGroup;
this.currentPart = b;
null === this.currentPart || this.currentPart.isSelected || (a.aa("ChangingSelection", a.selection), b = a.lastInput, (Wa ? b.meta : b.control) || b.shift || Ze(a), this.currentPart.isSelected = !0, a.aa("ChangedSelection", a.selection))
}
}
};
Re.prototype.doActivate = function () {
var a = this.diagram;
null === this.currentPart && this.standardMouseSelect();
var b = this.currentPart;
null !== b && (b.canMove() || b.canCopy()) && ($e = null, this.isActive = !0, this.Il.set(a.position), af(this, a.selection), this.Lg.length = 0, this.draggedParts = this.computeEffectiveCollection(a.selection, this.dragOptions), a.tk = !0, !0 === a.Ee("temporaryPixelRatio") && 30 < a.Uw && bf(a), cf(a, this.draggedParts), this.Aa("Drag"), this.startPoint = a.firstInput.documentPoint, a.isMouseCaptured = !0, a.allowDragOut &&
(this.isDragOutStarted = !0, this.yn = !1, $e = this, df = this.diagram, this.doSimulatedDragOut()))
};
function af(a, b) {
if (a.dragsLink) {
var c = a.diagram;
c.allowRelink && (c.model.ek() && 1 === b.count && b.first() instanceof R ? (a.draggedLink = b.first(), a.draggedLink.canRelinkFrom() && a.draggedLink.canRelinkTo() && a.draggedLink.Uj(), a.eg = c.toolManager.findTool("Relinking"), null === a.eg && (a.eg = new ef, a.eg.hb(c))) : (a.draggedLink = null, a.eg = null))
}
}
Re.prototype.computeEffectiveCollection = function (a, b) {
return this.diagram.commandHandler.computeEffectiveCollection(a, b)
};
Re.prototype.pd = function (a) {
return void 0 === a ? new ff(Fb) : this.isGridSnapEnabled ? new ff(new G(Math.round(a.x), Math.round(a.y))) : new ff(a.copy())
};
Re.prototype.doDeactivate = function () {
this.isActive = !1;
var a = this.diagram;
a.xf();
gf(this);
hf(a, this.draggedParts);
this.draggedParts = this.currentPart = null;
this.yn = this.isDragOutStarted = !1;
if (0 < jf.count) {
for (var b = jf, c = b.length, d = 0; d < c; d++) {
var e = b.N(d);
kf(e);
lf(e);
gf(e);
e.diagram.xf()
}
b.clear()
}
kf(this);
this.Il.h(NaN, NaN);
$e = df = null;
lf(this);
a.isMouseCaptured = !1;
a.currentCursor = "";
a.tk = !1;
this.zg();
mf(a, !0)
};
function gf(a) {
var b = a.diagram, c = b.skipsUndoManager;
b.skipsUndoManager = !0;
nf(a, b.lastInput, null);
b.skipsUndoManager = c;
a.Lg.length = 0
}
function of() {
var a = $e;
lf(a);
pf(a);
var b = a.diagram;
a.Il.o() && (b.position = a.Il);
b.xf()
}
Re.prototype.doCancel = function () {
lf(this);
pf(this);
var a = this.diagram;
this.Il.o() && (a.position = this.Il);
this.stopTool()
};
Re.prototype.doKeyDown = function () {
this.isActive && ("Esc" === this.diagram.lastInput.key ? this.doCancel() : this.doMouseMove())
};
Re.prototype.doKeyUp = function () {
this.isActive && this.doMouseMove()
};
function qf(a, b) {
var c = Infinity, d = Infinity, e = -Infinity, f = -Infinity;
for (a = a.iterator; a.next();) {
var g = a.value;
if (g.bc() && g.isVisible()) {
var h = g.location;
g = h.x;
h = h.y;
isNaN(g) || isNaN(h) || (g < c && (c = g), h < d && (d = h), g > e && (e = g), h > f && (f = h))
}
}
Infinity === c ? b.h(0, 0, 0, 0) : b.h(c, d, e - c, f - d)
}
function rf(a, b) {
if (null === a.copiedParts) {
var c = a.diagram;
if ((!b || !c.isReadOnly && !c.isModelReadOnly) && null !== a.draggedParts) {
var d = c.undoManager;
d.isEnabled && d.isInTransaction ? null !== d.currentTransaction && 0 < d.currentTransaction.changes.count && (c.undoManager.wf(), c.Aa("Drag")) : pf(a);
c.skipsUndoManager = !b;
c.partManager.addsToTemporaryLayer = !b;
a.startPoint = c.firstInput.documentPoint;
b = a.copiesEffectiveCollection ? a.draggedParts.Yd() : c.selection;
c = c.Zj(b, c, !0);
for (b = c.iterator; b.next();) b.value.location =
b.key.location;
b = N.alloc();
qf(c, b);
N.free(b);
b = new vb;
for (d = a.draggedParts.iterator; d.next();) {
var e = d.key;
e.bc() && e.canCopy() && (e = c.J(e), null !== e && (e.$b(), b.add(e, a.pd(e.location))))
}
for (c = c.iterator; c.next();) d = c.value, d instanceof R && d.canCopy() && b.add(d, a.pd());
a.copiedParts = b;
af(a, b.Yd());
null !== a.draggedLink && (c = a.draggedLink, b = c.routeBounds, sf(c, a.startPoint.x - (b.x + b.width / 2), a.startPoint.y - (b.y + b.height / 2)))
}
}
}
function lf(a) {
var b = a.diagram;
if (null !== a.copiedParts && (b.rt(a.copiedParts.Yd(), !1), a.copiedParts = null, null !== a.draggedParts)) for (var c = a.draggedParts.iterator; c.next();) c.key instanceof R && (c.value.point = new G(0, 0));
b.skipsUndoManager = !1;
b.partManager.addsToTemporaryLayer = !1;
a.startPoint = b.firstInput.documentPoint
}
function kf(a) {
if (null !== a.draggedLink) {
if (a.dragsLink && null !== a.eg) {
var b = a.eg;
b.diagram.remove(b.temporaryFromNode);
b.diagram.remove(b.temporaryToNode)
}
a.draggedLink = null;
a.eg = null
}
}
function tf(a, b, c) {
var d = a.diagram, e = a.startPoint, f = G.alloc();
f.assign(d.lastInput.documentPoint);
a.moveParts(b, f.Xd(e), c);
G.free(f);
!0 === d.Ee("temporaryPixelRatio") && null === d.kh && 30 < d.Uw && (bf(d), d.ot())
}
Re.prototype.moveParts = function (a, b, c) {
var d = this.diagram;
null !== d && zf(d, a, b, this.dragOptions, c)
};
function pf(a) {
if (null !== a.draggedParts) {
for (var b = a.diagram, c = a.draggedParts.iterator; c.next();) {
var d = c.key;
d.bc() && (d.location = c.value.point)
}
for (c = a.draggedParts.iterator; c.next();) if (d = c.key, d instanceof R && d.suspendsRouting) {
var e = c.value.point;
a.draggedParts.add(d, a.pd());
sf(d, -e.x, -e.y)
}
b.fd()
}
}
function Af(a, b) {
if (null === b) return !0;
b = b.part;
return null === b || b instanceof Je || b.layer.isTemporary || a.draggedParts && a.draggedParts.contains(b) || a.copiedParts && a.copiedParts.contains(b) ? !0 : !1
}
function Bf(a, b) {
var c = a.diagram;
a.dragsLink && (null !== a.draggedLink && (a.draggedLink.fromNode = null, a.draggedLink.toNode = null), Cf(a, !1));
var d = Df(c, b, null, function (b) {
return !Af(a, b)
}), e = c.lastInput;
e.targetObject = d;
var f = c.skipsUndoManager, g = !1;
try {
c.skipsUndoManager = !0;
g = nf(a, e, d);
if (!a.isActive && null === $e) return;
if (null === d || c.handlesDragDropForTopLevelParts) {
var h = c.mouseDragOver;
null !== h && (h(e), g = !0)
}
if (!a.isActive && null === $e) return;
a.doDragOver(b, d);
if (!a.isActive && null === $e) return
} finally {
c.skipsUndoManager =
f, g && c.fd()
}
c.isReadOnly || !c.allowMove && !c.allowCopy || !c.allowHorizontalScroll && !c.allowVerticalScroll || c.Os(e.viewPoint)
}
function nf(a, b, c) {
var d = !1, e = a.Lg.length, f = 0 < e ? a.Lg[0] : null;
if (c === f) return !1;
b.handled = !1;
for (var g = 0; g < e; g++) {
var h = a.Lg[g], k = h.mouseDragLeave;
if (null !== k && (k(b, h, c), d = !0, b.handled)) break
}
a.Lg.length = 0;
if (!a.isActive && null === $e || null === c) return d;
b.handled = !1;
for (e = c; null !== e;) a.Lg.push(e), e = Ef(e);
e = a.Lg.length;
for (c = 0; c < e && (g = a.Lg[c], h = g.mouseDragEnter, null === h || (h(b, g, f), d = !0, !b.handled)); c++) ;
return d
}
function Ef(a) {
var b = a.panel;
return null !== b ? b : a instanceof S && !(a instanceof U) && (a = a.containingGroup, null !== a && a.handlesDragDropForMembers) ? a : null
}
function Ff(a, b, c) {
var d = a.eg;
if (null === d) return null;
var e = a.diagram.rg(b, d.portGravity, function (a) {
return d.findValidLinkablePort(a, c)
});
a = G.alloc();
var f = Infinity, g = null;
for (e = e.iterator; e.next();) {
var h = e.value;
if (null !== h.part) {
var k = h.ma(Fc, a);
k = b.Ce(k);
k < f && (g = h, f = k)
}
}
G.free(a);
return g
}
function Cf(a, b) {
var c = a.draggedLink;
if (null !== c && !(2 > c.pointsCount)) {
var d = a.diagram;
if (!d.isReadOnly) {
var e = a.eg;
if (null !== e) {
var f = null, g = null;
null === c.fromNode && (f = Ff(a, c.i(0), !1), null !== f && (g = f.part));
var h = null, k = null;
null === c.toNode && (h = Ff(a, c.i(c.pointsCount - 1), !0), null !== h && (k = h.part));
e.isValidLink(g, f, k, h) ? b ? (c.defaultFromPoint = c.i(0), c.defaultToPoint = c.i(c.pointsCount - 1), c.suspendsRouting = !1, c.fromNode = g, null !== f && (c.fromPortId = f.portId), c.toNode = k, null !== h && (c.toPortId = h.portId), c.fromPort !==
d.tx && d.aa("LinkRelinked", c, d.tx), c.toPort !== d.ux && d.aa("LinkRelinked", c, d.ux)) : Gf(e, g, f, k, h) : Gf(e, null, null, null, null)
}
}
}
}
Re.prototype.doDragOver = function () {
};
function Hf(a, b) {
var c = a.diagram;
a.dragsLink && Cf(a, !0);
gf(a);
var d = Df(c, b, null, function (b) {
return !Af(a, b)
}), e = c.lastInput;
e.targetObject = d;
if (null !== d) {
e.handled = !1;
for (var f = d; null !== f;) {
var g = f.mouseDrop;
if (null !== g && (g(e, f), e.handled)) break;
If(a, e, f);
f = Ef(f)
}
} else f = c.mouseDrop, null !== f && f(e);
if (a.isActive || null !== $e) {
for (e = (a.copiedParts || a.draggedParts).iterator; e.next();) f = e.key, f instanceof V && f.linksConnected.each(function (a) {
a.suspendsRouting = !1
});
a.doDropOnto(b, d);
if (a.isActive || null !==
$e) {
b = N.alloc();
for (d = c.selection.iterator; d.next();) e = d.value, e instanceof V && Jf(a, c, e, b);
N.free(b)
}
}
}
function If(a, b, c) {
a = a.diagram;
c instanceof S && null === c.containingGroup && !(c instanceof U) && a.handlesDragDropForTopLevelParts && (c = a.mouseDrop, null !== c && c(b))
}
function Jf(a, b, c, d) {
var e = !1;
c.getAvoidableRect(d);
b.viewportBounds.nf(d) && (e = !0);
b = b.links;
for (a = a.copiedParts || a.draggedParts; b.next();) {
var f = b.value;
if (!e || Kf(f)) a.contains(f) && a.contains(c) || !f.Vd(c) && f.isAvoiding && dc(f.actualBounds, d, 0) && f.Ra()
}
}
Re.prototype.doDropOnto = function () {
};
Re.prototype.doMouseMove = function () {
if (this.isActive) {
var a = this.diagram, b = a.lastInput;
this.simulatedMouseMove(b.event, null, b.targetDiagram || null) || null === this.currentPart || null === this.draggedParts || (this.mayCopy() ? (a.currentCursor = "copy", rf(this, !1), cf(a, this.copiedParts), tf(this, this.copiedParts, !1), hf(a, this.copiedParts)) : this.mayMove() ? (a.currentCursor = "", lf(this), tf(this, this.draggedParts, !0)) : this.mayDragOut() ? (a.currentCursor = "no-drop", rf(this, !1), tf(this, this.copiedParts, !1)) : lf(this), Bf(this,
a.lastInput.documentPoint))
}
};
Re.prototype.doMouseUp = function () {
if (this.isActive) {
var a = this.diagram, b = a.lastInput;
if (!this.simulatedMouseUp(b.event, null, b.documentPoint, b.targetDiagram)) {
var c = !1;
(b = this.mayCopy()) && null !== this.copiedParts ? (lf(this), rf(this, !0), cf(a, this.copiedParts), tf(this, this.copiedParts, !1), hf(a, this.copiedParts), null !== this.copiedParts && a.Iv(this.copiedParts.Yd())) : (c = !0, lf(this), this.mayMove() && (tf(this, this.draggedParts, !0), Bf(this, a.lastInput.documentPoint)));
this.yn = !0;
Hf(this, a.lastInput.documentPoint);
if (this.isActive) {
var d = b ? this.copiedParts.Yd() : this.draggedParts.Yd();
this.copiedParts = null;
if (c && null !== this.draggedParts) for (c = this.draggedParts.iterator; c.next();) {
var e = c.key;
e instanceof V && (e = e.containingGroup, null === e || null === e.placeholder || this.draggedParts.contains(e) || e.placeholder.s())
}
a.Xa();
hf(a, this.draggedParts);
this.transactionResult = b ? "Copy" : "Move";
a.aa(b ? "SelectionCopied" : "SelectionMoved", d)
}
this.stopTool()
}
}
};
Re.prototype.simulatedMouseMove = function (a, b, c) {
if (null === $e) return !1;
var d = $e.diagram;
c instanceof P || (c = null);
var e = df;
c !== e && (null !== e && e !== d && (e.xf(), $e.isDragOutStarted = !1, e = e.toolManager.findTool("Dragging"), null !== e && e.doSimulatedDragLeave()), df = c, null !== c && c !== d && (of(), e = c.toolManager.findTool("Dragging"), null !== e && (jf.contains(e) || jf.add(e), e.doSimulatedDragEnter())));
if (null === c || c === d || !c.allowDrop || c.isReadOnly || !c.allowInsert) return !1;
d = c.toolManager.findTool("Dragging");
null !== d && (null !==
a ? (void 0 !== a.targetTouches && (0 < a.targetTouches.length ? a = a.targetTouches[0] : 0 < a.changedTouches.length && (a = a.changedTouches[0])), b = c.getMouse(a)) : null === b && (b = new G), c.lastInput.documentPoint = b, c.lastInput.viewPoint = c.xt(b), c.lastInput.down = !1, c.lastInput.up = !1, d.doSimulatedDragOver());
return !0
};
Re.prototype.simulatedMouseUp = function (a, b, c, d) {
if (null === $e) return !1;
null === d && (d = b);
b = df;
var e = $e.diagram;
if (null === d) return $e.doCancel(), !0;
if (d !== b) {
var f = b.toolManager.findTool("Dragging");
if (null !== b && b !== e && null !== f) return b.xf(), $e.isDragOutStarted = !1, f.doSimulatedDragLeave(), !1;
df = d;
b = d.toolManager.findTool("Dragging");
null !== d && null !== b && (of(), jf.contains(b) || jf.add(b), b.doSimulatedDragEnter())
}
return d !== this.diagram ? (null !== a ? (void 0 !== a.targetTouches && (0 < a.targetTouches.length ? a = a.targetTouches[0] :
0 < a.changedTouches.length && (a = a.changedTouches[0])), c = d.getMouse(a)) : null === c && (c = new G), d.lastInput.documentPoint = c, d.lastInput.viewPoint = d.xt(c), d.lastInput.down = !1, d.lastInput.up = !0, a = d.toolManager.findTool("Dragging"), null !== a && a.doSimulatedDrop(), a = $e, null !== a && (d = a.mayCopy(), a.transactionResult = d ? "Copy" : "Move", a.stopTool()), !0) : !1
};
Re.prototype.mayCopy = function () {
if (!this.isCopyEnabled) return !1;
var a = this.diagram;
if (a.isReadOnly || a.isModelReadOnly || !a.allowInsert || !a.allowCopy || (Wa ? !a.lastInput.alt : !a.lastInput.control)) return !1;
for (a = a.selection.iterator; a.next();) {
var b = a.value;
if (b.bc() && b.canCopy()) return !0
}
return null !== this.draggedLink && this.dragsLink && this.draggedLink.canCopy() ? !0 : !1
};
Re.prototype.mayDragOut = function () {
if (!this.isCopyEnabled) return !1;
var a = this.diagram;
if (!a.allowDragOut || !a.allowCopy || a.allowMove) return !1;
for (a = a.selection.iterator; a.next();) {
var b = a.value;
if (b.bc() && b.canCopy()) return !0
}
return null !== this.draggedLink && this.dragsLink && this.draggedLink.canCopy() ? !0 : !1
};
Re.prototype.mayMove = function () {
var a = this.diagram;
if (a.isReadOnly || !a.allowMove) return !1;
for (a = a.selection.iterator; a.next();) {
var b = a.value;
if (b.bc() && b.canMove()) return !0
}
return null !== this.draggedLink && this.dragsLink && this.draggedLink.canMove() ? !0 : !1
};
Re.prototype.computeBorder = function (a, b, c) {
return this.yn || null === this.draggedParts || this.draggedParts.contains(a) ? null : c.assign(b)
};
Re.prototype.Yy = function () {
return $e
};
Re.prototype.mayDragIn = function () {
var a = this.diagram;
if (!a.allowDrop || a.isReadOnly || a.isModelReadOnly || !a.allowInsert) return !1;
var b = $e;
return null === b || b.diagram.model.dataFormat !== a.model.dataFormat ? !1 : !0
};
Re.prototype.doSimulatedDragEnter = function () {
if (this.mayDragIn()) {
var a = this.diagram;
a.animationManager.vd();
Lf(a);
a.animationManager.vd();
a = $e;
null !== a && (a.diagram.currentCursor = "copy", a.diagram.tk = !1)
}
};
Re.prototype.doSimulatedDragLeave = function () {
var a = $e;
null !== a && a.doSimulatedDragOut();
this.doCancel()
};
Re.prototype.doSimulatedDragOver = function () {
var a = this.diagram, b = $e;
null !== b && null !== b.draggedParts && this.mayDragIn() && (a.currentCursor = "copy", Mf(this, b.draggedParts.Yd(), !1, a.firstInput), tf(this, this.copiedParts, !1), Bf(this, a.lastInput.documentPoint))
};
Re.prototype.doSimulatedDrop = function () {
var a = this.diagram, b = $e;
if (null !== b) {
var c = b.diagram;
b.yn = !0;
lf(this);
this.mayDragIn() && (this.Aa("Drop"), Mf(this, b.draggedParts.Yd(), !0, a.lastInput), tf(this, this.copiedParts, !1), null !== this.copiedParts && a.Iv(this.copiedParts.Yd()), Hf(this, a.lastInput.documentPoint), a.Xa(), b = a.selection, null !== this.copiedParts ? this.transactionResult = "ExternalCopy" : b = new F, this.copiedParts = null, a.doFocus(), a.aa("ExternalObjectsDropped", b, c), this.zg())
}
};
function Mf(a, b, c, d) {
if (null === a.copiedParts) {
var e = a.diagram;
if (!e.isReadOnly && !e.isModelReadOnly) {
e.skipsUndoManager = !c;
e.partManager.addsToTemporaryLayer = !c;
a.startPoint = d.documentPoint;
c = e.Zj(b, e, !0);
var f = N.alloc();
qf(b, f);
d = f.x + f.width / 2;
e = f.y + f.height / 2;
N.free(f);
f = a.ys;
var g = new vb, h = G.alloc();
for (b = b.iterator; b.next();) {
var k = b.value, l = c.J(k);
k.bc() && k.canCopy() ? (k = k.location, h.h(f.x - (d - k.x), f.y - (e - k.y)), l.location = h, l.$b(), g.add(l, a.pd(h))) : l instanceof R && k.canCopy() && (sf(l, f.x - d, f.y - e),
g.add(l, a.pd()))
}
G.free(h);
a.copiedParts = g;
af(a, g.Yd());
null !== a.draggedLink && (c = a.draggedLink, d = c.routeBounds, sf(c, a.startPoint.x - (d.x + d.width / 2), a.startPoint.y - (d.y + d.height / 2)))
}
}
}
Re.prototype.doSimulatedDragOut = function () {
var a = this.diagram;
a.tk = !1;
this.mayCopy() || this.mayMove() ? a.currentCursor = "" : a.currentCursor = "no-drop"
};
Re.prototype.computeMove = function (a, b, c, d) {
c = this.diagram;
return null !== c ? c.computeMove(a, b, this.dragOptions, d) : new G
};
ma.Object.defineProperties(Re.prototype, {
isCopyEnabled: {
get: function () {
return this.Kc
}, set: function (a) {
this.Kc = a
}
}, copiesEffectiveCollection: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, dragOptions: {
get: function () {
return this.La
}, set: function (a) {
this.La = a
}
}, isGridSnapEnabled: {
get: function () {
return this.dragOptions.isGridSnapEnabled
}, set: function (a) {
this.dragOptions.isGridSnapEnabled =
a
}
}, isComplexRoutingRealtime: {
get: function () {
return this.Vb
}, set: function (a) {
this.Vb = a
}
}, isGridSnapRealtime: {
get: function () {
return this.dragOptions.isGridSnapRealtime
}, set: function (a) {
this.dragOptions.isGridSnapRealtime = a
}
}, gridSnapCellSize: {
get: function () {
return this.dragOptions.gridSnapCellSize
}, set: function (a) {
null === this.diagram || this.dragOptions.gridSnapCellSize.A(a) || (a = a.I(), this.dragOptions.gridSnapCellSize =
a)
}
}, gridSnapCellSpot: {
get: function () {
return this.dragOptions.gridSnapCellSpot
}, set: function (a) {
this.dragOptions.gridSnapCellSpot.A(a) || (a = a.I(), this.dragOptions.gridSnapCellSpot = a)
}
}, gridSnapOrigin: {
get: function () {
return this.dragOptions.gridSnapOrigin
}, set: function (a) {
this.dragOptions.gridSnapOrigin.A(a) || (a = a.I(), this.dragOptions.gridSnapOrigin = a)
}
}, dragsLink: {
get: function () {
return this.dragOptions.dragsLink
},
set: function (a) {
this.dragOptions.dragsLink = a
}
}, dragsTree: {
get: function () {
return this.dragOptions.dragsTree
}, set: function (a) {
this.dragOptions.dragsTree = a
}
}, currentPart: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}, copiedParts: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, draggedParts: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma = a
}
}, draggingParts: {
get: function () {
return null !== this.copiedParts ? this.copiedParts.Yd() : null !== this.draggedParts ? this.draggedParts.Yd() : this.Ag
}
}, draggedLink: {
get: function () {
return this.diagram.draggedLink
}, set: function (a) {
this.diagram.draggedLink = a
}
}, isDragOutStarted: {
get: function () {
return this.Vc
}, set: function (a) {
this.Vc = a
}
}, startPoint: {
get: function () {
return this.ys
}, set: function (a) {
this.ys.A(a) || this.ys.assign(a)
}
},
delay: {
get: function () {
return this.Sk
}, set: function (a) {
this.Sk = a
}
}
});
Re.prototype.getDraggingSource = Re.prototype.Yy;
var jf = null, $e = null, df = null;
Re.className = "DraggingTool";
jf = new E;
Ma("draggingTool", function () {
return this.findTool("Dragging")
}, function (a) {
Pe(this, "Dragging", a, this.mouseMoveTools)
});
Na.prototype.doCancel = function () {
null !== $e && $e.doCancel();
Ee.prototype.doCancel.call(this)
};
function Nf() {
Ee.call(this);
this.Ag = 100;
this.ba = !1;
var a = new R, b = new W;
b.isPanelMain = !0;
b.stroke = "blue";
a.add(b);
b = new W;
b.toArrow = "Standard";
b.fill = "blue";
b.stroke = "blue";
a.add(b);
a.layerName = "Tool";
this.Hm = a;
a = new V;
b = new W;
b.portId = "";
b.figure = "Rectangle";
b.fill = null;
b.stroke = "magenta";
b.strokeWidth = 2;
b.desiredSize = Lb;
a.add(b);
a.selectable = !1;
a.layerName = "Tool";
this.Fm = a;
this.Gm = b;
a = new V;
b = new W;
b.portId = "";
b.figure = "Rectangle";
b.fill = null;
b.stroke = "magenta";
b.strokeWidth = 2;
b.desiredSize = Lb;
a.add(b);
a.selectable = !1;
a.layerName = "Tool";
this.Aq = a;
this.Bq = b;
this.Vc = this.Kc = this.Ma = this.La = this.Vb = null;
this.K = !0;
this.Px = new vb;
this.Dm = this.ki = this.Em = null
}
la(Nf, Ee);
Nf.prototype.doStop = function () {
this.diagram.xf();
this.originalToPort = this.originalToNode = this.originalFromPort = this.originalFromNode = this.originalLink = null;
this.validPortsCache.clear();
this.targetPort = null
};
Nf.prototype.copyPortProperties = function (a, b, c, d, e) {
if (null !== a && null !== b && null !== c && null !== d) {
var f = b.De(), g = M.alloc();
g.width = b.naturalBounds.width * f;
g.height = b.naturalBounds.height * f;
d.desiredSize = g;
M.free(g);
e ? (d.toSpot = b.toSpot, d.toEndSegmentLength = b.toEndSegmentLength) : (d.fromSpot = b.fromSpot, d.fromEndSegmentLength = b.fromEndSegmentLength);
c.locationSpot = Fc;
f = G.alloc();
c.location = b.ma(Fc, f);
G.free(f);
d.angle = b.Mi();
null !== this.portTargeted && this.portTargeted(a, b, c, d, e)
}
};
Nf.prototype.setNoTargetPortProperties = function (a, b, c) {
null !== b && (b.desiredSize = Lb, b.fromSpot = yc, b.toSpot = yc);
null !== a && (a.location = this.diagram.lastInput.documentPoint);
null !== this.portTargeted && this.portTargeted(null, null, a, b, c)
};
Nf.prototype.doMouseDown = function () {
this.isActive && this.doMouseMove()
};
Nf.prototype.doMouseMove = function () {
if (this.isActive) {
var a = this.diagram;
this.targetPort = this.findTargetPort(this.isForwards);
if (null !== this.targetPort && this.targetPort.part instanceof V) {
var b = this.targetPort.part;
this.isForwards ? this.copyPortProperties(b, this.targetPort, this.temporaryToNode, this.temporaryToPort, !0) : this.copyPortProperties(b, this.targetPort, this.temporaryFromNode, this.temporaryFromPort, !1)
} else this.isForwards ? this.setNoTargetPortProperties(this.temporaryToNode, this.temporaryToPort,
!0) : this.setNoTargetPortProperties(this.temporaryFromNode, this.temporaryFromPort, !1);
(a.allowHorizontalScroll || a.allowVerticalScroll) && a.Os(a.lastInput.viewPoint)
}
};
Nf.prototype.findValidLinkablePort = function (a, b) {
if (null === a) return null;
var c = a.part;
if (!(c instanceof V)) return null;
for (; null !== a;) {
var d = b ? a.toLinkable : a.fromLinkable;
if (!0 === d && (null !== a.portId || a instanceof V) && (b ? this.isValidTo(c, a) : this.isValidFrom(c, a))) return a;
if (!1 === d) break;
a = a.panel
}
return null
};
Nf.prototype.findTargetPort = function (a) {
var b = this.diagram, c = b.lastInput.documentPoint, d = this.portGravity;
0 >= d && (d = .1);
var e = this, f = b.rg(c, d, function (b) {
return e.findValidLinkablePort(b, a)
}, null, !0);
d = Infinity;
b = null;
for (f = f.iterator; f.next();) {
var g = f.value, h = g.part;
if (h instanceof V) {
var k = g.ma(Fc, G.alloc()), l = c.x - k.x, m = c.y - k.y;
G.free(k);
k = l * l + m * m;
k < d && (l = this.validPortsCache.J(g), null !== l ? l && (b = g, d = k) : a && this.isValidLink(this.originalFromNode, this.originalFromPort, h, g) || !a && this.isValidLink(h,
g, this.originalToNode, this.originalToPort) ? (this.validPortsCache.add(g, !0), b = g, d = k) : this.validPortsCache.add(g, !1))
}
}
return null !== b && (c = b.part, c instanceof V && (null === c.layer || c.layer.allowLink)) ? b : null
};
Nf.prototype.isValidFrom = function (a, b) {
if (null === a || null === b) return this.isUnconnectedLinkValid;
if (this.diagram.currentTool === this && (null !== a.layer && !a.layer.allowLink || !0 !== b.fromLinkable)) return !1;
var c = b.fromMaxLinks;
if (Infinity > c) {
if (null !== this.originalLink && a === this.originalFromNode && b === this.originalFromPort) return !0;
b = b.portId;
null === b && (b = "");
if (a.Wp(b).count >= c) return !1
}
return !0
};
Nf.prototype.isValidTo = function (a, b) {
if (null === a || null === b) return this.isUnconnectedLinkValid;
if (this.diagram.currentTool === this && (null !== a.layer && !a.layer.allowLink || !0 !== b.toLinkable)) return !1;
var c = b.toMaxLinks;
if (Infinity > c) {
if (null !== this.originalLink && a === this.originalToNode && b === this.originalToPort) return !0;
b = b.portId;
null === b && (b = "");
if (a.sd(b).count >= c) return !1
}
return !0
};
Nf.prototype.isInSameNode = function (a, b) {
if (null === a || null === b) return !1;
if (a === b) return !0;
a = a.part;
b = b.part;
return null !== a && a === b
};
Nf.prototype.isLinked = function (a, b) {
if (null === a || null === b) return !1;
var c = a.part;
if (!(c instanceof V)) return !1;
a = a.portId;
null === a && (a = "");
var d = b.part;
if (!(d instanceof V)) return !1;
b = b.portId;
null === b && (b = "");
for (b = d.sd(b); b.next();) if (d = b.value, d.fromNode === c && d.fromPortId === a) return !0;
return !1
};
Nf.prototype.isValidLink = function (a, b, c, d) {
if (!this.isValidFrom(a, b) || !this.isValidTo(c, d) || !(null === b || null === d || (b.fromLinkableSelfNode && d.toLinkableSelfNode || !this.isInSameNode(b, d)) && (b.fromLinkableDuplicates && d.toLinkableDuplicates || !this.isLinked(b, d))) || null !== this.originalLink && (null !== a && this.isLabelDependentOnLink(a, this.originalLink) || null !== c && this.isLabelDependentOnLink(c, this.originalLink)) || null !== a && null !== c && (null === a.data && null !== c.data || null !== a.data && null === c.data) || !this.isValidCycle(a,
c, this.originalLink)) return !1;
if (null !== a) {
var e = a.linkValidation;
if (null !== e && !e(a, b, c, d, this.originalLink)) return !1
}
if (null !== c && (e = c.linkValidation, null !== e && !e(a, b, c, d, this.originalLink))) return !1;
e = this.linkValidation;
return null !== e ? e(a, b, c, d, this.originalLink) : !0
};
Nf.prototype.isLabelDependentOnLink = function (a, b) {
if (null === a) return !1;
var c = a.labeledLink;
if (null === c) return !1;
if (c === b) return !0;
var d = new F;
d.add(a);
return Of(this, c, b, d)
};
function Of(a, b, c, d) {
if (b === c) return !0;
var e = b.fromNode;
if (null !== e && e.isLinkLabel && (d.add(e), Of(a, e.labeledLink, c, d))) return !0;
b = b.toNode;
return null !== b && b.isLinkLabel && (d.add(b), Of(a, b.labeledLink, c, d)) ? !0 : !1
}
Nf.prototype.isValidCycle = function (a, b, c) {
void 0 === c && (c = null);
if (null === a || null === b) return this.isUnconnectedLinkValid;
var d = this.diagram.validCycle;
if (d !== Pf) {
if (d === Qf) {
d = c || this.temporaryLink;
if (null !== d && !d.isTreeLink) return !0;
for (d = b.linksConnected; d.next();) {
var e = d.value;
if (e !== c && e.isTreeLink && e.toNode === b) return !1
}
return !Rf(this, a, b, c, !0)
}
if (d === Sf) {
d = c || this.temporaryLink;
if (null !== d && !d.isTreeLink) return !0;
for (d = a.linksConnected; d.next();) if (e = d.value, e !== c && e.isTreeLink && e.fromNode ===
a) return !1;
return !Rf(this, a, b, c, !0)
}
if (d === Tf) return a === b ? a = !0 : (d = new F, d.add(b), a = Uf(this, d, a, b, c)), !a;
if (d === Vf) return !Rf(this, a, b, c, !1);
if (d === Wf) return a === b ? a = !0 : (d = new F, d.add(b), a = jg(this, d, a, b, c)), !a
}
return !0
};
function Rf(a, b, c, d, e) {
if (b === c) return !0;
if (null === b || null === c) return !1;
for (var f = b.linksConnected; f.next();) {
var g = f.value;
if (g !== d && (!e || g.isTreeLink) && g.toNode === b && (g = g.fromNode, g !== b && Rf(a, g, c, d, e))) return !0
}
return !1
}
function Uf(a, b, c, d, e) {
if (c === d) return !0;
if (null === c || null === d || b.contains(c)) return !1;
b.add(c);
for (var f = c.linksConnected; f.next();) {
var g = f.value;
if (g !== e && g.toNode === c && (g = g.fromNode, g !== c && Uf(a, b, g, d, e))) return !0
}
return !1
}
function jg(a, b, c, d, e) {
if (c === d) return !0;
if (null === c || null === d || b.contains(c)) return !1;
b.add(c);
for (var f = c.linksConnected; f.next();) {
var g = f.value;
if (g !== e) {
var h = g.fromNode;
g = g.toNode;
h = h === c ? g : h;
if (h !== c && jg(a, b, h, d, e)) return !0
}
}
return !1
}
ma.Object.defineProperties(Nf.prototype, {
portGravity: {
get: function () {
return this.Ag
}, set: function (a) {
0 <= a && (this.Ag = a)
}
}, isUnconnectedLinkValid: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}, temporaryLink: {
get: function () {
return this.Hm
}, set: function (a) {
this.Hm = a
}
}, temporaryFromNode: {
get: function () {
return this.Fm
}, set: function (a) {
this.Fm = a
}
}, temporaryFromPort: {
get: function () {
return this.Gm
}, set: function (a) {
this.Gm = a
}
}, temporaryToNode: {
get: function () {
return this.Aq
}, set: function (a) {
this.Aq = a
}
}, temporaryToPort: {
get: function () {
return this.Bq
}, set: function (a) {
this.Bq = a
}
}, originalLink: {
get: function () {
return this.Vb
}, set: function (a) {
this.Vb = a
}
}, originalFromNode: {
get: function () {
return this.La
}, set: function (a) {
this.La = a
}
}, originalFromPort: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma = a
}
}, originalToNode: {
get: function () {
return this.Kc
}, set: function (a) {
this.Kc = a
}
}, originalToPort: {
get: function () {
return this.Vc
}, set: function (a) {
this.Vc = a
}
}, isForwards: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, validPortsCache: {
get: function () {
return this.Px
}
}, targetPort: {
get: function () {
return this.Em
}, set: function (a) {
this.Em = a
}
}, linkValidation: {
get: function () {
return this.ki
}, set: function (a) {
this.ki = a
}
}, portTargeted: {
get: function () {
return this.Dm
}, set: function (a) {
this.Dm = a
}
}
});
Nf.className = "LinkingBaseTool";
function kg() {
Nf.call(this);
this.name = "Linking";
this.u = {};
this.l = null;
this.L = lg;
this.Eh = null
}
la(kg, Nf);
kg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly || !a.allowLink || !a.model.dt() || !a.lastInput.left || a.currentTool !== this && !this.isBeyondDragSize() ? !1 : null !== this.findLinkablePort()
};
kg.prototype.findLinkablePort = function () {
var a = this.diagram, b = this.startObject;
null === b && (b = a.Rb(a.firstInput.documentPoint, null, null));
if (null === b || !(b.part instanceof V)) return null;
a = this.direction;
if (a === lg || a === mg) {
var c = this.findValidLinkablePort(b, !1);
if (null !== c) return this.isForwards = !0, c
}
if (a === lg || a === ng) if (b = this.findValidLinkablePort(b, !0), null !== b) return this.isForwards = !1, b;
return null
};
kg.prototype.doActivate = function () {
var a = this.diagram, b = this.findLinkablePort();
null !== b && (this.Aa(this.name), a.isMouseCaptured = !0, a.currentCursor = "pointer", this.isForwards ? (null === this.temporaryToNode || this.temporaryToNode.location.o() || (this.temporaryToNode.location = a.lastInput.documentPoint), this.originalFromPort = b, b = this.originalFromPort.part, b instanceof V && (this.originalFromNode = b), this.copyPortProperties(this.originalFromNode, this.originalFromPort, this.temporaryFromNode, this.temporaryFromPort,
!1)) : (null === this.temporaryFromNode || this.temporaryFromNode.location.o() || (this.temporaryFromNode.location = a.lastInput.documentPoint), this.originalToPort = b, b = this.originalToPort.part, b instanceof V && (this.originalToNode = b), this.copyPortProperties(this.originalToNode, this.originalToPort, this.temporaryToNode, this.temporaryToPort, !0)), a.add(this.temporaryFromNode), a.add(this.temporaryToNode), null !== this.temporaryLink && (null !== this.temporaryFromNode && (this.temporaryLink.fromNode = this.temporaryFromNode),
null !== this.temporaryToNode && (this.temporaryLink.toNode = this.temporaryToNode), this.temporaryLink.isTreeLink = this.isNewTreeLink(), this.temporaryLink.Ra(), a.add(this.temporaryLink)), this.isActive = !0)
};
kg.prototype.doDeactivate = function () {
this.isActive = !1;
var a = this.diagram;
a.remove(this.temporaryLink);
a.remove(this.temporaryFromNode);
a.remove(this.temporaryToNode);
a.isMouseCaptured = !1;
a.currentCursor = "";
this.zg()
};
kg.prototype.doStop = function () {
Nf.prototype.doStop.call(this);
this.startObject = null
};
kg.prototype.doMouseUp = function () {
if (this.isActive) {
var a = this.diagram, b = this.transactionResult = null, c = null, d = null, e = null,
f = this.targetPort = this.findTargetPort(this.isForwards);
if (null !== f) {
var g = f.part;
g instanceof V && (this.isForwards ? (null !== this.originalFromNode && (b = this.originalFromNode, c = this.originalFromPort), d = g, e = f) : (b = g, c = f, null !== this.originalToNode && (d = this.originalToNode, e = this.originalToPort)))
} else this.isForwards ? null !== this.originalFromNode && this.isUnconnectedLinkValid && (b = this.originalFromNode,
c = this.originalFromPort) : null !== this.originalToNode && this.isUnconnectedLinkValid && (d = this.originalToNode, e = this.originalToPort);
null !== b || null !== d ? (g = this.insertLink(b, c, d, e), null !== g ? (null === f && (this.isForwards ? g.defaultToPoint = a.lastInput.documentPoint : g.defaultFromPoint = a.lastInput.documentPoint), a.allowSelect && a.select(g), this.transactionResult = this.name, a.aa("LinkDrawn", g)) : (a.model.Nu(), this.doNoLink(b, c, d, e))) : this.isForwards ? this.doNoLink(this.originalFromNode, this.originalFromPort, null, null) :
this.doNoLink(null, null, this.originalToNode, this.originalToPort)
}
this.stopTool()
};
kg.prototype.isNewTreeLink = function () {
var a = this.archetypeLinkData;
if (null === a) return !0;
if (a instanceof R) return a.isTreeLink;
var b = this.diagram;
if (null === b) return !0;
a = b.partManager.getLinkCategoryForData(a);
b = b.partManager.findLinkTemplateForCategory(a);
return null !== b ? b.isTreeLink : !0
};
kg.prototype.insertLink = function (a, b, c, d) {
return this.diagram.partManager.insertLink(a, b, c, d)
};
kg.prototype.doNoLink = function () {
};
ma.Object.defineProperties(kg.prototype, {
archetypeLinkData: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, archetypeLabelNodeData: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}, direction: {
get: function () {
return this.L
}, set: function (a) {
this.L = a
}
}, startObject: {
get: function () {
return this.Eh
}, set: function (a) {
this.Eh = a
}
}
});
var lg = new D(kg, "Either", 0), mg = new D(kg, "ForwardsOnly", 0), ng = new D(kg, "BackwardsOnly", 0);
kg.className = "LinkingTool";
kg.Either = lg;
kg.ForwardsOnly = mg;
kg.BackwardsOnly = ng;
function ef() {
Nf.call(this);
this.name = "Relinking";
var a = new W;
a.figure = "Diamond";
a.desiredSize = Ob;
a.fill = "lightblue";
a.stroke = "dodgerblue";
a.cursor = "pointer";
a.segmentIndex = 0;
this.u = a;
a = new W;
a.figure = "Diamond";
a.desiredSize = Ob;
a.fill = "lightblue";
a.stroke = "dodgerblue";
a.cursor = "pointer";
a.segmentIndex = -1;
this.Eh = a;
this.l = null;
this.Gw = new N
}
la(ef, Nf);
ef.prototype.updateAdornments = function (a) {
if (null !== a && a instanceof R) {
var b = "RelinkFrom", c = null;
if (a.isSelected && !this.diagram.isReadOnly) {
var d = a.selectionObject;
null !== d && a.canRelinkFrom() && a.actualBounds.o() && a.isVisible() && d.actualBounds.o() && d.tf() && (c = a.bk(b), null === c && (c = this.makeAdornment(d, !1), a.rh(b, c)))
}
null === c && a.vf(b);
b = "RelinkTo";
c = null;
a.isSelected && !this.diagram.isReadOnly && (d = a.selectionObject, null !== d && a.canRelinkTo() && a.actualBounds.o() && a.isVisible() && d.actualBounds.o() && d.tf() &&
(c = a.bk(b), null === c ? (c = this.makeAdornment(d, !0), a.rh(b, c)) : c.s()));
null === c && a.vf(b)
}
};
ef.prototype.makeAdornment = function (a, b) {
var c = new Je;
c.type = X.Link;
b = b ? this.toHandleArchetype : this.fromHandleArchetype;
null !== b && c.add(b.copy());
c.adornedObject = a;
return c
};
ef.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (a.isReadOnly || a.isModelReadOnly || !a.allowRelink || !a.model.dt() || !a.lastInput.left) return !1;
var b = this.findToolHandleAt(a.firstInput.documentPoint, "RelinkFrom");
null === b && (b = this.findToolHandleAt(a.firstInput.documentPoint, "RelinkTo"));
return null !== b
};
ef.prototype.doActivate = function () {
var a = this.diagram;
if (null === this.originalLink) {
var b = this.handle;
null === b && (b = this.findToolHandleAt(a.firstInput.documentPoint, "RelinkFrom"), null === b && (b = this.findToolHandleAt(a.firstInput.documentPoint, "RelinkTo")));
if (null === b) return;
var c = b.part;
if (!(c instanceof Je && c.adornedPart instanceof R)) return;
this.handle = b;
this.isForwards = null === c || "RelinkTo" === c.category;
this.originalLink = c.adornedPart
}
this.Aa(this.name);
a.isMouseCaptured = !0;
a.currentCursor = "pointer";
this.originalFromPort = this.originalLink.fromPort;
this.originalFromNode = this.originalLink.fromNode;
this.originalToPort = this.originalLink.toPort;
this.originalToNode = this.originalLink.toNode;
this.Gw.set(this.originalLink.actualBounds);
null !== this.originalLink && 0 < this.originalLink.pointsCount && (null === this.originalLink.fromNode && (null !== this.temporaryFromPort && (this.temporaryFromPort.desiredSize = Kb), null !== this.temporaryFromNode && (this.temporaryFromNode.location = this.originalLink.i(0))), null === this.originalLink.toNode &&
(null !== this.temporaryToPort && (this.temporaryToPort.desiredSize = Kb), null !== this.temporaryToNode && (this.temporaryToNode.location = this.originalLink.i(this.originalLink.pointsCount - 1))));
this.copyPortProperties(this.originalFromNode, this.originalFromPort, this.temporaryFromNode, this.temporaryFromPort, !1);
this.copyPortProperties(this.originalToNode, this.originalToPort, this.temporaryToNode, this.temporaryToPort, !0);
a.add(this.temporaryFromNode);
a.add(this.temporaryToNode);
null !== this.temporaryLink && (null !==
this.temporaryFromNode && (this.temporaryLink.fromNode = this.temporaryFromNode), null !== this.temporaryToNode && (this.temporaryLink.toNode = this.temporaryToNode), this.copyLinkProperties(this.originalLink, this.temporaryLink), this.temporaryLink.Ra(), a.add(this.temporaryLink));
this.isActive = !0
};
ef.prototype.copyLinkProperties = function (a, b) {
if (null !== a && null !== b) {
b.adjusting = a.adjusting;
b.corner = a.corner;
var c = a.curve;
if (c === og || c === pg) c = qg;
b.curve = c;
b.curviness = a.curviness;
b.isTreeLink = a.isTreeLink;
b.points = a.points;
b.routing = a.routing;
b.smoothness = a.smoothness;
b.fromSpot = a.fromSpot;
b.fromEndSegmentLength = a.fromEndSegmentLength;
b.fromShortLength = a.fromShortLength;
b.toSpot = a.toSpot;
b.toEndSegmentLength = a.toEndSegmentLength;
b.toShortLength = a.toShortLength
}
};
ef.prototype.doDeactivate = function () {
this.isActive = !1;
var a = this.diagram;
a.remove(this.temporaryLink);
a.remove(this.temporaryFromNode);
a.remove(this.temporaryToNode);
a.isMouseCaptured = !1;
a.currentCursor = "";
this.zg()
};
ef.prototype.doStop = function () {
Nf.prototype.doStop.call(this);
this.handle = null
};
ef.prototype.doMouseUp = function () {
if (this.isActive) {
var a = this.diagram;
this.transactionResult = null;
var b = this.originalFromNode, c = this.originalFromPort, d = this.originalToNode, e = this.originalToPort,
f = this.originalLink;
this.targetPort = this.findTargetPort(this.isForwards);
if (null !== this.targetPort) {
var g = this.targetPort.part;
g instanceof V && (this.isForwards ? (d = g, e = this.targetPort) : (b = g, c = this.targetPort))
} else this.isUnconnectedLinkValid ? this.isForwards ? e = d = null : c = b = null : f = null;
null !== f ? (this.reconnectLink(f,
this.isForwards ? d : b, this.isForwards ? e : c, this.isForwards), null === this.targetPort && (this.isForwards ? f.defaultToPoint = a.lastInput.documentPoint : f.defaultFromPoint = a.lastInput.documentPoint, f.Ra()), a.allowSelect && (f.isSelected = !0), this.transactionResult = this.name, a.aa("LinkRelinked", f, this.isForwards ? this.originalToPort : this.originalFromPort)) : this.doNoRelink(this.originalLink, this.isForwards);
this.originalLink.eq(this.Gw)
}
this.stopTool()
};
ef.prototype.reconnectLink = function (a, b, c, d) {
c = null !== c && null !== c.portId ? c.portId : "";
d ? (a.toNode = b, a.toPortId = c) : (a.fromNode = b, a.fromPortId = c);
return !0
};
ef.prototype.doNoRelink = function () {
};
function Gf(a, b, c, d, e) {
null !== b ? (a.copyPortProperties(b, c, a.temporaryFromNode, a.temporaryFromPort, !1), a.diagram.add(a.temporaryFromNode)) : a.diagram.remove(a.temporaryFromNode);
null !== d ? (a.copyPortProperties(d, e, a.temporaryToNode, a.temporaryToPort, !0), a.diagram.add(a.temporaryToNode)) : a.diagram.remove(a.temporaryToNode)
}
ma.Object.defineProperties(ef.prototype, {
fromHandleArchetype: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, toHandleArchetype: {
get: function () {
return this.Eh
}, set: function (a) {
this.Eh = a
}
}, handle: {
get: function () {
return this.l
}, set: function (a) {
if (null !== a && !(a.part instanceof Je)) throw Error("new handle is not in an Adornment: " + a);
this.l = a
}
}
});
ef.className = "RelinkingTool";
Ma("linkingTool", function () {
return this.findTool("Linking")
}, function (a) {
Pe(this, "Linking", a, this.mouseMoveTools)
});
Ma("relinkingTool", function () {
return this.findTool("Relinking")
}, function (a) {
Pe(this, "Relinking", a, this.mouseDownTools)
});
function rg() {
Ee.call(this);
this.name = "LinkReshaping";
var a = new W;
a.figure = "Rectangle";
a.desiredSize = Mb;
a.fill = "lightblue";
a.stroke = "dodgerblue";
this.u = a;
a = new W;
a.figure = "Diamond";
a.desiredSize = Ob;
a.fill = "lightblue";
a.stroke = "dodgerblue";
a.cursor = "move";
this.K = a;
this.ba = 3;
this.Ht = this.l = null;
this.vl = new G;
this.fs = new E
}
la(rg, Ee);
rg.prototype.fv = function (a) {
return a && a.ls && 0 !== a.ls.value ? a.ls : sg
};
rg.prototype.xm = function (a, b) {
a.ls = b
};
rg.prototype.updateAdornments = function (a) {
if (null !== a && a instanceof R) {
var b = null;
if (a.isSelected && !this.diagram.isReadOnly) {
var c = a.path;
null !== c && a.canReshape() && a.actualBounds.o() && a.isVisible() && c.actualBounds.o() && c.tf() && (b = a.bk(this.name), null === b || b.Dw !== a.pointsCount || b.Ow !== a.resegmentable) && (b = this.makeAdornment(c), null !== b && (b.Dw = a.pointsCount, b.Ow = a.resegmentable, a.rh(this.name, b)))
}
null === b && a.vf(this.name)
}
};
rg.prototype.makeAdornment = function (a) {
var b = a.part, c = b.pointsCount, d = b.isOrthogonal, e = null;
if (null !== b.points && 1 < c) {
e = new Je;
e.type = X.Link;
c = b.firstPickIndex;
var f = b.lastPickIndex, g = d ? 1 : 0;
if (b.resegmentable && b.computeCurve() !== tg) for (var h = c + g; h < f - g; h++) {
var k = this.makeResegmentHandle(a, h);
null !== k && (k.segmentIndex = h, k.segmentFraction = .5, k.fromMaxLinks = 999, e.add(k))
}
for (g = c + 1; g < f; g++) if (h = this.makeHandle(a, g), null !== h) {
h.segmentIndex = g;
if (g !== c) if (g === c + 1 && d) {
k = b.i(c);
var l = b.i(c + 1);
H.w(k.x, l.x) &&
H.w(k.y, l.y) && (l = b.i(c - 1));
H.w(k.x, l.x) ? (this.xm(h, ug), h.cursor = "n-resize") : H.w(k.y, l.y) && (this.xm(h, vg), h.cursor = "w-resize")
} else g === f - 1 && d ? (k = b.i(f - 1), l = b.i(f), H.w(k.x, l.x) && H.w(k.y, l.y) && (k = b.i(f + 1)), H.w(k.x, l.x) ? (this.xm(h, ug), h.cursor = "n-resize") : H.w(k.y, l.y) && (this.xm(h, vg), h.cursor = "w-resize")) : g !== f && (this.xm(h, wg), h.cursor = "move");
e.add(h)
}
e.adornedObject = a
}
return e
};
rg.prototype.makeHandle = function () {
var a = this.handleArchetype;
return null === a ? null : a.copy()
};
rg.prototype.makeResegmentHandle = function () {
var a = this.midHandleArchetype;
return null === a ? null : a.copy()
};
rg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
return !a.isReadOnly && a.allowReshape && a.lastInput.left ? null !== this.findToolHandleAt(a.firstInput.documentPoint, this.name) : !1
};
rg.prototype.doActivate = function () {
var a = this.diagram;
null === this.handle && (this.handle = this.findToolHandleAt(a.firstInput.documentPoint, this.name));
if (null !== this.handle) {
var b = this.handle.part.adornedPart;
if (b instanceof R) {
this.Ht = b;
a.isMouseCaptured = !0;
this.Aa(this.name);
if (b.resegmentable && 999 === this.handle.fromMaxLinks) {
var c = b.points.copy(), d = this.getResegmentingPoint();
c.Ib(this.handle.segmentIndex + 1, d);
b.isOrthogonal && c.Ib(this.handle.segmentIndex + 1, d);
b.points = c;
b.Jb();
b.updateAdornments();
this.handle = this.findToolHandleAt(a.firstInput.documentPoint, this.name);
if (null === this.handle) {
this.doDeactivate();
return
}
}
this.vl = b.i(this.handle.segmentIndex);
this.fs = b.points.copy();
this.isActive = !0
}
}
};
rg.prototype.doDeactivate = function () {
this.zg();
this.Ht = this.handle = null;
this.isActive = this.diagram.isMouseCaptured = !1
};
rg.prototype.doCancel = function () {
var a = this.adornedLink;
null !== a && (a.points = this.fs);
this.stopTool()
};
rg.prototype.getResegmentingPoint = function () {
return this.handle.ma(Fc)
};
rg.prototype.doMouseMove = function () {
var a = this.diagram;
this.isActive && (a = this.computeReshape(a.lastInput.documentPoint), this.reshape(a))
};
rg.prototype.doMouseUp = function () {
var a = this.diagram;
if (this.isActive) {
var b = this.computeReshape(a.lastInput.documentPoint);
this.reshape(b);
b = this.adornedLink;
if (null !== b && b.resegmentable) {
var c = this.handle.segmentIndex, d = b.i(c - 1), e = b.i(c), f = b.i(c + 1);
if (b.isOrthogonal) {
if (c > b.firstPickIndex + 1 && c < b.lastPickIndex - 1) {
var g = b.i(c - 2);
if (Math.abs(d.x - e.x) < this.resegmentingDistance && Math.abs(d.y - e.y) < this.resegmentingDistance && (xg(this, g, d, e, f, !0) || xg(this, g, d, e, f, !1))) {
var h = b.points.copy();
xg(this, g, d,
e, f, !0) ? (h.gd(c - 2, new G(g.x, (f.y + g.y) / 2)), h.gd(c + 1, new G(f.x, (f.y + g.y) / 2))) : (h.gd(c - 2, new G((f.x + g.x) / 2, g.y)), h.gd(c + 1, new G((f.x + g.x) / 2, f.y)));
h.mb(c);
h.mb(c - 1);
b.points = h;
b.Jb()
} else g = b.i(c + 2), Math.abs(e.x - f.x) < this.resegmentingDistance && Math.abs(e.y - f.y) < this.resegmentingDistance && (xg(this, d, e, f, g, !0) || xg(this, d, e, f, g, !1)) && (h = b.points.copy(), xg(this, d, e, f, g, !0) ? (h.gd(c - 1, new G(d.x, (d.y + g.y) / 2)), h.gd(c + 2, new G(g.x, (d.y + g.y) / 2))) : (h.gd(c - 1, new G((d.x + g.x) / 2, d.y)), h.gd(c + 2, new G((d.x + g.x) / 2, g.y))),
h.mb(c + 1), h.mb(c), b.points = h, b.Jb())
}
} else g = G.alloc(), H.Ti(d.x, d.y, f.x, f.y, e.x, e.y, g) && g.Ce(e) < this.resegmentingDistance * this.resegmentingDistance && (d = b.points.copy(), d.mb(c), b.points = d, b.Jb()), G.free(g)
}
a.Xa();
this.transactionResult = this.name;
a.aa("LinkReshaped", this.adornedLink, this.fs)
}
this.stopTool()
};
function xg(a, b, c, d, e, f) {
return f ? Math.abs(b.y - c.y) < a.resegmentingDistance && Math.abs(c.y - d.y) < a.resegmentingDistance && Math.abs(d.y - e.y) < a.resegmentingDistance : Math.abs(b.x - c.x) < a.resegmentingDistance && Math.abs(c.x - d.x) < a.resegmentingDistance && Math.abs(d.x - e.x) < a.resegmentingDistance
}
rg.prototype.reshape = function (a) {
var b = this.adornedLink;
b.Dh();
var c = this.handle.segmentIndex, d = this.fv(this.handle);
if (b.isOrthogonal) if (c === b.firstPickIndex + 1) c = b.firstPickIndex + 1, d === ug ? (b.M(c, b.i(c - 1).x, a.y), b.M(c + 1, b.i(c + 2).x, a.y)) : d === vg && (b.M(c, a.x, b.i(c - 1).y), b.M(c + 1, a.x, b.i(c + 2).y)); else if (c === b.lastPickIndex - 1) c = b.lastPickIndex - 1, d === ug ? (b.M(c - 1, b.i(c - 2).x, a.y), b.M(c, b.i(c + 1).x, a.y)) : d === vg && (b.M(c - 1, a.x, b.i(c - 2).y), b.M(c, a.x, b.i(c + 1).y)); else {
d = c;
var e = b.i(d), f = b.i(d - 1), g = b.i(d + 1);
H.w(f.x,
e.x) && H.w(e.y, g.y) ? (H.w(f.x, b.i(d - 2).x) && !H.w(f.y, b.i(d - 2).y) ? (b.m(d, a.x, f.y), c++, d++) : b.M(d - 1, a.x, f.y), H.w(g.y, b.i(d + 2).y) && !H.w(g.x, b.i(d + 2).x) ? b.m(d + 1, g.x, a.y) : b.M(d + 1, g.x, a.y)) : H.w(f.y, e.y) && H.w(e.x, g.x) ? (H.w(f.y, b.i(d - 2).y) && !H.w(f.x, b.i(d - 2).x) ? (b.m(d, f.x, a.y), c++, d++) : b.M(d - 1, f.x, a.y), H.w(g.x, b.i(d + 2).x) && !H.w(g.y, b.i(d + 2).y) ? b.m(d + 1, a.x, g.y) : b.M(d + 1, a.x, g.y)) : H.w(f.x, e.x) && H.w(e.x, g.x) ? (H.w(f.x, b.i(d - 2).x) && !H.w(f.y, b.i(d - 2).y) ? (b.m(d, a.x, f.y), c++, d++) : b.M(d - 1, a.x, f.y), H.w(g.x, b.i(d + 2).x) &&
!H.w(g.y, b.i(d + 2).y) ? b.m(d + 1, a.x, g.y) : b.M(d + 1, a.x, g.y)) : H.w(f.y, e.y) && H.w(e.y, g.y) && (H.w(f.y, b.i(d - 2).y) && !H.w(f.x, b.i(d - 2).x) ? (b.m(d, f.x, a.y), c++, d++) : b.M(d - 1, f.x, a.y), H.w(g.y, b.i(d + 2).y) && !H.w(g.x, b.i(d + 2).x) ? b.m(d + 1, g.x, a.y) : b.M(d + 1, g.x, a.y));
b.M(c, a.x, a.y)
} else b.M(c, a.x, a.y), d = b.fromNode, e = b.fromPort, null !== d && (f = d.findVisibleNode(), null !== f && f !== d && (d = f, e = d.port)), 1 === c && b.computeSpot(!0, e).jc() && (f = e.ma(Fc, G.alloc()), d = b.getLinkPointFromPoint(d, e, f, a, !0, G.alloc()), b.M(0, d.x, d.y), G.free(f),
G.free(d)), d = b.toNode, e = b.toPort, null !== d && (f = d.findVisibleNode(), null !== f && f !== d && (d = f, e = d.port)), c === b.pointsCount - 2 && b.computeSpot(!1, e).jc() && (c = e.ma(Fc, G.alloc()), a = b.getLinkPointFromPoint(d, e, c, a, !1, G.alloc()), b.M(b.pointsCount - 1, a.x, a.y), G.free(c), G.free(a));
b.mf()
};
rg.prototype.computeReshape = function (a) {
var b = this.adornedLink, c = this.handle.segmentIndex;
switch (this.fv(this.handle)) {
case wg:
return a;
case ug:
return new G(b.i(c).x, a.y);
case vg:
return new G(a.x, b.i(c).y);
default:
case sg:
return b.i(c)
}
};
ma.Object.defineProperties(rg.prototype, {
handleArchetype: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, midHandleArchetype: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, handle: {
get: function () {
return this.l
}, set: function (a) {
if (null !== a && !(a.part instanceof Je)) throw Error("new handle is not in an Adornment: " + a);
this.l = a
}
}, adornedLink: {
get: function () {
return this.Ht
}
},
resegmentingDistance: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}, originalPoint: {
get: function () {
return this.vl
}
}, originalPoints: {
get: function () {
return this.fs
}
}
});
rg.prototype.setReshapingBehavior = rg.prototype.xm;
rg.prototype.getReshapingBehavior = rg.prototype.fv;
var sg = new D(rg, "None", 0), vg = new D(rg, "Horizontal", 1), ug = new D(rg, "Vertical", 2),
wg = new D(rg, "All", 3);
rg.className = "LinkReshapingTool";
rg.None = sg;
rg.Horizontal = vg;
rg.Vertical = ug;
rg.All = wg;
Ma("linkReshapingTool", function () {
return this.findTool("LinkReshaping")
}, function (a) {
Pe(this, "LinkReshaping", a, this.mouseDownTools)
});
function yg() {
Ee.call(this);
this.name = "Resizing";
this.Tf = (new M(1, 1)).freeze();
this.Sf = (new M(9999, 9999)).freeze();
this.Fg = (new M(NaN, NaN)).freeze();
this.K = !1;
this.$d = null;
var a = new W;
a.alignmentFocus = Fc;
a.figure = "Rectangle";
a.desiredSize = Mb;
a.fill = "lightblue";
a.stroke = "dodgerblue";
a.strokeWidth = 1;
a.cursor = "pointer";
this.u = a;
this.l = null;
this.vl = new G;
this.Fw = new M;
this.Lo = new G;
this.Yt = new M(0, 0);
this.Xt = new M(Infinity, Infinity);
this.Wt = new M(1, 1);
this.Cw = !0
}
la(yg, Ee);
yg.prototype.updateAdornments = function (a) {
if (!(null === a || a instanceof R)) {
if (a.isSelected && !this.diagram.isReadOnly) {
var b = a.resizeObject, c = a.bk(this.name);
if (null !== b && a.canResize() && a.actualBounds.o() && a.isVisible() && b.actualBounds.o() && b.tf()) {
if (null === c || c.adornedObject !== b) c = this.makeAdornment(b);
if (null !== c) {
b = b.Mi();
Kf(a) && this.updateResizeHandles(c, b);
a.rh(this.name, c);
return
}
}
}
a.vf(this.name)
}
};
yg.prototype.makeAdornment = function (a) {
var b = a.part.resizeAdornmentTemplate;
if (null === b) {
b = new Je;
b.type = X.Spot;
b.locationSpot = Fc;
var c = new zg;
c.isPanelMain = !0;
b.add(c);
b.add(this.makeHandle(a, zc));
b.add(this.makeHandle(a, Dc));
b.add(this.makeHandle(a, Jc));
b.add(this.makeHandle(a, Hc));
b.add(this.makeHandle(a, fd));
b.add(this.makeHandle(a, md));
b.add(this.makeHandle(a, nd));
b.add(this.makeHandle(a, ld))
} else if (Ag(b), b = b.copy(), null === b) return null;
b.adornedObject = a;
return b
};
yg.prototype.makeHandle = function (a, b) {
a = this.handleArchetype;
if (null === a) return null;
a = a.copy();
a.alignment = b;
return a
};
yg.prototype.updateResizeHandles = function (a, b) {
if (null !== a) if (!a.alignment.Kb() && ("pointer" === a.cursor || 0 < a.cursor.indexOf("resize"))) a:{
var c = a.alignment;
c.jc() && (c = Fc);
if (0 >= c.x) b = 0 >= c.y ? b + 225 : 1 <= c.y ? b + 135 : b + 180; else if (1 <= c.x) 0 >= c.y ? b += 315 : 1 <= c.y && (b += 45); else if (0 >= c.y) b += 270; else if (1 <= c.y) b += 90; else break a;
0 > b ? b += 360 : 360 <= b && (b -= 360);
a.cursor = 22.5 > b ? "e-resize" : 67.5 > b ? "se-resize" : 112.5 > b ? "s-resize" : 157.5 > b ? "sw-resize" : 202.5 > b ? "w-resize" : 247.5 > b ? "nw-resize" : 292.5 > b ? "n-resize" : 337.5 > b ? "ne-resize" :
"e-resize"
} else if (a instanceof X) for (a = a.elements; a.next();) this.updateResizeHandles(a.value, b)
};
yg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
return !a.isReadOnly && a.allowResize && a.lastInput.left ? null !== this.findToolHandleAt(a.firstInput.documentPoint, this.name) : !1
};
yg.prototype.doActivate = function () {
var a = this.diagram;
null === this.handle && (this.handle = this.findToolHandleAt(a.firstInput.documentPoint, this.name));
null !== this.handle && (this.adornedObject = this.handle.part.adornedObject, null !== this.adornedObject && (this.vl.set(this.adornedObject.ma(this.handle.alignment.tv())), this.Lo.set(this.adornedObject.part.location), this.Fw.set(this.adornedObject.desiredSize), this.Wt = this.computeCellSize(), this.Yt = this.computeMinSize(), this.Xt = this.computeMaxSize(), a.isMouseCaptured =
!0, this.Cw = a.animationManager.isEnabled, a.animationManager.isEnabled = !1, this.Aa(this.name), this.isActive = !0))
};
yg.prototype.doDeactivate = function () {
var a = this.diagram;
this.zg();
this.$d = this.handle = null;
this.isActive = a.isMouseCaptured = !1;
a.animationManager.isEnabled = this.Cw
};
yg.prototype.doCancel = function () {
null !== this.adornedObject && (this.adornedObject.desiredSize = this.originalDesiredSize, this.adornedObject.part.location = this.originalLocation);
this.stopTool()
};
yg.prototype.doMouseMove = function () {
var a = this.diagram;
if (this.isActive) {
var b = this.Yt, c = this.Xt, d = this.Wt, e = this.adornedObject.Ws(a.lastInput.documentPoint, G.alloc()),
f = this.computeReshape();
b = this.computeResize(e, this.handle.alignment, b, c, d, f);
this.resize(b);
a.fd();
G.free(e)
}
};
yg.prototype.doMouseUp = function () {
var a = this.diagram;
if (this.isActive) {
var b = this.Yt, c = this.Xt, d = this.Wt, e = this.adornedObject.Ws(a.lastInput.documentPoint, G.alloc()),
f = this.computeReshape();
b = this.computeResize(e, this.handle.alignment, b, c, d, f);
this.resize(b);
G.free(e);
a.Xa();
this.transactionResult = this.name;
a.aa("PartResized", this.adornedObject, this.originalDesiredSize)
}
this.stopTool()
};
yg.prototype.resize = function (a) {
var b = this.diagram, c = this.adornedObject, d = c.part;
c.desiredSize = a.size;
d.$b();
a = this.adornedObject.ma(this.handle.alignment.tv());
d instanceof U ? (c = new E, c.add(d), b.moveParts(c, this.vl.copy().Xd(a), !0)) : d.location = d.location.copy().Xd(a).add(this.vl)
};
yg.prototype.computeResize = function (a, b, c, d, e, f) {
b.jc() && (b = Fc);
var g = this.adornedObject.naturalBounds, h = g.x, k = g.y, l = g.x + g.width, m = g.y + g.height, n = 1;
if (!f) {
n = g.width;
var p = g.height;
0 >= n && (n = 1);
0 >= p && (p = 1);
n = p / n
}
p = G.alloc();
H.Xp(a.x, a.y, h, k, e.width, e.height, p);
a = g.copy();
0 >= b.x ? 0 >= b.y ? (a.x = Math.max(p.x, l - d.width), a.x = Math.min(a.x, l - c.width), a.width = Math.max(l - a.x, c.width), a.y = Math.max(p.y, m - d.height), a.y = Math.min(a.y, m - c.height), a.height = Math.max(m - a.y, c.height), f || (1 <= a.height / a.width ? (a.height = Math.max(Math.min(n *
a.width, d.height), c.height), a.width = a.height / n) : (a.width = Math.max(Math.min(a.height / n, d.width), c.width), a.height = n * a.width), a.x = l - a.width, a.y = m - a.height)) : 1 <= b.y ? (a.x = Math.max(p.x, l - d.width), a.x = Math.min(a.x, l - c.width), a.width = Math.max(l - a.x, c.width), a.height = Math.max(Math.min(p.y - k, d.height), c.height), f || (1 <= a.height / a.width ? (a.height = Math.max(Math.min(n * a.width, d.height), c.height), a.width = a.height / n) : (a.width = Math.max(Math.min(a.height / n, d.width), c.width), a.height = n * a.width), a.x = l - a.width)) : (a.x =
Math.max(p.x, l - d.width), a.x = Math.min(a.x, l - c.width), a.width = l - a.x, f || (a.height = Math.max(Math.min(n * a.width, d.height), c.height), a.width = a.height / n, a.y = k + .5 * (m - k - a.height))) : 1 <= b.x ? 0 >= b.y ? (a.width = Math.max(Math.min(p.x - h, d.width), c.width), a.y = Math.max(p.y, m - d.height), a.y = Math.min(a.y, m - c.height), a.height = Math.max(m - a.y, c.height), f || (1 <= a.height / a.width ? (a.height = Math.max(Math.min(n * a.width, d.height), c.height), a.width = a.height / n) : (a.width = Math.max(Math.min(a.height / n, d.width), c.width), a.height = n * a.width),
a.y = m - a.height)) : 1 <= b.y ? (a.width = Math.max(Math.min(p.x - h, d.width), c.width), a.height = Math.max(Math.min(p.y - k, d.height), c.height), f || (1 <= a.height / a.width ? (a.height = Math.max(Math.min(n * a.width, d.height), c.height), a.width = a.height / n) : (a.width = Math.max(Math.min(a.height / n, d.width), c.width), a.height = n * a.width))) : (a.width = Math.max(Math.min(p.x - h, d.width), c.width), f || (a.height = Math.max(Math.min(n * a.width, d.height), c.height), a.width = a.height / n, a.y = k + .5 * (m - k - a.height))) : 0 >= b.y ? (a.y = Math.max(p.y, m - d.height),
a.y = Math.min(a.y, m - c.height), a.height = m - a.y, f || (a.width = Math.max(Math.min(a.height / n, d.width), c.width), a.height = n * a.width, a.x = h + .5 * (l - h - a.width))) : 1 <= b.y && (a.height = Math.max(Math.min(p.y - k, d.height), c.height), f || (a.width = Math.max(Math.min(a.height / n, d.width), c.width), a.height = n * a.width, a.x = h + .5 * (l - h - a.width)));
G.free(p);
return a
};
yg.prototype.computeReshape = function () {
var a = Bg;
this.adornedObject instanceof W && (a = Cg(this.adornedObject));
return !(a === Dg || this.diagram.lastInput.shift)
};
yg.prototype.computeMinSize = function () {
var a = this.adornedObject.minSize.copy(), b = this.minSize;
!isNaN(b.width) && b.width > a.width && (a.width = b.width);
!isNaN(b.height) && b.height > a.height && (a.height = b.height);
return a
};
yg.prototype.computeMaxSize = function () {
var a = this.adornedObject.maxSize.copy(), b = this.maxSize;
!isNaN(b.width) && b.width < a.width && (a.width = b.width);
!isNaN(b.height) && b.height < a.height && (a.height = b.height);
return a
};
yg.prototype.computeCellSize = function () {
var a = new M(NaN, NaN), b = this.adornedObject.part;
null !== b && (b = b.resizeCellSize, !isNaN(b.width) && 0 < b.width && (a.width = b.width), !isNaN(b.height) && 0 < b.height && (a.height = b.height));
b = this.cellSize;
isNaN(a.width) && !isNaN(b.width) && 0 < b.width && (a.width = b.width);
isNaN(a.height) && !isNaN(b.height) && 0 < b.height && (a.height = b.height);
b = this.diagram;
(isNaN(a.width) || isNaN(a.height)) && b && (b = b.grid, null !== b && b.visible && this.isGridSnapEnabled && (b = b.gridCellSize, isNaN(a.width) &&
!isNaN(b.width) && 0 < b.width && (a.width = b.width), isNaN(a.height) && !isNaN(b.height) && 0 < b.height && (a.height = b.height)));
if (isNaN(a.width) || 0 === a.width || Infinity === a.width) a.width = 1;
if (isNaN(a.height) || 0 === a.height || Infinity === a.height) a.height = 1;
return a
};
ma.Object.defineProperties(yg.prototype, {
handleArchetype: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, handle: {
get: function () {
return this.l
}, set: function (a) {
if (null !== a && !(a.part instanceof Je)) throw Error("new handle is not in an Adornment: " + a);
this.l = a
}
}, adornedObject: {
get: function () {
return this.$d
}, set: function (a) {
if (null !== a && a.part instanceof Je) throw Error("new handle must not be in an Adornment: " +
a);
this.$d = a
}
}, minSize: {
get: function () {
return this.Tf
}, set: function (a) {
if (!this.Tf.A(a)) {
var b = a.width;
isNaN(b) && (b = 0);
a = a.height;
isNaN(a) && (a = 0);
this.Tf.h(b, a)
}
}
}, maxSize: {
get: function () {
return this.Sf
}, set: function (a) {
if (!this.Sf.A(a)) {
var b = a.width;
isNaN(b) && (b = Infinity);
a = a.height;
isNaN(a) && (a = Infinity);
this.Sf.h(b, a)
}
}
}, cellSize: {
get: function () {
return this.Fg
}, set: function (a) {
this.Fg.A(a) || this.Fg.assign(a)
}
},
isGridSnapEnabled: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, originalDesiredSize: {
get: function () {
return this.Fw
}
}, originalLocation: {
get: function () {
return this.Lo
}
}
});
yg.className = "ResizingTool";
Ma("resizingTool", function () {
return this.findTool("Resizing")
}, function (a) {
Pe(this, "Resizing", a, this.mouseDownTools)
});
function Eg() {
Ee.call(this);
this.name = "Rotating";
this.Ma = 45;
this.La = 2;
this.Lo = new G;
this.$d = null;
var a = new W;
a.figure = "Ellipse";
a.desiredSize = Ob;
a.fill = "lightblue";
a.stroke = "dodgerblue";
a.strokeWidth = 1;
a.cursor = "pointer";
this.u = a;
this.l = null;
this.Ew = 0;
this.ru = new G(NaN, NaN);
this.K = 0;
this.ba = 50
}
la(Eg, Ee);
Eg.prototype.updateAdornments = function (a) {
if (null !== a) {
if (a.Bh()) {
var b = a.rotateObject;
if (b === a || b === a.path || b.isPanelMain) return
}
if (a.isSelected && !this.diagram.isReadOnly && (b = a.rotateObject, null !== b && a.canRotate() && a.actualBounds.o() && a.isVisible() && b.actualBounds.o() && b.tf())) {
var c = a.bk(this.name);
if (null === c || c.adornedObject !== b) c = this.makeAdornment(b);
if (null !== c) {
c.angle = b.Mi();
null === c.placeholder && (c.location = this.computeAdornmentLocation(b));
a.rh(this.name, c);
return
}
}
a.vf(this.name)
}
};
Eg.prototype.makeAdornment = function (a) {
var b = a.part.rotateAdornmentTemplate;
if (null === b) {
b = new Je;
b.type = X.Position;
b.locationSpot = Fc;
var c = this.handleArchetype;
null !== c && b.add(c.copy())
} else if (Ag(b), b = b.copy(), null === b) return null;
b.adornedObject = a;
return b
};
Eg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
return !a.isReadOnly && a.allowRotate && a.lastInput.left ? null !== this.findToolHandleAt(a.firstInput.documentPoint, this.name) : !1
};
Eg.prototype.doActivate = function () {
var a = this.diagram;
if (null === this.adornedObject) {
null === this.handle && (this.handle = this.findToolHandleAt(a.firstInput.documentPoint, this.name));
if (null === this.handle) return;
this.adornedObject = this.handle.part.adornedObject
}
null !== this.adornedObject && (this.Ew = this.adornedObject.angle, this.ru = this.computeRotationPoint(this.adornedObject), this.Lo = this.adornedObject.part.location.copy(), a.isMouseCaptured = !0, a.delaysLayout = !0, this.Aa(this.name), this.isActive = !0)
};
Eg.prototype.computeRotationPoint = function (a) {
var b = a.part, c = b.locationObject;
return b.rotationSpot.gb() ? a.ma(b.rotationSpot) : a === b || a === c ? c.ma(b.locationSpot) : a.ma(Fc)
};
Eg.prototype.computeAdornmentLocation = function (a) {
var b = this.rotationPoint;
b.o() || (b = this.computeRotationPoint(a));
b = a.Ws(b);
var c = this.handleAngle;
0 > c ? c += 360 : 360 <= c && (c -= 360);
c = Math.round(45 * Math.round(c / 45));
var d = this.handleDistance;
0 === c ? b.x = a.naturalBounds.width + d : 45 === c ? (b.x = a.naturalBounds.width + d, b.y = a.naturalBounds.height + d) : 90 === c ? b.y = a.naturalBounds.height + d : 135 === c ? (b.x = -d, b.y = a.naturalBounds.height + d) : 180 === c ? b.x = -d : 225 === c ? (b.x = -d, b.y = -d) : 270 === c ? b.y = -d : 315 === c && (b.x = a.naturalBounds.width +
d, b.y = -d);
return a.ma(b)
};
Eg.prototype.doDeactivate = function () {
var a = this.diagram;
this.zg();
this.$d = this.handle = null;
this.ru = new G(NaN, NaN);
this.isActive = a.isMouseCaptured = !1
};
Eg.prototype.doCancel = function () {
this.diagram.delaysLayout = !1;
this.rotate(this.originalAngle);
this.stopTool()
};
Eg.prototype.doMouseMove = function () {
var a = this.diagram;
this.isActive && (a = this.computeRotate(a.lastInput.documentPoint), this.rotate(a))
};
Eg.prototype.doMouseUp = function () {
var a = this.diagram;
if (this.isActive) {
a.delaysLayout = !1;
var b = this.computeRotate(a.lastInput.documentPoint);
this.rotate(b);
a.Xa();
this.transactionResult = this.name;
a.aa("PartRotated", this.adornedObject, this.originalAngle)
}
this.stopTool()
};
Eg.prototype.rotate = function (a) {
var b = this.adornedObject;
if (null !== b) {
b.angle = a;
b = b.part;
b.$b();
var c = b.locationObject, d = b.rotateObject;
if (c === d || c.ug(d)) c = this.Lo.copy(), b.location = c.Xd(this.rotationPoint).rotate(a - this.originalAngle).add(this.rotationPoint)
}
};
Eg.prototype.computeRotate = function (a) {
a = this.rotationPoint.Wa(a) - this.handleAngle;
var b = this.adornedObject.panel;
null !== b && (a -= b.Mi());
360 <= a ? a -= 360 : 0 > a && (a += 360);
b = Math.min(Math.abs(this.snapAngleMultiple), 180);
var c = Math.min(Math.abs(this.snapAngleEpsilon), b / 2);
!this.diagram.lastInput.shift && 0 < b && 0 < c && (a % b < c ? a = Math.floor(a / b) * b : a % b > b - c && (a = (Math.floor(a / b) + 1) * b));
360 <= a ? a -= 360 : 0 > a && (a += 360);
return a
};
ma.Object.defineProperties(Eg.prototype, {
handleArchetype: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, handle: {
get: function () {
return this.l
}, set: function (a) {
if (null !== a && !(a.part instanceof Je)) throw Error("new handle is not in an Adornment: " + a);
this.l = a
}
}, adornedObject: {
get: function () {
return this.$d
}, set: function (a) {
if (null !== a && a.part instanceof Je) throw Error("new handle must not be in an Adornment: " +
a);
this.$d = a
}
}, snapAngleMultiple: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma = a
}
}, snapAngleEpsilon: {
get: function () {
return this.La
}, set: function (a) {
this.La = a
}
}, originalAngle: {
get: function () {
return this.Ew
}
}, rotationPoint: {
get: function () {
return this.ru
}
}, handleAngle: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, handleDistance: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}
});
Eg.className = "RotatingTool";
Ma("rotatingTool", function () {
return this.findTool("Rotating")
}, function (a) {
Pe(this, "Rotating", a, this.mouseDownTools)
});
function Fg() {
Ee.call(this);
this.name = "ClickSelecting"
}
la(Fg, Ee);
Fg.prototype.canStart = function () {
return !this.isEnabled || this.isBeyondDragSize() ? !1 : !0
};
Fg.prototype.doMouseUp = function () {
this.isActive && (this.standardMouseSelect(), !this.standardMouseClick() && this.diagram.lastInput.isTouchEvent && this.diagram.toolManager.doToolTip());
this.stopTool()
};
Fg.className = "ClickSelectingTool";
function Gg() {
Ee.call(this);
this.name = "Action";
this.xk = null
}
la(Gg, Ee);
Gg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram, b = a.lastInput, c = a.Rb(b.documentPoint, function (a) {
for (; null !== a.panel && !a.isActionable;) a = a.panel;
return a
});
if (null !== c) {
if (!c.isActionable) return !1;
this.xk = c;
a.Lk = a.Rb(b.documentPoint, null, null);
return !0
}
return !1
};
Gg.prototype.doMouseDown = function () {
if (this.isActive) {
var a = this.diagram.lastInput, b = this.xk;
null !== b && (a.targetObject = b, null !== b.actionDown && b.actionDown(a, b))
} else this.canStart() && this.doActivate()
};
Gg.prototype.doMouseMove = function () {
if (this.isActive) {
var a = this.diagram.lastInput, b = this.xk;
null !== b && (a.targetObject = b, null !== b.actionMove && b.actionMove(a, b))
}
};
Gg.prototype.doMouseUp = function () {
if (this.isActive) {
var a = this.diagram.lastInput, b = this.xk;
if (null === b) return;
a.targetObject = b;
null !== b.actionUp && b.actionUp(a, b);
this.standardMouseClick(function (a) {
for (; null !== a.panel && (!a.isActionable || a !== b);) a = a.panel;
return a
}, function (a) {
return a === b
})
}
this.stopTool()
};
Gg.prototype.doCancel = function () {
var a = this.diagram.lastInput, b = this.xk;
null !== b && (a.targetObject = b, null !== b.actionCancel && b.actionCancel(a, b), this.stopTool())
};
Gg.prototype.doStop = function () {
this.xk = null
};
Gg.className = "ActionTool";
function Hg() {
Ee.call(this);
this.name = "ClickCreating";
this.bj = null;
this.u = !0;
this.l = !1;
this.ww = new G(0, 0)
}
la(Hg, Ee);
Hg.prototype.canStart = function () {
if (!this.isEnabled || null === this.archetypeNodeData) return !1;
var a = this.diagram;
if (a.isReadOnly || a.isModelReadOnly || !a.allowInsert || !a.lastInput.left || this.isBeyondDragSize()) return !1;
if (this.isDoubleClick) {
if (1 === a.lastInput.clickCount && (this.ww = a.lastInput.viewPoint.copy()), 2 !== a.lastInput.clickCount || this.isBeyondDragSize(this.ww)) return !1
} else if (1 !== a.lastInput.clickCount) return !1;
return a.currentTool !== this && null !== a.am(a.lastInput.documentPoint, !0) ? !1 : !0
};
Hg.prototype.doMouseUp = function () {
var a = this.diagram;
this.isActive && this.insertPart(a.lastInput.documentPoint);
this.stopTool()
};
Hg.prototype.insertPart = function (a) {
var b = this.diagram, c = this.archetypeNodeData;
if (null === c) return null;
this.Aa(this.name);
var d = null;
c instanceof S ? c.bc() && (Ag(c), d = c.copy(), null !== d && b.add(d)) : null !== c && (c = b.model.copyNodeData(c), ya(c) && (b.model.kf(c), d = b.vc(c)));
null !== d && (c = G.allocAt(a.x, a.y), this.isGridSnapEnabled && Ig(this.diagram, d, a, c), d.location = c, b.allowSelect && b.select(d), G.free(c));
b.Xa();
this.transactionResult = this.name;
b.aa("PartCreated", d);
this.zg();
return d
};
ma.Object.defineProperties(Hg.prototype, {
archetypeNodeData: {
get: function () {
return this.bj
}, set: function (a) {
this.bj = a
}
}, isDoubleClick: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, isGridSnapEnabled: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}
});
Hg.className = "ClickCreatingTool";
function Jg() {
Ee.call(this);
this.name = "DragSelecting";
this.Sk = 175;
this.u = !1;
var a = new S;
a.layerName = "Tool";
a.selectable = !1;
var b = new W;
b.name = "SHAPE";
b.figure = "Rectangle";
b.fill = null;
b.stroke = "magenta";
a.add(b);
this.l = a
}
la(Jg, Ee);
Jg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (!a.allowSelect) return !1;
var b = a.lastInput;
return !b.left || a.currentTool !== this && (!this.isBeyondDragSize() || b.timestamp - a.firstInput.timestamp < this.delay || null !== a.am(b.documentPoint, !0)) ? !1 : !0
};
Jg.prototype.doActivate = function () {
var a = this.diagram;
this.isActive = !0;
a.isMouseCaptured = !0;
a.skipsUndoManager = !0;
a.add(this.box);
this.doMouseMove()
};
Jg.prototype.doDeactivate = function () {
var a = this.diagram;
a.xf();
a.remove(this.box);
a.skipsUndoManager = !1;
this.isActive = a.isMouseCaptured = !1
};
Jg.prototype.doMouseMove = function () {
var a = this.diagram;
if (this.isActive && null !== this.box) {
var b = this.computeBoxBounds(), c = this.box.$a("SHAPE");
null === c && (c = this.box.zb());
var d = M.alloc().h(b.width, b.height);
b = G.alloc().h(b.x, b.y);
c.desiredSize = d;
this.box.position = b;
M.free(d);
G.free(b);
(a.allowHorizontalScroll || a.allowVerticalScroll) && a.Os(a.lastInput.viewPoint)
}
};
Jg.prototype.doMouseUp = function () {
if (this.isActive) {
var a = this.diagram;
a.remove(this.box);
try {
a.currentCursor = "wait", a.aa("ChangingSelection", a.selection), this.selectInRect(this.computeBoxBounds()), a.aa("ChangedSelection", a.selection)
} finally {
a.currentCursor = ""
}
}
this.stopTool()
};
Jg.prototype.computeBoxBounds = function () {
var a = this.diagram;
return new N(a.firstInput.documentPoint, a.lastInput.documentPoint)
};
Jg.prototype.selectInRect = function (a) {
var b = this.diagram, c = b.lastInput;
a = b.ix(a, this.isPartialInclusion);
if (Wa ? c.meta : c.control) if (c.shift) for (a = a.iterator; a.next();) b = a.value, b.isSelected && (b.isSelected = !1); else for (a = a.iterator; a.next();) b = a.value, b.isSelected = !b.isSelected; else if (c.shift) for (a = a.iterator; a.next();) b = a.value, b.isSelected || (b.isSelected = !0); else {
c = new E;
for (b = b.selection.iterator; b.next();) {
var d = b.value;
a.contains(d) || c.add(d)
}
for (b = c.iterator; b.next();) b.value.isSelected = !1;
for (a =
a.iterator; a.next();) b = a.value, b.isSelected || (b.isSelected = !0)
}
};
ma.Object.defineProperties(Jg.prototype, {
delay: {
get: function () {
return this.Sk
}, set: function (a) {
this.Sk = a
}
}, isPartialInclusion: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, box: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}
});
Jg.className = "DragSelectingTool";
function Kg() {
Ee.call(this);
this.name = "Panning";
this.mu = new G;
this.Zx = new G;
this.Eg = !1;
var a = this;
this.Iw = function () {
x.document.removeEventListener("scroll", a.Iw, !1);
a.stopTool()
}
}
la(Kg, Ee);
Kg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
return !a.allowHorizontalScroll && !a.allowVerticalScroll || !a.lastInput.left || a.currentTool !== this && !this.isBeyondDragSize() ? !1 : !0
};
Kg.prototype.doActivate = function () {
var a = this.diagram;
this.Eg ? (a.lastInput.bubbles = !0, x.document.addEventListener("scroll", this.Iw, !1)) : (a.currentCursor = "move", a.isMouseCaptured = !0, this.mu.assign(a.position));
this.isActive = !0
};
Kg.prototype.doDeactivate = function () {
var a = this.diagram;
a.currentCursor = "";
this.isActive = a.isMouseCaptured = !1
};
Kg.prototype.doCancel = function () {
var a = this.diagram;
a.position = this.mu;
a.isMouseCaptured = !1;
this.stopTool()
};
Kg.prototype.doMouseMove = function () {
this.move()
};
Kg.prototype.doMouseUp = function () {
this.move();
this.stopTool()
};
Kg.prototype.move = function () {
var a = this.diagram;
if (this.isActive && a) if (this.Eg) a.lastInput.bubbles = !0; else {
var b = a.position, c = a.firstInput.documentPoint, d = a.lastInput.documentPoint, e = b.x + c.x - d.x;
c = b.y + c.y - d.y;
a.allowHorizontalScroll || (e = b.x);
a.allowVerticalScroll || (c = b.y);
a.position = this.Zx.h(e, c)
}
};
ma.Object.defineProperties(Kg.prototype, {
bubbles: {
get: function () {
return this.Eg
}, set: function (a) {
this.Eg = a
}
}, originalPosition: {
get: function () {
return this.mu
}
}
});
Kg.className = "PanningTool";
Ma("clickCreatingTool", function () {
return this.findTool("ClickCreating")
}, function (a) {
Pe(this, "ClickCreating", a, this.mouseUpTools)
});
Ma("clickSelectingTool", function () {
return this.findTool("ClickSelecting")
}, function (a) {
Pe(this, "ClickSelecting", a, this.mouseUpTools)
});
Ma("panningTool", function () {
return this.findTool("Panning")
}, function (a) {
Pe(this, "Panning", a, this.mouseMoveTools)
});
Ma("dragSelectingTool", function () {
return this.findTool("DragSelecting")
}, function (a) {
Pe(this, "DragSelecting", a, this.mouseMoveTools)
});
Ma("actionTool", function () {
return this.findTool("Action")
}, function (a) {
Pe(this, "Action", a, this.mouseDownTools)
});
function Oe() {
this.ba = this.K = this.l = this.u = null
}
ma.Object.defineProperties(Oe.prototype, {
mainElement: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, show: {
get: function () {
return this.u
}, set: function (a) {
this.u !== a && (this.u = a)
}
}, hide: {
get: function () {
return this.l
}, set: function (a) {
this.l !== a && (this.l = a)
}
}, valueFunction: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}
});
Oe.className = "HTMLInfo";
function Lg(a, b, c) {
this.text = a;
this.Xw = b;
this.visible = c
}
Lg.className = "ContextMenuButtonInfo";
function Mg() {
Ee.call(this);
this.name = "ContextMenu";
this.u = this.Nt = this.l = null;
this.Bw = new G;
this.Ot = null;
this.du = !1;
var a = this;
this.Bu = function () {
a.stopTool()
}
}
la(Mg, Ee);
function Ng(a) {
var b = new Oe;
b.show = function (a, b, c) {
c.showDefaultContextMenu()
};
b.hide = function (a, b) {
b.hideDefaultContextMenu()
};
Og = b;
a.Bu = function () {
a.stopTool()
};
b = ta("div");
var c = ta("div");
b.style.cssText = "top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";
c.style.cssText = "z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d = ta("style");
x.document.getElementsByTagName("head")[0].appendChild(d);
d.sheet.insertRule(".goCXul { list-style: none; }", 0);
d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }", 0);
d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }", 0);
b.addEventListener("contextmenu", Pg, !1);
b.addEventListener("selectstart", Pg, !1);
c.addEventListener("contextmenu",
Pg, !1);
b.className = "goCXforeground";
c.className = "goCXbackground";
x.document.body && (x.document.body.appendChild(b), x.document.body.appendChild(c));
Qg = b;
Rg = c;
Sg = !0
}
function Pg(a) {
a.preventDefault();
return !1
}
Mg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
return this.isBeyondDragSize() || !a.lastInput.right ? !1 : a.lastInput.isTouchEvent && null !== this.defaultTouchContextMenu || null !== this.findObjectWithContextMenu() ? !0 : !1
};
Mg.prototype.doStart = function () {
this.Bw.set(this.diagram.firstInput.documentPoint)
};
Mg.prototype.doStop = function () {
this.hideContextMenu();
this.currentObject = null
};
Mg.prototype.findObjectWithContextMenu = function (a) {
void 0 === a && (a = null);
var b = this.diagram, c = b.lastInput, d = null;
a instanceof P || (a instanceof Y ? d = a : d = b.Rb(c.documentPoint, null, function (a) {
return !a.layer.isTemporary
}));
if (null !== d) {
for (a = d; null !== a;) {
if (null !== a.contextMenu) return a;
a = a.panel
}
if (b.lastInput.isTouchEvent && this.defaultTouchContextMenu) return d.part
} else if (null !== b.contextMenu) return b;
return null
};
Mg.prototype.doActivate = function () {
};
Mg.prototype.doMouseDown = function () {
Ee.prototype.doMouseDown.call(this);
if (this.isActive && this.currentContextMenu instanceof Je) {
var a = this.diagram.toolManager.findTool("Action");
null !== a && a.canStart() && (a.doActivate(), a.doMouseDown(), a.doDeactivate())
}
this.diagram.toolManager.mouseDownTools.contains(this) && Tg(this)
};
Mg.prototype.doMouseUp = function () {
if (this.isActive && this.currentContextMenu instanceof Je) {
var a = this.diagram.toolManager.findTool("Action");
null !== a && a.canStart() && (a.doActivate(), a.doCancel(), a.doDeactivate())
}
Tg(this)
};
function Tg(a) {
var b = a.diagram;
if (a.isActive) {
var c = a.currentContextMenu;
if (null !== c) {
if (!(c instanceof Oe)) {
var d = b.Rb(b.lastInput.documentPoint, null, null);
null !== d && d.ug(c) && a.standardMouseClick(null, null)
}
a.stopTool();
a.canStart() && (b.currentTool = a, a.doMouseUp())
}
} else a.canStart() && (Ug(a, !0), a.isActive || a.stopTool())
}
function Ug(a, b, c) {
void 0 === c && (c = null);
if (!a.du && (a.du = !0, b && a.standardMouseSelect(), b = a.standardMouseClick(), a.du = !1, !b)) if (a.isActive = !0, b = Og, null === c && (c = a.findObjectWithContextMenu()), null !== c) {
var d = c.contextMenu;
null !== d ? (a.currentObject = c instanceof Y ? c : null, a.showContextMenu(d, a.currentObject)) : null !== b && a.showContextMenu(b, a.currentObject)
} else null !== b && a.showContextMenu(b, null)
}
Mg.prototype.doMouseMove = function () {
var a = this.diagram.toolManager.findTool("Action");
null !== a && a.doMouseMove();
this.isActive && this.diagram.toolManager.doMouseMove()
};
Mg.prototype.showContextMenu = function (a, b) {
var c = this.diagram;
a !== this.currentContextMenu && this.hideContextMenu();
if (a instanceof Je) {
a.layerName = "Tool";
a.selectable = !1;
a.scale = 1 / c.scale;
a.category = this.name;
null !== a.placeholder && (a.placeholder.scale = c.scale);
var d = a.diagram;
null !== d && d !== c && d.remove(a);
c.add(a);
null !== b ? a.adornedObject = b : a.data = c.model;
a.$b();
this.positionContextMenu(a, b)
} else a instanceof Oe && a.show(b, c, this);
this.currentContextMenu = a
};
Mg.prototype.positionContextMenu = function (a) {
if (null === a.placeholder) {
var b = this.diagram, c = b.lastInput.documentPoint.copy(), d = a.measuredBounds, e = b.viewportBounds;
b.lastInput.isTouchEvent && (c.x -= d.width);
c.x + d.width > e.right && (c.x -= d.width + 5 / b.scale);
c.x < e.x && (c.x = e.x);
c.y + d.height > e.bottom && (c.y -= d.height + 5 / b.scale);
c.y < e.y && (c.y = e.y);
a.position = c
}
};
Mg.prototype.hideContextMenu = function () {
var a = this.diagram, b = this.currentContextMenu;
null !== b && (b instanceof Je ? (a.remove(b), null !== this.Nt && this.Nt.vf(b.category), b.data = null, b.adornedObject = null) : b instanceof Oe && (null !== b.hide ? b.hide(a, this) : null !== b.mainElement && (b.mainElement.style.display = "none")), this.currentContextMenu = null, this.standardMouseOver())
};
function Vg() {
var a = new E;
a.add(new Lg("Copy", function (a) {
a.commandHandler.copySelection()
}, function (a) {
return a.commandHandler.canCopySelection()
}));
a.add(new Lg("Cut", function (a) {
a.commandHandler.cutSelection()
}, function (a) {
return a.commandHandler.canCutSelection()
}));
a.add(new Lg("Delete", function (a) {
a.commandHandler.deleteSelection()
}, function (a) {
return a.commandHandler.canDeleteSelection()
}));
a.add(new Lg("Paste", function (a) {
a.commandHandler.pasteSelection(a.lastInput.documentPoint)
}, function (a) {
return a.commandHandler.canPasteSelection()
}));
a.add(new Lg("Select All", function (a) {
a.commandHandler.selectAll()
}, function (a) {
return a.commandHandler.canSelectAll()
}));
a.add(new Lg("Undo", function (a) {
a.commandHandler.undo()
}, function (a) {
return a.commandHandler.canUndo()
}));
a.add(new Lg("Redo", function (a) {
a.commandHandler.redo()
}, function (a) {
return a.commandHandler.canRedo()
}));
a.add(new Lg("Scroll To Part", function (a) {
a.commandHandler.scrollToPart()
}, function (a) {
return a.commandHandler.canScrollToPart()
}));
a.add(new Lg("Zoom To Fit", function (a) {
a.commandHandler.zoomToFit()
},
function (a) {
return a.commandHandler.canZoomToFit()
}));
a.add(new Lg("Reset Zoom", function (a) {
a.commandHandler.resetZoom()
}, function (a) {
return a.commandHandler.canResetZoom()
}));
a.add(new Lg("Group Selection", function (a) {
a.commandHandler.groupSelection()
}, function (a) {
return a.commandHandler.canGroupSelection()
}));
a.add(new Lg("Ungroup Selection", function (a) {
a.commandHandler.ungroupSelection()
}, function (a) {
return a.commandHandler.canUngroupSelection()
}));
a.add(new Lg("Edit Text", function (a) {
a.commandHandler.editTextBlock()
},
function (a) {
return a.commandHandler.canEditTextBlock()
}));
return a
}
Mg.prototype.showDefaultContextMenu = function () {
var a = this.diagram;
null === this.Ot && (this.Ot = Vg());
Qg.innerHTML = "";
Rg.addEventListener("click", this.Bu, !1);
var b = this, c = ta("ul");
c.className = "goCXul";
Qg.appendChild(c);
c.innerHTML = "";
for (var d = this.Ot.iterator; d.next();) {
var e = d.value, f = e.visible;
if ("function" === typeof e.Xw && ("function" !== typeof f || f(a))) {
f = ta("li");
f.className = "goCXli";
var g = ta("a");
g.className = "goCXa";
g.href = "#";
g.Rx = e.Xw;
g.addEventListener("click", function (c) {
this.Rx(a);
b.stopTool();
c.preventDefault();
return !1
}, !1);
g.textContent = e.text;
f.appendChild(g);
c.appendChild(f)
}
}
Qg.style.display = "block";
Rg.style.display = "block"
};
Mg.prototype.hideDefaultContextMenu = function () {
null !== this.currentContextMenu && this.currentContextMenu === Og && (Qg.style.display = "none", Rg.style.display = "none", Rg.removeEventListener("click", this.Bu, !1), this.currentContextMenu = null)
};
ma.Object.defineProperties(Mg.prototype, {
currentContextMenu: {
get: function () {
return this.l
}, set: function (a) {
this.l = a;
this.Nt = a instanceof Je ? a.adornedPart : null
}
}, defaultTouchContextMenu: {
get: function () {
!1 === Sg && null === Og && Wg && Ng(this);
return Og
}, set: function (a) {
null === a && (Sg = !0);
Og = a
}
}, currentObject: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, mouseDownPoint: {
get: function () {
return this.Bw
}
}
});
var Og = null, Sg = !1, Rg = null, Qg = null;
Mg.className = "ContextMenuTool";
Ma("contextMenuTool", function () {
return this.findTool("ContextMenu")
}, function (a) {
Pe(this, "ContextMenu", a, this.mouseUpTools)
});
function Xg() {
Ee.call(this);
this.name = "TextEditing";
this.lh = new Yg;
this.Ma = null;
this.La = Zg;
this.yi = null;
this.la = $g;
this.K = 1;
this.ba = !0;
this.u = null;
this.l = new Oe;
this.Pt = null;
ah(this, this.l)
}
la(Xg, Ee);
function ah(a, b) {
if (Wg) {
var c = ta("textarea");
a.Pt = c;
c.addEventListener("input", function () {
if (null !== a.textBlock) {
var b = a.sx(this.value);
this.style.width = 20 + b.measuredBounds.width * this.Vz + "px";
this.rows = b.lineCount
}
}, !1);
c.addEventListener("keydown", function (b) {
if (null !== a.textBlock) {
var c = b.which;
13 === c ? (!1 === a.textBlock.isMultiline && b.preventDefault(), a.acceptText(bh)) : 9 === c ? (a.acceptText(ch), b.preventDefault()) : 27 === c && (a.doCancel(), null !== a.diagram && a.diagram.doFocus())
}
}, !1);
c.addEventListener("focus",
function () {
if (null !== a.currentTextEditor && a.state !== $g) {
var b = a.Pt;
a.la === dh && (a.la = eh);
"function" === typeof b.select && a.selectsTextOnActivate && (b.select(), b.setSelectionRange(0, 9999))
}
}, !1);
c.addEventListener("blur", function () {
if (null !== a.currentTextEditor && a.state !== $g) {
var b = a.Pt;
"function" === typeof b.focus && b.focus();
"function" === typeof b.select && a.selectsTextOnActivate && (b.select(), b.setSelectionRange(0, 9999))
}
}, !1);
b.valueFunction = function () {
return c.value
};
b.mainElement = c;
b.show = function (a,
b, f) {
if (a instanceof Yg && f instanceof Xg) if (f.state === nh) c.style.border = "3px solid red", c.focus(); else {
var d = a.ma(Fc), e = b.position, k = b.scale, l = a.De() * k;
l < f.minimumEditorScale && (l = f.minimumEditorScale);
var m = a.naturalBounds.width * l + 6, n = a.naturalBounds.height * l + 2, p = (d.x - e.x) * k;
d = (d.y - e.y) * k;
c.value = a.text;
b.div.style.font = a.font;
c.style.position = "absolute";
c.style.zIndex = "100";
c.style.font = "inherit";
c.style.fontSize = 100 * l + "%";
c.style.lineHeight = "normal";
c.style.width = m + "px";
c.style.left = (p - m / 2 | 0) - 1 +
"px";
c.style.top = (d - n / 2 | 0) - 1 + "px";
c.style.textAlign = a.textAlign;
c.style.margin = "0";
c.style.padding = "1px";
c.style.border = "0";
c.style.outline = "none";
c.style.whiteSpace = "pre-wrap";
c.style.overflow = "hidden";
c.rows = a.lineCount;
c.Vz = l;
c.className = "goTXarea";
b.div.appendChild(c);
c.focus();
f.selectsTextOnActivate && (c.select(), c.setSelectionRange(0, 9999))
}
};
b.hide = function (a) {
a.div.removeChild(c)
}
}
}
Xg.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (null === a || a.isReadOnly || !a.lastInput.left || this.isBeyondDragSize()) return !1;
var b = a.Rb(a.lastInput.documentPoint);
if (!(null !== b && b instanceof Yg && b.editable && b.part.canEdit())) return !1;
b = b.part;
return null === b || this.starting === Zg && !b.isSelected || this.starting === oh && 2 > a.lastInput.clickCount ? !1 : !0
};
Xg.prototype.doStart = function () {
this.isActive || null === this.textBlock || this.doActivate()
};
Xg.prototype.doActivate = function () {
if (!this.isActive) {
var a = this.diagram;
if (null !== a) {
var b = this.textBlock;
null === b && (b = a.Rb(a.lastInput.documentPoint));
if (null !== b && b instanceof Yg && (this.textBlock = b, null !== b.part)) {
this.isActive = !0;
this.la = dh;
var c = this.defaultTextEditor;
null !== b.textEditor && (c = b.textEditor);
this.lh = this.textBlock.copy();
var d = new N(this.textBlock.ma(zc), this.textBlock.ma(Jc));
a.Hv(d);
c.show(b, a, this);
this.currentTextEditor = c
}
}
}
};
Xg.prototype.doCancel = function () {
this.stopTool()
};
Xg.prototype.doMouseUp = function () {
!this.isActive && this.canStart() && this.doActivate()
};
Xg.prototype.doMouseDown = function () {
this.isActive && this.acceptText(ph)
};
Xg.prototype.acceptText = function (a) {
switch (a) {
case ph:
if (this.la === qh) this.currentTextEditor instanceof HTMLElement && this.currentTextEditor.focus(); else if (this.la === dh || this.la === nh || this.la === eh) this.la = rh, sh(this);
break;
case th:
case bh:
case ch:
if (bh !== a || !0 !== this.textBlock.isMultiline) if (this.la === dh || this.la === nh || this.la === eh) this.la = rh, sh(this)
}
};
function sh(a) {
var b = a.textBlock, c = a.diagram, d = a.currentTextEditor;
if (null !== b && null !== d) {
var e = b.text, f = "";
null !== d.valueFunction && (f = d.valueFunction());
a.isValidText(b, e, f) ? (a.Aa(a.name), a.la = qh, a.transactionResult = a.name, b.text = f, null !== b.textEdited && b.textEdited(b, e, f), null !== c && c.aa("TextEdited", b, e), a.zg(), a.stopTool(), null !== c && c.doFocus()) : (a.la = nh, null !== b.errorFunction && b.errorFunction(a, e, f), d.show(b, c, a))
}
}
Xg.prototype.doDeactivate = function () {
var a = this.diagram;
null !== a && (this.la = $g, this.textBlock = null, null !== this.currentTextEditor && this.currentTextEditor.hide(a, this), this.isActive = !1)
};
Xg.prototype.isValidText = function (a, b, c) {
var d = this.textValidation;
if (null !== d && !d(a, b, c)) return !1;
d = a.textValidation;
return null === d || d(a, b, c) ? !0 : !1
};
Xg.prototype.sx = function (a) {
var b = this.lh;
b.text = a;
b.measure(this.textBlock.kl, Infinity);
return b
};
ma.Object.defineProperties(Xg.prototype, {
textBlock: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma = a
}
}, currentTextEditor: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, defaultTextEditor: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}, starting: {
get: function () {
return this.La
}, set: function (a) {
this.La = a
}
}, textValidation: {
get: function () {
return this.yi
},
set: function (a) {
this.yi = a
}
}, minimumEditorScale: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, selectsTextOnActivate: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}, state: {
get: function () {
return this.la
}, set: function (a) {
this.la !== a && (this.la = a)
}
}
});
Xg.prototype.measureTemporaryTextBlock = Xg.prototype.sx;
var th = new D(Xg, "LostFocus", 0), ph = new D(Xg, "MouseDown", 1), ch = new D(Xg, "Tab", 2),
bh = new D(Xg, "Enter", 3), uh = new D(Xg, "SingleClick", 0), Zg = new D(Xg, "SingleClickSelected", 1),
oh = new D(Xg, "DoubleClick", 2), $g = new D(Xg, "StateNone", 0), dh = new D(Xg, "StateActive", 1),
eh = new D(Xg, "StateEditing", 2), rh = new D(Xg, "StateValidating", 3), nh = new D(Xg, "StateInvalid", 4),
qh = new D(Xg, "StateValidated", 5);
Xg.className = "TextEditingTool";
Xg.LostFocus = th;
Xg.MouseDown = ph;
Xg.Tab = ch;
Xg.Enter = bh;
Xg.SingleClick = uh;
Xg.SingleClickSelected = Zg;
Xg.DoubleClick = oh;
Xg.StateNone = $g;
Xg.StateActive = dh;
Xg.StateEditing = eh;
Xg.StateValidating = rh;
Xg.StateInvalid = nh;
Xg.StateValidated = qh;
Ma("textEditingTool", function () {
return this.findTool("TextEditing")
}, function (a) {
Pe(this, "TextEditing", a, this.mouseUpTools)
});
function vh() {
wh || (xh(), wh = !0);
this.ow = yh;
this.C = Fe;
this.rn = this.sn = null;
this.aj = this.tn = this.un = 0;
this.Ck = this.oi = this.rb = this.Ir = this.Nf = !1;
this.Of = this.Dc = !0;
this.$q = this.Zq = this.nw = null;
this.mw = 0;
this.br = new vb;
this.Vt = 600;
this.Tx = new G(0, 0);
this.kw = this.jw = this.Lw = !1;
this.ae = new F;
this.zj = new vb;
this.cs = new F;
this.ar = null
}
function zh(a) {
a.aj = 0;
a.br.clear();
a.$q = null;
a.Zq = null;
a.sn = null;
a.rn = null;
a.un = 0;
a.tn = 0;
a.zj.clear();
0 < a.cs.count && a.cs.clear();
a.ar = null
}
vh.prototype.hb = function (a) {
this.C = a
};
function yh(a, b, c, d) {
a /= d / 2;
return 1 > a ? c / 2 * a * a + b : -c / 2 * (--a * (a - 2) - 1) + b
}
vh.prototype.canStart = function () {
return !0
};
t = vh.prototype;
t.Ui = function (a, b) {
this.Dc && (void 0 !== b && (this.ar = b), (this.Of || this.C.Ri) && this.canStart(a) && (this.ae.add(a), this.Nf && this.vd(), this.oi = this.rb = !0))
};
t.Gz = function (a, b) {
this.Dc && (void 0 !== b && (this.ar = b), this.Of || this.C.Ri) && (this.ae.add(a), this.canStart(a) && (this.Nf && this.vd(), this.rb = !0))
};
function Ah(a) {
if (a.Dc) if (a.ae.contains("Model") && !a.Of || !a.Ck) a.ae.clear(), a.rb = !1, a.oi = !1, zh(a); else if (a.ae.clear(), a.rb && 0 === a.aj) {
var b = +new Date;
a.aj = b;
x.requestAnimationFrame(function () {
if (!1 !== a.rb && !a.Nf && a.aj === b) {
var c = a.C;
c.Ee("temporaryPixelRatio") && bf(c);
Bh(c);
a.rb = !1;
a.oi = !1;
c.aa("AnimationStarting");
Ch(a, b)
}
})
}
}
t.th = function (a, b, c, d, e, f) {
if (!(!this.rb || "position" === b && c.A(d) || a instanceof S && !a.isAnimated)) {
var g = this.zj;
if (g.contains(a)) {
var h = g.J(a);
g = h.start;
var k = h.end;
void 0 === g[b] && (g[b] = Dh(c));
k[b] = Dh(d)
} else h = {}, k = {}, h[b] = Dh(c), k[b] = Dh(d), d = h.position, d instanceof G && !d.o() && this.ae.contains("Expand SubGraph") && d.assign(k.position), h = new Eh(h, k, e), g.add(a, h);
e && 0 === b.indexOf("position:") && a instanceof S ? h.Wu.location = Dh(a.location) : e && (h.Wu[b] = Dh(c));
f && (h.pt = !0);
this.Ck = !0
}
};
function Dh(a) {
return a instanceof G ? a.copy() : a instanceof M ? a.copy() : a
}
function Fh(a, b) {
if (!a.Nf) return !1;
a = a.zj.J(b);
return null !== a && a.pt
}
function Ch(a, b) {
function c() {
if (!1 !== e.Nf && e.aj === b) {
var a = +new Date, f = a > q ? l : a - r;
Gh(e);
Hh(e, d, p, g, f, l);
e.Zq && e.Zq();
Lf(d);
Ih(e);
a > q ? Jh(e) : x.requestAnimationFrame(c)
}
}
var d = a.C;
if (null !== d) {
var e = a, f = a.ar || {}, g = f.bA || a.ow, h = f.fA || null, k = f.gA || null, l = f.duration || a.Vt,
m = a.Tx;
for (f = a.zj.iterator; f.next();) {
var n = f.value.start.position;
n instanceof G && (n.o() || n.assign(m))
}
a.nw = g;
a.Zq = h;
a.$q = k;
a.mw = l;
a.br = a.zj;
var p = a.br;
for (f = p.iterator; f.next();) h = f.value.end, h["position:placeholder"] && (k = f.key.findVisibleNode(),
k instanceof U && null !== k.placeholder && (m = k.placeholder, k = m.ma(zc), m = m.padding, k.x += m.left, k.y += m.top, h["position:placeholder"] = k));
a.Nf = !0;
Gh(a);
Hh(a, d, p, g, 0, l);
Lf(a.C, !0);
Ih(a);
var r = +new Date, q = r + l;
e.aj === b && x.requestAnimationFrame(function () {
c()
})
}
}
function Gh(a) {
if (!a.Ir) {
var b = a.C;
a.Lw = b.skipsUndoManager;
a.jw = b.skipsModelSourceBindings;
a.kw = b.tk;
b.skipsUndoManager = !0;
b.skipsModelSourceBindings = !0;
b.tk = !0;
a.Ir = !0
}
}
function Ih(a) {
var b = a.C;
b.skipsUndoManager = a.Lw;
b.skipsModelSourceBindings = a.jw;
b.tk = a.kw;
a.Ir = !1
}
function Hh(a, b, c, d, e, f) {
for (c = c.iterator; c.next();) {
var g = c.key, h = c.value, k = h.start, l = h.end, m = Kh;
for (n in l) "position" === n && (l["position:placeholder"] || l["position:node"]) || null === m.get(n) || m.get(n)(g, k[n], l[n], d, e, f, h)
}
d = b.lv;
b.lv = !0;
var n = a.ow;
0 !== a.un && 0 !== a.tn && (c = a.un, b.Ca = n(e, c, a.tn - c, f));
null !== a.sn && null !== a.rn && (c = a.sn, a = a.rn, b.sa = new G(n(e, c.x, a.x - c.x, f), n(e, c.y, a.y - c.y, f)));
b.lv = d
}
t.vd = function () {
!0 === this.rb && (this.oi = this.rb = !1, this.ae.clear(), this.aj = 0, this.Ck && this.C.cc());
this.Nf && this.Dc && Jh(this)
};
function Jh(a) {
a.Nf = !1;
a.Ck = !1;
Gh(a);
for (var b = a.C, c = a.nw, d = a.mw, e = a.br, f = a.cs.iterator; f.next();) f.value.s();
e = e.iterator;
for (f = Kh; e.next();) {
var g = e.key, h = e.value, k = h.start, l = h.end, m = h.Wu, n;
for (n in l) if (null !== f.get(n)) {
var p = n;
!h.Ru || "position:node" !== p && "position:placeholder" !== p || (p = "position");
f.get(p)(g, k[n], void 0 !== m[n] ? m[n] : h.Ru ? k[n] : l[n], c, d, d)
}
h.Ru && void 0 !== m.location && g instanceof S && (g.location = m.location);
h.pt && g instanceof S && g.Lb(!1)
}
for (c = a.C.links; c.next();) d = c.value, null !== d.dh &&
(d.points = d.dh, d.dh = null);
b.gt.clear();
mf(b, !1);
b.Xa();
b.R();
b.fd();
Lh(b);
Ih(a);
a.$q && a.$q();
zh(a);
b.aa("AnimationFinished");
b.cc()
}
t.Np = function (a, b) {
if (this.oi && (this.ae.contains("Expand Tree") || this.ae.contains("Expand SubGraph"))) {
var c = b.actualBounds, d = null;
b instanceof U && (d = b.placeholder);
null !== d ? (c = d.ma(zc), d = d.padding, c.x += d.left, c.y += d.top, this.th(a, "position", c, a.position, !1)) : this.th(a, "position", new G(c.x + c.width / 2, c.y + c.height / 2), a.position, !1);
this.th(a, "scale", .01, a.scale, !1);
if (a instanceof U) for (a = a.memberParts; a.next();) d = a.value, d instanceof V && this.Np(d, b)
}
};
t.Mp = function (a, b) {
if (a.isVisible() && this.oi && (this.ae.contains("Collapse Tree") || this.ae.contains("Collapse SubGraph"))) {
var c = null;
b instanceof U && (c = b.placeholder);
null !== c ? this.th(a, "position:placeholder", a.position, c, !0) : this.th(a, "position:node", a.position, b, !0);
this.th(a, "scale", a.scale, .01, !0);
this.rb && (c = this.zj, c.contains(a) && (c.J(a).pt = !0));
if (a instanceof U) for (a = a.memberParts; a.next();) c = a.value, c instanceof V && this.Mp(c, b)
}
};
function Mh(a, b, c) {
a.rb && !b.A(c) && (null === a.sn && b.o() && null === a.rn && (a.sn = b.copy()), a.rn = c.copy(), a.Ck = !0)
}
function Nh(a, b, c) {
a.rb && a.C.Ri && (0 === a.un && 0 === a.tn && (a.un = b), a.tn = c, a.Ck = !0)
}
function xh() {
var a = new vb;
a.add("position", function (a, c, d, e, f, g) {
f !== g ? a.wt(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g)) : a.position = new G(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g))
});
a.add("position:placeholder", function (a, c, d, e, f, g) {
f !== g ? a.wt(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g)) : a.position = new G(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g))
});
a.add("position:node", function (a, c, d, e, f, g) {
var b = a.actualBounds, k = d.actualBounds;
d = k.x + k.width / 2 - b.width / 2;
b = k.y + k.height / 2 - b.height / 2;
f !== g ? a.wt(e(f, c.x, d - c.x, g), e(f,
c.y, b - c.y, g)) : a.position = new G(e(f, c.x, d - c.x, g), e(f, c.y, b - c.y, g))
});
a.add("opacity", function (a, c, d, e, f, g) {
a.opacity = e(f, c, d - c, g)
});
a.add("scale", function (a, c, d, e, f, g) {
a.scale = e(f, c, d - c, g)
});
a.add("angle", function (a, c, d, e, f, g) {
a.angle = e(f, c, d - c, g)
});
a.add("visible", function (a, c, d, e, f, g) {
a.visible = f !== g ? c : d
});
Kh = a
}
ma.Object.defineProperties(vh.prototype, {
animationReasons: {
get: function () {
return this.ae
}
}, isEnabled: {
get: function () {
return this.Dc
}, set: function (a) {
this.Dc = a
}
}, duration: {
get: function () {
return this.Vt
}, set: function (a) {
1 > a && va(a, ">= 1", vh, "duration");
this.Vt = a
}
}, isAnimating: {
get: function () {
return this.Nf
}
}, isTicking: {
get: function () {
return this.Ir
}
}, isInitial: {
get: function () {
return this.Of
}, set: function (a) {
this.Of = a
}
}
});
vh.prototype.stopAnimation = vh.prototype.vd;
vh.prototype.addToAnimation = vh.prototype.th;
vh.prototype.prepareAnimation = vh.prototype.Gz;
vh.prototype.prepareAutomaticAnimation = vh.prototype.Ui;
var Kh = null, wh = !1;
vh.className = "AnimationManager";
function Eh(a, b, c) {
this.start = a;
this.end = b;
this.Wu = {};
this.Ru = c;
this.pt = !1
}
Eh.className = "AnimationStates";
function Oh() {
ab(this);
this.C = null;
this.Fa = new E;
this.Ua = "";
this.lb = 1;
this.u = !1;
this.Dj = this.K = this.Ph = this.Oh = this.Nh = this.Mh = this.Kh = this.Lh = this.Jh = this.Rh = this.Ih = this.Qh = this.Hh = this.Gh = !0;
this.l = !1;
this.Mo = []
}
t = Oh.prototype;
t.hb = function (a) {
this.C = a
};
t.toString = function (a) {
void 0 === a && (a = 0);
var b = 'Layer "' + this.name + '"';
if (0 >= a) return b;
for (var c = 0, d = 0, e = 0, f = 0, g = 0, h = this.Fa.iterator; h.next();) {
var k = h.value;
k instanceof U ? e++ : k instanceof V ? d++ : k instanceof R ? f++ : k instanceof Je ? g++ : c++
}
h = "";
0 < c && (h += c + " Parts ");
0 < d && (h += d + " Nodes ");
0 < e && (h += e + " Groups ");
0 < f && (h += f + " Links ");
0 < g && (h += g + " Adornments ");
if (1 < a) for (a = this.Fa.iterator; a.next();) c = a.value, h += "\n " + c.toString(), d = c.data, null !== d && lb(d) && (h += " #" + lb(d)), c instanceof V ? h += " " +
Ja(d) : c instanceof R && (h += " " + Ja(c.fromNode) + " " + Ja(c.toNode));
return b + " " + this.Fa.count + ": " + h
};
t.Rb = function (a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
if (!1 === this.Dj) return null;
var d = !1;
null !== this.diagram && this.diagram.viewportBounds.da(a) && (d = !0);
for (var e = G.alloc(), f = this.Fa.j, g = f.length; g--;) {
var h = f[g];
if ((!0 !== d || !1 !== Kf(h)) && h.isVisible() && (e.assign(a), zb(e, h.rd), h = h.Rb(e, b, c), null !== h && (null !== b && (h = b(h)), null !== h && (null === c || c(h))))) return G.free(e), h
}
G.free(e);
return null
};
t.Ii = function (a, b, c, d) {
void 0 === b && (b = null);
void 0 === c && (c = null);
d instanceof E || d instanceof F || (d = new F);
if (!1 === this.Dj) return d;
var e = !1;
null !== this.diagram && this.diagram.viewportBounds.da(a) && (e = !0);
for (var f = G.alloc(), g = this.Fa.j, h = g.length; h--;) {
var k = g[h];
if ((!0 !== e || !1 !== Kf(k)) && k.isVisible()) {
f.assign(a);
zb(f, k.rd);
var l = k;
k.Ii(f, b, c, d) && (null !== b && (l = b(l)), null === l || null !== c && !c(l) || d.add(l))
}
}
G.free(f);
return d
};
t.qg = function (a, b, c, d, e) {
void 0 === b && (b = null);
void 0 === c && (c = null);
void 0 === d && (d = !1);
e instanceof E || e instanceof F || (e = new F);
if (!1 === this.Dj) return e;
var f = !1;
null !== this.diagram && this.diagram.viewportBounds.nf(a) && (f = !0);
for (var g = this.Fa.j, h = g.length; h--;) {
var k = g[h];
if ((!0 !== f || !1 !== Kf(k)) && k.isVisible()) {
var l = k;
k.qg(a, b, c, d, e) && (null !== b && (l = b(l)), null === l || null !== c && !c(l) || e.add(l))
}
}
return e
};
t.rg = function (a, b, c, d, e, f) {
void 0 === c && (c = null);
void 0 === d && (d = null);
void 0 === e && (e = !0);
if (!1 !== e && !0 !== e) {
if (e instanceof E || e instanceof F) f = e;
e = !0
}
f instanceof E || f instanceof F || (f = new F);
if (!1 === this.Dj) return f;
var g = !1;
null !== this.diagram && this.diagram.viewportBounds.da(a) && (g = !0);
for (var h = G.alloc(), k = G.alloc(), l = this.Fa.j, m = l.length; m--;) {
var n = l[m];
if ((!0 !== g || !1 !== Kf(n)) && n.isVisible()) {
h.assign(a);
zb(h, n.rd);
k.h(a.x + b, a.y);
zb(k, n.rd);
var p = n;
n.rg(h, k, c, d, e, f) && (null !== c && (p = c(p)), null ===
p || null !== d && !d(p) || f.add(p))
}
}
G.free(h);
G.free(k);
return f
};
t.hd = function (a, b) {
if (this.visible) {
var c = void 0 === b ? a.viewportBounds : b;
var d = this.Fa.j, e = d.length;
a = Da();
b = Da();
for (var f = 0; f < e; f++) {
var g = d[f];
g.Aw = f;
g instanceof R && !1 === g.Lc || g instanceof Je && null !== g.adornedPart || (dc(g.actualBounds, c, 10) ? (g.hd(!0), a.push(g)) : (g.hd(!1), null !== g.adornments && 0 < g.adornments.count && b.push(g)))
}
for (c = 0; c < a.length; c++) for (d = a[c], Ph(d), d = d.adornments; d.next();) e = d.value, e.measure(Infinity, Infinity), e.arrange(), e.hd(!0);
for (c = 0; c < b.length; c++) d = b[c], d.updateAdornments(),
Qh(d, !0);
Ga(a);
Ga(b)
}
};
t.hc = function (a, b, c) {
if (this.visible && 0 !== this.lb && (void 0 === c && (c = !0), c || !this.isTemporary)) {
c = this.Fa.j;
var d = c.length;
if (0 !== d) {
1 !== this.lb && (a.globalAlpha = this.lb);
var e = this.Mo;
e.length = 0;
for (var f = b.scale, g = 0; g < d; g++) {
var h = c[g];
if (Kf(h)) {
if (h instanceof R && (h.isOrthogonal && e.push(h), !1 === h.Lc)) continue;
var k = h.actualBounds;
k.width * f > b.oe || k.height * f > b.oe ? h.hc(a, b) : Rh(a, h)
}
}
a.globalAlpha = 1
}
}
};
function Rh(a, b) {
var c = b.actualBounds, d = b.naturalBounds;
if (0 !== c.width && 0 !== c.height && !isNaN(c.x) && !isNaN(c.y) && b.isVisible()) {
var e = b.transform;
null !== b.areaBackground && (Sh(b, a, b.areaBackground, !0, !0, d, c), a.fillRect(c.x, c.y, c.width, c.height));
null === b.areaBackground && null === b.background && (Sh(b, a, "rgba(0,0,0,0.3)", !0, !1, d, c), a.fillRect(c.x, c.y, c.width, c.height));
null !== b.background && (a.transform(e.m11, e.m12, e.m21, e.m22, e.dx, e.dy), Sh(b, a, b.background, !0, !1, d, c), a.fillRect(0, 0, d.width / 2, d.height / 2),
e.ct() || (b = 1 / (e.m11 * e.m22 - e.m12 * e.m21), a.transform(e.m22 * b, -e.m12 * b, -e.m21 * b, e.m11 * b, b * (e.m21 * e.dy - e.m22 * e.dx), b * (e.m12 * e.dx - e.m11 * e.dy))))
}
}
t.g = function (a, b, c, d, e) {
var f = this.diagram;
null !== f && f.ab(re, a, this, b, c, d, e)
};
t.Qi = function (a, b, c) {
var d = this.Fa;
b.hi = this;
if (a >= d.count) a = d.count; else if (d.N(a) === b) return -1;
d.Ib(a, b);
b.bq(c);
d = this.diagram;
null !== d && (c ? d.R() : d.Qi(b));
Th(this, a, b);
return a
};
t.xc = function (a, b, c) {
if (!c && b.layer !== this && null !== b.layer) return b.layer.xc(a, b, c);
var d = this.Fa;
if (0 > a || a >= d.length) {
if (a = d.indexOf(b), 0 > a) return -1
} else if (d.N(a) !== b && (a = d.indexOf(b), 0 > a)) return -1;
b.cq(c);
d.mb(a);
d = this.diagram;
null !== d && (c ? d.R() : d.xc(b));
b.hi = null;
return a
};
function Th(a, b, c) {
b = Uh(a, b, c);
if (c instanceof U && null !== c && isNaN(c.zOrder)) {
if (0 !== c.memberParts.count) {
for (var d = -1, e = a.Fa.j, f = e.length, g = 0; g < f; g++) {
var h = e[g];
if (h === c && (b = g, 0 <= d)) break;
if (0 > d && h.containingGroup === c && (d = g, 0 <= b)) break
}
!(0 > d) && d < b && (e = a.Fa, e.mb(b), e.Ib(d, c))
}
c = c.containingGroup;
null !== c && Th(a, -1, c)
}
}
function Uh(a, b, c) {
var d = c.zOrder;
if (isNaN(d)) return b;
a = a.Fa;
var e = a.count;
if (1 >= e) return b;
0 > b && (b = a.indexOf(c));
if (0 > b) return -1;
for (var f = b - 1, g = NaN; 0 <= f;) {
g = a.N(f).zOrder;
if (!isNaN(g)) break;
f--
}
for (var h = b + 1, k = NaN; h < e;) {
k = a.N(h).zOrder;
if (!isNaN(k)) break;
h++
}
if (!isNaN(g) && g > d) for (; ;) {
if (-1 === f || g <= d) {
f++;
if (f === b) break;
a.mb(b);
a.Ib(f, c);
return f
}
for (g = NaN; 0 <= --f && (g = a.N(f).zOrder, isNaN(g));) ;
} else if (!isNaN(k) && k < d) for (; ;) {
if (h === e || k >= d) {
h--;
if (h === b) break;
a.mb(b);
a.Ib(h, c);
return h
}
for (k = NaN; ++h <
e && (k = a.N(h).zOrder, isNaN(k));) ;
}
return b
}
t.clear = function () {
for (var a = this.Fa.Na(), b = a.length, c = 0; c < b; c++) a[c].hd(!1), this.xc(-1, a[c], !1);
this.Mo.length = 0
};
ma.Object.defineProperties(Oh.prototype, {
parts: {
get: function () {
return this.Fa.iterator
}
}, partsBackwards: {
get: function () {
return this.Fa.iteratorBackwards
}
}, diagram: {
get: function () {
return this.C
}
}, name: {
get: function () {
return this.Ua
}, set: function (a) {
var b = this.Ua;
if (b !== a) {
var c = this.diagram;
if (null !== c) for ("" === b && B("Cannot rename default Layer to: " + a), c = c.layers; c.next();) c.value.name ===
a && B("Layer.name is already present in this diagram: " + a);
this.Ua = a;
this.g("name", b, a);
for (a = this.Fa.iterator; a.next();) a.value.layerName = this.Ua
}
}
}, opacity: {
get: function () {
return this.lb
}, set: function (a) {
var b = this.lb;
b !== a && ((0 > a || 1 < a) && va(a, "0 <= value <= 1", Oh, "opacity"), this.lb = a, this.g("opacity", b, a), a = this.diagram, null !== a && a.R())
}
}, isTemporary: {
get: function () {
return this.u
}, set: function (a) {
var b = this.u;
b !== a && (this.u = a, this.g("isTemporary",
b, a))
}
}, visible: {
get: function () {
return this.K
}, set: function (a) {
var b = this.K;
if (b !== a) {
this.K = a;
this.g("visible", b, a);
for (b = this.Fa.iterator; b.next();) b.value.Lb(a);
a = this.diagram;
null !== a && a.R()
}
}
}, pickable: {
get: function () {
return this.Dj
}, set: function (a) {
var b = this.Dj;
b !== a && (this.Dj = a, this.g("pickable", b, a))
}
}, isBoundsIncluded: {
get: function () {
return this.l
}, set: function (a) {
this.l !== a && (this.l = a, null !== this.diagram &&
this.diagram.Xa())
}
}, allowCopy: {
get: function () {
return this.Gh
}, set: function (a) {
var b = this.Gh;
b !== a && (this.Gh = a, this.g("allowCopy", b, a))
}
}, allowDelete: {
get: function () {
return this.Hh
}, set: function (a) {
var b = this.Hh;
b !== a && (this.Hh = a, this.g("allowDelete", b, a))
}
}, allowTextEdit: {
get: function () {
return this.Qh
}, set: function (a) {
var b = this.Qh;
b !== a && (this.Qh = a, this.g("allowTextEdit", b, a))
}
}, allowGroup: {
get: function () {
return this.Ih
}, set: function (a) {
var b = this.Ih;
b !== a && (this.Ih = a, this.g("allowGroup", b, a))
}
}, allowUngroup: {
get: function () {
return this.Rh
}, set: function (a) {
var b = this.Rh;
b !== a && (this.Rh = a, this.g("allowUngroup", b, a))
}
}, allowLink: {
get: function () {
return this.Jh
}, set: function (a) {
var b = this.Jh;
b !== a && (this.Jh = a, this.g("allowLink", b, a))
}
}, allowRelink: {
get: function () {
return this.Lh
}, set: function (a) {
var b =
this.Lh;
b !== a && (this.Lh = a, this.g("allowRelink", b, a))
}
}, allowMove: {
get: function () {
return this.Kh
}, set: function (a) {
var b = this.Kh;
b !== a && (this.Kh = a, this.g("allowMove", b, a))
}
}, allowReshape: {
get: function () {
return this.Mh
}, set: function (a) {
var b = this.Mh;
b !== a && (this.Mh = a, this.g("allowReshape", b, a))
}
}, allowResize: {
get: function () {
return this.Nh
}, set: function (a) {
var b = this.Nh;
b !== a && (this.Nh = a, this.g("allowResize", b, a))
}
},
allowRotate: {
get: function () {
return this.Oh
}, set: function (a) {
var b = this.Oh;
b !== a && (this.Oh = a, this.g("allowRotate", b, a))
}
}, allowSelect: {
get: function () {
return this.Ph
}, set: function (a) {
var b = this.Ph;
b !== a && (this.Ph = a, this.g("allowSelect", b, a))
}
}
});
Oh.prototype.findObjectsNear = Oh.prototype.rg;
Oh.prototype.findObjectsIn = Oh.prototype.qg;
Oh.prototype.findObjectsAt = Oh.prototype.Ii;
Oh.prototype.findObjectAt = Oh.prototype.Rb;
Oh.className = "Layer";
function P(a) {
function b() {
c.removeEventListener(x.document, "DOMContentLoaded", b, !1);
c.setRTL()
}
1 < arguments.length && B("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");
Vh || (Wh(), Vh = !0);
ab(this);
Fe = this;
Qa = [];
this.ob = !0;
this.Bk = new vh;
this.Bk.hb(this);
this.Gb = 17;
this.Tn = !1;
this.su = "default";
this.Ia = null;
var c = this;
Wg && (null !== x.document.body ? this.setRTL() : c.addEventListener(x.document, "DOMContentLoaded", b, !1));
this.Pa = new E;
this.wa = this.xa = 0;
this.Da = null;
this.qu =
new vb;
this.fg = this.Yc = null;
this.Fv();
this.el = null;
this.Ev();
this.sa = (new G(NaN, NaN)).freeze();
this.er = this.Ca = 1;
this.zr = (new G(NaN, NaN)).freeze();
this.Ar = NaN;
this.Ur = 1E-4;
this.Sr = 100;
this.tb = new wc;
this.Js = (new G(NaN, NaN)).freeze();
this.qr = (new N(NaN, NaN, NaN, NaN)).freeze();
this.ui = (new pc(0, 0, 0, 0)).freeze();
this.Ij = Xh;
this.ts = !1;
this.os = this.ks = null;
this.cj = Yh;
this.ej = ad;
this.ci = Yh;
this.On = ad;
this.Br = this.yr = zc;
this.nc = !0;
this.Pn = !1;
this.Dd = new F;
this.Yh = new vb;
this.xn = !0;
this.Tm = 250;
this.Dk = -1;
this.Um = (new pc(16, 16, 16, 16)).freeze();
this.Tk = this.qd = !1;
this.Yk = !0;
this.Zh = new ne;
this.Zh.diagram = this;
this.Ze = new ne;
this.Ze.diagram = this;
this.sj = new ne;
this.sj.diagram = this;
this.pe = this.Cf = null;
this.Nl = !1;
this.Rt = this.St = null;
this.Mq = x.PointerEvent && (Ta || Ua || Va) && x.navigator && !1 !== x.navigator.msPointerEnabled;
Zh(this);
this.Ai = new F;
this.Jr = !0;
this.Es = $h;
this.Vb = !1;
this.Gs = Pf;
this.Ma = null;
ai.add("Model", bi);
this.ba = this.La = this.Ub = null;
this.Yq = "";
this.qn = "auto";
this.Uf = this.Xr = this.Wf = this.Xf =
this.Zf = this.Ef = this.If = this.Df = null;
this.vr = !1;
this.Ff = this.kg = this.Yf = this.Vf = null;
this.lu = !1;
this.ou = {};
this.wl = [null, null];
this.K = null;
this.Qt = this.xu = this.Eh = this.fh = !1;
this.Vc = !0;
this.oj = this.Yb = !1;
this.Zb = null;
var d = this;
this.Ag = function (a) {
var b = d.partManager;
if (a.model === b.diagram.model && b.diagram.ea) {
b.diagram.ea = !1;
try {
var c = a.change;
"" === a.modelChange && c === re && b.updateDataBindings(a.object, a.propertyName)
} finally {
b.diagram.ea = !0
}
}
};
this.Dm = function (a) {
d.partManager.doModelChanged(a)
};
this.Nw = !0;
this.ge = -2;
this.Ej = new vb;
this.nu = new E;
this.Pf = !1;
this.Hh = this.Gh = this.Eq = this.Dc = !0;
this.Fq = !1;
this.Lq = this.Jq = this.Ph = this.Oh = this.Nh = this.Mh = this.Kh = this.Lh = this.Jh = this.Iq = this.Rh = this.Ih = this.Qh = this.Gq = !0;
this.Re = this.Kc = !1;
this.Kq = this.Hq = this.xr = this.wr = !0;
this.ss = this.qs = 16;
this.uu = this.ps = !1;
this.ip = this.rs = null;
this.vu = this.wu = 0;
this.eb = (new pc(5)).freeze();
this.Cq = (new F).freeze();
this.Tr = 999999999;
this.Aq = (new F).freeze();
this.di = this.mj = this.Sg = !0;
this.ai = this.Rg = !1;
this.gc =
null;
this.Dg = !0;
this.he = !1;
this.Bq = new F;
this.yw = new F;
this.Nb = null;
this.Ko = 1;
this.Hw = 0;
this.ye = {scale: 1, position: new G, bounds: new N, ox: !1};
this.Mw = (new N(NaN, NaN, NaN, NaN)).freeze();
this.Hp = (new M(NaN, NaN)).freeze();
this.vn = (new N(NaN, NaN, NaN, NaN)).freeze();
this.Kr = !1;
this.ir = null;
ci(this);
this.Pr = this.tr = this.$r = this.qw = this.pw = this.rw = this.Vg = this.$h = this.$f = null;
di(this);
this.Eb = null;
this.sr = !1;
this.Lk = null;
this.partManager = new bi;
this.toolManager = new Na;
this.toolManager.initializeStandardTools();
this.currentTool = this.defaultTool = this.toolManager;
this.hr = null;
this.Nk = new Ye;
this.es = this.ds = null;
this.yp = !1;
this.commandHandler = ei();
this.model = fi();
this.fh = !0;
this.layout = new gi;
this.fh = !1;
this.tw = this.Ut = null;
this.Mb = 1;
this.kh = null;
this.oe = 1;
this.wo = 0;
this.xo = [0, 0, 0, 0, 0];
this.yo = 0;
this.Fd = 1;
this.ll = 0;
this.Mr = new G;
this.Cu = 500;
this.Nq = new G;
this.Se = !1;
this.preventDefault = this.ot = this.lm = this.mm = this.km = this.jm = this.lk = this.nk = this.mk = this.jk = this.kk = this.aw = this.Tv = this.Uv = this.Vv = this.ti = this.cp =
this.si = this.bp = null;
this.u = !1;
this.bi = new hi;
this.Bs = !1;
void 0 !== a && ii(this, a);
this.ob = !1
}
P.prototype.clear = function () {
this.model.clear();
ji = null;
ki = "";
li(this, !1);
this.vn = (new N(NaN, NaN, NaN, NaN)).freeze();
this.R()
};
function li(a, b) {
var c = null;
null !== a.Eb && (c = a.Eb.part);
a.animationManager.vd();
for (var d = [], e = a.Pa.length, f = 0; f < e; f++) {
var g = a.Pa.j[f];
if (b) for (var h = g.parts; h.next();) {
var k = h.value;
k !== c && null === k.data && d.push(k)
}
g.clear()
}
a.partManager.clear();
a.Dd.clear();
a.Yh.clear();
a.Ai.clear();
a.Rp();
a.Mu();
a.Lk = null;
Ea = [];
null !== c && (a.add(c), a.partManager.parts.remove(c));
if (b) for (b = 0; b < d.length; b++) a.add(d[b])
}
function ei() {
return null
}
P.prototype.reset = function () {
this.ob = !0;
this.clear();
this.Bk = new vh;
this.Bk.hb(this);
this.Pa = new E;
this.Fv();
this.Ev();
this.sa = (new G(NaN, NaN)).freeze();
this.Ca = 1;
this.zr = (new G(NaN, NaN)).freeze();
this.Ar = NaN;
this.Ur = 1E-4;
this.Sr = 100;
this.Js = (new G(NaN, NaN)).freeze();
this.qr = (new N(NaN, NaN, NaN, NaN)).freeze();
this.ui = (new pc(0, 0, 0, 0)).freeze();
this.Ij = Xh;
this.ts = !1;
this.os = this.ks = null;
this.cj = Yh;
this.ej = ad;
this.ci = Yh;
this.On = ad;
this.Br = this.yr = zc;
this.Tm = 250;
this.Um = (new pc(16, 16, 16, 16)).freeze();
this.Jr = !0;
this.Es = $h;
this.Gs = Pf;
this.qn = "auto";
this.Uf = this.Xr = this.Wf = this.Xf = this.Zf = this.Ef = this.If = this.Df = null;
this.vr = !1;
this.Ff = this.kg = this.Yf = this.Vf = null;
this.Pf = !1;
this.Hh = this.Gh = this.Eq = this.Dc = !0;
this.Fq = !1;
this.Kq = this.Hq = this.xr = this.wr = this.Lq = this.Jq = this.Ph = this.Oh = this.Nh = this.Mh = this.Kh = this.Lh = this.Jh = this.Iq = this.Rh = this.Ih = this.Qh = this.Gq = !0;
this.ss = this.qs = 16;
this.eb = (new pc(5)).freeze();
this.Tr = 999999999;
this.gc = null;
this.Kr = !1;
this.Mb = 1;
this.kh = null;
this.wo = 0;
this.xo = [0,
0, 0, 0, 0];
this.yo = 0;
di(this);
this.Eb = null;
this.partManager = new bi;
this.toolManager = new Na;
this.toolManager.initializeStandardTools();
this.es = this.ds = this.hr = null;
this.yp = !1;
this.Nk.reset();
this.qu = new vb;
this.qu.clear();
this.currentTool = this.defaultTool = this.toolManager;
this.commandHandler = ei();
this.fh = !0;
ci(this);
this.layout = new gi;
this.fh = !1;
this.model = fi();
this.model.undoManager = new Ce;
this.he = !1;
this.Yk = !0;
this.ob = this.qd = !1;
this.R();
this.pe = this.Cf = null;
Zh(this);
this.Yq = ""
};
function di(a) {
a.$f = new vb;
var b = new V, c = new Yg;
c.bind(new si("text", "", Ja));
b.add(c);
a.rw = b;
a.$f.add("", b);
b = new V;
c = new Yg;
c.stroke = "brown";
c.bind(new si("text", "", Ja));
b.add(c);
a.$f.add("Comment", b);
b = new V;
b.selectable = !1;
b.avoidable = !1;
c = new W;
c.figure = "Ellipse";
c.fill = "black";
c.stroke = null;
c.desiredSize = (new M(3, 3)).ga();
b.add(c);
a.$f.add("LinkLabel", b);
a.$h = new vb;
b = new U;
b.selectionObjectName = "GROUPPANEL";
b.type = X.Vertical;
c = new Yg;
c.font = "bold 12pt sans-serif";
c.bind(new si("text", "", Ja));
b.add(c);
c = new X(X.Auto);
c.name = "GROUPPANEL";
var d = new W;
d.figure = "Rectangle";
d.fill = "rgba(128,128,128,0.2)";
d.stroke = "black";
c.add(d);
d = new zg;
d.padding = (new pc(5, 5, 5, 5)).ga();
c.add(d);
b.add(c);
a.pw = b;
a.$h.add("", b);
a.Vg = new vb;
b = new R;
c = new W;
c.isPanelMain = !0;
b.add(c);
c = new W;
c.toArrow = "Standard";
c.fill = "black";
c.stroke = null;
c.strokeWidth = 0;
b.add(c);
a.qw = b;
a.Vg.add("", b);
b = new R;
c = new W;
c.isPanelMain = !0;
c.stroke = "brown";
b.add(c);
a.Vg.add("Comment", b);
b = new Je;
b.type = X.Auto;
c = new W;
c.fill = null;
c.stroke =
"dodgerblue";
c.strokeWidth = 3;
b.add(c);
c = new zg;
c.margin = (new pc(1.5, 1.5, 1.5, 1.5)).ga();
b.add(c);
a.$r = b;
a.tr = b;
b = new Je;
b.type = X.Link;
c = new W;
c.isPanelMain = !0;
c.fill = null;
c.stroke = "dodgerblue";
c.strokeWidth = 3;
b.add(c);
a.Pr = b
}
P.prototype.setRTL = function (a) {
a = void 0 === a ? this.div : a;
null === a && (a = x.document.body);
var b = ta("div");
b.dir = "rtl";
b.style.cssText = "font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";
b.textContent = "A";
a.appendChild(b);
var c = "reverse";
0 < b.scrollLeft ? c = "default" : (b.scrollLeft = 1, 0 === b.scrollLeft && (c = "negative"));
a.removeChild(b);
this.su = c
};
P.prototype.setScrollWidth = function (a) {
a = void 0 === a ? this.div : a;
null === a && (a = x.document.body);
var b = 0;
if (Wg) {
var c = ti;
b = ui;
null === c && (c = ti = ta("p"), c.style.width = "100%", c.style.height = "200px", c.style.boxSizing = "content-box", b = ui = ta("div"), b.style.position = "absolute", b.style.visibility = "hidden", b.style.width = "200px", b.style.height = "150px", b.style.boxSizing = "content-box", b.appendChild(c));
b.style.overflow = "hidden";
a.appendChild(b);
var d = c.offsetWidth;
b.style.overflow = "scroll";
c = c.offsetWidth;
d === c && (c =
b.clientWidth);
a.removeChild(b);
b = d - c;
0 !== b || Xa || (b = 11)
}
this.Gb = b
};
P.prototype.fb = function (a) {
a.classType === P && (this.autoScale = a)
};
P.prototype.toString = function (a) {
void 0 === a && (a = 0);
var b = "";
this.div && this.div.id && (b = this.div.id);
b = 'Diagram "' + b + '"';
if (0 >= a) return b;
for (var c = this.Pa.iterator; c.next();) b += "\n " + c.value.toString(a - 1);
return b
};
P.prototype.addEventListener = function (a, b, c, d) {
a.addEventListener(b, c, d)
};
P.prototype.removeEventListener = function (a, b, c, d) {
a.removeEventListener(b, c, d)
};
function vi(a) {
var b = a.Da.Ga;
b instanceof HTMLCanvasElement && (a.Mq ? (a.addEventListener(b, "pointerdown", a.jm, !1), a.addEventListener(b, "pointermove", a.km, !1), a.addEventListener(b, "pointerup", a.mm, !1), a.addEventListener(b, "pointerout", a.lm, !1)) : (a.addEventListener(b, "touchstart", a.Vv, !1), a.addEventListener(b, "touchmove", a.Uv, !1), a.addEventListener(b, "touchend", a.Tv, !1), a.addEventListener(b, "mousemove", a.kk, !1), a.addEventListener(b, "mousedown", a.jk, !1), a.addEventListener(b, "mouseup", a.mk, !1), a.addEventListener(b,
"mouseout", a.lk, !1)), a.addEventListener(b, "mouseenter", a.Cy, !1), a.addEventListener(b, "mouseleave", a.Dy, !1), a.addEventListener(b, "wheel", a.nk, !1), a.addEventListener(b, "keydown", a.sz, !1), a.addEventListener(b, "keyup", a.uz, !1), a.addEventListener(b, "blur", a.oy, !1), a.addEventListener(b, "focus", a.py, !1), a.addEventListener(b, "selectstart", function (a) {
a.preventDefault();
return !1
}, !1), a.addEventListener(b, "contextmenu", function (a) {
a.preventDefault();
return !1
}, !1), a.addEventListener(b, "gesturestart", function (b) {
a.toolManager.gestureBehavior !==
Me && (a.toolManager.gestureBehavior === Le ? b.preventDefault() : a.Se && a.lastInput.handled || (b.preventDefault(), a.Ko = a.scale, a.currentTool.doCancel()))
}, !1), a.addEventListener(b, "gesturechange", function (b) {
if (a.toolManager.gestureBehavior !== Me) if (a.toolManager.gestureBehavior === Le) b.preventDefault(); else if (!a.Se || !a.lastInput.handled) {
b.preventDefault();
var c = b.scale;
if (null !== a.Ko) {
var e = a.Da.getBoundingClientRect();
b = new G(b.pageX - window.scrollX - a.xa / e.width * e.left, b.pageY - window.scrollY - a.wa / e.height *
e.top);
c = a.Ko * c;
e = a.commandHandler;
if (c !== a.scale && e.canResetZoom(c)) {
var f = a.zoomPoint;
a.zoomPoint = b;
e.resetZoom(c);
a.zoomPoint = f
}
}
}
}, !1), a.addEventListener(x, "resize", a.aw, !1))
}
function bf(a) {
30 < a.wo && (a.kh = 1)
}
function mf(a, b) {
null !== a.kh && (a.kh = null, b && a.ot(), a.wo = 0, a.xo = [0, 0, 0, 0, 0], a.yo = 0)
}
P.prototype.computePixelRatio = function () {
return null !== this.kh ? this.kh : x.devicePixelRatio || 1
};
P.prototype.doMouseMove = function () {
this.currentTool.doMouseMove()
};
P.prototype.doMouseDown = function () {
this.currentTool.doMouseDown()
};
P.prototype.doMouseUp = function () {
this.currentTool.doMouseUp()
};
P.prototype.doMouseWheel = function () {
this.currentTool.doMouseWheel()
};
P.prototype.doKeyDown = function () {
this.currentTool.doKeyDown()
};
P.prototype.doKeyUp = function () {
this.currentTool.doKeyUp()
};
P.prototype.doFocus = function () {
this.focus()
};
P.prototype.focus = function () {
if (this.Da) if (this.scrollsPageOnFocus) this.Da.focus(); else {
var a = x.scrollX || x.pageXOffset, b = x.scrollY || x.pageYOffset;
this.Da.focus();
x.scrollTo(a, b)
}
};
P.prototype.py = function () {
this.C.aa("GainedFocus")
};
P.prototype.oy = function () {
this.C.aa("LostFocus")
};
function Bh(a) {
if (null !== a.Da) {
var b = a.Ia;
if (0 !== b.clientWidth && 0 !== b.clientHeight) {
a.setScrollWidth();
var c = a.ai ? a.Gb : 0, d = a.Rg ? a.Gb : 0, e = a.Mb;
a.Mb = a.computePixelRatio();
a.Mb !== e && (a.Pn = !0, a.cc());
if (b.clientWidth !== a.xa + c || b.clientHeight !== a.wa + d) a.mj = !0, a.nc = !0, b = a.layout, null !== b && b.isViewportSized && a.autoScale === Yh && (a.Tk = !0, b.B()), a.Yb || a.cc()
}
}
}
function ci(a) {
var b = new Oh;
b.name = "Background";
a.Rl(b);
b = new Oh;
b.name = "";
a.Rl(b);
b = new Oh;
b.name = "Foreground";
a.Rl(b);
b = new Oh;
b.name = "Adornment";
b.isTemporary = !0;
a.Rl(b);
b = new Oh;
b.name = "Tool";
b.isTemporary = !0;
b.isBoundsIncluded = !0;
a.Rl(b);
b = new Oh;
b.name = "Grid";
b.allowSelect = !1;
b.pickable = !1;
b.isTemporary = !0;
a.Qw(b, a.$l("Background"))
}
function wi(a) {
a.Eb = new X(X.Grid);
a.Eb.name = "GRID";
var b = new W;
b.figure = "LineH";
b.stroke = "lightgray";
b.strokeWidth = .5;
b.interval = 1;
a.Eb.add(b);
b = new W;
b.figure = "LineH";
b.stroke = "gray";
b.strokeWidth = .5;
b.interval = 5;
a.Eb.add(b);
b = new W;
b.figure = "LineH";
b.stroke = "gray";
b.strokeWidth = 1;
b.interval = 10;
a.Eb.add(b);
b = new W;
b.figure = "LineV";
b.stroke = "lightgray";
b.strokeWidth = .5;
b.interval = 1;
a.Eb.add(b);
b = new W;
b.figure = "LineV";
b.stroke = "gray";
b.strokeWidth = .5;
b.interval = 5;
a.Eb.add(b);
b = new W;
b.figure = "LineV";
b.stroke = "gray";
b.strokeWidth = 1;
b.interval = 10;
a.Eb.add(b);
b = new S;
b.add(a.Eb);
b.layerName = "Grid";
b.zOrder = 0;
b.isInDocumentBounds = !1;
b.isAnimated = !1;
b.pickable = !1;
b.locationObjectName = "GRID";
a.add(b);
a.partManager.parts.remove(b);
a.Eb.visible = !1
}
function xi() {
this.C.uu ? this.C.uu = !1 : this.C.isEnabled ? this.C.$w(this) : yi(this.C)
}
function zi(a) {
this.C.isEnabled ? (this.C.wu = a.target.scrollTop, this.C.vu = a.target.scrollLeft) : yi(this.C)
}
P.prototype.$w = function (a) {
if (null !== this.Da) {
this.ps = !0;
var b = this.documentBounds, c = this.viewportBounds, d = this.ui, e = b.x - d.left, f = b.y - d.top,
g = b.width + d.left + d.right, h = b.height + d.top + d.bottom, k = b.right + d.right;
d = b.bottom + d.bottom;
var l = c.x;
b = c.y;
var m = c.width, n = c.height, p = c.right, r = c.bottom;
c = this.scale;
var q = a.scrollLeft;
if (this.Tn) switch (this.su) {
case "negative":
q = q + a.scrollWidth - a.clientWidth;
break;
case "reverse":
q = a.scrollWidth - q - a.clientWidth
}
var u = q;
m < g || n < h ? (q = G.allocAt(this.position.x, this.position.y),
this.allowHorizontalScroll && this.vu !== u && (q.x = u / c + e, this.vu = u), this.allowVerticalScroll && this.wu !== a.scrollTop && (q.y = a.scrollTop / c + f, this.wu = a.scrollTop), this.position = q, G.free(q), this.mj = this.ps = !1) : (q = G.alloc(), a.Vx && this.allowHorizontalScroll && (e < l && (this.position = q.h(u + e, this.position.y)), k > p && (this.position = q.h(-(this.rs.scrollWidth - this.xa) + u - this.xa / c + k, this.position.y))), a.Wx && this.allowVerticalScroll && (f < b && (this.position = q.h(this.position.x, a.scrollTop + f)), d > r && (this.position = q.h(this.position.x,
-(this.rs.scrollHeight - this.wa) + a.scrollTop - this.wa / c + d))), G.free(q), Ai(this), this.mj = this.ps = !1, b = this.documentBounds, c = this.viewportBounds, k = b.right, p = c.right, d = b.bottom, r = c.bottom, e = b.x, l = c.x, f = b.y, b = c.y, m >= g && e >= l && k <= p && (this.ip.style.width = "1px"), n >= h && f >= b && d <= r && (this.ip.style.height = "1px"))
}
};
P.prototype.computeBounds = function () {
0 < this.Dd.count && Bi(this);
return Ci(this)
};
function Ci(a) {
if (a.fixedBounds.o()) {
var b = a.fixedBounds.copy();
b.Op(a.eb);
return b
}
for (var c = !0, d = a.Pa.j, e = d.length, f = 0; f < e; f++) {
var g = d[f];
if (g.visible && (!g.isTemporary || g.isBoundsIncluded)) {
g = g.Fa.j;
for (var h = g.length, k = 0; k < h; k++) {
var l = g[k];
l.isInDocumentBounds && l.isVisible() && (l = l.actualBounds, l.o() && (c ? (c = !1, b = l.copy()) : b.Jc(l)))
}
}
}
c && (b = new N(0, 0, 0, 0));
b.Op(a.eb);
return b
}
P.prototype.computePartsBounds = function (a, b) {
void 0 === b && (b = !1);
var c = null;
if (za(a)) for (var d = 0; d < a.length; d++) {
var e = a[d];
!b && e instanceof R || (e.$b(), null === c ? c = e.actualBounds.copy() : c.Jc(e.actualBounds))
} else for (a = a.iterator; a.next();) d = a.value, !b && d instanceof R || (d.$b(), null === c ? c = d.actualBounds.copy() : c.Jc(d.actualBounds));
return null === c ? new N(NaN, NaN, 0, 0) : c
};
function Di(a, b) {
if ((b || a.he) && !a.ob && null !== a.Da && !a.animationManager.isAnimating && a.documentBounds.o()) {
a.ob = !0;
var c = a.cj;
b && a.ci !== Yh && (c = a.ci);
var d = c !== Yh ? Ei(a, c) : a.scale;
c = a.viewportBounds.copy();
var e = a.xa / d, f = a.wa / d, g = null, h = a.animationManager;
h.rb && (g = a.sa.copy());
var k = a.ej, l = a.On;
b && !k.gb() && (l.gb() || l.Kb()) && (k = l.Kb() ? Fc : l);
Fi(a, a.documentBounds, e, f, k, b);
null !== g && Mh(h, g, a.sa);
b = a.scale;
a.scale = d;
a.ob = !1;
d = a.viewportBounds;
d.Qa(c) || a.mq(c, d, b, !1)
}
}
function Ei(a, b) {
var c = a.er;
if (null === a.Da) return c;
a.Sg && Gi(a, a.computeBounds());
var d = a.documentBounds;
if (!d.o()) return c;
var e = d.width;
d = d.height;
var f = a.xa, g = a.wa, h = f / e, k = g / d;
return b === Hi ? (b = Math.min(k, h), b > c && (b = c), b < a.minScale && (b = a.minScale), b > a.maxScale && (b = a.maxScale), b) : b === Ii ? (b = k > h ? (g - a.Gb) / d : (f - a.Gb) / e, b > c && (b = c), b < a.minScale && (b = a.minScale), b > a.maxScale && (b = a.maxScale), b) : a.scale
}
P.prototype.zoomToFit = function () {
var a = this.Ij;
this.Ij = Xh;
this.scale = Ei(this, Hi);
a !== Xh && (Di(this, !1), Fi(this, this.documentBounds, this.xa / this.Ca, this.wa / this.Ca, this.ej, !1));
this.Ij = a
};
t = P.prototype;
t.$z = function (a, b) {
void 0 === b && (b = Hi);
var c = a.width, d = a.height;
if (!(0 === c || 0 === d || isNaN(c) && isNaN(d))) {
var e = 1;
if (b === Hi || b === Ii) if (isNaN(c)) e = this.viewportBounds.height * this.scale / d; else if (isNaN(d)) e = this.viewportBounds.width * this.scale / c; else {
e = this.xa;
var f = this.wa;
e = b === Ii ? f / d > e / c ? (f - (this.Rg ? this.Gb : 0)) / d : (e - (this.ai ? this.Gb : 0)) / c : Math.min(f / d, e / c)
}
this.scale = e;
this.position = new G(a.x, a.y)
}
};
t.jy = function (a, b) {
this.Sg && Gi(this, this.computeBounds());
var c = this.documentBounds, d = this.viewportBounds;
this.position = new G(c.x + (a.x * c.width + a.offsetX) - (b.x * d.width - b.offsetX), c.y + (a.y * c.height + a.offsetY) - (b.y * d.height - b.offsetY))
};
function Fi(a, b, c, d, e, f) {
a.sa.ha();
var g = a.sa, h = g.x, k = g.y;
if (f || a.scrollMode === Xh) e.gb() && (c > b.width && (h = b.x + (e.x * b.width + e.offsetX) - (e.x * c - e.offsetX)), d > b.height && (k = b.y + (e.y * b.height + e.offsetY) - (e.y * d - e.offsetY))), e = a.ui, f = c - b.width, c < b.width + e.left + e.right ? (h = Math.min(h + c / 2, b.right + Math.max(f, e.right) - c / 2), h = Math.max(h, b.left - Math.max(f, e.left) + c / 2), h -= c / 2) : h > b.left ? h = b.left : h < b.right - c && (h = b.right - c), c = d - b.height, d < b.height + e.top + e.bottom ? (k = Math.min(k + d / 2, b.bottom + Math.max(c, e.bottom) - d / 2), k =
Math.max(k, b.top - Math.max(c, e.top) + d / 2), k -= d / 2) : k > b.top ? k = b.top : k < b.bottom - d && (k = b.bottom - d);
g.x = isFinite(h) ? h : -a.eb.left;
g.y = isFinite(k) ? k : -a.eb.top;
null !== a.positionComputation && (b = a.positionComputation(a, g), g.x = b.x, g.y = b.y);
a.sa.freeze()
}
t.am = function (a, b) {
void 0 === b && (b = !0);
if (b) {
if (a = Df(this, a, function (a) {
return a.part
}, function (a) {
return a.canSelect()
}), a instanceof S) return a
} else if (a = Df(this, a, function (a) {
return a.part
}), a instanceof S) return a;
return null
};
t.Rb = function (a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
Bi(this);
for (var d = this.Pa.iteratorBackwards; d.next();) {
var e = d.value;
if (e.visible && (e = e.Rb(a, b, c), null !== e)) return e
}
return null
};
function Df(a, b, c, d) {
void 0 === c && (c = null);
void 0 === d && (d = null);
Bi(a);
for (a = a.Pa.iteratorBackwards; a.next();) {
var e = a.value;
if (e.visible && !e.isTemporary && (e = e.Rb(b, c, d), null !== e)) return e
}
return null
}
t.My = function (a, b, c) {
void 0 === b && (b = !0);
return Ji(this, a, function (a) {
return a.part
}, b ? function (a) {
return a instanceof S && a.canSelect()
} : null, c)
};
function Ji(a, b, c, d, e) {
void 0 === c && (c = null);
void 0 === d && (d = null);
e instanceof E || e instanceof F || (e = new F);
Bi(a);
for (a = a.Pa.iteratorBackwards; a.next();) {
var f = a.value;
f.visible && !f.isTemporary && f.Ii(b, c, d, e)
}
return e
}
t.Ii = function (a, b, c, d) {
void 0 === b && (b = null);
void 0 === c && (c = null);
d instanceof E || d instanceof F || (d = new F);
Bi(this);
for (var e = this.Pa.iteratorBackwards; e.next();) {
var f = e.value;
f.visible && f.Ii(a, b, c, d)
}
return d
};
t.ix = function (a, b, c, d) {
void 0 === b && (b = !1);
void 0 === c && (c = !0);
return Ki(this, a, function (a) {
return a instanceof S && (!c || a.canSelect())
}, b, d)
};
t.qg = function (a, b, c, d, e) {
void 0 === b && (b = null);
void 0 === c && (c = null);
void 0 === d && (d = !1);
e instanceof E || e instanceof F || (e = new F);
Bi(this);
for (var f = this.Pa.iteratorBackwards; f.next();) {
var g = f.value;
g.visible && g.qg(a, b, c, d, e)
}
return e
};
function Ki(a, b, c, d, e) {
var f = null;
void 0 === f && (f = null);
void 0 === c && (c = null);
void 0 === d && (d = !1);
e instanceof E || e instanceof F || (e = new F);
Bi(a);
for (a = a.Pa.iteratorBackwards; a.next();) {
var g = a.value;
g.visible && !g.isTemporary && g.qg(b, f, c, d, e)
}
return e
}
t.Ny = function (a, b, c, d, e) {
void 0 === c && (c = !0);
void 0 === d && (d = !0);
return Li(this, a, b, function (a) {
return a instanceof S && (!d || a.canSelect())
}, c, e)
};
t.rg = function (a, b, c, d, e, f) {
void 0 === c && (c = null);
void 0 === d && (d = null);
void 0 === e && (e = !0);
if (!1 !== e && !0 !== e) {
if (e instanceof E || e instanceof F) f = e;
e = !0
}
f instanceof E || f instanceof F || (f = new F);
Bi(this);
for (var g = this.Pa.iteratorBackwards; g.next();) {
var h = g.value;
h.visible && h.rg(a, b, c, d, e, f)
}
return f
};
function Li(a, b, c, d, e, f) {
var g = null;
void 0 === g && (g = null);
void 0 === d && (d = null);
void 0 === e && (e = !0);
if (!1 !== e && !0 !== e) {
if (e instanceof E || e instanceof F) f = e;
e = !0
}
f instanceof E || f instanceof F || (f = new F);
Bi(a);
for (a = a.Pa.iteratorBackwards; a.next();) {
var h = a.value;
h.visible && !h.isTemporary && h.rg(b, c, g, d, e, f)
}
return f
}
P.prototype.acceptEvent = function (a) {
return Mi(this, a, a instanceof MouseEvent)
};
function Mi(a, b, c) {
var d = a.Ze;
a.Ze = a.sj;
a.sj = d;
d.diagram = a;
d.event = b;
c ? Ni(a, b, d) : (d.viewPoint = a.Ze.viewPoint, d.documentPoint = a.Ze.documentPoint);
a = 0;
b.ctrlKey && (a += 1);
b.altKey && (a += 2);
b.shiftKey && (a += 4);
b.metaKey && (a += 8);
d.modifiers = a;
d.button = b.button;
void 0 === b.buttons || Sa || (d.buttons = b.buttons);
Wa && 0 === b.button && b.ctrlKey && (d.button = 2);
d.down = !1;
d.up = !1;
d.clickCount = 1;
d.delta = 0;
d.handled = !1;
d.bubbles = !1;
d.timestamp = b.timeStamp;
d.isMultiTouch = !1;
d.targetDiagram = Oi(b);
d.targetObject = null;
return d
}
function Oi(a) {
var b = a.target.C;
if (!b) {
var c = a.path;
c || "function" !== typeof a.composedPath || (c = a.composedPath());
c && c[0] && (b = c[0].C)
}
return b ? b : null
}
function Pi(a, b, c, d) {
var e = Qi(a, b, !0, !1, !0, d);
Ni(a, c, e);
e.targetDiagram = Oi(b);
e.targetObject = null;
d || e.clone(a.Zh);
return e
}
function Ri(a, b, c, d) {
var e;
d = Qi(a, b, !1, !1, !1, d);
null !== c ? ((e = x.document.elementFromPoint(c.clientX, c.clientY)) && e.C ? (b = c, c = e.C) : (b = void 0 !== b.targetTouches ? b.targetTouches[0] : b, c = a), d.targetDiagram = c, Ni(a, b, d)) : null !== a.Ze ? (d.documentPoint = a.Ze.documentPoint, d.viewPoint = a.Ze.viewPoint, d.targetDiagram = a.Ze.targetDiagram) : null !== a.Zh && (d.documentPoint = a.Zh.documentPoint, d.viewPoint = a.Zh.viewPoint, d.targetDiagram = a.Zh.targetDiagram);
d.targetObject = null;
return d
}
function Qi(a, b, c, d, e, f) {
var g = a.Ze;
a.Ze = a.sj;
a.sj = g;
g.diagram = a;
g.clickCount = 1;
var h = g.delta = 0;
b.ctrlKey && (h += 1);
b.altKey && (h += 2);
b.shiftKey && (h += 4);
b.metaKey && (h += 8);
g.modifiers = h;
g.button = 0;
g.buttons = 1;
g.event = b;
g.timestamp = b.timeStamp;
a.Mq && b instanceof x.PointerEvent && "touch" !== b.pointerType && (g.button = b.button, void 0 === b.buttons || Sa || (g.buttons = b.buttons), Wa && 0 === b.button && b.ctrlKey && (g.button = 2));
g.down = c;
g.up = d;
g.handled = !1;
g.bubbles = e;
g.isMultiTouch = f;
return g
}
function Si(a, b) {
if (a.bubbles) return !0;
void 0 !== b.stopPropagation && b.stopPropagation();
!1 !== b.cancelable && b.preventDefault();
b.cancelBubble = !0;
return !1
}
P.prototype.sz = function (a) {
var b = this.C;
if (!this.C.isEnabled) return !1;
var c = Mi(b, a, !1);
c.key = String.fromCharCode(a.which);
c.down = !0;
switch (a.which) {
case 8:
c.key = "Backspace";
break;
case 33:
c.key = "PageUp";
break;
case 34:
c.key = "PageDown";
break;
case 35:
c.key = "End";
break;
case 36:
c.key = "Home";
break;
case 37:
c.key = "Left";
break;
case 38:
c.key = "Up";
break;
case 39:
c.key = "Right";
break;
case 40:
c.key = "Down";
break;
case 45:
c.key = "Insert";
break;
case 46:
c.key = "Del";
break;
case 48:
c.key = "0";
break;
case 187:
case 61:
case 107:
c.key =
"Add";
break;
case 189:
case 173:
case 109:
c.key = "Subtract";
break;
case 27:
c.key = "Esc"
}
b.doKeyDown();
return Si(c, a)
};
P.prototype.uz = function (a) {
var b = this.C;
if (!b.isEnabled) return !1;
var c = Mi(b, a, !1);
c.key = String.fromCharCode(a.which);
c.up = !0;
switch (a.which) {
case 8:
c.key = "Backspace";
break;
case 33:
c.key = "PageUp";
break;
case 34:
c.key = "PageDown";
break;
case 35:
c.key = "End";
break;
case 36:
c.key = "Home";
break;
case 37:
c.key = "Left";
break;
case 38:
c.key = "Up";
break;
case 39:
c.key = "Right";
break;
case 40:
c.key = "Down";
break;
case 45:
c.key = "Insert";
break;
case 46:
c.key = "Del"
}
b.doKeyUp();
return Si(c, a)
};
P.prototype.Cy = function (a) {
var b = this.C;
if (!b.isEnabled) return !1;
var c = Mi(b, a, !0);
null !== b.mouseEnter && b.mouseEnter(c);
return Si(c, a)
};
P.prototype.Dy = function (a) {
var b = this.C;
if (!b.isEnabled) return !1;
var c = Mi(b, a, !0);
null !== b.mouseLeave && b.mouseLeave(c);
return Si(c, a)
};
P.prototype.getMouse = function (a) {
var b = this.Da;
if (null === b) return new G(0, 0);
var c = b.getBoundingClientRect();
b = a.clientX - this.xa / c.width * c.left;
a = a.clientY - this.wa / c.height * c.top;
return null !== this.tb ? zb(new G(b, a), this.tb) : new G(b, a)
};
function Ni(a, b, c) {
var d = a.Da, e = a.xa, f = a.wa, g = 0, h = 0;
null !== d && (d = d.getBoundingClientRect(), g = b.clientX - e / d.width * d.left, h = b.clientY - f / d.height * d.top);
c.viewPoint.h(g, h);
null !== a.tb ? (b = G.allocAt(g, h), a.tb.Ud(b), c.documentPoint.assign(b), G.free(b)) : c.documentPoint.h(g, h)
}
function oe(a, b, c, d) {
if (void 0 !== b.targetTouches) {
if (2 > b.targetTouches.length) return;
b = b.targetTouches[c]
} else if (null !== a.wl[0]) b = a.wl[c]; else return;
c = a.Da;
null !== c && (c = c.getBoundingClientRect(), d.h(b.clientX - a.xa / c.width * c.left, b.clientY - a.wa / c.height * c.top))
}
t = P.prototype;
t.Xa = function () {
this.Sg || (this.Sg = !0, this.cc(!0))
};
function Lh(a) {
a.Yb || Bi(a);
a.Sg && Gi(a, a.computeBounds())
}
t.uf = function () {
this.ob || this.Yb || (this.R(), Ti(this), Ai(this), this.Xa(), this.fd())
};
t.rz = function () {
return this.qd
};
t.xy = function (a) {
void 0 === a && (a = null);
var b = this.animationManager, c = b.isEnabled;
b.vd();
b.isEnabled = !1;
Lf(this);
this.he = !1;
b.isEnabled = c;
null !== a && sa(a, 1)
};
t.cc = function (a) {
void 0 === a && (a = !1);
if (!0 !== this.qd && !(this.ob || !1 === a && this.Yb)) {
this.qd = !0;
var b = this;
x.requestAnimationFrame(function () {
b.qd && b.fd()
})
}
};
t.fd = function () {
if (!this.Yk || this.qd) this.Yk && (this.Yk = !1), Lf(this)
};
function Ui(a, b) {
a.animationManager.isAnimating || a.ob || !a.mj || yi(a) || (b && Bi(a), Di(a, !1))
}
function Lf(a, b) {
if (!a.Yb && (a.qd = !1, null !== a.Ia || a.Hp.o())) {
a.Yb = !0;
var c = a.animationManager, d = a.nu;
if (!c.isTicking && 0 !== d.length) {
for (var e = d.j, f = e.length, g = 0; g < f; g++) {
var h = e[g];
Vi(h, !1);
h.s()
}
d.clear()
}
d = a.yw;
0 < d.count && (d.each(function (a) {
a.$v()
}), d.clear());
e = d = !1;
c.isAnimating && (e = !0, d = a.skipsUndoManager, a.skipsUndoManager = !0);
c.rb || Bh(a);
Ui(a, !1);
null !== a.Eb && (a.Eb.visible && !a.sr && (Wi(a), a.sr = !0), !a.Eb.visible && a.sr && (a.sr = !1));
Bi(a);
f = !1;
if (!a.he || a.Dg) a.he ? Xi(a, !a.Tk) : (a.Aa("Initial Layout"),
!1 === c.isEnabled && c.vd(), Xi(a, !1)), f = !0;
a.Tk = !1;
Bi(a);
a.xu || c.isAnimating || Lh(a);
Ui(a, !0);
f && (a.he || Yi(a), a.aa("LayoutCompleted"));
Bi(a);
f && !a.he && (a.he = !0, a.Za("Initial Layout"), a.skipsUndoManager || a.undoManager.clear(), sa(function () {
a.isModified = !1
}, 1));
a.Lu();
Ah(c);
b || a.hc(a.Yc);
e && (a.skipsUndoManager = d);
a.Yb = !1
}
}
function Yi(a) {
var b = a.Pa.j;
a.hd(b, b.length, a);
a.ci !== Yh ? a.scale = Ei(a, a.ci) : a.cj !== Yh ? a.scale = Ei(a, a.cj) : (b = a.initialScale, isFinite(b) && 0 < b && (a.scale = b));
b = a.initialPosition;
if (b.o()) a.position = b; else {
b = G.alloc();
b.Wi(a.documentBounds, a.initialDocumentSpot);
var c = a.viewportBounds;
c = N.allocAt(0, 0, c.width, c.height);
var d = G.alloc();
d.Wi(c, a.initialViewportSpot);
d.h(b.x - d.x, b.y - d.y);
a.position = d;
N.free(c);
G.free(d);
G.free(b);
Ti(a);
Ui(a, !0);
Di(a, !0)
}
a.aa("InitialLayoutCompleted");
Wi(a)
}
function Bi(a) {
if ((a.Yb || !a.animationManager.isAnimating) && 0 !== a.Dd.count) {
for (var b = 0; 23 > b; b++) {
var c = a.Dd.iterator;
if (null === c || 0 === a.Dd.count) break;
a.Dd = new F;
a.$v(c, a.Dd)
}
a.nodes.each(function (a) {
a instanceof U && 0 !== (a.S & 65536) !== !1 && (a.S = a.S ^ 65536)
})
}
}
t.$v = function (a, b) {
for (a.reset(); a.next();) {
var c = a.value;
!c.bc() || c instanceof U || (c.Si() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c))
}
for (a.reset(); a.next();) c = a.value, c instanceof U && c.isVisible() && Zi(this, c);
for (a.reset(); a.next();) c = a.value, c instanceof R && c.isVisible() && (c.Si() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
for (a.reset(); a.next();) c = a.value, c instanceof Je && c.isVisible() && (c.Si() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c))
};
function Zi(a, b) {
for (var c = Da(), d = Da(), e = b.memberParts; e.next();) {
var f = e.value;
f.isVisible() && (f instanceof U ? ($i(f) || aj(f) || bj(f)) && Zi(a, f) : f instanceof R ? f.fromNode === b || f.toNode === b ? d.push(f) : c.push(f) : (f.measure(Infinity, Infinity), f.arrange()))
}
a = c.length;
for (e = 0; e < a; e++) f = c[e], f.measure(Infinity, Infinity), f.arrange();
Ga(c);
b.measure(Infinity, Infinity);
b.arrange();
a = d.length;
for (b = 0; b < a; b++) c = d[b], c.measure(Infinity, Infinity), c.arrange();
Ga(d)
}
t.hd = function (a, b, c, d) {
if (this.di || this.animationManager.isAnimating) for (var e = 0; e < b; e++) a[e].hd(c, d)
};
t.hc = function (a, b) {
void 0 === b && (b = null);
if (null !== this.Ia) {
null === this.Da && B("No canvas specified");
var c = this.animationManager;
if (!c.rb) {
var d = new Date;
cj(this);
if ("0" !== this.Ia.style.opacity) {
var e = a !== this.Yc, f = this.Pa.j, g = f.length, h = this;
this.hd(f, g, h);
if (e) a.Rc(!0), Ai(this); else if (!this.nc && null === b && !c.isAnimating) return;
g = this.sa;
var k = this.Ca, l = Math.round(g.x * k) / k, m = Math.round(g.y * k) / k;
c = this.tb;
c.reset();
1 !== k && c.scale(k);
0 === g.x && 0 === g.y || c.translate(-l, -m);
k = this.Mb;
a.setTransform(1, 0,
0, 1, 0, 0);
a.scale(k, k);
a.clearRect(0, 0, this.xa, this.wa);
a.setTransform(1, 0, 0, 1, 0, 0);
a.scale(k, k);
a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy);
l = null !== b ? function (c) {
var d = b;
if (c.visible && 0 !== c.lb) {
var e = c.Fa.j, f = e.length;
if (0 !== f) {
1 !== c.lb && (a.globalAlpha = c.lb);
c = c.Mo;
c.length = 0;
for (var g = h.scale, k = 0; k < f; k++) {
var l = e[k];
if (Kf(l) && !d.contains(l)) {
if (l instanceof R && (l.isOrthogonal && c.push(l), !1 === l.Lc)) continue;
var m = l.actualBounds;
m.width * g > h.oe || m.height * g > h.oe ? l.hc(a, h) : Rh(a, l)
}
}
a.globalAlpha =
1
}
}
} : function (b) {
b.hc(a, h)
};
dj(this, a);
g = f.length;
for (m = 0; m < g; m++) a.setTransform(1, 0, 0, 1, 0, 0), a.scale(k, k), a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy), l(f[m]);
this.bi && ej(this.bi, this) && this.ir();
e ? (this.Yc.Rc(!0), Ai(this)) : this.nc = this.di = !1;
e = +new Date - +d;
if (null === this.kh) {
d = this.xo;
d[this.yo] = e;
this.yo = (this.yo + 1) % d.length;
for (f = e = 0; f < this.xo.length; f++) e += this.xo[f];
this.wo = e / d.length
}
}
}
}
};
function fj(a, b, c, d, e, f, g, h, k, l) {
if (null !== a.Ia) {
null === a.Da && B("No canvas specified");
void 0 === g && (g = null);
void 0 === h && (h = null);
void 0 === k && (k = !1);
void 0 === l && (l = !1);
cj(a);
a.Yc.Rc(!0);
Ai(a);
a.oj = !0;
var m = a.Ca;
a.Ca = e;
var n = a.Pa.j, p = n.length;
try {
var r = new N(f.x, f.y, d.width / e, d.height / e), q = r.copy();
q.Op(c);
Wi(a, q);
Bi(a);
a.hd(n, p, a, r);
var u = a.Mb;
b.setTransform(1, 0, 0, 1, 0, 0);
b.scale(u, u);
b.clearRect(0, 0, d.width, d.height);
null !== h && "" !== h && (b.fillStyle = h, b.fillRect(0, 0, d.width, d.height));
var v = wc.alloc();
v.reset();
v.translate(c.left, c.top);
v.scale(e);
0 === f.x && 0 === f.y || v.translate(-f.x, -f.y);
b.setTransform(v.m11, v.m12, v.m21, v.m22, v.dx, v.dy);
wc.free(v);
dj(a, b);
if (null !== g) {
var w = new F, z = g.iterator;
for (z.reset(); z.next();) {
var y = z.value;
!1 === l && "Grid" === y.layer.name || null === y || w.add(y)
}
var A = function (c) {
var d = k;
if (c.visible && 0 !== c.lb && (void 0 === d && (d = !0), d || !c.isTemporary)) {
d = c.Fa.j;
var e = d.length;
if (0 !== e) {
1 !== c.lb && (b.globalAlpha = c.lb);
c = c.Mo;
c.length = 0;
for (var f = a.scale, g = 0; g < e; g++) {
var h = d[g];
if (Kf(h) &&
w.contains(h)) {
if (h instanceof R && (h.isOrthogonal && c.push(h), !1 === h.Lc)) continue;
var l = h.actualBounds;
l.width * f > a.oe || l.height * f > a.oe ? h.hc(b, a) : Rh(b, h)
}
}
b.globalAlpha = 1
}
}
}
} else if (!k && l) {
var C = a.grid.part, I = C.layer;
A = function (c) {
c === I ? C.hc(b, a) : c.hc(b, a, k)
}
} else A = function (c) {
c.hc(b, a, k)
};
for (c = 0; c < p; c++) A(n[c]);
a.oj = !1;
a.bi && ej(a.bi, a) && a.ir()
} finally {
a.Ca = m, a.Yc.Rc(!0), Ai(a), a.hd(n, p, a), Wi(a)
}
}
}
t.Ee = function (a) {
return this.fg[a]
};
t.Gx = function (a, b) {
"minDrawingLength" === a && (this.oe = b);
this.fg[a] = b;
this.uf()
};
t.Fv = function () {
this.fg = new db;
this.fg.drawShadows = !0;
this.fg.textGreeking = !0;
this.fg.viewportOptimizations = Xa || Ta || Ua ? !1 : !0;
this.fg.temporaryPixelRatio = !0;
this.fg.pictureRatioOptimization = !0;
this.oe = this.fg.minDrawingLength = 1
};
function dj(a, b) {
a = a.fg;
null !== a && (void 0 !== a.imageSmoothingEnabled && b.Fx(!!a.imageSmoothingEnabled), a = a.defaultFont, void 0 !== a && null !== a && (b.font = a))
}
t.cm = function (a) {
return this.el[a]
};
t.Qz = function (a, b) {
this.el[a] = b
};
t.Ev = function () {
this.el = new db;
this.el.extraTouchArea = 10;
this.el.extraTouchThreshold = 10;
this.el.hasGestureZoom = !0
};
t.Ov = function (a) {
gj(this, a)
};
function gj(a, b) {
var c = a instanceof X, d = a instanceof P, e;
for (e in b) {
"" === e && B("Setting properties requires non-empty property names");
var f = a, g = e;
if (c || d) {
var h = e.indexOf(".");
if (0 < h) {
var k = e.substring(0, h);
if (c) f = a.$a(k); else if (f = a[k], void 0 === f || null === f) f = a.toolManager[k];
ya(f) ? g = e.substr(h + 1) : B("Unable to find object named: " + k + " in " + a.toString() + " when trying to set property: " + e)
}
}
if ("_" !== g[0] && !Ka(f, g)) if (d && "ModelChanged" === g) {
a.Sw(b[g]);
continue
} else if (d && "Changed" === g) {
a.sh(b[g]);
continue
} else if (d &&
Ka(a.toolManager, g)) f = a.toolManager; else if (d && hj(a, g)) {
a.Pj(g, b[g]);
continue
} else if (a instanceof Z && "Changed" === g) {
a.sh(b[g]);
continue
} else B('Trying to set undefined property "' + g + '" on object: ' + f.toString());
f[g] = b[e];
"_" === g[0] && f instanceof Y && f.Pw(g)
}
}
t.Lu = function () {
if (0 === this.undoManager.transactionLevel && 0 !== this.Yh.count) {
for (; 0 < this.Yh.count;) {
var a = this.Yh;
this.Yh = new vb;
for (a = a.iterator; a.next();) {
var b = a.key;
b.eq(a.value);
b.ac()
}
}
this.R()
}
};
t.R = function (a) {
void 0 === a && (a = null);
if (null === a) this.nc = !0, this.cc(); else {
var b = this.viewportBounds;
null !== a && a.o() && b.Ic(a) && (this.nc = !0, this.cc())
}
this.aa("InvalidateDraw")
};
t.mx = function (a, b) {
if (!0 !== this.nc) {
this.nc = !0;
var c = !0 === this.Ee("temporaryPixelRatio");
if (!0 === this.Ee("viewportOptimizations") && this.scrollMode !== ij && this.ui.Gi(0, 0, 0, 0) && b.width === a.width && b.height === a.height) {
var d = this.scale, e = Math.max(a.x, b.x), f = Math.max(a.y, b.y);
d = N.allocAt(e, f, Math.max(0, Math.min(a.x + a.width, b.x + b.width) - e) * d, Math.max(0, Math.min(a.y + a.height, b.y + b.height) - f) * d);
if (!this.Bs && 0 < d.width && 0 < d.height) {
if (!(this.Yb || (this.qd = !1, null === this.Ia || (this.Yb = !0, this.Lu(), this.documentBounds.o() ||
Gi(this, this.computeBounds()), e = this.Da, null === e || e instanceof jj)))) {
var g = this.Mb;
f = this.xa * g;
var h = this.wa * g, k = this.scale * g,
l = Math.round(Math.round(b.x * k) - Math.round(a.x * k));
b = Math.round(Math.round(b.y * k) - Math.round(a.y * k));
k = this.Ut;
a = this.tw;
k.width !== f && (k.width = f);
k.height !== h && (k.height = h);
a.clearRect(0, 0, f, h);
k = 190 * g;
var m = 70 * g, n = Math.max(l, 0), p = Math.max(b, 0), r = Math.floor(f - n),
q = Math.floor(h - p);
a.drawImage(e.Ga, n, p, r, q, 0, 0, r, q);
ej(this.bi, this) && a.clearRect(0, 0, k, m);
e = Da();
a = Da();
q = Math.abs(l);
r = Math.abs(b);
var u = 0 === n ? 0 : f - q;
n = G.allocAt(u, 0);
q = G.allocAt(q + u, h);
a.push(new N(Math.min(n.x, q.x), Math.min(n.y, q.y), Math.abs(n.x - q.x), Math.abs(n.y - q.y)));
var v = this.tb;
v.reset();
v.scale(g, g);
1 !== this.Ca && v.scale(this.Ca);
g = this.sa;
(0 !== g.x || 0 !== g.y) && isFinite(g.x) && isFinite(g.y) && v.translate(-g.x, -g.y);
zb(n, v);
zb(q, v);
e.push(new N(Math.min(n.x, q.x), Math.min(n.y, q.y), Math.abs(n.x - q.x), Math.abs(n.y - q.y)));
u = 0 === p ? 0 : h - r;
n.h(0, u);
q.h(f, r + u);
a.push(new N(Math.min(n.x, q.x), Math.min(n.y, q.y), Math.abs(n.x -
q.x), Math.abs(n.y - q.y)));
zb(n, v);
zb(q, v);
e.push(new N(Math.min(n.x, q.x), Math.min(n.y, q.y), Math.abs(n.x - q.x), Math.abs(n.y - q.y)));
ej(this.bi, this) && (f = 0 < l ? 0 : -l, h = 0 < b ? 0 : -b, n.h(f, h), q.h(k + f, m + h), a.push(new N(Math.min(n.x, q.x), Math.min(n.y, q.y), Math.abs(n.x - q.x), Math.abs(n.y - q.y))), zb(n, v), zb(q, v), e.push(new N(Math.min(n.x, q.x), Math.min(n.y, q.y), Math.abs(n.x - q.x), Math.abs(n.y - q.y))));
G.free(n);
G.free(q);
Ui(this, !1);
null === this.Ia && B("No div specified");
null === this.Da && B("No canvas specified");
if (!this.animationManager.rb &&
(f = this.Yc, this.nc)) {
cj(this);
h = this.Mb;
f.setTransform(1, 0, 0, 1, 0, 0);
f.clearRect(0, 0, this.xa * h, this.wa * h);
f.drawImage(this.Ut.Ga, 0 < l ? 0 : Math.round(-l), 0 < b ? 0 : Math.round(-b));
l = this.sa;
g = this.Ca;
k = Math.round(l.x * g) / g;
m = Math.round(l.y * g) / g;
b = this.tb;
b.reset();
1 !== g && b.scale(g);
0 === l.x && 0 === l.y || b.translate(-k, -m);
f.save();
f.beginPath();
l = a.length;
for (g = 0; g < l; g++) k = a[g], 0 !== k.width && 0 !== k.height && f.rect(Math.floor(k.x), Math.floor(k.y), Math.ceil(k.width), Math.ceil(k.height));
f.clip();
f.setTransform(1, 0,
0, 1, 0, 0);
f.scale(h, h);
f.transform(b.m11, b.m12, b.m21, b.m22, b.dx, b.dy);
b = this.Pa.j;
l = b.length;
this.hd(b, l, this);
dj(this, f);
for (h = 0; h < l; h++) if (p = b[h], g = e, p.visible && 0 !== p.lb) {
1 !== p.lb && (f.globalAlpha = p.lb);
k = p.Mo;
k.length = 0;
m = this.scale;
p = p.Fa.j;
n = p.length;
r = g.length;
for (q = 0; q < n; q++) if (v = p[q], Kf(v)) {
if (v instanceof R && (v.isOrthogonal && k.push(v), !1 === v.Lc)) continue;
u = kj(v, v.actualBounds);
a:{
var w = 2 / m;
for (var z = 4 / m, y = 0; y < r; y++) {
var A = g[y];
if (0 !== A.width && 0 !== A.height && u.jv(A.x - w, A.y - w, A.width + z, A.height +
z)) {
w = !0;
break a
}
}
w = !1
}
w && (u.width * m > this.oe || u.height * m > this.oe ? v.hc(f, this) : Rh(f, v))
}
f.globalAlpha = 1
}
f.restore();
f.Rc(!0);
this.bi && ej(this.bi, this) && this.ir();
this.nc = this.di = !1;
this.ot()
}
Ga(e);
Ga(a);
this.Yb = !1
}
} else this.fd();
N.free(d);
c && (bf(this), this.fd(), mf(this, !0))
} else c ? (bf(this), this.fd(), mf(this, !0)) : this.fd()
}
};
function Ti(a) {
!1 === a.mj && (a.mj = !0)
}
function Ai(a) {
!1 === a.di && (a.di = !0)
}
function cj(a) {
!1 !== a.Pn && (a.Pn = !1, lj(a, a.xa, a.wa))
}
function lj(a, b, c) {
var d = a.Mb;
a.Da.resize(b * d, c * d, b, c) && (a.nc = !0, a.Yc.Rc(!0))
}
function yi(a) {
var b = a.Da;
if (null === b) return !0;
var c = a.Ia, d = a.xa, e = a.wa, f = a.Mw.copy();
if (!f.o()) return !0;
var g = !1, h = a.ai ? a.Gb : 0, k = a.Rg ? a.Gb : 0, l = c.clientWidth || d + h;
c = c.clientHeight || e + k;
if (l !== d + h || c !== e + k) a.ai = !1, a.Rg = !1, k = h = 0, a.xa = l, a.wa = c, g = a.Pn = !0;
a.mj = !1;
var m = a.viewportBounds, n = a.documentBounds, p = 0, r = 0, q = 0, u = 0;
l = m.width;
c = m.height;
var v = a.ui;
a.contentAlignment.gb() ? (n.width > l && (p = v.left, r = v.right), n.height > c && (q = v.top, u = v.bottom)) : (p = v.left, r = v.right, q = v.top, u = v.bottom);
v = n.width + p + r;
var w = n.height +
q + u;
p = n.x - p;
var z = m.x;
r = n.right + r;
var y = m.right + h;
q = n.y - q;
var A = m.y;
n = n.bottom + u;
u = m.bottom + k;
var C = "1px", I = "1px";
m = a.scale;
var K = !(v < l + h), J = !(w < c + k);
a.scrollMode === Xh && (K || J) && (K && a.hasHorizontalScrollbar && a.allowHorizontalScroll && (C = 1, p + 1 < z && (C = Math.max((z - p) * m + a.xa, C)), r > y + 1 && (C = Math.max((r - y) * m + a.xa, C)), l + h + 1 < v && (C = Math.max((v - l + h) * m + a.xa, C)), C = C.toString() + "px"), J && a.hasVerticalScrollbar && a.allowVerticalScroll && (I = 1, q + 1 < A && (I = Math.max((A - q) * m + a.wa, I)), n > u + 1 && (I = Math.max((n - u) * m + a.wa, I)), c + k +
1 < w && (I = Math.max((w - c + k) * m + a.wa, I)), I = I.toString() + "px"));
J = "1px" !== C;
K = "1px" !== I;
J && K || !J && !K || (K && (y -= a.Gb), J && (u -= a.Gb), v < l + h || !a.hasHorizontalScrollbar || !a.allowHorizontalScroll || (h = 1, p + 1 < z && (h = Math.max((z - p) * m + a.xa, h)), r > y + 1 && (h = Math.max((r - y) * m + a.xa, h)), l + 1 < v && (h = Math.max((v - l) * m + a.xa, h)), C = h.toString() + "px"), J = "1px" !== C, h = a.wa, J !== a.Rg && (h = J ? a.wa - a.Gb : a.wa + a.Gb), w < c + k || !a.hasVerticalScrollbar || !a.allowVerticalScroll || (k = 1, q + 1 < A && (k = Math.max((A - q) * m + h, k)), n > u + 1 && (k = Math.max((n - u) * m + h, k)), c +
1 < w && (k = Math.max((w - c) * m + h, k)), I = k.toString() + "px"), K = "1px" !== I);
if (a.ps && J === a.Rg && K === a.ai) return d === a.xa && e === a.wa || a.fd(), !1;
J !== a.Rg && ("1px" === C ? a.wa = a.wa + a.Gb : a.wa = Math.max(a.wa - a.Gb, 1), g = !0);
a.Rg = J;
a.ip.style.width = C;
K !== a.ai && ("1px" === I ? a.xa = a.xa + a.Gb : a.xa = Math.max(a.xa - a.Gb, 1), g = !0, a.Tn && (k = G.alloc(), K ? (b.style.left = a.Gb + "px", a.position = k.h(a.sa.x + a.Gb / a.scale, a.sa.y)) : (b.style.left = "0px", a.position = k.h(a.sa.x - a.Gb / a.scale, a.sa.y)), G.free(k)));
a.ai = K;
a.ip.style.height = I;
a.uu = !0;
g && (a.Pn =
!0);
b = a.rs;
k = b.scrollLeft;
a.hasHorizontalScrollbar && a.allowHorizontalScroll && (l + 1 < v ? k = (a.position.x - p) * m : p + 1 < z ? k = b.scrollWidth - b.clientWidth : r > y + 1 && (k = a.position.x * m));
if (a.Tn) switch (a.su) {
case "negative":
k = -(b.scrollWidth - k - b.clientWidth);
break;
case "reverse":
k = b.scrollWidth - k - b.clientWidth
}
b.scrollLeft = k;
a.hasVerticalScrollbar && a.allowVerticalScroll && (c + 1 < w ? b.scrollTop = (a.position.y - q) * m : q + 1 < A ? b.scrollTop = b.scrollHeight - b.clientHeight : n > u + 1 && (b.scrollTop = a.position.y * m));
l = a.xa;
c = a.wa;
b.style.width =
l + (a.ai ? a.Gb : 0) + "px";
b.style.height = c + (a.Rg ? a.Gb : 0) + "px";
return d !== l || e !== c || a.animationManager.rb ? (a.mq(f, a.viewportBounds, m, g), !1) : !0
}
t.add = function (a) {
var b = a.diagram;
if (b !== this && (null !== b && B("Cannot add part " + a.toString() + " to " + this.toString() + ". It is already a part of " + b.toString()), b = this.$l(a.layerName), null === b && (b = this.$l("")), null === b && B('Cannot add a Part when unable find a Layer named "' + a.layerName + '" and there is no default Layer'), a.layer !== b)) {
var c = b.Qi(99999999, a, a.diagram === this);
0 <= c && this.ab(te, "parts", b, null, a, null, c);
b.isTemporary || this.Xa();
a.B(1);
c = a.layerChanged;
null !== c && c(a, null, b)
}
};
t.Qi = function (a) {
this.partManager.Qi(a);
var b = this;
mj(a, function (a) {
nj(b, a)
});
(a instanceof Je || a instanceof U && null !== a.placeholder) && a.s();
null !== a.data && mj(a, function (a) {
oj(b.partManager, a)
});
!0 !== aj(a) && !0 !== bj(a) || this.Dd.add(a);
pj(a, !0, this);
qj(a) ? (a.actualBounds.o() && this.R(kj(a, a.actualBounds)), this.Xa()) : a.isVisible() && a.actualBounds.o() && this.R(kj(a, a.actualBounds));
this.cc()
};
t.xc = function (a) {
a.Uj();
this.partManager.xc(a);
var b = this;
null !== a.data && mj(a, function (a) {
rj(b.partManager, a, b)
});
this.Dd.remove(a);
qj(a) ? (a.actualBounds.o() && this.R(kj(a, a.actualBounds)), this.Xa()) : a.isVisible() && a.actualBounds.o() && this.R(kj(a, a.actualBounds));
this.cc()
};
t.remove = function (a) {
sj(this, a, !0)
};
function sj(a, b, c) {
var d = b.layer;
null !== d && d.diagram === a && (b.isSelected = !1, b.isHighlighted = !1, b.B(2), c && b.$j(), c = d.xc(-1, b, !1), 0 <= c && a.ab(ue, "parts", d, b, null, c, null), a = b.layerChanged, null !== a && a(b, d, null))
}
t.rt = function (a, b) {
if (za(a)) for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
b && !e.canDelete() || this.remove(e)
} else for (c = new F, c.addAll(a), a = c.iterator; a.next();) c = a.value, b && !c.canDelete() || this.remove(c)
};
t.Zj = function (a, b, c) {
return this.partManager.Zj(a, b, c)
};
P.prototype.moveParts = function (a, b, c, d) {
void 0 === d && (d = tj(this));
if (null !== this.toolManager) {
var e = new vb;
if (null !== a) if (za(a)) for (var f = 0; f < a.length; f++) uj(this, e, a[f], c, d); else for (a = a.iterator; a.next();) uj(this, e, a.value, c, d); else {
for (a = this.parts; a.next();) uj(this, e, a.value, c, d);
for (a = this.nodes; a.next();) uj(this, e, a.value, c, d);
for (a = this.links; a.next();) uj(this, e, a.value, c, d)
}
zf(this, e, b, d, c)
}
};
function uj(a, b, c, d, e, f) {
if (!b.contains(c) && (void 0 === f && (f = !1), !d || f || c.canMove() || c.canCopy())) if (void 0 === e && (e = tj(a)), c instanceof V) {
b.add(c, a.pd(e, c, c.location));
if (c instanceof U) for (f = c.memberParts; f.next();) uj(a, b, f.value, d, e, e.hz);
for (f = c.linksConnected; f.next();) {
var g = f.value;
if (!b.contains(g)) {
var h = g.fromNode, k = g.toNode;
null !== h && b.contains(h) && null !== k && b.contains(k) && uj(a, b, g, d, e)
}
}
if (e.dragsTree) for (c = c.bv(); c.next();) uj(a, b, c.value, d, e)
} else if (c instanceof R) for (b.add(c, a.pd(e,
c)), c = c.labelNodes; c.next();) uj(a, b, c.value, d, e); else c instanceof Je || b.add(c, a.pd(e, c, c.location))
}
function zf(a, b, c, d, e) {
if (null !== b && 0 !== b.count) {
var f = G.alloc(), g = G.alloc();
g.assign(c);
isNaN(g.x) && (g.x = 0);
isNaN(g.y) && (g.y = 0);
(c = a.yp) || cf(a, b);
for (var h = Da(), k = Da(), l = b.iterator, m = G.alloc(); l.next();) {
var n = l.key, p = l.value;
if (n.bc()) {
var r = vj(a, n, b);
if (null !== r) h.push(new wj(n, p, r)); else if (!e || n.canMove()) r = p.point, f.assign(r), a.computeMove(n, f.add(g), d, m), n.location = m, void 0 === p.shifted && (p.shifted = new G), p.shifted.assign(m.Xd(r))
} else l.key instanceof R && k.push(l.na)
}
G.free(m);
e = h.length;
for (l =
0; l < e; l++) n = h[l], f.assign(n.info.point), void 0 === n.gv.shifted && (n.gv.shifted = new G), n.node.location = f.add(n.gv.shifted);
e = G.alloc();
l = G.alloc();
n = k.length;
for (p = 0; p < n; p++) {
var q = k[p];
r = q.key;
if (r instanceof R) if (r.suspendsRouting) {
r.dh = null;
m = r.fromNode;
var u = r.toNode;
if (null !== a.draggedLink && d.dragsLink) if (u = q.value.point, null === r.dragComputation) b.add(r, a.pd(d, r, g)), sf(r, g.x - u.x, g.y - u.y); else {
q = G.allocAt(0, 0);
(m = r.i(0)) && m.o() && q.assign(m);
var v = m = G.alloc().assign(q).add(g);
d.isGridSnapEnabled &&
(d.isGridSnapRealtime || a.lastInput.up) && (v = G.alloc(), Ig(a, r, m, v, d));
m.assign(r.dragComputation(r, m, v)).Xd(q);
b.add(r, a.pd(d, r, m));
sf(r, m.x - u.x, m.y - u.y);
G.free(q);
G.free(m);
v !== m && G.free(v)
} else null !== m && (e.assign(m.location), v = b.J(m), null !== v && e.Xd(v.point)), null !== u && (l.assign(u.location), v = b.J(u), null !== v && l.Xd(v.point)), null !== m && null !== u ? e.Qa(l) ? (m = q.value.point, u = f, u.assign(e), u.Xd(m), b.add(r, a.pd(d, r, e)), sf(r, u.x, u.y)) : (r.suspendsRouting = !1, r.Ra()) : (q = q.value.point, m = null !== m ? e : null !== u ? l :
g, b.add(r, a.pd(d, r, m)), sf(r, m.x - q.x, m.y - q.y))
} else if (null === r.fromNode || null === r.toNode) m = q.value.point, b.add(r, a.pd(d, r, g)), sf(r, g.x - m.x, g.y - m.y)
}
G.free(f);
G.free(g);
G.free(e);
G.free(l);
Ga(h);
Ga(k);
c || (Bi(a), hf(a, b))
}
}
P.prototype.computeMove = function (a, b, c, d) {
void 0 === d && (d = new G);
d.assign(b);
if (null === a) return d;
var e = b, f = c.isGridSnapEnabled;
f && (c.isGridSnapRealtime || this.lastInput.up) && (e = G.alloc(), Ig(this, a, b, e, c));
c = null !== a.dragComputation ? a.dragComputation(a, b, e) : e;
var g = a.minLocation, h = g.x;
isNaN(h) && (h = f ? Math.round(a.location.x) : a.location.x);
g = g.y;
isNaN(g) && (g = f ? Math.round(a.location.y) : a.location.y);
var k = a.maxLocation, l = k.x;
isNaN(l) && (l = f ? Math.round(a.location.x) : a.location.x);
k = k.y;
isNaN(k) && (k = f ? Math.round(a.location.y) :
a.location.y);
d.h(Math.max(h, Math.min(c.x, l)), Math.max(g, Math.min(c.y, k)));
e !== b && G.free(e);
return d
};
function tj(a) {
var b = a.toolManager.findTool("Dragging");
return null !== b ? b.dragOptions : a.Nk
}
function Ig(a, b, c, d, e) {
void 0 === e && (e = tj(a));
d.assign(c);
if (null !== b) {
var f = a.grid;
b = e.gridSnapCellSize;
a = b.width;
b = b.height;
var g = e.gridSnapOrigin, h = g.x;
g = g.y;
e = e.gridSnapCellSpot;
if (null !== f) {
var k = f.gridCellSize;
isNaN(a) && (a = k.width);
isNaN(b) && (b = k.height);
f = f.gridOrigin;
isNaN(h) && (h = f.x);
isNaN(g) && (g = f.y)
}
f = G.allocAt(0, 0);
f.sk(0, 0, a, b, e);
H.Xp(c.x, c.y, h + f.x, g + f.y, a, b, d);
G.free(f)
}
}
function cf(a, b) {
if (null !== b) for (a.yp = !0, a = b.iterator; a.next();) b = a.key, b instanceof R && (b.suspendsRouting = !0)
}
function hf(a, b) {
if (null !== b) {
for (b = b.iterator; b.next();) {
var c = b.key;
c instanceof R && (c.suspendsRouting = !1, xj(c) && c.Ra())
}
a.yp = !1
}
}
function vj(a, b, c) {
b = b.containingGroup;
if (null !== b) {
a = vj(a, b, c);
if (null !== a) return a;
a = c.J(b);
if (null !== a) return a
}
return null
}
t = P.prototype;
t.pd = function (a, b, c) {
if (void 0 === c) return new ff(Fb);
var d = a.isGridSnapEnabled;
a.iz || null === b.containingGroup || (d = !1);
return d ? new ff(new G(Math.round(c.x), Math.round(c.y))) : new ff(c.copy())
};
function yj(a, b, c) {
null !== b.diagram && b.diagram !== a && B("Cannot share a Layer with another Diagram: " + b + " of " + b.diagram);
null === c ? null !== b.diagram && B("Cannot add an existing Layer to this Diagram again: " + b) : (c.diagram !== a && B("Existing Layer must be in this Diagram: " + c + " not in " + c.diagram), b === c && B("Cannot move a Layer before or after itself: " + b));
if (b.diagram !== a) {
b = b.name;
a = a.Pa;
c = a.count;
for (var d = 0; d < c; d++) a.N(d).name === b && B("Cannot add Layer with the name '" + b + "'; a Layer with the same name is already present in this Diagram.")
}
}
t.Rl = function (a) {
yj(this, a, null);
a.hb(this);
var b = this.Pa, c = b.count - 1;
if (!a.isTemporary) for (; 0 <= c && b.N(c).isTemporary;) c--;
b.Ib(c + 1, a);
null !== this.Zb && this.ab(te, "layers", this, null, a, null, c + 1);
this.R();
this.Xa()
};
t.Qw = function (a, b) {
yj(this, a, b);
a.hb(this);
var c = this.Pa, d = c.indexOf(a);
0 <= d && (c.remove(a), null !== this.Zb && this.ab(ue, "layers", this, a, null, d, null));
var e = c.count, f;
for (f = 0; f < e; f++) if (c.N(f) === b) {
c.Ib(f, a);
break
}
null !== this.Zb && this.ab(te, "layers", this, null, a, null, f);
this.R();
0 > d && this.Xa()
};
t.by = function (a, b) {
yj(this, a, b);
a.hb(this);
var c = this.Pa, d = c.indexOf(a);
0 <= d && (c.remove(a), null !== this.Zb && this.ab(ue, "layers", this, a, null, d, null));
var e = c.count, f;
for (f = 0; f < e; f++) if (c.N(f) === b) {
c.Ib(f + 1, a);
break
}
null !== this.Zb && this.ab(te, "layers", this, null, a, null, f + 1);
this.R();
0 > d && this.Xa()
};
t.Kz = function (a) {
a.diagram !== this && B("Cannot remove a Layer from another Diagram: " + a + " of " + a.diagram);
if ("" !== a.name) {
var b = this.Pa, c = b.indexOf(a);
if (b.remove(a)) {
for (b = a.Fa.copy().iterator; b.next();) {
var d = b.value, e = d.layerName;
e !== a.name ? d.layerName = e : d.layerName = ""
}
null !== this.Zb && this.ab(ue, "layers", this, a, null, c, null);
this.R();
this.Xa()
}
}
};
t.$l = function (a) {
for (var b = this.layers; b.next();) {
var c = b.value;
if (c.name === a) return c
}
return null
};
t.Sw = function (a) {
null === this.pe && (this.pe = new E);
this.pe.add(a);
this.model.sh(a)
};
t.Mz = function (a) {
null !== this.pe && (this.pe.remove(a), 0 === this.pe.count && (this.pe = null));
this.model.rk(a)
};
t.sh = function (a) {
null === this.Cf && (this.Cf = new E);
this.Cf.add(a)
};
t.rk = function (a) {
null !== this.Cf && (this.Cf.remove(a), 0 === this.Cf.count && (this.Cf = null))
};
t.Ls = function (a) {
this.skipsUndoManager || this.model.skipsUndoManager || this.model.undoManager.hv(a);
a.change !== se && (this.isModified = !0);
if (null !== this.Cf) for (var b = this.Cf, c = b.length, d = 0; d < c; d++) b.N(d)(a)
};
t.ab = function (a, b, c, d, e, f, g) {
void 0 === f && (f = null);
void 0 === g && (g = null);
var h = new qe;
h.diagram = this;
h.change = a;
h.propertyName = b;
h.object = c;
h.oldValue = d;
h.oldParam = f;
h.newValue = e;
h.newParam = g;
this.Ls(h)
};
t.g = function (a, b, c, d, e) {
this.ab(re, a, this, b, c, d, e)
};
t.Tj = function (a, b) {
if (null !== a && a.diagram === this) {
var c = this.skipsModelSourceBindings;
try {
this.skipsModelSourceBindings = !0;
var d = a.change;
if (d === re) {
var e = a.object;
zj(e, a.propertyName, a.J(b));
if (e instanceof Y) {
var f = e.part;
null !== f && f.Jb()
}
this.isModified = !0
} else if (d === te) {
var g = a.object, h = a.newParam, k = a.newValue;
if (g instanceof X) if ("number" === typeof h && k instanceof Y) {
b ? g.xc(h) : g.Ib(h, k);
var l = g.part;
null !== l && l.Jb()
} else {
if ("number" === typeof h && k instanceof Aj) if (b) k.isRow ? g.Cv(h) : g.Av(h); else {
var m =
k.isRow ? g.getRowDefinition(k.index) : g.getColumnDefinition(k.index);
m.Wl(k)
}
} else if (g instanceof Oh) {
var n = !0 === a.oldParam;
"number" === typeof h && k instanceof S && (b ? (k.isSelected = !1, k.isHighlighted = !1, k.Jb(), g.xc(n ? h : -1, k, n)) : g.Qi(h, k, n))
} else g instanceof P ? "number" === typeof h && k instanceof Oh && (b ? this.Pa.mb(h) : (k.hb(this), this.Pa.Ib(h, k))) : B("unknown ChangedEvent.Insert object: " + a.toString());
this.isModified = !0
} else if (d === ue) {
var p = a.object, r = a.oldParam, q = a.oldValue;
if (p instanceof X) "number" ===
typeof r && q instanceof Y ? b ? p.Ib(r, q) : p.xc(r) : "number" === typeof r && q instanceof Aj && (b ? (m = q.isRow ? p.getRowDefinition(q.index) : p.getColumnDefinition(q.index), m.Wl(q)) : q.isRow ? p.Cv(r) : p.Av(r)); else if (p instanceof Oh) {
var u = !0 === a.newParam;
"number" === typeof r && q instanceof S && (b ? 0 > p.Fa.indexOf(q) && p.Qi(r, q, u) : (q.isSelected = !1, q.isHighlighted = !1, q.Jb(), p.xc(u ? r : -1, q, u)))
} else p instanceof P ? "number" === typeof r && q instanceof Oh && (b ? (q.hb(this), this.Pa.Ib(r, q)) : this.Pa.mb(r)) : B("unknown ChangedEvent.Remove object: " +
a.toString());
this.isModified = !0
} else d !== se && B("unknown ChangedEvent: " + a.toString())
} finally {
this.skipsModelSourceBindings = c
}
}
};
t.Aa = function (a) {
return this.undoManager.Aa(a)
};
t.Za = function (a) {
return this.undoManager.Za(a)
};
t.wf = function () {
return this.undoManager.wf()
};
P.prototype.commit = function (a, b) {
void 0 === b && (b = "");
var c = this.skipsUndoManager;
null === b && (this.skipsUndoManager = !0, b = "");
this.undoManager.Aa(b);
var d = !1;
try {
a(this), d = !0
} finally {
d ? this.undoManager.Za(b) : this.undoManager.wf(), this.skipsUndoManager = c
}
};
P.prototype.updateAllTargetBindings = function (a) {
this.partManager.updateAllTargetBindings(a)
};
t = P.prototype;
t.xq = function () {
this.partManager.xq()
};
function Bj(a, b, c) {
var d = a.animationManager;
if (a.ob || a.Yb) a.Ca = c, Nh(d, b, a.Ca); else if (a.ob = !0, null === a.Da) a.Ca = c; else {
var e = a.viewportBounds.copy(), f = a.xa, g = a.wa;
e.width = a.xa / b;
e.height = a.wa / b;
var h = a.zoomPoint.x, k = a.zoomPoint.y, l = a.contentAlignment;
isNaN(h) && (l.sf() ? l.rf(Mc) ? h = 0 : l.rf(Nc) && (h = f - 1) : h = l.gb() ? l.x * (f - 1) : f / 2);
isNaN(k) && (l.sf() ? l.rf(Kc) ? k = 0 : l.rf(Oc) && (k = g - 1) : k = l.gb() ? l.y * (g - 1) : g / 2);
null !== a.scaleComputation && (c = a.scaleComputation(a, c));
c < a.minScale && (c = a.minScale);
c > a.maxScale && (c = a.maxScale);
f = G.allocAt(a.sa.x + h / b - h / c, a.sa.y + k / b - k / c);
a.position = f;
G.free(f);
a.Ca = c;
a.mq(e, a.viewportBounds, b, !1);
a.ob = !1;
Di(a, !1);
Nh(d, b, a.Ca);
a.R();
Ti(a)
}
}
t.mq = function (a, b, c, d) {
if (!a.A(b)) {
void 0 === d && (d = !1);
d || Ti(this);
Ai(this);
var e = this.layout;
null === e || !e.isViewportSized || this.autoScale !== Yh || d || a.width === b.width && a.height === b.height || e.B();
e = this.currentTool;
!0 === this.Re && e instanceof Na && (this.lastInput.documentPoint = this.yt(this.lastInput.viewPoint), Ne(e, this));
this.ob || this.mx(a, b);
Wi(this);
this.ye.scale = c;
this.ye.position.x = a.x;
this.ye.position.y = a.y;
this.ye.bounds.assign(a);
this.ye.ox = d;
this.aa("ViewportBoundsChanged", this.ye, a);
this.isVirtualized &&
this.links.each(function (a) {
a.isAvoiding && a.actualBounds.Ic(b) && a.Ra()
})
}
};
function Wi(a, b) {
void 0 === b && (b = null);
var c = a.Eb;
if (null !== c && c.visible) {
for (var d = M.alloc(), e = 1, f = 1, g = c.Y.j, h = g.length, k = 0; k < h; k++) {
var l = g[k], m = l.interval;
2 > m || (Cj(l.figure) ? f = f * m / H.jx(f, m) : e = e * m / H.jx(e, m))
}
g = c.gridCellSize;
d.h(f * g.width, e * g.height);
if (null !== b) e = b.width, f = b.height, a = b.x, g = b.y; else {
b = N.alloc();
a = a.viewportBounds;
b.h(a.x, a.y, a.width, a.height);
if (!b.o()) {
N.free(b);
return
}
e = b.width;
f = b.height;
a = b.x;
g = b.y;
N.free(b)
}
c.width = e + 2 * d.width;
c.height = f + 2 * d.height;
b = G.alloc();
H.Xp(a, g, 0, 0,
d.width, d.height, b);
b.offset(-d.width, -d.height);
M.free(d);
c.part.location = b;
G.free(b)
}
}
t.Rp = function () {
var a = 0 < this.selection.count;
a && this.aa("ChangingSelection", this.selection);
Ze(this);
a && this.aa("ChangedSelection", this.selection)
};
function Ze(a) {
a = a.selection;
if (0 < a.count) {
for (var b = a.Na(), c = b.length, d = 0; d < c; d++) b[d].isSelected = !1;
a.ha();
a.clear();
a.freeze()
}
}
t.select = function (a) {
null !== a && a.layer.diagram === this && (!a.isSelected || 1 < this.selection.count) && (this.aa("ChangingSelection", this.selection), Ze(this), a.isSelected = !0, this.aa("ChangedSelection", this.selection))
};
t.Iv = function (a) {
this.aa("ChangingSelection", this.selection);
Ze(this);
if (za(a)) for (var b = a.length, c = 0; c < b; c++) {
var d = a[c];
d instanceof S || B("Diagram.selectCollection given something that is not a Part: " + d);
d.isSelected = !0
} else for (a = a.iterator; a.next();) b = a.value, b instanceof S || B("Diagram.selectCollection given something that is not a Part: " + b), b.isSelected = !0;
this.aa("ChangedSelection", this.selection)
};
t.Mu = function () {
var a = this.highlighteds;
if (0 < a.count) {
for (var b = a.Na(), c = b.length, d = 0; d < c; d++) b[d].isHighlighted = !1;
a.ha();
a.clear();
a.freeze()
}
};
t.kz = function (a) {
null !== a && a.layer.diagram === this && (!a.isHighlighted || 1 < this.highlighteds.count) && (this.Mu(), a.isHighlighted = !0)
};
t.lz = function (a) {
a = (new F).addAll(a);
for (var b = this.highlighteds.copy().pq(a).iterator; b.next();) b.value.isHighlighted = !1;
for (a = a.iterator; a.next();) b = a.value, b instanceof S || B("Diagram.highlightCollection given something that is not a Part: " + b), b.isHighlighted = !0
};
t.scroll = function (a, b, c) {
void 0 === c && (c = 1);
var d = "up" === b || "down" === b, e = 0;
if ("pixel" === a) e = c; else if ("line" === a) e = c * (d ? this.scrollVerticalLineChange : this.scrollHorizontalLineChange); else if ("page" === a) a = d ? this.viewportBounds.height : this.viewportBounds.width, a *= this.scale, 0 !== a && (e = c * Math.max(a - (d ? this.scrollVerticalLineChange : this.scrollHorizontalLineChange), 0)); else {
if ("document" === a) {
e = this.documentBounds;
c = this.viewportBounds;
d = G.alloc();
"up" === b ? this.position = d.h(c.x, e.y) : "left" === b ? this.position =
d.h(e.x, c.y) : "down" === b ? this.position = d.h(c.x, e.bottom - c.height) : "right" === b && (this.position = d.h(e.right - c.width, c.y));
G.free(d);
return
}
B("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: " + a)
}
e /= this.scale;
c = this.position.copy();
"up" === b ? c.y = this.position.y - e : "down" === b ? c.y = this.position.y + e : "left" === b ? c.x = this.position.x - e : "right" === b ? c.x = this.position.x + e : B("scrolling direction must be 'up', 'down', 'left', or 'right', not: " + b);
this.position = c
};
t.Hv = function (a) {
var b = this.viewportBounds;
b.nf(a) || (a = a.center, a.x -= b.width / 2, a.y -= b.height / 2, this.position = a)
};
t.Ku = function (a) {
var b = this.viewportBounds;
a = a.center;
a.x -= b.width / 2;
a.y -= b.height / 2;
this.position = a
};
t.xt = function (a) {
var b = this.tb;
b.reset();
1 !== this.Ca && b.scale(this.Ca);
var c = this.sa;
(0 !== c.x || 0 !== c.y) && isFinite(c.x) && isFinite(c.y) && b.translate(-c.x, -c.y);
return a.copy().transform(this.tb)
};
t.Xz = function (a) {
var b = this.tb, c = a.x, d = a.y, e = c + a.width, f = d + a.height, g = b.m11, h = b.m12, k = b.m21,
l = b.m22, m = b.dx, n = b.dy, p = c * g + d * k + m;
b = c * h + d * l + n;
var r = e * g + d * k + m;
a = e * h + d * l + n;
d = c * g + f * k + m;
c = c * h + f * l + n;
g = e * g + f * k + m;
e = e * h + f * l + n;
f = Math.min(p, r);
p = Math.max(p, r);
r = Math.min(b, a);
b = Math.max(b, a);
f = Math.min(f, d);
p = Math.max(p, d);
r = Math.min(r, c);
b = Math.max(b, c);
f = Math.min(f, g);
p = Math.max(p, g);
r = Math.min(r, e);
b = Math.max(b, e);
return new N(f, r, p - f, b - r)
};
t.yt = function (a) {
var b = this.tb;
b.reset();
1 !== this.Ca && b.scale(this.Ca);
var c = this.sa;
(0 !== c.x || 0 !== c.y) && isFinite(c.x) && isFinite(c.y) && b.translate(-c.x, -c.y);
return zb(a.copy(), this.tb)
};
function Dj(a) {
var b = a.isModified;
a.Nw !== b && (a.Nw = b, a.aa("Modified"))
}
function Ej(a) {
a = ai.get(a);
return null !== a ? new a : new bi
}
P.prototype.doModelChanged = function (a) {
if (a.model === this.model) {
var b = a.change, c = a.propertyName;
if (b === se && "S" === c[0]) if ("StartingFirstTransaction" === c) {
var d = this;
a = this.toolManager;
a.mouseDownTools.each(function (a) {
a.hb(d)
});
a.mouseMoveTools.each(function (a) {
a.hb(d)
});
a.mouseUpTools.each(function (a) {
a.hb(d)
});
this.Yb || this.he || (this.Tk = !0, this.Yk && (this.qd = !0))
} else "StartingUndo" === c || "StartingRedo" === c ? (a = this.animationManager, a.isAnimating && !this.skipsUndoManager && a.vd(), this.aa("ChangingSelection",
this.selection)) : "StartedTransaction" === c && (a = this.animationManager, a.isAnimating && !this.skipsUndoManager && a.vd()); else if (this.ea) {
this.ea = !1;
try {
if ("" === a.modelChange && b === se) {
if ("FinishedUndo" === c || "FinishedRedo" === c) this.aa("ChangedSelection", this.selection), Bi(this);
var e = this.animationManager;
"RolledBackTransaction" === c && e.vd();
this.Tk = !0;
this.fd();
0 === this.undoManager.transactionLevel && Ah(e);
"CommittedTransaction" === c && this.undoManager.eu && (this.ge = Math.min(this.ge, this.undoManager.historyIndex -
1));
var f = a.isTransactionFinished;
f && (Dj(this), this.gt.clear());
if (!this.lu && f) {
this.lu = !0;
var g = this;
sa(function () {
g.currentTool.standardMouseOver();
g.lu = !1
}, 10)
}
}
} finally {
this.ea = !0
}
}
}
};
function nj(a, b) {
b = b.Y.j;
for (var c = b.length, d = 0; d < c; d++) Mj(a, b[d])
}
function Mj(a, b) {
if (b instanceof Qj) {
var c = b.element;
if (null !== c && c instanceof HTMLImageElement) {
var d = b.Mg;
null !== d && (d.$k instanceof Event && null !== b.Cc && b.Cc(b, d.$k), !0 === d.Er && (null !== b.ff && b.ff(b, d.tu), null !== b.diagram && b.diagram.nu.add(b)));
c = c.getAttribute("src");
d = a.Ej.J(c);
if (null === d) d = [], d.push(b), a.Ej.add(c, d); else {
for (a = 0; a < d.length; a++) if (d[a] === b) return;
d.push(b)
}
}
}
}
function Rj(a, b) {
if (b instanceof Qj) {
var c = b.element;
if (null !== c && c instanceof HTMLImageElement) {
c = c.getAttribute("src");
var d = a.Ej.J(c);
if (null !== d) for (var e = 0; e < d.length; e++) if (d[e] === b) {
d.splice(e, 1);
0 === d.length && (a.Ej.remove(c), Sj(c));
break
}
}
}
}
P.prototype.ud = function () {
this.partManager.ud()
};
P.prototype.Mp = function (a, b) {
this.Bk.Mp(a, b)
};
P.prototype.Np = function (a, b) {
this.Bk.Np(a, b)
};
P.prototype.findPartForKey = function (a) {
return this.partManager.findPartForKey(a)
};
t = P.prototype;
t.Hb = function (a) {
return this.partManager.Hb(a)
};
t.vc = function (a) {
return this.partManager.vc(a)
};
t.Hi = function (a) {
return this.partManager.Hi(a)
};
t.uc = function (a) {
return this.partManager.uc(a)
};
t.Ss = function (a) {
for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
return this.partManager.Ss.apply(this.partManager, b instanceof Array ? b : ca(ba(b)))
};
t.Rs = function (a) {
for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
return this.partManager.Rs.apply(this.partManager, b instanceof Array ? b : ca(ba(b)))
};
function Gi(a, b) {
a.Sg = !1;
var c = a.vn;
c.A(b) || (b = b.I(), a.vn = b, Di(a, !1), a.aa("DocumentBoundsChanged", null, c.copy()), Ti(a))
}
t.Ry = function () {
for (var a = new F, b = this.nodes; b.next();) {
var c = b.value;
c.isTopLevel && a.add(c)
}
for (b = this.links; b.next();) c = b.value, c.isTopLevel && a.add(c);
return a.iterator
};
t.Qy = function () {
return this.Ai.iterator
};
t.wz = function (a) {
Bi(this);
a && Tj(this, !0);
this.Tk = !0;
Lf(this)
};
function Tj(a, b) {
for (var c = a.Ai.iterator; c.next();) Uj(a, c.value, b);
null !== a.layout && (b ? a.layout.isValidLayout = !1 : a.layout.B())
}
function Uj(a, b, c) {
if (null !== b) {
for (var d = b.sl.iterator; d.next();) Uj(a, d.value, c);
null !== b.layout && (c ? b.layout.isValidLayout = !1 : b.layout.B())
}
}
function Xi(a, b) {
if (a.Dg && !a.Qt) {
var c = a.ea;
a.ea = !0;
var d = a.undoManager.transactionLevel, e = a.layout;
try {
0 === d && a.Aa("Layout");
var f = a.animationManager;
1 >= d && !f.isAnimating && !f.rb && (b || f.Ui("Layout"));
a.Dg = !1;
for (var g = a.Ai.iterator; g.next();) Vj(a, g.value, b, d);
e.isValidLayout || (!b || e.isRealtime || null === e.isRealtime || 0 === d ? (e.doLayout(a), Bi(a), e.isValidLayout = !0) : a.Dg = !0)
} finally {
0 === d && a.Za("Layout"), a.Dg = !e.isValidLayout, a.ea = c
}
}
}
function Vj(a, b, c, d) {
if (null !== b) {
for (var e = b.sl.iterator; e.next();) Vj(a, e.value, c, d);
e = b.layout;
null === e || e.isValidLayout || (!c || e.isRealtime || 0 === d ? (b.pk = !b.location.o(), e.doLayout(b), b.B(32), Zi(a, b), e.isValidLayout = !0) : a.Dg = !0)
}
}
t.Xy = function () {
for (var a = new E, b = this.nodes; b.next();) {
var c = b.value;
c.isTopLevel && null === c.Ki() && a.add(c)
}
return a.iterator
};
function Zh(a) {
function b(a) {
var b = a.toLowerCase(), e = new E;
c.add(a, e);
c.add(b, e);
d.add(a, a);
d.add(b, a)
}
var c = new vb, d = new vb;
b("AnimationStarting");
b("AnimationFinished");
b("BackgroundSingleClicked");
b("BackgroundDoubleClicked");
b("BackgroundContextClicked");
b("ClipboardChanged");
b("ClipboardPasted");
b("DocumentBoundsChanged");
b("ExternalObjectsDropped");
b("GainedFocus");
b("InitialLayoutCompleted");
b("LayoutCompleted");
b("LinkDrawn");
b("LinkRelinked");
b("LinkReshaped");
b("LostFocus");
b("Modified");
b("ObjectSingleClicked");
b("ObjectDoubleClicked");
b("ObjectContextClicked");
b("PartCreated");
b("PartResized");
b("PartRotated");
b("SelectionMoved");
b("SelectionCopied");
b("SelectionDeleting");
b("SelectionDeleted");
b("SelectionGrouped");
b("SelectionUngrouped");
b("ChangingSelection");
b("ChangedSelection");
b("SubGraphCollapsed");
b("SubGraphExpanded");
b("TextEdited");
b("TreeCollapsed");
b("TreeExpanded");
b("ViewportBoundsChanged");
b("InvalidateDraw");
a.St = c;
a.Rt = d
}
function hj(a, b) {
var c = a.Rt.J(b);
return null !== c ? c : a.Rt.J(b.toLowerCase())
}
function Wj(a, b) {
var c = a.St.J(b);
if (null !== c) return c;
c = a.St.J(b.toLowerCase());
if (null !== c) return c;
B("Unknown DiagramEvent name: " + b);
return null
}
t.Pj = function (a, b) {
a = Wj(this, a);
null !== a && a.add(b)
};
t.nm = function (a, b) {
a = Wj(this, a);
null !== a && a.remove(b)
};
t.aa = function (a, b, c) {
var d = Wj(this, a), e = new pe;
e.diagram = this;
a = hj(this, a);
null !== a && (e.name = a);
void 0 !== b && (e.subject = b);
void 0 !== c && (e.parameter = c);
b = d.length;
if (1 === b) d.N(0)(e); else if (0 !== b) for (d = d.Na(), c = 0; c < b; c++) (0, d[c])(e)
};
function Xj(a) {
if (a.animationManager.isAnimating) return !1;
var b = a.currentTool;
return b === a.toolManager.findTool("Dragging") ? !a.yp || b.isComplexRoutingRealtime : !0
}
t.gk = function (a, b) {
void 0 === b && (b = null);
return Yj(this, !1, null, b).gk(a.x, a.y, a.width, a.height)
};
P.prototype.computeOccupiedArea = function () {
return this.isVirtualized ? this.viewportBounds.copy() : this.Sg ? Ci(this) : this.documentBounds.copy()
};
function Yj(a, b, c, d) {
null === a.Nb && (a.Nb = new Zj);
if (a.Nb.at || a.Nb.group !== c || a.Nb.Jx !== d) {
if (null === c) {
b = a.computeOccupiedArea();
b.Uc(100, 100);
a.Nb.initialize(b);
b = N.alloc();
for (var e = a.nodes; e.next();) {
var f = e.value, g = f.layer;
null !== g && g.visible && !g.isTemporary && ak(a, f, d, b)
}
N.free(b)
} else {
0 < c.memberParts.count && (b = a.computePartsBounds(c.memberParts, !1), b.Uc(20, 20), a.Nb.initialize(b));
b = N.alloc();
for (e = c.memberParts; e.next();) f = e.value, f instanceof V && ak(a, f, d, b);
N.free(b)
}
a.Nb.group = c;
a.Nb.Jx = d;
a.Nb.at =
!1
} else b && bk(a.Nb);
return a.Nb
}
function ak(a, b, c, d) {
if (b !== c) if (b.isVisible() && b.avoidable && !b.isLinkLabel) {
var e = b.getAvoidableRect(d), f = a.Nb.Vl;
c = a.Nb.Ul;
d = e.x + e.width;
b = e.y + e.height;
for (var g = e.x; g < d; g += f) {
for (var h = e.y; h < b; h += c) ck(a.Nb, g, h);
ck(a.Nb, g, b)
}
for (e = e.y; e < b; e += c) ck(a.Nb, d, e);
ck(a.Nb, d, b)
} else if (b instanceof U) for (b = b.memberParts; b.next();) e = b.value, e instanceof V && ak(a, e, c, d)
}
function dk(a, b) {
null !== a.Nb && !a.Nb.at && (void 0 === b && (b = null), null === b || b.avoidable && !b.isLinkLabel) && (a.Nb.at = !0)
}
t = P.prototype;
t.Os = function (a) {
this.Nq.assign(a);
ek(this, this.Nq).Qa(this.position) ? this.xf() : fk(this)
};
function fk(a) {
-1 === a.Dk && (a.Dk = sa(function () {
if (-1 !== a.Dk && (a.xf(), null !== a.lastInput.event)) {
var b = ek(a, a.Nq);
b.Qa(a.position) || (a.position = b, a.lastInput.documentPoint = a.yt(a.Nq), a.doMouseMove(), a.Sg = !0, Gi(a, a.documentBounds.copy().Jc(a.computeBounds())), a.nc = !0, a.fd(), fk(a))
}
}, a.Tm))
}
t.xf = function () {
-1 !== this.Dk && (x.clearTimeout(this.Dk), this.Dk = -1)
};
function ek(a, b) {
var c = a.position, d = a.Um;
if (0 >= d.top && 0 >= d.left && 0 >= d.right && 0 >= d.bottom) return c;
var e = a.viewportBounds, f = a.scale;
e = N.allocAt(0, 0, e.width * f, e.height * f);
var g = G.allocAt(0, 0);
if (b.x >= e.x && b.x < e.x + d.left) {
var h = Math.max(a.scrollHorizontalLineChange, 1);
h |= 0;
g.x -= h;
b.x < e.x + d.left / 2 && (g.x -= h);
b.x < e.x + d.left / 4 && (g.x -= 4 * h)
} else b.x <= e.x + e.width && b.x > e.x + e.width - d.right && (h = Math.max(a.scrollHorizontalLineChange, 1), h |= 0, g.x += h, b.x > e.x + e.width - d.right / 2 && (g.x += h), b.x > e.x + e.width - d.right / 4 &&
(g.x += 4 * h));
b.y >= e.y && b.y < e.y + d.top ? (a = Math.max(a.scrollVerticalLineChange, 1), a |= 0, g.y -= a, b.y < e.y + d.top / 2 && (g.y -= a), b.y < e.y + d.top / 4 && (g.y -= 4 * a)) : b.y <= e.y + e.height && b.y > e.y + e.height - d.bottom && (a = Math.max(a.scrollVerticalLineChange, 1), a |= 0, g.y += a, b.y > e.y + e.height - d.bottom / 2 && (g.y += a), b.y > e.y + e.height - d.bottom / 4 && (g.y += 4 * a));
g.Qa(Fb) || (c = new G(c.x + g.x / f, c.y + g.y / f));
N.free(e);
G.free(g);
return c
}
t.it = function () {
return null
};
t.ov = function () {
return null
};
t.iy = function (a, b) {
this.qu.add(a, b)
};
function gk(a, b, c) {
function d() {
var a = +new Date;
f = !0;
for (g.reset(); g.next();) if (!g.value[0].ol) {
f = !1;
break
}
f || a - l > k ? b(c, e, h) : x.requestAnimationFrame(d)
}
for (var e = c.callback, f = !0, g = a.Ej.iterator; g.next();) if (!g.value[0].ol) {
f = !1;
break
}
if ("function" !== typeof e || f) return b(c, e, a);
var h = a, k = c.callbackTimeout || 300, l = +new Date;
x.requestAnimationFrame(function () {
d()
});
return null
}
t.yz = function (a) {
if (!Wg) return null;
void 0 === a && (a = new db);
a.returnType = "Image";
return this.px(a)
};
t.px = function (a) {
void 0 === a && (a = new db);
return gk(this, this.zz, a)
};
t.zz = function (a, b, c) {
var d = hk(c, a, "canvas", null);
if (null === d) return null;
c = d.W.canvas;
var e = null;
if (null !== c) switch (e = a.returnType, void 0 === e ? e = "string" : e = e.toLowerCase(), e) {
case "imagedata":
e = d.getImageData(0, 0, c.width, c.height);
break;
case "image":
d = (a.document || document).createElement("img");
d.src = c.toDataURL(a.type, a.details);
e = d;
break;
case "blob":
"function" !== typeof b && B('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');
if ("function" ===
typeof c.toBlob) return c.toBlob(b, a.type, a.details), "toBlob";
if ("function" === typeof c.msToBlob) return b(c.msToBlob()), "msToBlob";
b(null);
return null;
default:
e = c.toDataURL(a.type, a.details)
}
return "function" === typeof b ? (b(e), null) : e
};
function hk(a, b, c, d) {
a.animationManager.vd();
a.fd();
if (null === a.Da) return null;
"object" !== typeof b && B("properties argument must be an Object.");
var e = b.size || null, f = b.scale || null;
void 0 !== b.scale && isNaN(b.scale) && (f = "NaN");
var g = b.maxSize;
void 0 === b.maxSize && (g = "SVG" === c ? new M(Infinity, Infinity) : new M(2E3, 2E3));
var h = b.position || null, k = b.parts || null, l = void 0 === b.padding ? 1 : b.padding,
m = b.background || null, n = b.omitTemporary;
void 0 === n && (n = !0);
var p = b.document || document, r = b.elementFinished || null, q = b.showTemporary;
void 0 === q && (q = !n);
b = b.showGrid;
void 0 === b && (b = q);
null !== e && isNaN(e.width) && isNaN(e.height) && (e = null);
"number" === typeof l ? l = new pc(l) : l instanceof pc || B("MakeImage padding must be a Margin or a number.");
l.left = Math.max(l.left, 0);
l.right = Math.max(l.right, 0);
l.top = Math.max(l.top, 0);
l.bottom = Math.max(l.bottom, 0);
a.Yc.Rc(!0);
n = new ik(null, p);
var u = n.context;
if (!(e || f || k || h)) {
n.width = a.xa + Math.ceil(l.left + l.right);
n.height = a.wa + Math.ceil(l.top + l.bottom);
if ("SVG" === c) {
if (null === d) return null;
d.resize(n.width,
n.height, n.width, n.height);
d.ownerDocument = p;
d.Up = r;
fj(a, d.context, l, new M(n.width, n.height), a.Ca, a.sa, k, m, q, b);
return d.context
}
a.xn = !1;
fj(a, u, l, new M(n.width, n.height), a.Ca, a.sa, k, m, q, b);
a.xn = !0;
return n.context
}
var v = a.er, w = a.documentBounds.copy();
w.Qv(a.eb);
if (q) for (var z = a.Pa.j, y = z.length, A = 0; A < y; A++) {
var C = z[A];
if (C.visible && C.isTemporary) {
C = C.Fa.j;
for (var I = C.length, K = 0; K < I; K++) {
var J = C[K];
J.isInDocumentBounds && J.isVisible() && (J = J.actualBounds, J.o() && w.Jc(J))
}
}
}
z = new G(w.x, w.y);
if (null !== k) {
y =
!0;
A = k.iterator;
for (A.reset(); A.next();) if (C = A.value, C instanceof S && (I = C.layer, (null === I || I.visible) && (null === I || q || !I.isTemporary) && C.isVisible() && (C = C.actualBounds, C.o()))) if (y) {
y = !1;
var T = C.copy()
} else T.Jc(C);
y && (T = new N(0, 0, 0, 0));
w.width = T.width;
w.height = T.height;
z.x = T.x;
z.y = T.y
}
null !== h && h.o() && (z = h, f || (f = v));
T = h = 0;
null !== l && (h = l.left + l.right, T = l.top + l.bottom);
y = A = 0;
null !== e && (A = e.width, y = e.height, isFinite(A) && (A = Math.max(0, A - h)), isFinite(y) && (y = Math.max(0, y - T)));
null !== e && null !== f ? ("NaN" ===
f && (f = v), e.o() ? (e = A, w = y) : isNaN(y) ? (e = A, w = w.height * f) : (e = w.width * f, w = y)) : null !== e ? e.o() ? (f = Math.min(A / w.width, y / w.height), e = A, w = y) : isNaN(y) ? (f = A / w.width, e = A, w = w.height * f) : (f = y / w.height, e = w.width * f, w = y) : null !== f ? "NaN" === f && g.o() ? (f = Math.min((g.width - h) / w.width, (g.height - T) / w.height), f > v ? (f = v, e = w.width, w = w.height) : (e = g.width, w = g.height)) : (e = w.width * f, w = w.height * f) : (f = v, e = w.width, w = w.height);
null !== l ? (e += h, w += T) : l = new pc(0);
null !== g && (v = g.width, g = g.height, isNaN(v) && (v = 2E3), isNaN(g) && (g = 2E3), isFinite(v) &&
(e = Math.min(e, v)), isFinite(g) && (w = Math.min(w, g)));
n.width = Math.ceil(e);
n.height = Math.ceil(w);
if ("SVG" === c) {
if (null === d) return null;
d.resize(n.width, n.height, n.width, n.height);
d.ownerDocument = p;
d.Up = r;
fj(a, d.context, l, new M(Math.ceil(e), Math.ceil(w)), f, z, k, m, q, b);
return d.context
}
a.xn = !1;
fj(a, u, l, new M(Math.ceil(e), Math.ceil(w)), f, z, k, m, q, b);
a.xn = !0;
return n.context
}
ma.Object.defineProperties(P.prototype, {
div: {
get: function () {
return this.Ia
}, set: function (a) {
if (this.Ia !== a) {
Qa = [];
var b = this.Ia;
null !== b ? (b.C = void 0, b.innerHTML = "", null !== this.Da && (b = this.Da.Ga, this.removeEventListener(b, "touchstart", this.Vv, !1), this.removeEventListener(b, "touchmove", this.Uv, !1), this.removeEventListener(b, "touchend", this.Tv, !1), this.Da.ax()), b = this.toolManager, null !== b && (b.mouseDownTools.each(function (a) {
a.cancelWaitAfter()
}), b.mouseMoveTools.each(function (a) {
a.cancelWaitAfter()
}),
b.mouseUpTools.each(function (a) {
a.cancelWaitAfter()
})), b.cancelWaitAfter(), this.currentTool.doCancel(), this.Yc = this.Da = null, this.removeEventListener(x, "resize", this.aw, !1), this.removeEventListener(x, "mousemove", this.kk, !0), this.removeEventListener(x, "mousedown", this.jk, !0), this.removeEventListener(x, "mouseup", this.mk, !0), this.removeEventListener(x, "wheel", this.nk, !0), this.removeEventListener(x, "mouseout", this.lk, !0), Fe === this && (Fe = null)) : this.he = !1;
this.Ia = null;
if (null !== a) {
if (b = a.C) b.div = null;
ii(this,
a);
this.uf()
}
}
}
}, Uw: {
get: function () {
return this.wo
}
}, lv: {
get: function () {
return this.ob
}, set: function (a) {
this.ob = a
}
}, Ri: {
get: function () {
return this.he
}
}, draggedLink: {
get: function () {
return this.hr
}, set: function (a) {
this.hr !== a && (this.hr = a, null !== a && (this.ds = a.fromPort, this.es = a.toPort))
}
}, tx: {
get: function () {
return this.ds
}, set: function (a) {
this.ds = a
}
}, ux: {
get: function () {
return this.es
}, set: function (a) {
this.es = a
}
}, animationManager: {
get: function () {
return this.Bk
}
}, undoManager: {
get: function () {
return this.Zb.undoManager
}
}, skipsUndoManager: {
get: function () {
return this.fh
}, set: function (a) {
this.fh = a;
this.Zb.skipsUndoManager = a
}
}, delaysLayout: {
get: function () {
return this.Qt
}, set: function (a) {
this.Qt = a
}
}, validCycle: {
get: function () {
return this.Gs
}, set: function (a) {
var b = this.Gs;
b !== a && (this.Gs = a, this.g("validCycle", b, a))
}
}, layers: {
get: function () {
return this.Pa.iterator
}
}, isModelReadOnly: {
get: function () {
var a = this.Zb;
return null === a ? !1 : a.isReadOnly
}, set: function (a) {
var b = this.Zb;
null !== b && (b.isReadOnly = a)
}
}, isReadOnly: {
get: function () {
return this.Pf
}, set: function (a) {
var b = this.Pf;
b !== a && (this.Pf = a, this.g("isReadOnly",
b, a))
}
}, isEnabled: {
get: function () {
return this.Dc
}, set: function (a) {
var b = this.Dc;
b !== a && (this.Dc = a, this.g("isEnabled", b, a))
}
}, allowClipboard: {
get: function () {
return this.Eq
}, set: function (a) {
var b = this.Eq;
b !== a && (this.Eq = a, this.g("allowClipboard", b, a))
}
}, allowCopy: {
get: function () {
return this.Gh
}, set: function (a) {
var b = this.Gh;
b !== a && (this.Gh = a, this.g("allowCopy", b, a))
}
}, allowDelete: {
get: function () {
return this.Hh
}, set: function (a) {
var b = this.Hh;
b !== a && (this.Hh = a, this.g("allowDelete", b, a))
}
}, allowDragOut: {
get: function () {
return this.Fq
}, set: function (a) {
var b = this.Fq;
b !== a && (this.Fq = a, this.g("allowDragOut", b, a))
}
}, allowDrop: {
get: function () {
return this.Gq
}, set: function (a) {
var b = this.Gq;
b !== a && (this.Gq = a, this.g("allowDrop", b, a))
}
}, allowTextEdit: {
get: function () {
return this.Qh
}, set: function (a) {
var b =
this.Qh;
b !== a && (this.Qh = a, this.g("allowTextEdit", b, a))
}
}, allowGroup: {
get: function () {
return this.Ih
}, set: function (a) {
var b = this.Ih;
b !== a && (this.Ih = a, this.g("allowGroup", b, a))
}
}, allowUngroup: {
get: function () {
return this.Rh
}, set: function (a) {
var b = this.Rh;
b !== a && (this.Rh = a, this.g("allowUngroup", b, a))
}
}, allowInsert: {
get: function () {
return this.Iq
}, set: function (a) {
var b = this.Iq;
b !== a && (this.Iq = a, this.g("allowInsert",
b, a))
}
}, allowLink: {
get: function () {
return this.Jh
}, set: function (a) {
var b = this.Jh;
b !== a && (this.Jh = a, this.g("allowLink", b, a))
}
}, allowRelink: {
get: function () {
return this.Lh
}, set: function (a) {
var b = this.Lh;
b !== a && (this.Lh = a, this.g("allowRelink", b, a))
}
}, allowMove: {
get: function () {
return this.Kh
}, set: function (a) {
var b = this.Kh;
b !== a && (this.Kh = a, this.g("allowMove", b, a))
}
}, allowReshape: {
get: function () {
return this.Mh
},
set: function (a) {
var b = this.Mh;
b !== a && (this.Mh = a, this.g("allowReshape", b, a))
}
}, allowResize: {
get: function () {
return this.Nh
}, set: function (a) {
var b = this.Nh;
b !== a && (this.Nh = a, this.g("allowResize", b, a))
}
}, allowRotate: {
get: function () {
return this.Oh
}, set: function (a) {
var b = this.Oh;
b !== a && (this.Oh = a, this.g("allowRotate", b, a))
}
}, allowSelect: {
get: function () {
return this.Ph
}, set: function (a) {
var b = this.Ph;
b !== a && (this.Ph = a,
this.g("allowSelect", b, a))
}
}, allowUndo: {
get: function () {
return this.Jq
}, set: function (a) {
var b = this.Jq;
b !== a && (this.Jq = a, this.g("allowUndo", b, a))
}
}, allowZoom: {
get: function () {
return this.Lq
}, set: function (a) {
var b = this.Lq;
b !== a && (this.Lq = a, this.g("allowZoom", b, a))
}
}, hasVerticalScrollbar: {
get: function () {
return this.xr
}, set: function (a) {
var b = this.xr;
b !== a && (this.xr = a, Ti(this), this.R(), this.g("hasVerticalScrollbar",
b, a), Di(this, !1))
}
}, hasHorizontalScrollbar: {
get: function () {
return this.wr
}, set: function (a) {
var b = this.wr;
b !== a && (this.wr = a, Ti(this), this.R(), this.g("hasHorizontalScrollbar", b, a), Di(this, !1))
}
}, allowHorizontalScroll: {
get: function () {
return this.Hq
}, set: function (a) {
var b = this.Hq;
b !== a && (this.Hq = a, this.g("allowHorizontalScroll", b, a), Di(this, !1))
}
}, allowVerticalScroll: {
get: function () {
return this.Kq
}, set: function (a) {
var b =
this.Kq;
b !== a && (this.Kq = a, this.g("allowVerticalScroll", b, a), Di(this, !1))
}
}, scrollHorizontalLineChange: {
get: function () {
return this.qs
}, set: function (a) {
var b = this.qs;
b !== a && (0 > a && va(a, ">= 0", P, "scrollHorizontalLineChange"), this.qs = a, this.g("scrollHorizontalLineChange", b, a))
}
}, scrollVerticalLineChange: {
get: function () {
return this.ss
}, set: function (a) {
var b = this.ss;
b !== a && (0 > a && va(a, ">= 0", P, "scrollVerticalLineChange"), this.ss = a, this.g("scrollVerticalLineChange",
b, a))
}
}, lastInput: {
get: function () {
return this.sj
}, set: function (a) {
this.sj = a
}
}, firstInput: {
get: function () {
return this.Zh
}, set: function (a) {
this.Zh = a
}
}, currentCursor: {
get: function () {
return this.Yq
}, set: function (a) {
"" === a && (a = this.qn);
if (this.Yq !== a) {
var b = this.Da, c = this.Ia;
if (null !== b) {
this.Yq = a;
var d = b.style.cursor;
b.style.cursor = a;
c.style.cursor = a;
b.style.cursor === d && (b.style.cursor = "-webkit-" + a, c.style.cursor =
"-webkit-" + a, b.style.cursor === d && (b.style.cursor = "-moz-" + a, c.style.cursor = "-moz-" + a, b.style.cursor === d && (b.style.cursor = a, c.style.cursor = a)))
}
}
}
}, defaultCursor: {
get: function () {
return this.qn
}, set: function (a) {
"" === a && (a = "auto");
var b = this.qn;
b !== a && (this.qn = a, this.g("defaultCursor", b, a))
}
}, click: {
get: function () {
return this.Df
}, set: function (a) {
var b = this.Df;
b !== a && (this.Df = a, this.g("click", b, a))
}
}, doubleClick: {
get: function () {
return this.If
}, set: function (a) {
var b = this.If;
b !== a && (this.If = a, this.g("doubleClick", b, a))
}
}, contextClick: {
get: function () {
return this.Ef
}, set: function (a) {
var b = this.Ef;
b !== a && (this.Ef = a, this.g("contextClick", b, a))
}
}, mouseOver: {
get: function () {
return this.Zf
}, set: function (a) {
var b = this.Zf;
b !== a && (this.Zf = a, this.g("mouseOver", b, a))
}
}, mouseHover: {
get: function () {
return this.Xf
}, set: function (a) {
var b =
this.Xf;
b !== a && (this.Xf = a, this.g("mouseHover", b, a))
}
}, mouseHold: {
get: function () {
return this.Wf
}, set: function (a) {
var b = this.Wf;
b !== a && (this.Wf = a, this.g("mouseHold", b, a))
}
}, mouseDragOver: {
get: function () {
return this.Xr
}, set: function (a) {
var b = this.Xr;
b !== a && (this.Xr = a, this.g("mouseDragOver", b, a))
}
}, mouseDrop: {
get: function () {
return this.Uf
}, set: function (a) {
var b = this.Uf;
b !== a && (this.Uf = a, this.g("mouseDrop", b, a))
}
},
handlesDragDropForTopLevelParts: {
get: function () {
return this.vr
}, set: function (a) {
var b = this.vr;
b !== a && (this.vr = a, this.g("handlesDragDropForTopLevelParts", b, a))
}
}, mouseEnter: {
get: function () {
return this.Vf
}, set: function (a) {
var b = this.Vf;
b !== a && (this.Vf = a, this.g("mouseEnter", b, a))
}
}, mouseLeave: {
get: function () {
return this.Yf
}, set: function (a) {
var b = this.Yf;
b !== a && (this.Yf = a, this.g("mouseLeave", b, a))
}
}, toolTip: {
get: function () {
return this.kg
}, set: function (a) {
var b = this.kg;
b !== a && (this.kg = a, this.g("toolTip", b, a))
}
}, contextMenu: {
get: function () {
return this.Ff
}, set: function (a) {
var b = this.Ff;
b !== a && (this.Ff = a, this.g("contextMenu", b, a))
}
}, commandHandler: {
get: function () {
return this.K
}, set: function (a) {
this.K !== a && (this.K = a, a.hb(this))
}
}, toolManager: {
get: function () {
return this.Ub
}, set: function (a) {
this.Ub !== a && (this.Ub =
a, a.hb(this))
}
}, defaultTool: {
get: function () {
return this.La
}, set: function (a) {
var b = this.La;
b !== a && (this.La = a, a.hb(this), this.currentTool === b && (this.currentTool = a))
}
}, currentTool: {
get: function () {
return this.ba
}, set: function (a) {
var b = this.ba;
null !== b && (b.isActive && b.doDeactivate(), b.cancelWaitAfter(), b.doStop());
null === a && (a = this.defaultTool);
null !== a && (this.ba = a, a.hb(this), a.doStart())
}
}, selection: {
get: function () {
return this.Cq
}
},
maxSelectionCount: {
get: function () {
return this.Tr
}, set: function (a) {
var b = this.Tr;
if (b !== a) if (0 <= a && !isNaN(a)) {
if (this.Tr = a, this.g("maxSelectionCount", b, a), !this.undoManager.isUndoingRedoing && (a = this.selection.count - a, 0 < a)) {
this.aa("ChangingSelection", this.selection);
b = this.selection.Na();
for (var c = 0; c < a; c++) b[c].isSelected = !1;
this.aa("ChangedSelection", this.selection)
}
} else va(a, ">= 0", P, "maxSelectionCount")
}
}, nodeSelectionAdornmentTemplate: {
get: function () {
return this.$r
}, set: function (a) {
var b = this.$r;
b !== a && (this.$r = a, this.g("nodeSelectionAdornmentTemplate", b, a))
}
}, groupSelectionAdornmentTemplate: {
get: function () {
return this.tr
}, set: function (a) {
var b = this.tr;
b !== a && (this.tr = a, this.g("groupSelectionAdornmentTemplate", b, a))
}
}, linkSelectionAdornmentTemplate: {
get: function () {
return this.Pr
}, set: function (a) {
var b = this.Pr;
b !== a && (this.Pr = a, this.g("linkSelectionAdornmentTemplate", b,
a))
}
}, highlighteds: {
get: function () {
return this.Aq
}
}, isModified: {
get: function () {
var a = this.undoManager;
return a.isEnabled ? null !== a.currentTransaction ? !0 : this.u && this.ge !== a.historyIndex : this.u
}, set: function (a) {
if (this.u !== a) {
this.u = a;
var b = this.undoManager;
!a && b.isEnabled && (this.ge = b.historyIndex);
a || Dj(this)
}
}
}, model: {
get: function () {
return this.Zb
}, set: function (a) {
var b = this.Zb;
if (b !== a) {
this.currentTool.doCancel();
null !== b && b.undoManager !== a.undoManager && b.undoManager.isInTransaction && B("Do not replace a Diagram.model while a transaction is in progress.");
li(this, !0);
this.he = !1;
this.Yk = !0;
this.ge = -2;
this.qd = !1;
var c = this.Yb;
this.Yb = !0;
this.animationManager.Ui("Model");
null !== b && (null !== this.pe && this.pe.each(function (a) {
b.rk(a)
}), b.rk(this.Dm));
this.Zb = a;
this.partManager = Ej(this.Zb.constructor.type);
a.sh(this.Ag);
this.partManager.addAllModeledParts();
a.rk(this.Ag);
a.sh(this.Dm);
null !== this.pe && this.pe.each(function (b) {
a.sh(b)
});
this.Yb = c;
this.ob || this.R();
null !== b && a.undoManager.copyProperties(b.undoManager)
}
}
}, ea: {
get: function () {
return this.Vc
}, set: function (a) {
this.Vc = a
}
}, gt: {
get: function () {
return this.Bq
}
}, skipsModelSourceBindings: {
get: function () {
return this.Eh
}, set: function (a) {
this.Eh = a
}
}, tk: {
get: function () {
return this.xu
}, set: function (a) {
this.xu = a
}
}, nodeTemplate: {
get: function () {
return this.$f.J("")
},
set: function (a) {
var b = this.$f.J("");
b !== a && (this.$f.add("", a), this.g("nodeTemplate", b, a), this.undoManager.isUndoingRedoing || this.ud())
}
}, nodeTemplateMap: {
get: function () {
return this.$f
}, set: function (a) {
var b = this.$f;
b !== a && (this.$f = a, this.g("nodeTemplateMap", b, a), this.undoManager.isUndoingRedoing || this.ud())
}
}, groupTemplate: {
get: function () {
return this.$h.J("")
}, set: function (a) {
var b = this.$h.J("");
b !== a && (this.$h.add("", a), this.g("groupTemplate",
b, a), this.undoManager.isUndoingRedoing || this.ud())
}
}, groupTemplateMap: {
get: function () {
return this.$h
}, set: function (a) {
var b = this.$h;
b !== a && (this.$h = a, this.g("groupTemplateMap", b, a), this.undoManager.isUndoingRedoing || this.ud())
}
}, linkTemplate: {
get: function () {
return this.Vg.J("")
}, set: function (a) {
var b = this.Vg.J("");
b !== a && (this.Vg.add("", a), this.g("linkTemplate", b, a), this.undoManager.isUndoingRedoing || this.ud())
}
}, linkTemplateMap: {
get: function () {
return this.Vg
}, set: function (a) {
var b = this.Vg;
b !== a && (this.Vg = a, this.g("linkTemplateMap", b, a), this.undoManager.isUndoingRedoing || this.ud())
}
}, isMouseOverDiagram: {
get: function () {
return this.Re
}, set: function (a) {
this.Re = a
}
}, isMouseCaptured: {
get: function () {
return this.Kc
}, set: function (a) {
var b = this.Da;
null !== b && (b = b.Ga, b instanceof SVGElement || (a ? (this.lastInput.bubbles = !1, this.Mq ? (this.removeEventListener(b, "pointermove",
this.km, !1), this.removeEventListener(b, "pointerdown", this.jm, !1), this.removeEventListener(b, "pointerup", this.mm, !1), this.removeEventListener(b, "pointerout", this.lm, !1), this.addEventListener(x, "pointermove", this.km, !0), this.addEventListener(x, "pointerdown", this.jm, !0), this.addEventListener(x, "pointerup", this.mm, !0), this.addEventListener(x, "pointerout", this.lm, !0)) : (this.removeEventListener(b, "mousemove", this.kk, !1), this.removeEventListener(b, "mousedown", this.jk, !1), this.removeEventListener(b, "mouseup",
this.mk, !1), this.removeEventListener(b, "mouseout", this.lk, !1), this.addEventListener(x, "mousemove", this.kk, !0), this.addEventListener(x, "mousedown", this.jk, !0), this.addEventListener(x, "mouseup", this.mk, !0), this.addEventListener(x, "mouseout", this.lk, !0)), this.removeEventListener(b, "wheel", this.nk, !1), this.addEventListener(x, "wheel", this.nk, !0), this.addEventListener(x, "selectstart", this.preventDefault, !1)) : (this.Mq ? (this.removeEventListener(x, "pointermove", this.km, !0), this.removeEventListener(x, "pointerdown",
this.jm, !0), this.removeEventListener(x, "pointerup", this.mm, !0), this.removeEventListener(x, "pointerout", this.lm, !0), this.addEventListener(b, "pointermove", this.km, !1), this.addEventListener(b, "pointerdown", this.jm, !1), this.addEventListener(b, "pointerup", this.mm, !1), this.addEventListener(b, "pointerout", this.lm, !1)) : (this.removeEventListener(x, "mousemove", this.kk, !0), this.removeEventListener(x, "mousedown", this.jk, !0), this.removeEventListener(x, "mouseup", this.mk, !0), this.removeEventListener(x, "mouseout",
this.lk, !0), this.addEventListener(b, "mousemove", this.kk, !1), this.addEventListener(b, "mousedown", this.jk, !1), this.addEventListener(b, "mouseup", this.mk, !1), this.addEventListener(b, "mouseout", this.lk, !1)), this.removeEventListener(x, "wheel", this.nk, !0), this.removeEventListener(x, "selectstart", this.preventDefault, !1), this.addEventListener(b, "wheel", this.nk, !1)), this.Kc = a))
}
}, position: {
get: function () {
return this.sa
}, set: function (a) {
var b = G.alloc().assign(this.sa);
if (!b.A(a)) {
var c =
this.viewportBounds.copy();
this.sa.assign(a);
this.ob || null === this.Da && !this.Hp.o() || (this.ob = !0, a = this.scale, Fi(this, this.vn, this.xa / a, this.wa / a, this.ej, !1), this.ob = !1);
Mh(this.animationManager, b, this.sa);
this.ob || this.mq(c, this.viewportBounds, this.Ca, !1)
}
G.free(b)
}
}, initialPosition: {
get: function () {
return this.zr
}, set: function (a) {
this.zr.A(a) || (this.zr = a.I())
}
}, initialScale: {
get: function () {
return this.Ar
}, set: function (a) {
this.Ar !== a && (this.Ar =
a)
}
}, grid: {
get: function () {
null === this.Eb && wi(this);
return this.Eb
}, set: function (a) {
var b = this.Eb;
if (b !== a) {
null === b && (wi(this), b = this.Eb);
a.type !== X.Grid && B("Diagram.grid must be a Panel of type Panel.Grid");
var c = b.panel;
null !== c && c.remove(b);
this.Eb = a;
a.name = "GRID";
null !== c && c.add(a);
Wi(this);
this.R();
this.g("grid", b, a)
}
}
}, viewportBounds: {
get: function () {
var a = this.Mw, b = this.sa, c = this.Ca;
if (null === this.Da) return this.Hp.o() && a.h(b.x, b.y,
this.xa / c, this.wa / c), a;
a.h(b.x, b.y, Math.max(this.xa, 0) / c, Math.max(this.wa, 0) / c);
return a
}
}, viewSize: {
get: function () {
return this.Hp
}, set: function (a) {
var b = this.viewSize;
b.A(a) || (this.Hp = a = a.I(), this.xa = a.width, this.wa = a.height, this.Xa(), this.g("viewSize", b, a))
}
}, fixedBounds: {
get: function () {
return this.qr
}, set: function (a) {
var b = this.qr;
b.A(a) || (-Infinity !== a.width && Infinity !== a.height && -Infinity !== a.height || B("fixedBounds width/height must not be Infinity"),
this.qr = a = a.I(), this.Xa(), this.g("fixedBounds", b, a))
}
}, scrollMargin: {
get: function () {
return this.ui
}, set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.ui;
b.A(a) || (this.ui = a = a.I(), this.g("scrollMargin", b, a), this.uf())
}
}, scrollMode: {
get: function () {
return this.Ij
}, set: function (a) {
var b = this.Ij;
b !== a && (this.Ij = a, a === Xh && Di(this, !1), this.g("scrollMode", b, a), this.uf())
}
}, scrollsPageOnFocus: {
get: function () {
return this.ts
},
set: function (a) {
var b = this.ts;
b !== a && (this.ts = a, this.g("scrollsPageOnFocus", b, a))
}
}, positionComputation: {
get: function () {
return this.ks
}, set: function (a) {
var b = this.ks;
b !== a && (this.ks = a, Di(this, !1), this.g("positionComputation", b, a))
}
}, scaleComputation: {
get: function () {
return this.os
}, set: function (a) {
var b = this.os;
b !== a && (this.os = a, Bj(this, this.scale, this.scale), this.g("scaleComputation", b, a))
}
}, documentBounds: {
get: function () {
return this.vn
}
}, isVirtualized: {
get: function () {
return this.Kr
}, set: function (a) {
var b = this.Kr;
b !== a && (this.Kr = a, this.g("isVirtualized", b, a))
}
}, scale: {
get: function () {
return this.Ca
}, set: function (a) {
var b = this.Ca;
b !== a && Bj(this, b, a)
}
}, defaultScale: {
get: function () {
return this.er
}, set: function (a) {
this.er = a
}
}, autoScale: {
get: function () {
return this.cj
}, set: function (a) {
var b =
this.cj;
b !== a && (this.cj = a, this.g("autoScale", b, a), a !== Yh && Di(this, !1))
}
}, initialAutoScale: {
get: function () {
return this.ci
}, set: function (a) {
var b = this.ci;
b !== a && (this.ci = a, this.g("initialAutoScale", b, a))
}
}, initialViewportSpot: {
get: function () {
return this.Br
}, set: function (a) {
var b = this.Br;
b !== a && (a.gb() || B("initialViewportSpot must be a specific Spot: " + a), this.Br = a, this.g("initialViewportSpot", b, a))
}
}, initialDocumentSpot: {
get: function () {
return this.yr
}, set: function (a) {
var b = this.yr;
b !== a && (a.gb() || B("initialViewportSpot must be a specific Spot: " + a), this.yr = a, this.g("initialDocumentSpot", b, a))
}
}, minScale: {
get: function () {
return this.Ur
}, set: function (a) {
var b = this.Ur;
b !== a && (0 < a ? (this.Ur = a, this.g("minScale", b, a), a > this.scale && (this.scale = a)) : va(a, "> 0", P, "minScale"))
}
}, maxScale: {
get: function () {
return this.Sr
}, set: function (a) {
var b = this.Sr;
b !== a && (0 < a ? (this.Sr =
a, this.g("maxScale", b, a), a < this.scale && (this.scale = a)) : va(a, "> 0", P, "maxScale"))
}
}, zoomPoint: {
get: function () {
return this.Js
}, set: function (a) {
this.Js.A(a) || (this.Js = a = a.I())
}
}, contentAlignment: {
get: function () {
return this.ej
}, set: function (a) {
var b = this.ej;
b.A(a) || (this.ej = a = a.I(), this.g("contentAlignment", b, a), Di(this, !1))
}
}, initialContentAlignment: {
get: function () {
return this.On
}, set: function (a) {
var b = this.On;
b.A(a) || (this.On = a = a.I(), this.g("initialContentAlignment", b, a))
}
}, padding: {
get: function () {
return this.eb
}, set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.eb;
b.A(a) || (this.eb = a = a.I(), this.Xa(), this.g("padding", b, a))
}
}, partManager: {
get: function () {
return this.Ma
}, set: function (a) {
var b = this.Ma;
b !== a && (null !== a.diagram && B("Cannot share PartManagers between Diagrams: " + a.toString()), null !== b && b.hb(null), this.Ma = a, a.hb(this))
}
}, nodes: {
get: function () {
return this.partManager.nodes.iterator
}
}, links: {
get: function () {
return this.partManager.links.iterator
}
}, parts: {
get: function () {
return this.partManager.parts.iterator
}
}, layout: {
get: function () {
return this.gc
}, set: function (a) {
var b = this.gc;
b !== a && (this.gc = a, a.diagram = this, a.group = null, this.Dg = !0, this.g("layout", b, a), this.cc())
}
}, isTreePathToChildren: {
get: function () {
return this.Jr
},
set: function (a) {
var b = this.Jr;
if (b !== a && (this.Jr = a, this.g("isTreePathToChildren", b, a), !this.undoManager.isUndoingRedoing)) for (a = this.nodes; a.next();) jk(a.value)
}
}, treeCollapsePolicy: {
get: function () {
return this.Es
}, set: function (a) {
var b = this.Es;
b !== a && (a !== $h && a !== kk && a !== lk && B("Unknown Diagram.treeCollapsePolicy: " + a), this.Es = a, this.g("treeCollapsePolicy", b, a))
}
}, Fe: {
get: function () {
return this.Vb
}, set: function (a) {
this.Vb = a
}
}, autoScrollInterval: {
get: function () {
return this.Tm
}, set: function (a) {
var b = this.Tm;
b !== a && (this.Tm = a, this.g("autoScrollInterval", b, a))
}
}, autoScrollRegion: {
get: function () {
return this.Um
}, set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.Um;
b.A(a) || (this.Um = a = a.I(), this.Xa(), this.g("autoScrollRegion", b, a))
}
}
});
ma.Object.defineProperties(P, {
licenseKey: {
get: function () {
return mk.Sb()
}, set: function (a) {
mk.add(a)
}
}, version: {
get: function () {
return nk
}
}
});
P.prototype.makeImageData = P.prototype.px;
P.prototype.makeImage = P.prototype.yz;
P.prototype.addRenderer = P.prototype.iy;
P.prototype.makeSVG = P.prototype.ov;
P.prototype.makeSvg = P.prototype.it;
P.prototype.stopAutoScroll = P.prototype.xf;
P.prototype.doAutoScroll = P.prototype.Os;
P.prototype.isUnoccupied = P.prototype.gk;
P.prototype.raiseDiagramEvent = P.prototype.aa;
P.prototype.removeDiagramListener = P.prototype.nm;
P.prototype.addDiagramListener = P.prototype.Pj;
P.prototype.findTreeRoots = P.prototype.Xy;
P.prototype.layoutDiagram = P.prototype.wz;
P.prototype.findTopLevelGroups = P.prototype.Qy;
P.prototype.findTopLevelNodesAndLinks = P.prototype.Ry;
P.prototype.findLinksByExample = P.prototype.Rs;
P.prototype.findNodesByExample = P.prototype.Ss;
P.prototype.findLinkForData = P.prototype.uc;
P.prototype.findNodeForData = P.prototype.Hi;
P.prototype.findPartForData = P.prototype.vc;
P.prototype.findNodeForKey = P.prototype.Hb;
P.prototype.findPartForKey = P.prototype.findPartForKey;
P.prototype.rebuildParts = P.prototype.ud;
P.prototype.transformViewToDoc = P.prototype.yt;
P.prototype.transformRectDocToView = P.prototype.Xz;
P.prototype.transformDocToView = P.prototype.xt;
P.prototype.centerRect = P.prototype.Ku;
P.prototype.scrollToRect = P.prototype.Hv;
P.prototype.scroll = P.prototype.scroll;
P.prototype.highlightCollection = P.prototype.lz;
P.prototype.highlight = P.prototype.kz;
P.prototype.clearHighlighteds = P.prototype.Mu;
P.prototype.selectCollection = P.prototype.Iv;
P.prototype.select = P.prototype.select;
P.prototype.clearSelection = P.prototype.Rp;
P.prototype.updateAllRelationshipsFromData = P.prototype.xq;
P.prototype.updateAllTargetBindings = P.prototype.updateAllTargetBindings;
P.prototype.commit = P.prototype.commit;
P.prototype.rollbackTransaction = P.prototype.wf;
P.prototype.commitTransaction = P.prototype.Za;
P.prototype.startTransaction = P.prototype.Aa;
P.prototype.raiseChanged = P.prototype.g;
P.prototype.raiseChangedEvent = P.prototype.ab;
P.prototype.removeChangedListener = P.prototype.rk;
P.prototype.addChangedListener = P.prototype.sh;
P.prototype.removeModelChangedListener = P.prototype.Mz;
P.prototype.addModelChangedListener = P.prototype.Sw;
P.prototype.findLayer = P.prototype.$l;
P.prototype.removeLayer = P.prototype.Kz;
P.prototype.addLayerAfter = P.prototype.by;
P.prototype.addLayerBefore = P.prototype.Qw;
P.prototype.addLayer = P.prototype.Rl;
P.prototype.moveParts = P.prototype.moveParts;
P.prototype.copyParts = P.prototype.Zj;
P.prototype.removeParts = P.prototype.rt;
P.prototype.remove = P.prototype.remove;
P.prototype.add = P.prototype.add;
P.prototype.clearDelayedGeometries = P.prototype.Lu;
P.prototype.setProperties = P.prototype.Ov;
P.prototype.resetInputOptions = P.prototype.Ev;
P.prototype.setInputOption = P.prototype.Qz;
P.prototype.getInputOption = P.prototype.cm;
P.prototype.resetRenderingHints = P.prototype.Fv;
P.prototype.setRenderingHint = P.prototype.Gx;
P.prototype.getRenderingHint = P.prototype.Ee;
P.prototype.maybeUpdate = P.prototype.fd;
P.prototype.requestUpdate = P.prototype.cc;
P.prototype.delayInitialization = P.prototype.xy;
P.prototype.isUpdateRequested = P.prototype.rz;
P.prototype.redraw = P.prototype.uf;
P.prototype.invalidateDocumentBounds = P.prototype.Xa;
P.prototype.findObjectsNear = P.prototype.rg;
P.prototype.findPartsNear = P.prototype.Ny;
P.prototype.findObjectsIn = P.prototype.qg;
P.prototype.findPartsIn = P.prototype.ix;
P.prototype.findObjectsAt = P.prototype.Ii;
P.prototype.findPartsAt = P.prototype.My;
P.prototype.findObjectAt = P.prototype.Rb;
P.prototype.findPartAt = P.prototype.am;
P.prototype.alignDocument = P.prototype.jy;
P.prototype.zoomToRect = P.prototype.$z;
P.prototype.zoomToFit = P.prototype.zoomToFit;
P.prototype.diagramScroll = P.prototype.$w;
P.prototype.focus = P.prototype.focus;
P.prototype.reset = P.prototype.reset;
P.useDOM = function (a) {
Wg = a ? void 0 !== x.document : !1
};
P.isUsingDOM = function () {
return Wg
};
var Fe = null, ai = new vb, ui = null, ti = null, Wg = void 0 !== x.document, ji = null, ki = "",
Yh = new D(P, "None", 0), Hi = new D(P, "Uniform", 1), Ii = new D(P, "UniformToFill", 2),
Pf = new D(P, "CycleAll", 10), Tf = new D(P, "CycleNotDirected", 11), Vf = new D(P, "CycleNotDirectedFast", 12),
Wf = new D(P, "CycleNotUndirected", 13), Qf = new D(P, "CycleDestinationTree", 14),
Sf = new D(P, "CycleSourceTree", 15), Xh = new D(P, "DocumentScroll", 1), ij = new D(P, "InfiniteScroll", 2),
$h = new D(P, "TreeParentCollapsed", 21), kk = new D(P, "AllParentsCollapsed", 22), lk = new D(P,
"AnyParentsCollapsed", 23), mk = new E, nk = "2.0.17", ok = null, Vh = !1;
function Wh() {
if (Wg) {
var a = x.document.createElement("canvas"), b = a.getContext("2d"), c = Ra("7ca11abfd022028846");
b[c] = Ra("398c3597c01238");
for (var d = ["5da73c80a36455d4038e4972187c3cae51fd22", qa.Dx + "4ae6247590da4bb21c324ba3a84e385776", wc.xF + "fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387", H.za], e = 1; 5 > e; e++) b[Ra("7ca11abfd7330390")](Ra(d[e - 1]), 10, 15 * e);
b[c] = Ra("39f046ebb36e4b");
for (c = 1; 5 > c; c++) b[Ra("7ca11abfd7330390")](Ra(d[c - 1]), 10, 15 * c);
ok = a
}
}
P.className = "Diagram";
P.fromDiv = function (a) {
var b = a;
"string" === typeof a && (b = x.document.getElementById(a));
return b instanceof HTMLDivElement && b.C instanceof P ? b.C : null
};
P.inherit = function (a, b) {
function c() {
}
if (Object.getPrototypeOf(a).prototype) throw Error("Used go.Diagram.inherit defining already defined class \n" + a);
c.prototype = b.prototype;
a.prototype = new c;
a.prototype.constructor = a
};
P.None = Yh;
P.Uniform = Hi;
P.UniformToFill = Ii;
P.CycleAll = Pf;
P.CycleNotDirected = Tf;
P.CycleNotDirectedFast = Vf;
P.CycleNotUndirected = Wf;
P.CycleDestinationTree = Qf;
P.CycleSourceTree = Sf;
P.DocumentScroll = Xh;
P.InfiniteScroll = ij;
P.TreeParentCollapsed = $h;
P.AllParentsCollapsed = kk;
P.AnyParentsCollapsed = lk;
function hi() {
this.Xx = null;
this.l = "zz@orderNum";
"63ad05bbe23a1786468a4c741b6d2" === this._tk ? this.Oe = this.l = !0 : this.Oe = null
}
function ej(a, b) {
b.Yc.setTransform(b.Mb, 0, 0, b.Mb, 0, 0);
if (null === a.Oe) {
b = "f";
var c = x[Ra("76a715b2f73f148a")][Ra("72ba13b5")];
a.Oe = !0;
if (Wg) {
var d = P[Ra("76a115b6ed251eaf4692")];
if (d) for (var e = mk.iterator; e.next();) {
d = e.value;
d = Ra(d).split(Ra("39e9"));
if (6 > d.length) break;
var f = Ra(d[1]).split(".");
if ("7da71ca0" !== d[4]) break;
var g = Ra(qa[Ra("6cae19")]).split(".");
if (f[0] > g[0] || f[0] === g[0] && f[1] >= g[1]) {
f = c[Ra("76ad18b4f73e")];
for (g = c[Ra("73a612b6fb191d")](Ra("35e7")) + 2; g < f; g++) b += c[g];
f = b[Ra("73a612b6fb191d")](Ra(d[2]));
0 > f && Ra(d[2]) !== Ra("7da71ca0ad381e90") && (f = b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));
0 > f && (f = b[Ra("73a612b6fb191d")](Ra("76a715b2ef3e149757")));
0 > f && (f = c[Ra("73a612b6fb191d")](Ra("7baa19a6f76c1988428554")));
a.Oe = !(0 <= f && f < b[Ra("73a612b6fb191d")](Ra("35")) || -1 === b[Ra("73a612b6fb191d")](Ra("35")));
if (!a.Oe) break;
f = Ra(d[2]);
if ("#" !== f[0]) break;
g = x.document.createElement("div");
for (var h = d[0].replace(/[A-Za-z]/g, ""); 4 > h.length;) h += "9";
h = h.substr(h.length - 4);
d = "";
d += ["gsh", "gsf"][parseInt(h.substr(0,
1), 10) % 2];
d += ["Header", "Background", "Display", "Feedback"][parseInt(h.substr(0, 1), 10) % 4];
g[Ra("79a417a0f0181a8946")] = d;
if (x.document[Ra("78a712aa")]) {
x.document[Ra("78a712aa")][Ra("7bb806b6ed32388c4a875b")](g);
h = x.getComputedStyle(g).getPropertyValue(Ra("78a704b7e62456904c9b12701b6532a8"));
x.document[Ra("78a712aa")][Ra("68ad1bbcf533388c4a875b")](g);
if (!h) break;
if (-1 !== h.indexOf(parseInt(f[1] + f[2], 16)) && -1 !== h.indexOf(parseInt(f[3] + f[4], 16))) {
a.Oe = !1;
break
} else if (Sa || Ta || Ua || Va) for (d = "." + d, f = 0; f < document.styleSheets.length; f++) {
g =
document.styleSheets[f].rules || document.styleSheets[f].cssRules;
for (var k in g) if (d === g[k].selectorText) {
a.Oe = !1;
break
}
}
} else a.Oe = null, a.Oe = !1
}
} else {
k = c[Ra("76ad18b4f73e")];
for (e = c[Ra("73a612b6fb191d")](Ra("35e7")) + 2; e < k; e++) b += c[e];
c = b[Ra("73a612b6fb191d")](Ra("7da71ca0ad381e90"));
a.Oe = !(0 <= c && c < b[Ra("73a612b6fb191d")](Ra("35")))
}
}
}
return 0 < a.Oe && a !== a.Xx ? !0 : !1
}
function ii(a, b) {
if (Wg) {
void 0 !== b && null !== b || B("Diagram setup requires an argument DIV.");
null !== a.Ia && B("Diagram has already completed setup.");
"string" === typeof b ? a.Ia = x.document.getElementById(b) : b instanceof HTMLDivElement ? a.Ia = b : B("No DIV or DIV id supplied: " + b);
null === a.Ia && B("Invalid DIV id; could not get element with id: " + b);
void 0 !== a.Ia.C && B("Invalid div id; div already has a Diagram associated with it.");
"static" === x.getComputedStyle(a.Ia, null).position && (a.Ia.style.position = "relative");
a.Ia.style["-webkit-tap-highlight-color"] = "rgba(255, 255, 255, 0)";
a.Ia.style["-ms-touch-action"] = "none";
a.Ia.innerHTML = "";
a.Ia.C = a;
var c = a.Bs ? new jj(a) : new ik(a);
void 0 !== c.style && (c.style.position = "absolute", c.style.top = "0px", c.style.left = "0px", "rtl" === x.getComputedStyle(a.Ia, null).getPropertyValue("direction") && (a.Tn = !0), c.style.zIndex = "2", c.style.userSelect = "none", c.style.webkitUserSelect = "none", c.style.MozUserSelect = "none");
a.Da = c;
a.Yc = c.context;
b = a.Yc;
a.Mb = a.computePixelRatio();
a.xa = a.Ia.clientWidth ||
1;
a.wa = a.Ia.clientHeight || 1;
lj(a, a.xa, a.wa);
//a.ir = b.W[Ra("7eba17a4ca3b1a8346")][Ra("78a118b7")](b.W, ok, 4, 4);
a.ir = function () {
return true
};
a.Ia.insertBefore(c.Ga, a.Ia.firstChild);
c = new ik(null);
c.width = 1;
c.height = 1;
a.Ut = c;
a.tw = c.context;
if (Wg) {
c = ta("div");
var d = ta("div");
c.style.position = "absolute";
c.style.overflow = "auto";
c.style.width = a.xa + "px";
c.style.height = a.wa + "px";
c.style.zIndex = "1";
d.style.position = "absolute";
d.style.width = "1px";
d.style.height = "1px";
a.Ia.appendChild(c);
c.appendChild(d);
c.onscroll = xi;
c.onmousedown = zi;
c.ontouchstart =
zi;
c.C = a;
c.Vx = !0;
c.Wx = !0;
a.rs = c;
a.ip = d
}
a.ot = ra(function () {
a.kh = null;
a.R()
}, 300);
a.aw = ra(function () {
Bh(a)
}, 250);
a.preventDefault = function (a) {
a.preventDefault();
return !1
};
a.kk = function (b) {
if (a.isEnabled) {
a.Re = !0;
var c = Mi(a, b, !0);
a.doMouseMove();
a.currentTool.isBeyondDragSize() && (a.Fd = 0);
Si(c, b)
}
};
a.jk = function (b) {
if (a.isEnabled) if (a.Re = !0, a.Se) b.preventDefault(); else {
var c = Mi(a, b, !0);
c.down = !0;
c.clickCount = b.detail;
if (Ta || Ua) b.timeStamp - a.ll < a.Cu && !a.currentTool.isBeyondDragSize() ? a.Fd++ : a.Fd = 1, a.ll =
b.timeStamp, c.clickCount = a.Fd;
c.clone(a.firstInput);
a.doMouseDown();
1 === b.button ? b.preventDefault() : Si(c, b)
}
};
a.mk = function (b) {
if (a.isEnabled) if (a.Se && 2 === b.button) b.preventDefault(); else if (a.Se && 0 === b.button && (a.Se = !1), a.Nl) b.preventDefault(); else {
a.Re = !0;
var c = Mi(a, b, !0);
c.up = !0;
c.clickCount = b.detail;
if (Ta || Ua) c.clickCount = a.Fd;
c.bubbles = b.bubbles;
c.targetDiagram = Oi(b);
a.doMouseUp();
a.xf();
Si(c, b)
}
};
a.nk = function (b) {
if (a.isEnabled) {
var c = Mi(a, b, !0);
c.bubbles = !0;
var d = 0, e = 0;
c.delta = 0;
void 0 !== b.deltaX ?
(0 !== b.deltaX && (d = 0 < b.deltaX ? 1 : -1), 0 !== b.deltaY && (e = 0 < b.deltaY ? 1 : -1), c.delta = Math.abs(b.deltaX) > Math.abs(b.deltaY) ? -d : -e) : void 0 !== b.wheelDeltaX ? (0 !== b.wheelDeltaX && (d = 0 < b.wheelDeltaX ? -1 : 1), 0 !== b.wheelDeltaY && (e = 0 < b.wheelDeltaY ? -1 : 1), c.delta = Math.abs(b.wheelDeltaX) > Math.abs(b.wheelDeltaY) ? -d : -e) : void 0 !== b.wheelDelta && 0 !== b.wheelDelta && (c.delta = 0 < b.wheelDelta ? 1 : -1);
a.doMouseWheel();
Si(c, b)
}
};
a.lk = function (b) {
a.isEnabled && (a.Re = !1, Mi(a, b, !0), b = a.currentTool, b.cancelWaitAfter(), b.standardMouseOver())
};
a.Vv = function (b) {
if (a.isEnabled) {
a.Nl = !1;
a.Se = !0;
var c = Pi(a, b, b.targetTouches[0], 1 < b.touches.length), d = null;
0 < b.targetTouches.length ? d = b.targetTouches[0] : 0 < b.changedTouches.length && (d = b.changedTouches[0]);
if (null !== d) {
var e = d.screenX;
d = d.screenY;
var k = a.Mr;
b.timeStamp - a.ll < a.Cu && !(25 < Math.abs(k.x - e) || 25 < Math.abs(k.y - d)) ? a.Fd++ : a.Fd = 1;
c.clickCount = a.Fd;
a.ll = b.timeStamp;
a.Mr.h(e, d)
}
a.doMouseDown();
Si(c, b)
}
};
a.Uv = function (b) {
if (a.isEnabled) {
var c = null;
0 < b.targetTouches.length ? c = b.targetTouches[0] : 0 <
b.changedTouches.length && (c = b.changedTouches[0]);
c = Ri(a, b, c, 1 < b.touches.length);
a.doMouseMove();
Si(c, b)
}
};
a.Tv = function (b) {
if (a.isEnabled) if (a.Nl) b.preventDefault(); else if (!(1 < b.touches.length)) {
var c = null, d = null;
0 < b.targetTouches.length ? d = b.targetTouches[0] : 0 < b.changedTouches.length && (d = b.changedTouches[0]);
var e = Qi(a, b, !1, !0, !1, !1);
null !== d && (c = x.document.elementFromPoint(d.clientX, d.clientY), null !== c && c.C instanceof P && c.C !== a && Ni(c.C, d, e), Ni(a, d, e), e.clickCount = a.Fd);
null === c ? e.targetDiagram =
Oi(b) : c.C ? e.targetDiagram = c.C : e.targetDiagram = null;
e.targetObject = null;
a.doMouseUp();
Si(e, b);
a.Se = !1
}
};
a.jm = function (b) {
if (a.isEnabled) {
a.Re = !0;
var c = a.ou;
void 0 === c[b.pointerId] && (c[b.pointerId] = b);
c = a.wl;
var d = !1;
if (null !== c[0] && c[0].pointerId === b.pointerId) c[0] = b; else if (null !== c[1] && c[1].pointerId === b.pointerId) c[1] = b, d = !0; else if (null === c[0]) c[0] = b; else if (null === c[1]) c[1] = b, d = !0; else {
b.preventDefault();
return
}
if ("touch" === b.pointerType || "pen" === b.pointerType) a.Nl = !1, a.Se = !0;
c = Pi(a, b, b, d);
d =
a.Mr;
var e = "touch" === b.pointerType || "pen" === b.pointerType ? 25 : 10;
b.timeStamp - a.ll < a.Cu && !(Math.abs(d.x - b.screenX) > e || Math.abs(d.y - b.screenY) > e) ? a.Fd++ : a.Fd = 1;
c.clickCount = a.Fd;
a.ll = b.timeStamp;
a.Mr.xg(b.screenX, b.screenY);
a.doMouseDown();
1 === b.button ? b.preventDefault() : Si(c, b)
}
};
a.km = function (b) {
if (a.isEnabled) {
a.Re = !0;
var c = a.wl;
if (null !== c[0] && c[0].pointerId === b.pointerId) c[0] = b; else {
if (null !== c[1] && c[1].pointerId === b.pointerId) {
c[1] = b;
return
}
if (null === c[0]) c[0] = b; else return
}
c[0].pointerId === b.pointerId &&
(c = Ri(a, b, b, null !== c[1]), a.doMouseMove(), Si(c, b))
}
};
a.mm = function (b) {
if (a.isEnabled) {
a.Re = !0;
var c = "touch" === b.pointerType || "pen" === b.pointerType, d = a.ou;
if (c && a.Nl) delete d[b.pointerId], b.preventDefault(); else if (d = a.wl, null !== d[0] && d[0].pointerId === b.pointerId) {
d[0] = null;
d = Qi(a, b, !1, !0, !0, !1);
var e = x.document.elementFromPoint(b.clientX, b.clientY);
null !== e && e.C instanceof P && e.C !== a && Ni(e.C, b, d);
Ni(a, b, d);
d.clickCount = a.Fd;
null === e ? d.targetDiagram = Oi(b) : e.C ? d.targetDiagram = e.C : d.targetDiagram = null;
d.targetObject = null;
a.doMouseUp();
Si(d, b);
c && (a.Se = !1)
} else null !== d[1] && d[1].pointerId === b.pointerId && (d[1] = null)
}
};
a.lm = function (b) {
if (a.isEnabled) {
a.Re = !1;
var c = a.ou;
c[b.pointerId] && delete c[b.pointerId];
c = a.wl;
null !== c[0] && c[0].pointerId === b.pointerId && (c[0] = null);
null !== c[1] && c[1].pointerId === b.pointerId && (c[1] = null);
"touch" !== b.pointerType && "pen" !== b.pointerType && (b = a.currentTool, b.cancelWaitAfter(), b.standardMouseOver())
}
};
b.Rc(!0);
vi(a)
}
}
hi.className = "DiagramHelper";
function ff(a) {
this.l = void 0 === a ? new G : a;
this.u = new G
}
ma.Object.defineProperties(ff.prototype, {
point: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}, shifted: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}
});
ff.className = "DraggingInfo";
function wj(a, b, c) {
this.node = a;
this.info = b;
this.gv = c
}
wj.className = "DraggingNodeInfoPair";
function Ye() {
this.reset()
}
Ye.prototype.reset = function () {
this.isGridSnapEnabled = !1;
this.isGridSnapRealtime = !0;
this.gridSnapCellSize = (new M(NaN, NaN)).freeze();
this.gridSnapCellSpot = zc;
this.gridSnapOrigin = (new G(NaN, NaN)).freeze();
this.iz = this.dragsTree = this.dragsLink = !1;
this.hz = !0
};
function pk(a) {
1 < arguments.length && B("Palette constructor can only take one optional argument, the DIV HTML element or its id.");
P.call(this, a);
this.allowDragOut = !0;
this.allowMove = !1;
this.isReadOnly = !0;
this.contentAlignment = Ac;
this.layout = new qk
}
la(pk, P);
pk.className = "Palette";
function rk(a) {
1 < arguments.length && B("Overview constructor can only take one optional argument, the DIV HTML element or its id.");
P.call(this, a);
this.animationManager.isEnabled = !1;
this.ob = !0;
this.ag = null;
this.jr = !0;
this.Gx("drawShadows", !1);
var b = new S, c = new W;
c.stroke = "magenta";
c.strokeWidth = 2;
c.fill = "transparent";
c.name = "BOXSHAPE";
b.selectable = !0;
b.selectionAdorned = !1;
b.selectionObjectName = "BOXSHAPE";
b.locationObjectName = "BOXSHAPE";
b.resizeObjectName = "BOXSHAPE";
b.cursor = "move";
b.add(c);
this.l = b;
this.allowDelete = this.allowCopy = !1;
this.allowSelect = !0;
this.autoScrollRegion = new pc(0, 0, 0, 0);
this.zu = new ik(null);
this.Yx = this.zu.context;
Pe(this.toolManager, "Dragging", new sk, this.toolManager.mouseMoveTools);
var d = this;
this.click = function () {
var a = d.ag;
if (null !== a) {
var b = a.viewportBounds, c = d.lastInput.documentPoint;
a.position = new G(c.x - b.width / 2, c.y - b.height / 2)
}
};
this.Hm = function () {
d.Xa();
tk(d)
};
this.Fm = function () {
null !== d.ag && (d.Xa(), d.R())
};
this.Gm = function () {
d.R()
};
this.Em = function () {
null !== d.ag &&
tk(d)
};
this.autoScale = Hi;
this.ob = !1
}
la(rk, P);
function uk(a) {
a.ob || a.Yb || !1 !== a.qd || (a.qd = !0, x.requestAnimationFrame(function () {
if (a.qd && !a.Yb && (a.qd = !1, null !== a.Ia)) {
a.Yb = !0;
Bi(a);
a.documentBounds.o() || Gi(a, a.computeBounds());
null === a.Ia && B("No div specified");
null === a.Da && B("No canvas specified");
Ph(a.box);
if (a.nc) {
var b = a.ag;
if (null !== b && !b.animationManager.isAnimating && !b.animationManager.rb) {
b = a.Yc;
var c = a.zu;
b.setTransform(1, 0, 0, 1, 0, 0);
b.clearRect(0, 0, a.Da.width, a.Da.height);
b.drawImage(c.Ga, 0, 0);
c = a.tb;
c.reset();
1 !== a.scale && c.scale(a.scale);
0 === a.position.x && 0 === a.position.y || c.translate(-a.position.x, -a.position.y);
b.scale(a.Mb, a.Mb);
b.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy);
c = a.Pa.j;
for (var d = c.length, e = 0; e < d; e++) c[e].hc(b, a);
a.di = !1;
a.nc = !1
}
}
a.Yb = !1
}
}))
}
rk.prototype.computePixelRatio = function () {
return 1
};
rk.prototype.hc = function () {
null === this.Ia && B("No div specified");
null === this.Da && B("No canvas specified");
if (!(this.Da instanceof jj) && (Ph(this.box), this.nc)) {
var a = this.ag;
if (null !== a && !a.animationManager.isAnimating) {
cj(this);
var b = a.grid;
null === b || !b.visible || isNaN(b.width) || isNaN(b.height) || (b = N.alloc().assign(this.viewportBounds).Jc(a.viewportBounds), Wi(a, b), N.free(b), Bi(a));
var c = this.Da;
b = this.Yc;
var d = this.zu, e = this.Yx;
d.width = c.width;
d.height = c.height;
b.Rc(!0);
b.setTransform(1, 0, 0, 1, 0, 0);
b.clearRect(0, 0, c.width, c.height);
d = this.tb;
d.reset();
1 !== this.scale && d.scale(this.scale);
0 === this.position.x && 0 === this.position.y || d.translate(-this.position.x, -this.position.y);
b.scale(this.Mb, this.Mb);
b.transform(d.m11, d.m12, d.m21, d.m22, d.dx, d.dy);
d = this.jr;
var f = this.viewportBounds;
a = a.Pa.j;
for (var g = a.length, h = 0; h < g; h++) {
var k = a[h], l = d;
if (k.visible && 0 !== k.lb && (void 0 === l && (l = !0), l || !k.isTemporary)) {
1 !== k.lb && (b.globalAlpha = k.lb);
l = this.scale;
k = k.Fa.j;
for (var m = k.length, n = 0; n < m; n++) {
var p = k[n],
r = p.actualBounds;
r.Ic(f) && (r.width * l > this.oe || r.height * l > this.oe ? p.hc(b, this) : Rh(b, p))
}
b.globalAlpha = 1
}
}
e.drawImage(c.Ga, 0, 0);
c = this.Pa.j;
e = c.length;
for (d = 0; d < e; d++) c[d].hc(b, this);
this.nc = this.di = !1
}
}
};
function tk(a) {
var b = a.box;
if (null !== b) {
var c = a.ag;
if (null !== c) {
a.nc = !0;
c = c.viewportBounds;
var d = b.selectionObject, e = M.alloc();
e.h(c.width, c.height);
d.desiredSize = e;
M.free(e);
a = 2 / a.scale;
d instanceof W && (d.strokeWidth = a);
b.location = new G(c.x - a / 2, c.y - a / 2);
b.isSelected = !0
}
}
}
rk.prototype.computeBounds = function () {
var a = this.ag;
if (null === a) return nc;
var b = a.documentBounds.copy();
b.Jc(a.viewportBounds);
return b
};
rk.prototype.mx = function () {
!0 !== this.nc && (this.nc = !0, uk(this))
};
rk.prototype.mq = function (a, b, c, d) {
this.ob || (Ai(this), this.R(), Ti(this), this.Xa(), tk(this), this.ye.scale = c, this.ye.position.x = a.x, this.ye.position.y = a.y, this.ye.bounds.assign(a), this.ye.ox = d, this.aa("ViewportBoundsChanged", this.ye, a))
};
ma.Object.defineProperties(rk.prototype, {
observed: {
get: function () {
return this.ag
}, set: function (a) {
var b = this.ag;
a instanceof rk && B("Overview.observed Diagram may not be an Overview itself: " + a);
b !== a && (null !== b && (this.remove(this.box), b.nm("ViewportBoundsChanged", this.Hm), b.nm("DocumentBoundsChanged", this.Fm), b.nm("InvalidateDraw", this.Gm), b.nm("AnimationFinished", this.Em)), this.ag = a, null !== a && (a.Pj("ViewportBoundsChanged", this.Hm), a.Pj("DocumentBoundsChanged", this.Fm),
a.Pj("InvalidateDraw", this.Gm), a.Pj("AnimationFinished", this.Em), this.add(this.box), tk(this)), this.Xa(), this.g("observed", b, a))
}
}, box: {
get: function () {
return this.l
}, set: function (a) {
var b = this.l;
b !== a && (this.l = a, this.remove(b), this.add(this.l), tk(this), this.g("box", b, a))
}
}, drawsTemporaryLayers: {
get: function () {
return this.jr
}, set: function (a) {
this.jr !== a && (this.jr = a, this.uf())
}
}
});
rk.className = "Overview";
function sk() {
Re.call(this);
this.l = null
}
la(sk, Re);
sk.prototype.canStart = function () {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (null === a || !a.allowMove || !a.allowSelect) return !1;
var b = a.observed;
if (null === b) return !1;
var c = a.lastInput;
if (!c.left || a.currentTool !== this && (!this.isBeyondDragSize() || c.isTouchEvent && c.timestamp - a.firstInput.timestamp < this.delay)) return !1;
null === this.findDraggablePart() && (c = b.viewportBounds, this.l = new G(c.width / 2, c.height / 2), a = a.firstInput.documentPoint, b.position = new G(a.x - this.l.x, a.y - this.l.y));
return !0
};
sk.prototype.doActivate = function () {
this.l = null;
Re.prototype.doActivate.call(this)
};
sk.prototype.moveParts = function () {
var a = this.diagram, b = a.observed;
if (null !== b) {
var c = a.box;
if (null !== c) {
if (null === this.l) {
var d = a.firstInput.documentPoint;
c = c.location;
this.l = new G(d.x - c.x, d.y - c.y)
}
a = a.lastInput.documentPoint;
b.position = new G(a.x - this.l.x, a.y - this.l.y)
}
}
};
sk.className = "OverviewDraggingTool";
function vk() {
ab(this);
this.C = Fe;
this.Ub = this.K = this.u = !0;
this.ba = this.La = this.Vb = this.Ma = !1;
this.li = this.l = null;
this.Vc = 1.05;
this.fu = NaN;
this.zw = null;
this.Fu = NaN;
this.Eu = nc;
this.gg = null;
this.Kc = 200
}
vk.prototype.toString = function () {
return "CommandHandler"
};
vk.prototype.hb = function (a) {
this.C = a
};
vk.prototype.doKeyDown = function () {
var a = this.diagram, b = a.lastInput, c = Wa ? b.meta : b.control, d = b.shift, e = b.alt, f = b.key;
!c || "C" !== f && "Insert" !== f ? c && "X" === f || d && "Del" === f ? this.canCutSelection() && this.cutSelection() : c && "V" === f || d && "Insert" === f ? this.canPasteSelection() && this.pasteSelection() : c && "Y" === f || e && d && "Backspace" === f ? this.canRedo() && this.redo() : c && "Z" === f || e && "Backspace" === f ? this.canUndo() && this.undo() : "Del" === f || "Backspace" === f ? this.canDeleteSelection() && this.deleteSelection() : c && "A" === f ? this.canSelectAll() &&
this.selectAll() : "Esc" === f ? this.canStopCommand() && this.stopCommand() : "Up" === f ? a.allowVerticalScroll && (c ? a.scroll("pixel", "up") : a.scroll("line", "up")) : "Down" === f ? a.allowVerticalScroll && (c ? a.scroll("pixel", "down") : a.scroll("line", "down")) : "Left" === f ? a.allowHorizontalScroll && (c ? a.scroll("pixel", "left") : a.scroll("line", "left")) : "Right" === f ? a.allowHorizontalScroll && (c ? a.scroll("pixel", "right") : a.scroll("line", "right")) : "PageUp" === f ? d && a.allowHorizontalScroll ? a.scroll("page", "left") : a.allowVerticalScroll &&
a.scroll("page", "up") : "PageDown" === f ? d && a.allowHorizontalScroll ? a.scroll("page", "right") : a.allowVerticalScroll && a.scroll("page", "down") : "Home" === f ? c && a.allowVerticalScroll ? a.scroll("document", "up") : !c && a.allowHorizontalScroll && a.scroll("document", "left") : "End" === f ? c && a.allowVerticalScroll ? a.scroll("document", "down") : !c && a.allowHorizontalScroll && a.scroll("document", "right") : " " === f ? this.canScrollToPart() && this.scrollToPart() : "Subtract" === f ? this.canDecreaseZoom() && this.decreaseZoom() : "Add" === f ? this.canIncreaseZoom() &&
this.increaseZoom() : c && "0" === f ? this.canResetZoom() && this.resetZoom() : d && "Z" === f ? this.canZoomToFit() && this.zoomToFit() : c && !d && "G" === f ? this.canGroupSelection() && this.groupSelection() : c && d && "G" === f ? this.canUngroupSelection() && this.ungroupSelection() : b.event && 113 === b.event.which ? this.canEditTextBlock() && this.editTextBlock() : b.event && 93 === b.event.which ? this.canShowContextMenu() && this.showContextMenu() : b.bubbles = !0 : this.canCopySelection() && this.copySelection()
};
vk.prototype.doKeyUp = function () {
this.diagram.lastInput.bubbles = !0
};
vk.prototype.stopCommand = function () {
var a = this.diagram, b = a.currentTool;
b instanceof Na && a.allowSelect && a.Rp();
null !== b && b.doCancel()
};
vk.prototype.canStopCommand = function () {
return !0
};
vk.prototype.selectAll = function () {
var a = this.diagram;
a.R();
try {
a.currentCursor = "wait";
a.aa("ChangingSelection", a.selection);
for (var b = a.parts; b.next();) b.value.isSelected = !0;
for (var c = a.nodes; c.next();) c.value.isSelected = !0;
for (var d = a.links; d.next();) d.value.isSelected = !0
} finally {
a.aa("ChangedSelection", a.selection), a.currentCursor = ""
}
};
vk.prototype.canSelectAll = function () {
return this.diagram.allowSelect
};
vk.prototype.deleteSelection = function () {
var a = this.diagram;
try {
a.currentCursor = "wait";
a.Aa("Delete");
a.aa("ChangingSelection", a.selection);
a.aa("SelectionDeleting", a.selection);
for (var b = new F, c = a.selection.iterator; c.next();) wk(b, c.value, !0, this.deletesTree ? Infinity : 0, this.deletesConnectedLinks ? null : !1, function (a) {
return a.canDelete()
});
a.rt(b, !0);
a.aa("SelectionDeleted", b)
} finally {
a.aa("ChangedSelection", a.selection), a.Za("Delete"), a.currentCursor = ""
}
};
vk.prototype.canDeleteSelection = function () {
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly || !a.allowDelete || 0 === a.selection.count ? !1 : !0
};
vk.prototype.copySelection = function () {
var a = this.diagram, b = new F;
for (a = a.selection.iterator; a.next();) wk(b, a.value, !0, this.copiesTree ? Infinity : 0, this.copiesConnectedLinks, function (a) {
return a.canCopy()
});
this.copyToClipboard(b)
};
vk.prototype.canCopySelection = function () {
var a = this.diagram;
return a.allowCopy && a.allowClipboard && 0 !== a.selection.count ? !0 : !1
};
vk.prototype.cutSelection = function () {
this.copySelection();
this.deleteSelection()
};
vk.prototype.canCutSelection = function () {
var a = this.diagram;
return !a.isReadOnly && !a.isModelReadOnly && a.allowCopy && a.allowDelete && a.allowClipboard && 0 !== a.selection.count ? !0 : !1
};
vk.prototype.copyToClipboard = function (a) {
var b = this.diagram, c = null;
if (null === a) ji = null, ki = ""; else {
c = b.model;
var d = !1, e = !1, f = null;
try {
c.gm() && (d = c.Yj, c.Yj = this.copiesParentKey), c.ek() && (e = c.Xj, c.Xj = this.copiesGroupKey), f = b.Zj(a, null, !0)
} finally {
c.gm() && (c.Yj = d), c.ek() && (c.Xj = e), c = new E, c.addAll(f), ji = c, ki = b.model.dataFormat
}
}
b.aa("ClipboardChanged", c)
};
vk.prototype.pasteFromClipboard = function () {
var a = new F, b = ji;
if (null === b) return a;
var c = this.diagram;
if (ki !== c.model.dataFormat) return a;
var d = c.model, e = !1, f = !1, g = null;
try {
d.gm() && (e = d.Yj, d.Yj = this.copiesParentKey), d.ek() && (f = d.Xj, d.Xj = this.copiesGroupKey), g = c.Zj(b, c, !1)
} finally {
for (d.gm() && (d.Yj = e), d.ek() && (d.Xj = f), b = g.iterator; b.next();) c = b.value, d = b.key, c.location.o() || (d.location.o() ? c.location = d.location : !c.position.o() && d.position.o() && (c.position = d.position)), a.add(c)
}
return a
};
vk.prototype.pasteSelection = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.currentCursor = "wait";
b.Aa("Paste");
b.aa("ChangingSelection", b.selection);
var c = this.pasteFromClipboard();
0 < c.count && Ze(b);
for (var d = c.iterator; d.next();) d.value.isSelected = !0;
b.aa("ChangedSelection", b.selection);
if (null !== a) {
var e = b.computePartsBounds(b.selection);
if (e.o()) {
var f = this.computeEffectiveCollection(b.selection, b.Nk);
zf(b, f, new G(a.x - e.centerX, a.y - e.centerY), b.Nk, !1)
}
}
b.aa("ClipboardPasted", c)
} finally {
b.Za("Paste"),
b.currentCursor = ""
}
};
vk.prototype.canPasteSelection = function () {
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly || !a.allowInsert || !a.allowClipboard || null === ji || 0 === ji.count || ki !== a.model.dataFormat ? !1 : !0
};
vk.prototype.undo = function () {
this.diagram.undoManager.undo()
};
vk.prototype.canUndo = function () {
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly ? !1 : a.allowUndo && a.undoManager.canUndo()
};
vk.prototype.redo = function () {
this.diagram.undoManager.redo()
};
vk.prototype.canRedo = function () {
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly ? !1 : a.allowUndo && a.undoManager.canRedo()
};
vk.prototype.decreaseZoom = function (a) {
void 0 === a && (a = 1 / this.zoomFactor);
var b = this.diagram;
b.autoScale === Yh && (a = b.scale * a, a < b.minScale || a > b.maxScale || (b.scale = a))
};
vk.prototype.canDecreaseZoom = function (a) {
void 0 === a && (a = 1 / this.zoomFactor);
var b = this.diagram;
if (b.autoScale !== Yh) return !1;
a = b.scale * a;
return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom
};
vk.prototype.increaseZoom = function (a) {
void 0 === a && (a = this.zoomFactor);
var b = this.diagram;
b.autoScale === Yh && (a = b.scale * a, a < b.minScale || a > b.maxScale || (b.scale = a))
};
vk.prototype.canIncreaseZoom = function (a) {
void 0 === a && (a = this.zoomFactor);
var b = this.diagram;
if (b.autoScale !== Yh) return !1;
a = b.scale * a;
return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom
};
vk.prototype.resetZoom = function (a) {
void 0 === a && (a = this.defaultScale);
var b = this.diagram;
a < b.minScale || a > b.maxScale || (b.scale = a)
};
vk.prototype.canResetZoom = function (a) {
void 0 === a && (a = this.defaultScale);
var b = this.diagram;
return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom
};
vk.prototype.zoomToFit = function () {
var a = this.diagram, b = a.scale, c = a.position;
b === this.Fu && !isNaN(this.fu) && a.documentBounds.A(this.Eu) ? (a.scale = this.fu, a.position = this.zw, this.Fu = NaN, this.Eu = nc) : (this.fu = b, this.zw = c.copy(), a.zoomToFit(), this.Fu = a.scale, this.Eu = a.documentBounds.copy())
};
vk.prototype.canZoomToFit = function () {
return this.diagram.allowZoom
};
vk.prototype.scrollToPart = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (null === a) {
try {
null !== this.gg && (this.gg.next() ? a = this.gg.value : this.gg = null)
} catch (k) {
this.gg = null
}
null === a && (0 < b.highlighteds.count ? this.gg = b.highlighteds.iterator : 0 < b.selection.count && (this.gg = b.selection.iterator), null !== this.gg && this.gg.next() && (a = this.gg.value))
}
if (null !== a) {
var c = b.animationManager;
c.Ui("Scroll To Part");
var d = this.scrollToPartPause;
if (0 < d) {
var e = xk(this, a, [a]), f = function () {
b.Aa();
for (var a = e.pop(); 0 <
e.length && a instanceof V && a.isTreeExpanded && (!(a instanceof U) || a.isSubGraphExpanded);) a = e.pop();
0 < e.length ? (a instanceof S && b.Hv(a.actualBounds), a instanceof V && !a.isTreeExpanded && (a.isTreeExpanded = !0), a instanceof U && !a.isSubGraphExpanded && (a.isSubGraphExpanded = !0)) : (a instanceof S && b.Ku(a.actualBounds), b.nm("LayoutCompleted", g));
b.Za("Scroll To Part")
}, g = function () {
sa(f, (c.isEnabled ? c.duration : 0) + d)
};
b.Pj("LayoutCompleted", g);
f()
} else {
var h = b.position.copy();
b.Ku(a.actualBounds);
h.Qa(b.position) &&
c.vd()
}
}
};
function xk(a, b, c) {
if (b.isVisible()) return c;
if (b instanceof Je) xk(a, b.adornedPart, c); else if (b instanceof R) {
var d = b.fromNode;
null !== d && xk(a, d, c);
b = b.toNode;
null !== b && xk(a, b, c)
} else b instanceof V && (d = b.labeledLink, null !== d && xk(a, d, c), d = b.sg(), null !== d && (d.isTreeExpanded || d.wasTreeExpanded || c.push(d), xk(a, d, c))), b = b.containingGroup, null !== b && (b.isSubGraphExpanded || b.wasSubGraphExpanded || c.push(b), xk(a, b, c));
return c
}
vk.prototype.canScrollToPart = function (a) {
void 0 === a && (a = null);
if (null !== a && !(a instanceof S)) return !1;
a = this.diagram;
return 0 === a.selection.count && 0 === a.highlighteds.count ? !1 : a.allowHorizontalScroll && a.allowVerticalScroll
};
vk.prototype.collapseTree = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Aa("Collapse Tree");
b.animationManager.Ui("Collapse Tree");
var c = new E;
if (null !== a && a.isTreeExpanded) a.collapseTree(), c.add(a); else if (null === a) for (var d = b.selection.iterator; d.next();) {
var e = d.value;
e instanceof V && e.isTreeExpanded && (e.collapseTree(), c.add(e))
}
b.aa("TreeCollapsed", c)
} finally {
b.Za("Collapse Tree")
}
};
vk.prototype.canCollapseTree = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly) return !1;
if (null !== a) {
if (!(a instanceof V && a.isTreeExpanded)) return !1;
if (0 < a.Yp().count) return !0
} else for (a = b.selection.iterator; a.next();) if (b = a.value, b instanceof V && b.isTreeExpanded && 0 < b.Yp().count) return !0;
return !1
};
vk.prototype.expandTree = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Aa("Expand Tree");
b.animationManager.Ui("Expand Tree");
var c = new E;
if (null !== a && !a.isTreeExpanded) a.expandTree(), c.add(a); else if (null === a) for (var d = b.selection.iterator; d.next();) {
var e = d.value;
e instanceof V && !e.isTreeExpanded && (e.expandTree(), c.add(e))
}
b.aa("TreeExpanded", c)
} finally {
b.Za("Expand Tree")
}
};
vk.prototype.canExpandTree = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly) return !1;
if (null !== a) {
if (!(a instanceof V) || a.isTreeExpanded) return !1;
if (0 < a.Yp().count) return !0
} else for (a = b.selection.iterator; a.next();) if (b = a.value, b instanceof V && !b.isTreeExpanded && 0 < b.Yp().count) return !0;
return !1
};
vk.prototype.groupSelection = function () {
var a = this.diagram, b = a.model;
if (b.fk()) {
var c = this.archetypeGroupData;
if (null !== c) {
var d = null;
try {
a.currentCursor = "wait";
a.Aa("Group");
a.aa("ChangingSelection", a.selection);
for (var e = new E, f = a.selection.iterator; f.next();) {
var g = f.value;
g.bc() && g.canGroup() && e.add(g)
}
for (var h = new E, k = e.iterator; k.next();) {
var l = k.value;
f = !1;
for (var m = e.iterator; m.next();) if (l.Vd(m.value)) {
f = !0;
break
}
f || h.add(l)
}
if (0 < h.count) {
var n = h.first().containingGroup;
if (null !== n) for (; null !==
n;) {
e = !1;
for (var p = h.iterator; p.next();) if (!p.value.Vd(n)) {
e = !0;
break
}
if (e) n = n.containingGroup; else break
}
if (c instanceof U) Ag(c), d = c.copy(), null !== d && a.add(d); else if (b.mv(c)) {
var r = b.copyNodeData(c);
ya(r) && (b.kf(r), d = a.Hi(r))
}
if (null !== d) {
null !== n && this.isValidMember(n, d) && (d.containingGroup = n);
for (var q = h.iterator; q.next();) {
var u = q.value;
this.isValidMember(d, u) && (u.containingGroup = d)
}
a.select(d)
}
}
a.aa("ChangedSelection", a.selection);
a.aa("SelectionGrouped", d)
} finally {
a.Za("Group"), a.currentCursor =
""
}
}
}
};
vk.prototype.canGroupSelection = function () {
var a = this.diagram;
if (a.isReadOnly || a.isModelReadOnly || !a.allowInsert || !a.allowGroup || !a.model.fk() || null === this.archetypeGroupData) return !1;
for (a = a.selection.iterator; a.next();) {
var b = a.value;
if (b.bc() && b.canGroup()) return !0
}
return !1
};
function yk(a) {
var b = Da();
for (a = a.iterator; a.next();) {
var c = a.value;
c instanceof R || b.push(c)
}
a = new F;
c = b.length;
for (var d = 0; d < c; d++) {
for (var e = b[d], f = !0, g = 0; g < c; g++) if (e.Vd(b[g])) {
f = !1;
break
}
f && a.add(e)
}
Ga(b);
return a
}
vk.prototype.isValidMember = function (a, b) {
if (null === b || a === b || b instanceof R) return !1;
if (null !== a) {
if (a === b || a.Vd(b)) return !1;
var c = a.memberValidation;
if (null !== c && !c(a, b) || null === a.data && null !== b.data || null !== a.data && null === b.data) return !1
}
c = this.memberValidation;
return null !== c ? c(a, b) : !0
};
vk.prototype.ungroupSelection = function (a) {
void 0 === a && (a = null);
var b = this.diagram, c = b.model;
if (c.fk()) try {
b.currentCursor = "wait";
b.Aa("Ungroup");
b.aa("ChangingSelection", b.selection);
var d = new E;
if (null !== a) d.add(a); else for (var e = b.selection.iterator; e.next();) {
var f = e.value;
f instanceof U && f.canUngroup() && d.add(f)
}
var g = new E;
if (0 < d.count) {
b.Rp();
for (var h = d.iterator; h.next();) {
var k = h.value;
k.expandSubGraph();
var l = k.containingGroup, m = null !== l && null !== l.data ? c.pa(l.data) : void 0;
g.addAll(k.memberParts);
for (var n = g.iterator; n.next();) {
var p = n.value;
p.isSelected = !0;
if (!(p instanceof R)) {
var r = p.data;
null !== r ? c.ut(r, m) : p.containingGroup = l
}
}
b.remove(k)
}
}
b.aa("ChangedSelection", b.selection);
b.aa("SelectionUngrouped", d, g)
} finally {
b.Za("Ungroup"), b.currentCursor = ""
}
};
vk.prototype.canUngroupSelection = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly || b.isModelReadOnly || !b.allowDelete || !b.allowUngroup || !b.model.fk()) return !1;
if (null !== a) {
if (!(a instanceof U)) return !1;
if (a.canUngroup()) return !0
} else for (a = b.selection.iterator; a.next();) if (b = a.value, b instanceof U && b.canUngroup()) return !0;
return !1
};
vk.prototype.addTopLevelParts = function (a, b) {
var c = !0;
for (a = yk(a).iterator; a.next();) {
var d = a.value;
null !== d.containingGroup && (!b || this.isValidMember(null, d) ? d.containingGroup = null : c = !1)
}
return c
};
vk.prototype.collapseSubGraph = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Aa("Collapse SubGraph");
b.animationManager.Ui("Collapse SubGraph");
var c = new E;
if (null !== a && a.isSubGraphExpanded) a.collapseSubGraph(), c.add(a); else if (null === a) for (var d = b.selection.iterator; d.next();) {
var e = d.value;
e instanceof U && e.isSubGraphExpanded && (e.collapseSubGraph(), c.add(e))
}
b.aa("SubGraphCollapsed", c)
} finally {
b.Za("Collapse SubGraph")
}
};
vk.prototype.canCollapseSubGraph = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly) return !1;
if (null !== a) return a instanceof U && a.isSubGraphExpanded ? !0 : !1;
for (a = b.selection.iterator; a.next();) if (b = a.value, b instanceof U && b.isSubGraphExpanded) return !0;
return !1
};
vk.prototype.expandSubGraph = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Aa("Expand SubGraph");
b.animationManager.Ui("Expand SubGraph");
var c = new E;
if (null !== a && !a.isSubGraphExpanded) a.expandSubGraph(), c.add(a); else if (null === a) for (var d = b.selection.iterator; d.next();) {
var e = d.value;
e instanceof U && !e.isSubGraphExpanded && (e.expandSubGraph(), c.add(e))
}
b.aa("SubGraphExpanded", c)
} finally {
b.Za("Expand SubGraph")
}
};
vk.prototype.canExpandSubGraph = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly) return !1;
if (null !== a) return a instanceof U && !a.isSubGraphExpanded ? !0 : !1;
for (a = b.selection.iterator; a.next();) if (b = a.value, b instanceof U && !b.isSubGraphExpanded) return !0;
return !1
};
vk.prototype.editTextBlock = function (a) {
void 0 === a && (a = null);
var b = this.diagram, c = b.toolManager.findTool("TextEditing");
if (null !== c) {
if (null === a) {
a = null;
for (var d = b.selection.iterator; d.next();) {
var e = d.value;
if (e.canEdit()) {
a = e;
break
}
}
if (null === a) return;
a = a.Zl(function (a) {
return a instanceof Yg && a.editable
})
}
null !== a && (b.currentTool = null, c.textBlock = a, b.currentTool = c)
}
};
vk.prototype.canEditTextBlock = function (a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly || b.isModelReadOnly || !b.allowTextEdit || null === b.toolManager.findTool("TextEditing")) return !1;
if (null !== a) {
if (!(a instanceof Yg)) return !1;
a = a.part;
if (null !== a && a.canEdit()) return !0
} else for (b = b.selection.iterator; b.next();) if (a = b.value, a.canEdit() && (a = a.Zl(function (a) {
return a instanceof Yg && a.editable
}), null !== a)) return !0;
return !1
};
vk.prototype.showContextMenu = function (a) {
var b = this.diagram, c = b.toolManager.findTool("ContextMenu");
if (null !== c && (void 0 === a && (a = 0 < b.selection.count ? b.selection.first() : b), a = c.findObjectWithContextMenu(a), null !== a)) {
var d = b.lastInput, e = null;
a instanceof Y ? e = a.ma(Fc) : b.isMouseOverDiagram || (e = b.viewportBounds, e = new G(e.x + e.width / 2, e.y + e.height / 2));
null !== e && (d.viewPoint = b.xt(e), d.documentPoint = e, d.left = !1, d.right = !0, d.up = !0);
b.currentTool = c;
Ug(c, !1, a)
}
};
vk.prototype.canShowContextMenu = function (a) {
var b = this.diagram, c = b.toolManager.findTool("ContextMenu");
if (null === c) return !1;
void 0 === a && (a = 0 < b.selection.count ? b.selection.first() : b);
return null === c.findObjectWithContextMenu(a) ? !1 : !0
};
vk.prototype.computeEffectiveCollection = function (a, b) {
var c = this.diagram, d = c.toolManager.findTool("Dragging"), e = c.currentTool === d;
void 0 === b && (b = e ? d.dragOptions : c.Nk);
d = new vb;
if (null === a) return d;
for (var f = a.iterator; f.next();) uj(c, d, f.value, e, b);
if (null !== c.draggedLink && b.dragsLink) return d;
for (f = a.iterator; f.next();) a = f.value, a instanceof R && (b = a.fromNode, null === b || d.contains(b) ? (b = a.toNode, null === b || d.contains(b) || d.remove(a)) : d.remove(a));
return d
};
ma.Object.defineProperties(vk.prototype, {
diagram: {
get: function () {
return this.C
}
}, copiesClipboardData: {
get: function () {
return this.u
}, set: function (a) {
this.u = a
}
}, copiesConnectedLinks: {
get: function () {
return this.K
}, set: function (a) {
this.K = a
}
}, deletesConnectedLinks: {
get: function () {
return this.Ub
}, set: function (a) {
this.Ub = a
}
}, copiesTree: {
get: function () {
return this.Ma
},
set: function (a) {
this.Ma = a
}
}, deletesTree: {
get: function () {
return this.Vb
}, set: function (a) {
this.Vb = a
}
}, copiesParentKey: {
get: function () {
return this.La
}, set: function (a) {
this.La = a
}
}, copiesGroupKey: {
get: function () {
return this.ba
}, set: function (a) {
this.ba = a
}
}, archetypeGroupData: {
get: function () {
return this.l
}, set: function (a) {
this.l = a
}
}, memberValidation: {
get: function () {
return this.li
},
set: function (a) {
this.li = a
}
}, defaultScale: {
get: function () {
return this.diagram.defaultScale
}, set: function (a) {
this.diagram.defaultScale = a
}
}, zoomFactor: {
get: function () {
return this.Vc
}, set: function (a) {
1 < a || B("zoomFactor must be larger than 1.0, not: " + a);
this.Vc = a
}
}, scrollToPartPause: {
get: function () {
return this.Kc
}, set: function (a) {
this.Kc = a
}
}
});
vk.className = "CommandHandler";
ei = function () {
return new vk
};
function Y() {
ab(this);
this.H = 4225027;
this.lb = 1;
this.dg = null;
this.Ua = "";
this.dc = this.ib = null;
this.sa = (new G(NaN, NaN)).freeze();
this.Nc = Rb;
this.Tf = Kb;
this.Sf = Qb;
this.tb = new wc;
this.Fh = new wc;
this.Rf = new wc;
this.Ca = this.Uk = 1;
this.zc = 0;
this.we = zk;
this.Wg = uc;
this.pc = (new N(NaN, NaN, NaN, NaN)).freeze();
this.vb = (new N(NaN, NaN, NaN, NaN)).freeze();
this.qc = (new N(0, 0, NaN, NaN)).freeze();
this.P = this.Ro = this.So = null;
this.zk = this.wb = ad;
this.ep = 0;
this.fp = 1;
this.Gg = 0;
this.Zm = 1;
this.vp = null;
this.jp = -Infinity;
this.zl =
0;
this.Al = Fb;
this.Bl = qg;
this.jn = "";
this.bb = this.O = null;
this.Fk = -1;
this.Dl = this.kd = this.Uh = this.Gl = null;
this.ls = Bg;
this.Cj = null
}
var wd, Bg, Dg, zk, Ak, Bk, Ck, Dk, Ek, Fk;
Y.prototype.cloneProtected = function (a) {
a.H = this.H | 6144;
a.lb = this.lb;
a.Ua = this.Ua;
a.ib = this.ib;
a.dc = this.dc;
a.sa.assign(this.sa);
a.Nc = this.Nc.I();
a.Tf = this.Tf.I();
a.Sf = this.Sf.I();
a.Rf = this.Rf.copy();
a.Ca = this.Ca;
a.zc = this.zc;
a.we = this.we;
a.Wg = this.Wg.I();
a.pc.assign(this.pc);
a.vb.assign(this.vb);
a.qc.assign(this.qc);
a.Ro = this.Ro;
null !== this.P && (a.P = this.P.copy());
a.wb = this.wb.I();
a.zk = this.zk.I();
a.ep = this.ep;
a.fp = this.fp;
a.Gg = this.Gg;
a.Zm = this.Zm;
a.vp = this.vp;
a.jp = this.jp;
a.zl = this.zl;
a.Al = this.Al.I();
a.Bl = this.Bl;
a.jn = this.jn;
null !== this.O && (a.O = this.O.copy());
a.bb = this.bb;
a.Fk = this.Fk;
null !== this.Uh && (a.Uh = Aa(this.Uh));
null !== this.kd && (a.kd = this.kd.copy());
a.Dl = this.Dl
};
Y.prototype.Pw = function (a) {
var b = this.Uh;
if (za(b)) for (var c = 0; c < b.length; c++) {
if (b[c] === a) return
} else this.Uh = b = [];
b.push(a)
};
Y.prototype.pf = function (a) {
a.So = null;
a.Cj = null;
a.s()
};
Y.prototype.clone = function () {
var a = new this.constructor;
this.cloneProtected(a);
if (null !== this.Uh) for (var b = 0; b < this.Uh.length; b++) {
var c = this.Uh[b];
a[c] = this[c]
}
return a
};
Y.prototype.copy = function () {
return this.clone()
};
t = Y.prototype;
t.fb = function (a) {
a.classType === R ? 0 === a.name.indexOf("Orient") ? this.segmentOrientation = a : B("Unknown Link enum value for GraphObject.segmentOrientation property: " + a) : a.classType === Y && (this.stretch = a)
};
t.toString = function () {
return Ha(this.constructor) + "#" + lb(this)
};
function Gk(a) {
null === a.O && (a.O = new Hk)
}
t.Hc = function () {
if (null === this.P) {
var a = new Ik;
a.Pg = yc;
a.oh = yc;
a.Ng = 10;
a.mh = 10;
a.Og = 0;
a.nh = 0;
this.P = a
}
};
t.ab = function (a, b, c, d, e, f, g) {
var h = this.part;
if (null !== h && (h.qk(a, b, c, d, e, f, g), c === this && a === re && Jk(this) && Kk(this, h, b), this instanceof X && c === h && 0 !== (h.H & 16777216) && null !== h.data)) for (a = this.Y.j, c = a.length, d = 0; d < c; d++) e = a[d], e instanceof X && mj(e, function (a) {
null !== a.data && 0 !== (a.H & 16777216) && a.Ea(b)
})
};
function Kk(a, b, c) {
var d = a.Ji();
if (null !== d) for (var e = a.bb.iterator; e.next();) {
var f = e.value, g = null;
if (null !== f.sourceName) {
g = Lk(f, d, a);
if (null === g) continue;
f.yq(a, g, c, null)
} else if (f.isToModel) {
var h = b.diagram;
null === h || h.skipsModelSourceBindings || f.yq(a, h.model.modelData, c, d)
} else {
h = d.data;
if (null === h) continue;
var k = b.diagram;
null === k || k.skipsModelSourceBindings || f.yq(a, h, c, d)
}
g === a && (h = d.Qs(f.Zi), null !== h && f.Zv(h, g, c))
}
}
t.Qs = function (a) {
return this.Fk === a ? this : null
};
t.g = function (a, b, c) {
this.ab(re, a, this, b, c)
};
function Mk(a, b, c, d, e) {
var f = a.pc, g = a.Rf;
g.reset();
Nk(a, g, b, c, d, e);
a.Rf = g;
f.h(b, c, d, e);
g.ct() || g.Wv(f)
}
function Ok(a, b, c, d) {
if (!1 === a.pickable) return !1;
d.multiply(a.transform);
return c ? a.Ic(b, d) : a.wh(b, d)
}
t.hx = function (a, b, c) {
if (!1 === this.pickable) return !1;
var d = this.naturalBounds;
b = a.Ce(b);
return c ? Ab(a.x, a.y, 0, 0, 0, d.height) <= b || Ab(a.x, a.y, 0, d.height, d.width, d.height) <= b || Ab(a.x, a.y, d.width, d.height, d.width, 0) <= b || Ab(a.x, a.y, d.width, 0, 0, 0) <= b : a.cd(0, 0) <= b && a.cd(0, d.height) <= b && a.cd(d.width, 0) <= b && a.cd(d.width, d.height) <= b
};
t.Zd = function () {
return !0
};
t.da = function (a) {
var b = G.alloc();
b.assign(a);
this.transform.ta(b);
var c = this.actualBounds;
if (!c.o()) return G.free(b), !1;
var d = this.diagram;
if (null !== d && d.Se) {
var e = d.cm("extraTouchThreshold"), f = d.cm("extraTouchArea"), g = f / 2, h = this.naturalBounds;
d = this.De() * d.scale;
var k = 1 / d;
if (h.width * d < e && h.height * d < e) return a = fc(c.x - g * k, c.y - g * k, c.width + f * k, c.height + f * k, b.x, b.y), G.free(b), a
}
e = !1;
if (this instanceof Je || this instanceof W ? fc(c.x - 5, c.y - 5, c.width + 10, c.height + 10, b.x, b.y) : c.da(b)) this.kd && !this.kd.da(b) ?
e = !1 : null !== this.dc && c.da(b) ? e = !0 : null !== this.ib && this.qc.da(a) ? e = !0 : e = this.xh(a);
G.free(b);
return e
};
t.xh = function (a) {
var b = this.naturalBounds;
return fc(0, 0, b.width, b.height, a.x, a.y)
};
t.nf = function (a) {
if (0 === this.angle) return this.actualBounds.nf(a);
var b = this.naturalBounds;
b = N.allocAt(0, 0, b.width, b.height);
var c = this.transform, d = !1, e = G.allocAt(a.x, a.y);
b.da(c.Ud(e)) && (e.h(a.x, a.bottom), b.da(c.Ud(e)) && (e.h(a.right, a.bottom), b.da(c.Ud(e)) && (e.h(a.right, a.y), b.da(c.Ud(e)) && (d = !0))));
G.free(e);
N.free(b);
return d
};
t.wh = function (a, b) {
if (void 0 === b) return a.nf(this.actualBounds);
var c = this.naturalBounds, d = !1, e = G.allocAt(0, 0);
a.da(b.ta(e)) && (e.h(0, c.height), a.da(b.ta(e)) && (e.h(c.width, c.height), a.da(b.ta(e)) && (e.h(c.width, 0), a.da(b.ta(e)) && (d = !0))));
G.free(e);
return d
};
t.Ic = function (a, b) {
if (void 0 === b && (b = this.transform, 0 === this.angle)) return a.Ic(this.actualBounds);
var c = this.naturalBounds, d = G.allocAt(0, 0), e = G.allocAt(0, c.height), f = G.allocAt(c.width, c.height),
g = G.allocAt(c.width, 0), h = !1;
if (a.da(b.ta(d)) || a.da(b.ta(e)) || a.da(b.ta(f)) || a.da(b.ta(g))) h = !0; else {
c = N.allocAt(0, 0, c.width, c.height);
var k = G.allocAt(a.x, a.y);
c.da(b.Ud(k)) ? h = !0 : (k.h(a.x, a.bottom), c.da(b.Ud(k)) ? h = !0 : (k.h(a.right, a.bottom), c.da(b.Ud(k)) ? h = !0 : (k.h(a.right, a.y), c.da(b.Ud(k)) && (h = !0))));
G.free(k);
N.free(c);
!h && (H.$s(a, d, e) || H.$s(a, e, f) || H.$s(a, f, g) || H.$s(a, g, d)) && (h = !0)
}
G.free(d);
G.free(e);
G.free(f);
G.free(g);
return h
};
t.ma = function (a, b) {
void 0 === b && (b = new G);
if (a instanceof O) {
var c = this.naturalBounds;
b.h(a.x * c.width + a.offsetX, a.y * c.height + a.offsetY)
} else b.set(a);
this.rd.ta(b);
return b
};
t.Zp = function (a) {
void 0 === a && (a = new N);
var b = this.naturalBounds, c = this.rd, d = G.allocAt(0, 0).transform(c);
a.h(d.x, d.y, 0, 0);
d.h(b.width, 0).transform(c);
ec(a, d.x, d.y, 0, 0);
d.h(b.width, b.height).transform(c);
ec(a, d.x, d.y, 0, 0);
d.h(0, b.height).transform(c);
ec(a, d.x, d.y, 0, 0);
G.free(d);
return a
};
t.Mi = function () {
var a = this.rd;
1 === a.m11 && 0 === a.m12 ? a = 0 : (a = 180 * Math.atan2(a.m12, a.m11) / Math.PI, 0 > a && (a += 360));
return a
};
t.De = function () {
if (0 !== (this.H & 4096) === !1) return this.Uk;
var a = this.Ca;
return null !== this.panel ? a * this.panel.De() : a
};
t.Ws = function (a, b) {
void 0 === b && (b = new G);
b.assign(a);
this.rd.Ud(b);
return b
};
t.Tc = function (a, b, c) {
return this.dk(a.x, a.y, b.x, b.y, c)
};
t.dk = function (a, b, c, d, e) {
var f = this.transform, g = 1 / (f.m11 * f.m22 - f.m12 * f.m21), h = f.m22 * g, k = -f.m12 * g, l = -f.m21 * g,
m = f.m11 * g, n = g * (f.m21 * f.dy - f.m22 * f.dx), p = g * (f.m12 * f.dx - f.m11 * f.dy);
if (null !== this.areaBackground) return f = this.actualBounds, H.Tc(f.left, f.top, f.right, f.bottom, a, b, c, d, e);
g = a * h + b * l + n;
a = a * k + b * m + p;
b = c * h + d * l + n;
c = c * k + d * m + p;
e.h(0, 0);
d = this.naturalBounds;
c = H.Tc(0, 0, d.width, d.height, g, a, b, c, e);
e.transform(f);
return c
};
Y.prototype.measure = function (a, b, c, d) {
if (!1 !== $i(this)) {
var e = this.Wg, f = e.right + e.left;
e = e.top + e.bottom;
a = Math.max(a - f, 0);
b = Math.max(b - e, 0);
c = Math.max((c || 0) - f, 0);
d = Math.max((d || 0) - e, 0);
f = this.angle;
e = this.desiredSize;
var g = 0;
this instanceof W && (g = this.strokeWidth);
90 === f || 270 === f ? (a = isFinite(e.height) ? e.height + g : a, b = isFinite(e.width) ? e.width + g : b) : (a = isFinite(e.width) ? e.width + g : a, b = isFinite(e.height) ? e.height + g : b);
e = c || 0;
g = d || 0;
var h = this instanceof X;
switch (Pk(this, !0)) {
case Bg:
g = e = 0;
h && (b = a = Infinity);
break;
case wd:
isFinite(a) && a > c && (e = a);
isFinite(b) && b > d && (g = b);
break;
case Ak:
isFinite(a) && a > c && (e = a);
g = 0;
h && (b = Infinity);
break;
case Bk:
isFinite(b) && b > d && (g = b), e = 0, h && (a = Infinity)
}
h = this.maxSize;
var k = this.minSize;
e > h.width && k.width < h.width && (e = h.width);
g > h.height && k.height < h.height && (g = h.height);
c = Math.max(e / this.scale, k.width);
d = Math.max(g / this.scale, k.height);
h.width < c && (c = Math.min(k.width, c));
h.height < d && (d = Math.min(k.height, d));
a = Math.min(h.width, a);
b = Math.min(h.height, b);
a = Math.max(c, a);
b = Math.max(d,
b);
if (90 === f || 270 === f) f = a, a = b, b = f, f = c, c = d, d = f;
this.pc.ha();
this.im(a, b, c, d);
this.pc.freeze();
this.pc.o() || B("Non-real measuredBounds has been set. Object " + this + ", measuredBounds: " + this.pc.toString());
Vi(this, !1)
}
};
Y.prototype.im = function () {
};
Y.prototype.wg = function () {
return !1
};
Y.prototype.arrange = function (a, b, c, d, e) {
this.gl();
var f = N.alloc();
f.assign(this.vb);
this.vb.ha();
!1 === aj(this) ? this.vb.h(a, b, c, d) : this.vh(a, b, c, d);
this.vb.freeze();
void 0 === e ? this.kd = null : this.kd = e;
c = !1;
if (void 0 !== e) c = !0; else if (e = this.panel, null === e || e.type !== X.TableRow && e.type !== X.TableColumn || (e = e.panel), null !== e && (e = e.qc, d = this.measuredBounds, null !== this.areaBackground && (d = this.vb), c = b + d.height, d = a + d.width, c = !(0 <= a + .05 && d <= e.width + .05 && 0 <= b + .05 && c <= e.height + .05), this instanceof Yg && (a = this.naturalBounds,
this.Rr > a.height || this.metrics.maxLineWidth > a.width))) c = !0;
this.H = c ? this.H | 256 : this.H & -257;
this.vb.o() || B("Non-real actualBounds has been set. Object " + this + ", actualBounds: " + this.vb.toString());
this.lt(f, this.vb);
Qk(this, !1);
N.free(f)
};
t = Y.prototype;
t.vh = function () {
};
function Rk(a, b, c, d, e) {
a.vb.h(b, c, d, e);
if (!a.desiredSize.o()) {
var f = a.pc;
c = a.Wg;
b = c.right + c.left;
var g = c.top + c.bottom;
c = f.width + b;
f = f.height + g;
d += b;
e += g;
b = Pk(a, !0);
c === d && f === e && (b = Bg);
switch (b) {
case Bg:
if (c > d || f > e) Vi(a, !0), a.measure(c > d ? d : c, f > e ? e : f, 0, 0);
break;
case wd:
Vi(a, !0);
a.measure(d, e, 0, 0);
break;
case Ak:
Vi(a, !0);
a.measure(d, f, 0, 0);
break;
case Bk:
Vi(a, !0), a.measure(c, e, 0, 0)
}
}
}
t.lt = function (a, b) {
var c = this.part;
null !== c && null !== c.diagram && (c.selectionObject !== this && c.resizeObject !== this && c.rotateObject !== this || Sk(c, !0), this.R(), ac(a, b) || (c.Ah(), this.Go(c)))
};
t.Go = function (a) {
null !== this.portId && (Sk(a, !0), a instanceof V && Tk(a, this))
};
t.hc = function (a, b) {
if (this.visible) {
var c = this instanceof X && (this.type === X.TableRow || this.type === X.TableColumn), d = this.vb;
if (c || 0 !== d.width && 0 !== d.height && !isNaN(d.x) && !isNaN(d.y)) {
var e = this.opacity;
if (0 !== e) {
var f = 1;
1 !== e && (f = a.globalAlpha, a.globalAlpha = f * e);
if (!this.bx(a, b)) if (c) Uk(this, a, b); else {
this instanceof R && this.ik(!1);
c = this.transform;
var g = this.panel;
0 !== (this.H & 4096) === !0 && Vk(this);
var h = this.part, k = !1, l = 0;
if (h && b.Ee("drawShadows") && (k = h.isShadowed)) {
var m = h.vi;
l = Math.max(m.y, m.x) *
b.scale * b.Mb
}
if (!(m = b.oj)) {
var n = this.naturalBounds;
m = this.Fh;
var p = m.m11, r = m.m21, q = m.dx, u = m.m12, v = m.m22, w = m.dy, z, y = z = 0;
m = z * p + y * r + q;
var A = z * u + y * v + w;
z = n.width + l;
y = 0;
var C = z * p + y * r + q;
z = z * u + y * v + w;
y = Math.min(m, C);
var I = Math.min(A, z);
var K = Math.max(m + 0, C) - y;
var J = Math.max(A + 0, z) - I;
m = y;
A = I;
z = n.width + l;
y = n.height + l;
C = z * p + y * r + q;
z = z * u + y * v + w;
y = Math.min(m, C);
I = Math.min(A, z);
K = Math.max(m + K, C) - y;
J = Math.max(A + J, z) - I;
m = y;
A = I;
z = 0;
y = n.height + l;
C = z * p + y * r + q;
z = z * u + y * v + w;
y = Math.min(m, C);
I = Math.min(A, z);
K = Math.max(m + K,
C) - y;
J = Math.max(A + J, z) - I;
m = y;
A = I;
l = b.viewportBounds;
n = l.x;
p = l.y;
m = !(m > l.$ + n || n > K + m || A > l.Z + p || p > J + A)
}
if (m) {
m = 0 !== (this.H & 256);
a.clipInsteadOfFill && (m = !1);
this instanceof Yg && (a.font = this.font);
if (m) {
A = g.Zd() ? g.naturalBounds : g.actualBounds;
null !== this.kd ? (n = this.kd, K = n.x, J = n.y, l = n.width, n = n.height) : (K = Math.max(d.x, A.x), J = Math.max(d.y, A.y), l = Math.min(d.right, A.right) - K, n = Math.min(d.bottom, A.bottom) - J);
if (K > d.width + d.x || d.x > A.width + A.x) {
1 !== e && (a.globalAlpha = f);
return
}
a.save();
a.beginPath();
a.rect(K,
J, l, n);
a.clip()
}
if (this.wg()) {
if (!h.isVisible()) {
1 !== e && (a.globalAlpha = f);
return
}
k && (A = h.vi, a.Pv(A.x * b.scale * b.Mb, A.y * b.scale * b.Mb, h.Od), Wk(a), a.shadowColor = h.Kj)
}
!0 === this.shadowVisible ? Wk(a) : !1 === this.shadowVisible && Xk(a);
h = this.naturalBounds;
null !== this.dc && (Sh(this, a, this.dc, !0, !0, h, d), this.dc instanceof Yk && this.dc.type === Zk ? (a.beginPath(), a.rect(d.x, d.y, d.width, d.height), a.Td(this.dc)) : a.fillRect(d.x, d.y, d.width, d.height));
a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy);
k && (null !== g && 0 !== (g.H &
512) || null !== g && (g.type === X.Auto || g.type === X.Spot) && g.zb() !== this) && null === this.shadowVisible && Xk(a);
null !== this.ib && (l = this.naturalBounds, K = A = 0, J = l.width, l = l.height, n = 0, this instanceof W && (l = this.qa.bounds, A = l.x, K = l.y, J = l.width, l = l.height, n = this.strokeWidth), Sh(this, a, this.ib, !0, !1, h, d), this.ib instanceof Yk && this.ib.type === Zk ? (a.beginPath(), a.rect(A - n / 2, K - n / 2, J + n, l + n), a.Td(this.ib)) : a.fillRect(A - n / 2, K - n / 2, J + n, l + n));
k && (null !== this.ib || null !== this.dc || null !== g && 0 !== (g.H & 512) || null !== g && (g.type ===
X.Auto || g.type === X.Spot) && g.zb() !== this) ? ($k(this, !0), null === this.shadowVisible && Xk(a)) : $k(this, !1);
this.Fi(a, b);
k && 0 !== (this.H & 512) === !0 && Wk(a);
this.wg() && k && Xk(a);
m ? (a.restore(), this instanceof X ? a.Rc(!0) : a.Rc(!1)) : c.ct() || (b = 1 / (c.m11 * c.m22 - c.m12 * c.m21), a.transform(c.m22 * b, -c.m12 * b, -c.m21 * b, c.m11 * b, b * (c.m21 * c.dy - c.m22 * c.dx), b * (c.m12 * c.dx - c.m11 * c.dy)))
}
}
1 !== e && (a.globalAlpha = f)
}
}
}
};
t.bx = function () {
return !1
};
function Uk(a, b, c) {
var d = a.vb, e = a.qc;
null !== a.dc && (Sh(a, b, a.dc, !0, !0, e, d), a.dc instanceof Yk && a.dc.type === Zk ? (b.beginPath(), b.rect(d.x, d.y, d.width, d.height), b.Td(a.dc)) : b.fillRect(d.x, d.y, d.width, d.height));
null !== a.ib && (Sh(a, b, a.ib, !0, !1, e, d), a.ib instanceof Yk && a.ib.type === Zk ? (b.beginPath(), b.rect(d.x, d.y, d.width, d.height), b.Td(a.ib)) : b.fillRect(d.x, d.y, d.width, d.height));
a.Fi(b, c)
}
t.Fi = function () {
};
function Sh(a, b, c, d, e, f, g) {
if (null !== c) {
var h = 1, k = 1;
if ("string" === typeof c) d ? b.fillStyle = c : b.strokeStyle = c; else if (c.type === al) d ? b.fillStyle = c.color : b.strokeStyle = c.color; else {
h = f.width;
k = f.height;
e && (h = g.width, k = g.height);
if ((f = b instanceof bl) && c.de && (c.type === cl || c.Ik === h && c.Lt === k)) var l = c.de; else {
var m = 0, n = 0, p = 0, r = 0, q = 0, u = 0;
u = q = 0;
e && (q = g.x, u = g.y);
m = c.start.x * h + c.start.offsetX;
n = c.start.y * k + c.start.offsetY;
p = c.end.x * h + c.end.offsetX;
r = c.end.y * k + c.end.offsetY;
m += q;
p += q;
n += u;
r += u;
if (c.type === dl) l =
b.createLinearGradient(m, n, p, r); else if (c.type === Zk) u = isNaN(c.endRadius) ? Math.max(h, k) / 2 : c.endRadius, isNaN(c.startRadius) ? (q = 0, u = Math.max(h, k) / 2) : q = c.startRadius, l = b.createRadialGradient(m, n, q, p, r, u); else if (c.type === cl) try {
l = b.createPattern(c.pattern, "repeat")
} catch (w) {
l = null
}
if (c.type !== cl && (e = c.colorStops, null !== e)) for (e = e.iterator; e.next();) l.addColorStop(e.key, e.value);
if (f && (c.de = l, null !== l && (c.Ik = h, c.Lt = k), null === l && c.type === cl && -1 !== c.Ik)) {
c.Ik = -1;
var v = a.diagram;
null !== v && -1 === c.Ik && sa(function () {
v.uf()
},
600)
}
}
d ? b.fillStyle = l : b.strokeStyle = l
}
}
}
t.ug = function (a) {
if (a instanceof X) a:{
if (this !== a && null !== a) for (var b = this.panel; null !== b;) {
if (b === a) {
a = !0;
break a
}
b = b.panel
}
a = !1
} else a = !1;
return a
};
t.tf = function () {
if (!this.visible) return !1;
var a = this.panel;
return null !== a ? a.tf() : !0
};
t.vg = function () {
for (var a = this instanceof X ? this : this.panel; null !== a && a.isEnabled;) a = a.panel;
return null === a
};
function Vk(a) {
if (0 !== (a.H & 2048) === !0) {
var b = a.tb;
b.reset();
if (!a.vb.o() || !a.pc.o()) {
el(a, !1);
return
}
b.translate(a.vb.x - a.pc.x, a.vb.y - a.pc.y);
if (1 !== a.scale || 0 !== a.angle) {
var c = a.naturalBounds;
Nk(a, b, c.x, c.y, c.width, c.height)
}
el(a, !1);
fl(a, !0)
}
0 !== (a.H & 4096) === !0 && (b = a.panel, null === b ? (a.Fh.set(a.tb), a.Uk = a.scale, fl(a, !1)) : null !== b.rd && (c = a.Fh, c.reset(), b.Zd() ? c.multiply(b.Fh) : null !== b.panel && c.multiply(b.panel.Fh), c.multiply(a.tb), a.Uk = a.scale * b.Uk, fl(a, !1)))
}
function Nk(a, b, c, d, e, f) {
1 !== a.scale && b.scale(a.scale);
if (0 !== a.angle) {
var g = Fc;
a.wg() && a.locationSpot.gb() && (g = a.locationSpot);
var h = G.alloc();
if (a instanceof S && a.locationObject !== a) for (c = a.locationObject, d = c.naturalBounds, h.sk(d.x, d.y, d.width, d.height, g), c.Rf.ta(h), h.offset(-c.measuredBounds.x, -c.measuredBounds.y), g = c.panel; null !== g && g !== a;) g.Rf.ta(h), h.offset(-g.measuredBounds.x, -g.measuredBounds.y), g = g.panel; else h.sk(c, d, e, f, g);
b.rotate(a.angle, h.x, h.y);
G.free(h)
}
}
t.s = function (a) {
void 0 === a && (a = !1);
if (!0 !== $i(this)) {
Vi(this, !0);
Qk(this, !0);
var b = this.panel;
null === b || a || b.s()
}
};
t.em = function () {
!0 !== $i(this) && (Vi(this, !0), Qk(this, !0))
};
function gl(a) {
if (!1 === aj(a)) {
var b = a.panel;
null !== b ? b.s() : a.wg() && (b = a.diagram, null !== b && (b.Dd.add(a), a instanceof V && a.ed(), b.cc()));
Qk(a, !0)
}
}
t.gl = function () {
0 !== (this.H & 2048) === !1 && (el(this, !0), fl(this, !0))
};
t.kv = function () {
fl(this, !0)
};
t.R = function () {
var a = this.part;
null !== a && a.R()
};
function Pk(a, b) {
var c = a.stretch, d = a.panel;
if (null !== d && d.type === X.Table) return hl(a, d.getRowDefinition(a.row), d.getColumnDefinition(a.column), b);
if (null !== d && d.type === X.Auto && d.zb() === a) return il(a, wd, b);
if (c === zk) {
if (null !== d) {
if (d.type === X.Spot && d.zb() === a) return il(a, wd, b);
c = d.defaultStretch;
return c === zk ? il(a, Bg, b) : il(a, c, b)
}
return il(a, Bg, b)
}
return il(a, c, b)
}
function hl(a, b, c, d) {
var e = a.stretch;
if (e !== zk) return il(a, e, d);
var f = e = null;
switch (b.stretch) {
case Bk:
f = !0;
break;
case wd:
f = !0
}
switch (c.stretch) {
case Ak:
e = !0;
break;
case wd:
e = !0
}
b = a.panel.defaultStretch;
null === e && (e = b === Ak || b === wd);
null === f && (f = b === Bk || b === wd);
return !0 === e && !0 === f ? il(a, wd, d) : !0 === e ? il(a, Ak, d) : !0 === f ? il(a, Bk, d) : il(a, Bg, d)
}
function il(a, b, c) {
if (c) return b;
if (b === Bg) return Bg;
c = a.desiredSize;
if (c.o()) return Bg;
a = a.angle;
if (!isNaN(c.width)) if (90 !== a && 270 !== a) {
if (b === Ak) return Bg;
if (b === wd) return Bk
} else {
if (b === Bk) return Bg;
if (b === wd) return Ak
}
if (!isNaN(c.height)) if (90 !== a && 270 !== a) {
if (b === Bk) return Bg;
if (b === wd) return Ak
} else {
if (b === Ak) return Bg;
if (b === wd) return Bk
}
return b
}
function $k(a, b) {
a.H = b ? a.H | 512 : a.H & -513
}
function Jk(a) {
return 0 !== (a.H & 1024)
}
function jl(a, b) {
a.H = b ? a.H | 1024 : a.H & -1025
}
function el(a, b) {
a.H = b ? a.H | 2048 : a.H & -2049
}
function fl(a, b) {
a.H = b ? a.H | 4096 : a.H & -4097
}
function $i(a) {
return 0 !== (a.H & 8192)
}
function Vi(a, b) {
a.H = b ? a.H | 8192 : a.H & -8193
}
function aj(a) {
return 0 !== (a.H & 16384)
}
function Qk(a, b) {
a.H = b ? a.H | 16384 : a.H & -16385
}
t.Vi = function (a) {
this.dg = a
};
t.Nv = function () {
};
t.Mv = function (a) {
this.sa = a;
gl(this);
return !0
};
t.wt = function (a, b) {
this.sa.h(a, b);
this.gl()
};
function kl(a) {
var b = a.part;
if (b instanceof V && (null !== a.portId || a === b.port)) {
var c = b.diagram;
null === c || c.undoManager.isUndoingRedoing || Tk(b, a)
}
}
function ll(a) {
var b = a.diagram;
null === b || b.undoManager.isUndoingRedoing || (a instanceof X ? a instanceof V ? a.ed() : a.zm(a, function (a) {
kl(a)
}) : kl(a))
}
t.bind = function (a) {
a.Qd = this;
var b = this.Ji();
null !== b && ml(b) && B("Cannot add a Binding to a template that has already been copied: " + a);
null === this.bb && (this.bb = new E);
this.bb.add(a)
};
t.Ji = function () {
for (var a = this instanceof X ? this : this.panel; null !== a;) {
if (null !== a.Sh) return a;
a = a.panel
}
return null
};
t.Ov = function (a) {
gj(this, a)
};
function nl(a, b) {
for (var c = 1; c < arguments.length; ++c) ;
c = arguments;
var d = null, e = null;
if ("function" === typeof a) e = a; else if ("string" === typeof a) {
var f = ol.J(a);
"function" === typeof f ? (c = Aa(arguments), d = f(c), ya(d) || B('GraphObject.make invoked object builder "' + a + '", but it did not return an Object')) : e = x.go[a]
}
null === d && (void 0 !== e && null !== e && e.constructor || B("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: " + a), d = new e);
e = 1;
if (d instanceof P && 1 < c.length) {
f =
d;
var g = c[1];
if ("string" === typeof g || g instanceof HTMLDivElement) ii(f, g), e++
}
for (; e < c.length; e++) f = c[e], void 0 === f ? B("Undefined value at argument " + e + " for object being constructed by GraphObject.make: " + d) : pl(d, f);
return d
}
function pl(a, b) {
if ("string" === typeof b) if (a instanceof Yg) a.text = b; else if (a instanceof W) a.figure = b; else if (a instanceof Qj) a.source = b; else if (a instanceof X) b = ql.J(b), null !== b && (a.type = b); else if (a instanceof Yk) {
var c = bb(Yk, b);
null !== c ? a.type = c : B("Unknown Brush type as an argument to GraphObject.make: " + b)
} else a instanceof ud ? (b = bb(ud, b), null !== b && (a.type = b)) : a instanceof le && (b = bb(le, b), null !== b && (a.type = b)); else if (b instanceof Y) a instanceof X || B("A GraphObject can only be added to a Panel, not to: " +
a), a.add(b); else if (b instanceof Aj) {
var d;
b.isRow && "function" === typeof a.getRowDefinition ? d = a.getRowDefinition(b.index) : b.isRow || "function" !== typeof a.getColumnDefinition || (d = a.getColumnDefinition(b.index));
d instanceof Aj ? d.Wl(b) : B("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: " + a)
} else if (b instanceof D) "function" === typeof a.fb && a.fb(b); else if (b instanceof rl) a.type = b; else if (b instanceof si) a instanceof Y ? a.bind(b) : a instanceof
Aj ? a.bind(b) : B("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: " + a); else if (b instanceof ke) a instanceof ud ? a.figures.add(b) : B("A PathFigure can only be added to a Geometry, not to: " + a); else if (b instanceof le) a instanceof ke ? a.segments.add(b) : B("A PathSegment can only be added to a PathFigure, not to: " + a); else if (b instanceof gi) a instanceof P ? a.layout = b : a instanceof U ? a.layout = b : B("A Layout can only be assigned to a Diagram or a Group, not to: " + a); else if (Array.isArray(b)) for (c =
0; c < b.length; c++) pl(a, b[c]); else if ("object" === typeof b && null !== b) if (a instanceof Yk) {
c = new db;
for (var e in b) d = parseFloat(e), isNaN(d) ? c[e] = b[e] : a.addColorStop(d, b[e]);
gj(a, c)
} else if (a instanceof Aj) {
void 0 !== b.row ? (e = b.row, (void 0 === e || null === e || Infinity === e || isNaN(e) || 0 > e) && B("Must specify non-negative integer row for RowColumnDefinition " + b + ", not: " + e), a.isRow = !0, a.index = e) : void 0 !== b.column && (e = b.column, (void 0 === e || null === e || Infinity === e || isNaN(e) || 0 > e) && B("Must specify non-negative integer column for RowColumnDefinition " +
b + ", not: " + e), a.isRow = !1, a.index = e);
e = new db;
for (c in b) "row" !== c && "column" !== c && (e[c] = b[c]);
gj(a, e)
} else gj(a, b); else B('Unknown initializer "' + b + '" for object being constructed by GraphObject.make: ' + a)
}
function sl(a, b) {
ol.add(a, b)
}
function tl(a, b, c) {
void 0 === c && (c = null);
var d = a[1];
if ("function" === typeof c ? c(d) : "string" === typeof d) return a.splice(1, 1), d;
if (void 0 === b) throw Error("no " + ("function" === typeof c ? "satisfactory" : "string") + " argument for GraphObject builder " + a[0]);
return b
}
ma.Object.defineProperties(Y.prototype, {
shadowVisible: {
get: function () {
return this.Dl
}, set: function (a) {
var b = this.Dl;
b !== a && (this.Dl = a, this.R(), this.g("shadowVisible", b, a))
}
}, enabledChanged: {
get: function () {
return null !== this.O ? this.O.Bn : null
}, set: function (a) {
Gk(this);
var b = this.O.Bn;
b !== a && (this.O.Bn = a, this.g("enabledChanged", b, a))
}
}, segmentOrientation: {
get: function () {
return this.Bl
}, set: function (a) {
var b = this.Bl;
b !== a && (this.Bl = a, this.s(), this.g("segmentOrientation", b, a), a === qg && (this.angle = 0))
}
}, segmentIndex: {
get: function () {
return this.jp
}, set: function (a) {
a = Math.round(a);
var b = this.jp;
b !== a && (this.jp = a, this.s(), this.g("segmentIndex", b, a))
}
}, segmentFraction: {
get: function () {
return this.zl
}, set: function (a) {
isNaN(a) ? a = 0 : 0 > a ? a = 0 : 1 < a && (a = 1);
var b = this.zl;
b !== a && (this.zl = a, this.s(), this.g("segmentFraction", b, a))
}
}, segmentOffset: {
get: function () {
return this.Al
}, set: function (a) {
var b = this.Al;
b.A(a) || (this.Al = a = a.I(), this.s(), this.g("segmentOffset", b, a))
}
}, stretch: {
get: function () {
return this.we
}, set: function (a) {
var b = this.we;
b !== a && (this.we = a, this.s(), this.g("stretch", b, a))
}
}, name: {
get: function () {
return this.Ua
}, set: function (a) {
var b = this.Ua;
b !== a && (this.Ua = a, null !== this.part && (this.part.xj = null), this.g("name", b, a))
}
}, opacity: {
get: function () {
return this.lb
},
set: function (a) {
var b = this.lb;
b !== a && ((0 > a || 1 < a) && va(a, "0 <= value <= 1", Y, "opacity"), this.lb = a, this.g("opacity", b, a), a = this.diagram, b = this.part, null !== a && null !== b && a.R(kj(b, b.actualBounds)))
}
}, visible: {
get: function () {
return 0 !== (this.H & 1)
}, set: function (a) {
var b = 0 !== (this.H & 1);
b !== a && (this.H ^= 1, this.g("visible", b, a), b = this.panel, null !== b ? b.s() : this.wg() && this.Lb(a), this.R(), ll(this))
}
}, pickable: {
get: function () {
return 0 !== (this.H & 2)
}, set: function (a) {
var b =
0 !== (this.H & 2);
b !== a && (this.H ^= 2, this.g("pickable", b, a))
}
}, fromLinkableDuplicates: {
get: function () {
return 0 !== (this.H & 4)
}, set: function (a) {
var b = 0 !== (this.H & 4);
b !== a && (this.H ^= 4, this.g("fromLinkableDuplicates", b, a))
}
}, fromLinkableSelfNode: {
get: function () {
return 0 !== (this.H & 8)
}, set: function (a) {
var b = 0 !== (this.H & 8);
b !== a && (this.H ^= 8, this.g("fromLinkableSelfNode", b, a))
}
}, toLinkableDuplicates: {
get: function () {
return 0 !==
(this.H & 16)
}, set: function (a) {
var b = 0 !== (this.H & 16);
b !== a && (this.H ^= 16, this.g("toLinkableDuplicates", b, a))
}
}, toLinkableSelfNode: {
get: function () {
return 0 !== (this.H & 32)
}, set: function (a) {
var b = 0 !== (this.H & 32);
b !== a && (this.H ^= 32, this.g("toLinkableSelfNode", b, a))
}
}, isPanelMain: {
get: function () {
return 0 !== (this.H & 64)
}, set: function (a) {
var b = 0 !== (this.H & 64);
b !== a && (this.H ^= 64, this.s(), this.g("isPanelMain", b, a))
}
}, isActionable: {
get: function () {
return 0 !== (this.H & 128)
}, set: function (a) {
var b = 0 !== (this.H & 128);
b !== a && (this.H ^= 128, this.g("isActionable", b, a))
}
}, areaBackground: {
get: function () {
return this.dc
}, set: function (a) {
var b = this.dc;
b !== a && (null !== a && ul(a, "GraphObject.areaBackground"), a instanceof Yk && a.freeze(), this.dc = a, this.R(), this.g("areaBackground", b, a))
}
}, background: {
get: function () {
return this.ib
}, set: function (a) {
var b = this.ib;
b !== a && (null !== a && ul(a, "GraphObject.background"),
a instanceof Yk && a.freeze(), this.ib = a, this.R(), this.g("background", b, a))
}
}, part: {
get: function () {
if (this.wg()) return this;
if (null !== this.Cj) return this.Cj;
var a;
for (a = this.panel; a;) {
if (a instanceof S) return this.Cj = a;
a = a.panel
}
return null
}
}, svg: {
get: function () {
return this.Bs
}, set: function (a) {
this.Bs = a
}
}, panel: {
get: function () {
return this.dg
}
}, layer: {
get: function () {
var a = this.part;
return null !== a ? a.layer : null
}
}, diagram: {
get: function () {
var a = this.part;
return null !== a ? a.diagram : null
}
}, position: {
get: function () {
return this.sa
}, set: function (a) {
var b = a.x, c = a.y, d = this.sa, e = d.x, f = d.y;
(e === b || isNaN(e) && isNaN(b)) && (f === c || isNaN(f) && isNaN(c)) ? this.Nv() : (a = a.I(), this.Mv(a, d) && this.g("position", d, a))
}
}, actualBounds: {
get: function () {
return this.vb
}
}, scale: {
get: function () {
return this.Ca
},
set: function (a) {
var b = this.Ca;
b !== a && (0 >= a && B("GraphObject.scale for " + this + " must be greater than zero, not: " + a), this.Ca = a, this.s(), this.g("scale", b, a))
}
}, angle: {
get: function () {
return this.zc
}, set: function (a) {
var b = this.zc;
b !== a && (a %= 360, 0 > a && (a += 360), b !== a && (this.zc = a, ll(this), this.s(), this.g("angle", b, a)))
}
}, desiredSize: {
get: function () {
return this.Nc
}, set: function (a) {
var b = a.width, c = a.height, d = this.Nc, e = d.width, f = d.height;
(e === b || isNaN(e) &&
isNaN(b)) && (f === c || isNaN(f) && isNaN(c)) || (this.Nc = a = a.I(), this.s(), this instanceof W && this.ac(), this.g("desiredSize", d, a), Jk(this) && (a = this.part, null !== a && (Kk(this, a, "width"), Kk(this, a, "height"))))
}
}, width: {
get: function () {
return this.Nc.width
}, set: function (a) {
var b = this.Nc.width;
b === a || isNaN(b) && isNaN(a) || (b = this.Nc, this.Nc = a = (new M(a, this.Nc.height)).freeze(), this.s(), this instanceof W && this.ac(), this.g("desiredSize", b, a), Jk(this) && (a = this.part, null !== a && Kk(this, a, "width")))
}
},
height: {
get: function () {
return this.Nc.height
}, set: function (a) {
var b = this.Nc.height;
b === a || isNaN(b) && isNaN(a) || (b = this.Nc, this.Nc = a = (new M(this.Nc.width, a)).freeze(), this.s(), this instanceof W && this.ac(), this.g("desiredSize", b, a), Jk(this) && (a = this.part, null !== a && Kk(this, a, "height")))
}
}, minSize: {
get: function () {
return this.Tf
}, set: function (a) {
var b = this.Tf;
b.A(a) || (a = a.copy(), isNaN(a.width) && (a.width = 0), isNaN(a.height) && (a.height = 0), a.freeze(),
this.Tf = a, this.s(), this.g("minSize", b, a))
}
}, maxSize: {
get: function () {
return this.Sf
}, set: function (a) {
var b = this.Sf;
b.A(a) || (a = a.copy(), isNaN(a.width) && (a.width = Infinity), isNaN(a.height) && (a.height = Infinity), a.freeze(), this.Sf = a, this.s(), this.g("maxSize", b, a))
}
}, measuredBounds: {
get: function () {
return this.pc
}
}, naturalBounds: {
get: function () {
return this.qc
}
}, margin: {
get: function () {
return this.Wg
},
set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.Wg;
b.A(a) || (this.Wg = a = a.I(), this.s(), this.g("margin", b, a))
}
}, transform: {
get: function () {
0 !== (this.H & 2048) === !0 && Vk(this);
return this.tb
}
}, rd: {
get: function () {
0 !== (this.H & 4096) === !0 && Vk(this);
return this.Fh
}
}, alignment: {
get: function () {
return this.wb
}, set: function (a) {
var b = this.wb;
b.A(a) || (a.jc() && !a.Kb() && B("GraphObject.alignment for " + this + " must be a real Spot or Spot.Default, not: " +
a), this.wb = a = a.I(), gl(this), this.g("alignment", b, a))
}
}, column: {
get: function () {
return this.Gg
}, set: function (a) {
a = Math.round(a);
var b = this.Gg;
b !== a && (0 > a && va(a, ">= 0", Y, "column"), this.Gg = a, this.s(), this.g("column", b, a))
}
}, columnSpan: {
get: function () {
return this.Zm
}, set: function (a) {
a = Math.round(a);
var b = this.Zm;
b !== a && (1 > a && va(a, ">= 1", Y, "columnSpan"), this.Zm = a, this.s(), this.g("columnSpan", b, a))
}
}, row: {
get: function () {
return this.ep
},
set: function (a) {
a = Math.round(a);
var b = this.ep;
b !== a && (0 > a && va(a, ">= 0", Y, "row"), this.ep = a, this.s(), this.g("row", b, a))
}
}, rowSpan: {
get: function () {
return this.fp
}, set: function (a) {
a = Math.round(a);
var b = this.fp;
b !== a && (1 > a && va(a, ">= 1", Y, "rowSpan"), this.fp = a, this.s(), this.g("rowSpan", b, a))
}
}, spanAllocation: {
get: function () {
return this.vp
}, set: function (a) {
var b = this.vp;
b !== a && (this.vp = a, this.s(), this.g("spanAllocation", b, a))
}
}, alignmentFocus: {
get: function () {
return this.zk
}, set: function (a) {
var b = this.zk;
b.A(a) || (this.zk = a = a.I(), this.s(), this.g("alignmentFocus", b, a))
}
}, portId: {
get: function () {
return this.Ro
}, set: function (a) {
var b = this.Ro;
if (b !== a) {
var c = this.part;
null === c || c instanceof V || (B("Cannot set portID on a Link: " + a), c = null);
null !== b && null !== c && vl(c, this);
this.Ro = a;
null !== a && null !== c && (c.zh = !0, wl(c, this));
this.g("portId", b, a)
}
}
}, toSpot: {
get: function () {
return null !==
this.P ? this.P.oh : yc
}, set: function (a) {
this.Hc();
var b = this.P.oh;
b.A(a) || (a = a.I(), this.P.oh = a, this.g("toSpot", b, a), kl(this))
}
}, toEndSegmentLength: {
get: function () {
return null !== this.P ? this.P.mh : 10
}, set: function (a) {
this.Hc();
var b = this.P.mh;
b !== a && (0 > a && va(a, ">= 0", Y, "toEndSegmentLength"), this.P.mh = a, this.g("toEndSegmentLength", b, a), kl(this))
}
}, toShortLength: {
get: function () {
return null !== this.P ? this.P.nh : 0
}, set: function (a) {
this.Hc();
var b = this.P.nh;
b !== a && (this.P.nh = a, this.g("toShortLength", b, a), kl(this))
}
}, toLinkable: {
get: function () {
return null !== this.P ? this.P.Cp : null
}, set: function (a) {
this.Hc();
var b = this.P.Cp;
b !== a && (this.P.Cp = a, this.g("toLinkable", b, a))
}
}, toMaxLinks: {
get: function () {
return null !== this.P ? this.P.Dp : Infinity
}, set: function (a) {
this.Hc();
var b = this.P.Dp;
b !== a && (0 > a && va(a, ">= 0", Y, "toMaxLinks"), this.P.Dp = a, this.g("toMaxLinks", b, a))
}
}, fromSpot: {
get: function () {
return null !== this.P ? this.P.Pg : yc
}, set: function (a) {
this.Hc();
var b = this.P.Pg;
b.A(a) || (a = a.I(), this.P.Pg = a, this.g("fromSpot", b, a), kl(this))
}
}, fromEndSegmentLength: {
get: function () {
return null !== this.P ? this.P.Ng : 10
}, set: function (a) {
this.Hc();
var b = this.P.Ng;
b !== a && (0 > a && va(a, ">= 0", Y, "fromEndSegmentLength"), this.P.Ng = a, this.g("fromEndSegmentLength", b, a), kl(this))
}
}, fromShortLength: {
get: function () {
return null !== this.P ? this.P.Og :
0
}, set: function (a) {
this.Hc();
var b = this.P.Og;
b !== a && (this.P.Og = a, this.g("fromShortLength", b, a), kl(this))
}
}, fromLinkable: {
get: function () {
return null !== this.P ? this.P.Dn : null
}, set: function (a) {
this.Hc();
var b = this.P.Dn;
b !== a && (this.P.Dn = a, this.g("fromLinkable", b, a))
}
}, fromMaxLinks: {
get: function () {
return null !== this.P ? this.P.En : Infinity
}, set: function (a) {
this.Hc();
var b = this.P.En;
b !== a && (0 > a && va(a, ">= 0", Y, "fromMaxLinks"), this.P.En = a, this.g("fromMaxLinks",
b, a))
}
}, cursor: {
get: function () {
return this.jn
}, set: function (a) {
var b = this.jn;
b !== a && (this.jn = a, this.g("cursor", b, a))
}
}, click: {
get: function () {
return null !== this.O ? this.O.Df : null
}, set: function (a) {
Gk(this);
var b = this.O.Df;
b !== a && (this.O.Df = a, this.g("click", b, a))
}
}, doubleClick: {
get: function () {
return null !== this.O ? this.O.If : null
}, set: function (a) {
Gk(this);
var b = this.O.If;
b !== a && (this.O.If = a, this.g("doubleClick", b,
a))
}
}, contextClick: {
get: function () {
return null !== this.O ? this.O.Ef : null
}, set: function (a) {
Gk(this);
var b = this.O.Ef;
b !== a && (this.O.Ef = a, this.g("contextClick", b, a))
}
}, mouseEnter: {
get: function () {
return null !== this.O ? this.O.Vf : null
}, set: function (a) {
Gk(this);
var b = this.O.Vf;
b !== a && (this.O.Vf = a, this.g("mouseEnter", b, a))
}
}, mouseLeave: {
get: function () {
return null !== this.O ? this.O.Yf : null
}, set: function (a) {
Gk(this);
var b =
this.O.Yf;
b !== a && (this.O.Yf = a, this.g("mouseLeave", b, a))
}
}, mouseOver: {
get: function () {
return null !== this.O ? this.O.Zf : null
}, set: function (a) {
Gk(this);
var b = this.O.Zf;
b !== a && (this.O.Zf = a, this.g("mouseOver", b, a))
}
}, mouseHover: {
get: function () {
return null !== this.O ? this.O.Xf : null
}, set: function (a) {
Gk(this);
var b = this.O.Xf;
b !== a && (this.O.Xf = a, this.g("mouseHover", b, a))
}
}, mouseHold: {
get: function () {
return null !== this.O ? this.O.Wf :
null
}, set: function (a) {
Gk(this);
var b = this.O.Wf;
b !== a && (this.O.Wf = a, this.g("mouseHold", b, a))
}
}, mouseDragEnter: {
get: function () {
return null !== this.O ? this.O.to : null
}, set: function (a) {
Gk(this);
var b = this.O.to;
b !== a && (this.O.to = a, this.g("mouseDragEnter", b, a))
}
}, mouseDragLeave: {
get: function () {
return null !== this.O ? this.O.uo : null
}, set: function (a) {
Gk(this);
var b = this.O.uo;
b !== a && (this.O.uo = a, this.g("mouseDragLeave", b, a))
}
}, mouseDrop: {
get: function () {
return null !== this.O ? this.O.Uf : null
}, set: function (a) {
Gk(this);
var b = this.O.Uf;
b !== a && (this.O.Uf = a, this.g("mouseDrop", b, a))
}
}, actionDown: {
get: function () {
return null !== this.O ? this.O.Jm : null
}, set: function (a) {
Gk(this);
var b = this.O.Jm;
b !== a && (this.O.Jm = a, this.g("actionDown", b, a))
}
}, actionMove: {
get: function () {
return null !== this.O ? this.O.Km : null
}, set: function (a) {
Gk(this);
var b = this.O.Km;
b !== a && (this.O.Km = a, this.g("actionMove",
b, a))
}
}, actionUp: {
get: function () {
return null !== this.O ? this.O.Lm : null
}, set: function (a) {
Gk(this);
var b = this.O.Lm;
b !== a && (this.O.Lm = a, this.g("actionUp", b, a))
}
}, actionCancel: {
get: function () {
return null !== this.O ? this.O.Im : null
}, set: function (a) {
Gk(this);
var b = this.O.Im;
b !== a && (this.O.Im = a, this.g("actionCancel", b, a))
}
}, toolTip: {
get: function () {
return null !== this.O ? this.O.kg : null
}, set: function (a) {
Gk(this);
var b = this.O.kg;
b !== a && (this.O.kg = a, this.g("toolTip", b, a))
}
}, contextMenu: {
get: function () {
return null !== this.O ? this.O.Ff : null
}, set: function (a) {
Gk(this);
var b = this.O.Ff;
b !== a && (this.O.Ff = a, this.g("contextMenu", b, a))
}
}
});
Y.prototype.setProperties = Y.prototype.Ov;
Y.prototype.findTemplateBinder = Y.prototype.Ji;
Y.prototype.bind = Y.prototype.bind;
Y.prototype.isEnabledObject = Y.prototype.vg;
Y.prototype.isVisibleObject = Y.prototype.tf;
Y.prototype.isContainedBy = Y.prototype.ug;
Y.prototype.getNearestIntersectionPoint = Y.prototype.Tc;
Y.prototype.getLocalPoint = Y.prototype.Ws;
Y.prototype.getDocumentScale = Y.prototype.De;
Y.prototype.getDocumentAngle = Y.prototype.Mi;
Y.prototype.getDocumentBounds = Y.prototype.Zp;
Y.prototype.getDocumentPoint = Y.prototype.ma;
Y.prototype.intersectsRect = Y.prototype.Ic;
Y.prototype.containedInRect = Y.prototype.wh;
Y.prototype.containsRect = Y.prototype.nf;
Y.prototype.containsPoint = Y.prototype.da;
Y.prototype.raiseChanged = Y.prototype.g;
Y.prototype.raiseChangedEvent = Y.prototype.ab;
Y.prototype.addCopyProperty = Y.prototype.Pw;
var ol = null;
Y.className = "GraphObject";
ol = new vb;
sl("Button", function () {
function a(a, b) {
return null !== a.diagram.Rb(a.documentPoint, function (a) {
for (; null !== a.panel && !a.isActionable;) a = a.panel;
return a
}, function (a) {
return a === b
})
}
var b = nl(X, X.Auto, {
isActionable: !0,
enabledChanged: function (a, b) {
if (a instanceof X) {
var c = a.$a("ButtonBorder");
null !== c && (c.fill = b ? a._buttonFillNormal : a._buttonFillDisabled)
}
},
cursor: "pointer",
_buttonFillNormal: "#F5F5F5",
_buttonStrokeNormal: "#BDBDBD",
_buttonFillOver: "#E0E0E0",
_buttonStrokeOver: "#9E9E9E",
_buttonFillPressed: "#BDBDBD",
_buttonStrokePressed: "#9E9E9E",
_buttonFillDisabled: "#E5E5E5"
}, nl(W, {
name: "ButtonBorder",
figure: "RoundedRectangle",
spot1: new O(0, 0, 2.76142374915397, 2.761423749153969),
spot2: new O(1, 1, -2.76142374915397, -2.761423749153969),
parameter1: 2,
parameter2: 2,
fill: "#F5F5F5",
stroke: "#BDBDBD"
}));
b.mouseEnter = function (a, b) {
if (b.vg() && b instanceof X && (a = b.$a("ButtonBorder"), a instanceof W)) {
var c = b._buttonFillOver;
b._buttonFillNormal = a.fill;
a.fill = c;
c = b._buttonStrokeOver;
b._buttonStrokeNormal = a.stroke;
a.stroke = c
}
};
b.mouseLeave = function (a, b) {
b.vg() && b instanceof X && (a = b.$a("ButtonBorder"), a instanceof W && (a.fill = b._buttonFillNormal, a.stroke = b._buttonStrokeNormal))
};
b.actionDown = function (a, b) {
if (b.vg() && b instanceof X && null !== b._buttonFillPressed && 0 === a.button) {
var c = b.$a("ButtonBorder");
if (c instanceof W) {
a = a.diagram;
var d = a.skipsUndoManager;
a.skipsUndoManager = !0;
var g = b._buttonFillPressed;
b._buttonFillOver = c.fill;
c.fill = g;
g = b._buttonStrokePressed;
b._buttonStrokeOver = c.stroke;
c.stroke = g;
a.skipsUndoManager = d
}
}
};
b.actionUp = function (b, d) {
if (d.vg() && d instanceof X && null !== d._buttonFillPressed && 0 === b.button) {
var c = d.$a("ButtonBorder");
if (c instanceof W) {
var f = b.diagram, g = f.skipsUndoManager;
f.skipsUndoManager = !0;
a(b, d) ? (c.fill = d._buttonFillOver, c.stroke = d._buttonStrokeOver) : (c.fill = d._buttonFillNormal, c.stroke = d._buttonStrokeNormal);
f.skipsUndoManager = g
}
}
};
b.actionCancel = function (b, d) {
if (d.vg() && d instanceof X && null !== d._buttonFillPressed) {
var c = d.$a("ButtonBorder");
if (c instanceof W) {
var f = b.diagram, g = f.skipsUndoManager;
f.skipsUndoManager = !0;
a(b, d) ? (c.fill = d._buttonFillOver, c.stroke = d._buttonStrokeOver) : (c.fill = d._buttonFillNormal, c.stroke = d._buttonStrokeNormal);
f.skipsUndoManager = g
}
}
};
b.actionMove = function (b, d) {
if (d.vg() && d instanceof X && null !== d._buttonFillPressed) {
var c = b.diagram;
if (0 === c.firstInput.button && (c.currentTool.standardMouseOver(), a(b, d) && (b = d.$a("ButtonBorder"), b instanceof W))) {
var f = c.skipsUndoManager;
c.skipsUndoManager = !0;
var g = d._buttonFillPressed;
b.fill !== g && (b.fill = g);
g = d._buttonStrokePressed;
b.stroke !== g && (b.stroke = g);
c.skipsUndoManager = f
}
}
};
return b
});
sl("TreeExpanderButton", function () {
var a = nl("Button", {
_treeExpandedFigure: "MinusLine",
_treeCollapsedFigure: "PlusLine"
}, nl(W, {
name: "ButtonIcon",
figure: "MinusLine",
stroke: "#424242",
strokeWidth: 2,
desiredSize: Ob
}, (new si("figure", "isTreeExpanded", function (a, c) {
c = c.panel;
return a ? c._treeExpandedFigure : c._treeCollapsedFigure
})).lq()), {visible: !1}, (new si("visible", "isTreeLeaf", function (a) {
return !a
})).lq());
a.click = function (a, c) {
c = c.part;
c instanceof Je && (c = c.adornedPart);
if (c instanceof V) {
var b = c.diagram;
if (null !== b) {
b = b.commandHandler;
if (c.isTreeExpanded) {
if (!b.canCollapseTree(c)) return
} else if (!b.canExpandTree(c)) return;
a.handled = !0;
c.isTreeExpanded ? b.collapseTree(c) : b.expandTree(c)
}
}
};
return a
});
sl("SubGraphExpanderButton", function () {
var a = nl("Button", {
_subGraphExpandedFigure: "MinusLine",
_subGraphCollapsedFigure: "PlusLine"
}, nl(W, {
name: "ButtonIcon",
figure: "MinusLine",
stroke: "#424242",
strokeWidth: 2,
desiredSize: Ob
}, (new si("figure", "isSubGraphExpanded", function (a, c) {
c = c.panel;
return a ? c._subGraphExpandedFigure : c._subGraphCollapsedFigure
})).lq()));
a.click = function (a, c) {
c = c.part;
c instanceof Je && (c = c.adornedPart);
if (c instanceof U) {
var b = c.diagram;
if (null !== b) {
b = b.commandHandler;
if (c.isSubGraphExpanded) {
if (!b.canCollapseSubGraph(c)) return
} else if (!b.canExpandSubGraph(c)) return;
a.handled = !0;
c.isSubGraphExpanded ? b.collapseSubGraph(c) : b.expandSubGraph(c)
}
}
};
return a
});
sl("ToolTip", function () {
return nl(Je, X.Auto, {
isShadowed: !0,
shadowColor: "rgba(0, 0, 0, .4)",
shadowOffset: new G(0, 3),
shadowBlur: 5
}, nl(W, {
name: "Border",
figure: "RoundedRectangle",
parameter1: 1,
parameter2: 1,
fill: "#F5F5F5",
stroke: "#F0F0F0",
spot1: new O(0, 0, 4, 6),
spot2: new O(1, 1, -4, -4)
}))
});
sl("ContextMenu", function () {
return nl(Je, X.Vertical, {
background: "#F5F5F5",
isShadowed: !0,
shadowColor: "rgba(0, 0, 0, .4)",
shadowOffset: new G(0, 3),
shadowBlur: 5
}, new si("background", "", function (a) {
return null !== a.adornedPart && null !== a.placeholder ? null : "#F5F5F5"
}))
});
sl("ContextMenuButton", function () {
var a = nl("Button");
a.stretch = Ak;
var b = a.$a("ButtonBorder");
b instanceof W && (b.figure = "Rectangle", b.strokeWidth = 0, b.spot1 = new O(0, 0, 2, 3), b.spot2 = new O(1, 1, -2, -2));
return a
});
sl("PanelExpanderButton", function (a) {
var b = tl(a, "COLLAPSIBLE"), c = nl("Button", {
_buttonExpandedFigure: "M0 0 M0 6 L4 2 8 6 M8 8",
_buttonCollapsedFigure: "M0 0 M0 2 L4 6 8 2 M8 8",
_buttonFillNormal: "rgba(0, 0, 0, 0)",
_buttonStrokeNormal: null,
_buttonFillOver: "rgba(0, 0, 0, .2)",
_buttonStrokeOver: null,
_buttonFillPressed: "rgba(0, 0, 0, .4)",
_buttonStrokePressed: null
}, nl(W, {name: "ButtonIcon", strokeWidth: 2}, (new si("geometryString", "visible", function (a) {
return a ? c._buttonExpandedFigure : c._buttonCollapsedFigure
})).lq(b)));
a = c.$a("ButtonBorder");
a instanceof W && (a.stroke = null, a.fill = "rgba(0, 0, 0, 0)");
c.click = function (a, c) {
a = c.diagram;
if (null !== a && !a.isReadOnly) {
var d = c.Ji();
null === d && (d = c.part);
null !== d && (c = d.$a(b), null !== c && (a.Aa("Collapse/Expand Panel"), c.visible = !c.visible, a.Za("Collapse/Expand Panel")))
}
};
return c
});
sl("CheckBoxButton", function (a) {
var b = tl(a);
a = nl("Button", {desiredSize: new M(14, 14)}, nl(W, {
name: "ButtonIcon",
geometryString: "M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",
strokeWidth: 2,
stretch: wd,
geometryStretch: Dg,
visible: !1
}, "" !== b ? (new si("visible", b)).qx() : []));
a.click = function (a, d) {
if (d instanceof X) {
var c = a.diagram;
if (!(null === c || c.isReadOnly || "" !== b && c.model.isReadOnly)) {
a.handled = !0;
var f = d.$a("ButtonIcon");
c.Aa("checkbox");
f.visible = !f.visible;
"function" === typeof d._doClick && d._doClick(a,
d);
c.Za("checkbox")
}
}
};
return a
});
sl("CheckBox", function (a) {
a = tl(a);
a = nl("CheckBoxButton", a, {name: "Button", isActionable: !1, margin: new pc(0, 1, 0, 0)});
var b = nl(X, "Horizontal", a, {
isActionable: !0,
cursor: a.cursor,
margin: 1,
_buttonFillNormal: a._buttonFillNormal,
_buttonStrokeNormal: a._buttonStrokeNormal,
_buttonFillOver: a._buttonFillOver,
_buttonStrokeOver: a._buttonStrokeOver,
_buttonFillPressed: a._buttonFillPressed,
_buttonStrokePressed: a._buttonStrokePressed,
_buttonFillDisabled: a._buttonFillDisabled,
mouseEnter: a.mouseEnter,
mouseLeave: a.mouseLeave,
actionDown: a.actionDown,
actionUp: a.actionUp,
actionCancel: a.actionCancel,
actionMove: a.actionMove,
click: a.click,
_buttonClick: a.click
});
a.mouseEnter = null;
a.mouseLeave = null;
a.actionDown = null;
a.actionUp = null;
a.actionCancel = null;
a.actionMove = null;
a.click = null;
return b
});
Y.None = Bg = new D(Y, "None", 0);
Y.Default = zk = new D(Y, "Default", 0);
Y.Vertical = Bk = new D(Y, "Vertical", 4);
Y.Horizontal = Ak = new D(Y, "Horizontal", 5);
Y.Fill = wd = new D(Y, "Fill", 3);
Y.Uniform = Dg = new D(Y, "Uniform", 1);
Y.UniformToFill = Ck = new D(Y, "UniformToFill", 2);
Y.FlipVertical = Dk = new D(Y, "FlipVertical", 1);
Y.FlipHorizontal = Ek = new D(Y, "FlipHorizontal", 2);
Y.FlipBoth = Fk = new D(Y, "FlipBoth", 3);
Y.make = nl;
Y.getBuilders = function () {
var a = new vb, b;
for (b in ol) if (b !== b.toLowerCase()) {
var c = ol.J(b);
"function" === typeof c && a.add(b, c)
}
a.freeze();
return a
};
Y.defineBuilder = sl;
Y.takeBuilderArgument = tl;
function Hk() {
this.Bn = this.Ff = this.kg = this.Im = this.Lm = this.Km = this.Jm = this.Uf = this.uo = this.to = this.Wf = this.Xf = this.Zf = this.Yf = this.Vf = this.Ef = this.If = this.Df = null
}
Hk.prototype.copy = function () {
var a = new Hk;
a.Df = this.Df;
a.If = this.If;
a.Ef = this.Ef;
a.Vf = this.Vf;
a.Yf = this.Yf;
a.Zf = this.Zf;
a.Xf = this.Xf;
a.Wf = this.Wf;
a.to = this.to;
a.uo = this.uo;
a.Uf = this.Uf;
a.Jm = this.Jm;
a.Km = this.Km;
a.Lm = this.Lm;
a.Im = this.Im;
a.kg = this.kg;
a.Ff = this.Ff;
a.Bn = this.Bn;
return a
};
Hk.className = "GraphObjectEventHandlers";
function xl() {
this.Oa = [1, 0, 0, 1, 0, 0]
}
xl.prototype.copy = function () {
var a = new xl;
a.Oa[0] = this.Oa[0];
a.Oa[1] = this.Oa[1];
a.Oa[2] = this.Oa[2];
a.Oa[3] = this.Oa[3];
a.Oa[4] = this.Oa[4];
a.Oa[5] = this.Oa[5];
return a
};
xl.prototype.translate = function (a, b) {
this.Oa[4] += this.Oa[0] * a + this.Oa[2] * b;
this.Oa[5] += this.Oa[1] * a + this.Oa[3] * b
};
xl.prototype.scale = function (a, b) {
this.Oa[0] *= a;
this.Oa[1] *= a;
this.Oa[2] *= b;
this.Oa[3] *= b
};
xl.className = "STransform";
function yl(a) {
this.type = a;
this.r2 = this.y2 = this.x2 = this.r1 = this.y1 = this.x1 = 0;
this.Ww = [];
this.pattern = null
}
yl.prototype.addColorStop = function (a, b) {
this.Ww.push({offset: a, color: b})
};
yl.className = "SGradient";
function jj(a, b) {
this.ownerDocument = a = void 0 === b ? x.document : b;
this.Dz = "http://www.w3.org/2000/svg";
void 0 !== a && (this.Ga = this.ub("svg", {
width: "1px",
height: "1px",
viewBox: "0 0 1 1"
}), this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns", "http://www.w3.org/2000/svg"), this.Ga.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink"));
this.Up = null;
this.context = new zl(this)
}
jj.prototype.resize = function (a, b, c, d) {
return this.width !== a || this.height !== b ? (this.style.width = c + "px", this.style.height = d + "px", this.Ga.setAttributeNS(null, "width", c + "px"), this.Ga.setAttributeNS(null, "height", d + "px"), this.Ga.setAttributeNS(null, "viewBox", "0 0 " + c + " " + d), this.context.hu.firstElementChild.setAttributeNS(null, "width", c + "px"), this.context.hu.firstElementChild.setAttributeNS(null, "height", d + "px"), !0) : !1
};
jj.prototype.ub = function (a, b, c) {
a = this.ownerDocument.createElementNS(this.Dz, a);
if (ya(b)) for (var d in b) a.setAttributeNS("href" === d ? "http://www.w3.org/1999/xlink" : "", d, b[d]);
void 0 !== c && (a.textContent = c);
return a
};
jj.prototype.getBoundingClientRect = function () {
return this.Ga.getBoundingClientRect()
};
jj.prototype.focus = function () {
this.Ga.focus()
};
jj.prototype.ax = function () {
this.ownerDocument = null
};
ma.Object.defineProperties(jj.prototype, {
width: {
get: function () {
return this.Ga.width.baseVal.value
}, set: function (a) {
this.Ga.width = a
}
}, height: {
get: function () {
return this.Ga.height.baseVal.value
}, set: function (a) {
this.Ga.height = a
}
}, style: {
get: function () {
return this.Ga.style
}
}
});
jj.className = "SVGSurface";
function zl(a) {
this.uk = a;
this.svg = a.Ga;
this.stack = [];
this.wc = [];
this.fillStyle = "#000000";
this.font = "10px sans-serif";
this.globalAlpha = 1;
this.lineCap = "butt";
this.lineDashOffset = 0;
this.lineJoin = "miter";
this.lineWidth = 1;
this.miterLimit = 10;
this.shadowBlur = 0;
this.shadowColor = "rgba(0, 0, 0, 0)";
this.shadowOffsetY = this.shadowOffsetX = 0;
this.strokeStyle = "#000000";
this.textAlign = "start";
this.clipInsteadOfFill = !1;
this.Od = this.qp = this.pp = 0;
this.fq = null;
this.path = [];
this.cu = !1;
this.hh = null;
this.ih = 0;
this.Sd = new xl;
Al(this, 1, 0, 0, 1, 0, 0);
var b = qb++, c = this.ub("clipPath", {id: "mainClip" + b});
c.appendChild(this.ub("rect", {x: 0, y: 0, width: a.width, height: a.height}));
this.hu = c;
this.uk.Ga.appendChild(c);
this.wc[0].setAttributeNS(null, "clip-path", "url(#mainClip" + b + ")");
this.Fz = {}
}
t = zl.prototype;
t.reset = function () {
this.stack = [];
this.wc = [];
this.fillStyle = "#000000";
this.font = "10px sans-serif";
this.globalAlpha = 1;
this.lineCap = "butt";
this.lineDashOffset = 0;
this.lineJoin = "miter";
this.lineWidth = 1;
this.miterLimit = 10;
this.shadowBlur = 0;
this.shadowColor = "rgba(0, 0, 0, 0)";
this.shadowOffsetY = this.shadowOffsetX = 0;
this.strokeStyle = "#000000";
this.textAlign = "start";
this.clipInsteadOfFill = !1;
this.Od = this.qp = this.pp = 0;
this.fq = null;
this.path = [];
this.Sd = new xl;
Al(this, 1, 0, 0, 1, 0, 0);
var a = qb++, b = this.ub("clipPath",
{id: "mainClip" + a});
b.appendChild(this.ub("rect", {x: 0, y: 0, width: this.uk.width, height: this.uk.height}));
this.hu = b;
this.uk.Ga.appendChild(b);
this.wc[0].setAttributeNS(null, "clip-path", "url(#mainClip" + a + ")")
};
t.arc = function (a, b, c, d, e, f, g, h) {
var k = 2 * Math.PI, l = k - 1E-6, m = c * Math.cos(d), n = c * Math.sin(d), p = a + m, r = b + n,
q = f ? 0 : 1;
d = f ? d - e : e - d;
(1E-6 < Math.abs(g - p) || 1E-6 < Math.abs(h - r)) && this.path.push(["L", p, +r]);
0 > d && (d = d % k + k);
d > l ? (this.path.push(["A", c, c, 0, 1, q, a - m, b - n]), this.path.push(["A", c, c, 0, 1, q, p, r])) : 1E-6 < d && this.path.push(["A", c, c, 0, +(d >= Math.PI), q, a + c * Math.cos(e), b + c * Math.sin(e)])
};
t.beginPath = function () {
this.path = []
};
t.bezierCurveTo = function (a, b, c, d, e, f) {
this.path.push(["C", a, b, c, d, e, f])
};
t.clearRect = function () {
};
t.clip = function () {
this.addPath("clipPath", this.path, this.Sd);
this.addPath("clipPath", this.path, new xl)
};
t.closePath = function () {
this.path.push(["z"])
};
t.createLinearGradient = function (a, b, c, d) {
var e = new yl("linear");
e.x1 = a;
e.y1 = b;
e.x2 = c;
e.y2 = d;
return e
};
t.createPattern = function (a) {
var b = "";
a instanceof HTMLCanvasElement && (b = a.toDataURL());
a instanceof HTMLImageElement && (b = a.getAttribute("src"));
var c = this.Fz;
if (c[b]) return "url(#" + c[b] + ")";
var d = "PATTERN" + qb++, e = {x: 0, y: 0, width: a.width, height: a.height, href: b};
a = this.ub("pattern", {width: a.width, height: a.height, id: d, patternUnits: "userSpaceOnUse"});
a.appendChild(this.ub("image", e));
this.svg.appendChild(a);
c[b] = d;
return "url(#" + d + ")"
};
t.createRadialGradient = function (a, b, c, d, e, f) {
var g = new yl("radial");
g.x1 = a;
g.y1 = b;
g.r1 = c;
g.x2 = d;
g.y2 = e;
g.r2 = f;
return g
};
t.drawImage = function (a, b, c, d, e, f, g, h, k) {
var l = "";
a instanceof HTMLCanvasElement && (l = a.toDataURL());
a instanceof HTMLImageElement && (l = a.getAttribute("src"));
var m = a instanceof HTMLImageElement ? a.naturalWidth : a.width,
n = a instanceof HTMLImageElement ? a.naturalHeight : a.height;
void 0 === d && (f = b, g = c, h = d = m, k = e = n);
d = d || 0;
e = e || 0;
f = f || 0;
g = g || 0;
h = h || 0;
k = k || 0;
l = {x: 0, y: 0, width: m || d, height: n || e, href: l, preserveAspectRatio: "xMidYMid slice"};
H.ca(d, h) && H.ca(e, k) || (l.preserveAspectRatio = "none");
a = "";
h /= d;
k /= e;
if (0 !==
f || 0 !== g) a += " translate(" + f + ", " + g + ")";
if (1 !== h || 1 !== k) a += " scale(" + h + ", " + k + ")";
if (0 !== b || 0 !== c) a += " translate(" + -b + ", " + -c + ")";
if (0 !== b || 0 !== c || d !== m || e !== n) f = "CLIP" + qb++, g = this.ub("clipPath", {id: f}), g.appendChild(this.ub("rect", {
x: b,
y: c,
width: d,
height: e
})), this.svg.appendChild(g), l["clip-path"] = "url(#" + f + ")";
Bl(this, "image", l, this.Sd, a);
this.addElement("image", l)
};
t.fill = function () {
this.addPath("fill", this.path, this.Sd)
};
t.Td = function () {
this.clipInsteadOfFill ? this.clip() : this.fill()
};
t.fillRect = function (a, b, c, d) {
a = [a, b, c, d];
a = {x: a[0], y: a[1], width: a[2], height: a[3]};
Bl(this, "fill", a, this.Sd);
this.addElement("rect", a)
};
t.fillText = function (a, b, c) {
a = [a, b, c];
b = this.textAlign;
"left" === b ? b = "start" : "right" === b ? b = "end" : "center" === b && (b = "middle");
b = {x: a[1], y: a[2], style: "font: " + this.font, "text-anchor": b};
Bl(this, "fill", b, this.Sd);
this.addElement("text", b, a[0])
};
t.lineTo = function (a, b) {
this.path.push(["L", a, b])
};
t.moveTo = function (a, b) {
this.path.push(["M", a, b])
};
t.quadraticCurveTo = function (a, b, c, d) {
this.path.push(["Q", a, b, c, d])
};
t.rect = function (a, b, c, d) {
this.path.push(["M", a, b], ["L", a + c, b], ["L", a + c, b + d], ["L", a, b + d], ["z"])
};
t.restore = function () {
this.Sd = this.stack.pop();
this.path = this.stack.pop();
var a = this.stack.pop();
this.fillStyle = a.fillStyle;
this.font = a.font;
this.globalAlpha = a.globalAlpha;
this.lineCap = a.lineCap;
this.lineDashOffset = a.lineDashOffset;
this.lineJoin = a.lineJoin;
this.lineWidth = a.lineWidth;
this.miterLimit = a.miterLimit;
this.shadowBlur = a.shadowBlur;
this.shadowColor = a.shadowColor;
this.shadowOffsetX = a.shadowOffsetX;
this.shadowOffsetY = a.shadowOffsetY;
this.strokeStyle = a.strokeStyle;
this.textAlign = a.textAlign
};
t.save = function () {
this.stack.push({
fillStyle: this.fillStyle,
font: this.font,
globalAlpha: this.globalAlpha,
lineCap: this.lineCap,
lineDashOffset: this.lineDashOffset,
lineJoin: this.lineJoin,
lineWidth: this.lineWidth,
miterLimit: this.miterLimit,
shadowBlur: this.shadowBlur,
shadowColor: this.shadowColor,
shadowOffsetX: this.shadowOffsetX,
shadowOffsetY: this.shadowOffsetY,
strokeStyle: this.strokeStyle,
textAlign: this.textAlign
});
for (var a = [], b = 0; b < this.path.length; b++) a.push(this.path[b]);
this.stack.push(a);
this.stack.push(this.Sd.copy())
};
t.setTransform = function (a, b, c, d, e, f) {
1 === a && 0 === b && 0 === c && 1 === d && 0 === e && 0 === f || Al(this, a, b, c, d, e, f)
};
t.scale = function (a, b) {
this.Sd.scale(a, b)
};
t.translate = function (a, b) {
this.Sd.translate(a, b)
};
t.transform = function () {
};
t.stroke = function () {
this.addPath("stroke", this.path, this.Sd)
};
t.Yi = function () {
this.clipInsteadOfFill || this.stroke()
};
t.ub = function (a, b, c) {
return this.uk.ub(a, b, c)
};
t.addElement = function (a, b, c) {
a = this.ub(a, b, c);
0 < this.wc.length ? this.wc[this.wc.length - 1].appendChild(a) : this.svg.appendChild(a);
return this.fq = a
};
function Bl(a, b, c, d, e) {
1 !== a.globalAlpha && (c.opacity = a.globalAlpha);
"fill" === b ? (a.fillStyle instanceof yl ? c.fill = Cl(a, a.fillStyle) : (/^rgba\(/.test(a.fillStyle) && (b = /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle), c.fill = "rgb(" + b[1] + "," + b[2] + "," + b[3] + ")", c["fill-opacity"] = b[4]), c.fill = a.fillStyle), c.stroke = "none") : "stroke" === b && (c.fill = "none", a.strokeStyle instanceof yl ? c.stroke = Cl(a, a.strokeStyle) : (/^rgba\(/.test(a.strokeStyle) && (b = /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke = "rgb(" + b[1] + "," + b[2] + "," + b[3] + ")", c["stroke-opacity"] = b[4]), c.stroke = a.strokeStyle), c["stroke-width"] = a.lineWidth, c["stroke-linecap"] = a.lineCap, c["stroke-linejoin"] = a.lineJoin, c["stroke-miterlimit"] = a.miterLimit);
a = d.Oa;
a = "matrix(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ")";
void 0 !== e && (a += e);
c.transform = a
}
function Cl(a, b) {
var c = "GRAD" + qb++;
if ("linear" === b.type) var d = a.ub("linearGradient", {
x1: b.x1,
x2: b.x2,
y1: b.y1,
y2: b.y2,
id: c,
gradientUnits: "userSpaceOnUse"
}); else if ("radial" === b.type) d = a.ub("radialGradient", {
x1: b.x1,
x2: b.x2,
y1: b.y1,
y2: b.y2,
r1: b.r1,
r2: b.r2,
id: c
}); else throw Error("invalid gradient");
var e = b.Ww;
b = e.length;
for (var f = [], g = 0; g < b; g++) {
var h = e[g], k = h.color;
h = {offset: h.offset, "stop-color": k};
/^rgba\(/.test(k) && (k = /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),
h["stop-color"] = "rgb(" + k[1] + "," + k[2] + "," + k[3] + ")", h["stop-opacity"] = k[4]);
f.push(h)
}
f.sort(function (a, b) {
return a.offset > b.offset ? 1 : -1
});
for (e = 0; e < b; e++) d.appendChild(a.ub("stop", f[e]));
a.svg.appendChild(d);
return "url(#" + c + ")"
}
t.addPath = function (a, b, c) {
for (var d = [], e = 0; e < b.length; e++) {
var f = Aa(b[e]), g = [f.shift()];
if ("A" === g[0]) g.push(f.shift() + "," + f.shift(), f.shift(), f.shift() + "," + f.shift(), f.shift() + "," + f.shift()); else for (; f.length;) g.push(f.shift() + "," + f.shift());
d.push(g.join(" "))
}
b = {d: d.join(" ")};
"stroke" === a && this.cu && (b["stroke-dasharray"] = this.hh.toString(), b["stroke-dashoffset"] = this.ih);
Bl(this, a, b, c);
"clipPath" === a ? (a = "CLIP" + qb++, c = this.ub("clipPath", {id: a}), c.appendChild(this.ub("path", b)), this.svg.appendChild(c),
0 < this.wc.length && this.wc[this.wc.length - 1].setAttributeNS(null, "clip-path", "url(#" + a + ")")) : this.addElement("path", b)
};
function Al(a, b, c, d, e, f, g) {
var h = new xl;
h.Oa = [b, c, d, e, f, g];
b = {};
Bl(a, "g", b, h);
h = a.addElement("g", b);
a.wc.push(h)
}
t.uq = function () {
if (0 !== this.shadowOffsetX || 0 !== this.shadowOffsetY || 0 !== this.shadowBlur) {
var a = "SHADOW" + qb++,
b = this.addElement("filter", {id: a, x: "-100%", y: "-100%", width: "300%", height: "300%"}, null);
var c = this.ub("feGaussianBlur", {"in": "SourceAlpha", result: "blur", iA: this.shadowBlur / 2});
var d = this.ub("feFlood", {"in": "blur", result: "flood", "flood-color": this.shadowColor});
var e = this.ub("feComposite", {"in": "flood", in2: "blur", operator: "in", result: "comp"});
var f = this.ub("feOffset", {
"in": "comp", result: "offsetBlur",
dx: this.shadowOffsetX, dy: this.shadowOffsetY
});
var g = this.ub("feMerge", {});
g.appendChild(this.ub("feMergeNode", {"in": "offsetBlur"}));
g.appendChild(this.ub("feMergeNode", {"in": "SourceGraphic"}));
b.appendChild(c);
b.appendChild(d);
b.appendChild(e);
b.appendChild(f);
b.appendChild(g);
0 < this.wc.length && this.wc[this.wc.length - 1].setAttributeNS(null, "filter", "url(#" + a + ")")
}
};
t.Pv = function (a, b, c) {
this.pp = a;
this.qp = b;
this.Od = c
};
function Xk(a) {
a.shadowOffsetX = 0;
a.shadowOffsetY = 0;
a.shadowBlur = 0
}
function Wk(a) {
a.shadowOffsetX = a.pp;
a.shadowOffsetY = a.qp;
a.shadowBlur = a.Od
}
t.Ps = function (a, b) {
this.cu = !0;
this.hh = a;
this.ih = b
};
t.Ns = function () {
this.cu = !1
};
t.Rc = function () {
};
t.Fx = function () {
};
zl.prototype.rotate = function () {
};
zl.prototype.getImageData = function () {
return null
};
zl.prototype.measureText = function () {
return null
};
zl.className = "SVGContext";
P.prototype.it = function (a) {
var b = new jj(this, x.document);
void 0 === a && (a = new db);
var c = this;
return gk(this, function (a, e) {
a = hk(c, a, "SVG", b);
a = null !== a ? a.svg : null;
return "function" === typeof e ? (e(a), null) : a
}, a)
};
P.prototype.makeSvg = P.prototype.it;
P.prototype.ov = function (a) {
return this.it(a)
};
P.prototype.makeSVG = P.prototype.ov;
Y.prototype.bx = function (a, b) {
if (!(a instanceof zl)) return !1;
if (!this.visible) return !0;
var c = null, d = a.fq;
if (this instanceof X && (this.type === X.TableRow || this.type === X.TableColumn)) return Uk(this, a, b), !0;
var e = this.vb;
if (0 === e.width || 0 === e.height || isNaN(e.x) || isNaN(e.y)) return !0;
var f = this.transform, g = this.panel;
0 !== (this.H & 4096) === !0 && Vk(this);
var h = 0 !== (this.H & 256), k = !1;
this instanceof Yg && (a.font = this.font);
if (h) {
k = g.Zd() ? g.naturalBounds : g.actualBounds;
if (null !== this.kd) {
var l = this.kd;
var m = l.x;
var n =
l.y;
var p = l.width;
l = l.height
} else m = Math.max(e.x, k.x), n = Math.max(e.y, k.y), p = Math.min(e.right, k.right) - m, l = Math.min(e.bottom, k.bottom) - n;
if (m > e.width + e.x || e.x > k.width + k.x || n > e.height + e.y || e.y > k.height + k.y) return !0;
k = !0;
Al(a, 1, 0, 0, 1, 0, 0);
a.save();
a.beginPath();
a.rect(m, n, p, l);
a.clip()
}
if (this.wg() && !this.isVisible()) return !0;
a.Sd.Oa = [1, 0, 0, 1, 0, 0];
(this instanceof Yg && 1 < this.lineCount || this instanceof W && 1 < this.geometry.figures.length) && Al(a, 1, 0, 0, 1, 0, 0);
m = !1;
this.wg() && this.isShadowed && b.Ee("drawShadows") &&
(n = this.vi, a.Pv(n.x * b.scale * b.Mb, n.y * b.scale * b.Mb, this.Od), Wk(a), a.shadowColor = this.Kj);
n = !1;
this.part && b.Ee("drawShadows") && (n = this.part.isShadowed);
!0 === this.shadowVisible ? (Wk(a), !1 === m && n && (Al(a, 1, 0, 0, 1, 0, 0), a.uq(), m = !0)) : !1 === this.shadowVisible && Xk(a);
p = this.naturalBounds;
null !== this.areaBackground && (Sh(this, a, this.areaBackground, !0, !0, p, e), !1 === m && n && (Al(a, 1, 0, 0, 1, 0, 0), a.uq(), m = !0), this.areaBackground instanceof Yk && this.areaBackground.type === Zk ? (a.beginPath(), a.rect(e.x, e.y, e.width, e.height),
a.Td(this.areaBackground)) : a.fillRect(e.x, e.y, e.width, e.height));
this instanceof X ? Al(a, f.m11, f.m12, f.m21, f.m22, f.dx, f.dy) : a.Sd.Oa = [f.m11, f.m12, f.m21, f.m22, f.dx, f.dy];
if (null !== this.background) {
!1 === m && n && (Al(a, 1, 0, 0, 1, 0, 0), a.uq(), m = !0);
var r = this.naturalBounds;
l = f = 0;
var q = r.width;
r = r.height;
var u = 0;
this instanceof W && (r = this.geometry.bounds, f = r.x, l = r.y, q = r.width, r = r.height, u = this.strokeWidth);
Sh(this, a, this.background, !0, !1, p, e);
this.background instanceof Yk && this.background.type === Zk ? (a.beginPath(),
a.rect(f - u / 2, l - u / 2, q + u, r + u), a.Td(this.background)) : a.fillRect(f - u / 2, l - u / 2, q + u, r + u)
}
n && (null !== this.background || null !== this.areaBackground || null !== g && 0 !== (g.H & 512) || null !== g && (g.type === X.Auto || g.type === X.Spot) && g.zb() !== this) ? ($k(this, !0), null === this.shadowVisible && Xk(a)) : $k(this, !1);
this.Fi(a, b);
n && 0 !== (this.H & 512) === !0 && Wk(a);
this.wg() && n && Xk(a);
h && (a.restore(), k && a.wc.pop());
this instanceof X && (c = a.wc.pop());
!0 === m && a.wc.pop();
if (this instanceof Yg && 1 < this.lineCount || this instanceof W && 1 < this.geometry.figures.length) c =
a.wc.pop();
null !== a.uk.Up && (null === c && (d === a.fq ? (Al(a, 1, 0, 0, 1, 0, 0), c = a.wc.pop()) : c = a.fq), a.uk.Up(this, c));
this.svg = c;
return !0
};
function ik(a, b) {
this.ownerDocument = b = void 0 === b ? x.document : b;
this.Up = null;
b = b.createElement("canvas");
b.tabIndex = 0;
this.Ga = b;
this.Ga.innerHTML = "This text is displayed if your browser does not support the Canvas HTML element.";
this.context = new bl(b);
b.C = a
}
ik.prototype.resize = function (a, b, c, d) {
return this.width !== a || this.height !== b ? (this.width = a, this.height = b, this.style.width = c + "px", this.style.height = d + "px", !0) : !1
};
ik.prototype.toDataURL = function (a, b) {
return this.Ga.toDataURL(a, b)
};
ik.prototype.getBoundingClientRect = function () {
return this.Ga.getBoundingClientRect()
};
ik.prototype.focus = function () {
this.Ga.focus()
};
ik.prototype.ax = function () {
this.ownerDocument = this.Ga.C = null
};
ma.Object.defineProperties(ik.prototype, {
width: {
get: function () {
return this.Ga.width
}, set: function (a) {
this.Ga.width = a
}
}, height: {
get: function () {
return this.Ga.height
}, set: function (a) {
this.Ga.height = a
}
}, style: {
get: function () {
return this.Ga.style
}
}
});
ik.className = "CanvasSurface";
function bl(a) {
a.getContext && a.getContext("2d") || B("Browser does not support HTML Canvas Element");
this.W = a.getContext("2d");
this.It = this.Kt = this.Jt = "";
this.Ym = !1;
this.Od = this.qp = this.pp = 0
}
t = bl.prototype;
t.Fx = function (a) {
this.W.imageSmoothingEnabled = a
};
t.arc = function (a, b, c, d, e, f) {
this.W.arc(a, b, c, d, e, f)
};
t.beginPath = function () {
this.W.beginPath()
};
t.bezierCurveTo = function (a, b, c, d, e, f) {
this.W.bezierCurveTo(a, b, c, d, e, f)
};
t.clearRect = function (a, b, c, d) {
this.W.clearRect(a, b, c, d)
};
t.clip = function () {
this.W.clip()
};
t.closePath = function () {
this.W.closePath()
};
t.createLinearGradient = function (a, b, c, d) {
return this.W.createLinearGradient(a, b, c, d)
};
t.createPattern = function (a, b) {
return this.W.createPattern(a, b)
};
t.createRadialGradient = function (a, b, c, d, e, f) {
return this.W.createRadialGradient(a, b, c, d, e, f)
};
t.drawImage = function (a, b, c, d, e, f, g, h, k) {
void 0 === d ? this.W.drawImage(a, b, c) : this.W.drawImage(a, b, c, d, e, f, g, h, k)
};
t.fill = function () {
this.W.fill()
};
t.fillRect = function (a, b, c, d) {
this.W.fillRect(a, b, c, d)
};
t.fillText = function (a, b, c) {
this.W.fillText(a, b, c)
};
t.getImageData = function (a, b, c, d) {
return this.W.getImageData(a, b, c, d)
};
t.lineTo = function (a, b) {
this.W.lineTo(a, b)
};
t.measureText = function (a) {
return this.W.measureText(a)
};
t.moveTo = function (a, b) {
this.W.moveTo(a, b)
};
t.quadraticCurveTo = function (a, b, c, d) {
this.W.quadraticCurveTo(a, b, c, d)
};
t.rect = function (a, b, c, d) {
this.W.rect(a, b, c, d)
};
t.restore = function () {
this.W.restore()
};
bl.prototype.rotate = function (a) {
this.W.rotate(a)
};
t = bl.prototype;
t.save = function () {
this.W.save()
};
t.setTransform = function (a, b, c, d, e, f) {
this.W.setTransform(a, b, c, d, e, f)
};
t.scale = function (a, b) {
this.W.scale(a, b)
};
t.stroke = function () {
this.W.stroke()
};
t.transform = function (a, b, c, d, e, f) {
1 === a && 0 === b && 0 === c && 1 === d && 0 === e && 0 === f || this.W.transform(a, b, c, d, e, f)
};
t.translate = function (a, b) {
this.W.translate(a, b)
};
t.Td = function (a) {
if (a instanceof Yk && a.type === Zk) {
var b = a.Ik;
a = a.Lt;
a > b ? (this.scale(b / a, 1), this.translate((a - b) / 2, 0)) : b > a && (this.scale(1, a / b), this.translate(0, (b - a) / 2));
this.Ym ? this.clip() : this.fill();
a > b ? (this.translate(-(a - b) / 2, 0), this.scale(1 / (b / a), 1)) : b > a && (this.translate(0, -(b - a) / 2), this.scale(1, 1 / (a / b)))
} else this.Ym ? this.clip() : this.fill()
};
t.Yi = function () {
this.Ym || this.stroke()
};
t.Pv = function (a, b, c) {
this.pp = a;
this.qp = b;
this.Od = c
};
t.Ps = function (a, b) {
var c = this.W;
void 0 !== c.setLineDash && (c.setLineDash(a), c.lineDashOffset = b)
};
t.Ns = function () {
var a = this.W;
void 0 !== a.setLineDash && (a.setLineDash(Dl), a.lineDashOffset = 0)
};
t.Rc = function (a) {
a && (this.Jt = "");
this.It = this.Kt = ""
};
ma.Object.defineProperties(bl.prototype, {
fillStyle: {
get: function () {
return this.W.fillStyle
}, set: function (a) {
this.It !== a && (this.It = this.W.fillStyle = a)
}
}, font: {
get: function () {
return this.W.font
}, set: function (a) {
this.Jt !== a && (this.Jt = this.W.font = a)
}
}, globalAlpha: {
get: function () {
return this.W.globalAlpha
}, set: function (a) {
this.W.globalAlpha = a
}
}, lineCap: {
get: function () {
return this.W.lineCap
},
set: function (a) {
this.W.lineCap = a
}
}, lineDashOffset: {
get: function () {
return this.W.lineDashOffset
}, set: function (a) {
this.W.lineDashOffset = a
}
}, lineJoin: {
get: function () {
return this.W.lineJoin
}, set: function (a) {
this.W.lineJoin = a
}
}, lineWidth: {
get: function () {
return this.W.lineWidth
}, set: function (a) {
this.W.lineWidth = a
}
}, miterLimit: {
get: function () {
return this.W.miterLimit
}, set: function (a) {
this.W.miterLimit =
a
}
}, shadowBlur: {
get: function () {
return this.W.shadowBlur
}, set: function (a) {
this.W.shadowBlur = a
}
}, shadowColor: {
get: function () {
return this.W.shadowColor
}, set: function (a) {
this.W.shadowColor = a
}
}, shadowOffsetX: {
get: function () {
return this.W.shadowOffsetX
}, set: function (a) {
this.W.shadowOffsetX = a
}
}, shadowOffsetY: {
get: function () {
return this.W.shadowOffsetY
}, set: function (a) {
this.W.shadowOffsetY =
a
}
}, strokeStyle: {
get: function () {
return this.W.strokeStyle
}, set: function (a) {
this.Kt !== a && (this.Kt = this.W.strokeStyle = a)
}
}, textAlign: {
get: function () {
return this.W.textAlign
}, set: function (a) {
this.W.textAlign = a
}
}, imageSmoothingEnabled: {
get: function () {
return this.W.imageSmoothingEnabled
}, set: function (a) {
this.W.imageSmoothingEnabled = a
}
}, clipInsteadOfFill: {
get: function () {
return this.Ym
},
set: function (a) {
this.Ym = a
}
}
});
var Dl = Object.freeze([]);
bl.className = "CanvasSurfaceContext";
function El() {
this.ba = this.u = this.K = this.l = 0
}
El.className = "ColorNumbers";
function Yk(a) {
Fl || (Gl(), Fl = !0);
ab(this);
this.v = !1;
void 0 === a ? (this.va = al, this.Hk = "black") : "string" === typeof a ? (this.va = al, this.Hk = a) : (this.va = a, this.Hk = "black");
a = this.va;
a === dl ? (this.Hl = Ac, this.Vk = Ic) : this.Vk = a === Zk ? this.Hl = Fc : this.Hl = yc;
this.zs = 0;
this.lr = NaN;
this.de = this.hs = this.ce = null;
this.Lt = this.Ik = 0
}
Yk.prototype.copy = function () {
var a = new Yk;
a.va = this.va;
a.Hk = this.Hk;
a.Hl = this.Hl.I();
a.Vk = this.Vk.I();
a.zs = this.zs;
a.lr = this.lr;
null !== this.ce && (a.ce = this.ce.copy());
a.hs = this.hs;
return a
};
t = Yk.prototype;
t.freeze = function () {
this.v = !0;
null !== this.ce && this.ce.freeze();
return this
};
t.ha = function () {
Object.isFrozen(this) && B("cannot thaw constant: " + this);
this.v = !1;
null !== this.ce && this.ce.ha();
return this
};
t.fb = function (a) {
a.classType === Yk && (this.type = a)
};
t.toString = function () {
var a = "Brush(";
if (this.type === al) a += this.color; else if (a = this.type === dl ? a + "Linear " : this.type === Zk ? a + "Radial " : this.type === cl ? a + "Pattern " : a + "(unknown) ", a += this.start + " " + this.end, null !== this.colorStops) for (var b = this.colorStops.iterator; b.next();) a += " " + b.key + ":" + b.value;
return a + ")"
};
t.addColorStop = function (a, b) {
this.v && ua(this);
("number" !== typeof a || !isFinite(a) || 1 < a || 0 > a) && va(a, "0 <= loc <= 1", Yk, "addColorStop:loc");
null === this.ce && (this.ce = new vb);
this.ce.add(a, b);
this.va === al && (this.type = dl);
this.de = null;
return this
};
t.xz = function (a, b) {
this.v && ua(this);
a = void 0 === a || "number" !== typeof a ? .2 : a;
b = void 0 === b ? Hl : b;
if (this.type === al) Il(this.color), this.color = Jl(a, b); else if ((this.type === dl || this.type === Zk) && null !== this.colorStops) for (var c = this.colorStops.iterator; c.next();) Il(c.value), this.addColorStop(c.key, Jl(a, b));
return this
};
function Kl(a, b, c) {
b = void 0 === b || "number" !== typeof b ? .2 : b;
c = void 0 === c ? Hl : c;
Il(a);
return Jl(b, c)
}
t.wy = function (a, b) {
this.v && ua(this);
a = void 0 === a || "number" !== typeof a ? .2 : a;
b = void 0 === b ? Hl : b;
if (this.type === al) Il(this.color), this.color = Jl(-a, b); else if ((this.type === dl || this.type === Zk) && null !== this.colorStops) for (var c = this.colorStops.iterator; c.next();) Il(c.value), this.addColorStop(c.key, Jl(-a, b));
return this
};
function Ll(a, b, c) {
b = void 0 === b || "number" !== typeof b ? .2 : b;
c = void 0 === c ? Hl : c;
Il(a);
return Jl(-b, c)
}
function Ml(a, b, c) {
Il(a);
a = Nl.l;
var d = Nl.K, e = Nl.u, f = Nl.ba;
Il(b);
void 0 === c && (c = .5);
return "rgba(" + Math.round((Nl.l - a) * c + a) + ", " + Math.round((Nl.K - d) * c + d) + ", " + Math.round((Nl.u - e) * c + e) + ", " + Math.round((Nl.ba - f) * c + f) + ")"
}
t.nx = function () {
if (this.type === al) return Ol(this.color);
if ((this.type === dl || this.type === Zk) && null !== this.colorStops) {
var a = this.colorStops;
if (this.type === Zk) return Ol(a.first().value);
if (null !== a.get(.5)) return Ol(a.get(.5));
if (2 === a.count) return a = a.Na(), Ol(Ml(a[0].value, a[1].value));
for (var b = a.iterator, c = -1, d = -1, e = 1, f = 1; b.next();) {
var g = b.key, h = Math.abs(.5 - b.key);
e > f && h < e ? (c = g, e = h) : f >= e && h < f && (d = g, f = h)
}
c > d && (c = [d, d = c][0]);
b = d - c;
return Ol(Ml(a.get(c), a.get(d), 1 - e / b))
}
return !1
};
function Ol(a) {
if (null === a) return null;
if (a instanceof Yk) return a.nx();
Il(a);
return 128 > (299 * Nl.l + 587 * Nl.K + 114 * Nl.u) / 1E3
}
function Jl(a, b) {
switch (b) {
case Hl:
var c = 100 * Pl(Nl.l);
b = 100 * Pl(Nl.K);
var d = 100 * Pl(Nl.u);
Ql.l = .4124564 * c + .3575761 * b + .1804375 * d;
Ql.K = .2126729 * c + .7151522 * b + .072175 * d;
Ql.u = .0193339 * c + .119192 * b + .9503041 * d;
Ql.ba = Nl.ba;
c = Rl(Ql.l / Sl[0]);
b = Rl(Ql.K / Sl[1]);
d = Rl(Ql.u / Sl[2]);
Tl.l = 116 * b - 16;
Tl.K = 500 * (c - b);
Tl.u = 200 * (b - d);
Tl.ba = Ql.ba;
Tl.l = Math.min(100, Math.max(0, Tl.l + 100 * a));
a = (Tl.l + 16) / 116;
c = a - Tl.u / 200;
Ql.l = Sl[0] * Ul(Tl.K / 500 + a);
Ql.K = Sl[1] * (Tl.l > Vl * Wl ? Math.pow(a, 3) : Tl.l / Vl);
Ql.u = Sl[2] * Ul(c);
Ql.ba = Tl.ba;
a = -.969266 *
Ql.l + 1.8760108 * Ql.K + .041556 * Ql.u;
c = .0556434 * Ql.l + -.2040259 * Ql.K + 1.0572252 * Ql.u;
Nl.l = 255 * Xl((3.2404542 * Ql.l + -1.5371385 * Ql.K + -.4985314 * Ql.u) / 100);
Nl.K = 255 * Xl(a / 100);
Nl.u = 255 * Xl(c / 100);
Nl.ba = Ql.ba;
Nl.l = Math.round(Nl.l);
255 < Nl.l ? Nl.l = 255 : 0 > Nl.l && (Nl.l = 0);
Nl.K = Math.round(Nl.K);
255 < Nl.K ? Nl.K = 255 : 0 > Nl.K && (Nl.K = 0);
Nl.u = Math.round(Nl.u);
255 < Nl.u ? Nl.u = 255 : 0 > Nl.u && (Nl.u = 0);
return "rgba(" + Nl.l + ", " + Nl.K + ", " + Nl.u + ", " + Nl.ba + ")";
case Yl:
b = Nl.l / 255;
d = Nl.K / 255;
var e = Nl.u / 255, f = Math.max(b, d, e), g = Math.min(b, d, e), h =
f - g;
g = (f + g) / 2;
if (0 === h) c = b = 0; else {
switch (f) {
case b:
c = (d - e) / h % 6;
break;
case d:
c = (e - b) / h + 2;
break;
case e:
c = (b - d) / h + 4
}
c *= 60;
0 > c && (c += 360);
b = h / (1 - Math.abs(2 * g - 1))
}
Zl.l = Math.round(c);
Zl.K = Math.round(100 * b);
Zl.u = Math.round(100 * g);
Zl.ba = Nl.ba;
Zl.u = Math.min(100, Math.max(0, Zl.u + 100 * a));
return "hsla(" + Zl.l + ", " + Zl.K + "%, " + Zl.u + "%, " + Zl.ba + ")";
default:
return B("Unknown color space: " + b), "rgba(0, 0, 0, 1)"
}
}
function Il(a) {
Fl || (Gl(), Fl = !0);
var b = $l;
if (null !== b) {
b.clearRect(0, 0, 1, 1);
b.fillStyle = "#000000";
var c = b.fillStyle;
b.fillStyle = a;
b.fillStyle !== c ? (b.fillRect(0, 0, 1, 1), a = b.getImageData(0, 0, 1, 1).data, Nl.l = a[0], Nl.K = a[1], Nl.u = a[2], Nl.ba = a[3] / 255) : (b.fillStyle = "#FFFFFF", b.fillStyle = a, Nl.l = 0, Nl.K = 0, Nl.u = 0, Nl.ba = 1)
}
}
function Pl(a) {
a /= 255;
return .04045 >= a ? a / 12.92 : Math.pow((a + .055) / 1.055, 2.4)
}
function Xl(a) {
return .0031308 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - .055
}
function Rl(a) {
return a > Wl ? Math.pow(a, 1 / 3) : (Vl * a + 16) / 116
}
function Ul(a) {
var b = a * a * a;
return b > Wl ? b : (116 * a - 16) / Vl
}
function ul(a, b) {
"string" !== typeof a && (a instanceof Yk || B("Value for " + b + " must be a color string or a Brush, not " + a))
}
function Gl() {
$l = Wg ? (new ik(null)).context : null
}
ma.Object.defineProperties(Yk.prototype, {
type: {
get: function () {
return this.va
}, set: function (a) {
this.v && ua(this, a);
this.va = a;
this.start.jc() && (a === dl ? this.start = Ac : a === Zk && (this.start = Fc));
this.end.jc() && (a === dl ? this.end = Ic : a === Zk && (this.end = Fc));
this.de = null
}
}, color: {
get: function () {
return this.Hk
}, set: function (a) {
this.v && ua(this, a);
this.Hk = a;
this.de = null
}
}, start: {
get: function () {
return this.Hl
}, set: function (a) {
this.v &&
ua(this, a);
this.Hl = a.I();
this.de = null
}
}, end: {
get: function () {
return this.Vk
}, set: function (a) {
this.v && ua(this, a);
this.Vk = a.I();
this.de = null
}
}, startRadius: {
get: function () {
return this.zs
}, set: function (a) {
this.v && ua(this, a);
0 > a && va(a, ">= zero", Yk, "startRadius");
this.zs = a;
this.de = null
}
}, endRadius: {
get: function () {
return this.lr
}, set: function (a) {
this.v && ua(this, a);
0 > a && va(a, ">= zero", Yk, "endRadius");
this.lr = a;
this.de =
null
}
}, colorStops: {
get: function () {
return this.ce
}, set: function (a) {
this.v && ua(this, a);
this.ce = a;
this.de = null
}
}, pattern: {
get: function () {
return this.hs
}, set: function (a) {
this.v && ua(this, a);
this.hs = a;
this.de = null
}
}
});
Yk.prototype.isDark = Yk.prototype.nx;
Yk.prototype.darkenBy = Yk.prototype.wy;
Yk.prototype.lightenBy = Yk.prototype.xz;
Yk.prototype.addColorStop = Yk.prototype.addColorStop;
var Wl = 216 / 24389, Vl = 24389 / 27, Sl = [95.047, 100, 108.883], $l = null, Nl = new El, Zl = new El,
Ql = new El, Tl = new El, Fl = !1;
Yk.className = "Brush";
var al;
Yk.Solid = al = new D(Yk, "Solid", 0);
var dl;
Yk.Linear = dl = new D(Yk, "Linear", 1);
var Zk;
Yk.Radial = Zk = new D(Yk, "Radial", 2);
var cl;
Yk.Pattern = cl = new D(Yk, "Pattern", 4);
var Hl;
Yk.Lab = Hl = new D(Yk, "Lab", 5);
var Yl;
Yk.HSL = Yl = new D(Yk, "HSL", 6);
Yk.randomColor = function (a, b) {
void 0 === a && (a = 128);
void 0 === b && (b = Math.max(a, 255));
var c = Math.abs(b - a);
b = Math.floor(a + Math.random() * c).toString(16);
var d = Math.floor(a + Math.random() * c).toString(16);
a = Math.floor(a + Math.random() * c).toString(16);
2 > b.length && (b = "0" + b);
2 > d.length && (d = "0" + d);
2 > a.length && (a = "0" + a);
return "#" + b + d + a
};
Yk.isValidColor = function (a) {
if ("black" === a) return !0;
if ("" === a) return !1;
Fl || (Gl(), Fl = !0);
var b = $l;
if (null === b) return !0;
b.fillStyle = "#000000";
var c = b.fillStyle;
b.fillStyle = a;
if (b.fillStyle !== c) return !0;
b.fillStyle = "#FFFFFF";
c = b.fillStyle;
b.fillStyle = a;
return b.fillStyle !== c
};
Yk.lighten = function (a) {
return Kl(a)
};
Yk.lightenBy = Kl;
Yk.darken = function (a) {
return Ll(a)
};
Yk.darkenBy = Ll;
Yk.mix = Ml;
Yk.isDark = Ol;
function rl() {
this.name = "Base"
}
rl.prototype.measure = function () {
};
rl.prototype.Az = function (a, b, c, d, e) {
a.measure(b, c, d, e)
};
rl.prototype.arrange = function () {
};
rl.prototype.ly = function (a, b, c, d, e, f) {
a.arrange(b, c, d, e, f)
};
ma.Object.defineProperties(rl.prototype, {
classType: {
get: function () {
return X
}
}
});
rl.prototype.arrangeElement = rl.prototype.ly;
rl.prototype.measureElement = rl.prototype.Az;
rl.className = "PanelLayout";
function am() {
this.name = "Base";
this.name = "Position"
}
la(am, rl);
am.prototype.measure = function (a, b, c, d, e, f, g) {
var h = d.length;
a = bm(a);
for (var k = 0; k < h; k++) {
var l = d[k];
if (l.visible || l === a) {
var m = l.margin, n = m.right + m.left;
m = m.top + m.bottom;
l.measure(b, c, f, g);
var p = l.measuredBounds;
n = Math.max(p.width + n, 0);
m = Math.max(p.height + m, 0);
p = l.position.x;
var r = l.position.y;
isFinite(p) || (p = 0);
isFinite(r) || (r = 0);
l instanceof W && l.isGeometryPositioned && (l = l.strokeWidth / 2, p -= l, r -= l);
ec(e, p, r, n, m)
}
}
};
am.prototype.arrange = function (a, b, c) {
var d = b.length, e = a.padding;
a = c.x - e.left;
c = c.y - e.top;
for (e = 0; e < d; e++) {
var f = b[e], g = f.measuredBounds, h = f.margin, k = f.position.x, l = f.position.y;
k = isNaN(k) ? -a : k - a;
l = isNaN(l) ? -c : l - c;
if (f instanceof W && f.isGeometryPositioned) {
var m = f.strokeWidth / 2;
k -= m;
l -= m
}
f.visible && f.arrange(k + h.left, l + h.top, g.width, g.height)
}
};
function cm() {
this.name = "Base";
this.name = "Horizontal"
}
la(cm, rl);
cm.prototype.measure = function (a, b, c, d, e, f, g) {
var h = d.length;
b = Da();
f = bm(a);
for (var k = 0; k < h; k++) {
var l = d[k];
if (l.visible || l === f) {
var m = Pk(l, !1);
if (m !== Bg && m !== Ak) b.push(l); else {
l.measure(Infinity, c, 0, g);
m = l.margin;
l = l.measuredBounds;
var n = Math.max(l.height + m.top + m.bottom, 0);
e.width += Math.max(l.width + m.right + m.left, 0);
e.height = Math.max(e.height, n)
}
}
}
d = b.length;
a.desiredSize.height ? c = Math.min(a.desiredSize.height, a.maxSize.height) : 0 !== e.height && (c = Math.min(e.height, a.maxSize.height));
for (a = 0; a < d; a++) if (k =
b[a], k.visible || k === f) m = k.margin, h = m.right + m.left, m = m.top + m.bottom, k.measure(Infinity, c, 0, g), k = k.measuredBounds, m = Math.max(k.height + m, 0), e.width += Math.max(k.width + h, 0), e.height = Math.max(e.height, m);
Ga(b)
};
cm.prototype.arrange = function (a, b, c) {
for (var d = b.length, e = a.padding, f = e.top, g = a.isOpposite, h = g ? c.width : e.left, k = 0; k < d; k++) {
var l = f, m = b[k];
if (m.visible) {
var n = m.measuredBounds, p = m.margin, r = p.top + p.bottom, q = f + e.bottom, u = n.height,
v = Pk(m, !1);
if (isNaN(m.desiredSize.height) && v === wd || v === Bk) u = Math.max(c.height - r - q, 0);
r = u + r + q;
q = m.alignment;
q.Kb() && (q = a.defaultAlignment);
q.gb() || (q = Fc);
g && (h -= n.width + p.left + p.right);
m.arrange(h + q.offsetX + p.left, l + q.offsetY + p.top + (c.height * q.y - r * q.y), n.width, u);
g || (h += n.width +
p.left + p.right)
}
}
};
function dm() {
this.name = "Base";
this.name = "Vertical"
}
la(dm, rl);
dm.prototype.measure = function (a, b, c, d, e, f) {
var g = d.length;
c = Da();
for (var h = bm(a), k = 0; k < g; k++) {
var l = d[k];
if (l.visible || l === h) {
var m = Pk(l, !1);
if (m !== Bg && m !== Bk) c.push(l); else {
var n = l.margin;
m = n.right + n.left;
n = n.top + n.bottom;
l.measure(b, Infinity, f, 0);
l = l.measuredBounds;
Wb(e, Math.max(e.width, Math.max(l.width + m, 0)), e.height + Math.max(l.height + n, 0))
}
}
}
d = c.length;
if (0 !== d) {
a.desiredSize.width ? b = Math.min(a.desiredSize.width, a.maxSize.width) : 0 !== e.width && (b = Math.min(e.width, a.maxSize.width));
for (a = 0; a < d; a++) if (k =
c[a], k.visible || k === h) l = k.margin, g = l.right + l.left, l = l.top + l.bottom, k.measure(b, Infinity, f, 0), k = k.measuredBounds, l = Math.max(k.height + l, 0), e.width = Math.max(e.width, Math.max(k.width + g, 0)), e.height += l;
Ga(c)
}
};
dm.prototype.arrange = function (a, b, c) {
for (var d = b.length, e = a.padding, f = e.left, g = a.isOpposite, h = g ? c.height : e.top, k = 0; k < d; k++) {
var l = f, m = b[k];
if (m.visible) {
var n = m.measuredBounds, p = m.margin, r = p.left + p.right, q = f + e.right, u = n.width,
v = Pk(m, !1);
if (isNaN(m.desiredSize.width) && v === wd || v === Ak) u = Math.max(c.width - r - q, 0);
r = u + r + q;
q = m.alignment;
q.Kb() && (q = a.defaultAlignment);
q.gb() || (q = Fc);
g && (h -= n.height + p.bottom + p.top);
m.arrange(l + q.offsetX + p.left + (c.width * q.x - r * q.x), h + q.offsetY + p.top, u, n.height);
g || (h += n.height +
p.bottom + p.top)
}
}
};
function em() {
this.name = "Base";
this.name = "Spot"
}
la(em, rl);
em.prototype.measure = function (a, b, c, d, e, f, g) {
var h = d.length, k = a.zb(), l = k.margin, m = l.right + l.left, n = l.top + l.bottom;
k.measure(b, c, f, g);
var p = k.measuredBounds;
f = p.width;
g = p.height;
var r = Math.max(f + m, 0);
var q = Math.max(g + n, 0);
for (var u = a.isClipping, v = N.allocAt(-l.left, -l.top, r, q), w = !0, z = bm(a), y = 0; y < h; y++) {
var A = d[y];
if (A !== k && (A.visible || A === z)) {
l = A.margin;
r = l.right + l.left;
q = l.top + l.bottom;
p = Pk(A, !1);
switch (p) {
case wd:
b = f;
c = g;
break;
case Ak:
b = f;
break;
case Bk:
c = g
}
A.measure(b, c, 0, 0);
p = A.measuredBounds;
r =
Math.max(p.width + r, 0);
q = Math.max(p.height + q, 0);
var C = A.alignment;
C.Kb() && (C = a.defaultAlignment);
C.gb() || (C = Fc);
var I = A.alignmentFocus;
I.Kb() && (I = Fc);
var K = null;
A instanceof X && "" !== A.Cg && (A.arrange(0, 0, p.width, p.height), K = A.$a(A.Cg), K === A && (K = null));
if (null !== K) {
l = K.naturalBounds;
p = K.margin;
for (l = G.allocAt(I.x * l.width - I.offsetX - p.left, I.y * l.height - I.offsetY - p.top); K !== A;) K.transform.ta(l), K = K.panel;
A = C.x * f + C.offsetX - l.x;
p = C.y * g + C.offsetY - l.y;
G.free(l)
} else A = C.x * f + C.offsetX - (I.x * p.width + I.offsetX) -
l.left, p = C.y * g + C.offsetY - (I.y * p.height + I.offsetY) - l.top;
w ? (w = !1, e.h(A, p, r, q)) : ec(e, A, p, r, q)
}
}
w ? e.assign(v) : u ? e.iv(v.x, v.y, v.width, v.height) : ec(e, v.x, v.y, v.width, v.height);
N.free(v);
p = k.stretch;
p === zk && (p = Pk(k, !1));
switch (p) {
case Bg:
return;
case wd:
if (!isFinite(b) && !isFinite(c)) return;
break;
case Ak:
if (!isFinite(b)) return;
break;
case Bk:
if (!isFinite(c)) return
}
p = k.measuredBounds;
f = p.width;
g = p.height;
r = Math.max(f + m, 0);
q = Math.max(g + n, 0);
l = k.margin;
v = N.allocAt(-l.left, -l.top, r, q);
for (b = 0; b < h; b++) c = d[b], c ===
k || !c.visible && c !== z || (l = c.margin, r = l.right + l.left, q = l.top + l.bottom, p = c.measuredBounds, r = Math.max(p.width + r, 0), q = Math.max(p.height + q, 0), m = c.alignment, m.Kb() && (m = a.defaultAlignment), m.gb() || (m = Fc), c = c.alignmentFocus, c.Kb() && (c = Fc), w ? (w = !1, e.h(m.x * f + m.offsetX - (c.x * p.width + c.offsetX) - l.left, m.y * g + m.offsetY - (c.y * p.height + c.offsetY) - l.top, r, q)) : ec(e, m.x * f + m.offsetX - (c.x * p.width + c.offsetX) - l.left, m.y * g + m.offsetY - (c.y * p.height + c.offsetY) - l.top, r, q));
w ? e.assign(v) : u ? e.iv(v.x, v.y, v.width, v.height) : ec(e, v.x,
v.y, v.width, v.height);
N.free(v)
};
em.prototype.arrange = function (a, b, c) {
var d = b.length, e = a.zb(), f = e.measuredBounds, g = f.width;
f = f.height;
var h = a.padding, k = h.left;
h = h.top;
var l = k - c.x, m = h - c.y;
e.arrange(l, m, g, f);
for (var n = 0; n < d; n++) {
var p = b[n];
if (p !== e) {
var r = p.measuredBounds, q = r.width;
r = r.height;
m = p.alignment;
m.Kb() && (m = a.defaultAlignment);
m.gb() || (m = Fc);
var u = p.alignmentFocus;
u.Kb() && (u = Fc);
l = null;
p instanceof X && "" !== p.Cg && (l = p.$a(p.Cg), l === p && (l = null));
if (null !== l) {
var v = l.naturalBounds;
for (u = G.allocAt(u.x * v.width - u.offsetX, u.y * v.height -
u.offsetY); l !== p;) l.transform.ta(u), l = l.panel;
l = m.x * g + m.offsetX - u.x;
m = m.y * f + m.offsetY - u.y;
G.free(u)
} else l = m.x * g + m.offsetX - (u.x * q + u.offsetX), m = m.y * f + m.offsetY - (u.y * r + u.offsetY);
l -= c.x;
m -= c.y;
p.visible && p.arrange(k + l, h + m, q, r)
}
}
};
function fm() {
this.name = "Base";
this.name = "Auto"
}
la(fm, rl);
fm.prototype.measure = function (a, b, c, d, e, f, g) {
var h = d.length, k = a.zb(), l = k.margin, m = b, n = c, p = l.right + l.left, r = l.top + l.bottom;
k.measure(b, c, f, g);
l = k.measuredBounds;
var q = 0, u = null;
k instanceof W && (u = k, q = u.strokeWidth * u.scale);
var v = Math.max(l.width + p, 0);
l = Math.max(l.height + r, 0);
var w = gm(k), z = w.x * v + w.offsetX;
w = w.y * l + w.offsetY;
var y = hm(k), A = y.x * v + y.offsetX;
y = y.y * l + y.offsetY;
isFinite(b) && (m = Math.max(Math.abs(z - A) - q, 0));
isFinite(c) && (n = Math.max(Math.abs(w - y) - q, 0));
q = M.alloc();
q.h(0, 0);
a = bm(a);
for (y = 0; y < h; y++) w =
d[y], w === k || !w.visible && w !== a || (l = w.margin, v = l.right + l.left, z = l.top + l.bottom, w.measure(m, n, 0, 0), l = w.measuredBounds, v = Math.max(l.width + v, 0), l = Math.max(l.height + z, 0), q.h(Math.max(v, q.width), Math.max(l, q.height)));
if (1 === h) e.width = v, e.height = l, M.free(q); else {
w = gm(k);
y = hm(k);
h = d = 0;
y.x !== w.x && y.y !== w.y && (d = q.width / Math.abs(y.x - w.x), h = q.height / Math.abs(y.y - w.y));
M.free(q);
q = 0;
null !== u && (q = u.strokeWidth * u.scale, Cg(u) === Dg && (d = h = Math.max(d, h)));
d += Math.abs(w.offsetX) + Math.abs(y.offsetX) + q;
h += Math.abs(w.offsetY) +
Math.abs(y.offsetY) + q;
u = k.stretch;
u === zk && (u = Pk(k, !1));
switch (u) {
case Bg:
g = f = 0;
break;
case wd:
isFinite(b) && (d = b);
isFinite(c) && (h = c);
break;
case Ak:
isFinite(b) && (d = b);
g = 0;
break;
case Bk:
f = 0, isFinite(c) && (h = c)
}
k.em();
k.measure(d, h, f, g);
e.width = k.measuredBounds.width + p;
e.height = k.measuredBounds.height + r
}
};
fm.prototype.arrange = function (a, b) {
var c = b.length, d = a.zb(), e = d.measuredBounds, f = N.alloc();
f.h(0, 0, 1, 1);
var g = d.margin, h = g.left;
g = g.top;
var k = a.padding, l = k.left;
k = k.top;
d.arrange(l + h, k + g, e.width, e.height);
var m = gm(d), n = hm(d), p = m.y * e.height + m.offsetY, r = n.x * e.width + n.offsetX;
n = n.y * e.height + n.offsetY;
f.x = m.x * e.width + m.offsetX;
f.y = p;
ec(f, r, n, 0, 0);
f.x += h + l;
f.y += g + k;
for (e = 0; e < c; e++) h = b[e], h !== d && (l = h.measuredBounds, g = h.margin, k = Math.max(l.width + g.right + g.left, 0), m = Math.max(l.height + g.top + g.bottom, 0), p = h.alignment,
p.Kb() && (p = a.defaultAlignment), p.gb() || (p = Fc), k = f.width * p.x + p.offsetX - k * p.x + g.left + f.x, g = f.height * p.y + p.offsetY - m * p.y + g.top + f.y, h.visible && (fc(f.x, f.y, f.width, f.height, k, g, l.width, l.height) ? h.arrange(k, g, l.width, l.height) : h.arrange(k, g, l.width, l.height, new N(f.x, f.y, f.width, f.height))));
N.free(f)
};
function im() {
this.name = "Base";
this.name = "Table"
}
la(im, rl);
im.prototype.measure = function (a, b, c, d, e, f, g) {
for (var h = d.length, k = Da(), l = Da(), m = 0; m < h; m++) {
var n = d[m], p = n instanceof X ? n : null;
if (null === p || p.type !== X.TableRow && p.type !== X.TableColumn || !n.visible) k.push(n); else {
l.push(p);
for (var r = p.Y.j, q = r.length, u = 0; u < q; u++) {
var v = r[u];
p.type === X.TableRow ? v.row = n.row : p.type === X.TableColumn && (v.column = n.column);
k.push(v)
}
}
}
h = k.length;
0 === h && (a.getRowDefinition(0), a.getColumnDefinition(0));
for (var w = [], z = 0; z < h; z++) {
var y = k[z];
Vi(y, !0);
Qk(y, !0);
w[y.row] || (w[y.row] =
[]);
w[y.row][y.column] || (w[y.row][y.column] = []);
w[y.row][y.column].push(y)
}
Ga(k);
var A = Da(), C = Da(), I = Da(), K = {count: 0}, J = {count: 0}, T = b, Q = c, ea = a.sb;
h = ea.length;
for (var pa = 0; pa < h; pa++) {
var L = ea[pa];
void 0 !== L && (L.actual = 0)
}
ea = a.nb;
h = ea.length;
for (var Fa = 0; Fa < h; Fa++) L = ea[Fa], void 0 !== L && (L.actual = 0);
for (var Pa = w.length, eb = 0, Ia = 0; Ia < Pa; Ia++) w[Ia] && (eb = Math.max(eb, w[Ia].length));
var nb = Math.min(a.topIndex, Pa - 1), yd = Math.min(a.leftIndex, eb - 1), kb = 0;
Pa = w.length;
for (var Yb = bm(a), Ya = 0; Ya < Pa; Ya++) if (w[Ya]) {
eb =
w[Ya].length;
for (var Md = a.getRowDefinition(Ya), sc = Md.actual = 0; sc < eb; sc++) if (w[Ya][sc]) {
var uf = a.getColumnDefinition(sc);
void 0 === A[sc] && (uf.actual = 0, A[sc] = !0);
for (var Se = w[Ya][sc], we = Se.length, fh = 0; fh < we; fh++) {
var Bc = Se[fh];
if (Bc.visible || Bc === Yb) {
var vf = 1 < Bc.rowSpan || 1 < Bc.columnSpan;
vf && (Ya < nb || sc < yd || C.push(Bc));
var Te = Bc.margin, Nd = Te.right + Te.left, Fj = Te.top + Te.bottom;
var Cb = hl(Bc, Md, uf, !1);
var wf = Bc.desiredSize, zd = !isNaN(wf.height), gc = !isNaN(wf.width) && zd;
vf || Cb === Bg || gc || Ya < nb || sc < yd || (void 0 !==
K[sc] || Cb !== wd && Cb !== Ak || (K[sc] = -1, K.count++), void 0 !== J[Ya] || Cb !== wd && Cb !== Bk || (J[Ya] = -1, J.count++), I.push(Bc));
Bc.measure(Infinity, Infinity, 0, 0);
if (!(Ya < nb || sc < yd)) {
var Ue = Bc.measuredBounds, Uc = Math.max(Ue.width + Nd, 0),
Xf = Math.max(Ue.height + Fj, 0);
if (1 === Bc.rowSpan && (Cb === Bg || Cb === Ak)) {
L = a.getRowDefinition(Ya);
var gh = L.tc();
kb = Math.max(Xf - L.actual, 0);
kb + gh > Q && (kb = Math.max(Q - gh, 0));
var Ym = 0 === L.actual;
L.actual = L.actual + kb;
Q = Math.max(Q - (kb + (Ym ? gh : 0)), 0)
}
if (1 === Bc.columnSpan && (Cb === Bg || Cb === Bk)) {
L = a.getColumnDefinition(sc);
var Yf = L.tc();
kb = Math.max(Uc - L.actual, 0);
kb + Yf > T && (kb = Math.max(T - Yf, 0));
var Gj = 0 === L.actual;
L.actual = L.actual + kb;
T = Math.max(T - (kb + (Gj ? Yf : 0)), 0)
}
vf && Bc.em()
}
}
}
}
}
Ga(A);
var Ub = 0, Lc = 0;
h = a.columnCount;
for (var Zb = 0; Zb < h; Zb++) {
var Zf = a.nb[Zb];
void 0 !== Zf && (Ub += Zf.ka, 0 !== Zf.ka && (Ub += Zf.tc()))
}
h = a.rowCount;
for (var hh = 0; hh < h; hh++) {
var Ve = a.sb[hh];
void 0 !== Ve && (Lc += Ve.ka, 0 !== Ve.ka && (Lc += Ve.tc()))
}
T = Math.max(b - Ub, 0);
var mi = Q = Math.max(c - Lc, 0), ee = T;
h = I.length;
for (var xe = 0; xe < h; xe++) {
var hc = I[xe], Zm = a.getRowDefinition(hc.row),
$m = a.getColumnDefinition(hc.column), $f = hc.measuredBounds, Nb = hc.margin, ag = Nb.right + Nb.left,
an = Nb.top + Nb.bottom;
K[hc.column] = 0 === $m.actual && void 0 !== K[hc.column] ? Math.max($f.width + ag, K[hc.column]) : null;
J[hc.row] = 0 === Zm.actual && void 0 !== J[hc.row] ? Math.max($f.height + an, J[hc.row]) : null
}
var ni = 0, bg = 0, xf;
for (xf in J) "count" !== xf && (ni += J[xf]);
for (xf in K) "count" !== xf && (bg += K[xf]);
for (var Za = M.alloc(), cg = 0; cg < h; cg++) {
var ic = I[cg];
if (ic.visible || ic === Yb) {
var Cc = a.getRowDefinition(ic.row), $a = a.getColumnDefinition(ic.column),
Ad = 0;
isFinite($a.width) ? Ad = $a.width : (isFinite(T) && null !== K[ic.column] ? 0 === bg ? Ad = $a.actual + T : Ad = K[ic.column] / bg * ee : null !== K[ic.column] ? Ad = T : Ad = $a.actual || T, Ad = Math.max(0, Ad - $a.tc()));
var Bd = 0;
isFinite(Cc.height) ? Bd = Cc.height : (isFinite(Q) && null !== J[ic.row] ? 0 === ni ? Bd = Cc.actual + Q : Bd = J[ic.row] / ni * mi : null !== J[ic.row] ? Bd = Q : Bd = Cc.actual || Q, Bd = Math.max(0, Bd - Cc.tc()));
Za.h(Math.max($a.minimum, Math.min(Ad, $a.maximum)), Math.max(Cc.minimum, Math.min(Bd, Cc.maximum)));
Cb = hl(ic, Cc, $a, !1);
switch (Cb) {
case Ak:
Za.height =
Math.max(Za.height, Cc.actual + Q);
break;
case Bk:
Za.width = Math.max(Za.width, $a.actual + T)
}
var Od = ic.margin, bn = Od.right + Od.left, ih = Od.top + Od.bottom;
ic.em();
ic.measure(Za.width, Za.height, $a.minimum, Cc.minimum);
var jh = ic.measuredBounds, kh = Math.max(jh.width + bn, 0), lh = Math.max(jh.height + ih, 0);
isFinite(T) && (kh = Math.min(kh, Za.width));
isFinite(Q) && (lh = Math.min(lh, Za.height));
var dg = 0;
dg = Cc.actual;
Cc.actual = Math.max(Cc.actual, lh);
kb = Cc.actual - dg;
Q = Math.max(Q - kb, 0);
dg = $a.actual;
$a.actual = Math.max($a.actual, kh);
kb = $a.actual - dg;
T = Math.max(T - kb, 0)
}
}
Ga(I);
var Cd = M.alloc(), gd = Da(), fe = Da();
h = C.length;
if (0 !== h) for (var jc = 0; jc < Pa; jc++) if (w[jc]) {
eb = w[jc].length;
var oi = a.getRowDefinition(jc);
gd[jc] = oi.actual;
for (var hd = 0; hd < eb; hd++) if (w[jc][hd]) {
var cn = a.getColumnDefinition(hd);
fe[hd] = cn.actual
}
}
for (var ge = 0; ge < h; ge++) {
var La = C[ge];
if (La.visible || La === Yb) {
var Dd = a.getRowDefinition(La.row), kc = a.getColumnDefinition(La.column);
Za.h(Math.max(kc.minimum, Math.min(b, kc.maximum)), Math.max(Dd.minimum, Math.min(c, Dd.maximum)));
Cb = hl(La, Dd, kc, !1);
switch (Cb) {
case wd:
0 !== fe[kc.index] && (Za.width = Math.min(Za.width, fe[kc.index]));
0 !== gd[Dd.index] && (Za.height = Math.min(Za.height, gd[Dd.index]));
break;
case Ak:
0 !== fe[kc.index] && (Za.width = Math.min(Za.width, fe[kc.index]));
break;
case Bk:
0 !== gd[Dd.index] && (Za.height = Math.min(Za.height, gd[Dd.index]))
}
isFinite(kc.width) && (Za.width = kc.width);
isFinite(Dd.height) && (Za.height = Dd.height);
Cd.h(0, 0);
for (var ye = 1; ye < La.rowSpan && !(La.row + ye >= a.rowCount); ye++) L = a.getRowDefinition(La.row + ye), kb = 0,
kb = Cb === wd || Cb === Bk ? Math.max(L.minimum, 0 === gd[La.row + ye] ? L.maximum : Math.min(gd[La.row + ye], L.maximum)) : Math.max(L.minimum, isNaN(L.Pc) ? L.maximum : Math.min(L.Pc, L.maximum)), Cd.height += kb;
for (var yf = 1; yf < La.columnSpan && !(La.column + yf >= a.columnCount); yf++) L = a.getColumnDefinition(La.column + yf), kb = 0, kb = Cb === wd || Cb === Ak ? Math.max(L.minimum, 0 === fe[La.column + yf] ? L.maximum : Math.min(fe[La.column + yf], L.maximum)) : Math.max(L.minimum, isNaN(L.Pc) ? L.maximum : Math.min(L.Pc, L.maximum)), Cd.width += kb;
Za.width += Cd.width;
Za.height +=
Cd.height;
var We = La.margin, Pd = We.right + We.left, ze = We.top + We.bottom;
La.measure(Za.width, Za.height, f, g);
for (var Xe = La.measuredBounds, Ae = Math.max(Xe.width + Pd, 0), Be = Math.max(Xe.height + ze, 0), id = 0, eg = 0; eg < La.rowSpan && !(La.row + eg >= a.rowCount); eg++) L = a.getRowDefinition(La.row + eg), id += L.total || 0;
if (id < Be) {
var he = Be - id, dn = Be - id;
if (null !== La.spanAllocation) for (var en = La.spanAllocation, jd = 0; jd < La.rowSpan && !(0 >= he) && !(La.row + jd >= a.rowCount); jd++) {
L = a.getRowDefinition(La.row + jd);
var fg = L.ka || 0, fn = en(La, L, dn);
L.actual =
Math.min(L.maximum, fg + fn);
L.ka !== fg && (he -= L.ka - fg)
}
for (; 0 < he;) {
var mh = L.ka || 0;
isNaN(L.height) && L.maximum > mh && (L.actual = Math.min(L.maximum, mh + he), L.ka !== mh && (he -= L.ka - mh));
if (0 === L.index) break;
L = a.getRowDefinition(L.index - 1)
}
}
for (var gg = 0, Hj = 0; Hj < La.columnSpan && !(La.column + Hj >= a.columnCount); Hj++) L = a.getColumnDefinition(La.column + Hj), gg += L.total || 0;
if (gg < Ae) {
var pi = Ae - gg, lt = Ae - gg;
if (null !== La.spanAllocation) for (var mt = La.spanAllocation, Ij = 0; Ij < La.columnSpan && !(0 >= pi) && !(La.column + Ij >= a.columnCount); Ij++) {
L =
a.getColumnDefinition(La.column + Ij);
var gn = L.ka || 0, nt = mt(La, L, lt);
L.actual = Math.min(L.maximum, gn + nt);
L.ka !== gn && (pi -= L.ka - gn)
}
for (; 0 < pi;) {
var Jj = L.ka || 0;
isNaN(L.width) && L.maximum > Jj && (L.actual = Math.min(L.maximum, Jj + pi), L.ka !== Jj && (pi -= L.ka - Jj));
if (0 === L.index) break;
L = a.getColumnDefinition(L.index - 1)
}
}
}
}
Ga(C);
M.free(Cd);
M.free(Za);
void 0 !== gd && Ga(gd);
void 0 !== fe && Ga(fe);
var hg = 0, ig = 0, Kj = a.desiredSize, Nq = a.maxSize;
Cb = Pk(a, !0);
var qi = Lc = Ub = 0, ri = 0;
h = a.columnCount;
for (var Lj = 0; Lj < h; Lj++) void 0 !== a.nb[Lj] &&
(L = a.getColumnDefinition(Lj), isFinite(L.width) ? (qi += L.width, qi += L.tc()) : jm(L) === km ? (qi += L.ka, qi += L.tc()) : 0 !== L.ka && (Ub += L.ka, Ub += L.tc()));
isFinite(Kj.width) ? hg = Math.min(Kj.width, Nq.width) : hg = Cb !== Bg && isFinite(b) ? b : Ub;
hg = Math.max(hg, a.minSize.width);
hg = Math.max(hg - qi, 0);
for (var ot = 0 === Ub ? 1 : Math.max(hg / Ub, 1), Nj = 0; Nj < h; Nj++) void 0 !== a.nb[Nj] && (L = a.getColumnDefinition(Nj), isFinite(L.width) || jm(L) === km || (L.actual = L.ka * ot), L.position = e.width, 0 !== L.ka && (e.width += L.ka, e.width += L.tc()));
h = a.rowCount;
for (var Oj =
0; Oj < h; Oj++) void 0 !== a.sb[Oj] && (L = a.getRowDefinition(Oj), isFinite(L.height) ? (ri += L.height, ri += L.tc()) : jm(L) === km ? (ri += L.ka, ri += L.tc()) : 0 !== L.ka && (Lc += L.ka, 0 !== L.ka && (Lc += L.tc())));
isFinite(Kj.height) ? ig = Math.min(Kj.height, Nq.height) : ig = Cb !== Bg && isFinite(c) ? c : Lc;
ig = Math.max(ig, a.minSize.height);
ig = Math.max(ig - ri, 0);
for (var pt = 0 === Lc ? 1 : Math.max(ig / Lc, 1), Pj = 0; Pj < h; Pj++) void 0 !== a.sb[Pj] && (L = a.getRowDefinition(Pj), isFinite(L.height) || jm(L) === km || (L.actual = L.ka * pt), L.position = e.height, 0 !== L.ka && (e.height +=
L.ka, 0 !== L.ka && (e.height += L.tc())));
h = l.length;
for (var hn = 0; hn < h; hn++) {
var kd = l[hn], jn = 0, kn = 0;
kd.type === X.TableRow ? (jn = e.width, L = a.getRowDefinition(kd.row), kn = L.actual) : (L = a.getColumnDefinition(kd.column), jn = L.actual, kn = e.height);
kd.measuredBounds.h(0, 0, jn, kn);
Vi(kd, !1);
w[kd.row] || (w[kd.row] = []);
w[kd.row][kd.column] || (w[kd.row][kd.column] = []);
w[kd.row][kd.column].push(kd)
}
Ga(l);
a.gp = w
};
im.prototype.arrange = function (a, b, c) {
var d = b.length, e = a.padding, f = e.left;
e = e.top;
for (var g = a.gp, h, k, l = g.length, m = 0, n = 0; n < l; n++) g[n] && (m = Math.max(m, g[n].length));
for (n = Math.min(a.topIndex, l - 1); n !== l && (void 0 === a.sb[n] || 0 === a.sb[n].ka);) n++;
n = Math.min(n, l - 1);
n = -a.sb[n].position;
for (h = Math.min(a.leftIndex, m - 1); h !== m && (void 0 === a.nb[h] || 0 === a.nb[h].ka);) h++;
h = Math.min(h, m - 1);
for (var p = -a.nb[h].position, r = M.alloc(), q = 0; q < l; q++) if (g[q]) {
m = g[q].length;
var u = a.getRowDefinition(q);
k = u.position + n + e;
0 !== u.ka &&
(k += u.Pu());
for (var v = 0; v < m; v++) if (g[q][v]) {
var w = a.getColumnDefinition(v);
h = w.position + p + f;
0 !== w.ka && (h += w.Pu());
for (var z = g[q][v], y = z.length, A = 0; A < y; A++) {
var C = z[A], I = C.measuredBounds, K = C instanceof X ? C : null;
if (null === K || K.type !== X.TableRow && K.type !== X.TableColumn) {
r.h(0, 0);
for (var J = 1; J < C.rowSpan && !(q + J >= a.rowCount); J++) K = a.getRowDefinition(q + J), r.height += K.total;
for (J = 1; J < C.columnSpan && !(v + J >= a.columnCount); J++) K = a.getColumnDefinition(v + J), r.width += K.total;
var T = w.ka + r.width, Q = u.ka + r.height;
J =
h;
K = k;
var ea = T, pa = Q, L = h, Fa = k, Pa = T, eb = Q;
h + T > c.width && (Pa = Math.max(c.width - h, 0));
k + Q > c.height && (eb = Math.max(c.height - k, 0));
var Ia = C.alignment;
if (Ia.Kb()) {
Ia = a.defaultAlignment;
Ia.gb() || (Ia = Fc);
var nb = Ia.x;
var yd = Ia.y;
var kb = Ia.offsetX;
Ia = Ia.offsetY;
var Yb = w.alignment, Ya = u.alignment;
Yb.gb() && (nb = Yb.x, kb = Yb.offsetX);
Ya.gb() && (yd = Ya.y, Ia = Ya.offsetY)
} else nb = Ia.x, yd = Ia.y, kb = Ia.offsetX, Ia = Ia.offsetY;
if (isNaN(nb) || isNaN(yd)) yd = nb = .5, Ia = kb = 0;
Yb = I.width;
Ya = I.height;
var Md = C.margin, sc = Md.left + Md.right, uf = Md.top +
Md.bottom, Se = hl(C, u, w, !1);
!isNaN(C.desiredSize.width) || Se !== wd && Se !== Ak || (Yb = Math.max(T - sc, 0));
!isNaN(C.desiredSize.height) || Se !== wd && Se !== Bk || (Ya = Math.max(Q - uf, 0));
T = C.maxSize;
Q = C.minSize;
Yb = Math.min(T.width, Yb);
Ya = Math.min(T.height, Ya);
Yb = Math.max(Q.width, Yb);
Ya = Math.max(Q.height, Ya);
T = Ya + uf;
J += ea * nb - (Yb + sc) * nb + kb + Md.left;
K += pa * yd - T * yd + Ia + Md.top;
C.visible && (fc(L, Fa, Pa, eb, J, K, I.width, I.height) ? C.arrange(J, K, Yb, Ya) : C.arrange(J, K, Yb, Ya, new N(L, Fa, Pa, eb)))
} else C.gl(), C.actualBounds.ha(), ea = C.actualBounds,
J = N.allocAt(ea.x, ea.y, ea.width, ea.height), ea.x = K.type === X.TableRow ? f : h, ea.y = K.type === X.TableColumn ? e : k, ea.width = I.width, ea.height = I.height, C.actualBounds.freeze(), Qk(C, !1), ac(J, ea) || (I = C.part, null !== I && (I.Ah(), C.Go(I))), N.free(J)
}
}
}
M.free(r);
for (a = 0; a < d; a++) c = b[a], f = c instanceof X ? c : null, null === f || f.type !== X.TableRow && f.type !== X.TableColumn || (f = c.actualBounds, c.naturalBounds.ha(), c.naturalBounds.h(0, 0, f.width, f.height), c.naturalBounds.freeze())
};
function lm() {
this.name = "Base";
this.name = "TableRow"
}
la(lm, rl);
lm.prototype.measure = function () {
};
lm.prototype.arrange = function () {
};
function mm() {
this.name = "Base";
this.name = "TableColumn"
}
la(mm, rl);
mm.prototype.measure = function () {
};
mm.prototype.arrange = function () {
};
function nm() {
this.name = "Base";
this.name = "Viewbox"
}
la(nm, rl);
nm.prototype.measure = function (a, b, c, d, e, f, g) {
1 < d.length && B("Viewbox Panel cannot contain more than one GraphObject.");
d = d[0];
d.Ca = 1;
d.em();
d.measure(Infinity, Infinity, f, g);
var h = d.measuredBounds, k = d.margin, l = k.right + k.left;
k = k.top + k.bottom;
if (isFinite(b) || isFinite(c)) {
var m = d.scale, n = h.width;
h = h.height;
var p = Math.max(b - l, 0), r = Math.max(c - k, 0), q = 1;
a.viewboxStretch === Dg ? 0 !== n && 0 !== h && (q = Math.min(p / n, r / h)) : 0 !== n && 0 !== h && (q = Math.max(p / n, r / h));
0 === q && (q = 1E-4);
d.Ca *= q;
m !== d.scale && (Vi(d, !0), d.measure(Infinity,
Infinity, f, g))
}
h = d.measuredBounds;
e.width = isFinite(b) ? b : Math.max(h.width + l, 0);
e.height = isFinite(c) ? c : Math.max(h.height + k, 0)
};
nm.prototype.arrange = function (a, b, c) {
b = b[0];
var d = b.measuredBounds, e = b.margin, f = Math.max(d.width + (e.right + e.left), 0);
e = Math.max(d.height + (e.top + e.bottom), 0);
var g = b.alignment;
g.Kb() && (g = a.defaultAlignment);
g.gb() || (g = Fc);
b.arrange(c.width * g.x - f * g.x + g.offsetX, c.height * g.y - e * g.y + g.offsetY, d.width, d.height)
};
function om() {
this.name = "Base";
this.name = "Grid"
}
la(om, rl);
om.prototype.measure = function () {
};
om.prototype.arrange = function () {
};
function pm() {
this.name = "Base";
this.name = "Link"
}
la(pm, rl);
pm.prototype.measure = function (a, b, c, d, e) {
c = d.length;
if (a instanceof Je || a instanceof R) {
var f = null, g = null, h = null;
a instanceof R && (g = f = a);
a instanceof Je && (h = a, f = h.adornedPart);
if (f instanceof R) {
var k = f;
if (0 === c) Wb(a.naturalBounds, 0, 0), a.measuredBounds.h(0, 0, 0, 0); else {
var l = a instanceof Je ? null : f.path, m = f.routeBounds;
b = a.lg;
b.h(0, 0, m.width, m.height);
var n = k.points;
f = f.pointsCount;
null !== h ? h.ik(!1) : null !== g && g.ik(!1);
var p = m.width, r = m.height;
a.location.h(m.x, m.y);
a.l.length = 0;
null !== l && (qm(a, p, r, l),
h = l.measuredBounds, b.Jc(h), a.l.push(h));
h = wc.alloc();
for (var q = G.alloc(), u = G.alloc(), v = 0; v < c; v++) {
var w = d[v];
if (w !== l) if (w.isPanelMain && w instanceof W) {
qm(a, p, r, w);
var z = w.measuredBounds;
b.Jc(z);
a.l.push(z)
} else if (2 > f) w.measure(Infinity, Infinity, 0, 0), z = w.measuredBounds, b.Jc(z), a.l.push(z); else {
var y = w.segmentIndex;
z = w.segmentFraction;
var A = w.alignmentFocus;
A.jc() && (A = Fc);
var C = w.segmentOrientation, I = w.segmentOffset;
if (y < -f || y >= f) {
z = k.midPoint;
var K = k.midAngle;
if (C !== qg) {
var J = k.computeAngle(w, C,
K);
w.zc = J
}
J = z.x - m.x;
var T = z.y - m.y
} else {
J = 0;
if (0 <= y) {
T = n.N(y);
var Q = y < f - 1 ? n.N(y + 1) : T
} else J = f + y, T = n.N(J), Q = 0 < J ? n.N(J - 1) : T;
if (T.Qa(Q)) {
0 <= y ? (K = 0 < y ? n.N(y - 1) : T, J = y < f - 2 ? n.N(y + 2) : Q) : (K = J < f - 1 ? n.N(J + 1) : T, J = 1 < J ? n.N(J - 2) : Q);
var ea = K.Ce(T), pa = Q.Ce(J);
K = ea > pa + 10 ? 0 <= y ? K.Wa(T) : T.Wa(K) : pa > ea + 10 ? 0 <= y ? Q.Wa(J) : J.Wa(Q) : 0 <= y ? K.Wa(J) : J.Wa(K)
} else K = 0 <= y ? T.Wa(Q) : Q.Wa(T);
C !== qg && (J = k.computeAngle(w, C, K), w.zc = J);
J = T.x + (Q.x - T.x) * z - m.x;
T = T.y + (Q.y - T.y) * z - m.y
}
w.measure(Infinity, Infinity, 0, 0);
z = w.measuredBounds;
Q = w.naturalBounds;
var L = 0;
w instanceof W && (L = w.strokeWidth);
ea = Q.width + L;
pa = Q.height + L;
h.reset();
h.translate(-z.x, -z.y);
h.scale(w.scale, w.scale);
h.rotate(C === qg ? w.angle : K, ea / 2, pa / 2);
C !== rm && C !== sm || h.rotate(90, ea / 2, pa / 2);
C !== tm && C !== um || h.rotate(-90, ea / 2, pa / 2);
C === vm && (45 < K && 135 > K || 225 < K && 315 > K) && h.rotate(-K, ea / 2, pa / 2);
Q = new N(0, 0, ea, pa);
q.Wi(Q, A);
h.ta(q);
A = -q.x + L / 2 * w.scale;
w = -q.y + L / 2 * w.scale;
u.assign(I);
L = isNaN(I.x);
var Fa = isNaN(I.y);
if (L || Fa) {
ea = ea / 2 + 3;
pa = pa / 2 + 3;
var Pa = 45 <= K && 135 >= K, eb = 225 <= K && 315 >= K;
C === qg && (Pa ||
eb) ? (u.x = Fa ? ea : I.y, u.y = L ? pa : I.x, Pa ? 0 <= y || !L || (u.y = -pa) : eb && (0 <= y && L && (u.y = -pa), Fa && (u.x = -ea))) : (L && (u.x = 0 <= y ? ea : -ea), Fa && (u.y = -pa), u.rotate(K))
} else u.rotate(K);
J += u.x;
T += u.y;
Q.set(z);
Q.h(J + A, T + w, z.width, z.height);
a.l.push(Q);
b.Jc(Q)
}
}
if (null !== g) for (d = g.labelNodes; d.next();) d.value.measure(Infinity, Infinity);
a.lg = b;
a = a.location;
a.h(a.x + b.x, a.y + b.y);
Wb(e, b.width || 0, b.height || 0);
wc.free(h);
G.free(q);
G.free(u)
}
}
}
};
pm.prototype.arrange = function (a, b) {
var c = b.length;
if (a instanceof Je || a instanceof R) {
var d = null, e = null, f = null;
a instanceof R && (e = d = a);
a instanceof Je && (f = a, d = f.adornedPart);
var g = a instanceof Je ? null : d.path;
if (0 !== a.l.length) {
var h = a.l, k = 0;
if (null !== g && k < a.l.length) {
var l = h[k];
k++;
g.arrange(l.x - a.lg.x, l.y - a.lg.y, l.width, l.height)
}
for (l = 0; l < c; l++) {
var m = b[l];
if (m !== g && k < a.l.length) {
var n = h[k];
k++;
m.arrange(n.x - a.lg.x, n.y - a.lg.y, n.width, n.height)
}
}
}
b = d.points;
c = b.count;
if (2 <= c && a instanceof R) for (d =
a.labelNodes; d.next();) {
n = a;
g = d.value;
h = g.segmentIndex;
var p = g.segmentFraction;
l = g.alignmentFocus;
var r = g.segmentOrientation;
k = g.segmentOffset;
if (h < -c || h >= c) {
var q = n.midPoint;
m = n.midAngle;
r !== qg && (n = n.computeAngle(g, r, m), g.angle = n);
n = q.x;
var u = q.y
} else {
var v = 0;
0 <= h ? (u = b.j[h], q = h < c - 1 ? b.j[h + 1] : u) : (v = c + h, u = b.j[v], q = 0 < v ? b.j[v - 1] : u);
if (u.Qa(q)) {
0 <= h ? (m = 0 < h ? b.j[h - 1] : u, v = h < c - 2 ? b.j[h + 2] : q) : (m = v < c - 1 ? b.j[v + 1] : u, v = 1 < v ? b.j[v - 2] : q);
var w = m.Ce(u), z = q.Ce(v);
m = w > z + 10 ? 0 <= h ? m.Wa(u) : u.Wa(m) : z > w + 10 ? 0 <= h ? q.Wa(v) : v.Wa(q) :
0 <= h ? m.Wa(v) : v.Wa(m)
} else m = 0 <= h ? u.Wa(q) : q.Wa(u);
r !== qg && (n = n.computeAngle(g, r, m), g.angle = n);
n = u.x + (q.x - u.x) * p;
u = u.y + (q.y - u.y) * p
}
l.et() ? g.location = new G(n, u) : (l.jc() && (l = Fc), q = wc.alloc(), q.reset(), q.scale(g.scale, g.scale), q.rotate(g.angle, 0, 0), p = g.naturalBounds, p = N.allocAt(0, 0, p.width, p.height), r = G.alloc(), r.Wi(p, l), q.ta(r), l = -r.x, v = -r.y, k = k.copy(), isNaN(k.x) && (0 <= h ? k.x = r.x + 3 : k.x = -(r.x + 3)), isNaN(k.y) && (k.y = -(r.y + 3)), k.rotate(m), n += k.x, u += k.y, q.Wv(p), l += p.x, v += p.y, h = G.allocAt(n + l, u + v), g.move(h), G.free(h),
G.free(r), N.free(p), wc.free(q))
}
null !== f ? f.ik(!1) : null !== e && e.ik(!1)
}
};
function qm(a, b, c, d) {
if (!1 !== $i(d)) {
var e = d.strokeWidth;
0 === e && a instanceof Je && a.type === X.Link && a.adornedObject instanceof W && (e = a.adornedObject.strokeWidth);
e *= d.Ca;
a instanceof R && null !== a.qa ? (a = a.qa.bounds, Mk(d, a.x - e / 2, a.y - e / 2, a.width + e, a.height + e)) : a instanceof Je && null !== a.adornedPart.qa ? (a = a.adornedPart.qa.bounds, Mk(d, a.x - e / 2, a.y - e / 2, a.width + e, a.height + e)) : Mk(d, -(e / 2), -(e / 2), b + e, c + e);
Vi(d, !1)
}
}
function wm() {
this.name = "Base";
this.name = "Graduated"
}
la(wm, rl);
wm.prototype.measure = function (a, b, c, d, e, f, g) {
var h = a.zb();
a.jj = [];
var k = h.margin, l = k.right + k.left, m = k.top + k.bottom;
h.measure(b, c, f, g);
var n = h.measuredBounds, p = new N(-k.left, -k.top, Math.max(n.width + l, 0), Math.max(n.height + m, 0));
a.jj.push(p);
e.assign(p);
for (var r = h.geometry, q = h.strokeWidth, u = r.flattenedSegments, v = r.flattenedLengths, w = r.flattenedTotalLength, z = u.length, y = 0, A = 0, C = Da(), I = 0; I < z; I++) {
var K = u[I], J = [];
A = y = 0;
for (var T = K.length, Q = 0; Q < T; Q += 2) {
var ea = K[Q], pa = K[Q + 1];
if (0 !== Q) {
var L = 180 * Math.atan2(pa -
A, ea - y) / Math.PI;
0 > L && (L += 360);
J.push(L)
}
y = ea;
A = pa
}
C.push(J)
}
if (null === a.Qg) {
for (var Fa = [], Pa = a.Y.j, eb = Pa.length, Ia = 0; Ia < eb; Ia++) {
var nb = Pa[Ia], yd = [];
Fa.push(yd);
if (nb.visible) for (var kb = nb.interval, Yb = 0; Yb < eb; Yb++) {
var Ya = Pa[Yb];
if (Ya.visible && nb !== Ya && !(nb instanceof W && !(Ya instanceof W) || nb instanceof Yg && !(Ya instanceof Yg))) {
var Md = Ya.interval;
Md > kb && yd.push(Md)
}
}
}
a.Qg = Fa
}
var sc = a.Qg;
var uf = a.Y.j, Se = uf.length, we = 0, fh = 0, Bc = w;
a.lj = [];
for (var vf, Te = 0; Te < Se; Te++) {
var Nd = uf[Te];
vf = [];
if (Nd.visible &&
Nd !== h) {
var Fj = Nd.interval, Cb = a.graduatedTickUnit;
if (!(2 > Cb * Fj * w / a.graduatedRange)) {
var wf = v[0][0], zd = 0, gc = 0;
fh = w * Nd.graduatedStart - 1E-4;
Bc = w * Nd.graduatedEnd + 1E-4;
var Ue = Cb * Fj, Uc = a.graduatedTickBase;
if (Uc < a.graduatedMin) {
var Xf = (a.graduatedMin - Uc) / Ue;
Xf = 0 === Xf % 1 ? Xf : Math.floor(Xf + 1);
Uc += Xf * Ue
} else Uc > a.graduatedMin + Ue && (Uc -= Math.floor((Uc - a.graduatedMin) / Ue) * Ue);
for (var gh = sc[Te]; Uc <= a.graduatedMax;) {
a:{
for (var Ym = gh.length, Yf = 0; Yf < Ym; Yf++) if (H.ca((Uc - a.graduatedTickBase) % (gh[Yf] * a.graduatedTickUnit),
0)) {
var Gj = !1;
break a
}
Gj = !0
}
if (Gj && (null === Nd.graduatedSkip || !Nd.graduatedSkip(Uc)) && (we = (Uc - a.graduatedMin) * w / a.graduatedRange, we > w && (we = w), fh <= we && we <= Bc)) {
for (var Ub = C[zd][gc], Lc = v[zd][gc]; zd < v.length;) {
for (; we > wf && gc < v[zd].length - 1;) gc++, Ub = C[zd][gc], Lc = v[zd][gc], wf += Lc;
if (we <= wf) break;
zd++;
gc = 0;
Ub = C[zd][gc];
Lc = v[zd][gc];
wf += Lc
}
var Zb = u[zd], Zf = Zb[2 * gc], hh = Zb[2 * gc + 1], Ve = (we - (wf - Lc)) / Lc,
mi = new G(Zf + (Zb[2 * gc + 2] - Zf) * Ve + q / 2 - r.bounds.x, hh + (Zb[2 * gc + 3] - hh) * Ve + q / 2 - r.bounds.y);
mi.scale(h.scale, h.scale);
var ee = Ub, xe = C[zd];
1E-4 > Ve ? 0 < gc ? ee = xe[gc - 1] : H.ca(Zb[0], Zb[Zb.length - 2]) && H.ca(Zb[1], Zb[Zb.length - 1]) && (ee = xe[xe.length - 1]) : .9999 < Ve && (gc + 1 < xe.length ? ee = xe[gc + 1] : H.ca(Zb[0], Zb[Zb.length - 2]) && H.ca(Zb[1], Zb[Zb.length - 1]) && (ee = xe[0]));
Ub !== ee && (180 < Math.abs(Ub - ee) && (Ub < ee ? Ub += 360 : ee += 360), Ub = (Ub + ee) / 2 % 360);
if (Nd instanceof Yg) {
var hc = "";
null !== Nd.graduatedFunction ? (hc = Nd.graduatedFunction(Uc), hc = null !== hc && void 0 !== hc ? hc.toString() : "") : hc = (+Uc.toFixed(2)).toString();
"" !== hc && vf.push([mi, Ub, hc])
} else vf.push([mi,
Ub])
}
Uc += Ue
}
}
}
a.lj.push(vf)
}
Ga(C);
for (var Zm = a.lj, $m = d.length, $f = 0; $f < $m; $f++) {
var Nb = d[$f], ag = Zm[$f];
if (Nb.visible && Nb !== h && 0 !== ag.length) {
if (Nb instanceof W) {
var an = a, ni = e, bg = Nb.alignmentFocus;
bg.jc() && (bg = Ac);
var xf = Nb.angle;
Nb.zc = 0;
Nb.measure(Infinity, Infinity, 0, 0);
Nb.zc = xf;
var Za = Nb.measuredBounds, cg = Za.width, ic = Za.height, Cc = N.allocAt(0, 0, cg, ic),
$a = G.alloc();
$a.Wi(Cc, bg);
N.free(Cc);
for (var Ad = -$a.x, Bd = -$a.y, Od = new N, bn = ag.length, ih = 0; ih < bn; ih++) for (var jh = ag[ih], kh = jh[0].x, lh = jh[0].y, dg = jh[1],
Cd = 0; 4 > Cd; Cd++) {
switch (Cd) {
case 0:
$a.h(Ad, Bd);
break;
case 1:
$a.h(Ad + cg, Bd);
break;
case 2:
$a.h(Ad, Bd + ic);
break;
case 3:
$a.h(Ad + cg, Bd + ic)
}
$a.rotate(dg + Nb.angle);
$a.offset(kh, lh);
0 === ih && 0 === Cd ? Od.h($a.x, $a.y, 0, 0) : Od.Je($a);
$a.offset(-kh, -lh);
$a.rotate(-dg - Nb.angle)
}
G.free($a);
an.jj.push(Od);
ec(ni, Od.x, Od.y, Od.width, Od.height)
} else if (Nb instanceof Yg) {
var gd = a, fe = e;
null === gd.lh && (gd.lh = new Yg);
var jc = gd.lh;
xm(jc, Nb);
var oi = Nb.alignmentFocus;
oi.jc() && (oi = Ac);
for (var hd = Nb.segmentOrientation, cn = Nb.segmentOffset,
ge = null, La = 0, Dd = 0, kc = 0, ye = 0, yf = ag.length, We = 0; We < yf; We++) {
var Pd = ag[We];
La = Pd[0].x;
Dd = Pd[0].y;
kc = Pd[1];
hd !== qg && (ye = R.computeAngle(hd, kc), jc.zc = ye);
jc.text = Pd[2];
jc.measure(Infinity, Infinity, 0, 0);
var ze = jc.measuredBounds, Xe = jc.naturalBounds, Ae = Xe.width, Be = Xe.height,
id = wc.alloc();
id.reset();
id.translate(-ze.x, -ze.y);
id.scale(jc.scale, jc.scale);
id.rotate(hd === qg ? jc.angle : kc, Ae / 2, Be / 2);
hd !== rm && hd !== sm || id.rotate(90, Ae / 2, Be / 2);
hd !== tm && hd !== um || id.rotate(-90, Ae / 2, Be / 2);
hd === vm && (45 < kc && 135 > kc || 225 < kc &&
315 > kc) && id.rotate(-kc, Ae / 2, Be / 2);
var eg = N.allocAt(0, 0, Ae, Be), he = G.alloc();
he.Wi(eg, oi);
id.ta(he);
var dn = -he.x, en = -he.y, jd = G.alloc();
jd.assign(cn);
isNaN(jd.x) && (jd.x = Ae / 2 + 3);
isNaN(jd.y) && (jd.y = -(Be / 2 + 3));
jd.rotate(kc);
La += jd.x + dn;
Dd += jd.y + en;
var fg = new N(La, Dd, ze.width, ze.height), fn = new N(ze.x, ze.y, ze.width, ze.height),
mh = new N(Xe.x, Xe.y, Xe.width, Xe.height), gg = new ym;
gg.Wl(jc.metrics);
Pd.push(ye);
Pd.push(jc.lineCount);
Pd.push(gg);
Pd.push(fg);
Pd.push(fn);
Pd.push(mh);
0 === We ? ge = fg.copy() : ge.Jc(fg);
G.free(jd);
G.free(he);
N.free(eg);
wc.free(id)
}
gd.jj.push(ge);
ec(fe, ge.x, ge.y, ge.width, ge.height)
}
Vi(Nb, !1)
}
}
};
wm.prototype.arrange = function (a, b, c) {
if (null !== a.jj) {
var d = a.zb(), e = a.lj, f = a.jj, g = 0, h = f[g];
g++;
d.arrange(h.x - c.x, h.y - c.y, h.width, h.height);
for (var k = b.length, l = 0; l < k; l++) {
var m = b[l];
h = e[l];
m.visible && m !== d && 0 !== h.length && (h = f[g], g++, m.arrange(h.x - c.x, h.y - c.y, h.width, h.height))
}
a.jj = null
}
};
function X(a) {
Y.call(this);
this.va = void 0 === a ? X.Position : a;
null === this.va && B("Panel type not specified or PanelLayout not loaded: " + a);
this.Y = new E;
this.eb = uc;
this.va === X.Grid && (this.isAtomic = !0);
this.nn = ad;
this.Gf = zk;
this.va === X.Table && zm(this);
this.Ip = Dg;
this.Ln = Pb;
this.Mn = Fb;
this.In = 0;
this.Hn = 100;
this.Kn = 10;
this.Jn = 0;
this.Sh = this.jb = this.Qg = this.jj = this.lj = null;
this.Zn = NaN;
this.je = this.gi = null;
this.hl = "category";
this.Ed = null;
this.lg = new N(NaN, NaN, NaN, NaN);
this.lh = this.gp = this.wi = null;
this.Cg = ""
}
la(X, Y);
function zm(a) {
a.fj = uc;
a.Kg = 1;
a.Xh = null;
a.Wh = null;
a.Jg = 1;
a.Ig = null;
a.Vh = null;
a.sb = [];
a.nb = [];
a.Hj = Am;
a.dj = Am;
a.zi = 0;
a.ii = 0
}
X.prototype.cloneProtected = function (a) {
Y.prototype.cloneProtected.call(this, a);
a.va = this.va;
a.eb = this.eb.I();
a.nn = this.nn.I();
a.Gf = this.Gf;
if (a.va === X.Table) {
a.fj = this.fj.I();
a.Kg = this.Kg;
a.Xh = this.Xh;
a.Wh = this.Wh;
a.Jg = this.Jg;
a.Ig = this.Ig;
a.Vh = this.Vh;
var b = [];
if (0 < this.sb.length) for (var c = this.sb, d = c.length, e = 0; e < d; e++) if (void 0 !== c[e]) {
var f = c[e].copy();
f.Vi(a);
b[e] = f
}
a.sb = b;
b = [];
if (0 < this.nb.length) for (c = this.nb, d = c.length, e = 0; e < d; e++) void 0 !== c[e] && (f = c[e].copy(), f.Vi(a), b[e] = f);
a.nb = b;
a.Hj =
this.Hj;
a.dj = this.dj;
a.zi = this.zi;
a.ii = this.ii
}
a.Ip = this.Ip;
a.Ln = this.Ln.I();
a.Mn = this.Mn.I();
a.In = this.In;
a.Hn = this.Hn;
a.Kn = this.Kn;
a.Jn = this.Jn;
a.lj = this.lj;
a.Qg = this.Qg;
a.jb = this.jb;
a.Sh = this.Sh;
a.Zn = this.Zn;
a.gi = this.gi;
a.je = this.je;
a.hl = this.hl;
a.lg.assign(this.lg);
a.Cg = this.Cg;
null !== this.gp && (a.gp = this.gp)
};
X.prototype.pf = function (a) {
Y.prototype.pf.call(this, a);
a.Y = this.Y;
for (var b = a.Y.j, c = b.length, d = 0; d < c; d++) b[d].dg = a;
a.wi = null
};
X.prototype.copy = function () {
var a = Y.prototype.copy.call(this);
if (null !== a) {
for (var b = this.Y.j, c = b.length, d = 0; d < c; d++) {
var e = b[d].copy();
e.Vi(a);
e.Cj = null;
var f = a.Y, g = f.count;
f.Ib(g, e);
f = a.part;
if (null !== f) {
f.xj = null;
null !== e.portId && f instanceof V && (f.zh = !0);
var h = a.diagram;
null !== h && h.undoManager.isUndoingRedoing || f.ab(te, "elements", a, null, e, null, g)
}
}
return a
}
return null
};
t = X.prototype;
t.toString = function () {
return "Panel(" + this.type + ")#" + lb(this)
};
t.Go = function (a) {
Y.prototype.Go.call(this, a);
for (var b = this.Y.j, c = b.length, d = 0; d < c; d++) b[d].Go(a)
};
t.Fi = function (a, b) {
if (this.va === X.Grid) {
b = this.De() * b.scale;
0 >= b && (b = 1);
var c = this.gridCellSize, d = c.width;
c = c.height;
var e = this.naturalBounds, f = this.actualBounds, g = e.width, h = e.height, k = Math.ceil(g / d),
l = Math.ceil(h / c), m = this.gridOrigin;
a.save();
a.beginPath();
a.rect(0, 0, g, h);
a.clip();
for (var n = [], p = this.Y.j, r = p.length, q = 0; q < r; q++) {
var u = p[q], v = [];
n.push(v);
if (u.visible) {
u = Cj(u.figure);
for (var w = q + 1; w < r; w++) {
var z = p[w];
z.visible && Cj(z.figure) === u && (z = z.interval, 2 <= z && v.push(z))
}
}
}
p = this.Y.j;
r = p.length;
for (q = 0; q < r; q++) {
var y = p[q];
if (y.visible && (v = y.interval, !(2 > d * v * b))) {
u = y.opacity;
w = 1;
if (1 !== u) {
if (0 === u) continue;
w = a.globalAlpha;
a.globalAlpha = w * u
}
z = n[q];
var A = !1, C = y.strokeDashArray;
null !== C && (A = !0, a.Ps(C, y.strokeDashOffset));
if ("LineV" === y.figure && null !== y.stroke) {
a.lineWidth = y.strokeWidth;
Sh(this, a, y.stroke, !1, !1, e, f);
a.beginPath();
for (C = y = Math.floor(-m.x / d); C <= y + k; C++) {
var I = C * d + m.x;
0 <= I && I <= g && Bm(C, v, z) && (a.moveTo(I, 0), a.lineTo(I, h))
}
a.stroke()
} else if ("LineH" === y.figure && null !== y.stroke) {
a.lineWidth =
y.strokeWidth;
Sh(this, a, y.stroke, !1, !1, e, f);
a.beginPath();
for (C = y = Math.floor(-m.y / c); C <= y + l; C++) I = C * c + m.y, 0 <= I && I <= h && Bm(C, v, z) && (a.moveTo(0, I), a.lineTo(g, I));
a.stroke()
} else if ("BarV" === y.figure && null !== y.fill) for (Sh(this, a, y.fill, !0, !1, e, f), y = y.width, isNaN(y) && (y = d), I = C = Math.floor(-m.x / d); I <= C + k; I++) {
var K = I * d + m.x;
0 <= K && K <= g && Bm(I, v, z) && a.fillRect(K, 0, y, h)
} else if ("BarH" === y.figure && null !== y.fill) for (Sh(this, a, y.fill, !0, !1, e, f), y = y.height, isNaN(y) && (y = c), I = C = Math.floor(-m.y / c); I <= C + l; I++) K = I * c +
m.y, 0 <= K && K <= h && Bm(I, v, z) && a.fillRect(0, K, g, y);
A && a.Ns();
1 !== u && (a.globalAlpha = w)
}
}
a.restore();
a.Rc(!1)
} else if (this.va === X.Graduated) {
d = b.oj;
b.oj = !0;
e = this.naturalBounds;
c = e.width;
e = e.height;
a.save();
a.beginPath();
a.rect(-1, -1, c + 1, e + 1);
a.clip();
c = this.zb();
c.hc(a, b);
e = this.De() * b.scale;
0 >= e && (e = 1);
f = c.actualBounds;
g = this.Y.j;
h = this.lj;
k = g.length;
for (l = 0; l < k; l++) if (p = g[l], m = h[l], n = m.length, p.visible && p !== c && 0 !== m.length) if (p instanceof W) {
if (!(2 > this.graduatedTickUnit * p.interval * c.geometry.flattenedTotalLength /
this.graduatedRange * e)) for (r = p.measuredBounds, q = p.strokeWidth * p.scale, v = p.alignmentFocus, v.jc() && (v = Ac), u = 0; u < n; u++) w = m[u][0], z = m[u][1], A = v, y = p.tb, y.reset(), y.translate(w.x + f.x, w.y + f.y), y.rotate(z + p.angle, 0, 0), y.translate(-r.width * A.x + A.offsetX + q / 2, -r.height * A.y + A.offsetY + q / 2), y.scale(p.scale, p.scale), el(p, !1), p.Fh.set(p.tb), p.Uk = p.scale, fl(p, !1), p.hc(a, b), p.tb.reset()
} else if (p instanceof Yg) for (null === this.lh && (this.lh = new Yg), r = this.lh, xm(r, p), p = 0; p < n; p++) u = m[p], 3 < u.length && (q = u[6], r.Ob = u[2], r.zc =
u[3], r.oc = u[4], r.nd = u[5], r.qc = u[8], r.arrange(q.x, q.y, q.width, q.height), q = u[6], r.arrange(q.x, q.y, q.width, q.height), v = u[7], u = u[8], w = r.tb, w.reset(), w.translate(q.x + f.x, q.y + f.y), w.translate(-v.x, -v.y), Nk(r, w, u.x, u.y, u.width, u.height), el(r, !1), r.Fh.set(r.tb), r.Uk = r.scale, fl(r, !1), r.hc(a, b));
b.oj = d;
a.restore();
a.Rc(!0)
} else {
this.va === X.Table && (a.lineCap = "butt", Cm(this, a, !0, this.sb, !0), Cm(this, a, !1, this.nb, !0), Dm(this, a, !0, this.sb), Dm(this, a, !1, this.nb), Cm(this, a, !0, this.sb, !1), Cm(this, a, !1, this.nb, !1));
(d = this.isClipping) && a.save();
c = this.zb();
e = this.Y.j;
f = e.length;
for (g = 0; g < f; g++) h = e[g], d && h === c && (a.clipInsteadOfFill = !0), h.hc(a, b), d && h === c && (a.clipInsteadOfFill = !1);
d && (a.restore(), a.Rc(!0))
}
};
function Dm(a, b, c, d) {
for (var e = d.length, f = a.actualBounds, g = a.naturalBounds, h = !0, k = 0; k < e; k++) {
var l = d[k];
if (void 0 !== l) if (h) h = !1; else if (0 !== l.actual) {
if (c) {
if (l.position > f.height) continue
} else if (l.position > f.width) continue;
var m = l.separatorStrokeWidth;
isNaN(m) && (m = c ? a.Kg : a.Jg);
var n = l.separatorStroke;
null === n && (n = c ? a.Xh : a.Ig);
if (0 !== m && null !== n) {
Sh(a, b, n, !1, !1, g, f);
n = !1;
var p = l.separatorDashArray;
null === p && (p = c ? a.Wh : a.Vh);
null !== p && (n = !0, b.Ps(p, 0));
b.beginPath();
p = l.position + m;
c ? p > f.height && (m -=
p - f.height) : p > f.width && (m -= p - f.width);
l = l.position + m / 2;
b.lineWidth = m;
m = a.eb;
c ? (l += m.top, p = f.width - m.right, b.moveTo(m.left, l), b.lineTo(p, l)) : (l += m.left, p = f.height - m.bottom, b.moveTo(l, m.top), b.lineTo(l, p));
b.stroke();
n && b.Ns()
}
}
}
}
function Cm(a, b, c, d, e) {
for (var f = d.length, g = a.actualBounds, h = a.naturalBounds, k = 0; k < f; k++) {
var l = d[k];
if (void 0 !== l && null !== l.background && l.coversSeparators !== e && 0 !== l.actual) {
var m = c ? g.height : g.width;
if (!(l.position > m)) {
var n = l.tc(), p = l.separatorStrokeWidth;
isNaN(p) && (p = c ? a.Kg : a.Jg);
var r = l.separatorStroke;
null === r && (r = c ? a.Xh : a.Ig);
null === r && (p = 0);
n -= p;
p = l.position + p;
n += l.actual;
p + n > m && (n = m - p);
0 >= n || (m = a.eb, Sh(a, b, l.background, !0, !1, h, g), c ? b.fillRect(m.left, p + m.top, g.width - (m.left + m.right), n) : b.fillRect(p +
m.left, m.top, n, g.height - (m.top + m.bottom)))
}
}
}
}
function Bm(a, b, c) {
if (0 !== a % b) return !1;
b = c.length;
for (var d = 0; d < b; d++) if (0 === a % c[d]) return !1;
return !0
}
function Cj(a) {
return "LineV" === a || "BarV" === a
}
t.dk = function (a, b, c, d, e) {
var f = this.Zd(), g = this.transform, h = 1 / (g.m11 * g.m22 - g.m12 * g.m21), k = g.m22 * h, l = -g.m12 * h,
m = -g.m21 * h, n = g.m11 * h, p = h * (g.m21 * g.dy - g.m22 * g.dx), r = h * (g.m12 * g.dx - g.m11 * g.dy);
if (null !== this.areaBackground) return g = this.actualBounds, H.Tc(g.left, g.top, g.right, g.bottom, a, b, c, d, e);
if (null !== this.background) return f = a * k + b * m + p, h = a * l + b * n + r, a = c * k + d * m + p, k = c * l + d * n + r, e.h(0, 0), c = this.naturalBounds, f = H.Tc(0, 0, c.width, c.height, f, h, a, k, e), e.transform(g), f;
f || (k = 1, m = l = 0, n = 1, r = p = 0);
h = a * k + b * m + p;
a = a * l + b *
n + r;
k = c * k + d * m + p;
c = c * l + d * n + r;
e.h(k, c);
d = (k - h) * (k - h) + (c - a) * (c - a);
l = !1;
n = this.Y.j;
r = n.length;
m = G.alloc();
p = null;
b = Infinity;
var q = null;
this.isClipping && (q = G.alloc(), p = this.zb(), (l = p.dk(h, a, k, c, q)) && (b = (h - q.x) * (h - q.x) + (a - q.y) * (a - q.y)));
for (var u = 0; u < r; u++) {
var v = n[u];
v.visible && v !== p && v.dk(h, a, k, c, m) && (l = !0, v = (h - m.x) * (h - m.x) + (a - m.y) * (a - m.y), v < d && (d = v, e.set(m)))
}
this.isClipping && (b > d && e.set(q), G.free(q));
G.free(m);
f && e.transform(g);
return l
};
t.s = function (a) {
Y.prototype.s.call(this, a);
a = null;
if (this.va === X.Auto || this.va === X.Link) a = this.zb();
for (var b = this.Y.j, c = b.length, d = 0; d < c; d++) {
var e = b[d];
(e === a || e.isPanelMain) && e.s(!0);
if (!e.desiredSize.o()) {
var f = Pk(e, !1);
(e instanceof zg || e instanceof X || e instanceof Yg || f !== Bg) && e.s(!0)
}
}
};
t.em = function () {
if (!1 === $i(this)) {
Vi(this, !0);
Qk(this, !0);
for (var a = this.Y.j, b = a.length, c = 0; c < b; c++) a[c].em()
}
};
t.gl = function () {
if (0 !== (this.H & 2048) === !1) {
el(this, !0);
fl(this, !0);
for (var a = this.Y.j, b = a.length, c = 0; c < b; c++) a[c].kv()
}
};
t.kv = function () {
fl(this, !0);
for (var a = this.Y.j, b = a.length, c = 0; c < b; c++) a[c].kv()
};
t.im = function (a, b, c, d) {
var e = this.lg;
e.h(0, 0, 0, 0);
var f = this.desiredSize, g = this.minSize;
void 0 === c && (c = g.width, d = g.height);
c = Math.max(c, g.width);
d = Math.max(d, g.height);
var h = this.maxSize;
isNaN(f.width) || (a = Math.min(f.width, h.width));
isNaN(f.height) || (b = Math.min(f.height, h.height));
a = Math.max(c, a);
b = Math.max(d, b);
var k = this.eb;
a = Math.max(a - k.left - k.right, 0);
b = Math.max(b - k.top - k.bottom, 0);
var l = this.Y.j;
0 !== l.length && this.va.measure(this, a, b, l, e, c, d);
a = e.width + k.left + k.right;
k = e.height + k.top + k.bottom;
isFinite(f.width) && (a = f.width);
isFinite(f.height) && (k = f.height);
a = Math.min(h.width, a);
k = Math.min(h.height, k);
a = Math.max(g.width, a);
k = Math.max(g.height, k);
a = Math.max(c, a);
k = Math.max(d, k);
Wb(e, a, k);
Wb(this.naturalBounds, a, k);
Mk(this, 0, 0, a, k)
};
t.zb = function () {
if (null === this.wi) {
var a = this.Y.j, b = a.length;
if (0 === b) return null;
for (var c = 0; c < b; c++) {
var d = a[c];
if (!0 === d.isPanelMain) return this.wi = d
}
this.wi = a[0]
}
return this.wi
};
function bm(a) {
return null !== a.part ? a.part.locationObject : null
}
t.vh = function (a, b, c, d) {
var e = this.Y.j;
this.actualBounds.h(a, b, c, d);
if (0 !== e.length) {
if (!this.desiredSize.o()) {
a = Pk(this, !0);
var f = this.measuredBounds;
b = f.width;
f = f.height;
var g = this.Wg, h = g.left + g.right;
g = g.top + g.bottom;
b === c && f === d && (a = Bg);
switch (a) {
case Bg:
if (b > c || f > d) this.s(), this.measure(b > c ? c : b, f > d ? d : f, 0, 0);
break;
case wd:
this.s(!0);
this.measure(c + h, d + g, 0, 0);
break;
case Ak:
this.s(!0);
this.measure(c + h, f + g, 0, 0);
break;
case Bk:
this.s(!0), this.measure(b + h, d + g, 0, 0)
}
}
this.va.arrange(this, e, this.lg)
}
};
t.xh = function (a) {
var b = this.naturalBounds, c = bm(this);
if (fc(0, 0, b.width, b.height, a.x, a.y)) {
b = this.Y.j;
for (var d = b.length, e = G.allocAt(0, 0); d--;) {
var f = b[d];
if (f.visible || f === c) if (zb(e.set(a), f.transform), f.da(e)) return G.free(e), !0
}
G.free(e);
return null === this.ib && null === this.dc ? !1 : !0
}
return !1
};
t.Qs = function (a) {
if (this.Fk === a) return this;
for (var b = this.Y.j, c = b.length, d = 0; d < c; d++) {
var e = b[d].Qs(a);
if (null !== e) return e
}
return null
};
t.zm = function (a, b) {
b(this, a);
if (a instanceof X) {
a = a.Y.j;
for (var c = a.length, d = 0; d < c; d++) this.zm(a[d], b)
}
};
function mj(a, b) {
Em(a, a, b)
}
function Em(a, b, c) {
c(b);
b = b.Y.j;
for (var d = b.length, e = 0; e < d; e++) {
var f = b[e];
f instanceof X && Em(a, f, c)
}
}
function Fm(a, b) {
Gm(a, a, b)
}
function Gm(a, b, c) {
c(b);
if (b instanceof X) {
b = b.Y.j;
for (var d = b.length, e = 0; e < d; e++) Gm(a, b[e], c)
}
}
t.Zl = function (a) {
return Hm(this, this, a)
};
function Hm(a, b, c) {
if (c(b)) return b;
if (b instanceof X) {
b = b.Y.j;
for (var d = b.length, e = 0; e < d; e++) {
var f = Hm(a, b[e], c);
if (null !== f) return f
}
}
return null
}
t.$a = function (a) {
if (this.name === a) return this;
var b = this.Y.j, c = b.length;
null === this.gi && null === this.je || (c = Im(this));
for (var d = 0; d < c; d++) {
var e = b[d];
if (e instanceof X) {
var f = e.$a(a);
if (null !== f) return f
}
if (e.name === a) return e
}
return null
};
function Jm(a) {
a = a.Y.j;
for (var b = a.length, c = 0, d = 0; d < b; d++) {
var e = a[d];
if (e instanceof X) c = Math.max(c, Jm(e)); else if (e instanceof W) {
a:{
switch (e.Wk) {
case "None":
case "Square":
case "Ellipse":
case "Circle":
case "LineH":
case "LineV":
case "FramedRectangle":
case "RoundedRectangle":
case "Line1":
case "Line2":
case "Border":
case "Cube1":
case "Cube2":
case "Junction":
case "Cylinder1":
case "Cylinder2":
case "Cylinder3":
case "Cylinder4":
case "PlusLine":
case "XLine":
case "ThinCross":
case "ThickCross":
e = 0;
break a
}
e =
e.jh / 2 * e.Lj * e.De()
}
c = Math.max(c, e)
}
}
return c
}
t.Zd = function () {
return !(this.type === X.TableRow || this.type === X.TableColumn)
};
t.Rb = function (a, b, c) {
if (!1 === this.pickable) return null;
void 0 === b && (b = null);
void 0 === c && (c = null);
if (aj(this)) return null;
var d = this.naturalBounds, e = 1 / this.De(), f = this.Zd(),
g = f ? a : zb(G.allocAt(a.x, a.y), this.transform), h = this.diagram, k = 10, l = 5;
null !== h && (k = h.cm("extraTouchArea"), l = k / 2);
if (fc(-(l * e), -(l * e), d.width + k * e, d.height + k * e, g.x, g.y)) {
if (!this.isAtomic) {
e = this.Y.j;
var m = e.length;
h = G.alloc();
l = (k = this.isClipping) ? this.zb() : null;
if (k && (l.Zd() ? zb(h.set(a), l.transform) : h.set(a), !l.da(h))) return G.free(h),
f || G.free(g), null;
for (var n = bm(this); m--;) {
var p = e[m];
if (p.visible || p === n) if (p.Zd() ? zb(h.set(a), p.transform) : h.set(a), !k || p !== l) {
var r = null;
p instanceof X ? r = p.Rb(h, b, c) : !0 === p.pickable && p.da(h) && (r = p);
if (null !== r && (null !== b && (r = b(r)), null !== r && (null === c || c(r)))) return G.free(h), f || G.free(g), r
}
}
G.free(h)
}
if (null === this.background && null === this.areaBackground) return f || G.free(g), null;
a = fc(0, 0, d.width, d.height, g.x, g.y) ? this : null;
f || G.free(g);
return a
}
f || G.free(g);
return null
};
t.Ii = function (a, b, c, d) {
if (!1 === this.pickable) return !1;
void 0 === b && (b = null);
void 0 === c && (c = null);
var e = this.naturalBounds, f = this.Zd(), g = f ? a : zb(G.allocAt(a.x, a.y), this.transform);
e = fc(0, 0, e.width, e.height, g.x, g.y);
if (this.type === X.TableRow || this.type === X.TableColumn || e) {
if (!this.isAtomic) {
for (var h = this.Y.j, k = h.length, l = G.alloc(), m = bm(this); k--;) {
var n = h[k];
if (n.visible || n === m) {
n.Zd() ? zb(l.set(a), n.transform) : l.set(a);
var p = n;
n = n instanceof X ? n : null;
(null !== n ? n.Ii(l, b, c, d) : p.da(l)) && !1 !== p.pickable &&
(null !== b && (p = b(p)), null === p || null !== c && !c(p) || d.add(p))
}
}
G.free(l)
}
f || G.free(g);
return e && (null !== this.background || null !== this.areaBackground)
}
f || G.free(g);
return !1
};
t.qg = function (a, b, c, d, e, f) {
if (!1 === this.pickable) return !1;
void 0 === b && (b = null);
void 0 === c && (c = null);
var g = f;
void 0 === f && (g = wc.alloc(), g.reset());
g.multiply(this.transform);
if (this.wh(a, g)) return Km(this, b, c, e), void 0 === f && wc.free(g), !0;
if (this.Ic(a, g)) {
if (!this.isAtomic) for (var h = bm(this), k = this.Y.j, l = k.length; l--;) {
var m = k[l];
if (m.visible || m === h) {
var n = m.actualBounds, p = this.naturalBounds;
if (!(n.x > p.width || n.y > p.height || 0 > n.x + n.width || 0 > n.y + n.height)) {
n = m;
m = m instanceof X ? m : null;
p = wc.alloc();
p.set(g);
if (null !== m ? m.qg(a, b, c, d, e, p) : Ok(n, a, d, p)) null !== b && (n = b(n)), null === n || null !== c && !c(n) || e.add(n);
wc.free(p)
}
}
}
void 0 === f && wc.free(g);
return d
}
void 0 === f && wc.free(g);
return !1
};
function Km(a, b, c, d) {
for (var e = a.Y.j, f = e.length; f--;) {
var g = e[f];
if (g.visible) {
var h = g.actualBounds, k = a.naturalBounds;
h.x > k.width || h.y > k.height || 0 > h.x + h.width || 0 > h.y + h.height || (g instanceof X && Km(g, b, c, d), null !== b && (g = b(g)), null === g || null !== c && !c(g) || d.add(g))
}
}
}
t.rg = function (a, b, c, d, e, f) {
if (!1 === this.pickable) return !1;
void 0 === c && (c = null);
void 0 === d && (d = null);
var g = this.naturalBounds, h = this.Zd(), k = h ? a : zb(G.allocAt(a.x, a.y), this.transform),
l = h ? b : zb(G.allocAt(b.x, b.y), this.transform), m = k.Ce(l),
n = 0 < k.x && k.x < g.width && 0 < k.y && k.y < g.height || Ab(k.x, k.y, 0, 0, 0, g.height) <= m || Ab(k.x, k.y, 0, g.height, g.width, g.height) <= m || Ab(k.x, k.y, g.width, g.height, g.width, 0) <= m || Ab(k.x, k.y, g.width, 0, 0, 0) <= m;
g = k.cd(0, 0) <= m && k.cd(0, g.height) <= m && k.cd(g.width, 0) <= m && k.cd(g.width, g.height) <=
m;
h || (G.free(k), G.free(l));
if (n) {
if (!this.isAtomic) {
k = G.alloc();
l = G.alloc();
m = bm(this);
for (var p = this.Y.j, r = p.length; r--;) {
var q = p[r];
if (q.visible || q === m) {
var u = q.actualBounds, v = this.naturalBounds;
if (!h || !(u.x > v.width || u.y > v.height || 0 > u.x + u.width || 0 > u.y + u.height)) if (q.Zd() ? (u = q.transform, zb(k.set(a), u), zb(l.set(b), u)) : (k.set(a), l.set(b)), u = q, q = q instanceof X ? q : null, null !== q ? q.rg(k, l, c, d, e, f) : u.hx(k, l, e)) null !== c && (u = c(u)), null === u || null !== d && !d(u) || f.add(u)
}
}
G.free(k);
G.free(l)
}
return e ? n : g
}
return !1
};
function gm(a) {
var b = null;
a instanceof W && (b = a.spot1, b === ad && (b = null), a = a.geometry, null !== a && null === b && (b = a.spot1));
null === b && (b = zc);
return b
}
function hm(a) {
var b = null;
a instanceof W && (b = a.spot2, b === ad && (b = null), a = a.geometry, null !== a && null === b && (b = a.spot2));
null === b && (b = Jc);
return b
}
t.add = function (a) {
this.Ib(this.Y.count, a)
};
t.N = function (a) {
return this.Y.N(a)
};
t.Ib = function (a, b) {
b instanceof S && B("Cannot add a Part to a Panel: " + b + "; use a Panel instead");
if (this === b || this.ug(b)) this === b && B("Cannot make a Panel contain itself: " + this.toString()), B("Cannot make a Panel indirectly contain itself: " + this.toString() + " already contains " + b.toString());
var c = b.panel;
null !== c && c !== this && B("Cannot add a GraphObject that already belongs to another Panel to this Panel: " + b.toString() + ", already contained by " + c.toString() + ", cannot be shared by this Panel: " + this.toString());
this.va !== X.Grid || b instanceof W || B("Can only add Shapes to a Grid Panel, not: " + b);
this.va !== X.Graduated || b instanceof W || b instanceof Yg || B("Can only add Shapes or TextBlocks to a Graduated Panel, not: " + b);
b.Vi(this);
b.Cj = null;
if (null !== this.itemArray) {
var d = b.data;
null !== d && "object" === typeof d && (null === this.Ed && (this.Ed = new vb), this.Ed.add(d, b))
}
var e = this.Y;
d = -1;
if (c === this) {
for (var f = -1, g = this.Y.j, h = g.length, k = 0; k < h; k++) if (g[k] === b) {
f = k;
break
}
if (-1 !== f) {
if (f === a || f + 1 >= e.count && a >= e.count) return;
e.mb(f);
d = f
} else B("element " + b.toString() + " has panel " + c.toString() + " but is not contained by it.")
}
if (0 > a || a > e.count) a = e.count;
e.Ib(a, b);
if (0 === a || b.isPanelMain) this.wi = null;
$i(this) || this.s();
b.s(!1);
null !== b.portId ? this.zh = !0 : b instanceof X && !0 === b.zh && (this.zh = !0);
this.Qg = null;
c = this.part;
null !== c && (c.xj = null, c.Xg = NaN, this.zh && c instanceof V && (c.zh = !0), c.zh && c instanceof V && (c.rc = null), e = this.diagram, null !== e && e.undoManager.isUndoingRedoing || (-1 !== d && c.ab(ue, "elements", this, b, null, d, null), c.ab(te,
"elements", this, null, b, null, a), this.vg() || Lm(this, b, !1)))
};
function Mm(a, b) {
a.H = b ? a.H | 16777216 : a.H & -16777217
}
t.remove = function (a) {
for (var b = this.Y.j, c = b.length, d = -1, e = 0; e < c; e++) if (b[e] === a) {
d = e;
break
}
-1 !== d && this.xc(d, !0)
};
t.mb = function (a) {
0 <= a && this.xc(a, !0)
};
t.xc = function (a, b) {
var c = this.Y, d = c.N(a);
d.Cj = null;
d.Vi(null);
if (null !== this.Ed) {
var e = d.data;
"object" === typeof e && this.Ed.remove(e)
}
c.mb(a);
Vi(this, !1);
this.s();
this.wi === d && (this.wi = null);
this.Qg = null;
var f = this.part;
null !== f && (f.xj = null, f.Xg = NaN, f.Jb(), f instanceof V && (d instanceof X ? d.zm(d, function (a, c) {
vl(f, c, b)
}) : vl(f, d, b)), c = this.diagram, null !== c && c.undoManager.isUndoingRedoing || f.ab(ue, "elements", this, d, null, a, null))
};
X.prototype.getRowDefinition = function (a) {
0 > a && va(a, ">= 0", X, "getRowDefinition:idx");
a = Math.round(a);
var b = this.sb;
if (void 0 === b) return null;
if (void 0 === b[a]) {
var c = new Aj;
c.Vi(this);
c.isRow = !0;
c.index = a;
b[a] = c
}
return b[a]
};
X.prototype.Cv = function (a) {
0 > a && va(a, ">= 0", X, "removeRowDefinition:idx");
a = Math.round(a);
var b = this.sb;
void 0 !== b && (this.ab(ue, "coldefs", this, b[a], null, a, null), b[a] && delete b[a], this.s())
};
X.prototype.getColumnDefinition = function (a) {
0 > a && va(a, ">= 0", X, "getColumnDefinition:idx");
a = Math.round(a);
var b = this.nb;
if (void 0 === b) return null;
if (void 0 === b[a]) {
var c = new Aj;
c.Vi(this);
c.isRow = !1;
c.index = a;
b[a] = c
}
return b[a]
};
t = X.prototype;
t.Av = function (a) {
0 > a && va(a, ">= 0", X, "removeColumnDefinition:idx");
a = Math.round(a);
var b = this.nb;
void 0 !== b && (this.ab(ue, "coldefs", this, b[a], null, a, null), b[a] && delete b[a], this.s())
};
t.Oy = function (a) {
if (0 > a || this.type !== X.Table) return -1;
for (var b = 0, c = this.sb, d = c.length, e = this.zi; e < d; e++) {
var f = c[e];
if (void 0 !== f && (b += f.total, a < b)) break
}
return e
};
t.Gy = function (a) {
if (0 > a || this.type !== X.Table) return -1;
for (var b = 0, c = this.nb, d = c.length, e = this.ii; e < d; e++) {
var f = c[e];
if (void 0 !== f && (b += f.total, a < b)) break
}
return e
};
t.fz = function (a, b) {
void 0 === b && (b = new G(NaN, NaN));
if (this.type !== X.Graduated) return b.h(NaN, NaN), b;
a = Math.min(Math.max(a, this.graduatedMin), this.graduatedMax);
var c = this.zb();
c.geometry.ev((a - this.graduatedMin) / this.graduatedRange, b);
return c.transform.ta(b)
};
t.gz = function (a) {
if (this.type !== X.Graduated) return NaN;
var b = this.zb();
b.transform.Ud(a);
return b.geometry.kx(a) * this.graduatedRange + this.graduatedMin
};
function ml(a) {
a = a.Sh;
return null !== a && a.v
}
function Ag(a) {
var b = a.Sh;
if (null === b) null !== a.data && B("Template cannot have .data be non-null: " + a), a.Sh = b = new E; else if (b.v) return;
var c = new E;
Mm(a, !1);
a.zm(a, function (a, d) {
var e = d.bb;
if (null !== e) for (jl(d, !1), e = e.iterator; e.next();) {
var f = e.value;
f.mode === Nm && jl(d, !0);
var g = f.sourceName;
null !== g && ("/" === g && Mm(a, !0), g = Lk(f, a, d), null !== g && (c.add(g), null === g.Gl && (g.Gl = new E), g.Gl.add(f)));
b.add(f)
}
if (d instanceof X && d.type === X.Table) {
if (0 < d.sb.length) for (a = d.sb, e = a.length, f = 0; f < e; f++) if (g = a[f], void 0 !==
g && null !== g.bb) for (var h = g.bb.iterator; h.next();) {
var k = h.value;
k.Qd = g;
k.zp = 2;
k.Ol = g.index;
b.add(k)
}
if (0 < d.nb.length) for (d = d.nb, a = d.length, e = 0; e < a; e++) if (f = d[e], void 0 !== f && null !== f.bb) for (g = f.bb.iterator; g.next();) h = g.value, h.Qd = f, h.zp = 1, h.Ol = f.index, b.add(h)
}
});
for (var d = c.iterator; d.next();) {
var e = d.value;
if (null !== e.Gl) {
jl(e, !0);
for (var f = e.Gl.iterator; f.next();) {
var g = f.value;
null === e.bb && (e.bb = new E);
e.bb.add(g)
}
}
e.Gl = null
}
for (d = b.iterator; d.next();) if (e = d.value, f = e.Qd, null !== f) {
e.Qd = null;
var h =
e.targetProperty, k = h.indexOf(".");
0 < k && f instanceof X && (g = h.substring(0, k), h = h.substr(k + 1), k = f.$a(g), null !== k ? (f = k, e.targetProperty = h) : wa('Warning: unable to find GraphObject named "' + g + '" for Binding: ' + e.toString()));
f instanceof Aj ? (g = lb(f.panel), e.Zi = void 0 === g ? -1 : g, f.panel.Fk = e.Zi) : f instanceof Y ? (g = lb(f), e.Zi = void 0 === g ? -1 : g, f.Fk = e.Zi) : B("Unknown type of binding target: " + f)
}
b.freeze();
a instanceof S && a.bc() && a.$b()
}
t.uy = function () {
var a = this.copy();
Fm(a, function (a) {
a instanceof X && (a.Sh = null, a.jb = null);
var b = a.bb;
null !== b && (a.bb = null, b.each(function (b) {
a.bind(b.copy())
}))
});
return a
};
t.Ea = function (a) {
var b = this.Sh;
if (null !== b) for (void 0 === a && (a = ""), b = b.iterator; b.next();) {
var c = b.value, d = c.sourceProperty;
if ("" === a || "" === d || d === a) if (d = c.targetProperty, null !== c.converter || "" !== d) {
d = this.data;
var e = c.sourceName;
if (null !== e) d = "" === e ? this : "/" === e ? this : "." === e ? this : ".." === e ? this : this.$a(e); else {
var f = this.diagram;
null !== f && c.isToModel && (d = f.model.modelData)
}
if (null !== d) {
f = this;
var g = c.Zi;
if (-1 !== g) {
if (f = this.Qs(g), null === f) continue
} else null !== c.Qd && (f = c.Qd);
"/" === e ? d = f.part : "." ===
e ? d = f : ".." === e && (d = f.panel);
e = c.zp;
if (0 !== e) {
if (!(f instanceof X)) continue;
1 === e ? f = f.getColumnDefinition(c.Ol) : 2 === e && (f = f.getRowDefinition(c.Ol))
}
void 0 !== f && c.Zv(f, d)
}
}
}
};
function Om(a, b) {
a = a.Y.j;
for (var c = a.length, d = b.length, e = 0, f = null; e < c && !(f = a[e], f instanceof X && null !== f.data);) e++, f = a[e];
if (c - e !== d) return !0;
if (null === f) return 0 < d;
for (var g = 0; e < c && g < d;) {
f = a[e];
if (!(f instanceof X) || f.data !== b[g]) return !0;
e++;
g++
}
return !1
}
function Im(a) {
if (a.type === X.Spot || a.type === X.Auto) return Math.min(a.Y.length, 1);
if (a.type === X.Link) {
a = a.Y;
for (var b = a.length, c = 0; c < b; c++) {
var d = a.N(c);
if (!(d instanceof W && d.isPanelMain)) break
}
return c
}
return a.type === X.Table && 0 < a.Y.length && (a = a.Y.N(0), a.isPanelMain && a instanceof X && (a.type === X.TableRow || a.type === X.TableColumn)) ? 1 : 0
}
t.nt = function () {
for (var a = Im(this); this.Y.length > a;) this.xc(this.Y.length - 1, !1);
a = this.itemArray;
if (null !== a) for (var b = a.length, c = 0; c < b; c++) Pm(this, a[c], c)
};
t.gx = function (a) {
return void 0 === a || null === a || null === this.Ed ? null : this.Ed.J(a)
};
function Pm(a, b, c) {
if (!(void 0 === b || null === b || 0 > c)) {
var d = Qm(a, b), e = a.itemTemplateMap, f = null;
null !== e && (f = e.J(d));
null === f && (Rm || (Rm = !0, wa('No item template Panel found for category "' + d + '" on ' + a), wa(" Using default item template."), d = new X, e = new Yg, e.bind(new si("text", "", Ja)), d.add(e), Sm = d), f = Sm);
d = f;
null !== d && (Ag(d), d = d.copy(), 0 !== (d.H & 16777216) && (e = a.Ji(), null !== e && Mm(e, !0)), "object" === typeof b && (null === a.Ed && (a.Ed = new vb), a.Ed.add(b, d)), e = c + Im(a), a.Ib(e, d), d.jb = b, Tm(a, e, c), d.jb = null, d.data =
b)
}
}
function Tm(a, b, c) {
for (a = a.Y; b < a.length;) {
var d = a.N(b);
if (d instanceof X) {
var e = b, f = c;
d.type === X.TableRow ? d.row = e : d.type === X.TableColumn && (d.column = e);
d.itemIndex = f
}
b++;
c++
}
}
function Qm(a, b) {
if (null === b) return "";
a = a.hl;
if ("function" === typeof a) a = a(b); else if ("string" === typeof a && "object" === typeof b) {
if ("" === a) return "";
a = Um(b, a)
} else return "";
if (void 0 === a) return "";
if ("string" === typeof a) return a;
B("Panel.getCategoryForItemData found a non-string category for " + b + ": " + a);
return ""
}
function Lm(a, b, c) {
var d = b.enabledChanged;
null !== d && d(b, c);
if (b instanceof X) {
b = b.Y.j;
d = b.length;
for (var e = 0; e < d; e++) {
var f = b[e];
c && f instanceof X && !f.isEnabled || Lm(a, f, c)
}
}
}
function Vm(a, b) {
ql.add(a, b)
}
ma.Object.defineProperties(X.prototype, {
type: {
get: function () {
return this.va
}, set: function (a) {
var b = this.va;
b !== a && (this.va = a, this.va === X.Grid ? this.isAtomic = !0 : this.va === X.Table && zm(this), this.s(), this.g("type", b, a))
}
}, elements: {
get: function () {
return this.Y.iterator
}
}, naturalBounds: {
get: function () {
return this.qc
}
}, padding: {
get: function () {
return this.eb
}, set: function (a) {
"number" ===
typeof a ? (0 > a && va(a, ">= 0", X, "padding"), a = new pc(a)) : (0 > a.left && va(a.left, ">= 0", X, "padding:value.left"), 0 > a.right && va(a.right, ">= 0", X, "padding:value.right"), 0 > a.top && va(a.top, ">= 0", X, "padding:value.top"), 0 > a.bottom && va(a.bottom, ">= 0", X, "padding:value.bottom"));
var b = this.eb;
b.A(a) || (this.eb = a = a.I(), this.s(), this.g("padding", b, a))
}
}, defaultAlignment: {
get: function () {
return this.nn
}, set: function (a) {
var b = this.nn;
b.A(a) || (this.nn = a = a.I(), this.s(), this.g("defaultAlignment",
b, a))
}
}, defaultStretch: {
get: function () {
return this.Gf
}, set: function (a) {
var b = this.Gf;
b !== a && (this.Gf = a, this.s(), this.g("defaultStretch", b, a))
}
}, defaultSeparatorPadding: {
get: function () {
return void 0 === this.fj ? uc : this.fj
}, set: function (a) {
if (void 0 !== this.fj) {
"number" === typeof a && (a = new pc(a));
var b = this.fj;
b.A(a) || (this.fj = a = a.I(), this.s(), this.g("defaultSeparatorPadding", b, a))
}
}
}, defaultRowSeparatorStroke: {
get: function () {
return void 0 ===
this.Xh ? null : this.Xh
}, set: function (a) {
var b = this.Xh;
b !== a && (null === a || "string" === typeof a || a instanceof Yk) && (a instanceof Yk && a.freeze(), this.Xh = a, this.R(), this.g("defaultRowSeparatorStroke", b, a))
}
}, defaultRowSeparatorStrokeWidth: {
get: function () {
return void 0 === this.Kg ? 1 : this.Kg
}, set: function (a) {
if (void 0 !== this.Kg) {
var b = this.Kg;
b !== a && isFinite(a) && 0 <= a && (this.Kg = a, this.s(), this.g("defaultRowSeparatorStrokeWidth", b, a))
}
}
}, defaultRowSeparatorDashArray: {
get: function () {
return void 0 === this.Wh ? null : this.Wh
}, set: function (a) {
if (void 0 !== this.Wh) {
var b = this.Wh;
if (b !== a) {
if (null !== a) {
for (var c = a.length, d = 0, e = 0; e < c; e++) {
var f = a[e];
"number" === typeof f && 0 <= f && isFinite(f) || B("defaultRowSeparatorDashArray value " + f + " at index " + e + " must be a positive number or zero.");
d += f
}
if (0 === d) {
if (null === b) return;
a = null
}
}
this.Wh = a;
this.R();
this.g("defaultRowSeparatorDashArray", b, a)
}
}
}
}, defaultColumnSeparatorStroke: {
get: function () {
return void 0 ===
this.Ig ? null : this.Ig
}, set: function (a) {
if (void 0 !== this.Ig) {
var b = this.Ig;
b !== a && (null === a || "string" === typeof a || a instanceof Yk) && (a instanceof Yk && a.freeze(), this.Ig = a, this.R(), this.g("defaultColumnSeparatorStroke", b, a))
}
}
}, defaultColumnSeparatorStrokeWidth: {
get: function () {
return void 0 === this.Jg ? 1 : this.Jg
}, set: function (a) {
if (void 0 !== this.Jg) {
var b = this.Jg;
b !== a && isFinite(a) && 0 <= a && (this.Jg = a, this.s(), this.g("defaultColumnSeparatorStrokeWidth", b, a))
}
}
}, defaultColumnSeparatorDashArray: {
get: function () {
return void 0 === this.Vh ? null : this.Vh
}, set: function (a) {
if (void 0 !== this.Vh) {
var b = this.Vh;
if (b !== a) {
if (null !== a) {
for (var c = a.length, d = 0, e = 0; e < c; e++) {
var f = a[e];
"number" === typeof f && 0 <= f && isFinite(f) || B("defaultColumnSeparatorDashArray value " + f + " at index " + e + " must be a positive number or zero.");
d += f
}
if (0 === d) {
if (null === b) return;
a = null
}
}
this.Vh = a;
this.R();
this.g("defaultColumnSeparatorDashArray", b, a)
}
}
}
}, viewboxStretch: {
get: function () {
return this.Ip
},
set: function (a) {
var b = this.Ip;
b !== a && (this.Ip = a, this.s(), this.g("viewboxStretch", b, a))
}
}, gridCellSize: {
get: function () {
return this.Ln
}, set: function (a) {
var b = this.Ln;
if (!b.A(a)) {
a.o() && 0 !== a.width && 0 !== a.height || B("Invalid Panel.gridCellSize: " + a);
this.Ln = a.I();
var c = this.diagram;
null !== c && this === c.grid && Wi(c);
this.R();
this.g("gridCellSize", b, a)
}
}
}, gridOrigin: {
get: function () {
return this.Mn
}, set: function (a) {
var b = this.Mn;
if (!b.A(a)) {
a.o() ||
B("Invalid Panel.gridOrigin: " + a);
this.Mn = a.I();
var c = this.diagram;
null !== c && this === c.grid && Wi(c);
this.R();
this.g("gridOrigin", b, a)
}
}
}, graduatedMin: {
get: function () {
return this.In
}, set: function (a) {
var b = this.In;
b !== a && (this.In = a, this.s(), this.g("graduatedMin", b, a), Jk(this) && (a = this.part, null !== a && Kk(this, a, "graduatedRange")))
}
}, graduatedMax: {
get: function () {
return this.Hn
}, set: function (a) {
var b = this.Hn;
b !== a && (this.Hn = a, this.s(), this.g("graduatedMax",
b, a), Jk(this) && (a = this.part, null !== a && Kk(this, a, "graduatedRange")))
}
}, graduatedRange: {
get: function () {
return this.graduatedMax - this.graduatedMin
}
}, graduatedTickUnit: {
get: function () {
return this.Kn
}, set: function (a) {
var b = this.Kn;
b !== a && 0 < a && (this.Kn = a, this.s(), this.g("graduatedTickUnit", b, a))
}
}, graduatedTickBase: {
get: function () {
return this.Jn
}, set: function (a) {
var b = this.Jn;
b !== a && (this.Jn = a, this.s(), this.g("graduatedTickBase",
b, a))
}
}, zh: {
get: function () {
return 0 !== (this.H & 8388608)
}, set: function (a) {
0 !== (this.H & 8388608) !== a && (this.H ^= 8388608)
}
}, rowCount: {
get: function () {
return void 0 === this.sb ? 0 : this.sb.length
}
}, columnCount: {
get: function () {
return void 0 === this.nb ? 0 : this.nb.length
}
}, rowSizing: {
get: function () {
return void 0 === this.Hj ? Am : this.Hj
}, set: function (a) {
if (void 0 !== this.Hj) {
var b = this.Hj;
b !== a && (this.Hj =
a, this.s(), this.g("rowSizing", b, a))
}
}
}, columnSizing: {
get: function () {
return void 0 === this.dj ? Am : this.dj
}, set: function (a) {
if (void 0 !== this.dj) {
var b = this.dj;
b !== a && (this.dj = a, this.s(), this.g("columnSizing", b, a))
}
}
}, topIndex: {
get: function () {
return void 0 === this.zi ? 0 : this.zi
}, set: function (a) {
if (void 0 !== this.zi) {
var b = this.zi;
b !== a && ((!isFinite(a) || 0 > a) && B("Panel.topIndex must be greater than zero and a real number, not: " + a), this.zi = a, this.s(),
this.g("topIndex", b, a))
}
}
}, leftIndex: {
get: function () {
return void 0 === this.ii ? 0 : this.ii
}, set: function (a) {
if (void 0 !== this.ii) {
var b = this.ii;
b !== a && ((!isFinite(a) || 0 > a) && B("Panel.leftIndex must be greater than zero and a real number, not: " + a), this.ii = a, this.s(), this.g("leftIndex", b, a))
}
}
}, data: {
get: function () {
return this.jb
}, set: function (a) {
var b = this.jb;
if (b !== a) {
var c = this instanceof S && !(this instanceof Je);
Ag(this);
this.jb = a;
var d = this.diagram;
null !== d && (c ? (c = d.partManager, this instanceof R ? (null !== b && c.Hg.remove(b), null !== a && c.Hg.add(a, this)) : this instanceof S && (null !== b && c.Ne.remove(b), null !== a && c.Ne.add(a, this))) : (c = this.panel, null !== c && null !== c.Ed && (null !== b && c.Ed.remove(b), null !== a && c.Ed.add(a, this))));
this.g("data", b, a);
null !== d && d.undoManager.isUndoingRedoing || null !== a && this.Ea()
}
}
}, itemIndex: {
get: function () {
return this.Zn
}, set: function (a) {
var b = this.Zn;
b !== a && (this.Zn = a, this.g("itemIndex", b, a))
}
}, itemArray: {
get: function () {
return this.gi
}, set: function (a) {
var b = this.gi;
if (b !== a || null !== a && Om(this, a)) {
var c = this.diagram;
b !== a && (null !== c && null !== b && rj(c.partManager, this, c), this.gi = a, null !== c && null !== a && oj(c.partManager, this));
this.g("itemArray", b, a);
null !== c && c.undoManager.isUndoingRedoing || this.nt()
}
}
}, itemTemplate: {
get: function () {
return null === this.je ? null : this.je.J("")
}, set: function (a) {
if (null === this.je) {
if (null === a) return;
this.je = new vb
}
var b = this.je.J("");
b !== a && ((a instanceof S || a.isPanelMain) && B("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: " + a), this.je.add("", a), this.g("itemTemplate", b, a), a = this.diagram, null !== a && a.undoManager.isUndoingRedoing || this.nt())
}
}, itemTemplateMap: {
get: function () {
return this.je
}, set: function (a) {
var b = this.je;
if (b !== a) {
for (var c = a.iterator; c.next();) ;
this.je = a;
this.g("itemTemplateMap", b, a);
a = this.diagram;
null !== a && a.undoManager.isUndoingRedoing || this.nt()
}
}
}, itemCategoryProperty: {
get: function () {
return this.hl
}, set: function (a) {
var b = this.hl;
b !== a && (this.hl = a, this.g("itemCategoryProperty", b, a))
}
}, isAtomic: {
get: function () {
return 0 !== (this.H & 1048576)
}, set: function (a) {
var b = 0 !== (this.H & 1048576);
b !== a && (this.H ^= 1048576, this.g("isAtomic", b, a))
}
}, isClipping: {
get: function () {
return 0 !== (this.H & 2097152)
}, set: function (a) {
var b = 0 !== (this.H & 2097152);
b !== a && (this.H ^= 2097152, this.s(), this.g("isClipping", b, a))
}
}, isOpposite: {
get: function () {
return 0 !== (this.H & 33554432)
}, set: function (a) {
var b = 0 !== (this.H & 33554432);
b !== a && (this.H ^= 33554432, this.s(), this.g("isOpposite", b, a))
}
}, isEnabled: {
get: function () {
return 0 !== (this.H & 4194304)
}, set: function (a) {
var b = 0 !== (this.H & 4194304);
if (b !== a) {
var c = null === this.panel || this.panel.vg();
this.H ^= 4194304;
this.g("isEnabled", b, a);
b = this.diagram;
null !== b && b.undoManager.isUndoingRedoing || c && Lm(this, this, a)
}
}
}, alignmentFocusName: {
get: function () {
return this.Cg
}, set: function (a) {
var b = this.Cg;
b !== a && (this.Cg = a, this.s(), this.g("alignmentFocusName", b, a))
}
}
});
ma.Object.defineProperties(X, {
Position: {
get: function () {
return ql.J("Position")
}
}, Horizontal: {
get: function () {
return ql.J("Horizontal")
}
}, Vertical: {
get: function () {
return ql.J("Vertical")
}
}, Spot: {
get: function () {
return ql.J("Spot")
}
}, Auto: {
get: function () {
return ql.J("Auto")
}
}, Table: {
get: function () {
return ql.J("Table")
}
}, Viewbox: {
get: function () {
return ql.J("Viewbox")
}
}, TableRow: {
get: function () {
return ql.J("TableRow")
}
}, TableColumn: {
get: function () {
return ql.J("TableColumn")
}
}, Link: {
get: function () {
return ql.J("Link")
}
}, Grid: {
get: function () {
return ql.J("Grid")
}
}, Graduated: {
get: function () {
return ql.J("Graduated")
}
}
});
X.prototype.findItemPanelForData = X.prototype.gx;
X.prototype.rebuildItemElements = X.prototype.nt;
X.prototype.updateTargetBindings = X.prototype.Ea;
X.prototype.copyTemplate = X.prototype.uy;
X.prototype.graduatedValueForPoint = X.prototype.gz;
X.prototype.graduatedPointForValue = X.prototype.fz;
X.prototype.findColumnForLocalX = X.prototype.Gy;
X.prototype.findRowForLocalY = X.prototype.Oy;
X.prototype.removeColumnDefinition = X.prototype.Av;
X.prototype.removeRowDefinition = X.prototype.Cv;
X.prototype.removeAt = X.prototype.mb;
X.prototype.remove = X.prototype.remove;
X.prototype.insertAt = X.prototype.Ib;
X.prototype.elt = X.prototype.N;
X.prototype.add = X.prototype.add;
X.prototype.findObject = X.prototype.$a;
X.prototype.findInVisualTree = X.prototype.Zl;
X.prototype.walkVisualTreeFrom = X.prototype.zm;
X.prototype.findMainElement = X.prototype.zb;
var Rm = !1, Sm = null, ql = new vb;
X.className = "Panel";
X.definePanelLayout = Vm;
Vm("Position", new am);
Vm("Vertical", new dm);
Vm("Auto", new fm);
Vm("Link", new pm);
Vm("Grid", new om);
function Aj() {
ab(this);
this.dg = null;
this.Gr = !0;
this.Sa = 0;
this.Pc = NaN;
this.Zg = 0;
this.Yg = Infinity;
this.wb = ad;
this.sa = this.ka = 0;
this.bb = null;
this.rp = Wm;
this.we = zk;
this.np = this.hg = null;
this.op = NaN;
this.ib = this.Jj = null;
this.hn = !1
}
Aj.prototype.copy = function () {
var a = new Aj;
a.Gr = this.Gr;
a.Sa = this.Sa;
a.Pc = this.Pc;
a.Zg = this.Zg;
a.Yg = this.Yg;
a.wb = this.wb;
a.ka = this.ka;
a.sa = this.sa;
a.we = this.we;
a.rp = this.rp;
null === this.hg ? a.hg = null : a.hg = this.hg.I();
a.np = this.np;
a.op = this.op;
a.Jj = null;
null !== this.Jj && (a.separatorDashArray = Aa(this.separatorDashArray));
a.ib = this.ib;
a.hn = this.hn;
a.bb = this.bb;
return a
};
t = Aj.prototype;
t.Wl = function (a) {
a.isRow ? this.height = a.height : this.width = a.width;
this.minimum = a.minimum;
this.maximum = a.maximum;
this.alignment = a.alignment;
this.stretch = a.stretch;
this.sizing = a.sizing;
this.hg = null === a.separatorPadding ? null : a.separatorPadding.I();
this.separatorStroke = a.separatorStroke;
this.separatorStrokeWidth = a.separatorStrokeWidth;
this.Jj = null;
a.separatorDashArray && (this.Jj = Aa(a.separatorDashArray));
this.background = a.background;
this.coversSeparators = a.coversSeparators;
this.bb = a.bb
};
t.fb = function (a) {
a.classType === Aj && (this.sizing = a)
};
t.toString = function () {
return "RowColumnDefinition " + (this.isRow ? "(Row " : "(Column ") + this.index + ") #" + lb(this)
};
t.Vi = function (a) {
this.dg = a
};
t.Pu = function () {
var a = 0, b = 0, c = this.dg, d = this.isRow;
if (null !== c && c.type === X.Table) for (var e = d ? c.sb.length : c.nb.length, f = 0; f < e; f++) {
var g = d ? c.sb[f] : c.nb[f];
if (void 0 !== g) {
b = g.index;
break
}
}
this.index !== b && (b = this.separatorStroke, null === b && null !== c && (b = this.isRow ? c.defaultRowSeparatorStroke : c.defaultColumnSeparatorStroke), null !== b && (a = this.separatorStrokeWidth, isNaN(a) && (null !== c ? a = this.isRow ? c.defaultRowSeparatorStrokeWidth : c.defaultColumnSeparatorStrokeWidth : a = 0)));
b = this.hg;
if (null === b) if (null !== c) b =
c.defaultSeparatorPadding; else return a;
return a + (this.isRow ? b.top : b.left)
};
t.tc = function () {
var a = 0, b = this.dg, c = 0, d = this.isRow;
if (null !== b && b.type === X.Table) for (var e = d ? b.sb.length : b.nb.length, f = 0; f < e; f++) {
var g = d ? b.sb[f] : b.nb[f];
if (void 0 !== g) {
c = g.index;
break
}
}
this.index !== c && (c = this.separatorStroke, null === c && null !== b && (c = d ? b.defaultRowSeparatorStroke : b.defaultColumnSeparatorStroke), null !== c && (a = this.separatorStrokeWidth, isNaN(a) && (null !== b ? a = d ? b.defaultRowSeparatorStrokeWidth : b.defaultColumnSeparatorStrokeWidth : a = 0)));
d = this.hg;
if (null === d) if (null !== b) d = b.defaultSeparatorPadding;
else return a;
return a + (this.isRow ? d.top + d.bottom : d.left + d.right)
};
t.yb = function (a, b, c) {
var d = this.dg;
if (null !== d && (d.ab(re, a, this, b, c, void 0, void 0), null !== this.bb && (b = d.diagram, null !== b && !b.skipsModelSourceBindings && (d = d.Ji(), null !== d && (b = d.data, null !== b))))) for (c = this.bb.iterator; c.next();) c.value.yq(this, b, a, d)
};
function jm(a) {
if (a.sizing === Wm) {
var b = a.dg;
return a.isRow ? b.rowSizing : b.columnSizing
}
return a.sizing
}
t.bind = function (a) {
a.Qd = this;
var b = this.panel;
if (null !== b) {
var c = b.Ji();
null !== c && ml(c) && B("Cannot add a Binding to a RowColumnDefinition that is already frozen: " + a + " on " + b)
}
null === this.bb && (this.bb = new E);
this.bb.add(a)
};
ma.Object.defineProperties(Aj.prototype, {
panel: {
get: function () {
return this.dg
}
}, isRow: {
get: function () {
return this.Gr
}, set: function (a) {
this.Gr = a
}
}, index: {
get: function () {
return this.Sa
}, set: function (a) {
this.Sa = a
}
}, height: {
get: function () {
return this.Pc
}, set: function (a) {
var b = this.Pc;
b !== a && (0 > a && va(a, ">= 0", Aj, "height"), this.Pc = a, this.actual = this.ka, null !== this.panel && this.panel.s(),
this.yb("height", b, a))
}
}, width: {
get: function () {
return this.Pc
}, set: function (a) {
var b = this.Pc;
b !== a && (0 > a && va(a, ">= 0", Aj, "width"), this.Pc = a, this.actual = this.ka, null !== this.panel && this.panel.s(), this.yb("width", b, a))
}
}, minimum: {
get: function () {
return this.Zg
}, set: function (a) {
var b = this.Zg;
b !== a && ((0 > a || !isFinite(a)) && va(a, ">= 0", Aj, "minimum"), this.Zg = a, this.actual = this.ka, null !== this.panel && this.panel.s(), this.yb("minimum", b, a))
}
}, maximum: {
get: function () {
return this.Yg
}, set: function (a) {
var b = this.Yg;
b !== a && (0 > a && va(a, ">= 0", Aj, "maximum"), this.Yg = a, this.actual = this.ka, null !== this.panel && this.panel.s(), this.yb("maximum", b, a))
}
}, alignment: {
get: function () {
return this.wb
}, set: function (a) {
var b = this.wb;
b.A(a) || (this.wb = a.I(), null !== this.panel && this.panel.s(), this.yb("alignment", b, a))
}
}, stretch: {
get: function () {
return this.we
}, set: function (a) {
var b = this.we;
b !== a && (this.we =
a, null !== this.panel && this.panel.s(), this.yb("stretch", b, a))
}
}, separatorPadding: {
get: function () {
return this.hg
}, set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.hg;
null !== a && null !== b && b.A(a) || (null !== a && (a = a.I()), this.hg = a, null !== this.panel && this.panel.s(), this.yb("separatorPadding", b, a))
}
}, separatorStroke: {
get: function () {
return this.np
}, set: function (a) {
var b = this.np;
b !== a && (null !== a && ul(a, "RowColumnDefinition.separatorStroke"),
a instanceof Yk && a.freeze(), this.np = a, null !== this.panel && this.panel.s(), this.yb("separatorStroke", b, a))
}
}, separatorStrokeWidth: {
get: function () {
return this.op
}, set: function (a) {
var b = this.op;
b !== a && (this.op = a, null !== this.panel && this.panel.s(), this.yb("separatorStrokeWidth", b, a))
}
}, separatorDashArray: {
get: function () {
return this.Jj
}, set: function (a) {
var b = this.Jj;
if (b !== a) {
if (null !== a) {
for (var c = a.length, d = 0, e = 0; e < c; e++) {
var f = a[e];
"number" ===
typeof f && 0 <= f && isFinite(f) || B("separatorDashArray value " + f + " at index " + e + " must be a positive number or zero.");
d += f
}
if (0 === d) {
if (null === b) return;
a = null
}
}
this.Jj = a;
null !== this.panel && this.panel.R();
this.yb("separatorDashArray", b, a)
}
}
}, background: {
get: function () {
return this.ib
}, set: function (a) {
var b = this.ib;
b !== a && (null !== a && ul(a, "RowColumnDefinition.background"), a instanceof Yk && a.freeze(), this.ib = a, null !== this.panel && this.panel.R(), this.yb("background", b, a))
}
}, coversSeparators: {
get: function () {
return this.hn
}, set: function (a) {
var b = this.hn;
b !== a && (this.hn = a, null !== this.panel && this.panel.R(), this.yb("coversSeparators", b, a))
}
}, sizing: {
get: function () {
return this.rp
}, set: function (a) {
var b = this.rp;
b !== a && (this.rp = a, null !== this.panel && this.panel.s(), this.yb("sizing", b, a))
}
}, actual: {
get: function () {
return this.ka
}, set: function (a) {
this.ka = isNaN(this.Pc) ? Math.max(Math.min(this.Yg, a), this.Zg) : Math.max(Math.min(this.Yg,
this.Pc), this.Zg)
}
}, total: {
get: function () {
return this.ka + this.tc()
}, set: function (a) {
this.ka = isNaN(this.Pc) ? Math.max(Math.min(this.Yg, a), this.Zg) : Math.max(Math.min(this.Yg, this.Pc), this.Zg);
this.ka = Math.max(0, this.ka - this.tc())
}
}, position: {
get: function () {
return this.sa
}, set: function (a) {
this.sa = a
}
}
});
Aj.prototype.bind = Aj.prototype.bind;
Aj.prototype.computeEffectiveSpacing = Aj.prototype.tc;
Aj.prototype.computeEffectiveSpacingTop = Aj.prototype.Pu;
var Wm = new D(Aj, "Default", 0), km = new D(Aj, "None", 1), Am = new D(Aj, "ProportionalExtra", 2);
Aj.className = "RowColumnDefinition";
Aj.Default = Wm;
Aj.None = km;
Aj.ProportionalExtra = Am;
function W() {
Y.call(this);
this.Pd = this.qa = null;
this.Wk = "None";
this.Gn = zk;
this.Gc = this.Xk = "black";
this.jh = 1;
this.Jl = "butt";
this.Kl = "miter";
this.Lj = 10;
this.hh = null;
this.ih = 0;
this.ef = this.df = ad;
this.Oo = this.No = NaN;
this.Rn = !1;
this.Qo = null;
this.Zk = this.Ql = "None";
this.Cd = 1;
this.Bd = 0;
this.zd = 1;
this.Ad = null
}
la(W, Y);
W.prototype.cloneProtected = function (a) {
Y.prototype.cloneProtected.call(this, a);
a.qa = this.qa;
a.Wk = this.Wk;
a.Gn = this.Gn;
a.Pd = this.Pd;
a.Xk = this.Xk;
a.Gc = this.Gc;
a.jh = this.jh;
a.Jl = this.Jl;
a.Kl = this.Kl;
a.Lj = this.Lj;
null !== this.hh && (a.hh = Aa(this.hh));
a.ih = this.ih;
a.df = this.df.I();
a.ef = this.ef.I();
a.No = this.No;
a.Oo = this.Oo;
a.Rn = this.Rn;
a.Qo = this.Qo;
a.Ql = this.Ql;
a.Zk = this.Zk;
a.Cd = this.Cd;
a.Bd = this.Bd;
a.zd = this.zd;
a.Ad = this.Ad
};
t = W.prototype;
t.fb = function (a) {
a === Bg || a === Dg || a === Ck || a === zk ? this.geometryStretch = a : Y.prototype.fb.call(this, a)
};
t.toString = function () {
return "Shape(" + ("None" !== this.figure ? this.figure : "None" !== this.toArrow ? this.toArrow : this.fromArrow) + ")#" + lb(this)
};
function Xm(a, b, c, d) {
var e = c.length;
if (!(4 > e)) {
var f = d.measuredBounds, g = Math.max(1, f.width);
f = f.height;
for (var h = c[0], k = c[1], l, m, n, p, r, q, u = 0, v = Da(), w = 2; w < e; w += 2) l = c[w], m = c[w + 1], n = l - h, h = m - k, 0 === n && (n = .001), p = h / n, r = Math.atan2(h, n), q = Math.sqrt(n * n + h * h), v.push([n, r, p, q]), u += q, h = l, k = m;
h = c[0];
k = c[1];
n = d.measuredBounds.width;
d instanceof W && (n -= d.strokeWidth);
1 > n && (n = 1);
e = c = n;
l = g / 2;
m = 0 === l ? !1 : !0;
w = 0;
q = v[w];
n = q[0];
r = q[1];
p = q[2];
q = q[3];
for (var z = 0; .1 <= u;) {
0 === z && (m ? (e = c, e -= l, u -= l, m = !1) : e = c, 0 === e && (e = 1));
if (e >
u) {
Ga(v);
return
}
e > q ? (z = e - q, e = q) : z = 0;
var y = Math.sqrt(e * e / (1 + p * p));
0 > n && (y = -y);
h += y;
k += p * y;
a.translate(h, k);
a.rotate(r);
a.translate(-(g / 2), -(f / 2));
0 === z && d.Fi(a, b);
a.translate(g / 2, f / 2);
a.rotate(-r);
a.translate(-h, -k);
u -= e;
q -= e;
if (0 !== z) {
w++;
if (w === v.length) {
Ga(v);
return
}
q = v[w];
n = q[0];
r = q[1];
p = q[2];
q = q[3];
e = z
}
}
Ga(v)
}
}
t.Fi = function (a, b) {
var c = this.Gc, d = this.Xk;
if (null !== c || null !== d) {
var e = this.actualBounds, f = this.naturalBounds;
null !== d && Sh(this, a, d, !0, !1, f, e);
null !== c && Sh(this, a, c, !1, !1, f, e);
e = this.part;
f = this.jh;
0 === f && null !== e && (f = e instanceof Je && e.type === X.Link && "Selection" === e.category && e.adornedObject instanceof W && e.adornedPart.zb() === e.adornedObject ? e.adornedObject.strokeWidth : 0);
a.lineWidth = f;
a.lineJoin = this.Kl;
a.lineCap = this.Jl;
a.miterLimit = this.Lj;
var g = !1;
e && b.Ee("drawShadows") && (g = e.isShadowed);
var h =
!0;
null !== c && null === d && (h = !1);
e = !1;
var k = this.strokeDashArray;
null !== k && (e = !0, a.Ps(k, this.ih));
var l = this.qa;
if (null !== l) {
if (l.type === xd) a.beginPath(), a.moveTo(l.startX, l.startY), a.lineTo(l.endX, l.endY), null !== d && a.Td(d), 0 !== f && null !== c && a.Yi(); else if (l.type === Hd) {
var m = l.startX, n = l.startY, p = l.endX, r = l.endY;
k = Math.min(m, p);
l = Math.min(n, r);
m = Math.abs(p - m);
n = Math.abs(r - n);
a.beginPath();
a.rect(k, l, m, n);
null !== d && a.Td(d);
if (null !== c) {
p = d = c = 0;
h && g && (c = a.shadowOffsetX, d = a.shadowOffsetY, p = a.shadowBlur,
a.shadowOffsetX = 0, a.shadowOffsetY = 0, a.shadowBlur = 0);
if (0 !== f) {
if (0 === m || 0 === n) a.beginPath(), a.rect(k, l, Math.max(m, .1), Math.max(n, .1));
a.Yi()
}
h && g && (a.shadowOffsetX = c, a.shadowOffsetY = d, a.shadowBlur = p)
}
} else if (l.type === Id) n = l.startX, k = l.startY, p = l.endX, r = l.endY, l = Math.abs(p - n) / 2, m = Math.abs(r - k) / 2, n = Math.min(n, p) + l, k = Math.min(k, r) + m, a.beginPath(), a.moveTo(n, k - m), a.bezierCurveTo(n + H.Bg * l, k - m, n + l, k - H.Bg * m, n + l, k), a.bezierCurveTo(n + l, k + H.Bg * m, n + H.Bg * l, k + m, n, k + m), a.bezierCurveTo(n - H.Bg * l, k + m, n - l, k + H.Bg *
m, n - l, k), a.bezierCurveTo(n - l, k - H.Bg * m, n - H.Bg * l, k - m, n, k - m), a.closePath(), null !== d && a.Td(d), 0 !== f && null !== c && (h && g ? (f = a.shadowOffsetX, g = a.shadowOffsetY, c = a.shadowBlur, a.shadowOffsetX = 0, a.shadowOffsetY = 0, a.shadowBlur = 0, a.Yi(), a.shadowOffsetX = f, a.shadowOffsetY = g, a.shadowBlur = c) : a.Yi()); else if (l.type === vd) for (k = l.figures, l = k.length, m = 0; m < l; m++) {
n = k.j[m];
a.beginPath();
a.moveTo(n.startX, n.startY);
p = n.segments.j;
r = p.length;
for (var q = null, u = 0; u < r; u++) {
var v = p[u];
switch (v.type) {
case Xd:
a.moveTo(v.endX, v.endY);
break;
case Fd:
a.lineTo(v.endX, v.endY);
break;
case Yd:
a.bezierCurveTo(v.point1X, v.point1Y, v.point2X, v.point2Y, v.endX, v.endY);
break;
case Zd:
a.quadraticCurveTo(v.point1X, v.point1Y, v.endX, v.endY);
break;
case $d:
if (v.radiusX === v.radiusY) {
var w = Math.PI / 180;
a.arc(v.point1X, v.point1Y, v.radiusX, v.startAngle * w, (v.startAngle + v.sweepAngle) * w, 0 > v.sweepAngle, null !== q ? q.endX : n.startX, null !== q ? q.endY : n.startY)
} else if (q = be(v, n), w = q.length, 0 === w) a.lineTo(v.centerX, v.centerY); else for (var z = 0; z < w; z++) {
var y = q[z];
0 ===
z && a.lineTo(y[0], y[1]);
a.bezierCurveTo(y[2], y[3], y[4], y[5], y[6], y[7])
}
break;
case ae:
z = w = 0;
if (null !== q && q.type === $d) {
q = be(q, n);
y = q.length;
if (0 === y) {
a.lineTo(v.centerX, v.centerY);
break
}
q = q[y - 1] || null;
null !== q && (w = q[6], z = q[7])
} else w = null !== q ? q.endX : n.startX, z = null !== q ? q.endY : n.startY;
q = ce(v, n, w, z);
w = q.length;
if (0 === w) {
a.lineTo(v.centerX, v.centerY);
break
}
for (z = 0; z < w; z++) y = q[z], a.bezierCurveTo(y[2], y[3], y[4], y[5], y[6], y[7]);
break;
default:
B("Segment not of valid type: " + v.type)
}
v.isClosed && a.closePath();
q = v
}
g ? (u = r = p = 0, n.isShadowed ? (!0 === n.isFilled && null !== d ? (a.Td(d), h = !0) : h = !1, 0 !== f && null !== c && (h && (p = a.shadowOffsetX, r = a.shadowOffsetY, u = a.shadowBlur, a.shadowOffsetX = 0, a.shadowOffsetY = 0, a.shadowBlur = 0), a.Yi(), h && (a.shadowOffsetX = p, a.shadowOffsetY = r, a.shadowBlur = u))) : (h && (p = a.shadowOffsetX, r = a.shadowOffsetY, u = a.shadowBlur, a.shadowOffsetX = 0, a.shadowOffsetY = 0, a.shadowBlur = 0), !0 === n.isFilled && null !== d && a.Td(d), 0 !== f && null !== c && a.Yi(), h && (a.shadowOffsetX = p, a.shadowOffsetY = r, a.shadowBlur = u))) : (!0 === n.isFilled &&
null !== d && a.Td(d), 0 !== f && null !== c && a.Yi())
}
e && a.Ns();
if (null !== this.pathPattern) {
e = this.pathPattern;
e.measure(Infinity, Infinity);
f = e.measuredBounds;
e.arrange(0, 0, f.width, f.height);
g = this.geometry;
a.save();
a.beginPath();
f = Da();
if (g.type === xd) f.push(g.startX), f.push(g.startY), f.push(g.endX), f.push(g.endY), Xm(a, b, f, e); else if (g.type === vd) for (g = g.figures.iterator; g.next();) {
c = g.value;
f.length = 0;
f.push(c.startX);
f.push(c.startY);
d = c.startX;
h = c.startY;
k = d;
l = h;
m = c.segments.j;
n = m.length;
for (p = 0; p < n; p++) {
r =
m[p];
switch (r.type) {
case Xd:
Xm(a, b, f, e);
f.length = 0;
f.push(r.endX);
f.push(r.endY);
d = r.endX;
h = r.endY;
k = d;
l = h;
break;
case Fd:
f.push(r.endX);
f.push(r.endY);
d = r.endX;
h = r.endY;
break;
case Yd:
H.Ae(d, h, r.point1X, r.point1Y, r.point2X, r.point2Y, r.endX, r.endY, .5, f);
d = r.endX;
h = r.endY;
break;
case Zd:
H.nq(d, h, r.point1X, r.point1Y, r.endX, r.endY, .5, f);
d = r.endX;
h = r.endY;
break;
case $d:
u = be(r, c);
v = u.length;
if (0 === v) {
f.push(r.centerX);
f.push(r.centerY);
d = r.centerX;
h = r.centerY;
break
}
for (q = 0; q < v; q++) w = u[q], H.Ae(d, h, w[2], w[3],
w[4], w[5], w[6], w[7], .5, f), d = w[6], h = w[7];
break;
case ae:
u = ce(r, c, d, h);
v = u.length;
if (0 === v) {
f.push(r.centerX);
f.push(r.centerY);
d = r.centerX;
h = r.centerY;
break
}
for (q = 0; q < v; q++) w = u[q], H.Ae(d, h, w[2], w[3], w[4], w[5], w[6], w[7], .5, f), d = w[6], h = w[7];
break;
default:
B("Segment not of valid type: " + r.type)
}
r.isClosed && (f.push(k), f.push(l), Xm(a, b, f, e))
}
Xm(a, b, f, e)
} else if (g.type === Hd) f.push(g.startX), f.push(g.startY), f.push(g.endX), f.push(g.startY), f.push(g.endX), f.push(g.endY), f.push(g.startX), f.push(g.endY), f.push(g.startX),
f.push(g.startY), Xm(a, b, f, e); else if (g.type === Id) {
h = new ke;
h.startX = g.endX;
h.startY = (g.startY + g.endY) / 2;
d = new le($d);
d.startAngle = 0;
d.sweepAngle = 360;
d.centerX = (g.startX + g.endX) / 2;
d.centerY = (g.startY + g.endY) / 2;
d.radiusX = Math.abs(g.startX - g.endX) / 2;
d.radiusY = Math.abs(g.startY - g.endY) / 2;
h.add(d);
g = be(d, h);
c = g.length;
if (0 === c) f.push(d.centerX), f.push(d.centerY); else for (d = h.startX, h = h.startY, k = 0; k < c; k++) l = g[k], H.Ae(d, h, l[2], l[3], l[4], l[5], l[6], l[7], .5, f), d = l[6], h = l[7];
Xm(a, b, f, e)
}
Ga(f);
a.restore();
a.Rc(!1)
}
}
}
};
t.ma = function (a, b) {
void 0 === b && (b = new G);
if (a instanceof O) {
a.jc() && B("getDocumentPoint Spot must be a real, specific Spot, not: " + a.toString());
var c = this.naturalBounds, d = this.strokeWidth;
b.h(a.x * (c.width + d) - d / 2 + c.x + a.offsetX, a.y * (c.height + d) - d / 2 + c.y + a.offsetY)
} else b.set(a);
this.rd.ta(b);
return b
};
t.Zp = function (a) {
void 0 === a && (a = new N);
var b = this.naturalBounds, c = this.rd;
b = N.allocAt(b.x, b.y, b.width, b.height);
var d = this.strokeWidth;
b.Uc(d / 2, d / 2);
d = G.allocAt(b.x, b.y).transform(c);
a.h(d.x, d.y, 0, 0);
d.h(b.right, b.y).transform(c);
ec(a, d.x, d.y, 0, 0);
d.h(b.right, b.bottom).transform(c);
ec(a, d.x, d.y, 0, 0);
d.h(b.x, b.bottom).transform(c);
ec(a, d.x, d.y, 0, 0);
N.free(b);
G.free(d);
return a
};
t.xh = function (a, b) {
var c = this.geometry;
if (null === c || null === this.fill && null === this.stroke) return !1;
var d = c.bounds, e = this.strokeWidth / 2;
c.type !== xd || b || (e += 2);
var f = N.alloc();
f.assign(d);
f.Uc(e + 2, e + 2);
if (!f.da(a)) return N.free(f), !1;
d = e + 1E-4;
if (c.type === xd) {
if (null === this.stroke) return !1;
d = (c.endX - c.startX) * (a.x - c.startX) + (c.endY - c.startY) * (a.y - c.startY);
if (0 > (c.startX - c.endX) * (a.x - c.endX) + (c.startY - c.endY) * (a.y - c.endY) || 0 > d) return !1;
N.free(f);
return H.Tb(c.startX, c.startY, c.endX, c.endY, e, a.x, a.y)
}
if (c.type ===
Hd) {
b = c.startX;
var g = c.startY, h = c.endX;
c = c.endY;
f.x = Math.min(b, h);
f.y = Math.min(g, c);
f.width = Math.abs(h - b);
f.height = Math.abs(c - g);
if (null === this.fill) {
f.Uc(-d, -d);
if (f.da(a)) return N.free(f), !1;
f.Uc(d, d)
}
null !== this.stroke && f.Uc(e, e);
a = f.da(a);
N.free(f);
return a
}
if (c.type === Id) {
g = c.startX;
e = c.startY;
h = c.endX;
var k = c.endY;
c = Math.min(g, h);
b = Math.min(e, k);
g = Math.abs(h - g) / 2;
e = Math.abs(k - e) / 2;
c = a.x - (c + g);
b = a.y - (b + e);
if (null === this.fill) {
g -= d;
e -= d;
if (0 >= g || 0 >= e || 1 >= c * c / (g * g) + b * b / (e * e)) return N.free(f), !1;
g += d;
e += d
}
null !== this.stroke && (g += d, e += d);
N.free(f);
return 0 >= g || 0 >= e ? !1 : 1 >= c * c / (g * g) + b * b / (e * e)
}
if (c.type === vd) return N.free(f), null === this.fill ? ie(c, a.x, a.y, e) : c.da(a, e, 1 < this.strokeWidth, b);
B("Unknown Geometry type: " + c.type);
return !1
};
t.im = function (a, b, c, d) {
var e = this.desiredSize, f = this.jh;
a = Math.max(a, 0);
b = Math.max(b, 0);
if (null !== this.Pd) var g = this.geometry.bounds; else {
var h = this.figure, k = ln[h];
if (void 0 === k) {
var l = H.Ke[h];
"string" === typeof l && (l = H.Ke[l]);
"function" === typeof l ? (k = l(null, 100, 100), ln[h] = k) : B("Unsupported Figure: " + h)
}
g = k.bounds
}
h = g.width;
k = g.height;
l = g.width;
var m = g.height;
switch (Pk(this, !0)) {
case Bg:
d = c = 0;
break;
case wd:
l = Math.max(a - f, 0);
m = Math.max(b - f, 0);
break;
case Ak:
l = Math.max(a - f, 0);
d = 0;
break;
case Bk:
c = 0, m =
Math.max(b - f, 0)
}
isFinite(e.width) && (l = e.width);
isFinite(e.height) && (m = e.height);
e = this.maxSize;
g = this.minSize;
c = Math.max(c - f, g.width);
d = Math.max(d - f, g.height);
l = Math.min(e.width, l);
m = Math.min(e.height, m);
l = isFinite(l) ? Math.max(c, l) : Math.max(h, c);
m = isFinite(m) ? Math.max(d, m) : Math.max(k, d);
c = Cg(this);
switch (c) {
case Bg:
break;
case wd:
h = l;
k = m;
break;
case Dg:
c = Math.min(l / h, m / k);
isFinite(c) || (c = 1);
h *= c;
k *= c;
break;
default:
B(c + " is not a valid geometryStretch.")
}
null !== this.Pd ? (h = Math.max(h, .01), k = Math.max(k,
.01), g = null !== this.Pd ? this.Pd : this.qa, e = h, d = k, c = g.copy(), g = g.bounds, e /= g.width, d /= g.height, isFinite(e) || (e = 1), isFinite(d) || (d = 1), 1 === e && 1 === d || c.scale(e, d), this.qa = c) : null !== this.qa && H.ca(this.qa.fl, a - f) && H.ca(this.qa.dl, b - f) || (this.qa = W.makeGeometry(this, h, k));
g = this.qa.bounds;
Infinity === a || Infinity === b ? Mk(this, g.x - f / 2, g.y - f / 2, 0 === a && 0 === h ? 0 : g.width + f, 0 === b && 0 === k ? 0 : g.height + f) : Mk(this, -(f / 2), -(f / 2), l + f, m + f)
};
function Cg(a) {
var b = a.geometryStretch;
return null !== a.Pd ? b === zk ? wd : b : b === zk ? ln[a.figure].defaultStretch : b
}
t.vh = function (a, b, c, d) {
Rk(this, a, b, c, d)
};
t.Tc = function (a, b, c) {
return this.dk(a.x, a.y, b.x, b.y, c)
};
t.dk = function (a, b, c, d, e) {
var f = this.transform, g = 1 / (f.m11 * f.m22 - f.m12 * f.m21), h = f.m22 * g, k = -f.m12 * g, l = -f.m21 * g,
m = f.m11 * g, n = g * (f.m21 * f.dy - f.m22 * f.dx), p = g * (f.m12 * f.dx - f.m11 * f.dy);
f = a * h + b * l + n;
g = a * k + b * m + p;
h = c * h + d * l + n;
k = c * k + d * m + p;
n = this.jh / 2;
l = this.qa;
null === l && (this.measure(Infinity, Infinity), l = this.qa);
p = l.bounds;
m = !1;
if (l.type === xd) if (1.5 >= this.strokeWidth) m = H.Ge(l.startX, l.startY, l.endX, l.endY, f, g, h, k, e); else {
l.startX === l.endX ? (d = n, m = 0) : (b = (l.endY - l.startY) / (l.endX - l.startX), m = n / Math.sqrt(1 + b * b), d = m *
b);
b = Da();
a = new G;
H.Ge(l.startX + d, l.startY + m, l.endX + d, l.endY + m, f, g, h, k, a) && b.push(a);
a = new G;
H.Ge(l.startX - d, l.startY - m, l.endX - d, l.endY - m, f, g, h, k, a) && b.push(a);
a = new G;
H.Ge(l.startX + d, l.startY + m, l.startX - d, l.startY - m, f, g, h, k, a) && b.push(a);
a = new G;
H.Ge(l.endX + d, l.endY + m, l.endX - d, l.endY - m, f, g, h, k, a) && b.push(a);
h = b.length;
if (0 === h) return Ga(b), !1;
m = !0;
k = Infinity;
for (d = 0; d < h; d++) a = b[d], c = (a.x - f) * (a.x - f) + (a.y - g) * (a.y - g), c < k && (k = c, e.x = a.x, e.y = a.y);
Ga(b)
} else if (l.type === Hd) m = H.Tc(p.x - n, p.y - n, p.x + p.width +
n, p.y + p.height + n, f, g, h, k, e); else if (l.type === Id) {
b = N.allocAt(p.x, p.y, p.width, p.height).Uc(n, n);
a:if (0 === b.width) m = H.Ge(b.x, b.y, b.x, b.y + b.height, f, g, h, k, e); else if (0 === b.height) m = H.Ge(b.x, b.y, b.x + b.width, b.y, f, g, h, k, e); else {
a = b.width / 2;
l = b.height / 2;
d = b.x + a;
m = b.y + l;
c = 9999;
f !== h && (c = (g - k) / (f - h));
if (9999 > Math.abs(c)) {
k = g - m - c * (f - d);
if (0 > a * a * c * c + l * l - k * k) {
e.x = NaN;
e.y = NaN;
m = !1;
break a
}
n = Math.sqrt(a * a * c * c + l * l - k * k);
h = (-(a * a * c * k) + a * l * n) / (l * l + a * a * c * c) + d;
a = (-(a * a * c * k) - a * l * n) / (l * l + a * a * c * c) + d;
l = c * (h - d) + k + m;
k = c *
(a - d) + k + m;
Math.abs((f - h) * (f - h)) + Math.abs((g - l) * (g - l)) < Math.abs((f - a) * (f - a)) + Math.abs((g - k) * (g - k)) ? (e.x = h, e.y = l) : (e.x = a, e.y = k)
} else {
h = l * l;
k = f - d;
h -= h / (a * a) * k * k;
if (0 > h) {
e.x = NaN;
e.y = NaN;
m = !1;
break a
}
k = Math.sqrt(h);
h = m + k;
k = m - k;
Math.abs(h - g) < Math.abs(k - g) ? (e.x = f, e.y = h) : (e.x = f, e.y = k)
}
m = !0
}
N.free(b)
} else if (l.type === vd) {
p = G.alloc();
var r = h - f;
var q = k - g;
var u = r * r + q * q;
e.x = h;
e.y = k;
for (var v = 0; v < l.figures.count; v++) {
var w = l.figures.j[v], z = w.segments;
r = w.startX;
q = w.startY;
for (var y = r, A = q, C = 0; C < z.count; C++) {
var I =
z.j[C], K = I.type;
var J = I.endX;
var T = I.endY;
var Q = !1;
switch (K) {
case Xd:
y = J;
A = T;
break;
case Fd:
Q = mn(r, q, J, T, f, g, h, k, p);
break;
case Yd:
Q = H.Pp(r, q, I.point1X, I.point1Y, I.point2X, I.point2Y, J, T, f, g, h, k, .6, p);
break;
case Zd:
Q = H.Pp(r, q, (r + 2 * I.point1X) / 3, (q + 2 * I.point1Y) / 3, (2 * I.point1X + J) / 3, (2 * I.point1X + J) / 3, J, T, f, g, h, k, .6, p);
break;
case $d:
case ae:
K = I.type === $d ? be(I, w) : ce(I, w, r, q);
var ea = K.length;
if (0 === ea) {
Q = mn(r, q, I.centerX, I.centerY, f, g, h, k, p);
break
}
T = null;
for (J = 0; J < ea; J++) {
T = K[J];
if (0 === J && mn(r, q, T[0], T[1],
f, g, h, k, p)) {
var pa = nn(f, g, p, u, e);
pa < u && (u = pa, m = !0)
}
H.Pp(T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], f, g, h, k, .6, p) && (pa = nn(f, g, p, u, e), pa < u && (u = pa, m = !0))
}
J = T[6];
T = T[7];
break;
default:
B("Unknown Segment type: " + K)
}
r = J;
q = T;
Q && (Q = nn(f, g, p, u, e), Q < u && (u = Q, m = !0));
I.isClosed && (J = y, T = A, mn(r, q, J, T, f, g, h, k, p) && (I = nn(f, g, p, u, e), I < u && (u = I, m = !0)))
}
}
f = c - a;
g = d - b;
h = Math.sqrt(f * f + g * g);
0 !== h && (f /= h, g /= h);
e.x -= f * n;
e.y -= g * n;
G.free(p)
} else B("Unknown Geometry type: " + l.type);
if (!m) return !1;
this.transform.ta(e);
return !0
};
function nn(a, b, c, d, e) {
a = c.x - a;
b = c.y - b;
b = a * a + b * b;
return b < d ? (e.x = c.x, e.y = c.y, b) : d
}
function mn(a, b, c, d, e, f, g, h, k) {
var l = !1, m = (e - g) * (b - d) - (f - h) * (a - c);
if (0 === m) return !1;
k.x = ((e * h - f * g) * (a - c) - (e - g) * (a * d - b * c)) / m;
k.y = ((e * h - f * g) * (b - d) - (f - h) * (a * d - b * c)) / m;
(a > c ? a - c : c - a) < (b > d ? b - d : d - b) ? (a = b < d ? b : d, b = b < d ? d : b, (k.y > a || H.ca(k.y, a)) && (k.y < b || H.ca(k.y, b)) && (l = !0)) : (b = a < c ? a : c, a = a < c ? c : a, (k.x > b || H.ca(k.x, b)) && (k.x < a || H.ca(k.x, a)) && (l = !0));
return l
}
t.wh = function (a, b) {
if (void 0 === b) return a.nf(this.actualBounds);
var c = this.qa;
null === c && (this.measure(Infinity, Infinity), c = this.qa);
c = c.bounds;
var d = this.strokeWidth / 2, e = !1, f = G.alloc();
f.h(c.x - d, c.y - d);
a.da(b.ta(f)) && (f.h(c.x - d, c.bottom + d), a.da(b.ta(f)) && (f.h(c.right + d, c.bottom + d), a.da(b.ta(f)) && (f.h(c.right + d, c.y - d), a.da(b.ta(f)) && (e = !0))));
G.free(f);
return e
};
t.Ic = function (a, b) {
if (this.wh(a, b) || void 0 === b && (b = this.transform, a.nf(this.actualBounds))) return !0;
var c = wc.alloc();
c.set(b);
c.bt();
var d = a.left, e = a.right, f = a.top;
a = a.bottom;
var g = G.alloc();
g.h(d, f);
c.ta(g);
if (this.xh(g, !0)) return G.free(g), !0;
g.h(e, f);
c.ta(g);
if (this.xh(g, !0)) return G.free(g), !0;
g.h(d, a);
c.ta(g);
if (this.xh(g, !0)) return G.free(g), !0;
g.h(e, a);
c.ta(g);
if (this.xh(g, !0)) return G.free(g), !0;
var h = G.alloc(), k = G.alloc();
c.set(b);
c.pv(this.transform);
c.bt();
h.x = e;
h.y = f;
h.transform(c);
g.x =
d;
g.y = f;
g.transform(c);
b = !1;
on(this, g, h, k) ? b = !0 : (g.x = e, g.y = a, g.transform(c), on(this, g, h, k) ? b = !0 : (h.x = d, h.y = a, h.transform(c), on(this, g, h, k) ? b = !0 : (g.x = d, g.y = f, g.transform(c), on(this, g, h, k) && (b = !0))));
G.free(g);
wc.free(c);
G.free(h);
G.free(k);
return b
};
function on(a, b, c, d) {
if (!a.Tc(b, c, d)) return !1;
a = b.x;
b = b.y;
var e = c.x, f = c.y;
c = d.x;
d = d.y;
if (a === e) return b < f ? (a = b, b = f) : a = f, d >= a && d <= b;
a < e ? (d = a, a = e) : d = e;
return c >= d && c <= a
}
t.hx = function (a, b, c) {
function d(a, b) {
for (var c = a.length, d = 0; d < c; d += 2) if (b.cd(a[d], a[d + 1]) > e) return !0;
return !1
}
if (c && null !== this.fill && this.xh(a, !0)) return !0;
var e = a.Ce(b), f = e;
1.5 < this.strokeWidth && (e = this.strokeWidth / 2 + Math.sqrt(e), e *= e);
b = this.qa;
if (null === b && (this.measure(Infinity, Infinity), b = this.qa, null === b)) return !1;
if (!c) {
var g = b.bounds, h = g.x, k = g.y, l = g.x + g.width;
g = g.y + g.height;
if (Bb(a.x, a.y, h, k) <= e && Bb(a.x, a.y, l, k) <= e && Bb(a.x, a.y, h, g) <= e && Bb(a.x, a.y, l, g) <= e) return !0
}
h = b.startX;
k = b.startY;
l =
b.endX;
g = b.endY;
if (b.type === xd) {
if (c = (h - l) * (a.x - l) + (k - g) * (a.y - g), Ab(a.x, a.y, h, k, l, g) <= (0 <= (l - h) * (a.x - h) + (g - k) * (a.y - k) && 0 <= c ? e : f)) return !0
} else {
if (b.type === Hd) return b = !1, c && (b = Ab(a.x, a.y, h, k, h, g) <= e || Ab(a.x, a.y, h, k, l, k) <= e || Ab(a.x, a.y, l, k, l, g) <= e || Ab(a.x, a.y, h, g, l, g) <= e), b;
if (b.type === Id) {
b = a.x - (h + l) / 2;
f = a.y - (k + g) / 2;
var m = Math.abs(l - h) / 2, n = Math.abs(g - k) / 2;
if (0 === m || 0 === n) return Ab(a.x, a.y, h, k, l, g) <= e ? !0 : !1;
if (c) {
if (a = H.Ay(m, n, b, f), a * a <= e) return !0
} else return Bb(b, f, -m, 0) >= e || Bb(b, f, 0, -n) >= e || Bb(b,
f, 0, n) >= e || Bb(b, f, m, 0) >= e ? !1 : !0
} else if (b.type === vd) {
l = b.bounds;
f = l.x;
h = l.y;
k = l.x + l.width;
l = l.y + l.height;
if (a.x > k && a.x < f && a.y > l && a.y < h && Ab(a.x, a.y, f, h, f, l) > e && Ab(a.x, a.y, f, h, k, h) > e && Ab(a.x, a.y, k, l, f, l) > e && Ab(a.x, a.y, k, l, k, h) > e) return !1;
f = Math.sqrt(e);
if (c) {
if (null === this.fill ? ie(b, a.x, a.y, f) : b.da(a, f, !0)) return !0
} else {
c = b.figures;
for (b = 0; b < c.count; b++) {
f = c.j[b];
g = f.startX;
m = f.startY;
if (a.cd(g, m) > e) return !1;
h = f.segments.j;
k = h.length;
for (l = 0; l < k; l++) switch (n = h[l], n.type) {
case Xd:
case Fd:
g = n.endX;
m =
n.endY;
if (a.cd(g, m) > e) return !1;
break;
case Yd:
var p = Da();
H.Ae(g, m, n.point1X, n.point1Y, n.point2X, n.point2Y, n.endX, n.endY, .8, p);
g = d(p, a);
Ga(p);
if (g) return !1;
g = n.endX;
m = n.endY;
if (a.cd(g, m) > e) return !1;
break;
case Zd:
p = Da();
H.nq(g, m, n.point1X, n.point1Y, n.endX, n.endY, .8, p);
g = d(p, a);
Ga(p);
if (g) return !1;
g = n.endX;
m = n.endY;
if (a.cd(g, m) > e) return !1;
break;
case $d:
case ae:
p = n.type === $d ? be(n, f) : ce(n, f, g, m);
var r = p.length;
if (0 === r) {
g = n.centerX;
m = n.centerY;
if (a.cd(g, m) > e) return !1;
break
}
n = null;
for (var q = Da(), u = 0; u < r; u++) if (n =
p[u], q.length = 0, H.Ae(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], .8, q), d(q, a)) return Ga(q), !1;
Ga(q);
null !== n && (g = n[6], m = n[7]);
break;
default:
B("Unknown Segment type: " + n.type)
}
}
return !0
}
}
}
return !1
};
t.ac = function () {
this.qa = null
};
function pn(a) {
var b = a.diagram;
null !== b && b.undoManager.isUndoingRedoing || (a.segmentOrientation = qn, "None" !== a.Ql ? (a.segmentIndex = -1, a.alignmentFocus = md) : "None" !== a.Zk && (a.segmentIndex = 0, a.alignmentFocus = new O(1 - md.x, md.y)))
}
W.makeGeometry = function (a, b, c) {
if ("None" !== a.toArrow) var d = rn[a.toArrow]; else "None" !== a.fromArrow ? d = rn[a.fromArrow] : (d = H.Ke[a.figure], "string" === typeof d && (d = H.Ke[d]), void 0 === d && B("Unknown Shape.figure: " + a.figure), d = d(a, b, c), d.fl = b, d.dl = c);
if (null === d) {
var e = H.Ke.Rectangle;
"function" === typeof e && (d = e(a, b, c))
}
return d
};
function sn(a) {
var b = rn[a];
if (void 0 === b) {
var c = a.toLowerCase();
if ("none" === c) return "None";
b = rn[c];
if (void 0 === b) {
var d = null, e;
for (e in H.Cm) if (e.toLowerCase() === c) {
d = e;
break
}
if (null !== d) return a = Jd(H.Cm[d], !1), rn[d] = a, c !== d && (rn[c] = d), d
}
}
return "string" === typeof b ? b : b instanceof ud ? a : null
}
ma.Object.defineProperties(W.prototype, {
geometry: {
get: function () {
return null !== this.qa ? this.qa : this.Pd
}, set: function (a) {
var b = this.qa;
if (b !== a) {
null !== a ? this.Pd = this.qa = a.freeze() : this.Pd = this.qa = null;
var c = this.part;
null !== c && (c.Xg = NaN);
this.s();
this.g("geometry", b, a);
Jk(this) && (a = this.part, null !== a && Kk(this, a, "geometryString"))
}
}
}, geometryString: {
get: function () {
return null === this.geometry ? "" : this.geometry.toString()
}, set: function (a) {
a =
Jd(a);
var b = a.normalize();
this.geometry = a;
this.position = a = G.allocAt(-b.x, -b.y);
G.free(a)
}
}, isGeometryPositioned: {
get: function () {
return this.Rn
}, set: function (a) {
var b = this.Rn;
b !== a && (this.Rn = a, this.s(), this.g("isGeometryPositioned", b, a))
}
}, fill: {
get: function () {
return this.Xk
}, set: function (a) {
var b = this.Xk;
b !== a && (null !== a && ul(a, "Shape.fill"), a instanceof Yk && a.freeze(), this.Xk = a, this.R(), this.g("fill", b, a))
}
}, stroke: {
get: function () {
return this.Gc
}, set: function (a) {
var b = this.Gc;
b !== a && (null !== a && ul(a, "Shape.stroke"), a instanceof Yk && a.freeze(), this.Gc = a, this.R(), this.g("stroke", b, a))
}
}, strokeWidth: {
get: function () {
return this.jh
}, set: function (a) {
var b = this.jh;
if (b !== a) if (0 <= a) {
this.jh = a;
this.s();
var c = this.part;
null !== c && (c.Xg = NaN);
this.g("strokeWidth", b, a)
} else va(a, "value >= 0", W, "strokeWidth:value")
}
}, strokeCap: {
get: function () {
return this.Jl
}, set: function (a) {
var b =
this.Jl;
b !== a && ("string" !== typeof a || "butt" !== a && "round" !== a && "square" !== a ? va(a, '"butt", "round", or "square"', W, "strokeCap") : (this.Jl = a, this.R(), this.g("strokeCap", b, a)))
}
}, strokeJoin: {
get: function () {
return this.Kl
}, set: function (a) {
var b = this.Kl;
b !== a && ("string" !== typeof a || "miter" !== a && "bevel" !== a && "round" !== a ? va(a, '"miter", "bevel", or "round"', W, "strokeJoin") : (this.Kl = a, this.R(), this.g("strokeJoin", b, a)))
}
}, strokeMiterLimit: {
get: function () {
return this.Lj
},
set: function (a) {
var b = this.Lj;
if (b !== a && 1 <= a) {
this.Lj = a;
this.R();
var c = this.part;
null !== c && (c.Xg = NaN);
this.g("strokeMiterLimit", b, a)
}
}
}, strokeDashArray: {
get: function () {
return this.hh
}, set: function (a) {
var b = this.hh;
if (b !== a) {
if (null !== a) {
for (var c = a.length, d = 0, e = 0; e < c; e++) {
var f = a[e];
0 <= f && isFinite(f) || B("strokeDashArray:value " + f + " at index " + e + " must be a positive number or zero.");
d += f
}
if (0 === d) {
if (null === b) return;
a = null
}
}
this.hh = a;
this.R();
this.g("strokeDashArray",
b, a)
}
}
}, strokeDashOffset: {
get: function () {
return this.ih
}, set: function (a) {
var b = this.ih;
b !== a && 0 <= a && (this.ih = a, this.R(), this.g("strokeDashOffset", b, a))
}
}, figure: {
get: function () {
return this.Wk
}, set: function (a) {
var b = this.Wk;
if (b !== a) {
var c = H.Ke[a];
"function" === typeof c ? c = a : (c = H.Ke[a.toLowerCase()]) || B("Unknown Shape.figure: " + a);
b !== c && (a = this.part, null !== a && (a.Xg = NaN), this.Wk = c, this.Pd = null, this.ac(), this.s(), this.g("figure", b, c))
}
}
}, toArrow: {
get: function () {
return this.Ql
}, set: function (a) {
var b = this.Ql;
!0 === a ? a = "Standard" : !1 === a && (a = "");
if (b !== a) {
var c = sn(a);
null === c ? B("Unknown Shape.toArrow: " + a) : b !== c && (this.Ql = c, this.Pd = null, this.ac(), this.s(), pn(this), this.g("toArrow", b, c))
}
}
}, fromArrow: {
get: function () {
return this.Zk
}, set: function (a) {
var b = this.Zk;
!0 === a ? a = "Standard" : !1 === a && (a = "");
if (b !== a) {
var c = sn(a);
null === c ? B("Unknown Shape.fromArrow: " + a) : b !== c && (this.Zk = c, this.Pd = null, this.ac(), this.s(),
pn(this), this.g("fromArrow", b, c))
}
}
}, spot1: {
get: function () {
return this.df
}, set: function (a) {
var b = this.df;
b.A(a) || (this.df = a = a.I(), this.s(), this.g("spot1", b, a))
}
}, spot2: {
get: function () {
return this.ef
}, set: function (a) {
var b = this.ef;
b.A(a) || (this.ef = a = a.I(), this.s(), this.g("spot2", b, a))
}
}, parameter1: {
get: function () {
return this.No
}, set: function (a) {
var b = this.No;
b !== a && (this.No = a, this.ac(), this.s(), this.g("parameter1",
b, a))
}
}, parameter2: {
get: function () {
return this.Oo
}, set: function (a) {
var b = this.Oo;
b !== a && (this.Oo = a, this.ac(), this.s(), this.g("parameter2", b, a))
}
}, naturalBounds: {
get: function () {
if (null !== this.qa) return this.qc.assign(this.qa.bounds), this.qc;
var a = this.desiredSize;
return new N(0, 0, a.width, a.height)
}
}, pathPattern: {
get: function () {
return this.Qo
}, set: function (a) {
var b = this.Qo;
b !== a && (this.Qo = a, this.R(), this.g("pathPattern",
b, a))
}
}, geometryStretch: {
get: function () {
return this.Gn
}, set: function (a) {
var b = this.Gn;
b !== a && (this.Gn = a, this.g("geometryStretch", b, a))
}
}, interval: {
get: function () {
return this.Cd
}, set: function (a) {
var b = this.Cd;
a = Math.floor(a);
if (b !== a && 0 <= a) {
this.Cd = a;
var c = this.diagram;
null !== c && this.panel === c.grid && Wi(c);
this.s();
c = this.panel;
null !== c && (c.Qg = null);
this.g("interval", b, a)
}
}
}, graduatedStart: {
get: function () {
return this.Bd
},
set: function (a) {
var b = this.Bd;
b !== a && (0 > a ? a = 0 : 1 < a && (a = 1), this.Bd = a, this.s(), this.g("graduatedStart", b, a))
}
}, graduatedEnd: {
get: function () {
return this.zd
}, set: function (a) {
var b = this.zd;
b !== a && (0 > a ? a = 0 : 1 < a && (a = 1), this.zd = a, this.s(), this.g("graduatedEnd", b, a))
}
}, graduatedSkip: {
get: function () {
return this.Ad
}, set: function (a) {
var b = this.Ad;
b !== a && (this.Ad = a, this.s(), this.g("graduatedSkip", b, a))
}
}
});
W.prototype.intersectsRect = W.prototype.Ic;
W.prototype.containedInRect = W.prototype.wh;
W.prototype.getNearestIntersectionPoint = W.prototype.Tc;
W.prototype.getDocumentBounds = W.prototype.Zp;
W.prototype.getDocumentPoint = W.prototype.ma;
var rn = new db, ln = new db;
W.className = "Shape";
W.getFigureGenerators = function () {
var a = new vb, b;
for (b in H.Ke) b !== b.toLowerCase() && a.add(b, H.Ke[b]);
a.freeze();
return a
};
W.defineFigureGenerator = function (a, b) {
var c = a.toLowerCase(), d = H.Ke;
d[a] = b;
d[c] = a
};
W.getArrowheadGeometries = function () {
var a = new vb;
for (d in H.Cm) if (void 0 === rn[d]) {
var b = Jd(H.Cm[d], !1);
rn[d] = b;
b = d.toLowerCase();
b !== d && (rn[b] = d)
}
for (var c in rn) if (c !== c.toLowerCase()) {
var d = rn[c];
d instanceof ud && a.add(c, d)
}
a.freeze();
return a
};
W.defineArrowheadGeometry = function (a, b) {
var c = null;
"string" === typeof b ? c = Jd(b, !1) : c = b;
b = a.toLowerCase();
"none" !== b && a !== b || B("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: " + a);
var d = rn;
d[a] = c;
d[b] = a
};
function Yg() {
Y.call(this);
tn || (un(), tn = !0);
this.Ob = "";
this.Gc = "black";
this.fe = "13px sans-serif";
this.xi = "start";
this.yd = Bg;
this.Ci = dd;
this.pj = !0;
this.ei = this.fi = !1;
this.bg = vn;
this.ng = wn;
this.Rr = this.oc = 0;
this.iu = this.ju = null;
this.nd = new ym;
this.An = !1;
this.Cc = this.Xm = this.Ap = this.yi = this.Bp = null;
this.cf = this.bf = 0;
this.ne = Infinity;
this.kl = 0;
this.Cd = 1;
this.Bd = 0;
this.zd = 1;
this.Ad = this.kj = null
}
la(Yg, Y);
Yg.prototype.cloneProtected = function (a) {
Y.prototype.cloneProtected.call(this, a);
a.Ob = this.Ob;
a.Gc = this.Gc;
a.fe = this.fe;
a.xi = this.xi;
a.yd = this.yd;
a.Ci = this.Ci;
a.pj = this.pj;
a.fi = this.fi;
a.ei = this.ei;
a.bg = this.bg;
a.ng = this.ng;
a.oc = this.oc;
a.Rr = this.Rr;
a.ju = this.ju;
a.iu = this.iu;
a.nd.Wl(this.nd);
a.An = this.An;
a.Bp = this.Bp;
a.yi = this.yi;
a.Ap = this.Ap;
a.Xm = this.Xm;
a.Cc = this.Cc;
a.bf = this.bf;
a.cf = this.cf;
a.ne = this.ne;
a.kl = this.kl;
a.Cd = this.Cd;
a.Bd = this.Bd;
a.zd = this.zd;
a.kj = this.kj;
a.Ad = this.Ad
};
function xm(a, b) {
a.H = b.H | 6144;
a.lb = b.opacity;
a.ib = b.background;
a.dc = b.areaBackground;
a.Nc = b.desiredSize.I();
a.Tf = b.minSize.I();
a.Sf = b.maxSize.I();
a.Rf = b.Rf.copy();
a.Ca = b.scale;
a.zc = b.angle;
a.we = b.stretch;
a.Wg = b.margin.I();
a.wb = b.alignment.I();
a.zk = b.alignmentFocus.I();
a.zl = b.segmentFraction;
a.Al = b.segmentOffset.I();
a.Bl = b.segmentOrientation;
null !== b.kd && (a.kd = b.kd.copy());
a.Dl = b.shadowVisible;
b instanceof Yg && (a.Ob = b.Ob, a.Gc = b.Gc, a.fe = b.fe, a.xi = b.xi, a.yd = b.yd, a.Ci = b.Ci, a.pj = b.pj, a.fi = b.fi, a.ei = b.ei,
a.bg = b.bg, a.ng = b.ng, a.nd.Kf = null, a.bf = b.bf, a.cf = b.cf, a.ne = b.ne, a.kl = b.kl, a.Cd = b.Cd, a.Bd = b.Bd, a.zd = b.zd, a.kj = b.kj, a.Ad = b.Ad)
}
t = Yg.prototype;
t.fb = function (a) {
a.classType === Yg ? this.wrap = a : Y.prototype.fb.call(this, a)
};
t.toString = function () {
return 22 < this.Ob.length ? 'TextBlock("' + this.Ob.substring(0, 20) + '"...)' : 'TextBlock("' + this.Ob + '")'
};
t.s = function () {
Y.prototype.s.call(this);
this.iu = this.ju = null
};
t.Fi = function (a, b) {
if (null !== this.Gc && 0 !== this.Ob.length && null !== this.fe) {
var c = this.naturalBounds, d = this.actualBounds, e = c.width, f = c.height, g = xn(this),
h = a.textAlign = this.xi, k = b.Tn;
"start" === h ? h = k ? "right" : "left" : "end" === h && (h = k ? "left" : "right");
k = this.fi;
var l = this.ei;
Sh(this, a, this.Gc, !0, !1, c, d);
(k || l) && Sh(this, a, this.Gc, !1, !1, c, d);
d = 0;
c = !1;
var m = G.allocAt(0, 0);
this.rd.ta(m);
var n = G.allocAt(0, g);
this.rd.ta(n);
var p = m.Ce(n);
G.free(m);
G.free(n);
m = b.scale;
8 > p * m * m && (c = !0);
b.Yc !== a && (c = !1);
!1 === b.Ee("textGreeking") &&
(c = !1);
b = this.bf;
p = this.cf;
switch (this.flip) {
case Ek:
a.translate(e, 0);
a.scale(-1, 1);
break;
case Dk:
a.translate(0, f);
a.scale(1, -1);
break;
case Fk:
a.translate(e, f), a.scale(-1, -1)
}
m = this.oc;
n = (b + g + p) * m;
f > n && (d = this.Ci, d = d.y * f - d.y * n + d.offsetY);
n = this.nd;
for (var r = 0; r < m; r++) {
var q = n.Wc[r];
q > e && (q = e);
d += b;
var u = n.Ac[r], v = a, w = d, z = h, y = 0;
if (c) "left" === z ? y = 0 : "right" === z ? y = e - q : "center" === z && (y = (e - q) / 2), v.fillRect(0 + y, w + .25 * g, q, 1); else {
"left" === z ? y = 0 : "right" === z ? y = e : "center" === z && (y = e / 2);
var A = null !== yn ? yn(this,
g) : .75 * g;
v.fillText(u, 0 + y, w + A);
u = g / 20 | 0;
0 === u && (u = 1);
"right" === z ? y -= q : "center" === z && (y -= q / 2);
k && (z = null !== zn ? zn(this, g) : .8 * g, v.beginPath(), v.lineWidth = u, v.moveTo(0 + y, w + z), v.lineTo(0 + y + q, w + z), v.stroke());
l && (v.beginPath(), v.lineWidth = u, w = w + g - g / 2.2 | 0, 0 !== u % 2 && (w += .5), v.moveTo(0 + y, w), v.lineTo(0 + y + q, w), v.stroke())
}
d += g + p
}
switch (this.flip) {
case Ek:
a.scale(-1, 1);
a.translate(-e, 0);
break;
case Dk:
a.scale(1, -1);
a.translate(0, -f);
break;
case Fk:
a.scale(-1, -1), a.translate(-e, -f)
}
}
};
t.im = function (a, b, c, d) {
this.kl = a;
var e = this.fe;
null !== An && Bn !== e && (Bn = An.font = e);
e = this.nd;
e.reset();
var f;
if (isNaN(this.desiredSize.width)) {
var g = this.Ob.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
if (0 === g.length) g = 0; else if (this.isMultiline) {
for (var h = f = 0, k = !1; !k;) {
var l = g.indexOf("\n", h);
-1 === l && (l = g.length, k = !0);
f = Math.max(f, Cn(g.substr(h, l - h).trim()));
h = l + 1
}
g = f
} else f = g.indexOf("\n", 0), 0 <= f && (g = g.substr(0, f)), g = Cn(g);
g = Math.min(g, a / this.scale);
g = Math.max(8, g)
} else g = this.desiredSize.width;
null !==
this.panel && (g = Math.min(g, this.panel.maxSize.width));
f = Dn(this, g, e);
isNaN(this.desiredSize.height) ? f = Math.min(f, b / this.scale) : f = this.desiredSize.height;
h = f;
if (0 !== e.Ec && 1 !== e.Ac.length && this.bg === En && (b = this.fe, b = this.bg === En ? Fn(b) : 0, k = this.bf + this.cf, k = Math.max(0, xn(this) + k), h = Math.min(this.maxLines - 1, Math.max(Math.floor(h / k + .01) - 1, 0)), !(h + 1 >= e.Ac.length))) {
k = e.Ac[h];
for (b = Math.max(1, a - b); Cn(k) > b && 1 < k.length;) k = k.substr(0, k.length - 1);
k += Gn;
b = Cn(k);
e.Ac[h] = k;
e.Ac = e.Ac.slice(0, h + 1);
e.Wc[h] = b;
e.Wc =
e.Wc.slice(0, h + 1);
e.mg = e.Ac.length;
e.Ec = Math.max(e.Ec, b);
this.oc = e.mg
}
if (this.wrap === Hn || isNaN(this.desiredSize.width)) g = isNaN(a) ? e.Ec : Math.min(a, e.Ec), isNaN(this.desiredSize.width) && (g = Math.max(8, g));
g = Math.max(c, g);
f = Math.max(d, f);
Wb(this.qc, g, f);
Mk(this, 0, 0, g, f)
};
t.vh = function (a, b, c, d) {
Rk(this, a, b, c, d)
};
function In(a, b, c, d, e) {
b = b.trim();
var f = 0;
var g = a.fe;
var h = a.bf + a.cf;
h = Math.max(0, xn(a) + h);
var k = a.bg === En ? Fn(g) : 0;
if (a.oc >= a.ne) null !== e && e.h(0, h); else {
var l = b;
if (a.ng === Jn) if (c.mg = 1, g = Cn(b), 0 === k || g <= d) c.Ec = Math.max(c.Ec, g), c.Wc.push(c.Ec), c.Ac.push(b), null !== e && e.h(g, h); else {
f = Kn(a, l);
l = l.substr(f.length);
b = Kn(a, l);
for (g = Cn(f + b); 0 < b.length && g <= d;) f += b, l = l.substr(b.length), b = Kn(a, l), g = Cn((f + b).trim());
f += b.trim();
for (d = Math.max(1, d - k); Cn(f) > d && 1 < f.length;) f = f.substr(0, f.length - 1);
f += Gn;
b = Cn(f);
c.Wc.push(b);
c.Ec = b;
c.Ac.push(f);
null !== e && e.h(b, h)
} else {
k = 0;
0 === l.length && (k = 1, c.Wc.push(0), c.Ac.push(l));
for (; 0 < l.length;) {
var m = Kn(a, l);
for (l = l.substr(m.length); Cn(m) > d;) {
var n = 1;
g = Cn(m.substr(0, n));
for (b = 0; g <= d;) n++, b = g, g = Cn(m.substr(0, n));
1 === n ? (c.Wc[a.oc + k] = g, f = Math.max(f, g)) : (c.Wc[a.oc + k] = b, f = Math.max(f, b));
n--;
1 > n && (n = 1);
c.Ac[a.oc + k] = m.substr(0, n);
k++;
m = m.substr(n);
if (a.oc + k > a.ne) break
}
b = Kn(a, l);
for (g = Cn(m + b); 0 < b.length && g <= d;) m += b, l = l.substr(b.length), b = Kn(a, l), g = Cn((m + b).trim());
m = m.trim();
if ("" !== m && ("\u00ad" === m[m.length - 1] && (m = m.substring(0, m.length - 1) + "\u2010"), 0 === b.length ? (c.Wc.push(g), f = Math.max(f, g)) : (b = Cn(m), c.Wc.push(b), f = Math.max(f, b)), c.Ac.push(m), k++, a.oc + k > a.ne)) break
}
c.mg = Math.min(a.ne, k);
c.Ec = Math.max(c.Ec, f);
null !== e && e.h(c.Ec, h * c.mg)
}
}
}
function Kn(a, b) {
if (a.ng === Ln) return b.substr(0, 1);
a = b.length;
for (var c = 0, d = Mn; c < a && !d.test(b.charAt(c));) c++;
for (; c < a && d.test(b.charAt(c));) c++;
return c >= a ? b : b.substr(0, c)
}
function Cn(a) {
return null === An ? 8 * a.length : An.measureText(a).width
}
function xn(a) {
if (null !== a.nd.Kf) return a.nd.Kf;
var b = a.fe;
if (null === An) {
var c = 16;
return a.nd.Kf = c
}
void 0 !== Nn[b] && 5E3 > On ? c = Nn[b] : (c = 1.3 * An.measureText("M").width, Nn[b] = c, On++);
return a.nd.Kf = c
}
function Fn(a) {
if (null === An) return 6;
if (void 0 !== Pn[a] && 5E3 > Qn) var b = Pn[a]; else b = An.measureText(Gn).width, Pn[a] = b, Qn++;
return b
}
function Dn(a, b, c) {
var d = a.Ob.replace(/\r\n/g, "\n").replace(/\r/g, "\n"), e = a.bf + a.cf;
e = Math.max(0, xn(a) + e);
if (0 === d.length) return c.Ec = 0, a.oc = 1, e;
if (!a.isMultiline) {
var f = d.indexOf("\n", 0);
0 <= f && (d = d.substr(0, f))
}
f = 0;
for (var g = a.oc = 0, h, k = !1; !k;) {
h = d.indexOf("\n", g);
-1 === h && (h = d.length, k = !0);
if (g <= h) {
g = d.substr(g, h - g);
if (a.ng !== Jn) {
c.mg = 0;
var l = M.alloc();
In(a, g, c, b, l);
f += l.height;
M.free(l);
a.oc += c.mg
} else In(a, g, c, b, null), f += e, a.oc++;
a.oc === a.ne && (k = !0)
}
g = h + 1
}
return a.Rr = f
}
function un() {
Mn = /[ \u200b\u00ad]/;
Nn = new db;
Pn = new db;
An = Wg ? (new ik(null)).context : null
}
ma.Object.defineProperties(Yg.prototype, {
font: {
get: function () {
return this.fe
}, set: function (a) {
var b = this.fe;
b !== a && (this.fe = a, this.nd.Kf = null, this.s(), this.g("font", b, a))
}
}, text: {
get: function () {
return this.Ob
}, set: function (a) {
var b = this.Ob;
null !== a && void 0 !== a ? a = a.toString() : a = "";
b !== a && (this.Ob = a, this.s(), this.g("text", b, a))
}
}, textAlign: {
get: function () {
return this.xi
}, set: function (a) {
var b = this.xi;
b === a || "start" !==
a && "end" !== a && "left" !== a && "right" !== a && "center" !== a || (this.xi = a, this.R(), this.g("textAlign", b, a))
}
}, flip: {
get: function () {
return this.yd
}, set: function (a) {
var b = this.yd;
b !== a && (this.yd = a, this.R(), this.g("flip", b, a))
}
}, verticalAlignment: {
get: function () {
return this.Ci
}, set: function (a) {
var b = this.Ci;
b.A(a) || (this.Ci = a = a.I(), gl(this), this.g("verticalAlignment", b, a))
}
}, naturalBounds: {
get: function () {
if (!this.qc.o()) {
var a =
M.alloc();
In(this, this.Ob, this.nd, 999999, a);
var b = a.width;
M.free(a);
a = Dn(this, b, this.nd);
var c = this.desiredSize;
isNaN(c.width) || (b = c.width);
isNaN(c.height) || (a = c.height);
Wb(this.qc, b, a)
}
return this.qc
}
}, isMultiline: {
get: function () {
return this.pj
}, set: function (a) {
var b = this.pj;
b !== a && (this.pj = a, this.s(), this.g("isMultiline", b, a))
}
}, isUnderline: {
get: function () {
return this.fi
}, set: function (a) {
var b = this.fi;
b !== a && (this.fi = a, this.R(), this.g("isUnderline",
b, a))
}
}, isStrikethrough: {
get: function () {
return this.ei
}, set: function (a) {
var b = this.ei;
b !== a && (this.ei = a, this.R(), this.g("isStrikethrough", b, a))
}
}, wrap: {
get: function () {
return this.ng
}, set: function (a) {
var b = this.ng;
b !== a && (this.ng = a, this.s(), this.g("wrap", b, a))
}
}, overflow: {
get: function () {
return this.bg
}, set: function (a) {
var b = this.bg;
b !== a && (this.bg = a, this.s(), this.g("overflow", b, a))
}
}, stroke: {
get: function () {
return this.Gc
}, set: function (a) {
var b = this.Gc;
b !== a && (null !== a && ul(a, "TextBlock.stroke"), a instanceof Yk && a.freeze(), this.Gc = a, this.R(), this.g("stroke", b, a))
}
}, lineCount: {
get: function () {
return this.oc
}
}, editable: {
get: function () {
return this.An
}, set: function (a) {
var b = this.An;
b !== a && (this.An = a, this.g("editable", b, a))
}
}, textEditor: {
get: function () {
return this.Bp
}, set: function (a) {
var b = this.Bp;
b !== a &&
(this.Bp = a, this.g("textEditor", b, a))
}
}, errorFunction: {
get: function () {
return this.Cc
}, set: function (a) {
var b = this.Cc;
b !== a && (this.Cc = a, this.g("errorFunction", b, a))
}
}, interval: {
get: function () {
return this.Cd
}, set: function (a) {
var b = this.Cd;
a = Math.floor(a);
if (b !== a && 0 <= a) {
this.Cd = a;
this.s();
var c = this.panel;
null !== c && (c.Qg = null);
this.g("interval", b, a)
}
}
}, graduatedStart: {
get: function () {
return this.Bd
}, set: function (a) {
var b =
this.Bd;
b !== a && (0 > a ? a = 0 : 1 < a && (a = 1), this.Bd = a, this.s(), this.g("graduatedStart", b, a))
}
}, graduatedEnd: {
get: function () {
return this.zd
}, set: function (a) {
var b = this.zd;
b !== a && (0 > a ? a = 0 : 1 < a && (a = 1), this.zd = a, this.s(), this.g("graduatedEnd", b, a))
}
}, graduatedFunction: {
get: function () {
return this.kj
}, set: function (a) {
var b = this.kj;
b !== a && (this.kj = a, this.s(), this.g("graduatedFunction", b, a))
}
}, graduatedSkip: {
get: function () {
return this.Ad
},
set: function (a) {
var b = this.Ad;
b !== a && (this.Ad = a, this.s(), this.g("graduatedSkip", b, a))
}
}, textValidation: {
get: function () {
return this.yi
}, set: function (a) {
var b = this.yi;
b !== a && (this.yi = a, this.g("textValidation", b, a))
}
}, textEdited: {
get: function () {
return this.Ap
}, set: function (a) {
var b = this.Ap;
b !== a && (this.Ap = a, this.g("textEdited", b, a))
}
}, spacingAbove: {
get: function () {
return this.bf
}, set: function (a) {
var b = this.bf;
b !==
a && (this.bf = a, this.g("spacingAbove", b, a))
}
}, spacingBelow: {
get: function () {
return this.cf
}, set: function (a) {
var b = this.cf;
b !== a && (this.cf = a, this.g("spacingBelow", b, a))
}
}, maxLines: {
get: function () {
return this.ne
}, set: function (a) {
var b = this.ne;
b !== a && (a = Math.floor(a), 0 >= a && va(a, "> 0", Yg, "maxLines"), this.ne = a, this.g("maxLines", b, a), this.s())
}
}, metrics: {
get: function () {
return this.nd
}
}, choices: {
get: function () {
return this.Xm
}, set: function (a) {
var b = this.Xm;
b !== a && (this.Xm = a, this.g("choices", b, a))
}
}
});
var yn = null, zn = null, Jn = new D(Yg, "None", 0), Hn = new D(Yg, "WrapFit", 1),
wn = new D(Yg, "WrapDesiredSize", 2), Ln = new D(Yg, "WrapBreakAll", 3), vn = new D(Yg, "OverflowClip", 0),
En = new D(Yg, "OverflowEllipsis", 1), Mn = null, Nn = null, On = 0, Pn = null, Qn = 0, Gn = "...", Bn = "",
An = null, tn = !1;
Yg.className = "TextBlock";
Yg.getEllipsis = function () {
return Gn
};
Yg.setEllipsis = function (a) {
Gn = a;
Pn = new db;
Qn = 0
};
Yg.getBaseline = function () {
return yn
};
Yg.setBaseline = function (a) {
yn = a;
a = Oa();
for (var b = a.length, c = 0; c < b; c++) a[c].uf()
};
Yg.getUnderline = function () {
return zn
};
Yg.setUnderline = function (a) {
zn = a;
a = Oa();
for (var b = a.length, c = 0; c < b; c++) a[c].uf()
};
Yg.isValidFont = function (a) {
tn || (un(), tn = !0);
if (null === An) return !0;
var b = An.font;
if (a === b || "10px sans-serif" === a) return !0;
An.font = "10px sans-serif";
An.font = a;
var c = An.font;
if ("10px sans-serif" !== c) return An.font = b, !0;
An.font = "19px serif";
var d = An.font;
An.font = a;
c = An.font;
An.font = b;
return c !== d
};
Yg.None = Jn;
Yg.WrapFit = Hn;
Yg.WrapDesiredSize = wn;
Yg.WrapBreakAll = Ln;
Yg.OverflowClip = vn;
Yg.OverflowEllipsis = En;
function ym() {
this.Ec = this.mg = 0;
this.Wc = [];
this.Ac = [];
this.Kf = null
}
ym.prototype.reset = function () {
this.Ec = this.mg = 0;
this.Kf = null;
this.Wc = [];
this.Ac = []
};
ym.prototype.Wl = function (a) {
this.mg = a.mg;
this.Kf = a.Kf;
this.Ec = a.Ec;
this.Wc = Aa(a.Wc);
this.Ac = Aa(a.Ac)
};
ma.Object.defineProperties(ym.prototype, {
arrSize: {
get: function () {
return this.Wc
}
}, arrText: {
get: function () {
return this.Ac
}
}, maxLineWidth: {
get: function () {
return this.Ec
}
}, fontHeight: {
get: function () {
return this.Kf
}
}
});
ym.className = "TextBlockMetrics";
function Qj() {
Y.call(this);
this.Mg = null;
this.tp = "";
this.gh = oc;
this.bl = wd;
this.ff = this.Cc = null;
this.al = Fc;
this.yd = Bg;
this.Ml = null;
this.bu = !1;
this.pr = !0;
this.ol = !1;
this.El = null
}
la(Qj, Y);
Qj.prototype.cloneProtected = function (a) {
Y.prototype.cloneProtected.call(this, a);
a.element = this.Mg;
a.tp = this.tp;
a.gh = this.gh.I();
a.bl = this.bl;
a.yd = this.yd;
a.Cc = this.Cc;
a.ff = this.ff;
a.al = this.al.I();
a.pr = this.pr;
a.El = this.El
};
t = Qj.prototype;
t.fb = function (a) {
a === Bg || a === Dg || a === Ck ? this.imageStretch = a : Y.prototype.fb.call(this, a)
};
t.toString = function () {
return "Picture(" + this.source + ")#" + lb(this)
};
function Sj(a) {
void 0 === a && (a = "");
"" !== a ? Rn[a] && (delete Rn[a], Sn--) : (Rn = new db, Sn = 0)
}
function Tn(a, b) {
a.Er = !0;
a.$k = !1;
for (var c, d = Oa(), e = d.length, f = 0; f < e; f++) {
var g = d[f];
c = a.getAttribute("src");
var h = g.Ej.J(c);
if (null !== h) for (var k = h.length, l = 0; l < k; l++) c = h[l], g.nu.add(c), g.cc(), void 0 === a.tu && (a.tu = b, null !== c.ff && c.ff(c, b))
}
}
function Un(a, b) {
a.$k = b;
for (var c, d = Oa(), e = d.length, f = 0; f < e; f++) {
var g = d[f], h = a.getAttribute("src");
c = g.Ej.J(h);
if (null !== c) {
g = c.length;
h = Da();
for (var k = 0; k < g; k++) h.push(c[k]);
for (k = 0; k < g; k++) c = h[k], null !== c.Cc && c.Cc(c, b);
Ga(h)
}
}
}
t.Jz = function () {
if ("" !== this.source) {
Sj(this.source);
var a = this.source;
this.source = "";
this.source = a
}
};
t.uf = function () {
this.R()
};
t.Fi = function (a, b) {
var c = this.Mg;
if (null !== c) {
var d = c.getAttribute("src");
c instanceof HTMLImageElement && (null === d || "" === d) && B('Element has no source ("src") attribute: ' + c);
if (!(c.$k instanceof Event)) {
d = this.naturalBounds;
var e = 0, f = 0, g = this.bu, h = g ? +c.width : c.naturalWidth;
g = g ? +c.height : c.naturalHeight;
void 0 === h && c.videoWidth && (h = c.videoWidth);
void 0 === g && c.videoHeight && (g = c.videoHeight);
h = h || d.width;
g = g || d.height;
if (0 !== h && 0 !== g) {
var k = h, l = g;
this.sourceRect.o() && (e = this.gh.x, f = this.gh.y, h = this.gh.width,
g = this.gh.height);
var m = h, n = g, p = this.bl, r = this.al;
switch (p) {
case Bg:
if (this.sourceRect.o()) break;
m >= d.width && (e = e + r.offsetX + (m * r.x - d.width * r.x));
n >= d.height && (f = f + r.offsetY + (n * r.y - d.height * r.y));
h = Math.min(d.width, m);
g = Math.min(d.height, n);
break;
case wd:
m = d.width;
n = d.height;
break;
case Dg:
case Ck:
p === Dg ? (p = Math.min(d.height / n, d.width / m), m *= p, n *= p) : p === Ck && (p = Math.max(d.height / n, d.width / m), m *= p, n *= p, m >= d.width && (e = (e + r.offsetX + (m * r.x - d.width * r.x) / m) * h), n >= d.height && (f = (f + r.offsetY + (n * r.y - d.height * r.y) /
n) * g), h *= 1 / (m / d.width), g *= 1 / (n / d.height), m = d.width, n = d.height)
}
p = this.De() * b.scale;
var q = m * p * n * p, u = h * g / q, v = c.__goCache;
p = null;
var w = Vn;
if (c.Er && void 0 !== v && 4 < q && u > w * w) for (null === v.Ei && (Wn(v, 4, k, l, c), Wn(v, 16, k, l, c)), k = v.Ei, l = k.length, q = 0; q < l; q++) if (k[q].ratio * k[q].ratio < u) p = k[q]; else break;
if (!b.xn) {
if (null === this.Ml) if (null === this.Mg) this.Ml = !1; else {
k = (new ik(null)).context;
k.drawImage(this.Mg, 0, 0);
try {
k.getImageData(0, 0, 1, 1).data[3] && (this.Ml = !1), this.Ml = !1
} catch (z) {
this.Ml = !0
}
}
if (this.Ml) return
}
k =
0;
m < d.width && (k = r.offsetX + (d.width * r.x - m * r.x));
l = 0;
n < d.height && (l = r.offsetY + (d.height * r.y - n * r.y));
switch (this.flip) {
case Ek:
a.translate(Math.min(d.width, m), 0);
a.scale(-1, 1);
break;
case Dk:
a.translate(0, Math.min(d.height, n));
a.scale(1, -1);
break;
case Fk:
a.translate(Math.min(d.width, m), Math.min(d.height, n)), a.scale(-1, -1)
}
if (b.Ee("pictureRatioOptimization") && !b.oj && void 0 !== v && null !== p && 1 !== p.ratio) {
a.save();
b = p.ratio;
try {
a.drawImage(p.source, e / b, f / b, Math.min(p.source.width, h / b), Math.min(p.source.height,
g / b), k, l, Math.min(d.width, m), Math.min(d.height, n))
} catch (z) {
this.pr = !1
}
a.restore()
} else try {
a.drawImage(c, e, f, h, g, k, l, Math.min(d.width, m), Math.min(d.height, n))
} catch (z) {
this.pr = !1
}
switch (this.flip) {
case Ek:
a.scale(-1, 1);
a.translate(-Math.min(d.width, m), 0);
break;
case Dk:
a.scale(1, -1);
a.translate(0, -Math.min(d.height, n));
break;
case Fk:
a.scale(-1, -1), a.translate(-Math.min(d.width, m), -Math.min(d.height, n))
}
}
}
}
};
t.im = function (a, b, c, d) {
var e = this.desiredSize, f = Pk(this, !0), g = this.Mg, h = this.bu;
if (h || !this.ol && g && g.complete) this.ol = !0;
null === g && (isFinite(e.width) || (a = 0), isFinite(e.height) || (b = 0));
isFinite(e.width) || f === wd || f === Ak ? (isFinite(a) || (a = this.sourceRect.o() ? this.sourceRect.width : h ? +g.width : g.naturalWidth), c = 0) : null !== g && !1 !== this.ol && (a = this.sourceRect.o() ? this.sourceRect.width : h ? +g.width : g.naturalWidth);
isFinite(e.height) || f === wd || f === Bk ? (isFinite(b) || (b = this.sourceRect.o() ? this.sourceRect.height : h ?
+g.height : g.naturalHeight), d = 0) : null !== g && !1 !== this.ol && (b = this.sourceRect.o() ? this.sourceRect.height : h ? +g.height : g.naturalHeight);
isFinite(e.width) && (a = e.width);
isFinite(e.height) && (b = e.height);
e = this.maxSize;
f = this.minSize;
c = Math.max(c, f.width);
d = Math.max(d, f.height);
a = Math.min(e.width, a);
b = Math.min(e.height, b);
a = Math.max(c, a);
b = Math.max(d, b);
null === g || g.complete || (isFinite(a) || (a = 0), isFinite(b) || (b = 0));
Wb(this.qc, a, b);
Mk(this, 0, 0, a, b)
};
t.vh = function (a, b, c, d) {
Rk(this, a, b, c, d)
};
ma.Object.defineProperties(Qj.prototype, {
element: {
get: function () {
return this.Mg
}, set: function (a) {
var b = this.Mg;
if (b !== a) {
null === a || a instanceof HTMLImageElement || a instanceof HTMLVideoElement || a instanceof HTMLCanvasElement || B("Picture.element must be an instance of Image, Canvas, or Video, not: " + a);
this.bu = a instanceof HTMLCanvasElement;
this.Mg = a;
if (null !== a) if (a instanceof HTMLCanvasElement || !0 === a.complete) a.$k instanceof Event && null !== this.Cc && this.Cc(this, a.$k),
!0 === a.Er && null !== this.ff && this.ff(this, a.tu), a.Er = !0, this.desiredSize.o() || (Vi(this, !1), this.s()); else {
var c = this;
a.xw || (a.addEventListener("load", function (b) {
Tn(a, b);
c.desiredSize.o() || (Vi(c, !1), c.s())
}), a.addEventListener("error", function (b) {
Un(a, b)
}), a.xw = !0)
}
this.g("element", b, a);
this.R()
}
}
}, source: {
get: function () {
return this.tp
}, set: function (a) {
var b = this.tp;
if (b !== a) {
this.tp = a;
var c = Rn, d = this.diagram, e = null;
if (void 0 !== c[a]) e = c[a]; else {
30 < Sn && (Sj(), c = Rn);
e = ta("img");
var f = this;
e.addEventListener("load", function (a) {
Tn(e, a);
f.desiredSize.o() || (Vi(f, !1), f.s())
});
e.addEventListener("error", function (a) {
Un(e, a)
});
e.xw = !0;
var g = this.El;
null !== g && (e.crossOrigin = g(this));
e.src = a;
c[a] = e;
Sn++
}
null !== d && Rj(d, this);
this.element = e;
null !== d && Mj(d, this);
void 0 === e.__goCache && (e.__goCache = new Xn);
this.s();
this.R();
this.g("source", b, a)
}
}
}, sourceCrossOrigin: {
get: function () {
return this.El
}, set: function (a) {
if (this.El !== a && (this.El = a, null !== this.element)) {
var b =
this.element.getAttribute("src");
null === a && "string" === typeof b ? this.element.crossOrigin = null : null !== a && (this.element.crossOrigin = a(this));
this.element.src = b
}
}
}, sourceRect: {
get: function () {
return this.gh
}, set: function (a) {
var b = this.gh;
b.A(a) || (this.gh = a = a.I(), this.R(), this.g("sourceRect", b, a))
}
}, imageStretch: {
get: function () {
return this.bl
}, set: function (a) {
var b = this.bl;
b !== a && (this.bl = a, this.R(), this.g("imageStretch", b, a))
}
}, flip: {
get: function () {
return this.yd
}, set: function (a) {
var b = this.yd;
b !== a && (this.yd = a, this.R(), this.g("flip", b, a))
}
}, imageAlignment: {
get: function () {
return this.al
}, set: function (a) {
var b = this.al;
b.A(a) || (this.al = a = a.I(), this.s(), this.g("imageAlignment", b, a))
}
}, errorFunction: {
get: function () {
return this.Cc
}, set: function (a) {
var b = this.Cc;
b !== a && (this.Cc = a, this.g("errorFunction", b, a))
}
}, successFunction: {
get: function () {
return this.ff
},
set: function (a) {
var b = this.ff;
b !== a && (this.ff = a, this.g("successFunction", b, a))
}
}, naturalBounds: {
get: function () {
return this.qc
}
}
});
Qj.prototype.redraw = Qj.prototype.uf;
Qj.prototype.reloadSource = Qj.prototype.Jz;
var Rn = null, Sn = 0, Vn = 4;
Qj.className = "Picture";
Rn = new db;
Qj.clearCache = Sj;
function Xn() {
this.Ei = null
}
function Wn(a, b, c, d, e) {
null === a.Ei && (a.Ei = []);
var f = new ik(null), g = f.context, h = 1 / b;
f.width = c / b;
f.height = d / b;
0 !== f.width && 0 !== f.height && (b = new Yn(f.Ga, b), c = 1, 0 < a.Ei.length && (c = a.Ei[a.Ei.length - 1], e = c.source, c = c.ratio), g.setTransform(h * c, 0, 0, h * c, 0, 0), g.drawImage(e, 0, 0), a.Ei.push(b))
}
Xn.className = "PictureCacheArray";
function Yn(a, b) {
this.source = a;
this.ratio = b
}
Yn.className = "PictureCacheInstance";
function Zn() {
this.Us = new ud;
this.ec = null
}
t = Zn.prototype;
t.reset = function (a) {
null !== a ? (a.ha(), this.Us = a, a.figures.clear()) : this.Us = new ud;
this.ec = null
};
function Ld(a, b, c, d, e) {
a.ec = new ke;
a.ec.startX = b;
a.ec.startY = c;
a.ec.isFilled = d;
a.Us.figures.add(a.ec);
void 0 !== e && (a.ec.isShadowed = e)
}
function Td(a) {
var b = a.ec.segments.length;
0 < b && a.ec.segments.N(b - 1).close()
}
t.uq = function (a) {
this.ec.isShadowed = a
};
t.moveTo = function (a, b, c) {
void 0 === c && (c = !1);
var d = new le(Xd);
d.endX = a;
d.endY = b;
c && d.close();
this.ec.segments.add(d)
};
t.lineTo = function (a, b, c) {
void 0 === c && (c = !1);
var d = new le(Fd);
d.endX = a;
d.endY = b;
c && d.close();
this.ec.segments.add(d)
};
function Qd(a, b, c, d, e, f, g) {
var h;
void 0 === h && (h = !1);
var k = new le(Yd);
k.point1X = b;
k.point1Y = c;
k.point2X = d;
k.point2Y = e;
k.endX = f;
k.endY = g;
h && k.close();
a.ec.segments.add(k)
}
function Rd(a, b, c, d, e) {
var f;
void 0 === f && (f = !1);
var g = new le(Zd);
g.point1X = b;
g.point1Y = c;
g.endX = d;
g.endY = e;
f && g.close();
a.ec.segments.add(g)
}
t.arcTo = function (a, b, c, d, e, f, g) {
void 0 === f && (f = 0);
void 0 === g && (g = !1);
var h = new le($d);
h.startAngle = a;
h.sweepAngle = b;
h.centerX = c;
h.centerY = d;
h.radiusX = e;
h.radiusY = 0 !== f ? f : e;
g && h.close();
this.ec.segments.add(h)
};
function Sd(a, b, c, d, e, f, g, h) {
var k;
void 0 === k && (k = !1);
b = new le(ae, g, h, b, c, d, e, f);
k && b.close();
a.ec.segments.add(b)
}
function Kd(a) {
var b = Ud;
if (null !== b) return Ud = null, b.reset(a), b;
b = new Zn;
b.reset(a);
return b
}
var Ud = null;
Zn.className = "StreamGeometryContext";
function $n(a, b) {
var c = a.toLowerCase(), d = H.Ke;
d[a] = b;
d[c] = a
}
$n("Rectangle", function (a, b, c) {
a = new ud(Hd);
a.startX = 0;
a.startY = 0;
a.endX = b;
a.endY = c;
return a
});
$n("Square", function (a, b, c) {
a = new ud(Hd);
a.startX = 0;
a.startY = 0;
a.endX = b;
a.endY = c;
a.defaultStretch = Dg;
return a
});
$n("RoundedRectangle", function (a, b, c) {
var d = a ? a.parameter1 : NaN;
if (isNaN(d) || 0 >= d) d = 5;
d = Math.min(d, b / 3);
d = Math.min(d, c / 3);
a = d * H.Bg;
b = (new ud).add((new ke(d, 0, !0)).add(new le(Fd, b - d, 0)).add(new le(Yd, b, d, b - a, 0, b, a)).add(new le(Fd, b, c - d)).add(new le(Yd, b - d, c, b, c - a, b - a, c)).add(new le(Fd, d, c)).add(new le(Yd, 0, c - d, a, c, 0, c - a)).add(new le(Fd, 0, d)).add((new le(Yd, d, 0, 0, a, a, 0)).close()));
1 < a && (b.spot1 = new O(0, 0, a, a), b.spot2 = new O(1, 1, -a, -a));
return b
});
$n("Border", "RoundedRectangle");
$n("Ellipse", function (a, b, c) {
a = new ud(Id);
a.startX = 0;
a.startY = 0;
a.endX = b;
a.endY = c;
a.spot1 = od;
a.spot2 = pd;
return a
});
$n("Circle", function (a, b, c) {
a = new ud(Id);
a.startX = 0;
a.startY = 0;
a.endX = b;
a.endY = c;
a.spot1 = od;
a.spot2 = pd;
a.defaultStretch = Dg;
return a
});
$n("TriangleRight", function (a, b, c) {
return (new ud).add((new ke(0, 0)).add(new le(Fd, b, .5 * c)).add((new le(Fd, 0, c)).close())).ym(0, .25, .5, .75)
});
$n("TriangleDown", function (a, b, c) {
return (new ud).add((new ke(0, 0)).add(new le(Fd, b, 0)).add((new le(Fd, .5 * b, c)).close())).ym(.25, 0, .75, .5)
});
$n("TriangleLeft", function (a, b, c) {
return (new ud).add((new ke(b, c)).add(new le(Fd, 0, .5 * c)).add((new le(Fd, b, 0)).close())).ym(.5, .25, 1, .75)
});
$n("TriangleUp", function (a, b, c) {
return (new ud).add((new ke(b, c)).add(new le(Fd, 0, c)).add((new le(Fd, .5 * b, 0)).close())).ym(.25, .5, .75, 1)
});
$n("Triangle", "TriangleUp");
$n("Diamond", function (a, b, c) {
return (new ud).add((new ke(.5 * b, 0)).add(new le(Fd, 0, .5 * c)).add(new le(Fd, .5 * b, c)).add((new le(Fd, b, .5 * c)).close())).ym(.25, .25, .75, .75)
});
$n("LineH", function (a, b, c) {
a = new ud(xd);
a.startX = 0;
a.startY = c / 2;
a.endX = b;
a.endY = c / 2;
return a
});
$n("LineV", function (a, b, c) {
a = new ud(xd);
a.startX = b / 2;
a.startY = 0;
a.endX = b / 2;
a.endY = c;
return a
});
$n("None", "Rectangle");
$n("BarH", "Rectangle");
$n("BarV", "Rectangle");
$n("MinusLine", "LineH");
$n("PlusLine", function (a, b, c) {
return (new ud).add((new ke(0, c / 2, !1)).add(new le(Fd, b, c / 2)).add(new le(Xd, b / 2, 0)).add(new le(Fd, b / 2, c)))
});
$n("XLine", function (a, b, c) {
return (new ud).add((new ke(0, c, !1)).add(new le(Fd, b, 0)).add(new le(Xd, 0, 0)).add(new le(Fd, b, c)))
});
H.Cm = {
"": "",
Standard: "F1 m 0,0 l 8,4 -8,4 2,-4 z",
Backward: "F1 m 8,0 l -2,4 2,4 -8,-4 z",
Triangle: "F1 m 0,0 l 8,4.62 -8,4.62 z",
BackwardTriangle: "F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",
Boomerang: "F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",
BackwardBoomerang: "F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",
SidewaysV: "m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",
BackwardV: "m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",
OpenTriangle: "m 0,0 l 8,4 -8,4",
BackwardOpenTriangle: "m 8,0 l -8,4 8,4",
OpenTriangleLine: "m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine: "m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",
OpenTriangleTop: "m 0,0 l 8,4 m 0,4",
BackwardOpenTriangleTop: "m 8,0 l -8,4 m 0,4",
OpenTriangleBottom: "m 0,8 l 8,-4",
BackwardOpenTriangleBottom: "m 0,4 l 8,4",
HalfTriangleTop: "F1 m 0,0 l 0,4 8,0 z m 0,8",
BackwardHalfTriangleTop: "F1 m 8,0 l 0,4 -8,0 z m 0,8",
HalfTriangleBottom: "F1 m 0,4 l 0,4 8,-4 z",
BackwardHalfTriangleBottom: "F1 m 8,4 l 0,4 -8,-4 z",
ForwardSemiCircle: "m 4,0 b 270 180 0 4 4",
BackwardSemiCircle: "m 4,8 b 90 180 0 -4 4",
Feather: "m 0,0 l 3,4 -3,4",
BackwardFeather: "m 3,0 l -3,4 3,4",
DoubleFeathers: "m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",
BackwardDoubleFeathers: "m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",
TripleFeathers: "m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",
BackwardTripleFeathers: "m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",
ForwardSlash: "m 0,8 l 5,-8",
BackSlash: "m 0,0 l 5,8",
DoubleForwardSlash: "m 0,8 l 4,-8 m -2,8 l 4,-8",
DoubleBackSlash: "m 0,0 l 4,8 m -2,-8 l 4,8",
TripleForwardSlash: "m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash: "m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",
Fork: "m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",
BackwardFork: "m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",
LineFork: "m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",
BackwardLineFork: "m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",
CircleFork: "F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleFork: "F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",
CircleLineFork: "F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork: "F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",
Circle: "F1 m 8,4 b 0 360 -4 0 4 z",
Block: "F1 m 0,0 l 0,8 8,0 0,-8 z",
StretchedDiamond: "F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",
Diamond: "F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",
Chevron: "F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",
StretchedChevron: "F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",
NormalArrow: "F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",
X: "m 0,0 l 8,8 m 0,-8 l -8,8",
TailedNormalArrow: "F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle: "F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",
BigEndArrow: "F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",
ConcaveTailArrow: "F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",
RoundedTriangle: "F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",
SimpleArrow: "F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",
AccelerationArrow: "F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",
BoxArrow: "F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine: "F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",
CircleEndedArrow: "F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",
DynamicWidthArrow: "F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",
EquilibriumArrow: "m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",
FastForward: "F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",
Kite: "F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",
HalfArrowTop: "F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",
HalfArrowBottom: "F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow: "F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",
PartialDoubleTriangle: "F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",
LineCircle: "F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",
DoubleLineCircle: "F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",
TripleLineCircle: "F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",
CircleLine: "F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",
DiamondCircle: "F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",
PlusCircle: "F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop: "m 8,0 l 0,4 -8,0 m 0,4",
OpenRightTriangleBottom: "m 8,8 l 0,-4 -8,0",
Line: "m 0,0 l 0,8",
DoubleLine: "m 0,0 l 0,8 m 2,0 l 0,-8",
TripleLine: "m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",
PentagonArrow: "F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"
};
function S(a) {
X.call(this, a);
this.D = 2408959;
this.Ug = this.Bf = "";
this.Zo = this.Wo = this.kp = this.ao = null;
this.mp = "";
this.yf = this.Nn = this.lp = this.eh = null;
this.Yo = "";
this.Xo = Rb;
this.Ob = this.$o = "";
this.hi = this.$m = this.Th = null;
this.me = (new G(NaN, NaN)).freeze();
this.io = "";
this.Xe = null;
this.jo = zc;
this.ap = ad;
this.ro = Gb;
this.ko = Hb;
this.wn = null;
this.bo = 127;
this.vi = Ib;
this.Kj = "gray";
this.Od = 4;
this.Aw = -1;
this.Lp = NaN;
this.Sx = new N;
this.xj = null;
this.Xg = NaN
}
la(S, X);
S.prototype.cloneProtected = function (a) {
X.prototype.cloneProtected.call(this, a);
a.D = this.D & -4097 | 49152;
a.Bf = this.Bf;
a.Ug = this.Ug;
a.ao = this.ao;
a.kp = this.kp;
a.Wo = this.Wo;
a.Zo = this.Zo;
a.mp = this.mp;
a.lp = this.lp;
a.Nn = this.Nn;
a.yf = null;
a.Yo = this.Yo;
a.Xo = this.Xo.I();
a.$o = this.$o;
a.ap = this.ap.I();
a.Ob = this.Ob;
a.$m = this.$m;
a.me.assign(this.me);
a.io = this.io;
a.jo = this.jo.I();
a.ro = this.ro.I();
a.ko = this.ko.I();
a.wn = this.wn;
a.bo = this.bo;
a.vi = this.vi.I();
a.Kj = this.Kj;
a.Od = this.Od;
a.Lp = this.Lp
};
S.prototype.pf = function (a) {
X.prototype.pf.call(this, a);
a.Ah();
a.eh = null;
a.Xe = null;
a.xj = null
};
S.prototype.toString = function () {
var a = Ha(this.constructor) + "#" + lb(this);
null !== this.data && (a += "(" + Ja(this.data) + ")");
return a
};
S.prototype.qk = function (a, b, c, d, e, f, g) {
var h = this.diagram;
null !== h && (a === te && "elements" === b ? e instanceof X ? mj(e, function (a) {
oj(h.partManager, a);
nj(h, a)
}) : Mj(h, e) : a === ue && "elements" === b && (e instanceof X ? mj(e, function (a) {
rj(h.partManager, a, h)
}) : Rj(h, e)), h.ab(a, b, c, d, e, f, g))
};
S.prototype.Ea = function (a) {
X.prototype.Ea.call(this, a);
if (null !== this.data) {
a = this.Y.j;
for (var b = a.length, c = 0; c < b; c++) {
var d = a[c];
d instanceof X && mj(d, function (a) {
null !== a.data && a.Ea()
})
}
}
};
S.prototype.updateRelationshipsFromData = function () {
null !== this.data && this.diagram.partManager.updateRelationshipsFromData(this)
};
S.prototype.bk = function (a) {
var b = this.yf;
return null === b ? null : b.J(a)
};
S.prototype.rh = function (a, b) {
if (null !== b) {
var c = null, d = this.yf;
null !== d && (c = d.J(a));
if (c !== b) {
if (null !== c) {
var e = c.diagram;
null !== e && e.remove(c)
}
null === d && (this.yf = d = new vb);
b.Bf !== a && (b.category = a);
d.add(a, b);
a = this.diagram;
null !== a && (a.add(b), a = b.adornedObject, null !== a && (a = a.Ji(), null !== a && (b.data = a.data)))
}
}
};
S.prototype.vf = function (a) {
var b = this.yf;
if (null !== b) {
var c = b.J(a);
if (null !== c) {
var d = c.diagram;
null !== d && d.remove(c)
}
b.remove(a);
0 === b.count && (this.yf = null)
}
};
S.prototype.Uj = function () {
var a = this.yf;
if (null !== a) {
var b = Da();
for (a = a.iterator; a.next();) b.push(a.key);
a = b.length;
for (var c = 0; c < a; c++) this.vf(b[c]);
Ga(b)
}
};
S.prototype.updateAdornments = function () {
var a = this.diagram;
if (null !== a) {
for (var b = this.adornments; b.next();) {
var c = b.value;
c.s();
c.placeholder && c.placeholder.s()
}
a:{
if (this.isSelected && this.selectionAdorned && (b = this.selectionObject, null !== b && this.actualBounds.o() && this.isVisible() && b.tf() && b.actualBounds.o())) {
c = this.bk("Selection");
if (null === c) {
c = this.selectionAdornmentTemplate;
null === c && (c = this.Bh() ? a.linkSelectionAdornmentTemplate : this instanceof U ? a.groupSelectionAdornmentTemplate : a.nodeSelectionAdornmentTemplate);
if (!(c instanceof Je)) break a;
Ag(c);
c = c.copy();
null !== c && (this.Bh() && this.selectionObject === this.path && (c.type = X.Link), c.adornedObject = b)
}
if (null !== c) {
if (null !== c.placeholder) {
var d = b.De(), e = 0;
b instanceof W && (e = b.strokeWidth);
var f = M.alloc();
f.h((b.naturalBounds.width + e) * d, (b.naturalBounds.height + e) * d);
M.free(f)
}
c.type === X.Link ? c.s() : (b = G.alloc(), G.free(b));
this.rh("Selection", c);
break a
}
}
this.vf("Selection")
}
ao(this, a);
for (b = this.adornments; b.next();) b.value.Ea()
}
};
S.prototype.Jb = function () {
var a = this.diagram;
null !== a && (Ai(a), 0 !== (this.D & 16384) !== !0 && (Qh(this, !0), a.cc()))
};
function Ph(a) {
0 !== (a.D & 16384) !== !1 && (a.updateAdornments(), Qh(a, !1))
}
function ao(a, b) {
b.toolManager.mouseDownTools.each(function (b) {
b.isEnabled && b.updateAdornments(a)
});
b.toolManager.updateAdornments(a)
}
function bo(a) {
if (!1 === bj(a)) {
co(a, !0);
a.gl();
var b = a.diagram;
null !== b && (b.Dd.add(a), b.cc())
}
}
function eo(a) {
a.D |= 2097152;
if (!1 !== bj(a)) {
var b = a.position, c = a.location;
c.o() && b.o() || fo(a, b, c);
c = a.vb;
var d = N.alloc().assign(c);
c.ha();
c.x = b.x;
c.y = b.y;
c.freeze();
a.lt(d, c);
N.free(d);
co(a, !1)
}
}
S.prototype.move = function (a, b) {
!0 === b ? this.location = a : this.position = a
};
S.prototype.moveTo = function (a, b, c) {
a = G.allocAt(a, b);
this.move(a, c);
G.free(a)
};
S.prototype.isVisible = function () {
if (!this.visible) return !1;
var a = this.layer;
if (null !== a && !a.visible) return !1;
a = this.diagram;
if (null !== a && Fh(a.animationManager, this)) return !0;
a = this.containingGroup;
return null === a || a.isSubGraphExpanded && a.isVisible() ? !0 : !1
};
t = S.prototype;
t.Lb = function (a) {
var b = this.diagram;
a ? (this.B(4), this.Jb(), null !== b && b.Dd.add(this)) : (this.B(8), this.Uj());
this.Ah();
null !== b && (b.Xa(), b.R())
};
t.$a = function (a) {
if (this.name === a) return this;
var b = this.xj;
null === b && (this.xj = b = new vb);
if (null !== b.J(a)) return b.J(a);
var c = X.prototype.$a.call(this, a);
if (null !== c) return b.set(a, c), c;
b.set(a, null);
return null
};
t.qf = function (a, b, c) {
void 0 === c && (c = new G);
b = b.jc() ? Fc : b;
var d = a.naturalBounds;
c.h(d.width * b.x + b.offsetX, d.height * b.y + b.offsetY);
if (null === a || a === this) return c;
a.transform.ta(c);
for (a = a.panel; null !== a && a !== this;) a.transform.ta(c), a = a.panel;
this.Rf.ta(c);
c.offset(-this.pc.x, -this.pc.y);
return c
};
t.Zp = function (a) {
void 0 === a && (a = new N);
return a.assign(this.actualBounds)
};
t.$b = function () {
!0 === $i(this) && (this instanceof U && this.memberParts.each(function (a) {
a.$b()
}), this.measure(Infinity, Infinity));
this.arrange()
};
function kj(a, b) {
var c = a.Sx;
isNaN(a.Xg) && (a.Xg = Jm(a));
var d = a.Xg;
var e = 2 * d;
if (!a.isShadowed) return c.h(b.x - 1 - d, b.y - 1 - d, b.width + 2 + e, b.height + 2 + e), c;
d = b.x;
e = b.y;
var f = b.width;
b = b.height;
var g = a.shadowBlur;
a = a.shadowOffset;
f += g;
b += g;
d -= g / 2;
e -= g / 2;
0 < a.x ? f += a.x : (d += a.x, f -= a.x);
0 < a.y ? b += a.y : (e += a.y, b -= a.y);
c.h(d - 1, e - 1, f + 2, b + 2);
return c
}
S.prototype.arrange = function () {
if (!1 === aj(this)) eo(this); else {
var a = this.vb, b = N.alloc();
b.assign(a);
a.ha();
var c = Kf(this);
this.vh(0, 0, this.pc.width, this.pc.height);
var d = this.position;
fo(this, d, this.location);
a.x = d.x;
a.y = d.y;
a.freeze();
this.lt(b, a);
Qk(this, !1);
b.A(a) ? this.hd(c) : !this.bc() || H.w(b.width, a.width) && H.w(b.height, a.height) || 0 <= this.Aw && this.B(16);
N.free(b);
co(this, !1)
}
};
t = S.prototype;
t.lt = function (a, b) {
var c = this.diagram;
if (null !== c) {
var d = !1;
if (!1 === c.Sg && a.o()) {
var e = N.alloc();
e.assign(c.documentBounds);
e.Qv(c.padding);
a.x > e.x && a.y > e.y && a.right < e.right && a.bottom < e.bottom && b.x > e.x && b.y > e.y && b.right < e.right && b.bottom < e.bottom && (d = !0);
N.free(e)
}
0 !== (this.D & 65536) !== !0 && a.A(b) || pj(this, d, c);
c.R();
ac(a, b) || (this instanceof V && !c.undoManager.isUndoingRedoing && this.ed(), this.Ah())
}
};
t.Mv = function (a, b) {
if (this.Bh() || !a.o()) return !1;
var c = this.diagram;
if (null !== c && (go(this, c, a, b), !0 === c.undoManager.isUndoingRedoing)) return !0;
this.sa = a;
this.D &= -2097153;
c = this.me;
c.o() && (this.me = new G(c.x + (a.x - b.x), c.y + (a.y - b.y)), this.g("location", c, this.me));
!1 === bj(this) && !1 === aj(this) && (bo(this), eo(this));
return !0
};
function go(a, b, c, d) {
null === b || a instanceof Je || (b = b.animationManager, b.oi && b.th(a, "position", d.copy(), c.copy(), !1))
}
t.wt = function (a, b) {
var c = this.me, d = this.sa;
bj(this) || aj(this) ? c.h(NaN, NaN) : c.h(c.x + a - d.x, c.y + b - d.y);
d.h(a, b);
bo(this)
};
t.Nv = function () {
this.D &= -2097153;
bo(this)
};
function fo(a, b, c) {
var d = G.alloc(), e = a.locationSpot, f = a.locationObject;
e.jc() && B("determineOffset: Part's locationSpot must be real: " + e.toString());
var g = f.naturalBounds, h = f instanceof W ? f.strokeWidth : 0;
d.sk(0, 0, g.width + h, g.height + h, e);
if (f !== a) for (d.offset(-h / 2, -h / 2), f.transform.ta(d), e = f.panel; null !== e && e !== a;) e.transform.ta(d), e = e.panel;
a.Rf.ta(d);
d.offset(-a.pc.x, -a.pc.y);
e = a.diagram;
f = c.o();
g = b.o();
f && g ? 0 !== (a.D & 2097152) ? ho(a, b, c, e, d) : io(a, b, c, e, d) : f ? ho(a, b, c, e, d) : g && io(a, b, c, e, d);
a.D |= 2097152;
G.free(d);
a.gl()
}
function ho(a, b, c, d, e) {
var f = b.x, g = b.y;
b.h(c.x - e.x, c.y - e.y);
null !== d && (c = d.animationManager, (e = c.isAnimating) || !c.oi || a instanceof Je || c.th(a, "position", new G(f, g), b, !1), e || b.x === f && b.y === g || (c = d.skipsUndoManager, d.skipsUndoManager = !0, a.g("position", new G(f, g), b), d.skipsUndoManager = c))
}
function io(a, b, c, d, e) {
var f = c.copy();
c.h(b.x + e.x, b.y + e.y);
c.A(f) || null === d || (b = d.skipsUndoManager, d.skipsUndoManager = !0, a.g("location", f, c), d.skipsUndoManager = b)
}
function pj(a, b, c) {
Sk(a, !1);
a instanceof V && dk(c, a);
a.layer.isTemporary || b || c.Xa();
b = a.vb;
var d = c.viewportBounds;
d.o() ? Kf(a) ? (dc(b, d, 10) || a.hd(!1), a.updateAdornments()) : b.Ic(d) ? (a.hd(!0), a.updateAdornments()) : a.Jb() : c.di = !0
}
t.Si = function () {
return !0
};
t.bc = function () {
return !0
};
t.Bh = function () {
return !1
};
t.wg = function () {
return !0
};
function jo(a, b, c, d) {
b.constructor === a.constructor || ko || (ko = !0, wa('Should not change the class of the Part when changing category from "' + c + '" to "' + d + '"'), wa(" Old class: " + Ha(a.constructor) + ", new class: " + Ha(b.constructor) + ", part: " + a.toString()));
a.Uj();
var e = a.data;
c = a.layerName;
var f = a.isSelected, g = a.isHighlighted, h = !0, k = !0, l = !1;
a instanceof V && (h = a.isTreeLeaf, k = a.isTreeExpanded, l = a.wasTreeExpanded);
b.pf(a);
b.cloneProtected(a);
a.Bf = d;
a.s();
a.R();
b = a.diagram;
d = !0;
null !== b && (d = b.skipsUndoManager,
b.skipsUndoManager = !0);
a.jb = e;
a.D = f ? a.D | 4096 : a.D & -4097;
a.D = g ? a.D | 524288 : a.D & -524289;
a instanceof V && (a.S = h ? a.S | 4 : a.S & -5, a.S = k ? a.S | 1 : a.S & -2, a.S = l ? a.S | 2 : a.S & -3);
null !== e && a.Ea();
e = a.layerName;
e !== c && (a.Ug = c, a.layerName = e);
null !== b && (b.skipsUndoManager = d);
a.bc() && a.B(64)
}
S.prototype.canCopy = function () {
if (!this.copyable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowCopy) return !1;
a = a.diagram;
return null === a ? !0 : a.allowCopy ? !0 : !1
};
S.prototype.canDelete = function () {
if (!this.deletable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowDelete) return !1;
a = a.diagram;
return null === a ? !0 : a.allowDelete ? !0 : !1
};
S.prototype.canEdit = function () {
if (!this.textEditable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowTextEdit) return !1;
a = a.diagram;
return null === a ? !0 : a.allowTextEdit ? !0 : !1
};
S.prototype.canGroup = function () {
if (!this.groupable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowGroup) return !1;
a = a.diagram;
return null === a ? !0 : a.allowGroup ? !0 : !1
};
S.prototype.canMove = function () {
if (!this.movable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowMove) return !1;
a = a.diagram;
return null === a ? !0 : a.allowMove ? !0 : !1
};
S.prototype.canReshape = function () {
if (!this.reshapable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowReshape) return !1;
a = a.diagram;
return null === a ? !0 : a.allowReshape ? !0 : !1
};
S.prototype.canResize = function () {
if (!this.resizable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowResize) return !1;
a = a.diagram;
return null === a ? !0 : a.allowResize ? !0 : !1
};
S.prototype.canRotate = function () {
if (!this.rotatable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowRotate) return !1;
a = a.diagram;
return null === a ? !0 : a.allowRotate ? !0 : !1
};
S.prototype.canSelect = function () {
if (!this.selectable) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowSelect) return !1;
a = a.diagram;
return null === a ? !0 : a.allowSelect ? !0 : !1
};
function Qh(a, b) {
a.D = b ? a.D | 16384 : a.D & -16385
}
function bj(a) {
return 0 !== (a.D & 32768)
}
function co(a, b) {
a.D = b ? a.D | 32768 : a.D & -32769
}
function Sk(a, b) {
a.D = b ? a.D | 65536 : a.D & -65537
}
function Kf(a) {
return 0 !== (a.D & 131072)
}
t = S.prototype;
t.hd = function (a) {
this.D = a ? this.D | 131072 : this.D & -131073
};
function lo(a, b) {
a.D = b ? a.D | 1048576 : a.D & -1048577
}
t.Ah = function () {
var a = this.containingGroup;
null !== a && (a.s(), null !== a.placeholder && a.placeholder.s(), a.ed())
};
t.R = function () {
var a = this.diagram;
null !== a && !aj(this) && !bj(this) && this.isVisible() && this.vb.o() && a.R(kj(this, this.vb))
};
t.s = function () {
X.prototype.s.call(this);
var a = this.diagram;
null !== a && (a.Dd.add(this), this instanceof V && null !== this.labeledLink && gl(this.labeledLink), a.cc(!0))
};
t.bq = function (a) {
a || (a = this.Th, null !== a && mo(a, this))
};
t.cq = function (a) {
a || (a = this.Th, null !== a && no(a, this))
};
t.$j = function () {
var a = this.data;
if (null !== a) {
var b = this.diagram;
null !== b && (b = b.model, null !== b && b.pm(a))
}
};
t.Py = function () {
return oo(this, this)
};
function oo(a, b) {
var c = b.containingGroup;
return null !== c ? 1 + oo(a, c) : b instanceof V && (b = b.labeledLink, null !== b) ? oo(a, b) : 0
}
t.Sy = function () {
return po(this, this)
};
function po(a, b) {
var c = b.containingGroup;
return null !== c || b instanceof V && (c = b.labeledLink, null !== c) ? po(a, c) : b
}
t.Vd = function (a) {
return a instanceof U ? qo(this, this, a) : !1
};
function qo(a, b, c) {
if (b === c || null === c) return !1;
var d = b.containingGroup;
return null === d || d !== c && !qo(a, d, c) ? b instanceof V && (b = b.labeledLink, null !== b) ? qo(a, b, c) : !1 : !0
}
t.ex = function (a) {
if (null === a) return null;
if (this === a) return this.containingGroup;
for (var b = this; null !== b;) {
b instanceof U && lo(b, !0);
if (b instanceof V) {
var c = b.labeledLink;
null !== c && (b = c)
}
b = b.containingGroup
}
c = null;
for (b = a; null !== b;) {
if (0 !== (b.D & 1048576)) {
c = b;
break
}
b instanceof V && (a = b.labeledLink, null !== a && (b = a));
b = b.containingGroup
}
for (b = this; null !== b;) b instanceof U && lo(b, !1), b instanceof V && (a = b.labeledLink, null !== a && (b = a)), b = b.containingGroup;
return c
};
S.prototype.canLayout = function () {
if (!this.isLayoutPositioned || !this.isVisible()) return !1;
var a = this.layer;
return null !== a && a.isTemporary || this instanceof V && this.isLinkLabel ? !1 : !0
};
S.prototype.B = function (a) {
void 0 === a && (a = 16777215);
if (this.isLayoutPositioned && 0 !== (a & this.layoutConditions)) {
var b = this.layer;
null !== b && b.isTemporary || this instanceof V && this.isLinkLabel ? b = !1 : (b = this.diagram, b = null !== b && b.undoManager.isUndoingRedoing ? !1 : !0)
} else b = !1;
if (b) if (b = this.Th, null !== b) {
var c = b.layout;
null !== c ? c.B() : b.B(a)
} else a = this.diagram, null !== a && (a = a.layout, null !== a && a.B())
};
function qj(a) {
if (!a.isVisible()) return !1;
a = a.layer;
return null !== a && a.isTemporary ? !1 : !0
}
function wk(a, b, c, d, e, f) {
void 0 === f && (f = null);
if (!(a.contains(b) || null !== f && !f(b) || b instanceof Je)) if (a.add(b), b instanceof V) {
if (c && b instanceof U) for (var g = b.memberParts; g.next();) wk(a, g.value, c, d, e, f);
if (!1 !== e) for (g = b.linksConnected; g.next();) {
var h = g.value;
if (!a.contains(h)) {
var k = h.fromNode, l = h.toNode;
k = null === k || a.contains(k);
l = null === l || a.contains(l);
(e ? k && l : k || l) && wk(a, h, c, d, e, f)
}
}
if (1 < d) for (b = b.bv(); b.next();) wk(a, b.value, c, d - 1, e, f)
} else if (b instanceof R) for (b = b.labelNodes; b.next();) wk(a,
b.value, c, d, e, f)
}
ma.Object.defineProperties(S.prototype, {
key: {
get: function () {
var a = this.diagram;
if (null !== a) return a.model.pa(this.data)
}
}, adornments: {
get: function () {
return null === this.yf ? gb : this.yf.iteratorValues
}
}, layer: {
get: function () {
return this.hi
}
}, diagram: {
get: function () {
var a = this.hi;
return null !== a ? a.diagram : null
}
}, layerName: {
get: function () {
return this.Ug
}, set: function (a) {
var b =
this.Ug;
if (b !== a) {
var c = this.diagram;
if (null === c || null !== c.$l(a) && !c.partManager.addsToTemporaryLayer) if (this.Ug = a, null !== c && c.Xa(), this.g("layerName", b, a), b = this.layer, null !== b && b.name !== a && (c = b.diagram, null !== c && (a = c.$l(a), null !== a && a !== b))) {
var d = b.xc(-1, this, !0);
0 <= d && c.ab(ue, "parts", b, this, null, d, !0);
d = a.Qi(99999999, this, !0);
b.visible !== a.visible && this.Lb(a.visible);
0 <= d && c.ab(te, "parts", a, null, this, !0, d);
d = this.layerChanged;
if (null !== d) {
var e = c.ea;
c.ea = !0;
d(this, b, a);
c.ea = e
}
}
}
}
}, layerChanged: {
get: function () {
return this.ao
}, set: function (a) {
var b = this.ao;
b !== a && (this.ao = a, this.g("layerChanged", b, a))
}
}, zOrder: {
get: function () {
return this.Lp
}, set: function (a) {
var b = this.Lp;
if (b !== a) {
this.Lp = a;
var c = this.layer;
null !== c && Th(c, -1, this);
this.g("zOrder", b, a);
a = this.diagram;
null !== a && a.R()
}
}
}, locationObject: {
get: function () {
if (null === this.Xe) {
var a = this.locationObjectName;
"" !== a ? (a = this.$a(a), null !== a ? this.Xe = a : this.Xe = this) :
this instanceof Je ? this.type !== X.Link && null !== this.placeholder ? this.Xe = this.placeholder : this.Xe = this : this.Xe = this
}
return this.Xe.visible ? this.Xe : this
}
}, minLocation: {
get: function () {
return this.ro
}, set: function (a) {
var b = this.ro;
b.A(a) || (this.ro = a = a.I(), this.g("minLocation", b, a))
}
}, maxLocation: {
get: function () {
return this.ko
}, set: function (a) {
var b = this.ko;
b.A(a) || (this.ko = a = a.I(), this.g("maxLocation", b, a))
}
}, locationObjectName: {
get: function () {
return this.io
}, set: function (a) {
var b = this.io;
b !== a && (this.io = a, this.Xe = null, this.s(), this.g("locationObjectName", b, a))
}
}, locationSpot: {
get: function () {
return this.jo
}, set: function (a) {
var b = this.jo;
b.A(a) || (this.jo = a = a.I(), this.s(), this.g("locationSpot", b, a))
}
}, location: {
get: function () {
return this.me
}, set: function (a) {
var b = a.x, c = a.y, d = this.me, e = d.x, f = d.y;
(e === b || isNaN(e) && isNaN(b)) && (f === c || isNaN(f) && isNaN(c)) ||
(a = a.I(), b = a, this.Bh() ? b = !1 : (this.me = b, this.D |= 2097152, !1 === aj(this) && (bo(this), c = this.sa, c.o() && (e = c.copy(), c.h(c.x + (b.x - d.x), c.y + (b.y - d.y)), go(this, this.diagram, c, e), this.g("position", e, c))), b = !0), b && this.g("location", d, a))
}
}, category: {
get: function () {
return this.Bf
}, set: function (a) {
var b = this.Bf;
if (b !== a) {
var c = this.diagram, d = this.data, e = null;
if (null !== c && null !== d && !(this instanceof Je)) {
var f = c.model.undoManager;
f.isEnabled && !f.isUndoingRedoing && (e = this.clone(), e.Y.addAll(this.Y))
}
this.Bf =
a;
this.g("category", b, a);
null === c || null === d || this instanceof Je ? this instanceof Je && (e = this.adornedPart, null !== e && (a = e.yf, null !== a && a.remove(b), e.rh(this.category, this))) : (f = c.model, f.undoManager.isUndoingRedoing || (this.Bh() ? (c.partManager.setLinkCategoryForData(d, a), c = c.partManager.findLinkTemplateForCategory(a), null !== c && (Ag(c), c = c.copy(), null !== c && jo(this, c, b, a))) : (null !== f && f.tq(d, a), c = ro(c.partManager, d, a), null !== c && (Ag(c), c = c.copy(), null === c || c instanceof R || (d = this.location.copy(), jo(this,
c, b, a), this.location.o() || (this.location = d)))), null !== e && (b = this.clone(), b.Y.addAll(this.Y), this.g("self", e, b))))
}
}
}, self: {
get: function () {
return this
}, set: function (a) {
jo(this, a, this.category, a.category)
}
}, copyable: {
get: function () {
return 0 !== (this.D & 1)
}, set: function (a) {
var b = 0 !== (this.D & 1);
b !== a && (this.D ^= 1, this.g("copyable", b, a))
}
}, deletable: {
get: function () {
return 0 !== (this.D & 2)
}, set: function (a) {
var b = 0 !== (this.D &
2);
b !== a && (this.D ^= 2, this.g("deletable", b, a))
}
}, textEditable: {
get: function () {
return 0 !== (this.D & 4)
}, set: function (a) {
var b = 0 !== (this.D & 4);
b !== a && (this.D ^= 4, this.g("textEditable", b, a), this.Jb())
}
}, groupable: {
get: function () {
return 0 !== (this.D & 8)
}, set: function (a) {
var b = 0 !== (this.D & 8);
b !== a && (this.D ^= 8, this.g("groupable", b, a))
}
}, movable: {
get: function () {
return 0 !== (this.D & 16)
}, set: function (a) {
var b = 0 !== (this.D & 16);
b !== a && (this.D ^= 16, this.g("movable", b, a))
}
}, selectionAdorned: {
get: function () {
return 0 !== (this.D & 32)
}, set: function (a) {
var b = 0 !== (this.D & 32);
b !== a && (this.D ^= 32, this.g("selectionAdorned", b, a), this.Jb())
}
}, isInDocumentBounds: {
get: function () {
return 0 !== (this.D & 64)
}, set: function (a) {
var b = 0 !== (this.D & 64);
if (b !== a) {
this.D ^= 64;
var c = this.diagram;
null !== c && c.Xa();
this.g("isInDocumentBounds", b, a)
}
}
}, isLayoutPositioned: {
get: function () {
return 0 !== (this.D & 128)
}, set: function (a) {
var b = 0 !== (this.D & 128);
b !== a && (this.D ^= 128, this.g("isLayoutPositioned", b, a), this.B(a ? 4 : 8))
}
}, selectable: {
get: function () {
return 0 !== (this.D & 256)
}, set: function (a) {
var b = 0 !== (this.D & 256);
b !== a && (this.D ^= 256, this.g("selectable", b, a), this.Jb())
}
}, reshapable: {
get: function () {
return 0 !== (this.D & 512)
}, set: function (a) {
var b = 0 !== (this.D & 512);
b !== a && (this.D ^= 512, this.g("reshapable", b, a), this.Jb())
}
},
resizable: {
get: function () {
return 0 !== (this.D & 1024)
}, set: function (a) {
var b = 0 !== (this.D & 1024);
b !== a && (this.D ^= 1024, this.g("resizable", b, a), this.Jb())
}
}, rotatable: {
get: function () {
return 0 !== (this.D & 2048)
}, set: function (a) {
var b = 0 !== (this.D & 2048);
b !== a && (this.D ^= 2048, this.g("rotatable", b, a), this.Jb())
}
}, isSelected: {
get: function () {
return 0 !== (this.D & 4096)
}, set: function (a) {
var b = 0 !== (this.D & 4096);
if (b !== a) {
var c = this.diagram;
if (!a || this.canSelect() && !(null !== c && c.selection.count >= c.maxSelectionCount)) {
this.D ^= 4096;
var d = !1;
if (null !== c) {
d = c.skipsUndoManager;
c.skipsUndoManager = !0;
var e = c.selection;
e.ha();
a ? e.add(this) : e.remove(this);
e.freeze()
}
this.g("isSelected", b, a);
this.Jb();
a = this.selectionChanged;
null !== a && a(this);
null !== c && (c.cc(), c.skipsUndoManager = d)
}
}
}
}, isHighlighted: {
get: function () {
return 0 !== (this.D & 524288)
}, set: function (a) {
var b = 0 !== (this.D & 524288);
if (b !== a) {
this.D ^= 524288;
var c =
this.diagram;
null !== c && (c = c.highlighteds, c.ha(), a ? c.add(this) : c.remove(this), c.freeze());
this.g("isHighlighted", b, a);
this.R();
a = this.highlightedChanged;
null !== a && a(this)
}
}
}, isShadowed: {
get: function () {
return 0 !== (this.D & 8192)
}, set: function (a) {
var b = 0 !== (this.D & 8192);
b !== a && (this.D ^= 8192, this.g("isShadowed", b, a), this.R())
}
}, isAnimated: {
get: function () {
return 0 !== (this.D & 262144)
}, set: function (a) {
var b = 0 !== (this.D & 262144);
b !== a && (this.D ^= 262144,
this.g("isAnimated", b, a))
}
}, highlightedChanged: {
get: function () {
return this.Nn
}, set: function (a) {
var b = this.Nn;
b !== a && (this.Nn = a, this.g("highlightedChanged", b, a))
}
}, selectionObjectName: {
get: function () {
return this.mp
}, set: function (a) {
var b = this.mp;
b !== a && (this.mp = a, this.eh = null, this.g("selectionObjectName", b, a))
}
}, selectionAdornmentTemplate: {
get: function () {
return this.kp
}, set: function (a) {
var b = this.kp;
b !== a && (this.kp =
a, this.g("selectionAdornmentTemplate", b, a))
}
}, selectionObject: {
get: function () {
if (null === this.eh) {
var a = this.selectionObjectName;
null !== a && "" !== a ? (a = this.$a(a), null !== a ? this.eh = a : this.eh = this) : this instanceof R ? (a = this.path, null !== a ? this.eh = a : this.eh = this) : this.eh = this
}
return this.eh
}
}, selectionChanged: {
get: function () {
return this.lp
}, set: function (a) {
var b = this.lp;
b !== a && (this.lp = a, this.g("selectionChanged", b, a))
}
}, resizeAdornmentTemplate: {
get: function () {
return this.Wo
}, set: function (a) {
var b = this.Wo;
b !== a && (this.Wo = a, this.g("resizeAdornmentTemplate", b, a))
}
}, resizeObjectName: {
get: function () {
return this.Yo
}, set: function (a) {
var b = this.Yo;
b !== a && (this.Yo = a, this.g("resizeObjectName", b, a))
}
}, resizeObject: {
get: function () {
var a = this.resizeObjectName;
return "" !== a && (a = this.$a(a), null !== a) ? a : this
}
}, resizeCellSize: {
get: function () {
return this.Xo
},
set: function (a) {
var b = this.Xo;
b.A(a) || (this.Xo = a = a.I(), this.g("resizeCellSize", b, a))
}
}, rotateAdornmentTemplate: {
get: function () {
return this.Zo
}, set: function (a) {
var b = this.Zo;
b !== a && (this.Zo = a, this.g("rotateAdornmentTemplate", b, a))
}
}, rotateObjectName: {
get: function () {
return this.$o
}, set: function (a) {
var b = this.$o;
b !== a && (this.$o = a, this.g("rotateObjectName", b, a))
}
}, rotateObject: {
get: function () {
var a = this.rotateObjectName;
return "" !== a && (a = this.$a(a), null !== a) ? a : this
}
}, rotationSpot: {
get: function () {
return this.ap
}, set: function (a) {
var b = this.ap;
b.A(a) || (this.ap = a = a.I(), this.g("rotationSpot", b, a))
}
}, text: {
get: function () {
return this.Ob
}, set: function (a) {
var b = this.Ob;
b !== a && (this.Ob = a, this.g("text", b, a))
}
}, containingGroup: {
get: function () {
return this.Th
}, set: function (a) {
if (this.bc()) {
var b = this.Th;
if (b !== a) {
null === a || this !== a && !a.Vd(this) ||
(this === a && B("Cannot make a Group a member of itself: " + this.toString()), B("Cannot make a Group indirectly contain itself: " + this.toString() + " already contains " + a.toString()));
this.B(2);
var c = this.diagram;
null !== b ? no(b, this) : this instanceof U && null !== c && c.Ai.remove(this);
this.Th = a;
null !== a ? mo(a, this) : this instanceof U && null !== c && c.Ai.add(this);
this.B(1);
if (null !== c) {
var d = this.data, e = c.model;
if (null !== d && e.fk()) {
var f = e.pa(null !== a ? a.data : null);
e.ut(d, f)
}
}
d = this.containingGroupChanged;
null !== d &&
(e = !0, null !== c && (e = c.ea, c.ea = !0), d(this, b, a), null !== c && (c.ea = e));
if (this instanceof U) for (c = new F, wk(c, this, !0, 0, !0), c = c.iterator; c.next();) if (d = c.value, d instanceof V) for (d = d.linksConnected; d.next();) so(d.value);
if (this instanceof V) {
for (c = this.linksConnected; c.next();) so(c.value);
c = this.labeledLink;
null !== c && so(c)
}
this.g("containingGroup", b, a);
null !== a && (b = a.layer, null !== b && Th(b, -1, a))
}
} else B("cannot set the Part.containingGroup of a Link or Adornment")
}
}, containingGroupChanged: {
get: function () {
return this.$m
}, set: function (a) {
var b = this.$m;
b !== a && (this.$m = a, this.g("containingGroupChanged", b, a))
}
}, isTopLevel: {
get: function () {
return null !== this.containingGroup || this instanceof V && null !== this.labeledLink ? !1 : !0
}
}, layoutConditions: {
get: function () {
return this.bo
}, set: function (a) {
var b = this.bo;
b !== a && (this.bo = a, this.g("layoutConditions", b, a))
}
}, dragComputation: {
get: function () {
return this.wn
},
set: function (a) {
var b = this.wn;
b !== a && (this.wn = a, this.g("dragComputation", b, a))
}
}, shadowOffset: {
get: function () {
return this.vi
}, set: function (a) {
var b = this.vi;
b.A(a) || (this.vi = a = a.I(), this.R(), this.g("shadowOffset", b, a))
}
}, shadowColor: {
get: function () {
return this.Kj
}, set: function (a) {
var b = this.Kj;
b !== a && (this.Kj = a, this.R(), this.g("shadowColor", b, a))
}
}, shadowBlur: {
get: function () {
return this.Od
}, set: function (a) {
var b =
this.Od;
b !== a && (this.Od = a, this.R(), this.g("shadowBlur", b, a))
}
}
});
S.prototype.invalidateLayout = S.prototype.B;
S.prototype.findCommonContainingGroup = S.prototype.ex;
S.prototype.isMemberOf = S.prototype.Vd;
S.prototype.findTopLevelPart = S.prototype.Sy;
S.prototype.findSubGraphLevel = S.prototype.Py;
S.prototype.ensureBounds = S.prototype.$b;
S.prototype.getDocumentBounds = S.prototype.Zp;
S.prototype.getRelativePoint = S.prototype.qf;
S.prototype.findObject = S.prototype.$a;
S.prototype.moveTo = S.prototype.moveTo;
S.prototype.invalidateAdornments = S.prototype.Jb;
S.prototype.clearAdornments = S.prototype.Uj;
S.prototype.removeAdornment = S.prototype.vf;
S.prototype.addAdornment = S.prototype.rh;
S.prototype.findAdornment = S.prototype.bk;
S.prototype.updateTargetBindings = S.prototype.Ea;
var ko = !1;
S.className = "Part";
S.LayoutNone = 0;
S.LayoutAdded = 1;
S.LayoutRemoved = 2;
S.LayoutShown = 4;
S.LayoutHidden = 8;
S.LayoutNodeSized = 16;
S.LayoutGroupLayout = 32;
S.LayoutNodeReplaced = 64;
S.LayoutStandard = 127;
S.LayoutAll = 16777215;
function Je(a) {
S.call(this, a);
this.D &= -257;
this.Ug = "Adornment";
this.$d = null;
this.Dw = 0;
this.Ow = !1;
this.l = [];
this.Va = null
}
la(Je, S);
Je.prototype.toString = function () {
var a = this.adornedPart;
return "Adornment(" + this.category + ")" + (null !== a ? a.toString() : "")
};
Je.prototype.updateRelationshipsFromData = function () {
};
Je.prototype.ik = function (a) {
var b = this.adornedObject.part;
if (b instanceof R && this.adornedObject instanceof W) {
var c = b.path;
b.ik(a);
a = c.geometry;
b = this.Y.j;
c = b.length;
for (var d = 0; d < c; d++) {
var e = b[d];
e.isPanelMain && e instanceof W && (e.qa = a)
}
}
};
Je.prototype.Si = function () {
var a = this.$d;
if (null === a) return !0;
a = a.part;
return null === a || !aj(a)
};
Je.prototype.bc = function () {
return !1
};
Je.prototype.qk = function (a, b, c, d, e, f, g) {
if (a === te && "elements" === b) if (e instanceof zg) null === this.Va && (this.Va = e); else {
if (e instanceof X) {
var h = e.Zl(function (a) {
return a instanceof zg
});
h instanceof zg && null === this.Va && (this.Va = h)
}
} else a === ue && "elements" === b && null !== this.Va && (d === this.Va ? this.Va = null : d instanceof X && this.Va.ug(d) && (this.Va = null));
S.prototype.qk.call(this, a, b, c, d, e, f, g)
};
Je.prototype.updateAdornments = function () {
};
Je.prototype.$j = function () {
};
ma.Object.defineProperties(Je.prototype, {
placeholder: {
get: function () {
return this.Va
}
}, adornedObject: {
get: function () {
return this.$d
}, set: function (a) {
var b = this.adornedPart, c = null;
null !== a && (c = a.part);
null === b || null !== a && b === c || b.vf(this.category);
this.$d = a;
null !== c && c.rh(this.category, this)
}
}, adornedPart: {
get: function () {
var a = this.$d;
return null !== a ? a.part : null
}
}, containingGroup: {
get: function () {
return null
}
}
});
Je.className = "Adornment";
function V(a) {
S.call(this, a);
this.S = 13;
this.Ya = new E;
this.Fp = this.il = this.ki = this.eo = this.co = null;
this.Ek = vc;
this.rc = this.Me = null;
this.To = to;
this.ph = !1
}
la(V, S);
V.prototype.cloneProtected = function (a) {
S.prototype.cloneProtected.call(this, a);
a.S = this.S;
a.S = this.S & -17;
a.co = this.co;
a.eo = this.eo;
a.ki = this.ki;
a.Fp = this.Fp;
a.Ek = this.Ek.I();
a.To = this.To
};
t = V.prototype;
t.pf = function (a) {
S.prototype.pf.call(this, a);
a.ed();
a.Me = this.Me;
a.rc = null
};
function uo(a, b) {
null !== b && (null === a.Me && (a.Me = new F), a.Me.add(b))
}
function vo(a, b, c, d) {
if (null === b || null === a.Me) return null;
for (var e = a.Me.iterator; e.next();) {
var f = e.value;
if (f.jt === a && f.qv === b && f.vx === c && f.wx === d || f.jt === b && f.qv === a && f.vx === d && f.wx === c) return f
}
return null
}
t.oz = function (a, b, c) {
if (void 0 === b || null === b) b = "";
if (void 0 === c || null === c) c = "";
a = vo(this, a, b, c);
null !== a && a.dm()
};
t.qk = function (a, b, c, d, e, f, g) {
a === te && "elements" === b ? this.rc = null : a === ue && "elements" === b && (this.rc = null);
S.prototype.qk.call(this, a, b, c, d, e, f, g)
};
t.ed = function (a) {
void 0 === a && (a = null);
for (var b = this.linksConnected; b.next();) {
var c = b.value;
null !== a && a.contains(c) || (wo(this, c.fromPort), wo(this, c.toPort), c.Ra())
}
};
function Tk(a, b) {
for (var c = a.linksConnected; c.next();) {
var d = c.value;
if (d.fromPort === b || d.toPort === b) wo(a, d.fromPort), wo(a, d.toPort), d.Ra()
}
}
function wo(a, b) {
null !== b && (b = b.So, null !== b && b.dm(), a = a.containingGroup, null === a || a.isSubGraphExpanded || wo(a, a.port))
}
t.Si = function () {
return !0
};
V.prototype.getAvoidableRect = function (a) {
a.set(this.actualBounds);
a.Op(this.Ek);
return a
};
V.prototype.findVisibleNode = function () {
for (var a = this; null !== a && !a.isVisible();) a = a.containingGroup;
return a
};
V.prototype.isVisible = function () {
if (!S.prototype.isVisible.call(this)) return !1;
var a = !0, b = $h, c = this.diagram;
if (null !== c) {
if (Fh(c.animationManager, this)) return !0;
a = c.isTreePathToChildren;
b = c.treeCollapsePolicy
}
if (b === $h) {
if (a = this.sg(), null !== a && !a.isTreeExpanded) return !1
} else if (b === kk) {
if (a = a ? this.$u() : this.av(), 0 < a.count && a.all(function (a) {
return !a.isTreeExpanded
})) return !1
} else if (b === lk && (a = a ? this.$u() : this.av(), 0 < a.count && a.any(function (a) {
return !a.isTreeExpanded
}))) return !1;
a = this.labeledLink;
return null !== a ? a.isVisible() : !0
};
t = V.prototype;
t.Lb = function (a) {
S.prototype.Lb.call(this, a);
for (var b = this.linksConnected; b.next();) b.value.Lb(a)
};
t.Yu = function (a) {
void 0 === a && (a = null);
if (null === a) return this.Ya.iterator;
var b = new ib(this.Ya), c = this;
b.predicate = function (b) {
return b.fromNode === c && b.fromPortId === a || b.toNode === c && b.toPortId === a
};
return b
};
t.Wp = function (a) {
void 0 === a && (a = null);
var b = new ib(this.Ya), c = this;
b.predicate = function (b) {
return b.fromNode !== c ? !1 : null === a ? !0 : b.fromPortId === a
};
return b
};
t.sd = function (a) {
void 0 === a && (a = null);
var b = new ib(this.Ya), c = this;
b.predicate = function (b) {
return b.toNode !== c ? !1 : null === a ? !0 : b.toPortId === a
};
return b
};
t.Zu = function (a) {
void 0 === a && (a = null);
for (var b = null, c = null, d = this.Ya.iterator; d.next();) {
var e = d.value;
if (e.fromNode === this) {
if (null === a || e.fromPortId === a) e = e.toNode, null !== b ? b.add(e) : null !== c && c !== e ? (b = new F, b.add(c), b.add(e)) : c = e
} else e.toNode !== this || null !== a && e.toPortId !== a || (e = e.fromNode, null !== b ? b.add(e) : null !== c && c !== e ? (b = new F, b.add(c), b.add(e)) : c = e)
}
return null !== b ? b.iterator : null !== c ? new hb(c) : gb
};
t.av = function (a) {
void 0 === a && (a = null);
for (var b = null, c = null, d = this.Ya.iterator; d.next();) {
var e = d.value;
e.fromNode !== this || null !== a && e.fromPortId !== a || (e = e.toNode, null !== b ? b.add(e) : null !== c && c !== e ? (b = new F, b.add(c), b.add(e)) : c = e)
}
return null !== b ? b.iterator : null !== c ? new hb(c) : gb
};
t.$u = function (a) {
void 0 === a && (a = null);
for (var b = null, c = null, d = this.Ya.iterator; d.next();) {
var e = d.value;
e.toNode !== this || null !== a && e.toPortId !== a || (e = e.fromNode, null !== b ? b.add(e) : null !== c && c !== e ? (b = new F, b.add(c), b.add(e)) : c = e)
}
return null !== b ? b.iterator : null !== c ? new hb(c) : gb
};
t.Ky = function (a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
var d = new ib(this.Ya), e = this;
d.predicate = function (d) {
return (d.fromNode !== e || d.toNode !== a || null !== b && d.fromPortId !== b || null !== c && d.toPortId !== c) && (d.fromNode !== a || d.toNode !== e || null !== c && d.fromPortId !== c || null !== b && d.toPortId !== b) ? !1 : !0
};
return d
};
t.Ly = function (a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
var d = new ib(this.Ya), e = this;
d.predicate = function (d) {
return d.fromNode !== e || d.toNode !== a || null !== b && d.fromPortId !== b || null !== c && d.toPortId !== c ? !1 : !0
};
return d
};
function xo(a, b, c) {
wo(a, c);
var d = a.Ya.contains(b);
d || a.Ya.add(b);
if (!d || b.fromNode === b.toNode) {
var e = a.linkConnected;
if (null !== e) {
var f = !0, g = a.diagram;
null !== g && (f = g.ea, g.ea = !0);
e(a, b, c);
null !== g && (g.ea = f)
}
}
!d && b.isTreeLink && (c = b.fromNode, b = b.toNode, null !== c && null !== b && c !== b && (d = !0, a = a.diagram, null !== a && (d = a.isTreePathToChildren), e = d ? b : c, f = d ? c : b, e.ph || (e.ph = f), !f.isTreeLeaf || null !== a && a.undoManager.isUndoingRedoing || (d ? c === f && (f.isTreeLeaf = !1) : b === f && (f.isTreeLeaf = !1))))
}
function yo(a, b, c) {
wo(a, c);
var d = a.Ya.remove(b), e = null;
if (d || b.toNode === b.fromNode) {
var f = a.linkDisconnected;
e = a.diagram;
if (null !== f) {
var g = !0;
null !== e && (g = e.ea, e.ea = !0);
f(a, b, c);
null !== e && (e.ea = g)
}
}
d && b.isTreeLink && (c = !0, null !== e && (c = e.isTreePathToChildren), a = c ? b.toNode : b.fromNode, b = c ? b.fromNode : b.toNode, null !== a && (a.ph = !1), null === b || b.isTreeLeaf || (0 === b.Ya.count ? (b.ph = null, null !== e && e.undoManager.isUndoingRedoing || (b.isTreeLeaf = !0)) : jk(b)))
}
function jk(a) {
a.ph = !1;
if (0 !== a.Ya.count) {
var b = !0, c = a.diagram;
if (null === c || !c.undoManager.isUndoingRedoing) {
null !== c && (b = c.isTreePathToChildren);
for (c = a.Ya.iterator; c.next();) {
var d = c.value;
if (d.isTreeLink) if (b) {
if (d.fromNode === a) {
a.isTreeLeaf = !1;
return
}
} else if (d.toNode === a) {
a.isTreeLeaf = !1;
return
}
}
a.isTreeLeaf = !0
}
}
}
V.prototype.updateRelationshipsFromData = function () {
var a = this.diagram;
null !== a && a.partManager.updateRelationshipsFromData(this)
};
t = V.prototype;
t.bq = function (a) {
S.prototype.bq.call(this, a);
a || (jk(this), a = this.il, null !== a && zo(a, this))
};
t.cq = function (a) {
S.prototype.cq.call(this, a);
a || (a = this.il, null !== a && null !== a.$c && (a.$c.remove(this), a.s()))
};
t.$j = function () {
if (0 < this.Ya.count) {
var a = this.diagram;
if (null !== a) for (var b = null !== a.commandHandler ? a.commandHandler.deletesConnectedLinks : !0, c = this.Ya.copy().iterator; c.next();) {
var d = c.value;
b ? a.remove(d) : (d.fromNode === this && (d.fromNode = null), d.toNode === this && (d.toNode = null))
}
}
this.labeledLink = null;
S.prototype.$j.call(this)
};
t.Ts = function (a) {
if (null === this.rc) {
if ("" === a && !1 === this.zh) return this;
Ao(this)
}
var b = this.rc.J(a);
return null !== b || "" !== a && (b = this.rc.J(""), null !== b) ? b : this
};
function Ao(a) {
null === a.rc ? a.rc = new vb : a.rc.clear();
a.zm(a, function (a, c) {
wl(a, c)
});
0 === a.rc.count && a.rc.add("", a)
}
function wl(a, b) {
var c = b.portId;
null !== c && null !== a.rc && a.rc.add(c, b)
}
function vl(a, b, c) {
var d = b.portId;
if (null !== d && (null !== a.rc && a.rc.remove(d), b = a.diagram, null !== b && c)) {
c = null;
for (a = a.Yu(d); a.next();) d = a.value, null === c && (c = Da()), c.push(d);
if (null !== c) {
for (a = 0; a < c.length; a++) b.remove(c[a]);
Ga(c)
}
}
}
t.qz = function (a) {
if (null === a || a === this) return !1;
var b = !0, c = this.diagram;
null !== c && (b = c.isTreePathToChildren);
c = this;
if (b) for (; c !== a;) {
b = null;
for (var d = c.Ya.iterator; d.next();) {
var e = d.value;
if (e.isTreeLink && (b = e.fromNode, b !== c && b !== this)) break
}
if (b === this || null === b || b === c) return !1;
c = b
} else for (; c !== a;) {
b = null;
for (d = c.Ya.iterator; d.next() && (e = d.value, !e.isTreeLink || (b = e.toNode, b === c || b === this));) ;
if (b === this || null === b || b === c) return !1;
c = b
}
return !0
};
t.Wy = function () {
var a = !0, b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
b = this;
if (a) for (; ;) {
a = null;
for (var c = b.Ya.iterator; c.next();) {
var d = c.value;
if (d.isTreeLink && (a = d.fromNode, a !== b && a !== this)) break
}
if (a === this) return this;
if (null === a || a === b) return b;
b = a
} else for (; ;) {
a = null;
for (c = b.Ya.iterator; c.next() && (d = c.value, !d.isTreeLink || (a = d.toNode, a === b || a === this));) ;
if (a === this) return this;
if (null === a || a === b) return b;
b = a
}
};
t.Hy = function (a) {
if (null === a) return null;
if (this === a) return this;
for (var b = this; null !== b;) lo(b, !0), b = b.sg();
var c = null;
for (b = a; null !== b;) {
if (0 !== (b.D & 1048576)) {
c = b;
break
}
b = b.sg()
}
for (b = this; null !== b;) lo(b, !1), b = b.sg();
return c
};
t.Ki = function () {
var a = !0, b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
b = this.Ya.iterator;
if (a) for (; b.next();) {
if (a = b.value, a.isTreeLink && a.fromNode !== this) return a
} else for (; b.next();) if (a = b.value, a.isTreeLink && a.toNode !== this) return a;
return null
};
t.sg = function () {
var a = this.ph;
if (null === a) return null;
if (a instanceof V) return a;
var b = !0;
a = this.diagram;
null !== a && (b = a.isTreePathToChildren);
a = this.Ya.iterator;
if (b) for (; a.next();) {
if (b = a.value, b.isTreeLink && (b = b.fromNode, b !== this)) return this.ph = b
} else for (; a.next();) if (b = a.value, b.isTreeLink && (b = b.toNode, b !== this)) return this.ph = b;
return this.ph = null
};
t.Uy = function () {
function a(b, d) {
if (null !== b) {
d.add(b);
var c = b.Ki();
null !== c && (d.add(c), a(b.sg(), d))
}
}
var b = new F;
a(this, b);
return b
};
t.Ty = function () {
return Bo(this, this)
};
function Bo(a, b) {
b = b.sg();
return null === b ? 0 : 1 + Bo(a, b)
}
t.Yp = function () {
var a = !0, b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
b = new ib(this.Ya);
var c = this;
b.predicate = a ? function (a) {
return a.isTreeLink && a.fromNode === c ? !0 : !1
} : function (a) {
return a.isTreeLink && a.toNode === c ? !0 : !1
};
return b
};
t.bv = function () {
var a = !0, b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
var c = b = null, d = this.Ya.iterator;
if (a) for (; d.next();) a = d.value, a.isTreeLink && a.fromNode === this && (a = a.toNode, null !== b ? b.add(a) : null !== c && c !== a ? (b = new E, b.add(c), b.add(a)) : c = a); else for (; d.next();) a = d.value, a.isTreeLink && a.toNode === this && (a = a.fromNode, null !== b ? b.add(a) : null !== c && c !== a ? (b = new E, b.add(c), b.add(a)) : c = a);
return null !== b ? b.iterator : null !== c ? new hb(c) : gb
};
t.Vy = function (a) {
void 0 === a && (a = Infinity);
var b = new F;
wk(b, this, !1, a, !0);
return b
};
V.prototype.collapseTree = function (a) {
void 0 === a && (a = 1);
1 > a && (a = 1);
var b = this.diagram;
if (null !== b && !b.Fe) {
b.Fe = !0;
var c = new F;
c.add(this);
Co(this, c, b.isTreePathToChildren, a, b, this, b.treeCollapsePolicy === $h);
b.Fe = !1
}
};
function Co(a, b, c, d, e, f, g) {
if (1 < d) for (var h = c ? a.Wp() : a.sd(); h.next();) {
var k = h.value;
k.isTreeLink && (k = k.Xs(a), null === k || k === a || b.contains(k) || (b.add(k), Co(k, b, c, d - 1, e, f, g)))
} else Do(a, b, c, e, f, g)
}
function Do(a, b, c, d, e, f) {
for (var g = e === a ? !0 : a.isTreeExpanded, h = c ? a.Wp() : a.sd(); h.next();) {
var k = h.value;
if (k.isTreeLink && (k = k.Xs(a), null !== k && k !== a)) {
var l = b.contains(k);
l || b.add(k);
g && (f && d.Mp(k, e), k.Ah(), k.Lb(!1));
k.isTreeExpanded && (k.wasTreeExpanded = k.isTreeExpanded, l || Do(k, b, c, d, e, f))
}
}
a.isTreeExpanded = !1
}
V.prototype.expandTree = function (a) {
void 0 === a && (a = 2);
2 > a && (a = 2);
var b = this.diagram;
if (null !== b && !b.Fe) {
b.Fe = !0;
var c = new F;
c.add(this);
Eo(this, c, b.isTreePathToChildren, a, b, this, b.treeCollapsePolicy === $h);
b.Fe = !1
}
};
function Eo(a, b, c, d, e, f, g) {
for (var h = f === a ? !1 : a.isTreeExpanded, k = c ? a.Wp() : a.sd(); k.next();) {
var l = k.value;
l.isTreeLink && (h || l.Lc || l.Ra(), l = l.Xs(a), null !== l && l !== a && !b.contains(l) && (b.add(l), h || (l.Lb(!0), l.Ah(), g && e.Np(l, f)), 2 < d || l.wasTreeExpanded)) && (l.wasTreeExpanded = !1, Eo(l, b, c, d - 1, e, f, g))
}
a.isTreeExpanded = !0
}
ma.Object.defineProperties(V.prototype, {
portSpreading: {
get: function () {
return this.To
}, set: function (a) {
var b = this.To;
b !== a && (this.To = a, this.g("portSpreading", b, a), a = this.diagram, null !== a && a.undoManager.isUndoingRedoing || this.ed())
}
}, avoidable: {
get: function () {
return 0 !== (this.S & 8)
}, set: function (a) {
var b = 0 !== (this.S & 8);
if (b !== a) {
this.S ^= 8;
var c = this.diagram;
null !== c && dk(c, this);
this.g("avoidable", b, a)
}
}
}, avoidableMargin: {
get: function () {
return this.Ek
}, set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.Ek;
if (!b.A(a)) {
this.Ek = a = a.I();
var c = this.diagram;
null !== c && dk(c, this);
this.g("avoidableMargin", b, a)
}
}
}, linksConnected: {
get: function () {
return this.Ya.iterator
}
}, linkConnected: {
get: function () {
return this.co
}, set: function (a) {
var b = this.co;
b !== a && (this.co = a, this.g("linkConnected", b, a))
}
}, linkDisconnected: {
get: function () {
return this.eo
},
set: function (a) {
var b = this.eo;
b !== a && (this.eo = a, this.g("linkDisconnected", b, a))
}
}, linkValidation: {
get: function () {
return this.ki
}, set: function (a) {
var b = this.ki;
b !== a && (this.ki = a, this.g("linkValidation", b, a))
}
}, isLinkLabel: {
get: function () {
return null !== this.il
}
}, labeledLink: {
get: function () {
return this.il
}, set: function (a) {
var b = this.il;
if (b !== a) {
var c = this.diagram, d = this.data;
if (null !== b) {
null !== b.$c && (b.$c.remove(this),
b.s());
if (null !== c && null !== d && !c.undoManager.isUndoingRedoing) {
var e = b.data, f = c.model;
if (null !== e && f.fm()) {
var g = f.pa(d);
void 0 !== g && f.xx(e, g)
}
}
this.containingGroup = null
}
this.il = a;
null !== a && (zo(a, this), null === c || null === d || c.undoManager.isUndoingRedoing || (e = a.data, c = c.model, null !== e && c.fm() && (d = c.pa(d), void 0 !== d && c.Hu(e, d))), this.containingGroup = a.containingGroup);
gl(this);
this.g("labeledLink", b, a)
}
}
}, port: {
get: function () {
return this.Ts("")
}
}, ports: {
get: function () {
null === this.rc && Ao(this);
return this.rc.iteratorValues
}
}, isTreeExpanded: {
get: function () {
return 0 !== (this.S & 1)
}, set: function (a) {
var b = 0 !== (this.S & 1);
if (b !== a) {
this.S ^= 1;
var c = this.diagram;
this.g("isTreeExpanded", b, a);
b = this.treeExpandedChanged;
if (null !== b) {
var d = !0;
null !== c && (d = c.ea, c.ea = !0);
b(this);
null !== c && (c.ea = d)
}
null !== c && c.undoManager.isUndoingRedoing ? this.Lb(a) : a ? this.expandTree() : this.collapseTree()
}
}
}, wasTreeExpanded: {
get: function () {
return 0 !== (this.S & 2)
}, set: function (a) {
var b = 0 !== (this.S & 2);
b !== a && (this.S ^= 2, this.g("wasTreeExpanded", b, a))
}
}, treeExpandedChanged: {
get: function () {
return this.Fp
}, set: function (a) {
var b = this.Fp;
b !== a && (this.Fp = a, this.g("treeExpandedChanged", b, a))
}
}, isTreeLeaf: {
get: function () {
return 0 !== (this.S & 4)
}, set: function (a) {
var b = 0 !== (this.S & 4);
b !== a && (this.S ^= 4, this.g("isTreeLeaf", b, a))
}
}
});
V.prototype.expandTree = V.prototype.expandTree;
V.prototype.collapseTree = V.prototype.collapseTree;
V.prototype.findTreeParts = V.prototype.Vy;
V.prototype.findTreeChildrenNodes = V.prototype.bv;
V.prototype.findTreeChildrenLinks = V.prototype.Yp;
V.prototype.findTreeLevel = V.prototype.Ty;
V.prototype.findTreeParentChain = V.prototype.Uy;
V.prototype.findTreeParentNode = V.prototype.sg;
V.prototype.findTreeParentLink = V.prototype.Ki;
V.prototype.findCommonTreeParent = V.prototype.Hy;
V.prototype.findTreeRoot = V.prototype.Wy;
V.prototype.isInTreeOf = V.prototype.qz;
V.prototype.findPort = V.prototype.Ts;
V.prototype.findLinksTo = V.prototype.Ly;
V.prototype.findLinksBetween = V.prototype.Ky;
V.prototype.findNodesInto = V.prototype.$u;
V.prototype.findNodesOutOf = V.prototype.av;
V.prototype.findNodesConnected = V.prototype.Zu;
V.prototype.findLinksInto = V.prototype.sd;
V.prototype.findLinksOutOf = V.prototype.Wp;
V.prototype.findLinksConnected = V.prototype.Yu;
V.prototype.invalidateConnectedLinks = V.prototype.ed;
V.prototype.invalidateLinkBundle = V.prototype.oz;
var Fo = new D(V, "SpreadingNone", 10), to = new D(V, "SpreadingEvenly", 11), Go = new D(V, "SpreadingPacked", 12);
V.className = "Node";
V.SpreadingNone = Fo;
V.SpreadingEvenly = to;
V.SpreadingPacked = Go;
function U(a) {
V.call(this, a);
this.S |= 4608;
this.oo = new F;
this.sl = new F;
this.Va = this.xp = this.li = this.po = this.no = null;
this.gc = new gi;
this.gc.group = this
}
la(U, V);
U.prototype.cloneProtected = function (a) {
V.prototype.cloneProtected.call(this, a);
this.S = this.S & -32769;
a.no = this.no;
a.po = this.po;
a.li = this.li;
a.xp = this.xp;
var b = a.Zl(function (a) {
return a instanceof zg
});
b instanceof zg ? a.Va = b : a.Va = null;
null !== this.gc ? (a.gc = this.gc.copy(), a.gc.group = a) : (null !== a.gc && (a.gc.group = null), a.gc = null)
};
t = U.prototype;
t.pf = function (a) {
V.prototype.pf.call(this, a);
var b = a.ck();
for (a = a.memberParts; a.next();) {
var c = a.value;
c.s();
c.B(8);
c.Uj();
if (c instanceof V) c.ed(b); else if (c instanceof R) for (c = c.labelNodes; c.next();) c.value.ed(b)
}
};
t.qk = function (a, b, c, d, e, f, g) {
if (a === te && "elements" === b) if (e instanceof zg) null === this.Va ? this.Va = e : this.Va !== e && B("Cannot insert a second Placeholder into the visual tree of a Group."); else {
if (e instanceof X) {
var h = e.Zl(function (a) {
return a instanceof zg
});
h instanceof zg && (null === this.Va ? this.Va = h : this.Va !== h && B("Cannot insert a second Placeholder into the visual tree of a Group."))
}
} else a === ue && "elements" === b && null !== this.Va && (d === this.Va ? this.Va = null : d instanceof X && this.Va.ug(d) && (this.Va = null));
V.prototype.qk.call(this, a, b, c, d, e, f, g)
};
t.vh = function (a, b, c, d) {
this.Xe = this.Va;
V.prototype.vh.call(this, a, b, c, d)
};
t.Si = function () {
if (!V.prototype.Si.call(this)) return !1;
for (var a = this.memberParts; a.next();) {
var b = a.value;
if (b instanceof V) {
if (b.isVisible() && aj(b)) return !1
} else if (b instanceof R && b.isVisible() && aj(b) && b.fromNode !== this && b.toNode !== this) return !1
}
return !0
};
function mo(a, b) {
if (a.oo.add(b)) {
b instanceof U && a.sl.add(b);
var c = a.memberAdded;
if (null !== c) {
var d = !0, e = a.diagram;
null !== e && (d = e.ea, e.ea = !0);
c(a, b);
null !== e && (e.ea = d)
}
a.isVisible() && a.isSubGraphExpanded || b.Lb(!1)
}
b instanceof R && !a.computesBoundsIncludingLinks || (b = a.Va, null === b && (b = a), b.s())
}
function no(a, b) {
if (a.oo.remove(b)) {
b instanceof U && a.sl.remove(b);
var c = a.memberRemoved;
if (null !== c) {
var d = !0, e = a.diagram;
null !== e && (d = e.ea, e.ea = !0);
c(a, b);
null !== e && (e.ea = d)
}
a.isVisible() && a.isSubGraphExpanded || b.Lb(!0)
}
b instanceof R && !a.computesBoundsIncludingLinks || (b = a.Va, null === b && (b = a), b.s())
}
t.$j = function () {
if (0 < this.oo.count) {
var a = this.diagram;
if (null !== a) for (var b = this.oo.copy().iterator; b.next();) a.remove(b.value)
}
V.prototype.$j.call(this)
};
U.prototype.canAddMembers = function (a) {
var b = this.diagram;
if (null === b) return !1;
b = b.commandHandler;
for (a = yk(a).iterator; a.next();) if (!b.isValidMember(this, a.value)) return !1;
return !0
};
U.prototype.addMembers = function (a, b) {
var c = this.diagram;
if (null === c) return !1;
c = c.commandHandler;
var d = !0;
for (a = yk(a).iterator; a.next();) {
var e = a.value;
!b || c.isValidMember(this, e) ? e.containingGroup = this : d = !1
}
return d
};
U.prototype.canUngroup = function () {
if (!this.ungroupable) return !1;
var a = this.layer;
if (null !== a && !a.allowUngroup) return !1;
a = a.diagram;
return null === a || a.allowUngroup ? !0 : !1
};
t = U.prototype;
t.ed = function (a) {
void 0 === a && (a = null);
var b = 0 !== (this.S & 65536);
V.prototype.ed.call(this, a);
if (!b) for (0 !== (this.S & 65536) !== !0 && (this.S = this.S ^ 65536), b = this.Xu(); b.next();) {
var c = b.value;
if (null === a || !a.contains(c)) {
var d = c.fromNode;
null !== d && d !== this && d.Vd(this) && !d.isVisible() ? (wo(d, c.fromPort), wo(d, c.toPort), c.Ra()) : (d = c.toNode, null !== d && d !== this && d.Vd(this) && !d.isVisible() && (wo(d, c.fromPort), wo(d, c.toPort), c.Ra()))
}
}
};
t.Xu = function () {
var a = this.ck();
a.add(this);
for (var b = new F, c = a.iterator; c.next();) {
var d = c.value;
if (d instanceof V) for (d = d.linksConnected; d.next();) {
var e = d.value;
a.contains(e) || b.add(e)
}
}
return b.iterator
};
t.Jy = function () {
var a = this.ck();
a.add(this);
for (var b = new F, c = a.iterator; c.next();) {
var d = c.value;
if (d instanceof V) for (d = d.linksConnected; d.next();) {
var e = d.value, f = e.fromNode;
a.contains(f) && f !== this || b.add(f);
e = e.toNode;
a.contains(e) && e !== this || b.add(e)
}
}
return b.iterator
};
t.Iy = function () {
function a(b, d) {
null !== b && (d.add(b), a(b.containingGroup, d))
}
var b = new F;
a(this, b);
return b
};
t.ck = function () {
var a = new F;
wk(a, this, !0, 0, !0);
a.remove(this);
return a
};
t.Lb = function (a) {
V.prototype.Lb.call(this, a);
for (var b = this.memberParts; b.next();) b.value.Lb(a)
};
U.prototype.collapseSubGraph = function () {
var a = this.diagram;
if (null !== a && !a.Fe) {
a.Fe = !0;
var b = this.ck();
Ho(this, b, a, this);
a.Fe = !1
}
};
function Ho(a, b, c, d) {
for (var e = a.memberParts; e.next();) {
var f = e.value;
f.Lb(!1);
f instanceof U && f.isSubGraphExpanded && (f.wasSubGraphExpanded = f.isSubGraphExpanded, Ho(f, b, c, d));
if (f instanceof V) f.ed(b), c.Mp(f, d); else if (f instanceof R) for (f = f.labelNodes; f.next();) f.value.ed(b)
}
a.isSubGraphExpanded = !1
}
U.prototype.expandSubGraph = function () {
var a = this.diagram;
if (null !== a && !a.Fe) {
a.Fe = !0;
var b = this.ck();
Io(this, b, a, this);
a.Fe = !1
}
};
function Io(a, b, c, d) {
for (var e = a.memberParts; e.next();) {
var f = e.value;
f.Lb(!0);
f instanceof U && f.wasSubGraphExpanded && (f.wasSubGraphExpanded = !1, Io(f, b, c, d));
if (f instanceof V) f.ed(b), c.Np(f, d); else if (f instanceof R) for (f = f.labelNodes; f.next();) f.value.ed(b)
}
a.isSubGraphExpanded = !0
}
U.prototype.move = function (a, b) {
void 0 === b && (b = !1);
var c = b ? this.location : this.position, d = c.x;
c = c.y;
var e = a.x, f = a.y;
if (!(d === e || isNaN(d) && isNaN(e)) || !(c === f || isNaN(c) && isNaN(f))) {
d = e - (isNaN(d) ? 0 : d);
c = f - (isNaN(c) ? 0 : c);
f = G.alloc();
V.prototype.move.call(this, a, b);
a = new F;
for (b = this.ck().iterator; b.next();) if (e = b.value, e instanceof R && (e.suspendsRouting && a.add(e), e.Lc || e.fromNode !== this && e.toNode !== this)) e.suspendsRouting = !0;
for (b.reset(); b.next();) if (e = b.value, !(e.Bh() || e instanceof V && e.isLinkLabel)) {
var g =
e.position, h = e.location;
g.o() ? (f.x = g.x + d, f.y = g.y + c, e.position = f) : h.o() && (f.x = h.x + d, f.y = h.y + c, e.location = f)
}
for (b.reset(); b.next();) if (e = b.value, e instanceof R && (e.suspendsRouting = a.contains(e), e.Lc || e.fromNode !== this && e.toNode !== this)) g = e.position, f.x = g.x + d, f.y = g.y + c, f.o() ? e.move(f) : e.Ra(), xj(e) && e.Ra();
G.free(f)
}
};
ma.Object.defineProperties(U.prototype, {
placeholder: {
get: function () {
return this.Va
}
}, computesBoundsAfterDrag: {
get: function () {
return 0 !== (this.S & 2048)
}, set: function (a) {
var b = 0 !== (this.S & 2048);
b !== a && (this.S ^= 2048, this.g("computesBoundsAfterDrag", b, a))
}
}, computesBoundsIncludingLinks: {
get: function () {
return 0 !== (this.S & 4096)
}, set: function (a) {
var b = 0 !== (this.S & 4096);
b !== a && (this.S ^= 4096, this.g("computesBoundsIncludingLinks",
b, a))
}
}, computesBoundsIncludingLocation: {
get: function () {
return 0 !== (this.S & 8192)
}, set: function (a) {
var b = 0 !== (this.S & 8192);
b !== a && (this.S ^= 8192, this.g("computesBoundsIncludingLocation", b, a))
}
}, handlesDragDropForMembers: {
get: function () {
return 0 !== (this.S & 16384)
}, set: function (a) {
var b = 0 !== (this.S & 16384);
b !== a && (this.S ^= 16384, this.g("handlesDragDropForMembers", b, a))
}
}, memberParts: {
get: function () {
return this.oo.iterator
}
},
layout: {
get: function () {
return this.gc
}, set: function (a) {
var b = this.gc;
if (b !== a) {
null !== b && (b.diagram = null, b.group = null);
this.gc = a;
var c = this.diagram;
null !== a && (a.diagram = c, a.group = this);
null !== c && (c.Dg = !0);
this.g("layout", b, a);
null !== c && c.cc()
}
}
}, memberAdded: {
get: function () {
return this.no
}, set: function (a) {
var b = this.no;
b !== a && (this.no = a, this.g("memberAdded", b, a))
}
}, memberRemoved: {
get: function () {
return this.po
},
set: function (a) {
var b = this.po;
b !== a && (this.po = a, this.g("memberRemoved", b, a))
}
}, memberValidation: {
get: function () {
return this.li
}, set: function (a) {
var b = this.li;
b !== a && (this.li = a, this.g("memberValidation", b, a))
}
}, ungroupable: {
get: function () {
return 0 !== (this.S & 256)
}, set: function (a) {
var b = 0 !== (this.S & 256);
b !== a && (this.S ^= 256, this.g("ungroupable", b, a))
}
}, isSubGraphExpanded: {
get: function () {
return 0 !== (this.S & 512)
},
set: function (a) {
var b = 0 !== (this.S & 512);
if (b !== a) {
this.S ^= 512;
var c = this.diagram;
this.g("isSubGraphExpanded", b, a);
b = this.subGraphExpandedChanged;
if (null !== b) {
var d = !0;
null !== c && (d = c.ea, c.ea = !0);
b(this);
null !== c && (c.ea = d)
}
null !== c && c.undoManager.isUndoingRedoing ? (null !== this.Va && this.Va.s(), this.memberParts.each(function (a) {
a.updateAdornments()
})) : a ? this.expandSubGraph() : this.collapseSubGraph()
}
}
}, wasSubGraphExpanded: {
get: function () {
return 0 !== (this.S & 1024)
}, set: function (a) {
var b =
0 !== (this.S & 1024);
b !== a && (this.S ^= 1024, this.g("wasSubGraphExpanded", b, a))
}
}, subGraphExpandedChanged: {
get: function () {
return this.xp
}, set: function (a) {
var b = this.xp;
b !== a && (this.xp = a, this.g("subGraphExpandedChanged", b, a))
}
}, pk: {
get: function () {
return 0 !== (this.S & 32768)
}, set: function (a) {
0 !== (this.S & 32768) !== a && (this.S ^= 32768)
}
}
});
U.prototype.expandSubGraph = U.prototype.expandSubGraph;
U.prototype.collapseSubGraph = U.prototype.collapseSubGraph;
U.prototype.findSubGraphParts = U.prototype.ck;
U.prototype.findContainingGroupChain = U.prototype.Iy;
U.prototype.findExternalNodesConnected = U.prototype.Jy;
U.prototype.findExternalLinksConnected = U.prototype.Xu;
U.className = "Group";
function zg() {
Y.call(this);
this.eb = uc;
this.hp = new N(NaN, NaN, NaN, NaN)
}
la(zg, Y);
zg.prototype.cloneProtected = function (a) {
Y.prototype.cloneProtected.call(this, a);
a.eb = this.eb.I();
a.hp = this.hp.copy()
};
zg.prototype.xh = function (a) {
if (null === this.background && null === this.areaBackground) return !1;
var b = this.naturalBounds;
return fc(0, 0, b.width, b.height, a.x, a.y)
};
zg.prototype.im = function () {
var a = this.part;
null !== a && (a instanceof U || a instanceof Je) || B("Placeholder is not inside a Group or Adornment.");
if (a instanceof U) {
var b = this.computeBorder(this.hp), c = this.minSize, d = this.qc;
Wb(d, (isFinite(c.width) ? Math.max(c.width, b.width) : b.width) || 0, (isFinite(c.height) ? Math.max(c.height, b.height) : b.height) || 0);
Mk(this, 0, 0, d.width, d.height);
c = a.memberParts;
for (d = !1; c.next();) if (c.value.isVisible()) {
d = !0;
break
}
c = a.diagram;
(d = !d || null === c) || (d = c.animationManager, d.Nf ? (d =
d.zj.J(a), d = null !== d && (d.start.position || d.start.location)) : d = !1);
d || isNaN(b.x) || isNaN(b.y) ? null !== c && c.animationManager.isAnimating && c.animationManager.cs.add(this) : (c = G.alloc(), c.Wi(b, a.locationSpot), c.A(a.location) || (a.location = new G(c.x, c.y)), G.free(c))
} else {
b = this.qc;
c = this.eb;
d = c.left + c.right;
var e = c.top + c.bottom, f = a.adornedObject;
a.angle = f.Mi();
var g = 0;
f instanceof W && (g = f.strokeWidth);
var h = f.De(), k = f.naturalBounds, l = (k.width + g) * h;
g = (k.height + g) * h;
a.type !== X.Link && (f = f.ma("Selection" === a.category ?
zc : a.locationSpot, G.alloc()), a.location = f, G.free(f));
isNaN(l) || isNaN(g) ? (a = a.adornedObject, l = a.ma(zc, G.alloc()), f = N.allocAt(l.x, l.y, 0, 0), f.Je(a.ma(Jc, l)), f.Je(a.ma(Dc, l)), f.Je(a.ma(Hc, l)), Wb(b, f.width + d || 0, f.height + e || 0), Mk(this, -c.left, -c.top, b.width, b.height), G.free(l), N.free(f)) : (Wb(b, l + d || 0, g + e || 0), Mk(this, -c.left, -c.top, b.width, b.height))
}
};
zg.prototype.vh = function (a, b, c, d) {
this.actualBounds.h(a, b, c, d)
};
zg.prototype.computeBorder = function (a) {
var b = this.part, c = b.diagram;
if (null !== c && b instanceof U && !b.layer.isTemporary && b.computesBoundsAfterDrag && this.hp.o()) {
var d = c.toolManager.findTool("Dragging");
if (d === c.currentTool && (c = d.computeBorder(b, this.hp, a), null !== c)) return c
}
c = N.alloc();
d = this.computeMemberBounds(c);
var e = this.eb;
b instanceof U && !b.isSubGraphExpanded ? a.h(d.x - e.left, d.y - e.top, 0, 0) : a.h(d.x - e.left, d.y - e.top, Math.max(d.width + e.left + e.right, 0), Math.max(d.height + e.top + e.bottom, 0));
N.free(c);
b instanceof U && b.computesBoundsIncludingLocation && b.location.o() && a.Je(b.location);
return a
};
zg.prototype.computeMemberBounds = function (a) {
if (!(this.part instanceof U)) return a.h(0, 0, 0, 0), a;
for (var b = this.part, c = Infinity, d = Infinity, e = -Infinity, f = -Infinity, g = b.memberParts; g.next();) {
var h = g.value;
if (h.isVisible()) {
if (h instanceof R) {
if (!b.computesBoundsIncludingLinks) continue;
if ($i(h)) continue;
if (h.fromNode === b || h.toNode === b) continue
}
h = h.actualBounds;
h.left < c && (c = h.left);
h.top < d && (d = h.top);
h.right > e && (e = h.right);
h.bottom > f && (f = h.bottom)
}
}
isFinite(c) && isFinite(d) ? a.h(c, d, e - c, f - d) : (b = b.location,
a.h(b.x, b.y, 0, 0));
return a
};
ma.Object.defineProperties(zg.prototype, {
padding: {
get: function () {
return this.eb
}, set: function (a) {
"number" === typeof a && (a = new pc(a));
var b = this.eb;
b.A(a) || (this.eb = a = a.I(), this.g("padding", b, a))
}
}
});
zg.className = "Placeholder";
function R() {
S.call(this, X.Link);
this.Ta = 8;
this.Pe = null;
this.Qe = "";
this.gf = this.Fn = null;
this.hf = "";
this.Ep = null;
this.Mm = qg;
this.gn = 0;
this.kn = qg;
this.ln = NaN;
this.Gj = Jo;
this.sp = .5;
this.$c = null;
this.xb = (new E).freeze();
this.dh = this.$g = null;
this.yl = new N;
this.qa = new ud;
this.Qn = !0;
this.K = this.u = this.Af = this.Jf = null;
this.l = [];
this.Au = new G;
this.rr = this.Kw = this.Jw = null;
this.au = NaN;
this.P = null
}
la(R, S);
R.prototype.cloneProtected = function (a) {
S.prototype.cloneProtected.call(this, a);
a.Ta = this.Ta & -113;
a.Qe = this.Qe;
a.Fn = this.Fn;
a.hf = this.hf;
a.Ep = this.Ep;
a.Mm = this.Mm;
a.gn = this.gn;
a.kn = this.kn;
a.ln = this.ln;
a.Gj = this.Gj;
a.sp = this.sp;
null !== this.P && (a.P = this.P.copy())
};
t = R.prototype;
t.pf = function (a) {
S.prototype.pf.call(this, a);
this.Qe = a.Qe;
this.hf = a.hf;
a.$g = null;
a.Ra();
a.Af = this.Af;
var b = a.fromPort;
null !== b && wo(a.fromNode, b);
b = a.toPort;
null !== b && wo(a.toNode, b)
};
t.fb = function (a) {
a.classType === R ? 2 === (a.value & 2) ? this.routing = a : a === tg || a === pg || a === og ? this.curve = a : a === Ko || a === Lo || a === Mo ? this.adjusting = a : a !== Jo && a !== qg && B("Unknown Link enum value for a Link property: " + a) : S.prototype.fb.call(this, a)
};
t.Hc = function () {
null === this.P && (this.P = new Ik)
};
t.Si = function () {
var a = this.fromNode;
if (null !== a) {
var b = a.findVisibleNode();
null !== b && (a = b);
if (aj(a) || bj(a)) return !1
}
a = this.toNode;
return null !== a && (b = a.findVisibleNode(), null !== b && (a = b), aj(a) || bj(a)) ? !1 : !0
};
t.Mv = function () {
return !1
};
t.Nv = function () {
};
t.bc = function () {
return !1
};
R.prototype.computeAngle = function (a, b, c) {
return R.computeAngle(b, c)
};
R.computeAngle = function (a, b) {
switch (a) {
default:
case qg:
a = 0;
break;
case qn:
a = b;
break;
case rm:
a = b + 90;
break;
case tm:
a = b - 90;
break;
case No:
a = b + 180;
break;
case Oo:
a = H.kq(b);
90 < a && 270 > a && (a -= 180);
break;
case sm:
a = H.kq(b + 90);
90 < a && 270 > a && (a -= 180);
break;
case um:
a = H.kq(b - 90);
90 < a && 270 > a && (a -= 180);
break;
case vm:
a = H.kq(b);
if (45 < a && 135 > a || 225 < a && 315 > a) return 0;
90 < a && 270 > a && (a -= 180)
}
return H.kq(a)
};
function so(a) {
var b = a.fromNode, c = a.toNode, d = null;
null !== b ? d = null !== c ? b.ex(c) : b.containingGroup : null !== c ? d = c.containingGroup : d = null;
b = d;
c = a.Th;
if (c !== b) {
null !== c && no(c, a);
a.Th = b;
null !== b && mo(b, a);
var e = a.containingGroupChanged;
if (null !== e) {
var f = !0, g = a.diagram;
null !== g && (f = g.ea, g.ea = !0);
e(a, c, b);
null !== g && (g.ea = f)
}
!a.Lc || a.Jw !== c && a.Kw !== c || a.Ra()
}
if (a.isLabeledLink) for (a = a.labelNodes; a.next();) a.value.containingGroup = d
}
t = R.prototype;
t.Ah = function () {
var a = this.containingGroup;
null !== a && this.fromNode !== a && this.toNode !== a && a.computesBoundsIncludingLinks && S.prototype.Ah.call(this)
};
t.Xs = function (a) {
var b = this.fromNode;
return a === b ? this.toNode : b
};
t.bz = function (a) {
var b = this.fromPort;
return a === b ? this.toPort : b
};
function zo(a, b) {
null === a.$c && (a.$c = new F);
a.$c.add(b);
a.s()
}
t.bq = function (a) {
S.prototype.bq.call(this, a);
Po(this) && this.eq(this.actualBounds);
if (!a) {
a = this.Pe;
var b = null;
null !== a && (b = this.fromPort, xo(a, this, b));
var c = this.gf;
if (null !== c) {
var d = this.toPort;
c === a && d === b || xo(c, this, d)
}
Qo(this)
}
};
t.cq = function (a) {
S.prototype.cq.call(this, a);
Po(this) && this.eq(this.actualBounds);
if (!a) {
a = this.Pe;
var b = null;
null !== a && (b = this.fromPort, yo(a, this, b));
var c = this.gf;
if (null !== c) {
var d = this.toPort;
c === a && d === b || yo(c, this, d)
}
Ro(this)
}
};
t.$j = function () {
this.Lc = !0;
if (null !== this.$c) {
var a = this.diagram;
if (null !== a) for (var b = this.$c.copy().iterator; b.next();) a.remove(b.value)
}
null !== this.data && (a = this.diagram, null !== a && a.partManager.removeDataForLink(this))
};
R.prototype.updateRelationshipsFromData = function () {
if (null !== this.data) {
var a = this.diagram;
null !== a && a.partManager.updateRelationshipsFromData(this)
}
};
R.prototype.move = function (a, b) {
var c = b ? this.location : this.position, d = c.x;
isNaN(d) && (d = 0);
var e = c.y;
isNaN(e) && (e = 0);
d = a.x - d;
e = a.y - e;
!0 === b ? S.prototype.move.call(this, a, !1) : (a = G.allocAt(c.x + d, c.y + e), S.prototype.move.call(this, a, !1), G.free(a));
sf(this, d, e);
for (a = this.labelNodes; a.next();) b = a.value, c = b.position, b.moveTo(c.x + d, c.y + e)
};
R.prototype.canRelinkFrom = function () {
if (!this.relinkableFrom) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowRelink) return !1;
a = a.diagram;
return null === a || a.allowRelink ? !0 : !1
};
R.prototype.canRelinkTo = function () {
if (!this.relinkableTo) return !1;
var a = this.layer;
if (null === a) return !0;
if (!a.allowRelink) return !1;
a = a.diagram;
return null === a || a.allowRelink ? !0 : !1
};
R.prototype.computeMidPoint = function (a) {
var b = this.pointsCount;
if (0 === b) return a.assign(Jb), a;
if (1 === b) return a.assign(this.i(0)), a;
if (2 === b) {
var c = this.i(0), d = this.i(1);
a.h((c.x + d.x) / 2, (c.y + d.y) / 2);
return a
}
if (this.isOrthogonal && (15 <= this.computeCorner() || this.computeCurve() === tg)) return this.qa.ev(.5, a), a.add(this.i(0)), c = this.qa.figures.first(), a.offset(-c.startX, -c.startY), a;
if (this.computeCurve() === tg) {
if (3 === b) return this.i(1);
d = (b - 1) / 3 | 0;
c = 3 * (d / 2 | 0);
if (1 === d % 2) {
d = this.i(c);
var e = this.i(c + 1),
f = this.i(c + 2);
c = this.i(c + 3);
H.ny(d.x, d.y, e.x, e.y, f.x, f.y, c.x, c.y, a)
} else a.assign(this.i(c));
return a
}
var g = this.flattenedLengths;
c = this.flattenedTotalLength;
for (e = f = d = 0; d < c / 2 && f < b;) {
e = g[f];
if (d + e > c / 2) break;
d += e;
f++
}
b = this.i(f);
f = this.i(f + 1);
1 > Math.abs(b.x - f.x) ? b.y > f.y ? a.h(b.x, b.y - (c / 2 - d)) : a.h(b.x, b.y + (c / 2 - d)) : 1 > Math.abs(b.y - f.y) ? b.x > f.x ? a.h(b.x - (c / 2 - d), b.y) : a.h(b.x + (c / 2 - d), b.y) : (c = (c / 2 - d) / e, a.h(b.x + c * (f.x - b.x), b.y + c * (f.y - b.y)));
return a
};
R.prototype.computeMidAngle = function () {
var a = this.pointsCount;
if (2 > a) return NaN;
if (2 === a) return this.i(0).Wa(this.i(1));
if (this.isOrthogonal && (15 <= this.computeCorner() || this.computeCurve() === tg)) {
a:{
a = this.qa;
var b = .5;
0 > b ? b = 0 : 1 < b && (b = 1);
if (a.type === xd) a = 180 * Math.atan2(a.endY - a.startY, a.endX - a.startX) / Math.PI; else {
var c = a.flattenedSegments, d = a.flattenedLengths, e = c.length;
b = a.flattenedTotalLength * b;
for (var f = 0, g = 0; g < e; g++) {
var h = d[g], k = h.length;
for (a = 0; a < k; a++) {
var l = h[a];
if (f + l >= b) {
b = c[g];
c = b[2 * a];
d = b[2 * a + 1];
e = b[2 * a + 2];
a = b[2 * a + 3];
a = 1 > Math.abs(e - c) && 1 > Math.abs(a - d) ? 0 : 1 > Math.abs(e - c) ? 0 <= a - d ? 90 : 270 : 1 > Math.abs(a - d) ? 0 <= e - c ? 0 : 180 : 180 * Math.atan2(a - d, e - c) / Math.PI;
break a
}
f += l
}
}
a = NaN
}
}
return a
}
if (this.computeCurve() === tg && 4 <= a) {
d = (a - 1) / 3 | 0;
c = 3 * (d / 2 | 0);
if (1 === d % 2) return c = Math.floor(c), a = this.i(c), d = this.i(c + 1), e = this.i(c + 2), c = this.i(c + 3), H.my(a.x, a.y, d.x, d.y, e.x, e.y, c.x, c.y);
if (0 < c && c + 1 < a) return this.i(c - 1).Wa(this.i(c + 1))
}
d = this.flattenedLengths;
e = this.flattenedTotalLength;
for (c = b = 0; b < e / 2 && c < a;) {
f =
d[c];
if (b + f > e / 2) break;
b += f;
c++
}
d = this.i(c);
e = this.i(c + 1);
if (1 > Math.abs(d.x - e.x) && 1 > Math.abs(d.y - e.y)) {
if (0 < c && c + 2 < a) return this.i(c - 1).Wa(this.i(c + 2))
} else {
if (1 > Math.abs(d.x - e.x)) return d.y > e.y ? 270 : 90;
if (1 > Math.abs(d.y - e.y)) return d.x > e.x ? 180 : 0
}
return d.Wa(e)
};
t = R.prototype;
t.i = function (a) {
return this.xb.j[a]
};
t.jd = function (a, b) {
this.xb.gd(a, b)
};
t.M = function (a, b, c) {
this.xb.gd(a, new G(b, c))
};
t.mz = function (a, b) {
this.xb.Ib(a, b)
};
t.m = function (a, b, c) {
this.xb.Ib(a, new G(b, c))
};
t.ze = function (a) {
this.xb.add(a)
};
t.lf = function (a, b) {
this.xb.add(new G(a, b))
};
t.Bv = function (a) {
this.xb.mb(a)
};
t.Vj = function () {
this.xb.clear()
};
function sf(a, b, c) {
if (0 !== b || 0 !== c) {
for (var d = a.Lc, e = new E, f = a.xb.iterator; f.next();) {
var g = f.value;
e.add((new G(g.x + b, g.y + c)).freeze())
}
e.freeze();
f = a.xb;
a.xb = e;
isNaN(b) || isNaN(c) || a.diagram.animationManager.rb ? a.s() : (a.me.h(a.me.x + b, a.me.y + c), a.sa.h(a.sa.x + b, a.sa.y + c), gl(a));
d && So(a);
b = a.diagram;
null !== b && b.animationManager.rb && (a.dh = e);
a.g("points", f, e)
}
}
t.Dh = function () {
null === this.$g && (this.$g = this.xb, this.xb = this.xb.copy())
};
t.mf = function () {
if (null !== this.$g) {
for (var a = this.$g, b = this.xb, c = Infinity, d = Infinity, e = a.j, f = e.length, g = 0; g < f; g++) {
var h = e[g];
c = Math.min(h.x, c);
d = Math.min(h.y, d)
}
h = g = Infinity;
for (var k = b.j, l = k.length, m = 0; m < l; m++) {
var n = k[m];
g = Math.min(n.x, g);
h = Math.min(n.y, h);
n.freeze()
}
b.freeze();
if (l === f) for (f = 0; f < l; f++) {
if (m = e[f], n = k[f], m.x - c !== n.x - g || m.y - d !== n.y - h) {
this.s();
this.ac();
break
}
} else this.s(), this.ac();
this.$g = null;
c = this.diagram;
null !== c && c.animationManager.rb && (this.dh = b);
So(this);
this.g("points",
a, b)
}
};
t.zx = function () {
null !== this.$g && (this.xb = this.$g, this.$g = null)
};
function So(a) {
0 === a.xb.count ? a.Lc = !1 : (a.Lc = !0, a.rr = null, a.au = NaN, a.defaultFromPoint = a.i(0), a.defaultToPoint = a.i(a.pointsCount - 1), To(a, !1))
}
t.Ra = function () {
if (!this.suspendsRouting) {
var a = this.diagram;
if (a) {
if (a.gt.contains(this) || a.undoManager.isUndoingRedoing) return;
a = a.animationManager;
if (a.isTicking && !a.isAnimating) return;
null !== this.dh && !a.isTicking && a.isAnimating && (this.dh = null)
}
a = this.path;
null !== a && (this.Lc = !1, this.s(), a.s())
}
};
t.$i = function () {
if (!this.Lc && !this.Qu) {
var a = !0;
try {
this.Qu = !0, this.Dh(), a = this.computePoints()
} finally {
this.Qu = !1, a ? this.mf() : this.zx()
}
}
};
R.prototype.computePoints = function () {
var a = this.diagram;
if (null === a) return !1;
var b = this.fromNode, c = null;
null === b ? (a.si || (a.bp = new W, a.bp.desiredSize = Kb, a.bp.strokeWidth = 0, a.si = new V, a.si.add(a.bp), a.si.$b()), this.defaultFromPoint && (a.si.position = a.si.location = this.defaultFromPoint, a.si.$b(), b = a.si, c = a.bp)) : c = this.fromPort;
if (null !== c && !b.isVisible()) {
var d = b.findVisibleNode();
null !== d && d !== b ? (b = d, c = d.port) : b = d
}
this.Jw = b;
if (null === b || !b.location.o()) return !1;
for (; !(null === c || c.actualBounds.o() && c.tf());) c =
c.panel;
if (null === c) return !1;
var e = this.toNode, f = null;
null === e ? (a.ti || (a.cp = new W, a.cp.desiredSize = Kb, a.cp.strokeWidth = 0, a.ti = new V, a.ti.add(a.cp), a.ti.$b()), this.defaultToPoint && (a.ti.position = a.ti.location = this.defaultToPoint, a.ti.$b(), e = a.ti, f = a.cp)) : f = this.toPort;
null === f || e.isVisible() || (a = e.findVisibleNode(), null !== a && a !== e ? (e = a, f = a.port) : e = a);
this.Kw = e;
if (null === e || !e.location.o()) return !1;
for (; !(null === f || f.actualBounds.o() && f.tf());) f = f.panel;
if (null === f) return !1;
var g = this.pointsCount;
d =
this.computeSpot(!0, c);
a = this.computeSpot(!1, f);
var h = Uo(d), k = Uo(a), l = c === f && null !== c, m = this.isOrthogonal, n = this.curve === tg;
this.Jf = l && !m ? n = !0 : !1;
var p = this.adjusting === qg || l;
if (!m && !l && h && k) {
if (h = !1, !p && 3 <= g && (p = this.getLinkPoint(b, c, d, !0, !1, e, f), k = this.getLinkPoint(e, f, a, !1, !1, b, c), h = this.adjustPoints(0, p, g - 1, k)) && (p = this.getLinkPoint(b, c, d, !0, !1, e, f), k = this.getLinkPoint(e, f, a, !1, !1, b, c), this.adjustPoints(0, p, g - 1, k)), !h) if (this.Vj(), n) {
g = this.getLinkPoint(b, c, d, !0, !1, e, f);
p = this.getLinkPoint(e,
f, a, !1, !1, b, c);
h = p.x - g.x;
k = p.y - g.y;
l = this.computeCurviness();
n = m = 0;
var r = g.x + h / 3, q = g.y + k / 3, u = r, v = q;
H.w(k, 0) ? v = 0 < h ? v - l : v + l : (m = -h / k, n = Math.sqrt(l * l / (m * m + 1)), 0 > l && (n = -n), u = (0 > k ? -1 : 1) * n + r, v = m * (u - r) + q);
r = g.x + 2 * h / 3;
q = g.y + 2 * k / 3;
var w = r, z = q;
H.w(k, 0) ? z = 0 < h ? z - l : z + l : (w = (0 > k ? -1 : 1) * n + r, z = m * (w - r) + q);
this.Vj();
this.ze(g);
this.lf(u, v);
this.lf(w, z);
this.ze(p);
this.jd(0, this.getLinkPoint(b, c, d, !0, !1, e, f));
this.jd(3, this.getLinkPoint(e, f, a, !1, !1, b, c))
} else d = this.getLinkPoint(b, c, d, !0, !1, e, f), a = this.getLinkPoint(e,
f, a, !1, !1, b, c), this.hasCurviness() ? (p = a.x - d.x, e = a.y - d.y, f = this.computeCurviness(), b = d.x + p / 2, c = d.y + e / 2, g = b, h = c, H.w(e, 0) ? h = 0 < p ? h - f : h + f : (p = -p / e, g = Math.sqrt(f * f / (p * p + 1)), 0 > f && (g = -g), g = (0 > e ? -1 : 1) * g + b, h = p * (g - b) + c), this.ze(d), this.lf(g, h)) : this.ze(d), this.ze(a)
} else {
n = this.isAvoiding;
p && (m && n || l) && this.Vj();
var y = l ? this.computeCurviness() : 0;
n = this.getLinkPoint(b, c, d, !0, m, e, f);
r = u = q = 0;
if (m || !h || l) v = this.computeEndSegmentLength(b, c, d, !0), r = this.getLinkDirection(b, c, n, d, !0, m, e, f), l && (h || d.A(a) || !m && 1 === d.x +
a.x && 1 === d.y + a.y) && (r -= m ? 90 : 30, 0 > y && (r -= 180)), 0 > r ? r += 360 : 360 <= r && (r -= 360), l && (v += Math.abs(y) * (m ? 1 : 2)), 0 === r ? q = v : 90 === r ? u = v : 180 === r ? q = -v : 270 === r ? u = -v : (q = v * Math.cos(r * Math.PI / 180), u = v * Math.sin(r * Math.PI / 180)), d.jc() && l && (v = c.ma(Fc, G.alloc()), w = G.allocAt(v.x + 1E3 * q, v.y + 1E3 * u), this.getLinkPointFromPoint(b, c, v, w, !0, n), G.free(v), G.free(w));
v = this.getLinkPoint(e, f, a, !1, m, b, c);
var A = z = w = 0;
if (m || !k || l) {
var C = this.computeEndSegmentLength(e, f, a, !1);
A = this.getLinkDirection(e, f, v, a, !1, m, b, c);
l && (k || d.A(a) || !m &&
1 === d.x + a.x && 1 === d.y + a.y) && (A += m ? 0 : 30, 0 > y && (A += 180));
0 > A ? A += 360 : 360 <= A && (A -= 360);
l && (C += Math.abs(y) * (m ? 1 : 2));
0 === A ? w = C : 90 === A ? z = C : 180 === A ? w = -C : 270 === A ? z = -C : (w = C * Math.cos(A * Math.PI / 180), z = C * Math.sin(A * Math.PI / 180));
a.jc() && l && (a = f.ma(Fc, G.alloc()), d = G.allocAt(a.x + 1E3 * w, a.y + 1E3 * z), this.getLinkPointFromPoint(e, f, a, d, !1, v), G.free(a), G.free(d))
}
a = n;
if (m || !h || l) a = new G(n.x + q, n.y + u);
d = v;
if (m || !k || l) d = new G(v.x + w, v.y + z);
!p && !m && h && 3 < g && this.adjustPoints(0, n, g - 2, d) ? this.jd(g - 1, v) : !p && !m && k && 3 < g && this.adjustPoints(1,
a, g - 1, v) ? this.jd(0, n) : !p && (m ? 6 <= g : 4 < g) && this.adjustPoints(1, a, g - 2, d) ? (this.jd(0, n), this.jd(g - 1, v)) : (this.Vj(), this.ze(n), (m || !h || l) && this.ze(a), m && this.addOrthoPoints(a, r, d, A, b, e), (m || !k || l) && this.ze(d), this.ze(v))
}
return !0
};
function Vo(a, b) {
Math.abs(b.x - a.x) > Math.abs(b.y - a.y) ? (b.x >= a.x ? b.x = a.x + 9E9 : b.x = a.x - 9E9, b.y = a.y) : (b.y >= a.y ? b.y = a.y + 9E9 : b.y = a.y - 9E9, b.x = a.x);
return b
}
R.prototype.getLinkPointFromPoint = function (a, b, c, d, e, f) {
void 0 === f && (f = new G);
if (null === a || null === b) return f.assign(c), f;
a.isVisible() || (e = a.findVisibleNode(), null !== e && e !== a && (b = e.port));
a = null;
e = b.panel;
null === e || e.Zd() || (e = e.panel);
if (null === e) {
e = d.x;
d = d.y;
var g = c.x;
c = c.y
} else {
a = e.rd;
e = 1 / (a.m11 * a.m22 - a.m12 * a.m21);
g = a.m22 * e;
var h = -a.m12 * e, k = -a.m21 * e, l = a.m11 * e, m = e * (a.m21 * a.dy - a.m22 * a.dx),
n = e * (a.m12 * a.dx - a.m11 * a.dy);
e = d.x * g + d.y * k + m;
d = d.x * h + d.y * l + n;
g = c.x * g + c.y * k + m;
c = c.x * h + c.y * l + n
}
b.dk(e, d, g, c, f);
null !==
a && f.transform(a);
return f
};
function Wo(a, b) {
var c = b.So;
null === c && (c = new Xo, c.port = b, c.node = b.part, b.So = c);
return Yo(c, a)
}
R.prototype.getLinkPoint = function (a, b, c, d, e, f, g, h) {
void 0 === h && (h = new G);
if (c.gb() && !Uo(c)) return b.ma(c, h), h;
if (c.sf()) {
var k = Wo(this, b);
if (null !== k) {
h.assign(k.hq);
if (e && this.routing === Zo) {
var l = Wo(this, g);
if (null !== l && k.Xl < l.Xl) {
k = G.alloc();
l = G.alloc();
var m = new N(b.ma(zc, k), b.ma(Jc, l)), n = this.computeSpot(!d, g);
a = this.getLinkPoint(f, g, n, !d, e, a, b, l);
(c.rf(Mc) || c.rf(Nc)) && a.y >= m.y && a.y <= m.y + m.height ? h.y = a.y : (c.rf(Kc) || c.rf(Oc)) && a.x >= m.x && a.x <= m.x + m.width && (h.x = a.x);
G.free(k);
G.free(l)
}
}
return h
}
}
c =
b.ma(.5 === c.x && .5 === c.y ? c : Fc, G.alloc());
this.pointsCount > (e ? 6 : 2) ? (g = d ? this.i(1) : this.i(this.pointsCount - 2), e && (g = Vo(c, g.copy()))) : (k = this.computeSpot(!d, g), f = G.alloc(), g = g.ma(.5 === k.x && .5 === k.y ? k : Fc, f), e && (g = Vo(c, g)), G.free(f));
this.getLinkPointFromPoint(a, b, c, g, d, h);
G.free(c);
return h
};
R.prototype.getLinkDirection = function (a, b, c, d, e, f, g, h) {
a:if (d.gb()) var k = d.x > d.y ? d.x > 1 - d.y ? 0 : d.x < 1 - d.y ? 270 : 315 : d.x < d.y ? d.x > 1 - d.y ? 90 : d.x < 1 - d.y ? 180 : 135 : .5 > d.x ? 225 : .5 < d.x ? 45 : 0; else {
if (d.sf() && (k = Wo(this, b), null !== k)) switch (k.yc) {
case 1:
k = 270;
break a;
case 2:
k = 180;
break a;
default:
case 4:
k = 0;
break a;
case 8:
k = 90;
break a
}
k = b.ma(Fc, G.alloc());
this.pointsCount > (f ? 6 : 2) ? (h = e ? this.i(1) : this.i(this.pointsCount - 2), h = f ? Vo(k, h.copy()) : c) : (c = G.alloc(), h = h.ma(Fc, c), G.free(c));
c = Math.abs(h.x - k.x) > Math.abs(h.y - k.y) ? h.x >=
k.x ? 0 : 180 : h.y >= k.y ? 90 : 270;
G.free(k);
k = c
}
d.jc() && g.Vd(a) && (k += 180, 360 <= k && (k -= 360));
if (Uo(d)) return k;
a = b.Mi();
if (0 === a) return k;
45 <= a && 135 > a ? k += 90 : 135 <= a && 225 > a ? k += 180 : 225 <= a && 315 > a && (k += 270);
360 <= k && (k -= 360);
return k
};
R.prototype.computeEndSegmentLength = function (a, b, c, d) {
if (null !== b && c.sf() && (a = Wo(this, b), null !== a)) return a.Vu;
a = d ? this.fromEndSegmentLength : this.toEndSegmentLength;
null !== b && isNaN(a) && (a = d ? b.fromEndSegmentLength : b.toEndSegmentLength);
isNaN(a) && (a = 10);
return a
};
R.prototype.computeSpot = function (a, b) {
void 0 === b && (b = null);
a ? (a = b ? b : this.fromPort, null === a ? a = Fc : (b = this.fromSpot, b.Kb() && (b = a.fromSpot), a = b === ad ? yc : b)) : (a = b ? b : this.toPort, null === a ? a = Fc : (b = this.toSpot, b.Kb() && (b = a.toSpot), a = b === ad ? yc : b));
return a
};
function Uo(a) {
return a === yc || .5 === a.x && .5 === a.y
}
R.prototype.computeOtherPoint = function (a, b) {
a = b.ma(Fc);
b = b.So;
b = null !== b ? Yo(b, this) : null;
null !== b && (a = b.hq);
return a
};
R.prototype.computeShortLength = function (a) {
if (a) {
a = this.fromShortLength;
if (isNaN(a)) {
var b = this.fromPort;
null !== b && (a = b.fromShortLength)
}
return isNaN(a) ? 0 : a
}
a = this.toShortLength;
isNaN(a) && (b = this.toPort, null !== b && (a = b.toShortLength));
return isNaN(a) ? 0 : a
};
R.prototype.qg = function (a, b, c, d, e, f) {
if (!1 === this.pickable) return !1;
void 0 === b && (b = null);
void 0 === c && (c = null);
var g = f;
void 0 === f && (g = wc.alloc(), g.reset());
g.multiply(this.transform);
if (this.wh(a, g)) return Km(this, b, c, e), void 0 === f && wc.free(g), !0;
if (this.Ic(a, g)) {
var h = !1;
if (!this.isAtomic) for (var k = this.Y.j, l = k.length; l--;) {
var m = k[l];
if (m.visible || m === this.locationObject) {
var n = m.actualBounds, p = this.naturalBounds;
if (!(n.x > p.width || n.y > p.height || 0 > n.x + n.width || 0 > n.y + n.height)) {
n = wc.alloc();
n.set(g);
if (m instanceof X) h = m.qg(a, b, c, d, e, n); else if (this.path === m) {
if (m instanceof W) if (h = a, p = d, !1 === m.pickable) h = !1; else if (n.multiply(m.transform), p) b:{
var r = h, q = n;
if (m.wh(r, q)) h = !0; else {
if (void 0 === q && (q = m.transform, r.nf(m.actualBounds))) {
h = !0;
break b
}
h = r.left;
p = r.right;
var u = r.top;
r = r.bottom;
var v = G.alloc(), w = G.alloc(), z = G.alloc(), y = wc.alloc();
y.set(q);
y.pv(m.transform);
y.bt();
w.x = p;
w.y = u;
w.transform(y);
v.x = h;
v.y = u;
v.transform(y);
q = !1;
on(m, v, w, z) ? q = !0 : (v.x = p, v.y = r, v.transform(y), on(m, v, w, z) ? q = !0 : (w.x =
h, w.y = r, w.transform(y), on(m, v, w, z) ? q = !0 : (v.x = h, v.y = u, v.transform(y), on(m, v, w, z) && (q = !0))));
wc.free(y);
G.free(v);
G.free(w);
G.free(z);
h = q
}
} else h = m.wh(h, n)
} else h = Ok(m, a, d, n);
h && (p = m, null !== b && (p = b(m)), p && (null === c || c(p)) && e.add(p));
wc.free(n)
}
}
}
void 0 === f && wc.free(g);
return h || null !== this.background || null !== this.areaBackground
}
void 0 === f && wc.free(g);
return !1
};
R.prototype.computeCurve = function () {
if (null === this.Jf) {
var a = this.fromPort, b = this.isOrthogonal;
this.Jf = null !== a && a === this.toPort && !b
}
return this.Jf ? tg : this.curve
};
R.prototype.computeCorner = function () {
if (this.curve === tg) return 0;
var a = this.corner;
if (isNaN(a) || 0 > a) a = 10;
return a
};
R.prototype.findMidLabel = function () {
for (var a = this.path, b = this.Y.j, c = b.length, d = 0; d < c; d++) {
var e = b[d];
if (e !== a && !e.isPanelMain && (-Infinity === e.segmentIndex || isNaN(e.segmentIndex))) return e
}
for (a = this.labelNodes; a.next();) if (b = a.value, -Infinity === b.segmentIndex || isNaN(b.segmentIndex)) return b;
return null
};
R.prototype.computeSpacing = function () {
if (!this.isVisible()) return 0;
var a = Math.max(14, this.computeThickness());
var b = this.fromPort, c = this.toPort;
if (null !== b && null !== c) {
var d = this.findMidLabel();
if (null !== d) {
var e = d.naturalBounds, f = d.margin, g = isNaN(e.width) ? 30 : e.width * d.scale + f.left + f.right;
e = isNaN(e.height) ? 14 : e.height * d.scale + f.top + f.bottom;
d = d.segmentOrientation;
d === qn || d === Oo || d === No ? a = Math.max(a, e) : d === tm || d === um || d === rm || d === sm ? a = Math.max(a, g) : (b = b.ma(Fc).Wa(c.ma(Fc)) / 180 * Math.PI, a = Math.max(a,
Math.abs(Math.sin(b) * g) + Math.abs(Math.cos(b) * e) + 1));
this.curve === tg && (a *= 1.333)
}
}
return a
};
R.prototype.arrangeBundledLinks = function (a, b) {
if (b) for (b = 0; b < a.length; b++) {
var c = a[b];
c.adjusting === qg && c.Ra()
}
};
R.prototype.computeCurviness = function () {
var a = this.curviness;
if (isNaN(a)) {
a = 16;
var b = this.Af;
if (null !== b) {
for (var c = Da(), d = 0, e = b.links, f = 0; f < e.length; f++) {
var g = e[f].computeSpacing();
c.push(g);
d += g
}
d = -d / 2;
for (f = 0; f < e.length; f++) {
if (e[f] === this) {
a = d + c[f] / 2;
break
}
d += c[f]
}
b.jt === this.fromNode && (a = -a);
Ga(c)
}
}
return a
};
R.prototype.computeThickness = function () {
if (!this.isVisible()) return 0;
var a = this.path;
return null !== a ? Math.max(a.strokeWidth, 1) : 1
};
R.prototype.hasCurviness = function () {
return !isNaN(this.curviness) || null !== this.Af
};
R.prototype.adjustPoints = function (a, b, c, d) {
var e = this.adjusting;
if (this.isOrthogonal) {
if (e === Lo) return !1;
e === Mo && (e = Ko)
}
switch (e) {
case Lo:
var f = this.i(a), g = this.i(c);
if (!f.Qa(b) || !g.Qa(d)) {
e = f.x;
f = f.y;
var h = g.x - e, k = g.y - f, l = Math.sqrt(h * h + k * k);
if (!H.ca(l, 0)) {
if (H.ca(h, 0)) var m = 0 > k ? -Math.PI / 2 : Math.PI / 2; else m = Math.atan(k / Math.abs(h)), 0 > h && (m = Math.PI - m);
g = b.x;
var n = b.y;
h = d.x - g;
var p = d.y - n;
k = Math.sqrt(h * h + p * p);
H.ca(h, 0) ? p = 0 > p ? -Math.PI / 2 : Math.PI / 2 : (p = Math.atan(p / Math.abs(h)), 0 > h && (p = Math.PI - p));
l = k / l;
m =
p - m;
this.jd(a, b);
for (a += 1; a < c; a++) b = this.i(a), h = b.x - e, k = b.y - f, b = Math.sqrt(h * h + k * k), H.ca(b, 0) || (H.ca(h, 0) ? k = 0 > k ? -Math.PI / 2 : Math.PI / 2 : (k = Math.atan(k / Math.abs(h)), 0 > h && (k = Math.PI - k)), h = k + m, b *= l, this.M(a, g + b * Math.cos(h), n + b * Math.sin(h)));
this.jd(c, d)
}
}
return !0;
case Mo:
f = this.i(a);
n = this.i(c);
if (!f.Qa(b) || !n.Qa(d)) {
e = f.x;
f = f.y;
g = n.x;
n = n.y;
l = (g - e) * (g - e) + (n - f) * (n - f);
h = b.x;
m = b.y;
k = d.x;
p = d.y;
var r = 1;
if (0 !== k - h) {
var q = (p - m) / (k - h);
r = Math.sqrt(1 + 1 / (q * q))
} else q = 9E9;
this.jd(a, b);
for (a += 1; a < c; a++) {
b = this.i(a);
var u = b.x, v = b.y, w = .5;
0 !== l && (w = ((e - u) * (e - g) + (f - v) * (f - n)) / l);
var z = e + w * (g - e), y = f + w * (n - f);
b = Math.sqrt((u - z) * (u - z) + (v - y) * (v - y));
v < q * (u - z) + y && (b = -b);
0 < q && (b = -b);
u = h + w * (k - h);
w = m + w * (p - m);
0 !== q ? (b = u + b / r, this.M(a, b, w - (b - u) / q)) : this.M(a, u, w + b)
}
this.jd(c, d)
}
return !0;
case Ko:
a:{
if (this.isOrthogonal && (e = this.i(a), f = this.i(a + 1), g = this.i(a + 2), h = f.x, m = f.y, n = h, l = m, H.w(e.y, f.y) ? H.w(f.x, g.x) ? m = b.y : H.w(f.y, g.y) && (h = b.x) : H.w(e.x, f.x) && (H.w(f.y, g.y) ? h = b.x : H.w(f.x, g.x) && (m = b.y)), this.M(a + 1, h, m), e = this.i(c), f = this.i(c -
1), g = this.i(c - 2), h = f.x, m = f.y, k = h, p = m, H.w(e.y, f.y) ? H.w(f.x, g.x) ? m = d.y : H.w(f.y, g.y) && (h = d.x) : H.w(e.x, f.x) && (H.w(f.y, g.y) ? h = d.x : H.w(f.x, g.x) && (m = d.y)), this.M(c - 1, h, m), xj(this))) {
this.M(a + 1, n, l);
this.M(c - 1, k, p);
c = !1;
break a
}
this.jd(a, b);
this.jd(c, d);
c = !0
}
return c;
default:
return !1
}
};
R.prototype.addOrthoPoints = function (a, b, c, d, e, f) {
b = -45 <= b && 45 > b ? 0 : 45 <= b && 135 > b ? 90 : 135 <= b && 225 > b ? 180 : 270;
d = -45 <= d && 45 > d ? 0 : 45 <= d && 135 > d ? 90 : 135 <= d && 225 > d ? 180 : 270;
var g = e.actualBounds.copy(), h = f.actualBounds.copy();
if (g.o() && h.o()) {
g.Uc(8, 8);
h.Uc(8, 8);
g.Je(a);
h.Je(c);
if (0 === b) if (c.x > a.x || 270 === d && c.y < a.y && h.right > a.x || 90 === d && c.y > a.y && h.right > a.x) {
var k = new G(c.x, a.y);
var l = new G(c.x, (a.y + c.y) / 2);
180 === d ? (k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1), l.x = k.x, l.y = c.y) : 270 === d && c.y < a.y || 90 === d &&
c.y > a.y ? (k.x = a.x < h.left ? this.computeMidOrthoPosition(a.x, a.y, h.left, c.y, !1) : a.x < h.right && (270 === d && a.y < h.top || 90 === d && a.y > h.bottom) ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1) : h.right, l.x = k.x, l.y = c.y) : 0 === d && a.x < h.left && a.y > h.top && a.y < h.bottom && (k.x = a.x, k.y = a.y < c.y ? Math.min(c.y, h.top) : Math.max(c.y, h.bottom), l.y = k.y)
} else {
k = new G(a.x, c.y);
l = new G((a.x + c.x) / 2, c.y);
if (180 === d || 90 === d && c.y < g.top || 270 === d && c.y > g.bottom) 180 === d && (h.da(a) || g.da(c)) ? k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0) :
c.y < a.y && (180 === d || 90 === d) ? k.y = this.computeMidOrthoPosition(a.x, g.top, c.x, Math.max(c.y, h.bottom), !0) : c.y > a.y && (180 === d || 270 === d) && (k.y = this.computeMidOrthoPosition(a.x, g.bottom, c.x, Math.min(c.y, h.top), !0)), l.x = c.x, l.y = k.y;
if (k.y > g.top && k.y < g.bottom) if (c.x >= g.left && c.x <= a.x || a.x <= h.right && a.x >= c.x) {
if (90 === d || 270 === d) k = new G(Math.max((a.x + c.x) / 2, a.x), a.y), l = new G(k.x, c.y)
} else k.y = 270 === d || (0 === d || 180 === d) && c.y < a.y ? Math.min(c.y, 0 === d ? g.top : Math.min(g.top, h.top)) : Math.max(c.y, 0 === d ? g.bottom : Math.max(g.bottom,
h.bottom)), l.x = c.x, l.y = k.y
} else if (180 === b) if (c.x < a.x || 270 === d && c.y < a.y && h.left < a.x || 90 === d && c.y > a.y && h.left < a.x) k = new G(c.x, a.y), l = new G(c.x, (a.y + c.y) / 2), 0 === d ? (k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1), l.x = k.x, l.y = c.y) : 270 === d && c.y < a.y || 90 === d && c.y > a.y ? (k.x = a.x > h.right ? this.computeMidOrthoPosition(a.x, a.y, h.right, c.y, !1) : a.x > h.left && (270 === d && a.y < h.top || 90 === d && a.y > h.bottom) ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1) : h.left, l.x = k.x, l.y = c.y) : 180 === d && a.x > h.right && a.y > h.top && a.y <
h.bottom && (k.x = a.x, k.y = a.y < c.y ? Math.min(c.y, h.top) : Math.max(c.y, h.bottom), l.y = k.y); else {
k = new G(a.x, c.y);
l = new G((a.x + c.x) / 2, c.y);
if (0 === d || 90 === d && c.y < g.top || 270 === d && c.y > g.bottom) 0 === d && (h.da(a) || g.da(c)) ? k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0) : c.y < a.y && (0 === d || 90 === d) ? k.y = this.computeMidOrthoPosition(a.x, g.top, c.x, Math.max(c.y, h.bottom), !0) : c.y > a.y && (0 === d || 270 === d) && (k.y = this.computeMidOrthoPosition(a.x, g.bottom, c.x, Math.min(c.y, h.top), !0)), l.x = c.x, l.y = k.y;
if (k.y > g.top && k.y < g.bottom) if (c.x <=
g.right && c.x >= a.x || a.x >= h.left && a.x <= c.x) {
if (90 === d || 270 === d) k = new G(Math.min((a.x + c.x) / 2, a.x), a.y), l = new G(k.x, c.y)
} else k.y = 270 === d || (0 === d || 180 === d) && c.y < a.y ? Math.min(c.y, 180 === d ? g.top : Math.min(g.top, h.top)) : Math.max(c.y, 180 === d ? g.bottom : Math.max(g.bottom, h.bottom)), l.x = c.x, l.y = k.y
} else if (90 === b) if (c.y > a.y || 180 === d && c.x < a.x && h.bottom > a.y || 0 === d && c.x > a.x && h.bottom > a.y) k = new G(a.x, c.y), l = new G((a.x + c.x) / 2, c.y), 270 === d ? (k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0), l.x = c.x, l.y = k.y) : 180 ===
d && c.x < a.x || 0 === d && c.x > a.x ? (k.y = a.y < h.top ? this.computeMidOrthoPosition(a.x, a.y, c.x, h.top, !0) : a.y < h.bottom && (180 === d && a.x < h.left || 0 === d && a.x > h.right) ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0) : h.bottom, l.x = c.x, l.y = k.y) : 90 === d && a.y < h.top && a.x > h.left && a.x < h.right && (k.x = a.x < c.x ? Math.min(c.x, h.left) : Math.max(c.x, h.right), k.y = a.y, l.x = k.x); else {
k = new G(c.x, a.y);
l = new G(c.x, (a.y + c.y) / 2);
if (270 === d || 0 === d && c.x < g.left || 180 === d && c.x > g.right) 270 === d && (h.da(a) || g.da(c)) ? k.x = this.computeMidOrthoPosition(a.x,
a.y, c.x, c.y, !1) : c.x < a.x && (270 === d || 0 === d) ? k.x = this.computeMidOrthoPosition(g.left, a.y, Math.max(c.x, h.right), c.y, !1) : c.x > a.x && (270 === d || 180 === d) && (k.x = this.computeMidOrthoPosition(g.right, a.y, Math.min(c.x, h.left), c.y, !1)), l.x = k.x, l.y = c.y;
if (k.x > g.left && k.x < g.right) if (c.y >= g.top && c.y <= a.y || a.y <= h.bottom && a.y >= c.y) {
if (0 === d || 180 === d) k = new G(a.x, Math.max((a.y + c.y) / 2, a.y)), l = new G(c.x, k.y)
} else k.x = 180 === d || (90 === d || 270 === d) && c.x < a.x ? Math.min(c.x, 90 === d ? g.left : Math.min(g.left, h.left)) : Math.max(c.x, 90 ===
d ? g.right : Math.max(g.right, h.right)), l.x = k.x, l.y = c.y
} else if (c.y < a.y || 180 === d && c.x < a.x && h.top < a.y || 0 === d && c.x > a.x && h.top < a.y) k = new G(a.x, c.y), l = new G((a.x + c.x) / 2, c.y), 90 === d ? (k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0), l.x = c.x, l.y = k.y) : 180 === d && c.x < a.x || 0 === d && c.x >= a.x ? (k.y = a.y > h.bottom ? this.computeMidOrthoPosition(a.x, a.y, c.x, h.bottom, !0) : a.y > h.top && (180 === d && a.x < h.left || 0 === d && a.x > h.right) ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0) : h.top, l.x = c.x, l.y = k.y) : 270 === d && a.y > h.bottom && a.x >
h.left && a.x < h.right && (k.x = a.x < c.x ? Math.min(c.x, h.left) : Math.max(c.x, h.right), k.y = a.y, l.x = k.x); else {
k = new G(c.x, a.y);
l = new G(c.x, (a.y + c.y) / 2);
if (90 === d || 0 === d && c.x < g.left || 180 === d && c.x > g.right) 90 === d && (h.da(a) || g.da(c)) ? k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1) : c.x < a.x && (90 === d || 0 === d) ? k.x = this.computeMidOrthoPosition(g.left, a.y, Math.max(c.x, h.right), c.y, !1) : c.x > a.x && (90 === d || 180 === d) && (k.x = this.computeMidOrthoPosition(g.right, a.y, Math.min(c.x, h.left), c.y, !1)), l.x = k.x, l.y = c.y;
if (k.x > g.left &&
k.x < g.right) if (c.y <= g.bottom && c.y >= a.y || a.y >= h.top && a.y <= c.y) {
if (0 === d || 180 === d) k = new G(a.x, Math.min((a.y + c.y) / 2, a.y)), l = new G(c.x, k.y)
} else k.x = 180 === d || (90 === d || 270 === d) && c.x < a.x ? Math.min(c.x, 270 === d ? g.left : Math.min(g.left, h.left)) : Math.max(c.x, 270 === d ? g.right : Math.max(g.right, h.right)), l.x = k.x, l.y = c.y
}
var m = k, n = l, p = c;
if (this.isAvoiding) {
var r = this.diagram;
if (null === r || !Xj(r) || g.da(p) && !f.Vd(e) || h.da(a) && !e.Vd(f) || e === f || this.layer.isTemporary) b = !1; else {
var q = Yj(r, !0, this.containingGroup, null);
if (q.gk(Math.min(a.x, m.x), Math.min(a.y, m.y), Math.abs(a.x - m.x), Math.abs(a.y - m.y)) && q.gk(Math.min(m.x, n.x), Math.min(m.y, n.y), Math.abs(m.x - n.x), Math.abs(m.y - n.y)) && q.gk(Math.min(n.x, p.x), Math.min(n.y, p.y), Math.abs(n.x - p.x), Math.abs(n.y - p.y))) b = !1; else {
e = a;
f = p;
var u = c = null;
if (r.isVirtualized) {
r = q.bounds.copy();
r.Uc(-q.Vl, -q.Ul);
var v = G.alloc();
$o(q, a.x, a.y) || (H.Tc(r.x, r.y, r.x + r.width, r.y + r.height, a.x, a.y, m.x, m.y, v) ? (c = a = v.copy(), b = v.Wa(m)) : H.Tc(r.x, r.y, r.x + r.width, r.y + r.height, m.x, m.y, n.x, n.y, v) ? (c = a =
v.copy(), b = v.Wa(n)) : H.Tc(r.x, r.y, r.x + r.width, r.y + r.height, n.x, n.y, p.x, p.y, v) && (c = a = v.copy(), b = v.Wa(p)));
$o(q, p.x, p.y) || (H.Tc(r.x, r.y, r.x + r.width, r.y + r.height, p.x, p.y, n.x, n.y, v) ? (u = p = v.copy(), d = n.Wa(v)) : H.Tc(r.x, r.y, r.x + r.width, r.y + r.height, n.x, n.y, m.x, m.y, v) ? (u = p = v.copy(), d = m.Wa(v)) : H.Tc(r.x, r.y, r.x + r.width, r.y + r.height, m.x, m.y, a.x, a.y, v) && (u = p = v.copy(), d = a.Wa(v)));
G.free(v)
}
g = g.copy().Jc(h);
h = q.Sz;
g.Uc(q.Vl * h, q.Ul * h);
ap(q, a, b, p, d, g);
h = bp(q, p.x, p.y);
!q.abort && h >= cp && (bk(q), h = q.vz, g.Uc(q.Vl * h, q.Ul *
h), ap(q, a, b, p, d, g), h = bp(q, p.x, p.y));
!q.abort && h >= cp && q.Yz && (bk(q), ap(q, a, b, p, d, q.bounds), h = bp(q, p.x, p.y));
if (!q.abort && h < cp && bp(q, p.x, p.y) !== dp) {
ep(this, q, p.x, p.y, d, !0);
g = this.i(2);
if (4 > this.pointsCount) 0 === b || 180 === b ? (g.x = a.x, g.y = p.y) : (g.x = p.x, g.y = a.y), this.M(2, g.x, g.y), this.m(3, g.x, g.y); else if (p = this.i(3), 0 === b || 180 === b) H.w(g.x, p.x) ? (g = 0 === b ? Math.max(g.x, a.x) : Math.min(g.x, a.x), this.M(2, g, a.y), this.M(3, g, p.y)) : H.w(g.y, p.y) ? (Math.abs(a.y - g.y) <= q.Ul / 2 && (this.M(2, g.x, a.y), this.M(3, p.x, a.y)), this.m(2,
g.x, a.y)) : this.M(2, a.x, g.y); else if (90 === b || 270 === b) H.w(g.y, p.y) ? (g = 90 === b ? Math.max(g.y, a.y) : Math.min(g.y, a.y), this.M(2, a.x, g), this.M(3, p.x, g)) : H.w(g.x, p.x) ? (Math.abs(a.x - g.x) <= q.Vl / 2 && (this.M(2, a.x, g.y), this.M(3, a.x, p.y)), this.m(2, a.x, g.y)) : this.M(2, g.x, a.y);
null !== c && (a = this.i(1), p = this.i(2), a.x !== p.x && a.y !== p.y ? 0 === b || 180 === b ? this.m(2, a.x, p.y) : this.m(2, p.x, a.y) : 0 === b || 180 === b ? this.m(2, e.x, c.y) : this.m(2, c.x, e.y));
null !== u && (0 === d || 180 === d ? this.lf(f.x, u.y) : this.lf(u.x, f.y));
b = !0
} else b = !1
}
}
} else b =
!1;
b || (this.ze(k), this.ze(l))
}
};
R.prototype.computeMidOrthoPosition = function (a, b, c, d, e) {
var f = 0;
this.hasCurviness() && (f = this.computeCurviness());
return e ? (b + d) / 2 + f : (a + c) / 2 + f
};
function xj(a) {
if (null === a.diagram || !a.isAvoiding || !Xj(a.diagram)) return !1;
var b = a.points.j, c = b.length;
if (4 > c) return !1;
a = Yj(a.diagram, !0, a.containingGroup, null);
for (var d = 1; d < c - 2; d++) {
var e = b[d], f = b[d + 1];
if (!a.gk(Math.min(e.x, f.x), Math.min(e.y, f.y), Math.abs(e.x - f.x), Math.abs(e.y - f.y))) return !0
}
return !1
}
function ep(a, b, c, d, e, f) {
var g = b.Vl, h = b.Ul, k = bp(b, c, d), l = c, m = d;
for (0 === e ? l += g : 90 === e ? m += h : 180 === e ? l -= g : m -= h; k > fp && bp(b, l, m) === k - 1;) c = l, d = m, 0 === e ? l += g : 90 === e ? m += h : 180 === e ? l -= g : m -= h, --k;
if (f) {
if (k > fp) if (180 === e || 0 === e) c = Math.floor(c / g) * g + g / 2; else if (90 === e || 270 === e) d = Math.floor(d / h) * h + h / 2
} else c = Math.floor(c / g) * g + g / 2, d = Math.floor(d / h) * h + h / 2;
k > fp && (f = e, l = c, m = d, 0 === e ? (f = 90, m += h) : 90 === e ? (f = 180, l -= g) : 180 === e ? (f = 270, m -= h) : 270 === e && (f = 0, l += g), bp(b, l, m) === k - 1 ? ep(a, b, l, m, f, !1) : (l = c, m = d, 0 === e ? (f = 270, m -= h) : 90 ===
e ? (f = 0, l += g) : 180 === e ? (f = 90, m += h) : 270 === e && (f = 180, l -= g), bp(b, l, m) === k - 1 && ep(a, b, l, m, f, !1)));
a.lf(c, d)
}
R.prototype.Fy = function (a) {
var b = a.x;
a = a.y;
for (var c = this.i(0), d = this.i(1), e = Ab(b, a, c.x, c.y, d.x, d.y), f = 0, g = 1; g < this.pointsCount - 1; g++) {
c = this.i(g + 1);
var h = Ab(b, a, d.x, d.y, c.x, c.y);
d = c;
h < e && (f = g, e = h)
}
return f
};
R.prototype.ac = function () {
this.Qn = !0
};
R.prototype.ik = function (a) {
if (!a) {
if (!1 === this.Lc) return;
a = this.zb();
if (!this.Qn && (null === a || null !== a.geometry)) return
}
this.qa = this.makeGeometry();
a = this.path;
if (null !== a) {
a.qa = this.qa;
for (var b = this.Y.j, c = b.length, d = 0; d < c; d++) {
var e = b[d];
e !== a && e.isPanelMain && e instanceof W && (e.qa = this.qa)
}
}
};
R.prototype.makeGeometry = function () {
var a = this.qa, b = this.pointsCount;
if (2 > b) return a.type = xd, this.Qn = !1, a;
var c = !1, d = this.diagram;
null !== d && Po(this) && d.Yh.contains(this) && (0 !== this.yl.width || 0 !== this.yl.height) && (c = !0);
var e = this.i(0).copy(), f = e.copy();
d = this.xb.j;
var g = this.computeCurve();
if (g === tg && 3 <= b && !H.ca(this.smoothness, 0)) if (3 === b) {
var h = this.i(1);
d = Math.min(e.x, h.x);
var k = Math.min(e.y, h.y);
h = this.i(2);
d = Math.min(d, h.x);
k = Math.min(k, h.y)
} else {
if (this.isOrthogonal) for (k = 0; k < b; k++) h = d[k], f.x =
Math.min(h.x, f.x), f.y = Math.min(h.y, f.y); else for (d = 3; d < b; d += 3) d + 3 >= b && (d = b - 1), k = this.i(d), f.x = Math.min(k.x, f.x), f.y = Math.min(k.y, f.y);
d = f.x;
k = f.y
} else {
for (k = 0; k < b; k++) h = d[k], f.x = Math.min(h.x, f.x), f.y = Math.min(h.y, f.y);
d = f.x;
k = f.y
}
d -= this.Au.x;
k -= this.Au.y;
e.x -= d;
e.y -= k;
if (2 !== b || Po(this)) {
a.type = vd;
h = Kd(a);
0 !== this.computeShortLength(!0) && (e = gp(this, e, !0, f));
Ld(h, e.x, e.y, !1);
if (g === tg && 3 <= b && !H.ca(this.smoothness, 0)) if (3 === b) c = this.i(1), b = c.x - d, c = c.y - k, e = this.i(2).copy(), e.x -= d, e.y -= k, 0 !== this.computeShortLength(!1) &&
(e = gp(this, e, !1, f)), Qd(h, b, c, b, c, e.x, e.y); else if (this.isOrthogonal) {
f = new G(d, k);
e = this.i(1).copy();
g = new G(d, k);
b = new G(d, k);
c = this.i(0);
for (var l, m = this.smoothness / 3, n = 1; n < this.pointsCount - 1; n++) {
l = this.i(n);
var p = c, r = l, q = this.i(hp(this, l, n, !1));
if (!H.ca(p.x, r.x) || !H.ca(r.x, q.x)) if (!H.ca(p.y, r.y) || !H.ca(r.y, q.y)) {
var u = m;
isNaN(u) && (u = this.smoothness / 3);
var v = p.x;
p = p.y;
var w = r.x;
r = r.y;
var z = q.x;
q = q.y;
var y = u * ip(v, p, w, r);
u *= ip(w, r, z, q);
H.ca(p, r) && H.ca(w, z) && (w > v ? q > r ? (g.x = w - y, g.y = r - y, b.x = w + u, b.y =
r + u) : (g.x = w - y, g.y = r + y, b.x = w + u, b.y = r - u) : q > r ? (g.x = w + y, g.y = r - y, b.x = w - u, b.y = r + u) : (g.x = w + y, g.y = r + y, b.x = w - u, b.y = r - u));
H.ca(v, w) && H.ca(r, q) && (r > p ? (z > w ? (g.x = w - y, g.y = r - y, b.x = w + u) : (g.x = w + y, g.y = r - y, b.x = w - u), b.y = r + u) : (z > w ? (g.x = w - y, g.y = r + y, b.x = w + u) : (g.x = w + y, g.y = r + y, b.x = w - u), b.y = r - u));
if (H.ca(v, w) && H.ca(w, z) || H.ca(p, r) && H.ca(r, q)) v = .5 * (v + z), p = .5 * (p + q), g.x = v, g.y = p, b.x = v, b.y = p;
1 === n ? (e.x = .5 * (c.x + l.x), e.y = .5 * (c.y + l.y)) : 2 === n && H.ca(c.x, this.i(0).x) && H.ca(c.y, this.i(0).y) && (e.x = .5 * (c.x + l.x), e.y = .5 * (c.y + l.y));
Qd(h, e.x -
d, e.y - k, g.x - d, g.y - k, l.x - d, l.y - k);
f.set(g);
e.set(b);
c = l
}
}
f = c.x;
c = c.y;
e = this.i(this.pointsCount - 1);
0 !== this.computeShortLength(!1) && (e = gp(this, e.copy(), !1, Fb));
f = .5 * (f + e.x);
c = .5 * (c + e.y);
Qd(h, b.x - d, b.y - k, f - d, c - k, e.x - d, e.y - k)
} else for (c = 3; c < b; c += 3) f = this.i(c - 2), c + 3 >= b && (c = b - 1), e = this.i(c - 1), g = this.i(c), c === b - 1 && 0 !== this.computeShortLength(!1) && (g = gp(this, g.copy(), !1, Fb)), Qd(h, f.x - d, f.y - k, e.x - d, e.y - k, g.x - d, g.y - k); else {
f = G.alloc();
f.assign(this.i(0));
g = 1;
for (e = 0; g < b;) {
g = hp(this, f, g, 1 < g);
m = this.i(g);
if (g >=
b - 1) {
if (!f.A(m)) 0 !== this.computeShortLength(!1) && (m = gp(this, m.copy(), !1, Fb)), jp(this, h, -d, -k, f, m, c); else if (0 === e) for (g = 1; g < b;) m = this.i(g++), jp(this, h, -d, -k, f, m, c), f.assign(m);
break
}
e = hp(this, m, g + 1, g < b - 3);
g = -d;
l = -k;
n = this.i(e);
v = c;
H.w(f.y, m.y) && H.w(m.x, n.x) ? (p = this.computeCorner(), p = Math.min(p, Math.abs(m.x - f.x) / 2), p = u = Math.min(p, Math.abs(n.y - m.y) / 2), H.w(p, 0) ? (jp(this, h, g, l, f, m, v), f.assign(m)) : (w = m.x, r = m.y, z = w, q = r, m.x > f.x ? w = m.x - p : w = m.x + p, n.y > m.y ? q = m.y + u : q = m.y - u, jp(this, h, g, l, f, new G(w, r), v), Rd(h, m.x +
g, m.y + l, z + g, q + l), f.h(z, q))) : H.w(f.x, m.x) && H.w(m.y, n.y) ? (p = this.computeCorner(), p = Math.min(p, Math.abs(m.y - f.y) / 2), p = u = Math.min(p, Math.abs(n.x - m.x) / 2), H.w(u, 0) ? (jp(this, h, g, l, f, m, v), f.assign(m)) : (w = m.x, r = m.y, z = w, q = r, m.y > f.y ? r = m.y - p : r = m.y + p, n.x > m.x ? z = m.x + u : z = m.x - u, jp(this, h, g, l, f, new G(w, r), v), Rd(h, m.x + g, m.y + l, z + g, q + l), f.h(z, q))) : (jp(this, h, g, l, f, m, v), f.assign(m));
g = e
}
G.free(f)
}
Ud = h
} else h = this.i(1).copy(), h.x -= d, h.y -= k, 0 !== this.computeShortLength(!0) && (e = gp(this, e, !0, f)), 0 !== this.computeShortLength(!1) &&
(h = gp(this, h, !1, f)), a.type = xd, a.startX = e.x, a.startY = e.y, a.endX = h.x, a.endY = h.y;
this.Qn = !1;
return a
};
function ip(a, b, c, d) {
a = c - a;
if (isNaN(a) || Infinity === a || -Infinity === a) return NaN;
0 > a && (a = -a);
b = d - b;
if (isNaN(b) || Infinity === b || -Infinity === b) return NaN;
0 > b && (b = -b);
return H.ca(a, 0) ? b : H.ca(b, 0) ? a : Math.sqrt(a * a + b * b)
}
function gp(a, b, c, d) {
var e = a.pointsCount;
if (2 > e) return b;
if (c) {
var f = a.i(1);
c = f.x - d.x;
f = f.y - d.y;
d = ip(b.x, b.y, c, f);
if (0 === d) return b;
e = 2 === e ? .5 * d : d;
a = a.computeShortLength(!0);
a > e && (a = e);
e = a * (f - b.y) / d;
b.x += a * (c - b.x) / d;
b.y += e
} else {
f = a.i(e - 2);
c = f.x - d.x;
f = f.y - d.y;
d = ip(b.x, b.y, c, f);
if (0 === d) return b;
e = 2 === e ? .5 * d : d;
a = a.computeShortLength(!1);
a > e && (a = e);
e = a * (b.y - f) / d;
b.x -= a * (b.x - c) / d;
b.y -= e
}
return b
}
function hp(a, b, c, d) {
for (var e = a.pointsCount, f = b; H.ca(b.x, f.x) && H.ca(b.y, f.y);) {
if (c >= e) return e - 1;
f = a.i(c++)
}
if (!H.ca(b.x, f.x) && !H.ca(b.y, f.y)) return c - 1;
for (var g = f; H.ca(b.x, f.x) && H.ca(f.x, g.x) && (!d || (b.y >= f.y ? f.y >= g.y : f.y <= g.y)) || H.ca(b.y, f.y) && H.ca(f.y, g.y) && (!d || (b.x >= f.x ? f.x >= g.x : f.x <= g.x));) {
if (c >= e) return e - 1;
g = a.i(c++)
}
return c - 2
}
function jp(a, b, c, d, e, f, g) {
if (!g && Po(a)) {
g = [];
var h = 0;
a.isVisible() && (h = kp(a, e, f, g));
if (0 < h) if (H.w(e.y, f.y)) if (e.x < f.x) for (var k = 0; k < h;) {
var l = Math.max(e.x, Math.min(g[k++] - 5, f.x - 10));
b.lineTo(l + c, f.y + d);
var m = l + c;
for (var n = Math.min(l + 10, f.x); k < h;) if (l = g[k], l < n + 10) k++, n = Math.min(l + 5, f.x); else break;
l = f.y - 10 + d;
n += c;
var p = f.y + d;
a.curve === pg ? Ld(b, n, p, !1) : Qd(b, m, l, n, l, n, p)
} else for (--h; 0 <= h;) {
k = Math.min(e.x, Math.max(g[h--] + 5, f.x + 10));
b.lineTo(k + c, f.y + d);
m = k + c;
for (l = Math.max(k - 10, f.x); 0 <= h;) if (k = g[h], k >
l - 10) h--, l = Math.max(k - 5, f.x); else break;
k = f.y - 10 + d;
l += c;
n = f.y + d;
a.curve === pg ? Ld(b, l, n, !1) : Qd(b, m, k, l, k, l, n)
} else if (H.w(e.x, f.x)) if (e.y < f.y) for (k = 0; k < h;) {
l = Math.max(e.y, Math.min(g[k++] - 5, f.y - 10));
b.lineTo(f.x + c, l + d);
m = l + d;
for (l = Math.min(l + 10, f.y); k < h;) if (n = g[k], n < l + 10) k++, l = Math.min(n + 5, f.y); else break;
n = f.x - 10 + c;
p = f.x + c;
l += d;
a.curve === pg ? Ld(b, p, l, !1) : Qd(b, n, m, n, l, p, l)
} else for (--h; 0 <= h;) {
k = Math.min(e.y, Math.max(g[h--] + 5, f.y + 10));
b.lineTo(f.x + c, k + d);
m = k + d;
for (k = Math.max(k - 10, f.y); 0 <= h;) if (l = g[h],
l > k - 10) h--, k = Math.max(l - 5, f.y); else break;
l = f.x - 10 + c;
n = f.x + c;
k += d;
a.curve === pg ? Ld(b, n, k, !1) : Qd(b, l, m, l, k, n, k)
}
}
b.lineTo(f.x + c, f.y + d)
}
function kp(a, b, c, d) {
var e = a.diagram;
if (null === e || b.A(c)) return 0;
for (e = e.layers; e.next();) {
var f = e.value;
if (null !== f && f.visible) {
f = f.Fa.j;
for (var g = f.length, h = 0; h < g; h++) {
var k = f[h];
if (k instanceof R) {
if (k === a) return 0 < d.length && d.sort(function (a, b) {
return a - b
}), d.length;
if (k.isVisible() && Po(k)) {
var l = k.routeBounds;
l.o() && a.routeBounds.Ic(l) && !a.usesSamePort(k) && (l = k.path, null !== l && l.tf() && lp(b, c, d, k))
}
}
}
}
}
0 < d.length && d.sort(function (a, b) {
return a - b
});
return d.length
}
function lp(a, b, c, d) {
for (var e = H.w(a.y, b.y), f = d.pointsCount, g = d.i(0), h = G.alloc(), k = 1; k < f; k++) {
var l = d.i(k);
if (k < f - 1) {
var m = d.i(k + 1);
if (g.y === l.y && l.y === m.y) {
if (l.x > g.x && m.x >= l.x || l.x < g.x && m.x <= l.x) continue
} else if (g.x === l.x && l.x === m.x && (l.y > g.y && m.y >= l.y || l.y < g.y && m.y <= l.y)) continue
}
a:{
m = a.x;
var n = a.y, p = b.x, r = b.y, q = g.x;
g = g.y;
var u = l.x, v = l.y;
if (!H.w(m, p)) {
if (H.w(n, r) && H.w(q, u) && Math.min(m, p) < q && Math.max(m, p) > q && Math.min(g, v) < n && Math.max(g, v) > n && !H.w(g, v)) {
h.x = q;
h.y = n;
m = !0;
break a
}
} else if (!H.w(n, r) &&
H.w(g, v) && Math.min(n, r) < g && Math.max(n, r) > g && Math.min(q, u) < m && Math.max(q, u) > m && !H.w(q, u)) {
h.x = m;
h.y = g;
m = !0;
break a
}
h.x = 0;
h.y = 0;
m = !1
}
m && (e ? c.push(h.x) : c.push(h.y));
g = l
}
G.free(h)
}
function Po(a) {
a = a.curve;
return a === og || a === pg
}
function To(a, b) {
if (b || Po(a)) b = a.diagram, null === b || b.animationManager.isTicking || b.Yh.contains(a) || 0 === a.yl.width && 0 === a.yl.height || b.Yh.add(a, a.yl.copy())
}
R.prototype.eq = function (a) {
var b = this.layer;
if (null !== b && b.visible && !b.isTemporary) {
var c = b.diagram;
if (null !== c && !c.animationManager.isAnimating) {
var d = !1;
for (c = c.layers; c.next();) {
var e = c.value;
if (e.visible) if (e === b) {
d = !0;
var f = !1;
e = e.Fa.j;
for (var g = e.length, h = 0; h < g; h++) {
var k = e[h];
k instanceof R && (k === this ? f = !0 : f && mp(this, k, a))
}
} else if (d) for (f = e.Fa.j, e = f.length, g = 0; g < e; g++) h = f[g], h instanceof R && mp(this, h, a)
}
}
}
};
function mp(a, b, c) {
if (null !== b && null !== b.qa && Po(b)) {
var d = b.routeBounds;
d.o() && (a.routeBounds.Ic(d) || c.Ic(d)) && (a.usesSamePort(b) || b.ac())
}
}
R.prototype.usesSamePort = function (a) {
var b = this.pointsCount, c = a.pointsCount;
if (0 < b && 0 < c) {
var d = this.i(0), e = a.i(0);
if (d.Qa(e)) return !0;
b = this.i(b - 1);
a = a.i(c - 1);
if (b.Qa(a) || d.Qa(a) || b.Qa(e)) return !0
} else if (this.fromNode === a.fromNode || this.toNode === a.toNode || this.fromNode === a.toNode || this.toNode === a.fromNode) return !0;
return !1
};
R.prototype.isVisible = function () {
if (!S.prototype.isVisible.call(this)) return !1;
var a = this.containingGroup, b = !0, c = this.diagram;
null !== c && (b = c.isTreePathToChildren);
c = this.fromNode;
if (null !== c) {
if (this.isTreeLink && b && !c.isTreeExpanded) return !1;
if (c === a) return !0;
for (var d = c; null !== d;) {
if (d.labeledLink === this) return !0;
d = d.containingGroup
}
c = c.findVisibleNode();
if (null === c || c === a) return !1
}
c = this.toNode;
if (null !== c) {
if (this.isTreeLink && !b && !c.isTreeExpanded) return !1;
if (c === a) return !0;
for (b = c; null !== b;) {
if (b.labeledLink ===
this) return !0;
b = b.containingGroup
}
b = c.findVisibleNode();
if (null === b || b === a) return !1
}
return !0
};
R.prototype.Lb = function (a) {
S.prototype.Lb.call(this, a);
null !== this.Af && this.Af.dm();
if (null !== this.$c) for (var b = this.$c.iterator; b.next();) b.value.Lb(a)
};
function Qo(a) {
var b = a.Pe;
if (null !== b) {
var c = a.gf;
if (null !== c) {
for (var d = a.Qe, e = a.hf, f = a = null, g = b.Ya.j, h = g.length, k = 0; k < h; k++) {
var l = g[k];
if (l.Pe === b && l.Qe === d && l.gf === c && l.hf === e || l.Pe === c && l.Qe === e && l.gf === b && l.hf === d) null === f ? f = l : (null === a && (a = [], a.push(f)), a.push(l))
}
if (null !== a) {
f = vo(b, c, d, e);
null === f && (f = new np(b, d, c, e), uo(b, f), uo(c, f));
f.links = a;
for (b = 0; b < a.length; b++) a[b].Af = f;
f.dm()
}
}
}
}
function Ro(a) {
var b = a.Af;
null !== b && (a.Af = null, a = b.links.indexOf(a), 0 <= a && (Ca(b.links, a), b.dm()))
}
R.prototype.Bh = function () {
return !0
};
ma.Object.defineProperties(R.prototype, {
fromNode: {
get: function () {
return this.Pe
}, set: function (a) {
var b = this.Pe;
if (b !== a) {
var c = this.fromPort;
null !== b && (this.gf !== b && yo(b, this, c), Ro(this), this.B(2));
this.Pe = a;
null !== a && this.Lb(a.isVisible());
this.Jf = null;
this.Ra();
var d = this.diagram;
null !== d && d.partManager.setFromNodeForLink(this, a, b);
var e = this.fromPort, f = this.fromPortChanged;
if (null !== f) {
var g = !0;
null !== d && (g = d.ea, d.ea = !0);
f(this, c, e);
null !== d && (d.ea = g)
}
null !== a && (this.gf !==
a && xo(a, this, e), Qo(this), this.B(1));
this.g("fromNode", b, a);
so(this)
}
}
}, fromPortId: {
get: function () {
return this.Qe
}, set: function (a) {
var b = this.Qe;
if (b !== a) {
var c = this.fromPort;
null !== c && wo(this.fromNode, c);
Ro(this);
this.Qe = a;
var d = this.fromPort;
null !== d && wo(this.fromNode, d);
var e = this.diagram;
if (null !== e) {
var f = this.data, g = e.model;
null !== f && g.fm() && g.Ex(f, a)
}
c !== d && (this.Jf = null, this.Ra(), f = this.fromPortChanged, null !== f && (g = !0, null !== e && (g = e.ea, e.ea = !0), f(this, c, d), null !==
e && (e.ea = g)));
Qo(this);
this.g("fromPortId", b, a)
}
}
}, fromPort: {
get: function () {
var a = this.Pe;
return null === a ? null : a.Ts(this.Qe)
}
}, fromPortChanged: {
get: function () {
return this.Fn
}, set: function (a) {
var b = this.Fn;
b !== a && (this.Fn = a, this.g("fromPortChanged", b, a))
}
}, toNode: {
get: function () {
return this.gf
}, set: function (a) {
var b = this.gf;
if (b !== a) {
var c = this.toPort;
null !== b && (this.Pe !== b && yo(b, this, c), Ro(this), this.B(2));
this.gf =
a;
null !== a && this.Lb(a.isVisible());
this.Jf = null;
this.Ra();
var d = this.diagram;
null !== d && d.partManager.setToNodeForLink(this, a, b);
var e = this.toPort, f = this.toPortChanged;
if (null !== f) {
var g = !0;
null !== d && (g = d.ea, d.ea = !0);
f(this, c, e);
null !== d && (d.ea = g)
}
null !== a && (this.Pe !== a && xo(a, this, e), Qo(this), this.B(1));
this.g("toNode", b, a);
so(this)
}
}
}, toPortId: {
get: function () {
return this.hf
}, set: function (a) {
var b = this.hf;
if (b !== a) {
var c = this.toPort;
null !== c && wo(this.toNode, c);
Ro(this);
this.hf = a;
var d = this.toPort;
null !== d && wo(this.toNode, d);
var e = this.diagram;
if (null !== e) {
var f = this.data, g = e.model;
null !== f && g.fm() && g.Ix(f, a)
}
c !== d && (this.Jf = null, this.Ra(), f = this.toPortChanged, null !== f && (g = !0, null !== e && (g = e.ea, e.ea = !0), f(this, c, d), null !== e && (e.ea = g)));
Qo(this);
this.g("toPortId", b, a)
}
}
}, toPort: {
get: function () {
var a = this.gf;
return null === a ? null : a.Ts(this.hf)
}
}, toPortChanged: {
get: function () {
return this.Ep
}, set: function (a) {
var b =
this.Ep;
b !== a && (this.Ep = a, this.g("toPortChanged", b, a))
}
}, fromSpot: {
get: function () {
return null !== this.P ? this.P.Pg : ad
}, set: function (a) {
this.Hc();
var b = this.P.Pg;
b.A(a) || (a = a.I(), this.P.Pg = a, this.g("fromSpot", b, a), this.Ra())
}
}, fromEndSegmentLength: {
get: function () {
return null !== this.P ? this.P.Ng : NaN
}, set: function (a) {
this.Hc();
var b = this.P.Ng;
b !== a && (0 > a && va(a, ">= 0", R, "fromEndSegmentLength"), this.P.Ng = a, this.g("fromEndSegmentLength", b, a), this.Ra())
}
},
fromShortLength: {
get: function () {
return null !== this.P ? this.P.Og : NaN
}, set: function (a) {
this.Hc();
var b = this.P.Og;
b !== a && (this.P.Og = a, this.g("fromShortLength", b, a), this.Ra(), this.ac())
}
}, toSpot: {
get: function () {
return null !== this.P ? this.P.oh : ad
}, set: function (a) {
this.Hc();
var b = this.P.oh;
b.A(a) || (a = a.I(), this.P.oh = a, this.g("toSpot", b, a), this.Ra())
}
}, toEndSegmentLength: {
get: function () {
return null !== this.P ? this.P.mh :
NaN
}, set: function (a) {
this.Hc();
var b = this.P.mh;
b !== a && (0 > a && va(a, ">= 0", R, "toEndSegmentLength"), this.P.mh = a, this.g("toEndSegmentLength", b, a), this.Ra())
}
}, toShortLength: {
get: function () {
return null !== this.P ? this.P.nh : NaN
}, set: function (a) {
this.Hc();
var b = this.P.nh;
b !== a && (this.P.nh = a, this.g("toShortLength", b, a), this.Ra(), this.ac())
}
}, isLabeledLink: {
get: function () {
return null === this.$c ? !1 : 0 < this.$c.count
}
}, labelNodes: {
get: function () {
return null === this.$c ? gb : this.$c.iterator
}
}, relinkableFrom: {
get: function () {
return 0 !== (this.Ta & 1)
}, set: function (a) {
var b = 0 !== (this.Ta & 1);
b !== a && (this.Ta ^= 1, this.g("relinkableFrom", b, a), this.Jb())
}
}, relinkableTo: {
get: function () {
return 0 !== (this.Ta & 2)
}, set: function (a) {
var b = 0 !== (this.Ta & 2);
b !== a && (this.Ta ^= 2, this.g("relinkableTo", b, a), this.Jb())
}
}, resegmentable: {
get: function () {
return 0 !== (this.Ta &
4)
}, set: function (a) {
var b = 0 !== (this.Ta & 4);
b !== a && (this.Ta ^= 4, this.g("resegmentable", b, a), this.Jb())
}
}, isTreeLink: {
get: function () {
return 0 !== (this.Ta & 8)
}, set: function (a) {
var b = 0 !== (this.Ta & 8);
b !== a && (this.Ta ^= 8, this.g("isTreeLink", b, a), null !== this.fromNode && jk(this.fromNode), null !== this.toNode && jk(this.toNode))
}
}, path: {
get: function () {
var a = this.zb();
return a instanceof W ? a : null
}
}, routeBounds: {
get: function () {
this.$i();
var a = this.yl, b = Infinity, c = Infinity, d = this.pointsCount;
if (0 === d) a.h(NaN, NaN, 0, 0); else {
if (1 === d) d = this.i(0), b = Math.min(d.x, b), c = Math.min(d.y, c), a.h(d.x, d.y, 0, 0); else if (2 === d) {
d = this.i(0);
var e = this.i(1);
b = Math.min(d.x, e.x);
c = Math.min(d.y, e.y);
a.h(d.x, d.y, 0, 0);
a.Je(e)
} else if (this.computeCurve() === tg && 3 <= d && !this.isOrthogonal) if (e = this.i(0), b = e.x, c = e.y, a.h(b, c, 0, 0), 3 === d) {
d = this.i(1);
b = Math.min(d.x, b);
c = Math.min(d.y, c);
var f = this.i(2);
b = Math.min(f.x, b);
c = Math.min(f.y, c);
H.Tl(e.x, e.y, d.x, d.y, d.x, d.y,
f.x, f.y, .5, a)
} else for (f = 3; f < d; f += 3) {
var g = this.i(f - 2);
f + 3 >= d && (f = d - 1);
var h = this.i(f - 1), k = this.i(f);
H.Tl(e.x, e.y, g.x, g.y, h.x, h.y, k.x, k.y, .5, a);
b = Math.min(k.x, b);
c = Math.min(k.y, c);
e = k
} else for (e = this.i(0), f = this.i(1), b = Math.min(e.x, f.x), c = Math.min(e.y, f.y), a.h(e.x, e.y, 0, 0), a.Je(f), e = 2; e < d; e++) f = this.i(e), b = Math.min(f.x, b), c = Math.min(f.y, c), a.Je(f);
this.Au.h(b - a.x, c - a.y)
}
return a
}
}, midPoint: {
get: function () {
this.$i();
return this.computeMidPoint(new G)
}
}, midAngle: {
get: function () {
this.$i();
return this.computeMidAngle()
}
}, flattenedLengths: {
get: function () {
if (null === this.rr) {
this.Lc || So(this);
for (var a = this.rr = [], b = this.pointsCount, c = 0; c < b - 1; c++) {
var d = this.i(c);
var e = this.i(c + 1);
H.ca(d.x, e.x) ? (d = e.y - d.y, 0 > d && (d = -d)) : H.ca(d.y, e.y) ? (d = e.x - d.x, 0 > d && (d = -d)) : d = Math.sqrt(d.Ce(e));
a.push(d)
}
}
return this.rr
}
}, flattenedTotalLength: {
get: function () {
var a = this.au;
if (isNaN(a)) {
for (var b = this.flattenedLengths,
c = b.length, d = a = 0; d < c; d++) a += b[d];
this.au = a
}
return a
}
}, points: {
get: function () {
return this.xb
}, set: function (a) {
var b = this.xb;
if (b !== a) {
var c = null;
if (Array.isArray(a)) {
var d = 0 === a.length % 2;
if (d) for (var e = 0; e < a.length; e++) if ("number" !== typeof a[e] || isNaN(a[e])) {
d = !1;
break
}
if (d) for (c = new E, d = 0; d < a.length / 2; d++) e = (new G(a[2 * d], a[2 * d + 1])).freeze(), c.add(e); else {
d = !0;
for (e = 0; e < a.length; e++) {
var f = a[e];
if (!ya(f) || "number" !== typeof f.x || isNaN(f.x) || "number" !== typeof f.y || isNaN(f.y)) {
d =
!1;
break
}
}
if (d) for (c = new E, d = 0; d < a.length; d++) e = a[d], c.add((new G(e.x, e.y)).freeze())
}
} else if (a instanceof E) for (c = a.copy(), a = c.iterator; a.next();) a.value.freeze(); else B("Link.points value is not an instance of List or Array: " + a);
c.freeze();
this.xb = c;
this.ac();
this.s();
So(this);
a = this.diagram;
null !== a && (a.Ri || a.undoManager.isUndoingRedoing || a.gt.add(this), a.animationManager.rb && (this.dh = c));
this.g("points", b, c)
}
}
}, pointsCount: {
get: function () {
return this.xb.count
}
},
Lc: {
get: function () {
return 0 !== (this.Ta & 16)
}, set: function (a) {
0 !== (this.Ta & 16) !== a && (this.Ta ^= 16)
}
}, suspendsRouting: {
get: function () {
return 0 !== (this.Ta & 32)
}, set: function (a) {
0 !== (this.Ta & 32) !== a && (this.Ta ^= 32)
}
}, Qu: {
get: function () {
return 0 !== (this.Ta & 64)
}, set: function (a) {
0 !== (this.Ta & 64) !== a && (this.Ta ^= 64)
}
}, defaultFromPoint: {
get: function () {
return this.u
}, set: function (a) {
this.u = a.copy()
}
},
defaultToPoint: {
get: function () {
return this.K
}, set: function (a) {
this.K = a.copy()
}
}, isOrthogonal: {
get: function () {
return 2 === (this.Gj.value & 2)
}
}, isAvoiding: {
get: function () {
return 4 === (this.Gj.value & 4)
}
}, geometry: {
get: function () {
this.Qn && (this.$i(), this.qa = this.makeGeometry());
return this.qa
}
}, firstPickIndex: {
get: function () {
return 2 >= this.pointsCount ? 0 : this.isOrthogonal ||
!Uo(this.computeSpot(!0)) ? 1 : 0
}
}, lastPickIndex: {
get: function () {
var a = this.pointsCount;
return 0 === a ? 0 : 2 >= a ? a - 1 : this.isOrthogonal || !Uo(this.computeSpot(!1)) ? a - 2 : a - 1
}
}, adjusting: {
get: function () {
return this.Mm
}, set: function (a) {
var b = this.Mm;
b !== a && (this.Mm = a, this.g("adjusting", b, a))
}
}, corner: {
get: function () {
return this.gn
}, set: function (a) {
var b = this.gn;
b !== a && (this.gn = a, this.ac(), this.g("corner", b, a))
}
}, curve: {
get: function () {
return this.kn
}, set: function (a) {
var b = this.kn;
b !== a && (this.kn = a, this.Ra(), this.ac(), To(this, b === pg || b === og || a === pg || a === og), this.g("curve", b, a))
}
}, curviness: {
get: function () {
return this.ln
}, set: function (a) {
var b = this.ln;
b !== a && (this.ln = a, this.Ra(), this.ac(), this.g("curviness", b, a))
}
}, routing: {
get: function () {
return this.Gj
}, set: function (a) {
var b = this.Gj;
b !== a && (this.Gj = a, this.Jf = null, this.Ra(), To(this, 2 === (b.value &
2) || 2 === (a.value & 2)), this.g("routing", b, a))
}
}, smoothness: {
get: function () {
return this.sp
}, set: function (a) {
var b = this.sp;
b !== a && (this.sp = a, this.ac(), this.g("smoothness", b, a))
}
}, key: {
get: function () {
var a = this.diagram;
if (null !== a && a.model.fm()) return a.model.ic(this.data)
}
}
});
R.prototype.invalidateOtherJumpOvers = R.prototype.eq;
R.prototype.findClosestSegment = R.prototype.Fy;
R.prototype.updateRoute = R.prototype.$i;
R.prototype.invalidateRoute = R.prototype.Ra;
R.prototype.rollbackRoute = R.prototype.zx;
R.prototype.commitRoute = R.prototype.mf;
R.prototype.startRoute = R.prototype.Dh;
R.prototype.clearPoints = R.prototype.Vj;
R.prototype.removePoint = R.prototype.Bv;
R.prototype.addPointAt = R.prototype.lf;
R.prototype.addPoint = R.prototype.ze;
R.prototype.insertPointAt = R.prototype.m;
R.prototype.insertPoint = R.prototype.mz;
R.prototype.setPointAt = R.prototype.M;
R.prototype.setPoint = R.prototype.jd;
R.prototype.getPoint = R.prototype.i;
R.prototype.getOtherPort = R.prototype.bz;
R.prototype.getOtherNode = R.prototype.Xs;
var Jo = new D(R, "Normal", 1), op = new D(R, "Orthogonal", 2), pp = new D(R, "AvoidsNodes", 6),
Zo = new D(R, "AvoidsNodesStraight", 7), qg = new D(R, "None", 0), tg = new D(R, "Bezier", 9),
pg = new D(R, "JumpGap", 10), og = new D(R, "JumpOver", 11), Ko = new D(R, "End", 17),
Lo = new D(R, "Scale", 18), Mo = new D(R, "Stretch", 19), qn = new D(R, "OrientAlong", 21),
rm = new D(R, "OrientPlus90", 22), tm = new D(R, "OrientMinus90", 23), No = new D(R, "OrientOpposite", 24),
Oo = new D(R, "OrientUpright", 25), sm = new D(R, "OrientPlus90Upright", 26),
um = new D(R, "OrientMinus90Upright",
27), vm = new D(R, "OrientUpright45", 28);
R.className = "Link";
R.Normal = Jo;
R.Orthogonal = op;
R.AvoidsNodes = pp;
R.AvoidsNodesStraight = Zo;
R.None = qg;
R.Bezier = tg;
R.JumpGap = pg;
R.JumpOver = og;
R.End = Ko;
R.Scale = Lo;
R.Stretch = Mo;
R.OrientAlong = qn;
R.OrientPlus90 = rm;
R.OrientMinus90 = tm;
R.OrientOpposite = No;
R.OrientUpright = Oo;
R.OrientPlus90Upright = sm;
R.OrientMinus90Upright = um;
R.OrientUpright45 = vm;
function np(a, b, c, d) {
ab(this);
this.ie = this.Cr = !1;
this.jt = a;
this.vx = b;
this.qv = c;
this.wx = d;
this.links = []
}
np.prototype.dm = function () {
if (!this.Cr) {
var a = this.links;
0 < a.length && (a = a[0].diagram, null !== a && (a.yw.add(this), this.ie = a.undoManager.isUndoingRedoing))
}
this.Cr = !0
};
np.prototype.$v = function () {
if (this.Cr) {
this.Cr = !1;
var a = this.links;
if (0 < a.length) {
var b = a[0], c = b.diagram;
c = null === c || c.Ri && !this.ie;
this.ie = !1;
b.arrangeBundledLinks(a, c);
1 === a.length && (b.Af = null, a.length = 0)
}
0 === a.length && (a = this.jt, null !== this && null !== a.Me && a.Me.remove(this), a = this.qv, null !== this && null !== a.Me && a.Me.remove(this))
}
};
np.className = "LinkBundle";
function Zj() {
ab(this);
this.Jx = this.group = null;
this.at = !0;
this.abort = !1;
this.Kd = this.Jd = 1;
this.mo = this.lo = -1;
this.lc = this.kc = 8;
this.Bb = [[]];
this.Oj = this.Nj = 0;
this.Yz = !1;
this.Sz = 22;
this.vz = 111
}
Zj.prototype.initialize = function (a) {
if (!(0 >= a.width || 0 >= a.height)) {
var b = a.y, c = a.x + a.width, d = a.y + a.height;
this.Jd = Math.floor((a.x - this.kc) / this.kc) * this.kc;
this.Kd = Math.floor((b - this.lc) / this.lc) * this.lc;
this.lo = Math.ceil((c + 2 * this.kc) / this.kc) * this.kc;
this.mo = Math.ceil((d + 2 * this.lc) / this.lc) * this.lc;
a = 1 + (Math.ceil((this.lo - this.Jd) / this.kc) | 0);
b = 1 + (Math.ceil((this.mo - this.Kd) / this.lc) | 0);
if (null === this.Bb || this.Nj < a - 1 || this.Oj < b - 1) {
c = [];
for (d = 0; d <= a; d++) c[d] = [];
this.Bb = c;
this.Nj = a - 1;
this.Oj = b - 1
}
a =
qp;
if (null !== this.Bb) for (b = 0; b <= this.Nj; b++) for (c = 0; c <= this.Oj; c++) this.Bb[b][c] = a
}
};
function $o(a, b, c) {
return a.Jd <= b && b <= a.lo && a.Kd <= c && c <= a.mo
}
function bp(a, b, c) {
if (!$o(a, b, c)) return qp;
b -= a.Jd;
b /= a.kc;
c -= a.Kd;
c /= a.lc;
return a.Bb[b | 0][c | 0]
}
function ck(a, b, c) {
$o(a, b, c) && (b -= a.Jd, b /= a.kc, c -= a.Kd, c /= a.lc, a.Bb[b | 0][c | 0] = dp)
}
function bk(a) {
if (null !== a.Bb) for (var b = 0; b <= a.Nj; b++) for (var c = 0; c <= a.Oj; c++) a.Bb[b][c] >= fp && (a.Bb[b][c] = qp)
}
Zj.prototype.gk = function (a, b, c, d) {
if (a > this.lo || a + c < this.Jd || b > this.mo || b + d < this.Kd) return !0;
a = (a - this.Jd) / this.kc | 0;
b = (b - this.Kd) / this.lc | 0;
c = Math.max(0, c) / this.kc + 1 | 0;
var e = Math.max(0, d) / this.lc + 1 | 0;
0 > a && (c += a, a = 0);
0 > b && (e += b, b = 0);
if (0 > c || 0 > e) return !0;
d = Math.min(a + c - 1, this.Nj) | 0;
for (c = Math.min(b + e - 1, this.Oj) | 0; a <= d; a++) for (e = b; e <= c; e++) if (this.Bb[a][e] === dp) return !1;
return !0
};
function rp(a, b, c, d, e, f, g, h, k) {
if (!(b < f || b > g || c < h || c > k)) {
var l = b | 0;
var m = c | 0;
var n = a.Bb[l][m];
if (n >= fp && n < cp) for (e ? m += d : l += d, n += 1; f <= l && l <= g && h <= m && m <= k && !(n >= a.Bb[l][m]);) a.Bb[l][m] = n, n += 1, e ? m += d : l += d;
l = e ? m : l;
if (e) if (0 < d) for (c += d; c < l; c += d) rp(a, b, c, 1, !e, f, g, h, k), rp(a, b, c, -1, !e, f, g, h, k); else for (c += d; c > l; c += d) rp(a, b, c, 1, !e, f, g, h, k), rp(a, b, c, -1, !e, f, g, h, k); else if (0 < d) for (b += d; b < l; b += d) rp(a, b, c, 1, !e, f, g, h, k), rp(a, b, c, -1, !e, f, g, h, k); else for (b += d; b > l; b += d) rp(a, b, c, 1, !e, f, g, h, k), rp(a, b, c, -1, !e, f, g, h,
k)
}
}
function sp(a, b, c, d, e, f, g, h, k) {
b |= 0;
c |= 0;
var l = dp, m = fp;
for (a.Bb[b][c] = m; l === dp && b > f && b < g && c > h && c < k;) m += 1, a.Bb[b][c] = m, e ? c += d : b += d, l = a.Bb[b][c]
}
function tp(a, b, c, d, e, f, g, h, k) {
b |= 0;
c |= 0;
var l = dp, m = cp;
for (a.Bb[b][c] = m; l === dp && b > f && b < g && c > h && c < k;) a.Bb[b][c] = m, e ? c += d : b += d, l = a.Bb[b][c]
}
function ap(a, b, c, d, e, f) {
if (null !== a.Bb) {
a.abort = !1;
var g = b.x, h = b.y;
if ($o(a, g, h) && (g -= a.Jd, g /= a.kc, h -= a.Kd, h /= a.lc, b = d.x, d = d.y, $o(a, b, d))) if (b -= a.Jd, b /= a.kc, d -= a.Kd, d /= a.lc, 1 >= Math.abs(g - b) && 1 >= Math.abs(h - d)) a.abort = !0; else {
var k = f.x, l = f.y, m = f.x + f.width, n = f.y + f.height;
k -= a.Jd;
k /= a.kc;
l -= a.Kd;
l /= a.lc;
m -= a.Jd;
m /= a.kc;
n -= a.Kd;
n /= a.lc;
f = Math.max(0, Math.min(a.Nj, k | 0));
m = Math.min(a.Nj, Math.max(0, m | 0));
l = Math.max(0, Math.min(a.Oj, l | 0));
n = Math.min(a.Oj, Math.max(0, n | 0));
g |= 0;
h |= 0;
b |= 0;
d |= 0;
k = 0 === c || 90 === c ?
1 : -1;
c = 90 === c || 270 === c;
a.Bb[g][h] === dp ? (sp(a, g, h, k, c, f, m, l, n), sp(a, g, h, 1, !c, f, m, l, n), sp(a, g, h, -1, !c, f, m, l, n)) : sp(a, g, h, k, c, g, h, g, h);
a.Bb[b][d] === dp ? (tp(a, b, d, 0 === e || 90 === e ? 1 : -1, 90 === e || 270 === e, f, m, l, n), tp(a, b, d, 1, !(90 === e || 270 === e), f, m, l, n), tp(a, b, d, -1, !(90 === e || 270 === e), f, m, l, n)) : tp(a, b, d, k, c, b, d, b, d);
a.abort || (rp(a, g, h, 1, !1, f, m, l, n), rp(a, g, h, -1, !1, f, m, l, n), rp(a, g, h, 1, !0, f, m, l, n), rp(a, g, h, -1, !0, f, m, l, n))
}
}
}
ma.Object.defineProperties(Zj.prototype, {
bounds: {
get: function () {
return new N(this.Jd, this.Kd, this.lo - this.Jd, this.mo - this.Kd)
}
}, Vl: {
get: function () {
return this.kc
}, set: function (a) {
0 < a && a !== this.kc && (this.kc = a, this.initialize(this.bounds))
}
}, Ul: {
get: function () {
return this.lc
}, set: function (a) {
0 < a && a !== this.lc && (this.lc = a, this.initialize(this.bounds))
}
}
});
var dp = 0, fp = 1, cp = 999999, qp = cp + 1;
Zj.className = "PositionArray";
function Xo() {
ab(this);
this.port = this.node = null;
this.Wd = [];
this.jq = !1
}
Xo.prototype.toString = function () {
for (var a = this.Wd, b = this.node.toString() + " " + a.length.toString() + ":", c = 0; c < a.length; c++) {
var d = a[c];
null !== d && (b += "\n " + d.toString())
}
return b
};
function up(a, b, c, d) {
b = b.offsetY;
switch (b) {
case 8:
return 90;
case 2:
return 180;
case 1:
return 270;
case 4:
return 0
}
switch (b) {
case 9:
return 180 < c ? 270 : 90;
case 6:
return 90 < c && 270 >= c ? 180 : 0
}
a = 180 * Math.atan2(a.height, a.width) / Math.PI;
switch (b) {
case 3:
return c > a && c <= 180 + a ? 180 : 270;
case 5:
return c > 180 - a && c <= 360 - a ? 270 : 0;
case 12:
return c > a && c <= 180 + a ? 90 : 0;
case 10:
return c > 180 - a && c <= 360 - a ? 180 : 90;
case 7:
return 90 < c && c <= 180 + a ? 180 : c > 180 + a && c <= 360 - a ? 270 : 0;
case 13:
return 180 < c && c <= 360 - a ? 270 : c > a && 180 >= c ? 90 : 0;
case 14:
return c >
a && c <= 180 - a ? 90 : c > 180 - a && 270 >= c ? 180 : 0;
case 11:
return c > 180 - a && c <= 180 + a ? 180 : c > 180 + a ? 270 : 90
}
d && 15 !== b && (c -= 15, 0 > c && (c += 360));
return c > a && c < 180 - a ? 90 : c >= 180 - a && c <= 180 + a ? 180 : c > 180 + a && c < 360 - a ? 270 : 0
}
Xo.prototype.dm = function () {
this.Wd.length = 0
};
function Yo(a, b) {
var c = a.Wd;
if (0 === c.length) {
a:if (!a.jq) {
c = a.jq;
a.jq = !0;
var d = null, e = a.node;
e = e instanceof U ? e : null;
if (null === e || e.isSubGraphExpanded) var f = a.node.Yu(a.port.portId); else {
if (!e.actualBounds.o()) {
a.jq = c;
break a
}
d = e;
f = d.Xu()
}
var g = a.Wd.length = 0, h = a.port.ma(zc, G.alloc()), k = a.port.ma(Jc, G.alloc());
e = N.allocAt(h.x, h.y, 0, 0);
e.Je(k);
G.free(h);
G.free(k);
h = G.allocAt(e.x + e.width / 2, e.y + e.height / 2);
k = a.port.Mi();
for (f = f.iterator; f.next();) {
var l = f.value;
if (l.isVisible() && l.fromPort !== l.toPort) {
var m =
l.fromPort === a.port || null !== l.fromNode && l.fromNode.Vd(d),
n = l.computeSpot(m, a.port);
if (n.sf() && (m = m ? l.toPort : l.fromPort, null !== m)) {
var p = m.part;
if (null !== p) {
var r = p.findVisibleNode();
null !== r && r !== p && (p = r, m = p.port);
m = l.computeOtherPoint(p, m);
p = h.Wa(m);
p -= k;
0 > p && (p += 360);
n = up(e, n, p, l.isOrthogonal);
0 === n ? (n = 4, 180 < p && (p -= 360)) : n = 90 === n ? 8 : 180 === n ? 2 : 1;
r = a.Wd[g];
void 0 === r ? (r = new vp(l, p, n), a.Wd[g] = r) : (r.link = l, r.angle = p, r.yc = n);
r.uv.set(m);
g++
}
}
}
}
G.free(h);
a.Wd.sort(Xo.prototype.l);
k = a.Wd.length;
d = -1;
for (g =
h = 0; g < k; g++) f = a.Wd[g], void 0 !== f && (f.yc !== d && (d = f.yc, h = 0), f.aq = h, h++);
d = -1;
h = 0;
for (g = k - 1; 0 <= g; g--) k = a.Wd[g], void 0 !== k && (k.yc !== d && (d = k.yc, h = k.aq + 1), k.Xl = h);
g = a.Wd;
n = a.port;
d = a.node.portSpreading;
h = G.alloc();
k = G.alloc();
f = G.alloc();
l = G.alloc();
n.ma(zc, h);
n.ma(Dc, k);
n.ma(Jc, f);
n.ma(Hc, l);
r = p = m = n = 0;
if (d === Go) for (var q = 0; q < g.length; q++) {
var u = g[q];
if (null !== u) {
var v = u.link.computeThickness();
switch (u.yc) {
case 8:
p += v;
break;
case 2:
r += v;
break;
case 1:
n += v;
break;
default:
case 4:
m += v
}
}
}
var w = q = 0, z = 1, y = u = 0;
for (v = 0; v < g.length; v++) {
var A = g[v];
if (null !== A) {
if (q !== A.yc) {
q = A.yc;
switch (q) {
case 8:
var C = f;
w = l;
break;
case 2:
C = l;
w = h;
break;
case 1:
C = h;
w = k;
break;
default:
case 4:
C = k, w = f
}
u = w.x - C.x;
y = w.y - C.y;
switch (q) {
case 8:
p > Math.abs(u) ? (z = Math.abs(u) / p, p = Math.abs(u)) : z = 1;
break;
case 2:
r > Math.abs(y) ? (z = Math.abs(y) / r, r = Math.abs(y)) : z = 1;
break;
case 1:
n > Math.abs(u) ? (z = Math.abs(u) / n, n = Math.abs(u)) : z = 1;
break;
default:
case 4:
m > Math.abs(y) ? (z = Math.abs(y) / m, m = Math.abs(y)) : z = 1
}
w = 0
}
var I = A.hq;
if (d === Go) {
A = A.link.computeThickness();
A *= z;
I.set(C);
switch (q) {
case 8:
I.x = C.x + u / 2 + p / 2 - w - A / 2;
break;
case 2:
I.y = C.y + y / 2 + r / 2 - w - A / 2;
break;
case 1:
I.x = C.x + u / 2 - n / 2 + w + A / 2;
break;
default:
case 4:
I.y = C.y + y / 2 - m / 2 + w + A / 2
}
w += A
} else {
var K = .5;
d === to && (K = (A.aq + 1) / (A.Xl + 1));
I.x = C.x + u * K;
I.y = C.y + y * K
}
}
}
G.free(h);
G.free(k);
G.free(f);
G.free(l);
C = a.Wd;
for (g = 0; g < C.length; g++) d = C[g], null !== d && (d.Vu = a.computeEndSegmentLength(d));
a.jq = c;
N.free(e)
}
c = a.Wd
}
for (a = 0; a < c.length; a++) if (e = c[a], null !== e && e.link === b) return e;
return null
}
Xo.prototype.l = function (a, b) {
return a === b ? 0 : null === a ? -1 : null === b ? 1 : a.yc < b.yc ? -1 : a.yc > b.yc ? 1 : a.angle < b.angle ? -1 : a.angle > b.angle ? 1 : 0
};
Xo.prototype.computeEndSegmentLength = function (a) {
var b = a.link, c = b.computeEndSegmentLength(this.node, this.port, yc, b.fromPort === this.port), d = a.aq;
if (0 > d) return c;
var e = a.Xl;
if (1 >= e || !b.isOrthogonal) return c;
b = a.uv;
var f = a.hq;
if (2 === a.yc || 8 === a.yc) d = e - 1 - d;
return ((a = 2 === a.yc || 4 === a.yc) ? b.y < f.y : b.x < f.x) ? c + 8 * d : (a ? b.y === f.y : b.x === f.x) ? c : c + 8 * (e - 1 - d)
};
Xo.className = "Knot";
function vp(a, b, c) {
this.link = a;
this.angle = b;
this.yc = c;
this.uv = new G;
this.Xl = this.aq = 0;
this.hq = new G;
this.Vu = 0
}
vp.prototype.toString = function () {
return this.link.toString() + " " + this.angle.toString() + " " + this.yc.toString() + ":" + this.aq.toString() + "/" + this.Xl.toString() + " " + this.hq.toString() + " " + this.Vu.toString() + " " + this.uv.toString()
};
vp.className = "LinkInfo";
function Ik() {
this.oh = this.Pg = ad;
this.nh = this.Og = this.mh = this.Ng = NaN;
this.Cp = this.Dn = null;
this.Dp = this.En = Infinity
}
Ik.prototype.copy = function () {
var a = new Ik;
a.Pg = this.Pg.I();
a.oh = this.oh.I();
a.Ng = this.Ng;
a.mh = this.mh;
a.Og = this.Og;
a.nh = this.nh;
a.Dn = this.Dn;
a.Cp = this.Cp;
a.En = this.En;
a.Dp = this.Dp;
return a
};
Ik.className = "LinkSettings";
function gi() {
ab(this);
this.K = this.C = null;
this.Of = this.Sn = !0;
this.Yn = !1;
this.Qm = (new G(0, 0)).freeze();
this.Vn = !0;
this.Un = null;
this.sw = "";
this.u = null;
this.Xn = !1;
this.l = null
}
gi.prototype.cloneProtected = function (a) {
a.Sn = this.Sn;
a.Of = this.Of;
a.Yn = this.Yn;
a.Qm.assign(this.Qm);
a.Vn = this.Vn;
a.Un = this.Un;
a.sw = this.sw;
a.Xn = !0
};
gi.prototype.copy = function () {
var a = new this.constructor;
this.cloneProtected(a);
return a
};
gi.prototype.fb = function () {
};
gi.prototype.toString = function () {
var a = Ha(this.constructor);
a += "(";
null !== this.group && (a += " in " + this.group);
null !== this.diagram && (a += " for " + this.diagram);
return a + ")"
};
gi.prototype.B = function () {
if (this.isValidLayout) {
var a = this.diagram;
if (null !== a && !a.undoManager.isUndoingRedoing) {
var b = a.animationManager;
!b.isTicking && (b.isAnimating && b.vd(), this.isOngoing && a.Ri || this.isInitial && !a.Ri) && (this.isValidLayout = !1, a.cc())
}
}
};
gi.prototype.createNetwork = function () {
return new wp(this)
};
gi.prototype.makeNetwork = function (a) {
var b = this.createNetwork();
a instanceof P ? (b.og(a.nodes, !0), b.og(a.links, !0)) : a instanceof U ? b.og(a.memberParts) : b.og(a.iterator);
return b
};
gi.prototype.updateParts = function () {
var a = this.diagram;
if (null === a && null !== this.network) for (var b = this.network.vertexes.iterator; b.next();) {
var c = b.value.node;
if (null !== c && (a = c.diagram, null !== a)) break
}
this.isValidLayout = !0;
try {
null !== a && a.Aa("Layout"), this.commitLayout()
} finally {
null !== a && a.Za("Layout")
}
};
gi.prototype.commitLayout = function () {
if (null !== this.network) {
for (var a = this.network.vertexes.iterator; a.next();) a.value.commit();
if (this.isRouting) for (a = this.network.edges.iterator; a.next();) a.value.commit()
}
};
gi.prototype.doLayout = function (a) {
var b = new F;
a instanceof P ? (xp(this, b, a.nodes, !0, this.pk, !0, !1, !0), xp(this, b, a.parts, !0, this.pk, !0, !1, !0)) : a instanceof U ? xp(this, b, a.memberParts, !1, this.pk, !0, !1, !0) : b.addAll(a.iterator);
var c = b.count;
if (0 < c) {
a = this.diagram;
null !== a && a.Aa("Layout");
c = Math.ceil(Math.sqrt(c));
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
var d = this.arrangementOrigin.x, e = d, f = this.arrangementOrigin.y, g = 0, h = 0;
for (b = b.iterator; b.next();) {
var k = b.value;
yp(k);
var l = k.measuredBounds,
m = l.width;
l = l.height;
k.moveTo(e, f);
k instanceof U && (k.pk = !1);
e += Math.max(m, 50) + 20;
h = Math.max(h, Math.max(l, 50));
g >= c - 1 ? (g = 0, e = d, f += h + 20, h = 0) : g++
}
null !== a && a.Za("Layout")
}
this.isValidLayout = !0
};
gi.prototype.pk = function (a) {
return !a.location.o() || a instanceof U && a.pk ? !0 : !1
};
function xp(a, b, c, d, e, f, g, h) {
for (c = c.iterator; c.next();) {
var k = c.value;
d && !k.isTopLevel || null !== e && !e(k) || !k.canLayout() || (f && k instanceof V ? k.isLinkLabel || (k instanceof U ? null === k.layout ? xp(a, b, k.memberParts, !1, e, f, g, h) : (yp(k), b.add(k)) : (yp(k), b.add(k))) : g && k instanceof R ? b.add(k) : !h || !k.bc() || k instanceof V || (yp(k), b.add(k)))
}
}
function yp(a) {
var b = a.actualBounds;
(0 === b.width || 0 === b.height || isNaN(b.width) || isNaN(b.height)) && a.$b()
}
gi.prototype.Oi = function (a, b) {
var c = this.boundsComputation;
if (null !== c) return b || (b = new N), c(a, this, b);
if (!b) return a.actualBounds;
b.set(a.actualBounds);
return b
};
gi.prototype.Vw = function (a) {
var b = new F;
a instanceof P ? (xp(this, b, a.nodes, !0, null, !0, !0, !0), xp(this, b, a.links, !0, null, !0, !0, !0), xp(this, b, a.parts, !0, null, !0, !0, !0)) : a instanceof U ? xp(this, b, a.memberParts, !1, null, !0, !0, !0) : xp(this, b, a.iterator, !1, null, !0, !0, !0);
return b
};
gi.prototype.initialOrigin = function (a) {
var b = this.group;
if (null !== b) {
var c = b.position.copy();
(isNaN(c.x) || isNaN(c.y)) && c.set(a);
b = b.placeholder;
null !== b && (c = b.ma(zc), (isNaN(c.x) || isNaN(c.y)) && c.set(a), a = b.padding, c.x += a.left, c.y += a.top);
return c
}
return a
};
ma.Object.defineProperties(gi.prototype, {
diagram: {
get: function () {
return this.C
}, set: function (a) {
this.C = a
}
}, group: {
get: function () {
return this.K
}, set: function (a) {
this.K !== a && (this.K = a, null !== a && (this.C = a.diagram))
}
}, isOngoing: {
get: function () {
return this.Sn
}, set: function (a) {
this.Sn !== a && (this.Sn = a)
}
}, isInitial: {
get: function () {
return this.Of
}, set: function (a) {
this.Of = a;
a || (this.Xn = !0)
}
},
isViewportSized: {
get: function () {
return this.Yn
}, set: function (a) {
this.Yn !== a && (this.Yn = a) && this.B()
}
}, isRouting: {
get: function () {
return this.Vn
}, set: function (a) {
this.Vn !== a && (this.Vn = a)
}
}, isRealtime: {
get: function () {
return this.Un
}, set: function (a) {
this.Un !== a && (this.Un = a)
}
}, isValidLayout: {
get: function () {
return this.Xn
}, set: function (a) {
this.Xn !== a && (this.Xn = a, a || (a = this.diagram, null !==
a && (a.Dg = !0)))
}
}, network: {
get: function () {
return this.l
}, set: function (a) {
this.l !== a && (this.l = a, null !== a && (a.layout = this))
}
}, boundsComputation: {
get: function () {
return this.u
}, set: function (a) {
this.u !== a && (this.u = a, this.B())
}
}, arrangementOrigin: {
get: function () {
return this.Qm
}, set: function (a) {
this.Qm.A(a) || (this.Qm.assign(a), this.B())
}
}
});
gi.prototype.collectParts = gi.prototype.Vw;
gi.prototype.getLayoutBounds = gi.prototype.Oi;
gi.prototype.invalidateLayout = gi.prototype.B;
gi.className = "Layout";
function wp(a) {
ab(this);
this.gc = a;
this.jf = new F;
this.ee = new F;
this.kt = new vb;
this.ft = new vb
}
wp.prototype.clear = function () {
if (this.jf) for (var a = this.jf.iterator; a.next();) a.value.clear();
if (this.ee) for (a = this.ee.iterator; a.next();) a.value.clear();
this.jf = new F;
this.ee = new F;
this.kt = new vb;
this.ft = new vb
};
wp.prototype.toString = function (a) {
void 0 === a && (a = 0);
var b = "LayoutNetwork" + (null !== this.layout ? "(" + this.layout.toString() + ")" : "");
if (0 >= a) return b;
b += " vertexes: " + this.jf.count + " edges: " + this.ee.count;
if (1 < a) {
for (var c = this.jf.iterator; c.next();) b += "\n " + c.value.toString(a - 1);
for (c = this.ee.iterator; c.next();) b += "\n " + c.value.toString(a - 1)
}
return b
};
wp.prototype.createVertex = function () {
return new zp(this)
};
wp.prototype.createEdge = function () {
return new Ap(this)
};
wp.prototype.og = function (a, b, c) {
if (null !== a) {
void 0 === b && (b = !1);
void 0 === c && (c = null);
null === c && (c = function (a) {
if (a instanceof V) return !a.isLinkLabel;
if (a instanceof R) {
var b = a.fromNode;
if (null === b || b.isLinkLabel) return !1;
a = a.toNode;
return null === a || a.isLinkLabel ? !1 : !0
}
return !1
});
for (a = a.iterator; a.next();) {
var d = a.value;
if (d instanceof V && (!b || d.isTopLevel) && d.canLayout() && c(d)) if (d instanceof U && null === d.layout) this.og(d.memberParts, !1); else if (null === this.Li(d)) {
var e = this.createVertex();
e.node =
d;
this.uh(e)
}
}
for (a.reset(); a.next();) if (d = a.value, d instanceof R && (!b || d.isTopLevel) && d.canLayout() && c(d) && null === this.Vp(d)) {
var f = d.fromNode;
e = d.toNode;
null !== f && null !== e && f !== e && (f = this.findGroupVertex(f), e = this.findGroupVertex(e), null !== f && null !== e && this.hk(f, e, d))
}
}
};
wp.prototype.findGroupVertex = function (a) {
if (null === a) return null;
var b = a.findVisibleNode();
if (null === b) return null;
a = this.Li(b);
if (null !== a) return a;
for (b = b.containingGroup; null !== b;) {
a = this.Li(b);
if (null !== a) return a;
b = b.containingGroup
}
return null
};
t = wp.prototype;
t.uh = function (a) {
if (null !== a) {
this.jf.add(a);
var b = a.node;
null !== b && this.kt.add(b, a);
a.network = this
}
};
t.Sl = function (a) {
if (null === a) return null;
var b = this.Li(a);
null === b && (b = this.createVertex(), b.node = a, this.uh(b));
return b
};
t.Uu = function (a) {
if (null !== a && Bp(this, a)) {
for (var b = a.yg, c = b.count - 1; 0 <= c; c--) {
var d = b.N(c);
this.ak(d)
}
b = a.pg;
for (a = b.count - 1; 0 <= a; a--) c = b.N(a), this.ak(c)
}
};
function Bp(a, b) {
if (null === b) return !1;
var c = a.jf.remove(b);
c && a.kt.remove(b.node);
return c
}
t.zy = function (a) {
null !== a && (a = this.Li(a), null !== a && this.Uu(a))
};
t.Li = function (a) {
return null === a ? null : this.kt.J(a)
};
t.Qj = function (a) {
if (null !== a) {
this.ee.add(a);
var b = a.link;
null !== b && null === this.Vp(b) && this.ft.add(b, a);
b = a.toVertex;
null !== b && b.Iu(a);
b = a.fromVertex;
null !== b && b.Gu(a);
a.network = this
}
};
t.ey = function (a) {
if (null === a) return null;
var b = a.fromNode, c = a.toNode, d = this.Vp(a);
null === d ? (d = this.createEdge(), d.link = a, null !== b && (d.fromVertex = this.Sl(b)), null !== c && (d.toVertex = this.Sl(c)), this.Qj(d)) : (null !== b ? d.fromVertex = this.Sl(b) : d.fromVertex = null, null !== c ? d.toVertex = this.Sl(c) : d.toVertex = null);
return d
};
t.ak = function (a) {
if (null !== a) {
var b = a.toVertex;
null !== b && b.Tu(a);
b = a.fromVertex;
null !== b && b.Su(a);
Cp(this, a)
}
};
function Cp(a, b) {
null !== b && a.ee.remove(b) && a.ft.remove(b.link)
}
t.yy = function (a) {
null !== a && (a = this.Vp(a), null !== a && this.ak(a))
};
t.Vp = function (a) {
return null === a ? null : this.ft.J(a)
};
t.hk = function (a, b, c) {
if (null === a || null === b) return null;
if (a.network === this && b.network === this) {
var d = this.createEdge();
d.link = c;
d.fromVertex = a;
d.toVertex = b;
this.Qj(d);
return d
}
return null
};
t.tm = function (a) {
if (null !== a) {
var b = a.fromVertex, c = a.toVertex;
null !== b && null !== c && (b.Su(a), c.Tu(a), a.tm(), b.Iu(a), c.Gu(a))
}
};
t.Tp = function () {
for (var a = Da(), b = this.ee.iterator; b.next();) {
var c = b.value;
c.fromVertex === c.toVertex && a.push(c)
}
b = a.length;
for (c = 0; c < b; c++) this.ak(a[c]);
Ga(a)
};
wp.prototype.deleteArtificialVertexes = function () {
for (var a = Da(), b = this.jf.iterator; b.next();) {
var c = b.value;
null === c.node && a.push(c)
}
c = a.length;
for (b = 0; b < c; b++) this.Uu(a[b]);
b = Da();
for (c = this.ee.iterator; c.next();) {
var d = c.value;
null === d.link && b.push(d)
}
c = b.length;
for (d = 0; d < c; d++) this.ak(b[d]);
Ga(a);
Ga(b)
};
function Dp(a) {
for (var b = Da(), c = a.ee.iterator; c.next();) {
var d = c.value;
null !== d.fromVertex && null !== d.toVertex || b.push(d)
}
c = b.length;
for (d = 0; d < c; d++) a.ak(b[d]);
Ga(b)
}
wp.prototype.Kx = function (a) {
void 0 === a && (a = !0);
a && (this.deleteArtificialVertexes(), Dp(this), this.Tp());
a = new E;
for (var b = !0; b;) {
b = !1;
for (var c = this.jf.iterator; c.next();) {
var d = c.value;
if (0 < d.yg.count || 0 < d.pg.count) {
b = this.layout.createNetwork();
a.add(b);
Ep(this, b, d);
b = !0;
break
}
}
}
a.sort(function (a, b) {
return null === a || null === b || a === b ? 0 : b.vertexes.count - a.vertexes.count
});
return a
};
function Ep(a, b, c) {
if (null !== c && c.network !== b) {
Bp(a, c);
b.uh(c);
for (var d = c.sourceEdges; d.next();) {
var e = d.value;
e.network !== b && (Cp(a, e), b.Qj(e), Ep(a, b, e.fromVertex))
}
for (d = c.destinationEdges; d.next();) c = d.value, c.network !== b && (Cp(a, c), b.Qj(c), Ep(a, b, c.toVertex))
}
}
wp.prototype.Ey = function () {
for (var a = new F, b = this.jf.iterator; b.next();) a.add(b.value.node);
for (b = this.ee.iterator; b.next();) a.add(b.value.link);
return a
};
ma.Object.defineProperties(wp.prototype, {
layout: {
get: function () {
return this.gc
}, set: function (a) {
null !== a && (this.gc = a)
}
}, vertexes: {
get: function () {
return this.jf
}
}, edges: {
get: function () {
return this.ee
}
}
});
wp.prototype.findAllParts = wp.prototype.Ey;
wp.prototype.splitIntoSubNetworks = wp.prototype.Kx;
wp.prototype.deleteSelfEdges = wp.prototype.Tp;
wp.prototype.reverseEdge = wp.prototype.tm;
wp.prototype.linkVertexes = wp.prototype.hk;
wp.prototype.findEdge = wp.prototype.Vp;
wp.prototype.deleteLink = wp.prototype.yy;
wp.prototype.deleteEdge = wp.prototype.ak;
wp.prototype.addLink = wp.prototype.ey;
wp.prototype.addEdge = wp.prototype.Qj;
wp.prototype.findVertex = wp.prototype.Li;
wp.prototype.deleteNode = wp.prototype.zy;
wp.prototype.deleteVertex = wp.prototype.Uu;
wp.prototype.addNode = wp.prototype.Sl;
wp.prototype.addVertex = wp.prototype.uh;
wp.prototype.addParts = wp.prototype.og;
wp.className = "LayoutNetwork";
function zp(a) {
ab(this);
this.Vc = a;
this.l = (new N(0, 0, 10, 10)).freeze();
this.u = (new G(5, 5)).freeze();
this.mi = this.jb = null;
this.yg = new E;
this.pg = new E
}
zp.prototype.clear = function () {
this.mi = this.jb = null;
this.yg = new E;
this.pg = new E
};
zp.prototype.toString = function (a) {
void 0 === a && (a = 0);
var b = "LayoutVertex#" + lb(this);
if (0 < a && (b += null !== this.node ? "(" + this.node.toString() + ")" : "", 1 < a)) {
a = "";
for (var c = !0, d = this.yg.iterator; d.next();) {
var e = d.value;
c ? c = !1 : a += ",";
a += e.toString(0)
}
e = "";
c = !0;
for (d = this.pg.iterator; d.next();) {
var f = d.value;
c ? c = !1 : e += ",";
e += f.toString(0)
}
b += " sources: " + a + " destinations: " + e
}
return b
};
zp.prototype.commit = function () {
var a = this.jb;
if (null !== a) {
var b = this.bounds, c = a.bounds;
ya(c) ? (c.x = b.x, c.y = b.y, c.width = b.width, c.height = b.height) : a.bounds = b.copy()
} else if (a = this.node, null !== a) {
b = this.bounds;
if (!(a instanceof U)) {
c = N.alloc();
var d = this.network.layout.Oi(a, c), e = a.locationObject.ma(Fc);
if (d.o() && e.o()) {
a.moveTo(b.x + this.focusX - (e.x - d.x), b.y + this.focusY - (e.y - d.y));
N.free(c);
return
}
N.free(c)
}
a.moveTo(b.x, b.y)
}
};
zp.prototype.Iu = function (a) {
null !== a && (this.yg.contains(a) || this.yg.add(a))
};
zp.prototype.Tu = function (a) {
null !== a && this.yg.remove(a)
};
zp.prototype.Gu = function (a) {
null !== a && (this.pg.contains(a) || this.pg.add(a))
};
zp.prototype.Su = function (a) {
null !== a && this.pg.remove(a)
};
function Fp(a, b) {
a = a.mi;
b = b.mi;
return a ? b ? (a = a.text, b = b.text, a < b ? -1 : a > b ? 1 : 0) : 1 : null !== b ? -1 : 0
}
ma.Object.defineProperties(zp.prototype, {
sourceEdgesArrayAccess: {
get: function () {
return this.yg._dataArray
}
}, destinationEdgesArrayAccess: {
get: function () {
return this.pg._dataArray
}
}, data: {
get: function () {
return this.jb
}, set: function (a) {
this.jb = a;
if (null !== a) {
var b = a.bounds;
a = b.x;
var c = b.y, d = b.width;
b = b.height;
this.u.h(d / 2, b / 2);
this.l.h(a, c, d, b)
}
}
}, node: {
get: function () {
return this.mi
},
set: function (a) {
if (this.mi !== a) {
this.mi = a;
a.$b();
var b = this.network.layout, c = N.alloc(), d = b.Oi(a, c);
b = d.x;
var e = d.y, f = d.width;
d = d.height;
isNaN(b) && (b = 0);
isNaN(e) && (e = 0);
this.l.h(b, e, f, d);
N.free(c);
if (!(a instanceof U) && (a = a.locationObject.ma(Fc), a.o())) {
this.u.h(a.x - b, a.y - e);
return
}
this.u.h(f / 2, d / 2)
}
}
}, bounds: {
get: function () {
return this.l
}, set: function (a) {
this.l.A(a) || this.l.assign(a)
}
}, focus: {
get: function () {
return this.u
}, set: function (a) {
this.u.A(a) ||
this.u.assign(a)
}
}, centerX: {
get: function () {
return this.l.x + this.u.x
}, set: function (a) {
var b = this.l;
b.x + this.u.x !== a && (b.ha(), b.x = a - this.u.x, b.freeze())
}
}, centerY: {
get: function () {
return this.l.y + this.u.y
}, set: function (a) {
var b = this.l;
b.y + this.u.y !== a && (b.ha(), b.y = a - this.u.y, b.freeze())
}
}, focusX: {
get: function () {
return this.u.x
}, set: function (a) {
var b = this.u;
b.x !== a && (b.ha(), b.x = a, b.freeze())
}
}, focusY: {
get: function () {
return this.u.y
}, set: function (a) {
var b = this.u;
b.y !== a && (b.ha(), b.y = a, b.freeze())
}
}, x: {
get: function () {
return this.l.x
}, set: function (a) {
var b = this.l;
b.x !== a && (b.ha(), b.x = a, b.freeze())
}
}, y: {
get: function () {
return this.l.y
}, set: function (a) {
var b = this.l;
b.y !== a && (b.ha(), b.y = a, b.freeze())
}
}, width: {
get: function () {
return this.l.width
}, set: function (a) {
var b = this.l;
b.width !== a && (b.ha(), b.width =
a, b.freeze())
}
}, height: {
get: function () {
return this.l.height
}, set: function (a) {
var b = this.l;
b.height !== a && (b.ha(), b.height = a, b.freeze())
}
}, network: {
get: function () {
return this.Vc
}, set: function (a) {
this.Vc = a
}
}, sourceVertexes: {
get: function () {
for (var a = new F, b = this.sourceEdges; b.next();) a.add(b.value.fromVertex);
return a.iterator
}
}, destinationVertexes: {
get: function () {
for (var a = new F, b =
this.destinationEdges; b.next();) a.add(b.value.toVertex);
return a.iterator
}
}, vertexes: {
get: function () {
for (var a = new F, b = this.sourceEdges; b.next();) a.add(b.value.fromVertex);
for (b = this.destinationEdges; b.next();) a.add(b.value.toVertex);
return a.iterator
}
}, sourceEdges: {
get: function () {
return this.yg.iterator
}
}, destinationEdges: {
get: function () {
return this.pg.iterator
}
}, edges: {
get: function () {
for (var a =
new E, b = this.sourceEdges; b.next();) a.add(b.value);
for (b = this.destinationEdges; b.next();) a.add(b.value);
return a.iterator
}
}, edgesCount: {
get: function () {
return this.yg.count + this.pg.count
}
}
});
zp.prototype.deleteDestinationEdge = zp.prototype.Su;
zp.prototype.addDestinationEdge = zp.prototype.Gu;
zp.prototype.deleteSourceEdge = zp.prototype.Tu;
zp.prototype.addSourceEdge = zp.prototype.Iu;
zp.className = "LayoutVertex";
zp.standardComparer = Fp;
zp.smartComparer = function (a, b) {
if (null !== a) {
if (null !== b) {
a = a.mi;
var c = b.mi;
if (null !== a) {
if (null !== c) {
b = a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
a = c.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
for (c = 0; c < b.length; c++) if ("" !== a[c] && void 0 !== a[c]) {
var d = parseFloat(b[c]), e = parseFloat(a[c]);
if (isNaN(d)) if (isNaN(e)) {
if (0 !== b[c].localeCompare(a[c])) return b[c].localeCompare(a[c])
} else return 1; else {
if (isNaN(e)) return -1;
if (0 !== d - e) return d -
e
}
} else if ("" !== b[c]) return 1;
return "" !== a[c] && void 0 !== a[c] ? -1 : 0
}
return 1
}
return null !== c ? -1 : 0
}
return 1
}
return null !== b ? -1 : 0
};
function Ap(a) {
ab(this);
this.Vb = a;
this.jg = this.Lf = this.nl = this.jb = null
}
Ap.prototype.clear = function () {
this.jg = this.Lf = this.nl = this.jb = null
};
Ap.prototype.toString = function (a) {
void 0 === a && (a = 0);
var b = "LayoutEdge#" + lb(this);
0 < a && (b += null !== this.nl ? "(" + this.nl.toString() + ")" : "", 1 < a && (b += " " + (this.Lf ? this.Lf.toString() : "null") + " --\x3e " + (this.jg ? this.jg.toString() : "null")));
return b
};
Ap.prototype.tm = function () {
var a = this.Lf;
this.Lf = this.jg;
this.jg = a
};
Ap.prototype.commit = function () {
};
Ap.prototype.lx = function (a) {
return this.jg === a ? this.Lf : this.Lf === a ? this.jg : null
};
ma.Object.defineProperties(Ap.prototype, {
network: {
get: function () {
return this.Vb
}, set: function (a) {
this.Vb = a
}
}, data: {
get: function () {
return this.jb
}, set: function (a) {
this.jb !== a && (this.jb = a)
}
}, link: {
get: function () {
return this.nl
}, set: function (a) {
this.nl !== a && (this.nl = a)
}
}, fromVertex: {
get: function () {
return this.Lf
}, set: function (a) {
this.Lf !== a && (this.Lf = a)
}
}, toVertex: {
get: function () {
return this.jg
}, set: function (a) {
this.jg !== a && (this.jg = a)
}
}
});
Ap.prototype.getOtherVertex = Ap.prototype.lx;
Ap.className = "LayoutEdge";
function qk() {
gi.call(this);
this.isViewportSized = !0;
this.Jp = this.Kp = NaN;
this.Fg = (new M(NaN, NaN)).freeze();
this.af = (new M(10, 10)).freeze();
this.wb = Gp;
this.Ab = Hp;
this.Qc = Ip;
this.Mc = Jp
}
la(qk, gi);
qk.prototype.cloneProtected = function (a) {
gi.prototype.cloneProtected.call(this, a);
a.Kp = this.Kp;
a.Jp = this.Jp;
a.Fg.assign(this.Fg);
a.af.assign(this.af);
a.wb = this.wb;
a.Ab = this.Ab;
a.Qc = this.Qc;
a.Mc = this.Mc
};
qk.prototype.fb = function (a) {
a.classType === qk ? a === Ip || a === Kp || a === Lp || a === Mp ? this.sorting = a : a === Hp || a === Np ? this.arrangement = a : a === Gp || a === Op ? this.alignment = a : B("Unknown enum value: " + a) : gi.prototype.fb.call(this, a)
};
qk.prototype.doLayout = function (a) {
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
var b = this.Vw(a);
a = this.diagram;
for (var c = b.copy().iterator; c.next();) {
var d = c.value;
if (!d.Bh() || null === d.fromNode && null === d.toNode) {
if (d.$b(), d instanceof U) for (d = d.memberParts; d.next();) b.remove(d.value)
} else b.remove(d)
}
var e = b.Na();
if (0 !== e.length) {
switch (this.sorting) {
case Mp:
e.reverse();
break;
case Ip:
e.sort(this.comparer);
break;
case Kp:
e.sort(this.comparer), e.reverse()
}
var f = this.wrappingColumn;
isNaN(f) && (f = 0);
var g = this.wrappingWidth;
isNaN(g) && null !== a ? (b = a.padding, g = Math.max(a.viewportBounds.width - b.left - b.right, 0)) : g = Math.max(this.wrappingWidth, 0);
0 >= f && 0 >= g && (f = 1);
b = this.spacing.width;
isFinite(b) || (b = 0);
c = this.spacing.height;
isFinite(c) || (c = 0);
null !== a && a.Aa("Layout");
d = [];
switch (this.alignment) {
case Op:
var h = b, k = c, l = N.alloc(), m = Math.max(this.cellSize.width, 1);
if (!isFinite(m)) for (var n = m = 0; n < e.length; n++) {
var p = this.Oi(e[n], l);
m = Math.max(m, p.width)
}
m = Math.max(m + h, 1);
n = Math.max(this.cellSize.height,
1);
if (!isFinite(n)) for (p = n = 0; p < e.length; p++) {
var r = this.Oi(e[p], l);
n = Math.max(n, r.height)
}
n = Math.max(n + k, 1);
p = this.arrangement;
for (var q = r = this.arrangementOrigin.x, u = this.arrangementOrigin.y, v = 0, w = 0, z = 0; z < e.length; z++) {
var y = e[z], A = this.Oi(y, l), C = Math.ceil((A.width + h) / m) * m,
I = Math.ceil((A.height + k) / n) * n;
switch (p) {
case Np:
var K = Math.abs(q - A.width);
break;
default:
K = q + A.width
}
if (0 < f && v > f - 1 || 0 < g && 0 < v && K - r > g) d.push(new N(0, u, g + h, w)), v = 0, q = r, u += w, w = 0;
w = Math.max(w, I);
switch (p) {
case Np:
A = -A.width;
break;
default:
A =
0
}
y.moveTo(q + A, u);
switch (p) {
case Np:
q -= C;
break;
default:
q += C
}
v++
}
d.push(new N(0, u, g + h, w));
N.free(l);
break;
case Gp:
k = g;
m = f;
n = b;
p = c;
g = N.alloc();
r = Math.max(this.cellSize.width, 1);
f = u = l = 0;
h = G.alloc();
for (q = 0; q < e.length; q++) w = e[q], v = this.Oi(w, g), w = w.qf(w.locationObject, w.locationSpot, h), l = Math.max(l, w.x), u = Math.max(u, v.width - w.x), f = Math.max(f, w.y);
q = this.arrangement;
switch (q) {
case Np:
l += n;
break;
default:
u += n
}
r = isFinite(r) ? Math.max(r + n, 1) : Math.max(l + u, 1);
var J = w = this.arrangementOrigin.x;
z = this.arrangementOrigin.y;
u = 0;
k >= l && (k -= l);
l = y = 0;
C = Math.max(this.cellSize.height, 1);
A = f = 0;
I = !0;
v = G.alloc();
for (K = 0; K < e.length; K++) {
var T = e[K], Q = this.Oi(T, g), ea = T.qf(T.locationObject, T.locationSpot, h);
if (0 < u) switch (q) {
case Np:
J = (J - w - (Q.width - ea.x)) / r;
J = H.ca(Math.round(J), J) ? Math.round(J) : Math.floor(J);
J = J * r + w;
break;
default:
J = (J - w + ea.x) / r, J = H.ca(Math.round(J), J) ? Math.round(J) : Math.ceil(J), J = J * r + w
} else switch (q) {
case Np:
y = J + ea.x + Q.width;
break;
default:
y = J - ea.x
}
switch (q) {
case Np:
var pa = -(J + ea.x) + y;
break;
default:
pa = J + Q.width - ea.x -
y
}
if (0 < m && u > m - 1 || 0 < k && 0 < u && pa > k) {
d.push(new N(0, I ? z - f : z, k + n, A + f + p));
for (J = 0; J < u && K !== u; J++) {
pa = e[K - u + J];
var L = pa.qf(pa.locationObject, pa.locationSpot, v);
pa.moveTo(pa.position.x, pa.position.y + f - L.y)
}
A += p;
z = I ? z + A : z + (A + f);
u = A = f = 0;
J = w;
I = !1
}
J === w && (l = q === Np ? Math.max(l, Q.width - ea.x) : Math.min(l, -ea.x));
f = Math.max(f, ea.y);
A = Math.max(A, Q.height - ea.y);
isFinite(C) && (A = Math.max(A, Math.max(Q.height, C) - ea.y));
I ? T.moveTo(J - ea.x, z - ea.y) : T.moveTo(J - ea.x, z);
switch (q) {
case Np:
J -= ea.x + n;
break;
default:
J += Q.width - ea.x +
n
}
u++
}
d.push(new N(0, z, k + n, (I ? A : A + f) + p));
if (e.length !== u) for (k = 0; k < u; k++) m = e[e.length - u + k], n = m.qf(m.locationObject, m.locationSpot, h), m.moveTo(m.position.x, m.position.y + f - n.y);
G.free(h);
G.free(v);
if (q === Np) for (e = 0; e < d.length; e++) f = d[e], f.width += l, f.x -= l; else for (e = 0; e < d.length; e++) f = d[e], f.x > l && (f.width += f.x - l, f.x = l);
N.free(g)
}
for (h = f = g = e = 0; h < d.length; h++) k = d[h], e = Math.min(e, k.x), g = Math.min(g, k.y), f = Math.max(f, k.x + k.width);
this.arrangement === Np ? this.commitLayers(d, new G(e + b / 2 - (f + e), g - c / 2)) : this.commitLayers(d,
new G(e - b / 2, g - c / 2));
null !== a && a.Za("Layout");
this.isValidLayout = !0
}
};
qk.prototype.commitLayers = function () {
};
function Jp(a, b) {
a = a.text;
b = b.text;
return a < b ? -1 : a > b ? 1 : 0
}
ma.Object.defineProperties(qk.prototype, {
wrappingWidth: {
get: function () {
return this.Kp
}, set: function (a) {
this.Kp !== a && (0 < a || isNaN(a)) && (this.Kp = a, this.isViewportSized = isNaN(a), this.B())
}
}, wrappingColumn: {
get: function () {
return this.Jp
}, set: function (a) {
this.Jp !== a && (0 < a || isNaN(a)) && (this.Jp = a, this.B())
}
}, cellSize: {
get: function () {
return this.Fg
}, set: function (a) {
this.Fg.A(a) || (this.Fg.assign(a), this.B())
}
}, spacing: {
get: function () {
return this.af
}, set: function (a) {
this.af.A(a) || (this.af.assign(a), this.B())
}
}, alignment: {
get: function () {
return this.wb
}, set: function (a) {
this.wb === a || a !== Gp && a !== Op || (this.wb = a, this.B())
}
}, arrangement: {
get: function () {
return this.Ab
}, set: function (a) {
this.Ab === a || a !== Hp && a !== Np || (this.Ab = a, this.B())
}
}, sorting: {
get: function () {
return this.Qc
}, set: function (a) {
this.Qc === a || a !== Lp && a !== Mp &&
a !== Ip && a !== Kp || (this.Qc = a, this.B())
}
}, comparer: {
get: function () {
return this.Mc
}, set: function (a) {
this.Mc !== a && (this.Mc = a, this.B())
}
}
});
var Op = new D(qk, "Position", 0), Gp = new D(qk, "Location", 1), Hp = new D(qk, "LeftToRight", 2),
Np = new D(qk, "RightToLeft", 3), Lp = new D(qk, "Forward", 4), Mp = new D(qk, "Reverse", 5),
Ip = new D(qk, "Ascending", 6), Kp = new D(qk, "Descending", 7);
qk.className = "GridLayout";
qk.standardComparer = Jp;
qk.smartComparer = function (a, b) {
if (null !== a) {
if (null !== b) {
a = a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
b = b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
for (var c = 0; c < a.length; c++) if ("" !== b[c] && void 0 !== b[c]) {
var d = parseFloat(a[c]), e = parseFloat(b[c]);
if (isNaN(d)) if (isNaN(e)) {
if (0 !== a[c].localeCompare(b[c])) return a[c].localeCompare(b[c])
} else return 1; else {
if (isNaN(e)) return -1;
if (0 !== d - e) return d - e
}
} else if ("" !== a[c]) return 1;
return "" !==
b[c] && void 0 !== b[c] ? -1 : 0
}
return 1
}
return null !== b ? -1 : 0
};
qk.Position = Op;
qk.Location = Gp;
qk.LeftToRight = Hp;
qk.RightToLeft = Np;
qk.Forward = Lp;
qk.Reverse = Mp;
qk.Ascending = Ip;
qk.Descending = Kp;
function bi() {
this.Fo = new F;
this.ho = new F;
this.Fa = new F;
this.Ne = new vb;
this.Hg = new vb;
this.qj = new vb;
this.C = null;
this.Dq = !1
}
t = bi.prototype;
t.clear = function () {
this.Fo.clear();
this.ho.clear();
this.Fa.clear();
this.Ne.clear();
this.Hg.clear();
this.qj.clear()
};
t.hb = function (a) {
this.C = a
};
t.Qi = function (a) {
if (a instanceof V) {
if (this.Fo.add(a), a instanceof U) {
var b = a.containingGroup;
null === b ? this.C.Ai.add(a) : b.sl.add(a);
b = a.layout;
null !== b && (b.diagram = this.C)
}
} else a instanceof R ? this.ho.add(a) : a instanceof Je || this.Fa.add(a);
b = a.data;
null === b || a instanceof Je || (a instanceof R ? this.Hg.add(b, a) : this.Ne.add(b, a))
};
t.xc = function (a) {
a.Uj();
if (a instanceof V) {
if (this.Fo.remove(a), a instanceof U) {
var b = a.containingGroup;
null === b ? this.C.Ai.remove(a) : b.sl.remove(a);
b = a.layout;
null !== b && (b.diagram = null)
}
} else a instanceof R ? this.ho.remove(a) : a instanceof Je || this.Fa.remove(a);
b = a.data;
null === b || a instanceof Je || (a instanceof R ? this.Hg.remove(b) : this.Ne.remove(b))
};
t.ud = function () {
for (var a = this.C.nodeTemplateMap.iterator; a.next();) {
var b = a.value, c = a.key;
(!b.bc() || b instanceof U) && B('Invalid node template in Diagram.nodeTemplateMap: template for "' + c + '" must be a Node or a simple Part, not a Group or Link: ' + b)
}
for (a = this.C.groupTemplateMap.iterator; a.next();) b = a.value, c = a.key, b instanceof U || B('Invalid group template in Diagram.groupTemplateMap: template for "' + c + '" must be a Group, not a normal Node or Link: ' + b);
for (a = this.C.linkTemplateMap.iterator; a.next();) b =
a.value, c = a.key, b instanceof R || B('Invalid link template in Diagram.linkTemplateMap: template for "' + c + '" must be a Link, not a normal Node or simple Part: ' + b);
a = Da();
for (b = this.C.selection.iterator; b.next();) (c = b.value.data) && a.push(c);
b = Da();
for (c = this.C.highlighteds.iterator; c.next();) {
var d = c.value.data;
d && b.push(d)
}
c = Da();
for (d = this.nodes.iterator; d.next();) {
var e = d.value;
null !== e.data && (c.push(e.data), c.push(e.location))
}
for (d = this.links.iterator; d.next();) e = d.value, null !== e.data && (c.push(e.data),
c.push(e.location));
for (d = this.parts.iterator; d.next();) e = d.value, null !== e.data && (c.push(e.data), c.push(e.location));
this.removeAllModeledParts();
this.addAllModeledParts();
for (d = 0; d < a.length; d++) e = this.vc(a[d]), null !== e && (e.isSelected = !0);
for (d = 0; d < b.length; d++) e = this.vc(b[d]), null !== e && (e.isHighlighted = !0);
for (d = 0; d < c.length; d += 2) e = this.vc(c[d]), null !== e && (e.location = c[d + 1]);
Ga(a);
Ga(b);
Ga(c)
};
bi.prototype.addAllModeledParts = function () {
this.addModeledParts(this.diagram.model.nodeDataArray)
};
bi.prototype.addModeledParts = function (a, b) {
var c = this, d = this.diagram.model;
a.forEach(function (a) {
d.Pb(a) && Pp(c, a, !1)
});
a.forEach(function (a) {
d.Pb(a) && c.resolveReferencesForData(a)
});
!1 !== b && Tj(this.diagram, !1)
};
function Pp(a, b, c) {
if (void 0 !== b && null !== b && !a.diagram.undoManager.isUndoingRedoing && !a.Ne.contains(b)) {
void 0 === c && (c = !0);
a:{
if (void 0 !== b && null !== b && !a.C.undoManager.isUndoingRedoing && !a.Ne.contains(b)) {
var d = a.Vs(b);
var e = ro(a, b, d);
if (null !== e && (Ag(e), e = e.copy(), null !== e)) {
var f = a.diagram.skipsModelSourceBindings;
a.diagram.skipsModelSourceBindings = !0;
e.Bf = d;
e.jb = b;
a.Dq && (e.Ug = "Tool");
a.diagram.add(e);
e.jb = null;
e.data = b;
a.diagram.skipsModelSourceBindings = f;
d = e;
break a
}
}
d = null
}
null !== d && c && a.resolveReferencesForData(b)
}
}
bi.prototype.insertLink = function () {
return null
};
bi.prototype.resolveReferencesForData = function () {
};
bi.prototype.Vs = function (a) {
return this.C.model.Vs(a)
};
function ro(a, b, c) {
a = a.C;
var d = a.model;
d.fk() && d.mv(b) ? (b = a.groupTemplateMap.J(c), null === b && (b = a.groupTemplateMap.J(""), null === b && (Qp || (Qp = !0, wa('No Group template found for category "' + c + '"'), wa(" Using default group template")), b = a.pw))) : (b = a.nodeTemplateMap.J(c), null === b && (b = a.nodeTemplateMap.J(""), null === b && (Rp || (Rp = !0, wa('No Node template found for category "' + c + '"'), wa(" Using default node template")), b = a.rw)));
return b
}
bi.prototype.getLinkCategoryForData = function () {
return ""
};
bi.prototype.setLinkCategoryForData = function () {
};
bi.prototype.setFromNodeForLink = function () {
};
bi.prototype.setToNodeForLink = function () {
};
bi.prototype.findLinkTemplateForCategory = function (a) {
var b = this.C.linkTemplateMap.J(a);
null === b && (b = this.C.linkTemplateMap.J(""), null === b && (Sp || (Sp = !0, wa('No Link template found for category "' + a + '"'), wa(" Using default link template")), b = this.C.qw));
return b
};
bi.prototype.removeAllModeledParts = function () {
this.qt(this.diagram.model.nodeDataArray)
};
bi.prototype.qt = function (a) {
var b = this;
a.forEach(function (a) {
b.qq(a)
})
};
bi.prototype.qq = function (a) {
a = this.vc(a);
null !== a && (sj(this.diagram, a, !1), this.unresolveReferencesForPart(a))
};
bi.prototype.unresolveReferencesForPart = function () {
};
bi.prototype.removeDataForLink = function () {
};
bi.prototype.findPartForKey = function (a) {
if (null === a || void 0 === a) return null;
a = this.C.model.Qb(a);
return null !== a ? this.Ne.J(a) : null
};
t = bi.prototype;
t.Hb = function (a) {
if (null === a || void 0 === a) return null;
a = this.C.model.Qb(a);
if (null === a) return null;
a = this.Ne.J(a);
return a instanceof V ? a : null
};
t.vc = function (a) {
if (null === a) return null;
var b = this.Ne.J(a);
return null !== b ? b : b = this.Hg.J(a)
};
t.Hi = function (a) {
if (null === a) return null;
a = this.Ne.J(a);
return a instanceof V ? a : null
};
t.uc = function (a) {
return null === a ? null : this.Hg.J(a)
};
t.Ss = function (a) {
for (var b = 0; b < arguments.length; ++b) ;
b = new F;
for (var c = this.Fo.iterator; c.next();) {
var d = c.value, e = d.data;
if (null !== e) for (var f = 0; f < arguments.length; f++) {
var g = arguments[f];
if (ya(g) && Tp(this, e, g)) {
b.add(d);
break
}
}
}
return b.iterator
};
t.Rs = function (a) {
for (var b = 0; b < arguments.length; ++b) ;
b = new F;
for (var c = this.ho.iterator; c.next();) {
var d = c.value, e = d.data;
if (null !== e) for (var f = 0; f < arguments.length; f++) {
var g = arguments[f];
if (ya(g) && Tp(this, e, g)) {
b.add(d);
break
}
}
}
return b.iterator
};
function Tp(a, b, c) {
for (var d in c) {
var e = b[d], f = c[d];
if (za(f)) {
if (!za(e) || e.length < f.length) return !1;
for (var g = 0; g < e.length; g++) {
var h = f[g];
if (void 0 !== h && !Up(a, e[g], h)) return !1
}
} else if (!Up(a, e, f)) return !1
}
return !0
}
function Up(a, b, c) {
if ("function" === typeof c) {
if (!c(b)) return !1
} else if (c instanceof RegExp) {
if (!b || !c.test(b.toString())) return !1
} else if (ya(b) && ya(c)) {
if (!Tp(a, b, c)) return !1
} else if (b !== c) return !1;
return !0
}
bi.prototype.doModelChanged = function (a) {
if (this.C) {
var b = this.C;
if (a.model === b.model) {
var c = a.change;
b.doModelChanged(a);
if (b.ea) {
b.ea = !1;
try {
var d = a.modelChange;
if ("" !== d) if (c === re) {
if ("nodeCategory" === d) {
var e = this.vc(a.object), f = a.newValue;
null !== e && "string" === typeof f && (e.category = f)
} else "nodeDataArray" === d && (this.qt(a.oldValue), this.addModeledParts(a.newValue));
b.isModified = !0
} else if (c === te) {
var g = a.newValue;
"nodeDataArray" === d && ya(g) && Pp(this, g);
b.isModified = !0
} else if (c === ue) {
var h = a.oldValue;
"nodeDataArray" === d && ya(h) && this.qq(h);
b.isModified = !0
} else c === se && ("SourceChanged" === d ? null !== a.object ? this.updateDataBindings(a.object, a.propertyName) : (this.xq(), this.updateAllTargetBindings()) : "ModelDisplaced" === d && this.ud()); else if (c === re) {
var k = a.propertyName, l = a.object;
if (l === b.model) {
if ("nodeKeyProperty" === k || "nodeCategoryProperty" === k) b.undoManager.isUndoingRedoing || this.ud()
} else this.updateDataBindings(l, k);
b.isModified = !0
} else if (c === te || c === ue) {
var m = a.change === te, n = m ? a.newParam : a.oldParam,
p = m ? a.newValue : a.oldValue, r = this.qj.J(a.object);
if (Array.isArray(r)) for (a = 0; a < r.length; a++) {
var q = r[a];
if (m) Pm(q, p, n); else if (!(0 > n)) {
var u = n + Im(q);
q.xc(u, !0);
Tm(q, u, n)
}
}
b.isModified = !0
}
} finally {
b.ea = !0
}
}
}
}
};
bi.prototype.updateAllTargetBindings = function (a) {
void 0 === a && (a = "");
for (var b = this.parts.iterator; b.next();) b.value.Ea(a);
for (b = this.nodes.iterator; b.next();) b.value.Ea(a);
for (b = this.links.iterator; b.next();) b.value.Ea(a)
};
bi.prototype.xq = function () {
for (var a = this.C.model, b = new F, c = a.nodeDataArray, d = 0; d < c.length; d++) b.add(c[d]);
var e = [];
this.nodes.each(function (a) {
null === a.data || b.contains(a.data) || e.push(a.data)
});
this.parts.each(function (a) {
null === a.data || b.contains(a.data) || e.push(a.data)
});
e.forEach(function (b) {
Vp(a, b, !1)
});
for (d = 0; d < c.length; d++) {
var f = c[d];
null === this.vc(f) && Wp(a, f, !1)
}
this.refreshDataBoundLinks();
for (c = this.parts.iterator; c.next();) c.value.updateRelationshipsFromData();
for (c = this.nodes.iterator; c.next();) c.value.updateRelationshipsFromData();
for (c = this.links.iterator; c.next();) c.value.updateRelationshipsFromData()
};
bi.prototype.refreshDataBoundLinks = function () {
};
bi.prototype.updateRelationshipsFromData = function () {
};
bi.prototype.updateDataBindings = function (a, b) {
if ("string" === typeof b) {
var c = this.vc(a);
if (null !== c) c.Ea(b); else {
c = null;
for (var d = this.qj.iterator; d.next();) {
for (var e = d.value, f = 0; f < e.length; f++) {
var g = e[f].gx(a);
null !== g && (null === c && (c = Da()), c.push(g))
}
if (null !== c) break
}
if (null !== c) {
for (d = 0; d < c.length; d++) c[d].Ea(b);
Ga(c)
}
}
a === this.diagram.model.modelData && this.updateAllTargetBindings(b)
}
};
function oj(a, b) {
var c = b.gi;
if (za(c)) {
var d = a.qj.J(c);
if (null === d) d = [], d.push(b), a.qj.add(c, d); else {
for (a = 0; a < d.length; a++) if (d[a] === b) return;
d.push(b)
}
}
}
function rj(a, b, c) {
mj(b, function (a) {
a = a.Y.j;
for (var b = a.length, d = 0; d < b; d++) Rj(c, a[d])
});
var d = b.gi;
if (za(d)) {
var e = a.qj.J(d);
if (null !== e) for (var f = 0; f < e.length; f++) if (e[f] === b) {
e.splice(f, 1);
0 === e.length && a.qj.remove(d);
break
}
}
}
bi.prototype.Zj = function (a, b, c) {
var d = new vb;
if (za(a)) for (var e = 0; e < a.length; e++) Xp(this, a[e], b, d, c); else for (a = a.iterator; a.next();) Xp(this, a.value, b, d, c);
if (null !== b) {
c = b.model;
a = b.toolManager.findTool("Dragging");
a = null !== a ? a.dragOptions.dragsLink : b.Nk.dragsLink;
e = new F;
for (var f = new vb, g = d.iterator; g.next();) {
var h = g.value;
if (h instanceof R) a || null !== h.fromNode && null !== h.toNode || e.add(h); else if (h instanceof V && null !== h.data && c.gm()) {
var k = h;
h = g.key;
var l = h.sg();
null !== l && (l = d.J(l), null !== l ? (c.Ie(k.data,
c.pa(l.data)), k = b.uc(k.data), h = h.Ki(), null !== h && null !== k && f.add(h, k)) : c.Ie(k.data, void 0))
}
}
0 < e.count && b.rt(e, !1);
if (0 < f.count) for (c = f.iterator; c.next();) d.add(c.key, c.value)
}
if (null !== b && null !== this.C && (b = b.model, c = b.afterCopyFunction, null !== c)) {
var m = new vb;
d.each(function (a) {
null !== a.key.data && m.add(a.key.data, a.value.data)
});
c(m, b, this.C.model)
}
for (b = d.iterator; b.next();) b.value.Ea();
return d
};
function Xp(a, b, c, d, e) {
if (null === b || e && !b.canCopy()) return null;
if (d.contains(b)) return d.J(b);
var f = a.copyPartData(b, c);
if (!(f instanceof S)) return null;
f.isSelected = !1;
f.isHighlighted = !1;
d.add(b, f);
if (b instanceof V) {
for (var g = b.linksConnected; g.next();) {
var h = g.value;
if (h.fromNode === b) {
var k = d.J(h);
null !== k && (k.fromNode = f)
}
h.toNode === b && (h = d.J(h), null !== h && (h.toNode = f))
}
if (b instanceof U && f instanceof U) for (b = b.memberParts; b.next();) g = Xp(a, b.value, c, d, e), g instanceof R || null === g || (g.containingGroup =
f)
} else if (b instanceof R && f instanceof R) for (g = b.fromNode, null !== g && (g = d.J(g), null !== g && (f.fromNode = g)), g = b.toNode, null !== g && (g = d.J(g), null !== g && (f.toNode = g)), b = b.labelNodes; b.next();) g = Xp(a, b.value, c, d, e), null !== g && g instanceof V && (g.labeledLink = f);
return f
}
bi.prototype.copyPartData = function (a, b) {
var c = null, d = a.data;
if (null !== d && null !== b) {
var e = b.model;
a instanceof R || (d = e.copyNodeData(d), ya(d) && (e.kf(d), c = b.vc(d)))
} else Ag(a), c = a.copy(), null !== c && (e = this.C, null !== b ? b.add(c) : null !== d && null !== e && null !== e.commandHandler && e.commandHandler.copiesClipboardData && (b = e.model, e = null, c instanceof R || (e = b.copyNodeData(d)), ya(e) && (c.data = e)));
return c
};
ma.Object.defineProperties(bi.prototype, {
nodes: {
get: function () {
return this.Fo
}
}, links: {
get: function () {
return this.ho
}
}, parts: {
get: function () {
return this.Fa
}
}, diagram: {
get: function () {
return this.C
}
}, addsToTemporaryLayer: {
get: function () {
return this.Dq
}, set: function (a) {
this.Dq = a
}
}
});
bi.prototype.updateAllRelationshipsFromData = bi.prototype.xq;
bi.prototype.findLinksByExample = bi.prototype.Rs;
bi.prototype.findNodesByExample = bi.prototype.Ss;
bi.prototype.findLinkForData = bi.prototype.uc;
bi.prototype.findNodeForData = bi.prototype.Hi;
bi.prototype.findPartForData = bi.prototype.vc;
bi.prototype.findNodeForKey = bi.prototype.Hb;
bi.prototype.removeModeledPart = bi.prototype.qq;
bi.prototype.removeModeledParts = bi.prototype.qt;
bi.prototype.rebuildParts = bi.prototype.ud;
var Rp = !1, Qp = !1, Sp = !1;
bi.className = "PartManager";
function Yp(a) {
bi.apply(this, arguments)
}
la(Yp, bi);
Yp.prototype.addAllModeledParts = function () {
var a = this.diagram.model;
this.addModeledParts(a.nodeDataArray);
Zp(this, a.linkDataArray)
};
Yp.prototype.addModeledParts = function (a) {
bi.prototype.addModeledParts.call(this, a, !1);
for (a = this.links.iterator; a.next();) so(a.value);
Tj(this.diagram, !1)
};
function Zp(a, b) {
b.forEach(function (b) {
$p(a, b)
});
Tj(a.diagram, !1)
}
function $p(a, b) {
if (void 0 !== b && null !== b && !a.diagram.undoManager.isUndoingRedoing && !a.Hg.contains(b)) {
var c = a.getLinkCategoryForData(b), d = a.findLinkTemplateForCategory(c);
if (null !== d) {
Ag(d);
var e = d.copy();
if (null !== e) {
d = a.diagram.skipsModelSourceBindings;
a.diagram.skipsModelSourceBindings = !0;
e.Bf = c;
e.jb = b;
c = a.diagram.model;
var f = aq(c, b, !0);
"" !== f && (e.fromPortId = f);
f = bq(c, b, !0);
void 0 !== f && (f = a.Hb(f), f instanceof V && (e.fromNode = f));
f = aq(c, b, !1);
"" !== f && (e.toPortId = f);
f = bq(c, b, !1);
void 0 !== f && (f = a.Hb(f),
f instanceof V && (e.toNode = f));
c = c.tg(b);
Array.isArray(c) && c.forEach(function (b) {
b = a.Hb(b);
null !== b && (b.labeledLink = e)
});
a.Dq && (e.Ug = "Tool");
a.diagram.add(e);
e.jb = null;
e.data = b;
a.diagram.skipsModelSourceBindings = d
}
}
}
}
Yp.prototype.removeAllModeledParts = function () {
var a = this.diagram.model;
cq(this, a.linkDataArray);
this.qt(a.nodeDataArray)
};
function cq(a, b) {
b.forEach(function (b) {
a.qq(b)
})
}
Yp.prototype.getLinkCategoryForData = function (a) {
return this.diagram.model.cv(a)
};
Yp.prototype.setLinkCategoryForData = function (a, b) {
return this.diagram.model.tt(a, b)
};
Yp.prototype.setFromNodeForLink = function (a, b) {
var c = this.diagram.model;
c.Cx(a.data, c.pa(null !== b ? b.data : null))
};
Yp.prototype.setToNodeForLink = function (a, b) {
var c = this.diagram.model;
c.Hx(a.data, c.pa(null !== b ? b.data : null))
};
Yp.prototype.removeDataForLink = function (a) {
this.diagram.model.om(a.data)
};
Yp.prototype.findPartForKey = function (a) {
var b = bi.prototype.findPartForKey.call(this, a);
return null === b && (a = this.diagram.model.yh(a), null !== a) ? this.Hg.J(a) : b
};
Yp.prototype.doModelChanged = function (a) {
var b = this;
bi.prototype.doModelChanged.call(this, a);
if (this.diagram) {
var c = this.diagram;
if (a.model === c.model) {
var d = a.change;
if (c.ea) {
c.ea = !1;
try {
var e = a.modelChange;
if ("" !== e) if (d === re) {
if ("linkFromKey" === e) {
var f = this.uc(a.object);
if (null !== f) {
var g = this.Hb(a.newValue);
f.fromNode = g
}
} else if ("linkToKey" === e) {
var h = this.uc(a.object);
if (null !== h) {
var k = this.Hb(a.newValue);
h.toNode = k
}
} else if ("linkFromPortId" === e) {
var l = this.uc(a.object);
if (null !== l) {
var m = a.newValue;
"string" === typeof m && (l.fromPortId = m)
}
} else if ("linkToPortId" === e) {
var n = this.uc(a.object);
if (null !== n) {
var p = a.newValue;
"string" === typeof p && (n.toPortId = p)
}
} else if ("nodeGroupKey" === e) {
var r = this.vc(a.object);
if (null !== r) {
var q = a.newValue;
if (void 0 !== q) {
var u = this.Hb(q);
u instanceof U ? r.containingGroup = u : r.containingGroup = null
} else r.containingGroup = null
}
} else if ("linkLabelKeys" === e) {
var v = this.uc(a.object);
if (null !== v) {
var w = a.oldValue, z = a.newValue;
Array.isArray(w) && w.forEach(function (a) {
a = b.Hb(a);
null !== a && (a.labeledLink = null)
});
Array.isArray(z) && z.forEach(function (a) {
a = b.Hb(a);
null !== a && (a.labeledLink = v)
})
}
} else if ("linkCategory" === e) {
var y = this.uc(a.object), A = a.newValue;
null !== y && "string" === typeof A && (y.category = A)
} else "linkDataArray" === e && (cq(this, a.oldValue), Zp(this, a.newValue));
c.isModified = !0
} else if (d === te) {
var C = a.newValue;
if ("linkDataArray" === e && "object" === typeof C && null !== C) $p(this, C); else if ("linkLabelKeys" === e && dq(C)) {
var I = this.uc(a.object), K = this.Hb(C);
null !== I && null !== K && (K.labeledLink =
I)
}
c.isModified = !0
} else {
if (d === ue) {
var J = a.oldValue;
if ("linkDataArray" === e && "object" === typeof J && null !== J) this.qq(J); else if ("linkLabelKeys" === e && dq(J)) {
var T = this.Hb(J);
null !== T && (T.labeledLink = null)
}
c.isModified = !0
}
} else if (d === re) {
var Q = a.propertyName, ea = a.object;
if (ea === c.model) {
if ("linkFromKeyProperty" === Q || "linkToKeyProperty" === Q || "linkFromPortIdProperty" === Q || "linkToPortIdProperty" === Q || "linkLabelKeysProperty" === Q || "nodeIsGroupProperty" === Q || "nodeGroupKeyProperty" === Q || "linkCategoryProperty" ===
Q) c.undoManager.isUndoingRedoing || this.ud()
} else this.updateDataBindings(ea, Q);
c.isModified = !0
}
} finally {
c.ea = !0
}
}
}
}
};
Yp.prototype.refreshDataBoundLinks = function () {
var a = this, b = this.diagram.model, c = new F, d = b.linkDataArray;
d.forEach(function (a) {
c.add(a)
});
var e = [];
this.links.each(function (a) {
null === a.data || c.contains(a.data) || e.push(a.data)
});
e.forEach(function (a) {
eq(b, a, !1)
});
d.forEach(function (c) {
null === a.uc(c) && fq(b, c, !1)
})
};
Yp.prototype.updateRelationshipsFromData = function (a) {
var b = a.data;
if (null !== b) {
var c = a.diagram;
if (null !== c) {
var d = c.model;
if (a instanceof R) {
var e = bq(d, b, !0);
e = c.Hb(e);
a.fromNode = e;
e = bq(d, b, !1);
e = c.Hb(e);
a.toNode = e;
b = d.tg(b);
if (0 < b.length || 0 < a.labelNodes.count) {
if (1 === b.length && 1 === a.labelNodes.count) {
e = b[0];
var f = a.labelNodes.first();
if (d.pa(f.data) === e) return
}
e = (new F).addAll(b);
var g = new F;
a.labelNodes.each(function (a) {
null !== a.data && (a = d.pa(a.data), void 0 !== a && g.add(a))
});
b = g.copy();
b.pq(e);
e =
e.copy();
e.pq(g);
if (0 < b.count || 0 < e.count) b.each(function (b) {
b = c.Hb(b);
null !== b && b.labeledLink === a && (b.labeledLink = null)
}), e.each(function (b) {
b = c.Hb(b);
null !== b && b.labeledLink !== a && (b.labeledLink = a)
})
}
} else !(a instanceof Je) && (b = d.Ni(b), b = c.findPartForKey(b), null === b || b instanceof U) && (a.containingGroup = b)
}
}
};
Yp.prototype.resolveReferencesForData = function (a) {
var b = this.diagram.model, c = b.pa(a);
if (void 0 !== c) {
var d = gq(b, c), e = this.vc(a);
if (null !== d && null !== e) {
d = d.iterator;
for (var f = {}; d.next();) {
var g = d.value;
b.Pb(g) ? e instanceof U && b.Ni(g) === c && (g = this.vc(g), null !== g && (g.containingGroup = e)) : (f.link = this.uc(g), null !== f.link && e instanceof V && (bq(b, g, !0) === c && (f.link.fromNode = e), bq(b, g, !1) === c && (f.link.toNode = e), g = b.tg(g), Array.isArray(g) && g.some(function (a) {
return function (b) {
return b === c ? (e.labeledLink = a.link,
!0) : !1
}
}(f))));
f = {link: f.link}
}
hq(b, c)
}
a = b.Ni(a);
void 0 !== a && (a = this.Hb(a), a instanceof U && (e.containingGroup = a))
}
};
Yp.prototype.unresolveReferencesForPart = function (a) {
var b = this.diagram.model;
if (a instanceof V) {
var c = b.pa(a.data);
if (void 0 !== c) {
for (var d = a.linksConnected; d.next();) iq(b, c, d.value.data);
a.isLinkLabel && (d = a.labeledLink, null !== d && iq(b, c, d.data));
if (a instanceof U) for (a = a.memberParts; a.next();) d = a.value.data, b.Pb(d) && iq(b, c, d)
}
}
};
Yp.prototype.copyPartData = function (a, b) {
var c = bi.prototype.copyPartData.call(this, a, b);
if (a instanceof R) if (a = a.data, null !== a && null !== b) {
var d = b.model;
a = d.Sp(a);
"object" === typeof a && null !== a && (d.Di(a), c = b.uc(a))
} else null !== c && (b = this.diagram, null !== a && null !== b && null !== b.commandHandler && b.commandHandler.copiesClipboardData && (b = b.model.Sp(a), "object" === typeof b && null !== b && (c.data = b)));
return c
};
Yp.prototype.insertLink = function (a, b, c, d) {
var e = this.diagram, f = e.model, g = e.toolManager.findTool("Linking"), h = "";
null !== a && (null === b && (b = a), h = b.portId, null === h && (h = ""));
b = "";
null !== c && (null === d && (d = c), b = d.portId, null === b && (b = ""));
d = g.archetypeLinkData;
if (d instanceof R) {
if (Ag(d), f = d.copy(), null !== f) return f.fromNode = a, f.fromPortId = h, f.toNode = c, f.toPortId = b, e.add(f), a = g.archetypeLabelNodeData, a instanceof V && (Ag(a), a = a.copy(), null !== a && (a.labeledLink = f, e.add(a))), f
} else if (null !== d && (d = f.Sp(d), "object" ===
typeof d && null !== d)) return null !== a && jq(f, d, f.pa(a.data), !0), kq(f, d, h, !0), null !== c && jq(f, d, f.pa(c.data), !1), kq(f, d, b, !1), f.Di(d), a = g.archetypeLabelNodeData, null === a || a instanceof V || (a = f.copyNodeData(a), "object" === typeof a && null !== a && (f.kf(a), a = f.pa(a), void 0 !== a && f.Hu(d, a))), e.uc(d);
return null
};
Yp.prototype.findPartForKey = Yp.prototype.findPartForKey;
Yp.prototype.removeAllModeledParts = Yp.prototype.removeAllModeledParts;
Yp.prototype.addModeledParts = Yp.prototype.addModeledParts;
Yp.prototype.addAllModeledParts = Yp.prototype.addAllModeledParts;
Yp.className = "GraphLinksPartManager";
function lq() {
bi.apply(this, arguments);
this.bh = null
}
la(lq, bi);
function mq(a, b, c) {
if (null !== b && null !== c) {
var d = a.diagram.toolManager.findTool("Linking"), e = b, f = c;
if (a.diagram.isTreePathToChildren) for (b = f.linksConnected; b.next();) {
if (b.value.toNode === f) return
} else for (e = c, f = b, b = e.linksConnected; b.next();) if (b.value.fromNode === e) return;
if (null === d || !Rf(d, e, f, null, !0)) if (d = a.getLinkCategoryForData(c.data), b = a.findLinkTemplateForCategory(d), null !== b && (Ag(b), b = b.copy(), null !== b)) {
var g = a.diagram.skipsModelSourceBindings;
a.diagram.skipsModelSourceBindings = !0;
b.Bf = d;
b.jb = c.data;
b.fromNode = e;
b.toNode = f;
a.diagram.add(b);
b.jb = null;
b.data = c.data;
a.diagram.skipsModelSourceBindings = g
}
}
}
lq.prototype.getLinkCategoryForData = function (a) {
return this.diagram.model.dv(a)
};
lq.prototype.setLinkCategoryForData = function (a, b) {
this.diagram.model.Kv(a, b)
};
lq.prototype.setFromNodeForLink = function (a, b, c) {
var d = this.diagram.model;
void 0 === c && (c = null);
b = null !== b ? b.data : null;
if (this.diagram.isTreePathToChildren) d.Ie(a.data, d.pa(b)); else {
var e = this.bh;
this.bh = a;
null !== c && d.Ie(c.data, void 0);
d.Ie(b, d.pa(null !== a.toNode ? a.toNode.data : null));
this.bh = e
}
};
lq.prototype.setToNodeForLink = function (a, b, c) {
var d = this.diagram.model;
void 0 === c && (c = null);
b = null !== b ? b.data : null;
if (this.diagram.isTreePathToChildren) {
var e = this.bh;
this.bh = a;
null !== c && d.Ie(c.data, void 0);
d.Ie(b, d.pa(null !== a.fromNode ? a.fromNode.data : null));
this.bh = e
} else d.Ie(a.data, d.pa(b))
};
lq.prototype.removeDataForLink = function (a) {
this.diagram.model.Ie(a.data, void 0)
};
lq.prototype.doModelChanged = function (a) {
bi.prototype.doModelChanged.call(this, a);
if (this.diagram) {
var b = this.diagram;
if (a.model === b.model) {
var c = a.change;
if (b.ea) {
b.ea = !1;
try {
var d = a.modelChange;
if ("" !== d) {
if (c === re) {
if ("nodeParentKey" === d) {
var e = a.object, f = this.Hb(a.newValue), g = this.Hi(e);
if (null !== this.bh) null !== f && (this.bh.data = e, this.bh.category = this.getLinkCategoryForData(e)); else if (null !== g) {
var h = g.Ki();
null !== h ? null === f ? b.remove(h) : b.isTreePathToChildren ? h.fromNode = f : h.toNode = f : mq(this, f,
g)
}
} else if ("parentLinkCategory" === d) {
var k = this.Hi(a.object), l = a.newValue;
if (null !== k && "string" === typeof l) {
var m = k.Ki();
null !== m && (m.category = l)
}
}
b.isModified = !0
}
} else if (c === re) {
var n = a.propertyName, p = a.object;
p === b.model ? "nodeParentKeyProperty" === n && (b.undoManager.isUndoingRedoing || this.ud()) : this.updateDataBindings(p, n);
b.isModified = !0
}
} finally {
b.ea = !0
}
}
}
}
};
lq.prototype.updateRelationshipsFromData = function (a) {
var b = a.data;
if (null !== b) {
var c = a.diagram;
if (null !== c) {
var d = c.model;
a instanceof V && (b = d.Pi(b), b = c.Hb(b), d = a.sg(), b !== d && (d = a.Ki(), null !== b ? null !== d ? c.isTreePathToChildren ? d.fromNode = b : d.toNode = b : mq(this, b, a) : null !== d && sj(c, d, !1)))
}
}
};
lq.prototype.updateDataBindings = function (a, b) {
bi.prototype.updateDataBindings.call(this, a, b);
"string" === typeof b && null !== this.vc(a) && (a = this.uc(a), null !== a && a.Ea(b))
};
lq.prototype.resolveReferencesForData = function (a) {
var b = this.diagram.model, c = b.pa(a);
if (void 0 !== c) {
var d = gq(b, c), e = this.vc(a);
if (null !== d && null !== e) {
for (d = d.iterator; d.next();) {
var f = d.value;
b.Pb(f) && e instanceof V && b.Pi(f) === c && mq(this, e, this.Hi(f))
}
hq(b, c)
}
a = b.Pi(a);
void 0 !== a && e instanceof V && (a = this.Hb(a), mq(this, a, e))
}
};
lq.prototype.unresolveReferencesForPart = function (a) {
var b = this.diagram.model;
if (a instanceof V) {
var c = b.pa(a.data), d = this.uc(a.data);
if (null !== d) {
d.isSelected = !1;
d.isHighlighted = !1;
var e = d.layer;
if (null !== e) {
var f = e.xc(-1, d, !1);
0 <= f && this.diagram.ab(ue, "parts", e, d, null, f, null);
f = d.layerChanged;
null !== f && f(d, e, null)
}
}
d = this.diagram.isTreePathToChildren;
for (a = a.linksConnected; a.next();) e = a.value, e = (d ? e.toNode : e.fromNode).data, b.Pb(e) && iq(b, c, e)
}
};
lq.prototype.insertLink = function (a, b, c) {
b = this.diagram.model;
var d = a, e = c;
this.diagram.isTreePathToChildren || (d = c, e = a);
return null !== d && null !== e ? (b.Ie(e.data, b.pa(d.data)), e.Ki()) : null
};
lq.className = "TreePartManager";
function Z(a) {
this.Et = ',\n "insertedNodeKeys": ';
this.gw = ',\n "modifiedNodeData": ';
this.Gt = ',\n "removedNodeKeys": ';
ab(this);
this.mn = this.Ua = "";
this.Pf = !1;
this.l = {};
this.Fc = [];
this.cb = new vb;
this.ni = "key";
this.Kk = this.pl = null;
this.bn = this.cn = !1;
this.en = !0;
this.Nm = null;
this.yj = "category";
this.Hf = new vb;
this.gu = new E;
this.fh = !1;
this.u = null;
this.undoManager = new Ce;
void 0 !== a && (this.nodeDataArray = a)
}
Z.prototype.cloneProtected = function (a) {
a.Ua = this.Ua;
a.mn = this.mn;
a.Pf = this.Pf;
a.ni = this.ni;
a.pl = this.pl;
a.Kk = this.Kk;
a.cn = this.cn;
a.bn = this.bn;
a.en = this.en;
a.Nm = this.Nm;
a.yj = this.yj
};
Z.prototype.copy = function () {
var a = new this.constructor;
this.cloneProtected(a);
return a
};
t = Z.prototype;
t.clear = function () {
this.Fc = [];
this.cb.clear();
this.Hf.clear();
this.undoManager.clear()
};
t.toString = function (a) {
void 0 === a && (a = 0);
if (1 < a) return this.vq();
var b = ("" !== this.name ? this.name : "") + " Model";
if (0 < a) {
b += "\n node data:";
a = this.nodeDataArray;
for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
b += " " + this.pa(e) + ":" + Ja(e)
}
}
return b
};
t.vk = function () {
var a = "";
"" !== this.name && (a += ',\n "name": ' + this.quote(this.name));
"" !== this.dataFormat && (a += ',\n "dataFormat": ' + this.quote(this.dataFormat));
this.isReadOnly && (a += ',\n "isReadOnly": ' + this.isReadOnly);
"key" !== this.nodeKeyProperty && "string" === typeof this.nodeKeyProperty && (a += ',\n "nodeKeyProperty": ' + this.quote(this.nodeKeyProperty));
this.copiesArrays && (a += ',\n "copiesArrays": true');
this.copiesArrayObjects && (a += ',\n "copiesArrayObjects": true');
this.copiesKey || (a += ',\n "copiesKey": false');
"category" !== this.nodeCategoryProperty && "string" === typeof this.nodeCategoryProperty && (a += ',\n "nodeCategoryProperty": ' + this.quote(this.nodeCategoryProperty));
return a
};
t.oq = function (a) {
a.name && (this.name = a.name);
a.dataFormat && (this.dataFormat = a.dataFormat);
a.isReadOnly && (this.isReadOnly = !0);
a.nodeKeyProperty && (this.nodeKeyProperty = a.nodeKeyProperty);
a.copiesArrays && (this.copiesArrays = !0);
a.copiesArrayObjects && (this.copiesArrayObjects = !0);
!1 === a.copiesKey && (this.copiesKey = !1);
a.nodeCategoryProperty && (this.nodeCategoryProperty = a.nodeCategoryProperty)
};
function nq(a) {
return ',\n "modelData": ' + oq(a, a.modelData)
}
function pq(a, b) {
b = b.modelData;
ya(b) && (a.qm(b), a.modelData = b)
}
t.bw = function () {
var a = this.modelData, b = !1, c;
for (c in a) if (!qq(c, a[c])) {
b = !0;
break
}
a = "";
b && (a = nq(this));
return a + ',\n "nodeDataArray": ' + rq(this, this.nodeDataArray, !0)
};
t.yv = function (a) {
pq(this, a);
a = a.nodeDataArray;
za(a) && (this.qm(a), this.nodeDataArray = a)
};
function sq(a, b, c, d) {
if (b === c) return !0;
if (typeof b !== typeof c || "function" === typeof b || "function" === typeof c) return !1;
if (Array.isArray(b) && Array.isArray(c)) {
if (d.J(b) === c) return !0;
d.add(b, c);
if (b.length !== c.length) return !1;
for (var e = 0; e < b.length; e++) if (!sq(a, b[e], c[e], d)) return !1;
return !0
}
if (ya(b) && ya(c)) {
if (d.J(b) === c) return !0;
d.add(b, c);
for (var f in b) {
var g = b[f];
if (!qq(f, g)) {
var h = c[f];
if (void 0 === h || !sq(a, g, h, d)) return !1
}
}
for (e in c) if (f = c[e], !qq(e, f) && (g = b[e], void 0 === g || !sq(a, g, f, d))) return !1;
return !0
}
return !1
}
function tq(a, b, c) {
a[c] !== b[c] && B("Model.computeJsonDifference: Model." + c + ' is not the same in both models: "' + a[c] + '" and "' + b[c] + '"')
}
t.zq = function (a) {
tq(this, a, "nodeKeyProperty");
for (var b = new F, c = new F, d = (new F).addAll(this.cb.iteratorKeys), e = new vb, f = a.nodeDataArray, g = f.length, h = 0; h < g; h++) {
var k = f[h], l = a.pa(k);
if (void 0 !== l) {
d.remove(l);
var m = this.Qb(l);
null === m ? (b.add(l), c.add(k)) : sq(this, m, k, e) || c.add(k)
} else this.ht(k), l = this.pa(k), b.add(l), c.add(k)
}
f = "";
sq(this, this.modelData, a.modelData, e) || (f += nq(this));
0 < b.count && (f += this.Et + rq(this, b.Na(), !0));
0 < c.count && (f += this.gw + rq(this, c.Na(), !0));
0 < d.count && (f += this.Gt + rq(this,
d.Na(), !0));
return f
};
t.qy = function (a, b) {
void 0 === b && (b = uq(this, this));
return '{ "class": ' + this.quote(b) + ', "incremental": 1' + this.vk() + this.zq(a) + "}"
};
t.zt = function (a, b) {
var c = this, d = !1, e = new F, f = new F, g = new F;
a.changes.each(function (a) {
a.model === c && ("nodeDataArray" === a.modelChange ? a.change === te ? e.add(a.newValue) : a.change === ue && g.add(a.oldValue) : c.Pb(a.object) ? f.add(a.object) : c.modelData === a.object && a.change === re && (d = !0))
});
var h = new F;
e.each(function (a) {
h.add(c.pa(a));
b || f.add(a)
});
var k = new F;
g.each(function (a) {
k.add(c.pa(a));
b && f.add(a)
});
a = "";
d && (a += nq(this));
0 < h.count && (a += (b ? this.Gt : this.Et) + rq(this, h.Na(), !0));
0 < f.count && (a += this.gw + rq(this,
f.Na(), !0));
0 < k.count && (a += (b ? this.Et : this.Gt) + rq(this, k.Na(), !0));
return a
};
t.xv = function (a) {
pq(this, a);
var b = a.insertedNodeKeys, c = a.modifiedNodeData, d = new vb;
if (Array.isArray(c)) for (var e = 0; e < c.length; e++) {
var f = c[e], g = this.pa(f);
void 0 !== g && null !== g && d.set(g, f)
}
if (Array.isArray(b)) for (e = b.length, f = 0; f < e; f++) {
g = b[f];
var h = this.Qb(g);
null === h && (h = (h = d.get(g)) ? h : this.copyNodeData({}), this.wm(h, g), this.kf(h))
}
if (Array.isArray(c)) for (b = c.length, d = 0; d < b; d++) if (e = c[d], f = this.pa(e), f = this.Qb(f), null !== f) for (var k in e) "__gohashid" === k || k === this.nodeKeyProperty || this.ek() && k ===
this.nodeIsGroupProperty || this.setDataProperty(f, k, e[k]);
a = a.removedNodeKeys;
if (Array.isArray(a)) for (c = a.length, k = 0; k < c; k++) b = this.Qb(a[k]), null !== b && this.pm(b)
};
t.Lx = function (a, b) {
a.change !== se && B("Model.toIncrementalJson argument is not a Transaction ChangedEvent:" + a.toString());
var c = a.object;
if (!(a.isTransactionFinished && c instanceof ve)) return '{ "incremental": 0 }';
void 0 === b && (b = uq(this, this));
return "2" === b ? '{ "incremental": 2' + this.zt(c, "FinishedUndo" === a.propertyName) + "}" : '{ "class": ' + this.quote(b) + ', "incremental": 1' + this.vk() + this.zt(c, "FinishedUndo" === a.propertyName) + "}"
};
t.Wz = function (a, b) {
return this.Lx(a, b)
};
t.vq = function (a) {
void 0 === a && (a = uq(this, this));
return '{ "class": ' + this.quote(a) + this.vk() + this.bw() + "}"
};
t.toJSON = function (a) {
return this.vq(a)
};
t.Tw = function (a) {
var b = null;
if ("string" === typeof a) try {
b = x.JSON.parse(a)
} catch (d) {
} else "object" === typeof a ? b = a : B("Unable to modify a Model from: " + a);
var c = b.incremental;
"number" !== typeof c && B("Unable to apply non-incremental changes to Model: " + a);
0 !== c && (this.Aa("applyIncrementalJson"), this.xv(b), this.Za("applyIncrementalJson"))
};
t.ky = function (a) {
return this.Tw(a)
};
Z.constructGraphLinksModel = function () {
return new Z
};
t = Z.prototype;
t.qm = function (a) {
if (za(a)) for (var b = a.length, c = 0; c < b; c++) {
var d = a[c];
if (ya(d)) {
var e = c;
d = this.qm(d);
Array.isArray(a) ? a[e] = d : B("Cannot replace an object in an HTMLCollection or NodeList at " + e)
}
} else if (ya(a)) {
for (c in a) if (e = a[c], ya(e) && (e = this.qm(e), a[c] = e, "points" === c && Array.isArray(e))) {
d = 0 === e.length % 2;
for (var f = 0; f < e.length; f++) if ("number" !== typeof e[f]) {
d = !1;
break
}
if (d) {
d = new E;
for (f = 0; f < e.length / 2; f++) d.add(new G(e[2 * f], e[2 * f + 1]));
d.freeze();
a[c] = d
}
}
if ("object" === typeof a) {
c = a;
e = a["class"];
if ("NaN" === e) c = NaN; else if ("Date" === e) c = new Date(a.value); else if ("go.Point" === e) c = new G(vq(a.x), vq(a.y)); else if ("go.Size" === e) c = new M(vq(a.width), vq(a.height)); else if ("go.Rect" === e) c = new N(vq(a.x), vq(a.y), vq(a.width), vq(a.height)); else if ("go.Margin" === e) c = new pc(vq(a.top), vq(a.right), vq(a.bottom), vq(a.left)); else if ("go.Spot" === e) "string" === typeof a["enum"] ? c = rd(a["enum"]) : c = new O(vq(a.x), vq(a.y), vq(a.offsetX), vq(a.offsetY)); else if ("go.Brush" === e) {
if (c = new Yk, c.type = bb(Yk, a.type), "string" ===
typeof a.color && (c.color = a.color), a.start instanceof O && (c.start = a.start), a.end instanceof O && (c.end = a.end), "number" === typeof a.startRadius && (c.startRadius = vq(a.startRadius)), "number" === typeof a.endRadius && (c.endRadius = vq(a.endRadius)), a = a.colorStops, ya(a)) for (b in a) c.addColorStop(parseFloat(b), a[b])
} else "go.Geometry" === e ? (b = null, "string" === typeof a.path ? b = Jd(a.path) : b = new ud, b.type = bb(ud, a.type), "number" === typeof a.startX && (b.startX = vq(a.startX)), "number" === typeof a.startY && (b.startY = vq(a.startY)),
"number" === typeof a.endX && (b.endX = vq(a.endX)), "number" === typeof a.endY && (b.endY = vq(a.endY)), a.spot1 instanceof O && (b.spot1 = a.spot1), a.spot2 instanceof O && (b.spot2 = a.spot2), c = b) : "go.EnumValue" === e && (b = a.classType, 0 === b.indexOf("go.") && (b = b.substr(3)), c = bb(wq[b] ? wq[b] : null, a.name));
a = c
}
}
return a
};
t.quote = function (a) {
for (var b = "", c = a.length, d = 0; d < c; d++) {
var e = a[d];
if ('"' === e || "\\" === e) b += "\\" + e; else if ("\b" === e) b += "\\b"; else if ("\f" === e) b += "\\f"; else if ("\n" === e) b += "\\n"; else if ("\r" === e) b += "\\r"; else if ("\t" === e) b += "\\t"; else {
var f = a.charCodeAt(d);
b = 16 > f ? b + ("\\u000" + a.charCodeAt(d).toString(16)) : 32 > f ? b + ("\\u00" + a.charCodeAt(d).toString(16)) : 8232 === f ? b + "\\u2028" : 8233 === f ? b + "\\u2029" : b + e
}
}
return '"' + b + '"'
};
t.Am = function (a) {
return void 0 === a ? "undefined" : null === a ? "null" : !0 === a ? "true" : !1 === a ? "false" : "string" === typeof a ? this.quote(a) : "number" === typeof a ? Infinity === a ? "9e9999" : -Infinity === a ? "-9e9999" : isNaN(a) ? '{"class":"NaN"}' : a.toString() : a instanceof Date ? '{"class":"Date", "value":"' + a.toJSON() + '"}' : a instanceof Number ? this.Am(a.valueOf()) : za(a) ? rq(this, a) : ya(a) ? oq(this, a) : "function" === typeof a ? "null" : a.toString()
};
function rq(a, b, c) {
void 0 === c && (c = !1);
var d = b.length;
if (0 >= d) return "[]";
var e = new cb;
e.add("[ ");
c && 1 < d && e.add("\n");
for (var f = 0; f < d; f++) {
var g = b[f];
void 0 !== g && (0 < f && (e.add(","), c && e.add("\n")), e.add(a.Am(g)))
}
c && 1 < d && e.add("\n");
e.add(" ]");
return e.toString()
}
function qq(a, b) {
return void 0 === b || "__gohashid" === a || "_" === a[0] || "function" === typeof b ? !0 : !1
}
function xq(a) {
return isNaN(a) ? "NaN" : Infinity === a ? "9e9999" : -Infinity === a ? "-9e9999" : a
}
function oq(a, b) {
var c = b;
if (c instanceof G) b = {
"class": "go.Point",
x: xq(c.x),
y: xq(c.y)
}; else if (c instanceof M) b = {
"class": "go.Size",
width: xq(c.width),
height: xq(c.height)
}; else if (c instanceof N) b = {
"class": "go.Rect",
x: xq(c.x),
y: xq(c.y),
width: xq(c.width),
height: xq(c.height)
}; else if (c instanceof pc) b = {
"class": "go.Margin",
top: xq(c.top),
right: xq(c.right),
bottom: xq(c.bottom),
left: xq(c.left)
}; else if (c instanceof O) c.gb() ? b = {
"class": "go.Spot",
x: xq(c.x),
y: xq(c.y),
offsetX: xq(c.offsetX),
offsetY: xq(c.offsetY)
} :
b = {"class": "go.Spot", "enum": c.toString()}; else if (c instanceof Yk) {
b = {"class": "go.Brush", type: c.type.name};
if (c.type === al) b.color = c.color; else if (c.type === dl || c.type === Zk) b.start = c.start, b.end = c.end, c.type === Zk && (0 !== c.startRadius && (b.startRadius = xq(c.startRadius)), isNaN(c.endRadius) || (b.endRadius = xq(c.endRadius)));
if (null !== c.colorStops) {
var d = {};
for (c = c.colorStops.iterator; c.next();) d[c.key] = c.value;
b.colorStops = d
}
} else c instanceof ud ? (b = {"class": "go.Geometry", type: c.type.name}, 0 !== c.startX && (b.startX =
xq(c.startX)), 0 !== c.startY && (b.startY = xq(c.startY)), 0 !== c.endX && (b.endX = xq(c.endX)), 0 !== c.endY && (b.endY = xq(c.endY)), c.spot1.A(zc) || (b.spot1 = c.spot1), c.spot2.A(Jc) || (b.spot2 = c.spot2), c.type === vd && (b.path = Gd(c))) : c instanceof D && (b = {
"class": "go.EnumValue",
classType: uq(a, c.classType),
name: c.name
});
d = "{";
c = !0;
for (var e in b) {
var f = Um(b, e);
if (!qq(e, f)) if (c ? c = !1 : d += ", ", d += '"' + e + '":', "points" === e && f instanceof E) {
var g = "[";
for (f = f.iterator; f.next();) {
var h = f.value;
1 < g.length && (g += ",");
g += a.Am(h.x);
g += ",";
g += a.Am(h.y)
}
g += "]";
d += g
} else d += a.Am(f)
}
return d + "}"
}
function vq(a) {
return "number" === typeof a ? a : "NaN" === a ? NaN : "9e9999" === a ? Infinity : "-9e9999" === a ? -Infinity : parseFloat(a)
}
t.sh = function (a) {
this.gu.add(a)
};
t.rk = function (a) {
this.gu.remove(a)
};
t.Ls = function (a) {
this.skipsUndoManager || this.undoManager.hv(a);
for (var b = this.gu, c = b.length, d = 0; d < c; d++) b.N(d)(a)
};
t.ab = function (a, b, c, d, e, f, g) {
yq(this, "", a, b, c, d, e, f, g)
};
t.g = function (a, b, c, d, e) {
yq(this, "", re, a, this, b, c, d, e)
};
t.mt = function (a, b, c, d, e, f) {
yq(this, "", re, b, a, c, d, e, f)
};
function yq(a, b, c, d, e, f, g, h, k) {
void 0 === h && (h = null);
void 0 === k && (k = null);
var l = new qe;
l.model = a;
l.change = c;
l.modelChange = b;
l.propertyName = d;
l.object = e;
l.oldValue = f;
l.oldParam = h;
l.newValue = g;
l.newParam = k;
a.Ls(l)
}
t.Tj = function (a, b) {
if (null !== a && a.model === this) if (a.change === re) zj(a.object, a.propertyName, a.J(b)); else if (a.change === te) {
var c = a.newParam;
if ("nodeDataArray" === a.modelChange) {
if (a = a.newValue, ya(a) && "number" === typeof c) {
var d = this.pa(a);
b ? (this.Fc[c] === a && Ca(this.Fc, c), void 0 !== d && this.cb.remove(d)) : (this.Fc[c] !== a && Ba(this.Fc, c, a), void 0 !== d && this.cb.add(d, a))
}
} else "" === a.modelChange ? ((d = a.object) && !za(d) && a.propertyName && (d = Um(a.object, a.propertyName)), za(d) && "number" === typeof c && (a = a.newValue, b ?
Ca(d, c) : Ba(d, c, a))) : B("unknown ChangedEvent.Insert modelChange: " + a.toString())
} else a.change === ue ? (c = a.oldParam, "nodeDataArray" === a.modelChange ? (a = a.oldValue, ya(a) && "number" === typeof c && (d = this.pa(a), b ? (this.Fc[c] !== a && Ba(this.Fc, c, a), void 0 !== d && this.cb.add(d, a)) : (this.Fc[c] === a && Ca(this.Fc, c), void 0 !== d && this.cb.remove(d)))) : "" === a.modelChange ? ((d = a.object) && !za(d) && a.propertyName && (d = Um(a.object, a.propertyName)), za(d) && "number" === typeof c && (a = a.oldValue, b ? Ba(d, c, a) : Ca(d, c))) : B("unknown ChangedEvent.Remove modelChange: " +
a.toString())) : a.change !== se && B("unknown ChangedEvent: " + a.toString())
};
t.Aa = function (a) {
return this.undoManager.Aa(a)
};
t.Za = function (a) {
return this.undoManager.Za(a)
};
t.wf = function () {
return this.undoManager.wf()
};
Z.prototype.commit = function (a, b) {
void 0 === b && (b = "");
var c = this.skipsUndoManager;
null === b && (this.skipsUndoManager = !0, b = "");
this.undoManager.Aa(b);
var d = !1;
try {
a(this), d = !0
} finally {
d ? this.undoManager.Za(b) : this.undoManager.wf(), this.skipsUndoManager = c
}
};
t = Z.prototype;
t.Ea = function (a, b) {
void 0 === b && (b = "");
yq(this, "SourceChanged", se, b, a, null, null)
};
t.pa = function (a) {
if (null !== a) {
var b = this.ni;
if ("" !== b && (b = Um(a, b), void 0 !== b)) {
if (dq(b)) return b;
B("Key value for node data " + a + " is not a number or a string: " + b)
}
}
};
t.wm = function (a, b) {
if (null !== a) {
var c = this.ni;
if ("" !== c) if (this.Pb(a)) {
var d = Um(a, c);
d !== b && null === this.Qb(b) && (zj(a, c, b), void 0 !== d && this.cb.remove(d), this.cb.add(b, a), yq(this, "nodeKey", re, c, a, d, b), "string" === typeof c && this.Ea(a, c), this.rq(d, b))
} else zj(a, c, b)
}
};
function dq(a) {
return "number" === typeof a || "string" === typeof a
}
t.Pb = function (a) {
var b = this.pa(a);
return void 0 === b ? !1 : this.cb.J(b) === a
};
t.Qb = function (a) {
null === a && B("Model.findNodeDataForKey:key must not be null");
return void 0 !== a && dq(a) ? this.cb.J(a) : null
};
t.ht = function (a) {
if (null !== a) {
var b = this.ni;
if ("" !== b) {
var c = this.pa(a);
if (void 0 === c || this.cb.contains(c)) {
var d = this.pl;
if (null !== d && (c = d(this, a), void 0 !== c && null !== c && !this.cb.contains(c))) {
zj(a, b, c);
return
}
if ("string" === typeof c) {
for (d = 2; this.cb.contains(c + d);) d++;
zj(a, b, c + d)
} else if (void 0 === c || "number" === typeof c) {
for (c = -this.cb.count - 1; this.cb.contains(c);) c--;
zj(a, b, c)
}
}
}
}
};
t.kf = function (a) {
null !== a && (ob(a), this.Pb(a) || Wp(this, a, !0))
};
function Wp(a, b, c) {
var d = a.pa(b);
if (void 0 === d || a.cb.J(d) !== b) a.ht(b), d = a.pa(b), void 0 === d ? B("Model.makeNodeDataKeyUnique failed on " + b + ". Data not added to Model.") : (a.cb.add(d, b), d = null, c && (d = a.Fc.length, Ba(a.Fc, d, b)), yq(a, "nodeDataArray", te, "nodeDataArray", a, null, b, null, d), a.sm(b), a.rm(b))
}
t.hy = function (a) {
if (za(a)) for (var b = a.length, c = 0; c < b; c++) this.kf(a[c]); else for (a = a.iterator; a.next();) this.kf(a.value)
};
t.pm = function (a) {
null !== a && Vp(this, a, !0)
};
function Vp(a, b, c) {
var d = a.pa(b);
void 0 !== d && a.cb.remove(d);
d = null;
if (c) {
a:if (c = a.Fc, Array.isArray(c)) d = c.indexOf(b); else {
d = c.length;
for (var e = 0; e < d; e++) if (c[e] === b) {
d = e;
break a
}
d = -1
}
if (0 > d) return;
Ca(a.Fc, d)
}
yq(a, "nodeDataArray", ue, "nodeDataArray", a, b, null, d, null);
a.wq(b)
}
t.Nz = function (a) {
if (za(a)) for (var b = a.length, c = 0; c < b; c++) this.pm(a[c]); else for (a = a.iterator; a.next();) this.pm(a.value)
};
t.Cz = function (a) {
if (za(a)) {
for (var b = new F(this.cb.iteratorKeys), c = new F, d = a.length, e = 0; e < d; e++) {
var f = a[e], g = this.pa(f);
if (void 0 !== g) {
c.add(g);
var h = this.Qb(g);
null !== h ? this.Sj(h, f) : (h = {}, this.wm(h, g), this.Sj(h, f), this.kf(h))
} else this.kf(f), c.add(this.pa(f))
}
for (a = b.iterator; a.next();) b = a.value, c.contains(b) || (b = this.Qb(b)) && this.pm(b)
}
};
t.rq = function (a, b) {
void 0 !== b && (a = gq(this, a), a instanceof F && this.Hf.add(b, a))
};
t.Yv = function () {
};
t.sm = function () {
};
t.rm = function () {
};
t.wq = function () {
};
function iq(a, b, c) {
if (void 0 !== b) {
var d = a.Hf.J(b);
null === d && (d = new F, a.Hf.add(b, d));
d.add(c)
}
}
function hq(a, b, c) {
if (void 0 !== b) {
var d = a.Hf.J(b);
d instanceof F && (void 0 === c || null === c ? a.Hf.remove(b) : (d.remove(c), 0 === d.count && a.Hf.remove(b)))
}
}
function gq(a, b) {
if (void 0 === b) return null;
a = a.Hf.J(b);
return a instanceof F ? a : null
}
t.Nu = function (a) {
void 0 === a ? this.Hf.clear() : this.Hf.remove(a)
};
Z.prototype.copyNodeData = function (a) {
if (null === a) return null;
var b = this.Kk;
a = null !== b ? b(a, this) : zq(this, a, !0);
ya(a) && ab(a);
return a
};
function zq(a, b, c) {
if (a.copiesArrays && Array.isArray(b)) {
var d = [];
for (c = 0; c < b.length; c++) {
var e = zq(a, b[c], a.copiesArrayObjects);
d.push(e)
}
ab(d);
return d
}
if (c && ya(b)) {
c = (c = b.constructor) ? new c : {};
e = a.copiesKey || "string" !== typeof a.nodeKeyProperty ? null : a.nodeKeyProperty;
for (d in b) if ("__gohashid" === d) c.__gohashid = void 0; else if (d === e) c[e] = void 0; else {
var f = Um(b, d), g = uq(a, f);
"GraphObject" === g || "Diagram" === g || "Layer" === g || "RowColumnDefinition" === g || "AnimationManager" === g || "Tool" === g || "CommandHandler" ===
g || "Layout" === g || "InputEvent" === g || "DiagramEvent" === g || f instanceof Z || f instanceof Ce || f instanceof ve || f instanceof qe ? zj(c, d, f) : (f = zq(a, f, !1), zj(c, d, f))
}
ab(c);
return c
}
return b instanceof G ? b.copy() : b instanceof M ? b.copy() : b instanceof N ? b.copy() : b instanceof O ? b.copy() : b instanceof pc ? b.copy() : b
}
Z.prototype.setDataProperty = function (a, b, c) {
if (this.Pb(a)) if (b === this.nodeKeyProperty) this.wm(a, c); else {
if (b === this.nodeCategoryProperty) {
this.tq(a, c);
return
}
} else !Aq && a instanceof Y && (Aq = !0, wa('Model.setDataProperty is modifying a GraphObject, "' + a.toString() + '"'), wa(" Is that really your intent?"));
var d = Um(a, b);
d !== c && (zj(a, b, c), this.mt(a, b, d, c))
};
t = Z.prototype;
t.set = function (a, b, c) {
this.setDataProperty(a, b, c)
};
t.Sj = function (a, b) {
if (b) {
var c = this.Pb(a), d;
for (d in b) "__gohashid" === d || c && d === this.nodeKeyProperty || this.setDataProperty(a, d, b[d])
}
};
t.ay = function (a, b) {
this.Ys(a, -1, b)
};
t.Ys = function (a, b, c) {
0 > b && (b = a.length);
Ba(a, b, c);
yq(this, "", te, "", a, null, c, null, b)
};
t.zv = function (a, b) {
void 0 === b && (b = -1);
a === this.Fc && B("Model.removeArrayItem should not be called on the Model.nodeDataArray");
-1 === b && (b = a.length - 1);
var c = a[b];
Ca(a, b);
yq(this, "", ue, "", a, c, null, b, null)
};
t.Vs = function (a) {
if (null === a) return "";
var b = this.yj;
if ("" === b) return "";
b = Um(a, b);
if (void 0 === b) return "";
if ("string" === typeof b) return b;
B("getCategoryForNodeData found a non-string category for " + a + ": " + b);
return ""
};
t.tq = function (a, b) {
if (null !== a) {
var c = this.yj;
if ("" !== c) if (this.Pb(a)) {
var d = Um(a, c);
void 0 === d && (d = "");
d !== b && (zj(a, c, b), yq(this, "nodeCategory", re, c, a, d, b))
} else zj(a, c, b)
}
};
t.gm = function () {
return !1
};
t.ek = function () {
return !1
};
t.fm = function () {
return !1
};
t.dt = function () {
return !1
};
t.fk = function () {
return !1
};
function fi() {
return new Z
}
function uq(a, b) {
if ("function" === typeof b) {
if (b.className) return b.className;
if (b.name) return b.name
} else if ("object" === typeof b && null !== b && b.constructor) return uq(a, b.constructor);
return typeof b
}
function Um(a, b) {
if (!a || !b) return null;
try {
if ("function" === typeof b) var c = b(a); else "function" === typeof a.getAttribute ? (c = a.getAttribute(b), null === c && (c = void 0)) : c = a[b]
} catch (d) {
}
return c
}
function zj(a, b, c) {
if (a && b) try {
"function" === typeof b ? b(a, c) : "function" === typeof a.setAttribute ? a.setAttribute(b, c) : a[b] = c
} catch (d) {
}
}
ma.Object.defineProperties(Z.prototype, {
name: {
get: function () {
return this.Ua
}, set: function (a) {
var b = this.Ua;
b !== a && (this.Ua = a, this.g("name", b, a))
}
}, dataFormat: {
get: function () {
return this.mn
}, set: function (a) {
var b = this.mn;
b !== a && (this.mn = a, this.g("dataFormat", b, a))
}
}, isReadOnly: {
get: function () {
return this.Pf
}, set: function (a) {
var b = this.Pf;
b !== a && (this.Pf = a, this.g("isReadOnly", b, a))
}
}, modelData: {
get: function () {
return this.l
}, set: function (a) {
var b = this.l;
b !== a && (this.l = a, this.g("modelData", b, a), this.Ea(a))
}
}, undoManager: {
get: function () {
return this.u
}, set: function (a) {
var b = this.u;
b !== a && (null !== b && b.yx(this), this.u = a, null !== a && a.Rw(this))
}
}, skipsUndoManager: {
get: function () {
return this.fh
}, set: function (a) {
this.fh = a
}
}, nodeKeyProperty: {
get: function () {
return this.ni
}, set: function (a) {
var b = this.ni;
b !== a && ("" === a && B("Model.nodeKeyProperty may not be the empty string"), 0 < this.cb.count && B("Cannot set Model.nodeKeyProperty when there is existing node data"), this.ni = a, this.g("nodeKeyProperty", b, a))
}
}, makeUniqueKeyFunction: {
get: function () {
return this.pl
}, set: function (a) {
var b = this.pl;
b !== a && (this.pl = a, this.g("makeUniqueKeyFunction", b, a))
}
}, nodeDataArray: {
get: function () {
return this.Fc
}, set: function (a) {
var b = this.Fc;
if (b !== a) {
this.cb.clear();
this.Yv();
for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
if (!ya(e)) {
B("Model.nodeDataArray must only contain Objects, not: " + e);
return
}
ob(e)
}
this.Fc = a;
d = new E;
for (e = 0; e < c; e++) {
var f = a[e], g = this.pa(f);
void 0 === g ? d.add(f) : null !== this.cb.J(g) ? d.add(f) : this.cb.add(g, f)
}
for (d = d.iterator; d.next();) e = d.value, this.ht(e), f = this.pa(e), void 0 !== f && this.cb.add(f, e);
yq(this, "nodeDataArray", re, "nodeDataArray", this, b, a);
for (b = 0; b < c; b++) d = a[b], this.sm(d), this.rm(d);
this.Nu();
Array.isArray(a) || (this.isReadOnly = !0)
}
}
},
copyNodeDataFunction: {
get: function () {
return this.Kk
}, set: function (a) {
var b = this.Kk;
b !== a && (this.Kk = a, this.g("copyNodeDataFunction", b, a))
}
}, copiesArrays: {
get: function () {
return this.cn
}, set: function (a) {
var b = this.cn;
b !== a && (this.cn = a, this.g("copiesArrays", b, a))
}
}, copiesArrayObjects: {
get: function () {
return this.bn
}, set: function (a) {
var b = this.bn;
b !== a && (this.bn = a, this.g("copiesArrayObjects", b, a))
}
}, copiesKey: {
get: function () {
return this.en
}, set: function (a) {
var b = this.en;
b !== a && (this.en = a, this.g("copiesKey", b, a))
}
}, afterCopyFunction: {
get: function () {
return this.Nm
}, set: function (a) {
var b = this.Nm;
b !== a && (this.Nm = a, this.g("afterCopyFunction", b, a))
}
}, nodeCategoryProperty: {
get: function () {
return this.yj
}, set: function (a) {
var b = this.yj;
b !== a && (this.yj = a, this.g("nodeCategoryProperty", b, a))
}
}
});
ma.Object.defineProperties(Z, {
type: {
get: function () {
return "Model"
}
}
});
Z.prototype.setCategoryForNodeData = Z.prototype.tq;
Z.prototype.getCategoryForNodeData = Z.prototype.Vs;
Z.prototype.removeArrayItem = Z.prototype.zv;
Z.prototype.insertArrayItem = Z.prototype.Ys;
Z.prototype.addArrayItem = Z.prototype.ay;
Z.prototype.assignAllDataProperties = Z.prototype.Sj;
Z.prototype.set = Z.prototype.set;
Z.prototype.clearUnresolvedReferences = Z.prototype.Nu;
Z.prototype.mergeNodeDataArray = Z.prototype.Cz;
Z.prototype.removeNodeDataCollection = Z.prototype.Nz;
Z.prototype.removeNodeData = Z.prototype.pm;
Z.prototype.addNodeDataCollection = Z.prototype.hy;
Z.prototype.addNodeData = Z.prototype.kf;
Z.prototype.makeNodeDataKeyUnique = Z.prototype.ht;
Z.prototype.findNodeDataForKey = Z.prototype.Qb;
Z.prototype.containsNodeData = Z.prototype.Pb;
Z.prototype.setKeyForNodeData = Z.prototype.wm;
Z.prototype.getKeyForNodeData = Z.prototype.pa;
Z.prototype.updateTargetBindings = Z.prototype.Ea;
Z.prototype.commit = Z.prototype.commit;
Z.prototype.rollbackTransaction = Z.prototype.wf;
Z.prototype.commitTransaction = Z.prototype.Za;
Z.prototype.startTransaction = Z.prototype.Aa;
Z.prototype.raiseDataChanged = Z.prototype.mt;
Z.prototype.raiseChanged = Z.prototype.g;
Z.prototype.raiseChangedEvent = Z.prototype.ab;
Z.prototype.removeChangedListener = Z.prototype.rk;
Z.prototype.addChangedListener = Z.prototype.sh;
Z.prototype.writeJsonValue = Z.prototype.Am;
Z.prototype.replaceJsonObjects = Z.prototype.qm;
Z.prototype.applyIncrementalJSON = Z.prototype.ky;
Z.prototype.applyIncrementalJson = Z.prototype.Tw;
Z.prototype.toJSON = Z.prototype.toJSON;
Z.prototype.toJson = Z.prototype.vq;
Z.prototype.toIncrementalJSON = Z.prototype.Wz;
Z.prototype.toIncrementalJson = Z.prototype.Lx;
Z.prototype.computeJsonDifference = Z.prototype.qy;
Z.prototype.clear = Z.prototype.clear;
var Aq = !1, wq = {};
Z.className = "Model";
Z.fromJSON = Z.fromJson = function (a, b) {
void 0 === b && (b = null);
var c = null;
if ("string" === typeof a) try {
c = x.JSON.parse(a)
} catch (f) {
} else "object" === typeof a ? c = a : B("Unable to construct a Model from: " + a);
if (null === b) {
a = null;
var d = c["class"];
if ("string" === typeof d) try {
var e = null;
0 === d.indexOf("go.") ? (d = d.substr(3), e = wq[d] ? wq[d] : null) : (e = wq[d] ? wq[d] : null, void 0 === e && (e = x[d]));
"function" === typeof e && (a = new e)
} catch (f) {
}
null === a || a instanceof Z ? b = a : B("Unable to construct a Model of declared class: " + c["class"])
}
null ===
b && (b = Z.constructGraphLinksModel());
b.oq(c);
b.yv(c);
return b
};
Z.safePropertyValue = Um;
Z.safePropertySet = zj;
wq.Brush = Yk;
wq.ChangedEvent = qe;
wq.Geometry = ud;
wq.GraphObject = Y;
wq.Margin = pc;
wq.Panel = X;
wq.Point = G;
wq.Rect = N;
wq.Size = M;
wq.Spot = O;
wq.Transaction = ve;
wq.UndoManager = Ce;
function si(a, b, c) {
ab(this);
this.v = !1;
void 0 === a && (a = "");
void 0 === b && (b = a);
void 0 === c && (c = null);
this.l = -1;
this.Qd = null;
this.Pl = a;
this.Ol = this.zp = 0;
this.xs = null;
this.Wn = !1;
this.Fl = b;
this.an = c;
this.so = Bq;
this.Vm = null;
this.Zt = new F
}
si.prototype.copy = function () {
var a = new si;
a.Pl = this.Pl;
a.zp = this.zp;
a.Ol = this.Ol;
a.xs = this.xs;
a.Wn = this.Wn;
a.Fl = this.Fl;
a.an = this.an;
a.so = this.so;
a.Vm = this.Vm;
return a
};
t = si.prototype;
t.fb = function (a) {
a.classType === si && (this.mode = a)
};
t.toString = function () {
return "Binding(" + this.targetProperty + ":" + this.sourceProperty + (-1 !== this.Zi ? " " + this.Zi : "") + " " + this.mode.name + ")"
};
t.freeze = function () {
this.v = !0;
return this
};
t.ha = function () {
this.v = !1;
return this
};
t.qx = function (a) {
void 0 === a && (a = null);
this.mode = Nm;
this.backConverter = a;
return this
};
t.lq = function (a) {
void 0 === a && (a = "");
this.sourceName = a;
this.isToModel = !1;
return this
};
t.Ez = function () {
this.sourceName = null;
this.isToModel = !0;
return this
};
function Lk(a, b, c) {
a = a.sourceName;
return null === a || "" === a ? b : "/" === a ? c.part : "." === a ? c : ".." === a ? c.panel : b.$a(a)
}
t.Zv = function (a, b, c) {
var d = this.Fl;
if (void 0 === c || "" === d || d === c) {
c = this.Pl;
var e = this.an;
if (null === e && "" === c) wa("Binding error: target property is the empty string: " + this.toString()); else {
var f = b;
"" !== d && (f = Um(b, d));
if (void 0 !== f) if (null === e) "" !== c && zj(a, c, f); else try {
if ("" !== c) {
var g = e(f, a);
zj(a, c, g)
} else e(f, a)
} catch (h) {
}
}
}
};
t.yq = function (a, b, c, d) {
if (this.so === Nm) {
var e = this.Pl;
if (void 0 === c || e === c) {
c = this.Fl;
var f = this.Vm, g = a;
"" !== e && (g = Um(a, e));
if (void 0 !== g && !this.Zt.contains(a)) try {
this.Zt.add(a);
var h = null !== d ? d.diagram : null, k = null !== h ? h.model : null;
if (null === f) if ("" !== c) null !== k ? k.setDataProperty(b, c, g) : zj(b, c, g); else {
if (null !== k && null !== d && 0 <= d.itemIndex && null !== d.panel && Array.isArray(d.panel.itemArray)) {
var l = d.itemIndex, m = d.panel.itemArray;
k.zv(m, l);
k.Ys(m, l, g)
}
} else try {
if ("" !== c) {
var n = f(g, b, k);
null !== k ? k.setDataProperty(b,
c, n) : zj(b, c, n)
} else {
var p = f(g, b, k);
if (void 0 !== p && null !== k && null !== d && 0 <= d.itemIndex && null !== d.panel && Array.isArray(d.panel.itemArray)) {
var r = d.itemIndex, q = d.panel.itemArray;
k.zv(q, r);
k.Ys(q, r, p)
}
}
} catch (u) {
}
} finally {
this.Zt.remove(a)
}
}
}
};
ma.Object.defineProperties(si.prototype, {
Zi: {
get: function () {
return this.l
}, set: function (a) {
this.v && ua(this);
this.l = a
}
}, targetProperty: {
get: function () {
return this.Pl
}, set: function (a) {
this.v && ua(this);
this.Pl = a
}
}, sourceName: {
get: function () {
return this.xs
}, set: function (a) {
this.v && ua(this);
this.xs = a;
null !== a && (this.Wn = !1)
}
}, isToModel: {
get: function () {
return this.Wn
}, set: function (a) {
this.v &&
ua(this);
this.Wn = a
}
}, sourceProperty: {
get: function () {
return this.Fl
}, set: function (a) {
this.v && ua(this);
this.Fl = a
}
}, converter: {
get: function () {
return this.an
}, set: function (a) {
this.v && ua(this);
this.an = a
}
}, backConverter: {
get: function () {
return this.Vm
}, set: function (a) {
this.v && ua(this);
this.Vm = a
}
}, mode: {
get: function () {
return this.so
}, set: function (a) {
this.v && ua(this);
this.so = a
}
}
});
si.prototype.updateSource = si.prototype.yq;
si.prototype.updateTarget = si.prototype.Zv;
si.prototype.ofModel = si.prototype.Ez;
si.prototype.ofObject = si.prototype.lq;
si.prototype.makeTwoWay = si.prototype.qx;
var Bq = new D(si, "OneWay", 1), Nm = new D(si, "TwoWay", 2);
si.className = "Binding";
si.parseEnum = function (a, b) {
return function (c) {
c = bb(a, c);
return null === c ? b : c
}
};
si.toString = Ja;
si.OneWay = Bq;
si.TwoWay = Nm;
function Cq(a, b) {
Z.call(this);
this.Dt = ',\n "insertedLinkKeys": ';
this.fw = ',\n "modifiedLinkData": ';
this.Ft = ',\n "removedLinkKeys": ';
this.Oc = [];
this.Qf = new F;
this.qb = new vb;
this.ji = "";
this.bj = this.Jk = this.ql = null;
this.Ve = "from";
this.We = "to";
this.vj = this.uj = "";
this.tj = "category";
this.Hd = "";
this.ul = "isGroup";
this.se = "group";
this.dn = !1;
void 0 !== a && (this.nodeDataArray = a);
void 0 !== b && (this.linkDataArray = b)
}
la(Cq, Z);
Cq.constructGraphLinksModel = Z.constructGraphLinksModel;
Cq.prototype.cloneProtected = function (a) {
Z.prototype.cloneProtected.call(this, a);
a.ji = this.ji;
a.ql = this.ql;
a.Jk = this.Jk;
a.Ve = this.Ve;
a.We = this.We;
a.uj = this.uj;
a.vj = this.vj;
a.tj = this.tj;
a.Hd = this.Hd;
a.ul = this.ul;
a.se = this.se;
a.dn = this.dn
};
t = Cq.prototype;
t.clear = function () {
Z.prototype.clear.call(this);
this.Oc = [];
this.qb.clear();
this.Qf.clear()
};
t.toString = function (a) {
void 0 === a && (a = 0);
if (2 <= a) return this.vq();
var b = ("" !== this.name ? this.name : "") + " GraphLinksModel";
if (0 < a) {
b += "\n node data:";
a = this.nodeDataArray;
var c = a.length, d;
for (d = 0; d < c; d++) {
var e = a[d];
b += " " + this.pa(e) + ":" + Ja(e)
}
b += "\n link data:";
a = this.linkDataArray;
c = a.length;
for (d = 0; d < c; d++) e = a[d], b += " " + bq(this, e, !0) + "--\x3e" + bq(this, e, !1)
}
return b
};
t.vk = function () {
var a = Z.prototype.vk.call(this), b = "";
"category" !== this.linkCategoryProperty && "string" === typeof this.linkCategoryProperty && (b += ',\n "linkCategoryProperty": ' + this.quote(this.linkCategoryProperty));
"" !== this.linkKeyProperty && "string" === typeof this.linkKeyProperty && (b += ',\n "linkKeyProperty": ' + this.quote(this.linkKeyProperty));
"from" !== this.linkFromKeyProperty && "string" === typeof this.linkFromKeyProperty && (b += ',\n "linkFromKeyProperty": ' + this.quote(this.linkFromKeyProperty));
"to" !==
this.linkToKeyProperty && "string" === typeof this.linkToKeyProperty && (b += ',\n "linkToKeyProperty": ' + this.quote(this.linkToKeyProperty));
"" !== this.linkFromPortIdProperty && "string" === typeof this.linkFromPortIdProperty && (b += ',\n "linkFromPortIdProperty": ' + this.quote(this.linkFromPortIdProperty));
"" !== this.linkToPortIdProperty && "string" === typeof this.linkToPortIdProperty && (b += ',\n "linkToPortIdProperty": ' + this.quote(this.linkToPortIdProperty));
"" !== this.linkLabelKeysProperty && "string" === typeof this.linkLabelKeysProperty &&
(b += ',\n "linkLabelKeysProperty": ' + this.quote(this.linkLabelKeysProperty));
"isGroup" !== this.nodeIsGroupProperty && "string" === typeof this.nodeIsGroupProperty && (b += ',\n "nodeIsGroupProperty": ' + this.quote(this.nodeIsGroupProperty));
"group" !== this.nodeGroupKeyProperty && "string" === typeof this.nodeGroupKeyProperty && (b += ',\n "nodeGroupKeyProperty": ' + this.quote(this.nodeGroupKeyProperty));
return a + b
};
t.oq = function (a) {
Z.prototype.oq.call(this, a);
a.linkKeyProperty && (this.linkKeyProperty = a.linkKeyProperty);
a.linkFromKeyProperty && (this.linkFromKeyProperty = a.linkFromKeyProperty);
a.linkToKeyProperty && (this.linkToKeyProperty = a.linkToKeyProperty);
a.linkFromPortIdProperty && (this.linkFromPortIdProperty = a.linkFromPortIdProperty);
a.linkToPortIdProperty && (this.linkToPortIdProperty = a.linkToPortIdProperty);
a.linkCategoryProperty && (this.linkCategoryProperty = a.linkCategoryProperty);
a.linkLabelKeysProperty && (this.linkLabelKeysProperty =
a.linkLabelKeysProperty);
a.nodeIsGroupProperty && (this.nodeIsGroupProperty = a.nodeIsGroupProperty);
a.nodeGroupKeyProperty && (this.nodeGroupKeyProperty = a.nodeGroupKeyProperty)
};
t.bw = function () {
var a = Z.prototype.bw.call(this), b = ',\n "linkDataArray": ' + rq(this, this.linkDataArray, !0);
return a + b
};
t.yv = function (a) {
Z.prototype.yv.call(this, a);
a = a.linkDataArray;
Array.isArray(a) && (this.qm(a), this.linkDataArray = a)
};
t.zq = function (a) {
if (!(a instanceof Cq)) return B("Model.computeJsonDifference: newmodel must be a GraphLinksModel"), "";
var b = Z.prototype.zq.call(this, a);
tq(this, a, "linkKeyProperty");
tq(this, a, "linkFromKeyProperty");
tq(this, a, "linkToKeyProperty");
tq(this, a, "linkLabelKeysProperty");
tq(this, a, "nodeIsGroupProperty");
tq(this, a, "nodeGroupKeyProperty");
for (var c = new F, d = new F, e = (new F).addAll(this.qb.iteratorKeys), f = new vb, g = a.linkDataArray, h = g.length, k = 0; k < h; k++) {
var l = g[k], m = a.ic(l);
if (void 0 !== m) {
e.remove(m);
var n = this.yh(m);
null === n ? (c.add(m), d.add(l)) : sq(this, n, l, f) || d.add(l)
} else this.iq(l), m = this.ic(l), c.add(m), d.add(l)
}
a = b;
0 < c.count && (a += this.Dt + rq(this, c.Na(), !0));
0 < d.count && (a += this.fw + rq(this, d.Na(), !0));
0 < e.count && (a += this.Ft + rq(this, e.Na(), !0));
return a
};
t.zt = function (a, b) {
var c = Z.prototype.zt.call(this, a, b), d = this, e = new F, f = new F, g = new F;
a.changes.each(function (a) {
a.model === d && ("linkDataArray" === a.modelChange ? a.change === te ? e.add(a.newValue) : a.change === ue && g.add(a.oldValue) : d.Be(a.object) && f.add(a.object))
});
var h = new F;
e.each(function (a) {
h.add(d.ic(a));
b || f.add(a)
});
var k = new F;
g.each(function (a) {
k.add(d.ic(a));
b && f.add(a)
});
a = c;
0 < h.count && (a += (b ? this.Ft : this.Dt) + rq(this, h.Na(), !0));
0 < f.count && (a += this.fw + rq(this, f.Na(), !0));
0 < k.count && (a += (b ? this.Dt :
this.Ft) + rq(this, k.Na(), !0));
return a
};
t.xv = function (a) {
Z.prototype.xv.call(this, a);
var b = a.insertedLinkKeys;
if (Array.isArray(b)) for (var c = b.length, d = 0; d < c; d++) {
var e = b[d], f = this.yh(e);
null === f && (f = this.Sp({}), this.vt(f, e), this.Di(f))
}
b = a.modifiedLinkData;
if (Array.isArray(b)) for (c = b.length, d = 0; d < c; d++) if (e = b[d], f = this.ic(e), f = this.yh(f), null !== f) for (var g in e) "__gohashid" !== g && g !== this.linkKeyProperty && this.setDataProperty(f, g, e[g]);
a = a.removedLinkKeys;
if (Array.isArray(a)) for (g = a.length, b = 0; b < g; b++) c = this.yh(a[b]), null !== c && this.om(c)
};
t.Tj = function (a, b) {
if (a.change === te) {
var c = a.newParam;
if ("linkDataArray" === a.modelChange) {
a = a.newValue;
if (ya(a) && "number" === typeof c) {
var d = this.ic(a);
b ? (this.Qf.remove(a), this.Oc[c] === a && this.Oc.splice(c, 1), void 0 !== d && this.qb.remove(d)) : (this.Qf.add(a), this.Oc[c] !== a && this.Oc.splice(c, 0, a), void 0 !== d && this.qb.add(d, a))
}
return
}
if ("linkLabelKeys" === a.modelChange) {
d = this.tg(a.object);
Array.isArray(d) && "number" === typeof c && (b ? (c = d.indexOf(a.newValue), 0 <= c && d.splice(c, 1)) : 0 > d.indexOf(a.newValue) && d.splice(c,
0, a.newValue));
return
}
} else if (a.change === ue) {
c = a.oldParam;
if ("linkDataArray" === a.modelChange) {
a = a.oldValue;
ya(a) && "number" === typeof c && (d = this.ic(a), b ? (this.Qf.add(a), this.Oc[c] !== a && this.Oc.splice(c, 0, a), void 0 !== d && this.qb.add(d, a)) : (this.Qf.remove(a), this.Oc[c] === a && this.Oc.splice(c, 1), void 0 !== d && this.qb.remove(d)));
return
}
if ("linkLabelKeys" === a.modelChange) {
d = this.tg(a.object);
Array.isArray(d) && "number" === typeof c && (b ? 0 > d.indexOf(a.newValue) && d.splice(c, 0, a.newValue) : (c = d.indexOf(a.newValue),
0 <= c && d.splice(c, 1)));
return
}
}
Z.prototype.Tj.call(this, a, b)
};
t.hm = function (a) {
if (void 0 !== a) {
var b = this.bj;
if (null !== b) {
var c = this.Qb(a);
null === c && (c = this.copyNodeData(b), zj(c, this.nodeKeyProperty, a), this.kf(c))
}
return a
}
};
t.Zy = function (a) {
return bq(this, a, !0)
};
t.Cx = function (a, b) {
jq(this, a, b, !0)
};
t.dz = function (a) {
return bq(this, a, !1)
};
t.Hx = function (a, b) {
jq(this, a, b, !1)
};
function bq(a, b, c) {
if (null !== b && (a = c ? a.Ve : a.We, "" !== a && (a = Um(b, a), void 0 !== a))) {
if (dq(a)) return a;
B((c ? "FromKey" : "ToKey") + " value for link data " + b + " is not a number or a string: " + a)
}
}
function jq(a, b, c, d) {
null === c && (c = void 0);
if (null !== b) {
var e = d ? a.Ve : a.We;
if ("" !== e) if (c = a.hm(c), a.Be(b)) {
var f = Um(b, e);
f !== c && (hq(a, f, b), zj(b, e, c), null === a.Qb(c) && iq(a, c, b), yq(a, d ? "linkFromKey" : "linkToKey", re, e, b, f, c), "string" === typeof e && a.Ea(b, e))
} else zj(b, e, c)
}
}
t.$y = function (a) {
return aq(this, a, !0)
};
t.Ex = function (a, b) {
kq(this, a, b, !0)
};
t.ez = function (a) {
return aq(this, a, !1)
};
t.Ix = function (a, b) {
kq(this, a, b, !1)
};
function aq(a, b, c) {
if (null === b) return "";
a = c ? a.uj : a.vj;
if ("" === a) return "";
b = Um(b, a);
return void 0 === b ? "" : b
}
function kq(a, b, c, d) {
if (null !== b) {
var e = d ? a.uj : a.vj;
if ("" !== e) if (a.Be(b)) {
var f = Um(b, e);
void 0 === f && (f = "");
f !== c && (zj(b, e, c), yq(a, d ? "linkFromPortId" : "linkToPortId", re, e, b, f, c), "string" === typeof e && a.Ea(b, e))
} else zj(b, e, c)
}
}
t.tg = function (a) {
if (null === a) return Dq;
var b = this.Hd;
if ("" === b) return Dq;
a = Um(a, b);
return void 0 === a ? Dq : a
};
t.Jv = function (a, b) {
if (null !== a) {
var c = this.Hd;
if ("" !== c) if (this.Be(a)) {
var d = Um(a, c);
void 0 === d && (d = Dq);
if (d !== b) {
if (Array.isArray(d)) for (var e = d.length, f = 0; f < e; f++) hq(this, d[f], a);
zj(a, c, b);
e = b.length;
for (f = 0; f < e; f++) {
var g = b[f];
null === this.Qb(g) && iq(this, g, a)
}
yq(this, "linkLabelKeys", re, c, a, d, b);
"string" === typeof c && this.Ea(a, c)
}
} else zj(a, c, b)
}
};
t.Hu = function (a, b) {
if (null !== b && void 0 !== b && null !== a) {
var c = this.Hd;
if ("" !== c) {
var d = Um(a, c);
if (void 0 === d) c = [], c.push(b), this.Jv(a, c); else if (Array.isArray(d)) {
var e = d.indexOf(b);
0 <= e || (e = d.length, d.push(b), this.Be(a) && (null === this.Qb(b) && iq(this, b, a), yq(this, "linkLabelKeys", te, c, a, null, b, null, e)))
} else B(c + " property is not an Array; cannot addLabelKeyForLinkData: " + a)
}
}
};
t.xx = function (a, b) {
if (null !== b && void 0 !== b && null !== a) {
var c = this.Hd;
if ("" !== c) {
var d = Um(a, c);
if (Array.isArray(d)) {
var e = d.indexOf(b);
0 > e || (d.splice(e, 1), this.Be(a) && (hq(this, b, a), yq(this, "linkLabelKeys", ue, c, a, b, null, e, null)))
} else void 0 !== d && B(c + " property is not an Array; cannot removeLabelKeyforLinkData: " + a)
}
}
};
t.ic = function (a) {
if (null !== a) {
var b = this.ji;
if ("" !== b && (b = Um(a, b), void 0 !== b)) {
if (dq(b)) return b;
B("Key value for link data " + a + " is not a number or a string: " + b)
}
}
};
t.vt = function (a, b) {
if (null !== a) {
var c = this.ji;
if ("" !== c) if (this.Be(a)) {
var d = Um(a, c);
d !== b && null === this.yh(b) && (zj(a, c, b), void 0 !== d && this.qb.remove(d), this.qb.add(b, a), yq(this, "linkKey", re, c, a, d, b), "string" === typeof c && this.Ea(a, c))
} else zj(a, c, b)
}
};
t.yh = function (a) {
null === a && B("GraphLinksModel.findLinkDataForKey:key must not be null");
return void 0 !== a && dq(a) ? this.qb.J(a) : null
};
t.iq = function (a) {
if (null !== a) {
var b = this.ji;
if ("" !== b) {
var c = this.ic(a);
if (void 0 === c || this.qb.contains(c)) {
var d = this.ql;
if (null !== d && (c = d(this, a), void 0 !== c && null !== c && !this.qb.contains(c))) {
zj(a, b, c);
return
}
if ("string" === typeof c) {
for (d = 2; this.qb.contains(c + d);) d++;
zj(a, b, c + d)
} else if (void 0 === c || "number" === typeof c) {
for (c = -this.qb.count - 1; this.qb.contains(c);) c--;
zj(a, b, c)
}
}
}
}
};
t.Be = function (a) {
return null === a ? !1 : this.Qf.contains(a)
};
t.Di = function (a) {
null !== a && (ob(a), this.Be(a) || fq(this, a, !0))
};
function fq(a, b, c) {
if ("" !== a.linkKeyProperty) {
var d = a.ic(b);
if (void 0 !== d && a.qb.J(d) === b) return;
a.iq(b);
d = a.ic(b);
if (void 0 === d) {
B("GraphLinksModel.makeLinkDataKeyUnique failed on " + b + ". Data not added to model.");
return
}
a.qb.add(d, b)
}
a.Qf.add(b);
d = null;
c && (d = a.Oc.length, a.Oc.splice(d, 0, b));
yq(a, "linkDataArray", te, "linkDataArray", a, null, b, null, d);
Eq(a, b)
}
t.gy = function (a) {
if (Array.isArray(a)) for (var b = a.length, c = 0; c < b; c++) this.Di(a[c]); else for (a = a.iterator; a.next();) this.Di(a.value)
};
t.om = function (a) {
null !== a && eq(this, a, !0)
};
function eq(a, b, c) {
a.Qf.remove(b);
var d = a.ic(b);
void 0 !== d && a.qb.remove(d);
d = null;
if (c) {
d = a.Oc.indexOf(b);
if (0 > d) return;
a.Oc.splice(d, 1)
}
yq(a, "linkDataArray", ue, "linkDataArray", a, b, null, d, null);
c = bq(a, b, !0);
hq(a, c, b);
c = bq(a, b, !1);
hq(a, c, b);
d = a.tg(b);
if (Array.isArray(d)) for (var e = d.length, f = 0; f < e; f++) c = d[f], hq(a, c, b)
}
t.Lz = function (a) {
if (Array.isArray(a)) for (var b = a.length, c = 0; c < b; c++) this.om(a[c]); else for (a = a.iterator; a.next();) this.om(a.value)
};
t.Bz = function (a) {
if (za(a)) {
for (var b = new F(this.qb.iteratorKeys), c = new F, d = a.length, e = 0; e < d; e++) {
var f = a[e], g = this.ic(f);
if (void 0 !== g) {
c.add(g);
var h = this.yh(g);
null !== h ? this.Sj(h, f) : (h = {}, this.vt(h, g), this.Sj(h, f), this.Di(h))
} else this.Di(f), c.add(this.ic(f))
}
for (a = b.iterator; a.next();) b = a.value, c.contains(b) || (b = this.yh(b)) && this.om(b)
}
};
function Eq(a, b) {
var c = bq(a, b, !0);
c = a.hm(c);
null === a.Qb(c) && iq(a, c, b);
c = bq(a, b, !1);
c = a.hm(c);
null === a.Qb(c) && iq(a, c, b);
var d = a.tg(b);
if (Array.isArray(d)) for (var e = d.length, f = 0; f < e; f++) c = d[f], null === a.Qb(c) && iq(a, c, b)
}
t.Sp = function (a) {
if (null === a) return null;
var b = this.Jk;
a = null !== b ? b(a, this) : zq(this, a, !0);
ya(a) && (ab(a), "" !== this.Ve && zj(a, this.Ve, void 0), "" !== this.We && zj(a, this.We, void 0), "" !== this.Hd && zj(a, this.Hd, []));
return a
};
t.mv = function (a) {
if (null === a) return !1;
var b = this.ul;
return "" === b ? !1 : Um(a, b) ? !0 : !1
};
t.Ni = function (a) {
if (null !== a) {
var b = this.se;
if ("" !== b && (b = Um(a, b), void 0 !== b)) {
if (dq(b)) return b;
B("GroupKey value for node data " + a + " is not a number or a string: " + b)
}
}
};
t.ut = function (a, b) {
null === b && (b = void 0);
if (null !== a) {
var c = this.se;
if ("" !== c) if (this.Pb(a)) {
var d = Um(a, c);
d !== b && (hq(this, d, a), zj(a, c, b), null === this.Qb(b) && iq(this, b, a), yq(this, "nodeGroupKey", re, c, a, d, b), "string" === typeof c && this.Ea(a, c))
} else zj(a, c, b)
}
};
Cq.prototype.copyNodeData = function (a) {
if (null === a) return null;
a = Z.prototype.copyNodeData.call(this, a);
this.Xj || "" === this.se || void 0 === Um(a, this.se) || zj(a, this.se, void 0);
return a
};
Cq.prototype.setDataProperty = function (a, b, c) {
if (this.Pb(a)) if (b === this.nodeKeyProperty) this.wm(a, c); else {
if (b === this.nodeCategoryProperty) {
this.tq(a, c);
return
}
if (b === this.nodeGroupKeyProperty) {
this.ut(a, c);
return
}
} else if (this.Be(a)) {
if (b === this.linkFromKeyProperty) {
jq(this, a, c, !0);
return
}
if (b === this.linkToKeyProperty) {
jq(this, a, c, !1);
return
}
if (b === this.linkFromPortIdProperty) {
kq(this, a, c, !0);
return
}
if (b === this.linkToPortIdProperty) {
kq(this, a, c, !1);
return
}
if (b === this.linkKeyProperty) {
this.vt(a, c);
return
}
if (b === this.linkCategoryProperty) {
this.tt(a, c);
return
}
if (b === this.linkLabelKeysProperty) {
this.Jv(a, c);
return
}
}
var d = Um(a, b);
d !== c && (zj(a, b, c), this.mt(a, b, d, c))
};
t = Cq.prototype;
t.Sj = function (a, b) {
if (b) {
var c = this.Pb(a), d = this.Be(a), e;
for (e in b) "__gohashid" === e || c && e === this.nodeKeyProperty || d && e === this.linkKeyProperty || this.setDataProperty(a, e, b[e])
}
};
t.rq = function (a, b) {
Z.prototype.rq.call(this, a, b);
for (var c = this.cb.iterator; c.next();) this.Dv(c.value, a, b);
for (c = this.Qf.iterator; c.next();) {
var d = c.value, e = a, f = b;
if (bq(this, d, !0) === e) {
var g = this.Ve;
zj(d, g, f);
yq(this, "linkFromKey", re, g, d, e, f);
"string" === typeof g && this.Ea(d, g)
}
bq(this, d, !1) === e && (g = this.We, zj(d, g, f), yq(this, "linkToKey", re, g, d, e, f), "string" === typeof g && this.Ea(d, g));
g = this.tg(d);
if (Array.isArray(g)) for (var h = g.length, k = this.Hd, l = 0; l < h; l++) g[l] === e && (g[l] = f, yq(this, "linkLabelKeys", te,
k, d, e, f, l, l))
}
};
t.Dv = function (a, b, c) {
if (this.Ni(a) === b) {
var d = this.se;
zj(a, d, c);
yq(this, "nodeGroupKey", re, d, a, b, c);
"string" === typeof d && this.Ea(a, d)
}
};
t.Yv = function () {
Z.prototype.Yv.call(this);
for (var a = this.linkDataArray, b = a.length, c = 0; c < b; c++) Eq(this, a[c])
};
t.sm = function (a) {
Z.prototype.sm.call(this, a);
a = this.pa(a);
var b = gq(this, a);
if (null !== b) {
var c = Da();
for (b = b.iterator; b.next();) {
var d = b.value;
if (this.Pb(d)) {
if (this.Ni(d) === a) {
var e = this.se;
yq(this, "nodeGroupKey", re, e, d, a, a);
"string" === typeof e && this.Ea(d, e);
c.push(d)
}
} else if (bq(this, d, !0) === a && (e = this.Ve, yq(this, "linkFromKey", re, e, d, a, a), "string" === typeof e && this.Ea(d, e), c.push(d)), bq(this, d, !1) === a && (e = this.We, yq(this, "linkToKey", re, e, d, a, a), "string" === typeof e && this.Ea(d, e), c.push(d)), e = this.tg(d),
Array.isArray(e)) for (var f = e.length, g = this.Hd, h = 0; h < f; h++) e[h] === a && (yq(this, "linkLabelKeys", te, g, d, a, a, h, h), c.push(d))
}
for (b = 0; b < c.length; b++) hq(this, a, c[b]);
Ga(c)
}
};
t.rm = function (a) {
Z.prototype.rm.call(this, a);
var b = this.Ni(a);
null === this.Qb(b) && iq(this, b, a)
};
t.wq = function (a) {
Z.prototype.wq.call(this, a);
var b = this.Ni(a);
hq(this, b, a)
};
t.cv = function (a) {
if (null === a) return "";
var b = this.tj;
if ("" === b) return "";
b = Um(a, b);
if (void 0 === b) return "";
if ("string" === typeof b) return b;
B("getCategoryForLinkData found a non-string category for " + a + ": " + b);
return ""
};
Cq.prototype.getLinkCategoryForData = function (a) {
return this.cv(a)
};
Cq.prototype.tt = function (a, b) {
if (null !== a) {
var c = this.tj;
if ("" !== c) if (this.Be(a)) {
var d = Um(a, c);
void 0 === d && (d = "");
d !== b && (zj(a, c, b), yq(this, "linkCategory", re, c, a, d, b), "string" === typeof c && this.Ea(a, c))
} else zj(a, c, b)
}
};
Cq.prototype.setLinkCategoryForData = function (a, b) {
this.tt(a, b)
};
Cq.prototype.ek = function () {
return !0
};
Cq.prototype.fm = function () {
return !0
};
Cq.prototype.dt = function () {
return !0
};
Cq.prototype.fk = function () {
return !0
};
ma.Object.defineProperties(Cq.prototype, {
archetypeNodeData: {
get: function () {
return this.bj
}, set: function (a) {
var b = this.bj;
b !== a && (this.bj = a, this.g("archetypeNodeData", b, a))
}
}, linkFromKeyProperty: {
get: function () {
return this.Ve
}, set: function (a) {
var b = this.Ve;
b !== a && (this.Ve = a, this.g("linkFromKeyProperty", b, a))
}
}, linkToKeyProperty: {
get: function () {
return this.We
}, set: function (a) {
var b = this.We;
b !== a && (this.We = a, this.g("linkToKeyProperty",
b, a))
}
}, linkFromPortIdProperty: {
get: function () {
return this.uj
}, set: function (a) {
var b = this.uj;
b !== a && (this.uj = a, this.g("linkFromPortIdProperty", b, a))
}
}, linkToPortIdProperty: {
get: function () {
return this.vj
}, set: function (a) {
var b = this.vj;
b !== a && (this.vj = a, this.g("linkToPortIdProperty", b, a))
}
}, linkLabelKeysProperty: {
get: function () {
return this.Hd
}, set: function (a) {
var b = this.Hd;
b !== a && (this.Hd = a, this.g("linkLabelKeysProperty",
b, a))
}
}, linkDataArray: {
get: function () {
return this.Oc
}, set: function (a) {
var b = this.Oc;
if (b !== a) {
this.qb.clear();
for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
if (!ya(e)) {
B("GraphLinksModel.linkDataArray must only contain Objects, not: " + e);
return
}
ob(e)
}
this.Oc = a;
if ("" !== this.linkKeyProperty) {
d = new E;
for (e = 0; e < c; e++) {
var f = a[e], g = this.ic(f);
void 0 === g ? d.add(f) : null !== this.qb.J(g) ? d.add(f) : this.qb.add(g, f)
}
for (d = d.iterator; d.next();) e = d.value, this.iq(e), f = this.ic(e), void 0 !==
f && this.qb.add(f, e)
}
d = new F;
for (e = 0; e < c; e++) d.add(a[e]);
this.Qf = d;
yq(this, "linkDataArray", re, "linkDataArray", this, b, a);
for (b = 0; b < c; b++) Eq(this, a[b])
}
}
}, linkKeyProperty: {
get: function () {
return this.ji
}, set: function (a) {
var b = this.ji;
if (b !== a) {
this.ji = a;
this.qb.clear();
for (var c = this.linkDataArray.length, d = 0; d < c; d++) {
var e = this.linkDataArray[d], f = this.ic(e);
void 0 === f && (this.iq(e), f = this.ic(e));
void 0 !== f && this.qb.add(f, e)
}
this.g("linkKeyProperty", b, a)
}
}
}, makeUniqueLinkKeyFunction: {
get: function () {
return this.ql
}, set: function (a) {
var b = this.ql;
b !== a && (this.ql = a, this.g("makeUniqueLinkKeyFunction", b, a))
}
}, copyLinkDataFunction: {
get: function () {
return this.Jk
}, set: function (a) {
var b = this.Jk;
b !== a && (this.Jk = a, this.g("copyLinkDataFunction", b, a))
}
}, nodeIsGroupProperty: {
get: function () {
return this.ul
}, set: function (a) {
var b = this.ul;
b !== a && (this.ul = a, this.g("nodeIsGroupProperty", b, a))
}
}, nodeGroupKeyProperty: {
get: function () {
return this.se
}, set: function (a) {
var b = this.se;
b !== a && (this.se = a, this.g("nodeGroupKeyProperty", b, a))
}
}, Xj: {
get: function () {
return this.dn
}, set: function (a) {
this.dn !== a && (this.dn = a)
}
}, linkCategoryProperty: {
get: function () {
return this.tj
}, set: function (a) {
var b = this.tj;
b !== a && (this.tj = a, this.g("linkCategoryProperty", b, a))
}
}
});
ma.Object.defineProperties(Cq, {
type: {
get: function () {
return "GraphLinksModel"
}
}
});
Cq.prototype.setCategoryForLinkData = Cq.prototype.tt;
Cq.prototype.getCategoryForLinkData = Cq.prototype.cv;
Cq.prototype.assignAllDataProperties = Cq.prototype.Sj;
Cq.prototype.setGroupKeyForNodeData = Cq.prototype.ut;
Cq.prototype.getGroupKeyForNodeData = Cq.prototype.Ni;
Cq.prototype.isGroupForNodeData = Cq.prototype.mv;
Cq.prototype.copyLinkData = Cq.prototype.Sp;
Cq.prototype.mergeLinkDataArray = Cq.prototype.Bz;
Cq.prototype.removeLinkDataCollection = Cq.prototype.Lz;
Cq.prototype.removeLinkData = Cq.prototype.om;
Cq.prototype.addLinkDataCollection = Cq.prototype.gy;
Cq.prototype.addLinkData = Cq.prototype.Di;
Cq.prototype.containsLinkData = Cq.prototype.Be;
Cq.prototype.makeLinkDataKeyUnique = Cq.prototype.iq;
Cq.prototype.findLinkDataForKey = Cq.prototype.yh;
Cq.prototype.setKeyForLinkData = Cq.prototype.vt;
Cq.prototype.getKeyForLinkData = Cq.prototype.ic;
Cq.prototype.removeLabelKeyForLinkData = Cq.prototype.xx;
Cq.prototype.addLabelKeyForLinkData = Cq.prototype.Hu;
Cq.prototype.setLabelKeysForLinkData = Cq.prototype.Jv;
Cq.prototype.getLabelKeysForLinkData = Cq.prototype.tg;
Cq.prototype.setToPortIdForLinkData = Cq.prototype.Ix;
Cq.prototype.getToPortIdForLinkData = Cq.prototype.ez;
Cq.prototype.setFromPortIdForLinkData = Cq.prototype.Ex;
Cq.prototype.getFromPortIdForLinkData = Cq.prototype.$y;
Cq.prototype.setToKeyForLinkData = Cq.prototype.Hx;
Cq.prototype.getToKeyForLinkData = Cq.prototype.dz;
Cq.prototype.setFromKeyForLinkData = Cq.prototype.Cx;
Cq.prototype.getFromKeyForLinkData = Cq.prototype.Zy;
Cq.prototype.clear = Cq.prototype.clear;
var Dq = Object.freeze([]);
Cq.className = "GraphLinksModel";
wq.GraphLinksModel = Cq;
Z.constructGraphLinksModel = Z.constructGraphLinksModel = function () {
return new Cq
};
Z.initDiagramModel = fi = function () {
return new Cq
};
function Fq(a) {
Z.call(this);
this.te = "parent";
this.fn = !1;
this.Bj = "parentLinkCategory";
void 0 !== a && (this.nodeDataArray = a)
}
la(Fq, Z);
Fq.constructGraphLinksModel = Z.constructGraphLinksModel;
Fq.prototype.cloneProtected = function (a) {
Z.prototype.cloneProtected.call(this, a);
a.te = this.te;
a.fn = this.fn;
a.Bj = this.Bj
};
t = Fq.prototype;
t.toString = function (a) {
void 0 === a && (a = 0);
if (2 <= a) return this.vq();
var b = ("" !== this.name ? this.name : "") + " TreeModel";
if (0 < a) {
b += "\n node data:";
a = this.nodeDataArray;
for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
b += " " + this.pa(e) + ":" + Ja(e)
}
}
return b
};
t.vk = function () {
var a = Z.prototype.vk.call(this), b = "";
"parent" !== this.nodeParentKeyProperty && "string" === typeof this.nodeParentKeyProperty && (b += ',\n "nodeParentKeyProperty": ' + this.quote(this.nodeParentKeyProperty));
return a + b
};
t.oq = function (a) {
Z.prototype.oq.call(this, a);
a.nodeParentKeyProperty && (this.nodeParentKeyProperty = a.nodeParentKeyProperty)
};
t.zq = function (a) {
tq(this, a, "nodeParentKeyProperty");
return Z.prototype.zq.call(this, a)
};
t.hm = function (a) {
return a
};
t.Pi = function (a) {
if (null !== a) {
var b = this.te;
if ("" !== b && (b = Um(a, b), void 0 !== b)) {
if (dq(b)) return b;
B("ParentKey value for node data " + a + " is not a number or a string: " + b)
}
}
};
t.Ie = function (a, b) {
null === b && (b = void 0);
if (null !== a) {
var c = this.te;
if ("" !== c) if (b = this.hm(b), this.Pb(a)) {
var d = Um(a, c);
d !== b && (hq(this, d, a), zj(a, c, b), null === this.Qb(b) && iq(this, b, a), yq(this, "nodeParentKey", re, c, a, d, b), "string" === typeof c && this.Ea(a, c))
} else zj(a, c, b)
}
};
t.dv = function (a) {
if (null === a) return "";
var b = this.Bj;
if ("" === b) return "";
b = Um(a, b);
if (void 0 === b) return "";
if ("string" === typeof b) return b;
B("getParentLinkCategoryForNodeData found a non-string category for " + a + ": " + b);
return ""
};
Fq.prototype.getLinkCategoryForData = function (a) {
return this.dv(a)
};
Fq.prototype.Kv = function (a, b) {
if (null !== a) {
var c = this.Bj;
if ("" !== c) if (this.Pb(a)) {
var d = Um(a, c);
void 0 === d && (d = "");
d !== b && (zj(a, c, b), yq(this, "parentLinkCategory", re, c, a, d, b), "string" === typeof c && this.Ea(a, c))
} else zj(a, c, b)
}
};
Fq.prototype.setLinkCategoryForData = function (a, b) {
this.Kv(a, b)
};
Fq.prototype.copyNodeData = function (a) {
if (null === a) return null;
a = Z.prototype.copyNodeData.call(this, a);
this.Yj || "" === this.te || void 0 === Um(a, this.te) || zj(a, this.te, void 0);
return a
};
Fq.prototype.setDataProperty = function (a, b, c) {
if (this.Pb(a)) if (b === this.nodeKeyProperty) this.wm(a, c); else {
if (b === this.nodeCategoryProperty) {
this.tq(a, c);
return
}
if (b === this.nodeParentKeyProperty) {
this.Ie(a, c);
return
}
}
var d = Um(a, b);
d !== c && (zj(a, b, c), this.mt(a, b, d, c))
};
t = Fq.prototype;
t.rq = function (a, b) {
Z.prototype.rq.call(this, a, b);
for (var c = this.cb.iterator; c.next();) this.Dv(c.value, a, b)
};
t.Dv = function (a, b, c) {
if (this.Pi(a) === b) {
var d = this.te;
zj(a, d, c);
yq(this, "nodeParentKey", re, d, a, b, c);
"string" === typeof d && this.Ea(a, d)
}
};
t.sm = function (a) {
Z.prototype.sm.call(this, a);
a = this.pa(a);
var b = gq(this, a);
if (null !== b) {
var c = Da();
for (b = b.iterator; b.next();) {
var d = b.value;
if (this.Pb(d) && this.Pi(d) === a) {
var e = this.te;
yq(this, "nodeParentKey", re, e, d, a, a);
"string" === typeof e && this.Ea(d, e);
c.push(d)
}
}
for (b = 0; b < c.length; b++) hq(this, a, c[b]);
Ga(c)
}
};
t.rm = function (a) {
Z.prototype.rm.call(this, a);
var b = this.Pi(a);
b = this.hm(b);
null === this.Qb(b) && iq(this, b, a)
};
t.wq = function (a) {
Z.prototype.wq.call(this, a);
var b = this.Pi(a);
hq(this, b, a)
};
t.gm = function () {
return !0
};
t.dt = function () {
return !0
};
ma.Object.defineProperties(Fq.prototype, {
nodeParentKeyProperty: {
get: function () {
return this.te
}, set: function (a) {
var b = this.te;
b !== a && (this.te = a, this.g("nodeParentKeyProperty", b, a))
}
}, Yj: {
get: function () {
return this.fn
}, set: function (a) {
this.fn !== a && (this.fn = a)
}
}, parentLinkCategoryProperty: {
get: function () {
return this.Bj
}, set: function (a) {
var b = this.Bj;
b !== a && (this.Bj = a, this.g("parentLinkCategoryProperty", b, a))
}
},
linkCategoryProperty: {
get: function () {
return this.parentLinkCategoryProperty
}, set: function (a) {
this.parentLinkCategoryProperty = a
}
}
});
ma.Object.defineProperties(Fq, {
type: {
get: function () {
return "TreeModel"
}
}
});
Fq.prototype.setParentLinkCategoryForNodeData = Fq.prototype.Kv;
Fq.prototype.getParentLinkCategoryForNodeData = Fq.prototype.dv;
Fq.prototype.setParentKeyForNodeData = Fq.prototype.Ie;
Fq.prototype.getParentKeyForNodeData = Fq.prototype.Pi;
Fq.className = "TreeModel";
wq.TreeModel = Fq;
function Gq() {
gi.call(this);
this.vw = this.zn = this.Xb = 0;
this.kr = 360;
this.uw = Hq;
this.hj = 0;
this.hw = new G;
this.Xq = this.Rd = 0;
this.Hs = new Iq;
this.Mt = this.Aj = 0;
this.Ux = 600;
this.Uo = NaN;
this.Sm = 1;
this.wp = 0;
this.Ll = 360;
this.Ab = Hq;
this.L = Jq;
this.Qc = Kq;
this.Mc = Fp;
this.af = 6;
this.Eo = Lq
}
la(Gq, gi);
Gq.prototype.cloneProtected = function (a) {
gi.prototype.cloneProtected.call(this, a);
a.Uo = this.Uo;
a.Sm = this.Sm;
a.wp = this.wp;
a.Ll = this.Ll;
a.Ab = this.Ab;
a.L = this.L;
a.Qc = this.Qc;
a.Mc = this.Mc;
a.af = this.af;
a.Eo = this.Eo
};
Gq.prototype.fb = function (a) {
if (a.classType === Gq) if (a === Mq || a === Oq || a === Pq || a === Qq || a === Kq) this.sorting = a; else if (a === Rq || a === Sq || a === Jq || a === Tq) this.direction = a; else if (a === Uq || a === Vq || a === Hq || a === Wq) this.arrangement = a; else {
if (a === Xq || a === Lq) this.nodeDiameterFormula = a
} else gi.prototype.fb.call(this, a)
};
Gq.prototype.createNetwork = function () {
return new Yq(this)
};
Gq.prototype.doLayout = function (a) {
null === this.network && (this.network = this.makeNetwork(a));
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
a = this.network.vertexes;
if (1 >= a.count) 1 === a.count && (a = a.first(), a.centerX = 0, a.centerY = 0); else {
var b = new E;
b.addAll(a.iterator);
a = new E;
var c = new E;
var d = this.sort(b);
var e, f, g = this.Xq;
var h = this.arrangement;
var k = this.nodeDiameterFormula;
var l = this.radius;
if (!isFinite(l) || 0 >= l) l = NaN;
var m = this.aspectRatio;
if (!isFinite(m) || 0 >= m) m = 1;
var n = this.startAngle;
isFinite(n) || (n = 0);
var p = this.sweepAngle;
if (!isFinite(p) || 360 < p || 1 > p) p = 360;
b = this.spacing;
isFinite(b) || (b = NaN);
h === Wq && k === Xq ? h = Hq : h === Wq && k !== Xq && (h = this.arrangement);
if ((this.direction === Rq || this.direction === Sq) && this.sorting !== Kq) {
for (k = 0; !(k >= d.length); k += 2) {
a.add(d.N(k));
if (k + 1 >= d.length) break;
c.add(d.N(k + 1))
}
this.direction === Rq ? (this.arrangement === Wq && a.reverse(), d = new E, d.addAll(a), d.addAll(c)) : (this.arrangement === Wq && c.reverse(), d = new E, d.addAll(c), d.addAll(a))
}
k = d.length;
for (var r = f = e = 0; r <
d.length; r++) {
var q = n + p * f * (this.direction === Jq ? 1 : -1) / k, u = d.N(r).diameter;
isNaN(u) && (u = Zq(d.N(r), q));
360 > p && (0 === r || r === d.length - 1) && (u /= 2);
e += u;
f++
}
if (isNaN(l) || h === Wq) {
isNaN(b) && (b = 6);
if (h !== Hq && h !== Wq) {
f = -Infinity;
for (g = 0; g < k; g++) r = d.N(g), e = d.N(g === k - 1 ? 0 : g + 1), isNaN(r.diameter) && Zq(r, 0), isNaN(e.diameter) && Zq(e, 0), f = Math.max(f, (r.diameter + e.diameter) / 2);
g = f + b;
h === Uq ? l = (f + b) / (2 * Math.PI / k) : l = $q(this, g * (360 <= p ? k : k - 1), m, n * Math.PI / 180, p * Math.PI / 180)
} else l = $q(this, e + (360 <= p ? k : k - 1) * (h !== Wq ? b : 1.6 * b), m, n *
Math.PI / 180, p * Math.PI / 180);
f = l * m
} else if (f = l * m, r = ar(this, l, f, n * Math.PI / 180, p * Math.PI / 180), isNaN(b)) {
if (h === Hq || h === Wq) b = (r - e) / (360 <= p ? k : k - 1)
} else if (h === Hq || h === Wq) r = (r - e) / (360 <= p ? k : k - 1), r < b ? (l = $q(this, e + b * (360 <= p ? k : k - 1), m, n * Math.PI / 180, p * Math.PI / 180), f = l * m) : b = r; else {
g = -Infinity;
for (e = 0; e < k; e++) q = d.N(e), u = d.N(e === k - 1 ? 0 : e + 1), isNaN(q.diameter) && Zq(q, 0), isNaN(u.diameter) && Zq(u, 0), g = Math.max(g, (q.diameter + u.diameter) / 2);
g += b;
e = $q(this, g * (360 <= p ? k : k - 1), m, n * Math.PI / 180, p * Math.PI / 180);
e > l ? (l = e, f = l * m) : g =
r / (360 <= p ? k : k - 1)
}
this.uw = h;
this.Xb = l;
this.zn = m;
this.vw = n;
this.kr = p;
this.hj = b;
this.Rd = f;
this.Xq = g;
b = d;
d = this.uw;
h = this.Xb;
l = this.vw;
m = this.kr;
n = this.hj;
p = this.Rd;
k = this.Xq;
if (this.direction !== Rq && this.direction !== Sq || d !== Wq) if (this.direction === Rq || this.direction === Sq) {
g = 0;
switch (d) {
case Vq:
g = 180 * br(this, h, p, l, k) / Math.PI;
break;
case Hq:
k = b = 0;
g = a.first();
null !== g && (b = Zq(g, Math.PI / 2));
g = c.first();
null !== g && (k = Zq(g, Math.PI / 2));
g = 180 * br(this, h, p, l, n + (b + k) / 2) / Math.PI;
break;
case Uq:
g = m / b.length
}
if (this.direction ===
Rq) {
switch (d) {
case Vq:
cr(this, a, l, Tq);
break;
case Hq:
dr(this, a, l, Tq);
break;
case Uq:
er(this, a, m / 2, l, Tq)
}
switch (d) {
case Vq:
cr(this, c, l + g, Jq);
break;
case Hq:
dr(this, c, l + g, Jq);
break;
case Uq:
er(this, c, m / 2, l + g, Jq)
}
} else {
switch (d) {
case Vq:
cr(this, c, l, Tq);
break;
case Hq:
dr(this, c, l, Tq);
break;
case Uq:
er(this, c, m / 2, l, Tq)
}
switch (d) {
case Vq:
cr(this, a, l + g, Jq);
break;
case Hq:
dr(this, a, l + g, Jq);
break;
case Uq:
er(this, a, m / 2, l + g, Jq)
}
}
} else switch (d) {
case Vq:
cr(this, b, l, this.direction);
break;
case Hq:
dr(this, b, l, this.direction);
break;
case Uq:
er(this, b, m, l, this.direction);
break;
case Wq:
fr(this, b, m, l, this.direction)
} else fr(this, b, m, l - m / 2, Jq)
}
this.updateParts();
this.network = null;
this.isValidLayout = !0
};
function er(a, b, c, d, e) {
var f = a.kr, g = a.Xb;
a = a.Rd;
d = d * Math.PI / 180;
c = c * Math.PI / 180;
for (var h = b.length, k = 0; k < h; k++) {
var l = d + (e === Jq ? k * c / (360 <= f ? h : h - 1) : -(k * c) / h), m = b.N(k), n = g * Math.tan(l) / a;
n = Math.sqrt((g * g + a * a * n * n) / (1 + n * n));
m.centerX = n * Math.cos(l);
m.centerY = n * Math.sin(l);
m.actualAngle = 180 * l / Math.PI
}
}
function dr(a, b, c, d) {
var e = a.Xb, f = a.Rd, g = a.hj;
c = c * Math.PI / 180;
for (var h = b.length, k = 0; k < h; k++) {
var l = b.N(k), m = b.N(k === h - 1 ? 0 : k + 1), n = f * Math.sin(c);
l.centerX = e * Math.cos(c);
l.centerY = n;
l.actualAngle = 180 * c / Math.PI;
isNaN(l.diameter) && Zq(l, 0);
isNaN(m.diameter) && Zq(m, 0);
l = br(a, e, f, d === Jq ? c : -c, (l.diameter + m.diameter) / 2 + g);
c += d === Jq ? l : -l
}
}
function cr(a, b, c, d) {
var e = a.Xb, f = a.Rd, g = a.Xq;
c = c * Math.PI / 180;
for (var h = b.length, k = 0; k < h; k++) {
var l = b.N(k);
l.centerX = e * Math.cos(c);
l.centerY = f * Math.sin(c);
l.actualAngle = 180 * c / Math.PI;
l = br(a, e, f, d === Jq ? c : -c, g);
c += d === Jq ? l : -l
}
}
function fr(a, b, c, d, e) {
var f = a.kr;
a.Aj = 0;
a.Hs = new Iq;
if (360 > c) {
for (f = d + (e === Jq ? f : -f); 0 > f;) f += 360;
f %= 360;
180 < f && (f -= 360);
f *= Math.PI / 180;
a.Mt = f;
gr(a, b, c, d, e)
} else hr(a, b, c, d, e);
a.Hs.commit(b)
}
function hr(a, b, c, d, e) {
var f = a.Xb, g = a.hj, h = a.zn, k = f * Math.cos(d * Math.PI / 180), l = a.Rd * Math.sin(d * Math.PI / 180),
m = b.Na();
if (3 === m.length) m[0].centerX = f, m[0].centerY = 0, m[1].centerX = m[0].centerX - m[0].width / 2 - m[1].width / 2 - g, m[1].y = m[0].y, m[2].centerX = (m[0].centerX + m[1].centerX) / 2, m[2].y = m[0].y - m[2].height - g; else if (4 === m.length) m[0].centerX = f, m[0].centerY = 0, m[2].centerX = -m[0].centerX, m[2].centerY = m[0].centerY, m[1].centerX = 0, m[1].y = Math.min(m[0].y, m[2].y) - m[1].height - g, m[3].centerX = 0, m[3].y = Math.max(m[0].y +
m[0].height + g, m[2].y + m[2].height + g); else {
f = G.alloc();
for (var n = 0; n < m.length; n++) {
m[n].centerX = k;
m[n].centerY = l;
if (n >= m.length - 1) break;
ir(a, k, l, m, n, e, f) || jr(a, k, l, m, n, e, f);
k = f.x;
l = f.y
}
G.free(f);
a.Aj++;
if (!(23 < a.Aj)) {
k = m[0].centerX;
l = m[0].centerY;
f = m[m.length - 1].centerX;
n = m[m.length - 1].centerY;
var p = Math.abs(k - f) - ((m[0].width + m[m.length - 1].width) / 2 + g),
r = Math.abs(l - n) - ((m[0].height + m[m.length - 1].height) / 2 + g);
g = 0;
1 > Math.abs(r) ? Math.abs(k - f) < (m[0].width + m[m.length - 1].width) / 2 && (g = 0) : g = 0 < r ? r : 1 > Math.abs(p) ?
0 : p;
k = Math.abs(f) > Math.abs(n) ? 0 < f !== l > n : 0 < n !== k < f;
if (k = e === Jq ? k : !k) g = -Math.abs(g), g = Math.min(g, -m[m.length - 1].width), g = Math.min(g, -m[m.length - 1].height);
a.Hs.compare(g, m);
1 < Math.abs(g) && (a.Xb = 8 > a.Aj ? a.Xb - g / (2 * Math.PI) : 5 > m.length && 10 < g ? a.Xb / 2 : a.Xb - (0 < g ? 1.7 : -2.3), a.Rd = a.Xb * h, hr(a, b, c, d, e))
}
}
}
function gr(a, b, c, d, e) {
for (var f = a.Xb, g = a.Rd, h = a.zn, k = f * Math.cos(d * Math.PI / 180), l = g * Math.sin(d * Math.PI / 180), m = G.alloc(), n = b.Na(), p = 0; p < n.length; p++) {
n[p].centerX = k;
n[p].centerY = l;
if (p >= n.length - 1) break;
ir(a, k, l, n, p, e, m) || jr(a, k, l, n, p, e, m);
k = m.x;
l = m.y
}
G.free(m);
a.Aj++;
if (!(23 < a.Aj)) {
k = Math.atan2(l, k);
k = e === Jq ? a.Mt - k : k - a.Mt;
k = Math.abs(k) < Math.abs(k - 2 * Math.PI) ? k : k - 2 * Math.PI;
f = k * (f + g) / 2;
g = a.Hs;
if (Math.abs(f) < Math.abs(g.bm)) for (g.bm = f, g.wk = [], g.Bm = [], k = 0; k < n.length; k++) g.wk[k] = n[k].bounds.x, g.Bm[k] = n[k].bounds.y;
1 < Math.abs(f) && (a.Xb = 8 > a.Aj ? a.Xb - f / (2 * Math.PI) : a.Xb - (0 < f ? 1.7 : -2.3), a.Rd = a.Xb * h, gr(a, b, c, d, e))
}
}
function ir(a, b, c, d, e, f, g) {
var h = a.Xb, k = a.Rd, l = 0;
a = (d[e].width + d[e + 1].width) / 2 + a.hj;
var m = !1;
if (0 <= c !== (f === Jq)) {
if (f = b + a, f > h) {
f = b - a;
if (f < -h) return g.x = f, g.y = l, !1;
m = !0
}
} else if (f = b - a, f < -h) {
f = b + a;
if (f > h) return g.x = f, g.y = l, !1;
m = !0
}
l = Math.sqrt(1 - Math.min(1, f * f / (h * h))) * k;
0 > c !== m && (l = -l);
if (Math.abs(c - l) > (d[e].height + d[e + 1].height) / 2) return g.x = f, g.y = l, !1;
g.x = f;
g.y = l;
return !0
}
function jr(a, b, c, d, e, f, g) {
var h = a.Xb, k = a.Rd, l = 0;
a = (d[e].height + d[e + 1].height) / 2 + a.hj;
d = !1;
if (0 <= b !== (f === Jq)) {
if (f = c - a, f < -k) {
f = c + a;
if (f > k) {
g.x = l;
g.y = f;
return
}
d = !0
}
} else if (f = c + a, f > k) {
f = c - a;
if (f < -k) {
g.x = l;
g.y = f;
return
}
d = !0
}
l = Math.sqrt(1 - Math.min(1, f * f / (k * k))) * h;
0 > b !== d && (l = -l);
g.x = l;
g.y = f
}
Gq.prototype.commitLayout = function () {
this.commitNodes();
this.isRouting && this.commitLinks()
};
Gq.prototype.commitNodes = function () {
var a = null !== this.group && null !== this.group.placeholder && this.group.isSubGraphExpanded,
b = a ? this.group.location.copy() : null, c = this.actualCenter;
a ? c = new G(0, 0) : (c.x = this.arrangementOrigin.x + this.Xb, c.y = this.arrangementOrigin.y + this.Rd);
for (var d = this.network.vertexes.iterator; d.next();) {
var e = d.value;
e.x += c.x;
e.y += c.y;
e.commit()
}
a && (this.group.$b(), a = this.group.position.copy(), c = this.group.location.copy(), b = b.Xd(c.Xd(a)), this.group.move(b), this.hw = b.Xd(a))
};
Gq.prototype.commitLinks = function () {
for (var a = this.network.edges.iterator; a.next();) a.value.commit()
};
function ar(a, b, c, d, e) {
var f = a.Ux;
if (.001 > Math.abs(a.zn - 1)) return void 0 !== d && void 0 !== e ? e * b : 2 * Math.PI * b;
a = b > c ? Math.sqrt(b * b - c * c) / b : Math.sqrt(c * c - b * b) / c;
var g = 0;
var h = void 0 !== d && void 0 !== e ? e / (f + 1) : Math.PI / (2 * (f + 1));
for (var k = 0, l = 0; l <= f; l++) {
void 0 !== d && void 0 !== e ? k = d + l * e / f : k = l * Math.PI / (2 * f);
var m = Math.sin(k);
g += Math.sqrt(1 - a * a * m * m) * h
}
return void 0 !== d && void 0 !== e ? (b > c ? b : c) * g : 4 * (b > c ? b : c) * g
}
function $q(a, b, c, d, e) {
return b / (void 0 !== d && void 0 !== e ? ar(a, 1, c, d, e) : ar(a, 1, c))
}
function br(a, b, c, d, e) {
if (.001 > Math.abs(a.zn - 1)) return e / b;
var f = b > c ? Math.sqrt(b * b - c * c) / b : Math.sqrt(c * c - b * b) / c, g = 0;
a = 2 * Math.PI / (700 * a.network.vertexes.count);
b > c && (d += Math.PI / 2);
for (var h = 0; ; h++) {
var k = Math.sin(d + h * a);
g += (b > c ? b : c) * Math.sqrt(1 - f * f * k * k) * a;
if (g >= e) return h * a
}
}
Gq.prototype.sort = function (a) {
switch (this.sorting) {
case Pq:
break;
case Qq:
a.reverse();
break;
case Mq:
a.sort(this.comparer);
break;
case Oq:
a.sort(this.comparer);
a.reverse();
break;
case Kq:
for (var b = [], c = 0; c < a.length; c++) b.push(0);
c = new E;
for (var d = 0; d < a.length; d++) {
var e = -1, f = -1;
if (0 === d) for (var g = 0; g < a.length; g++) {
var h = a.N(g).edgesCount;
h > e && (e = h, f = g)
} else for (g = 0; g < a.length; g++) h = b[g], h > e && (e = h, f = g);
c.add(a.N(f));
b[f] = -1;
f = a.N(f);
for (g = f.sourceEdges; g.next();) e = a.indexOf(g.value.fromVertex), 0 > e || 0 <=
b[e] && b[e]++;
for (f = f.destinationEdges; f.next();) e = a.indexOf(f.value.toVertex), 0 > e || 0 <= b[e] && b[e]++
}
a = [];
for (b = 0; b < c.length; b++) {
e = c.N(b);
a[b] = [];
for (f = e.destinationEdges; f.next();) d = c.indexOf(f.value.toVertex), d !== b && 0 > a[b].indexOf(d) && a[b].push(d);
for (e = e.sourceEdges; e.next();) d = c.indexOf(e.value.fromVertex), d !== b && 0 > a[b].indexOf(d) && a[b].push(d)
}
f = [];
for (b = 0; b < a.length; b++) f[b] = 0;
b = [];
g = [];
h = [];
e = [];
d = new E;
for (var k = 0, l = 0; l < a.length; l++) {
var m = a[l].length;
if (1 === m) e.push(l); else if (0 === m) d.add(c.N(l));
else {
if (0 === k) b.push(l); else {
for (var n = m = Infinity, p = -1, r = [], q = 0; q < b.length; q++) 0 > a[b[q]].indexOf(b[q === b.length - 1 ? 0 : q + 1]) && r.push(q === b.length - 1 ? 0 : q + 1);
if (0 === r.length) for (q = 0; q < b.length; q++) r.push(q);
for (q = 0; q < r.length; q++) {
for (var u = r[q], v = a[l], w = 0, z = 0; z < g.length; z++) {
var y = f[g[z]], A = f[h[z]];
if (y < A) {
var C = y;
y = A
} else C = A;
if (C < u && u <= y) for (A = 0; A < v.length; A++) {
var I = v[A];
0 > b.indexOf(I) || C < f[I] && f[I] < y || C === f[I] || y === f[I] || w++
} else for (A = 0; A < v.length; A++) I = v[A], 0 > b.indexOf(I) || C < f[I] && f[I] < y && C !== f[I] &&
y !== f[I] && w++
}
v = w;
for (z = w = 0; z < a[l].length; z++) C = b.indexOf(a[l][z]), 0 <= C && (C = Math.abs(u - (C >= u ? C + 1 : C)), w += C < b.length + 1 - C ? C : b.length + 1 - C);
for (z = 0; z < g.length; z++) C = f[g[z]], y = f[h[z]], C >= u && C++, y >= u && y++, C > y && (A = y, y = C, C = A), y - C < (b.length + 2) / 2 === (C < u && u <= y) && w++;
if (v < m || v === m && w < n) m = v, n = w, p = u
}
b.splice(p, 0, l);
for (m = 0; m < b.length; m++) f[b[m]] = m;
for (m = 0; m < a[l].length; m++) n = a[l][m], 0 <= b.indexOf(n) && (g.push(l), h.push(n))
}
k++
}
}
for (g = b.length; ;) {
f = !0;
for (h = 0; h < e.length; h++) if (k = e[h], l = a[k][0], m = b.indexOf(l), 0 <= m) {
for (p =
n = 0; p < a[l].length; p++) r = b.indexOf(a[l][p]), 0 > r || r === m || (q = r > m ? r - m : m - r, n += r < m !== q > g - q ? 1 : -1);
b.splice(0 > n ? m : m + 1, 0, k);
e.splice(h, 1);
h--
} else f = !1;
if (f) break; else b.push(e[0]), e.splice(0, 1)
}
for (a = 0; a < b.length; a++) d.add(c.N(b[a]));
return d;
default:
B("Invalid sorting type.")
}
return a
};
ma.Object.defineProperties(Gq.prototype, {
radius: {
get: function () {
return this.Uo
}, set: function (a) {
this.Uo !== a && (0 < a || isNaN(a)) && (this.Uo = a, this.B())
}
}, aspectRatio: {
get: function () {
return this.Sm
}, set: function (a) {
this.Sm !== a && 0 < a && (this.Sm = a, this.B())
}
}, startAngle: {
get: function () {
return this.wp
}, set: function (a) {
this.wp !== a && (this.wp = a, this.B())
}
}, sweepAngle: {
get: function () {
return this.Ll
},
set: function (a) {
this.Ll !== a && (0 < a && 360 >= a ? this.Ll = a : this.Ll = 360, this.B())
}
}, arrangement: {
get: function () {
return this.Ab
}, set: function (a) {
this.Ab === a || a !== Wq && a !== Hq && a !== Vq && a !== Uq || (this.Ab = a, this.B())
}
}, direction: {
get: function () {
return this.L
}, set: function (a) {
this.L === a || a !== Jq && a !== Tq && a !== Rq && a !== Sq || (this.L = a, this.B())
}
}, sorting: {
get: function () {
return this.Qc
}, set: function (a) {
this.Qc === a || a !== Pq && a !== Qq &&
a !== Mq && !Oq && a !== Kq || (this.Qc = a, this.B())
}
}, comparer: {
get: function () {
return this.Mc
}, set: function (a) {
this.Mc !== a && (this.Mc = a, this.B())
}
}, spacing: {
get: function () {
return this.af
}, set: function (a) {
this.af !== a && (this.af = a, this.B())
}
}, nodeDiameterFormula: {
get: function () {
return this.Eo
}, set: function (a) {
this.Eo === a || a !== Lq && a !== Xq || (this.Eo = a, this.B())
}
}, actualXRadius: {
get: function () {
return this.Xb
}
},
actualYRadius: {
get: function () {
return this.Rd
}
}, actualSpacing: {
get: function () {
return this.hj
}
}, actualCenter: {
get: function () {
return this.hw
}
}
});
var Hq = new D(Gq, "ConstantSpacing", 0), Vq = new D(Gq, "ConstantDistance", 1), Uq = new D(Gq, "ConstantAngle", 2),
Wq = new D(Gq, "Packed", 3), Jq = new D(Gq, "Clockwise", 4), Tq = new D(Gq, "Counterclockwise", 5),
Rq = new D(Gq, "BidirectionalLeft", 6), Sq = new D(Gq, "BidirectionalRight", 7), Pq = new D(Gq, "Forwards", 8),
Qq = new D(Gq, "Reverse", 9), Mq = new D(Gq, "Ascending", 10), Oq = new D(Gq, "Descending", 11),
Kq = new D(Gq, "Optimized", 12), Lq = new D(Gq, "Pythagorean", 13), Xq = new D(Gq, "Circular", 14);
Gq.className = "CircularLayout";
Gq.ConstantSpacing = Hq;
Gq.ConstantDistance = Vq;
Gq.ConstantAngle = Uq;
Gq.Packed = Wq;
Gq.Clockwise = Jq;
Gq.Counterclockwise = Tq;
Gq.BidirectionalLeft = Rq;
Gq.BidirectionalRight = Sq;
Gq.Forwards = Pq;
Gq.Reverse = Qq;
Gq.Ascending = Mq;
Gq.Descending = Oq;
Gq.Optimized = Kq;
Gq.Pythagorean = Lq;
Gq.Circular = Xq;
function Iq() {
this.bm = -Infinity;
this.Bm = this.wk = null
}
Iq.prototype.compare = function (a, b) {
if (0 < a && 0 > this.bm || Math.abs(a) < Math.abs(this.bm) && !(0 > a && 0 < this.bm)) for (this.bm = a, this.wk = [], this.Bm = [], a = 0; a < b.length; a++) this.wk[a] = b[a].bounds.x, this.Bm[a] = b[a].bounds.y
};
Iq.prototype.commit = function (a) {
if (null !== this.wk && null !== this.Bm) for (var b = 0; b < this.wk.length; b++) {
var c = a.N(b);
c.x = this.wk[b];
c.y = this.Bm[b]
}
};
Iq.className = "VertexArrangement";
function Yq(a) {
wp.call(this, a)
}
la(Yq, wp);
Yq.prototype.createVertex = function () {
return new kr(this)
};
Yq.prototype.createEdge = function () {
return new lr(this)
};
Yq.className = "CircularNetwork";
function kr(a) {
zp.call(this, a);
this.K = this.gj = NaN
}
la(kr, zp);
function Zq(a, b) {
var c = a.network;
if (null === c) return NaN;
c = c.layout;
if (null === c) return NaN;
if (c.arrangement === Wq) if (c.nodeDiameterFormula === Xq) a.gj = Math.max(a.width, a.height); else {
c = Math.abs(Math.sin(b));
b = Math.abs(Math.cos(b));
if (0 === c) return a.width;
if (0 === b) return a.height;
a.gj = Math.min(a.height / c, a.width / b)
} else a.gj = c.nodeDiameterFormula === Xq ? Math.max(a.width, a.height) : Math.sqrt(a.width * a.width + a.height * a.height);
return a.gj
}
ma.Object.defineProperties(kr.prototype, {
diameter: {
get: function () {
return this.gj
}, set: function (a) {
this.gj !== a && (this.gj = a)
}
}, actualAngle: {
get: function () {
return this.K
}, set: function (a) {
this.K !== a && (this.K = a)
}
}
});
kr.className = "CircularVertex";
function lr(a) {
Ap.call(this, a)
}
la(lr, Ap);
lr.className = "CircularEdge";
function mr() {
gi.call(this);
this.qh = null;
this.$n = 0;
this.wd = (new M(100, 100)).freeze();
this.Rm = !1;
this.$e = !0;
this.Xc = !1;
this.rl = 100;
this.Cn = 1;
this.Mf = 1E3;
this.vo = 10;
this.Vo = Math;
this.Rk = .05;
this.Qk = 50;
this.Ok = 150;
this.Pk = 0;
this.pn = 10;
this.on = 5
}
la(mr, gi);
mr.prototype.cloneProtected = function (a) {
gi.prototype.cloneProtected.call(this, a);
a.wd.assign(this.wd);
a.Rm = this.Rm;
a.$e = this.$e;
a.Xc = this.Xc;
a.rl = this.rl;
a.Cn = this.Cn;
a.Mf = this.Mf;
a.vo = this.vo;
a.Vo = this.Vo;
a.Rk = this.Rk;
a.Qk = this.Qk;
a.Ok = this.Ok;
a.Pk = this.Pk;
a.pn = this.pn;
a.on = this.on
};
mr.prototype.createNetwork = function () {
return new nr(this)
};
mr.prototype.doLayout = function (a) {
null === this.network && (this.network = this.makeNetwork(a));
a = this.maxIterations;
if (0 < this.network.vertexes.count) {
this.network.Tp();
for (var b = this.network.vertexes.iterator; b.next();) {
var c = b.value;
c.charge = this.electricalCharge(c);
c.mass = this.gravitationalMass(c)
}
for (b = this.network.edges.iterator; b.next();) c = b.value, c.stiffness = this.springStiffness(c), c.length = this.springLength(c);
this.Ju();
this.$n = 0;
if (this.needsClusterLayout()) {
b = this.network;
for (c = b.Kx().iterator; c.next();) {
this.network =
c.value;
for (var d = this.network.vertexes.iterator; d.next();) {
var e = d.value;
e.td = e.vertexes.count;
e.Ch = 1;
e.Wj = null;
e.He = null
}
or(this, 0, a)
}
this.network = b;
c.reset();
d = this.arrangementSpacing;
for (var f = c.count, g = !0, h = e = 0, k = Da(), l = 0; l < f + b.vertexes.count + 2; l++) k[l] = null;
f = 0;
c.reset();
for (var m = N.alloc(); c.next();) if (l = c.value, this.computeBounds(l, m), g) g = !1, e = m.x + m.width / 2, h = m.y + m.height / 2, k[0] = new G(m.x + m.width + d.width, m.y), k[1] = new G(m.x, m.y + m.height + d.height), f = 2; else {
var n = pr(k, f, e, h, m.width, m.height,
d), p = k[n], r = new G(p.x + m.width + d.width, p.y),
q = new G(p.x, p.y + m.height + d.height);
n + 1 < f && k.splice(n + 1, 0, null);
k[n] = r;
k[n + 1] = q;
f++;
n = p.x - m.x;
p = p.y - m.y;
for (l = l.vertexes.iterator; l.next();) r = l.value, r.centerX += n, r.centerY += p
}
N.free(m);
for (l = b.vertexes.iterator; l.next();) g = l.value, r = g.bounds, 2 > f ? (e = r.x + r.width / 2, h = r.y + r.height / 2, k[0] = new G(r.x + r.width + d.width, r.y), k[1] = new G(r.x, r.y + r.height + d.height), f = 2) : (m = pr(k, f, e, h, r.width, r.height, d), p = k[m], n = new G(p.x + r.width + d.width, p.y), r = new G(p.x, p.y + r.height +
d.height), m + 1 < f && k.splice(m + 1, 0, null), k[m] = n, k[m + 1] = r, f++, g.centerX = p.x + g.width / 2, g.centerY = p.y + g.height / 2);
Ga(k);
for (c.reset(); c.next();) {
d = c.value;
for (e = d.vertexes.iterator; e.next();) b.uh(e.value);
for (d = d.edges.iterator; d.next();) b.Qj(d.value)
}
}
qr(this, a);
this.updateParts()
}
this.rl = a;
this.network = null;
this.isValidLayout = !0
};
mr.prototype.needsClusterLayout = function () {
if (3 > this.network.vertexes.count) return !1;
for (var a = 0, b = 0, c = this.network.vertexes.first().bounds, d = this.network.vertexes.iterator; d.next();) {
if (d.value.bounds.Ic(c) && (a++, 2 < a)) return !0;
if (10 < b) break;
b++
}
return !1
};
mr.prototype.computeBounds = function (a, b) {
var c = !0;
for (a = a.vertexes.iterator; a.next();) {
var d = a.value;
c ? (c = !1, b.set(d.bounds)) : b.Jc(d.bounds)
}
return b
};
function or(a, b, c) {
if (rr(a, b)) {
var d = a.Mf;
a.Mf *= 1 + 1 / (b + 1);
var e = sr(a, b), f = Math.max(0, Math.max(Math.min(a.network.vertexes.count, c * (b + 1) / 11), 10));
a.maxIterations += f;
or(a, b + 1, c);
qr(a, f);
tr(a, e);
b = e.vertexes.Na();
b.sort(function (a, b) {
return null === a || null === b || a === b ? 0 : b.td - a.td
});
for (c = 0; c < b.length; c++) ur(a, b[c]);
a.Mf = d
}
}
function rr(a, b) {
if (10 < b || 3 > a.network.vertexes.count) return !1;
a.qh = a.network.vertexes.Na();
a = a.qh;
a.sort(function (a, b) {
return null === a || null === b || a === b ? 0 : b.td - a.td
});
for (b = a.length - 1; 0 <= b && 1 >= a[b].td;) b--;
return 1 < a.length - b
}
function sr(a, b) {
for (var c = a.network, d = new nr(a), e = 0; e < a.qh.length; e++) {
var f = a.qh[e];
if (1 < f.td) {
d.uh(f);
var g = new vr;
g.Bt = f.td;
g.Ct = f.width;
g.At = f.height;
g.cw = f.focus.x;
g.dw = f.focus.y;
null === f.He && (f.He = new E);
f.He.add(g);
f.Gv = f.He.count - 1
} else break
}
for (f = c.edges.iterator; f.next();) {
var h = f.value;
e = h.fromVertex;
g = h.toVertex;
e.network === d && g.network === d ? d.Qj(h) : e.network === d ? (h = e.Wj, null === h && (h = new E, e.Wj = h), h.add(g), e.td--, e.Ch += g.Ch) : g.network === d && (h = g.Wj, null === h && (h = new E, g.Wj = h), h.add(e),
g.td--, g.Ch += e.Ch)
}
for (e = d.edges.iterator; e.next();) f = e.value, f.length *= Math.max(1, H.sqrt((f.fromVertex.Ch + f.toVertex.Ch) / (4 * b + 1)));
for (b = d.vertexes.iterator; b.next();) {
e = b.value;
var k = e.Wj;
if (null !== k && 0 < k.count && (g = e.He.N(e.He.count - 1).Bt - e.td, !(0 >= g))) {
for (var l = h = 0, m = k.count - g; m < k.count; m++) {
var n = k.N(m), p = null;
for (f = n.edges.iterator; f.next();) {
var r = f.value;
if (r.lx(n) === e) {
p = r;
break
}
}
null !== p && (l += p.length, h += n.width * n.height)
}
f = e.centerX;
k = e.centerY;
m = e.width;
n = e.height;
p = e.focus;
r = m * n;
1 > r &&
(r = 1);
h = H.sqrt((h + r + l * l * 4 / (g * g)) / r);
g = (h - 1) * m / 2;
h = (h - 1) * n / 2;
e.bounds = new N(f - p.x - g, k - p.y - h, m + 2 * g, n + 2 * h);
e.focus = new G(p.x + g, p.y + h)
}
}
a.network = d;
return c
}
function tr(a, b) {
for (var c = a.network.vertexes.iterator; c.next();) {
var d = c.value;
d.network = b;
if (null !== d.He) {
var e = d.He.N(d.Gv);
d.td = e.Bt;
var f = e.cw, g = e.dw;
d.bounds = new N(d.centerX - f, d.centerY - g, e.Ct, e.At);
d.focus = new G(f, g);
d.Gv--
}
}
for (c = a.network.edges.iterator; c.next();) c.value.network = b;
a.network = b
}
function ur(a, b) {
var c = b.Wj;
if (null !== c && 0 !== c.count) {
var d = b.centerX, e = b.centerY, f = b.width, g = b.height;
null !== b.He && 0 < b.He.count && (g = b.He.N(0), f = g.Ct, g = g.At);
f = H.sqrt(f * f + g * g) / 2;
for (var h = !1, k = g = 0, l = 0, m = b.vertexes.iterator; m.next();) {
var n = m.value;
1 >= n.td ? k++ : (h = !0, l++, g += Math.atan2(b.centerY - n.centerY, b.centerX - n.centerX))
}
if (0 !== k) for (0 < l && (g /= l), l = b = 0, b = h ? 2 * Math.PI / (k + 1) : 2 * Math.PI / k, 0 === k % 2 && (l = b / 2), 1 < c.count && c.sort(function (a, b) {
return null === a || null === b || a === b ? 0 : b.width * b.height - a.width * a.height
}),
h = 0 === k % 2 ? 0 : 1, c = c.iterator; c.next();) if (k = c.value, !(1 < k.td || a.isFixed(k))) {
m = null;
for (n = k.edges.iterator; n.next();) {
m = n.value;
break
}
n = k.width;
var p = k.height;
n = H.sqrt(n * n + p * p) / 2;
m = f + m.length + n;
n = g + (b * (h / 2 >> 1) + l) * (0 === h % 2 ? 1 : -1);
k.centerX = d + m * Math.cos(n);
k.centerY = e + m * Math.sin(n);
h++
}
}
}
function pr(a, b, c, d, e, f, g) {
var h = 9E19, k = -1, l = 0;
a:for (; l < b; l++) {
var m = a[l], n = m.x - c, p = m.y - d;
n = n * n + p * p;
if (n < h) {
for (p = l - 1; 0 <= p; p--) if (a[p].y > m.y && a[p].x - m.x < e + g.width) continue a;
for (p = l + 1; p < b; p++) if (a[p].x > m.x && a[p].y - m.y < f + g.height) continue a;
k = l;
h = n
}
}
return k
}
mr.prototype.Ju = function () {
if (this.comments) for (var a = this.network.vertexes.iterator; a.next();) this.addComments(a.value)
};
mr.prototype.addComments = function (a) {
var b = a.node;
if (null !== b) for (b = b.Zu(); b.next();) {
var c = b.value;
if ("Comment" === c.category && c.isVisible()) {
var d = this.network.Li(c);
null === d && (d = this.network.Sl(c));
d.charge = this.defaultCommentElectricalCharge;
c = null;
for (var e = d.destinationEdges; e.next();) {
var f = e.value;
if (f.toVertex === a) {
c = f;
break
}
}
if (null === c) for (e = d.sourceEdges; e.next();) if (f = e.value, f.fromVertex === a) {
c = f;
break
}
null === c && (c = this.network.hk(a, d, null));
c.length = this.defaultCommentSpringLength
}
}
};
function wr(a, b) {
var c = a.bounds, d = c.x;
a = c.y;
var e = c.width;
c = c.height;
var f = b.bounds, g = f.x;
b = f.y;
var h = f.width;
f = f.height;
return d + e < g ? a > b + f ? (c = d + e - g, a = a - b - f, H.sqrt(c * c + a * a)) : a + c < b ? (d = d + e - g, a = a + c - b, H.sqrt(d * d + a * a)) : g - (d + e) : d > g + h ? a > b + f ? (c = d - g - h, a = a - b - f, H.sqrt(c * c + a * a)) : a + c < b ? (d = d - g - h, a = a + c - b, H.sqrt(d * d + a * a)) : d - (g + h) : a > b + f ? a - (b + f) : a + c < b ? b - (a + c) : .1
}
function qr(a, b) {
a.qh = null;
for (b = a.$n + b; a.$n < b && (a.$n++, xr(a));) ;
a.qh = null
}
function xr(a) {
null === a.qh && (a.qh = a.network.vertexes.Na());
var b = a.qh;
if (0 >= b.length) return !1;
var c = b[0];
c.forceX = 0;
c.forceY = 0;
for (var d = c.centerX, e = d, f = c = c.centerY, g = 1; g < b.length; g++) {
var h = b[g];
h.forceX = 0;
h.forceY = 0;
var k = h.centerX;
h = h.centerY;
d = Math.min(d, k);
e = Math.max(e, k);
c = Math.min(c, h);
f = Math.max(f, h)
}
(e = e - d > f - c) ? b.sort(function (a, b) {
return null === a || null === b || a === b ? 0 : a.centerX - b.centerX
}) : b.sort(function (a, b) {
return null === a || null === b || a === b ? 0 : a.centerY - b.centerY
});
c = a.Mf;
var l = d = h = 0;
for (f =
0; f < b.length; f++) {
g = b[f];
d = g.bounds;
h = g.focus;
k = d.x + h.x;
var m = d.y + h.y;
d = g.charge * a.electricalFieldX(k, m);
l = g.charge * a.electricalFieldY(k, m);
d += g.mass * a.gravitationalFieldX(k, m);
l += g.mass * a.gravitationalFieldY(k, m);
g.forceX += d;
g.forceY += l;
for (var n = f + 1; n < b.length; n++) {
var p = b[n];
if (p !== g) {
d = p.bounds;
h = p.focus;
l = d.x + h.x;
var r = d.y + h.y;
if (k - l > c || l - k > c) {
if (e) break
} else if (m - r > c || r - m > c) {
if (!e) break
} else {
var q = wr(g, p);
1 > q ? (d = a.randomNumberGenerator, null === d && (a.randomNumberGenerator = d = new yr), q = d.random(),
h = d.random(), k > l ? (d = Math.abs(p.bounds.right - g.bounds.x), d = (1 + d) * q) : k < l ? (d = Math.abs(p.bounds.x - g.bounds.right), d = -(1 + d) * q) : (d = Math.max(p.width, g.width), d = (1 + d) * q - d / 2), m > r ? (l = Math.abs(p.bounds.bottom - g.bounds.y), l = (1 + l) * h) : k < l ? (l = Math.abs(p.bounds.y - g.bounds.bottom), l = -(1 + l) * h) : (l = Math.max(p.height, g.height), l = (1 + l) * h - l / 2)) : (h = -(g.charge * p.charge) / (q * q), d = (l - k) / q * h, l = (r - m) / q * h);
g.forceX += d;
g.forceY += l;
p.forceX -= d;
p.forceY -= l
}
}
}
}
for (e = a.network.edges.iterator; e.next();) h = e.value, c = h.fromVertex, f = h.toVertex,
g = c.bounds, k = c.focus, d = g.x + k.x, g = g.y + k.y, m = f.bounds, n = f.focus, k = m.x + n.x, m = m.y + n.y, n = wr(c, f), 1 > n ? (n = a.randomNumberGenerator, null === n && (a.randomNumberGenerator = n = new yr), h = n.random(), n = n.random(), d = (d > k ? 1 : -1) * (1 + (f.width > c.width ? f.width : c.width)) * h, l = (g > m ? 1 : -1) * (1 + (f.height > c.height ? f.height : c.height)) * n) : (h = h.stiffness * (n - h.length), d = (k - d) / n * h, l = (m - g) / n * h), c.forceX += d, c.forceY += l, f.forceX -= d, f.forceY -= l;
d = 0;
e = a.moveLimit;
for (c = 0; c < b.length; c++) f = b[c], a.isFixed(f) ? a.moveFixedVertex(f) : (g = f.forceX, k =
f.forceY, g < -e ? g = -e : g > e && (g = e), k < -e ? k = -e : k > e && (k = e), f.centerX += g, f.centerY += k, d = Math.max(d, g * g + k * k));
return d > a.epsilonDistance * a.epsilonDistance
}
mr.prototype.moveFixedVertex = function () {
};
mr.prototype.commitLayout = function () {
this.Lv();
this.commitNodes();
this.isRouting && this.commitLinks()
};
mr.prototype.Lv = function () {
if (this.setsPortSpots) for (var a = this.network.edges.iterator; a.next();) {
var b = a.value.link;
null !== b && (b.fromSpot = ad, b.toSpot = ad)
}
};
mr.prototype.commitNodes = function () {
var a = 0, b = 0;
if (this.arrangesToOrigin) {
var c = N.alloc();
this.computeBounds(this.network, c);
b = this.arrangementOrigin;
a = b.x - c.x;
b = b.y - c.y;
N.free(c)
}
c = N.alloc();
for (var d = this.network.vertexes.iterator; d.next();) {
var e = d.value;
if (0 !== a || 0 !== b) c.assign(e.bounds), c.x += a, c.y += b, e.bounds = c;
e.commit()
}
N.free(c)
};
mr.prototype.commitLinks = function () {
for (var a = this.network.edges.iterator; a.next();) a.value.commit()
};
mr.prototype.springStiffness = function (a) {
a = a.stiffness;
return isNaN(a) ? this.Rk : a
};
mr.prototype.springLength = function (a) {
a = a.length;
return isNaN(a) ? this.Qk : a
};
mr.prototype.electricalCharge = function (a) {
a = a.charge;
return isNaN(a) ? this.Ok : a
};
mr.prototype.electricalFieldX = function () {
return 0
};
mr.prototype.electricalFieldY = function () {
return 0
};
mr.prototype.gravitationalMass = function (a) {
a = a.mass;
return isNaN(a) ? this.Pk : a
};
mr.prototype.gravitationalFieldX = function () {
return 0
};
mr.prototype.gravitationalFieldY = function () {
return 0
};
mr.prototype.isFixed = function (a) {
return a.isFixed
};
ma.Object.defineProperties(mr.prototype, {
currentIteration: {
get: function () {
return this.$n
}
}, arrangementSpacing: {
get: function () {
return this.wd
}, set: function (a) {
this.wd.A(a) || (this.wd.assign(a), this.B())
}
}, arrangesToOrigin: {
get: function () {
return this.Rm
}, set: function (a) {
this.Rm !== a && (this.Rm = a, this.B())
}
}, setsPortSpots: {
get: function () {
return this.$e
}, set: function (a) {
this.$e !== a && (this.$e =
a, this.B())
}
}, comments: {
get: function () {
return this.Xc
}, set: function (a) {
this.Xc !== a && (this.Xc = a, this.B())
}
}, maxIterations: {
get: function () {
return this.rl
}, set: function (a) {
this.rl !== a && 0 <= a && (this.rl = a, this.B())
}
}, epsilonDistance: {
get: function () {
return this.Cn
}, set: function (a) {
this.Cn !== a && 0 < a && (this.Cn = a, this.B())
}
}, infinityDistance: {
get: function () {
return this.Mf
}, set: function (a) {
this.Mf !==
a && 1 < a && (this.Mf = a, this.B())
}
}, moveLimit: {
get: function () {
return this.vo
}, set: function (a) {
this.vo !== a && 1 < a && (this.vo = a, this.B())
}
}, randomNumberGenerator: {
get: function () {
return this.Vo
}, set: function (a) {
this.Vo !== a && (null !== a && "function" !== typeof a.random && B('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: ' + a), this.Vo = a)
}
}, defaultSpringStiffness: {
get: function () {
return this.Rk
},
set: function (a) {
this.Rk !== a && (this.Rk = a, this.B())
}
}, defaultSpringLength: {
get: function () {
return this.Qk
}, set: function (a) {
this.Qk !== a && (this.Qk = a, this.B())
}
}, defaultElectricalCharge: {
get: function () {
return this.Ok
}, set: function (a) {
this.Ok !== a && (this.Ok = a, this.B())
}
}, defaultGravitationalMass: {
get: function () {
return this.Pk
}, set: function (a) {
this.Pk !== a && (this.Pk = a, this.B())
}
}, defaultCommentSpringLength: {
get: function () {
return this.pn
}, set: function (a) {
this.pn !== a && (this.pn = a, this.B())
}
}, defaultCommentElectricalCharge: {
get: function () {
return this.on
}, set: function (a) {
this.on !== a && (this.on = a, this.B())
}
}
});
mr.className = "ForceDirectedLayout";
function vr() {
this.dw = this.cw = this.At = this.Ct = this.Bt = 0
}
vr.className = "ForceDirectedSubnet";
function nr(a) {
wp.call(this, a)
}
la(nr, wp);
nr.prototype.createVertex = function () {
return new zr(this)
};
nr.prototype.createEdge = function () {
return new Ar(this)
};
nr.className = "ForceDirectedNetwork";
function zr(a) {
zp.call(this, a);
this.Ma = !1;
this.Ub = this.K = NaN;
this.Ch = this.td = this.La = this.ba = 0;
this.He = this.Wj = null;
this.Gv = 0
}
la(zr, zp);
ma.Object.defineProperties(zr.prototype, {
isFixed: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma !== a && (this.Ma = a)
}
}, charge: {
get: function () {
return this.K
}, set: function (a) {
this.K !== a && (this.K = a)
}
}, mass: {
get: function () {
return this.Ub
}, set: function (a) {
this.Ub !== a && (this.Ub = a)
}
}, forceX: {
get: function () {
return this.ba
}, set: function (a) {
this.ba !== a && (this.ba = a)
}
}, forceY: {
get: function () {
return this.La
}, set: function (a) {
this.La !== a && (this.La = a)
}
}
});
zr.className = "ForceDirectedVertex";
function Ar(a) {
Ap.call(this, a);
this.l = this.u = NaN
}
la(Ar, Ap);
ma.Object.defineProperties(Ar.prototype, {
stiffness: {
get: function () {
return this.u
}, set: function (a) {
this.u !== a && (this.u = a)
}
}, length: {
get: function () {
return this.l
}, set: function (a) {
this.l !== a && (this.l = a)
}
}
});
Ar.className = "ForceDirectedEdge";
function yr() {
var a = 0;
void 0 === a && (a = 42);
this.seed = a;
this.Mx = 48271;
this.Ox = 2147483647;
this.Q = 44488.07041494893;
this.Qx = 3399;
this.Nx = 1 / 2147483647;
this.random()
}
yr.prototype.random = function () {
var a = this.seed % this.Q * this.Mx - this.seed / this.Q * this.Qx;
0 < a ? this.seed = a : this.seed = a + this.Ox;
return this.seed * this.Nx
};
yr.className = "RandomNumberGenerator";
function Br() {
gi.call(this);
this.Wb = this.ke = 25;
this.L = 0;
this.Mk = Cr;
this.ml = Dr;
this.cl = Er;
this.rj = 4;
this.yk = Fr;
this.cg = 7;
this.$e = !0;
this.fo = 4;
this.Ha = this.Qr = this.ya = -1;
this.od = this.qo = 0;
this.Ka = this.ld = this.md = this.Gd = this.fc = null;
this.Ao = 0;
this.zo = this.wj = null;
this.Ld = 0;
this.Bo = null;
this.zf = new G;
this.qe = [];
this.qe.length = 100
}
la(Br, gi);
Br.prototype.cloneProtected = function (a) {
gi.prototype.cloneProtected.call(this, a);
a.ke = this.ke;
a.Wb = this.Wb;
a.L = this.L;
a.Mk = this.Mk;
a.ml = this.ml;
a.cl = this.cl;
a.rj = this.rj;
a.yk = this.yk;
a.cg = this.cg;
a.$e = this.$e;
a.fo = this.fo
};
Br.prototype.fb = function (a) {
a.classType === Br ? 0 === a.name.indexOf("Aggressive") ? this.aggressiveOption = a : 0 === a.name.indexOf("Cycle") ? this.cycleRemoveOption = a : 0 === a.name.indexOf("Init") ? this.initializeOption = a : 0 === a.name.indexOf("Layer") ? this.layeringOption = a : B("Unknown enum value: " + a) : gi.prototype.fb.call(this, a)
};
Br.prototype.createNetwork = function () {
return new Gr(this)
};
Br.prototype.doLayout = function (a) {
null === this.network && (this.network = this.makeNetwork(a));
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
this.Qr = -1;
this.od = this.qo = 0;
this.Bo = this.zo = this.wj = null;
for (a = 0; a < this.qe.length; a++) this.qe[a] = null;
if (0 < this.network.vertexes.count) {
this.network.Tp();
this.cycleRemoveOption !== Hr && this.removeCycles();
for (a = this.network.vertexes.iterator; a.next();) a.value.layer = -1;
this.ya = -1;
this.assignLayers();
for (a.reset(); a.next();) this.ya = Math.max(this.ya,
a.value.layer);
this.cycleRemoveOption === Hr && this.removeCycles();
a = this.network;
for (var b = [], c = a.edges.iterator; c.next();) {
var d = c.value;
d.valid = !1;
b.push(d)
}
for (c = 0; c < b.length; c++) {
d = b[c];
var e = d.fromVertex, f = d.toVertex;
if (!d.valid && (null !== e.node && null !== f.node || e.layer !== f.layer)) {
var g = 0, h = 0, k = 0, l = 0;
if (null !== d.link) {
h = d.link;
if (null === h) continue;
var m = e.node;
g = f.node;
if (null === m || null === g) continue;
var n = h.fromNode;
k = h.toNode;
var p = h.fromPort;
h = h.toPort;
if (d.rev) {
l = n;
var r = p;
n = k;
p = h;
k = l;
h = r
}
var q =
e.focus;
l = f.focus;
var u = d.rev ? f.bounds : e.bounds;
r = G.alloc();
m !== n ? u.o() && n.isVisible() ? n.actualBounds.o() ? (n.qf(p, Fc, r), r.x += n.actualBounds.x - u.x, r.y += n.actualBounds.y - u.y) : (n.qf(p, Fc, r), r.o() || r.assign(q)) : r.assign(q) : u.o() ? (n.qf(p, Fc, r), r.o() || r.assign(q)) : r.assign(q);
n = d.rev ? e.bounds : f.bounds;
m = G.alloc();
g !== k ? n.o() && k.isVisible() ? k.actualBounds.o() ? (k.qf(h, Fc, m), m.x += k.actualBounds.x - n.x, m.y += k.actualBounds.y - n.y) : (k.qf(h, Fc, m), m.o() || m.assign(l)) : m.assign(l) : n.o() ? (k.qf(h, Fc, m), m.o() || m.assign(l)) :
m.assign(l);
90 === this.L || 270 === this.L ? (g = Math.round((r.x - q.x) / this.Wb), k = r.x, h = Math.round((m.x - l.x) / this.Wb), l = m.x) : (g = Math.round((r.y - q.y) / this.Wb), k = r.y, h = Math.round((m.y - l.y) / this.Wb), l = m.y);
G.free(r);
G.free(m);
d.portFromColOffset = g;
d.portFromPos = k;
d.portToColOffset = h;
d.portToPos = l
} else d.portFromColOffset = 0, d.portFromPos = 0, d.portToColOffset = 0, d.portToPos = 0;
r = e.layer;
m = f.layer;
n = 0;
u = d.link;
if (null !== u) {
var v = u.fromPort, w = u.toPort;
if (null !== v && null !== w) {
var z = u.fromNode;
p = u.toNode;
if (null !== z &&
null !== p) {
var y = Ir(this, !0), A = Ir(this, !1),
C = this.setsPortSpots ? y : u.computeSpot(!0, v);
q = this.setsPortSpots ? A : u.computeSpot(!1, w);
var I = u.isOrthogonal;
C.sf() && C.rf(A) && q.sf() && q.rf(y) ? n = 0 : (y = u.getLinkPoint(z, v, C, !0, I, p, w, G.alloc()), A = u.getLinkDirection(z, v, y, C, !0, I, p, w), G.free(y), C.et() || A !== Jr(this, d, !0) ? this.setsPortSpots && null !== z && 1 === z.ports.count && d.rev && (n += 1) : n += 1, C = u.getLinkPoint(p, w, q, !1, I, z, v, G.alloc()), u = u.getLinkDirection(p, w, C, q, !1, I, z, v), G.free(C), q.et() || u !== Jr(this, d, !1) ? this.setsPortSpots &&
null !== p && 1 === p.ports.count && d.rev && (n += 2) : n += 2)
}
}
}
p = n;
n = 1 === p || 3 === p ? !0 : !1;
if (p = 2 === p || 3 === p ? !0 : !1) q = a.createVertex(), q.node = null, q.Rj = 1, q.layer = r, q.near = e, a.uh(q), e = a.hk(e, q, d.link), e.valid = !1, e.rev = d.rev, e.portFromColOffset = g, e.portToColOffset = 0, e.portFromPos = k, e.portToPos = 0, e = q;
u = 1;
n && u--;
if (r - m > u && 0 < r) {
d.valid = !1;
q = a.createVertex();
q.node = null;
q.Rj = 2;
q.layer = r - 1;
a.uh(q);
e = a.hk(e, q, d.link);
e.valid = !0;
e.rev = d.rev;
e.portFromColOffset = p ? 0 : g;
e.portToColOffset = 0;
e.portFromPos = p ? 0 : k;
e.portToPos = 0;
e =
q;
for (r--; r - m > u && 0 < r;) q = a.createVertex(), q.node = null, q.Rj = 3, q.layer = r - 1, a.uh(q), e = a.hk(e, q, d.link), e.valid = !0, e.rev = d.rev, e.portFromColOffset = 0, e.portToColOffset = 0, e.portFromPos = 0, e.portToPos = 0, e = q, r--;
e = a.hk(q, f, d.link);
e.valid = !n;
n && (q.near = f);
e.rev = d.rev;
e.portFromColOffset = 0;
e.portToColOffset = h;
e.portFromPos = 0;
e.portToPos = l
} else d.valid = !0
}
}
a = this.fc = [];
for (b = 0; b <= this.ya; b++) a[b] = 0;
for (b = this.network.vertexes.iterator; b.next();) b.value.index = -1;
this.initializeIndices();
this.Qr = -1;
for (c = this.od =
this.qo = 0; c <= this.ya; c++) a[c] > a[this.od] && (this.Qr = a[c] - 1, this.od = c), a[c] < a[this.qo] && (this.qo = c);
this.Bo = [];
for (c = 0; c < a.length; c++) this.Bo[c] = [];
for (b.reset(); b.next();) a = b.value, this.Bo[a.layer][a.index] = a;
this.Ha = -1;
for (a = 0; a <= this.ya; a++) {
b = Kr(this, a);
c = 0;
d = this.fc[a];
for (f = 0; f < d; f++) e = b[f], c += this.nodeMinColumnSpace(e, !0), e.column = c, c += 1, c += this.nodeMinColumnSpace(e, !1);
this.Ha = Math.max(this.Ha, c - 1);
Lr(this, a, b)
}
this.reduceCrossings();
this.straightenAndPack();
this.updateParts()
}
this.network =
null;
this.isValidLayout = !0
};
Br.prototype.linkMinLength = function () {
return 1
};
function Mr(a) {
var b = a.fromVertex.node;
a = a.toVertex.node;
return null === b && null === a ? 8 : null === b || null === a ? 4 : 1
}
Br.prototype.nodeMinLayerSpace = function (a, b) {
return null === a.node ? 0 : 90 === this.L || 270 === this.L ? b ? a.focus.y + 10 : a.bounds.height - a.focus.y + 10 : b ? a.focus.x + 10 : a.bounds.width - a.focus.x + 10
};
Br.prototype.nodeMinColumnSpace = function (a, b) {
if (null === a.node) return 0;
var c = b ? a.sv : a.rv;
if (null !== c) return c;
c = this.L;
return 90 === c || 270 === c ? b ? a.sv = a.focus.x / this.Wb + 1 | 0 : a.rv = (a.bounds.width - a.focus.x) / this.Wb + 1 | 0 : b ? a.sv = a.focus.y / this.Wb + 1 | 0 : a.rv = (a.bounds.height - a.focus.y) / this.Wb + 1 | 0
};
function Nr(a) {
null === a.wj && (a.wj = []);
for (var b = 0, c = a.network.vertexes.iterator; c.next();) {
var d = c.value;
a.wj[b] = d.layer;
b++;
a.wj[b] = d.column;
b++;
a.wj[b] = d.index;
b++
}
return a.wj
}
function Or(a, b) {
var c = 0;
for (a = a.network.vertexes.iterator; a.next();) {
var d = a.value;
d.layer = b[c];
c++;
d.column = b[c];
c++;
d.index = b[c];
c++
}
}
function Pr(a, b, c) {
var d = Kr(a, b), e = a.fc[b];
if (null === a.zo || a.zo.length < e * e) a.zo = [];
for (var f = a.zo, g = 0; g < e; g++) {
var h = 0, k = d[g], l = k.near;
if (null !== l && l.layer === k.layer) if (k = l.index, k > g) for (var m = g + 1; m < k; m++) {
var n = d[m];
n.near === l && n.Rj === l.Rj || h++
} else for (m = g - 1; m > k; m--) n = d[m], n.near === l && n.Rj === l.Rj || h++;
var p;
if (0 <= c) for (k = d[g].sourceEdgesArrayAccess, l = 0; l < k.length; l++) {
var r = k[l];
if (r.valid && r.fromVertex.layer !== b) for (n = r.fromVertex.index, m = r.portToPos, r = r.portFromPos, p = l + 1; p < k.length; p++) {
var q =
k[p];
if (q.valid && q.fromVertex.layer !== b) {
var u = q.fromVertex.index;
var v = q.portToPos;
q = q.portFromPos;
m < v && (n > u || n === u && r > q) && h++;
v < m && (u > n || u === n && q > r) && h++
}
}
}
if (0 >= c) for (k = d[g].destinationEdgesArrayAccess, l = 0; l < k.length; l++) if (r = k[l], r.valid && r.toVertex.layer !== b) for (n = r.toVertex.index, m = r.portToPos, r = r.portFromPos, p = l + 1; p < k.length; p++) q = k[p], q.valid && q.toVertex.layer !== b && (u = q.toVertex.index, v = q.portToPos, q = q.portFromPos, r < q && (n > u || n === u && m > v) && h++, q < r && (u > n || u === n && v > m) && h++);
f[g * e + g] = h;
for (k = g +
1; k < e; k++) {
var w = 0, z = 0;
if (0 <= c) {
h = d[g].sourceEdgesArrayAccess;
var y = d[k].sourceEdgesArrayAccess;
for (l = 0; l < h.length; l++) if (r = h[l], r.valid && r.fromVertex.layer !== b) for (n = r.fromVertex.index, r = r.portFromPos, p = 0; p < y.length; p++) q = y[p], q.valid && q.fromVertex.layer !== b && (u = q.fromVertex.index, q = q.portFromPos, (n < u || n === u && r < q) && z++, (u < n || u === n && q < r) && w++)
}
if (0 >= c) for (h = d[g].destinationEdgesArrayAccess, y = d[k].destinationEdgesArrayAccess, l = 0; l < h.length; l++) if (r = h[l], r.valid && r.toVertex.layer !== b) for (n = r.toVertex.index,
m = r.portToPos, p = 0; p < y.length; p++) q = y[p], q.valid && q.toVertex.layer !== b && (u = q.toVertex.index, v = q.portToPos, (n < u || n === u && m < v) && z++, (u < n || u === n && v < m) && w++);
f[g * e + k] = w;
f[k * e + g] = z
}
}
Lr(a, b, d);
return f
}
Br.prototype.countCrossings = function () {
for (var a = 0, b = 0; b <= this.ya; b++) for (var c = Pr(this, b, 1), d = this.fc[b], e = 0; e < d; e++) for (var f = e; f < d; f++) a += c[e * d + f];
return a
};
function Qr(a) {
for (var b = 0, c = 0; c <= a.ya; c++) {
for (var d = a, e = c, f = Kr(d, e), g = d.fc[e], h = 0, k = 0; k < g; k++) {
var l = f[k].destinationEdgesArrayAccess;
if (null !== l) for (var m = 0; m < l.length; m++) {
var n = l[m];
if (n.valid && n.toVertex.layer !== e) {
var p = n.fromVertex.column + n.portFromColOffset;
var r = n.toVertex.column + n.portToColOffset;
h += (Math.abs(p - r) + 1) * Mr(n)
}
}
}
Lr(d, e, f);
b += h
}
return b
}
Br.prototype.normalize = function () {
var a = Infinity;
this.Ha = -1;
for (var b = this.network.vertexes.iterator; b.next();) {
var c = b.value;
a = Math.min(a, c.column - this.nodeMinColumnSpace(c, !0));
this.Ha = Math.max(this.Ha, c.column + this.nodeMinColumnSpace(c, !1))
}
for (b.reset(); b.next();) b.value.column -= a;
this.Ha -= a
};
function Rr(a, b, c) {
for (var d = Kr(a, b), e = a.fc[b], f = [], g = 0; g < e; g++) {
var h = d[g], k = null;
0 >= c && (k = h.sourceEdgesArrayAccess);
var l = null;
0 <= c && (l = h.destinationEdgesArrayAccess);
var m = 0, n = 0, p = h.near;
null !== p && p.layer === h.layer && (m += p.column - 1, n++);
if (null !== k) for (p = 0; p < k.length; p++) {
h = k[p];
var r = h.fromVertex;
h.valid && !h.rev && r.layer !== b && (m += r.column, n++)
}
if (null !== l) for (k = 0; k < l.length; k++) h = l[k], p = h.toVertex, h.valid && !h.rev && p.layer !== b && (m += p.column, n++);
f[g] = 0 === n ? -1 : m / n
}
Lr(a, b, d);
return f
}
function Sr(a, b, c) {
for (var d = Kr(a, b), e = a.fc[b], f = [], g = 0; g < e; g++) {
var h = d[g], k = null;
0 >= c && (k = h.sourceEdgesArrayAccess);
var l = null;
0 <= c && (l = h.destinationEdgesArrayAccess);
var m = 0, n = [], p = h.near;
null !== p && p.layer === h.layer && (n[m] = p.column - 1, m++);
h = void 0;
if (null !== k) for (p = 0; p < k.length; p++) {
h = k[p];
var r = h.fromVertex;
h.valid && !h.rev && r.layer !== b && (n[m] = r.column + h.portFromColOffset, m++)
}
if (null !== l) for (k = 0; k < l.length; k++) h = l[k], p = h.toVertex, h.valid && !h.rev && p.layer !== b && (n[m] = p.column + h.portToColOffset,
m++);
0 === m ? f[g] = -1 : (n.sort(function (a, b) {
return a - b
}), l = m >> 1, f[g] = 0 !== (m & 1) ? n[l] : n[l - 1] + n[l] >> 1)
}
Lr(a, b, d);
return f
}
function Tr(a, b, c, d, e, f) {
if (b.component === d) {
b.component = c;
if (e) for (var g = b.destinationEdges; g.next();) {
var h = g.value;
var k = h.toVertex;
var l = b.layer - k.layer;
h = a.linkMinLength(h);
l === h && Tr(a, k, c, d, e, f)
}
if (f) for (g = b.sourceEdges; g.next();) h = g.value, k = h.fromVertex, l = k.layer - b.layer, h = a.linkMinLength(h), l === h && Tr(a, k, c, d, e, f)
}
}
function Ur(a, b, c, d, e, f) {
if (b.component === d) {
b.component = c;
if (e) for (var g = b.destinationEdges; g.next();) Ur(a, g.value.toVertex, c, d, e, f);
if (f) for (b = b.sourceEdges; b.next();) Ur(a, b.value.fromVertex, c, d, e, f)
}
}
Br.prototype.removeCycles = function () {
for (var a = this.network.edges.iterator; a.next();) a.value.rev = !1;
switch (this.Mk) {
default:
case Vr:
a = this.network;
var b = 0, c = a.vertexes.count - 1, d = [];
d.length = c + 1;
for (var e = a.vertexes.iterator; e.next();) e.value.valid = !0;
for (; null !== Wr(a);) {
for (e = Xr(a); null !== e;) d[c] = e, c--, e.valid = !1, e = Xr(a);
for (e = Yr(a); null !== e;) d[b] = e, b++, e.valid = !1, e = Yr(a);
e = null;
for (var f = 0, g = this.network.vertexes.iterator; g.next();) {
var h = g.value;
if (h.valid) {
for (var k = 0, l = h.destinationEdges; l.next();) l.value.toVertex.valid &&
k++;
l = 0;
for (var m = h.sourceEdges; m.next();) m.value.fromVertex.valid && l++;
if (null === e || f < k - l) e = h, f = k - l
}
}
null !== e && (d[b] = e, b++, e.valid = !1)
}
for (b = 0; b < a.vertexes.count; b++) d[b].index = b;
for (d = a.edges.iterator; d.next();) b = d.value, b.fromVertex.index > b.toVertex.index && (a.tm(b), b.rev = !0);
break;
case Cr:
for (d = this.network.vertexes.iterator; d.next();) a = d.value, a.Yl = -1, a.finish = -1;
for (a = this.network.edges.iterator; a.next();) a.value.forest = !1;
this.Ao = 0;
for (d.reset(); d.next();) b = d.value, 0 === b.sourceEdges.count &&
Zr(this, b);
for (d.reset(); d.next();) b = d.value, -1 === b.Yl && Zr(this, b);
for (a.reset(); a.next();) d = a.value, d.forest || (b = d.fromVertex, c = b.finish, e = d.toVertex, f = e.finish, e.Yl < b.Yl && c < f && (this.network.tm(d), d.rev = !0));
break;
case Hr:
a = this.network;
b = a.vertexes.iterator;
for (d = Infinity; b.next();) d = Math.min(d, b.value.layer);
if (Infinity > d) {
if (0 > d) for (b.reset(); b.next();) b.value.layer -= d;
d = [];
for (b.reset(); b.next();) c = b.value, e = d[c.layer], void 0 === e ? d[c.layer] = [c] : e.push(c);
for (c = b = 0; c < d.length; c++) if (e = d[c], !e ||
0 === e.length) b++; else if (0 < c) for (f = 0; f < e.length; f++) e[f].layer -= b;
for (d = a.edges.iterator; d.next();) b = d.value, b.fromVertex.layer < b.toVertex.layer && (a.tm(b), b.rev = !0)
}
}
};
function Wr(a) {
for (a = a.vertexes.iterator; a.next();) {
var b = a.value;
if (b.valid) return b
}
return null
}
function Xr(a) {
for (a = a.vertexes.iterator; a.next();) {
var b = a.value;
if (b.valid) {
for (var c = !0, d = b.destinationEdges; d.next();) if (d.value.toVertex.valid) {
c = !1;
break
}
if (c) return b
}
}
return null
}
function Yr(a) {
for (a = a.vertexes.iterator; a.next();) {
var b = a.value;
if (b.valid) {
for (var c = !0, d = b.sourceEdges; d.next();) if (d.value.fromVertex.valid) {
c = !1;
break
}
if (c) return b
}
}
return null
}
function Zr(a, b) {
b.Yl = a.Ao;
a.Ao++;
for (var c = b.destinationEdges; c.next();) {
var d = c.value, e = d.toVertex;
-1 === e.Yl && (d.forest = !0, Zr(a, e))
}
b.finish = a.Ao;
a.Ao++
}
Br.prototype.assignLayers = function () {
switch (this.ml) {
case $r:
as(this);
break;
case bs:
for (var a, b = this.network.vertexes.iterator; b.next();) a = cs(this, b.value), this.ya = Math.max(a, this.ya);
for (b.reset(); b.next();) a = b.value, a.layer = this.ya - a.layer;
break;
default:
case Dr:
as(this);
for (b = this.network.vertexes.iterator; b.next();) b.value.valid = !1;
for (b.reset(); b.next();) a = b.value, 0 === a.sourceEdges.count && ds(this, a);
a = Infinity;
for (b.reset(); b.next();) a = Math.min(a, b.value.layer);
this.ya = -1;
for (b.reset(); b.next();) {
var c =
b.value;
c.layer -= a;
this.ya = Math.max(this.ya, c.layer)
}
}
};
function as(a) {
for (var b = a.network.vertexes.iterator; b.next();) {
var c = es(a, b.value);
a.ya = Math.max(c, a.ya)
}
}
function es(a, b) {
var c = 0;
if (-1 === b.layer) {
for (var d = b.destinationEdges; d.next();) {
var e = d.value, f = e.toVertex;
e = a.linkMinLength(e);
c = Math.max(c, es(a, f) + e)
}
b.layer = c
} else c = b.layer;
return c
}
function cs(a, b) {
var c = 0;
if (-1 === b.layer) {
for (var d = b.sourceEdges; d.next();) {
var e = d.value, f = e.fromVertex;
e = a.linkMinLength(e);
c = Math.max(c, cs(a, f) + e)
}
b.layer = c
} else c = b.layer;
return c
}
function ds(a, b) {
if (!b.valid) {
b.valid = !0;
for (var c = b.destinationEdges; c.next();) ds(a, c.value.toVertex);
for (c = a.network.vertexes.iterator; c.next();) c.value.component = -1;
for (var d = b.sourceEdgesArrayAccess, e = d.length, f = 0; f < e; f++) {
var g = d[f], h = g.fromVertex, k = g.toVertex;
g = a.linkMinLength(g);
h.layer - k.layer > g && Tr(a, h, 0, -1, !0, !1)
}
for (Tr(a, b, 1, -1, !0, !0); 0 !== b.component;) {
f = 0;
d = Infinity;
h = 0;
k = null;
for (g = a.network.vertexes.iterator; g.next();) {
var l = g.value;
if (1 === l.component) {
var m = 0, n = !1, p = l.sourceEdgesArrayAccess;
e = p.length;
for (var r = 0; r < e; r++) {
var q = p[r], u = q.fromVertex;
m += 1;
1 !== u.component && (f += 1, u = u.layer - l.layer, q = a.linkMinLength(q), d = Math.min(d, u - q))
}
p = l.destinationEdgesArrayAccess;
e = p.length;
for (r = 0; r < e; r++) q = p[r].toVertex, --m, 1 !== q.component ? --f : n = !0;
(null === k || m < h) && !n && (k = l, h = m)
}
}
if (0 < f) {
for (c.reset(); c.next();) e = c.value, 1 === e.component && (e.layer += d);
b.component = 0
} else k.component = 0
}
for (c = a.network.vertexes.iterator; c.next();) c.value.component = -1;
for (Tr(a, b, 1, -1, !0, !1); 0 !== b.component;) {
d = 0;
e = Infinity;
f = 0;
h = null;
for (k = a.network.vertexes.iterator; k.next();) if (g = k.value, 1 === g.component) {
l = 0;
m = !1;
p = g.sourceEdgesArrayAccess;
n = p.length;
for (r = 0; r < n; r++) q = p[r].fromVertex, l += 1, 1 !== q.component ? d += 1 : m = !0;
p = g.destinationEdgesArrayAccess;
n = p.length;
for (r = 0; r < n; r++) q = p[r], u = q.toVertex, --l, 1 !== u.component && (--d, u = g.layer - u.layer, q = a.linkMinLength(q), e = Math.min(e, u - q));
(null === h || l > f) && !m && (h = g, f = l)
}
if (0 > d) {
for (c.reset(); c.next();) d = c.value, 1 === d.component && (d.layer -= e);
b.component = 0
} else h.component = 0
}
}
}
function Jr(a, b, c) {
return 90 === a.L ? c && !b.rev || !c && b.rev ? 270 : 90 : 180 === a.L ? c && !b.rev || !c && b.rev ? 0 : 180 : 270 === a.L ? c && !b.rev || !c && b.rev ? 90 : 270 : c && !b.rev || !c && b.rev ? 180 : 0
}
Br.prototype.initializeIndices = function () {
switch (this.cl) {
default:
case fs:
for (var a = this.network.vertexes.iterator; a.next();) {
var b = a.value, c = b.layer;
b.index = this.fc[c];
this.fc[c]++
}
break;
case Er:
a = this.network.vertexes.iterator;
for (b = this.ya; 0 <= b; b--) for (a.reset(); a.next();) c = a.value, c.layer === b && -1 === c.index && gs(this, c);
break;
case hs:
for (a = this.network.vertexes.iterator, b = 0; b <= this.ya; b++) for (a.reset(); a.next();) c = a.value, c.layer === b && -1 === c.index && is(this, c)
}
};
function gs(a, b) {
var c = b.layer;
b.index = a.fc[c];
a.fc[c]++;
b = b.destinationEdgesArrayAccess;
for (c = !0; c;) {
c = !1;
for (var d = 0; d < b.length - 1; d++) {
var e = b[d], f = b[d + 1];
e.portFromColOffset > f.portFromColOffset && (c = !0, b[d] = f, b[d + 1] = e)
}
}
for (c = 0; c < b.length; c++) d = b[c], d.valid && (d = d.toVertex, -1 === d.index && gs(a, d))
}
function is(a, b) {
var c = b.layer;
b.index = a.fc[c];
a.fc[c]++;
b = b.sourceEdgesArrayAccess;
for (var d = !0; d;) for (d = !1, c = 0; c < b.length - 1; c++) {
var e = b[c], f = b[c + 1];
e.portToColOffset > f.portToColOffset && (d = !0, b[c] = f, b[c + 1] = e)
}
for (c = 0; c < b.length; c++) d = b[c], d.valid && (d = d.fromVertex, -1 === d.index && is(a, d))
}
Br.prototype.reduceCrossings = function () {
var a = this.countCrossings(), b = Nr(this), c, d;
for (c = 0; c < this.rj; c++) {
for (d = 0; d <= this.ya; d++) js(this, d, 1), ks(this, d, 1);
var e = this.countCrossings();
e < a && (a = e, b = Nr(this));
for (d = this.ya; 0 <= d; d--) js(this, d, -1), ks(this, d, -1);
e = this.countCrossings();
e < a && (a = e, b = Nr(this))
}
Or(this, b);
for (c = 0; c < this.rj; c++) {
for (d = 0; d <= this.ya; d++) js(this, d, 0), ks(this, d, 0);
e = this.countCrossings();
e < a && (a = e, b = Nr(this));
for (d = this.ya; 0 <= d; d--) js(this, d, 0), ks(this, d, 0);
e = this.countCrossings();
e < a && (a = e, b = Nr(this))
}
Or(this, b);
var f, g, h;
switch (this.yk) {
case ls:
break;
case ms:
for (h = a + 1; (d = this.countCrossings()) < h;) for (h = d, c = this.ya; 0 <= c; c--) for (g = 0; g <= c; g++) {
for (f = !0; f;) for (f = !1, d = c; d >= g; d--) f = ks(this, d, -1) || f;
e = this.countCrossings();
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = c; d >= g; d--) f = ks(this, d, 1) || f;
e = this.countCrossings();
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = g; d <= c; d++) f = ks(this, d, 1) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = g; d <= c; d++) f =
ks(this, d, -1) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = c; d >= g; d--) f = ks(this, d, 0) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = g; d <= c; d++) f = ks(this, d, 0) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this))
}
break;
default:
case Fr:
for (c = this.ya, g = 0, h = a + 1; (d = this.countCrossings()) < h;) {
h = d;
for (f = !0; f;) for (f = !1, d = c; d >= g; d--) f = ks(this, d, -1) || f;
e = this.countCrossings();
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = c; d >= g; d--) f = ks(this, d, 1) || f;
e = this.countCrossings();
e >= a ? Or(this, b) :
(a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = g; d <= c; d++) f = ks(this, d, 1) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = g; d <= c; d++) f = ks(this, d, -1) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = c; d >= g; d--) f = ks(this, d, 0) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this));
for (f = !0; f;) for (f = !1, d = g; d <= c; d++) f = ks(this, d, 0) || f;
e >= a ? Or(this, b) : (a = e, b = Nr(this))
}
}
Or(this, b)
};
function js(a, b, c) {
var d = Kr(a, b), e = a.fc[b], f = Sr(a, b, c), g = Rr(a, b, c);
for (c = 0; c < e; c++) -1 === g[c] && (g[c] = d[c].column), -1 === f[c] && (f[c] = d[c].column);
for (var h = !0, k; h;) for (h = !1, c = 0; c < e - 1; c++) if (f[c + 1] < f[c] || f[c + 1] === f[c] && g[c + 1] < g[c]) h = !0, k = f[c], f[c] = f[c + 1], f[c + 1] = k, k = g[c], g[c] = g[c + 1], g[c + 1] = k, k = d[c], d[c] = d[c + 1], d[c + 1] = k;
for (c = f = 0; c < e; c++) k = d[c], k.index = c, f += a.nodeMinColumnSpace(k, !0), k.column = f, f += 1, f += a.nodeMinColumnSpace(k, !1);
Lr(a, b, d)
}
function ks(a, b, c) {
var d = Kr(a, b), e = a.fc[b];
c = Pr(a, b, c);
var f;
var g = [];
for (f = 0; f < e; f++) g[f] = -1;
var h = [];
for (f = 0; f < e; f++) h[f] = -1;
for (var k = !1, l = !0; l;) for (l = !1, f = 0; f < e - 1; f++) {
var m = c[d[f].index * e + d[f + 1].index], n = c[d[f + 1].index * e + d[f].index], p = 0, r = 0,
q = d[f].column, u = d[f + 1].column, v = a.nodeMinColumnSpace(d[f], !0),
w = a.nodeMinColumnSpace(d[f], !1), z = a.nodeMinColumnSpace(d[f + 1], !0),
y = a.nodeMinColumnSpace(d[f + 1], !1);
v = q - v + z;
w = u - w + y;
var A = d[f].sourceEdges.iterator;
for (A.reset(); A.next();) if (z = A.value, y = z.fromVertex,
z.valid && y.layer === b) {
for (z = 0; d[z] !== y;) z++;
z < f && (p += 2 * (f - z), r += 2 * (f + 1 - z));
z === f + 1 && (p += 1);
z > f + 1 && (p += 4 * (z - f), r += 4 * (z - (f + 1)))
}
A = d[f].destinationEdges.iterator;
for (A.reset(); A.next();) if (z = A.value, y = z.toVertex, z.valid && y.layer === b) {
for (z = 0; d[z] !== y;) z++;
z === f + 1 && (r += 1)
}
A = d[f + 1].sourceEdges.iterator;
for (A.reset(); A.next();) if (z = A.value, y = z.fromVertex, z.valid && y.layer === b) {
for (z = 0; d[z] !== y;) z++;
z < f && (p += 2 * (f + 1 - z), r += 2 * (f - z));
z === f && (r += 1);
z > f + 1 && (p += 4 * (z - (f + 1)), r += 4 * (z - f))
}
A = d[f + 1].destinationEdges.iterator;
for (A.reset(); A.next();) if (z = A.value, y = z.toVertex, z.valid && y.layer === b) {
for (z = 0; d[z] !== y;) z++;
z === f && (p += 1)
}
z = y = 0;
A = g[d[f].index];
var C = h[d[f].index], I = g[d[f + 1].index], K = h[d[f + 1].index];
-1 !== A && (y += Math.abs(A - q), z += Math.abs(A - w));
-1 !== C && (y += Math.abs(C - q), z += Math.abs(C - w));
-1 !== I && (y += Math.abs(I - u), z += Math.abs(I - v));
-1 !== K && (y += Math.abs(K - u), z += Math.abs(K - v));
if (r < p - .5 || r === p && n < m - .5 || r === p && n === m && z < y - .5) l = k = !0, d[f].column = w, d[f + 1].column = v, m = d[f], d[f] = d[f + 1], d[f + 1] = m
}
for (f = 0; f < e; f++) d[f].index =
f;
Lr(a, b, d);
return k
}
Br.prototype.straightenAndPack = function () {
var a = 0 !== (this.cg & 1);
var b = 7 === this.cg;
1E3 < this.network.edges.count && !b && (a = !1);
if (a) {
var c = [];
for (b = 0; b <= this.ya; b++) c[b] = 0;
for (var d, e = this.network.vertexes.iterator; e.next();) {
var f = e.value;
b = f.layer;
d = f.column;
f = this.nodeMinColumnSpace(f, !1);
c[b] = Math.max(c[b], d + f)
}
for (e.reset(); e.next();) f = e.value, b = f.layer, d = f.column, f.column = (8 * (this.Ha - c[b]) >> 1) + 8 * d;
this.Ha *= 8
}
if (0 !== (this.cg & 2)) for (c = !0; c;) {
c = !1;
for (b = this.od + 1; b <= this.ya; b++) c = ns(this, b, 1) || c;
for (b =
this.od - 1; 0 <= b; b--) c = ns(this, b, -1) || c;
c = ns(this, this.od, 0) || c
}
if (0 !== (this.cg & 4)) {
for (b = this.od + 1; b <= this.ya; b++) os(this, b, 1);
for (b = this.od - 1; 0 <= b; b--) os(this, b, -1);
os(this, this.od, 0)
}
a && (ps(this, -1), ps(this, 1));
if (0 !== (this.cg & 2)) for (c = !0; c;) {
c = !1;
c = ns(this, this.od, 0) || c;
for (b = this.od + 1; b <= this.ya; b++) c = ns(this, b, 0) || c;
for (b = this.od - 1; 0 <= b; b--) c = ns(this, b, 0) || c
}
};
function ns(a, b, c) {
for (var d = !1; qs(a, b, c);) d = !0;
return d
}
function qs(a, b, c) {
var d, e = Kr(a, b), f = a.fc[b], g = Rr(a, b, -1);
if (0 < c) for (d = 0; d < f; d++) g[d] = -1;
var h = Rr(a, b, 1);
if (0 > c) for (d = 0; d < f; d++) h[d] = -1;
for (var k = !1, l = !0; l;) for (l = !1, d = 0; d < f; d++) {
var m = e[d].column, n = a.nodeMinColumnSpace(e[d], !0), p = a.nodeMinColumnSpace(e[d], !1), r = 0;
0 > d - 1 || m - e[d - 1].column - 1 > n + a.nodeMinColumnSpace(e[d - 1], !1) ? r = m - 1 : r = m;
n = d + 1 >= f || e[d + 1].column - m - 1 > p + a.nodeMinColumnSpace(e[d + 1], !0) ? m + 1 : m;
var q = p = 0, u = 0;
if (0 >= c) for (var v = e[d].sourceEdges.iterator; v.next();) {
var w = v.value;
var z = w.fromVertex;
if (w.valid && z.layer !== b) {
var y = Mr(w);
var A = w.portFromColOffset;
w = w.portToColOffset;
z = z.column;
p += (Math.abs(m + w - (z + A)) + 1) * y;
q += (Math.abs(r + w - (z + A)) + 1) * y;
u += (Math.abs(n + w - (z + A)) + 1) * y
}
}
if (0 <= c) for (v = e[d].destinationEdges.iterator; v.next();) w = v.value, z = w.toVertex, w.valid && z.layer !== b && (y = Mr(w), A = w.portFromColOffset, w = w.portToColOffset, z = z.column, p += (Math.abs(m + A - (z + w)) + 1) * y, q += (Math.abs(r + A - (z + w)) + 1) * y, u += (Math.abs(n + A - (z + w)) + 1) * y);
w = A = y = 0;
v = g[e[d].index];
z = h[e[d].index];
-1 !== v && (y += Math.abs(v - m), A +=
Math.abs(v - r), w += Math.abs(v - n));
-1 !== z && (y += Math.abs(z - m), A += Math.abs(z - r), w += Math.abs(z - n));
if (q < p || q === p && A < y) l = k = !0, e[d].column = r; else if (u < p || u === p && w < y) l = k = !0, e[d].column = n
}
Lr(a, b, e);
a.normalize();
return k
}
function os(a, b, c) {
var d = Kr(a, b), e = a.fc[b], f = Sr(a, b, c), g = [];
for (c = 0; c < e; c++) g[c] = f[c];
for (f = !0; f;) for (f = !1, c = 0; c < e; c++) {
var h = d[c].column, k = a.nodeMinColumnSpace(d[c], !0), l = a.nodeMinColumnSpace(d[c], !1), m = 0;
if (-1 === g[c]) if (0 === c && c === e - 1) m = h; else if (0 === c) {
var n = d[c + 1].column;
n - h === l + a.nodeMinColumnSpace(d[c + 1], !0) ? m = h - 1 : m = h
} else c === e - 1 ? (n = d[c - 1].column, m = h - n === k + a.nodeMinColumnSpace(d[c - 1], !1) ? h + 1 : h) : (n = d[c - 1].column, k = n + a.nodeMinColumnSpace(d[c - 1], !1) + k + 1, n = d[c + 1].column, l = n - a.nodeMinColumnSpace(d[c +
1], !0) - l - 1, m = (k + l) / 2 | 0); else 0 === c && c === e - 1 ? m = g[c] : 0 === c ? (n = d[c + 1].column, l = n - a.nodeMinColumnSpace(d[c + 1], !0) - l - 1, m = Math.min(g[c], l)) : c === e - 1 ? (n = d[c - 1].column, k = n + a.nodeMinColumnSpace(d[c - 1], !1) + k + 1, m = Math.max(g[c], k)) : (n = d[c - 1].column, k = n + a.nodeMinColumnSpace(d[c - 1], !1) + k + 1, n = d[c + 1].column, l = n - a.nodeMinColumnSpace(d[c + 1], !0) - l - 1, k < g[c] && g[c] < l ? m = g[c] : k >= g[c] ? m = k : l <= g[c] && (m = l));
m !== h && (f = !0, d[c].column = m)
}
Lr(a, b, d);
a.normalize()
}
function rs(a, b) {
for (var c = !0, d = a.network.vertexes.iterator; d.next();) {
var e = d.value, f = a.nodeMinColumnSpace(e, !0), g = a.nodeMinColumnSpace(e, !1);
if (e.column - f <= b && e.column + g >= b) {
c = !1;
break
}
}
a = !1;
if (c) for (d.reset(); d.next();) c = d.value, c.column > b && (--c.column, a = !0);
return a
}
function ss(a, b) {
var c = b + 1;
var d, e = [], f = [];
for (d = 0; d <= a.ya; d++) e[d] = !1, f[d] = !1;
for (var g = a.network.vertexes.iterator; g.next();) {
d = g.value;
var h = d.column - a.nodeMinColumnSpace(d, !0), k = d.column + a.nodeMinColumnSpace(d, !1);
h <= b && k >= b && (e[d.layer] = !0);
h <= c && k >= c && (f[d.layer] = !0)
}
h = !0;
c = !1;
for (d = 0; d <= a.ya; d++) h = h && !(e[d] && f[d]);
if (h) for (g.reset(); g.next();) a = g.value, a.column > b && (--a.column, c = !0);
return c
}
function ps(a, b) {
for (var c = 0; c <= a.Ha; c++) for (; rs(a, c);) ;
a.normalize();
for (c = 0; c < a.Ha; c++) for (; ss(a, c);) ;
a.normalize();
var d;
if (0 < b) for (c = 0; c <= a.Ha; c++) {
var e = Nr(a);
var f = Qr(a);
for (d = f + 1; f < d;) {
d = f;
ts(a, c, 1);
var g = Qr(a);
g > f ? Or(a, e) : g < f && (f = g, e = Nr(a))
}
}
if (0 > b) for (c = a.Ha; 0 <= c; c--) for (e = Nr(a), f = Qr(a), d = f + 1; f < d;) d = f, ts(a, c, -1), g = Qr(a), g > f ? Or(a, e) : g < f && (f = g, e = Nr(a));
a.normalize()
}
function ts(a, b, c) {
a.Ld = 0;
for (var d = a.network.vertexes.iterator; d.next();) d.value.component = -1;
if (0 < c) for (d.reset(); d.next();) {
var e = d.value;
e.column - a.nodeMinColumnSpace(e, !0) <= b && (e.component = a.Ld)
}
if (0 > c) for (d.reset(); d.next();) e = d.value, e.column + a.nodeMinColumnSpace(e, !1) >= b && (e.component = a.Ld);
a.Ld++;
for (d.reset(); d.next();) b = d.value, -1 === b.component && (Ur(a, b, a.Ld, -1, !0, !0), a.Ld++);
var f;
b = [];
for (f = 0; f < a.Ld * a.Ld; f++) b[f] = !1;
e = [];
for (f = 0; f < (a.ya + 1) * (a.Ha + 1); f++) e[f] = -1;
for (d.reset(); d.next();) {
f =
d.value;
for (var g = f.layer, h = Math.max(0, f.column - a.nodeMinColumnSpace(f, !0)), k = Math.min(a.Ha, f.column + a.nodeMinColumnSpace(f, !1)); h <= k; h++) e[g * (a.Ha + 1) + h] = f.component
}
for (f = 0; f <= a.ya; f++) {
if (0 < c) for (g = 0; g < a.Ha; g++) -1 !== e[f * (a.Ha + 1) + g] && -1 !== e[f * (a.Ha + 1) + g + 1] && e[f * (a.Ha + 1) + g] !== e[f * (a.Ha + 1) + g + 1] && (b[e[f * (a.Ha + 1) + g] * a.Ld + e[f * (a.Ha + 1) + g + 1]] = !0);
if (0 > c) for (g = a.Ha; 0 < g; g--) -1 !== e[f * (a.Ha + 1) + g] && -1 !== e[f * (a.Ha + 1) + g - 1] && e[f * (a.Ha + 1) + g] !== e[f * (a.Ha + 1) + g - 1] && (b[e[f * (a.Ha + 1) + g] * a.Ld + e[f * (a.Ha + 1) + g - 1]] = !0)
}
e =
[];
for (f = 0; f < a.Ld; f++) e[f] = !0;
g = [];
for (g.push(0); 0 !== g.length;) if (k = g[g.length - 1], g.pop(), e[k]) for (e[k] = !1, f = 0; f < a.Ld; f++) b[k * a.Ld + f] && g.splice(0, 0, f);
if (0 < c) for (d.reset(); d.next();) a = d.value, e[a.component] && --a.column;
if (0 > c) for (d.reset(); d.next();) c = d.value, e[c.component] && (c.column += 1)
}
Br.prototype.commitLayout = function () {
if (this.setsPortSpots) for (var a = Ir(this, !0), b = Ir(this, !1), c = this.network.edges.iterator; c.next();) {
var d = c.value.link;
null !== d && (d.fromSpot = a, d.toSpot = b)
}
this.commitNodes();
this.Ou();
this.isRouting && this.commitLinks()
};
function Ir(a, b) {
return 270 === a.L ? b ? fd : nd : 90 === a.L ? b ? nd : fd : 180 === a.L ? b ? ld : md : b ? md : ld
}
Br.prototype.commitNodes = function () {
this.Gd = [];
this.md = [];
this.ld = [];
this.Ka = [];
for (var a = 0; a <= this.ya; a++) this.Gd[a] = 0, this.md[a] = 0, this.ld[a] = 0, this.Ka[a] = 0;
for (a = this.network.vertexes.iterator; a.next();) {
var b = a.value, c = b.layer;
this.Gd[c] = Math.max(this.Gd[c], this.nodeMinLayerSpace(b, !0));
this.md[c] = Math.max(this.md[c], this.nodeMinLayerSpace(b, !1))
}
b = 0;
c = this.ke;
for (var d = 0; d <= this.ya; d++) {
var e = c;
0 >= this.Gd[d] + this.md[d] && (e = 0);
0 < d && (b += e / 2);
90 === this.L || 0 === this.L ? (b += this.md[d], this.ld[d] = b,
b += this.Gd[d]) : (b += this.Gd[d], this.ld[d] = b, b += this.md[d]);
d < this.ya && (b += e / 2);
this.Ka[d] = b
}
c = b;
b = this.arrangementOrigin;
for (d = 0; d <= this.ya; d++) 270 === this.L ? this.ld[d] = b.y + this.ld[d] : 90 === this.L ? (this.ld[d] = b.y + c - this.ld[d], this.Ka[d] = c - this.Ka[d]) : 180 === this.L ? this.ld[d] = b.x + this.ld[d] : (this.ld[d] = b.x + c - this.ld[d], this.Ka[d] = c - this.Ka[d]);
a.reset();
for (c = d = Infinity; a.next();) {
e = a.value;
var f = e.layer, g = e.column | 0;
if (270 === this.L || 90 === this.L) {
var h = b.x + this.Wb * g;
f = this.ld[f]
} else h = this.ld[f], f = b.y +
this.Wb * g;
e.centerX = h;
e.centerY = f;
d = Math.min(e.x, d);
c = Math.min(e.y, c)
}
d = b.x - d;
b = b.y - c;
this.zf = new G(d, b);
for (a.reset(); a.next();) c = a.value, c.x += d, c.y += b, c.commit()
};
Br.prototype.Ou = function () {
for (var a = 0, b = this.ke, c = 0; c <= this.ya; c++) a += this.Gd[c], a += this.md[c];
a += this.ya * b;
b = [];
c = this.Wb * this.Ha;
for (var d = this.maxLayer; 0 <= d; d--) 270 === this.L ? 0 === d ? b.push(new N(0, 0, c, Math.abs(this.Ka[0]))) : b.push(new N(0, this.Ka[d - 1], c, Math.abs(this.Ka[d - 1] - this.Ka[d]))) : 90 === this.L ? 0 === d ? b.push(new N(0, this.Ka[0], c, Math.abs(this.Ka[0] - a))) : b.push(new N(0, this.Ka[d], c, Math.abs(this.Ka[d - 1] - this.Ka[d]))) : 180 === this.L ? 0 === d ? b.push(new N(0, 0, Math.abs(this.Ka[0]), c)) : b.push(new N(this.Ka[d -
1], 0, Math.abs(this.Ka[d - 1] - this.Ka[d]), c)) : 0 === d ? b.push(new N(this.Ka[0], 0, Math.abs(this.Ka[0] - a), c)) : b.push(new N(this.Ka[d], 0, Math.abs(this.Ka[d - 1] - this.Ka[d]), c));
this.commitLayers(b, this.zf)
};
Br.prototype.commitLayers = function () {
};
Br.prototype.commitLinks = function () {
for (var a = this.network.edges.iterator, b; a.next();) b = a.value.link, null !== b && (b.Dh(), b.Vj(), b.mf());
for (a.reset(); a.next();) b = a.value.link, null !== b && b.$i();
for (a.reset(); a.next();) {
var c = a.value;
b = c.link;
if (null !== b) {
b.Dh();
var d = b, e = d.fromNode, f = d.toNode, g = d.fromPort, h = d.toPort;
if (null !== e) {
var k = e.findVisibleNode();
null !== k && k !== e && (e = k, g = k.port)
}
null !== f && (k = f.findVisibleNode(), null !== k && k !== f && (f = k, h = k.port));
var l = b.computeSpot(!0, g);
k = b.computeSpot(!1, h);
var m =
c.fromVertex, n = c.toVertex;
if (c.valid) {
if (b.curve === tg && 4 === b.pointsCount) if (m.column === n.column) c = b.getLinkPoint(e, g, l, !0, !1, f, h), g = b.getLinkPoint(f, h, k, !1, !1, e, g), c.o() || c.set(e.actualBounds.center), g.o() || g.set(f.actualBounds.center), b.Vj(), b.lf(c.x, c.y), b.lf((2 * c.x + g.x) / 3, (2 * c.y + g.y) / 3), b.lf((c.x + 2 * g.x) / 3, (c.y + 2 * g.y) / 3), b.lf(g.x, g.y); else {
var p = !1, r = !1;
null !== g && l === yc && (p = !0);
null !== h && k === yc && (r = !0);
if (p || r) {
var q = b.i(0).x;
c = b.i(0).y;
m = b.i(3).x;
d = b.i(3).y;
p && (90 === this.L || 270 === this.L ? (p = q, n =
(c + d) / 2) : (p = (q + m) / 2, n = c), b.M(1, p, n), l = b.getLinkPoint(e, g, l, !0, !1, f, h), l.o() || l.set(e.actualBounds.center), b.M(0, l.x, l.y));
r && (90 === this.L || 270 === this.L ? (l = m, c = (c + d) / 2) : (l = (q + m) / 2, c = d), b.M(2, l, c), e = b.getLinkPoint(f, h, k, !1, !1, e, g), e.o() || e.set(f.actualBounds.center), b.M(3, e.x, e.y))
}
}
b.mf()
} else if (m.layer === n.layer) b.mf(); else {
p = r = !1;
q = b.firstPickIndex + 1;
if (b.isOrthogonal) {
p = !0;
var u = b.pointsCount;
4 < u && b.points.removeRange(2, u - 3)
} else if (b.curve === tg) r = !0, u = b.pointsCount, 4 < u && b.points.removeRange(2,
u - 3), 4 === u && (q = 2); else {
u = b.pointsCount;
var v = l === yc, w = k === yc;
2 < u && v && w ? b.points.removeRange(1, u - 2) : 3 < u && v && !w ? b.points.removeRange(1, u - 3) : 3 < u && !v && w ? b.points.removeRange(2, u - 2) : 4 < u && !v && !w && b.points.removeRange(2, u - 3)
}
if (c.rev) {
for (; null !== n && m !== n;) {
var z = u = null;
for (v = n.sourceEdges.iterator; v.next() && (w = v.value, w.link !== c.link || (u = w.fromVertex, z = w.toVertex, null !== u.node));) ;
if (u !== m) {
v = b.i(q - 1).x;
w = b.i(q - 1).y;
var y = u.centerX;
var A = u.centerY;
if (p) 180 === this.L || 0 === this.L ? q === b.firstPickIndex + 1 ? (b.m(q++,
v, w), b.m(q++, v, A)) : (null !== z ? z.centerY : w) !== A && (z = this.Ka[u.layer - 1] + this.zf.x, b.m(q++, z, w), b.m(q++, z, A)) : q === b.firstPickIndex + 1 ? (b.m(q++, v, w), b.m(q++, y, w)) : (null !== z ? z.centerX : v) !== y && (z = this.Ka[u.layer - 1] + this.zf.y, b.m(q++, v, z), b.m(q++, y, z)); else if (q === b.firstPickIndex + 1) {
z = Math.max(10, this.Gd[n.layer]);
var C = Math.max(10, this.md[n.layer]);
if (r) 180 === this.L ? y <= n.bounds.x ? (n = n.bounds.x, b.m(q++, n - z, A), b.m(q++, n, A), b.m(q++, n + C, A)) : (b.m(q++, y - z, A), b.m(q++, y, A), b.m(q++, y + C, A)) : 90 === this.L ? A >= n.bounds.bottom ?
(n = n.bounds.y + n.bounds.height, b.m(q++, y, n + C), b.m(q++, y, n), b.m(q++, y, n - z)) : (b.m(q++, y, A + C), b.m(q++, y, A), b.m(q++, y, A - z)) : 270 === this.L ? A <= n.bounds.y ? (n = n.bounds.y, b.m(q++, y, n - z), b.m(q++, y, n), b.m(q++, y, n + C)) : (b.m(q++, y, A - z), b.m(q++, y, A), b.m(q++, y, A + C)) : 0 === this.L && (y >= n.bounds.right ? (n = n.bounds.x + n.bounds.width, b.m(q++, n + C, A), b.m(q++, n, A), b.m(q++, n - z, A)) : (b.m(q++, y + C, A), b.m(q++, y, A), b.m(q++, y - z, A))); else {
b.m(q++, v, w);
var I = 0;
if (180 === this.L || 0 === this.L) {
if (180 === this.L ? y >= n.bounds.right : y <= n.bounds.x) I =
(0 === this.L ? -z : C) / 2;
b.m(q++, v + I, A)
} else {
if (270 === this.L ? A >= n.bounds.bottom : A <= n.bounds.y) I = (90 === this.L ? -z : C) / 2;
b.m(q++, y, w + I)
}
b.m(q++, y, A)
}
} else z = Math.max(10, this.Gd[u.layer]), C = Math.max(10, this.md[u.layer]), 180 === this.L ? (r && b.m(q++, y - z, A), b.m(q++, y, A), r && b.m(q++, y + C, A)) : 90 === this.L ? (r && b.m(q++, y, A + C), b.m(q++, y, A), r && b.m(q++, y, A - z)) : 270 === this.L ? (r && b.m(q++, y, A - z), b.m(q++, y, A), r && b.m(q++, y, A + C)) : (r && b.m(q++, y + C, A), b.m(q++, y, A), r && b.m(q++, y - z, A))
}
n = u
}
if (null === h || l !== yc || p) if (v = b.i(q - 1).x, w = b.i(q -
1).y, y = b.i(q).x, A = b.i(q).y, p) n = this.md[m.layer], 180 === this.L || 0 === this.L ? (p = w, p >= m.bounds.y && p <= m.bounds.bottom && (180 === this.L ? y >= m.bounds.x : y <= m.bounds.right) && (n = m.centerX + (180 === this.L ? -n : n), p < m.bounds.y + m.bounds.height / 2 ? p = m.bounds.y - this.Wb / 2 : p = m.bounds.bottom + this.Wb / 2, b.m(q++, n, w), b.m(q++, n, p)), b.m(q++, y, p)) : (p = v, p >= m.bounds.x && p <= m.bounds.right && (270 === this.L ? A >= m.bounds.y : A <= m.bounds.bottom) && (n = m.centerY + (270 === this.L ? -n : n), p < m.bounds.x + m.bounds.width / 2 ? p = m.bounds.x - this.Wb / 2 : p = m.bounds.right +
this.Wb / 2, b.m(q++, v, n), b.m(q++, p, n)), b.m(q++, p, A)), b.m(q++, y, A); else if (r) z = Math.max(10, this.Gd[m.layer]), C = Math.max(10, this.md[m.layer]), 180 === this.L && y >= m.bounds.x ? (n = m.bounds.x + m.bounds.width, b.M(q - 2, n, w), b.M(q - 1, n + C, w)) : 90 === this.L && A <= m.bounds.bottom ? (n = m.bounds.y, b.M(q - 2, v, n), b.M(q - 1, v, n - z)) : 270 === this.L && A >= m.bounds.y ? (n = m.bounds.y + m.bounds.height, b.M(q - 2, v, n), b.M(q - 1, v, n + C)) : 0 === this.L && y <= m.bounds.right && (n = m.bounds.x, b.M(q - 2, n, w), b.M(q - 1, n - z, w)); else {
z = Math.max(10, this.Gd[m.layer]);
C = Math.max(10,
this.md[m.layer]);
p = 0;
if (180 === this.L || 0 === this.L) {
if (180 === this.L ? y <= m.bounds.x : y >= m.bounds.right) p = (0 === this.L ? C : -z) / 2;
b.m(q++, y + p, w)
} else {
if (270 === this.L ? A <= m.bounds.y : A >= m.bounds.bottom) p = (90 === this.L ? C : -z) / 2;
b.m(q++, v, A + p)
}
b.m(q++, y, A)
}
} else {
for (; null !== m && m !== n;) {
z = u = null;
for (m = m.destinationEdges.iterator; m.next() && (v = m.value, v.link !== c.link || (u = v.toVertex, z = v.fromVertex, null !== z.node && (z = null), null !== u.node));) ;
u !== n && (v = b.i(q - 1).x, w = b.i(q - 1).y, y = u.centerX, A = u.centerY, p ? 180 === this.L || 0 === this.L ?
(null !== z ? z.centerY : w) !== A && (z = this.Ka[u.layer] + this.zf.x, q === b.firstPickIndex + 1 && (z = 0 === this.L ? Math.max(z, v) : Math.min(z, v)), b.m(q++, z, w), b.m(q++, z, A)) : (null !== z ? z.centerX : v) !== y && (z = this.Ka[u.layer] + this.zf.y, q === b.firstPickIndex + 1 && (z = 90 === this.L ? Math.max(z, w) : Math.min(z, w)), b.m(q++, v, z), b.m(q++, y, z)) : (z = Math.max(10, this.Gd[u.layer]), C = Math.max(10, this.md[u.layer]), 180 === this.L ? (b.m(q++, y + C, A), r && b.m(q++, y, A), b.m(q++, y - z, A)) : 90 === this.L ? (b.m(q++, y, A - z), r && b.m(q++, y, A), b.m(q++, y, A + C)) : 270 === this.L ?
(b.m(q++, y, A + C), r && b.m(q++, y, A), b.m(q++, y, A - z)) : (b.m(q++, y - z, A), r && b.m(q++, y, A), b.m(q++, y + C, A))));
m = u
}
p && (v = b.i(q - 1).x, w = b.i(q - 1).y, y = b.i(q).x, A = b.i(q).y, 180 === this.L || 0 === this.L ? w !== A && (z = 0 === this.L ? Math.min(Math.max((y + v) / 2, this.Ka[n.layer] + this.zf.x), y) : Math.max(Math.min((y + v) / 2, this.Ka[n.layer] + this.zf.x), y), b.m(q++, z, w), b.m(q++, z, A)) : v !== y && (z = 90 === this.L ? Math.min(Math.max((A + w) / 2, this.Ka[n.layer] + this.zf.y), A) : Math.max(Math.min((A + w) / 2, this.Ka[n.layer] + this.zf.y), A), b.m(q++, v, z), b.m(q++, y, z)))
}
null !==
d && r && (null !== g && (l === yc && (l = b.i(0), d = b.i(2), l.A(d) || b.M(1, (l.x + d.x) / 2, (l.y + d.y) / 2)), l = b.getLinkPoint(e, g, yc, !0, !1, f, h), l.o() || l.set(e.actualBounds.center), b.M(0, l.x, l.y)), null !== h && (k === yc && (k = b.i(b.pointsCount - 1), l = b.i(b.pointsCount - 3), k.A(l) || b.M(b.pointsCount - 2, (k.x + l.x) / 2, (k.y + l.y) / 2)), e = b.getLinkPoint(f, h, yc, !1, !1, e, g), e.o() || e.set(f.actualBounds.center), b.M(b.pointsCount - 1, e.x, e.y)));
b.mf();
c.commit()
}
}
}
this.avoidOrthogonalOverlaps()
};
Br.prototype.avoidOrthogonalOverlaps = function () {
for (var a = new E, b = this.network.edges.iterator; b.next();) {
var c = b.value.link;
null !== c && c.isOrthogonal && !a.contains(c) && a.add(c)
}
if (0 < a.count) if (90 === this.L || 270 === this.L) {
b = 0;
c = [];
for (a = a.iterator; a.next();) {
var d = a.value;
if (null !== d && d.isOrthogonal) for (var e = 2; e < d.pointsCount - 3; e++) {
var f = d.i(e);
var g = d.i(e + 1);
if (this.w(f.y, g.y) && !this.w(f.x, g.x)) {
var h = new us;
h.layer = Math.floor(f.y / 2);
var k = d.i(0), l = d.i(d.pointsCount - 1);
h.first = k.x * k.x + k.y;
h.Sb = l.x *
l.x + l.y;
h.Sc = Math.min(f.x, g.x);
h.sc = Math.max(f.x, g.x);
h.index = e;
h.link = d;
if (e + 2 < d.pointsCount) {
k = d.i(e - 1);
l = d.i(e + 2);
var m = 0;
k.y < f.y ? m = l.y < f.y ? 3 : f.x < g.x ? 2 : 1 : k.y > f.y && (m = l.y > f.y ? 0 : g.x < f.x ? 2 : 1);
h.l = m
}
c.push(h)
}
}
}
if (1 < c.length) for (c.sort(this.Bx), a = 0; a < c.length;) {
f = c[a].layer;
for (d = a + 1; d < c.length && c[d].layer === f;) d++;
if (1 < d - a) for (f = a; f < d;) {
g = c[f].sc;
for (e = a + 1; e < d && c[e].Sc < g;) g = Math.max(g, c[e].sc), e++;
g = e - f;
if (1 < g) {
this.Xi(c, this.st, f, f + g);
m = 1;
h = c[f].Sb;
for (k = f; k < e; k++) l = c[k], l.Sb !== h && (m++, h = l.Sb);
this.Xi(c,
this.Ax, f, f + g);
var n = 1;
h = c[f].first;
for (k = f; k < e; k++) l = c[k], l.first !== h && (n++, h = l.first);
k = !0;
l = n;
m < n ? (k = !1, l = m, h = c[f].Sb, this.Xi(c, this.st, f, f + g)) : h = c[f].first;
m = 0;
for (n = f; n < e; n++) {
var p = c[n];
(k ? p.first : p.Sb) !== h && (m++, h = k ? p.first : p.Sb);
var r = p.link;
f = r.i(p.index);
g = r.i(p.index + 1);
var q = this.linkSpacing * (m - (l - 1) / 2);
b++;
r.Dh();
r.M(p.index, f.x, f.y + q);
r.M(p.index + 1, g.x, g.y + q);
r.mf()
}
}
f = e
}
a = d
}
} else {
b = 0;
c = [];
for (a = a.iterator; a.next();) if (d = a.value, null !== d && d.isOrthogonal) for (e = 2; e < d.pointsCount - 3; e++) f =
d.i(e), g = d.i(e + 1), this.w(f.x, g.x) && !this.w(f.y, g.y) && (h = new us, h.layer = Math.floor(f.x / 2), k = d.i(0), l = d.i(d.pointsCount - 1), h.first = k.x + k.y * k.y, h.Sb = l.x + l.y * l.y, h.Sc = Math.min(f.y, g.y), h.sc = Math.max(f.y, g.y), h.index = e, h.link = d, e + 2 < d.pointsCount && (k = d.i(e - 1), l = d.i(e + 2), m = 0, k.x < f.x ? m = l.x < f.x ? 3 : f.y < g.y ? 2 : 1 : k.x > f.x && (m = l.x > f.x ? 0 : g.y < f.y ? 2 : 1), h.l = m), c.push(h));
if (1 < c.length) for (c.sort(this.Bx), a = 0; a < c.length;) {
f = c[a].layer;
for (d = a + 1; d < c.length && c[d].layer === f;) d++;
if (1 < d - a) for (f = a; f < d;) {
g = c[f].sc;
for (e = a +
1; e < d && c[e].Sc < g;) g = Math.max(g, c[e].sc), e++;
g = e - f;
if (1 < g) {
this.Xi(c, this.st, f, f + g);
m = 1;
h = c[f].Sb;
for (k = f; k < e; k++) l = c[k], l.Sb !== h && (m++, h = l.Sb);
this.Xi(c, this.Ax, f, f + g);
n = 1;
h = c[f].first;
for (k = f; k < e; k++) l = c[k], l.first !== h && (n++, h = l.first);
k = !0;
l = n;
m < n ? (k = !1, l = m, h = c[f].Sb, this.Xi(c, this.st, f, f + g)) : h = c[f].first;
m = 0;
for (n = f; n < e; n++) p = c[n], (k ? p.first : p.Sb) !== h && (m++, h = k ? p.first : p.Sb), r = p.link, f = r.i(p.index), g = r.i(p.index + 1), q = this.linkSpacing * (m - (l - 1) / 2), b++, r.Dh(), r.M(p.index, f.x + q, f.y), r.M(p.index + 1,
g.x + q, g.y), r.mf()
}
f = e
}
a = d
}
}
};
t = Br.prototype;
t.Bx = function (a, b) {
return a instanceof us && b instanceof us && a !== b ? a.layer < b.layer ? -1 : a.layer > b.layer ? 1 : a.Sc < b.Sc ? -1 : a.Sc > b.Sc ? 1 : a.sc < b.sc ? -1 : a.sc > b.sc ? 1 : 0 : 0
};
t.Ax = function (a, b) {
return a instanceof us && b instanceof us && a !== b ? a.first < b.first ? -1 : a.first > b.first || a.l < b.l ? 1 : a.l > b.l || a.Sc < b.Sc ? -1 : a.Sc > b.Sc ? 1 : a.sc < b.sc ? -1 : a.sc > b.sc ? 1 : 0 : 0
};
t.st = function (a, b) {
return a instanceof us && b instanceof us && a !== b ? a.Sb < b.Sb ? -1 : a.Sb > b.Sb || a.l < b.l ? 1 : a.l > b.l || a.Sc < b.Sc ? -1 : a.Sc > b.Sc ? 1 : a.sc < b.sc ? -1 : a.sc > b.sc ? 1 : 0 : 0
};
t.w = function (a, b) {
a -= b;
return -1 < a && 1 > a
};
t.Xi = function (a, b, c, d) {
var e = a.length, f = d - c;
if (!(1 >= f)) if ((0 > c || c >= e - 1) && B("not in range 0 <= from < length: " + c), 2 === f) d = a[c], e = a[c + 1], 0 < b(d, e) && (a[c] = e, a[c + 1] = d); else if (0 === c) if (d >= e) a.sort(b); else for (c = a.slice(0, d), c.sort(b), b = 0; b < d; b++) a[b] = c[b]; else if (d >= e) for (d = a.slice(c), d.sort(b), b = c; b < e; b++) a[b] = d[b - c]; else for (e = a.slice(c, d), e.sort(b), b = c; b < d; b++) a[b] = e[b - c]
};
function Kr(a, b) {
var c = a.fc[b];
if (c >= a.qe.length) {
var d = [];
for (var e = 0; e < a.qe.length; e++) d[e] = a.qe[e];
a.qe = d
}
void 0 === a.qe[c] || null === a.qe[c] ? d = [] : (d = a.qe[c], a.qe[c] = null);
a = a.Bo[b];
for (b = 0; b < a.length; b++) c = a[b], d[c.index] = c;
return d
}
function Lr(a, b, c) {
a.qe[a.fc[b]] = c
}
ma.Object.defineProperties(Br.prototype, {
layerSpacing: {
get: function () {
return this.ke
}, set: function (a) {
this.ke !== a && 0 <= a && (this.ke = a, this.B())
}
}, columnSpacing: {
get: function () {
return this.Wb
}, set: function (a) {
this.Wb !== a && 0 < a && (this.Wb = a, this.B())
}
}, direction: {
get: function () {
return this.L
}, set: function (a) {
this.L !== a && (0 === a || 90 === a || 180 === a || 270 === a ? (this.L = a, this.B()) : B("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))
}
},
cycleRemoveOption: {
get: function () {
return this.Mk
}, set: function (a) {
this.Mk === a || a !== Vr && a !== Cr && a !== Hr || (this.Mk = a, this.B())
}
}, layeringOption: {
get: function () {
return this.ml
}, set: function (a) {
this.ml === a || a !== Dr && a !== $r && a !== bs || (this.ml = a, this.B())
}
}, initializeOption: {
get: function () {
return this.cl
}, set: function (a) {
this.cl === a || a !== Er && a !== hs && a !== fs || (this.cl = a, this.B())
}
}, iterations: {
get: function () {
return this.rj
}, set: function (a) {
this.rj !== a && 0 <= a && (this.rj = a, this.B())
}
}, aggressiveOption: {
get: function () {
return this.yk
}, set: function (a) {
this.yk === a || a !== ls && a !== Fr && a !== ms || (this.yk = a, this.B())
}
}, packOption: {
get: function () {
return this.cg
}, set: function (a) {
this.cg !== a && 0 <= a && 8 > a && (this.cg = a, this.B())
}
}, setsPortSpots: {
get: function () {
return this.$e
}, set: function (a) {
this.$e !== a && (this.$e = a, this.B())
}
},
linkSpacing: {
get: function () {
return this.fo
}, set: function (a) {
this.fo !== a && 0 <= a && (this.fo = a, this.B())
}
}, maxLayer: {
get: function () {
return this.ya
}
}, maxIndex: {
get: function () {
return this.Qr
}
}, maxColumn: {
get: function () {
return this.Ha
}
}, minIndexLayer: {
get: function () {
return this.qo
}
}, maxIndexLayer: {
get: function () {
return this.od
}
}
});
var Cr = new D(Br, "CycleDepthFirst", 0), Vr = new D(Br, "CycleGreedy", 1), Hr = new D(Br, "CycleFromLayers", 2),
Dr = new D(Br, "LayerOptimalLinkLength", 0), $r = new D(Br, "LayerLongestPathSink", 1),
bs = new D(Br, "LayerLongestPathSource", 2), Er = new D(Br, "InitDepthFirstOut", 0),
hs = new D(Br, "InitDepthFirstIn", 1), fs = new D(Br, "InitNaive", 2), ls = new D(Br, "AggressiveNone", 0),
Fr = new D(Br, "AggressiveLess", 1), ms = new D(Br, "AggressiveMore", 2);
Br.className = "LayeredDigraphLayout";
Br.CycleDepthFirst = Cr;
Br.CycleGreedy = Vr;
Br.CycleFromLayers = Hr;
Br.LayerOptimalLinkLength = Dr;
Br.LayerLongestPathSink = $r;
Br.LayerLongestPathSource = bs;
Br.InitDepthFirstOut = Er;
Br.InitDepthFirstIn = hs;
Br.InitNaive = fs;
Br.AggressiveNone = ls;
Br.AggressiveLess = Fr;
Br.AggressiveMore = ms;
Br.PackNone = 0;
Br.PackExpand = 1;
Br.PackStraighten = 2;
Br.PackMedian = 4;
Br.PackAll = 7;
function us() {
this.index = this.sc = this.Sc = this.Sb = this.first = this.layer = 0;
this.link = null;
this.l = 0
}
us.className = "SegInfo";
function Gr(a) {
wp.call(this, a)
}
la(Gr, wp);
Gr.prototype.createVertex = function () {
return new vs(this)
};
Gr.prototype.createEdge = function () {
return new ws(this)
};
Gr.className = "LayeredDigraphNetwork";
function vs(a) {
zp.call(this, a);
this.Sa = this.Gg = this.hi = -1;
this.K = NaN;
this.ba = null;
this.valid = !1;
this.finish = this.Yl = NaN;
this.Rj = 0;
this.rv = this.sv = null
}
la(vs, zp);
ma.Object.defineProperties(vs.prototype, {
layer: {
get: function () {
return this.hi
}, set: function (a) {
this.hi !== a && (this.hi = a)
}
}, column: {
get: function () {
return this.Gg
}, set: function (a) {
this.Gg !== a && (this.Gg = a)
}
}, index: {
get: function () {
return this.Sa
}, set: function (a) {
this.Sa !== a && (this.Sa = a)
}
}, component: {
get: function () {
return this.K
}, set: function (a) {
this.K !== a && (this.K = a)
}
}, near: {
get: function () {
return this.ba
}, set: function (a) {
this.ba !== a && (this.ba = a)
}
}
});
vs.className = "LayeredDigraphVertex";
function ws(a) {
Ap.call(this, a);
this.l = this.Ma = this.Ub = !1;
this.La = this.K = NaN;
this.ba = this.u = 0
}
la(ws, Ap);
ma.Object.defineProperties(ws.prototype, {
valid: {
get: function () {
return this.Ub
}, set: function (a) {
this.Ub !== a && (this.Ub = a)
}
}, rev: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma !== a && (this.Ma = a)
}
}, forest: {
get: function () {
return this.l
}, set: function (a) {
this.l !== a && (this.l = a)
}
}, portFromPos: {
get: function () {
return this.K
}, set: function (a) {
this.K !== a && (this.K = a)
}
}, portToPos: {
get: function () {
return this.La
}, set: function (a) {
this.La !== a && (this.La = a)
}
}, portFromColOffset: {
get: function () {
return this.u
}, set: function (a) {
this.u !== a && (this.u = a)
}
}, portToColOffset: {
get: function () {
return this.ba
}, set: function (a) {
this.ba !== a && (this.ba = a)
}
}
});
ws.className = "LayeredDigraphEdge";
function xs() {
gi.call(this);
this.Fb = new F;
this.Po = ys;
this.Zc = zs;
this.Gp = As;
this.Or = Bs;
this.iw = [];
this.Xc = !0;
this.Ab = Cs;
this.wd = (new M(10, 10)).freeze();
var a = new Ds(this);
this.U = new Es(a);
this.V = new Es(a);
this.yu = []
}
la(xs, gi);
xs.prototype.cloneProtected = function (a) {
gi.prototype.cloneProtected.call(this, a);
a.Po = this.Po;
a.Gp = this.Gp;
a.Or = this.Or;
a.Xc = this.Xc;
a.Ab = this.Ab;
a.wd.assign(this.wd);
a.U.copyInheritedPropertiesFrom(this.U);
a.V.copyInheritedPropertiesFrom(this.V)
};
xs.prototype.fb = function (a) {
a.classType === xs ? 0 === a.name.indexOf("Alignment") ? this.alignment = a : 0 === a.name.indexOf("Arrangement") ? this.arrangement = a : 0 === a.name.indexOf("Compaction") ? this.compaction = a : 0 === a.name.indexOf("Path") ? this.path = a : 0 === a.name.indexOf("Sorting") ? this.sorting = a : 0 === a.name.indexOf("Style") ? this.treeStyle = a : B("Unknown enum value: " + a) : gi.prototype.fb.call(this, a)
};
xs.prototype.createNetwork = function () {
return new Ds(this)
};
xs.prototype.makeNetwork = function (a) {
function b(a) {
if (a instanceof V) return !a.isLinkLabel && "Comment" !== a.category;
if (a instanceof R) {
var b = a.fromNode;
if (null === b || b.isLinkLabel || "Comment" === b.category) return !1;
a = a.toNode;
return null === a || a.isLinkLabel || "Comment" === a.category ? !1 : !0
}
return !1
}
var c = this.createNetwork();
a instanceof P ? (c.og(a.nodes, !0, b), c.og(a.links, !0, b)) : a instanceof U ? c.og(a.memberParts, !1, b) : c.og(a.iterator, !1, b);
return c
};
xs.prototype.doLayout = function (a) {
null === this.network && (this.network = this.makeNetwork(a));
this.arrangement !== Fs && (this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin));
var b = this.diagram;
null === b && a instanceof P && (b = a);
this.path === ys && null !== b ? this.Zc = b.isTreePathToChildren ? zs : Gs : this.Zc = this.path === ys ? zs : this.path;
if (0 < this.network.vertexes.count) {
this.network.Tp();
for (a = this.network.vertexes.iterator; a.next();) b = a.value, b.initialized = !1, b.level = 0, b.parent = null, b.children = [];
if (0 < this.Fb.count) {
a =
new F;
for (b = this.Fb.iterator; b.next();) {
var c = b.value;
c instanceof V ? (c = this.network.Li(c), null !== c && a.add(c)) : c instanceof Es && a.add(c)
}
this.Fb = a
}
0 === this.Fb.count && this.findRoots();
for (a = this.Fb.copy().iterator; a.next();) b = a.value, b.initialized || (b.initialized = !0, Hs(this, b));
b = this.network.vertexes;
for (a = null; a = Is(b), 0 < a.count;) b = Js(this, a), null !== b && this.Fb.add(b), b.initialized = !0, Hs(this, b), b = a;
for (a = this.Fb.iterator; a.next();) b = a.value, b instanceof Es && Ks(this, b);
for (a = this.Fb.iterator; a.next();) b =
a.value, b instanceof Es && Ls(this, b);
for (a = this.Fb.iterator; a.next();) b = a.value, b instanceof Es && Ms(this, b);
this.Ju();
if (this.layerStyle === Ns) {
a = [];
for (b = this.network.vertexes.iterator; b.next();) {
c = b.value;
var d = c.parent;
null === d && (d = c);
d = 0 === d.angle || 180 === d.angle;
var e = a[c.level];
void 0 === e && (e = 0);
a[c.level] = Math.max(e, d ? c.width : c.height)
}
for (b = 0; b < a.length; b++) void 0 === a[b] && (a[b] = 0);
this.iw = a;
for (b = this.network.vertexes.iterator; b.next();) c = b.value, d = c.parent, null === d && (d = c), 0 === d.angle || 180 ===
d.angle ? (180 === d.angle && (c.focusX += a[c.level] - c.width), c.width = a[c.level]) : (270 === d.angle && (c.focusY += a[c.level] - c.height), c.height = a[c.level])
} else if (this.layerStyle === Os) for (a = this.network.vertexes.iterator; a.next();) {
b = a.value;
c = 0 === b.angle || 180 === b.angle;
d = -1;
for (e = 0; e < b.children.length; e++) {
var f = b.children[e];
d = Math.max(d, c ? f.width : f.height)
}
if (0 <= d) for (e = 0; e < b.children.length; e++) f = b.children[e], c ? (180 === b.angle && (f.focusX += d - f.width), f.width = d) : (270 === b.angle && (f.focusY += d - f.height), f.height =
d)
}
for (a = this.Fb.iterator; a.next();) b = a.value, b instanceof Es && this.layoutTree(b);
this.arrangeTrees();
this.updateParts()
}
this.network = null;
this.Fb = new F;
this.isValidLayout = !0
};
function Is(a) {
var b = new F;
for (a = a.iterator; a.next();) {
var c = a.value;
c.initialized || b.add(c)
}
return b
}
xs.prototype.findRoots = function () {
for (var a = this.network.vertexes, b = a.iterator; b.next();) {
var c = b.value;
switch (this.Zc) {
case zs:
0 === c.sourceEdges.count && this.Fb.add(c);
break;
case Gs:
0 === c.destinationEdges.count && this.Fb.add(c);
break;
default:
B("Unhandled path value " + this.Zc.toString())
}
}
0 === this.Fb.count && (a = Js(this, a), null !== a && this.Fb.add(a))
};
function Js(a, b) {
var c = 999999, d = null;
for (b = b.iterator; b.next();) {
var e = b.value;
switch (a.Zc) {
case zs:
e.sourceEdges.count < c && (c = e.sourceEdges.count, d = e);
break;
case Gs:
e.destinationEdges.count < c && (c = e.destinationEdges.count, d = e);
break;
default:
B("Unhandled path value " + a.Zc.toString())
}
}
return d
}
function Hs(a, b) {
if (null !== b) {
switch (a.Zc) {
case zs:
if (0 < b.destinationEdges.count) {
for (var c = new E, d = b.destinationVertexes; d.next();) {
var e = d.value;
Ps(a, b, e) && c.add(e)
}
0 < c.count && (b.children = c.Na())
}
break;
case Gs:
if (0 < b.sourceEdges.count) {
c = new E;
for (d = b.sourceVertexes; d.next();) e = d.value, Ps(a, b, e) && c.add(e);
0 < c.count && (b.children = c.Na())
}
break;
default:
B("Unhandled path value" + a.Zc.toString())
}
c = b.children;
d = c.length;
for (e = 0; e < d; e++) {
var f = c[e];
f.initialized = !0;
f.level = b.level + 1;
f.parent = b;
a.Fb.remove(f)
}
for (b =
0; b < d; b++) Hs(a, c[b])
}
}
function Ps(a, b, c) {
if (c.initialized) {
if (null === b) var d = !1; else {
for (d = b.parent; null !== d && d !== c;) d = d.parent;
d = d === c
}
if (d || c.level > b.level) return !1;
a.removeChild(c.parent, c)
}
return !0
}
xs.prototype.removeChild = function (a, b) {
if (null !== a && null !== b) {
for (var c = a.children, d = 0, e = 0; e < c.length; e++) c[e] === b && d++;
if (0 < d) {
d = Array(c.length - d);
for (var f = e = 0; f < c.length; f++) c[f] !== b && (d[e++] = c[f]);
a.children = d
}
}
};
function Ks(a, b) {
if (null !== b) {
a.initializeTreeVertexValues(b);
b.alignment === Qs && a.sortTreeVertexChildren(b);
for (var c = 0, d = b.childrenCount, e = 0, f = b.children, g = f.length, h = 0; h < g; h++) {
var k = f[h];
Ks(a, k);
c += k.descendantCount + 1;
d = Math.max(d, k.maxChildrenCount);
e = Math.max(e, k.maxGenerationCount)
}
b.descendantCount = c;
b.maxChildrenCount = d;
b.maxGenerationCount = 0 < d ? e + 1 : 0
}
}
function Rs(a, b) {
switch (a.Gp) {
default:
case As:
return null !== b.parent ? b.parent : a.U;
case Ss:
return null === b.parent ? a.U : null === b.parent.parent ? a.V : b.parent;
case Ts:
return null !== b.parent ? null !== b.parent.parent ? b.parent.parent : a.V : a.U;
case Us:
var c = !0;
if (0 === b.childrenCount) c = !1; else for (var d = b.children, e = d.length, f = 0; f < e; f++) if (0 < d[f].childrenCount) {
c = !1;
break
}
return c && null !== b.parent ? a.V : null !== b.parent ? b.parent : a.U
}
}
xs.prototype.initializeTreeVertexValues = function (a) {
a.copyInheritedPropertiesFrom(Rs(this, a));
if (null !== a.parent && a.parent.alignment === Qs) {
for (var b = a.angle, c = a.parent.children, d = 0; d < c.length && a !== c[d];) d++;
0 === d % 2 ? d !== c.length - 1 && (b = 90 === b ? 180 : 180 === b ? 270 : 270 === b ? 180 : 270) : b = 90 === b ? 0 : 180 === b ? 90 : 270 === b ? 0 : 90;
a.angle = b
}
a.initialized = !0
};
function Ls(a, b) {
if (null !== b) {
a.assignTreeVertexValues(b);
b = b.children;
for (var c = b.length, d = 0; d < c; d++) Ls(a, b[d])
}
}
xs.prototype.assignTreeVertexValues = function () {
};
function Ms(a, b) {
if (null !== b) {
b.alignment !== Qs && a.sortTreeVertexChildren(b);
b = b.children;
for (var c = b.length, d = 0; d < c; d++) Ms(a, b[d])
}
}
xs.prototype.sortTreeVertexChildren = function (a) {
switch (a.sorting) {
case Vs:
break;
case Ws:
a.children.reverse();
break;
case Xs:
a.children.sort(a.comparer);
break;
case Ys:
a.children.sort(a.comparer);
a.children.reverse();
break;
default:
B("Unhandled sorting value " + a.sorting.toString())
}
};
xs.prototype.Ju = function () {
if (this.comments) for (var a = this.network.vertexes.iterator; a.next();) this.addComments(a.value)
};
xs.prototype.addComments = function (a) {
var b = a.angle, c = a.parent, d = 0;
var e = !1;
null !== c && (d = c.angle, e = c.alignment, e = Zs(e));
b = 90 === b || 270 === b;
d = 90 === d || 270 === d;
c = 0 === a.childrenCount;
var f = 0, g = 0, h = 0, k = a.commentSpacing;
if (null !== a.node) for (var l = a.node.Zu(); l.next();) {
var m = l.value;
"Comment" === m.category && m.canLayout() && (null === a.comments && (a.comments = []), a.comments.push(m), m.$b(), m = m.measuredBounds, b && !c || !e && !d && c || e && d && c ? (f = Math.max(f, m.width), g += m.height + Math.abs(h)) : (f += m.width + Math.abs(h), g = Math.max(g,
m.height)), h = k)
}
null !== a.comments && (b && !c || !e && !d && c || e && d && c ? (f += Math.abs(a.commentMargin), g = Math.max(0, g - a.height)) : (g += Math.abs(a.commentMargin), f = Math.max(0, f - a.width)), e = N.allocAt(0, 0, a.bounds.width + f, a.bounds.height + g), a.bounds = e, N.free(e))
};
function Zs(a) {
return a === $s || a === Qs || a === at || a === bt
}
function ct(a) {
return a === $s || a === Qs
}
function dt(a) {
var b = a.parent;
if (null !== b) {
var c = b.alignment;
if (Zs(c)) {
if (ct(c)) {
b = b.children;
for (c = 0; c < b.length && a !== b[c];) c++;
return 0 === c % 2
}
if (c === at) return !0
}
}
return !1
}
xs.prototype.layoutComments = function (a) {
if (null !== a.comments) {
var b = a.node.measuredBounds, c = a.parent, d = a.angle, e = 0;
var f = !1;
null !== c && (e = c.angle, f = c.alignment, f = Zs(f));
d = 90 === d || 270 === d;
c = 90 === e || 270 === e;
for (var g = 0 === a.childrenCount, h = dt(a), k = 0, l = a.comments, m = l.length, n = G.alloc(), p = 0; p < m; p++) {
var r = l[p], q = r.measuredBounds;
if (d && !g || !f && !c && g || f && c && g) {
if (135 < e && !f || c && h) if (0 <= a.commentMargin) for (n.h(a.bounds.x - a.commentMargin - q.width, a.bounds.y + k), r.move(n), r = r.sd(); r.next();) {
var u = r.value;
u.fromSpot =
ld;
u.toSpot = md
} else for (n.h(a.bounds.x + 2 * a.focus.x - a.commentMargin, a.bounds.y + k), r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = md, u.toSpot = ld; else if (0 <= a.commentMargin) for (n.h(a.bounds.x + 2 * a.focus.x + a.commentMargin, a.bounds.y + k), r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = md, u.toSpot = ld; else for (n.h(a.bounds.x + a.commentMargin - q.width, a.bounds.y + k), r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = ld, u.toSpot = md;
k = 0 <= a.commentSpacing ? k + (q.height + a.commentSpacing) : k + (a.commentSpacing - q.height)
} else {
if (135 <
e && !f || !c && h) if (0 <= a.commentMargin) for (n.h(a.bounds.x + k, a.bounds.y - a.commentMargin - q.height), r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = fd, u.toSpot = nd; else for (n.h(a.bounds.x + k, a.bounds.y + 2 * a.focus.y - a.commentMargin), r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = nd, u.toSpot = fd; else if (0 <= a.commentMargin) for (n.h(a.bounds.x + k, a.bounds.y + 2 * a.focus.y + a.commentMargin), r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = nd, u.toSpot = fd; else for (n.h(a.bounds.x + k, a.bounds.y + a.commentMargin - q.height),
r.move(n), r = r.sd(); r.next();) u = r.value, u.fromSpot = fd, u.toSpot = nd;
k = 0 <= a.commentSpacing ? k + (q.width + a.commentSpacing) : k + (a.commentSpacing - q.width)
}
}
G.free(n);
b = k - a.commentSpacing - (d ? b.height : b.width);
if (this.Zc === zs) for (a = a.destinationEdges; a.next();) e = a.value.link, null === e || e.isAvoiding || (e.fromEndSegmentLength = 0 < b ? b : NaN); else for (a = a.sourceEdges; a.next();) e = a.value.link, null === e || e.isAvoiding || (e.toEndSegmentLength = 0 < b ? b : NaN)
}
};
xs.prototype.layoutTree = function (a) {
if (null !== a) {
for (var b = a.children, c = b.length, d = 0; d < c; d++) this.layoutTree(b[d]);
switch (a.compaction) {
case et:
ft(this, a);
break;
case gt:
if (a.alignment === Qs) ft(this, a); else if (0 === a.childrenCount) d = a.parent, c = !1, b = 0, null !== d && (b = d.angle, c = d.alignment, c = Zs(c)), d = dt(a), a.T.h(0, 0), a.ua.h(a.width, a.height), null === a.parent || null === a.comments || (180 !== b && 270 !== b || c) && !d ? a.ia.h(0, 0) : 180 === b && !c || (90 === b || 270 === b) && d ? a.ia.h(a.width - 2 * a.focus.x, 0) : a.ia.h(0, a.height - 2 * a.focus.y),
a.gq = null, a.sq = null; else {
var e = ht(a);
b = 90 === e || 270 === e;
var f = 0, g = a.children, h = g.length;
for (c = 0; c < h; c++) d = g[c], f = Math.max(f, b ? d.ua.width : d.ua.height);
var k = a.alignment, l = k === it, m = Zs(k), n = Math.max(0, a.breadthLimit);
c = jt(a);
var p = a.nodeSpacing, r = kt(a), q = a.rowSpacing, u = 0;
if (k === qt || l || a.um || a.vm && 1 === a.maxGenerationCount) u = Math.max(0, a.rowIndent);
d = a.width;
var v = a.height, w = 0, z = 0, y = 0, A = null, C = null, I = 0, K = 0, J = 0, T = 0, Q = 0,
ea = 0, pa = 0, L = 0;
m && !ct(k) && 135 < e && g.reverse();
if (ct(k)) if (1 < h) for (var Fa = 0; Fa < h; Fa++) 0 ===
Fa % 2 && Fa !== h - 1 && (L = Math.max(L, b ? g[Fa].ua.width : g[Fa].ua.height)); else 1 === h && (L = b ? g[0].ua.width : g[0].ua.height);
if (m) {
switch (k) {
case $s:
z = 135 > e ? rt(a, g, L, w, z) : st(a, g, L, w, z);
L = z.x;
w = z.width;
z = z.height;
break;
case at:
for (A = 0; A < h; A++) C = g[A], n = C.ua, y = 0 === ea ? 0 : q, b ? (C.T.h(f - n.width, T + y), w = Math.max(w, n.width), z = Math.max(z, T + y + n.height), T += y + n.height) : (C.T.h(J + y, f - n.height), w = Math.max(w, J + y + n.width), z = Math.max(z, n.height), J += y + n.width), ea++;
break;
case bt:
for (A = 0; A < h; A++) C = g[A], f = C.ua, n = 0 === ea ? 0 : q, b ? (C.T.h(p /
2 + a.focus.x, T + n), w = Math.max(w, f.width), z = Math.max(z, T + n + f.height), T += n + f.height) : (C.T.h(J + n, p / 2 + a.focus.y), w = Math.max(w, J + n + f.width), z = Math.max(z, f.height), J += n + f.width), ea++
}
A = tt(this, 2);
C = tt(this, 2);
b ? (A[0].h(0, 0), A[1].h(0, z), C[0].h(w, 0)) : (A[0].h(0, 0), A[1].h(w, 0), C[0].h(0, z));
C[1].h(w, z)
} else for (Fa = 0; Fa < h; Fa++) {
var Pa = g[Fa], eb = Pa.ua;
if (b) {
0 < n && 0 < ea && J + p + eb.width > n && (J < f && ut(a, k, f - J, 0, pa, Fa - 1), Q++, ea = 0, pa = Fa, y = z, J = 0, T = 135 < e ? -z - q : z + q);
vt(this, Pa, 0, T);
var Ia = 0;
if (0 === ea) {
if (A = Pa.gq, C = Pa.sq, I = eb.width,
K = eb.height, null === A || null === C || e !== ht(Pa)) A = tt(this, 2), C = tt(this, 2), A[0].h(0, 0), A[1].h(0, K), C[0].h(I, 0), C[1].h(I, K)
} else {
var nb = Da();
K = wt(this, a, Pa, A, C, I, K, nb);
Ia = K.x;
A = nb[0];
C = nb[1];
I = K.width;
K = K.height;
Ga(nb);
J < eb.width && 0 > Ia && (xt(a, -Ia, 0, pa, Fa - 1), yt(A, -Ia, 0), yt(C, -Ia, 0), Ia = 0)
}
Pa.T.h(Ia, T);
w = Math.max(w, I);
z = Math.max(z, y + (0 === Q ? 0 : q) + eb.height);
J = I
} else {
0 < n && 0 < ea && T + p + eb.height > n && (T < f && ut(a, k, 0, f - T, pa, Fa - 1), Q++, ea = 0, pa = Fa, y = w, T = 0, J = 135 < e ? -w - q : w + q);
vt(this, Pa, J, 0);
Ia = 0;
if (0 === ea) {
if (A = Pa.gq, C = Pa.sq,
I = eb.width, K = eb.height, null === A || null === C || e !== ht(Pa)) A = tt(this, 2), C = tt(this, 2), A[0].h(0, 0), A[1].h(I, 0), C[0].h(0, K), C[1].h(I, K)
} else nb = Da(), K = wt(this, a, Pa, A, C, I, K, nb), Ia = K.x, A = nb[0], C = nb[1], I = K.width, K = K.height, Ga(nb), T < eb.height && 0 > Ia && (xt(a, 0, -Ia, pa, Fa - 1), yt(A, 0, -Ia), yt(C, 0, -Ia), Ia = 0);
Pa.T.h(J, Ia);
z = Math.max(z, K);
w = Math.max(w, y + (0 === Q ? 0 : q) + eb.width);
T = K
}
ea++
}
0 < Q && (b ? (z += Math.max(0, c), J < w && ut(a, k, w - J, 0, pa, h - 1), 0 < u && (l || xt(a, u, 0, 0, h - 1), w += u)) : (w += Math.max(0, c), T < z && ut(a, k, 0, z - T, pa, h - 1), 0 < u && (l ||
xt(a, 0, u, 0, h - 1), z += u)));
u = l = 0;
switch (k) {
case zt:
b ? l += w / 2 - a.focus.x - r / 2 : u += z / 2 - a.focus.y - r / 2;
break;
case At:
0 < Q ? b ? l += w / 2 - a.focus.x - r / 2 : u += z / 2 - a.focus.y - r / 2 : b ? (L = g[0].T.x + g[0].ia.x, l += L + (g[h - 1].T.x + g[h - 1].ia.x + 2 * g[h - 1].focus.x - L) / 2 - a.focus.x - r / 2) : (L = g[0].T.y + g[0].ia.y, u += L + (g[h - 1].T.y + g[h - 1].ia.y + 2 * g[h - 1].focus.y - L) / 2 - a.focus.y - r / 2);
break;
case qt:
b ? (l -= r, w += r) : (u -= r, z += r);
break;
case it:
b ? (l += w - a.width + r, w += r) : (u += z - a.height + r, z += r);
break;
case $s:
b ? 1 < h ? l += L + p / 2 - a.focus.x : l += g[0].focus.x - a.focus.x + g[0].ia.x :
1 < h ? u += L + p / 2 - a.focus.y : u += g[0].focus.y - a.focus.y + g[0].ia.y;
break;
case at:
b ? l += w + p / 2 - a.focus.x : u += z + p / 2 - a.focus.y;
break;
case bt:
break;
default:
B("Unhandled alignment value " + k.toString())
}
for (r = 0; r < h; r++) L = g[r], b ? L.T.h(L.T.x + L.ia.x - l, L.T.y + (135 < e ? (m ? -z : -L.ua.height) + L.ia.y - c : v + c + L.ia.y)) : L.T.h(L.T.x + (135 < e ? (m ? -w : -L.ua.width) + L.ia.x - c : d + c + L.ia.x), L.T.y + L.ia.y - u);
h = g = 0;
m ? b ? (w = Bt(a, w, l), 0 > l && (l = 0), 135 < e && (u += z + c), z += v + c, k === bt && (g += p / 2 + a.focus.x), h += v + c) : (135 < e && (l += w + c), w += d + c, z = Ct(a, z, u), 0 > u && (u = 0),
k === bt && (h += p / 2 + a.focus.y), g += d + c) : b ? (null === a.comments ? d > w && (w = Dt(k, d - w, 0), g = w.x, h = w.y, w = d, l = 0) : w = Bt(a, w, l), 0 > l && (g -= l, l = 0), 135 < e && (u += z + c), z = Math.max(Math.max(z, v), z + v + c), h += v + c) : (135 < e && (l += w + c), w = Math.max(Math.max(w, d), w + d + c), null === a.comments ? v > z && (z = Dt(k, 0, v - z), g = z.x, h = z.y, z = v, u = 0) : z = Ct(a, z, u), 0 > u && (h -= u, u = 0), g += d + c);
if (0 < Q) e = tt(this, 4), Q = tt(this, 4), b ? (e[2].h(0, v + c), e[3].h(e[2].x, z), Q[2].h(w, e[2].y), Q[3].h(Q[2].x, e[3].y)) : (e[2].h(d + c, 0), e[3].h(w, e[2].y), Q[2].h(e[2].x, z), Q[3].h(e[3].x, Q[2].y));
else {
e = tt(this, A.length + 2);
Q = tt(this, C.length + 2);
for (k = 0; k < A.length; k++) m = A[k], e[k + 2].h(m.x + g, m.y + h);
for (k = 0; k < C.length; k++) m = C[k], Q[k + 2].h(m.x + g, m.y + h)
}
b ? (e[0].h(l, 0), e[1].h(e[0].x, v), e[2].y < e[1].y && (e[2].x > e[0].x ? e[2].assign(e[1]) : e[1].assign(e[2])), e[3].y < e[2].y && (e[3].x > e[0].x ? e[3].assign(e[2]) : e[2].assign(e[3])), Q[0].h(l + d, 0), Q[1].h(Q[0].x, v), Q[2].y < Q[1].y && (Q[2].x < Q[0].x ? Q[2].assign(Q[1]) : Q[1].assign(Q[2])), Q[3].y < Q[2].y && (Q[3].x < Q[0].x ? Q[3].assign(Q[2]) : Q[2].assign(Q[3])), e[2].y -= c / 2, Q[2].y -=
c / 2) : (e[0].h(0, u), e[1].h(d, e[0].y), e[2].x < e[1].x && (e[2].y > e[0].y ? e[2].assign(e[1]) : e[1].assign(e[2])), e[3].x < e[2].x && (e[3].y > e[0].y ? e[3].assign(e[2]) : e[2].assign(e[3])), Q[0].h(0, u + v), Q[1].h(d, Q[0].y), Q[2].x < Q[1].x && (Q[2].y < Q[0].y ? Q[2].assign(Q[1]) : Q[1].assign(Q[2])), Q[3].x < Q[2].x && (Q[3].y < Q[0].y ? Q[3].assign(Q[2]) : Q[2].assign(Q[3])), e[2].x -= c / 2, Q[2].x -= c / 2);
Et(this, A);
Et(this, C);
a.gq = e;
a.sq = Q;
a.ia.h(l, u);
a.ua.h(w, z)
}
break;
default:
B("Unhandled compaction value " + a.compaction.toString())
}
}
};
function ft(a, b) {
if (0 === b.childrenCount) {
var c = !1, d = 0;
null !== b.parent && (d = b.parent.angle, c = b.parent.alignment, c = Zs(c));
var e = dt(b);
b.T.h(0, 0);
b.ua.h(b.width, b.height);
null === b.parent || null === b.comments || (180 !== d && 270 !== d || c) && !e ? b.ia.h(0, 0) : 180 === d && !c || (90 === d || 270 === d) && e ? b.ia.h(b.width - 2 * b.focus.x, 0) : b.ia.h(0, b.height - 2 * b.focus.y)
} else {
d = ht(b);
c = 90 === d || 270 === d;
var f = 0;
e = b.children;
for (var g = e.length, h = 0; h < g; h++) {
var k = e[h];
f = Math.max(f, c ? k.ua.width : k.ua.height)
}
var l = b.alignment, m = l === qt, n = l ===
it;
h = Zs(l);
var p = Math.max(0, b.breadthLimit);
k = jt(b);
var r = b.nodeSpacing, q = kt(b), u = m || n ? 0 : q / 2, v = b.rowSpacing, w = 0;
if (m || n || b.um || b.vm && 1 === b.maxGenerationCount) w = Math.max(0, b.rowIndent);
m = b.width;
var z = b.height, y = 0, A = 0, C = 0, I = 0, K = 0, J = 0, T = 0, Q = 0, ea = 0;
h && !ct(l) && 135 < d && e.reverse();
if (ct(l)) if (1 < g) for (var pa = 0; pa < g; pa++) {
var L = e[pa], Fa = L.ua;
0 === pa % 2 && pa !== g - 1 && (ea = Math.max(ea, (c ? Fa.width : Fa.height) + Ft(L) - r))
} else 1 === g && (ea = c ? e[0].ua.width : e[0].ua.height);
if (h) switch (l) {
case $s:
case Qs:
A = 135 > d ? rt(b, e, ea,
y, A) : st(b, e, ea, y, A);
ea = A.x;
y = A.width;
A = A.height;
break;
case at:
for (a = 0; a < g; a++) p = e[a], u = p.ua, C = 0 === T ? 0 : v, c ? (p.T.h(f - u.width, K + C), y = Math.max(y, u.width), A = Math.max(A, K + C + u.height), K += C + u.height) : (p.T.h(I + C, f - u.height), y = Math.max(y, I + C + u.width), A = Math.max(A, u.height), I += C + u.width), T++;
break;
case bt:
for (f = 0; f < g; f++) a = e[f], p = a.ua, u = 0 === T ? 0 : v, c ? (a.T.h(r / 2 + b.focus.x, K + u), y = Math.max(y, p.width), A = Math.max(A, K + u + p.height), K += u + p.height) : (a.T.h(I + u, r / 2 + b.focus.y), y = Math.max(y, I + u + p.width), A = Math.max(A, p.height),
I += u + p.width), T++
} else for (pa = 0; pa < g; pa++) {
L = e[pa];
Fa = L.ua;
if (c) {
0 < p && 0 < T && I + r + Fa.width > p && (I < f && ut(b, l, f - I, 0, Q, pa - 1), J++, T = 0, Q = pa, C = A, I = 0, K = 135 < d ? -A - v : A + v);
var Pa = 0 === T ? u : r;
vt(a, L, 0, K);
L.T.h(I + Pa, K);
y = Math.max(y, I + Pa + Fa.width);
A = Math.max(A, C + (0 === J ? 0 : v) + Fa.height);
I += Pa + Fa.width
} else 0 < p && 0 < T && K + r + Fa.height > p && (K < f && ut(b, l, 0, f - K, Q, pa - 1), J++, T = 0, Q = pa, C = y, K = 0, I = 135 < d ? -y - v : y + v), Pa = 0 === T ? u : r, vt(a, L, I, 0), L.T.h(I, K + Pa), A = Math.max(A, K + Pa + Fa.height), y = Math.max(y, C + (0 === J ? 0 : v) + Fa.width), K += Pa + Fa.height;
T++
}
0 <
J && (c ? (A += Math.max(0, k), I < y && ut(b, l, y - I, 0, Q, g - 1), 0 < w && (n || xt(b, w, 0, 0, g - 1), y += w)) : (y += Math.max(0, k), K < A && ut(b, l, 0, A - K, Q, g - 1), 0 < w && (n || xt(b, 0, w, 0, g - 1), A += w)));
w = n = 0;
switch (l) {
case zt:
c ? n += y / 2 - b.focus.x - q / 2 : w += A / 2 - b.focus.y - q / 2;
break;
case At:
0 < J ? c ? n += y / 2 - b.focus.x - q / 2 : w += A / 2 - b.focus.y - q / 2 : c ? (l = e[0].T.x + e[0].ia.x, n += l + (e[g - 1].T.x + e[g - 1].ia.x + 2 * e[g - 1].focus.x - l) / 2 - b.focus.x - q / 2) : (l = e[0].T.y + e[0].ia.y, w += l + (e[g - 1].T.y + e[g - 1].ia.y + 2 * e[g - 1].focus.y - l) / 2 - b.focus.y - q / 2);
break;
case qt:
c ? (n -= q, y += q) : (w -= q, A +=
q);
break;
case it:
c ? (n += y - b.width + q, y += q) : (w += A - b.height + q, A += q);
break;
case $s:
case Qs:
c ? 1 < g ? n += ea + r / 2 - b.focus.x : n += e[0].focus.x - b.focus.x + e[0].ia.x : 1 < g ? w += ea + r / 2 - b.focus.y : w += e[0].focus.y - b.focus.y + e[0].ia.y;
break;
case at:
c ? n += y + r / 2 - b.focus.x : w += A + r / 2 - b.focus.y;
break;
case bt:
break;
default:
B("Unhandled alignment value " + l.toString())
}
for (q = 0; q < g; q++) l = e[q], c ? l.T.h(l.T.x + l.ia.x - n, l.T.y + (135 < d ? (h ? -A : -l.ua.height) + l.ia.y - k : z + k + l.ia.y)) : l.T.h(l.T.x + (135 < d ? (h ? -y : -l.ua.width) + l.ia.x - k : m + k + l.ia.x), l.T.y +
l.ia.y - w);
c ? (y = Bt(b, y, n), 0 > n && (n = 0), 135 < d && (w += A + k), A += z + k) : (135 < d && (n += y + k), y += m + k, A = Ct(b, A, w), 0 > w && (w = 0));
b.ia.h(n, w);
b.ua.h(y, A)
}
}
function rt(a, b, c, d, e) {
var f = b.length;
if (0 === f) return new N(c, 0, d, e);
if (1 === f) return a = b[0], d = a.ua.width, e = a.ua.height, new N(c, 0, d, e);
for (var g = a.nodeSpacing, h = a.rowSpacing, k = 90 === ht(a), l = 0, m = 0, n = 0, p = 0; p < f; p++) if (!(0 !== p % 2 || 1 < f && p === f - 1)) {
var r = b[p], q = r.ua, u = 0 === l ? 0 : h;
if (k) {
var v = Ft(r) - g;
r.T.h(c - (q.width + v), n + u);
d = Math.max(d, q.width + v);
e = Math.max(e, n + u + q.height);
n += u + q.height
} else v = Ft(r) - g, r.T.h(m + u, c - (q.height + v)), e = Math.max(e, q.height + v), d = Math.max(d, m + u + q.width), m += u + q.width;
l++
}
l = 0;
r = m;
p = n;
k ?
(m = c + g, n = 0) : (m = 0, n = c + g);
for (q = 0; q < f; q++) if (0 !== q % 2) {
u = b[q];
v = u.ua;
var w = 0 === l ? 0 : h;
if (k) {
var z = Ft(u) - g;
u.T.h(m + z, n + w);
d = Math.max(d, m + v.width + z);
e = Math.max(e, n + w + v.height);
n += w + v.height
} else z = Ft(u) - g, u.T.h(m + w, n + z), d = Math.max(d, m + w + v.width), e = Math.max(e, n + v.height + z), m += w + v.width;
l++
}
1 < f && 1 === f % 2 && (b = b[f - 1], f = b.ua, h = null === b.parent ? 0 : b.parent.rowSpacing, k ? (b.T.h(c + g / 2 - b.focus.x - b.ia.x, e + h), k = c + g / 2 - b.focus.x - b.ia.x, d = Math.max(d, k + f.width), 0 > k && (d -= k), e = Math.max(e, Math.max(p, n) + h + f.height), 0 > b.T.x &&
(c = Gt(a, b.T.x, !1, c, g))) : (b.T.h(d + h, c + g / 2 - b.focus.y - b.ia.y), d = Math.max(d, Math.max(r, m) + h + f.width), n = c + g / 2 - b.focus.y - b.ia.y, e = Math.max(e, n + f.height), 0 > n && (e -= n), 0 > b.T.y && (c = Gt(a, b.T.y, !0, c, g))));
return new N(c, 0, d, e)
}
function st(a, b, c, d, e) {
var f = b.length;
if (0 === f) return new N(c, 0, d, e);
if (1 === f) return b = b[0], d = b.ua.width, e = b.ua.height, new N(c, 0, d, e);
for (var g = a.nodeSpacing, h = a.rowSpacing, k = 270 === ht(a), l = 0, m = 0, n = 0, p = 0; p < f; p++) if (!(0 !== p % 2 || 1 < f && p === f - 1)) {
var r = b[p], q = r.ua, u = 0 === l ? 0 : h;
if (k) {
var v = Ft(r) - g;
n -= u + q.height;
r.T.h(c - (q.width + v), n);
d = Math.max(d, q.width + v);
e = Math.max(e, Math.abs(n))
} else v = Ft(r) - g, m -= u + q.width, r.T.h(m, c - (q.height + v)), e = Math.max(e, q.height + v), d = Math.max(d, Math.abs(m));
l++
}
l = 0;
r = m;
p = n;
k ? (m =
c + g, n = 0) : (m = 0, n = c + g);
for (q = 0; q < f; q++) if (0 !== q % 2) {
u = b[q];
v = u.ua;
var w = 0 === l ? 0 : h;
if (k) {
var z = Ft(u) - g;
n -= w + v.height;
u.T.h(m + z, n);
d = Math.max(d, m + v.width + z);
e = Math.max(e, Math.abs(n))
} else z = Ft(u) - g, m -= w + v.width, u.T.h(m, n + z), e = Math.max(e, n + v.height + z), d = Math.max(d, Math.abs(m));
l++
}
1 < f && 1 === f % 2 && (h = b[f - 1], l = h.ua, q = null === h.parent ? 0 : h.parent.rowSpacing, k ? (h.T.h(c + g / 2 - h.focus.x - h.ia.x, -e - l.height - q), m = c + g / 2 - h.focus.x - h.ia.x, d = Math.max(d, m + l.width), 0 > m && (d -= m), e = Math.max(e, Math.abs(Math.min(p, n)) + q + l.height),
0 > h.T.x && (c = Gt(a, h.T.x, !1, c, g))) : (h.T.h(-d - l.width - q, c + g / 2 - h.focus.y - h.ia.y), d = Math.max(d, Math.abs(Math.min(r, m)) + q + l.width), n = c + g / 2 - h.focus.y - h.ia.y, e = Math.max(e, n + l.height), 0 > n && (e -= n), 0 > h.T.y && (c = Gt(a, h.T.y, !0, c, g))));
for (a = 0; a < f; a++) g = b[a], k ? g.T.h(g.T.x, g.T.y + e) : g.T.h(g.T.x + d, g.T.y);
return new N(c, 0, d, e)
}
function Ft(a) {
return null === a.parent ? 0 : a.parent.nodeSpacing
}
function Gt(a, b, c, d, e) {
a = a.children;
for (var f = a.length, g = 0; g < f; g++) c ? a[g].T.h(a[g].T.x, a[g].T.y - b) : a[g].T.h(a[g].T.x - b, a[g].T.y);
b = a[f - 1];
return Math.max(d, c ? b.ia.y + b.focus.y - e / 2 : b.ia.x + b.focus.x - e / 2)
}
function Bt(a, b, c) {
switch (a.alignment) {
case At:
case zt:
return c + a.width > b && (b = c + a.width), 0 > c && (b -= c), b;
case qt:
return a.width > b ? a.width : b;
case it:
return 2 * a.focus.x > b ? a.width : b + a.width - 2 * a.focus.x;
case $s:
case Qs:
return Math.max(a.width, Math.max(b, c + a.width) - Math.min(0, c));
case at:
return a.width - a.focus.x + a.nodeSpacing / 2 + b;
case bt:
return Math.max(a.width, a.focus.x + a.nodeSpacing / 2 + b);
default:
return b
}
}
function Ct(a, b, c) {
switch (a.alignment) {
case At:
case zt:
return c + a.height > b && (b = c + a.height), 0 > c && (b -= c), b;
case qt:
return a.height > b ? a.height : b;
case it:
return 2 * a.focus.y > b ? a.height : b + a.height - 2 * a.focus.y;
case $s:
case Qs:
return Math.max(a.height, Math.max(b, c + a.height) - Math.min(0, c));
case at:
return a.height - a.focus.y + a.nodeSpacing / 2 + b;
case bt:
return Math.max(a.height, a.focus.y + a.nodeSpacing / 2 + b);
default:
return b
}
}
function Dt(a, b, c) {
switch (a) {
case zt:
b /= 2;
c /= 2;
break;
case At:
b /= 2;
c /= 2;
break;
case qt:
c = b = 0;
break;
case it:
break;
default:
B("Unhandled alignment value " + a.toString())
}
return new G(b, c)
}
function ut(a, b, c, d, e, f) {
b = Dt(b, c, d);
xt(a, b.x, b.y, e, f)
}
function xt(a, b, c, d, e) {
if (0 !== b || 0 !== c) for (a = a.children; d <= e; d++) {
var f = a[d].T;
f.x += b;
f.y += c
}
}
function vt(a, b, c, d) {
var e = b.parent;
switch (a.Zc) {
case zs:
for (a = b.sourceEdges; a.next();) b = a.value, b.fromVertex === e && b.relativePoint.h(c, d);
break;
case Gs:
for (a = b.destinationEdges; a.next();) b = a.value, b.toVertex === e && b.relativePoint.h(c, d);
break;
default:
B("Unhandled path value " + a.Zc.toString())
}
}
function yt(a, b, c) {
for (var d = 0; d < a.length; d++) {
var e = a[d];
e.x += b;
e.y += c
}
}
function wt(a, b, c, d, e, f, g, h) {
var k = ht(b), l = 90 === k || 270 === k, m = b.nodeSpacing;
b = d;
var n = e;
d = f;
var p = g, r = c.gq, q = c.sq;
g = c.ua;
var u = l ? Math.max(p, g.height) : Math.max(d, g.width);
if (null === r || k !== ht(c)) r = tt(a, 2), q = tt(a, 2), l ? (r[0].h(0, 0), r[1].h(0, g.height), q[0].h(g.width, 0), q[1].h(q[0].x, r[1].y)) : (r[0].h(0, 0), r[1].h(g.width, 0), q[0].h(0, g.height), q[1].h(r[1].x, q[0].y));
if (l) {
p = 9999999;
if (!(null === n || 2 > n.length || null === r || 2 > r.length)) for (e = c = 0; c < n.length && e < r.length;) {
f = n[c];
var v = r[e];
k = v.x;
l = v.y;
k += d;
var w =
f;
c + 1 < n.length && (w = n[c + 1]);
var z = v;
v = z.x;
z = z.y;
e + 1 < r.length && (z = r[e + 1], v = z.x, z = z.y, v += d);
var y = p;
f.y === l ? y = k - f.x : f.y > l && f.y < z ? y = k + (f.y - l) / (z - l) * (v - k) - f.x : l > f.y && l < w.y && (y = k - (f.x + (l - f.y) / (w.y - f.y) * (w.x - f.x)));
y < p && (p = y);
w.y <= f.y ? c++ : z <= l ? e++ : (w.y <= z && c++, z <= w.y && e++)
}
p = d - p;
p += m;
c = r;
e = p;
if (null === b || 2 > b.length || null === c || 2 > c.length) d = null; else {
m = tt(a, b.length + c.length);
for (d = f = k = 0; f < c.length && c[f].y < b[0].y;) l = c[f++], m[d++].h(l.x + e, l.y);
for (; k < b.length;) l = b[k++], m[d++].h(l.x, l.y);
for (k = b[b.length - 1].y; f <
c.length && c[f].y <= k;) f++;
for (; f < c.length && c[f].y > k;) l = c[f++], m[d++].h(l.x + e, l.y);
c = tt(a, d);
for (k = 0; k < d; k++) c[k].assign(m[k]);
Et(a, m);
d = c
}
f = q;
k = p;
if (null === n || 2 > n.length || null === f || 2 > f.length) e = null; else {
m = tt(a, n.length + f.length);
for (e = l = c = 0; c < n.length && n[c].y < f[0].y;) w = n[c++], m[e++].h(w.x, w.y);
for (; l < f.length;) w = f[l++], m[e++].h(w.x + k, w.y);
for (f = f[f.length - 1].y; c < n.length && n[c].y <= f;) c++;
for (; c < n.length && n[c].y > f;) k = n[c++], m[e++].h(k.x, k.y);
f = tt(a, e);
for (c = 0; c < e; c++) f[c].assign(m[c]);
Et(a, m);
e = f
}
f =
Math.max(0, p) + g.width;
g = u;
Et(a, b);
Et(a, r);
Et(a, n);
Et(a, q);
h[0] = d;
h[1] = e;
return new N(p, 0, f, g)
}
d = 9999999;
if (!(null === n || 2 > n.length || null === r || 2 > r.length)) for (e = c = 0; c < n.length && e < r.length;) f = n[c], v = r[e], k = v.x, l = v.y, l += p, w = f, c + 1 < n.length && (w = n[c + 1]), z = v, v = z.x, z = z.y, e + 1 < r.length && (z = r[e + 1], v = z.x, z = z.y, z += p), y = d, f.x === k ? y = l - f.y : f.x > k && f.x < v ? y = l + (f.x - k) / (v - k) * (z - l) - f.y : k > f.x && k < w.x && (y = l - (f.y + (k - f.x) / (w.x - f.x) * (w.y - f.y))), y < d && (d = y), w.x <= f.x ? c++ : v <= k ? e++ : (w.x <= v && c++, v <= w.x && e++);
p -= d;
p += m;
c = r;
e = p;
if (null ===
b || 2 > b.length || null === c || 2 > c.length) d = null; else {
m = tt(a, b.length + c.length);
for (d = f = k = 0; f < c.length && c[f].x < b[0].x;) l = c[f++], m[d++].h(l.x, l.y + e);
for (; k < b.length;) l = b[k++], m[d++].h(l.x, l.y);
for (k = b[b.length - 1].x; f < c.length && c[f].x <= k;) f++;
for (; f < c.length && c[f].x > k;) l = c[f++], m[d++].h(l.x, l.y + e);
c = tt(a, d);
for (k = 0; k < d; k++) c[k].assign(m[k]);
Et(a, m);
d = c
}
f = q;
k = p;
if (null === n || 2 > n.length || null === f || 2 > f.length) e = null; else {
m = tt(a, n.length + f.length);
for (e = l = c = 0; c < n.length && n[c].x < f[0].x;) w = n[c++], m[e++].h(w.x, w.y);
for (; l < f.length;) w = f[l++], m[e++].h(w.x, w.y + k);
for (f = f[f.length - 1].x; c < n.length && n[c].x <= f;) c++;
for (; c < n.length && n[c].x > f;) k = n[c++], m[e++].h(k.x, k.y);
f = tt(a, e);
for (c = 0; c < e; c++) f[c].assign(m[c]);
Et(a, m);
e = f
}
f = u;
g = Math.max(0, p) + g.height;
Et(a, b);
Et(a, r);
Et(a, n);
Et(a, q);
h[0] = d;
h[1] = e;
return new N(p, 0, f, g)
}
function tt(a, b) {
a = a.yu[b];
if (void 0 !== a && (a = a.pop(), void 0 !== a)) return a;
a = [];
for (var c = 0; c < b; c++) a[c] = new G;
return a
}
function Et(a, b) {
var c = b.length, d = a.yu[c];
void 0 === d && (d = [], a.yu[c] = d);
d.push(b)
}
xs.prototype.arrangeTrees = function () {
if (this.Ab === Fs) for (var a = this.Fb.iterator; a.next();) {
var b = a.value;
if (b instanceof Es) {
var c = b.node;
if (null !== c) {
var d = c.position;
c = d.x;
d = d.y;
isFinite(c) || (c = 0);
isFinite(d) || (d = 0);
Ht(this, b, c, d)
}
}
} else {
a = [];
for (b = this.Fb.iterator; b.next();) c = b.value, c instanceof Es && a.push(c);
switch (this.sorting) {
case Vs:
break;
case Ws:
a.reverse();
break;
case Xs:
a.sort(this.comparer);
break;
case Ys:
a.sort(this.comparer);
a.reverse();
break;
default:
B("Unhandled sorting value " + this.sorting.toString())
}
c =
this.arrangementOrigin;
b = c.x;
c = c.y;
for (d = 0; d < a.length; d++) {
var e = a[d];
Ht(this, e, b + e.ia.x, c + e.ia.y);
switch (this.Ab) {
case Cs:
c += e.ua.height + this.wd.height;
break;
case It:
b += e.ua.width + this.wd.width;
break;
default:
B("Unhandled arrangement value " + this.Ab.toString())
}
}
}
};
function Ht(a, b, c, d) {
if (null !== b) {
b.x = c;
b.y = d;
b = b.children;
for (var e = b.length, f = 0; f < e; f++) {
var g = b[f];
Ht(a, g, c + g.T.x, d + g.T.y)
}
}
}
xs.prototype.commitLayout = function () {
this.Lv();
this.commitNodes();
this.Ou();
this.isRouting && this.commitLinks()
};
xs.prototype.commitNodes = function () {
for (var a = this.network.vertexes.iterator; a.next();) a.value.commit();
for (a.reset(); a.next();) this.layoutComments(a.value)
};
xs.prototype.Ou = function () {
if (this.layerStyle === Ns) {
for (var a = this.iw, b = [], c = null, d = this.network.vertexes.iterator; d.next();) {
var e = d.value;
null === c ? c = e.bounds.copy() : c.Jc(e.bounds);
var f = b[e.level];
void 0 === f ? f = jt(e) : f = Math.max(f, jt(e));
b[e.level] = f
}
for (d = 0; d < b.length; d++) void 0 === b[d] && (b[d] = 0);
90 === this.angle || 270 === this.angle ? (c.Uc(this.nodeSpacing / 2, this.layerSpacing), d = new G(-this.nodeSpacing / 2, -this.layerSpacing / 2)) : (c.Uc(this.layerSpacing, this.nodeSpacing / 2), d = new G(-this.layerSpacing / 2, -this.nodeSpacing /
2));
e = [];
c = 90 === this.angle || 270 === this.angle ? c.width : c.height;
f = 0;
if (180 === this.angle || 270 === this.angle) for (var g = 0; g < a.length; g++) f += a[g] + b[g];
for (g = 0; g < a.length; g++) {
var h = a[g] + b[g];
270 === this.angle ? (f -= h, e.push(new N(0, f, c, h))) : 90 === this.angle ? (e.push(new N(0, f, c, h)), f += h) : 180 === this.angle ? (f -= h, e.push(new N(f, 0, h, c))) : (e.push(new N(f, 0, h, c)), f += h)
}
this.commitLayers(e, d)
}
};
xs.prototype.commitLayers = function () {
};
xs.prototype.commitLinks = function () {
for (var a = this.network.edges.iterator; a.next();) a.value.commit()
};
xs.prototype.Lv = function () {
for (var a = this.Fb.iterator; a.next();) {
var b = a.value;
b instanceof Es && Jt(this, b)
}
};
function Jt(a, b) {
if (null !== b) {
a.setPortSpots(b);
b = b.children;
for (var c = b.length, d = 0; d < c; d++) Jt(a, b[d])
}
}
xs.prototype.setPortSpots = function (a) {
var b = a.alignment;
if (Zs(b)) {
var c = this.Zc === zs, d = ht(a);
switch (d) {
case 0:
var e = md;
break;
case 90:
e = nd;
break;
case 180:
e = ld;
break;
default:
e = fd
}
var f = a.children, g = f.length;
switch (b) {
case $s:
case Qs:
for (b = 0; b < g; b++) {
var h = f[b];
h = (c ? h.sourceEdges : h.destinationEdges).first();
if (null !== h && (h = h.link, null !== h)) {
var k = 90 === d || 270 === d ? ld : fd;
if (1 === g || b === g - 1 && 1 === g % 2) switch (d) {
case 0:
k = ld;
break;
case 90:
k = fd;
break;
case 180:
k = md;
break;
default:
k = nd
} else 0 === b % 2 && (k = 90 === d || 270 ===
d ? md : nd);
c ? (a.setsPortSpot && (h.fromSpot = e), a.setsChildPortSpot && (h.toSpot = k)) : (a.setsPortSpot && (h.fromSpot = k), a.setsChildPortSpot && (h.toSpot = e))
}
}
break;
case at:
d = 90 === d || 270 === d ? md : nd;
for (f = c ? a.destinationEdges : a.sourceEdges; f.next();) g = f.value.link, null !== g && (c ? (a.setsPortSpot && (g.fromSpot = e), a.setsChildPortSpot && (g.toSpot = d)) : (a.setsPortSpot && (g.fromSpot = d), a.setsChildPortSpot && (g.toSpot = e)));
break;
case bt:
for (d = 90 === d || 270 === d ? ld : fd, f = c ? a.destinationEdges : a.sourceEdges; f.next();) g = f.value.link,
null !== g && (c ? (a.setsPortSpot && (g.fromSpot = e), a.setsChildPortSpot && (g.toSpot = d)) : (a.setsPortSpot && (g.fromSpot = d), a.setsChildPortSpot && (g.toSpot = e)))
}
} else if (c = ht(a), this.Zc === zs) for (e = a.destinationEdges; e.next();) {
if (d = e.value.link, null !== d) {
if (a.setsPortSpot) if (a.portSpot.Kb()) switch (c) {
case 0:
d.fromSpot = md;
break;
case 90:
d.fromSpot = nd;
break;
case 180:
d.fromSpot = ld;
break;
default:
d.fromSpot = fd
} else d.fromSpot = a.portSpot;
if (a.setsChildPortSpot) if (a.childPortSpot.Kb()) switch (c) {
case 0:
d.toSpot = ld;
break;
case 90:
d.toSpot = fd;
break;
case 180:
d.toSpot = md;
break;
default:
d.toSpot = nd
} else d.toSpot = a.childPortSpot
}
} else for (e = a.sourceEdges; e.next();) if (d = e.value.link, null !== d) {
if (a.setsPortSpot) if (a.portSpot.Kb()) switch (c) {
case 0:
d.toSpot = md;
break;
case 90:
d.toSpot = nd;
break;
case 180:
d.toSpot = ld;
break;
default:
d.toSpot = fd
} else d.toSpot = a.portSpot;
if (a.setsChildPortSpot) if (a.childPortSpot.Kb()) switch (c) {
case 0:
d.fromSpot = ld;
break;
case 90:
d.fromSpot = fd;
break;
case 180:
d.fromSpot = md;
break;
default:
d.fromSpot = nd
} else d.fromSpot =
a.childPortSpot
}
};
function ht(a) {
a = a.angle;
return 45 >= a ? 0 : 135 >= a ? 90 : 225 >= a ? 180 : 315 >= a ? 270 : 0
}
function jt(a) {
var b = ht(a);
b = 90 === b || 270 === b;
var c = a.layerSpacing;
if (0 < a.layerSpacingParentOverlap) {
var d = Math.min(1, a.layerSpacingParentOverlap);
c -= b ? a.height * d : a.width * d
}
c < (b ? -a.height : -a.width) && (c = b ? -a.height : -a.width);
return c
}
function kt(a) {
var b = ht(a), c = a.nodeIndent;
if (0 < a.nodeIndentPastParent) {
var d = Math.min(1, a.nodeIndentPastParent);
c += 90 === b || 270 === b ? a.width * d : a.height * d
}
return c = Math.max(0, c)
}
ma.Object.defineProperties(xs.prototype, {
roots: {
get: function () {
return this.Fb
}, set: function (a) {
this.Fb !== a && (this.Fb = a, this.B())
}
}, path: {
get: function () {
return this.Po
}, set: function (a) {
this.Po !== a && (this.Po = a, this.B())
}
}, treeStyle: {
get: function () {
return this.Gp
}, set: function (a) {
this.Ab === a || a !== As && a !== Ts && a !== Us && a !== Ss || (this.Gp = a, this.B())
}
}, layerStyle: {
get: function () {
return this.Or
},
set: function (a) {
this.Ab === a || a !== Bs && a !== Os && a !== Ns || (this.Or = a, this.B())
}
}, comments: {
get: function () {
return this.Xc
}, set: function (a) {
this.Xc !== a && (this.Xc = a, this.B())
}
}, arrangement: {
get: function () {
return this.Ab
}, set: function (a) {
this.Ab === a || a !== Cs && a !== It && a !== Fs || (this.Ab = a, this.B())
}
}, arrangementSpacing: {
get: function () {
return this.wd
}, set: function (a) {
this.wd.A(a) || (this.wd.assign(a), this.B())
}
}, rootDefaults: {
get: function () {
return this.U
}, set: function (a) {
this.U !== a && (this.U = a, this.B())
}
}, alternateDefaults: {
get: function () {
return this.V
}, set: function (a) {
this.V !== a && (this.V = a, this.B())
}
}, sorting: {
get: function () {
return this.U.sorting
}, set: function (a) {
this.U.sorting === a || a !== Vs && a !== Ws && a !== Xs && !Ys || (this.U.sorting = a, this.B())
}
}, comparer: {
get: function () {
return this.U.comparer
}, set: function (a) {
this.U.comparer !==
a && (this.U.comparer = a, this.B())
}
}, angle: {
get: function () {
return this.U.angle
}, set: function (a) {
this.U.angle !== a && (0 === a || 90 === a || 180 === a || 270 === a ? (this.U.angle = a, this.B()) : B("TreeLayout.angle must be 0, 90, 180, or 270"))
}
}, alignment: {
get: function () {
return this.U.alignment
}, set: function (a) {
this.U.alignment !== a && (this.U.alignment = a, this.B())
}
}, nodeIndent: {
get: function () {
return this.U.nodeIndent
}, set: function (a) {
this.U.nodeIndent !==
a && 0 <= a && (this.U.nodeIndent = a, this.B())
}
}, nodeIndentPastParent: {
get: function () {
return this.U.nodeIndentPastParent
}, set: function (a) {
this.U.nodeIndentPastParent !== a && 0 <= a && 1 >= a && (this.U.nodeIndentPastParent = a, this.B())
}
}, nodeSpacing: {
get: function () {
return this.U.nodeSpacing
}, set: function (a) {
this.U.nodeSpacing !== a && (this.U.nodeSpacing = a, this.B())
}
}, layerSpacing: {
get: function () {
return this.U.layerSpacing
}, set: function (a) {
this.U.layerSpacing !==
a && (this.U.layerSpacing = a, this.B())
}
}, layerSpacingParentOverlap: {
get: function () {
return this.U.layerSpacingParentOverlap
}, set: function (a) {
this.U.layerSpacingParentOverlap !== a && 0 <= a && 1 >= a && (this.U.layerSpacingParentOverlap = a, this.B())
}
}, compaction: {
get: function () {
return this.U.compaction
}, set: function (a) {
this.U.compaction === a || a !== et && a !== gt || (this.U.compaction = a, this.B())
}
}, breadthLimit: {
get: function () {
return this.U.breadthLimit
},
set: function (a) {
this.U.breadthLimit !== a && 0 <= a && (this.U.breadthLimit = a, this.B())
}
}, rowSpacing: {
get: function () {
return this.U.rowSpacing
}, set: function (a) {
this.U.rowSpacing !== a && (this.U.rowSpacing = a, this.B())
}
}, rowIndent: {
get: function () {
return this.U.rowIndent
}, set: function (a) {
this.U.rowIndent !== a && 0 <= a && (this.U.rowIndent = a, this.B())
}
}, commentSpacing: {
get: function () {
return this.U.commentSpacing
}, set: function (a) {
this.U.commentSpacing !==
a && (this.U.commentSpacing = a, this.B())
}
}, commentMargin: {
get: function () {
return this.U.commentMargin
}, set: function (a) {
this.U.commentMargin !== a && (this.U.commentMargin = a, this.B())
}
}, setsPortSpot: {
get: function () {
return this.U.setsPortSpot
}, set: function (a) {
this.U.setsPortSpot !== a && (this.U.setsPortSpot = a, this.B())
}
}, portSpot: {
get: function () {
return this.U.portSpot
}, set: function (a) {
this.U.portSpot.A(a) || (this.U.portSpot =
a, this.B())
}
}, setsChildPortSpot: {
get: function () {
return this.U.setsChildPortSpot
}, set: function (a) {
this.U.setsChildPortSpot !== a && (this.U.setsChildPortSpot = a, this.B())
}
}, childPortSpot: {
get: function () {
return this.U.childPortSpot
}, set: function (a) {
this.U.childPortSpot.A(a) || (this.U.childPortSpot = a, this.B())
}
}, alternateSorting: {
get: function () {
return this.V.sorting
}, set: function (a) {
this.V.sorting === a || a !== Vs && a !== Ws &&
a !== Xs && !Ys || (this.V.sorting = a, this.B())
}
}, alternateComparer: {
get: function () {
return this.V.comparer
}, set: function (a) {
this.V.comparer !== a && (this.V.comparer = a, this.B())
}
}, alternateAngle: {
get: function () {
return this.V.angle
}, set: function (a) {
this.V.angle === a || 0 !== a && 90 !== a && 180 !== a && 270 !== a || (this.V.angle = a, this.B())
}
}, alternateAlignment: {
get: function () {
return this.V.alignment
}, set: function (a) {
this.V.alignment !==
a && (this.V.alignment = a, this.B())
}
}, alternateNodeIndent: {
get: function () {
return this.V.nodeIndent
}, set: function (a) {
this.V.nodeIndent !== a && 0 <= a && (this.V.nodeIndent = a, this.B())
}
}, alternateNodeIndentPastParent: {
get: function () {
return this.V.nodeIndentPastParent
}, set: function (a) {
this.V.nodeIndentPastParent !== a && 0 <= a && 1 >= a && (this.V.nodeIndentPastParent = a, this.B())
}
}, alternateNodeSpacing: {
get: function () {
return this.V.nodeSpacing
},
set: function (a) {
this.V.nodeSpacing !== a && (this.V.nodeSpacing = a, this.B())
}
}, alternateLayerSpacing: {
get: function () {
return this.V.layerSpacing
}, set: function (a) {
this.V.layerSpacing !== a && (this.V.layerSpacing = a, this.B())
}
}, alternateLayerSpacingParentOverlap: {
get: function () {
return this.V.layerSpacingParentOverlap
}, set: function (a) {
this.V.layerSpacingParentOverlap !== a && 0 <= a && 1 >= a && (this.V.layerSpacingParentOverlap = a, this.B())
}
}, alternateCompaction: {
get: function () {
return this.V.compaction
}, set: function (a) {
this.V.compaction === a || a !== et && a !== gt || (this.V.compaction = a, this.B())
}
}, alternateBreadthLimit: {
get: function () {
return this.V.breadthLimit
}, set: function (a) {
this.V.breadthLimit !== a && 0 <= a && (this.V.breadthLimit = a, this.B())
}
}, alternateRowSpacing: {
get: function () {
return this.V.rowSpacing
}, set: function (a) {
this.V.rowSpacing !== a && (this.V.rowSpacing = a, this.B())
}
}, alternateRowIndent: {
get: function () {
return this.V.rowIndent
}, set: function (a) {
this.V.rowIndent !== a && 0 <= a && (this.V.rowIndent = a, this.B())
}
}, alternateCommentSpacing: {
get: function () {
return this.V.commentSpacing
}, set: function (a) {
this.V.commentSpacing !== a && (this.V.commentSpacing = a, this.B())
}
}, alternateCommentMargin: {
get: function () {
return this.V.commentMargin
}, set: function (a) {
this.V.commentMargin !== a && (this.V.commentMargin = a, this.B())
}
}, alternateSetsPortSpot: {
get: function () {
return this.V.setsPortSpot
}, set: function (a) {
this.V.setsPortSpot !== a && (this.V.setsPortSpot = a, this.B())
}
}, alternatePortSpot: {
get: function () {
return this.V.portSpot
}, set: function (a) {
this.V.portSpot.A(a) || (this.V.portSpot = a, this.B())
}
}, alternateSetsChildPortSpot: {
get: function () {
return this.V.setsChildPortSpot
}, set: function (a) {
this.V.setsChildPortSpot !== a && (this.V.setsChildPortSpot = a, this.B())
}
}, alternateChildPortSpot: {
get: function () {
return this.V.childPortSpot
}, set: function (a) {
this.V.childPortSpot.A(a) || (this.V.childPortSpot = a, this.B())
}
}
});
var ys = new D(xs, "PathDefault", -1), zs = new D(xs, "PathDestination", 0), Gs = new D(xs, "PathSource", 1),
Vs = new D(xs, "SortingForwards", 10), Ws = new D(xs, "SortingReverse", 11),
Xs = new D(xs, "SortingAscending", 12), Ys = new D(xs, "SortingDescending", 13),
zt = new D(xs, "AlignmentCenterSubtrees", 20), At = new D(xs, "AlignmentCenterChildren", 21),
qt = new D(xs, "AlignmentStart", 22), it = new D(xs, "AlignmentEnd", 23), $s = new D(xs, "AlignmentBus", 24),
Qs = new D(xs, "AlignmentBusBranching", 25), at = new D(xs, "AlignmentTopLeftBus", 26), bt = new D(xs,
"AlignmentBottomRightBus", 27), et = new D(xs, "CompactionNone", 30), gt = new D(xs, "CompactionBlock", 31),
As = new D(xs, "StyleLayered", 40), Us = new D(xs, "StyleLastParents", 41),
Ts = new D(xs, "StyleAlternating", 42), Ss = new D(xs, "StyleRootOnly", 43),
Cs = new D(xs, "ArrangementVertical", 50), It = new D(xs, "ArrangementHorizontal", 51),
Fs = new D(xs, "ArrangementFixedRoots", 52), Bs = new D(xs, "LayerIndividual", 60),
Os = new D(xs, "LayerSiblings", 61), Ns = new D(xs, "LayerUniform", 62);
xs.className = "TreeLayout";
xs.PathDefault = ys;
xs.PathDestination = zs;
xs.PathSource = Gs;
xs.SortingForwards = Vs;
xs.SortingReverse = Ws;
xs.SortingAscending = Xs;
xs.SortingDescending = Ys;
xs.AlignmentCenterSubtrees = zt;
xs.AlignmentCenterChildren = At;
xs.AlignmentStart = qt;
xs.AlignmentEnd = it;
xs.AlignmentBus = $s;
xs.AlignmentBusBranching = Qs;
xs.AlignmentTopLeftBus = at;
xs.AlignmentBottomRightBus = bt;
xs.CompactionNone = et;
xs.CompactionBlock = gt;
xs.StyleLayered = As;
xs.StyleLastParents = Us;
xs.StyleAlternating = Ts;
xs.StyleRootOnly = Ss;
xs.ArrangementVertical = Cs;
xs.ArrangementHorizontal = It;
xs.ArrangementFixedRoots = Fs;
xs.LayerIndividual = Bs;
xs.LayerSiblings = Os;
xs.LayerUniform = Ns;
function Ds(a) {
wp.call(this, a)
}
la(Ds, wp);
Ds.prototype.createVertex = function () {
return new Es(this)
};
Ds.prototype.createEdge = function () {
return new Kt(this)
};
Ds.className = "TreeNetwork";
function Es(a) {
zp.call(this, a);
this.La = !1;
this.Kc = null;
this.K = [];
this.Vb = this.Ub = this.ba = this.Ma = 0;
this.Xc = null;
this.T = new G(0, 0);
this.ua = new M(0, 0);
this.ia = new G(0, 0);
this.vm = this.um = this.Pz = !1;
this.sq = this.gq = null;
this.Qc = Vs;
this.Mc = Fp;
this.zc = 0;
this.wb = At;
this.Zr = this.Yr = 0;
this.bs = 20;
this.ke = 50;
this.Nr = 0;
this.Vq = gt;
this.Oq = 0;
this.ns = 25;
this.Uq = this.ms = 10;
this.Tq = 20;
this.ws = !0;
this.js = ad;
this.vs = !0;
this.Rq = ad
}
la(Es, zp);
Es.prototype.copyInheritedPropertiesFrom = function (a) {
null !== a && (this.Qc = a.sorting, this.Mc = a.comparer, this.zc = a.angle, this.wb = a.alignment, this.Yr = a.nodeIndent, this.Zr = a.nodeIndentPastParent, this.bs = a.nodeSpacing, this.ke = a.layerSpacing, this.Nr = a.layerSpacingParentOverlap, this.Vq = a.compaction, this.Oq = a.breadthLimit, this.ns = a.rowSpacing, this.ms = a.rowIndent, this.Uq = a.commentSpacing, this.Tq = a.commentMargin, this.ws = a.setsPortSpot, this.js = a.portSpot, this.vs = a.setsChildPortSpot, this.Rq = a.childPortSpot)
};
ma.Object.defineProperties(Es.prototype, {
initialized: {
get: function () {
return this.La
}, set: function (a) {
this.La !== a && (this.La = a)
}
}, parent: {
get: function () {
return this.Kc
}, set: function (a) {
this.Kc !== a && (this.Kc = a)
}
}, children: {
get: function () {
return this.K
}, set: function (a) {
if (this.K !== a) {
if (null !== a) for (var b = a.length, c = 0; c < b; c++) ;
this.K = a
}
}
}, level: {
get: function () {
return this.Ma
}, set: function (a) {
this.Ma !==
a && (this.Ma = a)
}
}, descendantCount: {
get: function () {
return this.ba
}, set: function (a) {
this.ba !== a && (this.ba = a)
}
}, maxChildrenCount: {
get: function () {
return this.Ub
}, set: function (a) {
this.Ub !== a && (this.Ub = a)
}
}, maxGenerationCount: {
get: function () {
return this.Vb
}, set: function (a) {
this.Vb !== a && (this.Vb = a)
}
}, comments: {
get: function () {
return this.Xc
}, set: function (a) {
if (this.Xc !== a) {
if (null !== a) for (var b =
a.length, c = 0; c < b; c++) ;
this.Xc = a
}
}
}, sorting: {
get: function () {
return this.Qc
}, set: function (a) {
this.Qc !== a && (this.Qc = a)
}
}, comparer: {
get: function () {
return this.Mc
}, set: function (a) {
this.Mc !== a && (this.Mc = a)
}
}, angle: {
get: function () {
return this.zc
}, set: function (a) {
this.zc !== a && (this.zc = a)
}
}, alignment: {
get: function () {
return this.wb
}, set: function (a) {
this.wb !== a && (this.wb = a)
}
}, nodeIndent: {
get: function () {
return this.Yr
}, set: function (a) {
this.Yr !== a && (this.Yr = a)
}
}, nodeIndentPastParent: {
get: function () {
return this.Zr
}, set: function (a) {
this.Zr !== a && (this.Zr = a)
}
}, nodeSpacing: {
get: function () {
return this.bs
}, set: function (a) {
this.bs !== a && (this.bs = a)
}
}, layerSpacing: {
get: function () {
return this.ke
}, set: function (a) {
this.ke !== a && (this.ke = a)
}
}, layerSpacingParentOverlap: {
get: function () {
return this.Nr
}, set: function (a) {
this.Nr !== a && (this.Nr = a)
}
}, compaction: {
get: function () {
return this.Vq
}, set: function (a) {
this.Vq !== a && (this.Vq = a)
}
}, breadthLimit: {
get: function () {
return this.Oq
}, set: function (a) {
this.Oq !== a && (this.Oq = a)
}
}, rowSpacing: {
get: function () {
return this.ns
}, set: function (a) {
this.ns !== a && (this.ns = a)
}
}, rowIndent: {
get: function () {
return this.ms
}, set: function (a) {
this.ms !==
a && (this.ms = a)
}
}, commentSpacing: {
get: function () {
return this.Uq
}, set: function (a) {
this.Uq !== a && (this.Uq = a)
}
}, commentMargin: {
get: function () {
return this.Tq
}, set: function (a) {
this.Tq !== a && (this.Tq = a)
}
}, setsPortSpot: {
get: function () {
return this.ws
}, set: function (a) {
this.ws !== a && (this.ws = a)
}
}, portSpot: {
get: function () {
return this.js
}, set: function (a) {
this.js.A(a) || (this.js = a)
}
}, setsChildPortSpot: {
get: function () {
return this.vs
}, set: function (a) {
this.vs !== a && (this.vs = a)
}
}, childPortSpot: {
get: function () {
return this.Rq
}, set: function (a) {
this.Rq.A(a) || (this.Rq = a)
}
}, childrenCount: {
get: function () {
return this.children.length
}
}, relativePosition: {
get: function () {
return this.T
}, set: function (a) {
this.T.set(a)
}
}, subtreeSize: {
get: function () {
return this.ua
}, set: function (a) {
this.ua.set(a)
}
},
subtreeOffset: {
get: function () {
return this.ia
}, set: function (a) {
this.ia.set(a)
}
}
});
Es.className = "TreeVertex";
function Kt(a) {
Ap.call(this, a);
this.pu = new G(0, 0)
}
la(Kt, Ap);
Kt.prototype.commit = function () {
var a = this.link;
if (null !== a && !a.isAvoiding) {
var b = this.network.layout, c = null, d = null;
switch (b.Zc) {
case zs:
c = this.fromVertex;
d = this.toVertex;
break;
case Gs:
c = this.toVertex;
d = this.fromVertex;
break;
default:
B("Unhandled path value " + b.Zc.toString())
}
if (null !== c && null !== d) if (b = this.pu, 0 !== b.x || 0 !== b.y || c.Pz) {
d = c.bounds;
var e = ht(c), f = jt(c), g = c.rowSpacing;
a.$i();
var h = a.curve === tg, k = a.isOrthogonal, l;
a.Dh();
if (k || h) {
for (l = 2; 4 < a.pointsCount;) a.Bv(2);
var m = a.i(1);
var n = a.i(2)
} else {
for (l =
1; 3 < a.pointsCount;) a.Bv(1);
m = a.i(0);
n = a.i(a.pointsCount - 1)
}
var p = a.i(a.pointsCount - 1);
0 === e ? (c.alignment === it ? (e = d.bottom + b.y, 0 === b.y && m.y > p.y + c.rowIndent && (e = Math.min(e, Math.max(m.y, e - kt(c))))) : c.alignment === qt ? (e = d.top + b.y, 0 === b.y && m.y < p.y - c.rowIndent && (e = Math.max(e, Math.min(m.y, e + kt(c))))) : e = c.um || c.vm && 1 === c.maxGenerationCount ? d.top - c.ia.y + b.y : d.y + d.height / 2 + b.y, h ? (a.m(l, m.x, e), l++, a.m(l, d.right + f, e), l++, a.m(l, d.right + f + (b.x - g) / 3, e), l++, a.m(l, d.right + f + 2 * (b.x - g) / 3, e), l++, a.m(l, d.right + f + (b.x -
g), e), l++, a.m(l, n.x, e)) : (k && (a.m(l, d.right + f / 2, m.y), l++), a.m(l, d.right + f / 2, e), l++, a.m(l, d.right + f + b.x - (k ? g / 2 : g), e), l++, k && a.m(l, a.i(l - 1).x, n.y))) : 90 === e ? (c.alignment === it ? (e = d.right + b.x, 0 === b.x && m.x > p.x + c.rowIndent && (e = Math.min(e, Math.max(m.x, e - kt(c))))) : c.alignment === qt ? (e = d.left + b.x, 0 === b.x && m.x < p.x - c.rowIndent && (e = Math.max(e, Math.min(m.x, e + kt(c))))) : e = c.um || c.vm && 1 === c.maxGenerationCount ? d.left - c.ia.x + b.x : d.x + d.width / 2 + b.x, h ? (a.m(l, e, m.y), l++, a.m(l, e, d.bottom + f), l++, a.m(l, e, d.bottom + f + (b.y - g) /
3), l++, a.m(l, e, d.bottom + f + 2 * (b.y - g) / 3), l++, a.m(l, e, d.bottom + f + (b.y - g)), l++, a.m(l, e, n.y)) : (k && (a.m(l, m.x, d.bottom + f / 2), l++), a.m(l, e, d.bottom + f / 2), l++, a.m(l, e, d.bottom + f + b.y - (k ? g / 2 : g)), l++, k && a.m(l, n.x, a.i(l - 1).y))) : 180 === e ? (c.alignment === it ? (e = d.bottom + b.y, 0 === b.y && m.y > p.y + c.rowIndent && (e = Math.min(e, Math.max(m.y, e - kt(c))))) : c.alignment === qt ? (e = d.top + b.y, 0 === b.y && m.y < p.y - c.rowIndent && (e = Math.max(e, Math.min(m.y, e + kt(c))))) : e = c.um || c.vm && 1 === c.maxGenerationCount ? d.top - c.ia.y + b.y : d.y + d.height / 2 + b.y, h ?
(a.m(l, m.x, e), l++, a.m(l, d.left - f, e), l++, a.m(l, d.left - f + (b.x + g) / 3, e), l++, a.m(l, d.left - f + 2 * (b.x + g) / 3, e), l++, a.m(l, d.left - f + (b.x + g), e), l++, a.m(l, n.x, e)) : (k && (a.m(l, d.left - f / 2, m.y), l++), a.m(l, d.left - f / 2, e), l++, a.m(l, d.left - f + b.x + (k ? g / 2 : g), e), l++, k && a.m(l, a.i(l - 1).x, n.y))) : 270 === e ? (c.alignment === it ? (e = d.right + b.x, 0 === b.x && m.x > p.x + c.rowIndent && (e = Math.min(e, Math.max(m.x, e - kt(c))))) : c.alignment === qt ? (e = d.left + b.x, 0 === b.x && m.x < p.x - c.rowIndent && (e = Math.max(e, Math.min(m.x, e + kt(c))))) : e = c.um || c.vm && 1 === c.maxGenerationCount ?
d.left - c.ia.x + b.x : d.x + d.width / 2 + b.x, h ? (a.m(l, e, m.y), l++, a.m(l, e, d.top - f), l++, a.m(l, e, d.top - f + (b.y + g) / 3), l++, a.m(l, e, d.top - f + 2 * (b.y + g) / 3), l++, a.m(l, e, d.top - f + (b.y + g)), l++, a.m(l, e, n.y)) : (k && (a.m(l, m.x, d.top - f / 2), l++), a.m(l, e, d.top - f / 2), l++, a.m(l, e, d.top - f + b.y + (k ? g / 2 : g)), l++, k && a.m(l, n.x, a.i(l - 1).y))) : B("Invalid angle " + e);
a.mf()
} else a = this.link, f = ht(c), f !== ht(d) && (g = jt(c), h = c.bounds, c = d.bounds, 0 === f && c.left - h.right < g + 1 || 90 === f && c.top - h.bottom < g + 1 || 180 === f && h.left - c.right < g + 1 || 270 === f && h.top - c.bottom <
g + 1 || (a.$i(), c = a.curve === tg, b = a.isOrthogonal, d = Zs(this.fromVertex.alignment), a.Dh(), 0 === f ? (f = h.right + g / 2, c ? 4 === a.pointsCount && (c = a.i(3).y, a.M(1, f - 20, a.i(1).y), a.m(2, f - 20, c), a.m(3, f, c), a.m(4, f + 20, c), a.M(5, a.i(5).x, c)) : b ? d ? a.M(3, a.i(2).x, a.i(4).y) : 6 === a.pointsCount && (a.M(2, f, a.i(2).y), a.M(3, f, a.i(3).y)) : 4 === a.pointsCount ? a.m(2, f, a.i(2).y) : 3 === a.pointsCount ? a.M(1, f, a.i(2).y) : 2 === a.pointsCount && a.m(1, f, a.i(1).y)) : 90 === f ? (f = h.bottom + g / 2, c ? 4 === a.pointsCount && (c = a.i(3).x, a.M(1, a.i(1).x, f - 20), a.m(2, c, f - 20),
a.m(3, c, f), a.m(4, c, f + 20), a.M(5, c, a.i(5).y)) : b ? d ? a.M(3, a.i(2).x, a.i(4).y) : 6 === a.pointsCount && (a.M(2, a.i(2).x, f), a.M(3, a.i(3).x, f)) : 4 === a.pointsCount ? a.m(2, a.i(2).x, f) : 3 === a.pointsCount ? a.M(1, a.i(2).x, f) : 2 === a.pointsCount && a.m(1, a.i(1).x, f)) : 180 === f ? (f = h.left - g / 2, c ? 4 === a.pointsCount && (c = a.i(3).y, a.M(1, f + 20, a.i(1).y), a.m(2, f + 20, c), a.m(3, f, c), a.m(4, f - 20, c), a.M(5, a.i(5).x, c)) : b ? d ? a.M(3, a.i(2).x, a.i(4).y) : 6 === a.pointsCount && (a.M(2, f, a.i(2).y), a.M(3, f, a.i(3).y)) : 4 === a.pointsCount ? a.m(2, f, a.i(2).y) : 3 === a.pointsCount ?
a.M(1, f, a.i(2).y) : 2 === a.pointsCount && a.m(1, f, a.i(1).y)) : 270 === f && (f = h.top - g / 2, c ? 4 === a.pointsCount && (c = a.i(3).x, a.M(1, a.i(1).x, f + 20), a.m(2, c, f + 20), a.m(3, c, f), a.m(4, c, f - 20), a.M(5, c, a.i(5).y)) : b ? d ? a.M(3, a.i(2).x, a.i(4).y) : 6 === a.pointsCount && (a.M(2, a.i(2).x, f), a.M(3, a.i(3).x, f)) : 4 === a.pointsCount ? a.m(2, a.i(2).x, f) : 3 === a.pointsCount ? a.M(1, a.i(2).x, f) : 2 === a.pointsCount && a.m(1, a.i(1).x, f)), a.mf()))
}
};
ma.Object.defineProperties(Kt.prototype, {
relativePoint: {
get: function () {
return this.pu
}, set: function (a) {
this.pu.set(a)
}
}
});
Kt.className = "TreeEdge";
Na.prototype.initializeStandardTools = function () {
Pe(this, "Action", new Gg, this.mouseDownTools);
Pe(this, "Relinking", new ef, this.mouseDownTools);
Pe(this, "LinkReshaping", new rg, this.mouseDownTools);
Pe(this, "Rotating", new Eg, this.mouseDownTools);
Pe(this, "Resizing", new yg, this.mouseDownTools);
Pe(this, "Linking", new kg, this.mouseMoveTools);
Pe(this, "Dragging", new Re, this.mouseMoveTools);
Pe(this, "DragSelecting", new Jg, this.mouseMoveTools);
Pe(this, "Panning", new Kg, this.mouseMoveTools);
Pe(this, "ContextMenu", new Mg,
this.mouseUpTools);
Pe(this, "TextEditing", new Xg, this.mouseUpTools);
Pe(this, "ClickCreating", new Hg, this.mouseUpTools);
Pe(this, "ClickSelecting", new Fg, this.mouseUpTools)
};
Vm("Horizontal", new cm);
Vm("Spot", new em);
Vm("Table", new im);
Vm("Viewbox", new nm);
Vm("TableRow", new lm);
Vm("TableColumn", new mm);
Vm("Graduated", new wm);
ai.add(Cq.type, Yp);
ai.add(Fq.type, lq);
var Lt = x.go, Mt = {
get licenseKey() {
return P.licenseKey
},
set licenseKey(a) {
P.licenseKey = a
},
get version() {
return P.version
},
Group: U,
EnumValue: D,
List: E,
Set: F,
Map: vb,
Point: G,
Size: M,
Rect: N,
Margin: pc,
Spot: O,
Geometry: ud,
PathFigure: ke,
PathSegment: le,
InputEvent: ne,
DiagramEvent: pe,
ChangedEvent: qe,
Model: Z,
GraphLinksModel: Cq,
TreeModel: Fq,
Binding: si,
Transaction: ve,
UndoManager: Ce,
CommandHandler: vk,
Tool: Ee,
DraggingTool: Re,
DraggingInfo: ff,
LinkingBaseTool: Nf,
LinkingTool: kg,
RelinkingTool: ef,
LinkReshapingTool: rg,
ResizingTool: yg,
RotatingTool: Eg,
ClickSelectingTool: Fg,
ActionTool: Gg,
ClickCreatingTool: Hg,
HTMLInfo: Oe,
ContextMenuTool: Mg,
DragSelectingTool: Jg,
PanningTool: Kg,
TextEditingTool: Xg,
ToolManager: Na,
AnimationManager: vh,
Layer: Oh,
Diagram: P,
Palette: pk,
Overview: rk,
Brush: Yk,
GraphObject: Y,
Panel: X,
RowColumnDefinition: Aj,
Shape: W,
TextBlock: Yg,
TextBlockMetrics: ym,
Picture: Qj,
Part: S,
Adornment: Je,
Node: V,
Link: R,
Placeholder: zg,
Layout: gi,
LayoutNetwork: wp,
LayoutVertex: zp,
LayoutEdge: Ap,
GridLayout: qk,
PanelLayout: rl,
CircularLayout: Gq,
CircularNetwork: Yq,
CircularVertex: kr,
CircularEdge: lr,
ForceDirectedLayout: mr,
ForceDirectedNetwork: nr,
ForceDirectedVertex: zr,
ForceDirectedEdge: Ar,
LayeredDigraphLayout: Br,
LayeredDigraphNetwork: Gr,
LayeredDigraphVertex: vs,
LayeredDigraphEdge: ws,
TreeLayout: xs,
TreeNetwork: Ds,
TreeVertex: Es,
TreeEdge: Kt
};
Lt && Lt.version !== Mt.version && B("WARNING: a `go` object on the root object is already defined with a version mismatch." + Lt.version + ". Replaced with version: " + Mt.version);
x.go = Mt;
("undefined" === typeof x || "undefined" === typeof x.module || "object" !== typeof x.module.exports) && x.define && "function" === typeof x.define && x.define.amd && x.define(Mt);
'undefined' !== typeof module && 'object' === typeof module.exports && (module.exports = 'undefined' !== typeof global ? global.go : self.go);
})();