/*
* GoJS v2.2.15 JavaScript Library for HTML Diagrams, https://gojs.net
* GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com.
* Copyright (C) 1998-2022 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.2.15/license.html.
* DO NOT MODIFY THIS FILE. DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE. 7ca11abfd022028846 7ca11abfd022028846
*/
(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 ea =
'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 = ea(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.zA = b.prototype;
}
var ma = 'undefined' != typeof global && null != global ? global : self,
na =
'function' == typeof Object.assign
? Object.assign
: function(a, b) {
for (var c = 1; c < arguments.length; c++) {
var d = arguments[c];
if (d)
for (var e in d)
Object.prototype.hasOwnProperty.call(d, e) && (a[e] = d[e]);
}
return a;
},
pa =
'function' == typeof Object.defineProperties
? Object.defineProperty
: function(a, b, c) {
a != Array.prototype && a != Object.prototype && (a[b] = c.value);
};
function qa(a, b) {
if (b) {
var c = ma;
a = a.split('.');
for (var d = 0; d < a.length - 1; d++) {
var e = a[d];
e in c || (c[e] = {});
c = c[e];
}
a = a[a.length - 1];
d = c[a];
b = b(d);
b != d &&
null != b &&
pa(c, a, {
writable: !0,
value: b,
});
}
}
qa('Object.assign', function(a) {
return a || na;
});
qa('Array.prototype.fill', 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 globalThis && globalThis) ||
('object' === typeof global && global.global === global && global) ||
('object' === typeof self && self.self === self && self) ||
{};
void 0 === x.requestAnimationFrame &&
(void 0 === x.setImmediate
? (x.requestAnimationFrame = function(a) {
x.setTimeout(a, 0);
})
: (x.requestAnimationFrame = x.setImmediate));
function ra() {}
function sa(a, b) {
var c = -1;
return function() {
var d = this,
e = arguments;
-1 !== c && x.clearTimeout(c);
c = ta(function() {
c = -1;
a.apply(d, e);
}, b);
};
}
function ta(a, b) {
return x.setTimeout(a, b);
}
function ua(a) {
return x.document.createElement(a);
}
function C(a) {
throw Error(a);
}
function va(a, b) {
a =
'The object is frozen, so its properties cannot be set: ' + a.toString();
void 0 !== b && (a += ' to value: ' + b);
C(a);
}
function wa(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);
C(c + ' is not in the range ' + b + ': ' + a);
}
function xa(a) {
x.console && x.console.log(a);
}
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 Ca(a, b, c) {
Array.isArray(a)
? b >= a.length
? a.push(c)
: a.splice(b, 0, c)
: C(
'Cannot insert an object into an HTMLCollection or NodeList: ' +
c +
' at ' +
b,
);
}
function Da(a, b) {
Array.isArray(a)
? b >= a.length
? a.pop()
: a.splice(b, 1)
: C('Cannot remove an object from an HTMLCollection or NodeList at ' + b);
}
function Ea() {
var a = Fa.pop();
return void 0 === a ? [] : a;
}
function Ga(a) {
a.length = 0;
Fa.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 Ia(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 Ja(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.lA;
if (c && c[b]) return !0;
a = Object.getPrototypeOf(a);
}
return !1;
}
function Ka(a, b, c) {
Object.defineProperty(La.prototype, a, {
get: b,
set: c,
});
}
function Ma(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 Na =
void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf('Trident/7'),
Pa = void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf('Edge/'),
Qa =
void 0 !== x.navigator &&
void 0 !== x.navigator.platform &&
null !== x.navigator.platform.match(/(iPhone|iPod|iPad|Mac)/i),
Fa = [];
Object.freeze([]);
ra.className = 'Util';
ra.Dx = '32ab5ff3b26f42dc0ed90f21462913b5';
ra.adym = 'gojs.net';
ra.vfo = '28e644fdb263';
ra.className = 'Util';
function D(a, b, c) {
Ra(this);
this.j = a;
this.va = b;
this.m = c;
}
D.prototype.toString = function() {
return 'EnumValue.' + this.va;
};
function Sa(a, b) {
return void 0 === b || null === b || '' === b ? null : a[b];
}
ma.Object.defineProperties(D.prototype, {
classType: {
get: function() {
return this.j;
},
},
name: {
get: function() {
return this.va;
},
},
value: {
get: function() {
return this.m;
},
},
});
D.className = 'EnumValue';
function Ta() {
this.Jv = [];
}
Ta.prototype.toString = function() {
return this.Jv.join('');
};
Ta.prototype.add = function(a) {
'' !== a && this.Jv.push(a);
};
Ta.className = 'StringBuilder';
function Wa() {}
Wa.className = 'PropertyCollection';
var Xa = {
nA: !1,
sA: !1,
pA: !1,
rA: !1,
xA: !1,
vA: !1,
Rw: !1,
oA: null,
trace: function(a) {
x.console && x.console.log(a);
},
qA: function(a, b, c, d) {
a.strokeStyle = 'red';
a.fillStyle = 'red';
a.font = '8px sans-serif';
a.beginPath();
a.moveTo(-10, 0);
a.lineTo(10, 0);
a.moveTo(0, -10);
a.lineTo(0, 10);
a.stroke();
a.setTransform(1, 0, 0, 1, 0, 0);
a.scale(c, c);
a.transform(b.m11, b.m12, b.m21, b.m22, b.dx, b.dy);
a.lineWidth = 2;
a.beginPath();
a.moveTo(d.left, d.top + 20);
a.lineTo(d.left, d.top);
a.lineTo(d.left + 20, d.top);
a.moveTo(d.right, d.bottom - 20);
a.lineTo(d.right, d.bottom);
a.lineTo(d.right - 20, d.bottom);
a.stroke();
a.fillText(
'DB: ' +
Math.round(d.x) +
', ' +
Math.round(d.y) +
', ' +
Math.round(d.width) +
', ' +
Math.round(d.height),
d.left,
d.top - 5,
);
},
mA: function(a) {
var b = {},
c;
for (c in a) {
b.x = c;
if ('licenseKey' !== b.x) {
var d = a[b.x];
if (void 0 !== d.prototype) {
b.Gl = Object.getOwnPropertyNames(d.prototype);
for (
var e = {
Lj: 0,
};
e.Lj < b.Gl.length;
e = {
Lj: e.Lj,
},
e.Lj++
) {
var f = Object.getOwnPropertyDescriptor(d.prototype, b.Gl[e.Lj]);
void 0 !== f.get &&
void 0 === f.set &&
Object.defineProperty(d.prototype, b.Gl[e.Lj], {
set: (function(a, b) {
return function() {
throw Error(
'Property ' +
a.Gl[b.Lj] +
' of ' +
a.x +
' is read-only.',
);
};
})(b, e),
});
}
}
}
b = {
Gl: b.Gl,
x: b.x,
};
}
},
};
function Ya() {}
Ya.prototype.reset = function() {};
Ya.prototype.next = function() {
return !1;
};
Ya.prototype.ud = function() {
return !1;
};
Ya.prototype.first = function() {
return null;
};
Ya.prototype.any = function() {
return !1;
};
Ya.prototype.all = function() {
return !0;
};
Ya.prototype.each = function() {
return this;
};
Ya.prototype.map = function() {
return this;
};
Ya.prototype.filter = function() {
return this;
};
Ya.prototype.Xd = function() {};
Ya.prototype.toString = function() {
return 'EmptyIterator';
};
ma.Object.defineProperties(Ya.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return 0;
},
},
});
Ya.prototype.first = Ya.prototype.first;
Ya.prototype.hasNext = Ya.prototype.ud;
Ya.prototype.next = Ya.prototype.next;
Ya.prototype.reset = Ya.prototype.reset;
var Za = null;
Ya.className = 'EmptyIterator';
Za = new Ya();
function $a(a) {
this.key = -1;
this.value = a;
}
$a.prototype.reset = function() {
this.key = -1;
};
$a.prototype.next = function() {
return -1 === this.key ? ((this.key = 0), !0) : !1;
};
$a.prototype.ud = function() {
return this.next();
};
$a.prototype.first = function() {
this.key = 0;
return this.value;
};
$a.prototype.any = function(a) {
this.key = -1;
return a(this.value);
};
$a.prototype.all = function(a) {
this.key = -1;
return a(this.value);
};
$a.prototype.each = function(a) {
this.key = -1;
a(this.value);
return this;
};
$a.prototype.map = function(a) {
return new $a(a(this.value));
};
$a.prototype.filter = function(a) {
return a(this.value) ? new $a(this.value) : Za;
};
$a.prototype.Xd = function() {
this.value = null;
};
$a.prototype.toString = function() {
return 'SingletonIterator(' + this.value + ')';
};
ma.Object.defineProperties($a.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return 1;
},
},
});
$a.prototype.first = $a.prototype.first;
$a.prototype.hasNext = $a.prototype.ud;
$a.prototype.next = $a.prototype.next;
$a.prototype.reset = $a.prototype.reset;
$a.className = 'SingletonIterator';
function ab(a) {
this.xb = a;
this.cf = null;
a.Pa = null;
this.na = a.Ia;
this.Wa = -1;
}
ab.prototype.reset = function() {
var a = this.xb;
a.Pa = null;
this.na = a.Ia;
this.Wa = -1;
};
ab.prototype.next = function() {
var a = this.xb;
if (a.Ia !== this.na && 0 > this.key) return !1;
a = a.s;
var b = a.length,
c = ++this.Wa,
d = this.cf;
if (null !== d)
for (; c < b; ) {
var e = a[c];
if (d(e)) return (this.key = this.Wa = c), (this.value = e), !0;
c++;
}
else {
if (c < b) return (this.key = c), (this.value = a[c]), !0;
this.Xd();
}
return !1;
};
ab.prototype.ud = function() {
return this.next();
};
ab.prototype.first = function() {
var a = this.xb;
this.na = a.Ia;
this.Wa = 0;
a = a.s;
var b = a.length,
c = this.cf;
if (null !== c) {
for (var d = 0; d < b; ) {
var e = a[d];
if (c(e)) return (this.key = this.Wa = d), (this.value = e);
d++;
}
return null;
}
return 0 < b ? ((a = a[0]), (this.key = 0), (this.value = a)) : null;
};
ab.prototype.any = function(a) {
var b = this.xb;
b.Pa = null;
this.Wa = -1;
b = b.s;
for (var c = b.length, d = this.cf, e = 0; e < c; e++) {
var f = b[e];
if ((null === d || d(f)) && a(f)) return !0;
}
return !1;
};
ab.prototype.all = function(a) {
var b = this.xb;
b.Pa = null;
this.Wa = -1;
b = b.s;
for (var c = b.length, d = this.cf, e = 0; e < c; e++) {
var f = b[e];
if ((null === d || d(f)) && !a(f)) return !1;
}
return !0;
};
ab.prototype.each = function(a) {
var b = this.xb;
b.Pa = null;
this.Wa = -1;
b = b.s;
for (var c = b.length, d = this.cf, e = 0; e < c; e++) {
var f = b[e];
(null === d || d(f)) && a(f);
}
return this;
};
ab.prototype.map = function(a) {
var b = this.xb;
b.Pa = null;
this.Wa = -1;
var c = [];
b = b.s;
for (var d = b.length, e = this.cf, f = 0; f < d; f++) {
var g = b[f];
(null === e || e(g)) && c.push(a(g));
}
a = new E();
a.s = c;
a.sb();
return a.iterator;
};
ab.prototype.filter = function(a) {
var b = this.xb;
b.Pa = null;
this.Wa = -1;
var c = [];
b = b.s;
for (var d = b.length, e = this.cf, f = 0; f < d; f++) {
var g = b[f];
(null === e || e(g)) && a(g) && c.push(g);
}
a = new E();
a.s = c;
a.sb();
return a.iterator;
};
ab.prototype.Xd = function() {
this.key = -1;
this.value = null;
this.na = -1;
this.cf = null;
this.xb.Pa = this;
};
ab.prototype.toString = function() {
return 'ListIterator@' + this.Wa + '/' + this.xb.count;
};
ma.Object.defineProperties(ab.prototype, {
iterator: {
get: function() {
return this;
},
},
predicate: {
get: function() {
return this.cf;
},
set: function(a) {
this.cf = a;
},
},
count: {
get: function() {
var a = this.cf;
if (null !== a) {
for (var b = 0, c = this.xb.s, d = c.length, e = 0; e < d; e++)
a(c[e]) && b++;
return b;
}
return this.xb.s.length;
},
},
});
ab.prototype.first = ab.prototype.first;
ab.prototype.hasNext = ab.prototype.ud;
ab.prototype.next = ab.prototype.next;
ab.prototype.reset = ab.prototype.reset;
ab.className = 'ListIterator';
function bb(a) {
this.xb = a;
a.yg = null;
this.na = a.Ia;
this.Wa = a.s.length;
}
bb.prototype.reset = function() {
var a = this.xb;
a.yg = null;
this.na = a.Ia;
this.Wa = a.s.length;
};
bb.prototype.next = function() {
var a = this.xb;
if (a.Ia !== this.na && 0 > this.key) return !1;
var b = --this.Wa;
if (0 <= b) return (this.key = b), (this.value = a.s[b]), !0;
this.Xd();
return !1;
};
bb.prototype.ud = function() {
return this.next();
};
bb.prototype.first = function() {
var a = this.xb;
this.na = a.Ia;
var b = a.s;
this.Wa = a = b.length - 1;
return 0 <= a ? ((b = b[a]), (this.key = a), (this.value = b)) : null;
};
bb.prototype.any = function(a) {
var b = this.xb;
b.yg = null;
b = b.s;
var c = b.length;
this.Wa = c;
for (--c; 0 <= c; c--) if (a(b[c])) return !0;
return !1;
};
bb.prototype.all = function(a) {
var b = this.xb;
b.yg = null;
b = b.s;
var c = b.length;
this.Wa = c;
for (--c; 0 <= c; c--) if (!a(b[c])) return !1;
return !0;
};
bb.prototype.each = function(a) {
var b = this.xb;
b.yg = null;
b = b.s;
var c = b.length;
this.Wa = c;
for (--c; 0 <= c; c--) a(b[c]);
return this;
};
bb.prototype.map = function(a) {
var b = this.xb;
b.yg = null;
var c = [];
b = b.s;
var d = b.length;
this.Wa = d;
for (--d; 0 <= d; d--) c.push(a(b[d]));
a = new E();
a.s = c;
a.sb();
return a.iterator;
};
bb.prototype.filter = function(a) {
var b = this.xb;
b.yg = null;
var c = [];
b = b.s;
var d = b.length;
this.Wa = d;
for (--d; 0 <= d; d--) {
var e = b[d];
a(e) && c.push(e);
}
a = new E();
a.s = c;
a.sb();
return a.iterator;
};
bb.prototype.Xd = function() {
this.key = -1;
this.value = null;
this.na = -1;
this.xb.yg = this;
};
bb.prototype.toString = function() {
return 'ListIteratorBackwards(' + this.Wa + '/' + this.xb.count + ')';
};
ma.Object.defineProperties(bb.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return this.xb.s.length;
},
},
});
bb.prototype.first = bb.prototype.first;
bb.prototype.hasNext = bb.prototype.ud;
bb.prototype.next = bb.prototype.next;
bb.prototype.reset = bb.prototype.reset;
bb.className = 'ListIteratorBackwards';
function E(a) {
Ra(this);
this._isFrozen = !1;
this.s = [];
this.Ia = 0;
this.yg = this.Pa = null;
'string' === typeof a &&
C(
'Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.',
);
void 0 !== a && this.addAll(a);
}
t = E.prototype;
t.sb = function() {
var a = this.Ia;
a++;
999999999 < a && (a = 0);
this.Ia = a;
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
this._isFrozen = !1;
return this;
};
t.toString = function() {
return 'List()#' + cb(this);
};
t.add = function(a) {
if (null === a) return this;
this._isFrozen && va(this, a);
this.s.push(a);
this.sb();
return this;
};
t.push = function(a) {
this.add(a);
};
t.addAll = function(a) {
if (null === a) return this;
this._isFrozen && va(this);
var b = this.s;
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.sb();
return this;
};
t.clear = function() {
this._isFrozen && va(this);
this.s.length = 0;
this.sb();
};
t.contains = function(a) {
return null === a ? !1 : -1 !== this.s.indexOf(a);
};
t.has = function(a) {
return this.contains(a);
};
t.indexOf = function(a) {
return null === a ? -1 : this.s.indexOf(a);
};
t.K = function(a) {
var b = this.s;
(0 > a || a >= b.length) && wa(a, '0 <= i < length', E, 'elt:i');
return b[a];
};
t.get = function(a) {
return this.K(a);
};
t.Vc = function(a, b) {
var c = this.s;
(0 > a || a >= c.length) && wa(a, '0 <= i < length', E, 'setElt:i');
this._isFrozen && va(this, a);
c[a] = b;
};
t.set = function(a, b) {
this.Vc(a, b);
};
t.first = function() {
var a = this.s;
return 0 === a.length ? null : a[0];
};
t.fc = function() {
var a = this.s,
b = a.length;
return 0 < b ? a[b - 1] : null;
};
t.pop = function() {
this._isFrozen && va(this);
var a = this.s;
return 0 < a.length ? a.pop() : null;
};
E.prototype.any = function(a) {
for (var b = this.s, 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.s, 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.s, 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.s, e = d.length, f = 0; f < e; f++)
c.push(a(d[f]));
b.s = c;
b.sb();
return b;
};
E.prototype.filter = function(a) {
for (var b = new E(), c = [], d = this.s, e = d.length, f = 0; f < e; f++) {
var g = d[f];
a(g) && c.push(g);
}
b.s = c;
b.sb();
return b;
};
t = E.prototype;
t.Cb = function(a, b) {
0 > a && wa(a, '>= 0', E, 'insertAt:i');
this._isFrozen && va(this, a);
var c = this.s;
a >= c.length ? c.push(b) : c.splice(a, 0, b);
this.sb();
};
t.remove = function(a) {
if (null === a) return !1;
this._isFrozen && va(this, a);
var b = this.s;
a = b.indexOf(a);
if (-1 === a) return !1;
a === b.length - 1 ? b.pop() : b.splice(a, 1);
this.sb();
return !0;
};
t.delete = function(a) {
return this.remove(a);
};
t.mb = function(a) {
var b = this.s;
(0 > a || a >= b.length) && wa(a, '0 <= i < length', E, 'removeAt:i');
this._isFrozen && va(this, a);
a === b.length - 1 ? b.pop() : b.splice(a, 1);
this.sb();
};
t.removeRange = function(a, b) {
var c = this.s,
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._isFrozen && va(this);
for (var e = a, f = b + 1; f < d; ) c[e++] = c[f++];
c.length = d - (b - a + 1);
this.sb();
return this;
};
E.prototype.copy = function() {
var a = new E(),
b = this.s;
0 < b.length && (a.s = Array.prototype.slice.call(b));
return a;
};
t = E.prototype;
t.Ea = function() {
for (var a = this.s, b = this.count, c = Array(b), d = 0; d < b; d++)
c[d] = a[d];
return c;
};
t.lv = function() {
for (var a = new G(), b = this.s, c = this.count, d = 0; d < c; d++)
a.add(b[d]);
return a;
};
t.sort = function(a) {
this._isFrozen && va(this);
this.s.sort(a);
this.sb();
return this;
};
t.ri = function(a, b, c) {
var d = this.s,
e = d.length;
void 0 === b && (b = 0);
void 0 === c && (c = e);
this._isFrozen && va(this);
var f = c - b;
if (1 >= f) return this;
(0 > b || b >= e - 1) && wa(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.sb()),
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.sb();
return this;
};
t.reverse = function() {
this._isFrozen && va(this);
this.s.reverse();
this.sb();
return this;
};
ma.Object.defineProperties(E.prototype, {
_dataArray: {
get: function() {
return this.s;
},
},
count: {
get: function() {
return this.s.length;
},
},
size: {
get: function() {
return this.s.length;
},
},
length: {
get: function() {
return this.s.length;
},
},
iterator: {
get: function() {
if (0 >= this.s.length) return Za;
var a = this.Pa;
return null !== a ? (a.reset(), a) : new ab(this);
},
},
iteratorBackwards: {
get: function() {
if (0 >= this.s.length) return Za;
var a = this.yg;
return null !== a ? (a.reset(), a) : new bb(this);
},
},
});
E.prototype.reverse = E.prototype.reverse;
E.prototype.sortRange = E.prototype.ri;
E.prototype.sort = E.prototype.sort;
E.prototype.toSet = E.prototype.lv;
E.prototype.toArray = E.prototype.Ea;
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.Cb;
E.prototype.pop = E.prototype.pop;
E.prototype.last = E.prototype.fc;
E.prototype.first = E.prototype.first;
E.prototype.set = E.prototype.set;
E.prototype.setElt = E.prototype.Vc;
E.prototype.get = E.prototype.get;
E.prototype.elt = E.prototype.K;
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.ja;
E.prototype.freeze = E.prototype.freeze;
E.className = 'List';
function fb(a) {
this.Xf = a;
a.Pa = null;
this.na = a.Ia;
this.ra = null;
}
fb.prototype.reset = function() {
var a = this.Xf;
a.Pa = null;
this.na = a.Ia;
this.ra = null;
};
fb.prototype.next = function() {
var a = this.Xf;
if (a.Ia !== this.na && null === this.key) return !1;
var b = this.ra;
b = null === b ? a.ea : b.ta;
if (null !== b)
return (this.ra = b), (this.value = b.value), (this.key = b.key), !0;
this.Xd();
return !1;
};
fb.prototype.ud = function() {
return this.next();
};
fb.prototype.first = function() {
var a = this.Xf;
this.na = a.Ia;
a = a.ea;
if (null !== a) {
this.ra = a;
var b = a.value;
this.key = a.key;
return (this.value = b);
}
return null;
};
fb.prototype.any = function(a) {
var b = this.Xf;
this.ra = b.Pa = null;
for (b = b.ea; null !== b; ) {
if (a(b.value)) return !0;
b = b.ta;
}
return !1;
};
fb.prototype.all = function(a) {
var b = this.Xf;
this.ra = b.Pa = null;
for (b = b.ea; null !== b; ) {
if (!a(b.value)) return !1;
b = b.ta;
}
return !0;
};
fb.prototype.each = function(a) {
var b = this.Xf;
this.ra = b.Pa = null;
for (b = b.ea; null !== b; ) a(b.value), (b = b.ta);
return this;
};
fb.prototype.map = function(a) {
var b = this.Xf;
b.Pa = null;
var c = new E();
for (b = b.ea; null !== b; ) c.add(a(b.value)), (b = b.ta);
return c.iterator;
};
fb.prototype.filter = function(a) {
var b = this.Xf;
b.Pa = null;
var c = new E();
for (b = b.ea; null !== b; ) {
var d = b.value;
a(d) && c.add(d);
b = b.ta;
}
return c.iterator;
};
fb.prototype.Xd = function() {
this.value = this.key = null;
this.na = -1;
this.Xf.Pa = this;
};
fb.prototype.toString = function() {
return null !== this.ra ? 'SetIterator@' + this.ra.value : 'SetIterator';
};
ma.Object.defineProperties(fb.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return this.Xf.Ob;
},
},
});
fb.prototype.first = fb.prototype.first;
fb.prototype.hasNext = fb.prototype.ud;
fb.prototype.next = fb.prototype.next;
fb.prototype.reset = fb.prototype.reset;
fb.className = 'SetIterator';
function G(a) {
Ra(this);
this._isFrozen = !1;
this.Pb = {};
this.Ob = 0;
this.Pa = null;
this.Ia = 0;
this.Ye = this.ea = null;
'string' === typeof a &&
C(
'Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.',
);
void 0 !== a && this.addAll(a);
}
t = G.prototype;
t.sb = function() {
var a = this.Ia;
a++;
999999999 < a && (a = 0);
this.Ia = a;
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
this._isFrozen = !1;
return this;
};
t.toString = function() {
return 'Set()#' + cb(this);
};
t.add = function(a) {
if (null === a) return this;
this._isFrozen && va(this, a);
var b = a;
ya(a) && (b = gb(a));
void 0 === this.Pb[b] &&
(this.Ob++,
(a = new jb(a, a)),
(this.Pb[b] = a),
(b = this.Ye),
null === b ? (this.ea = a) : ((a.al = b), (b.ta = a)),
(this.Ye = a),
this.sb());
return this;
};
t.addAll = function(a) {
if (null === a) return this;
this._isFrozen && va(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 = cb(a)), void 0 === b) ? !1 : void 0 !== this.Pb[b];
};
t.has = function(a) {
return this.contains(a);
};
t.zy = function(a) {
if (null === a) return !0;
for (a = a.iterator; a.next(); ) if (!this.contains(a.value)) return !1;
return !0;
};
t.Ay = 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.ea;
return null === a ? null : a.value;
};
G.prototype.any = function(a) {
for (var b = this.ea; null !== b; ) {
if (a(b.value)) return !0;
b = b.ta;
}
return !1;
};
G.prototype.all = function(a) {
for (var b = this.ea; null !== b; ) {
if (!a(b.value)) return !1;
b = b.ta;
}
return !0;
};
G.prototype.each = function(a) {
for (var b = this.ea; null !== b; ) a(b.value), (b = b.ta);
return this;
};
G.prototype.map = function(a) {
for (var b = new G(), c = this.ea; null !== c; )
b.add(a(c.value)), (c = c.ta);
return b;
};
G.prototype.filter = function(a) {
for (var b = new G(), c = this.ea; null !== c; ) {
var d = c.value;
a(d) && b.add(d);
c = c.ta;
}
return b;
};
t = G.prototype;
t.remove = function(a) {
if (null === a) return !1;
this._isFrozen && va(this, a);
var b = a;
if (ya(a) && ((b = cb(a)), void 0 === b)) return !1;
a = this.Pb[b];
if (void 0 === a) return !1;
var c = a.ta,
d = a.al;
null !== c && (c.al = d);
null !== d && (d.ta = c);
this.ea === a && (this.ea = c);
this.Ye === a && (this.Ye = d);
delete this.Pb[b];
this.Ob--;
this.sb();
return !0;
};
t.delete = function(a) {
return this.remove(a);
};
t.Ko = function(a) {
if (null === a) return this;
this._isFrozen && va(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.Wz = function(a) {
if (null === a || 0 === this.count) return this;
this._isFrozen && va(this);
var b = new G();
b.addAll(a);
a = [];
for (var c = this.iterator; c.next(); ) {
var d = c.value;
b.contains(d) || a.push(d);
}
this.Ko(a);
return this;
};
t.clear = function() {
this._isFrozen && va(this);
this.Pb = {};
this.Ob = 0;
null !== this.Pa && this.Pa.reset();
this.Ye = this.ea = null;
this.sb();
};
G.prototype.copy = function() {
var a = new G(),
b = this.Pb,
c;
for (c in b) a.add(b[c].value);
return a;
};
G.prototype.Ea = function() {
var a = Array(this.Ob),
b = this.Pb,
c = 0,
d;
for (d in b) (a[c] = b[d].value), c++;
return a;
};
G.prototype.kv = function() {
var a = new E(),
b = this.Pb,
c;
for (c in b) a.add(b[c].value);
return a;
};
function Ra(a) {
a.__gohashid = kb++;
}
function gb(a) {
var b = a.__gohashid;
void 0 === b && ((b = kb++), (a.__gohashid = b));
return b;
}
function cb(a) {
return a.__gohashid;
}
ma.Object.defineProperties(G.prototype, {
count: {
get: function() {
return this.Ob;
},
},
size: {
get: function() {
return this.Ob;
},
},
iterator: {
get: function() {
if (0 >= this.Ob) return Za;
var a = this.Pa;
return null !== a ? (a.reset(), a) : new fb(this);
},
},
});
G.prototype.toList = G.prototype.kv;
G.prototype.toArray = G.prototype.Ea;
G.prototype.clear = G.prototype.clear;
G.prototype.retainAll = G.prototype.Wz;
G.prototype.removeAll = G.prototype.Ko;
G.prototype['delete'] = G.prototype.delete;
G.prototype.remove = G.prototype.remove;
G.prototype.first = G.prototype.first;
G.prototype.containsAny = G.prototype.Ay;
G.prototype.containsAll = G.prototype.zy;
G.prototype.has = G.prototype.has;
G.prototype.contains = G.prototype.contains;
G.prototype.addAll = G.prototype.addAll;
G.prototype.add = G.prototype.add;
G.prototype.thaw = G.prototype.ja;
G.prototype.freeze = G.prototype.freeze;
var kb = 1;
G.className = 'Set';
G.uniqueHash = Ra;
G.hashIdUnique = gb;
G.hashId = cb;
function lb(a) {
this.la = a;
this.na = a.Ia;
this.ra = null;
}
lb.prototype.reset = function() {
this.na = this.la.Ia;
this.ra = null;
};
lb.prototype.next = function() {
var a = this.la;
if (a.Ia !== this.na && null === this.key) return !1;
var b = this.ra;
b = null === b ? a.ea : b.ta;
if (null !== b)
return (this.ra = b), (this.value = this.key = a = b.key), !0;
this.Xd();
return !1;
};
lb.prototype.ud = function() {
return this.next();
};
lb.prototype.first = function() {
var a = this.la;
this.na = a.Ia;
a = a.ea;
return null !== a
? ((this.ra = a), (this.value = this.key = a = a.key))
: null;
};
lb.prototype.any = function(a) {
var b = this.la;
this.ra = null;
for (b = b.ea; null !== b; ) {
if (a(b.key)) return !0;
b = b.ta;
}
return !1;
};
lb.prototype.all = function(a) {
var b = this.la;
this.ra = null;
for (b = b.ea; null !== b; ) {
if (!a(b.key)) return !1;
b = b.ta;
}
return !0;
};
lb.prototype.each = function(a) {
var b = this.la;
this.ra = null;
for (b = b.ea; null !== b; ) a(b.key), (b = b.ta);
return this;
};
lb.prototype.map = function(a) {
var b = this.la;
this.ra = null;
var c = new E();
for (b = b.ea; null !== b; ) c.add(a(b.key)), (b = b.ta);
return c.iterator;
};
lb.prototype.filter = function(a) {
var b = this.la;
this.ra = null;
var c = new E();
for (b = b.ea; null !== b; ) {
var d = b.key;
a(d) && c.add(d);
b = b.ta;
}
return c.iterator;
};
lb.prototype.Xd = function() {
this.value = this.key = null;
this.na = -1;
};
lb.prototype.toString = function() {
return null !== this.ra
? 'MapKeySetIterator@' + this.ra.value
: 'MapKeySetIterator';
};
ma.Object.defineProperties(lb.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return this.la.Ob;
},
},
});
lb.prototype.first = lb.prototype.first;
lb.prototype.hasNext = lb.prototype.ud;
lb.prototype.next = lb.prototype.next;
lb.prototype.reset = lb.prototype.reset;
lb.className = 'MapKeySetIterator';
function mb(a) {
G.call(this);
Ra(this);
this._isFrozen = !0;
this.la = a;
}
la(mb, G);
t = mb.prototype;
t.freeze = function() {
return this;
};
t.ja = function() {
return this;
};
t.toString = function() {
return 'MapKeySet(' + this.la.toString() + ')';
};
t.add = function() {
C('This Set is read-only: ' + this.toString());
};
t.contains = function(a) {
return this.la.contains(a);
};
t.has = function(a) {
return this.contains(a);
};
t.remove = function() {
C('This Set is read-only: ' + this.toString());
};
t.delete = function(a) {
return this.remove(a);
};
t.clear = function() {
C('This Set is read-only: ' + this.toString());
};
t.first = function() {
var a = this.la.ea;
return null !== a ? a.key : null;
};
mb.prototype.any = function(a) {
for (var b = this.la.ea; null !== b; ) {
if (a(b.key)) return !0;
b = b.ta;
}
return !1;
};
mb.prototype.all = function(a) {
for (var b = this.la.ea; null !== b; ) {
if (!a(b.key)) return !1;
b = b.ta;
}
return !0;
};
mb.prototype.each = function(a) {
for (var b = this.la.ea; null !== b; ) a(b.key), (b = b.ta);
return this;
};
mb.prototype.map = function(a) {
for (var b = new G(), c = this.la.ea; null !== c; )
b.add(a(c.key)), (c = c.ta);
return b;
};
mb.prototype.filter = function(a) {
for (var b = new G(), c = this.la.ea; null !== c; ) {
var d = c.key;
a(d) && b.add(d);
c = c.ta;
}
return b;
};
mb.prototype.copy = function() {
return new mb(this.la);
};
mb.prototype.lv = function() {
var a = new G(),
b = this.la.Pb,
c;
for (c in b) a.add(b[c].key);
return a;
};
mb.prototype.Ea = function() {
var a = this.la.Pb,
b = Array(this.la.Ob),
c = 0,
d;
for (d in a) (b[c] = a[d].key), c++;
return b;
};
mb.prototype.kv = function() {
var a = new E(),
b = this.la.Pb,
c;
for (c in b) a.add(b[c].key);
return a;
};
ma.Object.defineProperties(mb.prototype, {
count: {
get: function() {
return this.la.Ob;
},
},
size: {
get: function() {
return this.la.Ob;
},
},
iterator: {
get: function() {
return 0 >= this.la.Ob ? Za : new lb(this.la);
},
},
});
mb.prototype.toList = mb.prototype.kv;
mb.prototype.toArray = mb.prototype.Ea;
mb.prototype.toSet = mb.prototype.lv;
mb.prototype.first = mb.prototype.first;
mb.prototype.clear = mb.prototype.clear;
mb.prototype['delete'] = mb.prototype.delete;
mb.prototype.remove = mb.prototype.remove;
mb.prototype.has = mb.prototype.has;
mb.prototype.contains = mb.prototype.contains;
mb.prototype.add = mb.prototype.add;
mb.prototype.thaw = mb.prototype.ja;
mb.prototype.freeze = mb.prototype.freeze;
mb.className = 'MapKeySet';
function nb(a) {
this.la = a;
a.Xe = null;
this.na = a.Ia;
this.ra = null;
}
nb.prototype.reset = function() {
var a = this.la;
a.Xe = null;
this.na = a.Ia;
this.ra = null;
};
nb.prototype.next = function() {
var a = this.la;
if (a.Ia !== this.na && null === this.key) return !1;
var b = this.ra;
b = null === b ? a.ea : b.ta;
if (null !== b)
return (this.ra = b), (this.value = b.value), (this.key = b.key), !0;
this.Xd();
return !1;
};
nb.prototype.ud = function() {
return this.next();
};
nb.prototype.first = function() {
var a = this.la;
this.na = a.Ia;
a = a.ea;
if (null !== a) {
this.ra = a;
var b = a.value;
this.key = a.key;
return (this.value = b);
}
return null;
};
nb.prototype.any = function(a) {
var b = this.la;
this.ra = b.Xe = null;
for (b = b.ea; null !== b; ) {
if (a(b.value)) return !0;
b = b.ta;
}
return !1;
};
nb.prototype.all = function(a) {
var b = this.la;
this.ra = b.Xe = null;
for (b = b.ea; null !== b; ) {
if (!a(b.value)) return !1;
b = b.ta;
}
return !0;
};
nb.prototype.each = function(a) {
var b = this.la;
this.ra = b.Xe = null;
for (b = b.ea; null !== b; ) a(b.value), (b = b.ta);
return this;
};
nb.prototype.map = function(a) {
var b = this.la;
this.ra = b.Xe = null;
var c = new E();
for (b = b.ea; null !== b; ) c.add(a(b.value)), (b = b.ta);
return c.iterator;
};
nb.prototype.filter = function(a) {
var b = this.la;
this.ra = b.Xe = null;
var c = new E();
for (b = b.ea; null !== b; ) {
var d = b.value;
a(d) && c.add(d);
b = b.ta;
}
return c.iterator;
};
nb.prototype.Xd = function() {
this.value = this.key = null;
this.na = -1;
this.la.Xe = this;
};
nb.prototype.toString = function() {
return null !== this.ra
? 'MapValueSetIterator@' + this.ra.value
: 'MapValueSetIterator';
};
ma.Object.defineProperties(nb.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return this.la.Ob;
},
},
});
nb.prototype.first = nb.prototype.first;
nb.prototype.hasNext = nb.prototype.ud;
nb.prototype.next = nb.prototype.next;
nb.prototype.reset = nb.prototype.reset;
nb.className = 'MapValueSetIterator';
function jb(a, b) {
this.key = a;
this.value = b;
this.al = this.ta = null;
}
jb.prototype.toString = function() {
return '{' + this.key + ':' + this.value + '}';
};
jb.className = 'KeyValuePair';
function ob(a) {
this.la = a;
a.Pa = null;
this.na = a.Ia;
this.ra = null;
}
ob.prototype.reset = function() {
var a = this.la;
a.Pa = null;
this.na = a.Ia;
this.ra = null;
};
ob.prototype.next = function() {
var a = this.la;
if (a.Ia !== this.na && null === this.key) return !1;
var b = this.ra;
b = null === b ? a.ea : b.ta;
if (null !== b)
return (this.ra = b), (this.key = b.key), (this.value = b.value), !0;
this.Xd();
return !1;
};
ob.prototype.ud = function() {
return this.next();
};
ob.prototype.first = function() {
var a = this.la;
this.na = a.Ia;
a = a.ea;
return null !== a
? ((this.ra = a), (this.key = a.key), (this.value = a.value), a)
: null;
};
ob.prototype.any = function(a) {
var b = this.la;
this.ra = b.Pa = null;
for (b = b.ea; null !== b; ) {
if (a(b)) return !0;
b = b.ta;
}
return !1;
};
ob.prototype.all = function(a) {
var b = this.la;
this.ra = b.Pa = null;
for (b = b.ea; null !== b; ) {
if (!a(b)) return !1;
b = b.ta;
}
return !0;
};
ob.prototype.each = function(a) {
var b = this.la;
this.ra = b.Pa = null;
for (b = b.ea; null !== b; ) a(b), (b = b.ta);
return this;
};
ob.prototype.map = function(a) {
var b = this.la;
this.ra = b.Pa = null;
var c = new E();
for (b = b.ea; null !== b; ) c.add(a(b)), (b = b.ta);
return c.iterator;
};
ob.prototype.filter = function(a) {
var b = this.la;
this.ra = b.Pa = null;
var c = new E();
for (b = b.ea; null !== b; ) a(b) && c.add(b), (b = b.ta);
return c.iterator;
};
ob.prototype.Xd = function() {
this.value = this.key = null;
this.na = -1;
this.la.Pa = this;
};
ob.prototype.toString = function() {
return null !== this.ra ? 'MapIterator@' + this.ra : 'MapIterator';
};
ma.Object.defineProperties(ob.prototype, {
iterator: {
get: function() {
return this;
},
},
count: {
get: function() {
return this.la.Ob;
},
},
});
ob.prototype.first = ob.prototype.first;
ob.prototype.hasNext = ob.prototype.ud;
ob.prototype.next = ob.prototype.next;
ob.prototype.reset = ob.prototype.reset;
ob.className = 'MapIterator';
function pb(a) {
Ra(this);
this._isFrozen = !1;
this.Pb = {};
this.Ob = 0;
this.Xe = this.Pa = null;
this.Ia = 0;
this.Ye = this.ea = null;
'string' === typeof a &&
C(
'Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.',
);
void 0 !== a && this.addAll(a);
}
t = pb.prototype;
t.sb = function() {
var a = this.Ia;
a++;
999999999 < a && (a = 0);
this.Ia = a;
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
this._isFrozen = !1;
return this;
};
t.toString = function() {
return 'Map()#' + cb(this);
};
t.add = function(a, b) {
this._isFrozen && va(this, a);
var c = a;
ya(a) && (c = gb(a));
var d = this.Pb[c];
void 0 === d
? (this.Ob++,
(a = new jb(a, b)),
(this.Pb[c] = a),
(c = this.Ye),
null === c ? (this.ea = a) : ((a.al = c), (c.ta = a)),
(this.Ye = a),
this.sb())
: (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 if (a instanceof pb)
for (a = a.iterator; a.next(); ) this.add(a.key, a.value);
else
for (a = a.iterator; a.next(); ) (b = a.value), this.add(b.key, b.value);
return this;
};
t.first = function() {
return this.ea;
};
pb.prototype.any = function(a) {
for (var b = this.ea; null !== b; ) {
if (a(b)) return !0;
b = b.ta;
}
return !1;
};
pb.prototype.all = function(a) {
for (var b = this.ea; null !== b; ) {
if (!a(b)) return !1;
b = b.ta;
}
return !0;
};
pb.prototype.each = function(a) {
for (var b = this.ea; null !== b; ) a(b), (b = b.ta);
return this;
};
pb.prototype.map = function(a) {
for (var b = new pb(), c = this.ea; null !== c; )
b.add(c.key, a(c)), (c = c.ta);
return b;
};
pb.prototype.filter = function(a) {
for (var b = new pb(), c = this.ea; null !== c; )
a(c) && b.add(c.key, c.value), (c = c.ta);
return b;
};
t = pb.prototype;
t.contains = function(a) {
var b = a;
return ya(a) && ((b = cb(a)), void 0 === b) ? !1 : void 0 !== this.Pb[b];
};
t.has = function(a) {
return this.contains(a);
};
t.I = function(a) {
var b = a;
if (ya(a) && ((b = cb(a)), void 0 === b)) return null;
a = this.Pb[b];
return void 0 === a ? null : a.value;
};
t.get = function(a) {
return this.I(a);
};
t.remove = function(a) {
if (null === a) return !1;
this._isFrozen && va(this, a);
var b = a;
if (ya(a) && ((b = cb(a)), void 0 === b)) return !1;
a = this.Pb[b];
if (void 0 === a) return !1;
var c = a.ta,
d = a.al;
null !== c && (c.al = d);
null !== d && (d.ta = c);
this.ea === a && (this.ea = c);
this.Ye === a && (this.Ye = d);
delete this.Pb[b];
this.Ob--;
this.sb();
return !0;
};
t.delete = function(a) {
return this.remove(a);
};
t.clear = function() {
this._isFrozen && va(this);
this.Pb = {};
this.Ob = 0;
null !== this.Pa && this.Pa.reset();
null !== this.Xe && this.Xe.reset();
this.Ye = this.ea = null;
this.sb();
};
pb.prototype.copy = function() {
var a = new pb(),
b = this.Pb,
c;
for (c in b) {
var d = b[c];
a.add(d.key, d.value);
}
return a;
};
pb.prototype.Ea = function() {
var a = this.Pb,
b = Array(this.Ob),
c = 0,
d;
for (d in a) {
var e = a[d];
b[c] = new jb(e.key, e.value);
c++;
}
return b;
};
pb.prototype.Cf = function() {
return new mb(this);
};
ma.Object.defineProperties(pb.prototype, {
count: {
get: function() {
return this.Ob;
},
},
size: {
get: function() {
return this.Ob;
},
},
iterator: {
get: function() {
if (0 >= this.count) return Za;
var a = this.Pa;
return null !== a ? (a.reset(), a) : new ob(this);
},
},
iteratorKeys: {
get: function() {
return 0 >= this.count ? Za : new lb(this);
},
},
iteratorValues: {
get: function() {
if (0 >= this.count) return Za;
var a = this.Xe;
return null !== a ? (a.reset(), a) : new nb(this);
},
},
});
pb.prototype.toKeySet = pb.prototype.Cf;
pb.prototype.toArray = pb.prototype.Ea;
pb.prototype.clear = pb.prototype.clear;
pb.prototype['delete'] = pb.prototype.delete;
pb.prototype.remove = pb.prototype.remove;
pb.prototype.get = pb.prototype.get;
pb.prototype.getValue = pb.prototype.I;
pb.prototype.has = pb.prototype.has;
pb.prototype.contains = pb.prototype.contains;
pb.prototype.first = pb.prototype.first;
pb.prototype.addAll = pb.prototype.addAll;
pb.prototype.set = pb.prototype.set;
pb.prototype.add = pb.prototype.add;
pb.prototype.thaw = pb.prototype.ja;
pb.prototype.freeze = pb.prototype.freeze;
pb.className = 'Map';
function I(a, b) {
void 0 === a
? (this.y = this.x = 0)
: 'number' === typeof a && 'number' === typeof b
? ((this.x = a), (this.y = b))
: C('Invalid arguments to Point constructor: ' + a + ', ' + b);
this._isFrozen = !1;
}
var qb, rb, sb, tb, ub;
I.prototype.assign = function(a) {
this.x = a.x;
this.y = a.y;
return this;
};
I.prototype.h = function(a, b) {
this.x = a;
this.y = b;
return this;
};
I.prototype.kg = function(a, b) {
this.x = a;
this.y = b;
return this;
};
I.prototype.set = function(a) {
this.x = a.x;
this.y = a.y;
return this;
};
I.prototype.copy = function() {
var a = new I();
a.x = this.x;
a.y = this.y;
return a;
};
t = I.prototype;
t.ha = function() {
this._isFrozen = !0;
Object.freeze(this);
return this;
};
t.J = function() {
return this._isFrozen || Object.isFrozen(this)
? this
: this.copy().freeze();
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
return this;
};
function vb(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 I(c, e);
}
return new I();
}
function wb(a) {
return a.x.toString() + ' ' + a.y.toString();
}
t.toString = function() {
return 'Point(' + this.x + ',' + this.y + ')';
};
t.C = function(a) {
return a instanceof I ? this.x === a.x && this.y === a.y : !1;
};
t.bi = function(a, b) {
return this.x === a && this.y === b;
};
t.$a = function(a) {
return J.B(this.x, a.x) && J.B(this.y, a.y);
};
t.add = function(a) {
this.x += a.x;
this.y += a.y;
return this;
};
t.je = function(a) {
this.x -= a.x;
this.y -= a.y;
return this;
};
t.offset = function(a, b) {
this.x += a;
this.y += b;
return this;
};
I.prototype.rotate = function(a) {
if (0 === a) return this;
var b = this.x,
c = this.y;
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.x = a * b - d * c;
this.y = d * b + a * c;
return this;
};
t = I.prototype;
t.scale = function(a, b) {
this.x *= a;
this.y *= b;
return this;
};
t.rf = function(a) {
var b = a.x - this.x;
a = a.y - this.y;
return b * b + a * a;
};
t.td = function(a, b) {
a -= this.x;
b -= this.y;
return a * a + b * b;
};
t.normalize = function() {
var a = this.x,
b = this.y,
c = Math.sqrt(a * a + b * b);
0 < c && ((this.x = a / c), (this.y = b / c));
return this;
};
t.Ya = function(a) {
return xb(a.x - this.x, a.y - this.y);
};
t.direction = function(a, b) {
return xb(a - this.x, b - this.y);
};
function xb(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.yy = function(a, b) {
return J.sl(a.x, a.y, b.x, b.y, this.x, this.y);
};
t.Mz = function(a, b, c, d) {
J.fh(a, b, c, d, this.x, this.y, this);
return this;
};
t.Nz = function(a, b) {
J.fh(a.x, a.y, b.x, b.y, this.x, this.y, this);
return this;
};
t.aA = function(a, b, c, d) {
J.so(this.x, this.y, a, b, c, d, this);
return this;
};
t.bA = function(a, b) {
J.so(this.x, this.y, a.x, a.y, b.width, b.height, this);
return this;
};
t.oi = function(a, b) {
this.x = a.x + b.x * a.width + b.offsetX;
this.y = a.y + b.y * a.height + b.offsetY;
return this;
};
t.pi = function(a, b, c, d, e) {
this.x = a + e.x * c + e.offsetX;
this.y = b + e.y * d + e.offsetY;
return this;
};
t.transform = function(a) {
a.Fa(this);
return this;
};
function yb(a, b) {
b.Ld(a);
return a;
}
function zb(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 Ab(a, b, c, d) {
a = c - a;
b = d - b;
return a * a + b * b;
}
function Bb(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.v = function() {
return isFinite(this.x) && isFinite(this.y);
};
I.alloc = function() {
var a = Cb.pop();
return void 0 === a ? new I() : a;
};
I.allocAt = function(a, b) {
var c = Cb.pop();
if (void 0 === c) return new I(a, b);
c.x = a;
c.y = b;
return c;
};
I.free = function(a) {
Cb.push(a);
};
I.prototype.isReal = I.prototype.v;
I.prototype.setSpot = I.prototype.pi;
I.prototype.setRectSpot = I.prototype.oi;
I.prototype.snapToGridPoint = I.prototype.bA;
I.prototype.snapToGrid = I.prototype.aA;
I.prototype.projectOntoLineSegmentPoint = I.prototype.Nz;
I.prototype.projectOntoLineSegment = I.prototype.Mz;
I.intersectingLineSegments = function(a, b, c, d, e, f, g, h) {
return J.zl(a, b, c, d, e, f, g, h);
};
I.prototype.compareWithLineSegmentPoint = I.prototype.yy;
I.compareWithLineSegment = function(a, b, c, d, e, f) {
return J.sl(a, b, c, d, e, f);
};
I.prototype.direction = I.prototype.direction;
I.prototype.directionPoint = I.prototype.Ya;
I.prototype.normalize = I.prototype.normalize;
I.prototype.distanceSquared = I.prototype.td;
I.prototype.distanceSquaredPoint = I.prototype.rf;
I.prototype.scale = I.prototype.scale;
I.prototype.rotate = I.prototype.rotate;
I.prototype.offset = I.prototype.offset;
I.prototype.subtract = I.prototype.je;
I.prototype.add = I.prototype.add;
I.prototype.equalsApprox = I.prototype.$a;
I.prototype.equalTo = I.prototype.bi;
I.prototype.equals = I.prototype.C;
I.prototype.set = I.prototype.set;
I.prototype.setTo = I.prototype.kg;
var Cb = [];
I.className = 'Point';
I.parse = vb;
I.stringify = wb;
I.distanceLineSegmentSquared = zb;
I.distanceSquared = Ab;
I.direction = Bb;
I.Origin = qb = new I(0, 0).ha();
I.InfiniteTopLeft = rb = new I(-Infinity, -Infinity).ha();
I.InfiniteBottomRight = sb = new I(Infinity, Infinity).ha();
I.SixPoint = tb = new I(6, 6).ha();
I.NoPoint = ub = new I(NaN, NaN).ha();
I.parse = vb;
I.stringify = wb;
I.distanceLineSegmentSquared = zb;
I.distanceSquared = Ab;
I.direction = Bb;
function K(a, b) {
void 0 === a
? (this.height = this.width = 0)
: 'number' === typeof a &&
(0 <= a || isNaN(a)) &&
'number' === typeof b &&
(0 <= b || isNaN(b))
? ((this.width = a), (this.height = b))
: C('Invalid arguments to Size constructor: ' + a + ', ' + b);
this._isFrozen = !1;
}
var Db, Eb, Ib, Jb, Kb, Lb, Mb;
K.prototype.assign = function(a) {
this.width = a.width;
this.height = a.height;
return this;
};
K.prototype.h = function(a, b) {
this.width = a;
this.height = b;
return this;
};
K.prototype.kg = function(a, b) {
this.width = a;
this.height = b;
return this;
};
K.prototype.set = function(a) {
this.width = a.width;
this.height = a.height;
return this;
};
K.prototype.copy = function() {
var a = new K();
a.width = this.width;
a.height = this.height;
return a;
};
t = K.prototype;
t.ha = function() {
this._isFrozen = !0;
Object.freeze(this);
return this;
};
t.J = function() {
return this._isFrozen || Object.isFrozen(this)
? this
: this.copy().freeze();
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
return this;
};
function Nb(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 K(c, e);
}
return new K();
}
function Ob(a) {
return a.width.toString() + ' ' + a.height.toString();
}
t.toString = function() {
return 'Size(' + this.width + ',' + this.height + ')';
};
t.C = function(a) {
return a instanceof K
? this.width === a.width && this.height === a.height
: !1;
};
t.bi = function(a, b) {
return this.width === a && this.height === b;
};
t.$a = function(a) {
return J.B(this.width, a.width) && J.B(this.height, a.height);
};
t.vc = function(a, b) {
a = this.width + a;
this.width = 0 <= a ? a : 0;
b = this.height + b;
this.height = 0 <= b ? b : 0;
return this;
};
t.v = function() {
return isFinite(this.width) && isFinite(this.height);
};
K.alloc = function() {
var a = Pb.pop();
return void 0 === a ? new K() : a;
};
K.free = function(a) {
Pb.push(a);
};
K.prototype.isReal = K.prototype.v;
K.prototype.inflate = K.prototype.vc;
K.prototype.equalsApprox = K.prototype.$a;
K.prototype.equalTo = K.prototype.bi;
K.prototype.equals = K.prototype.C;
K.prototype.set = K.prototype.set;
K.prototype.setTo = K.prototype.kg;
var Pb = [];
K.className = 'Size';
K.parse = Nb;
K.stringify = Ob;
K.ZeroSize = Db = new K(0, 0).ha();
K.OneSize = Eb = new K(1, 1).ha();
K.SixSize = Ib = new K(6, 6).ha();
K.EightSize = Jb = new K(8, 8).ha();
K.TenSize = Kb = new K(10, 10).ha();
K.InfiniteSize = Lb = new K(Infinity, Infinity).ha();
K.NoSize = Mb = new K(NaN, NaN).ha();
K.parse = Nb;
K.stringify = Ob;
function M(a, b, c, d) {
void 0 === a
? (this.height = this.width = this.y = this.x = 0)
: 'number' === typeof a &&
'number' === typeof b &&
'number' === typeof c &&
(0 <= c || isNaN(c)) &&
'number' === typeof d &&
(0 <= d || isNaN(d))
? ((this.x = a), (this.y = b), (this.width = c), (this.height = d))
: a instanceof I
? ((c = a.x),
(a = a.y),
b instanceof I
? ((d = b.x),
(b = b.y),
(this.x = Math.min(c, d)),
(this.y = Math.min(a, b)),
(this.width = Math.abs(c - d)),
(this.height = Math.abs(a - b)))
: b instanceof K
? ((this.x = c),
(this.y = a),
(this.width = b.width),
(this.height = b.height))
: C('Incorrect second argument supplied to Rect constructor ' + b))
: C(
'Invalid arguments to Rect constructor: ' +
a +
', ' +
b +
', ' +
c +
', ' +
d,
);
this._isFrozen = !1;
}
t = M.prototype;
t.assign = function(a) {
this.x = a.x;
this.y = a.y;
this.width = a.width;
this.height = a.height;
return this;
};
t.h = function(a, b, c, d) {
this.x = a;
this.y = b;
this.width = c;
this.height = d;
return this;
};
function Qb(a, b, c) {
a.width = b;
a.height = c;
}
t.kg = function(a, b, c, d) {
this.x = a;
this.y = b;
this.width = c;
this.height = d;
return this;
};
t.set = function(a) {
this.x = a.x;
this.y = a.y;
this.width = a.width;
this.height = a.height;
return this;
};
t.Wc = function(a) {
this.x = a.x;
this.y = a.y;
return this;
};
t.$z = function(a) {
this.width = a.width;
this.height = a.height;
return this;
};
M.prototype.copy = function() {
var a = new M();
a.x = this.x;
a.y = this.y;
a.width = this.width;
a.height = this.height;
return a;
};
t = M.prototype;
t.ha = function() {
this._isFrozen = !0;
Object.freeze(this);
return this;
};
t.J = function() {
return this._isFrozen || Object.isFrozen(this)
? this
: this.copy().freeze();
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
return this;
};
function Rb(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 M(c, e, f, g);
}
return new M();
}
function Sb(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.C = function(a) {
return a instanceof M
? this.x === a.x &&
this.y === a.y &&
this.width === a.width &&
this.height === a.height
: !1;
};
t.bi = function(a, b, c, d) {
return (
this.x === a && this.y === b && this.width === c && this.height === d
);
};
t.$a = function(a) {
return (
J.B(this.x, a.x) &&
J.B(this.y, a.y) &&
J.B(this.width, a.width) &&
J.B(this.height, a.height)
);
};
function Tb(a, b) {
return (
J.ca(a.x, b.x) &&
J.ca(a.y, b.y) &&
J.ca(a.width, b.width) &&
J.ca(a.height, b.height)
);
}
t.ba = function(a) {
return (
this.x <= a.x &&
this.x + this.width >= a.x &&
this.y <= a.y &&
this.y + this.height >= a.y
);
};
t.Ee = function(a) {
return (
this.x <= a.x &&
a.x + a.width <= this.x + this.width &&
this.y <= a.y &&
a.y + a.height <= this.y + this.height
);
};
t.contains = function(a, b, c, d) {
void 0 === c && (c = 0);
void 0 === d && (d = 0);
return (
this.x <= a &&
a + c <= this.x + this.width &&
this.y <= b &&
b + d <= this.y + this.height
);
};
t.offset = function(a, b) {
this.x += a;
this.y += b;
return this;
};
t.vc = function(a, b) {
return Ub(this, b, a, b, a);
};
t.fo = function(a) {
return Ub(this, a.top, a.right, a.bottom, a.left);
};
t.jv = function(a) {
return Ub(this, -a.top, -a.right, -a.bottom, -a.left);
};
t.oz = function(a, b, c, d) {
return Ub(this, a, b, c, d);
};
function Ub(a, b, c, d, e) {
var f = a.width;
c + e <= -f
? ((a.x += f / 2), (a.width = 0))
: ((a.x -= e), (a.width += c + e));
c = a.height;
b + d <= -c
? ((a.y += c / 2), (a.height = 0))
: ((a.y -= b), (a.height += b + d));
return a;
}
t.ix = function(a) {
return Xb(this, a.x, a.y, a.width, a.height);
};
t.Gu = function(a, b, c, d) {
return Xb(this, a, b, c, d);
};
function Xb(a, b, c, d, e) {
var f = Math.max(a.x, b),
g = Math.max(a.y, c);
b = Math.min(a.x + a.width, b + d);
c = Math.min(a.y + a.height, c + e);
a.x = f;
a.y = g;
a.width = Math.max(0, b - f);
a.height = Math.max(0, c - g);
return a;
}
t.Sc = function(a) {
return this.Hu(a.x, a.y, a.width, a.height);
};
t.Hu = function(a, b, c, d) {
var e = this.width,
f = this.x;
if (
Infinity !== e &&
Infinity !== c &&
((e += f), (c += a), isNaN(c) || isNaN(e) || f > c || a > e)
)
return !1;
a = this.height;
c = this.y;
return Infinity !== a &&
Infinity !== d &&
((a += c), (d += b), isNaN(d) || isNaN(a) || c > d || b > a)
? !1
: !0;
};
function Yb(a, b) {
var c = a.width,
d = a.x,
e = b.x - 10;
if (d > b.width + 10 + 10 + e || e > c + d) return !1;
c = a.height;
a = a.y;
d = b.y - 10;
return a > b.height + 10 + 10 + d || d > c + a ? !1 : !0;
}
t.Me = function(a) {
return Zb(this, a.x, a.y, 0, 0);
};
t.Xc = function(a) {
return Zb(this, a.x, a.y, a.width, a.height);
};
t.nv = function(a, b, c, d) {
void 0 === c && (c = 0);
void 0 === d && (d = 0);
return Zb(this, a, b, c, d);
};
function Zb(a, b, c, d, e) {
var f = Math.min(a.x, b),
g = Math.min(a.y, c);
b = Math.max(a.x + a.width, b + d);
c = Math.max(a.y + a.height, c + e);
a.x = f;
a.y = g;
a.width = b - f;
a.height = c - g;
return a;
}
t.pi = function(a, b, c) {
this.x = a - c.offsetX - c.x * this.width;
this.y = b - c.offsetY - c.y * this.height;
return this;
};
function $b(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 ac(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.v = function() {
return (
isFinite(this.x) &&
isFinite(this.y) &&
isFinite(this.width) &&
isFinite(this.height)
);
};
t.vz = function() {
return 0 === this.width && 0 === this.height;
};
M.alloc = function() {
var a = bc.pop();
return void 0 === a ? new M() : a;
};
M.allocAt = function(a, b, c, d) {
var e = bc.pop();
return void 0 === e ? new M(a, b, c, d) : e.h(a, b, c, d);
};
M.free = function(a) {
bc.push(a);
};
ma.Object.defineProperties(M.prototype, {
left: {
get: function() {
return this.x;
},
set: function(a) {
this.x = a;
},
},
top: {
get: function() {
return this.y;
},
set: function(a) {
this.y = a;
},
},
right: {
get: function() {
return this.x + this.width;
},
set: function(a) {
this.x += a - (this.x + this.width);
},
},
bottom: {
get: function() {
return this.y + this.height;
},
set: function(a) {
this.y += a - (this.y + this.height);
},
},
position: {
get: function() {
return new I(this.x, this.y);
},
set: function(a) {
this.x = a.x;
this.y = a.y;
},
},
size: {
get: function() {
return new K(this.width, this.height);
},
set: function(a) {
this.width = a.width;
this.height = a.height;
},
},
center: {
get: function() {
return new I(this.x + this.width / 2, this.y + this.height / 2);
},
set: function(a) {
this.x = a.x - this.width / 2;
this.y = a.y - this.height / 2;
},
},
centerX: {
get: function() {
return this.x + this.width / 2;
},
set: function(a) {
this.x = a - this.width / 2;
},
},
centerY: {
get: function() {
return this.y + this.height / 2;
},
set: function(a) {
this.y = a - this.height / 2;
},
},
});
M.prototype.isEmpty = M.prototype.vz;
M.prototype.isReal = M.prototype.v;
M.intersectsLineSegment = function(a, b, c, d, e, f, g, h) {
return J.jx(a, b, c, d, e, f, g, h);
};
M.prototype.setSpot = M.prototype.pi;
M.prototype.union = M.prototype.nv;
M.prototype.unionRect = M.prototype.Xc;
M.prototype.unionPoint = M.prototype.Me;
M.prototype.intersects = M.prototype.Hu;
M.prototype.intersectsRect = M.prototype.Sc;
M.prototype.intersect = M.prototype.Gu;
M.prototype.intersectRect = M.prototype.ix;
M.prototype.grow = M.prototype.oz;
M.prototype.subtractMargin = M.prototype.jv;
M.prototype.addMargin = M.prototype.fo;
M.prototype.inflate = M.prototype.vc;
M.prototype.offset = M.prototype.offset;
M.prototype.contains = M.prototype.contains;
M.prototype.containsRect = M.prototype.Ee;
M.prototype.containsPoint = M.prototype.ba;
M.prototype.equalsApprox = M.prototype.$a;
M.prototype.equalTo = M.prototype.bi;
M.prototype.equals = M.prototype.C;
M.prototype.setSize = M.prototype.$z;
M.prototype.setPoint = M.prototype.Wc;
M.prototype.set = M.prototype.set;
M.prototype.setTo = M.prototype.kg;
var cc = null,
dc = null,
bc = [];
M.className = 'Rect';
M.parse = Rb;
M.stringify = Sb;
M.contains = $b;
M.intersects = ac;
M.ZeroRect = cc = new M(0, 0, 0, 0).ha();
M.NoRect = dc = new M(NaN, NaN, NaN, NaN).ha();
M.parse = Rb;
M.stringify = Sb;
M.contains = $b;
M.intersects = ac;
function ec(a, b, c, d) {
void 0 === a
? (this.left = this.bottom = this.right = this.top = 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))
: C(
'Invalid arguments to Margin constructor: ' +
a +
', ' +
b +
', ' +
c +
', ' +
d,
);
this._isFrozen = !1;
}
ec.prototype.assign = function(a) {
this.top = a.top;
this.right = a.right;
this.bottom = a.bottom;
this.left = a.left;
return this;
};
ec.prototype.kg = function(a, b, c, d) {
this.top = a;
this.right = b;
this.bottom = c;
this.left = d;
return this;
};
ec.prototype.set = function(a) {
this.top = a.top;
this.right = a.right;
this.bottom = a.bottom;
this.left = a.left;
return this;
};
ec.prototype.copy = function() {
var a = new ec();
a.top = this.top;
a.right = this.right;
a.bottom = this.bottom;
a.left = this.left;
return a;
};
t = ec.prototype;
t.ha = function() {
this._isFrozen = !0;
Object.freeze(this);
return this;
};
t.J = function() {
return this._isFrozen || Object.isFrozen(this)
? this
: this.copy().freeze();
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
return this;
};
function jc(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 ec();
for (var e = NaN; '' === a[b]; ) b++;
(d = a[b++]) && (e = parseFloat(d));
if (isNaN(e)) return new ec(c);
for (var f = NaN; '' === a[b]; ) b++;
(d = a[b++]) && (f = parseFloat(d));
if (isNaN(f)) return new ec(c, e);
for (var g = NaN; '' === a[b]; ) b++;
(d = a[b++]) && (g = parseFloat(d));
return isNaN(g) ? new ec(c, e) : new ec(c, e, f, g);
}
return new ec();
}
function kc(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.C = function(a) {
return a instanceof ec
? this.top === a.top &&
this.right === a.right &&
this.bottom === a.bottom &&
this.left === a.left
: !1;
};
t.bi = function(a, b, c, d) {
return (
this.top === a && this.right === b && this.bottom === c && this.left === d
);
};
t.$a = function(a) {
return (
J.B(this.top, a.top) &&
J.B(this.right, a.right) &&
J.B(this.bottom, a.bottom) &&
J.B(this.left, a.left)
);
};
t.v = function() {
return (
isFinite(this.top) &&
isFinite(this.right) &&
isFinite(this.bottom) &&
isFinite(this.left)
);
};
ec.alloc = function() {
var a = pc.pop();
return void 0 === a ? new ec() : a;
};
ec.free = function(a) {
pc.push(a);
};
ec.prototype.isReal = ec.prototype.v;
ec.prototype.equalsApprox = ec.prototype.$a;
ec.prototype.equalTo = ec.prototype.bi;
ec.prototype.equals = ec.prototype.C;
ec.prototype.set = ec.prototype.set;
ec.prototype.setTo = ec.prototype.kg;
var qc = null,
rc = null,
pc = [];
ec.className = 'Margin';
ec.parse = jc;
ec.stringify = kc;
ec.ZeroMargin = qc = new ec(0, 0, 0, 0).ha();
ec.TwoMargin = rc = new ec(2, 2, 2, 2).ha();
ec.parse = jc;
ec.stringify = kc;
function N(a, b, c, d) {
void 0 === a
? (this.offsetY = this.offsetX = this.y = this.x = 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._isFrozen = !1;
}
var sc,
tc,
uc,
vc,
xc,
yc,
zc,
Ac,
Bc,
Cc,
Dc,
Ec,
Gc,
Hc,
Ic,
Jc,
Kc,
Lc,
Mc,
Nc,
Oc,
Pc,
Qc,
Uc,
Vc,
Wc,
Xc,
Yc,
Zc,
$c,
ad,
dd,
ed,
fd,
gd,
hd;
N.prototype.assign = function(a) {
this.x = a.x;
this.y = a.y;
this.offsetX = a.offsetX;
this.offsetY = a.offsetY;
return this;
};
N.prototype.kg = function(a, b, c, d) {
this.x = a;
this.y = b;
this.offsetX = c;
this.offsetY = d;
return this;
};
N.prototype.set = function(a) {
this.x = a.x;
this.y = a.y;
this.offsetX = a.offsetX;
this.offsetY = a.offsetY;
return this;
};
N.prototype.copy = function() {
var a = new N();
a.x = this.x;
a.y = this.y;
a.offsetX = this.offsetX;
a.offsetY = this.offsetY;
return a;
};
t = N.prototype;
t.ha = function() {
this._isFrozen = !0;
Object.freeze(this);
return this;
};
t.J = function() {
return this._isFrozen || Object.isFrozen(this)
? this
: this.copy().freeze();
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
return this;
};
function id(a, b) {
a.x = NaN;
a.y = NaN;
a.offsetX = b;
return a;
}
function jd(a) {
if ('string' === typeof a) {
a = a.trim();
if ('None' === a) return sc;
if ('TopLeft' === a) return tc;
if ('Top' === a || 'TopCenter' === a || 'MiddleTop' === a) return uc;
if ('TopRight' === a) return vc;
if ('Left' === a || 'LeftCenter' === a || 'MiddleLeft' === a) return xc;
if ('Center' === a) return yc;
if ('Right' === a || 'RightCenter' === a || 'MiddleRight' === a)
return zc;
if ('BottomLeft' === a) return Ac;
if ('Bottom' === a || 'BottomCenter' === a || 'MiddleBottom' === a)
return Bc;
if ('BottomRight' === a) return Cc;
if ('TopSide' === a) return Dc;
if ('LeftSide' === a) return Ec;
if ('RightSide' === a) return Gc;
if ('BottomSide' === a) return Hc;
if ('TopBottomSides' === a) return Ic;
if ('LeftRightSides' === a) return Jc;
if ('TopLeftSides' === a) return Kc;
if ('TopRightSides' === a) return Lc;
if ('BottomLeftSides' === a) return Mc;
if ('BottomRightSides' === a) return Nc;
if ('NotTopSide' === a) return Oc;
if ('NotLeftSide' === a) return Pc;
if ('NotRightSide' === a) return Qc;
if ('NotBottomSide' === a) return Uc;
if ('AllSides' === a) return Vc;
if ('Default' === a) return Wc;
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 N(c, e, f, g);
}
return new N();
}
function kd(a) {
return a.pb()
? a.x.toString() +
' ' +
a.y.toString() +
' ' +
a.offsetX.toString() +
' ' +
a.offsetY.toString()
: a.toString();
}
t.toString = function() {
return this.pb()
? 0 === this.offsetX && 0 === this.offsetY
? 'Spot(' + this.x + ',' + this.y + ')'
: 'Spot(' +
this.x +
',' +
this.y +
',' +
this.offsetX +
',' +
this.offsetY +
')'
: this.C(sc)
? 'None'
: this.C(tc)
? 'TopLeft'
: this.C(uc)
? 'Top'
: this.C(vc)
? 'TopRight'
: this.C(xc)
? 'Left'
: this.C(yc)
? 'Center'
: this.C(zc)
? 'Right'
: this.C(Ac)
? 'BottomLeft'
: this.C(Bc)
? 'Bottom'
: this.C(Cc)
? 'BottomRight'
: this.C(Dc)
? 'TopSide'
: this.C(Ec)
? 'LeftSide'
: this.C(Gc)
? 'RightSide'
: this.C(Hc)
? 'BottomSide'
: this.C(Ic)
? 'TopBottomSides'
: this.C(Jc)
? 'LeftRightSides'
: this.C(Kc)
? 'TopLeftSides'
: this.C(Lc)
? 'TopRightSides'
: this.C(Mc)
? 'BottomLeftSides'
: this.C(Nc)
? 'BottomRightSides'
: this.C(Oc)
? 'NotTopSide'
: this.C(Pc)
? 'NotLeftSide'
: this.C(Qc)
? 'NotRightSide'
: this.C(Uc)
? 'NotBottomSide'
: this.C(Vc)
? 'AllSides'
: this.C(Wc)
? 'Default'
: 'None';
};
t.C = function(a) {
return a instanceof N
? (this.x === a.x || (isNaN(this.x) && isNaN(a.x))) &&
(this.y === a.y || (isNaN(this.y) && isNaN(a.y))) &&
this.offsetX === a.offsetX &&
this.offsetY === a.offsetY
: !1;
};
t.Qu = function() {
return new N(
0.5 - (this.x - 0.5),
0.5 - (this.y - 0.5),
-this.offsetX,
-this.offsetY,
);
};
t.xf = function(a) {
if (!this.Uc()) return !1;
if (!a.Uc())
if (a.C(Xc)) a = Ec;
else if (a.C(Yc)) a = Gc;
else if (a.C(Zc)) a = Dc;
else if (a.C($c)) a = Hc;
else return !1;
a = a.offsetY;
return (this.offsetY & a) === a;
};
t.pb = function() {
return !isNaN(this.x) && !isNaN(this.y);
};
t.Fc = function() {
return isNaN(this.x) || isNaN(this.y);
};
t.Uc = function() {
return (
isNaN(this.x) && isNaN(this.y) && 1 === this.offsetX && 0 !== this.offsetY
);
};
t.Wr = function() {
return (
isNaN(this.x) && isNaN(this.y) && 0 === this.offsetX && 0 === this.offsetY
);
};
t.Sb = function() {
return (
isNaN(this.x) &&
isNaN(this.y) &&
-1 === this.offsetX &&
0 === this.offsetY
);
};
N.alloc = function() {
var a = ld.pop();
return void 0 === a ? new N() : a;
};
N.free = function(a) {
ld.push(a);
};
N.prototype.isDefault = N.prototype.Sb;
N.prototype.isNone = N.prototype.Wr;
N.prototype.isSide = N.prototype.Uc;
N.prototype.isNoSpot = N.prototype.Fc;
N.prototype.isSpot = N.prototype.pb;
N.prototype.includesSide = N.prototype.xf;
N.prototype.opposite = N.prototype.Qu;
N.prototype.equals = N.prototype.C;
N.prototype.set = N.prototype.set;
N.prototype.setTo = N.prototype.kg;
var ld = [];
N.className = 'Spot';
N.parse = jd;
N.stringify = kd;
N.None = sc = id(new N(0, 0, 0, 0), 0).ha();
N.Default = Wc = id(new N(0, 0, -1, 0), -1).ha();
N.TopLeft = tc = new N(0, 0, 0, 0).ha();
N.TopCenter = uc = new N(0.5, 0, 0, 0).ha();
N.TopRight = vc = new N(1, 0, 0, 0).ha();
N.LeftCenter = xc = new N(0, 0.5, 0, 0).ha();
N.Center = yc = new N(0.5, 0.5, 0, 0).ha();
N.RightCenter = zc = new N(1, 0.5, 0, 0).ha();
N.BottomLeft = Ac = new N(0, 1, 0, 0).ha();
N.BottomCenter = Bc = new N(0.5, 1, 0, 0).ha();
N.BottomRight = Cc = new N(1, 1, 0, 0).ha();
N.MiddleTop = ad = uc;
N.MiddleLeft = dd = xc;
N.MiddleRight = ed = zc;
N.MiddleBottom = fd = Bc;
N.Top = Zc = uc;
N.Left = Xc = xc;
N.Right = Yc = zc;
N.Bottom = $c = Bc;
N.TopSide = Dc = id(new N(0, 0, 1, 1), 1).ha();
N.LeftSide = Ec = id(new N(0, 0, 1, 2), 1).ha();
N.RightSide = Gc = id(new N(0, 0, 1, 4), 1).ha();
N.BottomSide = Hc = id(new N(0, 0, 1, 8), 1).ha();
N.TopBottomSides = Ic = id(new N(0, 0, 1, 9), 1).ha();
N.LeftRightSides = Jc = id(new N(0, 0, 1, 6), 1).ha();
N.TopLeftSides = Kc = id(new N(0, 0, 1, 3), 1).ha();
N.TopRightSides = Lc = id(new N(0, 0, 1, 5), 1).ha();
N.BottomLeftSides = Mc = id(new N(0, 0, 1, 10), 1).ha();
N.BottomRightSides = Nc = id(new N(0, 0, 1, 12), 1).ha();
N.NotTopSide = Oc = id(new N(0, 0, 1, 14), 1).ha();
N.NotLeftSide = Pc = id(new N(0, 0, 1, 13), 1).ha();
N.NotRightSide = Qc = id(new N(0, 0, 1, 11), 1).ha();
N.NotBottomSide = Uc = id(new N(0, 0, 1, 7), 1).ha();
N.AllSides = Vc = id(new N(0, 0, 1, 15), 1).ha();
gd = new N(0.156, 0.156).ha();
hd = new N(0.844, 0.844).ha();
N.parse = jd;
N.stringify = kd;
function md() {
this.m11 = 1;
this.m21 = this.m12 = 0;
this.m22 = 1;
this.dy = this.dx = 0;
}
md.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;
};
md.prototype.setTransform = function(a, b, c, d, e, f) {
this.m11 = a;
this.m12 = b;
this.m21 = c;
this.m22 = d;
this.dx = e;
this.dy = f;
return this;
};
md.prototype.copy = function() {
var a = new md();
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;
};
md.prototype.toString = function() {
return (
'Transform(' +
this.m11 +
',' +
this.m12 +
',' +
this.m21 +
',' +
this.m22 +
',' +
this.dx +
',' +
this.dy +
')'
);
};
md.prototype.C = function(a) {
return (
this.m11 === a.m11 &&
this.m12 === a.m12 &&
this.m21 === a.m21 &&
this.m22 === a.m22 &&
this.dx === a.dx &&
this.dy === a.dy
);
};
md.prototype.Ur = function() {
return (
0 === this.dx &&
0 === this.dy &&
1 === this.m11 &&
0 === this.m12 &&
0 === this.m21 &&
1 === this.m22
);
};
md.prototype.reset = function() {
this.m11 = 1;
this.m21 = this.m12 = 0;
this.m22 = 1;
this.dy = this.dx = 0;
return this;
};
md.prototype.multiply = function(a) {
var b = this.m11 * a.m11 + this.m21 * a.m12,
c = this.m12 * a.m11 + this.m22 * a.m12,
d = this.m11 * a.m21 + this.m21 * a.m22,
e = this.m12 * a.m21 + this.m22 * a.m22;
this.dx = this.m11 * a.dx + this.m21 * a.dy + this.dx;
this.dy = this.m12 * a.dx + this.m22 * a.dy + this.dy;
this.m11 = b;
this.m12 = c;
this.m21 = d;
this.m22 = e;
return this;
};
md.prototype.Ou = 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;
};
md.prototype.Tr = 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;
};
md.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 = md.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.Fa = 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.Ld = 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.Fw = function(a) {
var b = 1 / (this.m11 * this.m22 - this.m12 * this.m21),
c = 1.25 * a.x,
d = 1.2 * 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.So = function(a) {
var b = a.x,
c = a.y,
d = b + a.width,
e = c + a.height,
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.h(e, r, n - e, p - r);
return a;
};
md.alloc = function() {
var a = nd.pop();
return void 0 === a ? new md() : a;
};
md.free = function(a) {
nd.push(a);
};
md.prototype.transformRect = md.prototype.So;
md.prototype.transformPoint = md.prototype.Fa;
md.prototype.scale = md.prototype.scale;
md.prototype.translate = md.prototype.translate;
md.prototype.rotate = md.prototype.rotate;
md.prototype.invert = md.prototype.Tr;
md.prototype.multiplyInverted = md.prototype.Ou;
md.prototype.multiply = md.prototype.multiply;
md.prototype.reset = md.prototype.reset;
md.prototype.isIdentity = md.prototype.Ur;
md.prototype.equals = md.prototype.C;
md.prototype.setTransform = md.prototype.setTransform;
md.prototype.set = md.prototype.set;
var nd = [];
md.className = 'Transform';
md.xF = '54a702f3e53909c447824c6706603faf4c';
var J = {
jA: '7da71ca0ad381e90',
ng: ((Math.sqrt(2) - 1) / 3) * 4,
yv: null,
sqrt: function(a) {
if (0 >= a) return 0;
var b = J.yv;
if (null === b) {
b = [];
for (var c = 0; 2e3 >= c; c++) b[c] = Math.sqrt(c);
J.yv = b;
}
return 1 > a
? ((c = 1 / a), 2e3 >= c ? 1 / b[c | 0] : Math.sqrt(a))
: 2e3 >= a
? b[a | 0]
: Math.sqrt(a);
},
B: function(a, b) {
a -= b;
return 0.5 > a && -0.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;
},
Br: function(a, b, c, d, e, f, g, h, k, l, m, n) {
if (J.Tb(a, b, g, h, n, c, d) && J.Tb(a, b, g, h, n, e, f))
return J.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 w = (d + q) / 2,
v = (c + u) / 2;
return (
J.Br(a, b, p, r, d, c, w, v, k, l, m, n) ||
J.Br(w, v, q, u, e, f, g, h, k, l, m, n)
);
},
Gw: 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;
},
ty: function(a, b, c, d, e, f, g, h) {
var k = (c + e) / 2,
l = (d + f) / 2;
return Bb(
((a + c) / 2 + k) / 2,
((b + d) / 2 + l) / 2,
(k + (e + g) / 2) / 2,
(l + (f + h) / 2) / 2,
);
},
ql: function(a, b, c, d, e, f, g, h, k, l) {
if (J.Tb(a, b, g, h, k, c, d) && J.Tb(a, b, g, h, k, e, f))
Zb(l, a, b, 0, 0), Zb(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;
J.ql(a, b, m, n, d, c, q, u, k, l);
J.ql(q, u, p, r, e, f, g, h, k, l);
}
return l;
},
De: function(a, b, c, d, e, f, g, h, k, l) {
if (J.Tb(a, b, g, h, k, c, d) && J.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;
J.De(a, b, m, n, d, c, q, u, k, l);
J.De(q, u, p, r, e, f, g, h, k, l);
}
return l;
},
Tu: function(a, b, c, d, e, f, g, h, k, l) {
if (J.Tb(a, b, e, f, l, c, d)) return J.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 (
J.Tu(a, b, m, n, p, r, g, h, k, l) || J.Tu(p, r, c, d, e, f, g, h, k, l)
);
},
yA: 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;
},
Su: function(a, b, c, d, e, f, g, h) {
if (J.Tb(a, b, e, f, g, c, d)) Zb(h, a, b, 0, 0), Zb(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;
J.Su(a, b, k, l, m, n, g, h);
J.Su(m, n, c, d, e, f, g, h);
}
return h;
},
Go: function(a, b, c, d, e, f, g, h) {
if (J.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;
J.Go(a, b, k, l, m, n, g, h);
J.Go(m, n, c, d, e, f, g, h);
}
return h;
},
io: function(a, b, c, d, e, f, g, h, k, l, m, n, p, r) {
if (J.Tb(a, b, g, h, p, c, d) && J.Tb(a, b, g, h, p, e, f)) {
if (!J.zl(a, b, g, h, k, l, m, n)) return !1;
p = (a - g) * (l - n) - (b - h) * (k - m);
if (0 === p) return !1;
r.h(
((a * h - b * g) * (k - m) - (a - g) * (k * n - l * m)) / p,
((a * h - b * g) * (l - n) - (b - h) * (k * n - l * m)) / p,
);
return !0;
}
var q = (a + c) / 2,
u = (b + d) / 2,
w = (c + e) / 2,
v = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
d = (q + w) / 2;
c = (u + v) / 2;
w = (w + e) / 2;
v = (v + f) / 2;
var z = (d + w) / 2,
y = (c + v) / 2,
A = Infinity,
B = !1,
F = 0,
L = 0;
J.io(a, b, q, u, d, c, 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), (B = !0), (F = r.x), (L = r.y)));
J.io(z, y, w, v, e, f, g, h, k, l, m, n, p, r) &&
(r.x - k) * (r.x - k) + (r.y - l) * (r.y - l) < A &&
((B = !0), (F = r.x), (L = r.y));
B && ((r.x = F), (r.y = L));
return B;
},
jo: function(a, b, c, d, e, f, g, h, k, l, m, n, p) {
var r = 0;
if (J.Tb(a, b, g, h, p, c, d) && J.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 ? ((k = b), (a = h)) : ((k = h), (a = b)), u < k || u > a))
return r;
} else if ((a < g ? ((k = a), (a = g)) : (k = g), q < k || q > a))
return r;
0 < p ? r++ : 0 > p && r--;
} else {
q = (a + c) / 2;
u = (b + d) / 2;
var w = (c + e) / 2,
v = (d + f) / 2;
e = (e + g) / 2;
f = (f + h) / 2;
d = (q + w) / 2;
c = (u + v) / 2;
w = (w + e) / 2;
v = (v + f) / 2;
var z = (d + w) / 2,
y = (c + v) / 2;
r += J.jo(a, b, q, u, d, c, z, y, k, l, m, n, p);
r += J.jo(z, y, w, v, e, f, g, h, k, l, m, n, p);
}
return r;
},
fh: function(a, b, c, d, e, f, g) {
if (J.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 (J.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;
},
Je: function(a, b, c, d, e, f, g, h, k) {
if (J.B(a, c) && J.B(b, d)) return k.h(a, b), !1;
if (J.ca(e, g))
return J.ca(a, c)
? (J.fh(a, b, c, d, e, f, k), !1)
: J.fh(a, b, c, d, e, ((d - b) / (c - a)) * (e - a) + b, k);
h = (h - f) / (g - e);
if (J.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 (J.ca(h, g)) return J.fh(a, b, c, d, e, f, k), !1;
e = (g * a - h * e + f - b) / (g - h);
if (J.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 J.fh(a, b, c, d, e, g * (e - a) + b, k);
},
wA: function(a, b, c, d, e) {
return J.Je(c.x, c.y, d.x, d.y, a.x, a.y, b.x, b.y, e);
},
uA: 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 (0.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;
},
wf: function(a, b, c, d, e, f, g, h, k) {
var l = 1e21,
m = a,
n = b;
if (J.Je(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));
}
J.Je(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)));
J.Je(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)));
J.Je(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;
},
tA: 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;
},
Rr: function(a, b, c) {
return J.jx(a.x, a.y, a.width, a.height, b.x, b.y, c.x, c.y);
},
jx: function(a, b, c, d, e, f, g, h) {
var k = a + c,
l = b + d;
return e === g
? (f < h ? ((g = f), (f = h)) : (g = h),
a <= e && e <= k && g <= l && f >= b)
: f === h
? (e < g ? ((h = e), (e = g)) : (h = g),
b <= f && f <= l && h <= k && e >= a)
: $b(a, b, c, d, e, f) ||
$b(a, b, c, d, g, h) ||
J.zl(a, b, k, b, e, f, g, h) ||
J.zl(k, b, k, l, e, f, g, h) ||
J.zl(k, l, a, l, e, f, g, h) ||
J.zl(a, l, a, b, e, f, g, h)
? !0
: !1;
},
zl: function(a, b, c, d, e, f, g, h) {
return (
0 >= J.sl(a, b, c, d, e, f) * J.sl(a, b, c, d, g, h) &&
0 >= J.sl(e, f, g, h, a, b) * J.sl(e, f, g, h, c, d)
);
},
sl: 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 f;
},
Eo: function(a) {
0 > a && (a += 360);
360 <= a && (a -= 360);
return a;
},
Mw: 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(J.Cy(c, l, e, a, b)),
(d -= Math.abs(e - l)),
(l = e);
return f;
},
Cy: 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),
];
},
so: 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;
},
Xw: 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;
},
Hy: 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 J.Iy(k, 0 === g ? a : b, l, c, 0, 0);
},
Iy: 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 = 0.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;
},
Oe: new Wa(),
dm: new Wa(),
Df: new Wa(),
Ef: 0,
em: 100,
};
J.za = J.jA;
function O(a) {
Ra(this);
this.o = 2;
void 0 === a && (a = O.m);
this.qa = a;
this.yc = this.xc = this.hd = this.gd = 0;
a === O.m
? (this.Yd = new E())
: (null === O.W && (O.W = new E().freeze()), (this.Yd = O.W));
this.Ep = this.Yd.Ia;
this.lp = new M().freeze();
this.gm = this.gk = null;
this.hm = NaN;
this.Yf = tc;
this.Zf = Cc;
this.Gk = this.Hk = NaN;
this.Kf = td;
}
O.prototype.copy = function() {
var a = new O();
a.o = this.o & -2;
a.qa = this.qa;
a.gd = this.gd;
a.hd = this.hd;
a.xc = this.xc;
a.yc = this.yc;
if (this.qa === O.m) {
for (var b = this.Yd.s, c = a.Yd, d = 0; d < b.length; d++)
c.add(b[d].copy());
a.Yd = c;
} else a.Yd = this.Yd;
a.Ep = this.Ep;
a.lp.assign(this.lp);
a.gk = this.gk;
a.gm = this.gm;
a.hm = this.hm;
a.Yf = this.Yf.J();
a.Zf = this.Zf.J();
a.Hk = this.Hk;
a.Gk = this.Gk;
a.Kf = this.Kf;
return a;
};
O.prototype.ha = function() {
this.freeze();
Object.freeze(this);
return this;
};
O.prototype.freeze = function() {
this._isFrozen = !0;
if (this.type !== O.m) return this;
var a = this.figures;
a.freeze();
a = a.s;
for (var b = a.length, c = 0; c < b; c++) a[c].freeze();
return this;
};
O.prototype.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
if (this.type !== O.m) return this;
var a = this.figures;
a.ja();
a = a.s;
for (var b = a.length, c = 0; c < b; c++) a[c].ja();
return this;
};
O.prototype.$a = function(a) {
if (!(a instanceof O)) return !1;
if (this.type !== a.type)
return this.type === O.j && a.type === O.m
? ud(this, a)
: a.type === O.j && this.type === O.m
? ud(a, this)
: !1;
if (this.type === O.m) {
var b = this.figures.s;
a = a.figures.s;
var c = b.length;
if (c !== a.length) return !1;
for (var d = 0; d < c; d++) if (!b[d].$a(a[d])) return !1;
return !0;
}
return (
J.B(this.startX, a.startX) &&
J.B(this.startY, a.startY) &&
J.B(this.endX, a.endX) &&
J.B(this.endY, a.endY)
);
};
function ud(a, b) {
return a.type !== O.j || b.type !== O.m
? !1
: 1 === b.figures.count &&
((b = b.figures.K(0)),
1 === b.segments.count &&
J.B(a.startX, b.startX) &&
J.B(a.startY, b.startY) &&
((b = b.segments.K(0)),
b.type === vd && J.B(a.endX, b.endX) && J.B(a.endY, b.endY)))
? !0
: !1;
}
O.ga = function(a) {
return a.toString();
};
O.prototype.ob = function(a) {
a.classType === O && (this.type = a);
};
O.prototype.toString = function(a) {
void 0 === a && (a = -1);
switch (this.type) {
case O.j:
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 O.u:
var b = new M(this.startX, this.startY, 0, 0);
b.nv(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 O.F:
b = new M(this.startX, this.startY, 0, 0);
b.nv(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 O.m:
b = '';
c = this.figures.s;
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();
}
};
O.hb = 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;
};
O.parse = function(a, b) {
function c() {
return u >= A - 1 ? !0 : null !== l[u + 1].match(B);
}
function d() {
u++;
return l[u];
}
function e(a) {
var b = parseFloat(d()),
c = parseFloat(d());
w === w.toLowerCase() && ((b = y.x + b), (c = y.y + c));
a.h(b, c);
}
function f() {
e(y);
return y;
}
function g() {
e(z);
return z;
}
function h() {
var a = v.toLowerCase();
return 'c' !== a && 's' !== a && 'q' !== a && 't' !== a
? y
: new I(2 * y.x - z.x, 2 * y.y - z.y);
}
void 0 === b && (b = !1);
var k = /([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm;
a = a.replace(/,/gm, ' ');
a = a.replace(k, '$1 $2');
a = a.replace(k, '$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(/[\s\r\t\n]+/gm, ' ');
a = a.replace(/^\s+|\s+$/g, '');
var l = a.split(' ');
for (a = 0; a < l.length; a++) {
var m = l[a];
if (null !== m.match(/(\.[0-9]*)(\.)/gm)) {
k = Ea();
for (var n = '', p = !1, r = 0; r < m.length; r++) {
var q = m[r];
'.' !== q || p
? '.' === q
? (k.push(n), (n = '.'))
: (n += q)
: ((p = !0), (n += q));
}
k.push(n);
l.splice(a, 1);
for (m = 0; m < k.length; m++) l.splice(a + m, 0, k[m]);
a += k.length - 1;
Ga(k);
}
}
var u = -1,
w = '',
v = '';
k = new I(0, 0);
var z = new I(0, 0),
y = new I(0, 0),
A = l.length;
a = wd(null);
n = m = !1;
p = !0;
r = null;
for (var B = /[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/; !(u >= A - 1); )
if (((v = w), (w = d()), '' !== w))
switch (w.toUpperCase()) {
case 'X':
p = !0;
n = m = !1;
break;
case 'M':
r = f();
null === a.pc || !0 === p
? (xd(a, r.x, r.y, m, !n), (p = !1))
: a.moveTo(r.x, r.y);
for (k.assign(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 I(
(w === w.toLowerCase() ? y.x : 0) + parseFloat(d()),
y.y,
)),
a.lineTo(y.x, y.y);
break;
case 'V':
for (; !c(); )
(y = new I(
y.x,
(w === w.toLowerCase() ? y.y : 0) + parseFloat(d()),
)),
a.lineTo(y.x, y.y);
break;
case 'C':
for (; !c(); ) {
r = new I();
e(r);
q = g();
var F = f();
yd(a, r.x, r.y, q.x, q.y, F.x, F.y);
}
break;
case 'S':
for (; !c(); )
(r = h()),
(q = g()),
(F = f()),
yd(a, r.x, r.y, q.x, q.y, F.x, F.y);
break;
case 'Q':
for (; !c(); ) (r = g()), (q = f()), zd(a, r.x, r.y, q.x, q.y);
break;
case 'T':
for (; !c(); ) (z = r = h()), (q = f()), zd(a, r.x, r.y, q.x, q.y);
break;
case 'B':
for (; !c(); ) {
r = parseFloat(d());
q = parseFloat(d());
F = parseFloat(d());
var L = parseFloat(d()),
S = parseFloat(d()),
R = S,
P = !1;
c() ||
((R = parseFloat(d())), c() || (P = 0 !== parseFloat(d())));
w === w.toLowerCase() && ((F += y.x), (L += y.y));
a.arcTo(r, q, F, L, S, R, P);
}
break;
case 'A':
for (; !c(); )
(r = Math.abs(parseFloat(d()))),
(q = Math.abs(parseFloat(d()))),
(F = parseFloat(d())),
(S = L = !1),
(P = R = 0),
(R = d()),
1 === R.length
? ((L = !!parseFloat(R)),
(S = !!parseFloat(d())),
(R = parseFloat(d())))
: 2 === R.length
? ((L = !!parseFloat(R[0])),
(S = !!parseFloat(R[1])),
(R = parseFloat(d())))
: ((L = !!parseFloat(R[0])),
(S = !!parseFloat(R[1])),
(R = parseFloat(R.slice(2)))),
(P = parseFloat(d())),
w === w.toLowerCase() && ((R = y.x + R), (P = y.y + P)),
y.h(R, P),
Ad(a, r, q, F, L, S, R, P);
break;
case 'Z':
Gd(a);
y.assign(k);
break;
case 'F':
r = '';
for (q = 1; l[u + q]; )
if (null !== l[u + q].match(/[Uu]/)) q++;
else if (null === l[u + q].match(B)) q++;
else {
r = l[u + q];
break;
}
r.match(/[Mm]/)
? (m = !0)
: 0 < a.pc.segments.length && (a.pc.isFilled = !0);
break;
case 'U':
r = '';
for (q = 1; l[u + q]; )
if (null !== l[u + q].match(/[Ff]/)) q++;
else if (null === l[u + q].match(B)) q++;
else {
r = l[u + q];
break;
}
r.match(/[Mm]/) ? (n = !0) : a.Xl(!1);
}
k = a.Lr;
Hd = a;
if (b) for (b = k.figures.iterator; b.next(); ) b.value.isFilled = !0;
return k;
};
O.Ga = function(a, b) {
for (var c = a.length, d = I.alloc(), e = 0; e < c; e++) {
var f = a[e];
d.x = f[0];
d.y = f[1];
b.Fa(d);
f[0] = d.x;
f[1] = d.y;
d.x = f[2];
d.y = f[3];
b.Fa(d);
f[2] = d.x;
f[3] = d.y;
d.x = f[4];
d.y = f[5];
b.Fa(d);
f[4] = d.x;
f[5] = d.y;
d.x = f[6];
d.y = f[7];
b.Fa(d);
f[6] = d.x;
f[7] = d.y;
}
I.free(d);
};
O.prototype.Lu = function() {
if (this._isInvalidBounds) return !0;
if (this.type === O.m) {
if (this.Ep !== this.figures.Ia) return !0;
for (var a = this.figures.s, b = a.length, c = 0; c < b; c++)
if (a[c].Lu()) return !0;
}
return !1;
};
O.prototype.computeBounds = function() {
this._isInvalidBounds = !1;
this.gm = this.gk = null;
this.hm = NaN;
if (this.type === O.m) {
this.Ep = this.figures.Ia;
for (var a = this.figures.s, b = a.length, c = 0; c < b; c++) {
var d = a[c];
d._isInvalidBounds = !1;
var e = d.segments;
d.Pq = e.Ia;
d = e.s;
e = d.length;
for (var f = 0; f < e; f++) {
var g = d[f];
g._isInvalidBounds = !1;
g.Ud = null;
}
}
}
a = this.lp;
a.ja();
isNaN(this.Hk) || isNaN(this.Gk)
? a.h(0, 0, 0, 0)
: a.h(0, 0, this.Hk, this.Gk);
Id(this, a, !1);
Zb(a, 0, 0, 0, 0);
a.freeze();
};
O.prototype.Lw = function() {
var a = new M();
Id(this, a, !0);
return a;
};
function Id(a, b, c) {
switch (a.type) {
case O.j:
case O.u:
case O.F:
c ? b.h(a.gd, a.hd, 0, 0) : Zb(b, a.gd, a.hd, 0, 0);
Zb(b, a.xc, a.yc, 0, 0);
break;
case O.m:
var d = a.figures;
a = d.s;
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)
: Zb(b, f.startX, f.startY, 0, 0);
for (
var g = f.segments.s,
h = g.length,
k = f.startX,
l = f.startY,
m = 0;
m < h;
m++
) {
var n = g[m];
switch (n.type) {
case vd:
case Jd:
k = n.endX;
l = n.endY;
Zb(b, k, l, 0, 0);
break;
case Kd:
J.ql(
k,
l,
n.point1X,
n.point1Y,
n.point2X,
n.point2Y,
n.endX,
n.endY,
0.5,
b,
);
k = n.endX;
l = n.endY;
break;
case Ld:
J.Su(k, l, n.point1X, n.point1Y, n.endX, n.endY, 0.5, b);
k = n.endX;
l = n.endY;
break;
case Md:
case Qd:
var p = n.type === Md ? Rd(n, f) : Sd(n, f, k, l),
r = p.length;
if (0 === r) {
k = n.type === Md ? n.centerX : n.endX;
l = n.type === Md ? n.centerY : n.endY;
Zb(b, k, l, 0, 0);
break;
}
n = null;
for (var q = 0; q < r; q++)
(n = p[q]),
J.ql(
n[0],
n[1],
n[2],
n[3],
n[4],
n[5],
n[6],
n[7],
0.5,
b,
);
null !== n && ((k = n[6]), (l = n[7]));
break;
default:
C('Unknown Segment type: ' + n.type);
}
}
}
break;
default:
C('Unknown Geometry type: ' + a.type);
}
}
O.prototype.normalize = function() {
this._isFrozen && va(this);
var a = this.Lw();
this.offset(-a.x, -a.y);
return new I(-a.x, -a.y);
};
O.prototype.offset = function(a, b) {
this._isFrozen && va(this);
this.transform(1, 0, 0, 1, a, b);
return this;
};
O.prototype.scale = function(a, b) {
this._isFrozen && va(this);
this.transform(a, 0, 0, b, 0, 0);
return this;
};
O.prototype.rotate = function(a, b, c) {
this._isFrozen && va(this);
void 0 === b && (b = 0);
void 0 === c && (c = 0);
var d = md.alloc();
d.reset();
d.rotate(a, b, c);
this.transform(d.m11, d.m12, d.m21, d.m22, d.dx, d.dy);
md.free(d);
return this;
};
t = O.prototype;
t.transform = function(a, b, c, d, e, f) {
switch (this.type) {
case O.j:
case O.u:
case O.F:
var g = this.gd;
var h = this.hd;
this.gd = g * a + h * c + e;
this.hd = g * b + h * d + f;
g = this.xc;
h = this.yc;
this.xc = g * a + h * c + e;
this.yc = g * b + h * d + f;
break;
case O.m:
for (var k = this.figures.s, 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.s;
for (var p = n.length, r = 0; r < p; r++) {
var q = n[r];
switch (q.type) {
case vd:
case Jd:
g = q.endX;
h = q.endY;
q.endX = g * a + h * c + e;
q.endY = g * b + h * d + f;
break;
case Kd:
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 Ld:
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 Md:
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 Qd:
g = q.endX;
h = q.endY;
q.endX = g * a + h * c + e;
q.endY = g * b + h * d + f;
if (0 === q.radiusX || 0 === q.radiusY) break;
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:
C('Unknown Segment type: ' + q.type);
}
}
}
}
this._isInvalidBounds = !0;
return this;
};
t.ba = function(a, b) {
void 0 === b && (b = 0);
var c = this.gd,
d = this.hd,
e = this.xc,
f = this.yc;
switch (this.type) {
case O.j:
return J.Tb(c, d, e, f, b, a.x, a.y);
case O.u:
var g = M.allocAt(
Math.min(c, e) - b,
Math.min(d, f) - b,
Math.abs(e - c) + 2 * b,
Math.abs(f - d) + 2 * b,
);
a = g.ba(a);
M.free(g);
return a;
case O.F:
g = Math.min(c, e) - b;
var h = Math.min(d, f) - b;
c = (Math.abs(e - c) + 2 * b) / 2;
b = (Math.abs(f - d) + 2 * b) / 2;
if (0 >= c || 0 >= b) return !1;
g = a.x - (g + c);
h = a.y - (h + b);
return 1 >= (g * g) / (c * c) + (h * h) / (b * b);
case O.m:
return Td(this, a, b, !0, !1);
default:
return !1;
}
};
function Td(a, b, c, d, e) {
var f = b.x;
b = b.y;
for (
var g = a.bounds.x - 20,
h = 0,
k,
l,
m,
n,
p = a.figures.s,
r = p.length,
q = 0;
q < r;
q++
) {
var u = p[q];
if (u.isFilled) {
if (d && u.ba(f, b, c)) return !0;
var w = u.segments;
k = u.startX;
l = u.startY;
for (var v = k, z = l, y = w.s, A = 0; A <= w.length; A++) {
var B = void 0;
if (A !== w.length) {
B = y[A];
var F = B.type;
a = B.endX;
n = B.endY;
} else (F = vd), (a = v), (n = z);
switch (F) {
case Jd:
v = Ud(f, b, g, b, k, l, v, z);
if (isNaN(v)) return !0;
h += v;
v = a;
z = n;
break;
case vd:
k = Ud(f, b, g, b, k, l, a, n);
if (isNaN(k)) return !0;
h += k;
break;
case Kd:
m = J.jo(
k,
l,
B.point1X,
B.point1Y,
B.point2X,
B.point2Y,
a,
n,
g,
b,
f,
b,
0.5,
);
h += m;
break;
case Ld:
m = J.jo(
k,
l,
(k + 2 * B.point1X) / 3,
(l + 2 * B.point1Y) / 3,
(2 * B.point1X + a) / 3,
(2 * B.point1Y + n) / 3,
a,
n,
g,
b,
f,
b,
0.5,
);
h += m;
break;
case Md:
case Qd:
F = B.type === Md ? Rd(B, u) : Sd(B, u, k, l);
var L = F.length;
if (0 === L) {
k = Ud(
f,
b,
g,
b,
k,
l,
B.type === Md ? B.centerX : B.endX,
B.type === Md ? B.centerY : B.endY,
);
if (isNaN(k)) return !0;
h += k;
break;
}
B = null;
for (var S = 0; S < L; S++) {
B = F[S];
if (0 === S) {
m = Ud(f, b, g, b, k, l, B[0], B[1]);
if (isNaN(m)) return !0;
h += m;
}
m = J.jo(
B[0],
B[1],
B[2],
B[3],
B[4],
B[5],
B[6],
B[7],
g,
b,
f,
b,
0.5,
);
h += m;
}
null !== B && ((a = B[6]), (n = B[7]));
break;
default:
C('Unknown Segment type: ' + B.type);
}
k = a;
l = n;
}
if (0 !== h) return !0;
h = 0;
} else if (u.ba(f, b, e ? c : c + 2)) return !0;
}
return 0 !== h;
}
function Ud(a, b, c, d, e, f, g, h) {
if (J.Tb(e, f, g, h, 0.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 Vd(a, b, c, d) {
a = a.figures.s;
for (var e = a.length, f = 0; f < e; f++) if (a[f].ba(b, c, d)) return !0;
return !1;
}
t.Bu = function(a, b) {
0 > a ? (a = 0) : 1 < a && (a = 1);
void 0 === b && (b = new I());
if (this.type === O.j)
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),
(d = 0 === m ? 0 : d / m),
(c = c[h]),
(h = c[2 * a]),
(e = c[2 * a + 1]),
b.h(h + (c[2 * a + 2] - h) * d, e + (c[2 * a + 3] - e) * d),
b
);
g += m;
}
}
return b;
};
t.Yw = function(a) {
0 > a ? (a = 0) : 1 < a && (a = 1);
if (this.type === O.j)
return (
(180 * Math.atan2(this.endY - this.startY, this.endX - this.startX)) /
Math.PI
);
for (
var b = this.flattenedSegments,
c = this.flattenedLengths,
d = b.length,
e = this.flattenedTotalLength * a,
f = 0,
g = 0;
g < d;
g++
) {
var h = c[g],
k = h.length;
for (a = 0; a < k; a++) {
var l = h[a];
if (f + l >= e)
return (
(e = b[g]),
(b = e[2 * a]),
(c = e[2 * a + 1]),
(d = e[2 * a + 2]),
(a = e[2 * a + 3]),
1 > Math.abs(d - b) && 1 > Math.abs(a - c)
? 0
: 1 > Math.abs(d - b)
? 0 <= a - c
? 90
: 270
: 1 > Math.abs(a - c)
? 0 <= d - b
? 0
: 180
: (180 * Math.atan2(a - c, d - b)) / Math.PI
);
f += l;
}
}
return NaN;
};
t.Cu = function(a, b) {
0 > a ? (a = 0) : 1 < a && (a = 1);
void 0 === b && (b = []);
b.length = 3;
if (this.type === O.j)
return (
(b[0] = this.startX + a * (this.endX - this.startX)),
(b[1] = this.startY + a * (this.endY - this.startY)),
(b[2] =
(180 * Math.atan2(this.endY - this.startY, this.endX - this.startX)) /
Math.PI),
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),
(d = 0 === m ? 0 : d / m),
(m = c[h]),
(c = m[2 * a]),
(h = m[2 * a + 1]),
(e = m[2 * a + 2]),
(a = m[2 * a + 3]),
(b[0] = c + (e - c) * d),
(b[1] = h + (a - h) * d),
(b[2] =
1 > Math.abs(e - c) && 1 > Math.abs(a - h)
? 0
: 1 > Math.abs(e - c)
? 0 <= a - h
? 90
: 270
: 1 > Math.abs(a - h)
? 0 <= e - c
? 0
: 180
: (180 * Math.atan2(a - h, e - c)) / Math.PI),
b
);
g += m;
}
}
return b;
};
t.Zw = function(a) {
if (this.type === O.j) {
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);
}
if (c === e)
return (
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)
);
g = (d - b) * (d - b) + (e - c) * (e - c);
var h = I.alloc();
J.fh(b, c, d, e, f, a, h);
a = h.x;
f = h.y;
I.free(h);
return Math.sqrt(((a - b) * (a - b) + (f - c) * (f - c)) / g);
}
} else if (this.type === O.u) {
g = this.startX;
h = this.startY;
var 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 = I.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 w = p[u],
v = p[u + 1];
if (0 !== u) {
J.fh(l, m, w, v, 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 = w;
m = v;
}
I.free(d);
a = g / f;
return 0 > a ? 0 : 1 < a ? 1 : a;
}
return 0;
};
function Wd(a) {
if (null === a.gk) {
var b = (a.gk = []),
c = (a.gm = []),
d = [],
e = [];
if (a.type === O.j)
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 === O.u)
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 === O.F) {
var f = new Xd();
f.startX = a.endX;
f.startY = (a.startY + a.endY) / 2;
var g = new Yd(Md);
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 = Rd(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];
J.De(g, f, k[2], k[3], k[4], k[5], k[6], k[7], 0.5, d);
g = k[6];
f = k[7];
}
}
b.push(d);
c.push(Zd(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.s, m = l.length, n = 0; n < m; n++) {
var p = l[n];
switch (p.type) {
case Jd:
4 <= d.length && (b.push(d), c.push(Zd(d)));
d = [];
d.push(p.endX);
d.push(p.endY);
g = p.endX;
f = p.endY;
h = g;
k = f;
break;
case vd:
d.push(p.endX);
d.push(p.endY);
g = p.endX;
f = p.endY;
break;
case Kd:
J.De(
g,
f,
p.point1X,
p.point1Y,
p.point2X,
p.point2Y,
p.endX,
p.endY,
0.5,
d,
);
g = p.endX;
f = p.endY;
break;
case Ld:
J.Go(g, f, p.point1X, p.point1Y, p.endX, p.endY, 0.5, d);
g = p.endX;
f = p.endY;
break;
case Md:
var r = Rd(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 w = r[u];
J.De(g, f, w[2], w[3], w[4], w[5], w[6], w[7], 0.5, d);
g = w[6];
f = w[7];
}
break;
case Qd:
r = Sd(p, e, g, f);
q = r.length;
u = p.endX;
w = p.endY;
if (0 === q) {
d.push(u);
d.push(w);
g = u;
f = w;
break;
}
for (u = 0; u < q; u++)
(w = r[u]),
J.De(g, f, w[2], w[3], w[4], w[5], w[6], w[7], 0.5, d),
(g = w[6]),
(f = w[7]);
break;
default:
C('Segment not of valid type: ' + p.type);
}
p.isClosed && (d.push(h), d.push(k));
}
4 <= d.length && (b.push(d), c.push(Zd(d)));
}
}
}
function Zd(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(Ab(c, d, g, h)));
c = g;
d = h;
}
return b;
}
t.add = function(a) {
this.Yd.add(a);
return this;
};
t.Yl = function(a, b, c, d, e, f, g, h) {
this._isFrozen && va(this);
this.Yf = new N(a, b, e, f).freeze();
this.Zf = new N(c, d, g, h).freeze();
return this;
};
ma.Object.defineProperties(O.prototype, {
_isFrozen: {
get: function() {
return 0 !== (this.o & 1);
},
set: function(a) {
this.o = a ? this.o | 1 : this.o & -2;
},
},
_isInvalidBounds: {
get: function() {
return 0 !== (this.o & 2);
},
set: function(a) {
this.o = a ? this.o | 2 : this.o & -3;
},
},
flattenedSegments: {
get: function() {
Wd(this);
return this.gk;
},
},
flattenedLengths: {
get: function() {
Wd(this);
return this.gm;
},
},
flattenedTotalLength: {
get: function() {
var a = this.hm;
if (isNaN(a)) {
if (this.type === O.j) {
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 === O.u)
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.hm = a;
}
return a;
},
},
type: {
get: function() {
return this.qa;
},
set: function(a) {
this.qa !== a &&
(this._isFrozen && va(this, a),
(this.qa = a),
a === O.m
? (this.Yd = new E())
: (null === O.W && (O.W = new E().freeze()), (this.Yd = O.W)),
(this._isInvalidBounds = !0));
},
},
startX: {
get: function() {
return this.gd;
},
set: function(a) {
this.gd !== a &&
(this._isFrozen && va(this, a),
(this.gd = a),
(this._isInvalidBounds = !0));
},
},
startY: {
get: function() {
return this.hd;
},
set: function(a) {
this.hd !== a &&
(this._isFrozen && va(this, a),
(this.hd = a),
(this._isInvalidBounds = !0));
},
},
endX: {
get: function() {
return this.xc;
},
set: function(a) {
this.xc !== a &&
(this._isFrozen && va(this, a),
(this.xc = a),
(this._isInvalidBounds = !0));
},
},
endY: {
get: function() {
return this.yc;
},
set: function(a) {
this.yc !== a &&
(this._isFrozen && va(this, a),
(this.yc = a),
(this._isInvalidBounds = !0));
},
},
figures: {
get: function() {
return this.Yd;
},
set: function(a) {
this.Yd !== a &&
(this._isFrozen && va(this, a),
(this.Yd = a),
(this._isInvalidBounds = !0));
},
},
spot1: {
get: function() {
return this.Yf;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Yf = a.J();
},
},
spot2: {
get: function() {
return this.Zf;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Zf = a.J();
},
},
defaultStretch: {
get: function() {
return this.Kf;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Kf = a;
},
},
bounds: {
get: function() {
this.Lu() && this.computeBounds();
return this.lp;
},
},
});
O.prototype.setSpots = O.prototype.Yl;
O.prototype.add = O.prototype.add;
O.prototype.getFractionForPoint = O.prototype.Zw;
O.prototype.getPointAndAngleAlongPath = O.prototype.Cu;
O.prototype.getAngleAlongPath = O.prototype.Yw;
O.prototype.getPointAlongPath = O.prototype.Bu;
O.prototype.containsPoint = O.prototype.ba;
O.prototype.transform = O.prototype.transform;
O.prototype.rotate = O.prototype.rotate;
O.prototype.scale = O.prototype.scale;
O.prototype.offset = O.prototype.offset;
O.prototype.normalize = O.prototype.normalize;
O.prototype.computeBoundsWithoutOrigin = O.prototype.Lw;
O.prototype.equalsApprox = O.prototype.$a;
O.className = 'Geometry';
O.j = new D(O, 'Line', 0);
O.u = new D(O, 'Rectangle', 1);
O.F = new D(O, 'Ellipse', 2);
O.m = new D(O, 'Path', 3);
O.W = null;
O.cb = 'UuBbMmZzLlHhVvCcSsQqTtAaFfXx';
O.className = 'Geometry';
O.stringify = O.ga;
O.fillPath = O.hb;
O.parse = O.parse;
O.Line = O.j;
O.Rectangle = O.u;
O.Ellipse = O.F;
O.Path = O.m;
function Xd(a, b, c, d) {
Ra(this);
void 0 === c && (c = !0);
void 0 === d && (d = !0);
this.o = 2 | (c ? 4 : 0) | (d ? 8 : 0);
void 0 !== a ? (this.gd = a) : (this.gd = 0);
void 0 !== b ? (this.hd = b) : (this.hd = 0);
this.el = new E();
this.Pq = this.el.Ia;
this.Kv = null;
}
Xd.prototype.copy = function() {
var a = new Xd();
a.o = this.o & -2;
a.gd = this.gd;
a.hd = this.hd;
for (var b = this.el.s, c = b.length, d = a.el, e = 0; e < c; e++) {
var f = b[e].copy();
d.add(f);
}
a.Pq = this.Pq;
a.Kv = this.Kv;
return a;
};
t = Xd.prototype;
t.$a = function(a) {
if (
!(
a instanceof Xd &&
J.B(this.startX, a.startX) &&
J.B(this.startY, a.startY)
)
)
return !1;
var b = this.segments.s;
a = a.segments.s;
var c = b.length;
if (c !== a.length) return !1;
for (var d = 0; d < c; d++) if (!b[d].$a(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.s, d = c.length, e = 0; e < d; e++)
b += ' ' + c[e].toString(a);
return b;
};
t.freeze = function() {
this._isFrozen = !0;
var a = this.segments;
a.freeze();
var b = a.s;
a = a.length;
for (var c = 0; c < a; c++) b[c].freeze();
return this;
};
t.ja = function() {
this._isFrozen = !1;
var a = this.segments;
a.ja();
a = a.s;
for (var b = a.length, c = 0; c < b; c++) a[c].ja();
return this;
};
t.Lu = function() {
if (this._isInvalidBounds) return !0;
var a = this.segments;
if (this.Pq !== a.Ia) return !0;
a = a.s;
for (var b = a.length, c = 0; c < b; c++)
if (a[c]._isInvalidBounds) return !0;
return !1;
};
t.add = function(a) {
this.el.add(a);
return this;
};
t.ba = function(a, b, c) {
for (
var d = this.startX,
e = this.startY,
f = d,
g = e,
h = this.segments.s,
k = h.length,
l = 0;
l < k;
l++
) {
var m = h[l];
switch (m.type) {
case Jd:
f = m.endX;
g = m.endY;
d = m.endX;
e = m.endY;
break;
case vd:
if (J.Tb(d, e, m.endX, m.endY, c, a, b)) return !0;
d = m.endX;
e = m.endY;
break;
case Kd:
if (
J.Br(
d,
e,
m.point1X,
m.point1Y,
m.point2X,
m.point2Y,
m.endX,
m.endY,
0.5,
a,
b,
c,
)
)
return !0;
d = m.endX;
e = m.endY;
break;
case Ld:
if (J.Tu(d, e, m.point1X, m.point1Y, m.endX, m.endY, 0.5, a, b, c))
return !0;
d = m.endX;
e = m.endY;
break;
case Md:
case Qd:
var n = m.type === Md ? Rd(m, this) : Sd(m, this, d, e),
p = n.length,
r = m.type === Md ? m.centerX : m.endX,
q = m.type === Md ? m.centerY : m.endY;
if (0 === p) {
if (J.Tb(d, e, r, q, c, a, b)) return !0;
d = r;
e = q;
break;
}
r = null;
for (q = 0; q < p; q++)
if (
((r = n[q]),
(0 === q && J.Tb(d, e, r[0], r[1], c, a, b)) ||
J.Br(
r[0],
r[1],
r[2],
r[3],
r[4],
r[5],
r[6],
r[7],
0.5,
a,
b,
c,
))
)
return !0;
null !== r && ((d = r[6]), (e = r[7]));
break;
default:
C('Unknown Segment type: ' + m.type);
}
if (m.isClosed && (d !== f || e !== g) && J.Tb(d, e, f, g, c, a, b))
return !0;
}
return !1;
};
ma.Object.defineProperties(Xd.prototype, {
_isFrozen: {
get: function() {
return 0 !== (this.o & 1);
},
set: function(a) {
this.o = a ? this.o | 1 : this.o & -2;
},
},
_isInvalidBounds: {
get: function() {
return 0 !== (this.o & 2);
},
set: function(a) {
this.o = a ? this.o | 2 : this.o & -3;
},
},
isFilled: {
get: function() {
return 0 !== (this.o & 4);
},
set: function(a) {
this._isFrozen && va(this, a);
this.o = a ? this.o | 4 : this.o & -5;
},
},
isShadowed: {
get: function() {
return 0 !== (this.o & 8);
},
set: function(a) {
this._isFrozen && va(this, a);
this.o = a ? this.o | 8 : this.o & -9;
},
},
startX: {
get: function() {
return this.gd;
},
set: function(a) {
this._isFrozen && va(this, a);
this.gd = a;
this._isInvalidBounds = !0;
},
},
startY: {
get: function() {
return this.hd;
},
set: function(a) {
this._isFrozen && va(this, a);
this.hd = a;
this._isInvalidBounds = !0;
},
},
segments: {
get: function() {
return this.el;
},
set: function(a) {
this._isFrozen && va(this, a);
this.el = a;
this._isInvalidBounds = !0;
},
},
});
Xd.prototype.add = Xd.prototype.add;
Xd.prototype.equalsApprox = Xd.prototype.$a;
Xd.className = 'PathFigure';
function Yd(a, b, c, d, e, f, g, h) {
Ra(this);
void 0 === a && (a = vd);
this.qa = a;
this.o = 2;
void 0 !== b ? (this.xc = b) : (this.xc = 0);
void 0 !== c ? (this.yc = c) : (this.yc = 0);
void 0 === d && (d = 0);
void 0 === e && (e = 0);
void 0 === f && (f = 0);
void 0 === g && (g = 0);
a === Qd
? ((a = f % 360),
0 > a && (a += 360),
(this.Be = a),
(this.Oh = 0),
(this.Ph = Math.max(d, 0)),
(this.Gg = Math.max(e, 0)),
'boolean' === typeof g
? g && (this.isLargeArc = !0)
: 'number' === typeof g && g && (this.isLargeArc = !0),
h && (this.isClockwiseArc = !0))
: ((this.Be = d),
(this.Oh = e),
a === Md && (f = Math.max(f, 0)),
(this.Ph = f),
'number' === typeof g
? (a === Md && (g = Math.max(g, 0)), (this.Gg = g))
: (this.Gg = 0));
this.Ud = null;
}
Yd.prototype.copy = function() {
var a = new Yd();
a.qa = this.qa;
a.o = this.o & -2;
a.xc = this.xc;
a.yc = this.yc;
a.Be = this.Be;
a.Oh = this.Oh;
a.Ph = this.Ph;
a.Gg = this.Gg;
return a;
};
t = Yd.prototype;
t.$a = function(a) {
if (
!(a instanceof Yd) ||
this.type !== a.type ||
this.isClosed !== a.isClosed
)
return !1;
switch (this.type) {
case Jd:
case vd:
return J.B(this.endX, a.endX) && J.B(this.endY, a.endY);
case Kd:
return (
J.B(this.endX, a.endX) &&
J.B(this.endY, a.endY) &&
J.B(this.point1X, a.point1X) &&
J.B(this.point1Y, a.point1Y) &&
J.B(this.point2X, a.point2X) &&
J.B(this.point2Y, a.point2Y)
);
case Ld:
return (
J.B(this.endX, a.endX) &&
J.B(this.endY, a.endY) &&
J.B(this.point1X, a.point1X) &&
J.B(this.point1Y, a.point1Y)
);
case Md:
return (
J.B(this.startAngle, a.startAngle) &&
J.B(this.sweepAngle, a.sweepAngle) &&
J.B(this.centerX, a.centerX) &&
J.B(this.centerY, a.centerY) &&
J.B(this.radiusX, a.radiusX) &&
J.B(this.radiusY, a.radiusY)
);
case Qd:
return (
this.isClockwiseArc === a.isClockwiseArc &&
this.isLargeArc === a.isLargeArc &&
J.B(this.xAxisRotation, a.xAxisRotation) &&
J.B(this.endX, a.endX) &&
J.B(this.endY, a.endY) &&
J.B(this.radiusX, a.radiusX) &&
J.B(this.radiusY, a.radiusY)
);
default:
return !1;
}
};
t.ob = function(a) {
a.classType === Yd && (this.type = a);
};
t.toString = function(a) {
void 0 === a && (a = -1);
switch (this.type) {
case Jd:
a =
0 > a
? 'M' + this.endX.toString() + ' ' + this.endY.toString()
: 'M' + this.endX.toFixed(a) + ' ' + this.endY.toFixed(a);
break;
case vd:
a =
0 > a
? 'L' + this.endX.toString() + ' ' + this.endY.toString()
: 'L' + this.endX.toFixed(a) + ' ' + this.endY.toFixed(a);
break;
case Kd:
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 Ld:
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 Md:
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 Qd:
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.isClosed ? 'z' : '');
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
this._isFrozen = !1;
return this;
};
t.close = function() {
this.isClosed = !0;
return this;
};
function Rd(a, b) {
if (null !== a.Ud && !1 === b._isInvalidBounds) return a.Ud;
var c = a.radiusX,
d = a.radiusY;
void 0 === d && (d = c);
if (0 === c || 0 === d) return (a.Ud = []), a.Ud;
b = a.Be;
var e = a.Oh,
f = J.Mw(
0,
0,
c < d ? c : d,
a.startAngle,
a.startAngle + a.sweepAngle,
!1,
);
if (c !== d) {
var g = md.alloc();
g.reset();
c < d ? g.scale(1, d / c) : g.scale(c / d, 1);
O.Ga(f, g);
md.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.Ud = f;
return a.Ud;
}
function Sd(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.Ud && !1 === b._isInvalidBounds) return a.Ud;
if (0 === a.radiusX || 0 === a.radiusY) return (a.Ud = []), a.Ud;
b = a.Ph;
var f = a.Gg;
0 === b && (b = 1e-4);
0 === f && (f = 1e-4);
var g = (Math.PI / 180) * a.Be,
h = a.isLargeArc,
k = a.isClockwiseArc,
l = a.xc,
m = a.yc,
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 = J.Mw(0, 0, b > f ? b : f, m, m + g, !0);
f = md.alloc();
f.reset();
f.translate(c, d);
f.rotate(a.Be, 0, 0);
f.scale(k, r);
O.Ga(b, f);
md.free(f);
a.Ud = b;
return a.Ud;
}
ma.Object.defineProperties(Yd.prototype, {
_isFrozen: {
get: function() {
return 0 !== (this.o & 1);
},
set: function(a) {
this.o = a ? this.o | 1 : this.o & -2;
},
},
_isInvalidBounds: {
get: function() {
return 0 !== (this.o & 2);
},
set: function(a) {
this.o = a ? this.o | 2 : this.o & -3;
},
},
isClosed: {
get: function() {
return 0 !== (this.o & 8);
},
set: function(a) {
this.isClosed !== a &&
((this.o = a ? this.o | 8 : this.o & -9),
(this._isInvalidBounds = !0));
},
},
type: {
get: function() {
return this.qa;
},
set: function(a) {
this._isFrozen && va(this, a);
this.qa = a;
this._isInvalidBounds = !0;
},
},
endX: {
get: function() {
return this.xc;
},
set: function(a) {
this._isFrozen && va(this, a);
this.xc = a;
this._isInvalidBounds = !0;
},
},
endY: {
get: function() {
return this.yc;
},
set: function(a) {
this._isFrozen && va(this, a);
this.yc = a;
this._isInvalidBounds = !0;
},
},
point1X: {
get: function() {
return this.Be;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Be = a;
this._isInvalidBounds = !0;
},
},
point1Y: {
get: function() {
return this.Oh;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Oh = a;
this._isInvalidBounds = !0;
},
},
point2X: {
get: function() {
return this.Ph;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Ph = a;
this._isInvalidBounds = !0;
},
},
point2Y: {
get: function() {
return this.Gg;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Gg = a;
this._isInvalidBounds = !0;
},
},
centerX: {
get: function() {
return this.Be;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Be = a;
this._isInvalidBounds = !0;
},
},
centerY: {
get: function() {
return this.Oh;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Oh = a;
this._isInvalidBounds = !0;
},
},
radiusX: {
get: function() {
return this.Ph;
},
set: function(a) {
0 > a && wa(a, '>= zero', Yd, 'radiusX');
this._isFrozen && va(this, a);
this.Ph = a;
this._isInvalidBounds = !0;
},
},
radiusY: {
get: function() {
return this.Gg;
},
set: function(a) {
0 > a && wa(a, '>= zero', Yd, 'radiusY');
this._isFrozen && va(this, a);
this.Gg = a;
this._isInvalidBounds = !0;
},
},
startAngle: {
get: function() {
return this.xc;
},
set: function(a) {
this._isFrozen && va(this, a);
a %= 360;
0 > a && (a += 360);
this.xc = a;
this._isInvalidBounds = !0;
},
},
sweepAngle: {
get: function() {
return this.yc;
},
set: function(a) {
this._isFrozen && va(this, a);
360 < a && (a = 360);
-360 > a && (a = -360);
this.yc = a;
this._isInvalidBounds = !0;
},
},
isClockwiseArc: {
get: function() {
return 0 !== (this.o & 4);
},
set: function(a) {
this._isFrozen && va(this, a);
this.o = a ? this.o | 4 : this.o & -5;
this._isInvalidBounds = !0;
},
},
isLargeArc: {
get: function() {
return 0 !== (this.o & 16);
},
set: function(a) {
this._isFrozen && va(this, a);
this.o = a ? this.o | 16 : this.o & -17;
this._isInvalidBounds = !0;
},
},
xAxisRotation: {
get: function() {
return this.Be;
},
set: function(a) {
this._isFrozen && va(this, a);
a %= 360;
0 > a && (a += 360);
this.Be = a;
this._isInvalidBounds = !0;
},
},
});
Yd.prototype.equalsApprox = Yd.prototype.$a;
var Jd = new D(Yd, 'Move', 0),
vd = new D(Yd, 'Line', 1),
Kd = new D(Yd, 'Bezier', 2),
Ld = new D(Yd, 'QuadraticBezier', 3),
Md = new D(Yd, 'Arc', 4),
Qd = new D(Yd, 'SvgArc', 4);
Yd.className = 'PathSegment';
Yd.Move = Jd;
Yd.Line = vd;
Yd.Bezier = Kd;
Yd.QuadraticBezier = Ld;
Yd.Arc = Md;
Yd.SvgArc = Qd;
function $d() {
this.H = null;
this.cu = new I(0, 0).freeze();
this.Os = new I(0, 0).freeze();
this.ep = this.qq = 0;
this.fp = 1;
this.yh = '';
this.vr = this.xp = !1;
this.vp = this.hp = 0;
this.og = this.Pp = this.Vp = !1;
this.Cp = null;
this.qr = 0;
this.sd = this.lr = null;
}
$d.prototype.copy = function() {
var a = new $d();
return this.clone(a);
};
$d.prototype.clone = function(a) {
a.H = this.H;
a.cu.assign(this.viewPoint);
a.Os.assign(this.documentPoint);
a.qq = this.qq;
a.ep = this.ep;
a.fp = this.fp;
a.yh = this.yh;
a.xp = this.xp;
a.vr = this.vr;
a.hp = this.hp;
a.vp = this.vp;
a.Vp = this.Vp;
a.Pp = this.Pp;
a.og = this.og;
a.Cp = this.Cp;
a.qr = this.qr;
a.lr = this.lr;
a.sd = this.sd;
return a;
};
$d.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;
};
$d.prototype.vo = function(a, b) {
var c = this.diagram;
if (null === c) return b;
ae(c, this.event, a, b);
return b;
};
$d.prototype.iz = function(a, b) {
var c = this.diagram;
if (null === c) return b;
ae(c, this.event, a, b);
b.assign(c.rs(b));
return b;
};
ma.Object.defineProperties($d.prototype, {
diagram: {
get: function() {
return this.H;
},
set: function(a) {
this.H = a;
},
},
viewPoint: {
get: function() {
return this.cu;
},
set: function(a) {
this.cu.assign(a);
},
},
documentPoint: {
get: function() {
return this.Os;
},
set: function(a) {
this.Os.assign(a);
},
},
modifiers: {
get: function() {
return this.qq;
},
set: function(a) {
this.qq = a;
},
},
button: {
get: function() {
return this.ep;
},
set: function(a) {
this.ep = 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.fp;
},
set: function(a) {
this.fp = a;
},
},
key: {
get: function() {
return this.yh;
},
set: function(a) {
this.yh = a;
},
},
down: {
get: function() {
return this.xp;
},
set: function(a) {
this.xp = a;
},
},
up: {
get: function() {
return this.vr;
},
set: function(a) {
this.vr = a;
},
},
clickCount: {
get: function() {
return this.hp;
},
set: function(a) {
this.hp = a;
},
},
delta: {
get: function() {
return this.vp;
},
set: function(a) {
this.vp = a;
},
},
isMultiTouch: {
get: function() {
return this.Vp;
},
set: function(a) {
this.Vp = a;
},
},
handled: {
get: function() {
return this.Pp;
},
set: function(a) {
this.Pp = a;
},
},
bubbles: {
get: function() {
return this.og;
},
set: function(a) {
this.og = a;
},
},
event: {
get: function() {
return this.Cp;
},
set: function(a) {
this.Cp = 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.qr;
},
set: function(a) {
this.qr = a;
},
},
targetDiagram: {
get: function() {
return this.lr;
},
set: function(a) {
this.lr = a;
},
},
targetObject: {
get: function() {
return this.sd;
},
set: function(a) {
this.sd = 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;
},
},
});
$d.prototype.getMultiTouchDocumentPoint = $d.prototype.iz;
$d.prototype.getMultiTouchViewPoint = $d.prototype.vo;
$d.className = 'InputEvent';
function be() {
this.H = null;
this.va = '';
this.zq = this.hr = null;
}
be.prototype.copy = function() {
var a = new be();
a.H = this.H;
a.va = this.va;
a.hr = this.hr;
a.zq = this.zq;
return a;
};
be.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(be.prototype, {
diagram: {
get: function() {
return this.H;
},
set: function(a) {
this.H = a;
},
},
name: {
get: function() {
return this.va;
},
set: function(a) {
this.va = a;
},
},
subject: {
get: function() {
return this.hr;
},
set: function(a) {
this.hr = a;
},
},
parameter: {
get: function() {
return this.zq;
},
set: function(a) {
this.zq = a;
},
},
});
be.className = 'DiagramEvent';
function ce() {
this.nm = de;
this.df = this.pq = '';
this.sn = this.tn = this.yn = this.zn = this.xn = this.H = this.ac = null;
}
ce.prototype.clear = function() {
this.sn = this.tn = this.yn = this.zn = this.xn = this.H = this.ac = null;
};
ce.prototype.copy = function() {
var a = new ce();
a.nm = this.nm;
a.pq = this.pq;
a.df = this.df;
a.ac = this.ac;
a.H = this.H;
a.xn = this.xn;
var b = this.zn;
a.zn = ya(b) && 'function' === typeof b.J ? b.J() : b;
b = this.yn;
a.yn = ya(b) && 'function' === typeof b.J ? b.J() : b;
b = this.tn;
a.tn = ya(b) && 'function' === typeof b.J ? b.J() : b;
b = this.sn;
a.sn = ya(b) && 'function' === typeof b.J ? b.J() : b;
return a;
};
ce.prototype.ob = function(a) {
a.classType === ce && (this.change = a);
};
ce.prototype.toString = function() {
var a = '';
a =
this.change === ee
? a + '* '
: this.change === de
? 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 === ee
? null !== this.oldValue && (a += ' ' + this.oldValue)
: (null !== this.object && (a += Ia(this.object)),
null !== this.oldValue && (a += ' old: ' + Ia(this.oldValue)),
null !== this.oldParam && (a += ' ' + this.oldParam),
null !== this.newValue && (a += ' new: ' + Ia(this.newValue)),
null !== this.newParam && (a += ' ' + this.newParam));
return a;
};
ce.prototype.I = function(a) {
return a ? this.oldValue : this.newValue;
};
ce.prototype.kz = function(a) {
return a ? this.oldParam : this.newParam;
};
ce.prototype.canUndo = function() {
return null !== this.model || null !== this.diagram ? !0 : !1;
};
ce.prototype.undo = function() {
this.canUndo() &&
(null !== this.model
? this.model.changeState(this, !0)
: null !== this.diagram && this.diagram.changeState(this, !0));
};
ce.prototype.canRedo = function() {
return null !== this.model || null !== this.diagram ? !0 : !1;
};
ce.prototype.redo = function() {
this.canRedo() &&
(null !== this.model
? this.model.changeState(this, !1)
: null !== this.diagram && this.diagram.changeState(this, !1));
};
ma.Object.defineProperties(ce.prototype, {
model: {
get: function() {
return this.ac;
},
set: function(a) {
this.ac = a;
},
},
diagram: {
get: function() {
return this.H;
},
set: function(a) {
this.H = a;
},
},
change: {
get: function() {
return this.nm;
},
set: function(a) {
this.nm = a;
},
},
modelChange: {
get: function() {
return this.pq;
},
set: function(a) {
this.pq = a;
},
},
propertyName: {
get: function() {
return this.df;
},
set: function(a) {
this.df = a;
},
},
isTransactionFinished: {
get: function() {
return (
this.nm === ee &&
('CommittedTransaction' === this.df ||
'FinishedUndo' === this.df ||
'FinishedRedo' === this.df)
);
},
},
object: {
get: function() {
return this.xn;
},
set: function(a) {
this.xn = a;
},
},
oldValue: {
get: function() {
return this.zn;
},
set: function(a) {
this.zn = a;
},
},
oldParam: {
get: function() {
return this.yn;
},
set: function(a) {
this.yn = a;
},
},
newValue: {
get: function() {
return this.tn;
},
set: function(a) {
this.tn = a;
},
},
newParam: {
get: function() {
return this.sn;
},
set: function(a) {
this.sn = a;
},
},
});
ce.prototype.redo = ce.prototype.redo;
ce.prototype.canRedo = ce.prototype.canRedo;
ce.prototype.undo = ce.prototype.undo;
ce.prototype.canUndo = ce.prototype.canUndo;
ce.prototype.getParam = ce.prototype.kz;
ce.prototype.getValue = ce.prototype.I;
ce.prototype.clear = ce.prototype.clear;
var ee = new D(ce, 'Transaction', -1),
de = new D(ce, 'Property', 0),
fe = new D(ce, 'Insert', 1),
ge = new D(ce, 'Remove', 2);
ce.className = 'ChangedEvent';
ce.Transaction = ee;
ce.Property = de;
ce.Insert = fe;
ce.Remove = ge;
function he() {
this.m = new E().freeze();
this.va = '';
this.j = !1;
}
he.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.K(c);
null !== d && (b += '\n ' + d.toString());
}
}
return b;
};
he.prototype.clear = function() {
var a = this.changes;
a.ja();
for (var b = a.count - 1; 0 <= b; b--) {
var c = a.K(b);
null !== c && c.clear();
}
a.clear();
a.freeze();
};
he.prototype.canUndo = function() {
return this.isComplete;
};
he.prototype.undo = function() {
if (this.canUndo())
for (var a = this.changes.count - 1; 0 <= a; a--) {
var b = this.changes.K(a);
null !== b && b.undo();
}
};
he.prototype.canRedo = function() {
return this.isComplete;
};
he.prototype.redo = function() {
if (this.canRedo())
for (var a = this.changes.count, b = 0; b < a; b++) {
var c = this.changes.K(b);
null !== c && c.redo();
}
};
he.prototype.Vj = function() {
if (this.isComplete) {
var a = this.changes;
a.ja();
for (var b = new pb(), c = 0; c < a.count; c++) {
var d = a.K(c);
if (null !== d && d.change === de && d.object) {
var e = b.get(d.object);
e || ((e = new pb()), b.set(d.object, e));
var f = e.get(d.propertyName);
null === f
? e.set(d.propertyName, -1)
: (0 < f && a.Vc(f, null), e.set(d.propertyName, c));
}
}
for (c = b = 0; c < a.count; c++)
(d = a.K(c)), null !== d && (c > b && a.Vc(b, d), b++);
for (; a.length > b; ) a.pop();
a.freeze();
}
};
ma.Object.defineProperties(he.prototype, {
changes: {
get: function() {
return this.m;
},
},
name: {
get: function() {
return this.va;
},
set: function(a) {
this.va = a;
},
},
isComplete: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
});
he.prototype.optimize = he.prototype.Vj;
he.prototype.redo = he.prototype.redo;
he.prototype.canRedo = he.prototype.canRedo;
he.prototype.undo = he.prototype.undo;
he.prototype.canUndo = he.prototype.canUndo;
he.prototype.clear = he.prototype.clear;
he.className = 'Transaction';
function ie() {
this.ut = new G();
this.Ad = !1;
this.u = new E().freeze();
this.se = -1;
this.m = 999;
this.ue = !1;
this.qp = null;
this.Vh = 0;
this.j = !1;
this.xe = new E().freeze();
this.Wk = new E();
this.Ws = !0;
this.ft = this.Tp = this.it = this.ht = !1;
}
ie.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.K(d));
b += ']';
if (void 0 !== a && 0 < a)
for (c = this.history.count, d = 0; d < c; d++)
b += '\n ' + this.history.K(d).toString(a - 1);
return b;
};
ie.prototype.clear = function() {
var a = this.history;
a.ja();
for (var b = a.count - 1; 0 <= b; b--) {
var c = a.K(b);
null !== c && c.clear();
}
a.clear();
this.se = -1;
a.freeze();
this.ue = !1;
this.qp = null;
this.Vh = 0;
this.xe.ja();
this.xe.clear();
this.xe.freeze();
this.Wk.clear();
this.ft = this.Tp = this.it = this.ht = !1;
};
ie.prototype.copyProperties = function(a) {
this.isEnabled = a.isEnabled;
this.maxHistoryLength = a.maxHistoryLength;
this.checksTransactionLevel = a.checksTransactionLevel;
};
t = ie.prototype;
t.Bw = function(a) {
this.ut.add(a);
};
t.yx = function(a) {
this.ut.remove(a);
};
t.Da = function(a) {
void 0 === a && (a = '');
null === a && (a = '');
if (this.isUndoingRedoing) return !1;
!0 === this.Ws &&
((this.Ws = !1),
this.Vh++,
this.isInternalTransaction ||
this.Kb('StartingFirstTransaction', a, this.currentTransaction),
0 < this.Vh && this.Vh--);
this.isEnabled &&
(this.xe.ja(),
this.xe.add(a),
this.xe.freeze(),
null === this.currentTransaction
? this.Wk.add(0)
: this.Wk.add(this.currentTransaction.changes.count));
this.Vh++;
var b = 1 === this.transactionLevel;
b &&
(this.isInternalTransaction ||
this.Kb('StartedTransaction', a, this.currentTransaction));
return b;
};
t.eb = function(a) {
void 0 === a && (a = '');
return je(this, !0, a);
};
t.Bf = function() {
return je(this, !1, '');
};
function je(a, b, c) {
if (a.isUndoingRedoing) return !1;
a.checksTransactionLevel &&
1 > a.transactionLevel &&
xa('Ending transaction without having started a transaction: ' + c);
var d = 1 === a.transactionLevel,
e = a.currentTransaction;
d && b && (a.isInternalTransaction || a.Kb('CommittingTransaction', c, e));
var f = 0;
if (0 < a.transactionLevel && (a.Vh--, a.isEnabled)) {
var g = a.xe.count;
0 < g &&
('' === c && (c = a.xe.K(0)), a.xe.ja(), a.xe.mb(g - 1), a.xe.freeze());
g = a.Wk.count;
0 < g && ((f = a.Wk.K(g - 1)), a.Wk.mb(g - 1));
}
if (d) {
if (b) {
a.Tp = !1;
null === e && '' !== c && (e = a.currentTransaction);
if (a.isEnabled && null !== e) {
e.isComplete || ((e.isComplete = !0), (e.name = c));
b = a.history;
b.ja();
for (d = b.count - 1; d > a.historyIndex; d--)
(f = b.K(d)), null !== f && f.clear(), b.mb(d), (a.Tp = !0);
d = a.maxHistoryLength;
0 <= d &&
(0 === d
? b.clear()
: b.count >= d &&
((f = b.K(0)), null !== f && f.clear(), b.mb(0), a.se--));
0 === d ||
(0 !== b.count && b.get(b.count - 1) === e) ||
(b.add(e), a.se++);
b.freeze();
}
a.isInternalTransaction || a.Kb('CommittedTransaction', c, e);
} else {
a.ue = !0;
try {
a.isEnabled && null !== e && ((e.isComplete = !0), e.undo());
} finally {
a.isInternalTransaction || a.Kb('RolledBackTransaction', c, e),
(a.ue = !1);
}
null !== e && e.clear();
}
a.qp = null;
a.isPendingClear && a.clear();
a.isPendingClear = !1;
a.isPendingUnmodified = !1;
return !0;
}
if (a.isEnabled && !b && null !== e) {
a = f;
c = e.changes;
for (e = c.count - 1; e >= a; e--)
(b = c.K(e)), null !== b && b.undo(), c.ja(), c.mb(e);
c.freeze();
}
return !1;
}
ie.prototype.canUndo = function() {
if (!this.isEnabled || 0 < this.transactionLevel) return !1;
var a = this.transactionToUndo;
return null !== a && a.canUndo() ? !0 : !1;
};
ie.prototype.undo = function() {
if (this.canUndo()) {
var a = this.transactionToUndo;
try {
(this.ue = !0), this.Kb('StartingUndo', 'Undo', a), this.se--, a.undo();
} catch (b) {
xa('undo error: ' + b.toString());
} finally {
this.Kb('FinishedUndo', 'Undo', a), (this.ue = !1);
}
}
};
ie.prototype.canRedo = function() {
if (!this.isEnabled || 0 < this.transactionLevel) return !1;
var a = this.transactionToRedo;
return null !== a && a.canRedo() ? !0 : !1;
};
ie.prototype.redo = function() {
if (this.canRedo()) {
var a = this.transactionToRedo;
try {
(this.ue = !0), this.Kb('StartingRedo', 'Redo', a), this.se++, a.redo();
} catch (b) {
xa('redo error: ' + b.toString());
} finally {
this.Kb('FinishedRedo', 'Redo', a), (this.ue = !1);
}
}
};
ie.prototype.Kb = function(a, b, c) {
void 0 === c && (c = null);
var d = new ce();
d.change = ee;
d.propertyName = a;
d.object = c;
d.oldValue = b;
for (a = this.models; a.next(); ) (b = a.value), (d.model = b), b.Cr(d);
};
ie.prototype.Fu = function(a) {
if (this.isEnabled && !this.isUndoingRedoing && !this.skipsEvent(a)) {
var b = this.currentTransaction;
null === b && (this.qp = b = new he());
var c = a.copy();
b = b.changes;
b.ja();
b.add(c);
b.freeze();
this.checksTransactionLevel &&
0 >= this.transactionLevel &&
!this.Ws &&
((a = a.diagram),
(null !== a && !1 === a.ji) ||
xa('Change not within a transaction: ' + c.toString()));
}
};
ie.prototype.skipsEvent = function(a) {
if (null === a || 0 > a.change.value) return !0;
a = a.object;
if (null === a) return !1;
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(ie.prototype, {
models: {
get: function() {
return this.ut.iterator;
},
},
isEnabled: {
get: function() {
return this.Ad;
},
set: function(a) {
this.Ad = a;
},
},
transactionToUndo: {
get: function() {
return 0 <= this.historyIndex &&
this.historyIndex <= this.history.count - 1
? this.history.K(this.historyIndex)
: null;
},
},
transactionToRedo: {
get: function() {
return this.historyIndex < this.history.count - 1
? this.history.K(this.historyIndex + 1)
: null;
},
},
isUndoingRedoing: {
get: function() {
return this.ue;
},
},
history: {
get: function() {
return this.u;
},
},
maxHistoryLength: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
historyIndex: {
get: function() {
return this.se;
},
},
currentTransaction: {
get: function() {
return this.qp;
},
},
transactionLevel: {
get: function() {
return this.Vh;
},
},
isInTransaction: {
get: function() {
return 0 < this.Vh;
},
},
checksTransactionLevel: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
nestedTransactionNames: {
get: function() {
return this.xe;
},
},
isPendingClear: {
get: function() {
return this.ht;
},
set: function(a) {
this.ht = a;
},
},
isPendingUnmodified: {
get: function() {
return this.it;
},
set: function(a) {
this.it = a;
},
},
isInternalTransaction: {
get: function() {
return this.ft;
},
set: function(a) {
this.ft = a;
},
},
isJustDiscarded: {
get: function() {
return this.Tp;
},
},
});
ie.prototype.handleChanged = ie.prototype.Fu;
ie.prototype.redo = ie.prototype.redo;
ie.prototype.undo = ie.prototype.undo;
ie.prototype.canUndo = ie.prototype.canUndo;
ie.prototype.rollbackTransaction = ie.prototype.Bf;
ie.prototype.commitTransaction = ie.prototype.eb;
ie.prototype.startTransaction = ie.prototype.Da;
ie.prototype.removeModel = ie.prototype.yx;
ie.prototype.addModel = ie.prototype.Bw;
ie.prototype.clear = ie.prototype.clear;
ie.className = 'UndoManager';
function ke() {
Ra(this);
this.H = le;
this.va = '';
this.Ad = !0;
this.hb = !1;
this.xi = null;
this.gy = new $d();
this.yr = -1;
}
ke.prototype.toString = function() {
return '' !== this.name ? this.name + ' Tool' : Ha(this.constructor);
};
ke.prototype.updateAdornments = function() {};
ke.prototype.canStart = function() {
return this.isEnabled;
};
ke.prototype.doStart = function() {};
ke.prototype.doActivate = function() {
this.isActive = !0;
};
ke.prototype.doDeactivate = function() {
this.isActive = !1;
};
ke.prototype.doStop = function() {};
ke.prototype.doCancel = function() {
this.transactionResult = null;
this.stopTool();
};
ke.prototype.stopTool = function() {
var a = this.diagram;
a.currentTool === this && ((a.currentTool = null), (a.currentCursor = ''));
};
ke.prototype.doMouseDown = function() {
!this.isActive && this.canStart() && this.doActivate();
};
ke.prototype.doMouseMove = function() {};
ke.prototype.doMouseUp = function() {
this.stopTool();
};
ke.prototype.doMouseWheel = function() {};
ke.prototype.canStartMultiTouch = function() {
return !0;
};
ke.prototype.standardPinchZoomStart = function() {
var a = this.diagram,
b = a.lastInput,
c = b.vo(0, I.allocAt(NaN, NaN)),
d = b.vo(1, I.allocAt(NaN, NaN));
if (c.v() && d.v() && (this.doCancel(), a.yl('hasGestureZoom'))) {
a.fw = a.scale;
var e = d.x - c.x,
f = d.y - c.y;
a.nw = Math.sqrt(e * e + f * f);
b.bubbles = !1;
}
I.free(c);
I.free(d);
};
ke.prototype.standardPinchZoomMove = function() {
var a = this.diagram,
b = a.lastInput,
c = b.vo(0, I.allocAt(NaN, NaN)),
d = b.vo(1, I.allocAt(NaN, NaN));
if (c.v() && d.v() && (this.doCancel(), a.yl('hasGestureZoom'))) {
var e = d.x - c.x,
f = d.y - c.y;
f = Math.sqrt(e * e + f * f) / a.nw;
e = new I(
(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.fw;
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;
}
I.free(c);
I.free(d);
};
ke.prototype.doKeyDown = function() {
'Esc' === this.diagram.lastInput.key && this.doCancel();
};
ke.prototype.doKeyUp = function() {};
ke.prototype.Da = function(a) {
void 0 === a && (a = this.name);
this.transactionResult = null;
return this.diagram.Da(a);
};
ke.prototype.stopTransaction = function() {
var a = this.diagram;
return null === this.transactionResult
? a.Bf()
: a.eb(this.transactionResult);
};
ke.prototype.standardMouseSelect = function() {
var a = this.diagram;
if (a.allowSelect) {
var b = a.lastInput,
c = a.wl(b.documentPoint, !1);
if (null !== c)
if (Qa ? b.meta : b.control) {
a.P('ChangingSelection', a.selection);
for (b = c; null !== b && !b.canSelect(); ) b = b.containingGroup;
null !== b && (b.isSelected = !b.isSelected);
a.P('ChangedSelection', a.selection);
} else if (b.shift) {
if (!c.isSelected) {
a.P('ChangingSelection', a.selection);
for (b = c; null !== b && !b.canSelect(); ) b = b.containingGroup;
null !== b && (b.isSelected = !0);
a.P('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 || (Qa ? b.meta : b.control) || b.shift || a.clearSelection();
}
};
ke.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.ec(d.documentPoint, a, b);
d.targetObject = a;
re(a, d, c);
return d.handled;
};
function re(a, b, c) {
b.handled = !1;
if (null === a || a.yf()) {
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.P(e, a);
} else {
switch (d) {
case 1:
e = 'BackgroundSingleClicked';
break;
case 2:
e = 'BackgroundDoubleClicked';
break;
case 3:
e = 'BackgroundContextClicked';
}
0 !== d && c.P(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);
}
}
}
ke.prototype.standardMouseOver = function() {
var a = this.diagram,
b = a.lastInput;
if (!0 !== a.animationManager.zb) {
var c = a.skipsUndoManager;
a.skipsUndoManager = !0;
var d = a.viewportBounds.ba(b.documentPoint)
? a.ec(b.documentPoint, null, null)
: null;
b.targetObject = d;
var e = !1;
if (d !== a.qk) {
var f = a.qk,
g = f;
a.qk = 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.jg(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.jg(d)) break;
g(b, d, f);
e = !0;
if (b.handled) break;
}
d = d.panel;
}
d = a.qk;
}
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.Mb();
a.skipsUndoManager = c;
}
};
ke.prototype.doCurrentObjectChanged = function() {};
ke.prototype.standardMouseWheel = function() {
var a = this.diagram,
b = a.lastInput,
c = b.delta;
if (0 !== c && a.documentBounds.v()) {
var d = a.commandHandler,
e = a.toolManager.mouseWheelBehavior;
if (null !== d && ((e === se && !b.shift) || (e === te && b.control))) {
if (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 === se && b.shift) || (e === te && !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 (Na || Pa)
(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 &&
((e *= a.scrollHorizontalLineChange / 16),
0 < e ? a.scroll(c, 'left', -e) : a.scroll(c, 'right', e));
0 !== g &&
a.allowVerticalScroll &&
((g *= a.scrollVerticalLineChange / 16),
0 < g ? a.scroll(c, 'up', -g) : a.scroll(c, 'down', g));
}
a.position.C(d) || (b.bubbles = !1);
}
}
};
ke.prototype.standardWaitAfter = function(a, b) {
void 0 === b && (b = this.diagram.lastInput);
this.cancelWaitAfter();
var c = this,
d = b.clone(this.gy);
this.yr = ta(function() {
c.doWaitAfter(d);
}, a);
};
ke.prototype.cancelWaitAfter = function() {
-1 !== this.yr && x.clearTimeout(this.yr);
this.yr = -1;
};
ke.prototype.doWaitAfter = function() {};
ke.prototype.findToolHandleAt = function(a, b) {
a = this.diagram.ec(a, function(a) {
for (; null !== a && !(a.panel instanceof ue); ) a = a.panel;
return a;
});
return null === a ? null : a.part.category === b ? a : null;
};
ke.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(ke.prototype, {
diagram: {
get: function() {
return this.H;
},
set: function(a) {
a instanceof Q && (this.H = a);
},
},
name: {
get: function() {
return this.va;
},
set: function(a) {
this.va = a;
},
},
isEnabled: {
get: function() {
return this.Ad;
},
set: function(a) {
this.Ad = a;
},
},
isActive: {
get: function() {
return this.hb;
},
set: function(a) {
this.hb = a;
},
},
transactionResult: {
get: function() {
return this.xi;
},
set: function(a) {
this.xi = a;
},
},
});
ke.prototype.startTransaction = ke.prototype.Da;
ke.className = 'Tool';
function La() {
ke.call(this);
this.name = 'ToolManager';
this.cb = new E();
this.nb = new E();
this.Db = new E();
this.F = this.W = 850;
this.m = new K(2, 2).ha();
this.Ga = 5e3;
this.ga = te;
this.u = ve;
this.pp = this.j = null;
this.uj = -1;
}
la(La, ke);
La.prototype.initializeStandardTools = function() {};
La.prototype.updateAdornments = function(a) {
var b = this.currentToolTip;
if (b instanceof ue && this.pp === a) {
var c = b.adornedObject;
(null !== a
? c.part === a
: null === c)
? this.showToolTip(b, c)
: this.hideToolTip();
}
};
La.prototype.doMouseDown = function() {
var a = this.diagram,
b = a.lastInput;
b.isTouchEvent && this.gestureBehavior === we && (b.bubbles = !1);
if (b.isMultiTouch) {
this.cancelWaitAfter();
if (this.gestureBehavior === xe) {
b.bubbles = !0;
return;
}
if (this.gestureBehavior === we) return;
if (a.currentTool.canStartMultiTouch()) {
a.currentTool.standardPinchZoomStart();
return;
}
}
for (var c = this.mouseDownTools.length, d = 0; d < c; d++) {
var e = this.mouseDownTools.K(d);
e.diagram = 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 === te
? (this.mouseWheelBehavior = se)
: this.mouseWheelBehavior === se && (this.mouseWheelBehavior = te));
this.doActivate();
this.standardWaitAfter(this.holdDelay, b);
};
La.prototype.doMouseMove = function() {
var a = this.diagram,
b = a.lastInput;
if (b.isMultiTouch) {
if (this.gestureBehavior === xe) {
b.bubbles = !0;
return;
}
if (this.gestureBehavior === we) 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.K(d);
e.diagram = this.diagram;
if (e.canStart()) {
a.doFocus();
a.currentTool = e;
a.currentTool === e &&
(e.isActive || e.doActivate(), e.doMouseMove());
return;
}
}
ye(this, a);
a = b.event;
null === a ||
('pointermove' !== a.type && a.cancelable) ||
(b.bubbles = !0);
};
function ye(a, b) {
a.standardMouseOver();
a.isBeyondDragSize() &&
a.standardWaitAfter(a.isActive ? a.holdDelay : a.hoverDelay, b.lastInput);
}
La.prototype.doCurrentObjectChanged = function(a, b) {
a = this.currentToolTip;
null === a ||
(null !== b && a instanceof ue && (b === a || b.jg(a))) ||
this.hideToolTip();
};
La.prototype.doWaitAfter = function(a) {
var b = this.diagram;
b.Ha &&
(this.doMouseHover(),
this.isActive || this.doToolTip(),
a.isTouchEvent &&
!b.lastInput.handled &&
((a = a.copy()),
(a.button = 2),
(a.buttons = 2),
(b.lastInput = a),
(b.Wt = !0),
b.doMouseUp()));
};
La.prototype.doMouseHover = function() {
var a = this.diagram,
b = a.lastInput;
null === b.targetObject &&
(b.targetObject = a.ec(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);
};
La.prototype.doToolTip = function() {
var a = this.diagram,
b = a.lastInput;
null === b.targetObject &&
(b.targetObject = a.ec(b.documentPoint, null, null));
b = b.targetObject;
if (null !== b) {
if (
((a = this.currentToolTip), !(a instanceof ue) || (b !== a && !b.jg(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();
};
La.prototype.showToolTip = function(a, b) {
var c = this.diagram;
a !== this.currentToolTip && this.hideToolTip();
if (a instanceof ue) {
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.Za();
this.positionToolTip(a, b);
} else a instanceof ze && a !== this.currentToolTip && a.show(b, c, this);
this.currentToolTip = a;
-1 !== this.uj && (x.clearTimeout(this.uj), (this.uj = -1));
a = this.toolTipDuration;
if (0 < a && Infinity !== a) {
var e = this;
this.uj = ta(function() {
e.hideToolTip();
}, a);
}
};
La.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;
}
};
La.prototype.hideToolTip = function() {
-1 !== this.uj && (x.clearTimeout(this.uj), (this.uj = -1));
var a = this.diagram,
b = this.currentToolTip;
null !== b &&
(b instanceof ue
? (a.remove(b),
null !== this.pp && this.pp.Af(b.category),
(b.data = null),
(b.adornedObject = null))
: b instanceof ze && null !== b.hide && b.hide(a, this),
(this.currentToolTip = null));
};
La.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.K(c);
d.diagram = this.diagram;
if (d.canStart()) {
a.doFocus();
a.currentTool = d;
a.currentTool === d && (d.isActive || d.doActivate(), d.doMouseUp());
return;
}
}
a.doFocus();
this.doDeactivate();
};
La.prototype.doMouseWheel = function() {
this.standardMouseWheel();
};
La.prototype.doKeyDown = function() {
var a = this.diagram;
null !== a.commandHandler && a.commandHandler.doKeyDown();
};
La.prototype.doKeyUp = function() {
var a = this.diagram;
null !== a.commandHandler && a.commandHandler.doKeyUp();
};
La.prototype.findTool = function(a) {
for (var b = this.mouseDownTools.length, c = 0; c < b; c++) {
var d = this.mouseDownTools.K(c);
if (d.name === a) return d;
}
b = this.mouseMoveTools.length;
for (c = 0; c < b; c++)
if (((d = this.mouseMoveTools.K(c)), d.name === a)) return d;
b = this.mouseUpTools.length;
for (c = 0; c < b; c++)
if (((d = this.mouseUpTools.K(c)), d.name === a)) return d;
return null;
};
La.prototype.replaceTool = function(a, b) {
null !== b && (b.diagram = this.diagram);
for (var c = this.mouseDownTools.length, d = 0; d < c; d++) {
var e = this.mouseDownTools.K(d);
if (e.name === a)
return (
null !== b ? this.mouseDownTools.Vc(d, b) : this.mouseDownTools.mb(d),
e
);
}
c = this.mouseMoveTools.length;
for (d = 0; d < c; d++)
if (((e = this.mouseMoveTools.K(d)), e.name === a))
return (
null !== b ? this.mouseMoveTools.Vc(d, b) : this.mouseMoveTools.mb(d),
e
);
c = this.mouseUpTools.length;
for (d = 0; d < c; d++)
if (((e = this.mouseUpTools.K(d)), e.name === a))
return (
null !== b ? this.mouseUpTools.Vc(d, b) : this.mouseUpTools.mb(d), e
);
return null;
};
La.prototype.gb = function(a, b, c) {
null !== b && ((b.name = a), (b.diagram = this.diagram));
this.findTool(a) ? this.replaceTool(a, b) : null !== b && c.add(b);
};
ma.Object.defineProperties(La.prototype, {
mouseWheelBehavior: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
gestureBehavior: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
currentToolTip: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
this.pp = null !== a && a instanceof ue ? a.adornedPart : null;
},
},
mouseDownTools: {
get: function() {
return this.cb;
},
},
mouseMoveTools: {
get: function() {
return this.nb;
},
},
mouseUpTools: {
get: function() {
return this.Db;
},
},
hoverDelay: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
holdDelay: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
dragSize: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a.J();
},
},
toolTipDuration: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga = a;
},
},
});
La.prototype.replaceStandardTool = La.prototype.gb;
var te = new D(La, 'WheelScroll', 0),
se = new D(La, 'WheelZoom', 1),
Ae = new D(La, 'WheelNone', 2),
ve = new D(La, 'GestureZoom', 3),
we = new D(La, 'GestureCancel', 4),
xe = new D(La, 'GestureNone', 5);
La.className = 'ToolManager';
La.WheelScroll = te;
La.WheelZoom = se;
La.WheelNone = Ae;
La.GestureZoom = ve;
La.GestureCancel = we;
La.GestureNone = xe;
function Be() {
ke.call(this);
this.name = 'Dragging';
this.u = this.ww = this.nb = !0;
this.m = this.Ga = this.W = this.Ce = null;
this.Gm = this.Db = !1;
this.il = new I(NaN, NaN);
this.br = new I();
this.cb = !0;
this.wk = 100;
this.tg = [];
this.le = new G().freeze();
this.ga = new Ce();
this.hn = null;
this.F = 'copy';
this.Hc = '';
this.Ic = 'no-drop';
}
var De;
la(Be, ke);
Be.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.wk)))
? !1
: null !== this.findDraggablePart();
};
Be.prototype.findDraggablePart = function() {
var a = this.diagram;
a = a.wl(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;
};
Be.prototype.standardMouseSelect = function() {
var a = this.diagram;
if (a.allowSelect) {
var b = a.wl(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.P('ChangingSelection', a.selection),
(b = a.lastInput),
(Qa ? b.meta : b.control) || b.shift || a.clearSelection(!0),
(this.currentPart.isSelected = !0),
a.P('ChangedSelection', a.selection));
}
}
};
Be.prototype.doActivate = function() {
var a = this.diagram;
this.hn = null;
null === this.currentPart && this.standardMouseSelect();
var b = this.currentPart;
null !== b &&
(b.canMove() || b.canCopy()) &&
(a.lu(!0),
(Ee = null),
(this.isActive = !0),
this.il.set(a.position),
Fe(this, a.selection),
(this.tg.length = 0),
a.animationManager.wc(),
(this.draggedParts = this.computeEffectiveCollection(
a.selection,
this.dragOptions,
)),
(this.ww = this.diagram.layout.isRealtime),
(this.diagram.layout.isRealtime = !1),
(a.os = !0),
!0 === a.Ge('temporaryPixelRatio') && 30 < a.Ew && Ge(a),
He(a, this.draggedParts),
this.Da('Drag'),
(this.startPoint = a.firstInput.documentPoint),
(a.isMouseCaptured = !0),
a.allowDragOut &&
((this.isDragOutStarted = !0),
(this.Gm = !1),
(Ee = this),
(Ie = this.diagram),
this.doSimulatedDragOut()));
};
function Fe(a, b) {
if (a.dragsLink) {
var c = a.diagram;
c.allowRelink &&
(c.model.Nj() && 1 === b.count && b.first() instanceof T
? ((a.draggedLink = b.first()),
a.draggedLink.canRelinkFrom() &&
a.draggedLink.canRelinkTo() &&
a.draggedLink.zj(),
(a.Ce = c.toolManager.findTool('Relinking')),
null === a.Ce && ((a.Ce = new Se()), (a.Ce.diagram = c)),
(a.Ce.originalLink = a.draggedLink))
: ((a.draggedLink = null), (a.Ce = null)));
}
}
Be.prototype.computeEffectiveCollection = function(a, b) {
return this.diagram.commandHandler.computeEffectiveCollection(a, b);
};
Be.prototype.Fd = function(a) {
return void 0 === a
? new Te(qb)
: this.isGridSnapEnabled
? new Te(new I(Math.round(1e3 * a.x) / 1e3, Math.round(1e3 * a.y) / 1e3))
: new Te(a.copy());
};
Be.prototype.doDeactivate = function() {
this.isActive = !1;
var a = this.diagram;
this.diagram.layout.isRealtime = this.ww;
a.lu(!1);
a.lg();
Ue(this);
Ve(a, this.draggedParts);
this.draggedParts = this.currentPart = this.hn = null;
this.Gm = this.isDragOutStarted = !1;
if (0 < De.count) {
for (var b = De, c = b.length, d = 0; d < c; d++) {
var e = b.K(d);
We(e);
Xe(e);
Ue(e);
e.diagram.lg();
}
b.clear();
}
We(this);
this.il.h(NaN, NaN);
null !== Ie && (Ie.currentCursor = '');
Ee = Ie = null;
Xe(this);
a.isMouseCaptured = !1;
a.currentCursor = '';
a.os = !1;
this.stopTransaction();
Ye(a, !0);
};
Be.prototype.stopTransaction = function() {
var a = this.diagram,
b = ke.prototype.stopTransaction.call(this);
b &&
null !== a.undoManager.transactionToUndo &&
a.undoManager.transactionToUndo.Vj();
return b;
};
function Ue(a) {
var b = a.diagram,
c = b.skipsUndoManager;
b.skipsUndoManager = !0;
Ze(a, b.lastInput, null);
b.skipsUndoManager = c;
a.tg.length = 0;
}
function $e() {
var a = Ee;
Xe(a);
af(a);
var b = a.diagram;
a.il.v() && (b.position = a.il);
b.lg();
}
Be.prototype.doCancel = function() {
Xe(this);
af(this);
var a = this.diagram;
this.il.v() && (a.position = this.il);
this.stopTool();
};
Be.prototype.doKeyDown = function() {
var a = this.diagram,
b = a.lastInput;
this.isActive &&
('Esc' === b.key
? this.doCancel()
: b.key !== a.previousInput.key && this.doMouseMove());
};
Be.prototype.doKeyUp = function() {
this.isActive && this.doMouseMove();
};
function bf(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.Bf(), c.Da('Drag'))
: af(a);
c.skipsUndoManager = !b;
c.partManager.addsToTemporaryLayer = !b;
a.startPoint = c.firstInput.documentPoint;
b = a.copiesEffectiveCollection ? a.draggedParts.Cf() : c.selection;
b = c.Ej(b, c, !0);
c = new pb();
for (d = a.draggedParts.iterator; d.next(); ) {
var e = d.key;
if (e.Tc() && e.canCopy()) {
var f = b.I(e);
null !== f &&
((f.location = e.location), f.Za(), c.add(f, a.Fd(f.location)));
}
}
for (b = b.iterator; b.next(); )
(d = b.value), d instanceof T && d.canCopy() && c.add(d, a.Fd());
a.copiedParts = c;
Fe(a, c.Cf());
null !== a.draggedLink &&
((c = a.draggedLink),
(b = c.routeBounds),
cf(
c,
a.startPoint.x - (b.x + b.width / 2),
a.startPoint.y - (b.y + b.height / 2),
));
a.doUpdateCursor(null, !0);
}
}
}
function Xe(a) {
var b = a.diagram;
if (null !== a.copiedParts) {
b.hs(a.copiedParts.Cf(), !1);
a.copiedParts = null;
if (null !== a.draggedParts)
for (var c = a.draggedParts.iterator; c.next(); )
c.key instanceof T && (c.value.point = new I(0, 0));
a.doUpdateCursor(null, !0);
}
b.skipsUndoManager = !1;
b.partManager.addsToTemporaryLayer = !1;
a.startPoint = b.firstInput.documentPoint;
}
function We(a) {
if (null !== a.draggedLink) {
if (a.dragsLink && null !== a.Ce) {
var b = a.Ce;
b.diagram.remove(b.temporaryFromNode);
b.diagram.remove(b.temporaryToNode);
a.Ce.originalLink = null;
}
a.draggedLink = null;
a.Ce = null;
}
}
function df(a, b, c) {
var d = a.diagram,
e = a.startPoint,
f = I.alloc();
f.assign(d.lastInput.documentPoint);
a.moveParts(b, f.je(e), c);
I.free(f);
!0 === d.Ge('temporaryPixelRatio') &&
null === d.Rh &&
30 < d.Ew &&
(Ge(d), d.Jo());
}
Be.prototype.moveParts = function(a, b, c) {
void 0 === c && (c = !1);
var d = this.diagram;
null !== d && ef(d, a, b, this.dragOptions, c);
};
function af(a) {
if (null !== a.draggedParts) {
for (var b = a.diagram, c = a.draggedParts.iterator; c.next(); ) {
var d = c.key;
d.Tc() && (d.location = c.value.point);
}
for (c = a.draggedParts.iterator; c.next(); )
if (((d = c.key), d instanceof T && d.suspendsRouting)) {
var e = c.value.point;
a.draggedParts.add(d, a.Fd());
cf(d, -e.x, -e.y);
}
b.nd();
}
}
function ff(a, b) {
var c = a.diagram;
a.dragsLink &&
(null !== a.draggedLink &&
((a.draggedLink.fromNode = null), (a.draggedLink.toNode = null)),
pf(a, !1));
var d = a.findDragOverObject(b),
e = c.lastInput;
e.targetObject = d;
a.doUpdateCursor(d, !1);
var f = c.skipsUndoManager,
g = !1;
try {
c.skipsUndoManager = !0;
g = Ze(a, e, d);
if (!a.isActive && null === Ee) return;
var h = null !== d ? d.part : null;
if (
null === h ||
(c.handlesDragDropForTopLevelParts &&
h.isTopLevel &&
!(h instanceof qf))
) {
var k = c.mouseDragOver;
null !== k && (k(e), (g = !0));
}
if (!a.isActive && null === Ee) return;
a.doDragOver(b, d);
if (!a.isActive && null === Ee) return;
} finally {
(c.skipsUndoManager = f), g && c.nd();
}
a.hn = d;
c.isReadOnly ||
(!c.allowMove && !c.allowCopy) ||
(!c.allowHorizontalScroll && !c.allowVerticalScroll) ||
c.Fr(e.viewPoint);
}
Be.prototype.findDragOverObject = function(a) {
var b = this;
return rf(this.diagram, a, null, function(a) {
null === a
? (a = !0)
: ((a = a.part),
(a =
null === a ||
a instanceof ue ||
a.layer.isTemporary ||
(b.draggedParts && b.draggedParts.contains(a)) ||
(b.copiedParts && b.copiedParts.contains(a))
? !0
: !1));
return !a;
});
};
Be.prototype.doUpdateCursor = function(a, b) {
var c = this.diagram;
if (b || this.hn !== a)
!this.diagram.currentTool.isActive || this.mayCopy()
? (c.currentCursor = this.copyCursor)
: this.mayMove()
? (c.currentCursor = this.moveCursor)
: this.mayDragOut() && (c.currentCursor = this.nodropCursor);
};
function Ze(a, b, c) {
var d = !1,
e = a.tg.length,
f = 0 < e ? a.tg[0] : null;
if (c === f) return !1;
b.handled = !1;
for (var g = 0; g < e; g++) {
var h = a.tg[g],
k = h.mouseDragLeave;
if (null !== k && (k(b, h, c), (d = !0), b.handled)) break;
}
a.tg.length = 0;
if ((!a.isActive && null === Ee) || null === c) return d;
b.handled = !1;
for (e = c; null !== e; ) a.tg.push(e), (e = sf(e));
e = a.tg.length;
for (
c = 0;
c < e &&
((g = a.tg[c]),
(h = g.mouseDragEnter),
null === h || (h(b, g, f), (d = !0), !b.handled));
c++
);
return d;
}
function sf(a) {
var b = a.panel;
return null !== b
? b
: a instanceof U &&
!(a instanceof qf) &&
((a = a.containingGroup), null !== a && a.handlesDragDropForMembers)
? a
: null;
}
function tf(a, b, c) {
var d = a.Ce;
if (null === d) return null;
var e = a.diagram.hg(b, d.portGravity, function(a) {
return d.findValidLinkablePort(a, c);
});
a = I.alloc();
var f = Infinity,
g = null;
for (e = e.iterator; e.next(); ) {
var h = e.value;
if (null !== h.part) {
var k = h.ia(yc, a);
k = b.rf(k);
k < f && ((g = h), (f = k));
}
}
I.free(a);
return g;
}
function pf(a, b) {
var c = a.draggedLink;
if (null !== c && !(2 > c.pointsCount)) {
var d = a.diagram;
if (!d.isReadOnly) {
var e = a.Ce;
if (null !== e) {
var f = null,
g = null;
null === c.fromNode &&
((f = tf(a, c.i(0), !1)), null !== f && (g = f.part));
var h = null,
k = null;
null === c.toNode &&
((h = tf(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.P('LinkRelinked', c, d.tx),
c.toPort !== d.ux && d.P('LinkRelinked', c, d.ux))
: uf(e, g, f, k, h)
: uf(e, null, null, null, null);
}
}
}
}
Be.prototype.doDragOver = function() {};
function vf(a, b) {
var c = a.diagram;
a.dragsLink && pf(a, !0);
Ue(a);
var d = a.findDragOverObject(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;
wf(a, e, f);
f = sf(f);
}
} else (f = c.mouseDrop), null !== f && f(e);
if (a.isActive || null !== Ee) {
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 !== Ee) {
a = M.alloc();
for (b = c.selection.iterator; b.next(); )
(d = b.value), d instanceof V && xf(c, d, a);
M.free(a);
}
}
}
function wf(a, b, c) {
a = a.diagram;
c = c.part;
!a.handlesDragDropForTopLevelParts ||
!c.isTopLevel ||
c instanceof qf ||
((c = a.mouseDrop), null !== c && c(b));
}
function xf(a, b, c) {
var d = !1;
b.getAvoidableRect(c);
a.viewportBounds.Ee(c) && (d = !0);
a = a.zu(
c,
function(a) {
return a.part;
},
function(a) {
return a instanceof T;
},
!0,
function(a) {
return a instanceof T;
},
d,
);
if (0 !== a.count)
for (a = a.iterator; a.next(); )
(c = a.value), !c.Md(b) && c.isAvoiding && c.ab();
}
Be.prototype.doDropOnto = function() {};
Be.prototype.doMouseMove = function() {
if (this.isActive) {
var a = this.diagram,
b = a.lastInput;
this.simulatedMouseMove(b.event, b.documentPoint, b.targetDiagram) ||
null === this.currentPart ||
null === this.draggedParts ||
(this.mayCopy()
? (bf(this, !1),
He(a, this.copiedParts),
df(this, this.copiedParts, !1),
Ve(a, this.copiedParts))
: this.mayMove()
? (Xe(this), df(this, this.draggedParts, !0))
: this.mayDragOut()
? (bf(this, !1), df(this, this.copiedParts, !1))
: Xe(this),
ff(this, a.lastInput.documentPoint));
}
};
Be.prototype.doMouseUp = function() {
if (this.isActive) {
var a = this.diagram,
b = a.lastInput;
if (!this.simulatedMouseUp(b.event, b.documentPoint, b.targetDiagram)) {
b = !1;
var c = this.mayCopy();
c && null !== this.copiedParts
? (Xe(this),
bf(this, !0),
He(a, this.copiedParts),
df(this, this.copiedParts, !1),
Ve(a, this.copiedParts),
null !== this.copiedParts &&
(a.P('ChangingSelection', a.selection),
a.clearSelection(!0),
this.copiedParts.iteratorKeys.each(function(a) {
a.isSelected = !0;
})))
: ((b = !0),
Xe(this),
this.mayMove() &&
(df(this, this.draggedParts, !0),
ff(this, a.lastInput.documentPoint)));
this.Gm = !0;
vf(this, a.lastInput.documentPoint);
if (this.isActive) {
var d = c ? this.copiedParts.Cf() : this.draggedParts.Cf();
this.copiedParts = null;
b && yf(this);
a.Va();
Ve(a, this.draggedParts);
this.transactionResult = c ? 'Copy' : 'Move';
a.P(c ? 'SelectionCopied' : 'SelectionMoved', d);
}
this.stopTool();
c && a.P('ChangedSelection', a.selection);
}
}
};
Be.prototype.simulatedMouseMove = function(a, b, c) {
if (null === Ee) return !1;
var d = Ee.diagram;
c instanceof Q || (c = null);
var e = Ie;
c !== e &&
(null !== e &&
e !== d &&
(e.lg(),
(Ee.isDragOutStarted = !1),
(e = e.toolManager.findTool('Dragging')),
null !== e && e.doSimulatedDragLeave()),
(Ie = c),
null !== c &&
c !== d &&
($e(),
(e = c.toolManager.findTool('Dragging')),
null !== e && (De.contains(e) || De.add(e), e.doSimulatedDragEnter())),
this.doUpdateCursor(null, !0));
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))),
(c.lastInput.documentPoint = b),
(c.lastInput.viewPoint = c.Ro(b)),
(c.lastInput.down = !1),
(c.lastInput.up = !1),
d.doSimulatedDragOver());
return !0;
};
Be.prototype.simulatedMouseUp = function(a, b, c) {
if (null === Ee) return !1;
var d = Ie,
e = Ee.diagram;
if (null === c) return Ee.doCancel(), !0;
if (c !== d) {
var f = d.toolManager.findTool('Dragging');
if (null !== d && d !== e && null !== f)
return d.lg(), (Ee.isDragOutStarted = !1), f.doSimulatedDragLeave(), !1;
Ie = c;
d = c.toolManager.findTool('Dragging');
null !== d &&
($e(), De.contains(d) || De.add(d), d.doSimulatedDragEnter());
}
return c !== this.diagram
? (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 I()),
(c.lastInput.documentPoint = b),
(c.lastInput.viewPoint = c.Ro(b)),
(c.lastInput.down = !1),
(c.lastInput.up = !0),
(a = c.toolManager.findTool('Dragging')),
null !== a && a.doSimulatedDrop(),
(a = Ee),
null !== a &&
((c = a.mayCopy()),
(a.transactionResult = c ? 'Copy' : 'Move'),
a.stopTool()),
!0)
: !1;
};
function yf(a) {
if (null !== a.draggedParts)
for (var b = a.draggedParts.iterator; b.next(); ) {
var c = b.key;
c instanceof V &&
((c = c.containingGroup),
null === c ||
null === c.placeholder ||
a.draggedParts.contains(c) ||
c.placeholder.w());
}
}
Be.prototype.mayCopy = function() {
if (!this.isCopyEnabled) return !1;
var a = this.diagram;
if (
a.isReadOnly ||
a.isModelReadOnly ||
!a.allowInsert ||
!a.allowCopy ||
(Qa ? !a.lastInput.alt : !a.lastInput.control)
)
return !1;
for (a = a.selection.iterator; a.next(); ) if (a.value.canCopy()) return !0;
return null !== this.draggedLink &&
this.dragsLink &&
this.draggedLink.canCopy()
? !0
: !1;
};
Be.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(); ) if (a.value.canCopy()) return !0;
return null !== this.draggedLink &&
this.dragsLink &&
this.draggedLink.canCopy()
? !0
: !1;
};
Be.prototype.mayMove = function() {
var a = this.diagram;
if (a.isReadOnly || !a.allowMove) return !1;
for (a = a.selection.iterator; a.next(); ) if (a.value.canMove()) return !0;
return null !== this.draggedLink &&
this.dragsLink &&
this.draggedLink.canMove()
? !0
: !1;
};
Be.prototype.computeBorder = function(a, b, c) {
return this.Gm ||
null === this.draggedParts ||
this.draggedParts.contains(a)
? null
: c.assign(b);
};
Be.prototype.hz = function() {
return Ee;
};
Be.prototype.mayDragIn = function() {
var a = this.diagram;
if (!a.allowDrop || a.isReadOnly || a.isModelReadOnly || !a.allowInsert)
return !1;
var b = Ee;
return null === b || b.diagram.model.dataFormat !== a.model.dataFormat
? !1
: !0;
};
Be.prototype.doSimulatedDragEnter = function() {
if (this.mayDragIn()) {
var a = this.diagram;
a.animationManager.wc();
zf(a);
a.animationManager.wc();
a = Ee;
null !== a && (a.diagram.os = !1);
this.doUpdateCursor(null, !0);
}
};
Be.prototype.doSimulatedDragLeave = function() {
var a = Ee;
null !== a && a.doSimulatedDragOut();
this.doCancel();
};
Be.prototype.doSimulatedDragOver = function() {
var a = this.diagram;
a.animationManager.lm = !0;
var b = Ee;
if (null !== b && null !== b.draggedParts) {
if (!this.mayDragIn()) return;
Af(this, b.draggedParts.Cf(), !1, a.firstInput);
df(this, this.copiedParts, !1);
ff(this, a.lastInput.documentPoint);
}
a.animationManager.lm = !1;
};
Be.prototype.doSimulatedDrop = function() {
var a = this.diagram,
b = Ee;
if (null !== b) {
var c = b.diagram;
b.Gm = !0;
Xe(this);
if (!this.mayDragIn()) return;
a.animationManager.lm = !0;
a.P('ChangingSelection', a.selection);
this.Da('Drop');
Af(this, b.draggedParts.Cf(), !0, a.lastInput);
df(this, this.copiedParts, !1);
null !== this.copiedParts &&
(a.clearSelection(!0),
this.copiedParts.iteratorKeys.each(function(a) {
a.isSelected = !0;
}));
vf(this, a.lastInput.documentPoint);
a.Va();
b = a.selection;
null !== this.copiedParts
? (this.transactionResult = 'ExternalCopy')
: (b = new G());
this.copiedParts = null;
a.doFocus();
a.P('ExternalObjectsDropped', b, c);
this.stopTransaction();
a.P('ChangedSelection', a.selection);
}
a.animationManager.lm = !1;
};
function Af(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.Ej(b, e, !0);
var f = M.alloc();
e = d = Infinity;
for (var g = -Infinity, h = -Infinity, k = b.iterator; k.next(); ) {
var l = k.value;
if (l.isVisible()) {
var m = l.location;
l = m.x;
m = m.y;
isNaN(l) ||
isNaN(m) ||
(l < d && (d = l),
m < e && (e = m),
l > g && (g = l),
m > h && (h = m));
}
}
Infinity === d ? f.h(0, 0, 0, 0) : f.h(d, e, g - d, h - e);
d = f.x + f.width / 2;
e = f.y + f.height / 2;
M.free(f);
f = a.br;
g = new pb();
h = I.alloc();
for (k = b.iterator; k.next(); )
(l = k.value),
l instanceof T &&
l.canCopy() &&
((m = c.I(l)),
null !== m &&
((m.points = l.points),
cf(m, f.x - d, f.y - e),
(m.suspendsRouting = !0),
g.add(m, a.Fd())));
for (b = b.iterator; b.next(); )
(l = b.value),
l.Tc() &&
l.canCopy() &&
((k = c.I(l)),
null !== k &&
((l = l.location),
h.h(f.x - (d - l.x), f.y - (e - l.y)),
(k.location = h),
k.Za(),
g.add(k, a.Fd(h))));
I.free(h);
a.copiedParts = g;
Fe(a, g.Cf());
null !== a.draggedLink &&
((c = a.draggedLink),
(b = c.routeBounds),
cf(
c,
a.startPoint.x - (b.x + b.width / 2),
a.startPoint.y - (b.y + b.height / 2),
));
a.doUpdateCursor(null, !0);
}
}
}
Be.prototype.doSimulatedDragOut = function() {
var a = this.diagram;
a.os = !1;
this.mayCopy() || this.mayMove()
? (a.currentCursor = '')
: (a.currentCursor = this.nodropCursor);
this.hn = null;
};
Be.prototype.computeMove = function(a, b, c, d) {
c = this.diagram;
return null !== c ? c.computeMove(a, b, this.dragOptions, d) : new I();
};
ma.Object.defineProperties(Be.prototype, {
isCopyEnabled: {
get: function() {
return this.nb;
},
set: function(a) {
this.nb = a;
},
},
copiesEffectiveCollection: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
dragOptions: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
isGridSnapEnabled: {
get: function() {
return this.dragOptions.isGridSnapEnabled;
},
set: function(a) {
this.dragOptions.isGridSnapEnabled = a;
},
},
isComplexRoutingRealtime: {
get: function() {
return this.cb;
},
set: function(a) {
this.cb = 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) {
this.dragOptions.gridSnapCellSize.C(a) ||
((a = a.J()), (this.dragOptions.gridSnapCellSize = a));
},
},
gridSnapCellSpot: {
get: function() {
return this.dragOptions.gridSnapCellSpot;
},
set: function(a) {
this.dragOptions.gridSnapCellSpot.C(a) ||
((a = a.J()), (this.dragOptions.gridSnapCellSpot = a));
},
},
gridSnapOrigin: {
get: function() {
return this.dragOptions.gridSnapOrigin;
},
set: function(a) {
this.dragOptions.gridSnapOrigin.C(a) ||
((a = a.J()), (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;
},
},
copyCursor: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
moveCursor: {
get: function() {
return this.Hc;
},
set: function(a) {
this.Hc = a;
},
},
nodropCursor: {
get: function() {
return this.Ic;
},
set: function(a) {
this.Ic = a;
},
},
currentPart: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
copiedParts: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
draggedParts: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga = a;
},
},
draggingParts: {
get: function() {
return null !== this.copiedParts
? this.copiedParts.Cf()
: null !== this.draggedParts
? this.draggedParts.Cf()
: this.le;
},
},
draggedLink: {
get: function() {
return this.diagram.draggedLink;
},
set: function(a) {
this.diagram.draggedLink = a;
},
},
isDragOutStarted: {
get: function() {
return this.Db;
},
set: function(a) {
this.Db = a;
},
},
startPoint: {
get: function() {
return this.br;
},
set: function(a) {
this.br.C(a) || this.br.assign(a);
},
},
delay: {
get: function() {
return this.wk;
},
set: function(a) {
this.wk = a;
},
},
});
Be.prototype.getDraggingSource = Be.prototype.hz;
var Ee = null,
Ie = null;
Be.className = 'DraggingTool';
De = new E();
Ka(
'draggingTool',
function() {
return this.findTool('Dragging');
},
function(a) {
this.gb('Dragging', a, this.mouseMoveTools);
},
);
La.prototype.doCancel = function() {
null !== Ee && Ee.doCancel();
ke.prototype.doCancel.call(this);
};
function Bf() {
ke.call(this);
this.le = 100;
this.Ga = !1;
this.u = 'pointer';
var a = new T(),
b = new Cf();
b.isPanelMain = !0;
b.stroke = 'blue';
a.add(b);
b = new Cf();
b.toArrow = 'Standard';
b.fill = 'blue';
b.stroke = 'blue';
a.add(b);
a.layerName = 'Tool';
this.vi = a;
a = new V();
b = new Cf();
b.portId = '';
b.figure = 'Rectangle';
b.fill = null;
b.stroke = 'magenta';
b.strokeWidth = 2;
b.desiredSize = Eb;
a.add(b);
a.selectable = !1;
a.layerName = 'Tool';
this.ui = a;
this.j = b;
a = new V();
b = new Cf();
b.portId = '';
b.figure = 'Rectangle';
b.fill = null;
b.stroke = 'magenta';
b.strokeWidth = 2;
b.desiredSize = Eb;
a.add(b);
a.selectable = !1;
a.layerName = 'Tool';
this.wi = a;
this.m = b;
this.Ic = this.Hc = this.nb = this.cb = this.Db = null;
this.ga = !0;
this.Wo = new pb();
this.Ff = this.bj = this.Gf = null;
}
la(Bf, ke);
Bf.prototype.doStop = function() {
this.diagram.lg();
this.originalToPort = this.originalToNode = this.originalFromPort = this.originalFromNode = this.originalLink = null;
this.validPortsCache.clear();
this.targetPort = null;
};
Bf.prototype.copyPortProperties = function(a, b, c, d, e) {
if (null !== a && null !== b && null !== c && null !== d) {
var f = b.uf(),
g = K.alloc();
g.width = b.naturalBounds.width * f;
g.height = b.naturalBounds.height * f;
d.desiredSize = g;
K.free(g);
e
? ((d.toSpot = b.toSpot), (d.toEndSegmentLength = b.toEndSegmentLength))
: ((d.fromSpot = b.fromSpot),
(d.fromEndSegmentLength = b.fromEndSegmentLength));
c.locationSpot = yc;
f = I.alloc();
c.location = b.ia(yc, f);
I.free(f);
d.angle = b.fi();
null !== this.portTargeted && this.portTargeted(a, b, c, d, e);
}
};
Bf.prototype.setNoTargetPortProperties = function(a, b, c) {
null !== b && ((b.desiredSize = Eb), (b.fromSpot = sc), (b.toSpot = sc));
null !== a && (a.location = this.diagram.lastInput.documentPoint);
null !== this.portTargeted && this.portTargeted(null, null, a, b, c);
};
Bf.prototype.doMouseDown = function() {
this.isActive && this.doMouseMove();
};
Bf.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.Fr(a.lastInput.viewPoint);
}
};
Bf.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;
};
Bf.prototype.findTargetPort = function(a) {
var b = this.diagram,
c = b.lastInput.documentPoint,
d = this.portGravity;
0 >= d && (d = 0.1);
var e = this,
f = b.hg(
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.ia(yc, I.alloc()),
l = c.x - k.x,
m = c.y - k.y;
I.free(k);
k = l * l + m * m;
k < d &&
((l = this.validPortsCache.I(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;
};
Bf.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.ro(b).count >= c) return !1;
}
return !0;
};
Bf.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.Kd(b).count >= c) return !1;
}
return !0;
};
Bf.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;
};
Bf.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.Kd(b); b.next(); )
if (((d = b.value), d.fromNode === c && d.fromPortId === a)) return !0;
return !1;
};
Bf.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;
};
Bf.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 G();
d.add(a);
return Df(this, c, b, d);
};
function Df(a, b, c, d) {
if (b === c) return !0;
var e = b.fromNode;
if (null !== e && e.isLinkLabel && (d.add(e), Df(a, e.labeledLink, c, d)))
return !0;
b = b.toNode;
return null !== b && b.isLinkLabel && (d.add(b), Df(a, b.labeledLink, c, d))
? !0
: !1;
}
Bf.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 !== Ef) {
if (d === Ff) {
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 !Gf(this, a, b, c, !0);
}
if (d === Hf) {
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 !Gf(this, a, b, c, !0);
}
if (d === If)
return (
a === b
? (a = !0)
: ((d = new G()), d.add(b), (a = Jf(this, d, a, b, c))),
!a
);
if (d === Kf) return !Gf(this, a, b, c, !1);
if (d === Lf)
return (
a === b
? (a = !0)
: ((d = new G()), d.add(b), (a = Tf(this, d, a, b, c))),
!a
);
}
return !0;
};
function Gf(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 && Gf(a, g, c, d, e))
)
return !0;
}
return !1;
}
function Jf(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 && Jf(a, b, g, d, e))
)
return !0;
}
return !1;
}
function Tf(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 && Tf(a, b, h, d, e)) return !0;
}
}
return !1;
}
ma.Object.defineProperties(Bf.prototype, {
portGravity: {
get: function() {
return this.le;
},
set: function(a) {
0 <= a && (this.le = a);
},
},
isUnconnectedLinkValid: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga = a;
},
},
linkingCursor: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
temporaryLink: {
get: function() {
return this.vi;
},
set: function(a) {
this.vi = a;
},
},
temporaryFromNode: {
get: function() {
return this.ui;
},
set: function(a) {
if ((this.ui = a)) this.j = a.port;
},
},
temporaryFromPort: {
get: function() {
return this.j;
},
set: function(a) {
if (null !== this.j) {
var b = this.j.panel;
if (null !== b) {
var c = b.R.indexOf(this.j);
b.mb(c);
b.Cb(c, a);
}
}
this.j = a;
},
},
temporaryToNode: {
get: function() {
return this.wi;
},
set: function(a) {
if ((this.wi = a)) this.m = a.port;
},
},
temporaryToPort: {
get: function() {
return this.m;
},
set: function(a) {
if (null !== this.m) {
var b = this.m.panel;
if (null !== b) {
var c = b.R.indexOf(this.m);
b.mb(c);
b.Cb(c, a);
}
}
this.m = a;
},
},
originalLink: {
get: function() {
return this.Db;
},
set: function(a) {
this.Db = a;
},
},
originalFromNode: {
get: function() {
return this.cb;
},
set: function(a) {
this.cb = a;
},
},
originalFromPort: {
get: function() {
return this.nb;
},
set: function(a) {
this.nb = a;
},
},
originalToNode: {
get: function() {
return this.Hc;
},
set: function(a) {
this.Hc = a;
},
},
originalToPort: {
get: function() {
return this.Ic;
},
set: function(a) {
this.Ic = a;
},
},
isForwards: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
validPortsCache: {
get: function() {
return this.Wo;
},
},
targetPort: {
get: function() {
return this.Gf;
},
set: function(a) {
this.Gf = a;
},
},
linkValidation: {
get: function() {
return this.bj;
},
set: function(a) {
this.bj = a;
},
},
portTargeted: {
get: function() {
return this.Ff;
},
set: function(a) {
this.Ff = a;
},
},
});
Bf.className = 'LinkingBaseTool';
function Uf() {
Bf.call(this);
this.name = 'Linking';
this.W = {};
this.F = null;
this.L = Vf;
this.Qd = null;
}
la(Uf, Bf);
Uf.prototype.canStart = function() {
if (!this.isEnabled) return !1;
var a = this.diagram;
return a.isReadOnly ||
a.isModelReadOnly ||
!a.allowLink ||
!a.model.Vr() ||
!a.lastInput.left ||
(a.currentTool !== this && !this.isBeyondDragSize())
? !1
: null !== this.findLinkablePort();
};
Uf.prototype.findLinkablePort = function() {
var a = this.diagram,
b = this.startObject;
null === b && (b = a.ec(a.firstInput.documentPoint, null, null));
if (null === b) return null;
a = b.part;
if (!(a instanceof V)) return null;
var c = this.direction;
if (c === Vf || c === Wf) {
var d = this.findValidLinkablePort(b, !1);
if (
null !== d ||
(this.startObject === a &&
((d = a.port), this.findValidLinkablePort(d, !1)))
)
return (this.isForwards = !0), d;
}
if (c === Vf || c === Xf)
if (
((b = this.findValidLinkablePort(b, !0)),
null !== b ||
(this.startObject === a &&
((b = a.port), this.findValidLinkablePort(b, !0))))
)
return (this.isForwards = !1), b;
return null;
};
Uf.prototype.doActivate = function() {
var a = this.diagram,
b = this.findLinkablePort();
null === b
? this.stopTool()
: (this.Da(this.name),
(a.isMouseCaptured = !0),
(a.currentCursor = this.linkingCursor),
this.isForwards
? (null === this.temporaryToNode ||
this.temporaryToNode.location.v() ||
(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.v() ||
(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.ab(),
a.add(this.temporaryLink)),
(this.isActive = !0));
};
Uf.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.stopTransaction();
};
Uf.prototype.doStop = function() {
Bf.prototype.doStop.call(this);
this.startObject = null;
};
Uf.prototype.doMouseUp = function() {
if (this.isActive) {
var a = this.diagram,
b = (this.transactionResult = null),
c = null,
d = null,
e = null,
f = null;
try {
var g = (this.targetPort = this.findTargetPort(this.isForwards));
if (null !== g) {
var h = g.part;
h instanceof V &&
(this.isForwards
? (null !== this.originalFromNode &&
((b = this.originalFromNode), (c = this.originalFromPort)),
(d = h),
(e = g))
: ((b = h),
(c = g),
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
? ((f = this.insertLink(b, c, d, e)),
null !== f
? (null === g &&
(this.isForwards
? (f.defaultToPoint = a.lastInput.documentPoint)
: (f.defaultFromPoint = a.lastInput.documentPoint)),
a.allowSelect &&
(a.P('ChangingSelection', a.selection),
a.clearSelection(!0),
(f.isSelected = !0)),
(this.transactionResult = this.name),
a.P('LinkDrawn', f))
: this.doNoLink(b, c, d, e))
: this.isForwards
? this.doNoLink(
this.originalFromNode,
this.originalFromPort,
null,
null,
)
: this.doNoLink(null, null, this.originalToNode, this.originalToPort);
} finally {
this.stopTool(),
f && a.allowSelect && a.P('ChangedSelection', a.selection);
}
}
};
Uf.prototype.isNewTreeLink = function() {
var a = this.archetypeLinkData;
if (null === a) return !0;
if (a instanceof T) 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;
};
Uf.prototype.insertLink = function(a, b, c, d) {
return this.diagram.partManager.insertLink(a, b, c, d);
};
Uf.prototype.doNoLink = function() {};
ma.Object.defineProperties(Uf.prototype, {
archetypeLinkData: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
archetypeLabelNodeData: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
direction: {
get: function() {
return this.L;
},
set: function(a) {
this.L = a;
},
},
startObject: {
get: function() {
return this.Qd;
},
set: function(a) {
this.Qd = a;
},
},
});
var Vf = new D(Uf, 'Either', 0),
Wf = new D(Uf, 'ForwardsOnly', 0),
Xf = new D(Uf, 'BackwardsOnly', 0);
Uf.className = 'LinkingTool';
Uf.Either = Vf;
Uf.ForwardsOnly = Wf;
Uf.BackwardsOnly = Xf;
function Se() {
Bf.call(this);
this.name = 'Relinking';
var a = new Cf();
a.figure = 'Diamond';
a.desiredSize = Jb;
a.fill = 'lightblue';
a.stroke = 'dodgerblue';
a.cursor = this.linkingCursor;
a.segmentIndex = 0;
this.W = a;
a = new Cf();
a.figure = 'Diamond';
a.desiredSize = Jb;
a.fill = 'lightblue';
a.stroke = 'dodgerblue';
a.cursor = this.linkingCursor;
a.segmentIndex = -1;
this.Qd = a;
this.F = null;
this.iw = new M();
}
la(Se, Bf);
Se.prototype.updateAdornments = function(a) {
if (null !== a && a instanceof T) {
var b = 'RelinkFrom',
c = null;
if (a.isSelected && !this.diagram.isReadOnly) {
var d = a.selectionObject;
null !== d &&
a.canRelinkFrom() &&
a.actualBounds.v() &&
a.isVisible() &&
d.actualBounds.v() &&
d.zf() &&
((c = a.Hj(b)),
null === c && ((c = this.makeAdornment(d, !1)), a.Tg(b, c)));
}
null === c && a.Af(b);
b = 'RelinkTo';
c = null;
a.isSelected &&
!this.diagram.isReadOnly &&
((d = a.selectionObject),
null !== d &&
a.canRelinkTo() &&
a.actualBounds.v() &&
a.isVisible() &&
d.actualBounds.v() &&
d.zf() &&
((c = a.Hj(b)),
null === c ? ((c = this.makeAdornment(d, !0)), a.Tg(b, c)) : c.w()));
null === c && a.Af(b);
}
};
Se.prototype.makeAdornment = function(a, b) {
var c = new ue();
c.type = W.Link;
b = b ? this.toHandleArchetype : this.fromHandleArchetype;
null !== b && c.add(b.copy());
c.adornedObject = a;
return c;
};
Se.prototype.canStart = function() {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (
a.isReadOnly ||
a.isModelReadOnly ||
!a.allowRelink ||
!a.model.Vr() ||
!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;
};
Se.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 ue && c.adornedPart instanceof T)) return;
this.handle = b;
this.isForwards = null === c || 'RelinkTo' === c.category;
this.originalLink = c.adornedPart;
}
this.Da(this.name);
a.isMouseCaptured = !0;
a.currentCursor = this.linkingCursor;
this.originalFromPort = this.originalLink.fromPort;
this.originalFromNode = this.originalLink.fromNode;
this.originalToPort = this.originalLink.toPort;
this.originalToNode = this.originalLink.toNode;
this.iw.set(this.originalLink.actualBounds);
null !== this.originalLink &&
0 < this.originalLink.pointsCount &&
(null === this.originalLink.fromNode &&
(null !== this.temporaryFromPort &&
(this.temporaryFromPort.desiredSize = Db),
null !== this.temporaryFromNode &&
(this.temporaryFromNode.location = this.originalLink.i(0))),
null === this.originalLink.toNode &&
(null !== this.temporaryToPort &&
(this.temporaryToPort.desiredSize = Db),
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.ab(),
a.add(this.temporaryLink));
this.isActive = !0;
};
Se.prototype.copyLinkProperties = function(a, b) {
if (null !== a && null !== b) {
b.adjusting = a.adjusting;
b.corner = a.corner;
var c = a.curve;
if (c === Yf || c === Zf) c = $f;
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;
}
};
Se.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.stopTransaction();
};
Se.prototype.doStop = function() {
Bf.prototype.doStop.call(this);
this.handle = null;
};
Se.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;
try {
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.ab()),
(this.transactionResult = this.name),
a.P(
'LinkRelinked',
f,
this.isForwards ? this.originalToPort : this.originalFromPort,
))
: this.doNoRelink(this.originalLink, this.isForwards);
this.originalLink.Ao(this.iw);
} finally {
this.stopTool();
}
}
};
Se.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;
};
Se.prototype.doNoRelink = function() {};
function uf(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(Se.prototype, {
fromHandleArchetype: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
toHandleArchetype: {
get: function() {
return this.Qd;
},
set: function(a) {
this.Qd = a;
},
},
handle: {
get: function() {
return this.F;
},
set: function(a) {
if (null !== a && !(a.part instanceof ue))
throw Error('new handle is not in an Adornment: ' + a);
this.F = a;
},
},
});
Se.className = 'RelinkingTool';
Ka(
'linkingTool',
function() {
return this.findTool('Linking');
},
function(a) {
this.gb('Linking', a, this.mouseMoveTools);
},
);
Ka(
'relinkingTool',
function() {
return this.findTool('Relinking');
},
function(a) {
this.gb('Relinking', a, this.mouseDownTools);
},
);
function ag() {
ke.call(this);
this.name = 'LinkReshaping';
var a = new Cf();
a.figure = 'Rectangle';
a.desiredSize = Ib;
a.fill = 'lightblue';
a.stroke = 'dodgerblue';
this.m = a;
a = new Cf();
a.figure = 'Diamond';
a.desiredSize = Jb;
a.fill = 'lightblue';
a.stroke = 'dodgerblue';
a.cursor = 'move';
this.u = a;
this.F = 3;
this.vs = this.j = null;
this.jw = new I();
this.xq = new E();
}
la(ag, ke);
ag.prototype.Du = function(a) {
return a && 0 !== a.reshapingBehavior.value ? a.reshapingBehavior : bg;
};
ag.prototype.Wl = function(a, b) {
a.reshapingBehavior = b;
};
ag.prototype.updateAdornments = function(a) {
if (null !== a && a instanceof T) {
var b = null;
if (a.isSelected && !this.diagram.isReadOnly) {
var c = a.path;
null !== c &&
a.canReshape() &&
a.actualBounds.v() &&
a.isVisible() &&
c.actualBounds.v() &&
c.zf() &&
((b = a.Hj(this.name)),
null === b || b.ew !== a.pointsCount || b.yw !== a.resegmentable) &&
((b = this.makeAdornment(c)),
null !== b &&
((b.ew = a.pointsCount),
(b.yw = a.resegmentable),
a.Tg(this.name, b)));
}
null === b && a.Af(this.name);
}
};
ag.prototype.makeAdornment = function(a) {
var b = a.part,
c = b.pointsCount,
d = b.isOrthogonal,
e = null;
if (null !== b.points && 1 < c) {
e = new ue();
e.type = W.Link;
c = b.firstPickIndex;
var f = b.lastPickIndex,
g = d ? 1 : 0;
if (b.resegmentable && b.computeCurve() !== cg)
for (var h = c + g; h < f - g; h++) {
var k = this.makeResegmentHandle(a, h);
null !== k &&
((k.segmentIndex = h),
(k.segmentFraction = 0.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);
J.B(k.x, l.x) && J.B(k.y, l.y) && (l = b.i(c - 1));
J.B(k.x, l.x)
? (this.Wl(h, dg), (h.cursor = 'n-resize'))
: J.B(k.y, l.y) && (this.Wl(h, eg), (h.cursor = 'w-resize'));
} else
g === f - 1 && d
? ((k = b.i(f - 1)),
(l = b.i(f)),
J.B(k.x, l.x) && J.B(k.y, l.y) && (k = b.i(f + 1)),
J.B(k.x, l.x)
? (this.Wl(h, dg), (h.cursor = 'n-resize'))
: J.B(k.y, l.y) &&
(this.Wl(h, eg), (h.cursor = 'w-resize')))
: g !== f && (this.Wl(h, fg), (h.cursor = 'move'));
e.add(h);
}
e.adornedObject = a;
}
return e;
};
ag.prototype.makeHandle = function() {
var a = this.handleArchetype;
return null === a ? null : a.copy();
};
ag.prototype.makeResegmentHandle = function() {
var a = this.midHandleArchetype;
return null === a ? null : a.copy();
};
ag.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;
};
ag.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 T) {
this.vs = b;
a.isMouseCaptured = !0;
this.Da(this.name);
if (b.resegmentable && 999 === this.handle.fromMaxLinks) {
var c = b.points.copy(),
d = this.getResegmentingPoint();
c.Cb(this.handle.segmentIndex + 1, d);
b.isOrthogonal && c.Cb(this.handle.segmentIndex + 1, d);
b.points = c;
b.Rb();
b.updateAdornments();
this.handle = this.findToolHandleAt(
a.firstInput.documentPoint,
this.name,
);
if (null === this.handle) {
this.doDeactivate();
return;
}
}
this.jw = b.i(this.handle.segmentIndex);
this.xq = b.points.copy();
this.isActive = !0;
}
}
};
ag.prototype.doDeactivate = function() {
this.stopTransaction();
this.vs = this.handle = null;
this.isActive = this.diagram.isMouseCaptured = !1;
};
ag.prototype.stopTransaction = function() {
var a = this.diagram,
b = ke.prototype.stopTransaction.call(this);
b &&
null !== a.undoManager.transactionToUndo &&
a.undoManager.transactionToUndo.Vj();
return b;
};
ag.prototype.doCancel = function() {
var a = this.adornedLink;
null !== a && (a.points = this.xq);
this.stopTool();
};
ag.prototype.getResegmentingPoint = function() {
return this.handle.ia(yc);
};
ag.prototype.doMouseMove = function() {
var a = this.diagram;
this.isActive &&
((a = this.computeReshape(a.lastInput.documentPoint)), this.reshape(a));
};
ag.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 &&
(gg(this, g, d, e, f, !0) || gg(this, g, d, e, f, !1))
) {
var h = b.points.copy();
gg(this, g, d, e, f, !0)
? (h.Vc(c - 2, new I(g.x, (f.y + g.y) / 2)),
h.Vc(c + 1, new I(f.x, (f.y + g.y) / 2)))
: (h.Vc(c - 2, new I((f.x + g.x) / 2, g.y)),
h.Vc(c + 1, new I((f.x + g.x) / 2, f.y)));
h.mb(c);
h.mb(c - 1);
b.points = h;
b.Rb();
} else
(g = b.i(c + 2)),
Math.abs(e.x - f.x) < this.resegmentingDistance &&
Math.abs(e.y - f.y) < this.resegmentingDistance &&
(gg(this, d, e, f, g, !0) || gg(this, d, e, f, g, !1)) &&
((h = b.points.copy()),
gg(this, d, e, f, g, !0)
? (h.Vc(c - 1, new I(d.x, (d.y + g.y) / 2)),
h.Vc(c + 2, new I(g.x, (d.y + g.y) / 2)))
: (h.Vc(c - 1, new I((d.x + g.x) / 2, d.y)),
h.Vc(c + 2, new I((d.x + g.x) / 2, g.y))),
h.mb(c + 1),
h.mb(c),
(b.points = h),
b.Rb());
}
} else
(g = I.alloc()),
J.fh(d.x, d.y, f.x, f.y, e.x, e.y, g) &&
g.rf(e) < this.resegmentingDistance * this.resegmentingDistance &&
((d = b.points.copy()), d.mb(c), (b.points = d), b.Rb()),
I.free(g);
}
a.Va();
this.transactionResult = this.name;
a.P('LinkReshaped', this.adornedLink, this.xq);
}
this.stopTool();
};
function gg(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;
}
ag.prototype.reshape = function(a) {
var b = this.adornedLink;
b.jh();
var c = this.handle.segmentIndex,
d = this.Du(this.handle);
if (b.isOrthogonal)
if (c === b.firstPickIndex + 1)
(c = b.firstPickIndex + 1),
d === dg
? (b.M(c, b.i(c - 1).x, a.y), b.M(c + 1, b.i(c + 2).x, a.y))
: d === eg &&
(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 === dg
? (b.M(c - 1, b.i(c - 2).x, a.y), b.M(c, b.i(c + 1).x, a.y))
: d === eg &&
(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);
J.B(f.x, e.x) && J.B(e.y, g.y)
? (J.B(f.x, b.i(d - 2).x) && !J.B(f.y, b.i(d - 2).y)
? (b.l(d, a.x, f.y), c++, d++)
: b.M(d - 1, a.x, f.y),
J.B(g.y, b.i(d + 2).y) && !J.B(g.x, b.i(d + 2).x)
? b.l(d + 1, g.x, a.y)
: b.M(d + 1, g.x, a.y))
: J.B(f.y, e.y) && J.B(e.x, g.x)
? (J.B(f.y, b.i(d - 2).y) && !J.B(f.x, b.i(d - 2).x)
? (b.l(d, f.x, a.y), c++, d++)
: b.M(d - 1, f.x, a.y),
J.B(g.x, b.i(d + 2).x) && !J.B(g.y, b.i(d + 2).y)
? b.l(d + 1, a.x, g.y)
: b.M(d + 1, a.x, g.y))
: J.B(f.x, e.x) && J.B(e.x, g.x)
? (J.B(f.x, b.i(d - 2).x) && !J.B(f.y, b.i(d - 2).y)
? (b.l(d, a.x, f.y), c++, d++)
: b.M(d - 1, a.x, f.y),
J.B(g.x, b.i(d + 2).x) && !J.B(g.y, b.i(d + 2).y)
? b.l(d + 1, a.x, g.y)
: b.M(d + 1, a.x, g.y))
: J.B(f.y, e.y) &&
J.B(e.y, g.y) &&
(J.B(f.y, b.i(d - 2).y) && !J.B(f.x, b.i(d - 2).x)
? (b.l(d, f.x, a.y), c++, d++)
: b.M(d - 1, f.x, a.y),
J.B(g.y, b.i(d + 2).y) && !J.B(g.x, b.i(d + 2).x)
? b.l(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).Fc() &&
((f = e.ia(yc, I.alloc())),
(d = b.getLinkPointFromPoint(d, e, f, a, !0, I.alloc())),
b.M(0, d.x, d.y),
I.free(f),
I.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).Fc() &&
((c = e.ia(yc, I.alloc())),
(a = b.getLinkPointFromPoint(d, e, c, a, !1, I.alloc())),
b.M(b.pointsCount - 1, a.x, a.y),
I.free(c),
I.free(a));
b.pf();
};
ag.prototype.computeReshape = function(a) {
var b = this.adornedLink,
c = this.handle.segmentIndex;
switch (this.Du(this.handle)) {
case fg:
return a;
case dg:
return new I(b.i(c).x, a.y);
case eg:
return new I(a.x, b.i(c).y);
default:
case bg:
return b.i(c);
}
};
ma.Object.defineProperties(ag.prototype, {
handleArchetype: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
midHandleArchetype: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
handle: {
get: function() {
return this.j;
},
set: function(a) {
if (null !== a && !(a.part instanceof ue))
throw Error('new handle is not in an Adornment: ' + a);
this.j = a;
},
},
adornedLink: {
get: function() {
return this.vs;
},
},
resegmentingDistance: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
originalPoint: {
get: function() {
return this.jw;
},
},
originalPoints: {
get: function() {
return this.xq;
},
},
});
ag.prototype.setReshapingBehavior = ag.prototype.Wl;
ag.prototype.getReshapingBehavior = ag.prototype.Du;
var bg = new D(ag, 'None', 0),
eg = new D(ag, 'Horizontal', 1),
dg = new D(ag, 'Vertical', 2),
fg = new D(ag, 'All', 3);
ag.className = 'LinkReshapingTool';
ag.None = bg;
ag.Horizontal = eg;
ag.Vertical = dg;
ag.All = fg;
Ka(
'linkReshapingTool',
function() {
return this.findTool('LinkReshaping');
},
function(a) {
this.gb('LinkReshaping', a, this.mouseDownTools);
},
);
function hg() {
ke.call(this);
this.name = 'Resizing';
this.m = new K(1, 1).freeze();
this.j = new K(9999, 9999).freeze();
this.pg = new K(NaN, NaN).freeze();
this.W = !1;
this.ga = !0;
this.me = null;
var a = new Cf();
a.alignmentFocus = yc;
a.figure = 'Rectangle';
a.desiredSize = Ib;
a.fill = 'lightblue';
a.stroke = 'dodgerblue';
a.strokeWidth = 1;
a.cursor = 'pointer';
this.F = a;
this.u = null;
this.wq = new I();
this.hw = new K();
this.An = new I();
this.Us = new K(0, 0);
this.Ts = new K(Infinity, Infinity);
this.Ss = new K(1, 1);
}
la(hg, ke);
hg.prototype.updateAdornments = function(a) {
if (!(null === a || a instanceof T)) {
if (a.isSelected && !this.diagram.isReadOnly) {
var b = a.resizeObject,
c = a.Hj(this.name);
if (
null !== b &&
a.canResize() &&
a.actualBounds.v() &&
a.isVisible() &&
b.actualBounds.v() &&
b.zf()
) {
if (null === c || c.adornedObject !== b) c = this.makeAdornment(b);
if (null !== c) {
b = b.fi();
ig(a) && this.updateResizeHandles(c, b);
a.Tg(this.name, c);
return;
}
}
}
a.Af(this.name);
}
};
hg.prototype.makeAdornment = function(a) {
var b = a.part.resizeAdornmentTemplate;
if (null === b) {
b = new ue();
b.type = W.Spot;
b.locationSpot = yc;
var c = new jg();
c.isPanelMain = !0;
b.add(c);
b.add(this.makeHandle(a, tc));
b.add(this.makeHandle(a, vc));
b.add(this.makeHandle(a, Cc));
b.add(this.makeHandle(a, Ac));
b.add(this.makeHandle(a, ad));
b.add(this.makeHandle(a, ed));
b.add(this.makeHandle(a, fd));
b.add(this.makeHandle(a, dd));
} else if ((kg(b), (b = b.copy()), null === b)) return null;
b.adornedObject = a;
return b;
};
hg.prototype.makeHandle = function(a, b) {
a = this.handleArchetype;
if (null === a) return null;
a = a.copy();
a.alignment = b;
return a;
};
hg.prototype.updateResizeHandles = function(a, b) {
if (null !== a)
if (
!a.alignment.Sb() &&
('pointer' === a.cursor || 0 < a.cursor.indexOf('resize'))
)
a: {
var c = a.alignment;
c.Fc() && (c = yc);
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 W)
for (a = a.elements; a.next(); ) this.updateResizeHandles(a.value, b);
};
hg.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;
};
hg.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 &&
((a.isMouseCaptured = !0),
a.animationManager.wc(),
this.Da(this.name),
this.wq.set(this.adornedObject.ia(this.handle.alignment.Qu())),
this.An.set(this.adornedObject.part.location),
this.hw.set(this.adornedObject.desiredSize),
(this.Ss = this.computeCellSize()),
(this.Us = this.computeMinSize()),
(this.Ts = this.computeMaxSize()),
(this.isActive = !0)));
};
hg.prototype.doDeactivate = function() {
var a = this.diagram;
this.stopTransaction();
this.me = this.handle = null;
this.isActive = a.isMouseCaptured = !1;
};
hg.prototype.stopTransaction = function() {
var a = this.diagram,
b = ke.prototype.stopTransaction.call(this);
b &&
null !== a.undoManager.transactionToUndo &&
a.undoManager.transactionToUndo.Vj();
return b;
};
hg.prototype.doCancel = function() {
null !== this.adornedObject &&
((this.adornedObject.desiredSize = this.originalDesiredSize),
(this.adornedObject.part.location = this.originalLocation));
this.stopTool();
};
hg.prototype.doMouseMove = function() {
var a = this.diagram;
if (this.isActive) {
var b = this.Us,
c = this.Ts,
d = this.Ss,
e = this.adornedObject.Nr(a.lastInput.documentPoint, I.alloc()),
f = this.computeReshape();
b = this.computeResize(e, this.handle.alignment, b, c, d, f);
this.resize(b);
a.nd();
I.free(e);
}
};
hg.prototype.doMouseUp = function() {
var a = this.diagram;
if (this.isActive) {
var b = this.Us,
c = this.Ts,
d = this.Ss,
e = this.adornedObject.Nr(a.lastInput.documentPoint, I.alloc()),
f = this.computeReshape();
b = this.computeResize(e, this.handle.alignment, b, c, d, f);
this.resize(b);
I.free(e);
a.Va();
this.transactionResult = this.name;
a.P('PartResized', this.adornedObject, this.originalDesiredSize);
}
this.stopTool();
};
hg.prototype.resize = function(a) {
var b = this.diagram,
c = this.adornedObject;
if (null !== c) {
c.desiredSize = a.size;
a = c.part;
a.Za();
c = c.ia(this.handle.alignment.Qu());
if (a instanceof qf) {
var d = new E();
d.add(a);
if (!this.dragsMembers && null === a.placeholder) {
var e = new Ce();
e.dragsMembers = !1;
}
b.moveParts(d, this.oppositePoint.copy().je(c), !0, e);
} else
a.location = a.location
.copy()
.je(c)
.add(this.oppositePoint);
b.nd();
}
};
hg.prototype.computeResize = function(a, b, c, d, e, f) {
b.Fc() && (b = yc);
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 = I.alloc();
J.so(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 + 0.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 + 0.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 + 0.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 + 0.5 * (l - h - a.width))));
I.free(p);
return a;
};
hg.prototype.computeReshape = function() {
var a = lg;
this.adornedObject instanceof Cf && (a = mg(this.adornedObject));
return !(a === ng || this.diagram.lastInput.shift);
};
hg.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;
};
hg.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;
};
hg.prototype.computeCellSize = function() {
var a = new K(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(hg.prototype, {
handleArchetype: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
handle: {
get: function() {
return this.u;
},
set: function(a) {
if (null !== a && !(a.part instanceof ue))
throw Error('new handle is not in an Adornment: ' + a);
this.u = a;
},
},
adornedObject: {
get: function() {
return this.me;
},
set: function(a) {
if (null !== a && a.part instanceof ue)
throw Error('new handle must not be in an Adornment: ' + a);
this.me = a;
},
},
minSize: {
get: function() {
return this.m;
},
set: function(a) {
if (!this.m.C(a)) {
var b = a.width;
isNaN(b) && (b = 0);
a = a.height;
isNaN(a) && (a = 0);
this.m.h(b, a);
}
},
},
maxSize: {
get: function() {
return this.j;
},
set: function(a) {
if (!this.j.C(a)) {
var b = a.width;
isNaN(b) && (b = Infinity);
a = a.height;
isNaN(a) && (a = Infinity);
this.j.h(b, a);
}
},
},
cellSize: {
get: function() {
return this.pg;
},
set: function(a) {
this.pg.C(a) || this.pg.assign(a);
},
},
isGridSnapEnabled: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
dragsMembers: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
oppositePoint: {
get: function() {
return this.wq;
},
set: function(a) {
this.wq.C(a) || this.wq.assign(a);
},
},
originalDesiredSize: {
get: function() {
return this.hw;
},
},
originalLocation: {
get: function() {
return this.An;
},
},
});
hg.className = 'ResizingTool';
Ka(
'resizingTool',
function() {
return this.findTool('Resizing');
},
function(a) {
this.gb('Resizing', a, this.mouseDownTools);
},
);
function og() {
ke.call(this);
this.name = 'Rotating';
this.ga = 45;
this.W = 2;
this.An = new I();
this.me = null;
var a = new Cf();
a.figure = 'Ellipse';
a.desiredSize = Jb;
a.fill = 'lightblue';
a.stroke = 'dodgerblue';
a.strokeWidth = 1;
a.cursor = 'pointer';
this.m = a;
this.j = null;
this.gw = 0;
this.Jq = new I(NaN, NaN);
this.u = 0;
this.F = 50;
}
la(og, ke);
og.prototype.updateAdornments = function(a) {
if (null !== a) {
if (a.eh()) {
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.v() &&
a.isVisible() &&
b.actualBounds.v() &&
b.zf())
) {
var c = a.Hj(this.name);
if (null === c || c.adornedObject !== b) c = this.makeAdornment(b);
if (null !== c) {
c.angle = b.fi();
null === c.placeholder &&
(c.location = this.computeAdornmentLocation(b));
a.Tg(this.name, c);
return;
}
}
a.Af(this.name);
}
};
og.prototype.makeAdornment = function(a) {
var b = a.part.rotateAdornmentTemplate;
if (null === b) {
b = new ue();
b.type = W.Position;
b.locationSpot = yc;
var c = this.handleArchetype;
null !== c && b.add(c.copy());
} else if ((kg(b), (b = b.copy()), null === b)) return null;
b.adornedObject = a;
return b;
};
og.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;
};
og.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 &&
((a.isMouseCaptured = !0),
(a.delaysLayout = !0),
this.Da(this.name),
(this.gw = this.adornedObject.angle),
(this.Jq = this.computeRotationPoint(this.adornedObject)),
(this.An = this.adornedObject.part.location.copy()),
(this.isActive = !0));
};
og.prototype.computeRotationPoint = function(a) {
var b = a.part,
c = b.locationObject;
return b.rotationSpot.pb()
? a.ia(b.rotationSpot)
: a === b || a === c
? c.ia(b.locationSpot)
: a.ia(yc);
};
og.prototype.computeAdornmentLocation = function(a) {
var b = this.rotationPoint;
b.v() || (b = this.computeRotationPoint(a));
b = a.Nr(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.ia(b);
};
og.prototype.doDeactivate = function() {
var a = this.diagram;
this.stopTransaction();
this.me = this.handle = null;
this.Jq = new I(NaN, NaN);
this.isActive = a.isMouseCaptured = !1;
};
og.prototype.stopTransaction = function() {
var a = this.diagram,
b = ke.prototype.stopTransaction.call(this);
b &&
null !== a.undoManager.transactionToUndo &&
a.undoManager.transactionToUndo.Vj();
return b;
};
og.prototype.doCancel = function() {
this.diagram.delaysLayout = !1;
this.rotate(this.originalAngle);
this.stopTool();
};
og.prototype.doMouseMove = function() {
var a = this.diagram;
this.isActive &&
((a = this.computeRotate(a.lastInput.documentPoint)), this.rotate(a));
};
og.prototype.doMouseUp = function() {
var a = this.diagram;
if (this.isActive) {
a.delaysLayout = !1;
var b = this.computeRotate(a.lastInput.documentPoint);
this.rotate(b);
a.Va();
this.transactionResult = this.name;
a.P('PartRotated', this.adornedObject, this.originalAngle);
}
this.stopTool();
};
og.prototype.rotate = function(a) {
var b = this.adornedObject;
if (null !== b) {
b.angle = a;
b = b.part;
b.Za();
var c = b.locationObject,
d = b.rotateObject;
if (c === d || c.jg(d))
(c = this.An.copy()),
(b.location = c
.je(this.rotationPoint)
.rotate(a - this.originalAngle)
.add(this.rotationPoint));
this.diagram.nd();
}
};
og.prototype.computeRotate = function(a) {
a = this.rotationPoint.Ya(a) - this.handleAngle;
var b = this.adornedObject.panel;
null !== b && (a -= b.fi());
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(og.prototype, {
handleArchetype: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
handle: {
get: function() {
return this.j;
},
set: function(a) {
if (null !== a && !(a.part instanceof ue))
throw Error('new handle is not in an Adornment: ' + a);
this.j = a;
},
},
adornedObject: {
get: function() {
return this.me;
},
set: function(a) {
if (null !== a && a.part instanceof ue)
throw Error('new handle must not be in an Adornment: ' + a);
this.me = a;
},
},
snapAngleMultiple: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
snapAngleEpsilon: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
originalAngle: {
get: function() {
return this.gw;
},
},
rotationPoint: {
get: function() {
return this.Jq;
},
set: function(a) {
this.Jq = a.copy();
},
},
handleAngle: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
handleDistance: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
});
og.className = 'RotatingTool';
Ka(
'rotatingTool',
function() {
return this.findTool('Rotating');
},
function(a) {
this.gb('Rotating', a, this.mouseDownTools);
},
);
function pg() {
ke.call(this);
this.name = 'ClickSelecting';
}
la(pg, ke);
pg.prototype.canStart = function() {
return !this.isEnabled || this.isBeyondDragSize() ? !1 : !0;
};
pg.prototype.doMouseUp = function() {
this.isActive &&
(this.standardMouseSelect(),
!this.standardMouseClick() &&
this.diagram.lastInput.isTouchEvent &&
this.diagram.toolManager.doToolTip());
this.stopTool();
};
pg.className = 'ClickSelectingTool';
function qg() {
ke.call(this);
this.name = 'Action';
this.ck = null;
}
la(qg, ke);
qg.prototype.canStart = function() {
if (!this.isEnabled) return !1;
var a = this.diagram,
b = a.lastInput,
c = a.ec(b.documentPoint, function(a) {
for (; null !== a.panel && !a.isActionable; ) a = a.panel;
return a;
});
if (null !== c) {
if (!c.isActionable) return !1;
this.ck = c;
a.qk = a.ec(b.documentPoint, null, null);
return !0;
}
return !1;
};
qg.prototype.doMouseDown = function() {
if (this.isActive) {
var a = this.diagram.lastInput,
b = this.ck;
null !== b &&
((a.targetObject = b), null !== b.actionDown && b.actionDown(a, b));
} else this.canStart() && this.doActivate();
};
qg.prototype.doMouseMove = function() {
if (this.isActive) {
var a = this.diagram.lastInput,
b = this.ck;
null !== b &&
((a.targetObject = b), null !== b.actionMove && b.actionMove(a, b));
}
};
qg.prototype.doMouseUp = function() {
if (this.isActive) {
var a = this.diagram.lastInput,
b = this.ck;
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();
};
qg.prototype.doCancel = function() {
var a = this.diagram.lastInput,
b = this.ck;
null !== b &&
((a.targetObject = b),
null !== b.actionCancel && b.actionCancel(a, b),
this.stopTool());
};
qg.prototype.doStop = function() {
this.ck = null;
};
qg.className = 'ActionTool';
function rg() {
ke.call(this);
this.name = 'ClickCreating';
this.Li = null;
this.m = !0;
this.j = !1;
this.Rv = new I(0, 0);
}
la(rg, ke);
rg.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.Rv = a.lastInput.viewPoint.copy()),
2 !== a.lastInput.clickCount || this.isBeyondDragSize(this.Rv))
)
return !1;
} else if (1 !== a.lastInput.clickCount) return !1;
return a.currentTool !== this &&
null !== a.wl(a.lastInput.documentPoint, !0)
? !1
: !0;
};
rg.prototype.doMouseUp = function() {
var a = this.diagram;
this.isActive && this.insertPart(a.lastInput.documentPoint);
this.stopTool();
};
rg.prototype.insertPart = function(a) {
var b = this.diagram,
c = this.archetypeNodeData;
if (null === c) return null;
var d = null;
try {
b.P('ChangingSelection', b.selection);
this.Da(this.name);
if (c instanceof U)
c.Tc() && (kg(c), (d = c.copy()), null !== d && b.add(d));
else if (null !== c) {
var e = b.model.copyNodeData(c);
ya(e) && (b.model.lf(e), (d = b.Ec(e)));
}
if (null !== d) {
var f = I.allocAt(a.x, a.y);
this.isGridSnapEnabled && Ag(this.diagram, d, a, f);
d.location = f;
b.allowSelect && (b.clearSelection(!0), (d.isSelected = !0));
I.free(f);
}
b.Va();
this.transactionResult = this.name;
b.P('PartCreated', d);
} finally {
this.stopTransaction(), b.P('ChangedSelection', b.selection);
}
return d;
};
ma.Object.defineProperties(rg.prototype, {
archetypeNodeData: {
get: function() {
return this.Li;
},
set: function(a) {
this.Li = a;
},
},
isDoubleClick: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
isGridSnapEnabled: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
});
rg.className = 'ClickCreatingTool';
function Bg() {
ke.call(this);
this.name = 'DragSelecting';
this.wk = 175;
this.m = !1;
var a = new U();
a.layerName = 'Tool';
a.selectable = !1;
var b = new Cf();
b.name = 'SHAPE';
b.figure = 'Rectangle';
b.fill = null;
b.stroke = 'magenta';
a.add(b);
this.j = a;
}
la(Bg, ke);
Bg.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.wl(b.documentPoint, !0)))
? !1
: !0;
};
Bg.prototype.doActivate = function() {
var a = this.diagram;
this.isActive = !0;
a.isMouseCaptured = !0;
a.skipsUndoManager = !0;
a.add(this.box);
this.doMouseMove();
};
Bg.prototype.doDeactivate = function() {
var a = this.diagram;
a.lg();
a.remove(this.box);
a.skipsUndoManager = !1;
this.isActive = a.isMouseCaptured = !1;
};
Bg.prototype.doMouseMove = function() {
var a = this.diagram;
if (this.isActive && null !== this.box) {
var b = this.computeBoxBounds(),
c = this.box.fb('SHAPE');
null === c && (c = this.box.vb());
var d = K.alloc().h(b.width, b.height);
c.desiredSize = d;
this.box.Ul(b.x, b.y, !1);
K.free(d);
(a.allowHorizontalScroll || a.allowVerticalScroll) &&
a.Fr(a.lastInput.viewPoint);
}
};
Bg.prototype.doMouseUp = function() {
if (this.isActive) {
var a = this.diagram;
a.remove(this.box);
try {
(a.currentCursor = 'wait'),
a.P('ChangingSelection', a.selection),
this.selectInRect(this.computeBoxBounds()),
a.P('ChangedSelection', a.selection);
} finally {
a.currentCursor = '';
}
}
this.stopTool();
};
Bg.prototype.computeBoxBounds = function() {
var a = this.diagram;
return new M(a.firstInput.documentPoint, a.lastInput.documentPoint);
};
Bg.prototype.selectInRect = function(a) {
var b = this.diagram,
c = b.lastInput;
a = b.Ww(a, this.isPartialInclusion);
if (Qa ? 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(Bg.prototype, {
delay: {
get: function() {
return this.wk;
},
set: function(a) {
this.wk = a;
},
},
isPartialInclusion: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
box: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
});
Bg.className = 'DragSelectingTool';
function Cg() {
ke.call(this);
this.name = 'Panning';
this.Ct = new I();
this.ey = new I();
this.og = !1;
var a = this;
this.ow = function() {
var b = a.diagram;
null !== b && b.removeEventListener(x.document, 'scroll', a.ow, !1);
a.stopTool();
};
}
la(Cg, ke);
Cg.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;
};
Cg.prototype.doActivate = function() {
var a = this.diagram;
this.og
? ((a.lastInput.bubbles = !0),
a.addEventListener(x.document, 'scroll', this.ow, !1))
: ((a.currentCursor = 'move'),
(a.isMouseCaptured = !0),
this.Ct.assign(a.position));
this.isActive = !0;
};
Cg.prototype.doDeactivate = function() {
var a = this.diagram;
a.currentCursor = '';
this.isActive = a.isMouseCaptured = !1;
};
Cg.prototype.doCancel = function() {
var a = this.diagram;
a.position = this.Ct;
a.isMouseCaptured = !1;
this.stopTool();
};
Cg.prototype.doMouseMove = function() {
this.move();
};
Cg.prototype.doMouseUp = function() {
this.move();
this.stopTool();
};
Cg.prototype.move = function() {
var a = this.diagram;
if (this.isActive && a)
if (this.og) 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.ey.h(e, c);
}
};
ma.Object.defineProperties(Cg.prototype, {
bubbles: {
get: function() {
return this.og;
},
set: function(a) {
this.og = a;
},
},
originalPosition: {
get: function() {
return this.Ct;
},
},
});
Cg.className = 'PanningTool';
Ka(
'clickCreatingTool',
function() {
return this.findTool('ClickCreating');
},
function(a) {
this.gb('ClickCreating', a, this.mouseUpTools);
},
);
Ka(
'clickSelectingTool',
function() {
return this.findTool('ClickSelecting');
},
function(a) {
this.gb('ClickSelecting', a, this.mouseUpTools);
},
);
Ka(
'panningTool',
function() {
return this.findTool('Panning');
},
function(a) {
this.gb('Panning', a, this.mouseMoveTools);
},
);
Ka(
'dragSelectingTool',
function() {
return this.findTool('DragSelecting');
},
function(a) {
this.gb('DragSelecting', a, this.mouseMoveTools);
},
);
Ka(
'actionTool',
function() {
return this.findTool('Action');
},
function(a) {
this.gb('Action', a, this.mouseDownTools);
},
);
function ze() {
this.F = this.u = this.j = this.m = null;
}
ma.Object.defineProperties(ze.prototype, {
mainElement: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
show: {
get: function() {
return this.m;
},
set: function(a) {
this.m !== a && (this.m = a);
},
},
hide: {
get: function() {
return this.j;
},
set: function(a) {
this.j !== a && (this.j = a);
},
},
valueFunction: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
});
ze.className = 'HTMLInfo';
function Dg(a, b, c) {
this.text = a;
this.Kw = b;
this.visible = c;
}
Dg.className = 'ContextMenuButtonInfo';
function Eg() {
ke.call(this);
this.name = 'ContextMenu';
this.m = this.Js = this.j = null;
this.cw = new I();
this.Ls = null;
this.gt = !1;
var a = this;
this.Zt = function() {
a.stopTool();
};
}
la(Eg, ke);
function Fg(a) {
var b = new ze();
b.show = function(a, b, c) {
c.showDefaultContextMenu();
};
b.hide = function(a, b) {
b.hideDefaultContextMenu();
};
Gg = b;
a.Zt = function() {
a.stopTool();
};
b = ua('div');
var c = ua('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 = ua('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,
);
d = a.diagram;
null !== d &&
(d.addEventListener(b, 'contextmenu', Hg, !1),
d.addEventListener(b, 'selectstart', Hg, !1),
d.addEventListener(c, 'contextmenu', Hg, !1));
b.className = 'goCXforeground';
c.className = 'goCXbackground';
x.document.body &&
(x.document.body.appendChild(b), x.document.body.appendChild(c));
Ig = b;
Jg = c;
Kg = !0;
}
function Hg(a) {
a.preventDefault();
return !1;
}
Eg.prototype.canStart = function() {
if (!this.isEnabled) return !1;
var a = this.diagram;
return this.isBeyondDragSize() ||
!a.lastInput.right ||
1 < a.lastInput.clickCount
? !1
: (a.lastInput.isTouchEvent && null !== this.defaultTouchContextMenu) ||
null !== this.findObjectWithContextMenu()
? !0
: !1;
};
Eg.prototype.doStart = function() {
this.cw.set(this.diagram.firstInput.documentPoint);
};
Eg.prototype.doStop = function() {
this.hideContextMenu();
this.currentObject = null;
};
Eg.prototype.findObjectWithContextMenu = function(a) {
void 0 === a && (a = null);
var b = this.diagram,
c = b.lastInput,
d = null;
a instanceof Q ||
(a instanceof Y
? (d = a)
: (d = b.ec(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;
};
Eg.prototype.doActivate = function() {};
Eg.prototype.doMouseDown = function() {
ke.prototype.doMouseDown.call(this);
if (this.isActive && this.currentContextMenu instanceof ue) {
var a = this.diagram.toolManager.findTool('Action');
null !== a &&
a.canStart() &&
(a.doActivate(), a.doMouseDown(), a.doDeactivate());
}
this.diagram.toolManager.mouseDownTools.contains(this) && Lg(this);
};
Eg.prototype.doMouseUp = function() {
if (this.isActive && this.currentContextMenu instanceof ue) {
var a = this.diagram.toolManager.findTool('Action');
null !== a &&
a.canStart() &&
(a.doActivate(), a.doCancel(), a.doDeactivate());
}
Lg(this);
};
function Lg(a) {
var b = a.diagram;
if (a.isActive) {
var c = a.currentContextMenu;
if (null !== c) {
if (!(c instanceof ze)) {
var d = b.ec(b.lastInput.documentPoint, null, null);
null !== d && d.jg(c) && a.standardMouseClick(null, null);
}
a.stopTool();
a.canStart() && ((b.currentTool = a), a.doMouseUp());
}
} else a.canStart() && (Mg(a, !0), a.isActive || a.stopTool());
}
function Mg(a, b, c) {
void 0 === c && (c = null);
if (
!a.gt &&
((a.gt = !0),
b && a.standardMouseSelect(),
(b = a.standardMouseClick()),
(a.gt = !1),
!b)
) {
a.isActive = !0;
b = Gg;
null === c && (c = a.findObjectWithContextMenu());
if (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);
a.currentContextMenu instanceof ue &&
!a.currentContextMenu.visible &&
a.stopTool();
}
}
Eg.prototype.doMouseMove = function() {
var a = this.diagram.toolManager.findTool('Action');
null !== a && a.doMouseMove();
this.isActive && this.diagram.toolManager.doMouseMove();
};
Eg.prototype.showContextMenu = function(a, b) {
var c = this.diagram;
a !== this.currentContextMenu && this.hideContextMenu();
if (a instanceof ue) {
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.Za();
this.positionContextMenu(a, b);
} else a instanceof ze && a.show(b, c, this);
this.currentContextMenu = a;
};
Eg.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;
}
};
Eg.prototype.hideContextMenu = function() {
var a = this.diagram,
b = this.currentContextMenu;
null !== b &&
(b instanceof ue
? (a.remove(b),
null !== this.Js && this.Js.Af(b.category),
(b.data = null),
(b.adornedObject = null))
: b instanceof ze &&
(null !== b.hide
? b.hide(a, this)
: null !== b.mainElement && (b.mainElement.style.display = 'none')),
(this.currentContextMenu = null),
this.standardMouseOver());
};
function Ng(a) {
var b = new E();
b.add(
new Dg(
'Copy',
function(a) {
a.commandHandler.copySelection();
},
function(a) {
return a.commandHandler.canCopySelection();
},
),
);
b.add(
new Dg(
'Cut',
function(a) {
a.commandHandler.cutSelection();
},
function(a) {
return a.commandHandler.canCutSelection();
},
),
);
b.add(
new Dg(
'Delete',
function(a) {
a.commandHandler.deleteSelection();
},
function(a) {
return a.commandHandler.canDeleteSelection();
},
),
);
b.add(
new Dg(
'Paste',
function(b) {
b.commandHandler.pasteSelection(a.mouseDownPoint);
},
function(b) {
return b.commandHandler.canPasteSelection(a.mouseDownPoint);
},
),
);
b.add(
new Dg(
'Select All',
function(a) {
a.commandHandler.selectAll();
},
function(a) {
return a.commandHandler.canSelectAll();
},
),
);
b.add(
new Dg(
'Undo',
function(a) {
a.commandHandler.undo();
},
function(a) {
return a.commandHandler.canUndo();
},
),
);
b.add(
new Dg(
'Redo',
function(a) {
a.commandHandler.redo();
},
function(a) {
return a.commandHandler.canRedo();
},
),
);
b.add(
new Dg(
'Scroll To Part',
function(a) {
a.commandHandler.scrollToPart();
},
function(a) {
return a.commandHandler.canScrollToPart();
},
),
);
b.add(
new Dg(
'Zoom To Fit',
function(a) {
a.commandHandler.zoomToFit();
},
function(a) {
return a.commandHandler.canZoomToFit();
},
),
);
b.add(
new Dg(
'Reset Zoom',
function(a) {
a.commandHandler.resetZoom();
},
function(a) {
return a.commandHandler.canResetZoom();
},
),
);
b.add(
new Dg(
'Group Selection',
function(a) {
a.commandHandler.groupSelection();
},
function(a) {
return a.commandHandler.canGroupSelection();
},
),
);
b.add(
new Dg(
'Ungroup Selection',
function(a) {
a.commandHandler.ungroupSelection();
},
function(a) {
return a.commandHandler.canUngroupSelection();
},
),
);
b.add(
new Dg(
'Edit Text',
function(a) {
a.commandHandler.editTextBlock();
},
function(a) {
return a.commandHandler.canEditTextBlock();
},
),
);
return b;
}
Eg.prototype.showDefaultContextMenu = function() {
var a = this.diagram;
null === this.Ls && (this.Ls = Ng(this));
Ig.innerHTML = '';
Jg.addEventListener('pointerdown', this.Zt, !1);
var b = this,
c = ua('ul');
c.className = 'goCXul';
Ig.appendChild(c);
c.innerHTML = '';
for (var d = this.Ls.iterator; d.next(); ) {
var e = d.value,
f = e.visible;
if ('function' === typeof e.Kw && ('function' !== typeof f || f(a))) {
f = ua('li');
f.className = 'goCXli';
var g = ua('a');
g.className = 'goCXa';
g.href = '#';
g.Qx = e.Kw;
g.addEventListener(
'pointerdown',
function(c) {
this.Qx(a);
b.stopTool();
c.preventDefault();
return !1;
},
!1,
);
g.textContent = e.text;
f.appendChild(g);
c.appendChild(f);
}
}
Ig.style.display = 'block';
Jg.style.display = 'block';
};
Eg.prototype.hideDefaultContextMenu = function() {
if (null !== this.currentContextMenu && this.currentContextMenu === Gg) {
Ig.style.display = 'none';
Jg.style.display = 'none';
var a = this.diagram;
null !== a && a.removeEventListener(Jg, 'pointerdown', this.Zt, !1);
this.currentContextMenu = null;
}
};
ma.Object.defineProperties(Eg.prototype, {
currentContextMenu: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
this.Js = a instanceof ue ? a.adornedPart : null;
},
},
defaultTouchContextMenu: {
get: function() {
!1 === Kg && null === Gg && Og && Fg(this);
return Gg;
},
set: function(a) {
null === a && (Kg = !0);
Gg = a;
},
},
currentObject: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
mouseDownPoint: {
get: function() {
return this.cw;
},
},
});
var Gg = null,
Kg = !1,
Jg = null,
Ig = null;
Eg.className = 'ContextMenuTool';
Ka(
'contextMenuTool',
function() {
return this.findTool('ContextMenu');
},
function(a) {
this.gb('ContextMenu', a, this.mouseUpTools);
},
);
function Pg() {
ke.call(this);
this.name = 'TextEditing';
this.Sh = new Qg();
this.ga = null;
this.W = Rg;
this.qj = null;
this.na = Sg;
this.u = 1;
this.F = !0;
this.m = null;
this.j = new ze();
this.Ms = null;
Tg(this, this.j);
}
la(Pg, ke);
function Tg(a, b) {
if (Og) {
var c = ua('textarea');
a.Ms = c;
c.addEventListener(
'input',
function() {
if (null !== a.textBlock) {
var b = a.qx(this.value);
this.style.width = 20 + b.measuredBounds.width * this.cA + 'px';
this.rows = b.lineCount;
}
},
!1,
);
c.addEventListener(
'keydown',
function(b) {
if (null !== a.textBlock) {
var c = b.key;
'Enter' === c
? (!1 === a.textBlock.isMultiline && b.preventDefault(),
a.acceptText(Ug))
: 'Tab' === c
? (a.acceptText(Vg), b.preventDefault())
: 'Escape' === c &&
(a.doCancel(), null !== a.diagram && a.diagram.doFocus());
}
},
!1,
);
c.addEventListener(
'focus',
function() {
if (null !== a.currentTextEditor && a.state !== Sg) {
var b = a.Ms;
a.na === Wg && (a.na = Xg);
'function' === typeof b.select &&
a.selectsTextOnActivate &&
(b.select(), b.setSelectionRange(0, 9999));
}
},
!1,
);
c.addEventListener(
'blur',
function() {
if (null !== a.currentTextEditor && a.state !== Sg) {
var b = a.Ms;
'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 Qg && f instanceof Pg)
if (f.state === Yg) (c.style.border = '3px solid red'), c.focus();
else {
var d = a.ia(yc),
e = b.position,
k = b.scale,
l = a.uf() * 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;
e = a.verticalAlignment;
k =
(a.lineHeight + a.spacingAbove + a.spacingBelow) *
a.lineCount *
l;
n = e.y * n - e.y * k + e.offsetY - (0.5 * n - 0.5 * k) - k / 2;
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) | 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.cA = 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);
};
}
}
Pg.prototype.canStart = function() {
if (!this.isEnabled) return !1;
var a = this.diagram;
if (
null === a ||
a.isReadOnly ||
(Zg && Zg !== this && (Zg.acceptText($g), Zg && Zg !== this)) ||
!a.lastInput.left ||
this.isBeyondDragSize()
)
return !1;
var b = a.ec(a.lastInput.documentPoint);
if (!(null !== b && b instanceof Qg && b.editable && b.part.canEdit()))
return !1;
b = b.part;
return null === b ||
(this.starting === Rg && !b.isSelected) ||
(this.starting === ah && 2 > a.lastInput.clickCount)
? !1
: !0;
};
Pg.prototype.doStart = function() {
Zg = this;
null !== this.textBlock && this.doActivate();
};
Pg.prototype.doActivate = function() {
if (!this.isActive) {
var a = this.diagram;
if (null !== a) {
var b = this.textBlock;
null === b && (b = a.ec(a.lastInput.documentPoint));
if (
null !== b &&
b instanceof Qg &&
((this.textBlock = b), null !== b.part)
) {
a.animationManager.wc();
this.isActive = !0;
this.na = Wg;
var c = this.defaultTextEditor;
null !== b.textEditor && (c = b.textEditor);
this.Sh = this.textBlock.copy();
var d = new M(this.textBlock.ia(tc), this.textBlock.ia(Cc));
a.bv(d);
c.show(b, a, this);
this.currentTextEditor = c;
}
}
}
};
Pg.prototype.doCancel = function() {
this.stopTool();
};
Pg.prototype.doMouseUp = function() {
this.canStart() && this.doActivate();
};
Pg.prototype.doMouseDown = function() {
this.isActive && this.acceptText($g);
};
Pg.prototype.acceptText = function(a) {
switch (a) {
case $g:
if (this.na === bh)
this.currentTextEditor instanceof HTMLElement &&
this.currentTextEditor.focus();
else if (this.na === Wg || this.na === Yg || this.na === Xg)
(this.na = ch), dh(this);
break;
case eh:
case Ug:
case Vg:
if (Ug !== a || !0 !== this.textBlock.isMultiline)
if (this.na === Wg || this.na === Yg || this.na === Xg)
(this.na = ch), dh(this);
}
};
function dh(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.Da(a.name),
(a.na = bh),
(a.transactionResult = a.name),
(b.text = f),
a.doSuccess(e, f),
null !== c && c.P('TextEdited', b, e),
a.stopTransaction(),
a.stopTool(),
null !== c && c.doFocus())
: ((a.na = Yg), a.doError(e, f));
}
}
Pg.prototype.doError = function(a, b) {
var c = this.textBlock;
null !== c.errorFunction && c.errorFunction(this, a, b);
(a = this.currentTextEditor) && a.show(c, this.diagram, this);
};
Pg.prototype.doSuccess = function(a, b) {
var c = this.textBlock;
null !== c.textEdited && c.textEdited(c, a, b);
};
Pg.prototype.doDeactivate = function() {
var a = this.diagram;
null !== a &&
((this.na = Sg),
null !== this.currentTextEditor && this.currentTextEditor.hide(a, this),
(this.textBlock = null),
(this.isActive = !1));
};
Pg.prototype.doStop = function() {
Zg = null;
};
Pg.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;
};
Pg.prototype.qx = function(a) {
var b = this.Sh;
b.text = a;
b.measure(this.textBlock.zh, Infinity);
return b;
};
ma.Object.defineProperties(Pg.prototype, {
textBlock: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
currentTextEditor: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
defaultTextEditor: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
starting: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
textValidation: {
get: function() {
return this.qj;
},
set: function(a) {
this.qj = a;
},
},
minimumEditorScale: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
selectsTextOnActivate: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
state: {
get: function() {
return this.na;
},
set: function(a) {
this.na !== a && (this.na = a);
},
},
});
Pg.prototype.measureTemporaryTextBlock = Pg.prototype.qx;
var eh = new D(Pg, 'LostFocus', 0),
$g = new D(Pg, 'MouseDown', 1),
Vg = new D(Pg, 'Tab', 2),
Ug = new D(Pg, 'Enter', 3),
fh = new D(Pg, 'SingleClick', 0),
Rg = new D(Pg, 'SingleClickSelected', 1),
ah = new D(Pg, 'DoubleClick', 2),
Sg = new D(Pg, 'StateNone', 0),
Wg = new D(Pg, 'StateActive', 1),
Xg = new D(Pg, 'StateEditing', 2),
ch = new D(Pg, 'StateValidating', 3),
Yg = new D(Pg, 'StateInvalid', 4),
bh = new D(Pg, 'StateValidated', 5),
Zg = null;
Pg.className = 'TextEditingTool';
Pg.LostFocus = eh;
Pg.MouseDown = $g;
Pg.Tab = Vg;
Pg.Enter = Ug;
Pg.SingleClick = fh;
Pg.SingleClickSelected = Rg;
Pg.DoubleClick = ah;
Pg.StateNone = Sg;
Pg.StateActive = Wg;
Pg.StateEditing = Xg;
Pg.StateValidating = ch;
Pg.StateInvalid = Yg;
Pg.StateValidated = bh;
Ka(
'textEditingTool',
function() {
return this.findTool('TextEditing');
},
function(a) {
this.gb('TextEditing', a, this.mouseUpTools);
},
);
function gh(a) {
hh || (ih(), (hh = !0));
this.H = le;
this.Dk = this.zb = this.Xp = this.$b = !1;
this.uw = !0;
this.Ek = jh;
this.lm = !1;
this.wh = this.Ad = !0;
this.ug = 600;
this.Hv = this.sw = !1;
this.Sd = new G();
this.Wd = new kh();
this.Wd.Rd = this;
this.yi = new G();
this.Vt = new G();
this.rr = new G();
this.dl = new G();
a && Object.assign(this, a);
}
gh.prototype.Le = function(a) {
this.H = a;
};
gh.prototype.canStart = function() {
return !0;
};
function lh(a, b) {
a.Ad &&
a.canStart(b) &&
(a.Sd.add(b),
a.defaultAnimation.isAnimating && a.wc(),
mh(a.H),
(a.zb = !0));
}
function nh(a) {
if (a.Ad && a.zb) {
var b = a.Wd,
c = a.H,
d = a.Sd.contains('Model');
d &&
((a.Dk = !0),
a.Ek === jh
? ((b.isViewportUnconstrained = !0),
b.rc.clear(),
b.add(c, 'position', c.position.copy().offset(0, -200), c.position),
b.add(c, 'opacity', 0, 1))
: a.Ek === oh && b.rc.clear(),
(a.uw = a.Ek === ph && c.Jt.C(c.pa) ? !0 : !1),
c.P('InitialAnimationStarting', a));
(d && !a.wh) || 0 === b.rc.count
? (a.Sd.clear(),
(a.zb = !1),
b.rc.clear(),
qh(b, c),
(a.Dk = !1),
c.N())
: (a.Sd.clear(),
(c.cg = !1),
(d = b.rc.get(c)),
c.autoScale !== rh &&
null !== d &&
(delete d.start.scale, delete d.end.scale),
x.requestAnimationFrame(function() {
!1 === a.zb ||
b.$b ||
(c.Ge('temporaryPixelRatio') && Ge(c),
sh(c),
(a.zb = !1),
b.start(),
b.$b &&
(th(a),
c.Va(),
uh(b, 0),
zf(c, !0),
vh(a),
c.P('AnimationStarting', a)));
}));
}
}
function wh(a) {
return a.Sd.contains('Trigger') && 1 === a.Sd.count;
}
function xh(a, b, c, d) {
a.isTicking ||
wh(a) ||
(b instanceof T && (null !== b.fromNode || null !== b.toNode)) ||
a.Wd.add(b, 'position', c, d, !1);
}
t = gh.prototype;
t.es = function(a) {
return this.Wd.es(a);
};
t.Ju = function(a) {
return this.Wd.Ju(a);
};
function yh(a, b) {
function c() {
0 < e.rr.count && (d.addAll(e.rr), e.rr.clear(), (e.$b = !0));
if (!1 !== e.$b && 0 !== d.count) {
e.Vt.addAll(d);
for (var a = e.Vt.iterator; a.next(); ) {
var b = a.value;
if (!1 !== b.$b) {
a: if (0 < b.nl.count) var h = !0;
else {
for (h = b.rc.iterator; h.next(); ) {
var k = h.key;
if ((k instanceof Y && null !== k.diagram) || k instanceof Q) {
h = !0;
break a;
}
}
h = !1;
}
h ? zh(b, !1) : (b.Mk = !0);
}
}
e.Vt.clear();
!1 !== e.$b && (th(e), zf(e.H), vh(e), x.requestAnimationFrame(c));
}
}
var d = a.yi,
e = a;
a.$b
? a.rr.add(b)
: ((a.$b = !0),
d.add(b),
x.requestAnimationFrame(function() {
c();
}));
}
function Ah(a) {
for (a = a.yi.iterator; a.next(); ) a.value.Mk = !1;
}
function th(a) {
if (!a.Xp) {
var b = a.H;
a.sw = b.skipsUndoManager;
a.Hv = b.skipsModelSourceBindings;
b.skipsUndoManager = !0;
b.skipsModelSourceBindings = !0;
a.Xp = !0;
}
}
function vh(a) {
var b = a.H;
b.skipsUndoManager = a.sw;
b.skipsModelSourceBindings = a.Hv;
a.Xp = !1;
}
t.wc = function(a) {
var b = this.Wd;
!0 === this.zb &&
((this.Dk = this.zb = !1),
this.Sd.clear(),
0 < b.rc.count && this.H.Mb());
if (this.$b) {
if ((b.ul(!0), b.rc.clear(), qh(b, null), !0 === a))
for (a = this.yi.Ea(), b = 0; b < a.length; b++) a[b].ul(!0);
} else b.rc.clear(), qh(b, this.H);
};
t.ul = function(a) {
a === this.defaultAnimation && this.defaultAnimation.rc.clear();
this.yi.remove(a);
0 === this.yi.count && ((this.$b = !1), this.H.Mb());
a === this.defaultAnimation &&
(this.defaultAnimation.rc.clear(), this.H.P('AnimationFinished', this));
};
t.xj = function(a, b) {
this.zb &&
(this.Sd.contains('Expand Tree') ||
this.Sd.contains('Expand SubGraph')) &&
(this.Wd.xj(a, b), Bh(this, a));
};
t.vj = function(a, b) {
this.zb &&
(this.Sd.contains('Collapse Tree') ||
this.Sd.contains('Collapse SubGraph')) &&
(this.Wd.vj(a, b),
Ch(this.Wd, b, 'position', b.position, b.position),
Bh(this, a));
};
function Nh(a, b, c) {
!a.zb ||
b.C(c) ||
wh(a) ||
(a.H.ji || (b = c.copy()), Ch(a.Wd, a.H, 'position', b, c));
}
function Bh(a, b) {
for (b = b.findLinksConnected(); b.next(); ) {
var c = b.value;
c.ef = c.points.copy();
a.dl.add(c);
}
}
function Oh(a, b, c, d, e) {
null === a && (a = [0, 0, 0, 0]);
null === b && (b = [0, 0, 0, 0]);
var f = a[0],
g = a[1],
h = a[2];
a = a[3];
var k = b[0],
l = b[1],
m = b[2];
b = b[3];
if (0 === h || 100 === h) (f = k), (g = l);
else if (0 === m || 100 === m) (k = f), (l = g);
180 < Math.abs(k - f) && (k > f ? (f += 360) : (k += 360));
f = e(c, f, k - f, d) % 360;
g = e(c, g, l - g, d);
h = e(c, h, m - h, d);
c = e(c, a, b - a, d);
return 'hsla(' + f + ', ' + g + '%, ' + h + '%, ' + c + ')';
}
function ih() {
function a(a, b, e, f, g, h) {
a.position = new I(f(g, b.x, e.x - b.x, h), f(g, b.y, e.y - b.y, h));
}
var b = new pb();
b.add('position:diagram', a);
b.add('position', a);
b.add('position:part', function(a, b, e, f, g, h) {
g < h
? a.Ul(f(g, b.x, e.x - b.x, h), f(g, b.y, e.y - b.y, h), !1)
: (a.position = new I(
f(g, b.x, e.x - b.x, h),
f(g, b.y, e.y - b.y, h),
));
});
b.add('location', function(a, b, e, f, g, h) {
g < h
? a.Ul(f(g, b.x, e.x - b.x, h), f(g, b.y, e.y - b.y, h), !0)
: (a.location = new I(
f(g, b.x, e.x - b.x, h),
f(g, b.y, e.y - b.y, h),
));
});
b.add('position:placeholder', function(a, b, e, f, g, h) {
g < h
? a.Ul(f(g, b.x, e.x - b.x, h), f(g, b.y, e.y - b.y, h), !1)
: (a.position = new I(
f(g, b.x, e.x - b.x, h),
f(g, b.y, e.y - b.y, h),
));
});
b.add('position:nodeCollapse', function(a, b, e, f, g, h) {
var c = a.actualBounds,
d = e.actualBounds;
e = d.x + d.width / 2 - c.width / 2;
c = d.y + d.height / 2 - c.height / 2;
g < h
? a.Ul(f(g, b.x, e - b.x, h), f(g, b.y, c - b.y, h), !1)
: (a.position = new I(f(g, b.x, e - b.x, h), f(g, b.y, c - b.y, h)));
});
b.add('desiredSize', function(a, b, e, f, g, h) {
a.desiredSize = new M(
f(g, b.width, e.width - b.width, h),
f(g, b.height, e.height - b.height, h),
);
});
b.add('width', function(a, b, e, f, g, h) {
a.width = f(g, b, e - b, h);
});
b.add('height', function(a, b, e, f, g, h) {
a.height = f(g, b, e - b, h);
});
b.add('fill', function(a, b, e, f, g, h) {
a.fill = Oh(b, e, g, h, f);
});
b.add('stroke', function(a, b, e, f, g, h) {
a.stroke = Oh(b, e, g, h, f);
});
b.add('strokeWidth', function(a, b, e, f, g, h) {
a.strokeWidth = f(g, b, e - b, h);
});
b.add('strokeDashOffset', function(a, b, e, f, g, h) {
a.strokeDashOffset = f(g, b, e - b, h);
});
b.add('background', function(a, b, e, f, g, h) {
a.background = Oh(b, e, g, h, f);
});
b.add('areaBackground', function(a, b, e, f, g, h) {
a.areaBackground = Oh(b, e, g, h, f);
});
b.add('opacity', function(a, b, e, f, g, h) {
a.opacity = f(g, b, e - b, h);
});
b.add('scale', function(a, b, e, f, g, h) {
a.scale = f(g, b, e - b, h);
});
b.add('angle', function(a, b, e, f, g, h) {
a.angle = f(g, b, e - b, h);
});
Ph = b;
}
ma.Object.defineProperties(gh.prototype, {
animationReasons: {
get: function() {
return this.Sd;
},
},
isEnabled: {
get: function() {
return this.Ad;
},
set: function(a) {
(this.Ad = a) &&
this.yi.each(function(a) {
a.isAnimating || Infinity !== a.runCount || a.start();
});
},
},
duration: {
get: function() {
return this.ug;
},
set: function(a) {
1 > a && wa(a, '>= 1', gh, 'duration');
this.ug = a;
},
},
isAnimating: {
get: function() {
return this.$b;
},
},
isTicking: {
get: function() {
return this.Xp;
},
},
isInitial: {
get: function() {
return this.wh;
},
set: function(a) {
this.wh = a;
},
},
defaultAnimation: {
get: function() {
return this.Wd;
},
},
activeAnimations: {
get: function() {
return this.yi;
},
},
initialAnimationStyle: {
get: function() {
return this.Ek;
},
set: function(a) {
this.Ek = a;
},
},
});
gh.prototype.stopAnimation = gh.prototype.wc;
var Ph = null,
hh = !1,
jh = new D(gh, 'Default', 1),
ph = new D(gh, 'AnimateLocations', 2),
oh = new D(gh, 'None', 3);
gh.className = 'AnimationManager';
gh.defineAnimationEffect = function(a, b) {
hh || (ih(), (hh = !0));
Ph.add(a, b);
};
gh.Default = jh;
gh.AnimateLocations = ph;
gh.None = oh;
function kh(a) {
this.au = this.rw = this.Rd = this.H = null;
this.Mk = this.$b = this.j = !1;
this.Km = this.Gd = 0;
this.op = this.Rs = Qh;
this.Lk = this.Kn = !1;
this.It = 1;
this.Gt = 0;
this.yd = this.ug = NaN;
this.Lv = 0;
this.Lm = null;
this.m = qb;
this.rc = new pb();
this.yt = new pb();
this.nl = new G();
this.zt = new G();
this.Iv = Rh;
a && Object.assign(this, a);
}
kh.prototype.suspend = function() {
this.Mk = !0;
};
kh.prototype.advanceTo = function(a, b) {
b && (this.Mk = !1);
this.Kn && a >= this.yd && ((this.Lk = !0), (a -= this.yd));
this.Lv = a;
zh(this, !0);
th(this.Rd);
zf(this.H);
vh(this.Rd);
this.H.redraw();
};
function qh(a, b) {
a.yt.clear();
a.Lk = !1;
a.Gt = 0;
a.yd = NaN;
0 < a.nl.count && a.nl.clear();
0 < a.zt.count && a.zt.clear();
if (null !== b) for (a = b.links; a.next(); ) a.value.ef = null;
}
t = kh.prototype;
t.start = function() {
if (0 === this.rc.count || this.$b) return this;
for (var a = this.H, b = this.rc.iterator; b.next(); ) {
var c = b.value.end,
d = b.key;
if (c['position:placeholder']) {
var e = d.findVisibleNode();
if (e instanceof qf && null !== e.placeholder) {
var f = e.placeholder;
e = f.ia(tc);
f = f.padding;
e.x += f.left;
e.y += f.top;
c['position:placeholder'] = e;
}
}
null === a &&
(d instanceof Q ? (a = d) : d instanceof Y && (a = d.diagram));
}
if (null !== a) (this.H = a), (this.Rd = a.animationManager);
else return this;
b = this.Rd;
if (!1 === b.isEnabled) return this;
this.yd = isNaN(this.ug) ? b.duration : this.ug;
this.op = this.Rs;
b.Dk &&
b.Ek === jh &&
this === b.defaultAnimation &&
((this.op = Sh),
(this.yd = isNaN(this.ug)
? 600 === b.duration
? 900
: b.duration
: this.ug));
this.Iv = a.scrollMode;
this.isViewportUnconstrained && (a.nj = Th);
th(b);
this.nl.each(function(b) {
b.data = null;
a.add(b);
});
vh(b);
this.$b = !0;
this.Gd = +new Date();
this.Km = this.Gd + this.yd;
yh(b, this);
return this;
};
t.oy = function(a, b) {
if (!a.Tc()) return this;
this.nl.add(a);
this.H = b;
return this;
};
t.add = function(a, b, c, d, e) {
if ('position' === b && c.C(d)) return this;
null === this.H &&
(a instanceof Q
? (this.H = a)
: a instanceof Y && null !== a.diagram && (this.H = a.diagram));
if (a instanceof U) {
if (!a.isAnimated) return this;
'position' === b && (b = 'position:part');
}
Ch(this, a, b, c, d, e);
return this;
};
function Ch(a, b, c, d, e, f) {
var g = a.rc;
b instanceof Q && 'position' === c && (c = 'position:diagram');
if (
'fill' === c ||
'stroke' === c ||
'background' === c ||
'areaBackground' === c
)
Uh(d),
Vh(),
(d = [Wh.j, Wh.u, Wh.m, Wh.F]),
Uh(e),
Vh(),
(e = [Wh.j, Wh.u, Wh.m, Wh.F]);
if (g.contains(b)) {
var h = g.I(b);
var k = h.start;
var l = h.end;
void 0 === k[c] && (k[c] = Xh(d));
l[c] = Xh(e);
} else
(k = {}),
(l = {}),
(k[c] = Xh(d)),
(l[c] = Xh(e)),
(h = k.position),
b instanceof Y &&
h instanceof I &&
!h.v() &&
b.diagram.animationManager.Sd.contains('Expand SubGraph') &&
h.assign(l.position),
(h = new Yh(k, l, f)),
g.add(b, h);
g = k[c];
g instanceof I && !g.v() && g.assign(a.m);
f && 0 === c.indexOf('position:') && b instanceof U
? (h.uu.location = Xh(b.location))
: f && (h.uu[c] = Xh(d));
}
function Xh(a) {
return a instanceof I ? a.copy() : a instanceof K ? a.copy() : a;
}
t.es = function(a) {
if (!this.$b) return !1;
a = this.rc.I(a);
return null !== a && a.Wu;
};
t.Ju = function(a) {
if (!this.$b) return !1;
a = this.rc.I(a);
return null !== a && (a.start.position || a.start.location);
};
function zh(a, b) {
if (!a.Mk || b) {
var c = a.Rd;
if (!1 !== a.$b) {
var d = +new Date(),
e = d > a.Km ? a.yd : d - a.Gd;
b &&
((e = a.Lv),
e < a.yd
? ((a.Gd = +new Date() - e), (a.Km = a.Gd + a.yd))
: (e = a.yd));
th(c);
uh(a, e);
zf(a.H, !0);
vh(c);
d > a.Km &&
(a.Kn && !a.Lk
? ((a.Gd = +new Date()), (a.Km = a.Gd + a.yd), (a.Lk = !0))
: a.ul(!1));
}
}
}
function uh(a, b) {
for (var c = a.yd, d = a.rc.iterator, e = a.Lk; d.next(); ) {
var f = d.key;
if (!(f instanceof Y && null === f.diagram)) {
var g = d.value,
h = e ? g.end : g.start;
g = e ? g.start : g.end;
var k = Ph,
l;
for (l in g)
('position' === l &&
(g['position:placeholder'] || g['position:nodeCollapse'])) ||
null === k.get(l) ||
k.get(l)(f, h[l], g[l], a.op, b, c, a);
}
}
}
t.stop = function() {
if (!this.$b) return this;
this.ul(!0);
return this;
};
t.ul = function(a) {
null !== this.au && this.au.Mn.remove(this.rw);
if (this.$b) {
var b = this.H,
c = this.Rd;
this.Mk = this.$b = c.Dk = !1;
th(c);
for (var d = this.rc, e = this.nl.iterator; e.next(); ) b.remove(e.value);
for (e = this.zt.iterator; e.next(); ) e.value.w();
e = this.Kn;
d = d.iterator;
for (var f = Ph; d.next(); ) {
var g = d.key,
h = d.value,
k = e ? h.end : h.start,
l = e ? h.start : h.end,
m = h.uu,
n;
for (n in l)
if (null !== f.get(n)) {
var p = n;
!h.ou ||
('position:nodeCollapse' !== p && 'position:placeholder' !== p) ||
(p = 'position');
f.get(p)(
g,
k[n],
void 0 !== m[n] ? m[n] : h.ou ? k[n] : l[n],
this.op,
this.yd,
this.yd,
this,
);
}
h.ou &&
void 0 !== m.location &&
g instanceof U &&
(g.location = m.location);
h.Wu && g instanceof U && g.Ub(!1);
}
b.Zr.clear();
Ye(b, !1);
b.Va();
b.N();
zf(b, !0);
if (c.defaultAnimation === this) {
for (n = c.dl.iterator; n.next(); )
(e = n.value), null !== e.ef && ((e.points = e.ef), (e.ef = null));
c.dl.clear();
}
zf(b, !0);
this.isViewportUnconstrained && (b.scrollMode = this.Iv);
vh(c);
this.Gt++;
!a && this.It > this.Gt
? ((this.Lk = !1), this.start())
: (this.Lm && this.Lm(this), qh(this, null), c.ul(this), b.Mb());
}
};
t.xj = function(a, b) {
var c = b.actualBounds,
d = null;
b instanceof qf && (d = b.placeholder);
null !== d
? ((c = d.ia(tc)),
(d = d.padding),
(c.x += d.left),
(c.y += d.top),
this.add(a, 'position', c, a.position, !1))
: this.add(
a,
'position',
new I(c.x + c.width / 2, c.y + c.height / 2),
a.position,
!1,
);
this.add(a, 'scale', 0.01, a.scale, !1);
if (a instanceof qf)
for (a = a.memberParts; a.next(); )
(d = a.value), d instanceof V && this.xj(d, b);
};
t.vj = function(a, b) {
if (a.isVisible()) {
var c = null;
b instanceof qf && (c = b.placeholder);
null !== c
? this.add(a, 'position:placeholder', a.position, c, !0)
: this.add(a, 'position:nodeCollapse', a.position, b, !0);
this.add(a, 'scale', a.scale, 0.01, !0);
c = this.rc;
c.contains(a) && (c.I(a).Wu = !0);
if (a instanceof qf)
for (a = a.memberParts; a.next(); )
(c = a.value), c instanceof V && this.vj(c, b);
}
};
t.lz = function(a) {
var b = this.yt.get(a);
null === b && ((b = {}), this.yt.add(a, b));
return b;
};
ma.Object.defineProperties(kh.prototype, {
duration: {
get: function() {
return this.ug;
},
set: function(a) {
1 > a && wa(a, '>= 1', kh, 'duration');
this.ug = a;
},
},
reversible: {
get: function() {
return this.Kn;
},
set: function(a) {
this.Kn = a;
},
},
runCount: {
get: function() {
return this.It;
},
set: function(a) {
0 < a
? (this.It = a)
: C('Animation.runCount value must be a positive integer.');
},
},
finished: {
get: function() {
return this.Lm;
},
set: function(a) {
this.Lm !== a && (this.Lm = a);
},
},
easing: {
get: function() {
return this.Rs;
},
set: function(a) {
this.Rs = a;
},
},
isViewportUnconstrained: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
isAnimating: {
get: function() {
return this.$b;
},
},
});
kh.prototype.getTemporaryState = kh.prototype.lz;
kh.prototype.stop = kh.prototype.stop;
kh.prototype.add = kh.prototype.add;
kh.prototype.addTemporaryPart = kh.prototype.oy;
function Qh(a, b, c, d) {
a /= d / 2;
return 1 > a ? (c / 2) * a * a + b : (-c / 2) * (--a * (a - 2) - 1) + b;
}
function Sh(a, b, c, d) {
return a === d ? b + c : c * (-Math.pow(2, (-10 * a) / d) + 1) + b;
}
kh.className = 'Animation';
kh.EaseLinear = function(a, b, c, d) {
return (c * a) / d + b;
};
kh.EaseInOutQuad = Qh;
kh.EaseInQuad = function(a, b, c, d) {
return c * (a /= d) * a + b;
};
kh.EaseOutQuad = function(a, b, c, d) {
return -c * (a /= d) * (a - 2) + b;
};
kh.EaseInExpo = function(a, b, c, d) {
return 0 === a ? b : c * Math.pow(2, 10 * (a / d - 1)) + b;
};
kh.EaseOutExpo = Sh;
function Yh(a, b, c) {
this.start = a;
this.end = b;
this.uu = {};
this.ou = c;
this.Wu = !1;
}
Yh.className = 'AnimationState';
function Zh(a, b, c) {
this.sd = null;
this.df = a;
this.Vn = c || $h;
this.hk = null;
void 0 !== b && ((this.hk = b), void 0 === c && (this.Vn = ai));
}
Zh.prototype.copy = function() {
var a = new Zh(this.df);
a.Vn = this.Vn;
var b = this.hk;
if (null !== b) {
var c = {};
void 0 !== b.duration && (c.duration = b.duration);
void 0 !== b.finished && (c.finished = b.finished);
void 0 !== b.easing && (c.easing = b.easing);
a.hk = c;
}
return a;
};
function bi(a, b) {
a = a.hk;
null !== a &&
(a.duration && (b.duration = a.duration),
a.finished && (b.finished = a.finished),
a.easing && (b.easing = a.easing));
}
ma.Object.defineProperties(Zh.prototype, {
propertyName: {
get: function() {
return this.df;
},
set: function(a) {
this.df = a;
},
},
animationSettings: {
get: function() {
return this.hk;
},
set: function(a) {
this.hk = a;
},
},
startCondition: {
get: function() {
return this.Vn;
},
set: function(a) {
this.Vn = a;
},
},
});
var $h = new D(Zh, 'Default', 1),
ai = new D(Zh, 'Immediate', 2),
ci = new D(Zh, 'Bundled', 3);
Zh.className = 'AnimationTrigger';
Zh.Default = $h;
Zh.Immediate = ai;
Zh.Bundled = ci;
function di(a) {
Ra(this);
this.H = null;
this.Ma = new E();
this.va = '';
this.tb = 1;
this.m = !1;
this.j = this.Nh = this.u = this.Ii = this.Hi = this.Gi = this.Fi = this.Di = this.Ei = this.Ci = this.Ki = this.Bi = this.Ji = this.Ai = this.zi = !0;
this.Bn = [];
a && Object.assign(this, a);
}
t = di.prototype;
t.clear = function() {
this.Ma.clear();
this.Bn.length = 0;
};
t.Le = function(a) {
this.H = 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.Ma.iterator;
h.next();
) {
var k = h.value;
k instanceof qf
? e++
: k instanceof V
? d++
: k instanceof T
? f++
: k instanceof ue
? 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.Ma.iterator; a.next(); )
(c = a.value),
(h += '\n ' + c.toString()),
(d = c.data),
null !== d && cb(d) && (h += ' #' + cb(d)),
c instanceof V
? (h += ' ' + Ia(d))
: c instanceof T &&
(h += ' ' + Ia(c.fromNode) + ' ' + Ia(c.toNode));
return b + ' ' + this.Ma.count + ': ' + h;
};
t.ec = function(a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
if (!1 === this.Nh) return null;
var d = !1;
null !== this.diagram && this.diagram.viewportBounds.ba(a) && (d = !0);
for (var e = I.alloc(), f = this.Ma.s, g = f.length; g--; ) {
var h = f[g];
if (
(!0 !== d || !1 !== ig(h)) &&
h.isVisible() &&
(e.assign(a),
yb(e, h.ge),
(h = h.ec(e, b, c)),
null !== h &&
(null !== b && (h = b(h)), null !== h && (null === c || c(h))))
)
return I.free(e), h;
}
I.free(e);
return null;
};
t.di = function(a, b, c, d) {
void 0 === b && (b = null);
void 0 === c && (c = null);
d instanceof E || d instanceof G || (d = new G());
if (!1 === this.Nh) return d;
var e = !1;
null !== this.diagram && this.diagram.viewportBounds.ba(a) && (e = !0);
for (var f = I.alloc(), g = this.Ma.s, h = g.length; h--; ) {
var k = g[h];
if ((!0 !== e || !1 !== ig(k)) && k.isVisible()) {
f.assign(a);
yb(f, k.ge);
var l = k;
k.di(f, b, c, d) &&
(null !== b && (l = b(l)),
null === l || (null !== c && !c(l)) || d.add(l));
}
}
I.free(f);
return d;
};
t.tf = 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 G || (e = new G());
if (!1 === this.Nh) return e;
var f = !1;
null !== this.diagram && this.diagram.viewportBounds.Ee(a) && (f = !0);
for (var g = this.Ma.s, h = g.length; h--; ) {
var k = g[h];
if ((!0 !== f || !1 !== ig(k)) && k.isVisible()) {
var l = k;
k.tf(a, b, c, d, e) &&
(null !== b && (l = b(l)),
null === l || (null !== c && !c(l)) || e.add(l));
}
}
return e;
};
t.zu = function(a, b, c, d, e, f, g) {
if (!1 === this.Nh) return e;
for (var h = this.Ma.s, k = h.length; k--; ) {
var l = h[k];
if ((!0 !== g || !1 !== ig(l)) && f(l) && l.isVisible()) {
var m = l;
l.tf(a, b, c, d, e) &&
(null !== b && (m = b(m)),
null === m || (null !== c && !c(m)) || e.add(m));
}
}
return e;
};
t.hg = 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 G) f = e;
e = !0;
}
f instanceof E || f instanceof G || (f = new G());
if (!1 === this.Nh) return f;
var g = !1;
null !== this.diagram && this.diagram.viewportBounds.ba(a) && (g = !0);
for (var h = I.alloc(), k = I.alloc(), l = this.Ma.s, m = l.length; m--; ) {
var n = l[m];
if ((!0 !== g || !1 !== ig(n)) && n.isVisible()) {
h.assign(a);
yb(h, n.ge);
k.h(a.x + b, a.y);
yb(k, n.ge);
var p = n;
n.hg(h, k, c, d, e, f) &&
(null !== c && (p = c(p)),
null === p || (null !== d && !d(p)) || f.add(p));
}
}
I.free(h);
I.free(k);
return f;
};
t.Pd = function(a, b) {
if (this.visible) {
var c = this.Ma.s,
d = c.length;
if (0 !== d) {
a = Ea();
for (var e = Ea(), f = 0; f < d; f++) {
var g = c[f];
g.aw = f;
if (g instanceof T) {
if (!1 === g.xd) continue;
} else if (g instanceof ue && null !== g.adornedPart) continue;
var h = g.actualBounds;
g.isVisible() && Yb(h, b)
? (g.Pd(!0), a.push(g))
: (g.Pd(!1),
null !== g.adornments && 0 < g.adornments.count && e.push(g));
}
for (b = 0; b < a.length; b++)
for (c = a[b], ei(c), c = c.adornments; c.next(); )
(d = c.value), d.measure(Infinity, Infinity), d.arrange(), d.Pd(!0);
for (b = 0; b < e.length; b++) ei(e[b]);
Ga(a);
Ga(e);
}
}
};
function fi(a, b) {
var c = 1;
1 !== a.tb && ((c = b.globalAlpha), (b.globalAlpha = c * a.tb));
return c;
}
t.tc = function(a, b, c) {
if (
this.visible &&
0 !== this.tb &&
(void 0 === c && (c = !0), c || !this.isTemporary)
) {
c = this.Ma.s;
var d = c.length;
if (0 !== d) {
var e = fi(this, a),
f = this.Bn;
f.length = 0;
for (var g = b.scale, h = M.alloc(), k = 0; k < d; k++)
this.$h(a, c[k], b, f, g, h, !0);
M.free(h);
a.globalAlpha = e;
}
}
};
t.$h = function(a, b, c, d, e, f, g) {
if (!g || ig(b)) {
if (
null !== d &&
b instanceof T &&
(b.isOrthogonal && d.push(b), !1 === b.xd)
)
return;
g = !1;
for (d = b.containingGroup; null !== d; )
g
? null !== d.ib && f.ix(d.ib)
: null !== d.ib && ((g = !0), f.assign(d.ib)),
(d = d.containingGroup);
var h = b.actualBounds;
d = !1;
if (g && b.isVisible()) {
if (!f.Sc(h)) return;
d = !f.Ee(h);
}
d &&
(a.save(),
a.beginPath(),
a.rect(f.x, f.y, f.width, f.height),
a.clip());
h.width * e > c.nq || h.height * e > c.nq
? b.tc(a, c)
: ((e = b.actualBounds),
(f = b.naturalBounds),
0 === e.width ||
0 === e.height ||
isNaN(e.x) ||
isNaN(e.y) ||
!b.isVisible() ||
((c = b.transform),
null !== b.areaBackground &&
(gi(b, a, b.areaBackground, !0, !0, f, e),
a.fillRect(e.x, e.y, e.width, e.height)),
null === b.areaBackground &&
null === b.background &&
(gi(b, a, 'rgba(0,0,0,0.3)', !0, !1, f, e),
a.fillRect(e.x, e.y, e.width, e.height)),
null !== b.background &&
(a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy),
gi(b, a, b.background, !0, !1, f, e),
a.fillRect(0, 0, f.width / 2, f.height / 2),
c.Ur() ||
((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),
)))));
d && (a.restore(), a.Oc(!0));
}
};
t.g = function(a, b, c, d, e) {
var f = this.diagram;
null !== f && f.bb(de, a, this, b, c, d, e);
};
t.ii = function(a, b, c) {
var d = this.Ma;
b.Ah = this;
if (a >= d.count) a = d.count;
else if (d.K(a) === b) return -1;
d.Cb(a, b);
b.yo(c);
d = this.diagram;
null !== d && (c ? d.N() : d.ii(b));
hi(this, a, b);
return a;
};
t.lc = function(a, b, c) {
if (!c && b.layer !== this && null !== b.layer) return b.layer.lc(a, b, c);
var d = this.Ma;
if (0 > a || a >= d.length) {
if (((a = d.indexOf(b)), 0 > a)) return -1;
} else if (d.K(a) !== b && ((a = d.indexOf(b)), 0 > a)) return -1;
b.zo(c);
d.mb(a);
d = this.diagram;
null !== d && (c ? d.N() : d.lc(b));
b.Ah = null;
return a;
};
function hi(a, b, c) {
b = ii(a, b, c);
if (c instanceof qf && null !== c && isNaN(c.zOrder)) {
if (0 !== c.memberParts.count) {
for (var d = -1, e = a.Ma.s, 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.Ma), e.mb(b), e.Cb(d, c));
}
c = c.containingGroup;
null !== c && hi(a, -1, c);
}
}
function ii(a, b, c) {
var d = c.zOrder;
if (isNaN(d)) return b;
a = a.Ma;
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.K(f).zOrder;
if (!isNaN(g)) break;
f--;
}
for (var h = b + 1, k = NaN; h < e; ) {
k = a.K(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.Cb(f, c);
return f;
}
for (g = NaN; 0 <= --f && ((g = a.K(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.Cb(h, c);
return h;
}
for (k = NaN; ++h < e && ((k = a.K(h).zOrder), isNaN(k)); );
}
return b;
}
ma.Object.defineProperties(di.prototype, {
parts: {
get: function() {
return this.Ma.iterator;
},
},
partsBackwards: {
get: function() {
return this.Ma.iteratorBackwards;
},
},
diagram: {
get: function() {
return this.H;
},
},
name: {
get: function() {
return this.va;
},
set: function(a) {
var b = this.va;
if (b !== a) {
var c = this.diagram;
if (null !== c)
for (
'' === b && C('Cannot rename default Layer to: ' + a),
c = c.layers;
c.next();
)
c.value.name === a &&
C('Layer.name is already present in this diagram: ' + a);
this.va = a;
this.g('name', b, a);
for (a = this.Ma.iterator; a.next(); ) a.value.layerName = this.va;
}
},
},
opacity: {
get: function() {
return this.tb;
},
set: function(a) {
var b = this.tb;
b !== a &&
((0 > a || 1 < a) && wa(a, '0 <= value <= 1', di, 'opacity'),
(this.tb = a),
this.g('opacity', b, a),
(a = this.diagram),
null !== a && a.N());
},
},
isTemporary: {
get: function() {
return this.m;
},
set: function(a) {
var b = this.m;
if (b !== a) {
if ((this.m = a)) this.isInDocumentBounds = !1;
this.g('isTemporary', b, a);
}
},
},
visible: {
get: function() {
return this.u;
},
set: function(a) {
var b = this.u;
if (b !== a) {
this.u = a;
this.g('visible', b, a);
for (b = this.Ma.iterator; b.next(); ) b.value.Ub(a);
a = this.diagram;
null !== a && a.N();
}
},
},
pickable: {
get: function() {
return this.Nh;
},
set: function(a) {
var b = this.Nh;
b !== a && ((this.Nh = a), this.g('pickable', b, a));
},
},
isInDocumentBounds: {
get: function() {
return this.j;
},
set: function(a) {
this.j !== a &&
((this.j = a), null !== this.diagram && this.diagram.Va());
},
},
allowCopy: {
get: function() {
return this.zi;
},
set: function(a) {
var b = this.zi;
b !== a && ((this.zi = a), this.g('allowCopy', b, a));
},
},
allowDelete: {
get: function() {
return this.Ai;
},
set: function(a) {
var b = this.Ai;
b !== a && ((this.Ai = a), this.g('allowDelete', b, a));
},
},
allowTextEdit: {
get: function() {
return this.Ji;
},
set: function(a) {
var b = this.Ji;
b !== a && ((this.Ji = a), this.g('allowTextEdit', b, a));
},
},
allowGroup: {
get: function() {
return this.Bi;
},
set: function(a) {
var b = this.Bi;
b !== a && ((this.Bi = a), this.g('allowGroup', b, a));
},
},
allowUngroup: {
get: function() {
return this.Ki;
},
set: function(a) {
var b = this.Ki;
b !== a && ((this.Ki = a), this.g('allowUngroup', b, a));
},
},
allowLink: {
get: function() {
return this.Ci;
},
set: function(a) {
var b = this.Ci;
b !== a && ((this.Ci = a), this.g('allowLink', b, a));
},
},
allowRelink: {
get: function() {
return this.Ei;
},
set: function(a) {
var b = this.Ei;
b !== a && ((this.Ei = a), this.g('allowRelink', b, a));
},
},
allowMove: {
get: function() {
return this.Di;
},
set: function(a) {
var b = this.Di;
b !== a && ((this.Di = a), this.g('allowMove', b, a));
},
},
allowReshape: {
get: function() {
return this.Fi;
},
set: function(a) {
var b = this.Fi;
b !== a && ((this.Fi = a), this.g('allowReshape', b, a));
},
},
allowResize: {
get: function() {
return this.Gi;
},
set: function(a) {
var b = this.Gi;
b !== a && ((this.Gi = a), this.g('allowResize', b, a));
},
},
allowRotate: {
get: function() {
return this.Hi;
},
set: function(a) {
var b = this.Hi;
b !== a && ((this.Hi = a), this.g('allowRotate', b, a));
},
},
allowSelect: {
get: function() {
return this.Ii;
},
set: function(a) {
var b = this.Ii;
b !== a && ((this.Ii = a), this.g('allowSelect', b, a));
},
},
});
di.prototype.findObjectsNear = di.prototype.hg;
di.prototype.findObjectsIn = di.prototype.tf;
di.prototype.findObjectsAt = di.prototype.di;
di.prototype.findObjectAt = di.prototype.ec;
di.className = 'Layer';
function Q(a, b) {
ji || (ki(), (ji = !0));
Ra(this);
le = this;
this.wb = !0;
this.La = null;
this.Aa = this.Ba = 0;
this.Ha = null;
if (Og) {
var c = this,
d = function() {
c.removeEventListener(x.document, 'DOMContentLoaded', d, !1);
c.setRTL();
};
null !== x.document.body
? this.setRTL()
: c.addEventListener(x.document, 'DOMContentLoaded', d, !1);
}
this.cl = null;
li.add('Model', mi);
var e = this;
this.Db = function(a) {
var b = e.partManager;
if (a.model === b.diagram.model && b.diagram.$) {
b.diagram.$ = !1;
try {
var c = a.change;
'' === a.modelChange &&
c === de &&
b.updateDataBindings(a.object, a.propertyName);
} finally {
b.diagram.$ = !0;
}
}
};
this.Hc = function(a) {
e.partManager.doModelChanged(a);
};
this.Nt = this.Qt = null;
ni(this);
this.model = oi();
this.Mg = !0;
pi(this);
this.layout = new qi();
this.Mg = !1;
this.Yj = this.Zj = this.Xj = this.Wj = this.Iz = this.Sj = this.sv = null;
this.Jo = function() {};
this.preventDefault = null;
this.Ym = !1;
this.vh = new ri();
void 0 !== a &&
('string' === typeof a || (x.Element && a instanceof Element)
? si(this, a)
: (b = a));
this.wb = !1;
b && this.Vl(b);
return this;
}
var ti, le;
function ni(a) {
a.Rd = new gh();
a.Rd.Le(a);
a.Ab = 17;
a.kw = !1;
a.$m = !1;
a.Ht = 'default';
a.Ua = new E();
a.Yx = new pb();
a.Ax();
a.zx();
a.tb = 1;
a.pa = new I(NaN, NaN).freeze();
a.Jt = new I(NaN, NaN);
a.xa = 1;
a.sp = 1;
a.bt = new I(NaN, NaN).freeze();
a.ct = NaN;
a.tt = 1e-4;
a.pt = 100;
a.Bb = new md();
a.eu = new I(NaN, NaN).freeze();
a.Xs = new M(NaN, NaN, NaN, NaN).freeze();
a.mj = new ec(0, 0, 0, 0).freeze();
a.nj = Rh;
a.Tt = !1;
a.Et = null;
a.Lt = null;
a.nh = rh;
a.mk = Wc;
a.wg = rh;
a.Rp = Wc;
a.at = tc;
a.dt = tc;
a.bd = !0;
a.Wm = !1;
a.te = new G();
a.th = new pb();
a.Fm = !0;
a.Yo = 250;
a.ik = -1;
a.$o = new ec(16, 16, 16, 16).freeze();
a.cg = !1;
a.xk = !1;
a.Nm = !0;
a.Fp = new $d();
a.Fp.diagram = a;
a.Hg = new $d();
a.Hg.diagram = a;
a.Yi = new $d();
a.Yi.diagram = a;
a.qg = null;
a.bf = null;
a.Wt = !1;
ui(a);
a.Uh = new G();
a.kt = !0;
a.$t = vi;
a.Vv = !1;
a.bu = Ef;
a.Ks = 'auto';
a.rp = 'auto';
a.oh = null;
a.uh = null;
a.qh = null;
a.Jh = null;
a.Hh = null;
a.Gh = null;
a.vt = null;
a.Eh = null;
a.$s = !1;
a.Fh = null;
a.Ih = null;
a.Th = null;
a.rh = null;
a.wt = !1;
a.Dt = {};
a.$k = [null, null];
a.Mg = !1;
a.mw = !1;
a.Ut = !1;
a.Ns = !1;
a.Xv = !0;
a.cd = !1;
a.Vi = !1;
a.xw = !0;
a.se = -2;
a.Fg = new pb();
a.Fn = new E();
a.xg = !1;
a.Ad = !0;
a.ws = !0;
a.zi = !0;
a.Ai = !0;
a.xs = !1;
a.ys = !0;
a.Ji = !0;
a.Bi = !0;
a.Ki = !0;
a.As = !0;
a.Ci = !0;
a.Ei = !0;
a.Di = !0;
a.Fi = !0;
a.Gi = !0;
a.Hi = !0;
a.Ii = !0;
a.Bs = !0;
a.Ds = !0;
a.Wv = !1;
a.Kk = !1;
a.Tm = !0;
a.Um = !0;
a.zs = !0;
a.Cs = !0;
a.Ot = 16;
a.St = 16;
a.Nq = !1;
a.Mt = !1;
a.Rt = 0;
a.Pt = 0;
a.ub = new ec(5).freeze();
a.lw = new G().freeze();
a.qt = 999999999;
a.Tv = new G().freeze();
a.Si = !0;
a.Ti = !0;
a.Ui = !0;
a.We = !1;
a.Of = !1;
a.mh = !0;
a.Qf = !1;
a.Xx = new G();
a.Uv = new G();
a.Qh = null;
a.Fv = new K(8, 8);
a.Gv = 999;
a.fw = 1;
a.nw = 0;
a.kd = {
scale: 1,
position: new I(),
bounds: new M(),
Hw: new K(),
sx: new K(),
lx: !1,
};
a.vw = new M(NaN, NaN, NaN, NaN).freeze();
a.Zn = new K(NaN, NaN).freeze();
a.wp = new M(NaN, NaN, NaN, NaN).freeze();
a.lt = !1;
a.Dg = new pb();
var b = new V(),
c = new Qg();
c.bind(new wi('text', '', Ia));
b.add(c);
a.Tx = b;
a.Dg.add('', b);
b = new V();
c = new Qg();
c.stroke = 'brown';
c.bind(new wi('text', '', Ia));
b.add(c);
a.Dg.add('Comment', b);
b = new V();
b.selectable = !1;
b.avoidable = !1;
c = new Cf();
c.figure = 'Ellipse';
c.fill = 'black';
c.stroke = null;
c.desiredSize = new K(3, 3).ha();
b.add(c);
a.Dg.add('LinkLabel', b);
a.Ri = new pb();
b = new qf();
b.selectionObjectName = 'GROUPPANEL';
b.type = W.Vertical;
c = new Qg();
c.font = 'bold 12pt sans-serif';
c.bind(new wi('text', '', Ia));
b.add(c);
c = new W(W.Auto);
c.name = 'GROUPPANEL';
var d = new Cf();
d.figure = 'Rectangle';
d.fill = 'rgba(128,128,128,0.2)';
d.stroke = 'black';
c.add(d);
d = new jg();
d.padding = new ec(5, 5, 5, 5).ha();
c.add(d);
b.add(c);
a.Rx = b;
a.Ri.add('', b);
a.Ch = new pb();
b = new T();
c = new Cf();
c.isPanelMain = !0;
b.add(c);
c = new Cf();
c.toArrow = 'Standard';
c.fill = 'black';
c.stroke = null;
c.strokeWidth = 0;
b.add(c);
a.Sx = b;
a.Ch.add('', b);
b = new T();
c = new Cf();
c.isPanelMain = !0;
c.stroke = 'brown';
b.add(c);
a.Ch.add('Comment', b);
b = new ue();
b.type = W.Auto;
c = new Cf();
c.fill = null;
c.stroke = 'dodgerblue';
c.strokeWidth = 3;
b.add(c);
c = new jg();
c.margin = new ec(1.5, 1.5, 1.5, 1.5).ha();
b.add(c);
a.xt = b;
a.Zs = b;
b = new ue();
b.type = W.Link;
c = new Cf();
c.isPanelMain = !0;
c.fill = null;
c.stroke = 'dodgerblue';
c.strokeWidth = 3;
b.add(c);
a.nt = b;
a.Zd = null;
a.Op = !1;
a.qk = null;
a.partManager = new mi();
a.toolManager = new La();
a.toolManager.initializeStandardTools();
a.defaultTool = a.toolManager;
a.currentTool = a.defaultTool;
a.Ps = null;
a.Em = new Ce();
a.At = null;
a.Bt = null;
a.jr = !1;
a.commandHandler = xi();
a.kr = !1;
a.Hp = null;
a.Ip = ub;
a.tw = !1;
a.kc = 1;
a.Rh = null;
a.nq = 1;
a.rq = 0;
a.dw = [0, 0, 0, 0, 0];
a.sq = 0;
a.Yp = 1;
a.Zv = 0;
a.$v = new I();
a.hy = 500;
a.Zo = new I();
a.jt = !1;
}
Q.prototype.clear = function() {
this.animationManager.wc();
this.model.clear();
yi = null;
zi = '';
Ai(this, !1);
this.Fn.clear();
Bi();
this.Fg.clear();
this.Qh = null;
this.Va();
this.Za();
this.N();
};
function Ai(a, b) {
a.animationManager.wc(!0);
a.lw = new G().freeze();
a.Tv = new G().freeze();
var c = a.skipsUndoManager,
d = null !== a.ac && void 0 !== a.ac;
d && (a.skipsUndoManager = !0);
var e = null;
null !== a.Zd && ((e = a.Zd.part), null !== e && a.remove(e));
var f = [],
g = a.Ua.length;
if (b) {
for (b = 0; b < g; b++)
for (var h = a.Ua.s[b].parts; h.next(); ) {
var k = h.value;
k !== e && null === k.data && f.push(k);
}
for (b = 0; b < f.length; b++) a.remove(f[b]);
}
for (b = 0; b < g; b++) a.Ua.s[b].clear();
a.partManager.clear();
a.te.clear();
a.th.clear();
a.Uh.clear();
a.qk = null;
a.Fn.clear();
Bi();
a.Fg.clear();
Fa = [];
null !== e && (a.add(e), a.partManager.parts.remove(e));
d && (a.skipsUndoManager = c);
return f;
}
function xi() {
return null;
}
Q.prototype.reset = function() {
this.clear();
this.wb = !0;
ni(this);
Ci(this);
this.Mg = !0;
pi(this);
this.layout = new qi();
this.Mg = !1;
this.model = oi();
this.model.undoManager = new ie();
this.wb = this.Ym = !1;
this.N();
};
Q.prototype.setRTL = function(a) {
a = void 0 === a ? this.div : a;
null === a && (a = x.document.body);
var b = ua('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.Ht = c;
};
Q.prototype.setScrollWidth = function(a) {
a = void 0 === a ? this.div : a;
null === a && (a = x.document.body);
var b = 0;
if (Og) {
var c = Di;
b = ti;
null === c &&
((c = Di = ua('p')),
(c.style.width = '100%'),
(c.style.height = '200px'),
(c.style.boxSizing = 'content-box'),
(b = ti = ua('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 || Qa || (b = 11);
}
this.Ab = b;
this.kw = !0;
};
Q.prototype.ob = function(a) {
a.classType === Q && (this.autoScale = a);
};
Q.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.Ua.iterator; c.next(); )
b += '\n ' + c.value.toString(a - 1);
return b;
};
Q.prototype.addEventListener = function(a, b, c, d) {
a.addEventListener(b, c, {
capture: d,
passive: !1,
});
};
Q.prototype.removeEventListener = function(a, b, c, d) {
a.removeEventListener(b, c, {
capture: d,
});
};
function Ei(a) {
var b = a.Ha.Sa;
b instanceof HTMLCanvasElement &&
(a.addEventListener(b, 'pointerdown', a.Wj, !1),
a.addEventListener(b, 'pointermove', a.Xj, !1),
a.addEventListener(b, 'pointerup', a.Zj, !1),
a.addEventListener(b, 'pointerout', a.Yj, !1),
a.addEventListener(b, 'pointerenter', a.Jy, !1),
a.addEventListener(b, 'pointerleave', a.Ky, !1),
a.addEventListener(b, 'wheel', a.Sj, !1),
a.addEventListener(b, 'keydown', a.yz, !1),
a.addEventListener(b, 'keyup', a.zz, !1),
a.addEventListener(b, 'blur', a.vy, !1),
a.addEventListener(b, 'focus', a.wy, !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(x, 'resize', a.sv, !1),
Qa &&
a.addEventListener(
b,
'touchstart',
function(a) {
a.preventDefault();
},
!1,
));
}
function Ge(a) {
30 < a.rq && (a.Rh = 1);
}
function Ye(a, b) {
null !== a.Rh &&
((a.Rh = null),
b && a.Jo(),
(Xa && Xa.Rw) || ((a.rq = 0), (a.dw = [0, 0, 0, 0, 0]), (a.sq = 0)));
}
Q.prototype.computePixelRatio = function() {
return null !== this.Rh ? this.Rh : x.devicePixelRatio || 1;
};
Q.prototype.doMouseMove = function() {
this.currentTool.doMouseMove();
};
Q.prototype.doMouseDown = function() {
this.currentTool.doMouseDown();
};
Q.prototype.doMouseUp = function() {
this.currentTool.doMouseUp();
};
Q.prototype.doMouseWheel = function() {
this.currentTool.doMouseWheel();
};
Q.prototype.doKeyDown = function() {
this.currentTool.doKeyDown();
};
Q.prototype.doKeyUp = function() {
this.currentTool.doKeyUp();
};
Q.prototype.doFocus = function() {
this.focus();
};
Q.prototype.focus = function() {
if (this.Ha)
if (this.scrollsPageOnFocus) this.Ha.focus();
else {
var a = x.scrollX || x.pageXOffset,
b = x.scrollY || x.pageYOffset;
this.Ha.focus();
x.scrollTo(a, b);
}
};
Q.prototype.wy = function() {
this.H.P('GainedFocus');
};
Q.prototype.vy = function() {
this.H.P('LostFocus');
};
function sh(a) {
if (null !== a.Ha) {
var b = a.La;
if (null !== b && 0 !== b.clientWidth && 0 !== b.clientHeight) {
a.kw || a.setScrollWidth();
var c = a.Of ? a.Ab : 0,
d = a.We ? a.Ab : 0,
e = a.kc;
a.kc = a.computePixelRatio();
a.kc !== e && ((a.Wm = !0), a.Mb());
if (b.clientWidth !== a.Ba + c || b.clientHeight !== a.Aa + d)
(a.Ti = !0),
(a.bd = !0),
(b = a.layout),
null !== b &&
b.isViewportSized &&
a.autoScale === rh &&
((a.xk = !0), b.D()),
a.cd || a.Mb();
}
}
}
function pi(a) {
var b = new di();
b.name = 'Background';
a.pl(b);
b = new di();
b.name = '';
a.pl(b);
b = new di();
b.name = 'Foreground';
a.pl(b);
b = new di();
b.name = 'Adornment';
b.isTemporary = !0;
b.isInDocumentBounds = !1;
a.pl(b);
b = new di();
b.name = 'Tool';
b.isTemporary = !0;
b.isInDocumentBounds = !0;
a.pl(b);
b = new di();
b.name = 'Grid';
b.allowSelect = !1;
b.pickable = !1;
b.isTemporary = !0;
b.isInDocumentBounds = !1;
a.Aw(b, a.Ij('Background'));
}
function Fi(a) {
var b = new W(W.Grid);
b.name = 'GRID';
var c = new Cf();
c.figure = 'LineH';
c.stroke = 'lightgray';
c.strokeWidth = 0.5;
c.interval = 1;
b.add(c);
c = new Cf();
c.figure = 'LineH';
c.stroke = 'gray';
c.strokeWidth = 0.5;
c.interval = 5;
b.add(c);
c = new Cf();
c.figure = 'LineH';
c.stroke = 'gray';
c.strokeWidth = 1;
c.interval = 10;
b.add(c);
c = new Cf();
c.figure = 'LineV';
c.stroke = 'lightgray';
c.strokeWidth = 0.5;
c.interval = 1;
b.add(c);
c = new Cf();
c.figure = 'LineV';
c.stroke = 'gray';
c.strokeWidth = 0.5;
c.interval = 5;
b.add(c);
c = new Cf();
c.figure = 'LineV';
c.stroke = 'gray';
c.strokeWidth = 1;
c.interval = 10;
b.add(c);
c = new U();
c.add(b);
c.layerName = 'Grid';
c.zOrder = 0;
c.isInDocumentBounds = !1;
c.isAnimated = !1;
c.pickable = !1;
c.locationObjectName = 'GRID';
a.add(c);
a.partManager.parts.remove(c);
b.visible = !1;
return b;
}
function Gi() {
this.H.Mt
? (this.H.Mt = !1)
: this.H.isEnabled
? this.H.Nw(this)
: Oi(this.H);
}
function Qi(a) {
this.H.isEnabled
? ((this.H.Rt = a.target.scrollTop), (this.H.Pt = a.target.scrollLeft))
: Oi(this.H);
}
Q.prototype.Nw = function(a) {
if (null !== this.Ha) {
var b = this.Qt,
c = this.Nt;
this.Nq = !0;
var d = this.documentBounds,
e = this.viewportBounds,
f = this.mj,
g = d.x - f.left,
h = d.y - f.top,
k = d.width + f.left + f.right,
l = d.height + f.top + f.bottom,
m = d.right + f.right;
f = d.bottom + f.bottom;
var n = e.x;
d = e.y;
var p = e.width,
r = e.height,
q = e.right,
u = e.bottom;
e = this.scale;
var w = a.scrollLeft;
if (this.$m)
switch (this.Ht) {
case 'negative':
w = w + a.scrollWidth - a.clientWidth;
break;
case 'reverse':
w = a.scrollWidth - w - a.clientWidth;
}
var v = w;
p < k || r < l
? ((w = I.allocAt(this.position.x, this.position.y)),
this.allowHorizontalScroll &&
this.Pt !== v &&
((w.x = v / e + g), (this.Pt = v)),
this.allowVerticalScroll &&
this.Rt !== a.scrollTop &&
((w.y = a.scrollTop / e + h), (this.Rt = a.scrollTop)),
(this.position = w),
I.free(w),
(this.Ti = this.Nq = !1))
: ((w = I.alloc()),
a.$x &&
this.allowHorizontalScroll &&
(g < n && (this.position = w.h(v + g, this.position.y)),
m > q &&
(this.position = w.h(
-(b.scrollWidth - this.Ba) + v - this.Ba / e + m,
this.position.y,
))),
a.ay &&
this.allowVerticalScroll &&
(h < d && (this.position = w.h(this.position.x, a.scrollTop + h)),
f > u &&
(this.position = w.h(
this.position.x,
-(b.scrollHeight - this.Aa) + a.scrollTop - this.Aa / e + f,
))),
I.free(w),
Ri(this),
(this.Ti = this.Nq = !1),
(d = this.documentBounds),
(e = this.viewportBounds),
(m = d.right),
(q = e.right),
(f = d.bottom),
(u = e.bottom),
(g = d.x),
(n = e.x),
(h = d.y),
(d = e.y),
p >= k && g >= n && m <= q && (c.style.width = '1px'),
r >= l && h >= d && f <= u && (c.style.height = '1px'));
}
};
Q.prototype.computeBounds = function(a) {
void 0 === a && (a = new M());
mh(this);
return Si(this, a);
};
function Si(a, b) {
if (a.fixedBounds.v()) return b.assign(a.fixedBounds), b.fo(a.ub), b;
for (var c = !0, d = a.Ua.s, e = d.length, f = 0; f < e; f++) {
var g = d[f];
if (g.visible && g.isInDocumentBounds) {
g = g.Ma.s;
for (var h = g.length, k = 0; k < h; k++) {
var l = g[k];
l.isInDocumentBounds &&
l.isVisible() &&
((l = l.actualBounds),
l.v() && (c ? ((c = !1), b.assign(l)) : b.Xc(l)));
}
}
}
c && b.h(0, 0, 0, 0);
b.fo(a.ub);
return b;
}
Q.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 T) ||
(e.Za(),
null === c ? (c = e.actualBounds.copy()) : c.Xc(e.actualBounds));
}
else
for (a = a.iterator; a.next(); )
(d = a.value),
(!b && d instanceof T) ||
(d.Za(),
null === c ? (c = d.actualBounds.copy()) : c.Xc(d.actualBounds));
return null === c ? new M(NaN, NaN, 0, 0) : c;
};
function Ti(a, b) {
if ((b || a.Qf) && !a.wb && null !== a.Ha && a.documentBounds.v()) {
if (b) {
var c = a.initialPosition;
if (c.v()) {
a.position = c;
return;
}
c = I.alloc();
c.oi(a.documentBounds, a.initialDocumentSpot);
var d = a.viewportBounds;
d = M.allocAt(0, 0, d.width, d.height);
var e = I.alloc();
e.oi(d, a.initialViewportSpot);
e.h(c.x - e.x, c.y - e.y);
a.position = e;
M.free(d);
I.free(e);
I.free(c);
}
a.wb = !0;
c = a.nh;
b && a.wg !== rh && (c = a.wg);
var f = c !== rh ? Ui(a, c) : a.scale;
c = a.pa.x;
d = a.pa.y;
e = a.Ba / f;
var g = a.Aa / f,
h = a.mk,
k = a.Rp;
b && !h.pb() && (k.pb() || k.Sb()) && (h = k.Sb() ? yc : k);
Vi(a, a.documentBounds, e, g, h, b);
b = a.scale;
a.scale = f;
a.wb = !1;
Wi(a);
Xi(a, !0, !1);
f = a.viewportBounds;
if (!(J.B(f.x, c) && J.B(f.y, d) && J.B(f.width, e) && J.B(f.height, g)))
a.onViewportBoundsChanged(new M(c, d, e, g), f, b, !1);
}
}
function Ui(a, b) {
var c = a.sp;
if (null === a.Ha) return c;
a.Za();
var d = a.documentBounds;
if (!d.v()) return c;
var e = d.width;
d = d.height;
var f = a.Ba + (a.Of ? a.Ab : 0),
g = a.Aa + (a.We ? a.Ab : 0),
h = f / e,
k = g / d;
return b === Yi
? ((b = Math.min(k, h)),
b > c && (b = c),
b < a.minScale && (b = a.minScale),
b > a.maxScale && (b = a.maxScale),
b)
: b === Zi
? ((b = k > h ? (g - a.Ab) / d : (f - a.Ab) / e),
b > c && (b = c),
b < a.minScale && (b = a.minScale),
b > a.maxScale && (b = a.maxScale),
b)
: a.scale;
}
Q.prototype.zoomToFit = function() {
var a = this.nj;
this.nj = Rh;
this.scale = Ui(this, Yi);
a !== Rh &&
(Ti(this, !1),
Vi(
this,
this.documentBounds,
this.Ba / this.xa,
this.Aa / this.xa,
this.mk,
!1,
));
this.nj = a;
};
t = Q.prototype;
t.kA = function(a, b) {
void 0 === b && (b = Yi);
var c = a.width,
d = a.height;
if (!(0 === c || 0 === d || (isNaN(c) && isNaN(d)))) {
var e = 1;
if (b === Yi || b === Zi)
if (isNaN(c)) e = (this.viewportBounds.height * this.scale) / d;
else if (isNaN(d)) e = (this.viewportBounds.width * this.scale) / c;
else {
e = this.Ba;
var f = this.Aa;
e =
b === Zi
? f / d > e / c
? (f - (this.We ? this.Ab : 0)) / d
: (e - (this.Of ? this.Ab : 0)) / c
: Math.min(f / d, e / c);
}
this.scale = e;
this.position = new I(a.x, a.y);
}
};
t.py = function(a, b) {
this.Za();
var c = this.documentBounds,
d = this.viewportBounds;
this.position = new I(
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),
);
};
t.gz = function(a) {
if (a instanceof Y) {
this.Hp = a;
var b = I.alloc();
this.Ip = this.Ro(a.ia(tc, b));
I.free(b);
} else (this.Hp = null), (this.Ip = ub);
};
function Vi(a, b, c, d, e, f) {
var g = I.allocAt(a.pa.x, a.pa.y),
h = g.x,
k = g.y;
if (null !== a.Hp) {
var l = I.alloc();
l = a.Hp.ia(tc, l);
h = l.x - a.Ip.x / a.scale;
k = l.y - a.Ip.y / a.scale;
e = sc;
I.free(l);
}
if (f || a.scrollMode === Rh)
e.pb() &&
(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.mj),
(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.ub.left;
g.y = isFinite(k) ? k : -a.ub.top;
null !== a.positionComputation &&
((b = a.positionComputation(a, g)), (g.x = b.x), (g.y = b.y));
Nh(a.Rd, a.pa, g);
a.pa.h(g.x, g.y);
Ci(a);
I.free(g);
}
t.wl = function(a, b) {
void 0 === b && (b = !0);
if (b) {
if (
((a = rf(
this,
a,
function(a) {
return a.part;
},
function(a) {
return a.canSelect();
},
)),
a instanceof U)
)
return a;
} else if (
((a = rf(this, a, function(a) {
return a.part;
})),
a instanceof U)
)
return a;
return null;
};
t.ec = function(a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
mh(this);
for (var d = this.Ua.iteratorBackwards; d.next(); ) {
var e = d.value;
if (e.visible && ((e = e.ec(a, b, c)), null !== e)) return e;
}
return null;
};
function rf(a, b, c, d) {
void 0 === c && (c = null);
void 0 === d && (d = null);
mh(a);
for (a = a.Ua.iteratorBackwards; a.next(); ) {
var e = a.value;
if (e.visible && !e.isTemporary && ((e = e.ec(b, c, d)), null !== e))
return e;
}
return null;
}
t.Uy = function(a, b, c) {
void 0 === b && (b = !0);
return $i(
this,
a,
function(a) {
return a.part;
},
b
? function(a) {
return a instanceof U && a.canSelect();
}
: null,
c,
);
};
function $i(a, b, c, d, e) {
void 0 === c && (c = null);
void 0 === d && (d = null);
e instanceof E || e instanceof G || (e = new G());
mh(a);
for (a = a.Ua.iteratorBackwards; a.next(); ) {
var f = a.value;
f.visible && !f.isTemporary && f.di(b, c, d, e);
}
return e;
}
t.di = function(a, b, c, d) {
void 0 === b && (b = null);
void 0 === c && (c = null);
d instanceof E || d instanceof G || (d = new G());
mh(this);
for (var e = this.Ua.iteratorBackwards; e.next(); ) {
var f = e.value;
f.visible && f.di(a, b, c, d);
}
return d;
};
t.Ww = function(a, b, c, d) {
void 0 === b && (b = !1);
void 0 === c && (c = !0);
return aj(
this,
a,
function(a) {
return a instanceof U && (!c || a.canSelect());
},
b,
d,
);
};
t.tf = 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 G || (e = new G());
mh(this);
for (var f = this.Ua.iteratorBackwards; f.next(); ) {
var g = f.value;
g.visible && g.tf(a, b, c, d, e);
}
return e;
};
t.zu = function(a, b, c, d, e, f) {
var g = new G();
mh(this);
for (var h = this.Ua.iteratorBackwards; h.next(); ) {
var k = h.value;
k.visible && k.zu(a, b, c, d, g, e, f);
}
return g;
};
function aj(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 G || (e = new G());
mh(a);
for (a = a.Ua.iteratorBackwards; a.next(); ) {
var g = a.value;
g.visible && !g.isTemporary && g.tf(b, f, c, d, e);
}
return e;
}
t.Vy = function(a, b, c, d, e) {
void 0 === c && (c = !0);
void 0 === d && (d = !0);
return bj(
this,
a,
b,
function(a) {
return a instanceof U && (!d || a.canSelect());
},
c,
e,
);
};
t.hg = 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 G) f = e;
e = !0;
}
f instanceof E || f instanceof G || (f = new G());
mh(this);
for (var g = this.Ua.iteratorBackwards; g.next(); ) {
var h = g.value;
h.visible && h.hg(a, b, c, d, e, f);
}
return f;
};
function bj(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 G) f = e;
e = !0;
}
f instanceof E || f instanceof G || (f = new G());
mh(a);
for (a = a.Ua.iteratorBackwards; a.next(); ) {
var h = a.value;
h.visible && !h.isTemporary && h.hg(b, c, g, d, e, f);
}
return f;
}
Q.prototype.acceptEvent = function(a) {
return cj(this, a, a instanceof MouseEvent);
};
function cj(a, b, c) {
var d = a.Hg;
a.Hg = a.Yi;
a.Yi = d;
d.diagram = a;
d.event = b;
c
? dj(a, b, d)
: ((d.viewPoint = a.Hg.viewPoint),
(d.documentPoint = a.Hg.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 && (d.buttons = b.buttons);
Qa && 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 = ej(b, b.target);
d.targetObject = null;
return d;
}
function ej(a, b) {
if (null === b) return null;
if ((b = b.H)) return b;
(b = a.path) ||
'function' !== typeof a.composedPath ||
(b = a.composedPath());
return b && b[0] && b[0].H ? b[0].H : null;
}
function fj(a, b, c, d, e, f) {
var g = a.Hg;
a.Hg = a.Yi;
a.Yi = g;
g.diagram = a;
g.clickCount = 1;
a = g.delta = 0;
b.ctrlKey && (a += 1);
b.altKey && (a += 2);
b.shiftKey && (a += 4);
b.metaKey && (a += 8);
g.modifiers = a;
g.event = b;
g.timestamp = b.timeStamp;
g.button = b.button;
g.buttons = b.buttons;
Qa && 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 gj(a, b) {
if (a.bubbles) return !0;
void 0 !== b.stopPropagation && b.stopPropagation();
!1 !== b.cancelable && b.preventDefault();
b.cancelBubble = !0;
return !1;
}
Q.prototype.yz = function(a) {
var b = this.H;
if (!this.H.isEnabled) return !1;
var c = cj(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 gj(c, a);
};
Q.prototype.zz = function(a) {
var b = this.H;
if (!b.isEnabled) return !1;
var c = cj(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 gj(c, a);
};
Q.prototype.Jy = function(a) {
var b = this.H;
if (!b.isEnabled) return !1;
var c = cj(b, a, !0);
null !== b.mouseEnter && b.mouseEnter(c);
return gj(c, a);
};
Q.prototype.Ky = function(a) {
var b = this.H;
if (!b.isEnabled) return !1;
var c = cj(b, a, !0);
null !== b.mouseLeave && b.mouseLeave(c);
return gj(c, a);
};
Q.prototype.getMouse = function(a) {
var b = this.Ha;
if (null === b) return new I(0, 0);
var c = b.getBoundingClientRect();
b = a.clientX - (this.Ba / c.width) * c.left;
a = a.clientY - (this.Aa / c.height) * c.top;
return null !== this.Bb ? yb(new I(b, a), this.Bb) : new I(b, a);
};
function dj(a, b, c) {
var d = a.Ha,
e = a.Ba,
f = a.Aa,
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.Bb
? ((b = I.allocAt(g, h)),
a.Bb.Ld(b),
c.documentPoint.assign(b),
I.free(b))
: c.documentPoint.h(g, h);
}
function ae(a, b, c, d) {
if (void 0 !== b.targetTouches) {
if (2 > b.targetTouches.length) return;
b = b.targetTouches[c];
} else if (null !== a.$k[0]) b = a.$k[c];
else return;
c = a.Ha;
null !== c &&
((c = c.getBoundingClientRect()),
d.h(
b.clientX - (a.Ba / c.width) * c.left,
b.clientY - (a.Aa / c.height) * c.top,
));
}
Q.prototype.Va = function() {
this.Si || ((this.Si = !0), this.Mb(!0));
};
function hj(a) {
a.cd || mh(a);
a.Za();
}
Q.prototype.redraw = function() {
this.wb || this.cd || (this.N(), Wi(this), this.nd());
};
t = Q.prototype;
t.xz = function() {
return this.cg;
};
t.Ey = function(a) {
void 0 === a && (a = null);
var b = this.animationManager,
c = b.isEnabled;
b.wc();
b.isEnabled = !1;
zf(this);
this.Qf = !1;
this.Jt = new I(NaN, NaN);
b.isEnabled = c;
this.cd = !0;
var d = this;
null !== a &&
ta(function() {
d.cd = !1;
lh(b, 'Model');
a(d);
}, 1);
};
t.Mb = function(a) {
void 0 === a && (a = !1);
if (!0 !== this.cg && !(this.wb || (!1 === a && this.cd))) {
this.cg = !0;
var b = this;
x.requestAnimationFrame(function() {
b.cg && b.nd();
});
}
};
t.nd = function() {
if (!this.Nm || this.cg) this.Nm && (this.Nm = !1), zf(this);
};
function Xi(a, b, c) {
a.animationManager.defaultAnimation.isAnimating ||
a.wb ||
!a.Ti ||
Oi(a) ||
(b && mh(a), c && Ti(a, !1));
}
function zf(a, b) {
if (!a.cd && ((a.cg = !1), null !== a.La || a.Zn.v())) {
a.cd = !0;
var c = a.animationManager,
d = a.Fn;
if (!c.isAnimating && 0 !== d.length) {
for (var e = d.s, f = e.length, g = 0; g < f; g++) {
var h = e[g];
ij(h, !1);
h.w();
}
d.clear();
}
d = a.Uv;
0 < d.count &&
(d.each(function(a) {
a.rv();
}),
d.clear());
e = d = !1;
c.defaultAnimation.isAnimating &&
((e = !0), (d = a.skipsUndoManager), (a.skipsUndoManager = !0));
c.zb || sh(a);
Xi(a, !1, !0);
null !== a.Zd &&
(a.Zd.visible && !a.Op && (jj(a), (a.Op = !0)),
!a.Zd.visible && a.Op && (a.Op = !1));
mh(a);
f = !1;
if (!a.Qf || a.mh)
a.Qf
? kj(a, !a.xk)
: (a.Da('Initial Layout'), !1 === c.isEnabled && c.wc(), kj(a, !1)),
(f = !0);
a.xk = !1;
mh(a);
a.Ut || hj(a);
Xi(a, !0, !1);
g = !1;
f
? ((c = M.alloc()),
c.assign(a.viewportBounds),
a.Qf ||
((g = a.Qf = !0),
a.skipsUndoManager || (a.undoManager.isPendingClear = !0),
(a.undoManager.isPendingUnmodified = !0),
lj(a)),
a.P('LayoutCompleted'),
c.C(a.viewportBounds) || Xi(a, !0, !1),
M.free(c))
: c.Dk &&
c.uw &&
(a.wg !== rh
? (a.scale = Ui(a, a.wg))
: a.nh !== rh
? (a.scale = Ui(a, a.nh))
: ((c = a.initialScale), isFinite(c) && 0 < c && (a.scale = c)),
Ti(a, !0));
mh(a);
f && g && a.eb('Initial Layout');
a.mu();
b || a.tc(a.Zb);
e && (a.skipsUndoManager = d);
a.cd = !1;
}
}
function lj(a) {
var b = a.xa;
if (a.wg !== rh) a.scale = Ui(a, a.wg);
else if (a.nh !== rh) a.scale = Ui(a, a.nh);
else {
var c = a.initialScale;
isFinite(c) && 0 < c && (a.scale = c);
}
a.xa !== b && (Wi(a), Xi(a, !0, !1));
Ti(a, !0);
b = a.Ua.s;
a.Pd(b, b.length, a, a.viewportBounds);
a.P('InitialLayoutCompleted');
a.Jt.assign(a.pa);
jj(a);
}
function mh(a) {
if (0 !== a.te.count && (a.cd || !a.animationManager.isTicking)) {
for (var b = 0; 23 > b; b++) {
var c = a.te.iterator;
if (null === c || 0 === a.te.count) break;
a.te = new G();
a.rv(c, a.te);
}
a.nodes.each(function(a) {
a instanceof qf && (0 !== (a.U & 65536)) !== !1 && (a.U = a.U ^ 65536);
});
}
}
t.rv = function(a, b) {
for (a.reset(); a.next(); ) {
var c = a.value;
!c.Tc() ||
c instanceof qf ||
(c.mi() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
}
for (a.reset(); a.next(); )
(c = a.value), c instanceof qf && c.isVisible() && mj(this, c);
for (a.reset(); a.next(); )
(c = a.value),
c instanceof T &&
c.isVisible() &&
(c.mi() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
for (a.reset(); a.next(); )
(c = a.value),
c instanceof ue &&
c.isVisible() &&
(c.mi() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
};
function mj(a, b) {
for (var c = Ea(), d = Ea(), e = b.memberParts; e.next(); ) {
var f = e.value;
f.isVisible() &&
(f instanceof qf
? (nj(f) || oj(f) || pj(f)) && mj(a, f)
: f instanceof T
? 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.Pd = function(a, b, c, d) {
if (this.Ui || this.animationManager.isAnimating)
for (var e = 0; e < b; e++) a[e].Pd(c, d);
};
t.tc = function(a, b) {
if (null !== this.La) {
null === this.Ha && C('No canvas specified');
var c = this.animationManager;
if (!c.zb && (!c.isAnimating || c.isTicking)) {
var d = new Date();
qj(this);
if ('0' !== this.La.style.opacity) {
var e = a !== this.Zb,
f = this.Ua.s,
g = f.length,
h = this;
this.Pd(f, g, h, h.viewportBounds);
if (e) a.Oc(!0), Ri(this);
else if (!this.bd && void 0 === b && !c.isAnimating) return;
g = this.pa;
var k = this.xa,
l = Math.round(g.x * k) / k,
m = Math.round(g.y * k) / k;
c = this.Bb;
c.reset();
1 !== k && c.scale(k);
(0 === g.x && 0 === g.y) || c.translate(-l, -m);
k = this.kc;
a.setTransform(k, 0, 0, k, 0, 0);
a.clearRect(0, 0, this.Ba, this.Aa);
1 !== this.tb && (a.globalAlpha = this.tb);
rj(this, a);
l =
void 0 !== b
? function(c) {
if (c.visible && 0 !== c.tb) {
var d = c.Ma.s,
e = d.length;
if (0 !== e) {
var f = fi(c, a),
g = c.Bn;
g.length = 0;
for (var k = h.scale, l = M.alloc(), m = 0; m < e; m++) {
var n = d[m];
b.contains(n) || c.$h(a, n, h, g, k, l, !0);
}
M.free(l);
a.globalAlpha = f;
}
}
}
: function(b) {
b.tc(a, h);
};
g = f.length;
for (m = 0; m < g; m++)
a.setTransform(k, 0, 0, k, 0, 0),
a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy),
a.Pc(),
l(f[m]);
f = !1;
this.vh ? sj(this.vh, this) && (f = this.Qs()) : (f = !0);
f && (md.prototype.Ld = md.prototype.Fw);
e ? (this.Zb.Oc(!0), Ri(this)) : (this.bd = this.Ui = !1);
f = +new Date() - +d;
e = Xa && Xa.Rw;
d = this.dw;
if (e || null === this.Rh) {
d[this.sq] = f;
this.sq = (this.sq + 1) % d.length;
for (c = f = 0; c < d.length; c++) f += d[c];
this.rq = f / d.length;
}
1 !== this.tb && (a.globalAlpha = 1);
if (e)
for (a.setTransform(1, 0, 0, 1, 0, 0), e = 0; e < d.length; e++)
a.fillText(d[e].toString(), 20, 150 + +(20 * e));
}
}
}
};
function tj(a, b, c, d, e, f, g, h, k, l) {
if (null !== a.La) {
null === a.Ha && C('No canvas specified');
void 0 === g && (g = null);
void 0 === h && (h = null);
void 0 === k && (k = !1);
void 0 === l && (l = !1);
qj(a);
a.Zb.Oc(!0);
Ri(a);
a.Vi = !0;
var m = a.xa;
a.xa = e;
var n = a.Ua.s,
p = n.length;
try {
var r = new M(f.x, f.y, d.width / e, d.height / e),
q = r.copy();
q.fo(c);
jj(a, q);
mh(a);
a.Pd(n, p, a, r);
b.setTransform(1, 0, 0, 1, 0, 0);
b.clearRect(0, 0, d.width, d.height);
null !== h &&
'' !== h &&
((b.fillStyle = h), b.fillRect(0, 0, d.width, d.height));
var u = a.kc;
b.scale(u, u);
var w = md.alloc();
w.reset();
w.translate(c.left, c.top);
w.scale(e);
(0 === f.x && 0 === f.y) || w.translate(-f.x, -f.y);
b.setTransform(w.m11, w.m12, w.m21, w.m22, w.dx, w.dy);
b.Pc();
md.free(w);
rj(a, b);
b.globalAlpha = a.tb;
var v = a.Ij('Grid');
if (g) {
var z = new G(),
y = g.iterator;
for (y.reset(); y.next(); ) {
var A = y.value;
A instanceof U && (l || A.layer !== v) && z.add(A);
}
for (l = 0; l < p; l++) {
var B = n[l];
v = b;
var F = a;
if (B.visible && 0 !== B.tb && (k || !B.isTemporary)) {
var L = B.Ma.s,
S = L.length;
if (0 !== S) {
var R = fi(B, v),
P = B.Bn;
P.length = 0;
var H = F.scale,
da = M.alloc();
for (c = 0; c < S; c++) {
var X = L[c];
z.contains(X) && B.$h(v, X, F, P, H, da, !1);
}
M.free(da);
v.globalAlpha = R;
}
}
}
} else
for (z = 0; z < p; z++)
(F = n[z]), F === v ? l && F.tc(b, a, !0) : F.tc(b, a, k);
a.Vi = !1;
a.vh && sj(a.vh, a) && a.Qs();
} finally {
(a.xa = m), a.Zb.Oc(!0), Ri(a), a.Pd(n, p, a, a.viewportBounds), jj(a);
}
}
}
t.Ge = function(a) {
return this.Ig[a];
};
t.Fx = function(a, b) {
'minDrawingLength' === a && (this.nq = b);
this.Ig[a] = b;
this.redraw();
};
t.Ax = function() {
this.Ig = new Wa();
this.Ig.drawShadows = !0;
this.Ig.textGreeking = !0;
this.Ig.viewportOptimizations = Qa || Na ? !1 : !0;
this.Ig.temporaryPixelRatio = !0;
this.Ig.pictureRatioOptimization = !0;
this.nq = this.Ig.minDrawingLength = 1;
};
function rj(a, b) {
a = a.Ig;
null !== a &&
(void 0 !== a.imageSmoothingEnabled && b.Ex(!!a.imageSmoothingEnabled),
(a = a.defaultFont),
void 0 !== a && null !== a && (b.font = a));
}
t.yl = function(a) {
return this.Vm[a];
};
t.Zz = function(a, b) {
this.Vm[a] = b;
};
t.zx = function() {
this.Vm = new Wa();
this.Vm.extraTouchArea = 10;
this.Vm.extraTouchThreshold = 10;
this.Vm.hasGestureZoom = !0;
};
t.set = function(a) {
Object.assign(this, a);
return this;
};
t.ku = function(a) {
return this.Vl(a);
};
t.Vl = function(a) {
uj(this, a);
return this;
};
function uj(a, b) {
var c = a instanceof W,
d = a instanceof Q,
e;
for (e in b) {
'' === e && C('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.fb(k);
else if (((f = a[k]), void 0 === f || null === f))
f = a.toolManager[k];
ya(f)
? (g = e.substr(h + 1))
: C(
'Unable to find object named: ' +
k +
' in ' +
a.toString() +
' when trying to set property: ' +
e,
);
}
}
if ('_' !== g[0] && !Ja(f, g))
if (d && 'ModelChanged' === g) {
a.Cw(b[g]);
continue;
} else if (d && 'Changed' === g) {
a.Ug(b[g]);
continue;
} else if (d && Ja(a.toolManager, g)) f = a.toolManager;
else if (d && vj(a, g)) {
a.wj(g, b[g]);
continue;
} else if (a instanceof Z && 'Changed' === g) {
a.Ug(b[g]);
continue;
} else
C(
'Trying to set undefined property "' +
g +
'" on object: ' +
f.toString(),
);
f[g] = b[e];
'_' === g[0] && f instanceof Y && f.zw(g);
}
}
t.mu = function() {
if (0 === this.undoManager.transactionLevel && 0 !== this.th.count) {
for (; 0 < this.th.count; ) {
var a = this.th;
this.th = new pb();
for (a = a.iterator; a.next(); ) {
var b = a.key;
b.Ao(a.value);
b.mc(!1);
}
}
this.N();
}
};
t.N = function(a) {
if (void 0 === a) (this.bd = !0), this.Mb();
else {
var b = this.viewportBounds;
a.v() && b.Sc(a) && ((this.bd = !0), this.Mb());
}
this.P('InvalidateDraw');
};
Q.prototype.invalidateViewport = function(a, b) {
if (!0 !== this.bd) {
this.bd = !0;
var c = !0 === this.Ge('temporaryPixelRatio');
if (
!0 === this.Ge('viewportOptimizations') &&
this.scrollMode !== Th &&
this.mj.bi(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 = M.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.kr && 0 < d.width && 0 < d.height) {
if (
!(
this.cd ||
((this.cg = !1),
null === this.La ||
((this.cd = !0),
this.mu(),
this.documentBounds.v() ||
((e = M.alloc()), wj(this, this.computeBounds(e)), M.free(e)),
(e = this.Ha),
null === e || e instanceof xj))
)
) {
var g = this.kc;
f = this.Ba * g;
var h = this.Aa * 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.Ov;
a = this.Ux;
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.Sa, n, p, r, q, 0, 0, r, q);
sj(this.vh, this) && a.clearRect(0, 0, k, m);
e = Ea();
a = Ea();
q = Math.abs(l);
r = Math.abs(b);
var u = 0 === n ? 0 : f - q;
n = I.allocAt(u, 0);
q = I.allocAt(q + u, h);
a.push(
new M(
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 w = this.Bb;
w.reset();
w.scale(g, g);
1 !== this.xa && w.scale(this.xa);
g = this.pa;
(0 !== g.x || 0 !== g.y) &&
isFinite(g.x) &&
isFinite(g.y) &&
w.translate(-g.x, -g.y);
yb(n, w);
yb(q, w);
e.push(
new M(
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 M(
Math.min(n.x, q.x),
Math.min(n.y, q.y),
Math.abs(n.x - q.x),
Math.abs(n.y - q.y),
),
);
yb(n, w);
yb(q, w);
e.push(
new M(
Math.min(n.x, q.x),
Math.min(n.y, q.y),
Math.abs(n.x - q.x),
Math.abs(n.y - q.y),
),
);
sj(this.vh, this) &&
((f = 0 < l ? 0 : -l),
(h = 0 < b ? 0 : -b),
n.h(f, h),
q.h(k + f, m + h),
a.push(
new M(
Math.min(n.x, q.x),
Math.min(n.y, q.y),
Math.abs(n.x - q.x),
Math.abs(n.y - q.y),
),
),
yb(n, w),
yb(q, w),
e.push(
new M(
Math.min(n.x, q.x),
Math.min(n.y, q.y),
Math.abs(n.x - q.x),
Math.abs(n.y - q.y),
),
));
I.free(n);
I.free(q);
Xi(this, !1, !0);
null === this.La && C('No div specified');
null === this.Ha && C('No canvas specified');
if (!this.animationManager.zb && ((f = this.Zb), this.bd)) {
qj(this);
h = this.kc;
f.setTransform(1, 0, 0, 1, 0, 0);
f.clearRect(0, 0, this.Ba * h, this.Aa * h);
f.drawImage(
this.Ov.Sa,
0 < l ? 0 : Math.round(-l),
0 < b ? 0 : Math.round(-b),
);
l = this.pa;
g = this.xa;
k = Math.round(l.x * g) / g;
m = Math.round(l.y * g) / g;
b = this.Bb;
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(h, 0, 0, h, 0, 0);
f.transform(b.m11, b.m12, b.m21, b.m22, b.dx, b.dy);
f.Pc();
b = this.Ua.s;
l = b.length;
this.Pd(b, l, this, this.viewportBounds);
rj(this, f);
f.globalAlpha = this.tb;
for (h = 0; h < l; h++)
if (((g = b[h]), (k = e), g.visible && 0 !== g.tb)) {
m = fi(g, f);
p = g.Bn;
p.length = 0;
n = this.scale;
r = M.alloc();
q = g.Ma.s;
w = q.length;
u = k.length;
for (var v = 0; v < w; v++) {
var z = q[v],
y = yj(z, z.actualBounds);
a: {
for (var A = 2 / n, B = 4 / n, F = 0; F < u; F++) {
var L = k[F];
if (
0 !== L.width &&
0 !== L.height &&
y.Hu(L.x - A, L.y - A, L.width + B, L.height + B)
) {
y = !0;
break a;
}
}
y = !1;
}
y && g.$h(f, z, this, p, n, r, !0);
}
M.free(r);
f.globalAlpha = m;
}
f.restore();
f.Oc(!0);
this.vh && sj(this.vh, this) && this.Qs();
this.bd = this.Ui = !1;
this.Jo();
}
Ga(e);
Ga(a);
this.cd = !1;
}
} else this.nd();
M.free(d);
c && (Ge(this), this.nd(), Ye(this, !0));
} else c ? (Ge(this), this.nd(), Ye(this, !0)) : this.nd();
}
};
function Wi(a) {
!1 === a.Ti && (a.Ti = !0);
}
function Ri(a) {
!1 === a.Ui && (a.Ui = !0);
}
function qj(a) {
!1 !== a.Wm && ((a.Wm = !1), zj(a, a.Ba, a.Aa));
}
function zj(a, b, c) {
Ci(a);
var d = a.kc;
a.Ha.resize(b * d, c * d, b, c) && ((a.bd = !0), a.Zb.Oc(!0));
}
function Oi(a) {
var b = a.Ha;
if (null === b || a.Zn.v()) return !0;
var c = a.Ba,
d = a.Aa,
e = a.viewportBounds;
if (!a.viewportBounds.v()) return !0;
var f = e.x,
g = e.y,
h = e.width,
k = e.height,
l = a.Qt,
m = a.Nt,
n = a.La,
p = !1,
r = a.Of ? a.Ab : 0,
q = a.We ? a.Ab : 0,
u = n.clientWidth || c + r,
w = n.clientHeight || d + q;
if (u !== c + r || w !== d + q)
(a.Of = !1),
(a.We = !1),
(q = r = 0),
(a.Ba = u),
(a.Aa = w),
(p = a.Wm = !0),
Ci(a);
if (!(p || a.Of || a.We || a.Tm || a.Um)) return !0;
a.Ti = !1;
var v = a.documentBounds,
z = 0,
y = 0,
A = 0,
B = 0;
n = e.width;
var F = e.height,
L = a.mj;
a.contentAlignment.pb()
? (v.width > n && ((z = L.left), (y = L.right)),
v.height > F && ((A = L.top), (B = L.bottom)))
: ((z = L.left), (y = L.right), (A = L.top), (B = L.bottom));
L = v.width + z + y;
var S = v.height + A + B;
z = v.x - z;
var R = e.x;
y = v.right + y;
var P = e.right + r;
A = v.y - A;
var H = e.y;
v = v.bottom + B;
B = e.bottom + q;
var da = '1px',
X = '1px';
e = a.scale;
u = L > u / e;
w = S > w / e;
a.scrollMode === Rh &&
(u || w) &&
(u &&
a.hasHorizontalScrollbar &&
a.allowHorizontalScroll &&
((u = 1),
z + 1 < R && (u = Math.max((R - z) * e + a.Ba, u)),
y > P + 1 && (u = Math.max((y - P) * e + a.Ba, u)),
n + r + 1 < L && (u = Math.max((L - n) * e + a.Ba, u)),
(da = u.toString() + 'px')),
w &&
a.hasVerticalScrollbar &&
a.allowVerticalScroll &&
((u = 1),
A + 1 < H && (u = Math.max((H - A) * e + a.Aa, u)),
v > B + 1 && (u = Math.max((v - B) * e + a.Aa, u)),
F + q + 1 < S && (u = Math.max((S - F) * e + a.Aa, u)),
(X = u.toString() + 'px')));
u = '1px' !== da;
w = '1px' !== X;
(u && w) ||
(!u && !w) ||
(w && (P -= a.Ab),
u && (B -= a.Ab),
L < n + r ||
!a.hasHorizontalScrollbar ||
!a.allowHorizontalScroll ||
((r = 1),
z + 1 < R && (r = Math.max((R - z) * e + a.Ba, r)),
y > P + 1 && (r = Math.max((y - P) * e + a.Ba, r)),
n + 1 < L && (r = Math.max((L - n) * e + a.Ba, r)),
(da = r.toString() + 'px')),
(u = '1px' !== da),
(r = a.Aa),
u !== a.We && (r = u ? a.Aa - a.Ab : a.Aa + a.Ab),
S < F + q ||
!a.hasVerticalScrollbar ||
!a.allowVerticalScroll ||
((q = 1),
A + 1 < H && (q = Math.max((H - A) * e + r, q)),
v > B + 1 && (q = Math.max((v - B) * e + r, q)),
F + 1 < S && (q = Math.max((S - F) * e + r, q)),
(X = q.toString() + 'px')),
(w = '1px' !== X));
if (a.Nq && u === a.We && w === a.Of)
return (c === a.Ba && d === a.Aa) || a.nd(), !1;
u !== a.We &&
('1px' === da ? (a.Aa = a.Aa + a.Ab) : (a.Aa = Math.max(a.Aa - a.Ab, 1)),
(p = !0));
a.We = u;
m.style.width = da;
w !== a.Of &&
('1px' === X ? (a.Ba = a.Ba + a.Ab) : (a.Ba = Math.max(a.Ba - a.Ab, 1)),
(p = !0),
a.$m &&
((q = I.alloc()),
w
? ((b.style.left = a.Ab + 'px'),
(a.position = q.h(a.pa.x + a.Ab / a.scale, a.pa.y)))
: ((b.style.left = '0px'),
(a.position = q.h(a.pa.x - a.Ab / a.scale, a.pa.y))),
I.free(q)));
p && Ci(a);
a.Of = w;
m.style.height = X;
a.Mt = !0;
p && (a.Wm = !0);
b = l.scrollLeft;
a.hasHorizontalScrollbar &&
a.allowHorizontalScroll &&
(n + 1 < L
? (b = (a.position.x - z) * e)
: z + 1 < R
? (b = l.scrollWidth - l.clientWidth)
: y > P + 1 && (b = a.position.x * e));
if (a.$m)
switch (a.Ht) {
case 'negative':
b = -(l.scrollWidth - b - l.clientWidth);
break;
case 'reverse':
b = l.scrollWidth - b - l.clientWidth;
}
l.scrollLeft = b;
a.hasVerticalScrollbar &&
a.allowVerticalScroll &&
(F + 1 < S
? (l.scrollTop = (a.position.y - A) * e)
: A + 1 < H
? (l.scrollTop = l.scrollHeight - l.clientHeight)
: v > B + 1 && (l.scrollTop = a.position.y * e));
u = a.Ba;
w = a.Aa;
l.style.width = u + (a.Of ? a.Ab : 0) + 'px';
l.style.height = w + (a.We ? a.Ab : 0) + 'px';
return c !== u || d !== w || a.animationManager.zb
? ((c = M.allocAt(f, g, h, k)),
a.onViewportBoundsChanged(c, a.viewportBounds, e, p),
M.free(c),
!1)
: !0;
}
t = Q.prototype;
t.add = function(a) {
var b = a.diagram;
if (
b !== this &&
(null !== b &&
C(
'Cannot add part ' +
a.toString() +
' to ' +
this.toString() +
'. It is already a part of ' +
b.toString(),
),
(b = this.Ij(a.layerName)),
null === b && (b = this.Ij('')),
null === b &&
C(
'Cannot add a Part when unable find a Layer named "' +
a.layerName +
'" and there is no default Layer',
),
a.layer !== b)
) {
var c = b.ii(99999999, a, a.diagram === this);
0 <= c && this.bb(fe, 'parts', b, null, a, null, c);
b.isTemporary || this.Va();
a.D(1);
c = a.layerChanged;
null !== c && c(a, null, b);
}
};
t.ii = function(a) {
this.partManager.ii(a);
var b = this;
Aj(a, function(a) {
Bj(b, a);
});
(a instanceof ue || (a instanceof qf && null !== a.placeholder)) && a.w();
null !== a.data &&
Aj(a, function(a) {
Cj(b.partManager, a);
});
(!0 !== oj(a) && !0 !== pj(a)) || this.te.add(a);
Dj(a, !0, this);
Ej(a)
? (a.actualBounds.v() && this.N(yj(a, a.actualBounds)), this.Va())
: a.isVisible() && a.actualBounds.v() && this.N(yj(a, a.actualBounds));
this.Mb();
};
t.lc = function(a) {
a.zj();
this.partManager.lc(a);
var b = this;
null !== a.data &&
Aj(a, function(a) {
Fj(b.partManager, a, b);
});
this.te.remove(a);
Ej(a)
? (a.actualBounds.v() && this.N(yj(a, a.actualBounds)), this.Va())
: a.isVisible() && a.actualBounds.v() && this.N(yj(a, a.actualBounds));
this.Mb();
};
t.remove = function(a) {
Gj(this, a, !0);
};
function Gj(a, b, c) {
var d = b.layer;
null !== d &&
d.diagram === a &&
((b.isSelected = !1),
(b.isHighlighted = !1),
b.D(2),
c && b.Fj(),
(c = d.lc(-1, b, !1)),
0 <= c && a.bb(ge, 'parts', d, b, null, c, null),
(a = b.layerChanged),
null !== a && a(b, d, null));
}
t.hs = function(a, b) {
void 0 === b && (b = !1);
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 G(), c.addAll(a), a = c.iterator; a.next(); )
(c = a.value), (b && !c.canDelete()) || this.remove(c);
};
t.Ej = function(a, b, c) {
void 0 === c && (c = !1);
return this.partManager.Ej(a, b, c);
};
Q.prototype.moveParts = function(a, b, c, d) {
void 0 === c && (c = !1);
void 0 === d && (d = Hj(this));
if (null !== this.toolManager) {
var e = new pb();
if (null !== a)
if (za(a)) for (var f = 0; f < a.length; f++) Ij(this, e, a[f], c, d);
else for (a = a.iterator; a.next(); ) Ij(this, e, a.value, c, d);
else {
for (a = this.parts; a.next(); ) Ij(this, e, a.value, c, d);
for (a = this.nodes; a.next(); ) Ij(this, e, a.value, c, d);
for (a = this.links; a.next(); ) Ij(this, e, a.value, c, d);
}
ef(this, e, b, d, c);
}
};
function Ij(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 = Hj(a)), c instanceof V)) {
b.add(c, a.Fd(e, c, c.location));
if (c instanceof qf && (null !== c.placeholder || e.dragsMembers))
for (f = c.memberParts; f.next(); )
Ij(a, b, f.value, d, e, e.groupsAlwaysMove);
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) &&
Ij(a, b, g, d, e);
}
}
if (e.dragsTree) for (c = c.Au(); c.next(); ) Ij(a, b, c.value, d, e);
} else if (c instanceof T)
for (b.add(c, a.Fd(e, c)), c = c.labelNodes; c.next(); )
Ij(a, b, c.value, d, e);
else c instanceof ue || b.add(c, a.Fd(e, c, c.location));
}
function ef(a, b, c, d, e) {
if (null !== b && 0 !== b.count) {
var f = I.alloc(),
g = I.alloc();
g.assign(c);
isNaN(g.x) && (g.x = 0);
isNaN(g.y) && (g.y = 0);
(c = a.jr) || He(a, b);
for (var h = Ea(), k = Ea(), l = b.iterator, m = I.alloc(); l.next(); ) {
var n = l.key,
p = l.value;
if (n.Tc()) {
var r = Jj(a, n, b);
if (null !== r) h.push(new Kj(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 I()),
p.shifted.assign(m.je(r));
} else l.key instanceof T && k.push(l.ra);
}
I.free(m);
e = h.length;
for (l = 0; l < e; l++)
(n = h[l]),
f.assign(n.info.point),
void 0 === n.Eu.shifted && (n.Eu.shifted = new I()),
(n.node.location = f.add(n.Eu.shifted));
e = I.alloc();
l = I.alloc();
n = k.length;
for (p = 0; p < n; p++) {
var q = k[p];
r = q.key;
if (r instanceof T)
if (r.suspendsRouting) {
r.ef = 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.Fd(d, r, g)), cf(r, g.x - u.x, g.y - u.y);
else {
q = I.allocAt(0, 0);
(m = r.i(0)) && m.v() && q.assign(m);
var w = (m = I.alloc()
.assign(q)
.add(g));
d.isGridSnapEnabled &&
(d.isGridSnapRealtime || a.lastInput.up) &&
((w = I.alloc()), Ag(a, r, m, w, d));
m.assign(r.dragComputation(r, m, w)).je(q);
b.add(r, a.Fd(d, r, m));
cf(r, m.x - u.x, m.y - u.y);
I.free(q);
I.free(m);
w !== m && I.free(w);
}
else
null !== m &&
(e.assign(m.location),
(w = b.I(m)),
null !== w && e.je(w.point)),
null !== u &&
(l.assign(u.location),
(w = b.I(u)),
null !== w && l.je(w.point)),
null !== m && null !== u
? e.$a(l)
? ((m = q.value.point),
(u = f),
u.assign(e),
u.je(m),
b.add(r, a.Fd(d, r, e)),
cf(r, u.x, u.y))
: ((r.suspendsRouting = !1), r.ab())
: ((q = q.value.point),
(m = null !== m ? e : null !== u ? l : g),
b.add(r, a.Fd(d, r, m)),
cf(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.Fd(d, r, g)),
cf(r, g.x - m.x, g.y - m.y);
}
I.free(f);
I.free(g);
I.free(e);
I.free(l);
Ga(h);
Ga(k);
c || (mh(a), Ve(a, b));
}
}
Q.prototype.computeMove = function(a, b, c, d) {
void 0 === d && (d = new I());
d.assign(b);
if (null === a) return d;
var e = b,
f = c.isGridSnapEnabled;
f &&
(c.isGridSnapRealtime || this.lastInput.up) &&
((e = I.alloc()), Ag(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(1e3 * a.location.x) / 1e3 : a.location.x);
g = g.y;
isNaN(g) && (g = f ? Math.round(1e3 * a.location.y) / 1e3 : a.location.y);
var k = a.maxLocation,
l = k.x;
isNaN(l) && (l = f ? Math.round(1e3 * a.location.x) / 1e3 : a.location.x);
k = k.y;
isNaN(k) && (k = f ? Math.round(1e3 * a.location.y) / 1e3 : a.location.y);
d.h(Math.max(h, Math.min(c.x, l)), Math.max(g, Math.min(c.y, k)));
e !== b && I.free(e);
return d;
};
function Hj(a) {
var b = a.toolManager.findTool('Dragging');
return null !== b ? b.dragOptions : a.Em;
}
function Ag(a, b, c, d, e) {
void 0 === e && (e = Hj(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 = I.allocAt(0, 0);
f.pi(0, 0, a, b, e);
J.so(c.x, c.y, h + f.x, g + f.y, a, b, d);
I.free(f);
}
}
function He(a, b) {
if (null !== b)
for (a.jr = !0, a = b.iterator; a.next(); )
(b = a.key), b instanceof T && (b.suspendsRouting = !0);
}
function Ve(a, b) {
if (null !== b) {
for (b = b.iterator; b.next(); ) {
var c = b.key;
c instanceof T && ((c.suspendsRouting = !1), Lj(c) && c.ab());
}
a.jr = !1;
}
}
function Jj(a, b, c) {
b = b.containingGroup;
if (null !== b) {
a = Jj(a, b, c);
if (null !== a) return a;
a = c.I(b);
if (null !== a) return a;
}
return null;
}
t = Q.prototype;
t.Fd = function(a, b, c) {
if (void 0 === c) return new Te(qb);
var d = a.isGridSnapEnabled;
a.groupsSnapMembers || null === b.containingGroup || (d = !1);
return d
? new Te(new I(Math.round(1e3 * c.x) / 1e3, Math.round(1e3 * c.y) / 1e3))
: new Te(c.copy());
};
function Mj(a, b, c) {
null !== b.diagram &&
b.diagram !== a &&
C('Cannot share a Layer with another Diagram: ' + b + ' of ' + b.diagram);
null === c
? null !== b.diagram &&
C('Cannot add an existing Layer to this Diagram again: ' + b)
: (c.diagram !== a &&
C(
'Existing Layer must be in this Diagram: ' +
c +
' not in ' +
c.diagram,
),
b === c && C('Cannot move a Layer before or after itself: ' + b));
if (b.diagram !== a) {
b = b.name;
a = a.Ua;
c = a.count;
for (var d = 0; d < c; d++)
a.K(d).name === b &&
C(
"Cannot add Layer with the name '" +
b +
"'; a Layer with the same name is already present in this Diagram.",
);
}
}
t.pl = function(a) {
Mj(this, a, null);
a.Le(this);
var b = this.Ua,
c = b.count - 1;
if (!a.isTemporary) for (; 0 <= c && b.K(c).isTemporary; ) c--;
b.Cb(c + 1, a);
null !== this.ac && this.bb(fe, 'layers', this, null, a, null, c + 1);
this.N();
this.Va();
return this;
};
t.Aw = function(a, b) {
Mj(this, a, b);
a.Le(this);
var c = this.Ua,
d = c.indexOf(a);
0 <= d &&
(c.remove(a),
null !== this.ac && this.bb(ge, 'layers', this, a, null, d, null));
var e = c.count,
f;
for (f = 0; f < e; f++)
if (c.K(f) === b) {
c.Cb(f, a);
break;
}
null !== this.ac && this.bb(fe, 'layers', this, null, a, null, f);
this.N();
0 > d && this.Va();
return this;
};
t.jy = function(a, b) {
Mj(this, a, b);
a.Le(this);
var c = this.Ua,
d = c.indexOf(a);
0 <= d &&
(c.remove(a),
null !== this.ac && this.bb(ge, 'layers', this, a, null, d, null));
var e = c.count,
f;
for (f = 0; f < e; f++)
if (c.K(f) === b) {
c.Cb(f + 1, a);
break;
}
null !== this.ac && this.bb(fe, 'layers', this, null, a, null, f + 1);
this.N();
0 > d && this.Va();
return this;
};
t.Rz = function(a) {
a.diagram !== this &&
C(
'Cannot remove a Layer from another Diagram: ' + a + ' of ' + a.diagram,
);
if ('' !== a.name) {
var b = this.Ua,
c = b.indexOf(a);
if (b.remove(a)) {
for (b = a.Ma.copy().iterator; b.next(); ) {
var d = b.value,
e = d.layerName;
e !== a.name ? (d.layerName = e) : (d.layerName = '');
}
null !== this.ac && this.bb(ge, 'layers', this, a, null, c, null);
this.N();
this.Va();
}
}
};
t.Ij = function(a) {
for (var b = this.layers; b.next(); ) {
var c = b.value;
if (c.name === a) return c;
}
return null;
};
t.Cw = function(a) {
null === this.bf && (this.bf = new E());
this.bf.add(a);
this.model.Ug(a);
return this;
};
t.Tz = function(a) {
null !== this.bf &&
(this.bf.remove(a), 0 === this.bf.count && (this.bf = null));
this.model.ak(a);
};
t.Ug = function(a) {
null === this.qg && (this.qg = new E());
this.qg.add(a);
return this;
};
t.ak = function(a) {
null !== this.qg &&
(this.qg.remove(a), 0 === this.qg.count && (this.qg = null));
};
t.Cr = function(a) {
this.skipsUndoManager ||
this.model.skipsUndoManager ||
this.model.undoManager.Fu(a);
a.change !== ee && (this.isModified = !0);
if (null !== this.qg)
for (var b = this.qg, c = b.length, d = 0; d < c; d++) b.K(d)(a);
};
t.bb = function(a, b, c, d, e, f, g) {
void 0 === f && (f = null);
void 0 === g && (g = null);
var h = new ce();
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.Cr(h);
};
t.g = function(a, b, c, d, e) {
this.bb(de, a, this, b, c, d, e);
};
Q.prototype.changeState = function(a, b) {
if (null !== a && a.diagram === this) {
var c = this.skipsModelSourceBindings;
try {
this.skipsModelSourceBindings = !0;
var d = a.change;
if (d === de) {
var e = a.object;
Nj(e, a.propertyName, a.I(b));
if (e instanceof Y) {
var f = e.part;
null !== f && f.Rb();
}
this.isModified = !0;
} else if (d === fe) {
var g = a.object,
h = a.newParam,
k = a.newValue;
if (g instanceof W)
if ('number' === typeof h && k instanceof Y) {
b ? g.lc(h) : g.Cb(h, k);
var l = g.part;
null !== l && l.Rb();
} else
'number' === typeof h &&
k instanceof Oj &&
(k.isRow ? Pj(g, h, b ? void 0 : k) : Qj(g, h, b ? void 0 : k));
else if (g instanceof di) {
var m = !0 === a.oldParam;
'number' === typeof h &&
k instanceof U &&
(b
? ((k.isSelected = !1),
(k.isHighlighted = !1),
k.Rb(),
g.lc(m ? h : -1, k, m))
: g.ii(h, k, m));
} else
g instanceof Q
? 'number' === typeof h &&
k instanceof di &&
(b ? this.Ua.mb(h) : (k.Le(this), this.Ua.Cb(h, k)))
: C('unknown ChangedEvent.Insert object: ' + a.toString());
this.isModified = !0;
} else if (d === ge) {
var n = a.object,
p = a.oldParam,
r = a.oldValue;
if (n instanceof W)
'number' === typeof p && r instanceof Y
? b
? n.Cb(p, r)
: n.lc(p)
: 'number' === typeof p &&
r instanceof Oj &&
(r.isRow ? Pj(n, p, b ? r : void 0) : Qj(n, p, b ? r : void 0));
else if (n instanceof di) {
var q = !0 === a.newParam;
'number' === typeof p &&
r instanceof U &&
(b
? 0 > n.Ma.indexOf(r) && n.ii(p, r, q)
: ((r.isSelected = !1),
(r.isHighlighted = !1),
r.Rb(),
n.lc(q ? p : -1, r, q)));
} else
n instanceof Q
? 'number' === typeof p &&
r instanceof di &&
(b ? (r.Le(this), this.Ua.Cb(p, r)) : this.Ua.mb(p))
: C('unknown ChangedEvent.Remove object: ' + a.toString());
this.isModified = !0;
} else d !== ee && C('unknown ChangedEvent: ' + a.toString());
} finally {
this.skipsModelSourceBindings = c;
}
}
};
Q.prototype.Da = function(a) {
return this.undoManager.Da(a);
};
Q.prototype.eb = function(a) {
return this.undoManager.eb(a);
};
Q.prototype.Bf = function() {
return this.undoManager.Bf();
};
Q.prototype.commit = function(a, b) {
void 0 === b && (b = '');
var c = this.skipsUndoManager;
null === b && ((this.skipsUndoManager = !0), (b = ''));
this.undoManager.Da(b);
var d = !1;
try {
a(this), (d = !0);
} finally {
d ? this.undoManager.eb(b) : this.undoManager.Bf(),
(this.skipsUndoManager = c);
}
};
Q.prototype.updateAllTargetBindings = function(a) {
this.partManager.updateAllTargetBindings(a);
};
Q.prototype.Uo = function() {
this.partManager.Uo();
};
function Rj(a, b, c) {
var d = a.animationManager;
if (a.wb || a.cd)
(a.xa = c), Ci(a), d.zb && (wh(d) || d.Wd.add(d.H, 'scale', b, a.xa));
else if (null === a.Ha) (a.xa = c), Ci(a);
else {
a.wb = !0;
var e = a.viewportBounds.copy(),
f = a.Ba,
g = a.Aa;
e.width = a.Ba / b;
e.height = a.Aa / b;
var h = a.zoomPoint.x,
k = a.zoomPoint.y,
l = a.contentAlignment;
isNaN(h) &&
(l.Uc()
? l.xf(Ec)
? (h = 0)
: l.xf(Gc) && (h = f - 1)
: (h = l.pb() ? l.x * (f - 1) : f / 2));
isNaN(k) &&
(l.Uc()
? l.xf(Dc)
? (k = 0)
: l.xf(Hc) && (k = g - 1)
: (k = l.pb() ? l.y * (g - 1) : g / 2));
null === a.scaleComputation ||
a.animationManager.defaultAnimation.isAnimating ||
(c = a.scaleComputation(a, c));
c < a.minScale && (c = a.minScale);
c > a.maxScale && (c = a.maxScale);
f = I.allocAt(a.pa.x + h / b - h / c, a.pa.y + k / b - k / c);
a.position = f;
I.free(f);
a.xa = c;
Ci(a);
a.onViewportBoundsChanged(e, a.viewportBounds, b, !1);
a.wb = !1;
Ti(a, !1);
d.zb && (wh(d) || d.Wd.add(d.H, 'scale', b, a.xa));
a.N();
Wi(a);
}
}
Q.prototype.onViewportBoundsChanged = function(a, b, c, d) {
if (!a.C(b)) {
void 0 === d && (d = !1);
d || Wi(this);
Ri(this);
var e = this.layout;
null === e ||
!e.isViewportSized ||
this.autoScale !== rh ||
d ||
(a.width === b.width && a.height === b.height) ||
e.D();
e = this.currentTool;
!0 === this.Kk &&
e instanceof La &&
((this.lastInput.documentPoint = this.rs(this.lastInput.viewPoint)),
ye(e, this));
this.wb || this.invalidateViewport(a, b);
jj(this);
this.kd.scale = c;
this.kd.position.x = a.x;
this.kd.position.y = a.y;
this.kd.bounds.assign(a);
this.kd.Hw.width = Math.round(a.width * c);
this.kd.Hw.height = Math.round(a.height * c);
this.kd.sx.width = this.Ba;
this.kd.sx.height = this.Aa;
this.kd.lx = d;
this.P('ViewportBoundsChanged', this.kd, a);
this.isVirtualized &&
this.links.each(function(a) {
a.isAvoiding && a.actualBounds.Sc(b) && a.ab();
});
}
};
function jj(a, b) {
var c = a.Zd;
if (null !== c && c.visible) {
for (
var d = K.alloc(), e = 1, f = 1, g = c.R.s, h = g.length, k = 0;
k < h;
k++
) {
var l = g[k],
m = Math.abs(l.interval);
2 > m ||
(Sj(l.figure)
? (f = (f * m) / J.Xw(f, m))
: (e = (e * m) / J.Xw(e, m)));
}
g = c.gridCellSize;
d.h(f * g.width, e * g.height);
if (void 0 !== b) (e = b.width), (f = b.height), (a = b.x), (g = b.y);
else {
b = M.alloc();
a = a.viewportBounds;
b.h(a.x, a.y, a.width, a.height);
if (!b.v()) {
M.free(b);
return;
}
e = b.width;
f = b.height;
a = b.x;
g = b.y;
M.free(b);
}
c.width = e + 2 * d.width;
c.height = f + 2 * d.height;
b = I.alloc();
J.so(a, g, 0, 0, d.width, d.height, b);
b.offset(-d.width, -d.height);
K.free(d);
c.part.location = b;
I.free(b);
}
}
Q.prototype.clearSelection = function(a) {
void 0 === a && (a = !1);
var b = this.selection;
if (0 !== b.count) {
a || this.P('ChangingSelection', b);
for (var c = b.Ea(), d = c.length, e = 0; e < d; e++)
c[e].isSelected = !1;
b.ja();
b.clear();
b.freeze();
a || this.P('ChangedSelection', b);
}
};
Q.prototype.select = function(a) {
null !== a &&
a.diagram === this &&
(!a.isSelected || 1 < this.selection.count) &&
(this.P('ChangingSelection', this.selection),
this.clearSelection(!0),
(a.isSelected = !0),
this.P('ChangedSelection', this.selection));
};
Q.prototype.Yz = function(a) {
this.P('ChangingSelection', this.selection);
this.clearSelection(!0);
if (za(a))
for (var b = a.length, c = 0; c < b; c++) {
var d = a[c];
d instanceof U ||
C(
'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 U ||
C(
'Diagram.selectCollection given something that is not a Part: ' +
b,
),
(b.isSelected = !0);
this.P('ChangedSelection', this.selection);
};
Q.prototype.clearHighlighteds = function() {
var a = this.highlighteds;
if (0 < a.count) {
for (var b = a.Ea(), c = b.length, d = 0; d < c; d++)
b[d].isHighlighted = !1;
a.ja();
a.clear();
a.freeze();
}
};
t = Q.prototype;
t.qz = function(a) {
null !== a &&
a.diagram === this &&
(!a.isHighlighted || 1 < this.highlighteds.count) &&
(this.clearHighlighteds(), (a.isHighlighted = !0));
};
t.rz = function(a) {
a = new G().addAll(a);
for (var b = this.highlighteds.copy().Ko(a).iterator; b.next(); )
b.value.isHighlighted = !1;
for (a = a.iterator; a.next(); )
(b = a.value),
b instanceof U ||
C(
'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 = I.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));
I.free(d);
return;
}
C(
"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)
: C(
"scrolling direction must be 'up', 'down', 'left', or 'right', not: " +
b,
);
this.position = c;
};
t.bv = function(a) {
var b = this.viewportBounds;
b.Ee(a) ||
((a = a.center),
(a.x -= b.width / 2),
(a.y -= b.height / 2),
(this.position = a));
};
t.Dr = function(a) {
var b = this.viewportBounds;
a = a.center;
a.x -= b.width / 2;
a.y -= b.height / 2;
this.position = a;
};
t.Ro = function(a) {
var b = this.Bb;
b.reset();
1 !== this.xa && b.scale(this.xa);
var c = this.pa;
(0 !== c.x || 0 !== c.y) &&
isFinite(c.x) &&
isFinite(c.y) &&
b.translate(-c.x, -c.y);
return a.copy().transform(this.Bb);
};
t.gA = function(a) {
var b = this.Bb,
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 M(f, r, p - f, b - r);
};
t.rs = function(a) {
var b = this.Bb;
b.reset();
1 !== this.xa && b.scale(this.xa);
var c = this.pa;
(0 !== c.x || 0 !== c.y) &&
isFinite(c.x) &&
isFinite(c.y) &&
b.translate(-c.x, -c.y);
return yb(a.copy(), this.Bb);
};
function Tj(a) {
var b = a.isModified;
a.xw !== b && ((a.xw = b), a.P('Modified'));
}
function Uj(a) {
a = li.get(a);
return null !== a ? new a() : new mi();
}
Q.prototype.doModelChanged = function(a) {
var b = this;
if (a.model === this.model) {
var c = a.change,
d = a.propertyName;
if (c === ee && 'S' === d[0])
if ('StartingFirstTransaction' === d) {
var e = this;
a = this.toolManager;
a.mouseDownTools.each(function(a) {
a.diagram = e;
});
a.mouseMoveTools.each(function(a) {
a.diagram = e;
});
a.mouseUpTools.each(function(a) {
a.diagram = e;
});
this.cd || this.Qf || ((this.xk = !0), this.Nm && (this.cg = !0));
} else
'StartingUndo' === d || 'StartingRedo' === d
? ((a = this.animationManager),
a.defaultAnimation.isAnimating &&
!this.skipsUndoManager &&
a.wc(),
this.P('ChangingSelection', this.selection))
: 'StartedTransaction' === d &&
((a = this.animationManager),
a.defaultAnimation.isAnimating &&
!this.skipsUndoManager &&
a.wc());
else if (this.$) {
this.$ = !1;
try {
if ('' === a.modelChange && c === ee) {
if ('FinishedUndo' === d || 'FinishedRedo' === d)
this.P('ChangedSelection', this.selection), mh(this);
var f = this.animationManager;
'RolledBackTransaction' === d && f.wc();
this.xk = !0;
this.nd();
(0 !== this.undoManager.transactionLevel &&
1 !== this.undoManager.transactionLevel) ||
nh(f);
'CommittedTransaction' === d &&
this.undoManager.isJustDiscarded &&
(this.se = Math.min(this.se, this.undoManager.historyIndex - 1));
('CommittedTransaction' !== d && 'RolledBackTransaction' !== d) ||
!this.undoManager.isPendingUnmodified ||
setTimeout(function() {
b.isModified = !1;
}, 1);
var g = a.isTransactionFinished;
g && (Tj(this), this.Zr.clear(), Ah(this.animationManager));
if (!this.wt && g && this.lastInput.targetDiagram) {
this.wt = !0;
var h = this;
ta(function() {
h.currentTool.standardMouseOver();
h.wt = !1;
}, 10);
}
}
} finally {
this.$ = !0;
}
}
}
};
function Bj(a, b) {
b = b.R.s;
for (var c = b.length, d = 0; d < c; d++) Vj(a, b[d]);
}
function Vj(a, b) {
if (b instanceof Wj) {
var c = b.element;
if (null !== c && c instanceof HTMLImageElement) {
c.sg instanceof G && c.sg.add(a);
var d = b.vg;
null !== d && !0 === d.Up && null !== b.diagram && b.diagram.Fn.add(b);
if (c.Pm)
if (((c = c.getAttribute('src') || ''), (d = a.Fg.I(c)), null === d))
(d = []), d.push(b), a.Fg.add(c, d);
else {
for (a = 0; a < d.length; a++) if (d[a] === b) return;
d.push(b);
}
}
}
}
function Xj(a, b) {
if (b instanceof Wj) {
var c = b.element;
if (
null !== c &&
c instanceof HTMLImageElement &&
(c.sg instanceof G && c.sg.remove(a), Yj(c), c.Pm)
) {
c = c.getAttribute('src') || '';
var d = a.Fg.I(c);
if (null !== d)
for (var e = 0; e < d.length; e++)
if (d[e] === b) {
d.splice(e, 1);
0 === d.length && (a.Fg.remove(c), Bi(c));
break;
}
}
}
}
Q.prototype.Od = function() {
this.partManager.Od();
};
Q.prototype.vj = function(a, b) {
this.Rd.vj(a, b);
};
Q.prototype.xj = function(a, b) {
this.Rd.xj(a, b);
};
Q.prototype.findPartForKey = function(a) {
return this.partManager.findPartForKey(a);
};
Q.prototype.Lb = function(a) {
return this.partManager.Lb(a);
};
Q.prototype.findLinkForKey = function(a) {
return this.partManager.findLinkForKey(a);
};
t = Q.prototype;
t.Ec = function(a) {
return this.partManager.Ec(a);
};
t.ci = function(a) {
return this.partManager.ci(a);
};
t.Dc = function(a) {
return this.partManager.Dc(a);
};
t.Jr = function(a) {
for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
return this.partManager.Jr.apply(
this.partManager,
b instanceof Array ? b : ca(ba(b)),
);
};
t.Ir = function(a) {
for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
return this.partManager.Ir.apply(
this.partManager,
b instanceof Array ? b : ca(ba(b)),
);
};
function Ci(a) {
var b = a.pa,
c = a.xa;
a.vw.h(b.x, b.y, Math.max(a.Ba, 0) / c, Math.max(a.Aa, 0) / c);
}
function wj(a, b) {
a.Si = !1;
var c = a.wp;
c.C(b) ||
((c = c.copy()),
a.wp.assign(b),
Ti(a, !1),
a.P('DocumentBoundsChanged', void 0, c),
Wi(a));
}
t.Za = function() {
if (this.Si) {
var a = M.alloc();
wj(this, this.computeBounds(a));
M.free(a);
}
};
t.$y = function() {
for (var a = new G(), 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.Zy = function() {
return this.Uh.iterator;
};
t.Bz = function(a) {
mh(this);
a && Zj(this, !0);
this.cd ? kj(this, !1) : ((this.xk = !0), zf(this));
};
function Zj(a, b) {
for (var c = a.Uh.iterator; c.next(); ) ak(a, c.value, b);
a.layout && (b ? (a.layout.isValidLayout = !1) : a.layout.D());
}
function ak(a, b, c) {
if (null !== b) {
for (var d = b.Vk.iterator; d.next(); ) ak(a, d.value, c);
null !== b.layout && (c ? (b.layout.isValidLayout = !1) : b.layout.D());
}
}
function kj(a, b) {
if (a.mh && !a.Ns) {
var c = a.$;
a.$ = !0;
var d = a.undoManager.transactionLevel,
e = a.layout,
f = a.animationManager;
try {
0 === d && ((a.undoManager.isInternalTransaction = !0), a.Da('Layout'));
1 >= d &&
!f.defaultAnimation.isAnimating &&
!f.zb &&
(b || lh(f, 'Layout'));
a.mh = !1;
for (var g = a.Uh.iterator; g.next(); ) bk(a, g.value, b, d);
e.isValidLayout ||
(!b || e.isRealtime || null === e.isRealtime || 0 === d
? (e.doLayout(a), mh(a), (e.isValidLayout = !0))
: (a.mh = !0));
} finally {
(b = a.undoManager.isInternalTransaction),
0 === d &&
(a.eb('Layout'), (a.undoManager.isInternalTransaction = !1)),
!b || (0 !== d && 1 !== d) || nh(f),
(a.$ = c);
}
}
}
function bk(a, b, c, d) {
if (null !== b) {
for (var e = b.Vk.iterator; e.next(); ) bk(a, e.value, c, d);
e = b.layout;
null === e ||
e.isValidLayout ||
(!c || e.isRealtime || 0 === d
? ((b.gh = !b.location.v()),
e.doLayout(b),
b.D(32),
mj(a, b),
(e.isValidLayout = !0))
: (a.mh = !0));
}
}
t.fz = function() {
for (var a = new E(), b = this.nodes; b.next(); ) {
var c = b.value;
c.isTopLevel && null === c.$g() && a.add(c);
}
return a.iterator;
};
function ui(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 pb(),
d = new pb();
b('InitialAnimationStarting');
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.Nv = c;
a.Mv = d;
}
function vj(a, b) {
var c = a.Mv.I(b);
return null !== c ? c : a.Mv.I(b.toLowerCase());
}
function ck(a, b) {
var c = a.Nv.I(b);
if (null !== c) return c;
c = a.Nv.I(b.toLowerCase());
if (null !== c) return c;
C('Unknown DiagramEvent name: ' + b);
}
t.wj = function(a, b) {
a = ck(this, a);
null !== a && a.add(b);
return this;
};
t.Il = function(a, b) {
a = ck(this, a);
null !== a && a.remove(b);
};
t.P = function(a, b, c) {
var d = ck(this, a),
e = new be();
e.diagram = this;
a = vj(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.K(0)(e);
else if (0 !== b) for (d = d.Ea(), c = 0; c < b; c++) (0, d[c])(e);
};
function dk(a) {
if (a.animationManager.isTicking) return !1;
var b = a.currentTool;
return b === a.toolManager.findTool('Dragging')
? !a.jr || b.isComplexRoutingRealtime
: !0;
}
t.Pj = function(a, b) {
return ek(this, !1, null, b || null).Pj(a.x, a.y, a.width, a.height);
};
Q.prototype.computeOccupiedArea = function(a) {
return this.isVirtualized
? this.viewportBounds.copy()
: this.Si
? Si(this, a)
: a.assign(this.documentBounds);
};
function ek(a, b, c, d) {
var e = a.Qh;
null === e && (a.Qh = e = new fk(a.avoidanceCellSize));
if (e.Sr || e.group !== c || e.Hx !== d) {
e.mx = Math.max(
e.ps + 1,
Math.floor(a.avoidanceLimit / a.avoidanceCellSize.width),
);
e.nx = Math.max(
e.ps + 1,
Math.floor(a.avoidanceLimit / a.avoidanceCellSize.height),
);
null !== c && (c = gk(a, c));
if (null === c) {
b = M.alloc();
a.computeOccupiedArea(b);
b.vc(100, 100);
e.initialize(b);
for (var f = a.nodes; f.next(); ) {
var g = f.value,
h = g.layer;
null !== h && h.visible && !h.isTemporary && hk(a, g, d, b);
}
M.free(b);
} else {
0 < c.memberParts.count &&
((b = a.computePartsBounds(c.memberParts, !1)),
b.vc(20, 20),
e.initialize(b));
b = M.alloc();
for (f = c.memberParts; f.next(); )
(g = f.value), g instanceof V && hk(a, g, d, b);
M.free(b);
}
e.group = c;
e.Hx = d;
e.Sr = !1;
} else b && ik(e);
return e;
}
function gk(a, b) {
return b.avoidable && !b.isLinkLabel
? b
: null !== b.containingGroup
? gk(a, b.containingGroup)
: null;
}
function hk(a, b, c, d) {
if (b !== c && b.isVisible())
if (b.avoidable && !b.isLinkLabel) {
b = b.getAvoidableRect(d);
a = a.Qh;
var e = b.x,
f = b.y;
if (jk(a, e, f))
for (
c = ((f - a.Ed) / a.oc) | 0,
d = Math.min(((e + b.width - a.Dd) / a.nc) | 0, a.Wh),
b = Math.min(((f + b.height - a.Ed) / a.oc) | 0, a.Xh),
e = ((e - a.Dd) / a.nc) | 0;
e <= d;
e++
)
if (((f = a.Xb[e]), f.fill)) f.fill(kk, c, b + 1);
else for (var g = c; g <= b; g++) f[g] = kk;
} else if (b instanceof qf)
for (b = b.memberParts; b.next(); )
(e = b.value), e instanceof V && hk(a, e, c, d);
}
function lk(a, b) {
null === a.Qh ||
a.Qh.Sr ||
(void 0 !== b && (!b.avoidable || b.isLinkLabel)) ||
(a.Qh.Sr = !0);
}
Q.prototype.Fr = function(a) {
this.Zo.assign(a);
this.computeAutoScrollPosition(this.Zo).$a(this.position)
? this.lg()
: uk(this);
};
function uk(a) {
-1 === a.ik &&
(a.ik = ta(function() {
if (-1 !== a.ik && (a.lg(), null !== a.lastInput.event)) {
var b = a.computeAutoScrollPosition(a.Zo);
b.$a(a.position) ||
((a.position = b),
(a.lastInput.documentPoint = a.rs(a.Zo)),
a.doMouseMove(),
(a.Si = !0),
(b = M.alloc()),
a.computeBounds(b),
b.Xc(a.documentBounds),
wj(a, b),
M.free(b),
(a.bd = !0),
a.nd(),
uk(a));
}
}, a.Yo));
}
Q.prototype.lg = function() {
-1 !== this.ik && (x.clearTimeout(this.ik), (this.ik = -1));
};
Q.prototype.computeAutoScrollPosition = function(a) {
var b = this.position,
c = this.$o;
if (0 >= c.top && 0 >= c.left && 0 >= c.right && 0 >= c.bottom) return b;
var d = this.viewportBounds,
e = this.scale;
d = M.allocAt(0, 0, d.width * e, d.height * e);
var f = I.allocAt(0, 0);
if (a.x >= d.x && a.x < d.x + c.left && this.allowHorizontalScroll) {
var g = Math.max(this.scrollHorizontalLineChange, 1);
g |= 0;
f.x -= g;
a.x < d.x + c.left / 2 && (f.x -= g);
a.x < d.x + c.left / 4 && (f.x -= 4 * g);
} else
a.x <= d.x + d.width &&
a.x > d.x + d.width - c.right &&
this.allowHorizontalScroll &&
((g = Math.max(this.scrollHorizontalLineChange, 1)),
(g |= 0),
(f.x += g),
a.x > d.x + d.width - c.right / 2 && (f.x += g),
a.x > d.x + d.width - c.right / 4 && (f.x += 4 * g));
a.y >= d.y && a.y < d.y + c.top && this.allowVerticalScroll
? ((g = Math.max(this.scrollVerticalLineChange, 1)),
(g |= 0),
(f.y -= g),
a.y < d.y + c.top / 2 && (f.y -= g),
a.y < d.y + c.top / 4 && (f.y -= 4 * g))
: a.y <= d.y + d.height &&
a.y > d.y + d.height - c.bottom &&
this.allowVerticalScroll &&
((g = Math.max(this.scrollVerticalLineChange, 1)),
(g |= 0),
(f.y += g),
a.y > d.y + d.height - c.bottom / 2 && (f.y += g),
a.y > d.y + d.height - c.bottom / 4 && (f.y += 4 * g));
f.$a(qb) || (b = new I(b.x + f.x / e, b.y + f.y / e));
M.free(d);
I.free(f);
return b;
};
t = Q.prototype;
t.bs = function() {
return null;
};
t.Nu = function() {
return null;
};
t.ny = function(a, b) {
this.Yx.add(a, b);
};
t.lu = function(a) {
(this.tw = a) ||
this.nodes.each(function(a) {
a instanceof qf && (a.Dp = null);
});
};
function yk(a, b, c) {
function d() {
var a = +new Date();
f = !0;
for (g.reset(); g.next(); )
if (!g.value[0].Qk) {
f = !1;
break;
}
f || a - l > k ? b(c, e, h) : x.requestAnimationFrame(d);
}
for (var e = c.callback, f = !0, g = a.Fg.iterator; g.next(); )
if (!g.value[0].Qk) {
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.Dz = function(a) {
if (!Og) return null;
void 0 === a && (a = {});
a.returnType = 'Image';
return this.ox(a);
};
t.ox = function(a) {
void 0 === a && (a = {});
return yk(this, this.Ez, a);
};
t.Ez = function(a, b, c) {
var d = zk(c, a, 'canvas', null);
if (null === d) return null;
c = d.Z.canvas;
var e = null;
if (null !== c)
switch (
((e = a.returnType),
void 0 === e ? (e = 'string') : (e = e.toLowerCase()),
e)
) {
case Ak + 'data':
e = d.getImageData(0, 0, c.width, c.height);
break;
case Ak:
d = (a.document || document).createElement('img');
d.src = c.toDataURL(a.type, a.details);
e = d;
break;
case 'blob':
'function' !== typeof b &&
C(
'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 zk(a, b, c, d) {
a.animationManager.wc();
a.nd();
if (null === a.Ha) return null;
'object' !== typeof b && C('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 K(Infinity, Infinity) : new K(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 ec(l))
: l instanceof ec || C('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.Zb.Oc(!0);
n = new Bk(null, p);
var u = n.context;
if (!(e || f || k || h)) {
n.width = a.Ba + Math.ceil(l.left + l.right);
n.height = a.Aa + 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.po = r;
tj(a, d.context, l, new K(n.width, n.height), a.xa, a.pa, k, m, q, b);
return d.context;
}
a.Fm = !1;
tj(a, u, l, new K(n.width, n.height), a.xa, a.pa, k, m, q, b);
a.Fm = !0;
return n.context;
}
var w = a.sp,
v = a.documentBounds.copy();
v.jv(a.ub);
if (q)
for (var z = a.Ua.s, y = z.length, A = 0; A < y; A++) {
var B = z[A];
if (B.visible && B.isTemporary) {
B = B.Ma.s;
for (var F = B.length, L = 0; L < F; L++) {
var S = B[L];
S.isInDocumentBounds &&
S.isVisible() &&
((S = S.actualBounds), S.v() && v.Xc(S));
}
}
}
z = new I(v.x, v.y);
if (null !== k) {
y = new M(0, 0, 0, 0);
A = !0;
B = k.iterator;
for (B.reset(); B.next(); )
(F = B.value),
F instanceof U &&
((L = F.layer),
(null !== L && !L.visible) ||
(null !== L && !q && L.isTemporary) ||
!F.isVisible() ||
((F = F.actualBounds),
F.v() && (A ? ((A = !1), y.assign(F)) : y.Xc(F))));
v.width = y.width;
v.height = y.height;
z.x = y.x;
z.y = y.y;
}
null !== h && h.v() && ((z = h), f || (f = w));
y = h = 0;
null !== l && ((h = l.left + l.right), (y = l.top + l.bottom));
A = B = 0;
null !== e &&
((B = e.width),
(A = e.height),
isFinite(B) && (B = Math.max(0, B - h)),
isFinite(A) && (A = Math.max(0, A - y)));
null !== e && null !== f
? ('NaN' === f && (f = w),
e.v()
? ((e = B), (v = A))
: isNaN(A)
? ((e = B), (v = v.height * f))
: ((e = v.width * f), (v = A)))
: null !== e
? e.v()
? ((f = Math.min(B / v.width, A / v.height)), (e = B), (v = A))
: isNaN(A)
? ((f = B / v.width), (e = B), (v = v.height * f))
: ((f = A / v.height), (e = v.width * f), (v = A))
: null !== f
? 'NaN' === f && g.v()
? ((f = Math.min((g.width - h) / v.width, (g.height - y) / v.height)),
f > w
? ((f = w), (e = v.width), (v = v.height))
: ((e = g.width), (v = g.height)))
: ((e = v.width * f), (v = v.height * f))
: ((f = w), (e = v.width), (v = v.height));
null !== l ? ((e += h), (v += y)) : (l = new ec(0));
null !== g &&
((w = g.width),
(g = g.height),
isNaN(w) && (w = 2e3),
isNaN(g) && (g = 2e3),
isFinite(w) && (e = Math.min(e, w)),
isFinite(g) && (v = Math.min(v, g)));
n.width = Math.ceil(e);
n.height = Math.ceil(v);
if ('SVG' === c) {
if (null === d) return null;
d.resize(n.width, n.height, n.width, n.height);
d.ownerDocument = p;
d.po = r;
tj(a, d.context, l, new K(Math.ceil(e), Math.ceil(v)), f, z, k, m, q, b);
return d.context;
}
a.Fm = !1;
tj(a, u, l, new K(Math.ceil(e), Math.ceil(v)), f, z, k, m, q, b);
a.Fm = !0;
return n.context;
}
ma.Object.defineProperties(Q.prototype, {
div: {
get: function() {
return this.La;
},
set: function(a) {
if (this.La !== a) {
var b = this.La;
null !== b
? ((b.H = void 0),
(b.goDiagram = void 0),
(b.go = void 0),
(b.innerHTML = ''),
null !== this.Ha &&
((b = this.Ha.Sa),
this.removeEventListener(b, 'pointermove', this.Xj, !1),
this.removeEventListener(b, 'pointerdown', this.Wj, !1),
this.removeEventListener(b, 'pointerup', this.Zj, !1),
this.removeEventListener(b, 'pointerout', this.Yj, !1),
this.Ha.Pw()),
this.cl && (this.cl.disconnect(), (this.cl = null)),
(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.Ha = null),
this.removeEventListener(x, 'resize', this.sv, !1),
this.removeEventListener(x, 'wheel', this.Sj, !0),
le === this && (le = null))
: (this.Qf = !1);
this.La = null;
if (null !== a) {
if ((b = a.H)) b.div = null;
si(this, a);
this.redraw();
}
}
},
},
Ew: {
get: function() {
return this.rq;
},
},
ji: {
get: function() {
return this.Qf;
},
},
draggedLink: {
get: function() {
return this.Ps;
},
set: function(a) {
this.Ps !== a &&
((this.Ps = a),
null !== a && ((this.At = a.fromPort), (this.Bt = a.toPort)));
},
},
tx: {
get: function() {
return this.At;
},
set: function(a) {
this.At = a;
},
},
ux: {
get: function() {
return this.Bt;
},
set: function(a) {
this.Bt = a;
},
},
animationManager: {
get: function() {
return this.Rd;
},
},
undoManager: {
get: function() {
return this.ac.undoManager;
},
},
skipsUndoManager: {
get: function() {
return this.Mg;
},
set: function(a) {
this.Mg = a;
this.ac.skipsUndoManager = a;
},
},
delaysLayout: {
get: function() {
return this.Ns;
},
set: function(a) {
this.Ns = a;
},
},
opacity: {
get: function() {
return this.tb;
},
set: function(a) {
var b = this.tb;
b !== a &&
((0 > a || 1 < a) && wa(a, '0 <= value <= 1', Q, 'opacity'),
(this.tb = a),
this.g('opacity', b, a),
this.N());
},
},
validCycle: {
get: function() {
return this.bu;
},
set: function(a) {
var b = this.bu;
b !== a && ((this.bu = a), this.g('validCycle', b, a));
},
},
layers: {
get: function() {
return this.Ua.iterator;
},
},
isModelReadOnly: {
get: function() {
var a = this.ac;
return null === a ? !1 : a.isReadOnly;
},
set: function(a) {
var b = this.ac;
null !== b && (b.isReadOnly = a);
},
},
isReadOnly: {
get: function() {
return this.xg;
},
set: function(a) {
var b = this.xg;
b !== a && ((this.xg = a), this.g('isReadOnly', b, a));
},
},
isEnabled: {
get: function() {
return this.Ad;
},
set: function(a) {
var b = this.Ad;
b !== a && ((this.Ad = a), this.g('isEnabled', b, a));
},
},
allowClipboard: {
get: function() {
return this.ws;
},
set: function(a) {
var b = this.ws;
b !== a && ((this.ws = a), this.g('allowClipboard', b, a));
},
},
allowCopy: {
get: function() {
return this.zi;
},
set: function(a) {
var b = this.zi;
b !== a && ((this.zi = a), this.g('allowCopy', b, a));
},
},
allowDelete: {
get: function() {
return this.Ai;
},
set: function(a) {
var b = this.Ai;
b !== a && ((this.Ai = a), this.g('allowDelete', b, a));
},
},
allowDragOut: {
get: function() {
return this.xs;
},
set: function(a) {
var b = this.xs;
b !== a && ((this.xs = a), this.g('allowDragOut', b, a));
},
},
allowDrop: {
get: function() {
return this.ys;
},
set: function(a) {
var b = this.ys;
b !== a && ((this.ys = a), this.g('allowDrop', b, a));
},
},
allowTextEdit: {
get: function() {
return this.Ji;
},
set: function(a) {
var b = this.Ji;
b !== a && ((this.Ji = a), this.g('allowTextEdit', b, a));
},
},
allowGroup: {
get: function() {
return this.Bi;
},
set: function(a) {
var b = this.Bi;
b !== a && ((this.Bi = a), this.g('allowGroup', b, a));
},
},
allowUngroup: {
get: function() {
return this.Ki;
},
set: function(a) {
var b = this.Ki;
b !== a && ((this.Ki = a), this.g('allowUngroup', b, a));
},
},
allowInsert: {
get: function() {
return this.As;
},
set: function(a) {
var b = this.As;
b !== a && ((this.As = a), this.g('allowInsert', b, a));
},
},
allowLink: {
get: function() {
return this.Ci;
},
set: function(a) {
var b = this.Ci;
b !== a && ((this.Ci = a), this.g('allowLink', b, a));
},
},
allowRelink: {
get: function() {
return this.Ei;
},
set: function(a) {
var b = this.Ei;
b !== a && ((this.Ei = a), this.g('allowRelink', b, a));
},
},
allowMove: {
get: function() {
return this.Di;
},
set: function(a) {
var b = this.Di;
b !== a && ((this.Di = a), this.g('allowMove', b, a));
},
},
allowReshape: {
get: function() {
return this.Fi;
},
set: function(a) {
var b = this.Fi;
b !== a && ((this.Fi = a), this.g('allowReshape', b, a));
},
},
allowResize: {
get: function() {
return this.Gi;
},
set: function(a) {
var b = this.Gi;
b !== a && ((this.Gi = a), this.g('allowResize', b, a));
},
},
allowRotate: {
get: function() {
return this.Hi;
},
set: function(a) {
var b = this.Hi;
b !== a && ((this.Hi = a), this.g('allowRotate', b, a));
},
},
allowSelect: {
get: function() {
return this.Ii;
},
set: function(a) {
var b = this.Ii;
b !== a && ((this.Ii = a), this.g('allowSelect', b, a));
},
},
allowUndo: {
get: function() {
return this.Bs;
},
set: function(a) {
var b = this.Bs;
b !== a && ((this.Bs = a), this.g('allowUndo', b, a));
},
},
allowZoom: {
get: function() {
return this.Ds;
},
set: function(a) {
var b = this.Ds;
b !== a && ((this.Ds = a), this.g('allowZoom', b, a));
},
},
hasVerticalScrollbar: {
get: function() {
return this.Um;
},
set: function(a) {
var b = this.Um;
b !== a &&
((this.Um = a),
Wi(this),
this.N(),
this.g('hasVerticalScrollbar', b, a),
Ti(this, !1));
},
},
hasHorizontalScrollbar: {
get: function() {
return this.Tm;
},
set: function(a) {
var b = this.Tm;
b !== a &&
((this.Tm = a),
Wi(this),
this.N(),
this.g('hasHorizontalScrollbar', b, a),
Ti(this, !1));
},
},
allowHorizontalScroll: {
get: function() {
return this.zs;
},
set: function(a) {
var b = this.zs;
b !== a &&
((this.zs = a), this.g('allowHorizontalScroll', b, a), Ti(this, !1));
},
},
allowVerticalScroll: {
get: function() {
return this.Cs;
},
set: function(a) {
var b = this.Cs;
b !== a &&
((this.Cs = a), this.g('allowVerticalScroll', b, a), Ti(this, !1));
},
},
scrollHorizontalLineChange: {
get: function() {
return this.Ot;
},
set: function(a) {
var b = this.Ot;
b !== a &&
(0 > a && wa(a, '>= 0', Q, 'scrollHorizontalLineChange'),
(this.Ot = a),
this.g('scrollHorizontalLineChange', b, a));
},
},
scrollVerticalLineChange: {
get: function() {
return this.St;
},
set: function(a) {
var b = this.St;
b !== a &&
(0 > a && wa(a, '>= 0', Q, 'scrollVerticalLineChange'),
(this.St = a),
this.g('scrollVerticalLineChange', b, a));
},
},
lastInput: {
get: function() {
return this.Yi;
},
set: function(a) {
this.Yi = a;
},
},
previousInput: {
get: function() {
return this.Hg;
},
set: function(a) {
this.Hg = a;
},
},
firstInput: {
get: function() {
return this.Fp;
},
set: function(a) {
this.Fp = a;
},
},
currentCursor: {
get: function() {
return this.Ks;
},
set: function(a) {
'' === a && (a = this.rp);
if (this.Ks !== a) {
var b = this.Ha,
c = this.La;
if (null !== b && null !== c) {
this.Ks = 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.rp;
},
set: function(a) {
'' === a && (a = 'auto');
var b = this.rp;
b !== a && ((this.rp = a), this.g('defaultCursor', b, a));
},
},
click: {
get: function() {
return this.oh;
},
set: function(a) {
var b = this.oh;
b !== a && ((this.oh = a), this.g('click', b, a));
},
},
doubleClick: {
get: function() {
return this.uh;
},
set: function(a) {
var b = this.uh;
b !== a && ((this.uh = a), this.g('doubleClick', b, a));
},
},
contextClick: {
get: function() {
return this.qh;
},
set: function(a) {
var b = this.qh;
b !== a && ((this.qh = a), this.g('contextClick', b, a));
},
},
mouseOver: {
get: function() {
return this.Jh;
},
set: function(a) {
var b = this.Jh;
b !== a && ((this.Jh = a), this.g('mouseOver', b, a));
},
},
mouseHover: {
get: function() {
return this.Hh;
},
set: function(a) {
var b = this.Hh;
b !== a && ((this.Hh = a), this.g('mouseHover', b, a));
},
},
mouseHold: {
get: function() {
return this.Gh;
},
set: function(a) {
var b = this.Gh;
b !== a && ((this.Gh = a), this.g('mouseHold', b, a));
},
},
mouseDragOver: {
get: function() {
return this.vt;
},
set: function(a) {
var b = this.vt;
b !== a && ((this.vt = a), this.g('mouseDragOver', b, a));
},
},
mouseDrop: {
get: function() {
return this.Eh;
},
set: function(a) {
var b = this.Eh;
b !== a && ((this.Eh = a), this.g('mouseDrop', b, a));
},
},
handlesDragDropForTopLevelParts: {
get: function() {
return this.$s;
},
set: function(a) {
var b = this.$s;
b !== a &&
((this.$s = a), this.g('handlesDragDropForTopLevelParts', b, a));
},
},
mouseEnter: {
get: function() {
return this.Fh;
},
set: function(a) {
var b = this.Fh;
b !== a && ((this.Fh = a), this.g('mouseEnter', b, a));
},
},
mouseLeave: {
get: function() {
return this.Ih;
},
set: function(a) {
var b = this.Ih;
b !== a && ((this.Ih = a), this.g('mouseLeave', b, a));
},
},
toolTip: {
get: function() {
return this.Th;
},
set: function(a) {
var b = this.Th;
b !== a && ((this.Th = a), this.g('toolTip', b, a));
},
},
contextMenu: {
get: function() {
return this.rh;
},
set: function(a) {
var b = this.rh;
b !== a && ((this.rh = a), this.g('contextMenu', b, a));
},
},
commandHandler: {
get: function() {
return this.hb;
},
set: function(a) {
this.hb !== a && ((this.hb = a), a.Le(this));
},
},
toolManager: {
get: function() {
return this.le;
},
set: function(a) {
this.le !== a && ((this.le = a), (a.diagram = this));
},
},
defaultTool: {
get: function() {
return this.nb;
},
set: function(a) {
var b = this.nb;
b !== a &&
((this.nb = a),
(a.diagram = this),
this.currentTool === b && (this.currentTool = a));
},
},
currentTool: {
get: function() {
return this.cb;
},
set: function(a) {
var b = this.cb;
b && (b.isActive && b.doDeactivate(), b.cancelWaitAfter(), b.doStop());
null === a && (a = this.defaultTool);
null !== a && ((this.cb = a), (a.diagram = this), a.doStart());
},
},
selection: {
get: function() {
return this.lw;
},
},
maxSelectionCount: {
get: function() {
return this.qt;
},
set: function(a) {
var b = this.qt;
if (b !== a)
if (0 <= a && !isNaN(a)) {
if (
((this.qt = a),
this.g('maxSelectionCount', b, a),
!this.undoManager.isUndoingRedoing &&
((a = this.selection.count - a), 0 < a))
) {
this.P('ChangingSelection', this.selection);
b = this.selection.Ea();
for (var c = 0; c < a; c++) b[c].isSelected = !1;
this.P('ChangedSelection', this.selection);
}
} else wa(a, '>= 0', Q, 'maxSelectionCount');
},
},
nodeSelectionAdornmentTemplate: {
get: function() {
return this.xt;
},
set: function(a) {
var b = this.xt;
b !== a &&
((this.xt = a), this.g('nodeSelectionAdornmentTemplate', b, a));
},
},
groupSelectionAdornmentTemplate: {
get: function() {
return this.Zs;
},
set: function(a) {
var b = this.Zs;
b !== a &&
((this.Zs = a), this.g('groupSelectionAdornmentTemplate', b, a));
},
},
linkSelectionAdornmentTemplate: {
get: function() {
return this.nt;
},
set: function(a) {
var b = this.nt;
b !== a &&
((this.nt = a), this.g('linkSelectionAdornmentTemplate', b, a));
},
},
highlighteds: {
get: function() {
return this.Tv;
},
},
isModified: {
get: function() {
var a = this.undoManager;
return a.isEnabled
? null !== a.currentTransaction
? !0
: this.Ym && this.se !== a.historyIndex
: this.Ym;
},
set: function(a) {
if (this.Ym !== a) {
this.Ym = a;
var b = this.undoManager;
!a && b.isEnabled && (this.se = b.historyIndex);
a || Tj(this);
}
},
},
model: {
get: function() {
return this.ac;
},
set: function(a) {
var b = this.ac;
if (b !== a) {
this.currentTool.doCancel();
b &&
b.undoManager !== a.undoManager &&
b.undoManager.isInTransaction &&
C(
'Do not replace a Diagram.model while a transaction is in progress.',
);
this.animationManager.wc(!0);
var c = Ai(this, !0);
this.Qf = !1;
this.Nm = !0;
this.se = -2;
this.cg = !1;
var d = this.wb;
this.wb = !0;
lh(this.animationManager, 'Model');
b &&
(null !== this.bf &&
this.bf.each(function(a) {
b.ak(a);
}),
b.ak(this.Hc));
this.ac = a;
this.partManager = Uj(this.ac.type);
for (var e = 0; e < c.length; e++) this.add(c[e]);
a.Ug(this.Db);
this.partManager.addAllModeledParts();
a.ak(this.Db);
a.Ug(this.Hc);
null !== this.bf &&
this.bf.each(function(b) {
a.Ug(b);
});
this.wb = d;
this.Va();
this.wb || this.N();
b && a.undoManager.copyProperties(b.undoManager);
}
},
},
$: {
get: function() {
return this.Xv;
},
set: function(a) {
this.Xv = a;
},
},
Zr: {
get: function() {
return this.Xx;
},
},
skipsModelSourceBindings: {
get: function() {
return this.mw;
},
set: function(a) {
this.mw = a;
},
},
os: {
get: function() {
return this.Ut;
},
set: function(a) {
this.Ut = a;
},
},
nodeTemplate: {
get: function() {
return this.Dg.I('');
},
set: function(a) {
var b = this.Dg.I('');
b !== a &&
(this.Dg.add('', a),
this.g('nodeTemplate', b, a),
this.undoManager.isUndoingRedoing || this.Od());
},
},
nodeTemplateMap: {
get: function() {
return this.Dg;
},
set: function(a) {
var b = this.Dg;
b !== a &&
((this.Dg = a),
this.g('nodeTemplateMap', b, a),
this.undoManager.isUndoingRedoing || this.Od());
},
},
groupTemplate: {
get: function() {
return this.Ri.I('');
},
set: function(a) {
var b = this.Ri.I('');
b !== a &&
(this.Ri.add('', a),
this.g('groupTemplate', b, a),
this.undoManager.isUndoingRedoing || this.Od());
},
},
groupTemplateMap: {
get: function() {
return this.Ri;
},
set: function(a) {
var b = this.Ri;
b !== a &&
((this.Ri = a),
this.g('groupTemplateMap', b, a),
this.undoManager.isUndoingRedoing || this.Od());
},
},
linkTemplate: {
get: function() {
return this.Ch.I('');
},
set: function(a) {
var b = this.Ch.I('');
b !== a &&
(this.Ch.add('', a),
this.g('linkTemplate', b, a),
this.undoManager.isUndoingRedoing || this.Od());
},
},
linkTemplateMap: {
get: function() {
return this.Ch;
},
set: function(a) {
var b = this.Ch;
b !== a &&
((this.Ch = a),
this.g('linkTemplateMap', b, a),
this.undoManager.isUndoingRedoing || this.Od());
},
},
isMouseCaptured: {
get: function() {
return this.Wv;
},
set: function(a) {
var b = this.Ha;
null !== b &&
((b = b.Sa),
b instanceof SVGElement ||
(a
? ((this.lastInput.bubbles = !1),
this.removeEventListener(b, 'pointermove', this.Xj, !1),
this.removeEventListener(b, 'pointerdown', this.Wj, !1),
this.removeEventListener(b, 'pointerup', this.Zj, !1),
this.removeEventListener(b, 'pointerout', this.Yj, !1),
this.addEventListener(x, 'pointermove', this.Xj, !0),
this.addEventListener(x, 'pointerdown', this.Wj, !0),
this.addEventListener(x, 'pointerup', this.Zj, !0),
this.addEventListener(x, 'pointerout', this.Yj, !0),
this.removeEventListener(b, 'wheel', this.Sj, !1),
this.addEventListener(x, 'wheel', this.Sj, !0),
this.addEventListener(
x,
'selectstart',
this.preventDefault,
!1,
))
: (this.removeEventListener(x, 'pointermove', this.Xj, !0),
this.removeEventListener(x, 'pointerdown', this.Wj, !0),
this.removeEventListener(x, 'pointerup', this.Zj, !0),
this.removeEventListener(x, 'pointerout', this.Yj, !0),
this.addEventListener(b, 'pointermove', this.Xj, !1),
this.addEventListener(b, 'pointerdown', this.Wj, !1),
this.addEventListener(b, 'pointerup', this.Zj, !1),
this.addEventListener(b, 'pointerout', this.Yj, !1),
this.removeEventListener(x, 'wheel', this.Sj, !0),
this.removeEventListener(
x,
'selectstart',
this.preventDefault,
!1,
),
this.addEventListener(b, 'wheel', this.Sj, !1)),
(this.Wv = a)));
},
},
position: {
get: function() {
return this.pa;
},
set: function(a) {
var b = I.alloc().assign(this.pa);
if (!b.C(a)) {
var c = this.viewportBounds.copy();
this.pa.assign(a);
Nh(this.animationManager, b, this.pa);
this.wb || (null === this.Ha && !this.Zn.v())
? Ci(this)
: ((this.wb = !0),
(a = this.scale),
Vi(this, this.wp, this.Ba / a, this.Aa / a, this.mk, !1),
(this.wb = !1));
if (!this.wb)
this.onViewportBoundsChanged(c, this.viewportBounds, this.xa, !1);
}
I.free(b);
},
},
initialPosition: {
get: function() {
return this.bt;
},
set: function(a) {
this.bt.C(a) || (this.bt = a.J());
},
},
initialScale: {
get: function() {
return this.ct;
},
set: function(a) {
this.ct !== a && (this.ct = a);
},
},
grid: {
get: function() {
null === this.Zd && (this.Zd = Fi(this));
return this.Zd;
},
set: function(a) {
var b = this.Zd;
if (b !== a) {
null === b && (b = this.Zd = Fi(this));
a.type !== W.Grid &&
C('Diagram.grid must be a Panel of type Panel.Grid');
var c = b.panel;
null !== c && c.remove(b);
this.Zd = a;
a.name = 'GRID';
null !== c && c.add(a);
jj(this);
this.N();
this.g('grid', b, a);
}
},
},
viewportBounds: {
get: function() {
return this.vw;
},
},
viewSize: {
get: function() {
return this.Zn;
},
set: function(a) {
var b = this.viewSize;
b.C(a) ||
((this.Zn = a = a.J()),
(this.Aa = this.Ba = 0),
a.v()
? ((this.Ba = a.width), (this.Aa = a.height))
: null !== this.La &&
((this.Ba = this.La.clientWidth || 1),
(this.Aa = this.La.clientHeight || 1)),
Ci(this),
this.Va(),
this.g('viewSize', b, a),
this.redraw());
},
},
fixedBounds: {
get: function() {
return this.Xs;
},
set: function(a) {
var b = this.Xs;
b.C(a) ||
((-Infinity !== a.width &&
Infinity !== a.height &&
-Infinity !== a.height) ||
C('fixedBounds width/height must not be Infinity'),
(this.Xs = a = a.J()),
this.Va(),
this.g('fixedBounds', b, a));
},
},
scrollMargin: {
get: function() {
return this.mj;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.mj;
b.C(a) ||
((this.mj = a = a.J()), this.g('scrollMargin', b, a), this.Jo());
},
},
scrollMode: {
get: function() {
return this.nj;
},
set: function(a) {
var b = this.nj;
b !== a &&
((this.nj = a),
a === Rh && Ti(this, !1),
this.g('scrollMode', b, a),
this.N());
},
},
scrollsPageOnFocus: {
get: function() {
return this.Tt;
},
set: function(a) {
var b = this.Tt;
b !== a && ((this.Tt = a), this.g('scrollsPageOnFocus', b, a));
},
},
positionComputation: {
get: function() {
return this.Et;
},
set: function(a) {
var b = this.Et;
b !== a &&
((this.Et = a), Ti(this, !1), this.g('positionComputation', b, a));
},
},
scaleComputation: {
get: function() {
return this.Lt;
},
set: function(a) {
var b = this.Lt;
b !== a &&
((this.Lt = a),
Rj(this, this.scale, this.scale),
this.g('scaleComputation', b, a));
},
},
documentBounds: {
get: function() {
return this.wp;
},
},
isVirtualized: {
get: function() {
return this.lt;
},
set: function(a) {
var b = this.lt;
b !== a && ((this.lt = a), this.g('isVirtualized', b, a));
},
},
scale: {
get: function() {
return this.xa;
},
set: function(a) {
var b = this.xa;
b !== a && Rj(this, b, a);
},
},
defaultScale: {
get: function() {
return this.sp;
},
set: function(a) {
this.sp = a;
},
},
autoScale: {
get: function() {
return this.nh;
},
set: function(a) {
var b = this.nh;
b !== a &&
((this.nh = a), this.g('autoScale', b, a), a !== rh && Ti(this, !1));
},
},
initialAutoScale: {
get: function() {
return this.wg;
},
set: function(a) {
var b = this.wg;
b !== a && ((this.wg = a), this.g('initialAutoScale', b, a));
},
},
initialViewportSpot: {
get: function() {
return this.dt;
},
set: function(a) {
var b = this.dt;
b !== a &&
(a.pb() || C('initialViewportSpot must be a specific Spot: ' + a),
(this.dt = a),
this.g('initialViewportSpot', b, a));
},
},
initialDocumentSpot: {
get: function() {
return this.at;
},
set: function(a) {
var b = this.at;
b !== a &&
(a.pb() || C('initialViewportSpot must be a specific Spot: ' + a),
(this.at = a),
this.g('initialDocumentSpot', b, a));
},
},
minScale: {
get: function() {
return this.tt;
},
set: function(a) {
var b = this.tt;
b !== a &&
(0 < a
? ((this.tt = a),
this.g('minScale', b, a),
a > this.scale && (this.scale = a))
: wa(a, '> 0', Q, 'minScale'));
},
},
maxScale: {
get: function() {
return this.pt;
},
set: function(a) {
var b = this.pt;
b !== a &&
(0 < a
? ((this.pt = a),
this.g('maxScale', b, a),
a < this.scale && (this.scale = a))
: wa(a, '> 0', Q, 'maxScale'));
},
},
zoomPoint: {
get: function() {
return this.eu;
},
set: function(a) {
this.eu.C(a) || (this.eu = a = a.J());
},
},
contentAlignment: {
get: function() {
return this.mk;
},
set: function(a) {
var b = this.mk;
b.C(a) ||
((this.mk = a = a.J()),
this.g('contentAlignment', b, a),
Ti(this, !1));
},
},
initialContentAlignment: {
get: function() {
return this.Rp;
},
set: function(a) {
var b = this.Rp;
b.C(a) ||
((this.Rp = a = a.J()), this.g('initialContentAlignment', b, a));
},
},
padding: {
get: function() {
return this.ub;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.ub;
b.C(a) || ((this.ub = a = a.J()), this.Va(), this.g('padding', b, a));
},
},
partManager: {
get: function() {
return this.Ic;
},
set: function(a) {
var b = this.Ic;
b !== a &&
(null !== a.diagram &&
C('Cannot share PartManagers between Diagrams: ' + a.toString()),
b && b.Le(null),
(this.Ic = a),
a.Le(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.Kc;
},
set: function(a) {
var b = this.Kc;
b !== a &&
((this.Kc = a),
(a.diagram = this),
(a.group = null),
(this.mh = !0),
this.g('layout', b, a),
this.Mb());
},
},
isTreePathToChildren: {
get: function() {
return this.kt;
},
set: function(a) {
var b = this.kt;
if (
b !== a &&
((this.kt = a),
this.g('isTreePathToChildren', b, a),
!this.undoManager.isUndoingRedoing)
)
for (a = this.nodes; a.next(); ) Ck(a.value);
},
},
treeCollapsePolicy: {
get: function() {
return this.$t;
},
set: function(a) {
var b = this.$t;
b !== a &&
(a !== vi &&
a !== Dk &&
a !== Ek &&
C('Unknown Diagram.treeCollapsePolicy: ' + a),
(this.$t = a),
this.g('treeCollapsePolicy', b, a));
},
},
Ie: {
get: function() {
return this.Vv;
},
set: function(a) {
this.Vv = a;
},
},
avoidanceCellSize: {
get: function() {
return this.Fv;
},
set: function(a) {
this.Qh = null;
this.Fv = new K(Math.max(1, a.width), Math.max(1, a.height));
},
},
avoidanceLimit: {
get: function() {
return this.Gv;
},
set: function(a) {
this.Gv = Math.max(1, a);
},
},
autoScrollInterval: {
get: function() {
return this.Yo;
},
set: function(a) {
var b = this.Yo;
b !== a && ((this.Yo = a), this.g('autoScrollInterval', b, a));
},
},
autoScrollRegion: {
get: function() {
return this.$o;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.$o;
b.C(a) ||
((this.$o = a = a.J()), this.Va(), this.g('autoScrollRegion', b, a));
},
},
});
ma.Object.defineProperties(Q, {
licenseKey: {
get: function() {
return Fk.fc();
},
set: function(a) {
Fk.add(a.replace(/\s/g, ''));
},
},
version: {
get: function() {
return Gk;
},
},
});
Q.prototype.makeImageData = Q.prototype.ox;
Q.prototype.makeImage = Q.prototype.Dz;
Q.prototype.cacheGroupExternalLinks = Q.prototype.lu;
Q.prototype.addRenderer = Q.prototype.ny;
Q.prototype.makeSVG = Q.prototype.Nu;
Q.prototype.makeSvg = Q.prototype.bs;
Q.prototype.stopAutoScroll = Q.prototype.lg;
Q.prototype.doAutoScroll = Q.prototype.Fr;
Q.prototype.isUnoccupied = Q.prototype.Pj;
Q.prototype.raiseDiagramEvent = Q.prototype.P;
Q.prototype.removeDiagramListener = Q.prototype.Il;
Q.prototype.addDiagramListener = Q.prototype.wj;
Q.prototype.findTreeRoots = Q.prototype.fz;
Q.prototype.layoutDiagram = Q.prototype.Bz;
Q.prototype.findTopLevelGroups = Q.prototype.Zy;
Q.prototype.findTopLevelNodesAndLinks = Q.prototype.$y;
Q.prototype.ensureBounds = Q.prototype.Za;
Q.prototype.findLinksByExample = Q.prototype.Ir;
Q.prototype.findNodesByExample = Q.prototype.Jr;
Q.prototype.findLinkForData = Q.prototype.Dc;
Q.prototype.findNodeForData = Q.prototype.ci;
Q.prototype.findPartForData = Q.prototype.Ec;
Q.prototype.findLinkForKey = Q.prototype.findLinkForKey;
Q.prototype.findNodeForKey = Q.prototype.Lb;
Q.prototype.findPartForKey = Q.prototype.findPartForKey;
Q.prototype.rebuildParts = Q.prototype.Od;
Q.prototype.transformViewToDoc = Q.prototype.rs;
Q.prototype.transformRectDocToView = Q.prototype.gA;
Q.prototype.transformDocToView = Q.prototype.Ro;
Q.prototype.centerRect = Q.prototype.Dr;
Q.prototype.scrollToRect = Q.prototype.bv;
Q.prototype.scroll = Q.prototype.scroll;
Q.prototype.highlightCollection = Q.prototype.rz;
Q.prototype.highlight = Q.prototype.qz;
Q.prototype.selectCollection = Q.prototype.Yz;
Q.prototype.select = Q.prototype.select;
Q.prototype.updateAllRelationshipsFromData = Q.prototype.Uo;
Q.prototype.updateAllTargetBindings = Q.prototype.updateAllTargetBindings;
Q.prototype.commit = Q.prototype.commit;
Q.prototype.rollbackTransaction = Q.prototype.Bf;
Q.prototype.commitTransaction = Q.prototype.eb;
Q.prototype.startTransaction = Q.prototype.Da;
Q.prototype.raiseChanged = Q.prototype.g;
Q.prototype.raiseChangedEvent = Q.prototype.bb;
Q.prototype.removeChangedListener = Q.prototype.ak;
Q.prototype.addChangedListener = Q.prototype.Ug;
Q.prototype.removeModelChangedListener = Q.prototype.Tz;
Q.prototype.addModelChangedListener = Q.prototype.Cw;
Q.prototype.findLayer = Q.prototype.Ij;
Q.prototype.removeLayer = Q.prototype.Rz;
Q.prototype.addLayerAfter = Q.prototype.jy;
Q.prototype.addLayerBefore = Q.prototype.Aw;
Q.prototype.addLayer = Q.prototype.pl;
Q.prototype.moveParts = Q.prototype.moveParts;
Q.prototype.copyParts = Q.prototype.Ej;
Q.prototype.removeParts = Q.prototype.hs;
Q.prototype.remove = Q.prototype.remove;
Q.prototype.add = Q.prototype.add;
Q.prototype.clearDelayedGeometries = Q.prototype.mu;
Q.prototype.setProperties = Q.prototype.Vl;
Q.prototype.attach = Q.prototype.ku;
Q.prototype.set = Q.prototype.set;
Q.prototype.resetInputOptions = Q.prototype.zx;
Q.prototype.setInputOption = Q.prototype.Zz;
Q.prototype.getInputOption = Q.prototype.yl;
Q.prototype.resetRenderingHints = Q.prototype.Ax;
Q.prototype.setRenderingHint = Q.prototype.Fx;
Q.prototype.getRenderingHint = Q.prototype.Ge;
Q.prototype.maybeUpdate = Q.prototype.nd;
Q.prototype.requestUpdate = Q.prototype.Mb;
Q.prototype.delayInitialization = Q.prototype.Ey;
Q.prototype.isUpdateRequested = Q.prototype.xz;
Q.prototype.invalidateDocumentBounds = Q.prototype.Va;
Q.prototype.findObjectsNear = Q.prototype.hg;
Q.prototype.findPartsNear = Q.prototype.Vy;
Q.prototype.findObjectsIn = Q.prototype.tf;
Q.prototype.findPartsIn = Q.prototype.Ww;
Q.prototype.findObjectsAt = Q.prototype.di;
Q.prototype.findPartsAt = Q.prototype.Uy;
Q.prototype.findObjectAt = Q.prototype.ec;
Q.prototype.findPartAt = Q.prototype.wl;
Q.prototype.focusObject = Q.prototype.gz;
Q.prototype.alignDocument = Q.prototype.py;
Q.prototype.zoomToRect = Q.prototype.kA;
Q.prototype.zoomToFit = Q.prototype.zoomToFit;
Q.prototype.diagramScroll = Q.prototype.Nw;
Q.prototype.focus = Q.prototype.focus;
var li = new pb(),
Di = null,
Og = void 0 !== x.document,
yi = null,
zi = '',
rh = new D(Q, 'None', 0),
Yi = new D(Q, 'Uniform', 1),
Zi = new D(Q, 'UniformToFill', 2),
Ef = new D(Q, 'CycleAll', 10),
If = new D(Q, 'CycleNotDirected', 11),
Kf = new D(Q, 'CycleNotDirectedFast', 12),
Lf = new D(Q, 'CycleNotUndirected', 13),
Ff = new D(Q, 'CycleDestinationTree', 14),
Hf = new D(Q, 'CycleSourceTree', 15),
Rh = new D(Q, 'DocumentScroll', 1),
Th = new D(Q, 'InfiniteScroll', 2),
vi = new D(Q, 'TreeParentCollapsed', 21),
Dk = new D(Q, 'AllParentsCollapsed', 22),
Ek = new D(Q, 'AnyParentsCollapsed', 23),
Fk = new E(),
Gk = '2.2.15',
Ak = 'image',
Hk = null,
ji = !1;
function ki() {
if (Og) {
var a = x.document.createElement('canvas'),
b = a.getContext('2d'),
c = Ma('7ca11abfd022028846');
b[c] = Ma('398c3597c01238');
// for (var d = ["5da73c80a36455d6038e4972187c3cae51fd22", ra.Dx + "4ae6247590da4bb21c324ba3a84e385776", md.xF + "fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387", J.za], e = 1; 5 > e; e++) b[Ma("7ca11abfd7330390")](Ma(d[e - 1]), 10, 15 * e);
// b[c] = Ma("39f046ebb36e4b");
// for (c = 1; 5 > c; c++) b[Ma("7ca11abfd7330390")](Ma(d[c - 1]), 10, 15 * c);
// if (4 !== d.length || "5" !== d[0][0] || "7" !== d[3][0]) md.prototype.Ld = md.prototype.Fw;
Hk = a;
}
}
Q.className = 'Diagram';
Q.fromDiv = function(a) {
var b = a;
'string' === typeof a && (b = x.document.getElementById(a));
return b instanceof HTMLDivElement && b.H instanceof Q ? b.H : null;
};
Q.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;
};
Q.useDOM = function(a) {
Og = a ? void 0 !== x.document : !1;
};
Q.isUsingDOM = function() {
return Og;
};
Q.None = rh;
Q.Uniform = Yi;
Q.UniformToFill = Zi;
Q.CycleAll = Ef;
Q.CycleNotDirected = If;
Q.CycleNotDirectedFast = Kf;
Q.CycleNotUndirected = Lf;
Q.CycleDestinationTree = Ff;
Q.CycleSourceTree = Hf;
Q.DocumentScroll = Rh;
Q.InfiniteScroll = Th;
Q.TreeParentCollapsed = vi;
Q.AllParentsCollapsed = Dk;
Q.AnyParentsCollapsed = Ek;
function ri() {
this.by = null;
this.j = 'zz@orderNum';
'63ad05bbe23a1786468a4c741b6d2' === this._tk
? (this.pd = this.j = !0)
: (this.pd = null);
}
function sj(a, b) {
b.Zb.setTransform(b.kc, 0, 0, b.kc, 0, 0);
b.Zb.Pc();
if (null === a.pd)
a: {
b = 'f';
var c = x[Ma('76a715b2f73f148a')][Ma('72ba13b5')];
a.pd = !0;
if (Og) {
var d = Q[Ma('76a115b6ed251eaf4692')];
if (d)
for (var e = Fk.iterator; e.next(); ) {
d = e.value;
d = Ma(d).split(Ma('39e9'));
if (6 > d.length) break;
var f = Ma(d[1]).split('.');
if ('7da71ca0' !== d[4]) break;
var g = Ma(ra[Ma('6cae19')]).split('.');
if (f[0] > g[0] || (f[0] === g[0] && f[1] >= g[1])) {
var h = x[Ma('74a900bae4370f8b51')][
Ma('6fbb13a1c2311e8a57')
].toLowerCase();
g = h[Ma('73a612b6fb191d')](Ma('3aad1ab6e022098b4dc4'));
f = Ma(d[2]);
if (
-1 < g &&
((h = h[Ma('73a612b6fb191d')](f.toLowerCase() + '/')),
(a.pd = !(-1 < h && h < g)),
!a.pd)
)
break;
g = c[Ma('76ad18b4f73e')];
for (h = c[Ma('73a612b6fb191d')](Ma('35e7')) + 2; h < g; h++)
b += c[h];
g = b[Ma('73a612b6fb191d')](f);
0 > g &&
f !== Ma('7da71ca0ad381e90') &&
(g = b[Ma('73a612b6fb191d')](Ma('76a715b2ef3e149757')));
0 > g &&
(g = b[Ma('73a612b6fb191d')](Ma('76a715b2ef3e149757')));
0 > g &&
(g = c[Ma('73a612b6fb191d')](Ma('7baa19a6f76c1988428554')));
a.pd = !(
(0 <= g && g < b[Ma('73a612b6fb191d')](Ma('35'))) ||
-1 === b[Ma('73a612b6fb191d')](Ma('35'))
);
if (!a.pd) break;
if (
c[Ma('73a612b6fb191d')](Ma('7fb002b6ed25128b4da25b2e')) &&
c[Ma('73a612b6fb191d')](Ma('75ba1beee63a1e875799507d')) &&
((a.pd = !(-1 < c[Ma('73a612b6fb191d')](f))), !a.pd)
)
break;
if ('#' === f[0]) {
g = x.document.createElement('div');
for (var k = d[0].replace(/[A-Za-z]/g, ''); 4 > k.length; )
k += '9';
h = k;
k = k.substr(k.length - 4);
d = '';
d += ['gsh', 'gsf'][parseInt(k.substr(0, 1), 10) % 2];
d += ['Header', 'Background', 'Display', 'Feedback'][
parseInt(k.substr(0, 1), 10) % 4
];
g[Ma('79a417a0f0181a8946')] = d;
if (x.document[Ma('78a712aa')]) {
x.document[Ma('78a712aa')][Ma('7bb806b6ed32388c4a875b')](g);
k = x
.getComputedStyle(g)
.getPropertyValue(Ma('78a704b7e62456904c9b12701b6532a8'));
var l = x
.getComputedStyle(g)
.getPropertyValue(Ma('75b817b0ea2202'));
x.document[Ma('78a712aa')][Ma('68ad1bbcf533388c4a875b')](g);
if (k)
if (
((g = x[Ma('77a902b0eb1b1e804a8a')]),
l === '0.' + (parseInt(h, 10) % 100) ||
(-1 !== k.indexOf(parseInt(f[1] + f[2], 16)) &&
-1 !== k.indexOf(parseInt(f[3] + f[4], 16))))
) {
a.pd = !1;
break;
} else if (
g &&
g(Ma('32ae19a1e0331fc94084537c067a67fa59f1386b89d006'))
.matches
)
for (
d = '.' + d, f = 0;
f < document.styleSheets.length;
f++
) {
g =
document.styleSheets[f].rules ||
document.styleSheets[f].cssRules;
for (var m in g)
if (d === g[m].selectorText) {
a.pd = !1;
break a;
}
}
} else (a.pd = null), (a.pd = !1);
}
}
}
else {
m = c[Ma('76ad18b4f73e')];
for (e = c[Ma('73a612b6fb191d')](Ma('35e7')) + 2; e < m; e++)
b += c[e];
c = b[Ma('73a612b6fb191d')](Ma('7da71ca0ad381e90'));
a.pd = !(0 <= c && c < b[Ma('73a612b6fb191d')](Ma('35')));
}
}
}
return 0 < a.pd && a !== a.by ? !0 : !1;
}
function si(a, b) {
if (Og) {
(void 0 !== b && null !== b) ||
C('Diagram setup requires an argument DIV.');
null !== a.La && C('Diagram has already completed setup.');
'string' === typeof b
? (a.La = x.document.getElementById(b))
: b instanceof HTMLDivElement
? (a.La = b)
: C('No DIV or DIV id supplied: ' + b);
null === a.La && C('Invalid DIV id; could not get element with id: ' + b);
void 0 !== a.La.H &&
C('Invalid div id; div already has a Diagram associated with it.');
if (!a.cl && x.ResizeObserver) {
var c = sa(function() {
a.Mb();
}, 250);
a.cl = new x.ResizeObserver(function() {
c();
});
a.cl.observe(a.La);
}
'static' === x.getComputedStyle(a.La, null).position &&
(a.La.style.position = 'relative');
b = 5;
var d = 'rgba(2' + b + '5, 255, 255, 0)';
b--;
a.La.style['-webkit-tap-highlight-color'] = d;
a.La.innerHTML = '';
a.La.H = a;
a.La.goDiagram = a;
a.La.go = x.go;
var e = a.kr ? new xj(a) : new Bk(a);
void 0 !== e.style &&
((e.style.position = 'absolute'),
(e.style.top = '0px'),
(e.style.left = '0px'),
'rtl' ===
x.getComputedStyle(a.La, null).getPropertyValue('direction') &&
(a.$m = !0),
(e.style.zIndex = '2'),
(e.style.userSelect = 'none'),
(e.style.MozUserSelect = 'none'),
(e.style.touchAction = 'none'));
a.Ha = e;
a.Zb = e.context;
d = a.Zb;
a.kc = a.computePixelRatio();
a.viewSize.v() ||
((a.Ba = a.La.clientWidth || 1), (a.Aa = a.La.clientHeight || 1));
zj(a, a.Ba, a.Aa);
a.La.insertBefore(e.Sa, a.La.firstChild);
e = new Bk(null);
e.width = 1;
e.height = 1;
a.Ov = e;
a.Ux = e.context;
if (Og) {
e = ua('div');
var f = ua('div');
e.style.position = 'absolute';
e.style.overflow = 'auto';
e.style.width = a.Ba + 'px';
e.style.height = a.Aa + 'px';
e.style.zIndex = '1';
f.style.position = 'absolute';
f.style.width = '1px';
f.style.height = '1px';
a.La.appendChild(e);
e.appendChild(f);
e.onscroll = Gi;
e.addEventListener('pointerdown', Qi);
e.H = a;
e.$x = !0;
e.ay = !0;
a.Qt = e;
a.Nt = f;
}
a.Jo = sa(function() {
a.Rh = null;
a.N();
}, 300);
a.sv = sa(function() {
sh(a);
}, 250);
a.preventDefault = function(a) {
a.preventDefault();
return !1;
};
a.Sj = function(b) {
if (a.isEnabled) {
var c = cj(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();
gj(c, b);
}
};
a.Iz = function(b) {
a.isEnabled &&
((a.Kk = !1),
cj(a, b, !0),
(b = a.currentTool),
b.cancelWaitAfter(),
b.standardMouseOver());
};
a.Wj = function(b) {
if (a.isEnabled) {
a.Kk = !0;
var c = a.Dt;
void 0 === c[b.pointerId] && (c[b.pointerId] = b);
c = a.$k;
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 ((c = 'touch' === b.pointerType || 'pen' === b.pointerType))
(a.Wt = !1), (a.jt = !0);
var e = d;
d = fj(a, b, !0, !1, !0, e);
dj(a, b, d);
d.targetDiagram = ej(b, b.target);
d.targetObject = null;
e || d.clone(a.Fp);
e = a.$v;
c = c ? 25 : 10;
b.timeStamp - a.Zv < a.hy &&
!(Math.abs(e.x - b.screenX) > c || Math.abs(e.y - b.screenY) > c)
? a.Yp++
: (a.Yp = 1);
d.clickCount = a.Yp;
a.Zv = b.timeStamp;
a.$v.kg(b.screenX, b.screenY);
a.doMouseDown();
1 === b.button ? b.preventDefault() : gj(d, b);
}
};
a.Xj = function(b) {
if (a.isEnabled) {
a.Kk = !0;
var c = a.$k;
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;
}
if (c[0].pointerId === b.pointerId) {
c = fj(a, b, !1, !1, !1, null !== c[1]);
var d = x.document.elementFromPoint(b.clientX, b.clientY);
null !== d &&
void 0 !== d.shadowRoot &&
null !== d.shadowRoot &&
(d = d.shadowRoot.elementFromPoint(b.clientX, b.clientY));
var e = a,
f = b;
d && d.H && ((f = b), (e = d.H));
c.targetDiagram = e;
dj(a, f, c);
c.targetObject = null;
a.doMouseMove();
gj(c, b);
}
}
};
a.Zj = function(b) {
if (a.isEnabled) {
a.Kk = !0;
var c = 'touch' === b.pointerType || 'pen' === b.pointerType,
d = a.Dt;
if (c && a.Wt) delete d[b.pointerId], b.preventDefault();
else if (
((d = a.$k), null !== d[0] && d[0].pointerId === b.pointerId)
) {
d[0] = null;
d = fj(a, b, !1, !0, !0, !1);
var e = x.document.elementFromPoint(b.clientX, b.clientY);
null !== e &&
void 0 !== e.shadowRoot &&
null !== e.shadowRoot &&
(e = e.shadowRoot.elementFromPoint(b.clientX, b.clientY));
null !== e && e.H instanceof Q && e.H !== a && dj(e.H, b, d);
null === e && (e = b.target);
dj(a, b, d);
d.clickCount = a.Yp;
d.targetDiagram = ej(b, e);
d.targetObject = null;
a.doMouseUp();
gj(d, b);
c && (a.jt = !1);
} else
null !== d[1] && d[1].pointerId === b.pointerId && (d[1] = null);
}
};
a.Yj = function(b) {
if (a.isEnabled) {
a.Kk = !1;
var c = a.Dt;
c[b.pointerId] && delete c[b.pointerId];
c = a.$k;
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());
}
};
a.Qs = d.Z['d' + Ik[1] + Ik[2] + 'wI' + Ak.slice(1, 5)][
'b' + Jk.slice(1, b)
](d.Z, Hk, b, b);
d.Oc(!0);
Ei(a);
}
}
ri.className = 'DiagramHelper';
function Te(a) {
this.j = void 0 === a ? new I() : a;
this.m = new I();
}
ma.Object.defineProperties(Te.prototype, {
point: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
shifted: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
});
var Ik = 'DraggingInfo';
Te.className = 'DraggingInfo';
function Kj(a, b, c) {
this.node = a;
this.info = b;
this.Eu = c;
}
Kj.className = 'DraggingNodeInfoPair';
function Ce() {
this.reset();
}
Ce.prototype.reset = function() {
this.isGridSnapEnabled = !1;
this.isGridSnapRealtime = !0;
this.gridSnapCellSize = new K(NaN, NaN).freeze();
this.gridSnapCellSpot = tc;
this.gridSnapOrigin = new I(NaN, NaN).freeze();
this.groupsSnapMembers = this.dragsTree = this.dragsLink = !1;
this.dragsMembers = this.groupsAlwaysMove = !0;
};
Ce.className = 'DraggingOptions';
function Kk(a, b) {
if ('string' === typeof a || (x.Element && a instanceof Element))
var c = Q.call(this, a) || this;
else (c = Q.call(this) || this), (b = a);
Lk(c);
b && c.Vl(b);
return c;
}
la(Kk, Q);
function Lk(a) {
a.allowDragOut = !0;
a.allowMove = !1;
a.isReadOnly = !0;
a.contentAlignment = uc;
a.layout = new Mk();
}
Kk.prototype.reset = function() {
Q.prototype.reset.call(this);
Lk(this);
};
Kk.className = 'Palette';
function Nk(a, b) {
if ('string' === typeof a || (x.Element && a instanceof Element))
var c = Q.call(this, a) || this;
else (c = Q.call(this) || this), (b = a);
var d = c;
c.animationManager.isEnabled = !1;
c.wb = !0;
c.W = null;
c.Tm = !1;
c.Um = !1;
c.F = !0;
c.u = !0;
c.ga = 0;
c.m = !1;
c.fl = null;
c.Fx('drawShadows', !1);
a = new U();
var e = new Cf();
e.stroke = 'magenta';
e.strokeWidth = 2;
e.fill = 'transparent';
e.name = 'BOXSHAPE';
a.selectable = !0;
a.selectionAdorned = !1;
a.selectionObjectName = 'BOXSHAPE';
a.locationObjectName = 'BOXSHAPE';
a.resizeObjectName = 'BOXSHAPE';
a.cursor = 'move';
a.add(e);
c.j = a;
c.allowCopy = !1;
c.allowDelete = !1;
c.allowSelect = !0;
c.autoScrollRegion = new ec(0, 0, 0, 0);
c.pa.h(0, 0);
c.toolManager.gb('Dragging', new Ok(), c.toolManager.mouseMoveTools);
c.click = function() {
var a = d.observed;
if (null !== a) {
var b = a.viewportBounds,
c = d.lastInput.documentPoint;
a.position = new I(c.x - b.width / 2, c.y - b.height / 2);
}
};
c.Gf = function() {
d.Va();
Pk(d);
};
c.Qd = function() {
null !== d.observed && (d.Va(), d.N());
};
c.Ga = function() {
1 > d.updateDelay
? d.N()
: d.m ||
((d.m = !0),
setTimeout(function() {
return d.redraw();
}, d.updateDelay));
};
c.Ff = function() {
null !== d.observed && Pk(d);
};
c.autoScale = Yi;
c.wb = !1;
b && Object.assign(c, b);
return c;
}
la(Nk, Q);
Nk.prototype.computePixelRatio = function() {
return 1;
};
Nk.prototype.redraw = function() {
if (this.m && 1 <= this.updateDelay) {
this.m = !1;
var a = this.Ha,
b = this.Zb;
if (null !== a && null !== b) {
qj(this);
if (null === this.fl) {
var c = new Bk(null);
c.width = a.width;
c.height = a.height;
this.fl = c;
}
try {
(this.Ha = this.fl),
(this.Zb = this.Ha.context),
this.Zb.Oc(!0),
this.Zb.setTransform(1, 0, 0, 1, 0, 0),
this.Zb.clearRect(0, 0, this.Ha.width, this.Ha.height),
Qk(this);
} finally {
(this.Ha = a), (this.Zb = b);
}
}
}
Q.prototype.redraw.call(this);
};
Nk.prototype.tc = function() {
null === this.La && C('No div specified');
null === this.Ha && C('No canvas specified');
if (!(this.Ha instanceof xj) && (ei(this.box), this.bd)) {
var a = this.observed;
if (
null !== a &&
!a.animationManager.defaultAnimation.isAnimating &&
a.ji
) {
qj(this);
var b = this.Ha;
a = this.Zb;
a.Oc(!0);
a.setTransform(1, 0, 0, 1, 0, 0);
a.clearRect(0, 0, b.width, b.height);
1 > this.updateDelay
? Qk(this)
: null !== this.fl &&
(a.drawImage(this.fl.Sa, 0, 0),
(b = this.Bb),
b.reset(),
1 !== this.scale && b.scale(this.scale),
(0 === this.position.x && 0 === this.position.y) ||
b.translate(-this.position.x, -this.position.y),
a.scale(this.kc, this.kc),
a.transform(b.m11, b.m12, b.m21, b.m22, b.dx, b.dy));
b = this.Ua.s;
for (var c = b.length, d = 0; d < c; d++) b[d].tc(a, this);
this.bd = this.Ui = !1;
}
}
};
function Qk(a) {
var b = a.observed;
if (null !== b) {
var c = a.drawsTemporaryLayers,
d = a.drawsGrid && c,
e = b.grid;
d &&
null !== e &&
e.visible &&
!isNaN(e.width) &&
!isNaN(e.height) &&
((e = M.alloc()
.assign(a.viewportBounds)
.Xc(b.viewportBounds)),
jj(b, e),
M.free(e),
mh(b));
var f = a.Bb;
f.reset();
1 !== a.scale && f.scale(a.scale);
(0 === a.position.x && 0 === a.position.y) ||
f.translate(-a.position.x, -a.position.y);
e = a.Zb;
e.scale(a.kc, a.kc);
e.transform(f.m11, f.m12, f.m21, f.m22, f.dx, f.dy);
b = b.Ua.s;
f = b.length;
for (var g = 0; g < f; g++) {
var h = b[g],
k = a;
if (h.visible && 0 !== h.opacity) {
var l = h.diagram.grid.part;
if (!c && h.isTemporary)
d &&
l.layer === h &&
((h = fi(h, e)), l.tc(e, k), (e.globalAlpha = h));
else {
for (
var m = fi(h, e),
n = k.scale,
p = M.alloc(),
r = h.Ma.s,
q = r.length,
u = 0;
u < q;
u++
) {
var w = r[u];
(d || w !== l) && h.$h(e, w, k, null, n, p, !1);
}
M.free(p);
e.globalAlpha = m;
}
}
}
}
}
function Pk(a) {
var b = a.box;
if (null !== b) {
var c = a.observed;
if (null !== c) {
a.bd = !0;
c = c.viewportBounds;
var d = b.selectionObject,
e = K.alloc();
e.h(c.width, c.height);
d.desiredSize = e;
K.free(e);
a = 2 / a.scale;
d instanceof Cf && (d.strokeWidth = a);
b.location = new I(c.x - a / 2, c.y - a / 2);
b.isSelected = !0;
}
}
}
Nk.prototype.computeBounds = function() {
var a = this.observed;
if (null === a) return cc;
var b = a.documentBounds.copy();
b.Xc(a.viewportBounds);
return b;
};
Nk.prototype.invalidateViewport = function() {
!0 !== this.bd && ((this.bd = !0), this.Mb());
};
Nk.prototype.onViewportBoundsChanged = function(a, b, c, d) {
this.wb ||
(Ri(this),
this.N(),
Wi(this),
this.Va(),
Pk(this),
(this.kd.scale = c),
(this.kd.position.x = a.x),
(this.kd.position.y = a.y),
this.kd.bounds.assign(a),
(this.kd.lx = d),
this.P('ViewportBoundsChanged', this.kd, a));
};
ma.Object.defineProperties(Nk.prototype, {
observed: {
get: function() {
return this.W;
},
set: function(a) {
var b = this.W;
a instanceof Nk &&
C('Overview.observed Diagram may not be an Overview itself: ' + a);
if (b !== a) {
null !== b &&
(this.remove(this.box),
b.Il('ViewportBoundsChanged', this.Gf),
b.Il('DocumentBoundsChanged', this.Qd),
b.Il('InvalidateDraw', this.Ga),
b.Il('AnimationFinished', this.Ff));
this.W = a;
null !== a &&
(a.wj('ViewportBoundsChanged', this.Gf),
a.wj('DocumentBoundsChanged', this.Qd),
a.wj('InvalidateDraw', this.Ga),
a.wj('AnimationFinished', this.Ff),
this.add(this.box));
this.Va();
if (null === a) {
this.fl = null;
var c = this.Ha,
d = this.Zb;
c &&
d &&
(d.setTransform(1, 0, 0, 1, 0, 0),
d.clearRect(0, 0, c.width, c.height));
} else this.Ga(null), Pk(this), this.N();
this.g('observed', b, a);
}
},
},
box: {
get: function() {
return this.j;
},
set: function(a) {
var b = this.j;
b !== a &&
((this.j = a),
this.remove(b),
this.add(this.j),
Pk(this),
this.g('box', b, a));
},
},
drawsTemporaryLayers: {
get: function() {
return this.F;
},
set: function(a) {
this.F !== a && ((this.F = a), this.redraw());
},
},
drawsGrid: {
get: function() {
return this.u;
},
set: function(a) {
this.u !== a && ((this.u = a), this.redraw());
},
},
updateDelay: {
get: function() {
return this.ga;
},
set: function(a) {
0 > a && (a = 0);
this.ga !== a && (this.ga = a);
},
},
});
Nk.className = 'Overview';
function Ok() {
Be.call(this);
this.j = null;
}
la(Ok, Be);
Ok.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.j = new I(c.width / 2, c.height / 2)),
(a = a.firstInput.documentPoint),
(b.position = new I(a.x - this.j.x, a.y - this.j.y)));
return !0;
};
Ok.prototype.doActivate = function() {
this.j = null;
Be.prototype.doActivate.call(this);
};
Ok.prototype.doUpdateCursor = function() {
var a = this.diagram,
b = a.box;
null !== b && b.cursor && (a.currentCursor = b.cursor);
};
Ok.prototype.moveParts = function() {
var a = this.diagram,
b = a.observed;
if (null !== b) {
var c = a.box;
if (null !== c) {
if (null === this.j) {
var d = a.firstInput.documentPoint;
c = c.location;
this.j = new I(d.x - c.x, d.y - c.y);
}
a = a.lastInput.documentPoint;
b.position = new I(a.x - this.j.x, a.y - this.j.y);
}
}
};
Ok.className = 'OverviewDraggingTool';
function Rk() {
Ra(this);
this.H = le;
this.Ga = this.u = this.m = !0;
this.F = this.W = this.hb = this.ga = !1;
this.dj = this.j = null;
this.Db = 1.05;
this.mt = NaN;
this.Yv = null;
this.fu = NaN;
this.du = cc;
this.cb = !0;
this.Vf = null;
this.nb = 200;
}
Rk.prototype.toString = function() {
return 'CommandHandler';
};
Rk.prototype.Le = function(a) {
this.H = a;
};
Rk.prototype.doKeyDown = function() {
var a = this.diagram,
b = a.lastInput,
c = Qa ? 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()
: 'F2' === f || (b.event && 'F2' === b.event.key)
? this.canEditTextBlock() && this.editTextBlock()
: 'ContextMenu' === f || (b.event && 'ContextMenu' === b.event.key)
? this.canShowContextMenu() && this.showContextMenu()
: (b.bubbles = !0)
: this.canCopySelection() && this.copySelection();
};
Rk.prototype.doKeyUp = function() {
this.diagram.lastInput.bubbles = !0;
};
Rk.prototype.stopCommand = function() {
var a = this.diagram,
b = a.currentTool;
b instanceof La && a.allowSelect && a.clearSelection();
null !== b && b.doCancel();
};
Rk.prototype.canStopCommand = function() {
return !0;
};
Rk.prototype.selectAll = function() {
var a = this.diagram;
a.N();
try {
a.currentCursor = 'wait';
a.P('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.P('ChangedSelection', a.selection), (a.currentCursor = '');
}
};
Rk.prototype.canSelectAll = function() {
return this.diagram.allowSelect;
};
Rk.prototype.deleteSelection = function() {
var a = this.diagram;
try {
a.currentCursor = 'wait';
a.P('ChangingSelection', a.selection);
a.Da('Delete');
a.P('SelectionDeleting', a.selection);
for (var b = new G(), c = a.selection.iterator; c.next(); )
Sk(
b,
c.value,
!0,
this.deletesTree ? Infinity : 0,
this.deletesConnectedLinks ? null : !1,
function(a) {
return a.canDelete();
},
);
a.hs(b, !0);
a.P('SelectionDeleted', b);
} finally {
a.eb('Delete'),
a.P('ChangedSelection', a.selection),
(a.currentCursor = '');
}
};
Rk.prototype.canDeleteSelection = function() {
var a = this.diagram;
return a.isReadOnly ||
a.isModelReadOnly ||
!a.allowDelete ||
0 === a.selection.count
? !1
: !0;
};
Rk.prototype.copySelection = function() {
var a = this.diagram,
b = new G();
for (a = a.selection.iterator; a.next(); )
Sk(
b,
a.value,
!0,
this.copiesTree ? Infinity : 0,
this.copiesConnectedLinks,
function(a) {
return a.canCopy();
},
);
this.copyToClipboard(b);
};
Rk.prototype.canCopySelection = function() {
var a = this.diagram;
return a.allowCopy && a.allowClipboard && 0 !== a.selection.count ? !0 : !1;
};
Rk.prototype.cutSelection = function() {
this.copySelection();
this.deleteSelection();
};
Rk.prototype.canCutSelection = function() {
var a = this.diagram;
return !a.isReadOnly &&
!a.isModelReadOnly &&
a.allowCopy &&
a.allowDelete &&
a.allowClipboard &&
0 !== a.selection.count
? !0
: !1;
};
Rk.prototype.copyToClipboard = function(a) {
var b = this.diagram,
c = null;
if (null === a) (yi = null), (zi = '');
else {
c = b.model;
var d = !1,
e = !1,
f = null;
try {
c.Bl() && ((d = c.Dj), (c.Dj = this.copiesParentKey)),
c.Nj() && ((e = c.Cj), (c.Cj = this.copiesGroupKey)),
(f = b.Ej(a, null, !0));
} finally {
c.Bl() && (c.Dj = d),
c.Nj() && (c.Cj = e),
(c = new E()),
c.addAll(f),
(yi = c),
(zi = b.model.dataFormat);
}
}
b.P('ClipboardChanged', c);
};
Rk.prototype.pasteFromClipboard = function() {
var a = new G(),
b = yi;
if (null === b) return a;
var c = this.diagram;
if (zi !== c.model.dataFormat) return a;
var d = c.model,
e = !1,
f = !1,
g = null;
try {
d.Bl() && ((e = d.Dj), (d.Dj = this.copiesParentKey)),
d.Nj() && ((f = d.Cj), (d.Cj = this.copiesGroupKey)),
(g = c.Ej(b, c, !1));
} finally {
for (
d.Bl() && (d.Dj = e), d.Nj() && (d.Cj = f), b = g.iterator;
b.next();
)
(c = b.value),
(d = b.key),
c.location.v() ||
(d.location.v()
? (c.location = d.location)
: !c.position.v() && d.position.v() && (c.position = d.position)),
a.add(c);
}
return a;
};
Rk.prototype.pasteSelection = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.currentCursor = 'wait';
b.P('ChangingSelection', b.selection);
b.Da('Paste');
var c = this.pasteFromClipboard();
0 < c.count && b.clearSelection(!0);
for (var d = c.iterator; d.next(); ) d.value.isSelected = !0;
if (null !== a) {
var e = b.computePartsBounds(b.selection);
if (e.v()) {
var f = this.computeEffectiveCollection(b.selection, b.Em);
ef(b, f, new I(a.x - e.centerX, a.y - e.centerY), b.Em, !1);
}
}
b.P('ClipboardPasted', c);
} finally {
b.eb('Paste'),
b.P('ChangedSelection', b.selection),
(b.currentCursor = '');
}
};
Rk.prototype.canPasteSelection = function() {
var a = this.diagram;
return a.isReadOnly ||
a.isModelReadOnly ||
!a.allowInsert ||
!a.allowClipboard ||
null === yi ||
0 === yi.count ||
zi !== a.model.dataFormat
? !1
: !0;
};
Rk.prototype.undo = function() {
this.diagram.undoManager.undo();
};
Rk.prototype.canUndo = function() {
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly
? !1
: a.allowUndo && a.undoManager.canUndo();
};
Rk.prototype.redo = function() {
this.diagram.undoManager.redo();
};
Rk.prototype.canRedo = function() {
var a = this.diagram;
return a.isReadOnly || a.isModelReadOnly
? !1
: a.allowUndo && a.undoManager.canRedo();
};
Rk.prototype.decreaseZoom = function(a) {
void 0 === a && (a = 1 / this.zoomFactor);
var b = this.diagram;
b.autoScale === rh &&
((a = b.scale * a), a < b.minScale || a > b.maxScale || (b.scale = a));
};
Rk.prototype.canDecreaseZoom = function(a) {
void 0 === a && (a = 1 / this.zoomFactor);
var b = this.diagram;
if (b.autoScale !== rh) return !1;
a = b.scale * a;
return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom;
};
Rk.prototype.increaseZoom = function(a) {
void 0 === a && (a = this.zoomFactor);
var b = this.diagram;
b.autoScale === rh &&
((a = b.scale * a), a < b.minScale || a > b.maxScale || (b.scale = a));
};
Rk.prototype.canIncreaseZoom = function(a) {
void 0 === a && (a = this.zoomFactor);
var b = this.diagram;
if (b.autoScale !== rh) return !1;
a = b.scale * a;
return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom;
};
Rk.prototype.resetZoom = function(a) {
void 0 === a && (a = this.defaultScale);
var b = this.diagram;
a < b.minScale || a > b.maxScale || (b.scale = a);
};
Rk.prototype.canResetZoom = function(a) {
void 0 === a && (a = this.defaultScale);
var b = this.diagram;
return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom;
};
Rk.prototype.zoomToFit = function() {
var a = this.diagram,
b = a.animationManager;
b.wc();
a.redraw();
var c = a.position,
d = a.scale;
lh(b, 'Zoom To Fit');
this.isZoomToFitRestoreEnabled &&
d === this.fu &&
!isNaN(this.mt) &&
a.documentBounds.C(this.du)
? ((a.scale = this.mt),
(a.position = this.Yv),
(this.fu = NaN),
(this.du = cc))
: ((this.mt = d),
(this.Yv = c.copy()),
a.zoomToFit(),
(this.fu = a.scale),
(this.du = a.documentBounds.copy()));
nh(b);
};
Rk.prototype.canZoomToFit = function() {
return this.diagram.allowZoom;
};
Rk.prototype.scrollToPart = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
b.Za();
if (null === a) {
try {
null !== this.Vf &&
(this.Vf.next() ? (a = this.Vf.value) : (this.Vf = null));
} catch (k) {
this.Vf = null;
}
null === a &&
(0 < b.highlighteds.count
? (this.Vf = b.highlighteds.iterator)
: 0 < b.selection.count && (this.Vf = b.selection.iterator),
null !== this.Vf && this.Vf.next() && (a = this.Vf.value));
}
if (null !== a) {
var c = b.animationManager;
lh(c, 'Scroll To Part');
var d = this.scrollToPartPause;
if (0 < d) {
var e = Tk(this, a, [a]);
if (1 === e.length)
b.Da(), b.Dr(a.actualBounds), b.eb('Scroll To Part');
else {
var f = function() {
b.Da();
for (
var a = e.pop();
0 < e.length &&
a instanceof V &&
a.isTreeExpanded &&
(!(a instanceof qf) || a.isSubGraphExpanded);
)
a = e.pop();
0 < e.length
? (a instanceof U && b.bv(a.actualBounds),
a instanceof V &&
!a.isTreeExpanded &&
(a.isTreeExpanded = !0),
a instanceof qf &&
!a.isSubGraphExpanded &&
(a.isSubGraphExpanded = !0))
: (a instanceof U && b.Dr(a.actualBounds),
b.Il('LayoutCompleted', g));
b.eb('Scroll To Part');
},
g = function() {
ta(f, (c.isEnabled ? c.duration : 0) + d);
};
b.wj('LayoutCompleted', g);
f();
}
} else {
var h = b.position.copy();
b.Dr(a.actualBounds);
h.$a(b.position) && c.wc();
}
}
};
function Tk(a, b, c) {
if (b.isVisible()) return c;
if (b instanceof ue) Tk(a, b.adornedPart, c);
else if (b instanceof T) {
var d = b.fromNode;
null !== d && Tk(a, d, c);
b = b.toNode;
null !== b && Tk(a, b, c);
} else
b instanceof V &&
((d = b.labeledLink),
null !== d && Tk(a, d, c),
(d = b.ig()),
null !== d &&
(d.isTreeExpanded || d.wasTreeExpanded || c.push(d), Tk(a, d, c))),
(b = b.containingGroup),
null !== b &&
(b.isSubGraphExpanded || b.wasSubGraphExpanded || c.push(b),
Tk(a, b, c));
return c;
}
Rk.prototype.canScrollToPart = function(a) {
void 0 === a && (a = null);
if (null !== a && !(a instanceof U)) return !1;
a = this.diagram;
return 0 === a.selection.count && 0 === a.highlighteds.count
? !1
: a.allowHorizontalScroll && a.allowVerticalScroll;
};
Rk.prototype.collapseTree = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Da('Collapse Tree');
lh(b.animationManager, '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.P('TreeCollapsed', c);
} finally {
b.eb('Collapse Tree');
}
};
Rk.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.to().count) return !0;
} else
for (a = b.selection.iterator; a.next(); )
if (
((b = a.value),
b instanceof V && b.isTreeExpanded && 0 < b.to().count)
)
return !0;
return !1;
};
Rk.prototype.expandTree = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Da('Expand Tree');
lh(b.animationManager, '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.P('TreeExpanded', c);
} finally {
b.eb('Expand Tree');
}
};
Rk.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.to().count) return !0;
} else
for (a = b.selection.iterator; a.next(); )
if (
((b = a.value),
b instanceof V && !b.isTreeExpanded && 0 < b.to().count)
)
return !0;
return !1;
};
Rk.prototype.groupSelection = function() {
var a = this.diagram,
b = a.model;
if (b.Oj()) {
var c = this.archetypeGroupData;
if (null !== c) {
var d = null;
try {
a.currentCursor = 'wait';
a.P('ChangingSelection', a.selection);
a.Da('Group');
for (var e = new E(), f = a.selection.iterator; f.next(); ) {
var g = f.value;
g.Tc() && 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.Md(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.Md(n)) {
e = !0;
break;
}
if (e) n = n.containingGroup;
else break;
}
if (c instanceof qf) kg(c), (d = c.copy()), null !== d && a.add(d);
else if (b.Ku(c)) {
var r = b.copyNodeData(c);
ya(r) && (b.lf(r), (d = a.ci(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.clearSelection(!0);
d.isSelected = !0;
}
}
a.P('SelectionGrouped', d);
} finally {
a.eb('Group'),
a.P('ChangedSelection', a.selection),
(a.currentCursor = '');
}
}
}
};
Rk.prototype.canGroupSelection = function() {
var a = this.diagram;
if (
a.isReadOnly ||
a.isModelReadOnly ||
!a.allowInsert ||
!a.allowGroup ||
!a.model.Oj() ||
null === this.archetypeGroupData
)
return !1;
for (a = a.selection.iterator; a.next(); ) {
var b = a.value;
if (b.Tc() && b.canGroup()) return !0;
}
return !1;
};
function Uk(a) {
var b = Ea();
for (a = a.iterator; a.next(); ) {
var c = a.value;
c instanceof T || b.push(c);
}
a = new G();
c = b.length;
for (var d = 0; d < c; d++) {
for (var e = b[d], f = !0, g = 0; g < c; g++)
if (e.Md(b[g])) {
f = !1;
break;
}
f && a.add(e);
}
Ga(b);
return a;
}
Rk.prototype.isValidMember = function(a, b) {
if (null === b || a === b || b instanceof T) return !1;
if (null !== a) {
if (a === b || a.Md(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;
};
Rk.prototype.ungroupSelection = function(a) {
void 0 === a && (a = null);
var b = this.diagram,
c = b.model;
if (c.Oj())
try {
b.currentCursor = 'wait';
b.P('ChangingSelection', b.selection);
b.Da('Ungroup');
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 qf && f.canUngroup() && d.add(f);
}
var g = new E();
if (0 < d.count) {
b.clearSelection(!0);
for (var h = d.iterator; h.next(); ) {
var k = h.value;
k.expandSubGraph();
var l = k.containingGroup,
m = null !== l && null !== l.data ? c.ua(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 T)) {
var r = p.data;
null !== r ? c.Po(r, m) : (p.containingGroup = l);
}
}
b.remove(k);
}
}
b.P('SelectionUngrouped', d, g);
} finally {
b.eb('Ungroup'),
b.P('ChangedSelection', b.selection),
(b.currentCursor = '');
}
};
Rk.prototype.canUngroupSelection = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
if (
b.isReadOnly ||
b.isModelReadOnly ||
!b.allowDelete ||
!b.allowUngroup ||
!b.model.Oj()
)
return !1;
if (null !== a) {
if (!(a instanceof qf)) return !1;
if (a.canUngroup()) return !0;
} else
for (a = b.selection.iterator; a.next(); )
if (((b = a.value), b instanceof qf && b.canUngroup())) return !0;
return !1;
};
Rk.prototype.addTopLevelParts = function(a, b) {
var c = !0;
for (a = Uk(a).iterator; a.next(); ) {
var d = a.value;
null !== d.containingGroup &&
(!b || this.isValidMember(null, d)
? (d.containingGroup = null)
: (c = !1));
}
return c;
};
Rk.prototype.collapseSubGraph = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Da('Collapse SubGraph');
lh(b.animationManager, '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 qf &&
e.isSubGraphExpanded &&
(e.collapseSubGraph(), c.add(e));
}
b.P('SubGraphCollapsed', c);
} finally {
b.eb('Collapse SubGraph');
}
};
Rk.prototype.canCollapseSubGraph = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly) return !1;
if (null !== a) return a instanceof qf && a.isSubGraphExpanded ? !0 : !1;
for (a = b.selection.iterator; a.next(); )
if (((b = a.value), b instanceof qf && b.isSubGraphExpanded)) return !0;
return !1;
};
Rk.prototype.expandSubGraph = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
try {
b.Da('Expand SubGraph');
lh(b.animationManager, '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 qf &&
!e.isSubGraphExpanded &&
(e.expandSubGraph(), c.add(e));
}
b.P('SubGraphExpanded', c);
} finally {
b.eb('Expand SubGraph');
}
};
Rk.prototype.canExpandSubGraph = function(a) {
void 0 === a && (a = null);
var b = this.diagram;
if (b.isReadOnly) return !1;
if (null !== a) return a instanceof qf && !a.isSubGraphExpanded ? !0 : !1;
for (a = b.selection.iterator; a.next(); )
if (((b = a.value), b instanceof qf && !b.isSubGraphExpanded)) return !0;
return !1;
};
Rk.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.vl(function(a) {
return a instanceof Qg && a.editable;
});
}
null !== a &&
((b.currentTool = null), (c.textBlock = a), (b.currentTool = c));
}
};
Rk.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 Qg)) 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.vl(function(a) {
return a instanceof Qg && a.editable;
})),
null !== a))
)
return !0;
return !1;
};
Rk.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.ia(yc))
: b.viewportBounds.ba(d.documentPoint) ||
((e = b.viewportBounds),
(e = new I(e.x + e.width / 2, e.y + e.height / 2)));
null !== e &&
((d.viewPoint = b.Ro(e)),
(d.documentPoint = e),
(d.left = !1),
(d.right = !0),
(d.up = !0));
b.currentTool = c;
Mg(c, !1, a);
}
};
Rk.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;
};
Rk.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.Em);
d = new pb();
if (null === a) return d;
for (var f = a.iterator; f.next(); ) Ij(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 T &&
((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(Rk.prototype, {
diagram: {
get: function() {
return this.H;
},
},
copiesClipboardData: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a;
},
},
copiesConnectedLinks: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
deletesConnectedLinks: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga = a;
},
},
copiesTree: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga = a;
},
},
deletesTree: {
get: function() {
return this.hb;
},
set: function(a) {
this.hb = a;
},
},
copiesParentKey: {
get: function() {
return this.W;
},
set: function(a) {
this.W = a;
},
},
copiesGroupKey: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
archetypeGroupData: {
get: function() {
return this.j;
},
set: function(a) {
this.j = a;
},
},
memberValidation: {
get: function() {
return this.dj;
},
set: function(a) {
this.dj = a;
},
},
defaultScale: {
get: function() {
return this.diagram.defaultScale;
},
set: function(a) {
this.diagram.defaultScale = a;
},
},
zoomFactor: {
get: function() {
return this.Db;
},
set: function(a) {
1 < a || C('zoomFactor must be larger than 1.0, not: ' + a);
this.Db = a;
},
},
isZoomToFitRestoreEnabled: {
get: function() {
return this.cb;
},
set: function(a) {
this.cb = a;
},
},
scrollToPartPause: {
get: function() {
return this.nb;
},
set: function(a) {
this.nb = a;
},
},
});
Rk.className = 'CommandHandler';
xi = function() {
return new Rk();
};
function Y() {
Ra(this);
this.o = 30723;
this.tb = 1;
this.Yb = this.Uf = null;
this.pa = new I(NaN, NaN).freeze();
this.$c = Mb;
this.Bb = new md();
this.lh = new md();
this.Ib = null;
this.xa = this.yk = 1;
this.Gb = 0;
this.Ag = qc;
this.qc = new M(NaN, NaN, NaN, NaN).freeze();
this.Eb = new M(NaN, NaN, NaN, NaN).freeze();
this.bc = new M(0, 0, NaN, NaN).freeze();
this.aa = this.Gn = this.Hn = null;
this.fk = this.Fb = Wc;
this.rg = this.Ln = 0;
this.Mn = this.jj = this.ib = this.sh = this.A = this.Ra = null;
}
var td, lg, ng, Vk, Wk, Xk, Yk, Zk, $k, al;
Y.prototype.cloneProtected = function(a) {
a.o = this.o | 6144;
a.tb = this.tb;
a.Yb = this.Yb;
a.pa.assign(this.pa);
a.$c = this.$c.J();
null !== this.Ib ? (a.Ib = this.Ib.copy()) : (a.Ib = null);
a.xa = this.xa;
a.Gb = this.Gb;
a.Ag = this.Ag.J();
a.qc.assign(this.qc);
a.Eb.assign(this.Eb);
a.bc.assign(this.bc);
a.Gn = this.Gn;
null !== this.aa && (a.aa = this.aa.copy());
a.Fb = this.Fb.J();
a.fk = this.fk.J();
a.Ln = this.Ln;
a.rg = this.rg;
null !== this.Ra && (a.Ra = this.Ra.copy());
null !== this.A && (a.A = this.A.ic ? this.A : this.A.copy());
null !== this.sh && (a.sh = Aa(this.sh));
null !== this.ib && (a.ib = this.ib.copy());
};
Y.prototype.zw = function(a) {
var b = this.sh;
if (za(b))
for (var c = 0; c < b.length; c++) {
if (b[c] === a) return;
}
else this.sh = b = [];
b.push(a);
};
Y.prototype.qf = function(a) {
a.Hn = null;
a.jj = null;
a.w();
};
Y.prototype.clone = function() {
var a = new this.constructor();
this.cloneProtected(a);
if (null !== this.sh)
for (var b = 0; b < this.sh.length; b++) {
var c = this.sh[b];
a[c] = this[c];
}
return a;
};
Y.prototype.copy = function() {
return this.clone();
};
t = Y.prototype;
t.ob = function(a) {
a.classType === T
? 0 === a.name.indexOf('Orient')
? (this.segmentOrientation = a)
: C(
'Unknown Link enum value for GraphObject.segmentOrientation property: ' +
a,
)
: a.classType === Y && (this.stretch = a);
};
t.toString = function() {
return Ha(this.constructor) + '#' + cb(this);
};
t.ih = function() {
null !== this.A && (this.A.ic = !0);
};
function bl(a) {
null === a.A ? (a.A = new cl()) : a.A.ic && (a.A = a.A.copy());
}
t.Rc = function() {
if (null === this.aa) {
var a = new dl();
a.Qi = sc;
a.tj = sc;
a.Oi = 10;
a.rj = 10;
a.Pi = 0;
a.sj = 0;
this.aa = a;
}
};
t.bb = function(a, b, c, d, e, f, g) {
var h = this.part;
if (
null !== h &&
(h.$j(a, b, c, d, e, f, g),
c === this && a === de && el(this) && fl(this, h, b),
(f = this.diagram),
null === this.animationTriggers ||
null === f ||
!f.ji ||
f.undoManager.isUndoingRedoing ||
f.animationManager.lm ||
((a = this.animationTriggers.get(b)),
null !== a &&
f.animationManager.isEnabled &&
!f.animationManager.isTicking &&
(null === this.Mn && (this.Mn = new pb()),
(g = 0 === f.undoManager.transactionLevel),
a.startCondition === ai
? (g = !0)
: a.startCondition === ci && (g = !1),
g
? ((f = new kh()),
bi(a, f),
(g = this.Mn.get(a)),
null !== g && g.stop(),
this.Mn.add(a, f),
(f.au = this),
(f.rw = a),
f.add(this, b, d, e),
f.start())
: (lh(f.animationManager, 'Trigger'),
f.animationManager.defaultAnimation.add(this, b, d, e)))),
this instanceof W && c === h && 0 !== (h.o & 16777216) && null !== h.data)
)
for (c = this.R.s, d = c.length, e = 0; e < d; e++)
(h = c[e]),
h instanceof W &&
Aj(h, function(a) {
null !== a.data && 0 !== (a.o & 16777216) && a.Ka(b);
});
};
function fl(a, b, c) {
var d = a.Yg();
if (null !== d)
for (var e = a.localBindings.iterator; e.next(); ) {
var f = e.value,
g = null;
if (null !== f.sourceName) {
g = gl(f, d, a);
if (null === g) continue;
f.Vo(a, g, c, null);
} else if (f.isToModel) {
var h = b.diagram;
null === h ||
h.skipsModelSourceBindings ||
f.Vo(a, h.model.modelData, c, d);
} else {
h = d.data;
if (null === h) continue;
var k = b.diagram;
null === k || k.skipsModelSourceBindings || f.Vo(a, h, c, d);
}
g === a && ((h = d.Hr(f.ti)), null !== h && f.pv(h, g, c));
}
}
t.Hr = function(a) {
return this.bindingId === a ? this : null;
};
t.g = function(a, b, c) {
this.bb(de, a, this, b, c);
};
t.ve = function(a, b, c, d) {
var e = this.qc;
e.h(a, b, c, d);
if (1 !== this.xa || 0 !== this.Gb) {
null === this.Ib && (this.Ib = new md());
var f = this.Ib;
f.reset();
this.Qn(f, a, b, c, d);
f.So(e);
}
};
function hl(a, b, c, d) {
if (!1 === a.pickable) return !1;
d.multiply(a.transform);
return c ? a.Sc(b, d) : a.Wg(b, d);
}
t.Vw = function(a, b, c) {
if (!1 === this.pickable) return !1;
var d = this.naturalBounds;
b = a.rf(b);
return c
? zb(a.x, a.y, 0, 0, 0, d.height) <= b ||
zb(a.x, a.y, 0, d.height, d.width, d.height) <= b ||
zb(a.x, a.y, d.width, d.height, d.width, 0) <= b ||
zb(a.x, a.y, d.width, 0, 0, 0) <= b
: a.td(0, 0) <= b &&
a.td(0, d.height) <= b &&
a.td(d.width, 0) <= b &&
a.td(d.width, d.height) <= b;
};
t.ke = function() {
return !0;
};
t.ba = function(a) {
var b = I.alloc();
b.assign(a);
this.transform.Fa(b);
var c = this.actualBounds;
if (!c.v()) return I.free(b), !1;
var d = this.diagram;
if (null !== d && d.jt) {
var e = d.yl('extraTouchThreshold'),
f = d.yl('extraTouchArea'),
g = f / 2,
h = this.naturalBounds;
d = this.uf() * d.scale;
var k = 1 / d;
if (h.width * d < e && h.height * d < e)
return (
(a = $b(
c.x - g * k,
c.y - g * k,
c.width + f * k,
c.height + f * k,
b.x,
b.y,
)),
I.free(b),
a
);
}
e = !1;
if (
this instanceof ue || this instanceof Cf
? $b(c.x - 5, c.y - 5, c.width + 10, c.height + 10, b.x, b.y)
: c.ba(b)
)
this.ib && !this.ib.ba(b)
? (e = !1)
: null !== this.areaBackground && c.ba(b)
? (e = !0)
: null !== this.Yb && this.bc.ba(a)
? (e = !0)
: (e = this.Xg(a));
I.free(b);
return e;
};
t.Xg = function(a) {
var b = this.naturalBounds;
return $b(0, 0, b.width, b.height, a.x, a.y);
};
t.Ee = function(a) {
if (0 === this.angle) return this.actualBounds.Ee(a);
var b = this.naturalBounds;
b = M.allocAt(0, 0, b.width, b.height);
var c = this.transform,
d = !1,
e = I.allocAt(a.x, a.y);
b.ba(c.Ld(e)) &&
(e.h(a.x, a.bottom),
b.ba(c.Ld(e)) &&
(e.h(a.right, a.bottom),
b.ba(c.Ld(e)) && (e.h(a.right, a.y), b.ba(c.Ld(e)) && (d = !0))));
I.free(e);
M.free(b);
return d;
};
t.Wg = function(a, b) {
if (void 0 === b) return a.Ee(this.actualBounds);
var c = this.naturalBounds,
d = !1,
e = I.allocAt(0, 0);
a.ba(b.Fa(e)) &&
(e.h(0, c.height),
a.ba(b.Fa(e)) &&
(e.h(c.width, c.height),
a.ba(b.Fa(e)) && (e.h(c.width, 0), a.ba(b.Fa(e)) && (d = !0))));
I.free(e);
return d;
};
t.Sc = function(a, b) {
if (void 0 === b && ((b = this.transform), 0 === this.angle))
return a.Sc(this.actualBounds);
var c = this.naturalBounds,
d = I.allocAt(0, 0),
e = I.allocAt(0, c.height),
f = I.allocAt(c.width, c.height),
g = I.allocAt(c.width, 0),
h = !1;
if (a.ba(b.Fa(d)) || a.ba(b.Fa(e)) || a.ba(b.Fa(f)) || a.ba(b.Fa(g)))
h = !0;
else {
c = M.allocAt(0, 0, c.width, c.height);
var k = I.allocAt(a.x, a.y);
c.ba(b.Ld(k))
? (h = !0)
: (k.h(a.x, a.bottom),
c.ba(b.Ld(k))
? (h = !0)
: (k.h(a.right, a.bottom),
c.ba(b.Ld(k))
? (h = !0)
: (k.h(a.right, a.y), c.ba(b.Ld(k)) && (h = !0))));
I.free(k);
M.free(c);
!h &&
(J.Rr(a, d, e) || J.Rr(a, e, f) || J.Rr(a, f, g) || J.Rr(a, g, d)) &&
(h = !0);
}
I.free(d);
I.free(e);
I.free(f);
I.free(g);
return h;
};
t.ia = function(a, b) {
void 0 === b && (b = new I());
if (a instanceof N) {
var c = this.naturalBounds;
b.h(a.x * c.width + a.offsetX, a.y * c.height + a.offsetY);
} else b.set(a);
this.ge.Fa(b);
return b;
};
t.gi = function(a) {
void 0 === a && (a = new M());
var b = this.naturalBounds,
c = this.ge,
d = I.allocAt(0, 0).transform(c);
a.h(d.x, d.y, 0, 0);
d.h(b.width, 0).transform(c);
Zb(a, d.x, d.y, 0, 0);
d.h(b.width, b.height).transform(c);
Zb(a, d.x, d.y, 0, 0);
d.h(0, b.height).transform(c);
Zb(a, d.x, d.y, 0, 0);
I.free(d);
return a;
};
t.fi = function() {
var a = this.ge;
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.uf = function() {
if ((0 !== (this.o & 4096)) === !1) return this.yk;
var a = this.xa;
return null !== this.panel ? a * this.panel.uf() : a;
};
t.Nr = function(a, b) {
void 0 === b && (b = new I());
b.assign(a);
this.ge.Ld(b);
return b;
};
t.Or = function(a, b, c) {
return this.Kj(a.x, a.y, b.x, b.y, c);
};
t.Kj = 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),
J.wf(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 = J.wf(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 !== nj(this)) {
var e = this.Ag,
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 Cf && (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 W;
switch (il(this, !0)) {
case lg:
g = e = 0;
h && (b = a = Infinity);
break;
case td:
isFinite(a) && a > c && (e = a);
isFinite(b) && b > d && (g = b);
break;
case Vk:
isFinite(a) && a > c && (e = a);
g = 0;
h && (b = Infinity);
break;
case Wk:
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.qc.ja();
this.El(a, b, c, d);
this.qc.freeze();
this.qc.v() ||
C(
'Non-real measuredBounds has been set. Object ' +
this +
', measuredBounds: ' +
this.qc.toString(),
);
ij(this, !1);
}
};
Y.prototype.El = function() {};
Y.prototype.li = function() {
return !1;
};
Y.prototype.arrange = function(a, b, c, d, e) {
this.Jk();
var f = M.alloc();
f.assign(this.Eb);
this.Eb.ja();
!1 === oj(this) ? this.Eb.h(a, b, c, d) : this.Vg(a, b, c, d);
this.Eb.freeze();
void 0 === e ? (this.ib = null) : (this.ib = e);
c = !1;
if (void 0 !== e) c = !0;
else if (
((e = this.panel),
null === e ||
(e.type !== W.TableRow && e.type !== W.TableColumn) ||
(e = e.panel),
null !== e &&
((e = e.bc),
(d = this.measuredBounds),
null !== this.areaBackground && (d = this.Eb),
(c = b + d.height),
(d = a + d.width),
(c = !(
0 <= a + 0.05 &&
d <= e.width + 0.05 &&
0 <= b + 0.05 &&
c <= e.height + 0.05
)),
this instanceof Qg &&
((a = this.naturalBounds), this.kq > a.height || this.yb > a.width)))
)
c = !0;
this.o = c ? this.o | 256 : this.o & -257;
this.Eb.v() ||
C(
'Non-real actualBounds has been set. Object ' +
this +
', actualBounds: ' +
this.Eb.toString(),
);
this.Fl(f, this.Eb);
jl(this, !1);
M.free(f);
};
t = Y.prototype;
t.Vg = function() {};
function kl(a, b, c, d, e) {
a.Eb.h(b, c, d, e);
if (!a.desiredSize.v()) {
var f = a.qc;
c = a.Ag;
b = c.right + c.left;
var g = c.top + c.bottom;
c = f.width + b;
f = f.height + g;
d += b;
e += g;
b = il(a, !0);
c === d && f === e && (b = lg);
switch (b) {
case lg:
if (c > d || f > e)
ij(a, !0), a.measure(c > d ? d : c, f > e ? e : f, 0, 0);
break;
case td:
ij(a, !0);
a.measure(d, e, 0, 0);
break;
case Vk:
ij(a, !0);
a.measure(d, f, 0, 0);
break;
case Wk:
ij(a, !0), a.measure(c, e, 0, 0);
}
}
}
t.Fl = function(a, b) {
var c = this.part;
null !== c &&
null !== c.diagram &&
((c.selectionObject !== this &&
c.resizeObject !== this &&
c.rotateObject !== this) ||
ll(c, !0),
this.N(),
Tb(a, b) || (c.dh(), this.wn(c)));
};
t.wn = function(a) {
null !== this.portId && (ll(a, !0), a instanceof V && ml(a, this));
};
t.tc = function(a, b) {
if (this.visible) {
var c = this.opacity;
if (0 !== c) {
var d =
this instanceof W &&
(this.type === W.TableRow || this.type === W.TableColumn),
e = this.Eb;
if (
d ||
(0 !== e.width && 0 !== e.height && !isNaN(e.x) && !isNaN(e.y))
) {
var f = 1;
1 !== c && ((f = a.globalAlpha), (a.globalAlpha = f * c));
if (d) {
e = this.Eb;
d = this.bc;
var g = this.areaBackground,
h = this.Yb;
(null === g && null === h) || a.Pc();
null !== g &&
(gi(this, a, g, !0, !0, d, e),
g instanceof nl && g.type === ol
? (a.beginPath(), a.rect(e.x, e.y, e.width, e.height), a.sf(g))
: a.fillRect(e.x, e.y, e.width, e.height));
null !== h &&
(gi(this, a, h, !0, !1, d, e),
h instanceof nl && h.type === ol
? (a.beginPath(), a.rect(e.x, e.y, e.width, e.height), a.sf(h))
: a.fillRect(e.x, e.y, e.width, e.height));
this.ai(a, b);
} else if (!this.Qw(a, b)) {
this instanceof T && this.Rj(!1);
d = this.transform;
g = this.panel;
(0 !== (this.o & 4096)) === !0 && pl(this);
var k = this.part;
h = !1;
var l = 0;
if (k && b.Ge('drawShadows') && (h = k.isShadowed)) {
var m = k.shadowOffset;
l = Math.max(m.y, m.x) * b.scale * b.kc;
}
m = this.li();
var n;
if (!(n = b.Vi || !m)) {
var p = this.naturalBounds;
n = this.lh;
var r = n.m11,
q = n.m21,
u = n.dx,
w = n.m12,
v = n.m22,
z = n.dy,
y,
A = (y = 0);
n = y * r + A * q + u;
var B = y * w + A * v + z;
y = p.width + l;
A = 0;
var F = y * r + A * q + u;
y = y * w + A * v + z;
A = Math.min(n, F);
var L = Math.min(B, y);
var S = Math.max(n + 0, F) - A;
var R = Math.max(B + 0, y) - L;
n = A;
B = L;
y = p.width + l;
A = p.height + l;
F = y * r + A * q + u;
y = y * w + A * v + z;
A = Math.min(n, F);
L = Math.min(B, y);
S = Math.max(n + S, F) - A;
R = Math.max(B + R, y) - L;
n = A;
B = L;
y = 0;
A = p.height + l;
F = y * r + A * q + u;
y = y * w + A * v + z;
A = Math.min(n, F);
L = Math.min(B, y);
S = Math.max(n + S, F) - A;
R = Math.max(B + R, y) - L;
n = A;
B = L;
l = b.viewportBounds;
p = l.x;
r = l.y;
n = !(
n > l.width + p ||
p > S + n ||
B > l.height + r ||
r > R + B
);
}
if (n) {
n = 0 !== (this.o & 256);
a.clipInsteadOfFill && (n = !1);
this instanceof Qg && (a.font = this.font);
if (n) {
B = g.ke() ? g.naturalBounds : g.actualBounds;
null !== this.ib
? ((p = this.ib),
(S = p.x),
(R = p.y),
(l = p.width),
(p = p.height))
: ((S = Math.max(e.x, B.x)),
(R = Math.max(e.y, B.y)),
(l = Math.min(e.right, B.right) - S),
(p = Math.min(e.bottom, B.bottom) - R));
if (S > e.width + e.x || e.x > B.width + B.x) {
1 !== c && (a.globalAlpha = f);
return;
}
a.save();
a.beginPath();
a.rect(S, R, l, p);
a.clip();
}
if (m) {
if (!k.isVisible()) {
1 !== c && (a.globalAlpha = f);
return;
}
h &&
((B = k.shadowOffset),
a.iv(
B.x * b.scale * b.kc,
B.y * b.scale * b.kc,
k.shadowBlur,
),
ql(a),
(a.shadowColor = k.shadowColor));
}
h && !0 === this.shadowVisible
? ql(a)
: h && !1 === this.shadowVisible && rl(a);
k = this.naturalBounds;
null !== this.areaBackground &&
(a.Pc(),
gi(this, a, this.areaBackground, !0, !0, k, e),
this.areaBackground instanceof nl &&
this.areaBackground.type === ol
? (a.beginPath(),
a.rect(e.x, e.y, e.width, e.height),
a.sf(this.areaBackground))
: a.fillRect(e.x, e.y, e.width, e.height));
a.transform(d.m11, d.m12, d.m21, d.m22, d.dx, d.dy);
h &&
((null !== g && 0 !== (g.o & 512)) ||
(null !== g &&
(g.type === W.Auto || g.type === W.Spot) &&
g.vb() !== this)) &&
null === this.shadowVisible &&
rl(a);
null !== this.Yb && (a.Pc(), sl(this, a, k, e));
h &&
(null !== this.Yb ||
null !== this.areaBackground ||
(null !== g && 0 !== (g.o & 512)) ||
(null !== g &&
(g.type === W.Auto || g.type === W.Spot) &&
g.vb() !== this))
? (tl(this, !0), null === this.shadowVisible && rl(a))
: tl(this, !1);
this.ai(a, b);
h && (0 !== (this.o & 512)) === !0 && ql(a);
m && h && rl(a);
n && (a.restore(), a.Oc(this instanceof W));
d.Ur() ||
((b = 1 / (d.m11 * d.m22 - d.m12 * d.m21)),
a.transform(
d.m22 * b,
-d.m12 * b,
-d.m21 * b,
d.m11 * b,
b * (d.m21 * d.dy - d.m22 * d.dx),
b * (d.m12 * d.dx - d.m11 * d.dy),
));
}
}
1 !== c && (a.globalAlpha = f);
}
}
}
};
function sl(a, b, c, d) {
var e = a.naturalBounds,
f = 0,
g = 0,
h = e.width;
e = e.height;
var k = a.Sv();
a instanceof Cf &&
((e = a.sa.bounds), (f = e.x), (g = e.y), (h = e.width), (e = e.height));
gi(a, b, a.Yb, !0, !1, c, d);
a.Yb instanceof nl && a.Yb.type === ol
? (b.beginPath(), b.rect(f - k / 2, g - k / 2, h + k, e + k), b.sf(a.Yb))
: b.fillRect(f - k / 2, g - k / 2, h + k, e + k);
}
t.Qw = function() {
return !1;
};
t.ai = function() {};
function gi(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 === ul)
d ? (b.fillStyle = c.color) : (b.strokeStyle = c.color);
else {
var l = 0;
a instanceof Cf && (l = a.strokeWidth);
h = f.width;
k = f.height;
e ? ((h = g.width), (k = g.height)) : d || ((h += l), (k += l));
if (
(f = b instanceof vl) &&
c.oe &&
(c.type === wl || (c.lk === h && c.Hs === k))
)
var m = c.oe;
else {
var n = 0,
p = 0,
r = 0,
q = 0,
u = 0,
w = 0;
w = u = 0;
e ? ((u = g.x), (w = g.y)) : d || ((u -= l / 2), (w -= l / 2));
n = c.start.x * h + c.start.offsetX;
p = c.start.y * k + c.start.offsetY;
r = c.end.x * h + c.end.offsetX;
q = c.end.y * k + c.end.offsetY;
n += u;
r += u;
p += w;
q += w;
if (c.type === xl) m = b.createLinearGradient(n, p, r, q);
else if (c.type === ol)
(w = isNaN(c.endRadius) ? Math.max(h, k) / 2 : c.endRadius),
isNaN(c.startRadius)
? ((u = 0), (w = Math.max(h, k) / 2))
: (u = c.startRadius),
(m = b.createRadialGradient(n, p, u, r, q, w));
else if (c.type === wl)
try {
m = b.createPattern(c.pattern, 'repeat');
} catch (z) {
m = null;
}
if (c.type !== wl && ((e = c.colorStops), null !== e))
for (e = e.iterator; e.next(); ) m.addColorStop(e.key, e.value);
if (
f &&
((c.oe = m),
null !== m && ((c.lk = h), (c.Hs = k)),
null === m && c.type === wl && -1 !== c.lk)
) {
c.lk = -1;
var v = a.diagram;
null !== v &&
-1 === c.lk &&
ta(function() {
v.redraw();
}, 600);
}
}
d ? (b.fillStyle = m) : (b.strokeStyle = m);
}
}
}
t.jg = function(a) {
if (a instanceof W)
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.zf = function() {
if (!this.visible) return !1;
var a = this.panel;
return null !== a ? a.zf() : !0;
};
t.yf = function() {
for (
var a = this instanceof W ? this : this.panel;
null !== a && a.isEnabled;
)
a = a.panel;
return null === a;
};
function pl(a) {
if ((0 !== (a.o & 2048)) === !0) {
var b = a.Bb;
b.reset();
if (!a.Eb.v() || !a.qc.v()) {
yl(a, !1);
return;
}
b.translate(a.Eb.x - a.qc.x, a.Eb.y - a.qc.y);
if (1 !== a.scale || 0 !== a.angle) {
var c = a.naturalBounds;
a.Qn(b, c.x, c.y, c.width, c.height);
}
yl(a, !1);
zl(a, !0);
}
(0 !== (a.o & 4096)) === !0 &&
((b = a.panel),
null === b
? (a.lh.set(a.Bb), (a.yk = a.scale), zl(a, !1))
: null !== b.ge &&
((c = a.lh),
c.reset(),
b.ke()
? c.multiply(b.lh)
: null !== b.panel && c.multiply(b.panel.lh),
c.multiply(a.Bb),
(a.yk = a.scale * b.yk),
zl(a, !1)));
}
t.Qn = function(a, b, c, d, e) {
1 !== this.xa && a.scale(this.xa);
if (0 !== this.Gb) {
var f = I.alloc();
f.pi(b, c, d, e, yc);
a.rotate(this.Gb, f.x, f.y);
I.free(f);
}
};
t.w = function(a) {
if (!nj(this)) {
void 0 === a && (a = !1);
ij(this, !0);
jl(this, !0);
var b = this.panel;
null === b || a || b.w();
}
};
t.Mj = function() {
nj(this) || (ij(this, !0), jl(this, !0));
};
function Al(a) {
if (!oj(a)) {
var b = a.panel;
null !== b
? b.w()
: a.li() &&
((b = a.diagram),
null !== b && (b.te.add(a), a instanceof V && a.vd(), b.Mb()));
jl(a, !0);
}
}
t.Jk = function() {
(0 !== (this.o & 2048)) === !1 && (yl(this, !0), zl(this, !0));
};
t.Iu = function() {
zl(this, !0);
};
t.N = function() {
var a = this.part;
null !== a && a.N();
};
function il(a, b) {
var c = a.stretch,
d = a.panel;
if (null !== d && d.type === W.Table)
return Bl(
a,
d.getRowDefinition(a.row),
d.getColumnDefinition(a.column),
b,
);
if (null !== d && d.type === W.Auto && d.vb() === a) return Cl(a, td, b);
if (c === Xk) {
if (null !== d) {
if (d.type === W.Spot && d.vb() === a) return Cl(a, td, b);
c = d.defaultStretch;
return c === Xk ? Cl(a, lg, b) : Cl(a, c, b);
}
return Cl(a, lg, b);
}
return Cl(a, c, b);
}
function Bl(a, b, c, d) {
var e = a.stretch;
if (e !== Xk) return Cl(a, e, d);
var f = (e = null);
switch (b.stretch) {
case Wk:
f = !0;
break;
case td:
f = !0;
}
switch (c.stretch) {
case Vk:
e = !0;
break;
case td:
e = !0;
}
b = a.panel.defaultStretch;
null === e && (e = b === Vk || b === td);
null === f && (f = b === Wk || b === td);
return !0 === e && !0 === f
? Cl(a, td, d)
: !0 === e
? Cl(a, Vk, d)
: !0 === f
? Cl(a, Wk, d)
: Cl(a, lg, d);
}
function Cl(a, b, c) {
if (c) return b;
if (b === lg) return lg;
c = a.desiredSize;
if (c.v()) return lg;
a = a.angle;
if (!isNaN(c.width))
if (90 !== a && 270 !== a) {
if (b === Vk) return lg;
if (b === td) return Wk;
} else {
if (b === Wk) return lg;
if (b === td) return Vk;
}
if (!isNaN(c.height))
if (90 !== a && 270 !== a) {
if (b === Wk) return lg;
if (b === td) return Vk;
} else {
if (b === Vk) return lg;
if (b === td) return Wk;
}
return b;
}
function tl(a, b) {
a.o = b ? a.o | 512 : a.o & -513;
}
function el(a) {
return 0 !== (a.o & 1024);
}
function Dl(a, b) {
a.o = b ? a.o | 1024 : a.o & -1025;
}
function yl(a, b) {
a.o = b ? a.o | 2048 : a.o & -2049;
}
function zl(a, b) {
a.o = b ? a.o | 4096 : a.o & -4097;
}
function nj(a) {
return 0 !== (a.o & 8192);
}
function ij(a, b) {
a.o = b ? a.o | 8192 : a.o & -8193;
}
function oj(a) {
return 0 !== (a.o & 16384);
}
function jl(a, b) {
a.o = b ? a.o | 16384 : a.o & -16385;
}
t.ni = function(a) {
this.Uf = a;
};
t.ns = function() {};
t.fv = function(a) {
this.pa = a;
Al(this);
return !0;
};
t.Ul = function(a, b) {
if (this.pa.x !== a || this.pa.y !== b) this.pa.h(a, b), this.Jk();
};
t.Sv = function() {
return 0;
};
function El(a) {
var b = a.part;
if (b instanceof V && (null !== a.portId || a === b.port)) {
var c = b.diagram;
null === c || c.undoManager.isUndoingRedoing || ml(b, a);
}
}
function Fl(a) {
var b = a.diagram;
null === b ||
b.undoManager.isUndoingRedoing ||
(a instanceof W
? a instanceof V
? a.vd()
: a.$l(a, function(a) {
El(a);
})
: El(a));
}
t.bind = function(a, b, c, d) {
var e = null;
'string' === typeof a ? (e = new wi(a, b, c, d)) : (e = a);
e.sd = this;
a = this.Yg();
null !== a &&
Gl(a) &&
C(
'Cannot add a Binding to a template that has already been copied: ' + e,
);
null === this.localBindings && (this.localBindings = new E());
this.localBindings.add(e);
return this;
};
t.set = function(a) {
Object.assign(this, a);
return this;
};
t.ku = function(a) {
Hl(this, a);
return this;
};
t.apply = function(a) {
a(this);
return this;
};
t.Vl = function(a) {
uj(this, a);
return this;
};
t.Yy = function() {
return this.Yg();
};
t.Yg = function() {
for (var a = this instanceof W ? this : this.panel; null !== a; ) {
if (null !== a.allBindings) return a;
a = a.panel;
}
return null;
};
t.mv = function(a) {
a.sd = this;
null === this.animationTriggers && (this.animationTriggers = new pb());
this.animationTriggers.add(a.propertyName, a);
return this;
};
function Il(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 = Jl.I(a);
'function' === typeof f
? ((c = Aa(arguments)),
(d = f(c)),
ya(d) ||
C(
'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) ||
C(
'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 Q && 1 < c.length) {
f = d;
var g = c[1];
if ('string' === typeof g || g instanceof HTMLDivElement) si(f, g), e++;
}
for (; e < c.length; e++)
(f = c[e]),
void 0 === f
? C(
'Undefined value at argument ' +
e +
' for object being constructed by GraphObject.make: ' +
d,
)
: Hl(d, f);
return d;
}
function Hl(a, b) {
if ('string' === typeof b)
if (a instanceof Qg) a.text = b;
else if (a instanceof Cf) a.figure = b;
else if (a instanceof Wj) a.source = b;
else if (a instanceof W) (b = Kl.I(b)), null !== b && (a.type = b);
else if (a instanceof nl) {
var c = Sa(nl, b);
null !== c
? (a.type = c)
: C('Unknown Brush type as an argument to GraphObject.make: ' + b);
} else
a instanceof O
? ((b = Sa(O, b)), null !== b && (a.type = b))
: a instanceof Yd && ((b = Sa(Yd, b)), null !== b && (a.type = b));
else if (b instanceof Y)
a instanceof W ||
C('A GraphObject can only be added to a Panel, not to: ' + a),
a.add(b);
else if (b instanceof Oj) {
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 Oj
? ((a = d),
b.isRow ? (a.height = b.height) : (a.width = b.width),
(a.minimum = b.minimum),
(a.maximum = b.maximum),
(a.alignment = b.alignment),
(a.stretch = b.stretch),
(a.sizing = b.sizing),
(a.Wf = null === b.separatorPadding ? null : b.separatorPadding.J()),
(a.separatorStroke = b.separatorStroke),
(a.separatorStrokeWidth = b.separatorStrokeWidth),
(a.oj = null),
b.separatorDashArray && (a.oj = Aa(b.separatorDashArray)),
(a.background = b.background),
(a.coversSeparators = b.coversSeparators),
(a.Vd = b.Vd))
: C(
'A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: ' +
a,
);
} else if (b instanceof D) 'function' === typeof a.ob && a.ob(b);
else if (b instanceof Ll) a.type = b;
else if (b instanceof wi)
a instanceof Y
? a.bind(b)
: a instanceof Oj
? a.bind(b)
: C(
'A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: ' +
a,
);
else if (b instanceof Zh)
a instanceof Y
? a.mv(b)
: C(
'An AnimationTrigger can only be applied to a GraphObject, not to: ' +
a,
);
else if (b instanceof Xd)
a instanceof O && a.type === O.m
? a.figures.add(b)
: C('A PathFigure can only be added to a Path Geometry, not to: ' + a);
else if (b instanceof Yd)
a instanceof Xd
? a.segments.add(b)
: C('A PathSegment can only be added to a PathFigure, not to: ' + a);
else if (b instanceof qi)
a instanceof Q
? (a.layout = b)
: a instanceof qf
? (a.layout = b)
: C(
'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++) Hl(a, b[c]);
else if ('object' === typeof b && null !== b)
if (a instanceof nl) {
c = new Wa();
for (var e in b)
(d = parseFloat(e)),
isNaN(d) ? (c[e] = b[e]) : a.addColorStop(d, b[e]);
uj(a, c);
} else if (a instanceof Oj) {
void 0 !== b.row
? ((e = b.row),
(void 0 === e ||
null === e ||
Infinity === e ||
isNaN(e) ||
0 > e) &&
C(
'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) &&
C(
'Must specify non-negative integer column for RowColumnDefinition ' +
b +
', not: ' +
e,
),
(a.isRow = !1),
(a.index = e));
e = new Wa();
for (c in b) 'row' !== c && 'column' !== c && (e[c] = b[c]);
uj(a, e);
} else uj(a, b);
else
C(
'Unknown initializer "' +
b +
'" for object being constructed by GraphObject.make: ' +
a,
);
}
function Ml(a, b) {
Jl.add(a, b);
}
function Nl(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, {
bindingId: {
get: function() {
return null !== this.A ? this.A.bp : -1;
},
set: function(a) {
this.bindingId !== a &&
(null === this.A && (this.A = new cl()), (this.A.bp = a));
},
},
localBindings: {
get: function() {
return null !== this.A ? this.A.Ff : null;
},
set: function(a) {
this.localBindings !== a &&
(null === this.A && (this.A = new cl()), (this.A.Ff = a));
},
},
srcBindings: {
get: function() {
return null !== this.A ? this.A.Wo : null;
},
set: function(a) {
this.srcBindings !== a &&
(null === this.A && (this.A = new cl()), (this.A.Wo = a));
},
},
shadowVisible: {
get: function() {
return null !== this.A ? this.A.wi : null;
},
set: function(a) {
var b = this.shadowVisible;
b !== a &&
(bl(this), (this.A.wi = a), this.N(), this.g('shadowVisible', b, a));
},
},
enabledChanged: {
get: function() {
return null !== this.A ? this.A.Hc : null;
},
set: function(a) {
var b = this.enabledChanged;
b !== a && (bl(this), (this.A.Hc = a), this.g('enabledChanged', b, a));
},
},
segmentOrientation: {
get: function() {
return null !== this.Ra ? this.Ra.Oq : $f;
},
set: function(a) {
var b = this.segmentOrientation;
b !== a &&
(null === this.Ra && (this.Ra = new Ol()),
(this.Ra.Oq = a),
this.w(),
this.g('segmentOrientation', b, a),
a === $f && (this.angle = 0));
},
},
segmentIndex: {
get: function() {
return null !== this.Ra ? this.Ra.u : -Infinity;
},
set: function(a) {
a = Math.round(a);
var b = this.segmentIndex;
b !== a &&
(null === this.Ra && (this.Ra = new Ol()),
(this.Ra.u = a),
this.w(),
this.g('segmentIndex', b, a));
},
},
segmentFraction: {
get: function() {
return null !== this.Ra ? this.Ra.m : 0;
},
set: function(a) {
isNaN(a) ? (a = 0) : 0 > a ? (a = 0) : 1 < a && (a = 1);
var b = this.segmentFraction;
b !== a &&
(null === this.Ra && (this.Ra = new Ol()),
(this.Ra.m = a),
this.w(),
this.g('segmentFraction', b, a));
},
},
segmentOffset: {
get: function() {
return null !== this.Ra ? this.Ra.F : qb;
},
set: function(a) {
var b = this.segmentOffset;
b.C(a) ||
((a = a.J()),
null === this.Ra && (this.Ra = new Ol()),
(this.Ra.F = a),
this.w(),
this.g('segmentOffset', b, a));
},
},
stretch: {
get: function() {
return null !== this.A ? this.A.$f : Xk;
},
set: function(a) {
var b = this.stretch;
b !== a &&
(bl(this), (this.A.$f = a), this.w(), this.g('stretch', b, a));
},
},
name: {
get: function() {
return null !== this.A ? this.A.va : '';
},
set: function(a) {
var b = this.name;
b !== a &&
(bl(this),
(this.A.va = a),
null !== this.part && (this.part.Kh = null),
this.g('name', b, a));
},
},
opacity: {
get: function() {
return this.tb;
},
set: function(a) {
var b = this.tb;
b !== a &&
((0 > a || 1 < a) && wa(a, '0 <= value <= 1', Y, 'opacity'),
(this.tb = a),
this.g('opacity', b, a),
(a = this.diagram),
(b = this.part),
null !== a && null !== b && a.N(yj(b, b.actualBounds)));
},
},
visible: {
get: function() {
return 0 !== (this.o & 1);
},
set: function(a) {
var b = 0 !== (this.o & 1);
b !== a &&
((this.o ^= 1),
this.g('visible', b, a),
(b = this.panel),
null !== b ? b.w() : this.li() && this.Ub(a),
this.N(),
Fl(this));
},
},
pickable: {
get: function() {
return 0 !== (this.o & 2);
},
set: function(a) {
var b = 0 !== (this.o & 2);
b !== a && ((this.o ^= 2), this.g('pickable', b, a));
},
},
fromLinkableDuplicates: {
get: function() {
return 0 !== (this.o & 4);
},
set: function(a) {
var b = 0 !== (this.o & 4);
b !== a && ((this.o ^= 4), this.g('fromLinkableDuplicates', b, a));
},
},
fromLinkableSelfNode: {
get: function() {
return 0 !== (this.o & 8);
},
set: function(a) {
var b = 0 !== (this.o & 8);
b !== a && ((this.o ^= 8), this.g('fromLinkableSelfNode', b, a));
},
},
toLinkableDuplicates: {
get: function() {
return 0 !== (this.o & 16);
},
set: function(a) {
var b = 0 !== (this.o & 16);
b !== a && ((this.o ^= 16), this.g('toLinkableDuplicates', b, a));
},
},
toLinkableSelfNode: {
get: function() {
return 0 !== (this.o & 32);
},
set: function(a) {
var b = 0 !== (this.o & 32);
b !== a && ((this.o ^= 32), this.g('toLinkableSelfNode', b, a));
},
},
isPanelMain: {
get: function() {
return 0 !== (this.o & 64);
},
set: function(a) {
var b = 0 !== (this.o & 64);
b !== a && ((this.o ^= 64), this.w(), this.g('isPanelMain', b, a));
},
},
isActionable: {
get: function() {
return 0 !== (this.o & 128);
},
set: function(a) {
var b = 0 !== (this.o & 128);
b !== a && ((this.o ^= 128), this.g('isActionable', b, a));
},
},
areaBackground: {
get: function() {
return null !== this.A ? this.A.nb : null;
},
set: function(a) {
var b = this.areaBackground;
b !== a &&
(null !== a && Pl(a, 'GraphObject.areaBackground'),
a instanceof nl && a.freeze(),
bl(this),
(this.A.nb = a),
this.N(),
this.g('areaBackground', b, a));
},
},
background: {
get: function() {
return this.Yb;
},
set: function(a) {
var b = this.Yb;
b !== a &&
(null !== a && Pl(a, 'GraphObject.background'),
a instanceof nl && a.freeze(),
(this.Yb = a),
this.N(),
this.g('background', b, a));
},
},
part: {
get: function() {
if (this.li()) return this;
if (null !== this.jj) return this.jj;
var a;
for (a = this.panel; a; ) {
if (a instanceof U) return (this.jj = a);
a = a.panel;
}
return null;
},
},
svg: {
get: function() {
return this.kr;
},
set: function(a) {
this.kr = a;
},
},
panel: {
get: function() {
return this.Uf;
},
},
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.pa;
},
set: function(a) {
var b = a.x,
c = a.y,
d = this.pa,
e = d.x;
d = d.y;
(e === b || (isNaN(e) && isNaN(b))) &&
(d === c || (isNaN(d) && isNaN(c)))
? this.ns()
: ((a = a.copy()),
this.fv(a, e, d) && this.g('position', new I(e, d), a));
},
},
actualBounds: {
get: function() {
return this.Eb;
},
},
scale: {
get: function() {
return this.xa;
},
set: function(a) {
var b = this.xa;
b !== a &&
(0 >= a &&
C(
'GraphObject.scale for ' +
this +
' must be greater than zero, not: ' +
a,
),
(this.xa = a),
this.w(),
this.g('scale', b, a));
},
},
angle: {
get: function() {
return this.Gb;
},
set: function(a) {
var b = this.Gb;
b !== a &&
((a %= 360),
0 > a && (a += 360),
b !== a &&
((this.Gb = a), Fl(this), this.w(), this.g('angle', b, a)));
},
},
desiredSize: {
get: function() {
return this.$c;
},
set: function(a) {
var b = a.width,
c = a.height,
d = this.$c,
e = d.width,
f = d.height;
((e === b || (isNaN(e) && isNaN(b))) &&
(f === c || (isNaN(f) && isNaN(c)))) ||
((this.$c = a = a.J()),
this.w(),
this instanceof Cf && this.mc(),
this.g('desiredSize', d, a),
el(this) &&
((a = this.part),
null !== a && (fl(this, a, 'width'), fl(this, a, 'height'))));
},
},
width: {
get: function() {
return this.$c.width;
},
set: function(a) {
var b = this.$c.width;
b === a ||
(isNaN(b) && isNaN(a)) ||
((b = this.$c),
(this.$c = a = new K(a, this.$c.height).freeze()),
this.w(),
this instanceof Cf && this.mc(),
this.g('desiredSize', b, a),
el(this) && ((a = this.part), null !== a && fl(this, a, 'width')));
},
},
height: {
get: function() {
return this.$c.height;
},
set: function(a) {
var b = this.$c.height;
b === a ||
(isNaN(b) && isNaN(a)) ||
((b = this.$c),
(this.$c = a = new K(this.$c.width, a).freeze()),
this.w(),
this instanceof Cf && this.mc(),
this.g('desiredSize', b, a),
el(this) && ((a = this.part), null !== a && fl(this, a, 'height')));
},
},
minSize: {
get: function() {
return null !== this.A ? this.A.u : Db;
},
set: function(a) {
var b = this.minSize;
b.C(a) ||
((a = a.copy()),
isNaN(a.width) && (a.width = 0),
isNaN(a.height) && (a.height = 0),
a.freeze(),
bl(this),
(this.A.u = a),
this.w(),
this.g('minSize', b, a));
},
},
maxSize: {
get: function() {
return null !== this.A ? this.A.m : Lb;
},
set: function(a) {
var b = this.maxSize;
b.C(a) ||
((a = a.copy()),
isNaN(a.width) && (a.width = Infinity),
isNaN(a.height) && (a.height = Infinity),
a.freeze(),
bl(this),
(this.A.m = a),
this.w(),
this.g('maxSize', b, a));
},
},
measuredBounds: {
get: function() {
return this.qc;
},
},
naturalBounds: {
get: function() {
return this.bc;
},
},
margin: {
get: function() {
return this.Ag;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.Ag;
b.C(a) || ((this.Ag = a = a.J()), this.w(), this.g('margin', b, a));
},
},
transform: {
get: function() {
(0 !== (this.o & 2048)) === !0 && pl(this);
return this.Bb;
},
},
ge: {
get: function() {
(0 !== (this.o & 4096)) === !0 && pl(this);
return this.lh;
},
},
animationTriggers: {
get: function() {
return null !== this.A ? this.A.cb : null;
},
set: function(a) {
this.animationTriggers !== a && (bl(this), (this.A.cb = a));
},
},
reshapingBehavior: {
get: function() {
return null !== this.A ? this.A.ui : lg;
},
set: function(a) {
this.reshapingBehavior !== a && (bl(this), (this.A.ui = a));
},
},
alignment: {
get: function() {
return this.Fb;
},
set: function(a) {
var b = this.Fb;
b.C(a) ||
(a.Fc() &&
!a.Sb() &&
C(
'GraphObject.alignment for ' +
this +
' must be a real Spot or Spot.Default, not: ' +
a,
),
(this.Fb = a = a.J()),
Al(this),
this.g('alignment', b, a));
},
},
column: {
get: function() {
return this.rg;
},
set: function(a) {
a = Math.round(a);
var b = this.rg;
b !== a &&
(0 > a && wa(a, '>= 0', Y, 'column'),
(this.rg = a),
this.w(),
this.g('column', b, a));
},
},
columnSpan: {
get: function() {
return null !== this.A ? this.A.Db : 1;
},
set: function(a) {
a = Math.round(a);
var b = this.columnSpan;
b !== a &&
(1 > a && wa(a, '>= 1', Y, 'columnSpan'),
bl(this),
(this.A.Db = a),
this.w(),
this.g('columnSpan', b, a));
},
},
row: {
get: function() {
return this.Ln;
},
set: function(a) {
a = Math.round(a);
var b = this.Ln;
b !== a &&
(0 > a && wa(a, '>= 0', Y, 'row'),
(this.Ln = a),
this.w(),
this.g('row', b, a));
},
},
rowSpan: {
get: function() {
return null !== this.A ? this.A.vi : 1;
},
set: function(a) {
a = Math.round(a);
var b = this.rowSpan;
b !== a &&
(1 > a && wa(a, '>= 1', Y, 'rowSpan'),
bl(this),
(this.A.vi = a),
this.w(),
this.g('rowSpan', b, a));
},
},
spanAllocation: {
get: function() {
return null !== this.A ? this.A.xi : null;
},
set: function(a) {
var b = this.spanAllocation;
b !== a &&
(bl(this), (this.A.xi = a), this.w(), this.g('spanAllocation', b, a));
},
},
alignmentFocus: {
get: function() {
return this.fk;
},
set: function(a) {
var b = this.fk;
b.C(a) ||
((this.fk = a = a.J()), this.w(), this.g('alignmentFocus', b, a));
},
},
portId: {
get: function() {
return this.Gn;
},
set: function(a) {
var b = this.Gn;
if (b !== a) {
var c = this.part;
null === c ||
c instanceof V ||
C('Cannot set portID on a Link: ' + a);
null !== b && null !== c && Ql(c, this);
this.Gn = a;
null !== a && null !== c && ((c.He = !0), Rl(c, this));
this.g('portId', b, a);
}
},
},
toSpot: {
get: function() {
return null !== this.aa ? this.aa.tj : sc;
},
set: function(a) {
var b = this.toSpot;
b.C(a) ||
((a = a.J()),
this.Rc(),
(this.aa.tj = a),
this.g('toSpot', b, a),
El(this));
},
},
toEndSegmentLength: {
get: function() {
return null !== this.aa ? this.aa.rj : 10;
},
set: function(a) {
var b = this.toEndSegmentLength;
b !== a &&
(0 > a && wa(a, '>= 0', Y, 'toEndSegmentLength'),
this.Rc(),
(this.aa.rj = a),
this.g('toEndSegmentLength', b, a),
El(this));
},
},
toShortLength: {
get: function() {
return null !== this.aa ? this.aa.sj : 0;
},
set: function(a) {
var b = this.toShortLength;
b !== a &&
(this.Rc(),
(this.aa.sj = a),
this.g('toShortLength', b, a),
El(this));
},
},
toLinkable: {
get: function() {
return null !== this.aa ? this.aa.sr : null;
},
set: function(a) {
var b = this.toLinkable;
b !== a && (this.Rc(), (this.aa.sr = a), this.g('toLinkable', b, a));
},
},
toMaxLinks: {
get: function() {
return null !== this.aa ? this.aa.tr : Infinity;
},
set: function(a) {
var b = this.toMaxLinks;
b !== a &&
(0 > a && wa(a, '>= 0', Y, 'toMaxLinks'),
this.Rc(),
(this.aa.tr = a),
this.g('toMaxLinks', b, a));
},
},
fromSpot: {
get: function() {
return null !== this.aa ? this.aa.Qi : sc;
},
set: function(a) {
var b = this.fromSpot;
b.C(a) ||
((a = a.J()),
this.Rc(),
(this.aa.Qi = a),
this.g('fromSpot', b, a),
El(this));
},
},
fromEndSegmentLength: {
get: function() {
return null !== this.aa ? this.aa.Oi : 10;
},
set: function(a) {
var b = this.fromEndSegmentLength;
b !== a &&
(0 > a && wa(a, '>= 0', Y, 'fromEndSegmentLength'),
this.Rc(),
(this.aa.Oi = a),
this.g('fromEndSegmentLength', b, a),
El(this));
},
},
fromShortLength: {
get: function() {
return null !== this.aa ? this.aa.Pi : 0;
},
set: function(a) {
var b = this.fromShortLength;
b !== a &&
(this.Rc(),
(this.aa.Pi = a),
this.g('fromShortLength', b, a),
El(this));
},
},
fromLinkable: {
get: function() {
return null !== this.aa ? this.aa.Kp : null;
},
set: function(a) {
var b = this.fromLinkable;
b !== a && (this.Rc(), (this.aa.Kp = a), this.g('fromLinkable', b, a));
},
},
fromMaxLinks: {
get: function() {
return null !== this.aa ? this.aa.Lp : Infinity;
},
set: function(a) {
var b = this.fromMaxLinks;
b !== a &&
(0 > a && wa(a, '>= 0', Y, 'fromMaxLinks'),
this.Rc(),
(this.aa.Lp = a),
this.g('fromMaxLinks', b, a));
},
},
cursor: {
get: function() {
return null !== this.A ? this.A.j : '';
},
set: function(a) {
var b = this.cursor;
b !== a && (bl(this), (this.A.j = a), this.g('cursor', b, a));
},
},
click: {
get: function() {
return null !== this.A ? this.A.oh : null;
},
set: function(a) {
var b = this.click;
b !== a && (bl(this), (this.A.oh = a), this.g('click', b, a));
},
},
doubleClick: {
get: function() {
return null !== this.A ? this.A.uh : null;
},
set: function(a) {
var b = this.doubleClick;
b !== a && (bl(this), (this.A.uh = a), this.g('doubleClick', b, a));
},
},
contextClick: {
get: function() {
return null !== this.A ? this.A.qh : null;
},
set: function(a) {
var b = this.contextClick;
b !== a && (bl(this), (this.A.qh = a), this.g('contextClick', b, a));
},
},
mouseEnter: {
get: function() {
return null !== this.A ? this.A.Fh : null;
},
set: function(a) {
var b = this.mouseEnter;
b !== a && (bl(this), (this.A.Fh = a), this.g('mouseEnter', b, a));
},
},
mouseLeave: {
get: function() {
return null !== this.A ? this.A.Ih : null;
},
set: function(a) {
var b = this.mouseLeave;
b !== a && (bl(this), (this.A.Ih = a), this.g('mouseLeave', b, a));
},
},
mouseOver: {
get: function() {
return null !== this.A ? this.A.Jh : null;
},
set: function(a) {
var b = this.mouseOver;
b !== a && (bl(this), (this.A.Jh = a), this.g('mouseOver', b, a));
},
},
mouseHover: {
get: function() {
return null !== this.A ? this.A.Hh : null;
},
set: function(a) {
var b = this.mouseHover;
b !== a && (bl(this), (this.A.Hh = a), this.g('mouseHover', b, a));
},
},
mouseHold: {
get: function() {
return null !== this.A ? this.A.Gh : null;
},
set: function(a) {
var b = this.mouseHold;
b !== a && (bl(this), (this.A.Gh = a), this.g('mouseHold', b, a));
},
},
mouseDragEnter: {
get: function() {
return null !== this.A ? this.A.Qd : null;
},
set: function(a) {
var b = this.mouseDragEnter;
b !== a && (bl(this), (this.A.Qd = a), this.g('mouseDragEnter', b, a));
},
},
mouseDragLeave: {
get: function() {
return null !== this.A ? this.A.Gf : null;
},
set: function(a) {
var b = this.mouseDragLeave;
b !== a && (bl(this), (this.A.Gf = a), this.g('mouseDragLeave', b, a));
},
},
mouseDrop: {
get: function() {
return null !== this.A ? this.A.Eh : null;
},
set: function(a) {
var b = this.mouseDrop;
b !== a && (bl(this), (this.A.Eh = a), this.g('mouseDrop', b, a));
},
},
actionDown: {
get: function() {
return null !== this.A ? this.A.W : null;
},
set: function(a) {
var b = this.actionDown;
b !== a && (bl(this), (this.A.W = a), this.g('actionDown', b, a));
},
},
actionMove: {
get: function() {
return null !== this.A ? this.A.ga : null;
},
set: function(a) {
var b = this.actionMove;
b !== a && (bl(this), (this.A.ga = a), this.g('actionMove', b, a));
},
},
actionUp: {
get: function() {
return null !== this.A ? this.A.Ga : null;
},
set: function(a) {
var b = this.actionUp;
b !== a && (bl(this), (this.A.Ga = a), this.g('actionUp', b, a));
},
},
actionCancel: {
get: function() {
return null !== this.A ? this.A.F : null;
},
set: function(a) {
var b = this.actionCancel;
b !== a && (bl(this), (this.A.F = a), this.g('actionCancel', b, a));
},
},
toolTip: {
get: function() {
return null !== this.A ? this.A.Th : null;
},
set: function(a) {
var b = this.toolTip;
b !== a && (bl(this), (this.A.Th = a), this.g('toolTip', b, a));
},
},
contextMenu: {
get: function() {
return null !== this.A ? this.A.rh : null;
},
set: function(a) {
var b = this.contextMenu;
b !== a && (bl(this), (this.A.rh = a), this.g('contextMenu', b, a));
},
},
});
Y.prototype.trigger = Y.prototype.mv;
Y.prototype.findBindingPanel = Y.prototype.Yg;
Y.prototype.findTemplateBinder = Y.prototype.Yy;
Y.prototype.setProperties = Y.prototype.Vl;
Y.prototype.apply = Y.prototype.apply;
Y.prototype.attach = Y.prototype.ku;
Y.prototype.set = Y.prototype.set;
Y.prototype.isEnabledObject = Y.prototype.yf;
Y.prototype.isVisibleObject = Y.prototype.zf;
Y.prototype.isContainedBy = Y.prototype.jg;
Y.prototype.getNearestIntersectionPoint = Y.prototype.Or;
Y.prototype.getLocalPoint = Y.prototype.Nr;
Y.prototype.getDocumentScale = Y.prototype.uf;
Y.prototype.getDocumentAngle = Y.prototype.fi;
Y.prototype.getDocumentBounds = Y.prototype.gi;
Y.prototype.getDocumentPoint = Y.prototype.ia;
Y.prototype.intersectsRect = Y.prototype.Sc;
Y.prototype.containedInRect = Y.prototype.Wg;
Y.prototype.containsRect = Y.prototype.Ee;
Y.prototype.containsPoint = Y.prototype.ba;
Y.prototype.raiseChanged = Y.prototype.g;
Y.prototype.raiseChangedEvent = Y.prototype.bb;
Y.prototype.addCopyProperty = Y.prototype.zw;
var Jl = null;
Y.className = 'GraphObject';
Jl = new pb();
Ml('Button', function() {
function a(a, b) {
return (
null !==
a.diagram.ec(
a.documentPoint,
function(a) {
for (; null !== a.panel && !a.isActionable; ) a = a.panel;
return a;
},
function(a) {
return a === b;
},
)
);
}
var b = Il(
W,
W.Auto,
{
isActionable: !0,
enabledChanged: function(a, b) {
if (a instanceof W) {
var c = a.fb('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',
},
Il(Cf, {
name: 'ButtonBorder',
figure: 'RoundedRectangle',
spot1: new N(0, 0, 2.76142374915397, 2.761423749153969),
spot2: new N(1, 1, -2.76142374915397, -2.761423749153969),
parameter1: 2,
parameter2: 2,
fill: '#F5F5F5',
stroke: '#BDBDBD',
}),
);
b.mouseEnter = function(a, b) {
if (
b.yf() &&
b instanceof W &&
((a = b.fb('ButtonBorder')), a instanceof Cf)
) {
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.yf() &&
b instanceof W &&
((a = b.fb('ButtonBorder')),
a instanceof Cf &&
((a.fill = b._buttonFillNormal), (a.stroke = b._buttonStrokeNormal)));
};
b.actionDown = function(a, b) {
if (
b.yf() &&
b instanceof W &&
null !== b._buttonFillPressed &&
0 === a.button
) {
var c = b.fb('ButtonBorder');
if (c instanceof Cf) {
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.yf() &&
d instanceof W &&
null !== d._buttonFillPressed &&
0 === b.button
) {
var c = d.fb('ButtonBorder');
if (c instanceof Cf) {
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.yf() && d instanceof W && null !== d._buttonFillPressed) {
var c = d.fb('ButtonBorder');
if (c instanceof Cf) {
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.yf() && d instanceof W && null !== d._buttonFillPressed) {
var c = b.diagram;
if (
0 === c.firstInput.button &&
(c.currentTool.standardMouseOver(),
a(b, d) && ((b = d.fb('ButtonBorder')), b instanceof Cf))
) {
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;
});
Ml('TreeExpanderButton', function() {
var a = Il(
'Button',
{
_treeExpandedFigure: 'MinusLine',
_treeCollapsedFigure: 'PlusLine',
},
Il(
Cf,
{
name: 'ButtonIcon',
figure: 'MinusLine',
stroke: '#424242',
strokeWidth: 2,
desiredSize: Jb,
},
new wi('figure', 'isTreeExpanded', function(a, c) {
c = c.panel;
return a ? c._treeExpandedFigure : c._treeCollapsedFigure;
}).Fo(),
),
{
visible: !1,
},
new wi('visible', 'isTreeLeaf', function(a) {
return !a;
}).Fo(),
);
a.click = function(a, c) {
c = c.part;
c instanceof ue && (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;
});
Ml('SubGraphExpanderButton', function() {
var a = Il(
'Button',
{
_subGraphExpandedFigure: 'MinusLine',
_subGraphCollapsedFigure: 'PlusLine',
},
Il(
Cf,
{
name: 'ButtonIcon',
figure: 'MinusLine',
stroke: '#424242',
strokeWidth: 2,
desiredSize: Jb,
},
new wi('figure', 'isSubGraphExpanded', function(a, c) {
c = c.panel;
return a ? c._subGraphExpandedFigure : c._subGraphCollapsedFigure;
}).Fo(),
),
);
a.click = function(a, c) {
c = c.part;
c instanceof ue && (c = c.adornedPart);
if (c instanceof qf) {
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;
});
Ml('ToolTip', function() {
return Il(
ue,
W.Auto,
{
isShadowed: !0,
shadowColor: 'rgba(0, 0, 0, .4)',
shadowOffset: new I(0, 3),
shadowBlur: 5,
},
Il(Cf, {
name: 'Border',
figure: 'RoundedRectangle',
parameter1: 1,
parameter2: 1,
fill: '#F5F5F5',
stroke: '#F0F0F0',
spot1: new N(0, 0, 4, 6),
spot2: new N(1, 1, -4, -4),
}),
);
});
Ml('ContextMenu', function() {
return Il(
ue,
W.Vertical,
{
background: '#F5F5F5',
isShadowed: !0,
shadowColor: 'rgba(0, 0, 0, .4)',
shadowOffset: new I(0, 3),
shadowBlur: 5,
},
new wi('background', '', function(a) {
return null !== a.adornedPart && null !== a.placeholder
? null
: '#F5F5F5';
}),
);
});
Ml('ContextMenuButton', function() {
var a = Il('Button');
a.stretch = Vk;
var b = a.fb('ButtonBorder');
b instanceof Cf &&
((b.figure = 'Rectangle'),
(b.strokeWidth = 0),
(b.spot1 = new N(0, 0, 2, 3)),
(b.spot2 = new N(1, 1, -2, -2)));
return a;
});
Ml('PanelExpanderButton', function(a) {
var b = Nl(a, 'COLLAPSIBLE'),
c = Il(
'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,
},
Il(
Cf,
{
name: 'ButtonIcon',
strokeWidth: 2,
},
new wi('geometryString', 'visible', function(a) {
return a ? c._buttonExpandedFigure : c._buttonCollapsedFigure;
}).Fo(b),
),
);
a = c.fb('ButtonBorder');
a instanceof Cf && ((a.stroke = null), (a.fill = 'rgba(0, 0, 0, 0)'));
c.click = function(a, c) {
var d = c.diagram;
if (null !== d && !d.isReadOnly) {
var e = c.Yg();
null === e && (e = c.part);
null !== e &&
((c = e.fb(b)),
null !== c &&
((a.handled = !0),
d.Da('Collapse/Expand Panel'),
(c.visible = !c.visible),
d.eb('Collapse/Expand Panel')));
}
};
return c;
});
Ml('CheckBoxButton', function(a) {
var b = Nl(a);
a = Il(
'Button',
{
desiredSize: new K(14, 14),
},
Il(
Cf,
{
name: 'ButtonIcon',
geometryString: 'M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2',
strokeWidth: 2,
stretch: td,
geometryStretch: ng,
visible: !1,
},
'' !== b ? new wi('visible', b).px() : [],
),
);
a.click = function(a, d) {
if (d instanceof W) {
var c = a.diagram;
if (!(null === c || c.isReadOnly || ('' !== b && c.model.isReadOnly))) {
a.handled = !0;
var f = d.fb('ButtonIcon');
c.Da('checkbox');
f.visible = !f.visible;
'function' === typeof d._doClick && d._doClick(a, d);
c.eb('checkbox');
}
}
};
return a;
});
Ml('CheckBox', function(a) {
a = Nl(a);
a = Il('CheckBoxButton', a, {
name: 'Button',
isActionable: !1,
margin: new ec(0, 1, 0, 0),
});
var b = Il(W, '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 = lg = new D(Y, 'None', 0);
Y.Default = Xk = new D(Y, 'Default', 0);
Y.Vertical = Wk = new D(Y, 'Vertical', 4);
Y.Horizontal = Vk = new D(Y, 'Horizontal', 5);
Y.Fill = td = new D(Y, 'Fill', 3);
Y.Uniform = ng = new D(Y, 'Uniform', 1);
Y.UniformToFill = Yk = new D(Y, 'UniformToFill', 2);
Y.FlipVertical = Zk = new D(Y, 'FlipVertical', 1);
Y.FlipHorizontal = $k = new D(Y, 'FlipHorizontal', 2);
Y.FlipBoth = al = new D(Y, 'FlipBoth', 3);
Y.make = Il;
Y.getBuilders = function() {
var a = new pb(),
b;
for (b in Jl)
if (b !== b.toLowerCase()) {
var c = Jl.I(b);
'function' === typeof c && a.add(b, c);
}
a.freeze();
return a;
};
Y.defineBuilder = Ml;
Y.build = function(a, b) {
var c = Jl.I(a);
if ('function' === typeof c && ((c = c(null)), c instanceof Y))
return b && c.set(b), c;
C(
'GraphObject.build invoked object builder "' +
a +
'", but it did not return an Object',
);
};
Y.takeBuilderArgument = Nl;
function cl() {
this.ic = !1;
this.va = '';
this.bp = -1;
this.hb = this.Wo = this.Ff = null;
this.j = '';
this.cb = this.xi = this.Hc = this.rh = this.Th = this.F = this.Ga = this.ga = this.W = this.Eh = this.Gf = this.Qd = this.Gh = this.Hh = this.Jh = this.Ih = this.Fh = this.qh = this.uh = this.oh = null;
this.u = Db;
this.m = Lb;
this.$f = Xk;
this.Db = this.vi = 1;
this.ui = lg;
this.le = this.wi = this.nb = null;
this.Ic = 'category';
}
cl.prototype.copy = function() {
var a = new cl();
a.va = this.va;
a.bp = this.bp;
a.Ff = this.Ff;
a.hb = this.hb;
a.j = this.j;
a.oh = this.oh;
a.uh = this.uh;
a.qh = this.qh;
a.Fh = this.Fh;
a.Ih = this.Ih;
a.Jh = this.Jh;
a.Hh = this.Hh;
a.Gh = this.Gh;
a.Qd = this.Qd;
a.Gf = this.Gf;
a.Eh = this.Eh;
a.W = this.W;
a.ga = this.ga;
a.Ga = this.Ga;
a.F = this.F;
a.Th = this.Th;
a.rh = this.rh;
a.Hc = this.Hc;
a.xi = this.xi;
a.cb = this.cb;
a.u = this.u.J();
a.m = this.m.J();
a.$f = this.$f;
a.vi = this.vi;
a.Db = this.Db;
a.ui = this.ui;
a.nb = this.nb;
a.wi = this.wi;
a.le = this.le;
a.Ic = this.Ic;
return a;
};
function Ol() {
this.u = -Infinity;
this.m = 0;
this.F = qb;
this.Oq = $f;
this.j = this.W = 'None';
}
Ol.prototype.copy = function() {
var a = new Ol();
a.u = this.u;
a.m = this.m;
a.F = this.F.J();
a.Oq = this.Oq;
a.W = this.W;
a.j = this.j;
return a;
};
Ol.className = 'LinkElementSettings';
function dl() {
this.tj = this.Qi = Wc;
this.sj = this.Pi = this.rj = this.Oi = NaN;
this.sr = this.Kp = null;
this.tr = this.Lp = Infinity;
}
dl.prototype.copy = function() {
var a = new dl();
a.Qi = this.Qi.J();
a.tj = this.tj.J();
a.Oi = this.Oi;
a.rj = this.rj;
a.Pi = this.Pi;
a.sj = this.sj;
a.Kp = this.Kp;
a.sr = this.sr;
a.Lp = this.Lp;
a.tr = this.tr;
return a;
};
dl.className = 'LinkSettings';
function Sl() {
this.Ta = [1, 0, 0, 1, 0, 0];
}
Sl.prototype.copy = function() {
var a = new Sl();
a.Ta[0] = this.Ta[0];
a.Ta[1] = this.Ta[1];
a.Ta[2] = this.Ta[2];
a.Ta[3] = this.Ta[3];
a.Ta[4] = this.Ta[4];
a.Ta[5] = this.Ta[5];
return a;
};
Sl.prototype.translate = function(a, b) {
this.Ta[4] += this.Ta[0] * a + this.Ta[2] * b;
this.Ta[5] += this.Ta[1] * a + this.Ta[3] * b;
};
Sl.prototype.scale = function(a, b) {
this.Ta[0] *= a;
this.Ta[1] *= a;
this.Ta[2] *= b;
this.Ta[3] *= b;
};
Sl.className = 'STransform';
function Tl(a) {
this.type = a;
this.r2 = this.y2 = this.x2 = this.r1 = this.y1 = this.x1 = 0;
this.Jw = [];
this.pattern = null;
}
Tl.prototype.addColorStop = function(a, b) {
this.Jw.push({
offset: a,
color: b,
});
};
Tl.className = 'SGradient';
function xj(a, b) {
this.ownerDocument = a = void 0 === b ? x.document : b;
this.Jz = 'http://www.w3.org/2000/svg';
void 0 !== a &&
((this.Sa = this.Vb('svg', {
width: '1px',
height: '1px',
viewBox: '0 0 1 1',
})),
this.Sa.setAttributeNS(
'http://www.w3.org/2000/xmlns/',
'xmlns',
'http://www.w3.org/2000/svg',
),
this.Sa.setAttributeNS(
'http://www.w3.org/2000/xmlns/',
'xmlns:xlink',
'http://www.w3.org/1999/xlink',
));
this.po = null;
this.context = new Ul(this);
}
xj.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.Sa.setAttributeNS(null, 'width', c + 'px'),
this.Sa.setAttributeNS(null, 'height', d + 'px'),
this.Sa.setAttributeNS(null, 'viewBox', '0 0 ' + c + ' ' + d),
this.context.bw.firstElementChild.setAttributeNS(
null,
'width',
c + 'px',
),
this.context.bw.firstElementChild.setAttributeNS(
null,
'height',
d + 'px',
),
!0)
: !1;
};
xj.prototype.Vb = function(a, b, c) {
a = this.ownerDocument.createElementNS(this.Jz, 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;
};
xj.prototype.getBoundingClientRect = function() {
return this.Sa.getBoundingClientRect();
};
xj.prototype.focus = function() {
this.Sa.focus();
};
xj.prototype.Pw = function() {
this.ownerDocument = null;
};
ma.Object.defineProperties(xj.prototype, {
width: {
get: function() {
return this.Sa.width.baseVal.value;
},
set: function(a) {
this.Sa.width = a;
},
},
height: {
get: function() {
return this.Sa.height.baseVal.value;
},
set: function(a) {
this.Sa.height = a;
},
},
style: {
get: function() {
return this.Sa.style;
},
},
});
xj.className = 'SVGSurface';
function Ul(a) {
this.qs = a;
this.svg = a.Sa;
this.stack = [];
this.md = [];
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.Lg = this.Yq = this.Xq = 0;
this.Xr = null;
this.path = [];
this.et = !1;
this.Og = null;
this.pj = 0;
this.Fe = new Sl();
Vl(this, 1, 0, 0, 1, 0, 0);
var b = kb++,
c = this.Vb('clipPath', {
id: 'mainClip' + b,
});
c.appendChild(
this.Vb('rect', {
x: 0,
y: 0,
width: a.width,
height: a.height,
}),
);
this.bw = c;
this.qs.Sa.appendChild(c);
this.md[0].setAttributeNS(null, 'clip-path', 'url(#mainClip' + b + ')');
this.Lz = {};
}
t = Ul.prototype;
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.Fe);
};
t.closePath = function() {
this.path.push(['z']);
};
t.createLinearGradient = function(a, b, c, d) {
var e = new Tl('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.Lz;
if (c[b]) return 'url(#' + c[b] + ')';
var d = 'PATTERN' + kb++,
e = {
x: 0,
y: 0,
width: a.width,
height: a.height,
href: b,
};
a = this.Vb('pattern', {
width: a.width,
height: a.height,
id: d,
patternUnits: 'userSpaceOnUse',
});
a.appendChild(this.Vb(Ak, e));
this.svg.appendChild(a);
c[b] = d;
return 'url(#' + d + ')';
};
t.createRadialGradient = function(a, b, c, d, e, f) {
var g = new Tl('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;
a = {
x: 0,
y: 0,
width: m || d,
height: n || e,
href: l,
};
J.ca(d, h) && J.ca(e, k)
? -1 === l.toLowerCase().indexOf('.svg') &&
-1 === l.toLowerCase().indexOf('data:image/svg') &&
(a.preserveAspectRatio = 'xMidYMid slice')
: (a.preserveAspectRatio = 'none');
l = '';
h /= d;
k /= e;
if (0 !== f || 0 !== g) l += ' translate(' + f + ', ' + g + ')';
if (1 !== h || 1 !== k) l += ' scale(' + h + ', ' + k + ')';
if (0 !== b || 0 !== c) l += ' translate(' + -b + ', ' + -c + ')';
if (0 !== b || 0 !== c || d !== m || e !== n)
(f = 'CLIP' + kb++),
(g = this.Vb('clipPath', {
id: f,
})),
g.appendChild(
this.Vb('rect', {
x: b,
y: c,
width: d,
height: e,
}),
),
this.svg.appendChild(g),
(a['clip-path'] = 'url(#' + f + ')');
Wl(this, Ak, a, this.Fe, l);
this.addElement(Ak, a);
};
t.fill = function() {
this.addPath('fill', this.path, this.Fe);
};
t.sf = 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],
};
Wl(this, 'fill', a, this.Fe);
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,
};
Wl(this, 'fill', b, this.Fe);
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.Fe = 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.Fe.copy());
};
t.setTransform = function(a, b, c, d, e, f) {
(1 === a && 0 === b && 0 === c && 1 === d && 0 === e && 0 === f) ||
Vl(this, a, b, c, d, e, f);
};
t.scale = function(a, b) {
this.Fe.scale(a, b);
};
t.translate = function(a, b) {
this.Fe.translate(a, b);
};
t.transform = function() {};
t.Pc = function() {};
t.stroke = function() {
this.addPath('stroke', this.path, this.Fe);
};
t.si = function() {
this.clipInsteadOfFill || this.stroke();
};
t.Vb = function(a, b, c) {
return this.qs.Vb(a, b, c);
};
t.addElement = function(a, b, c) {
a = this.Vb(a, b, c);
0 < this.md.length
? this.md[this.md.length - 1].appendChild(a)
: this.svg.appendChild(a);
return (this.Xr = a);
};
function Wl(a, b, c, d, e) {
1 !== a.globalAlpha && (c.opacity = a.globalAlpha);
'fill' === b
? (a.fillStyle instanceof Tl
? (c.fill = Xl(a, a.fillStyle))
: /^rgba\(/.test(a.fillStyle)
? ((a = /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(
a.fillStyle,
)),
(c.fill = 'rgb(' + a[1] + ',' + a[2] + ',' + a[3] + ')'),
(c['fill-opacity'] = a[4]))
: (c.fill = a.fillStyle),
(c.stroke = 'none'))
: 'stroke' === b &&
((c.fill = 'none'),
a.strokeStyle instanceof Tl
? (c.stroke = Xl(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));
d = d.Ta;
d =
'matrix(' +
d[0] +
', ' +
d[1] +
', ' +
d[2] +
', ' +
d[3] +
', ' +
d[4] +
', ' +
d[5] +
')';
void 0 !== e && (d += e);
c.transform = d;
}
function Xl(a, b) {
var c = 'GRAD' + kb++;
if ('linear' === b.type)
var d = a.Vb('linearGradient', {
x1: b.x1,
x2: b.x2,
y1: b.y1,
y2: b.y2,
id: c,
gradientUnits: 'userSpaceOnUse',
});
else if ('radial' === b.type)
d = a.Vb('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.Jw;
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.Vb('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.et &&
((b['stroke-dasharray'] = this.Og.toString()),
(b['stroke-dashoffset'] = this.pj));
Wl(this, a, b, c);
'clipPath' === a
? ((a = 'CLIP' + kb++),
(c = this.Vb('clipPath', {
id: a,
})),
c.appendChild(this.Vb('path', b)),
this.svg.appendChild(c),
0 < this.md.length &&
this.md[this.md.length - 1].setAttributeNS(
null,
'clip-path',
'url(#' + a + ')',
))
: this.addElement('path', b);
};
function Vl(a, b, c, d, e, f, g) {
var h = new Sl();
h.Ta = [b, c, d, e, f, g];
b = {};
Wl(a, 'g', b, h);
h = a.addElement('g', b);
a.md.push(h);
}
t.Xl = function(a) {
if (
0 !== this.shadowOffsetX ||
0 !== this.shadowOffsetY ||
0 !== this.shadowBlur
) {
var b = 'SHADOW' + kb++,
c = this.addElement(
'filter',
{
id: b,
x: '-100%',
y: '-100%',
width: '300%',
height: '300%',
},
null,
),
d = a.computePixelRatio();
a = this.Vb('feGaussianBlur', {
in: 'SourceAlpha',
result: 'blur',
stdDeviation: this.shadowBlur / 2 / d,
});
var e = this.Vb('feFlood', {
in: 'blur',
result: 'flood',
'flood-color': this.shadowColor,
}),
f = this.Vb('feComposite', {
in: 'flood',
in2: 'blur',
operator: 'in',
result: 'comp',
});
d = this.Vb('feOffset', {
in: 'comp',
result: 'offsetBlur',
dx: this.shadowOffsetX / d,
dy: this.shadowOffsetY / d,
});
var g = this.Vb('feMerge', {});
g.appendChild(
this.Vb('feMergeNode', {
in: 'offsetBlur',
}),
);
g.appendChild(
this.Vb('feMergeNode', {
in: 'SourceGraphic',
}),
);
c.appendChild(a);
c.appendChild(e);
c.appendChild(f);
c.appendChild(d);
c.appendChild(g);
0 < this.md.length &&
this.md[this.md.length - 1].setAttributeNS(
null,
'filter',
'url(#' + b + ')',
);
}
};
t.iv = function(a, b, c) {
this.Xq = a;
this.Yq = b;
this.Lg = c;
};
function rl(a) {
a.shadowOffsetX = 0;
a.shadowOffsetY = 0;
a.shadowBlur = 0;
}
function ql(a) {
a.shadowOffsetX = a.Xq;
a.shadowOffsetY = a.Yq;
a.shadowBlur = a.Lg;
}
t.Gr = function(a, b) {
this.et = !0;
this.Og = a;
this.pj = b;
};
t.Er = function() {
this.et = !1;
};
t.Oc = function() {};
t.Ex = function() {};
Ul.prototype.rotate = function() {};
Ul.prototype.getImageData = function() {
return null;
};
Ul.prototype.measureText = function() {
return null;
};
Ul.className = 'SVGContext';
Q.prototype.bs = function(a) {
var b = new xj(this, x.document);
void 0 === a && (a = new Wa());
var c = this;
return yk(
this,
function(a, e) {
a = zk(c, a, 'SVG', b);
a = null !== a ? a.svg : null;
return 'function' === typeof e ? (e(a), null) : a;
},
a,
);
};
Q.prototype.makeSvg = Q.prototype.bs;
Q.prototype.Nu = function(a) {
return this.bs(a);
};
Q.prototype.makeSVG = Q.prototype.Nu;
Y.prototype.Qw = function(a, b) {
if (!(a instanceof Ul)) return !1;
var c = null,
d = a.Xr,
e = this.transform,
f = this.panel;
(0 !== (this.o & 4096)) === !0 && pl(this);
var g = this.Eb,
h = 0 !== (this.o & 256);
a.clipInsteadOfFill && (h = !1);
var k = !1;
this instanceof Qg && (a.font = this.font);
if (h) {
k = f.ke() ? f.naturalBounds : f.actualBounds;
if (null !== this.ib) {
var l = this.ib;
var m = l.x;
var n = l.y;
var p = l.width;
l = l.height;
} else
(m = Math.max(g.x, k.x)),
(n = Math.max(g.y, k.y)),
(p = Math.min(g.right, k.right) - m),
(l = Math.min(g.bottom, k.bottom) - n);
if (
m > g.width + g.x ||
g.x > k.width + k.x ||
n > g.height + g.y ||
g.y > k.height + k.y
)
return !0;
k = !0;
Vl(a, 1, 0, 0, 1, 0, 0);
a.save();
a.beginPath();
a.rect(m, n, p, l);
a.clip();
}
if (this.li() && !this.isVisible()) return !0;
a.Fe.Ta = [1, 0, 0, 1, 0, 0];
((this instanceof Qg && 1 < this.lineCount) ||
(this instanceof Cf && 1 < this.geometry.figures.length)) &&
Vl(a, 1, 0, 0, 1, 0, 0);
m = !1;
this.li() &&
this.isShadowed &&
b.Ge('drawShadows') &&
((n = this.shadowOffset),
a.iv(n.x * b.scale * b.kc, n.y * b.scale * b.kc, this.shadowBlur),
ql(a),
(a.shadowColor = this.shadowColor));
n = !1;
this.part && b.Ge('drawShadows') && (n = this.part.isShadowed);
a.clipInsteadOfFill && (n = !1);
!0 === this.shadowVisible
? (ql(a), !1 === m && n && (Vl(a, 1, 0, 0, 1, 0, 0), a.Xl(b), (m = !0)))
: !1 === this.shadowVisible && rl(a);
p = this.naturalBounds;
null !== this.areaBackground &&
(gi(this, a, this.areaBackground, !0, !0, p, g),
!1 === m && n && (Vl(a, 1, 0, 0, 1, 0, 0), a.Xl(b), (m = !0)),
this.areaBackground instanceof nl && this.areaBackground.type === ol
? (a.beginPath(),
a.rect(g.x, g.y, g.width, g.height),
a.sf(this.areaBackground))
: a.fillRect(g.x, g.y, g.width, g.height));
l = !1;
this instanceof W
? Vl(a, e.m11, e.m12, e.m21, e.m22, e.dx, e.dy)
: ((a.Fe.Ta = [e.m11, e.m12, e.m21, e.m22, e.dx, e.dy]),
!1 === m && n && (l = !0));
null !== this.background &&
(!1 === m && n && (Vl(a, 1, 0, 0, 1, 0, 0), a.Xl(b), (m = !0)),
sl(this, a, p, g));
n &&
(null !== this.background ||
null !== this.areaBackground ||
(null !== f && 0 !== (f.o & 512)) ||
(null !== f &&
(f.type === W.Auto || f.type === W.Spot) &&
f.vb() !== this))
? (tl(this, !0), null === this.shadowVisible && rl(a), (l = !1))
: tl(this, !1);
l && !1 === m && (Vl(a, 1, 0, 0, 1, 0, 0), a.Xl(b), (m = !0));
this.ai(a, b);
n && (0 !== (this.o & 512)) === !0 && ql(a);
this.li() && n && rl(a);
h && (a.restore(), k && a.md.pop());
this instanceof W && (c = a.md.pop());
!0 === m && a.md.pop();
if (
(this instanceof Qg && 1 < this.lineCount) ||
(this instanceof Cf && 1 < this.geometry.figures.length)
)
c = a.md.pop();
null !== a.qs.po &&
(null === c &&
(d === a.Xr ? (Vl(a, 1, 0, 0, 1, 0, 0), (c = a.md.pop())) : (c = a.Xr)),
a.qs.po(this, c));
this.svg = c;
return !0;
};
function Bk(a, b) {
this.ownerDocument = b = void 0 === b ? x.document : b;
this.po = null;
b = b.createElement('canvas');
b.tabIndex = 0;
this.Sa = b;
this.Sa.innerHTML =
'This text is displayed if your browser does not support the Canvas HTML element.';
this.context = new vl(b);
b.H = a;
}
Bk.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;
};
Bk.prototype.toDataURL = function(a, b) {
return this.Sa.toDataURL(a, b);
};
Bk.prototype.getBoundingClientRect = function() {
return this.Sa.getBoundingClientRect();
};
Bk.prototype.focus = function() {
this.Sa.focus();
};
Bk.prototype.Pw = function() {
this.ownerDocument = this.Sa.H = null;
};
ma.Object.defineProperties(Bk.prototype, {
width: {
get: function() {
return this.Sa.width;
},
set: function(a) {
this.Sa.width = a;
},
},
height: {
get: function() {
return this.Sa.height;
},
set: function(a) {
this.Sa.height = a;
},
},
style: {
get: function() {
return this.Sa.style;
},
},
});
Bk.className = 'CanvasSurface';
function vl(a) {
(a.getContext && a.getContext('2d')) ||
C('Browser does not support HTML Canvas Element');
this.Z = a.getContext('2d');
this.Es = this.Gs = this.Fs = '';
this.pm = !1;
this.Lg = this.Yq = this.Xq = 0;
this.rl = new md();
}
t = vl.prototype;
t.Ex = function(a) {
this.Z.imageSmoothingEnabled = a;
};
t.arc = function(a, b, c, d, e, f) {
this.Z.arc(a, b, c, d, e, f);
};
t.beginPath = function() {
this.Z.beginPath();
};
t.bezierCurveTo = function(a, b, c, d, e, f) {
this.Z.bezierCurveTo(a, b, c, d, e, f);
};
t.clearRect = function(a, b, c, d) {
this.Pc();
this.Z.clearRect(a, b, c, d);
};
t.clip = function() {
this.Z.clip();
};
t.closePath = function() {
this.Z.closePath();
};
t.createLinearGradient = function(a, b, c, d) {
return this.Z.createLinearGradient(a, b, c, d);
};
t.createPattern = function(a, b) {
return this.Z.createPattern(a, b);
};
t.createRadialGradient = function(a, b, c, d, e, f) {
return this.Z.createRadialGradient(a, b, c, d, e, f);
};
t.drawImage = function(a, b, c, d, e, f, g, h, k) {
void 0 === d
? this.Z.drawImage(a, b, c)
: this.Z.drawImage(a, b, c, d, e, f, g, h, k);
};
t.fill = function() {
this.Z.fill();
};
t.fillRect = function(a, b, c, d) {
this.Z.fillRect(a, b, c, d);
};
t.fillText = function(a, b, c) {
this.Z.fillText(a, b, c);
};
t.getImageData = function(a, b, c, d) {
return this.Z.getImageData(a, b, c, d);
};
t.lineTo = function(a, b) {
this.Z.lineTo(a, b);
};
t.measureText = function(a) {
return this.Z.measureText(a);
};
t.moveTo = function(a, b) {
this.Z.moveTo(a, b);
};
t.quadraticCurveTo = function(a, b, c, d) {
this.Z.quadraticCurveTo(a, b, c, d);
};
t.rect = function(a, b, c, d) {
this.Z.rect(a, b, c, d);
};
t.restore = function() {
this.Z.restore();
};
t.save = function() {
this.Pc();
this.Z.save();
};
vl.prototype.rotate = function(a) {
this.rl.rotate(57.2958 * a, 0, 0);
};
t = vl.prototype;
t.setTransform = function(a, b, c, d, e, f) {
this.rl.setTransform(a, b, c, d, e, f);
};
t.scale = function(a, b) {
this.rl.scale(a, b);
};
t.translate = function(a, b) {
this.rl.translate(a, b);
};
t.stroke = function() {
this.Z.stroke();
};
t.transform = function(a, b, c, d, e, f) {
if (1 !== a || 0 !== b || 0 !== c || 1 !== d || 0 !== e || 0 !== f) {
var g = this.rl,
h = g.m11 * a + g.m21 * b;
a = g.m12 * a + g.m22 * b;
b = g.m11 * c + g.m21 * d;
c = g.m12 * c + g.m22 * d;
g.dx = g.m11 * e + g.m21 * f + g.dx;
g.dy = g.m12 * e + g.m22 * f + g.dy;
g.m11 = h;
g.m12 = a;
g.m21 = b;
g.m22 = c;
}
};
t.Pc = function() {
var a = this.rl;
this.Z.setTransform(a.m11, a.m12, a.m21, a.m22, a.dx, a.dy);
};
t.sf = function(a) {
if (a instanceof nl && a.type === ol) {
var b = a.lk;
a = a.Hs;
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.pm ? 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.pm ? this.clip() : this.fill();
};
t.si = function() {
this.pm || this.stroke();
};
t.iv = function(a, b, c) {
this.Xq = a;
this.Yq = b;
this.Lg = c;
};
t.Gr = function(a, b) {
var c = this.Z;
void 0 !== c.setLineDash && (c.setLineDash(a), (c.lineDashOffset = b));
};
t.Er = function() {
var a = this.Z;
void 0 !== a.setLineDash && (a.setLineDash(Yl), (a.lineDashOffset = 0));
};
t.Oc = function(a) {
a && (this.Fs = '');
this.Es = this.Gs = '';
};
ma.Object.defineProperties(vl.prototype, {
fillStyle: {
get: function() {
return this.Z.fillStyle;
},
set: function(a) {
this.Es !== a && (this.Es = this.Z.fillStyle = a);
},
},
font: {
get: function() {
return this.Z.font;
},
set: function(a) {
this.Fs !== a && (this.Fs = this.Z.font = a);
},
},
globalAlpha: {
get: function() {
return this.Z.globalAlpha;
},
set: function(a) {
this.Z.globalAlpha = a;
},
},
lineCap: {
get: function() {
return this.Z.lineCap;
},
set: function(a) {
this.Z.lineCap = a;
},
},
lineDashOffset: {
get: function() {
return this.Z.lineDashOffset;
},
set: function(a) {
this.Z.lineDashOffset = a;
},
},
lineJoin: {
get: function() {
return this.Z.lineJoin;
},
set: function(a) {
this.Z.lineJoin = a;
},
},
lineWidth: {
get: function() {
return this.Z.lineWidth;
},
set: function(a) {
this.Z.lineWidth = a;
},
},
miterLimit: {
get: function() {
return this.Z.miterLimit;
},
set: function(a) {
this.Z.miterLimit = a;
},
},
shadowBlur: {
get: function() {
return this.Z.shadowBlur;
},
set: function(a) {
this.Z.shadowBlur = a;
},
},
shadowColor: {
get: function() {
return this.Z.shadowColor;
},
set: function(a) {
this.Z.shadowColor = a;
},
},
shadowOffsetX: {
get: function() {
return this.Z.shadowOffsetX;
},
set: function(a) {
this.Z.shadowOffsetX = a;
},
},
shadowOffsetY: {
get: function() {
return this.Z.shadowOffsetY;
},
set: function(a) {
this.Z.shadowOffsetY = a;
},
},
strokeStyle: {
get: function() {
return this.Z.strokeStyle;
},
set: function(a) {
this.Gs !== a && (this.Gs = this.Z.strokeStyle = a);
},
},
textAlign: {
get: function() {
return this.Z.textAlign;
},
set: function(a) {
this.Z.textAlign = a;
},
},
imageSmoothingEnabled: {
get: function() {
return this.Z.imageSmoothingEnabled;
},
set: function(a) {
this.Z.imageSmoothingEnabled = a;
},
},
clipInsteadOfFill: {
get: function() {
return this.pm;
},
set: function(a) {
this.pm = a;
},
},
});
var Yl = Object.freeze([]);
vl.className = 'CanvasSurfaceContext';
function Zl() {
this.F = this.m = this.u = this.j = 0;
}
Zl.className = 'ColorNumbers';
function nl(a, b) {
$l || (am(), ($l = !0));
Ra(this);
this._isFrozen = !1;
void 0 === a
? ((this.qa = ul), (this.kk = 'black'))
: 'string' === typeof a
? ((this.qa = ul), (this.kk = a))
: ((this.qa = a), (this.kk = 'black'));
a = this.qa;
a === xl
? ((this.Gd = uc), (this.zk = Bc))
: (this.zk = a === ol ? (this.Gd = yc) : (this.Gd = sc));
this.cr = 0;
this.Ap = NaN;
this.oe = this.Bq = this.ne = null;
this.Hs = this.lk = 0;
b && Object.assign(this, b);
}
nl.prototype.copy = function() {
var a = new nl();
a.qa = this.qa;
a.kk = this.kk;
a.Gd = this.Gd.J();
a.zk = this.zk.J();
a.cr = this.cr;
a.Ap = this.Ap;
null !== this.ne && (a.ne = this.ne.copy());
a.Bq = this.Bq;
return a;
};
t = nl.prototype;
t.freeze = function() {
this._isFrozen = !0;
null !== this.ne && this.ne.freeze();
return this;
};
t.ja = function() {
Object.isFrozen(this) && C('cannot thaw constant: ' + this);
this._isFrozen = !1;
null !== this.ne && this.ne.ja();
return this;
};
t.ob = function(a) {
a.classType === nl && (this.type = a);
};
t.toString = function() {
var a = 'Brush(';
if (this.type === ul) a += this.color;
else if (
((a =
this.type === xl
? a + 'Linear '
: this.type === ol
? a + 'Radial '
: this.type === wl
? 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._isFrozen && va(this);
('number' !== typeof a || !isFinite(a) || 1 < a || 0 > a) &&
wa(a, '0 <= loc <= 1', nl, 'addColorStop:loc');
null === this.ne && (this.ne = new pb());
this.ne.add(a, b);
this.qa === ul && (this.type = xl);
this.oe = null;
return this;
};
t.Cz = function(a, b) {
this._isFrozen && va(this);
a = void 0 === a || 'number' !== typeof a ? 0.2 : a;
b = void 0 === b ? bm : b;
if (this.type === ul) Uh(this.color), (this.color = cm(a, b));
else if ((this.type === xl || this.type === ol) && null !== this.colorStops)
for (var c = this.colorStops.iterator; c.next(); )
Uh(c.value), this.addColorStop(c.key, cm(a, b));
return this;
};
function dm(a, b, c) {
b = void 0 === b || 'number' !== typeof b ? 0.2 : b;
c = void 0 === c ? bm : c;
Uh(a);
return cm(b, c);
}
t.Dy = function(a, b) {
this._isFrozen && va(this);
a = void 0 === a || 'number' !== typeof a ? 0.2 : a;
b = void 0 === b ? bm : b;
if (this.type === ul) Uh(this.color), (this.color = cm(-a, b));
else if ((this.type === xl || this.type === ol) && null !== this.colorStops)
for (var c = this.colorStops.iterator; c.next(); )
Uh(c.value), this.addColorStop(c.key, cm(-a, b));
return this;
};
function em(a, b, c) {
b = void 0 === b || 'number' !== typeof b ? 0.2 : b;
c = void 0 === c ? bm : c;
Uh(a);
return cm(-b, c);
}
function fm(a, b, c) {
Uh(a);
a = gm.j;
var d = gm.u,
e = gm.m,
f = gm.F;
Uh(b);
void 0 === c && (c = 0.5);
return (
'rgba(' +
Math.round((gm.j - a) * c + a) +
', ' +
Math.round((gm.u - d) * c + d) +
', ' +
Math.round((gm.m - e) * c + e) +
', ' +
Math.round((gm.F - f) * c + f) +
')'
);
}
t.kx = function() {
if (this.type === ul) return hm(this.color);
if ((this.type === xl || this.type === ol) && null !== this.colorStops) {
var a = this.colorStops;
if (this.type === ol) return hm(a.first().value);
if (null !== a.get(0.5)) return hm(a.get(0.5));
if (2 === a.count) return (a = a.Ea()), hm(fm(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(0.5 - b.key);
e > f && h < e
? ((c = g), (e = h))
: f >= e && h < f && ((d = g), (f = h));
}
c > d && ((f = c), (c = d), (d = f), (f = e));
e = d - c;
return hm(fm(a.get(c), a.get(d), 1 - f / e));
}
return !1;
};
function hm(a) {
if (!a) return !1;
if (a instanceof nl) return a.kx();
Uh(a);
return 128 > (299 * gm.j + 587 * gm.u + 114 * gm.m) / 1e3;
}
function cm(a, b) {
switch (b) {
case bm:
b = 100 * im(gm.j);
var c = 100 * im(gm.u),
d = 100 * im(gm.m);
jm.j = 0.4124564 * b + 0.3575761 * c + 0.1804375 * d;
jm.u = 0.2126729 * b + 0.7151522 * c + 0.072175 * d;
jm.m = 0.0193339 * b + 0.119192 * c + 0.9503041 * d;
jm.F = gm.F;
b = km(jm.j / lm[0]);
c = km(jm.u / lm[1]);
d = km(jm.m / lm[2]);
mm.j = 116 * c - 16;
mm.u = 500 * (b - c);
mm.m = 200 * (c - d);
mm.F = jm.F;
mm.j = Math.min(100, Math.max(0, mm.j + 100 * a));
a = (mm.j + 16) / 116;
b = a - mm.m / 200;
jm.j = lm[0] * nm(mm.u / 500 + a);
jm.u = lm[1] * (mm.j > om * pm ? Math.pow(a, 3) : mm.j / om);
jm.m = lm[2] * nm(b);
jm.F = mm.F;
a = -0.969266 * jm.j + 1.8760108 * jm.u + 0.041556 * jm.m;
b = 0.0556434 * jm.j + -0.2040259 * jm.u + 1.0572252 * jm.m;
gm.j =
255 *
qm((3.2404542 * jm.j + -1.5371385 * jm.u + -0.4985314 * jm.m) / 100);
gm.u = 255 * qm(a / 100);
gm.m = 255 * qm(b / 100);
gm.F = jm.F;
gm.j = Math.round(gm.j);
255 < gm.j ? (gm.j = 255) : 0 > gm.j && (gm.j = 0);
gm.u = Math.round(gm.u);
255 < gm.u ? (gm.u = 255) : 0 > gm.u && (gm.u = 0);
gm.m = Math.round(gm.m);
255 < gm.m ? (gm.m = 255) : 0 > gm.m && (gm.m = 0);
return 'rgba(' + gm.j + ', ' + gm.u + ', ' + gm.m + ', ' + gm.F + ')';
case rm:
return (
Vh(),
(Wh.m = Math.min(100, Math.max(0, Wh.m + 100 * a))),
'hsla(' + Wh.j + ', ' + Wh.u + '%, ' + Wh.m + '%, ' + Wh.F + ')'
);
default:
C('Unknown color space: ' + b);
}
}
function Uh(a) {
$l || (am(), ($l = !0));
var b = sm;
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),
(gm.j = a[0]),
(gm.u = a[1]),
(gm.m = a[2]),
(gm.F = a[3] / 255))
: ((b.fillStyle = '#FFFFFF'),
(b.fillStyle = a),
(gm.j = 0),
(gm.u = 0),
(gm.m = 0),
(gm.F = 1));
}
}
function Vh() {
var a = gm.j / 255,
b = gm.u / 255,
c = gm.m / 255,
d = Math.max(a, b, c),
e = Math.min(a, b, c),
f = d - e;
e = (d + e) / 2;
if (0 === f) var g = (a = 0);
else {
switch (d) {
case a:
g = ((b - c) / f) % 6;
break;
case b:
g = (c - a) / f + 2;
break;
case c:
g = (a - b) / f + 4;
}
g *= 60;
0 > g && (g += 360);
a = f / (1 - Math.abs(2 * e - 1));
}
Wh.j = Math.round(g);
Wh.u = Math.round(100 * a);
Wh.m = Math.round(100 * e);
Wh.F = gm.F;
}
function im(a) {
a /= 255;
return 0.04045 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
}
function qm(a) {
return 0.0031308 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - 0.055;
}
function km(a) {
return a > pm ? Math.pow(a, 1 / 3) : (om * a + 16) / 116;
}
function nm(a) {
var b = a * a * a;
return b > pm ? b : (116 * a - 16) / om;
}
function Pl(a, b) {
'string' !== typeof a &&
(a instanceof nl ||
C('Value for ' + b + ' must be a color string or a Brush, not ' + a));
}
function am() {
sm = Og ? new Bk(null).context : null;
}
ma.Object.defineProperties(nl.prototype, {
type: {
get: function() {
return this.qa;
},
set: function(a) {
this._isFrozen && va(this, a);
this.qa = a;
this.start.Fc() &&
(a === xl ? (this.start = uc) : a === ol && (this.start = yc));
this.end.Fc() &&
(a === xl ? (this.end = Bc) : a === ol && (this.end = yc));
this.oe = null;
},
},
color: {
get: function() {
return this.kk;
},
set: function(a) {
this._isFrozen && va(this, a);
this.kk = a;
this.oe = null;
},
},
start: {
get: function() {
return this.Gd;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Gd = a.J();
this.oe = null;
},
},
end: {
get: function() {
return this.zk;
},
set: function(a) {
this._isFrozen && va(this, a);
this.zk = a.J();
this.oe = null;
},
},
startRadius: {
get: function() {
return this.cr;
},
set: function(a) {
this._isFrozen && va(this, a);
0 > a && wa(a, '>= zero', nl, 'startRadius');
this.cr = a;
this.oe = null;
},
},
endRadius: {
get: function() {
return this.Ap;
},
set: function(a) {
this._isFrozen && va(this, a);
0 > a && wa(a, '>= zero', nl, 'endRadius');
this.Ap = a;
this.oe = null;
},
},
colorStops: {
get: function() {
return this.ne;
},
set: function(a) {
this._isFrozen && va(this, a);
this.ne = a;
this.oe = null;
},
},
pattern: {
get: function() {
return this.Bq;
},
set: function(a) {
this._isFrozen && va(this, a);
this.Bq = a;
this.oe = null;
},
},
});
nl.prototype.isDark = nl.prototype.kx;
nl.prototype.darkenBy = nl.prototype.Dy;
nl.prototype.lightenBy = nl.prototype.Cz;
nl.prototype.addColorStop = nl.prototype.addColorStop;
var pm = 216 / 24389,
om = 24389 / 27,
lm = [95.047, 100, 108.883],
sm = null,
gm = new Zl(),
Wh = new Zl(),
jm = new Zl(),
mm = new Zl(),
$l = !1;
nl.className = 'Brush';
var ul;
nl.Solid = ul = new D(nl, 'Solid', 0);
var xl;
nl.Linear = xl = new D(nl, 'Linear', 1);
var ol;
nl.Radial = ol = new D(nl, 'Radial', 2);
var wl;
nl.Pattern = wl = new D(nl, 'Pattern', 4);
var bm;
nl.Lab = bm = new D(nl, 'Lab', 5);
var rm;
nl.HSL = rm = new D(nl, 'HSL', 6);
nl.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;
};
nl.isValidColor = function(a) {
if ('black' === a) return !0;
if ('' === a) return !1;
$l || (am(), ($l = !0));
var b = sm;
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;
};
nl.lighten = function(a) {
return dm(a);
};
nl.lightenBy = dm;
nl.darken = function(a) {
return em(a);
};
nl.darkenBy = em;
nl.mix = fm;
nl.isDark = hm;
function Ll() {
this.va = 'Base';
}
Ll.prototype.measure = function() {};
Ll.prototype.Fz = function(a, b, c, d, e) {
a.measure(b, c, d, e);
};
Ll.prototype.arrange = function() {};
Ll.prototype.sy = function(a, b, c, d, e, f) {
a.arrange(b, c, d, e, f);
};
Ll.prototype.Pz = function(a) {
a.Mj();
};
Ll.prototype.tc = function() {};
ma.Object.defineProperties(Ll.prototype, {
name: {
get: function() {
return this.va;
},
set: function(a) {
this.va = a;
},
},
classType: {
get: function() {
return W;
},
},
});
Ll.prototype.remeasureObject = Ll.prototype.Pz;
Ll.prototype.arrangeElement = Ll.prototype.sy;
Ll.prototype.measureElement = Ll.prototype.Fz;
Ll.className = 'PanelLayout';
function tm() {
this.va = 'Base';
}
la(tm, Ll);
tm.prototype.measure = function(a, b, c, d, e, f, g) {
var h = d.length;
a = um(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 Cf &&
l.isGeometryPositioned &&
((l = l.strokeWidth / 2), (p -= l), (r -= l));
Zb(e, p, r, n, m);
}
}
};
tm.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 Cf && 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 vm() {
this.va = 'Base';
}
la(vm, Ll);
vm.prototype.measure = function(a, b, c, d, e, f, g) {
var h = d.length;
b = Ea();
f = um(a);
for (var k = 0; k < h; k++) {
var l = d[k];
if (l.visible || l === f) {
var m = il(l, !1);
if (m !== lg && m !== Vk) 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);
};
vm.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,
w = il(m, !1);
if ((isNaN(m.desiredSize.height) && w === td) || w === Wk)
u = Math.max(c.height - r - q, 0);
r = u + r + q;
q = m.alignment;
q.Sb() && (q = a.defaultAlignment);
q.pb() || (q = yc);
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 wm() {
this.va = 'Base';
}
la(wm, Ll);
wm.prototype.measure = function(a, b, c, d, e, f) {
var g = d.length;
c = Ea();
for (var h = um(a), k = 0; k < g; k++) {
var l = d[k];
if (l.visible || l === h) {
var m = il(l, !1);
if (m !== lg && m !== Wk) 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;
Qb(
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);
}
};
wm.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,
w = il(m, !1);
if ((isNaN(m.desiredSize.width) && w === td) || w === Vk)
u = Math.max(c.width - r - q, 0);
r = u + r + q;
q = m.alignment;
q.Sb() && (q = a.defaultAlignment);
q.pb() || (q = yc);
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 xm() {
this.va = 'Base';
}
la(xm, Ll);
xm.prototype.measure = function(a, b, c, d, e, f, g) {
var h = d.length,
k = a.vb(),
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);
var u = a.isClipping,
w = M.allocAt(-l.left, -l.top, r, q),
v = M.allocAt(0, 0, f, g);
ym(k, v, !0);
f = v.width;
g = v.height;
for (var z = !0, y = um(a), A = 0; A < h; A++) {
var B = d[A],
F = b,
L = c;
if (B !== k && (B.visible || B === y)) {
l = B.margin;
r = l.right + l.left;
q = l.top + l.bottom;
p = il(B, !1);
switch (p) {
case td:
F = f;
L = g;
break;
case Vk:
F = f;
break;
case Wk:
L = g;
}
B.measure(F, L, 0, 0);
p = B.measuredBounds;
r = Math.max(p.width + r, 0);
q = Math.max(p.height + q, 0);
F = B.alignment;
F.Sb() && (F = a.defaultAlignment);
F.pb() || (F = yc);
var S = B.alignmentFocus;
S.Sb() && (S = yc);
L = null;
B instanceof W &&
'' !== B.Pe &&
((L = B.fb(B.Pe)), L === B && (L = null));
var R = v.x,
P = v.y;
if (null !== L) {
B.arrange(0, 0, p.width, p.height);
l = L.actualBounds;
l = I.allocAt(
l.x + (S.x * l.width - S.offsetX),
l.y + (S.y * l.height - S.offsetY),
);
for (L = L.panel; L !== B; ) L.transform.Fa(l), (L = L.panel);
R += F.x * f + F.offsetX - l.x;
P += F.y * g + F.offsetY - l.y;
I.free(l);
} else
(R += F.x * f + F.offsetX - (S.x * p.width + S.offsetX) - l.left),
(P += F.y * g + F.offsetY - (S.y * p.height + S.offsetY) - l.top);
z ? ((z = !1), e.h(R, P, r, q)) : Zb(e, R, P, r, q);
}
}
z
? e.assign(w)
: u
? e.Gu(v.x, v.y, v.width, v.height)
: Zb(e, w.x, w.y, w.width, w.height);
M.free(w);
M.free(v);
p = k.stretch;
p === Xk && (p = il(k, !1));
switch (p) {
case lg:
return;
case td:
if (!isFinite(b) && !isFinite(c)) return;
break;
case Vk:
if (!isFinite(b)) return;
break;
case Wk:
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 = M.allocAt(-l.left, -l.top, r, q);
ym(k, v, !0);
f = v.width;
g = v.height;
for (b = 0; b < h; b++)
(c = d[b]),
c === k ||
(!c.visible && c !== y) ||
((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.Sb() && (m = a.defaultAlignment),
m.pb() || (m = yc),
(c = c.alignmentFocus),
c.Sb() && (c = yc),
z
? ((z = !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,
))
: Zb(
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,
));
z
? e.assign(w)
: u
? e.Gu(v.x, v.y, v.width, v.height)
: Zb(e, w.x, w.y, w.width, w.height);
M.free(v);
};
xm.prototype.arrange = function(a, b, c) {
var d = b.length,
e = a.vb(),
f = e.measuredBounds,
g = f.width,
h = f.height,
k = a.padding;
f = k.left;
k = k.top;
var l = f - c.x,
m = k - c.y;
e.arrange(l, m, g, h);
g = M.allocAt(0, 0, g, h);
ym(e, g, !1);
for (h = 0; h < d; h++) {
var n = b[h];
if (n !== e) {
l = n.measuredBounds;
var p = l.width,
r = l.height;
m = n.alignment;
m.Sb() && (m = a.defaultAlignment);
m.pb() || (m = yc);
var q = n.alignmentFocus;
q.Sb() && (q = yc);
l = null;
n instanceof W &&
'' !== n.Pe &&
((l = n.fb(n.Pe)), l === n && (l = null));
if (null !== l) {
var u = l.actualBounds;
q = I.allocAt(
u.x + (q.x * u.width - q.offsetX),
u.y + (q.y * u.height - q.offsetY),
);
for (l = l.panel; l !== n; ) l.transform.Fa(q), (l = l.panel);
l = m.x * g.width + m.offsetX - q.x;
m = m.y * g.height + m.offsetY - q.y;
I.free(q);
} else
(l = m.x * g.width + m.offsetX - (q.x * p + q.offsetX)),
(m = m.y * g.height + m.offsetY - (q.y * r + q.offsetY));
l += g.x - c.x;
m += g.y - c.y;
n.visible && n.arrange(f + l, k + m, p, r);
}
}
M.free(g);
};
function ym(a, b, c) {
var d = null;
a instanceof W && '' !== a.Pe && ((d = a.fb(a.Pe)), d === a && (d = null));
if (null !== d)
for (
c && a.arrange(0, 0, b.width, b.height),
b.assign(d.actualBounds),
d = d.panel;
d !== a;
)
d.transform.So(b), (d = d.panel);
}
function zm() {
this.va = 'Base';
}
la(zm, Ll);
zm.prototype.measure = function(a, b, c, d, e, f, g) {
var h = d.length,
k = a.vb(),
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 Cf && ((u = k), (q = u.strokeWidth * u.scale));
var w = Math.max(l.width + p, 0);
l = Math.max(l.height + r, 0);
var v = Am(k),
z = v.x * w + v.offsetX;
v = v.y * l + v.offsetY;
var y = Bm(k),
A = y.x * w + 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(v - y) - q, 0));
q = K.alloc();
q.h(0, 0);
a = um(a);
for (y = 0; y < h; y++)
(v = d[y]),
v === k ||
(!v.visible && v !== a) ||
((l = v.margin),
(w = l.right + l.left),
(z = l.top + l.bottom),
v.measure(m, n, 0, 0),
(l = v.measuredBounds),
(w = Math.max(l.width + w, 0)),
(l = Math.max(l.height + z, 0)),
q.h(Math.max(w, q.width), Math.max(l, q.height)));
if (1 === h) (e.width = w), (e.height = l), K.free(q);
else {
v = Am(k);
y = Bm(k);
h = d = 0;
y.x !== v.x &&
y.y !== v.y &&
((d = q.width / Math.abs(y.x - v.x)),
(h = q.height / Math.abs(y.y - v.y)));
K.free(q);
q = 0;
null !== u &&
((q = u.strokeWidth * u.scale),
mg(u) === ng && (d = h = Math.max(d, h)));
d += Math.abs(v.offsetX) + Math.abs(y.offsetX) + q;
h += Math.abs(v.offsetY) + Math.abs(y.offsetY) + q;
u = k.stretch;
u === Xk && (u = il(k, !1));
switch (u) {
case lg:
g = f = 0;
break;
case td:
isFinite(b) && (d = b);
isFinite(c) && (h = c);
break;
case Vk:
isFinite(b) && (d = b);
g = 0;
break;
case Wk:
(f = 0), isFinite(c) && (h = c);
}
k.Mj();
k.measure(d, h, f, g);
e.width = k.measuredBounds.width + p;
e.height = k.measuredBounds.height + r;
}
};
zm.prototype.arrange = function(a, b) {
var c = b.length,
d = a.vb(),
e = d.measuredBounds,
f = M.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 = Am(d),
n = Bm(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;
Zb(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.Sb() && (p = a.defaultAlignment),
p.pb() || (p = yc),
(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 &&
($b(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 M(f.x, f.y, f.width, f.height),
)));
M.free(f);
};
function Cm() {
this.va = 'Base';
this.name = 'Table';
}
la(Cm, Ll);
Cm.prototype.measure = function(a, b, c, d, e) {
for (var f = d.length, g = Ea(), h = Ea(), k = 0; k < f; k++) {
var l = d[k],
m = l instanceof W ? l : null;
if (
null === m ||
(m.type !== W.TableRow && m.type !== W.TableColumn) ||
!l.visible
)
g.push(l);
else {
h.push(m);
for (var n = m.R.s, p = n.length, r = 0; r < p; r++) {
var q = n[r];
m.type === W.TableRow
? (q.row = l.row)
: m.type === W.TableColumn && (q.column = l.column);
g.push(q);
}
}
}
f = g.length;
0 === f && (a.getRowDefinition(0), a.getColumnDefinition(0));
for (var u = [], w = 0; w < f; w++) {
var v = g[w];
v.visible &&
(ij(v, !0),
jl(v, !0),
u[v.row] || (u[v.row] = []),
u[v.row][v.column] || (u[v.row][v.column] = []),
u[v.row][v.column].push(v));
}
Ga(g);
var z = Ea(),
y = Ea(),
A = Ea(),
B = {
count: 0,
},
F = {
count: 0,
},
L = b,
S = c,
R = a.rowDefs,
P = a.colDefs,
H = null;
f = R.length;
for (var da = 0; da < f; da++) (H = R[da]), void 0 !== H && (H.actual = 0);
f = P.length;
for (var X = 0; X < f; X++) (H = P[X]), void 0 !== H && (H.actual = 0);
for (var oa = u.length, Ba = 0, db = 0; db < oa; db++)
u[db] && (Ba = Math.max(Ba, u[db].length));
var hb = Math.min(a.topIndex, oa - 1),
Fb = Math.min(a.leftIndex, Ba - 1),
eb = 0;
oa = u.length;
for (var Je = um(a), Ua = 0; Ua < oa; Ua++)
if (u[Ua]) {
Ba = u[Ua].length;
var od = a.getRowDefinition(Ua);
od.actual = 0;
for (var Gb = (od.jc = 0); Gb < Ba; Gb++)
if (u[Ua][Gb]) {
var Ke = a.getColumnDefinition(Gb);
void 0 === z[Gb] && ((Ke.actual = 0), (Ke.jc = 0), (z[Gb] = !0));
for (var wc = u[Ua][Gb], Rc = wc.length, lc = 0; lc < Rc; lc++) {
var fc = wc[lc];
if (fc.visible || fc === Je) {
var gf = 1 < fc.rowSpan || 1 < fc.columnSpan;
gf && (Ua < hb || Gb < Fb || y.push(fc));
var pd = fc.margin,
Dh = pd.right + pd.left,
mc = pd.top + pd.bottom;
var Hb = Bl(fc, od, Ke, !1);
var Hi = fc.desiredSize,
sg = !isNaN(Hi.height),
Bd = !isNaN(Hi.width) && sg;
gf ||
Hb === lg ||
Bd ||
Ua < hb ||
Gb < Fb ||
(void 0 !== B[Gb] ||
(Hb !== td && Hb !== Vk) ||
((B[Gb] = -1), B.count++),
void 0 !== F[Ua] ||
(Hb !== td && Hb !== Wk) ||
((F[Ua] = -1), F.count++),
A.push(fc));
fc.measure(Infinity, Infinity, 0, 0);
if (!(Ua < hb || Gb < Fb)) {
var gc = fc.measuredBounds,
Mf = Math.max(gc.width + Dh, 0),
nc = Math.max(gc.height + mc, 0);
if (1 === fc.rowSpan && (Hb === lg || Hb === Vk)) {
H = a.getRowDefinition(Ua);
var hf = H.Qc();
eb = Math.max(nc - H.actual, 0);
eb + hf > S && (eb = Math.max(S - hf, 0));
var mk = 0 === H.ma;
H.jc = H.jc + eb;
H.actual = H.ma + eb;
S = Math.max(S - (eb + (mk ? hf : 0)), 0);
}
if (1 === fc.columnSpan && (Hb === lg || Hb === Wk)) {
H = a.getColumnDefinition(Gb);
var Ii = H.Qc();
eb = Math.max(Mf - H.actual, 0);
eb + Ii > L && (eb = Math.max(L - Ii, 0));
var Kn = 0 === H.ma;
H.jc = H.jc + eb;
H.actual = H.ma + eb;
L = Math.max(L - (eb + (Kn ? Ii : 0)), 0);
}
gf && fc.Mj();
}
}
}
}
}
Ga(z);
var Nd = 0,
me = 0;
f = a.columnCount;
for (var tg = 0; tg < f; tg++) {
var jf = P[tg];
void 0 !== jf &&
((Nd += isNaN(jf.Ac) ? jf.jc : jf.Ac), 0 !== jf.jc && (Nd += jf.Qc()));
}
f = a.rowCount;
for (var Eh = 0; Eh < f; Eh++) {
var kf = R[Eh];
void 0 !== kf &&
((me += isNaN(kf.Ac) ? kf.jc : kf.Ac), 0 !== kf.jc && (me += kf.Qc()));
}
L = Math.max(b - Nd, 0);
var Od = (S = Math.max(c - me, 0)),
Le = L;
f = A.length;
for (var hc = 0; hc < f; hc++) {
var Cd = A[hc],
nk = a.getRowDefinition(Cd.row),
ne = a.getColumnDefinition(Cd.column),
Fh = Cd.measuredBounds,
qd = Cd.margin,
Nf = qd.right + qd.left,
Dd = qd.top + qd.bottom;
B[Cd.column] =
0 === ne.jc && void 0 !== B[Cd.column]
? Math.max(Fh.width + Nf, B[Cd.column])
: null;
F[Cd.row] =
0 === nk.jc && void 0 !== F[Cd.row]
? Math.max(Fh.height + Dd, F[Cd.row])
: null;
}
var ug = 0,
Gh = 0,
bd;
for (bd in F) 'count' !== bd && (ug += F[bd]);
for (bd in B) 'count' !== bd && (Gh += B[bd]);
for (var ib = K.alloc(), Ji = 0; Ji < f; Ji++) {
var Vb = A[Ji];
if (Vb.visible || Vb === Je) {
var Va = a.getRowDefinition(Vb.row),
Wb = a.getColumnDefinition(Vb.column),
oe = 0;
isFinite(Wb.width)
? (oe = Wb.width)
: (isFinite(L) && null !== B[Vb.column]
? 0 === Gh
? (oe = Wb.actual + L)
: (oe = (B[Vb.column] / Gh) * Le)
: null !== B[Vb.column]
? (oe = L)
: (oe = Wb.actual || L),
(oe = Math.max(0, oe - Wb.Qc())));
var Me = 0;
isFinite(Va.height)
? (Me = Va.height)
: (isFinite(S) && null !== F[Vb.row]
? 0 === ug
? (Me = Va.actual + S)
: (Me = (F[Vb.row] / ug) * Od)
: null !== F[Vb.row]
? (Me = S)
: (Me = Va.actual || S),
(Me = Math.max(0, Me - Va.Qc())));
ib.h(
Math.max(Wb.minimum, Math.min(oe, Wb.maximum)),
Math.max(Va.minimum, Math.min(Me, Va.maximum)),
);
Hb = Bl(Vb, Va, Wb, !1);
switch (Hb) {
case Vk:
ib.height = Math.max(ib.height, Va.actual + S);
break;
case Wk:
ib.width = Math.max(ib.width, Wb.actual + L);
}
var Of = Vb.margin,
Ln = Of.right + Of.left,
ok = Of.top + Of.bottom;
Vb.Mj();
Vb.measure(ib.width, ib.height, Wb.minimum, Va.minimum);
var Hh = Vb.measuredBounds,
Pf = Math.max(Hh.width + Ln, 0),
vg = Math.max(Hh.height + ok, 0);
isFinite(L) && (Pf = Math.min(Pf, ib.width));
isFinite(S) && (vg = Math.min(vg, ib.height));
var ic = 0;
ic = Va.actual;
Va.actual = Math.max(Va.actual, vg);
Va.jc = Math.max(Va.jc, vg);
eb = Va.actual - ic;
S = Math.max(S - eb, 0);
null === F[Vb.row] && (Od = Math.max(Od - eb, 0));
ic = Wb.actual;
Wb.actual = Math.max(Wb.actual, Pf);
Wb.jc = Math.max(Wb.jc, Pf);
eb = Wb.actual - ic;
L = Math.max(L - eb, 0);
null === B[Vb.column] && (Le = Math.max(Le - eb, 0));
}
}
Ga(A);
var Ed = K.alloc(),
rd = Ea(),
Fc = Ea();
f = y.length;
if (0 !== f)
for (var lf = 0; lf < oa; lf++)
if (u[lf]) {
Ba = u[lf].length;
var Ih = a.getRowDefinition(lf);
rd[lf] = Ih.actual;
for (var mf = 0; mf < Ba; mf++)
if (u[lf][mf]) {
var pk = a.getColumnDefinition(mf);
Fc[mf] = pk.actual;
}
}
for (var Jh = 0; Jh < f; Jh++) {
var Oa = y[Jh];
if (Oa.visible || Oa === Je) {
var cd = a.getRowDefinition(Oa.row),
Sc = a.getColumnDefinition(Oa.column);
ib.h(
Math.max(Sc.minimum, Math.min(b, Sc.maximum)),
Math.max(cd.minimum, Math.min(c, cd.maximum)),
);
Hb = Bl(Oa, cd, Sc, !1);
switch (Hb) {
case td:
0 !== Fc[Sc.index] && (ib.width = Math.min(ib.width, Fc[Sc.index]));
0 !== rd[cd.index] &&
(ib.height = Math.min(ib.height, rd[cd.index]));
break;
case Vk:
0 !== Fc[Sc.index] && (ib.width = Math.min(ib.width, Fc[Sc.index]));
break;
case Wk:
0 !== rd[cd.index] &&
(ib.height = Math.min(ib.height, rd[cd.index]));
}
isFinite(Sc.width) && (ib.width = Sc.width);
isFinite(cd.height) && (ib.height = cd.height);
Ed.h(0, 0);
for (
var qk = Sc.minimum, oc = cd.minimum, Ne = 1;
Ne < Oa.rowSpan && !(Oa.row + Ne >= a.rowCount);
Ne++
)
(H = a.getRowDefinition(Oa.row + Ne)),
(eb = 0),
(eb =
Hb === td || Hb === Wk
? Math.max(
H.minimum,
0 === rd[Oa.row + Ne]
? H.maximum
: Math.min(rd[Oa.row + Ne], H.maximum),
)
: Math.max(
H.minimum,
isNaN(H.Ac) ? H.maximum : Math.min(H.Ac, H.maximum),
)),
(Ed.height += eb),
(oc += H.minimum);
for (
var Tc = 1;
Tc < Oa.columnSpan && !(Oa.column + Tc >= a.columnCount);
Tc++
)
(H = a.getColumnDefinition(Oa.column + Tc)),
(eb = 0),
(eb =
Hb === td || Hb === Vk
? Math.max(
H.minimum,
0 === Fc[Oa.column + Tc]
? H.maximum
: Math.min(Fc[Oa.column + Tc], H.maximum),
)
: Math.max(
H.minimum,
isNaN(H.Ac) ? H.maximum : Math.min(H.Ac, H.maximum),
)),
(Ed.width += eb),
(qk += H.minimum);
ib.width += Ed.width;
ib.height += Ed.height;
var Kh = Oa.margin,
nf = Kh.right + Kh.left,
Ki = Kh.top + Kh.bottom;
Oa.measure(ib.width, ib.height, qk, oc);
for (
var Lh = Oa.measuredBounds,
Fd = Math.max(Lh.width + nf, 0),
Qf = Math.max(Lh.height + Ki, 0),
of = 0,
Mh = 0;
Mh < Oa.rowSpan && !(Oa.row + Mh >= a.rowCount);
Mh++
)
(H = a.getRowDefinition(Oa.row + Mh)), (of += H.total || 0);
if (of < Qf) {
var Oe = Qf - of,
Pd = Qf - of;
if (null !== Oa.spanAllocation)
for (
var Pe = Oa.spanAllocation, pe = 0;
pe < Oa.rowSpan && !(0 >= Oe) && !(Oa.row + pe >= a.rowCount);
pe++
) {
H = a.getRowDefinition(Oa.row + pe);
var Qe = H.ma || 0,
Rf = Pe(Oa, H, Pd);
H.actual = Math.min(H.maximum, Qe + Rf);
H.ma !== Qe && (Oe -= H.ma - Qe);
}
for (; 0 < Oe; ) {
var sd = H.ma || 0;
isNaN(H.height) &&
H.maximum > sd &&
((H.actual = Math.min(H.maximum, sd + Oe)),
H.ma !== sd && (Oe -= H.ma - sd));
if (0 === H.index) break;
H = a.getRowDefinition(H.index - 1);
}
}
for (
var wg = 0, Re = 0;
Re < Oa.columnSpan && !(Oa.column + Re >= a.columnCount);
Re++
)
(H = a.getColumnDefinition(Oa.column + Re)), (wg += H.total || 0);
if (wg < Fd) {
var xg = Fd - wg,
Mn = Fd - wg;
if (null !== Oa.spanAllocation)
for (
var qe = Oa.spanAllocation, Sf = 0;
Sf < Oa.columnSpan &&
!(0 >= xg) &&
!(Oa.column + Sf >= a.columnCount);
Sf++
) {
H = a.getColumnDefinition(Oa.column + Sf);
var Li = H.ma || 0,
Nn = qe(Oa, H, Mn);
H.actual = Math.min(H.maximum, Li + Nn);
H.ma !== Li && (xg -= H.ma - Li);
}
for (; 0 < xg; ) {
var rk = H.ma || 0;
isNaN(H.width) &&
H.maximum > rk &&
((H.actual = Math.min(H.maximum, rk + xg)),
H.ma !== rk && (xg -= H.ma - rk));
if (0 === H.index) break;
H = a.getColumnDefinition(H.index - 1);
}
}
}
}
Ga(y);
K.free(Ed);
K.free(ib);
void 0 !== rd && Ga(rd);
void 0 !== Fc && Ga(Fc);
var yg = 0,
zg = 0,
sk = a.desiredSize,
vr = a.maxSize;
Hb = il(a, !0);
var Mi = (me = Nd = 0),
Ni = 0;
f = a.columnCount;
for (var tk = 0; tk < f; tk++)
void 0 !== P[tk] &&
((H = a.getColumnDefinition(tk)),
isFinite(H.width)
? ((Mi += H.width), (Mi += H.Qc()))
: Dm(H) === Em
? ((Mi += H.ma), (Mi += H.Qc()))
: 0 !== H.ma && ((Nd += H.ma), (Nd += H.Qc())));
isFinite(sk.width)
? (yg = Math.min(sk.width, vr.width))
: (yg = Hb !== lg && isFinite(b) ? b : Nd);
yg = Math.max(yg, a.minSize.width);
yg = Math.max(yg - Mi, 0);
for (var iu = 0 === Nd ? 1 : Math.max(yg / Nd, 1), vk = 0; vk < f; vk++)
void 0 !== P[vk] &&
((H = a.getColumnDefinition(vk)),
isFinite(H.width) || Dm(H) === Em || (H.actual = H.ma * iu),
(H.position = e.width),
0 !== H.ma && ((e.width += H.ma), (e.width += H.Qc())));
f = a.rowCount;
for (var wk = 0; wk < f; wk++)
void 0 !== R[wk] &&
((H = a.getRowDefinition(wk)),
isFinite(H.height)
? ((Ni += H.height), (Ni += H.Qc()))
: Dm(H) === Em
? ((Ni += H.ma), (Ni += H.Qc()))
: 0 !== H.ma && ((me += H.ma), (me += H.Qc())));
isFinite(sk.height)
? (zg = Math.min(sk.height, vr.height))
: (zg = Hb !== lg && isFinite(c) ? c : me);
zg = Math.max(zg, a.minSize.height);
zg = Math.max(zg - Ni, 0);
for (var ju = 0 === me ? 1 : Math.max(zg / me, 1), xk = 0; xk < f; xk++)
void 0 !== R[xk] &&
((H = a.getRowDefinition(xk)),
isFinite(H.height) || Dm(H) === Em || (H.actual = H.ma * ju),
(H.position = e.height),
0 !== H.ma && ((e.height += H.ma), (e.height += H.Qc())));
f = h.length;
for (var On = 0; On < f; On++) {
var Pi = h[On],
Pn = 0,
Qn = 0;
Pi.type === W.TableRow
? ((Pn = e.width), (H = a.getRowDefinition(Pi.row)), (Qn = H.actual))
: ((H = a.getColumnDefinition(Pi.column)),
(Pn = H.actual),
(Qn = e.height));
Pi.measuredBounds.h(0, 0, Pn, Qn);
ij(Pi, !1);
}
Ga(h);
a.inRowsCols = u;
};
Cm.prototype.arrange = function(a, b, c) {
var d = b.length,
e = a.padding,
f = e.left;
e = e.top;
var g = a.inRowsCols;
if (null !== g) {
for (var h, k, l = g.length, m = 0, n = 0; n < l; n++)
g[n] && (m = Math.max(m, g[n].length));
k = a.rowDefs;
h = a.colDefs;
var p = (n = 0),
r = Math.min(a.topIndex, l - 1);
if (0 < k.length) {
for (; r !== l && (void 0 === k[r] || 0 === k[r].ma); ) r++;
r = Math.max(Math.min(r, l - 1), 0);
n = -k[r].position;
}
var q = Math.min(a.leftIndex, m - 1);
if (0 < h.length) {
for (; q !== m && (void 0 === h[q] || 0 === h[q].ma); ) q++;
q = Math.max(Math.min(q, m - 1), 0);
p = -h[q].position;
}
for (var u = 0, w = 0; u !== l && void 0 === k[u]; ) u++;
for (; w !== l && void 0 === h[w]; ) w++;
m = a.part;
a.getRowDefinition(u);
a.getColumnDefinition(w);
for (var v = 0; v < b.length; v++) {
var z = b[v];
if (
z instanceof W &&
z.visible &&
(z.type === W.TableRow || z.type === W.TableColumn)
) {
if (z.type === W.TableRow) {
h = a.getRowDefinition(z.row);
var y = a.getColumnDefinition(w);
} else
(h = a.getRowDefinition(u)), (y = a.getColumnDefinition(z.column));
k = h.position + n + e;
0 !== h.ma && (k += h.mo(Math.max(u, r)));
h = y.position + p + f;
0 !== y.ma && (h += y.mo(Math.max(w, q)));
y = z.measuredBounds;
z.Jk();
z.actualBounds.ja();
var A = z.actualBounds,
B = M.allocAt(A.x, A.y, A.width, A.height);
A.x = z.type === W.TableRow ? f : h;
A.y = z.type === W.TableColumn ? e : k;
A.width = y.width;
A.height = y.height;
z.actualBounds.freeze();
jl(z, !1);
Tb(B, A) || null === m || (m.dh(), z.wn(m));
M.free(B);
}
}
v = K.alloc();
for (z = 0; z < l; z++)
if (g[z])
for (
m = g[z].length,
y = a.getRowDefinition(z),
k = y.position + n + e,
0 !== y.ma && (k += y.mo(Math.max(u, r))),
A = 0;
A < m;
A++
)
if (g[z][A]) {
B = a.getColumnDefinition(A);
h = B.position + p + f;
0 !== B.ma && (h += B.mo(Math.max(w, q)));
for (var F = g[z][A], L = F.length, S = 0; S < L; S++) {
var R = F[S],
P = R.measuredBounds;
v.h(0, 0);
for (var H = 1; H < R.rowSpan && !(z + H >= a.rowCount); H++) {
var da = a.getRowDefinition(z + H);
0 !== da.ma && (v.height += da.total);
}
for (H = 1; H < R.columnSpan && !(A + H >= a.columnCount); H++)
(da = a.getColumnDefinition(A + H)),
0 !== da.ma && (v.width += da.total);
var X = B.ma + v.width,
oa = y.ma + v.height;
H = h;
da = k;
var Ba = X,
db = oa,
hb = h,
Fb = k,
eb = X,
Je = oa;
h + X > c.width && (eb = Math.max(c.width - h, 0));
k + oa > c.height && (Je = Math.max(c.height - k, 0));
var Ua = R.alignment;
if (Ua.Sb()) {
Ua = a.defaultAlignment;
Ua.pb() || (Ua = yc);
var od = Ua.x;
var Gb = Ua.y;
var Ke = Ua.offsetX;
Ua = Ua.offsetY;
var wc = B.alignment,
Rc = y.alignment;
wc.pb() && ((od = wc.x), (Ke = wc.offsetX));
Rc.pb() && ((Gb = Rc.y), (Ua = Rc.offsetY));
} else
(od = Ua.x),
(Gb = Ua.y),
(Ke = Ua.offsetX),
(Ua = Ua.offsetY);
if (isNaN(od) || isNaN(Gb)) (Gb = od = 0.5), (Ua = Ke = 0);
wc = P.width;
Rc = P.height;
var lc = R.margin,
fc = lc.left + lc.right,
gf = lc.top + lc.bottom,
pd = Bl(R, y, B, !1);
!isNaN(R.desiredSize.width) ||
(pd !== td && pd !== Vk) ||
(wc = Math.max(X - fc, 0));
!isNaN(R.desiredSize.height) ||
(pd !== td && pd !== Wk) ||
(Rc = Math.max(oa - gf, 0));
X = R.maxSize;
oa = R.minSize;
wc = Math.min(X.width, wc);
Rc = Math.min(X.height, Rc);
wc = Math.max(oa.width, wc);
Rc = Math.max(oa.height, Rc);
X = Rc + gf;
H += Ba * od - (wc + fc) * od + Ke + lc.left;
da += db * Gb - X * Gb + Ua + lc.top;
R.visible &&
($b(hb, Fb, eb, Je, H, da, P.width, P.height)
? R.arrange(H, da, wc, Rc)
: R.arrange(H, da, wc, Rc, new M(hb, Fb, eb, Je)));
}
}
K.free(v);
for (a = 0; a < d; a++)
(c = b[a]),
(f = c instanceof W ? c : null),
null === f ||
(f.type !== W.TableRow && f.type !== W.TableColumn) ||
((f = c.actualBounds),
c.naturalBounds.ja(),
c.naturalBounds.h(0, 0, f.width, f.height),
c.naturalBounds.freeze());
}
};
function Fm() {
this.va = 'Base';
}
la(Fm, Ll);
Fm.prototype.measure = function() {};
Fm.prototype.arrange = function() {};
function Gm() {
this.va = 'Base';
}
la(Gm, Ll);
Gm.prototype.measure = function() {};
Gm.prototype.arrange = function() {};
function Hm() {
this.va = 'Base';
}
la(Hm, Ll);
Hm.prototype.measure = function(a, b, c, d, e, f, g) {
1 < d.length &&
C('Viewbox Panel cannot contain more than one GraphObject.');
d = d[0];
d.xa = 1;
d.Mj();
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 === ng
? 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.xa *= q;
m !== d.scale && (ij(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);
};
Hm.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.Sb() && (g = a.defaultAlignment);
g.pb() || (g = yc);
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 Im() {
this.va = 'Base';
}
la(Im, Ll);
Im.prototype.measure = function() {};
Im.prototype.arrange = function() {};
Im.prototype.tc = function(a, b, c) {
c = a.uf() * c.scale;
0 >= c && (c = 1);
var d = a.gridCellSize,
e = d.width;
d = d.height;
var f = a.naturalBounds,
g = a.actualBounds,
h = f.width,
k = f.height,
l = Math.ceil(h / e),
m = Math.ceil(k / d),
n = a.gridOrigin,
p = n.x;
n = n.y;
b.save();
b.beginPath();
b.rect(0, 0, h, k);
b.clip();
for (var r = [], q = a.R.s, u = q.length, w = 0; w < u; w++) {
var v = q[w],
z = [];
r.push(z);
if (v.visible) {
var y = v.interval;
if (!(0 > y)) {
v = Sj(v.figure);
for (var A = 0; A < u; A++)
if (A !== w) {
var B = q[A];
B.visible &&
Sj(B.figure) === v &&
((B = B.interval), B > y && z.push(B));
}
}
}
}
q = a.R.s;
u = q.length;
for (w = 0; w < u; w++) {
var F = q[w];
if (
F.visible &&
((z = F.interval || 1), (v = Math.abs(z)), !(2 > e * v * c))
) {
y = F.segmentIndex;
if (!isFinite(y) || isNaN(y)) y = 0;
0 > y && (y = v - Math.min(-y, v));
y = Math.round(y % v);
v = F.opacity;
A = 1;
if (1 !== v) {
if (0 === v) continue;
A = b.globalAlpha;
b.globalAlpha = A * v;
}
B = r[w];
var L = !1,
S = F.strokeDashArray;
null !== S && ((L = !0), b.Gr(S, F.strokeDashOffset));
if ('LineV' === F.figure && null !== F.stroke && 0 < F.strokeWidth) {
b.lineWidth = F.strokeWidth;
gi(a, b, F.stroke, !1, !1, f, g);
b.beginPath();
for (S = F = Math.floor((p - e) / e); S <= F + l; S++) {
var R = S * e + p;
0 <= R &&
R <= h &&
Jm(S, z, y, B) &&
(b.moveTo(R, 0), b.lineTo(R, k));
}
b.stroke();
} else if (
'LineH' === F.figure &&
null !== F.stroke &&
0 < F.strokeWidth
) {
b.lineWidth = F.strokeWidth;
gi(a, b, F.stroke, !1, !1, f, g);
b.beginPath();
for (S = F = Math.floor((n - d) / d); S <= F + m; S++)
(R = S * d + n),
0 <= R &&
R <= k &&
Jm(S, z, y, B) &&
(b.moveTo(0, R), b.lineTo(h, R));
b.stroke();
} else if ('BarV' === F.figure && null !== F.fill)
for (
gi(a, b, F.fill, !0, !1, f, g),
F = F.width,
isNaN(F) && (F = e),
R = S = Math.floor((p - e) / e);
R <= S + l;
R++
) {
var P = R * e + p;
0 <= P + F && P <= h && Jm(R, z, y, B) && b.fillRect(P, 0, F, k);
}
else if ('BarH' === F.figure && null !== F.fill)
for (
gi(a, b, F.fill, !0, !1, f, g),
F = F.height,
isNaN(F) && (F = d),
R = S = Math.floor((n - d) / d);
R <= S + m;
R++
)
(P = R * d + n),
0 <= P + F && P <= k && Jm(R, z, y, B) && b.fillRect(0, P, h, F);
L && b.Er();
1 !== v && (b.globalAlpha = A);
}
}
b.restore();
b.Oc(!1);
};
function Jm(a, b, c, d) {
if (0 > b) return a % b === c;
if (a % b !== c) return !1;
b = d.length;
for (var e = 0; e < b; e++) if (a % d[e] === c) return !1;
return !0;
}
function Km() {
this.va = 'Base';
}
la(Km, Ll);
Km.prototype.measure = function(a, b, c, d, e) {
var f = d.length;
if (a instanceof ue || a instanceof T) {
var g = null,
h = null;
a instanceof T && (g = a);
a instanceof ue &&
((h = a), (g = h.adornedPart), null === a.j && (a.j = []));
if (g instanceof T) {
var k = g;
if (0 === f) Qb(a.naturalBounds, 0, 0), a.measuredBounds.h(0, 0, 0, 0);
else {
var l = a instanceof ue ? null : g.path;
b = g.routeBounds;
c = a.bg;
c.h(0, 0, b.width, b.height);
var m = k.points,
n = g.pointsCount;
null !== h ? h.Rj(!1) : null !== g && g.Rj(!1);
h = b.width;
var p = b.height,
r = a.j;
r.length = 0;
if (null !== l) {
Lm(a, h, p, l);
var q = l.measuredBounds;
c.Xc(q);
r.push(q);
}
q = md.alloc();
for (var u = I.alloc(), w = I.alloc(), v = 0; v < f; v++) {
var z = d[v];
if (z !== l)
if (z.isPanelMain && z instanceof Cf) {
Lm(a, h, p, z);
var y = z.measuredBounds;
c.Xc(y);
r.push(y);
} else if (2 > n)
z.measure(Infinity, Infinity, 0, 0),
(y = z.measuredBounds),
c.Xc(y),
r.push(y);
else {
var A = z.segmentIndex,
B = z.segmentFraction,
F = z.alignmentFocus;
F.Fc() && (F = yc);
var L = z.segmentOrientation,
S = z.segmentOffset;
if (isNaN(A)) {
var R = k.sa;
y = Ea();
R.Cu(B, y);
var P = I.allocAt(y[0], y[1]);
P.add(k.i(0));
R.type === O.j
? P.offset(-R.startX, -R.startY)
: ((R = R.figures.first()),
null !== R && P.offset(-R.startX, -R.startY));
R = y[2];
if (L !== $f) {
var H = k.computeAngle(z, L, R);
z.Gb = H;
}
H = P.x - b.x;
var da = P.y - b.y;
I.free(P);
Ga(y);
} else if (A < -n || A >= n)
(y = I.alloc()),
k.mg(),
k.computeMidPoint(y),
(R = k.midAngle),
L !== $f && ((H = k.computeAngle(z, L, R)), (z.Gb = H)),
(H = y.x - b.x),
(da = y.y - b.y),
I.free(y);
else {
H = 0;
0 <= A
? ((da = m.K(A)), (y = A < n - 1 ? m.K(A + 1) : da))
: ((H = n + A),
(da = m.K(H)),
(y = 0 < H ? m.K(H - 1) : da));
if (da.$a(y)) {
0 <= A
? ((R = 0 < A ? m.K(A - 1) : da),
(H = A < n - 2 ? m.K(A + 2) : y))
: ((R = H < n - 1 ? m.K(H + 1) : da),
(H = 1 < H ? m.K(H - 2) : y));
P = R.rf(da);
var X = y.rf(H);
R =
P > X + 10
? 0 <= A
? R.Ya(da)
: da.Ya(R)
: X > P + 10
? 0 <= A
? y.Ya(H)
: H.Ya(y)
: 0 <= A
? R.Ya(H)
: H.Ya(R);
} else R = 0 <= A ? da.Ya(y) : y.Ya(da);
L !== $f && ((H = k.computeAngle(z, L, R)), (z.Gb = H));
H = da.x + (y.x - da.x) * B - b.x;
da = da.y + (y.y - da.y) * B - b.y;
}
z.measure(Infinity, Infinity, 0, 0);
y = z.measuredBounds;
P = z.naturalBounds;
var oa = 0;
z instanceof Cf && (oa = z.strokeWidth);
X = P.width + oa;
var Ba = P.height + oa;
q.reset();
q.translate(-y.x, -y.y);
q.scale(z.scale, z.scale);
q.rotate(L === $f ? z.angle : R, X / 2, Ba / 2);
(L !== Mm && L !== Nm) || q.rotate(90, X / 2, Ba / 2);
(L !== Om && L !== Pm) || q.rotate(-90, X / 2, Ba / 2);
L === Qm &&
((45 < R && 135 > R) || (225 < R && 315 > R)) &&
q.rotate(-R, X / 2, Ba / 2);
P = new M(0, 0, X, Ba);
u.oi(P, F);
q.Fa(u);
F = -u.x + (oa / 2) * z.scale;
z = -u.y + (oa / 2) * z.scale;
w.assign(S);
oa = isNaN(S.x);
var db = isNaN(S.y);
if (oa || db) {
X = X / 2 + 3;
Ba = Ba / 2 + 3;
var hb = 45 <= R && 135 >= R,
Fb = 225 <= R && 315 >= R;
L === $f && (hb || Fb)
? ((w.x = db ? X : S.y),
(w.y = oa ? Ba : S.x),
hb
? 0 <= A || (isNaN(A) && 0.5 > B) || !oa || (w.y = -Ba)
: Fb &&
((0 <= A || (isNaN(A) && 0.5 > B)) &&
oa &&
(w.y = -Ba),
db && (w.x = -X)))
: (oa && (w.x = 0 <= A || (isNaN(A) && 0.5 > B) ? X : -X),
db && (w.y = -Ba),
w.rotate(R));
} else w.rotate(R);
H += w.x;
da += w.y;
P.set(y);
P.h(H + F, da + z, y.width, y.height);
r.push(P);
c.Xc(P);
}
}
if (null !== g)
for (d = g.labelNodes; d.next(); )
d.value.measure(Infinity, Infinity);
a.bg = c;
a.position.h(b.x + c.x, b.y + c.y);
a.location.h(NaN, NaN);
Qb(e, c.width || 0, c.height || 0);
md.free(q);
I.free(u);
I.free(w);
}
}
}
};
Km.prototype.arrange = function(a, b) {
var c = b.length;
if (a instanceof ue || a instanceof T) {
var d = a,
e = null;
a instanceof ue && ((e = a), (d = e.adornedPart));
var f = a instanceof ue ? null : d.path,
g = a.j;
if (0 !== g.length) {
var h = 0;
if (null !== f && h < g.length) {
var k = g[h];
h++;
f.arrange(k.x - a.bg.x, k.y - a.bg.y, k.width, k.height);
}
for (k = 0; k < c; k++) {
var l = b[k];
if (l !== f && h < g.length) {
var m = g[h];
h++;
l.arrange(m.x - a.bg.x, m.y - a.bg.y, m.width, m.height);
}
}
}
b = d.points;
c = b.count;
if (2 <= c && a instanceof T)
for (f = a.labelNodes; f.next(); ) {
var n = a;
g = f.value;
h = g.segmentIndex;
k = g.segmentFraction;
var p = g.alignmentFocus;
l = g.segmentOrientation;
m = g.segmentOffset;
if (isNaN(h)) {
var r = n.sa;
var q = Ea();
r.Cu(k, q);
var u = I.allocAt(q[0], q[1]);
u.add(n.i(0));
r.type === O.j
? u.offset(-r.startX, -r.startY)
: ((r = r.figures.first()), u.offset(-r.startX, -r.startY));
r = q[2];
l !== $f && ((n = n.computeAngle(g, l, r)), (g.angle = n));
n = u.x;
var w = u.y;
I.free(u);
Ga(q);
} else if (h < -c || h >= c)
(q = I.alloc()),
(r = n),
(w = q),
r.mg(),
r.computeMidPoint(w),
(r = n.midAngle),
l !== $f && ((n = n.computeAngle(g, l, r)), (g.angle = n)),
(n = q.x),
(w = q.y),
I.free(q);
else {
u = 0;
0 <= h
? ((q = b.s[h]), (w = h < c - 1 ? b.s[h + 1] : q))
: ((u = c + h), (q = b.s[u]), (w = 0 < u ? b.s[u - 1] : q));
if (q.$a(w)) {
0 <= h
? ((r = 0 < h ? b.s[h - 1] : q),
(u = h < c - 2 ? b.s[h + 2] : w))
: ((r = u < c - 1 ? b.s[u + 1] : q),
(u = 1 < u ? b.s[u - 2] : w));
var v = r.rf(q),
z = w.rf(u);
r =
v > z + 10
? 0 <= h
? r.Ya(q)
: q.Ya(r)
: z > v + 10
? 0 <= h
? w.Ya(u)
: u.Ya(w)
: 0 <= h
? r.Ya(u)
: u.Ya(r);
} else r = 0 <= h ? q.Ya(w) : w.Ya(q);
l !== $f && ((n = n.computeAngle(g, l, r)), (g.angle = n));
n = q.x + (w.x - q.x) * k;
w = q.y + (w.y - q.y) * k;
}
if (p.Wr()) g.location = new I(n, w);
else {
p.Fc() && (p = yc);
q = md.alloc();
q.reset();
q.scale(g.scale, g.scale);
q.rotate(g.angle, 0, 0);
var y = g.naturalBounds;
u = M.allocAt(0, 0, y.width, y.height);
v = I.alloc();
v.oi(u, p);
q.Fa(v);
p = -v.x;
z = -v.y;
var A = y.width,
B = y.height;
y = I.alloc();
y.assign(m);
var F = isNaN(m.x),
L = isNaN(m.y);
if (F || L) {
A = A / 2 + 3;
B = B / 2 + 3;
var S = 45 <= r && 135 >= r,
R = 225 <= r && 315 >= r;
l === $f && (S || R)
? ((y.x = L ? A : m.y),
(y.y = F ? B : m.x),
S
? 0 <= h || (isNaN(h) && 0.5 > k) || !F || (y.y = -B)
: R &&
((0 <= h || (isNaN(h) && 0.5 > k)) && F && (y.y = -B),
L && (y.x = -A)))
: (F && (y.x = 0 <= h || (isNaN(h) && 0.5 > k) ? A : -A),
L && (y.y = -B),
y.rotate(r));
} else y.rotate(r);
n += y.x;
w += y.y;
q.So(u);
p += u.x;
z += u.y;
h = I.allocAt(n + p, w + z);
g.move(h);
I.free(h);
I.free(y);
I.free(v);
M.free(u);
md.free(q);
}
}
null !== e ? e.Rj(!1) : d.Rj(!1);
}
};
function Lm(a, b, c, d) {
if (!1 !== nj(d)) {
var e = d.strokeWidth;
0 === e &&
a instanceof ue &&
a.type === W.Link &&
a.adornedObject instanceof Cf &&
(e = a.adornedObject.strokeWidth);
e *= d.xa;
a instanceof T && null !== a.sa
? ((a = a.sa.bounds),
d.ve(a.x - e / 2, a.y - e / 2, a.width + e, a.height + e))
: a instanceof ue && null !== a.adornedPart.sa
? ((a = a.adornedPart.sa.bounds),
d.ve(a.x - e / 2, a.y - e / 2, a.width + e, a.height + e))
: d.ve(-(e / 2), -(e / 2), b + e, c + e);
e = d.desiredSize;
e.v() || null === d.sa
? d.bc.h(0, 0, e.width, e.height)
: d.bc.assign(d.sa.bounds);
ij(d, !1);
}
}
function Rm() {
this.va = 'Base';
}
la(Rm, Ll);
Rm.prototype.measure = function(a, b, c, d, e, f, g) {
var h = a.vb();
a.graduatedBounds = [];
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 M(
-k.left,
-k.top,
Math.max(n.width + l, 0),
Math.max(n.height + m, 0),
);
a.graduatedBounds.push(p);
e.assign(p);
for (
var r = h.geometry,
q = h.strokeWidth,
u = r.flattenedSegments,
w = r.flattenedLengths,
v = r.flattenedTotalLength,
z = u.length,
y = 0,
A = 0,
B = Ea(),
F = 0;
F < z;
F++
) {
var L = u[F],
S = [];
A = y = 0;
for (var R = L.length, P = 0; P < R; P += 2) {
var H = L[P],
da = L[P + 1];
if (0 !== P) {
var X = (180 * Math.atan2(da - A, H - y)) / Math.PI;
0 > X && (X += 360);
S.push(X);
}
y = H;
A = da;
}
B.push(S);
}
if (null === a.graduatedIntervals) {
for (var oa = [], Ba = a.R.s, db = Ba.length, hb = 0; hb < db; hb++) {
var Fb = Ba[hb],
eb = [];
oa.push(eb);
if (Fb.visible) {
var Je = Fb.interval;
if (!(0 > Je))
for (var Ua = 0; Ua < db; Ua++)
if (Ua !== hb) {
var od = Ba[Ua];
if (od.visible && Fb.constructor === od.constructor) {
var Gb = od.interval;
Gb > Je && eb.push(Gb);
}
}
}
}
a.graduatedIntervals = oa;
}
var Ke = a.graduatedIntervals;
var wc = a.R.s,
Rc = wc.length,
lc = 0,
fc = 0,
gf = v;
a.graduatedMarks = [];
for (var pd, Dh = 0; Dh < Rc; Dh++) {
var mc = wc[Dh];
pd = [];
if (mc.visible && mc !== h) {
var Hb = Math.abs(mc.interval),
Hi = a.graduatedTickUnit;
if (
!(2 > (Hi * Hb * v) / a.graduatedRange && null === mc.graduatedSkip)
) {
var sg = w[0][0],
Bd = 0,
gc = 0;
fc = v * mc.graduatedStart - 1e-4;
gf = v * mc.graduatedEnd + 1e-4;
var Mf = Hi * Hb,
nc = a.graduatedTickBase;
if (nc < a.graduatedMin) {
var hf = (a.graduatedMin - nc) / Mf;
hf = 0 === hf % 1 ? hf : Math.floor(hf + 1);
nc += hf * Mf;
} else
nc > a.graduatedMin + Mf &&
(nc -= Math.floor((nc - a.graduatedMin) / Mf) * Mf);
for (
var mk = Ke[Dh], Ii = nc, Kn = 1e-6 * a.graduatedMax, Nd = 1;
nc <= a.graduatedMax + Kn;
Nd++
) {
a: {
for (var me = mk.length, tg = 0; tg < me; tg++) {
var jf =
(nc - a.graduatedTickBase) % (mk[tg] * a.graduatedTickUnit),
Eh = 1e-6 * a.graduatedTickUnit;
if (jf < Eh && jf > -Eh) {
var kf = !1;
break a;
}
}
kf = !0;
}
if (
kf &&
(nc > a.graduatedMax && (nc = a.graduatedMax),
null === mc.graduatedSkip ||
(mc instanceof Qg && !mc.graduatedSkip(nc, mc)) ||
(mc instanceof Cf && !mc.graduatedSkip(nc, mc))) &&
((lc = ((nc - a.graduatedMin) * v) / a.graduatedRange),
lc > v && (lc = v),
fc <= lc && lc <= gf)
) {
for (var Od = B[Bd][gc], Le = w[Bd][gc]; Bd < w.length; ) {
for (; lc > sg && gc < w[Bd].length - 1; )
gc++, (Od = B[Bd][gc]), (Le = w[Bd][gc]), (sg += Le);
if (lc <= sg) break;
Bd++;
gc = 0;
Od = B[Bd][gc];
Le = w[Bd][gc];
sg += Le;
}
var hc = u[Bd],
Cd = hc[2 * gc],
nk = hc[2 * gc + 1],
ne = (lc - (sg - Le)) / Le,
Fh = new I(
Cd + (hc[2 * gc + 2] - Cd) * ne + q / 2 - r.bounds.x,
nk + (hc[2 * gc + 3] - nk) * ne + q / 2 - r.bounds.y,
);
Fh.scale(h.scale, h.scale);
a: {
var qd = Od,
Nf = B[Bd];
if (!(0.5005 > ne && 0.4995 < ne)) {
var Dd = qd;
0.5 > ne
? 0 < gc
? (Dd = Nf[gc - 1])
: J.ca(hc[0], hc[hc.length - 2]) &&
J.ca(hc[1], hc[hc.length - 1]) &&
(Dd = Nf[Nf.length - 1])
: 0.5 < ne &&
(gc + 1 < Nf.length
? (Dd = Nf[gc + 1])
: J.ca(hc[0], hc[hc.length - 2]) &&
J.ca(hc[1], hc[hc.length - 1]) &&
(Dd = Nf[0]));
if (qd !== Dd) {
var ug = Math.abs(qd - Dd);
180 < ug &&
(qd < Dd ? (qd += 360) : (Dd += 360),
(ug = Math.abs(qd - Dd)));
if (5e-4 > ne || 0.9995 < ne) {
Od = ((qd + Dd) / 2) % 360;
break a;
}
if (10 > ug) {
var Gh = 1 - Math.abs(0.5 - ne);
Od = (qd * Gh + Dd * (1 - Gh)) % 360;
break a;
}
}
}
Od = qd;
}
if (mc instanceof Qg) {
var bd = '';
null !== mc.graduatedFunction
? ((bd = mc.graduatedFunction(nc, mc)),
(bd = null !== bd && void 0 !== bd ? bd.toString() : ''))
: (bd = (+nc.toFixed(2)).toString());
'' !== bd &&
pd.push({
Hl: Fh,
angle: Od,
text: bd,
});
} else
pd.push({
Hl: Fh,
angle: Od,
});
}
nc = Ii + Nd * Mf;
}
}
}
a.graduatedMarks.push(pd);
}
Ga(B);
var ib = a.graduatedMarks;
if (null !== ib)
for (var Ji = d.length, Vb = 0; Vb < Ji; Vb++) {
var Va = d[Vb],
Wb = ib[Vb];
if (Va.visible && Va !== h && 0 !== Wb.length) {
if (Va instanceof Cf) {
var oe = a,
Me = e,
Of = Va.alignmentFocus;
Of.Fc() && (Of = uc);
var Ln = Va.angle;
Va.Gb = 0;
Va.measure(Infinity, Infinity, 0, 0);
Va.Gb = Ln;
var ok = Va.measuredBounds,
Hh = ok.width,
Pf = ok.height,
vg = M.allocAt(0, 0, Hh, Pf),
ic = I.alloc();
ic.oi(vg, Of);
M.free(vg);
for (
var Ed = -ic.x, rd = -ic.y, Fc = new M(), lf = Wb.length, Ih = 0;
Ih < lf;
Ih++
)
for (
var mf = Wb[Ih],
pk = mf.Hl.x,
Jh = mf.Hl.y,
Oa = mf.angle,
cd = 0;
4 > cd;
cd++
) {
switch (cd) {
case 0:
ic.h(Ed, rd);
break;
case 1:
ic.h(Ed + Hh, rd);
break;
case 2:
ic.h(Ed, rd + Pf);
break;
case 3:
ic.h(Ed + Hh, rd + Pf);
}
ic.rotate(Oa + Va.angle);
ic.offset(pk, Jh);
0 === Ih && 0 === cd ? Fc.h(ic.x, ic.y, 0, 0) : Fc.Me(ic);
ic.offset(-pk, -Jh);
ic.rotate(-Oa - Va.angle);
}
I.free(ic);
null !== oe.graduatedBounds && oe.graduatedBounds.push(Fc);
Zb(Me, Fc.x, Fc.y, Fc.width, Fc.height);
} else if (Va instanceof Qg) {
var Sc = a,
qk = e;
null === Sc.temporaryTextBlock &&
(Sc.temporaryTextBlock = new Qg());
var oc = Sc.temporaryTextBlock;
Sm(oc, Va);
var Ne = Va.alignmentFocus;
Ne.Fc() && (Ne = uc);
for (
var Tc = Va.segmentOrientation,
Kh = Va.segmentOffset,
nf = new M(),
Ki = 0,
Lh = 0,
Fd = 0,
Qf = 0,
of = 0,
Mh = Wb.length,
Oe = 0;
Oe < Mh;
Oe++
) {
var Pd = Wb[Oe];
Ki = Pd.Hl.x;
Lh = Pd.Hl.y;
Fd = Pd.angle;
of = Qf = Va.angle;
Tc !== $f &&
((of = Tc === Tm || Tc === Um ? Fd + Va.angle : Fd),
(Qf = T.computeAngle(Tc, of)));
oc.Gb = Qf;
oc.text = Pd.text || '';
oc.measure(Infinity, Infinity, 0, 0);
var Pe = oc.measuredBounds,
pe = oc.naturalBounds,
Qe = pe.width,
Rf = pe.height,
sd = md.alloc();
sd.reset();
sd.translate(-Pe.x, -Pe.y);
sd.scale(oc.scale, oc.scale);
sd.rotate(of, Qe / 2, Rf / 2);
(Tc !== Mm && Tc !== Nm) || sd.rotate(90, Qe / 2, Rf / 2);
(Tc !== Om && Tc !== Pm) || sd.rotate(-90, Qe / 2, Rf / 2);
Tc === Qm &&
((45 < Fd && 135 > Fd) || (225 < Fd && 315 > Fd)) &&
sd.rotate(-Fd, Qe / 2, Rf / 2);
var wg = M.allocAt(0, 0, Qe, Rf),
Re = I.alloc();
Re.oi(wg, Ne);
sd.Fa(Re);
var xg = -Re.x,
Mn = -Re.y,
qe = I.alloc();
qe.assign(Kh);
isNaN(qe.x) && (qe.x = Qe / 2 + 3);
isNaN(qe.y) && (qe.y = -(Rf / 2 + 3));
qe.rotate(Fd);
Ki += qe.x + xg;
Lh += qe.y + Mn;
var Sf = new M(Ki, Lh, Pe.width, Pe.height),
Li = new M(Pe.x, Pe.y, Pe.width, Pe.height),
Nn = new M(pe.x, pe.y, pe.width, pe.height);
Pd.Az = Qf;
Pd.lineCount = oc.lineCount;
Pd.lines = [oc.yb, oc.zh, oc.Te, oc.Ae, oc.Jc, oc.Wb, oc.qe];
Pd.actualBounds = Sf;
Pd.measuredBounds = Li;
Pd.naturalBounds = Nn;
0 === Oe ? nf.assign(Sf) : nf.Xc(Sf);
I.free(qe);
I.free(Re);
M.free(wg);
md.free(sd);
}
null !== Sc.graduatedBounds && Sc.graduatedBounds.push(nf);
Zb(qk, nf.x, nf.y, nf.width, nf.height);
}
ij(Va, !1);
}
}
};
Rm.prototype.arrange = function(a, b, c) {
if (null !== a.graduatedBounds) {
var d = a.vb(),
e = a.graduatedMarks;
if (null !== e) {
var f = a.graduatedBounds,
g = 0,
h = f[g];
g++;
null !== d && 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.graduatedBounds = null;
}
}
};
Rm.prototype.tc = function(a, b, c) {
var d = c.Vi;
c.Vi = !0;
var e = a.naturalBounds,
f = e.width;
e = e.height;
b.save();
b.beginPath();
b.rect(-1, -1, f + 1, e + 1);
b.clip();
f = a.vb();
f.tc(b, c);
e = a.uf() * c.scale;
0 >= e && (e = 1);
for (
var g = f.actualBounds,
h = a.R.s,
k = a.graduatedMarks,
l = h.length,
m = 0;
m < l;
m++
) {
var n = h[m],
p = k[m],
r = p.length;
if (n.visible && n !== f && 0 !== p.length)
if (n instanceof Cf) {
if (
!(
2 >
((a.graduatedTickUnit *
n.interval *
f.geometry.flattenedTotalLength) /
a.graduatedRange) *
e && null === n.graduatedSkip
)
) {
var q = n.measuredBounds,
u = n.strokeWidth * n.scale,
w = n.alignmentFocus;
w.Fc() && (w = uc);
for (var v = 0; v < r; v++) {
var z = p[v].Hl,
y = p[v].angle,
A = w,
B = n.Bb;
B.reset();
B.translate(z.x + g.x, z.y + g.y);
B.rotate(y + n.angle, 0, 0);
B.translate(
-q.width * A.x + A.offsetX + u / 2,
-q.height * A.y + A.offsetY + u / 2,
);
B.scale(n.scale, n.scale);
yl(n, !1);
n.lh.set(n.Bb);
n.yk = n.scale;
zl(n, !1);
n.tc(b, c);
n.Bb.reset();
}
}
} else if (n instanceof Qg)
for (
null === a.temporaryTextBlock && (a.temporaryTextBlock = new Qg()),
q = a.temporaryTextBlock,
Sm(q, n),
n = 0;
n < r;
n++
)
(u = p[n]),
u.actualBounds &&
u.measuredBounds &&
u.naturalBounds &&
((q.cc = u.text || ''),
(q.Gb = u.Az || 0),
(q.dd = u.lineCount || 0),
(w = u.lines),
void 0 !== w &&
((q.yb = w[0]),
(q.zh = w[1]),
(q.Te = w[2]),
(q.Ae = w[3]),
(q.Jc = w[4]),
(q.Wb = w[5]),
(q.qe = w[6])),
u.naturalBounds && (q.bc = u.naturalBounds),
u.actualBounds &&
((w = u.actualBounds),
q.arrange(w.x, w.y, w.width, w.height)),
(w = u.actualBounds),
q.arrange(w.x, w.y, w.width, w.height),
(v = u.measuredBounds),
(u = u.naturalBounds),
(z = q.Bb),
z.reset(),
z.translate(w.x + g.x, w.y + g.y),
z.translate(-v.x, -v.y),
q.Qn(z, u.x, u.y, u.width, u.height),
yl(q, !1),
q.lh.set(q.Bb),
(q.yk = q.scale),
zl(q, !1),
q.tc(b, c));
}
c.Vi = d;
b.restore();
b.Oc(!0);
};
function W(a, b) {
Y.call(this);
this.qa = null;
if (void 0 === a) this.qa = W.Position;
else if ('string' === typeof a) {
var c = Kl.I(a);
null !== c && (this.qa = c);
} else
a instanceof Ll ? (this.qa = a) : a && ((this.qa = W.Position), (b = a));
null === this.qa &&
C('Panel type not specified or PanelLayout not loaded: ' + a);
this.o = this.o | 4194304 | (this.qa === W.Grid ? 1048576 : 0);
this.R = new E();
this.ub = qc;
this.Bm = Wc;
this.Kf = Xk;
this.Qg = null;
this.Pe = '';
this.bg = new M(NaN, NaN, NaN, NaN);
this.T = this.F = null;
this.$n = ng;
this.Qm = Kb;
this.Rm = qb;
this.qb = this.oa = null;
this.fn = NaN;
this.$d = this.xh = null;
b && Object.assign(this, b);
}
la(W, Y);
W.prototype.cloneProtected = function(a) {
Y.prototype.cloneProtected.call(this, a);
a.qa = this.qa;
a.ub = this.ub.J();
a.Bm = this.Bm.J();
a.Kf = this.Kf;
a.Pe = this.Pe;
a.bg.assign(this.bg);
null !== this.T && (a.T = this.T.copy(a));
a.$n = this.$n;
a.Qm = this.Qm.J();
a.Rm = this.Rm.J();
null !== this.oa && (a.oa = this.oa.copy());
a.qb = this.qb;
a.fn = this.fn;
a.xh = this.xh;
};
W.prototype.qf = function(a) {
Y.prototype.qf.call(this, a);
a.R = this.R;
for (var b = a.R.s, c = b.length, d = 0; d < c; d++) b[d].Uf = a;
a.Qg = null;
};
W.prototype.copy = function() {
var a = Y.prototype.copy.call(this);
if (null !== a) {
for (var b = this.R.s, c = b.length, d = 0; d < c; d++) {
var e = b[d].copy();
e.ni(a);
e.jj = null;
var f = a.R,
g = f.count;
f.Cb(g, e);
f = a.part;
if (null !== f) {
f.Kh = null;
null !== e.portId && f instanceof V && (f.He = !0);
var h = a.diagram;
(null !== h && h.undoManager.isUndoingRedoing) ||
f.bb(fe, 'elements', a, null, e, null, g);
}
}
return a;
}
return null;
};
t = W.prototype;
t.toString = function() {
return 'Panel(' + this.type.name + ')#' + cb(this);
};
t.wn = function(a) {
Y.prototype.wn.call(this, a);
for (var b = this.R.s, c = b.length, d = 0; d < c; d++) b[d].wn(a);
};
t.ai = function(a, b) {
if (this.qa === W.Grid) a.Pc(), this.qa.tc(this, a, b);
else if (this.qa === W.Graduated) a.Pc(), this.qa.tc(this, a, b);
else {
if (this.qa === W.Table) {
a.Pc();
a.lineCap = 'butt';
var c = 0 < this.rowCount ? this.rowDefs : null,
d = 0 < this.columnCount ? this.colDefs : null;
null !== c && Vm(this, a, !0, c, !0);
null !== d && Vm(this, a, !1, d, !0);
null !== c && Wm(this, a, !0, c);
null !== d && Wm(this, a, !1, d);
null !== c && Vm(this, a, !0, c, !1);
null !== d && Vm(this, a, !1, d, !1);
}
(c = this.isClipping && this.qa === W.Spot) && a.save();
d = this.vb();
for (var e = this.R.s, f = e.length, g = 0; g < f; g++) {
var h = e[g];
c && h === d && (a.clipInsteadOfFill = !0);
h.tc(a, b);
c && h === d && (a.clipInsteadOfFill = !1);
}
c && (a.restore(), a.Oc(!0));
}
};
function Wm(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 && 0 !== l.actual)
if (h) h = !1;
else {
if (c) {
if (l.position > f.height) continue;
} else if (l.position > f.width) continue;
var m = l.separatorStrokeWidth;
isNaN(m) &&
(m = c
? a.defaultRowSeparatorStrokeWidth
: a.defaultColumnSeparatorStrokeWidth);
var n = l.separatorStroke;
null === n &&
(n = c
? a.defaultRowSeparatorStroke
: a.defaultColumnSeparatorStroke);
if (0 !== m && null !== n) {
gi(a, b, n, !1, !1, g, f);
n = !1;
var p = l.separatorDashArray;
null === p &&
(p = c
? a.defaultRowSeparatorDashArray
: a.defaultColumnSeparatorDashArray);
null !== p && ((n = !0), b.Gr(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.ub;
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.Er();
}
}
}
}
function Vm(a, b, c, d, e) {
for (
var f = d.length,
g = a.actualBounds,
h = a.naturalBounds,
k = Xm(a, !0),
l = Xm(a, !1),
m = 0;
m < f;
m++
) {
var n = d[m];
if (
void 0 !== n &&
null !== n.background &&
n.coversSeparators !== e &&
0 !== n.actual
) {
var p = c ? g.height : g.width;
if (!(n.position > p)) {
var r = n.Qc(),
q = n.separatorStrokeWidth;
isNaN(q) &&
(q = c
? a.defaultRowSeparatorStrokeWidth
: a.defaultColumnSeparatorStrokeWidth);
var u = n.separatorStroke;
null === u &&
(u = c
? a.defaultRowSeparatorStroke
: a.defaultColumnSeparatorStroke);
if (null === u || n.index === (c ? k : l)) q = 0;
r -= q;
q = n.position + q;
r += n.actual;
q + r > p && (r = p - q);
0 >= r ||
((p = a.ub),
gi(a, b, n.background, !0, !1, h, g),
c
? b.fillRect(p.left, q + p.top, g.width - (p.left + p.right), r)
: b.fillRect(
q + p.left,
p.top,
r,
g.height - (p.top + p.bottom),
));
}
}
}
}
function Xm(a, b) {
for (var c = b ? a.rowCount : a.columnCount, d = 0; d < c; d++) {
var e = b ? a.rowDefs[d] : a.colDefs[d];
if (void 0 !== e) return e.index;
}
return 0;
}
function Sj(a) {
return 'LineV' === a || 'BarV' === a;
}
t.Kj = function(a, b, c, d, e) {
var f = this.ke(),
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),
J.wf(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 = J.wf(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.R.s;
r = n.length;
m = I.alloc();
p = null;
b = Infinity;
var q = null,
u = this.isClipping && this.qa === W.Spot;
u &&
((q = I.alloc()),
(p = this.vb()),
(l = p.Kj(h, a, k, c, q)) &&
(b = (h - q.x) * (h - q.x) + (a - q.y) * (a - q.y)));
for (var w = 0; w < r; w++) {
var v = n[w];
v.visible &&
v !== p &&
v.Kj(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)));
}
u && (b > d && e.set(q), I.free(q));
I.free(m);
f && e.transform(g);
return l;
};
t.w = function(a) {
if (!nj(this)) {
Y.prototype.w.call(this, a);
a = null;
if (this.qa === W.Auto || this.qa === W.Link) a = this.vb();
for (var b = this.R.s, c = b.length, d = 0; d < c; d++) {
var e = b[d];
(e === a || e.isPanelMain) && e.w(!0);
if (!e.desiredSize.v()) {
var f = il(e, !1);
(e instanceof jg || e instanceof W || e instanceof Qg || f !== lg) &&
e.w(!0);
}
}
}
};
t.Mj = function() {
if (!nj(this)) {
ij(this, !0);
jl(this, !0);
for (var a = this.R.s, b = a.length, c = 0; c < b; c++) a[c].Mj();
}
};
t.Jk = function() {
if ((0 !== (this.o & 2048)) === !1) {
yl(this, !0);
zl(this, !0);
for (var a = this.R.s, b = a.length, c = 0; c < b; c++) a[c].Iu();
}
};
t.Iu = function() {
zl(this, !0);
for (var a = this.R.s, b = a.length, c = 0; c < b; c++) a[c].Iu();
};
t.El = function(a, b, c, d) {
var e = this.bg;
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.ub;
a = Math.max(a - k.left - k.right, 0);
b = Math.max(b - k.top - k.bottom, 0);
var l = this.R.s;
0 !== l.length && this.qa.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);
Qb(e, a, k);
Qb(this.naturalBounds, a, k);
this.ve(0, 0, a, k);
};
t.vb = function() {
if (null === this.Qg) {
var a = this.R.s,
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.Qg = d);
}
this.Qg = a[0];
}
return this.Qg;
};
function um(a) {
return null !== a.part ? a.part.locationObject : null;
}
t.Vg = function(a, b, c, d) {
var e = this.R.s;
this.actualBounds.h(a, b, c, d);
if (0 !== e.length) {
if (!this.desiredSize.v()) {
a = il(this, !0);
var f = this.measuredBounds;
b = f.width;
f = f.height;
var g = this.Ag,
h = g.left + g.right;
g = g.top + g.bottom;
b === c && f === d && (a = lg);
switch (a) {
case lg:
if (b > c || f > d)
this.w(), this.measure(b > c ? c : b, f > d ? d : f, 0, 0);
break;
case td:
this.w(!0);
this.measure(c + h, d + g, 0, 0);
break;
case Vk:
this.w(!0);
this.measure(c + h, f + g, 0, 0);
break;
case Wk:
this.w(!0), this.measure(b + h, d + g, 0, 0);
}
}
this.qa.arrange(this, e, this.bg);
}
};
t.Xg = function(a) {
var b = this.naturalBounds,
c = um(this);
if ($b(0, 0, b.width, b.height, a.x, a.y)) {
b = this.R.s;
for (var d = b.length, e = I.allocAt(0, 0); d--; ) {
var f = b[d];
if (f.visible || f === c)
if ((yb(e.set(a), f.transform), f.ba(e))) return I.free(e), !0;
}
I.free(e);
return null === this.Yb && null === this.areaBackground ? !1 : !0;
}
return !1;
};
t.Hr = function(a) {
if (this.bindingId === a) return this;
for (var b = this.R.s, c = b.length, d = 0; d < c; d++) {
var e = b[d].Hr(a);
if (null !== e) return e;
}
return null;
};
t.$l = function(a, b) {
b(this, a);
if (a instanceof W) {
a = a.R.s;
for (var c = a.length, d = 0; d < c; d++) this.$l(a[d], b);
}
};
function Aj(a, b) {
Ym(a, a, b);
}
function Ym(a, b, c) {
c(b);
b = b.R.s;
for (var d = b.length, e = 0; e < d; e++) {
var f = b[e];
f instanceof W && Ym(a, f, c);
}
}
function Zm(a, b) {
$m(a, a, b);
}
function $m(a, b, c) {
c(b);
if (b instanceof W) {
b = b.R.s;
for (var d = b.length, e = 0; e < d; e++) $m(a, b[e], c);
}
}
t.vl = function(a) {
return an(this, this, a);
};
function an(a, b, c) {
if (c(b)) return b;
if (b instanceof W) {
b = b.R.s;
for (var d = b.length, e = 0; e < d; e++) {
var f = an(a, b[e], c);
if (null !== f) return f;
}
}
return null;
}
t.fb = function(a) {
if (this.name === a) return this;
var b = this.R.s,
c = b.length;
(null === this.xh && null === this.itemTemplateMap) || (c = bn(this));
for (var d = 0; d < c; d++) {
var e = b[d];
if (e instanceof W) {
var f = e.fb(a);
if (null !== f) return f;
}
if (e.name === a) return e;
}
return null;
};
function cn(a) {
a = a.R.s;
for (var b = a.length, c = 0, d = 0; d < b; d++) {
var e = a[d];
e instanceof W
? (c = Math.max(c, cn(e)))
: e instanceof Cf &&
(c = Math.max(c, (e.ag / 2) * e.strokeMiterLimit * e.uf()));
}
return c;
}
t.ke = function() {
return !(this.type === W.TableRow || this.type === W.TableColumn);
};
t.ec = function(a, b, c) {
if (!1 === this.pickable) return null;
void 0 === b && (b = null);
void 0 === c && (c = null);
if (oj(this)) return null;
var d = this.naturalBounds,
e = 1 / this.uf(),
f = this.ke(),
g = f ? a : yb(I.allocAt(a.x, a.y), this.transform),
h = this.diagram,
k = 10,
l = 5;
null !== h && ((k = h.yl('extraTouchArea')), (l = k / 2));
if ($b(-(l * e), -(l * e), d.width + k * e, d.height + k * e, g.x, g.y)) {
if (!this.isAtomic) {
e = this.R.s;
var m = e.length;
h = I.alloc();
l = (k = this.isClipping && this.qa === W.Spot) ? this.vb() : null;
if (k && (l.ke() ? yb(h.set(a), l.transform) : h.set(a), !l.ba(h)))
return I.free(h), f || I.free(g), null;
for (var n = um(this); m--; ) {
var p = e[m];
if (p.visible || p === n)
if (
(p.ke() ? yb(h.set(a), p.transform) : h.set(a), !k || p !== l)
) {
var r = null;
p instanceof W
? (r = p.ec(h, b, c))
: !0 === p.pickable && p.ba(h) && (r = p);
if (
null !== r &&
(null !== b && (r = b(r)), null !== r && (null === c || c(r)))
)
return I.free(h), f || I.free(g), r;
}
}
I.free(h);
}
if (null === this.background && null === this.areaBackground)
return f || I.free(g), null;
a = $b(0, 0, d.width, d.height, g.x, g.y) ? this : null;
f || I.free(g);
return a;
}
f || I.free(g);
return null;
};
t.di = 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.ke(),
g = f ? a : yb(I.allocAt(a.x, a.y), this.transform);
e = $b(0, 0, e.width, e.height, g.x, g.y);
if (this.type === W.TableRow || this.type === W.TableColumn || e) {
if (!this.isAtomic) {
for (
var h = this.R.s, k = h.length, l = I.alloc(), m = um(this);
k--;
) {
var n = h[k];
if (n.visible || n === m) {
n.ke() ? yb(l.set(a), n.transform) : l.set(a);
var p = n;
n = n instanceof W ? n : null;
(null !== n ? n.di(l, b, c, d) : p.ba(l)) &&
!1 !== p.pickable &&
(null !== b && (p = b(p)),
null === p || (null !== c && !c(p)) || d.add(p));
}
}
I.free(l);
}
f || I.free(g);
return e && (null !== this.background || null !== this.areaBackground);
}
f || I.free(g);
return !1;
};
t.tf = 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 = md.alloc()), g.reset());
g.multiply(this.transform);
if (this.Wg(a, g)) return dn(this, b, c, e), void 0 === f && md.free(g), !0;
if (this.Sc(a, g)) {
if (!this.isAtomic)
for (var h = um(this), k = this.R.s, 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 W ? m : null;
p = md.alloc();
p.set(g);
if (null !== m ? m.tf(a, b, c, d, e, p) : hl(n, a, d, p))
null !== b && (n = b(n)),
null === n || (null !== c && !c(n)) || e.add(n);
md.free(p);
}
}
}
void 0 === f && md.free(g);
return d;
}
void 0 === f && md.free(g);
return !1;
};
function dn(a, b, c, d) {
for (var e = a.R.s, 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 W && dn(g, b, c, d),
null !== b && (g = b(g)),
null === g || (null !== c && !c(g)) || d.add(g));
}
}
}
t.hg = 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.ke(),
k = h ? a : yb(I.allocAt(a.x, a.y), this.transform),
l = h ? b : yb(I.allocAt(b.x, b.y), this.transform),
m = k.rf(l),
n =
(0 < k.x && k.x < g.width && 0 < k.y && k.y < g.height) ||
zb(k.x, k.y, 0, 0, 0, g.height) <= m ||
zb(k.x, k.y, 0, g.height, g.width, g.height) <= m ||
zb(k.x, k.y, g.width, g.height, g.width, 0) <= m ||
zb(k.x, k.y, g.width, 0, 0, 0) <= m;
g =
k.td(0, 0) <= m &&
k.td(0, g.height) <= m &&
k.td(g.width, 0) <= m &&
k.td(g.width, g.height) <= m;
h || (I.free(k), I.free(l));
if (n) {
if (!this.isAtomic) {
k = I.alloc();
l = I.alloc();
m = um(this);
for (var p = this.R.s, r = p.length; r--; ) {
var q = p[r];
if (q.visible || q === m) {
var u = q.actualBounds,
w = this.naturalBounds;
if (
!h ||
!(
u.x > w.width ||
u.y > w.height ||
0 > u.x + u.width ||
0 > u.y + u.height
)
)
if (
(q.ke()
? ((u = q.transform), yb(k.set(a), u), yb(l.set(b), u))
: (k.set(a), l.set(b)),
(u = q),
(q = q instanceof W ? q : null),
null !== q ? q.hg(k, l, c, d, e, f) : u.Vw(k, l, e))
)
null !== c && (u = c(u)),
null === u || (null !== d && !d(u)) || f.add(u);
}
}
I.free(k);
I.free(l);
}
return e ? n : g;
}
return !1;
};
function Am(a) {
var b = null;
a instanceof Cf &&
((b = a.spot1),
b === Wc && (b = null),
(a = a.geometry),
null !== a && null === b && (b = a.spot1));
null === b && (b = tc);
return b;
}
function Bm(a) {
var b = null;
a instanceof Cf &&
((b = a.spot2),
b === Wc && (b = null),
(a = a.geometry),
null !== a && null === b && (b = a.spot2));
null === b && (b = Cc);
return b;
}
t.add = function(a) {
for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
for (c = 0; c < b.length; c++) this.Cb(this.R.count, b[c]);
return this;
};
t.K = function(a) {
return this.R.K(a);
};
t.Cb = function(a, b) {
b instanceof U &&
C('Cannot add a Part to a Panel: ' + b + '; use a Panel instead');
if (this === b || this.jg(b))
this === b && C('Cannot make a Panel contain itself: ' + this.toString()),
C(
'Cannot make a Panel indirectly contain itself: ' +
this.toString() +
' already contains ' +
b.toString(),
);
var c = b.panel;
null !== c &&
c !== this &&
C(
'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.qa !== W.Grid ||
b instanceof Cf ||
C('Can only add Shapes to a Grid Panel, not: ' + b);
this.qa !== W.Graduated ||
b instanceof Cf ||
b instanceof Qg ||
C('Can only add Shapes or TextBlocks to a Graduated Panel, not: ' + b);
b.ni(this);
b.jj = null;
if (null !== this.itemArray) {
var d = b.data;
null !== d &&
'object' === typeof d &&
(null === this.$d && (this.$d = new pb()), this.$d.add(d, b));
}
var e = this.R;
d = -1;
if (c === this) {
for (var f = -1, g = this.R.s, 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
C(
'element ' +
b.toString() +
' has panel ' +
c.toString() +
' but is not contained by it.',
);
}
if (0 > a || a > e.count) a = e.count;
e.Cb(a, b);
if (0 === a || b.isPanelMain) this.Qg = null;
nj(this) || this.w();
b.w(!1);
null !== b.portId
? (this.He = !0)
: b instanceof W && !0 === b.He && (this.He = !0);
this.graduatedIntervals = null;
this.yf() || en(this, b, !1);
c = this.part;
null !== c &&
((c.Kh = null),
(c.Sf = NaN),
this.He && c instanceof V && (c.He = !0),
c.He && c instanceof V && (c.sc = null),
(e = this.diagram),
(null !== e && e.undoManager.isUndoingRedoing) ||
(-1 !== d && c.bb(ge, 'elements', this, b, null, d, null),
c.bb(fe, 'elements', this, null, b, null, a)));
};
function fn(a, b) {
a.o = b ? a.o | 16777216 : a.o & -16777217;
}
t.remove = function(a) {
for (var b = this.R.s, c = b.length, d = -1, e = 0; e < c; e++)
if (b[e] === a) {
d = e;
break;
}
-1 !== d && this.lc(d, !0);
};
t.mb = function(a) {
0 <= a && this.lc(a, !0);
};
t.lc = function(a, b) {
var c = this.R,
d = c.K(a);
d.jj = null;
d.ni(null);
if (null !== this.$d) {
var e = d.data;
'object' === typeof e && this.$d.remove(e);
}
c.mb(a);
ij(this, !1);
this.w();
this.Qg === d && (this.Qg = null);
this.graduatedIntervals = null;
var f = this.part;
null !== f &&
((f.Kh = null),
(f.Sf = NaN),
f.Rb(),
f instanceof V &&
(d instanceof W
? d.$l(d, function(a, c) {
Ql(f, c, b);
})
: Ql(f, d, b)),
(c = this.diagram),
(null !== c && c.undoManager.isUndoingRedoing) ||
f.bb(ge, 'elements', this, d, null, a, null));
};
W.prototype.getRowDefinition = function(a) {
0 > a && wa(a, '>= 0', W, 'getRowDefinition:idx');
a = Math.round(a);
var b = this.rowDefs;
if (void 0 === b[a]) {
var c = new Oj();
c.ni(this);
c.isRow = !0;
c.index = a;
b[a] = c;
this.bb(fe, 'rowdefs', this, null, c, null, a);
}
return b[a];
};
W.prototype.Vz = function(a) {
0 > a && wa(a, '>= 0', W, 'removeRowDefinition:idx');
if (0 !== this.rowCount) {
a = Math.round(a);
var b = this.rowDefs,
c = b[a];
if (c) {
b[a] = void 0;
for (var d = b.length - 1; 0 <= d && void 0 === b[d--]; ) b.length--;
this.bb(ge, 'rowdefs', this, c, null, a, null);
this.w();
}
}
};
function Pj(a, b, c) {
var d = a.rowDefs;
if (!(0 > b)) {
d[b] = c instanceof Oj ? c : void 0;
if (!c) for (b = d.length - 1; 0 <= b && void 0 === d[b--]; ) d.length--;
a.w();
}
}
W.prototype.getColumnDefinition = function(a) {
0 > a && wa(a, '>= 0', W, 'getColumnDefinition:idx');
a = Math.round(a);
var b = this.colDefs;
if (void 0 === b[a]) {
var c = new Oj();
c.ni(this);
c.isRow = !1;
c.index = a;
b[a] = c;
this.bb(fe, 'coldefs', this, null, c, null, a);
}
return b[a];
};
t = W.prototype;
t.Qz = function(a) {
0 > a && wa(a, '>= 0', W, 'removeColumnDefinition:idx');
if (0 !== this.columnCount) {
a = Math.round(a);
var b = this.colDefs,
c = b[a];
if (c) {
b[a] = void 0;
for (var d = b.length - 1; 0 <= d && void 0 === b[d--]; ) b.length--;
this.bb(ge, 'coldefs', this, c, null, a, null);
this.w();
}
}
};
function Qj(a, b, c) {
var d = a.colDefs;
if (!(0 > b)) {
d[b] = c instanceof Oj ? c : void 0;
if (!c) for (b = d.length - 1; 0 <= b && void 0 === d[b--]; ) d.length--;
a.w();
}
}
t.Wy = function(a) {
if (0 > a || this.type !== W.Table || 0 === this.rowCount) return -1;
for (
var b = 0, c = this.rowDefs, d = c.length, e = this.topIndex;
e < d;
e++
) {
var f = c[e];
if (void 0 !== f && ((b += f.total), a < b)) break;
}
return e;
};
t.Oy = function(a) {
if (0 > a || this.type !== W.Table || 0 === this.columnCount) return -1;
for (
var b = 0, c = this.colDefs, d = c.length, e = this.leftIndex;
e < d;
e++
) {
var f = c[e];
if (void 0 !== f && ((b += f.total), a < b)) break;
}
return e;
};
t.mz = function(a, b) {
void 0 === b && (b = new I(NaN, NaN));
if (this.type !== W.Graduated) return b.h(NaN, NaN), b;
a = Math.min(Math.max(a, this.graduatedMin), this.graduatedMax);
var c = this.vb();
c.geometry.Bu((a - this.graduatedMin) / this.graduatedRange, b);
return c.transform.Fa(b);
};
t.nz = function(a) {
if (this.type !== W.Graduated) return NaN;
var b = this.vb();
b.transform.Ld(a);
return b.geometry.Zw(a) * this.graduatedRange + this.graduatedMin;
};
function Gl(a) {
a = a.allBindings;
return null !== a && a._isFrozen;
}
function kg(a) {
var b = a.allBindings;
if (null === b)
null !== a.data && C('Template cannot have .data be non-null: ' + a),
(a.allBindings = b = new E());
else if (b._isFrozen) return;
var c = new E();
fn(a, !1);
a.$l(a, function(a, d) {
d.ih();
var e = d.localBindings;
if (null !== e)
for (Dl(d, !1), e = e.iterator; e.next(); ) {
var f = e.value;
f.mode === gn && Dl(d, !0);
var g = f.sourceName;
null !== g &&
('/' === g && fn(a, !0),
(g = gl(f, a, d)),
null !== g &&
(c.add(g),
null === g.srcBindings && (g.srcBindings = new E()),
g.srcBindings.add(f)));
b.add(f);
}
if (d instanceof W && d.type === W.Table) {
if (0 < d.rowCount)
for (a = d.rowDefs, e = a.length, f = 0; f < e; f++)
if (((g = a[f]), void 0 !== g && null !== g.Vd))
for (var h = g.Vd.iterator; h.next(); ) {
var k = h.value;
k.sd = g;
k.Wn = 2;
k.ll = g.index;
b.add(k);
}
if (0 < d.columnCount)
for (d = d.colDefs, a = d.length, e = 0; e < a; e++)
if (((f = d[e]), void 0 !== f && null !== f.Vd))
for (g = f.Vd.iterator; g.next(); )
(h = g.value),
(h.sd = f),
(h.Wn = 1),
(h.ll = f.index),
b.add(h);
}
});
for (var d = c.iterator; d.next(); ) {
var e = d.value;
if (null !== e.srcBindings) {
Dl(e, !0);
for (var f = e.srcBindings.iterator; f.next(); ) {
var g = f.value;
null === e.localBindings && (e.localBindings = new E());
e.localBindings.add(g);
}
}
e.srcBindings = null;
}
for (d = b.iterator; d.next(); )
if (((e = d.value), (f = e.sd), null !== f)) {
e.sd = null;
var h = e.targetProperty,
k = h.indexOf('.');
0 < k &&
f instanceof W &&
((g = h.substring(0, k)),
(h = h.substr(k + 1)),
(k = f.fb(g)),
null !== k
? ((f = k), (e.targetProperty = h))
: xa(
'Warning: unable to find GraphObject named "' +
g +
'" for Binding: ' +
e.toString(),
));
f instanceof Oj
? ((g = cb(f.panel)),
(e.ti = void 0 === g ? -1 : g),
(f.panel.bindingId = e.ti))
: f instanceof Y
? ((g = cb(f)), (e.ti = void 0 === g ? -1 : g), (f.bindingId = e.ti))
: C('Unknown type of binding target: ' + f);
}
b.freeze();
a instanceof U && a.Tc() && a.Za();
}
t.By = function(a) {
void 0 === a && (a = !1);
var b = this.copy();
Zm(b, function(a) {
a instanceof W && ((a.allBindings = null), (a.qb = null));
var b = a.localBindings;
null !== b &&
((a.localBindings = null),
b.each(function(b) {
a.bind(b.copy());
}));
b = a.animationTriggers;
null !== b &&
((a.animationTriggers = null),
b.each(function(b) {
a.mv(b.value.copy());
}));
});
a && kg(b);
return b;
};
t.Ka = function(a) {
var b = this.allBindings;
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)
if ('' === e) d = this;
else if ('/' === e) d = this;
else if ('.' === e) d = this;
else if ('..' === e) d = this;
else {
if (((d = this.fb(e)), null === d)) continue;
}
else if (c.isToModel)
if (((d = this.diagram), null !== d)) d = d.model.modelData;
else continue;
var f = this,
g = c.ti;
if (-1 !== g) {
if (((f = this.Hr(g)), null === f)) continue;
} else null !== c.sd && (f = c.sd);
'/' === e
? (d = f.part)
: '.' === e
? (d = f)
: '..' === e && (d = f.panel);
e = c.Wn;
if (0 !== e) {
if (!(f instanceof W)) continue;
1 === e
? (f = f.getColumnDefinition(c.ll))
: 2 === e && (f = f.getRowDefinition(c.ll));
}
void 0 !== f && c.pv(f, d);
}
}
};
t.Uw = function(a) {
return void 0 === a || null === a || null === this.$d ? null : this.$d.I(a);
};
function hn(a, b) {
a = a.R.s;
for (
var c = a.length, d = b.length, e = 0, f = null;
e < c && !((f = a[e]), f instanceof W && 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 W) || f.data !== b[g]) return !0;
e++;
g++;
}
return !1;
}
function bn(a) {
if (a.type === W.Spot || a.type === W.Auto) return Math.min(a.R.length, 1);
if (a.type === W.Link) {
a = a.R;
for (var b = a.length, c = 0; c < b; c++) {
var d = a.K(c);
if (!(d instanceof Cf && d.isPanelMain)) break;
}
return c;
}
return a.type === W.Table &&
0 < a.R.length &&
((a = a.R.K(0)),
a.isPanelMain &&
a instanceof W &&
(a.type === W.TableRow || a.type === W.TableColumn))
? 1
: 0;
}
t.Vu = function() {
for (var a = bn(this); this.R.length > a; ) this.lc(this.R.length - 1, !1);
jn(this, this.itemArray);
};
function jn(a, b) {
var c = bn(a);
if (null === b || 0 === b.length)
for (; a.R.length > c; ) a.lc(a.R.length - 1, !1);
else if (a.R.length <= c) {
c = b.length;
for (var d = 0; d < c; d++) kn(a, b[d], d, !0);
} else {
d = c;
for (var e = 0; e < b.length; e++, d++) {
var f = b[e],
g = d < a.R.length ? a.R.K(d) : null;
if (g instanceof W) {
if (g.data !== f) {
var h = ln(a, g.data),
k = ln(a, f),
l = k !== h;
l || ((h = mn(a, h)), (l = mn(a, k) !== h));
l ? (a.lc(d, !1), kn(a, f, e, !1)) : (g.data = f);
}
} else kn(a, f, e, !1);
}
for (; d < a.R.length; ) a.lc(d, !1);
a.Qg = null;
nn(a, c, 0);
nj(a) || a.w();
a.graduatedIntervals = null;
a.yf() || en(a, a, !1);
b = a.part;
null !== b &&
((b.Kh = null),
(b.Sf = NaN),
a.He && b instanceof V && (b.He = !0),
b.He && b instanceof V && (b.sc = null));
}
}
function kn(a, b, c, d) {
if (!(void 0 === b || null === b || 0 > c)) {
var e = ln(a, b);
e = mn(a, e);
if (null !== e) {
kg(e);
e = e.copy();
if (0 !== (e.o & 16777216)) {
var f = a.Yg();
null !== f && fn(f, !0);
}
'object' === typeof b &&
(null === a.$d && (a.$d = new pb()), a.$d.add(b, e));
f = c + bn(a);
a.Cb(f, e);
d && ((e.qb = b), nn(a, f, c), (e.qb = null));
e.data = b;
}
}
}
function nn(a, b, c) {
for (a = a.R; b < a.length; ) {
var d = a.K(b);
if (d instanceof W) {
var e = b,
f = c;
d.type === W.TableRow
? (d.row = e)
: d.type === W.TableColumn && (d.column = e);
d.itemIndex = f;
}
b++;
c++;
}
}
function ln(a, b) {
if (null === b) return '';
a = a.itemCategoryProperty;
if ('function' === typeof a) a = a(b);
else if ('string' === typeof a && 'object' === typeof b) {
if ('' === a) return '';
a = on(b, a);
} else return '';
if (void 0 === a) return '';
if ('string' === typeof a) return a;
C(
'Panel.getCategoryForItemData found a non-string category for ' +
b +
': ' +
a,
);
}
function mn(a, b) {
var c = a.itemTemplateMap,
d = null;
null !== c && (d = c.I(b));
null === d &&
(null !== c && (d = c.I('')),
null === d &&
(pn ||
((pn = !0),
xa('No item template Panel found for category "' + b + '" on ' + a),
xa(' Using default item template.'),
(a = new W()),
(b = new Qg()),
b.bind(new wi('text', '', Ia)),
a.add(b),
(qn = a)),
(d = qn)));
return d;
}
function en(a, b, c) {
var d = b.enabledChanged;
null !== d && d(b, c);
if (b instanceof W) {
b = b.R.s;
d = b.length;
for (var e = 0; e < d; e++) {
var f = b[e];
(c && f instanceof W && !f.isEnabled) || en(a, f, c);
}
}
}
function rn(a, b) {
b.name = a;
Kl.add(a, b);
}
ma.Object.defineProperties(W.prototype, {
type: {
get: function() {
return this.qa;
},
set: function(a) {
var b = this.qa;
b !== a &&
((this.qa = a),
(this.isAtomic = this.qa === W.Grid),
this.w(),
this.g('type', b, a));
},
},
elements: {
get: function() {
return this.R.iterator;
},
},
naturalBounds: {
get: function() {
return this.bc;
},
},
padding: {
get: function() {
return this.ub;
},
set: function(a) {
'number' === typeof a
? (0 > a && wa(a, '>= 0', W, 'padding'), (a = new ec(a)))
: (0 > a.left && wa(a.left, '>= 0', W, 'padding:value.left'),
0 > a.right && wa(a.right, '>= 0', W, 'padding:value.right'),
0 > a.top && wa(a.top, '>= 0', W, 'padding:value.top'),
0 > a.bottom && wa(a.bottom, '>= 0', W, 'padding:value.bottom'));
var b = this.ub;
b.C(a) || ((this.ub = a = a.J()), this.w(), this.g('padding', b, a));
},
},
defaultAlignment: {
get: function() {
return this.Bm;
},
set: function(a) {
var b = this.Bm;
b.C(a) ||
((this.Bm = a = a.J()), this.w(), this.g('defaultAlignment', b, a));
},
},
defaultStretch: {
get: function() {
return this.Kf;
},
set: function(a) {
var b = this.Kf;
b !== a && ((this.Kf = a), this.w(), this.g('defaultStretch', b, a));
},
},
defaultSeparatorPadding: {
get: function() {
return null !== this.T ? this.T.tp : qc;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.defaultSeparatorPadding;
b.C(a) ||
((a = a.J()),
null === this.T && (this.T = new sn()),
(this.T.tp = a),
this.w(),
this.g('defaultSeparatorPadding', b, a));
},
},
defaultRowSeparatorStroke: {
get: function() {
return null !== this.T ? this.T.ga : null;
},
set: function(a) {
var b = this.defaultRowSeparatorStroke;
b !== a &&
(null === a || 'string' === typeof a || a instanceof nl) &&
(a instanceof nl && a.freeze(),
null === this.T && (this.T = new sn()),
(this.T.ga = a),
this.N(),
this.g('defaultRowSeparatorStroke', b, a));
},
},
defaultRowSeparatorStrokeWidth: {
get: function() {
return null !== this.T ? this.T.Ga : 1;
},
set: function(a) {
var b = this.defaultRowSeparatorStrokeWidth;
b !== a &&
isFinite(a) &&
0 <= a &&
(null === this.T && (this.T = new sn()),
(this.T.Ga = a),
this.w(),
this.g('defaultRowSeparatorStrokeWidth', b, a));
},
},
defaultRowSeparatorDashArray: {
get: function() {
return null !== this.T ? this.T.W : null;
},
set: function(a) {
var b = this.defaultRowSeparatorDashArray;
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)) ||
C(
'defaultRowSeparatorDashArray value ' +
f +
' at index ' +
e +
' must be a positive number or zero.',
);
d += f;
}
if (0 === d) {
if (null === b) return;
a = null;
}
}
null === this.T && (this.T = new sn());
this.T.W = a;
this.N();
this.g('defaultRowSeparatorDashArray', b, a);
}
},
},
defaultColumnSeparatorStroke: {
get: function() {
return null !== this.T ? this.T.u : null;
},
set: function(a) {
var b = this.defaultColumnSeparatorStroke;
b !== a &&
(null === a || 'string' === typeof a || a instanceof nl) &&
(a instanceof nl && a.freeze(),
null === this.T && (this.T = new sn()),
(this.T.u = a),
this.N(),
this.g('defaultColumnSeparatorStroke', b, a));
},
},
defaultColumnSeparatorStrokeWidth: {
get: function() {
return null !== this.T ? this.T.F : 1;
},
set: function(a) {
var b = this.defaultColumnSeparatorStrokeWidth;
b !== a &&
isFinite(a) &&
0 <= a &&
(null === this.T && (this.T = new sn()),
(this.T.F = a),
this.w(),
this.g('defaultColumnSeparatorStrokeWidth', b, a));
},
},
defaultColumnSeparatorDashArray: {
get: function() {
return null !== this.T ? this.T.m : null;
},
set: function(a) {
var b = this.defaultColumnSeparatorDashArray;
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)) ||
C(
'defaultColumnSeparatorDashArray value ' +
f +
' at index ' +
e +
' must be a positive number or zero.',
);
d += f;
}
if (0 === d) {
if (null === b) return;
a = null;
}
}
null === this.T && (this.T = new sn());
this.T.m = a;
this.N();
this.g('defaultColumnSeparatorDashArray', b, a);
}
},
},
inRowsCols: {
get: function() {
return null !== this.T ? this.T.hb : null;
},
set: function(a) {
null === this.T && (this.T = new sn());
this.T.hb = a;
},
},
viewboxStretch: {
get: function() {
return this.$n;
},
set: function(a) {
var b = this.$n;
b !== a && ((this.$n = a), this.w(), this.g('viewboxStretch', b, a));
},
},
gridCellSize: {
get: function() {
return this.Qm;
},
set: function(a) {
var b = this.Qm;
if (!b.C(a)) {
(a.v() && 0 !== a.width && 0 !== a.height) ||
C('Invalid Panel.gridCellSize: ' + a);
this.Qm = a.J();
var c = this.diagram;
null !== c && this === c.grid && jj(c);
this.N();
this.g('gridCellSize', b, a);
}
},
},
gridOrigin: {
get: function() {
return this.Rm;
},
set: function(a) {
var b = this.Rm;
if (!b.C(a)) {
a.v() || C('Invalid Panel.gridOrigin: ' + a);
this.Rm = a.J();
var c = this.diagram;
null !== c && this === c.grid && jj(c);
this.N();
this.g('gridOrigin', b, a);
}
},
},
graduatedMin: {
get: function() {
return null !== this.oa ? this.oa.Np : 0;
},
set: function(a) {
var b = this.graduatedMin;
b !== a &&
(null === this.oa && (this.oa = new tn()),
(this.oa.Np = a),
this.w(),
this.g('graduatedMin', b, a),
el(this) &&
((a = this.part), null !== a && fl(this, a, 'graduatedRange')));
},
},
graduatedMax: {
get: function() {
return null !== this.oa ? this.oa.F : 100;
},
set: function(a) {
var b = this.graduatedMax;
b !== a &&
(null === this.oa && (this.oa = new tn()),
(this.oa.F = a),
this.w(),
this.g('graduatedMax', b, a),
el(this) &&
((a = this.part), null !== a && fl(this, a, 'graduatedRange')));
},
},
graduatedRange: {
get: function() {
return this.graduatedMax - this.graduatedMin;
},
},
graduatedTickUnit: {
get: function() {
return null !== this.oa ? this.oa.ga : 10;
},
set: function(a) {
var b = this.graduatedTickUnit;
b !== a &&
0 < a &&
(null === this.oa && (this.oa = new tn()),
(this.oa.ga = a),
this.w(),
this.g('graduatedTickUnit', b, a));
},
},
graduatedTickBase: {
get: function() {
return null !== this.oa ? this.oa.W : 0;
},
set: function(a) {
var b = this.graduatedTickBase;
b !== a &&
(null === this.oa && (this.oa = new tn()),
(this.oa.W = a),
this.w(),
this.g('graduatedTickBase', b, a));
},
},
graduatedMarks: {
get: function() {
return null !== this.oa ? this.oa.u : null;
},
set: function(a) {
null !== this.oa
? (this.oa.u = a)
: null !== a && ((this.oa = new tn()), (this.oa.u = a));
},
},
graduatedBounds: {
get: function() {
return null !== this.oa ? this.oa.j : null;
},
set: function(a) {
null !== this.oa
? (this.oa.j = a)
: null !== a && ((this.oa = new tn()), (this.oa.j = a));
},
},
graduatedIntervals: {
get: function() {
return null !== this.oa ? this.oa.m : null;
},
set: function(a) {
null !== this.oa
? (this.oa.m = a)
: null !== a && ((this.oa = new tn()), (this.oa.m = a));
},
},
temporaryTextBlock: {
get: function() {
return null !== this.oa ? this.oa.Sh : null;
},
set: function(a) {
null !== this.oa
? (this.oa.Sh = a)
: null !== a && ((this.oa = new tn()), (this.oa.Sh = a));
},
},
panelLayoutState: {
get: function() {
return this.F;
},
set: function(a) {
this.F = a;
},
},
He: {
get: function() {
return 0 !== (this.o & 8388608);
},
set: function(a) {
(0 !== (this.o & 8388608)) !== a && (this.o ^= 8388608);
},
},
rowDefs: {
get: function() {
null === this.T && (this.T = new sn());
return this.T.Ic;
},
},
rowCount: {
get: function() {
return null === this.T ? 0 : this.rowDefs.length;
},
},
colDefs: {
get: function() {
null === this.T && (this.T = new sn());
return this.T.Hc;
},
},
columnCount: {
get: function() {
return null === this.T ? 0 : this.colDefs.length;
},
},
rowSizing: {
get: function() {
return null !== this.T ? this.T.nb : un;
},
set: function(a) {
var b = this.rowSizing;
b !== a &&
(null === this.T && (this.T = new sn()),
(this.T.nb = a),
this.w(),
this.g('rowSizing', b, a));
},
},
columnSizing: {
get: function() {
return null !== this.T ? this.T.j : un;
},
set: function(a) {
var b = this.columnSizing;
b !== a &&
(null === this.T && (this.T = new sn()),
(this.T.j = a),
this.w(),
this.g('columnSizing', b, a));
},
},
topIndex: {
get: function() {
return null !== this.T ? this.T.Db : 0;
},
set: function(a) {
var b = this.topIndex;
b !== a &&
((!isFinite(a) || 0 > a) &&
C(
'Panel.topIndex must be greater than zero and a real number, not: ' +
a,
),
null === this.T && (this.T = new sn()),
(this.T.Db = a),
this.w(),
this.g('topIndex', b, a));
},
},
leftIndex: {
get: function() {
return null !== this.T ? this.T.cb : 0;
},
set: function(a) {
var b = this.leftIndex;
b !== a &&
((!isFinite(a) || 0 > a) &&
C(
'Panel.leftIndex must be greater than zero and a real number, not: ' +
a,
),
null === this.T && (this.T = new sn()),
(this.T.cb = a),
this.w(),
this.g('leftIndex', b, a));
},
},
data: {
get: function() {
return this.qb;
},
set: function(a) {
var b = this.qb;
if (b !== a) {
var c = this instanceof U && !(this instanceof ue);
kg(this);
this.qb = a;
var d = this.diagram;
null !== d &&
(c
? ((c = d.partManager),
this instanceof T
? (null !== b && c.Re.remove(b),
null !== a && c.Re.add(a, this))
: this instanceof U &&
(null !== b && c.Se.remove(b),
null !== a && c.Se.add(a, this)))
: ((c = this.panel),
null !== c &&
null !== c.$d &&
(null !== b && c.$d.remove(b),
null !== a && c.$d.add(a, this))));
this.g('data', b, a);
(null !== d && d.undoManager.isUndoingRedoing) ||
(null !== a && this.Ka());
}
},
},
itemIndex: {
get: function() {
return this.fn;
},
set: function(a) {
var b = this.fn;
b !== a && ((this.fn = a), this.g('itemIndex', b, a));
},
},
allBindings: {
get: function() {
return null !== this.A ? this.A.hb : null;
},
set: function(a) {
this.localBindings !== a &&
(null === this.A && (this.A = new cl()), (this.A.hb = a));
},
},
itemArray: {
get: function() {
return this.xh;
},
set: function(a) {
var b = this.xh;
if (b !== a || (null !== a && hn(this, a))) {
var c = this.diagram;
b !== a &&
(null !== c && null !== b && Fj(c.partManager, this, c),
(this.xh = a),
null !== c && null !== a && Cj(c.partManager, this));
this.g('itemArray', b, a);
(null !== c && c.undoManager.isUndoingRedoing) || jn(this, a);
}
},
},
itemTemplate: {
get: function() {
return null === this.itemTemplateMap
? null
: this.itemTemplateMap.I('');
},
set: function(a) {
if (null === this.itemTemplateMap) {
if (null === a) return;
this.itemTemplateMap = new pb();
}
var b = this.itemTemplateMap.I('');
b !== a &&
((a instanceof U || a.isPanelMain) &&
C(
'Panel.itemTemplate must not be a Part or be Panel.isPanelMain: ' +
a,
),
this.itemTemplateMap.add('', a),
this.g('itemTemplate', b, a),
(a = this.diagram),
(null !== a && a.undoManager.isUndoingRedoing) || this.Vu());
},
},
itemTemplateMap: {
get: function() {
return null !== this.A ? this.A.le : null;
},
set: function(a) {
var b = this.itemTemplateMap;
if (b !== a) {
for (var c = a.iterator; c.next(); );
bl(this);
this.A.le = a;
this.g('itemTemplateMap', b, a);
a = this.diagram;
(null !== a && a.undoManager.isUndoingRedoing) || this.Vu();
}
},
},
itemCategoryProperty: {
get: function() {
return null !== this.A ? this.A.Ic : 'category';
},
set: function(a) {
var b = this.itemCategoryProperty;
b !== a &&
(bl(this), (this.A.Ic = a), this.g('itemCategoryProperty', b, a));
},
},
isAtomic: {
get: function() {
return 0 !== (this.o & 1048576);
},
set: function(a) {
var b = 0 !== (this.o & 1048576);
b !== a && ((this.o ^= 1048576), this.g('isAtomic', b, a));
},
},
isClipping: {
get: function() {
return 0 !== (this.o & 2097152);
},
set: function(a) {
var b = 0 !== (this.o & 2097152);
b !== a &&
((this.o ^= 2097152),
this instanceof qf && (this.ib = null),
this.w(),
this.g('isClipping', b, a));
},
},
isOpposite: {
get: function() {
return 0 !== (this.o & 33554432);
},
set: function(a) {
var b = 0 !== (this.o & 33554432);
b !== a && ((this.o ^= 33554432), this.w(), this.g('isOpposite', b, a));
},
},
isEnabled: {
get: function() {
return 0 !== (this.o & 4194304);
},
set: function(a) {
var b = 0 !== (this.o & 4194304);
if (b !== a) {
var c = null === this.panel || this.panel.yf();
this.o ^= 4194304;
this.g('isEnabled', b, a);
b = this.diagram;
(null !== b && b.undoManager.isUndoingRedoing) ||
(c && en(this, this, a));
}
},
},
alignmentFocusName: {
get: function() {
return this.Pe;
},
set: function(a) {
var b = this.Pe;
b !== a &&
((this.Pe = a), this.w(), this.g('alignmentFocusName', b, a));
},
},
});
ma.Object.defineProperties(W, {
Position: {
get: function() {
return Kl.I('Position');
},
},
Horizontal: {
get: function() {
return Kl.I('Horizontal');
},
},
Vertical: {
get: function() {
return Kl.I('Vertical');
},
},
Spot: {
get: function() {
return Kl.I('Spot');
},
},
Auto: {
get: function() {
return Kl.I('Auto');
},
},
Table: {
get: function() {
return Kl.I('Table');
},
},
Viewbox: {
get: function() {
return Kl.I('Viewbox');
},
},
TableRow: {
get: function() {
return Kl.I('TableRow');
},
},
TableColumn: {
get: function() {
return Kl.I('TableColumn');
},
},
Link: {
get: function() {
return Kl.I('Link');
},
},
Grid: {
get: function() {
return Kl.I('Grid');
},
},
Graduated: {
get: function() {
return Kl.I('Graduated');
},
},
});
W.prototype.rebuildItemElements = W.prototype.Vu;
W.prototype.findItemPanelForData = W.prototype.Uw;
W.prototype.updateTargetBindings = W.prototype.Ka;
W.prototype.copyTemplate = W.prototype.By;
W.prototype.graduatedValueForPoint = W.prototype.nz;
W.prototype.graduatedPointForValue = W.prototype.mz;
W.prototype.findColumnForLocalX = W.prototype.Oy;
W.prototype.findRowForLocalY = W.prototype.Wy;
W.prototype.removeColumnDefinition = W.prototype.Qz;
W.prototype.removeRowDefinition = W.prototype.Vz;
W.prototype.removeAt = W.prototype.mb;
W.prototype.remove = W.prototype.remove;
W.prototype.insertAt = W.prototype.Cb;
W.prototype.elt = W.prototype.K;
W.prototype.add = W.prototype.add;
W.prototype.findObject = W.prototype.fb;
W.prototype.findInVisualTree = W.prototype.vl;
W.prototype.walkVisualTreeFrom = W.prototype.$l;
W.prototype.findMainElement = W.prototype.vb;
var pn = !1,
qn = null,
Kl = new pb();
W.className = 'Panel';
W.definePanelLayout = rn;
rn('Position', new tm());
rn('Vertical', new wm());
rn('Auto', new zm());
rn('Link', new Km());
function tn() {
this.Np = 0;
this.F = 100;
this.ga = 10;
this.W = 0;
this.Sh = this.m = this.j = this.u = null;
}
tn.prototype.copy = function() {
var a = new tn();
a.Np = this.Np;
a.F = this.F;
a.ga = this.ga;
a.W = this.W;
a.u = this.u;
a.j = this.j;
a.m = this.m;
a.Sh = this.Sh;
return a;
};
tn.className = 'GradPanelSettings';
function sn() {
this.Ic = [];
this.Hc = [];
this.j = this.nb = un;
this.cb = this.Db = 0;
this.tp = qc;
this.Ga = 1;
this.W = this.ga = null;
this.F = 1;
this.hb = this.m = this.u = null;
}
sn.prototype.copy = function(a) {
for (
var b = new sn(), c = this.Ic, d = c.length, e = b.Ic, f = 0;
f < d;
f++
)
if (void 0 !== c[f]) {
var g = c[f].copy();
g.ni(a);
e[f] = g;
}
c = this.Hc;
d = c.length;
e = b.Hc;
for (f = 0; f < d; f++)
void 0 !== c[f] && ((g = c[f].copy()), g.ni(a), (e[f] = g));
b.nb = this.nb;
b.j = this.j;
b.Db = this.Db;
b.cb = this.cb;
b.tp = this.tp.J();
b.Ga = this.Ga;
b.ga = this.ga;
b.W = this.W;
b.F = this.F;
b.u = this.u;
b.m = this.m;
b.hb = this.hb;
return b;
};
sn.className = 'TablePanelSettings';
function Oj() {
Ra(this);
this.Uf = null;
this.Wp = !0;
this.Wa = 0;
this.Ac = NaN;
this.ej = 0;
this.cj = Infinity;
this.Fb = Wc;
this.pa = this.jc = this.ma = 0;
this.Vd = null;
this.Rn = vn;
this.$f = Xk;
this.On = this.Wf = null;
this.Pn = NaN;
this.Yb = this.oj = null;
this.xm = !1;
}
Oj.prototype.copy = function() {
var a = new Oj();
a.Wp = this.Wp;
a.Wa = this.Wa;
a.Ac = this.Ac;
a.ej = this.ej;
a.cj = this.cj;
a.Fb = this.Fb;
a.ma = this.ma;
a.jc = this.jc;
a.pa = this.pa;
a.$f = this.$f;
a.Rn = this.Rn;
null === this.Wf ? (a.Wf = null) : (a.Wf = this.Wf.J());
a.On = this.On;
a.Pn = this.Pn;
a.oj = null;
null !== this.oj && (a.separatorDashArray = Aa(this.separatorDashArray));
a.Yb = this.Yb;
a.xm = this.xm;
a.Vd = this.Vd;
return a;
};
t = Oj.prototype;
t.ob = function(a) {
a.classType === Oj && (this.sizing = a);
};
t.toString = function() {
return (
'RowColumnDefinition ' +
(this.isRow ? '(Row ' : '(Column ') +
this.index +
') #' +
cb(this)
);
};
t.ni = function(a) {
this.Uf = a;
};
t.mo = function(a) {
var b = 0,
c = this.Uf;
this.index !== a &&
((a = this.separatorStroke),
null === a &&
null !== c &&
(a = this.isRow
? c.defaultRowSeparatorStroke
: c.defaultColumnSeparatorStroke),
null !== a &&
((b = this.separatorStrokeWidth),
isNaN(b) &&
(null !== c
? (b = this.isRow
? c.defaultRowSeparatorStrokeWidth
: c.defaultColumnSeparatorStrokeWidth)
: (b = 0))));
a = this.Wf;
if (null === a)
if (null !== c) a = c.defaultSeparatorPadding;
else return b;
return b + (this.isRow ? a.top : a.left);
};
t.Qc = function() {
var a = 0,
b = this.Uf,
c = 0,
d = this.isRow;
if (null !== b && b.type === W.Table)
for (var e = d ? b.rowDefs.length : b.colDefs.length, f = 0; f < e; f++) {
var g = d ? b.rowDefs[f] : b.colDefs[f];
if (void 0 !== g && 0 !== g.ma) {
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.Wf;
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.Kb = function(a, b, c) {
var d = this.Uf;
if (
null !== d &&
(d.bb(de, a, this, b, c, void 0, void 0),
null !== this.Vd &&
((b = d.diagram),
null !== b &&
!b.skipsModelSourceBindings &&
((d = d.Yg()), null !== d && ((b = d.data), null !== b))))
)
for (c = this.Vd.iterator; c.next(); ) c.value.Vo(this, b, a, d);
};
function Dm(a) {
if (a.sizing === vn) {
var b = a.Uf;
return a.isRow ? b.rowSizing : b.columnSizing;
}
return a.sizing;
}
t.bind = function(a, b, c, d) {
var e = null;
'string' === typeof a ? (e = new wi(a, b, c, d)) : (e = a);
e.sd = this;
a = this.panel;
null !== a &&
((b = a.Yg()),
null !== b &&
Gl(b) &&
C(
'Cannot add a Binding to a RowColumnDefinition that is already frozen: ' +
e +
' on ' +
a,
));
null === this.Vd && (this.Vd = new E());
this.Vd.add(e);
return this;
};
ma.Object.defineProperties(Oj.prototype, {
panel: {
get: function() {
return this.Uf;
},
},
isRow: {
get: function() {
return this.Wp;
},
set: function(a) {
this.Wp = a;
},
},
index: {
get: function() {
return this.Wa;
},
set: function(a) {
this.Wa = a;
},
},
height: {
get: function() {
return this.Ac;
},
set: function(a) {
var b = this.Ac;
b !== a &&
(0 > a && wa(a, '>= 0', Oj, 'height'),
(this.Ac = a),
(this.actual = this.ma),
null !== this.panel && this.panel.w(),
this.Kb('height', b, a));
},
},
width: {
get: function() {
return this.Ac;
},
set: function(a) {
var b = this.Ac;
b !== a &&
(0 > a && wa(a, '>= 0', Oj, 'width'),
(this.Ac = a),
(this.actual = this.ma),
null !== this.panel && this.panel.w(),
this.Kb('width', b, a));
},
},
minimum: {
get: function() {
return this.ej;
},
set: function(a) {
var b = this.ej;
b !== a &&
((0 > a || !isFinite(a)) && wa(a, '>= 0', Oj, 'minimum'),
(this.ej = a),
(this.actual = this.ma),
null !== this.panel && this.panel.w(),
this.Kb('minimum', b, a));
},
},
maximum: {
get: function() {
return this.cj;
},
set: function(a) {
var b = this.cj;
b !== a &&
(0 > a && wa(a, '>= 0', Oj, 'maximum'),
(this.cj = a),
(this.actual = this.ma),
null !== this.panel && this.panel.w(),
this.Kb('maximum', b, a));
},
},
alignment: {
get: function() {
return this.Fb;
},
set: function(a) {
var b = this.Fb;
b.C(a) ||
((this.Fb = a.J()),
null !== this.panel && this.panel.w(),
this.Kb('alignment', b, a));
},
},
stretch: {
get: function() {
return this.$f;
},
set: function(a) {
var b = this.$f;
b !== a &&
((this.$f = a),
null !== this.panel && this.panel.w(),
this.Kb('stretch', b, a));
},
},
separatorPadding: {
get: function() {
return this.Wf;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.Wf;
(null !== a && null !== b && b.C(a)) ||
(null !== a && (a = a.J()),
(this.Wf = a),
null !== this.panel && this.panel.w(),
this.Kb('separatorPadding', b, a));
},
},
separatorStroke: {
get: function() {
return this.On;
},
set: function(a) {
var b = this.On;
b !== a &&
(null !== a && Pl(a, 'RowColumnDefinition.separatorStroke'),
a instanceof nl && a.freeze(),
(this.On = a),
null !== this.panel && this.panel.w(),
this.Kb('separatorStroke', b, a));
},
},
separatorStrokeWidth: {
get: function() {
return this.Pn;
},
set: function(a) {
var b = this.Pn;
b !== a &&
((this.Pn = a),
null !== this.panel && this.panel.w(),
this.Kb('separatorStrokeWidth', b, a));
},
},
separatorDashArray: {
get: function() {
return this.oj;
},
set: function(a) {
var b = this.oj;
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)) ||
C(
'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.oj = a;
null !== this.panel && this.panel.N();
this.Kb('separatorDashArray', b, a);
}
},
},
background: {
get: function() {
return this.Yb;
},
set: function(a) {
var b = this.Yb;
b !== a &&
(null !== a && Pl(a, 'RowColumnDefinition.background'),
a instanceof nl && a.freeze(),
(this.Yb = a),
null !== this.panel && this.panel.N(),
this.Kb('background', b, a));
},
},
coversSeparators: {
get: function() {
return this.xm;
},
set: function(a) {
var b = this.xm;
b !== a &&
((this.xm = a),
null !== this.panel && this.panel.N(),
this.Kb('coversSeparators', b, a));
},
},
sizing: {
get: function() {
return this.Rn;
},
set: function(a) {
var b = this.Rn;
b !== a &&
((this.Rn = a),
null !== this.panel && this.panel.w(),
this.Kb('sizing', b, a));
},
},
actual: {
get: function() {
return this.ma;
},
set: function(a) {
this.ma = isNaN(this.Ac)
? Math.max(Math.min(this.cj, a), this.ej)
: Math.max(Math.min(this.cj, this.Ac), this.ej);
},
},
measured: {
get: function() {
return this.jc;
},
set: function(a) {
this.jc = a;
},
},
total: {
get: function() {
return this.ma + this.Qc();
},
},
position: {
get: function() {
return this.pa;
},
set: function(a) {
this.pa = a;
},
},
});
Oj.prototype.computeEffectiveSpacing = Oj.prototype.Qc;
Oj.prototype.computeEffectiveSpacingTop = Oj.prototype.mo;
var vn = new D(Oj, 'Default', 0),
Em = new D(Oj, 'None', 1),
un = new D(Oj, 'ProportionalExtra', 2);
Oj.className = 'RowColumnDefinition';
Oj.Default = vn;
Oj.None = Em;
Oj.ProportionalExtra = un;
function Cf(a, b) {
Y.call(this);
this.Hd = this.sa = null;
this.Jm = 'None';
this.Nc = this.Ak = 'black';
this.ag = 1;
this.Na = this.Og = null;
this.Dn = this.Cn = NaN;
this.fa = null;
'string' === typeof a ? (this.figure = a) : a && Object.assign(this, a);
b && Object.assign(this, b);
}
la(Cf, Y);
Cf.prototype.cloneProtected = function(a) {
Y.prototype.cloneProtected.call(this, a);
a.sa = this.sa;
a.Hd = this.Hd;
a.Jm = this.Jm;
a.Ak = this.Ak;
a.Nc = this.Nc;
a.ag = this.ag;
null !== this.Og && (a.Og = Aa(this.Og));
null !== this.Na && (a.Na = this.Na.ic ? this.Na : this.Na.copy());
a.Cn = this.Cn;
a.Dn = this.Dn;
null !== this.fa && (a.fa = this.fa.copy());
};
function wn(a) {
null === a.Na ? (a.Na = new xn()) : a.Na.ic && (a.Na = a.Na.copy());
}
t = Cf.prototype;
t.ih = function() {
Y.prototype.ih.call(this);
null !== this.Na && (this.Na.ic = !0);
};
t.ob = function(a) {
a === lg || a === ng || a === Yk || a === Xk
? (this.geometryStretch = a)
: Y.prototype.ob.call(this, a);
};
t.toString = function() {
return (
'Shape(' +
('None' !== this.figure
? this.figure
: 'None' !== this.toArrow
? this.toArrow
: this.fromArrow) +
')#' +
cb(this)
);
};
function yn(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, w = Ea(), v = 2;
v < e;
v += 2
)
(l = c[v]),
(m = c[v + 1]),
(n = l - h),
(h = m - k),
0 === n && (n = 0.001),
(p = h / n),
(r = Math.atan2(h, n)),
(q = Math.sqrt(n * n + h * h)),
w.push([n, r, p, q]),
(u += q),
(h = l),
(k = m);
h = c[0];
k = c[1];
n = d.measuredBounds.width;
d instanceof Cf && (n -= d.strokeWidth);
1 > n && (n = 1);
e = c = n;
l = g / 2;
m = 0 === l ? !1 : !0;
v = 0;
q = w[v];
n = q[0];
r = q[1];
p = q[2];
q = q[3];
for (var z = 0; 0.1 <= u; ) {
0 === z &&
(m ? ((e = c), (e -= l), (u -= l), (m = !1)) : (e = c),
0 === e && (e = 1));
if (e > u) {
Ga(w);
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.ai(a, b);
a.translate(g / 2, f / 2);
a.rotate(-r);
a.translate(-h, -k);
u -= e;
q -= e;
if (0 !== z) {
v++;
if (v === w.length) {
Ga(w);
return;
}
q = w[v];
n = q[0];
r = q[1];
p = q[2];
q = q[3];
e = z;
}
}
Ga(w);
}
}
t.ai = function(a, b) {
var c = this.Nc,
d = this.Ak;
if (null !== c || null !== d) {
var e = this.sa;
if (null !== e) {
a.Pc();
var f = this.actualBounds,
g = this.naturalBounds;
null !== d && gi(this, a, d, !0, !1, g, f);
var h = this.part,
k = this.ag;
null === c ||
0 !== k ||
null === h ||
(!this.isPanelMain && h.vb() !== this) ||
(k =
h.type === W.Link &&
h instanceof ue &&
'Selection' === h.category &&
h.adornedObject instanceof Cf &&
h.adornedPart.vb() === h.adornedObject
? h.adornedObject.strokeWidth
: 0);
0 === k && (c = null);
null !== c &&
0 !== k &&
(gi(this, a, c, !1, !1, g, f),
(a.lineWidth = k),
(a.lineJoin = this.strokeJoin),
(a.lineCap = this.strokeCap),
(a.miterLimit = this.strokeMiterLimit));
f = !1;
h && b.Ge('drawShadows') && (f = h.isShadowed);
h = !0;
null === c || (null !== d && 'transparent' !== d) || (h = !1);
g = !1;
k = this.strokeDashArray;
null !== k && ((g = !0), a.Gr(k, this.strokeDashOffset));
if (e.type === O.j)
a.beginPath(),
a.moveTo(e.startX, e.startY),
a.lineTo(e.endX, e.endY),
null !== c && a.si();
else if (e.type === O.u) {
var l = e.startX;
k = e.startY;
var m = e.endX,
n = e.endY;
e = Math.min(l, m);
var p = Math.min(k, n);
l = Math.abs(m - l);
k = Math.abs(n - k);
a.beginPath();
a.rect(e, p, l, k);
null !== d && a.sf(d);
if (null !== c) {
h && f && rl(a);
if (0 === l || 0 === k)
a.beginPath(), a.rect(e, p, Math.max(l, 0.1), Math.max(k, 0.1));
a.si();
h && f && ql(a);
}
} else if (e.type === O.F)
(l = e.startX),
(k = e.startY),
(m = e.endX),
(n = e.endY),
(e = Math.abs(m - l) / 2),
(p = Math.abs(n - k) / 2),
(l = Math.min(l, m) + e),
(k = Math.min(k, n) + p),
a.beginPath(),
a.moveTo(l, k - p),
a.bezierCurveTo(l + J.ng * e, k - p, l + e, k - J.ng * p, l + e, k),
a.bezierCurveTo(l + e, k + J.ng * p, l + J.ng * e, k + p, l, k + p),
a.bezierCurveTo(l - J.ng * e, k + p, l - e, k + J.ng * p, l - e, k),
a.bezierCurveTo(l - e, k - J.ng * p, l - J.ng * e, k - p, l, k - p),
a.closePath(),
null !== d && a.sf(d),
null !== c && (h && f ? (rl(a), a.si(), ql(a)) : a.si());
else if (e.type === O.m)
for (e = e.figures, k = e.length, p = 0; p < k; p++) {
l = e.s[p];
a.beginPath();
a.moveTo(l.startX, l.startY);
m = l.segments.s;
n = m.length;
for (var r = null, q = 0; q < n; q++) {
var u = m[q];
switch (u.type) {
case Jd:
a.moveTo(u.endX, u.endY);
break;
case vd:
a.lineTo(u.endX, u.endY);
break;
case Kd:
a.bezierCurveTo(
u.point1X,
u.point1Y,
u.point2X,
u.point2Y,
u.endX,
u.endY,
);
break;
case Ld:
a.quadraticCurveTo(u.point1X, u.point1Y, u.endX, u.endY);
break;
case Md:
if (u.radiusX === u.radiusY) {
var w = Math.PI / 180;
a.arc(
u.point1X,
u.point1Y,
u.radiusX,
u.startAngle * w,
(u.startAngle + u.sweepAngle) * w,
0 > u.sweepAngle,
null !== r ? r.endX : l.startX,
null !== r ? r.endY : l.startY,
);
} else if (((r = Rd(u, l)), (w = r.length), 0 === w))
a.lineTo(u.centerX, u.centerY);
else
for (var v = 0; v < w; v++) {
var z = r[v];
0 === v && a.lineTo(z[0], z[1]);
a.bezierCurveTo(z[2], z[3], z[4], z[5], z[6], z[7]);
}
break;
case Qd:
v = w = 0;
if (null !== r && r.type === Md) {
r = Rd(r, l);
z = r.length;
if (0 === z) {
a.lineTo(u.endX, u.endY);
break;
}
r = r[z - 1] || null;
null !== r && ((w = r[6]), (v = r[7]));
} else
(w = null !== r ? r.endX : l.startX),
(v = null !== r ? r.endY : l.startY);
r = Sd(u, l, w, v);
w = r.length;
if (0 === w) {
a.lineTo(u.endX, u.endY);
break;
}
for (v = 0; v < w; v++)
(z = r[v]),
a.bezierCurveTo(z[2], z[3], z[4], z[5], z[6], z[7]);
break;
default:
C('Segment not of valid type: ' + u.type);
}
u.isClosed && a.closePath();
r = u;
}
m = l.isFilled;
f
? l.isShadowed
? (!0 === m && 'transparent' !== d && null !== d && a.sf(d),
null !== c && (m && h && rl(a), a.si(), m && h && ql(a)))
: (rl(a),
m && 'transparent' !== d && null !== d && a.sf(d),
null !== c && a.si(),
ql(a))
: (m && null !== d && a.sf(d), null !== c && a.si());
}
g && a.Er();
if (null !== this.pathPattern) {
c = this.pathPattern;
c.measure(Infinity, Infinity);
d = c.measuredBounds;
c.arrange(0, 0, d.width, d.height);
f = this.geometry;
a.save();
a.beginPath();
d = Ea();
if (f.type === O.j)
d.push(f.startX),
d.push(f.startY),
d.push(f.endX),
d.push(f.endY),
yn(a, b, d, c);
else if (f.type === O.m)
for (f = f.figures.iterator; f.next(); ) {
h = f.value;
d.length = 0;
d.push(h.startX);
d.push(h.startY);
g = h.startX;
e = h.startY;
k = g;
p = e;
l = h.segments.s;
m = l.length;
for (n = 0; n < m; n++) {
q = l[n];
switch (q.type) {
case Jd:
yn(a, b, d, c);
d.length = 0;
d.push(q.endX);
d.push(q.endY);
g = q.endX;
e = q.endY;
k = g;
p = e;
break;
case vd:
d.push(q.endX);
d.push(q.endY);
g = q.endX;
e = q.endY;
break;
case Kd:
J.De(
g,
e,
q.point1X,
q.point1Y,
q.point2X,
q.point2Y,
q.endX,
q.endY,
0.5,
d,
);
g = q.endX;
e = q.endY;
break;
case Ld:
J.Go(g, e, q.point1X, q.point1Y, q.endX, q.endY, 0.5, d);
g = q.endX;
e = q.endY;
break;
case Md:
u = Rd(q, h);
r = u.length;
if (0 === r) {
d.push(q.centerX);
d.push(q.centerY);
g = q.centerX;
e = q.centerY;
break;
}
for (w = 0; w < r; w++)
(v = u[w]),
J.De(g, e, v[2], v[3], v[4], v[5], v[6], v[7], 0.5, d),
(g = v[6]),
(e = v[7]);
break;
case Qd:
u = Sd(q, h, g, e);
r = u.length;
if (0 === r) {
d.push(q.endX);
d.push(q.endY);
g = q.endX;
e = q.endY;
break;
}
for (w = 0; w < r; w++)
(v = u[w]),
J.De(g, e, v[2], v[3], v[4], v[5], v[6], v[7], 0.5, d),
(g = v[6]),
(e = v[7]);
break;
default:
C('Segment not of valid type: ' + q.type);
}
q.isClosed && (d.push(k), d.push(p), yn(a, b, d, c));
}
yn(a, b, d, c);
}
else if (f.type === O.u)
d.push(f.startX),
d.push(f.startY),
d.push(f.endX),
d.push(f.startY),
d.push(f.endX),
d.push(f.endY),
d.push(f.startX),
d.push(f.endY),
d.push(f.startX),
d.push(f.startY),
yn(a, b, d, c);
else if (f.type === O.F) {
e = new Xd();
e.startX = f.endX;
e.startY = (f.startY + f.endY) / 2;
g = new Yd(Md);
g.startAngle = 0;
g.sweepAngle = 360;
g.centerX = (f.startX + f.endX) / 2;
g.centerY = (f.startY + f.endY) / 2;
g.radiusX = Math.abs(f.startX - f.endX) / 2;
g.radiusY = Math.abs(f.startY - f.endY) / 2;
e.add(g);
f = Rd(g, e);
h = f.length;
if (0 === h) d.push(g.centerX), d.push(g.centerY);
else
for (g = e.startX, e = e.startY, k = 0; k < h; k++)
(p = f[k]),
J.De(g, e, p[2], p[3], p[4], p[5], p[6], p[7], 0.5, d),
(g = p[6]),
(e = p[7]);
yn(a, b, d, c);
}
Ga(d);
a.restore();
a.Oc(!1);
}
}
}
};
t.ia = function(a, b) {
void 0 === b && (b = new I());
if (a instanceof N) {
a.Fc() &&
C(
'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.ge.Fa(b);
return b;
};
t.gi = function(a) {
void 0 === a && (a = new M());
var b = this.naturalBounds,
c = this.ge;
b = M.allocAt(b.x, b.y, b.width, b.height);
var d = this.strokeWidth;
b.vc(d / 2, d / 2);
d = I.allocAt(b.x, b.y).transform(c);
a.h(d.x, d.y, 0, 0);
d.h(b.right, b.y).transform(c);
Zb(a, d.x, d.y, 0, 0);
d.h(b.right, b.bottom).transform(c);
Zb(a, d.x, d.y, 0, 0);
d.h(b.x, b.bottom).transform(c);
Zb(a, d.x, d.y, 0, 0);
M.free(b);
I.free(d);
return a;
};
t.Xg = 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 !== O.j || b || (e += 2);
var f = M.alloc();
f.assign(d);
f.vc(e + 2, e + 2);
if (!f.ba(a)) return M.free(f), !1;
d = e + 1e-4;
if (c.type === O.j) {
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;
M.free(f);
return J.Tb(c.startX, c.startY, c.endX, c.endY, e, a.x, a.y);
}
if (c.type === O.u) {
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.vc(-d, -d);
if (f.ba(a)) return M.free(f), !1;
f.vc(d, d);
}
null !== this.stroke && f.vc(e, e);
a = f.ba(a);
M.free(f);
return a;
}
if (c.type === O.F) {
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 M.free(f), !1;
g += d;
e += d;
}
null !== this.stroke && ((g += d), (e += d));
M.free(f);
return 0 >= g || 0 >= e ? !1 : 1 >= (c * c) / (g * g) + (b * b) / (e * e);
}
if (c.type === O.m)
return (
M.free(f),
null === this.fill
? Vd(c, a.x, a.y, e)
: Td(c, a, e, 1 < this.strokeWidth, b)
);
C('Unknown Geometry type: ' + c.type);
};
t.El = function(a, b, c, d) {
var e = this.desiredSize,
f = this.ag;
a = Math.max(a, 0);
b = Math.max(b, 0);
if (null !== this.Hd) var g = this.geometry.bounds;
else {
var h = this.figure,
k = zn[h];
if (void 0 === k) {
var l = J.Oe[h];
'string' === typeof l && (l = J.Oe[l]);
'function' === typeof l
? ((k = l(null, 100, 100)), (zn[h] = k))
: C('Unsupported Figure: ' + h);
}
g = k.bounds;
}
h = g.width;
k = g.height;
l = g.width;
var m = g.height;
switch (il(this, !0)) {
case lg:
d = c = 0;
break;
case td:
l = Math.max(a - f, 0);
m = Math.max(b - f, 0);
break;
case Vk:
l = Math.max(a - f, 0);
d = 0;
break;
case Wk:
(c = 0), (m = Math.max(b - f, 0));
}
isFinite(e.width) && (l = e.width);
isFinite(e.height) && (m = e.height);
g = this.maxSize;
var n = this.minSize;
c = Math.max(c - f, n.width);
d = Math.max(d - f, n.height);
l = Math.min(g.width, l);
m = Math.min(g.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 = mg(this);
switch (c) {
case lg:
break;
case td:
h = l;
k = m;
break;
case ng:
c = Math.min(l / h, m / k);
isFinite(c) || (c = 1);
h *= c;
k *= c;
break;
default:
C(c + ' is not a valid geometryStretch.');
}
null !== this.Hd
? (0 === h && (h = 0.001),
0 === k && (k = 0.001),
(c = null !== this.Hd ? this.Hd : this.sa),
(g = c.bounds),
(d = h / g.width),
(g = k / g.height),
isFinite(d) || (d = 1),
isFinite(g) || (g = 1),
(this.sa = 1 === d && 1 === g ? c : c.copy().scale(d, g)))
: (null !== this.sa &&
J.ca(this.sa.Hk, a - f) &&
J.ca(this.sa.Gk, b - f)) ||
(this.sa = Cf.makeGeometry(this, h, k));
g = this.sa.bounds;
Infinity === a || Infinity === b
? this.ve(
g.x - f / 2,
g.y - f / 2,
0 === a && 0 === h ? 0 : g.width + f,
0 === b && 0 === k ? 0 : g.height + f,
)
: this.ve(-(f / 2), -(f / 2), l + f, m + f);
e.v() ? this.bc.h(0, 0, e.width, e.height) : this.bc.assign(g);
};
function mg(a) {
var b = a.geometryStretch;
return null !== a.Hd
? b === Xk
? td
: b
: b === Xk
? zn[a.figure].defaultStretch
: b;
}
t.Vg = function(a, b, c, d) {
kl(this, a, b, c, d);
};
t.Or = function(a, b, c) {
return this.Kj(a.x, a.y, b.x, b.y, c);
};
t.Kj = 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.ag / 2;
l = this.sa;
null === l && (this.measure(Infinity, Infinity), (l = this.sa));
var r = l.bounds;
m = !1;
if (l.type === O.j)
if (1.5 >= this.strokeWidth)
m = J.Je(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 = Ea();
a = new I();
J.Je(
l.startX + d,
l.startY + m,
l.endX + d,
l.endY + m,
f,
g,
h,
k,
a,
) && b.push(a);
a = new I();
J.Je(
l.startX - d,
l.startY - m,
l.endX - d,
l.endY - m,
f,
g,
h,
k,
a,
) && b.push(a);
a = new I();
J.Je(
l.startX + d,
l.startY + m,
l.startX - d,
l.startY - m,
f,
g,
h,
k,
a,
) && b.push(a);
a = new I();
J.Je(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 === O.u)
m = J.wf(
r.x - n,
r.y - n,
r.x + r.width + n,
r.y + r.height + n,
f,
g,
h,
k,
e,
);
else if (l.type === O.F) {
b = M.allocAt(r.x, r.y, r.width, r.height).vc(n, n);
a: if (0 === b.width)
m = J.Je(b.x, b.y, b.x, b.y + b.height, f, g, h, k, e);
else if (0 === b.height)
m = J.Je(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;
}
M.free(b);
} else if (l.type === O.m) {
p = I.alloc();
var q = h - f;
var u = k - g,
w = q * q + u * u,
v = f,
z = g;
if (0 < w && r.contains(v, z) && ((p.x = v), (p.y = z), this.ba(p)))
for (
0 !== q && 0.5 > Math.abs(q)
? ((u *= 0.5 / q), (q = 0.5))
: 0 !== u && 0.5 > Math.abs(u) && ((q *= 0.5 / u), (u = 0.5)),
v -= q,
z -= u;
r.contains(v, z);
)
(v -= q), (z -= u);
e.x = h;
e.y = k;
for (u = 0; u < l.figures.count; u++) {
var y = l.figures.s[u],
A = y.isFilled ? v : f,
B = y.isFilled ? z : g,
F = y.segments;
r = y.startX;
q = y.startY;
for (var L = r, S = q, R = 0; R < F.count; R++) {
var P = F.s[R],
H = P.type;
var da = P.endX;
var X = P.endY;
var oa = !1;
switch (H) {
case Jd:
L = da;
S = X;
break;
case vd:
oa = An(r, q, da, X, A, B, h, k, p);
break;
case Kd:
oa = J.io(
r,
q,
P.point1X,
P.point1Y,
P.point2X,
P.point2Y,
da,
X,
A,
B,
h,
k,
0.6,
p,
);
break;
case Ld:
oa = J.io(
r,
q,
r + (2 / 3) * (P.point1X - r),
q + (2 / 3) * (P.point1Y - q),
da + (2 / 3) * (P.point1X - da),
X + (2 / 3) * (P.point1Y - X),
da,
X,
A,
B,
h,
k,
0.6,
p,
);
break;
case Md:
case Qd:
H = P.type === Md ? Rd(P, y) : Sd(P, y, r, q);
var Ba = H.length;
if (0 === Ba) {
oa = An(
r,
q,
P.type === Md ? P.centerX : P.endX,
P.type === Md ? P.centerY : P.endY,
A,
B,
h,
k,
p,
);
break;
}
X = null;
for (da = 0; da < Ba; da++) {
X = H[da];
if (0 === da && An(r, q, X[0], X[1], A, B, h, k, p)) {
var db = Bn(A, B, p, w, e);
db < w && ((w = db), (m = !0));
}
J.io(
X[0],
X[1],
X[2],
X[3],
X[4],
X[5],
X[6],
X[7],
A,
B,
h,
k,
0.6,
p,
) && ((db = Bn(A, B, p, w, e)), db < w && ((w = db), (m = !0)));
}
da = X[6];
X = X[7];
break;
default:
C('Unknown Segment type: ' + H);
}
r = da;
q = X;
oa && ((oa = Bn(A, B, p, w, e)), oa < w && ((w = oa), (m = !0)));
P.isClosed &&
((da = L),
(X = S),
An(r, q, da, X, A, B, h, k, p) &&
((P = Bn(A, B, p, w, e)), P < w && ((w = P), (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;
I.free(p);
} else C('Unknown Geometry type: ' + l.type);
if (!m) return !1;
this.transform.Fa(e);
return !0;
};
function Bn(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 An(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 || J.ca(k.y, a)) && (k.y < b || J.ca(k.y, b)) && (l = !0))
: ((b = a < c ? a : c),
(a = a < c ? c : a),
(k.x > b || J.ca(k.x, b)) && (k.x < a || J.ca(k.x, a)) && (l = !0));
return l;
}
t.Wg = function(a, b) {
if (void 0 === b) return a.Ee(this.actualBounds);
var c = this.sa;
null === c && (this.measure(Infinity, Infinity), (c = this.sa));
c = c.bounds;
var d = this.strokeWidth / 2,
e = !1,
f = I.alloc();
f.h(c.x - d, c.y - d);
a.ba(b.Fa(f)) &&
(f.h(c.x - d, c.bottom + d),
a.ba(b.Fa(f)) &&
(f.h(c.right + d, c.bottom + d),
a.ba(b.Fa(f)) &&
(f.h(c.right + d, c.y - d), a.ba(b.Fa(f)) && (e = !0))));
I.free(f);
return e;
};
t.Sc = function(a, b) {
if (
this.Wg(a, b) ||
(void 0 === b && ((b = this.transform), a.Ee(this.actualBounds)))
)
return !0;
var c = md.alloc();
c.set(b);
c.Tr();
var d = a.left,
e = a.right,
f = a.top;
a = a.bottom;
var g = I.alloc();
g.h(d, f);
c.Fa(g);
if (this.Xg(g, !0)) return I.free(g), !0;
g.h(e, f);
c.Fa(g);
if (this.Xg(g, !0)) return I.free(g), !0;
g.h(d, a);
c.Fa(g);
if (this.Xg(g, !0)) return I.free(g), !0;
g.h(e, a);
c.Fa(g);
if (this.Xg(g, !0)) return I.free(g), !0;
var h = I.alloc(),
k = I.alloc();
c.set(b);
c.Ou(this.transform);
c.Tr();
h.x = e;
h.y = f;
h.transform(c);
g.x = d;
g.y = f;
g.transform(c);
b = !1;
Cn(this, g, h, k)
? (b = !0)
: ((g.x = e),
(g.y = a),
g.transform(c),
Cn(this, g, h, k)
? (b = !0)
: ((h.x = d),
(h.y = a),
h.transform(c),
Cn(this, g, h, k)
? (b = !0)
: ((g.x = d),
(g.y = f),
g.transform(c),
Cn(this, g, h, k) && (b = !0))));
I.free(g);
md.free(c);
I.free(h);
I.free(k);
return b;
};
function Cn(a, b, c, d) {
if (!a.Or(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.Vw = function(a, b, c) {
function d(a, b) {
for (var c = a.length, d = 0; d < c; d += 2)
if (b.td(a[d], a[d + 1]) > e) return !0;
return !1;
}
if (c && null !== this.fill && this.Xg(a, !0)) return !0;
var e = a.rf(b),
f = e;
1.5 < this.strokeWidth &&
((e = this.strokeWidth / 2 + Math.sqrt(e)), (e *= e));
b = this.sa;
if (
null === b &&
(this.measure(Infinity, Infinity), (b = this.sa), 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 (
Ab(a.x, a.y, h, k) <= e &&
Ab(a.x, a.y, l, k) <= e &&
Ab(a.x, a.y, h, g) <= e &&
Ab(a.x, a.y, l, g) <= e
)
return !0;
}
h = b.startX;
k = b.startY;
l = b.endX;
g = b.endY;
if (b.type === O.j) {
if (
((c = (h - l) * (a.x - l) + (k - g) * (a.y - g)),
zb(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 === O.u)
return (
(b = !1),
c &&
(b =
zb(a.x, a.y, h, k, h, g) <= e ||
zb(a.x, a.y, h, k, l, k) <= e ||
zb(a.x, a.y, l, k, l, g) <= e ||
zb(a.x, a.y, h, g, l, g) <= e),
b
);
if (b.type === O.F) {
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 zb(a.x, a.y, h, k, l, g) <= e ? !0 : !1;
if (c) {
if (((a = J.Hy(m, n, b, f)), a * a <= e)) return !0;
} else
return Ab(b, f, -m, 0) >= e ||
Ab(b, f, 0, -n) >= e ||
Ab(b, f, 0, n) >= e ||
Ab(b, f, m, 0) >= e
? !1
: !0;
} else if (b.type === O.m) {
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 &&
zb(a.x, a.y, f, h, f, l) > e &&
zb(a.x, a.y, f, h, k, h) > e &&
zb(a.x, a.y, k, l, f, l) > e &&
zb(a.x, a.y, k, l, k, h) > e
)
return !1;
f = Math.sqrt(e);
if (c) {
if (null === this.fill ? Vd(b, a.x, a.y, f) : Td(b, a, f, !0, !1))
return !0;
} else {
c = b.figures;
for (b = 0; b < c.count; b++) {
f = c.s[b];
g = f.startX;
m = f.startY;
if (a.td(g, m) > e) return !1;
h = f.segments.s;
k = h.length;
for (l = 0; l < k; l++)
switch (((n = h[l]), n.type)) {
case Jd:
case vd:
g = n.endX;
m = n.endY;
if (a.td(g, m) > e) return !1;
break;
case Kd:
var p = Ea();
J.De(
g,
m,
n.point1X,
n.point1Y,
n.point2X,
n.point2Y,
n.endX,
n.endY,
0.8,
p,
);
g = d(p, a);
Ga(p);
if (g) return !1;
g = n.endX;
m = n.endY;
if (a.td(g, m) > e) return !1;
break;
case Ld:
p = Ea();
J.Go(g, m, n.point1X, n.point1Y, n.endX, n.endY, 0.8, p);
g = d(p, a);
Ga(p);
if (g) return !1;
g = n.endX;
m = n.endY;
if (a.td(g, m) > e) return !1;
break;
case Md:
case Qd:
p = n.type === Md ? Rd(n, f) : Sd(n, f, g, m);
var r = p.length;
if (0 === r) {
g = n.type === Md ? n.centerX : n.endX;
m = n.type === Md ? n.centerY : n.endY;
if (a.td(g, m) > e) return !1;
break;
}
n = null;
for (var q = Ea(), u = 0; u < r; u++)
if (
((n = p[u]),
(q.length = 0),
J.De(
n[0],
n[1],
n[2],
n[3],
n[4],
n[5],
n[6],
n[7],
0.8,
q,
),
d(q, a))
)
return Ga(q), !1;
Ga(q);
null !== n && ((g = n[6]), (m = n[7]));
break;
default:
C('Unknown Segment type: ' + n.type);
}
}
return !0;
}
}
}
return !1;
};
t.mc = function() {
this.sa = null;
};
t.Sv = function() {
return this.ag;
};
function Dn(a) {
var b = a.diagram;
(null !== b && b.undoManager.isUndoingRedoing) ||
((a.segmentOrientation = Tm),
'None' !== a.toArrow
? ((a.segmentIndex = -1), (a.alignmentFocus = ed))
: 'None' !== a.fromArrow &&
((a.segmentIndex = 0), (a.alignmentFocus = new N(1 - ed.x, ed.y))));
}
Cf.makeGeometry = function(a, b, c) {
if ('None' !== a.toArrow) var d = En[a.toArrow];
else
'None' !== a.fromArrow
? (d = En[a.fromArrow])
: ((d = J.Oe[a.figure]),
'string' === typeof d && (d = J.Oe[d]),
void 0 === d && C('Unknown Shape.figure: ' + a.figure),
(d = d(a, b, c)),
(d.Hk = b),
(d.Gk = c));
if (null === d) {
var e = J.Oe.Rectangle;
'function' === typeof e && (d = e(a, b, c));
}
return d;
};
function Fn(a) {
var b = En[a];
if (void 0 === b) {
var c = a.toLowerCase();
if ('none' === c) return 'None';
b = En[c];
if (void 0 === b) {
var d = null,
e;
for (e in J.dm)
if (e.toLowerCase() === c) {
d = e;
break;
}
if (null !== d)
return (
(a = O.parse(J.dm[d], !1)), (En[d] = a), c !== d && (En[c] = d), d
);
}
}
return 'string' === typeof b ? b : b instanceof O ? a : null;
}
ma.Object.defineProperties(Cf.prototype, {
geometry: {
get: function() {
return null !== this.sa ? this.sa : this.Hd;
},
set: function(a) {
var b = this.sa,
c = this.Hd;
if (b !== a) {
null !== a
? (this.Hd = this.sa = a.freeze())
: (this.Hd = this.sa = null);
var d = this.part;
null !== d && (d.Sf = NaN);
this.w();
this.g('geometry', b || c, a);
el(this) &&
((a = this.part), null !== a && fl(this, a, 'geometryString'));
}
},
},
geometryString: {
get: function() {
return null === this.geometry ? '' : this.geometry.toString();
},
set: function(a) {
a = O.parse(a);
var b = a.normalize();
this.geometry = a;
this.position = a = I.allocAt(-b.x, -b.y);
I.free(a);
},
},
isGeometryPositioned: {
get: function() {
return 0 !== (this.o & 1048576);
},
set: function(a) {
var b = 0 !== (this.o & 1048576);
b !== a &&
((this.o ^= 1048576), this.w(), this.g('isGeometryPositioned', b, a));
},
},
fill: {
get: function() {
return this.Ak;
},
set: function(a) {
var b = this.Ak;
b !== a &&
(null !== a && Pl(a, 'Shape.fill'),
a instanceof nl && a.freeze(),
(this.Ak = a),
this.N(),
this.g('fill', b, a));
},
},
stroke: {
get: function() {
return this.Nc;
},
set: function(a) {
var b = this.Nc;
b !== a &&
(null !== a && Pl(a, 'Shape.stroke'),
a instanceof nl && a.freeze(),
(this.Nc = a),
this.N(),
this.g('stroke', b, a));
},
},
strokeWidth: {
get: function() {
return this.ag;
},
set: function(a) {
var b = this.ag;
if (b !== a)
if (0 <= a) {
this.ag = a;
this.w();
var c = this.part;
null !== c && (c.Sf = NaN);
this.g('strokeWidth', b, a);
} else wa(a, 'value >= 0', Cf, 'strokeWidth:value');
},
},
strokeCap: {
get: function() {
return null !== this.Na ? this.Na.dr : 'butt';
},
set: function(a) {
var b = this.strokeCap;
b !== a &&
('string' !== typeof a ||
('butt' !== a && 'round' !== a && 'square' !== a)
? wa(a, '"butt", "round", or "square"', Cf, 'strokeCap')
: (wn(this),
(this.Na.dr = a),
this.N(),
this.g('strokeCap', b, a)));
},
},
strokeJoin: {
get: function() {
return null !== this.Na ? this.Na.er : 'miter';
},
set: function(a) {
var b = this.strokeJoin;
b !== a &&
('string' !== typeof a ||
('miter' !== a && 'bevel' !== a && 'round' !== a)
? wa(a, '"miter", "bevel", or "round"', Cf, 'strokeJoin')
: (wn(this),
(this.Na.er = a),
this.N(),
this.g('strokeJoin', b, a)));
},
},
strokeMiterLimit: {
get: function() {
return null !== this.Na ? this.Na.fr : 10;
},
set: function(a) {
var b = this.strokeMiterLimit;
if (b !== a && 1 <= a) {
wn(this);
this.Na.fr = a;
this.N();
var c = this.part;
null !== c && (c.Sf = NaN);
this.g('strokeMiterLimit', b, a);
}
},
},
strokeDashArray: {
get: function() {
return this.Og;
},
set: function(a) {
var b = this.Og;
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)) ||
C(
'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.Og = a;
this.N();
this.g('strokeDashArray', b, a);
}
},
},
strokeDashOffset: {
get: function() {
return null !== this.Na ? this.Na.pj : 0;
},
set: function(a) {
var b = this.strokeDashOffset;
b !== a &&
0 <= a &&
(wn(this),
(this.Na.pj = a),
this.N(),
this.g('strokeDashOffset', b, a));
},
},
figure: {
get: function() {
return this.Jm;
},
set: function(a) {
var b = this.Jm;
if (b !== a) {
var c = J.Oe[a];
'function' === typeof c
? (c = a)
: (c = J.Oe[a.toLowerCase()]) || C('Unknown Shape.figure: ' + a);
b !== c &&
((a = this.part),
null !== a && (a.Sf = NaN),
(this.Jm = c),
(this.Hd = null),
this.mc(),
this.w(),
this.g('figure', b, c));
}
},
},
toArrow: {
get: function() {
return null !== this.Ra ? this.Ra.W : 'None';
},
set: function(a) {
var b = this.toArrow;
!0 === a ? (a = 'Standard') : !1 === a && (a = '');
if (b !== a) {
var c = Fn(a);
null === c
? C('Unknown Shape.toArrow: ' + a)
: b !== c &&
(null === this.Ra && (this.Ra = new Ol()),
(this.Ra.W = c),
(this.Hd = null),
this.mc(),
this.w(),
Dn(this),
this.g('toArrow', b, c));
}
},
},
fromArrow: {
get: function() {
return null !== this.Ra ? this.Ra.j : 'None';
},
set: function(a) {
var b = this.fromArrow;
!0 === a ? (a = 'Standard') : !1 === a && (a = '');
if (b !== a) {
var c = Fn(a);
null === c
? C('Unknown Shape.fromArrow: ' + a)
: b !== c &&
(null === this.Ra && (this.Ra = new Ol()),
(this.Ra.j = c),
(this.Hd = null),
this.mc(),
this.w(),
Dn(this),
this.g('fromArrow', b, c));
}
},
},
spot1: {
get: function() {
return null !== this.Na ? this.Na.Yf : Wc;
},
set: function(a) {
var b = this.spot1;
b.C(a) ||
((a = a.J()),
wn(this),
(this.Na.Yf = a),
this.w(),
this.g('spot1', b, a));
},
},
spot2: {
get: function() {
return null !== this.Na ? this.Na.Zf : Wc;
},
set: function(a) {
var b = this.spot2;
b.C(a) ||
((a = a.J()),
wn(this),
(this.Na.Zf = a),
this.w(),
this.g('spot2', b, a));
},
},
parameter1: {
get: function() {
return this.Cn;
},
set: function(a) {
var b = this.Cn;
b !== a &&
((this.Cn = a), this.mc(), this.w(), this.g('parameter1', b, a));
},
},
parameter2: {
get: function() {
return this.Dn;
},
set: function(a) {
var b = this.Dn;
b !== a &&
((this.Dn = a), this.mc(), this.w(), this.g('parameter2', b, a));
},
},
naturalBounds: {
get: function() {
return this.bc;
},
},
pathPattern: {
get: function() {
return null !== this.Na ? this.Na.Aq : null;
},
set: function(a) {
var b = this.pathPattern;
b !== a &&
(wn(this), (this.Na.Aq = a), this.N(), this.g('pathPattern', b, a));
},
},
geometryStretch: {
get: function() {
return null !== this.Na ? this.Na.Mp : Xk;
},
set: function(a) {
var b = this.geometryStretch;
b !== a &&
(wn(this),
(this.Na.Mp = a),
this.w(),
this.g('geometryStretch', b, a));
},
},
interval: {
get: function() {
return null !== this.fa ? this.fa.Ik : 1;
},
set: function(a) {
var b = this.interval;
a = Math.round(a);
if (b !== a && 0 !== a && isFinite(a)) {
null === this.fa && (this.fa = new Gn());
this.fa.Ik = a;
var c = this.diagram;
null !== c && this.panel === c.grid && jj(c);
this.w();
c = this.panel;
null !== c && (c.graduatedIntervals = null);
this.g('interval', b, a);
}
},
},
graduatedStart: {
get: function() {
return null !== this.fa ? this.fa.u : 0;
},
set: function(a) {
var b = this.graduatedStart;
b !== a &&
(0 > a ? (a = 0) : 1 < a && (a = 1),
null === this.fa && (this.fa = new Gn()),
(this.fa.u = a),
this.w(),
this.g('graduatedStart', b, a));
},
},
graduatedEnd: {
get: function() {
return null !== this.fa ? this.fa.j : 1;
},
set: function(a) {
var b = this.graduatedEnd;
b !== a &&
(0 > a ? (a = 0) : 1 < a && (a = 1),
null === this.fa && (this.fa = new Gn()),
(this.fa.j = a),
this.w(),
this.g('graduatedEnd', b, a));
},
},
graduatedSkip: {
get: function() {
return null !== this.fa ? this.fa.m : null;
},
set: function(a) {
var b = this.graduatedSkip;
b !== a &&
(null === this.fa && (this.fa = new Gn()),
(this.fa.m = a),
this.w(),
this.g('graduatedSkip', b, a));
},
},
});
Cf.prototype.intersectsRect = Cf.prototype.Sc;
Cf.prototype.containedInRect = Cf.prototype.Wg;
Cf.prototype.getNearestIntersectionPoint = Cf.prototype.Or;
Cf.prototype.getDocumentBounds = Cf.prototype.gi;
Cf.prototype.getDocumentPoint = Cf.prototype.ia;
var En = new Wa(),
zn = new Wa();
Cf.className = 'Shape';
Cf.getFigureGenerators = function() {
var a = new pb(),
b;
for (b in J.Oe) b !== b.toLowerCase() && a.add(b, J.Oe[b]);
a.freeze();
return a;
};
Cf.defineFigureGenerator = function(a, b) {
var c = a.toLowerCase(),
d = J.Oe;
d[a] = b;
d[c] = a;
};
Cf.getArrowheadGeometries = function() {
var a = new pb();
for (d in J.dm)
if (void 0 === En[d]) {
var b = O.parse(J.dm[d], !1);
En[d] = b;
b = d.toLowerCase();
b !== d && (En[b] = d);
}
for (var c in En)
if (c !== c.toLowerCase()) {
var d = En[c];
d instanceof O && a.add(c, d);
}
a.freeze();
return a;
};
Cf.defineArrowheadGeometry = function(a, b) {
var c = null;
'string' === typeof b ? (c = O.parse(b, !1)) : (c = b);
b = a.toLowerCase();
('none' !== b && a !== b) ||
C(
'Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: ' +
a,
);
var d = En;
d[a] = c;
d[b] = a;
};
function xn() {
this.ic = !1;
this.dr = 'butt';
this.er = 'miter';
this.fr = 10;
this.pj = 0;
this.Aq = null;
this.Mp = Xk;
this.Zf = this.Yf = Wc;
}
xn.prototype.copy = function() {
var a = new xn();
a.dr = this.dr;
a.er = this.er;
a.fr = this.fr;
a.pj = this.pj;
a.Aq = this.Aq;
a.Mp = this.Mp;
a.Yf = this.Yf.J();
a.Zf = this.Zf.J();
return a;
};
function Qg(a, b) {
Y.call(this);
Hn || ((In = Og ? new Bk(null).context : null), (Hn = !0));
this.o |= 2097152;
this.cc = '';
this.Nc = 'black';
this.re = '13px sans-serif';
this.kq = this.yb = this.dd = 0;
this.da = this.fa = this.om = this.rt = this.st = null;
this.zh = 0;
this.Te = null;
this.Ae = 0;
this.qe = this.Wb = this.Jc = null;
'string' === typeof a ? (this.text = a) : a && Object.assign(this, a);
b && Object.assign(this, b);
return this;
}
la(Qg, Y);
Qg.prototype.cloneProtected = function(a) {
Y.prototype.cloneProtected.call(this, a);
a.cc = this.cc;
a.Nc = this.Nc;
a.re = this.re;
a.dd = this.dd;
a.yb = this.yb;
a.kq = this.kq;
a.st = this.st;
a.rt = this.rt;
a.om = this.om;
null !== this.fa && (a.fa = this.fa.copy());
null !== this.da && (a.da = this.da.ic ? this.da : this.da.copy());
a.zh = this.zh;
a.Te = this.Te;
a.Ae = this.Ae;
a.Jc = this.Jc;
a.Wb = this.Wb;
a.qe = this.qe;
};
function Jn(a) {
null === a.da ? (a.da = new Rn()) : a.da.ic && (a.da = a.da.copy());
}
t = Qg.prototype;
t.ih = function() {
Y.prototype.ih.call(this);
null !== this.da && (this.da.ic = !0);
};
function Sm(a, b) {
a.o = b.o | 6144;
a.tb = b.opacity;
a.Yb = b.background;
a.areaBackground = b.areaBackground;
a.$c = b.desiredSize.J();
a.minSize = b.minSize.J();
a.maxSize = b.maxSize.J();
null !== b.Ib ? (a.Ib = b.Ib.copy()) : (a.Ib = null);
a.xa = b.scale;
a.Gb = b.angle;
a.stretch = b.stretch;
a.Ag = b.margin.J();
a.Fb = b.alignment.J();
a.fk = b.alignmentFocus.J();
a.segmentFraction = b.segmentFraction;
a.segmentOffset = b.segmentOffset.J();
a.segmentOrientation = b.segmentOrientation;
null !== b.ib && (a.ib = b.ib.copy());
a.shadowVisible = b.shadowVisible;
a.cc = b.cc;
a.Nc = b.Nc;
a.re = b.re;
null !== a.fa && (a.fa = b.fa.copy());
null !== b.da && (a.da = b.da.ic ? b.da : b.da.copy());
a.zh = b.zh;
}
t.ob = function(a) {
a.classType === Qg ? (this.wrap = a) : Y.prototype.ob.call(this, a);
};
t.toString = function() {
return 22 < this.cc.length
? 'TextBlock("' + this.cc.substring(0, 20) + '"...)'
: 'TextBlock("' + this.cc + '")';
};
t.w = function() {
Y.prototype.w.call(this);
this.rt = this.st = null;
};
t.ai = function(a, b) {
if (null !== this.Nc && 0 !== this.cc.length && null !== this.re) {
var c = this.naturalBounds,
d = this.actualBounds,
e = c.width,
f = c.height,
g = Sn(this),
h = (a.textAlign = this.textAlign),
k = b.$m;
'start' === h
? (h = k ? 'right' : 'left')
: 'end' === h && (h = k ? 'left' : 'right');
k = this.isUnderline;
var l = this.isStrikethrough;
gi(this, a, this.Nc, !0, !1, c, d);
(k || l) && gi(this, a, this.Nc, !1, !1, c, d);
d = 0;
c = !1;
var m = this.ge,
n = m.dx - (g * m.m21 + m.dx);
m = m.dy - (g * m.m22 + m.dy);
var p = b.scale;
8 > (n * n + m * m) * p * p && (c = !0);
b.Zb !== a && (c = !1);
!1 === b.Ge('textGreeking') && (c = !1);
b = this.spacingAbove;
n = this.spacingBelow;
switch (this.flip) {
case $k:
a.translate(e, 0);
a.scale(-1, 1);
break;
case Zk:
a.translate(0, f);
a.scale(1, -1);
break;
case al:
a.translate(e, f), a.scale(-1, -1);
}
a.Pc();
m = this.dd;
p = (b + g + n) * m;
f > p &&
((d = this.verticalAlignment), (d = d.y * f - d.y * p + d.offsetY));
if (1 === m && null !== this.qe)
(n = this.yb),
n > e && (n = e),
this.$h(this.qe, a, 0, d + b, e, g, n, c, h, k, l);
else if (null !== this.Jc && null !== this.Wb)
for (p = 0; p < m; p++) {
var r = this.Jc[p];
r > e && (r = e);
d += b;
this.$h(this.Wb[p], a, 0, d, e, g, r, c, h, k, l);
d += g + n;
}
switch (this.flip) {
case $k:
a.scale(-1, 1);
a.translate(-e, 0);
break;
case Zk:
a.scale(1, -1);
a.translate(0, -f);
break;
case al:
a.scale(-1, -1), a.translate(-e, -f);
}
}
};
t.$h = function(a, b, c, d, e, f, g, h, k, l, m) {
var n = 0;
h
? ('left' === k
? (n = 0)
: 'right' === k
? (n = e - g)
: 'center' === k && (n = (e - g) / 2),
b.fillRect(c + n, d + 0.25 * f, g, 1))
: ('left' === k
? (n = 0)
: 'right' === k
? (n = e)
: 'center' === k && (n = e / 2),
(e = null !== Tn ? Tn(this, f) : 0.75 * f),
b.fillText(a, c + n, d + e),
(a = (f / 20) | 0),
0 === a && (a = 1),
'right' === k ? (n -= g) : 'center' === k && (n -= g / 2),
l &&
((k = null !== Un ? Un(this, f) : 0.8 * f),
b.beginPath(),
(b.lineWidth = a),
b.moveTo(c + n, d + k),
b.lineTo(c + n + g, d + k),
b.stroke()),
m &&
(b.beginPath(),
(b.lineWidth = a),
(d = (d + f - f / 2.2) | 0),
0 !== a % 2 && (d += 0.5),
b.moveTo(c + n, d),
b.lineTo(c + n + g, d),
b.stroke()));
};
t.El = function(a, b, c, d) {
this.zh = a;
var e = this.re;
null !== In && Vn !== e && (Vn = In.font = e);
this.yb = this.Ae = 0;
this.qe = this.Wb = this.Jc = this.Te = null;
var f;
if (isNaN(this.desiredSize.width)) {
e = this.cc.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
if (0 === e.length) e = 0;
else if (this.isMultiline) {
for (var g = (f = 0), h = !1; !h; ) {
var k = e.indexOf('\n', g);
-1 === k && ((k = e.length), (h = !0));
g = e.substr(g, k - g);
this.formatting === Wn && (g = g.trim());
f = Math.max(f, Xn(g));
g = k + 1;
}
e = f;
} else
(f = e.indexOf('\n', 0)), 0 <= f && (e = e.substr(0, f)), (e = Xn(e));
e = Math.min(e, a / this.scale);
e = Math.max(8, e);
} else e = this.desiredSize.width;
null !== this.panel && (e = Math.min(e, this.panel.maxSize.width));
f = Yn(this, e);
isNaN(this.desiredSize.height)
? (f = Math.min(f, b / this.scale))
: (f = this.desiredSize.height);
h = f;
if (
0 !== this.yb &&
null !== this.Jc &&
null !== this.Wb &&
this.overflow === Zn &&
((b = this.re),
(b = this.overflow === Zn ? $n(b) : 0),
(k = this.spacingAbove + this.spacingBelow),
(k = Math.max(0, Sn(this) + k)),
(h = Math.min(
this.maxLines - 1,
Math.max(Math.floor(h / k + 0.01) - 1, 0),
)),
!(h + 1 >= this.Wb.length))
) {
k = this.Wb[h];
for (b = Math.max(1, a - b); Xn(k) > b && 1 < k.length; )
k = k.substr(0, k.length - 1);
k += ao;
b = Xn(k);
this.Wb[h] = k;
this.Wb = this.Wb.slice(0, h + 1);
this.Jc[h] = b;
this.Jc = this.Jc.slice(0, h + 1);
this.Ae = this.Wb.length;
this.yb = Math.max(this.yb, b);
this.dd = this.Ae;
1 === this.dd && (this.qe = this.Wb[0]);
}
if (this.wrap === bo || isNaN(this.desiredSize.width))
(e = isNaN(a) ? this.yb : Math.min(a, this.yb)),
isNaN(this.desiredSize.width) && (e = Math.max(8, e));
e = Math.max(c, e);
f = Math.max(d, f);
Qb(this.bc, e, f);
this.ve(0, 0, e, f);
};
t.Vg = function(a, b, c, d) {
kl(this, a, b, c, d);
};
function co(a, b, c) {
if (null === a.qe) (a.qe = b), (a.yb = c);
else {
if (null === a.Wb || null === a.Jc)
(a.Wb = []), (a.Jc = []), a.Wb.push(a.qe), a.Jc.push(a.yb);
a.Wb.push(b);
a.Jc.push(c);
}
}
function eo(a, b, c, d) {
var e = a.formatting === Wn;
e && (b = b.trim());
var f = 0,
g = a.re,
h = a.spacingAbove + a.spacingBelow;
h = Math.max(0, Sn(a) + h);
var k = a.overflow === Zn ? $n(g) : 0;
if (a.dd >= a.maxLines) null !== d && d.h(0, h);
else if (((g = b), a.wrap === fo)) {
a.Ae = 1;
var l = Xn(b);
if (0 === k || l <= c)
(a.yb = Math.max(a.yb, l)), co(a, b, a.yb), null !== d && d.h(l, h);
else {
f = go(a, g);
g = g.substr(f.length);
b = go(a, g);
for (l = Xn(f + b); 0 < b.length && l <= c; )
(f += b),
(g = g.substr(b.length)),
(b = go(a, g)),
(l = f + b),
e && (l = l.trim()),
(l = Xn(l));
e && (b = b.trim());
f += b;
for (c = Math.max(1, c - k); Xn(f) > c && 1 < f.length; )
f = f.substr(0, f.length - 1);
f += ao;
var m = Xn(f);
a.yb = m;
co(a, f, m);
null !== d && d.h(m, h);
}
} else {
k = 0;
0 === g.length && ((k = 1), co(a, g, 0));
for (; 0 < g.length; ) {
b = go(a, g);
for (g = g.substr(b.length); Xn(b) > c; ) {
var n = 1;
l = Xn(b.substr(0, n));
for (m = 0; l <= c; ) n++, (m = l), (l = Xn(b.substr(0, n)));
if (1 === n) {
var p = l;
f = Math.max(f, l);
} else (p = m), (f = Math.max(f, m));
n--;
1 > n && (n = 1);
co(a, b.substr(0, n), p);
k++;
b = b.substr(n);
if (a.dd + k > a.maxLines) break;
}
m = go(a, g);
for (l = Xn(b + m); 0 < m.length && l <= c; )
(b += m),
(g = g.substr(m.length)),
(m = go(a, g)),
(l = b + m),
e && (l = l.trim()),
(l = Xn(l));
e && (b = b.trim());
if (
'' !== b &&
('' === b[b.length - 1] && (b = b.substring(0, b.length - 1) + '‐'),
0 === m.length
? ((n = l), (f = Math.max(f, l)))
: ((n = m = Xn(b)), (f = Math.max(f, m))),
co(a, b, n),
k++,
a.dd + k > a.maxLines)
)
break;
}
a.Ae = Math.min(a.maxLines, k);
a.yb = Math.max(a.yb, f);
null !== d && d.h(a.yb, h * a.Ae);
}
}
function go(a, b) {
if (a.wrap === ho) return b.substr(0, 1);
for (var c = b.length, d = 0, e = io; d < c && !e.test(b.charAt(d)); ) d++;
for (
a.formatting === jo && (c = Math.min(c, d + 1));
d < c && e.test(b.charAt(d));
)
d++;
return d >= b.length ? b : b.substr(0, d);
}
function Xn(a) {
return null === In ? 8 * a.length : In.measureText(a).width;
}
function Sn(a) {
if (null !== a.Te) return a.Te;
var b = a.re;
if (null === In) {
var c = 16;
return (a.Te = c);
}
void 0 !== ko[b] && 5e3 > lo
? (c = ko[b])
: ((c = 1.3 * In.measureText('M').width), (ko[b] = c), lo++);
return (a.Te = c);
}
function $n(a) {
if (null === In) return 6;
if (void 0 !== mo[a] && 5e3 > no) var b = mo[a];
else (b = In.measureText(ao).width), (mo[a] = b), no++;
return b;
}
function Yn(a, b) {
var c = a.cc.replace(/\r\n/g, '\n').replace(/\r/g, '\n'),
d = a.spacingAbove + a.spacingBelow;
d = Math.max(0, Sn(a) + d);
if (0 === c.length) return (a.yb = 0), (a.dd = 1), d;
if (!a.isMultiline) {
var e = c.indexOf('\n', 0);
0 <= e && (c = c.substr(0, e));
}
e = 0;
for (var f = (a.dd = 0), g, h = !1; !h; ) {
g = c.indexOf('\n', f);
-1 === g && ((g = c.length), (h = !0));
if (f <= g) {
f = c.substr(f, g - f);
if (a.wrap !== fo) {
a.Ae = 0;
var k = K.alloc();
eo(a, f, b, k);
e += k.height;
K.free(k);
a.dd += a.Ae;
} else eo(a, f, b, null), (e += d), a.dd++;
a.dd === a.maxLines && (h = !0);
}
f = g + 1;
}
return (a.kq = e);
}
ma.Object.defineProperties(Qg.prototype, {
font: {
get: function() {
return this.re;
},
set: function(a) {
var b = this.re;
b !== a &&
((this.re = a), (this.Te = null), this.w(), this.g('font', b, a));
},
},
text: {
get: function() {
return this.cc;
},
set: function(a) {
var b = this.cc;
null !== a && void 0 !== a ? (a = a.toString()) : (a = '');
b !== a && ((this.cc = a), this.w(), this.g('text', b, a));
},
},
textAlign: {
get: function() {
return null !== this.da ? this.da.mr : 'start';
},
set: function(a) {
var b = this.textAlign;
b === a ||
('start' !== a &&
'end' !== a &&
'left' !== a &&
'right' !== a &&
'center' !== a) ||
(Jn(this), (this.da.mr = a), this.N(), this.g('textAlign', b, a));
},
},
flip: {
get: function() {
return null !== this.da ? this.da.Nf : lg;
},
set: function(a) {
var b = this.flip;
b !== a && (Jn(this), (this.da.Nf = a), this.N(), this.g('flip', b, a));
},
},
verticalAlignment: {
get: function() {
return null !== this.da ? this.da.xr : Zc;
},
set: function(a) {
var b = this.verticalAlignment;
b.C(a) ||
((a = a.J()),
Jn(this),
(this.da.xr = a),
Al(this),
this.g('verticalAlignment', b, a));
},
},
naturalBounds: {
get: function() {
if (!this.bc.v()) {
var a = K.alloc();
eo(this, this.cc, 999999, a);
var b = a.width;
K.free(a);
a = Yn(this, b);
var c = this.desiredSize;
isNaN(c.width) || (b = c.width);
isNaN(c.height) || (a = c.height);
Qb(this.bc, b, a);
}
return this.bc;
},
},
isMultiline: {
get: function() {
return 0 !== (this.o & 2097152);
},
set: function(a) {
var b = 0 !== (this.o & 2097152);
b !== a && ((this.o ^= 2097152), this.w(), this.g('isMultiline', b, a));
},
},
isUnderline: {
get: function() {
return 0 !== (this.o & 4194304);
},
set: function(a) {
var b = 0 !== (this.o & 4194304);
b !== a && ((this.o ^= 4194304), this.N(), this.g('isUnderline', b, a));
},
},
isStrikethrough: {
get: function() {
return 0 !== (this.o & 8388608);
},
set: function(a) {
var b = 0 !== (this.o & 8388608);
b !== a &&
((this.o ^= 8388608), this.N(), this.g('isStrikethrough', b, a));
},
},
wrap: {
get: function() {
return null !== this.da ? this.da.Ar : oo;
},
set: function(a) {
var b = this.wrap;
b !== a && (Jn(this), (this.da.Ar = a), this.w(), this.g('wrap', b, a));
},
},
overflow: {
get: function() {
return null !== this.da ? this.da.yq : po;
},
set: function(a) {
var b = this.overflow;
b !== a &&
(Jn(this), (this.da.yq = a), this.w(), this.g('overflow', b, a));
},
},
stroke: {
get: function() {
return this.Nc;
},
set: function(a) {
var b = this.Nc;
b !== a &&
(null !== a && Pl(a, 'TextBlock.stroke'),
a instanceof nl && a.freeze(),
(this.Nc = a),
this.N(),
this.g('stroke', b, a));
},
},
lineCount: {
get: function() {
return this.dd;
},
},
lineHeight: {
get: function() {
return Sn(this);
},
},
editable: {
get: function() {
return 0 !== (this.o & 1048576);
},
set: function(a) {
var b = 0 !== (this.o & 1048576);
b !== a && ((this.o ^= 1048576), this.g('editable', b, a));
},
},
textEditor: {
get: function() {
return null !== this.da ? this.da.pr : null;
},
set: function(a) {
var b = this.textEditor;
b !== a && (Jn(this), (this.da.pr = a), this.g('textEditor', b, a));
},
},
errorFunction: {
get: function() {
return null !== this.da ? this.da.zd : null;
},
set: function(a) {
var b = this.errorFunction;
b !== a && (Jn(this), (this.da.zd = a), this.g('errorFunction', b, a));
},
},
interval: {
get: function() {
return null !== this.fa ? this.fa.Ik : 1;
},
set: function(a) {
var b = this.interval;
a = Math.round(a);
if (b !== a && 0 !== a && isFinite(a)) {
null === this.fa && (this.fa = new Gn());
this.fa.Ik = a;
this.w();
var c = this.panel;
null !== c && (c.graduatedIntervals = null);
this.g('interval', b, a);
}
},
},
graduatedStart: {
get: function() {
return null !== this.fa ? this.fa.u : 0;
},
set: function(a) {
var b = this.graduatedStart;
b !== a &&
(0 > a ? (a = 0) : 1 < a && (a = 1),
null === this.fa && (this.fa = new Gn()),
(this.fa.u = a),
this.w(),
this.g('graduatedStart', b, a));
},
},
graduatedEnd: {
get: function() {
return null !== this.fa ? this.fa.j : 1;
},
set: function(a) {
var b = this.graduatedEnd;
b !== a &&
(0 > a ? (a = 0) : 1 < a && (a = 1),
null === this.fa && (this.fa = new Gn()),
(this.fa.j = a),
this.w(),
this.g('graduatedEnd', b, a));
},
},
graduatedFunction: {
get: function() {
return null !== this.fa ? this.fa.F : null;
},
set: function(a) {
var b = this.graduatedFunction;
b !== a &&
(null === this.fa && (this.fa = new Gn()),
(this.fa.F = a),
this.w(),
this.g('graduatedFunction', b, a));
},
},
graduatedSkip: {
get: function() {
return null !== this.fa ? this.fa.m : null;
},
set: function(a) {
var b = this.graduatedSkip;
b !== a &&
(null === this.fa && (this.fa = new Gn()),
(this.fa.m = a),
this.w(),
this.g('graduatedSkip', b, a));
},
},
textValidation: {
get: function() {
return null !== this.da ? this.da.qj : null;
},
set: function(a) {
var b = this.textValidation;
b !== a && (Jn(this), (this.da.qj = a), this.g('textValidation', b, a));
},
},
textEdited: {
get: function() {
return null !== this.da ? this.da.nr : null;
},
set: function(a) {
var b = this.textEdited;
b !== a && (Jn(this), (this.da.nr = a), this.g('textEdited', b, a));
},
},
spacingAbove: {
get: function() {
return null !== this.da ? this.da.$q : 0;
},
set: function(a) {
var b = this.spacingAbove;
b !== a &&
(Jn(this), (this.da.$q = a), this.w(), this.g('spacingAbove', b, a));
},
},
spacingBelow: {
get: function() {
return null !== this.da ? this.da.ar : 0;
},
set: function(a) {
var b = this.spacingBelow;
b !== a &&
(Jn(this), (this.da.ar = a), this.w(), this.g('spacingBelow', b, a));
},
},
formatting: {
get: function() {
return null !== this.da ? this.da.Jp : Wn;
},
set: function(a) {
var b = this.formatting;
b !== a &&
(Jn(this), (this.da.Jp = a), this.w(), this.g('formatting', b, a));
},
},
maxLines: {
get: function() {
return null !== this.da ? this.da.iq : Infinity;
},
set: function(a) {
var b = this.maxLines;
b !== a &&
((a = Math.floor(a)),
0 >= a && wa(a, '> 0', Qg, 'maxLines'),
Jn(this),
(this.da.iq = a),
this.w(),
this.g('maxLines', b, a));
},
},
metrics: {
get: function() {
return {
arrSize: null !== this.Jc ? this.Jc : [this.yb],
arrText: null !== this.Wb ? this.Wb : [this.qe],
maxLineWidth: this.yb,
fontHeight: this.Te,
};
},
},
choices: {
get: function() {
return this.om;
},
set: function(a) {
var b = this.om;
b !== a && ((this.om = a), this.g('choices', b, a));
},
},
});
var Tn = null,
Un = null,
fo = new D(Qg, 'None', 0),
bo = new D(Qg, 'WrapFit', 1),
oo = new D(Qg, 'WrapDesiredSize', 2),
ho = new D(Qg, 'WrapBreakAll', 3),
po = new D(Qg, 'OverflowClip', 0),
Zn = new D(Qg, 'OverflowEllipsis', 1),
Wn = new D(Qg, 'FormatTrim', 0),
jo = new D(Qg, 'FormatNone', 0),
io = /[ ]/,
ko = new Wa(),
lo = 0,
mo = new Wa(),
no = 0,
ao = '...',
Vn = '',
In = null,
Hn = !1;
Qg.className = 'TextBlock';
function Rn() {
this.ic = !1;
this.zd = null;
this.Nf = lg;
this.Jp = Wn;
this.iq = Infinity;
this.yq = po;
this.ar = this.$q = 0;
this.mr = 'start';
this.qj = this.pr = this.nr = null;
this.xr = Zc;
this.Ar = oo;
}
Rn.prototype.copy = function() {
var a = new Rn();
a.zd = this.zd;
a.Nf = this.Nf;
a.Jp = this.Jp;
a.iq = this.iq;
a.yq = this.yq;
a.$q = this.$q;
a.ar = this.ar;
a.mr = this.mr;
a.nr = this.nr;
a.pr = this.pr;
a.qj = this.qj;
a.xr = this.xr;
a.Ar = this.Ar;
return a;
};
Qg.getEllipsis = function() {
return ao;
};
Qg.setEllipsis = function(a) {
ao = a;
mo = new Wa();
no = 0;
};
Qg.getBaseline = function() {
return Tn;
};
Qg.setBaseline = function(a) {
Tn = a;
};
Qg.getUnderline = function() {
return Un;
};
Qg.setUnderline = function(a) {
Un = a;
};
Qg.isValidFont = function(a) {
Hn || ((In = Og ? new Bk(null).context : null), (Hn = !0));
if (null === In) return !0;
var b = In.font;
if (a === b || '10px sans-serif' === a) return !0;
In.font = '10px sans-serif';
In.font = a;
var c = In.font;
if ('10px sans-serif' !== c) return (In.font = b), !0;
In.font = '19px serif';
var d = In.font;
In.font = a;
c = In.font;
In.font = b;
return c !== d;
};
Qg.FormatNone = jo;
Qg.FormatTrim = Wn;
Qg.None = fo;
Qg.OverflowClip = po;
Qg.OverflowEllipsis = Zn;
Qg.WrapBreakAll = ho;
Qg.WrapDesiredSize = oo;
Qg.WrapFit = bo;
function Gn() {
this.Ik = 1;
this.u = 0;
this.j = 1;
this.m = this.F = null;
}
Gn.prototype.copy = function() {
var a = new Gn();
a.Ik = this.Ik;
a.u = this.u;
a.j = this.j;
a.F = this.F;
a.m = this.m;
return a;
};
Gn.className = 'GradElementSettings';
function Wj(a, b) {
Y.call(this);
this.vg = null;
this.Tn = '';
this.Ng = dc;
this.Ck = td;
this.Pg = this.zd = null;
this.Bk = yc;
this.Nf = lg;
this.kl = null;
this.Xm = !1;
this.Mm = !0;
this.Qk = !1;
this.gl = null;
'string' === typeof a ? (this.source = a) : a && Object.assign(this, a);
b && Object.assign(this, b);
}
var qo;
la(Wj, Y);
Wj.prototype.cloneProtected = function(a) {
Y.prototype.cloneProtected.call(this, a);
a.element = this.vg;
a.Tn = this.Tn;
a.Ng = this.Ng.J();
a.Ck = this.Ck;
a.Nf = this.Nf;
a.zd = this.zd;
a.Pg = this.Pg;
a.Bk = this.Bk.J();
a.Mm = this.Mm;
a.gl = this.gl;
};
Wj.prototype.ob = function(a) {
a === lg || a === ng || a === Yk
? (this.imageStretch = a)
: Y.prototype.ob.call(this, a);
};
Wj.prototype.toString = function() {
return 'Picture(' + this.source + ')#' + cb(this);
};
function Bi(a) {
void 0 === a && (a = '');
'' !== a ? qo[a] && (delete qo[a], ro--) : ((qo = new Wa()), (ro = 0));
}
function so(a, b) {
b.Wx ||
((b.fq = function(c) {
b.Up = !0;
b.Sm = !1;
var d = b.sg.copy();
if (null !== d && void 0 !== d) {
for (d = d.iterator; d.next(); ) {
var e = d.value;
var f = b.getAttribute('src') || '';
var g = e.Fg.I(f);
if (null !== g)
for (var h = g.length, k = 0; k < h; k++)
(f = g[k]),
e.Fn.add(f),
e.Mb(),
b.Pm &&
(void 0 === b.Kt && (b.Kt = c),
null !== f.Pg && f.Pg(f, c));
}
b.sg.clear();
}
a.desiredSize.v() || (ij(a, !1), a.w());
}),
(b.Bp = function(a) {
b.Sm = a;
var c = b.sg.copy();
if (null !== c && void 0 !== c) {
for (c = c.iterator; c.next(); ) {
var e = c.value,
f = b.getAttribute('src') || '';
var g = e.Fg.I(f);
if (null !== g) {
e = g.length;
f = Ea();
for (var h = 0; h < e; h++) f.push(g[h]);
if (b.Pm)
for (h = 0; h < e; h++) (g = f[h]), null !== g.zd && g.zd(g, a);
Ga(f);
}
}
b.sg.clear();
}
}),
b.addEventListener('load', b.fq),
b.addEventListener('error', b.Bp),
(b.Wx = !0));
}
function Yj(a) {
a.fq && a.removeEventListener('load', a.fq);
a.Bp && a.removeEventListener('error', a.Bp);
delete a.fq;
delete a.Bp;
}
Wj.prototype.Oz = function() {
if ('' !== this.source) {
Bi(this.source);
var a = this.source;
this.source = '';
this.source = a;
}
};
Wj.prototype.redraw = function() {
this.N();
};
Wj.prototype.ai = function(a, b) {
var c = this.vg;
if (null !== c) {
var d = c.getAttribute('src');
if (
!(
(c instanceof HTMLImageElement && (null === d || '' === d)) ||
(c.Sm instanceof Event && a instanceof vl)
)
) {
d = this.naturalBounds;
var e = 0,
f = 0,
g = this.Xm,
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.v() &&
((e = this.Ng.x),
(f = this.Ng.y),
(h = this.Ng.width),
(g = this.Ng.height));
var m = h,
n = g,
p = this.Ck,
r = this.Bk;
switch (p) {
case lg:
if (this.sourceRect.v()) 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 td:
m = d.width;
n = d.height;
break;
case ng:
case Yk:
p === ng
? ((p = Math.min(d.height / n, d.width / m)),
(m *= p),
(n *= p))
: p === Yk &&
((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.uf() * b.scale;
var q = m * p * n * p,
u = (h * g) / q,
w = c.__goCache;
p = null;
var v = to;
if (c.Up && void 0 !== w && 4 < q && u > v * v)
for (
null === w.Zh && (uo(w, 4, k, l, c), uo(w, 16, k, l, c)),
k = w.Zh,
l = k.length,
q = 0;
q < l;
q++
)
if (k[q].ratio * k[q].ratio < u) p = k[q];
else break;
if (!b.Fm) {
if (null === this.kl)
if (null === this.vg) this.kl = !1;
else {
k = new Bk(null).context;
try {
k.drawImage(this.vg, 0, 0);
} catch (z) {
this.Mm = !1;
}
try {
k.getImageData(0, 0, 1, 1).data[3] && (this.kl = !1),
(this.kl = !1);
} catch (z) {
this.kl = !0;
}
}
if (this.kl) 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 $k:
a.translate(Math.min(d.width, m), 0);
a.scale(-1, 1);
break;
case Zk:
a.translate(0, Math.min(d.height, n));
a.scale(1, -1);
break;
case al:
a.translate(Math.min(d.width, m), Math.min(d.height, n)),
a.scale(-1, -1);
}
a.Pc();
if (
b.Ge('pictureRatioOptimization') &&
!b.Vi &&
void 0 !== w &&
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.Mm = !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.Mm = !1;
}
switch (this.flip) {
case $k:
a.scale(-1, 1);
a.translate(-Math.min(d.width, m), 0);
break;
case Zk:
a.scale(1, -1);
a.translate(0, -Math.min(d.height, n));
break;
case al:
a.scale(-1, -1),
a.translate(-Math.min(d.width, m), -Math.min(d.height, n));
}
}
}
}
};
Wj.prototype.El = function(a, b, c, d) {
var e = this.desiredSize,
f = il(this, !0),
g = this.vg,
h = this.Xm;
if (h || (!this.Qk && g && g.complete)) this.Qk = !0;
null === g && (isFinite(e.width) || (a = 0), isFinite(e.height) || (b = 0));
isFinite(e.width) || f === td || f === Vk
? (isFinite(a) ||
(this.sourceRect.v()
? (a = this.sourceRect.width)
: null !== g && (a = h ? +g.width : g.naturalWidth)),
(c = 0))
: null !== g &&
!1 !== this.Qk &&
(a = this.sourceRect.v()
? this.sourceRect.width
: h
? +g.width
: g.naturalWidth);
isFinite(e.height) || f === td || f === Wk
? (isFinite(b) ||
(this.sourceRect.v()
? (b = this.sourceRect.height)
: null !== g && (b = h ? +g.height : g.naturalHeight)),
(d = 0))
: null !== g &&
!1 !== this.Qk &&
(b = this.sourceRect.v()
? 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 || 0, f.width);
d = Math.max(d || 0, 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));
Qb(this.bc, a, b);
this.ve(0, 0, a, b);
};
Wj.prototype.Vg = function(a, b, c, d) {
kl(this, a, b, c, d);
};
ma.Object.defineProperties(Wj.prototype, {
element: {
get: function() {
return this.vg;
},
set: function(a) {
var b = this.vg;
if (b !== a) {
this.Xm = a instanceof HTMLCanvasElement;
var c = a instanceof HTMLImageElement;
b instanceof HTMLImageElement && Yj(b);
null === a ||
c ||
a instanceof HTMLVideoElement ||
this.Xm ||
C(
'Picture.element must be an instance of Image, Canvas, or Video, not: ' +
a,
);
var d = this.diagram;
null !== d && Xj(d, this);
this.vg = a;
null !== a && c && void 0 === a.sg && (a.sg = new G());
null !== d && c && Vj(d, this);
null !== a &&
(this.Xm || !0 === a.complete
? (a.Pm &&
(a.Sm instanceof Event && null !== this.zd
? this.zd(this, a.Sm)
: !0 === a.Up &&
!a.Sm &&
null !== this.Pg &&
a.Kt &&
this.Pg(this, a.Kt)),
(a.Up = !0),
this.desiredSize.v() || (ij(this, !1), this.w()))
: c && so(this, a));
this.g('element', b, a);
this.N();
}
},
},
source: {
get: function() {
return this.Tn;
},
set: function(a) {
var b = this.Tn;
if (b !== a) {
this.Tn = a;
var c = qo;
if (Og) {
if (void 0 !== c[a]) var d = c[a];
else if ('' !== a) {
30 < ro && (Bi(), (c = qo));
d = ua('img');
d.Pm = !0;
so(this, d);
var e = this.gl;
null !== e && (d.crossOrigin = e(this));
d.src = a;
c[a] = d;
ro++;
}
this.element = d;
null !== d && void 0 === d.__goCache && (d.__goCache = new vo());
this.w();
this.N();
}
this.g('source', b, a);
}
},
},
sourceCrossOrigin: {
get: function() {
return this.gl;
},
set: function(a) {
if (this.gl !== a && ((this.gl = 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.Ng;
},
set: function(a) {
var b = this.Ng;
b.C(a) || ((this.Ng = a = a.J()), this.N(), this.g('sourceRect', b, a));
},
},
imageStretch: {
get: function() {
return this.Ck;
},
set: function(a) {
var b = this.Ck;
b !== a && ((this.Ck = a), this.N(), this.g('imageStretch', b, a));
},
},
flip: {
get: function() {
return this.Nf;
},
set: function(a) {
var b = this.Nf;
b !== a && ((this.Nf = a), this.N(), this.g('flip', b, a));
},
},
imageAlignment: {
get: function() {
return this.Bk;
},
set: function(a) {
var b = this.Bk;
b.C(a) ||
((this.Bk = a = a.J()), this.N(), this.g('imageAlignment', b, a));
},
},
errorFunction: {
get: function() {
return this.zd;
},
set: function(a) {
var b = this.zd;
b !== a && ((this.zd = a), this.g('errorFunction', b, a));
},
},
successFunction: {
get: function() {
return this.Pg;
},
set: function(a) {
var b = this.Pg;
b !== a && ((this.Pg = a), this.g('successFunction', b, a));
},
},
naturalBounds: {
get: function() {
return this.bc;
},
},
});
Wj.prototype.redraw = Wj.prototype.redraw;
Wj.prototype.reloadSource = Wj.prototype.Oz;
var ro = 0,
to = 4;
Wj.className = 'Picture';
qo = new Wa();
Wj.clearCache = Bi;
function vo() {
this.Zh = null;
}
function uo(a, b, c, d, e) {
null === a.Zh && (a.Zh = []);
var f = new Bk(null),
g = f.context,
h = 1 / b;
f.width = c / b;
f.height = d / b;
0 !== f.width &&
0 !== f.height &&
((b = new wo(f.Sa, b)),
(c = 1),
0 < a.Zh.length &&
((c = a.Zh[a.Zh.length - 1]), (e = c.source), (c = c.ratio)),
g.setTransform(h * c, 0, 0, h * c, 0, 0),
g.Pc(),
g.drawImage(e, 0, 0),
a.Zh.push(b));
}
vo.className = 'PictureCacheArray';
function wo(a, b) {
this.source = a;
this.ratio = b;
}
wo.className = 'PictureCacheInstance';
function xo() {
this.Lr = new O();
this.pc = null;
}
xo.prototype.reset = function(a) {
null !== a
? (a.ja(), (this.Lr = a), a.figures.clear())
: (this.Lr = new O());
this.pc = null;
};
function xd(a, b, c, d, e) {
a.pc = new Xd();
a.pc.startX = b;
a.pc.startY = c;
a.pc.isFilled = d;
a.Lr.figures.add(a.pc);
void 0 !== e && (a.pc.isShadowed = e);
}
function Gd(a) {
var b = a.pc.segments.length;
0 < b && a.pc.segments.K(b - 1).close();
}
xo.prototype.Xl = function(a) {
this.pc.isShadowed = a;
};
xo.prototype.moveTo = function(a, b, c) {
void 0 === c && (c = !1);
var d = new Yd(Jd);
d.endX = a;
d.endY = b;
c && d.close();
this.pc.segments.add(d);
};
xo.prototype.lineTo = function(a, b, c) {
void 0 === c && (c = !1);
var d = new Yd(vd);
d.endX = a;
d.endY = b;
c && d.close();
this.pc.segments.add(d);
};
function yd(a, b, c, d, e, f, g) {
var h;
void 0 === h && (h = !1);
var k = new Yd(Kd);
k.point1X = b;
k.point1Y = c;
k.point2X = d;
k.point2Y = e;
k.endX = f;
k.endY = g;
h && k.close();
a.pc.segments.add(k);
}
function zd(a, b, c, d, e) {
var f;
void 0 === f && (f = !1);
var g = new Yd(Ld);
g.point1X = b;
g.point1Y = c;
g.endX = d;
g.endY = e;
f && g.close();
a.pc.segments.add(g);
}
xo.prototype.arcTo = function(a, b, c, d, e, f, g) {
void 0 === f && (f = 0);
void 0 === g && (g = !1);
var h = new Yd(Md);
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.pc.segments.add(h);
};
function Ad(a, b, c, d, e, f, g, h) {
var k;
void 0 === k && (k = !1);
b = new Yd(Qd, g, h, b, c, d, e, f);
k && b.close();
a.pc.segments.add(b);
}
function wd(a) {
var b = Hd;
if (null !== b) return (Hd = null), b.reset(a), b;
b = new xo();
b.reset(a);
return b;
}
var Hd = null;
xo.className = 'StreamGeometryContext';
function yo(a, b) {
var c = a.toLowerCase(),
d = J.Oe;
d[a] = b;
d[c] = a;
}
yo('Rectangle', function(a, b, c) {
a = 'r' + b + ',' + c;
var d = J.Df[a];
if (void 0 !== d) return d;
d = new O(O.u);
d.endX = b;
d.endY = c;
J.Ef < J.em && ((J.Df[a] = d), J.Ef++);
return d;
});
yo('Square', function(a, b, c) {
a = 's' + b + ',' + c;
var d = J.Df[a];
if (void 0 !== d) return d;
d = new O(O.u);
d.endX = b;
d.endY = c;
d.defaultStretch = ng;
J.Ef < J.em && ((J.Df[a] = d), J.Ef++);
return d;
});
yo('RoundedRectangle', function(a, b, c) {
a = a ? a.parameter1 : NaN;
if (isNaN(a) || 0 > a) a = 5;
a = Math.min(a, b / 3);
a = Math.min(a, c / 3);
var d = 'rr' + b + ',' + c + ',' + a,
e = J.Df[d];
if (void 0 !== e) return e;
var f = a * J.ng;
e = new O().add(
new Xd(a, 0, !0)
.add(new Yd(vd, b - a, 0))
.add(new Yd(Kd, b, a, b - f, 0, b, f))
.add(new Yd(vd, b, c - a))
.add(new Yd(Kd, b - a, c, b, c - f, b - f, c))
.add(new Yd(vd, a, c))
.add(new Yd(Kd, 0, c - a, f, c, 0, c - f))
.add(new Yd(vd, 0, a))
.add(new Yd(Kd, a, 0, 0, f, f, 0).close()),
);
1 < f && ((e.spot1 = new N(0, 0, f, f)), (e.spot2 = new N(1, 1, -f, -f)));
J.Ef < J.em && ((J.Df[d] = e), J.Ef++);
return e;
});
yo('Border', 'RoundedRectangle');
yo('Ellipse', function(a, b, c) {
a = 'e' + b + ',' + c;
var d = J.Df[a];
if (void 0 !== d) return d;
d = new O(O.F);
d.endX = b;
d.endY = c;
d.spot1 = gd;
d.spot2 = hd;
J.Ef < J.em && ((J.Df[a] = d), J.Ef++);
return d;
});
yo('Circle', function(a, b, c) {
a = 'c' + b + ',' + c;
var d = J.Df[a];
if (void 0 !== d) return d;
d = new O(O.F);
d.endX = b;
d.endY = c;
d.spot1 = gd;
d.spot2 = hd;
d.defaultStretch = ng;
J.Ef < J.em && ((J.Df[a] = d), J.Ef++);
return d;
});
yo('TriangleRight', function(a, b, c) {
return new O()
.add(
new Xd(0, 0).add(new Yd(vd, b, 0.5 * c)).add(new Yd(vd, 0, c).close()),
)
.Yl(0, 0.25, 0.5, 0.75);
});
yo('TriangleDown', function(a, b, c) {
return new O()
.add(
new Xd(0, 0).add(new Yd(vd, b, 0)).add(new Yd(vd, 0.5 * b, c).close()),
)
.Yl(0.25, 0, 0.75, 0.5);
});
yo('TriangleLeft', function(a, b, c) {
return new O()
.add(
new Xd(b, c).add(new Yd(vd, 0, 0.5 * c)).add(new Yd(vd, b, 0).close()),
)
.Yl(0.5, 0.25, 1, 0.75);
});
yo('TriangleUp', function(a, b, c) {
return new O()
.add(
new Xd(b, c).add(new Yd(vd, 0, c)).add(new Yd(vd, 0.5 * b, 0).close()),
)
.Yl(0.25, 0.5, 0.75, 1);
});
yo('Triangle', 'TriangleUp');
yo('Diamond', function(a, b, c) {
return new O()
.add(
new Xd(0.5 * b, 0)
.add(new Yd(vd, 0, 0.5 * c))
.add(new Yd(vd, 0.5 * b, c))
.add(new Yd(vd, b, 0.5 * c).close()),
)
.Yl(0.25, 0.25, 0.75, 0.75);
});
yo('LineH', function(a, b, c) {
a = new O(O.j);
a.startX = 0;
a.startY = c / 2;
a.endX = b;
a.endY = c / 2;
return a;
});
yo('LineV', function(a, b, c) {
a = new O(O.j);
a.startX = b / 2;
a.startY = 0;
a.endX = b / 2;
a.endY = c;
return a;
});
yo('None', 'Rectangle');
yo('BarH', 'Rectangle');
yo('BarV', 'Rectangle');
yo('MinusLine', 'LineH');
yo('PlusLine', function(a, b, c) {
return new O().add(
new Xd(0, c / 2, !1)
.add(new Yd(vd, b, c / 2))
.add(new Yd(Jd, b / 2, 0))
.add(new Yd(vd, b / 2, c)),
);
});
yo('XLine', function(a, b, c) {
return new O().add(
new Xd(0, c, !1)
.add(new Yd(vd, b, 0))
.add(new Yd(Jd, 0, 0))
.add(new Yd(vd, b, c)),
);
});
yo('LineRight', function(a, b, c) {
return new O().add(
new Xd(0.25 * b, 0, !1)
.add(new Yd(vd, 0.75 * b, 0.5 * c))
.add(new Yd(vd, 0.25 * b, c)),
);
});
yo('LineDown', function(a, b, c) {
return new O().add(
new Xd(0, 0.25 * c, !1)
.add(new Yd(vd, 0.5 * b, 0.75 * c))
.add(new Yd(vd, b, 0.25 * c)),
);
});
yo('LineLeft', function(a, b, c) {
return new O().add(
new Xd(0.75 * b, 0, !1)
.add(new Yd(vd, 0.25 * b, 0.5 * c))
.add(new Yd(vd, 0.75 * b, c)),
);
});
yo('LineUp', function(a, b, c) {
return new O().add(
new Xd(0, 0.75 * c, !1)
.add(new Yd(vd, 0.5 * b, 0.25 * c))
.add(new Yd(vd, b, 0.75 * c)),
);
});
J.dm = {
'': '',
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 zo() {
this.ic = !1;
this.Qq = this.np = this.Zp = null;
this.Sq = '';
this.Eq = this.Qp = this.Rq = null;
this.Gq = '';
this.Fq = Mb;
this.Hq = null;
this.Iq = '';
this.Kq = Wc;
this.gq = '';
this.hq = tc;
this.oq = rb;
this.jq = sb;
this.yp = null;
this.bq = 127;
this.Wq = tb;
this.Vq = 'gray';
this.Lg = 4;
}
zo.prototype.copy = function() {
var a = new zo();
a.Zp = this.Zp;
a.np = this.np;
a.Qq = this.Qq;
a.Sq = this.Sq;
a.Rq = this.Rq;
a.Qp = this.Qp;
a.Eq = this.Eq;
a.Gq = this.Gq;
a.Fq = this.Fq.J();
a.Hq = this.Hq;
a.Iq = this.Iq;
a.Kq = this.Kq.J();
a.gq = this.gq;
a.hq = this.hq.J();
a.oq = this.oq.J();
a.jq = this.jq.J();
a.yp = this.yp;
a.bq = this.bq;
a.Wq = this.Wq.J();
a.Vq = this.Vq;
a.Lg = this.Lg;
return a;
};
function U(a, b) {
void 0 === a || a instanceof Ll || 'string' === typeof a
? W.call(this, a)
: (W.call(this), a && (b = a));
this.G = 2408959;
this.Jf = '';
this.O = null;
this.zg = '';
this.Hf = this.Kg = null;
this.cc = '';
this.ph = this.Ah = null;
this.de = new I(NaN, NaN).freeze();
this.af = null;
this.eo = NaN;
this.aw = -1;
this.Vx = new M();
this.Kh = null;
this.Sf = NaN;
b && Object.assign(this, b);
}
la(U, W);
U.prototype.cloneProtected = function(a) {
W.prototype.cloneProtected.call(this, a);
a.G = (this.G & -4097) | 49152;
a.Jf = this.Jf;
null !== this.O && (a.O = this.O.ic ? this.O : this.O.copy());
a.zg = this.zg;
a.Hf = null;
a.cc = this.cc;
a.de.assign(this.de);
a.eo = this.eo;
};
t = U.prototype;
t.qf = function(a) {
W.prototype.qf.call(this, a);
a.dh();
a.Kg = null;
a.af = null;
a.Kh = null;
};
t.toString = function() {
var a = Ha(this.constructor) + '#' + cb(this);
null !== this.data && (a += '(' + Ia(this.data) + ')');
return a;
};
function Ao(a) {
null === a.O ? (a.O = new zo()) : a.O.ic && (a.O = a.O.copy());
}
t.ih = function() {
W.prototype.ih.call(this);
null !== this.O && (this.O.ic = !0);
};
t.$j = function(a, b, c, d, e, f, g) {
var h = this.diagram;
null !== h &&
(a === fe && 'elements' === b
? e instanceof W
? Aj(e, function(a) {
Cj(h.partManager, a);
Bj(h, a);
})
: Vj(h, e)
: a === ge &&
'elements' === b &&
(e instanceof W
? Aj(e, function(a) {
Fj(h.partManager, a, h);
})
: Xj(h, e)),
h.bb(a, b, c, d, e, f, g));
};
t.Ka = function(a) {
W.prototype.Ka.call(this, a);
if (null !== this.data) {
for (var b = this.R.s, c = b.length, d = 0; d < c; d++) {
var e = b[d];
e instanceof W &&
Aj(e, function(a) {
null !== a.data && a.Ka();
});
}
for (b = this.adornments; b.next(); ) b.value.Ka(a);
}
};
U.prototype.updateRelationshipsFromData = function() {
var a;
null !== this.data &&
(null === (a = this.diagram) || void 0 === a
? void 0
: a.partManager.updateRelationshipsFromData(this));
};
U.prototype.Hj = function(a) {
var b = this.Hf;
return null === b ? null : b.I(a);
};
U.prototype.Tg = function(a, b) {
if (null !== b) {
var c = null,
d = this.Hf;
null !== d && (c = d.I(a));
if (c !== b) {
if (null !== c) {
var e = c.diagram;
null !== e && e.remove(c);
}
null === d && (this.Hf = d = new pb());
b.Jf !== a && (b.category = a);
d.add(a, b);
a = this.diagram;
null !== a &&
(a.add(b),
(a = b.adornedObject),
null !== a && ((a = a.Yg()), null !== a && (b.data = a.data)));
}
}
};
U.prototype.Af = function(a) {
var b = this.Hf;
if (null !== b) {
var c = b.I(a);
if (null !== c) {
var d = c.diagram;
null !== d && d.remove(c);
}
b.remove(a);
0 === b.count && (this.Hf = null);
}
};
U.prototype.zj = function() {
var a = this.Hf;
if (null !== a) {
var b = Ea();
for (a = a.iterator; a.next(); ) b.push(a.key);
a = b.length;
for (var c = 0; c < a; c++) this.Af(b[c]);
Ga(b);
}
};
U.prototype.updateAdornments = function() {
var a = this.diagram;
if (null !== a) {
for (var b = this.adornments; b.next(); ) {
var c = b.value;
c.w();
c.placeholder && c.placeholder.w();
}
a: {
if (
this.isSelected &&
this.selectionAdorned &&
((b = this.selectionObject),
null !== b &&
this.actualBounds.v() &&
this.isVisible() &&
b.zf() &&
b.actualBounds.v())
) {
c = this.Hj('Selection');
if (null === c) {
c = this.selectionAdornmentTemplate;
null === c &&
(c = this.eh()
? a.linkSelectionAdornmentTemplate
: this instanceof qf
? a.groupSelectionAdornmentTemplate
: a.nodeSelectionAdornmentTemplate);
if (!(c instanceof ue)) break a;
kg(c);
c = c.copy();
null !== c &&
(this.eh() &&
this.selectionObject === this.path &&
(c.type = W.Link),
(c.adornedObject = b));
}
if (null !== c) {
c.type === W.Link && c.w();
this.Tg('Selection', c);
break a;
}
}
this.Af('Selection');
}
Bo(this, a);
for (b = this.adornments; b.next(); ) b.value.Ka();
}
};
U.prototype.Rb = function() {
var a = this.diagram;
null !== a &&
(Ri(a), (0 !== (this.G & 16384)) !== !0 && ((this.G |= 16384), a.Mb()));
};
function ei(a) {
(0 !== (a.G & 16384)) !== !1 && (a.updateAdornments(), (a.G &= -16385));
}
function Bo(a, b) {
b.toolManager.mouseDownTools.each(function(b) {
b.isEnabled && b.updateAdornments(a);
});
b.toolManager.updateAdornments(a);
}
function Co(a) {
if (!1 === pj(a)) {
Do(a, !0);
a.Jk();
var b = a.diagram;
null !== b && (b.te.add(a), b.Mb());
}
}
function Eo(a) {
a.G |= 2097152;
if (!1 !== pj(a)) {
var b = a.position,
c = a.location;
(c.v() && b.v()) || Fo(a, b, c);
c = a.Eb;
var d = M.alloc().assign(c);
c.ja();
c.x = b.x;
c.y = b.y;
c.freeze();
a.Fl(d, c);
M.free(d);
Do(a, !1);
}
}
U.prototype.ve = function(a, b, c, d) {
var e = this.qc;
e.h(a, b, c, d);
null === this.Ib && (this.Ib = new md());
var f = this.Ib;
f.reset();
this.Qn(f, a, b, c, d);
this.Ib = f;
f.Ur() || f.So(e);
};
U.prototype.Qn = function(a, b, c, d, e) {
1 !== this.xa && a.scale(this.xa);
if (0 !== this.Gb) {
var f = yc;
this.locationSpot.pb() && (f = this.locationSpot);
var g = I.alloc();
if (this.locationObject !== this)
for (
b = this.locationObject,
c = b.naturalBounds,
g.pi(c.x, c.y, c.width, c.height, f),
null !== b.Ib && b.Ib.Fa(g),
g.offset(-b.measuredBounds.x, -b.measuredBounds.y),
f = b.panel;
null !== f && f !== this;
)
null !== f.Ib && f.Ib.Fa(g),
g.offset(-f.measuredBounds.x, -f.measuredBounds.y),
(f = f.panel);
else g.pi(b, c, d, e, f);
a.rotate(this.Gb, g.x, g.y);
I.free(g);
}
};
U.prototype.move = function(a, b) {
!0 === b ? (this.location = a) : (this.position = a);
};
U.prototype.moveTo = function(a, b, c) {
a = I.allocAt(a, b);
this.move(a, c);
I.free(a);
};
U.prototype.isVisible = function() {
if (!this.visible) return !1;
var a = this.layer;
if (null !== a) {
if (!a.visible) return !1;
a = a.diagram;
if (null !== a && a.animationManager.es(this)) return !0;
}
a = this.containingGroup;
return null === a || (a.isSubGraphExpanded && a.isVisible()) ? !0 : !1;
};
U.prototype.Ub = function(a) {
var b = this.diagram;
a
? (this.D(4), this.Rb(), null !== b && b.te.add(this))
: (this.D(8), this.zj());
this.dh();
null !== b && (b.Va(), b.N());
};
U.prototype.fb = function(a) {
if (this.name === a) return this;
var b = this.Kh;
null === b && (this.Kh = b = new pb());
if (null !== b.I(a)) return b.I(a);
var c = W.prototype.fb.call(this, a);
if (null !== c) return b.set(a, c), c;
b.set(a, null);
return null;
};
function Go(a, b, c, d) {
void 0 === d && (d = new I());
c = c.Fc() ? yc : c;
var e = b.naturalBounds;
d.h(e.width * c.x + c.offsetX, e.height * c.y + c.offsetY);
if (null === b || b === a) return d;
b.transform.Fa(d);
for (b = b.panel; null !== b && b !== a; ) b.transform.Fa(d), (b = b.panel);
null !== a.Ib && a.Ib.Fa(d);
d.offset(-a.qc.x, -a.qc.y);
return d;
}
U.prototype.gi = function(a) {
void 0 === a && (a = new M());
return a.assign(this.actualBounds);
};
U.prototype.Za = function() {
!0 === nj(this) && this.measure(Infinity, Infinity);
this.arrange();
};
function yj(a, b) {
var c = a.Vx;
isNaN(a.Sf) && (a.Sf = cn(a));
var d = a.Sf;
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;
}
U.prototype.arrange = function() {
if (!1 === oj(this)) Eo(this);
else {
jl(this, !1);
var a = this.Eb,
b = M.alloc();
b.assign(a);
var c = ig(this);
this.Vg(0, 0, this.qc.width, this.qc.height);
var d = this.position;
Fo(this, d, this.location);
a.ja();
a.x = d.x;
a.y = d.y;
a.freeze();
this.Fl(b, a);
b.C(a)
? this.Pd(c)
: !this.Tc() ||
(J.B(b.width, a.width) && J.B(b.height, a.height)) ||
(0 <= this.aw && this.D(16));
M.free(b);
Do(this, !1);
}
};
t = U.prototype;
t.Fl = function(a, b) {
var c = this.diagram;
if (null !== c) {
var d = !1;
if (!1 === c.Si && a.v()) {
var e = M.alloc();
e.assign(c.documentBounds);
e.jv(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);
M.free(e);
}
((0 !== (this.G & 65536)) !== !0 && a.C(b)) || Dj(this, d, c);
c.N();
(!a.v() && !b.v()) ||
Tb(a, b) ||
(this instanceof V && !c.undoManager.isUndoingRedoing && this.vd(),
this.dh());
}
};
t.fv = function(a, b, c) {
if (this.eh() || !a.v()) return !1;
var d = this.diagram;
null !== d && Ho(this, d, a, b, c);
this.pa = a;
this.G &= -2097153;
!this.de.v() ||
(null !== d &&
!d.animationManager.isTicking &&
d.undoManager.isUndoingRedoing) ||
((d = this.de),
(this.de = new I(d.x + (a.x - b), d.y + (a.y - c))),
this.g('location', d, this.de.copy()));
!1 === pj(this) && !1 === oj(this) && (Co(this), Eo(this));
return !0;
};
function Ho(a, b, c, d, e) {
null === b ||
a instanceof ue ||
((b = b.animationManager), b.zb && xh(b, a, new I(d, e), c));
}
t.Ul = function(a, b, c) {
var d = this.de,
e = this.pa;
if (c) {
if (d.x === a && d.y === b) return;
pj(this) || oj(this) ? e.h(NaN, NaN) : e.h(e.x + a - d.x, e.y + b - d.y);
d.h(a, b);
} else {
if (e.x === a && e.y === b) return;
pj(this) || oj(this) ? this.ns() : d.h(d.x + a - e.x, d.y + b - e.y);
e.h(a, b);
}
Co(this);
};
t.ns = function() {
this.G &= -2097153;
Co(this);
};
function Fo(a, b, c) {
var d = I.alloc(),
e = a.locationObject,
f = e.naturalBounds,
g = e instanceof Cf ? e.strokeWidth : 0;
d.pi(0, 0, f.width + g, f.height + g, a.locationSpot);
if (e !== a)
for (
d.offset(-g / 2, -g / 2), e.transform.Fa(d), e = e.panel;
null !== e && e !== a;
)
e.transform.Fa(d), (e = e.panel);
null !== a.Ib && a.Ib.Fa(d);
d.offset(-a.qc.x, -a.qc.y);
e = a.diagram;
f = c.v();
g = b.v();
f && g
? 0 !== (a.G & 2097152)
? Io(a, b, c, e, d)
: Jo(a, b, c, e, d)
: f
? Io(a, b, c, e, d)
: g && Jo(a, b, c, e, d);
a.G |= 2097152;
I.free(d);
a.Jk();
}
function Io(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),
(d = c.defaultAnimation.isAnimating) ||
!c.zb ||
a instanceof ue ||
xh(c, a, new I(f, g), b),
d || (b.x === f && b.y === g) || a.g('position', new I(f, g), b.copy()));
}
function Jo(a, b, c, d, e) {
var f = c.copy();
c.h(b.x + e.x, b.y + e.y);
c.C(f) || null === d || a.g('location', f, c.copy());
}
function Dj(a, b, c) {
ll(a, !1);
a instanceof V && lk(c, a);
a.layer.isTemporary || b || c.Va();
b = a.Eb;
var d = c.viewportBounds;
d.v()
? ig(a)
? (Yb(b, d) || a.Pd(!1), a.updateAdornments())
: b.Sc(d)
? (a.Pd(!0), a.updateAdornments())
: a.Rb()
: (c.Ui = !0);
}
t.mi = function() {
return !0;
};
t.Tc = function() {
return !0;
};
t.eh = function() {
return !1;
};
t.li = function() {
return !0;
};
function Ko(a, b, c, d) {
b.constructor === a.constructor ||
Lo ||
((Lo = !0),
xa(
'Should not change the class of the Part when changing category from "' +
c +
'" to "' +
d +
'"',
),
xa(
' Old class: ' +
Ha(a.constructor) +
', new class: ' +
Ha(b.constructor) +
', part: ' +
a.toString(),
));
a.zj();
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.qf(a);
b.cloneProtected(a);
a.Jf = d;
a.w();
a.N();
b = a.diagram;
d = !0;
null !== b && ((d = b.skipsUndoManager), (b.skipsUndoManager = !0));
a.qb = e;
a.G = f ? a.G | 4096 : a.G & -4097;
a.G = g ? a.G | 524288 : a.G & -524289;
a instanceof V &&
((a.U = h ? a.U | 4 : a.U & -5),
(a.U = k ? a.U | 1 : a.U & -2),
(a.U = l ? a.U | 2 : a.U & -3));
null !== e && a.Ka();
e = a.layerName;
e !== c && ((a.zg = c), (a.layerName = e));
null !== b && (b.skipsUndoManager = d);
a.Tc() && a.D(64);
}
U.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;
};
U.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;
};
U.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;
};
U.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;
};
U.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;
};
U.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;
};
U.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;
};
U.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;
};
U.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 pj(a) {
return 0 !== (a.G & 32768);
}
function Do(a, b) {
a.G = b ? a.G | 32768 : a.G & -32769;
}
function ll(a, b) {
a.G = b ? a.G | 65536 : a.G & -65537;
}
function ig(a) {
return 0 !== (a.G & 131072);
}
t = U.prototype;
t.Pd = function(a) {
this.G = a ? this.G | 131072 : this.G & -131073;
};
function Mo(a, b) {
a.G = b ? a.G | 1048576 : a.G & -1048577;
}
t.dh = function() {
var a = this.containingGroup;
null !== a && (a.w(), null !== a.placeholder && a.placeholder.w(), a.vd());
};
t.N = function() {
var a = this.diagram;
null !== a &&
!oj(this) &&
!pj(this) &&
this.isVisible() &&
this.Eb.v() &&
a.N(yj(this, this.Eb));
};
t.w = function() {
W.prototype.w.call(this);
var a = this.diagram;
null !== a &&
(a.te.add(this),
this instanceof V && null !== this.labeledLink && Al(this.labeledLink),
a.Mb(!0));
};
t.yo = function(a) {
a || ((a = this.ph), null !== a && No(a, this));
};
t.zo = function(a) {
a || ((a = this.ph), null !== a && Oo(a, this));
};
t.Fj = function() {
var a = this.data;
if (null !== a) {
var b = this.diagram;
null !== b && ((b = b.model), null !== b && b.Kl(a));
}
};
t.Xy = function() {
return Po(this, this);
};
function Po(a, b) {
var c = b.containingGroup;
return null !== c
? 1 + Po(a, c)
: b instanceof V && ((b = b.labeledLink), null !== b)
? Po(a, b)
: 0;
}
t.az = function() {
return Qo(this, this);
};
function Qo(a, b) {
var c = b.containingGroup;
return null !== c || (b instanceof V && ((c = b.labeledLink), null !== c))
? Qo(a, c)
: b;
}
t.Md = function(a) {
return a instanceof qf ? Ro(this, this, a) : !1;
};
function Ro(a, b, c) {
if (b === c || null === c) return !1;
var d = b.containingGroup;
return null === d || (d !== c && !Ro(a, d, c))
? b instanceof V && ((b = b.labeledLink), null !== b)
? Ro(a, b, c)
: !1
: !0;
}
t.Sw = function(a) {
if (null === a) return null;
if (this === a) return this.containingGroup;
for (var b = this; null !== b; ) {
b instanceof qf && Mo(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.G & 1048576)) {
c = b;
break;
}
b instanceof V && ((a = b.labeledLink), null !== a && (b = a));
b = b.containingGroup;
}
for (b = this; null !== b; )
b instanceof qf && Mo(b, !1),
b instanceof V && ((a = b.labeledLink), null !== a && (b = a)),
(b = b.containingGroup);
return c;
};
U.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;
};
U.prototype.D = 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.ph), null !== b)) {
var c = b.layout;
null !== c ? c.D() : b.D(a);
} else
(a = this.diagram), null !== a && ((a = a.layout), null !== a && a.D());
};
function Ej(a) {
if (!a.isVisible()) return !1;
a = a.layer;
return null !== a && a.isTemporary ? !1 : !0;
}
function Sk(a, b, c, d, e, f) {
void 0 === f && (f = null);
if (!(a.contains(b) || (null !== f && !f(b)) || b instanceof ue))
if ((a.add(b), b instanceof V)) {
if (c && b instanceof qf)
for (var g = b.memberParts; g.next(); ) Sk(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) && Sk(a, h, c, d, e, f);
}
}
if (1 < d) for (b = b.Au(); b.next(); ) Sk(a, b.value, c, d - 1, e, f);
} else if (b instanceof T)
for (b = b.labelNodes; b.next(); ) Sk(a, b.value, c, d, e, f);
}
ma.Object.defineProperties(U.prototype, {
key: {
get: function() {
var a = this.diagram;
if (null !== a) return a.model.ua(this.data);
},
},
adornments: {
get: function() {
return null === this.Hf ? Za : this.Hf.iteratorValues;
},
},
layer: {
get: function() {
return this.Ah;
},
},
diagram: {
get: function() {
var a = this.Ah;
return null === a || void 0 === a ? null : a.diagram;
},
},
layerName: {
get: function() {
return this.zg;
},
set: function(a) {
var b = this.zg;
if (b !== a) {
var c = this.diagram;
if (
null === c ||
(null !== c.Ij(a) && !c.partManager.addsToTemporaryLayer)
)
if (
((this.zg = a),
null !== c && c.Va(),
this.g('layerName', b, a),
(b = this.layer),
null !== b &&
b.name !== a &&
((c = b.diagram),
null !== c && ((a = c.Ij(a)), null !== a && a !== b)))
) {
var d = b.lc(-1, this, !0);
0 <= d && c.bb(ge, 'parts', b, this, null, d, !0);
d = a.ii(99999999, this, !0);
b.visible !== a.visible && this.Ub(a.visible);
0 <= d && c.bb(fe, 'parts', a, null, this, !0, d);
d = this.layerChanged;
if (null !== d) {
var e = c.$;
c.$ = !0;
d(this, b, a);
c.$ = e;
}
}
}
},
},
layerChanged: {
get: function() {
return null !== this.O ? this.O.Zp : null;
},
set: function(a) {
var b = this.layerChanged;
b !== a && (Ao(this), (this.O.Zp = a), this.g('layerChanged', b, a));
},
},
zOrder: {
get: function() {
return this.eo;
},
set: function(a) {
var b = this.eo;
if (b !== a) {
this.eo = a;
var c = this.layer;
null !== c && hi(c, -1, this);
this.g('zOrder', b, a);
a = this.diagram;
null !== a && a.N();
}
},
},
locationObject: {
get: function() {
if (null === this.af) {
var a = this.locationObjectName;
'' !== a
? ((a = this.fb(a)), null !== a ? (this.af = a) : (this.af = this))
: this instanceof ue
? this.type !== W.Link && null !== this.placeholder
? (this.af = this.placeholder)
: (this.af = this)
: (this.af = this);
}
return this.af.visible ? this.af : this;
},
},
minLocation: {
get: function() {
return null !== this.O ? this.O.oq : rb;
},
set: function(a) {
var b = this.minLocation;
b.C(a) ||
((a = a.J()), Ao(this), (this.O.oq = a), this.g('minLocation', b, a));
},
},
maxLocation: {
get: function() {
return null !== this.O ? this.O.jq : sb;
},
set: function(a) {
var b = this.maxLocation;
b.C(a) ||
((a = a.J()), Ao(this), (this.O.jq = a), this.g('maxLocation', b, a));
},
},
locationObjectName: {
get: function() {
return null !== this.O ? this.O.gq : '';
},
set: function(a) {
var b = this.locationObjectName;
b !== a &&
(Ao(this),
(this.O.gq = a),
(this.af = null),
this.w(),
this.g('locationObjectName', b, a));
},
},
locationSpot: {
get: function() {
return null !== this.O ? this.O.hq : tc;
},
set: function(a) {
var b = this.locationSpot;
b.C(a) ||
((a = a.J()),
Ao(this),
(this.O.hq = a),
this.w(),
this.g('locationSpot', b, a));
},
},
location: {
get: function() {
return this.de;
},
set: function(a) {
var b = a.x,
c = a.y,
d = this.de;
if (
!(d.x === b || (isNaN(d.x) && isNaN(b))) ||
!(d.y === c || (isNaN(d.y) && isNaN(c)))
) {
a = a.copy();
b = a;
if (this.eh()) b = !1;
else {
this.de = b;
this.G |= 2097152;
if (!1 === oj(this) && (Co(this), (c = this.pa), c.v())) {
var e = this.diagram;
if (
null === e ||
e.animationManager.isTicking ||
!e.undoManager.isUndoingRedoing
) {
var f = c.copy();
c.h(c.x + (b.x - d.x), c.y + (b.y - d.y));
Ho(this, e, c, f.x, f.y);
this.g('position', f, c.copy());
}
}
b = !0;
}
b && this.g('location', d, a.copy());
}
},
},
category: {
get: function() {
return this.Jf;
},
set: function(a) {
var b = this.Jf;
if (b !== a) {
var c = this.diagram,
d = this.data,
e = null;
if (null !== c && null !== d && !(this instanceof ue)) {
var f = c.model.undoManager;
f.isEnabled &&
!f.isUndoingRedoing &&
((e = this.clone()), e.R.addAll(this.R));
}
this.Jf = a;
this.g('category', b, a);
null === c || null === d || this instanceof ue
? this instanceof ue &&
((e = this.adornedPart),
null !== e &&
((a = e.Hf),
null !== a && a.remove(b),
e.Tg(this.category, this)))
: ((f = c.model),
f.undoManager.isUndoingRedoing ||
(this.eh()
? (c.partManager.setLinkCategoryForData(d, a),
(c = c.partManager.findLinkTemplateForCategory(a)),
null !== c &&
(kg(c), (c = c.copy()), null !== c && Ko(this, c, b, a)))
: (null !== f && f.Rl(d, a),
(c = So(c.partManager, d, a)),
null !== c &&
(kg(c),
(c = c.copy()),
null === c ||
c instanceof T ||
((d = this.location.copy()),
Ko(this, c, b, a),
this.location.v() || (this.location = d)))),
null !== e &&
((b = this.clone()),
b.R.addAll(this.R),
this.g('self', e, b))));
}
},
},
self: {
get: function() {
return this;
},
set: function(a) {
Ko(this, a, this.category, a.category);
},
},
copyable: {
get: function() {
return 0 !== (this.G & 1);
},
set: function(a) {
var b = 0 !== (this.G & 1);
b !== a && ((this.G ^= 1), this.g('copyable', b, a));
},
},
deletable: {
get: function() {
return 0 !== (this.G & 2);
},
set: function(a) {
var b = 0 !== (this.G & 2);
b !== a && ((this.G ^= 2), this.g('deletable', b, a));
},
},
textEditable: {
get: function() {
return 0 !== (this.G & 4);
},
set: function(a) {
var b = 0 !== (this.G & 4);
b !== a && ((this.G ^= 4), this.g('textEditable', b, a), this.Rb());
},
},
groupable: {
get: function() {
return 0 !== (this.G & 8);
},
set: function(a) {
var b = 0 !== (this.G & 8);
b !== a && ((this.G ^= 8), this.g('groupable', b, a));
},
},
movable: {
get: function() {
return 0 !== (this.G & 16);
},
set: function(a) {
var b = 0 !== (this.G & 16);
b !== a && ((this.G ^= 16), this.g('movable', b, a));
},
},
selectionAdorned: {
get: function() {
return 0 !== (this.G & 32);
},
set: function(a) {
var b = 0 !== (this.G & 32);
b !== a &&
((this.G ^= 32), this.g('selectionAdorned', b, a), this.Rb());
},
},
isInDocumentBounds: {
get: function() {
return 0 !== (this.G & 64);
},
set: function(a) {
var b = 0 !== (this.G & 64);
if (b !== a) {
this.G ^= 64;
var c = this.diagram;
null !== c && c.Va();
this.g('isInDocumentBounds', b, a);
}
},
},
isLayoutPositioned: {
get: function() {
return 0 !== (this.G & 128);
},
set: function(a) {
var b = 0 !== (this.G & 128);
b !== a &&
((this.G ^= 128),
this.g('isLayoutPositioned', b, a),
this.D(a ? 4 : 8));
},
},
selectable: {
get: function() {
return 0 !== (this.G & 256);
},
set: function(a) {
var b = 0 !== (this.G & 256);
b !== a && ((this.G ^= 256), this.g('selectable', b, a), this.Rb());
},
},
reshapable: {
get: function() {
return 0 !== (this.G & 512);
},
set: function(a) {
var b = 0 !== (this.G & 512);
b !== a && ((this.G ^= 512), this.g('reshapable', b, a), this.Rb());
},
},
resizable: {
get: function() {
return 0 !== (this.G & 1024);
},
set: function(a) {
var b = 0 !== (this.G & 1024);
b !== a && ((this.G ^= 1024), this.g('resizable', b, a), this.Rb());
},
},
rotatable: {
get: function() {
return 0 !== (this.G & 2048);
},
set: function(a) {
var b = 0 !== (this.G & 2048);
b !== a && ((this.G ^= 2048), this.g('rotatable', b, a), this.Rb());
},
},
isSelected: {
get: function() {
return 0 !== (this.G & 4096);
},
set: function(a) {
var b = 0 !== (this.G & 4096);
if (b !== a) {
var c = this.diagram;
if (
!a ||
(this.canSelect() &&
!(null !== c && c.selection.count >= c.maxSelectionCount))
) {
this.G ^= 4096;
var d = !1;
if (null !== c) {
d = c.skipsUndoManager;
c.skipsUndoManager = !0;
var e = c.selection;
e.ja();
a ? e.add(this) : e.remove(this);
e.freeze();
}
this.g('isSelected', b, a);
this.Rb();
a = this.selectionChanged;
null !== a && a(this);
null !== c && (c.Mb(), (c.skipsUndoManager = d));
}
}
},
},
isHighlighted: {
get: function() {
return 0 !== (this.G & 524288);
},
set: function(a) {
var b = 0 !== (this.G & 524288);
if (b !== a) {
this.G ^= 524288;
var c = this.diagram;
null !== c &&
((c = c.highlighteds),
c.ja(),
a ? c.add(this) : c.remove(this),
c.freeze());
this.g('isHighlighted', b, a);
this.N();
a = this.highlightedChanged;
null !== a && a(this);
}
},
},
isShadowed: {
get: function() {
return 0 !== (this.G & 8192);
},
set: function(a) {
var b = 0 !== (this.G & 8192);
b !== a && ((this.G ^= 8192), this.g('isShadowed', b, a), this.N());
},
},
isAnimated: {
get: function() {
return 0 !== (this.G & 262144);
},
set: function(a) {
var b = 0 !== (this.G & 262144);
b !== a && ((this.G ^= 262144), this.g('isAnimated', b, a));
},
},
highlightedChanged: {
get: function() {
return null !== this.O ? this.O.Qp : null;
},
set: function(a) {
var b = this.highlightedChanged;
b !== a &&
(Ao(this), (this.O.Qp = a), this.g('highlightedChanged', b, a));
},
},
selectionObjectName: {
get: function() {
return null !== this.O ? this.O.Sq : '';
},
set: function(a) {
var b = this.selectionObjectName;
b !== a &&
(Ao(this),
(this.O.Sq = a),
(this.Kg = null),
this.g('selectionObjectName', b, a));
},
},
selectionAdornmentTemplate: {
get: function() {
return null !== this.O ? this.O.Qq : null;
},
set: function(a) {
var b = this.selectionAdornmentTemplate;
b !== a &&
(Ao(this),
(this.O.Qq = a),
this.g('selectionAdornmentTemplate', b, a));
},
},
selectionObject: {
get: function() {
if (null === this.Kg) {
var a = this.selectionObjectName;
null !== a && '' !== a
? ((a = this.fb(a)), null !== a ? (this.Kg = a) : (this.Kg = this))
: this instanceof T
? ((a = this.path), null !== a ? (this.Kg = a) : (this.Kg = this))
: (this.Kg = this);
}
return this.Kg;
},
},
selectionChanged: {
get: function() {
return null !== this.O ? this.O.Rq : null;
},
set: function(a) {
var b = this.selectionChanged;
b !== a &&
(Ao(this), (this.O.Rq = a), this.g('selectionChanged', b, a));
},
},
resizeAdornmentTemplate: {
get: function() {
return null !== this.O ? this.O.Eq : null;
},
set: function(a) {
var b = this.resizeAdornmentTemplate;
b !== a &&
(Ao(this), (this.O.Eq = a), this.g('resizeAdornmentTemplate', b, a));
},
},
resizeObjectName: {
get: function() {
return null !== this.O ? this.O.Gq : '';
},
set: function(a) {
var b = this.resizeObjectName;
b !== a &&
(Ao(this), (this.O.Gq = a), this.g('resizeObjectName', b, a));
},
},
resizeObject: {
get: function() {
var a = this.resizeObjectName;
return '' !== a && ((a = this.fb(a)), null !== a) ? a : this;
},
},
resizeCellSize: {
get: function() {
return null !== this.O ? this.O.Fq : Mb;
},
set: function(a) {
var b = this.resizeCellSize;
b.C(a) ||
((a = a.J()),
Ao(this),
(this.O.Fq = a),
this.g('resizeCellSize', b, a));
},
},
rotateAdornmentTemplate: {
get: function() {
return null !== this.O ? this.O.Hq : null;
},
set: function(a) {
var b = this.rotateAdornmentTemplate;
b !== a &&
(Ao(this), (this.O.Hq = a), this.g('rotateAdornmentTemplate', b, a));
},
},
rotateObjectName: {
get: function() {
return null !== this.O ? this.O.Iq : '';
},
set: function(a) {
var b = this.rotateObjectName;
b !== a &&
(Ao(this), (this.O.Iq = a), this.g('rotateObjectName', b, a));
},
},
rotateObject: {
get: function() {
var a = this.rotateObjectName;
return '' !== a && ((a = this.fb(a)), null !== a) ? a : this;
},
},
rotationSpot: {
get: function() {
return null !== this.O ? this.O.Kq : Wc;
},
set: function(a) {
var b = this.rotationSpot;
b.C(a) ||
((a = a.J()),
Ao(this),
(this.O.Kq = a),
this.g('rotationSpot', b, a));
},
},
text: {
get: function() {
return this.cc;
},
set: function(a) {
var b = this.cc;
b !== a && ((this.cc = a), this.g('text', b, a));
},
},
containingGroup: {
get: function() {
return this.ph;
},
set: function(a) {
if (this.Tc()) {
var b = this.ph;
if (b !== a) {
null === a ||
(this !== a && !a.Md(this)) ||
(this === a &&
C('Cannot make a Group a member of itself: ' + this.toString()),
C(
'Cannot make a Group indirectly contain itself: ' +
this.toString() +
' already contains ' +
a.toString(),
));
this.D(2);
var c = this.diagram;
null !== b
? Oo(b, this)
: this instanceof qf && null !== c && c.Uh.remove(this);
this.ph = a;
null !== a
? No(a, this)
: this instanceof qf && null !== c && c.Uh.add(this);
this.D(1);
if (null !== c && c.$) {
var d = this.data,
e = c.model;
if (null !== d && e.Oj()) {
var f = e.ua(null !== a ? a.data : null);
e.Po(d, f);
}
}
d = this.containingGroupChanged;
null !== d &&
((e = !0),
null !== c && ((e = c.$), (c.$ = !0)),
d(this, b, a),
null !== c && (c.$ = e));
if (this instanceof qf)
for (
c = new G(), Sk(c, this, !0, 0, !0), c = c.iterator;
c.next();
)
if (((d = c.value), d instanceof V))
for (d = d.linksConnected; d.next(); ) To(d.value);
if (this instanceof V) {
for (c = this.linksConnected; c.next(); ) To(c.value);
c = this.labeledLink;
null !== c && To(c);
}
this.g('containingGroup', b, a);
null !== a && ((b = a.layer), null !== b && hi(b, -1, a));
}
} else C('cannot set the Part.containingGroup of a Link or Adornment');
},
},
containingGroupChanged: {
get: function() {
return null !== this.O ? this.O.np : null;
},
set: function(a) {
var b = this.containingGroupChanged;
b !== a &&
(Ao(this), (this.O.np = 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 null !== this.O ? this.O.bq : 127;
},
set: function(a) {
var b = this.layoutConditions;
b !== a &&
(Ao(this), (this.O.bq = a), this.g('layoutConditions', b, a));
},
},
dragComputation: {
get: function() {
return null !== this.O ? this.O.yp : null;
},
set: function(a) {
var b = this.dragComputation;
b !== a && (Ao(this), (this.O.yp = a), this.g('dragComputation', b, a));
},
},
shadowOffset: {
get: function() {
return null !== this.O ? this.O.Wq : tb;
},
set: function(a) {
var b = this.shadowOffset;
b.C(a) ||
((a = a.J()),
Ao(this),
(this.O.Wq = a),
this.N(),
this.g('shadowOffset', b, a));
},
},
shadowColor: {
get: function() {
return null !== this.O ? this.O.Vq : 'gray';
},
set: function(a) {
var b = this.shadowColor;
b !== a &&
(Ao(this), (this.O.Vq = a), this.N(), this.g('shadowColor', b, a));
},
},
shadowBlur: {
get: function() {
return null !== this.O ? this.O.Lg : 4;
},
set: function(a) {
var b = this.shadowBlur;
b !== a &&
(Ao(this), (this.O.Lg = a), this.N(), this.g('shadowBlur', b, a));
},
},
});
U.prototype.invalidateLayout = U.prototype.D;
U.prototype.findCommonContainingGroup = U.prototype.Sw;
U.prototype.isMemberOf = U.prototype.Md;
U.prototype.findTopLevelPart = U.prototype.az;
U.prototype.findSubGraphLevel = U.prototype.Xy;
U.prototype.ensureBounds = U.prototype.Za;
U.prototype.getDocumentBounds = U.prototype.gi;
U.prototype.findObject = U.prototype.fb;
U.prototype.moveTo = U.prototype.moveTo;
U.prototype.invalidateAdornments = U.prototype.Rb;
U.prototype.clearAdornments = U.prototype.zj;
U.prototype.removeAdornment = U.prototype.Af;
U.prototype.addAdornment = U.prototype.Tg;
U.prototype.findAdornment = U.prototype.Hj;
U.prototype.updateTargetBindings = U.prototype.Ka;
var Lo = !1;
U.className = 'Part';
U.LayoutNone = 0;
U.LayoutAdded = 1;
U.LayoutRemoved = 2;
U.LayoutShown = 4;
U.LayoutHidden = 8;
U.LayoutNodeSized = 16;
U.LayoutGroupLayout = 32;
U.LayoutNodeReplaced = 64;
U.LayoutStandard = 127;
U.LayoutAll = 16777215;
function ue(a, b) {
void 0 === a || a instanceof Ll || 'string' === typeof a
? U.call(this, a)
: (U.call(this), a && (b = a));
this.G &= -257;
this.zg = 'Adornment';
this.me = null;
this.ew = 0;
this.yw = !1;
this.j = this.Xa = null;
b && Object.assign(this, b);
}
la(ue, U);
ue.prototype.toString = function() {
var a = this.adornedPart;
return (
'Adornment(' + this.category + ')' + (null !== a ? a.toString() : '')
);
};
ue.prototype.updateRelationshipsFromData = function() {};
ue.prototype.Rj = function(a) {
var b = this.adornedObject,
c = null === b || void 0 === b ? void 0 : b.part;
if (c instanceof T && b instanceof Cf) {
b = c.path;
c.Rj(a);
a = b.geometry;
c = this.R.s;
b = c.length;
for (var d = 0; d < b; d++) {
var e = c[d];
e.isPanelMain && e instanceof Cf && (e.sa = a);
}
}
};
ue.prototype.mi = function() {
var a = this.me;
if (null === a) return !0;
a = a.part;
return null === a || !oj(a);
};
ue.prototype.Tc = function() {
return !1;
};
ue.prototype.$j = function(a, b, c, d, e, f, g) {
if (a === fe && 'elements' === b)
if (e instanceof jg) null === this.Xa && (this.Xa = e);
else {
if (e instanceof W) {
var h = e.vl(function(a) {
return a instanceof jg;
});
h instanceof jg && null === this.Xa && (this.Xa = h);
}
}
else
a === ge &&
'elements' === b &&
null !== this.Xa &&
(d === this.Xa
? (this.Xa = null)
: d instanceof W && this.Xa.jg(d) && (this.Xa = null));
U.prototype.$j.call(this, a, b, c, d, e, f, g);
};
ue.prototype.updateAdornments = function() {};
ue.prototype.Fj = function() {};
ma.Object.defineProperties(ue.prototype, {
placeholder: {
get: function() {
return this.Xa;
},
},
adornedObject: {
get: function() {
return this.me;
},
set: function(a) {
var b = this.adornedPart,
c = null;
null !== a && (c = a.part);
null === b || (null !== a && b === c) || b.Af(this.category);
this.me = a;
null !== c && c.Tg(this.category, this);
},
},
adornedPart: {
get: function() {
var a = this.me;
return null !== a ? a.part : null;
},
},
containingGroup: {
get: function() {
return null;
},
},
});
ue.className = 'Adornment';
function Uo() {
this.ic = !1;
this.ur = this.bj = this.eq = this.cq = null;
this.ap = rc;
this.Dq = Vo;
this.gr = this.dj = this.mq = this.lq = null;
}
Uo.prototype.copy = function() {
var a = new Uo();
a.cq = this.cq;
a.eq = this.eq;
a.bj = this.bj;
a.ur = this.ur;
a.ap = this.ap.J();
a.Dq = this.Dq;
a.lq = this.lq;
a.mq = this.mq;
a.dj = this.dj;
a.gr = this.gr;
return a;
};
function V(a, b) {
void 0 === a || a instanceof Ll || 'string' === typeof a
? U.call(this, a)
: (U.call(this), a && (b = a));
this.U = 13;
this.ya = null;
this.jb = new E();
this.sc = this.Qe = this.Nk = null;
this.Rg = !1;
b && Object.assign(this, b);
}
la(V, U);
V.prototype.cloneProtected = function(a) {
U.prototype.cloneProtected.call(this, a);
a.U = this.U;
null !== this.ya && (a.ya = this.ya.ic ? this.ya : this.ya.copy());
};
t = V.prototype;
t.qf = function(a) {
U.prototype.qf.call(this, a);
a.vd();
a.Qe = this.Qe;
a.sc = null;
};
function Wo(a) {
null === a.ya ? (a.ya = new Uo()) : a.ya.ic && (a.ya = a.ya.copy());
}
t.ih = function() {
U.prototype.ih.call(this);
null !== this.ya && (this.ya.ic = !0);
};
function Xo(a, b) {
null !== b && (null === a.Qe && (a.Qe = new G()), a.Qe.add(b));
}
function Yo(a, b, c, d) {
if (null === b || null === a.Qe) return null;
for (var e = a.Qe.iterator; e.next(); ) {
var f = e.value;
if (
(f.cs === a && f.Pu === b && f.vx === c && f.wx === d) ||
(f.cs === b && f.Pu === a && f.vx === d && f.wx === c)
)
return f;
}
return null;
}
t.uz = function(a, b, c) {
if (void 0 === b || null === b) b = '';
if (void 0 === c || null === c) c = '';
a = Yo(this, a, b, c);
null !== a && a.Al();
};
t.$j = function(a, b, c, d, e, f, g) {
a === fe && 'elements' === b
? (this.sc = null)
: a === ge && 'elements' === b && (this.sc = null);
U.prototype.$j.call(this, a, b, c, d, e, f, g);
};
t.vd = function(a) {
for (var b = this.linksConnected; b.next(); ) {
var c = b.value;
(void 0 !== a && a.contains(c)) || (Zo(c.fromPort), Zo(c.toPort), c.ab());
}
};
function ml(a, b) {
for (a = a.linksConnected; a.next(); ) {
var c = a.value;
if (c.fromPort === b || c.toPort === b)
Zo(c.fromPort), Zo(c.toPort), c.ab();
}
}
function Zo(a) {
if (null !== a) {
var b = a.Hn;
null !== b && b.Al();
a = a.part;
b = a.containingGroup;
null === b || a.isVisible() || Zo(b.port);
}
}
t.mi = function() {
return !0;
};
V.prototype.getAvoidableRect = function(a) {
a.set(this.actualBounds);
a.fo(this.avoidableMargin);
return a;
};
V.prototype.findVisibleNode = function() {
for (var a = this; null !== a && !a.isVisible(); ) a = a.containingGroup;
return a;
};
V.prototype.isVisible = function() {
if (!U.prototype.isVisible.call(this)) return !1;
var a = !0,
b = vi,
c = this.diagram;
if (null !== c) {
if (c.animationManager.es(this)) return !0;
a = c.isTreePathToChildren;
b = c.treeCollapsePolicy;
}
if (b === vi) {
if (((a = this.ig()), null !== a && !a.isTreeExpanded)) return !1;
} else if (b === Dk) {
if (
((a = a ? this.xu() : this.yu()),
0 < a.count &&
a.all(function(a) {
return !a.isTreeExpanded;
}))
)
return !1;
} else if (
b === Ek &&
((a = a ? this.xu() : this.yu()),
0 < a.count &&
a.any(function(a) {
return !a.isTreeExpanded;
}))
)
return !1;
a = this.labeledLink;
return null !== a ? a.isVisible() : !0;
};
V.prototype.Ub = function(a) {
U.prototype.Ub.call(this, a);
for (var b = this.linksConnected; b.next(); ) {
var c = b.value;
if (a && null !== this.containingGroup) {
var d = c.wo(this);
null === d || d.Md(this.containingGroup) || c.ab();
}
c.Ub(a);
}
};
V.prototype.Tw = function() {
var a = new G(),
b = new G();
$o(this, this, a, b);
return b.iterator;
};
function $o(a, b, c, d) {
if (null !== b && !c.has(b)) {
c.add(b);
var e = !0,
f = a.diagram;
null !== f && (e = f.isTreePathToChildren);
b.linksConnected.each(function(f) {
f.isTreeLink
? (e ? f.fromNode === b : f.toNode === b) &&
$o(a, e ? f.toNode : f.fromNode, c, d)
: d.add(f);
});
}
}
V.prototype.findLinksConnected = function(a) {
void 0 === a && (a = null);
if (null === a) return this.jb.iterator;
var b = new ab(this.jb),
c = this;
b.predicate = function(b) {
return (
(b.fromNode === c && b.fromPortId === a) ||
(b.toNode === c && b.toPortId === a)
);
};
return b;
};
t = V.prototype;
t.ro = function(a) {
void 0 === a && (a = null);
var b = new ab(this.jb),
c = this;
b.predicate = function(b) {
return b.fromNode !== c ? !1 : null === a ? !0 : b.fromPortId === a;
};
return b;
};
t.Kd = function(a) {
void 0 === a && (a = null);
var b = new ab(this.jb),
c = this;
b.predicate = function(b) {
return b.toNode !== c ? !1 : null === a ? !0 : b.toPortId === a;
};
return b;
};
t.wu = function(a) {
void 0 === a && (a = null);
for (var b = null, c = null, d = this.jb.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 G()), 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 G()), b.add(c), b.add(e))
: (c = e));
}
return null !== b ? b.iterator : null !== c ? new $a(c) : Za;
};
t.yu = function(a) {
void 0 === a && (a = null);
for (var b = null, c = null, d = this.jb.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 G()), b.add(c), b.add(e))
: (c = e));
}
return null !== b ? b.iterator : null !== c ? new $a(c) : Za;
};
t.xu = function(a) {
void 0 === a && (a = null);
for (var b = null, c = null, d = this.jb.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 G()), b.add(c), b.add(e))
: (c = e));
}
return null !== b ? b.iterator : null !== c ? new $a(c) : Za;
};
t.Sy = function(a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
var d = new ab(this.jb),
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.Ty = function(a, b, c) {
void 0 === b && (b = null);
void 0 === c && (c = null);
var d = new ab(this.jb),
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 ap(a, b, c) {
Zo(c);
var d = a.jb.contains(b);
d || a.jb.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.$), (g.$ = !0));
e(a, b, c);
null !== g && (g.$ = 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.Rg || (e.Rg = f),
!f.isTreeLeaf ||
(null !== a && a.undoManager.isUndoingRedoing) ||
(d
? c === f && (f.isTreeLeaf = !1)
: b === f && (f.isTreeLeaf = !1))));
}
function bp(a, b, c) {
Zo(c);
var d = a.jb.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.$), (e.$ = !0));
f(a, b, c);
null !== e && (e.$ = 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.Rg = !1),
null === b ||
b.isTreeLeaf ||
(0 === b.jb.count
? ((b.Rg = null),
(null !== e && e.undoManager.isUndoingRedoing) ||
(b.isTreeLeaf = !0))
: Ck(b)));
}
function Ck(a) {
a.Rg = !1;
if (0 !== a.jb.count) {
var b = !0,
c = a.diagram;
if (null === c || !c.undoManager.isUndoingRedoing) {
null !== c && (b = c.isTreePathToChildren);
for (c = a.jb.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.yo = function(a) {
U.prototype.yo.call(this, a);
a || (Ck(this), (a = this.Nk), null !== a && cp(a, this));
};
t.zo = function(a) {
U.prototype.zo.call(this, a);
a ||
((a = this.Nk),
null !== a && null !== a.rd && (a.rd.remove(this), a.w()));
};
t.Fj = function() {
if (0 < this.jb.count) {
var a = this.diagram;
if (null !== a)
for (
var b =
null !== a.commandHandler
? a.commandHandler.deletesConnectedLinks
: !0,
c = this.jb.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;
U.prototype.Fj.call(this);
};
t.Kr = function(a) {
if (null === this.sc) {
if ('' === a && !1 === this.He) return this;
dp(this);
}
var b = this.sc.I(a);
return null !== b || ('' !== a && ((b = this.sc.I('')), null !== b))
? b
: this;
};
function dp(a) {
null === a.sc ? (a.sc = new pb()) : a.sc.clear();
a.$l(a, function(a, c) {
Rl(a, c);
});
0 === a.sc.count && a.sc.add('', a);
}
function Rl(a, b) {
var c = b.portId;
null !== c && null !== a.sc && a.sc.add(c, b);
}
function Ql(a, b, c) {
var d = b.portId;
if (
null !== d &&
(null !== a.sc && a.sc.remove(d), (b = a.diagram), null !== b && c)
) {
c = null;
for (a = a.findLinksConnected(d); a.next(); )
(d = a.value), null === c && (c = Ea()), c.push(d);
if (null !== c) {
for (a = 0; a < c.length; a++) b.remove(c[a]);
Ga(c);
}
}
}
t.wz = 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.jb.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.jb.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.ez = function() {
var a = !0,
b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
b = this;
if (a)
for (;;) {
a = null;
for (var c = b.jb.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.jb.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.Py = function(a) {
if (null === a) return null;
if (this === a) return this;
for (var b = this; null !== b; ) Mo(b, !0), (b = b.ig());
var c = null;
for (b = a; null !== b; ) {
if (0 !== (b.G & 1048576)) {
c = b;
break;
}
b = b.ig();
}
for (b = this; null !== b; ) Mo(b, !1), (b = b.ig());
return c;
};
t.$g = function() {
var a = !0,
b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
b = this.jb.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.ig = function() {
var a = this.Rg;
if (null === a) return null;
if (a instanceof V) return a;
var b = !0;
a = this.diagram;
null !== a && (b = a.isTreePathToChildren);
a = this.jb.iterator;
if (b)
for (; a.next(); ) {
if (((b = a.value), b.isTreeLink && ((b = b.fromNode), b !== this)))
return (this.Rg = b);
}
else
for (; a.next(); )
if (((b = a.value), b.isTreeLink && ((b = b.toNode), b !== this)))
return (this.Rg = b);
return (this.Rg = null);
};
t.cz = function() {
function a(b, d) {
d.add(b);
var c = b.$g();
null !== c && (d.add(c), (b = b.ig()), null !== b && a(b, d));
}
var b = new G();
a(this, b);
return b;
};
t.bz = function() {
return ep(this, this);
};
function ep(a, b) {
b = b.ig();
return null === b ? 0 : 1 + ep(a, b);
}
t.to = function() {
var a = !0,
b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
b = new ab(this.jb);
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.Au = function() {
var a = !0,
b = this.diagram;
null !== b && (a = b.isTreePathToChildren);
var c = (b = null),
d = this.jb.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 $a(c) : Za;
};
t.dz = function(a) {
void 0 === a && (a = Infinity);
var b = new G();
Sk(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.Ie) {
b.Ie = !0;
var c = new G();
c.add(this);
fp(
this,
c,
b.isTreePathToChildren,
a,
b,
this,
b.treeCollapsePolicy === vi,
);
b.Ie = !1;
}
};
function fp(a, b, c, d, e, f, g) {
if (1 < d)
for (var h = c ? a.ro() : a.Kd(); h.next(); ) {
var k = h.value;
k.isTreeLink &&
((k = k.wo(a)),
null === k ||
k === a ||
b.contains(k) ||
(b.add(k), fp(k, b, c, d - 1, e, f, g)));
}
else gp(a, b, c, e, f, g);
}
function gp(a, b, c, d, e, f) {
for (
var g = e === a ? !0 : a.isTreeExpanded, h = c ? a.ro() : a.Kd();
h.next();
) {
var k = h.value;
if (k.isTreeLink && ((k = k.wo(a)), null !== k && k !== a)) {
var l = b.contains(k);
l || b.add(k);
g && (f && d.vj(k, e), k.dh(), k.Ub(!1));
k.isTreeExpanded &&
((k.wasTreeExpanded = k.isTreeExpanded), l || gp(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.Ie) {
b.Ie = !0;
var c = new G();
c.add(this);
hp(
this,
c,
b.isTreePathToChildren,
a,
b,
this,
b.treeCollapsePolicy === vi,
);
b.Ie = !1;
}
};
function hp(a, b, c, d, e, f, g) {
for (
var h = f === a ? !1 : a.isTreeExpanded, k = c ? a.ro() : a.Kd();
k.next();
) {
var l = k.value;
l.isTreeLink &&
(h || l.xd || l.ab(),
(l = l.wo(a)),
null !== l &&
l !== a &&
!b.contains(l) &&
(b.add(l),
h || (l.Ub(!0), l.dh(), g && e.xj(l, f)),
2 < d || l.wasTreeExpanded)) &&
((l.wasTreeExpanded = !1), hp(l, b, c, d - 1, e, f, g));
}
a.isTreeExpanded = !0;
}
ma.Object.defineProperties(V.prototype, {
portSpreading: {
get: function() {
return null !== this.ya ? this.ya.Dq : Vo;
},
set: function(a) {
var b = this.portSpreading;
b !== a &&
(Wo(this),
(this.ya.Dq = a),
this.g('portSpreading', b, a),
(a = this.diagram),
(null !== a && a.undoManager.isUndoingRedoing) || this.vd());
},
},
avoidable: {
get: function() {
return 0 !== (this.U & 8);
},
set: function(a) {
var b = 0 !== (this.U & 8);
if (b !== a) {
this.U ^= 8;
var c = this.diagram;
null !== c && lk(c, this);
this.g('avoidable', b, a);
}
},
},
avoidableMargin: {
get: function() {
return null !== this.ya ? this.ya.ap : rc;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.avoidableMargin;
if (!b.C(a)) {
a = a.J();
Wo(this);
this.ya.ap = a;
var c = this.diagram;
null !== c && lk(c, this);
this.g('avoidableMargin', b, a);
}
},
},
linksConnected: {
get: function() {
return this.jb.iterator;
},
},
linkConnected: {
get: function() {
return null !== this.ya ? this.ya.cq : null;
},
set: function(a) {
var b = this.linkConnected;
b !== a && (Wo(this), (this.ya.cq = a), this.g('linkConnected', b, a));
},
},
linkDisconnected: {
get: function() {
return null !== this.ya ? this.ya.eq : null;
},
set: function(a) {
var b = this.linkDisconnected;
b !== a &&
(Wo(this), (this.ya.eq = a), this.g('linkDisconnected', b, a));
},
},
linkValidation: {
get: function() {
return null !== this.ya ? this.ya.bj : null;
},
set: function(a) {
var b = this.linkValidation;
b !== a && (Wo(this), (this.ya.bj = a), this.g('linkValidation', b, a));
},
},
isLinkLabel: {
get: function() {
return null !== this.Nk;
},
},
labeledLink: {
get: function() {
return this.Nk;
},
set: function(a) {
var b = this.Nk;
if (b !== a) {
var c = this.diagram,
d = this.data;
if (null !== b) {
null !== b.rd && (b.rd.remove(this), b.w());
if (null !== c && null !== d && !c.undoManager.isUndoingRedoing) {
var e = b.data,
f = c.model;
if (null !== e && f.ki()) {
var g = f.ua(d);
void 0 !== g && f.xx(e, g);
}
}
this.containingGroup = null;
}
this.Nk = a;
null !== a &&
(cp(a, this),
null === c ||
null === d ||
c.undoManager.isUndoingRedoing ||
((e = a.data),
(c = c.model),
null !== e &&
c.ki() &&
((d = c.ua(d)), void 0 !== d && c.hu(e, d))),
(this.containingGroup = a.containingGroup));
Al(this);
this.g('labeledLink', b, a);
}
},
},
port: {
get: function() {
return this.Kr('');
},
},
ports: {
get: function() {
null === this.sc && dp(this);
return this.sc.iteratorValues;
},
},
isTreeExpanded: {
get: function() {
return 0 !== (this.U & 1);
},
set: function(a) {
var b = 0 !== (this.U & 1);
if (b !== a) {
this.U ^= 1;
var c = this.diagram;
this.g('isTreeExpanded', b, a);
b = this.treeExpandedChanged;
if (null !== b) {
var d = !0;
null !== c && ((d = c.$), (c.$ = !0));
b(this);
null !== c && (c.$ = d);
}
null !== c && c.undoManager.isUndoingRedoing
? this.Ub(a)
: a
? this.expandTree()
: this.collapseTree();
}
},
},
wasTreeExpanded: {
get: function() {
return 0 !== (this.U & 2);
},
set: function(a) {
var b = 0 !== (this.U & 2);
b !== a && ((this.U ^= 2), this.g('wasTreeExpanded', b, a));
},
},
treeExpandedChanged: {
get: function() {
return null !== this.ya ? this.ya.ur : null;
},
set: function(a) {
var b = this.treeExpandedChanged;
b !== a &&
(Wo(this), (this.ya.ur = a), this.g('treeExpandedChanged', b, a));
},
},
isTreeLeaf: {
get: function() {
return 0 !== (this.U & 4);
},
set: function(a) {
var b = 0 !== (this.U & 4);
b !== a && ((this.U ^= 4), this.g('isTreeLeaf', b, a));
},
},
});
V.prototype.expandTree = V.prototype.expandTree;
V.prototype.collapseTree = V.prototype.collapseTree;
V.prototype.findTreeParts = V.prototype.dz;
V.prototype.findTreeChildrenNodes = V.prototype.Au;
V.prototype.findTreeChildrenLinks = V.prototype.to;
V.prototype.findTreeLevel = V.prototype.bz;
V.prototype.findTreeParentChain = V.prototype.cz;
V.prototype.findTreeParentNode = V.prototype.ig;
V.prototype.findTreeParentLink = V.prototype.$g;
V.prototype.findCommonTreeParent = V.prototype.Py;
V.prototype.findTreeRoot = V.prototype.ez;
V.prototype.isInTreeOf = V.prototype.wz;
V.prototype.findPort = V.prototype.Kr;
V.prototype.findLinksTo = V.prototype.Ty;
V.prototype.findLinksBetween = V.prototype.Sy;
V.prototype.findNodesInto = V.prototype.xu;
V.prototype.findNodesOutOf = V.prototype.yu;
V.prototype.findNodesConnected = V.prototype.wu;
V.prototype.findLinksInto = V.prototype.Kd;
V.prototype.findLinksOutOf = V.prototype.ro;
V.prototype.findExternalTreeLinksConnected = V.prototype.Tw;
V.prototype.invalidateConnectedLinks = V.prototype.vd;
V.prototype.invalidateLinkBundle = V.prototype.uz;
var ip = new D(V, 'SpreadingNone', 10),
Vo = new D(V, 'SpreadingEvenly', 11),
jp = new D(V, 'SpreadingPacked', 12);
V.className = 'Node';
V.SpreadingNone = ip;
V.SpreadingEvenly = Vo;
V.SpreadingPacked = jp;
function qf(a, b) {
void 0 === a || a instanceof Ll || 'string' === typeof a
? V.call(this, a)
: (V.call(this), a && (b = a));
this.U |= 4608;
this.on = new G();
this.Xa = null;
this.Kc = new qi();
this.Kc.group = this;
this.Vk = new G();
this.ib = this.Dp = null;
b && Object.assign(this, b);
}
la(qf, V);
qf.prototype.cloneProtected = function(a) {
V.prototype.cloneProtected.call(this, a);
this.U = this.U & -32769;
var b = a.vl(function(a) {
return a instanceof jg;
});
b instanceof jg ? (a.Xa = b) : (a.Xa = null);
null !== this.Kc
? ((a.Kc = this.Kc.copy()), (a.Kc.group = a))
: (null !== a.Kc && (a.Kc.group = null), (a.Kc = null));
null !== this.ib && (a.ib = this.ib.copy());
};
t = qf.prototype;
t.qf = function(a) {
V.prototype.qf.call(this, a);
var b = a.Jj();
for (a = a.memberParts; a.next(); ) {
var c = a.value;
c.w();
c.D(8);
c.zj();
if (c instanceof V) c.vd(b);
else if (c instanceof T) for (c = c.labelNodes; c.next(); ) c.value.vd(b);
}
};
t.$j = function(a, b, c, d, e, f, g) {
if (a === fe && 'elements' === b)
if (e instanceof jg)
null === this.Xa
? (this.Xa = e)
: this.Xa !== e &&
C(
'Cannot insert a second Placeholder into the visual tree of a Group.',
);
else {
if (e instanceof W) {
var h = e.vl(function(a) {
return a instanceof jg;
});
h instanceof jg &&
(null === this.Xa
? (this.Xa = h)
: this.Xa !== h &&
C(
'Cannot insert a second Placeholder into the visual tree of a Group.',
));
}
}
else
a === ge &&
'elements' === b &&
null !== this.Xa &&
(d === this.Xa
? (this.Xa = null)
: d instanceof W && this.Xa.jg(d) && (this.Xa = null));
V.prototype.$j.call(this, a, b, c, d, e, f, g);
};
t.Fl = function(a, b) {
V.prototype.Fl.call(this, a, b);
this.isClipping &&
this.type !== W.Spot &&
this.isSubGraphExpanded &&
((a = this.resizeObject),
a instanceof W && (a = a.vb()),
null === this.ib && (this.ib = new M()),
a.gi(this.ib),
a instanceof Cf && this.ib.vc(-a.strokeWidth, -a.strokeWidth));
};
t.Vg = function(a, b, c, d) {
this.af = this.Xa;
V.prototype.Vg.call(this, a, b, c, d);
};
t.Za = function() {
var a = this;
a.isSubGraphExpanded &&
this.memberParts.each(function(b) {
(!a.computesBoundsIncludingLinks && b instanceof T) || b.Za();
});
V.prototype.Za.call(this);
};
t.mi = function() {
if (!V.prototype.mi.call(this)) return !1;
for (var a = this.memberParts; a.next(); ) {
var b = a.value;
if (b instanceof V) {
if (b.isVisible() && oj(b)) return !1;
} else if (
b instanceof T &&
b.isVisible() &&
oj(b) &&
b.fromNode !== this &&
b.toNode !== this
)
return !1;
}
return !0;
};
function No(a, b) {
if (a.on.add(b)) {
b instanceof qf && a.Vk.add(b);
var c = a.memberAdded;
if (null !== c) {
var d = !0,
e = a.diagram;
null !== e && ((d = e.$), (e.$ = !0));
c(a, b);
null !== e && (e.$ = d);
}
(a.isVisible() && a.isSubGraphExpanded) || b.Ub(!1);
}
(b instanceof T && !a.computesBoundsIncludingLinks) ||
((b = a.Xa), null === b && (b = a), b.w());
}
function Oo(a, b) {
if (a.on.remove(b)) {
b instanceof qf && a.Vk.remove(b);
var c = a.memberRemoved;
if (null !== c) {
var d = !0,
e = a.diagram;
null !== e && ((d = e.$), (e.$ = !0));
c(a, b);
null !== e && (e.$ = d);
}
(a.isVisible() && a.isSubGraphExpanded) || b.Ub(!0);
}
(b instanceof T && !a.computesBoundsIncludingLinks) ||
((b = a.Xa), null === b && (b = a), b.w());
}
t.Fj = function() {
if (0 < this.on.count) {
var a = this.diagram;
if (null !== a)
for (var b = this.on.copy().iterator; b.next(); ) a.remove(b.value);
}
V.prototype.Fj.call(this);
};
qf.prototype.canAddMembers = function(a) {
var b = this.diagram;
if (null === b) return !1;
b = b.commandHandler;
for (a = Uk(a).iterator; a.next(); )
if (!b.isValidMember(this, a.value)) return !1;
return !0;
};
qf.prototype.addMembers = function(a, b) {
var c = this.diagram;
if (null === c) return !1;
c = c.commandHandler;
var d = !0;
for (a = Uk(a).iterator; a.next(); ) {
var e = a.value;
!b || c.isValidMember(this, e) ? (e.containingGroup = this) : (d = !1);
}
return d;
};
qf.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 = qf.prototype;
t.vd = function(a) {
var b = 0 !== (this.U & 65536);
V.prototype.vd.call(this, a);
if (!b)
for (
(0 !== (this.U & 65536)) !== !0 && (this.U = this.U ^ 65536),
b = this.vu();
b.next();
) {
var c = b.value;
if (void 0 === a || !a.contains(c)) {
var d = c.fromNode;
null !== d && d !== this && d.Md(this) && !d.isVisible()
? (Zo(c.fromPort), Zo(c.toPort), c.ab())
: ((d = c.toNode),
null !== d &&
d !== this &&
d.Md(this) &&
!d.isVisible() &&
(Zo(c.fromPort), Zo(c.toPort), c.ab()));
}
}
};
t.vu = function() {
var a = null !== this.diagram && this.diagram.tw;
if (a && null !== this.Dp) return this.Dp.iterator;
var b = this.Jj();
b.add(this);
for (var c = new G(), d = b.iterator; d.next(); ) {
var e = d.value;
if (e instanceof V)
for (e = e.linksConnected; e.next(); ) {
var f = e.value;
b.contains(f) || c.add(f);
}
}
a && (this.Dp = c);
return c.iterator;
};
t.Ry = function() {
var a = this.Jj();
a.add(this);
for (var b = new G(), 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;
null === f || (a.contains(f) && f !== this) || b.add(f);
e = e.toNode;
null === e || (a.contains(e) && e !== this) || b.add(e);
}
}
return b.iterator;
};
t.Qy = function() {
function a(b, d) {
null !== b && (d.add(b), a(b.containingGroup, d));
}
var b = new G();
a(this, b);
return b;
};
t.Jj = function() {
var a = new G();
Sk(a, this, !0, 0, !0);
a.remove(this);
return a;
};
t.Ub = function(a) {
V.prototype.Ub.call(this, a);
for (var b = this.memberParts; b.next(); ) b.value.Ub(a);
};
qf.prototype.collapseSubGraph = function() {
var a = this.diagram;
if (null !== a && !a.Ie) {
a.Ie = !0;
var b = this.Jj();
kp(this, b, a, this);
a.Ie = !1;
}
};
function kp(a, b, c, d) {
for (var e = a.memberParts; e.next(); ) {
var f = e.value;
f.Ub(!1);
f instanceof qf &&
f.isSubGraphExpanded &&
((f.wasSubGraphExpanded = f.isSubGraphExpanded), kp(f, b, c, d));
if (f instanceof V) f.vd(b), c.vj(f, d);
else if (f instanceof T) for (f = f.labelNodes; f.next(); ) f.value.vd(b);
}
a.isSubGraphExpanded = !1;
}
qf.prototype.expandSubGraph = function() {
var a = this.diagram;
if (null !== a && !a.Ie) {
a.Ie = !0;
var b = this.Jj();
lp(this, b, a, this);
a.Ie = !1;
}
};
function lp(a, b, c, d) {
for (var e = a.memberParts; e.next(); ) {
var f = e.value;
f.Ub(!0);
f instanceof qf &&
f.wasSubGraphExpanded &&
((f.wasSubGraphExpanded = !1), lp(f, b, c, d));
if (f instanceof V) f.vd(b), c.xj(f, d);
else if (f instanceof T) for (f = f.labelNodes; f.next(); ) f.value.vd(b);
}
a.isSubGraphExpanded = !0;
}
qf.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 = I.alloc();
V.prototype.move.call(this, a, b);
a = new G();
for (b = this.Jj().iterator; b.next(); )
if (
((e = b.value),
e instanceof T &&
(e.suspendsRouting && a.add(e),
e.xd || (e.fromNode !== this && e.toNode !== this)))
)
e.suspendsRouting = !0;
for (b.reset(); b.next(); )
if (((e = b.value), !(e.eh() || (e instanceof V && e.isLinkLabel)))) {
var g = e.position,
h = e.location;
g.v()
? ((f.x = g.x + d), (f.y = g.y + c), (e.position = f))
: h.v() && ((f.x = h.x + d), (f.y = h.y + c), (e.location = f));
}
for (b.reset(); b.next(); )
if (
((e = b.value),
e instanceof T &&
((e.suspendsRouting = a.contains(e)),
e.xd || (e.fromNode !== this && e.toNode !== this)))
)
(g = e.position),
(f.x = g.x + d),
(f.y = g.y + c),
f.v() ? e.move(f) : e.ab(),
Lj(e) && e.ab();
I.free(f);
}
};
ma.Object.defineProperties(qf.prototype, {
placeholder: {
get: function() {
return this.Xa;
},
},
computesBoundsAfterDrag: {
get: function() {
return 0 !== (this.U & 2048);
},
set: function(a) {
var b = 0 !== (this.U & 2048);
b !== a && ((this.U ^= 2048), this.g('computesBoundsAfterDrag', b, a));
},
},
computesBoundsIncludingLinks: {
get: function() {
return 0 !== (this.U & 4096);
},
set: function(a) {
var b = 0 !== (this.U & 4096);
b !== a &&
((this.U ^= 4096), this.g('computesBoundsIncludingLinks', b, a));
},
},
computesBoundsIncludingLocation: {
get: function() {
return 0 !== (this.U & 8192);
},
set: function(a) {
var b = 0 !== (this.U & 8192);
b !== a &&
((this.U ^= 8192), this.g('computesBoundsIncludingLocation', b, a));
},
},
handlesDragDropForMembers: {
get: function() {
return 0 !== (this.U & 16384);
},
set: function(a) {
var b = 0 !== (this.U & 16384);
b !== a &&
((this.U ^= 16384), this.g('handlesDragDropForMembers', b, a));
},
},
memberParts: {
get: function() {
return this.on.iterator;
},
},
layout: {
get: function() {
return this.Kc;
},
set: function(a) {
var b = this.Kc;
if (b !== a) {
null !== a &&
null !== a.diagram &&
a.diagram.layout === a &&
C(
'A layout cannot be both the Diagram.layout and a Group.layout: ' +
a,
);
null !== b && ((b.diagram = null), (b.group = null));
this.Kc = a;
var c = this.diagram;
null !== a && ((a.diagram = c), (a.group = this));
null !== c && (c.mh = !0);
this.g('layout', b, a);
null !== c && c.Mb();
}
},
},
memberAdded: {
get: function() {
return null !== this.ya ? this.ya.lq : null;
},
set: function(a) {
var b = this.memberAdded;
b !== a && (Wo(this), (this.ya.lq = a), this.g('memberAdded', b, a));
},
},
memberRemoved: {
get: function() {
return null !== this.ya ? this.ya.mq : null;
},
set: function(a) {
var b = this.memberRemoved;
b !== a && (Wo(this), (this.ya.mq = a), this.g('memberRemoved', b, a));
},
},
memberValidation: {
get: function() {
return null !== this.ya ? this.ya.dj : null;
},
set: function(a) {
var b = this.memberValidation;
b !== a &&
(Wo(this), (this.ya.dj = a), this.g('memberValidation', b, a));
},
},
ungroupable: {
get: function() {
return 0 !== (this.U & 256);
},
set: function(a) {
var b = 0 !== (this.U & 256);
b !== a && ((this.U ^= 256), this.g('ungroupable', b, a));
},
},
isSubGraphExpanded: {
get: function() {
return 0 !== (this.U & 512);
},
set: function(a) {
var b = 0 !== (this.U & 512);
if (b !== a) {
this.U ^= 512;
var c = this.diagram;
this.g('isSubGraphExpanded', b, a);
b = this.subGraphExpandedChanged;
if (null !== b) {
var d = !0;
null !== c && ((d = c.$), (c.$ = !0));
b(this);
null !== c && (c.$ = d);
}
null !== c && c.undoManager.isUndoingRedoing
? (null !== this.Xa && this.Xa.w(),
this.memberParts.each(function(a) {
a.updateAdornments();
}))
: a
? this.expandSubGraph()
: this.collapseSubGraph();
}
},
},
wasSubGraphExpanded: {
get: function() {
return 0 !== (this.U & 1024);
},
set: function(a) {
var b = 0 !== (this.U & 1024);
b !== a && ((this.U ^= 1024), this.g('wasSubGraphExpanded', b, a));
},
},
subGraphExpandedChanged: {
get: function() {
return null !== this.ya ? this.ya.gr : null;
},
set: function(a) {
var b = this.subGraphExpandedChanged;
b !== a &&
(Wo(this), (this.ya.gr = a), this.g('subGraphExpandedChanged', b, a));
},
},
gh: {
get: function() {
return 0 !== (this.U & 32768);
},
set: function(a) {
(0 !== (this.U & 32768)) !== a && (this.U ^= 32768);
},
},
});
qf.prototype.expandSubGraph = qf.prototype.expandSubGraph;
qf.prototype.collapseSubGraph = qf.prototype.collapseSubGraph;
qf.prototype.findSubGraphParts = qf.prototype.Jj;
qf.prototype.findContainingGroupChain = qf.prototype.Qy;
qf.prototype.findExternalNodesConnected = qf.prototype.Ry;
qf.prototype.findExternalLinksConnected = qf.prototype.vu;
qf.prototype.ensureBounds = qf.prototype.Za;
qf.className = 'Group';
function jg(a) {
Y.call(this);
this.ub = qc;
this.Nn = new M(NaN, NaN, NaN, NaN);
a && Object.assign(this, a);
}
la(jg, Y);
jg.prototype.cloneProtected = function(a) {
Y.prototype.cloneProtected.call(this, a);
a.ub = this.ub.J();
a.Nn = this.Nn.copy();
};
jg.prototype.Xg = function(a) {
if (null === this.background && null === this.areaBackground) return !1;
var b = this.naturalBounds;
return $b(0, 0, b.width, b.height, a.x, a.y);
};
jg.prototype.El = function() {
var a = this.part;
(null !== a && (a instanceof qf || a instanceof ue)) ||
C('Placeholder is not inside a Group or Adornment.');
if (a instanceof qf) {
var b = this.computeBorder(this.Nn),
c = this.minSize,
d = this.bc;
Qb(
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,
);
this.ve(0, 0, d.width, d.height);
d = a.memberParts;
for (c = !1; d.next(); )
if (d.value.isVisible()) {
c = !0;
break;
}
d = a.diagram;
!c ||
null === d ||
d.animationManager.Ju(a) ||
isNaN(b.x) ||
isNaN(b.y) ||
((c = I.alloc()),
c.oi(b, a.locationSpot),
c.C(a.location) || (a.location = c),
I.free(c));
} else {
b = this.bc;
c = this.ub;
d = c.left + c.right;
var e = c.top + c.bottom,
f = a.adornedObject;
a.angle = f.fi();
var g = 0;
f instanceof Cf && (g = f.strokeWidth);
var h = f.uf(),
k = f.naturalBounds,
l = (k.width + g) * h;
g = (k.height + g) * h;
a.type !== W.Link &&
((h = f.ia(
'Selection' === a.category ? tc : a.locationSpot,
I.alloc(),
)),
(a.location = h),
I.free(h));
isNaN(l) || isNaN(g)
? ((a = f.ia(tc, I.alloc())),
(l = M.allocAt(a.x, a.y, 0, 0)),
l.Me(f.ia(Cc, a)),
l.Me(f.ia(vc, a)),
l.Me(f.ia(Ac, a)),
Qb(b, l.width + d || 0, l.height + e || 0),
this.ve(-c.left, -c.top, b.width, b.height),
I.free(a),
M.free(l))
: (Qb(b, l + d || 0, g + e || 0),
this.ve(-c.left, -c.top, b.width, b.height));
}
};
jg.prototype.Vg = function(a, b, c, d) {
this.actualBounds.h(a, b, c, d);
};
jg.prototype.computeBorder = function(a) {
var b = this.part,
c = b.diagram;
if (
null !== c &&
b instanceof qf &&
!b.layer.isTemporary &&
b.computesBoundsAfterDrag &&
this.Nn.v()
) {
var d = c.toolManager.findTool('Dragging');
if (
d === c.currentTool &&
((c = d.computeBorder(b, this.Nn, a)), null !== c)
)
return c;
}
c = M.alloc();
d = this.computeMemberBounds(c);
var e = this.ub;
b instanceof qf && !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),
);
M.free(c);
b instanceof qf &&
b.computesBoundsIncludingLocation &&
b.location.v() &&
a.Me(b.location);
return a;
};
jg.prototype.computeMemberBounds = function(a) {
if (!(this.part instanceof qf)) 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 T) {
if (!b.computesBoundsIncludingLinks) continue;
if (nj(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(jg.prototype, {
padding: {
get: function() {
return this.ub;
},
set: function(a) {
'number' === typeof a && (a = new ec(a));
var b = this.ub;
b.C(a) || ((this.ub = a = a.J()), this.g('padding', b, a), this.w());
},
},
});
jg.className = 'Placeholder';
function T(a) {
U.call(this, W.Link);
this.Oa = 8;
this.Ue = null;
this.Ve = '';
this.hf = this.Om = null;
this.jf = '';
this.Xn = null;
this.dk = $f;
this.wm = 0;
this.ym = $f;
this.zm = NaN;
this.kj = mp;
this.Sn = 0.5;
this.rd = null;
this.Jb = new E().freeze();
this.ef = this.Eg = null;
this.bl = new M();
this.sa = new O();
this.u = this.m = this.If = this.Mf = null;
this.Yt = new I();
this.Gp = this.qw = this.pw = null;
this.Ys = NaN;
this.aa = null;
this.j = [];
a && Object.assign(this, a);
}
la(T, U);
T.prototype.cloneProtected = function(a) {
U.prototype.cloneProtected.call(this, a);
a.Oa = this.Oa & -113;
a.Ve = this.Ve;
a.Om = this.Om;
a.jf = this.jf;
a.Xn = this.Xn;
a.dk = this.dk;
a.wm = this.wm;
a.ym = this.ym;
a.zm = this.zm;
a.kj = this.kj;
a.Sn = this.Sn;
null !== this.aa && (a.aa = this.aa.copy());
};
t = T.prototype;
t.qf = function(a) {
U.prototype.qf.call(this, a);
this.Ve = a.Ve;
this.jf = a.jf;
a.Eg = null;
a.ab();
a.If = this.If;
var b = a.fromPort;
null !== b && Zo(b);
a = a.toPort;
null !== a && Zo(a);
};
t.ob = function(a) {
a.classType === T
? 2 === (a.value & 2)
? (this.routing = a)
: a === cg || a === Zf || a === Yf
? (this.curve = a)
: a === np || a === op || a === pp
? (this.adjusting = a)
: a !== mp &&
a !== $f &&
C('Unknown Link enum value for a Link property: ' + a)
: U.prototype.ob.call(this, a);
};
t.Rc = function() {
null === this.aa && (this.aa = new dl());
};
t.mi = function() {
var a = this.fromNode;
if (null !== a) {
var b = a.findVisibleNode();
null !== b && (a = b);
if (oj(a) || pj(a)) return !1;
}
a = this.toNode;
return null !== a &&
((b = a.findVisibleNode()), null !== b && (a = b), oj(a) || pj(a))
? !1
: !0;
};
t.fv = function() {
return !1;
};
t.ns = function() {};
t.Tc = function() {
return !1;
};
T.prototype.computeAngle = function(a, b, c) {
return T.computeAngle(b, c);
};
T.computeAngle = function(a, b) {
switch (a) {
default:
case $f:
a = 0;
break;
case Tm:
a = b;
break;
case Mm:
a = b + 90;
break;
case Om:
a = b - 90;
break;
case qp:
a = b + 180;
break;
case Um:
a = J.Eo(b);
90 < a && 270 > a && (a -= 180);
break;
case Nm:
a = J.Eo(b + 90);
90 < a && 270 > a && (a -= 180);
break;
case Pm:
a = J.Eo(b - 90);
90 < a && 270 > a && (a -= 180);
break;
case Qm:
a = J.Eo(b);
if ((45 < a && 135 > a) || (225 < a && 315 > a)) return 0;
90 < a && 270 > a && (a -= 180);
}
return J.Eo(a);
};
function To(a) {
var b = a.fromNode,
c = a.toNode,
d = null;
null !== b
? (d = null !== c ? b.Sw(c) : b.containingGroup)
: null !== c
? (d = c.containingGroup)
: (d = null);
b = d;
c = a.ph;
if (c !== b) {
null !== c && Oo(c, a);
a.ph = b;
null !== b && No(b, a);
var e = a.containingGroupChanged;
if (null !== e) {
var f = !0,
g = a.diagram;
null !== g && ((f = g.$), (g.$ = !0));
e(a, c, b);
null !== g && (g.$ = f);
}
!a.xd || (a.pw !== c && a.qw !== c) || a.ab();
}
if (a.isLabeledLink)
for (a = a.labelNodes; a.next(); ) a.value.containingGroup = d;
}
t = T.prototype;
t.dh = function() {
var a = this.containingGroup;
null !== a &&
this.fromNode !== a &&
this.toNode !== a &&
a.computesBoundsIncludingLinks &&
U.prototype.dh.call(this);
};
t.wo = function(a) {
var b = this.fromNode;
return a === b ? this.toNode : b;
};
t.jz = function(a) {
var b = this.fromPort;
return a === b ? this.toPort : b;
};
function cp(a, b) {
null === a.rd && (a.rd = new G());
a.rd.add(b);
a.w();
}
t.yo = function(a) {
U.prototype.yo.call(this, a);
rp(this) && this.Ao(this.actualBounds);
if (!a) {
a = this.Ue;
var b = null;
null !== a && ((b = this.fromPort), ap(a, this, b));
var c = this.hf;
if (null !== c) {
var d = this.toPort;
(c === a && d === b) || ap(c, this, d);
}
sp(this);
}
};
t.zo = function(a) {
U.prototype.zo.call(this, a);
rp(this) && this.Ao(this.actualBounds);
if (!a) {
a = this.Ue;
var b = null;
null !== a && ((b = this.fromPort), bp(a, this, b));
var c = this.hf;
if (null !== c) {
var d = this.toPort;
(c === a && d === b) || bp(c, this, d);
}
tp(this);
}
};
t.Fj = function() {
this.xd = !0;
if (null !== this.rd) {
var a = this.diagram;
if (null !== a)
for (var b = this.rd.copy().iterator; b.next(); ) a.remove(b.value);
}
null !== this.data &&
((a = this.diagram), null !== a && a.partManager.removeDataForLink(this));
};
T.prototype.updateRelationshipsFromData = function() {
if (null !== this.data) {
var a = this.diagram;
null !== a && a.partManager.updateRelationshipsFromData(this);
}
};
T.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
? U.prototype.move.call(this, a, !1)
: ((a = I.allocAt(c.x + d, c.y + e)),
U.prototype.move.call(this, a, !1),
I.free(a));
cf(this, d, e);
for (a = this.labelNodes; a.next(); )
(b = a.value), (c = b.position), b.moveTo(c.x + d, c.y + e);
};
T.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;
};
T.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;
};
T.prototype.computeMidPoint = function(a) {
var b = this.pointsCount;
if (0 === b) return a.assign(ub), 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() === cg)
)
return (
this.sa.Bu(0.5, a),
a.add(this.i(0)),
(c = this.sa.figures.first()),
a.offset(-c.startX, -c.startY),
a
);
if (this.computeCurve() === cg) {
if (3 === b) {
c = this.i(0);
d = this.i(1);
var e = this.i(2);
J.Gw(c.x, c.y, d.x, d.y, d.x, d.y, e.x, e.y, a);
return a;
}
d = ((b - 1) / 3) | 0;
c = 3 * ((d / 2) | 0);
if (1 === d % 2) {
d = this.i(c);
e = this.i(c + 1);
var f = this.i(c + 2);
c = this.i(c + 3);
J.Gw(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;
};
T.prototype.computeMidAngle = function() {
var a = this.pointsCount;
if (2 > a) return NaN;
if (2 === a) return this.i(0).Ya(this.i(1));
if (
this.isOrthogonal &&
(15 <= this.computeCorner() || this.computeCurve() === cg)
)
return this.sa.Yw(0.5);
if (this.computeCurve() === cg && 4 <= a) {
var b = ((a - 1) / 3) | 0,
c = 3 * ((b / 2) | 0);
if (1 === b % 2) {
c = Math.floor(c);
a = this.i(c);
b = this.i(c + 1);
var d = this.i(c + 2);
c = this.i(c + 3);
return J.ty(a.x, a.y, b.x, b.y, d.x, d.y, c.x, c.y);
}
if (0 < c && c + 1 < a) return this.i(c - 1).Ya(this.i(c + 1));
}
b = this.flattenedLengths;
d = this.flattenedTotalLength;
var e = 0;
c = 0;
for (var f; e < d / 2 && c < a; ) {
f = b[c];
if (e + f > d / 2) break;
e += f;
c++;
}
b = this.i(c);
d = this.i(c + 1);
if (1 > Math.abs(b.x - d.x) && 1 > Math.abs(b.y - d.y)) {
if (0 < c && c + 2 < a) return this.i(c - 1).Ya(this.i(c + 2));
} else {
if (1 > Math.abs(b.x - d.x)) return b.y > d.y ? 270 : 90;
if (1 > Math.abs(b.y - d.y)) return b.x > d.x ? 180 : 0;
}
return b.Ya(d);
};
t = T.prototype;
t.i = function(a) {
return this.Jb.s[a];
};
t.Wc = function(a, b) {
this.Jb.Vc(a, b);
};
t.M = function(a, b, c) {
this.Jb.Vc(a, new I(b, c));
};
t.sz = function(a, b) {
this.Jb.Cb(a, b);
};
t.l = function(a, b, c) {
this.Jb.Cb(a, new I(b, c));
};
t.fe = function(a) {
this.Jb.add(a);
};
t.mf = function(a, b) {
this.Jb.add(new I(a, b));
};
t.Yu = function(a) {
this.Jb.mb(a);
};
t.Aj = function() {
this.Jb.clear();
};
function cf(a, b, c) {
if (0 !== b || 0 !== c)
if (0 === a.pointsCount)
a.defaultFromPoint && a.defaultFromPoint.offset(b, c),
a.defaultToPoint && a.defaultToPoint.offset(b, c);
else {
for (var d = a.xd, e = new E(), f = a.Jb.iterator; f.next(); ) {
var g = f.value;
e.add(new I(g.x + b, g.y + c).freeze());
}
e.freeze();
f = a.Jb;
a.Jb = e;
g = a.diagram;
isNaN(b) || isNaN(c) || (null !== g && g.animationManager.zb)
? a.w()
: (a.de.h(a.de.x + b, a.de.y + c),
a.pa.h(a.pa.x + b, a.pa.y + c),
Al(a));
d
? up(a)
: (a.defaultFromPoint && (a.defaultFromPoint = a.i(0)),
a.defaultToPoint && (a.defaultToPoint = a.i(a.pointsCount - 1)));
null !== g &&
g.animationManager.zb &&
((b = g.animationManager), (a.ef = e), b.dl.add(a));
a.g('points', f, e);
}
}
t.jh = function() {
null === this.Eg && ((this.Eg = this.Jb), (this.Jb = this.Jb.copy()));
};
t.pf = function() {
if (null !== this.Eg) {
for (
var a = this.Eg,
b = this.Jb,
c = Infinity,
d = Infinity,
e = a.s,
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.s, 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.mc(!0);
break;
}
}
else this.mc(!0);
this.Eg = null;
c = this.diagram;
null !== c &&
c.animationManager.zb &&
((c = c.animationManager), (this.ef = b), c.dl.add(this));
up(this);
this.g('points', a, b);
}
};
t.$u = function() {
null !== this.Eg && ((this.Jb = this.Eg), (this.Eg = null));
};
function up(a) {
0 === a.Jb.count
? (a.xd = !1)
: ((a.xd = !0),
(a.Gp = null),
(a.Ys = NaN),
(a.defaultFromPoint = a.i(0)),
(a.defaultToPoint = a.i(a.pointsCount - 1)),
vp(a, !1));
}
t.ab = function() {
if (!this.suspendsRouting) {
var a = this.diagram;
if (a) {
if (a.Zr.contains(this) || a.undoManager.isUndoingRedoing) return;
a = a.animationManager;
if (a.isTicking && !a.isAnimating) return;
null !== this.ef && !a.isTicking && a.isAnimating && (this.ef = null);
}
a = this.path;
null !== a && ((this.xd = !1), this.w(), a.w());
}
};
t.mg = function() {
if (!this.xd && !this.computingPoints) {
var a = !0;
try {
(this.computingPoints = !0), this.jh(), (a = this.computePoints());
} catch (b) {
(this.computingPoints = !1), this.$u();
} finally {
(this.computingPoints = !1), a ? this.pf() : this.$u();
}
}
};
T.prototype.computePoints = function() {
if (null === this.diagram) return !1;
var a = this.fromNode,
b = null;
null === a
? (wp || ((wp = new V()), (wp.desiredSize = Db), wp.Za()),
this.defaultFromPoint &&
((wp.location = this.defaultFromPoint), wp.Za(), (b = a = wp)))
: (b = this.fromPort);
if (null !== b && !a.isVisible()) {
var c = a.findVisibleNode();
null !== c && c !== a ? ((a = c), (b = c.port)) : (a = c);
}
this.pw = a;
if (null === a || !a.location.v()) return !1;
for (; !(null === b || (b.actualBounds.v() && b.zf())); ) b = b.panel;
if (null === b) return !1;
var d = this.toNode,
e = null;
null === d
? (xp || ((xp = new V()), (xp.desiredSize = Db), xp.Za()),
this.defaultToPoint &&
((xp.location = this.defaultToPoint), xp.Za(), (e = d = xp)))
: (e = this.toPort);
null === e ||
d.isVisible() ||
((c = d.findVisibleNode()),
null !== c && c !== d ? ((d = c), (e = c.port)) : (d = c));
this.qw = d;
if (null === d || !d.location.v()) return !1;
for (; !(null === e || (e.actualBounds.v() && e.zf())); ) e = e.panel;
if (null === e) return !1;
var f = this.pointsCount,
g = this.computeSpot(!0, b);
c = this.computeSpot(!1, e);
var h = yp(g),
k = yp(c),
l = b === e && null !== b,
m = this.isOrthogonal,
n = this.curve === cg;
this.Mf = l && !m ? (n = !0) : !1;
var p = this.computeAdjusting() === $f || l;
if (!m && !l && h && k) {
if (
((h = !1),
!p &&
3 <= f &&
((p = this.getLinkPoint(a, b, g, !0, !1, d, e)),
(k = this.getLinkPoint(d, e, c, !1, !1, a, b)),
(h = this.adjustPoints(0, p, f - 1, k))) &&
((p = this.getLinkPoint(a, b, g, !0, !1, d, e)),
(k = this.getLinkPoint(d, e, c, !1, !1, a, b)),
this.adjustPoints(0, p, f - 1, k)),
!h)
)
if ((this.Aj(), n)) {
f = this.getLinkPoint(a, b, g, !0, !1, d, e);
p = this.getLinkPoint(d, e, c, !1, !1, a, b);
h = p.x - f.x;
k = p.y - f.y;
l = this.computeCurviness();
n = m = 0;
var r = f.x + h / 3,
q = f.y + k / 3,
u = r,
w = q;
J.B(k, 0)
? (w = 0 < h ? w - l : w + l)
: ((m = -h / k),
(n = Math.sqrt((l * l) / (m * m + 1))),
0 > l && (n = -n),
(u = (0 > k ? -1 : 1) * n + r),
(w = m * (u - r) + q));
r = f.x + (2 * h) / 3;
q = f.y + (2 * k) / 3;
var v = r,
z = q;
J.B(k, 0)
? (z = 0 < h ? z - l : z + l)
: ((v = (0 > k ? -1 : 1) * n + r), (z = m * (v - r) + q));
this.Aj();
this.fe(f);
this.mf(u, w);
this.mf(v, z);
this.fe(p);
this.Wc(0, this.getLinkPoint(a, b, g, !0, !1, d, e));
this.Wc(3, this.getLinkPoint(d, e, c, !1, !1, a, b));
} else if (
((f = d),
(p = e),
(d = this.getLinkPoint(a, b, g, !0, !1, f, p)),
(e = this.getLinkPoint(f, p, c, !1, !1, a, b)),
this.hasCurviness())
)
(p = e.x - d.x),
(c = e.y - d.y),
(g = this.computeCurviness()),
(a = d.x + p / 2),
(b = d.y + c / 2),
(f = a),
(h = b),
J.B(c, 0)
? (h = 0 < p ? h - g : h + g)
: ((p = -p / c),
(f = Math.sqrt((g * g) / (p * p + 1))),
0 > g && (f = -f),
(f = (0 > c ? -1 : 1) * f + a),
(h = p * (f - a) + b)),
this.fe(d),
this.mf(f, h),
this.fe(e);
else {
this.fe(d);
this.fe(e);
h = M.alloc();
b.gi(h);
k = h.ba(e);
p.gi(h);
l = h.ba(d);
if (k || l)
(g = b.ia(zp(g), new I())),
this.Wc(0, this.getLinkPointFromPoint(a, b, g, e, !0, g)),
(c = p.ia(zp(c), new I())),
this.Wc(1, this.getLinkPointFromPoint(f, p, c, d, !1, c));
M.free(h);
}
} else {
n = this.isAvoiding;
p && ((m && n) || l) && this.Aj();
var y = l ? this.computeCurviness() : 0;
n = this.getLinkPoint(a, b, g, !0, m, d, e);
r = u = q = 0;
if (m || !h || l)
(w = this.computeEndSegmentLength(a, b, g, !0)),
(r = this.getLinkDirection(a, b, n, g, !0, m, d, e)),
l &&
(h || g.C(c) || (!m && 1 === g.x + c.x && 1 === g.y + c.y)) &&
((r -= m ? 90 : 30), 0 > y && (r -= 180)),
0 > r ? (r += 360) : 360 <= r && (r -= 360),
l && (w += Math.abs(y) * (m ? 1 : 2)),
0 === r
? (q = w)
: 90 === r
? (u = w)
: 180 === r
? (q = -w)
: 270 === r
? (u = -w)
: ((q = w * Math.cos((r * Math.PI) / 180)),
(u = w * Math.sin((r * Math.PI) / 180))),
g.Fc() &&
l &&
((w = b.ia(yc, I.alloc())),
(v = I.allocAt(w.x + 1e3 * q, w.y + 1e3 * u)),
this.getLinkPointFromPoint(a, b, w, v, !0, n),
I.free(w),
I.free(v));
w = this.getLinkPoint(d, e, c, !1, m, a, b);
var A = (z = v = 0);
if (m || !k || l) {
var B = this.computeEndSegmentLength(d, e, c, !1);
A = this.getLinkDirection(d, e, w, c, !1, m, a, b);
l &&
(k || g.C(c) || (!m && 1 === g.x + c.x && 1 === g.y + c.y)) &&
((A += m ? 0 : 30), 0 > y && (A += 180));
0 > A ? (A += 360) : 360 <= A && (A -= 360);
l && (B += Math.abs(y) * (m ? 1 : 2));
0 === A
? (v = B)
: 90 === A
? (z = B)
: 180 === A
? (v = -B)
: 270 === A
? (z = -B)
: ((v = B * Math.cos((A * Math.PI) / 180)),
(z = B * Math.sin((A * Math.PI) / 180)));
c.Fc() &&
l &&
((c = e.ia(yc, I.alloc())),
(g = I.allocAt(c.x + 1e3 * v, c.y + 1e3 * z)),
this.getLinkPointFromPoint(d, e, c, g, !1, w),
I.free(c),
I.free(g));
}
c = n;
if (m || !h || l) c = new I(n.x + q, n.y + u);
g = w;
if (m || !k || l) g = new I(w.x + v, w.y + z);
!p && !m && h && 3 < f && this.adjustPoints(0, n, f - 2, g)
? this.Wc(f - 1, w)
: !p && !m && k && 3 < f && this.adjustPoints(1, c, f - 1, w)
? this.Wc(0, n)
: !p && (m ? 6 <= f : 4 < f) && this.adjustPoints(1, c, f - 2, g)
? (this.Wc(0, n), this.Wc(f - 1, w))
: (this.Aj(),
this.fe(n),
(m || !h || l) && this.fe(c),
m && this.addOrthoPoints(c, r, g, A, a, d),
(m || !k || l) && this.fe(g),
this.fe(w));
}
return !0;
};
function Ap(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;
}
T.prototype.getLinkPointFromPoint = function(a, b, c, d, e, f) {
void 0 === f && (f = new I());
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.ke() || (e = e.panel);
if (null === e) {
e = d.x;
d = d.y;
var g = c.x;
c = c.y;
} else {
a = e.ge;
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.Kj(e, d, g, c, f);
null !== a && f.transform(a);
return f;
};
function Bp(a, b) {
var c = b.Hn;
null === c && ((c = new Cp()), (c.port = b), (c.node = b.part), (b.Hn = c));
return Dp(c, a);
}
T.prototype.getLinkPoint = function(a, b, c, d, e, f, g, h) {
void 0 === h && (h = new I());
if (c.pb() && !yp(c)) return b.ia(c, h), h;
if (c.Uc()) {
var k = Bp(this, b);
if (null !== k) {
h.assign(k.Co);
if (e && this.routing === Ep) {
var l = Bp(this, g);
if (null !== l && k.tl < l.tl) {
k = I.alloc();
l = I.alloc();
var m = new M(b.ia(tc, k), b.ia(Cc, l)),
n = this.computeSpot(!d, g);
a = this.getLinkPoint(f, g, n, !d, e, a, b, l);
(c.xf(Ec) || c.xf(Gc)) && a.y >= m.y && a.y <= m.y + m.height
? (h.y = a.y)
: (c.xf(Dc) || c.xf(Hc)) &&
a.x >= m.x &&
a.x <= m.x + m.width &&
(h.x = a.x);
I.free(k);
I.free(l);
}
}
return h;
}
}
c = b.ia(zp(c), I.alloc());
this.pointsCount > (e ? 6 : 2)
? ((g = d ? this.i(1) : this.i(this.pointsCount - 2)),
e && (g = Ap(c, g.copy())))
: ((k = this.computeSpot(!d, g)),
(f = I.alloc()),
(g = g.ia(zp(k), f)),
e && (g = Ap(c, g)),
I.free(f));
this.getLinkPointFromPoint(a, b, c, g, d, h);
I.free(c);
return h;
};
T.prototype.getLinkDirection = function(a, b, c, d, e, f, g, h) {
a: if (d.pb())
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
: 0.5 > d.x
? 225
: 0.5 < d.x
? 45
: 0;
else {
if (d.Uc() && ((k = Bp(this, b)), null !== k))
switch (k.Gc) {
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.ia(yc, I.alloc());
this.pointsCount > (f ? 6 : 2)
? ((h = e ? this.i(1) : this.i(this.pointsCount - 2)),
(h = f ? Ap(k, h.copy()) : c))
: ((c = I.alloc()), (h = h.ia(yc, c)), I.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;
I.free(k);
k = c;
}
d.Fc() && g.Md(a) && ((k += 180), 360 <= k && (k -= 360));
if (yp(d)) return k;
a = b.fi();
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;
};
T.prototype.computeEndSegmentLength = function(a, b, c, d) {
if (null !== b && c.Uc() && ((a = Bp(this, b)), null !== a)) return a.tu;
a = d ? this.fromEndSegmentLength : this.toEndSegmentLength;
null !== b &&
isNaN(a) &&
(a = d ? b.fromEndSegmentLength : b.toEndSegmentLength);
isNaN(a) && (a = 10);
return a;
};
T.prototype.computeSpot = function(a, b) {
void 0 === b && (b = null);
a
? ((a = b ? b : this.fromPort),
null === a
? (a = yc)
: ((b = this.fromSpot),
b.Sb() && (b = a.fromSpot),
(a = b === Wc ? sc : b)))
: ((a = b ? b : this.toPort),
null === a
? (a = yc)
: ((b = this.toSpot),
b.Sb() && (b = a.toSpot),
(a = b === Wc ? sc : b)));
return a;
};
function yp(a) {
return a === sc || (0.5 === a.x && 0.5 === a.y);
}
function zp(a) {
return 0.5 === a.x && 0.5 === a.y ? a : yc;
}
T.prototype.computeOtherPoint = function(a, b) {
if (this.computeAdjusting() !== $f && 4 < this.pointsCount)
return this.computeMidPoint(new I());
a = b.Hn;
a = null !== a ? Dp(a, this) : null;
return null !== a ? a.Co : b.ia(yc);
};
T.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;
};
T.prototype.tf = 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 = md.alloc()), g.reset());
g.multiply(this.transform);
if (this.Wg(a, g)) return dn(this, b, c, e), void 0 === f && md.free(g), !0;
if (this.Sc(a, g)) {
var h = !1;
if (!this.isAtomic)
for (var k = this.R.s, 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 = md.alloc();
n.set(g);
if (m instanceof W) h = m.tf(a, b, c, d, e, n);
else if (this.path === m) {
if (m instanceof Cf)
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.Wg(r, q)) h = !0;
else {
if (
void 0 === q &&
((q = m.transform), r.Ee(m.actualBounds))
) {
h = !0;
break b;
}
h = r.left;
p = r.right;
var u = r.top;
r = r.bottom;
var w = I.alloc(),
v = I.alloc(),
z = I.alloc(),
y = md.alloc();
y.set(q);
y.Ou(m.transform);
y.Tr();
v.x = p;
v.y = u;
v.transform(y);
w.x = h;
w.y = u;
w.transform(y);
q = !1;
Cn(m, w, v, z)
? (q = !0)
: ((w.x = p),
(w.y = r),
w.transform(y),
Cn(m, w, v, z)
? (q = !0)
: ((v.x = h),
(v.y = r),
v.transform(y),
Cn(m, w, v, z)
? (q = !0)
: ((w.x = h),
(w.y = u),
w.transform(y),
Cn(m, w, v, z) && (q = !0))));
md.free(y);
I.free(w);
I.free(v);
I.free(z);
h = q;
}
}
else h = m.Wg(h, n);
} else h = hl(m, a, d, n);
h &&
((p = m),
null !== b && (p = b(m)),
p && (null === c || c(p)) && e.add(p));
md.free(n);
}
}
}
void 0 === f && md.free(g);
return h || null !== this.background || null !== this.areaBackground;
}
void 0 === f && md.free(g);
return !1;
};
T.prototype.computeCurve = function() {
if (null === this.Mf) {
var a = this.fromPort,
b = this.isOrthogonal;
this.Mf = null !== a && a === this.toPort && !b;
}
return this.Mf ? cg : this.curve;
};
T.prototype.computeCorner = function() {
if (this.curve === cg) return 0;
var a = this.corner;
if (isNaN(a) || 0 > a) a = 10;
return a;
};
T.prototype.findMidLabel = function() {
for (var a = this.path, b = this.R.s, 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;
};
T.prototype.computeSpacing = function() {
if (!this.isVisible()) return 0;
var a = Fp;
a = Math.max(a, 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 === Tm || d === Um || d === qp
? (a = Math.max(a, e))
: d === Om || d === Pm || d === Mm || d === Nm
? (a = Math.max(a, g))
: ((b = (b.ia(yc).Ya(c.ia(yc)) / 180) * Math.PI),
(a = Math.max(
a,
Math.abs(Math.sin(b) * g) + Math.abs(Math.cos(b) * e) + 1,
)));
this.curve === cg && (a *= 1.333);
}
}
return a;
};
T.prototype.arrangeBundledLinks = function(a, b) {
if (b)
for (b = 0; b < a.length; b++) {
var c = a[b];
c.computeAdjusting() === $f && c.ab();
}
};
T.prototype.computeCurviness = function() {
var a = this.curviness;
if (isNaN(a)) {
a = Gp;
var b = this.If;
if (null !== b) {
for (var c = Ea(), 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.cs === this.fromNode && (a = -a);
Ga(c);
}
}
return a;
};
T.prototype.computeThickness = function() {
if (!this.isVisible()) return 0;
var a = this.path;
return null !== a ? Math.max(a.strokeWidth, 1) : 1;
};
T.prototype.hasCurviness = function() {
return !isNaN(this.curviness) || null !== this.If;
};
T.prototype.adjustPoints = function(a, b, c, d) {
var e = this.computeAdjusting();
if (this.isOrthogonal) {
if (e === op) return !1;
e === pp && (e = np);
}
switch (e) {
case op:
var f = this.i(a),
g = this.i(c);
if (!f.$a(b) || !g.$a(d)) {
e = f.x;
f = f.y;
var h = g.x - e,
k = g.y - f,
l = Math.sqrt(h * h + k * k);
if (!J.ca(l, 0)) {
if (J.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);
J.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.Wc(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)),
J.ca(b, 0) ||
(J.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.Wc(c, d);
}
}
return !0;
case pp:
f = this.i(a);
n = this.i(c);
if (!f.$a(b) || !n.$a(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.Wc(a, b);
for (a += 1; a < c; a++) {
b = this.i(a);
var u = b.x,
w = b.y,
v = 0.5;
0 !== l && (v = ((e - u) * (e - g) + (f - w) * (f - n)) / l);
var z = e + v * (g - e),
y = f + v * (n - f);
b = Math.sqrt((u - z) * (u - z) + (w - y) * (w - y));
w < q * (u - z) + y && (b = -b);
0 < q && (b = -b);
u = h + v * (k - h);
v = m + v * (p - m);
0 !== q
? ((b = u + b / r), this.M(a, b, v - (b - u) / q))
: this.M(a, u, v + b);
}
this.Wc(c, d);
}
return !0;
case np:
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),
J.B(e.y, f.y)
? J.B(f.x, g.x)
? (m = b.y)
: J.B(f.y, g.y) && (h = b.x)
: J.B(e.x, f.x) &&
(J.B(f.y, g.y) ? (h = b.x) : J.B(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),
J.B(e.y, f.y)
? J.B(f.x, g.x)
? (m = d.y)
: J.B(f.y, g.y) && (h = d.x)
: J.B(e.x, f.x) &&
(J.B(f.y, g.y) ? (h = d.x) : J.B(f.x, g.x) && (m = d.y)),
this.M(c - 1, h, m),
Lj(this))
) {
this.M(a + 1, n, l);
this.M(c - 1, k, p);
c = !1;
break a;
}
this.Wc(a, b);
this.Wc(c, d);
c = !0;
}
return c;
default:
return !1;
}
};
T.prototype.addOrthoPoints = function(a, b, c, d, e, f) {
0 > b ? (b += 360) : 360 <= b && (b -= 360);
0 > d ? (d += 360) : 360 <= d && (d -= 360);
var g = d;
b =
315 <= b || 45 > b
? 0
: 45 <= b && 135 > b
? 90
: 135 <= b && 225 > b
? 180
: 270;
d =
315 <= d || 45 > d
? 0
: 45 <= d && 135 > d
? 90
: 135 <= d && 225 > d
? 180
: 270;
var h = e.actualBounds.copy(),
k = f.actualBounds.copy();
if (h.v() && k.v()) {
h.vc(Hp, Hp);
k.vc(Hp, Hp);
h.Me(a);
k.Me(c);
var l = I.alloc(),
m = I.alloc();
if (0 === b)
if (
c.x > a.x ||
(270 === d && c.y < a.y && k.right > a.x) ||
(90 === d && c.y > a.y && k.right > a.x)
)
l.h(c.x, a.y),
m.h(c.x, (a.y + c.y) / 2),
180 === d
? ((l.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)),
(m.x = l.x),
(m.y = c.y))
: (270 === d && c.y < a.y) || (90 === d && c.y > a.y)
? ((l.x =
a.x < k.left
? this.computeMidOrthoPosition(a.x, a.y, k.left, c.y, !1)
: a.x < k.right &&
((270 === d && a.y < k.top) ||
(90 === d && a.y > k.bottom))
? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)
: k.right),
(m.x = l.x),
(m.y = c.y))
: 0 === d &&
a.x < k.left &&
a.y > k.top &&
a.y < k.bottom &&
((l.x = a.x),
(l.y =
a.y < c.y ? Math.min(c.y, k.top) : Math.max(c.y, k.bottom)),
(m.y = l.y));
else {
l.h(a.x, c.y);
m.h((a.x + c.x) / 2, c.y);
if (
180 === d ||
(90 === d && c.y < h.top) ||
(270 === d && c.y > h.bottom)
)
180 === d && (k.ba(a) || h.ba(c))
? (l.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0))
: c.y < a.y && (180 === d || 90 === d)
? (l.y = this.computeMidOrthoPosition(
a.x,
h.top,
c.x,
Math.max(c.y, k.bottom),
!0,
))
: c.y > a.y &&
(180 === d || 270 === d) &&
(l.y = this.computeMidOrthoPosition(
a.x,
h.bottom,
c.x,
Math.min(c.y, k.top),
!0,
)),
(m.x = c.x),
(m.y = l.y);
if (l.y > h.top && l.y < h.bottom)
if (
(c.x >= h.left && c.x <= a.x) ||
(a.x <= k.right && a.x >= c.x)
) {
if (90 === d || 270 === d)
l.h(Math.max((a.x + c.x) / 2, a.x), a.y), m.h(l.x, c.y);
} else
(l.y =
270 === d || ((0 === d || 180 === d) && c.y < a.y)
? Math.min(c.y, 0 === d ? h.top : Math.min(h.top, k.top))
: Math.max(
c.y,
0 === d ? h.bottom : Math.max(h.bottom, k.bottom),
)),
(m.x = c.x),
(m.y = l.y);
}
else if (180 === b)
if (
c.x < a.x ||
(270 === d && c.y < a.y && k.left < a.x) ||
(90 === d && c.y > a.y && k.left < a.x)
)
l.h(c.x, a.y),
m.h(c.x, (a.y + c.y) / 2),
0 === d
? ((l.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)),
(m.x = l.x),
(m.y = c.y))
: (270 === d && c.y < a.y) || (90 === d && c.y > a.y)
? ((l.x =
a.x > k.right
? this.computeMidOrthoPosition(a.x, a.y, k.right, c.y, !1)
: a.x > k.left &&
((270 === d && a.y < k.top) ||
(90 === d && a.y > k.bottom))
? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)
: k.left),
(m.x = l.x),
(m.y = c.y))
: 180 === d &&
a.x > k.right &&
a.y > k.top &&
a.y < k.bottom &&
((l.x = a.x),
(l.y =
a.y < c.y ? Math.min(c.y, k.top) : Math.max(c.y, k.bottom)),
(m.y = l.y));
else {
l.h(a.x, c.y);
m.h((a.x + c.x) / 2, c.y);
if (
0 === d ||
(90 === d && c.y < h.top) ||
(270 === d && c.y > h.bottom)
)
0 === d && (k.ba(a) || h.ba(c))
? (l.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0))
: c.y < a.y && (0 === d || 90 === d)
? (l.y = this.computeMidOrthoPosition(
a.x,
h.top,
c.x,
Math.max(c.y, k.bottom),
!0,
))
: c.y > a.y &&
(0 === d || 270 === d) &&
(l.y = this.computeMidOrthoPosition(
a.x,
h.bottom,
c.x,
Math.min(c.y, k.top),
!0,
)),
(m.x = c.x),
(m.y = l.y);
if (l.y > h.top && l.y < h.bottom)
if (
(c.x <= h.right && c.x >= a.x) ||
(a.x >= k.left && a.x <= c.x)
) {
if (90 === d || 270 === d)
l.h(Math.min((a.x + c.x) / 2, a.x), a.y), m.h(l.x, c.y);
} else
(l.y =
270 === d || ((0 === d || 180 === d) && c.y < a.y)
? Math.min(c.y, 180 === d ? h.top : Math.min(h.top, k.top))
: Math.max(
c.y,
180 === d ? h.bottom : Math.max(h.bottom, k.bottom),
)),
(m.x = c.x),
(m.y = l.y);
}
else if (90 === b)
if (
c.y > a.y ||
(180 === d && c.x < a.x && k.bottom > a.y) ||
(0 === d && c.x > a.x && k.bottom > a.y)
)
l.h(a.x, c.y),
m.h((a.x + c.x) / 2, c.y),
270 === d
? ((l.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)),
(m.x = c.x),
(m.y = l.y))
: (180 === d && c.x < a.x) || (0 === d && c.x > a.x)
? ((l.y =
a.y < k.top
? this.computeMidOrthoPosition(a.x, a.y, c.x, k.top, !0)
: a.y < k.bottom &&
((180 === d && a.x < k.left) ||
(0 === d && a.x > k.right))
? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)
: k.bottom),
(m.x = c.x),
(m.y = l.y))
: 90 === d &&
a.y < k.top &&
a.x > k.left &&
a.x < k.right &&
((l.x =
a.x < c.x ? Math.min(c.x, k.left) : Math.max(c.x, k.right)),
(l.y = a.y),
(m.x = l.x));
else {
l.h(c.x, a.y);
m.h(c.x, (a.y + c.y) / 2);
if (
270 === d ||
(0 === d && c.x < h.left) ||
(180 === d && c.x > h.right)
)
270 === d && (k.ba(a) || h.ba(c))
? (l.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1))
: c.x < a.x && (270 === d || 0 === d)
? (l.x = this.computeMidOrthoPosition(
h.left,
a.y,
Math.max(c.x, k.right),
c.y,
!1,
))
: c.x > a.x &&
(270 === d || 180 === d) &&
(l.x = this.computeMidOrthoPosition(
h.right,
a.y,
Math.min(c.x, k.left),
c.y,
!1,
)),
(m.x = l.x),
(m.y = c.y);
if (l.x > h.left && l.x < h.right)
if (
(c.y >= h.top && c.y <= a.y) ||
(a.y <= k.bottom && a.y >= c.y)
) {
if (0 === d || 180 === d)
l.h(a.x, Math.max((a.y + c.y) / 2, a.y)), m.h(c.x, l.y);
} else
(l.x =
180 === d || ((90 === d || 270 === d) && c.x < a.x)
? Math.min(c.x, 90 === d ? h.left : Math.min(h.left, k.left))
: Math.max(
c.x,
90 === d ? h.right : Math.max(h.right, k.right),
)),
(m.x = l.x),
(m.y = c.y);
}
else if (
c.y < a.y ||
(180 === d && c.x < a.x && k.top < a.y) ||
(0 === d && c.x > a.x && k.top < a.y)
)
l.h(a.x, c.y),
m.h((a.x + c.x) / 2, c.y),
90 === d
? ((l.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)),
(m.x = c.x),
(m.y = l.y))
: (180 === d && c.x < a.x) || (0 === d && c.x >= a.x)
? ((l.y =
a.y > k.bottom
? this.computeMidOrthoPosition(a.x, a.y, c.x, k.bottom, !0)
: a.y > k.top &&
((180 === d && a.x < k.left) || (0 === d && a.x > k.right))
? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)
: k.top),
(m.x = c.x),
(m.y = l.y))
: 270 === d &&
a.y > k.bottom &&
a.x > k.left &&
a.x < k.right &&
((l.x =
a.x < c.x ? Math.min(c.x, k.left) : Math.max(c.x, k.right)),
(l.y = a.y),
(m.x = l.x));
else {
l.h(c.x, a.y);
m.h(c.x, (a.y + c.y) / 2);
if (
90 === d ||
(0 === d && c.x < h.left) ||
(180 === d && c.x > h.right)
)
90 === d && (k.ba(a) || h.ba(c))
? (l.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1))
: c.x < a.x && (90 === d || 0 === d)
? (l.x = this.computeMidOrthoPosition(
h.left,
a.y,
Math.max(c.x, k.right),
c.y,
!1,
))
: c.x > a.x &&
(90 === d || 180 === d) &&
(l.x = this.computeMidOrthoPosition(
h.right,
a.y,
Math.min(c.x, k.left),
c.y,
!1,
)),
(m.x = l.x),
(m.y = c.y);
if (l.x > h.left && l.x < h.right)
if ((c.y <= h.bottom && c.y >= a.y) || (a.y >= k.top && a.y <= c.y)) {
if (0 === d || 180 === d)
l.h(a.x, Math.min((a.y + c.y) / 2, a.y)), m.h(c.x, l.y);
} else
(l.x =
180 === d || ((90 === d || 270 === d) && c.x < a.x)
? Math.min(c.x, 270 === d ? h.left : Math.min(h.left, k.left))
: Math.max(
c.x,
270 === d ? h.right : Math.max(h.right, k.right),
)),
(m.x = l.x),
(m.y = c.y);
}
var n = c;
if (this.isAvoiding) {
var p = this.diagram;
if (
null === p ||
e === f ||
this.layer.isTemporary ||
!dk(p) ||
(h.ba(n) && !f.Md(e)) ||
(k.ba(a) && !e.Md(f))
)
b = !1;
else {
var r = ek(p, !0, this.containingGroup, null);
if (
17 !== this.segmentIndex &&
r.Pj(
Math.min(a.x, l.x),
Math.min(a.y, l.y),
Math.abs(a.x - l.x),
Math.abs(a.y - l.y),
) &&
r.Pj(
Math.min(l.x, m.x),
Math.min(l.y, m.y),
Math.abs(l.x - m.x),
Math.abs(l.y - m.y),
) &&
r.Pj(
Math.min(m.x, n.x),
Math.min(m.y, n.y),
Math.abs(m.x - n.x),
Math.abs(m.y - n.y),
)
)
b = !1;
else {
e = a;
f = n;
var q = (c = null);
if (p.isVirtualized) {
p = r.bounds.copy();
p.vc(-r.lo, -r.ko);
var u = I.alloc();
jk(r, a.x, a.y) ||
(J.wf(
p.x,
p.y,
p.x + p.width,
p.y + p.height,
a.x,
a.y,
l.x,
l.y,
u,
)
? ((c = a = u.copy()), (b = u.Ya(l)))
: J.wf(
p.x,
p.y,
p.x + p.width,
p.y + p.height,
l.x,
l.y,
m.x,
m.y,
u,
)
? ((c = a = u.copy()), (b = u.Ya(m)))
: J.wf(
p.x,
p.y,
p.x + p.width,
p.y + p.height,
m.x,
m.y,
n.x,
n.y,
u,
) && ((c = a = u.copy()), (b = u.Ya(n))));
jk(r, n.x, n.y) ||
(J.wf(
p.x,
p.y,
p.x + p.width,
p.y + p.height,
n.x,
n.y,
m.x,
m.y,
u,
)
? ((q = n = u.copy()), (d = m.Ya(u)))
: J.wf(
p.x,
p.y,
p.x + p.width,
p.y + p.height,
m.x,
m.y,
l.x,
l.y,
u,
)
? ((q = n = u.copy()), (d = l.Ya(u)))
: J.wf(
p.x,
p.y,
p.x + p.width,
p.y + p.height,
l.x,
l.y,
a.x,
a.y,
u,
) && ((q = n = u.copy()), (d = a.Ya(u))));
I.free(u);
}
h = h.copy().Xc(k);
h.vc(r.lo * r.ps, r.ko * r.ps);
Ip(r, a, b, n, d, h, !0);
k = Jp(r, n.x, n.y);
!r.abort &&
k >= Kp &&
(ik(r),
h.vc(r.lo * r.mx, r.ko * r.nx),
Ip(r, a, b, n, d, h, !1),
(k = Jp(r, n.x, n.y)));
if (!r.abort && k < Kp && Jp(r, n.x, n.y) !== kk) {
Lp(this, r, n.x, n.y, d, !0, g);
h = this.i(2);
if (4 > this.pointsCount)
0 === b || 180 === b
? ((h.x = a.x), (h.y = n.y))
: ((h.x = n.x), (h.y = a.y)),
this.M(2, h.x, h.y),
this.l(3, h.x, h.y);
else if (((g = this.i(3)), 0 === b || 180 === b))
J.B(h.x, g.x)
? ((h = 0 === b ? Math.max(h.x, a.x) : Math.min(h.x, a.x)),
this.M(2, h, a.y),
this.M(3, h, g.y))
: J.B(h.y, g.y)
? (Math.abs(a.y - h.y) <= r.ko / 2 &&
(this.M(2, h.x, a.y), this.M(3, g.x, a.y)),
this.l(2, h.x, a.y))
: this.M(2, a.x, h.y);
else if (90 === b || 270 === b)
J.B(h.y, g.y)
? ((h = 90 === b ? Math.max(h.y, a.y) : Math.min(h.y, a.y)),
this.M(2, a.x, h),
this.M(3, g.x, h))
: J.B(h.x, g.x)
? (Math.abs(a.x - h.x) <= r.lo / 2 &&
(this.M(2, a.x, h.y), this.M(3, a.x, g.y)),
this.l(2, a.x, h.y))
: this.M(2, h.x, a.y);
null !== c &&
((a = this.i(1)),
(g = this.i(2)),
a.x !== g.x && a.y !== g.y
? 0 === b || 180 === b
? this.l(2, a.x, g.y)
: this.l(2, g.x, a.y)
: 0 === b || 180 === b
? this.l(2, e.x, c.y)
: this.l(2, c.x, e.y));
null !== q &&
(0 === d || 180 === d ? this.mf(f.x, q.y) : this.mf(q.x, f.y));
b = !0;
} else b = !1;
}
}
} else b = !1;
b || (this.fe(l.copy()), this.fe(m.copy()));
I.free(l);
I.free(m);
}
};
T.prototype.computeMidOrthoPosition = function(a, b, c, d, e) {
var f = 0;
!this.hasCurviness() ||
this.computeSpot(!0, this.fromPort).Uc() ||
this.computeSpot(!1, this.toPort).Uc() ||
(f = this.computeCurviness());
return e ? (b + d) / 2 + f : (a + c) / 2 + f;
};
function Lj(a) {
if (null === a.diagram || !a.isAvoiding || !dk(a.diagram)) return !1;
var b = a.points.s,
c = b.length;
if (4 > c) return !1;
a = ek(a.diagram, !0, a.containingGroup, null);
for (var d = 1; d < c - 2; d++) {
var e = b[d],
f = b[d + 1];
if (
!a.Pj(
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 Lp(a, b, c, d, e, f, g) {
var h = b.lo,
k = b.ko,
l = Jp(b, c, d),
m = c,
n = d;
0 === e ? (m += h) : 90 === e ? (n += k) : 180 === e ? (m -= h) : (n -= k);
e !== g &&
l > Mp &&
Jp(b, m, n) !== l - 1 &&
(Jp(b, c - h, d) === l - 1
? ((e = 180), (m = c - h), (n = d))
: Jp(b, c + h, d) === l - 1
? ((e = 0), (m = c + h), (n = d))
: Jp(b, c, d - k) === l - 1
? ((e = 270), (m = c), (n = d - k))
: Jp(b, c, d + k) === l - 1 && ((e = 90), (m = c), (n = d + k)));
for (; l > Mp && Jp(b, m, n) === l - 1; )
(c = m),
(d = n),
0 === e
? (m += h)
: 90 === e
? (n += k)
: 180 === e
? (m -= h)
: (n -= k),
--l;
if (f) {
if (l > Mp)
if (180 === e || 0 === e) c = Math.floor(c / h) * h + h / 2;
else if (90 === e || 270 === e) d = Math.floor(d / k) * k + k / 2;
} else
(c = Math.floor(c / h) * h + h / 2), (d = Math.floor(d / k) * k + k / 2);
l > Mp &&
((f = e),
(g = c),
(m = d),
0 === e
? ((f = 90), (m += k))
: 90 === e
? ((f = 180), (g -= h))
: 180 === e
? ((f = 270), (m -= k))
: 270 === e && ((f = 0), (g += h)),
Jp(b, g, m) === l - 1
? Lp(a, b, g, m, f, !1, f)
: ((g = c),
(m = d),
0 === e
? ((f = 270), (m -= k))
: 90 === e
? ((f = 0), (g += h))
: 180 === e
? ((f = 90), (m += k))
: 270 === e && ((f = 180), (g -= h)),
Jp(b, g, m) === l - 1 && Lp(a, b, g, m, f, !1, f)));
a.mf(c, d);
}
T.prototype.Ny = function(a) {
var b = a.x;
a = a.y;
for (
var c = this.i(0),
d = this.i(1),
e = zb(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 = zb(b, a, d.x, d.y, c.x, c.y);
d = c;
h < e && ((f = g), (e = h));
}
return f;
};
T.prototype.mc = function(a) {
this.Zl = !1;
a && this.w();
};
T.prototype.Rj = function(a) {
if (!a) {
if (!1 === this.xd) return;
a = this.vb();
if (this.Zl && (null === a || null !== a.geometry)) return;
}
this.sa = this.makeGeometry();
a = this.path;
if (null !== a) {
a.sa = this.sa;
for (var b = this.R.s, c = b.length, d = 0; d < c; d++) {
var e = b[d];
e !== a && e.isPanelMain && e instanceof Cf && (e.sa = this.sa);
}
}
};
T.prototype.makeGeometry = function() {
var a = this.sa,
b = this.pointsCount;
if (2 > b) return (a.type = O.j), (this.Zl = !0), a;
var c = !1,
d = this.diagram;
null !== d &&
rp(this) &&
d.th.contains(this) &&
(0 !== this.bl.width || 0 !== this.bl.height) &&
(c = !0);
var e = this.i(0).copy(),
f = e.copy();
d = this.Jb.s;
var g = this.computeCurve();
if (g === cg && 3 <= b && !J.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.Yt.x;
k -= this.Yt.y;
e.x -= d;
e.y -= k;
if (2 !== b || rp(this)) {
a.type = O.m;
h = wd(a);
0 !== this.computeShortLength(!0) && (e = Np(this, e, !0, f));
xd(h, e.x, e.y, !1);
if (g === cg && 3 <= b && !J.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 = Np(this, e, !1, f)),
yd(h, b, c, b, c, e.x, e.y);
else if (this.isOrthogonal) {
b = I.allocAt(d, k);
c = I.alloc();
c.assign(this.i(1));
f = I.allocAt(d, k);
e = I.allocAt(d, k);
g = this.i(0);
for (
var l, m = this.smoothness / 3, n = 1;
n < this.pointsCount - 1;
n++
) {
l = this.i(n);
var p = g,
r = l,
q = this.i(Op(this, l, n, !1));
if (!J.ca(p.x, r.x) || !J.ca(r.x, q.x))
if (!J.ca(p.y, r.y) || !J.ca(r.y, q.y)) {
var u = m;
isNaN(u) && (u = this.smoothness / 3);
var w = p.x;
p = p.y;
var v = r.x;
r = r.y;
var z = q.x;
q = q.y;
var y = u * Pp(w, p, v, r);
u *= Pp(v, r, z, q);
J.ca(p, r) &&
J.ca(v, z) &&
(v > w
? q > r
? ((f.x = v - y),
(f.y = r - y),
(e.x = v + u),
(e.y = r + u))
: ((f.x = v - y),
(f.y = r + y),
(e.x = v + u),
(e.y = r - u))
: q > r
? ((f.x = v + y),
(f.y = r - y),
(e.x = v - u),
(e.y = r + u))
: ((f.x = v + y),
(f.y = r + y),
(e.x = v - u),
(e.y = r - u)));
J.ca(w, v) &&
J.ca(r, q) &&
(r > p
? (z > v
? ((f.x = v - y), (f.y = r - y), (e.x = v + u))
: ((f.x = v + y), (f.y = r - y), (e.x = v - u)),
(e.y = r + u))
: (z > v
? ((f.x = v - y), (f.y = r + y), (e.x = v + u))
: ((f.x = v + y), (f.y = r + y), (e.x = v - u)),
(e.y = r - u)));
if ((J.ca(w, v) && J.ca(v, z)) || (J.ca(p, r) && J.ca(r, q)))
(w = 0.5 * (w + z)),
(p = 0.5 * (p + q)),
(f.x = w),
(f.y = p),
(e.x = w),
(e.y = p);
1 === n
? ((c.x = 0.5 * (g.x + l.x)), (c.y = 0.5 * (g.y + l.y)))
: 2 === n &&
J.ca(g.x, this.i(0).x) &&
J.ca(g.y, this.i(0).y) &&
((c.x = 0.5 * (g.x + l.x)), (c.y = 0.5 * (g.y + l.y)));
yd(h, c.x - d, c.y - k, f.x - d, f.y - k, l.x - d, l.y - k);
b.set(f);
c.set(e);
g = l;
}
}
l = g.x;
g = g.y;
m = this.i(this.pointsCount - 1);
0 !== this.computeShortLength(!1) && (m = Np(this, m.copy(), !1, qb));
l = 0.5 * (l + m.x);
g = 0.5 * (g + m.y);
yd(h, e.x - d, e.y - k, l - d, g - k, m.x - d, m.y - k);
I.free(b);
I.free(c);
I.free(f);
I.free(e);
} 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 = Np(this, g.copy(), !1, qb)),
yd(h, f.x - d, f.y - k, e.x - d, e.y - k, g.x - d, g.y - k);
else {
f = I.alloc();
f.assign(this.i(0));
e = I.alloc();
e.assign(f);
g = this.computeCorner();
n = 1;
for (l = 0; n < b; ) {
n = Op(this, f, n, 1 < n);
m = this.i(n);
if (n >= b - 1) {
if (!f.C(m))
0 !== this.computeShortLength(!1) &&
(m = Np(this, m.copy(), !1, qb)),
Qp(this, h, -d, -k, f, m, c);
else if (0 === l)
for (n = 1; n < b; )
e.assign(f),
(m = this.i(n++)),
Qp(this, h, -d, -k, f, m, c),
f.assign(m);
break;
}
l = Op(this, m, n + 1, n < b - 3);
n = -d;
w = -k;
p = m;
v = this.i(l);
u = c;
if (J.B(f.y, p.y) && J.B(p.x, v.x))
if (
((q = Math.min(g, Math.abs(p.x - e.x) / 2)),
(q = y = Math.min(q, Math.abs(v.y - p.y) / 2)),
J.B(q, 0))
)
Qp(this, h, n, w, f, p, u), f.assign(p);
else {
var A = p.x,
B = p.y;
r = A;
z = B;
p.x > f.x ? (A = p.x - q) : (A = p.x + q);
v.y > p.y ? (z = p.y + y) : (z = p.y - y);
v = I.allocAt(A, B);
Qp(this, h, n, w, f, v, u);
I.free(v);
zd(h, p.x + n, p.y + w, r + n, z + w);
f.h(r, z);
}
else
J.B(f.x, p.x) && J.B(p.y, v.y)
? ((q = Math.min(g, Math.abs(p.y - e.y) / 2)),
(q = y = Math.min(q, Math.abs(v.x - p.x) / 2)),
J.B(y, 0)
? (Qp(this, h, n, w, f, p, u), f.assign(p))
: ((A = p.x),
(B = p.y),
(r = A),
(z = B),
p.y > f.y ? (B = p.y - q) : (B = p.y + q),
v.x > p.x ? (r = p.x + y) : (r = p.x - y),
(v = I.allocAt(A, B)),
Qp(this, h, n, w, f, v, u),
I.free(v),
zd(h, p.x + n, p.y + w, r + n, z + w),
f.h(r, z)))
: (Qp(this, h, n, w, f, p, u), f.assign(p));
e.assign(m);
n = l;
}
I.free(f);
}
Hd = h;
} else
(h = this.i(1).copy()),
(h.x -= d),
(h.y -= k),
0 !== this.computeShortLength(!0) && (e = Np(this, e, !0, f)),
0 !== this.computeShortLength(!1) && (h = Np(this, h, !1, f)),
(a.type = O.j),
(a.startX = e.x),
(a.startY = e.y),
(a.endX = h.x),
(a.endY = h.y);
this.Zl = !0;
return a;
};
function Pp(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 J.ca(a, 0) ? b : J.ca(b, 0) ? a : Math.sqrt(a * a + b * b);
}
function Np(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 = Pp(b.x, b.y, c, f);
if (0 === d) return b;
e = 2 === e ? 0.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 = Pp(b.x, b.y, c, f);
if (0 === d) return b;
e = 2 === e ? 0.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 Op(a, b, c, d) {
for (var e = a.pointsCount, f = b; J.ca(b.x, f.x) && J.ca(b.y, f.y); ) {
if (c >= e) return e - 1;
f = a.i(c++);
}
if (!J.ca(b.x, f.x) && !J.ca(b.y, f.y)) return c - 1;
for (
var g = f;
(J.ca(b.x, f.x) &&
J.ca(f.x, g.x) &&
(!d || (b.y >= f.y ? f.y >= g.y : f.y <= g.y))) ||
(J.ca(b.y, f.y) &&
J.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;
}
T.prototype.computeJumpLength = function() {
return 10;
};
function Qp(a, b, c, d, e, f, g) {
if (!g && rp(a)) {
g = a.computeJumpLength();
var h = g / 2,
k = [],
l = 0;
a.isVisible() && (l = Rp(a, e, f, k));
if (0 < l)
if (J.B(e.y, f.y))
if (e.x < f.x)
for (var m = 0; m < l; ) {
var n = Math.max(e.x, Math.min(k[m++] - h, f.x - g));
b.lineTo(n + c, f.y + d);
var p = n + c;
for (var r = Math.min(n + g, f.x); m < l; )
if (((n = k[m]), n < r + g)) m++, (r = Math.min(n + h, f.x));
else break;
n = f.y - g + d;
r += c;
var q = f.y + d;
a.curve === Zf ? xd(b, r, q, !1) : yd(b, p, n, r, n, r, q);
}
else
for (--l; 0 <= l; ) {
m = Math.min(e.x, Math.max(k[l--] + h, f.x + g));
b.lineTo(m + c, f.y + d);
p = m + c;
for (n = Math.max(m - g, f.x); 0 <= l; )
if (((m = k[l]), m > n - g)) l--, (n = Math.max(m - h, f.x));
else break;
m = f.y - g + d;
n += c;
r = f.y + d;
a.curve === Zf ? xd(b, n, r, !1) : yd(b, p, m, n, m, n, r);
}
else if (J.B(e.x, f.x))
if (e.y < f.y)
for (m = 0; m < l; ) {
n = Math.max(e.y, Math.min(k[m++] - h, f.y - g));
b.lineTo(f.x + c, n + d);
p = n + d;
for (n = Math.min(n + g, f.y); m < l; )
if (((r = k[m]), r < n + g)) m++, (n = Math.min(r + h, f.y));
else break;
r = f.x - g + c;
q = f.x + c;
n += d;
a.curve === Zf ? xd(b, q, n, !1) : yd(b, r, p, r, n, q, n);
}
else
for (--l; 0 <= l; ) {
m = Math.min(e.y, Math.max(k[l--] + h, f.y + g));
b.lineTo(f.x + c, m + d);
p = m + d;
for (m = Math.max(m - g, f.y); 0 <= l; )
if (((n = k[l]), n > m - g)) l--, (m = Math.max(n - h, f.y));
else break;
n = f.x - g + c;
r = f.x + c;
m += d;
a.curve === Zf ? xd(b, r, m, !1) : yd(b, n, p, n, m, r, m);
}
}
b.lineTo(f.x + c, f.y + d);
}
function Rp(a, b, c, d) {
var e = a.diagram;
if (null === e || b.C(c)) return 0;
for (e = e.layers; e.next(); ) {
var f = e.value;
if (null !== f && f.visible) {
f = f.Ma.s;
for (var g = f.length, h = 0; h < g; h++) {
var k = f[h];
if (k instanceof T) {
if (k === a)
return (
0 < d.length &&
d.sort(function(a, b) {
return a - b;
}),
d.length
);
if (k.isVisible() && rp(k)) {
var l = k.routeBounds;
l.v() &&
a.routeBounds.Sc(l) &&
!a.usesSamePort(k) &&
((l = k.path), null !== l && l.zf() && Sp(b, c, d, k));
}
}
}
}
}
0 < d.length &&
d.sort(function(a, b) {
return a - b;
});
return d.length;
}
function Sp(a, b, c, d) {
for (
var e = J.B(a.y, b.y),
f = d.pointsCount,
g = d.i(0),
h = I.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,
w = l.y;
if (!J.B(m, p)) {
if (
J.B(n, r) &&
J.B(q, u) &&
Math.min(m, p) < q &&
Math.max(m, p) > q &&
Math.min(g, w) < n &&
Math.max(g, w) > n &&
!J.B(g, w)
) {
h.x = q;
h.y = n;
m = !0;
break a;
}
} else if (
!J.B(n, r) &&
J.B(g, w) &&
Math.min(n, r) < g &&
Math.max(n, r) > g &&
Math.min(q, u) < m &&
Math.max(q, u) > m &&
!J.B(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;
}
I.free(h);
}
function rp(a) {
a = a.curve;
return a === Yf || a === Zf;
}
function vp(a, b) {
if (b || rp(a))
(b = a.diagram),
null === b ||
b.animationManager.isTicking ||
b.th.contains(a) ||
(0 === a.bl.width && 0 === a.bl.height) ||
b.th.add(a, a.bl.copy());
}
T.prototype.Ao = function(a) {
var b = this.layer;
if (null !== b && b.visible && !b.isTemporary) {
var c = b.diagram;
if (null !== c && !c.animationManager.isTicking) {
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.Ma.s;
for (var g = e.length, h = 0; h < g; h++) {
var k = e[h];
k instanceof T && (k === this ? (f = !0) : f && Tp(this, k, a));
}
} else if (d)
for (f = e.Ma.s, e = f.length, g = 0; g < e; g++)
(h = f[g]), h instanceof T && Tp(this, h, a);
}
}
}
};
function Tp(a, b, c) {
if (null !== b && b.Zl && b.xd && rp(b)) {
var d = b.routeBounds;
d.v() &&
(a.routeBounds.Sc(d) || c.Sc(d)) &&
(a.usesSamePort(b) || b.mc(!1));
}
}
T.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.$a(e)) return !0;
b = this.i(b - 1);
a = a.i(c - 1);
if (b.$a(a) || d.$a(a) || b.$a(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;
};
T.prototype.isVisible = function() {
if (!U.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;
};
T.prototype.Ub = function(a) {
U.prototype.Ub.call(this, a);
null !== this.If && this.If.Al();
if (null !== this.rd)
for (var b = this.rd.iterator; b.next(); ) b.value.Ub(a);
};
T.prototype.computeAdjusting = function() {
return this.isAvoiding &&
null !== this.diagram &&
this.diagram.animationManager.defaultAnimation.isAnimating
? np
: this.dk;
};
function sp(a) {
var b = a.Ue;
if (null !== b) {
var c = a.hf;
if (null !== c && isNaN(a.curviness)) {
for (
var d = a.Ve,
e = a.jf,
f = (a = null),
g = b.jb.s,
h = g.length,
k = 0;
k < h;
k++
) {
var l = g[k];
if (
(l.Ue === b && l.Ve === d && l.hf === c && l.jf === e) ||
(l.Ue === c && l.Ve === e && l.hf === b && l.jf === d)
)
null === f
? (f = l)
: (null === a && ((a = []), a.push(f)), a.push(l));
}
if (null !== a) {
f = Yo(b, c, d, e);
null === f && ((f = new Up(b, d, c, e)), Xo(b, f), Xo(c, f));
f.links = a;
for (b = 0; b < a.length; b++) a[b].If = f;
f.Al();
}
}
}
}
function tp(a) {
var b = a.If;
null !== b &&
isNaN(a.curviness) &&
((a.If = null),
(a = b.links.indexOf(a)),
0 <= a && (Da(b.links, a), b.Al()));
}
T.prototype.eh = function() {
return !0;
};
ma.Object.defineProperties(T.prototype, {
fromNode: {
get: function() {
return this.Ue;
},
set: function(a) {
var b = this.Ue;
if (b !== a) {
var c = this.fromPort;
null !== b && (this.hf !== b && bp(b, this, c), tp(this), this.D(2));
this.Ue = a;
null !== a && this.Ub(a.isVisible());
this.Mf = null;
this.ab();
var d = this.diagram;
null !== d && d.$ && d.partManager.setFromNodeForLink(this, a, b);
var e = this.fromPort,
f = this.fromPortChanged;
if (null !== f) {
var g = !0;
null !== d && ((g = d.$), (d.$ = !0));
f(this, c, e);
null !== d && (d.$ = g);
}
null !== a && (this.hf !== a && ap(a, this, e), sp(this), this.D(1));
this.g('fromNode', b, a);
To(this);
}
},
},
fromPortId: {
get: function() {
return this.Ve;
},
set: function(a) {
var b = this.Ve;
if (b !== a) {
var c = this.fromPort;
null !== c && Zo(c);
tp(this);
this.Ve = a;
var d = this.fromPort;
null !== d && Zo(d);
var e = this.diagram;
if (null !== e) {
var f = this.data,
g = e.model;
null !== f && g.ki() && g.dv(f, a);
}
c !== d &&
((this.Mf = null),
this.ab(),
(f = this.fromPortChanged),
null !== f &&
((g = !0),
null !== e && ((g = e.$), (e.$ = !0)),
f(this, c, d),
null !== e && (e.$ = g)));
sp(this);
this.g('fromPortId', b, a);
}
},
},
fromPort: {
get: function() {
var a = this.Ue;
return null === a ? null : a.Kr(this.Ve);
},
},
fromPortChanged: {
get: function() {
return this.Om;
},
set: function(a) {
var b = this.Om;
b !== a && ((this.Om = a), this.g('fromPortChanged', b, a));
},
},
toNode: {
get: function() {
return this.hf;
},
set: function(a) {
var b = this.hf;
if (b !== a) {
var c = this.toPort;
null !== b && (this.Ue !== b && bp(b, this, c), tp(this), this.D(2));
this.hf = a;
null !== a && this.Ub(a.isVisible());
this.Mf = null;
this.ab();
var d = this.diagram;
null !== d && d.$ && d.partManager.setToNodeForLink(this, a, b);
var e = this.toPort,
f = this.toPortChanged;
if (null !== f) {
var g = !0;
null !== d && ((g = d.$), (d.$ = !0));
f(this, c, e);
null !== d && (d.$ = g);
}
null !== a && (this.Ue !== a && ap(a, this, e), sp(this), this.D(1));
this.g('toNode', b, a);
To(this);
}
},
},
toPortId: {
get: function() {
return this.jf;
},
set: function(a) {
var b = this.jf;
if (b !== a) {
var c = this.toPort;
null !== c && Zo(c);
tp(this);
this.jf = a;
var d = this.toPort;
null !== d && Zo(d);
var e = this.diagram;
if (null !== e) {
var f = this.data,
g = e.model;
null !== f && g.ki() && g.hv(f, a);
}
c !== d &&
((this.Mf = null),
this.ab(),
(f = this.toPortChanged),
null !== f &&
((g = !0),
null !== e && ((g = e.$), (e.$ = !0)),
f(this, c, d),
null !== e && (e.$ = g)));
sp(this);
this.g('toPortId', b, a);
}
},
},
toPort: {
get: function() {
var a = this.hf;
return null === a ? null : a.Kr(this.jf);
},
},
toPortChanged: {
get: function() {
return this.Xn;
},
set: function(a) {
var b = this.Xn;
b !== a && ((this.Xn = a), this.g('toPortChanged', b, a));
},
},
fromSpot: {
get: function() {
return null !== this.aa ? this.aa.Qi : Wc;
},
set: function(a) {
var b = this.fromSpot;
b.C(a) ||
((a = a.J()),
this.Rc(),
(this.aa.Qi = a),
this.g('fromSpot', b, a),
(b.Uc() || a.Uc()) && null !== this.fromNode && Zo(this.fromPort),
this.ab());
},
},
fromEndSegmentLength: {
get: function() {
return null !== this.aa ? this.aa.Oi : NaN;
},
set: function(a) {
var b = this.fromEndSegmentLength;
b !== a &&
(0 > a && wa(a, '>= 0', T, 'fromEndSegmentLength'),
this.Rc(),
(this.aa.Oi = a),
this.g('fromEndSegmentLength', b, a),
this.ab());
},
},
fromShortLength: {
get: function() {
return null !== this.aa ? this.aa.Pi : NaN;
},
set: function(a) {
var b = this.fromShortLength;
b !== a &&
(this.Rc(),
(this.aa.Pi = a),
this.mc(!0),
this.g('fromShortLength', b, a));
},
},
toSpot: {
get: function() {
return null !== this.aa ? this.aa.tj : Wc;
},
set: function(a) {
var b = this.toSpot;
b.C(a) ||
((a = a.J()),
this.Rc(),
(this.aa.tj = a),
this.g('toSpot', b, a),
(b.Uc() || a.Uc()) && null !== this.toNode && Zo(this.toPort),
this.ab());
},
},
toEndSegmentLength: {
get: function() {
return null !== this.aa ? this.aa.rj : NaN;
},
set: function(a) {
var b = this.toEndSegmentLength;
b !== a &&
(0 > a && wa(a, '>= 0', T, 'toEndSegmentLength'),
this.Rc(),
(this.aa.rj = a),
this.g('toEndSegmentLength', b, a),
this.ab());
},
},
toShortLength: {
get: function() {
return null !== this.aa ? this.aa.sj : NaN;
},
set: function(a) {
var b = this.toShortLength;
b !== a &&
(this.Rc(),
(this.aa.sj = a),
this.mc(!0),
this.g('toShortLength', b, a));
},
},
isLabeledLink: {
get: function() {
return null === this.rd ? !1 : 0 < this.rd.count;
},
},
labelNodes: {
get: function() {
return null === this.rd ? Za : this.rd.iterator;
},
},
relinkableFrom: {
get: function() {
return 0 !== (this.Oa & 1);
},
set: function(a) {
var b = 0 !== (this.Oa & 1);
b !== a && ((this.Oa ^= 1), this.g('relinkableFrom', b, a), this.Rb());
},
},
relinkableTo: {
get: function() {
return 0 !== (this.Oa & 2);
},
set: function(a) {
var b = 0 !== (this.Oa & 2);
b !== a && ((this.Oa ^= 2), this.g('relinkableTo', b, a), this.Rb());
},
},
resegmentable: {
get: function() {
return 0 !== (this.Oa & 4);
},
set: function(a) {
var b = 0 !== (this.Oa & 4);
b !== a && ((this.Oa ^= 4), this.g('resegmentable', b, a), this.Rb());
},
},
isTreeLink: {
get: function() {
return 0 !== (this.Oa & 8);
},
set: function(a) {
var b = 0 !== (this.Oa & 8);
b !== a &&
((this.Oa ^= 8),
this.g('isTreeLink', b, a),
null !== this.fromNode && Ck(this.fromNode),
null !== this.toNode && Ck(this.toNode));
},
},
path: {
get: function() {
var a = this.vb();
return a instanceof Cf ? a : null;
},
},
routeBounds: {
get: function() {
this.mg();
var a = this.bl,
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.Me(e);
} else if (this.computeCurve() === cg && 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);
J.ql(e.x, e.y, d.x, d.y, d.x, d.y, f.x, f.y, 0.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);
J.ql(e.x, e.y, g.x, g.y, h.x, h.y, k.x, k.y, 0.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.Me(f),
e = 2;
e < d;
e++
)
(f = this.i(e)),
(b = Math.min(f.x, b)),
(c = Math.min(f.y, c)),
a.Me(f);
this.Yt.h(b - a.x, c - a.y);
}
return a;
},
},
midPoint: {
get: function() {
this.mg();
return this.computeMidPoint(new I());
},
},
midAngle: {
get: function() {
this.mg();
return this.computeMidAngle();
},
},
flattenedLengths: {
get: function() {
if (null === this.Gp) {
this.xd || up(this);
for (
var a = (this.Gp = []), b = this.pointsCount, c = 0;
c < b - 1;
c++
) {
var d = this.i(c);
var e = this.i(c + 1);
J.ca(d.x, e.x)
? ((d = e.y - d.y), 0 > d && (d = -d))
: J.ca(d.y, e.y)
? ((d = e.x - d.x), 0 > d && (d = -d))
: (d = Math.sqrt(d.rf(e)));
a.push(d);
}
}
return this.Gp;
},
},
flattenedTotalLength: {
get: function() {
var a = this.Ys;
if (isNaN(a)) {
for (
var b = this.flattenedLengths, c = b.length, d = (a = 0);
d < c;
d++
)
a += b[d];
this.Ys = a;
}
return a;
},
},
points: {
get: function() {
return this.Jb;
},
set: function(a) {
var b = this.Jb;
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 I(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 I(e.x, e.y).freeze());
}
} else if (a instanceof E)
for (c = a.copy(), a = c.iterator; a.next(); ) a.value.freeze();
else C('Link.points value is not an instance of List or Array: ' + a);
c.freeze();
this.Jb = c;
this.mc(!0);
up(this);
a = this.diagram;
null !== a &&
(a.ji || a.undoManager.isUndoingRedoing || a.Zr.add(this),
a.animationManager.zb &&
((a = a.animationManager), (this.ef = c), a.dl.add(this)));
this.g('points', b, c);
}
},
},
pointsCount: {
get: function() {
return this.Jb.count;
},
},
xd: {
get: function() {
return 0 !== (this.Oa & 16);
},
set: function(a) {
(0 !== (this.Oa & 16)) !== a && (this.Oa ^= 16);
},
},
suspendsRouting: {
get: function() {
return 0 !== (this.Oa & 32);
},
set: function(a) {
(0 !== (this.Oa & 32)) !== a && (this.Oa ^= 32);
},
},
computingPoints: {
get: function() {
return 0 !== (this.Oa & 64);
},
set: function(a) {
(0 !== (this.Oa & 64)) !== a && (this.Oa ^= 64);
},
},
defaultFromPoint: {
get: function() {
return this.m;
},
set: function(a) {
this.m = a.copy();
},
},
defaultToPoint: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a.copy();
},
},
isOrthogonal: {
get: function() {
return 2 === (this.kj.value & 2);
},
},
isAvoiding: {
get: function() {
return 4 === (this.kj.value & 4);
},
},
Zl: {
get: function() {
return 0 !== (this.Oa & 128);
},
set: function(a) {
(0 !== (this.Oa & 128)) !== a && (this.Oa ^= 128);
},
},
geometry: {
get: function() {
this.Zl || (this.mg(), (this.sa = this.makeGeometry()));
return this.sa;
},
},
firstPickIndex: {
get: function() {
return 2 >= this.pointsCount
? 0
: this.isOrthogonal || !yp(this.computeSpot(!0))
? 1
: 0;
},
},
lastPickIndex: {
get: function() {
var a = this.pointsCount;
return 0 === a
? 0
: 2 >= a
? a - 1
: this.isOrthogonal || !yp(this.computeSpot(!1))
? a - 2
: a - 1;
},
},
adjusting: {
get: function() {
return this.dk;
},
set: function(a) {
var b = this.dk;
b !== a && ((this.dk = a), this.g('adjusting', b, a));
},
},
corner: {
get: function() {
return this.wm;
},
set: function(a) {
var b = this.wm;
b !== a && ((this.wm = a), this.mc(!0), this.g('corner', b, a));
},
},
curve: {
get: function() {
return this.ym;
},
set: function(a) {
var b = this.ym;
b !== a &&
((this.ym = a),
this.ab(),
this.mc(!0),
vp(this, b === Zf || b === Yf || a === Zf || a === Yf),
this.g('curve', b, a));
},
},
curviness: {
get: function() {
return this.zm;
},
set: function(a) {
var b = this.zm;
b !== a &&
((this.zm = a), this.ab(), this.mc(!1), this.g('curviness', b, a));
},
},
routing: {
get: function() {
return this.kj;
},
set: function(a) {
var b = this.kj;
b !== a &&
((this.kj = a),
(this.Mf = null),
this.ab(),
vp(this, 2 === (b.value & 2) || 2 === (a.value & 2)),
this.g('routing', b, a));
},
},
smoothness: {
get: function() {
return this.Sn;
},
set: function(a) {
var b = this.Sn;
b !== a && ((this.Sn = a), this.mc(!0), this.g('smoothness', b, a));
},
},
key: {
get: function() {
var a = this.diagram;
if (null !== a && a.model.ki()) return a.model.uc(this.data);
},
},
});
T.prototype.invalidateOtherJumpOvers = T.prototype.Ao;
T.prototype.findClosestSegment = T.prototype.Ny;
T.prototype.updateRoute = T.prototype.mg;
T.prototype.invalidateRoute = T.prototype.ab;
T.prototype.rollbackRoute = T.prototype.$u;
T.prototype.commitRoute = T.prototype.pf;
T.prototype.startRoute = T.prototype.jh;
T.prototype.clearPoints = T.prototype.Aj;
T.prototype.removePoint = T.prototype.Yu;
T.prototype.addPointAt = T.prototype.mf;
T.prototype.addPoint = T.prototype.fe;
T.prototype.insertPointAt = T.prototype.l;
T.prototype.insertPoint = T.prototype.sz;
T.prototype.setPointAt = T.prototype.M;
T.prototype.setPoint = T.prototype.Wc;
T.prototype.getPoint = T.prototype.i;
T.prototype.getOtherPort = T.prototype.jz;
T.prototype.getOtherNode = T.prototype.wo;
var wp = null,
xp = null,
mp = new D(T, 'Normal', 1),
Vp = new D(T, 'Orthogonal', 2),
Wp = new D(T, 'AvoidsNodes', 6),
Ep = new D(T, 'AvoidsNodesStraight', 7),
$f = new D(T, 'None', 0),
cg = new D(T, 'Bezier', 9),
Zf = new D(T, 'JumpGap', 10),
Yf = new D(T, 'JumpOver', 11),
np = new D(T, 'End', 17),
op = new D(T, 'Scale', 18),
pp = new D(T, 'Stretch', 19),
Tm = new D(T, 'OrientAlong', 21),
Mm = new D(T, 'OrientPlus90', 22),
Om = new D(T, 'OrientMinus90', 23),
qp = new D(T, 'OrientOpposite', 24),
Um = new D(T, 'OrientUpright', 25),
Nm = new D(T, 'OrientPlus90Upright', 26),
Pm = new D(T, 'OrientMinus90Upright', 27),
Qm = new D(T, 'OrientUpright45', 28),
Gp = 16,
Fp = 14,
Hp = 8;
T.className = 'Link';
T.Normal = mp;
T.Orthogonal = Vp;
T.AvoidsNodes = Wp;
T.AvoidsNodesStraight = Ep;
T.None = $f;
T.Bezier = cg;
T.JumpGap = Zf;
T.JumpOver = Yf;
T.End = np;
T.Scale = op;
T.Stretch = pp;
T.OrientAlong = Tm;
T.OrientPlus90 = Mm;
T.OrientMinus90 = Om;
T.OrientOpposite = qp;
T.OrientUpright = Um;
T.OrientPlus90Upright = Nm;
T.OrientMinus90Upright = Pm;
T.OrientUpright45 = Qm;
T.EndSegmentStep = 8;
T.CurvinessStart = Gp;
T.SpacingMin = Fp;
T.OrthoShortCut = Hp;
function Up(a, b, c, d) {
Ra(this);
this.ue = this.Sp = !1;
this.cs = a;
this.vx = b;
this.Pu = c;
this.wx = d;
this.links = [];
}
Up.prototype.Al = function() {
if (!this.Sp) {
var a = this.links;
0 < a.length &&
((a = a[0].diagram),
null !== a &&
(a.Uv.add(this), (this.ue = a.undoManager.isUndoingRedoing)));
}
this.Sp = !0;
};
Up.prototype.rv = function() {
if (this.Sp) {
this.Sp = !1;
var a = this.links;
if (0 < a.length) {
var b = a[0],
c = b.diagram;
c = null === c || (c.ji && !this.ue);
this.ue = !1;
b.arrangeBundledLinks(a, c);
1 === a.length && ((b.If = null), (a.length = 0));
}
0 === a.length &&
((a = this.cs),
null !== this && null !== a.Qe && a.Qe.remove(this),
(a = this.Pu),
null !== this && null !== a.Qe && a.Qe.remove(this));
}
};
Up.className = 'LinkBundle';
function fk(a) {
Ra(this);
this.Hx = this.group = null;
this.Sr = !0;
this.abort = !1;
this.Ed = this.Dd = 1;
this.mn = this.ln = -1;
this.nc = a.width;
this.oc = a.height;
this.Xb = null;
this.Xh = this.Wh = 0;
this.ps = 11;
this.nx = this.mx = 22;
}
fk.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.Dd = Math.floor((a.x - this.nc) / this.nc) * this.nc;
this.Ed = Math.floor((b - this.oc) / this.oc) * this.oc;
this.ln = Math.ceil((c + 2 * this.nc) / this.nc) * this.nc;
this.mn = Math.ceil((d + 2 * this.oc) / this.oc) * this.oc;
a = 1 + (Math.ceil((this.ln - this.Dd) / this.nc) | 0);
b = 1 + (Math.ceil((this.mn - this.Ed) / this.oc) | 0);
if (null === this.Xb || this.Wh < a - 1 || this.Xh < b - 1) {
c = [];
for (d = 0; d <= a; d++) c[d] = new Uint32Array(b);
this.Xb = c;
this.Wh = a - 1;
this.Xh = b - 1;
}
a = Xp;
if (null !== this.Xb)
for (b = 0; b <= this.Wh; b++)
if (((c = this.Xb[b]), c.fill)) c.fill(a);
else for (d = 0; d <= this.Xh; d++) c[d] = a;
}
};
function jk(a, b, c) {
return a.Dd <= b && b <= a.ln && a.Ed <= c && c <= a.mn;
}
function Jp(a, b, c) {
if (!jk(a, b, c)) return Xp;
b -= a.Dd;
b /= a.nc;
c -= a.Ed;
c /= a.oc;
return a.Xb[b | 0][c | 0];
}
function ik(a) {
if (null !== a.Xb)
for (var b = 0; b <= a.Wh; b++)
for (var c = a.Xb[b], d = 0; d <= a.Xh; d++) c[d] >= Mp && (c[d] = Xp);
}
fk.prototype.Pj = function(a, b, c, d) {
if (a > this.ln || a + c < this.Dd || b > this.mn || b + d < this.Ed)
return !0;
a = ((a - this.Dd) / this.nc) | 0;
b = ((b - this.Ed) / this.oc) | 0;
c = (Math.max(0, c) / this.nc + 1) | 0;
var e = (Math.max(0, d) / this.oc + 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.Wh) | 0;
for (c = Math.min(b + e - 1, this.Xh) | 0; a <= d; a++) {
e = this.Xb[a];
for (var f = b; f <= c; f++) if (e[f] === kk) return !1;
}
return !0;
};
function Yp(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.Xb[l][m];
if (n >= Mp && n < Kp)
for (
e ? (m += d) : (l += d), n += 1;
f <= l && l <= g && h <= m && m <= k && !(n >= a.Xb[l][m]);
)
(a.Xb[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)
Yp(a, b, c, 1, !e, f, g, h, k), Yp(a, b, c, -1, !e, f, g, h, k);
else
for (c += d; c > l; c += d)
Yp(a, b, c, 1, !e, f, g, h, k), Yp(a, b, c, -1, !e, f, g, h, k);
else if (0 < d)
for (b += d; b < l; b += d)
Yp(a, b, c, 1, !e, f, g, h, k), Yp(a, b, c, -1, !e, f, g, h, k);
else
for (b += d; b > l; b += d)
Yp(a, b, c, 1, !e, f, g, h, k), Yp(a, b, c, -1, !e, f, g, h, k);
}
}
function Zp(a, b, c, d, e, f, g, h, k) {
b |= 0;
c |= 0;
var l = kk,
m = Mp;
for (a.Xb[b][c] = m; l === kk && b > f && b < g && c > h && c < k; )
(m += 1), (a.Xb[b][c] = m), e ? (c += d) : (b += d), (l = a.Xb[b][c]);
}
function $p(a, b, c, d, e, f, g, h, k) {
b |= 0;
c |= 0;
var l = kk,
m = Kp;
for (a.Xb[b][c] = m; l === kk && b > f && b < g && c > h && c < k; )
(a.Xb[b][c] = m), e ? (c += d) : (b += d), (l = a.Xb[b][c]);
}
function Ip(a, b, c, d, e, f, g) {
if (null !== a.Xb) {
a.abort = !1;
var h = b.x,
k = b.y;
if (jk(a, h, k)) {
h -= a.Dd;
h /= a.nc;
k -= a.Ed;
k /= a.oc;
var l = d.x,
m = d.y;
if (jk(a, l, m))
if (
((l -= a.Dd),
(l /= a.nc),
(m -= a.Ed),
(m /= a.oc),
1 >= Math.abs(h - l) && 1 >= Math.abs(k - m))
)
a.abort = !0;
else {
var n = f.x;
d = f.y;
b = f.x + f.width;
var p = f.y + f.height;
n -= a.Dd;
n /= a.nc;
d -= a.Ed;
d /= a.oc;
b -= a.Dd;
b /= a.nc;
p -= a.Ed;
p /= a.oc;
f = Math.max(0, Math.min(a.Wh, n | 0));
b = Math.min(a.Wh, Math.max(0, b | 0));
n = Math.max(0, Math.min(a.Xh, d | 0));
p = Math.min(a.Xh, Math.max(0, p | 0));
d = a.Xb;
h |= 0;
k |= 0;
l |= 0;
m |= 0;
var r = 0 === c || 90 === c ? 1 : -1;
c = 90 === c || 270 === c;
d[h][k] === kk
? (Zp(a, h, k, r, c, f, b, n, p),
Zp(a, h, k, 1, !c, f, b, n, p),
Zp(a, h, k, -1, !c, f, b, n, p))
: Zp(a, h, k, r, c, h, k, h, k);
d[l][m] === kk
? ($p(
a,
l,
m,
0 === e || 90 === e ? 1 : -1,
90 === e || 270 === e,
f,
b,
n,
p,
),
$p(a, l, m, 1, !(90 === e || 270 === e), f, b, n, p),
$p(a, l, m, -1, !(90 === e || 270 === e), f, b, n, p))
: $p(a, l, m, r, c, l, m, l, m);
c = Ea();
if (g && aq(a, l, m, e, h, k, c)) {
if (c[0] !== l || c[1] !== m) c.unshift(m), c.unshift(l);
if (c[c.length - 2] !== h || c[c.length - 1] !== k)
c.push(h), c.push(k);
a = Mp;
e = c[c.length - 2];
g = c[c.length - 1];
d[e][g] = a++;
for (f = c.length - 4; 0 <= f; f -= 2)
for (
e = c[f + 2], g = c[f + 3], b = c[f], l = c[f + 1];
b > e ? e++ : b < e ? e-- : l > g ? g++ : l < g && g--,
(d[e][g] = a++),
e !== b || g !== l;
);
} else
Yp(a, h, k, 1, !1, f, b, n, p),
Yp(a, h, k, -1, !1, f, b, n, p),
Yp(a, h, k, 1, !0, f, b, n, p),
Yp(a, h, k, -1, !0, f, b, n, p);
Ga(c);
}
}
}
}
function aq(a, b, c, d, e, f, g) {
for (var h = a.Xb, k = b, l = c; ; ) {
if (k === e && l === f) return !0;
var m = k,
n = l;
if (0 === d)
if (m < e) m++;
else break;
else if (90 === d)
if (n < f) n++;
else break;
else if (180 === d)
if (m > e) m--;
else break;
else if (n > f) n--;
else break;
var p = h[m][n];
if (0 === p || p === bq) break;
k = m;
l = n;
}
for (;;) {
m = d;
n = k;
p = l;
0 === d
? p < f
? ((m = 90), p++)
: p > f && ((m = 270), p--)
: 90 === d
? n < e
? ((m = 0), n++)
: n > e && ((m = 180), n--)
: 180 === d
? p < f
? ((m = 90), p++)
: p > f && ((m = 270), p--)
: n < e
? ((m = 0), n++)
: n > e && ((m = 180), n--);
n = h[n][p];
if (m !== d && 0 !== n && n !== bq) {
g.push(k);
g.push(l);
if (aq(a, k, l, m, e, f, g)) return !0;
g.pop();
g.pop();
}
h[k][l] = bq;
if (0 === d) {
if (k === b) return !1;
k--;
} else if (90 === d) {
if (l === c) return !1;
l--;
} else if (180 === d) {
if (k === b) return !1;
k++;
} else {
if (l === c) return !1;
l++;
}
}
}
ma.Object.defineProperties(fk.prototype, {
bounds: {
get: function() {
return new M(this.Dd, this.Ed, this.ln - this.Dd, this.mn - this.Ed);
},
},
lo: {
get: function() {
return this.nc;
},
set: function(a) {
0 < a && a !== this.nc && ((this.nc = a), this.initialize(this.bounds));
},
},
ko: {
get: function() {
return this.oc;
},
set: function(a) {
0 < a && a !== this.oc && ((this.oc = a), this.initialize(this.bounds));
},
},
});
var kk = 0,
Mp = 1,
Kp = 999999,
Xp = Kp + 1,
bq = Kp + 2;
fk.className = 'PositionArray';
function Cp() {
Ra(this);
this.port = this.node = null;
this.he = [];
this.Do = !1;
}
Cp.prototype.toString = function() {
for (
var a = this.he,
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 cq(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;
}
Cp.prototype.Al = function() {
this.he.length = 0;
};
function Dp(a, b) {
var c = a.he;
if (0 === c.length) {
a: if (!a.Do) {
c = a.Do;
a.Do = !0;
var d = null,
e = a.node,
f = e instanceof qf ? e : null;
if (null === f || f.isSubGraphExpanded)
var g = e.isTreeExpanded
? e.findLinksConnected(a.port.portId)
: e.Tw();
else {
if (!f.actualBounds.v()) {
a.Do = c;
break a;
}
d = f;
g = d.vu();
}
f = a.he.length = 0;
var h = a.port.ia(tc, I.alloc()),
k = a.port.ia(Cc, I.alloc());
e = M.allocAt(h.x, h.y, 0, 0);
e.Me(k);
I.free(h);
I.free(k);
h = I.allocAt(e.x + e.width / 2, e.y + e.height / 2);
k = a.port.fi();
for (g = g.iterator; g.next(); ) {
var l = g.value;
if (l.isVisible() && l.fromPort !== l.toPort) {
var m =
l.fromPort === a.port ||
(null !== l.fromNode && l.fromNode.Md(d)),
n = l.computeSpot(m, a.port);
if (n.Uc() && ((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.Ya(m);
p -= k;
0 > p ? (p += 360) : 360 <= p && (p -= 360);
n = cq(e, n, p, l.isOrthogonal);
0 === n
? ((n = 4), 180 < p && (p -= 360))
: 90 === n
? ((n = 8), 270 < p && (p -= 360))
: 180 === n
? (n = 2)
: ((n = 1), 90 > p && (p += 360));
r = a.he[f];
void 0 === r
? ((r = new dq(l, p, n)), (a.he[f] = r))
: ((r.link = l), (r.angle = p), (r.Gc = n));
r.Ru.set(m);
f++;
}
}
}
}
I.free(h);
a.he.sort(Cp.prototype.j);
k = a.he.length;
d = -1;
for (f = h = 0; f < k; f++)
(g = a.he[f]),
void 0 !== g &&
(g.Gc !== d && ((d = g.Gc), (h = 0)), (g.xo = h), h++);
d = -1;
h = 0;
for (f = k - 1; 0 <= f; f--)
(k = a.he[f]),
void 0 !== k &&
(k.Gc !== d && ((d = k.Gc), (h = k.xo + 1)), (k.tl = h));
f = a.he;
n = a.port;
d = a.node.portSpreading;
h = I.alloc();
k = I.alloc();
g = I.alloc();
l = I.alloc();
n.ia(tc, h);
n.ia(vc, k);
n.ia(Cc, g);
n.ia(Ac, l);
r = p = m = n = 0;
if (d === jp)
for (var q = 0; q < f.length; q++) {
var u = f[q];
if (null !== u) {
var w = u.link.computeThickness();
switch (u.Gc) {
case 8:
p += w;
break;
case 2:
r += w;
break;
case 1:
n += w;
break;
default:
case 4:
m += w;
}
}
}
var v = (q = 0),
z = 1,
y = (u = 0);
for (w = 0; w < f.length; w++) {
var A = f[w];
if (null !== A) {
if (q !== A.Gc) {
q = A.Gc;
switch (q) {
case 8:
var B = g;
v = l;
break;
case 2:
B = l;
v = h;
break;
case 1:
B = h;
v = k;
break;
default:
case 4:
(B = k), (v = g);
}
u = v.x - B.x;
y = v.y - B.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);
}
v = 0;
}
var F = A.Co;
if (d === jp) {
A = A.link.computeThickness();
A *= z;
F.set(B);
switch (q) {
case 8:
F.x = B.x + u / 2 + p / 2 - v - A / 2;
break;
case 2:
F.y = B.y + y / 2 + r / 2 - v - A / 2;
break;
case 1:
F.x = B.x + u / 2 - n / 2 + v + A / 2;
break;
default:
case 4:
F.y = B.y + y / 2 - m / 2 + v + A / 2;
}
v += A;
} else {
var L = 0.5;
d === Vo && (L = (A.xo + 1) / (A.tl + 1));
F.x = B.x + u * L;
F.y = B.y + y * L;
}
}
}
I.free(h);
I.free(k);
I.free(g);
I.free(l);
B = a.he;
for (f = 0; f < B.length; f++)
(d = B[f]), null !== d && (d.tu = a.computeEndSegmentLength(d));
a.Do = c;
M.free(e);
}
c = a.he;
}
for (a = 0; a < c.length; a++)
if (((e = c[a]), null !== e && e.link === b)) return e;
return null;
}
Cp.prototype.j = function(a, b) {
return a === b
? 0
: null === a
? -1
: null === b
? 1
: a.Gc < b.Gc
? -1
: a.Gc > b.Gc
? 1
: a.angle < b.angle
? -1
: a.angle > b.angle
? 1
: 0;
};
Cp.prototype.computeEndSegmentLength = function(a) {
var b = a.link,
c = b.computeEndSegmentLength(
this.node,
this.port,
sc,
b.fromPort === this.port,
),
d = a.xo;
if (0 > d) return c;
var e = a.tl;
if (1 >= e || !b.isOrthogonal) return c;
b = a.Ru;
var f = a.Co;
if (2 === a.Gc || 8 === a.Gc) d = e - 1 - d;
return ((a = 2 === a.Gc || 4 === a.Gc)
? 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);
};
Cp.className = 'Knot';
function dq(a, b, c) {
this.link = a;
this.angle = b;
this.Gc = c;
this.Ru = new I();
this.tl = this.xo = 0;
this.Co = new I();
this.tu = 0;
}
dq.prototype.toString = function() {
return (
this.link.toString() +
' ' +
this.angle.toString() +
' ' +
this.Gc.toString() +
':' +
this.xo.toString() +
'/' +
this.tl.toString() +
' ' +
this.Co.toString() +
' ' +
this.tu.toString() +
' ' +
this.Ru.toString()
);
};
dq.className = 'LinkInfo';
function qi(a) {
Ra(this);
this.m = this.H = null;
this.wh = this.Zm = !0;
this.en = !1;
this.im = new I(0, 0).freeze();
this.bn = !0;
this.mm = this.an = null;
this.dn = !1;
this.j = null;
this.u = 0;
this.nn = this.ao = null;
this.zr = !1;
this.dg = this.lj = null;
this.ir = !1;
a && Object.assign(this, a);
}
qi.prototype.cloneProtected = function(a) {
a.Zm = this.Zm;
a.wh = this.wh;
a.en = this.en;
a.im.assign(this.im);
a.bn = this.bn;
a.an = this.an;
a.mm = this.mm;
a.dn = !0;
a.nn = this.nn;
a.ao = this.ao;
};
qi.prototype.copy = function() {
var a = new this.constructor();
this.cloneProtected(a);
return a;
};
qi.prototype.serializeLayoutProperties = function(a) {
a.arrangementOrigin = {
x: this.arrangementOrigin.x,
y: this.arrangementOrigin.y,
};
a.isRouting = this.isRouting;
};
qi.prototype.deserializeLayoutProperties = function(a) {
null !== a &&
((this.arrangementOrigin = new I(
a.arrangementOrigin.x,
a.arrangementOrigin.y,
)),
(this.isRouting = a.isRouting));
};
qi.prototype.ob = function() {};
qi.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 + ')';
};
qi.prototype.D = function() {
if (this.isValidLayout) {
var a = this.diagram;
if (null !== a && !a.undoManager.isUndoingRedoing) {
var b = a.animationManager;
!b.isTicking &&
(b.defaultAnimation.isAnimating && b.wc(),
(this.isOngoing && a.ji) || (this.isInitial && !a.ji)) &&
((this.isValidLayout = !1), a.Mb());
}
}
};
qi.prototype.createNetwork = function() {
return new eq(this);
};
qi.prototype.makeNetwork = function(a) {
var b = this.createNetwork();
a instanceof Q
? (b.eg(a.nodes, !0), b.eg(a.links, !0))
: a instanceof qf
? b.eg(a.memberParts)
: b.eg(a.iterator);
return b;
};
qi.prototype.updateParts = function() {
this.isValidLayout = !0;
if (!this.workerLayout()) {
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;
}
try {
null !== a && a.Da('Layout'), this.commitLayout();
} finally {
null !== a && a.eb('Layout');
}
}
};
qi.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();
}
};
qi.prototype.doLayout = function(a) {
var b = new G();
a instanceof Q
? (fq(this, b, a.nodes, !0, this.gh, !0, !1, !0),
fq(this, b, a.parts, !0, this.gh, !0, !1, !0))
: a instanceof qf
? fq(this, b, a.memberParts, !1, this.gh, !0, !1, !0)
: b.addAll(a.iterator);
0 < b.count &&
((a = this.diagram),
null !== a && a.Da('Layout'),
this.doMinimalNoNetworkLayout(b),
null !== a && a.eb('Layout'));
this.isValidLayout = !0;
};
qi.prototype.doMinimalNoNetworkLayout = function(a) {
var b = Math.ceil(Math.sqrt(a.count));
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
var c = this.arrangementOrigin.x,
d = c,
e = this.arrangementOrigin.y,
f = 0,
g = 0;
for (a = a.iterator; a.next(); ) {
var h = a.value;
gq(h);
var k = h.measuredBounds,
l = k.width;
k = k.height;
h.moveTo(d, e);
h instanceof qf && (h.gh = !1);
d += Math.max(l, 50) + 20;
g = Math.max(g, Math.max(k, 50));
f >= b - 1 ? ((f = 0), (d = c), (e += g + 20), (g = 0)) : f++;
}
};
qi.prototype.doMinimalNetworkLayout = function() {
var a = Math.ceil(Math.sqrt(this.network.vertexes.count));
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
for (
var b = this.arrangementOrigin.x,
c = b,
d = this.arrangementOrigin.y,
e = 0,
f = 0,
g = this.network.vertexes.iterator;
g.next();
) {
var h = g.value.node;
if (!(null === h || h instanceof T) && (gq(h), this.gh(h))) {
var k = h.measuredBounds,
l = k.width;
k = k.height;
h.moveTo(c, d);
h instanceof qf && (h.gh = !1);
c += Math.max(l, 50) + 20;
f = Math.max(f, Math.max(k, 50));
e >= a - 1 ? ((e = 0), (c = b), (d += f + 20), (f = 0)) : e++;
}
}
};
qi.prototype.gh = function(a) {
return !a.location.v() || (a instanceof qf && a.gh) ? !0 : !1;
};
function fq(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 qf
? null === k.layout
? fq(a, b, k.memberParts, !1, e, f, g, h)
: (gq(k), b.add(k))
: (gq(k), b.add(k)))
: g && k instanceof T
? b.add(k)
: !h || !k.Tc() || k instanceof V || (gq(k), b.add(k)));
}
}
function gq(a) {
var b = a.actualBounds;
(0 === b.width || 0 === b.height || isNaN(b.width) || isNaN(b.height)) &&
a.Za();
}
qi.prototype.hi = function(a, b) {
var c = this.boundsComputation;
if (null !== c) return b || (b = new M()), c(a, this, b);
if (!b) return a.actualBounds;
b.set(a.actualBounds);
return b;
};
qi.prototype.Iw = function(a) {
var b = new G();
a instanceof Q
? (fq(this, b, a.nodes, !0, null, !0, !0, !0),
fq(this, b, a.links, !0, null, !0, !0, !0),
fq(this, b, a.parts, !0, null, !0, !0, !0))
: a instanceof qf
? fq(this, b, a.memberParts, !1, null, !0, !0, !0)
: fq(this, b, a.iterator, !1, null, !0, !0, !0);
return b;
};
qi.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.ia(tc)),
(isNaN(c.x) || isNaN(c.y)) && c.set(a),
(a = b.padding),
(c.x += a.left),
(c.y += a.top));
return c;
}
return a;
};
qi.prototype.mayUseWorker = function() {
return this.mayUseWorkerFunction ? this.mayUseWorkerFunction(this) : !1;
};
qi.prototype.workerLayout = function() {
return !1;
};
function hq(a, b) {
if (null !== a.workerStateChanged) {
var c = {
key: a.group ? a.group.key : null,
};
void 0 !== b && (c.time = b);
null !== a.lj && (c.running = iq(a.lj));
null !== a.dg && (c.waiting = iq(a.dg));
a.workerStateChanged(c, a);
}
}
function iq(a) {
return {
vertexes: a.vertexes.count,
edges: a.edges.count,
};
}
qi.prototype.uy = function() {
var a = jq(this.constructor);
a &&
(null !== a.Ne && a.Ne.terminate(),
(a.Ne = null),
a.Cl.iteratorValues.each(function(a) {
a.zr = !1;
a.lj = null;
a.dg = null;
a.ir = !1;
hq(a);
}),
a.Cl.clear());
};
function kq(a, b) {
var c = jq(a);
if (c) {
if (b) for (var d in b) c[d] = b[d];
} else throw Error('Unknown Layout class: ' + a);
}
function jq(a) {
var b = null;
if ('function' === typeof a) {
if (((b = lq.get(a)), !b)) {
var c = Ha(a);
b = lq.get(c);
b ||
((b = new mq()),
(b.pu = a),
(b.name = c),
(b.j = a.name),
(b.hx = nq),
lq.set(c, b),
lq.set(a, b),
lq.set(a.name, b));
}
} else 'string' === typeof a && (b = lq.get(a));
return b;
}
qi.prototype.qv = function() {
if (
'undefined' === typeof Worker ||
!oq ||
'undefined' === typeof self ||
'undefined' !== typeof self.DedicatedWorkerGlobalScope
)
return !1;
if (!this.mayUseWorker())
return (
this.zr && ((this.ir = !0), (this.dg = this.lj = null), hq(this)), !1
);
var a = jq(this.constructor);
if (null === a) return !1;
null === a.Ne &&
((a.Ne = new Worker(oq)),
(a.Ne.onerror = function(a) {
a.preventDefault();
xa(
'Worker Error at: ' +
a.filename +
' ' +
a.lineno +
' ' +
a.colno +
'\n ' +
a.message,
);
}),
(a.Ne.j = function(a) {
xa('Worker serialization error: ' + a);
}),
(a.Ne.onmessage = function(b) {
var c = b.data;
if ('_GoJS' === c._GoJS)
if (c.version && Q.version && c.version !== Q.version)
xa('Failure: GoJS v' + Q.version + ' Worker v' + c.version);
else if ((b = a.Cl.get(c.id))) {
a.Cl.remove(c.id);
b.zr = !1;
b.lj = null;
if (b.ir) (b.ir = !1), (b.dg = null);
else {
var d = pq(b, c, !1);
b.network = d;
b.updateParts();
b.network = null;
b.isValidLayout = !0;
}
hq(b, c.time);
c = b.dg;
if (null !== c) b.dg = null;
else
for (d = a.Cl.iteratorValues; d.next(); ) {
var e = d.value;
c = e.dg;
if (null !== c) {
e.dg = null;
break;
}
}
null !== c && qq(b, c);
}
}),
a.Ne.postMessage({
_GoJS: '_GoJS',
url: a.hx,
}),
Array.isArray(a.scripts) &&
a.scripts.forEach(function(b) {
a.Ne.postMessage({
_GoJS: '_GoJS',
url: b,
});
}),
a.Ne.postMessage({
_GoJS: '_GoJS',
version: -1,
}));
null !== this.lj ? (this.dg = this.network) : qq(this, this.network);
hq(this);
this.doMinimalNetworkLayout();
this.network = null;
return (this.isValidLayout = !0);
};
function qq(a, b) {
a.zr = !0;
var c = jq(a.constructor),
d = rq(a, b, !0);
d._GoJS = '_GoJS';
c.Ne.postMessage(d);
c.Cl.set(cb(a), a);
a.lj = b;
}
function rq(a, b, c) {
a.onNetworkSerialization(1, c, b, null);
var d = {};
a.serializeLayoutProperties(d, c);
var e = [];
b.vertexes.each(function(a) {
var b = {};
a.serializeVertexProperties(b, c);
e.push(b);
});
var f = [];
b.edges.each(function(a) {
var b = {};
a.serializeEdgeProperties(b, c);
f.push(b);
});
d = {
id: c ? cb(a) : a.id,
layout: Ha(a.constructor),
p: d,
hA: e,
Ly: f,
};
a.onNetworkSerialization(2, c, b, d);
return d;
}
function pq(a, b, c) {
c && (a.id = b.id);
var d = a.diagram,
e = a.createNetwork();
a.onNetworkSerialization(3, c, e, b);
var f = b.hA,
g = new pb();
f &&
f.forEach(function(a) {
var b = null;
null === a.key || null === d || c || (b = d.Lb(a.key));
null !== b ? (b = e.yj(b)) : ((b = e.createVertex()), e.fg(b));
c &&
null !== a.key &&
(b.data = {
yh: a.key,
});
g.set(a.id, b);
});
var h = b.Ly,
k = new pb();
h &&
h.forEach(function(a) {
var b = null;
null === a.key || null === d || c || (b = d.findLinkForKey(a.key));
var f = e.createEdge();
e.ol(f);
f.link = b;
c &&
null !== a.key &&
(f.data = {
yh: a.key,
});
k.set(a.id, f);
});
f &&
f.forEach(function(a) {
var b = g.get(a.id);
b && b.deserializeVertexProperties(a, g, k, c);
});
h &&
h.forEach(function(a) {
var b = k.get(a.id);
b && b.deserializeEdgeProperties(a, g, k, c);
});
a.deserializeLayoutProperties(b.p, g, k, c, e);
a.onNetworkSerialization(4, c, e, b);
return e;
}
qi.prototype.onNetworkSerialization = function() {};
ma.Object.defineProperties(qi.prototype, {
diagram: {
get: function() {
return this.H;
},
set: function(a) {
this.H = a;
},
},
group: {
get: function() {
return this.m;
},
set: function(a) {
this.m !== a && ((this.m = a), null !== a && (this.H = a.diagram));
},
},
isOngoing: {
get: function() {
return this.Zm;
},
set: function(a) {
this.Zm !== a && (this.Zm = a);
},
},
isInitial: {
get: function() {
return this.wh;
},
set: function(a) {
this.wh = a;
a || (this.dn = !0);
},
},
isViewportSized: {
get: function() {
return this.en;
},
set: function(a) {
this.en !== a && (this.en = a) && this.D();
},
},
isRouting: {
get: function() {
return this.bn;
},
set: function(a) {
this.bn !== a && (this.bn = a);
},
},
isRealtime: {
get: function() {
return this.an;
},
set: function(a) {
this.an !== a && (this.an = a);
},
},
isValidLayout: {
get: function() {
return this.dn;
},
set: function(a) {
this.dn !== a &&
((this.dn = a), a || ((a = this.diagram), null !== a && (a.mh = !0)));
},
},
network: {
get: function() {
return this.j;
},
set: function(a) {
this.j !== a && ((this.j = a), null !== a && (a.layout = this));
},
},
boundsComputation: {
get: function() {
return this.mm;
},
set: function(a) {
this.mm !== a && ((this.mm = a), this.D());
},
},
arrangementOrigin: {
get: function() {
return this.im;
},
set: function(a) {
this.im.C(a) || (this.im.assign(a), this.D());
},
},
id: {
get: function() {
return this.u;
},
set: function(a) {
this.u = a;
},
},
mayUseWorkerFunction: {
get: function() {
return this.nn;
},
set: function(a) {
this.nn !== a && (this.nn = a);
},
},
workerStateChanged: {
get: function() {
return this.ao;
},
set: function(a) {
this.ao !== a && (this.ao = a);
},
},
});
qi.prototype.useWorker = qi.prototype.qv;
qi.declareWorkerLayout = kq;
qi.prototype.cancelWorker = qi.prototype.uy;
qi.prototype.collectParts = qi.prototype.Iw;
qi.prototype.getLayoutBounds = qi.prototype.hi;
qi.prototype.invalidateLayout = qi.prototype.D;
var lq = new pb(),
nq =
'object' === typeof x.document && x.document.currentScript
? x.document.currentScript.src
: '',
oq =
'undefined' !== typeof URL &&
'function' === typeof URL.createObjectURL &&
'function' === typeof Blob
? URL.createObjectURL(
new Blob(
[
'self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}',
],
{
type: 'text/javascript',
},
),
)
: '';
qi.className = 'Layout';
qi.GoJSScriptURL = nq;
qi.declareWorkerLayout = kq;
'undefined' !== typeof self &&
'undefined' !== typeof self.DedicatedWorkerGlobalScope &&
'undefined' !== typeof self &&
'undefined' !== typeof self.DedicatedWorkerGlobalScope &&
(self.onmessage = function(a) {
a = a.data;
if ('_GoJS' === a._GoJS)
if (a.url) importScripts(a.url);
else if (a.version)
self.postMessage(
{
_GoJS: '_GoJS',
version: Q.version,
},
void 0,
);
else {
var b = performance.now(),
c = null;
a.layout && (c = jq(a.layout));
var d = null;
c && c.pu && (d = new c.pu());
if (!d) throw Error('no registered Worker Layout: ' + a.layout);
d.network = pq(d, a, !0);
d.workerLayout = function() {
var a = rq(d, d.network, !1);
a._GoJS = '_GoJS';
a.time = performance.now() - b;
self.postMessage(a, void 0);
return !0;
};
d.doLayout(new E());
}
});
function mq() {
this.pu = null;
this.hx = this.j = this.name = '';
this.scripts = [];
this.Ne = null;
this.Cl = new pb();
}
function eq(a) {
Ra(this);
this.Kc = a;
this.kf = new G();
this.pe = new G();
this.ds = new pb();
this.Yr = new pb();
}
eq.prototype.clear = function() {
if (this.kf) for (var a = this.kf.iterator; a.next(); ) a.value.clear();
if (this.pe) for (a = this.pe.iterator; a.next(); ) a.value.clear();
this.kf = new G();
this.pe = new G();
this.ds = new pb();
this.Yr = new pb();
};
eq.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.kf.count + ' edges: ' + this.pe.count;
if (1 < a) {
for (var c = this.kf.iterator; c.next(); )
b += '\n ' + c.value.toString(a - 1);
for (c = this.pe.iterator; c.next(); )
b += '\n ' + c.value.toString(a - 1);
}
return b;
};
eq.prototype.createVertex = function() {
return new sq(this);
};
eq.prototype.createEdge = function() {
return new tq(this);
};
eq.prototype.eg = 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 T) {
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 qf && null === d.layout) this.eg(d.memberParts, !1);
else if (null === this.ei(d)) {
var e = this.createVertex();
e.node = d;
this.fg(e);
}
}
for (a.reset(); a.next(); )
if (
((d = a.value),
d instanceof T &&
(!b || d.isTopLevel) &&
d.canLayout() &&
c(d) &&
null === this.qo(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.Qj(f, e, d));
}
}
};
eq.prototype.findGroupVertex = function(a) {
if (null === a) return null;
var b = a.findVisibleNode();
if (null === b) return null;
a = this.ei(b);
if (null !== a) return a;
for (b = b.containingGroup; null !== b; ) {
a = this.ei(b);
if (null !== a) return a;
b = b.containingGroup;
}
return null;
};
t = eq.prototype;
t.fg = function(a) {
if (null !== a) {
this.kf.add(a);
var b = a.node;
null !== b && this.ds.add(b, a);
a.network = this;
}
};
t.yj = function(a) {
if (null === a) return null;
var b = this.ei(a);
null === b && ((b = this.createVertex()), (b.node = a), this.fg(b));
return b;
};
t.su = function(a) {
if (null !== a && uq(this, a)) {
for (var b = a.wd, c = b.count - 1; 0 <= c; c--) {
var d = b.K(c);
this.Gj(d);
}
b = a.Jd;
for (a = b.count - 1; 0 <= a; a--) (c = b.K(a)), this.Gj(c);
}
};
function uq(a, b) {
if (null === b) return !1;
var c = a.kf.remove(b);
c && ((b = b.node), null !== b && a.ds.remove(b));
return c;
}
t.Gy = function(a) {
null !== a && ((a = this.ei(a)), null !== a && this.su(a));
};
t.ei = function(a) {
return null === a ? null : this.ds.I(a);
};
t.ol = function(a) {
if (null !== a) {
vq(this, a);
var b = a.toVertex;
null !== b && b.iu(a);
b = a.fromVertex;
null !== b && b.gu(a);
}
};
function vq(a, b) {
if (null !== b) {
a.pe.add(b);
var c = b.link;
null !== c && null === a.qo(c) && a.Yr.add(c, b);
b.network = a;
}
}
t.ky = function(a) {
if (null === a) return null;
var b = a.fromNode,
c = a.toNode,
d = this.qo(a);
null === d
? ((d = this.createEdge()),
(d.link = a),
null !== b && (d.fromVertex = this.yj(b)),
null !== c && (d.toVertex = this.yj(c)),
this.ol(d))
: (null !== b ? (d.fromVertex = this.yj(b)) : (d.fromVertex = null),
null !== c ? (d.toVertex = this.yj(c)) : (d.toVertex = null));
return d;
};
t.Gj = function(a) {
if (null !== a) {
var b = a.toVertex;
null !== b && b.ru(a);
b = a.fromVertex;
null !== b && b.qu(a);
wq(this, a);
}
};
function wq(a, b) {
null !== b &&
a.pe.remove(b) &&
((b = b.link), null !== b && a.Yr.remove(b));
}
t.Fy = function(a) {
null !== a && ((a = this.qo(a)), null !== a && this.Gj(a));
};
t.qo = function(a) {
return null === a ? null : this.Yr.I(a);
};
t.Qj = 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.ol(d);
return d;
}
return null;
};
t.Ol = function(a) {
if (null !== a) {
var b = a.fromVertex,
c = a.toVertex;
null !== b && null !== c && (b.qu(a), c.ru(a), a.Ol(), b.iu(a), c.gu(a));
}
};
t.oo = function() {
for (var a = Ea(), b = this.pe.iterator; b.next(); ) {
var c = b.value;
c.fromVertex === c.toVertex && a.push(c);
}
b = a.length;
for (c = 0; c < b; c++) this.Gj(a[c]);
Ga(a);
};
eq.prototype.deleteArtificialVertexes = function() {
for (var a = Ea(), b = this.kf.iterator; b.next(); ) {
var c = b.value;
null === c.node && null === c.data && a.push(c);
}
c = a.length;
for (b = 0; b < c; b++) this.su(a[b]);
b = Ea();
for (c = this.pe.iterator; c.next(); ) {
var d = c.value;
null === d.link && null === d.data && b.push(d);
}
c = b.length;
for (d = 0; d < c; d++) this.Gj(b[d]);
Ga(a);
Ga(b);
};
function xq(a) {
for (var b = Ea(), c = a.pe.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.Gj(b[d]);
Ga(b);
}
eq.prototype.Ix = function(a) {
void 0 === a && (a = !0);
a && (this.deleteArtificialVertexes(), xq(this), this.oo());
a = new E();
for (var b = !0; b; ) {
b = !1;
for (var c = this.kf.iterator; c.next(); ) {
var d = c.value;
if (0 < d.wd.count || 0 < d.Jd.count) {
b = this.layout.createNetwork();
a.add(b);
yq(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 yq(a, b, c) {
if (null !== c && c.network !== b) {
uq(a, c);
b.fg(c);
for (var d = c.sourceEdges; d.next(); ) {
var e = d.value;
e.network !== b && (wq(a, e), vq(b, e), yq(a, b, e.fromVertex));
}
for (d = c.destinationEdges; d.next(); )
(c = d.value),
c.network !== b && (wq(a, c), vq(b, c), yq(a, b, c.toVertex));
}
}
eq.prototype.My = function() {
for (var a = new G(), b = this.kf.iterator; b.next(); ) a.add(b.value.node);
for (b = this.pe.iterator; b.next(); ) a.add(b.value.link);
return a;
};
ma.Object.defineProperties(eq.prototype, {
layout: {
get: function() {
return this.Kc;
},
set: function(a) {
null !== a && (this.Kc = a);
},
},
vertexes: {
get: function() {
return this.kf;
},
},
edges: {
get: function() {
return this.pe;
},
},
});
eq.prototype.findAllParts = eq.prototype.My;
eq.prototype.splitIntoSubNetworks = eq.prototype.Ix;
eq.prototype.deleteSelfEdges = eq.prototype.oo;
eq.prototype.reverseEdge = eq.prototype.Ol;
eq.prototype.linkVertexes = eq.prototype.Qj;
eq.prototype.findEdge = eq.prototype.qo;
eq.prototype.deleteLink = eq.prototype.Fy;
eq.prototype.deleteEdge = eq.prototype.Gj;
eq.prototype.addLink = eq.prototype.ky;
eq.prototype.addEdge = eq.prototype.ol;
eq.prototype.findVertex = eq.prototype.ei;
eq.prototype.deleteNode = eq.prototype.Gy;
eq.prototype.deleteVertex = eq.prototype.su;
eq.prototype.addNode = eq.prototype.yj;
eq.prototype.addVertex = eq.prototype.fg;
eq.prototype.addParts = eq.prototype.eg;
eq.className = 'LayoutNetwork';
function sq(a) {
Ra(this);
this.nb = a;
this.j = new M(0, 0, 10, 10).freeze();
this.m = new I(5, 5).freeze();
this.Lh = this.qb = null;
this.wd = new E();
this.Jd = new E();
}
sq.prototype.serializeVertexProperties = function(a) {
a.id = cb(this);
a.key = this.node ? this.node.key : this.data ? this.data.yh : void 0;
void 0 === a.key && (a.key = null);
a.x = this.bounds.x;
a.y = this.bounds.y;
a.iA = this.bounds.width;
a.pz = this.bounds.height;
a.fx = this.focus.x;
a.fy = this.focus.y;
var b = [];
this.wd.each(function(a) {
b.push(cb(a));
});
a.Gx = b;
var c = [];
this.Jd.each(function(a) {
c.push(cb(a));
});
a.Ow = c;
};
sq.prototype.deserializeVertexProperties = function(a, b, c) {
if (null !== a) {
this.x = a.x;
this.y = a.y;
this.width = a.iA;
this.height = a.pz;
this.focusX = a.fx;
this.focusY = a.fy;
var d = this;
a.Gx &&
a.Gx.forEach(function(a) {
(a = c.get(a)) && d.wd.add(a);
});
a.Ow &&
a.Ow.forEach(function(a) {
(a = c.get(a)) && d.Jd.add(a);
});
}
};
sq.prototype.clear = function() {
this.Lh = this.qb = null;
this.wd = new E();
this.Jd = new E();
};
sq.prototype.toString = function(a) {
void 0 === a && (a = 0);
var b = 'LayoutVertex#' + cb(this);
if (
0 < a &&
((b += null !== this.node ? '(' + this.node.toString() + ')' : ''), 1 < a)
) {
a = '';
for (var c = !0, d = this.wd.iterator; d.next(); ) {
var e = d.value;
c ? (c = !1) : (a += ',');
a += e.toString(0);
}
e = '';
c = !0;
for (d = this.Jd.iterator; d.next(); ) {
var f = d.value;
c ? (c = !1) : (e += ',');
e += f.toString(0);
}
b += ' sources: ' + a + ' destinations: ' + e;
}
return b;
};
sq.prototype.commit = function() {
var a = this.qb;
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 qf)) {
c = M.alloc();
var d = this.network.layout.hi(a, c),
e = a.locationObject.ia(yc);
if (d.v() && e.v()) {
a.moveTo(
b.x + this.focusX - (e.x - d.x),
b.y + this.focusY - (e.y - d.y),
);
M.free(c);
return;
}
M.free(c);
}
a.moveTo(b.x, b.y);
}
};
sq.prototype.iu = function(a) {
null !== a && (this.wd.contains(a) || this.wd.add(a));
};
sq.prototype.ru = function(a) {
null !== a && this.wd.remove(a);
};
sq.prototype.gu = function(a) {
null !== a && (this.Jd.contains(a) || this.Jd.add(a));
};
sq.prototype.qu = function(a) {
null !== a && this.Jd.remove(a);
};
function zq(a, b) {
a = a.Lh;
b = b.Lh;
return a
? b
? ((a = a.text), (b = b.text), a < b ? -1 : a > b ? 1 : 0)
: 1
: null !== b
? -1
: 0;
}
ma.Object.defineProperties(sq.prototype, {
sourceEdgesArrayAccess: {
get: function() {
return this.wd._dataArray;
},
},
destinationEdgesArrayAccess: {
get: function() {
return this.Jd._dataArray;
},
},
data: {
get: function() {
return this.qb;
},
set: function(a) {
this.qb = a;
if (null !== a && a.bounds) {
var b = a.bounds;
a = b.x;
var c = b.y,
d = b.width;
b = b.height;
this.m.h(d / 2, b / 2);
this.j.h(a, c, d, b);
}
},
},
node: {
get: function() {
return this.Lh;
},
set: function(a) {
if (this.Lh !== a) {
this.Lh = a;
a.Za();
var b = this.network.layout,
c = M.alloc(),
d = b.hi(a, c);
b = d.x;
var e = d.y,
f = d.width;
d = d.height;
isNaN(b) && (b = 0);
isNaN(e) && (e = 0);
this.j.h(b, e, f, d);
M.free(c);
if (!(a instanceof qf) && ((a = a.locationObject.ia(yc)), a.v())) {
this.m.h(a.x - b, a.y - e);
return;
}
this.m.h(f / 2, d / 2);
}
},
},
bounds: {
get: function() {
return this.j;
},
set: function(a) {
this.j.C(a) || this.j.assign(a);
},
},
focus: {
get: function() {
return this.m;
},
set: function(a) {
this.m.C(a) || this.m.assign(a);
},
},
centerX: {
get: function() {
return this.j.x + this.m.x;
},
set: function(a) {
var b = this.j;
b.x + this.m.x !== a && (b.ja(), (b.x = a - this.m.x), b.freeze());
},
},
centerY: {
get: function() {
return this.j.y + this.m.y;
},
set: function(a) {
var b = this.j;
b.y + this.m.y !== a && (b.ja(), (b.y = a - this.m.y), b.freeze());
},
},
focusX: {
get: function() {
return this.m.x;
},
set: function(a) {
var b = this.m;
b.x !== a && (b.ja(), (b.x = a), b.freeze());
},
},
focusY: {
get: function() {
return this.m.y;
},
set: function(a) {
var b = this.m;
b.y !== a && (b.ja(), (b.y = a), b.freeze());
},
},
x: {
get: function() {
return this.j.x;
},
set: function(a) {
var b = this.j;
b.x !== a && (b.ja(), (b.x = a), b.freeze());
},
},
y: {
get: function() {
return this.j.y;
},
set: function(a) {
var b = this.j;
b.y !== a && (b.ja(), (b.y = a), b.freeze());
},
},
width: {
get: function() {
return this.j.width;
},
set: function(a) {
var b = this.j;
b.width !== a && (b.ja(), (b.width = a), b.freeze());
},
},
height: {
get: function() {
return this.j.height;
},
set: function(a) {
var b = this.j;
b.height !== a && (b.ja(), (b.height = a), b.freeze());
},
},
network: {
get: function() {
return this.nb;
},
set: function(a) {
this.nb = a;
},
},
sourceVertexes: {
get: function() {
for (var a = new G(), b = this.sourceEdges; b.next(); )
a.add(b.value.fromVertex);
return a.iterator;
},
},
destinationVertexes: {
get: function() {
for (var a = new G(), b = this.destinationEdges; b.next(); )
a.add(b.value.toVertex);
return a.iterator;
},
},
vertexes: {
get: function() {
for (var a = new G(), 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.wd.iterator;
},
},
destinationEdges: {
get: function() {
return this.Jd.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.wd.count + this.Jd.count;
},
},
});
sq.prototype.deleteDestinationEdge = sq.prototype.qu;
sq.prototype.addDestinationEdge = sq.prototype.gu;
sq.prototype.deleteSourceEdge = sq.prototype.ru;
sq.prototype.addSourceEdge = sq.prototype.iu;
sq.className = 'LayoutVertex';
sq.standardComparer = zq;
sq.smartComparer = function(a, b) {
if (null !== a) {
if (null !== b) {
a = a.Lh;
var c = b.Lh;
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 tq(a) {
Ra(this);
this.hb = a;
this.jd = this.ad = this.Pk = this.qb = null;
}
tq.prototype.clear = function() {
this.jd = this.ad = this.Pk = this.qb = null;
};
tq.prototype.serializeEdgeProperties = function(a) {
a.id = cb(this);
a.key = this.link ? this.link.key : this.data ? this.data.yh : void 0;
void 0 === a.key && (a.key = null);
a.from = this.fromVertex ? cb(this.fromVertex) : null;
a.dA = this.toVertex ? cb(this.toVertex) : null;
};
tq.prototype.deserializeEdgeProperties = function(a, b) {
if (null !== a) {
var c = b.get(a.from);
c && (this.fromVertex = c);
if ((a = b.get(a.dA))) this.toVertex = a;
}
};
tq.prototype.toString = function(a) {
void 0 === a && (a = 0);
var b = 'LayoutEdge#' + cb(this);
0 < a &&
((b += null !== this.Pk ? '(' + this.Pk.toString() + ')' : ''),
1 < a &&
(b +=
' ' +
(this.ad ? this.ad.toString() : 'null') +
' --> ' +
(this.jd ? this.jd.toString() : 'null')));
return b;
};
tq.prototype.Ol = function() {
var a = this.ad;
this.ad = this.jd;
this.jd = a;
};
tq.prototype.commit = function() {};
tq.prototype.bx = function(a) {
return this.jd === a ? this.ad : this.ad === a ? this.jd : null;
};
ma.Object.defineProperties(tq.prototype, {
network: {
get: function() {
return this.hb;
},
set: function(a) {
this.hb = a;
},
},
data: {
get: function() {
return this.qb;
},
set: function(a) {
this.qb !== a && (this.qb = a);
},
},
link: {
get: function() {
return this.Pk;
},
set: function(a) {
this.Pk !== a && (this.Pk = a);
},
},
fromVertex: {
get: function() {
return this.ad;
},
set: function(a) {
this.ad !== a && (this.ad = a);
},
},
toVertex: {
get: function() {
return this.jd;
},
set: function(a) {
this.jd !== a && (this.jd = a);
},
},
});
tq.prototype.getOtherVertex = tq.prototype.bx;
tq.className = 'LayoutEdge';
function Mk(a) {
qi.call(this);
this.isViewportSized = !0;
this.bo = this.co = NaN;
this.pg = new K(NaN, NaN).freeze();
this.gf = new K(10, 10).freeze();
this.Fb = Aq;
this.Nb = Bq;
this.fd = Cq;
this.Zc = Dq;
a && Object.assign(this, a);
}
la(Mk, qi);
Mk.prototype.cloneProtected = function(a) {
qi.prototype.cloneProtected.call(this, a);
a.co = this.co;
a.bo = this.bo;
a.pg.assign(this.pg);
a.gf.assign(this.gf);
a.Fb = this.Fb;
a.Nb = this.Nb;
a.fd = this.fd;
a.Zc = this.Zc;
};
Mk.prototype.ob = function(a) {
a.classType === Mk
? a === Cq || a === Eq || a === Fq || a === Gq
? (this.sorting = a)
: a === Bq || a === Hq
? (this.arrangement = a)
: a === Aq || a === Iq
? (this.alignment = a)
: C('Unknown enum value: ' + a)
: qi.prototype.ob.call(this, a);
};
Mk.prototype.doLayout = function(a) {
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
var b = this.Iw(a);
a = this.diagram;
for (var c = b.copy().iterator; c.next(); ) {
var d = c.value;
if (!d.eh() || (null === d.fromNode && null === d.toNode)) {
if ((d.Za(), d instanceof qf))
for (d = d.memberParts; d.next(); ) b.remove(d.value);
} else b.remove(d);
}
var e = b.Ea();
if (0 !== e.length) {
switch (this.sorting) {
case Gq:
e.reverse();
break;
case Cq:
e.sort(this.comparer);
break;
case Eq:
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.Da('Layout');
d = [];
switch (this.alignment) {
case Iq:
var h = b,
k = c,
l = M.alloc(),
m = Math.max(this.cellSize.width, 1);
if (!isFinite(m))
for (var n = (m = 0); n < e.length; n++) {
var p = this.hi(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.hi(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,
w = 0,
v = 0,
z = 0;
z < e.length;
z++
) {
var y = e[z],
A = this.hi(y, l),
B = Math.ceil((A.width + h) / m) * m,
F = Math.ceil((A.height + k) / n) * n;
switch (p) {
case Hq:
var L = Math.abs(q - A.width);
break;
default:
L = q + A.width;
}
if ((0 < f && w > f - 1) || (0 < g && 0 < w && L - r > g))
d.push(new M(0, u, g + h, v)),
(w = 0),
(q = r),
(u += v),
(v = 0);
v = Math.max(v, F);
switch (p) {
case Hq:
A = -A.width;
break;
default:
A = 0;
}
y.moveTo(q + A, u);
switch (p) {
case Hq:
q -= B;
break;
default:
q += B;
}
w++;
}
d.push(new M(0, u, g + h, v));
M.free(l);
break;
case Aq:
k = g;
m = f;
n = b;
p = c;
g = M.alloc();
r = Math.max(this.cellSize.width, 1);
f = u = l = 0;
h = I.alloc();
for (q = 0; q < e.length; q++)
(v = e[q]),
(w = this.hi(v, g)),
(v = Go(v, v.locationObject, v.locationSpot, h)),
(l = Math.max(l, v.x)),
(u = Math.max(u, w.width - v.x)),
(f = Math.max(f, v.y));
q = this.arrangement;
switch (q) {
case Hq:
l += n;
break;
default:
u += n;
}
r = isFinite(r) ? Math.max(r + n, 1) : Math.max(l + u, 1);
var S = (v = this.arrangementOrigin.x);
z = this.arrangementOrigin.y;
u = 0;
k >= l && (k -= l);
l = y = 0;
B = Math.max(this.cellSize.height, 1);
A = f = 0;
F = !0;
w = I.alloc();
for (L = 0; L < e.length; L++) {
var R = e[L],
P = this.hi(R, g),
H = Go(R, R.locationObject, R.locationSpot, h);
if (0 < u)
switch (q) {
case Hq:
S = (S - v - (P.width - H.x)) / r;
S = J.ca(Math.round(S), S) ? Math.round(S) : Math.floor(S);
S = S * r + v;
break;
default:
(S = (S - v + H.x) / r),
(S = J.ca(Math.round(S), S) ? Math.round(S) : Math.ceil(S)),
(S = S * r + v);
}
else
switch (q) {
case Hq:
y = S + H.x + P.width;
break;
default:
y = S - H.x;
}
switch (q) {
case Hq:
var da = -(S + H.x) + y;
break;
default:
da = S + P.width - H.x - y;
}
if ((0 < m && u > m - 1) || (0 < k && 0 < u && da > k)) {
d.push(new M(0, F ? z - f : z, k + n, A + f + p));
for (S = 0; S < u && L !== u; S++) {
da = e[L - u + S];
var X = Go(da, da.locationObject, da.locationSpot, w);
da.moveTo(da.position.x, da.position.y + f - X.y);
}
A += p;
z = F ? z + A : z + (A + f);
u = A = f = 0;
S = v;
F = !1;
}
S === v &&
(l = q === Hq ? Math.max(l, P.width - H.x) : Math.min(l, -H.x));
f = Math.max(f, H.y);
A = Math.max(A, P.height - H.y);
isFinite(B) && (A = Math.max(A, Math.max(P.height, B) - H.y));
F ? R.moveTo(S - H.x, z - H.y) : R.moveTo(S - H.x, z);
switch (q) {
case Hq:
S -= H.x + n;
break;
default:
S += P.width - H.x + n;
}
u++;
}
d.push(new M(0, z, k + n, (F ? A : A + f) + p));
if (e.length !== u)
for (k = 0; k < u; k++)
(m = e[e.length - u + k]),
(n = Go(m, m.locationObject, m.locationSpot, h)),
m.moveTo(m.position.x, m.position.y + f - n.y);
I.free(h);
I.free(w);
if (q === Hq)
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));
M.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 === Hq
? this.commitLayers(d, new I(e + b / 2 - (f + e), g - c / 2))
: this.commitLayers(d, new I(e - b / 2, g - c / 2));
null !== a && a.eb('Layout');
this.isValidLayout = !0;
}
};
Mk.prototype.commitLayers = function() {};
function Dq(a, b) {
a = a.text;
b = b.text;
return a < b ? -1 : a > b ? 1 : 0;
}
ma.Object.defineProperties(Mk.prototype, {
wrappingWidth: {
get: function() {
return this.co;
},
set: function(a) {
this.co !== a &&
(0 < a || isNaN(a)) &&
((this.co = a), (this.isViewportSized = isNaN(a)), this.D());
},
},
wrappingColumn: {
get: function() {
return this.bo;
},
set: function(a) {
this.bo !== a && (0 < a || isNaN(a)) && ((this.bo = a), this.D());
},
},
cellSize: {
get: function() {
return this.pg;
},
set: function(a) {
this.pg.C(a) || (this.pg.assign(a), this.D());
},
},
spacing: {
get: function() {
return this.gf;
},
set: function(a) {
this.gf.C(a) || (this.gf.assign(a), this.D());
},
},
alignment: {
get: function() {
return this.Fb;
},
set: function(a) {
this.Fb === a || (a !== Aq && a !== Iq) || ((this.Fb = a), this.D());
},
},
arrangement: {
get: function() {
return this.Nb;
},
set: function(a) {
this.Nb === a || (a !== Bq && a !== Hq) || ((this.Nb = a), this.D());
},
},
sorting: {
get: function() {
return this.fd;
},
set: function(a) {
this.fd === a ||
(a !== Fq && a !== Gq && a !== Cq && a !== Eq) ||
((this.fd = a), this.D());
},
},
comparer: {
get: function() {
return this.Zc;
},
set: function(a) {
this.Zc !== a && ((this.Zc = a), this.D());
},
},
});
var Iq = new D(Mk, 'Position', 0),
Aq = new D(Mk, 'Location', 1),
Bq = new D(Mk, 'LeftToRight', 2),
Hq = new D(Mk, 'RightToLeft', 3),
Fq = new D(Mk, 'Forward', 4),
Gq = new D(Mk, 'Reverse', 5),
Cq = new D(Mk, 'Ascending', 6),
Eq = new D(Mk, 'Descending', 7);
Mk.className = 'GridLayout';
Mk.standardComparer = Dq;
Mk.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;
};
Mk.Position = Iq;
Mk.Location = Aq;
Mk.LeftToRight = Bq;
Mk.RightToLeft = Hq;
Mk.Forward = Fq;
Mk.Reverse = Gq;
Mk.Ascending = Cq;
Mk.Descending = Eq;
function mi() {
this.vn = new G();
this.kn = new G();
this.Ma = new G();
this.Se = new pb();
this.Re = new pb();
this.Wi = new pb();
this.H = null;
this.Xo = !1;
}
t = mi.prototype;
t.clear = function() {
this.vn.clear();
this.kn.clear();
this.Ma.clear();
this.Se.clear();
this.Re.clear();
this.Wi.clear();
};
t.Le = function(a) {
this.H = a;
};
t.ii = function(a) {
if (a instanceof V) {
if ((this.vn.add(a), a instanceof qf)) {
var b = a.containingGroup;
null === b ? this.H.Uh.add(a) : b.Vk.add(a);
b = a.layout;
null !== b && (b.diagram = this.H);
}
} else a instanceof T ? this.kn.add(a) : a instanceof ue || this.Ma.add(a);
b = a.data;
null === b ||
a instanceof ue ||
(a instanceof T ? this.Re.add(b, a) : this.Se.add(b, a));
};
t.lc = function(a) {
a.zj();
if (a instanceof V) {
if ((this.vn.remove(a), a instanceof qf)) {
var b = a.containingGroup;
null === b ? this.H.Uh.remove(a) : b.Vk.remove(a);
b = a.layout;
null !== b && (b.diagram = null);
}
} else
a instanceof T ? this.kn.remove(a) : a instanceof ue || this.Ma.remove(a);
b = a.data;
null === b ||
a instanceof ue ||
(a instanceof T ? this.Re.remove(b) : this.Se.remove(b));
};
t.Od = function() {
var a = this.H;
if (null !== a) {
for (var b = a.nodeTemplateMap.iterator; b.next(); ) {
var c = b.value,
d = b.key;
(!c.Tc() || c instanceof qf) &&
C(
'Invalid node template in Diagram.nodeTemplateMap: template for "' +
d +
'" must be a Node or a simple Part, not a Group or Link: ' +
c,
);
}
for (b = a.groupTemplateMap.iterator; b.next(); )
(c = b.value),
(d = b.key),
c instanceof qf ||
C(
'Invalid group template in Diagram.groupTemplateMap: template for "' +
d +
'" must be a Group, not a normal Node or Link: ' +
c,
);
for (b = a.linkTemplateMap.iterator; b.next(); )
(c = b.value),
(d = b.key),
c instanceof T ||
C(
'Invalid link template in Diagram.linkTemplateMap: template for "' +
d +
'" must be a Link, not a normal Node or simple Part: ' +
c,
);
b = Ea();
for (c = a.selection.iterator; c.next(); )
(d = c.value.data) && b.push(d);
c = Ea();
for (a = a.highlighteds.iterator; a.next(); )
(d = a.value.data) && c.push(d);
a = Ea();
for (d = this.nodes.iterator; d.next(); ) {
var e = d.value;
null !== e.data && (a.push(e.data), a.push(e.location));
}
for (d = this.links.iterator; d.next(); )
(e = d.value), null !== e.data && (a.push(e.data), a.push(e.location));
for (d = this.parts.iterator; d.next(); )
(e = d.value), null !== e.data && (a.push(e.data), a.push(e.location));
this.removeAllModeledParts();
this.addAllModeledParts();
for (d = 0; d < b.length; d++)
(e = this.Ec(b[d])), null !== e && (e.isSelected = !0);
for (d = 0; d < c.length; d++)
(e = this.Ec(c[d])), null !== e && (e.isHighlighted = !0);
for (d = 0; d < a.length; d += 2)
(e = this.Ec(a[d])), null !== e && (e.location = a[d + 1]);
Ga(b);
Ga(c);
Ga(a);
}
};
mi.prototype.addAllModeledParts = function() {
this.addModeledParts(this.diagram.model.nodeDataArray);
};
mi.prototype.addModeledParts = function(a, b) {
var c = this,
d = this.diagram.model;
a.forEach(function(a) {
d.lb(a) && Jq(c, a, !1);
});
a.forEach(function(a) {
d.lb(a) && c.resolveReferencesForData(a);
});
!1 !== b && Zj(this.diagram, !1);
};
function Jq(a, b, c) {
if (
void 0 !== b &&
null !== b &&
!a.diagram.undoManager.isUndoingRedoing &&
!a.Se.contains(b)
) {
void 0 === c && (c = !0);
a: {
if (
void 0 !== b &&
null !== b &&
!a.H.undoManager.isUndoingRedoing &&
!a.Se.contains(b)
) {
var d = a.uo(b);
var e = So(a, b, d);
if (null !== e && (kg(e), (e = e.copy()), null !== e)) {
var f = a.diagram.skipsModelSourceBindings;
a.diagram.skipsModelSourceBindings = !0;
e.Jf = d;
e.qb = b;
a.Xo && (e.zg = 'Tool');
a.diagram.add(e);
e.qb = null;
e.data = b;
a.diagram.skipsModelSourceBindings = f;
d = e;
break a;
}
}
d = null;
}
null !== d && c && a.resolveReferencesForData(b);
}
}
mi.prototype.insertLink = function() {
return null;
};
mi.prototype.resolveReferencesForData = function() {};
mi.prototype.uo = function(a) {
return this.H.model.uo(a);
};
function So(a, b, c) {
a = a.H;
var d = a.model;
d.Oj() && d.Ku(b)
? ((b = a.groupTemplateMap.I(c)),
null === b &&
((b = a.groupTemplateMap.I('')),
null === b &&
(Kq ||
((Kq = !0),
xa('No Group template found for category "' + c + '"'),
xa(' Using default group template')),
(b = a.Rx))))
: ((b = a.nodeTemplateMap.I(c)),
null === b &&
((b = a.nodeTemplateMap.I('')),
null === b &&
(Lq ||
((Lq = !0),
xa('No Node template found for category "' + c + '"'),
xa(' Using default node template')),
(b = a.Tx))));
return b;
}
mi.prototype.getLinkCategoryForData = function() {
return '';
};
mi.prototype.setLinkCategoryForData = function() {};
mi.prototype.setFromNodeForLink = function() {};
mi.prototype.setToNodeForLink = function() {};
mi.prototype.findLinkTemplateForCategory = function(a) {
var b = this.H,
c = b.linkTemplateMap.I(a);
null === c &&
((c = b.linkTemplateMap.I('')),
null === c &&
(Mq ||
((Mq = !0),
xa('No Link template found for category "' + a + '"'),
xa(' Using default link template')),
(c = b.Sx)));
return c;
};
mi.prototype.removeAllModeledParts = function() {
this.gs(this.diagram.model.nodeDataArray);
};
mi.prototype.gs = function(a) {
var b = this;
a.forEach(function(a) {
b.Lo(a);
});
};
mi.prototype.Lo = function(a) {
a = this.Ec(a);
null !== a && (Gj(this.diagram, a, !1), this.unresolveReferencesForPart(a));
};
mi.prototype.unresolveReferencesForPart = function() {};
mi.prototype.removeDataForLink = function() {};
mi.prototype.findPartForKey = function(a) {
if (null === a || void 0 === a) return null;
a = this.H.model.dc(a);
return null !== a ? this.Se.I(a) : null;
};
mi.prototype.Lb = function(a) {
if (null === a || void 0 === a) return null;
a = this.H.model.dc(a);
if (null === a) return null;
a = this.Se.I(a);
return a instanceof V ? a : null;
};
mi.prototype.findLinkForKey = function() {
return null;
};
t = mi.prototype;
t.Ec = function(a) {
if (null === a) return null;
var b = this.Se.I(a);
return null !== b ? b : (b = this.Re.I(a));
};
t.ci = function(a) {
if (null === a) return null;
a = this.Se.I(a);
return a instanceof V ? a : null;
};
t.Dc = function(a) {
return null === a ? null : this.Re.I(a);
};
t.Jr = function(a) {
for (var b = 0; b < arguments.length; ++b);
b = new G();
for (var c = this.vn.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) && Nq(this, e, g)) {
b.add(d);
break;
}
}
}
return b.iterator;
};
t.Ir = function(a) {
for (var b = 0; b < arguments.length; ++b);
b = new G();
for (var c = this.kn.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) && Nq(this, e, g)) {
b.add(d);
break;
}
}
}
return b.iterator;
};
function Nq(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 && !Oq(a, e[g], h)) return !1;
}
} else if (!Oq(a, e, f)) return !1;
}
return !0;
}
function Oq(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 (!Nq(a, b, c)) return !1;
} else if (b !== c) return !1;
return !0;
}
mi.prototype.doModelChanged = function(a) {
if (this.H) {
var b = this.H;
if (a.model === b.model) {
var c = a.change;
b.doModelChanged(a);
if (b.$) {
b.$ = !1;
try {
var d = a.modelChange;
if ('' !== d)
if (c === de) {
if ('nodeCategory' === d) {
var e = this.Ec(a.object),
f = a.newValue;
null !== e && 'string' === typeof f && (e.category = f);
} else
'nodeDataArray' === d &&
(this.gs(a.oldValue), this.addModeledParts(a.newValue));
b.isModified = !0;
} else if (c === fe) {
var g = a.newValue;
'nodeDataArray' === d && ya(g) && Jq(this, g);
b.isModified = !0;
} else if (c === ge) {
var h = a.oldValue;
'nodeDataArray' === d && ya(h) && this.Lo(h);
b.isModified = !0;
} else
c === ee &&
('SourceChanged' === d
? null !== a.object
? this.updateDataBindings(a.object, a.propertyName)
: (this.Uo(), this.updateAllTargetBindings())
: 'ModelDisplaced' === d && this.Od());
else if (c === de) {
var k = a.propertyName,
l = a.object;
if (l === b.model) {
if ('nodeKeyProperty' === k || 'nodeCategoryProperty' === k)
b.undoManager.isUndoingRedoing || this.Od();
} else this.updateDataBindings(l, k);
b.isModified = !0;
} else if (c === fe || c === ge) {
var m = a.change === fe,
n = m ? a.newParam : a.oldParam,
p = m ? a.newValue : a.oldValue,
r = this.Wi.I(a.object);
if (Array.isArray(r))
for (a = 0; a < r.length; a++) {
var q = r[a];
if (m) kn(q, p, n, !0);
else if (!(0 > n)) {
var u = n + bn(q);
q.lc(u, !0);
nn(q, u, n);
}
}
b.isModified = !0;
}
} finally {
b.$ = !0;
}
}
}
}
};
mi.prototype.updateAllTargetBindings = function(a) {
void 0 === a && (a = '');
for (var b = this.parts.iterator; b.next(); ) b.value.Ka(a);
for (b = this.nodes.iterator; b.next(); ) b.value.Ka(a);
for (b = this.links.iterator; b.next(); ) b.value.Ka(a);
};
mi.prototype.Uo = function() {
for (
var a = this.H.model, b = new G(), 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) {
Pq(a, b, !1);
});
for (d = 0; d < c.length; d++) {
var f = c[d];
null === this.Ec(f) && Qq(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();
};
mi.prototype.refreshDataBoundLinks = function() {};
mi.prototype.updateRelationshipsFromData = function() {};
mi.prototype.updateDataBindings = function(a, b) {
if ('string' === typeof b) {
var c = this.Ec(a);
if (null !== c) c.Ka(b);
else {
c = null;
for (var d = this.Wi.iterator; d.next(); ) {
for (var e = d.value, f = 0; f < e.length; f++) {
var g = e[f].Uw(a);
null !== g && (null === c && (c = Ea()), c.push(g));
}
if (null !== c) break;
}
if (null !== c) {
for (d = 0; d < c.length; d++) c[d].Ka(b);
Ga(c);
}
}
a === this.diagram.model.modelData && this.updateAllTargetBindings(b);
}
};
function Cj(a, b) {
var c = b.xh;
if (za(c)) {
var d = a.Wi.I(c);
if (null === d) (d = []), d.push(b), a.Wi.add(c, d);
else {
for (a = 0; a < d.length; a++) if (d[a] === b) return;
d.push(b);
}
}
}
function Fj(a, b, c) {
Aj(b, function(a) {
a = a.R.s;
for (var b = a.length, d = 0; d < b; d++) Xj(c, a[d]);
});
var d = b.xh;
if (za(d)) {
var e = a.Wi.I(d);
if (null !== e)
for (var f = 0; f < e.length; f++)
if (e[f] === b) {
e.splice(f, 1);
0 === e.length && a.Wi.remove(d);
break;
}
}
}
mi.prototype.Ej = function(a, b, c) {
void 0 === c && (c = !1);
var d = new pb();
if (za(a)) for (var e = 0; e < a.length; e++) Rq(this, a[e], b, d, c);
else for (a = a.iterator; a.next(); ) Rq(this, a.value, b, d, c);
if (null !== b) {
c = b.model;
a = b.toolManager.findTool('Dragging');
a = null !== a ? a.dragOptions.dragsLink : b.Em.dragsLink;
e = new G();
for (var f = new pb(), g = d.iterator; g.next(); ) {
var h = g.value;
if (h instanceof T)
a || (null !== h.fromNode && null !== h.toNode) || e.add(h);
else if (h instanceof V && null !== h.data && c.Bl()) {
var k = h;
h = g.key;
var l = h.ig();
null !== l &&
((l = d.I(l)),
null !== l
? (c.ie(k.data, c.ua(l.data)),
(k = b.Dc(k.data)),
(h = h.$g()),
null !== h && null !== k && f.add(h, k))
: c.ie(k.data, void 0));
}
}
0 < e.count && b.hs(e, !1);
if (0 < f.count) for (c = f.iterator; c.next(); ) d.add(c.key, c.value);
}
if (
null !== b &&
null !== this.H &&
((b = b.model), (c = b.afterCopyFunction), null !== c)
) {
var m = new pb();
d.each(function(a) {
null !== a.key.data && m.add(a.key.data, a.value.data);
});
c(m, b, this.H.model);
}
for (b = d.iterator; b.next(); ) b.value.Ka();
return d;
};
function Rq(a, b, c, d, e) {
if (null === b || (e && !b.canCopy())) return null;
if (d.contains(b)) return d.I(b);
var f = a.copyPartData(b, c);
if (!(f instanceof U)) 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.I(h);
null !== k && (k.fromNode = f);
}
h.toNode === b && ((h = d.I(h)), null !== h && (h.toNode = f));
}
if (b instanceof qf && f instanceof qf)
for (b = b.memberParts; b.next(); )
(g = Rq(a, b.value, c, d, e)),
g instanceof T || null === g || (g.containingGroup = f);
} else if (b instanceof T && f instanceof T)
for (
g = b.fromNode,
null !== g && ((g = d.I(g)), null !== g && (f.fromNode = g)),
g = b.toNode,
null !== g && ((g = d.I(g)), null !== g && (f.toNode = g)),
b = b.labelNodes;
b.next();
)
(g = Rq(a, b.value, c, d, e)),
null !== g && g instanceof V && (g.labeledLink = f);
return f;
}
mi.prototype.copyPartData = function(a, b) {
var c = null,
d = a.data;
if (null !== d && null !== b) {
var e = b.model;
a instanceof T ||
((d = e.copyNodeData(d)), ya(d) && (e.lf(d), (c = b.Ec(d))));
} else
kg(a),
(c = a.copy()),
null !== c &&
((e = this.H),
null !== b
? b.add(c)
: null !== d &&
null !== e &&
null !== e.commandHandler &&
e.commandHandler.copiesClipboardData &&
((b = e.model),
(e = null),
c instanceof T || (e = b.copyNodeData(d)),
ya(e) && (c.data = e)));
return c;
};
ma.Object.defineProperties(mi.prototype, {
nodes: {
get: function() {
return this.vn;
},
},
links: {
get: function() {
return this.kn;
},
},
parts: {
get: function() {
return this.Ma;
},
},
diagram: {
get: function() {
return this.H;
},
},
addsToTemporaryLayer: {
get: function() {
return this.Xo;
},
set: function(a) {
this.Xo = a;
},
},
});
mi.prototype.updateAllRelationshipsFromData = mi.prototype.Uo;
mi.prototype.findLinksByExample = mi.prototype.Ir;
mi.prototype.findNodesByExample = mi.prototype.Jr;
mi.prototype.findLinkForData = mi.prototype.Dc;
mi.prototype.findNodeForData = mi.prototype.ci;
mi.prototype.findPartForData = mi.prototype.Ec;
mi.prototype.findNodeForKey = mi.prototype.Lb;
mi.prototype.removeModeledPart = mi.prototype.Lo;
mi.prototype.removeModeledParts = mi.prototype.gs;
mi.prototype.rebuildParts = mi.prototype.Od;
var Lq = !1,
Kq = !1,
Mq = !1;
mi.className = 'PartManager';
function Sq(a) {
mi.apply(this, arguments);
}
la(Sq, mi);
Sq.prototype.addAllModeledParts = function() {
var a = this.diagram.model;
this.addModeledParts(a.nodeDataArray);
Tq(this, a.linkDataArray);
};
Sq.prototype.addModeledParts = function(a) {
mi.prototype.addModeledParts.call(this, a, !1);
for (a = this.links.iterator; a.next(); ) To(a.value);
Zj(this.diagram, !1);
};
function Tq(a, b) {
b.forEach(function(b) {
Uq(a, b);
});
Zj(a.diagram, !1);
}
function Uq(a, b) {
if (
void 0 !== b &&
null !== b &&
!a.diagram.undoManager.isUndoingRedoing &&
!a.Re.contains(b)
) {
var c = a.getLinkCategoryForData(b),
d = a.findLinkTemplateForCategory(c);
if (null !== d) {
kg(d);
var e = d.copy();
if (null !== e) {
d = a.diagram.skipsModelSourceBindings;
a.diagram.skipsModelSourceBindings = !0;
e.Jf = c;
e.qb = b;
c = a.diagram.model;
var f = Vq(c, b, !0);
'' !== f && (e.fromPortId = f);
f = Wq(c, b, !0);
void 0 !== f && ((f = a.Lb(f)), f instanceof V && (e.fromNode = f));
f = Vq(c, b, !1);
'' !== f && (e.toPortId = f);
f = Wq(c, b, !1);
void 0 !== f && ((f = a.Lb(f)), f instanceof V && (e.toNode = f));
c = c.vf(b);
Array.isArray(c) &&
c.forEach(function(b) {
b = a.Lb(b);
null !== b && (b.labeledLink = e);
});
a.Xo && (e.zg = 'Tool');
a.diagram.add(e);
e.qb = null;
e.data = b;
a.diagram.skipsModelSourceBindings = d;
}
}
}
}
Sq.prototype.removeAllModeledParts = function() {
var a = this.diagram.model;
Xq(this, a.linkDataArray);
this.gs(a.nodeDataArray);
};
function Xq(a, b) {
b.forEach(function(b) {
a.Lo(b);
});
}
Sq.prototype.getLinkCategoryForData = function(a) {
return this.diagram.model.Mr(a);
};
Sq.prototype.setLinkCategoryForData = function(a, b) {
return this.diagram.model.Oo(a, b);
};
Sq.prototype.setFromNodeForLink = function(a, b) {
var c = this.diagram.model;
c.cv(a.data, c.ua(null !== b ? b.data : null));
};
Sq.prototype.setToNodeForLink = function(a, b) {
var c = this.diagram.model;
c.gv(a.data, c.ua(null !== b ? b.data : null));
};
Sq.prototype.removeDataForLink = function(a) {
this.diagram.model.Jl(a.data);
};
Sq.prototype.findPartForKey = function(a) {
var b = mi.prototype.findPartForKey.call(this, a);
return null === b && ((a = this.diagram.model.Zg(a)), null !== a)
? this.Re.I(a)
: b;
};
Sq.prototype.findLinkForKey = function(a) {
if (null === a || void 0 === a) return null;
a = this.diagram.model.Zg(a);
return null !== a ? this.Re.I(a) : null;
};
Sq.prototype.doModelChanged = function(a) {
var b = this;
mi.prototype.doModelChanged.call(this, a);
if (this.diagram) {
var c = this.diagram;
if (a.model === c.model) {
var d = a.change;
if (c.$) {
c.$ = !1;
try {
var e = a.modelChange;
if ('' !== e)
if (d === de) {
if ('linkFromKey' === e) {
var f = this.Dc(a.object);
if (null !== f) {
var g = this.Lb(a.newValue);
f.fromNode = g;
}
} else if ('linkToKey' === e) {
var h = this.Dc(a.object);
if (null !== h) {
var k = this.Lb(a.newValue);
h.toNode = k;
}
} else if ('linkFromPortId' === e) {
var l = this.Dc(a.object);
if (null !== l) {
var m = a.newValue;
'string' === typeof m && (l.fromPortId = m);
}
} else if ('linkToPortId' === e) {
var n = this.Dc(a.object);
if (null !== n) {
var p = a.newValue;
'string' === typeof p && (n.toPortId = p);
}
} else if ('nodeGroupKey' === e) {
var r = this.Ec(a.object);
if (null !== r) {
var q = a.newValue;
if (void 0 !== q) {
var u = this.Lb(q);
u instanceof qf
? (r.containingGroup = u)
: (r.containingGroup = null);
} else r.containingGroup = null;
}
} else if ('linkLabelKeys' === e) {
var w = this.Dc(a.object);
if (null !== w) {
var v = a.oldValue,
z = a.newValue;
Array.isArray(v) &&
v.forEach(function(a) {
0 <= z.indexOf(a) ||
((a = b.Lb(a)), null !== a && (a.labeledLink = null));
});
Array.isArray(z) &&
z.forEach(function(a) {
a = b.Lb(a);
null !== a && (a.labeledLink = w);
});
}
} else if ('linkCategory' === e) {
var y = this.Dc(a.object),
A = a.newValue;
null !== y && 'string' === typeof A && (y.category = A);
} else
'linkDataArray' === e &&
(Xq(this, a.oldValue), Tq(this, a.newValue));
c.isModified = !0;
} else if (d === fe) {
var B = a.newValue;
if (
'linkDataArray' === e &&
'object' === typeof B &&
null !== B
)
Uq(this, B);
else if ('linkLabelKeys' === e && Yq(B)) {
var F = this.Dc(a.object),
L = this.Lb(B);
null !== F && null !== L && (L.labeledLink = F);
}
c.isModified = !0;
} else {
if (d === ge) {
var S = a.oldValue;
if (
'linkDataArray' === e &&
'object' === typeof S &&
null !== S
)
this.Lo(S);
else if ('linkLabelKeys' === e && Yq(S)) {
var R = this.Lb(S);
null !== R && (R.labeledLink = null);
}
c.isModified = !0;
}
}
else if (d === de) {
var P = a.propertyName;
a.object !== c.model ||
('linkFromKeyProperty' !== P &&
'linkToKeyProperty' !== P &&
'linkFromPortIdProperty' !== P &&
'linkToPortIdProperty' !== P &&
'linkLabelKeysProperty' !== P &&
'nodeIsGroupProperty' !== P &&
'nodeGroupKeyProperty' !== P &&
'linkCategoryProperty' !== P) ||
c.undoManager.isUndoingRedoing ||
this.Od();
c.isModified = !0;
}
} finally {
c.$ = !0;
}
}
}
}
};
Sq.prototype.refreshDataBoundLinks = function() {
var a = this,
b = this.diagram.model,
c = new G(),
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) {
Zq(b, a, !1);
});
d.forEach(function(c) {
null === a.Dc(c) && $q(b, c, !1);
});
};
Sq.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 T) {
var e = Wq(d, b, !0);
e = c.Lb(e);
a.fromNode = e;
e = Wq(d, b, !1);
e = c.Lb(e);
a.toNode = e;
b = d.vf(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.ua(f.data) === e) return;
}
e = new G().addAll(b);
var g = new G();
a.labelNodes.each(function(a) {
null !== a.data && ((a = d.ua(a.data)), void 0 !== a && g.add(a));
});
b = g.copy();
b.Ko(e);
e = e.copy();
e.Ko(g);
if (0 < b.count || 0 < e.count)
b.each(function(b) {
b = c.Lb(b);
null !== b && b.labeledLink === a && (b.labeledLink = null);
}),
e.each(function(b) {
b = c.Lb(b);
null !== b && b.labeledLink !== a && (b.labeledLink = a);
});
}
} else
!(a instanceof ue) &&
((b = d.ah(b)),
(b = c.findPartForKey(b)),
null === b || b instanceof qf) &&
(a.containingGroup = b);
}
}
};
Sq.prototype.resolveReferencesForData = function(a) {
var b = this.diagram.model,
c = b.ua(a);
if (void 0 !== c) {
var d = ar(b, c),
e = this.Ec(a);
if (null !== d && null !== e) {
d = d.iterator;
for (var f = {}; d.next(); ) {
var g = d.value;
b.lb(g)
? e instanceof qf &&
b.ah(g) === c &&
((g = this.Ec(g)), null !== g && (g.containingGroup = e))
: ((f.link = this.Dc(g)),
null !== f.link &&
e instanceof V &&
(Wq(b, g, !0) === c && (f.link.fromNode = e),
Wq(b, g, !1) === c && (f.link.toNode = e),
(g = b.vf(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,
};
}
br(b, c);
}
a = b.ah(a);
void 0 !== a &&
((a = this.Lb(a)), a instanceof qf && (e.containingGroup = a));
}
};
Sq.prototype.unresolveReferencesForPart = function(a) {
var b = this.diagram.model;
if (a instanceof V) {
var c = b.ua(a.data);
if (void 0 !== c) {
for (var d = a.linksConnected; d.next(); ) cr(b, c, d.value.data);
a.isLinkLabel && ((d = a.labeledLink), null !== d && cr(b, c, d.data));
if (a instanceof qf)
for (a = a.memberParts; a.next(); )
(d = a.value.data), b.lb(d) && cr(b, c, d);
}
}
};
Sq.prototype.copyPartData = function(a, b) {
var c = mi.prototype.copyPartData.call(this, a, b);
if (a instanceof T)
if (((a = a.data), null !== a && null !== b)) {
var d = b.model;
a = d.no(a);
'object' === typeof a && null !== a && (d.Yh(a), (c = b.Dc(a)));
} else
null !== c &&
((b = this.diagram),
null !== a &&
null !== b &&
null !== b.commandHandler &&
b.commandHandler.copiesClipboardData &&
((b = b.model.no(a)),
'object' === typeof b && null !== b && (c.data = b)));
return c;
};
Sq.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 T) {
if ((kg(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 &&
(kg(a),
(a = a.copy()),
null !== a && ((a.labeledLink = f), e.add(a))),
f
);
} else if (
null !== d &&
((d = f.no(d)), 'object' === typeof d && null !== d)
)
return (
null !== a && dr(f, d, f.ua(a.data), !0),
er(f, d, h, !0),
null !== c && dr(f, d, f.ua(c.data), !1),
er(f, d, b, !1),
f.Yh(d),
(a = g.archetypeLabelNodeData),
null === a ||
a instanceof V ||
((a = f.copyNodeData(a)),
'object' === typeof a &&
null !== a &&
(f.lf(a), (a = f.ua(a)), void 0 !== a && f.hu(d, a))),
e.Dc(d)
);
return null;
};
Sq.prototype.findLinkForKey = Sq.prototype.findLinkForKey;
Sq.prototype.findPartForKey = Sq.prototype.findPartForKey;
Sq.prototype.removeAllModeledParts = Sq.prototype.removeAllModeledParts;
Sq.prototype.addModeledParts = Sq.prototype.addModeledParts;
Sq.prototype.addAllModeledParts = Sq.prototype.addAllModeledParts;
Sq.className = 'GraphLinksPartManager';
function fr() {
mi.apply(this, arguments);
this.Jg = null;
}
la(fr, mi);
function gr(a, b, c) {
if (null !== b && null !== c && null === c.$g()) {
var d = a.diagram.toolManager.findTool('Linking'),
e = b,
f = c;
a.diagram.isTreePathToChildren || ((e = c), (f = b));
if (null === d || !Gf(d, e, f, null, !0))
if (
((b = a.getLinkCategoryForData(c.data)),
(d = a.findLinkTemplateForCategory(b)),
null !== d && (kg(d), (d = d.copy()), null !== d))
) {
var g = a.diagram.skipsModelSourceBindings;
a.diagram.skipsModelSourceBindings = !0;
d.Jf = b;
d.qb = c.data;
d.fromNode = e;
d.toNode = f;
a.diagram.add(d);
d.qb = null;
d.data = c.data;
a.diagram.skipsModelSourceBindings = g;
}
}
}
fr.prototype.getLinkCategoryForData = function(a) {
return this.diagram.model.Pr(a);
};
fr.prototype.setLinkCategoryForData = function(a, b) {
this.diagram.model.ms(a, b);
};
fr.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.ua(b));
else {
var e = this.Jg;
this.Jg = a;
null !== c && d.ie(c.data, void 0);
d.ie(b, d.ua(null !== a.toNode ? a.toNode.data : null));
this.Jg = e;
}
};
fr.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.Jg;
this.Jg = a;
null !== c && d.ie(c.data, void 0);
d.ie(b, d.ua(null !== a.fromNode ? a.fromNode.data : null));
this.Jg = e;
} else d.ie(a.data, d.ua(b));
};
fr.prototype.removeDataForLink = function(a) {
this.diagram.model.ie(a.data, void 0);
};
fr.prototype.findLinkForKey = function(a) {
if (null === a || void 0 === a) return null;
a = this.diagram.model.dc(a);
return null !== a ? this.Re.I(a) : null;
};
fr.prototype.doModelChanged = function(a) {
mi.prototype.doModelChanged.call(this, a);
if (this.diagram) {
var b = this.diagram;
if (a.model === b.model) {
var c = a.change;
if (b.$) {
b.$ = !1;
try {
var d = a.modelChange;
if ('' !== d) {
if (c === de) {
if ('nodeParentKey' === d) {
var e = a.object,
f = this.Lb(a.newValue),
g = this.ci(e);
if (null !== this.Jg)
null !== f &&
((this.Jg.data = e),
(this.Jg.category = this.getLinkCategoryForData(e)));
else if (null !== g) {
var h = g.$g();
null !== h
? null === f
? b.remove(h)
: b.isTreePathToChildren
? (h.fromNode = f)
: (h.toNode = f)
: gr(this, f, g);
}
} else if ('parentLinkCategory' === d) {
var k = this.ci(a.object),
l = a.newValue;
if (null !== k && 'string' === typeof l) {
var m = k.$g();
null !== m && (m.category = l);
}
}
b.isModified = !0;
}
} else if (c === de) {
var n = a.propertyName;
a.object === b.model &&
'nodeParentKeyProperty' === n &&
(b.undoManager.isUndoingRedoing || this.Od());
b.isModified = !0;
}
} finally {
b.$ = !0;
}
}
}
}
};
fr.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.bh(b)),
(b = c.Lb(b)),
(d = a.ig()),
b !== d &&
((d = a.$g()),
null !== b
? null !== d
? c.isTreePathToChildren
? (d.fromNode = b)
: (d.toNode = b)
: gr(this, b, a)
: null !== d && Gj(c, d, !1)));
}
}
};
fr.prototype.updateDataBindings = function(a, b) {
mi.prototype.updateDataBindings.call(this, a, b);
'string' === typeof b &&
null !== this.Ec(a) &&
((a = this.Dc(a)), null !== a && a.Ka(b));
};
fr.prototype.resolveReferencesForData = function(a) {
var b = this.diagram.model,
c = b.ua(a);
if (void 0 !== c) {
var d = ar(b, c),
e = this.Ec(a);
if (null !== d && null !== e) {
for (d = d.iterator; d.next(); ) {
var f = d.value;
b.lb(f) && e instanceof V && b.bh(f) === c && gr(this, e, this.ci(f));
}
br(b, c);
}
a = b.bh(a);
void 0 !== a && e instanceof V && ((a = this.Lb(a)), gr(this, a, e));
}
};
fr.prototype.unresolveReferencesForPart = function(a) {
var b = this.diagram.model;
if (a instanceof V) {
var c = b.ua(a.data),
d = this.Dc(a.data);
if (null !== d) {
d.isSelected = !1;
d.isHighlighted = !1;
var e = d.layer;
if (null !== e) {
var f = e.lc(-1, d, !1);
0 <= f && this.diagram.bb(ge, '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.lb(e) && cr(b, c, e);
}
};
fr.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.ua(d.data)), e.$g())
: null;
};
fr.prototype.findLinkForKey = fr.prototype.findLinkForKey;
fr.className = 'TreePartManager';
function Z(a, b) {
this.Zk = new G();
this.Xk = new G();
this.Av = ',\n "insertedNodeKeys": ';
this.Px = ',\n "modifiedNodeData": ';
this.Cv = ',\n "removedNodeKeys": ';
this.kh = null;
Ra(this);
this.Am = this.va = '';
this.xg = !1;
this.j = {};
this.Mc = [];
this.kb = new pb();
this.Mh = 'key';
this.pk = this.Rk = null;
this.rm = this.sm = !1;
this.um = !0;
this.fm = null;
this.gj = 'category';
this.Lf = new pb();
this.ot = new E();
this.Mg = !1;
this.m = null;
this.undoManager = new ie();
void 0 !== a && (za(a) ? (this.nodeDataArray = a) : Object.assign(this, a));
b && Object.assign(this, b);
}
Z.prototype.cloneProtected = function(a) {
a.va = this.va;
a.Am = this.Am;
a.xg = this.xg;
a.Mh = this.Mh;
a.Rk = this.Rk;
a.pk = this.pk;
a.sm = this.sm;
a.rm = this.rm;
a.um = this.um;
a.fm = this.fm;
a.gj = this.gj;
};
Z.prototype.copy = function() {
var a = new this.constructor();
this.cloneProtected(a);
return a;
};
Z.prototype.clear = function() {
this.Mc = [];
this.kb.clear();
this.Lf.clear();
this.undoManager.clear();
};
Z.prototype.toString = function(a) {
void 0 === a && (a = 0);
if (1 < a) return this.Qo();
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.ua(e) + ':' + Ia(e);
}
}
return b;
};
Z.prototype.eA = function(a) {
a.change !== ee &&
C(
'Model.toIncrementalData argument is not a Transaction ChangedEvent:' +
a.toString(),
);
var b = a.object;
if (!(a.isTransactionFinished && b instanceof he)) return null;
hr(this, b);
a = this.uv(b, 'FinishedUndo' === a.propertyName);
this.kh = null;
return a;
};
Z.prototype.uv = function(a, b) {
var c = this,
d = !1,
e = new G(),
f = new G(),
g = new G(),
h = this.kh;
a.changes.each(function(a) {
a.model === c &&
('nodeDataArray' === a.modelChange
? a.change === fe
? e.add(a.newValue)
: a.change === ge && g.add(a.oldValue)
: c.lb(a.object)
? f.add(a.object)
: a.change !== de ||
(c.modelData !== a.object && 'modelData' !== a.propertyName)
? null !== a.object &&
(h && h.contains(a.object)
? h.get(a.object).each(function(a) {
c.lb(a) && f.add(a);
})
: a.object instanceof Z ||
(c.ki() && c.Cc(a.object)) ||
ir(c, a.object).each(function(a) {
f.add(a);
}))
: (d = !0));
});
var k = this.Xk;
k.clear();
e.each(function(a) {
k.add(c.ua(a));
b || f.add(a);
});
var l = this.Zk;
l.clear();
g.each(function(a) {
l.add(c.ua(a));
b && f.add(a);
});
a = c.cloneDeep(f.Ea());
var m = null;
d &&
(null === m && (m = {}), (m.modelData = this.cloneDeep(this.modelData)));
0 < k.count &&
(null === m && (m = {}),
b ? (m.removedNodeKeys = k.Ea()) : (m.insertedNodeKeys = k.Ea()));
0 < a.length && (null === m && (m = {}), (m.modifiedNodeData = a));
0 < l.count &&
(null === m && (m = {}),
b ? (m.insertedNodeKeys = l.Ea()) : (m.removedNodeKeys = l.Ea()));
l.clear();
k.clear();
return m;
};
Z.prototype.cloneDeep = function(a) {
return jr(this, a, !0);
};
function jr(a, b, c, d, e, f) {
function g(a, c) {
h
? (void 0 === a.__gohashid && f.push(a), d.set(a, c))
: ((a = kb++), d.set(a, c), e.set(a, b));
}
if (!ya(b)) return b;
f || (f = []);
var h = Object.isExtensible(b);
d || (d = new pb());
if (h) {
var k = d.get(b);
if (k) return k;
} else
for (e || (e = new pb()), k = e.iterator; k.next(); ) {
var l = k.key;
if (k.value === b && (l = d.get(l))) return l;
}
if (Array.isArray(b)) {
k = [];
g(b, k);
for (var m = 0; m < b.length; m++) k.push(jr(a, b[m], !1, d, e, f));
} else if (
b instanceof I ||
b instanceof K ||
b instanceof M ||
b instanceof ec ||
b instanceof N
)
(k = b.copy()), g(b, k);
else {
if (b instanceof nl || b instanceof O || b instanceof D) return b;
if (b instanceof E)
(k = new E().addAll(jr(a, b.Ea(), !1, d, e, f))), g(b, k);
else if (b instanceof G)
(k = new G().addAll(jr(a, b.Ea(), !1, d, e, f))), g(b, k);
else if (b instanceof pb)
(k = new pb().addAll(jr(a, b.Ea(), !1, d, e, f))), g(b, k);
else if (b instanceof Date) (k = new Date(b.getTime())), g(b, k);
else if (b instanceof RegExp)
(k = new RegExp(b)), g(b, k), (k.lastIndex = b.lastIndex);
else if ('function' === typeof b.copy) (k = b.copy()), g(b, k);
else
for (m in ((k = {}), g(b, k), b))
'__gohashid' !== m && (k[m] = jr(a, b[m], !1, d, e, f));
}
c &&
f.forEach(function(a) {
delete a.__gohashid;
});
return k;
}
t = Z.prototype;
t.quote = function(a) {
return JSON.stringify(a).replace(/[-]/g, function(a) {
return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).substr(-4);
});
};
t.am = 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.Io = 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 kr(a, b) {
b = b.modelData;
ya(b) && (a.Ll(b), (a.modelData = b));
}
t.vv = function() {
var a = this.modelData,
b = !1,
c;
for (c in a)
if (!lr(c, a[c])) {
b = !0;
break;
}
a = '';
b && (a = ',\n "modelData": ' + mr(this, this.modelData));
return a + ',\n "nodeDataArray": ' + nr(this, this.nodeDataArray, !0);
};
t.Uu = function(a) {
kr(this, a);
a = a.nodeDataArray;
za(a) && (this.Ll(a), (this.nodeDataArray = a));
};
function hr(a, b) {
function c(a, b) {
if ((b = b.part))
if (((b = b.data), a !== b)) {
var c = d.get(a);
null === c ? ((c = new G()), c.add(b), d.add(a, c)) : c.add(b);
}
}
var d = a.kh;
null === d &&
((d = new pb()),
b.changes.each(function(a) {
if (null !== a.diagram) {
var b = a.change;
if (b === de) (a = a.object.panel) && (b = a.data) && c(b, a);
else if (b === fe || b === ge)
(a = a.object), (b = a.itemArray) && c(b, a);
}
}),
(a.kh = d));
}
function ir(a, b) {
for (var c = new G(), d = 0; d < a.nodeDataArray.length; d++) {
var e = a.nodeDataArray[d];
or(a, b, e, e, c);
}
return c;
}
function or(a, b, c, d, e) {
if (Array.isArray(c))
for (var f = 0; f < c.length; f++) {
var g = c[f];
if (g === b) return e.add(d), !0;
if (or(a, b, g, d, e)) return !0;
}
else if (ya(c) && Object.getPrototypeOf(c) === Object.prototype)
for (f in c) {
g = c[f];
if (g === b) return e.add(d), !0;
if (or(a, b, g, d, e)) return !0;
}
return !1;
}
t.tv = function(a, b) {
var c = this,
d = !1,
e = new G(),
f = new G(),
g = new G(),
h = this.kh;
a.changes.each(function(a) {
a.model === c &&
('nodeDataArray' === a.modelChange
? a.change === fe
? e.add(a.newValue)
: a.change === ge && g.add(a.oldValue)
: c.lb(a.object)
? f.add(a.object)
: a.change !== de ||
(c.modelData !== a.object && 'modelData' !== a.propertyName)
? null !== a.object &&
(h && h.contains(a.object)
? h.get(a.object).each(function(a) {
c.lb(a) && f.add(a);
})
: a.object instanceof Z ||
(c.ki() && c.Cc(a.object)) ||
ir(c, a.object).each(function(a) {
f.add(a);
}))
: (d = !0));
});
var k = this.Xk;
k.clear();
e.each(function(a) {
k.add(c.ua(a));
b || f.add(a);
});
var l = this.Zk;
l.clear();
g.each(function(a) {
l.add(c.ua(a));
b && f.add(a);
});
a = '';
d && (a += ',\n "modelData": ' + mr(this, this.modelData));
0 < k.count && (a += (b ? this.Cv : this.Av) + nr(this, k.Ea(), !0));
0 < f.count && (a += this.Px + nr(this, f.Ea(), !0));
0 < l.count && (a += (b ? this.Av : this.Cv) + nr(this, l.Ea(), !0));
l.clear();
k.clear();
return a;
};
t.Ho = function(a) {
((void 0 !== a.name && a.name !== this.name) ||
(void 0 !== a.dataFormat && a.dataFormat !== this.dataFormat) ||
(void 0 !== a.isReadOnly && a.isReadOnly !== this.isReadOnly) ||
(void 0 !== a.nodeKeyProperty &&
a.nodeKeyProperty !== this.nodeKeyProperty) ||
(void 0 !== a.copiesArrays && a.copiesArrays !== this.copiesArrays) ||
(void 0 !== a.copiesArrayObjects &&
a.copiesArrayObjects !== this.copiesArrayObjects) ||
(void 0 !== a.copiesKey && a.copiesKey !== this.copiesKey) ||
(void 0 !== a.nodeCategoryProperty &&
a.nodeCategoryProperty !== this.nodeCategoryProperty)) &&
C('applyIncrementalJson cannot change Model properties');
kr(this, a);
var b = a.insertedNodeKeys,
c = a.modifiedNodeData,
d = new pb();
if (Array.isArray(c))
for (var e = 0; e < c.length; e++) {
var f = c[e],
g = this.ua(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.dc(g);
null === h &&
((h = (h = d.get(g)) ? h : this.copyNodeData({})),
this.Sl(h, g),
this.lf(h));
}
if (Array.isArray(c))
for (b = c.length, d = 0; d < b; d++)
if (((e = c[d]), (f = this.ua(e)), (f = this.dc(f)), null !== f)) {
for (var k in e)
'__gohashid' === k ||
k === this.nodeKeyProperty ||
(this.Nj() && k === this.nodeIsGroupProperty) ||
this.setDataProperty(f, k, e[k]);
this.Tl(e, f);
}
a = a.removedNodeKeys;
if (Array.isArray(a))
for (c = a.length, k = 0; k < c; k++)
(b = this.dc(a[k])), null !== b && this.Kl(b);
};
t.Jx = function(a, b) {
a.change !== ee &&
C(
'Model.toIncrementalJson argument is not a Transaction ChangedEvent:' +
a.toString(),
);
var c = a.object;
if (!(a.isTransactionFinished && c instanceof he))
return '{ "incremental": 0 }';
void 0 === b && (b = pr(this, this));
hr(this, c);
a = this.tv(c, 'FinishedUndo' === a.propertyName);
this.kh = null;
return '2' === b
? '{ "incremental": 2' + a + '}'
: '{ "class": ' +
this.quote(b) +
', "incremental": 1' +
this.am() +
a +
'}';
};
t.fA = function(a, b) {
return this.Jx(a, b);
};
t.Qo = function(a) {
void 0 === a && (a = pr(this, this));
return '{ "class": ' + this.quote(a) + this.am() + this.vv() + '}';
};
t.toJSON = function(a) {
return this.Qo(a);
};
t.Dw = function(a) {
var b = null;
if ('string' === typeof a)
try {
b = x.JSON.parse(a);
} catch (d) {}
else
'object' === typeof a
? (b = a)
: C('Unable to modify a Model from: ' + a);
var c = b.incremental;
'number' !== typeof c &&
C('Unable to apply non-incremental changes to Model: ' + a);
0 !== c &&
(this.Da('applyIncrementalJson'),
this.Ho(b),
this.eb('applyIncrementalJson'));
};
t.qy = function(a) {
return this.Dw(a);
};
Z.constructGraphLinksModel = function() {
return new Z();
};
t = Z.prototype;
t.Ll = 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.Ll(d);
Array.isArray(a)
? (a[e] = d)
: C(
'Cannot replace an object in an HTMLCollection or NodeList at ' +
e,
);
}
}
else if (ya(a)) {
for (b in a)
if (
((c = a[b]),
ya(c) &&
((c = this.Ll(c)), (a[b] = c), 'points' === b && Array.isArray(c)))
) {
e = 0 === c.length % 2;
for (d = 0; d < c.length; d++)
if ('number' !== typeof c[d]) {
e = !1;
break;
}
if (e) {
e = new E();
for (d = 0; d < c.length / 2; d++)
e.add(new I(c[2 * d], c[2 * d + 1]));
e.freeze();
a[b] = e;
}
}
return qr(a);
}
return a;
};
t.bm = 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.bm(a.valueOf())
: za(a)
? nr(this, a)
: ya(a)
? mr(this, a)
: 'function' === typeof a
? 'null'
: a.toString();
};
function nr(a, b, c) {
void 0 === c && (c = !1);
var d = b.length;
if (0 >= d) return '[]';
var e = new Ta();
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.bm(g)));
}
c && 1 < d && e.add('\n');
e.add(']');
return e.toString();
}
function lr(a, b) {
return void 0 === b ||
'__gohashid' === a ||
'_' === a[0] ||
'function' === typeof b
? !0
: !1;
}
function rr(a) {
return isNaN(a)
? 'NaN'
: Infinity === a
? '9e9999'
: -Infinity === a
? '-9e9999'
: a;
}
function mr(a, b) {
var c = b;
if (c instanceof I)
b = {
class: 'go.Point',
x: rr(c.x),
y: rr(c.y),
};
else if (c instanceof K)
b = {
class: 'go.Size',
width: rr(c.width),
height: rr(c.height),
};
else if (c instanceof M)
b = {
class: 'go.Rect',
x: rr(c.x),
y: rr(c.y),
width: rr(c.width),
height: rr(c.height),
};
else if (c instanceof ec)
b = {
class: 'go.Margin',
top: rr(c.top),
right: rr(c.right),
bottom: rr(c.bottom),
left: rr(c.left),
};
else if (c instanceof N)
c.pb()
? (b = {
class: 'go.Spot',
x: rr(c.x),
y: rr(c.y),
offsetX: rr(c.offsetX),
offsetY: rr(c.offsetY),
})
: (b = {
class: 'go.Spot',
enum: c.toString(),
});
else if (c instanceof nl) {
b = {
class: 'go.Brush',
type: c.type.name,
};
if (c.type === ul) b.color = c.color;
else if (c.type === xl || c.type === ol)
(b.start = c.start),
(b.end = c.end),
c.type === ol &&
(0 !== c.startRadius && (b.startRadius = rr(c.startRadius)),
isNaN(c.endRadius) || (b.endRadius = rr(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 O
? ((b = {
class: 'go.Geometry',
type: c.type.name,
}),
0 !== c.startX && (b.startX = rr(c.startX)),
0 !== c.startY && (b.startY = rr(c.startY)),
0 !== c.endX && (b.endX = rr(c.endX)),
0 !== c.endY && (b.endY = rr(c.endY)),
c.spot1.C(tc) || (b.spot1 = c.spot1),
c.spot2.C(Cc) || (b.spot2 = c.spot2),
c.type === O.m && (b.path = O.ga(c)))
: c instanceof D &&
(b = {
class: 'go.EnumValue',
classType: pr(a, c.classType),
name: c.name,
});
d = '{';
c = !0;
for (var e in b) {
var f = on(b, e);
if (!lr(e, f))
if (
(c ? (c = !1) : (d += ','),
(d += a.quote(e) + ':'),
'points' === e && f instanceof E)
) {
var g = '[';
for (f = f.iterator; f.next(); ) {
var h = f.value;
1 < g.length && (g += ',');
g += a.bm(h.x);
g += ',';
g += a.bm(h.y);
}
g += ']';
d += g;
} else d += a.bm(f);
}
return d + '}';
}
function sr(a) {
return 'number' === typeof a
? a
: 'NaN' === a
? NaN
: '9e9999' === a
? Infinity
: '-9e9999' === a
? -Infinity
: parseFloat(a);
}
function qr(a) {
if ('object' !== typeof a) return a;
var b = a['class'] || '';
if ('NaN' === b) return NaN;
if ('Date' === b) return new Date(a.value);
if (0 !== b.indexOf('go.')) return a;
b = b.substr(3);
var c = a;
if ('Point' === b) c = new I(sr(a.x), sr(a.y));
else if ('Size' === b) c = new K(sr(a.width), sr(a.height));
else if ('Rect' === b)
c = new M(sr(a.x), sr(a.y), sr(a.width), sr(a.height));
else if ('Margin' === b)
c = new ec(sr(a.top), sr(a.right), sr(a.bottom), sr(a.left));
else if ('Spot' === b)
'string' === typeof a['enum']
? (c = jd(a['enum']))
: (c = new N(sr(a.x), sr(a.y), sr(a.offsetX), sr(a.offsetY)));
else if ('Brush' === b) {
if (
((c = new nl()),
(c.type = Sa(nl, a.type)),
'string' === typeof a.color && (c.color = a.color),
a.start instanceof N && (c.start = a.start),
a.end instanceof N && (c.end = a.end),
'number' === typeof a.startRadius &&
(c.startRadius = sr(a.startRadius)),
'number' === typeof a.endRadius && (c.endRadius = sr(a.endRadius)),
(a = a.colorStops),
ya(a))
)
for (var d in a) c.addColorStop(parseFloat(d), a[d]);
} else
'Geometry' === b
? ((c = null),
'string' === typeof a.path ? (c = O.parse(a.path)) : (c = new O()),
(c.type = Sa(O, a.type)),
'number' === typeof a.startX && (c.startX = sr(a.startX)),
'number' === typeof a.startY && (c.startY = sr(a.startY)),
'number' === typeof a.endX && (c.endX = sr(a.endX)),
'number' === typeof a.endY && (c.endY = sr(a.endY)),
a.spot1 instanceof N && (c.spot1 = a.spot1),
a.spot2 instanceof N && (c.spot2 = a.spot2))
: 'EnumValue' === b &&
((d = a.classType),
0 === d.indexOf('go.') && (d = d.substr(3)),
(d = tr(d)),
'function' === typeof d && (c = Sa(d, a.name)));
return c;
}
t.Ug = function(a) {
this.ot.add(a);
return this;
};
t.ak = function(a) {
this.ot.remove(a);
};
t.Cr = function(a) {
this.skipsUndoManager || this.undoManager.Fu(a);
for (var b = this.ot, c = b.length, d = 0; d < c; d++) b.K(d)(a);
};
t.bb = function(a, b, c, d, e, f, g) {
ur(this, '', a, b, c, d, e, f, g);
};
t.g = function(a, b, c, d, e) {
ur(this, '', de, a, this, b, c, d, e);
};
t.fs = function(a, b, c, d, e, f) {
ur(this, '', de, b, a, c, d, e, f);
};
function ur(a, b, c, d, e, f, g, h, k) {
void 0 === h && (h = null);
void 0 === k && (k = null);
var l = new ce();
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.Cr(l);
}
Z.prototype.changeState = function(a, b) {
if (null !== a && a.model === this)
if (a.change === de) {
var c = a.object,
d = a.propertyName,
e = a.I(b);
d === this.nodeKeyProperty &&
this.lb(c) &&
((b = a.I(!b)),
void 0 !== b && this.kb.remove(b),
void 0 !== e && this.kb.add(e, c));
Nj(c, d, e);
} else
a.change === fe
? ((c = a.newParam),
'nodeDataArray' === a.modelChange
? ((a = a.newValue),
ya(a) &&
'number' === typeof c &&
((d = this.ua(a)),
b
? (this.Mc[c] === a && Da(this.Mc, c),
void 0 !== d && this.kb.remove(d))
: (this.Mc[c] !== a && Ca(this.Mc, c, a),
void 0 !== d && this.kb.add(d, a))))
: '' === a.modelChange
? ((d = a.object) &&
!za(d) &&
a.propertyName &&
(d = on(a.object, a.propertyName)),
za(d) &&
'number' === typeof c &&
((a = a.newValue), b ? Da(d, c) : Ca(d, c, a)))
: C('unknown ChangedEvent.Insert modelChange: ' + a.toString()))
: a.change === ge
? ((c = a.oldParam),
'nodeDataArray' === a.modelChange
? ((a = a.oldValue),
ya(a) &&
'number' === typeof c &&
((d = this.ua(a)),
b
? (this.Mc[c] !== a && Ca(this.Mc, c, a),
void 0 !== d && this.kb.add(d, a))
: (this.Mc[c] === a && Da(this.Mc, c),
void 0 !== d && this.kb.remove(d))))
: '' === a.modelChange
? ((d = a.object) &&
!za(d) &&
a.propertyName &&
(d = on(a.object, a.propertyName)),
za(d) &&
'number' === typeof c &&
((a = a.oldValue), b ? Ca(d, c, a) : Da(d, c)))
: C('unknown ChangedEvent.Remove modelChange: ' + a.toString()))
: a.change !== ee && C('unknown ChangedEvent: ' + a.toString());
};
Z.prototype.Da = function(a) {
return this.undoManager.Da(a);
};
Z.prototype.eb = function(a) {
return this.undoManager.eb(a);
};
Z.prototype.Bf = function() {
return this.undoManager.Bf();
};
Z.prototype.commit = function(a, b) {
void 0 === b && (b = '');
var c = this.skipsUndoManager;
null === b && ((this.skipsUndoManager = !0), (b = ''));
this.undoManager.Da(b);
var d = !1;
try {
a(this), (d = !0);
} finally {
d ? this.undoManager.eb(b) : this.undoManager.Bf(),
(this.skipsUndoManager = c);
}
};
t = Z.prototype;
t.Ka = function(a, b) {
void 0 === b && (b = '');
ur(this, 'SourceChanged', ee, b, a, null, null);
};
t.ua = function(a) {
if (null !== a) {
var b = this.Mh;
if ('' !== b && ((b = on(a, b)), void 0 !== b)) {
if (Yq(b)) return b;
C(
'Key value for node data ' + a + ' is not a number or a string: ' + b,
);
}
}
};
t.Sl = function(a, b) {
if (null !== a) {
var c = this.Mh;
if ('' !== c)
if (this.lb(a)) {
var d = on(a, c);
d !== b &&
null === this.dc(b) &&
(Nj(a, c, b),
void 0 !== d && this.kb.remove(d),
this.kb.add(b, a),
ur(this, 'nodeKey', de, c, a, d, b),
'string' === typeof c && this.Ka(a, c),
this.Mo(d, b));
} else Nj(a, c, b);
}
};
function Yq(a) {
return 'number' === typeof a || 'string' === typeof a;
}
t.lb = function(a) {
var b = this.ua(a);
return void 0 === b ? !1 : this.kb.I(b) === a;
};
t.dc = function(a) {
null === a && C('Model.findNodeDataForKey:key must not be null');
return void 0 !== a && Yq(a) ? this.kb.I(a) : null;
};
t.Mu = function(a) {
if (null !== a) {
var b = this.Mh;
if ('' !== b) {
var c = this.ua(a);
if (void 0 === c || this.kb.contains(c)) {
var d = this.Rk;
if (
null !== d &&
((c = d(this, a)),
void 0 !== c && null !== c && !this.kb.contains(c))
) {
Nj(a, b, c);
return;
}
if ('string' === typeof c) {
for (d = 2; this.kb.contains(c + d); ) d++;
Nj(a, b, c + d);
} else if (void 0 === c || 'number' === typeof c) {
for (c = -this.kb.count - 1; this.kb.contains(c); ) c--;
Nj(a, b, c);
}
}
}
}
};
t.lf = function(a) {
null !== a && (gb(a), this.lb(a) || Qq(this, a, !0));
};
function Qq(a, b, c) {
var d = a.ua(b);
if (void 0 === d || a.kb.I(d) !== b)
a.Mu(b),
(d = a.ua(b)),
void 0 === d &&
C(
'Model.makeNodeDataKeyUnique failed on ' +
b +
'. Data not added to Model.',
),
a.kb.add(d, b),
(d = null),
c && ((d = a.Mc.length), Ca(a.Mc, d, b)),
ur(a, 'nodeDataArray', fe, 'nodeDataArray', a, null, b, null, d),
a.Nl(b),
a.Ml(b);
}
t.my = function(a) {
if (za(a)) for (var b = a.length, c = 0; c < b; c++) this.lf(a[c]);
else for (a = a.iterator; a.next(); ) this.lf(a.value);
};
t.Kl = function(a) {
null !== a && Pq(this, a, !0);
};
function Pq(a, b, c) {
var d = a.ua(b);
void 0 !== d && a.kb.remove(d);
d = null;
if (c) {
a: if (((c = a.Mc), 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;
Da(a.Mc, d);
}
ur(a, 'nodeDataArray', ge, 'nodeDataArray', a, b, null, d, null);
a.To(b);
}
t.Uz = function(a) {
if (za(a)) for (var b = a.length, c = 0; c < b; c++) this.Kl(a[c]);
else for (a = a.iterator; a.next(); ) this.Kl(a.value);
};
t.Hz = function(a) {
if (a !== this.nodeDataArray && za(a)) {
var b = this.Zk;
b.clear();
b.addAll(this.kb.iteratorKeys);
var c = this.Xk;
c.clear();
for (var d = a.length, e = 0; e < d; e++) {
var f = a[e],
g = this.ua(f);
if (void 0 !== g) {
c.add(g);
var h = this.dc(g);
h !== f &&
(null !== h
? (this.ho(h, f), this.Tl(f, h))
: ((f = this.cloneDeep(f)), this.Sl(f, g), this.lf(f)));
} else (g = this.cloneDeep(f)), this.lf(g), c.add(this.ua(g));
}
for (a = b.iterator; a.next(); )
(d = a.value), c.contains(d) || ((d = this.dc(d)) && this.Kl(d));
b.clear();
c.clear();
}
};
t.Mo = function(a, b) {
void 0 !== b && ((a = ar(this, a)), a instanceof G && this.Lf.add(b, a));
};
t.ov = function() {};
t.Nl = function() {};
t.Ml = function() {};
t.To = function() {};
function cr(a, b, c) {
if (void 0 !== b) {
var d = a.Lf.I(b);
null === d && ((d = new G()), a.Lf.add(b, d));
d.add(c);
}
}
function br(a, b, c) {
if (void 0 !== b) {
var d = a.Lf.I(b);
d instanceof G &&
(void 0 === c || null === c
? a.Lf.remove(b)
: (d.remove(c), 0 === d.count && a.Lf.remove(b)));
}
}
function ar(a, b) {
if (void 0 === b) return null;
a = a.Lf.I(b);
return a instanceof G ? a : null;
}
t.xy = function(a) {
void 0 === a ? this.Lf.clear() : this.Lf.remove(a);
};
Z.prototype.copyNodeData = function(a) {
if (null === a) return null;
var b = this.pk;
a = null !== b ? b(a, this) : wr(this, a, !0);
ya(a) && Ra(a);
return a;
};
function wr(a, b, c) {
if (a.copiesArrays && Array.isArray(b)) {
var d = [];
for (c = 0; c < b.length; c++) {
var e = wr(a, b[c], a.copiesArrayObjects);
d.push(e);
}
Ra(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 = on(b, d),
g = pr(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 ie ||
f instanceof he ||
f instanceof ce
? Nj(c, d, f)
: ((f = wr(a, f, !1)), Nj(c, d, f));
}
Ra(c);
return c;
}
return b instanceof I
? b.copy()
: b instanceof K
? b.copy()
: b instanceof M
? b.copy()
: b instanceof N
? b.copy()
: b instanceof ec
? b.copy()
: b;
}
Z.prototype.setDataProperty = function(a, b, c) {
if (this.lb(a)) {
if (b === this.nodeKeyProperty) {
this.Sl(a, c);
return;
}
if (b === this.nodeCategoryProperty) {
this.Rl(a, c);
return;
}
} else
!xr &&
a instanceof Y &&
((xr = !0),
xa(
'Model.setDataProperty is modifying a GraphObject, "' +
a.toString() +
'"',
),
xa(' Is that really your intent?'));
var d = on(a, b);
d !== c && (Nj(a, b, c), this.fs(a, b, d, c));
};
t = Z.prototype;
t.set = function(a, b, c) {
this.setDataProperty(a, b, c);
};
t.ho = function(a, b) {
if (b) {
var c = this.lb(a),
d;
for (d in b)
'__gohashid' === d ||
(c && d === this.nodeKeyProperty) ||
this.setDataProperty(a, d, b[d]);
}
};
t.iy = function(a, b) {
this.Qr(a, -1, b);
};
t.Qr = function(a, b, c) {
0 > b && (b = a.length);
Ca(a, b, c);
ur(this, '', fe, '', a, null, c, null, b);
};
t.Xu = function(a, b) {
void 0 === b && (b = -1);
a === this.Mc &&
C(
'Model.removeArrayItem should not be called on the Model.nodeDataArray',
);
-1 === b && (b = a.length - 1);
var c = a[b];
Da(a, b);
ur(this, '', ge, '', a, c, null, b, null);
};
t.uo = function(a) {
if (null === a) return '';
var b = this.gj;
if ('' === b) return '';
b = on(a, b);
if (void 0 === b) return '';
if ('string' === typeof b) return b;
C('getCategoryForNodeData found a non-string category for ' + a + ': ' + b);
};
t.Rl = function(a, b) {
if (null !== a) {
var c = this.gj;
if ('' !== c)
if (this.lb(a)) {
var d = on(a, c);
void 0 === d && (d = '');
d !== b && (Nj(a, c, b), ur(this, 'nodeCategory', de, c, a, d, b));
} else Nj(a, c, b);
}
};
t.Tl = function(a, b) {
this.Rl(b, this.uo(a));
};
t.Bl = function() {
return !1;
};
t.Nj = function() {
return !1;
};
t.ki = function() {
return !1;
};
t.Vr = function() {
return !1;
};
t.Oj = function() {
return !1;
};
function oi() {
return new Z();
}
function pr(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 pr(a, b.constructor);
return typeof b;
}
function tr(a) {
return yr[a] ? yr[a] : void 0 !== x.go && x.go[a] ? x.go[a] : null;
}
function on(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 Nj(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.va;
},
set: function(a) {
var b = this.va;
b !== a && ((this.va = a), this.g('name', b, a));
},
},
dataFormat: {
get: function() {
return this.Am;
},
set: function(a) {
var b = this.Am;
b !== a && ((this.Am = a), this.g('dataFormat', b, a));
},
},
isReadOnly: {
get: function() {
return this.xg;
},
set: function(a) {
var b = this.xg;
b !== a && ((this.xg = a), this.g('isReadOnly', b, a));
},
},
modelData: {
get: function() {
return this.j;
},
set: function(a) {
var b = this.j;
b !== a && ((this.j = a), this.g('modelData', b, a), this.Ka(a));
},
},
undoManager: {
get: function() {
return this.m;
},
set: function(a) {
var b = this.m;
b !== a &&
(null !== b && b.yx(this), (this.m = a), null !== a && a.Bw(this));
},
},
skipsUndoManager: {
get: function() {
return this.Mg;
},
set: function(a) {
this.Mg = a;
},
},
nodeKeyProperty: {
get: function() {
return this.Mh;
},
set: function(a) {
var b = this.Mh;
b !== a &&
('' === a && C('Model.nodeKeyProperty may not be the empty string'),
0 < this.kb.count &&
C(
'Cannot set Model.nodeKeyProperty when there is existing node data',
),
(this.Mh = a),
this.g('nodeKeyProperty', b, a));
},
},
makeUniqueKeyFunction: {
get: function() {
return this.Rk;
},
set: function(a) {
var b = this.Rk;
b !== a && ((this.Rk = a), this.g('makeUniqueKeyFunction', b, a));
},
},
nodeDataArray: {
get: function() {
return this.Mc;
},
set: function(a) {
var b = this.Mc;
if (b !== a) {
this.kb.clear();
this.ov();
for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
ya(e) ||
C('Model.nodeDataArray must only contain Objects, not: ' + e);
gb(e);
}
this.Mc = a;
d = new E();
for (e = 0; e < c; e++) {
var f = a[e],
g = this.ua(f);
void 0 === g
? d.add(f)
: null !== this.kb.I(g)
? d.add(f)
: this.kb.add(g, f);
}
for (d = d.iterator; d.next(); )
(e = d.value),
this.Mu(e),
(f = this.ua(e)),
void 0 !== f && this.kb.add(f, e);
ur(this, 'nodeDataArray', de, 'nodeDataArray', this, b, a);
for (b = 0; b < c; b++) (d = a[b]), this.Nl(d), this.Ml(d);
Array.isArray(a) || (this.isReadOnly = !0);
}
},
},
copyNodeDataFunction: {
get: function() {
return this.pk;
},
set: function(a) {
var b = this.pk;
b !== a && ((this.pk = a), this.g('copyNodeDataFunction', b, a));
},
},
copiesArrays: {
get: function() {
return this.sm;
},
set: function(a) {
var b = this.sm;
b !== a && ((this.sm = a), this.g('copiesArrays', b, a));
},
},
copiesArrayObjects: {
get: function() {
return this.rm;
},
set: function(a) {
var b = this.rm;
b !== a && ((this.rm = a), this.g('copiesArrayObjects', b, a));
},
},
copiesKey: {
get: function() {
return this.um;
},
set: function(a) {
var b = this.um;
b !== a && ((this.um = a), this.g('copiesKey', b, a));
},
},
afterCopyFunction: {
get: function() {
return this.fm;
},
set: function(a) {
var b = this.fm;
b !== a && ((this.fm = a), this.g('afterCopyFunction', b, a));
},
},
nodeCategoryProperty: {
get: function() {
return this.gj;
},
set: function(a) {
var b = this.gj;
b !== a && ((this.gj = a), this.g('nodeCategoryProperty', b, a));
},
},
type: {
get: function() {
return 'Model';
},
},
});
Z.prototype.setCategoryForNodeData = Z.prototype.Rl;
Z.prototype.getCategoryForNodeData = Z.prototype.uo;
Z.prototype.removeArrayItem = Z.prototype.Xu;
Z.prototype.insertArrayItem = Z.prototype.Qr;
Z.prototype.addArrayItem = Z.prototype.iy;
Z.prototype.assignAllDataProperties = Z.prototype.ho;
Z.prototype.set = Z.prototype.set;
Z.prototype.clearUnresolvedReferences = Z.prototype.xy;
Z.prototype.mergeNodeDataArray = Z.prototype.Hz;
Z.prototype.removeNodeDataCollection = Z.prototype.Uz;
Z.prototype.removeNodeData = Z.prototype.Kl;
Z.prototype.addNodeDataCollection = Z.prototype.my;
Z.prototype.addNodeData = Z.prototype.lf;
Z.prototype.makeNodeDataKeyUnique = Z.prototype.Mu;
Z.prototype.findNodeDataForKey = Z.prototype.dc;
Z.prototype.containsNodeData = Z.prototype.lb;
Z.prototype.setKeyForNodeData = Z.prototype.Sl;
Z.prototype.getKeyForNodeData = Z.prototype.ua;
Z.prototype.updateTargetBindings = Z.prototype.Ka;
Z.prototype.commit = Z.prototype.commit;
Z.prototype.rollbackTransaction = Z.prototype.Bf;
Z.prototype.commitTransaction = Z.prototype.eb;
Z.prototype.startTransaction = Z.prototype.Da;
Z.prototype.raiseDataChanged = Z.prototype.fs;
Z.prototype.raiseChanged = Z.prototype.g;
Z.prototype.raiseChangedEvent = Z.prototype.bb;
Z.prototype.removeChangedListener = Z.prototype.ak;
Z.prototype.addChangedListener = Z.prototype.Ug;
Z.prototype.writeJsonValue = Z.prototype.bm;
Z.prototype.replaceJsonObjects = Z.prototype.Ll;
Z.prototype.applyIncrementalJSON = Z.prototype.qy;
Z.prototype.applyIncrementalJson = Z.prototype.Dw;
Z.prototype.toJSON = Z.prototype.toJSON;
Z.prototype.toJson = Z.prototype.Qo;
Z.prototype.toIncrementalJSON = Z.prototype.fA;
Z.prototype.toIncrementalJson = Z.prototype.Jx;
Z.prototype.toIncrementalData = Z.prototype.eA;
Z.prototype.clear = Z.prototype.clear;
var xr = !1,
yr = {};
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)
: C('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 = tr(d)))
: ((e = tr(d)), null === e && (e = x[d]));
'function' === typeof e && (a = new e());
} catch (f) {}
null === a || a instanceof Z
? (b = a)
: C('Unable to construct a Model of declared class: ' + c['class']);
}
null === b && (b = Z.constructGraphLinksModel());
b.Io(c);
b.Uu(c);
return b;
};
Z.safePropertyValue = on;
Z.safePropertySet = Nj;
yr.Brush = nl;
yr.ChangedEvent = ce;
yr.Geometry = O;
yr.Margin = ec;
yr.Panel = W;
yr.Point = I;
yr.Rect = M;
yr.Size = K;
yr.Spot = N;
yr.Transaction = he;
yr.UndoManager = ie;
function wi(a, b, c, d) {
Ra(this);
this._isFrozen = !1;
void 0 === a && (a = '');
void 0 === b && (b = a);
void 0 === c && (c = null);
this.j = -1;
this.sd = null;
this.ml = a;
this.ll = this.Wn = 0;
this.Zq = null;
this.cn = !1;
this.hl = b;
this.qm = c;
void 0 === d
? ((this.Uk = zr), (this.jk = null))
: ((this.Uk = gn), (this.jk = d));
this.Vs = new G();
}
wi.prototype.copy = function() {
var a = new wi();
a.ml = this.ml;
a.Wn = this.Wn;
a.ll = this.ll;
a.Zq = this.Zq;
a.cn = this.cn;
a.hl = this.hl;
a.qm = this.qm;
a.Uk = this.Uk;
a.jk = this.jk;
return a;
};
t = wi.prototype;
t.ob = function(a) {
a.classType === wi && (this.mode = a);
};
t.toString = function() {
return (
'Binding(' +
this.targetProperty +
':' +
this.sourceProperty +
(-1 !== this.ti ? ' ' + this.ti : '') +
' ' +
this.mode.name +
')'
);
};
t.freeze = function() {
this._isFrozen = !0;
return this;
};
t.ja = function() {
this._isFrozen = !1;
return this;
};
t.px = function(a) {
void 0 === a && (a = null);
this.mode = gn;
this.backConverter = a;
return this;
};
t.Fo = function(a) {
void 0 === a && (a = '');
this.sourceName = a;
this.isToModel = !1;
return this;
};
t.Kz = function() {
this.sourceName = null;
this.isToModel = !0;
return this;
};
function gl(a, b, c) {
a = a.sourceName;
return null === a || '' === a
? b
: '/' === a
? c.part
: '.' === a
? c
: '..' === a
? c.panel
: b.fb(a);
}
t.pv = function(a, b, c) {
var d = this.hl;
if (void 0 === c || '' === d || d === c) {
c = this.ml;
var e = this.qm;
if (null === e && '' === c)
xa(
'Binding error: target property is the empty string: ' +
this.toString(),
);
else {
var f = b;
'' !== d && (f = on(b, d));
if (void 0 !== f)
if (null === e) '' !== c && Nj(a, c, f);
else
try {
if ('' !== c) {
var g = e(f, a);
Nj(a, c, g);
} else e(f, a);
} catch (h) {}
}
}
};
t.Vo = function(a, b, c, d) {
if (this.Uk === gn) {
var e = this.ml;
if (void 0 === c || e === c) {
c = this.hl;
var f = this.jk,
g = a;
'' !== e && (g = on(a, e));
if (void 0 !== g && !this.Vs.contains(a))
try {
this.Vs.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) : Nj(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.Xu(m, l);
k.Qr(m, l, g);
}
}
else
try {
if ('' !== c) {
var n = f(g, b, k);
null !== k ? k.setDataProperty(b, c, n) : Nj(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.Xu(q, r);
k.Qr(q, r, p);
}
}
} catch (u) {}
} finally {
this.Vs.remove(a);
}
}
}
};
ma.Object.defineProperties(wi.prototype, {
ti: {
get: function() {
return this.j;
},
set: function(a) {
this._isFrozen && va(this);
this.j = a;
},
},
targetProperty: {
get: function() {
return this.ml;
},
set: function(a) {
this._isFrozen && va(this);
this.ml = a;
},
},
sourceName: {
get: function() {
return this.Zq;
},
set: function(a) {
this._isFrozen && va(this);
this.Zq = a;
null !== a && (this.cn = !1);
},
},
isToModel: {
get: function() {
return this.cn;
},
set: function(a) {
this._isFrozen && va(this);
this.cn = a;
},
},
sourceProperty: {
get: function() {
return this.hl;
},
set: function(a) {
this._isFrozen && va(this);
this.hl = a;
},
},
converter: {
get: function() {
return this.qm;
},
set: function(a) {
this._isFrozen && va(this);
this.qm = a;
},
},
backConverter: {
get: function() {
return this.jk;
},
set: function(a) {
this._isFrozen && va(this);
this.jk = a;
},
},
mode: {
get: function() {
return this.Uk;
},
set: function(a) {
this._isFrozen && va(this);
this.Uk = a;
},
},
});
wi.prototype.updateSource = wi.prototype.Vo;
wi.prototype.updateTarget = wi.prototype.pv;
wi.prototype.ofModel = wi.prototype.Kz;
wi.prototype.ofObject = wi.prototype.Fo;
wi.prototype.makeTwoWay = wi.prototype.px;
var Jk = 'Binding',
zr = new D(wi, 'OneWay', 1),
gn = new D(wi, 'TwoWay', 2);
wi.className = 'Binding';
wi.parseEnum = function(a, b) {
return function(c) {
c = Sa(a, c);
return null === c ? b : c;
};
};
wi.toString = Ia;
wi.OneWay = zr;
wi.TwoWay = gn;
function Ar(a, b, c) {
Z.call(this);
this.zv = ',\n "insertedLinkKeys": ';
this.Ox = ',\n "modifiedLinkData": ';
this.Bv = ',\n "removedLinkKeys": ';
this.ed = [];
this.Rf = new G();
this.rb = new pb();
this.Bh = '';
this.Li = this.nk = this.Sk = null;
this.Ze = 'from';
this.$e = 'to';
this.aj = this.$i = '';
this.Zi = 'category';
this.ce = '';
this.Yk = 'isGroup';
this.ye = 'group';
this.tm = !1;
void 0 !== b && (this.linkDataArray = b);
void 0 !== a && (za(a) ? (this.nodeDataArray = a) : Object.assign(this, a));
c && Object.assign(this, c);
}
la(Ar, Z);
Ar.constructGraphLinksModel = Z.constructGraphLinksModel;
Ar.prototype.cloneProtected = function(a) {
Z.prototype.cloneProtected.call(this, a);
a.Bh = this.Bh;
a.Sk = this.Sk;
a.nk = this.nk;
a.Ze = this.Ze;
a.$e = this.$e;
a.$i = this.$i;
a.aj = this.aj;
a.Zi = this.Zi;
a.ce = this.ce;
a.Yk = this.Yk;
a.ye = this.ye;
a.tm = this.tm;
};
t = Ar.prototype;
t.clear = function() {
Z.prototype.clear.call(this);
this.ed = [];
this.rb.clear();
this.Rf.clear();
};
t.toString = function(a) {
void 0 === a && (a = 0);
if (2 <= a) return this.Qo();
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.ua(e) + ':' + Ia(e);
}
b += '\n link data:';
a = this.linkDataArray;
c = a.length;
for (d = 0; d < c; d++)
(e = a[d]), (b += ' ' + Wq(this, e, !0) + '-->' + Wq(this, e, !1));
}
return b;
};
t.uv = function(a, b) {
'' === this.linkKeyProperty &&
C(
'GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.',
);
var c = Z.prototype.uv.call(this, a, b),
d = this,
e = new G(),
f = new G(),
g = new G(),
h = this.kh;
a.changes.each(function(a) {
a.model === d &&
('linkDataArray' === a.modelChange
? a.change === fe
? e.add(a.newValue)
: a.change === ge && g.add(a.oldValue)
: d.Cc(a.object)
? f.add(a.object)
: null !== a.object &&
(null !== a.object && h && h.contains(a.object)
? h.get(a.object).each(function(a) {
d.Cc(a) && f.add(a);
})
: a.object instanceof Z ||
d.lb(a.object) ||
Br(d, a.object).each(function(a) {
f.add(a);
})));
});
var k = this.Xk;
k.clear();
e.each(function(a) {
k.add(d.uc(a));
b || f.add(a);
});
var l = this.Zk;
l.clear();
g.each(function(a) {
l.add(d.uc(a));
b && f.add(a);
});
a = d.cloneDeep(f.Ea());
0 < k.count &&
(null === c && (c = {}),
b ? (c.removedLinkKeys = k.Ea()) : (c.insertedLinkKeys = k.Ea()));
0 < a.length && (null === c && (c = {}), (c.modifiedLinkData = a));
0 < l.count &&
(null === c && (c = {}),
b ? (c.insertedLinkKeys = l.Ea()) : (c.removedLinkKeys = l.Ea()));
l.clear();
k.clear();
return c;
};
t.am = function() {
var a = Z.prototype.am.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.Io = function(a) {
Z.prototype.Io.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.vv = function() {
var a = Z.prototype.vv.call(this),
b = ',\n "linkDataArray": ' + nr(this, this.linkDataArray, !0);
return a + b;
};
t.Uu = function(a) {
Z.prototype.Uu.call(this, a);
a = a.linkDataArray;
Array.isArray(a) && (this.Ll(a), (this.linkDataArray = a));
};
function Br(a, b) {
for (var c = new G(), d = 0; d < a.linkDataArray.length; d++) {
var e = a.linkDataArray[d];
or(a, b, e, e, c);
}
return c;
}
t.tv = function(a, b) {
'' === this.linkKeyProperty &&
C(
'GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.',
);
var c = Z.prototype.tv.call(this, a, b),
d = this,
e = new G(),
f = new G(),
g = new G(),
h = this.kh;
a.changes.each(function(a) {
a.model === d &&
('linkDataArray' === a.modelChange
? a.change === fe
? e.add(a.newValue)
: a.change === ge && g.add(a.oldValue)
: d.Cc(a.object)
? f.add(a.object)
: null !== a.object &&
(null !== a.object && h && h.contains(a.object)
? h.get(a.object).each(function(a) {
d.Cc(a) && f.add(a);
})
: a.object instanceof Z ||
d.lb(a.object) ||
Br(d, a.object).each(function(a) {
f.add(a);
})));
});
var k = this.Xk;
k.clear();
e.each(function(a) {
k.add(d.uc(a));
b || f.add(a);
});
var l = this.Zk;
l.clear();
g.each(function(a) {
l.add(d.uc(a));
b && f.add(a);
});
a = c;
0 < k.count && (a += (b ? this.Bv : this.zv) + nr(this, k.Ea(), !0));
0 < f.count && (a += this.Ox + nr(this, f.Ea(), !0));
0 < l.count && (a += (b ? this.zv : this.Bv) + nr(this, l.Ea(), !0));
l.clear();
k.clear();
return a;
};
t.Ho = function(a) {
((void 0 !== a.linkCategoryProperty &&
a.linkCategoryProperty !== this.linkCategoryProperty) ||
(void 0 !== a.linkKeyProperty &&
a.linkKeyProperty !== this.linkKeyProperty) ||
(void 0 !== a.linkFromKeyProperty &&
a.linkFromKeyProperty !== this.linkFromKeyProperty) ||
(void 0 !== a.linkToKeyProperty &&
a.linkToKeyProperty !== this.linkToKeyProperty) ||
(void 0 !== a.linkFromPortIdProperty &&
a.linkFromPortIdProperty !== this.linkFromPortIdProperty) ||
(void 0 !== a.linkToPortIdProperty &&
a.linkToPortIdProperty !== this.linkToPortIdProperty) ||
(void 0 !== a.linkLabelKeysProperty &&
a.linkLabelKeysProperty !== this.linkLabelKeysProperty) ||
(void 0 !== a.nodeIsGroupProperty &&
a.nodeIsGroupProperty !== this.nodeIsGroupProperty) ||
(void 0 !== a.nodeGroupKeyProperty &&
a.nodeGroupKeyProperty !== this.nodeGroupKeyProperty)) &&
C('applyIncrementalJson cannot change Model properties');
Z.prototype.Ho.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.Zg(e);
null === f && ((f = this.no({})), this.ks(f, e), this.Yh(f));
}
b = a.modifiedLinkData;
if (Array.isArray(b))
for (c = b.length, d = 0; d < c; d++)
if (((e = b[d]), (f = this.uc(e)), (f = this.Zg(f)), null !== f)) {
for (var g in e)
'__gohashid' !== g &&
g !== this.linkKeyProperty &&
this.setDataProperty(f, g, e[g]);
Cr(this, e, f);
}
a = a.removedLinkKeys;
if (Array.isArray(a))
for (g = a.length, b = 0; b < g; b++)
(c = this.Zg(a[b])), null !== c && this.Jl(c);
};
Ar.prototype.changeState = function(a, b) {
if (null !== a && a.model === this) {
if (a.change === de) {
var c = a.object,
d = a.propertyName;
if (d === this.linkKeyProperty && this.Cc(c)) {
var e = a.I(b);
b = a.I(!b);
void 0 !== b && this.rb.remove(b);
void 0 !== e && this.rb.add(e, c);
Nj(c, d, e);
return;
}
} else if (a.change === fe) {
c = a.newParam;
if ('linkDataArray' === a.modelChange) {
a = a.newValue;
ya(a) &&
'number' === typeof c &&
((d = this.uc(a)),
b
? (this.Rf.remove(a),
this.ed[c] === a && this.ed.splice(c, 1),
void 0 !== d && this.rb.remove(d))
: (this.Rf.add(a),
this.ed[c] !== a && this.ed.splice(c, 0, a),
void 0 !== d && this.rb.add(d, a)));
return;
}
if ('linkLabelKeys' === a.modelChange) {
d = this.vf(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 === ge) {
c = a.oldParam;
if ('linkDataArray' === a.modelChange) {
a = a.oldValue;
ya(a) &&
'number' === typeof c &&
((d = this.uc(a)),
b
? (this.Rf.add(a),
this.ed[c] !== a && this.ed.splice(c, 0, a),
void 0 !== d && this.rb.add(d, a))
: (this.Rf.remove(a),
this.ed[c] === a && this.ed.splice(c, 1),
void 0 !== d && this.rb.remove(d)));
return;
}
if ('linkLabelKeys' === a.modelChange) {
d = this.vf(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.changeState.call(this, a, b);
}
};
t = Ar.prototype;
t.Dl = function(a) {
if (void 0 !== a) {
var b = this.Li;
if (null !== b) {
var c = this.dc(a);
null === c &&
((c = this.copyNodeData(b)),
Nj(c, this.nodeKeyProperty, a),
this.lf(c));
}
return a;
}
};
t.$w = function(a) {
return Wq(this, a, !0);
};
t.cv = function(a, b) {
dr(this, a, b, !0);
};
t.ex = function(a) {
return Wq(this, a, !1);
};
t.gv = function(a, b) {
dr(this, a, b, !1);
};
function Wq(a, b, c) {
if (
null !== b &&
((a = c ? a.Ze : a.$e), '' !== a && ((a = on(b, a)), void 0 !== a))
) {
if (Yq(a)) return a;
C(
(c ? 'FromKey' : 'ToKey') +
' value for link data ' +
b +
' is not a number or a string: ' +
a,
);
}
}
function dr(a, b, c, d) {
null === c && (c = void 0);
if (null !== b) {
var e = d ? a.Ze : a.$e;
if ('' !== e)
if (((c = a.Dl(c)), a.Cc(b))) {
var f = on(b, e);
f !== c &&
(br(a, f, b),
Nj(b, e, c),
null === a.dc(c) && cr(a, c, b),
ur(a, d ? 'linkFromKey' : 'linkToKey', de, e, b, f, c),
'string' === typeof e && a.Ka(b, e));
} else Nj(b, e, c);
}
}
t.ax = function(a) {
return Vq(this, a, !0);
};
t.dv = function(a, b) {
er(this, a, b, !0);
};
t.gx = function(a) {
return Vq(this, a, !1);
};
t.hv = function(a, b) {
er(this, a, b, !1);
};
function Vq(a, b, c) {
if (null === b) return '';
a = c ? a.$i : a.aj;
if ('' === a) return '';
b = on(b, a);
return void 0 === b ? '' : b;
}
function er(a, b, c, d) {
if (null !== b) {
var e = d ? a.$i : a.aj;
if ('' !== e)
if (a.Cc(b)) {
var f = on(b, e);
void 0 === f && (f = '');
f !== c &&
(Nj(b, e, c),
ur(a, d ? 'linkFromPortId' : 'linkToPortId', de, e, b, f, c),
'string' === typeof e && a.Ka(b, e));
} else Nj(b, e, c);
}
}
t.vf = function(a) {
if (null === a) return Dr;
var b = this.ce;
if ('' === b) return Dr;
a = on(a, b);
return void 0 === a ? Dr : a;
};
t.ls = function(a, b) {
if (null !== a) {
var c = this.ce;
if ('' !== c)
if (this.Cc(a)) {
var d = on(a, c);
void 0 === d && (d = Dr);
if (d !== b) {
if (Array.isArray(d))
for (var e = d.length, f = 0; f < e; f++) br(this, d[f], a);
Nj(a, c, b);
e = b.length;
for (f = 0; f < e; f++) {
var g = b[f];
null === this.dc(g) && cr(this, g, a);
}
ur(this, 'linkLabelKeys', de, c, a, d, b);
'string' === typeof c && this.Ka(a, c);
}
} else Nj(a, c, b);
}
};
t.hu = function(a, b) {
if (null !== b && void 0 !== b && null !== a) {
var c = this.ce;
if ('' !== c) {
var d = on(a, c);
if (void 0 === d) (c = []), c.push(b), this.ls(a, c);
else if (Array.isArray(d)) {
var e = d.indexOf(b);
0 <= e ||
((e = d.length),
d.push(b),
this.Cc(a) &&
(null === this.dc(b) && cr(this, b, a),
ur(this, 'linkLabelKeys', fe, c, a, null, b, null, e)));
} else
C(
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.ce;
if ('' !== c) {
var d = on(a, c);
if (Array.isArray(d)) {
var e = d.indexOf(b);
0 > e ||
(d.splice(e, 1),
this.Cc(a) &&
(br(this, b, a),
ur(this, 'linkLabelKeys', ge, c, a, b, null, e, null)));
} else
void 0 !== d &&
C(
c +
' property is not an Array; cannot removeLabelKeyforLinkData: ' +
a,
);
}
}
};
t.uc = function(a) {
if (null !== a) {
var b = this.Bh;
if ('' !== b && ((b = on(a, b)), void 0 !== b)) {
if (Yq(b)) return b;
C(
'Key value for link data ' + a + ' is not a number or a string: ' + b,
);
}
}
};
t.ks = function(a, b) {
if (null !== a) {
var c = this.Bh;
if ('' !== c)
if (this.Cc(a)) {
var d = on(a, c);
d !== b &&
null === this.Zg(b) &&
(Nj(a, c, b),
void 0 !== d && this.rb.remove(d),
this.rb.add(b, a),
ur(this, 'linkKey', de, c, a, d, b),
'string' === typeof c && this.Ka(a, c));
} else Nj(a, c, b);
}
};
t.Zg = function(a) {
null === a && C('GraphLinksModel.findLinkDataForKey:key must not be null');
return void 0 !== a && Yq(a) ? this.rb.I(a) : null;
};
t.$r = function(a) {
if (null !== a) {
var b = this.Bh;
if ('' !== b) {
var c = this.uc(a);
if (void 0 === c || this.rb.contains(c)) {
var d = this.Sk;
if (
null !== d &&
((c = d(this, a)),
void 0 !== c && null !== c && !this.rb.contains(c))
) {
Nj(a, b, c);
return;
}
if ('string' === typeof c) {
for (d = 2; this.rb.contains(c + d); ) d++;
Nj(a, b, c + d);
} else if (void 0 === c || 'number' === typeof c) {
for (c = -this.rb.count - 1; this.rb.contains(c); ) c--;
Nj(a, b, c);
}
}
}
}
};
t.Cc = function(a) {
return null === a ? !1 : this.Rf.contains(a);
};
t.Yh = function(a) {
null !== a && (gb(a), this.Cc(a) || $q(this, a, !0));
};
function $q(a, b, c) {
if ('' !== a.linkKeyProperty) {
var d = a.uc(b);
if (void 0 !== d && a.rb.I(d) === b) return;
a.$r(b);
d = a.uc(b);
void 0 === d &&
C(
'GraphLinksModel.makeLinkDataKeyUnique failed on ' +
b +
'. Data not added to model.',
);
a.rb.add(d, b);
}
a.Rf.add(b);
d = null;
c && ((d = a.ed.length), a.ed.splice(d, 0, b));
ur(a, 'linkDataArray', fe, 'linkDataArray', a, null, b, null, d);
Er(a, b);
}
t.ly = function(a) {
if (Array.isArray(a))
for (var b = a.length, c = 0; c < b; c++) this.Yh(a[c]);
else for (a = a.iterator; a.next(); ) this.Yh(a.value);
};
t.Jl = function(a) {
null !== a && Zq(this, a, !0);
};
function Zq(a, b, c) {
a.Rf.remove(b);
var d = a.uc(b);
void 0 !== d && a.rb.remove(d);
d = null;
if (c) {
d = a.ed.indexOf(b);
if (0 > d) return;
a.ed.splice(d, 1);
}
ur(a, 'linkDataArray', ge, 'linkDataArray', a, b, null, d, null);
c = Wq(a, b, !0);
br(a, c, b);
c = Wq(a, b, !1);
br(a, c, b);
d = a.vf(b);
if (Array.isArray(d))
for (var e = d.length, f = 0; f < e; f++) (c = d[f]), br(a, c, b);
}
t.Sz = function(a) {
if (Array.isArray(a))
for (var b = a.length, c = 0; c < b; c++) this.Jl(a[c]);
else for (a = a.iterator; a.next(); ) this.Jl(a.value);
};
t.Gz = function(a) {
'' === this.linkKeyProperty &&
C(
'GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.',
);
if (a !== this.linkDataArray && za(a)) {
var b = this.Zk;
b.clear();
b.addAll(this.rb.iteratorKeys);
var c = this.Xk;
c.clear();
for (var d = a.length, e = 0; e < d; e++) {
var f = a[e],
g = this.uc(f);
if (void 0 !== g) {
c.add(g);
var h = this.Zg(g);
h !== f &&
(null !== h
? (this.ho(h, f), Cr(this, f, h))
: ((f = this.cloneDeep(f)), this.ks(f, g), this.Yh(f)));
} else (g = this.cloneDeep(f)), this.Yh(g), c.add(this.uc(g));
}
for (a = b.iterator; a.next(); )
(d = a.value), c.contains(d) || ((d = this.Zg(d)) && this.Jl(d));
b.clear();
c.clear();
}
};
function Er(a, b) {
var c = Wq(a, b, !0);
c = a.Dl(c);
null === a.dc(c) && cr(a, c, b);
c = Wq(a, b, !1);
c = a.Dl(c);
null === a.dc(c) && cr(a, c, b);
var d = a.vf(b);
if (Array.isArray(d))
for (var e = d.length, f = 0; f < e; f++)
(c = d[f]), null === a.dc(c) && cr(a, c, b);
}
t.no = function(a) {
if (null === a) return null;
var b = this.nk;
a = null !== b ? b(a, this) : wr(this, a, !0);
ya(a) &&
(Ra(a),
'' !== this.Ze && Nj(a, this.Ze, void 0),
'' !== this.$e && Nj(a, this.$e, void 0),
'' !== this.ce && Nj(a, this.ce, []));
return a;
};
t.Ku = function(a) {
if (null === a) return !1;
var b = this.Yk;
return '' === b ? !1 : on(a, b) ? !0 : !1;
};
t.ah = function(a) {
if (null !== a) {
var b = this.ye;
if ('' !== b && ((b = on(a, b)), void 0 !== b)) {
if (Yq(b)) return b;
C(
'GroupKey value for node data ' +
a +
' is not a number or a string: ' +
b,
);
}
}
};
t.Po = function(a, b) {
null === b && (b = void 0);
if (null !== a) {
var c = this.ye;
if ('' !== c)
if (this.lb(a)) {
var d = on(a, c);
d !== b &&
(br(this, d, a),
Nj(a, c, b),
null === this.dc(b) && cr(this, b, a),
ur(this, 'nodeGroupKey', de, c, a, d, b),
'string' === typeof c && this.Ka(a, c));
} else Nj(a, c, b);
}
};
Ar.prototype.copyNodeData = function(a) {
if (null === a) return null;
a = Z.prototype.copyNodeData.call(this, a);
this.Cj ||
'' === this.ye ||
void 0 === on(a, this.ye) ||
Nj(a, this.ye, void 0);
return a;
};
Ar.prototype.setDataProperty = function(a, b, c) {
if (this.lb(a)) {
if (b === this.nodeKeyProperty) {
this.Sl(a, c);
return;
}
if (b === this.nodeCategoryProperty) {
this.Rl(a, c);
return;
}
if (b === this.nodeGroupKeyProperty) {
this.Po(a, c);
return;
}
} else if (this.Cc(a)) {
if (b === this.linkFromKeyProperty) {
dr(this, a, c, !0);
return;
}
if (b === this.linkToKeyProperty) {
dr(this, a, c, !1);
return;
}
if (b === this.linkFromPortIdProperty) {
er(this, a, c, !0);
return;
}
if (b === this.linkToPortIdProperty) {
er(this, a, c, !1);
return;
}
if (b === this.linkKeyProperty) {
this.ks(a, c);
return;
}
if (b === this.linkCategoryProperty) {
this.Oo(a, c);
return;
}
if (b === this.linkLabelKeysProperty) {
this.ls(a, c);
return;
}
}
var d = on(a, b);
d !== c && (Nj(a, b, c), this.fs(a, b, d, c));
};
t = Ar.prototype;
t.ho = function(a, b) {
if (b) {
var c = this.lb(a),
d = this.Cc(a),
e;
for (e in b)
'__gohashid' === e ||
(c && e === this.nodeKeyProperty) ||
(c && e === this.nodeIsGroupProperty && on(a, e) === b[e]) ||
(d && e === this.linkKeyProperty) ||
this.setDataProperty(a, e, b[e]);
}
};
t.Mo = function(a, b) {
Z.prototype.Mo.call(this, a, b);
for (var c = this.kb.iterator; c.next(); ) this.Zu(c.value, a, b);
for (c = this.Rf.iterator; c.next(); ) {
var d = c.value,
e = a,
f = b;
if (Wq(this, d, !0) === e) {
var g = this.Ze;
Nj(d, g, f);
ur(this, 'linkFromKey', de, g, d, e, f);
'string' === typeof g && this.Ka(d, g);
}
Wq(this, d, !1) === e &&
((g = this.$e),
Nj(d, g, f),
ur(this, 'linkToKey', de, g, d, e, f),
'string' === typeof g && this.Ka(d, g));
g = this.vf(d);
if (Array.isArray(g))
for (var h = g.length, k = this.ce, l = 0; l < h; l++)
g[l] === e &&
((g[l] = f), ur(this, 'linkLabelKeys', fe, k, d, e, f, l, l));
}
};
t.Zu = function(a, b, c) {
if (this.ah(a) === b) {
var d = this.ye;
Nj(a, d, c);
ur(this, 'nodeGroupKey', de, d, a, b, c);
'string' === typeof d && this.Ka(a, d);
}
};
t.ov = function() {
Z.prototype.ov.call(this);
for (var a = this.linkDataArray, b = a.length, c = 0; c < b; c++)
Er(this, a[c]);
};
t.Nl = function(a) {
Z.prototype.Nl.call(this, a);
a = this.ua(a);
var b = ar(this, a);
if (null !== b) {
var c = Ea();
for (b = b.iterator; b.next(); ) {
var d = b.value;
if (this.lb(d)) {
if (this.ah(d) === a) {
var e = this.ye;
ur(this, 'nodeGroupKey', de, e, d, a, a);
'string' === typeof e && this.Ka(d, e);
c.push(d);
}
} else if (
(Wq(this, d, !0) === a &&
((e = this.Ze),
ur(this, 'linkFromKey', de, e, d, a, a),
'string' === typeof e && this.Ka(d, e),
c.push(d)),
Wq(this, d, !1) === a &&
((e = this.$e),
ur(this, 'linkToKey', de, e, d, a, a),
'string' === typeof e && this.Ka(d, e),
c.push(d)),
(e = this.vf(d)),
Array.isArray(e))
)
for (var f = e.length, g = this.ce, h = 0; h < f; h++)
e[h] === a &&
(ur(this, 'linkLabelKeys', fe, g, d, a, a, h, h), c.push(d));
}
for (b = 0; b < c.length; b++) br(this, a, c[b]);
Ga(c);
}
};
t.Ml = function(a) {
Z.prototype.Ml.call(this, a);
var b = this.ah(a);
null === this.dc(b) && cr(this, b, a);
};
t.To = function(a) {
Z.prototype.To.call(this, a);
var b = this.ah(a);
br(this, b, a);
};
t.Mr = function(a) {
if (null === a) return '';
var b = this.Zi;
if ('' === b) return '';
b = on(a, b);
if (void 0 === b) return '';
if ('string' === typeof b) return b;
C('getCategoryForLinkData found a non-string category for ' + a + ': ' + b);
};
Ar.prototype.getLinkCategoryForData = function(a) {
return this.Mr(a);
};
Ar.prototype.Oo = function(a, b) {
if (null !== a) {
var c = this.Zi;
if ('' !== c)
if (this.Cc(a)) {
var d = on(a, c);
void 0 === d && (d = '');
d !== b &&
(Nj(a, c, b),
ur(this, 'linkCategory', de, c, a, d, b),
'string' === typeof c && this.Ka(a, c));
} else Nj(a, c, b);
}
};
Ar.prototype.setLinkCategoryForData = function(a, b) {
this.Oo(a, b);
};
t = Ar.prototype;
t.Tl = function(a, b) {
Z.prototype.Tl.call(this, a, b);
this.Po(b, this.ah(a));
};
function Cr(a, b, c) {
a.Oo(c, a.Mr(b));
a.cv(c, a.$w(b));
a.gv(c, a.ex(b));
a.ls(c, a.vf(b));
a.dv(c, a.ax(b));
a.hv(c, a.gx(b));
}
t.Nj = function() {
return !0;
};
t.ki = function() {
return !0;
};
t.Vr = function() {
return !0;
};
t.Oj = function() {
return !0;
};
ma.Object.defineProperties(Ar.prototype, {
archetypeNodeData: {
get: function() {
return this.Li;
},
set: function(a) {
var b = this.Li;
b !== a && ((this.Li = a), this.g('archetypeNodeData', b, a));
},
},
linkFromKeyProperty: {
get: function() {
return this.Ze;
},
set: function(a) {
var b = this.Ze;
b !== a && ((this.Ze = a), this.g('linkFromKeyProperty', b, a));
},
},
linkToKeyProperty: {
get: function() {
return this.$e;
},
set: function(a) {
var b = this.$e;
b !== a && ((this.$e = a), this.g('linkToKeyProperty', b, a));
},
},
linkFromPortIdProperty: {
get: function() {
return this.$i;
},
set: function(a) {
var b = this.$i;
b !== a && ((this.$i = a), this.g('linkFromPortIdProperty', b, a));
},
},
linkToPortIdProperty: {
get: function() {
return this.aj;
},
set: function(a) {
var b = this.aj;
b !== a && ((this.aj = a), this.g('linkToPortIdProperty', b, a));
},
},
linkLabelKeysProperty: {
get: function() {
return this.ce;
},
set: function(a) {
var b = this.ce;
b !== a && ((this.ce = a), this.g('linkLabelKeysProperty', b, a));
},
},
linkDataArray: {
get: function() {
return this.ed;
},
set: function(a) {
var b = this.ed;
if (b !== a) {
this.rb.clear();
for (var c = a.length, d = 0; d < c; d++) {
var e = a[d];
ya(e) ||
C(
'GraphLinksModel.linkDataArray must only contain Objects, not: ' +
e,
);
gb(e);
}
this.ed = a;
if ('' !== this.linkKeyProperty) {
d = new E();
for (e = 0; e < c; e++) {
var f = a[e],
g = this.uc(f);
void 0 === g
? d.add(f)
: null !== this.rb.I(g)
? d.add(f)
: this.rb.add(g, f);
}
for (d = d.iterator; d.next(); )
(e = d.value),
this.$r(e),
(f = this.uc(e)),
void 0 !== f && this.rb.add(f, e);
}
d = new G();
for (e = 0; e < c; e++) d.add(a[e]);
this.Rf = d;
ur(this, 'linkDataArray', de, 'linkDataArray', this, b, a);
for (b = 0; b < c; b++) Er(this, a[b]);
}
},
},
linkKeyProperty: {
get: function() {
return this.Bh;
},
set: function(a) {
var b = this.Bh;
if (b !== a) {
this.Bh = a;
this.rb.clear();
for (var c = this.linkDataArray.length, d = 0; d < c; d++) {
var e = this.linkDataArray[d],
f = this.uc(e);
void 0 === f && (this.$r(e), (f = this.uc(e)));
void 0 !== f && this.rb.add(f, e);
}
this.g('linkKeyProperty', b, a);
}
},
},
makeUniqueLinkKeyFunction: {
get: function() {
return this.Sk;
},
set: function(a) {
var b = this.Sk;
b !== a && ((this.Sk = a), this.g('makeUniqueLinkKeyFunction', b, a));
},
},
copyLinkDataFunction: {
get: function() {
return this.nk;
},
set: function(a) {
var b = this.nk;
b !== a && ((this.nk = a), this.g('copyLinkDataFunction', b, a));
},
},
nodeIsGroupProperty: {
get: function() {
return this.Yk;
},
set: function(a) {
var b = this.Yk;
b !== a && ((this.Yk = a), this.g('nodeIsGroupProperty', b, a));
},
},
nodeGroupKeyProperty: {
get: function() {
return this.ye;
},
set: function(a) {
var b = this.ye;
b !== a && ((this.ye = a), this.g('nodeGroupKeyProperty', b, a));
},
},
Cj: {
get: function() {
return this.tm;
},
set: function(a) {
this.tm !== a && (this.tm = a);
},
},
linkCategoryProperty: {
get: function() {
return this.Zi;
},
set: function(a) {
var b = this.Zi;
b !== a && ((this.Zi = a), this.g('linkCategoryProperty', b, a));
},
},
type: {
get: function() {
return 'GraphLinksModel';
},
},
});
Ar.prototype.setCategoryForLinkData = Ar.prototype.Oo;
Ar.prototype.getCategoryForLinkData = Ar.prototype.Mr;
Ar.prototype.assignAllDataProperties = Ar.prototype.ho;
Ar.prototype.setGroupKeyForNodeData = Ar.prototype.Po;
Ar.prototype.getGroupKeyForNodeData = Ar.prototype.ah;
Ar.prototype.isGroupForNodeData = Ar.prototype.Ku;
Ar.prototype.copyLinkData = Ar.prototype.no;
Ar.prototype.mergeLinkDataArray = Ar.prototype.Gz;
Ar.prototype.removeLinkDataCollection = Ar.prototype.Sz;
Ar.prototype.removeLinkData = Ar.prototype.Jl;
Ar.prototype.addLinkDataCollection = Ar.prototype.ly;
Ar.prototype.addLinkData = Ar.prototype.Yh;
Ar.prototype.containsLinkData = Ar.prototype.Cc;
Ar.prototype.makeLinkDataKeyUnique = Ar.prototype.$r;
Ar.prototype.findLinkDataForKey = Ar.prototype.Zg;
Ar.prototype.setKeyForLinkData = Ar.prototype.ks;
Ar.prototype.getKeyForLinkData = Ar.prototype.uc;
Ar.prototype.removeLabelKeyForLinkData = Ar.prototype.xx;
Ar.prototype.addLabelKeyForLinkData = Ar.prototype.hu;
Ar.prototype.setLabelKeysForLinkData = Ar.prototype.ls;
Ar.prototype.getLabelKeysForLinkData = Ar.prototype.vf;
Ar.prototype.setToPortIdForLinkData = Ar.prototype.hv;
Ar.prototype.getToPortIdForLinkData = Ar.prototype.gx;
Ar.prototype.setFromPortIdForLinkData = Ar.prototype.dv;
Ar.prototype.getFromPortIdForLinkData = Ar.prototype.ax;
Ar.prototype.setToKeyForLinkData = Ar.prototype.gv;
Ar.prototype.getToKeyForLinkData = Ar.prototype.ex;
Ar.prototype.setFromKeyForLinkData = Ar.prototype.cv;
Ar.prototype.getFromKeyForLinkData = Ar.prototype.$w;
Ar.prototype.clear = Ar.prototype.clear;
var Dr = Object.freeze([]);
Ar.className = 'GraphLinksModel';
yr.GraphLinksModel = Ar;
Z.constructGraphLinksModel = Z.constructGraphLinksModel = function() {
return new Ar();
};
Z.initDiagramModel = oi = function() {
return new Ar();
};
function Fr(a, b) {
Z.call(this);
this.ze = 'parent';
this.vm = !1;
this.ij = 'parentLinkCategory';
void 0 !== a && (za(a) ? (this.nodeDataArray = a) : Object.assign(this, a));
b && Object.assign(this, b);
}
la(Fr, Z);
Fr.constructGraphLinksModel = Z.constructGraphLinksModel;
Fr.prototype.cloneProtected = function(a) {
Z.prototype.cloneProtected.call(this, a);
a.ze = this.ze;
a.vm = this.vm;
a.ij = this.ij;
};
t = Fr.prototype;
t.toString = function(a) {
void 0 === a && (a = 0);
if (2 <= a) return this.Qo();
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.ua(e) + ':' + Ia(e);
}
}
return b;
};
t.am = function() {
var a = Z.prototype.am.call(this),
b = '';
'parent' !== this.nodeParentKeyProperty &&
'string' === typeof this.nodeParentKeyProperty &&
(b +=
',\n "nodeParentKeyProperty": ' +
this.quote(this.nodeParentKeyProperty));
return a + b;
};
t.Io = function(a) {
Z.prototype.Io.call(this, a);
a.nodeParentKeyProperty &&
(this.nodeParentKeyProperty = a.nodeParentKeyProperty);
};
t.Ho = function(a) {
void 0 !== a.nodeParentKeyProperty &&
a.nodeParentKeyProperty !== this.nodeParentKeyProperty &&
C('applyIncrementalJson cannot change Model properties');
Z.prototype.Ho.call(this, a);
};
t.Dl = function(a) {
return a;
};
t.bh = function(a) {
if (null !== a) {
var b = this.ze;
if ('' !== b && ((b = on(a, b)), void 0 !== b)) {
if (Yq(b)) return b;
C(
'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.ze;
if ('' !== c)
if (((b = this.Dl(b)), this.lb(a))) {
var d = on(a, c);
d !== b &&
(br(this, d, a),
Nj(a, c, b),
null === this.dc(b) && cr(this, b, a),
ur(this, 'nodeParentKey', de, c, a, d, b),
'string' === typeof c && this.Ka(a, c));
} else Nj(a, c, b);
}
};
t.Pr = function(a) {
if (null === a) return '';
var b = this.ij;
if ('' === b) return '';
b = on(a, b);
if (void 0 === b) return '';
if ('string' === typeof b) return b;
C(
'getParentLinkCategoryForNodeData found a non-string category for ' +
a +
': ' +
b,
);
return '';
};
Fr.prototype.getLinkCategoryForData = function(a) {
return this.Pr(a);
};
Fr.prototype.ms = function(a, b) {
if (null !== a) {
var c = this.ij;
if ('' !== c)
if (this.lb(a)) {
var d = on(a, c);
void 0 === d && (d = '');
d !== b &&
(Nj(a, c, b),
ur(this, 'parentLinkCategory', de, c, a, d, b),
'string' === typeof c && this.Ka(a, c));
} else Nj(a, c, b);
}
};
Fr.prototype.setLinkCategoryForData = function(a, b) {
this.ms(a, b);
};
Fr.prototype.copyNodeData = function(a) {
if (null === a) return null;
a = Z.prototype.copyNodeData.call(this, a);
this.Dj ||
'' === this.ze ||
void 0 === on(a, this.ze) ||
Nj(a, this.ze, void 0);
return a;
};
Fr.prototype.setDataProperty = function(a, b, c) {
if (this.lb(a)) {
if (b === this.nodeKeyProperty) {
this.Sl(a, c);
return;
}
if (b === this.nodeCategoryProperty) {
this.Rl(a, c);
return;
}
if (b === this.nodeParentKeyProperty) {
this.ie(a, c);
return;
}
}
var d = on(a, b);
d !== c && (Nj(a, b, c), this.fs(a, b, d, c));
};
t = Fr.prototype;
t.Mo = function(a, b) {
Z.prototype.Mo.call(this, a, b);
for (var c = this.kb.iterator; c.next(); ) this.Zu(c.value, a, b);
};
t.Zu = function(a, b, c) {
if (this.bh(a) === b) {
var d = this.ze;
Nj(a, d, c);
ur(this, 'nodeParentKey', de, d, a, b, c);
'string' === typeof d && this.Ka(a, d);
}
};
t.Nl = function(a) {
Z.prototype.Nl.call(this, a);
a = this.ua(a);
var b = ar(this, a);
if (null !== b) {
var c = Ea();
for (b = b.iterator; b.next(); ) {
var d = b.value;
if (this.lb(d) && this.bh(d) === a) {
var e = this.ze;
ur(this, 'nodeParentKey', de, e, d, a, a);
'string' === typeof e && this.Ka(d, e);
c.push(d);
}
}
for (b = 0; b < c.length; b++) br(this, a, c[b]);
Ga(c);
}
};
t.Ml = function(a) {
Z.prototype.Ml.call(this, a);
var b = this.bh(a);
b = this.Dl(b);
null === this.dc(b) && cr(this, b, a);
};
t.To = function(a) {
Z.prototype.To.call(this, a);
var b = this.bh(a);
br(this, b, a);
};
t.Tl = function(a, b) {
Z.prototype.Tl.call(this, a, b);
this.ms(b, this.Pr(a));
this.ie(b, this.bh(a));
};
t.Bl = function() {
return !0;
};
t.Vr = function() {
return !0;
};
ma.Object.defineProperties(Fr.prototype, {
nodeParentKeyProperty: {
get: function() {
return this.ze;
},
set: function(a) {
var b = this.ze;
b !== a && ((this.ze = a), this.g('nodeParentKeyProperty', b, a));
},
},
Dj: {
get: function() {
return this.vm;
},
set: function(a) {
this.vm !== a && (this.vm = a);
},
},
parentLinkCategoryProperty: {
get: function() {
return this.ij;
},
set: function(a) {
var b = this.ij;
b !== a && ((this.ij = a), this.g('parentLinkCategoryProperty', b, a));
},
},
linkCategoryProperty: {
get: function() {
return this.parentLinkCategoryProperty;
},
set: function(a) {
this.parentLinkCategoryProperty = a;
},
},
type: {
get: function() {
return 'TreeModel';
},
},
});
Fr.prototype.setParentLinkCategoryForNodeData = Fr.prototype.ms;
Fr.prototype.getParentLinkCategoryForNodeData = Fr.prototype.Pr;
Fr.prototype.setParentKeyForNodeData = Fr.prototype.ie;
Fr.prototype.getParentKeyForNodeData = Fr.prototype.bh;
Fr.className = 'TreeModel';
yr.TreeModel = Fr;
function Gr(a) {
qi.call(this);
this.Qv = this.Hm = this.hc = 0;
this.zp = 360;
this.Pv = Hr;
this.Ni = 0;
this.Dv = new I();
this.mp = this.ee = 0;
this.wr = new Ir();
this.Is = this.hj = 0;
this.Zx = 600;
this.In = NaN;
this.km = 1;
this.Un = 0;
this.jl = 360;
this.Nb = Hr;
this.L = Jr;
this.fd = Kr;
this.Zc = zq;
this.gf = 6;
this.un = Lr;
a && Object.assign(this, a);
}
la(Gr, qi);
Gr.prototype.cloneProtected = function(a) {
qi.prototype.cloneProtected.call(this, a);
a.In = this.In;
a.km = this.km;
a.Un = this.Un;
a.jl = this.jl;
a.Nb = this.Nb;
a.L = this.L;
a.fd = this.fd;
a.Zc = this.Zc;
a.gf = this.gf;
a.un = this.un;
};
Gr.prototype.ob = function(a) {
if (a.classType === Gr)
if (a === Mr || a === Nr || a === Or || a === Pr || a === Kr)
this.sorting = a;
else if (a === Qr || a === Rr || a === Jr || a === Sr) this.direction = a;
else if (a === Tr || a === Ur || a === Hr || a === Vr)
this.arrangement = a;
else {
if (a === Wr || a === Lr) this.nodeDiameterFormula = a;
}
else qi.prototype.ob.call(this, a);
};
Gr.prototype.createNetwork = function() {
return new Xr(this);
};
Gr.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.mp;
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 === Vr && k === Wr
? (h = Hr)
: h === Vr && k !== Wr && (h = this.arrangement);
if (
(this.direction === Qr || this.direction === Rr) &&
this.sorting !== Kr
) {
for (k = 0; !(k >= d.length); k += 2) {
a.add(d.K(k));
if (k + 1 >= d.length) break;
c.add(d.K(k + 1));
}
this.direction === Qr
? (this.arrangement === Vr && a.reverse(),
(d = new E()),
d.addAll(a),
d.addAll(c))
: (this.arrangement === Vr && 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 === Jr ? 1 : -1)) / k,
u = d.K(r).diameter;
isNaN(u) && (u = Yr(d.K(r), q));
360 > p && (0 === r || r === d.length - 1) && (u /= 2);
e += u;
f++;
}
if (isNaN(l) || h === Vr) {
isNaN(b) && (b = 6);
if (h !== Hr && h !== Vr) {
f = -Infinity;
for (g = 0; g < k; g++)
(r = d.K(g)),
(e = d.K(g === k - 1 ? 0 : g + 1)),
isNaN(r.diameter) && Yr(r, 0),
isNaN(e.diameter) && Yr(e, 0),
(f = Math.max(f, (r.diameter + e.diameter) / 2));
g = f + b;
h === Tr
? (l = (f + b) / ((2 * Math.PI) / k))
: (l = Zr(
this,
g * (360 <= p ? k : k - 1),
m,
(n * Math.PI) / 180,
(p * Math.PI) / 180,
));
} else
l = Zr(
this,
e + (360 <= p ? k : k - 1) * (h !== Vr ? b : 1.6 * b),
m,
(n * Math.PI) / 180,
(p * Math.PI) / 180,
);
f = l * m;
} else if (
((f = l * m),
(r = $r(this, l, f, (n * Math.PI) / 180, (p * Math.PI) / 180)),
isNaN(b))
) {
if (h === Hr || h === Vr) b = (r - e) / (360 <= p ? k : k - 1);
} else if (h === Hr || h === Vr)
(r = (r - e) / (360 <= p ? k : k - 1)),
r < b
? ((l = Zr(
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.K(e)),
(u = d.K(e === k - 1 ? 0 : e + 1)),
isNaN(q.diameter) && Yr(q, 0),
isNaN(u.diameter) && Yr(u, 0),
(g = Math.max(g, (q.diameter + u.diameter) / 2));
g += b;
e = Zr(
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.Pv = h;
this.hc = l;
this.Hm = m;
this.Qv = n;
this.zp = p;
this.Ni = b;
this.ee = f;
this.mp = g;
b = d;
d = this.Pv;
h = this.hc;
l = this.Qv;
m = this.zp;
n = this.Ni;
p = this.ee;
k = this.mp;
if ((this.direction !== Qr && this.direction !== Rr) || d !== Vr)
if (this.direction === Qr || this.direction === Rr) {
g = 0;
switch (d) {
case Ur:
g = (180 * as(this, h, p, l, k)) / Math.PI;
break;
case Hr:
k = b = 0;
g = a.first();
null !== g && (b = Yr(g, Math.PI / 2));
g = c.first();
null !== g && (k = Yr(g, Math.PI / 2));
g = (180 * as(this, h, p, l, n + (b + k) / 2)) / Math.PI;
break;
case Tr:
g = m / b.length;
}
if (this.direction === Qr) {
switch (d) {
case Ur:
bs(this, a, l, Sr);
break;
case Hr:
cs(this, a, l, Sr);
break;
case Tr:
ds(this, a, m / 2, l, Sr);
}
switch (d) {
case Ur:
bs(this, c, l + g, Jr);
break;
case Hr:
cs(this, c, l + g, Jr);
break;
case Tr:
ds(this, c, m / 2, l + g, Jr);
}
} else {
switch (d) {
case Ur:
bs(this, c, l, Sr);
break;
case Hr:
cs(this, c, l, Sr);
break;
case Tr:
ds(this, c, m / 2, l, Sr);
}
switch (d) {
case Ur:
bs(this, a, l + g, Jr);
break;
case Hr:
cs(this, a, l + g, Jr);
break;
case Tr:
ds(this, a, m / 2, l + g, Jr);
}
}
} else
switch (d) {
case Ur:
bs(this, b, l, this.direction);
break;
case Hr:
cs(this, b, l, this.direction);
break;
case Tr:
ds(this, b, m, l, this.direction);
break;
case Vr:
es(this, b, m, l, this.direction);
}
else es(this, b, m, l - m / 2, Jr);
}
this.updateParts();
this.network = null;
this.isValidLayout = !0;
};
function ds(a, b, c, d, e) {
var f = a.zp,
g = a.hc;
a = a.ee;
d = (d * Math.PI) / 180;
c = (c * Math.PI) / 180;
for (var h = b.length, k = 0; k < h; k++) {
var l = d + (e === Jr ? (k * c) / (360 <= f ? h : h - 1) : -(k * c) / h),
m = b.K(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 cs(a, b, c, d) {
var e = a.hc,
f = a.ee,
g = a.Ni;
c = (c * Math.PI) / 180;
for (var h = b.length, k = 0; k < h; k++) {
var l = b.K(k),
m = b.K(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) && Yr(l, 0);
isNaN(m.diameter) && Yr(m, 0);
l = as(a, e, f, d === Jr ? c : -c, (l.diameter + m.diameter) / 2 + g);
c += d === Jr ? l : -l;
}
}
function bs(a, b, c, d) {
var e = a.hc,
f = a.ee,
g = a.mp;
c = (c * Math.PI) / 180;
for (var h = b.length, k = 0; k < h; k++) {
var l = b.K(k);
l.centerX = e * Math.cos(c);
l.centerY = f * Math.sin(c);
l.actualAngle = (180 * c) / Math.PI;
l = as(a, e, f, d === Jr ? c : -c, g);
c += d === Jr ? l : -l;
}
}
function es(a, b, c, d, e) {
var f = a.zp;
a.hj = 0;
a.wr = new Ir();
if (360 > c) {
for (f = d + (e === Jr ? f : -f); 0 > f; ) f += 360;
f %= 360;
180 < f && (f -= 360);
f *= Math.PI / 180;
a.Is = f;
fs(a, b, c, d, e);
} else gs(a, b, c, d, e);
a.wr.commit(b);
}
function gs(a, b, c, d, e) {
var f = a.hc,
g = a.Ni,
h = a.Hm,
k = f * Math.cos((d * Math.PI) / 180),
l = a.ee * Math.sin((d * Math.PI) / 180),
m = b.Ea();
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 = I.alloc();
for (var n = 0; n < m.length; n++) {
m[n].centerX = k;
m[n].centerY = l;
if (n >= m.length - 1) break;
hs(a, k, l, m, n, e, f) || is(a, k, l, m, n, e, f);
k = f.x;
l = f.y;
}
I.free(f);
a.hj++;
if (!(23 < a.hj)) {
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 === Jr ? 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.wr.compare(g, m);
1 < Math.abs(g) &&
((a.hc =
8 > a.hj
? a.hc - g / (2 * Math.PI)
: 5 > m.length && 10 < g
? a.hc / 2
: a.hc - (0 < g ? 1.7 : -2.3)),
(a.ee = a.hc * h),
gs(a, b, c, d, e));
}
}
}
function fs(a, b, c, d, e) {
for (
var f = a.hc,
g = a.ee,
h = a.Hm,
k = f * Math.cos((d * Math.PI) / 180),
l = g * Math.sin((d * Math.PI) / 180),
m = I.alloc(),
n = b.Ea(),
p = 0;
p < n.length;
p++
) {
n[p].centerX = k;
n[p].centerY = l;
if (p >= n.length - 1) break;
hs(a, k, l, n, p, e, m) || is(a, k, l, n, p, e, m);
k = m.x;
l = m.y;
}
I.free(m);
a.hj++;
if (!(23 < a.hj)) {
k = Math.atan2(l, k);
k = e === Jr ? a.Is - k : k - a.Is;
k = Math.abs(k) < Math.abs(k - 2 * Math.PI) ? k : k - 2 * Math.PI;
f = (k * (f + g)) / 2;
g = a.wr;
if (Math.abs(f) < Math.abs(g.xl))
for (g.xl = f, g.bk = [], g.cm = [], k = 0; k < n.length; k++)
(g.bk[k] = n[k].bounds.x), (g.cm[k] = n[k].bounds.y);
1 < Math.abs(f) &&
((a.hc =
8 > a.hj ? a.hc - f / (2 * Math.PI) : a.hc - (0 < f ? 1.7 : -2.3)),
(a.ee = a.hc * h),
fs(a, b, c, d, e));
}
}
function hs(a, b, c, d, e, f, g) {
var h = a.hc,
k = a.ee,
l = 0;
a = (d[e].width + d[e + 1].width) / 2 + a.Ni;
var m = !1;
if (0 <= c !== (f === Jr)) {
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 is(a, b, c, d, e, f, g) {
var h = a.hc,
k = a.ee,
l = 0;
a = (d[e].height + d[e + 1].height) / 2 + a.Ni;
d = !1;
if (0 <= b !== (f === Jr)) {
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;
}
Gr.prototype.commitLayout = function() {
this.commitNodes();
this.isRouting && this.commitLinks();
};
Gr.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 I(0, 0))
: ((c.x = this.arrangementOrigin.x + this.hc),
(c.y = this.arrangementOrigin.y + this.ee));
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.Za(),
(a = this.group.position.copy()),
(c = this.group.location.copy()),
(b = b.je(c.je(a))),
this.group.move(b),
(this.Dv = b.je(a)));
};
Gr.prototype.commitLinks = function() {
for (var a = this.network.edges.iterator; a.next(); ) a.value.commit();
};
function $r(a, b, c, d, e) {
var f = a.Zx;
if (0.001 > Math.abs(a.Hm - 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 Zr(a, b, c, d, e) {
return b / (void 0 !== d && void 0 !== e ? $r(a, 1, c, d, e) : $r(a, 1, c));
}
function as(a, b, c, d, e) {
if (0.001 > Math.abs(a.Hm - 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;
}
}
Gr.prototype.sort = function(a) {
switch (this.sorting) {
case Or:
break;
case Pr:
a.reverse();
break;
case Mr:
a.sort(this.comparer);
break;
case Nr:
a.sort(this.comparer);
a.reverse();
break;
case Kr:
return this.Vj(js(a));
default:
C('Invalid sorting type.');
}
return a;
};
function js(a) {
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.K(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.K(f));
b[f] = -1;
f = a.K(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]++);
}
return c;
}
Gr.prototype.Vj = function(a) {
for (var b = [], c = 0; c < a.length; c++) {
var d = a.K(c);
b[c] = [];
for (var e, f = d.destinationEdges; f.next(); )
(e = a.indexOf(f.value.toVertex)),
e !== c && 0 > b[c].indexOf(e) && b[c].push(e);
for (d = d.sourceEdges; d.next(); )
(e = a.indexOf(d.value.fromVertex)),
e !== c && 0 > b[c].indexOf(e) && b[c].push(e);
}
f = [];
for (c = 0; c < b.length; c++) f[c] = 0;
c = [];
var g = [],
h = [];
d = [];
e = new E();
for (var k = 0, l = 0; l < b.length; l++) {
var m = b[l].length;
if (1 === m) d.push(l);
else if (0 === m) e.add(a.K(l));
else {
if (0 === k) c.push(l);
else {
for (var n = (m = Infinity), p = -1, r = [], q = 0; q < c.length; q++)
0 > b[c[q]].indexOf(c[q === c.length - 1 ? 0 : q + 1]) &&
r.push(q === c.length - 1 ? 0 : q + 1);
if (0 === r.length) for (q = 0; q < c.length; q++) r.push(q);
for (q = 0; q < r.length; q++) {
for (var u = r[q], w = b[l], v = 0, z = 0; z < g.length; z++) {
var y = f[g[z]],
A = f[h[z]];
if (y < A) {
var B = y;
y = A;
} else B = A;
if (B < u && u <= y)
for (A = 0; A < w.length; A++) {
var F = w[A];
0 > c.indexOf(F) ||
(B < f[F] && f[F] < y) ||
B === f[F] ||
y === f[F] ||
v++;
}
else
for (A = 0; A < w.length; A++)
(F = w[A]),
0 > c.indexOf(F) ||
(B < f[F] && f[F] < y && B !== f[F] && y !== f[F] && v++);
}
w = v;
for (z = v = 0; z < b[l].length; z++)
(B = c.indexOf(b[l][z])),
0 <= B &&
((B = Math.abs(u - (B >= u ? B + 1 : B))),
(v += B < c.length + 1 - B ? B : c.length + 1 - B));
for (z = 0; z < g.length; z++)
(B = f[g[z]]),
(y = f[h[z]]),
B >= u && B++,
y >= u && y++,
B > y && ((A = y), (y = B), (B = A)),
y - B < (c.length + 2) / 2 === (B < u && u <= y) && v++;
if (w < m || (w === m && v < n)) (m = w), (n = v), (p = u);
}
c.splice(p, 0, l);
for (m = 0; m < c.length; m++) f[c[m]] = m;
for (m = 0; m < b[l].length; m++)
(n = b[l][m]), 0 <= c.indexOf(n) && (g.push(l), h.push(n));
}
k++;
}
}
for (g = c.length; ; ) {
f = !0;
for (h = 0; h < d.length; h++)
if (((k = d[h]), (l = b[k][0]), (m = c.indexOf(l)), 0 <= m)) {
for (p = n = 0; p < b[l].length; p++)
(r = c.indexOf(b[l][p])),
0 > r ||
r === m ||
((q = r > m ? r - m : m - r),
(n += r < m !== q > g - q ? 1 : -1));
c.splice(0 > n ? m : m + 1, 0, k);
d.splice(h, 1);
h--;
} else f = !1;
if (f) break;
else c.push(d[0]), d.splice(0, 1);
}
for (b = 0; b < c.length; b++) e.add(a.K(c[b]));
return e;
};
ma.Object.defineProperties(Gr.prototype, {
radius: {
get: function() {
return this.In;
},
set: function(a) {
this.In !== a && (0 < a || isNaN(a)) && ((this.In = a), this.D());
},
},
aspectRatio: {
get: function() {
return this.km;
},
set: function(a) {
this.km !== a && 0 < a && ((this.km = a), this.D());
},
},
startAngle: {
get: function() {
return this.Un;
},
set: function(a) {
this.Un !== a && ((this.Un = a), this.D());
},
},
sweepAngle: {
get: function() {
return this.jl;
},
set: function(a) {
this.jl !== a &&
(0 < a && 360 >= a ? (this.jl = a) : (this.jl = 360), this.D());
},
},
arrangement: {
get: function() {
return this.Nb;
},
set: function(a) {
this.Nb === a ||
(a !== Vr && a !== Hr && a !== Ur && a !== Tr) ||
((this.Nb = a), this.D());
},
},
direction: {
get: function() {
return this.L;
},
set: function(a) {
this.L === a ||
(a !== Jr && a !== Sr && a !== Qr && a !== Rr) ||
((this.L = a), this.D());
},
},
sorting: {
get: function() {
return this.fd;
},
set: function(a) {
this.fd === a ||
(a !== Or && a !== Pr && a !== Mr && !Nr && a !== Kr) ||
((this.fd = a), this.D());
},
},
comparer: {
get: function() {
return this.Zc;
},
set: function(a) {
this.Zc !== a && ((this.Zc = a), this.D());
},
},
spacing: {
get: function() {
return this.gf;
},
set: function(a) {
this.gf !== a && ((this.gf = a), this.D());
},
},
nodeDiameterFormula: {
get: function() {
return this.un;
},
set: function(a) {
this.un === a || (a !== Lr && a !== Wr) || ((this.un = a), this.D());
},
},
actualXRadius: {
get: function() {
return this.hc;
},
},
actualYRadius: {
get: function() {
return this.ee;
},
},
actualSpacing: {
get: function() {
return this.Ni;
},
},
actualCenter: {
get: function() {
return this.Dv;
},
},
});
var Hr = new D(Gr, 'ConstantSpacing', 0),
Ur = new D(Gr, 'ConstantDistance', 1),
Tr = new D(Gr, 'ConstantAngle', 2),
Vr = new D(Gr, 'Packed', 3),
Jr = new D(Gr, 'Clockwise', 4),
Sr = new D(Gr, 'Counterclockwise', 5),
Qr = new D(Gr, 'BidirectionalLeft', 6),
Rr = new D(Gr, 'BidirectionalRight', 7),
Or = new D(Gr, 'Forwards', 8),
Pr = new D(Gr, 'Reverse', 9),
Mr = new D(Gr, 'Ascending', 10),
Nr = new D(Gr, 'Descending', 11),
Kr = new D(Gr, 'Optimized', 12),
Lr = new D(Gr, 'Pythagorean', 13),
Wr = new D(Gr, 'Circular', 14);
Gr.className = 'CircularLayout';
Gr.ConstantSpacing = Hr;
Gr.ConstantDistance = Ur;
Gr.ConstantAngle = Tr;
Gr.Packed = Vr;
Gr.Clockwise = Jr;
Gr.Counterclockwise = Sr;
Gr.BidirectionalLeft = Qr;
Gr.BidirectionalRight = Rr;
Gr.Forwards = Or;
Gr.Reverse = Pr;
Gr.Ascending = Mr;
Gr.Descending = Nr;
Gr.Optimized = Kr;
Gr.Pythagorean = Lr;
Gr.Circular = Wr;
function Ir() {
this.xl = -Infinity;
this.cm = this.bk = null;
}
Ir.prototype.compare = function(a, b) {
if (
(0 < a && 0 > this.xl) ||
(Math.abs(a) < Math.abs(this.xl) && !(0 > a && 0 < this.xl))
)
for (this.xl = a, this.bk = [], this.cm = [], a = 0; a < b.length; a++)
(this.bk[a] = b[a].bounds.x), (this.cm[a] = b[a].bounds.y);
};
Ir.prototype.commit = function(a) {
if (null !== this.bk && null !== this.cm)
for (var b = 0; b < this.bk.length; b++) {
var c = a.K(b);
c.x = this.bk[b];
c.y = this.cm[b];
}
};
Ir.className = 'VertexArrangement';
function Xr(a) {
eq.call(this, a);
}
la(Xr, eq);
Xr.prototype.createVertex = function() {
return new ks(this);
};
Xr.prototype.createEdge = function() {
return new ls(this);
};
Xr.className = 'CircularNetwork';
function ks(a) {
sq.call(this, a);
this.u = this.Mi = NaN;
}
la(ks, sq);
function Yr(a, b) {
var c = a.network;
if (null === c) return NaN;
c = c.layout;
if (null === c) return NaN;
if (c.arrangement === Vr)
if (c.nodeDiameterFormula === Wr) a.Mi = 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.Mi = Math.min(a.height / c, a.width / b);
}
else
a.Mi =
c.nodeDiameterFormula === Wr
? Math.max(a.width, a.height)
: Math.sqrt(a.width * a.width + a.height * a.height);
return a.Mi;
}
ma.Object.defineProperties(ks.prototype, {
diameter: {
get: function() {
return this.Mi;
},
set: function(a) {
this.Mi !== a && (this.Mi = a);
},
},
actualAngle: {
get: function() {
return this.u;
},
set: function(a) {
this.u !== a && (this.u = a);
},
},
});
ks.className = 'CircularVertex';
function ls(a) {
tq.call(this, a);
}
la(ls, tq);
ls.className = 'CircularEdge';
function ms(a) {
qi.call(this);
this.Sg = null;
this.gn = 0;
this.Td = new K(100, 100).freeze();
this.jm = !1;
this.ff = !0;
this.od = !1;
this.Tk = 100;
this.Im = 1;
this.Pf = 1e3;
this.pn = 10;
this.Jn = Math;
this.vk = 0.05;
this.uk = 50;
this.sk = 150;
this.tk = 0;
this.Dm = 10;
this.Cm = 5;
a && Object.assign(this, a);
}
la(ms, qi);
ms.prototype.cloneProtected = function(a) {
qi.prototype.cloneProtected.call(this, a);
a.Td.assign(this.Td);
a.jm = this.jm;
a.ff = this.ff;
a.od = this.od;
a.Tk = this.Tk;
a.Im = this.Im;
a.Pf = this.Pf;
a.pn = this.pn;
a.Jn = this.Jn;
a.vk = this.vk;
a.uk = this.uk;
a.sk = this.sk;
a.tk = this.tk;
a.Dm = this.Dm;
a.Cm = this.Cm;
};
ms.prototype.serializeLayoutProperties = function(a, b) {
qi.prototype.serializeLayoutProperties.call(this, a, b);
a.arrangementSpacing = {
width: this.arrangementSpacing.width,
height: this.arrangementSpacing.height,
};
a.arrangesToOrigin = this.arrangesToOrigin;
a.setsPortSpots = this.setsPortSpots;
a.comments = this.comments;
a.maxIterations = this.maxIterations;
a.epsilonDistance = this.epsilonDistance;
a.infinityDistance = this.infinityDistance;
a.moveLimit = this.moveLimit;
a.defaultSpringStiffness = this.defaultSpringStiffness;
a.defaultSpringLength = this.defaultSpringLength;
a.defaultElectricalCharge = this.defaultElectricalCharge;
a.defaultGravitationalMass = this.defaultGravitationalMass;
a.defaultCommentSpringLength = this.defaultCommentSpringLength;
a.defaultCommentElectricalCharge = this.defaultCommentElectricalCharge;
};
ms.prototype.deserializeLayoutProperties = function(a, b, c, d, e) {
qi.prototype.deserializeLayoutProperties.call(this, a, b, c, d, e);
this.arrangementSpacing = new K(
a.arrangementSpacing.width,
a.arrangementSpacing.height,
);
this.arrangesToOrigin = a.arrangesToOrigin;
this.setsPortSpots = a.setsPortSpots;
this.comments = a.comments;
this.maxIterations = a.maxIterations;
this.epsilonDistance = a.epsilonDistance;
this.infinityDistance = a.infinityDistance;
this.moveLimit = a.moveLimit;
this.defaultSpringStiffness = a.defaultSpringStiffness;
this.defaultSpringLength = a.defaultSpringLength;
this.defaultElectricalCharge = a.defaultElectricalCharge;
this.defaultGravitationalMass = a.defaultGravitationalMass;
this.defaultCommentSpringLength = a.defaultCommentSpringLength;
this.defaultCommentElectricalCharge = a.defaultCommentElectricalCharge;
};
ms.prototype.createNetwork = function() {
return new ns(this);
};
ms.prototype.doLayout = function(a) {
null === this.network && (this.network = this.makeNetwork(a));
if (!this.qv()) {
a = this.maxIterations;
if (0 < this.network.vertexes.count) {
this.network.oo();
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.gn = 0;
if (this.needsClusterLayout()) {
b = this.network;
c = b.Ix();
for (var d = c.iterator; d.next(); ) {
this.network = d.value;
for (var e = this.network.vertexes.iterator; e.next(); ) {
var f = e.value;
f.Nd = f.vertexes.count;
f.hh = 1;
f.Bj = null;
f.Ke = null;
}
os(this, 0, a);
}
this.network = b;
var g = (d = c.iterator);
d = this.arrangementSpacing;
var h = g.count,
k = !0;
f = e = 0;
for (var l = Ea(), m = 0; m < h + b.vertexes.count + 2; m++)
l[m] = null;
h = 0;
g.reset();
for (var n = M.alloc(); g.next(); )
if (((m = g.value), this.computeBounds(m, n), k))
(k = !1),
(e = n.x + n.width / 2),
(f = n.y + n.height / 2),
(l[0] = new I(n.x + n.width + d.width, n.y)),
(l[1] = new I(n.x, n.y + n.height + d.height)),
(h = 2);
else {
var p = ps(l, h, e, f, n.width, n.height, d),
r = l[p],
q = new I(r.x + n.width + d.width, r.y),
u = new I(r.x, r.y + n.height + d.height);
p + 1 < h && l.splice(p + 1, 0, null);
l[p] = q;
l[p + 1] = u;
h++;
p = r.x - n.x;
r = r.y - n.y;
for (m = m.vertexes.iterator; m.next(); )
(q = m.value), (q.centerX += p), (q.centerY += r);
}
M.free(n);
for (m = b.vertexes.iterator; m.next(); )
(g = m.value),
(p = g.bounds),
2 > h
? ((e = p.x + p.width / 2),
(f = p.y + p.height / 2),
(l[0] = new I(p.x + p.width + d.width, p.y)),
(l[1] = new I(p.x, p.y + p.height + d.height)),
(h = 2))
: ((k = ps(l, h, e, f, p.width, p.height, d)),
(n = l[k]),
(r = new I(n.x + p.width + d.width, n.y)),
(p = new I(n.x, n.y + p.height + d.height)),
k + 1 < h && l.splice(k + 1, 0, null),
(l[k] = r),
(l[k + 1] = p),
h++,
(g.centerX = n.x + g.width / 2),
(g.centerY = n.y + g.height / 2));
Ga(l);
for (d = c.iterator; d.next(); ) {
c = d.value;
for (e = c.vertexes.iterator; e.next(); ) b.fg(e.value);
for (c = c.edges.iterator; c.next(); ) b.ol(c.value);
}
}
qs(this, a);
this.updateParts();
}
this.Tk = a;
this.network = null;
this.isValidLayout = !0;
}
};
ms.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.Sc(c) && (a++, 2 < a)) return !0;
if (10 < b) break;
b++;
}
return !1;
};
ms.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.Xc(d.bounds);
}
return b;
};
function os(a, b, c) {
if (rs(a, b)) {
var d = a.Pf;
a.Pf *= 1 + 1 / (b + 1);
var e = ss(a, b),
f = Math.max(
0,
Math.max(Math.min(a.network.vertexes.count, (c * (b + 1)) / 11), 10),
);
a.maxIterations += f;
os(a, b + 1, c);
qs(a, f);
ts(a, e);
b = e.vertexes.Ea();
b.sort(function(a, b) {
return null === a || null === b || a === b ? 0 : b.Nd - a.Nd;
});
for (c = 0; c < b.length; c++) us(a, b[c]);
a.Pf = d;
}
}
function rs(a, b) {
if (10 < b || 3 > a.network.vertexes.count) return !1;
a.Sg = a.network.vertexes.Ea();
a = a.Sg;
a.sort(function(a, b) {
return null === a || null === b || a === b ? 0 : b.Nd - a.Nd;
});
for (b = a.length - 1; 0 <= b && 1 >= a[b].Nd; ) b--;
return 1 < a.length - b;
}
function ss(a, b) {
for (var c = a.network, d = new ns(a), e = 0; e < a.Sg.length; e++) {
var f = a.Sg[e];
if (1 < f.Nd) {
d.fg(f);
var g = new vs();
g.ts = f.Nd;
g.us = f.width;
g.ss = f.height;
g.wv = f.focus.x;
g.xv = f.focus.y;
null === f.Ke && (f.Ke = new E());
f.Ke.add(g);
f.av = f.Ke.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.ol(h)
: e.network === d
? ((h = e.Bj),
null === h && ((h = new E()), (e.Bj = h)),
h.add(g),
e.Nd--,
(e.hh += g.hh))
: g.network === d &&
((h = g.Bj),
null === h && ((h = new E()), (g.Bj = h)),
h.add(e),
g.Nd--,
(g.hh += e.hh));
}
for (e = d.edges.iterator; e.next(); )
(f = e.value),
(f.length *= Math.max(
1,
J.sqrt((f.fromVertex.hh + f.toVertex.hh) / (4 * b + 1)),
));
for (b = d.vertexes.iterator; b.next(); ) {
e = b.value;
var k = e.Bj;
if (
null !== k &&
0 < k.count &&
((g = e.Ke.K(e.Ke.count - 1).ts - e.Nd), !(0 >= g))
) {
for (var l = (h = 0), m = k.count - g; m < k.count; m++) {
var n = k.K(m),
p = null;
for (f = n.edges.iterator; f.next(); ) {
var r = f.value;
if (r.bx(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 = J.sqrt((h + r + (l * l * 4) / (g * g)) / r);
g = ((h - 1) * m) / 2;
h = ((h - 1) * n) / 2;
e.bounds = new M(f - p.x - g, k - p.y - h, m + 2 * g, n + 2 * h);
e.focus = new I(p.x + g, p.y + h);
}
}
a.network = d;
return c;
}
function ts(a, b) {
for (var c = a.network.vertexes.iterator; c.next(); ) {
var d = c.value;
d.network = b;
if (null !== d.Ke) {
var e = d.Ke.K(d.av);
d.Nd = e.ts;
var f = e.wv,
g = e.xv;
d.bounds = new M(d.centerX - f, d.centerY - g, e.us, e.ss);
d.focus = new I(f, g);
d.av--;
}
}
for (c = a.network.edges.iterator; c.next(); ) c.value.network = b;
a.network = b;
}
function us(a, b) {
var c = b.Bj;
if (null !== c && 0 !== c.count) {
var d = b.centerX,
e = b.centerY,
f = b.width,
g = b.height;
null !== b.Ke &&
0 < b.Ke.count &&
((g = b.Ke.K(0)), (f = g.us), (g = g.ss));
f = J.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.Nd
? 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.Nd || a.isFixed(k)))) {
m = null;
for (n = k.edges.iterator; n.next(); ) {
m = n.value;
break;
}
n = k.width;
var p = k.height;
n = J.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 ps(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;
}
ms.prototype.ju = function() {
if (this.comments)
for (var a = this.network.vertexes.iterator; a.next(); )
this.addComments(a.value);
};
ms.prototype.addComments = function(a) {
var b = a.node;
if (null !== b)
for (b = b.wu(); b.next(); ) {
var c = b.value;
if ('Comment' === c.category && c.isVisible()) {
var d = this.network.ei(c);
null === d && (d = this.network.yj(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.Qj(a, d, null));
c.length = this.defaultCommentSpringLength;
}
}
};
function ws(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), J.sqrt(c * c + a * a))
: a + c < b
? ((d = d + e - g), (a = a + c - b), J.sqrt(d * d + a * a))
: g - (d + e)
: d > g + h
? a > b + f
? ((c = d - g - h), (a = a - b - f), J.sqrt(c * c + a * a))
: a + c < b
? ((d = d - g - h), (a = a + c - b), J.sqrt(d * d + a * a))
: d - (g + h)
: a > b + f
? a - (b + f)
: a + c < b
? b - (a + c)
: 0.1;
}
function qs(a, b) {
a.Sg = null;
for (b = a.gn + b; a.gn < b && (a.gn++, xs(a)); );
a.Sg = null;
}
function xs(a) {
null === a.Sg && (a.Sg = a.network.vertexes.Ea());
var b = a.Sg;
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.Pf;
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 = ws(g, p);
1 > q
? ((d = a.randomNumberGenerator),
null === d && (a.randomNumberGenerator = d = new ys()),
(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 = ws(c, f)),
1 > n
? ((n = a.randomNumberGenerator),
null === n && (a.randomNumberGenerator = n = new ys()),
(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);
for (e = d = 0; e < b.length; e++)
(c = b[e]),
a.isFixed(c)
? a.moveFixedVertex(c)
: (d = Math.max(d, a.moveVertex(c) || 0));
return d > a.epsilonDistance * a.epsilonDistance;
}
ms.prototype.moveVertex = function(a) {
var b = a.forceX,
c = a.forceY,
d = this.moveLimit;
b < -d ? (b = -d) : b > d && (b = d);
c < -d ? (c = -d) : c > d && (c = d);
a.centerX += b;
a.centerY += c;
return b * b + c * c;
};
ms.prototype.moveFixedVertex = function() {};
ms.prototype.commitLayout = function() {
this.ev();
this.commitNodes();
this.isRouting && this.commitLinks();
};
ms.prototype.ev = function() {
if (this.setsPortSpots)
for (var a = this.network.edges.iterator; a.next(); ) {
var b = a.value.link;
null !== b && ((b.fromSpot = Wc), (b.toSpot = Wc));
}
};
ms.prototype.commitNodes = function() {
var a = 0,
b = 0;
if (this.arrangesToOrigin) {
var c = M.alloc();
this.computeBounds(this.network, c);
b = this.arrangementOrigin;
a = b.x - c.x;
b = b.y - c.y;
M.free(c);
}
c = M.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();
}
M.free(c);
};
ms.prototype.commitLinks = function() {
for (var a = this.network.edges.iterator; a.next(); ) a.value.commit();
};
ms.prototype.springStiffness = function(a) {
a = a.stiffness;
return isNaN(a) ? this.vk : a;
};
ms.prototype.springLength = function(a) {
a = a.length;
return isNaN(a) ? this.uk : a;
};
ms.prototype.electricalCharge = function(a) {
a = a.charge;
return isNaN(a) ? this.sk : a;
};
ms.prototype.electricalFieldX = function() {
return 0;
};
ms.prototype.electricalFieldY = function() {
return 0;
};
ms.prototype.gravitationalMass = function(a) {
a = a.mass;
return isNaN(a) ? this.tk : a;
};
ms.prototype.gravitationalFieldX = function() {
return 0;
};
ms.prototype.gravitationalFieldY = function() {
return 0;
};
ms.prototype.isFixed = function(a) {
return a.isFixed;
};
ma.Object.defineProperties(ms.prototype, {
currentIteration: {
get: function() {
return this.gn;
},
},
arrangementSpacing: {
get: function() {
return this.Td;
},
set: function(a) {
this.Td.C(a) || (this.Td.assign(a), this.D());
},
},
arrangesToOrigin: {
get: function() {
return this.jm;
},
set: function(a) {
this.jm !== a && ((this.jm = a), this.D());
},
},
setsPortSpots: {
get: function() {
return this.ff;
},
set: function(a) {
this.ff !== a && ((this.ff = a), this.D());
},
},
comments: {
get: function() {
return this.od;
},
set: function(a) {
this.od !== a && ((this.od = a), this.D());
},
},
maxIterations: {
get: function() {
return this.Tk;
},
set: function(a) {
this.Tk !== a && 0 <= a && ((this.Tk = a), this.D());
},
},
epsilonDistance: {
get: function() {
return this.Im;
},
set: function(a) {
this.Im !== a && 0 < a && ((this.Im = a), this.D());
},
},
infinityDistance: {
get: function() {
return this.Pf;
},
set: function(a) {
this.Pf !== a && 1 < a && ((this.Pf = a), this.D());
},
},
moveLimit: {
get: function() {
return this.pn;
},
set: function(a) {
this.pn !== a && 1 < a && ((this.pn = a), this.D());
},
},
randomNumberGenerator: {
get: function() {
return this.Jn;
},
set: function(a) {
this.Jn !== a &&
(null !== a &&
'function' !== typeof a.random &&
C(
'ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: ' +
a,
),
(this.Jn = a));
},
},
defaultSpringStiffness: {
get: function() {
return this.vk;
},
set: function(a) {
this.vk !== a && ((this.vk = a), this.D());
},
},
defaultSpringLength: {
get: function() {
return this.uk;
},
set: function(a) {
this.uk !== a && ((this.uk = a), this.D());
},
},
defaultElectricalCharge: {
get: function() {
return this.sk;
},
set: function(a) {
this.sk !== a && ((this.sk = a), this.D());
},
},
defaultGravitationalMass: {
get: function() {
return this.tk;
},
set: function(a) {
this.tk !== a && ((this.tk = a), this.D());
},
},
defaultCommentSpringLength: {
get: function() {
return this.Dm;
},
set: function(a) {
this.Dm !== a && ((this.Dm = a), this.D());
},
},
defaultCommentElectricalCharge: {
get: function() {
return this.Cm;
},
set: function(a) {
this.Cm !== a && ((this.Cm = a), this.D());
},
},
});
ms.className = 'ForceDirectedLayout';
function vs() {
this.xv = this.wv = this.ss = this.us = this.ts = 0;
}
vs.className = 'ForceDirectedSubnet';
function ns(a) {
eq.call(this, a);
}
la(ns, eq);
ns.prototype.createVertex = function() {
return new zs(this);
};
ns.prototype.createEdge = function() {
return new As(this);
};
ns.className = 'ForceDirectedNetwork';
function zs(a) {
sq.call(this, a);
this.ga = !1;
this.Ga = this.u = NaN;
this.hh = this.Nd = this.W = this.F = 0;
this.Ke = this.Bj = null;
this.av = 0;
}
la(zs, sq);
zs.prototype.serializeVertexProperties = function(a, b) {
sq.prototype.serializeVertexProperties.call(this, a, b);
a.isFixed = this.isFixed;
a.charge = this.charge;
a.mass = this.mass;
};
zs.prototype.deserializeVertexProperties = function(a, b, c, d) {
sq.prototype.deserializeVertexProperties.call(this, a, b, c, d);
this.isFixed = a.isFixed;
this.charge = a.charge;
this.mass = a.mass;
};
ma.Object.defineProperties(zs.prototype, {
isFixed: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga !== a && (this.ga = a);
},
},
charge: {
get: function() {
return this.u;
},
set: function(a) {
this.u !== a && (this.u = a);
},
},
mass: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga !== a && (this.Ga = a);
},
},
forceX: {
get: function() {
return this.F;
},
set: function(a) {
this.F !== a && (this.F = a);
},
},
forceY: {
get: function() {
return this.W;
},
set: function(a) {
this.W !== a && (this.W = a);
},
},
});
zs.className = 'ForceDirectedVertex';
function As(a) {
tq.call(this, a);
this.j = this.m = NaN;
}
la(As, tq);
As.prototype.serializeEdgeProperties = function(a, b) {
tq.prototype.serializeEdgeProperties.call(this, a, b);
a.stiffness = this.stiffness;
a.length = this.length;
};
As.prototype.deserializeEdgeProperties = function(a, b, c, d) {
tq.prototype.deserializeEdgeProperties.call(this, a, b, c, d);
this.stiffness = a.stiffness;
this.length = a.length;
};
ma.Object.defineProperties(As.prototype, {
stiffness: {
get: function() {
return this.m;
},
set: function(a) {
this.m !== a && (this.m = a);
},
},
length: {
get: function() {
return this.j;
},
set: function(a) {
this.j !== a && (this.j = a);
},
},
});
As.className = 'ForceDirectedEdge';
function ys() {
var a = 0;
void 0 === a && (a = 42);
this.seed = a;
this.Kx = 48271;
this.Mx = 2147483647;
this.Q = 44488.07041494893;
this.Nx = 3399;
this.Lx = 1 / 2147483647;
this.random();
}
ys.prototype.random = function() {
var a = (this.seed % this.Q) * this.Kx - (this.seed / this.Q) * this.Nx;
0 < a ? (this.seed = a) : (this.seed = a + this.Mx);
return this.seed * this.Lx;
};
ys.className = 'RandomNumberGenerator';
function Bs(a) {
qi.call(this);
this.gc = this.be = 25;
this.L = 0;
this.rk = Cs;
this.Ok = Ds;
this.Fk = Es;
this.Xi = 4;
this.ek = Fs;
this.Tf = 15;
this.ff = !0;
this.jn = 4;
this.Ja = this.Dh = this.wa = -1;
this.zc = this.Bg = 0;
this.Qa = this.Bd = this.Cd = this.ae = this.Hb = null;
this.Cg = 0;
this.qn = this.fj = null;
this.Lc = 0;
this.rn = null;
this.Yc = new I();
this.we = [];
this.we.length = 100;
a && Object.assign(this, a);
}
la(Bs, qi);
Bs.prototype.cloneProtected = function(a) {
qi.prototype.cloneProtected.call(this, a);
a.be = this.be;
a.gc = this.gc;
a.L = this.L;
a.rk = this.rk;
a.Ok = this.Ok;
a.Fk = this.Fk;
a.Xi = this.Xi;
a.ek = this.ek;
a.Tf = this.Tf;
a.ff = this.ff;
a.jn = this.jn;
};
Bs.prototype.serializeLayoutProperties = function(a, b) {
qi.prototype.serializeLayoutProperties.call(this, a, b);
a.layerSpacing = this.layerSpacing;
a.columnSpacing = this.columnSpacing;
a.direction = this.direction;
a.cycleRemoveOption = this.cycleRemoveOption.name;
a.layeringOption = this.layeringOption.name;
a.initializeOption = this.initializeOption.name;
a.iterations = this.iterations;
a.aggressiveOption = this.aggressiveOption.name;
a.packOption = this.packOption;
a.setsPortSpots = this.setsPortSpots;
a.linkSpacing = this.linkSpacing;
a.wa = this.wa;
a.Dh = this.Dh;
a.Ja = this.Ja;
a.Bg = this.Bg;
a.zc = this.zc;
a.Hb = this.Hb;
a.Cg = this.Cg;
a.Lc = this.Lc;
a.Yc = {
x: this.Yc.x,
y: this.Yc.y,
};
};
Bs.prototype.deserializeLayoutProperties = function(a, b, c, d, e) {
qi.prototype.deserializeLayoutProperties.call(this, a, b, c, d, e);
this.layerSpacing = a.layerSpacing;
this.columnSpacing = a.columnSpacing;
this.direction = a.direction;
this.cycleRemoveOption = Sa(Bs, a.cycleRemoveOption);
this.layeringOption = Sa(Bs, a.layeringOption);
this.initializeOption = Sa(Bs, a.initializeOption);
this.iterations = a.iterations;
this.aggressiveOption = Sa(Bs, a.aggressiveOption);
this.packOption = a.packOption;
this.setsPortSpots = a.setsPortSpots;
this.linkSpacing = a.linkSpacing;
this.wa = a.wa;
this.Dh = a.Dh;
this.Ja = a.Ja;
this.Bg = a.Bg;
this.zc = a.zc;
this.Hb = a.Hb;
this.Cg = a.Cg;
this.Lc = a.Lc;
this.Yc = new I(this.Yc.x, this.Yc.y);
e &&
!d &&
e.edges.each(function(a) {
if (
!a.link &&
a.fromVertex &&
a.toVertex &&
(null === a.fromVertex.node || null === a.toVertex.node)
) {
for (
var b = a.fromVertex;
null !== b && null === b.node && 0 < b.wd.count;
) {
var c = b.wd.K(0);
if (c.link) {
a.link = c.link;
break;
}
b = c.fromVertex;
}
if (!a.link) {
for (
c = a.toVertex;
null !== c && null === c.node && 0 < c.Jd.count;
) {
var d = c.Jd.K(0);
if (d.link) {
a.link = d.link;
break;
}
c = d.toVertex;
}
if (!a.link)
for (c = c.wd.iterator; c.next(); )
if (((d = c.value), d.link && d.fromVertex === b)) {
a.link = d.link;
break;
}
}
}
});
};
Bs.prototype.ob = function(a) {
a.classType === Bs
? 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)
: C('Unknown enum value: ' + a)
: qi.prototype.ob.call(this, a);
};
Bs.prototype.createNetwork = function() {
return new Gs(this);
};
Bs.prototype.doLayout = function(a) {
null === this.network && (this.network = this.makeNetwork(a));
this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
this.Dh = -1;
this.zc = this.Bg = 0;
this.rn = this.qn = this.fj = null;
for (a = 0; a < this.we.length; a++) this.we[a] = null;
if (0 < this.network.vertexes.count) {
this.network.oo();
if (this.qv()) return;
this.cycleRemoveOption !== Hs && this.removeCycles();
for (a = this.network.vertexes.iterator; a.next(); ) a.value.layer = -1;
this.wa = -1;
this.assignLayers();
for (a.reset(); a.next(); ) this.wa = Math.max(this.wa, a.value.layer);
this.cycleRemoveOption === Hs && 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 === e.data) ||
(null === f.node && null === f.data)) &&
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 = I.alloc();
m !== n
? u.v() && n.isVisible()
? n.actualBounds.v()
? (Go(n, p, yc, r),
(r.x += n.actualBounds.x - u.x),
(r.y += n.actualBounds.y - u.y))
: (Go(n, p, yc, r), r.v() || r.assign(q))
: r.assign(q)
: u.v()
? (Go(n, p, yc, r), r.v() || r.assign(q))
: r.assign(q);
n = d.rev ? e.bounds : f.bounds;
m = I.alloc();
g !== k
? n.v() && k.isVisible()
? k.actualBounds.v()
? (Go(k, h, yc, m),
(m.x += k.actualBounds.x - n.x),
(m.y += k.actualBounds.y - n.y))
: (Go(k, h, yc, m), m.v() || m.assign(l))
: m.assign(l)
: n.v()
? (Go(k, h, yc, m), m.v() || m.assign(l))
: m.assign(l);
90 === this.L || 270 === this.L
? ((g = Math.round((r.x - q.x) / this.gc)),
(k = r.x),
(h = Math.round((m.x - l.x) / this.gc)),
(l = m.x))
: ((g = Math.round((r.y - q.y) / this.gc)),
(k = r.y),
(h = Math.round((m.y - l.y) / this.gc)),
(l = m.y));
I.free(r);
I.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 w = u.fromPort,
v = u.toPort;
if (null !== w && null !== v) {
var z = u.fromNode;
p = u.toNode;
if (null !== z && null !== p) {
var y = Is(this, !0),
A = Is(this, !1),
B = this.setsPortSpots ? y : u.computeSpot(!0, w);
q = this.setsPortSpots ? A : u.computeSpot(!1, v);
var F = u.isOrthogonal;
B.Uc() && B.xf(A) && q.Uc() && q.xf(y)
? (n = 0)
: ((y = u.getLinkPoint(z, w, B, !0, F, p, v, I.alloc())),
(A = u.getLinkDirection(z, w, y, B, !0, F, p, v)),
I.free(y),
B.Wr() || A !== Js(this, d, !0)
? this.setsPortSpots &&
null !== z &&
1 === z.ports.count &&
d.rev &&
(n += 1)
: (n += 1),
(B = u.getLinkPoint(p, v, q, !1, F, z, w, I.alloc())),
(u = u.getLinkDirection(p, v, B, q, !1, F, z, w)),
I.free(B),
q.Wr() || u !== Js(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.nf = 1),
(q.layer = r),
(q.near = e),
a.fg(q),
(e = a.Qj(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.nf = 2;
q.layer = r - 1;
a.fg(q);
e = a.Qj(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.nf = 3),
(q.layer = r - 1),
a.fg(q),
(e = a.Qj(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.Qj(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.Hb = [];
for (b = 0; b <= this.wa; b++) a[b] = 0;
for (b = this.network.vertexes.iterator; b.next(); ) b.value.index = -1;
this.initializeIndices();
this.Dh = -1;
for (c = this.zc = this.Bg = 0; c <= this.wa; c++)
a[c] > a[this.zc] && ((this.Dh = a[c] - 1), (this.zc = c)),
a[c] < a[this.Bg] && (this.Bg = c);
this.rn = [];
for (c = 0; c < a.length; c++) this.rn[c] = [];
for (b.reset(); b.next(); )
(a = b.value), (this.rn[a.layer][a.index] = a);
this.Ja = -1;
for (a = 0; a <= this.wa; a++) {
b = Ks(this, a);
c = 0;
d = this.Hb[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.Ja = Math.max(this.Ja, c - 1);
Ls(this, a, b);
}
this.reduceCrossings();
this.straightenAndPack();
this.updateParts();
}
this.network = null;
this.isValidLayout = !0;
};
Bs.prototype.linkMinLength = function() {
return 1;
};
function Ms(a) {
var b = a.fromVertex.node || a.fromVertex.data;
a = a.toVertex.node || a.toVertex.data;
return null === b && null === a ? 8 : null === b || null === a ? 4 : 1;
}
Bs.prototype.nodeMinLayerSpace = function(a, b) {
return null === a.node && null === a.data
? 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;
};
Bs.prototype.nodeMinColumnSpace = function(a, b) {
if (null === a.node && null === a.data) return 0;
var c = b ? a.Uj : a.Tj;
if (null !== c) return c;
c = this.L;
return 90 === c || 270 === c
? b
? (a.Uj = (a.focus.x / this.gc + 1) | 0)
: (a.Tj = ((a.bounds.width - a.focus.x) / this.gc + 1) | 0)
: b
? (a.Uj = (a.focus.y / this.gc + 1) | 0)
: (a.Tj = ((a.bounds.height - a.focus.y) / this.gc + 1) | 0);
};
function Ns(a) {
null === a.fj && (a.fj = []);
for (var b = 0, c = a.network.vertexes.iterator; c.next(); ) {
var d = c.value;
a.fj[b] = d.layer;
b++;
a.fj[b] = d.column;
b++;
a.fj[b] = d.index;
b++;
}
return a.fj;
}
function Os(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 Ps(a, b, c) {
var d = Ks(a, b),
e = a.Hb[b];
if (null === a.qn || a.qn.length < e * e) a.qn = [];
for (var f = a.qn, 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.nf === l.nf) || h++;
}
else
for (m = g - 1; m > k; m--)
(n = d[m]), (n.near === l && n.nf === l.nf) || 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 w = q.portToPos;
q = q.portFromPos;
m < w && (n > u || (n === u && r > q)) && h++;
w < 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),
(w = q.portToPos),
(q = q.portFromPos),
r < q && (n > u || (n === u && m > w)) && h++,
q < r && (u > n || (u === n && w > m)) && h++);
f[g * e + g] = h;
for (k = g + 1; k < e; k++) {
var v = 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)) && v++);
}
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),
(w = q.portToPos),
(n < u || (n === u && m < w)) && z++,
(u < n || (u === n && w < m)) && v++);
f[g * e + k] = v;
f[k * e + g] = z;
}
}
Ls(a, b, d);
return f;
}
Bs.prototype.countCrossings = function() {
for (var a = 0, b = 0; b <= this.wa; b++)
for (var c = Ps(this, b, 1), d = this.Hb[b], e = 0; e < d; e++)
for (var f = e; f < d; f++) a += c[e * d + f];
return a;
};
function Qs(a) {
for (var b = 0, c = 0; c <= a.wa; c++) {
for (
var d = a, e = c, f = Ks(d, e), g = d.Hb[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) * Ms(n);
}
}
}
Ls(d, e, f);
b += h;
}
return b;
}
Bs.prototype.normalize = function() {
var a = Infinity;
this.Ja = -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.Ja = Math.max(this.Ja, c.column + this.nodeMinColumnSpace(c, !1));
}
for (b.reset(); b.next(); ) b.value.column -= a;
this.Ja -= a;
};
function Rs(a, b, c) {
for (var d = Ks(a, b), e = a.Hb[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;
}
Ls(a, b, d);
return f;
}
function Ss(a, b, c) {
for (var d = Ks(a, b), e = a.Hb[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));
}
Ls(a, b, d);
return f;
}
function Ts(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 && Ts(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 && Ts(a, k, c, d, e, f);
}
}
function Us(a, b, c, d, e, f) {
if (b.component === d) {
b.component = c;
if (e)
for (var g = b.destinationEdges; g.next(); )
Us(a, g.value.toVertex, c, d, e, f);
if (f)
for (b = b.sourceEdges; b.next(); )
Us(a, b.value.fromVertex, c, d, e, f);
}
}
Bs.prototype.removeCycles = function() {
for (var a = this.network.edges.iterator; a.next(); ) a.value.rev = !1;
switch (this.rk) {
default:
case Vs:
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 !== Ws(a); ) {
for (e = Xs(a); null !== e; )
(d[c] = e), c--, (e.valid = !1), (e = Xs(a));
for (e = Ys(a); null !== e; )
(d[b] = e), b++, (e.valid = !1), (e = Ys(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.Ol(b), (b.rev = !0));
break;
case Cs:
for (d = this.network.vertexes.iterator; d.next(); )
(a = d.value), (a.gg = -1), (a.finish = -1);
for (a = this.network.edges.iterator; a.next(); ) a.value.forest = !1;
this.Cg = 0;
for (d.reset(); d.next(); )
(b = d.value), 0 === b.sourceEdges.count && Zs(this, b);
for (d.reset(); d.next(); ) (b = d.value), -1 === b.gg && Zs(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.gg < b.gg && c < f && (this.network.Ol(d), (d.rev = !0)));
break;
case Hs:
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.Ol(b), (b.rev = !0));
}
}
};
function Ws(a) {
for (a = a.vertexes.iterator; a.next(); ) {
var b = a.value;
if (b.valid) return b;
}
return null;
}
function Xs(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 Ys(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 Zs(a, b) {
b.gg = a.Cg;
a.Cg++;
for (var c = b.destinationEdges; c.next(); ) {
var d = c.value,
e = d.toVertex;
-1 === e.gg && ((d.forest = !0), Zs(a, e));
}
b.finish = a.Cg;
a.Cg++;
}
Bs.prototype.assignLayers = function() {
switch (this.Ok) {
case $s:
at(this);
break;
case bt:
for (var a, b = this.network.vertexes.iterator; b.next(); )
(a = ct(this, b.value)), (this.wa = Math.max(a, this.wa));
for (b.reset(); b.next(); )
(a = b.value), (a.layer = this.wa - a.layer);
break;
default:
case Ds:
at(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 && dt(this, a);
a = Infinity;
for (b.reset(); b.next(); ) a = Math.min(a, b.value.layer);
this.wa = -1;
for (b.reset(); b.next(); ) {
var c = b.value;
c.layer -= a;
this.wa = Math.max(this.wa, c.layer);
}
}
};
function at(a) {
for (var b = a.network.vertexes.iterator; b.next(); ) {
var c = et(a, b.value);
a.wa = Math.max(c, a.wa);
}
}
function et(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, et(a, f) + e);
}
b.layer = c;
} else c = b.layer;
return c;
}
function ct(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, ct(a, f) + e);
}
b.layer = c;
} else c = b.layer;
return c;
}
function dt(a, b) {
if (!b.valid) {
b.valid = !0;
for (var c = b.destinationEdges; c.next(); ) dt(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 && Ts(a, h, 0, -1, !0, !1);
}
for (Ts(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 (Ts(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 Js(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;
}
Bs.prototype.initializeIndices = function() {
switch (this.Fk) {
default:
case ft:
for (var a = this.network.vertexes.iterator; a.next(); ) {
var b = a.value,
c = b.layer;
b.index = this.Hb[c];
this.Hb[c]++;
}
break;
case Es:
a = this.network.vertexes.iterator;
for (b = this.wa; 0 <= b; b--)
for (a.reset(); a.next(); )
(c = a.value), c.layer === b && -1 === c.index && gt(this, c);
break;
case ht:
for (a = this.network.vertexes.iterator, b = 0; b <= this.wa; b++)
for (a.reset(); a.next(); )
(c = a.value), c.layer === b && -1 === c.index && it(this, c);
}
};
function gt(a, b) {
var c = b.layer;
b.index = a.Hb[c];
a.Hb[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 && gt(a, d));
}
function it(a, b) {
var c = b.layer;
b.index = a.Hb[c];
a.Hb[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 && it(a, d));
}
Bs.prototype.reduceCrossings = function() {
var a = this.countCrossings(),
b = Ns(this),
c,
d;
for (c = 0; c < this.Xi; c++) {
for (d = 0; d <= this.wa; d++) jt(this, d, 1), kt(this, d, 1);
var e = this.countCrossings();
e < a && ((a = e), (b = Ns(this)));
for (d = this.wa; 0 <= d; d--) jt(this, d, -1), kt(this, d, -1);
e = this.countCrossings();
e < a && ((a = e), (b = Ns(this)));
}
Os(this, b);
for (c = 0; c < this.Xi; c++) {
for (d = 0; d <= this.wa; d++) jt(this, d, 0), kt(this, d, 0);
e = this.countCrossings();
e < a && ((a = e), (b = Ns(this)));
for (d = this.wa; 0 <= d; d--) jt(this, d, 0), kt(this, d, 0);
e = this.countCrossings();
e < a && ((a = e), (b = Ns(this)));
}
Os(this, b);
var f, g, h;
switch (this.ek) {
case lt:
break;
case mt:
for (h = a + 1; (d = this.countCrossings()) < h; )
for (h = d, c = this.wa; 0 <= c; c--)
for (g = 0; g <= c; g++) {
for (f = !0; f; )
for (f = !1, d = c; d >= g; d--) f = kt(this, d, -1) || f;
e = this.countCrossings();
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = c; d >= g; d--) f = kt(this, d, 1) || f;
e = this.countCrossings();
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = g; d <= c; d++) f = kt(this, d, 1) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = g; d <= c; d++) f = kt(this, d, -1) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = c; d >= g; d--) f = kt(this, d, 0) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = g; d <= c; d++) f = kt(this, d, 0) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
}
break;
default:
case Fs:
for (c = this.wa, g = 0, h = a + 1; (d = this.countCrossings()) < h; ) {
h = d;
for (f = !0; f; )
for (f = !1, d = c; d >= g; d--) f = kt(this, d, -1) || f;
e = this.countCrossings();
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = c; d >= g; d--) f = kt(this, d, 1) || f;
e = this.countCrossings();
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = g; d <= c; d++) f = kt(this, d, 1) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = g; d <= c; d++) f = kt(this, d, -1) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = c; d >= g; d--) f = kt(this, d, 0) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
for (f = !0; f; )
for (f = !1, d = g; d <= c; d++) f = kt(this, d, 0) || f;
e >= a ? Os(this, b) : ((a = e), (b = Ns(this)));
}
}
Os(this, b);
};
function jt(a, b, c) {
var d = Ks(a, b),
e = a.Hb[b],
f = Ss(a, b, c),
g = Rs(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));
Ls(a, b, d);
}
function kt(a, b, c) {
var d = Ks(a, b),
e = a.Hb[b];
c = Ps(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,
w = a.nodeMinColumnSpace(d[f], !0),
v = a.nodeMinColumnSpace(d[f], !1),
z = a.nodeMinColumnSpace(d[f + 1], !0),
y = a.nodeMinColumnSpace(d[f + 1], !1);
w = q - w + z;
v = u - v + 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 B = h[d[f].index],
F = g[d[f + 1].index],
L = h[d[f + 1].index];
-1 !== A && ((y += Math.abs(A - q)), (z += Math.abs(A - v)));
-1 !== B && ((y += Math.abs(B - q)), (z += Math.abs(B - v)));
-1 !== F && ((y += Math.abs(F - u)), (z += Math.abs(F - w)));
-1 !== L && ((y += Math.abs(L - u)), (z += Math.abs(L - w)));
if (
r < p - 0.5 ||
(r === p && n < m - 0.5) ||
(r === p && n === m && z < y - 0.5)
)
(l = k = !0),
(d[f].column = v),
(d[f + 1].column = w),
(m = d[f]),
(d[f] = d[f + 1]),
(d[f + 1] = m);
}
for (f = 0; f < e; f++) d[f].index = f;
Ls(a, b, d);
return k;
}
Bs.prototype.straightenAndPack = function() {
var a = 0 !== (this.Tf & 1);
var b = 0 !== (this.Tf & nt);
1e3 < this.network.edges.count && b && (a = !1);
if (a) {
var c = [];
for (b = 0; b <= this.wa; 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.Ja - c[b])) >> 1) + 8 * d);
this.Ja *= 8;
}
if (0 !== (this.Tf & 2))
for (c = !0; c; ) {
c = !1;
for (b = this.zc + 1; b <= this.wa; b++) c = ot(this, b, 1) || c;
for (b = this.zc - 1; 0 <= b; b--) c = ot(this, b, -1) || c;
c = ot(this, this.zc, 0) || c;
}
if (0 !== (this.Tf & 4)) {
for (b = this.zc + 1; b <= this.wa; b++) pt(this, b, 1);
for (b = this.zc - 1; 0 <= b; b--) pt(this, b, -1);
pt(this, this.zc, 0);
}
a && (qt(this, -1), qt(this, 1));
if (0 !== (this.Tf & 2))
for (c = !0; c; ) {
c = !1;
c = ot(this, this.zc, 0) || c;
for (b = this.zc + 1; b <= this.wa; b++) c = ot(this, b, 0) || c;
for (b = this.zc - 1; 0 <= b; b--) c = ot(this, b, 0) || c;
}
};
function ot(a, b, c) {
for (var d = !1; rt(a, b, c); ) d = !0;
return d;
}
function rt(a, b, c) {
var d,
e = Ks(a, b),
f = a.Hb[b],
g = Rs(a, b, -1);
if (0 < c) for (d = 0; d < f; d++) g[d] = -1;
var h = Rs(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 w = e[d].sourceEdges.iterator; w.next(); ) {
var v = w.value;
var z = v.fromVertex;
if (v.valid && z.layer !== b) {
var y = Ms(v);
var A = v.portFromColOffset;
v = v.portToColOffset;
z = z.column;
p += (Math.abs(m + v - (z + A)) + 1) * y;
q += (Math.abs(r + v - (z + A)) + 1) * y;
u += (Math.abs(n + v - (z + A)) + 1) * y;
}
}
if (0 <= c)
for (w = e[d].destinationEdges.iterator; w.next(); )
(v = w.value),
(z = v.toVertex),
v.valid &&
z.layer !== b &&
((y = Ms(v)),
(A = v.portFromColOffset),
(v = v.portToColOffset),
(z = z.column),
(p += (Math.abs(m + A - (z + v)) + 1) * y),
(q += (Math.abs(r + A - (z + v)) + 1) * y),
(u += (Math.abs(n + A - (z + v)) + 1) * y));
v = A = y = 0;
w = g[e[d].index];
z = h[e[d].index];
-1 !== w &&
((y += Math.abs(w - m)),
(A += Math.abs(w - r)),
(v += Math.abs(w - n)));
-1 !== z &&
((y += Math.abs(z - m)),
(A += Math.abs(z - r)),
(v += Math.abs(z - n)));
if (q < p || (q === p && A < y)) (l = k = !0), (e[d].column = r);
else if (u < p || (u === p && v < y)) (l = k = !0), (e[d].column = n);
}
Ls(a, b, e);
a.normalize();
return k;
}
function pt(a, b, c) {
var d = Ks(a, b),
e = a.Hb[b],
f = Ss(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));
}
Ls(a, b, d);
a.normalize();
}
function st(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 tt(a, b) {
var c = b + 1;
var d,
e = [],
f = [];
for (d = 0; d <= a.wa; 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.wa; 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 qt(a, b) {
for (var c = 0; c <= a.Ja; c++) for (; st(a, c); );
a.normalize();
for (c = 0; c < a.Ja; c++) for (; tt(a, c); );
a.normalize();
var d;
if (0 < b)
for (c = 0; c <= a.Ja; c++) {
var e = Ns(a);
var f = Qs(a);
for (d = f + 1; f < d; ) {
d = f;
ut(a, c, 1);
var g = Qs(a);
g > f ? Os(a, e) : g < f && ((f = g), (e = Ns(a)));
}
}
if (0 > b)
for (c = a.Ja; 0 <= c; c--)
for (e = Ns(a), f = Qs(a), d = f + 1; f < d; )
(d = f),
ut(a, c, -1),
(g = Qs(a)),
g > f ? Os(a, e) : g < f && ((f = g), (e = Ns(a)));
a.normalize();
}
function ut(a, b, c) {
a.Lc = 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.Lc);
}
if (0 > c)
for (d.reset(); d.next(); )
(e = d.value),
e.column + a.nodeMinColumnSpace(e, !1) >= b && (e.component = a.Lc);
a.Lc++;
for (d.reset(); d.next(); )
(b = d.value), -1 === b.component && (Us(a, b, a.Lc, -1, !0, !0), a.Lc++);
var f;
b = [];
for (f = 0; f < a.Lc * a.Lc; f++) b[f] = !1;
e = [];
for (f = 0; f < (a.wa + 1) * (a.Ja + 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.Ja, f.column + a.nodeMinColumnSpace(f, !1));
h <= k;
h++
)
e[g * (a.Ja + 1) + h] = f.component;
}
for (f = 0; f <= a.wa; f++) {
if (0 < c)
for (g = 0; g < a.Ja; g++)
-1 !== e[f * (a.Ja + 1) + g] &&
-1 !== e[f * (a.Ja + 1) + g + 1] &&
e[f * (a.Ja + 1) + g] !== e[f * (a.Ja + 1) + g + 1] &&
(b[e[f * (a.Ja + 1) + g] * a.Lc + e[f * (a.Ja + 1) + g + 1]] = !0);
if (0 > c)
for (g = a.Ja; 0 < g; g--)
-1 !== e[f * (a.Ja + 1) + g] &&
-1 !== e[f * (a.Ja + 1) + g - 1] &&
e[f * (a.Ja + 1) + g] !== e[f * (a.Ja + 1) + g - 1] &&
(b[e[f * (a.Ja + 1) + g] * a.Lc + e[f * (a.Ja + 1) + g - 1]] = !0);
}
e = [];
for (f = 0; f < a.Lc; 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.Lc; f++)
b[k * a.Lc + 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);
}
Bs.prototype.commitLayout = function() {
if (this.setsPortSpots)
for (
var a = Is(this, !0), b = Is(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.nu();
this.isRouting && this.commitLinks();
};
function Is(a, b) {
return 270 === a.L
? b
? ad
: fd
: 90 === a.L
? b
? fd
: ad
: 180 === a.L
? b
? dd
: ed
: b
? ed
: dd;
}
Bs.prototype.commitNodes = function() {
this.ae = [];
this.Cd = [];
this.Bd = [];
this.Qa = [];
for (var a = 0; a <= this.wa; a++)
(this.ae[a] = 0), (this.Cd[a] = 0), (this.Bd[a] = 0), (this.Qa[a] = 0);
for (a = this.network.vertexes.iterator; a.next(); ) {
var b = a.value,
c = b.layer;
this.ae[c] = Math.max(this.ae[c], this.nodeMinLayerSpace(b, !0));
this.Cd[c] = Math.max(this.Cd[c], this.nodeMinLayerSpace(b, !1));
}
b = 0;
c = this.be;
for (var d = 0; d <= this.wa; d++) {
var e = c;
0 >= this.ae[d] + this.Cd[d] && (e = 0);
0 < d && (b += e / 2);
90 === this.L || 0 === this.L
? ((b += this.Cd[d]), (this.Bd[d] = b), (b += this.ae[d]))
: ((b += this.ae[d]), (this.Bd[d] = b), (b += this.Cd[d]));
d < this.wa && (b += e / 2);
this.Qa[d] = b;
}
c = b;
b = this.arrangementOrigin;
for (d = 0; d <= this.wa; d++)
270 === this.L
? (this.Bd[d] = b.y + this.Bd[d])
: 90 === this.L
? ((this.Bd[d] = b.y + c - this.Bd[d]), (this.Qa[d] = c - this.Qa[d]))
: 180 === this.L
? (this.Bd[d] = b.x + this.Bd[d])
: ((this.Bd[d] = b.x + c - this.Bd[d]), (this.Qa[d] = c - this.Qa[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.gc * g;
f = this.Bd[f];
} else (h = this.Bd[f]), (f = b.y + this.gc * 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.Yc = new I(d, b);
for (a.reset(); a.next(); )
(c = a.value), (c.x += d), (c.y += b), c.commit();
};
Bs.prototype.nu = function() {
for (var a = 0, b = this.be, c = 0; c <= this.wa; c++)
(a += this.ae[c]), (a += this.Cd[c]);
a += this.wa * b;
b = [];
c = this.gc * this.Ja;
for (var d = this.maxLayer; 0 <= d; d--)
270 === this.L
? 0 === d
? b.push(new M(0, 0, c, Math.abs(this.Qa[0])))
: b.push(
new M(
0,
this.Qa[d - 1],
c,
Math.abs(this.Qa[d - 1] - this.Qa[d]),
),
)
: 90 === this.L
? 0 === d
? b.push(new M(0, this.Qa[0], c, Math.abs(this.Qa[0] - a)))
: b.push(
new M(0, this.Qa[d], c, Math.abs(this.Qa[d - 1] - this.Qa[d])),
)
: 180 === this.L
? 0 === d
? b.push(new M(0, 0, Math.abs(this.Qa[0]), c))
: b.push(
new M(
this.Qa[d - 1],
0,
Math.abs(this.Qa[d - 1] - this.Qa[d]),
c,
),
)
: 0 === d
? b.push(new M(this.Qa[0], 0, Math.abs(this.Qa[0] - a), c))
: b.push(
new M(this.Qa[d], 0, Math.abs(this.Qa[d - 1] - this.Qa[d]), c),
);
this.commitLayers(b, this.Yc);
};
Bs.prototype.commitLayers = function() {};
Bs.prototype.commitLinks = function() {
for (var a = this.network.edges.iterator, b; a.next(); )
(b = a.value.link), null !== b && (b.jh(), b.Aj(), b.pf());
for (a.reset(); a.next(); ) (b = a.value.link), null !== b && b.mg();
for (a.reset(); a.next(); ) {
var c = a.value;
b = c.link;
if (null !== b) {
b.jh();
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 === cg && 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.v() || c.set(e.actualBounds.center),
g.v() || g.set(f.actualBounds.center),
b.Aj(),
b.mf(c.x, c.y),
b.mf((2 * c.x + g.x) / 3, (2 * c.y + g.y) / 3),
b.mf((c.x + 2 * g.x) / 3, (c.y + 2 * g.y) / 3),
b.mf(g.x, g.y);
else {
var p = !1,
r = !1;
null !== g && l === sc && (p = !0);
null !== h && k === sc && (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;
if (p) {
if (90 === this.L || 270 === this.L) {
p = q;
var u = (c + d) / 2;
} else (p = (q + m) / 2), (u = c);
b.M(1, p, u);
l = b.getLinkPoint(e, g, l, !0, !1, f, h);
l.v() || 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.v() || e.set(f.actualBounds.center),
b.M(3, e.x, e.y));
}
}
b.pf();
} else if (m.layer === n.layer) b.pf();
else {
p = r = !1;
u = this.be;
q = b.firstPickIndex + 1;
if (b.isOrthogonal) {
p = !0;
var w = b.pointsCount;
4 < w && b.points.removeRange(2, w - 3);
} else if (b.curve === cg)
(r = !0),
(w = b.pointsCount),
4 < w && b.points.removeRange(2, w - 3),
4 === w && (q = 2);
else {
w = b.pointsCount;
var v = l === sc,
z = k === sc;
2 < w && v && z
? b.points.removeRange(1, w - 2)
: 3 < w && v && !z
? b.points.removeRange(1, w - 3)
: 3 < w && !v && z
? b.points.removeRange(2, w - 2)
: 4 < w && !v && !z && b.points.removeRange(2, w - 3);
}
if (c.rev) {
for (; null !== n && m !== n; ) {
var y = (w = null);
for (
v = n.sourceEdges.iterator;
v.next() &&
((z = v.value),
z.link !== c.link ||
((w = z.fromVertex), (y = z.toVertex), null !== w.node));
);
if (null === w) break;
if (w !== m) {
v = b.i(q - 1).x;
z = b.i(q - 1).y;
var A = w.centerX;
var B = w.centerY;
if (p)
180 === this.L || 0 === this.L
? q === b.firstPickIndex + 1
? (b.l(q++, v, z), b.l(q++, v, B))
: (null !== y ? y.centerY : z) !== B &&
((y = this.Qa[w.layer - 1] + this.Yc.x),
b.l(q++, y, z),
b.l(q++, y, B))
: q === b.firstPickIndex + 1
? (b.l(q++, v, z), b.l(q++, A, z))
: (null !== y ? y.centerX : v) !== A &&
((y = this.Qa[w.layer - 1] + this.Yc.y),
b.l(q++, v, y),
b.l(q++, A, y));
else if (q === b.firstPickIndex + 1) {
y = Math.max(10, this.ae[n.layer]);
var F = Math.max(10, this.Cd[n.layer]);
if (r)
180 === this.L
? A <= n.bounds.x
? ((n = n.bounds.x),
b.l(q++, n - y, B),
b.l(q++, n, B),
b.l(q++, n + F, B))
: (b.l(q++, A - y, B),
b.l(q++, A, B),
b.l(q++, A + F, B))
: 90 === this.L
? B >= n.bounds.bottom
? ((n = n.bounds.y + n.bounds.height),
b.l(q++, A, n + F),
b.l(q++, A, n),
b.l(q++, A, n - y))
: (b.l(q++, A, B + F),
b.l(q++, A, B),
b.l(q++, A, B - y))
: 270 === this.L
? B <= n.bounds.y
? ((n = n.bounds.y),
b.l(q++, A, n - y),
b.l(q++, A, n),
b.l(q++, A, n + F))
: (b.l(q++, A, B - y),
b.l(q++, A, B),
b.l(q++, A, B + F))
: 0 === this.L &&
(A >= n.bounds.right
? ((n = n.bounds.x + n.bounds.width),
b.l(q++, n + F, B),
b.l(q++, n, B),
b.l(q++, n - y, B))
: (b.l(q++, A + F, B),
b.l(q++, A, B),
b.l(q++, A - y, B)));
else {
b.l(q++, v, z);
var L = 0;
if (180 === this.L || 0 === this.L) {
if (
180 === this.L ? A >= n.bounds.right : A <= n.bounds.x
)
L = (0 === this.L ? -y : F) / 2;
b.l(q++, v + L, B);
} else {
if (
270 === this.L ? B >= n.bounds.bottom : B <= n.bounds.y
)
L = (90 === this.L ? -y : F) / 2;
b.l(q++, A, z + L);
}
b.l(q++, A, B);
}
} else
(y = Math.max(10, this.ae[w.layer])),
(F = Math.max(10, this.Cd[w.layer])),
r
? 180 === this.L
? (b.l(q++, A - y - u, B),
b.l(q++, Math.min(A - y + u / 2, A), B),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, Math.max(A + F - u / 2, A), B),
b.l(q++, A + F + u, B))
: 90 === this.L
? (b.l(q++, A, B + F + u),
b.l(q++, A, Math.max(B + F - u / 2, B)),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, A, Math.min(B - y + u / 2, B)),
b.l(q++, A, B - y - u))
: 270 === this.L
? (b.l(q++, A, B - y - u),
b.l(q++, A, Math.min(B - y + u / 2, B)),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, A, Math.max(B + F - u / 2, B)),
b.l(q++, A, B + F + u))
: (b.l(q++, A + F + u, B),
b.l(q++, Math.max(A + F - u / 2, A), B),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, Math.min(A - y + u / 2, A), B),
b.l(q++, A - y - u, B))
: b.l(q++, A, B);
}
n = w;
}
if (null === h || l !== sc || p)
if (
((v = b.i(q - 1).x),
(z = b.i(q - 1).y),
(A = b.i(q).x),
(B = b.i(q).y),
p)
)
(u = this.Cd[m.layer]),
180 === this.L || 0 === this.L
? ((p = z),
p >= m.bounds.y &&
p <= m.bounds.bottom &&
(180 === this.L
? A >= m.bounds.x
: A <= m.bounds.right) &&
((n = m.centerX + (180 === this.L ? -u : u)),
p < m.bounds.y + m.bounds.height / 2
? (p = m.bounds.y - this.gc / 2)
: (p = m.bounds.bottom + this.gc / 2),
b.l(q++, n, z),
b.l(q++, n, p)),
b.l(q++, A, p))
: ((p = v),
p >= m.bounds.x &&
p <= m.bounds.right &&
(270 === this.L
? B >= m.bounds.y
: B <= m.bounds.bottom) &&
((n = m.centerY + (270 === this.L ? -u : u)),
p < m.bounds.x + m.bounds.width / 2
? (p = m.bounds.x - this.gc / 2)
: (p = m.bounds.right + this.gc / 2),
b.l(q++, v, n),
b.l(q++, p, n)),
b.l(q++, p, B)),
b.l(q++, A, B);
else if (r)
(y = Math.max(10, this.ae[m.layer])),
(F = Math.max(10, this.Cd[m.layer])),
180 === this.L && A >= m.bounds.x
? ((n = m.bounds.x + m.bounds.width),
b.M(q - 2, n, z),
b.M(q - 1, n + F, z))
: 90 === this.L && B <= m.bounds.bottom
? ((n = m.bounds.y), b.M(q - 2, v, n), b.M(q - 1, v, n - y))
: 270 === this.L && B >= m.bounds.y
? ((n = m.bounds.y + m.bounds.height),
b.M(q - 2, v, n),
b.M(q - 1, v, n + F))
: 0 === this.L &&
A <= m.bounds.right &&
((n = m.bounds.x),
b.M(q - 2, n, z),
b.M(q - 1, n - y, z));
else {
y = Math.max(10, this.ae[m.layer]);
F = Math.max(10, this.Cd[m.layer]);
p = 0;
if (180 === this.L || 0 === this.L) {
if (180 === this.L ? A <= m.bounds.x : A >= m.bounds.right)
p = (0 === this.L ? F : -y) / 2;
b.l(q++, A + p, z);
} else {
if (270 === this.L ? B <= m.bounds.y : B >= m.bounds.bottom)
p = (90 === this.L ? F : -y) / 2;
b.l(q++, v, B + p);
}
b.l(q++, A, B);
}
} else {
for (; null !== m && m !== n; ) {
y = w = null;
for (
m = m.destinationEdges.iterator;
m.next() &&
((v = m.value),
v.link !== c.link ||
((w = v.toVertex),
(y = v.fromVertex),
null !== y.node && (y = null),
null !== w.node));
);
if (null === w) break;
w !== n &&
((v = b.i(q - 1).x),
(z = b.i(q - 1).y),
(A = w.centerX),
(B = w.centerY),
p
? 180 === this.L || 0 === this.L
? (null !== y ? y.centerY : z) !== B &&
((y = this.Qa[w.layer] + this.Yc.x),
q === b.firstPickIndex + 1 &&
(y = 0 === this.L ? Math.max(y, v) : Math.min(y, v)),
b.l(q++, y, z),
b.l(q++, y, B))
: (null !== y ? y.centerX : v) !== A &&
((y = this.Qa[w.layer] + this.Yc.y),
q === b.firstPickIndex + 1 &&
(y = 90 === this.L ? Math.max(y, z) : Math.min(y, z)),
b.l(q++, v, y),
b.l(q++, A, y))
: ((y = Math.max(10, this.ae[w.layer])),
(F = Math.max(10, this.Cd[w.layer])),
r
? 180 === this.L
? (b.l(q++, A + F + u, B),
b.l(q++, Math.max(A + F - u / 2, A), B),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, Math.min(A - y + u / 2, A), B),
b.l(q++, A - y - u, B))
: 90 === this.L
? (b.l(q++, A, B - y - u),
b.l(q++, A, Math.min(B - y + u / 2, B)),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, A, Math.max(B + F - u / 2, B)),
b.l(q++, A, B + F + u))
: 270 === this.L
? (b.l(q++, A, B + F + u),
b.l(q++, A, Math.max(B + F - u / 2, B)),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, A, Math.min(B - y + u / 2, B)),
b.l(q++, A, B - y - u))
: (b.l(q++, A - y - u, B),
b.l(q++, Math.min(A - y + u / 2, A), B),
b.l(q++, A, B),
b.l(q++, A, B),
b.l(q++, Math.max(A + F - u / 2, A), B),
b.l(q++, A + F + u, B))
: 180 === this.L
? (b.l(q++, A + F, B), b.l(q++, A - y, B))
: 90 === this.L
? (b.l(q++, A, B - y), b.l(q++, A, B + F))
: 270 === this.L
? (b.l(q++, A, B + F), b.l(q++, A, B - y))
: (b.l(q++, A - y, B), b.l(q++, A + F, B))));
m = w;
}
p &&
((v = b.i(q - 1).x),
(z = b.i(q - 1).y),
(A = b.i(q).x),
(B = b.i(q).y),
180 === this.L || 0 === this.L
? z !== B &&
((y =
0 === this.L
? Math.min(
Math.max((A + v) / 2, this.Qa[n.layer] + this.Yc.x),
A,
)
: Math.max(
Math.min((A + v) / 2, this.Qa[n.layer] + this.Yc.x),
A,
)),
b.l(q++, y, z),
b.l(q++, y, B))
: v !== A &&
((y =
90 === this.L
? Math.min(
Math.max((B + z) / 2, this.Qa[n.layer] + this.Yc.y),
B,
)
: Math.max(
Math.min((B + z) / 2, this.Qa[n.layer] + this.Yc.y),
B,
)),
b.l(q++, v, y),
b.l(q++, A, y)));
}
null !== d &&
r &&
(null !== g &&
(l === sc &&
((l = b.i(0)),
(d = b.i(2)),
l.C(d) || b.M(1, (l.x + d.x) / 2, (l.y + d.y) / 2)),
(l = b.getLinkPoint(e, g, sc, !0, !1, f, h)),
l.v() || l.set(e.actualBounds.center),
b.M(0, l.x, l.y)),
null !== h &&
(k === sc &&
((k = b.i(b.pointsCount - 1)),
(l = b.i(b.pointsCount - 3)),
k.C(l) ||
b.M(b.pointsCount - 2, (k.x + l.x) / 2, (k.y + l.y) / 2)),
(e = b.getLinkPoint(f, h, sc, !1, !1, e, g)),
e.v() || e.set(f.actualBounds.center),
b.M(b.pointsCount - 1, e.x, e.y)));
b.pf();
c.commit();
}
}
}
this.avoidOrthogonalOverlaps();
};
Bs.prototype.avoidOrthogonalOverlaps = function() {
if (!(0 >= this.linkSpacing)) {
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.B(f.y, g.y) && !this.B(f.x, g.x)) {
var h = new vt();
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.fc = l.x * l.x + l.y;
h.ld = Math.min(f.x, g.x);
h.Bc = 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.j = m;
}
c.push(h);
}
}
}
if (1 < c.length)
for (c.sort(this.Cx), 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].Bc;
for (e = a + 1; e < d && c[e].ld < g; )
(g = Math.max(g, c[e].Bc)), e++;
g = e - f;
if (1 < g) {
this.ri(c, this.js, f, f + g);
m = 1;
h = c[f].fc;
for (k = f; k < e; k++)
(l = c[k]), l.fc !== h && (m++, (h = l.fc));
this.ri(c, this.Bx, 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].fc),
this.ri(c, this.js, f, f + g))
: (h = c[f].first);
m = 0;
for (n = f; n < e; n++) {
var p = c[n];
(k ? p.first : p.fc) !== h &&
(m++, (h = k ? p.first : p.fc));
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.jh();
r.M(p.index, f.x, f.y + q);
r.M(p.index + 1, g.x, g.y + q);
r.pf();
}
}
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.B(f.x, g.x) &&
!this.B(f.y, g.y) &&
((h = new vt()),
(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.fc = l.x + l.y * l.y),
(h.ld = Math.min(f.y, g.y)),
(h.Bc = 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.j = m)),
c.push(h));
if (1 < c.length)
for (c.sort(this.Cx), 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].Bc;
for (e = a + 1; e < d && c[e].ld < g; )
(g = Math.max(g, c[e].Bc)), e++;
g = e - f;
if (1 < g) {
this.ri(c, this.js, f, f + g);
m = 1;
h = c[f].fc;
for (k = f; k < e; k++)
(l = c[k]), l.fc !== h && (m++, (h = l.fc));
this.ri(c, this.Bx, 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].fc),
this.ri(c, this.js, f, f + g))
: (h = c[f].first);
m = 0;
for (n = f; n < e; n++)
(p = c[n]),
(k ? p.first : p.fc) !== h &&
(m++, (h = k ? p.first : p.fc)),
(r = p.link),
(f = r.i(p.index)),
(g = r.i(p.index + 1)),
(q = this.linkSpacing * (m - (l - 1) / 2)),
b++,
r.jh(),
r.M(p.index, f.x + q, f.y),
r.M(p.index + 1, g.x + q, g.y),
r.pf();
}
f = e;
}
a = d;
}
}
}
};
t = Bs.prototype;
t.Cx = function(a, b) {
return a instanceof vt && b instanceof vt && a !== b
? a.layer < b.layer
? -1
: a.layer > b.layer
? 1
: a.ld < b.ld
? -1
: a.ld > b.ld
? 1
: a.Bc < b.Bc
? -1
: a.Bc > b.Bc
? 1
: 0
: 0;
};
t.Bx = function(a, b) {
return a instanceof vt && b instanceof vt && a !== b
? a.first < b.first
? -1
: a.first > b.first || a.j < b.j
? 1
: a.j > b.j || a.ld < b.ld
? -1
: a.ld > b.ld
? 1
: a.Bc < b.Bc
? -1
: a.Bc > b.Bc
? 1
: 0
: 0;
};
t.js = function(a, b) {
return a instanceof vt && b instanceof vt && a !== b
? a.fc < b.fc
? -1
: a.fc > b.fc || a.j < b.j
? 1
: a.j > b.j || a.ld < b.ld
? -1
: a.ld > b.ld
? 1
: a.Bc < b.Bc
? -1
: a.Bc > b.Bc
? 1
: 0
: 0;
};
t.B = function(a, b) {
a -= b;
return -1 < a && 1 > a;
};
t.ri = function(a, b, c, d) {
var e = a.length,
f = d - c;
if (!(1 >= f))
if (
((0 > c || c >= e - 1) && C('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 Ks(a, b) {
var c = a.Hb[b];
if (c >= a.we.length) {
var d = [];
for (var e = 0; e < a.we.length; e++) d[e] = a.we[e];
a.we = d;
}
void 0 === a.we[c] || null === a.we[c]
? (d = [])
: ((d = a.we[c]), (a.we[c] = null));
a = a.rn[b];
for (b = 0; b < a.length; b++) (c = a[b]), (d[c.index] = c);
return d;
}
function Ls(a, b, c) {
a.we[a.Hb[b]] = c;
}
ma.Object.defineProperties(Bs.prototype, {
layerSpacing: {
get: function() {
return this.be;
},
set: function(a) {
this.be !== a && 0 <= a && ((this.be = a), this.D());
},
},
columnSpacing: {
get: function() {
return this.gc;
},
set: function(a) {
this.gc !== a && 0 < a && ((this.gc = a), this.D());
},
},
direction: {
get: function() {
return this.L;
},
set: function(a) {
this.L !== a &&
(0 === a || 90 === a || 180 === a || 270 === a
? ((this.L = a), this.D())
: C('LayeredDigraphLayout.direction must be 0, 90, 180, or 270'));
},
},
cycleRemoveOption: {
get: function() {
return this.rk;
},
set: function(a) {
this.rk === a ||
(a !== Vs && a !== Cs && a !== Hs) ||
((this.rk = a), this.D());
},
},
layeringOption: {
get: function() {
return this.Ok;
},
set: function(a) {
this.Ok === a ||
(a !== Ds && a !== $s && a !== bt) ||
((this.Ok = a), this.D());
},
},
initializeOption: {
get: function() {
return this.Fk;
},
set: function(a) {
this.Fk === a ||
(a !== Es && a !== ht && a !== ft) ||
((this.Fk = a), this.D());
},
},
iterations: {
get: function() {
return this.Xi;
},
set: function(a) {
this.Xi !== a && 0 <= a && ((this.Xi = a), this.D());
},
},
aggressiveOption: {
get: function() {
return this.ek;
},
set: function(a) {
this.ek === a ||
(a !== lt && a !== Fs && a !== mt) ||
((this.ek = a), this.D());
},
},
packOption: {
get: function() {
return this.Tf;
},
set: function(a) {
this.Tf !== a && 0 <= a && 8 > a && ((this.Tf = a), this.D());
},
},
setsPortSpots: {
get: function() {
return this.ff;
},
set: function(a) {
this.ff !== a && ((this.ff = a), this.D());
},
},
linkSpacing: {
get: function() {
return this.jn;
},
set: function(a) {
this.jn !== a && 0 <= a && ((this.jn = a), this.D());
},
},
maxLayer: {
get: function() {
return this.wa;
},
},
maxIndex: {
get: function() {
return this.Dh;
},
},
maxColumn: {
get: function() {
return this.Ja;
},
},
minIndexLayer: {
get: function() {
return this.Bg;
},
},
maxIndexLayer: {
get: function() {
return this.zc;
},
},
});
var Cs = new D(Bs, 'CycleDepthFirst', 0),
Vs = new D(Bs, 'CycleGreedy', 1),
Hs = new D(Bs, 'CycleFromLayers', 2),
Ds = new D(Bs, 'LayerOptimalLinkLength', 0),
$s = new D(Bs, 'LayerLongestPathSink', 1),
bt = new D(Bs, 'LayerLongestPathSource', 2),
Es = new D(Bs, 'InitDepthFirstOut', 0),
ht = new D(Bs, 'InitDepthFirstIn', 1),
ft = new D(Bs, 'InitNaive', 2),
lt = new D(Bs, 'AggressiveNone', 0),
Fs = new D(Bs, 'AggressiveLess', 1),
mt = new D(Bs, 'AggressiveMore', 2),
nt = 8;
Bs.className = 'LayeredDigraphLayout';
Bs.CycleDepthFirst = Cs;
Bs.CycleGreedy = Vs;
Bs.CycleFromLayers = Hs;
Bs.LayerOptimalLinkLength = Ds;
Bs.LayerLongestPathSink = $s;
Bs.LayerLongestPathSource = bt;
Bs.InitDepthFirstOut = Es;
Bs.InitDepthFirstIn = ht;
Bs.InitNaive = ft;
Bs.AggressiveNone = lt;
Bs.AggressiveLess = Fs;
Bs.AggressiveMore = mt;
Bs.PackNone = 0;
Bs.PackExpand = 1;
Bs.PackStraighten = 2;
Bs.PackMedian = 4;
Bs.PackAll = 15;
function vt() {
this.index = this.Bc = this.ld = this.fc = this.first = this.layer = 0;
this.link = null;
this.j = 0;
}
vt.className = 'SegInfo';
function Gs(a) {
eq.call(this, a);
}
la(Gs, eq);
Gs.prototype.createVertex = function() {
return new wt(this);
};
Gs.prototype.createEdge = function() {
return new xt(this);
};
Gs.className = 'LayeredDigraphNetwork';
function wt(a) {
sq.call(this, a);
this.Wa = this.rg = this.Ah = -1;
this.u = NaN;
this.F = null;
this.valid = !1;
this.finish = this.gg = NaN;
this.nf = 0;
this.Tj = this.Uj = null;
}
la(wt, sq);
wt.prototype.serializeVertexProperties = function(a, b) {
sq.prototype.serializeVertexProperties.call(this, a, b);
a.layer = this.layer;
a.column = this.column;
a.index = this.index;
a.component = this.component;
a.near = this.near ? cb(this.near) : null;
a.valid = this.valid;
a.gg = this.gg;
a.finish = this.finish;
a.nf = this.nf;
a.Uj = this.Uj;
a.Tj = this.Tj;
};
wt.prototype.deserializeVertexProperties = function(a, b, c, d) {
sq.prototype.deserializeVertexProperties.call(this, a, b, c, d);
this.layer = a.layer;
this.column = a.column;
this.index = a.index;
this.component = a.component;
if ((b = b.get(a.near))) this.near = b;
this.valid = a.valid;
this.gg = a.gg;
this.finish = a.finish;
this.nf = a.nf;
this.Uj = a.Uj;
this.Tj = a.Tj;
};
ma.Object.defineProperties(wt.prototype, {
layer: {
get: function() {
return this.Ah;
},
set: function(a) {
this.Ah !== a && (this.Ah = a);
},
},
column: {
get: function() {
return this.rg;
},
set: function(a) {
this.rg !== a && (this.rg = a);
},
},
index: {
get: function() {
return this.Wa;
},
set: function(a) {
this.Wa !== a && (this.Wa = a);
},
},
component: {
get: function() {
return this.u;
},
set: function(a) {
this.u !== a && (this.u = a);
},
},
near: {
get: function() {
return this.F;
},
set: function(a) {
this.F !== a && (this.F = a);
},
},
});
wt.className = 'LayeredDigraphVertex';
function xt(a) {
tq.call(this, a);
this.j = this.ga = this.Ga = !1;
this.W = this.u = NaN;
this.F = this.m = 0;
}
la(xt, tq);
xt.prototype.serializeEdgeProperties = function(a, b) {
tq.prototype.serializeEdgeProperties.call(this, a, b);
a.valid = this.valid;
a.rev = this.rev;
a.forest = this.forest;
a.portFromPos = this.portFromPos;
a.portToPos = this.portToPos;
a.portFromColOffset = this.portFromColOffset;
a.portToColOffset = this.portToColOffset;
};
xt.prototype.deserializeEdgeProperties = function(a, b, c, d) {
tq.prototype.deserializeEdgeProperties.call(this, a, b, c, d);
this.valid = a.valid;
this.rev = a.rev;
this.forest = a.forest;
this.portFromPos = a.portFromPos;
this.portToPos = a.portToPos;
this.portFromColOffset = a.portFromColOffset;
this.portToColOffset = a.portToColOffset;
};
ma.Object.defineProperties(xt.prototype, {
fromVertex: {
get: function() {
return this.ad;
},
set: function(a) {
this.ad !== a && (this.ad = a);
},
},
toVertex: {
get: function() {
return this.jd;
},
set: function(a) {
this.jd !== a && (this.jd = a);
},
},
valid: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga !== a && (this.Ga = a);
},
},
rev: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga !== a && (this.ga = a);
},
},
forest: {
get: function() {
return this.j;
},
set: function(a) {
this.j !== a && (this.j = a);
},
},
portFromPos: {
get: function() {
return this.u;
},
set: function(a) {
this.u !== a && (this.u = a);
},
},
portToPos: {
get: function() {
return this.W;
},
set: function(a) {
this.W !== a && (this.W = a);
},
},
portFromColOffset: {
get: function() {
return this.m;
},
set: function(a) {
this.m !== a && (this.m = a);
},
},
portToColOffset: {
get: function() {
return this.F;
},
set: function(a) {
this.F !== a && (this.F = a);
},
},
});
xt.className = 'LayeredDigraphEdge';
function yt(a) {
qi.call(this);
this.Qb = new G();
this.En = zt;
this.qd = At;
this.Yn = Bt;
this.aq = Ct;
this.Ev = [];
this.od = !0;
this.Nb = Dt;
this.Td = new K(10, 10).freeze();
var b = new Et(this);
this.V = new Ft(b);
this.Y = new Ft(b);
this.Xt = [];
a && Object.assign(this, a);
}
la(yt, qi);
yt.prototype.cloneProtected = function(a) {
qi.prototype.cloneProtected.call(this, a);
a.En = this.En;
a.Yn = this.Yn;
a.aq = this.aq;
a.od = this.od;
a.Nb = this.Nb;
a.Td.assign(this.Td);
a.V.copyInheritedPropertiesFrom(this.V);
a.Y.copyInheritedPropertiesFrom(this.Y);
};
yt.prototype.ob = function(a) {
a.classType === yt
? 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)
: C('Unknown enum value: ' + a)
: qi.prototype.ob.call(this, a);
};
yt.prototype.createNetwork = function() {
return new Et(this);
};
yt.prototype.makeNetwork = function(a) {
function b(a) {
if (a instanceof V) return !a.isLinkLabel && 'Comment' !== a.category;
if (a instanceof T) {
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 Q
? (c.eg(a.nodes, !0, b), c.eg(a.links, !0, b))
: a instanceof qf
? c.eg(a.memberParts, !1, b)
: c.eg(a.iterator, !1, b);
return c;
};
yt.prototype.doLayout = function(a) {
null === this.network && (this.network = this.makeNetwork(a));
this.arrangement !== Gt &&
(this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin));
var b = this.diagram;
null === b && a instanceof Q && (b = a);
this.path === zt && null !== b
? (this.qd = b.isTreePathToChildren ? At : Ht)
: (this.qd = this.path === zt ? At : this.path);
if (0 < this.network.vertexes.count) {
this.network.oo();
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.Qb.count) {
a = new G();
for (b = this.Qb.iterator; b.next(); ) {
var c = b.value;
c instanceof V
? ((c = this.network.ei(c)), null !== c && a.add(c))
: c instanceof Ft && a.add(c);
}
this.Qb = a;
}
0 === this.Qb.count && this.findRoots();
for (a = this.Qb.copy().iterator; a.next(); )
(b = a.value), b.initialized || ((b.initialized = !0), It(this, b));
b = this.network.vertexes;
for (a = null; (a = Jt(b)), 0 < a.count; )
(b = Kt(this, a)),
null !== b && this.Qb.add(b),
(b.initialized = !0),
It(this, b),
(b = a);
for (a = this.Qb.iterator; a.next(); )
(b = a.value), b instanceof Ft && Lt(this, b);
for (a = this.Qb.iterator; a.next(); )
(b = a.value), b instanceof Ft && Mt(this, b);
for (a = this.Qb.iterator; a.next(); )
(b = a.value), b instanceof Ft && Nt(this, b);
this.ju();
if (this.layerStyle === Ot) {
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.Ev = 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 === Pt)
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.Qb.iterator; a.next(); )
(b = a.value), b instanceof Ft && this.layoutTree(b);
this.arrangeTrees();
this.updateParts();
}
this.network = null;
this.Qb = new G();
this.isValidLayout = !0;
};
function Jt(a) {
var b = new G();
for (a = a.iterator; a.next(); ) {
var c = a.value;
c.initialized || b.add(c);
}
return b;
}
yt.prototype.findRoots = function() {
for (var a = this.network.vertexes, b = a.iterator; b.next(); ) {
var c = b.value;
switch (this.qd) {
case At:
0 === c.sourceEdges.count && this.Qb.add(c);
break;
case Ht:
0 === c.destinationEdges.count && this.Qb.add(c);
break;
default:
C('Unhandled path value ' + this.qd.toString());
}
}
0 === this.Qb.count && ((a = Kt(this, a)), null !== a && this.Qb.add(a));
};
function Kt(a, b) {
var c = 999999,
d = null;
for (b = b.iterator; b.next(); ) {
var e = b.value;
switch (a.qd) {
case At:
e.sourceEdges.count < c && ((c = e.sourceEdges.count), (d = e));
break;
case Ht:
e.destinationEdges.count < c &&
((c = e.destinationEdges.count), (d = e));
break;
default:
C('Unhandled path value ' + a.qd.toString());
}
}
return d;
}
function It(a, b) {
if (null !== b) {
switch (a.qd) {
case At:
if (0 < b.destinationEdges.count) {
for (var c = new E(), d = b.destinationVertexes; d.next(); ) {
var e = d.value;
Qt(a, b, e) && c.add(e);
}
0 < c.count && (b.children = c.Ea());
}
break;
case Ht:
if (0 < b.sourceEdges.count) {
c = new E();
for (d = b.sourceVertexes; d.next(); )
(e = d.value), Qt(a, b, e) && c.add(e);
0 < c.count && (b.children = c.Ea());
}
break;
default:
C('Unhandled path value' + a.qd.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.Qb.remove(f);
}
for (b = 0; b < d; b++) It(a, c[b]);
}
}
function Qt(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;
}
yt.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 Lt(a, b) {
if (null !== b) {
a.initializeTreeVertexValues(b);
b.alignment === Rt && 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];
Lt(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 St(a, b) {
switch (a.Yn) {
default:
case Bt:
return null !== b.parent ? b.parent : a.V;
case Tt:
return null === b.parent
? a.V
: null === b.parent.parent
? a.Y
: b.parent;
case Ut:
return null !== b.parent
? null !== b.parent.parent
? b.parent.parent
: a.Y
: a.V;
case Vt:
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.Y
: null !== b.parent
? b.parent
: a.V;
}
}
yt.prototype.initializeTreeVertexValues = function(a) {
a.copyInheritedPropertiesFrom(St(this, a));
if (null !== a.parent && a.parent.alignment === Rt) {
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 Mt(a, b) {
if (null !== b) {
a.assignTreeVertexValues(b);
b = b.children;
for (var c = b.length, d = 0; d < c; d++) Mt(a, b[d]);
}
}
yt.prototype.assignTreeVertexValues = function() {};
function Nt(a, b) {
if (null !== b) {
b.alignment !== Rt && a.sortTreeVertexChildren(b);
b = b.children;
for (var c = b.length, d = 0; d < c; d++) Nt(a, b[d]);
}
}
yt.prototype.sortTreeVertexChildren = function(a) {
switch (a.sorting) {
case Wt:
break;
case Xt:
a.children.reverse();
break;
case Yt:
a.children.sort(a.comparer);
break;
case Zt:
a.children.sort(a.comparer);
a.children.reverse();
break;
default:
C('Unhandled sorting value ' + a.sorting.toString());
}
};
yt.prototype.ju = function() {
if (this.comments)
for (var a = this.network.vertexes.iterator; a.next(); )
this.addComments(a.value);
};
yt.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 = $t(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.wu(); l.next(); ) {
var m = l.value;
'Comment' === m.category &&
m.canLayout() &&
(null === a.comments && (a.comments = []),
a.comments.push(m),
m.Za(),
(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 = M.allocAt(0, 0, a.bounds.width + f, a.bounds.height + g)),
(a.bounds = e),
M.free(e));
};
function $t(a) {
return a === au || a === Rt || a === bu || a === cu;
}
function du(a) {
return a === au || a === Rt;
}
function eu(a) {
var b = a.parent;
if (null !== b) {
var c = b.alignment;
if ($t(c)) {
if (du(c)) {
b = b.children;
for (c = 0; c < b.length && a !== b[c]; ) c++;
return 0 === c % 2;
}
if (c === bu) return !0;
}
}
return !1;
}
yt.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 = $t(f)));
d = 90 === d || 270 === d;
c = 90 === e || 270 === e;
for (
var g = 0 === a.childrenCount,
h = eu(a),
k = 0,
l = a.comments,
m = l.length,
n = I.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.Kd();
r.next();
) {
var u = r.value;
u.fromSpot = dd;
u.toSpot = ed;
}
else
for (
n.h(
a.bounds.x + 2 * a.focus.x - a.commentMargin,
a.bounds.y + k,
),
r.move(n),
r = r.Kd();
r.next();
)
(u = r.value), (u.fromSpot = ed), (u.toSpot = dd);
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.Kd();
r.next();
)
(u = r.value), (u.fromSpot = ed), (u.toSpot = dd);
else
for (
n.h(a.bounds.x + a.commentMargin - q.width, a.bounds.y + k),
r.move(n),
r = r.Kd();
r.next();
)
(u = r.value), (u.fromSpot = dd), (u.toSpot = ed);
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.Kd();
r.next();
)
(u = r.value), (u.fromSpot = ad), (u.toSpot = fd);
else
for (
n.h(
a.bounds.x + k,
a.bounds.y + 2 * a.focus.y - a.commentMargin,
),
r.move(n),
r = r.Kd();
r.next();
)
(u = r.value), (u.fromSpot = fd), (u.toSpot = ad);
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.Kd();
r.next();
)
(u = r.value), (u.fromSpot = fd), (u.toSpot = ad);
else
for (
n.h(a.bounds.x + k, a.bounds.y + a.commentMargin - q.height),
r.move(n),
r = r.Kd();
r.next();
)
(u = r.value), (u.fromSpot = ad), (u.toSpot = fd);
k =
0 <= a.commentSpacing
? k + (q.width + a.commentSpacing)
: k + (a.commentSpacing - q.width);
}
}
I.free(n);
b = k - a.commentSpacing - (d ? b.height : b.width);
if (this.qd === At)
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);
}
};
yt.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 fu:
gu(this, a);
break;
case hu:
if (a.alignment === Rt) gu(this, a);
else if (0 === a.childrenCount)
(d = a.parent),
(c = !1),
(b = 0),
null !== d && ((b = d.angle), (c = d.alignment), (c = $t(c))),
(d = eu(a)),
a.S.h(0, 0),
a.Ca.h(a.width, a.height),
null === a.parent ||
null === a.comments ||
(((180 !== b && 270 !== b) || c) && !d)
? a.ka.h(0, 0)
: (180 === b && !c) || ((90 === b || 270 === b) && d)
? a.ka.h(a.width - 2 * a.focus.x, 0)
: a.ka.h(0, a.height - 2 * a.focus.y),
(a.Bo = null),
(a.No = null);
else {
var e = ku(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.Ca.width : d.Ca.height));
var k = a.alignment,
l = k === lu,
m = $t(k),
n = Math.max(0, a.breadthLimit);
c = mu(a);
var p = a.nodeSpacing,
r = nu(a),
q = a.rowSpacing,
u = 0;
if (k === ou || l || a.Pl || (a.Ql && 1 === a.maxGenerationCount))
u = Math.max(0, a.rowIndent);
d = a.width;
var w = a.height,
v = 0,
z = 0,
y = 0,
A = null,
B = null,
F = 0,
L = 0,
S = 0,
R = 0,
P = 0,
H = 0,
da = 0,
X = 0;
m && !du(k) && 135 < e && g.reverse();
if (du(k))
if (1 < h)
for (var oa = 0; oa < h; oa++)
0 === oa % 2 &&
oa !== h - 1 &&
(X = Math.max(X, b ? g[oa].Ca.width : g[oa].Ca.height));
else 1 === h && (X = b ? g[0].Ca.width : g[0].Ca.height);
if (m) {
switch (k) {
case au:
z = 135 > e ? pu(a, g, X, v, z) : qu(a, g, X, v, z);
X = z.x;
v = z.width;
z = z.height;
break;
case bu:
for (A = 0; A < h; A++)
(B = g[A]),
(n = B.Ca),
(y = 0 === H ? 0 : q),
b
? (B.S.h(f - n.width, R + y),
(v = Math.max(v, n.width)),
(z = Math.max(z, R + y + n.height)),
(R += y + n.height))
: (B.S.h(S + y, f - n.height),
(v = Math.max(v, S + y + n.width)),
(z = Math.max(z, n.height)),
(S += y + n.width)),
H++;
break;
case cu:
for (A = 0; A < h; A++)
(B = g[A]),
(f = B.Ca),
(n = 0 === H ? 0 : q),
b
? (B.S.h(p / 2 + a.focus.x, R + n),
(v = Math.max(v, f.width)),
(z = Math.max(z, R + n + f.height)),
(R += n + f.height))
: (B.S.h(S + n, p / 2 + a.focus.y),
(v = Math.max(v, S + n + f.width)),
(z = Math.max(z, f.height)),
(S += n + f.width)),
H++;
}
A = ru(this, 2);
B = ru(this, 2);
b
? (A[0].h(0, 0), A[1].h(0, z), B[0].h(v, 0))
: (A[0].h(0, 0), A[1].h(v, 0), B[0].h(0, z));
B[1].h(v, z);
} else
for (oa = 0; oa < h; oa++) {
var Ba = g[oa],
db = Ba.Ca;
if (b) {
0 < n &&
0 < H &&
S + p + db.width > n &&
(S < f && su(a, k, f - S, 0, da, oa - 1),
P++,
(H = 0),
(da = oa),
(y = z),
(S = 0),
(R = 135 < e ? -z - q : z + q));
tu(this, Ba, 0, R);
var hb = 0;
if (0 === H) {
if (
((A = Ba.Bo),
(B = Ba.No),
(F = db.width),
(L = db.height),
null === A || null === B || e !== ku(Ba))
)
(A = ru(this, 2)),
(B = ru(this, 2)),
A[0].h(0, 0),
A[1].h(0, L),
B[0].h(F, 0),
B[1].h(F, L);
} else {
var Fb = Ea();
L = uu(this, a, Ba, A, B, F, L, Fb);
hb = L.x;
A = Fb[0];
B = Fb[1];
F = L.width;
L = L.height;
Ga(Fb);
S < db.width &&
0 > hb &&
(vu(a, -hb, 0, da, oa - 1),
wu(A, -hb, 0),
wu(B, -hb, 0),
(hb = 0));
}
Ba.S.h(hb, R);
v = Math.max(v, F);
z = Math.max(z, y + (0 === P ? 0 : q) + db.height);
S = F;
} else {
0 < n &&
0 < H &&
R + p + db.height > n &&
(R < f && su(a, k, 0, f - R, da, oa - 1),
P++,
(H = 0),
(da = oa),
(y = v),
(R = 0),
(S = 135 < e ? -v - q : v + q));
tu(this, Ba, S, 0);
hb = 0;
if (0 === H) {
if (
((A = Ba.Bo),
(B = Ba.No),
(F = db.width),
(L = db.height),
null === A || null === B || e !== ku(Ba))
)
(A = ru(this, 2)),
(B = ru(this, 2)),
A[0].h(0, 0),
A[1].h(F, 0),
B[0].h(0, L),
B[1].h(F, L);
} else
(Fb = Ea()),
(L = uu(this, a, Ba, A, B, F, L, Fb)),
(hb = L.x),
(A = Fb[0]),
(B = Fb[1]),
(F = L.width),
(L = L.height),
Ga(Fb),
R < db.height &&
0 > hb &&
(vu(a, 0, -hb, da, oa - 1),
wu(A, 0, -hb),
wu(B, 0, -hb),
(hb = 0));
Ba.S.h(S, hb);
z = Math.max(z, L);
v = Math.max(v, y + (0 === P ? 0 : q) + db.width);
R = L;
}
H++;
}
0 < P &&
(b
? ((z += Math.max(0, c)),
S < v && su(a, k, v - S, 0, da, h - 1),
0 < u && (l || vu(a, u, 0, 0, h - 1), (v += u)))
: ((v += Math.max(0, c)),
R < z && su(a, k, 0, z - R, da, h - 1),
0 < u && (l || vu(a, 0, u, 0, h - 1), (z += u))));
u = l = 0;
switch (k) {
case xu:
b
? (l += v / 2 - a.focus.x - r / 2)
: (u += z / 2 - a.focus.y - r / 2);
break;
case yu:
0 < P
? b
? (l += v / 2 - a.focus.x - r / 2)
: (u += z / 2 - a.focus.y - r / 2)
: b
? ((X = g[0].S.x + g[0].ka.x),
(l +=
X +
(g[h - 1].S.x +
g[h - 1].ka.x +
2 * g[h - 1].focus.x -
X) /
2 -
a.focus.x -
r / 2))
: ((X = g[0].S.y + g[0].ka.y),
(u +=
X +
(g[h - 1].S.y +
g[h - 1].ka.y +
2 * g[h - 1].focus.y -
X) /
2 -
a.focus.y -
r / 2));
break;
case ou:
b ? ((l -= r), (v += r)) : ((u -= r), (z += r));
break;
case lu:
b
? ((l += v - a.width + r), (v += r))
: ((u += z - a.height + r), (z += r));
break;
case au:
b
? 1 < h
? (l += X + p / 2 - a.focus.x)
: (l += g[0].focus.x - a.focus.x + g[0].ka.x)
: 1 < h
? (u += X + p / 2 - a.focus.y)
: (u += g[0].focus.y - a.focus.y + g[0].ka.y);
break;
case bu:
b ? (l += v + p / 2 - a.focus.x) : (u += z + p / 2 - a.focus.y);
break;
case cu:
break;
default:
C('Unhandled alignment value ' + k.toString());
}
for (r = 0; r < h; r++)
(X = g[r]),
b
? X.S.h(
X.S.x + X.ka.x - l,
X.S.y +
(135 < e
? (m ? -z : -X.Ca.height) + X.ka.y - c
: w + c + X.ka.y),
)
: X.S.h(
X.S.x +
(135 < e
? (m ? -v : -X.Ca.width) + X.ka.x - c
: d + c + X.ka.x),
X.S.y + X.ka.y - u,
);
h = g = 0;
m
? b
? ((v = zu(a, v, l)),
0 > l && (l = 0),
135 < e && (u += z + c),
(z += w + c),
k === cu && (g += p / 2 + a.focus.x),
(h += w + c))
: (135 < e && (l += v + c),
(v += d + c),
(z = Au(a, z, u)),
0 > u && (u = 0),
k === cu && (h += p / 2 + a.focus.y),
(g += d + c))
: b
? (null === a.comments
? d > v &&
((v = Bu(k, d - v, 0)),
(g = v.x),
(h = v.y),
(v = d),
(l = 0))
: (v = zu(a, v, l)),
0 > l && ((g -= l), (l = 0)),
135 < e && (u += z + c),
(z = Math.max(Math.max(z, w), z + w + c)),
(h += w + c))
: (135 < e && (l += v + c),
(v = Math.max(Math.max(v, d), v + d + c)),
null === a.comments
? w > z &&
((z = Bu(k, 0, w - z)),
(g = z.x),
(h = z.y),
(z = w),
(u = 0))
: (z = Au(a, z, u)),
0 > u && ((h -= u), (u = 0)),
(g += d + c));
if (0 < P)
(e = ru(this, 4)),
(P = ru(this, 4)),
b
? (e[2].h(0, w + c),
e[3].h(e[2].x, z),
P[2].h(v, e[2].y),
P[3].h(P[2].x, e[3].y))
: (e[2].h(d + c, 0),
e[3].h(v, e[2].y),
P[2].h(e[2].x, z),
P[3].h(e[3].x, P[2].y));
else {
e = ru(this, A.length + 2);
P = ru(this, B.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 < B.length; k++)
(m = B[k]), P[k + 2].h(m.x + g, m.y + h);
}
b
? (e[0].h(l, 0),
e[1].h(e[0].x, w),
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])),
P[0].h(l + d, 0),
P[1].h(P[0].x, w),
P[2].y < P[1].y &&
(P[2].x < P[0].x ? P[2].assign(P[1]) : P[1].assign(P[2])),
P[3].y < P[2].y &&
(P[3].x < P[0].x ? P[3].assign(P[2]) : P[2].assign(P[3])),
(e[2].y -= c / 2),
(P[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])),
P[0].h(0, u + w),
P[1].h(d, P[0].y),
P[2].x < P[1].x &&
(P[2].y < P[0].y ? P[2].assign(P[1]) : P[1].assign(P[2])),
P[3].x < P[2].x &&
(P[3].y < P[0].y ? P[3].assign(P[2]) : P[2].assign(P[3])),
(e[2].x -= c / 2),
(P[2].x -= c / 2));
Cu(this, A);
Cu(this, B);
a.Bo = e;
a.No = P;
a.ka.h(l, u);
a.Ca.h(v, z);
}
break;
default:
C('Unhandled compaction value ' + a.compaction.toString());
}
}
};
function gu(a, b) {
if (0 === b.childrenCount) {
var c = !1,
d = 0;
null !== b.parent &&
((d = b.parent.angle), (c = b.parent.alignment), (c = $t(c)));
var e = eu(b);
b.S.h(0, 0);
b.Ca.h(b.width, b.height);
null === b.parent ||
null === b.comments ||
(((180 !== d && 270 !== d) || c) && !e)
? b.ka.h(0, 0)
: (180 === d && !c) || ((90 === d || 270 === d) && e)
? b.ka.h(b.width - 2 * b.focus.x, 0)
: b.ka.h(0, b.height - 2 * b.focus.y);
} else {
d = ku(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.Ca.width : k.Ca.height);
}
var l = b.alignment,
m = l === ou,
n = l === lu;
h = $t(l);
var p = Math.max(0, b.breadthLimit);
k = mu(b);
var r = b.nodeSpacing,
q = nu(b),
u = m || n ? 0 : q / 2,
w = b.rowSpacing,
v = 0;
if (m || n || b.Pl || (b.Ql && 1 === b.maxGenerationCount))
v = Math.max(0, b.rowIndent);
m = b.width;
var z = b.height,
y = 0,
A = 0,
B = 0,
F = 0,
L = 0,
S = 0,
R = 0,
P = 0,
H = 0;
h && !du(l) && 135 < d && e.reverse();
if (du(l))
if (1 < g)
for (var da = 0; da < g; da++) {
var X = e[da],
oa = X.Ca;
0 === da % 2 &&
da !== g - 1 &&
(H = Math.max(H, (c ? oa.width : oa.height) + Du(X) - r));
}
else 1 === g && (H = c ? e[0].Ca.width : e[0].Ca.height);
if (h)
switch (l) {
case au:
case Rt:
A = 135 > d ? pu(b, e, H, y, A) : qu(b, e, H, y, A);
H = A.x;
y = A.width;
A = A.height;
break;
case bu:
for (a = 0; a < g; a++)
(p = e[a]),
(u = p.Ca),
(B = 0 === R ? 0 : w),
c
? (p.S.h(f - u.width, L + B),
(y = Math.max(y, u.width)),
(A = Math.max(A, L + B + u.height)),
(L += B + u.height))
: (p.S.h(F + B, f - u.height),
(y = Math.max(y, F + B + u.width)),
(A = Math.max(A, u.height)),
(F += B + u.width)),
R++;
break;
case cu:
for (f = 0; f < g; f++)
(a = e[f]),
(p = a.Ca),
(u = 0 === R ? 0 : w),
c
? (a.S.h(r / 2 + b.focus.x, L + u),
(y = Math.max(y, p.width)),
(A = Math.max(A, L + u + p.height)),
(L += u + p.height))
: (a.S.h(F + u, r / 2 + b.focus.y),
(y = Math.max(y, F + u + p.width)),
(A = Math.max(A, p.height)),
(F += u + p.width)),
R++;
}
else
for (da = 0; da < g; da++) {
X = e[da];
oa = X.Ca;
if (c) {
0 < p &&
0 < R &&
F + r + oa.width > p &&
(F < f && su(b, l, f - F, 0, P, da - 1),
S++,
(R = 0),
(P = da),
(B = A),
(F = 0),
(L = 135 < d ? -A - w : A + w));
var Ba = 0 === R ? u : r;
tu(a, X, 0, L);
X.S.h(F + Ba, L);
y = Math.max(y, F + Ba + oa.width);
A = Math.max(A, B + (0 === S ? 0 : w) + oa.height);
F += Ba + oa.width;
} else
0 < p &&
0 < R &&
L + r + oa.height > p &&
(L < f && su(b, l, 0, f - L, P, da - 1),
S++,
(R = 0),
(P = da),
(B = y),
(L = 0),
(F = 135 < d ? -y - w : y + w)),
(Ba = 0 === R ? u : r),
tu(a, X, F, 0),
X.S.h(F, L + Ba),
(A = Math.max(A, L + Ba + oa.height)),
(y = Math.max(y, B + (0 === S ? 0 : w) + oa.width)),
(L += Ba + oa.height);
R++;
}
0 < S &&
(c
? ((A += Math.max(0, k)),
F < y && su(b, l, y - F, 0, P, g - 1),
0 < v && (n || vu(b, v, 0, 0, g - 1), (y += v)))
: ((y += Math.max(0, k)),
L < A && su(b, l, 0, A - L, P, g - 1),
0 < v && (n || vu(b, 0, v, 0, g - 1), (A += v))));
v = n = 0;
switch (l) {
case xu:
c
? (n += y / 2 - b.focus.x - q / 2)
: (v += A / 2 - b.focus.y - q / 2);
break;
case yu:
0 < S
? c
? (n += y / 2 - b.focus.x - q / 2)
: (v += A / 2 - b.focus.y - q / 2)
: c
? ((l = e[0].S.x + e[0].ka.x),
(n +=
l +
(e[g - 1].S.x + e[g - 1].ka.x + 2 * e[g - 1].focus.x - l) / 2 -
b.focus.x -
q / 2))
: ((l = e[0].S.y + e[0].ka.y),
(v +=
l +
(e[g - 1].S.y + e[g - 1].ka.y + 2 * e[g - 1].focus.y - l) / 2 -
b.focus.y -
q / 2));
break;
case ou:
c ? ((n -= q), (y += q)) : ((v -= q), (A += q));
break;
case lu:
c
? ((n += y - b.width + q), (y += q))
: ((v += A - b.height + q), (A += q));
break;
case au:
case Rt:
c
? 1 < g
? (n += H + r / 2 - b.focus.x)
: (n += e[0].focus.x - b.focus.x + e[0].ka.x)
: 1 < g
? (v += H + r / 2 - b.focus.y)
: (v += e[0].focus.y - b.focus.y + e[0].ka.y);
break;
case bu:
c ? (n += y + r / 2 - b.focus.x) : (v += A + r / 2 - b.focus.y);
break;
case cu:
break;
default:
C('Unhandled alignment value ' + l.toString());
}
for (q = 0; q < g; q++)
(l = e[q]),
c
? l.S.h(
l.S.x + l.ka.x - n,
l.S.y +
(135 < d
? (h ? -A : -l.Ca.height) + l.ka.y - k
: z + k + l.ka.y),
)
: l.S.h(
l.S.x +
(135 < d
? (h ? -y : -l.Ca.width) + l.ka.x - k
: m + k + l.ka.x),
l.S.y + l.ka.y - v,
);
c
? ((y = zu(b, y, n)),
0 > n && (n = 0),
135 < d && (v += A + k),
(A = Math.max(Math.max(A, z), A + z + k)))
: (135 < d && (n += y + k),
(y = Math.max(Math.max(y, m), y + m + k)),
(A = Au(b, A, v)),
0 > v && (v = 0));
b.ka.h(n, v);
b.Ca.h(y, A);
}
}
function pu(a, b, c, d, e) {
var f = b.length;
if (0 === f) return new M(c, 0, d, e);
if (1 === f)
return (a = b[0]), (d = a.Ca.width), (e = a.Ca.height), new M(c, 0, d, e);
for (
var g = a.nodeSpacing,
h = a.rowSpacing,
k = 90 === ku(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.Ca,
u = 0 === l ? 0 : h;
if (k) {
var w = Du(r) - g;
r.S.h(c - (q.width + w), n + u);
d = Math.max(d, q.width + w);
e = Math.max(e, n + u + q.height);
n += u + q.height;
} else
(w = Du(r) - g),
r.S.h(m + u, c - (q.height + w)),
(e = Math.max(e, q.height + w)),
(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];
w = u.Ca;
var v = 0 === l ? 0 : h;
if (k) {
var z = Du(u) - g;
u.S.h(m + z, n + v);
d = Math.max(d, m + w.width + z);
e = Math.max(e, n + v + w.height);
n += v + w.height;
} else
(z = Du(u) - g),
u.S.h(m + v, n + z),
(d = Math.max(d, m + v + w.width)),
(e = Math.max(e, n + w.height + z)),
(m += v + w.width);
l++;
}
1 < f &&
1 === f % 2 &&
((b = b[f - 1]),
(f = b.Ca),
(h = null === b.parent ? 0 : b.parent.rowSpacing),
k
? (b.S.h(c + g / 2 - b.focus.x - b.ka.x, e + h),
(k = c + g / 2 - b.focus.x - b.ka.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.S.x && (c = Eu(a, b.S.x, !1, c, g)))
: (b.S.h(d + h, c + g / 2 - b.focus.y - b.ka.y),
(d = Math.max(d, Math.max(r, m) + h + f.width)),
(n = c + g / 2 - b.focus.y - b.ka.y),
(e = Math.max(e, n + f.height)),
0 > n && (e -= n),
0 > b.S.y && (c = Eu(a, b.S.y, !0, c, g))));
return new M(c, 0, d, e);
}
function qu(a, b, c, d, e) {
var f = b.length;
if (0 === f) return new M(c, 0, d, e);
if (1 === f)
return (b = b[0]), (d = b.Ca.width), (e = b.Ca.height), new M(c, 0, d, e);
for (
var g = a.nodeSpacing,
h = a.rowSpacing,
k = 270 === ku(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.Ca,
u = 0 === l ? 0 : h;
if (k) {
var w = Du(r) - g;
n -= u + q.height;
r.S.h(c - (q.width + w), n);
d = Math.max(d, q.width + w);
e = Math.max(e, Math.abs(n));
} else
(w = Du(r) - g),
(m -= u + q.width),
r.S.h(m, c - (q.height + w)),
(e = Math.max(e, q.height + w)),
(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];
w = u.Ca;
var v = 0 === l ? 0 : h;
if (k) {
var z = Du(u) - g;
n -= v + w.height;
u.S.h(m + z, n);
d = Math.max(d, m + w.width + z);
e = Math.max(e, Math.abs(n));
} else
(z = Du(u) - g),
(m -= v + w.width),
u.S.h(m, n + z),
(e = Math.max(e, n + w.height + z)),
(d = Math.max(d, Math.abs(m)));
l++;
}
1 < f &&
1 === f % 2 &&
((h = b[f - 1]),
(l = h.Ca),
(q = null === h.parent ? 0 : h.parent.rowSpacing),
k
? (h.S.h(c + g / 2 - h.focus.x - h.ka.x, -e - l.height - q),
(m = c + g / 2 - h.focus.x - h.ka.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.S.x && (c = Eu(a, h.S.x, !1, c, g)))
: (h.S.h(-d - l.width - q, c + g / 2 - h.focus.y - h.ka.y),
(d = Math.max(d, Math.abs(Math.min(r, m)) + q + l.width)),
(n = c + g / 2 - h.focus.y - h.ka.y),
(e = Math.max(e, n + l.height)),
0 > n && (e -= n),
0 > h.S.y && (c = Eu(a, h.S.y, !0, c, g))));
for (a = 0; a < f; a++)
(g = b[a]), k ? g.S.h(g.S.x, g.S.y + e) : g.S.h(g.S.x + d, g.S.y);
return new M(c, 0, d, e);
}
function Du(a) {
return null === a.parent ? 0 : a.parent.nodeSpacing;
}
function Eu(a, b, c, d, e) {
a = a.children;
for (var f = a.length, g = 0; g < f; g++)
c ? a[g].S.h(a[g].S.x, a[g].S.y - b) : a[g].S.h(a[g].S.x - b, a[g].S.y);
b = a[f - 1];
return Math.max(
d,
c ? b.ka.y + b.focus.y - e / 2 : b.ka.x + b.focus.x - e / 2,
);
}
function zu(a, b, c) {
switch (a.alignment) {
case yu:
case xu:
return c + a.width > b && (b = c + a.width), 0 > c && (b -= c), b;
case ou:
return a.width > b ? a.width : b;
case lu:
return 2 * a.focus.x > b ? a.width : b + a.width - 2 * a.focus.x;
case au:
case Rt:
return Math.max(a.width, Math.max(b, c + a.width) - Math.min(0, c));
case bu:
return a.width - a.focus.x + a.nodeSpacing / 2 + b;
case cu:
return Math.max(a.width, a.focus.x + a.nodeSpacing / 2 + b);
default:
return b;
}
}
function Au(a, b, c) {
switch (a.alignment) {
case yu:
case xu:
return c + a.height > b && (b = c + a.height), 0 > c && (b -= c), b;
case ou:
return a.height > b ? a.height : b;
case lu:
return 2 * a.focus.y > b ? a.height : b + a.height - 2 * a.focus.y;
case au:
case Rt:
return Math.max(a.height, Math.max(b, c + a.height) - Math.min(0, c));
case bu:
return a.height - a.focus.y + a.nodeSpacing / 2 + b;
case cu:
return Math.max(a.height, a.focus.y + a.nodeSpacing / 2 + b);
default:
return b;
}
}
function Bu(a, b, c) {
switch (a) {
case xu:
b /= 2;
c /= 2;
break;
case yu:
b /= 2;
c /= 2;
break;
case ou:
c = b = 0;
break;
case lu:
break;
default:
C('Unhandled alignment value ' + a.toString());
}
return new I(b, c);
}
function su(a, b, c, d, e, f) {
b = Bu(b, c, d);
vu(a, b.x, b.y, e, f);
}
function vu(a, b, c, d, e) {
if (0 !== b || 0 !== c)
for (a = a.children; d <= e; d++) {
var f = a[d].S;
f.x += b;
f.y += c;
}
}
function tu(a, b, c, d) {
var e = b.parent;
switch (a.qd) {
case At:
for (a = b.sourceEdges; a.next(); )
(b = a.value), b.fromVertex === e && b.relativePoint.h(c, d);
break;
case Ht:
for (a = b.destinationEdges; a.next(); )
(b = a.value), b.toVertex === e && b.relativePoint.h(c, d);
break;
default:
C('Unhandled path value ' + a.qd.toString());
}
}
function wu(a, b, c) {
for (var d = 0; d < a.length; d++) {
var e = a[d];
e.x += b;
e.y += c;
}
}
function uu(a, b, c, d, e, f, g, h) {
var k = ku(b),
l = 90 === k || 270 === k,
m = b.nodeSpacing;
b = d;
var n = e;
d = f;
var p = g,
r = c.Bo,
q = c.No;
g = c.Ca;
var u = l ? Math.max(p, g.height) : Math.max(d, g.width);
if (null === r || k !== ku(c))
(r = ru(a, 2)),
(q = ru(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 w = r[e];
k = w.x;
l = w.y;
k += d;
var v = f;
c + 1 < n.length && (v = n[c + 1]);
var z = w;
w = z.x;
z = z.y;
e + 1 < r.length && ((z = r[e + 1]), (w = z.x), (z = z.y), (w += d));
var y = p;
f.y === l
? (y = k - f.x)
: f.y > l && f.y < z
? (y = k + ((f.y - l) / (z - l)) * (w - k) - f.x)
: l > f.y &&
l < v.y &&
(y = k - (f.x + ((l - f.y) / (v.y - f.y)) * (v.x - f.x)));
y < p && (p = y);
v.y <= f.y ? c++ : z <= l ? e++ : (v.y <= z && c++, z <= v.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 = ru(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 = ru(a, d);
for (k = 0; k < d; k++) c[k].assign(m[k]);
Cu(a, m);
d = c;
}
f = q;
k = p;
if (null === n || 2 > n.length || null === f || 2 > f.length) e = null;
else {
m = ru(a, n.length + f.length);
for (e = l = c = 0; c < n.length && n[c].y < f[0].y; )
(v = n[c++]), m[e++].h(v.x, v.y);
for (; l < f.length; ) (v = f[l++]), m[e++].h(v.x + k, v.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 = ru(a, e);
for (c = 0; c < e; c++) f[c].assign(m[c]);
Cu(a, m);
e = f;
}
f = Math.max(0, p) + g.width;
g = u;
Cu(a, b);
Cu(a, r);
Cu(a, n);
Cu(a, q);
h[0] = d;
h[1] = e;
return new M(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]),
(w = r[e]),
(k = w.x),
(l = w.y),
(l += p),
(v = f),
c + 1 < n.length && (v = n[c + 1]),
(z = w),
(w = z.x),
(z = z.y),
e + 1 < r.length && ((z = r[e + 1]), (w = z.x), (z = z.y), (z += p)),
(y = d),
f.x === k
? (y = l - f.y)
: f.x > k && f.x < w
? (y = l + ((f.x - k) / (w - k)) * (z - l) - f.y)
: k > f.x &&
k < v.x &&
(y = l - (f.y + ((k - f.x) / (v.x - f.x)) * (v.y - f.y))),
y < d && (d = y),
v.x <= f.x ? c++ : w <= k ? e++ : (v.x <= w && c++, w <= v.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 = ru(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 = ru(a, d);
for (k = 0; k < d; k++) c[k].assign(m[k]);
Cu(a, m);
d = c;
}
f = q;
k = p;
if (null === n || 2 > n.length || null === f || 2 > f.length) e = null;
else {
m = ru(a, n.length + f.length);
for (e = l = c = 0; c < n.length && n[c].x < f[0].x; )
(v = n[c++]), m[e++].h(v.x, v.y);
for (; l < f.length; ) (v = f[l++]), m[e++].h(v.x, v.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 = ru(a, e);
for (c = 0; c < e; c++) f[c].assign(m[c]);
Cu(a, m);
e = f;
}
f = u;
g = Math.max(0, p) + g.height;
Cu(a, b);
Cu(a, r);
Cu(a, n);
Cu(a, q);
h[0] = d;
h[1] = e;
return new M(p, 0, f, g);
}
function ru(a, b) {
a = a.Xt[b];
if (void 0 !== a && ((a = a.pop()), void 0 !== a)) return a;
a = [];
for (var c = 0; c < b; c++) a[c] = new I();
return a;
}
function Cu(a, b) {
var c = b.length,
d = a.Xt[c];
void 0 === d && ((d = []), (a.Xt[c] = d));
d.push(b);
}
yt.prototype.arrangeTrees = function() {
if (this.Nb === Gt)
for (var a = this.Qb.iterator; a.next(); ) {
var b = a.value;
if (b instanceof Ft) {
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);
Fu(this, b, c, d);
}
}
}
else {
a = [];
for (b = this.Qb.iterator; b.next(); )
(c = b.value), c instanceof Ft && a.push(c);
switch (this.sorting) {
case Wt:
break;
case Xt:
a.reverse();
break;
case Yt:
a.sort(this.comparer);
break;
case Zt:
a.sort(this.comparer);
a.reverse();
break;
default:
C('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];
Fu(this, e, b + e.ka.x, c + e.ka.y);
switch (this.Nb) {
case Dt:
c += e.Ca.height + this.Td.height;
break;
case Gu:
b += e.Ca.width + this.Td.width;
break;
default:
C('Unhandled arrangement value ' + this.Nb.toString());
}
}
}
};
function Fu(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];
Fu(a, g, c + g.S.x, d + g.S.y);
}
}
}
yt.prototype.commitLayout = function() {
this.ev();
this.commitNodes();
this.nu();
this.isRouting && this.commitLinks();
};
yt.prototype.commitNodes = function() {
for (var a = this.network.vertexes.iterator; a.next(); ) a.value.commit();
for (a.reset(); a.next(); ) this.layoutComments(a.value);
};
yt.prototype.nu = function() {
if (this.layerStyle === Ot) {
for (
var a = this.Ev, b = [], c = null, d = this.network.vertexes.iterator;
d.next();
) {
var e = d.value;
null === c ? (c = e.bounds.copy()) : c.Xc(e.bounds);
var f = b[e.level];
void 0 === f ? (f = mu(e)) : (f = Math.max(f, mu(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.vc(this.nodeSpacing / 2, this.layerSpacing),
(d = new I(-this.nodeSpacing / 2, -this.layerSpacing / 2)))
: (c.vc(this.layerSpacing, this.nodeSpacing / 2),
(d = new I(-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 M(0, f, c, h)))
: 90 === this.angle
? (e.push(new M(0, f, c, h)), (f += h))
: 180 === this.angle
? ((f -= h), e.push(new M(f, 0, h, c)))
: (e.push(new M(f, 0, h, c)), (f += h));
}
this.commitLayers(e, d);
}
};
yt.prototype.commitLayers = function() {};
yt.prototype.commitLinks = function() {
for (var a = this.network.edges.iterator; a.next(); ) a.value.commit();
};
yt.prototype.ev = function() {
for (var a = this.Qb.iterator; a.next(); ) {
var b = a.value;
b instanceof Ft && Hu(this, b);
}
};
function Hu(a, b) {
if (null !== b) {
a.setPortSpots(b);
b = b.children;
for (var c = b.length, d = 0; d < c; d++) Hu(a, b[d]);
}
}
yt.prototype.setPortSpots = function(a) {
var b = a.alignment;
if ($t(b)) {
var c = this.qd === At,
d = ku(a);
switch (d) {
case 0:
var e = ed;
break;
case 90:
e = fd;
break;
case 180:
e = dd;
break;
default:
e = ad;
}
var f = a.children,
g = f.length;
switch (b) {
case au:
case Rt:
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 ? dd : ad;
if (1 === g || (b === g - 1 && 1 === g % 2))
switch (d) {
case 0:
k = dd;
break;
case 90:
k = ad;
break;
case 180:
k = ed;
break;
default:
k = fd;
}
else 0 === b % 2 && (k = 90 === d || 270 === d ? ed : fd);
c
? (a.setsPortSpot && (h.fromSpot = e),
a.setsChildPortSpot && (h.toSpot = k))
: (a.setsPortSpot && (h.fromSpot = k),
a.setsChildPortSpot && (h.toSpot = e));
}
}
break;
case bu:
d = 90 === d || 270 === d ? ed : fd;
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 cu:
for (
d = 90 === d || 270 === d ? dd : ad,
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 = ku(a)), this.qd === At))
for (e = a.destinationEdges; e.next(); ) {
if (((d = e.value.link), null !== d)) {
if (a.setsPortSpot)
if (a.portSpot.Sb())
switch (c) {
case 0:
d.fromSpot = ed;
break;
case 90:
d.fromSpot = fd;
break;
case 180:
d.fromSpot = dd;
break;
default:
d.fromSpot = ad;
}
else d.fromSpot = a.portSpot;
if (a.setsChildPortSpot)
if (a.childPortSpot.Sb())
switch (c) {
case 0:
d.toSpot = dd;
break;
case 90:
d.toSpot = ad;
break;
case 180:
d.toSpot = ed;
break;
default:
d.toSpot = fd;
}
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.Sb())
switch (c) {
case 0:
d.toSpot = ed;
break;
case 90:
d.toSpot = fd;
break;
case 180:
d.toSpot = dd;
break;
default:
d.toSpot = ad;
}
else d.toSpot = a.portSpot;
if (a.setsChildPortSpot)
if (a.childPortSpot.Sb())
switch (c) {
case 0:
d.fromSpot = dd;
break;
case 90:
d.fromSpot = ad;
break;
case 180:
d.fromSpot = ed;
break;
default:
d.fromSpot = fd;
}
else d.fromSpot = a.childPortSpot;
}
};
function ku(a) {
a = a.angle;
return 45 >= a ? 0 : 135 >= a ? 90 : 225 >= a ? 180 : 315 >= a ? 270 : 0;
}
function mu(a) {
var b = ku(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 nu(a) {
var b = ku(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(yt.prototype, {
roots: {
get: function() {
return this.Qb;
},
set: function(a) {
this.Qb !== a && ((this.Qb = a), this.D());
},
},
path: {
get: function() {
return this.En;
},
set: function(a) {
this.En !== a && ((this.En = a), this.D());
},
},
treeStyle: {
get: function() {
return this.Yn;
},
set: function(a) {
this.Nb === a ||
(a !== Bt && a !== Ut && a !== Vt && a !== Tt) ||
((this.Yn = a), this.D());
},
},
layerStyle: {
get: function() {
return this.aq;
},
set: function(a) {
this.Nb === a ||
(a !== Ct && a !== Pt && a !== Ot) ||
((this.aq = a), this.D());
},
},
comments: {
get: function() {
return this.od;
},
set: function(a) {
this.od !== a && ((this.od = a), this.D());
},
},
arrangement: {
get: function() {
return this.Nb;
},
set: function(a) {
this.Nb === a ||
(a !== Dt && a !== Gu && a !== Gt) ||
((this.Nb = a), this.D());
},
},
arrangementSpacing: {
get: function() {
return this.Td;
},
set: function(a) {
this.Td.C(a) || (this.Td.assign(a), this.D());
},
},
rootDefaults: {
get: function() {
return this.V;
},
set: function(a) {
this.V !== a && ((this.V = a), this.D());
},
},
alternateDefaults: {
get: function() {
return this.Y;
},
set: function(a) {
this.Y !== a && ((this.Y = a), this.D());
},
},
sorting: {
get: function() {
return this.V.sorting;
},
set: function(a) {
this.V.sorting === a ||
(a !== Wt && a !== Xt && a !== Yt && !Zt) ||
((this.V.sorting = a), this.D());
},
},
comparer: {
get: function() {
return this.V.comparer;
},
set: function(a) {
this.V.comparer !== a && ((this.V.comparer = a), this.D());
},
},
angle: {
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.D())
: C('TreeLayout.angle must be 0, 90, 180, or 270'));
},
},
alignment: {
get: function() {
return this.V.alignment;
},
set: function(a) {
this.V.alignment !== a && ((this.V.alignment = a), this.D());
},
},
nodeIndent: {
get: function() {
return this.V.nodeIndent;
},
set: function(a) {
this.V.nodeIndent !== a &&
0 <= a &&
((this.V.nodeIndent = a), this.D());
},
},
nodeIndentPastParent: {
get: function() {
return this.V.nodeIndentPastParent;
},
set: function(a) {
this.V.nodeIndentPastParent !== a &&
0 <= a &&
1 >= a &&
((this.V.nodeIndentPastParent = a), this.D());
},
},
nodeSpacing: {
get: function() {
return this.V.nodeSpacing;
},
set: function(a) {
this.V.nodeSpacing !== a && ((this.V.nodeSpacing = a), this.D());
},
},
layerSpacing: {
get: function() {
return this.V.layerSpacing;
},
set: function(a) {
this.V.layerSpacing !== a && ((this.V.layerSpacing = a), this.D());
},
},
layerSpacingParentOverlap: {
get: function() {
return this.V.layerSpacingParentOverlap;
},
set: function(a) {
this.V.layerSpacingParentOverlap !== a &&
0 <= a &&
1 >= a &&
((this.V.layerSpacingParentOverlap = a), this.D());
},
},
compaction: {
get: function() {
return this.V.compaction;
},
set: function(a) {
this.V.compaction === a ||
(a !== fu && a !== hu) ||
((this.V.compaction = a), this.D());
},
},
breadthLimit: {
get: function() {
return this.V.breadthLimit;
},
set: function(a) {
this.V.breadthLimit !== a &&
0 <= a &&
((this.V.breadthLimit = a), this.D());
},
},
rowSpacing: {
get: function() {
return this.V.rowSpacing;
},
set: function(a) {
this.V.rowSpacing !== a && ((this.V.rowSpacing = a), this.D());
},
},
rowIndent: {
get: function() {
return this.V.rowIndent;
},
set: function(a) {
this.V.rowIndent !== a && 0 <= a && ((this.V.rowIndent = a), this.D());
},
},
commentSpacing: {
get: function() {
return this.V.commentSpacing;
},
set: function(a) {
this.V.commentSpacing !== a && ((this.V.commentSpacing = a), this.D());
},
},
commentMargin: {
get: function() {
return this.V.commentMargin;
},
set: function(a) {
this.V.commentMargin !== a && ((this.V.commentMargin = a), this.D());
},
},
setsPortSpot: {
get: function() {
return this.V.setsPortSpot;
},
set: function(a) {
this.V.setsPortSpot !== a && ((this.V.setsPortSpot = a), this.D());
},
},
portSpot: {
get: function() {
return this.V.portSpot;
},
set: function(a) {
this.V.portSpot.C(a) || ((this.V.portSpot = a), this.D());
},
},
setsChildPortSpot: {
get: function() {
return this.V.setsChildPortSpot;
},
set: function(a) {
this.V.setsChildPortSpot !== a &&
((this.V.setsChildPortSpot = a), this.D());
},
},
childPortSpot: {
get: function() {
return this.V.childPortSpot;
},
set: function(a) {
this.V.childPortSpot.C(a) || ((this.V.childPortSpot = a), this.D());
},
},
alternateSorting: {
get: function() {
return this.Y.sorting;
},
set: function(a) {
this.Y.sorting === a ||
(a !== Wt && a !== Xt && a !== Yt && !Zt) ||
((this.Y.sorting = a), this.D());
},
},
alternateComparer: {
get: function() {
return this.Y.comparer;
},
set: function(a) {
this.Y.comparer !== a && ((this.Y.comparer = a), this.D());
},
},
alternateAngle: {
get: function() {
return this.Y.angle;
},
set: function(a) {
this.Y.angle === a ||
(0 !== a && 90 !== a && 180 !== a && 270 !== a) ||
((this.Y.angle = a), this.D());
},
},
alternateAlignment: {
get: function() {
return this.Y.alignment;
},
set: function(a) {
this.Y.alignment !== a && ((this.Y.alignment = a), this.D());
},
},
alternateNodeIndent: {
get: function() {
return this.Y.nodeIndent;
},
set: function(a) {
this.Y.nodeIndent !== a &&
0 <= a &&
((this.Y.nodeIndent = a), this.D());
},
},
alternateNodeIndentPastParent: {
get: function() {
return this.Y.nodeIndentPastParent;
},
set: function(a) {
this.Y.nodeIndentPastParent !== a &&
0 <= a &&
1 >= a &&
((this.Y.nodeIndentPastParent = a), this.D());
},
},
alternateNodeSpacing: {
get: function() {
return this.Y.nodeSpacing;
},
set: function(a) {
this.Y.nodeSpacing !== a && ((this.Y.nodeSpacing = a), this.D());
},
},
alternateLayerSpacing: {
get: function() {
return this.Y.layerSpacing;
},
set: function(a) {
this.Y.layerSpacing !== a && ((this.Y.layerSpacing = a), this.D());
},
},
alternateLayerSpacingParentOverlap: {
get: function() {
return this.Y.layerSpacingParentOverlap;
},
set: function(a) {
this.Y.layerSpacingParentOverlap !== a &&
0 <= a &&
1 >= a &&
((this.Y.layerSpacingParentOverlap = a), this.D());
},
},
alternateCompaction: {
get: function() {
return this.Y.compaction;
},
set: function(a) {
this.Y.compaction === a ||
(a !== fu && a !== hu) ||
((this.Y.compaction = a), this.D());
},
},
alternateBreadthLimit: {
get: function() {
return this.Y.breadthLimit;
},
set: function(a) {
this.Y.breadthLimit !== a &&
0 <= a &&
((this.Y.breadthLimit = a), this.D());
},
},
alternateRowSpacing: {
get: function() {
return this.Y.rowSpacing;
},
set: function(a) {
this.Y.rowSpacing !== a && ((this.Y.rowSpacing = a), this.D());
},
},
alternateRowIndent: {
get: function() {
return this.Y.rowIndent;
},
set: function(a) {
this.Y.rowIndent !== a && 0 <= a && ((this.Y.rowIndent = a), this.D());
},
},
alternateCommentSpacing: {
get: function() {
return this.Y.commentSpacing;
},
set: function(a) {
this.Y.commentSpacing !== a && ((this.Y.commentSpacing = a), this.D());
},
},
alternateCommentMargin: {
get: function() {
return this.Y.commentMargin;
},
set: function(a) {
this.Y.commentMargin !== a && ((this.Y.commentMargin = a), this.D());
},
},
alternateSetsPortSpot: {
get: function() {
return this.Y.setsPortSpot;
},
set: function(a) {
this.Y.setsPortSpot !== a && ((this.Y.setsPortSpot = a), this.D());
},
},
alternatePortSpot: {
get: function() {
return this.Y.portSpot;
},
set: function(a) {
this.Y.portSpot.C(a) || ((this.Y.portSpot = a), this.D());
},
},
alternateSetsChildPortSpot: {
get: function() {
return this.Y.setsChildPortSpot;
},
set: function(a) {
this.Y.setsChildPortSpot !== a &&
((this.Y.setsChildPortSpot = a), this.D());
},
},
alternateChildPortSpot: {
get: function() {
return this.Y.childPortSpot;
},
set: function(a) {
this.Y.childPortSpot.C(a) || ((this.Y.childPortSpot = a), this.D());
},
},
});
var zt = new D(yt, 'PathDefault', -1),
At = new D(yt, 'PathDestination', 0),
Ht = new D(yt, 'PathSource', 1),
Wt = new D(yt, 'SortingForwards', 10),
Xt = new D(yt, 'SortingReverse', 11),
Yt = new D(yt, 'SortingAscending', 12),
Zt = new D(yt, 'SortingDescending', 13),
xu = new D(yt, 'AlignmentCenterSubtrees', 20),
yu = new D(yt, 'AlignmentCenterChildren', 21),
ou = new D(yt, 'AlignmentStart', 22),
lu = new D(yt, 'AlignmentEnd', 23),
au = new D(yt, 'AlignmentBus', 24),
Rt = new D(yt, 'AlignmentBusBranching', 25),
bu = new D(yt, 'AlignmentTopLeftBus', 26),
cu = new D(yt, 'AlignmentBottomRightBus', 27),
fu = new D(yt, 'CompactionNone', 30),
hu = new D(yt, 'CompactionBlock', 31),
Bt = new D(yt, 'StyleLayered', 40),
Vt = new D(yt, 'StyleLastParents', 41),
Ut = new D(yt, 'StyleAlternating', 42),
Tt = new D(yt, 'StyleRootOnly', 43),
Dt = new D(yt, 'ArrangementVertical', 50),
Gu = new D(yt, 'ArrangementHorizontal', 51),
Gt = new D(yt, 'ArrangementFixedRoots', 52),
Ct = new D(yt, 'LayerIndividual', 60),
Pt = new D(yt, 'LayerSiblings', 61),
Ot = new D(yt, 'LayerUniform', 62);
yt.className = 'TreeLayout';
yt.PathDefault = zt;
yt.PathDestination = At;
yt.PathSource = Ht;
yt.SortingForwards = Wt;
yt.SortingReverse = Xt;
yt.SortingAscending = Yt;
yt.SortingDescending = Zt;
yt.AlignmentCenterSubtrees = xu;
yt.AlignmentCenterChildren = yu;
yt.AlignmentStart = ou;
yt.AlignmentEnd = lu;
yt.AlignmentBus = au;
yt.AlignmentBusBranching = Rt;
yt.AlignmentTopLeftBus = bu;
yt.AlignmentBottomRightBus = cu;
yt.CompactionNone = fu;
yt.CompactionBlock = hu;
yt.StyleLayered = Bt;
yt.StyleLastParents = Vt;
yt.StyleAlternating = Ut;
yt.StyleRootOnly = Tt;
yt.ArrangementVertical = Dt;
yt.ArrangementHorizontal = Gu;
yt.ArrangementFixedRoots = Gt;
yt.LayerIndividual = Ct;
yt.LayerSiblings = Pt;
yt.LayerUniform = Ot;
function Et(a) {
eq.call(this, a);
}
la(Et, eq);
Et.prototype.createVertex = function() {
return new Ft(this);
};
Et.prototype.createEdge = function() {
return new Iu(this);
};
Et.className = 'TreeNetwork';
function Ft(a) {
sq.call(this, a);
this.W = !1;
this.cb = null;
this.u = [];
this.hb = this.Ga = this.F = this.ga = 0;
this.od = null;
this.S = new I(0, 0);
this.Ca = new K(0, 0);
this.ka = new I(0, 0);
this.Ql = this.Pl = this.Xz = !1;
this.No = this.Bo = null;
this.fd = Wt;
this.Zc = zq;
this.Gb = 0;
this.Fb = yu;
this.uq = this.tq = 0;
this.vq = 20;
this.be = 50;
this.$p = 0;
this.kp = hu;
this.cp = 0;
this.Mq = 25;
this.jp = this.Lq = 10;
this.ip = 20;
this.Uq = !0;
this.Cq = Wc;
this.Tq = !0;
this.gp = Wc;
}
la(Ft, sq);
Ft.prototype.copyInheritedPropertiesFrom = function(a) {
null !== a &&
((this.fd = a.sorting),
(this.Zc = a.comparer),
(this.Gb = a.angle),
(this.Fb = a.alignment),
(this.tq = a.nodeIndent),
(this.uq = a.nodeIndentPastParent),
(this.vq = a.nodeSpacing),
(this.be = a.layerSpacing),
(this.$p = a.layerSpacingParentOverlap),
(this.kp = a.compaction),
(this.cp = a.breadthLimit),
(this.Mq = a.rowSpacing),
(this.Lq = a.rowIndent),
(this.jp = a.commentSpacing),
(this.ip = a.commentMargin),
(this.Uq = a.setsPortSpot),
(this.Cq = a.portSpot),
(this.Tq = a.setsChildPortSpot),
(this.gp = a.childPortSpot));
};
ma.Object.defineProperties(Ft.prototype, {
initialized: {
get: function() {
return this.W;
},
set: function(a) {
this.W !== a && (this.W = a);
},
},
parent: {
get: function() {
return this.cb;
},
set: function(a) {
this.cb !== a && (this.cb = a);
},
},
children: {
get: function() {
return this.u;
},
set: function(a) {
if (this.u !== a) {
if (null !== a) for (var b = a.length, c = 0; c < b; c++);
this.u = a;
}
},
},
level: {
get: function() {
return this.ga;
},
set: function(a) {
this.ga !== a && (this.ga = a);
},
},
descendantCount: {
get: function() {
return this.F;
},
set: function(a) {
this.F !== a && (this.F = a);
},
},
maxChildrenCount: {
get: function() {
return this.Ga;
},
set: function(a) {
this.Ga !== a && (this.Ga = a);
},
},
maxGenerationCount: {
get: function() {
return this.hb;
},
set: function(a) {
this.hb !== a && (this.hb = a);
},
},
comments: {
get: function() {
return this.od;
},
set: function(a) {
if (this.od !== a) {
if (null !== a) for (var b = a.length, c = 0; c < b; c++);
this.od = a;
}
},
},
sorting: {
get: function() {
return this.fd;
},
set: function(a) {
this.fd !== a && (this.fd = a);
},
},
comparer: {
get: function() {
return this.Zc;
},
set: function(a) {
this.Zc !== a && (this.Zc = a);
},
},
angle: {
get: function() {
return this.Gb;
},
set: function(a) {
this.Gb !== a && (this.Gb = a);
},
},
alignment: {
get: function() {
return this.Fb;
},
set: function(a) {
this.Fb !== a && (this.Fb = a);
},
},
nodeIndent: {
get: function() {
return this.tq;
},
set: function(a) {
this.tq !== a && (this.tq = a);
},
},
nodeIndentPastParent: {
get: function() {
return this.uq;
},
set: function(a) {
this.uq !== a && (this.uq = a);
},
},
nodeSpacing: {
get: function() {
return this.vq;
},
set: function(a) {
this.vq !== a && (this.vq = a);
},
},
layerSpacing: {
get: function() {
return this.be;
},
set: function(a) {
this.be !== a && (this.be = a);
},
},
layerSpacingParentOverlap: {
get: function() {
return this.$p;
},
set: function(a) {
this.$p !== a && (this.$p = a);
},
},
compaction: {
get: function() {
return this.kp;
},
set: function(a) {
this.kp !== a && (this.kp = a);
},
},
breadthLimit: {
get: function() {
return this.cp;
},
set: function(a) {
this.cp !== a && (this.cp = a);
},
},
rowSpacing: {
get: function() {
return this.Mq;
},
set: function(a) {
this.Mq !== a && (this.Mq = a);
},
},
rowIndent: {
get: function() {
return this.Lq;
},
set: function(a) {
this.Lq !== a && (this.Lq = a);
},
},
commentSpacing: {
get: function() {
return this.jp;
},
set: function(a) {
this.jp !== a && (this.jp = a);
},
},
commentMargin: {
get: function() {
return this.ip;
},
set: function(a) {
this.ip !== a && (this.ip = a);
},
},
setsPortSpot: {
get: function() {
return this.Uq;
},
set: function(a) {
this.Uq !== a && (this.Uq = a);
},
},
portSpot: {
get: function() {
return this.Cq;
},
set: function(a) {
this.Cq.C(a) || (this.Cq = a);
},
},
setsChildPortSpot: {
get: function() {
return this.Tq;
},
set: function(a) {
this.Tq !== a && (this.Tq = a);
},
},
childPortSpot: {
get: function() {
return this.gp;
},
set: function(a) {
this.gp.C(a) || (this.gp = a);
},
},
childrenCount: {
get: function() {
return this.children.length;
},
},
relativePosition: {
get: function() {
return this.S;
},
set: function(a) {
this.S.set(a);
},
},
subtreeSize: {
get: function() {
return this.Ca;
},
set: function(a) {
this.Ca.set(a);
},
},
subtreeOffset: {
get: function() {
return this.ka;
},
set: function(a) {
this.ka.set(a);
},
},
});
Ft.className = 'TreeVertex';
function Iu(a) {
tq.call(this, a);
this.Ft = new I(0, 0);
}
la(Iu, tq);
Iu.prototype.commit = function() {
var a = this.link;
if (null !== a && !a.isAvoiding) {
var b = this.network.layout,
c = null,
d = null;
switch (b.qd) {
case At:
c = this.fromVertex;
d = this.toVertex;
break;
case Ht:
c = this.toVertex;
d = this.fromVertex;
break;
default:
C('Unhandled path value ' + b.qd.toString());
}
if (null !== c && null !== d)
if (((b = this.Ft), 0 !== b.x || 0 !== b.y || c.Xz)) {
d = c.bounds;
var e = ku(c),
f = mu(c),
g = c.rowSpacing;
a.mg();
var h = a.curve === cg,
k = a.isOrthogonal,
l;
a.jh();
if (k || h) {
for (l = 2; 4 < a.pointsCount; ) a.Yu(2);
var m = a.i(1);
var n = a.i(2);
} else {
for (l = 1; 3 < a.pointsCount; ) a.Yu(1);
m = a.i(0);
n = a.i(a.pointsCount - 1);
}
var p = a.i(a.pointsCount - 1);
0 === e
? (c.alignment === lu
? ((e = d.bottom + b.y),
0 === b.y &&
m.y > p.y + c.rowIndent &&
(e = Math.min(e, Math.max(m.y, e - nu(c)))))
: c.alignment === ou
? ((e = d.top + b.y),
0 === b.y &&
m.y < p.y - c.rowIndent &&
(e = Math.max(e, Math.min(m.y, e + nu(c)))))
: (e =
c.Pl || (c.Ql && 1 === c.maxGenerationCount)
? d.top - c.ka.y + b.y
: d.y + d.height / 2 + b.y),
h
? (a.l(l, m.x, e),
l++,
a.l(l, d.right + f, e),
l++,
a.l(l, d.right + f + (b.x - g) / 3, e),
l++,
a.l(l, d.right + f + (2 * (b.x - g)) / 3, e),
l++,
a.l(l, d.right + f + (b.x - g), e),
l++,
a.l(l, n.x, e))
: (k && (a.l(l, d.right + f / 2, m.y), l++),
a.l(l, d.right + f / 2, e),
l++,
a.l(l, d.right + f + b.x - (k ? g / 2 : g), e),
l++,
k && a.l(l, a.i(l - 1).x, n.y)))
: 90 === e
? (c.alignment === lu
? ((e = d.right + b.x),
0 === b.x &&
m.x > p.x + c.rowIndent &&
(e = Math.min(e, Math.max(m.x, e - nu(c)))))
: c.alignment === ou
? ((e = d.left + b.x),
0 === b.x &&
m.x < p.x - c.rowIndent &&
(e = Math.max(e, Math.min(m.x, e + nu(c)))))
: (e =
c.Pl || (c.Ql && 1 === c.maxGenerationCount)
? d.left - c.ka.x + b.x
: d.x + d.width / 2 + b.x),
h
? (a.l(l, e, m.y),
l++,
a.l(l, e, d.bottom + f),
l++,
a.l(l, e, d.bottom + f + (b.y - g) / 3),
l++,
a.l(l, e, d.bottom + f + (2 * (b.y - g)) / 3),
l++,
a.l(l, e, d.bottom + f + (b.y - g)),
l++,
a.l(l, e, n.y))
: (k && (a.l(l, m.x, d.bottom + f / 2), l++),
a.l(l, e, d.bottom + f / 2),
l++,
a.l(l, e, d.bottom + f + b.y - (k ? g / 2 : g)),
l++,
k && a.l(l, n.x, a.i(l - 1).y)))
: 180 === e
? (c.alignment === lu
? ((e = d.bottom + b.y),
0 === b.y &&
m.y > p.y + c.rowIndent &&
(e = Math.min(e, Math.max(m.y, e - nu(c)))))
: c.alignment === ou
? ((e = d.top + b.y),
0 === b.y &&
m.y < p.y - c.rowIndent &&
(e = Math.max(e, Math.min(m.y, e + nu(c)))))
: (e =
c.Pl || (c.Ql && 1 === c.maxGenerationCount)
? d.top - c.ka.y + b.y
: d.y + d.height / 2 + b.y),
h
? (a.l(l, m.x, e),
l++,
a.l(l, d.left - f, e),
l++,
a.l(l, d.left - f + (b.x + g) / 3, e),
l++,
a.l(l, d.left - f + (2 * (b.x + g)) / 3, e),
l++,
a.l(l, d.left - f + (b.x + g), e),
l++,
a.l(l, n.x, e))
: (k && (a.l(l, d.left - f / 2, m.y), l++),
a.l(l, d.left - f / 2, e),
l++,
a.l(l, d.left - f + b.x + (k ? g / 2 : g), e),
l++,
k && a.l(l, a.i(l - 1).x, n.y)))
: 270 === e
? (c.alignment === lu
? ((e = d.right + b.x),
0 === b.x &&
m.x > p.x + c.rowIndent &&
(e = Math.min(e, Math.max(m.x, e - nu(c)))))
: c.alignment === ou
? ((e = d.left + b.x),
0 === b.x &&
m.x < p.x - c.rowIndent &&
(e = Math.max(e, Math.min(m.x, e + nu(c)))))
: (e =
c.Pl || (c.Ql && 1 === c.maxGenerationCount)
? d.left - c.ka.x + b.x
: d.x + d.width / 2 + b.x),
h
? (a.l(l, e, m.y),
l++,
a.l(l, e, d.top - f),
l++,
a.l(l, e, d.top - f + (b.y + g) / 3),
l++,
a.l(l, e, d.top - f + (2 * (b.y + g)) / 3),
l++,
a.l(l, e, d.top - f + (b.y + g)),
l++,
a.l(l, e, n.y))
: (k && (a.l(l, m.x, d.top - f / 2), l++),
a.l(l, e, d.top - f / 2),
l++,
a.l(l, e, d.top - f + b.y + (k ? g / 2 : g)),
l++,
k && a.l(l, n.x, a.i(l - 1).y)))
: C('Invalid angle ' + e);
a.pf();
} else
(a = this.link),
(f = ku(c)),
f !== ku(d) &&
((g = mu(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.mg(),
(c = a.curve === cg),
(b = a.isOrthogonal),
(d = $t(this.fromVertex.alignment)),
a.jh(),
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.l(2, f - 20, c),
a.l(3, f, c),
a.l(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.l(2, f, a.i(2).y)
: 3 === a.pointsCount
? a.M(1, f, a.i(2).y)
: 2 === a.pointsCount && a.l(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.l(2, c, f - 20),
a.l(3, c, f),
a.l(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.l(2, a.i(2).x, f)
: 3 === a.pointsCount
? a.M(1, a.i(2).x, f)
: 2 === a.pointsCount && a.l(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.l(2, f + 20, c),
a.l(3, f, c),
a.l(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.l(2, f, a.i(2).y)
: 3 === a.pointsCount
? a.M(1, f, a.i(2).y)
: 2 === a.pointsCount && a.l(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.l(2, c, f + 20),
a.l(3, c, f),
a.l(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.l(2, a.i(2).x, f)
: 3 === a.pointsCount
? a.M(1, a.i(2).x, f)
: 2 === a.pointsCount && a.l(1, a.i(1).x, f)),
a.pf()));
}
};
ma.Object.defineProperties(Iu.prototype, {
fromVertex: {
get: function() {
return this.ad;
},
set: function(a) {
this.ad !== a && (this.ad = a);
},
},
toVertex: {
get: function() {
return this.jd;
},
set: function(a) {
this.jd !== a && (this.jd = a);
},
},
relativePoint: {
get: function() {
return this.Ft;
},
set: function(a) {
this.Ft.set(a);
},
},
});
Iu.className = 'TreeEdge';
La.prototype.initializeStandardTools = function() {
this.gb('Action', new qg(), this.mouseDownTools);
this.gb('Relinking', new Se(), this.mouseDownTools);
this.gb('LinkReshaping', new ag(), this.mouseDownTools);
this.gb('Rotating', new og(), this.mouseDownTools);
this.gb('Resizing', new hg(), this.mouseDownTools);
this.gb('Linking', new Uf(), this.mouseMoveTools);
this.gb('Dragging', new Be(), this.mouseMoveTools);
this.gb('DragSelecting', new Bg(), this.mouseMoveTools);
this.gb('Panning', new Cg(), this.mouseMoveTools);
this.gb('ContextMenu', new Eg(), this.mouseUpTools);
this.gb('TextEditing', new Pg(), this.mouseUpTools);
this.gb('ClickCreating', new rg(), this.mouseUpTools);
this.gb('ClickSelecting', new pg(), this.mouseUpTools);
};
rn('Horizontal', new vm());
rn('Spot', new xm());
rn('Table', new Cm());
rn('Viewbox', new Hm());
rn('TableRow', new Fm());
rn('TableColumn', new Gm());
rn('Graduated', new Rm());
rn('Grid', new Im());
li.add('GraphLinksModel', Sq);
li.add('TreeModel', fr);
kq(ms, null);
kq(Bs, null);
var Ju = x.go,
Ku = {
get licenseKey() {
return Q.licenseKey;
},
set licenseKey(a) {
Q.licenseKey = a;
},
get version() {
return Q.version;
},
Group: qf,
EnumValue: D,
List: E,
Set: G,
Map: pb,
Point: I,
Size: K,
Rect: M,
Margin: ec,
Spot: N,
Geometry: O,
PathFigure: Xd,
PathSegment: Yd,
InputEvent: $d,
DiagramEvent: be,
ChangedEvent: ce,
Model: Z,
GraphLinksModel: Ar,
TreeModel: Fr,
Binding: wi,
Transaction: he,
UndoManager: ie,
CommandHandler: Rk,
Tool: ke,
DraggingTool: Be,
DraggingInfo: Te,
DraggingOptions: Ce,
LinkingBaseTool: Bf,
LinkingTool: Uf,
RelinkingTool: Se,
LinkReshapingTool: ag,
ResizingTool: hg,
RotatingTool: og,
ClickSelectingTool: pg,
ActionTool: qg,
ClickCreatingTool: rg,
HTMLInfo: ze,
ContextMenuTool: Eg,
DragSelectingTool: Bg,
PanningTool: Cg,
TextEditingTool: Pg,
ToolManager: La,
Animation: kh,
AnimationManager: gh,
AnimationTrigger: Zh,
Layer: di,
Diagram: Q,
Palette: Kk,
Overview: Nk,
Brush: nl,
GraphObject: Y,
Panel: W,
RowColumnDefinition: Oj,
Shape: Cf,
TextBlock: Qg,
Picture: Wj,
Part: U,
Adornment: ue,
Node: V,
Link: T,
Placeholder: jg,
Layout: qi,
LayoutNetwork: eq,
LayoutVertex: sq,
LayoutEdge: tq,
GridLayout: Mk,
PanelLayout: Ll,
CircularLayout: Gr,
CircularNetwork: Xr,
CircularVertex: ks,
CircularEdge: ls,
ForceDirectedLayout: ms,
ForceDirectedNetwork: ns,
ForceDirectedVertex: zs,
ForceDirectedEdge: As,
LayeredDigraphLayout: Bs,
LayeredDigraphNetwork: Gs,
LayeredDigraphVertex: wt,
LayeredDigraphEdge: xt,
TreeLayout: yt,
TreeNetwork: Et,
TreeVertex: Ft,
TreeEdge: Iu,
};
'object' === typeof Ju &&
Ju.version &&
xa(
'WARNING: a `go` object on the root object is already defined. ' +
('Debug' in Ju ? 'debug ' : '') +
'version: ' +
Ju.version +
', replaced with version: ' +
Ku.version,
);
Q.prototype.go = Ku;
x.go = Ku;
'undefined' !== typeof module &&
'object' === typeof module.exports &&
(module.exports = 'undefined' !== typeof global ? global.go : self.go);
})();
'function' === typeof define &&
define.amd &&
define('undefined' !== typeof global ? global.go : self.go);